From: David Wu Date: Fri, 26 Feb 2016 10:07:01 +0000 (+0800) Subject: POWER: AVS: rockchp: add rk3366 io domain supprot X-Git-Tag: firefly_0821_release~3349 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=16f09683b6e6cf71612b0979bc941e6f9e365e4c;p=firefly-linux-kernel-4.4.55.git POWER: AVS: rockchp: add rk3366 io domain supprot Change-Id: I64eb48ee7e161306b941a851585c50a1ee0edae2 Signed-off-by: David Wu --- diff --git a/Documentation/devicetree/bindings/power/rockchip-io-domain.txt b/Documentation/devicetree/bindings/power/rockchip-io-domain.txt index b8627e763dba..2d2ea68e760b 100644 --- a/Documentation/devicetree/bindings/power/rockchip-io-domain.txt +++ b/Documentation/devicetree/bindings/power/rockchip-io-domain.txt @@ -33,6 +33,7 @@ Required properties: - compatible: should be one of: - "rockchip,rk3188-io-voltage-domain" for rk3188 - "rockchip,rk3288-io-voltage-domain" for rk3288 + - "rockchip,rk3366-io-voltage-domain" for rk3366 - "rockchip,rk3368-io-voltage-domain" for rk3368 - "rockchip,rk3368-pmu-io-voltage-domain" for rk3368 pmu-domains - rockchip,grf: phandle to the syscon managing the "general register files" @@ -66,6 +67,15 @@ Possible supplies for rk3288: - sdcard-supply: The supply connected to SDMMC0_VDD. - wifi-supply: The supply connected to APIO3_VDD. Also known as SDIO0. +Possible supplies for rk3366: +- lcdc-supply: The supply connected to LCDC_IOVDD. +- dvpts-supply: The supply connected to DVP_IOVDD. +- flash-supply: The supply connected to FLASH_IOVDD. Typically for eMMC +- wifibt-supply: The supply connected to APIO1_VDD. Also known as SDIO and UART0. +- audio-supply: The supply connected to AUDIO_IOVDD. +- sdcard-supply: The supply connected to SDMMC0_VDD. +- tphdsor-suply: The supply connected to APIO2_IOVDD. + Possible supplies for rk3368: - audio-supply: The supply connected to APIO3_VDD. - dvp-supply: The supply connected to DVPIO_VDD. diff --git a/drivers/power/avs/rockchip-io-domain.c b/drivers/power/avs/rockchip-io-domain.c index 80994566a1c8..909412428645 100644 --- a/drivers/power/avs/rockchip-io-domain.c +++ b/drivers/power/avs/rockchip-io-domain.c @@ -43,6 +43,10 @@ #define RK3288_SOC_CON2_FLASH0 BIT(7) #define RK3288_SOC_FLASH_SUPPLY_NUM 2 +#define RK3366_SOC_CON6 0x418 +#define RK3366_SOC_CON6_FLASH0 BIT(14) +#define RK3366_SOC_FLASH_SUPPLY_NUM 2 + #define RK3368_SOC_CON15 0x43c #define RK3368_SOC_CON15_FLASH0 BIT(14) #define RK3368_SOC_FLASH_SUPPLY_NUM 2 @@ -162,6 +166,25 @@ static void rk3288_iodomain_init(struct rockchip_iodomain *iod) dev_warn(iod->dev, "couldn't update flash0 ctrl\n"); } +static void rk3366_iodomain_init(struct rockchip_iodomain *iod) +{ + int ret; + u32 val; + + /* if no flash supply we should leave things alone */ + if (!iod->supplies[RK3366_SOC_FLASH_SUPPLY_NUM].reg) + return; + + /* + * set flash0 iodomain to also use this framework + * instead of a special gpio. + */ + val = RK3366_SOC_CON6_FLASH0 | (RK3366_SOC_CON6_FLASH0 << 16); + ret = regmap_write(iod->grf, RK3368_SOC_CON15, val); + if (ret < 0) + dev_warn(iod->dev, "couldn't update flash0 ctrl\n"); +} + static void rk3368_iodomain_init(struct rockchip_iodomain *iod) { int ret; @@ -224,6 +247,21 @@ static const struct rockchip_iodomain_soc_data soc_data_rk3288 = { .init = rk3288_iodomain_init, }; +static const struct rockchip_iodomain_soc_data soc_data_rk3366 = { + .grf_offset = 0x900, + .supply_names = { + "lcdc", /* LCDC_IOVDD */ + "dvpts", /* DVP_IOVDD */ + "flash", /* FLASH_IOVDD (emmc) */ + "wifibt", /* APIO1_IOVDD */ + NULL, + "audio", /* AUDIO_IODVDD */ + "sdcard", /* SDMMC_IOVDD (sdmmc) */ + "tphdsor", /* APIO2_IOVDD */ + }, + .init = rk3366_iodomain_init, +}; + static const struct rockchip_iodomain_soc_data soc_data_rk3368 = { .grf_offset = 0x900, .supply_names = { @@ -261,6 +299,10 @@ static const struct of_device_id rockchip_iodomain_match[] = { .compatible = "rockchip,rk3288-io-voltage-domain", .data = (void *)&soc_data_rk3288 }, + { + .compatible = "rockchip,rk3366-io-voltage-domain", + .data = (void *)&soc_data_rk3366 + }, { .compatible = "rockchip,rk3368-io-voltage-domain", .data = (void *)&soc_data_rk3368