ohci: Fixes due to USB stack update

This commit is contained in:
Sebastian Huber 2016-10-07 07:09:48 +02:00
parent e3881ee3e0
commit e11f8e31f0
2 changed files with 13 additions and 21 deletions

View File

@ -253,6 +253,12 @@ typedef struct ohci_softc {
uint8_t sc_hub_idata[32]; uint8_t sc_hub_idata[32];
char sc_vendor[16]; char sc_vendor[16];
#ifdef __rtems__
int sc_init_done;
#ifdef BSP_USB_OTG_TRANSCEIVER_I2C_ADDR
struct usb_otg_transceiver sc_otg_trans;
#endif /* BSP_USB_OTG_TRANSCEIVER_I2C_ADDR */
#endif /* __rtems__ */
} ohci_softc_t; } ohci_softc_t;

View File

@ -34,6 +34,8 @@
#include <bsp.h> #include <bsp.h>
#include <errno.h>
#if defined(LIBBSP_ARM_LPC24XX_BSP_H) || defined(LIBBSP_ARM_LPC32XX_BSP_H) #if defined(LIBBSP_ARM_LPC24XX_BSP_H) || defined(LIBBSP_ARM_LPC32XX_BSP_H)
#include <bsp/irq.h> #include <bsp/irq.h>
@ -224,7 +226,7 @@ static int lpc_otg_clk_ctrl(uint32_t otg_clk_ctrl)
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/stdint.h> #include <sys/stdint.h>
#include <sys/stddef.h> #include <sys/stddef.h>
#include <sys/param.h> #include <rtems/bsd/sys/param.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -232,7 +234,7 @@ static int lpc_otg_clk_ctrl(uint32_t otg_clk_ctrl)
#include <sys/bus.h> #include <sys/bus.h>
#include <sys/linker_set.h> #include <sys/linker_set.h>
#include <sys/module.h> #include <sys/module.h>
#include <sys/lock.h> #include <rtems/bsd/sys/lock.h>
#include <sys/mutex.h> #include <sys/mutex.h>
#include <sys/condvar.h> #include <sys/condvar.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
@ -362,7 +364,6 @@ static int i2c_write(
static device_probe_t ohci_lpc_probe; static device_probe_t ohci_lpc_probe;
static device_attach_t ohci_lpc_attach; static device_attach_t ohci_lpc_attach;
static device_detach_t ohci_lpc_detach; static device_detach_t ohci_lpc_detach;
static device_suspend_t ohci_lpc_suspend;
static device_resume_t ohci_lpc_resume; static device_resume_t ohci_lpc_resume;
static int static int
@ -393,23 +394,9 @@ ohci_lpc_otg_transceiver_suspend(ohci_softc_t *e)
return eno; return eno;
} }
static int
ohci_lpc_suspend(device_t self)
{
ohci_softc_t *e = device_get_softc(self);
int eno = bus_generic_suspend(self);
if (eno == 0) {
ohci_suspend(e);
}
return (eno);
}
static int static int
ohci_lpc_resume(device_t self) ohci_lpc_resume(device_t self)
{ {
ohci_softc_t *e = device_get_softc(self);
int eno = 0; int eno = 0;
#ifdef BSP_USB_OTG_TRANSCEIVER_I2C_ADDR #ifdef BSP_USB_OTG_TRANSCEIVER_I2C_ADDR
@ -442,8 +429,6 @@ ohci_lpc_resume(device_t self)
#endif /* BSP_USB_OTG_TRANSCEIVER_I2C_ADDR */ #endif /* BSP_USB_OTG_TRANSCEIVER_I2C_ADDR */
if (eno == 0) { if (eno == 0) {
ohci_resume(e);
eno = bus_generic_resume(self); eno = bus_generic_resume(self);
} }
@ -472,6 +457,7 @@ ohci_lpc_attach(device_t self)
e->sc_bus.parent = self; e->sc_bus.parent = self;
e->sc_bus.devices = e->sc_devices; e->sc_bus.devices = e->sc_devices;
e->sc_bus.devices_max = OHCI_MAX_DEVICES; e->sc_bus.devices_max = OHCI_MAX_DEVICES;
e->sc_bus.dma_bits = 32;
/* Get all DMA memory */ /* Get all DMA memory */
if (usb_bus_mem_alloc_all(&e->sc_bus, USB_GET_DMA_TAG(self), &ohci_iterate_hw_softc)) { if (usb_bus_mem_alloc_all(&e->sc_bus, USB_GET_DMA_TAG(self), &ohci_iterate_hw_softc)) {
@ -602,7 +588,7 @@ ohci_lpc_detach(device_t self)
device_delete_child(self, bdev); device_delete_child(self, bdev);
} }
device_delete_all_children(self); device_delete_children(self);
if (e->sc_init_done) { if (e->sc_init_done) {
ohci_detach(e); ohci_detach(e);
@ -632,7 +618,7 @@ static device_method_t ohci_methods [] = {
DEVMETHOD(device_probe, ohci_lpc_probe), DEVMETHOD(device_probe, ohci_lpc_probe),
DEVMETHOD(device_attach, ohci_lpc_attach), DEVMETHOD(device_attach, ohci_lpc_attach),
DEVMETHOD(device_detach, ohci_lpc_detach), DEVMETHOD(device_detach, ohci_lpc_detach),
DEVMETHOD(device_suspend, ohci_lpc_suspend), DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, ohci_lpc_resume), DEVMETHOD(device_resume, ohci_lpc_resume),
DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_shutdown, bus_generic_shutdown),