Skip to content

Commit 5d8042e

Browse files
bijudaskishon
authored andcommitted
phy: rcar-gen3-usb2: Add support for r8a77470
This patch adds support for r8a77470 (RZ/G1C). We can reuse this driver for initializing timing/interrupt generation registers. Signed-off-by: Biju Das <[email protected]> Reviewed-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Kishon Vijay Abraham I <[email protected]>
1 parent b7187e0 commit 5d8042e

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

drivers/phy/renesas/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ config PHY_RCAR_GEN3_PCIE
1919
config PHY_RCAR_GEN3_USB2
2020
tristate "Renesas R-Car generation 3 USB 2.0 PHY driver"
2121
depends on ARCH_RENESAS
22-
depends on EXTCON
22+
depends on EXTCON || !EXTCON # if EXTCON=m, this cannot be built-in
2323
depends on USB_SUPPORT
2424
select GENERIC_PHY
2525
select USB_COMMON

drivers/phy/renesas/phy-rcar-gen3-usb2.c

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,12 @@ static const struct phy_ops rcar_gen3_phy_usb2_ops = {
393393
.owner = THIS_MODULE,
394394
};
395395

396+
static const struct phy_ops rz_g1c_phy_usb2_ops = {
397+
.init = rcar_gen3_phy_usb2_init,
398+
.exit = rcar_gen3_phy_usb2_exit,
399+
.owner = THIS_MODULE,
400+
};
401+
396402
static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch)
397403
{
398404
struct rcar_gen3_chan *ch = _ch;
@@ -411,11 +417,27 @@ static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch)
411417
}
412418

413419
static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = {
414-
{ .compatible = "renesas,usb2-phy-r8a7795" },
415-
{ .compatible = "renesas,usb2-phy-r8a7796" },
416-
{ .compatible = "renesas,usb2-phy-r8a77965" },
417-
{ .compatible = "renesas,rcar-gen3-usb2-phy" },
418-
{ }
420+
{
421+
.compatible = "renesas,usb2-phy-r8a77470",
422+
.data = &rz_g1c_phy_usb2_ops,
423+
},
424+
{
425+
.compatible = "renesas,usb2-phy-r8a7795",
426+
.data = &rcar_gen3_phy_usb2_ops,
427+
},
428+
{
429+
.compatible = "renesas,usb2-phy-r8a7796",
430+
.data = &rcar_gen3_phy_usb2_ops,
431+
},
432+
{
433+
.compatible = "renesas,usb2-phy-r8a77965",
434+
.data = &rcar_gen3_phy_usb2_ops,
435+
},
436+
{
437+
.compatible = "renesas,rcar-gen3-usb2-phy",
438+
.data = &rcar_gen3_phy_usb2_ops,
439+
},
440+
{ /* sentinel */ },
419441
};
420442
MODULE_DEVICE_TABLE(of, rcar_gen3_phy_usb2_match_table);
421443

@@ -431,6 +453,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
431453
struct rcar_gen3_chan *channel;
432454
struct phy_provider *provider;
433455
struct resource *res;
456+
const struct phy_ops *phy_usb2_ops;
434457
int irq, ret = 0;
435458

436459
if (!dev->of_node) {
@@ -481,7 +504,11 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
481504
* And then, phy-core will manage runtime pm for this device.
482505
*/
483506
pm_runtime_enable(dev);
484-
channel->phy = devm_phy_create(dev, NULL, &rcar_gen3_phy_usb2_ops);
507+
phy_usb2_ops = of_device_get_match_data(dev);
508+
if (!phy_usb2_ops)
509+
return -EINVAL;
510+
511+
channel->phy = devm_phy_create(dev, NULL, phy_usb2_ops);
485512
if (IS_ERR(channel->phy)) {
486513
dev_err(dev, "Failed to create USB2 PHY\n");
487514
ret = PTR_ERR(channel->phy);

0 commit comments

Comments
 (0)