pwm.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Pulse Width Modulation Memory Map
  3. *
  4. * Copyright (C) 2004-2008 Freescale Semiconductor, Inc.
  5. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #ifndef __ATA_H__
  26. #define __ATA_H__
  27. /* Pulse Width Modulation (PWM) */
  28. typedef struct pwm_ctrl {
  29. #ifdef CONFIG_M5272
  30. u8 cr0;
  31. u8 res1[3];
  32. u8 cr1;
  33. u8 res2[3];
  34. u8 cr2;
  35. u8 res3[7];
  36. u8 pwr0;
  37. u8 res4[3];
  38. u8 pwr1;
  39. u8 res5[3];
  40. u8 pwr2;
  41. u8 res6[7];
  42. #else
  43. u8 en; /* 0x00 PWM Enable */
  44. u8 pol; /* 0x01 Polarity */
  45. u8 clk; /* 0x02 Clock Select */
  46. u8 prclk; /* 0x03 Prescale Clock Select */
  47. u8 cae; /* 0x04 Center Align Enable */
  48. u8 ctl; /* 0x05 Control */
  49. u16 res1; /* 0x06 - 0x07 */
  50. u8 scla; /* 0x08 Scale A */
  51. u8 sclb; /* 0x09 Scale B */
  52. u16 res2; /* 0x0A - 0x0B */
  53. #ifdef CONFIG_M5275
  54. u8 cnt[4]; /* 0x0C Channel n Counter */
  55. u16 res3; /* 0x10 - 0x11 */
  56. u8 per[4]; /* 0x14 Channel n Period */
  57. u16 res4; /* 0x16 - 0x17 */
  58. u8 dty[4]; /* 0x18 Channel n Duty */
  59. #else
  60. u8 cnt[8]; /* 0x0C Channel n Counter */
  61. u8 per[8]; /* 0x14 Channel n Period */
  62. u8 dty[8]; /* 0x1C Channel n Duty */
  63. u8 sdn; /* 0x24 Shutdown */
  64. u8 res3[3]; /* 0x25 - 0x27 */
  65. #endif /* CONFIG_M5275 */
  66. #endif /* CONFIG_M5272 */
  67. } pwm_t;
  68. #ifdef CONFIG_M5272
  69. #define PWM_CR_EN (0x80)
  70. #define PWM_CR_FRC1 (0x40)
  71. #define PWM_CR_LVL (0x20)
  72. #define PWM_CR_CLKSEL(x) ((x) & 0x0F)
  73. #define PWM_CR_CLKSEL_MASK (0xF0)
  74. #else
  75. #define PWM_EN_PWMEn(x) (1 << ((x) & 0x07))
  76. #define PWM_EN_PWMEn_MASK (0xF0)
  77. #define PWM_POL_PPOLn(x) (1 << ((x) & 0x07))
  78. #define PWM_POL_PPOLn_MASK (0xF0)
  79. #define PWM_CLK_PCLKn(x) (1 << ((x) & 0x07))
  80. #define PWM_CLK_PCLKn_MASK (0xF0)
  81. #define PWM_PRCLK_PCKB(x) (((x) & 0x07) << 4)
  82. #define PWM_PRCLK_PCKB_MASK (0x8F)
  83. #define PWM_PRCLK_PCKA(x) ((x) & 0x07)
  84. #define PWM_PRCLK_PCKA_MASK (0xF8)
  85. #define PWM_CLK_PCLKn(x) (1 << ((x) & 0x07))
  86. #define PWM_CLK_PCLKn_MASK (0xF0)
  87. #define PWM_CTL_CON67 (0x80)
  88. #define PWM_CTL_CON45 (0x40)
  89. #define PWM_CTL_CON23 (0x20)
  90. #define PWM_CTL_CON01 (0x10)
  91. #define PWM_CTL_PSWAR (0x08)
  92. #define PWM_CTL_PFRZ (0x04)
  93. #define PWM_SDN_IF (0x80)
  94. #define PWM_SDN_IE (0x40)
  95. #define PWM_SDN_RESTART (0x20)
  96. #define PWM_SDN_LVL (0x10)
  97. #define PWM_SDN_PWM7IN (0x04)
  98. #define PWM_SDN_PWM7IL (0x02)
  99. #define PWM_SDN_SDNEN (0x01)
  100. #endif /* CONFIG_M5272 */
  101. #endif /* __ATA_H__ */