platform.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * include/asm-arm/arch-ixp4xx/platform.h
  3. *
  4. * Constants and functions that are useful to IXP4xx platform-specific code
  5. * and device drivers.
  6. *
  7. * Copyright (C) 2004 MontaVista Software, Inc.
  8. */
  9. #ifndef __ASM_ARCH_HARDWARE_H__
  10. #error "Do not include this directly, instead #include <asm/hardware.h>"
  11. #endif
  12. #ifndef __ASSEMBLY__
  13. #include <asm/types.h>
  14. #ifndef __ARMEB__
  15. #define REG_OFFSET 0
  16. #else
  17. #define REG_OFFSET 3
  18. #endif
  19. /*
  20. * Expansion bus memory regions
  21. */
  22. #define IXP4XX_EXP_BUS_BASE_PHYS (0x50000000)
  23. #define IXP4XX_EXP_BUS_CSX_REGION_SIZE (0x01000000)
  24. #define IXP4XX_EXP_BUS_CS0_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x00000000)
  25. #define IXP4XX_EXP_BUS_CS1_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x01000000)
  26. #define IXP4XX_EXP_BUS_CS2_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x02000000)
  27. #define IXP4XX_EXP_BUS_CS3_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x03000000)
  28. #define IXP4XX_EXP_BUS_CS4_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x04000000)
  29. #define IXP4XX_EXP_BUS_CS5_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x05000000)
  30. #define IXP4XX_EXP_BUS_CS6_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x06000000)
  31. #define IXP4XX_EXP_BUS_CS7_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x07000000)
  32. #define IXP4XX_FLASH_WRITABLE (0x2)
  33. #define IXP4XX_FLASH_DEFAULT (0xbcd23c40)
  34. #define IXP4XX_FLASH_WRITE (0xbcd23c42)
  35. /*
  36. * Clock Speed Definitions.
  37. */
  38. #define IXP4XX_PERIPHERAL_BUS_CLOCK (66) /* 66Mhzi APB BUS */
  39. #define IXP4XX_UART_XTAL 14745600
  40. /*
  41. * The IXP4xx chips do not have an I2C unit, so GPIO lines are just
  42. * used to
  43. * Used as platform_data to provide GPIO pin information to the ixp42x
  44. * I2C driver.
  45. */
  46. struct ixp4xx_i2c_pins {
  47. unsigned long sda_pin;
  48. unsigned long scl_pin;
  49. };
  50. struct sys_timer;
  51. /*
  52. * Functions used by platform-level setup code
  53. */
  54. extern void ixp4xx_map_io(void);
  55. extern void ixp4xx_init_irq(void);
  56. extern void ixp4xx_sys_init(void);
  57. extern struct sys_timer ixp4xx_timer;
  58. extern void ixp4xx_pci_preinit(void);
  59. struct pci_sys_data;
  60. extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
  61. extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
  62. /*
  63. * GPIO-functions
  64. */
  65. /*
  66. * The following converted to the real HW bits the gpio_line_config
  67. */
  68. /* GPIO pin types */
  69. #define IXP4XX_GPIO_OUT 0x1
  70. #define IXP4XX_GPIO_IN 0x2
  71. /* GPIO signal types */
  72. #define IXP4XX_GPIO_LOW 0
  73. #define IXP4XX_GPIO_HIGH 1
  74. /* GPIO Clocks */
  75. #define IXP4XX_GPIO_CLK_0 14
  76. #define IXP4XX_GPIO_CLK_1 15
  77. static inline void gpio_line_config(u8 line, u32 direction)
  78. {
  79. if (direction == IXP4XX_GPIO_OUT)
  80. *IXP4XX_GPIO_GPOER |= (1 << line);
  81. else
  82. *IXP4XX_GPIO_GPOER &= ~(1 << line);
  83. }
  84. static inline void gpio_line_get(u8 line, int *value)
  85. {
  86. *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
  87. }
  88. static inline void gpio_line_set(u8 line, int value)
  89. {
  90. if (value == IXP4XX_GPIO_HIGH)
  91. *IXP4XX_GPIO_GPOUTR |= (1 << line);
  92. else if (value == IXP4XX_GPIO_LOW)
  93. *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
  94. }
  95. static inline void gpio_line_isr_clear(u8 line)
  96. {
  97. *IXP4XX_GPIO_GPISR = (1 << line);
  98. }
  99. #endif // __ASSEMBLY__