Commit 672faa7b authored by Colin Foster's avatar Colin Foster Committed by David S. Miller
Browse files

phy: phy-ocelot-serdes: add ability to be used in a non-syscon configuration



The phy-ocelot-serdes module has exclusively been used in a syscon setup,
from an internal CPU. The addition of external control of ocelot switches
via an existing MFD implementation means that syscon is no longer the only
interface that phy-ocelot-serdes will see.

In the MFD configuration, an IORESOURCE_REG resource will exist for the
device. Utilize this resource to be able to function in both syscon and
non-syscon configurations.

Signed-off-by: default avatarColin Foster <colin.foster@in-advantage.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d4671cb9
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -494,6 +494,7 @@ static int serdes_probe(struct platform_device *pdev)
{
{
	struct phy_provider *provider;
	struct phy_provider *provider;
	struct serdes_ctrl *ctrl;
	struct serdes_ctrl *ctrl;
	struct resource *res;
	unsigned int i;
	unsigned int i;
	int ret;
	int ret;


@@ -503,6 +504,14 @@ static int serdes_probe(struct platform_device *pdev)


	ctrl->dev = &pdev->dev;
	ctrl->dev = &pdev->dev;
	ctrl->regs = syscon_node_to_regmap(pdev->dev.parent->of_node);
	ctrl->regs = syscon_node_to_regmap(pdev->dev.parent->of_node);
	if (IS_ERR(ctrl->regs)) {
		/* Fall back to using IORESOURCE_REG, if possible */
		res = platform_get_resource(pdev, IORESOURCE_REG, 0);
		if (res)
			ctrl->regs = dev_get_regmap(ctrl->dev->parent,
						    res->name);
	}

	if (IS_ERR(ctrl->regs))
	if (IS_ERR(ctrl->regs))
		return PTR_ERR(ctrl->regs);
		return PTR_ERR(ctrl->regs);