hardware.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * linux/include/asm-arm/arch-pxa/hardware.h
  3. *
  4. * Author: Nicolas Pitre
  5. * Created: Jun 15, 2001
  6. * Copyright: MontaVista Software Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * Note: This file was taken from linux-2.4.19-rmk4-pxa1
  13. *
  14. * - 2003/01/20 implementation specifics activated
  15. * Robert Schwebel <r.schwebel@pengutronix.de>
  16. */
  17. #ifndef __ASM_ARCH_HARDWARE_H
  18. #define __ASM_ARCH_HARDWARE_H
  19. #include <linux/config.h>
  20. #include <asm/mach-types.h>
  21. /*
  22. * These are statically mapped PCMCIA IO space for designs using it as a
  23. * generic IO bus, typically with ISA parts, hardwired IDE interfaces, etc.
  24. * The actual PCMCIA code is mapping required IO region at run time.
  25. */
  26. #define PCMCIA_IO_0_BASE 0xf6000000
  27. #define PCMCIA_IO_1_BASE 0xf7000000
  28. /*
  29. * We requires absolute addresses.
  30. */
  31. #define PCIO_BASE 0
  32. /*
  33. * Workarounds for at least 2 errata so far require this.
  34. * The mapping is set in mach-pxa/generic.c.
  35. */
  36. #define UNCACHED_PHYS_0 0xff000000
  37. #define UNCACHED_ADDR UNCACHED_PHYS_0
  38. /*
  39. * Intel PXA internal I/O mappings:
  40. *
  41. * 0x40000000 - 0x41ffffff <--> 0xf8000000 - 0xf9ffffff
  42. * 0x44000000 - 0x45ffffff <--> 0xfa000000 - 0xfbffffff
  43. * 0x48000000 - 0x49ffffff <--> 0xfc000000 - 0xfdffffff
  44. */
  45. /* FIXME: Only this does work for u-boot... find out why... [RS] */
  46. #define UBOOT_REG_FIX 1
  47. #ifndef UBOOT_REG_FIX
  48. #ifndef __ASSEMBLY__
  49. #define io_p2v(x) ( ((x) | 0xbe000000) ^ (~((x) >> 1) & 0x06000000) )
  50. #define io_v2p( x ) ( ((x) & 0x41ffffff) ^ ( ((x) & 0x06000000) << 1) )
  51. /*
  52. * This __REG() version gives the same results as the one above, except
  53. * that we are fooling gcc somehow so it generates far better and smaller
  54. * assembly code for access to contigous registers. It's a shame that gcc
  55. * doesn't guess this by itself.
  56. */
  57. #include <asm/types.h>
  58. typedef struct { volatile u32 offset[4096]; } __regbase;
  59. # define __REGP(x) ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2]
  60. # define __REG(x) __REGP(io_p2v(x))
  61. #endif
  62. /* Let's kick gcc's ass again... */
  63. # define __REG2(x,y) \
  64. ( __builtin_constant_p(y) ? (__REG((x) + (y))) \
  65. : (*(volatile u32 *)((u32)&__REG(x) + (y))) )
  66. # define __PREG(x) (io_v2p((u32)&(x)))
  67. #else
  68. # define __REG(x) io_p2v(x)
  69. # define __PREG(x) io_v2p(x)
  70. # undef io_p2v
  71. # undef __REG
  72. # ifndef __ASSEMBLY__
  73. # define io_p2v(PhAdd) (PhAdd)
  74. # define __REG(x) (*((volatile u32 *)io_p2v(x)))
  75. # define __REG2(x,y) (*(volatile u32 *)((u32)&__REG(x) + (y)))
  76. # else
  77. # define __REG(x) (x)
  78. # ifdef CONFIG_CPU_MONAHANS /* Hack to make this work with mona's pxa-regs.h */
  79. # define __REG_2(x) (x)
  80. # define __REG_3(x) (x)
  81. # endif
  82. # endif
  83. #endif /* UBOOT_REG_FIX */
  84. #include "pxa-regs.h"
  85. #ifndef __ASSEMBLY__
  86. /*
  87. * GPIO edge detection for IRQs:
  88. * IRQs are generated on Falling-Edge, Rising-Edge, or both.
  89. * This must be called *before* the corresponding IRQ is registered.
  90. * Use this instead of directly setting GRER/GFER.
  91. */
  92. #define GPIO_FALLING_EDGE 1
  93. #define GPIO_RISING_EDGE 2
  94. #define GPIO_BOTH_EDGES 3
  95. extern void set_GPIO_IRQ_edge( int gpio_nr, int edge_mask );
  96. /*
  97. * Handy routine to set GPIO alternate functions
  98. */
  99. extern void set_GPIO_mode( int gpio_mode );
  100. /*
  101. * return current lclk frequency in units of 10kHz
  102. */
  103. extern unsigned int get_lclk_frequency_10khz(void);
  104. #endif
  105. /*
  106. * Implementation specifics
  107. */
  108. #ifdef CONFIG_ARCH_LUBBOCK
  109. #include "lubbock.h"
  110. #endif
  111. #ifdef CONFIG_ARCH_PXA_IDP
  112. #include "idp.h"
  113. #endif
  114. #ifdef CONFIG_ARCH_PXA_CERF
  115. #include "cerf.h"
  116. #endif
  117. #ifdef CONFIG_ARCH_CSB226
  118. #include "csb226.h"
  119. #endif
  120. #ifdef CONFIG_ARCH_INNOKOM
  121. #include "innokom.h"
  122. #endif
  123. #ifdef CONFIG_ARCH_PLEB
  124. #include "pleb.h"
  125. #endif
  126. #endif /* _ASM_ARCH_HARDWARE_H */