diff options
Diffstat (limited to 'drivers/usb/gadget')
| -rw-r--r-- | drivers/usb/gadget/dwc2_udc_otg.c | 63 | ||||
| -rw-r--r-- | drivers/usb/gadget/ether.c | 24 | ||||
| -rw-r--r-- | drivers/usb/gadget/max3420_udc.c | 8 |
3 files changed, 51 insertions, 44 deletions
diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c index 8a8e2179e48..e3871e381e1 100644 --- a/drivers/usb/gadget/dwc2_udc_otg.c +++ b/drivers/usb/gadget/dwc2_udc_otg.c @@ -980,48 +980,47 @@ 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 *platdata = 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; } - platdata->regs_otg = dev_read_addr(dev); + plat->regs_otg = dev_read_addr(dev); - platdata->rx_fifo_sz = dev_read_u32_default(dev, "g-rx-fifo-size", 0); - platdata->np_tx_fifo_sz = dev_read_u32_default(dev, - "g-np-tx-fifo-size", 0); + plat->rx_fifo_sz = dev_read_u32_default(dev, "g-rx-fifo-size", 0); + plat->np_tx_fifo_sz = dev_read_u32_default(dev, "g-np-tx-fifo-size", 0); - platdata->tx_fifo_sz_nb = + plat->tx_fifo_sz_nb = dev_read_size(dev, "g-tx-fifo-size") / sizeof(u32); - if (platdata->tx_fifo_sz_nb > DWC2_MAX_HW_ENDPOINTS) - platdata->tx_fifo_sz_nb = DWC2_MAX_HW_ENDPOINTS; - if (platdata->tx_fifo_sz_nb) { + if (plat->tx_fifo_sz_nb > DWC2_MAX_HW_ENDPOINTS) + plat->tx_fifo_sz_nb = DWC2_MAX_HW_ENDPOINTS; + if (plat->tx_fifo_sz_nb) { ret = dev_read_u32_array(dev, "g-tx-fifo-size", - platdata->tx_fifo_sz_array, - platdata->tx_fifo_sz_nb); + plat->tx_fifo_sz_array, + plat->tx_fifo_sz_nb); if (ret) return ret; } - platdata->force_b_session_valid = + plat->force_b_session_valid = dev_read_bool(dev, "u-boot,force-b-session-valid"); - platdata->force_vbus_detection = + plat->force_vbus_detection = dev_read_bool(dev, "u-boot,force-vbus-detection"); - /* force platdata according compatible */ + /* force plat according compatible */ drvdata = dev_get_driver_data(dev); if (drvdata) { set_params = (void *)drvdata; - set_params(platdata); + set_params(plat); } return 0; @@ -1091,10 +1090,10 @@ static int dwc2_udc_otg_clk_init(struct udevice *dev, static int dwc2_udc_otg_probe(struct udevice *dev) { - struct dwc2_plat_otg_data *platdata = 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 *)platdata->regs_otg; + (struct dwc2_usbotg_reg *)plat->regs_otg; int ret; ret = dwc2_udc_otg_clk_init(dev, &priv->clks); @@ -1109,10 +1108,10 @@ static int dwc2_udc_otg_probe(struct udevice *dev) if (ret) return ret; - if (platdata->activate_stm_id_vb_detection) { + if (plat->activate_stm_id_vb_detection) { if (CONFIG_IS_ENABLED(DM_REGULATOR) && - (!platdata->force_b_session_valid || - platdata->force_vbus_detection)) { + (!plat->force_b_session_valid || + plat->force_vbus_detection)) { ret = device_get_supply_regulator(dev, "usb33d-supply", &priv->usb33d_supply); if (ret) { @@ -1126,8 +1125,8 @@ static int dwc2_udc_otg_probe(struct udevice *dev) } } - if (platdata->force_b_session_valid && - !platdata->force_vbus_detection) { + if (plat->force_b_session_valid && + !plat->force_vbus_detection) { /* Override VBUS detection: enable then value*/ setbits_le32(&usbotg_reg->gotgctl, VB_VALOEN); setbits_le32(&usbotg_reg->gotgctl, VB_VALOVAL); @@ -1136,7 +1135,7 @@ static int dwc2_udc_otg_probe(struct udevice *dev) setbits_le32(&usbotg_reg->ggpio, GGPIO_STM32_OTG_GCCFG_VBDEN); } - if (platdata->force_b_session_valid) { + if (plat->force_b_session_valid) { /* Override B session bits: enable then value */ setbits_le32(&usbotg_reg->gotgctl, A_VALOEN | B_VALOEN); setbits_le32(&usbotg_reg->gotgctl, @@ -1148,7 +1147,7 @@ static int dwc2_udc_otg_probe(struct udevice *dev) } } - ret = dwc2_udc_probe(platdata); + ret = dwc2_udc_probe(plat); if (ret) return ret; @@ -1186,18 +1185,18 @@ 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, - .platdata_auto_alloc_size = sizeof(struct dwc2_plat_otg_data), - .priv_auto_alloc_size = sizeof(struct dwc2_priv_data), + .plat_auto = sizeof(struct dwc2_plat_otg_data), + .priv_auto = sizeof(struct dwc2_priv_data), }; int dwc2_udc_B_session_valid(struct udevice *dev) { - struct dwc2_plat_otg_data *platdata = dev_get_platdata(dev); + struct dwc2_plat_otg_data *plat = dev_get_plat(dev); struct dwc2_usbotg_reg *usbotg_reg = - (struct dwc2_usbotg_reg *)platdata->regs_otg; + (struct dwc2_usbotg_reg *)plat->regs_otg; return readl(&usbotg_reg->gotgctl) & B_SESSION_VALID; } diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index a8e8bfc04b4..16922ff15c6 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -1860,10 +1860,18 @@ static int rndis_control_ack(struct eth_device *net) static int rndis_control_ack(struct udevice *net) #endif { - struct ether_priv *priv = (struct ether_priv *)net->priv; - struct eth_dev *dev = &priv->ethdev; - int length; - struct usb_request *resp = dev->stat_req; + struct ether_priv *priv; + struct eth_dev *dev; + int length; + struct usb_request *resp; + +#ifndef CONFIG_DM_ETH + priv = (struct ether_priv *)net->priv; +#else + priv = dev_get_priv(net); +#endif + dev = &priv->ethdev; + resp = dev->stat_req; /* in case RNDIS calls this after disconnect */ if (!dev->status) { @@ -2009,7 +2017,7 @@ static int eth_bind(struct usb_gadget *gadget) int gcnum; u8 tmp[7]; #ifdef CONFIG_DM_ETH - struct eth_pdata *pdata = dev_get_platdata(l_priv->netdev); + struct eth_pdata *pdata = dev_get_plat(l_priv->netdev); #endif /* these flags are only ever cleared; compiler take note */ @@ -2646,7 +2654,7 @@ static void usb_eth_stop(struct udevice *dev) static int usb_eth_probe(struct udevice *dev) { struct ether_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); priv->netdev = dev; l_priv = priv; @@ -2691,8 +2699,8 @@ U_BOOT_DRIVER(eth_usb) = { .id = UCLASS_ETH, .probe = usb_eth_probe, .ops = &usb_eth_ops, - .priv_auto_alloc_size = sizeof(struct ether_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ether_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif /* CONFIG_DM_ETH */ diff --git a/drivers/usb/gadget/max3420_udc.c b/drivers/usb/gadget/max3420_udc.c index b38b9dc68f7..a16095f8927 100644 --- a/drivers/usb/gadget/max3420_udc.c +++ b/drivers/usb/gadget/max3420_udc.c @@ -819,14 +819,14 @@ int dm_usb_gadget_handle_interrupts(struct udevice *dev) static int max3420_udc_probe(struct udevice *dev) { struct max3420_udc *udc = dev_get_priv(dev); - struct dm_spi_slave_platdata *slave_pdata; + struct dm_spi_slave_plat *slave_pdata; struct udevice *bus = dev->parent; - int busnum = bus->seq; + int busnum = dev_seq(bus); unsigned int cs; uint speed, mode; struct udevice *spid; - slave_pdata = dev_get_parent_platdata(dev); + slave_pdata = dev_get_parent_plat(dev); cs = slave_pdata->cs; speed = slave_pdata->max_hz; mode = slave_pdata->mode; @@ -871,5 +871,5 @@ U_BOOT_DRIVER(max3420_generic_udc) = { .of_match = max3420_ids, .probe = max3420_udc_probe, .remove = max3420_udc_remove, - .priv_auto_alloc_size = sizeof(struct max3420_udc), + .priv_auto = sizeof(struct max3420_udc), }; |
