diff options
-rw-r--r-- | arch/arm/mach-dove/common.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-dove/dove-db-setup.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/board-dreamplug.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/rd88f6192-nas-setup.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/t5325-setup.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/tsx1x-common.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-mv78xx0/common.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/common.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c | 1 | ||||
-rw-r--r-- | arch/arm/plat-orion/common.c | 38 | ||||
-rw-r--r-- | arch/arm/plat-orion/include/plat/common.h | 11 | ||||
-rw-r--r-- | drivers/spi/spi-orion.c | 30 | ||||
-rw-r--r-- | include/linux/spi/orion_spi.h | 17 |
15 files changed, 70 insertions, 55 deletions
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index 63fe6e612e98..da5b4047464d 100644 --- a/arch/arm/mach-dove/common.c +++ b/arch/arm/mach-dove/common.c | |||
@@ -76,6 +76,8 @@ static void __init clk_init(void) | |||
76 | { | 76 | { |
77 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, | 77 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, |
78 | get_tclk()); | 78 | get_tclk()); |
79 | |||
80 | orion_clkdev_init(tclk); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | /***************************************************************************** | 83 | /***************************************************************************** |
@@ -162,12 +164,12 @@ void __init dove_uart3_init(void) | |||
162 | ****************************************************************************/ | 164 | ****************************************************************************/ |
163 | void __init dove_spi0_init(void) | 165 | void __init dove_spi0_init(void) |
164 | { | 166 | { |
165 | orion_spi_init(DOVE_SPI0_PHYS_BASE, get_tclk()); | 167 | orion_spi_init(DOVE_SPI0_PHYS_BASE); |
166 | } | 168 | } |
167 | 169 | ||
168 | void __init dove_spi1_init(void) | 170 | void __init dove_spi1_init(void) |
169 | { | 171 | { |
170 | orion_spi_1_init(DOVE_SPI1_PHYS_BASE, get_tclk()); | 172 | orion_spi_1_init(DOVE_SPI1_PHYS_BASE); |
171 | } | 173 | } |
172 | 174 | ||
173 | /***************************************************************************** | 175 | /***************************************************************************** |
diff --git a/arch/arm/mach-dove/dove-db-setup.c b/arch/arm/mach-dove/dove-db-setup.c index ea77ae430b2d..bc2867f11346 100644 --- a/arch/arm/mach-dove/dove-db-setup.c +++ b/arch/arm/mach-dove/dove-db-setup.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
22 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
23 | #include <linux/spi/orion_spi.h> | ||
24 | #include <linux/spi/flash.h> | 23 | #include <linux/spi/flash.h> |
25 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
26 | #include <asm/mach-types.h> | 25 | #include <asm/mach-types.h> |
diff --git a/arch/arm/mach-kirkwood/board-dreamplug.c b/arch/arm/mach-kirkwood/board-dreamplug.c index 985453994dd3..55e357ab2923 100644 --- a/arch/arm/mach-kirkwood/board-dreamplug.c +++ b/arch/arm/mach-kirkwood/board-dreamplug.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/mtd/physmap.h> | 27 | #include <linux/mtd/physmap.h> |
28 | #include <linux/spi/flash.h> | 28 | #include <linux/spi/flash.h> |
29 | #include <linux/spi/spi.h> | 29 | #include <linux/spi/spi.h> |
30 | #include <linux/spi/orion_spi.h> | ||
31 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
32 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
33 | #include <asm/mach/map.h> | 32 | #include <asm/mach/map.h> |
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index 57b8d1ef3093..476e0b941db7 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c | |||
@@ -86,10 +86,12 @@ static struct clk __init *kirkwood_register_gate(const char *name, u8 bit_idx) | |||
86 | 86 | ||
87 | void __init kirkwood_clk_init(void) | 87 | void __init kirkwood_clk_init(void) |
88 | { | 88 | { |
89 | struct clk *runit; | ||
90 | |||
89 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, | 91 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, |
90 | CLK_IS_ROOT, kirkwood_tclk); | 92 | CLK_IS_ROOT, kirkwood_tclk); |
91 | 93 | ||
92 | kirkwood_register_gate("runit", CGC_BIT_RUNIT); | 94 | runit = kirkwood_register_gate("runit", CGC_BIT_RUNIT); |
93 | kirkwood_register_gate("ge0", CGC_BIT_GE0); | 95 | kirkwood_register_gate("ge0", CGC_BIT_GE0); |
94 | kirkwood_register_gate("ge1", CGC_BIT_GE1); | 96 | kirkwood_register_gate("ge1", CGC_BIT_GE1); |
95 | kirkwood_register_gate("sata0", CGC_BIT_SATA0); | 97 | kirkwood_register_gate("sata0", CGC_BIT_SATA0); |
@@ -104,6 +106,10 @@ void __init kirkwood_clk_init(void) | |||
104 | kirkwood_register_gate("audio", CGC_BIT_AUDIO); | 106 | kirkwood_register_gate("audio", CGC_BIT_AUDIO); |
105 | kirkwood_register_gate("tdm", CGC_BIT_TDM); | 107 | kirkwood_register_gate("tdm", CGC_BIT_TDM); |
106 | kirkwood_register_gate("tsu", CGC_BIT_TSU); | 108 | kirkwood_register_gate("tsu", CGC_BIT_TSU); |
109 | |||
110 | /* clkdev entries, mapping clks to devices */ | ||
111 | orion_clkdev_add(NULL, "orion_spi.0", runit); | ||
112 | orion_clkdev_add(NULL, "orion_spi.1", runit); | ||
107 | } | 113 | } |
108 | 114 | ||
109 | /***************************************************************************** | 115 | /***************************************************************************** |
@@ -270,7 +276,7 @@ void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data) | |||
270 | void __init kirkwood_spi_init() | 276 | void __init kirkwood_spi_init() |
271 | { | 277 | { |
272 | kirkwood_clk_ctrl |= CGC_RUNIT; | 278 | kirkwood_clk_ctrl |= CGC_RUNIT; |
273 | orion_spi_init(SPI_PHYS_BASE, kirkwood_tclk); | 279 | orion_spi_init(SPI_PHYS_BASE); |
274 | } | 280 | } |
275 | 281 | ||
276 | 282 | ||
diff --git a/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c b/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c index 85f6169c2484..6d8364a97810 100644 --- a/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c +++ b/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/gpio_keys.h> | 23 | #include <linux/gpio_keys.h> |
24 | #include <linux/spi/flash.h> | 24 | #include <linux/spi/flash.h> |
25 | #include <linux/spi/spi.h> | 25 | #include <linux/spi/spi.h> |
26 | #include <linux/spi/orion_spi.h> | ||
27 | #include <net/dsa.h> | 26 | #include <net/dsa.h> |
28 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
29 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
diff --git a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c index fd2c9c8b6831..f742a66a7045 100644 --- a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c +++ b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
17 | #include <linux/spi/flash.h> | 17 | #include <linux/spi/flash.h> |
18 | #include <linux/spi/spi.h> | 18 | #include <linux/spi/spi.h> |
19 | #include <linux/spi/orion_spi.h> | ||
20 | #include <asm/mach-types.h> | 19 | #include <asm/mach-types.h> |
21 | #include <asm/mach/arch.h> | 20 | #include <asm/mach/arch.h> |
22 | #include <mach/kirkwood.h> | 21 | #include <mach/kirkwood.h> |
diff --git a/arch/arm/mach-kirkwood/t5325-setup.c b/arch/arm/mach-kirkwood/t5325-setup.c index f9d2a11b7f96..bad738e44044 100644 --- a/arch/arm/mach-kirkwood/t5325-setup.c +++ b/arch/arm/mach-kirkwood/t5325-setup.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/mtd/physmap.h> | 16 | #include <linux/mtd/physmap.h> |
17 | #include <linux/spi/flash.h> | 17 | #include <linux/spi/flash.h> |
18 | #include <linux/spi/spi.h> | 18 | #include <linux/spi/spi.h> |
19 | #include <linux/spi/orion_spi.h> | ||
20 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
21 | #include <linux/mv643xx_eth.h> | 20 | #include <linux/mv643xx_eth.h> |
22 | #include <linux/ata_platform.h> | 21 | #include <linux/ata_platform.h> |
diff --git a/arch/arm/mach-kirkwood/tsx1x-common.c b/arch/arm/mach-kirkwood/tsx1x-common.c index 24294b2bc469..8943ede29b44 100644 --- a/arch/arm/mach-kirkwood/tsx1x-common.c +++ b/arch/arm/mach-kirkwood/tsx1x-common.c | |||
@@ -4,7 +4,6 @@ | |||
4 | #include <linux/mtd/physmap.h> | 4 | #include <linux/mtd/physmap.h> |
5 | #include <linux/spi/flash.h> | 5 | #include <linux/spi/flash.h> |
6 | #include <linux/spi/spi.h> | 6 | #include <linux/spi/spi.h> |
7 | #include <linux/spi/orion_spi.h> | ||
8 | #include <linux/serial_reg.h> | 7 | #include <linux/serial_reg.h> |
9 | #include <mach/kirkwood.h> | 8 | #include <mach/kirkwood.h> |
10 | #include "common.h" | 9 | #include "common.h" |
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c index 73733207f5a9..4c24b46520aa 100644 --- a/arch/arm/mach-mv78xx0/common.c +++ b/arch/arm/mach-mv78xx0/common.c | |||
@@ -175,6 +175,8 @@ static void __init clk_init(void) | |||
175 | { | 175 | { |
176 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, | 176 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, |
177 | get_tclk()); | 177 | get_tclk()); |
178 | |||
179 | orion_clkdev_init(tclk); | ||
178 | } | 180 | } |
179 | 181 | ||
180 | /***************************************************************************** | 182 | /***************************************************************************** |
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 81660522c6b4..2ef82e2f511d 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -79,6 +79,8 @@ static void __init clk_init(void) | |||
79 | { | 79 | { |
80 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, | 80 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, |
81 | orion5x_tclk); | 81 | orion5x_tclk); |
82 | |||
83 | orion_clkdev_init(tclk); | ||
82 | } | 84 | } |
83 | 85 | ||
84 | /***************************************************************************** | 86 | /***************************************************************************** |
@@ -144,7 +146,7 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data) | |||
144 | ****************************************************************************/ | 146 | ****************************************************************************/ |
145 | void __init orion5x_spi_init() | 147 | void __init orion5x_spi_init() |
146 | { | 148 | { |
147 | orion_spi_init(SPI_PHYS_BASE, orion5x_tclk); | 149 | orion_spi_init(SPI_PHYS_BASE); |
148 | } | 150 | } |
149 | 151 | ||
150 | 152 | ||
diff --git a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c index 2c5fab00d205..7b97a9a211ed 100644 --- a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c +++ b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/mtd/physmap.h> | 16 | #include <linux/mtd/physmap.h> |
17 | #include <linux/mv643xx_eth.h> | 17 | #include <linux/mv643xx_eth.h> |
18 | #include <linux/spi/spi.h> | 18 | #include <linux/spi/spi.h> |
19 | #include <linux/spi/orion_spi.h> | ||
20 | #include <linux/spi/flash.h> | 19 | #include <linux/spi/flash.h> |
21 | #include <linux/ethtool.h> | 20 | #include <linux/ethtool.h> |
22 | #include <net/dsa.h> | 21 | #include <net/dsa.h> |
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c index 4fdd2e7e74a1..bbe50a948710 100644 --- a/arch/arm/plat-orion/common.c +++ b/arch/arm/plat-orion/common.c | |||
@@ -19,12 +19,32 @@ | |||
19 | #include <linux/mv643xx_eth.h> | 19 | #include <linux/mv643xx_eth.h> |
20 | #include <linux/mv643xx_i2c.h> | 20 | #include <linux/mv643xx_i2c.h> |
21 | #include <net/dsa.h> | 21 | #include <net/dsa.h> |
22 | #include <linux/spi/orion_spi.h> | ||
23 | #include <plat/orion_wdt.h> | 22 | #include <plat/orion_wdt.h> |
24 | #include <plat/mv_xor.h> | 23 | #include <plat/mv_xor.h> |
25 | #include <plat/ehci-orion.h> | 24 | #include <plat/ehci-orion.h> |
26 | #include <mach/bridge-regs.h> | 25 | #include <mach/bridge-regs.h> |
27 | 26 | ||
27 | /* Create a clkdev entry for a given device/clk */ | ||
28 | void __init orion_clkdev_add(const char *con_id, const char *dev_id, | ||
29 | struct clk *clk) | ||
30 | { | ||
31 | struct clk_lookup *cl; | ||
32 | |||
33 | cl = clkdev_alloc(clk, con_id, dev_id); | ||
34 | if (cl) | ||
35 | clkdev_add(cl); | ||
36 | } | ||
37 | |||
38 | /* Create clkdev entries for all orion platforms except kirkwood. | ||
39 | Kirkwood has gated clocks for some of its peripherals, so creates | ||
40 | its own clkdev entries. For all the other orion devices, create | ||
41 | clkdev entries to the tclk. */ | ||
42 | void __init orion_clkdev_init(struct clk *tclk) | ||
43 | { | ||
44 | orion_clkdev_add(NULL, "orion_spi.0", tclk); | ||
45 | orion_clkdev_add(NULL, "orion_spi.1", tclk); | ||
46 | } | ||
47 | |||
28 | /* Fill in the resources structure and link it into the platform | 48 | /* Fill in the resources structure and link it into the platform |
29 | device structure. There is always a memory region, and nearly | 49 | device structure. There is always a memory region, and nearly |
30 | always an interrupt.*/ | 50 | always an interrupt.*/ |
@@ -523,44 +543,32 @@ void __init orion_i2c_1_init(unsigned long mapbase, | |||
523 | /***************************************************************************** | 543 | /***************************************************************************** |
524 | * SPI | 544 | * SPI |
525 | ****************************************************************************/ | 545 | ****************************************************************************/ |
526 | static struct orion_spi_info orion_spi_plat_data; | ||
527 | static struct resource orion_spi_resources; | 546 | static struct resource orion_spi_resources; |
528 | 547 | ||
529 | static struct platform_device orion_spi = { | 548 | static struct platform_device orion_spi = { |
530 | .name = "orion_spi", | 549 | .name = "orion_spi", |
531 | .id = 0, | 550 | .id = 0, |
532 | .dev = { | ||
533 | .platform_data = &orion_spi_plat_data, | ||
534 | }, | ||
535 | }; | 551 | }; |
536 | 552 | ||
537 | static struct orion_spi_info orion_spi_1_plat_data; | ||
538 | static struct resource orion_spi_1_resources; | 553 | static struct resource orion_spi_1_resources; |
539 | 554 | ||
540 | static struct platform_device orion_spi_1 = { | 555 | static struct platform_device orion_spi_1 = { |
541 | .name = "orion_spi", | 556 | .name = "orion_spi", |
542 | .id = 1, | 557 | .id = 1, |
543 | .dev = { | ||
544 | .platform_data = &orion_spi_1_plat_data, | ||
545 | }, | ||
546 | }; | 558 | }; |
547 | 559 | ||
548 | /* Note: The SPI silicon core does have interrupts. However the | 560 | /* Note: The SPI silicon core does have interrupts. However the |
549 | * current Linux software driver does not use interrupts. */ | 561 | * current Linux software driver does not use interrupts. */ |
550 | 562 | ||
551 | void __init orion_spi_init(unsigned long mapbase, | 563 | void __init orion_spi_init(unsigned long mapbase) |
552 | unsigned long tclk) | ||
553 | { | 564 | { |
554 | orion_spi_plat_data.tclk = tclk; | ||
555 | fill_resources(&orion_spi, &orion_spi_resources, | 565 | fill_resources(&orion_spi, &orion_spi_resources, |
556 | mapbase, SZ_512 - 1, NO_IRQ); | 566 | mapbase, SZ_512 - 1, NO_IRQ); |
557 | platform_device_register(&orion_spi); | 567 | platform_device_register(&orion_spi); |
558 | } | 568 | } |
559 | 569 | ||
560 | void __init orion_spi_1_init(unsigned long mapbase, | 570 | void __init orion_spi_1_init(unsigned long mapbase) |
561 | unsigned long tclk) | ||
562 | { | 571 | { |
563 | orion_spi_1_plat_data.tclk = tclk; | ||
564 | fill_resources(&orion_spi_1, &orion_spi_1_resources, | 572 | fill_resources(&orion_spi_1, &orion_spi_1_resources, |
565 | mapbase, SZ_512 - 1, NO_IRQ); | 573 | mapbase, SZ_512 - 1, NO_IRQ); |
566 | platform_device_register(&orion_spi_1); | 574 | platform_device_register(&orion_spi_1); |
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h index a7fa005a5a0e..d188a1aa6f56 100644 --- a/arch/arm/plat-orion/include/plat/common.h +++ b/arch/arm/plat-orion/include/plat/common.h | |||
@@ -70,11 +70,9 @@ void __init orion_i2c_1_init(unsigned long mapbase, | |||
70 | unsigned long irq, | 70 | unsigned long irq, |
71 | unsigned long freq_m); | 71 | unsigned long freq_m); |
72 | 72 | ||
73 | void __init orion_spi_init(unsigned long mapbase, | 73 | void __init orion_spi_init(unsigned long mapbase); |
74 | unsigned long tclk); | ||
75 | 74 | ||
76 | void __init orion_spi_1_init(unsigned long mapbase, | 75 | void __init orion_spi_1_init(unsigned long mapbase); |
77 | unsigned long tclk); | ||
78 | 76 | ||
79 | void __init orion_wdt_init(unsigned long tclk); | 77 | void __init orion_wdt_init(unsigned long tclk); |
80 | 78 | ||
@@ -106,4 +104,9 @@ void __init orion_crypto_init(unsigned long mapbase, | |||
106 | unsigned long srambase, | 104 | unsigned long srambase, |
107 | unsigned long sram_size, | 105 | unsigned long sram_size, |
108 | unsigned long irq); | 106 | unsigned long irq); |
107 | |||
108 | void __init orion_clkdev_add(const char *con_id, const char *dev_id, | ||
109 | struct clk *clk); | ||
110 | |||
111 | void __init orion_clkdev_init(struct clk *tclk); | ||
109 | #endif | 112 | #endif |
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index e496f799b7a9..dfd04e91fa6d 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c | |||
@@ -16,8 +16,8 @@ | |||
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/spi/spi.h> | 18 | #include <linux/spi/spi.h> |
19 | #include <linux/spi/orion_spi.h> | ||
20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/clk.h> | ||
21 | #include <asm/unaligned.h> | 21 | #include <asm/unaligned.h> |
22 | 22 | ||
23 | #define DRIVER_NAME "orion_spi" | 23 | #define DRIVER_NAME "orion_spi" |
@@ -46,6 +46,7 @@ struct orion_spi { | |||
46 | unsigned int max_speed; | 46 | unsigned int max_speed; |
47 | unsigned int min_speed; | 47 | unsigned int min_speed; |
48 | struct orion_spi_info *spi_info; | 48 | struct orion_spi_info *spi_info; |
49 | struct clk *clk; | ||
49 | }; | 50 | }; |
50 | 51 | ||
51 | static struct workqueue_struct *orion_spi_wq; | 52 | static struct workqueue_struct *orion_spi_wq; |
@@ -104,7 +105,7 @@ static int orion_spi_baudrate_set(struct spi_device *spi, unsigned int speed) | |||
104 | 105 | ||
105 | orion_spi = spi_master_get_devdata(spi->master); | 106 | orion_spi = spi_master_get_devdata(spi->master); |
106 | 107 | ||
107 | tclk_hz = orion_spi->spi_info->tclk; | 108 | tclk_hz = clk_get_rate(orion_spi->clk); |
108 | 109 | ||
109 | /* | 110 | /* |
110 | * the supported rates are: 4,6,8...30 | 111 | * the supported rates are: 4,6,8...30 |
@@ -450,6 +451,7 @@ static int __init orion_spi_probe(struct platform_device *pdev) | |||
450 | struct orion_spi *spi; | 451 | struct orion_spi *spi; |
451 | struct resource *r; | 452 | struct resource *r; |
452 | struct orion_spi_info *spi_info; | 453 | struct orion_spi_info *spi_info; |
454 | unsigned long tclk_hz; | ||
453 | int status = 0; | 455 | int status = 0; |
454 | 456 | ||
455 | spi_info = pdev->dev.platform_data; | 457 | spi_info = pdev->dev.platform_data; |
@@ -476,19 +478,28 @@ static int __init orion_spi_probe(struct platform_device *pdev) | |||
476 | spi->master = master; | 478 | spi->master = master; |
477 | spi->spi_info = spi_info; | 479 | spi->spi_info = spi_info; |
478 | 480 | ||
479 | spi->max_speed = DIV_ROUND_UP(spi_info->tclk, 4); | 481 | spi->clk = clk_get(&pdev->dev, NULL); |
480 | spi->min_speed = DIV_ROUND_UP(spi_info->tclk, 30); | 482 | if (IS_ERR(spi->clk)) { |
483 | status = PTR_ERR(spi->clk); | ||
484 | goto out; | ||
485 | } | ||
486 | |||
487 | clk_prepare(spi->clk); | ||
488 | clk_enable(spi->clk); | ||
489 | tclk_hz = clk_get_rate(spi->clk); | ||
490 | spi->max_speed = DIV_ROUND_UP(tclk_hz, 4); | ||
491 | spi->min_speed = DIV_ROUND_UP(tclk_hz, 30); | ||
481 | 492 | ||
482 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 493 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
483 | if (r == NULL) { | 494 | if (r == NULL) { |
484 | status = -ENODEV; | 495 | status = -ENODEV; |
485 | goto out; | 496 | goto out_rel_clk; |
486 | } | 497 | } |
487 | 498 | ||
488 | if (!request_mem_region(r->start, resource_size(r), | 499 | if (!request_mem_region(r->start, resource_size(r), |
489 | dev_name(&pdev->dev))) { | 500 | dev_name(&pdev->dev))) { |
490 | status = -EBUSY; | 501 | status = -EBUSY; |
491 | goto out; | 502 | goto out_rel_clk; |
492 | } | 503 | } |
493 | spi->base = ioremap(r->start, SZ_1K); | 504 | spi->base = ioremap(r->start, SZ_1K); |
494 | 505 | ||
@@ -508,7 +519,9 @@ static int __init orion_spi_probe(struct platform_device *pdev) | |||
508 | 519 | ||
509 | out_rel_mem: | 520 | out_rel_mem: |
510 | release_mem_region(r->start, resource_size(r)); | 521 | release_mem_region(r->start, resource_size(r)); |
511 | 522 | out_rel_clk: | |
523 | clk_disable_unprepare(spi->clk); | ||
524 | clk_put(spi->clk); | ||
512 | out: | 525 | out: |
513 | spi_master_put(master); | 526 | spi_master_put(master); |
514 | return status; | 527 | return status; |
@@ -526,6 +539,9 @@ static int __exit orion_spi_remove(struct platform_device *pdev) | |||
526 | 539 | ||
527 | cancel_work_sync(&spi->work); | 540 | cancel_work_sync(&spi->work); |
528 | 541 | ||
542 | clk_disable_unprepare(spi->clk); | ||
543 | clk_put(spi->clk); | ||
544 | |||
529 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 545 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
530 | release_mem_region(r->start, resource_size(r)); | 546 | release_mem_region(r->start, resource_size(r)); |
531 | 547 | ||
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h deleted file mode 100644 index b4d9fa6f797c..000000000000 --- a/include/linux/spi/orion_spi.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* | ||
2 | * orion_spi.h | ||
3 | * | ||
4 | * This file is licensed under the terms of the GNU General Public | ||
5 | * License version 2. This program is licensed "as is" without any | ||
6 | * warranty of any kind, whether express or implied. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_SPI_ORION_SPI_H | ||
10 | #define __LINUX_SPI_ORION_SPI_H | ||
11 | |||
12 | struct orion_spi_info { | ||
13 | u32 tclk; /* no <linux/clk.h> support yet */ | ||
14 | }; | ||
15 | |||
16 | |||
17 | #endif | ||