18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef BCM63XX_IO_H_ 38c2ecf20Sopenharmony_ci#define BCM63XX_IO_H_ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <asm/mach-bcm63xx/bcm63xx_cpu.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci/* 88c2ecf20Sopenharmony_ci * Physical memory map, RAM is mapped at 0x0. 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * Note that size MUST be a power of two. 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci#define BCM_PCMCIA_COMMON_BASE_PA (0x20000000) 138c2ecf20Sopenharmony_ci#define BCM_PCMCIA_COMMON_SIZE (16 * 1024 * 1024) 148c2ecf20Sopenharmony_ci#define BCM_PCMCIA_COMMON_END_PA (BCM_PCMCIA_COMMON_BASE_PA + \ 158c2ecf20Sopenharmony_ci BCM_PCMCIA_COMMON_SIZE - 1) 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define BCM_PCMCIA_ATTR_BASE_PA (0x21000000) 188c2ecf20Sopenharmony_ci#define BCM_PCMCIA_ATTR_SIZE (16 * 1024 * 1024) 198c2ecf20Sopenharmony_ci#define BCM_PCMCIA_ATTR_END_PA (BCM_PCMCIA_ATTR_BASE_PA + \ 208c2ecf20Sopenharmony_ci BCM_PCMCIA_ATTR_SIZE - 1) 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define BCM_PCMCIA_IO_BASE_PA (0x22000000) 238c2ecf20Sopenharmony_ci#define BCM_PCMCIA_IO_SIZE (64 * 1024) 248c2ecf20Sopenharmony_ci#define BCM_PCMCIA_IO_END_PA (BCM_PCMCIA_IO_BASE_PA + \ 258c2ecf20Sopenharmony_ci BCM_PCMCIA_IO_SIZE - 1) 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define BCM_PCI_MEM_BASE_PA (0x30000000) 288c2ecf20Sopenharmony_ci#define BCM_PCI_MEM_SIZE (128 * 1024 * 1024) 298c2ecf20Sopenharmony_ci#define BCM_PCI_MEM_END_PA (BCM_PCI_MEM_BASE_PA + \ 308c2ecf20Sopenharmony_ci BCM_PCI_MEM_SIZE - 1) 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define BCM_PCI_IO_BASE_PA (0x08000000) 338c2ecf20Sopenharmony_ci#define BCM_PCI_IO_SIZE (64 * 1024) 348c2ecf20Sopenharmony_ci#define BCM_PCI_IO_END_PA (BCM_PCI_IO_BASE_PA + \ 358c2ecf20Sopenharmony_ci BCM_PCI_IO_SIZE - 1) 368c2ecf20Sopenharmony_ci#define BCM_PCI_IO_HALF_PA (BCM_PCI_IO_BASE_PA + \ 378c2ecf20Sopenharmony_ci (BCM_PCI_IO_SIZE / 2) - 1) 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define BCM_CB_MEM_BASE_PA (0x38000000) 408c2ecf20Sopenharmony_ci#define BCM_CB_MEM_SIZE (128 * 1024 * 1024) 418c2ecf20Sopenharmony_ci#define BCM_CB_MEM_END_PA (BCM_CB_MEM_BASE_PA + \ 428c2ecf20Sopenharmony_ci BCM_CB_MEM_SIZE - 1) 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define BCM_PCIE_MEM_BASE_PA 0x10f00000 458c2ecf20Sopenharmony_ci#define BCM_PCIE_MEM_SIZE (16 * 1024 * 1024) 468c2ecf20Sopenharmony_ci#define BCM_PCIE_MEM_END_PA (BCM_PCIE_MEM_BASE_PA + \ 478c2ecf20Sopenharmony_ci BCM_PCIE_MEM_SIZE - 1) 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci/* 508c2ecf20Sopenharmony_ci * Internal registers are accessed through KSEG3 518c2ecf20Sopenharmony_ci */ 528c2ecf20Sopenharmony_ci#define BCM_REGS_VA(x) ((void __iomem *)(x)) 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define bcm_readb(a) (*(volatile unsigned char *) BCM_REGS_VA(a)) 558c2ecf20Sopenharmony_ci#define bcm_readw(a) (*(volatile unsigned short *) BCM_REGS_VA(a)) 568c2ecf20Sopenharmony_ci#define bcm_readl(a) (*(volatile unsigned int *) BCM_REGS_VA(a)) 578c2ecf20Sopenharmony_ci#define bcm_readq(a) (*(volatile u64 *) BCM_REGS_VA(a)) 588c2ecf20Sopenharmony_ci#define bcm_writeb(v, a) (*(volatile unsigned char *) BCM_REGS_VA((a)) = (v)) 598c2ecf20Sopenharmony_ci#define bcm_writew(v, a) (*(volatile unsigned short *) BCM_REGS_VA((a)) = (v)) 608c2ecf20Sopenharmony_ci#define bcm_writel(v, a) (*(volatile unsigned int *) BCM_REGS_VA((a)) = (v)) 618c2ecf20Sopenharmony_ci#define bcm_writeq(v, a) (*(volatile u64 *) BCM_REGS_VA((a)) = (v)) 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* 648c2ecf20Sopenharmony_ci * IO helpers to access register set for current CPU 658c2ecf20Sopenharmony_ci */ 668c2ecf20Sopenharmony_ci#define bcm_rset_readb(s, o) bcm_readb(bcm63xx_regset_address(s) + (o)) 678c2ecf20Sopenharmony_ci#define bcm_rset_readw(s, o) bcm_readw(bcm63xx_regset_address(s) + (o)) 688c2ecf20Sopenharmony_ci#define bcm_rset_readl(s, o) bcm_readl(bcm63xx_regset_address(s) + (o)) 698c2ecf20Sopenharmony_ci#define bcm_rset_writeb(s, v, o) bcm_writeb((v), \ 708c2ecf20Sopenharmony_ci bcm63xx_regset_address(s) + (o)) 718c2ecf20Sopenharmony_ci#define bcm_rset_writew(s, v, o) bcm_writew((v), \ 728c2ecf20Sopenharmony_ci bcm63xx_regset_address(s) + (o)) 738c2ecf20Sopenharmony_ci#define bcm_rset_writel(s, v, o) bcm_writel((v), \ 748c2ecf20Sopenharmony_ci bcm63xx_regset_address(s) + (o)) 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci/* 778c2ecf20Sopenharmony_ci * helpers for frequently used register sets 788c2ecf20Sopenharmony_ci */ 798c2ecf20Sopenharmony_ci#define bcm_perf_readl(o) bcm_rset_readl(RSET_PERF, (o)) 808c2ecf20Sopenharmony_ci#define bcm_perf_writel(v, o) bcm_rset_writel(RSET_PERF, (v), (o)) 818c2ecf20Sopenharmony_ci#define bcm_timer_readl(o) bcm_rset_readl(RSET_TIMER, (o)) 828c2ecf20Sopenharmony_ci#define bcm_timer_writel(v, o) bcm_rset_writel(RSET_TIMER, (v), (o)) 838c2ecf20Sopenharmony_ci#define bcm_wdt_readl(o) bcm_rset_readl(RSET_WDT, (o)) 848c2ecf20Sopenharmony_ci#define bcm_wdt_writel(v, o) bcm_rset_writel(RSET_WDT, (v), (o)) 858c2ecf20Sopenharmony_ci#define bcm_gpio_readl(o) bcm_rset_readl(RSET_GPIO, (o)) 868c2ecf20Sopenharmony_ci#define bcm_gpio_writel(v, o) bcm_rset_writel(RSET_GPIO, (v), (o)) 878c2ecf20Sopenharmony_ci#define bcm_uart0_readl(o) bcm_rset_readl(RSET_UART0, (o)) 888c2ecf20Sopenharmony_ci#define bcm_uart0_writel(v, o) bcm_rset_writel(RSET_UART0, (v), (o)) 898c2ecf20Sopenharmony_ci#define bcm_mpi_readl(o) bcm_rset_readl(RSET_MPI, (o)) 908c2ecf20Sopenharmony_ci#define bcm_mpi_writel(v, o) bcm_rset_writel(RSET_MPI, (v), (o)) 918c2ecf20Sopenharmony_ci#define bcm_pcmcia_readl(o) bcm_rset_readl(RSET_PCMCIA, (o)) 928c2ecf20Sopenharmony_ci#define bcm_pcmcia_writel(v, o) bcm_rset_writel(RSET_PCMCIA, (v), (o)) 938c2ecf20Sopenharmony_ci#define bcm_pcie_readl(o) bcm_rset_readl(RSET_PCIE, (o)) 948c2ecf20Sopenharmony_ci#define bcm_pcie_writel(v, o) bcm_rset_writel(RSET_PCIE, (v), (o)) 958c2ecf20Sopenharmony_ci#define bcm_sdram_readl(o) bcm_rset_readl(RSET_SDRAM, (o)) 968c2ecf20Sopenharmony_ci#define bcm_sdram_writel(v, o) bcm_rset_writel(RSET_SDRAM, (v), (o)) 978c2ecf20Sopenharmony_ci#define bcm_memc_readl(o) bcm_rset_readl(RSET_MEMC, (o)) 988c2ecf20Sopenharmony_ci#define bcm_memc_writel(v, o) bcm_rset_writel(RSET_MEMC, (v), (o)) 998c2ecf20Sopenharmony_ci#define bcm_ddr_readl(o) bcm_rset_readl(RSET_DDR, (o)) 1008c2ecf20Sopenharmony_ci#define bcm_ddr_writel(v, o) bcm_rset_writel(RSET_DDR, (v), (o)) 1018c2ecf20Sopenharmony_ci#define bcm_misc_readl(o) bcm_rset_readl(RSET_MISC, (o)) 1028c2ecf20Sopenharmony_ci#define bcm_misc_writel(v, o) bcm_rset_writel(RSET_MISC, (v), (o)) 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#endif /* ! BCM63XX_IO_H_ */ 105