From patchwork Mon Dec 10 11:08:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 1857691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 927A33FCF2 for ; Mon, 10 Dec 2012 11:11:36 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Ti1De-0001s5-46; Mon, 10 Dec 2012 11:08:18 +0000 Received: from mail-bk0-f49.google.com ([209.85.214.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Ti1DZ-0001qs-NN for linux-arm-kernel@lists.infradead.org; Mon, 10 Dec 2012 11:08:15 +0000 Received: by mail-bk0-f49.google.com with SMTP id jm19so979554bkc.36 for ; Mon, 10 Dec 2012 03:08:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=R+xiFqZcrDsQ8S+eyDrJO/rb3GmD2qysXSxr2nmjPj0=; b=WAPx5FtDBzXiyjimCUqIe9UNjpevkT53AUxNRAcxWdnSjxhjSKAgHZpVaS1GO76pal UDr+kqvbNyJWbPJq7IBNBHVYYiaqLOMVD3bJwroUve3RD+orJ8+fBemyDMlhfxtv+xlv tWEaefWiH+aICcNLJ3aZIwamgJBkpkuYTcZF5dtzxxnmeQ9oZcued75t5uqn/BpA4Jph t7+xcPUJAY6AxycZpHeVw1ODI7H5/pVFmR3tY+4AXnI1l5FEoyMlHQWWfbdrS6nR6O35 e2e8nyMOSgOxLdy733pVfLUpquTB5ymb2P8YON0Kyp3wW+femSB9Mb972e20oTh2DkSr 1S+g== Received: by 10.204.9.23 with SMTP id j23mr4080507bkj.2.1355137691664; Mon, 10 Dec 2012 03:08:11 -0800 (PST) Received: from gmail.com (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id i20sm13578677bkw.5.2012.12.10.03.08.09 (version=SSLv3 cipher=OTHER); Mon, 10 Dec 2012 03:08:10 -0800 (PST) Date: Mon, 10 Dec 2012 11:08:07 +0000 From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/12 v2] ARM: ux500: Use the GPIO regulator framework for SDI0's 'en' and 'vsel' Message-ID: <20121210110807.GF9362@gmail.com> References: <1355129761-8088-1-git-send-email-lee.jones@linaro.org> <1355129761-8088-12-git-send-email-lee.jones@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1355129761-8088-12-git-send-email-lee.jones@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQnOwqbqjHrdiMDLjoQvf8XF0z+1/B/87Ckbq//1pslSN8G3RcxnWKcpaPLrI52tmioGXv7M X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121210_060814_061118_12B78D73 X-CRM114-Status: GOOD ( 20.77 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: ulf.hansson@linaro.org, linus.walleij@stericsson.com, arnd@arndb.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org To prevent lots of unnecessary call-backs into platform code, we're now using the GPIO regulator framework to control the 'enable' (en) and 'voltage select' (vsel) GPIO pins which in turn control the MMCI's secondary regulator settings. This already works with Device Tree, but when booting with ATAGs we need to register it as a platform device. Signed-off-by: Lee Jones --- arch/arm/mach-ux500/board-mop500-regulators.c | 14 ++++++++ arch/arm/mach-ux500/board-mop500-regulators.h | 1 + arch/arm/mach-ux500/board-mop500.c | 44 +++++++++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c index 2a17bc5..cb75405 100644 --- a/arch/arm/mach-ux500/board-mop500-regulators.c +++ b/arch/arm/mach-ux500/board-mop500-regulators.c @@ -28,6 +28,20 @@ struct regulator_init_data gpio_en_3v3_regulator = { .consumer_supplies = gpio_en_3v3_consumers, }; +static struct regulator_consumer_supply sdi0_reg_consumers[] = { + REGULATOR_SUPPLY("vqmmc", "sdi0"), +}; + +struct regulator_init_data sdi0_reg_init_data = { + .constraints = { + .min_uV = 1800000, + .max_uV = 2900000, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE|REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = ARRAY_SIZE(sdi0_reg_consumers), + .consumer_supplies = sdi0_reg_consumers, +}; + /* * TPS61052 regulator */ diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h index 78a0642..0c79d90 100644 --- a/arch/arm/mach-ux500/board-mop500-regulators.h +++ b/arch/arm/mach-ux500/board-mop500-regulators.h @@ -19,5 +19,6 @@ ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS]; extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS]; extern struct regulator_init_data tps61052_regulator; extern struct regulator_init_data gpio_en_3v3_regulator; +extern struct regulator_init_data sdi0_reg_init_data; #endif diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index daa4237..1d721ea 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include #include @@ -91,6 +93,37 @@ static struct platform_device snowball_gpio_en_3v3_regulator_dev = { }, }; +/* Dynamically populated. */ +static struct gpio sdi0_reg_gpios[] = { + { 0, GPIOF_OUT_INIT_LOW, "mmci_vsel" }, +}; + +static struct gpio_regulator_state sdi0_reg_states[] = { + { .value = 2900000, .gpios = (0 << 0) }, + { .value = 1800000, .gpios = (1 << 0) }, +}; + +static struct gpio_regulator_config sdi0_reg_info = { + .supply_name = "ab8500-ext-supply3", + .gpios = sdi0_reg_gpios, + .nr_gpios = ARRAY_SIZE(sdi0_reg_gpios), + .states = sdi0_reg_states, + .nr_states = ARRAY_SIZE(sdi0_reg_states), + .type = REGULATOR_VOLTAGE, + .enable_high = 1, + .enabled_at_boot = 0, + .init_data = &sdi0_reg_init_data, + .startup_delay = 100, +}; + +static struct platform_device sdi0_regulator = { + .name = "gpio-regulator", + .id = -1, + .dev = { + .platform_data = &sdi0_reg_info, + }, +}; + static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { .gpio_base = MOP500_AB8500_PIN_GPIO(1), .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE, @@ -440,6 +473,7 @@ static struct hash_platform_data u8500_hash1_platform_data = { /* add any platform devices here - TODO */ static struct platform_device *mop500_platform_devs[] __initdata = { &mop500_gpio_keys_device, + &sdi0_regulator, }; #ifdef CONFIG_STE_DMA40 @@ -581,6 +615,7 @@ static struct platform_device *snowball_platform_devs[] __initdata = { &snowball_key_dev, &snowball_sbnet_dev, &snowball_gpio_en_3v3_regulator_dev, + &sdi0_regulator, }; static void __init mop500_init_machine(void) @@ -591,6 +626,9 @@ static void __init mop500_init_machine(void) mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; + sdi0_reg_info.enable_gpio = GPIO_SDMMC_EN; + sdi0_reg_info.gpios[0].gpio = GPIO_SDMMC_1V8_3V_SEL; + mop500_pinmaps_init(); parent = u8500_init_devices(&ab8500_platdata); @@ -623,6 +661,9 @@ static void __init snowball_init_machine(void) struct device *parent = NULL; int i; + sdi0_reg_info.enable_gpio = SNOWBALL_SDMMC_EN_GPIO; + sdi0_reg_info.gpios[0].gpio = SNOWBALL_SDMMC_1V8_3V_GPIO; + snowball_pinmaps_init(); parent = u8500_init_devices(&ab8500_platdata); @@ -655,6 +696,9 @@ static void __init hrefv60_init_machine(void) */ mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; + sdi0_reg_info.enable_gpio = HREFV60_SDMMC_EN_GPIO; + sdi0_reg_info.gpios[0].gpio = HREFV60_SDMMC_1V8_3V_GPIO; + hrefv60_pinmaps_init(); parent = u8500_init_devices(&ab8500_platdata);