aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2012-10-11 04:11:15 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-10-15 03:10:12 -0400
commit1b6056d6db2426cd612f03dabacf655ecb6a27ae (patch)
treecc7146778c548af33a845e2523ad273ec7410774 /drivers/pinctrl
parent6defe9a0ddc59aa2302473aa3c8b3fdb543fdc1b (diff)
pinctrl: samsung: Include bank-specific eint offset in bank struct
Some SoCs, like Exynos4x12, have non-sequential layout of EINT control registers and so current way of calculating register addresses does not work correctly for them. This patch adds eint_offset field to samsung_pin_bank struct and modifies the driver to use it instead of calculating the offsets from bank index. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Thomas Abraham <thomas.abraham@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl-exynos.c55
-rw-r--r--drivers/pinctrl/pinctrl-exynos.h3
-rw-r--r--drivers/pinctrl/pinctrl-samsung.h1
3 files changed, 30 insertions, 29 deletions
diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c
index 0ea2164bf6d9..bd9f1307a793 100644
--- a/drivers/pinctrl/pinctrl-exynos.c
+++ b/drivers/pinctrl/pinctrl-exynos.c
@@ -146,7 +146,7 @@ static struct exynos_geint_data *exynos_get_eint_data(irq_hw_number_t hw,
146 struct samsung_pin_bank *bank = d->ctrl->pin_banks; 146 struct samsung_pin_bank *bank = d->ctrl->pin_banks;
147 struct exynos_geint_data *eint_data; 147 struct exynos_geint_data *eint_data;
148 unsigned int nr_banks = d->ctrl->nr_banks, idx; 148 unsigned int nr_banks = d->ctrl->nr_banks, idx;
149 unsigned int irq_base = 0, eint_offset = 0; 149 unsigned int irq_base = 0;
150 150
151 if (hw >= d->ctrl->nr_gint) { 151 if (hw >= d->ctrl->nr_gint) {
152 dev_err(d->dev, "unsupported ext-gpio interrupt\n"); 152 dev_err(d->dev, "unsupported ext-gpio interrupt\n");
@@ -159,7 +159,6 @@ static struct exynos_geint_data *exynos_get_eint_data(irq_hw_number_t hw,
159 if ((hw >= irq_base) && (hw < (irq_base + bank->nr_pins))) 159 if ((hw >= irq_base) && (hw < (irq_base + bank->nr_pins)))
160 break; 160 break;
161 irq_base += bank->nr_pins; 161 irq_base += bank->nr_pins;
162 eint_offset += 4;
163 } 162 }
164 163
165 if (idx == nr_banks) { 164 if (idx == nr_banks) {
@@ -175,7 +174,7 @@ static struct exynos_geint_data *exynos_get_eint_data(irq_hw_number_t hw,
175 174
176 eint_data->bank = bank; 175 eint_data->bank = bank;
177 eint_data->pin = hw - irq_base; 176 eint_data->pin = hw - irq_base;
178 eint_data->eint_offset = eint_offset; 177 eint_data->eint_offset = bank->eint_offset;
179 return eint_data; 178 return eint_data;
180} 179}
181 180
@@ -484,35 +483,35 @@ static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
484 483
485/* pin banks of exynos4210 pin-controller 0 */ 484/* pin banks of exynos4210 pin-controller 0 */
486static struct samsung_pin_bank exynos4210_pin_banks0[] = { 485static struct samsung_pin_bank exynos4210_pin_banks0[] = {
487 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0"), 486 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
488 EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1"), 487 EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
489 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb"), 488 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08),
490 EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0"), 489 EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c),
491 EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1"), 490 EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10),
492 EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpd0"), 491 EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpd0", 0x14),
493 EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpd1"), 492 EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpd1", 0x18),
494 EXYNOS_PIN_BANK_EINTG(5, 0x0E0, "gpe0"), 493 EXYNOS_PIN_BANK_EINTG(5, 0x0E0, "gpe0", 0x1c),
495 EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpe1"), 494 EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpe1", 0x20),
496 EXYNOS_PIN_BANK_EINTG(6, 0x120, "gpe2"), 495 EXYNOS_PIN_BANK_EINTG(6, 0x120, "gpe2", 0x24),
497 EXYNOS_PIN_BANK_EINTG(8, 0x140, "gpe3"), 496 EXYNOS_PIN_BANK_EINTG(8, 0x140, "gpe3", 0x28),
498 EXYNOS_PIN_BANK_EINTG(8, 0x160, "gpe4"), 497 EXYNOS_PIN_BANK_EINTG(8, 0x160, "gpe4", 0x2c),
499 EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpf0"), 498 EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpf0", 0x30),
500 EXYNOS_PIN_BANK_EINTG(8, 0x1A0, "gpf1"), 499 EXYNOS_PIN_BANK_EINTG(8, 0x1A0, "gpf1", 0x34),
501 EXYNOS_PIN_BANK_EINTG(8, 0x1C0, "gpf2"), 500 EXYNOS_PIN_BANK_EINTG(8, 0x1C0, "gpf2", 0x38),
502 EXYNOS_PIN_BANK_EINTG(6, 0x1E0, "gpf3"), 501 EXYNOS_PIN_BANK_EINTG(6, 0x1E0, "gpf3", 0x3c),
503}; 502};
504 503
505/* pin banks of exynos4210 pin-controller 1 */ 504/* pin banks of exynos4210 pin-controller 1 */
506static struct samsung_pin_bank exynos4210_pin_banks1[] = { 505static struct samsung_pin_bank exynos4210_pin_banks1[] = {
507 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpj0"), 506 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpj0", 0x00),
508 EXYNOS_PIN_BANK_EINTG(5, 0x020, "gpj1"), 507 EXYNOS_PIN_BANK_EINTG(5, 0x020, "gpj1", 0x04),
509 EXYNOS_PIN_BANK_EINTG(7, 0x040, "gpk0"), 508 EXYNOS_PIN_BANK_EINTG(7, 0x040, "gpk0", 0x08),
510 EXYNOS_PIN_BANK_EINTG(7, 0x060, "gpk1"), 509 EXYNOS_PIN_BANK_EINTG(7, 0x060, "gpk1", 0x0c),
511 EXYNOS_PIN_BANK_EINTG(7, 0x080, "gpk2"), 510 EXYNOS_PIN_BANK_EINTG(7, 0x080, "gpk2", 0x10),
512 EXYNOS_PIN_BANK_EINTG(7, 0x0A0, "gpk3"), 511 EXYNOS_PIN_BANK_EINTG(7, 0x0A0, "gpk3", 0x14),
513 EXYNOS_PIN_BANK_EINTG(8, 0x0C0, "gpl0"), 512 EXYNOS_PIN_BANK_EINTG(8, 0x0C0, "gpl0", 0x18),
514 EXYNOS_PIN_BANK_EINTG(3, 0x0E0, "gpl1"), 513 EXYNOS_PIN_BANK_EINTG(3, 0x0E0, "gpl1", 0x1c),
515 EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpl2"), 514 EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpl2", 0x20),
516 EXYNOS_PIN_BANK_EINTN(6, 0x120, "gpy0"), 515 EXYNOS_PIN_BANK_EINTN(6, 0x120, "gpy0"),
517 EXYNOS_PIN_BANK_EINTN(4, 0x140, "gpy1"), 516 EXYNOS_PIN_BANK_EINTN(4, 0x140, "gpy1"),
518 EXYNOS_PIN_BANK_EINTN(6, 0x160, "gpy2"), 517 EXYNOS_PIN_BANK_EINTN(6, 0x160, "gpy2"),
diff --git a/drivers/pinctrl/pinctrl-exynos.h b/drivers/pinctrl/pinctrl-exynos.h
index 2de4a2936e9c..5d8e380fbadf 100644
--- a/drivers/pinctrl/pinctrl-exynos.h
+++ b/drivers/pinctrl/pinctrl-exynos.h
@@ -59,7 +59,7 @@
59 .name = id \ 59 .name = id \
60 } 60 }
61 61
62#define EXYNOS_PIN_BANK_EINTG(pins, reg, id) \ 62#define EXYNOS_PIN_BANK_EINTG(pins, reg, id, offs) \
63 { \ 63 { \
64 .pctl_offset = reg, \ 64 .pctl_offset = reg, \
65 .nr_pins = pins, \ 65 .nr_pins = pins, \
@@ -69,6 +69,7 @@
69 .conpdn_width = 2, \ 69 .conpdn_width = 2, \
70 .pudpdn_width = 2, \ 70 .pudpdn_width = 2, \
71 .eint_type = EINT_TYPE_GPIO, \ 71 .eint_type = EINT_TYPE_GPIO, \
72 .eint_offset = offs, \
72 .name = id \ 73 .name = id \
73 } 74 }
74 75
diff --git a/drivers/pinctrl/pinctrl-samsung.h b/drivers/pinctrl/pinctrl-samsung.h
index ea5dadd35913..d77d9bcc5d7d 100644
--- a/drivers/pinctrl/pinctrl-samsung.h
+++ b/drivers/pinctrl/pinctrl-samsung.h
@@ -124,6 +124,7 @@ struct samsung_pin_bank {
124 u8 conpdn_width; 124 u8 conpdn_width;
125 u8 pudpdn_width; 125 u8 pudpdn_width;
126 enum eint_type eint_type; 126 enum eint_type eint_type;
127 u32 eint_offset;
127 u32 irq_base; 128 u32 irq_base;
128 char *name; 129 char *name;
129 struct device_node *of_node; 130 struct device_node *of_node;