aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-07-25 10:08:06 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-07-30 16:54:40 -0400
commit7779a5e07d33fe316fe468e7afe7975fb686a831 (patch)
tree05426226c35b46a938a555a37524307ceb1a22d7
parentbb72f1f729dcbd6a6a93c74479eeaa19deebfb47 (diff)
[MIPS] TXx9: Unify serial_txx9 setup
* Unify calling of early_serial_txx9_setup. * Use dedicated serial clock on RBTX4938. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/txx9/generic/setup.c24
-rw-r--r--arch/mips/txx9/generic/setup_tx3927.c25
-rw-r--r--arch/mips/txx9/generic/setup_tx4927.c23
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c18
-rw-r--r--arch/mips/txx9/jmr3927/setup.c2
-rw-r--r--arch/mips/txx9/rbtx4927/setup.c2
-rw-r--r--arch/mips/txx9/rbtx4938/setup.c2
-rw-r--r--include/asm-mips/txx9/generic.h2
-rw-r--r--include/asm-mips/txx9/tx3927.h2
-rw-r--r--include/asm-mips/txx9/tx4927.h2
-rw-r--r--include/asm-mips/txx9/tx4938.h2
11 files changed, 49 insertions, 55 deletions
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index b136c6692a5f..94ce1a5c38a4 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -21,6 +21,7 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/serial_core.h>
24#include <asm/bootinfo.h> 25#include <asm/bootinfo.h>
25#include <asm/time.h> 26#include <asm/time.h>
26#include <asm/reboot.h> 27#include <asm/reboot.h>
@@ -247,6 +248,29 @@ void __init txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr)
247 platform_device_put(pdev); 248 platform_device_put(pdev);
248} 249}
249 250
251void __init txx9_sio_init(unsigned long baseaddr, int irq,
252 unsigned int line, unsigned int sclk, int nocts)
253{
254#ifdef CONFIG_SERIAL_TXX9
255 struct uart_port req;
256
257 memset(&req, 0, sizeof(req));
258 req.line = line;
259 req.iotype = UPIO_MEM;
260 req.membase = ioremap(baseaddr, 0x24);
261 req.mapbase = baseaddr;
262 req.irq = irq;
263 if (!nocts)
264 req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
265 if (sclk) {
266 req.flags |= UPF_MAGIC_MULTIPLIER /*USE_SCLK*/;
267 req.uartclk = sclk;
268 } else
269 req.uartclk = TXX9_IMCLK;
270 early_serial_txx9_setup(&req);
271#endif /* CONFIG_SERIAL_TXX9 */
272}
273
250/* wrappers */ 274/* wrappers */
251void __init plat_mem_setup(void) 275void __init plat_mem_setup(void)
252{ 276{
diff --git a/arch/mips/txx9/generic/setup_tx3927.c b/arch/mips/txx9/generic/setup_tx3927.c
index 0d09a0ff71e3..7bd963d37fc3 100644
--- a/arch/mips/txx9/generic/setup_tx3927.c
+++ b/arch/mips/txx9/generic/setup_tx3927.c
@@ -13,8 +13,8 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/ioport.h> 14#include <linux/ioport.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/serial_core.h>
17#include <linux/param.h> 16#include <linux/param.h>
17#include <linux/io.h>
18#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
19#include <asm/txx9irq.h> 19#include <asm/txx9irq.h>
20#include <asm/txx9tmr.h> 20#include <asm/txx9tmr.h>
@@ -119,23 +119,12 @@ void __init tx3927_time_init(unsigned int evt_tmrnr, unsigned int src_tmrnr)
119 txx9_clocksource_init(TX3927_TMR_REG(src_tmrnr), TXX9_IMCLK); 119 txx9_clocksource_init(TX3927_TMR_REG(src_tmrnr), TXX9_IMCLK);
120} 120}
121 121
122void __init tx3927_setup_serial(unsigned int cts_mask) 122void __init tx3927_sio_init(unsigned int sclk, unsigned int cts_mask)
123{ 123{
124#ifdef CONFIG_SERIAL_TXX9
125 int i; 124 int i;
126 struct uart_port req; 125
127 126 for (i = 0; i < 2; i++)
128 for (i = 0; i < 2; i++) { 127 txx9_sio_init(TX3927_SIO_REG(i),
129 memset(&req, 0, sizeof(req)); 128 TXX9_IRQ_BASE + TX3927_IR_SIO(i),
130 req.line = i; 129 i, sclk, (1 << i) & cts_mask);
131 req.iotype = UPIO_MEM;
132 req.membase = (unsigned char __iomem *)TX3927_SIO_REG(i);
133 req.mapbase = TX3927_SIO_REG(i);
134 req.irq = TXX9_IRQ_BASE + TX3927_IR_SIO(i);
135 if (!((1 << i) & cts_mask))
136 req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
137 req.uartclk = TXX9_IMCLK;
138 early_serial_txx9_setup(&req);
139 }
140#endif /* CONFIG_SERIAL_TXX9 */
141} 130}
diff --git a/arch/mips/txx9/generic/setup_tx4927.c b/arch/mips/txx9/generic/setup_tx4927.c
index b42c85573d0d..f80d4b7a694d 100644
--- a/arch/mips/txx9/generic/setup_tx4927.c
+++ b/arch/mips/txx9/generic/setup_tx4927.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/ioport.h> 14#include <linux/ioport.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/serial_core.h>
17#include <linux/param.h> 16#include <linux/param.h>
18#include <asm/txx9irq.h> 17#include <asm/txx9irq.h>
19#include <asm/txx9tmr.h> 18#include <asm/txx9tmr.h>
@@ -178,22 +177,12 @@ void __init tx4927_time_init(unsigned int tmrnr)
178 TXX9_IMCLK); 177 TXX9_IMCLK);
179} 178}
180 179
181void __init tx4927_setup_serial(void) 180void __init tx4927_sio_init(unsigned int sclk, unsigned int cts_mask)
182{ 181{
183#ifdef CONFIG_SERIAL_TXX9
184 int i; 182 int i;
185 struct uart_port req; 183
186 184 for (i = 0; i < 2; i++)
187 for (i = 0; i < 2; i++) { 185 txx9_sio_init(TX4927_SIO_REG(i) & 0xfffffffffULL,
188 memset(&req, 0, sizeof(req)); 186 TXX9_IRQ_BASE + TX4927_IR_SIO(i),
189 req.line = i; 187 i, sclk, (1 << i) & cts_mask);
190 req.iotype = UPIO_MEM;
191 req.membase = (unsigned char __iomem *)TX4927_SIO_REG(i);
192 req.mapbase = TX4927_SIO_REG(i) & 0xfffffffffULL;
193 req.irq = TXX9_IRQ_BASE + TX4927_IR_SIO(i);
194 req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
195 req.uartclk = TXX9_IMCLK;
196 early_serial_txx9_setup(&req);
197 }
198#endif /* CONFIG_SERIAL_TXX9 */
199} 188}
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index 1ceace45ef6a..f3040b9ba059 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/ioport.h> 14#include <linux/ioport.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/serial_core.h>
17#include <linux/param.h> 16#include <linux/param.h>
18#include <asm/txx9irq.h> 17#include <asm/txx9irq.h>
19#include <asm/txx9tmr.h> 18#include <asm/txx9tmr.h>
@@ -238,11 +237,9 @@ void __init tx4938_time_init(unsigned int tmrnr)
238 TXX9_IMCLK); 237 TXX9_IMCLK);
239} 238}
240 239
241void __init tx4938_setup_serial(void) 240void __init tx4938_sio_init(unsigned int sclk, unsigned int cts_mask)
242{ 241{
243#ifdef CONFIG_SERIAL_TXX9
244 int i; 242 int i;
245 struct uart_port req;
246 unsigned int ch_mask = 0; 243 unsigned int ch_mask = 0;
247 244
248 if (__raw_readq(&tx4938_ccfgptr->pcfg) & TX4938_PCFG_ETH0_SEL) 245 if (__raw_readq(&tx4938_ccfgptr->pcfg) & TX4938_PCFG_ETH0_SEL)
@@ -250,17 +247,10 @@ void __init tx4938_setup_serial(void)
250 for (i = 0; i < 2; i++) { 247 for (i = 0; i < 2; i++) {
251 if ((1 << i) & ch_mask) 248 if ((1 << i) & ch_mask)
252 continue; 249 continue;
253 memset(&req, 0, sizeof(req)); 250 txx9_sio_init(TX4938_SIO_REG(i) & 0xfffffffffULL,
254 req.line = i; 251 TXX9_IRQ_BASE + TX4938_IR_SIO(i),
255 req.iotype = UPIO_MEM; 252 i, sclk, (1 << i) & cts_mask);
256 req.membase = (unsigned char __iomem *)TX4938_SIO_REG(i);
257 req.mapbase = TX4938_SIO_REG(i) & 0xfffffffffULL;
258 req.irq = TXX9_IRQ_BASE + TX4938_IR_SIO(i);
259 req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
260 req.uartclk = TXX9_IMCLK;
261 early_serial_txx9_setup(&req);
262 } 253 }
263#endif /* CONFIG_SERIAL_TXX9 */
264} 254}
265 255
266void __init tx4938_spi_init(int busid) 256void __init tx4938_spi_init(int busid)
diff --git a/arch/mips/txx9/jmr3927/setup.c b/arch/mips/txx9/jmr3927/setup.c
index cf7513d95fa7..87db41be8a56 100644
--- a/arch/mips/txx9/jmr3927/setup.c
+++ b/arch/mips/txx9/jmr3927/setup.c
@@ -105,7 +105,7 @@ static void __init jmr3927_mem_setup(void)
105 /* initialize board */ 105 /* initialize board */
106 jmr3927_board_init(); 106 jmr3927_board_init();
107 107
108 tx3927_setup_serial(1 << 1); /* ch1: noCTS */ 108 tx3927_sio_init(0, 1 << 1); /* ch1: noCTS */
109#ifdef CONFIG_SERIAL_TXX9_CONSOLE 109#ifdef CONFIG_SERIAL_TXX9_CONSOLE
110 argptr = prom_getcmdline(); 110 argptr = prom_getcmdline();
111 if (!strstr(argptr, "console=")) 111 if (!strstr(argptr, "console="))
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 962ada57d12d..0d39bafea794 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -212,7 +212,7 @@ static void __init rbtx4927_mem_setup(void)
212 set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET); 212 set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET);
213#endif 213#endif
214 214
215 tx4927_setup_serial(); 215 tx4927_sio_init(0, 0);
216#ifdef CONFIG_SERIAL_TXX9_CONSOLE 216#ifdef CONFIG_SERIAL_TXX9_CONSOLE
217 argptr = prom_getcmdline(); 217 argptr = prom_getcmdline();
218 if (!strstr(argptr, "console=")) 218 if (!strstr(argptr, "console="))
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index 5c05a21b33f5..9ab48dec0fe8 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -165,7 +165,7 @@ static void __init rbtx4938_mem_setup(void)
165 set_io_port_base(RBTX4938_ETHER_BASE); 165 set_io_port_base(RBTX4938_ETHER_BASE);
166#endif 166#endif
167 167
168 tx4938_setup_serial(); 168 tx4938_sio_init(7372800, 0);
169#ifdef CONFIG_SERIAL_TXX9_CONSOLE 169#ifdef CONFIG_SERIAL_TXX9_CONSOLE
170 argptr = prom_getcmdline(); 170 argptr = prom_getcmdline();
171 if (!strstr(argptr, "console=")) 171 if (!strstr(argptr, "console="))
diff --git a/include/asm-mips/txx9/generic.h b/include/asm-mips/txx9/generic.h
index c6b5cd6a2722..a295aaa846fa 100644
--- a/include/asm-mips/txx9/generic.h
+++ b/include/asm-mips/txx9/generic.h
@@ -47,5 +47,7 @@ char *prom_getcmdline(void);
47void txx9_wdt_init(unsigned long base); 47void txx9_wdt_init(unsigned long base);
48void txx9_spi_init(int busid, unsigned long base, int irq); 48void txx9_spi_init(int busid, unsigned long base, int irq);
49void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr); 49void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
50void txx9_sio_init(unsigned long baseaddr, int irq,
51 unsigned int line, unsigned int sclk, int nocts);
50 52
51#endif /* __ASM_TXX9_GENERIC_H */ 53#endif /* __ASM_TXX9_GENERIC_H */
diff --git a/include/asm-mips/txx9/tx3927.h b/include/asm-mips/txx9/tx3927.h
index f0439a73b3aa..14e063689626 100644
--- a/include/asm-mips/txx9/tx3927.h
+++ b/include/asm-mips/txx9/tx3927.h
@@ -331,7 +331,7 @@ struct tx3927_ccfg_reg {
331void tx3927_wdt_init(void); 331void tx3927_wdt_init(void);
332void tx3927_setup(void); 332void tx3927_setup(void);
333void tx3927_time_init(unsigned int evt_tmrnr, unsigned int src_tmrnr); 333void tx3927_time_init(unsigned int evt_tmrnr, unsigned int src_tmrnr);
334void tx3927_setup_serial(unsigned int cts_mask); 334void tx3927_sio_init(unsigned int sclk, unsigned int cts_mask);
335struct pci_controller; 335struct pci_controller;
336void tx3927_pcic_setup(struct pci_controller *channel, 336void tx3927_pcic_setup(struct pci_controller *channel,
337 unsigned long sdram_size, int extarb); 337 unsigned long sdram_size, int extarb);
diff --git a/include/asm-mips/txx9/tx4927.h b/include/asm-mips/txx9/tx4927.h
index 3d9fd7dcb33f..195f6515db9a 100644
--- a/include/asm-mips/txx9/tx4927.h
+++ b/include/asm-mips/txx9/tx4927.h
@@ -246,7 +246,7 @@ unsigned int tx4927_get_mem_size(void);
246void tx4927_wdt_init(void); 246void tx4927_wdt_init(void);
247void tx4927_setup(void); 247void tx4927_setup(void);
248void tx4927_time_init(unsigned int tmrnr); 248void tx4927_time_init(unsigned int tmrnr);
249void tx4927_setup_serial(void); 249void tx4927_sio_init(unsigned int sclk, unsigned int cts_mask);
250int tx4927_report_pciclk(void); 250int tx4927_report_pciclk(void);
251int tx4927_pciclk66_setup(void); 251int tx4927_pciclk66_setup(void);
252void tx4927_setup_pcierr_irq(void); 252void tx4927_setup_pcierr_irq(void);
diff --git a/include/asm-mips/txx9/tx4938.h b/include/asm-mips/txx9/tx4938.h
index 26f9d4aaf136..8175d4ccbc39 100644
--- a/include/asm-mips/txx9/tx4938.h
+++ b/include/asm-mips/txx9/tx4938.h
@@ -279,7 +279,7 @@ struct tx4938_ccfg_reg {
279void tx4938_wdt_init(void); 279void tx4938_wdt_init(void);
280void tx4938_setup(void); 280void tx4938_setup(void);
281void tx4938_time_init(unsigned int tmrnr); 281void tx4938_time_init(unsigned int tmrnr);
282void tx4938_setup_serial(void); 282void tx4938_sio_init(unsigned int sclk, unsigned int cts_mask);
283void tx4938_spi_init(int busid); 283void tx4938_spi_init(int busid);
284void tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1); 284void tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1);
285int tx4938_report_pciclk(void); 285int tx4938_report_pciclk(void);