]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/include/asm/arch-s5pc1xx/pwm.h
Exynos542x: Add and enable get_periph_rate support
[u-boot] / arch / arm / include / asm / arch-s5pc1xx / pwm.h
index e02a8d8fb3a44d1422501b4d0d75b49269ba6284..7a33ed895b55d68c162858e2d92ff21b3616602a 100644 (file)
@@ -3,38 +3,34 @@
  * Kyungmin Park <kyungmin.park@samsung.com>
  * Minkyu Kang <mk7.kang@samsung.com>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef __ASM_ARM_ARCH_PWM_H_
 #define __ASM_ARM_ARCH_PWM_H_
 
-/* PWM timer addressing */
-#define S5PC100_TIMER_BASE     S5PC100_PWMTIMER_BASE
-#define S5PC110_TIMER_BASE     S5PC110_PWMTIMER_BASE
+#define PRESCALER_0            (8 - 1)         /* prescaler of timer 0, 1 */
+#define PRESCALER_1            (16 - 1)        /* prescaler of timer 2, 3, 4 */
+
+/* Divider MUX */
+#define MUX_DIV_1              0               /* 1/1 period */
+#define MUX_DIV_2              1               /* 1/2 period */
+#define MUX_DIV_4              2               /* 1/4 period */
+#define MUX_DIV_8              3               /* 1/8 period */
+#define MUX_DIV_16             4               /* 1/16 period */
+
+#define MUX_DIV_SHIFT(x)       (x * 4)
+
+#define TCON_OFFSET(x)         ((x + 1) * (!!x) << 2)
 
-/* Interval mode(Auto Reload) of PWM Timer 4 */
-#define S5PC1XX_TCON4_AUTO_RELOAD      (1 << 22)
-/* Update TCNTB4 */
-#define S5PC1XX_TCON4_UPDATE           (1 << 21)
-/* start bit of PWM Timer 4 */
-#define S5PC1XX_TCON4_START            (1 << 20)
+#define TCON_START(x)          (1 << TCON_OFFSET(x))
+#define TCON_UPDATE(x)         (1 << (TCON_OFFSET(x) + 1))
+#define TCON_INVERTER(x)       (1 << (TCON_OFFSET(x) + 2))
+#define TCON_AUTO_RELOAD(x)    (1 << (TCON_OFFSET(x) + 3))
+#define TCON4_AUTO_RELOAD      (1 << 22)
 
 #ifndef __ASSEMBLY__
-struct s5pc1xx_timer {
+struct s5p_timer {
        unsigned int    tcfg0;
        unsigned int    tcfg1;
        unsigned int    tcon;