xref: /linux/arch/arm/mach-orion5x/common.h (revision cdd5b5a9761fd66d17586e4f4ba6588c70e640ea)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
29dd0b194SLennert Buytenhek #ifndef __ARCH_ORION5X_COMMON_H
39dd0b194SLennert Buytenhek #define __ARCH_ORION5X_COMMON_H
49dd0b194SLennert Buytenhek 
57b6d864bSRobin Holt #include <linux/reboot.h>
67b6d864bSRobin Holt 
7044f6c7cSLennert Buytenhek struct mv643xx_eth_platform_data;
8044f6c7cSLennert Buytenhek struct mv_sata_platform_data;
9044f6c7cSLennert Buytenhek 
104ca2c040SThomas Petazzoni #define ORION_MBUS_PCIE_MEM_TARGET    0x04
114ca2c040SThomas Petazzoni #define ORION_MBUS_PCIE_MEM_ATTR      0x59
124ca2c040SThomas Petazzoni #define ORION_MBUS_PCIE_IO_TARGET     0x04
134ca2c040SThomas Petazzoni #define ORION_MBUS_PCIE_IO_ATTR       0x51
144ca2c040SThomas Petazzoni #define ORION_MBUS_PCIE_WA_TARGET     0x04
154ca2c040SThomas Petazzoni #define ORION_MBUS_PCIE_WA_ATTR       0x79
164ca2c040SThomas Petazzoni #define ORION_MBUS_PCI_MEM_TARGET     0x03
174ca2c040SThomas Petazzoni #define ORION_MBUS_PCI_MEM_ATTR       0x59
184ca2c040SThomas Petazzoni #define ORION_MBUS_PCI_IO_TARGET      0x03
194ca2c040SThomas Petazzoni #define ORION_MBUS_PCI_IO_ATTR        0x51
204ca2c040SThomas Petazzoni #define ORION_MBUS_DEVBUS_BOOT_TARGET 0x01
214ca2c040SThomas Petazzoni #define ORION_MBUS_DEVBUS_BOOT_ATTR   0x0f
224ca2c040SThomas Petazzoni #define ORION_MBUS_DEVBUS_TARGET(cs)  0x01
234ca2c040SThomas Petazzoni #define ORION_MBUS_DEVBUS_ATTR(cs)    (~(1 << cs))
241cc9d481SThomas Petazzoni #define ORION_MBUS_SRAM_TARGET        0x09
254ca2c040SThomas Petazzoni #define ORION_MBUS_SRAM_ATTR          0x00
264ca2c040SThomas Petazzoni 
279dd0b194SLennert Buytenhek /*
289dd0b194SLennert Buytenhek  * Basic Orion init functions used early by machine-setup.
299dd0b194SLennert Buytenhek  */
309dd0b194SLennert Buytenhek void orion5x_map_io(void);
314ee1f6b5SLennert Buytenhek void orion5x_init_early(void);
329dd0b194SLennert Buytenhek void orion5x_init_irq(void);
339dd0b194SLennert Buytenhek void orion5x_init(void);
341bffb4a8SThomas Petazzoni void orion5x_id(u32 *dev, u32 *rev, char **dev_name);
351bffb4a8SThomas Petazzoni void clk_init(void);
36ebe35affSLennert Buytenhek extern int orion5x_tclk;
376bb27d73SStephen Warren extern void orion5x_timer_init(void);
389dd0b194SLennert Buytenhek 
395d1190eaSThomas Petazzoni void orion5x_setup_wins(void);
409dd0b194SLennert Buytenhek 
41044f6c7cSLennert Buytenhek void orion5x_ehci0_init(void);
42044f6c7cSLennert Buytenhek void orion5x_ehci1_init(void);
43044f6c7cSLennert Buytenhek void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
44044f6c7cSLennert Buytenhek void orion5x_i2c_init(void);
45044f6c7cSLennert Buytenhek void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
46d323ade1SLennert Buytenhek void orion5x_spi_init(void);
47044f6c7cSLennert Buytenhek void orion5x_uart0_init(void);
48044f6c7cSLennert Buytenhek void orion5x_uart1_init(void);
491d5a1a6eSSaeed Bishara void orion5x_xor_init(void);
507b6d864bSRobin Holt void orion5x_restart(enum reboot_mode, const char *);
519dd0b194SLennert Buytenhek 
52044f6c7cSLennert Buytenhek /*
53044f6c7cSLennert Buytenhek  * PCIe/PCI functions.
54044f6c7cSLennert Buytenhek  */
559dd0b194SLennert Buytenhek struct pci_bus;
5697ad2bdcSLorenzo Pieralisi struct pci_host_bridge;
57044f6c7cSLennert Buytenhek struct pci_sys_data;
586ed272f2SAndrew Lunn struct pci_dev;
599dd0b194SLennert Buytenhek 
609dd0b194SLennert Buytenhek void orion5x_pcie_id(u32 *dev, u32 *rev);
617a6bb262SPer Andersson void orion5x_pci_disable(void);
62da01bba3SLennert Buytenhek void orion5x_pci_set_cardbus_mode(void);
639dd0b194SLennert Buytenhek int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
6497ad2bdcSLorenzo Pieralisi int orion5x_pci_sys_scan_bus(int nr, struct pci_host_bridge *bridge);
65d5341942SRalf Baechle int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
669dd0b194SLennert Buytenhek 
679dd0b194SLennert Buytenhek struct tag;
681c2f87c2SLaura Abbott extern void __init tag_fixup_mem32(struct tag *, char **);
699dd0b194SLennert Buytenhek 
70fbf04d81SThomas Petazzoni #ifdef CONFIG_MACH_MSS2_DT
71fbf04d81SThomas Petazzoni extern void mss2_init(void);
72fbf04d81SThomas Petazzoni #else
mss2_init(void)73fbf04d81SThomas Petazzoni static inline void mss2_init(void) {}
74fbf04d81SThomas Petazzoni #endif
75fbf04d81SThomas Petazzoni 
76*f8ef1233SArnd Bergmann #ifdef CONFIG_MACH_D2NET_DT
77*f8ef1233SArnd Bergmann void d2net_init(void);
78*f8ef1233SArnd Bergmann #else
d2net_init(void)79*f8ef1233SArnd Bergmann static inline void d2net_init(void) {}
80*f8ef1233SArnd Bergmann #endif
81*f8ef1233SArnd Bergmann 
828a52dd4fSRob Herring /*****************************************************************************
838a52dd4fSRob Herring  * Helpers to access Orion registers
848a52dd4fSRob Herring  ****************************************************************************/
858a52dd4fSRob Herring /*
868a52dd4fSRob Herring  * These are not preempt-safe.  Locks, if needed, must be taken
878a52dd4fSRob Herring  * care of by the caller.
888a52dd4fSRob Herring  */
898a52dd4fSRob Herring #define orion5x_setbits(r, mask)	writel(readl(r) | (mask), (r))
908a52dd4fSRob Herring #define orion5x_clrbits(r, mask)	writel(readl(r) & ~(mask), (r))
919dd0b194SLennert Buytenhek 
929dd0b194SLennert Buytenhek #endif
93