18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights 38c2ecf20Sopenharmony_ci * reserved. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two 68c2ecf20Sopenharmony_ci * licenses. You may choose to be licensed under the terms of the GNU 78c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file 88c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the NetLogic 98c2ecf20Sopenharmony_ci * license below: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 128c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 138c2ecf20Sopenharmony_ci * are met: 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright 168c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 178c2ecf20Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright 188c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer in 198c2ecf20Sopenharmony_ci * the documentation and/or other materials provided with the 208c2ecf20Sopenharmony_ci * distribution. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR 238c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 248c2ecf20Sopenharmony_ci * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 258c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE 268c2ecf20Sopenharmony_ci * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 278c2ecf20Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 288c2ecf20Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 298c2ecf20Sopenharmony_ci * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 308c2ecf20Sopenharmony_ci * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 318c2ecf20Sopenharmony_ci * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 328c2ecf20Sopenharmony_ci * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 338c2ecf20Sopenharmony_ci */ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#ifndef _NLM_HAL_XLP_H 368c2ecf20Sopenharmony_ci#define _NLM_HAL_XLP_H 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define PIC_UART_0_IRQ 17 398c2ecf20Sopenharmony_ci#define PIC_UART_1_IRQ 18 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define PIC_PCIE_LINK_LEGACY_IRQ_BASE 19 428c2ecf20Sopenharmony_ci#define PIC_PCIE_LINK_LEGACY_IRQ(i) (19 + (i)) 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define PIC_EHCI_0_IRQ 23 458c2ecf20Sopenharmony_ci#define PIC_EHCI_1_IRQ 24 468c2ecf20Sopenharmony_ci#define PIC_OHCI_0_IRQ 25 478c2ecf20Sopenharmony_ci#define PIC_OHCI_1_IRQ 26 488c2ecf20Sopenharmony_ci#define PIC_OHCI_2_IRQ 27 498c2ecf20Sopenharmony_ci#define PIC_OHCI_3_IRQ 28 508c2ecf20Sopenharmony_ci#define PIC_2XX_XHCI_0_IRQ 23 518c2ecf20Sopenharmony_ci#define PIC_2XX_XHCI_1_IRQ 24 528c2ecf20Sopenharmony_ci#define PIC_2XX_XHCI_2_IRQ 25 538c2ecf20Sopenharmony_ci#define PIC_9XX_XHCI_0_IRQ 23 548c2ecf20Sopenharmony_ci#define PIC_9XX_XHCI_1_IRQ 24 558c2ecf20Sopenharmony_ci#define PIC_9XX_XHCI_2_IRQ 25 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define PIC_MMC_IRQ 29 588c2ecf20Sopenharmony_ci#define PIC_I2C_0_IRQ 30 598c2ecf20Sopenharmony_ci#define PIC_I2C_1_IRQ 31 608c2ecf20Sopenharmony_ci#define PIC_I2C_2_IRQ 32 618c2ecf20Sopenharmony_ci#define PIC_I2C_3_IRQ 33 628c2ecf20Sopenharmony_ci#define PIC_SPI_IRQ 34 638c2ecf20Sopenharmony_ci#define PIC_NAND_IRQ 37 648c2ecf20Sopenharmony_ci#define PIC_SATA_IRQ 38 658c2ecf20Sopenharmony_ci#define PIC_GPIO_IRQ 39 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#define PIC_PCIE_LINK_MSI_IRQ_BASE 44 /* 44 - 47 MSI IRQ */ 688c2ecf20Sopenharmony_ci#define PIC_PCIE_LINK_MSI_IRQ(i) (44 + (i)) 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci/* MSI-X with second link-level dispatch */ 718c2ecf20Sopenharmony_ci#define PIC_PCIE_MSIX_IRQ_BASE 48 /* 48 - 51 MSI-X IRQ */ 728c2ecf20Sopenharmony_ci#define PIC_PCIE_MSIX_IRQ(i) (48 + (i)) 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci/* XLP9xx and XLP8xx has 128 and 32 MSIX vectors respectively */ 758c2ecf20Sopenharmony_ci#define NLM_MSIX_VEC_BASE 96 /* 96 - 223 - MSIX mapped */ 768c2ecf20Sopenharmony_ci#define NLM_MSI_VEC_BASE 224 /* 224 -351 - MSI mapped */ 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#define NLM_PIC_INDIRECT_VEC_BASE 512 798c2ecf20Sopenharmony_ci#define NLM_GPIO_VEC_BASE 768 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#define PIC_IRQ_BASE 8 828c2ecf20Sopenharmony_ci#define PIC_IRT_FIRST_IRQ PIC_IRQ_BASE 838c2ecf20Sopenharmony_ci#define PIC_IRT_LAST_IRQ 63 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci/* SMP support functions */ 888c2ecf20Sopenharmony_civoid xlp_boot_core0_siblings(void); 898c2ecf20Sopenharmony_civoid xlp_wakeup_secondary_cpus(void); 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_civoid xlp_mmu_init(void); 928c2ecf20Sopenharmony_civoid nlm_hal_init(void); 938c2ecf20Sopenharmony_ciint nlm_get_dram_map(int node, uint64_t *dram_map, int nentries); 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_cistruct pci_dev; 968c2ecf20Sopenharmony_ciint xlp_socdev_to_node(const struct pci_dev *dev); 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci/* Device tree related */ 998c2ecf20Sopenharmony_civoid xlp_early_init_devtree(void); 1008c2ecf20Sopenharmony_civoid *xlp_dt_init(void *fdtp); 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_cistatic inline int cpu_is_xlpii(void) 1038c2ecf20Sopenharmony_ci{ 1048c2ecf20Sopenharmony_ci int chip = read_c0_prid() & PRID_IMP_MASK; 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci return chip == PRID_IMP_NETLOGIC_XLP2XX || 1078c2ecf20Sopenharmony_ci chip == PRID_IMP_NETLOGIC_XLP9XX || 1088c2ecf20Sopenharmony_ci chip == PRID_IMP_NETLOGIC_XLP5XX; 1098c2ecf20Sopenharmony_ci} 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_cistatic inline int cpu_is_xlp9xx(void) 1128c2ecf20Sopenharmony_ci{ 1138c2ecf20Sopenharmony_ci int chip = read_c0_prid() & PRID_IMP_MASK; 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci return chip == PRID_IMP_NETLOGIC_XLP9XX || 1168c2ecf20Sopenharmony_ci chip == PRID_IMP_NETLOGIC_XLP5XX; 1178c2ecf20Sopenharmony_ci} 1188c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */ 1198c2ecf20Sopenharmony_ci#endif /* _ASM_NLM_XLP_H */ 120