diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-02-07 10:31:56 -0500 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2013-03-13 06:05:11 -0400 |
commit | 557b7d5d0787997247a798e6f46541fe9dc977fa (patch) | |
tree | e38f38290608819345f711ebd1f286054475b1d6 | |
parent | 67cf9c0a00bd88443adb7d6c3efa8b18d03f97c5 (diff) |
ARM: at91/avr32/atmel_lcdfb: add bus-clock entry
Add hclk entry for the atmel_lcdfb bus clock.
On at91sam9261, at91sam9g10 and at32ap the bus clock has to be enabled
as well as the peripheral clock. Add the appropriate lookup entries to
these SOCs and fake clocks to the SOCs that do not use it.
This allows us to get rid of the conditional enabling of the clocks in
the driver which relied on the cpu_is macros.
Tested on at91sam9263 and at91sam9g45, compile-tested for other
AT91-SOCs, and untested for AVR32.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
-rw-r--r-- | arch/arm/mach-at91/at91sam9261.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9263.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9g45.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9rl.c | 1 | ||||
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 4 | ||||
-rw-r--r-- | drivers/video/atmel_lcdfb.c | 23 |
6 files changed, 14 insertions, 17 deletions
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index 2998a08afc2d..5838f12e6698 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c | |||
@@ -169,6 +169,7 @@ static struct clk *periph_clocks[] __initdata = { | |||
169 | }; | 169 | }; |
170 | 170 | ||
171 | static struct clk_lookup periph_clocks_lookups[] = { | 171 | static struct clk_lookup periph_clocks_lookups[] = { |
172 | CLKDEV_CON_DEV_ID("hclk", "atmel_lcdfb.0", &hck1), | ||
172 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), | 173 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), |
173 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), | 174 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), |
174 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), | 175 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), |
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index b9fc60d1b33a..520a63d31329 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c | |||
@@ -190,6 +190,7 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
190 | CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk), | 190 | CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk), |
191 | CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk), | 191 | CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk), |
192 | CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk), | 192 | CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk), |
193 | CLKDEV_CON_DEV_ID("hclk", "atmel_lcdfb.0", &lcdc_clk), | ||
193 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk), | 194 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk), |
194 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk), | 195 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk), |
195 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), | 196 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), |
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index d3addee43d8d..ea6b62bcbe77 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c | |||
@@ -228,6 +228,7 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
228 | CLKDEV_CON_ID("hclk", &macb_clk), | 228 | CLKDEV_CON_ID("hclk", &macb_clk), |
229 | /* One additional fake clock for ohci */ | 229 | /* One additional fake clock for ohci */ |
230 | CLKDEV_CON_ID("ohci_clk", &uhphs_clk), | 230 | CLKDEV_CON_ID("ohci_clk", &uhphs_clk), |
231 | CLKDEV_CON_DEV_ID("hclk", "atmel_lcdfb.0", &lcdc_clk), | ||
231 | CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk), | 232 | CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk), |
232 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), | 233 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), |
233 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), | 234 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), |
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c index eb98704db2d9..4cd4fa985d0d 100644 --- a/arch/arm/mach-at91/at91sam9rl.c +++ b/arch/arm/mach-at91/at91sam9rl.c | |||
@@ -179,6 +179,7 @@ static struct clk *periph_clocks[] __initdata = { | |||
179 | }; | 179 | }; |
180 | 180 | ||
181 | static struct clk_lookup periph_clocks_lookups[] = { | 181 | static struct clk_lookup periph_clocks_lookups[] = { |
182 | CLKDEV_CON_DEV_ID("hclk", "atmel_lcdfb.0", &lcdc_clk), | ||
182 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), | 183 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), |
183 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), | 184 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), |
184 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), | 185 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), |
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index b323d8d3185b..cd25b01b5848 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -1453,7 +1453,7 @@ static struct resource atmel_lcdfb0_resource[] = { | |||
1453 | }, | 1453 | }, |
1454 | }; | 1454 | }; |
1455 | DEFINE_DEV_DATA(atmel_lcdfb, 0); | 1455 | DEFINE_DEV_DATA(atmel_lcdfb, 0); |
1456 | DEV_CLK(hck1, atmel_lcdfb0, hsb, 7); | 1456 | DEV_CLK(hclk, atmel_lcdfb0, hsb, 7); |
1457 | static struct clk atmel_lcdfb0_pixclk = { | 1457 | static struct clk atmel_lcdfb0_pixclk = { |
1458 | .name = "lcdc_clk", | 1458 | .name = "lcdc_clk", |
1459 | .dev = &atmel_lcdfb0_device.dev, | 1459 | .dev = &atmel_lcdfb0_device.dev, |
@@ -2246,7 +2246,7 @@ static __initdata struct clk *init_clocks[] = { | |||
2246 | &atmel_twi0_pclk, | 2246 | &atmel_twi0_pclk, |
2247 | &atmel_mci0_pclk, | 2247 | &atmel_mci0_pclk, |
2248 | #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) | 2248 | #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) |
2249 | &atmel_lcdfb0_hck1, | 2249 | &atmel_lcdfb0_hclk, |
2250 | &atmel_lcdfb0_pixclk, | 2250 | &atmel_lcdfb0_pixclk, |
2251 | #endif | 2251 | #endif |
2252 | &ssc0_pclk, | 2252 | &ssc0_pclk, |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 025428e04c33..c5883cafa38a 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -821,15 +821,13 @@ static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo) | |||
821 | 821 | ||
822 | static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo) | 822 | static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo) |
823 | { | 823 | { |
824 | if (sinfo->bus_clk) | 824 | clk_enable(sinfo->bus_clk); |
825 | clk_enable(sinfo->bus_clk); | ||
826 | clk_enable(sinfo->lcdc_clk); | 825 | clk_enable(sinfo->lcdc_clk); |
827 | } | 826 | } |
828 | 827 | ||
829 | static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo) | 828 | static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo) |
830 | { | 829 | { |
831 | if (sinfo->bus_clk) | 830 | clk_disable(sinfo->bus_clk); |
832 | clk_disable(sinfo->bus_clk); | ||
833 | clk_disable(sinfo->lcdc_clk); | 831 | clk_disable(sinfo->lcdc_clk); |
834 | } | 832 | } |
835 | 833 | ||
@@ -888,13 +886,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
888 | info->fix = atmel_lcdfb_fix; | 886 | info->fix = atmel_lcdfb_fix; |
889 | 887 | ||
890 | /* Enable LCDC Clocks */ | 888 | /* Enable LCDC Clocks */ |
891 | if (cpu_is_at91sam9261() || cpu_is_at91sam9g10() | 889 | sinfo->bus_clk = clk_get(dev, "hclk"); |
892 | || cpu_is_at32ap7000()) { | 890 | if (IS_ERR(sinfo->bus_clk)) { |
893 | sinfo->bus_clk = clk_get(dev, "hck1"); | 891 | ret = PTR_ERR(sinfo->bus_clk); |
894 | if (IS_ERR(sinfo->bus_clk)) { | 892 | goto free_info; |
895 | ret = PTR_ERR(sinfo->bus_clk); | ||
896 | goto free_info; | ||
897 | } | ||
898 | } | 893 | } |
899 | sinfo->lcdc_clk = clk_get(dev, "lcdc_clk"); | 894 | sinfo->lcdc_clk = clk_get(dev, "lcdc_clk"); |
900 | if (IS_ERR(sinfo->lcdc_clk)) { | 895 | if (IS_ERR(sinfo->lcdc_clk)) { |
@@ -1055,8 +1050,7 @@ stop_clk: | |||
1055 | atmel_lcdfb_stop_clock(sinfo); | 1050 | atmel_lcdfb_stop_clock(sinfo); |
1056 | clk_put(sinfo->lcdc_clk); | 1051 | clk_put(sinfo->lcdc_clk); |
1057 | put_bus_clk: | 1052 | put_bus_clk: |
1058 | if (sinfo->bus_clk) | 1053 | clk_put(sinfo->bus_clk); |
1059 | clk_put(sinfo->bus_clk); | ||
1060 | free_info: | 1054 | free_info: |
1061 | framebuffer_release(info); | 1055 | framebuffer_release(info); |
1062 | out: | 1056 | out: |
@@ -1081,8 +1075,7 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev) | |||
1081 | unregister_framebuffer(info); | 1075 | unregister_framebuffer(info); |
1082 | atmel_lcdfb_stop_clock(sinfo); | 1076 | atmel_lcdfb_stop_clock(sinfo); |
1083 | clk_put(sinfo->lcdc_clk); | 1077 | clk_put(sinfo->lcdc_clk); |
1084 | if (sinfo->bus_clk) | 1078 | clk_put(sinfo->bus_clk); |
1085 | clk_put(sinfo->bus_clk); | ||
1086 | fb_dealloc_cmap(&info->cmap); | 1079 | fb_dealloc_cmap(&info->cmap); |
1087 | free_irq(sinfo->irq_base, info); | 1080 | free_irq(sinfo->irq_base, info); |
1088 | iounmap(sinfo->mmio); | 1081 | iounmap(sinfo->mmio); |