Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-orion/kurobox_pro-setup.c |
| 3 | * |
| 4 | * Maintainer: Ronen Shitrit <rshitrit@marvell.com> |
| 5 | * |
| 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 |
| 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> |
| 25 | #include <asm/arch/orion.h> |
| 26 | #include <asm/arch/platform.h> |
| 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, |
| 56 | }, |
| 57 | { |
| 58 | .name = "rootfs", |
| 59 | .offset = SZ_4M, |
| 60 | .size = SZ_64M, |
| 61 | }, |
| 62 | { |
| 63 | .name = "extra", |
| 64 | .offset = SZ_4M + SZ_64M, |
| 65 | .size = SZ_256M - (SZ_4M + SZ_64M), |
| 66 | }, |
| 67 | }; |
| 68 | |
| 69 | static struct resource kurobox_pro_nand_resource = { |
| 70 | .flags = IORESOURCE_MEM, |
| 71 | .start = KUROBOX_PRO_NAND_BASE, |
| 72 | .end = KUROBOX_PRO_NAND_BASE + KUROBOX_PRO_NAND_SIZE - 1, |
| 73 | }; |
| 74 | |
| 75 | static struct orion_nand_data kurobox_pro_nand_data = { |
| 76 | .parts = kurobox_pro_nand_parts, |
| 77 | .nr_parts = ARRAY_SIZE(kurobox_pro_nand_parts), |
| 78 | .cle = 0, |
| 79 | .ale = 1, |
| 80 | .width = 8, |
| 81 | }; |
| 82 | |
| 83 | static struct platform_device kurobox_pro_nand_flash = { |
| 84 | .name = "orion_nand", |
| 85 | .id = -1, |
| 86 | .dev = { |
| 87 | .platform_data = &kurobox_pro_nand_data, |
| 88 | }, |
| 89 | .resource = &kurobox_pro_nand_resource, |
| 90 | .num_resources = 1, |
| 91 | }; |
| 92 | |
| 93 | /***************************************************************************** |
| 94 | * 256KB NOR Flash on BOOT Device |
| 95 | ****************************************************************************/ |
| 96 | |
| 97 | static struct physmap_flash_data kurobox_pro_nor_flash_data = { |
| 98 | .width = 1, |
| 99 | }; |
| 100 | |
| 101 | static struct resource kurobox_pro_nor_flash_resource = { |
| 102 | .flags = IORESOURCE_MEM, |
| 103 | .start = KUROBOX_PRO_NOR_BOOT_BASE, |
| 104 | .end = KUROBOX_PRO_NOR_BOOT_BASE + KUROBOX_PRO_NOR_BOOT_SIZE - 1, |
| 105 | }; |
| 106 | |
| 107 | static struct platform_device kurobox_pro_nor_flash = { |
| 108 | .name = "physmap-flash", |
| 109 | .id = 0, |
| 110 | .dev = { |
| 111 | .platform_data = &kurobox_pro_nor_flash_data, |
| 112 | }, |
| 113 | .num_resources = 1, |
| 114 | .resource = &kurobox_pro_nor_flash_resource, |
| 115 | }; |
| 116 | |
| 117 | /***************************************************************************** |
| 118 | * PCI |
| 119 | ****************************************************************************/ |
| 120 | |
| 121 | static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
| 122 | { |
| 123 | /* |
| 124 | * PCI isn't used on the Kuro |
| 125 | */ |
| 126 | if (dev->bus->number == orion_pcie_local_bus_nr()) |
| 127 | return IRQ_ORION_PCIE0_INT; |
| 128 | else |
| 129 | printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n"); |
| 130 | |
| 131 | return -1; |
| 132 | } |
| 133 | |
| 134 | static struct hw_pci kurobox_pro_pci __initdata = { |
| 135 | .nr_controllers = 1, |
| 136 | .swizzle = pci_std_swizzle, |
| 137 | .setup = orion_pci_sys_setup, |
| 138 | .scan = orion_pci_sys_scan_bus, |
| 139 | .map_irq = kurobox_pro_pci_map_irq, |
| 140 | }; |
| 141 | |
| 142 | static int __init kurobox_pro_pci_init(void) |
| 143 | { |
| 144 | if (machine_is_kurobox_pro()) |
| 145 | pci_common_init(&kurobox_pro_pci); |
| 146 | |
| 147 | return 0; |
| 148 | } |
| 149 | |
| 150 | subsys_initcall(kurobox_pro_pci_init); |
| 151 | |
| 152 | /***************************************************************************** |
| 153 | * Ethernet |
| 154 | ****************************************************************************/ |
| 155 | |
| 156 | static struct mv643xx_eth_platform_data kurobox_pro_eth_data = { |
| 157 | .phy_addr = 8, |
| 158 | .force_phy_addr = 1, |
| 159 | }; |
| 160 | |
| 161 | /***************************************************************************** |
| 162 | * RTC 5C372a on I2C bus |
| 163 | ****************************************************************************/ |
| 164 | static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = { |
| 165 | .driver_name = "rtc-rs5c372", |
| 166 | .type = "rs5c372a", |
| 167 | .addr = 0x32, |
| 168 | }; |
| 169 | |
| 170 | /***************************************************************************** |
Byron Bradley | 3b277c2 | 2008-02-08 18:20:01 +0000 | [diff] [blame^] | 171 | * SATA |
| 172 | ****************************************************************************/ |
| 173 | static struct mv_sata_platform_data kurobox_pro_sata_data = { |
| 174 | .n_ports = 2, |
| 175 | }; |
| 176 | |
| 177 | /***************************************************************************** |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 178 | * General Setup |
| 179 | ****************************************************************************/ |
| 180 | |
| 181 | static struct platform_device *kurobox_pro_devices[] __initdata = { |
| 182 | &kurobox_pro_nor_flash, |
| 183 | &kurobox_pro_nand_flash, |
| 184 | }; |
| 185 | |
| 186 | static void __init kurobox_pro_init(void) |
| 187 | { |
| 188 | /* |
| 189 | * Setup basic Orion functions. Need to be called early. |
| 190 | */ |
| 191 | orion_init(); |
| 192 | |
| 193 | /* |
| 194 | * Setup the CPU address decode windows for our devices |
| 195 | */ |
| 196 | orion_setup_cpu_win(ORION_DEV_BOOT, KUROBOX_PRO_NOR_BOOT_BASE, |
| 197 | KUROBOX_PRO_NOR_BOOT_SIZE, -1); |
| 198 | orion_setup_cpu_win(ORION_DEV0, KUROBOX_PRO_NAND_BASE, |
| 199 | KUROBOX_PRO_NAND_SIZE, -1); |
| 200 | /* |
| 201 | * Open a special address decode windows for the PCIE WA. |
| 202 | */ |
Lennert Buytenhek | 7f74c2c | 2008-02-07 21:55:17 +0100 | [diff] [blame] | 203 | orion_write(ORION_REGS_VIRT_BASE | 0x20074, ORION_PCIE_WA_PHYS_BASE); |
| 204 | orion_write(ORION_REGS_VIRT_BASE | 0x20070, (0x7941 | |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 205 | (((ORION_PCIE_WA_SIZE >> 16) - 1)) << 16)); |
| 206 | |
| 207 | /* |
| 208 | * Setup Multiplexing Pins -- |
| 209 | * MPP[0-1] Not used |
| 210 | * MPP[2] GPIO Micon |
| 211 | * MPP[3] GPIO RTC |
| 212 | * MPP[4-5] Not used |
| 213 | * MPP[6] Nand Flash REn |
| 214 | * MPP[7] Nand Flash WEn |
| 215 | * MPP[8-11] Not used |
| 216 | * MPP[12] SATA 0 presence Indication |
| 217 | * MPP[13] SATA 1 presence Indication |
| 218 | * MPP[14] SATA 0 active Indication |
| 219 | * MPP[15] SATA 1 active indication |
| 220 | * MPP[16-19] Not used |
| 221 | */ |
| 222 | orion_write(MPP_0_7_CTRL, 0x44220003); |
| 223 | orion_write(MPP_8_15_CTRL, 0x55550000); |
| 224 | orion_write(MPP_16_19_CTRL, 0x0); |
| 225 | |
| 226 | orion_gpio_set_valid_pins(0x0000000c); |
| 227 | |
| 228 | platform_add_devices(kurobox_pro_devices, ARRAY_SIZE(kurobox_pro_devices)); |
| 229 | i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1); |
| 230 | orion_eth_init(&kurobox_pro_eth_data); |
Byron Bradley | 3b277c2 | 2008-02-08 18:20:01 +0000 | [diff] [blame^] | 231 | orion_sata_init(&kurobox_pro_sata_data); |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | MACHINE_START(KUROBOX_PRO, "Buffalo/Revogear Kurobox Pro") |
| 235 | /* Maintainer: Ronen Shitrit <rshitrit@marvell.com> */ |
Lennert Buytenhek | 7f74c2c | 2008-02-07 21:55:17 +0100 | [diff] [blame] | 236 | .phys_io = ORION_REGS_PHYS_BASE, |
| 237 | .io_pg_offst = ((ORION_REGS_VIRT_BASE) >> 18) & 0xFFFC, |
Ronen Shitrit | 1e78045 | 2007-10-23 15:14:42 -0400 | [diff] [blame] | 238 | .boot_params = 0x00000100, |
| 239 | .init_machine = kurobox_pro_init, |
| 240 | .map_io = orion_map_io, |
| 241 | .init_irq = orion_init_irq, |
| 242 | .timer = &orion_timer, |
| 243 | MACHINE_END |