@@ -18,6 +18,7 @@
#include <linux/of_address.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
+#include <linux/of_device.h>
/******* USB2.0 Host registers (original offset is +0x200) *******/
#define USB2_INT_ENABLE 0x000
@@ -150,9 +151,22 @@ static struct phy_ops rcar_gen3_phy_usb2_ops = {
.owner = THIS_MODULE,
};
+static const struct phy_ops rz_g1c_phy_usb2_ops = {
+ .init = rcar_gen3_phy_usb2_init,
+ .exit = rcar_gen3_phy_usb2_exit,
+ .owner = THIS_MODULE,
+};
+
static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = {
- { .compatible = "renesas,usb2-phy-r8a7795" },
- { }
+ {
+ .compatible = "renesas,usb2-phy-r8a77470",
+ .data = &rz_g1c_phy_usb2_ops,
+ },
+ {
+ .compatible = "renesas,usb2-phy-r8a7795",
+ .data = &rcar_gen3_phy_usb2_ops,
+ },
+ { /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, rcar_gen3_phy_usb2_match_table);
@@ -162,6 +176,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
struct rcar_gen3_chan *channel;
struct phy_provider *provider;
struct resource *res;
+ const struct phy_ops *phy_usb2_ops;
if (!dev->of_node) {
dev_err(dev, "This driver needs device tree\n");
@@ -188,7 +203,11 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
}
/* devm_phy_create() will call pm_runtime_enable(dev); */
- channel->phy = devm_phy_create(dev, NULL, &rcar_gen3_phy_usb2_ops);
+ phy_usb2_ops = of_device_get_match_data(dev);
+ if (!phy_usb2_ops)
+ return -EINVAL;
+
+ channel->phy = devm_phy_create(dev, NULL, phy_usb2_ops);
if (IS_ERR(channel->phy)) {
dev_err(dev, "Failed to create USB2 PHY\n");
return PTR_ERR(channel->phy);