diff options
author | Colin Foster <colin.foster@in-advantage.com> | 2023-03-17 21:54:07 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-03-20 12:08:48 +0300 |
commit | 672faa7bbf6014a301b6edc477918af445c92ce2 (patch) | |
tree | d28636ae2f25f25077271109384729d5e61b0f08 /drivers/phy | |
parent | d4671cb96fa317e2b1f410367a52f731a145e2bc (diff) | |
download | linux-672faa7bbf6014a301b6edc477918af445c92ce2.tar.xz |
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: Colin Foster <colin.foster@in-advantage.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/mscc/phy-ocelot-serdes.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/phy/mscc/phy-ocelot-serdes.c b/drivers/phy/mscc/phy-ocelot-serdes.c index 76f596365176..d9443e865a78 100644 --- a/drivers/phy/mscc/phy-ocelot-serdes.c +++ b/drivers/phy/mscc/phy-ocelot-serdes.c @@ -494,6 +494,7 @@ static int serdes_probe(struct platform_device *pdev) { struct phy_provider *provider; struct serdes_ctrl *ctrl; + struct resource *res; unsigned int i; int ret; @@ -503,6 +504,14 @@ static int serdes_probe(struct platform_device *pdev) ctrl->dev = &pdev->dev; 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)) return PTR_ERR(ctrl->regs); |