From: 黄涛 Date: Tue, 5 Mar 2013 03:54:11 +0000 (+0800) Subject: rk3066b: grf add io power domain voltage api X-Git-Tag: firefly_0821_release~7481 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=23de822f963d0bff990494618d67eca8aad9f0bb;p=firefly-linux-kernel-4.4.55.git rk3066b: grf add io power domain voltage api --- diff --git a/arch/arm/mach-rk30/include/mach/grf-rk3066b.h b/arch/arm/mach-rk30/include/mach/grf-rk3066b.h index f796d4db65aa..6df6821eeeab 100644 --- a/arch/arm/mach-rk30/include/mach/grf-rk3066b.h +++ b/arch/arm/mach-rk30/include/mach/grf-rk3066b.h @@ -1,6 +1,8 @@ #ifndef __MACH_GRF_RK3066B_H #define __MACH_GRF_RK3066B_H +#include + #define GRF_GPIO0L_DIR 0x0000 #define GRF_GPIO0H_DIR 0x0004 #define GRF_GPIO1L_DIR 0x0008 @@ -81,4 +83,31 @@ #define GRF_OS_REG6 0x015c #define GRF_OS_REG7 0x0160 +enum grf_io_power_domain_voltage { + IO_PD_VOLTAGE_3_3V = 0, + IO_PD_VOLTAGE_1_8V = 1, +}; + +enum grf_io_power_domain { + IO_PD_AP0 = 8, + IO_PD_AP1, + IO_PD_CIF, + IO_PD_FLASH, + IO_PD_VCCIO0, + IO_PD_VCCIO1, + IO_PD_LCDC0, + IO_PD_LCDC1, +}; + +static inline void grf_set_io_power_domain_voltage(enum grf_io_power_domain pd, enum grf_io_power_domain_voltage volt) +{ + writel_relaxed((0x10000 + volt) << pd, RK30_GRF_BASE + GRF_IO_CON4); + dsb(); +} + +static inline enum grf_io_power_domain_voltage grf_get_io_power_domain_voltage(enum grf_io_power_domain pd) +{ + return (readl_relaxed(RK30_GRF_BASE + GRF_IO_CON4) >> pd) & 1; +} + #endif