diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/common/common.c | 2 | ||||
-rw-r--r-- | drivers/usb/dwc3/linux-compat.h | 2 | ||||
-rw-r--r-- | drivers/usb/eth/mcs7830.c | 12 | ||||
-rw-r--r-- | drivers/usb/gadget/Kconfig | 82 | ||||
-rw-r--r-- | drivers/usb/gadget/at91_udc.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/atmel_usba_udc.c | 6 | ||||
-rw-r--r-- | drivers/usb/gadget/dwc2_udc_otg.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/ether.c | 58 | ||||
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 10 | ||||
-rw-r--r-- | drivers/usb/gadget/f_sdp.c | 16 | ||||
-rw-r--r-- | drivers/usb/gadget/f_thor.c | 26 | ||||
-rw-r--r-- | drivers/usb/gadget/g_dnl.c | 12 | ||||
-rw-r--r-- | drivers/usb/host/Kconfig | 8 | ||||
-rw-r--r-- | drivers/usb/host/Makefile | 1 | ||||
-rw-r--r-- | drivers/usb/host/dwc2.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/dwc3-sti-glue.c | 28 | ||||
-rw-r--r-- | drivers/usb/host/ehci-generic.c | 18 | ||||
-rw-r--r-- | drivers/usb/host/ehci-rcar_gen3.c | 106 | ||||
-rw-r--r-- | drivers/usb/host/ohci-generic.c | 18 | ||||
-rw-r--r-- | drivers/usb/host/xhci-dwc3.c | 6 | ||||
-rw-r--r-- | drivers/usb/host/xhci-rockchip.c | 12 | ||||
-rw-r--r-- | drivers/usb/musb-new/linux-compat.h | 2 | ||||
-rw-r--r-- | drivers/usb/musb-new/sunxi.c | 56 | ||||
-rw-r--r-- | drivers/usb/musb-new/ti-musb.c | 12 |
24 files changed, 224 insertions, 277 deletions
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 35c2dc18d9..e8432bb016 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -28,7 +28,7 @@ enum usb_dr_mode usb_get_dr_mode(int node) dr_mode = fdt_getprop(fdt, node, "dr_mode", NULL); if (!dr_mode) { - error("usb dr_mode not found\n"); + pr_err("usb dr_mode not found\n"); return USB_DR_MODE_UNKNOWN; } diff --git a/drivers/usb/dwc3/linux-compat.h b/drivers/usb/dwc3/linux-compat.h index 9e944a31be..5cbe377e3c 100644 --- a/drivers/usb/dwc3/linux-compat.h +++ b/drivers/usb/dwc3/linux-compat.h @@ -12,10 +12,8 @@ #ifndef __DWC3_LINUX_COMPAT__ #define __DWC3_LINUX_COMPAT__ -#define pr_debug(format) debug(format) #define WARN(val, format, arg...) debug(format, ##arg) #define dev_WARN(dev, format, arg...) debug(format, ##arg) -#define WARN_ON_ONCE(val) debug("Error %d\n", val) static inline size_t strlcat(char *dest, const char *src, size_t n) { diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c index 4abef5d5c8..941d612a68 100644 --- a/drivers/usb/eth/mcs7830.c +++ b/drivers/usb/eth/mcs7830.c @@ -418,25 +418,25 @@ static int mcs7830_basic_reset(struct usb_device *udev, rc = mcs7830_set_autoneg(udev); if (rc < 0) { - error("setting autoneg failed\n"); + pr_err("setting autoneg failed\n"); return rc; } rc = mcs7830_write_mchash(udev, priv); if (rc < 0) { - error("failed to set multicast hash\n"); + pr_err("failed to set multicast hash\n"); return rc; } rc = mcs7830_write_config(udev, priv); if (rc < 0) { - error("failed to set configuration\n"); + pr_err("failed to set configuration\n"); return rc; } rc = mcs7830_apply_fixup(udev); if (rc < 0) { - error("fixup application failed\n"); + pr_err("fixup application failed\n"); return rc; } @@ -541,11 +541,11 @@ static int mcs7830_recv_common(struct ueth_data *ueth, uint8_t *buf) debug("%s() RX want len %d, got len %d, rc %d\n", __func__, wantlen, gotlen, rc); if (rc != 0) { - error("RX: failed to receive\n"); + pr_err("RX: failed to receive\n"); return rc; } if (gotlen > wantlen) { - error("RX: got too many bytes (%d)\n", gotlen); + pr_err("RX: got too many bytes (%d)\n", gotlen); return -EIO; } diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 225b66bc95..102a63b8ee 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -36,6 +36,30 @@ menuconfig USB_GADGET if USB_GADGET +config USB_GADGET_MANUFACTURER + string "Vendor name of the USB device" + default "Allwinner Technology" if ARCH_SUNXI + default "U-Boot" + help + Vendor name of the USB device emulated, reported to the host device. + This is usually either the manufacturer of the device or the SoC. + +config USB_GADGET_VENDOR_NUM + hex "Vendor ID of the USB device" + default 0x1f3a if ARCH_SUNXI + default 0x0 + help + Vendor ID of the USB device emulated, reported to the host device. + This is usually the board or SoC vendor's, unless you've registered + for one. + +config USB_GADGET_PRODUCT_NUM + hex "Product ID of the USB device" + default 0x1010 if ARCH_SUNXI + default 0x0 + help + Product ID of the USB device emulated, reported to the host device. + config USB_GADGET_ATMEL_USBA bool "Atmel USBA" select USB_GADGET_DUALSPEED @@ -110,19 +134,63 @@ config USB_FUNCTION_SDP allows to download images into memory and execute (jump to) them using the same protocol as implemented by the i.MX family's boot ROM. -config G_DNL_MANUFACTURER - string "Vendor name of USB device" +endif # USB_GADGET_DOWNLOAD -config G_DNL_VENDOR_NUM - hex "Vendor ID of USB device" +config USB_ETHER + bool "USB Ethernet Gadget" + default y if ARCH_SUNXI && USB_MUSB_GADGET + help + Creates an Ethernet network device through a USB peripheral + controller. This will create a network interface on both the device + (U-Boot) and the host (remote device) that can be used just like any + other nework interface. + It will bind on the peripheral USB controller, ignoring the USB hosts + controllers in the system. + +if USB_ETHER + +choice + prompt "USB Ethernet Gadget Model" + default USB_ETH_RNDIS + help + There is several models (protocols) to implement Ethernet over USB + devices. The main ones are Microsoft's RNDIS and USB's CDC-Ethernet + (also called CDC-ECM). RNDIS is obviously compatible with Windows, + while CDC-ECM is not. Most other operating systems support both, so + if inter-operability is a concern, RNDIS is to be preferred. + +config USB_ETH_CDC + bool "CDC-ECM Protocol" + help + CDC (Communications Device Class) is the standard for Ethernet over + USB devices. While there's several alternatives, the most widely used + protocol is ECM (Ethernet Control Model). However, compatibility with + Windows is not that great. + +config USB_ETH_RNDIS + bool "RNDIS Protocol" + help + The RNDIS (Remote Network Driver Interface Specification) is a + Microsoft proprietary protocol to create an Ethernet device over USB. + Windows obviously supports it, as well as all the major operating + systems, so it's the best option for compatibility. -config G_DNL_PRODUCT_NUM - hex "Product ID of USB device" +endchoice config USBNET_DEVADDR string "USB Gadget Ethernet device mac address" default "de:ad:be:ef:00:01" + help + Ethernet MAC address of the device-side (ie. local board's) MAC + address of the usb_ether interface -endif # USB_GADGET_DOWNLOAD +config USBNET_HOST_ADDR + string "USB Gadget Ethernet host mac address" + default "de:ad:be:ef:00:00" + help + Ethernet MAC address of the host-side (ie. remote device's) MAC + address of the usb_ether interface + +endif # USB_ETHER endif # USB_GADGET diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 9df6d32c65..ad2f606b78 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -1456,7 +1456,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) ret = driver->bind(&udc->gadget); if (ret) { - error("driver->bind() returned %d\n", ret); + pr_err("driver->bind() returned %d\n", ret); udc->driver = NULL; } @@ -1468,7 +1468,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) struct at91_udc *udc = controller; if (!driver || !driver->unbind || !driver->disconnect) { - error("bad paramter\n"); + pr_err("bad paramter\n"); return -EINVAL; } diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index ad31703c73..c0a95a97c9 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c @@ -1228,7 +1228,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) ret = driver->bind(&udc->gadget); if (ret) { - error("driver->bind() returned %d\n", ret); + pr_err("driver->bind() returned %d\n", ret); udc->driver = NULL; } @@ -1240,7 +1240,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) struct usba_udc *udc = &controller; if (!driver || !driver->unbind || !driver->disconnect) { - error("bad paramter\n"); + pr_err("bad paramter\n"); return -EINVAL; } @@ -1261,7 +1261,7 @@ static struct usba_ep *usba_udc_pdata(struct usba_platform_data *pdata, eps = malloc(sizeof(struct usba_ep) * pdata->num_ep); if (!eps) { - error("failed to alloc eps\n"); + pr_err("failed to alloc eps\n"); return NULL; } diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c index cb44374e81..088811c191 100644 --- a/drivers/usb/gadget/dwc2_udc_otg.c +++ b/drivers/usb/gadget/dwc2_udc_otg.c @@ -835,7 +835,7 @@ int dwc2_udc_probe(struct dwc2_plat_otg_data *pdata) ROUND(sizeof(struct usb_ctrlrequest), CONFIG_SYS_CACHELINE_SIZE)); if (!usb_ctrl) { - error("No memory available for UDC!\n"); + pr_err("No memory available for UDC!\n"); return -ENOMEM; } diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 2cf5c8d31e..a80486e91f 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -273,8 +273,8 @@ static inline int BITRATE(struct usb_gadget *g) * static ushort idProduct; */ -#if defined(CONFIG_USBNET_MANUFACTURER) -static char *iManufacturer = CONFIG_USBNET_MANUFACTURER; +#if defined(CONFIG_USB_GADGET_MANUFACTURER) +static char *iManufacturer = CONFIG_USB_GADGET_MANUFACTURER; #else static char *iManufacturer = "U-Boot"; #endif @@ -1059,7 +1059,7 @@ static int eth_set_config(struct eth_dev *dev, unsigned number, && dev->config && dev->tx_qlen != 0) { /* tx fifo is full, but we can't clear it...*/ - error("can't change configurations"); + pr_err("can't change configurations"); return -ESPIPE; } eth_reset_config(dev); @@ -1233,7 +1233,7 @@ static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req) /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ status = rndis_msg_parser(dev->rndis_config, (u8 *) req->buf); if (status < 0) - error("%s: rndis parse error %d", __func__, status); + pr_err("%s: rndis parse error %d", __func__, status); } #endif /* RNDIS */ @@ -1554,7 +1554,7 @@ static int rx_submit(struct eth_dev *dev, struct usb_request *req, retval = usb_ep_queue(dev->out_ep, req, gfp_flags); if (retval) - error("rx submit --> %d", retval); + pr_err("rx submit --> %d", retval); return retval; } @@ -1624,7 +1624,7 @@ static int alloc_requests(struct eth_dev *dev, unsigned n, gfp_t gfp_flags) fail2: usb_ep_free_request(dev->in_ep, dev->tx_req); fail1: - error("can't alloc requests"); + pr_err("can't alloc requests"); return -1; } @@ -2060,7 +2060,7 @@ static int eth_bind(struct usb_gadget *gadget) * anything less functional on CDC-capable hardware, * so we fail in this case. */ - error("controller '%s' not recognized", + pr_err("controller '%s' not recognized", gadget->name); return -ENODEV; } @@ -2073,11 +2073,11 @@ static int eth_bind(struct usb_gadget *gadget) * to choose the right configuration otherwise. */ if (rndis) { -#if defined(CONFIG_USB_RNDIS_VENDOR_ID) && defined(CONFIG_USB_RNDIS_PRODUCT_ID) +#if defined(CONFIG_USB_GADGET_VENDOR_NUM) && defined(CONFIG_USB_GADGET_PRODUCT_NUM) device_desc.idVendor = - __constant_cpu_to_le16(CONFIG_USB_RNDIS_VENDOR_ID); + __constant_cpu_to_le16(CONFIG_USB_GADGET_VENDOR_NUM); device_desc.idProduct = - __constant_cpu_to_le16(CONFIG_USB_RNDIS_PRODUCT_ID); + __constant_cpu_to_le16(CONFIG_USB_GADGET_PRODUCT_NUM); #else device_desc.idVendor = __constant_cpu_to_le16(RNDIS_VENDOR_NUM); @@ -2092,9 +2092,9 @@ static int eth_bind(struct usb_gadget *gadget) * supporting one submode of the "SAFE" variant of MDLM.) */ } else { -#if defined(CONFIG_USB_CDC_VENDOR_ID) && defined(CONFIG_USB_CDC_PRODUCT_ID) - device_desc.idVendor = cpu_to_le16(CONFIG_USB_CDC_VENDOR_ID); - device_desc.idProduct = cpu_to_le16(CONFIG_USB_CDC_PRODUCT_ID); +#if defined(CONFIG_USB_GADGET_VENDOR_NUM) && defined(CONFIG_USB_GADGET_PRODUCT_NUM) + device_desc.idVendor = cpu_to_le16(CONFIG_USB_GADGET_VENDOR_NUM); + device_desc.idProduct = cpu_to_le16(CONFIG_USB_GADGET_PRODUCT_NUM); #else if (!cdc) { device_desc.idVendor = @@ -2121,7 +2121,7 @@ static int eth_bind(struct usb_gadget *gadget) in_ep = usb_ep_autoconfig(gadget, &fs_source_desc); if (!in_ep) { autoconf_fail: - error("can't autoconfigure on %s\n", + pr_err("can't autoconfigure on %s\n", gadget->name); return -ENODEV; } @@ -2142,7 +2142,7 @@ autoconf_fail: if (status_ep) { status_ep->driver_data = status_ep; /* claim */ } else if (rndis) { - error("can't run RNDIS on %s", gadget->name); + pr_err("can't run RNDIS on %s", gadget->name); return -ENODEV; #ifdef CONFIG_USB_ETH_CDC } else if (cdc) { @@ -2244,7 +2244,7 @@ autoconf_fail: if (rndis) { status = rndis_init(); if (status < 0) { - error("can't init RNDIS, %d", status); + pr_err("can't init RNDIS, %d", status); goto fail; } } @@ -2335,7 +2335,7 @@ fail0: return 0; fail: - error("%s failed, status = %d", __func__, status); + pr_err("%s failed, status = %d", __func__, status); eth_unbind(gadget); return status; } @@ -2350,7 +2350,7 @@ int dm_usb_init(struct eth_dev *e_dev) ret = uclass_first_device(UCLASS_USB_DEV_GENERIC, &dev); if (!dev || ret) { - error("No USB device found\n"); + pr_err("No USB device found\n"); return -ENODEV; } @@ -2369,7 +2369,7 @@ static int _usb_eth_init(struct ether_priv *priv) #ifdef CONFIG_DM_USB if (dm_usb_init(dev)) { - error("USB ether not found\n"); + pr_err("USB ether not found\n"); return -ENODEV; } #else @@ -2393,11 +2393,11 @@ static int _usb_eth_init(struct ether_priv *priv) sizeof(host_addr)); if (!is_eth_addr_valid(dev_addr)) { - error("Need valid 'usbnet_devaddr' to be set"); + pr_err("Need valid 'usbnet_devaddr' to be set"); goto fail; } if (!is_eth_addr_valid(host_addr)) { - error("Need valid 'usbnet_hostaddr' to be set"); + pr_err("Need valid 'usbnet_hostaddr' to be set"); goto fail; } @@ -2427,7 +2427,7 @@ static int _usb_eth_init(struct ether_priv *priv) while (!dev->network_started) { /* Handle control-c and timeouts */ if (ctrlc() || (get_timer(ts) > timeout)) { - error("The remote end did not respond in time."); + pr_err("The remote end did not respond in time."); goto fail; } usb_gadget_handle_interrupts(0); @@ -2456,7 +2456,7 @@ static int _usb_eth_send(struct ether_priv *priv, void *packet, int length) rndis_pkt = malloc(length + sizeof(struct rndis_packet_msg_type)); if (!rndis_pkt) { - error("No memory to alloc RNDIS packet"); + pr_err("No memory to alloc RNDIS packet"); goto drop; } rndis_add_hdr(rndis_pkt, length); @@ -2574,7 +2574,7 @@ static int usb_eth_recv(struct eth_device *netdev) ret = _usb_eth_recv(priv); if (ret) { - error("error packet receive\n"); + pr_err("error packet receive\n"); return ret; } @@ -2585,7 +2585,7 @@ static int usb_eth_recv(struct eth_device *netdev) net_process_received_packet(net_rx_packets[0], dev->rx_req->length); } else { - error("dev->rx_req invalid"); + pr_err("dev->rx_req invalid"); } packet_received = 0; rx_submit(dev, dev->rx_req, 0); @@ -2641,7 +2641,7 @@ static int usb_eth_recv(struct udevice *dev, int flags, uchar **packetp) ret = _usb_eth_recv(priv); if (ret) { - error("error packet receive\n"); + pr_err("error packet receive\n"); return ret; } @@ -2650,7 +2650,7 @@ static int usb_eth_recv(struct udevice *dev, int flags, uchar **packetp) *packetp = (uchar *)net_rx_packets[0]; return ethdev->rx_req->length; } else { - error("dev->rx_req invalid"); + pr_err("dev->rx_req invalid"); return -EFAULT; } } @@ -2706,13 +2706,13 @@ int usb_ether_init(void) ret = uclass_first_device(UCLASS_USB_DEV_GENERIC, &usb_dev); if (!usb_dev || ret) { - error("No USB device found\n"); + pr_err("No USB device found\n"); return ret; } ret = device_bind_driver(usb_dev, "usb_ether", "usb_ether", &dev); if (!dev || ret) { - error("usb - not able to bind usb_ether device\n"); + pr_err("usb - not able to bind usb_ether device\n"); return ret; } diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index f3382a965b..7acffb6c87 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -410,7 +410,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req) strsep(&cmd, ":"); if (!cmd) { - error("missing variable"); + pr_err("missing variable"); fastboot_tx_write_str("FAILmissing var"); return; } @@ -593,7 +593,7 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req) strsep(&cmd, ":"); if (!cmd) { - error("missing partition name"); + pr_err("missing partition name"); fastboot_tx_write_str("FAILmissing partition name"); return; } @@ -645,7 +645,7 @@ static void cb_erase(struct usb_ep *ep, struct usb_request *req) strsep(&cmd, ":"); if (!cmd) { - error("missing partition name"); + pr_err("missing partition name"); fastboot_tx_write_str("FAILmissing partition name"); return; } @@ -718,7 +718,7 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req) } if (!func_cb) { - error("unknown command: %.*s", req->actual, cmdbuf); + pr_err("unknown command: %.*s", req->actual, cmdbuf); fastboot_tx_write_str("FAILunknown command"); } else { if (req->actual < req->length) { @@ -726,7 +726,7 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req) buf[req->actual] = 0; func_cb(ep, req); } else { - error("buffer overflow"); + pr_err("buffer overflow"); fastboot_tx_write_str("FAILbuffer overflow"); } } diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index 0fae66beab..fd3da922a6 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -237,12 +237,12 @@ static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req) u8 report = data[0]; if (status != 0) { - error("Status: %d", status); + pr_err("Status: %d", status); return; } if (report != 1) { - error("Unexpected report %d", report); + pr_err("Unexpected report %d", report); return; } @@ -309,7 +309,7 @@ static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req) sdp->next_state = SDP_STATE_IDLE; break; default: - error("Unknown command: %04x\n", be16_to_cpu(cmd->cmd)); + pr_err("Unknown command: %04x\n", be16_to_cpu(cmd->cmd)); } } @@ -322,12 +322,12 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req) int datalen = req->length - 1; if (status != 0) { - error("Status: %d", status); + pr_err("Status: %d", status); return; } if (report != 2) { - error("Unexpected report %d", report); + pr_err("Unexpected report %d", report); return; } @@ -360,7 +360,7 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req) sdp->state = SDP_STATE_TX_SEC_CONF; break; default: - error("Invalid state: %d", sdp->state); + pr_err("Invalid state: %d", sdp->state); } } @@ -370,7 +370,7 @@ static void sdp_tx_complete(struct usb_ep *ep, struct usb_request *req) int status = req->status; if (status != 0) { - error("Status: %d", status); + pr_err("Status: %d", status); return; } @@ -393,7 +393,7 @@ static void sdp_tx_complete(struct usb_ep *ep, struct usb_request *req) sdp->state = SDP_STATE_IDLE; break; default: - error("Wrong State: %d", sdp->state); + pr_err("Wrong State: %d", sdp->state); sdp->state = SDP_STATE_IDLE; break; } diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index cd4d9e659a..18f233ab58 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -174,7 +174,7 @@ static long long int download_head(unsigned long long total, transfer_buffer, THOR_STORE_UNIT_SIZE, (*cnt)++); if (ret) { - error("DFU write failed [%d] cnt: %d", + pr_err("DFU write failed [%d] cnt: %d", ret, *cnt); return ret; } @@ -218,20 +218,20 @@ static int download_tail(long long int left, int cnt) dfu_entity = dfu_get_entity(alt_setting_num); if (!dfu_entity) { - error("Alt setting: %d entity not found!\n", alt_setting_num); + pr_err("Alt setting: %d entity not found!\n", alt_setting_num); return -ENOENT; } transfer_buffer = dfu_get_buf(dfu_entity); if (!transfer_buffer) { - error("Transfer buffer not allocated!"); + pr_err("Transfer buffer not allocated!"); return -ENXIO; } if (left) { ret = dfu_write(dfu_entity, transfer_buffer, left, cnt++); if (ret) { - error("DFU write failed [%d]: left: %llu", ret, left); + pr_err("DFU write failed [%d]: left: %llu", ret, left); return ret; } } @@ -245,7 +245,7 @@ static int download_tail(long long int left, int cnt) */ ret = dfu_flush(dfu_entity, transfer_buffer, 0, cnt); if (ret) - error("DFU flush failed!"); + pr_err("DFU flush failed!"); return ret; } @@ -285,7 +285,7 @@ static long long int process_rqt_download(const struct rqt_box *rqt) alt_setting_num = dfu_get_alt(f_name); if (alt_setting_num < 0) { - error("Alt setting [%d] to write not found!", + pr_err("Alt setting [%d] to write not found!", alt_setting_num); rsp->ack = -ENODEV; ret = rsp->ack; @@ -311,7 +311,7 @@ static long long int process_rqt_download(const struct rqt_box *rqt) debug("DL EXIT\n"); break; default: - error("Operation not supported: %d", rqt->rqt_data); + pr_err("Operation not supported: %d", rqt->rqt_data); ret = -ENOTSUPP; } @@ -342,7 +342,7 @@ static int process_data(void) puts("RQT: UPLOAD not supported!\n"); break; default: - error("unknown request (%d)", rqt->rqt); + pr_err("unknown request (%d)", rqt->rqt); } return ret; @@ -541,7 +541,7 @@ static int thor_rx_data(void) status = usb_ep_queue(dev->out_ep, dev->out_req, 0); if (status) { - error("kill %s: resubmit %d bytes --> %d", + pr_err("kill %s: resubmit %d bytes --> %d", dev->out_ep->name, dev->out_req->length, status); usb_ep_set_halt(dev->out_ep); return -EAGAIN; @@ -575,7 +575,7 @@ static void thor_tx_data(unsigned char *data, int len) status = usb_ep_queue(dev->in_ep, dev->in_req, 0); if (status) { - error("kill %s: resubmit %d bytes --> %d", + pr_err("kill %s: resubmit %d bytes --> %d", dev->in_ep->name, dev->in_req->length, status); usb_ep_set_halt(dev->in_ep); } @@ -608,7 +608,7 @@ static void thor_rx_tx_complete(struct usb_ep *ep, struct usb_request *req) case -ESHUTDOWN: /* disconnect from host */ case -EREMOTEIO: /* short read */ case -EOVERFLOW: - error("ERROR:%d", status); + pr_err("ERROR:%d", status); break; } @@ -664,7 +664,7 @@ thor_func_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) break; default: - error("thor_setup: unknown request: %d", ctrl->bRequest); + pr_err("thor_setup: unknown request: %d", ctrl->bRequest); } if (value >= 0) { @@ -973,7 +973,7 @@ static int thor_func_set_alt(struct usb_function *f, debug("Communication Data interface\n"); result = thor_eps_setup(f); if (result) - error("%s: EPs setup failed!", __func__); + pr_err("%s: EPs setup failed!", __func__); dev->configuration_done = 1; break; } diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c index 039331a5af..99d500a6af 100644 --- a/drivers/usb/gadget/g_dnl.c +++ b/drivers/usb/gadget/g_dnl.c @@ -26,9 +26,9 @@ /* * One needs to define the following: - * CONFIG_G_DNL_VENDOR_NUM - * CONFIG_G_DNL_PRODUCT_NUM - * CONFIG_G_DNL_MANUFACTURER + * CONFIG_USB_GADGET_VENDOR_NUM + * CONFIG_USB_GADGET_PRODUCT_NUM + * CONFIG_USB_GADGET_MANUFACTURER * at e.g. ./configs/<board>_defconfig */ @@ -46,7 +46,7 @@ static const char product[] = "USB download gadget"; static char g_dnl_serial[MAX_STRING_SERIAL]; -static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER; +static const char manufacturer[] = CONFIG_USB_GADGET_MANUFACTURER; void g_dnl_set_serialnumber(char *s) { @@ -62,8 +62,8 @@ static struct usb_device_descriptor device_desc = { .bDeviceClass = USB_CLASS_PER_INTERFACE, .bDeviceSubClass = 0, /*0x02:CDC-modem , 0x00:CDC-serial*/ - .idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM), - .idProduct = __constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM), + .idVendor = __constant_cpu_to_le16(CONFIG_USB_GADGET_VENDOR_NUM), + .idProduct = __constant_cpu_to_le16(CONFIG_USB_GADGET_PRODUCT_NUM), /* .iProduct = DYNAMIC */ /* .iSerialNumber = DYNAMIC */ .bNumConfigurations = 1, diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index f797a2568c..f5f19ed775 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -157,14 +157,6 @@ config USB_EHCI_PCI help Enables support for the PCI-based EHCI controller. -config USB_EHCI_RCAR_GEN3 - bool "Support for Renesas RCar M3/H3 EHCI USB controller" - depends on RCAR_GEN3 - default y - ---help--- - Enables support for the on-chip EHCI controller on Renesas - R8A7795 and R8A7796 SoCs. - config USB_EHCI_ZYNQ bool "Support for Xilinx Zynq on-chip EHCI USB controller" depends on ARCH_ZYNQ diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 29afb7cf1d..83903fcf99 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -46,7 +46,6 @@ obj-$(CONFIG_USB_EHCI_TEGRA) += ehci-tegra.o obj-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o obj-$(CONFIG_USB_EHCI_VF) += ehci-vf.o obj-$(CONFIG_USB_EHCI_RMOBILE) += ehci-rmobile.o -obj-$(CONFIG_USB_EHCI_RCAR_GEN3) += ehci-rcar_gen3.o obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o # xhci diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c index 0ed72d5ae7..1293e18f75 100644 --- a/drivers/usb/host/dwc2.c +++ b/drivers/usb/host/dwc2.c @@ -179,7 +179,7 @@ static int dwc_vbus_supply_init(struct udevice *dev) ret = regulator_set_enable(vbus_supply, true); if (ret) { - error("Error enabling vbus supply\n"); + pr_err("Error enabling vbus supply\n"); return ret; } diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c index 02ad3115df..6dc656af89 100644 --- a/drivers/usb/host/dwc3-sti-glue.c +++ b/drivers/usb/host/dwc3-sti-glue.c @@ -71,7 +71,7 @@ static int sti_dwc3_glue_drd_init(struct sti_dwc3_glue_platdata *plat) break; default: - error("Unsupported mode of operation %d\n", plat->mode); + pr_err("Unsupported mode of operation %d\n", plat->mode); return -EINVAL; } writel(val, plat->syscfg_base + plat->syscfg_offset); @@ -113,7 +113,7 @@ static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev) ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "reg", reg, ARRAY_SIZE(reg)); if (ret) { - error("unable to find st,stih407-dwc3 reg property(%d)\n", ret); + pr_err("unable to find st,stih407-dwc3 reg property(%d)\n", ret); return ret; } @@ -124,14 +124,14 @@ static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev) ret = uclass_get_device_by_phandle(UCLASS_SYSCON, dev, "st,syscfg", &syscon); if (ret) { - error("unable to find syscon device (%d)\n", ret); + pr_err("unable to find syscon device (%d)\n", ret); return ret; } /* get syscfg-reg base address */ regmap = syscon_get_regmap(syscon); if (!regmap) { - error("unable to find regmap\n"); + pr_err("unable to find regmap\n"); return -ENODEV; } plat->syscfg_base = regmap->base; @@ -139,14 +139,14 @@ static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev) /* get powerdown reset */ ret = reset_get_by_name(dev, "powerdown", &plat->powerdown_ctl); if (ret) { - error("can't get powerdown reset for %s (%d)", dev->name, ret); + pr_err("can't get powerdown reset for %s (%d)", dev->name, ret); return ret; } /* get softreset reset */ ret = reset_get_by_name(dev, "softreset", &plat->softreset_ctl); if (ret) - error("can't get soft reset for %s (%d)", dev->name, ret); + pr_err("can't get soft reset for %s (%d)", dev->name, ret); return ret; }; @@ -159,14 +159,14 @@ static int sti_dwc3_glue_bind(struct udevice *dev) /* check if one subnode is present */ dwc3_node = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev)); if (dwc3_node <= 0) { - error("Can't find subnode for %s\n", dev->name); + pr_err("Can't find subnode for %s\n", dev->name); return -ENODEV; } /* check if the subnode compatible string is the dwc3 one*/ if (fdt_node_check_compatible(gd->fdt_blob, dwc3_node, "snps,dwc3") != 0) { - error("Can't find dwc3 subnode for %s\n", dev->name); + pr_err("Can't find dwc3 subnode for %s\n", dev->name); return -ENODEV; } @@ -187,13 +187,13 @@ static int sti_dwc3_glue_probe(struct udevice *dev) /* deassert both powerdown and softreset */ ret = reset_deassert(&plat->powerdown_ctl); if (ret < 0) { - error("DWC3 powerdown reset deassert failed: %d", ret); + pr_err("DWC3 powerdown reset deassert failed: %d", ret); return ret; } ret = reset_deassert(&plat->softreset_ctl); if (ret < 0) { - error("DWC3 soft reset deassert failed: %d", ret); + pr_err("DWC3 soft reset deassert failed: %d", ret); goto softreset_err; } @@ -208,14 +208,14 @@ static int sti_dwc3_glue_probe(struct udevice *dev) init_err: ret = reset_assert(&plat->softreset_ctl); if (ret < 0) { - error("DWC3 soft reset deassert failed: %d", ret); + pr_err("DWC3 soft reset deassert failed: %d", ret); return ret; } softreset_err: ret = reset_assert(&plat->powerdown_ctl); if (ret < 0) - error("DWC3 powerdown reset deassert failed: %d", ret); + pr_err("DWC3 powerdown reset deassert failed: %d", ret); return ret; } @@ -228,13 +228,13 @@ static int sti_dwc3_glue_remove(struct udevice *dev) /* assert both powerdown and softreset */ ret = reset_assert(&plat->powerdown_ctl); if (ret < 0) { - error("DWC3 powerdown reset deassert failed: %d", ret); + pr_err("DWC3 powerdown reset deassert failed: %d", ret); return ret; } ret = reset_assert(&plat->softreset_ctl); if (ret < 0) - error("DWC3 soft reset deassert failed: %d", ret); + pr_err("DWC3 soft reset deassert failed: %d", ret); return ret; } diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c index 18e1e0ee88..1cb92c0338 100644 --- a/drivers/usb/host/ehci-generic.c +++ b/drivers/usb/host/ehci-generic.c @@ -51,7 +51,7 @@ static int ehci_usb_probe(struct udevice *dev) break; err = clk_enable(&priv->clocks[i]); if (err) { - error("failed to enable clock %d\n", i); + pr_err("failed to enable clock %d\n", i); clk_free(&priv->clocks[i]); goto clk_err; } @@ -59,7 +59,7 @@ static int ehci_usb_probe(struct udevice *dev) } } else { if (clock_nb != -ENOENT) { - error("failed to get clock phandle(%d)\n", clock_nb); + pr_err("failed to get clock phandle(%d)\n", clock_nb); return clock_nb; } } @@ -80,7 +80,7 @@ static int ehci_usb_probe(struct udevice *dev) break; if (reset_deassert(&priv->resets[i])) { - error("failed to deassert reset %d\n", i); + pr_err("failed to deassert reset %d\n", i); reset_free(&priv->resets[i]); goto reset_err; } @@ -88,7 +88,7 @@ static int ehci_usb_probe(struct udevice *dev) } } else { if (reset_nb != -ENOENT) { - error("failed to get reset phandle(%d)\n", reset_nb); + pr_err("failed to get reset phandle(%d)\n", reset_nb); goto clk_err; } } @@ -96,14 +96,14 @@ static int ehci_usb_probe(struct udevice *dev) err = generic_phy_get_by_index(dev, 0, &priv->phy); if (err) { if (err != -ENOENT) { - error("failed to get usb phy\n"); + pr_err("failed to get usb phy\n"); goto reset_err; } } else { err = generic_phy_init(&priv->phy); if (err) { - error("failed to init usb phy\n"); + pr_err("failed to init usb phy\n"); goto reset_err; } } @@ -122,17 +122,17 @@ phy_err: if (generic_phy_valid(&priv->phy)) { ret = generic_phy_exit(&priv->phy); if (ret) - error("failed to release phy\n"); + pr_err("failed to release phy\n"); } reset_err: ret = reset_release_all(priv->resets, priv->reset_count); if (ret) - error("failed to assert all resets\n"); + pr_err("failed to assert all resets\n"); clk_err: ret = clk_release_all(priv->clocks, priv->clock_count); if (ret) - error("failed to disable all clocks\n"); + pr_err("failed to disable all clocks\n"); return err; } diff --git a/drivers/usb/host/ehci-rcar_gen3.c b/drivers/usb/host/ehci-rcar_gen3.c deleted file mode 100644 index 525e7f3573..0000000000 --- a/drivers/usb/host/ehci-rcar_gen3.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * drivers/usb/host/ehci-rcar_gen3. - * This file is EHCI HCD (Host Controller Driver) for USB. - * - * Copyright (C) 2015-2017 Renesas Electronics Corporation - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <errno.h> -#include <wait_bit.h> -#include <asm/io.h> -#include <usb/ehci-ci.h> -#include "ehci.h" - -#define RCAR_GEN3_USB_BASE(n) (0xEE080000 + ((n) * 0x20000)) - -#define EHCI_USBCMD 0x120 - -#define CORE_SPD_RSM_TIMSET 0x30c -#define CORE_OC_TIMSET 0x310 - -/* Register offset */ -#define AHB_OFFSET 0x200 - -#define BASE_HSUSB 0xE6590000 -#define REG_LPSTS (BASE_HSUSB + 0x0102) /* 16bit */ -#define SUSPM 0x4000 -#define SUSPM_NORMAL BIT(14) -#define REG_UGCTRL2 (BASE_HSUSB + 0x0184) /* 32bit */ -#define USB0SEL 0x00000030 -#define USB0SEL_EHCI 0x00000010 - -#define SMSTPCR7 0xE615014C -#define SMSTPCR700 BIT(0) /* EHCI3 */ -#define SMSTPCR701 BIT(1) /* EHCI2 */ -#define SMSTPCR702 BIT(2) /* EHCI1 */ -#define SMSTPCR703 BIT(3) /* EHCI0 */ -#define SMSTPCR704 BIT(4) /* HSUSB */ - -#define AHB_PLL_RST BIT(1) - -#define USBH_INTBEN BIT(2) -#define USBH_INTAEN BIT(1) - -#define AHB_INT_ENABLE 0x200 -#define AHB_USBCTR 0x20c - -int ehci_hcd_stop(int index) -{ -#if defined(CONFIG_R8A7795) - const u32 mask = SMSTPCR703 | SMSTPCR702 | SMSTPCR701 | SMSTPCR700; -#else - const u32 mask = SMSTPCR703 | SMSTPCR702; -#endif - const u32 base = RCAR_GEN3_USB_BASE(index); - int ret; - - /* Reset EHCI */ - setbits_le32((uintptr_t)(base + EHCI_USBCMD), CMD_RESET); - ret = wait_for_bit("ehci-rcar", (void *)(uintptr_t)base + EHCI_USBCMD, - CMD_RESET, false, 10, true); - if (ret) { - printf("ehci-rcar: reset failed (index=%i, ret=%i).\n", - index, ret); - } - - setbits_le32(SMSTPCR7, BIT(3 - index)); - - if ((readl(SMSTPCR7) & mask) == mask) - setbits_le32(SMSTPCR7, SMSTPCR704); - - return 0; -} - -int ehci_hcd_init(int index, enum usb_init_type init, - struct ehci_hccr **hccr, struct ehci_hcor **hcor) -{ - const void __iomem *base = - (void __iomem *)(uintptr_t)RCAR_GEN3_USB_BASE(index); - struct usb_ehci *ehci = (struct usb_ehci *)(uintptr_t)base; - - clrbits_le32(SMSTPCR7, BIT(3 - index)); - clrbits_le32(SMSTPCR7, SMSTPCR704); - - *hccr = (struct ehci_hccr *)((uintptr_t)&ehci->caplength); - *hcor = (struct ehci_hcor *)((uintptr_t)*hccr + - HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase))); - - /* Enable interrupt */ - setbits_le32(base + AHB_INT_ENABLE, USBH_INTBEN | USBH_INTAEN); - writel(0x014e029b, base + CORE_SPD_RSM_TIMSET); - writel(0x000209ab, base + CORE_OC_TIMSET); - - /* Choice USB0SEL */ - clrsetbits_le32(REG_UGCTRL2, USB0SEL, USB0SEL_EHCI); - - /* Clock & Reset */ - clrbits_le32(base + AHB_USBCTR, AHB_PLL_RST); - - /* low power status */ - clrsetbits_le16(REG_LPSTS, SUSPM, SUSPM_NORMAL); - - return 0; -} diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c index e22ee97939..bf55a71d66 100644 --- a/drivers/usb/host/ohci-generic.c +++ b/drivers/usb/host/ohci-generic.c @@ -47,14 +47,14 @@ static int ohci_usb_probe(struct udevice *dev) err = clk_enable(&priv->clocks[i]); if (err) { - error("failed to enable clock %d\n", i); + pr_err("failed to enable clock %d\n", i); clk_free(&priv->clocks[i]); goto clk_err; } priv->clock_count++; } } else if (clock_nb != -ENOENT) { - error("failed to get clock phandle(%d)\n", clock_nb); + pr_err("failed to get clock phandle(%d)\n", clock_nb); return clock_nb; } @@ -74,28 +74,28 @@ static int ohci_usb_probe(struct udevice *dev) err = reset_deassert(&priv->resets[i]); if (err) { - error("failed to deassert reset %d\n", i); + pr_err("failed to deassert reset %d\n", i); reset_free(&priv->resets[i]); goto reset_err; } priv->reset_count++; } } else if (reset_nb != -ENOENT) { - error("failed to get reset phandle(%d)\n", reset_nb); + pr_err("failed to get reset phandle(%d)\n", reset_nb); goto clk_err; } err = generic_phy_get_by_index(dev, 0, &priv->phy); if (err) { if (err != -ENOENT) { - error("failed to get usb phy\n"); + pr_err("failed to get usb phy\n"); goto reset_err; } } else { err = generic_phy_init(&priv->phy); if (err) { - error("failed to init usb phy\n"); + pr_err("failed to init usb phy\n"); goto reset_err; } } @@ -110,17 +110,17 @@ phy_err: if (generic_phy_valid(&priv->phy)) { ret = generic_phy_exit(&priv->phy); if (ret) - error("failed to release phy\n"); + pr_err("failed to release phy\n"); } reset_err: ret = reset_release_all(priv->resets, priv->reset_count); if (ret) - error("failed to assert all resets\n"); + pr_err("failed to assert all resets\n"); clk_err: ret = clk_release_all(priv->clocks, priv->clock_count); if (ret) - error("failed to disable all clocks\n"); + pr_err("failed to disable all clocks\n"); return err; } diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c index 4191a89421..258d1cd00a 100644 --- a/drivers/usb/host/xhci-dwc3.c +++ b/drivers/usb/host/xhci-dwc3.c @@ -128,13 +128,13 @@ static int xhci_dwc3_probe(struct udevice *dev) ret = generic_phy_get_by_index(dev, 0, &plat->usb_phy); if (ret) { if (ret != -ENOENT) { - error("Failed to get USB PHY for %s\n", dev->name); + pr_err("Failed to get USB PHY for %s\n", dev->name); return ret; } } else { ret = generic_phy_init(&plat->usb_phy); if (ret) { - error("Can't init USB PHY for %s\n", dev->name); + pr_err("Can't init USB PHY for %s\n", dev->name); return ret; } } @@ -161,7 +161,7 @@ static int xhci_dwc3_remove(struct udevice *dev) if (generic_phy_valid(&plat->usb_phy)) { ret = generic_phy_exit(&plat->usb_phy); if (ret) { - error("Can't deinit USB PHY for %s\n", dev->name); + pr_err("Can't deinit USB PHY for %s\n", dev->name); return ret; } } diff --git a/drivers/usb/host/xhci-rockchip.c b/drivers/usb/host/xhci-rockchip.c index ca3abffba0..b1f9884273 100644 --- a/drivers/usb/host/xhci-rockchip.c +++ b/drivers/usb/host/xhci-rockchip.c @@ -46,7 +46,7 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev) */ plat->hcd_base = dev_read_addr(dev); if (plat->hcd_base == FDT_ADDR_T_NONE) { - error("Can't get the XHCI register base address\n"); + pr_err("Can't get the XHCI register base address\n"); return -ENXIO; } @@ -60,7 +60,7 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev) } if (plat->phy_base == FDT_ADDR_T_NONE) { - error("Can't get the usbphy register address\n"); + pr_err("Can't get the usbphy register address\n"); return -ENXIO; } @@ -117,7 +117,7 @@ static int rockchip_xhci_core_init(struct rockchip_xhci *rkxhci, ret = dwc3_core_init(rkxhci->dwc3_reg); if (ret) { - error("failed to initialize core\n"); + pr_err("failed to initialize core\n"); return ret; } @@ -149,14 +149,14 @@ static int xhci_usb_probe(struct udevice *dev) if (plat->vbus_supply) { ret = regulator_set_enable(plat->vbus_supply, true); if (ret) { - error("XHCI: failed to set VBus supply\n"); + pr_err("XHCI: failed to set VBus supply\n"); return ret; } } ret = rockchip_xhci_core_init(ctx, dev); if (ret) { - error("XHCI: failed to initialize controller\n"); + pr_err("XHCI: failed to initialize controller\n"); return ret; } @@ -179,7 +179,7 @@ static int xhci_usb_remove(struct udevice *dev) if (plat->vbus_supply) { ret = regulator_set_enable(plat->vbus_supply, false); if (ret) - error("XHCI: failed to set VBus supply\n"); + pr_err("XHCI: failed to set VBus supply\n"); } return ret; diff --git a/drivers/usb/musb-new/linux-compat.h b/drivers/usb/musb-new/linux-compat.h index 4dae83ed68..7bb53d2b19 100644 --- a/drivers/usb/musb-new/linux-compat.h +++ b/drivers/usb/musb-new/linux-compat.h @@ -5,8 +5,6 @@ #include <linux/list.h> #include <linux/compat.h> -#define pr_debug(fmt, args...) debug(fmt, ##args) - #define WARN(condition, fmt, args...) ({ \ int ret_warn = !!condition; \ if (ret_warn) \ diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c index 5c1a902e42..7ee44ea919 100644 --- a/drivers/usb/musb-new/sunxi.c +++ b/drivers/usb/musb-new/sunxi.c @@ -308,9 +308,6 @@ static struct musb_hdrc_platform_data musb_plat = { .platform_ops = &sunxi_musb_ops, }; -#ifdef CONFIG_USB_MUSB_HOST -static int musb_usb_remove(struct udevice *dev); - static int musb_usb_probe(struct udevice *dev) { struct musb_host_data *host = dev_get_priv(dev); @@ -319,16 +316,20 @@ static int musb_usb_probe(struct udevice *dev) priv->desc_before_addr = true; +#ifdef CONFIG_USB_MUSB_HOST host->host = musb_init_controller(&musb_plat, NULL, (void *)SUNXI_USB0_BASE); if (!host->host) return -EIO; ret = musb_lowlevel_init(host); - if (ret == 0) - printf("MUSB OTG\n"); - else - musb_usb_remove(dev); + if (!ret) + printf("Allwinner mUSB OTG (Host)\n"); +#else + ret = musb_register(&musb_plat, NULL, (void *)SUNXI_USB0_BASE); + if (!ret) + printf("Allwinner mUSB OTG (Peripheral)\n"); +#endif return ret; } @@ -352,30 +353,27 @@ static int musb_usb_remove(struct udevice *dev) return 0; } -U_BOOT_DRIVER(usb_musb) = { - .name = "sunxi-musb", - .id = UCLASS_USB, - .probe = musb_usb_probe, - .remove = musb_usb_remove, - .ops = &musb_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct musb_host_data), +static const struct udevice_id sunxi_musb_ids[] = { + { .compatible = "allwinner,sun4i-a10-musb" }, + { .compatible = "allwinner,sun6i-a31-musb" }, + { .compatible = "allwinner,sun8i-a33-musb" }, + { .compatible = "allwinner,sun8i-h3-musb" }, + { } }; -#endif -void sunxi_musb_board_init(void) -{ +U_BOOT_DRIVER(usb_musb) = { + .name = "sunxi-musb", #ifdef CONFIG_USB_MUSB_HOST - struct udevice *dev; - - /* - * Bind the driver directly for now as musb linux kernel support is - * still pending upstream so our dts files do not have the necessary - * nodes yet. TODO: Remove this as soon as the dts nodes are in place - * and bind by compatible instead. - */ - device_bind_driver(dm_root(), "sunxi-musb", "sunxi-musb", &dev); + .id = UCLASS_USB, #else - musb_register(&musb_plat, NULL, (void *)SUNXI_USB0_BASE); + .id = UCLASS_USB_DEV_GENERIC, #endif -} + .of_match = sunxi_musb_ids, + .probe = musb_usb_probe, + .remove = musb_usb_remove, +#ifdef CONFIG_USB_MUSB_HOST + .ops = &musb_usb_ops, +#endif + .platdata_auto_alloc_size = sizeof(struct usb_platdata), + .priv_auto_alloc_size = sizeof(struct musb_host_data), +}; diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index de101319cd..233857ad7a 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -106,7 +106,7 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev) "mentor,multipoint", -1); if (platdata->musb_config.multipoint < 0) { - error("MUSB multipoint DT entry missing\n"); + pr_err("MUSB multipoint DT entry missing\n"); return -ENOENT; } @@ -115,14 +115,14 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev) platdata->musb_config.num_eps = fdtdec_get_int(fdt, node, "mentor,num-eps", -1); if (platdata->musb_config.num_eps < 0) { - error("MUSB num-eps DT entry missing\n"); + pr_err("MUSB num-eps DT entry missing\n"); return -ENOENT; } platdata->musb_config.ram_bits = fdtdec_get_int(fdt, node, "mentor,ram-bits", -1); if (platdata->musb_config.ram_bits < 0) { - error("MUSB ram-bits DT entry missing\n"); + pr_err("MUSB ram-bits DT entry missing\n"); return -ENOENT; } @@ -132,7 +132,7 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev) platdata->plat.power = fdtdec_get_int(fdt, node, "mentor,power", -1); if (platdata->plat.power < 0) { - error("MUSB mentor,power DT entry missing\n"); + pr_err("MUSB mentor,power DT entry missing\n"); return -ENOENT; } @@ -183,7 +183,7 @@ static int ti_musb_host_ofdata_to_platdata(struct udevice *dev) ret = ti_musb_ofdata_to_platdata(dev); if (ret) { - error("platdata dt parse error\n"); + pr_err("platdata dt parse error\n"); return ret; } @@ -229,7 +229,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent) ret = device_bind_driver_to_node(parent, "ti-musb-host", name, offset_to_ofnode(node), &dev); if (ret) { - error("musb - not able to bind usb host node\n"); + pr_err("musb - not able to bind usb host node\n"); return ret; } break; |