aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2007-10-03 12:36:18 -0400
committerBryan Wu <bryan.wu@analog.com>2007-10-03 12:36:18 -0400
commitcda6a20b68c1f21f4b4bc9cd3ee08494e7ebf0d5 (patch)
tree138cf053600bdf22dea762e8bc2b6e7bc27b64eb
parentc58c2140f08de4ad0b0dbd48f6e78168dc321042 (diff)
Blackfin arch: fix PORT_J BUG for BF537/6 EMAC driver reported by Kalle Pokki <kalle.pokki@iki.fi>
Cc: Kalle Pokki <kalle.pokki@iki.fi> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c19
-rw-r--r--include/asm-blackfin/mach-bf537/portmux.h35
2 files changed, 45 insertions, 9 deletions
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index 9f3094800248..5d488ef965ce 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -180,11 +180,13 @@ static int cmp_label(unsigned short ident, const char *label)
180#ifdef BF537_FAMILY 180#ifdef BF537_FAMILY
181static void port_setup(unsigned short gpio, unsigned short usage) 181static void port_setup(unsigned short gpio, unsigned short usage)
182{ 182{
183 if (usage == GPIO_USAGE) { 183 if (!check_gpio(gpio)) {
184 *port_fer[gpio_bank(gpio)] &= ~gpio_bit(gpio); 184 if (usage == GPIO_USAGE) {
185 } else 185 *port_fer[gpio_bank(gpio)] &= ~gpio_bit(gpio);
186 *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio); 186 } else
187 SSYNC(); 187 *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio);
188 SSYNC();
189 }
188} 190}
189#else 191#else
190# define port_setup(...) do { } while (0) 192# define port_setup(...) do { } while (0)
@@ -644,11 +646,10 @@ int peripheral_request(unsigned short per, const char *label)
644 if (!(per & P_DEFINED)) 646 if (!(per & P_DEFINED))
645 return -ENODEV; 647 return -ENODEV;
646 648
647 if (check_gpio(ident) < 0)
648 return -EINVAL;
649
650 local_irq_save(flags); 649 local_irq_save(flags);
651 650
651 if (!check_gpio(ident)) {
652
652 if (unlikely(reserved_gpio_map[gpio_bank(ident)] & gpio_bit(ident))) { 653 if (unlikely(reserved_gpio_map[gpio_bank(ident)] & gpio_bit(ident))) {
653 printk(KERN_ERR 654 printk(KERN_ERR
654 "%s: Peripheral %d is already reserved as GPIO by %s !\n", 655 "%s: Peripheral %d is already reserved as GPIO by %s !\n",
@@ -658,6 +659,8 @@ int peripheral_request(unsigned short per, const char *label)
658 return -EBUSY; 659 return -EBUSY;
659 } 660 }
660 661
662 }
663
661 if (unlikely(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident))) { 664 if (unlikely(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident))) {
662 665
663 /* 666 /*
diff --git a/include/asm-blackfin/mach-bf537/portmux.h b/include/asm-blackfin/mach-bf537/portmux.h
index 7daa2479a731..ae6c53b28452 100644
--- a/include/asm-blackfin/mach-bf537/portmux.h
+++ b/include/asm-blackfin/mach-bf537/portmux.h
@@ -106,4 +106,37 @@
106#define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(PORT_PJ11) | P_FUNCT(1)) 106#define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(PORT_PJ11) | P_FUNCT(1))
107#define P_SPI0_SSEL7 (P_DEFINED | P_IDENT(PORT_PJ5) | P_FUNCT(2)) 107#define P_SPI0_SSEL7 (P_DEFINED | P_IDENT(PORT_PJ5) | P_FUNCT(2))
108 108
109#endif /* _MACH_PORTMUX_H_ */ 109#define P_MII0 {\
110 P_MII0_ETxD0, \
111 P_MII0_ETxD1, \
112 P_MII0_ETxD2, \
113 P_MII0_ETxD3, \
114 P_MII0_ETxEN, \
115 P_MII0_TxCLK, \
116 P_MII0_PHYINT, \
117 P_MII0_COL, \
118 P_MII0_ERxD0, \
119 P_MII0_ERxD1, \
120 P_MII0_ERxD2, \
121 P_MII0_ERxD3, \
122 P_MII0_ERxDV, \
123 P_MII0_ERxCLK, \
124 P_MII0_ERxER, \
125 P_MII0_CRS, \
126 P_MDC, \
127 P_MDIO, 0}
128
129
130#define P_RMII0 {\
131 P_MII0_ETxD0, \
132 P_MII0_ETxD1, \
133 P_MII0_ETxEN, \
134 P_MII0_ERxD0, \
135 P_MII0_ERxD1, \
136 P_MII0_ERxER, \
137 P_RMII0_REF_CLK, \
138 P_RMII0_MDINT, \
139 P_RMII0_CRS_DV, \
140 P_MDC, \
141 P_MDIO, 0}
142#endif /* _MACH_PORTMUX_H_ */