diff options
author | Manuel Lauss <manuel.lauss@googlemail.com> | 2011-12-08 05:42:10 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-12-08 05:42:10 -0500 |
commit | b67a1a02d463b5b298cc718ca971738fe20f0ab9 (patch) | |
tree | 3523ca7826a356e1bf1a8ac878056a4fbeb73434 /arch/mips/alchemy | |
parent | 1c043f16a01c144305e952025e883b55706f2450 (diff) |
MTD: nand: make au1550nd.c a platform_driver
Transform the au1550nd.c driver into a platform_driver and hook it
up in the PB1550 board (gen_nand works fine on the DB1550, but since
I don't have a PB1550 to test this driver stays for now).
Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
Cc: linux-mtd@lists.infradead.org
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2875/
Patchwork: https://patchwork.linux-mips.org/patch/3160/
Acked-by: Artem Bityutskiy <dedekind1@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/alchemy')
-rw-r--r-- | arch/mips/alchemy/devboards/pb1550.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/arch/mips/alchemy/devboards/pb1550.c b/arch/mips/alchemy/devboards/pb1550.c index e4a00a56a20f..b37e7de8d920 100644 --- a/arch/mips/alchemy/devboards/pb1550.c +++ b/arch/mips/alchemy/devboards/pb1550.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <asm/mach-au1x00/au1000.h> | 25 | #include <asm/mach-au1x00/au1000.h> |
26 | #include <asm/mach-au1x00/au1xxx_dbdma.h> | 26 | #include <asm/mach-au1x00/au1xxx_dbdma.h> |
27 | #include <asm/mach-au1x00/au1550nd.h> | ||
27 | #include <asm/mach-au1x00/gpio.h> | 28 | #include <asm/mach-au1x00/gpio.h> |
28 | #include <asm/mach-db1x00/bcsr.h> | 29 | #include <asm/mach-db1x00/bcsr.h> |
29 | #include "platform.h" | 30 | #include "platform.h" |
@@ -131,6 +132,67 @@ static struct platform_device pb1550_i2c_dev = { | |||
131 | .resource = au1550_psc2_res, | 132 | .resource = au1550_psc2_res, |
132 | }; | 133 | }; |
133 | 134 | ||
135 | static struct mtd_partition pb1550_nand_parts[] = { | ||
136 | [0] = { | ||
137 | .name = "NAND FS 0", | ||
138 | .offset = 0, | ||
139 | .size = 8 * 1024 * 1024, | ||
140 | }, | ||
141 | [1] = { | ||
142 | .name = "NAND FS 1", | ||
143 | .offset = MTDPART_OFS_APPEND, | ||
144 | .size = MTDPART_SIZ_FULL, | ||
145 | }, | ||
146 | }; | ||
147 | |||
148 | static struct au1550nd_platdata pb1550_nand_pd = { | ||
149 | .parts = pb1550_nand_parts, | ||
150 | .num_parts = ARRAY_SIZE(pb1550_nand_parts), | ||
151 | .devwidth = 0, /* x8 NAND default, needs fixing up */ | ||
152 | }; | ||
153 | |||
154 | static struct resource pb1550_nand_res[] = { | ||
155 | [0] = { | ||
156 | .start = 0x20000000, | ||
157 | .end = 0x20000fff, | ||
158 | .flags = IORESOURCE_MEM, | ||
159 | }, | ||
160 | }; | ||
161 | |||
162 | static struct platform_device pb1550_nand_dev = { | ||
163 | .name = "au1550-nand", | ||
164 | .id = -1, | ||
165 | .resource = pb1550_nand_res, | ||
166 | .num_resources = ARRAY_SIZE(pb1550_nand_res), | ||
167 | .dev = { | ||
168 | .platform_data = &pb1550_nand_pd, | ||
169 | }, | ||
170 | }; | ||
171 | |||
172 | static void __init pb1550_nand_setup(void) | ||
173 | { | ||
174 | int boot_swapboot = (au_readl(MEM_STSTAT) & (0x7 << 1)) | | ||
175 | ((bcsr_read(BCSR_STATUS) >> 6) & 0x1); | ||
176 | |||
177 | switch (boot_swapboot) { | ||
178 | case 0: | ||
179 | case 2: | ||
180 | case 8: | ||
181 | case 0xC: | ||
182 | case 0xD: | ||
183 | /* x16 NAND Flash */ | ||
184 | pb1550_nand_pd.devwidth = 1; | ||
185 | /* fallthrough */ | ||
186 | case 1: | ||
187 | case 9: | ||
188 | case 3: | ||
189 | case 0xE: | ||
190 | case 0xF: | ||
191 | /* x8 NAND, already set up */ | ||
192 | platform_device_register(&pb1550_nand_dev); | ||
193 | } | ||
194 | } | ||
195 | |||
134 | static int __init pb1550_dev_init(void) | 196 | static int __init pb1550_dev_init(void) |
135 | { | 197 | { |
136 | int swapped; | 198 | int swapped; |
@@ -168,6 +230,10 @@ static int __init pb1550_dev_init(void) | |||
168 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x008010000 - 1, | 230 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x008010000 - 1, |
169 | AU1550_GPIO201_205_INT, AU1550_GPIO1_INT, 0, 0, 1); | 231 | AU1550_GPIO201_205_INT, AU1550_GPIO1_INT, 0, 0, 1); |
170 | 232 | ||
233 | /* NAND setup */ | ||
234 | gpio_direction_input(206); /* GPIO206 high */ | ||
235 | pb1550_nand_setup(); | ||
236 | |||
171 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_PB1550_SWAPBOOT; | 237 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_PB1550_SWAPBOOT; |
172 | db1x_register_norflash(128 * 1024 * 1024, 4, swapped); | 238 | db1x_register_norflash(128 * 1024 * 1024, 4, swapped); |
173 | platform_device_register(&pb1550_pci_host); | 239 | platform_device_register(&pb1550_pci_host); |