Skip to content

Commit e8014b2

Browse files
jonhunterthierryreding
authored andcommitted
soc/tegra: pmc: Add IO pads for Tegra264
Populate the IO pads and pins for Tegra264. Tegra264 has internal 1.8V and 0.6V regulators that must be enabled when selecting the 1.8V mode for the sdmmc1-hv IO pad. To support this a new 'ena_1v8' member is added to the 'tegra_io_pad_vctrl' structure to populate the bits that need to be set to enable these internal regulators. Although this is enabling 1.8V (bit 1) and 0.6V (bit 2) regulators, it is simply called 'ena_1v8' because these are both enabled for 1.8V operation. Note that these internal regulators are disabled when not using 1.8V mode. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent db3c16b commit e8014b2

1 file changed

Lines changed: 64 additions & 2 deletions

File tree

drivers/soc/tegra/pmc.c

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@
201201
#define TEGRA_SMC_PMC_READ 0xaa
202202
#define TEGRA_SMC_PMC_WRITE 0xbb
203203

204+
/* Tegra264 and later */
205+
#define PMC_IMPL_SDMMC1_HV_PADCTL_0 0x41004
206+
204207
struct pmc_clk {
205208
struct clk_hw hw;
206209
struct tegra_pmc *pmc;
@@ -301,6 +304,7 @@ struct tegra_io_pad_vctrl {
301304
enum tegra_io_pad id;
302305
unsigned int offset;
303306
unsigned int ena_3v3;
307+
unsigned int ena_1v8;
304308
};
305309

306310
struct tegra_pmc_regs {
@@ -1931,11 +1935,18 @@ static int tegra_io_pad_set_voltage(struct tegra_pmc *pmc, enum tegra_io_pad id,
19311935

19321936
value = tegra_pmc_readl(pmc, pad->offset);
19331937

1934-
if (voltage == TEGRA_IO_PAD_VOLTAGE_1V8)
1938+
if (voltage == TEGRA_IO_PAD_VOLTAGE_1V8) {
19351939
value &= ~BIT(pad->ena_3v3);
1936-
else
1940+
1941+
if (pad->ena_1v8)
1942+
value |= pad->ena_1v8;
1943+
} else {
19371944
value |= BIT(pad->ena_3v3);
19381945

1946+
if (pad->ena_1v8)
1947+
value &= ~pad->ena_1v8;
1948+
}
1949+
19391950
tegra_pmc_writel(pmc, value, pad->offset);
19401951

19411952
mutex_unlock(&pmc->powergates_lock);
@@ -3724,6 +3735,7 @@ static const u8 tegra124_cpu_powergates[] = {
37243735
.id = (_id), \
37253736
.offset = (_offset), \
37263737
.ena_3v3 = (_ena_3v3), \
3738+
.ena_1v8 = 0, \
37273739
})
37283740

37293741
#define TEGRA_IO_PIN_DESC(_id, _name) \
@@ -4583,6 +4595,50 @@ static const struct tegra_pmc_soc tegra234_pmc_soc = {
45834595
.has_single_mmio_aperture = false,
45844596
};
45854597

4598+
#define TEGRA264_IO_PAD_VCTRL(_id, _offset, _ena_3v3, _ena_1v8) \
4599+
((struct tegra_io_pad_vctrl) { \
4600+
.id = (_id), \
4601+
.offset = (_offset), \
4602+
.ena_3v3 = (_ena_3v3), \
4603+
.ena_1v8 = (_ena_1v8), \
4604+
})
4605+
4606+
static const struct tegra_io_pad_soc tegra264_io_pads[] = {
4607+
TEGRA_IO_PAD(TEGRA_IO_PAD_CSIA, 0, 0x41020, 0x41024, "csia"),
4608+
TEGRA_IO_PAD(TEGRA_IO_PAD_CSIB, 1, 0x41020, 0x41024, "csib"),
4609+
TEGRA_IO_PAD(TEGRA_IO_PAD_HDMI_DP0, 0, 0x41050, 0x41054, "hdmi-dp0"),
4610+
TEGRA_IO_PAD(TEGRA_IO_PAD_CSIC, 2, 0x41020, 0x41024, "csic"),
4611+
TEGRA_IO_PAD(TEGRA_IO_PAD_CSID, 3, 0x41020, 0x41024, "csid"),
4612+
TEGRA_IO_PAD(TEGRA_IO_PAD_CSIE, 4, 0x41020, 0x41024, "csie"),
4613+
TEGRA_IO_PAD(TEGRA_IO_PAD_CSIF, 5, 0x41020, 0x41024, "csif"),
4614+
TEGRA_IO_PAD(TEGRA_IO_PAD_UFS, 4, 0x41040, 0x41044, "ufs0"),
4615+
TEGRA_IO_PAD(TEGRA_IO_PAD_EDP, 0, 0x41028, 0x4102c, "edp"),
4616+
TEGRA_IO_PAD(TEGRA_IO_PAD_SDMMC1, 0, 0x41090, 0x41094, "sdmmc1"),
4617+
TEGRA_IO_PAD(TEGRA_IO_PAD_SDMMC1_HV, UINT_MAX, UINT_MAX, UINT_MAX, "sdmmc1-hv"),
4618+
TEGRA_IO_PAD(TEGRA_IO_PAD_CSIG, 6, 0x41020, 0x41024, "csig"),
4619+
TEGRA_IO_PAD(TEGRA_IO_PAD_CSIH, 7, 0x41020, 0x41024, "csih"),
4620+
};
4621+
4622+
static const struct tegra_io_pad_vctrl tegra264_io_pad_vctrls[] = {
4623+
TEGRA264_IO_PAD_VCTRL(TEGRA_IO_PAD_SDMMC1_HV, PMC_IMPL_SDMMC1_HV_PADCTL_0, 0, 0x6),
4624+
};
4625+
4626+
static const struct pinctrl_pin_desc tegra264_pin_descs[] = {
4627+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_CSIA, "csia"),
4628+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_CSIB, "csib"),
4629+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_HDMI_DP0, "hdmi-dp0"),
4630+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_CSIC, "csic"),
4631+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_CSID, "csid"),
4632+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_CSIE, "csie"),
4633+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_CSIF, "csif"),
4634+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_UFS, "ufs0"),
4635+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_EDP, "edp"),
4636+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_SDMMC1, "sdmmc1"),
4637+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_SDMMC1_HV, "sdmmc1-hv"),
4638+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_CSIG, "csig"),
4639+
TEGRA_IO_PIN_DESC(TEGRA_IO_PAD_CSIH, "csih"),
4640+
};
4641+
45864642
static const struct tegra_pmc_regs tegra264_pmc_regs = {
45874643
.scratch0 = 0x684,
45884644
.rst_status = 0x4,
@@ -4705,6 +4761,12 @@ static const struct tegra_wake_event tegra264_wake_events[] = {
47054761

47064762
static const struct tegra_pmc_soc tegra264_pmc_soc = {
47074763
.has_io_pad_wren = false,
4764+
.num_io_pads = ARRAY_SIZE(tegra264_io_pads),
4765+
.io_pads = tegra264_io_pads,
4766+
.num_io_pad_vctrls = ARRAY_SIZE(tegra264_io_pad_vctrls),
4767+
.io_pad_vctrls = tegra264_io_pad_vctrls,
4768+
.num_pin_descs = ARRAY_SIZE(tegra264_pin_descs),
4769+
.pin_descs = tegra264_pin_descs,
47084770
.regs = &tegra264_pmc_regs,
47094771
.init = tegra186_pmc_init,
47104772
.setup_irq_polarity = tegra186_pmc_setup_irq_polarity,

0 commit comments

Comments
 (0)