194a4c329SAtsushi Nemoto /* 294a4c329SAtsushi Nemoto * TX4927 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> 17ce8e7411SAtsushi Nemoto #include <linux/ptrace.h> 1851f607c7SAtsushi Nemoto #include <linux/mtd/physmap.h> 19496a3b5cSAtsushi Nemoto #include <asm/reboot.h> 20ce8e7411SAtsushi Nemoto #include <asm/traps.h> 2194a4c329SAtsushi Nemoto #include <asm/txx9irq.h> 2294a4c329SAtsushi Nemoto #include <asm/txx9tmr.h> 2394a4c329SAtsushi Nemoto #include <asm/txx9pio.h> 2494a4c329SAtsushi Nemoto #include <asm/txx9/generic.h> 25f48c8c95SAtsushi Nemoto #include <asm/txx9/dmac.h> 2694a4c329SAtsushi Nemoto #include <asm/txx9/tx4927.h> 2794a4c329SAtsushi Nemoto 2868314725SAtsushi Nemoto static void __init tx4927_wdr_init(void) 2994a4c329SAtsushi Nemoto { 30496a3b5cSAtsushi Nemoto /* report watchdog reset status */ 31496a3b5cSAtsushi Nemoto if (____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_WDRST) 327178d2cdSJoe Perches pr_warn("Watchdog reset detected at 0x%lx\n", 33496a3b5cSAtsushi Nemoto read_c0_errorepc()); 3494a4c329SAtsushi Nemoto /* clear WatchDogReset (W1C) */ 3594a4c329SAtsushi Nemoto tx4927_ccfg_set(TX4927_CCFG_WDRST); 3694a4c329SAtsushi Nemoto /* do reset on watchdog */ 3794a4c329SAtsushi Nemoto tx4927_ccfg_set(TX4927_CCFG_WR); 3894a4c329SAtsushi Nemoto } 3994a4c329SAtsushi Nemoto 4068314725SAtsushi Nemoto void __init tx4927_wdt_init(void) 4168314725SAtsushi Nemoto { 4268314725SAtsushi Nemoto txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL); 4368314725SAtsushi Nemoto } 4468314725SAtsushi Nemoto 45496a3b5cSAtsushi Nemoto static void tx4927_machine_restart(char *command) 46496a3b5cSAtsushi Nemoto { 47496a3b5cSAtsushi Nemoto local_irq_disable(); 48496a3b5cSAtsushi Nemoto pr_emerg("Rebooting (with %s watchdog reset)...\n", 49496a3b5cSAtsushi Nemoto (____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_WDREXEN) ? 50496a3b5cSAtsushi Nemoto "external" : "internal"); 51496a3b5cSAtsushi Nemoto /* clear watchdog status */ 52496a3b5cSAtsushi Nemoto tx4927_ccfg_set(TX4927_CCFG_WDRST); /* W1C */ 53496a3b5cSAtsushi Nemoto txx9_wdt_now(TX4927_TMR_REG(2) & 0xfffffffffULL); 54496a3b5cSAtsushi Nemoto while (!(____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_WDRST)) 55496a3b5cSAtsushi Nemoto ; 56496a3b5cSAtsushi Nemoto mdelay(10); 57496a3b5cSAtsushi Nemoto if (____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_WDREXEN) { 58496a3b5cSAtsushi Nemoto pr_emerg("Rebooting (with internal watchdog reset)...\n"); 59496a3b5cSAtsushi Nemoto /* External WDRST failed. Do internal watchdog reset */ 60496a3b5cSAtsushi Nemoto tx4927_ccfg_clear(TX4927_CCFG_WDREXEN); 61496a3b5cSAtsushi Nemoto } 62496a3b5cSAtsushi Nemoto /* fallback */ 63496a3b5cSAtsushi Nemoto (*_machine_halt)(); 64496a3b5cSAtsushi Nemoto } 65496a3b5cSAtsushi Nemoto 66ce8e7411SAtsushi Nemoto void show_registers(struct pt_regs *regs); 67ce8e7411SAtsushi Nemoto static int tx4927_be_handler(struct pt_regs *regs, int is_fixup) 68ce8e7411SAtsushi Nemoto { 69ce8e7411SAtsushi Nemoto int data = regs->cp0_cause & 4; 70ce8e7411SAtsushi Nemoto console_verbose(); 71ce8e7411SAtsushi Nemoto pr_err("%cBE exception at %#lx\n", data ? 'D' : 'I', regs->cp0_epc); 72ce8e7411SAtsushi Nemoto pr_err("ccfg:%llx, toea:%llx\n", 73ce8e7411SAtsushi Nemoto (unsigned long long)____raw_readq(&tx4927_ccfgptr->ccfg), 74ce8e7411SAtsushi Nemoto (unsigned long long)____raw_readq(&tx4927_ccfgptr->toea)); 75ce8e7411SAtsushi Nemoto #ifdef CONFIG_PCI 76ce8e7411SAtsushi Nemoto tx4927_report_pcic_status(); 77ce8e7411SAtsushi Nemoto #endif 78ce8e7411SAtsushi Nemoto show_registers(regs); 79ce8e7411SAtsushi Nemoto panic("BusError!"); 80ce8e7411SAtsushi Nemoto } 81ce8e7411SAtsushi Nemoto static void __init tx4927_be_init(void) 82ce8e7411SAtsushi Nemoto { 83ce8e7411SAtsushi Nemoto board_be_handler = tx4927_be_handler; 84ce8e7411SAtsushi Nemoto } 85ce8e7411SAtsushi Nemoto 8694a4c329SAtsushi Nemoto static struct resource tx4927_sdram_resource[4]; 8794a4c329SAtsushi Nemoto 8894a4c329SAtsushi Nemoto void __init tx4927_setup(void) 8994a4c329SAtsushi Nemoto { 9094a4c329SAtsushi Nemoto int i; 9194a4c329SAtsushi Nemoto __u32 divmode; 92740ebe4aSAtsushi Nemoto unsigned int cpuclk = 0; 9394a4c329SAtsushi Nemoto u64 ccfg; 9494a4c329SAtsushi Nemoto 9594a4c329SAtsushi Nemoto txx9_reg_res_init(TX4927_REV_PCODE(), TX4927_REG_BASE, 9694a4c329SAtsushi Nemoto TX4927_REG_SIZE); 97d10e025fSAtsushi Nemoto set_c0_config(TX49_CONF_CWFON); 9894a4c329SAtsushi Nemoto 9994a4c329SAtsushi Nemoto /* SDRAMC,EBUSC are configured by PROM */ 10094a4c329SAtsushi Nemoto for (i = 0; i < 8; i++) { 10194a4c329SAtsushi Nemoto if (!(TX4927_EBUSC_CR(i) & 0x8)) 10294a4c329SAtsushi Nemoto continue; /* disabled */ 10394a4c329SAtsushi Nemoto txx9_ce_res[i].start = (unsigned long)TX4927_EBUSC_BA(i); 10494a4c329SAtsushi Nemoto txx9_ce_res[i].end = 10594a4c329SAtsushi Nemoto txx9_ce_res[i].start + TX4927_EBUSC_SIZE(i) - 1; 10694a4c329SAtsushi Nemoto request_resource(&iomem_resource, &txx9_ce_res[i]); 10794a4c329SAtsushi Nemoto } 10894a4c329SAtsushi Nemoto 10994a4c329SAtsushi Nemoto /* clocks */ 11094a4c329SAtsushi Nemoto ccfg = ____raw_readq(&tx4927_ccfgptr->ccfg); 11194a4c329SAtsushi Nemoto if (txx9_master_clock) { 11294a4c329SAtsushi Nemoto /* calculate gbus_clock and cpu_clock from master_clock */ 11394a4c329SAtsushi Nemoto divmode = (__u32)ccfg & TX4927_CCFG_DIVMODE_MASK; 11494a4c329SAtsushi Nemoto switch (divmode) { 11594a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_8: 11694a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_10: 11794a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_12: 11894a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_16: 11994a4c329SAtsushi Nemoto txx9_gbus_clock = txx9_master_clock * 4; break; 12094a4c329SAtsushi Nemoto default: 12194a4c329SAtsushi Nemoto txx9_gbus_clock = txx9_master_clock; 12294a4c329SAtsushi Nemoto } 12394a4c329SAtsushi Nemoto switch (divmode) { 12494a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_2: 12594a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_8: 12694a4c329SAtsushi Nemoto cpuclk = txx9_gbus_clock * 2; break; 12794a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_2_5: 12894a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_10: 12994a4c329SAtsushi Nemoto cpuclk = txx9_gbus_clock * 5 / 2; break; 13094a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_3: 13194a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_12: 13294a4c329SAtsushi Nemoto cpuclk = txx9_gbus_clock * 3; break; 13394a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_4: 13494a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_16: 13594a4c329SAtsushi Nemoto cpuclk = txx9_gbus_clock * 4; break; 13694a4c329SAtsushi Nemoto } 13794a4c329SAtsushi Nemoto txx9_cpu_clock = cpuclk; 13894a4c329SAtsushi Nemoto } else { 13994a4c329SAtsushi Nemoto if (txx9_cpu_clock == 0) 14094a4c329SAtsushi Nemoto txx9_cpu_clock = 200000000; /* 200MHz */ 14194a4c329SAtsushi Nemoto /* calculate gbus_clock and master_clock from cpu_clock */ 14294a4c329SAtsushi Nemoto cpuclk = txx9_cpu_clock; 14394a4c329SAtsushi Nemoto divmode = (__u32)ccfg & TX4927_CCFG_DIVMODE_MASK; 14494a4c329SAtsushi Nemoto switch (divmode) { 14594a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_2: 14694a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_8: 14794a4c329SAtsushi Nemoto txx9_gbus_clock = cpuclk / 2; break; 14894a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_2_5: 14994a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_10: 15094a4c329SAtsushi Nemoto txx9_gbus_clock = cpuclk * 2 / 5; break; 15194a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_3: 15294a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_12: 15394a4c329SAtsushi Nemoto txx9_gbus_clock = cpuclk / 3; break; 15494a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_4: 15594a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_16: 15694a4c329SAtsushi Nemoto txx9_gbus_clock = cpuclk / 4; break; 15794a4c329SAtsushi Nemoto } 15894a4c329SAtsushi Nemoto switch (divmode) { 15994a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_8: 16094a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_10: 16194a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_12: 16294a4c329SAtsushi Nemoto case TX4927_CCFG_DIVMODE_16: 16394a4c329SAtsushi Nemoto txx9_master_clock = txx9_gbus_clock / 4; break; 16494a4c329SAtsushi Nemoto default: 16594a4c329SAtsushi Nemoto txx9_master_clock = txx9_gbus_clock; 16694a4c329SAtsushi Nemoto } 16794a4c329SAtsushi Nemoto } 16894a4c329SAtsushi Nemoto /* change default value to udelay/mdelay take reasonable time */ 16994a4c329SAtsushi Nemoto loops_per_jiffy = txx9_cpu_clock / HZ / 2; 17094a4c329SAtsushi Nemoto 17194a4c329SAtsushi Nemoto /* CCFG */ 17294a4c329SAtsushi Nemoto tx4927_wdr_init(); 17394a4c329SAtsushi Nemoto /* clear BusErrorOnWrite flag (W1C) */ 17494a4c329SAtsushi Nemoto tx4927_ccfg_set(TX4927_CCFG_BEOW); 17594a4c329SAtsushi Nemoto /* enable Timeout BusError */ 17694a4c329SAtsushi Nemoto if (txx9_ccfg_toeon) 17794a4c329SAtsushi Nemoto tx4927_ccfg_set(TX4927_CCFG_TOE); 17894a4c329SAtsushi Nemoto 17994a4c329SAtsushi Nemoto /* DMA selection */ 18094a4c329SAtsushi Nemoto txx9_clear64(&tx4927_ccfgptr->pcfg, TX4927_PCFG_DMASEL_ALL); 18194a4c329SAtsushi Nemoto 18294a4c329SAtsushi Nemoto /* Use external clock for external arbiter */ 18394a4c329SAtsushi Nemoto if (!(____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCIARB)) 18494a4c329SAtsushi Nemoto txx9_clear64(&tx4927_ccfgptr->pcfg, TX4927_PCFG_PCICLKEN_ALL); 18594a4c329SAtsushi Nemoto 186*2cec11d8SGeert Uytterhoeven pr_info("%s -- %dMHz(M%dMHz) CRIR:%08x CCFG:%llx PCFG:%llx\n", 187*2cec11d8SGeert Uytterhoeven txx9_pcode_str, (cpuclk + 500000) / 1000000, 18894a4c329SAtsushi Nemoto (txx9_master_clock + 500000) / 1000000, 18994a4c329SAtsushi Nemoto (__u32)____raw_readq(&tx4927_ccfgptr->crir), 190*2cec11d8SGeert Uytterhoeven ____raw_readq(&tx4927_ccfgptr->ccfg), 191*2cec11d8SGeert Uytterhoeven ____raw_readq(&tx4927_ccfgptr->pcfg)); 19294a4c329SAtsushi Nemoto 193*2cec11d8SGeert Uytterhoeven pr_info("%s SDRAMC --", txx9_pcode_str); 19494a4c329SAtsushi Nemoto for (i = 0; i < 4; i++) { 19594a4c329SAtsushi Nemoto __u64 cr = TX4927_SDRAMC_CR(i); 19694a4c329SAtsushi Nemoto unsigned long base, size; 19794a4c329SAtsushi Nemoto if (!((__u32)cr & 0x00000400)) 19894a4c329SAtsushi Nemoto continue; /* disabled */ 19994a4c329SAtsushi Nemoto base = (unsigned long)(cr >> 49) << 21; 20094a4c329SAtsushi Nemoto size = (((unsigned long)(cr >> 33) & 0x7fff) + 1) << 21; 201*2cec11d8SGeert Uytterhoeven pr_cont(" CR%d:%016llx", i, cr); 20294a4c329SAtsushi Nemoto tx4927_sdram_resource[i].name = "SDRAM"; 20394a4c329SAtsushi Nemoto tx4927_sdram_resource[i].start = base; 20494a4c329SAtsushi Nemoto tx4927_sdram_resource[i].end = base + size - 1; 20594a4c329SAtsushi Nemoto tx4927_sdram_resource[i].flags = IORESOURCE_MEM; 20694a4c329SAtsushi Nemoto request_resource(&iomem_resource, &tx4927_sdram_resource[i]); 20794a4c329SAtsushi Nemoto } 208*2cec11d8SGeert Uytterhoeven pr_cont(" TR:%09llx\n", ____raw_readq(&tx4927_sdramcptr->tr)); 20994a4c329SAtsushi Nemoto 21094a4c329SAtsushi Nemoto /* TMR */ 21194a4c329SAtsushi Nemoto /* disable all timers */ 21294a4c329SAtsushi Nemoto for (i = 0; i < TX4927_NR_TMR; i++) 21394a4c329SAtsushi Nemoto txx9_tmr_init(TX4927_TMR_REG(i) & 0xfffffffffULL); 21494a4c329SAtsushi Nemoto 21594a4c329SAtsushi Nemoto /* PIO */ 21694a4c329SAtsushi Nemoto __raw_writel(0, &tx4927_pioptr->maskcpu); 21794a4c329SAtsushi Nemoto __raw_writel(0, &tx4927_pioptr->maskext); 218496a3b5cSAtsushi Nemoto 219496a3b5cSAtsushi Nemoto _machine_restart = tx4927_machine_restart; 220ce8e7411SAtsushi Nemoto board_be_init = tx4927_be_init; 22194a4c329SAtsushi Nemoto } 22294a4c329SAtsushi Nemoto 22394a4c329SAtsushi Nemoto void __init tx4927_time_init(unsigned int tmrnr) 22494a4c329SAtsushi Nemoto { 22594a4c329SAtsushi Nemoto if (____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_TINTDIS) 22694a4c329SAtsushi Nemoto txx9_clockevent_init(TX4927_TMR_REG(tmrnr) & 0xfffffffffULL, 22794a4c329SAtsushi Nemoto TXX9_IRQ_BASE + TX4927_IR_TMR(tmrnr), 22894a4c329SAtsushi Nemoto TXX9_IMCLK); 22994a4c329SAtsushi Nemoto } 23094a4c329SAtsushi Nemoto 2317779a5e0SAtsushi Nemoto void __init tx4927_sio_init(unsigned int sclk, unsigned int cts_mask) 23294a4c329SAtsushi Nemoto { 23394a4c329SAtsushi Nemoto int i; 23494a4c329SAtsushi Nemoto 2357779a5e0SAtsushi Nemoto for (i = 0; i < 2; i++) 2367779a5e0SAtsushi Nemoto txx9_sio_init(TX4927_SIO_REG(i) & 0xfffffffffULL, 2377779a5e0SAtsushi Nemoto TXX9_IRQ_BASE + TX4927_IR_SIO(i), 2387779a5e0SAtsushi Nemoto i, sclk, (1 << i) & cts_mask); 23994a4c329SAtsushi Nemoto } 24051f607c7SAtsushi Nemoto 24151f607c7SAtsushi Nemoto void __init tx4927_mtd_init(int ch) 24251f607c7SAtsushi Nemoto { 24351f607c7SAtsushi Nemoto struct physmap_flash_data pdata = { 24451f607c7SAtsushi Nemoto .width = TX4927_EBUSC_WIDTH(ch) / 8, 24551f607c7SAtsushi Nemoto }; 24651f607c7SAtsushi Nemoto unsigned long start = txx9_ce_res[ch].start; 24751f607c7SAtsushi Nemoto unsigned long size = txx9_ce_res[ch].end - start + 1; 24851f607c7SAtsushi Nemoto 24951f607c7SAtsushi Nemoto if (!(TX4927_EBUSC_CR(ch) & 0x8)) 25051f607c7SAtsushi Nemoto return; /* disabled */ 25151f607c7SAtsushi Nemoto txx9_physmap_flash_init(ch, start, size, &pdata); 25251f607c7SAtsushi Nemoto } 253f6d9831bSAtsushi Nemoto 254f48c8c95SAtsushi Nemoto void __init tx4927_dmac_init(int memcpy_chan) 255f48c8c95SAtsushi Nemoto { 256f48c8c95SAtsushi Nemoto struct txx9dmac_platform_data plat_data = { 257f48c8c95SAtsushi Nemoto .memcpy_chan = memcpy_chan, 258f48c8c95SAtsushi Nemoto .have_64bit_regs = true, 259f48c8c95SAtsushi Nemoto }; 260f48c8c95SAtsushi Nemoto 261f48c8c95SAtsushi Nemoto txx9_dmac_init(0, TX4927_DMA_REG & 0xfffffffffULL, 262f48c8c95SAtsushi Nemoto TXX9_IRQ_BASE + TX4927_IR_DMA(0), &plat_data); 263f48c8c95SAtsushi Nemoto } 264f48c8c95SAtsushi Nemoto 265742cd586SAtsushi Nemoto void __init tx4927_aclc_init(unsigned int dma_chan_out, 266742cd586SAtsushi Nemoto unsigned int dma_chan_in) 267742cd586SAtsushi Nemoto { 268742cd586SAtsushi Nemoto u64 pcfg = __raw_readq(&tx4927_ccfgptr->pcfg); 269742cd586SAtsushi Nemoto __u64 dmasel_mask = 0, dmasel = 0; 270742cd586SAtsushi Nemoto unsigned long flags; 271742cd586SAtsushi Nemoto 272742cd586SAtsushi Nemoto if (!(pcfg & TX4927_PCFG_SEL2)) 273742cd586SAtsushi Nemoto return; 274742cd586SAtsushi Nemoto /* setup DMASEL (playback:ACLC ch0, capture:ACLC ch1) */ 275742cd586SAtsushi Nemoto switch (dma_chan_out) { 276742cd586SAtsushi Nemoto case 0: 277742cd586SAtsushi Nemoto dmasel_mask |= TX4927_PCFG_DMASEL0_MASK; 278742cd586SAtsushi Nemoto dmasel |= TX4927_PCFG_DMASEL0_ACL0; 279742cd586SAtsushi Nemoto break; 280742cd586SAtsushi Nemoto case 2: 281742cd586SAtsushi Nemoto dmasel_mask |= TX4927_PCFG_DMASEL2_MASK; 282742cd586SAtsushi Nemoto dmasel |= TX4927_PCFG_DMASEL2_ACL0; 283742cd586SAtsushi Nemoto break; 284742cd586SAtsushi Nemoto default: 285742cd586SAtsushi Nemoto return; 286742cd586SAtsushi Nemoto } 287742cd586SAtsushi Nemoto switch (dma_chan_in) { 288742cd586SAtsushi Nemoto case 1: 289742cd586SAtsushi Nemoto dmasel_mask |= TX4927_PCFG_DMASEL1_MASK; 290742cd586SAtsushi Nemoto dmasel |= TX4927_PCFG_DMASEL1_ACL1; 291742cd586SAtsushi Nemoto break; 292742cd586SAtsushi Nemoto case 3: 293742cd586SAtsushi Nemoto dmasel_mask |= TX4927_PCFG_DMASEL3_MASK; 294742cd586SAtsushi Nemoto dmasel |= TX4927_PCFG_DMASEL3_ACL1; 295742cd586SAtsushi Nemoto break; 296742cd586SAtsushi Nemoto default: 297742cd586SAtsushi Nemoto return; 298742cd586SAtsushi Nemoto } 299742cd586SAtsushi Nemoto local_irq_save(flags); 300742cd586SAtsushi Nemoto txx9_clear64(&tx4927_ccfgptr->pcfg, dmasel_mask); 301742cd586SAtsushi Nemoto txx9_set64(&tx4927_ccfgptr->pcfg, dmasel); 302742cd586SAtsushi Nemoto local_irq_restore(flags); 303742cd586SAtsushi Nemoto txx9_aclc_init(TX4927_ACLC_REG & 0xfffffffffULL, 304742cd586SAtsushi Nemoto TXX9_IRQ_BASE + TX4927_IR_ACLC, 305742cd586SAtsushi Nemoto 0, dma_chan_out, dma_chan_in); 306742cd586SAtsushi Nemoto } 307742cd586SAtsushi Nemoto 308f6d9831bSAtsushi Nemoto static void __init tx4927_stop_unused_modules(void) 309f6d9831bSAtsushi Nemoto { 310f6d9831bSAtsushi Nemoto __u64 pcfg, rst = 0, ckd = 0; 311f6d9831bSAtsushi Nemoto char buf[128]; 312f6d9831bSAtsushi Nemoto 313f6d9831bSAtsushi Nemoto buf[0] = '\0'; 314f6d9831bSAtsushi Nemoto local_irq_disable(); 315f6d9831bSAtsushi Nemoto pcfg = ____raw_readq(&tx4927_ccfgptr->pcfg); 316f6d9831bSAtsushi Nemoto if (!(pcfg & TX4927_PCFG_SEL2)) { 317f6d9831bSAtsushi Nemoto rst |= TX4927_CLKCTR_ACLRST; 318f6d9831bSAtsushi Nemoto ckd |= TX4927_CLKCTR_ACLCKD; 319f6d9831bSAtsushi Nemoto strcat(buf, " ACLC"); 320f6d9831bSAtsushi Nemoto } 321f6d9831bSAtsushi Nemoto if (rst | ckd) { 322f6d9831bSAtsushi Nemoto txx9_set64(&tx4927_ccfgptr->clkctr, rst); 323f6d9831bSAtsushi Nemoto txx9_set64(&tx4927_ccfgptr->clkctr, ckd); 324f6d9831bSAtsushi Nemoto } 325f6d9831bSAtsushi Nemoto local_irq_enable(); 326f6d9831bSAtsushi Nemoto if (buf[0]) 327f6d9831bSAtsushi Nemoto pr_info("%s: stop%s\n", txx9_pcode_str, buf); 328f6d9831bSAtsushi Nemoto } 329f6d9831bSAtsushi Nemoto 330f6d9831bSAtsushi Nemoto static int __init tx4927_late_init(void) 331f6d9831bSAtsushi Nemoto { 332f6d9831bSAtsushi Nemoto if (txx9_pcode != 0x4927) 333f6d9831bSAtsushi Nemoto return -ENODEV; 334f6d9831bSAtsushi Nemoto tx4927_stop_unused_modules(); 335f6d9831bSAtsushi Nemoto return 0; 336f6d9831bSAtsushi Nemoto } 337f6d9831bSAtsushi Nemoto late_initcall(tx4927_late_init); 338