From patchwork Fri Jun 2 08:51:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guodong Xu X-Patchwork-Id: 100993 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp284225qge; Fri, 2 Jun 2017 01:53:03 -0700 (PDT) X-Received: by 10.98.61.207 with SMTP id x76mr5663133pfj.170.1496393583170; Fri, 02 Jun 2017 01:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496393583; cv=none; d=google.com; s=arc-20160816; b=BgENRVL0kn/dDvAHUgrgSOjIhgPifWj3ZvTvtYabFj5XbytHN2TUK5XOZlqktPhMLl TxNcdAb+J4iFicCDIQEch3Xs5c7qgt8bajR6GlA2f2CmQi0K+p21qAtI/GEXHUadB6WH KHgg4RPpDSnDZhHxLHYTheLef+/iTgP2MY6rTuzJvC9TdEdYJtA/Bf9+DkKStcO3xKF8 yQnLSB6VJfyd/ePCTlBMaAuCOvhYejPs0rfUnrioZjABqu2cFAKhVPE33Wgsl6WksdTd K72bFhsiH1TAcU56mTuIY8Hc8P1nAmHG3oS9sxv1US7uImiHuJ+h7DiNW/BDZzDdCJwP jBeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=PP+cxYzx+epasFaiqQEisBX9xZNKkFJu+vGxkefemZg=; b=TAmNw7eOCTXkNgJfu7rVuxNvThxhBQNTPbmfqB+QH2CeCsbz0ea02Wc5Nc2Pxd3sRg iJ8izBIYsi9YhybAGN4MmnqxuOxSRO9Qh8jgiDwYhczQkZBUncG1forhVkste3aphxRP iCF1Pf4LjNOMl9F1v6DEamHUkbR58nC+iLhH/m+zSEG5Pq7mEYI7MdiqeQ7jEnuqDbcI quMj4AFylutKXeBZZ/lN+4AuKs00Z/rGDCs6kn1w3/lYp5E8zReaL076LKYcdfB7QLtS b7JAe7AMEfaushbZT0RNSw0UzPL5IhhBM10l/7sZeHTdfxf94XXYJooUONQcK/mGF9gQ d1cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si22455191pgc.250.2017.06.02.01.53.02; Fri, 02 Jun 2017 01:53:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751135AbdFBIw7 (ORCPT + 7 others); Fri, 2 Jun 2017 04:52:59 -0400 Received: from mail-it0-f50.google.com ([209.85.214.50]:36788 "EHLO mail-it0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751130AbdFBIw5 (ORCPT ); Fri, 2 Jun 2017 04:52:57 -0400 Received: by mail-it0-f50.google.com with SMTP id m47so547212iti.1 for ; Fri, 02 Jun 2017 01:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Sa12Nv5YBukV+hPJxqhHiZsqERRqdABGIuyF78gOPnQ=; b=Hhro04DaG3UmFicZdnvFnp63DCEj3IUqXlkV8bjYA0+E7E8SNfBQ48R1uZDQxJfmqX zN7ATtx2kY4Y9K60MI+UnNbpwBajMteI9tYOEKnXaABrwYJfIOYM2Q9E3xX8dT/FtO5F EyXFsFtbx+uNvywpnY7/IdZF43mBjqBCfqxLA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Sa12Nv5YBukV+hPJxqhHiZsqERRqdABGIuyF78gOPnQ=; b=Z0SSali8FY7aW3Q/ibyRrWaQQaDY+lNua/dlV8imXgPfKYFx8eEKVQQp1HX1EXRP8K C5YusRuBB1r1gX4GrjDMA4uy+na/xbJVNGzQofNROjrehuhAbqeGTImE0gkoOLEXmpBh OexkGUEecTHeAGptydJwGkKUKU1A1qLuCmMt1RUHaNM4ys1IX6R/iemEx6llOG6Zx6ts lspPNKchRDUNHrbCZdxoX9Sy50Qbuj0qEcKN692pLz+VXiWRKsjBnRrwV9k1ll//w/PU qkCuc/e+96b2XNJoct4mgBkwvLyLCd5Ttn59FNks4HHFWstlP/J/yULw/ORirvb9Ktg/ 3j9g== X-Gm-Message-State: AODbwcBwL5wi6mfbE5lRxL3CXv/WBdbl/d7PdP4DyTDQaq3xsxxoAF6H pvCBcy7XVpBL6zpe X-Received: by 10.99.139.194 with SMTP id j185mr6033546pge.126.1496393513918; Fri, 02 Jun 2017 01:51:53 -0700 (PDT) Received: from localhost.localdomain ([45.56.159.223]) by smtp.gmail.com with ESMTPSA id d185sm32608146pgc.39.2017.06.02.01.51.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Jun 2017 01:51:53 -0700 (PDT) From: Guodong Xu To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, xuwei5@hisilicon.com, catalin.marinas@arm.com, will.deacon@arm.com, lgirdwood@gmail.com, broonie@kernel.org, khilman@baylibre.com, arnd@arndb.de, gregory.clement@free-electrons.com, horms+renesas@verge.net.au, olof@lixom.net, thomas.petazzoni@free-electrons.com, yamada.masahiro@socionext.com, riku.voipio@linaro.org, treding@nvidia.com, krzk@kernel.org, eric@anholt.net, damm+renesas@opensource.se, ard.biesheuvel@linaro.org, linus.walleij@linaro.org, geert+renesas@glider.be Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, hw.wangxiaoyin@hisilicon.com, Guodong Xu Subject: [PATCH v2 2/6] mfd: hi6421-pmic: add support for HiSilicon Hi6421v530 Date: Fri, 2 Jun 2017 16:51:13 +0800 Message-Id: <20170602085117.27474-3-guodong.xu@linaro.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170602085117.27474-1-guodong.xu@linaro.org> References: <20170602085117.27474-1-guodong.xu@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add support for HiSilicon Hi6421v530 PMIC. Hi6421v530 communicates with main SoC via memory-mapped I/O. Hi6421v530 and Hi6421 are PMIC chips from the same vendor, HiSilicon, but at different revisions. They share the same memory-mapped I/O design. They differ in integrated devices, such as regulator details, LDO voltage points. Signed-off-by: Wang Xiaoyin Signed-off-by: Guodong Xu --- drivers/mfd/hi6421-pmic-core.c | 56 +++++++++++++++++++++++++++++++---------- include/linux/mfd/hi6421-pmic.h | 5 ++++ 2 files changed, 48 insertions(+), 13 deletions(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mfd/hi6421-pmic-core.c b/drivers/mfd/hi6421-pmic-core.c index 3fd703f..6d40485 100644 --- a/drivers/mfd/hi6421-pmic-core.c +++ b/drivers/mfd/hi6421-pmic-core.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -35,6 +35,10 @@ static const struct mfd_cell hi6421_devs[] = { { .name = "hi6421-regulator", }, }; +static const struct mfd_cell hi6421v530_devs[] = { + { .name = "hi6421v530-regulator", }, +}; + static const struct regmap_config hi6421_regmap_config = { .reg_bits = 32, .reg_stride = 4, @@ -42,12 +46,30 @@ static const struct regmap_config hi6421_regmap_config = { .max_register = HI6421_REG_TO_BUS_ADDR(HI6421_REG_MAX), }; +static const struct of_device_id of_hi6421_pmic_match_tbl[] = { + { .compatible = "hisilicon,hi6421-pmic", + .data = (void *)HI6421 }, + { .compatible = "hisilicon,hi6421v530-pmic", + .data = (void *)HI6421_V530 }, + { }, +}; +MODULE_DEVICE_TABLE(of, of_hi6421_pmic_match_tbl); + static int hi6421_pmic_probe(struct platform_device *pdev) { struct hi6421_pmic *pmic; struct resource *res; void __iomem *base; - int ret; + const struct of_device_id *id; + unsigned long type; + const struct mfd_cell *subdevs = NULL; + int n_subdevs, ret; + + id = of_match_device(of_hi6421_pmic_match_tbl, &pdev->dev); + if (id) + type = (unsigned long)id->data; + else + return -EINVAL; pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); if (!pmic) @@ -66,18 +88,32 @@ static int hi6421_pmic_probe(struct platform_device *pdev) return PTR_ERR(pmic->regmap); } - /* set over-current protection debounce 8ms */ - regmap_update_bits(pmic->regmap, HI6421_OCP_DEB_CTRL_REG, + platform_set_drvdata(pdev, pmic); + + switch (type) { + case HI6421: + /* set over-current protection debounce 8ms */ + regmap_update_bits(pmic->regmap, HI6421_OCP_DEB_CTRL_REG, (HI6421_OCP_DEB_SEL_MASK | HI6421_OCP_EN_DEBOUNCE_MASK | HI6421_OCP_AUTO_STOP_MASK), (HI6421_OCP_DEB_SEL_8MS | HI6421_OCP_EN_DEBOUNCE_ENABLE)); - platform_set_drvdata(pdev, pmic); + subdevs = hi6421_devs; + n_subdevs = ARRAY_SIZE(hi6421_devs); + break; + case HI6421_V530: + subdevs = hi6421v530_devs; + n_subdevs = ARRAY_SIZE(hi6421v530_devs); + break; + default: + dev_err(&pdev->dev, "Unknown device type %ld\n", type); + return -EINVAL; + } - ret = devm_mfd_add_devices(&pdev->dev, 0, hi6421_devs, - ARRAY_SIZE(hi6421_devs), NULL, 0, NULL); + ret = devm_mfd_add_devices(&pdev->dev, 0, subdevs, + n_subdevs, NULL, 0, NULL); if (ret) { dev_err(&pdev->dev, "add mfd devices failed: %d\n", ret); return ret; @@ -86,12 +122,6 @@ static int hi6421_pmic_probe(struct platform_device *pdev) return 0; } -static const struct of_device_id of_hi6421_pmic_match_tbl[] = { - { .compatible = "hisilicon,hi6421-pmic", }, - { }, -}; -MODULE_DEVICE_TABLE(of, of_hi6421_pmic_match_tbl); - static struct platform_driver hi6421_pmic_driver = { .driver = { .name = "hi6421_pmic", diff --git a/include/linux/mfd/hi6421-pmic.h b/include/linux/mfd/hi6421-pmic.h index 587273e..2457438 100644 --- a/include/linux/mfd/hi6421-pmic.h +++ b/include/linux/mfd/hi6421-pmic.h @@ -38,4 +38,9 @@ struct hi6421_pmic { struct regmap *regmap; }; +enum hi6421_type { + HI6421 = 1, + HI6421_V530 = 2, +}; + #endif /* __HI6421_PMIC_H */ From patchwork Fri Jun 2 08:51:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guodong Xu X-Patchwork-Id: 100992 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp284077qge; Fri, 2 Jun 2017 01:52:36 -0700 (PDT) X-Received: by 10.98.215.86 with SMTP id v22mr2355186pfl.204.1496393556196; Fri, 02 Jun 2017 01:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496393556; cv=none; d=google.com; s=arc-20160816; b=hss3wjbhBLDhdfyloEpIVyfW8cEzQRZ7bDdIvmYo6CzJLCIVzhLjOfpIKSv+6w1RtA ngb9tCLxk0e2x0N69bYEwEV8ZVnCWCH3ahI11mIKgt3ThFt3YSIOrr7x12NBz6/vMYYd 5XHm3INzDmSC/DsCykIqlKVTyEoY2LScvXo1SGWp28wzCyzaVDU5E4HPd/Szuj/2umeo SIxPaK7PcYdz2Q+kQfJOlEEw6TPASUPaACtt9uXOvhjP0yR36lBjykC5l3+H6587V3bX z1x+mwj12/XP/VZ73n95QbTY/tcl+oqh0pDu/4jdppdZn/4WNbI/WKLLskZcZid4lUJ8 h8BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=nRH0EYhNaOjQOky/Ja2bHQt05Ey5SkT6lPixFBQhdlQ=; b=PfPNMQF7eX8PCmOTpaJecmHKkX5JpRpO9QCBDgNfyNxNoSDwRzI8inlIZrJrDdSQXg IJgkMoEoCR7qs70K0knG8Yxm3LmDHC197pltIKzs3UBNiCm6oTV8dYJxXGZdzZF9jtMI WKLc8BAFAC5VMYDU82LVG6u38kFHutAgL15A/eIYJ7GPTv6vdGDISatljbOANenLS1JG 6ufgGn7gvw16CQiiRdmlw7XoEKCiLU4atiO07CvBs9YtpgMzLRHetk3LBa/WL1Wqe4DG NU70NQcSBTOfZsNjsBSPfbFsjsXceTQDJR7e9GmH4AkJiywnYM8D+F8qyMspsPNvmGv3 Cz7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h186si3082967pge.75.2017.06.02.01.52.35; Fri, 02 Jun 2017 01:52:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751240AbdFBIwd (ORCPT + 7 others); Fri, 2 Jun 2017 04:52:33 -0400 Received: from mail-it0-f46.google.com ([209.85.214.46]:37584 "EHLO mail-it0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbdFBIw3 (ORCPT ); Fri, 2 Jun 2017 04:52:29 -0400 Received: by mail-it0-f46.google.com with SMTP id m47so10936551iti.0 for ; Fri, 02 Jun 2017 01:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bJ/hpgaPnLB+1LwhHJruX3y4DoWHlZP3v8EUwQDNn0k=; b=VS2hf8NhwMQlwliM7XQdGnHKzLW1eahsgdHYz1kmxSx4suZiSBVFtxgk3M+yBTpFqP 4Br4BfpHrEkYQTjg4CLw9npRm+6m7Bf8PUmKa79F6QnBpPdFySnkINYQHfXWCLJcvqWn c0+nHrHdYyTe13UpTvJnDPyMjrAd/luiV583k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bJ/hpgaPnLB+1LwhHJruX3y4DoWHlZP3v8EUwQDNn0k=; b=PyiBmnHP8E53eeBtQxVngzuw43RAVUn9DNDVLvp3VgfMJKNo33tK4yAH3yGGZ0YRcH zu8rASIpkIK0S+5X7Olh2GG9kYnh7jVtTmg0N5g1VB/C0S071FjVrBxAWDgS3X+XBVZP qeou48f07oLS6OHV9xnoWsq4N8DQ4RQiaklc7gz731UclHnNnlrHcfmpJOZuIMuhZDH4 gJOo8900ZJy4cZiycG0rGwKmsJK8Q9LZqs/UP5KAjmORogDwO/AyioA3dQVdwzu0L6Da uF/TGR+J8vPzc1d1tdlmVtCJ8rUo6wLBhlFkGohQkaxnChjz8TlHbbaC0RVA0isYA/Md YUYw== X-Gm-Message-State: AODbwcCjMcHFcLiaHflylaCgqh1oMdBkeMRvoEye6XkCacW88SeEQppl EH15o+igTqoMPuLH X-Received: by 10.99.146.86 with SMTP id s22mr1312292pgn.85.1496393538395; Fri, 02 Jun 2017 01:52:18 -0700 (PDT) Received: from localhost.localdomain ([45.56.159.223]) by smtp.gmail.com with ESMTPSA id d185sm32608146pgc.39.2017.06.02.01.52.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Jun 2017 01:52:17 -0700 (PDT) From: Guodong Xu To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, xuwei5@hisilicon.com, catalin.marinas@arm.com, will.deacon@arm.com, lgirdwood@gmail.com, broonie@kernel.org, khilman@baylibre.com, arnd@arndb.de, gregory.clement@free-electrons.com, horms+renesas@verge.net.au, olof@lixom.net, thomas.petazzoni@free-electrons.com, yamada.masahiro@socionext.com, riku.voipio@linaro.org, treding@nvidia.com, krzk@kernel.org, eric@anholt.net, damm+renesas@opensource.se, ard.biesheuvel@linaro.org, linus.walleij@linaro.org, geert+renesas@glider.be Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, hw.wangxiaoyin@hisilicon.com, Guodong Xu Subject: [PATCH v2 5/6] arm64: dts: hikey960: add device node for pmic and regulators Date: Fri, 2 Jun 2017 16:51:16 +0800 Message-Id: <20170602085117.27474-6-guodong.xu@linaro.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170602085117.27474-1-guodong.xu@linaro.org> References: <20170602085117.27474-1-guodong.xu@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Wang Xiaoyin add device node for hi6421 pmic core and hi6421v530 voltage regulator,include LDO(1,3,9,11,15,16) Signed-off-by: Wang Xiaoyin Signed-off-by: Guodong Xu --- arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts | 46 +++++++++++++++++++++++ 1 file changed, 46 insertions(+) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts index ca448f0..9da8375 100644 --- a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +++ b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts @@ -97,6 +97,52 @@ default-state = "off"; }; }; + + pmic: pmic@fff34000 { + compatible = "hisilicon,hi6421v530-pmic"; + reg = <0x0 0xfff34000 0x0 0x1000>; + interrupt-controller; + #interrupt-cells = <2>; + + regulators { + ldo3: LDO3 { /* HDMI */ + regulator-name = "VOUT3_1V85"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <2200000>; + regulator-enable-ramp-delay = <120>; + }; + + ldo9: LDO9 { /* SDCARD I/O */ + regulator-name = "VOUT9_1V8/2V95"; + regulator-min-microvolt = <1750000>; + regulator-max-microvolt = <3300000>; + regulator-enable-ramp-delay = <240>; + }; + + ldo11: LDO11 { /* Low Speed Connector */ + regulator-name = "VOUT11_1V8/2V95"; + regulator-min-microvolt = <1750000>; + regulator-max-microvolt = <3300000>; + regulator-enable-ramp-delay = <240>; + }; + + ldo15: LDO15 { /* UFS VCC */ + regulator-name = "VOUT15_3V0"; + regulator-min-microvolt = <1750000>; + regulator-max-microvolt = <3000000>; + regulator-boot-on; + regulator-always-on; + regulator-enable-ramp-delay = <120>; + }; + + ldo16: LDO16 { /* SD VDD */ + regulator-name = "VOUT16_2V95"; + regulator-min-microvolt = <1750000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <360>; + }; + }; + }; }; &i2c0 {