11
11
#include <linux/irq.h>
12
12
#include <linux/kernel.h>
13
13
#include <linux/module.h>
14
- #include <linux/platform_data/sa11x0-serial.h>
15
14
#include <linux/platform_device.h>
16
15
#include <linux/pm.h>
17
16
#include <linux/serial_core.h>
49
48
#define IRR_SA1111 (1 << 2)
50
49
51
50
#define NCR_NGPIO 7
52
-
53
- #define MDM_CTL0_RTS1 (1 << 0)
54
- #define MDM_CTL0_DTR1 (1 << 1)
55
- #define MDM_CTL0_RTS2 (1 << 2)
56
- #define MDM_CTL0_DTR2 (1 << 3)
57
51
#define MDM_CTL0_NGPIO 4
58
-
59
- #define MDM_CTL1_CTS1 (1 << 0)
60
- #define MDM_CTL1_DSR1 (1 << 1)
61
- #define MDM_CTL1_DCD1 (1 << 2)
62
- #define MDM_CTL1_CTS2 (1 << 3)
63
- #define MDM_CTL1_DSR2 (1 << 4)
64
- #define MDM_CTL1_DCD2 (1 << 5)
65
52
#define MDM_CTL1_NGPIO 6
66
-
67
- #define AUD_SEL_1341 (1 << 0)
68
- #define AUD_MUTE_1341 (1 << 1)
69
53
#define AUD_NGPIO 2
70
54
71
55
extern void sa1110_mb_disable (void );
@@ -97,6 +81,30 @@ struct neponset_drvdata {
97
81
struct gpio_chip * gpio [4 ];
98
82
};
99
83
84
+ static struct gpiod_lookup_table neponset_uart1_gpio_table = {
85
+ .dev_id = "sa11x0-uart.1" ,
86
+ .table = {
87
+ GPIO_LOOKUP ("neponset-mdm-ctl0" , 2 , "rts" , GPIO_ACTIVE_LOW ),
88
+ GPIO_LOOKUP ("neponset-mdm-ctl0" , 3 , "dtr" , GPIO_ACTIVE_LOW ),
89
+ GPIO_LOOKUP ("neponset-mdm-ctl1" , 3 , "cts" , GPIO_ACTIVE_LOW ),
90
+ GPIO_LOOKUP ("neponset-mdm-ctl1" , 4 , "dsr" , GPIO_ACTIVE_LOW ),
91
+ GPIO_LOOKUP ("neponset-mdm-ctl1" , 5 , "dcd" , GPIO_ACTIVE_LOW ),
92
+ { },
93
+ },
94
+ };
95
+
96
+ static struct gpiod_lookup_table neponset_uart3_gpio_table = {
97
+ .dev_id = "sa11x0-uart.3" ,
98
+ .table = {
99
+ GPIO_LOOKUP ("neponset-mdm-ctl0" , 0 , "rts" , GPIO_ACTIVE_LOW ),
100
+ GPIO_LOOKUP ("neponset-mdm-ctl0" , 1 , "dtr" , GPIO_ACTIVE_LOW ),
101
+ GPIO_LOOKUP ("neponset-mdm-ctl1" , 0 , "cts" , GPIO_ACTIVE_LOW ),
102
+ GPIO_LOOKUP ("neponset-mdm-ctl1" , 1 , "dsr" , GPIO_ACTIVE_LOW ),
103
+ GPIO_LOOKUP ("neponset-mdm-ctl1" , 2 , "dcd" , GPIO_ACTIVE_LOW ),
104
+ { },
105
+ },
106
+ };
107
+
100
108
static struct gpiod_lookup_table neponset_pcmcia_table = {
101
109
.dev_id = "1800" ,
102
110
.table = {
@@ -124,69 +132,6 @@ void neponset_ncr_frob(unsigned int mask, unsigned int val)
124
132
}
125
133
EXPORT_SYMBOL (neponset_ncr_frob );
126
134
127
- static void neponset_set_mctrl (struct uart_port * port , u_int mctrl )
128
- {
129
- struct neponset_drvdata * n = nep ;
130
- unsigned long mask , val = 0 ;
131
-
132
- if (!n )
133
- return ;
134
-
135
- if (port -> mapbase == _Ser1UTCR0 ) {
136
- mask = MDM_CTL0_RTS2 | MDM_CTL0_DTR2 ;
137
-
138
- if (!(mctrl & TIOCM_RTS ))
139
- val |= MDM_CTL0_RTS2 ;
140
-
141
- if (!(mctrl & TIOCM_DTR ))
142
- val |= MDM_CTL0_DTR2 ;
143
- } else if (port -> mapbase == _Ser3UTCR0 ) {
144
- mask = MDM_CTL0_RTS1 | MDM_CTL0_DTR1 ;
145
-
146
- if (!(mctrl & TIOCM_RTS ))
147
- val |= MDM_CTL0_RTS1 ;
148
-
149
- if (!(mctrl & TIOCM_DTR ))
150
- val |= MDM_CTL0_DTR1 ;
151
- }
152
-
153
- n -> gpio [1 ]-> set_multiple (n -> gpio [1 ], & mask , & val );
154
- }
155
-
156
- static u_int neponset_get_mctrl (struct uart_port * port )
157
- {
158
- void __iomem * base = nep -> base ;
159
- u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR ;
160
- u_int mdm_ctl1 ;
161
-
162
- if (!base )
163
- return ret ;
164
-
165
- mdm_ctl1 = readb_relaxed (base + MDM_CTL_1 );
166
- if (port -> mapbase == _Ser1UTCR0 ) {
167
- if (mdm_ctl1 & MDM_CTL1_DCD2 )
168
- ret &= ~TIOCM_CD ;
169
- if (mdm_ctl1 & MDM_CTL1_CTS2 )
170
- ret &= ~TIOCM_CTS ;
171
- if (mdm_ctl1 & MDM_CTL1_DSR2 )
172
- ret &= ~TIOCM_DSR ;
173
- } else if (port -> mapbase == _Ser3UTCR0 ) {
174
- if (mdm_ctl1 & MDM_CTL1_DCD1 )
175
- ret &= ~TIOCM_CD ;
176
- if (mdm_ctl1 & MDM_CTL1_CTS1 )
177
- ret &= ~TIOCM_CTS ;
178
- if (mdm_ctl1 & MDM_CTL1_DSR1 )
179
- ret &= ~TIOCM_DSR ;
180
- }
181
-
182
- return ret ;
183
- }
184
-
185
- static struct sa1100_port_fns neponset_port_fns = {
186
- .set_mctrl = neponset_set_mctrl ,
187
- .get_mctrl = neponset_get_mctrl ,
188
- };
189
-
190
135
/*
191
136
* Install handler for Neponset IRQ. Note that we have to loop here
192
137
* since the ETHERNET and USAR IRQs are level based, and we need to
@@ -388,6 +333,8 @@ static int neponset_probe(struct platform_device *dev)
388
333
d -> base + AUD_CTL , AUD_NGPIO , false,
389
334
neponset_aud_names );
390
335
336
+ gpiod_add_lookup_table (& neponset_uart1_gpio_table );
337
+ gpiod_add_lookup_table (& neponset_uart3_gpio_table );
391
338
gpiod_add_lookup_table (& neponset_pcmcia_table );
392
339
393
340
/*
@@ -402,8 +349,6 @@ static int neponset_probe(struct platform_device *dev)
402
349
d -> irq_base , d -> irq_base + NEP_IRQ_NR - 1 );
403
350
nep = d ;
404
351
405
- sa1100_register_uart_fns (& neponset_port_fns );
406
-
407
352
/* Ensure that the memory bus request/grant signals are setup */
408
353
sa1110_mb_disable ();
409
354
@@ -442,6 +387,8 @@ static int neponset_remove(struct platform_device *dev)
442
387
platform_device_unregister (d -> smc91x );
443
388
444
389
gpiod_remove_lookup_table (& neponset_pcmcia_table );
390
+ gpiod_remove_lookup_table (& neponset_uart3_gpio_table );
391
+ gpiod_remove_lookup_table (& neponset_uart1_gpio_table );
445
392
446
393
irq_set_chained_handler (irq , NULL );
447
394
irq_free_descs (d -> irq_base , NEP_IRQ_NR );
0 commit comments