aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/txx9/generic/setup.c27
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c16
-rw-r--r--arch/mips/txx9/rbtx4938/setup.c34
-rw-r--r--include/asm-mips/txx9/generic.h2
-rw-r--r--include/asm-mips/txx9/tx4938.h2
5 files changed, 49 insertions, 32 deletions
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 7b5705d18deb..b136c6692a5f 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -220,6 +220,33 @@ void __init txx9_wdt_init(unsigned long base)
220 platform_device_register_simple("txx9wdt", -1, &res, 1); 220 platform_device_register_simple("txx9wdt", -1, &res, 1);
221} 221}
222 222
223/* SPI support */
224void __init txx9_spi_init(int busid, unsigned long base, int irq)
225{
226 struct resource res[] = {
227 {
228 .start = base,
229 .end = base + 0x20 - 1,
230 .flags = IORESOURCE_MEM,
231 }, {
232 .start = irq,
233 .flags = IORESOURCE_IRQ,
234 },
235 };
236 platform_device_register_simple("spi_txx9", busid,
237 res, ARRAY_SIZE(res));
238}
239
240void __init txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr)
241{
242 struct platform_device *pdev =
243 platform_device_alloc("tc35815-mac", id);
244 if (!pdev ||
245 platform_device_add_data(pdev, ethaddr, 6) ||
246 platform_device_add(pdev))
247 platform_device_put(pdev);
248}
249
223/* wrappers */ 250/* wrappers */
224void __init plat_mem_setup(void) 251void __init plat_mem_setup(void)
225{ 252{
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index b0a3dc8863fd..1ceace45ef6a 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -262,3 +262,19 @@ void __init tx4938_setup_serial(void)
262 } 262 }
263#endif /* CONFIG_SERIAL_TXX9 */ 263#endif /* CONFIG_SERIAL_TXX9 */
264} 264}
265
266void __init tx4938_spi_init(int busid)
267{
268 txx9_spi_init(busid, TX4938_SPI_REG & 0xfffffffffULL,
269 TXX9_IRQ_BASE + TX4938_IR_SPI);
270}
271
272void __init tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1)
273{
274 u64 pcfg = __raw_readq(&tx4938_ccfgptr->pcfg);
275
276 if (addr0 && (pcfg & TX4938_PCFG_ETH0_SEL))
277 txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH0, addr0);
278 if (addr1 && (pcfg & TX4938_PCFG_ETH1_SEL))
279 txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH1, addr1);
280}
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index ff5fda2151f2..3324a70a6b7a 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -132,19 +132,7 @@ static int __init rbtx4938_ethaddr_init(void)
132 if (sum) 132 if (sum)
133 printk(KERN_WARNING "seeprom: bad checksum.\n"); 133 printk(KERN_WARNING "seeprom: bad checksum.\n");
134 } 134 }
135 for (i = 0; i < 2; i++) { 135 tx4938_ethaddr_init(&dat[4], &dat[4 + 6]);
136 unsigned int id =
137 TXX9_IRQ_BASE + (i ? TX4938_IR_ETH1 : TX4938_IR_ETH0);
138 struct platform_device *pdev;
139 if (!(__raw_readq(&tx4938_ccfgptr->pcfg) &
140 (i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL)))
141 continue;
142 pdev = platform_device_alloc("tc35815-mac", id);
143 if (!pdev ||
144 platform_device_add_data(pdev, &dat[4 + 6 * i], 6) ||
145 platform_device_add(pdev))
146 platform_device_put(pdev);
147 }
148#endif /* CONFIG_PCI */ 136#endif /* CONFIG_PCI */
149 return 0; 137 return 0;
150} 138}
@@ -301,24 +289,6 @@ static struct gpio_chip rbtx4938_spi_gpio_chip = {
301 .ngpio = 3, 289 .ngpio = 3,
302}; 290};
303 291
304/* SPI support */
305
306static void __init txx9_spi_init(unsigned long base, int irq)
307{
308 struct resource res[] = {
309 {
310 .start = base,
311 .end = base + 0x20 - 1,
312 .flags = IORESOURCE_MEM,
313 }, {
314 .start = irq,
315 .flags = IORESOURCE_IRQ,
316 },
317 };
318 platform_device_register_simple("spi_txx9", 0,
319 res, ARRAY_SIZE(res));
320}
321
322static int __init rbtx4938_spi_init(void) 292static int __init rbtx4938_spi_init(void)
323{ 293{
324 struct spi_board_info srtc_info = { 294 struct spi_board_info srtc_info = {
@@ -341,7 +311,7 @@ static int __init rbtx4938_spi_init(void)
341 gpio_direction_output(16 + SEEPROM2_CS, 1); 311 gpio_direction_output(16 + SEEPROM2_CS, 1);
342 gpio_request(16 + SEEPROM3_CS, "seeprom3"); 312 gpio_request(16 + SEEPROM3_CS, "seeprom3");
343 gpio_direction_output(16 + SEEPROM3_CS, 1); 313 gpio_direction_output(16 + SEEPROM3_CS, 1);
344 txx9_spi_init(TX4938_SPI_REG & 0xfffffffffULL, RBTX4938_IRQ_IRC_SPI); 314 tx4938_spi_init(0);
345 return 0; 315 return 0;
346} 316}
347 317
diff --git a/include/asm-mips/txx9/generic.h b/include/asm-mips/txx9/generic.h
index 2b34d09e34c8..c6b5cd6a2722 100644
--- a/include/asm-mips/txx9/generic.h
+++ b/include/asm-mips/txx9/generic.h
@@ -45,5 +45,7 @@ extern int (*txx9_irq_dispatch)(int pending);
45void prom_init_cmdline(void); 45void prom_init_cmdline(void);
46char *prom_getcmdline(void); 46char *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);
49void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
48 50
49#endif /* __ASM_TXX9_GENERIC_H */ 51#endif /* __ASM_TXX9_GENERIC_H */
diff --git a/include/asm-mips/txx9/tx4938.h b/include/asm-mips/txx9/tx4938.h
index d5d7cef7ee8d..26f9d4aaf136 100644
--- a/include/asm-mips/txx9/tx4938.h
+++ b/include/asm-mips/txx9/tx4938.h
@@ -280,6 +280,8 @@ void 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_setup_serial(void);
283void tx4938_spi_init(int busid);
284void tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1);
283int tx4938_report_pciclk(void); 285int tx4938_report_pciclk(void);
284void tx4938_report_pci1clk(void); 286void tx4938_report_pci1clk(void);
285int tx4938_pciclk66_setup(void); 287int tx4938_pciclk66_setup(void);