OSDN Git Service

msm: ipa3: changes to IPA USB APIs to support SMMU
authorSkylar Chang <chiaweic@codeaurora.org>
Wed, 27 Jul 2016 00:17:22 +0000 (17:17 -0700)
committerSkylar Chang <chiaweic@codeaurora.org>
Wed, 27 Jul 2016 00:17:22 +0000 (17:17 -0700)
Add support to IPA USB APIs for SMMU.

CRs-Fixed: 1046497
Change-Id: Ifca675f308b59913743baf2e59dc3ed515a5b974
Acked-by: Ady Abraham <adya@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
drivers/platform/msm/ipa/ipa_clients/ipa_usb.c
drivers/usb/gadget/function/f_gsi.c
include/linux/ipa_usb.h

index d7a9873..11daafe 100644 (file)
@@ -1061,8 +1061,8 @@ static bool ipa3_usb_check_chan_params(struct ipa_usb_xdci_chan_params *params)
        IPA_USB_DBG_LOW("xfer_ring_len = %d\n", params->xfer_ring_len);
        IPA_USB_DBG_LOW("xfer_ring_base_addr = %llx\n",
                params->xfer_ring_base_addr);
-       IPA_USB_DBG_LOW("last_trb_addr = %x\n",
-               params->xfer_scratch.last_trb_addr);
+       IPA_USB_DBG_LOW("last_trb_addr_iova = %x\n",
+               params->xfer_scratch.last_trb_addr_iova);
        IPA_USB_DBG_LOW("const_buffer_size = %d\n",
                params->xfer_scratch.const_buffer_size);
        IPA_USB_DBG_LOW("depcmd_low_addr = %x\n",
@@ -1227,7 +1227,7 @@ static int ipa3_usb_request_xdci_channel(
        chan_params.chan_params.err_cb = ipa3_usb_gsi_chan_err_cb;
        chan_params.chan_params.chan_user_data = NULL;
        chan_params.chan_scratch.xdci.last_trb_addr =
-               params->xfer_scratch.last_trb_addr;
+               params->xfer_scratch.last_trb_addr_iova;
        /* xferrscidx will be updated later */
        chan_params.chan_scratch.xdci.xferrscidx = 0;
        chan_params.chan_scratch.xdci.const_buffer_size =
index 6964933..8a80110 100644 (file)
@@ -256,7 +256,7 @@ static int ipa_connect_channels(struct gsi_data_port *d_port)
        in_params->dir = GSI_CHAN_DIR_FROM_GSI;
        in_params->xfer_ring_len = gsi_channel_info.xfer_ring_len;
        in_params->xfer_ring_base_addr = gsi_channel_info.xfer_ring_base_addr;
-       in_params->xfer_scratch.last_trb_addr =
+       in_params->xfer_scratch.last_trb_addr_iova =
                d_port->in_last_trb_addr = gsi_channel_info.last_trb_addr;
        in_params->xfer_scratch.const_buffer_size =
                gsi_channel_info.const_buffer_size;
@@ -290,7 +290,7 @@ static int ipa_connect_channels(struct gsi_data_port *d_port)
                        gsi_channel_info.xfer_ring_len;
                out_params->xfer_ring_base_addr =
                        gsi_channel_info.xfer_ring_base_addr;
-               out_params->xfer_scratch.last_trb_addr =
+               out_params->xfer_scratch.last_trb_addr_iova =
                        gsi_channel_info.last_trb_addr;
                out_params->xfer_scratch.const_buffer_size =
                        gsi_channel_info.const_buffer_size;
@@ -2782,7 +2782,7 @@ static ssize_t gsi_info_show(struct config_item *item, char *page)
                ipa_chnl_params->xfer_scratch.depcmd_low_addr);
                len += scnprintf(buf + len, PAGE_SIZE - len,
                "%25s %10x\n", "IN LastTRB Addr Off: ",
-                       ipa_chnl_params->xfer_scratch.last_trb_addr);
+               ipa_chnl_params->xfer_scratch.last_trb_addr_iova);
                len += scnprintf(buf + len, PAGE_SIZE - len,
                "%25s %10u\n", "IN Buffer Size: ",
                ipa_chnl_params->xfer_scratch.const_buffer_size);
@@ -2816,7 +2816,7 @@ static ssize_t gsi_info_show(struct config_item *item, char *page)
                        ipa_chnl_params->xfer_scratch.depcmd_low_addr);
                len += scnprintf(buf + len, PAGE_SIZE - len,
                "%25s %10x\n", "OUT LastTRB Addr Off: ",
-                       ipa_chnl_params->xfer_scratch.last_trb_addr);
+               ipa_chnl_params->xfer_scratch.last_trb_addr_iova);
                len += scnprintf(buf + len, PAGE_SIZE - len,
                "%25s %10u\n", "OUT Buffer Size: ",
                ipa_chnl_params->xfer_scratch.const_buffer_size);
index c3885c7..0fe0e36 100644 (file)
@@ -94,7 +94,7 @@ struct ipa_usb_xdci_connect_params {
  * ipa_usb_xdci_chan_scratch - xDCI protocol SW config area of
  * channel scratch
  *
- * @last_trb_addr:       Address (LSB - based on alignment restrictions) of
+ * @last_trb_addr_iova:  Address (iova LSB - based on alignment restrictions) of
  *                       last TRB in queue. Used to identify roll over case
  * @const_buffer_size:   TRB buffer size in KB (similar to IPA aggregation
  *                       configuration). Must be aligned to max USB Packet Size.
@@ -103,7 +103,7 @@ struct ipa_usb_xdci_connect_params {
  * @depcmd_hi_addr:      Used to generate "Update Transfer" command.
  */
 struct ipa_usb_xdci_chan_scratch {
-       u16 last_trb_addr;
+       u16 last_trb_addr_iova;
        u8 const_buffer_size;
        u32 depcmd_low_addr;
        u8 depcmd_hi_addr;
@@ -124,6 +124,11 @@ struct ipa_usb_xdci_chan_scratch {
  * @xfer_ring_base_addr: physical base address of transfer ring. Address must be
  *                       aligned to xfer_ring_len rounded to power of two
  * @xfer_scratch:        parameters for xDCI channel scratch
+ * @xfer_ring_base_addr_iova: IO virtual address mapped to xfer_ring_base_addr
+ * @data_buff_base_len:  length of data buffer allocated by USB driver
+ * @data_buff_base_addr: physical base address for the data buffer (where TRBs
+ *                       points)
+ * @data_buff_base_addr_iova:  IO virtual address mapped to data_buff_base_addr
  *
  */
 struct ipa_usb_xdci_chan_params {
@@ -140,6 +145,10 @@ struct ipa_usb_xdci_chan_params {
        u16 xfer_ring_len;
        u64 xfer_ring_base_addr;
        struct ipa_usb_xdci_chan_scratch xfer_scratch;
+       u64 xfer_ring_base_addr_iova;
+       u32 data_buff_base_len;
+       u64 data_buff_base_addr;
+       u64 data_buff_base_addr_iova;
 };
 
 /**