blob: 4454b7901cd351a4d1e904e058f27c946f5193ee [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>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000018#include <linux/pm.h>
Atsushi Nemoto57e386c2007-05-01 00:27:58 +090019#include <linux/platform_device.h>
Atsushi Nemoto4cad1542008-04-05 00:56:09 +090020#include <linux/gpio.h>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000021
Ralf Baechle23fbee92005-07-25 22:45:45 +000022#include <asm/reboot.h>
Ralf Baechle23fbee92005-07-25 22:45:45 +000023#include <asm/io.h>
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090024#include <asm/txx9/generic.h>
25#include <asm/txx9/pci.h>
Atsushi Nemoto22b1d702008-07-11 00:31:36 +090026#include <asm/txx9/rbtx4938.h>
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +090027#include <linux/spi/spi.h>
Atsushi Nemoto22b1d702008-07-11 00:31:36 +090028#include <asm/txx9/spi.h>
Atsushi Nemoto4cad1542008-04-05 00:56:09 +090029#include <asm/txx9pio.h>
Ralf Baechle23fbee92005-07-25 22:45:45 +000030
Atsushi Nemoto7b226092008-07-14 00:15:04 +090031static void rbtx4938_machine_halt(void)
Ralf Baechle23fbee92005-07-25 22:45:45 +000032{
33 printk(KERN_NOTICE "System Halted\n");
34 local_irq_disable();
35
36 while (1)
37 __asm__(".set\tmips3\n\t"
38 "wait\n\t"
39 ".set\tmips0");
40}
41
Atsushi Nemoto7b226092008-07-14 00:15:04 +090042static void rbtx4938_machine_power_off(void)
Ralf Baechle23fbee92005-07-25 22:45:45 +000043{
44 rbtx4938_machine_halt();
45 /* no return */
46}
47
Atsushi Nemoto7b226092008-07-14 00:15:04 +090048static void rbtx4938_machine_restart(char *command)
Ralf Baechle23fbee92005-07-25 22:45:45 +000049{
50 local_irq_disable();
51
52 printk("Rebooting...");
Atsushi Nemoto66140c82008-04-14 21:49:07 +090053 writeb(1, rbtx4938_softresetlock_addr);
54 writeb(1, rbtx4938_sfvol_addr);
55 writeb(1, rbtx4938_softreset_addr);
56 while(1)
57 ;
Ralf Baechle23fbee92005-07-25 22:45:45 +000058}
59
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090060static void __init rbtx4938_pci_setup(void)
Ralf Baechle23fbee92005-07-25 22:45:45 +000061{
Ralf Baechle23fbee92005-07-25 22:45:45 +000062#ifdef CONFIG_PCI
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090063 int extarb = !(__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCIARB);
64 struct pci_controller *c = &txx9_primary_pcic;
Ralf Baechle23fbee92005-07-25 22:45:45 +000065
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090066 register_pci_controller(c);
Ralf Baechle23fbee92005-07-25 22:45:45 +000067
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090068 if (__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCI66)
69 txx9_pci_option =
70 (txx9_pci_option & ~TXX9_PCI_OPT_CLK_MASK) |
71 TXX9_PCI_OPT_CLK_66; /* already configured */
Ralf Baechle23fbee92005-07-25 22:45:45 +000072
73 /* Reset PCI Bus */
Atsushi Nemoto66140c82008-04-14 21:49:07 +090074 writeb(0, rbtx4938_pcireset_addr);
Ralf Baechle23fbee92005-07-25 22:45:45 +000075 /* Reset PCIC */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090076 txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
77 if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
78 TXX9_PCI_OPT_CLK_66)
Ralf Baechle23fbee92005-07-25 22:45:45 +000079 tx4938_pciclk66_setup();
80 mdelay(10);
81 /* clear PCIC reset */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090082 txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
Atsushi Nemoto66140c82008-04-14 21:49:07 +090083 writeb(1, rbtx4938_pcireset_addr);
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090084 iob();
Ralf Baechle23fbee92005-07-25 22:45:45 +000085
86 tx4938_report_pciclk();
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090087 tx4927_pcic_setup(tx4938_pcicptr, c, extarb);
88 if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) ==
89 TXX9_PCI_OPT_CLK_AUTO &&
90 txx9_pci66_check(c, 0, 0)) {
Ralf Baechle23fbee92005-07-25 22:45:45 +000091 /* Reset PCI Bus */
Atsushi Nemoto66140c82008-04-14 21:49:07 +090092 writeb(0, rbtx4938_pcireset_addr);
Ralf Baechle23fbee92005-07-25 22:45:45 +000093 /* Reset PCIC */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090094 txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
Ralf Baechle23fbee92005-07-25 22:45:45 +000095 tx4938_pciclk66_setup();
96 mdelay(10);
97 /* clear PCIC reset */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090098 txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST);
Atsushi Nemoto66140c82008-04-14 21:49:07 +090099 writeb(1, rbtx4938_pcireset_addr);
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900100 iob();
Ralf Baechle23fbee92005-07-25 22:45:45 +0000101 /* Reinitialize PCIC */
102 tx4938_report_pciclk();
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900103 tx4927_pcic_setup(tx4938_pcicptr, c, extarb);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000104 }
105
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900106 if (__raw_readq(&tx4938_ccfgptr->pcfg) &
107 (TX4938_PCFG_ETH0_SEL|TX4938_PCFG_ETH1_SEL)) {
108 /* Reset PCIC1 */
109 txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIC1RST);
110 /* PCI1DMD==0 => PCI1CLK==GBUSCLK/2 => PCI66 */
111 if (!(__raw_readq(&tx4938_ccfgptr->ccfg)
112 & TX4938_CCFG_PCI1DMD))
113 tx4938_ccfg_set(TX4938_CCFG_PCI1_66);
114 mdelay(10);
115 /* clear PCIC1 reset */
116 txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIC1RST);
117 tx4938_report_pci1clk();
Ralf Baechle23fbee92005-07-25 22:45:45 +0000118
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900119 /* mem:64K(max), io:64K(max) (enough for ETH0,ETH1) */
120 c = txx9_alloc_pci_controller(NULL, 0, 0x10000, 0, 0x10000);
121 register_pci_controller(c);
122 tx4927_pcic_setup(tx4938_pcic1ptr, c, 0);
123 }
Atsushi Nemoto455cc252008-07-25 23:01:35 +0900124 tx4938_setup_pcierr_irq();
Ralf Baechle23fbee92005-07-25 22:45:45 +0000125#endif /* CONFIG_PCI */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900126}
Ralf Baechle23fbee92005-07-25 22:45:45 +0000127
128/* SPI support */
129
130/* chip select for SPI devices */
131#define SEEPROM1_CS 7 /* PIO7 */
132#define SEEPROM2_CS 0 /* IOC */
133#define SEEPROM3_CS 1 /* IOC */
134#define SRTC_CS 2 /* IOC */
135
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900136static int __init rbtx4938_ethaddr_init(void)
Ralf Baechle23fbee92005-07-25 22:45:45 +0000137{
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900138#ifdef CONFIG_PCI
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900139 unsigned char dat[17];
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900140 unsigned char sum;
141 int i;
142
143 /* 0-3: "MAC\0", 4-9:eth0, 10-15:eth1, 16:sum */
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900144 if (spi_eeprom_read(SEEPROM1_CS, 0, dat, sizeof(dat))) {
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900145 printk(KERN_ERR "seeprom: read error.\n");
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900146 return -ENODEV;
147 } else {
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900148 if (strcmp(dat, "MAC") != 0)
149 printk(KERN_WARNING "seeprom: bad signature.\n");
150 for (i = 0, sum = 0; i < sizeof(dat); i++)
151 sum += dat[i];
152 if (sum)
153 printk(KERN_WARNING "seeprom: bad checksum.\n");
Ralf Baechle23fbee92005-07-25 22:45:45 +0000154 }
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900155 for (i = 0; i < 2; i++) {
Atsushi Nemoto06675e62008-01-19 01:15:52 +0900156 unsigned int id =
157 TXX9_IRQ_BASE + (i ? TX4938_IR_ETH1 : TX4938_IR_ETH0);
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900158 struct platform_device *pdev;
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900159 if (!(__raw_readq(&tx4938_ccfgptr->pcfg) &
Atsushi Nemoto2db30152007-07-02 22:43:06 +0900160 (i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL)))
161 continue;
162 pdev = platform_device_alloc("tc35815-mac", id);
163 if (!pdev ||
164 platform_device_add_data(pdev, &dat[4 + 6 * i], 6) ||
165 platform_device_add(pdev))
166 platform_device_put(pdev);
167 }
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900168#endif /* CONFIG_PCI */
Ralf Baechle23fbee92005-07-25 22:45:45 +0000169 return 0;
170}
Ralf Baechle23fbee92005-07-25 22:45:45 +0000171
Ralf Baechle23fbee92005-07-25 22:45:45 +0000172static void __init rbtx4938_spi_setup(void)
173{
174 /* set SPI_SEL */
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900175 txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_SPI_SEL);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000176}
177
178static struct resource rbtx4938_fpga_resource;
Ralf Baechle23fbee92005-07-25 22:45:45 +0000179
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900180static void __init rbtx4938_time_init(void)
Ralf Baechle23fbee92005-07-25 22:45:45 +0000181{
Atsushi Nemoto94a4c322008-07-19 01:51:47 +0900182 tx4938_time_init(0);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000183}
184
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900185static void __init rbtx4938_mem_setup(void)
Ralf Baechle23fbee92005-07-25 22:45:45 +0000186{
187 unsigned long long pcfg;
188 char *argptr;
189
Ralf Baechle23fbee92005-07-25 22:45:45 +0000190 if (txx9_master_clock == 0)
191 txx9_master_clock = 25000000; /* 25MHz */
Atsushi Nemoto94a4c322008-07-19 01:51:47 +0900192
193 tx4938_setup();
194
195#ifdef CONFIG_PCI
196 txx9_alloc_pci_controller(&txx9_primary_pcic, 0, 0, 0, 0);
Atsushi Nemoto07517522008-07-24 00:25:15 +0900197 txx9_board_pcibios_setup = tx4927_pcibios_setup;
Atsushi Nemoto94a4c322008-07-19 01:51:47 +0900198#else
Ralf Baechle23fbee92005-07-25 22:45:45 +0000199 set_io_port_base(RBTX4938_ETHER_BASE);
200#endif
201
Atsushi Nemoto94a4c322008-07-19 01:51:47 +0900202 tx4938_setup_serial();
Ralf Baechle23fbee92005-07-25 22:45:45 +0000203#ifdef CONFIG_SERIAL_TXX9_CONSOLE
204 argptr = prom_getcmdline();
205 if (strstr(argptr, "console=") == NULL) {
206 strcat(argptr, " console=ttyS0,38400");
207 }
208#endif
Ralf Baechle23fbee92005-07-25 22:45:45 +0000209
210#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61
211 printk("PIOSEL: disabling both ata and nand selection\n");
212 local_irq_disable();
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900213 txx9_clear64(&tx4938_ccfgptr->pcfg,
214 TX4938_PCFG_NDF_SEL | TX4938_PCFG_ATA_SEL);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000215#endif
216
217#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_NAND
218 printk("PIOSEL: enabling nand selection\n");
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900219 txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL);
220 txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000221#endif
222
223#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_ATA
224 printk("PIOSEL: enabling ata selection\n");
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900225 txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL);
226 txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000227#endif
228
229#ifdef CONFIG_IP_PNP
230 argptr = prom_getcmdline();
231 if (strstr(argptr, "ip=") == NULL) {
232 strcat(argptr, " ip=any");
233 }
234#endif
235
236
237#ifdef CONFIG_FB
238 {
239 conswitchp = &dummy_con;
240 }
241#endif
242
243 rbtx4938_spi_setup();
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900244 pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg); /* updated */
Ralf Baechle23fbee92005-07-25 22:45:45 +0000245 /* fixup piosel */
246 if ((pcfg & (TX4938_PCFG_ATA_SEL | TX4938_PCFG_NDF_SEL)) ==
Atsushi Nemoto66140c82008-04-14 21:49:07 +0900247 TX4938_PCFG_ATA_SEL)
248 writeb((readb(rbtx4938_piosel_addr) & 0x03) | 0x04,
249 rbtx4938_piosel_addr);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000250 else if ((pcfg & (TX4938_PCFG_ATA_SEL | TX4938_PCFG_NDF_SEL)) ==
Atsushi Nemoto66140c82008-04-14 21:49:07 +0900251 TX4938_PCFG_NDF_SEL)
252 writeb((readb(rbtx4938_piosel_addr) & 0x03) | 0x08,
253 rbtx4938_piosel_addr);
254 else
255 writeb(readb(rbtx4938_piosel_addr) & ~(0x08 | 0x04),
256 rbtx4938_piosel_addr);
Ralf Baechle23fbee92005-07-25 22:45:45 +0000257
258 rbtx4938_fpga_resource.name = "FPGA Registers";
259 rbtx4938_fpga_resource.start = CPHYSADDR(RBTX4938_FPGA_REG_ADDR);
260 rbtx4938_fpga_resource.end = CPHYSADDR(RBTX4938_FPGA_REG_ADDR) + 0xffff;
261 rbtx4938_fpga_resource.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
Atsushi Nemoto8d795f22008-07-18 00:43:48 +0900262 if (request_resource(&txx9_ce_res[2], &rbtx4938_fpga_resource))
Ralf Baechle23fbee92005-07-25 22:45:45 +0000263 printk("request resource for fpga failed\n");
264
Ralf Baechle23fbee92005-07-25 22:45:45 +0000265 _machine_restart = rbtx4938_machine_restart;
266 _machine_halt = rbtx4938_machine_halt;
Ralf Baechlefcdb27a2006-01-18 17:37:07 +0000267 pm_power_off = rbtx4938_machine_power_off;
Ralf Baechle23fbee92005-07-25 22:45:45 +0000268
Atsushi Nemoto66140c82008-04-14 21:49:07 +0900269 writeb(0xff, rbtx4938_led_addr);
270 printk(KERN_INFO "RBTX4938 --- FPGA(Rev %02x) DIPSW:%02x,%02x\n",
271 readb(rbtx4938_fpga_rev_addr),
272 readb(rbtx4938_dipsw_addr), readb(rbtx4938_bdipsw_addr));
Ralf Baechle23fbee92005-07-25 22:45:45 +0000273}
274
Atsushi Nemoto57e386c2007-05-01 00:27:58 +0900275static int __init rbtx4938_ne_init(void)
276{
277 struct resource res[] = {
278 {
279 .start = RBTX4938_RTL_8019_BASE,
280 .end = RBTX4938_RTL_8019_BASE + 0x20 - 1,
281 .flags = IORESOURCE_IO,
282 }, {
283 .start = RBTX4938_RTL_8019_IRQ,
284 .flags = IORESOURCE_IRQ,
285 }
286 };
287 struct platform_device *dev =
288 platform_device_register_simple("ne", -1,
289 res, ARRAY_SIZE(res));
290 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
291}
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900292
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900293static DEFINE_SPINLOCK(rbtx4938_spi_gpio_lock);
294
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900295static void rbtx4938_spi_gpio_set(struct gpio_chip *chip, unsigned int offset,
296 int value)
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900297{
298 u8 val;
299 unsigned long flags;
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900300 spin_lock_irqsave(&rbtx4938_spi_gpio_lock, flags);
Atsushi Nemoto66140c82008-04-14 21:49:07 +0900301 val = readb(rbtx4938_spics_addr);
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900302 if (value)
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900303 val |= 1 << offset;
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900304 else
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900305 val &= ~(1 << offset);
Atsushi Nemoto66140c82008-04-14 21:49:07 +0900306 writeb(val, rbtx4938_spics_addr);
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900307 mmiowb();
308 spin_unlock_irqrestore(&rbtx4938_spi_gpio_lock, flags);
309}
310
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900311static int rbtx4938_spi_gpio_dir_out(struct gpio_chip *chip,
312 unsigned int offset, int value)
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900313{
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900314 rbtx4938_spi_gpio_set(chip, offset, value);
Atsushi Nemoto3896b052007-06-22 23:21:55 +0900315 return 0;
316}
317
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900318static struct gpio_chip rbtx4938_spi_gpio_chip = {
319 .set = rbtx4938_spi_gpio_set,
320 .direction_output = rbtx4938_spi_gpio_dir_out,
321 .label = "RBTX4938-SPICS",
322 .base = 16,
323 .ngpio = 3,
324};
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900325
326/* SPI support */
327
328static void __init txx9_spi_init(unsigned long base, int irq)
329{
330 struct resource res[] = {
331 {
332 .start = base,
333 .end = base + 0x20 - 1,
334 .flags = IORESOURCE_MEM,
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900335 }, {
336 .start = irq,
337 .flags = IORESOURCE_IRQ,
338 },
339 };
Atsushi Nemoto4ccdb4c2007-08-30 23:56:25 -0700340 platform_device_register_simple("spi_txx9", 0,
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900341 res, ARRAY_SIZE(res));
342}
343
344static int __init rbtx4938_spi_init(void)
345{
346 struct spi_board_info srtc_info = {
Atsushi Nemoto9f90a032007-08-19 22:32:10 +0900347 .modalias = "rtc-rs5c348",
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900348 .max_speed_hz = 1000000, /* 1.0Mbps @ Vdd 2.0V */
349 .bus_num = 0,
350 .chip_select = 16 + SRTC_CS,
351 /* Mode 1 (High-Active, Shift-Then-Sample), High Avtive CS */
352 .mode = SPI_MODE_1 | SPI_CS_HIGH,
353 };
354 spi_register_board_info(&srtc_info, 1);
355 spi_eeprom_register(SEEPROM1_CS);
356 spi_eeprom_register(16 + SEEPROM2_CS);
357 spi_eeprom_register(16 + SEEPROM3_CS);
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900358 gpio_request(16 + SRTC_CS, "rtc-rs5c348");
359 gpio_direction_output(16 + SRTC_CS, 0);
360 gpio_request(SEEPROM1_CS, "seeprom1");
361 gpio_direction_output(SEEPROM1_CS, 1);
362 gpio_request(16 + SEEPROM2_CS, "seeprom2");
363 gpio_direction_output(16 + SEEPROM2_CS, 1);
364 gpio_request(16 + SEEPROM3_CS, "seeprom3");
365 gpio_direction_output(16 + SEEPROM3_CS, 1);
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900366 txx9_spi_init(TX4938_SPI_REG & 0xfffffffffULL, RBTX4938_IRQ_IRC_SPI);
367 return 0;
368}
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900369
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900370static void __init rbtx4938_arch_init(void)
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900371{
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900372 gpiochip_add(&rbtx4938_spi_gpio_chip);
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +0900373 rbtx4938_pci_setup();
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900374 rbtx4938_spi_init();
Atsushi Nemoto4cad1542008-04-05 00:56:09 +0900375}
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900376
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900377/* Watchdog support */
378
379static int __init txx9_wdt_init(unsigned long base)
380{
381 struct resource res = {
382 .start = base,
383 .end = base + 0x100 - 1,
384 .flags = IORESOURCE_MEM,
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900385 };
386 struct platform_device *dev =
387 platform_device_register_simple("txx9wdt", -1, &res, 1);
388 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
389}
390
391static int __init rbtx4938_wdt_init(void)
392{
393 return txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL);
394}
Atsushi Nemoto2064ba22007-11-24 01:20:27 +0900395
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900396static void __init rbtx4938_device_init(void)
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900397{
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900398 rbtx4938_ethaddr_init();
399 rbtx4938_ne_init();
400 rbtx4938_wdt_init();
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900401}
Atsushi Nemotof74cf6f2007-06-22 23:22:06 +0900402
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900403struct txx9_board_vec rbtx4938_vec __initdata = {
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +0900404 .system = "Toshiba RBTX4938",
405 .prom_init = rbtx4938_prom_init,
406 .mem_setup = rbtx4938_mem_setup,
407 .irq_setup = rbtx4938_irq_setup,
408 .time_init = rbtx4938_time_init,
409 .device_init = rbtx4938_device_init,
410 .arch_init = rbtx4938_arch_init,
411#ifdef CONFIG_PCI
412 .pci_map_irq = rbtx4938_pci_map_irq,
413#endif
414};