common.h 2.7 KB

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