aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorKevin Hilman <khilman@ti.com>2011-04-20 19:31:23 -0400
committerKevin Hilman <khilman@ti.com>2011-06-16 14:13:42 -0400
commitfa87931acb8203a1f40a3c637863ad238f70cd40 (patch)
treefd79e56fb9819bbb1096c9d3904f0ba04bec832a /arch/arm/mach-omap2
parenta8be8dafd00e3ccf4f85e2f30babf42be5076324 (diff)
gpio/omap: consolidate direction, input, output, remove #ifdefs
Add register offset fields to GPIO platform_data for registers. This patch adds registers that control direction, input and output data. Using these register offsets in the common driver allows removal of #ifdefs and greatly improves readability. Also create dedicated data out functions: one for banks with dedicated set/clear registers, and another for banks with a single mask register. Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/gpio.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 9529842ae054..357e06956b0c 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -61,13 +61,29 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
61 pdata->dbck_flag = dev_attr->dbck_flag; 61 pdata->dbck_flag = dev_attr->dbck_flag;
62 pdata->virtual_irq_start = IH_GPIO_BASE + 32 * (id - 1); 62 pdata->virtual_irq_start = IH_GPIO_BASE + 32 * (id - 1);
63 63
64 pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs), GFP_KERNEL);
65 if (!pdata) {
66 pr_err("gpio%d: Memory allocation failed\n", id);
67 return -ENOMEM;
68 }
69
64 switch (oh->class->rev) { 70 switch (oh->class->rev) {
65 case 0: 71 case 0:
66 case 1: 72 case 1:
67 pdata->bank_type = METHOD_GPIO_24XX; 73 pdata->bank_type = METHOD_GPIO_24XX;
74 pdata->regs->direction = OMAP24XX_GPIO_OE;
75 pdata->regs->datain = OMAP24XX_GPIO_DATAIN;
76 pdata->regs->dataout = OMAP24XX_GPIO_DATAOUT;
77 pdata->regs->set_dataout = OMAP24XX_GPIO_SETDATAOUT;
78 pdata->regs->clr_dataout = OMAP24XX_GPIO_CLEARDATAOUT;
68 break; 79 break;
69 case 2: 80 case 2:
70 pdata->bank_type = METHOD_GPIO_44XX; 81 pdata->bank_type = METHOD_GPIO_44XX;
82 pdata->regs->direction = OMAP4_GPIO_OE;
83 pdata->regs->datain = OMAP4_GPIO_DATAIN;
84 pdata->regs->dataout = OMAP4_GPIO_DATAOUT;
85 pdata->regs->set_dataout = OMAP4_GPIO_SETDATAOUT;
86 pdata->regs->clr_dataout = OMAP4_GPIO_CLEARDATAOUT;
71 break; 87 break;
72 default: 88 default:
73 WARN(1, "Invalid gpio bank_type\n"); 89 WARN(1, "Invalid gpio bank_type\n");