From 96c386e2c3820d10accbdbcf05bd234cd4ebe091 Mon Sep 17 00:00:00 2001 From: Gilad Avidov Date: Wed, 8 Aug 2012 14:06:24 -0600 Subject: [PATCH] spmi: pmic-arb: Add register names in device tree Improve readability and maintainability of the PMIC-arbiter driver, by reading platform memory resources from device tree by name rather then by index. Change-Id: I10651e474210f0859d517d2b60fa04acdf77c9a4 Signed-off-by: Gilad Avidov Signed-off-by: Kenneth Heitke --- Documentation/devicetree/bindings/spmi/spmi-pmic-arb.txt | 2 ++ arch/arm/boot/dts/mpq8092.dtsi | 3 ++- arch/arm/boot/dts/msm8226.dtsi | 1 + arch/arm/boot/dts/msm8610.dtsi | 1 + arch/arm/boot/dts/msm8974.dtsi | 1 + arch/arm/boot/dts/msm9625.dtsi | 1 + drivers/spmi/spmi-pmic-arb.c | 6 +++--- 7 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/spmi/spmi-pmic-arb.txt b/Documentation/devicetree/bindings/spmi/spmi-pmic-arb.txt index 63c1e877f29..d1d769b743f 100644 --- a/Documentation/devicetree/bindings/spmi/spmi-pmic-arb.txt +++ b/Documentation/devicetree/bindings/spmi/spmi-pmic-arb.txt @@ -3,6 +3,7 @@ Qualcomm SPMI Controller (PMIC Arbiter) Required properties: - cell-index : the bus identifier. - compatible : should be "qcom,spmi-pmic-arb". +- reg-names : should be "core", "intr" - reg : offset and length of the PMIC Arbiter Core register map. - reg : offset and length of the PMIC Arbiter Interrupt controller register map. - interrupts : the PMIC Arbiter interrupt. @@ -33,6 +34,7 @@ Example: qcom,spmi@fc4c0000 { cell-index = <0>; compatible = "qcom,spmi-pmic-arb"; + reg-names = "core", "intr"; reg = <0xfc4cf000 0x1000>, <0Xfc4cb000 0x1000>; interrupts = <0>; diff --git a/arch/arm/boot/dts/mpq8092.dtsi b/arch/arm/boot/dts/mpq8092.dtsi index eebc66c1838..7a809898254 100644 --- a/arch/arm/boot/dts/mpq8092.dtsi +++ b/arch/arm/boot/dts/mpq8092.dtsi @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -66,6 +66,7 @@ spmi_bus: qcom,spmi@fc4c0000 { cell-index = <0>; compatible = "qcom,spmi-pmic-arb"; + reg-names = "core", "intr"; reg = <0xfc4cf000 0x1000>, <0Xfc4cb000 0x1000>; /* 190,ee0_krait_hlos_spmi_periph_irq */ diff --git a/arch/arm/boot/dts/msm8226.dtsi b/arch/arm/boot/dts/msm8226.dtsi index cec513a39a2..0d331c0d1e3 100644 --- a/arch/arm/boot/dts/msm8226.dtsi +++ b/arch/arm/boot/dts/msm8226.dtsi @@ -437,6 +437,7 @@ spmi_bus: qcom,spmi@fc4c0000 { cell-index = <0>; compatible = "qcom,spmi-pmic-arb"; + reg-names = "core", "intr"; reg = <0xfc4cf000 0x1000>, <0Xfc4cb000 0x1000>; /* 190,ee0_krait_hlos_spmi_periph_irq */ diff --git a/arch/arm/boot/dts/msm8610.dtsi b/arch/arm/boot/dts/msm8610.dtsi index 80f5cd2eb0d..bf5292f5a1a 100644 --- a/arch/arm/boot/dts/msm8610.dtsi +++ b/arch/arm/boot/dts/msm8610.dtsi @@ -248,6 +248,7 @@ spmi_bus: qcom,spmi@fc4c0000 { cell-index = <0>; compatible = "qcom,spmi-pmic-arb"; + reg-names = "core", "intr"; reg = <0xfc4cf000 0x1000>, <0Xfc4cb000 0x1000>; /* 190,ee0_krait_hlos_spmi_periph_irq */ diff --git a/arch/arm/boot/dts/msm8974.dtsi b/arch/arm/boot/dts/msm8974.dtsi index 1dbee079f55..bcdc581689e 100644 --- a/arch/arm/boot/dts/msm8974.dtsi +++ b/arch/arm/boot/dts/msm8974.dtsi @@ -484,6 +484,7 @@ spmi_bus: qcom,spmi@fc4c0000 { cell-index = <0>; compatible = "qcom,spmi-pmic-arb"; + reg-names = "core", "intr"; reg = <0xfc4cf000 0x1000>, <0Xfc4cb000 0x1000>; /* 190,ee0_krait_hlos_spmi_periph_irq */ diff --git a/arch/arm/boot/dts/msm9625.dtsi b/arch/arm/boot/dts/msm9625.dtsi index e95d108ac2d..46f5d7d1a35 100644 --- a/arch/arm/boot/dts/msm9625.dtsi +++ b/arch/arm/boot/dts/msm9625.dtsi @@ -232,6 +232,7 @@ spmi_bus: qcom,spmi@fc4c0000 { cell-index = <0>; compatible = "qcom,spmi-pmic-arb"; + reg-names = "core", "intr"; reg = <0xfc4cf000 0x1000>, <0Xfc4cb000 0x1000>; /* 190,ee0_krait_hlos_spmi_periph_irq */ diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index b8e79bf6554..6d9b6ebddfe 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -581,7 +581,7 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev) return -ENOMEM; } - mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + mem_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core"); if (!mem_res) { dev_err(&pdev->dev, "missing base memory resource\n"); return -ENODEV; @@ -594,7 +594,7 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev) return -ENOMEM; } - mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + mem_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "intr"); if (!mem_res) { dev_err(&pdev->dev, "missing mem resource (interrupts)\n"); return -ENODEV;