Skip to content

Commit e8c9d35

Browse files
committed
Merge tag 'tegra-for-5.10-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into arm/drivers
soc/tegra: Changes for v5.10-rc1 These changes contain a bit of cleanup and chip support for the upcoming Tegra234 SoC. * tag 'tegra-for-5.10-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux: soc/tegra: pmc: Add Tegra234 support soc/tegra: pmc: Reorder reset sources/levels definitions soc/tegra: misc: Add Tegra234 support soc/tegra: fuse: Add Tegra234 support soc/tegra: fuse: Implement tegra_is_silicon() soc/tegra: fuse: Extract tegra_get_platform() Link: https://lore.kernel.org/r/20200918150303.3938852-2-thierry.reding@gmail.com Signed-off-by: Olof Johansson <olof@lixom.net>
2 parents 5746b3b + 34e214a commit e8c9d35

6 files changed

Lines changed: 181 additions & 42 deletions

File tree

drivers/soc/tegra/fuse/fuse-tegra.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ static struct tegra_fuse *fuse = &(struct tegra_fuse) {
4949
};
5050

5151
static const struct of_device_id tegra_fuse_match[] = {
52+
#ifdef CONFIG_ARCH_TEGRA_234_SOC
53+
{ .compatible = "nvidia,tegra234-efuse", .data = &tegra234_fuse_soc },
54+
#endif
5255
#ifdef CONFIG_ARCH_TEGRA_194_SOC
5356
{ .compatible = "nvidia,tegra194-efuse", .data = &tegra194_fuse_soc },
5457
#endif
@@ -326,7 +329,8 @@ const struct attribute_group tegra_soc_attr_group = {
326329
.attrs = tegra_soc_attr,
327330
};
328331

329-
#ifdef CONFIG_ARCH_TEGRA_194_SOC
332+
#if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
333+
IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC)
330334
static ssize_t platform_show(struct device *dev, struct device_attribute *attr,
331335
char *buf)
332336
{
@@ -336,7 +340,7 @@ static ssize_t platform_show(struct device *dev, struct device_attribute *attr,
336340
* platform type is silicon and all other non-zero values indicate
337341
* the type of simulation platform is being used.
338342
*/
339-
return sprintf(buf, "%d\n", (tegra_read_chipid() >> 20) & 0xf);
343+
return sprintf(buf, "%d\n", tegra_get_platform());
340344
}
341345

342346
static DEVICE_ATTR_RO(platform);

drivers/soc/tegra/fuse/fuse-tegra30.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,3 +356,33 @@ const struct tegra_fuse_soc tegra194_fuse_soc = {
356356
.soc_attr_group = &tegra194_soc_attr_group,
357357
};
358358
#endif
359+
360+
#if defined(CONFIG_ARCH_TEGRA_234_SOC)
361+
static const struct nvmem_cell_lookup tegra234_fuse_lookups[] = {
362+
{
363+
.nvmem_name = "fuse",
364+
.cell_name = "xusb-pad-calibration",
365+
.dev_id = "3520000.padctl",
366+
.con_id = "calibration",
367+
}, {
368+
.nvmem_name = "fuse",
369+
.cell_name = "xusb-pad-calibration-ext",
370+
.dev_id = "3520000.padctl",
371+
.con_id = "calibration-ext",
372+
},
373+
};
374+
375+
static const struct tegra_fuse_info tegra234_fuse_info = {
376+
.read = tegra30_fuse_read,
377+
.size = 0x300,
378+
.spare = 0x280,
379+
};
380+
381+
const struct tegra_fuse_soc tegra234_fuse_soc = {
382+
.init = tegra30_fuse_init,
383+
.info = &tegra234_fuse_info,
384+
.lookups = tegra234_fuse_lookups,
385+
.num_lookups = ARRAY_SIZE(tegra234_fuse_lookups),
386+
.soc_attr_group = &tegra194_soc_attr_group,
387+
};
388+
#endif

drivers/soc/tegra/fuse/fuse.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,17 @@ extern const struct tegra_fuse_soc tegra210_fuse_soc;
115115
extern const struct tegra_fuse_soc tegra186_fuse_soc;
116116
#endif
117117

118+
#if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
119+
IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC)
120+
extern const struct attribute_group tegra194_soc_attr_group;
121+
#endif
122+
118123
#ifdef CONFIG_ARCH_TEGRA_194_SOC
119124
extern const struct tegra_fuse_soc tegra194_fuse_soc;
120-
extern const struct attribute_group tegra194_soc_attr_group;
125+
#endif
126+
127+
#ifdef CONFIG_ARCH_TEGRA_234_SOC
128+
extern const struct tegra_fuse_soc tegra234_fuse_soc;
121129
#endif
122130

123131
#endif

drivers/soc/tegra/fuse/tegra-apbmisc.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,31 @@ u8 tegra_get_minor_rev(void)
4747
return (tegra_read_chipid() >> 16) & 0xf;
4848
}
4949

50+
u8 tegra_get_platform(void)
51+
{
52+
return (tegra_read_chipid() >> 20) & 0xf;
53+
}
54+
55+
bool tegra_is_silicon(void)
56+
{
57+
switch (tegra_get_chip_id()) {
58+
case TEGRA194:
59+
case TEGRA234:
60+
if (tegra_get_platform() == 0)
61+
return true;
62+
63+
return false;
64+
}
65+
66+
/*
67+
* Chips prior to Tegra194 have a different way of determining whether
68+
* they are silicon or not. Since we never supported simulation on the
69+
* older Tegra chips, don't bother extracting the information and just
70+
* report that we're running on silicon.
71+
*/
72+
return true;
73+
}
74+
5075
u32 tegra_read_straps(void)
5176
{
5277
WARN(!chipid, "Tegra ABP MISC not yet available\n");
@@ -70,6 +95,7 @@ static const struct of_device_id apbmisc_match[] __initconst = {
7095
{ .compatible = "nvidia,tegra20-apbmisc", },
7196
{ .compatible = "nvidia,tegra186-misc", },
7297
{ .compatible = "nvidia,tegra194-misc", },
98+
{ .compatible = "nvidia,tegra234-misc", },
7399
{},
74100
};
75101

drivers/soc/tegra/pmc.c

Lines changed: 107 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -336,45 +336,6 @@ struct tegra_pmc_soc {
336336
bool has_blink_output;
337337
};
338338

339-
static const char * const tegra186_reset_sources[] = {
340-
"SYS_RESET",
341-
"AOWDT",
342-
"MCCPLEXWDT",
343-
"BPMPWDT",
344-
"SCEWDT",
345-
"SPEWDT",
346-
"APEWDT",
347-
"BCCPLEXWDT",
348-
"SENSOR",
349-
"AOTAG",
350-
"VFSENSOR",
351-
"SWREST",
352-
"SC7",
353-
"HSM",
354-
"CORESIGHT"
355-
};
356-
357-
static const char * const tegra186_reset_levels[] = {
358-
"L0", "L1", "L2", "WARM"
359-
};
360-
361-
static const char * const tegra30_reset_sources[] = {
362-
"POWER_ON_RESET",
363-
"WATCHDOG",
364-
"SENSOR",
365-
"SW_MAIN",
366-
"LP0"
367-
};
368-
369-
static const char * const tegra210_reset_sources[] = {
370-
"POWER_ON_RESET",
371-
"WATCHDOG",
372-
"SENSOR",
373-
"SW_MAIN",
374-
"LP0",
375-
"AOTAG"
376-
};
377-
378339
/**
379340
* struct tegra_pmc - NVIDIA Tegra PMC
380341
* @dev: pointer to PMC device structure
@@ -2784,6 +2745,14 @@ static const u8 tegra30_cpu_powergates[] = {
27842745
TEGRA_POWERGATE_CPU3,
27852746
};
27862747

2748+
static const char * const tegra30_reset_sources[] = {
2749+
"POWER_ON_RESET",
2750+
"WATCHDOG",
2751+
"SENSOR",
2752+
"SW_MAIN",
2753+
"LP0"
2754+
};
2755+
27872756
static const struct tegra_pmc_soc tegra30_pmc_soc = {
27882757
.num_powergates = ARRAY_SIZE(tegra30_powergates),
27892758
.powergates = tegra30_powergates,
@@ -3061,6 +3030,15 @@ static const struct pinctrl_pin_desc tegra210_pin_descs[] = {
30613030
TEGRA210_IO_PAD_TABLE(TEGRA_IO_PIN_DESC)
30623031
};
30633032

3033+
static const char * const tegra210_reset_sources[] = {
3034+
"POWER_ON_RESET",
3035+
"WATCHDOG",
3036+
"SENSOR",
3037+
"SW_MAIN",
3038+
"LP0",
3039+
"AOTAG"
3040+
};
3041+
30643042
static const struct tegra_wake_event tegra210_wake_events[] = {
30653043
TEGRA_WAKE_IRQ("rtc", 16, 2),
30663044
TEGRA_WAKE_IRQ("pmu", 51, 86),
@@ -3193,6 +3171,28 @@ static void tegra186_pmc_setup_irq_polarity(struct tegra_pmc *pmc,
31933171
iounmap(wake);
31943172
}
31953173

3174+
static const char * const tegra186_reset_sources[] = {
3175+
"SYS_RESET",
3176+
"AOWDT",
3177+
"MCCPLEXWDT",
3178+
"BPMPWDT",
3179+
"SCEWDT",
3180+
"SPEWDT",
3181+
"APEWDT",
3182+
"BCCPLEXWDT",
3183+
"SENSOR",
3184+
"AOTAG",
3185+
"VFSENSOR",
3186+
"SWREST",
3187+
"SC7",
3188+
"HSM",
3189+
"CORESIGHT"
3190+
};
3191+
3192+
static const char * const tegra186_reset_levels[] = {
3193+
"L0", "L1", "L2", "WARM"
3194+
};
3195+
31963196
static const struct tegra_wake_event tegra186_wake_events[] = {
31973197
TEGRA_WAKE_IRQ("pmu", 24, 209),
31983198
TEGRA_WAKE_GPIO("power", 29, 1, TEGRA186_AON_GPIO(FF, 0)),
@@ -3362,7 +3362,75 @@ static const struct tegra_pmc_soc tegra194_pmc_soc = {
33623362
.has_blink_output = false,
33633363
};
33643364

3365+
static const struct tegra_pmc_regs tegra234_pmc_regs = {
3366+
.scratch0 = 0x2000,
3367+
.dpd_req = 0,
3368+
.dpd_status = 0,
3369+
.dpd2_req = 0,
3370+
.dpd2_status = 0,
3371+
.rst_status = 0x70,
3372+
.rst_source_shift = 0x2,
3373+
.rst_source_mask = 0xfc,
3374+
.rst_level_shift = 0x0,
3375+
.rst_level_mask = 0x3,
3376+
};
3377+
3378+
static const char * const tegra234_reset_sources[] = {
3379+
"SYS_RESET_N",
3380+
"AOWDT",
3381+
"BCCPLEXWDT",
3382+
"BPMPWDT",
3383+
"SCEWDT",
3384+
"SPEWDT",
3385+
"APEWDT",
3386+
"LCCPLEXWDT",
3387+
"SENSOR",
3388+
"AOTAG",
3389+
"VFSENSOR",
3390+
"MAINSWRST",
3391+
"SC7",
3392+
"HSM",
3393+
"CSITE",
3394+
"RCEWDT",
3395+
"PVA0WDT",
3396+
"PVA1WDT",
3397+
"L1A_ASYNC",
3398+
"BPMPBOOT",
3399+
"FUSECRC",
3400+
};
3401+
3402+
static const struct tegra_pmc_soc tegra234_pmc_soc = {
3403+
.num_powergates = 0,
3404+
.powergates = NULL,
3405+
.num_cpu_powergates = 0,
3406+
.cpu_powergates = NULL,
3407+
.has_tsense_reset = false,
3408+
.has_gpu_clamps = false,
3409+
.needs_mbist_war = false,
3410+
.has_impl_33v_pwr = true,
3411+
.maybe_tz_only = false,
3412+
.num_io_pads = 0,
3413+
.io_pads = NULL,
3414+
.num_pin_descs = 0,
3415+
.pin_descs = NULL,
3416+
.regs = &tegra234_pmc_regs,
3417+
.init = NULL,
3418+
.setup_irq_polarity = tegra186_pmc_setup_irq_polarity,
3419+
.irq_set_wake = tegra186_pmc_irq_set_wake,
3420+
.irq_set_type = tegra186_pmc_irq_set_type,
3421+
.reset_sources = tegra234_reset_sources,
3422+
.num_reset_sources = ARRAY_SIZE(tegra234_reset_sources),
3423+
.reset_levels = tegra186_reset_levels,
3424+
.num_reset_levels = ARRAY_SIZE(tegra186_reset_levels),
3425+
.num_wake_events = 0,
3426+
.wake_events = NULL,
3427+
.pmc_clks_data = NULL,
3428+
.num_pmc_clks = 0,
3429+
.has_blink_output = false,
3430+
};
3431+
33653432
static const struct of_device_id tegra_pmc_match[] = {
3433+
{ .compatible = "nvidia,tegra234-pmc", .data = &tegra234_pmc_soc },
33663434
{ .compatible = "nvidia,tegra194-pmc", .data = &tegra194_pmc_soc },
33673435
{ .compatible = "nvidia,tegra186-pmc", .data = &tegra186_pmc_soc },
33683436
{ .compatible = "nvidia,tegra210-pmc", .data = &tegra210_pmc_soc },

include/soc/tegra/fuse.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define TEGRA210 0x21
1515
#define TEGRA186 0x18
1616
#define TEGRA194 0x19
17+
#define TEGRA234 0x23
1718

1819
#define TEGRA_FUSE_SKU_CALIB_0 0xf0
1920
#define TEGRA30_FUSE_SATA_CALIB 0x124
@@ -23,6 +24,8 @@
2324

2425
u32 tegra_read_chipid(void);
2526
u8 tegra_get_chip_id(void);
27+
u8 tegra_get_platform(void);
28+
bool tegra_is_silicon(void);
2629

2730
enum tegra_revision {
2831
TEGRA_REVISION_UNKNOWN = 0,

0 commit comments

Comments
 (0)