18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * FSP-2 board specific routines 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Based on earlier code: 68c2ecf20Sopenharmony_ci * Matt Porter <mporter@kernel.crashing.org> 78c2ecf20Sopenharmony_ci * Copyright 2002-2005 MontaVista Software Inc. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> 108c2ecf20Sopenharmony_ci * Copyright (c) 2003-2005 Zultys Technologies 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * Rewritten and ported to the merged powerpc tree: 138c2ecf20Sopenharmony_ci * Copyright 2007 David Gibson <dwg@au1.ibm.com>, IBM Corporation. 148c2ecf20Sopenharmony_ci */ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <linux/init.h> 178c2ecf20Sopenharmony_ci#include <linux/of_platform.h> 188c2ecf20Sopenharmony_ci#include <linux/rtc.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include <asm/machdep.h> 218c2ecf20Sopenharmony_ci#include <asm/prom.h> 228c2ecf20Sopenharmony_ci#include <asm/udbg.h> 238c2ecf20Sopenharmony_ci#include <asm/time.h> 248c2ecf20Sopenharmony_ci#include <asm/uic.h> 258c2ecf20Sopenharmony_ci#include <asm/ppc4xx.h> 268c2ecf20Sopenharmony_ci#include <asm/dcr.h> 278c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 288c2ecf20Sopenharmony_ci#include <linux/of_irq.h> 298c2ecf20Sopenharmony_ci#include "fsp2.h" 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define FSP2_BUS_ERR "ibm,bus-error-irq" 328c2ecf20Sopenharmony_ci#define FSP2_CMU_ERR "ibm,cmu-error-irq" 338c2ecf20Sopenharmony_ci#define FSP2_CONF_ERR "ibm,conf-error-irq" 348c2ecf20Sopenharmony_ci#define FSP2_OPBD_ERR "ibm,opbd-error-irq" 358c2ecf20Sopenharmony_ci#define FSP2_MCUE "ibm,mc-ue-irq" 368c2ecf20Sopenharmony_ci#define FSP2_RST_WRN "ibm,reset-warning-irq" 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_cistatic __initdata struct of_device_id fsp2_of_bus[] = { 398c2ecf20Sopenharmony_ci { .compatible = "ibm,plb4", }, 408c2ecf20Sopenharmony_ci { .compatible = "ibm,plb6", }, 418c2ecf20Sopenharmony_ci { .compatible = "ibm,opb", }, 428c2ecf20Sopenharmony_ci {}, 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistatic void l2regs(void) 468c2ecf20Sopenharmony_ci{ 478c2ecf20Sopenharmony_ci pr_err("L2 Controller:\n"); 488c2ecf20Sopenharmony_ci pr_err("MCK: 0x%08x\n", mfl2(L2MCK)); 498c2ecf20Sopenharmony_ci pr_err("INT: 0x%08x\n", mfl2(L2INT)); 508c2ecf20Sopenharmony_ci pr_err("PLBSTAT0: 0x%08x\n", mfl2(L2PLBSTAT0)); 518c2ecf20Sopenharmony_ci pr_err("PLBSTAT1: 0x%08x\n", mfl2(L2PLBSTAT1)); 528c2ecf20Sopenharmony_ci pr_err("ARRSTAT0: 0x%08x\n", mfl2(L2ARRSTAT0)); 538c2ecf20Sopenharmony_ci pr_err("ARRSTAT1: 0x%08x\n", mfl2(L2ARRSTAT1)); 548c2ecf20Sopenharmony_ci pr_err("ARRSTAT2: 0x%08x\n", mfl2(L2ARRSTAT2)); 558c2ecf20Sopenharmony_ci pr_err("CPUSTAT: 0x%08x\n", mfl2(L2CPUSTAT)); 568c2ecf20Sopenharmony_ci pr_err("RACSTAT0: 0x%08x\n", mfl2(L2RACSTAT0)); 578c2ecf20Sopenharmony_ci pr_err("WACSTAT0: 0x%08x\n", mfl2(L2WACSTAT0)); 588c2ecf20Sopenharmony_ci pr_err("WACSTAT1: 0x%08x\n", mfl2(L2WACSTAT1)); 598c2ecf20Sopenharmony_ci pr_err("WACSTAT2: 0x%08x\n", mfl2(L2WACSTAT2)); 608c2ecf20Sopenharmony_ci pr_err("WDFSTAT: 0x%08x\n", mfl2(L2WDFSTAT)); 618c2ecf20Sopenharmony_ci pr_err("LOG0: 0x%08x\n", mfl2(L2LOG0)); 628c2ecf20Sopenharmony_ci pr_err("LOG1: 0x%08x\n", mfl2(L2LOG1)); 638c2ecf20Sopenharmony_ci pr_err("LOG2: 0x%08x\n", mfl2(L2LOG2)); 648c2ecf20Sopenharmony_ci pr_err("LOG3: 0x%08x\n", mfl2(L2LOG3)); 658c2ecf20Sopenharmony_ci pr_err("LOG4: 0x%08x\n", mfl2(L2LOG4)); 668c2ecf20Sopenharmony_ci pr_err("LOG5: 0x%08x\n", mfl2(L2LOG5)); 678c2ecf20Sopenharmony_ci} 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_cistatic void show_plbopb_regs(u32 base, int num) 708c2ecf20Sopenharmony_ci{ 718c2ecf20Sopenharmony_ci pr_err("\nPLBOPB Bridge %d:\n", num); 728c2ecf20Sopenharmony_ci pr_err("GESR0: 0x%08x\n", mfdcr(base + PLB4OPB_GESR0)); 738c2ecf20Sopenharmony_ci pr_err("GESR1: 0x%08x\n", mfdcr(base + PLB4OPB_GESR1)); 748c2ecf20Sopenharmony_ci pr_err("GESR2: 0x%08x\n", mfdcr(base + PLB4OPB_GESR2)); 758c2ecf20Sopenharmony_ci pr_err("GEARU: 0x%08x\n", mfdcr(base + PLB4OPB_GEARU)); 768c2ecf20Sopenharmony_ci pr_err("GEAR: 0x%08x\n", mfdcr(base + PLB4OPB_GEAR)); 778c2ecf20Sopenharmony_ci} 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_cistatic irqreturn_t bus_err_handler(int irq, void *data) 808c2ecf20Sopenharmony_ci{ 818c2ecf20Sopenharmony_ci pr_err("Bus Error\n"); 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci l2regs(); 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci pr_err("\nPLB6 Controller:\n"); 868c2ecf20Sopenharmony_ci pr_err("BC_SHD: 0x%08x\n", mfdcr(DCRN_PLB6_SHD)); 878c2ecf20Sopenharmony_ci pr_err("BC_ERR: 0x%08x\n", mfdcr(DCRN_PLB6_ERR)); 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci pr_err("\nPLB6-to-PLB4 Bridge:\n"); 908c2ecf20Sopenharmony_ci pr_err("ESR: 0x%08x\n", mfdcr(DCRN_PLB6PLB4_ESR)); 918c2ecf20Sopenharmony_ci pr_err("EARH: 0x%08x\n", mfdcr(DCRN_PLB6PLB4_EARH)); 928c2ecf20Sopenharmony_ci pr_err("EARL: 0x%08x\n", mfdcr(DCRN_PLB6PLB4_EARL)); 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci pr_err("\nPLB4-to-PLB6 Bridge:\n"); 958c2ecf20Sopenharmony_ci pr_err("ESR: 0x%08x\n", mfdcr(DCRN_PLB4PLB6_ESR)); 968c2ecf20Sopenharmony_ci pr_err("EARH: 0x%08x\n", mfdcr(DCRN_PLB4PLB6_EARH)); 978c2ecf20Sopenharmony_ci pr_err("EARL: 0x%08x\n", mfdcr(DCRN_PLB4PLB6_EARL)); 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci pr_err("\nPLB6-to-MCIF Bridge:\n"); 1008c2ecf20Sopenharmony_ci pr_err("BESR0: 0x%08x\n", mfdcr(DCRN_PLB6MCIF_BESR0)); 1018c2ecf20Sopenharmony_ci pr_err("BESR1: 0x%08x\n", mfdcr(DCRN_PLB6MCIF_BESR1)); 1028c2ecf20Sopenharmony_ci pr_err("BEARH: 0x%08x\n", mfdcr(DCRN_PLB6MCIF_BEARH)); 1038c2ecf20Sopenharmony_ci pr_err("BEARL: 0x%08x\n", mfdcr(DCRN_PLB6MCIF_BEARL)); 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci pr_err("\nPLB4 Arbiter:\n"); 1068c2ecf20Sopenharmony_ci pr_err("P0ESRH 0x%08x\n", mfdcr(DCRN_PLB4_P0ESRH)); 1078c2ecf20Sopenharmony_ci pr_err("P0ESRL 0x%08x\n", mfdcr(DCRN_PLB4_P0ESRL)); 1088c2ecf20Sopenharmony_ci pr_err("P0EARH 0x%08x\n", mfdcr(DCRN_PLB4_P0EARH)); 1098c2ecf20Sopenharmony_ci pr_err("P0EARH 0x%08x\n", mfdcr(DCRN_PLB4_P0EARH)); 1108c2ecf20Sopenharmony_ci pr_err("P1ESRH 0x%08x\n", mfdcr(DCRN_PLB4_P1ESRH)); 1118c2ecf20Sopenharmony_ci pr_err("P1ESRL 0x%08x\n", mfdcr(DCRN_PLB4_P1ESRL)); 1128c2ecf20Sopenharmony_ci pr_err("P1EARH 0x%08x\n", mfdcr(DCRN_PLB4_P1EARH)); 1138c2ecf20Sopenharmony_ci pr_err("P1EARH 0x%08x\n", mfdcr(DCRN_PLB4_P1EARH)); 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci show_plbopb_regs(DCRN_PLB4OPB0_BASE, 0); 1168c2ecf20Sopenharmony_ci show_plbopb_regs(DCRN_PLB4OPB1_BASE, 1); 1178c2ecf20Sopenharmony_ci show_plbopb_regs(DCRN_PLB4OPB2_BASE, 2); 1188c2ecf20Sopenharmony_ci show_plbopb_regs(DCRN_PLB4OPB3_BASE, 3); 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci pr_err("\nPLB4-to-AHB Bridge:\n"); 1218c2ecf20Sopenharmony_ci pr_err("ESR: 0x%08x\n", mfdcr(DCRN_PLB4AHB_ESR)); 1228c2ecf20Sopenharmony_ci pr_err("SEUAR: 0x%08x\n", mfdcr(DCRN_PLB4AHB_SEUAR)); 1238c2ecf20Sopenharmony_ci pr_err("SELAR: 0x%08x\n", mfdcr(DCRN_PLB4AHB_SELAR)); 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci pr_err("\nAHB-to-PLB4 Bridge:\n"); 1268c2ecf20Sopenharmony_ci pr_err("\nESR: 0x%08x\n", mfdcr(DCRN_AHBPLB4_ESR)); 1278c2ecf20Sopenharmony_ci pr_err("\nEAR: 0x%08x\n", mfdcr(DCRN_AHBPLB4_EAR)); 1288c2ecf20Sopenharmony_ci panic("Bus Error\n"); 1298c2ecf20Sopenharmony_ci} 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_cistatic irqreturn_t cmu_err_handler(int irq, void *data) { 1328c2ecf20Sopenharmony_ci pr_err("CMU Error\n"); 1338c2ecf20Sopenharmony_ci pr_err("FIR0: 0x%08x\n", mfcmu(CMUN_FIR0)); 1348c2ecf20Sopenharmony_ci panic("CMU Error\n"); 1358c2ecf20Sopenharmony_ci} 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_cistatic irqreturn_t conf_err_handler(int irq, void *data) { 1388c2ecf20Sopenharmony_ci pr_err("Configuration Logic Error\n"); 1398c2ecf20Sopenharmony_ci pr_err("CONF_FIR: 0x%08x\n", mfdcr(DCRN_CONF_FIR_RWC)); 1408c2ecf20Sopenharmony_ci pr_err("RPERR0: 0x%08x\n", mfdcr(DCRN_CONF_RPERR0)); 1418c2ecf20Sopenharmony_ci pr_err("RPERR1: 0x%08x\n", mfdcr(DCRN_CONF_RPERR1)); 1428c2ecf20Sopenharmony_ci panic("Configuration Logic Error\n"); 1438c2ecf20Sopenharmony_ci} 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_cistatic irqreturn_t opbd_err_handler(int irq, void *data) { 1468c2ecf20Sopenharmony_ci panic("OPBD Error\n"); 1478c2ecf20Sopenharmony_ci} 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_cistatic irqreturn_t mcue_handler(int irq, void *data) { 1508c2ecf20Sopenharmony_ci pr_err("DDR: Uncorrectable Error\n"); 1518c2ecf20Sopenharmony_ci pr_err("MCSTAT: 0x%08x\n", 1528c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_MCSTAT)); 1538c2ecf20Sopenharmony_ci pr_err("MCOPT1: 0x%08x\n", 1548c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_MCOPT1)); 1558c2ecf20Sopenharmony_ci pr_err("MCOPT2: 0x%08x\n", 1568c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_MCOPT2)); 1578c2ecf20Sopenharmony_ci pr_err("PHYSTAT: 0x%08x\n", 1588c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_PHYSTAT)); 1598c2ecf20Sopenharmony_ci pr_err("CFGR0: 0x%08x\n", 1608c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_CFGR0)); 1618c2ecf20Sopenharmony_ci pr_err("CFGR1: 0x%08x\n", 1628c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_CFGR1)); 1638c2ecf20Sopenharmony_ci pr_err("CFGR2: 0x%08x\n", 1648c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_CFGR2)); 1658c2ecf20Sopenharmony_ci pr_err("CFGR3: 0x%08x\n", 1668c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_CFGR3)); 1678c2ecf20Sopenharmony_ci pr_err("SCRUB_CNTL: 0x%08x\n", 1688c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_SCRUB_CNTL)); 1698c2ecf20Sopenharmony_ci pr_err("ECCERR_PORT0: 0x%08x\n", 1708c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_ECCERR_PORT0)); 1718c2ecf20Sopenharmony_ci pr_err("ECCERR_ADDR_PORT0: 0x%08x\n", 1728c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_ECCERR_ADDR_PORT0)); 1738c2ecf20Sopenharmony_ci pr_err("ECCERR_CNT_PORT0: 0x%08x\n", 1748c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_ECCERR_COUNT_PORT0)); 1758c2ecf20Sopenharmony_ci pr_err("ECC_CHECK_PORT0: 0x%08x\n", 1768c2ecf20Sopenharmony_ci mfdcr(DCRN_DDR34_BASE + DCRN_DDR34_ECC_CHECK_PORT0)); 1778c2ecf20Sopenharmony_ci pr_err("MCER0: 0x%08x\n", 1788c2ecf20Sopenharmony_ci mfdcr(DCRN_CW_BASE + DCRN_CW_MCER0)); 1798c2ecf20Sopenharmony_ci pr_err("MCER1: 0x%08x\n", 1808c2ecf20Sopenharmony_ci mfdcr(DCRN_CW_BASE + DCRN_CW_MCER1)); 1818c2ecf20Sopenharmony_ci pr_err("BESR: 0x%08x\n", 1828c2ecf20Sopenharmony_ci mfdcr(DCRN_PLB6MCIF_BESR0)); 1838c2ecf20Sopenharmony_ci pr_err("BEARL: 0x%08x\n", 1848c2ecf20Sopenharmony_ci mfdcr(DCRN_PLB6MCIF_BEARL)); 1858c2ecf20Sopenharmony_ci pr_err("BEARH: 0x%08x\n", 1868c2ecf20Sopenharmony_ci mfdcr(DCRN_PLB6MCIF_BEARH)); 1878c2ecf20Sopenharmony_ci panic("DDR: Uncorrectable Error\n"); 1888c2ecf20Sopenharmony_ci} 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_cistatic irqreturn_t rst_wrn_handler(int irq, void *data) { 1918c2ecf20Sopenharmony_ci u32 crcs = mfcmu(CMUN_CRCS); 1928c2ecf20Sopenharmony_ci switch (crcs & CRCS_STAT_MASK) { 1938c2ecf20Sopenharmony_ci case CRCS_STAT_CHIP_RST_B: 1948c2ecf20Sopenharmony_ci panic("Received chassis-initiated reset request"); 1958c2ecf20Sopenharmony_ci default: 1968c2ecf20Sopenharmony_ci panic("Unknown external reset: CRCS=0x%x", crcs); 1978c2ecf20Sopenharmony_ci } 1988c2ecf20Sopenharmony_ci} 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_cistatic void node_irq_request(const char *compat, irq_handler_t errirq_handler) 2018c2ecf20Sopenharmony_ci{ 2028c2ecf20Sopenharmony_ci struct device_node *np; 2038c2ecf20Sopenharmony_ci unsigned int irq; 2048c2ecf20Sopenharmony_ci int32_t rc; 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci for_each_compatible_node(np, NULL, compat) { 2078c2ecf20Sopenharmony_ci irq = irq_of_parse_and_map(np, 0); 2088c2ecf20Sopenharmony_ci if (irq == NO_IRQ) { 2098c2ecf20Sopenharmony_ci pr_err("device tree node %pOFn is missing a interrupt", 2108c2ecf20Sopenharmony_ci np); 2118c2ecf20Sopenharmony_ci of_node_put(np); 2128c2ecf20Sopenharmony_ci return; 2138c2ecf20Sopenharmony_ci } 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci rc = request_irq(irq, errirq_handler, 0, np->name, np); 2168c2ecf20Sopenharmony_ci if (rc) { 2178c2ecf20Sopenharmony_ci pr_err("fsp_of_probe: request_irq failed: np=%pOF rc=%d", 2188c2ecf20Sopenharmony_ci np, rc); 2198c2ecf20Sopenharmony_ci of_node_put(np); 2208c2ecf20Sopenharmony_ci return; 2218c2ecf20Sopenharmony_ci } 2228c2ecf20Sopenharmony_ci } 2238c2ecf20Sopenharmony_ci} 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_cistatic void critical_irq_setup(void) 2268c2ecf20Sopenharmony_ci{ 2278c2ecf20Sopenharmony_ci node_irq_request(FSP2_CMU_ERR, cmu_err_handler); 2288c2ecf20Sopenharmony_ci node_irq_request(FSP2_BUS_ERR, bus_err_handler); 2298c2ecf20Sopenharmony_ci node_irq_request(FSP2_CONF_ERR, conf_err_handler); 2308c2ecf20Sopenharmony_ci node_irq_request(FSP2_OPBD_ERR, opbd_err_handler); 2318c2ecf20Sopenharmony_ci node_irq_request(FSP2_MCUE, mcue_handler); 2328c2ecf20Sopenharmony_ci node_irq_request(FSP2_RST_WRN, rst_wrn_handler); 2338c2ecf20Sopenharmony_ci} 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_cistatic int __init fsp2_device_probe(void) 2368c2ecf20Sopenharmony_ci{ 2378c2ecf20Sopenharmony_ci of_platform_bus_probe(NULL, fsp2_of_bus, NULL); 2388c2ecf20Sopenharmony_ci return 0; 2398c2ecf20Sopenharmony_ci} 2408c2ecf20Sopenharmony_cimachine_device_initcall(fsp2, fsp2_device_probe); 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_cistatic int __init fsp2_probe(void) 2438c2ecf20Sopenharmony_ci{ 2448c2ecf20Sopenharmony_ci u32 val; 2458c2ecf20Sopenharmony_ci unsigned long root = of_get_flat_dt_root(); 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci if (!of_flat_dt_is_compatible(root, "ibm,fsp2")) 2488c2ecf20Sopenharmony_ci return 0; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci /* Clear BC_ERR and mask snoopable request plb errors. */ 2518c2ecf20Sopenharmony_ci val = mfdcr(DCRN_PLB6_CR0); 2528c2ecf20Sopenharmony_ci val |= 0x20000000; 2538c2ecf20Sopenharmony_ci mtdcr(DCRN_PLB6_BASE, val); 2548c2ecf20Sopenharmony_ci mtdcr(DCRN_PLB6_HD, 0xffff0000); 2558c2ecf20Sopenharmony_ci mtdcr(DCRN_PLB6_SHD, 0xffff0000); 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci /* TVSENSE reset is blocked (clock gated) by the POR default of the TVS 2588c2ecf20Sopenharmony_ci * sleep config bit. As a consequence, TVSENSE will provide erratic 2598c2ecf20Sopenharmony_ci * sensor values, which may result in spurious (parity) errors 2608c2ecf20Sopenharmony_ci * recorded in the CMU FIR and leading to erroneous interrupt requests 2618c2ecf20Sopenharmony_ci * once the CMU interrupt is unmasked. 2628c2ecf20Sopenharmony_ci */ 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci /* 1. set TVS1[UNDOZE] */ 2658c2ecf20Sopenharmony_ci val = mfcmu(CMUN_TVS1); 2668c2ecf20Sopenharmony_ci val |= 0x4; 2678c2ecf20Sopenharmony_ci mtcmu(CMUN_TVS1, val); 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ci /* 2. clear FIR[TVS] and FIR[TVSPAR] */ 2708c2ecf20Sopenharmony_ci val = mfcmu(CMUN_FIR0); 2718c2ecf20Sopenharmony_ci val |= 0x30000000; 2728c2ecf20Sopenharmony_ci mtcmu(CMUN_FIR0, val); 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci /* L2 machine checks */ 2758c2ecf20Sopenharmony_ci mtl2(L2PLBMCKEN0, 0xffffffff); 2768c2ecf20Sopenharmony_ci mtl2(L2PLBMCKEN1, 0x0000ffff); 2778c2ecf20Sopenharmony_ci mtl2(L2ARRMCKEN0, 0xffffffff); 2788c2ecf20Sopenharmony_ci mtl2(L2ARRMCKEN1, 0xffffffff); 2798c2ecf20Sopenharmony_ci mtl2(L2ARRMCKEN2, 0xfffff000); 2808c2ecf20Sopenharmony_ci mtl2(L2CPUMCKEN, 0xffffffff); 2818c2ecf20Sopenharmony_ci mtl2(L2RACMCKEN0, 0xffffffff); 2828c2ecf20Sopenharmony_ci mtl2(L2WACMCKEN0, 0xffffffff); 2838c2ecf20Sopenharmony_ci mtl2(L2WACMCKEN1, 0xffffffff); 2848c2ecf20Sopenharmony_ci mtl2(L2WACMCKEN2, 0xffffffff); 2858c2ecf20Sopenharmony_ci mtl2(L2WDFMCKEN, 0xffffffff); 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci /* L2 interrupts */ 2888c2ecf20Sopenharmony_ci mtl2(L2PLBINTEN1, 0xffff0000); 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci /* 2918c2ecf20Sopenharmony_ci * At a global level, enable all L2 machine checks and interrupts 2928c2ecf20Sopenharmony_ci * reported by the L2 subsystems, except for the external machine check 2938c2ecf20Sopenharmony_ci * input (UIC0.1). 2948c2ecf20Sopenharmony_ci */ 2958c2ecf20Sopenharmony_ci mtl2(L2MCKEN, 0x000007ff); 2968c2ecf20Sopenharmony_ci mtl2(L2INTEN, 0x000004ff); 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci /* Enable FSP-2 configuration logic parity errors */ 2998c2ecf20Sopenharmony_ci mtdcr(DCRN_CONF_EIR_RS, 0x80000000); 3008c2ecf20Sopenharmony_ci return 1; 3018c2ecf20Sopenharmony_ci} 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_cistatic void __init fsp2_irq_init(void) 3048c2ecf20Sopenharmony_ci{ 3058c2ecf20Sopenharmony_ci uic_init_tree(); 3068c2ecf20Sopenharmony_ci critical_irq_setup(); 3078c2ecf20Sopenharmony_ci} 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_cidefine_machine(fsp2) { 3108c2ecf20Sopenharmony_ci .name = "FSP-2", 3118c2ecf20Sopenharmony_ci .probe = fsp2_probe, 3128c2ecf20Sopenharmony_ci .progress = udbg_progress, 3138c2ecf20Sopenharmony_ci .init_IRQ = fsp2_irq_init, 3148c2ecf20Sopenharmony_ci .get_irq = uic_get_irq, 3158c2ecf20Sopenharmony_ci .restart = ppc4xx_reset_system, 3168c2ecf20Sopenharmony_ci .calibrate_decr = generic_calibrate_decr, 3178c2ecf20Sopenharmony_ci}; 318