musb: cppi41: fixes to support new musb arch
authorAjay Kumar Gupta <ajay.gupta@ti.com>
Thu, 20 Jan 2011 09:28:21 +0000 (14:58 +0530)
committerVaibhav Hiremath <hvaibhav@ti.com>
Mon, 23 Jan 2012 19:14:09 +0000 (00:44 +0530)
Changes:
- __init to __devinit
- rename create/destroy functions
- channels maxlen

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
drivers/usb/musb/cppi41.c
drivers/usb/musb/cppi41.h
drivers/usb/musb/cppi41_dma.c

index 498f858c249c999518c409aafa9b0c8714ffa569..ec97a3b609e081f8b967538f204eda79aa29b446 100644 (file)
@@ -61,7 +61,7 @@ static struct {
 
 /******************** CPPI 4.1 Functions (External Interface) *****************/
 
-int __init cppi41_queue_mgr_init(u8 q_mgr, dma_addr_t rgn0_base, u16 rgn0_size)
+int cppi41_queue_mgr_init(u8 q_mgr, dma_addr_t rgn0_base, u16 rgn0_size)
 {
        void __iomem *q_mgr_regs;
        void *ptr;
@@ -112,7 +112,7 @@ int __init cppi41_queue_mgr_init(u8 q_mgr, dma_addr_t rgn0_base, u16 rgn0_size)
        return 0;
 }
 
-int __init cppi41_dma_block_init(u8 dma_num, u8 q_mgr, u8 num_order,
+int cppi41_dma_block_init(u8 dma_num, u8 q_mgr, u8 num_order,
                                 u8 *sched_tbl, u8 tbl_size)
 {
        const struct cppi41_dma_block *dma_block;
index 032ed135020ad06813f5d253a238b35c1cf10010..5452af9748d7c8654133b5ac2273818b9b9d6b45 100644 (file)
 #define DMA_SCHED_LAST_ENTRY_SHIFT     0
 #define DMA_SCHED_LAST_ENTRY_MASK      (0xff << DMA_SCHED_LAST_ENTRY_SHIFT)
 
+#define CPPI41_TXDMA_MAXLEN            (4 * 1024 * 1024 - 1)
+#define CPPI41_RXDMA_MAXLEN            (64 * 1024)
 /*
  * DMA Scheduler - Table Region
  */
@@ -534,7 +536,7 @@ int cppi41_mem_rgn_free(u8 q_mgr, u8 mem_rgn);
  *
  * Returns 0 on success, error otherwise.
  */
-int __init cppi41_dma_block_init(u8 dma_num, u8 q_mgr, u8 num_order,
+int cppi41_dma_block_init(u8 dma_num, u8 q_mgr, u8 num_order,
                                 u8 *sched_tbl, u8 tbl_size);
 
 /*
index 8c9bf5f5c154ead9fcc26969cb1c477b098446c2..9e146d835e8ade26cd3b9401ce2c050cf2c0fc6d 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <linux/errno.h>
 #include <linux/dma-mapping.h>
+#include <linux/module.h>
 
 #include "cppi41.h"
 
@@ -160,7 +161,7 @@ static void usb_put_free_pd(struct cppi41 *cppi, struct usb_pkt_desc *free_pd)
  *
  * This function initializes the CPPI 4.1 Tx/Rx channels.
  */
-static int __init cppi41_controller_start(struct dma_controller *controller)
+static int __devinit cppi41_controller_start(struct dma_controller *controller)
 {
        struct cppi41 *cppi;
        struct cppi41_channel *cppi_ch;
@@ -439,6 +440,8 @@ static struct dma_channel *cppi41_channel_alloc(struct dma_controller
        cppi_ch->end_pt = ep;
        cppi_ch->ch_num = ch_num;
        cppi_ch->channel.status = MUSB_DMA_STATUS_FREE;
+       cppi_ch->channel.max_len = is_tx ?
+                               CPPI41_TXDMA_MAXLEN : CPPI41_RXDMA_MAXLEN;
 
        DBG(4, "Allocated DMA %cx channel %d for EP%d\n", is_tx ? 'T' : 'R',
            ch_num, ep_num);
@@ -1070,10 +1073,11 @@ static int cppi41_channel_abort(struct dma_channel *channel)
 }
 
 /**
- * dma_controller_create - instantiate an object representing DMA controller.
+ * cppi41_dma_controller_create -
+ * instantiate an object representing DMA controller.
  */
-struct dma_controller * __init dma_controller_create(struct musb  *musb,
-                                                    void __iomem *mregs)
+struct dma_controller * __devinit
+cppi41_dma_controller_create(struct musb  *musb, void __iomem *mregs)
 {
        struct cppi41 *cppi;
 
@@ -1092,12 +1096,14 @@ struct dma_controller * __init dma_controller_create(struct musb  *musb,
 
        return &cppi->controller;
 }
+EXPORT_SYMBOL(cppi41_dma_controller_create);
 
 /**
- * dma_controller_destroy - destroy a previously instantiated DMA controller
+ * cppi41_dma_controller_destroy -
+ * destroy a previously instantiated DMA controller
  * @controller: the controller
  */
-void dma_controller_destroy(struct dma_controller *controller)
+void cppi41_dma_controller_destroy(struct dma_controller *controller)
 {
        struct cppi41 *cppi;
 
@@ -1106,6 +1112,7 @@ void dma_controller_destroy(struct dma_controller *controller)
        /* Free the CPPI object */
        kfree(cppi);
 }
+EXPORT_SYMBOL(cppi41_dma_controller_destroy);
 
 static void usb_process_tx_queue(struct cppi41 *cppi, unsigned index)
 {
@@ -1228,3 +1235,17 @@ void cppi41_completion(struct musb *musb, u32 rx, u32 tx)
                if (tx & 1)
                        usb_process_tx_queue(cppi, index);
 }
+
+MODULE_DESCRIPTION("CPPI4.1 dma controller driver for musb");
+MODULE_LICENSE("GPL v2");
+
+static int __init cppi41_dma_init(void)
+{
+       return 0;
+}
+module_init(cppi41_dma_init);
+
+static void __exit cppi41_dma__exit(void)
+{
+}
+module_exit(cppi41_dma__exit);