]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
mmc: cmdq: fixing transfer descriptor allocation
authorR Raj Kumar <rrajk@nvidia.com>
Mon, 2 Nov 2015 12:31:42 +0000 (18:01 +0530)
committerR Raj Kumar <rrajk@nvidia.com>
Wed, 22 Jun 2016 10:00:35 +0000 (03:00 -0700)
- Fixed transfer descriptor allocation and access
- Replaced virt_to_phys() function with proper function

Bug 200149628
Bug 200193440

Change-Id: Ia034b25d34613492d3ff5242b542c4d94416626f
Reviewed-on: http://git-master/r/826245

Signed-off-by: R Raj Kumar <rrajk@nvidia.com>
Change-Id: I1c9915bf8e3dfeaf1b1b54923e2174068df95fce
Reviewed-on: http://git-master/r/1168483
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>
drivers/mmc/host/cmdq_hci.c

index afef727de37b28e5e8a3b77e53aabccfdffa92af..66dcbc9d878ac27166e3181fa9c7239cee17ab4e 100644 (file)
@@ -48,8 +48,7 @@ static inline dma_addr_t get_trans_desc_dma(struct cmdq_host *cq_host, u8 tag)
 {
        u8 mul = sizeof(u64)/sizeof(dma_addr_t);
        return cq_host->trans_desc_dma_base +
-               (mul * cq_host->mmc->max_segs * tag *
-                sizeof(*cq_host->trans_desc_base));
+               (mul * cq_host->mmc->max_segs * tag * cq_host->trans_desc_len);
 }
 
 static inline u64 *get_trans_desc(struct cmdq_host *cq_host, u8 tag)
@@ -58,23 +57,16 @@ static inline u64 *get_trans_desc(struct cmdq_host *cq_host, u8 tag)
 
        return cq_host->trans_desc_base +
                (mul * cq_host->mmc->max_segs * tag *
-                sizeof(*cq_host->trans_desc_base));
+               (cq_host->trans_desc_len / sizeof(*cq_host->trans_desc_base)));
 }
 
 static void setup_trans_desc(struct cmdq_host *cq_host, u8 tag)
 {
        u64 *link_temp;
-       u64 *trans_desc;
        dma_addr_t trans_temp;
 
        link_temp = get_link_desc(cq_host, tag);
-       /*
-        * Wrong physical address is getting populated with
-        * get_trans_desc_dma() api. Hence, using virt_to_phys() for
-        * physical address.
-        */
-       trans_desc = get_trans_desc(cq_host, tag);
-       trans_temp = virt_to_phys(trans_desc);
+       trans_temp = get_trans_desc_dma(cq_host, tag);
 
        memset(link_temp, 0, sizeof(*link_temp));
        if (cq_host->link_desc_len > 1)
@@ -203,8 +195,7 @@ static int cmdq_host_alloc_tdl(struct cmdq_host *cq_host)
                cq_host->slot_sz * cq_host->num_slots;
 
        /* FIXME: consider allocating smaller chunks iteratively */
-       cq_host->data_size = (sizeof(*cq_host->trans_desc_base)) *
-               cq_host->trans_desc_len * cq_host->mmc->max_segs *
+       cq_host->data_size = cq_host->trans_desc_len * cq_host->mmc->max_segs *
                (cq_host->num_slots - 1);
 
        /*