Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bdec5a6b authored by David Lechner's avatar David Lechner Committed by Sekhar Nori
Browse files

ARM: da8xx: use platform data for CFGCHIP syscon regmap



This converts from using a platform device for the CFGCHIP syscon
regmap to using platform data to pass the regmap to consumers.

A lazy getter function is used so that the regmap will only be
created if it is actually used. This function will also be used
in the clock init when we convert to the common clock framework.

The USB PHY driver is currently the only consumer. This driver is
updated to use platform data to get the CFGCHIP regmap instead of
syscon_regmap_lookup_by_pdevname().

Signed-off-by: default avatarDavid Lechner <david@lechnology.com>
Acked-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
parent e98bbbf3
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -551,10 +551,6 @@ static __init void da830_evm_init(void)
	struct davinci_soc_info *soc_info = &davinci_soc_info;
	int ret;

	ret = da8xx_register_cfgchip();
	if (ret)
		pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret);

	ret = da830_register_gpio();
	if (ret)
		pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
+0 −4
Original line number Diff line number Diff line
@@ -1334,10 +1334,6 @@ static __init void da850_evm_init(void)
{
	int ret;

	ret = da8xx_register_cfgchip();
	if (ret)
		pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret);

	ret = da850_register_gpio();
	if (ret)
		pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
+0 −4
Original line number Diff line number Diff line
@@ -502,10 +502,6 @@ static void __init mityomapl138_init(void)
{
	int ret;

	ret = da8xx_register_cfgchip();
	if (ret)
		pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret);

	/* for now, no special EDMA channels are reserved */
	ret = da850_register_edma(NULL);
	if (ret)
+0 −4
Original line number Diff line number Diff line
@@ -281,10 +281,6 @@ static __init void omapl138_hawk_init(void)
{
	int ret;

	ret = da8xx_register_cfgchip();
	if (ret)
		pr_warn("%s: CFGCHIP registration failed: %d\n", __func__, ret);

	ret = da850_register_gpio();
	if (ret)
		pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
+24 −21
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@
 * (at your option) any later version.
 */
#include <linux/init.h>
#include <linux/platform_data/syscon.h>
#include <linux/platform_device.h>
#include <linux/dma-contiguous.h>
#include <linux/serial_8250.h>
@@ -1118,29 +1117,33 @@ int __init da850_register_sata(unsigned long refclkpn)
}
#endif

static struct syscon_platform_data da8xx_cfgchip_platform_data = {
	.label	= "cfgchip",
};
static struct regmap *da8xx_cfgchip;

static struct resource da8xx_cfgchip_resources[] = {
	{
		.start	= DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP0_REG,
		.end	= DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP4_REG + 3,
		.flags	= IORESOURCE_MEM,
	},
};
/* regmap doesn't make a copy of this, so we need to keep the pointer around */
static const char da8xx_cfgchip_name[] = "cfgchip";

static struct platform_device da8xx_cfgchip_device = {
	.name	= "syscon",
	.id	= -1,
	.dev	= {
		.platform_data	= &da8xx_cfgchip_platform_data,
	},
	.num_resources	= ARRAY_SIZE(da8xx_cfgchip_resources),
	.resource	= da8xx_cfgchip_resources,
static const struct regmap_config da8xx_cfgchip_config __initconst = {
	.name		= da8xx_cfgchip_name,
	.reg_bits	= 32,
	.val_bits	= 32,
	.reg_stride	= 4,
	.max_register	= DA8XX_CFGCHIP4_REG - DA8XX_CFGCHIP0_REG,
};

int __init da8xx_register_cfgchip(void)
/**
 * da8xx_get_cfgchip - Lazy gets CFGCHIP as regmap
 *
 * This is for use on non-DT boards only. For DT boards, use
 * syscon_regmap_lookup_by_compatible("ti,da830-cfgchip")
 *
 * Returns: Pointer to the CFGCHIP regmap or negative error code.
 */
struct regmap * __init da8xx_get_cfgchip(void)
{
	return platform_device_register(&da8xx_cfgchip_device);
	if (IS_ERR_OR_NULL(da8xx_cfgchip))
		da8xx_cfgchip = regmap_init_mmio(NULL,
					DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG),
					&da8xx_cfgchip_config);

	return da8xx_cfgchip;
}
Loading