soc/tegra: Changes for v4.14-rc1

Contains a fix for unbalanced reference counting of device tree nodes in
 the PMC-based generic power domains code.
 
 A second change moves the SoC device registration code from its old
 location in arch/arm/mach-tegra to drivers/soc/tegra so that it can be
 shared between 32-bit and 64-bit ARM Tegra SoCs.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAlmW+3ITHHRyZWRpbmdA
 bnZpZGlhLmNvbQAKCRDdI6zXfz6zocmaEACeb9YuHAXaLz4ujzE8JiDmjIIKTtbd
 16d75z/d29vVfxCzKAV7yzqugJjPsvc1J6IsWA5g9m+0O36chgpqaQq6AOmTP4us
 zE9WRXG922aGu3++9YQVFA3I+ew/9SKBMDJ53JptP8oQsHNERolgNgV5OAeX1SQ7
 XBrGLvsnLWtYIj4QjtkbTQhRy8/O7r4kl/mNWuh5LP+dmYA5dfd8v2d2w2xBGKua
 4w9f1iLK8fJnBoRXNZj+e/d4LFsYuZcElsqQ46fHN0APAjg9TBuTvYGTAmWeAP8b
 VEKjTR1Jaix8XLxyjjIivEUT591BnO15NLfZ3yC8/1wY64daRtE3oFuH3VLM5fgt
 E1mrIAd3SJSt2zD/ubh1+Dm21e7bXehajsb+AL6t6wheHbVlM4jf0rjszzGGZof6
 s76IY1WcuSYQYx0u0S3upPGBcjPqw+JEf/4hJQ8H/RXpx70v1KDP4dUW6PR58jxk
 cPZeOtcqLGWvCfg04/U20OjWn2mpVDU1Gbr7nO5J0xyam/IG7fiDgU4hFLC7HqoE
 q67QI7/kssGRmYuWQMBu+cqLj6saOXTUDLvGCrN508r04HbuVwhK4t42P+tmaK8G
 ujDNcsdcekjvWn7tgxm5LV7m0puCWbblBwV2WTaFaR5Jv/EKRBQisBByDndNxy8h
 lFV8tbUTL8tvNw==
 =Qbm4
 -----END PGP SIGNATURE-----

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

Pull "soc/tegra: Changes for v4.14-rc1" from Thierry Reding:

Contains a fix for unbalanced reference counting of device tree nodes in
the PMC-based generic power domains code.

A second change moves the SoC device registration code from its old
location in arch/arm/mach-tegra to drivers/soc/tegra so that it can be
shared between 32-bit and 64-bit ARM Tegra SoCs.

* tag 'tegra-for-4.14-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  soc/tegra: Register SoC device
  soc/tegra: Fix bad of_node_put() in powergate init
This commit is contained in:
Arnd Bergmann 2017-08-18 23:29:52 +02:00
commit f2970be50a
5 changed files with 55 additions and 33 deletions

View File

@ -84,35 +84,8 @@ static void __init tegra_dt_init_irq(void)
static void __init tegra_dt_init(void)
{
struct soc_device_attribute *soc_dev_attr;
struct soc_device *soc_dev;
struct device *parent = NULL;
struct device *parent = tegra_soc_device_register();
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
if (!soc_dev_attr)
goto out;
soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra");
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d",
tegra_sku_info.revision);
soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id());
soc_dev = soc_device_register(soc_dev_attr);
if (IS_ERR(soc_dev)) {
kfree(soc_dev_attr->family);
kfree(soc_dev_attr->revision);
kfree(soc_dev_attr->soc_id);
kfree(soc_dev_attr);
goto out;
}
parent = soc_device_to_device(soc_dev);
/*
* Finished with the static registrations now; fill in the missing
* devices
*/
out:
of_platform_default_populate(NULL, NULL, parent);
}

View File

@ -107,6 +107,11 @@ config ARCH_TEGRA_186_SOC
endif
endif
config SOC_TEGRA_FUSE
def_bool y
depends on ARCH_TEGRA
select SOC_BUS
config SOC_TEGRA_FLOWCTRL
bool

View File

@ -19,10 +19,12 @@
#include <linux/device.h>
#include <linux/kobject.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/sys_soc.h>
#include <soc/tegra/common.h>
#include <soc/tegra/fuse.h>
@ -210,6 +212,31 @@ static void tegra_enable_fuse_clk(void __iomem *base)
writel(reg, base + 0x14);
}
struct device * __init tegra_soc_device_register(void)
{
struct soc_device_attribute *attr;
struct soc_device *dev;
attr = kzalloc(sizeof(*attr), GFP_KERNEL);
if (!attr)
return NULL;
attr->family = kasprintf(GFP_KERNEL, "Tegra");
attr->revision = kasprintf(GFP_KERNEL, "%d", tegra_sku_info.revision);
attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id());
dev = soc_device_register(attr);
if (IS_ERR(dev)) {
kfree(attr->soc_id);
kfree(attr->revision);
kfree(attr->family);
kfree(attr);
return ERR_CAST(dev);
}
return soc_device_to_device(dev);
}
static int __init tegra_init_fuse(void)
{
const struct of_device_id *match;
@ -311,6 +338,23 @@ static int __init tegra_init_fuse(void)
pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id);
return 0;
}
early_initcall(tegra_init_fuse);
#ifdef CONFIG_ARM64
static int __init tegra_init_soc(void)
{
struct device *soc;
soc = tegra_soc_device_register();
if (IS_ERR(soc)) {
pr_err("failed to register SoC device: %ld\n", PTR_ERR(soc));
return PTR_ERR(soc);
}
return 0;
}
device_initcall(tegra_init_soc)
#endif

View File

@ -918,10 +918,8 @@ static void tegra_powergate_init(struct tegra_pmc *pmc,
if (!np)
return;
for_each_child_of_node(np, child) {
for_each_child_of_node(np, child)
tegra_powergate_add(pmc, child);
of_node_put(child);
}
of_node_put(np);
}

View File

@ -65,6 +65,8 @@ int tegra_fuse_readl(unsigned long offset, u32 *value);
extern struct tegra_sku_info tegra_sku_info;
struct device *tegra_soc_device_register(void);
#endif /* __ASSEMBLY__ */
#endif /* __SOC_TEGRA_FUSE_H__ */