[tools/mklibs] add missing includes ('unistd.h') for mklibs
[openwrt.git] / target / linux / lantiq / patches-3.2 / 0030-MIPS-lantiq-convert-falcon-gpio-to-clkdev-api.patch
1 From 3cb13f9992ae1948b6ca05c88d2bd25cf9e7cd41 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 30/70] 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 --- a/arch/mips/lantiq/falcon/devices.c
16 +++ b/arch/mips/lantiq/falcon/devices.c
17 @@ -111,9 +111,6 @@ falcon_register_gpio(void)
18                 falcon_gpio1_res, ARRAY_SIZE(falcon_gpio1_res));
19         platform_device_register_simple("falcon_gpio", 2,
20                 falcon_gpio2_res, ARRAY_SIZE(falcon_gpio2_res));
21 -       ltq_sysctl_activate(SYSCTL_SYS1, ACTS_PADCTRL1 | ACTS_P1);
22 -       ltq_sysctl_activate(SYSCTL_SYSETH, ACTS_PADCTRL0 |
23 -               ACTS_PADCTRL2 | ACTS_P0 | ACTS_P2);
24  }
25  
26  void __init
27 @@ -123,6 +120,4 @@ falcon_register_gpio_extra(void)
28                 falcon_gpio3_res, ARRAY_SIZE(falcon_gpio3_res));
29         platform_device_register_simple("falcon_gpio", 4,
30                 falcon_gpio4_res, ARRAY_SIZE(falcon_gpio4_res));
31 -       ltq_sysctl_activate(SYSCTL_SYS1,
32 -               ACTS_PADCTRL3 | ACTS_PADCTRL4 | ACTS_P3 | ACTS_P4);
33  }
34 --- a/arch/mips/lantiq/falcon/gpio.c
35 +++ b/arch/mips/lantiq/falcon/gpio.c
36 @@ -11,6 +11,7 @@
37  #include <linux/interrupt.h>
38  #include <linux/slab.h>
39  #include <linux/export.h>
40 +#include <linux/err.h>
41  #include <linux/platform_device.h>
42  
43  #include <lantiq_soc.h>
44 @@ -71,6 +72,7 @@ struct falcon_gpio_port {
45         void __iomem *port;
46         unsigned int irq_base;
47         unsigned int chained_irq;
48 +       struct clk *clk;
49  };
50  
51  static struct falcon_gpio_port ltq_gpio_port[MAX_PORTS];
52 @@ -332,6 +334,14 @@ falcon_gpio_probe(struct platform_device
53                 goto err;
54         }
55  
56 +       gpio_port->clk = clk_get(&pdev->dev, NULL);
57 +       if (IS_ERR(gpio_port->clk)) {
58 +               dev_err(&pdev->dev, "Could not get clock\n");
59 +               ret = PTR_ERR(gpio_port->clk);;
60 +               goto err;
61 +       }
62 +       clk_enable(gpio_port->clk);
63 +
64         if (irq > 0) {
65                 /* irq_chip support */
66                 gpio_port->gpio_chip.to_irq = falcon_gpio_to_irq;