--- zzzz-none-000/linux-3.10.107/drivers/usb/musb/musbhsdma.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/usb/musb/musbhsdma.c 2021-02-04 17:41:59.000000000 +0000 @@ -37,18 +37,10 @@ #include "musb_core.h" #include "musbhsdma.h" -static int dma_controller_start(struct dma_controller *c) -{ - /* nothing to do */ - return 0; -} - static void dma_channel_release(struct dma_channel *channel); -static int dma_controller_stop(struct dma_controller *c) +static void dma_controller_stop(struct musb_dma_controller *controller) { - struct musb_dma_controller *controller = container_of(c, - struct musb_dma_controller, controller); struct musb *musb = controller->private_data; struct dma_channel *channel; u8 bit; @@ -67,8 +59,6 @@ } } } - - return 0; } static struct dma_channel *dma_channel_allocate(struct dma_controller *c, @@ -205,6 +195,7 @@ { struct musb_dma_channel *musb_channel = channel->private_data; void __iomem *mbase = musb_channel->controller->base; + struct musb *musb = musb_channel->controller->private_data; u8 bchannel = musb_channel->idx; int offset; @@ -212,7 +203,7 @@ if (channel->status == MUSB_DMA_STATUS_BUSY) { if (musb_channel->transmit) { - offset = MUSB_EP_OFFSET(musb_channel->epnum, + offset = musb->io.ep_offset(musb_channel->epnum, MUSB_TXCSR); /* @@ -225,7 +216,7 @@ csr &= ~MUSB_TXCSR_DMAMODE; musb_writew(mbase, offset, csr); } else { - offset = MUSB_EP_OFFSET(musb_channel->epnum, + offset = musb->io.ep_offset(musb_channel->epnum, MUSB_RXCSR); csr = musb_readw(mbase, offset); @@ -336,7 +327,7 @@ (musb_channel->max_packet_sz - 1))) ) { u8 epnum = musb_channel->epnum; - int offset = MUSB_EP_OFFSET(epnum, + int offset = musb->io.ep_offset(epnum, MUSB_TXCSR); u16 txcsr; @@ -366,21 +357,22 @@ return retval; } -void dma_controller_destroy(struct dma_controller *c) +void musbhs_dma_controller_destroy(struct dma_controller *c) { struct musb_dma_controller *controller = container_of(c, struct musb_dma_controller, controller); - if (!controller) - return; + dma_controller_stop(controller); if (controller->irq) free_irq(controller->irq, c); kfree(controller); } +EXPORT_SYMBOL_GPL(musbhs_dma_controller_destroy); -struct dma_controller *dma_controller_create(struct musb *musb, void __iomem *base) +struct dma_controller *musbhs_dma_controller_create(struct musb *musb, + void __iomem *base) { struct musb_dma_controller *controller; struct device *dev = musb->controller; @@ -400,8 +392,6 @@ controller->private_data = musb; controller->base = base; - controller->controller.start = dma_controller_start; - controller->controller.stop = dma_controller_stop; controller->controller.channel_alloc = dma_channel_allocate; controller->controller.channel_release = dma_channel_release; controller->controller.channel_program = dma_channel_program; @@ -410,7 +400,7 @@ if (request_irq(irq, dma_controller_irq, 0, dev_name(musb->controller), &controller->controller)) { dev_err(dev, "request_irq %d failed!\n", irq); - dma_controller_destroy(&controller->controller); + musb_dma_controller_destroy(&controller->controller); return NULL; } @@ -419,3 +409,4 @@ return &controller->controller; } +EXPORT_SYMBOL_GPL(musbhs_dma_controller_create);