Commit c58c2140 authored by Michael Hennerich's avatar Michael Hennerich Committed by Bryan Wu

Blackfin arch: gpio pinmux and resource allocation API required by BF537 on...

Blackfin arch: gpio pinmux and resource allocation API required by BF537 on chip ethernet mac driver
Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarBryan Wu <bryan.wu@analog.com>
parent 0b95f22b
This diff is collapsed.
#include <linux/serial.h> #include <linux/serial.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/portmux.h>
#define NR_PORTS 1 #define NR_PORTS 1
...@@ -92,18 +93,24 @@ struct bfin_serial_res bfin_serial_resource[] = { ...@@ -92,18 +93,24 @@ struct bfin_serial_res bfin_serial_resource[] = {
} }
}; };
#define DRIVER_NAME "bfin-uart"
int nr_ports = NR_PORTS; int nr_ports = NR_PORTS;
static void bfin_serial_hw_init(struct bfin_serial_port *uart) 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 #ifdef CONFIG_SERIAL_BFIN_CTSRTS
if (uart->cts_pin >= 0) { if (uart->cts_pin >= 0) {
gpio_request(uart->cts_pin, NULL); gpio_request(uart->cts_pin, DRIVER_NAME);
gpio_direction_input(uart->cts_pin); gpio_direction_input(uart->cts_pin);
} }
if (uart->rts_pin >= 0) { if (uart->rts_pin >= 0) {
gpio_request(uart->rts_pin, NULL); gpio_request(uart->rts_pin, DRIVER_NAME);
gpio_direction_input(uart->rts_pin); gpio_direction_input(uart->rts_pin);
} }
#endif #endif
......
#include <linux/serial.h> #include <linux/serial.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/portmux.h>
#define NR_PORTS 2 #define NR_PORTS 2
...@@ -122,25 +123,29 @@ struct bfin_serial_res bfin_serial_resource[] = { ...@@ -122,25 +123,29 @@ struct bfin_serial_res bfin_serial_resource[] = {
int nr_ports = ARRAY_SIZE(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) 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); #ifdef CONFIG_SERIAL_BFIN_UART0
val |= 0xF; peripheral_request(P_UART0_TX, DRIVER_NAME);
bfin_write16(PORTF_FER, val); 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 #ifdef CONFIG_SERIAL_BFIN_CTSRTS
if (uart->cts_pin >= 0) { if (uart->cts_pin >= 0) {
gpio_request(uart->cts_pin, NULL); gpio_request(uart->cts_pin, DRIVER_NAME);
gpio_direction_input(uart->cts_pin); gpio_direction_input(uart->cts_pin);
} }
if (uart->rts_pin >= 0) { if (uart->rts_pin >= 0) {
gpio_request(uart->rts_pin, NULL); gpio_request(uart->rts_pin, DRIVER_NAME);
gpio_direction_output(uart->rts_pin); gpio_direction_output(uart->rts_pin);
} }
#endif #endif
......
...@@ -106,4 +106,4 @@ ...@@ -106,4 +106,4 @@
#define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(PORT_PJ11) | P_FUNCT(1)) #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)) #define P_SPI0_SSEL7 (P_DEFINED | P_IDENT(PORT_PJ5) | P_FUNCT(2))
#endif /* _MACH_PORTMUX_H_ */ #endif /* _MACH_PORTMUX_H_ */
#include <linux/serial.h> #include <linux/serial.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/portmux.h>
#define NR_PORTS 1 #define NR_PORTS 1
...@@ -92,18 +93,24 @@ struct bfin_serial_res bfin_serial_resource[] = { ...@@ -92,18 +93,24 @@ struct bfin_serial_res bfin_serial_resource[] = {
} }
}; };
#define DRIVER_NAME "bfin-uart"
int nr_ports = NR_PORTS; int nr_ports = NR_PORTS;
static void bfin_serial_hw_init(struct bfin_serial_port *uart) 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 #ifdef CONFIG_SERIAL_BFIN_CTSRTS
if (uart->cts_pin >= 0) { if (uart->cts_pin >= 0) {
gpio_request(uart->cts_pin, NULL); gpio_request(uart->cts_pin, DRIVER_NAME);
gpio_direction_input(uart->cts_pin); gpio_direction_input(uart->cts_pin);
} }
if (uart->rts_pin >= 0) { if (uart->rts_pin >= 0) {
gpio_request(uart->rts_pin, NULL); gpio_request(uart->rts_pin, DRIVER_NAME);
gpio_direction_input(uart->rts_pin); gpio_direction_input(uart->rts_pin);
} }
#endif #endif
......
...@@ -14,6 +14,12 @@ ...@@ -14,6 +14,12 @@
#define P_MAYSHARE 0x2000 #define P_MAYSHARE 0x2000
#define P_DONTCARE 0x1000 #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/gpio.h>
#include <asm/mach/portmux.h> #include <asm/mach/portmux.h>
...@@ -145,6 +151,22 @@ ...@@ -145,6 +151,22 @@
#define P_SPI2_SSEL3 P_UNDEF #define P_SPI2_SSEL3 P_UNDEF
#endif #endif
#ifndef P_SPI2_SSEL4
#define P_SPI2_SSEL4 P_UNDEF
#endif
#ifndef P_SPI2_SSEL5
#define P_SPI2_SSEL5 P_UNDEF
#endif
#ifndef P_SPI2_SSEL6
#define P_SPI2_SSEL6 P_UNDEF
#endif
#ifndef P_SPI2_SSEL7
#define P_SPI2_SSEL7 P_UNDEF
#endif
#ifndef P_SPI2_SCK #ifndef P_SPI2_SCK
#define P_SPI2_SCK P_UNDEF #define P_SPI2_SCK P_UNDEF
#endif #endif
...@@ -513,6 +535,22 @@ ...@@ -513,6 +535,22 @@
#define P_SPI0_SSEL3 P_UNDEF #define P_SPI0_SSEL3 P_UNDEF
#endif #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 #ifndef P_UART0_TX
#define P_UART0_TX P_UNDEF #define P_UART0_TX P_UNDEF
#endif #endif
...@@ -741,6 +779,23 @@ ...@@ -741,6 +779,23 @@
#define P_SPI1_SSEL3 P_UNDEF #define P_SPI1_SSEL3 P_UNDEF
#endif #endif
#ifndef P_SPI1_SSEL4
#define P_SPI1_SSEL4 P_UNDEF
#endif
#ifndef P_SPI1_SSEL5
#define P_SPI1_SSEL5 P_UNDEF
#endif
#ifndef P_SPI1_SSEL6
#define P_SPI1_SSEL6 P_UNDEF
#endif
#ifndef P_SPI1_SSEL7
#define P_SPI1_SSEL7 P_UNDEF
#endif
#ifndef P_SPI1_SCK #ifndef P_SPI1_SCK
#define P_SPI1_SCK P_UNDEF #define P_SPI1_SCK P_UNDEF
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment