Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / arm / include / asm / arch-sunxi / pwm.h
index 5884b5dbe7d460a0f98d60d029a271039b20ff07..b89bddd2e898d5f5ac83d72583751b2775f0946d 100644 (file)
@@ -1,18 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * (C) Copyright 2016 Hans de Goede <hdegoede@redhat.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef _SUNXI_PWM_H
 #define _SUNXI_PWM_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define SUNXI_PWM_CTRL_REG             (SUNXI_PWM_BASE + 0)
 #define SUNXI_PWM_CH0_PERIOD           (SUNXI_PWM_BASE + 4)
 
 #define SUNXI_PWM_CTRL_PRESCALE0(x)    ((x) & 0xf)
+#define SUNXI_PWM_CTRL_PRESCALE0_MASK  0xf
 #define SUNXI_PWM_CTRL_ENABLE0         (0x5 << 4)
 #define SUNXI_PWM_CTRL_POLARITY0(x)    ((x) << 5)
+#define SUNXI_PWM_CTRL_CH0_ACT_STA     BIT(5)
+#define SUNXI_PWM_CTRL_CLK_GATE                BIT(6)
+
+#define SUNXI_PWM_CH0_PERIOD_MAX       (0xffff)
+#define SUNXI_PWM_CH0_PERIOD_PRD(x)    ((x & 0xffff) << 16)
+#define SUNXI_PWM_CH0_PERIOD_DUTY(x)   ((x) & 0xffff)
 
 #define SUNXI_PWM_PERIOD_80PCT         0x04af03c0
 
@@ -31,4 +41,9 @@
 #define SUNXI_PWM_MUX                  SUN8I_GPH_PWM
 #endif
 
+struct sunxi_pwm {
+       u32 ctrl;
+       u32 ch0_period;
+};
+
 #endif