Blackfin updates for 2.6.23-rc3 (GPIO related)
Hi Linus,
If you got this email twice, please forgive me for sending it again. Because I found LKML didn't receive this email, let me try again.
Please pull from 'for-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/cooloney/blackfin-2.6.git for-linus
to receive the following updates:
arch/blackfin/Kconfig | 2 +- arch/blackfin/kernel/bfin_gpio.c | 323 ++++++++++++++++-- arch/blackfin/mach-bf548/Kconfig | 4 +- arch/blackfin/mach-bf548/boards/ezkit.c | 367 ++++++++++++++++++++- arch/blackfin/mach-bf548/gpio.c | 103 +++++- arch/blackfin/mach-common/ints-priority-dc.c | 4 +- arch/blackfin/mach-common/ints-priority-sc.c | 8 +- include/asm-blackfin/gpio.h | 31 ++ include/asm-blackfin/mach-bf533/bfin_serial_5xx.h | 11 +- include/asm-blackfin/mach-bf533/blackfin.h | 2 +- include/asm-blackfin/mach-bf533/irq.h | 2 + include/asm-blackfin/mach-bf537/bfin_serial_5xx.h | 23 +- include/asm-blackfin/mach-bf537/blackfin.h | 2 +- include/asm-blackfin/mach-bf537/irq.h | 2 + include/asm-blackfin/mach-bf537/portmux.h | 35 ++- include/asm-blackfin/mach-bf548/bfin_serial_5xx.h | 39 +-- include/asm-blackfin/mach-bf548/blackfin.h | 2 +- include/asm-blackfin/mach-bf548/gpio.h | 5 - include/asm-blackfin/mach-bf548/irq.h | 2 + include/asm-blackfin/mach-bf561/bfin_serial_5xx.h | 11 +- include/asm-blackfin/mach-bf561/blackfin.h | 2 +- include/asm-blackfin/mach-bf561/irq.h | 2 + include/asm-blackfin/portmux.h | 22 ++ 23 files changed, 897 insertions(+), 107 deletions(-)
Bryan Wu (2):
Blackfin arch: bug fixing, add missing BF533_FAMILY GPIO_PFx definition Blackfin arch: update platform driver resource information to the ezkitBF548 board file
Michael Hennerich (10):
Blackfin arch: store labels so we later know who allocated GPIO/Peripheral resources Blackfin arch: add peripheral resource allocation support
Blackfin arch: Add label to call new GPIO API
Blackfin arch: fix PORT_J BUG for BF537/6 EMAC driver
Blackfin arch: Finalize the generic gpio support - add gpio_to_irq and irq_to_gpio Blackfin arch: Advertise GENERIC_GPIO and remove duplicated GENERIC_CALIBRATE_DELAY Blackfin arch: Add PORT_J.High (needed for BF548-EZkit Touchscreen interrupts) - remove PORT_C.H Blackfin arch: add missing gpio error handling to make sure we roll back requests in case one fails Blackfin arch: Some cosmetics based on LKML feedback from Joe Perches
Blackfin serial driver: use new GPIO API
Mike Frysinger (1):
Blackfin arch: scrub remaining ASSEMBLY usage since the switch to __ASSEMBLY__
arch/blackfin/Kconfig +1 -1
@@ -57,7 +57,7 @@ config GENERIC_TIME bool default n -config GENERIC_CALIBRATE_DELAY +config GENERIC_GPIO bool default y
arch/blackfin/kernel/bfin_gpio.c +286 -37
454 lines not on this page · raw message
arch/blackfin/mach-bf548/Kconfig +2 -2
@@ -282,7 +282,7 @@ menu "Assignment" config PINTx_REASSIGN bool "Reprogram PINT Assignment" - default n + default y help The interrupt assignment registers controls the pin-to-interrupt assignment in a byte-wide manner. Each option allows you to select
@@ -303,7 +303,7 @@ config PINT1_ASSIGN config PINT2_ASSIGN hex "PINT2_ASSIGN" depends on PINTx_REASSIGN - default 0x00000101 + default 0x07000101 config PINT3_ASSIGN hex "PINT3_ASSIGN" depends on PINTx_REASSIGN
arch/blackfin/mach-bf548/boards/ezkit.c +366 -1
399 lines not on this page · raw message
arch/blackfin/mach-bf548/gpio.c +86 -17
212 lines not on this page · raw message
arch/blackfin/mach-common/ints-priority-dc.c +2 -2
@@ -221,7 +221,7 @@ static unsigned int bf561_gpio_irq_startup(unsigned int irq)if (!(gpio_enabled[gpio_bank (gpionr)] &gpio_bit (gpionr))) { - ret =gpio_request (gpionr,NULL ); + ret =gpio_request (gpionr,"IRQ" );if (ret)return ret;
@@ -261,7 +261,7 @@ static int bf561_gpio_irq_type(unsigned int irq, unsigned int type)if (!(gpio_enabled[gpio_bank (gpionr)] &gpio_bit (gpionr))) { - ret =gpio_request (gpionr,NULL ); + ret =gpio_request (gpionr,"IRQ" );if (ret)return ret;
arch/blackfin/mach-common/ints-priority-sc.c +4 -4
@@ -343,7 +343,7 @@ static unsigned int bfin_gpio_irq_startup(unsigned int irq)u16 gpionr = irq -IRQ_PF0 ;if (!(gpio_enabled[gpio_bank (gpionr)] &gpio_bit (gpionr))) { - ret =gpio_request (gpionr,NULL ); + ret =gpio_request (gpionr,"IRQ" );if (ret)return ret; }
@@ -377,7 +377,7 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)if (type & (IRQ_TYPE_EDGE_RISING |IRQ_TYPE_EDGE_FALLING |IRQ_TYPE_LEVEL_HIGH |IRQ_TYPE_LEVEL_LOW )) {if (!(gpio_enabled[gpio_bank (gpionr)] &gpio_bit (gpionr))) { - ret =gpio_request (gpionr,NULL ); + ret =gpio_request (gpionr,"IRQ" );if (ret)return ret; }
@@ -587,7 +587,7 @@ static unsigned int bfin_gpio_irq_startup(unsigned int irq) }if (!(gpio_enabled[gpio_bank (gpionr)] &gpio_bit (gpionr))) { - ret =gpio_request (gpionr,NULL ); + ret =gpio_request (gpionr,"IRQ" );if (ret)return ret; }
@@ -627,7 +627,7 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)if (type & (IRQ_TYPE_EDGE_RISING |IRQ_TYPE_EDGE_FALLING |IRQ_TYPE_LEVEL_HIGH |IRQ_TYPE_LEVEL_LOW )) {if (!(gpio_enabled[gpio_bank (gpionr)] &gpio_bit (gpionr))) { - ret =gpio_request (gpionr,NULL ); + ret =gpio_request (gpionr,"IRQ" );if (ret)return ret; }
include/asm-blackfin/gpio.h +31 -0
@@ -144,6 +144,24 @@#ifdef BF533_FAMILY #define MAX_BLACKFIN_GPIOS 16 + +#define GPIO_PF0 0 +#define GPIO_PF1 1 +#define GPIO_PF2 2 +#define GPIO_PF3 3 +#define GPIO_PF4 4 +#define GPIO_PF5 5 +#define GPIO_PF6 6 +#define GPIO_PF7 7 +#define GPIO_PF8 8 +#define GPIO_PF9 9 +#define GPIO_PF10 10 +#define GPIO_PF11 11 +#define GPIO_PF12 12 +#define GPIO_PF13 13 +#define GPIO_PF14 14 +#define GPIO_PF15 15 +#endif #ifdef BF537_FAMILY
@@ -421,6 +439,19 @@ unsigned short gpio_get_value(unsigned short gpio);void gpio_direction_input (unsigned short gpio);void gpio_direction_output (unsigned short gpio); +#include <asm-generic/gpio.h> /* cansleep wrappers */ +#include <asm/irq.h> + +static inline int gpio_to_irq (unsigned gpio) +{ +return (gpio +GPIO_IRQ_BASE ); +} + +static inline int irq_to_gpio (unsigned irq) +{ +return (irq -GPIO_IRQ_BASE ); +} +#endif /* __ASSEMBLY__ */ #endif /* __ARCH_BLACKFIN_GPIO_H__ */
include/asm-blackfin/mach-bf533/bfin_serial_5xx.h +9 -2
@@ -1,5 +1,6 @@#include <linux/serial.h> #include <asm/dma.h> +#include <asm/portmux.h> #define NR_PORTS 1
@@ -92,18 +93,24 @@ struct bfin_serial_res bfin_serial_resource[] = { } }; +#define DRIVER_NAME "bfin-uart"int nr_ports =NR_PORTS ;static void bfin_serial_hw_init (struct bfin_serial_port *uart) { +#ifdef CONFIG_SERIAL_BFIN_UART0 +peripheral_request (P_UART0_TX ,DRIVER_NAME ); +peripheral_request (P_UART0_RX ,DRIVER_NAME ); +#endif +#ifdef CONFIG_SERIAL_BFIN_CTSRTS if (uart->cts_pin >=0 ) { -gpio_request (uart->cts_pin,NULL ); +gpio_request (uart->cts_pin,DRIVER_NAME );gpio_direction_input (uart->cts_pin); }if (uart->rts_pin >=0 ) { -gpio_request (uart->rts_pin,NULL ); +gpio_request (uart->rts_pin,DRIVER_NAME );gpio_direction_input (uart->rts_pin); }#endif
include/asm-blackfin/mach-bf533/blackfin.h +1 -1
@@ -38,7 +38,7 @@#include "defBF532.h" #include "anomaly.h" -#if !(defined(__ASSEMBLY__) || defined(ASSEMBLY )) +#if !defined(__ASSEMBLY__)#include "cdefBF532.h" #endif
include/asm-blackfin/mach-bf533/irq.h +2 -0
@@ -128,6 +128,8 @@ Core Emulation **#define IRQ_PF14 47#define IRQ_PF15 48 +#define GPIO_IRQ_BASE IRQ_PF0 +#ifdef CONFIG_IRQCHIP_DEMUX_GPIO #define NR_IRQS (IRQ_PF15+1)#else
include/asm-blackfin/mach-bf537/bfin_serial_5xx.h +14 -9
@@ -1,5 +1,6 @@#include <linux/serial.h> #include <asm/dma.h> +#include <asm/portmux.h> #define NR_PORTS 2
@@ -122,25 +123,29 @@ struct bfin_serial_res bfin_serial_resource[] = {int nr_ports =ARRAY_SIZE (bfin_serial_resource); +#define DRIVER_NAME "bfin-uart" +static void bfin_serial_hw_init (struct bfin_serial_port *uart) { -unsigned short val; - val =bfin_read16 (BFIN_PORT_MUX ); - val &= ~(PFDE |PFTE ); -bfin_write16 (BFIN_PORT_MUX , val); - val =bfin_read16 (PORTF_FER ); - val |=0xF ; -bfin_write16 (PORTF_FER , val); +#ifdef CONFIG_SERIAL_BFIN_UART0 +peripheral_request (P_UART0_TX ,DRIVER_NAME ); +peripheral_request (P_UART0_RX ,DRIVER_NAME ); +#endif + +#ifdef CONFIG_SERIAL_BFIN_UART1 +peripheral_request (P_UART1_TX ,DRIVER_NAME ); +peripheral_request (P_UART1_RX ,DRIVER_NAME ); +#endif #ifdef CONFIG_SERIAL_BFIN_CTSRTS if (uart->cts_pin >=0 ) { -gpio_request (uart->cts_pin,NULL ); +gpio_request (uart->cts_pin,DRIVER_NAME );gpio_direction_input (uart->cts_pin); }if (uart->rts_pin >=0 ) { -gpio_request (uart->rts_pin,NULL ); +gpio_request (uart->rts_pin,DRIVER_NAME );gpio_direction_output (uart->rts_pin); }#endif
include/asm-blackfin/mach-bf537/blackfin.h +1 -1
@@ -43,7 +43,7 @@#include "defBF537.h" #endif -#if !(defined(__ASSEMBLY__) || defined(ASSEMBLY )) +#if !defined(__ASSEMBLY__)#include "cdefBF534.h" /* UART 0*/
include/asm-blackfin/mach-bf537/irq.h +2 -0
@@ -160,6 +160,8 @@ Core Emulation **#define IRQ_PH14 96#define IRQ_PH15 97 +#define GPIO_IRQ_BASE IRQ_PF0 +#ifdef CONFIG_IRQCHIP_DEMUX_GPIO #define NR_IRQS (IRQ_PH15+1)#else
include/asm-blackfin/mach-bf537/portmux.h +34 -1
@@ -106,4 +106,37 @@#define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(PORT_PJ11) | P_FUNCT(1))#define P_SPI0_SSEL7 (P_DEFINED | P_IDENT(PORT_PJ5) | P_FUNCT(2)) -#endif /* _MACH_PORTMUX_H_ */ +#define P_MII0 {\ + P_MII0_ETxD0, \ + P_MII0_ETxD1, \ + P_MII0_ETxD2, \ + P_MII0_ETxD3, \ + P_MII0_ETxEN, \ + P_MII0_TxCLK, \ + P_MII0_PHYINT, \ + P_MII0_COL, \ + P_MII0_ERxD0, \ + P_MII0_ERxD1, \ + P_MII0_ERxD2, \ + P_MII0_ERxD3, \ + P_MII0_ERxDV, \ + P_MII0_ERxCLK, \ + P_MII0_ERxER, \ + P_MII0_CRS, \ + P_MDC, \ + P_MDIO, 0} + + +#define P_RMII0 {\ + P_MII0_ETxD0, \ + P_MII0_ETxD1, \ + P_MII0_ETxEN, \ + P_MII0_ERxD0, \ + P_MII0_ERxD1, \ + P_MII0_ERxER, \ + P_RMII0_REF_CLK, \ + P_RMII0_MDINT, \ + P_RMII0_CRS_DV, \ + P_MDC, \ + P_MDIO, 0} +#endif /* _MACH_PORTMUX_H_ */
include/asm-blackfin/mach-bf548/bfin_serial_5xx.h +19 -20
@@ -1,5 +1,6 @@#include <linux/serial.h> #include <asm/dma.h> +#include <asm/portmux.h> #define NR_PORTS 4
@@ -143,50 +144,48 @@ struct bfin_serial_res bfin_serial_resource[] = {int nr_ports =ARRAY_SIZE (bfin_serial_resource); +#define DRIVER_NAME "bfin-uart" +static void bfin_serial_hw_init (struct bfin_serial_port *uart) {#ifdef CONFIG_SERIAL_BFIN_UART0 -/* Enable UART0 RX and TX on pin 7 & 8 of PORT E */ -bfin_write_PORTE_FER (0x180 |bfin_read_PORTE_FER ()); -bfin_write_PORTE_MUX (0x3C000 |bfin_read_PORTE_MUX ()); +peripheral_request (P_UART0_TX ,DRIVER_NAME ); +peripheral_request (P_UART0_RX ,DRIVER_NAME );#endif #ifdef CONFIG_SERIAL_BFIN_UART1 -/* Enable UART1 RX and TX on pin 0 & 1 of PORT H */ -bfin_write_PORTH_FER (0x3 |bfin_read_PORTH_FER ()); -bfin_write_PORTH_MUX (~0xF &bfin_read_PORTH_MUX ()); +peripheral_request (P_UART1_TX ,DRIVER_NAME ); +peripheral_request (P_UART1_RX ,DRIVER_NAME ); +#ifdef CONFIG_BFIN_UART1_CTSRTS -/* Enable UART1 RTS and CTS on pin 9 & 10 of PORT E */ -bfin_write_PORTE_FER (0x600 |bfin_read_PORTE_FER ()); -bfin_write_PORTE_MUX (~0x3C0000 &bfin_read_PORTE_MUX ()); +peripheral_request (P_UART1_RTS ,DRIVER_NAME ); + peripheral_request(P_UART1_CTS DRIVER_NAME);#endif #endif #ifdef CONFIG_SERIAL_BFIN_UART2 -/* Enable UART2 RX and TX on pin 4 & 5 of PORT B */ -bfin_write_PORTB_FER (0x30 |bfin_read_PORTB_FER ()); -bfin_write_PORTB_MUX (~0xF00 &bfin_read_PORTB_MUX ()); +peripheral_request (P_UART2_TX ,DRIVER_NAME ); +peripheral_request (P_UART2_RX ,DRIVER_NAME );#endif #ifdef CONFIG_SERIAL_BFIN_UART3 -/* Enable UART3 RX and TX on pin 6 & 7 of PORT B */ -bfin_write_PORTB_FER (0xC0 |bfin_read_PORTB_FER ()); -bfin_write_PORTB_MUX (~0xF000 |bfin_read_PORTB_MUX ()); +peripheral_request (P_UART3_TX ,DRIVER_NAME ); +peripheral_request (P_UART3_RX ,DRIVER_NAME ); +#ifdef CONFIG_BFIN_UART3_CTSRTS -/* Enable UART3 RTS and CTS on pin 2 & 3 of PORT B */ -bfin_write_PORTB_FER (0xC |bfin_read_PORTB_FER ()); -bfin_write_PORTB_MUX (~0xF0 |bfin_read_PORTB_MUX ()); +peripheral_request (P_UART3_RTS ,DRIVER_NAME ); + peripheral_request(P_UART3_CTS DRIVER_NAME);#endif #endif SSYNC ();#ifdef CONFIG_SERIAL_BFIN_CTSRTS if (uart->cts_pin >=0 ) { -gpio_request (uart->cts_pin,NULL ); +gpio_request (uart->cts_pin,DRIVER_NAME );gpio_direction_input (uart->cts_pin); }if (uart->rts_pin >=0 ) { -gpio_request (uart->rts_pin,NULL ); +gpio_request (uart->rts_pin,DRIVER_NAME );gpio_direction_output (uart->rts_pin); }#endif
include/asm-blackfin/mach-bf548/blackfin.h +1 -1
@@ -54,7 +54,7 @@#include "defBF549.h" #endif -#if !(defined(__ASSEMBLY__) || defined(ASSEMBLY )) +#if !defined(__ASSEMBLY__)#ifdef CONFIG_BF542 #include "cdefBF542.h" #endif
include/asm-blackfin/mach-bf548/gpio.h +0 -5
@@ -209,8 +209,3 @@ struct gpio_port_t {unsigned short dummy7;unsigned int port_mux; }; - -int gpio_request (unsigned short gpio,const char *label); -void peripheral_free (unsigned short per); -int peripheral_request_list (unsigned short per[],const char *label); -void peripheral_free_list (unsigned short per[]);
include/asm-blackfin/mach-bf548/irq.h +2 -0
@@ -337,6 +337,8 @@ Events (highest priority) EMU 0#define IRQ_PJ14 BFIN_PJ_IRQ(14)/* N/A */ #define IRQ_PJ15 BFIN_PJ_IRQ(15)/* N/A */ +#define GPIO_IRQ_BASE IRQ_PA0 +#ifdef CONFIG_IRQCHIP_DEMUX_GPIO #define NR_IRQS (IRQ_PJ15+1)#else
include/asm-blackfin/mach-bf561/bfin_serial_5xx.h +9 -2
@@ -1,5 +1,6 @@#include <linux/serial.h> #include <asm/dma.h> +#include <asm/portmux.h> #define NR_PORTS 1
@@ -92,18 +93,24 @@ struct bfin_serial_res bfin_serial_resource[] = { } }; +#define DRIVER_NAME "bfin-uart"int nr_ports =NR_PORTS ;static void bfin_serial_hw_init (struct bfin_serial_port *uart) { +#ifdef CONFIG_SERIAL_BFIN_UART0 +peripheral_request (P_UART0_TX ,DRIVER_NAME ); +peripheral_request (P_UART0_RX ,DRIVER_NAME ); +#endif +#ifdef CONFIG_SERIAL_BFIN_CTSRTS if (uart->cts_pin >=0 ) { -gpio_request (uart->cts_pin,NULL ); +gpio_request (uart->cts_pin,DRIVER_NAME );gpio_direction_input (uart->cts_pin); }if (uart->rts_pin >=0 ) { -gpio_request (uart->rts_pin,NULL ); +gpio_request (uart->rts_pin,DRIVER_NAME );gpio_direction_input (uart->rts_pin); }#endif
include/asm-blackfin/mach-bf561/blackfin.h +1 -1
@@ -38,7 +38,7 @@#include "defBF561.h" #include "anomaly.h" -#if !(defined(__ASSEMBLY__) || defined(ASSEMBLY )) +#if !defined(__ASSEMBLY__)#include "cdefBF561.h" #endif
include/asm-blackfin/mach-bf561/irq.h +2 -0
@@ -289,6 +289,8 @@#define IRQ_PF46 119#define IRQ_PF47 120 +#define GPIO_IRQ_BASE IRQ_PF0 +#ifdef CONFIG_IRQCHIP_DEMUX_GPIO #define NR_IRQS (IRQ_PF47 + 1)#else
include/asm-blackfin/portmux.h +22 -0
@@ -14,6 +14,12 @@#define P_MAYSHARE 0x2000#define P_DONTCARE 0x1000 + +int peripheral_request (unsigned short per,const char *label); +void peripheral_free (unsigned short per); +int peripheral_request_list (unsigned short per[],const char *label); +void peripheral_free_list (unsigned short per[]); +#include <asm/gpio.h> #include <asm/mach/portmux.h>
@@ -513,6 +519,22 @@#define P_SPI0_SSEL3 P_UNDEF#endif +#ifndef P_SPI0_SSEL4 +#define P_SPI0_SSEL4 P_UNDEF +#endif + +#ifndef P_SPI0_SSEL5 +#define P_SPI0_SSEL5 P_UNDEF +#endif + +#ifndef P_SPI0_SSEL6 +#define P_SPI0_SSEL6 P_UNDEF +#endif + +#ifndef P_SPI0_SSEL7 +#define P_SPI0_SSEL7 P_UNDEF +#endif +#ifndef P_UART0_TX #define P_UART0_TX P_UNDEF#endif