18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Toshiba rbtx4927 specific setup 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Author: MontaVista Software, Inc. 58c2ecf20Sopenharmony_ci * source@mvista.com 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright 2001-2002 MontaVista Software Inc. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Copyright (C) 1996, 97, 2001, 04 Ralf Baechle (ralf@linux-mips.org) 108c2ecf20Sopenharmony_ci * Copyright (C) 2000 RidgeRun, Inc. 118c2ecf20Sopenharmony_ci * Author: RidgeRun, Inc. 128c2ecf20Sopenharmony_ci * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * Copyright 2001 MontaVista Software Inc. 158c2ecf20Sopenharmony_ci * Author: jsun@mvista.com or jsun@junsun.net 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci * Copyright 2002 MontaVista Software Inc. 188c2ecf20Sopenharmony_ci * Author: Michael Pruznick, michael_pruznick@mvista.com 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * Copyright (C) 2000-2001 Toshiba Corporation 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * Copyright (C) 2004 MontaVista Software Inc. 238c2ecf20Sopenharmony_ci * Author: Manish Lachwani, mlachwani@mvista.com 248c2ecf20Sopenharmony_ci * 258c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 268c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License as published by the 278c2ecf20Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your 288c2ecf20Sopenharmony_ci * option) any later version. 298c2ecf20Sopenharmony_ci * 308c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 318c2ecf20Sopenharmony_ci * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 328c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 338c2ecf20Sopenharmony_ci * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 348c2ecf20Sopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 358c2ecf20Sopenharmony_ci * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 368c2ecf20Sopenharmony_ci * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 378c2ecf20Sopenharmony_ci * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 388c2ecf20Sopenharmony_ci * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 398c2ecf20Sopenharmony_ci * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 408c2ecf20Sopenharmony_ci * 418c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along 428c2ecf20Sopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc., 438c2ecf20Sopenharmony_ci * 675 Mass Ave, Cambridge, MA 02139, USA. 448c2ecf20Sopenharmony_ci */ 458c2ecf20Sopenharmony_ci#include <linux/init.h> 468c2ecf20Sopenharmony_ci#include <linux/kernel.h> 478c2ecf20Sopenharmony_ci#include <linux/types.h> 488c2ecf20Sopenharmony_ci#include <linux/ioport.h> 498c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 508c2ecf20Sopenharmony_ci#include <linux/delay.h> 518c2ecf20Sopenharmony_ci#include <linux/gpio.h> 528c2ecf20Sopenharmony_ci#include <linux/leds.h> 538c2ecf20Sopenharmony_ci#include <asm/io.h> 548c2ecf20Sopenharmony_ci#include <asm/reboot.h> 558c2ecf20Sopenharmony_ci#include <asm/txx9pio.h> 568c2ecf20Sopenharmony_ci#include <asm/txx9/generic.h> 578c2ecf20Sopenharmony_ci#include <asm/txx9/pci.h> 588c2ecf20Sopenharmony_ci#include <asm/txx9/rbtx4927.h> 598c2ecf20Sopenharmony_ci#include <asm/txx9/tx4938.h> /* for TX4937 */ 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI 628c2ecf20Sopenharmony_cistatic void __init tx4927_pci_setup(void) 638c2ecf20Sopenharmony_ci{ 648c2ecf20Sopenharmony_ci int extarb = !(__raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCIARB); 658c2ecf20Sopenharmony_ci struct pci_controller *c = &txx9_primary_pcic; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci register_pci_controller(c); 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci if (__raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCI66) 708c2ecf20Sopenharmony_ci txx9_pci_option = 718c2ecf20Sopenharmony_ci (txx9_pci_option & ~TXX9_PCI_OPT_CLK_MASK) | 728c2ecf20Sopenharmony_ci TXX9_PCI_OPT_CLK_66; /* already configured */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci /* Reset PCI Bus */ 758c2ecf20Sopenharmony_ci writeb(1, rbtx4927_pcireset_addr); 768c2ecf20Sopenharmony_ci /* Reset PCIC */ 778c2ecf20Sopenharmony_ci txx9_set64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST); 788c2ecf20Sopenharmony_ci if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) == 798c2ecf20Sopenharmony_ci TXX9_PCI_OPT_CLK_66) 808c2ecf20Sopenharmony_ci tx4927_pciclk66_setup(); 818c2ecf20Sopenharmony_ci mdelay(10); 828c2ecf20Sopenharmony_ci /* clear PCIC reset */ 838c2ecf20Sopenharmony_ci txx9_clear64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST); 848c2ecf20Sopenharmony_ci writeb(0, rbtx4927_pcireset_addr); 858c2ecf20Sopenharmony_ci iob(); 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci tx4927_report_pciclk(); 888c2ecf20Sopenharmony_ci tx4927_pcic_setup(tx4927_pcicptr, c, extarb); 898c2ecf20Sopenharmony_ci if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) == 908c2ecf20Sopenharmony_ci TXX9_PCI_OPT_CLK_AUTO && 918c2ecf20Sopenharmony_ci txx9_pci66_check(c, 0, 0)) { 928c2ecf20Sopenharmony_ci /* Reset PCI Bus */ 938c2ecf20Sopenharmony_ci writeb(1, rbtx4927_pcireset_addr); 948c2ecf20Sopenharmony_ci /* Reset PCIC */ 958c2ecf20Sopenharmony_ci txx9_set64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST); 968c2ecf20Sopenharmony_ci tx4927_pciclk66_setup(); 978c2ecf20Sopenharmony_ci mdelay(10); 988c2ecf20Sopenharmony_ci /* clear PCIC reset */ 998c2ecf20Sopenharmony_ci txx9_clear64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST); 1008c2ecf20Sopenharmony_ci writeb(0, rbtx4927_pcireset_addr); 1018c2ecf20Sopenharmony_ci iob(); 1028c2ecf20Sopenharmony_ci /* Reinitialize PCIC */ 1038c2ecf20Sopenharmony_ci tx4927_report_pciclk(); 1048c2ecf20Sopenharmony_ci tx4927_pcic_setup(tx4927_pcicptr, c, extarb); 1058c2ecf20Sopenharmony_ci } 1068c2ecf20Sopenharmony_ci tx4927_setup_pcierr_irq(); 1078c2ecf20Sopenharmony_ci} 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_cistatic void __init tx4937_pci_setup(void) 1108c2ecf20Sopenharmony_ci{ 1118c2ecf20Sopenharmony_ci int extarb = !(__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCIARB); 1128c2ecf20Sopenharmony_ci struct pci_controller *c = &txx9_primary_pcic; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci register_pci_controller(c); 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci if (__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCI66) 1178c2ecf20Sopenharmony_ci txx9_pci_option = 1188c2ecf20Sopenharmony_ci (txx9_pci_option & ~TXX9_PCI_OPT_CLK_MASK) | 1198c2ecf20Sopenharmony_ci TXX9_PCI_OPT_CLK_66; /* already configured */ 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci /* Reset PCI Bus */ 1228c2ecf20Sopenharmony_ci writeb(1, rbtx4927_pcireset_addr); 1238c2ecf20Sopenharmony_ci /* Reset PCIC */ 1248c2ecf20Sopenharmony_ci txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); 1258c2ecf20Sopenharmony_ci if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) == 1268c2ecf20Sopenharmony_ci TXX9_PCI_OPT_CLK_66) 1278c2ecf20Sopenharmony_ci tx4938_pciclk66_setup(); 1288c2ecf20Sopenharmony_ci mdelay(10); 1298c2ecf20Sopenharmony_ci /* clear PCIC reset */ 1308c2ecf20Sopenharmony_ci txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); 1318c2ecf20Sopenharmony_ci writeb(0, rbtx4927_pcireset_addr); 1328c2ecf20Sopenharmony_ci iob(); 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci tx4938_report_pciclk(); 1358c2ecf20Sopenharmony_ci tx4927_pcic_setup(tx4938_pcicptr, c, extarb); 1368c2ecf20Sopenharmony_ci if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) == 1378c2ecf20Sopenharmony_ci TXX9_PCI_OPT_CLK_AUTO && 1388c2ecf20Sopenharmony_ci txx9_pci66_check(c, 0, 0)) { 1398c2ecf20Sopenharmony_ci /* Reset PCI Bus */ 1408c2ecf20Sopenharmony_ci writeb(1, rbtx4927_pcireset_addr); 1418c2ecf20Sopenharmony_ci /* Reset PCIC */ 1428c2ecf20Sopenharmony_ci txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); 1438c2ecf20Sopenharmony_ci tx4938_pciclk66_setup(); 1448c2ecf20Sopenharmony_ci mdelay(10); 1458c2ecf20Sopenharmony_ci /* clear PCIC reset */ 1468c2ecf20Sopenharmony_ci txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); 1478c2ecf20Sopenharmony_ci writeb(0, rbtx4927_pcireset_addr); 1488c2ecf20Sopenharmony_ci iob(); 1498c2ecf20Sopenharmony_ci /* Reinitialize PCIC */ 1508c2ecf20Sopenharmony_ci tx4938_report_pciclk(); 1518c2ecf20Sopenharmony_ci tx4927_pcic_setup(tx4938_pcicptr, c, extarb); 1528c2ecf20Sopenharmony_ci } 1538c2ecf20Sopenharmony_ci tx4938_setup_pcierr_irq(); 1548c2ecf20Sopenharmony_ci} 1558c2ecf20Sopenharmony_ci#else 1568c2ecf20Sopenharmony_cistatic inline void tx4927_pci_setup(void) {} 1578c2ecf20Sopenharmony_cistatic inline void tx4937_pci_setup(void) {} 1588c2ecf20Sopenharmony_ci#endif /* CONFIG_PCI */ 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_cistatic void __init rbtx4927_gpio_init(void) 1618c2ecf20Sopenharmony_ci{ 1628c2ecf20Sopenharmony_ci /* TX4927-SIO DTR on (PIO[15]) */ 1638c2ecf20Sopenharmony_ci gpio_request(15, "sio-dtr"); 1648c2ecf20Sopenharmony_ci gpio_direction_output(15, 1); 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci tx4927_sio_init(0, 0); 1678c2ecf20Sopenharmony_ci} 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_cistatic void __init rbtx4927_arch_init(void) 1708c2ecf20Sopenharmony_ci{ 1718c2ecf20Sopenharmony_ci txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, 0, TX4927_NUM_PIO); 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci rbtx4927_gpio_init(); 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci tx4927_pci_setup(); 1768c2ecf20Sopenharmony_ci} 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_cistatic void __init rbtx4937_arch_init(void) 1798c2ecf20Sopenharmony_ci{ 1808c2ecf20Sopenharmony_ci txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO); 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci rbtx4927_gpio_init(); 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci tx4937_pci_setup(); 1858c2ecf20Sopenharmony_ci} 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_cistatic void toshiba_rbtx4927_restart(char *command) 1888c2ecf20Sopenharmony_ci{ 1898c2ecf20Sopenharmony_ci /* enable the s/w reset register */ 1908c2ecf20Sopenharmony_ci writeb(1, rbtx4927_softresetlock_addr); 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci /* wait for enable to be seen */ 1938c2ecf20Sopenharmony_ci while (!(readb(rbtx4927_softresetlock_addr) & 1)) 1948c2ecf20Sopenharmony_ci ; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci /* do a s/w reset */ 1978c2ecf20Sopenharmony_ci writeb(1, rbtx4927_softreset_addr); 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci /* fallback */ 2008c2ecf20Sopenharmony_ci (*_machine_halt)(); 2018c2ecf20Sopenharmony_ci} 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_cistatic void __init rbtx4927_clock_init(void); 2048c2ecf20Sopenharmony_cistatic void __init rbtx4937_clock_init(void); 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_cistatic void __init rbtx4927_mem_setup(void) 2078c2ecf20Sopenharmony_ci{ 2088c2ecf20Sopenharmony_ci if (TX4927_REV_PCODE() == 0x4927) { 2098c2ecf20Sopenharmony_ci rbtx4927_clock_init(); 2108c2ecf20Sopenharmony_ci tx4927_setup(); 2118c2ecf20Sopenharmony_ci } else { 2128c2ecf20Sopenharmony_ci rbtx4937_clock_init(); 2138c2ecf20Sopenharmony_ci tx4938_setup(); 2148c2ecf20Sopenharmony_ci } 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci _machine_restart = toshiba_rbtx4927_restart; 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI 2198c2ecf20Sopenharmony_ci txx9_alloc_pci_controller(&txx9_primary_pcic, 2208c2ecf20Sopenharmony_ci RBTX4927_PCIMEM, RBTX4927_PCIMEM_SIZE, 2218c2ecf20Sopenharmony_ci RBTX4927_PCIIO, RBTX4927_PCIIO_SIZE); 2228c2ecf20Sopenharmony_ci txx9_board_pcibios_setup = tx4927_pcibios_setup; 2238c2ecf20Sopenharmony_ci#else 2248c2ecf20Sopenharmony_ci set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET); 2258c2ecf20Sopenharmony_ci#endif 2268c2ecf20Sopenharmony_ci} 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_cistatic void __init rbtx4927_clock_init(void) 2298c2ecf20Sopenharmony_ci{ 2308c2ecf20Sopenharmony_ci /* 2318c2ecf20Sopenharmony_ci * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. 2328c2ecf20Sopenharmony_ci * 2338c2ecf20Sopenharmony_ci * For TX4927: 2348c2ecf20Sopenharmony_ci * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1). 2358c2ecf20Sopenharmony_ci * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5) 2368c2ecf20Sopenharmony_ci * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3) 2378c2ecf20Sopenharmony_ci * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5) 2388c2ecf20Sopenharmony_ci * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6) 2398c2ecf20Sopenharmony_ci * i.e. S9[3]: ON (83MHz), OFF (100MHz) 2408c2ecf20Sopenharmony_ci */ 2418c2ecf20Sopenharmony_ci switch ((unsigned long)__raw_readq(&tx4927_ccfgptr->ccfg) & 2428c2ecf20Sopenharmony_ci TX4927_CCFG_PCIDIVMODE_MASK) { 2438c2ecf20Sopenharmony_ci case TX4927_CCFG_PCIDIVMODE_2_5: 2448c2ecf20Sopenharmony_ci case TX4927_CCFG_PCIDIVMODE_5: 2458c2ecf20Sopenharmony_ci txx9_cpu_clock = 166666666; /* 166MHz */ 2468c2ecf20Sopenharmony_ci break; 2478c2ecf20Sopenharmony_ci default: 2488c2ecf20Sopenharmony_ci txx9_cpu_clock = 200000000; /* 200MHz */ 2498c2ecf20Sopenharmony_ci } 2508c2ecf20Sopenharmony_ci} 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_cistatic void __init rbtx4937_clock_init(void) 2538c2ecf20Sopenharmony_ci{ 2548c2ecf20Sopenharmony_ci /* 2558c2ecf20Sopenharmony_ci * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. 2568c2ecf20Sopenharmony_ci * 2578c2ecf20Sopenharmony_ci * For TX4937: 2588c2ecf20Sopenharmony_ci * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1) 2598c2ecf20Sopenharmony_ci * PCIDIVMODE[10] is 0. 2608c2ecf20Sopenharmony_ci * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8) 2618c2ecf20Sopenharmony_ci * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4) 2628c2ecf20Sopenharmony_ci * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9) 2638c2ecf20Sopenharmony_ci * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5) 2648c2ecf20Sopenharmony_ci * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10) 2658c2ecf20Sopenharmony_ci * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5) 2668c2ecf20Sopenharmony_ci */ 2678c2ecf20Sopenharmony_ci switch ((unsigned long)__raw_readq(&tx4938_ccfgptr->ccfg) & 2688c2ecf20Sopenharmony_ci TX4938_CCFG_PCIDIVMODE_MASK) { 2698c2ecf20Sopenharmony_ci case TX4938_CCFG_PCIDIVMODE_8: 2708c2ecf20Sopenharmony_ci case TX4938_CCFG_PCIDIVMODE_4: 2718c2ecf20Sopenharmony_ci txx9_cpu_clock = 266666666; /* 266MHz */ 2728c2ecf20Sopenharmony_ci break; 2738c2ecf20Sopenharmony_ci case TX4938_CCFG_PCIDIVMODE_9: 2748c2ecf20Sopenharmony_ci case TX4938_CCFG_PCIDIVMODE_4_5: 2758c2ecf20Sopenharmony_ci txx9_cpu_clock = 300000000; /* 300MHz */ 2768c2ecf20Sopenharmony_ci break; 2778c2ecf20Sopenharmony_ci default: 2788c2ecf20Sopenharmony_ci txx9_cpu_clock = 333333333; /* 333MHz */ 2798c2ecf20Sopenharmony_ci } 2808c2ecf20Sopenharmony_ci} 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_cistatic void __init rbtx4927_time_init(void) 2838c2ecf20Sopenharmony_ci{ 2848c2ecf20Sopenharmony_ci tx4927_time_init(0); 2858c2ecf20Sopenharmony_ci} 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_cistatic void __init toshiba_rbtx4927_rtc_init(void) 2888c2ecf20Sopenharmony_ci{ 2898c2ecf20Sopenharmony_ci struct resource res = { 2908c2ecf20Sopenharmony_ci .start = RBTX4927_BRAMRTC_BASE - IO_BASE, 2918c2ecf20Sopenharmony_ci .end = RBTX4927_BRAMRTC_BASE - IO_BASE + 0x800 - 1, 2928c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2938c2ecf20Sopenharmony_ci }; 2948c2ecf20Sopenharmony_ci platform_device_register_simple("rtc-ds1742", -1, &res, 1); 2958c2ecf20Sopenharmony_ci} 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_cistatic void __init rbtx4927_ne_init(void) 2988c2ecf20Sopenharmony_ci{ 2998c2ecf20Sopenharmony_ci struct resource res[] = { 3008c2ecf20Sopenharmony_ci { 3018c2ecf20Sopenharmony_ci .start = RBTX4927_RTL_8019_BASE, 3028c2ecf20Sopenharmony_ci .end = RBTX4927_RTL_8019_BASE + 0x20 - 1, 3038c2ecf20Sopenharmony_ci .flags = IORESOURCE_IO, 3048c2ecf20Sopenharmony_ci }, { 3058c2ecf20Sopenharmony_ci .start = RBTX4927_RTL_8019_IRQ, 3068c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 3078c2ecf20Sopenharmony_ci } 3088c2ecf20Sopenharmony_ci }; 3098c2ecf20Sopenharmony_ci platform_device_register_simple("ne", -1, res, ARRAY_SIZE(res)); 3108c2ecf20Sopenharmony_ci} 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_cistatic void __init rbtx4927_mtd_init(void) 3138c2ecf20Sopenharmony_ci{ 3148c2ecf20Sopenharmony_ci int i; 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci for (i = 0; i < 2; i++) 3178c2ecf20Sopenharmony_ci tx4927_mtd_init(i); 3188c2ecf20Sopenharmony_ci} 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_cistatic void __init rbtx4927_gpioled_init(void) 3218c2ecf20Sopenharmony_ci{ 3228c2ecf20Sopenharmony_ci static const struct gpio_led leds[] = { 3238c2ecf20Sopenharmony_ci { .name = "gpioled:green:0", .gpio = 0, .active_low = 1, }, 3248c2ecf20Sopenharmony_ci { .name = "gpioled:green:1", .gpio = 1, .active_low = 1, }, 3258c2ecf20Sopenharmony_ci }; 3268c2ecf20Sopenharmony_ci static struct gpio_led_platform_data pdata = { 3278c2ecf20Sopenharmony_ci .num_leds = ARRAY_SIZE(leds), 3288c2ecf20Sopenharmony_ci .leds = leds, 3298c2ecf20Sopenharmony_ci }; 3308c2ecf20Sopenharmony_ci struct platform_device *pdev = platform_device_alloc("leds-gpio", 0); 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ci if (!pdev) 3338c2ecf20Sopenharmony_ci return; 3348c2ecf20Sopenharmony_ci pdev->dev.platform_data = &pdata; 3358c2ecf20Sopenharmony_ci if (platform_device_add(pdev)) 3368c2ecf20Sopenharmony_ci platform_device_put(pdev); 3378c2ecf20Sopenharmony_ci} 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_cistatic void __init rbtx4927_device_init(void) 3408c2ecf20Sopenharmony_ci{ 3418c2ecf20Sopenharmony_ci toshiba_rbtx4927_rtc_init(); 3428c2ecf20Sopenharmony_ci rbtx4927_ne_init(); 3438c2ecf20Sopenharmony_ci tx4927_wdt_init(); 3448c2ecf20Sopenharmony_ci rbtx4927_mtd_init(); 3458c2ecf20Sopenharmony_ci if (TX4927_REV_PCODE() == 0x4927) { 3468c2ecf20Sopenharmony_ci tx4927_dmac_init(2); 3478c2ecf20Sopenharmony_ci tx4927_aclc_init(0, 1); 3488c2ecf20Sopenharmony_ci } else { 3498c2ecf20Sopenharmony_ci tx4938_dmac_init(0, 2); 3508c2ecf20Sopenharmony_ci tx4938_aclc_init(); 3518c2ecf20Sopenharmony_ci } 3528c2ecf20Sopenharmony_ci platform_device_register_simple("txx9aclc-generic", -1, NULL, 0); 3538c2ecf20Sopenharmony_ci txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL); 3548c2ecf20Sopenharmony_ci rbtx4927_gpioled_init(); 3558c2ecf20Sopenharmony_ci} 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_cistruct txx9_board_vec rbtx4927_vec __initdata = { 3588c2ecf20Sopenharmony_ci .system = "Toshiba RBTX4927", 3598c2ecf20Sopenharmony_ci .prom_init = rbtx4927_prom_init, 3608c2ecf20Sopenharmony_ci .mem_setup = rbtx4927_mem_setup, 3618c2ecf20Sopenharmony_ci .irq_setup = rbtx4927_irq_setup, 3628c2ecf20Sopenharmony_ci .time_init = rbtx4927_time_init, 3638c2ecf20Sopenharmony_ci .device_init = rbtx4927_device_init, 3648c2ecf20Sopenharmony_ci .arch_init = rbtx4927_arch_init, 3658c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI 3668c2ecf20Sopenharmony_ci .pci_map_irq = rbtx4927_pci_map_irq, 3678c2ecf20Sopenharmony_ci#endif 3688c2ecf20Sopenharmony_ci}; 3698c2ecf20Sopenharmony_cistruct txx9_board_vec rbtx4937_vec __initdata = { 3708c2ecf20Sopenharmony_ci .system = "Toshiba RBTX4937", 3718c2ecf20Sopenharmony_ci .prom_init = rbtx4927_prom_init, 3728c2ecf20Sopenharmony_ci .mem_setup = rbtx4927_mem_setup, 3738c2ecf20Sopenharmony_ci .irq_setup = rbtx4927_irq_setup, 3748c2ecf20Sopenharmony_ci .time_init = rbtx4927_time_init, 3758c2ecf20Sopenharmony_ci .device_init = rbtx4927_device_init, 3768c2ecf20Sopenharmony_ci .arch_init = rbtx4937_arch_init, 3778c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI 3788c2ecf20Sopenharmony_ci .pci_map_irq = rbtx4927_pci_map_irq, 3798c2ecf20Sopenharmony_ci#endif 3808c2ecf20Sopenharmony_ci}; 381