- 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
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>;
+ };
+ };
};
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;
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;