[lantiq] update 3.2 patches
[openwrt.git] / target / linux / lantiq / patches-3.2 / 0029-MIPS-lantiq-convert-falcon-gpio-to-clkdev-api.patch
1 From 509bc67e8e365c8f1a0cb91abcac7c7772cf8335 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Thu, 8 Mar 2012 11:22:03 +0100
4 Subject: [PATCH 29/73] MIPS: lantiq: convert falcon gpio to clkdev api
5
6 The falcon gpio clocks used to be enabled when registering the platform device.
7 Move this code into the driver and use clkdev api.
8
9 Signed-off-by: John Crispin <blogic@openwrt.org>
10 ---
11  arch/mips/lantiq/falcon/devices.c |    5 -----
12  arch/mips/lantiq/falcon/gpio.c    |   10 ++++++++++
13  2 files changed, 10 insertions(+), 5 deletions(-)
14
15 diff --git a/arch/mips/lantiq/falcon/devices.c b/arch/mips/lantiq/falcon/devices.c
16 index 4f47b44..6cd7a88 100644
17 --- a/arch/mips/lantiq/falcon/devices.c
18 +++ b/arch/mips/lantiq/falcon/devices.c
19 @@ -111,9 +111,6 @@ falcon_register_gpio(void)
20                 falcon_gpio1_res, ARRAY_SIZE(falcon_gpio1_res));
21         platform_device_register_simple("falcon_gpio", 2,
22                 falcon_gpio2_res, ARRAY_SIZE(falcon_gpio2_res));
23 -       ltq_sysctl_activate(SYSCTL_SYS1, ACTS_PADCTRL1 | ACTS_P1);
24 -       ltq_sysctl_activate(SYSCTL_SYSETH, ACTS_PADCTRL0 |
25 -               ACTS_PADCTRL2 | ACTS_P0 | ACTS_P2);
26  }
27  
28  void __init
29 @@ -123,6 +120,4 @@ falcon_register_gpio_extra(void)
30                 falcon_gpio3_res, ARRAY_SIZE(falcon_gpio3_res));
31         platform_device_register_simple("falcon_gpio", 4,
32                 falcon_gpio4_res, ARRAY_SIZE(falcon_gpio4_res));
33 -       ltq_sysctl_activate(SYSCTL_SYS1,
34 -               ACTS_PADCTRL3 | ACTS_PADCTRL4 | ACTS_P3 | ACTS_P4);
35  }
36 diff --git a/arch/mips/lantiq/falcon/gpio.c b/arch/mips/lantiq/falcon/gpio.c
37 index a44f71b..4147d61 100644
38 --- a/arch/mips/lantiq/falcon/gpio.c
39 +++ b/arch/mips/lantiq/falcon/gpio.c
40 @@ -11,6 +11,7 @@
41  #include <linux/interrupt.h>
42  #include <linux/slab.h>
43  #include <linux/export.h>
44 +#include <linux/err.h>
45  #include <linux/platform_device.h>
46  
47  #include <lantiq_soc.h>
48 @@ -71,6 +72,7 @@ struct falcon_gpio_port {
49         void __iomem *port;
50         unsigned int irq_base;
51         unsigned int chained_irq;
52 +       struct clk *clk;
53  };
54  
55  static struct falcon_gpio_port ltq_gpio_port[MAX_PORTS];
56 @@ -332,6 +334,14 @@ falcon_gpio_probe(struct platform_device *pdev)
57                 goto err;
58         }
59  
60 +       gpio_port->clk = clk_get(&pdev->dev, NULL);
61 +       if (IS_ERR(gpio_port->clk)) {
62 +               dev_err(&pdev->dev, "Could not get clock\n");
63 +               ret = PTR_ERR(gpio_port->clk);;
64 +               goto err;
65 +       }
66 +       clk_enable(gpio_port->clk);
67 +
68         if (irq > 0) {
69                 /* irq_chip support */
70                 gpio_port->gpio_chip.to_irq = falcon_gpio_to_irq;
71 -- 
72 1.7.9.1
73