tsi108.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * common routine and memory layout for Tundra TSI108(Grendel) host bridge
  4. * memory controller.
  5. *
  6. * Author: Jacob Pan ([email protected])
  7. * Alex Bounine ([email protected])
  8. *
  9. * Copyright 2004-2006 Freescale Semiconductor, Inc.
  10. */
  11. #ifndef __PPC_KERNEL_TSI108_H
  12. #define __PPC_KERNEL_TSI108_H
  13. #include <asm/pci-bridge.h>
  14. /* Size of entire register space */
  15. #define TSI108_REG_SIZE (0x10000)
  16. /* Sizes of register spaces for individual blocks */
  17. #define TSI108_HLP_SIZE 0x1000
  18. #define TSI108_PCI_SIZE 0x1000
  19. #define TSI108_CLK_SIZE 0x1000
  20. #define TSI108_PB_SIZE 0x1000
  21. #define TSI108_SD_SIZE 0x1000
  22. #define TSI108_DMA_SIZE 0x1000
  23. #define TSI108_ETH_SIZE 0x1000
  24. #define TSI108_I2C_SIZE 0x400
  25. #define TSI108_MPIC_SIZE 0x400
  26. #define TSI108_UART0_SIZE 0x200
  27. #define TSI108_GPIO_SIZE 0x200
  28. #define TSI108_UART1_SIZE 0x200
  29. /* Offsets within Tsi108(A) CSR space for individual blocks */
  30. #define TSI108_HLP_OFFSET 0x0000
  31. #define TSI108_PCI_OFFSET 0x1000
  32. #define TSI108_CLK_OFFSET 0x2000
  33. #define TSI108_PB_OFFSET 0x3000
  34. #define TSI108_SD_OFFSET 0x4000
  35. #define TSI108_DMA_OFFSET 0x5000
  36. #define TSI108_ETH_OFFSET 0x6000
  37. #define TSI108_I2C_OFFSET 0x7000
  38. #define TSI108_MPIC_OFFSET 0x7400
  39. #define TSI108_UART0_OFFSET 0x7800
  40. #define TSI108_GPIO_OFFSET 0x7A00
  41. #define TSI108_UART1_OFFSET 0x7C00
  42. /* Tsi108 registers used by common code components */
  43. #define TSI108_PCI_CSR (0x004)
  44. #define TSI108_PCI_IRP_CFG_CTL (0x180)
  45. #define TSI108_PCI_IRP_STAT (0x184)
  46. #define TSI108_PCI_IRP_ENABLE (0x188)
  47. #define TSI108_PCI_IRP_INTAD (0x18C)
  48. #define TSI108_PCI_IRP_STAT_P_INT (0x00400000)
  49. #define TSI108_PCI_IRP_ENABLE_P_INT (0x00400000)
  50. #define TSI108_CG_PWRUP_STATUS (0x234)
  51. #define TSI108_PB_ISR (0x00C)
  52. #define TSI108_PB_ERRCS (0x404)
  53. #define TSI108_PB_AERR (0x408)
  54. #define TSI108_PB_ERRCS_ES (1 << 1)
  55. #define TSI108_PB_ISR_PBS_RD_ERR (1 << 8)
  56. #define TSI108_PCI_CFG_SIZE (0x01000000)
  57. /*
  58. * PHY Configuration Options
  59. *
  60. * Specify "bcm54xx" in the compatible property of your device tree phy
  61. * nodes if your board uses the Broadcom PHYs
  62. */
  63. #define TSI108_PHY_MV88E 0 /* Marvel 88Exxxx PHY */
  64. #define TSI108_PHY_BCM54XX 1 /* Broadcom BCM54xx PHY */
  65. /* Global variables */
  66. extern u32 tsi108_pci_cfg_base;
  67. /* Exported functions */
  68. extern int tsi108_direct_write_config(struct pci_bus *bus, unsigned int devfn,
  69. int offset, int len, u32 val);
  70. extern int tsi108_direct_read_config(struct pci_bus *bus, unsigned int devfn,
  71. int offset, int len, u32 * val);
  72. extern void tsi108_clear_pci_error(u32 pci_cfg_base);
  73. extern phys_addr_t get_csrbase(void);
  74. typedef struct {
  75. u32 regs; /* hw registers base address */
  76. u32 phyregs; /* phy registers base address */
  77. u16 phy; /* phy address */
  78. u16 irq_num; /* irq number */
  79. u8 mac_addr[6]; /* phy mac address */
  80. u16 phy_type; /* type of phy on board */
  81. } hw_info;
  82. extern u32 get_vir_csrbase(void);
  83. extern u32 tsi108_csr_vir_base;
  84. static inline u32 tsi108_read_reg(u32 reg_offset)
  85. {
  86. return in_be32((volatile u32 *)(tsi108_csr_vir_base + reg_offset));
  87. }
  88. static inline void tsi108_write_reg(u32 reg_offset, u32 val)
  89. {
  90. out_be32((volatile u32 *)(tsi108_csr_vir_base + reg_offset), val);
  91. }
  92. #endif /* __PPC_KERNEL_TSI108_H */