UPSTREAM: usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Conflicts:
	drivers/usb/host/ehci-atmel.c
	drivers/usb/host/xhci-fsl.c

Change-Id: If6c980c620cf97c1dd131f60953c305e34dba505
Signed-off-by: Sven Schwermer <sven@svenschwermer.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit fd09c205fc57b90a782cac33449ef172575d0a8c)
This commit is contained in:
Sven Schwermer 2018-11-21 08:43:56 +01:00 committed by Frank Wang
parent 796dd72a95
commit 3739bf7e20
29 changed files with 92 additions and 97 deletions

View File

@ -43,7 +43,7 @@
static int asynch_allowed; static int asynch_allowed;
char usb_started; /* flag for the started/stopped USB status */ char usb_started; /* flag for the started/stopped USB status */
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
static struct usb_device usb_dev[USB_MAX_DEVICE]; static struct usb_device usb_dev[USB_MAX_DEVICE];
static int dev_index; static int dev_index;
@ -184,7 +184,7 @@ int usb_disable_asynch(int disable)
asynch_allowed = !disable; asynch_allowed = !disable;
return old_value; return old_value;
} }
#endif /* !CONFIG_DM_USB */ #endif /* !CONFIG_IS_ENABLED(DM_USB) */
/*------------------------------------------------------------------- /*-------------------------------------------------------------------
@ -849,7 +849,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
* the USB device are static allocated [USB_MAX_DEVICE]. * the USB device are static allocated [USB_MAX_DEVICE].
*/ */
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
/* returns a pointer to the device with the index [index]. /* returns a pointer to the device with the index [index].
* if the device is not assigned (dev->devnum==-1) returns NULL * if the device is not assigned (dev->devnum==-1) returns NULL
@ -906,7 +906,7 @@ __weak int usb_alloc_device(struct usb_device *udev)
{ {
return 0; return 0;
} }
#endif /* !CONFIG_DM_USB */ #endif /* !CONFIG_IS_ENABLED(DM_USB) */
static int usb_hub_port_reset(struct usb_device *dev, struct usb_device *hub) static int usb_hub_port_reset(struct usb_device *dev, struct usb_device *hub)
{ {
@ -1166,7 +1166,7 @@ int usb_setup_device(struct usb_device *dev, bool do_read,
return ret; return ret;
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
/* /*
* By the time we get here, the device has gotten a new device ID * By the time we get here, the device has gotten a new device ID
* and is in the default state. We need to identify the thing and * and is in the default state. We need to identify the thing and
@ -1215,14 +1215,14 @@ int board_usb_cleanup(int index, enum usb_init_type init)
bool usb_device_has_child_on_port(struct usb_device *parent, int port) bool usb_device_has_child_on_port(struct usb_device *parent, int port)
{ {
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
return false; return false;
#else #else
return parent->children[port] != NULL; return parent->children[port] != NULL;
#endif #endif
} }
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
void usb_find_usb2_hub_address_port(struct usb_device *udev, void usb_find_usb2_hub_address_port(struct usb_device *udev,
uint8_t *hub_address, uint8_t *hub_port) uint8_t *hub_address, uint8_t *hub_port)
{ {

View File

@ -67,7 +67,7 @@ static inline bool usb_hub_is_superspeed(struct usb_device *hdev)
return hdev->descriptor.bDeviceProtocol == 3; return hdev->descriptor.bDeviceProtocol == 3;
} }
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
bool usb_hub_is_root_hub(struct udevice *hub) bool usb_hub_is_root_hub(struct udevice *hub)
{ {
if (device_get_uclass_id(hub->parent) != UCLASS_USB_HUB) if (device_get_uclass_id(hub->parent) != UCLASS_USB_HUB)
@ -128,7 +128,7 @@ int usb_get_port_status(struct usb_device *dev, int port, void *data)
USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port, USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port,
data, sizeof(struct usb_port_status), USB_CNTL_TIMEOUT); data, sizeof(struct usb_port_status), USB_CNTL_TIMEOUT);
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -212,7 +212,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
max(100, (int)pgood_delay) + 1000); max(100, (int)pgood_delay) + 1000);
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
static struct usb_hub_device hub_dev[USB_MAX_HUB]; static struct usb_hub_device hub_dev[USB_MAX_HUB];
static int usb_hub_index; static int usb_hub_index;
@ -276,7 +276,7 @@ static int usb_hub_port_reset(struct usb_device *dev, int port,
unsigned short portstatus, portchange; unsigned short portstatus, portchange;
int delay = HUB_SHORT_RESET_TIME; /* start with short reset delay */ int delay = HUB_SHORT_RESET_TIME; /* start with short reset delay */
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
debug("%s: resetting '%s' port %d...\n", __func__, dev->dev->name, debug("%s: resetting '%s' port %d...\n", __func__, dev->dev->name,
port + 1); port + 1);
#else #else
@ -397,7 +397,7 @@ int usb_hub_port_connect_change(struct usb_device *dev, int port)
break; break;
} }
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
struct udevice *child; struct udevice *child;
ret = usb_scan_device(dev->dev, port + 1, speed, &child); ret = usb_scan_device(dev->dev, port + 1, speed, &child);
@ -607,7 +607,7 @@ static struct usb_hub_device *usb_get_hub_device(struct usb_device *dev)
{ {
struct usb_hub_device *hub; struct usb_hub_device *hub;
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
/* "allocate" Hub device */ /* "allocate" Hub device */
hub = usb_hub_allocate(); hub = usb_hub_allocate();
#else #else
@ -791,7 +791,7 @@ static int usb_hub_configure(struct usb_device *dev)
(le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_OVERCURRENT) ? \ (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_OVERCURRENT) ? \
"" : "no "); "" : "no ");
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
/* /*
* Update USB host controller's internal representation of this hub * Update USB host controller's internal representation of this hub
* after the hub descriptor is fetched. * after the hub descriptor is fetched.
@ -933,7 +933,7 @@ int usb_hub_probe(struct usb_device *dev, int ifnum)
return ret; return ret;
} }
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
int usb_hub_scan(struct udevice *hub) int usb_hub_scan(struct udevice *hub)
{ {
struct usb_device *udev = dev_get_parent_priv(hub); struct usb_device *udev = dev_get_parent_priv(hub);

View File

@ -537,7 +537,7 @@ static int probe_usb_keyboard(struct usb_device *dev)
return 0; return 0;
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
/* Search for keyboard and register it if found. */ /* Search for keyboard and register it if found. */
int drv_usb_kbd_init(void) int drv_usb_kbd_init(void)
{ {
@ -600,7 +600,7 @@ int usb_kbd_deregister(int force)
#endif #endif
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int usb_kbd_probe(struct udevice *dev) static int usb_kbd_probe(struct udevice *dev)
{ {

View File

@ -303,7 +303,7 @@ int usb_stor_scan(int mode)
if (mode == 1) if (mode == 1)
printf(" scanning usb for storage devices... "); printf(" scanning usb for storage devices... ");
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
unsigned char i; unsigned char i;
usb_disable_asynch(1); /* asynch transfer not allowed */ usb_disable_asynch(1); /* asynch transfer not allowed */
@ -946,7 +946,7 @@ static void usb_stor_set_max_xfer_blk(struct usb_device *udev,
size_t __maybe_unused size; size_t __maybe_unused size;
int __maybe_unused ret; int __maybe_unused ret;
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
#ifdef CONFIG_USB_EHCI_HCD #ifdef CONFIG_USB_EHCI_HCD
/* /*
* The U-Boot EHCI driver can handle any transfer length as long as * The U-Boot EHCI driver can handle any transfer length as long as
@ -1500,7 +1500,7 @@ int usb_stor_get_info(struct usb_device *dev, struct us_data *ss,
return 1; return 1;
} }
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int usb_mass_storage_probe(struct udevice *dev) static int usb_mass_storage_probe(struct udevice *dev)
{ {

View File

@ -811,7 +811,7 @@ MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver"); MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver");
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
int dwc3_init(struct dwc3 *dwc) int dwc3_init(struct dwc3 *dwc)
{ {

View File

@ -724,7 +724,7 @@ struct dwc3 {
/* device lock */ /* device lock */
spinlock_t lock; spinlock_t lock;
#if defined(__UBOOT__) && defined(CONFIG_DM_USB) #if defined(__UBOOT__) && CONFIG_IS_ENABLED(DM_USB)
struct udevice *dev; struct udevice *dev;
#else #else
struct device *dev; struct device *dev;

View File

@ -272,7 +272,7 @@ int usb_host_eth_scan(int mode)
} }
usb_max_eth_dev = 0; usb_max_eth_dev = 0;
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
/* /*
* TODO: We should add U_BOOT_USB_DEVICE() declarations to each USB * TODO: We should add U_BOOT_USB_DEVICE() declarations to each USB
* Ethernet driver and then most of this file can be removed. * Ethernet driver and then most of this file can be removed.

View File

@ -1009,7 +1009,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
if (driver->speed != USB_SPEED_FULL && driver->speed != USB_SPEED_HIGH) if (driver->speed != USB_SPEED_FULL && driver->speed != USB_SPEED_HIGH)
return -EINVAL; return -EINVAL;
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
ret = usb_setup_ehci_gadget(&controller.ctrl); ret = usb_setup_ehci_gadget(&controller.ctrl);
#else #else
ret = usb_lowlevel_init(0, USB_INIT_DEVICE, (void **)&controller.ctrl); ret = usb_lowlevel_init(0, USB_INIT_DEVICE, (void **)&controller.ctrl);

View File

@ -105,7 +105,7 @@ struct eth_dev {
struct usb_gadget *gadget; struct usb_gadget *gadget;
struct usb_request *req; /* for control responses */ struct usb_request *req; /* for control responses */
struct usb_request *stat_req; /* for cdc & rndis status */ struct usb_request *stat_req; /* for cdc & rndis status */
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
struct udevice *usb_udev; struct udevice *usb_udev;
#endif #endif
@ -2342,7 +2342,7 @@ fail:
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
int dm_usb_init(struct eth_dev *e_dev) int dm_usb_init(struct eth_dev *e_dev)
{ {
struct udevice *dev = NULL; struct udevice *dev = NULL;
@ -2367,7 +2367,7 @@ static int _usb_eth_init(struct ether_priv *priv)
unsigned long ts; unsigned long ts;
unsigned long timeout = USB_CONNECT_TIMEOUT; unsigned long timeout = USB_CONNECT_TIMEOUT;
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
if (dm_usb_init(dev)) { if (dm_usb_init(dev)) {
pr_err("USB ether not found\n"); pr_err("USB ether not found\n");
return -ENODEV; return -ENODEV;
@ -2546,7 +2546,7 @@ void _usb_eth_halt(struct ether_priv *priv)
} }
usb_gadget_unregister_driver(&priv->eth_driver); usb_gadget_unregister_driver(&priv->eth_driver);
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
board_usb_cleanup(0, USB_INIT_DEVICE); board_usb_cleanup(0, USB_INIT_DEVICE);
#endif #endif
} }

View File

@ -32,7 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define MAX_ENDPOINT 16 #define MAX_ENDPOINT 16
struct dwc2_priv { struct dwc2_priv {
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
uint8_t aligned_buffer[DWC2_DATA_BUF_SIZE] __aligned(ARCH_DMA_MINALIGN); uint8_t aligned_buffer[DWC2_DATA_BUF_SIZE] __aligned(ARCH_DMA_MINALIGN);
uint8_t status_buffer[DWC2_STATUS_BUF_SIZE] __aligned(ARCH_DMA_MINALIGN); uint8_t status_buffer[DWC2_STATUS_BUF_SIZE] __aligned(ARCH_DMA_MINALIGN);
#ifdef CONFIG_DM_REGULATOR #ifdef CONFIG_DM_REGULATOR
@ -57,7 +57,7 @@ struct dwc2_priv {
struct reset_ctl_bulk resets; struct reset_ctl_bulk resets;
}; };
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
/* We need cacheline-aligned buffers for DMA transfers and dcache support */ /* We need cacheline-aligned buffers for DMA transfers and dcache support */
DEFINE_ALIGN_BUFFER(uint8_t, aligned_buffer_addr, DWC2_DATA_BUF_SIZE, DEFINE_ALIGN_BUFFER(uint8_t, aligned_buffer_addr, DWC2_DATA_BUF_SIZE,
ARCH_DMA_MINALIGN); ARCH_DMA_MINALIGN);
@ -171,7 +171,7 @@ static void dwc_otg_core_reset(struct dwc2_core_regs *regs)
mdelay(100); mdelay(100);
} }
#if defined(CONFIG_DM_USB) && defined(CONFIG_DM_REGULATOR) #if CONFIG_IS_ENABLED(DM_USB) && defined(CONFIG_DM_REGULATOR)
static int dwc_vbus_supply_init(struct udevice *dev) static int dwc_vbus_supply_init(struct udevice *dev)
{ {
struct dwc2_priv *priv = dev_get_priv(dev); struct dwc2_priv *priv = dev_get_priv(dev);
@ -214,7 +214,7 @@ static int dwc_vbus_supply_init(struct udevice *dev)
return 0; return 0;
} }
#if defined(CONFIG_DM_USB) #if CONFIG_IS_ENABLED(DM_USB)
static int dwc_vbus_supply_exit(struct udevice *dev) static int dwc_vbus_supply_exit(struct udevice *dev)
{ {
return 0; return 0;
@ -1225,7 +1225,7 @@ static void dwc2_uninit_common(struct dwc2_core_regs *regs)
DWC2_HPRT0_PRTRST); DWC2_HPRT0_PRTRST);
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
int len, struct devrequest *setup) int len, struct devrequest *setup)
{ {
@ -1270,7 +1270,7 @@ int usb_lowlevel_stop(int index)
} }
#endif #endif
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int dwc2_submit_control_msg(struct udevice *dev, struct usb_device *udev, static int dwc2_submit_control_msg(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length, unsigned long pipe, void *buffer, int length,
struct devrequest *setup) struct devrequest *setup)

View File

@ -15,9 +15,7 @@
#include "ehci.h" #include "ehci.h"
DECLARE_GLOBAL_DATA_PTR; #if !CONFIG_IS_ENABLED(DM_USB)
#ifndef CONFIG_DM_USB
int ehci_hcd_init(int index, enum usb_init_type init, int ehci_hcd_init(int index, enum usb_init_type init,
struct ehci_hccr **hccr, struct ehci_hcor **hcor) struct ehci_hccr **hccr, struct ehci_hcor **hcor)

View File

@ -26,7 +26,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define CONFIG_USB_MAX_CONTROLLER_COUNT 1 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
#endif #endif
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
struct ehci_fsl_priv { struct ehci_fsl_priv {
struct ehci_ctrl ehci; struct ehci_ctrl ehci;
fdt_addr_t hcd_base; fdt_addr_t hcd_base;
@ -35,7 +35,7 @@ struct ehci_fsl_priv {
#endif #endif
static void set_txfifothresh(struct usb_ehci *, u32); static void set_txfifothresh(struct usb_ehci *, u32);
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int ehci_fsl_init(struct ehci_fsl_priv *priv, struct usb_ehci *ehci, static int ehci_fsl_init(struct ehci_fsl_priv *priv, struct usb_ehci *ehci,
struct ehci_hccr *hccr, struct ehci_hcor *hcor); struct ehci_hccr *hccr, struct ehci_hcor *hcor);
#else #else
@ -55,7 +55,7 @@ static int usb_phy_clk_valid(struct usb_ehci *ehci)
} }
} }
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int ehci_fsl_ofdata_to_platdata(struct udevice *dev) static int ehci_fsl_ofdata_to_platdata(struct udevice *dev)
{ {
struct ehci_fsl_priv *priv = dev_get_priv(dev); struct ehci_fsl_priv *priv = dev_get_priv(dev);
@ -177,7 +177,7 @@ int ehci_hcd_stop(int index)
} }
#endif #endif
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int ehci_fsl_init(struct ehci_fsl_priv *priv, struct usb_ehci *ehci, static int ehci_fsl_init(struct ehci_fsl_priv *priv, struct usb_ehci *ehci,
struct ehci_hccr *hccr, struct ehci_hcor *hcor) struct ehci_hccr *hccr, struct ehci_hcor *hcor)
#else #else
@ -186,7 +186,7 @@ static int ehci_fsl_init(int index, struct usb_ehci *ehci,
#endif #endif
{ {
const char *phy_type = NULL; const char *phy_type = NULL;
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
size_t len; size_t len;
char current_usb_controller[5]; char current_usb_controller[5];
#endif #endif
@ -212,7 +212,7 @@ static int ehci_fsl_init(int index, struct usb_ehci *ehci,
out_be32(&ehci->snoop2, 0x80000000 | SNOOP_SIZE_2GB); out_be32(&ehci->snoop2, 0x80000000 | SNOOP_SIZE_2GB);
/* Init phy */ /* Init phy */
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
if (priv->phy_type) if (priv->phy_type)
phy_type = priv->phy_type; phy_type = priv->phy_type;
#else #else

View File

@ -31,7 +31,7 @@
*/ */
#define HCHALT_TIMEOUT (8 * 1000) #define HCHALT_TIMEOUT (8 * 1000)
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
static struct ehci_ctrl ehcic[CONFIG_USB_MAX_CONTROLLER_COUNT]; static struct ehci_ctrl ehcic[CONFIG_USB_MAX_CONTROLLER_COUNT];
#endif #endif
@ -112,7 +112,7 @@ static struct descriptor {
static struct ehci_ctrl *ehci_get_ctrl(struct usb_device *udev) static struct ehci_ctrl *ehci_get_ctrl(struct usb_device *udev)
{ {
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
return dev_get_priv(usb_get_bus(udev->dev)); return dev_get_priv(usb_get_bus(udev->dev));
#else #else
return udev->controller; return udev->controller;
@ -964,7 +964,7 @@ static void ehci_setup_ops(struct ehci_ctrl *ctrl, const struct ehci_ops *ops)
} }
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
void ehci_set_controller_priv(int index, void *priv, const struct ehci_ops *ops) void ehci_set_controller_priv(int index, void *priv, const struct ehci_ops *ops)
{ {
struct ehci_ctrl *ctrl = &ehcic[index]; struct ehci_ctrl *ctrl = &ehcic[index];
@ -1088,7 +1088,7 @@ static int ehci_common_init(struct ehci_ctrl *ctrl, uint tweaks)
return 0; return 0;
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
int usb_lowlevel_stop(int index) int usb_lowlevel_stop(int index)
{ {
ehci_shutdown(&ehcic[index]); ehci_shutdown(&ehcic[index]);
@ -1509,7 +1509,7 @@ static int _ehci_submit_int_msg(struct usb_device *dev, unsigned long pipe,
return result; return result;
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int length) void *buffer, int length)
{ {
@ -1547,7 +1547,7 @@ int destroy_int_queue(struct usb_device *dev, struct int_queue *queue)
} }
#endif #endif
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int ehci_submit_control_msg(struct udevice *dev, struct usb_device *udev, static int ehci_submit_control_msg(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length, unsigned long pipe, void *buffer, int length,
struct devrequest *setup) struct devrequest *setup)

View File

@ -39,7 +39,7 @@ DECLARE_GLOBAL_DATA_PTR;
/* /*
* USB 2.0 Bridge Address Decoding registers setup * USB 2.0 Bridge Address Decoding registers setup
*/ */
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
struct ehci_mvebu_priv { struct ehci_mvebu_priv {
struct ehci_ctrl ehci; struct ehci_ctrl ehci;
@ -229,4 +229,4 @@ int ehci_hcd_stop(int index)
return 0; return 0;
} }
#endif /* CONFIG_DM_USB */ #endif /* CONFIG_IS_ENABLED(DM_USB) */

View File

@ -336,7 +336,7 @@ int ehci_mx6_common_init(struct usb_ehci *ehci, int index)
return 0; return 0;
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
int ehci_hcd_init(int index, enum usb_init_type init, int ehci_hcd_init(int index, enum usb_init_type init,
struct ehci_hccr **hccr, struct ehci_hcor **hcor) struct ehci_hccr **hccr, struct ehci_hcor **hcor)
{ {

View File

@ -20,7 +20,7 @@ struct ehci_pci_priv {
struct phy phy; struct phy phy;
}; };
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int ehci_pci_init(struct udevice *dev, struct ehci_hccr **ret_hccr, static int ehci_pci_init(struct udevice *dev, struct ehci_hccr **ret_hccr,
struct ehci_hcor **ret_hcor) struct ehci_hcor **ret_hcor)
{ {
@ -122,9 +122,9 @@ int ehci_hcd_stop(int index)
{ {
return 0; return 0;
} }
#endif /* nCONFIG_DM_USB */ #endif /* !CONFIG_IS_ENABLED(DM_USB) */
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int ehci_pci_probe(struct udevice *dev) static int ehci_pci_probe(struct udevice *dev)
{ {
struct ehci_hccr *hccr; struct ehci_hccr *hccr;
@ -174,4 +174,4 @@ static struct pci_device_id ehci_pci_supported[] = {
U_BOOT_PCI_DEVICE(ehci_pci, ehci_pci_supported); U_BOOT_PCI_DEVICE(ehci_pci, ehci_pci_supported);
#endif /* CONFIG_DM_USB */ #endif /* CONFIG_IS_ENABLED(DM_USB) */

View File

@ -154,7 +154,7 @@ int ehci_vf_common_init(struct usb_ehci *ehci, int index)
return 0; return 0;
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
int ehci_hcd_init(int index, enum usb_init_type init, int ehci_hcd_init(int index, enum usb_init_type init,
struct ehci_hccr **hccr, struct ehci_hcor **hcor) struct ehci_hccr **hccr, struct ehci_hcor **hcor)
{ {

View File

@ -121,7 +121,7 @@ static struct pci_device_id ehci_pci_ids[] = {
#define invalidate_dcache_iso_td(addr) invalidate_dcache_buffer(addr, 32) #define invalidate_dcache_iso_td(addr) invalidate_dcache_buffer(addr, 32)
#define invalidate_dcache_hcca(addr) invalidate_dcache_buffer(addr, 256) #define invalidate_dcache_hcca(addr) invalidate_dcache_buffer(addr, 256)
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
/* /*
* The various ohci_mdelay(1) calls in the code seem unnecessary. We keep * The various ohci_mdelay(1) calls in the code seem unnecessary. We keep
* them around when building for older boards not yet converted to the dm * them around when building for older boards not yet converted to the dm
@ -132,7 +132,7 @@ static struct pci_device_id ehci_pci_ids[] = {
#define ohci_mdelay(x) mdelay(x) #define ohci_mdelay(x) mdelay(x)
#endif #endif
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
/* global ohci_t */ /* global ohci_t */
static ohci_t gohci; static ohci_t gohci;
/* this must be aligned to a 256 byte boundary */ /* this must be aligned to a 256 byte boundary */
@ -1692,7 +1692,7 @@ static int _ohci_destroy_int_queue(ohci_t *ohci, struct usb_device *dev,
return 0; return 0;
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
/* submit routines called from usb.c */ /* submit routines called from usb.c */
int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
int transfer_len) int transfer_len)
@ -1981,7 +1981,7 @@ static int hc_interrupt(ohci_t *ohci)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
@ -2131,7 +2131,7 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe,
} }
#endif #endif
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int ohci_submit_control_msg(struct udevice *dev, struct usb_device *udev, static int ohci_submit_control_msg(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length, unsigned long pipe, void *buffer, int length,
struct devrequest *setup) struct devrequest *setup)

View File

@ -27,7 +27,7 @@
#define ED_ALIGNMENT 16 #define ED_ALIGNMENT 16
#endif #endif
#if defined CONFIG_DM_USB && ARCH_DMA_MINALIGN > 32 #if CONFIG_IS_ENABLED(DM_USB) && ARCH_DMA_MINALIGN > 32
#define TD_ALIGNMENT ARCH_DMA_MINALIGN #define TD_ALIGNMENT ARCH_DMA_MINALIGN
#else #else
#define TD_ALIGNMENT 32 #define TD_ALIGNMENT 32
@ -406,7 +406,7 @@ typedef struct ohci {
const char *slot_name; const char *slot_name;
} ohci_t; } ohci_t;
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
extern struct dm_usb_ops ohci_usb_ops; extern struct dm_usb_ops ohci_usb_ops;
int ohci_register(struct udevice *dev, struct ohci_regs *regs); int ohci_register(struct udevice *dev, struct ohci_regs *regs);

View File

@ -112,7 +112,7 @@ void dwc3_set_fladj(struct dwc3 *dwc3_reg, u32 val)
GFLADJ_30MHZ(val)); GFLADJ_30MHZ(val));
} }
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int xhci_dwc3_setup_phy(struct udevice *dev) static int xhci_dwc3_setup_phy(struct udevice *dev)
{ {
struct xhci_dwc3_platdata *plat = dev_get_platdata(dev); struct xhci_dwc3_platdata *plat = dev_get_platdata(dev);

View File

@ -19,10 +19,7 @@
#include <fsl_usb.h> #include <fsl_usb.h>
#include <dm.h> #include <dm.h>
/* Declare global data pointer */ #if !CONFIG_IS_ENABLED(DM_USB)
DECLARE_GLOBAL_DATA_PTR;
#ifndef CONFIG_DM_USB
static struct fsl_xhci fsl_xhci; static struct fsl_xhci fsl_xhci;
unsigned long ctr_addr[] = FSL_USB_XHCI_ADDR; unsigned long ctr_addr[] = FSL_USB_XHCI_ADDR;
#else #else
@ -110,7 +107,7 @@ static int fsl_xhci_core_exit(struct fsl_xhci *fsl_xhci)
return 0; return 0;
} }
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int xhci_fsl_probe(struct udevice *dev) static int xhci_fsl_probe(struct udevice *dev)
{ {
struct xhci_fsl_priv *priv = dev_get_priv(dev); struct xhci_fsl_priv *priv = dev_get_priv(dev);

View File

@ -724,7 +724,7 @@ void xhci_setup_addressable_virt_dev(struct xhci_ctrl *ctrl,
int slot_id = udev->slot_id; int slot_id = udev->slot_id;
int speed = udev->speed; int speed = udev->speed;
int route = 0; int route = 0;
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
struct usb_device *dev = udev; struct usb_device *dev = udev;
struct usb_hub_device *hub; struct usb_hub_device *hub;
#endif #endif
@ -740,7 +740,7 @@ void xhci_setup_addressable_virt_dev(struct xhci_ctrl *ctrl,
/* Only the control endpoint is valid - one endpoint context */ /* Only the control endpoint is valid - one endpoint context */
slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1)); slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1));
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
/* Calculate the route string for this device */ /* Calculate the route string for this device */
port_num = dev->portnr; port_num = dev->portnr;
while (!usb_hub_is_root_hub(dev->dev)) { while (!usb_hub_is_root_hub(dev->dev)) {
@ -783,7 +783,7 @@ void xhci_setup_addressable_virt_dev(struct xhci_ctrl *ctrl,
BUG(); BUG();
} }
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
/* Set up TT fields to support FS/LS devices */ /* Set up TT fields to support FS/LS devices */
if (speed == USB_SPEED_LOW || speed == USB_SPEED_FULL) { if (speed == USB_SPEED_LOW || speed == USB_SPEED_FULL) {
struct udevice *parent = udev->dev; struct udevice *parent = udev->dev;

View File

@ -109,13 +109,13 @@ static struct descriptor {
}, },
}; };
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
static struct xhci_ctrl xhcic[CONFIG_USB_MAX_CONTROLLER_COUNT]; static struct xhci_ctrl xhcic[CONFIG_USB_MAX_CONTROLLER_COUNT];
#endif #endif
struct xhci_ctrl *xhci_get_ctrl(struct usb_device *udev) struct xhci_ctrl *xhci_get_ctrl(struct usb_device *udev)
{ {
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
struct udevice *dev; struct udevice *dev;
/* Find the USB controller */ /* Find the USB controller */
@ -742,7 +742,7 @@ static int _xhci_alloc_device(struct usb_device *udev)
return 0; return 0;
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
int usb_alloc_device(struct usb_device *udev) int usb_alloc_device(struct usb_device *udev)
{ {
return _xhci_alloc_device(udev); return _xhci_alloc_device(udev);
@ -1257,7 +1257,7 @@ static int xhci_lowlevel_stop(struct xhci_ctrl *ctrl)
return 0; return 0;
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
int submit_control_msg(struct usb_device *udev, unsigned long pipe, int submit_control_msg(struct usb_device *udev, unsigned long pipe,
void *buffer, int length, struct devrequest *setup) void *buffer, int length, struct devrequest *setup)
{ {
@ -1341,9 +1341,9 @@ int usb_lowlevel_stop(int index)
return 0; return 0;
} }
#endif /* CONFIG_DM_USB */ #endif /* CONFIG_IS_ENABLED(DM_USB) */
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int xhci_submit_control_msg(struct udevice *dev, struct usb_device *udev, static int xhci_submit_control_msg(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length, unsigned long pipe, void *buffer, int length,

View File

@ -1212,7 +1212,7 @@ void xhci_hcd_stop(int index);
#define XHCI_STS_CNR (1 << 11) #define XHCI_STS_CNR (1 << 11)
struct xhci_ctrl { struct xhci_ctrl {
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
struct udevice *dev; struct udevice *dev;
#endif #endif
struct xhci_hccr *hccr; /* R/O registers, not need for volatile */ struct xhci_hccr *hccr; /* R/O registers, not need for volatile */

View File

@ -22,7 +22,7 @@ struct int_queue {
struct urb urb; struct urb urb;
}; };
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
struct musb_host_data musb_host; struct musb_host_data musb_host;
#endif #endif
@ -249,7 +249,7 @@ int musb_lowlevel_init(struct musb_host_data *host)
return 0; return 0;
} }
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
int usb_lowlevel_stop(int index) int usb_lowlevel_stop(int index)
{ {
if (!musb_host.host) { if (!musb_host.host) {
@ -306,9 +306,9 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
{ {
return musb_lowlevel_init(&musb_host); return musb_lowlevel_init(&musb_host);
} }
#endif /* !CONFIG_DM_USB */ #endif /* !CONFIG_IS_ENABLED(DM_USB) */
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static int musb_submit_control_msg(struct udevice *dev, struct usb_device *udev, static int musb_submit_control_msg(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length, unsigned long pipe, void *buffer, int length,
struct devrequest *setup) struct devrequest *setup)
@ -370,7 +370,7 @@ struct dm_usb_ops musb_usb_ops = {
.destroy_int_queue = musb_destroy_int_queue, .destroy_int_queue = musb_destroy_int_queue,
.reset_root_port = musb_reset_root_port, .reset_root_port = musb_reset_root_port,
}; };
#endif /* CONFIG_DM_USB */ #endif /* CONFIG_IS_ENABLED(DM_USB) */
#endif /* CONFIG_USB_MUSB_HOST */ #endif /* CONFIG_USB_MUSB_HOST */
#ifdef CONFIG_USB_MUSB_GADGET #ifdef CONFIG_USB_MUSB_GADGET
@ -431,7 +431,7 @@ int musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
struct musb **musbp; struct musb **musbp;
switch (plat->mode) { switch (plat->mode) {
#if defined(CONFIG_USB_MUSB_HOST) && !defined(CONFIG_DM_USB) #if defined(CONFIG_USB_MUSB_HOST) && !CONFIG_IS_ENABLED(DM_USB)
case MUSB_HOST: case MUSB_HOST:
musbp = &musb_host.host; musbp = &musb_host.host;
break; break;

View File

@ -136,7 +136,7 @@ const struct musb_platform_ops omap2430_ops = {
.disable = omap2430_musb_disable, .disable = omap2430_musb_disable,
}; };
#if defined(CONFIG_DM_USB) #if CONFIG_IS_ENABLED(DM_USB)
struct omap2430_musb_platdata { struct omap2430_musb_platdata {
void *base; void *base;
@ -277,4 +277,4 @@ U_BOOT_DRIVER(omap2430_musb) = {
.priv_auto_alloc_size = sizeof(struct musb_host_data), .priv_auto_alloc_size = sizeof(struct musb_host_data),
}; };
#endif /* CONFIG_DM_USB */ #endif /* CONFIG_IS_ENABLED(DM_USB) */

View File

@ -20,7 +20,7 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
/* USB 2.0 PHY Control */ /* USB 2.0 PHY Control */
#define CM_PHY_PWRDN (1 << 0) #define CM_PHY_PWRDN (1 << 0)
@ -252,4 +252,4 @@ U_BOOT_DRIVER(ti_musb_wrapper) = {
.bind = ti_musb_wrapper_bind, .bind = ti_musb_wrapper_bind,
}; };
#endif /* CONFIG_DM_USB */ #endif /* CONFIG_IS_ENABLED(DM_USB) */

View File

@ -67,7 +67,7 @@ static inline int usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd,
return 0; return 0;
} }
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
static inline struct usb_device *usb_dev_get_parent(struct usb_device *udev) static inline struct usb_device *usb_dev_get_parent(struct usb_device *udev)
{ {
struct udevice *parent = udev->dev->parent; struct udevice *parent = udev->dev->parent;

View File

@ -141,7 +141,7 @@ struct usb_device {
int act_len; /* transferred bytes */ int act_len; /* transferred bytes */
int maxchild; /* Number of ports if hub */ int maxchild; /* Number of ports if hub */
int portnr; /* Port number, 1=first */ int portnr; /* Port number, 1=first */
#ifndef CONFIG_DM_USB #if !CONFIG_IS_ENABLED(DM_USB)
/* parent hub, or NULL if this is the root hub */ /* parent hub, or NULL if this is the root hub */
struct usb_device *parent; struct usb_device *parent;
struct usb_device *children[USB_MAXCHILDREN]; struct usb_device *children[USB_MAXCHILDREN];
@ -149,7 +149,7 @@ struct usb_device {
#endif #endif
/* slot_id - for xHCI enabled devices */ /* slot_id - for xHCI enabled devices */
unsigned int slot_id; unsigned int slot_id;
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
struct udevice *dev; /* Pointer to associated device */ struct udevice *dev; /* Pointer to associated device */
struct udevice *controller_dev; /* Pointer to associated controller */ struct udevice *controller_dev; /* Pointer to associated controller */
#endif #endif
@ -174,7 +174,7 @@ enum usb_init_type {
int usb_lowlevel_init(int index, enum usb_init_type init, void **controller); int usb_lowlevel_init(int index, enum usb_init_type init, void **controller);
int usb_lowlevel_stop(int index); int usb_lowlevel_stop(int index);
#if defined(CONFIG_USB_MUSB_HOST) || defined(CONFIG_DM_USB) #if defined(CONFIG_USB_MUSB_HOST) || CONFIG_IS_ENABLED(DM_USB)
int usb_reset_root_port(struct usb_device *dev); int usb_reset_root_port(struct usb_device *dev);
#else #else
#define usb_reset_root_port(dev) #define usb_reset_root_port(dev)
@ -188,7 +188,7 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
int transfer_len, int interval); int transfer_len, int interval);
#if defined CONFIG_USB_EHCI_HCD || defined CONFIG_USB_MUSB_HOST \ #if defined CONFIG_USB_EHCI_HCD || defined CONFIG_USB_MUSB_HOST \
|| defined(CONFIG_DM_USB) || CONFIG_IS_ENABLED(DM_USB)
struct int_queue *create_int_queue(struct usb_device *dev, unsigned long pipe, struct int_queue *create_int_queue(struct usb_device *dev, unsigned long pipe,
int queuesize, int elementsize, void *buffer, int interval); int queuesize, int elementsize, void *buffer, int interval);
int destroy_int_queue(struct usb_device *dev, struct int_queue *queue); int destroy_int_queue(struct usb_device *dev, struct int_queue *queue);
@ -589,7 +589,7 @@ struct usb_hub_device {
struct usb_tt tt; /* Transaction Translator */ struct usb_tt tt; /* Transaction Translator */
}; };
#ifdef CONFIG_DM_USB #if CONFIG_IS_ENABLED(DM_USB)
/** /**
* struct usb_platdata - Platform data about a USB controller * struct usb_platdata - Platform data about a USB controller
* *
@ -913,7 +913,7 @@ int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp);
*/ */
void usb_stor_reset(void); void usb_stor_reset(void);
#else /* !CONFIG_DM_USB */ #else /* !CONFIG_IS_ENABLED(DM_USB) */
struct usb_device *usb_get_dev_index(int index); struct usb_device *usb_get_dev_index(int index);