common.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ARCH_ORION5X_COMMON_H
  3. #define __ARCH_ORION5X_COMMON_H
  4. #include <linux/reboot.h>
  5. struct dsa_chip_data;
  6. struct mv643xx_eth_platform_data;
  7. struct mv_sata_platform_data;
  8. #define ORION_MBUS_PCIE_MEM_TARGET 0x04
  9. #define ORION_MBUS_PCIE_MEM_ATTR 0x59
  10. #define ORION_MBUS_PCIE_IO_TARGET 0x04
  11. #define ORION_MBUS_PCIE_IO_ATTR 0x51
  12. #define ORION_MBUS_PCIE_WA_TARGET 0x04
  13. #define ORION_MBUS_PCIE_WA_ATTR 0x79
  14. #define ORION_MBUS_PCI_MEM_TARGET 0x03
  15. #define ORION_MBUS_PCI_MEM_ATTR 0x59
  16. #define ORION_MBUS_PCI_IO_TARGET 0x03
  17. #define ORION_MBUS_PCI_IO_ATTR 0x51
  18. #define ORION_MBUS_DEVBUS_BOOT_TARGET 0x01
  19. #define ORION_MBUS_DEVBUS_BOOT_ATTR 0x0f
  20. #define ORION_MBUS_DEVBUS_TARGET(cs) 0x01
  21. #define ORION_MBUS_DEVBUS_ATTR(cs) (~(1 << cs))
  22. #define ORION_MBUS_SRAM_TARGET 0x09
  23. #define ORION_MBUS_SRAM_ATTR 0x00
  24. /*
  25. * Basic Orion init functions used early by machine-setup.
  26. */
  27. void orion5x_map_io(void);
  28. void orion5x_init_early(void);
  29. void orion5x_init_irq(void);
  30. void orion5x_init(void);
  31. void orion5x_id(u32 *dev, u32 *rev, char **dev_name);
  32. void clk_init(void);
  33. extern int orion5x_tclk;
  34. extern void orion5x_timer_init(void);
  35. void orion5x_setup_wins(void);
  36. void orion5x_ehci0_init(void);
  37. void orion5x_ehci1_init(void);
  38. void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
  39. void orion5x_eth_switch_init(struct dsa_chip_data *d);
  40. void orion5x_i2c_init(void);
  41. void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
  42. void orion5x_spi_init(void);
  43. void orion5x_uart0_init(void);
  44. void orion5x_uart1_init(void);
  45. void orion5x_xor_init(void);
  46. void orion5x_restart(enum reboot_mode, const char *);
  47. /*
  48. * PCIe/PCI functions.
  49. */
  50. struct pci_bus;
  51. struct pci_host_bridge;
  52. struct pci_sys_data;
  53. struct pci_dev;
  54. void orion5x_pcie_id(u32 *dev, u32 *rev);
  55. void orion5x_pci_disable(void);
  56. void orion5x_pci_set_cardbus_mode(void);
  57. int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
  58. int orion5x_pci_sys_scan_bus(int nr, struct pci_host_bridge *bridge);
  59. int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
  60. struct tag;
  61. extern void __init tag_fixup_mem32(struct tag *, char **);
  62. #ifdef CONFIG_MACH_MSS2_DT
  63. extern void mss2_init(void);
  64. #else
  65. static inline void mss2_init(void) {}
  66. #endif
  67. /*****************************************************************************
  68. * Helpers to access Orion registers
  69. ****************************************************************************/
  70. /*
  71. * These are not preempt-safe. Locks, if needed, must be taken
  72. * care of by the caller.
  73. */
  74. #define orion5x_setbits(r, mask) writel(readl(r) | (mask), (r))
  75. #define orion5x_clrbits(r, mask) writel(readl(r) & ~(mask), (r))
  76. #endif