]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
padctrl: tegra210-pad: remove duplication of IO PAD init
authorLaxman Dewangan <ldewangan@nvidia.com>
Tue, 26 May 2015 14:54:35 +0000 (20:24 +0530)
committerLaxman Dewangan <ldewangan@nvidia.com>
Tue, 2 Jun 2015 06:28:24 +0000 (23:28 -0700)
Remove duplication of IO pad voltage and dpd initialization
via DT properties platform-io-pad-voltage and platform-io-pad-power
as the same can be achieve with io-pad-defaults node.

bug 1648039

Change-Id: I09308f65868fe53288e235c4adae8232569701f5
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
(cherry picked from commit 11cdbcc830fe01e55c55cb0a780a4ced77a21a2b)
Reviewed-on: http://git-master/r/750847

Documentation/devicetree/bindings/padctrl/padctrl-tegra210-pmc.txt
drivers/padctrl/padctrl-tegra210-pmc.c

index 7d6acfa6aac06b8bd7b02e61e9d6ce9458997f62..6993cfdbc7d1365205d96517e8273661aa17d073 100644 (file)
@@ -4,24 +4,6 @@ Required properties:
 - Compatible: Must be nvidia,tegra210-pmc.
 - #padcontroller-cells: Number of padctrl arguments. It must be 1.
 
-Optional properties:
--platform-io-pad-voltage: Array of U32 data with IO rail ID and related
-       volatge for that pad. Example
-               platform-io-pad-voltage = <TEGRA210_PAD_GPIO IO_RAIL_VOLTAGE_1_8V
-                                       TEGRA210_PAD_AUDIO_HV IO_RAIL_VOLTAGE_3_3V>;
-               The driver intialise the io pad voltage during registration.
-
-- platform-io-pad-power: Array of U32 data with IO rail ID and related
-               power enable/disable for that pad. Example
-               platform-io-pad-power = <
-                       TEGRA210_TEGRA_IO_PAD_GROUP_SDMMC3 TEGRA_IO_PAD_GROUP_POWER_DISABLE
-                       TEGRA_IO_PAD_GROUP_PEX_CTRL TEGRA_IO_PAD_GROUP_POWER_DISABLE
-                       TEGRA_IO_PAD_GROUP_DSI  TEGRA_IO_PAD_GROUP_POWER_ENABLE>;
-The pad id is passed as the argument and this is defined as macro at
-       include/dt-bindings/padctrl/tegra210-pads.h
-For platform-io-pad-power, use the TEGRA_IO_PAD_GROUP_*.
-For platform-io-pad-voltage, use TEGRA210_PAD_*.
-
 Pad intitialisation through subnode:
 ==================================
 Driver offers the pad initialisation through subnode. The subnode
@@ -70,8 +52,14 @@ Example: SDMMC1 pad is 6 and SDMMC3 is 7.
                reg = <0x0 0x7000e400 0x0 0x400>;
                #padcontroller-cells = <1>;
                status = "disabled";
-               platform-io-pad-voltage = <TEGRA210_PAD_GPIO IO_RAIL_VOLTAGE_1_8V
-                                       TEGRA210_PAD_AUDIO_HV IO_RAIL_VOLTAGE_3_3V>;
+               io-pad-defaults {
+                       gpio {
+                               nvidia,io-pad-init-voltage = <IO_RAIL_VOLTAGE_1_8V>;
+                       };
+                       audio-hv {
+                               nvidia,io-pad-init-voltage = <IO_RAIL_VOLTAGE_3_3V>;
+                       };
+               };
        };
 
 
index d332c80f81473c4beaf0eabdb5ceeed68a22de36..8f47fa602bc18a047be2628c43eb77de82e63a25 100644 (file)
@@ -362,126 +362,6 @@ static int tegra210_pmc_parse_io_pad_init(struct device_node *np,
        return 0;
 }
 
-static int tegra210_pmc_parse_io_pad_voltage(struct device_node *np,
-               struct padctrl_dev *pad_dev)
-{
-       u32 io_pad_id, volt_uv;
-       int n_config;
-       u32 *configs;
-       int i, j, index;
-       int ret;
-
-       n_config = of_property_count_u32(np, "platform-io-pad-voltage");
-       if (n_config < 0)
-               return 0;
-       if (!n_config || (n_config % 2))
-               return -EINVAL;
-
-       n_config = n_config/2;
-
-       configs = kzalloc(n_config * sizeof(*configs), GFP_KERNEL);
-       if (!configs)
-               return -ENOMEM;
-
-       for (i = 0; i < n_config; ++i) {
-               index = i * 2;
-               of_property_read_u32_index(np, "platform-io-pad-voltage",
-                                       index, &io_pad_id);
-               of_property_read_u32_index(np, "platform-io-pad-voltage",
-                                       index + 1, &volt_uv);
-               for (j = 0; j < ARRAY_SIZE(tegra210_pads_info); ++j) {
-                       if (tegra210_pads_info[j].pad_id == io_pad_id)
-                               break;
-               }
-               if (j == ARRAY_SIZE(tegra210_pads_info)) {
-                       pr_err("PMC: IO pad ID %u is invalid\n", io_pad_id);
-                       continue;
-               }
-
-               configs[index] = j;
-               configs[index + 1] = volt_uv;
-       };
-
-       for (i = 0; i < n_config; ++i) {
-               index = i * 2;
-               if (!configs[index + 1])
-                       continue;
-               ret = tegra210_pmc_padctrl_set_voltage(pad_dev,
-                               tegra210_pads_info[configs[index]].pad_id,
-                               configs[index + 1]);
-               if (ret < 0) {
-                       pr_warn("PMC: IO pad %s voltage config failed: %d\n",
-                               tegra210_pads_info[configs[index]].pad_name, ret);
-                       WARN_ON(1);
-               } else {
-                       pr_info("PMC: IO pad %s voltage is %d\n",
-                               tegra210_pads_info[configs[index]].pad_name,
-                                       configs[index + 1]);
-               }
-       }
-       kfree(configs);
-       return 0;
-}
-
-static int tegra210_pmc_parse_io_pad_power(struct device_node *np,
-               struct padctrl_dev *pad_dev)
-{
-       u32 io_pad_id, enable;
-       int n_config;
-       u32 *configs;
-       int i, j, index;
-       int ret;
-
-       n_config = of_property_count_u32(np, "platform-io-pad-power");
-       if (n_config < 0)
-               return 0;
-       if (!n_config || (n_config % 2))
-               return -EINVAL;
-
-       n_config = n_config/2;
-
-       configs = kzalloc(n_config * sizeof(*configs), GFP_KERNEL);
-       if (!configs)
-               return -ENOMEM;
-
-       for (i = 0; i < n_config; ++i) {
-               index = i * 2;
-               of_property_read_u32_index(np, "platform-io-pad-power",
-                                       index, &io_pad_id);
-               of_property_read_u32_index(np, "platform-io-pad-power",
-                                       index + 1, &enable);
-               for (j = 0; j < ARRAY_SIZE(tegra210_pads_info); ++j) {
-                       if (tegra210_pads_info[j].pad_id == io_pad_id)
-                               break;
-               }
-               if (j == ARRAY_SIZE(tegra210_pads_info)) {
-                       pr_err("PMC: IO pad ID %u is invalid\n", io_pad_id);
-                       continue;
-               }
-
-               configs[index] = j;
-               configs[index + 1] = enable;
-       };
-
-       for (i = 0; i < n_config; ++i) {
-               index = i * 2;
-               ret = tegra210_pmc_padctrl_set_power(pad_dev,
-                               tegra210_pads_info[configs[index]].pad_id,
-                               configs[index + 1]);
-               if (ret < 0) {
-                       pr_warn("PMC: IO pad %s power config failed: %d\n",
-                            tegra210_pads_info[configs[index]].pad_name, ret);
-                       WARN_ON(1);
-               } else {
-                       pr_info("PMC: IO pad %s power is %s\n",
-                               tegra210_pads_info[configs[index]].pad_name,
-                                  (configs[index + 1]) ? "enable" : "disable");
-               }
-       }
-       kfree(configs);
-       return 0;
-}
-
 int tegra210_pmc_padctrl_init(struct device *dev, struct device_node *np)
 {
        struct tegra210_pmc_padcontrl *pmc_padctrl;
@@ -504,16 +384,12 @@ int tegra210_pmc_padctrl_init(struct device *dev, struct device_node *np)
                return ret;
        }
        padctrl_set_drvdata(pmc_padctrl->pad_dev, pmc_padctrl);
-       tegra210_pmc_parse_io_pad_init(config.of_node,
-               pmc_padctrl->pad_dev);
-       tegra210_pmc_parse_io_pad_voltage(config.of_node,
-                               pmc_padctrl->pad_dev);
 
        /* Clear all DPD */
        tegra_pmc_io_dpd_clear();
 
-       tegra210_pmc_parse_io_pad_power(config.of_node,
-                               pmc_padctrl->pad_dev);
+       tegra210_pmc_parse_io_pad_init(config.of_node,
+               pmc_padctrl->pad_dev);
 
        pr_info("T210 pmc padctrl driver initialized\n");
        return 0;