Re: [PATCH v8 10/11] OMAP: GPIO: Implement GPIO as a platform device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 25, 2010 at 4:48 AM, Varadarajan, Charulatha <charu@xxxxxx> wrote:
> Implement GPIO as a platform device.
>
> GPIO APIs are used in machine_init functions. Hence it is
> required to complete GPIO probe before board_init. Therefore
> GPIO device register and driver register are implemented as
> postcore_initcalls.
>
> omap_gpio_init() does nothing now and this function would be
> removed in the next patch as it's usage is spread across most
> of the board files.
>
> Inorder to convert GPIO as platform device, modifications are
> required in clockxxxx_data.c file for OMAP1 so that device names
> can be used to obtain clock instead of getting clocks by
> name/NULL ptr.
>
> Use runtime pm APIs (pm_runtime_put*/pm_runtime_get*) for enabling
> or disabling the clocks, modify sysconfig settings and remove usage
> of clock FW APIs.
> Note 1: Converting GPIO driver to use runtime PM APIs is not done as a
> separate patch because GPIO clock names are different for various OMAPs
> and are different for some of the banks in the same CPU. This would need
> usage of cpu_is checks and bank id checks while using clock FW APIs in
> the gpio driver. Hence while making GPIO a platform driver framework,
> PM runtime APIs are used directly.
>
> Note 2: While implementing GPIO as a platform device, pm runtime APIs
> are used as mentioned above and modification is not done in gpio's
> prepare for idle/ resume after idle functions. This would be done
> in the next patch series and GPIO driver would be made to use dev_pm_ops
> instead of sysdev_class in that series only.
>
> Due to the above, the GPIO driver implicitly relies on
> CM_AUTOIDLE = 1 on its iclk for power management to work, since the
> driver never disables its iclk.
> This would be taken care in the next patch series (see Note 3 below).
>
> Refer to
> http://www.mail-archive.com/linux-omap@xxxxxxxxxxxxxxx/msg39112.html
> for more details.
>
> Note 3: only pm_runtime_get_sync is called in gpio's probe() and
> pm_runtime_put* is never called. This is to make the implementation
> similar to the existing GPIO code. Another patch series would be sent
> to correct this.
>
> In OMAP3 and OMAP4 gpio's debounce clocks are optional clocks. They
> are enabled/ disabled whenever required using clock framework APIs
>
> TODO:
> 1. Cleanup the GPIO driver. Use function pointers and register
> offest pointers instead of using hardcoded values
> 2. Remove all cpu_is_ checks and OMAP specific macros
> 3. Remove usage of gpio_bank array so that only
> Â instance specific information is used in driver code
> 4. Rename 'method'/ avoid it's usage
> 5. Fix the non-wakeup gpios handling for OMAP2430, OMAP3 & OMAP4
> 6. Modify gpio's prepare for idle/ resume after idle functions
> Â to use runtime pm implentation.
>
> Signed-off-by: Charulatha V <charu@xxxxxx>
> Signed-off-by: Rajendra Nayak <rnayak@xxxxxx>
> Reviewed-by: Basak, Partha <p-basak2@xxxxxx>
> ---
> Âarch/arm/mach-omap1/Makefile   |  Â6 +
> Âarch/arm/mach-omap1/clock_data.c | Â Â4 +-
> Âarch/arm/mach-omap2/Makefile   |  Â2 +-
> Âarch/arm/plat-omap/gpio.c    Â| Â420 ++++++++++----------------------------
> Â4 files changed, 114 insertions(+), 318 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
> index de3cc13..0b1c07f 100644
> --- a/arch/arm/mach-omap1/Makefile
> +++ b/arch/arm/mach-omap1/Makefile
> @@ -49,6 +49,12 @@ ifeq ($(CONFIG_ARCH_OMAP15XX),y)
> Âobj-$(CONFIG_MACH_OMAP_INNOVATOR) Â Â Â+= fpga.o
> Âendif
>
> +# GPIO
> +obj-$(CONFIG_ARCH_OMAP730) Â Â Â Â Â Â += gpio7xx.o
> +obj-$(CONFIG_ARCH_OMAP850) Â Â Â Â Â Â += gpio7xx.o
> +obj-$(CONFIG_ARCH_OMAP15XX) Â Â Â Â Â Â+= gpio15xx.o
> +obj-$(CONFIG_ARCH_OMAP16XX) Â Â Â Â Â Â+= gpio16xx.o
> +
> Â# LEDs support
> Âled-$(CONFIG_MACH_OMAP_H2) Â Â Â Â Â Â += leds-h2p2-debug.o
> Âled-$(CONFIG_MACH_OMAP_H3) Â Â Â Â Â Â += leds-h2p2-debug.o
> diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
> index af54114..423d21d 100644
> --- a/arch/arm/mach-omap1/clock_data.c
> +++ b/arch/arm/mach-omap1/clock_data.c
> @@ -143,7 +143,7 @@ static struct arm_idlect1_clk armper_ck = {
> Â* activation. Â[ GPIO code for 1510 ]
> Â*/
> Âstatic struct clk arm_gpio_ck = {
> -    .name      = "arm_gpio_ck",
> +    .name      = "ick",
>    Â.ops      Â= &clkops_generic,
>    Â.parent     = &ck_dpll1,
>    Â.flags     Â= ENABLE_ON_INIT,
> @@ -684,7 +684,7 @@ static struct omap_clk omap_clks[] = {
> Â Â Â ÂCLK(NULL, Â Â Â "ck_sossi", Â Â &sossi_ck, Â Â ÂCK_16XX),
> Â Â Â ÂCLK(NULL, Â Â Â "arm_ck", Â Â Â &arm_ck, Â Â Â ÂCK_16XX | CK_1510 | CK_310),
> Â Â Â ÂCLK(NULL, Â Â Â "armper_ck", Â Â&armper_ck.clk, CK_16XX | CK_1510 | CK_310),
> - Â Â Â CLK(NULL, Â Â Â "arm_gpio_ck", Â&arm_gpio_ck, Â CK_1510 | CK_310),
> + Â Â Â CLK("omap_gpio.0", "ick", Â Â Â &arm_gpio_ck, Â CK_1510 | CK_310),
> Â Â Â ÂCLK(NULL, Â Â Â "armxor_ck", Â Â&armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
> Â Â Â ÂCLK(NULL, Â Â Â "armtim_ck", Â Â&armtim_ck.clk, CK_16XX | CK_1510 | CK_310),
> Â Â Â ÂCLK("omap_wdt", "fck", Â Â Â Â Â&armwdt_ck.clk, CK_16XX | CK_1510 | CK_310),
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index eb31c9c..31864e1 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -4,7 +4,7 @@
>
> Â# Common support
> Âobj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
> - Â Â Â Âcommon.o
> + Â Â Â Âcommon.o gpio.o
>
> Âomap-2-3-common                Â= irq.o sdrc.o prm2xxx_3xxx.o
> Âhwmod-common              = omap_hwmod.o \
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index 610787c..d04ded2 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
> @@ -21,6 +21,8 @@
> Â#include <linux/err.h>
> Â#include <linux/clk.h>
> Â#include <linux/io.h>
> +#include <linux/slab.h>
> +#include <linux/pm_runtime.h>
>
> Â#include <mach/hardware.h>
> Â#include <asm/irq.h>
> @@ -32,7 +34,6 @@
> Â/*
> Â* OMAP1510 GPIO registers
> Â*/
> -#define OMAP1510_GPIO_BASE Â Â Â Â Â Â 0xfffce000
> Â#define OMAP1510_GPIO_DATA_INPUT Â Â Â 0x00
> Â#define OMAP1510_GPIO_DATA_OUTPUT Â Â Â0x04
> Â#define OMAP1510_GPIO_DIR_CONTROL Â Â Â0x08
> @@ -46,10 +47,6 @@
> Â/*
> Â* OMAP1610 specific GPIO registers
> Â*/
> -#define OMAP1610_GPIO1_BASE Â Â Â Â Â Â0xfffbe400
> -#define OMAP1610_GPIO2_BASE Â Â Â Â Â Â0xfffbec00
> -#define OMAP1610_GPIO3_BASE Â Â Â Â Â Â0xfffbb400
> -#define OMAP1610_GPIO4_BASE Â Â Â Â Â Â0xfffbbc00
> Â#define OMAP1610_GPIO_REVISION Â Â Â Â 0x0000
> Â#define OMAP1610_GPIO_SYSCONFIG Â Â Â Â Â Â Â Â0x0010
> Â#define OMAP1610_GPIO_SYSSTATUS Â Â Â Â Â Â Â Â0x0014
> @@ -71,12 +68,6 @@
> Â/*
> Â* OMAP7XX specific GPIO registers
> Â*/
> -#define OMAP7XX_GPIO1_BASE Â Â Â Â Â Â 0xfffbc000
> -#define OMAP7XX_GPIO2_BASE Â Â Â Â Â Â 0xfffbc800
> -#define OMAP7XX_GPIO3_BASE Â Â Â Â Â Â 0xfffbd000
> -#define OMAP7XX_GPIO4_BASE Â Â Â Â Â Â 0xfffbd800
> -#define OMAP7XX_GPIO5_BASE Â Â Â Â Â Â 0xfffbe000
> -#define OMAP7XX_GPIO6_BASE Â Â Â Â Â Â 0xfffbe800
> Â#define OMAP7XX_GPIO_DATA_INPUT Â Â Â Â Â Â Â Â0x00
> Â#define OMAP7XX_GPIO_DATA_OUTPUT Â Â Â 0x04
> Â#define OMAP7XX_GPIO_DIR_CONTROL Â Â Â 0x08
> @@ -84,25 +75,10 @@
> Â#define OMAP7XX_GPIO_INT_MASK Â Â Â Â Â0x10
> Â#define OMAP7XX_GPIO_INT_STATUS Â Â Â Â Â Â Â Â0x14
>
> -#define OMAP1_MPUIO_VBASE Â Â Â Â Â Â ÂOMAP1_MPUIO_BASE
> -
> Â/*
> - * omap24xx specific GPIO registers
> + * omap2+ specific GPIO registers
> Â*/
> -#define OMAP242X_GPIO1_BASE Â Â Â Â Â Â0x48018000
> -#define OMAP242X_GPIO2_BASE Â Â Â Â Â Â0x4801a000
> -#define OMAP242X_GPIO3_BASE Â Â Â Â Â Â0x4801c000
> -#define OMAP242X_GPIO4_BASE Â Â Â Â Â Â0x4801e000
> -
> -#define OMAP243X_GPIO1_BASE Â Â Â Â Â Â0x4900C000
> -#define OMAP243X_GPIO2_BASE Â Â Â Â Â Â0x4900E000
> -#define OMAP243X_GPIO3_BASE Â Â Â Â Â Â0x49010000
> -#define OMAP243X_GPIO4_BASE Â Â Â Â Â Â0x49012000
> -#define OMAP243X_GPIO5_BASE Â Â Â Â Â Â0x480B6000
> -
> Â#define OMAP24XX_GPIO_REVISION Â Â Â Â 0x0000
> -#define OMAP24XX_GPIO_SYSCONFIG Â Â Â Â Â Â Â Â0x0010
> -#define OMAP24XX_GPIO_SYSSTATUS Â Â Â Â Â Â Â Â0x0014
> Â#define OMAP24XX_GPIO_IRQSTATUS1 Â Â Â 0x0018
> Â#define OMAP24XX_GPIO_IRQSTATUS2 Â Â Â 0x0028
> Â#define OMAP24XX_GPIO_IRQENABLE2 Â Â Â 0x002c
> @@ -126,7 +102,6 @@
> Â#define OMAP24XX_GPIO_SETDATAOUT Â Â Â 0x0094
>
> Â#define OMAP4_GPIO_REVISION Â Â Â Â Â Â0x0000
> -#define OMAP4_GPIO_SYSCONFIG Â Â Â Â Â 0x0010
> Â#define OMAP4_GPIO_EOI Â Â Â Â Â Â Â Â 0x0020
> Â#define OMAP4_GPIO_IRQSTATUSRAW0 Â Â Â 0x0024
> Â#define OMAP4_GPIO_IRQSTATUSRAW1 Â Â Â 0x0028
> @@ -138,7 +113,6 @@
> Â#define OMAP4_GPIO_IRQSTATUSCLR1 Â Â Â 0x0040
> Â#define OMAP4_GPIO_IRQWAKEN0 Â Â Â Â Â 0x0044
> Â#define OMAP4_GPIO_IRQWAKEN1 Â Â Â Â Â 0x0048
> -#define OMAP4_GPIO_SYSSTATUS Â Â Â Â Â 0x0114
> Â#define OMAP4_GPIO_IRQENABLE1 Â Â Â Â Â0x011c
> Â#define OMAP4_GPIO_WAKE_EN Â Â Â Â Â Â 0x0120
> Â#define OMAP4_GPIO_IRQSTATUS2 Â Â Â Â Â0x0128
> @@ -159,26 +133,6 @@
> Â#define OMAP4_GPIO_SETWKUENA Â Â Â Â Â 0x0184
> Â#define OMAP4_GPIO_CLEARDATAOUT Â Â Â Â Â Â Â Â0x0190
> Â#define OMAP4_GPIO_SETDATAOUT Â Â Â Â Â0x0194
> -/*
> - * omap34xx specific GPIO registers
> - */
> -
> -#define OMAP34XX_GPIO1_BASE Â Â Â Â Â Â0x48310000
> -#define OMAP34XX_GPIO2_BASE Â Â Â Â Â Â0x49050000
> -#define OMAP34XX_GPIO3_BASE Â Â Â Â Â Â0x49052000
> -#define OMAP34XX_GPIO4_BASE Â Â Â Â Â Â0x49054000
> -#define OMAP34XX_GPIO5_BASE Â Â Â Â Â Â0x49056000
> -#define OMAP34XX_GPIO6_BASE Â Â Â Â Â Â0x49058000
> -
> -/*
> - * OMAP44XX Âspecific GPIO registers
> - */
> -#define OMAP44XX_GPIO1_BASE Â Â Â Â Â Â 0x4a310000
> -#define OMAP44XX_GPIO2_BASE Â Â Â Â Â Â 0x48055000
> -#define OMAP44XX_GPIO3_BASE Â Â Â Â Â Â 0x48057000
> -#define OMAP44XX_GPIO4_BASE Â Â Â Â Â Â 0x48059000
> -#define OMAP44XX_GPIO5_BASE Â Â Â Â Â Â 0x4805B000
> -#define OMAP44XX_GPIO6_BASE Â Â Â Â Â Â 0x4805D000
>
> Âstruct gpio_bank {
> Â Â Â Âunsigned long pbase;
> @@ -203,97 +157,12 @@ struct gpio_bank {
> Â Â Â Âstruct clk *dbck;
> Â Â Â Âu32 mod_usage;
> Â Â Â Âu32 dbck_enable_mask;
> + Â Â Â struct device *dev;
> + Â Â Â bool dbck_flag;
> Â};
>
> -#ifdef CONFIG_ARCH_OMAP16XX
> -static struct gpio_bank gpio_bank_1610[5] = {
> - Â Â Â { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE,
> - Â Â Â Â Â Â Â METHOD_MPUIO },
> - Â Â Â { OMAP1610_GPIO1_BASE, NULL, INT_GPIO_BANK1, IH_GPIO_BASE,
> - Â Â Â Â Â Â Â METHOD_GPIO_1610 },
> - Â Â Â { OMAP1610_GPIO2_BASE, NULL, INT_1610_GPIO_BANK2, IH_GPIO_BASE + 16,
> - Â Â Â Â Â Â Â METHOD_GPIO_1610 },
> - Â Â Â { OMAP1610_GPIO3_BASE, NULL, INT_1610_GPIO_BANK3, IH_GPIO_BASE + 32,
> - Â Â Â Â Â Â Â METHOD_GPIO_1610 },
> - Â Â Â { OMAP1610_GPIO4_BASE, NULL, INT_1610_GPIO_BANK4, IH_GPIO_BASE + 48,
> - Â Â Â Â Â Â Â METHOD_GPIO_1610 },
> -};
> -#endif
> -
> -#ifdef CONFIG_ARCH_OMAP15XX
> -static struct gpio_bank gpio_bank_1510[2] = {
> - Â Â Â { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE,
> - Â Â Â Â Â Â Â METHOD_MPUIO },
> - Â Â Â { OMAP1510_GPIO_BASE, NULL, INT_GPIO_BANK1, IH_GPIO_BASE,
> - Â Â Â Â Â Â Â METHOD_GPIO_1510 }
> -};
> -#endif
> -
> -#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
> -static struct gpio_bank gpio_bank_7xx[7] = {
> - Â Â Â { OMAP1_MPUIO_VBASE, NULL, INT_7XX_MPUIO, IH_MPUIO_BASE,
> - Â Â Â Â Â Â Â METHOD_MPUIO },
> - Â Â Â { OMAP7XX_GPIO1_BASE, NULL, INT_7XX_GPIO_BANK1, IH_GPIO_BASE,
> - Â Â Â Â Â Â Â METHOD_GPIO_7XX },
> - Â Â Â { OMAP7XX_GPIO2_BASE, NULL, INT_7XX_GPIO_BANK2, IH_GPIO_BASE + 32,
> - Â Â Â Â Â Â Â METHOD_GPIO_7XX },
> - Â Â Â { OMAP7XX_GPIO3_BASE, NULL, INT_7XX_GPIO_BANK3, IH_GPIO_BASE + 64,
> - Â Â Â Â Â Â Â METHOD_GPIO_7XX },
> - Â Â Â { OMAP7XX_GPIO4_BASE, NULL, INT_7XX_GPIO_BANK4, ÂIH_GPIO_BASE + 96,
> - Â Â Â Â Â Â Â METHOD_GPIO_7XX },
> - Â Â Â { OMAP7XX_GPIO5_BASE, NULL, INT_7XX_GPIO_BANK5, ÂIH_GPIO_BASE + 128,
> - Â Â Â Â Â Â Â METHOD_GPIO_7XX },
> - Â Â Â { OMAP7XX_GPIO6_BASE, NULL, INT_7XX_GPIO_BANK6, ÂIH_GPIO_BASE + 160,
> - Â Â Â Â Â Â Â METHOD_GPIO_7XX },
> -};
> -#endif
> -
> -#ifdef CONFIG_ARCH_OMAP2
> -
> -static struct gpio_bank gpio_bank_242x[4] = {
> - Â Â Â { OMAP242X_GPIO1_BASE, NULL, INT_24XX_GPIO_BANK1, IH_GPIO_BASE,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP242X_GPIO2_BASE, NULL, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP242X_GPIO3_BASE, NULL, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP242X_GPIO4_BASE, NULL, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> -};
> -
> -static struct gpio_bank gpio_bank_243x[5] = {
> - Â Â Â { OMAP243X_GPIO1_BASE, NULL, INT_24XX_GPIO_BANK1, IH_GPIO_BASE,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP243X_GPIO2_BASE, NULL, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP243X_GPIO3_BASE, NULL, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP243X_GPIO4_BASE, NULL, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP243X_GPIO5_BASE, NULL, INT_24XX_GPIO_BANK5, IH_GPIO_BASE + 128,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> -};
> -
> -#endif
> -
> Â#ifdef CONFIG_ARCH_OMAP3
> -static struct gpio_bank gpio_bank_34xx[6] = {
> - Â Â Â { OMAP34XX_GPIO1_BASE, NULL, INT_34XX_GPIO_BANK1, IH_GPIO_BASE,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP34XX_GPIO2_BASE, NULL, INT_34XX_GPIO_BANK2, IH_GPIO_BASE + 32,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP34XX_GPIO3_BASE, NULL, INT_34XX_GPIO_BANK3, IH_GPIO_BASE + 64,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP34XX_GPIO4_BASE, NULL, INT_34XX_GPIO_BANK4, IH_GPIO_BASE + 96,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP34XX_GPIO5_BASE, NULL, INT_34XX_GPIO_BANK5, IH_GPIO_BASE + 128,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> - Â Â Â { OMAP34XX_GPIO6_BASE, NULL, INT_34XX_GPIO_BANK6, IH_GPIO_BASE + 160,
> - Â Â Â Â Â Â Â METHOD_GPIO_24XX },
> -};
> -
> Âstruct omap3_gpio_regs {
> - Â Â Â u32 sysconfig;
> Â Â Â Âu32 irqenable1;
> Â Â Â Âu32 irqenable2;
> Â Â Â Âu32 wake_en;
> @@ -309,25 +178,14 @@ struct omap3_gpio_regs {
> Âstatic struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
> Â#endif
>
> -#ifdef CONFIG_ARCH_OMAP4
> -static struct gpio_bank gpio_bank_44xx[6] = {
> - Â Â Â { OMAP44XX_GPIO1_BASE, NULL, OMAP44XX_IRQ_GPIO1, IH_GPIO_BASE,
> - Â Â Â Â Â Â Â METHOD_GPIO_44XX },
> - Â Â Â { OMAP44XX_GPIO2_BASE, NULL, OMAP44XX_IRQ_GPIO2, IH_GPIO_BASE + 32,
> - Â Â Â Â Â Â Â METHOD_GPIO_44XX },
> - Â Â Â { OMAP44XX_GPIO3_BASE, NULL, OMAP44XX_IRQ_GPIO3, IH_GPIO_BASE + 64,
> - Â Â Â Â Â Â Â METHOD_GPIO_44XX },
> - Â Â Â { OMAP44XX_GPIO4_BASE, NULL, OMAP44XX_IRQ_GPIO4, IH_GPIO_BASE + 96,
> - Â Â Â Â Â Â Â METHOD_GPIO_44XX },
> - Â Â Â { OMAP44XX_GPIO5_BASE, NULL, OMAP44XX_IRQ_GPIO5, IH_GPIO_BASE + 128,
> - Â Â Â Â Â Â Â METHOD_GPIO_44XX },
> - Â Â Â { OMAP44XX_GPIO6_BASE, NULL, OMAP44XX_IRQ_GPIO6, IH_GPIO_BASE + 160,
> - Â Â Â Â Â Â Â METHOD_GPIO_44XX },
> -};
> +/*
> + * TODO: Cleanup gpio_bank usage as it is having information
> + * related to all instances of the device
> + */
> +static struct gpio_bank *gpio_bank;
>
> -#endif
> +static int bank_width;
>
> -static struct gpio_bank *gpio_bank;
> Â/* TODO: Analyze removing gpio_bank_count usage from driver code */
> Âint gpio_bank_count;
>
> @@ -634,6 +492,9 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
> Â Â Â Âu32 Â Â Â Â Â Â Â Â Â Â val;
> Â Â Â Âu32 Â Â Â Â Â Â Â Â Â Â l;
>
> + Â Â Â if (!bank->dbck_flag)
> + Â Â Â Â Â Â Â return;
> +
> Â Â Â Âif (debounce < 32)
> Â Â Â Â Â Â Â Âdebounce = 0x01;
> Â Â Â Âelse if (debounce > 7936)
> @@ -643,7 +504,7 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
>
> Â Â Â Âl = 1 << get_gpio_index(gpio);
>
> - Â Â Â if (cpu_is_omap44xx())
> + Â Â Â if (bank->method == METHOD_GPIO_44XX)
> Â Â Â Â Â Â Â Âreg += OMAP4_GPIO_DEBOUNCINGTIME;
> Â Â Â Âelse
> Â Â Â Â Â Â Â Âreg += OMAP24XX_GPIO_DEBOUNCE_VAL;
> @@ -651,7 +512,7 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
> Â Â Â Â__raw_writel(debounce, reg);
>
> Â Â Â Âreg = bank->base;
> - Â Â Â if (cpu_is_omap44xx())
> + Â Â Â if (bank->method == METHOD_GPIO_44XX)
> Â Â Â Â Â Â Â Âreg += OMAP4_GPIO_DEBOUNCENABLE;
> Â Â Â Âelse
> Â Â Â Â Â Â Â Âreg += OMAP24XX_GPIO_DEBOUNCE_EN;
> @@ -660,12 +521,10 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
>
> Â Â Â Âif (debounce) {
> Â Â Â Â Â Â Â Âval |= l;
> - Â Â Â Â Â Â Â if (cpu_is_omap34xx() || cpu_is_omap44xx())
> - Â Â Â Â Â Â Â Â Â Â Â clk_enable(bank->dbck);
> + Â Â Â Â Â Â Â clk_enable(bank->dbck);
> Â Â Â Â} else {
> Â Â Â Â Â Â Â Âval &= ~l;
> - Â Â Â Â Â Â Â if (cpu_is_omap34xx() || cpu_is_omap44xx())
> - Â Â Â Â Â Â Â Â Â Â Â clk_disable(bank->dbck);
> + Â Â Â Â Â Â Â clk_disable(bank->dbck);
> Â Â Â Â}
> Â Â Â Âbank->dbck_enable_mask = val;
>
> @@ -1537,7 +1396,8 @@ static struct platform_device omap_mpuio_device = {
>
> Âstatic inline void mpuio_init(void)
> Â{
> - Â Â Â platform_set_drvdata(&omap_mpuio_device, &gpio_bank_1610[0]);
> + Â Â Â struct gpio_bank *bank = get_gpio_bank(OMAP_MPUIO(0));
> + Â Â Â platform_set_drvdata(&omap_mpuio_device, bank);
>
> Â Â Â Âif (platform_driver_register(&omap_mpuio_driver) == 0)
> Â Â Â Â Â Â Â Â(void) platform_device_register(&omap_mpuio_device);
> @@ -1642,6 +1502,13 @@ static int gpio_debounce(struct gpio_chip *chip, unsigned offset,
> Â Â Â Âunsigned long flags;
>
> Â Â Â Âbank = container_of(chip, struct gpio_bank, chip);
> +
> + Â Â Â if (!bank->dbck) {
> + Â Â Â Â Â Â Â bank->dbck = clk_get(bank->dev, "dbclk");
> + Â Â Â Â Â Â Â if (IS_ERR(bank->dbck))
> + Â Â Â Â Â Â Â Â Â Â Â dev_err(bank->dev, "Could not get gpio dbck\n");
> + Â Â Â }
> +

I'm testing this on omap7xx, which doesn't have a dbclk.  Even with
dbck_flag set to false, this code still runs, causing these messages
to show up:

    omap_gpio omap_gpio.5: Could not get gpio dbck
    omap_gpio omap_gpio.6: Could not get gpio dbck

I think that 'if' should be:

    if (bank->dbck_flag && !bank->dbck) {

Also, see my comments in patch 4 - OMAP7xx: GPIO: Introduce support
for GPIO init, as there's dbck_flag entries there that are needed for
omap7xx.  Otherwise, seems to work well.

- Cory
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux