From e2b36fb662531c94c201637d39fada11b6d5abbe Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Tue, 5 Mar 2013 11:54:28 +0800 Subject: [PATCH] rk3188: grf add io power domain voltage api --- arch/arm/mach-rk3188/include/mach/grf.h | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/arch/arm/mach-rk3188/include/mach/grf.h b/arch/arm/mach-rk3188/include/mach/grf.h index 288e813249dd..a76496d10a7c 100644 --- a/arch/arm/mach-rk3188/include/mach/grf.h +++ b/arch/arm/mach-rk3188/include/mach/grf.h @@ -1,6 +1,8 @@ #ifndef __MACH_GRF_H #define __MACH_GRF_H +#include + #define GRF_GPIO0L_DIR 0x0000 #define GRF_GPIO0H_DIR 0x0004 #define GRF_GPIO1L_DIR 0x0008 @@ -108,4 +110,31 @@ #define GRF_FLASH_DATA_PULL 0x01a0 #define GRF_FLASH_CMD_PULL 0x01a4 +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 -- 2.34.1