@@ -87,57 +87,6 @@ static struct resource h3xxx_flash_resource =
87
87
/*
88
88
* H3xxx uart support
89
89
*/
90
- static struct gpio h3xxx_uart_gpio [] = {
91
- { H3XXX_GPIO_COM_DCD , GPIOF_IN , "COM DCD" },
92
- { H3XXX_GPIO_COM_CTS , GPIOF_IN , "COM CTS" },
93
- { H3XXX_GPIO_COM_RTS , GPIOF_OUT_INIT_LOW , "COM RTS" },
94
- };
95
-
96
- static bool h3xxx_uart_request_gpios (void )
97
- {
98
- static bool h3xxx_uart_gpio_ok ;
99
- int rc ;
100
-
101
- if (h3xxx_uart_gpio_ok )
102
- return true;
103
-
104
- rc = gpio_request_array (h3xxx_uart_gpio , ARRAY_SIZE (h3xxx_uart_gpio ));
105
- if (rc )
106
- pr_err ("h3xxx_uart_request_gpios: error %d\n" , rc );
107
- else
108
- h3xxx_uart_gpio_ok = true;
109
-
110
- return h3xxx_uart_gpio_ok ;
111
- }
112
-
113
- static void h3xxx_uart_set_mctrl (struct uart_port * port , u_int mctrl )
114
- {
115
- if (port -> mapbase == _Ser3UTCR0 ) {
116
- if (!h3xxx_uart_request_gpios ())
117
- return ;
118
- gpio_set_value (H3XXX_GPIO_COM_RTS , !(mctrl & TIOCM_RTS ));
119
- }
120
- }
121
-
122
- static u_int h3xxx_uart_get_mctrl (struct uart_port * port )
123
- {
124
- u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR ;
125
-
126
- if (port -> mapbase == _Ser3UTCR0 ) {
127
- if (!h3xxx_uart_request_gpios ())
128
- return ret ;
129
- /*
130
- * DCD and CTS bits are inverted in GPLR by RS232 transceiver
131
- */
132
- if (gpio_get_value (H3XXX_GPIO_COM_DCD ))
133
- ret &= ~TIOCM_CD ;
134
- if (gpio_get_value (H3XXX_GPIO_COM_CTS ))
135
- ret &= ~TIOCM_CTS ;
136
- }
137
-
138
- return ret ;
139
- }
140
-
141
90
static void h3xxx_uart_pm (struct uart_port * port , u_int state , u_int oldstate )
142
91
{
143
92
if (port -> mapbase == _Ser3UTCR0 ) {
@@ -170,12 +119,20 @@ static int h3xxx_uart_set_wake(struct uart_port *port, u_int enable)
170
119
}
171
120
172
121
static struct sa1100_port_fns h3xxx_port_fns __initdata = {
173
- .set_mctrl = h3xxx_uart_set_mctrl ,
174
- .get_mctrl = h3xxx_uart_get_mctrl ,
175
122
.pm = h3xxx_uart_pm ,
176
123
.set_wake = h3xxx_uart_set_wake ,
177
124
};
178
125
126
+ static struct gpiod_lookup_table h3xxx_uart3_gpio_table = {
127
+ .dev_id = "sa11x0-uart.3" ,
128
+ .table = {
129
+ GPIO_LOOKUP ("gpio" , H3XXX_GPIO_COM_DCD , "dcd" , GPIO_ACTIVE_LOW ),
130
+ GPIO_LOOKUP ("gpio" , H3XXX_GPIO_COM_CTS , "cts" , GPIO_ACTIVE_LOW ),
131
+ GPIO_LOOKUP ("gpio" , H3XXX_GPIO_COM_RTS , "rts" , GPIO_ACTIVE_LOW ),
132
+ { },
133
+ },
134
+ };
135
+
179
136
/*
180
137
* EGPIO
181
138
*/
@@ -283,6 +240,7 @@ static struct gpiod_lookup_table h3xxx_pcmcia_gpio_table = {
283
240
void __init h3xxx_mach_init (void )
284
241
{
285
242
gpiod_add_lookup_table (& h3xxx_pcmcia_gpio_table );
243
+ gpiod_add_lookup_table (& h3xxx_uart3_gpio_table );
286
244
sa1100_register_uart_fns (& h3xxx_port_fns );
287
245
sa11x0_register_mtd (& h3xxx_flash_data , & h3xxx_flash_resource , 1 );
288
246
platform_add_devices (h3xxx_devices , ARRAY_SIZE (h3xxx_devices ));
0 commit comments