Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 1 | /* |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 2 | * arch/arm/mach-orion5x/kurobox_pro-setup.c |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 3 | * |
| 4 | * Maintainer: Ronen Shitrit <rshitrit@marvell.com> |
| 5 | * |
Lennert Buytenhek | 159ffb3 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 6 | * This file is licensed under the terms of the GNU General Public |
| 7 | * License version 2. This program is licensed "as is" without any |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 8 | * warranty of any kind, whether express or implied. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/pci.h> |
| 15 | #include <linux/irq.h> |
| 16 | #include <linux/mtd/physmap.h> |
| 17 | #include <linux/mtd/nand.h> |
| 18 | #include <linux/mv643xx_eth.h> |
| 19 | #include <linux/i2c.h> |
Byron Bradley | 3b277c2 | 2008-02-08 18:20:01 +0000 | [diff] [blame] | 20 | #include <linux/ata_platform.h> |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 21 | #include <asm/mach-types.h> |
| 22 | #include <asm/gpio.h> |
| 23 | #include <asm/mach/arch.h> |
| 24 | #include <asm/mach/pci.h> |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 25 | #include <asm/arch/orion5x.h> |
Lennert Buytenhek | 5d4294c | 2008-03-27 14:51:40 -0400 | [diff] [blame] | 26 | #include <asm/plat-orion/orion_nand.h> |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 27 | #include "common.h" |
| 28 | |
| 29 | /***************************************************************************** |
| 30 | * KUROBOX-PRO Info |
| 31 | ****************************************************************************/ |
| 32 | |
| 33 | /* |
| 34 | * 256K NOR flash Device bus boot chip select |
| 35 | */ |
| 36 | |
| 37 | #define KUROBOX_PRO_NOR_BOOT_BASE 0xf4000000 |
| 38 | #define KUROBOX_PRO_NOR_BOOT_SIZE SZ_256K |
| 39 | |
| 40 | /* |
| 41 | * 256M NAND flash on Device bus chip select 1 |
| 42 | */ |
| 43 | |
| 44 | #define KUROBOX_PRO_NAND_BASE 0xfc000000 |
| 45 | #define KUROBOX_PRO_NAND_SIZE SZ_2M |
| 46 | |
| 47 | /***************************************************************************** |
| 48 | * 256MB NAND Flash on Device bus CS0 |
| 49 | ****************************************************************************/ |
| 50 | |
| 51 | static struct mtd_partition kurobox_pro_nand_parts[] = { |
| 52 | { |
| 53 | .name = "uImage", |
| 54 | .offset = 0, |
| 55 | .size = SZ_4M, |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 56 | }, { |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 57 | .name = "rootfs", |
| 58 | .offset = SZ_4M, |
| 59 | .size = SZ_64M, |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 60 | }, { |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 61 | .name = "extra", |
| 62 | .offset = SZ_4M + SZ_64M, |
| 63 | .size = SZ_256M - (SZ_4M + SZ_64M), |
| 64 | }, |
| 65 | }; |
| 66 | |
| 67 | static struct resource kurobox_pro_nand_resource = { |
| 68 | .flags = IORESOURCE_MEM, |
| 69 | .start = KUROBOX_PRO_NAND_BASE, |
| 70 | .end = KUROBOX_PRO_NAND_BASE + KUROBOX_PRO_NAND_SIZE - 1, |
| 71 | }; |
| 72 | |
| 73 | static struct orion_nand_data kurobox_pro_nand_data = { |
| 74 | .parts = kurobox_pro_nand_parts, |
| 75 | .nr_parts = ARRAY_SIZE(kurobox_pro_nand_parts), |
| 76 | .cle = 0, |
| 77 | .ale = 1, |
| 78 | .width = 8, |
| 79 | }; |
| 80 | |
| 81 | static struct platform_device kurobox_pro_nand_flash = { |
| 82 | .name = "orion_nand", |
| 83 | .id = -1, |
| 84 | .dev = { |
| 85 | .platform_data = &kurobox_pro_nand_data, |
| 86 | }, |
| 87 | .resource = &kurobox_pro_nand_resource, |
| 88 | .num_resources = 1, |
| 89 | }; |
| 90 | |
| 91 | /***************************************************************************** |
| 92 | * 256KB NOR Flash on BOOT Device |
| 93 | ****************************************************************************/ |
| 94 | |
| 95 | static struct physmap_flash_data kurobox_pro_nor_flash_data = { |
| 96 | .width = 1, |
| 97 | }; |
| 98 | |
| 99 | static struct resource kurobox_pro_nor_flash_resource = { |
| 100 | .flags = IORESOURCE_MEM, |
| 101 | .start = KUROBOX_PRO_NOR_BOOT_BASE, |
| 102 | .end = KUROBOX_PRO_NOR_BOOT_BASE + KUROBOX_PRO_NOR_BOOT_SIZE - 1, |
| 103 | }; |
| 104 | |
| 105 | static struct platform_device kurobox_pro_nor_flash = { |
| 106 | .name = "physmap-flash", |
| 107 | .id = 0, |
| 108 | .dev = { |
| 109 | .platform_data = &kurobox_pro_nor_flash_data, |
| 110 | }, |
| 111 | .num_resources = 1, |
| 112 | .resource = &kurobox_pro_nor_flash_resource, |
| 113 | }; |
| 114 | |
| 115 | /***************************************************************************** |
| 116 | * PCI |
| 117 | ****************************************************************************/ |
| 118 | |
| 119 | static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
| 120 | { |
Lennert Buytenhek | 92b913b | 2008-04-25 16:28:33 -0400 | [diff] [blame] | 121 | int irq; |
| 122 | |
| 123 | /* |
| 124 | * Check for devices with hard-wired IRQs. |
| 125 | */ |
| 126 | irq = orion5x_pci_map_irq(dev, slot, pin); |
| 127 | if (irq != -1) |
| 128 | return irq; |
| 129 | |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 130 | /* |
| 131 | * PCI isn't used on the Kuro |
| 132 | */ |
Lennert Buytenhek | 92b913b | 2008-04-25 16:28:33 -0400 | [diff] [blame] | 133 | printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n"); |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 134 | |
| 135 | return -1; |
| 136 | } |
| 137 | |
| 138 | static struct hw_pci kurobox_pro_pci __initdata = { |
Lennert Buytenhek | bbdf1c1 | 2008-05-15 10:31:14 +0100 | [diff] [blame] | 139 | .nr_controllers = 2, |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 140 | .swizzle = pci_std_swizzle, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 141 | .setup = orion5x_pci_sys_setup, |
| 142 | .scan = orion5x_pci_sys_scan_bus, |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 143 | .map_irq = kurobox_pro_pci_map_irq, |
| 144 | }; |
| 145 | |
| 146 | static int __init kurobox_pro_pci_init(void) |
| 147 | { |
| 148 | if (machine_is_kurobox_pro()) |
| 149 | pci_common_init(&kurobox_pro_pci); |
| 150 | |
| 151 | return 0; |
| 152 | } |
| 153 | |
| 154 | subsys_initcall(kurobox_pro_pci_init); |
| 155 | |
| 156 | /***************************************************************************** |
| 157 | * Ethernet |
| 158 | ****************************************************************************/ |
| 159 | |
| 160 | static struct mv643xx_eth_platform_data kurobox_pro_eth_data = { |
| 161 | .phy_addr = 8, |
| 162 | .force_phy_addr = 1, |
| 163 | }; |
| 164 | |
| 165 | /***************************************************************************** |
| 166 | * RTC 5C372a on I2C bus |
| 167 | ****************************************************************************/ |
| 168 | static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = { |
Jean Delvare | 3760f73 | 2008-04-29 23:11:40 +0200 | [diff] [blame] | 169 | I2C_BOARD_INFO("rs5c372a", 0x32), |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 170 | }; |
| 171 | |
| 172 | /***************************************************************************** |
Byron Bradley | 3b277c2 | 2008-02-08 18:20:01 +0000 | [diff] [blame] | 173 | * SATA |
| 174 | ****************************************************************************/ |
| 175 | static struct mv_sata_platform_data kurobox_pro_sata_data = { |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 176 | .n_ports = 2, |
Byron Bradley | 3b277c2 | 2008-02-08 18:20:01 +0000 | [diff] [blame] | 177 | }; |
| 178 | |
| 179 | /***************************************************************************** |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 180 | * General Setup |
| 181 | ****************************************************************************/ |
| 182 | |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 183 | static void __init kurobox_pro_init(void) |
| 184 | { |
| 185 | /* |
| 186 | * Setup basic Orion functions. Need to be called early. |
| 187 | */ |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 188 | orion5x_init(); |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 189 | |
| 190 | /* |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 191 | * Setup Multiplexing Pins -- |
| 192 | * MPP[0-1] Not used |
| 193 | * MPP[2] GPIO Micon |
| 194 | * MPP[3] GPIO RTC |
| 195 | * MPP[4-5] Not used |
| 196 | * MPP[6] Nand Flash REn |
| 197 | * MPP[7] Nand Flash WEn |
| 198 | * MPP[8-11] Not used |
| 199 | * MPP[12] SATA 0 presence Indication |
| 200 | * MPP[13] SATA 1 presence Indication |
| 201 | * MPP[14] SATA 0 active Indication |
| 202 | * MPP[15] SATA 1 active indication |
| 203 | * MPP[16-19] Not used |
| 204 | */ |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 205 | orion5x_write(MPP_0_7_CTRL, 0x44220003); |
| 206 | orion5x_write(MPP_8_15_CTRL, 0x55550000); |
| 207 | orion5x_write(MPP_16_19_CTRL, 0x0); |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 208 | |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 209 | orion5x_gpio_set_valid_pins(0x0000000c); |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 210 | |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 211 | /* |
| 212 | * Configure peripherals. |
| 213 | */ |
| 214 | orion5x_ehci0_init(); |
| 215 | orion5x_ehci1_init(); |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 216 | orion5x_eth_init(&kurobox_pro_eth_data); |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 217 | orion5x_i2c_init(); |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 218 | orion5x_sata_init(&kurobox_pro_sata_data); |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 219 | orion5x_uart0_init(); |
| 220 | |
| 221 | orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE, |
| 222 | KUROBOX_PRO_NOR_BOOT_SIZE); |
| 223 | platform_device_register(&kurobox_pro_nor_flash); |
| 224 | |
| 225 | if (machine_is_kurobox_pro()) { |
| 226 | orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE, |
| 227 | KUROBOX_PRO_NAND_SIZE); |
| 228 | platform_device_register(&kurobox_pro_nand_flash); |
| 229 | } |
| 230 | |
| 231 | i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1); |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 232 | } |
| 233 | |
Byron Bradley | 8754925 | 2008-04-09 21:50:16 +0100 | [diff] [blame] | 234 | #ifdef CONFIG_MACH_KUROBOX_PRO |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 235 | MACHINE_START(KUROBOX_PRO, "Buffalo/Revogear Kurobox Pro") |
| 236 | /* Maintainer: Ronen Shitrit <rshitrit@marvell.com> */ |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 237 | .phys_io = ORION5X_REGS_PHYS_BASE, |
| 238 | .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC, |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 239 | .boot_params = 0x00000100, |
| 240 | .init_machine = kurobox_pro_init, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 241 | .map_io = orion5x_map_io, |
| 242 | .init_irq = orion5x_init_irq, |
| 243 | .timer = &orion5x_timer, |
Guennadi Liakhovetski | be73a34 | 2008-02-29 21:12:57 +0100 | [diff] [blame] | 244 | .fixup = tag_fixup_mem32, |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 245 | MACHINE_END |
Byron Bradley | 8754925 | 2008-04-09 21:50:16 +0100 | [diff] [blame] | 246 | #endif |
| 247 | |
| 248 | #ifdef CONFIG_MACH_LINKSTATION_PRO |
| 249 | MACHINE_START(LINKSTATION_PRO, "Buffalo Linkstation Pro/Live") |
| 250 | /* Maintainer: Byron Bradley <byron.bbradley@gmail.com> */ |
| 251 | .phys_io = ORION5X_REGS_PHYS_BASE, |
| 252 | .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC, |
| 253 | .boot_params = 0x00000100, |
| 254 | .init_machine = kurobox_pro_init, |
| 255 | .map_io = orion5x_map_io, |
| 256 | .init_irq = orion5x_init_irq, |
| 257 | .timer = &orion5x_timer, |
| 258 | .fixup = tag_fixup_mem32, |
| 259 | MACHINE_END |
| 260 | #endif |