blob: e1177b3b91033f50bf4523a64c9a5e0828101c3a [file] [log] [blame]
Ralf Baechle23fbee92005-07-25 22:45:45 +00001/*
Ralf Baechle23fbee92005-07-25 22:45:45 +00002 * Setup pointers to hardware-dependent routines.
3 * Copyright (C) 2000-2001 Toshiba Corporation
4 *
5 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
6 * terms of the GNU General Public License version 2. This program is
7 * licensed "as is" without any warranty of any kind, whether express
8 * or implied.
9 *
10 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
11 */
Ralf Baechle23fbee92005-07-25 22:45:45 +000012#include <linux/init.h>
13#include <linux/types.h>
14#include <linux/ioport.h>
Ralf Baechle23fbee92005-07-25 22:45:45 +000015#include <linux/delay.h>
16#include <linux/interrupt.h>
17#include <linux/console.h>
Atsushi Nemoto57e386c2007-05-01 00:27:58 +090018#include <linux/platform_device.h>
Atsushi Nemoto4cad1542008-04-05 00:56:09 +090019#include <linux/gpio.h>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000020
Ralf Baechle23fbee92005-07-25 22:45:45 +000021#include <asm/reboot.h>
Ralf Baechle23fbee92005-07-25 22:45:45 +000022#include <asm/io.h>
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090023#include <asm/txx9/generic.h>
24#include <asm/txx9/pci.h>
Atsushi Nemoto22b1d702008-07-11 00:31:36 +090025#include <asm/txx9/rbtx4938.h>
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +090026#include <linux/spi/spi.h>
Atsushi Nemoto22b1d702008-07-11 00:31:36 +090027#include <asm/txx9/spi.h>
Atsushi Nemoto4cad1542008-04-05 00:56:09 +090028#include <asm/txx9pio.h>
Ralf Baechle23fbee92005-07-25 22:45:45 +000029
Atsushi Nemoto7b226092008-07-14 00:15:04 +090030static void rbtx4938_machine_restart(char *command)
Ralf Baechle23fbee92005-07-25 22:45:45 +000031{
32 local_irq_disable();
Atsushi Nemoto66140c82008-04-14 21:49:07 +090033 writeb(1, rbtx4938_softresetlock_addr);
34 writeb(1, rbtx4938_sfvol_addr);
35 writeb(1, rbtx4938_softreset_addr);
Atsushi Nemotoa49297e2008-07-24 00:25:17 +090036 /* fallback */
37 (*_machine_halt)();
Ralf Baechle23fbee92005-07-25 22:45:45 +000038}
39
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090040static void __init rbtx4938_pci_setup(void)
Ralf Baechle23fbee92005-07-25 22:45:45 +000041{
Ralf Baechle23fbee92005-07-25 22:45:45 +000042#ifdef CONFIG_PCI
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090043 int extarb = !(__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCIARB);
44 struct pci_controller *c = &txx9_primary_pcic;
Ralf Baechle23fbee92005-07-25 22:45:45 +000045
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090046 register_pci_controller(c);
Ralf Baechle23fbee92005-07-25 22:45:45 +000047
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090048 if (__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCI66)
49 txx9_pci_option =
50 (txx9_pci_option & ~TXX9_PCI_OPT_CLK_MASK) |
51 TXX9_PCI_OPT_CLK_66; /* already configured */
Ralf Baechle23fbee92005-07-25 22:45:45 +000052
53 /* Reset PCI Bus */
Atsushi Nemoto66140c82008-04-14 21:49:07 +090054 writeb(0, rbtx4938_pcireset_addr);
Ralf Baechle23fbee92005-07-25 22:45:45 +000055 /* Reset PCIC */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090056 txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
57 if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
58 TXX9_PCI_OPT_CLK_66)
Ralf Baechle23fbee92005-07-25 22:45:45 +000059 tx4938_pciclk66_setup();
60 mdelay(10);
61 /* clear PCIC reset */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090062 txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
Atsushi Nemoto66140c82008-04-14 21:49:07 +090063 writeb(1, rbtx4938_pcireset_addr);
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090064 iob();
Ralf Baechle23fbee92005-07-25 22:45:45 +000065
66 tx4938_report_pciclk();
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090067 tx4927_pcic_setup(tx4938_pcicptr, c, extarb);
68 if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
69 TXX9_PCI_OPT_CLK_AUTO &&
70 txx9_pci66_check(c, 0, 0)) {
Ralf Baechle23fbee92005-07-25 22:45:45 +000071 /* Reset PCI Bus */
Atsushi Nemoto66140c82008-04-14 21:49:07 +090072 writeb(0, rbtx4938_pcireset_addr);
Ralf Baechle23fbee92005-07-25 22:45:45 +000073 /* Reset PCIC */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090074 txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
Ralf Baechle23fbee92005-07-25 22:45:45 +000075 tx4938_pciclk66_setup();
76 mdelay(10);
77 /* clear PCIC reset */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090078 txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
Atsushi Nemoto66140c82008-04-14 21:49:07 +090079 writeb(1, rbtx4938_pcireset_addr);
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090080 iob();
Ralf Baechle23fbee92005-07-25 22:45:45 +000081 /* Reinitialize PCIC */
82 tx4938_report_pciclk();
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090083 tx4927_pcic_setup(tx4938_pcicptr, c, extarb);
Ralf Baechle23fbee92005-07-25 22:45:45 +000084 }
85
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090086 if (__raw_readq(&tx4938_ccfgptr->pcfg) &
87 (TX4938_PCFG_ETH0_SEL|TX4938_PCFG_ETH1_SEL)) {
88 /* Reset PCIC1 */
89 txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIC1RST);
90 /* PCI1DMD==0 => PCI1CLK==GBUSCLK/2 => PCI66 */
91 if (!(__raw_readq(&tx4938_ccfgptr->ccfg)
92 & TX4938_CCFG_PCI1DMD))
93 tx4938_ccfg_set(TX4938_CCFG_PCI1_66);
94 mdelay(10);
95 /* clear PCIC1 reset */
96 txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIC1RST);
97 tx4938_report_pci1clk();
Ralf Baechle23fbee92005-07-25 22:45:45 +000098
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090099 /* mem:64K(max), io:64K(max) (enough for ETH0,ETH1) */
100 c = txx9_alloc_pci_controller(NULL, 0, 0x10000, 0, 0x10000);
101 register_pci_controller(c);
102 tx4927_pcic_setup(tx4938_pcic1ptr, c, 0);
103 }
Atsushi Nemoto455cc252008-07-25 23:01:35 +0900104 tx4938_setup_pcierr_irq();
Ralf Baechle23fbee92005-07-25 22:45:45 +0000105#endif /* CONFIG_PCI */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900106}
Ralf Baechle23fbee92005-07-25 22:45:45 +0000107
108/* SPI support */
109
110/* chip select for SPI devices */
111#define SEEPROM1_CS 7 /* PIO7 */
112#define SEEPROM2_CS 0 /* IOC */
113#define SEEPROM3_CS 1 /* IOC */
114#define SRTC_CS 2 /* IOC */
115
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900116static int __init rbtx4938_ethaddr_init(void)
Ralf Baechle23fbee92005-07-25 22:45:45 +0000117{
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900118#ifdef CONFIG_PCI
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900119 unsigned char dat[17];
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900120 unsigned char sum;
121 int i;
122
123 /* 0-3: "MAC\0", 4-9:eth0, 10-15:eth1, 16:sum */
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900124 if (spi_eeprom_read(SEEPROM1_CS, 0, dat, sizeof(dat))) {
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900125 printk(KERN_ERR "seeprom: read error.\n");
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900126 return -ENODEV;
127 } else {
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900128 if (strcmp(dat, "MAC") != 0)
129 printk(KERN_WARNING "seeprom: bad signature.\n");
130 for (i = 0, sum = 0; i < sizeof(dat); i++)
131 sum += dat[i];
132 if (sum)
133 printk(KERN_WARNING "seeprom: bad checksum.\n");
Ralf Baechle23fbee92005-07-25 22:45:45 +0000134 }
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900135 for (i = 0; i < 2; i++) {
Atsushi Nemoto06675e62008-01-19 01:15:52 +0900136 unsigned int id =
137 TXX9_IRQ_BASE + (i ? TX4938_IR_ETH1 : TX4938_IR_ETH0);
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900138 struct platform_device *pdev;
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900139 if (!(__raw_readq(&tx4938_ccfgptr->pcfg) &
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900140 (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 }
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900148#endif /* CONFIG_PCI */
Ralf Baechle23fbee92005-07-25 22:45:45 +0000149 return 0;
150}
Ralf Baechle23fbee92005-07-25 22:45:45 +0000151
Ralf Baechle23fbee92005-07-25 22:45:45 +0000152static void __init rbtx4938_spi_setup(void)
153{
154 /* set SPI_SEL */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900155 txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_SPI_SEL);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000156}
157
158static struct resource rbtx4938_fpga_resource;
Ralf Baechle23fbee92005-07-25 22:45:45 +0000159
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900160static void __init rbtx4938_time_init(void)
Ralf Baechle23fbee92005-07-25 22:45:45 +0000161{
Atsushi Nemoto94a4c322008-07-19 01:51:47 +0900162 tx4938_time_init(0);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000163}
164
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900165static void __init rbtx4938_mem_setup(void)
Ralf Baechle23fbee92005-07-25 22:45:45 +0000166{
167 unsigned long long pcfg;
168 char *argptr;
169
Ralf Baechle23fbee92005-07-25 22:45:45 +0000170 if (txx9_master_clock == 0)
171 txx9_master_clock = 25000000; /* 25MHz */
Atsushi Nemoto94a4c322008-07-19 01:51:47 +0900172
173 tx4938_setup();
174
175#ifdef CONFIG_PCI
176 txx9_alloc_pci_controller(&txx9_primary_pcic, 0, 0, 0, 0);
Atsushi Nemoto07517522008-07-24 00:25:15 +0900177 txx9_board_pcibios_setup = tx4927_pcibios_setup;
Atsushi Nemoto94a4c322008-07-19 01:51:47 +0900178#else
Ralf Baechle23fbee92005-07-25 22:45:45 +0000179 set_io_port_base(RBTX4938_ETHER_BASE);
180#endif
181
Atsushi Nemoto94a4c322008-07-19 01:51:47 +0900182 tx4938_setup_serial();
Ralf Baechle23fbee92005-07-25 22:45:45 +0000183#ifdef CONFIG_SERIAL_TXX9_CONSOLE
184 argptr = prom_getcmdline();
185 if (strstr(argptr, "console=") == NULL) {
186 strcat(argptr, " console=ttyS0,38400");
187 }
188#endif
Ralf Baechle23fbee92005-07-25 22:45:45 +0000189
190#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61
191 printk("PIOSEL: disabling both ata and nand selection\n");
192 local_irq_disable();
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900193 txx9_clear64(&tx4938_ccfgptr->pcfg,
194 TX4938_PCFG_NDF_SEL | TX4938_PCFG_ATA_SEL);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000195#endif
196
197#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_NAND
198 printk("PIOSEL: enabling nand selection\n");
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900199 txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL);
200 txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000201#endif
202
203#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_ATA
204 printk("PIOSEL: enabling ata selection\n");
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900205 txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL);
206 txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000207#endif
208
209#ifdef CONFIG_IP_PNP
210 argptr = prom_getcmdline();
211 if (strstr(argptr, "ip=") == NULL) {
212 strcat(argptr, " ip=any");
213 }
214#endif
215
216
217#ifdef CONFIG_FB
218 {
219 conswitchp = &dummy_con;
220 }
221#endif
222
223 rbtx4938_spi_setup();
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900224 pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg); /* updated */
Ralf Baechle23fbee92005-07-25 22:45:45 +0000225 /* fixup piosel */
226 if ((pcfg & (TX4938_PCFG_ATA_SEL | TX4938_PCFG_NDF_SEL)) ==
Atsushi Nemoto66140c82008-04-14 21:49:07 +0900227 TX4938_PCFG_ATA_SEL)
228 writeb((readb(rbtx4938_piosel_addr) & 0x03) | 0x04,
229 rbtx4938_piosel_addr);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000230 else if ((pcfg & (TX4938_PCFG_ATA_SEL | TX4938_PCFG_NDF_SEL)) ==
Atsushi Nemoto66140c82008-04-14 21:49:07 +0900231 TX4938_PCFG_NDF_SEL)
232 writeb((readb(rbtx4938_piosel_addr) & 0x03) | 0x08,
233 rbtx4938_piosel_addr);
234 else
235 writeb(readb(rbtx4938_piosel_addr) & ~(0x08 | 0x04),
236 rbtx4938_piosel_addr);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000237
238 rbtx4938_fpga_resource.name = "FPGA Registers";
239 rbtx4938_fpga_resource.start = CPHYSADDR(RBTX4938_FPGA_REG_ADDR);
240 rbtx4938_fpga_resource.end = CPHYSADDR(RBTX4938_FPGA_REG_ADDR) + 0xffff;
241 rbtx4938_fpga_resource.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
Atsushi Nemoto8d795f22008-07-18 00:43:48 +0900242 if (request_resource(&txx9_ce_res[2], &rbtx4938_fpga_resource))
Ralf Baechle23fbee92005-07-25 22:45:45 +0000243 printk("request resource for fpga failed\n");
244
Ralf Baechle23fbee92005-07-25 22:45:45 +0000245 _machine_restart = rbtx4938_machine_restart;
Ralf Baechle23fbee92005-07-25 22:45:45 +0000246
Atsushi Nemoto66140c82008-04-14 21:49:07 +0900247 writeb(0xff, rbtx4938_led_addr);
248 printk(KERN_INFO "RBTX4938 --- FPGA(Rev %02x) DIPSW:%02x,%02x\n",
249 readb(rbtx4938_fpga_rev_addr),
250 readb(rbtx4938_dipsw_addr), readb(rbtx4938_bdipsw_addr));
Ralf Baechle23fbee92005-07-25 22:45:45 +0000251}
252
Atsushi Nemoto57e386c2007-05-01 00:27:58 +0900253static int __init rbtx4938_ne_init(void)
254{
255 struct resource res[] = {
256 {
257 .start = RBTX4938_RTL_8019_BASE,
258 .end = RBTX4938_RTL_8019_BASE + 0x20 - 1,
259 .flags = IORESOURCE_IO,
260 }, {
261 .start = RBTX4938_RTL_8019_IRQ,
262 .flags = IORESOURCE_IRQ,
263 }
264 };
265 struct platform_device *dev =
266 platform_device_register_simple("ne", -1,
267 res, ARRAY_SIZE(res));
268 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
269}
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900270
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900271static DEFINE_SPINLOCK(rbtx4938_spi_gpio_lock);
272
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900273static void rbtx4938_spi_gpio_set(struct gpio_chip *chip, unsigned int offset,
274 int value)
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900275{
276 u8 val;
277 unsigned long flags;
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900278 spin_lock_irqsave(&rbtx4938_spi_gpio_lock, flags);
Atsushi Nemoto66140c82008-04-14 21:49:07 +0900279 val = readb(rbtx4938_spics_addr);
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900280 if (value)
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900281 val |= 1 << offset;
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900282 else
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900283 val &= ~(1 << offset);
Atsushi Nemoto66140c82008-04-14 21:49:07 +0900284 writeb(val, rbtx4938_spics_addr);
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900285 mmiowb();
286 spin_unlock_irqrestore(&rbtx4938_spi_gpio_lock, flags);
287}
288
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900289static int rbtx4938_spi_gpio_dir_out(struct gpio_chip *chip,
290 unsigned int offset, int value)
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900291{
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900292 rbtx4938_spi_gpio_set(chip, offset, value);
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900293 return 0;
294}
295
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900296static struct gpio_chip rbtx4938_spi_gpio_chip = {
297 .set = rbtx4938_spi_gpio_set,
298 .direction_output = rbtx4938_spi_gpio_dir_out,
299 .label = "RBTX4938-SPICS",
300 .base = 16,
301 .ngpio = 3,
302};
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900303
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,
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900313 }, {
314 .start = irq,
315 .flags = IORESOURCE_IRQ,
316 },
317 };
Atsushi Nemoto4ccdb4c2007-08-30 23:56:25 -0700318 platform_device_register_simple("spi_txx9", 0,
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900319 res, ARRAY_SIZE(res));
320}
321
322static int __init rbtx4938_spi_init(void)
323{
324 struct spi_board_info srtc_info = {
Atsushi Nemoto9f90a032007-08-19 22:32:10 +0900325 .modalias = "rtc-rs5c348",
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900326 .max_speed_hz = 1000000, /* 1.0Mbps @ Vdd 2.0V */
327 .bus_num = 0,
328 .chip_select = 16 + SRTC_CS,
329 /* Mode 1 (High-Active, Shift-Then-Sample), High Avtive CS */
330 .mode = SPI_MODE_1 | SPI_CS_HIGH,
331 };
332 spi_register_board_info(&srtc_info, 1);
333 spi_eeprom_register(SEEPROM1_CS);
334 spi_eeprom_register(16 + SEEPROM2_CS);
335 spi_eeprom_register(16 + SEEPROM3_CS);
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900336 gpio_request(16 + SRTC_CS, "rtc-rs5c348");
337 gpio_direction_output(16 + SRTC_CS, 0);
338 gpio_request(SEEPROM1_CS, "seeprom1");
339 gpio_direction_output(SEEPROM1_CS, 1);
340 gpio_request(16 + SEEPROM2_CS, "seeprom2");
341 gpio_direction_output(16 + SEEPROM2_CS, 1);
342 gpio_request(16 + SEEPROM3_CS, "seeprom3");
343 gpio_direction_output(16 + SEEPROM3_CS, 1);
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900344 txx9_spi_init(TX4938_SPI_REG & 0xfffffffffULL, RBTX4938_IRQ_IRC_SPI);
345 return 0;
346}
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900347
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900348static void __init rbtx4938_arch_init(void)
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900349{
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900350 gpiochip_add(&rbtx4938_spi_gpio_chip);
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900351 rbtx4938_pci_setup();
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900352 rbtx4938_spi_init();
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900353}
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900354
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900355/* Watchdog support */
356
357static int __init txx9_wdt_init(unsigned long base)
358{
359 struct resource res = {
360 .start = base,
361 .end = base + 0x100 - 1,
362 .flags = IORESOURCE_MEM,
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900363 };
364 struct platform_device *dev =
365 platform_device_register_simple("txx9wdt", -1, &res, 1);
366 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
367}
368
369static int __init rbtx4938_wdt_init(void)
370{
371 return txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL);
372}
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900373
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900374static void __init rbtx4938_device_init(void)
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900375{
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900376 rbtx4938_ethaddr_init();
377 rbtx4938_ne_init();
378 rbtx4938_wdt_init();
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900379}
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900380
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900381struct txx9_board_vec rbtx4938_vec __initdata = {
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900382 .system = "Toshiba RBTX4938",
383 .prom_init = rbtx4938_prom_init,
384 .mem_setup = rbtx4938_mem_setup,
385 .irq_setup = rbtx4938_irq_setup,
386 .time_init = rbtx4938_time_init,
387 .device_init = rbtx4938_device_init,
388 .arch_init = rbtx4938_arch_init,
389#ifdef CONFIG_PCI
390 .pci_map_irq = rbtx4938_pci_map_irq,
391#endif
392};