Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ARCH_ORION5X_COMMON_H
0003 #define __ARCH_ORION5X_COMMON_H
0004 
0005 #include <linux/reboot.h>
0006 
0007 struct dsa_chip_data;
0008 struct mv643xx_eth_platform_data;
0009 struct mv_sata_platform_data;
0010 
0011 #define ORION_MBUS_PCIE_MEM_TARGET    0x04
0012 #define ORION_MBUS_PCIE_MEM_ATTR      0x59
0013 #define ORION_MBUS_PCIE_IO_TARGET     0x04
0014 #define ORION_MBUS_PCIE_IO_ATTR       0x51
0015 #define ORION_MBUS_PCIE_WA_TARGET     0x04
0016 #define ORION_MBUS_PCIE_WA_ATTR       0x79
0017 #define ORION_MBUS_PCI_MEM_TARGET     0x03
0018 #define ORION_MBUS_PCI_MEM_ATTR       0x59
0019 #define ORION_MBUS_PCI_IO_TARGET      0x03
0020 #define ORION_MBUS_PCI_IO_ATTR        0x51
0021 #define ORION_MBUS_DEVBUS_BOOT_TARGET 0x01
0022 #define ORION_MBUS_DEVBUS_BOOT_ATTR   0x0f
0023 #define ORION_MBUS_DEVBUS_TARGET(cs)  0x01
0024 #define ORION_MBUS_DEVBUS_ATTR(cs)    (~(1 << cs))
0025 #define ORION_MBUS_SRAM_TARGET        0x09
0026 #define ORION_MBUS_SRAM_ATTR          0x00
0027 
0028 /*
0029  * Basic Orion init functions used early by machine-setup.
0030  */
0031 void orion5x_map_io(void);
0032 void orion5x_init_early(void);
0033 void orion5x_init_irq(void);
0034 void orion5x_init(void);
0035 void orion5x_id(u32 *dev, u32 *rev, char **dev_name);
0036 void clk_init(void);
0037 extern int orion5x_tclk;
0038 extern void orion5x_timer_init(void);
0039 
0040 void orion5x_setup_wins(void);
0041 
0042 void orion5x_ehci0_init(void);
0043 void orion5x_ehci1_init(void);
0044 void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
0045 void orion5x_eth_switch_init(struct dsa_chip_data *d);
0046 void orion5x_i2c_init(void);
0047 void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
0048 void orion5x_spi_init(void);
0049 void orion5x_uart0_init(void);
0050 void orion5x_uart1_init(void);
0051 void orion5x_xor_init(void);
0052 void orion5x_restart(enum reboot_mode, const char *);
0053 
0054 /*
0055  * PCIe/PCI functions.
0056  */
0057 struct pci_bus;
0058 struct pci_host_bridge;
0059 struct pci_sys_data;
0060 struct pci_dev;
0061 
0062 void orion5x_pcie_id(u32 *dev, u32 *rev);
0063 void orion5x_pci_disable(void);
0064 void orion5x_pci_set_cardbus_mode(void);
0065 int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
0066 int orion5x_pci_sys_scan_bus(int nr, struct pci_host_bridge *bridge);
0067 int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
0068 
0069 struct tag;
0070 extern void __init tag_fixup_mem32(struct tag *, char **);
0071 
0072 #ifdef CONFIG_MACH_MSS2_DT
0073 extern void mss2_init(void);
0074 #else
0075 static inline void mss2_init(void) {}
0076 #endif
0077 
0078 /*****************************************************************************
0079  * Helpers to access Orion registers
0080  ****************************************************************************/
0081 /*
0082  * These are not preempt-safe.  Locks, if needed, must be taken
0083  * care of by the caller.
0084  */
0085 #define orion5x_setbits(r, mask)    writel(readl(r) | (mask), (r))
0086 #define orion5x_clrbits(r, mask)    writel(readl(r) & ~(mask), (r))
0087 
0088 #endif