GitLab has been upgraded to 13.3.6. If you encounter any issues mail code@riscosopen.org

Commit eb6b48ef authored by Jeffrey Lee's avatar Jeffrey Lee

Update to latest code from Raspberry Pi github. Improve debugging. Fix race...

Update to latest code from Raspberry Pi github. Improve debugging. Fix race condition that could lead to timeout callbacks inappropriately firing.

Detail:
  Makefile, dwc/* - Updated to latest code from Raspberry Pi github. Tweaks specific to Broadcom hardware have been placed in BCM2835 #ifdef's to allow them to easily be identified/controlled if we need the driver to support different SoCs in future
  c/cmodule, c/dwc_common_riscos, c/port, c/softc_device, h/cmodule - Improved debugging code
  c/softc_device - Schedule timeout before starting transfer instead of after. Fixes issue where a transfer that completes inbetween dwc_otg_hcd_urb_enqueue() and callout_reset() would result in the timeout being enabled even though the transfer is already complete
  s/triggercbs - Synced with latest USBDriver version for consistency
Admin:
  Tested on Raspberry Pi with high processor vectors
  Fixes some, if not all, stability issues


Version 0.04. Tagged as 'DWCDriver-0_04'
parent 5ae117ef
......@@ -31,7 +31,7 @@ CUSTOMEXP = custom
#
DEBUG ?= FALSE
ifeq (${DEBUG},TRUE)
CFLAGS += -DDEBUGLIB -DDWCDRIVER_DEBUG -DDEBUG
CFLAGS += -DDEBUGLIB -DDWCDRIVER_DEBUG -DDEBUG -DUSB_DEBUG
CMHGDEFINES += -DDWCDRIVER_DEBUG
LIBS += ${DEBUGLIBS} ${NET5LIBS}
endif
......@@ -46,7 +46,7 @@ LDFLAGS = -Symbols rm.sym${TARGET}
VPATH = ^.^.build ^.^.dev.usb dwc.driver dwc.dwc_common_port
# DWC bits
CFLAGS += -DDWC_EN_ISOC -Idwc.dwc_common_port -DDWC_HOST_ONLY
CFLAGS += -DDWC_EN_ISOC -Idwc.dwc_common_port -DDWC_HOST_ONLY -DBCM2835
OBJS += dwc_otg_cil dwc_otg_cil_intr dwc_otg_hcd dwc_otg_hcd_intr dwc_otg_hcd_queue dwc_otg_hcd_ddma
OBJS += dwc_cc dwc_modpow dwc_notifier dwc_mem
......
/* (0.03)
/* (0.04)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.03
#define Module_MajorVersion_CMHG 0.04
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 15 Jun 2012
#define Module_Date_CMHG 24 Jun 2012
#define Module_MajorVersion "0.03"
#define Module_Version 3
#define Module_MajorVersion "0.04"
#define Module_Version 4
#define Module_MinorVersion ""
#define Module_Date "15 Jun 2012"
#define Module_Date "24 Jun 2012"
#define Module_ApplicationDate "15-Jun-12"
#define Module_ApplicationDate "24-Jun-12"
#define Module_ComponentName "DWCDriver"
#define Module_ComponentPath "mixed/RiscOS/Sources/HWSupport/USB/Controllers/DWCDriver"
#define Module_FullVersion "0.03"
#define Module_HelpVersion "0.03 (15 Jun 2012)"
#define Module_LibraryVersionInfo "0:3"
#define Module_FullVersion "0.04"
#define Module_HelpVersion "0.04 (24 Jun 2012)"
#define Module_LibraryVersionInfo "0:4"
......@@ -214,8 +214,8 @@ _kernel_oserror* module_init (const char *cmd_tail, int podule_base, void *pw)
debug_set_unbuffered_files (TRUE);
#ifdef DWCDRIVER_DEBUG
dwcdebug = atoi(getenv("dwcdebug"));
dwcdebug = 11;
const char *c = getenv("dwcdebug");
dwcdebug = (c?atoi(c):0);
#endif
......@@ -449,3 +449,14 @@ _kernel_oserror *endpoint_disable_cb(_kernel_swi_regs *r,void *pw,void *handle)
dwc_otg_hcd_endpoint_disable(dwc_soft.hcd,handle,250);
return NULL;
}
#ifdef DEBUGLIB
int address_valid(void *addr,int align)
{
if(!addr || (((int)addr) & align))
return 0;
if(_swi(OS_ValidateAddress,_INR(0,1)|_RETURN(_FLAGS),addr,((int)addr)+1) & _C)
return 0;
return 1;
}
#endif
......@@ -73,15 +73,18 @@ void __DWC_ERROR(char *format,...)
dvprintf(("",format,a));
}
#ifdef DEBUG
void DWC_EXCEPTION(char *format,...)
{
ensure_irqs_off();
va_list a;
va_start(a,format);
dvprintf(("",format,a));
/* DWCTODO - halt */
_swix(0x531C1,0); /* DADebug_Print */
/* Halt */
while(1) {};
}
#ifdef DEBUG
void __DWC_DEBUG(char *format,...)
{
va_list a;
......@@ -107,6 +110,12 @@ void *__DWC_DMA_ALLOC(uint32_t size, dwc_dma_t *dma_addr)
return mem;
}
void *__DWC_DMA_ALLOC_ATOMIC(uint32_t size, dwc_dma_t *dma_addr)
{
/* TODO - probably want to be clever about this */
return __DWC_DMA_ALLOC(size,dma_addr);
}
void __DWC_DMA_FREE(uint32_t size, void *virt_addr, dwc_dma_t dma_addr)
{
(void) size;
......@@ -152,7 +161,10 @@ void *__DWC_ALLOC(uint32_t size)
restore_irqs(irqs);
block = malloc(size-4); /* Subtract 4 bytes for heap block header */
if(!block)
{
dwc_debug("Failed to allocate %d bytes",size-4);
return NULL;
}
}
else
{
......@@ -483,7 +495,7 @@ dwc_workq_t *DWC_WORKQ_ALLOC(char *name)
DWC_FREE(q);
return NULL;
}
q->name = DWC_STRDUP(name);
q->name = (name?DWC_STRDUP(name):0);
q->stack = stack;
stack->sc_mark = 0xF60690FF;
stack->sc_size = THREAD_STACK_SIZE;
......@@ -517,7 +529,10 @@ void DWC_WORKQ_SCHEDULE(dwc_workq_t *workq, dwc_work_callback_t work_cb, void *d
va_list a;
va_start(a,format);
char buf[128];
vsnprintf(buf,sizeof(buf),format,a);
if(format)
vsnprintf(buf,sizeof(buf),format,a);
else
buf[0] = 0;
struct dwc_workq_entry *e = DWC_ALLOC(sizeof(struct dwc_workq_entry)+strlen(buf)+1);
if(!e)
return;
......@@ -551,7 +566,10 @@ void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *workq, dwc_work_callback_t work_cb,
va_list a;
va_start(a,format);
char buf[128];
vsnprintf(buf,sizeof(buf),format,a);
if(format)
vsnprintf(buf,sizeof(buf),format,a);
else
buf[0] = 0;
struct dwc_workq_entry *e = DWC_ALLOC(sizeof(struct dwc_workq_entry)+strlen(buf)+1);
if(!e)
return;
......
......@@ -30,6 +30,8 @@
#include "cmodule.h"
#include "dwc_os.h"
void splx (int s)
{
restore_irqs(s);
......@@ -63,6 +65,7 @@ callout_handler (_kernel_swi_regs* r, void* pw, void* _c) {
#ifdef USB_DEBUG0
if (usbdebug > 15) dprintf (("Port", "callout2 %p called\n", c));
#endif
c->c_next = NULL;
if(c->c_func)c->c_func (c->c_arg);
return NULL;
}
......@@ -72,12 +75,14 @@ callout_stop (struct callout *c) {
#ifdef USB_DEBUG0
if (usbdebug > 15) dprintf (("Port", "callout stop %p\n", c));
#endif
c->c_next = NULL;
callx_remove_callafter (callout_handler, c);
}
void
callout_reset (struct callout *c, int i, void (*f)(void *), void *v) {
if (i <= 0) i = 1;
dwc_assert(!c->c_next,"");
c->c_arg = v;
c->c_func = f;
c->c_next = (void*) private_word; /* hacky thing to get handler to work */
......
......@@ -59,10 +59,18 @@ static void softc_device_timeout(void *addr)
usbd_status softc_device_transfer(usbd_xfer_handle xfer)
{
dwc_assert(address_valid(xfer,3),"Bad xfer handle %08x",xfer);
usbd_status err;
DPRINTFN(10,("softc_device_transfer: xfer=%p pipe=%p\n",xfer,xfer->pipe));
#ifdef DWCDRIVER_DEBUG
usbd_pipe_handle pipe = xfer->pipe;
usbd_xfer_handle xfer2;
SIMPLEQ_FOREACH(xfer2, &pipe->queue, next) {
dwc_assert(xfer != xfer2,"xfer already in queue!");
}
#endif
/* Add transfer to queue */
err = usb_insert_transfer(xfer);
if (err)
......@@ -74,6 +82,7 @@ usbd_status softc_device_transfer(usbd_xfer_handle xfer)
usbd_status softc_device_start(usbd_xfer_handle xfer)
{
dwc_assert(address_valid(xfer,3),"Bad xfer handle %08x",xfer);
struct dwc_softc_xfer *ex = (struct dwc_softc_xfer *) xfer;
struct dwc_softc_pipe *epipe = (struct dwc_softc_pipe *)xfer->pipe;
dwc_softc_t *sc = (dwc_softc_t *)epipe->pipe.device->bus;
......@@ -121,18 +130,23 @@ usbd_status softc_device_start(usbd_xfer_handle xfer)
/* Queue and start the urb */
epipe->xfer = ex;
bool timeout = ex->xfer.timeout && !sc->sc_bus.use_polling;
if(timeout) {
DPRINTFN(10,("-> set timeout %d on %x\n",ex->xfer.timeout,ex));
callout_reset(&(ex->xfer.timeout_handle), (MS_TO_TICKS(ex->xfer.timeout)), (softc_device_timeout), (ex));
}
int ret = dwc_otg_hcd_urb_enqueue(sc->hcd,epipe->urb,&epipe->dwc_priv);
if(ret)
{
dprintf(("","urb_enqueue failed, %d\n",ret));
if(timeout) {
callout_stop(&(ex->xfer.timeout_handle));
}
}
/* Handle timeout */
if(!ret && ex->xfer.timeout && !sc->sc_bus.use_polling) {
DPRINTFN(10,("-> set timeout %d on %x\n",ex->xfer.timeout,ex));
callout_reset(&(ex->xfer.timeout_handle), (MS_TO_TICKS(ex->xfer.timeout)), (softc_device_timeout), (ex));
}
switch(ret)
{
......@@ -152,12 +166,16 @@ usbd_status softc_device_start(usbd_xfer_handle xfer)
void softc_device_abort(usbd_xfer_handle xfer)
{
dwc_assert(address_valid(xfer,3),"Bad xfer handle %08x",xfer);
DPRINTF(("softc_device_abort: xfer=%p\n",xfer));
softc_abort_xfer(xfer,USBD_CANCELLED);
}
void softc_device_close(usbd_pipe_handle pipe)
{
dwc_assert(address_valid(pipe,3),"Bad pipe handle %08x",pipe);
struct dwc_softc_pipe *epipe = (struct dwc_softc_pipe *) pipe;
dwc_softc_t *sc = (dwc_softc_t *)epipe->pipe.device->bus;
DPRINTF(("softc_device_close: pipe=%p\n",epipe));
......@@ -177,12 +195,16 @@ void softc_device_close(usbd_pipe_handle pipe)
void softc_device_clear_toggle(usbd_pipe_handle pipe)
{
dwc_assert(address_valid(pipe,3),"Bad pipe handle %08x",pipe);
DPRINTF(("softc_device_clear_toggle: pipe=%p\n",pipe));
/* DWCTODO - no way of controlling toggle? maybe have to disable endpoint? */
}
void softc_device_done(usbd_xfer_handle xfer)
{
dwc_assert(address_valid(xfer,3),"Bad xfer handle %08x",xfer);
DPRINTFN(10,("softc_device_done: xfer=%p, length=%d, repeat=%d\n", xfer,xfer->actlen,xfer->pipe->repeat));
/* If it's a repeating xfer, we put it back on the list */
if(xfer->pipe->repeat)
......@@ -191,6 +213,8 @@ void softc_device_done(usbd_xfer_handle xfer)
void softc_abort_xfer(usbd_xfer_handle xfer,usbd_status status)
{
dwc_assert(address_valid(xfer,3),"Bad xfer handle %08x",xfer);
struct dwc_softc_xfer *ex = (struct dwc_softc_xfer *) xfer;
struct dwc_softc_pipe *epipe = (struct dwc_softc_pipe *) xfer->pipe;
dwc_softc_t *sc = (dwc_softc_t *)epipe->pipe.device->bus;
......
......@@ -299,7 +299,16 @@
#ifdef LM_INTERFACE
#include <asm/sizes.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
#include <asm/arch/lm.h>
#else
/* in 2.6.31, at least, we seem to have lost the generic LM infrastructure -
here we use definitions stolen from arm-integrator headers
*/
#include <mach/lm.h>
#endif
#elif defined(PLATFORM_INTERFACE)
#include <linux/platform_device.h>
#endif
#include <asm/io.h>
......@@ -336,7 +345,7 @@ static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attri
return count; \
}
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \
static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \
......@@ -356,6 +365,30 @@ static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attri
return count; \
}
#elif defined(PLATFORM_INTERFACE)
#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \
static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \
{ \
struct platform_device *platform_dev = \
container_of(_dev, struct platform_device, dev); \
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \
uint32_t val; \
DWC_PRINTF("%s(%p) -> platform_dev %p, otg_dev %p\n", \
__func__, _dev, platform_dev, otg_dev); \
val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \
return sprintf (buf, "%s = 0x%x\n", _string_, val); \
}
#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \
static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \
uint32_t set = simple_strtoul(buf, NULL, 16); \
dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\
return count; \
}
#endif
/*
......@@ -381,7 +414,7 @@ static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attri
dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \
return count; \
}
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \
static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \
{ \
......@@ -400,6 +433,30 @@ static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attri
return count; \
}
#elif defined(PLATFORM_INTERFACE)
#include "dwc_otg_dbg.h"
#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \
static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \
{ \
struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \
uint32_t val; \
DWC_PRINTF("%s(%p) -> platform_dev %p, otg_dev %p\n", \
__func__, _dev, platform_dev, otg_dev); \
val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \
return sprintf (buf, "%s = 0x%08x\n", _string_, val); \
}
#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \
static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \
uint32_t val = simple_strtoul(buf, NULL, 16); \
dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \
return count; \
}
#endif
#define DWC_OTG_DEVICE_ATTR_BITFIELD_RW(_otg_attr_name_,_string_) \
......@@ -432,8 +489,12 @@ static ssize_t regoffset_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev = container_of(_dev,
struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
return snprintf(buf, sizeof("0xFFFFFFFF\n") + 1, "0x%08x\n",
......@@ -450,16 +511,16 @@ static ssize_t regoffset_store(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev = container_of(_dev,
struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
uint32_t offset = simple_strtoul(buf, NULL, 16);
#ifdef LM_INTERFACE
if (offset < SZ_256K) {
#elif PCI_INTERFACE
if (offset < 0x00040000) {
#endif
otg_dev->reg_offset = offset;
} else {
dev_err(_dev, "invalid offset\n");
......@@ -480,8 +541,12 @@ static ssize_t regvalue_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
uint32_t val;
......@@ -514,8 +579,12 @@ static ssize_t regvalue_store(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
volatile uint32_t *addr;
......@@ -589,8 +658,12 @@ static ssize_t hnp_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
return sprintf(buf, "HstNegScs = 0x%x\n",
dwc_otg_get_hnpstatus(otg_dev->core_if));
......@@ -606,8 +679,12 @@ static ssize_t hnp_store(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
uint32_t in = simple_strtoul(buf, NULL, 16);
dwc_otg_set_hnpreq(otg_dev->core_if, in);
......@@ -629,8 +706,12 @@ static ssize_t srp_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
return sprintf(buf, "SesReqScs = 0x%x\n",
dwc_otg_get_srpstatus(otg_dev->core_if));
......@@ -650,8 +731,12 @@ static ssize_t srp_store(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
dwc_otg_pcd_initiate_srp(otg_dev->pcd);
#endif
......@@ -672,8 +757,12 @@ static ssize_t buspower_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
return sprintf(buf, "Bus Power = 0x%x\n",
dwc_otg_get_prtpower(otg_dev->core_if));
......@@ -689,8 +778,12 @@ static ssize_t buspower_store(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
uint32_t on = simple_strtoul(buf, NULL, 16);
dwc_otg_set_prtpower(otg_dev->core_if, on);
......@@ -711,8 +804,12 @@ static ssize_t bussuspend_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
return sprintf(buf, "Bus Suspend = 0x%x\n",
......@@ -729,8 +826,12 @@ static ssize_t bussuspend_store(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
uint32_t in = simple_strtoul(buf, NULL, 16);
......@@ -750,8 +851,12 @@ static ssize_t remote_wakeup_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
return sprintf(buf,
......@@ -778,8 +883,12 @@ static ssize_t remote_wakeup_store(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
uint32_t val = simple_strtoul(buf, NULL, 16);
......@@ -806,8 +915,12 @@ static ssize_t regdump_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
dwc_otg_dump_global_registers(otg_dev->core_if);
......@@ -832,8 +945,12 @@ static ssize_t spramdump_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
dwc_otg_dump_spram(otg_dev->core_if);
......@@ -853,8 +970,12 @@ static ssize_t hcddump_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
dwc_otg_hcd_dump_state(otg_dev->hcd);
......@@ -876,8 +997,12 @@ static ssize_t hcd_frrem_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
dwc_otg_hcd_dump_frrem(otg_dev->hcd);
......@@ -899,8 +1024,12 @@ static ssize_t rd_reg_test_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);
#elif defined(PLATFORM_INTERFACE)
struct platform_device *platform_dev =
container_of(_dev, struct platform_device, dev);
dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev);
#endif
int i;
......@@ -931,8 +1060,12 @@ static ssize_t wr_reg_test_show(struct device *_dev,
#ifdef LM_INTERFACE
struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev);
dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);
#elif PCI_INTERFACE
#elif defined(PCI_INTERFACE)
dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);