aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2011-05-15 07:32:46 -0400
committerNicolas Pitre <nico@fluxnic.net>2011-05-16 15:09:07 -0400
commit980f9f601ad456dc5a699bf526b6bd894957bad3 (patch)
treef5e1bd57495bf3dabc17eadd4eda8a36d14637b9
parentaac7ffa3ed121846b61347028828617c5dd1ce46 (diff)
ARM: orion: Consolidate SPI initialization.
This change removes the interrupt resource. The driver does not use it. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
-rw-r--r--arch/arm/mach-dove/common.c65
-rw-r--r--arch/arm/mach-kirkwood/common.c25
-rw-r--r--arch/arm/mach-orion5x/common.c29
-rw-r--r--arch/arm/plat-orion/common.c47
-rw-r--r--arch/arm/plat-orion/include/plat/common.h6
5 files changed, 58 insertions, 114 deletions
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 198760b1b17d..e3e043c0004c 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -18,7 +18,6 @@
18#include <linux/mbus.h> 18#include <linux/mbus.h>
19#include <linux/ata_platform.h> 19#include <linux/ata_platform.h>
20#include <linux/serial_8250.h> 20#include <linux/serial_8250.h>
21#include <linux/spi/orion_spi.h>
22#include <linux/gpio.h> 21#include <linux/gpio.h>
23#include <asm/page.h> 22#include <asm/page.h>
24#include <asm/setup.h> 23#include <asm/setup.h>
@@ -234,71 +233,16 @@ void __init dove_uart3_init(void)
234} 233}
235 234
236/***************************************************************************** 235/*****************************************************************************
237 * SPI0 236 * SPI
238 ****************************************************************************/ 237 ****************************************************************************/
239static struct orion_spi_info dove_spi0_data = {
240 .tclk = 0,
241};
242
243static struct resource dove_spi0_resources[] = {
244 {
245 .start = DOVE_SPI0_PHYS_BASE,
246 .end = DOVE_SPI0_PHYS_BASE + SZ_512 - 1,
247 .flags = IORESOURCE_MEM,
248 }, {
249 .start = IRQ_DOVE_SPI0,
250 .end = IRQ_DOVE_SPI0,
251 .flags = IORESOURCE_IRQ,
252 },
253};
254
255static struct platform_device dove_spi0 = {
256 .name = "orion_spi",
257 .id = 0,
258 .resource = dove_spi0_resources,
259 .dev = {
260 .platform_data = &dove_spi0_data,
261 },
262 .num_resources = ARRAY_SIZE(dove_spi0_resources),
263};
264
265void __init dove_spi0_init(void) 238void __init dove_spi0_init(void)
266{ 239{
267 platform_device_register(&dove_spi0); 240 orion_spi_init(DOVE_SPI0_PHYS_BASE, get_tclk());
268} 241}
269 242
270/*****************************************************************************
271 * SPI1
272 ****************************************************************************/
273static struct orion_spi_info dove_spi1_data = {
274 .tclk = 0,
275};
276
277static struct resource dove_spi1_resources[] = {
278 {
279 .start = DOVE_SPI1_PHYS_BASE,
280 .end = DOVE_SPI1_PHYS_BASE + SZ_512 - 1,
281 .flags = IORESOURCE_MEM,
282 }, {
283 .start = IRQ_DOVE_SPI1,
284 .end = IRQ_DOVE_SPI1,
285 .flags = IORESOURCE_IRQ,
286 },
287};
288
289static struct platform_device dove_spi1 = {
290 .name = "orion_spi",
291 .id = 1,
292 .resource = dove_spi1_resources,
293 .dev = {
294 .platform_data = &dove_spi1_data,
295 },
296 .num_resources = ARRAY_SIZE(dove_spi1_resources),
297};
298
299void __init dove_spi1_init(void) 243void __init dove_spi1_init(void)
300{ 244{
301 platform_device_register(&dove_spi1); 245 orion_spi_init(DOVE_SPI1_PHYS_BASE, get_tclk());
302} 246}
303 247
304/***************************************************************************** 248/*****************************************************************************
@@ -613,9 +557,6 @@ void __init dove_init(void)
613#endif 557#endif
614 dove_setup_cpu_mbus(); 558 dove_setup_cpu_mbus();
615 559
616 dove_spi0_data.tclk = tclk;
617 dove_spi1_data.tclk = tclk;
618
619 /* internal devices that every board has */ 560 /* internal devices that every board has */
620 dove_rtc_init(); 561 dove_rtc_init();
621 dove_xor0_init(); 562 dove_xor0_init();
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index fc86a80ef565..af864fc7883b 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -15,7 +15,6 @@
15#include <linux/mbus.h> 15#include <linux/mbus.h>
16#include <linux/ata_platform.h> 16#include <linux/ata_platform.h>
17#include <linux/mtd/nand.h> 17#include <linux/mtd/nand.h>
18#include <linux/spi/orion_spi.h>
19#include <net/dsa.h> 18#include <net/dsa.h>
20#include <asm/page.h> 19#include <asm/page.h>
21#include <asm/timex.h> 20#include <asm/timex.h>
@@ -292,31 +291,10 @@ void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data)
292/***************************************************************************** 291/*****************************************************************************
293 * SPI 292 * SPI
294 ****************************************************************************/ 293 ****************************************************************************/
295static struct orion_spi_info kirkwood_spi_plat_data = {
296};
297
298static struct resource kirkwood_spi_resources[] = {
299 {
300 .start = SPI_PHYS_BASE,
301 .end = SPI_PHYS_BASE + SZ_512 - 1,
302 .flags = IORESOURCE_MEM,
303 },
304};
305
306static struct platform_device kirkwood_spi = {
307 .name = "orion_spi",
308 .id = 0,
309 .resource = kirkwood_spi_resources,
310 .dev = {
311 .platform_data = &kirkwood_spi_plat_data,
312 },
313 .num_resources = ARRAY_SIZE(kirkwood_spi_resources),
314};
315
316void __init kirkwood_spi_init() 294void __init kirkwood_spi_init()
317{ 295{
318 kirkwood_clk_ctrl |= CGC_RUNIT; 296 kirkwood_clk_ctrl |= CGC_RUNIT;
319 platform_device_register(&kirkwood_spi); 297 orion_spi_init(SPI_PHYS_BASE, kirkwood_tclk);
320} 298}
321 299
322 300
@@ -757,7 +735,6 @@ void __init kirkwood_init(void)
757{ 735{
758 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n", 736 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n",
759 kirkwood_id(), kirkwood_tclk); 737 kirkwood_id(), kirkwood_tclk);
760 kirkwood_spi_plat_data.tclk = kirkwood_tclk;
761 kirkwood_i2s_data.tclk = kirkwood_tclk; 738 kirkwood_i2s_data.tclk = kirkwood_tclk;
762 739
763 /* 740 /*
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 9af0b88573ae..d2dee431635a 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -17,7 +17,6 @@
17#include <linux/mbus.h> 17#include <linux/mbus.h>
18#include <linux/mv643xx_i2c.h> 18#include <linux/mv643xx_i2c.h>
19#include <linux/ata_platform.h> 19#include <linux/ata_platform.h>
20#include <linux/spi/orion_spi.h>
21#include <net/dsa.h> 20#include <net/dsa.h>
22#include <asm/page.h> 21#include <asm/page.h>
23#include <asm/setup.h> 22#include <asm/setup.h>
@@ -214,33 +213,9 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
214/***************************************************************************** 213/*****************************************************************************
215 * SPI 214 * SPI
216 ****************************************************************************/ 215 ****************************************************************************/
217static struct orion_spi_info orion5x_spi_plat_data = {
218 .tclk = 0,
219 .enable_clock_fix = 1,
220};
221
222static struct resource orion5x_spi_resources[] = {
223 {
224 .name = "spi base",
225 .start = SPI_PHYS_BASE,
226 .end = SPI_PHYS_BASE + 0x1f,
227 .flags = IORESOURCE_MEM,
228 },
229};
230
231static struct platform_device orion5x_spi = {
232 .name = "orion_spi",
233 .id = 0,
234 .dev = {
235 .platform_data = &orion5x_spi_plat_data,
236 },
237 .num_resources = ARRAY_SIZE(orion5x_spi_resources),
238 .resource = orion5x_spi_resources,
239};
240
241void __init orion5x_spi_init() 216void __init orion5x_spi_init()
242{ 217{
243 platform_device_register(&orion5x_spi); 218 orion_spi_init(SPI_PHYS_BASE, orion5x_tclk);
244} 219}
245 220
246 221
@@ -513,8 +488,6 @@ void __init orion5x_init(void)
513 orion5x_id(&dev, &rev, &dev_name); 488 orion5x_id(&dev, &rev, &dev_name);
514 printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk); 489 printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk);
515 490
516 orion5x_spi_plat_data.tclk = orion5x_tclk;
517
518 /* 491 /*
519 * Setup Orion address map 492 * Setup Orion address map
520 */ 493 */
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index bcc1734c91a8..2afe79d1a273 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -17,6 +17,7 @@
17#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
18#include <linux/mv643xx_i2c.h> 18#include <linux/mv643xx_i2c.h>
19#include <net/dsa.h> 19#include <net/dsa.h>
20#include <linux/spi/orion_spi.h>
20 21
21/* Fill in the resources structure and link it into the platform 22/* Fill in the resources structure and link it into the platform
22 device structure. There is always a memory region, and nearly 23 device structure. There is always a memory region, and nearly
@@ -517,3 +518,49 @@ void __init orion_i2c_1_init(unsigned long mapbase,
517 SZ_32 - 1, irq); 518 SZ_32 - 1, irq);
518 platform_device_register(&orion_i2c_1); 519 platform_device_register(&orion_i2c_1);
519} 520}
521
522/*****************************************************************************
523 * SPI
524 ****************************************************************************/
525static struct orion_spi_info orion_spi_plat_data;
526static struct resource orion_spi_resources;
527
528static struct platform_device orion_spi = {
529 .name = "orion_spi",
530 .id = 0,
531 .dev = {
532 .platform_data = &orion_spi_plat_data,
533 },
534};
535
536static struct orion_spi_info orion_spi_1_plat_data;
537static struct resource orion_spi_1_resources;
538
539static struct platform_device orion_spi_1 = {
540 .name = "orion_spi",
541 .id = 1,
542 .dev = {
543 .platform_data = &orion_spi_1_plat_data,
544 },
545};
546
547/* Note: The SPI silicon core does have interrupts. However the
548 * current Linux software driver does not use interrupts. */
549
550void __init orion_spi_init(unsigned long mapbase,
551 unsigned long tclk)
552{
553 orion_spi_plat_data.tclk = tclk;
554 fill_resources(&orion_spi, &orion_spi_resources,
555 mapbase, SZ_512 - 1, NO_IRQ);
556 platform_device_register(&orion_spi);
557}
558
559void __init orion_spi_1_init(unsigned long mapbase,
560 unsigned long tclk)
561{
562 orion_spi_1_plat_data.tclk = tclk;
563 fill_resources(&orion_spi_1, &orion_spi_1_resources,
564 mapbase, SZ_512 - 1, NO_IRQ);
565 platform_device_register(&orion_spi_1);
566}
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h
index d107c62d3912..e72c1466d6ce 100644
--- a/arch/arm/plat-orion/include/plat/common.h
+++ b/arch/arm/plat-orion/include/plat/common.h
@@ -73,4 +73,10 @@ void __init orion_i2c_init(unsigned long mapbase,
73void __init orion_i2c_1_init(unsigned long mapbase, 73void __init orion_i2c_1_init(unsigned long mapbase,
74 unsigned long irq, 74 unsigned long irq,
75 unsigned long freq_m); 75 unsigned long freq_m);
76
77void __init orion_spi_init(unsigned long mapbase,
78 unsigned long tclk);
79
80void __init orion_spi_1_init(unsigned long mapbase,
81 unsigned long tclk);
76#endif 82#endif