diff options
Diffstat (limited to 'firmware/target/arm/imx233/pinctrl-imx233.c')
-rw-r--r-- | firmware/target/arm/imx233/pinctrl-imx233.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/firmware/target/arm/imx233/pinctrl-imx233.c b/firmware/target/arm/imx233/pinctrl-imx233.c index 5dc25031b1..ab59532543 100644 --- a/firmware/target/arm/imx233/pinctrl-imx233.c +++ b/firmware/target/arm/imx233/pinctrl-imx233.c | |||
@@ -63,6 +63,7 @@ const char *imx233_pinctrl_blame(unsigned bank, unsigned pin) | |||
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | static pin_irq_cb_t pin_cb[3][32]; /* 3 banks, 32 pins/bank */ | 65 | static pin_irq_cb_t pin_cb[3][32]; /* 3 banks, 32 pins/bank */ |
66 | static intptr_t pin_cb_user[3][32]; | ||
66 | 67 | ||
67 | static void INT_GPIO(int bank) | 68 | static void INT_GPIO(int bank) |
68 | { | 69 | { |
@@ -71,9 +72,12 @@ static void INT_GPIO(int bank) | |||
71 | if(fire & (1 << pin)) | 72 | if(fire & (1 << pin)) |
72 | { | 73 | { |
73 | pin_irq_cb_t cb = pin_cb[bank][pin]; | 74 | pin_irq_cb_t cb = pin_cb[bank][pin]; |
74 | imx233_pinctrl_setup_irq(bank, pin, false, false, false, NULL); | 75 | intptr_t arg = pin_cb_user[bank][pin]; |
76 | /* WARNING: this call will modify pin_cb and pin_cb_user, that's | ||
77 | * why we copy the data before ! */ | ||
78 | imx233_pinctrl_setup_irq(bank, pin, false, false, false, NULL, 0); | ||
75 | if(cb) | 79 | if(cb) |
76 | cb(bank, pin); | 80 | cb(bank, pin, arg); |
77 | } | 81 | } |
78 | } | 82 | } |
79 | 83 | ||
@@ -92,13 +96,14 @@ void INT_GPIO2(void) | |||
92 | INT_GPIO(2); | 96 | INT_GPIO(2); |
93 | } | 97 | } |
94 | 98 | ||
95 | void imx233_pinctrl_setup_irq(int bank, int pin, bool enable_int, | 99 | void imx233_pinctrl_setup_irq(unsigned bank, unsigned pin, bool enable_int, |
96 | bool level, bool polarity, pin_irq_cb_t cb) | 100 | bool level, bool polarity, pin_irq_cb_t cb, intptr_t user) |
97 | { | 101 | { |
98 | HW_PINCTRL_PIN2IRQn_CLR(bank) = 1 << pin; | 102 | HW_PINCTRL_PIN2IRQn_CLR(bank) = 1 << pin; |
99 | HW_PINCTRL_IRQENn_CLR(bank) = 1 << pin; | 103 | HW_PINCTRL_IRQENn_CLR(bank) = 1 << pin; |
100 | HW_PINCTRL_IRQSTATn_CLR(bank) = 1 << pin; | 104 | HW_PINCTRL_IRQSTATn_CLR(bank) = 1 << pin; |
101 | pin_cb[bank][pin] = cb; | 105 | pin_cb[bank][pin] = cb; |
106 | pin_cb_user[bank][pin] = user; | ||
102 | if(enable_int) | 107 | if(enable_int) |
103 | { | 108 | { |
104 | if(level) | 109 | if(level) |