xref: /OK3568_Linux_fs/u-boot/arch/arm/include/asm/arch-sunxi/pwm.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * (C) Copyright 2016 Hans de Goede <hdegoede@redhat.com>
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0+
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #ifndef _SUNXI_PWM_H
8*4882a593Smuzhiyun #define _SUNXI_PWM_H
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #define SUNXI_PWM_CTRL_REG		(SUNXI_PWM_BASE + 0)
11*4882a593Smuzhiyun #define SUNXI_PWM_CH0_PERIOD		(SUNXI_PWM_BASE + 4)
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #define SUNXI_PWM_CTRL_PRESCALE0(x)	((x) & 0xf)
14*4882a593Smuzhiyun #define SUNXI_PWM_CTRL_ENABLE0		(0x5 << 4)
15*4882a593Smuzhiyun #define SUNXI_PWM_CTRL_POLARITY0(x)	((x) << 5)
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun #define SUNXI_PWM_PERIOD_80PCT		0x04af03c0
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun #if defined CONFIG_MACH_SUN4I || defined CONFIG_MACH_SUN5I
20*4882a593Smuzhiyun #define SUNXI_PWM_PIN0			SUNXI_GPB(2)
21*4882a593Smuzhiyun #define SUNXI_PWM_MUX			SUN4I_GPB_PWM
22*4882a593Smuzhiyun #endif
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun #if defined CONFIG_MACH_SUN6I
25*4882a593Smuzhiyun #define SUNXI_PWM_PIN0			SUNXI_GPH(13)
26*4882a593Smuzhiyun #define SUNXI_PWM_MUX			SUN6I_GPH_PWM
27*4882a593Smuzhiyun #endif
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun #if defined CONFIG_MACH_SUN8I_A23 || defined CONFIG_MACH_SUN8I_A33
30*4882a593Smuzhiyun #define SUNXI_PWM_PIN0			SUNXI_GPH(0)
31*4882a593Smuzhiyun #define SUNXI_PWM_MUX			SUN8I_GPH_PWM
32*4882a593Smuzhiyun #endif
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun #endif
35