diff options
author | Jeff Smith <jsmith@nvidia.com> | 2012-11-06 23:19:23 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 13:38:09 -0700 |
commit | 912aa237c4a73d9358ae54a1669665be369249a5 (patch) | |
tree | 63b6319d3fc4a41f31d1ae7aa379c091d86ee84a /drivers/usb/gadget/tegra_udc.c | |
parent | 3286cc8ae5d9d7b1f07f86905e750e85179a6178 (diff) |
usb: tegra: Move to tegra pre-si config
This change is a part of the effort to enable runtime
platform detection and reduce compile-time conditionals.
Bug 1333554
Change-Id: Ia0b559545f8c71dc929d29878b1569d9f6209904
Signed-off-by: Chetan Kumar N G <chetankumarn@nvidia.com>
Reviewed-on: http://git-master/r/252548
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Alexander Van Brunt <avanbrunt@nvidia.com>
Diffstat (limited to 'drivers/usb/gadget/tegra_udc.c')
-rw-r--r-- | drivers/usb/gadget/tegra_udc.c | 85 |
1 files changed, 44 insertions, 41 deletions
diff --git a/drivers/usb/gadget/tegra_udc.c b/drivers/usb/gadget/tegra_udc.c index bf6ee8670c63..c24e17bdf4a4 100644 --- a/drivers/usb/gadget/tegra_udc.c +++ b/drivers/usb/gadget/tegra_udc.c @@ -49,6 +49,8 @@ #include <asm/unaligned.h> #include <asm/dma.h> +#include <mach/hardware.h> + /* HACK! This needs to come from DT */ #include "../../../arch/arm/mach-tegra/iomap.h" @@ -134,16 +136,16 @@ static inline unsigned int udc_readl(struct tegra_udc *udc, u32 offset) static inline bool vbus_enabled(struct tegra_udc *udc) { bool status = false; -#ifdef CONFIG_TEGRA_SILICON_PLATFORM - if (!udc->support_pmu_vbus) - status = (udc_readl(udc, VBUS_WAKEUP_REG_OFFSET) - & USB_SYS_VBUS_STATUS); -#else - /* On FPGA VBUS is detected through VBUS A Session instead of VBUS - * status.*/ - status = (udc_readl(udc, VBUS_SENSOR_REG_OFFSET) + if (tegra_platform_is_fpga()) { + /* On FPGA VBUS is detected through VBUS A Session instead + * of VBUS status.*/ + status = (udc_readl(udc, VBUS_SENSOR_REG_OFFSET) & USB_SYS_VBUS_ASESSION); -#endif + } else if (!udc->support_pmu_vbus) { + status = (udc_readl(udc, VBUS_WAKEUP_REG_OFFSET) + & USB_SYS_VBUS_STATUS); + } + return status; } @@ -356,25 +358,26 @@ static void dr_controller_run(struct tegra_udc *udc) /* If OTG transceiver is available, then it handles the VBUS detection*/ if (IS_ERR_OR_NULL(udc->transceiver)) { -#ifdef CONFIG_TEGRA_SILICON_PLATFORM - /* Enable cable detection interrupt, without setting the - * USB_SYS_VBUS_WAKEUP_INT bit. USB_SYS_VBUS_WAKEUP_INT is - * clear on write */ - temp = udc_readl(udc, VBUS_WAKEUP_REG_OFFSET); - temp |= (USB_SYS_VBUS_WAKEUP_INT_ENABLE - | USB_SYS_VBUS_WAKEUP_ENABLE); - temp &= ~USB_SYS_VBUS_WAKEUP_INT_STATUS; - udc_writel(udc, temp, VBUS_WAKEUP_REG_OFFSET); -#else - /* On FPGA VBUS is detected through VBUS A Session instead of - * VBUS status.*/ - temp = udc_readl(udc, VBUS_SENSOR_REG_OFFSET); - temp |= USB_SYS_VBUS_ASESSION_INT_EN; - temp &= ~USB_SYS_VBUS_ASESSION_CHANGED; - udc_writel(udc, temp, VBUS_SENSOR_REG_OFFSET); -#endif + if (tegra_platform_is_fpga()) { + /* On FPGA VBUS is detected through VBUS A Session + * instead of VBUS status.*/ + temp = udc_readl(udc, VBUS_SENSOR_REG_OFFSET); + temp |= USB_SYS_VBUS_ASESSION_INT_EN; + temp &= ~USB_SYS_VBUS_ASESSION_CHANGED; + udc_writel(udc, temp, VBUS_SENSOR_REG_OFFSET); + } else { + /* Enable cable detection interrupt, without setting the + * USB_SYS_VBUS_WAKEUP_INT bit. USB_SYS_VBUS_WAKEUP_INT + * is clear on write */ + temp = udc_readl(udc, VBUS_WAKEUP_REG_OFFSET); + temp |= (USB_SYS_VBUS_WAKEUP_INT_ENABLE + | USB_SYS_VBUS_WAKEUP_ENABLE); + temp &= ~USB_SYS_VBUS_WAKEUP_INT_STATUS; + udc_writel(udc, temp, VBUS_WAKEUP_REG_OFFSET); + } } else udc_writel(udc, 0, VBUS_SENSOR_REG_OFFSET); + /* Enable DR irq reg */ temp = USB_INTR_INT_EN | USB_INTR_ERR_INT_EN | USB_INTR_PTC_DETECT_EN | USB_INTR_RESET_EN @@ -2414,21 +2417,21 @@ static irqreturn_t tegra_udc_irq(int irq, void *_udc) spin_lock_irqsave(&udc->lock, flags); if (IS_ERR_OR_NULL(udc->transceiver)) { -#ifdef CONFIG_TEGRA_SILICON_PLATFORM - temp = udc_readl(udc, VBUS_WAKEUP_REG_OFFSET); - /* write back the register to clear the interrupt */ - udc_writel(udc, temp, VBUS_WAKEUP_REG_OFFSET); - if (temp & USB_SYS_VBUS_WAKEUP_INT_STATUS) - schedule_work(&udc->irq_work); - status = IRQ_HANDLED; -#else - temp = udc_readl(udc, VBUS_SENSOR_REG_OFFSET); - /* write back the register to clear the interrupt */ - udc_writel(udc, temp, VBUS_SENSOR_REG_OFFSET); - if (temp & USB_SYS_VBUS_ASESSION_CHANGED) - schedule_work(&udc->irq_work); - status = IRQ_HANDLED; -#endif + if (tegra_platform_is_fpga()) { + temp = udc_readl(udc, VBUS_SENSOR_REG_OFFSET); + /* write back the register to clear the interrupt */ + udc_writel(udc, temp, VBUS_SENSOR_REG_OFFSET); + if (temp & USB_SYS_VBUS_ASESSION_CHANGED) + schedule_work(&udc->irq_work); + status = IRQ_HANDLED; + } else { + temp = udc_readl(udc, VBUS_WAKEUP_REG_OFFSET); + /* write back the register to clear the interrupt */ + udc_writel(udc, temp, VBUS_WAKEUP_REG_OFFSET); + if (temp & USB_SYS_VBUS_WAKEUP_INT_STATUS) + schedule_work(&udc->irq_work); + status = IRQ_HANDLED; + } } /* Disable ISR for OTG host mode */ |