soc/tegra: Changes for v6.4-rc1

Contains various minor cleanups and fixes as well as support for several
 more wake events on Tegra234.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmQuvPoTHHRyZWRpbmdA
 bnZpZGlhLmNvbQAKCRDdI6zXfz6zoXOVD/45SorSxhCf11ZTc8mpDfwjLKuKt24X
 psl1lIjD3zMhpu9VQo/6or+iDjCAI+hxElcYylfev1cE5dZCf2PJnsYfbqY8izVL
 kkGCBuuTcDLk6R2uG9+LZlCjf0tSGvoMXlGrqbhp3arxAg+zib2MjrTqbHB8mmmH
 7DK8X1DqbefAgjy/NdHcRqh5cM6gM7SKaTzxcmwPGadPW7DVZsL7NwsafWn13BG1
 eMqLzTmeZc5idueutLsJZ9+L10EjGxyuv2WUzz0ziih7X2V96aiTwu9ZMGEBCejP
 5gECq2Uj5vw1oPIQU4USBRH4MlQ33hGPVwABl3Q7Zh3MCSbCY9oF73LF1X7YMvHy
 U2qqMg15CTV2tGmXREh+mcj/XJ5Njn1b8LYsl7olCvZ/wfxlRAKhQ8Z2Qul27pwW
 3PDlgp140HoQsxf31/pCGuyS6yYVjTNUjwJtzcRHvYuRd52s6U320F8z5vmmbT9R
 5QggdmOcX6CmxpF8effKicp8fHjxfNO5uMMkTbC4TYPcAZaZJAN6jsnPnGGE+mwY
 1iofAvFPmEySJYWm5v2oDK9EKvh8Hfxg65VpBuCYuOTnxW0J2dz4YcyK1FGZ6JHi
 pVs2HvG7vFTXJ/8P7KkM34Bta8gg+aG1qaoW71IqRhFQporn2JqMVzeNRIgILfp+
 P/40x9se1Irkbw==
 =lDCY
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmQ5Q9gACgkQYKtH/8kJ
 UifcKRAAyaTiOVL5EpqoVdf484Hx2OfxIO0A/X3gZTF/n/cH4vS0X9Bhmu3Zf2AQ
 a7WCPXLdrCS0QZixuCP4uRPgkovsFQ4S/JQUsdl8tB1QcBnzSdCanbwgyxe3PJfJ
 gUIuQDw9ov4LIRitIcSpQpxu3JWRoFjPUI8Zf9FW04HFmZwdHIRAx2QeB/zT5Rko
 yZxt+KOASbrKOOmGO6MjRBYrvFcsp520GMtSpTsV/QHfxEFPYQf+lBwVMtbiBeEH
 yidAXUfLv3jIQb2fHq5PPAVPL0vPpjL1hKZZuOJv/SvdXfaprni2yq/XQ8dlHmcW
 9gKvv5W3nqRi/QjvOn914SxvKR7c5Ex5Vbx0K0/1Uo67A37dt02tJl0PRx+Bh3kY
 OgP0sT8k+lfGr4d56V+EtzvmK6PG7/36ETY94+lN8eP/i7Qu3F+/N9hb/c6tc9es
 qw6l3fKqGXmsElD+/EQcc5EcL5ygkK4So1qKS4n1bv4mj0xiZ0jgbOrNsB3S2wsW
 GuNzV4ObuugmzaTs5L5ur60oKS8jNHKyT78RrSikD4pYizGy7luG3n5faKpZKz7C
 yOn/CS1jrQJoVGU7BH1htzqb+8I+YhC+zJuoR04qdHAQ4GoRMreQIFQosoYbNEmd
 xE4wNlUQm7HmEawh6aIwir4QJ/gwokP6HRmlW0QNvL1GBxL48TU=
 =CjZi
 -----END PGP SIGNATURE-----

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

soc/tegra: Changes for v6.4-rc1

Contains various minor cleanups and fixes as well as support for several
more wake events on Tegra234.

* tag 'tegra-for-6.4-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  soc/tegra: fuse: Remove nvmem root only access
  soc/tegra: cbb: tegra194: Use of_address_count() helper
  soc/tegra: cbb: Remove MODULE_LICENSE in non-modules
  soc/tegra: flowctrl: Use devm_platform_get_and_ioremap_resource()
  soc: tegra: cbb: Drop empty platform remove function
  soc/tegra: pmc: Support software wake-up for SPE
  soc/tegra: pmc: Add wake source interrupt for MGBE
  soc/tegra: pmc: Add the PMIC wake event for Tegra234
  soc/tegra: bpmp: Actually free memory on error path
  soc/tegra: cbb: remove linux/version.h

Link: https://lore.kernel.org/r/20230406124804.970394-2-thierry.reding@gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2023-04-14 14:15:19 +02:00
commit 547d67a904
7 changed files with 30 additions and 21 deletions

View File

@ -16,7 +16,6 @@
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/version.h>
#include <soc/tegra/fuse.h> #include <soc/tegra/fuse.h>
#include <soc/tegra/tegra-cbb.h> #include <soc/tegra/tegra-cbb.h>

View File

@ -23,7 +23,6 @@
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/version.h>
#include <soc/tegra/fuse.h> #include <soc/tegra/fuse.h>
#include <soc/tegra/tegra-cbb.h> #include <soc/tegra/tegra-cbb.h>
@ -2191,7 +2190,6 @@ MODULE_DEVICE_TABLE(of, tegra194_cbb_match);
static int tegra194_cbb_get_bridges(struct tegra194_cbb *cbb, struct device_node *np) static int tegra194_cbb_get_bridges(struct tegra194_cbb *cbb, struct device_node *np)
{ {
struct tegra_cbb *entry; struct tegra_cbb *entry;
struct resource res;
unsigned long flags; unsigned long flags;
unsigned int i; unsigned int i;
int err; int err;
@ -2211,8 +2209,7 @@ static int tegra194_cbb_get_bridges(struct tegra194_cbb *cbb, struct device_node
spin_unlock_irqrestore(&cbb_lock, flags); spin_unlock_irqrestore(&cbb_lock, flags);
if (!cbb->bridges) { if (!cbb->bridges) {
while (of_address_to_resource(np, cbb->num_bridges, &res) == 0) cbb->num_bridges = of_address_count(np);
cbb->num_bridges++;
cbb->bridges = devm_kcalloc(cbb->base.dev, cbb->num_bridges, cbb->bridges = devm_kcalloc(cbb->base.dev, cbb->num_bridges,
sizeof(*cbb->bridges), GFP_KERNEL); sizeof(*cbb->bridges), GFP_KERNEL);
@ -2359,4 +2356,3 @@ module_exit(tegra194_cbb_exit);
MODULE_AUTHOR("Sumit Gupta <sumitg@nvidia.com>"); MODULE_AUTHOR("Sumit Gupta <sumitg@nvidia.com>");
MODULE_DESCRIPTION("Control Backbone error handling driver for Tegra194"); MODULE_DESCRIPTION("Control Backbone error handling driver for Tegra194");
MODULE_LICENSE("GPL");

View File

@ -24,7 +24,6 @@
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/version.h>
#include <soc/tegra/fuse.h> #include <soc/tegra/fuse.h>
#include <soc/tegra/tegra-cbb.h> #include <soc/tegra/tegra-cbb.h>
@ -1174,11 +1173,6 @@ static int tegra234_cbb_probe(struct platform_device *pdev)
return tegra_cbb_register(&cbb->base); return tegra_cbb_register(&cbb->base);
} }
static int tegra234_cbb_remove(struct platform_device *pdev)
{
return 0;
}
static int __maybe_unused tegra234_cbb_resume_noirq(struct device *dev) static int __maybe_unused tegra234_cbb_resume_noirq(struct device *dev)
{ {
struct tegra234_cbb *cbb = dev_get_drvdata(dev); struct tegra234_cbb *cbb = dev_get_drvdata(dev);
@ -1196,7 +1190,6 @@ static const struct dev_pm_ops tegra234_cbb_pm = {
static struct platform_driver tegra234_cbb_driver = { static struct platform_driver tegra234_cbb_driver = {
.probe = tegra234_cbb_probe, .probe = tegra234_cbb_probe,
.remove = tegra234_cbb_remove,
.driver = { .driver = {
.name = "tegra234-cbb", .name = "tegra234-cbb",
.of_match_table = tegra234_cbb_dt_ids, .of_match_table = tegra234_cbb_dt_ids,
@ -1218,4 +1211,3 @@ static void __exit tegra234_cbb_exit(void)
module_exit(tegra234_cbb_exit); module_exit(tegra234_cbb_exit);
MODULE_DESCRIPTION("Control Backbone 2.0 error handling driver for Tegra234"); MODULE_DESCRIPTION("Control Backbone 2.0 error handling driver for Tegra234");
MODULE_LICENSE("GPL");

View File

@ -156,10 +156,8 @@ void flowctrl_cpu_suspend_exit(unsigned int cpuid)
static int tegra_flowctrl_probe(struct platform_device *pdev) static int tegra_flowctrl_probe(struct platform_device *pdev)
{ {
void __iomem *base = tegra_flowctrl_base; void __iomem *base = tegra_flowctrl_base;
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); tegra_flowctrl_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
tegra_flowctrl_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(tegra_flowctrl_base)) if (IS_ERR(tegra_flowctrl_base))
return PTR_ERR(tegra_flowctrl_base); return PTR_ERR(tegra_flowctrl_base);

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (c) 2013-2022, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2013-2023, NVIDIA CORPORATION. All rights reserved.
*/ */
#include <linux/clk.h> #include <linux/clk.h>
@ -166,7 +166,7 @@ static int tegra_fuse_probe(struct platform_device *pdev)
nvmem.nkeepout = fuse->soc->num_keepouts; nvmem.nkeepout = fuse->soc->num_keepouts;
nvmem.type = NVMEM_TYPE_OTP; nvmem.type = NVMEM_TYPE_OTP;
nvmem.read_only = true; nvmem.read_only = true;
nvmem.root_only = true; nvmem.root_only = false;
nvmem.reg_read = tegra_fuse_read; nvmem.reg_read = tegra_fuse_read;
nvmem.size = fuse->soc->info->size; nvmem.size = fuse->soc->info->size;
nvmem.word_size = 4; nvmem.word_size = 4;

View File

@ -3,7 +3,7 @@
* drivers/soc/tegra/pmc.c * drivers/soc/tegra/pmc.c
* *
* Copyright (c) 2010 Google, Inc * Copyright (c) 2010 Google, Inc
* Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
* *
* Author: * Author:
* Colin Cross <ccross@google.com> * Colin Cross <ccross@google.com>
@ -177,6 +177,7 @@
/* Tegra186 and later */ /* Tegra186 and later */
#define WAKE_AOWAKE_CNTRL(x) (0x000 + ((x) << 2)) #define WAKE_AOWAKE_CNTRL(x) (0x000 + ((x) << 2))
#define WAKE_AOWAKE_CNTRL_LEVEL (1 << 3) #define WAKE_AOWAKE_CNTRL_LEVEL (1 << 3)
#define WAKE_AOWAKE_CNTRL_SR_CAPTURE_EN (1 << 1)
#define WAKE_AOWAKE_MASK_W(x) (0x180 + ((x) << 2)) #define WAKE_AOWAKE_MASK_W(x) (0x180 + ((x) << 2))
#define WAKE_AOWAKE_MASK_R(x) (0x300 + ((x) << 2)) #define WAKE_AOWAKE_MASK_R(x) (0x300 + ((x) << 2))
#define WAKE_AOWAKE_STATUS_W(x) (0x30c + ((x) << 2)) #define WAKE_AOWAKE_STATUS_W(x) (0x30c + ((x) << 2))
@ -191,6 +192,8 @@
#define WAKE_AOWAKE_CTRL 0x4f4 #define WAKE_AOWAKE_CTRL 0x4f4
#define WAKE_AOWAKE_CTRL_INTR_POLARITY BIT(0) #define WAKE_AOWAKE_CTRL_INTR_POLARITY BIT(0)
#define SW_WAKE_ID 83 /* wake83 */
/* for secure PMC */ /* for secure PMC */
#define TEGRA_SMC_PMC 0xc2fffe00 #define TEGRA_SMC_PMC 0xc2fffe00
#define TEGRA_SMC_PMC_READ 0xaa #define TEGRA_SMC_PMC_READ 0xaa
@ -355,6 +358,7 @@ struct tegra_pmc_soc {
void (*setup_irq_polarity)(struct tegra_pmc *pmc, void (*setup_irq_polarity)(struct tegra_pmc *pmc,
struct device_node *np, struct device_node *np,
bool invert); bool invert);
void (*set_wake_filters)(struct tegra_pmc *pmc);
int (*irq_set_wake)(struct irq_data *data, unsigned int on); int (*irq_set_wake)(struct irq_data *data, unsigned int on);
int (*irq_set_type)(struct irq_data *data, unsigned int type); int (*irq_set_type)(struct irq_data *data, unsigned int type);
int (*powergate_set)(struct tegra_pmc *pmc, unsigned int id, int (*powergate_set)(struct tegra_pmc *pmc, unsigned int id,
@ -2416,6 +2420,17 @@ static int tegra210_pmc_irq_set_type(struct irq_data *data, unsigned int type)
return 0; return 0;
} }
static void tegra186_pmc_set_wake_filters(struct tegra_pmc *pmc)
{
u32 value;
/* SW Wake (wake83) needs SR_CAPTURE filter to be enabled */
value = readl(pmc->wake + WAKE_AOWAKE_CNTRL(SW_WAKE_ID));
value |= WAKE_AOWAKE_CNTRL_SR_CAPTURE_EN;
writel(value, pmc->wake + WAKE_AOWAKE_CNTRL(SW_WAKE_ID));
dev_dbg(pmc->dev, "WAKE_AOWAKE_CNTRL_83 = 0x%x\n", value);
}
static int tegra186_pmc_irq_set_wake(struct irq_data *data, unsigned int on) static int tegra186_pmc_irq_set_wake(struct irq_data *data, unsigned int on)
{ {
struct tegra_pmc *pmc = irq_data_get_irq_chip_data(data); struct tegra_pmc *pmc = irq_data_get_irq_chip_data(data);
@ -3042,6 +3057,10 @@ static int tegra_pmc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pmc); platform_set_drvdata(pdev, pmc);
tegra_pm_init_suspend(); tegra_pm_init_suspend();
/* Some wakes require specific filter configuration */
if (pmc->soc->set_wake_filters)
pmc->soc->set_wake_filters(pmc);
return 0; return 0;
cleanup_powergates: cleanup_powergates:
@ -3938,6 +3957,7 @@ static const struct tegra_pmc_soc tegra186_pmc_soc = {
.regs = &tegra186_pmc_regs, .regs = &tegra186_pmc_regs,
.init = tegra186_pmc_init, .init = tegra186_pmc_init,
.setup_irq_polarity = tegra186_pmc_setup_irq_polarity, .setup_irq_polarity = tegra186_pmc_setup_irq_polarity,
.set_wake_filters = tegra186_pmc_set_wake_filters,
.irq_set_wake = tegra186_pmc_irq_set_wake, .irq_set_wake = tegra186_pmc_irq_set_wake,
.irq_set_type = tegra186_pmc_irq_set_type, .irq_set_type = tegra186_pmc_irq_set_type,
.reset_sources = tegra186_reset_sources, .reset_sources = tegra186_reset_sources,
@ -4122,6 +4142,7 @@ static const struct tegra_pmc_soc tegra194_pmc_soc = {
.regs = &tegra194_pmc_regs, .regs = &tegra194_pmc_regs,
.init = tegra186_pmc_init, .init = tegra186_pmc_init,
.setup_irq_polarity = tegra186_pmc_setup_irq_polarity, .setup_irq_polarity = tegra186_pmc_setup_irq_polarity,
.set_wake_filters = tegra186_pmc_set_wake_filters,
.irq_set_wake = tegra186_pmc_irq_set_wake, .irq_set_wake = tegra186_pmc_irq_set_wake,
.irq_set_type = tegra186_pmc_irq_set_type, .irq_set_type = tegra186_pmc_irq_set_type,
.reset_sources = tegra194_reset_sources, .reset_sources = tegra194_reset_sources,
@ -4225,7 +4246,9 @@ static const char * const tegra234_reset_sources[] = {
}; };
static const struct tegra_wake_event tegra234_wake_events[] = { static const struct tegra_wake_event tegra234_wake_events[] = {
TEGRA_WAKE_IRQ("pmu", 24, 209),
TEGRA_WAKE_GPIO("power", 29, 1, TEGRA234_AON_GPIO(EE, 4)), TEGRA_WAKE_GPIO("power", 29, 1, TEGRA234_AON_GPIO(EE, 4)),
TEGRA_WAKE_GPIO("mgbe", 56, 0, TEGRA234_MAIN_GPIO(Y, 3)),
TEGRA_WAKE_IRQ("rtc", 73, 10), TEGRA_WAKE_IRQ("rtc", 73, 10),
}; };
@ -4247,6 +4270,7 @@ static const struct tegra_pmc_soc tegra234_pmc_soc = {
.regs = &tegra234_pmc_regs, .regs = &tegra234_pmc_regs,
.init = tegra186_pmc_init, .init = tegra186_pmc_init,
.setup_irq_polarity = tegra186_pmc_setup_irq_polarity, .setup_irq_polarity = tegra186_pmc_setup_irq_polarity,
.set_wake_filters = tegra186_pmc_set_wake_filters,
.irq_set_wake = tegra186_pmc_irq_set_wake, .irq_set_wake = tegra186_pmc_irq_set_wake,
.irq_set_type = tegra186_pmc_irq_set_type, .irq_set_type = tegra186_pmc_irq_set_type,
.reset_sources = tegra234_reset_sources, .reset_sources = tegra234_reset_sources,

View File

@ -286,7 +286,7 @@ remove:
tegra_powergate_remove(powergate); tegra_powergate_remove(powergate);
} }
kfree(genpd->domains); kfree(domains);
return err; return err;
} }