From patchwork Mon Mar 18 18:26:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2294691 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 383F640AFD for ; Mon, 18 Mar 2013 18:26:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754321Ab3CRS0t (ORCPT ); Mon, 18 Mar 2013 14:26:49 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:49616 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754304Ab3CRS0r (ORCPT ); Mon, 18 Mar 2013 14:26:47 -0400 Received: from axis700.grange (dslb-088-077-165-235.pools.arcor-ip.net [88.77.165.235]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0Lq2aK-1UvNJ63RY0-00dkNc; Mon, 18 Mar 2013 19:26:45 +0100 Received: by axis700.grange (Postfix, from userid 1000) id 7C78E40BB4; Mon, 18 Mar 2013 19:26:44 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 79E1040BB3; Mon, 18 Mar 2013 19:26:44 +0100 (CET) Date: Mon, 18 Mar 2013 19:26:44 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-sh@vger.kernel.org cc: Simon Horman , Magnus Damm Subject: [PATCH/RFC 2/2] ARM: shmobile: kzm9g: add fixed voltage regulators for SDHI0 and SDHI2 In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Provags-ID: V02:K0:IafbqeIhFxQnRwjKmzH9f8Uc5eDyeIlOHQNIRx8U3aE WvzZSM6HnuasYygHHaDfDJ7bTJwI5oQikUI1Bby90wlXdTuP+i CzabMYU3bUOhfBdjkjl/3coYTojzFgjfeKYVxTOqkighpqLGn1 de4YIJNwDusM+/l1FaQ0IANTihDjhS7tA4pImctVpWh7uj7Qoz 0uOCNVD28dwhgRC9ffscIyVsghUd7CR0OkyBQ1pK0cYPBwbgSZ eboqHfFrPQGl3tP4mPIrWV0HXMewYs9TrVgr9dAwbcNTZrhiVc KgU9m+saY/OUv1jzTQhZcvDh5lEXuxHRfhmx3qY4yd3OtxyDr1 xq46ABF1JeRKgRa9x5X85Nae1y9KZredwNEyYiOIFPJYzY7Lvf O4zTnf6Kg1uLA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Both SDHI0 and SDHI2 power supplies on kzm9g can be switched on and off. In the current version this is not used and the regulators are hard-wired to "on." This patch switches SDHI0 and SDHI2 to proper fixed-voltage regulators, using GPIOs to enable and disable them. Both ports shall now be specifying the MMC_CAP_POWER_OFF_CARD MMC capability. Only SDHI0 has been tested with an SDIO card, since SDHI2 is a microSD slot. Signed-off-by: Guennadi Liakhovetski --- arch/arm/mach-shmobile/board-kzm9g.c | 76 +++++++++++++++++++++++++++------ 1 files changed, 62 insertions(+), 14 deletions(-) diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index 0b19d0c..ceabb44 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c @@ -376,13 +376,64 @@ static struct platform_device mmc_device = { .resource = sh_mmcif_resources, }; -/* Fixed 3.3V regulators to be used by SDHI0 and SDHI2 */ -static struct regulator_consumer_supply fixed3v3_power_consumers[] = +/* Fixed 3.3V regulators to be used by SDHI0 */ +static struct regulator_consumer_supply vcc_sdhi0_consumers[] = { REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), - REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), +}; + +static struct regulator_init_data vcc_sdhi0_init_data = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers), + .consumer_supplies = vcc_sdhi0_consumers, +}; + +static struct fixed_voltage_config vcc_sdhi0_info = { + .supply_name = "SDHI0 Vcc", + .microvolts = 3300000, + .gpio = 15, + .enable_high = 1, + .init_data = &vcc_sdhi0_init_data, +}; + +static struct platform_device vcc_sdhi0 = { + .name = "reg-fixed-voltage", + .id = 0, + .dev = { + .platform_data = &vcc_sdhi0_info, + }, +}; + +/* Fixed 3.3V regulators to be used by SDHI2 */ +static struct regulator_consumer_supply vcc_sdhi2_consumers[] = +{ REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"), - REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"), +}; + +static struct regulator_init_data vcc_sdhi2_init_data = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi2_consumers), + .consumer_supplies = vcc_sdhi2_consumers, +}; + +static struct fixed_voltage_config vcc_sdhi2_info = { + .supply_name = "SDHI2 Vcc", + .microvolts = 3300000, + .gpio = 14, + .enable_high = 1, + .init_data = &vcc_sdhi2_init_data, +}; + +static struct platform_device vcc_sdhi2 = { + .name = "reg-fixed-voltage", + .id = 1, + .dev = { + .platform_data = &vcc_sdhi2_info, + }, }; /* SDHI */ @@ -390,7 +441,8 @@ static struct sh_mobile_sdhi_info sdhi0_info = { .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, - .tmio_caps = MMC_CAP_SD_HIGHSPEED, + .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | + MMC_CAP_POWER_OFF_CARD, }; static struct resource sdhi0_resources[] = { @@ -433,7 +485,7 @@ static struct sh_mobile_sdhi_info sdhi2_info = { .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD | TMIO_MMC_WRPROTECT_DISABLE, - .tmio_caps = MMC_CAP_SD_HIGHSPEED, + .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_POWER_OFF_CARD, .cd_gpio = 13, }; @@ -732,6 +784,8 @@ static struct platform_device *kzm_devices[] __initdata = { &usbhs_device, &lcdc_device, &mmc_device, + &vcc_sdhi0, + &vcc_sdhi2, &sdhi0_device, &sdhi2_device, &gpio_keys_device, @@ -799,11 +853,9 @@ static const struct pinctrl_map kzm_pinctrl_map[] = { static void __init kzm_init(void) { - regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers, + regulator_register_always_on(2, "fixed-1.8V", fixed1v8_power_consumers, ARRAY_SIZE(fixed1v8_power_consumers), 1800000); - regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers, - ARRAY_SIZE(fixed3v3_power_consumers), 3300000); - regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies)); + regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies)); pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map)); @@ -821,10 +873,6 @@ static void __init kzm_init(void) /* enable SD */ gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL); - gpio_request_one(15, GPIOF_OUT_INIT_HIGH, NULL); /* power */ - - /* enable Micro SD */ - gpio_request_one(14, GPIOF_OUT_INIT_HIGH, NULL); /* power */ #ifdef CONFIG_CACHE_L2X0 /* Early BRESP enable, Shared attribute override enable, 64K*8way */