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