diff options
author | Michael Hennerich <michael.hennerich@analog.com> | 2007-10-21 04:54:27 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@analog.com> | 2007-10-21 04:54:27 -0400 |
commit | 590031450a52c373bf72f5fb156fbcc0c78c6f2c (patch) | |
tree | 0e631bc6e8af9422635535459aaaf10fdddab357 /arch/blackfin/kernel/bfin_gpio.c | |
parent | cfa76f024f7c9e65169425804e5b32e71f66d0ee (diff) |
Blackfin arch: add new processor ADSP-BF52x arch/mach support
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'arch/blackfin/kernel/bfin_gpio.c')
-rw-r--r-- | arch/blackfin/kernel/bfin_gpio.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index 3fe0cd49e8db..ce85d4bf34ca 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c | |||
@@ -124,7 +124,7 @@ static struct gpio_port_t *gpio_bankb[gpio_bank(MAX_BLACKFIN_GPIOS)] = { | |||
124 | }; | 124 | }; |
125 | #endif | 125 | #endif |
126 | 126 | ||
127 | #ifdef BF537_FAMILY | 127 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) |
128 | static struct gpio_port_t *gpio_bankb[gpio_bank(MAX_BLACKFIN_GPIOS)] = { | 128 | static struct gpio_port_t *gpio_bankb[gpio_bank(MAX_BLACKFIN_GPIOS)] = { |
129 | (struct gpio_port_t *) PORTFIO, | 129 | (struct gpio_port_t *) PORTFIO, |
130 | (struct gpio_port_t *) PORTGIO, | 130 | (struct gpio_port_t *) PORTGIO, |
@@ -139,6 +139,21 @@ static unsigned short *port_fer[gpio_bank(MAX_BLACKFIN_GPIOS)] = { | |||
139 | 139 | ||
140 | #endif | 140 | #endif |
141 | 141 | ||
142 | #ifdef BF527_FAMILY | ||
143 | static unsigned short *port_mux[gpio_bank(MAX_BLACKFIN_GPIOS)] = { | ||
144 | (unsigned short *) PORTF_MUX, | ||
145 | (unsigned short *) PORTG_MUX, | ||
146 | (unsigned short *) PORTH_MUX, | ||
147 | }; | ||
148 | |||
149 | static const | ||
150 | u8 pmux_offset[][16] = | ||
151 | {{ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 4, 6, 8, 8, 10, 10 }, /* PORTF */ | ||
152 | { 0, 0, 0, 0, 0, 2, 2, 4, 4, 6, 8, 10, 10, 10, 12, 12 }, /* PORTG */ | ||
153 | { 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 4, 4, 4, 4 }, /* PORTH */ | ||
154 | }; | ||
155 | #endif | ||
156 | |||
142 | #ifdef BF561_FAMILY | 157 | #ifdef BF561_FAMILY |
143 | static struct gpio_port_t *gpio_bankb[gpio_bank(MAX_BLACKFIN_GPIOS)] = { | 158 | static struct gpio_port_t *gpio_bankb[gpio_bank(MAX_BLACKFIN_GPIOS)] = { |
144 | (struct gpio_port_t *) FIO0_FLAG_D, | 159 | (struct gpio_port_t *) FIO0_FLAG_D, |
@@ -186,6 +201,10 @@ static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG_INTB | |||
186 | static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX}; | 201 | static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX}; |
187 | #endif | 202 | #endif |
188 | 203 | ||
204 | #ifdef BF527_FAMILY | ||
205 | static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PORTF_INTB, IRQ_PORTG_INTB, IRQ_PORTH_INTB}; | ||
206 | #endif | ||
207 | |||
189 | #ifdef BF561_FAMILY | 208 | #ifdef BF561_FAMILY |
190 | static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB}; | 209 | static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB}; |
191 | #endif | 210 | #endif |
@@ -238,7 +257,7 @@ static int cmp_label(unsigned short ident, const char *label) | |||
238 | return -EINVAL; | 257 | return -EINVAL; |
239 | } | 258 | } |
240 | 259 | ||
241 | #ifdef BF537_FAMILY | 260 | #if defined(BF527_FAMILY) || defined(BF537_FAMILY) |
242 | static void port_setup(unsigned short gpio, unsigned short usage) | 261 | static void port_setup(unsigned short gpio, unsigned short usage) |
243 | { | 262 | { |
244 | if (!check_gpio(gpio)) { | 263 | if (!check_gpio(gpio)) { |
@@ -354,6 +373,18 @@ inline u16 get_portmux(unsigned short portno) | |||
354 | 373 | ||
355 | return (pmux >> (2 * gpio_sub_n(portno)) & 0x3); | 374 | return (pmux >> (2 * gpio_sub_n(portno)) & 0x3); |
356 | } | 375 | } |
376 | #elif defined(BF527_FAMILY) | ||
377 | inline void portmux_setup(unsigned short portno, unsigned short function) | ||
378 | { | ||
379 | u16 pmux, ident = P_IDENT(portno); | ||
380 | u8 offset = pmux_offset[gpio_bank(ident)][gpio_sub_n(ident)]; | ||
381 | |||
382 | pmux = *port_mux[gpio_bank(ident)]; | ||
383 | pmux &= ~(3 << offset); | ||
384 | pmux |= (function & 3) << offset; | ||
385 | *port_mux[gpio_bank(ident)] = pmux; | ||
386 | SSYNC(); | ||
387 | } | ||
357 | #else | 388 | #else |
358 | # define portmux_setup(...) do { } while (0) | 389 | # define portmux_setup(...) do { } while (0) |
359 | #endif | 390 | #endif |