ARM: at91/avr32/atmel_lcdfb: add bus-clock entry
authorJohan Hovold <jhovold@gmail.com>
Thu, 7 Feb 2013 15:31:56 +0000 (16:31 +0100)
committerNicolas Ferre <nicolas.ferre@atmel.com>
Wed, 13 Mar 2013 10:05:11 +0000 (11:05 +0100)
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>
arch/arm/mach-at91/at91sam9261.c
arch/arm/mach-at91/at91sam9263.c
arch/arm/mach-at91/at91sam9g45.c
arch/arm/mach-at91/at91sam9rl.c
arch/avr32/mach-at32ap/at32ap700x.c
drivers/video/atmel_lcdfb.c

index 2998a08afc2d91a020700807ff9fcd0ca813b68c..5838f12e6698daa6e4539c7e79e03bef627f5339 100644 (file)
@@ -169,6 +169,7 @@ static struct clk *periph_clocks[] __initdata = {
 };
 
 static struct clk_lookup periph_clocks_lookups[] = {
+       CLKDEV_CON_DEV_ID("hclk", "atmel_lcdfb.0", &hck1),
        CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
        CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
        CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
index b9fc60d1b33a2f2e6f0e4feef4f44fb82dda38e9..520a63d313290d61c5e71a886395339ed1a28be0 100644 (file)
@@ -190,6 +190,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
        CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
        CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk),
        CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk),
+       CLKDEV_CON_DEV_ID("hclk", "atmel_lcdfb.0", &lcdc_clk),
        CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk),
        CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk),
        CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
index d3addee43d8dac22689c5e3b3970564dbc0d2aca..ea6b62bcbe77689a9ad9de8d5e4c3e552850747e 100644 (file)
@@ -228,6 +228,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
        CLKDEV_CON_ID("hclk", &macb_clk),
        /* One additional fake clock for ohci */
        CLKDEV_CON_ID("ohci_clk", &uhphs_clk),
+       CLKDEV_CON_DEV_ID("hclk", "atmel_lcdfb.0", &lcdc_clk),
        CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk),
        CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk),
        CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk),
index eb98704db2d92a4b24835b226cedcf7814260529..4cd4fa985d0d011b5eb67fce8e4ee30952610468 100644 (file)
@@ -179,6 +179,7 @@ static struct clk *periph_clocks[] __initdata = {
 };
 
 static struct clk_lookup periph_clocks_lookups[] = {
+       CLKDEV_CON_DEV_ID("hclk", "atmel_lcdfb.0", &lcdc_clk),
        CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk),
        CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk),
        CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
index b323d8d3185b35b91a21da1857bcd340d935449c..cd25b01b584848694a454690f2e773d2c49b3c4a 100644 (file)
@@ -1453,7 +1453,7 @@ static struct resource atmel_lcdfb0_resource[] = {
        },
 };
 DEFINE_DEV_DATA(atmel_lcdfb, 0);
-DEV_CLK(hck1, atmel_lcdfb0, hsb, 7);
+DEV_CLK(hclk, atmel_lcdfb0, hsb, 7);
 static struct clk atmel_lcdfb0_pixclk = {
        .name           = "lcdc_clk",
        .dev            = &atmel_lcdfb0_device.dev,
@@ -2246,7 +2246,7 @@ static __initdata struct clk *init_clocks[] = {
        &atmel_twi0_pclk,
        &atmel_mci0_pclk,
 #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
-       &atmel_lcdfb0_hck1,
+       &atmel_lcdfb0_hclk,
        &atmel_lcdfb0_pixclk,
 #endif
        &ssc0_pclk,
index 025428e04c33c7bb99a80f2310b5dfdf8c936c2b..c5883cafa38a831b07ae7bf708e64e412b06a21a 100644 (file)
@@ -821,15 +821,13 @@ static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
 
 static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo)
 {
-       if (sinfo->bus_clk)
-               clk_enable(sinfo->bus_clk);
+       clk_enable(sinfo->bus_clk);
        clk_enable(sinfo->lcdc_clk);
 }
 
 static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
 {
-       if (sinfo->bus_clk)
-               clk_disable(sinfo->bus_clk);
+       clk_disable(sinfo->bus_clk);
        clk_disable(sinfo->lcdc_clk);
 }
 
@@ -888,13 +886,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
        info->fix = atmel_lcdfb_fix;
 
        /* Enable LCDC Clocks */
-       if (cpu_is_at91sam9261() || cpu_is_at91sam9g10()
-        || cpu_is_at32ap7000()) {
-               sinfo->bus_clk = clk_get(dev, "hck1");
-               if (IS_ERR(sinfo->bus_clk)) {
-                       ret = PTR_ERR(sinfo->bus_clk);
-                       goto free_info;
-               }
+       sinfo->bus_clk = clk_get(dev, "hclk");
+       if (IS_ERR(sinfo->bus_clk)) {
+               ret = PTR_ERR(sinfo->bus_clk);
+               goto free_info;
        }
        sinfo->lcdc_clk = clk_get(dev, "lcdc_clk");
        if (IS_ERR(sinfo->lcdc_clk)) {
@@ -1055,8 +1050,7 @@ stop_clk:
        atmel_lcdfb_stop_clock(sinfo);
        clk_put(sinfo->lcdc_clk);
 put_bus_clk:
-       if (sinfo->bus_clk)
-               clk_put(sinfo->bus_clk);
+       clk_put(sinfo->bus_clk);
 free_info:
        framebuffer_release(info);
 out:
@@ -1081,8 +1075,7 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
        unregister_framebuffer(info);
        atmel_lcdfb_stop_clock(sinfo);
        clk_put(sinfo->lcdc_clk);
-       if (sinfo->bus_clk)
-               clk_put(sinfo->bus_clk);
+       clk_put(sinfo->bus_clk);
        fb_dealloc_cmap(&info->cmap);
        free_irq(sinfo->irq_base, info);
        iounmap(sinfo->mmio);