162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef __ARCH_ORION5X_COMMON_H 362306a36Sopenharmony_ci#define __ARCH_ORION5X_COMMON_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <linux/reboot.h> 662306a36Sopenharmony_ci 762306a36Sopenharmony_cistruct mv643xx_eth_platform_data; 862306a36Sopenharmony_cistruct mv_sata_platform_data; 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#define ORION_MBUS_PCIE_MEM_TARGET 0x04 1162306a36Sopenharmony_ci#define ORION_MBUS_PCIE_MEM_ATTR 0x59 1262306a36Sopenharmony_ci#define ORION_MBUS_PCIE_IO_TARGET 0x04 1362306a36Sopenharmony_ci#define ORION_MBUS_PCIE_IO_ATTR 0x51 1462306a36Sopenharmony_ci#define ORION_MBUS_PCIE_WA_TARGET 0x04 1562306a36Sopenharmony_ci#define ORION_MBUS_PCIE_WA_ATTR 0x79 1662306a36Sopenharmony_ci#define ORION_MBUS_PCI_MEM_TARGET 0x03 1762306a36Sopenharmony_ci#define ORION_MBUS_PCI_MEM_ATTR 0x59 1862306a36Sopenharmony_ci#define ORION_MBUS_PCI_IO_TARGET 0x03 1962306a36Sopenharmony_ci#define ORION_MBUS_PCI_IO_ATTR 0x51 2062306a36Sopenharmony_ci#define ORION_MBUS_DEVBUS_BOOT_TARGET 0x01 2162306a36Sopenharmony_ci#define ORION_MBUS_DEVBUS_BOOT_ATTR 0x0f 2262306a36Sopenharmony_ci#define ORION_MBUS_DEVBUS_TARGET(cs) 0x01 2362306a36Sopenharmony_ci#define ORION_MBUS_DEVBUS_ATTR(cs) (~(1 << cs)) 2462306a36Sopenharmony_ci#define ORION_MBUS_SRAM_TARGET 0x09 2562306a36Sopenharmony_ci#define ORION_MBUS_SRAM_ATTR 0x00 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci/* 2862306a36Sopenharmony_ci * Basic Orion init functions used early by machine-setup. 2962306a36Sopenharmony_ci */ 3062306a36Sopenharmony_civoid orion5x_map_io(void); 3162306a36Sopenharmony_civoid orion5x_init_early(void); 3262306a36Sopenharmony_civoid orion5x_init_irq(void); 3362306a36Sopenharmony_civoid orion5x_init(void); 3462306a36Sopenharmony_civoid orion5x_id(u32 *dev, u32 *rev, char **dev_name); 3562306a36Sopenharmony_civoid clk_init(void); 3662306a36Sopenharmony_ciextern int orion5x_tclk; 3762306a36Sopenharmony_ciextern void orion5x_timer_init(void); 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_civoid orion5x_setup_wins(void); 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_civoid orion5x_ehci0_init(void); 4262306a36Sopenharmony_civoid orion5x_ehci1_init(void); 4362306a36Sopenharmony_civoid orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data); 4462306a36Sopenharmony_civoid orion5x_i2c_init(void); 4562306a36Sopenharmony_civoid orion5x_sata_init(struct mv_sata_platform_data *sata_data); 4662306a36Sopenharmony_civoid orion5x_spi_init(void); 4762306a36Sopenharmony_civoid orion5x_uart0_init(void); 4862306a36Sopenharmony_civoid orion5x_uart1_init(void); 4962306a36Sopenharmony_civoid orion5x_xor_init(void); 5062306a36Sopenharmony_civoid orion5x_restart(enum reboot_mode, const char *); 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci/* 5362306a36Sopenharmony_ci * PCIe/PCI functions. 5462306a36Sopenharmony_ci */ 5562306a36Sopenharmony_cistruct pci_bus; 5662306a36Sopenharmony_cistruct pci_host_bridge; 5762306a36Sopenharmony_cistruct pci_sys_data; 5862306a36Sopenharmony_cistruct pci_dev; 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_civoid orion5x_pcie_id(u32 *dev, u32 *rev); 6162306a36Sopenharmony_civoid orion5x_pci_disable(void); 6262306a36Sopenharmony_civoid orion5x_pci_set_cardbus_mode(void); 6362306a36Sopenharmony_ciint orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys); 6462306a36Sopenharmony_ciint orion5x_pci_sys_scan_bus(int nr, struct pci_host_bridge *bridge); 6562306a36Sopenharmony_ciint orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_cistruct tag; 6862306a36Sopenharmony_ciextern void __init tag_fixup_mem32(struct tag *, char **); 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci#ifdef CONFIG_MACH_MSS2_DT 7162306a36Sopenharmony_ciextern void mss2_init(void); 7262306a36Sopenharmony_ci#else 7362306a36Sopenharmony_cistatic inline void mss2_init(void) {} 7462306a36Sopenharmony_ci#endif 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci#ifdef CONFIG_MACH_D2NET_DT 7762306a36Sopenharmony_civoid d2net_init(void); 7862306a36Sopenharmony_ci#else 7962306a36Sopenharmony_cistatic inline void d2net_init(void) {} 8062306a36Sopenharmony_ci#endif 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci/***************************************************************************** 8362306a36Sopenharmony_ci * Helpers to access Orion registers 8462306a36Sopenharmony_ci ****************************************************************************/ 8562306a36Sopenharmony_ci/* 8662306a36Sopenharmony_ci * These are not preempt-safe. Locks, if needed, must be taken 8762306a36Sopenharmony_ci * care of by the caller. 8862306a36Sopenharmony_ci */ 8962306a36Sopenharmony_ci#define orion5x_setbits(r, mask) writel(readl(r) | (mask), (r)) 9062306a36Sopenharmony_ci#define orion5x_clrbits(r, mask) writel(readl(r) & ~(mask), (r)) 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci#endif 93