194a4c329SAtsushi Nemoto /* 294a4c329SAtsushi Nemoto * TX4938/4937 setup routines 394a4c329SAtsushi Nemoto * Based on linux/arch/mips/txx9/rbtx4938/setup.c, 494a4c329SAtsushi Nemoto * and RBTX49xx patch from CELF patch archive. 594a4c329SAtsushi Nemoto * 694a4c329SAtsushi Nemoto * 2003-2005 (c) MontaVista Software, Inc. 794a4c329SAtsushi Nemoto * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007 894a4c329SAtsushi Nemoto * 994a4c329SAtsushi Nemoto * This file is subject to the terms and conditions of the GNU General Public 1094a4c329SAtsushi Nemoto * License. See the file "COPYING" in the main directory of this archive 1194a4c329SAtsushi Nemoto * for more details. 1294a4c329SAtsushi Nemoto */ 1394a4c329SAtsushi Nemoto #include <linux/init.h> 1494a4c329SAtsushi Nemoto #include <linux/ioport.h> 1594a4c329SAtsushi Nemoto #include <linux/delay.h> 1694a4c329SAtsushi Nemoto #include <linux/param.h> 1751f607c7SAtsushi Nemoto #include <linux/mtd/physmap.h> 18*496a3b5cSAtsushi Nemoto #include <asm/reboot.h> 1994a4c329SAtsushi Nemoto #include <asm/txx9irq.h> 2094a4c329SAtsushi Nemoto #include <asm/txx9tmr.h> 2194a4c329SAtsushi Nemoto #include <asm/txx9pio.h> 2294a4c329SAtsushi Nemoto #include <asm/txx9/generic.h> 2394a4c329SAtsushi Nemoto #include <asm/txx9/tx4938.h> 2494a4c329SAtsushi Nemoto 2568314725SAtsushi Nemoto static void __init tx4938_wdr_init(void) 2694a4c329SAtsushi Nemoto { 27*496a3b5cSAtsushi Nemoto /* report watchdog reset status */ 28*496a3b5cSAtsushi Nemoto if (____raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_WDRST) 29*496a3b5cSAtsushi Nemoto pr_warning("Watchdog reset detected at 0x%lx\n", 30*496a3b5cSAtsushi Nemoto read_c0_errorepc()); 3194a4c329SAtsushi Nemoto /* clear WatchDogReset (W1C) */ 3294a4c329SAtsushi Nemoto tx4938_ccfg_set(TX4938_CCFG_WDRST); 3394a4c329SAtsushi Nemoto /* do reset on watchdog */ 3494a4c329SAtsushi Nemoto tx4938_ccfg_set(TX4938_CCFG_WR); 3594a4c329SAtsushi Nemoto } 3694a4c329SAtsushi Nemoto 3768314725SAtsushi Nemoto void __init tx4938_wdt_init(void) 3868314725SAtsushi Nemoto { 3968314725SAtsushi Nemoto txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL); 4068314725SAtsushi Nemoto } 4168314725SAtsushi Nemoto 42*496a3b5cSAtsushi Nemoto static void tx4938_machine_restart(char *command) 43*496a3b5cSAtsushi Nemoto { 44*496a3b5cSAtsushi Nemoto local_irq_disable(); 45*496a3b5cSAtsushi Nemoto pr_emerg("Rebooting (with %s watchdog reset)...\n", 46*496a3b5cSAtsushi Nemoto (____raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_WDREXEN) ? 47*496a3b5cSAtsushi Nemoto "external" : "internal"); 48*496a3b5cSAtsushi Nemoto /* clear watchdog status */ 49*496a3b5cSAtsushi Nemoto tx4938_ccfg_set(TX4938_CCFG_WDRST); /* W1C */ 50*496a3b5cSAtsushi Nemoto txx9_wdt_now(TX4938_TMR_REG(2) & 0xfffffffffULL); 51*496a3b5cSAtsushi Nemoto while (!(____raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_WDRST)) 52*496a3b5cSAtsushi Nemoto ; 53*496a3b5cSAtsushi Nemoto mdelay(10); 54*496a3b5cSAtsushi Nemoto if (____raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_WDREXEN) { 55*496a3b5cSAtsushi Nemoto pr_emerg("Rebooting (with internal watchdog reset)...\n"); 56*496a3b5cSAtsushi Nemoto /* External WDRST failed. Do internal watchdog reset */ 57*496a3b5cSAtsushi Nemoto tx4938_ccfg_clear(TX4938_CCFG_WDREXEN); 58*496a3b5cSAtsushi Nemoto } 59*496a3b5cSAtsushi Nemoto /* fallback */ 60*496a3b5cSAtsushi Nemoto (*_machine_halt)(); 61*496a3b5cSAtsushi Nemoto } 62*496a3b5cSAtsushi Nemoto 6394a4c329SAtsushi Nemoto static struct resource tx4938_sdram_resource[4]; 6494a4c329SAtsushi Nemoto static struct resource tx4938_sram_resource; 6594a4c329SAtsushi Nemoto 6694a4c329SAtsushi Nemoto #define TX4938_SRAM_SIZE 0x800 6794a4c329SAtsushi Nemoto 6894a4c329SAtsushi Nemoto void __init tx4938_setup(void) 6994a4c329SAtsushi Nemoto { 7094a4c329SAtsushi Nemoto int i; 7194a4c329SAtsushi Nemoto __u32 divmode; 7294a4c329SAtsushi Nemoto int cpuclk = 0; 7394a4c329SAtsushi Nemoto u64 ccfg; 7494a4c329SAtsushi Nemoto 7594a4c329SAtsushi Nemoto txx9_reg_res_init(TX4938_REV_PCODE(), TX4938_REG_BASE, 7694a4c329SAtsushi Nemoto TX4938_REG_SIZE); 77d10e025fSAtsushi Nemoto set_c0_config(TX49_CONF_CWFON); 7894a4c329SAtsushi Nemoto 7994a4c329SAtsushi Nemoto /* SDRAMC,EBUSC are configured by PROM */ 8094a4c329SAtsushi Nemoto for (i = 0; i < 8; i++) { 8194a4c329SAtsushi Nemoto if (!(TX4938_EBUSC_CR(i) & 0x8)) 8294a4c329SAtsushi Nemoto continue; /* disabled */ 8394a4c329SAtsushi Nemoto txx9_ce_res[i].start = (unsigned long)TX4938_EBUSC_BA(i); 8494a4c329SAtsushi Nemoto txx9_ce_res[i].end = 8594a4c329SAtsushi Nemoto txx9_ce_res[i].start + TX4938_EBUSC_SIZE(i) - 1; 8694a4c329SAtsushi Nemoto request_resource(&iomem_resource, &txx9_ce_res[i]); 8794a4c329SAtsushi Nemoto } 8894a4c329SAtsushi Nemoto 8994a4c329SAtsushi Nemoto /* clocks */ 9094a4c329SAtsushi Nemoto ccfg = ____raw_readq(&tx4938_ccfgptr->ccfg); 9194a4c329SAtsushi Nemoto if (txx9_master_clock) { 9294a4c329SAtsushi Nemoto /* calculate gbus_clock and cpu_clock from master_clock */ 9394a4c329SAtsushi Nemoto divmode = (__u32)ccfg & TX4938_CCFG_DIVMODE_MASK; 9494a4c329SAtsushi Nemoto switch (divmode) { 9594a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_8: 9694a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_10: 9794a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_12: 9894a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_16: 9994a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_18: 10094a4c329SAtsushi Nemoto txx9_gbus_clock = txx9_master_clock * 4; break; 10194a4c329SAtsushi Nemoto default: 10294a4c329SAtsushi Nemoto txx9_gbus_clock = txx9_master_clock; 10394a4c329SAtsushi Nemoto } 10494a4c329SAtsushi Nemoto switch (divmode) { 10594a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_2: 10694a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_8: 10794a4c329SAtsushi Nemoto cpuclk = txx9_gbus_clock * 2; break; 10894a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_2_5: 10994a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_10: 11094a4c329SAtsushi Nemoto cpuclk = txx9_gbus_clock * 5 / 2; break; 11194a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_3: 11294a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_12: 11394a4c329SAtsushi Nemoto cpuclk = txx9_gbus_clock * 3; break; 11494a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_4: 11594a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_16: 11694a4c329SAtsushi Nemoto cpuclk = txx9_gbus_clock * 4; break; 11794a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_4_5: 11894a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_18: 11994a4c329SAtsushi Nemoto cpuclk = txx9_gbus_clock * 9 / 2; break; 12094a4c329SAtsushi Nemoto } 12194a4c329SAtsushi Nemoto txx9_cpu_clock = cpuclk; 12294a4c329SAtsushi Nemoto } else { 12394a4c329SAtsushi Nemoto if (txx9_cpu_clock == 0) 12494a4c329SAtsushi Nemoto txx9_cpu_clock = 300000000; /* 300MHz */ 12594a4c329SAtsushi Nemoto /* calculate gbus_clock and master_clock from cpu_clock */ 12694a4c329SAtsushi Nemoto cpuclk = txx9_cpu_clock; 12794a4c329SAtsushi Nemoto divmode = (__u32)ccfg & TX4938_CCFG_DIVMODE_MASK; 12894a4c329SAtsushi Nemoto switch (divmode) { 12994a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_2: 13094a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_8: 13194a4c329SAtsushi Nemoto txx9_gbus_clock = cpuclk / 2; break; 13294a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_2_5: 13394a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_10: 13494a4c329SAtsushi Nemoto txx9_gbus_clock = cpuclk * 2 / 5; break; 13594a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_3: 13694a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_12: 13794a4c329SAtsushi Nemoto txx9_gbus_clock = cpuclk / 3; break; 13894a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_4: 13994a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_16: 14094a4c329SAtsushi Nemoto txx9_gbus_clock = cpuclk / 4; break; 14194a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_4_5: 14294a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_18: 14394a4c329SAtsushi Nemoto txx9_gbus_clock = cpuclk * 2 / 9; break; 14494a4c329SAtsushi Nemoto } 14594a4c329SAtsushi Nemoto switch (divmode) { 14694a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_8: 14794a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_10: 14894a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_12: 14994a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_16: 15094a4c329SAtsushi Nemoto case TX4938_CCFG_DIVMODE_18: 15194a4c329SAtsushi Nemoto txx9_master_clock = txx9_gbus_clock / 4; break; 15294a4c329SAtsushi Nemoto default: 15394a4c329SAtsushi Nemoto txx9_master_clock = txx9_gbus_clock; 15494a4c329SAtsushi Nemoto } 15594a4c329SAtsushi Nemoto } 15694a4c329SAtsushi Nemoto /* change default value to udelay/mdelay take reasonable time */ 15794a4c329SAtsushi Nemoto loops_per_jiffy = txx9_cpu_clock / HZ / 2; 15894a4c329SAtsushi Nemoto 15994a4c329SAtsushi Nemoto /* CCFG */ 16094a4c329SAtsushi Nemoto tx4938_wdr_init(); 16194a4c329SAtsushi Nemoto /* clear BusErrorOnWrite flag (W1C) */ 16294a4c329SAtsushi Nemoto tx4938_ccfg_set(TX4938_CCFG_BEOW); 16394a4c329SAtsushi Nemoto /* enable Timeout BusError */ 16494a4c329SAtsushi Nemoto if (txx9_ccfg_toeon) 16594a4c329SAtsushi Nemoto tx4938_ccfg_set(TX4938_CCFG_TOE); 16694a4c329SAtsushi Nemoto 16794a4c329SAtsushi Nemoto /* DMA selection */ 16894a4c329SAtsushi Nemoto txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_DMASEL_ALL); 16994a4c329SAtsushi Nemoto 17094a4c329SAtsushi Nemoto /* Use external clock for external arbiter */ 17194a4c329SAtsushi Nemoto if (!(____raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCIARB)) 17294a4c329SAtsushi Nemoto txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_PCICLKEN_ALL); 17394a4c329SAtsushi Nemoto 17494a4c329SAtsushi Nemoto printk(KERN_INFO "%s -- %dMHz(M%dMHz) CRIR:%08x CCFG:%llx PCFG:%llx\n", 17594a4c329SAtsushi Nemoto txx9_pcode_str, 17694a4c329SAtsushi Nemoto (cpuclk + 500000) / 1000000, 17794a4c329SAtsushi Nemoto (txx9_master_clock + 500000) / 1000000, 17894a4c329SAtsushi Nemoto (__u32)____raw_readq(&tx4938_ccfgptr->crir), 17994a4c329SAtsushi Nemoto (unsigned long long)____raw_readq(&tx4938_ccfgptr->ccfg), 18094a4c329SAtsushi Nemoto (unsigned long long)____raw_readq(&tx4938_ccfgptr->pcfg)); 18194a4c329SAtsushi Nemoto 18294a4c329SAtsushi Nemoto printk(KERN_INFO "%s SDRAMC --", txx9_pcode_str); 18394a4c329SAtsushi Nemoto for (i = 0; i < 4; i++) { 18494a4c329SAtsushi Nemoto __u64 cr = TX4938_SDRAMC_CR(i); 18594a4c329SAtsushi Nemoto unsigned long base, size; 18694a4c329SAtsushi Nemoto if (!((__u32)cr & 0x00000400)) 18794a4c329SAtsushi Nemoto continue; /* disabled */ 18894a4c329SAtsushi Nemoto base = (unsigned long)(cr >> 49) << 21; 18994a4c329SAtsushi Nemoto size = (((unsigned long)(cr >> 33) & 0x7fff) + 1) << 21; 19094a4c329SAtsushi Nemoto printk(" CR%d:%016llx", i, (unsigned long long)cr); 19194a4c329SAtsushi Nemoto tx4938_sdram_resource[i].name = "SDRAM"; 19294a4c329SAtsushi Nemoto tx4938_sdram_resource[i].start = base; 19394a4c329SAtsushi Nemoto tx4938_sdram_resource[i].end = base + size - 1; 19494a4c329SAtsushi Nemoto tx4938_sdram_resource[i].flags = IORESOURCE_MEM; 19594a4c329SAtsushi Nemoto request_resource(&iomem_resource, &tx4938_sdram_resource[i]); 19694a4c329SAtsushi Nemoto } 19794a4c329SAtsushi Nemoto printk(" TR:%09llx\n", 19894a4c329SAtsushi Nemoto (unsigned long long)____raw_readq(&tx4938_sdramcptr->tr)); 19994a4c329SAtsushi Nemoto 20094a4c329SAtsushi Nemoto /* SRAM */ 20194a4c329SAtsushi Nemoto if (txx9_pcode == 0x4938 && ____raw_readq(&tx4938_sramcptr->cr) & 1) { 20294a4c329SAtsushi Nemoto unsigned int size = TX4938_SRAM_SIZE; 20394a4c329SAtsushi Nemoto tx4938_sram_resource.name = "SRAM"; 20494a4c329SAtsushi Nemoto tx4938_sram_resource.start = 20594a4c329SAtsushi Nemoto (____raw_readq(&tx4938_sramcptr->cr) >> (39-11)) 20694a4c329SAtsushi Nemoto & ~(size - 1); 20794a4c329SAtsushi Nemoto tx4938_sram_resource.end = 20894a4c329SAtsushi Nemoto tx4938_sram_resource.start + TX4938_SRAM_SIZE - 1; 20994a4c329SAtsushi Nemoto tx4938_sram_resource.flags = IORESOURCE_MEM; 21094a4c329SAtsushi Nemoto request_resource(&iomem_resource, &tx4938_sram_resource); 21194a4c329SAtsushi Nemoto } 21294a4c329SAtsushi Nemoto 21394a4c329SAtsushi Nemoto /* TMR */ 21494a4c329SAtsushi Nemoto /* disable all timers */ 21594a4c329SAtsushi Nemoto for (i = 0; i < TX4938_NR_TMR; i++) 21694a4c329SAtsushi Nemoto txx9_tmr_init(TX4938_TMR_REG(i) & 0xfffffffffULL); 21794a4c329SAtsushi Nemoto 21894a4c329SAtsushi Nemoto /* DMA */ 21994a4c329SAtsushi Nemoto for (i = 0; i < 2; i++) 22094a4c329SAtsushi Nemoto ____raw_writeq(TX4938_DMA_MCR_MSTEN, 22194a4c329SAtsushi Nemoto (void __iomem *)(TX4938_DMA_REG(i) + 0x50)); 22294a4c329SAtsushi Nemoto 22394a4c329SAtsushi Nemoto /* PIO */ 22494a4c329SAtsushi Nemoto txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO); 22594a4c329SAtsushi Nemoto __raw_writel(0, &tx4938_pioptr->maskcpu); 22694a4c329SAtsushi Nemoto __raw_writel(0, &tx4938_pioptr->maskext); 22794a4c329SAtsushi Nemoto 22894a4c329SAtsushi Nemoto if (txx9_pcode == 0x4938) { 22994a4c329SAtsushi Nemoto __u64 pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg); 23094a4c329SAtsushi Nemoto /* set PCIC1 reset */ 23194a4c329SAtsushi Nemoto txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIC1RST); 23294a4c329SAtsushi Nemoto if (pcfg & (TX4938_PCFG_ETH0_SEL | TX4938_PCFG_ETH1_SEL)) { 23394a4c329SAtsushi Nemoto mdelay(1); /* at least 128 cpu clock */ 23494a4c329SAtsushi Nemoto /* clear PCIC1 reset */ 23594a4c329SAtsushi Nemoto txx9_clear64(&tx4938_ccfgptr->clkctr, 23694a4c329SAtsushi Nemoto TX4938_CLKCTR_PCIC1RST); 23794a4c329SAtsushi Nemoto } else { 23894a4c329SAtsushi Nemoto printk(KERN_INFO "%s: stop PCIC1\n", txx9_pcode_str); 23994a4c329SAtsushi Nemoto /* stop PCIC1 */ 24094a4c329SAtsushi Nemoto txx9_set64(&tx4938_ccfgptr->clkctr, 24194a4c329SAtsushi Nemoto TX4938_CLKCTR_PCIC1CKD); 24294a4c329SAtsushi Nemoto } 24394a4c329SAtsushi Nemoto if (!(pcfg & TX4938_PCFG_ETH0_SEL)) { 24494a4c329SAtsushi Nemoto printk(KERN_INFO "%s: stop ETH0\n", txx9_pcode_str); 24594a4c329SAtsushi Nemoto txx9_set64(&tx4938_ccfgptr->clkctr, 24694a4c329SAtsushi Nemoto TX4938_CLKCTR_ETH0RST); 24794a4c329SAtsushi Nemoto txx9_set64(&tx4938_ccfgptr->clkctr, 24894a4c329SAtsushi Nemoto TX4938_CLKCTR_ETH0CKD); 24994a4c329SAtsushi Nemoto } 25094a4c329SAtsushi Nemoto if (!(pcfg & TX4938_PCFG_ETH1_SEL)) { 25194a4c329SAtsushi Nemoto printk(KERN_INFO "%s: stop ETH1\n", txx9_pcode_str); 25294a4c329SAtsushi Nemoto txx9_set64(&tx4938_ccfgptr->clkctr, 25394a4c329SAtsushi Nemoto TX4938_CLKCTR_ETH1RST); 25494a4c329SAtsushi Nemoto txx9_set64(&tx4938_ccfgptr->clkctr, 25594a4c329SAtsushi Nemoto TX4938_CLKCTR_ETH1CKD); 25694a4c329SAtsushi Nemoto } 25794a4c329SAtsushi Nemoto } 258*496a3b5cSAtsushi Nemoto 259*496a3b5cSAtsushi Nemoto _machine_restart = tx4938_machine_restart; 26094a4c329SAtsushi Nemoto } 26194a4c329SAtsushi Nemoto 26294a4c329SAtsushi Nemoto void __init tx4938_time_init(unsigned int tmrnr) 26394a4c329SAtsushi Nemoto { 26494a4c329SAtsushi Nemoto if (____raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_TINTDIS) 26594a4c329SAtsushi Nemoto txx9_clockevent_init(TX4938_TMR_REG(tmrnr) & 0xfffffffffULL, 26694a4c329SAtsushi Nemoto TXX9_IRQ_BASE + TX4938_IR_TMR(tmrnr), 26794a4c329SAtsushi Nemoto TXX9_IMCLK); 26894a4c329SAtsushi Nemoto } 26994a4c329SAtsushi Nemoto 2707779a5e0SAtsushi Nemoto void __init tx4938_sio_init(unsigned int sclk, unsigned int cts_mask) 27194a4c329SAtsushi Nemoto { 27294a4c329SAtsushi Nemoto int i; 27394a4c329SAtsushi Nemoto unsigned int ch_mask = 0; 27494a4c329SAtsushi Nemoto 27594a4c329SAtsushi Nemoto if (__raw_readq(&tx4938_ccfgptr->pcfg) & TX4938_PCFG_ETH0_SEL) 27694a4c329SAtsushi Nemoto ch_mask |= 1 << 1; /* disable SIO1 by PCFG setting */ 27794a4c329SAtsushi Nemoto for (i = 0; i < 2; i++) { 27894a4c329SAtsushi Nemoto if ((1 << i) & ch_mask) 27994a4c329SAtsushi Nemoto continue; 2807779a5e0SAtsushi Nemoto txx9_sio_init(TX4938_SIO_REG(i) & 0xfffffffffULL, 2817779a5e0SAtsushi Nemoto TXX9_IRQ_BASE + TX4938_IR_SIO(i), 2827779a5e0SAtsushi Nemoto i, sclk, (1 << i) & cts_mask); 28394a4c329SAtsushi Nemoto } 28494a4c329SAtsushi Nemoto } 285c49f91f5SAtsushi Nemoto 286c49f91f5SAtsushi Nemoto void __init tx4938_spi_init(int busid) 287c49f91f5SAtsushi Nemoto { 288c49f91f5SAtsushi Nemoto txx9_spi_init(busid, TX4938_SPI_REG & 0xfffffffffULL, 289c49f91f5SAtsushi Nemoto TXX9_IRQ_BASE + TX4938_IR_SPI); 290c49f91f5SAtsushi Nemoto } 291c49f91f5SAtsushi Nemoto 292c49f91f5SAtsushi Nemoto void __init tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1) 293c49f91f5SAtsushi Nemoto { 294c49f91f5SAtsushi Nemoto u64 pcfg = __raw_readq(&tx4938_ccfgptr->pcfg); 295c49f91f5SAtsushi Nemoto 296c49f91f5SAtsushi Nemoto if (addr0 && (pcfg & TX4938_PCFG_ETH0_SEL)) 297c49f91f5SAtsushi Nemoto txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH0, addr0); 298c49f91f5SAtsushi Nemoto if (addr1 && (pcfg & TX4938_PCFG_ETH1_SEL)) 299c49f91f5SAtsushi Nemoto txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH1, addr1); 300c49f91f5SAtsushi Nemoto } 30151f607c7SAtsushi Nemoto 30251f607c7SAtsushi Nemoto void __init tx4938_mtd_init(int ch) 30351f607c7SAtsushi Nemoto { 30451f607c7SAtsushi Nemoto struct physmap_flash_data pdata = { 30551f607c7SAtsushi Nemoto .width = TX4938_EBUSC_WIDTH(ch) / 8, 30651f607c7SAtsushi Nemoto }; 30751f607c7SAtsushi Nemoto unsigned long start = txx9_ce_res[ch].start; 30851f607c7SAtsushi Nemoto unsigned long size = txx9_ce_res[ch].end - start + 1; 30951f607c7SAtsushi Nemoto 31051f607c7SAtsushi Nemoto if (!(TX4938_EBUSC_CR(ch) & 0x8)) 31151f607c7SAtsushi Nemoto return; /* disabled */ 31251f607c7SAtsushi Nemoto txx9_physmap_flash_init(ch, start, size, &pdata); 31351f607c7SAtsushi Nemoto } 314