Merge tag 'tegra-for-6.1-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into arm/drivers

soc/tegra: Changes for v6.1-rc1

This contains an assortment of small fixes and cleanups. One new feature
is introduced in the form of simple wake events which are needed to wake
the system from sleep on USB port events.

* tag 'tegra-for-6.1-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  soc/tegra: pmc: Check device node status property
  soc/tegra: pmc: Use devm_clk_get_optional()
  soc/tegra: fuse: Drop Kconfig dependency on TEGRA20_APB_DMA
  soc/tegra: pmc: Add USB port wake events for Tegra194
  soc/tegra: pmc: Add support for simple wake events
  soc/tegra: pmc: Remove leading space
  soc/tegra: fuse: Add missing of_node_put()
  soc/tegra: fuse: Add missing of_node_put() in tegra_init_fuse()

Link: https://lore.kernel.org/r/20220916101957.1635854-1-thierry.reding@gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann
2022-09-23 17:32:34 +02:00
4 changed files with 38 additions and 16 deletions

View File

@@ -136,7 +136,6 @@ config SOC_TEGRA_FUSE
def_bool y def_bool y
depends on ARCH_TEGRA depends on ARCH_TEGRA
select SOC_BUS select SOC_BUS
select TEGRA20_APB_DMA if ARCH_TEGRA_2x_SOC
config SOC_TEGRA_FLOWCTRL config SOC_TEGRA_FLOWCTRL
bool bool

View File

@@ -568,6 +568,7 @@ static int __init tegra_init_fuse(void)
np = of_find_matching_node(NULL, car_match); np = of_find_matching_node(NULL, car_match);
if (np) { if (np) {
void __iomem *base = of_iomap(np, 0); void __iomem *base = of_iomap(np, 0);
of_node_put(np);
if (base) { if (base) {
tegra_enable_fuse_clk(base); tegra_enable_fuse_clk(base);
iounmap(base); iounmap(base);

View File

@@ -182,12 +182,12 @@ void __init tegra_init_apbmisc(void)
*/ */
if (of_address_to_resource(np, 0, &apbmisc) < 0) { if (of_address_to_resource(np, 0, &apbmisc) < 0) {
pr_err("failed to get APBMISC registers\n"); pr_err("failed to get APBMISC registers\n");
return; goto put;
} }
if (of_address_to_resource(np, 1, &straps) < 0) { if (of_address_to_resource(np, 1, &straps) < 0) {
pr_err("failed to get strapping options registers\n"); pr_err("failed to get strapping options registers\n");
return; goto put;
} }
} }
@@ -208,4 +208,7 @@ void __init tegra_init_apbmisc(void)
} }
long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code"); long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code");
put:
of_node_put(np);
} }

View File

@@ -296,6 +296,17 @@ struct tegra_wake_event {
} gpio; } gpio;
}; };
#define TEGRA_WAKE_SIMPLE(_name, _id) \
{ \
.name = _name, \
.id = _id, \
.irq = 0, \
.gpio = { \
.instance = UINT_MAX, \
.pin = UINT_MAX, \
}, \
}
#define TEGRA_WAKE_IRQ(_name, _id, _irq) \ #define TEGRA_WAKE_IRQ(_name, _id, _irq) \
{ \ { \
.name = _name, \ .name = _name, \
@@ -2239,6 +2250,7 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq,
for (i = 0; i < soc->num_wake_events; i++) { for (i = 0; i < soc->num_wake_events; i++) {
const struct tegra_wake_event *event = &soc->wake_events[i]; const struct tegra_wake_event *event = &soc->wake_events[i];
/* IRQ and simple wake events */
if (fwspec->param_count == 2) { if (fwspec->param_count == 2) {
struct irq_fwspec spec; struct irq_fwspec spec;
@@ -2251,6 +2263,12 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq,
if (err < 0) if (err < 0)
break; break;
/* simple hierarchies stop at the PMC level */
if (event->irq == 0) {
err = irq_domain_disconnect_hierarchy(domain->parent, virq);
break;
}
spec.fwnode = &pmc->dev->of_node->fwnode; spec.fwnode = &pmc->dev->of_node->fwnode;
spec.param_count = 3; spec.param_count = 3;
spec.param[0] = GIC_SPI; spec.param[0] = GIC_SPI;
@@ -2263,6 +2281,7 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq,
break; break;
} }
/* GPIO wake events */
if (fwspec->param_count == 3) { if (fwspec->param_count == 3) {
if (event->gpio.instance != fwspec->param[0] || if (event->gpio.instance != fwspec->param[0] ||
event->gpio.pin != fwspec->param[1]) event->gpio.pin != fwspec->param[1])
@@ -2885,17 +2904,10 @@ static int tegra_pmc_probe(struct platform_device *pdev)
pmc->scratch = base; pmc->scratch = base;
} }
pmc->clk = devm_clk_get(&pdev->dev, "pclk"); pmc->clk = devm_clk_get_optional(&pdev->dev, "pclk");
if (IS_ERR(pmc->clk)) { if (IS_ERR(pmc->clk))
err = PTR_ERR(pmc->clk); return dev_err_probe(&pdev->dev, PTR_ERR(pmc->clk),
"failed to get pclk\n");
if (err != -ENOENT) {
dev_err(&pdev->dev, "failed to get pclk: %d\n", err);
return err;
}
pmc->clk = NULL;
}
/* /*
* PMC should be last resort for restarting since it soft-resets * PMC should be last resort for restarting since it soft-resets
@@ -3757,6 +3769,13 @@ static const struct tegra_wake_event tegra194_wake_events[] = {
TEGRA_WAKE_IRQ("pmu", 24, 209), TEGRA_WAKE_IRQ("pmu", 24, 209),
TEGRA_WAKE_GPIO("power", 29, 1, TEGRA194_AON_GPIO(EE, 4)), TEGRA_WAKE_GPIO("power", 29, 1, TEGRA194_AON_GPIO(EE, 4)),
TEGRA_WAKE_IRQ("rtc", 73, 10), TEGRA_WAKE_IRQ("rtc", 73, 10),
TEGRA_WAKE_SIMPLE("usb3-port-0", 76),
TEGRA_WAKE_SIMPLE("usb3-port-1", 77),
TEGRA_WAKE_SIMPLE("usb3-port-2-3", 78),
TEGRA_WAKE_SIMPLE("usb2-port-0", 79),
TEGRA_WAKE_SIMPLE("usb2-port-1", 80),
TEGRA_WAKE_SIMPLE("usb2-port-2", 81),
TEGRA_WAKE_SIMPLE("usb2-port-3", 82),
}; };
static const struct tegra_pmc_soc tegra194_pmc_soc = { static const struct tegra_pmc_soc tegra194_pmc_soc = {
@@ -4025,7 +4044,7 @@ static int __init tegra_pmc_early_init(void)
return -ENXIO; return -ENXIO;
} }
if (np) { if (of_device_is_available(np)) {
pmc->soc = match->data; pmc->soc = match->data;
if (pmc->soc->maybe_tz_only) if (pmc->soc->maybe_tz_only)