From patchwork Fri May 31 09:18:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 17324 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0CD5925CAB for ; Fri, 31 May 2013 09:20:41 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id n10sf1519923qcx.7 for ; Fri, 31 May 2013 02:20:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :mime-version:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=cqLM6HBmrF9eWuuBjhZvMTDb0HOqtYEhSzRtVOsfNqY=; b=cF3LunFhY+ny9H0t+9TvBucwPMFhi82SAFr83Cz4nfWD2s7RmWCEFhtXKwCYBl2psH WIDqEFmSqFEp+90z6LUI56VfaJiDRnGI05s+sa5vL52kbe0B4k7wmq4SnYvVayIRnqhX 7ZphpIcxsKb3ZTRvv5sy748T2DdTWaeyOMJFq2O3pNAq8sqklMt46uUd9x4e87ZyDJcp IM/gidcgC63xus8kwAoZgI6Qo+JT3S3WtG3NLeTXlQ9HvIsCmoILsyUszWj6y0oV4GCy X8v1gM65Q+3e513xWxpu1WyjJwh8mzCbRhbGL9bqzh8kg/VWSx8NbsvNp5A1JIMda3zk HxtA== X-Received: by 10.224.36.66 with SMTP id s2mr6287659qad.6.1369992040885; Fri, 31 May 2013 02:20:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.14.103 with SMTP id o7ls851482qec.9.gmail; Fri, 31 May 2013 02:20:40 -0700 (PDT) X-Received: by 10.58.30.115 with SMTP id r19mr9390660veh.26.1369992040613; Fri, 31 May 2013 02:20:40 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id ad7si27819670vdc.68.2013.05.31.02.20.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 May 2013 02:20:40 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id ia10so224495vcb.8 for ; Fri, 31 May 2013 02:20:40 -0700 (PDT) X-Received: by 10.220.10.212 with SMTP id q20mr9466830vcq.9.1369992040466; Fri, 31 May 2013 02:20:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.229.199 with SMTP id jj7csp42401vcb; Fri, 31 May 2013 02:20:39 -0700 (PDT) X-Received: by 10.14.221.3 with SMTP id q3mr1847055eep.149.1369992039398; Fri, 31 May 2013 02:20:39 -0700 (PDT) Received: from eu1sys200aog114.obsmtp.com (eu1sys200aog114.obsmtp.com [207.126.144.137]) by mx.google.com with SMTP id 7si29973569eeb.325.2013.05.31.02.20.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 May 2013 02:20:39 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.137 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.137; Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob114.postini.com ([207.126.147.11]) with SMTP ID DSNKUahrTSgwBbupqSYKY3NgDKjzT02Cp2q/@postini.com; Fri, 31 May 2013 09:20:39 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B4F6526E; Fri, 31 May 2013 09:20:09 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 269D54A31; Fri, 31 May 2013 09:19:52 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id CA43524C07C; Fri, 31 May 2013 11:20:03 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.279.5; Fri, 31 May 2013 11:20:08 +0200 From: Linus Walleij To: Cc: Arnd Bergmann , Linus Walleij , Mark Brown Subject: [PATCH 12/39] ARM: u300: set up board power from device tree Date: Fri, 31 May 2013 11:18:47 +0200 Message-ID: <1369991954-17406-13-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: <1369991954-17406-1-git-send-email-linus.walleij@stericsson.com> References: <1369991954-17406-1-git-send-email-linus.walleij@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkHREJxKU4ubVywk4KqykFXqm2+PwWqQQuEaxe0TqD7NyybIC6uIPrR9HqFtfZCGvJm56D8 X-Original-Sender: linus.walleij@stericsson.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Linus Walleij This adds support for setting up the board power from the device tree on the U300. We use a board-specific node in the device tree for the S365 board and bind a regulator for the board power to this node. Cc: Mark Brown Signed-off-by: Linus Walleij --- Documentation/devicetree/bindings/arm/ste-u300.txt | 13 +++++++ arch/arm/mach-u300/regulator.c | 42 ++++++++++++++++++++-- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/ste-u300.txt b/Documentation/devicetree/bindings/arm/ste-u300.txt index 222dca5..cd9001a 100644 --- a/Documentation/devicetree/bindings/arm/ste-u300.txt +++ b/Documentation/devicetree/bindings/arm/ste-u300.txt @@ -7,3 +7,16 @@ or board power regulator supplies. Required root node property: compatible="stericsson,u300"; + +Boards with the U300 SoC include: + +S365 "Small Board U365": + +Required node: s365 + +Example: + +s365 { + compatible = "stericsson,s365"; + vana15-supply = <&ab3100_ldo_d_reg>; +}; diff --git a/arch/arm/mach-u300/regulator.c b/arch/arm/mach-u300/regulator.c index 9c53f01..8a67dc6 100644 --- a/arch/arm/mach-u300/regulator.c +++ b/arch/arm/mach-u300/regulator.c @@ -10,9 +10,14 @@ #include #include #include +#include +#include +#include +#include #include /* Those are just for writing in syscon */ #include +#include #include #include @@ -47,13 +52,17 @@ void u300_pm_poweroff(void) /* * Hog the regulators needed to power up the board. */ -static int __init u300_init_boardpower(void) +static int __init __u300_init_boardpower(struct platform_device *pdev) { int err; u32 val; pr_info("U300: setting up board power\n"); - main_power_15 = regulator_get(NULL, "vana15"); + if (pdev) + main_power_15 = regulator_get(&pdev->dev, "vana15"); + else + main_power_15 = regulator_get(NULL, "vana15"); + if (IS_ERR(main_power_15)) { pr_err("could not get vana15"); return PTR_ERR(main_power_15); @@ -82,7 +91,34 @@ static int __init u300_init_boardpower(void) return 0; } +static int __init s365_board_probe(struct platform_device *pdev) +{ + return __u300_init_boardpower(pdev); +} + +static const struct of_device_id s365_board_match[] = { + { .compatible = "stericsson,s365" }, + {}, +}; + +static struct platform_driver s365_board_driver = { + .driver = { + .name = "s365-board", + .owner = THIS_MODULE, + .of_match_table = s365_board_match, + }, +}; + /* * So at module init time we hog the regulator! */ -module_init(u300_init_boardpower); +static int __init u300_init_boardpower(void) +{ + if (of_have_populated_dt()) + return platform_driver_probe(&s365_board_driver, + s365_board_probe); + /* Only call this on non-DT boots */ + return __u300_init_boardpower(NULL); +} + +device_initcall(u300_init_boardpower);