Commit 6861781a authored by Kunihiko Hayashi's avatar Kunihiko Hayashi Committed by Kishon Vijay Abraham I

phy: uniphier-pcie: Add SoC-dependent phy-mode function support

Since this phy is shared by multiple devices including USB and PCIe,
it is necessary to determine which device use this phy.
This patch adds SoC-dependent functions to determine a device using
this phy.

When there is 'socionext,syscon' property in the pcie-phy node,
the driver calls SoC-dependt function instead of checking .has_syscon
in SoC-dependent data. The function configures the system controller
to use phy for PCIe.
Signed-off-by: default avatarKunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent 04de8fa2
...@@ -55,8 +55,8 @@ struct uniphier_pciephy_priv { ...@@ -55,8 +55,8 @@ struct uniphier_pciephy_priv {
}; };
struct uniphier_pciephy_soc_data { struct uniphier_pciephy_soc_data {
bool has_syscon;
bool is_legacy; bool is_legacy;
void (*set_phymode)(struct regmap *regmap);
}; };
static void uniphier_pciephy_testio_write(struct uniphier_pciephy_priv *priv, static void uniphier_pciephy_testio_write(struct uniphier_pciephy_priv *priv,
...@@ -243,9 +243,8 @@ static int uniphier_pciephy_probe(struct platform_device *pdev) ...@@ -243,9 +243,8 @@ static int uniphier_pciephy_probe(struct platform_device *pdev)
regmap = syscon_regmap_lookup_by_phandle(dev->of_node, regmap = syscon_regmap_lookup_by_phandle(dev->of_node,
"socionext,syscon"); "socionext,syscon");
if (!IS_ERR(regmap) && priv->data->has_syscon) if (!IS_ERR(regmap) && priv->data->set_phymode)
regmap_update_bits(regmap, SG_USBPCIESEL, priv->data->set_phymode(regmap);
SG_USBPCIESEL_PCIE, SG_USBPCIESEL_PCIE);
phy_set_drvdata(phy, priv); phy_set_drvdata(phy, priv);
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
...@@ -253,18 +252,22 @@ static int uniphier_pciephy_probe(struct platform_device *pdev) ...@@ -253,18 +252,22 @@ static int uniphier_pciephy_probe(struct platform_device *pdev)
return PTR_ERR_OR_ZERO(phy_provider); return PTR_ERR_OR_ZERO(phy_provider);
} }
static void uniphier_pciephy_ld20_setmode(struct regmap *regmap)
{
regmap_update_bits(regmap, SG_USBPCIESEL,
SG_USBPCIESEL_PCIE, SG_USBPCIESEL_PCIE);
}
static const struct uniphier_pciephy_soc_data uniphier_pro5_data = { static const struct uniphier_pciephy_soc_data uniphier_pro5_data = {
.has_syscon = false,
.is_legacy = true, .is_legacy = true,
}; };
static const struct uniphier_pciephy_soc_data uniphier_ld20_data = { static const struct uniphier_pciephy_soc_data uniphier_ld20_data = {
.has_syscon = true,
.is_legacy = false, .is_legacy = false,
.set_phymode = uniphier_pciephy_ld20_setmode,
}; };
static const struct uniphier_pciephy_soc_data uniphier_pxs3_data = { static const struct uniphier_pciephy_soc_data uniphier_pxs3_data = {
.has_syscon = false,
.is_legacy = false, .is_legacy = false,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment