dm: core: Access device ofnode through functions
[platform/kernel/u-boot.git] / drivers / usb / gadget / dwc2_udc_otg.c
index 93b1c60..e3871e3 100644 (file)
@@ -980,15 +980,15 @@ static void dwc2_phy_shutdown(struct udevice *dev, struct phy_bulk *phys)
        generic_phy_exit_bulk(phys);
 }
 
-static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)
+static int dwc2_udc_otg_of_to_plat(struct udevice *dev)
 {
-       struct dwc2_plat_otg_data *plat = dev_get_platdata(dev);
+       struct dwc2_plat_otg_data *plat = dev_get_plat(dev);
        ulong drvdata;
        void (*set_params)(struct dwc2_plat_otg_data *data);
        int ret;
 
-       if (usb_get_dr_mode(dev->node) != USB_DR_MODE_PERIPHERAL &&
-           usb_get_dr_mode(dev->node) != USB_DR_MODE_OTG) {
+       if (usb_get_dr_mode(dev_ofnode(dev)) != USB_DR_MODE_PERIPHERAL &&
+           usb_get_dr_mode(dev_ofnode(dev)) != USB_DR_MODE_OTG) {
                dev_dbg(dev, "Invalid mode\n");
                return -ENODEV;
        }
@@ -1090,7 +1090,7 @@ static int dwc2_udc_otg_clk_init(struct udevice *dev,
 
 static int dwc2_udc_otg_probe(struct udevice *dev)
 {
-       struct dwc2_plat_otg_data *plat = dev_get_platdata(dev);
+       struct dwc2_plat_otg_data *plat = dev_get_plat(dev);
        struct dwc2_priv_data *priv = dev_get_priv(dev);
        struct dwc2_usbotg_reg *usbotg_reg =
                (struct dwc2_usbotg_reg *)plat->regs_otg;
@@ -1185,7 +1185,7 @@ U_BOOT_DRIVER(dwc2_udc_otg) = {
        .name   = "dwc2-udc-otg",
        .id     = UCLASS_USB_GADGET_GENERIC,
        .of_match = dwc2_udc_otg_ids,
-       .ofdata_to_platdata = dwc2_udc_otg_ofdata_to_platdata,
+       .of_to_plat = dwc2_udc_otg_of_to_plat,
        .probe = dwc2_udc_otg_probe,
        .remove = dwc2_udc_otg_remove,
        .plat_auto      = sizeof(struct dwc2_plat_otg_data),
@@ -1194,7 +1194,7 @@ U_BOOT_DRIVER(dwc2_udc_otg) = {
 
 int dwc2_udc_B_session_valid(struct udevice *dev)
 {
-       struct dwc2_plat_otg_data *plat = dev_get_platdata(dev);
+       struct dwc2_plat_otg_data *plat = dev_get_plat(dev);
        struct dwc2_usbotg_reg *usbotg_reg =
                (struct dwc2_usbotg_reg *)plat->regs_otg;