2 * arch/arm/mach-orion5x/kurobox_pro-setup.c
4 * Maintainer: Ronen Shitrit <rshitrit@marvell.com>
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.
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>
20 #include <linux/ata_platform.h>
21 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/pci.h>
25 #include <asm/arch/orion5x.h>
26 #include <asm/plat-orion/orion_nand.h>
29 /*****************************************************************************
31 ****************************************************************************/
34 * 256K NOR flash Device bus boot chip select
37 #define KUROBOX_PRO_NOR_BOOT_BASE 0xf4000000
38 #define KUROBOX_PRO_NOR_BOOT_SIZE SZ_256K
41 * 256M NAND flash on Device bus chip select 1
44 #define KUROBOX_PRO_NAND_BASE 0xfc000000
45 #define KUROBOX_PRO_NAND_SIZE SZ_2M
47 /*****************************************************************************
48 * 256MB NAND Flash on Device bus CS0
49 ****************************************************************************/
51 static struct mtd_partition kurobox_pro_nand_parts[] = {
62 .offset = SZ_4M + SZ_64M,
63 .size = SZ_256M - (SZ_4M + SZ_64M),
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,
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),
81 static struct platform_device kurobox_pro_nand_flash = {
85 .platform_data = &kurobox_pro_nand_data,
87 .resource = &kurobox_pro_nand_resource,
91 /*****************************************************************************
92 * 256KB NOR Flash on BOOT Device
93 ****************************************************************************/
95 static struct physmap_flash_data kurobox_pro_nor_flash_data = {
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,
105 static struct platform_device kurobox_pro_nor_flash = {
106 .name = "physmap-flash",
109 .platform_data = &kurobox_pro_nor_flash_data,
112 .resource = &kurobox_pro_nor_flash_resource,
115 /*****************************************************************************
117 ****************************************************************************/
119 static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
124 * Check for devices with hard-wired IRQs.
126 irq = orion5x_pci_map_irq(dev, slot, pin);
131 * PCI isn't used on the Kuro
133 printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n");
138 static struct hw_pci kurobox_pro_pci __initdata = {
140 .swizzle = pci_std_swizzle,
141 .setup = orion5x_pci_sys_setup,
142 .scan = orion5x_pci_sys_scan_bus,
143 .map_irq = kurobox_pro_pci_map_irq,
146 static int __init kurobox_pro_pci_init(void)
148 if (machine_is_kurobox_pro())
149 pci_common_init(&kurobox_pro_pci);
154 subsys_initcall(kurobox_pro_pci_init);
156 /*****************************************************************************
158 ****************************************************************************/
160 static struct mv643xx_eth_platform_data kurobox_pro_eth_data = {
165 /*****************************************************************************
166 * RTC 5C372a on I2C bus
167 ****************************************************************************/
168 static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = {
169 I2C_BOARD_INFO("rs5c372a", 0x32),
172 /*****************************************************************************
174 ****************************************************************************/
175 static struct mv_sata_platform_data kurobox_pro_sata_data = {
179 /*****************************************************************************
181 ****************************************************************************/
183 static void __init kurobox_pro_init(void)
186 * Setup basic Orion functions. Need to be called early.
191 * Setup the CPU address decode windows for our devices
193 orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
194 KUROBOX_PRO_NOR_BOOT_SIZE);
195 orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE, KUROBOX_PRO_NAND_SIZE);
198 * Open a special address decode windows for the PCIe WA.
200 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
201 ORION5X_PCIE_WA_SIZE);
204 * Setup Multiplexing Pins --
209 * MPP[6] Nand Flash REn
210 * MPP[7] Nand Flash WEn
212 * MPP[12] SATA 0 presence Indication
213 * MPP[13] SATA 1 presence Indication
214 * MPP[14] SATA 0 active Indication
215 * MPP[15] SATA 1 active indication
216 * MPP[16-19] Not used
218 orion5x_write(MPP_0_7_CTRL, 0x44220003);
219 orion5x_write(MPP_8_15_CTRL, 0x55550000);
220 orion5x_write(MPP_16_19_CTRL, 0x0);
222 orion5x_gpio_set_valid_pins(0x0000000c);
224 platform_device_register(&kurobox_pro_nor_flash);
225 if (machine_is_kurobox_pro())
226 platform_device_register(&kurobox_pro_nand_flash);
227 i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
228 orion5x_eth_init(&kurobox_pro_eth_data);
229 orion5x_sata_init(&kurobox_pro_sata_data);
232 #ifdef CONFIG_MACH_KUROBOX_PRO
233 MACHINE_START(KUROBOX_PRO, "Buffalo/Revogear Kurobox Pro")
234 /* Maintainer: Ronen Shitrit <rshitrit@marvell.com> */
235 .phys_io = ORION5X_REGS_PHYS_BASE,
236 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
237 .boot_params = 0x00000100,
238 .init_machine = kurobox_pro_init,
239 .map_io = orion5x_map_io,
240 .init_irq = orion5x_init_irq,
241 .timer = &orion5x_timer,
242 .fixup = tag_fixup_mem32,
246 #ifdef CONFIG_MACH_LINKSTATION_PRO
247 MACHINE_START(LINKSTATION_PRO, "Buffalo Linkstation Pro/Live")
248 /* Maintainer: Byron Bradley <byron.bbradley@gmail.com> */
249 .phys_io = ORION5X_REGS_PHYS_BASE,
250 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
251 .boot_params = 0x00000100,
252 .init_machine = kurobox_pro_init,
253 .map_io = orion5x_map_io,
254 .init_irq = orion5x_init_irq,
255 .timer = &orion5x_timer,
256 .fixup = tag_fixup_mem32,