Skip to content

Commit 6861781

Browse files
khayash1kishon
authored andcommitted
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: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
1 parent 04de8fa commit 6861781

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

‎drivers/phy/socionext/phy-uniphier-pcie.c‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ struct uniphier_pciephy_priv {
5555
};
5656

5757
struct uniphier_pciephy_soc_data {
58-
bool has_syscon;
5958
bool is_legacy;
59+
void (*set_phymode)(struct regmap *regmap);
6060
};
6161

6262
static void uniphier_pciephy_testio_write(struct uniphier_pciephy_priv *priv,
@@ -243,28 +243,31 @@ static int uniphier_pciephy_probe(struct platform_device *pdev)
243243

244244
regmap = syscon_regmap_lookup_by_phandle(dev->of_node,
245245
"socionext,syscon");
246-
if (!IS_ERR(regmap) && priv->data->has_syscon)
247-
regmap_update_bits(regmap, SG_USBPCIESEL,
248-
SG_USBPCIESEL_PCIE, SG_USBPCIESEL_PCIE);
246+
if (!IS_ERR(regmap) && priv->data->set_phymode)
247+
priv->data->set_phymode(regmap);
249248

250249
phy_set_drvdata(phy, priv);
251250
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
252251

253252
return PTR_ERR_OR_ZERO(phy_provider);
254253
}
255254

255+
static void uniphier_pciephy_ld20_setmode(struct regmap *regmap)
256+
{
257+
regmap_update_bits(regmap, SG_USBPCIESEL,
258+
SG_USBPCIESEL_PCIE, SG_USBPCIESEL_PCIE);
259+
}
260+
256261
static const struct uniphier_pciephy_soc_data uniphier_pro5_data = {
257-
.has_syscon = false,
258262
.is_legacy = true,
259263
};
260264

261265
static const struct uniphier_pciephy_soc_data uniphier_ld20_data = {
262-
.has_syscon = true,
263266
.is_legacy = false,
267+
.set_phymode = uniphier_pciephy_ld20_setmode,
264268
};
265269

266270
static const struct uniphier_pciephy_soc_data uniphier_pxs3_data = {
267-
.has_syscon = false,
268271
.is_legacy = false,
269272
};
270273

0 commit comments

Comments
 (0)