usb: renesas_usbhs: add the channel number in dma-names
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Thu, 12 Mar 2015 06:35:18 +0000 (15:35 +0900)
committerFelipe Balbi <balbi@ti.com>
Fri, 13 Mar 2015 15:41:08 +0000 (10:41 -0500)
To connect the channel of USB-DMAC to USBHS DnFIFO number, this patch
adds this channel/FIFO number in dma-names. Otherwise, this driver
needs to add analysis code for device tree.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Documentation/devicetree/bindings/usb/renesas_usbhs.txt
drivers/usb/renesas_usbhs/fifo.c

index 61b045b6d50e56ae139b31468f2b95f85e8f1651..dc2a18f0b3a10a9e1bd5814fc429fe9246b82ec7 100644 (file)
@@ -15,7 +15,10 @@ Optional properties:
   - phys: phandle + phy specifier pair
   - phy-names: must be "usb"
   - dmas: Must contain a list of references to DMA specifiers.
-  - dma-names : Must contain a list of DMA names, "tx" or "rx".
+  - dma-names : Must contain a list of DMA names:
+   - tx0 ... tx<n>
+   - rx0 ... rx<n>
+    - This <n> means DnFIFO in USBHS module.
 
 Example:
        usbhs: usb@e6590000 {
index d891bff39d66cc538f50c71f4547e763581f197b..28d10eb432d5136ea49e5c7748f50a9691d44ee4 100644 (file)
@@ -1069,23 +1069,29 @@ static void usbhsf_dma_init_pdev(struct usbhs_fifo *fifo)
                                            &fifo->rx_slave);
 }
 
-static void usbhsf_dma_init_dt(struct device *dev, struct usbhs_fifo *fifo)
+static void usbhsf_dma_init_dt(struct device *dev, struct usbhs_fifo *fifo,
+                              int channel)
 {
-       fifo->tx_chan = dma_request_slave_channel_reason(dev, "tx");
+       char name[16];
+
+       snprintf(name, sizeof(name), "tx%d", channel);
+       fifo->tx_chan = dma_request_slave_channel_reason(dev, name);
        if (IS_ERR(fifo->tx_chan))
                fifo->tx_chan = NULL;
-       fifo->rx_chan = dma_request_slave_channel_reason(dev, "rx");
+
+       snprintf(name, sizeof(name), "rx%d", channel);
+       fifo->rx_chan = dma_request_slave_channel_reason(dev, name);
        if (IS_ERR(fifo->rx_chan))
                fifo->rx_chan = NULL;
 }
 
-static void usbhsf_dma_init(struct usbhs_priv *priv,
-                           struct usbhs_fifo *fifo)
+static void usbhsf_dma_init(struct usbhs_priv *priv, struct usbhs_fifo *fifo,
+                           int channel)
 {
        struct device *dev = usbhs_priv_to_dev(priv);
 
        if (dev->of_node)
-               usbhsf_dma_init_dt(dev, fifo);
+               usbhsf_dma_init_dt(dev, fifo, channel);
        else
                usbhsf_dma_init_pdev(fifo);
 
@@ -1231,7 +1237,7 @@ do {                                                                      \
                        usbhs_get_dparam(priv, d##channel##_tx_id);     \
        fifo->rx_slave.shdma_slave.slave_id =                           \
                        usbhs_get_dparam(priv, d##channel##_rx_id);     \
-       usbhsf_dma_init(priv, fifo);                                    \
+       usbhsf_dma_init(priv, fifo, channel);                           \
 } while (0)
 
 #define USBHS_DFIFO_INIT(priv, fifo, channel)                          \