Skip to content

Commit

Permalink
usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Sven Schwermer <[email protected]>
  • Loading branch information
svenschwermer authored and Marek Vasut committed Nov 26, 2018
1 parent ab58170 commit fd09c20
Show file tree
Hide file tree
Showing 29 changed files with 92 additions and 92 deletions.
14 changes: 7 additions & 7 deletions common/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
static int asynch_allowed;
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 int dev_index;

Expand Down Expand Up @@ -183,7 +183,7 @@ int usb_disable_asynch(int disable)
asynch_allowed = !disable;
return old_value;
}
#endif /* !CONFIG_DM_USB */
#endif /* !CONFIG_IS_ENABLED(DM_USB) */


/*-------------------------------------------------------------------
Expand Down Expand Up @@ -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].
*/

#ifndef CONFIG_DM_USB
#if !CONFIG_IS_ENABLED(DM_USB)

/* returns a pointer to the device with the index [index].
* if the device is not assigned (dev->devnum==-1) returns NULL
Expand Down Expand Up @@ -906,7 +906,7 @@ __weak int usb_alloc_device(struct usb_device *udev)
{
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)
{
Expand Down Expand Up @@ -1166,7 +1166,7 @@ int usb_setup_device(struct usb_device *dev, bool do_read,
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
* and is in the default state. We need to identify the thing and
Expand Down Expand Up @@ -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)
{
#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
return false;
#else
return parent->children[port] != NULL;
#endif
}

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
void usb_find_usb2_hub_address_port(struct usb_device *udev,
uint8_t *hub_address, uint8_t *hub_port)
{
Expand Down
16 changes: 8 additions & 8 deletions common/usb_hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static inline bool usb_hub_is_superspeed(struct usb_device *hdev)
return hdev->descriptor.bDeviceProtocol == 3;
}

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
bool usb_hub_is_root_hub(struct udevice *hub)
{
if (device_get_uclass_id(hub->parent) != UCLASS_USB_HUB)
Expand Down Expand Up @@ -125,7 +125,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,
data, sizeof(struct usb_port_status), USB_CNTL_TIMEOUT);

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
if (ret < 0)
return ret;

Expand Down Expand Up @@ -209,7 +209,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
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 int usb_hub_index;

Expand Down Expand Up @@ -273,7 +273,7 @@ static int usb_hub_port_reset(struct usb_device *dev, int port,
unsigned short portstatus, portchange;
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,
port + 1);
#else
Expand Down Expand Up @@ -394,7 +394,7 @@ int usb_hub_port_connect_change(struct usb_device *dev, int port)
break;
}

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
struct udevice *child;

ret = usb_scan_device(dev->dev, port + 1, speed, &child);
Expand Down Expand Up @@ -604,7 +604,7 @@ static struct usb_hub_device *usb_get_hub_device(struct usb_device *dev)
{
struct usb_hub_device *hub;

#ifndef CONFIG_DM_USB
#if !CONFIG_IS_ENABLED(DM_USB)
/* "allocate" Hub device */
hub = usb_hub_allocate();
#else
Expand Down Expand Up @@ -788,7 +788,7 @@ static int usb_hub_configure(struct usb_device *dev)
(le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_OVERCURRENT) ? \
"" : "no ");

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
/*
* Update USB host controller's internal representation of this hub
* after the hub descriptor is fetched.
Expand Down Expand Up @@ -930,7 +930,7 @@ int usb_hub_probe(struct usb_device *dev, int ifnum)
return ret;
}

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
int usb_hub_scan(struct udevice *hub)
{
struct usb_device *udev = dev_get_parent_priv(hub);
Expand Down
4 changes: 2 additions & 2 deletions common/usb_kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ static int probe_usb_keyboard(struct usb_device *dev)
return 0;
}

#ifndef CONFIG_DM_USB
#if !CONFIG_IS_ENABLED(DM_USB)
/* Search for keyboard and register it if found. */
int drv_usb_kbd_init(void)
{
Expand Down Expand Up @@ -602,7 +602,7 @@ int usb_kbd_deregister(int force)

#endif

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)

static int usb_kbd_probe(struct udevice *dev)
{
Expand Down
6 changes: 3 additions & 3 deletions common/usb_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ int usb_stor_scan(int mode)
if (mode == 1)
printf(" scanning usb for storage devices... ");

#ifndef CONFIG_DM_USB
#if !CONFIG_IS_ENABLED(DM_USB)
unsigned char i;

usb_disable_asynch(1); /* asynch transfer not allowed */
Expand Down Expand Up @@ -942,7 +942,7 @@ static void usb_stor_set_max_xfer_blk(struct usb_device *udev,
size_t __maybe_unused size;
int __maybe_unused ret;

#ifndef CONFIG_DM_USB
#if !CONFIG_IS_ENABLED(DM_USB)
#ifdef CONFIG_USB_EHCI_HCD
/*
* The U-Boot EHCI driver can handle any transfer length as long as
Expand Down Expand Up @@ -1495,7 +1495,7 @@ int usb_stor_get_info(struct usb_device *dev, struct us_data *ss,
return 1;
}

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)

static int usb_mass_storage_probe(struct udevice *dev)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ MODULE_AUTHOR("Felipe Balbi <[email protected]>");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver");

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)

int dwc3_init(struct dwc3 *dwc)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/dwc3/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ struct dwc3 {
/* device lock */
spinlock_t lock;

#if defined(__UBOOT__) && defined(CONFIG_DM_USB)
#if defined(__UBOOT__) && CONFIG_IS_ENABLED(DM_USB)
struct udevice *dev;
#else
struct device *dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/eth/usb_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ int usb_host_eth_scan(int mode)
}

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
* Ethernet driver and then most of this file can be removed.
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/ci_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
if (driver->speed != USB_SPEED_FULL && driver->speed != USB_SPEED_HIGH)
return -EINVAL;

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
ret = usb_setup_ehci_gadget(&controller.ctrl);
#else
ret = usb_lowlevel_init(0, USB_INIT_DEVICE, (void **)&controller.ctrl);
Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/gadget/ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct eth_dev {
struct usb_gadget *gadget;
struct usb_request *req; /* for control responses */
struct usb_request *stat_req; /* for cdc & rndis status */
#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
struct udevice *usb_udev;
#endif

Expand Down Expand Up @@ -2337,7 +2337,7 @@ static int eth_bind(struct usb_gadget *gadget)

/*-------------------------------------------------------------------------*/

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
int dm_usb_init(struct eth_dev *e_dev)
{
struct udevice *dev = NULL;
Expand All @@ -2362,7 +2362,7 @@ static int _usb_eth_init(struct ether_priv *priv)
unsigned long ts;
unsigned long timeout = USB_CONNECT_TIMEOUT;

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
if (dm_usb_init(dev)) {
pr_err("USB ether not found\n");
return -ENODEV;
Expand Down Expand Up @@ -2541,7 +2541,7 @@ void _usb_eth_halt(struct ether_priv *priv)
}

usb_gadget_unregister_driver(&priv->eth_driver);
#ifndef CONFIG_DM_USB
#if !CONFIG_IS_ENABLED(DM_USB)
board_usb_cleanup(0, USB_INIT_DEVICE);
#endif
}
Expand Down
12 changes: 6 additions & 6 deletions drivers/usb/host/dwc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define MAX_ENDPOINT 16

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 status_buffer[DWC2_STATUS_BUF_SIZE] __aligned(ARCH_DMA_MINALIGN);
#ifdef CONFIG_DM_REGULATOR
Expand All @@ -54,7 +54,7 @@ struct dwc2_priv {
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 */
DEFINE_ALIGN_BUFFER(uint8_t, aligned_buffer_addr, DWC2_DATA_BUF_SIZE,
ARCH_DMA_MINALIGN);
Expand Down Expand Up @@ -168,7 +168,7 @@ static void dwc_otg_core_reset(struct dwc2_core_regs *regs)
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)
{
struct dwc2_priv *priv = dev_get_priv(dev);
Expand Down Expand Up @@ -211,7 +211,7 @@ static int dwc_vbus_supply_init(struct udevice *dev)
return 0;
}

#if defined(CONFIG_DM_USB)
#if CONFIG_IS_ENABLED(DM_USB)
static int dwc_vbus_supply_exit(struct udevice *dev)
{
return 0;
Expand Down Expand Up @@ -1222,7 +1222,7 @@ static void dwc2_uninit_common(struct dwc2_core_regs *regs)
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 len, struct devrequest *setup)
{
Expand Down Expand Up @@ -1267,7 +1267,7 @@ int usb_lowlevel_stop(int index)
}
#endif

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
static int dwc2_submit_control_msg(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length,
struct devrequest *setup)
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ehci-atmel.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "ehci.h"

#ifndef CONFIG_DM_USB
#if !CONFIG_IS_ENABLED(DM_USB)

int ehci_hcd_init(int index, enum usb_init_type init,
struct ehci_hccr **hccr, struct ehci_hcor **hcor)
Expand Down
12 changes: 6 additions & 6 deletions drivers/usb/host/ehci-fsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
#endif

#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
struct ehci_fsl_priv {
struct ehci_ctrl ehci;
fdt_addr_t hcd_base;
Expand All @@ -34,7 +34,7 @@ struct ehci_fsl_priv {
#endif

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,
struct ehci_hccr *hccr, struct ehci_hcor *hcor);
#else
Expand All @@ -54,7 +54,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)
{
struct ehci_fsl_priv *priv = dev_get_priv(dev);
Expand Down Expand Up @@ -183,7 +183,7 @@ int ehci_hcd_stop(int index)
}
#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,
struct ehci_hccr *hccr, struct ehci_hcor *hcor)
#else
Expand All @@ -192,7 +192,7 @@ static int ehci_fsl_init(int index, struct usb_ehci *ehci,
#endif
{
const char *phy_type = NULL;
#ifndef CONFIG_DM_USB
#if !CONFIG_IS_ENABLED(DM_USB)
size_t len;
char current_usb_controller[5];
#endif
Expand All @@ -218,7 +218,7 @@ static int ehci_fsl_init(int index, struct usb_ehci *ehci,
out_be32(&ehci->snoop2, 0x80000000 | SNOOP_SIZE_2GB);

/* Init phy */
#ifdef CONFIG_DM_USB
#if CONFIG_IS_ENABLED(DM_USB)
if (priv->phy_type)
phy_type = priv->phy_type;
#else
Expand Down
Loading

0 comments on commit fd09c20

Please sign in to comment.