imx233: rewrite pwm using new registers

Change-Id: Ie222f0b25f4b8af9ccf21aecd82a7f4eba40aa3c
This commit is contained in:
Amaury Pouly 2013-06-16 17:19:20 +02:00
parent 7c5b65b9d2
commit 3e8c2dc46d
4 changed files with 18 additions and 43 deletions

View file

@ -23,38 +23,15 @@
#include "system.h"
#define HW_PWM_BASE 0x80064000
#include "regs/regs-pwm.h"
#define HW_PWM_CTRL (*(volatile uint32_t *)(HW_PWM_BASE + 0x0))
#define HW_PWM_CTRL__PWMx_ENABLE(x) (1 << (x))
/* fake field for simpler programming */
#define BP_PWM_CTRL_PWMx_ENABLE(x) (x)
#define BM_PWM_CTRL_PWMx_ENABLE(x) (1 << (x))
#define HW_PWM_ACTIVEx(x) (*(volatile uint32_t *)(HW_PWM_BASE + 0x10 + (x) * 0x20))
#define HW_PWM_ACTIVEx__ACTIVE_BP 0
#define HW_PWM_ACTIVEx__ACTIVE_BM 0xffff
#define HW_PWM_ACTIVEx__INACTIVE_BP 16
#define HW_PWM_ACTIVEx__INACTIVE_BM 0xffff0000
#define IMX233_PWM_MAX_PERIOD (1 << 16)
#define HW_PWM_PERIODx(x) (*(volatile uint32_t *)(HW_PWM_BASE + 0x20 + (x) * 0x20))
#define HW_PWM_PERIODx__PERIOD_BP 0
#define HW_PWM_PERIODx__PERIOD_BM 0xffff
#define HW_PWM_PERIODx__ACTIVE_STATE_BP 16
#define HW_PWM_PERIODx__ACTIVE_STATE_BM (0x3 << 16)
#define HW_PWM_PERIODx__INACTIVE_STATE_BP 18
#define HW_PWM_PERIODx__INACTIVE_STATE_BM (0x3 << 18)
#define HW_PWM_PERIODx__CDIV_BP 20
#define HW_PWM_PERIODx__CDIV_BM (0x7 << 20)
#define HW_PWM_PERIODx__CDIV__DIV_1 0
#define HW_PWM_PERIODx__CDIV__DIV_2 1
#define HW_PWM_PERIODx__CDIV__DIV_4 2
#define HW_PWM_PERIODx__CDIV__DIV_8 3
#define HW_PWM_PERIODx__CDIV__DIV_16 4
#define HW_PWM_PERIODx__CDIV__DIV_64 5
#define HW_PWM_PERIODx__CDIV__DIV_256 6
#define HW_PWM_PERIODx__CDIV__DIV_1024 7
#define HW_PWM_PERIODx__STATE__HI_Z 0
#define HW_PWM_PERIODx__STATE__LOW 2
#define HW_PWM_PERIODx__STATE__HIGH 3
#define IMX233_PWM_NR_CHANNELS 5
#define IMX233_PWM_PIN_BANK(channel) 1
#define IMX233_PWM_PIN(channel) (26 + (channel))