aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2007-10-03 12:35:05 -0400
committerBryan Wu <bryan.wu@analog.com>2007-10-03 12:35:05 -0400
commitc58c2140f08de4ad0b0dbd48f6e78168dc321042 (patch)
treeee7381b9db76340295229c56350adcca44d218b1 /include
parent0b95f22bd3b91c7114c6892bbfbb5a8576b27fbe (diff)
Blackfin arch: gpio pinmux and resource allocation API required by BF537 on chip ethernet mac driver
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-blackfin/mach-bf533/bfin_serial_5xx.h11
-rw-r--r--include/asm-blackfin/mach-bf537/bfin_serial_5xx.h23
-rw-r--r--include/asm-blackfin/mach-bf537/portmux.h2
-rw-r--r--include/asm-blackfin/mach-bf561/bfin_serial_5xx.h11
-rw-r--r--include/asm-blackfin/portmux.h55
5 files changed, 88 insertions, 14 deletions
diff --git a/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h
index e043cafa3c42..69b9f8e120e9 100644
--- a/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h
+++ b/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h
@@ -1,5 +1,6 @@
1#include <linux/serial.h> 1#include <linux/serial.h>
2#include <asm/dma.h> 2#include <asm/dma.h>
3#include <asm/portmux.h>
3 4
4#define NR_PORTS 1 5#define NR_PORTS 1
5 6
@@ -92,18 +93,24 @@ struct bfin_serial_res bfin_serial_resource[] = {
92 } 93 }
93}; 94};
94 95
96#define DRIVER_NAME "bfin-uart"
95 97
96int nr_ports = NR_PORTS; 98int nr_ports = NR_PORTS;
97static void bfin_serial_hw_init(struct bfin_serial_port *uart) 99static void bfin_serial_hw_init(struct bfin_serial_port *uart)
98{ 100{
99 101
102#ifdef CONFIG_SERIAL_BFIN_UART0
103 peripheral_request(P_UART0_TX, DRIVER_NAME);
104 peripheral_request(P_UART0_RX, DRIVER_NAME);
105#endif
106
100#ifdef CONFIG_SERIAL_BFIN_CTSRTS 107#ifdef CONFIG_SERIAL_BFIN_CTSRTS
101 if (uart->cts_pin >= 0) { 108 if (uart->cts_pin >= 0) {
102 gpio_request(uart->cts_pin, NULL); 109 gpio_request(uart->cts_pin, DRIVER_NAME);
103 gpio_direction_input(uart->cts_pin); 110 gpio_direction_input(uart->cts_pin);
104 } 111 }
105 if (uart->rts_pin >= 0) { 112 if (uart->rts_pin >= 0) {
106 gpio_request(uart->rts_pin, NULL); 113 gpio_request(uart->rts_pin, DRIVER_NAME);
107 gpio_direction_input(uart->rts_pin); 114 gpio_direction_input(uart->rts_pin);
108 } 115 }
109#endif 116#endif
diff --git a/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h
index 8f5d9c4d8d5b..6fb328f5186a 100644
--- a/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h
+++ b/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h
@@ -1,5 +1,6 @@
1#include <linux/serial.h> 1#include <linux/serial.h>
2#include <asm/dma.h> 2#include <asm/dma.h>
3#include <asm/portmux.h>
3 4
4#define NR_PORTS 2 5#define NR_PORTS 2
5 6
@@ -122,25 +123,29 @@ struct bfin_serial_res bfin_serial_resource[] = {
122 123
123int nr_ports = ARRAY_SIZE(bfin_serial_resource); 124int nr_ports = ARRAY_SIZE(bfin_serial_resource);
124 125
126#define DRIVER_NAME "bfin-uart"
127
125static void bfin_serial_hw_init(struct bfin_serial_port *uart) 128static void bfin_serial_hw_init(struct bfin_serial_port *uart)
126{ 129{
127 unsigned short val;
128 val = bfin_read16(BFIN_PORT_MUX);
129 val &= ~(PFDE | PFTE);
130 bfin_write16(BFIN_PORT_MUX, val);
131 130
132 val = bfin_read16(PORTF_FER); 131#ifdef CONFIG_SERIAL_BFIN_UART0
133 val |= 0xF; 132 peripheral_request(P_UART0_TX, DRIVER_NAME);
134 bfin_write16(PORTF_FER, val); 133 peripheral_request(P_UART0_RX, DRIVER_NAME);
134#endif
135
136#ifdef CONFIG_SERIAL_BFIN_UART1
137 peripheral_request(P_UART1_TX, DRIVER_NAME);
138 peripheral_request(P_UART1_RX, DRIVER_NAME);
139#endif
135 140
136#ifdef CONFIG_SERIAL_BFIN_CTSRTS 141#ifdef CONFIG_SERIAL_BFIN_CTSRTS
137 if (uart->cts_pin >= 0) { 142 if (uart->cts_pin >= 0) {
138 gpio_request(uart->cts_pin, NULL); 143 gpio_request(uart->cts_pin, DRIVER_NAME);
139 gpio_direction_input(uart->cts_pin); 144 gpio_direction_input(uart->cts_pin);
140 } 145 }
141 146
142 if (uart->rts_pin >= 0) { 147 if (uart->rts_pin >= 0) {
143 gpio_request(uart->rts_pin, NULL); 148 gpio_request(uart->rts_pin, DRIVER_NAME);
144 gpio_direction_output(uart->rts_pin); 149 gpio_direction_output(uart->rts_pin);
145 } 150 }
146#endif 151#endif
diff --git a/include/asm-blackfin/mach-bf537/portmux.h b/include/asm-blackfin/mach-bf537/portmux.h
index 23e13c5abc4d..7daa2479a731 100644
--- a/include/asm-blackfin/mach-bf537/portmux.h
+++ b/include/asm-blackfin/mach-bf537/portmux.h
@@ -106,4 +106,4 @@
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#endif /* _MACH_PORTMUX_H_ */
diff --git a/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h
index e043cafa3c42..69b9f8e120e9 100644
--- a/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h
+++ b/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h
@@ -1,5 +1,6 @@
1#include <linux/serial.h> 1#include <linux/serial.h>
2#include <asm/dma.h> 2#include <asm/dma.h>
3#include <asm/portmux.h>
3 4
4#define NR_PORTS 1 5#define NR_PORTS 1
5 6
@@ -92,18 +93,24 @@ struct bfin_serial_res bfin_serial_resource[] = {
92 } 93 }
93}; 94};
94 95
96#define DRIVER_NAME "bfin-uart"
95 97
96int nr_ports = NR_PORTS; 98int nr_ports = NR_PORTS;
97static void bfin_serial_hw_init(struct bfin_serial_port *uart) 99static void bfin_serial_hw_init(struct bfin_serial_port *uart)
98{ 100{
99 101
102#ifdef CONFIG_SERIAL_BFIN_UART0
103 peripheral_request(P_UART0_TX, DRIVER_NAME);
104 peripheral_request(P_UART0_RX, DRIVER_NAME);
105#endif
106
100#ifdef CONFIG_SERIAL_BFIN_CTSRTS 107#ifdef CONFIG_SERIAL_BFIN_CTSRTS
101 if (uart->cts_pin >= 0) { 108 if (uart->cts_pin >= 0) {
102 gpio_request(uart->cts_pin, NULL); 109 gpio_request(uart->cts_pin, DRIVER_NAME);
103 gpio_direction_input(uart->cts_pin); 110 gpio_direction_input(uart->cts_pin);
104 } 111 }
105 if (uart->rts_pin >= 0) { 112 if (uart->rts_pin >= 0) {
106 gpio_request(uart->rts_pin, NULL); 113 gpio_request(uart->rts_pin, DRIVER_NAME);
107 gpio_direction_input(uart->rts_pin); 114 gpio_direction_input(uart->rts_pin);
108 } 115 }
109#endif 116#endif
diff --git a/include/asm-blackfin/portmux.h b/include/asm-blackfin/portmux.h
index 9d3681e42111..0d3f650d2d99 100644
--- a/include/asm-blackfin/portmux.h
+++ b/include/asm-blackfin/portmux.h
@@ -14,6 +14,12 @@
14#define P_MAYSHARE 0x2000 14#define P_MAYSHARE 0x2000
15#define P_DONTCARE 0x1000 15#define P_DONTCARE 0x1000
16 16
17
18int peripheral_request(unsigned short per, const char *label);
19void peripheral_free(unsigned short per);
20int peripheral_request_list(unsigned short per[], const char *label);
21void peripheral_free_list(unsigned short per[]);
22
17#include <asm/gpio.h> 23#include <asm/gpio.h>
18#include <asm/mach/portmux.h> 24#include <asm/mach/portmux.h>
19 25
@@ -145,6 +151,22 @@
145#define P_SPI2_SSEL3 P_UNDEF 151#define P_SPI2_SSEL3 P_UNDEF
146#endif 152#endif
147 153
154#ifndef P_SPI2_SSEL4
155#define P_SPI2_SSEL4 P_UNDEF
156#endif
157
158#ifndef P_SPI2_SSEL5
159#define P_SPI2_SSEL5 P_UNDEF
160#endif
161
162#ifndef P_SPI2_SSEL6
163#define P_SPI2_SSEL6 P_UNDEF
164#endif
165
166#ifndef P_SPI2_SSEL7
167#define P_SPI2_SSEL7 P_UNDEF
168#endif
169
148#ifndef P_SPI2_SCK 170#ifndef P_SPI2_SCK
149#define P_SPI2_SCK P_UNDEF 171#define P_SPI2_SCK P_UNDEF
150#endif 172#endif
@@ -513,6 +535,22 @@
513#define P_SPI0_SSEL3 P_UNDEF 535#define P_SPI0_SSEL3 P_UNDEF
514#endif 536#endif
515 537
538#ifndef P_SPI0_SSEL4
539#define P_SPI0_SSEL4 P_UNDEF
540#endif
541
542#ifndef P_SPI0_SSEL5
543#define P_SPI0_SSEL5 P_UNDEF
544#endif
545
546#ifndef P_SPI0_SSEL6
547#define P_SPI0_SSEL6 P_UNDEF
548#endif
549
550#ifndef P_SPI0_SSEL7
551#define P_SPI0_SSEL7 P_UNDEF
552#endif
553
516#ifndef P_UART0_TX 554#ifndef P_UART0_TX
517#define P_UART0_TX P_UNDEF 555#define P_UART0_TX P_UNDEF
518#endif 556#endif
@@ -741,6 +779,23 @@
741#define P_SPI1_SSEL3 P_UNDEF 779#define P_SPI1_SSEL3 P_UNDEF
742#endif 780#endif
743 781
782
783#ifndef P_SPI1_SSEL4
784#define P_SPI1_SSEL4 P_UNDEF
785#endif
786
787#ifndef P_SPI1_SSEL5
788#define P_SPI1_SSEL5 P_UNDEF
789#endif
790
791#ifndef P_SPI1_SSEL6
792#define P_SPI1_SSEL6 P_UNDEF
793#endif
794
795#ifndef P_SPI1_SSEL7
796#define P_SPI1_SSEL7 P_UNDEF
797#endif
798
744#ifndef P_SPI1_SCK 799#ifndef P_SPI1_SCK
745#define P_SPI1_SCK P_UNDEF 800#define P_SPI1_SCK P_UNDEF
746#endif 801#endif