18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * TX4927 setup routines 38c2ecf20Sopenharmony_ci * Based on linux/arch/mips/txx9/rbtx4938/setup.c, 48c2ecf20Sopenharmony_ci * and RBTX49xx patch from CELF patch archive. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * 2003-2005 (c) MontaVista Software, Inc. 78c2ecf20Sopenharmony_ci * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 108c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 118c2ecf20Sopenharmony_ci * for more details. 128c2ecf20Sopenharmony_ci */ 138c2ecf20Sopenharmony_ci#include <linux/init.h> 148c2ecf20Sopenharmony_ci#include <linux/ioport.h> 158c2ecf20Sopenharmony_ci#include <linux/delay.h> 168c2ecf20Sopenharmony_ci#include <linux/param.h> 178c2ecf20Sopenharmony_ci#include <linux/ptrace.h> 188c2ecf20Sopenharmony_ci#include <linux/mtd/physmap.h> 198c2ecf20Sopenharmony_ci#include <asm/reboot.h> 208c2ecf20Sopenharmony_ci#include <asm/traps.h> 218c2ecf20Sopenharmony_ci#include <asm/txx9irq.h> 228c2ecf20Sopenharmony_ci#include <asm/txx9tmr.h> 238c2ecf20Sopenharmony_ci#include <asm/txx9pio.h> 248c2ecf20Sopenharmony_ci#include <asm/txx9/generic.h> 258c2ecf20Sopenharmony_ci#include <asm/txx9/dmac.h> 268c2ecf20Sopenharmony_ci#include <asm/txx9/tx4927.h> 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistatic void __init tx4927_wdr_init(void) 298c2ecf20Sopenharmony_ci{ 308c2ecf20Sopenharmony_ci /* report watchdog reset status */ 318c2ecf20Sopenharmony_ci if (____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_WDRST) 328c2ecf20Sopenharmony_ci pr_warn("Watchdog reset detected at 0x%lx\n", 338c2ecf20Sopenharmony_ci read_c0_errorepc()); 348c2ecf20Sopenharmony_ci /* clear WatchDogReset (W1C) */ 358c2ecf20Sopenharmony_ci tx4927_ccfg_set(TX4927_CCFG_WDRST); 368c2ecf20Sopenharmony_ci /* do reset on watchdog */ 378c2ecf20Sopenharmony_ci tx4927_ccfg_set(TX4927_CCFG_WR); 388c2ecf20Sopenharmony_ci} 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_civoid __init tx4927_wdt_init(void) 418c2ecf20Sopenharmony_ci{ 428c2ecf20Sopenharmony_ci txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL); 438c2ecf20Sopenharmony_ci} 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistatic void tx4927_machine_restart(char *command) 468c2ecf20Sopenharmony_ci{ 478c2ecf20Sopenharmony_ci local_irq_disable(); 488c2ecf20Sopenharmony_ci pr_emerg("Rebooting (with %s watchdog reset)...\n", 498c2ecf20Sopenharmony_ci (____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_WDREXEN) ? 508c2ecf20Sopenharmony_ci "external" : "internal"); 518c2ecf20Sopenharmony_ci /* clear watchdog status */ 528c2ecf20Sopenharmony_ci tx4927_ccfg_set(TX4927_CCFG_WDRST); /* W1C */ 538c2ecf20Sopenharmony_ci txx9_wdt_now(TX4927_TMR_REG(2) & 0xfffffffffULL); 548c2ecf20Sopenharmony_ci while (!(____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_WDRST)) 558c2ecf20Sopenharmony_ci ; 568c2ecf20Sopenharmony_ci mdelay(10); 578c2ecf20Sopenharmony_ci if (____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_WDREXEN) { 588c2ecf20Sopenharmony_ci pr_emerg("Rebooting (with internal watchdog reset)...\n"); 598c2ecf20Sopenharmony_ci /* External WDRST failed. Do internal watchdog reset */ 608c2ecf20Sopenharmony_ci tx4927_ccfg_clear(TX4927_CCFG_WDREXEN); 618c2ecf20Sopenharmony_ci } 628c2ecf20Sopenharmony_ci /* fallback */ 638c2ecf20Sopenharmony_ci (*_machine_halt)(); 648c2ecf20Sopenharmony_ci} 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_civoid show_registers(struct pt_regs *regs); 678c2ecf20Sopenharmony_cistatic int tx4927_be_handler(struct pt_regs *regs, int is_fixup) 688c2ecf20Sopenharmony_ci{ 698c2ecf20Sopenharmony_ci int data = regs->cp0_cause & 4; 708c2ecf20Sopenharmony_ci console_verbose(); 718c2ecf20Sopenharmony_ci pr_err("%cBE exception at %#lx\n", data ? 'D' : 'I', regs->cp0_epc); 728c2ecf20Sopenharmony_ci pr_err("ccfg:%llx, toea:%llx\n", 738c2ecf20Sopenharmony_ci (unsigned long long)____raw_readq(&tx4927_ccfgptr->ccfg), 748c2ecf20Sopenharmony_ci (unsigned long long)____raw_readq(&tx4927_ccfgptr->toea)); 758c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI 768c2ecf20Sopenharmony_ci tx4927_report_pcic_status(); 778c2ecf20Sopenharmony_ci#endif 788c2ecf20Sopenharmony_ci show_registers(regs); 798c2ecf20Sopenharmony_ci panic("BusError!"); 808c2ecf20Sopenharmony_ci} 818c2ecf20Sopenharmony_cistatic void __init tx4927_be_init(void) 828c2ecf20Sopenharmony_ci{ 838c2ecf20Sopenharmony_ci board_be_handler = tx4927_be_handler; 848c2ecf20Sopenharmony_ci} 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_cistatic struct resource tx4927_sdram_resource[4]; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_civoid __init tx4927_setup(void) 898c2ecf20Sopenharmony_ci{ 908c2ecf20Sopenharmony_ci int i; 918c2ecf20Sopenharmony_ci __u32 divmode; 928c2ecf20Sopenharmony_ci unsigned int cpuclk = 0; 938c2ecf20Sopenharmony_ci u64 ccfg; 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci txx9_reg_res_init(TX4927_REV_PCODE(), TX4927_REG_BASE, 968c2ecf20Sopenharmony_ci TX4927_REG_SIZE); 978c2ecf20Sopenharmony_ci set_c0_config(TX49_CONF_CWFON); 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci /* SDRAMC,EBUSC are configured by PROM */ 1008c2ecf20Sopenharmony_ci for (i = 0; i < 8; i++) { 1018c2ecf20Sopenharmony_ci if (!(TX4927_EBUSC_CR(i) & 0x8)) 1028c2ecf20Sopenharmony_ci continue; /* disabled */ 1038c2ecf20Sopenharmony_ci txx9_ce_res[i].start = (unsigned long)TX4927_EBUSC_BA(i); 1048c2ecf20Sopenharmony_ci txx9_ce_res[i].end = 1058c2ecf20Sopenharmony_ci txx9_ce_res[i].start + TX4927_EBUSC_SIZE(i) - 1; 1068c2ecf20Sopenharmony_ci request_resource(&iomem_resource, &txx9_ce_res[i]); 1078c2ecf20Sopenharmony_ci } 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci /* clocks */ 1108c2ecf20Sopenharmony_ci ccfg = ____raw_readq(&tx4927_ccfgptr->ccfg); 1118c2ecf20Sopenharmony_ci if (txx9_master_clock) { 1128c2ecf20Sopenharmony_ci /* calculate gbus_clock and cpu_clock from master_clock */ 1138c2ecf20Sopenharmony_ci divmode = (__u32)ccfg & TX4927_CCFG_DIVMODE_MASK; 1148c2ecf20Sopenharmony_ci switch (divmode) { 1158c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_8: 1168c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_10: 1178c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_12: 1188c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_16: 1198c2ecf20Sopenharmony_ci txx9_gbus_clock = txx9_master_clock * 4; break; 1208c2ecf20Sopenharmony_ci default: 1218c2ecf20Sopenharmony_ci txx9_gbus_clock = txx9_master_clock; 1228c2ecf20Sopenharmony_ci } 1238c2ecf20Sopenharmony_ci switch (divmode) { 1248c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_2: 1258c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_8: 1268c2ecf20Sopenharmony_ci cpuclk = txx9_gbus_clock * 2; break; 1278c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_2_5: 1288c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_10: 1298c2ecf20Sopenharmony_ci cpuclk = txx9_gbus_clock * 5 / 2; break; 1308c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_3: 1318c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_12: 1328c2ecf20Sopenharmony_ci cpuclk = txx9_gbus_clock * 3; break; 1338c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_4: 1348c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_16: 1358c2ecf20Sopenharmony_ci cpuclk = txx9_gbus_clock * 4; break; 1368c2ecf20Sopenharmony_ci } 1378c2ecf20Sopenharmony_ci txx9_cpu_clock = cpuclk; 1388c2ecf20Sopenharmony_ci } else { 1398c2ecf20Sopenharmony_ci if (txx9_cpu_clock == 0) 1408c2ecf20Sopenharmony_ci txx9_cpu_clock = 200000000; /* 200MHz */ 1418c2ecf20Sopenharmony_ci /* calculate gbus_clock and master_clock from cpu_clock */ 1428c2ecf20Sopenharmony_ci cpuclk = txx9_cpu_clock; 1438c2ecf20Sopenharmony_ci divmode = (__u32)ccfg & TX4927_CCFG_DIVMODE_MASK; 1448c2ecf20Sopenharmony_ci switch (divmode) { 1458c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_2: 1468c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_8: 1478c2ecf20Sopenharmony_ci txx9_gbus_clock = cpuclk / 2; break; 1488c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_2_5: 1498c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_10: 1508c2ecf20Sopenharmony_ci txx9_gbus_clock = cpuclk * 2 / 5; break; 1518c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_3: 1528c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_12: 1538c2ecf20Sopenharmony_ci txx9_gbus_clock = cpuclk / 3; break; 1548c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_4: 1558c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_16: 1568c2ecf20Sopenharmony_ci txx9_gbus_clock = cpuclk / 4; break; 1578c2ecf20Sopenharmony_ci } 1588c2ecf20Sopenharmony_ci switch (divmode) { 1598c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_8: 1608c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_10: 1618c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_12: 1628c2ecf20Sopenharmony_ci case TX4927_CCFG_DIVMODE_16: 1638c2ecf20Sopenharmony_ci txx9_master_clock = txx9_gbus_clock / 4; break; 1648c2ecf20Sopenharmony_ci default: 1658c2ecf20Sopenharmony_ci txx9_master_clock = txx9_gbus_clock; 1668c2ecf20Sopenharmony_ci } 1678c2ecf20Sopenharmony_ci } 1688c2ecf20Sopenharmony_ci /* change default value to udelay/mdelay take reasonable time */ 1698c2ecf20Sopenharmony_ci loops_per_jiffy = txx9_cpu_clock / HZ / 2; 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci /* CCFG */ 1728c2ecf20Sopenharmony_ci tx4927_wdr_init(); 1738c2ecf20Sopenharmony_ci /* clear BusErrorOnWrite flag (W1C) */ 1748c2ecf20Sopenharmony_ci tx4927_ccfg_set(TX4927_CCFG_BEOW); 1758c2ecf20Sopenharmony_ci /* enable Timeout BusError */ 1768c2ecf20Sopenharmony_ci if (txx9_ccfg_toeon) 1778c2ecf20Sopenharmony_ci tx4927_ccfg_set(TX4927_CCFG_TOE); 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci /* DMA selection */ 1808c2ecf20Sopenharmony_ci txx9_clear64(&tx4927_ccfgptr->pcfg, TX4927_PCFG_DMASEL_ALL); 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci /* Use external clock for external arbiter */ 1838c2ecf20Sopenharmony_ci if (!(____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCIARB)) 1848c2ecf20Sopenharmony_ci txx9_clear64(&tx4927_ccfgptr->pcfg, TX4927_PCFG_PCICLKEN_ALL); 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci pr_info("%s -- %dMHz(M%dMHz) CRIR:%08x CCFG:%llx PCFG:%llx\n", 1878c2ecf20Sopenharmony_ci txx9_pcode_str, (cpuclk + 500000) / 1000000, 1888c2ecf20Sopenharmony_ci (txx9_master_clock + 500000) / 1000000, 1898c2ecf20Sopenharmony_ci (__u32)____raw_readq(&tx4927_ccfgptr->crir), 1908c2ecf20Sopenharmony_ci ____raw_readq(&tx4927_ccfgptr->ccfg), 1918c2ecf20Sopenharmony_ci ____raw_readq(&tx4927_ccfgptr->pcfg)); 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci pr_info("%s SDRAMC --", txx9_pcode_str); 1948c2ecf20Sopenharmony_ci for (i = 0; i < 4; i++) { 1958c2ecf20Sopenharmony_ci __u64 cr = TX4927_SDRAMC_CR(i); 1968c2ecf20Sopenharmony_ci unsigned long base, size; 1978c2ecf20Sopenharmony_ci if (!((__u32)cr & 0x00000400)) 1988c2ecf20Sopenharmony_ci continue; /* disabled */ 1998c2ecf20Sopenharmony_ci base = (unsigned long)(cr >> 49) << 21; 2008c2ecf20Sopenharmony_ci size = (((unsigned long)(cr >> 33) & 0x7fff) + 1) << 21; 2018c2ecf20Sopenharmony_ci pr_cont(" CR%d:%016llx", i, cr); 2028c2ecf20Sopenharmony_ci tx4927_sdram_resource[i].name = "SDRAM"; 2038c2ecf20Sopenharmony_ci tx4927_sdram_resource[i].start = base; 2048c2ecf20Sopenharmony_ci tx4927_sdram_resource[i].end = base + size - 1; 2058c2ecf20Sopenharmony_ci tx4927_sdram_resource[i].flags = IORESOURCE_MEM; 2068c2ecf20Sopenharmony_ci request_resource(&iomem_resource, &tx4927_sdram_resource[i]); 2078c2ecf20Sopenharmony_ci } 2088c2ecf20Sopenharmony_ci pr_cont(" TR:%09llx\n", ____raw_readq(&tx4927_sdramcptr->tr)); 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci /* TMR */ 2118c2ecf20Sopenharmony_ci /* disable all timers */ 2128c2ecf20Sopenharmony_ci for (i = 0; i < TX4927_NR_TMR; i++) 2138c2ecf20Sopenharmony_ci txx9_tmr_init(TX4927_TMR_REG(i) & 0xfffffffffULL); 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci /* PIO */ 2168c2ecf20Sopenharmony_ci __raw_writel(0, &tx4927_pioptr->maskcpu); 2178c2ecf20Sopenharmony_ci __raw_writel(0, &tx4927_pioptr->maskext); 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci _machine_restart = tx4927_machine_restart; 2208c2ecf20Sopenharmony_ci board_be_init = tx4927_be_init; 2218c2ecf20Sopenharmony_ci} 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_civoid __init tx4927_time_init(unsigned int tmrnr) 2248c2ecf20Sopenharmony_ci{ 2258c2ecf20Sopenharmony_ci if (____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_TINTDIS) 2268c2ecf20Sopenharmony_ci txx9_clockevent_init(TX4927_TMR_REG(tmrnr) & 0xfffffffffULL, 2278c2ecf20Sopenharmony_ci TXX9_IRQ_BASE + TX4927_IR_TMR(tmrnr), 2288c2ecf20Sopenharmony_ci TXX9_IMCLK); 2298c2ecf20Sopenharmony_ci} 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_civoid __init tx4927_sio_init(unsigned int sclk, unsigned int cts_mask) 2328c2ecf20Sopenharmony_ci{ 2338c2ecf20Sopenharmony_ci int i; 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci for (i = 0; i < 2; i++) 2368c2ecf20Sopenharmony_ci txx9_sio_init(TX4927_SIO_REG(i) & 0xfffffffffULL, 2378c2ecf20Sopenharmony_ci TXX9_IRQ_BASE + TX4927_IR_SIO(i), 2388c2ecf20Sopenharmony_ci i, sclk, (1 << i) & cts_mask); 2398c2ecf20Sopenharmony_ci} 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_civoid __init tx4927_mtd_init(int ch) 2428c2ecf20Sopenharmony_ci{ 2438c2ecf20Sopenharmony_ci struct physmap_flash_data pdata = { 2448c2ecf20Sopenharmony_ci .width = TX4927_EBUSC_WIDTH(ch) / 8, 2458c2ecf20Sopenharmony_ci }; 2468c2ecf20Sopenharmony_ci unsigned long start = txx9_ce_res[ch].start; 2478c2ecf20Sopenharmony_ci unsigned long size = txx9_ce_res[ch].end - start + 1; 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci if (!(TX4927_EBUSC_CR(ch) & 0x8)) 2508c2ecf20Sopenharmony_ci return; /* disabled */ 2518c2ecf20Sopenharmony_ci txx9_physmap_flash_init(ch, start, size, &pdata); 2528c2ecf20Sopenharmony_ci} 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_civoid __init tx4927_dmac_init(int memcpy_chan) 2558c2ecf20Sopenharmony_ci{ 2568c2ecf20Sopenharmony_ci struct txx9dmac_platform_data plat_data = { 2578c2ecf20Sopenharmony_ci .memcpy_chan = memcpy_chan, 2588c2ecf20Sopenharmony_ci .have_64bit_regs = true, 2598c2ecf20Sopenharmony_ci }; 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci txx9_dmac_init(0, TX4927_DMA_REG & 0xfffffffffULL, 2628c2ecf20Sopenharmony_ci TXX9_IRQ_BASE + TX4927_IR_DMA(0), &plat_data); 2638c2ecf20Sopenharmony_ci} 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_civoid __init tx4927_aclc_init(unsigned int dma_chan_out, 2668c2ecf20Sopenharmony_ci unsigned int dma_chan_in) 2678c2ecf20Sopenharmony_ci{ 2688c2ecf20Sopenharmony_ci u64 pcfg = __raw_readq(&tx4927_ccfgptr->pcfg); 2698c2ecf20Sopenharmony_ci __u64 dmasel_mask = 0, dmasel = 0; 2708c2ecf20Sopenharmony_ci unsigned long flags; 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci if (!(pcfg & TX4927_PCFG_SEL2)) 2738c2ecf20Sopenharmony_ci return; 2748c2ecf20Sopenharmony_ci /* setup DMASEL (playback:ACLC ch0, capture:ACLC ch1) */ 2758c2ecf20Sopenharmony_ci switch (dma_chan_out) { 2768c2ecf20Sopenharmony_ci case 0: 2778c2ecf20Sopenharmony_ci dmasel_mask |= TX4927_PCFG_DMASEL0_MASK; 2788c2ecf20Sopenharmony_ci dmasel |= TX4927_PCFG_DMASEL0_ACL0; 2798c2ecf20Sopenharmony_ci break; 2808c2ecf20Sopenharmony_ci case 2: 2818c2ecf20Sopenharmony_ci dmasel_mask |= TX4927_PCFG_DMASEL2_MASK; 2828c2ecf20Sopenharmony_ci dmasel |= TX4927_PCFG_DMASEL2_ACL0; 2838c2ecf20Sopenharmony_ci break; 2848c2ecf20Sopenharmony_ci default: 2858c2ecf20Sopenharmony_ci return; 2868c2ecf20Sopenharmony_ci } 2878c2ecf20Sopenharmony_ci switch (dma_chan_in) { 2888c2ecf20Sopenharmony_ci case 1: 2898c2ecf20Sopenharmony_ci dmasel_mask |= TX4927_PCFG_DMASEL1_MASK; 2908c2ecf20Sopenharmony_ci dmasel |= TX4927_PCFG_DMASEL1_ACL1; 2918c2ecf20Sopenharmony_ci break; 2928c2ecf20Sopenharmony_ci case 3: 2938c2ecf20Sopenharmony_ci dmasel_mask |= TX4927_PCFG_DMASEL3_MASK; 2948c2ecf20Sopenharmony_ci dmasel |= TX4927_PCFG_DMASEL3_ACL1; 2958c2ecf20Sopenharmony_ci break; 2968c2ecf20Sopenharmony_ci default: 2978c2ecf20Sopenharmony_ci return; 2988c2ecf20Sopenharmony_ci } 2998c2ecf20Sopenharmony_ci local_irq_save(flags); 3008c2ecf20Sopenharmony_ci txx9_clear64(&tx4927_ccfgptr->pcfg, dmasel_mask); 3018c2ecf20Sopenharmony_ci txx9_set64(&tx4927_ccfgptr->pcfg, dmasel); 3028c2ecf20Sopenharmony_ci local_irq_restore(flags); 3038c2ecf20Sopenharmony_ci txx9_aclc_init(TX4927_ACLC_REG & 0xfffffffffULL, 3048c2ecf20Sopenharmony_ci TXX9_IRQ_BASE + TX4927_IR_ACLC, 3058c2ecf20Sopenharmony_ci 0, dma_chan_out, dma_chan_in); 3068c2ecf20Sopenharmony_ci} 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_cistatic void __init tx4927_stop_unused_modules(void) 3098c2ecf20Sopenharmony_ci{ 3108c2ecf20Sopenharmony_ci __u64 pcfg, rst = 0, ckd = 0; 3118c2ecf20Sopenharmony_ci char buf[128]; 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci buf[0] = '\0'; 3148c2ecf20Sopenharmony_ci local_irq_disable(); 3158c2ecf20Sopenharmony_ci pcfg = ____raw_readq(&tx4927_ccfgptr->pcfg); 3168c2ecf20Sopenharmony_ci if (!(pcfg & TX4927_PCFG_SEL2)) { 3178c2ecf20Sopenharmony_ci rst |= TX4927_CLKCTR_ACLRST; 3188c2ecf20Sopenharmony_ci ckd |= TX4927_CLKCTR_ACLCKD; 3198c2ecf20Sopenharmony_ci strcat(buf, " ACLC"); 3208c2ecf20Sopenharmony_ci } 3218c2ecf20Sopenharmony_ci if (rst | ckd) { 3228c2ecf20Sopenharmony_ci txx9_set64(&tx4927_ccfgptr->clkctr, rst); 3238c2ecf20Sopenharmony_ci txx9_set64(&tx4927_ccfgptr->clkctr, ckd); 3248c2ecf20Sopenharmony_ci } 3258c2ecf20Sopenharmony_ci local_irq_enable(); 3268c2ecf20Sopenharmony_ci if (buf[0]) 3278c2ecf20Sopenharmony_ci pr_info("%s: stop%s\n", txx9_pcode_str, buf); 3288c2ecf20Sopenharmony_ci} 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_cistatic int __init tx4927_late_init(void) 3318c2ecf20Sopenharmony_ci{ 3328c2ecf20Sopenharmony_ci if (txx9_pcode != 0x4927) 3338c2ecf20Sopenharmony_ci return -ENODEV; 3348c2ecf20Sopenharmony_ci tx4927_stop_unused_modules(); 3358c2ecf20Sopenharmony_ci return 0; 3368c2ecf20Sopenharmony_ci} 3378c2ecf20Sopenharmony_cilate_initcall(tx4927_late_init); 338