environmentalTemperatureAnalysis.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * Copyright (C) 2009 Nokia
  3. * Copyright (C) 2009-2010 Texas Instruments
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include "mux2420.h"
  10. #include "mux2430.h"
  11. #include "mux34xx.h"
  12. #include "mux44xx.h"
  13. #define OMAP_MUX_TERMINATOR 0xffff
  14. /* 34xx mux mode options for each pin. See TRM for options */
  15. #define OMAP_MUX_MODE0 0
  16. #define OMAP_MUX_MODE1 1
  17. #define OMAP_MUX_MODE2 2
  18. #define OMAP_MUX_MODE3 3
  19. #define OMAP_MUX_MODE4 4
  20. #define OMAP_MUX_MODE5 5
  21. #define OMAP_MUX_MODE6 6
  22. #define OMAP_MUX_MODE7 7
  23. /* 24xx/34xx mux bit defines */
  24. #define OMAP_PULL_ENA (1 << 3)
  25. #define OMAP_PULL_UP (1 << 4)
  26. #define OMAP_ALTELECTRICALSEL (1 << 5)
  27. /* 34xx specific mux bit defines */
  28. #define OMAP_INPUT_EN (1 << 8)
  29. #define OMAP_OFF_EN (1 << 9)
  30. #define OMAP_OFFOUT_EN (1 << 10)
  31. #define OMAP_OFFOUT_VAL (1 << 11)
  32. #define OMAP_OFF_PULL_EN (1 << 12)
  33. #define OMAP_OFF_PULL_UP (1 << 13)
  34. #define OMAP_WAKEUP_EN (1 << 14)
  35. /* 44xx specific mux bit defines */
  36. #define OMAP_WAKEUP_EVENT (1 << 15)
  37. /* Active pin states */
  38. #define OMAP_PIN_OUTPUT 0
  39. #define OMAP_PIN_INPUT OMAP_INPUT_EN
  40. #define OMAP_PIN_INPUT_PULLUP (OMAP_PULL_ENA | OMAP_INPUT_EN \
  41. | OMAP_PULL_UP)
  42. #define OMAP_PIN_INPUT_PULLDOWN (OMAP_PULL_ENA | OMAP_INPUT_EN)
  43. /* Off mode states */
  44. #define OMAP_PIN_OFF_NONE 0
  45. #define OMAP_PIN_OFF_OUTPUT_HIGH (OMAP_OFF_EN | OMAP_OFFOUT_EN \
  46. | OMAP_OFFOUT_VAL)
  47. #define OMAP_PIN_OFF_OUTPUT_LOW (OMAP_OFF_EN | OMAP_OFFOUT_EN)
  48. #define OMAP_PIN_OFF_INPUT_PULLUP (OMAP_OFF_EN | OMAP_OFF_PULL_EN \
  49. | OMAP_OFF_PULL_UP)
  50. #define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN)
  51. #define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN
  52. #define OMAP_MODE_GPIO(partition, x) (((x) & OMAP_MUX_MODE7) == \
  53. partition->gpio)
  54. #define OMAP_MODE_UART(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE0)
  55. /* Flags for omapX_mux_init */
  56. #define OMAP_PACKAGE_MASK 0xffff
  57. #define OMAP_PACKAGE_CBS 8 /* 547-pin 0.40 0.40 */
  58. #define OMAP_PACKAGE_CBL 7 /* 547-pin 0.40 0.40 */
  59. #define OMAP_PACKAGE_CBP 6 /* 515-pin 0.40 0.50 */
  60. #define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */
  61. #define OMAP_PACKAGE_CBB 4 /* 515-pin 0.40 0.50 */
  62. #define OMAP_PACKAGE_CBC 3 /* 515-pin 0.50 0.65 */
  63. #define OMAP_PACKAGE_ZAC 2 /* 24xx 447-pin POP */
  64. #define OMAP_PACKAGE_ZAF 1 /* 2420 447-pin SIP */
  65. #define OMAP_MUX_NR_MODES 8 /* Available modes */
  66. #define OMAP_MUX_NR_SIDES 2 /* Bottom & top */
  67. /*
  68. * omap_mux_init flags definition:
  69. *
  70. * OMAP_GPIO_MUX_MODE, bits 0-2: gpio muxing mode, same like pad control
  71. * register which includes values from 0-7.
  72. * OMAP_MUX_REG_8BIT: Ensure that access to padconf is done in 8 bits.
  73. * The default value is 16 bits.
  74. */
  75. #define OMAP_MUX_GPIO_IN_MODE0 OMAP_MUX_MODE0
  76. #define OMAP_MUX_GPIO_IN_MODE1 OMAP_MUX_MODE1
  77. #define OMAP_MUX_GPIO_IN_MODE2 OMAP_MUX_MODE2
  78. #define OMAP_MUX_GPIO_IN_MODE3 OMAP_MUX_MODE3
  79. #define OMAP_MUX_GPIO_IN_MODE4 OMAP_MUX_MODE4
  80. #define OMAP_MUX_GPIO_IN_MODE5 OMAP_MUX_MODE5
  81. #define OMAP_MUX_GPIO_IN_MODE6 OMAP_MUX_MODE6
  82. #define OMAP_MUX_GPIO_IN_MODE7 OMAP_MUX_MODE7
  83. #define OMAP_MUX_REG_8BIT (1 << 3)
  84. /**
  85. * struct omap_board_data - board specific device data
  86. * @id: instance id
  87. * @flags: additional flags for platform init code
  88. * @pads: array of device specific pads
  89. * @pads_cnt: ARRAY_SIZE() of pads
  90. */
  91. struct omap_board_data {
  92. int id;
  93. u32 flags;
  94. struct omap_device_pad *pads;
  95. int pads_cnt;
  96. };
  97. /**
  98. * struct mux_partition - contain partition related information
  99. * @name: name of the current partition
  100. * @flags: flags specific to this partition
  101. * @gpio: gpio mux mode
  102. * @phys: physical address
  103. * @size: partition size
  104. * @base: virtual address after ioremap
  105. * @muxmodes: list of nodes that belong to a partition
  106. * @node: list node for the partitions linked list
  107. */
  108. struct omap_mux_partition {
  109. const char *name;
  110. u32 flags;
  111. u32 gpio;
  112. u32 phys;
  113. u32 size;
  114. void __iomem *base;
  115. struct list_head muxmodes;
  116. struct list_head node;
  117. };
  118. /**
  119. * struct omap_mux - data for omap mux register offset and it's value
  120. * @reg_offset: mux register offset from the mux base
  121. * @gpio: GPIO number
  122. * @muxnames: available signal modes for a ball
  123. * @balls: available balls on the package
  124. */
  125. struct omap_mux {
  126. u16 reg_offset;
  127. u16 gpio;
  128. #ifdef CONFIG_OMAP_MUX
  129. char *muxnames[OMAP_MUX_NR_MODES];
  130. #ifdef CONFIG_DEBUG_FS
  131. char *balls[OMAP_MUX_NR_SIDES];
  132. #endif
  133. #endif
  134. };
  135. /**
  136. * struct omap_ball - data for balls on omap package
  137. * @reg_offset: mux register offset from the mux base
  138. * @balls: available balls on the package
  139. */
  140. struct omap_ball {
  141. u16 reg_offset;
  142. char *balls[OMAP_MUX_NR_SIDES];
  143. };
  144. /**
  145. * struct omap_board_mux - data for initializing mux registers
  146. * @reg_offset: mux register offset from the mux base
  147. * @mux_value: desired mux value to set
  148. */
  149. struct omap_board_mux {
  150. u16 reg_offset;