hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/mmc/host/rk_sdmmc_ops.c
....@@ -22,6 +22,8 @@
2222 #include <linux/seq_file.h>
2323 #include <linux/mutex.h>
2424 #include <linux/miscdevice.h>
25
+#include <linux/pm.h>
26
+#include <linux/pm_runtime.h>
2527 #include "../core/block.h"
2628 #include "../core/card.h"
2729 #include "../core/core.h"
....@@ -131,7 +133,7 @@
131133 /*
132134 * Transfer a single sector of kernel addressable data
133135 */
134
-int rk_emmc_transfer(u8 *buffer, unsigned addr, unsigned blksz, int write)
136
+int rk_emmc_transfer(u8 *buffer, unsigned int addr, unsigned int datasz, int write)
135137 {
136138 int ret = 0;
137139 enum emmc_area_type areatype;
....@@ -150,11 +152,18 @@
150152 mrq.data = &data;
151153 mrq.stop = &stop;
152154
153
- sg_init_one(&sg, buffer, blksz);
155
+ sg_init_one(&sg, buffer, datasz);
154156
155
- rk_emmc_prepare_mrq(&mrq, &sg, 1, addr, 1, blksz, write);
157
+ rk_emmc_prepare_mrq(&mrq, &sg, 1, addr, datasz / BLKSZ, BLKSZ, write);
156158
159
+ pm_runtime_get_sync(&this_card->dev);
157160 mmc_claim_host(this_card->host);
161
+
162
+ if (this_card->ext_csd.cmdq_en) {
163
+ ret = mmc_cmdq_disable(this_card);
164
+ if (ret)
165
+ goto exit;
166
+ }
158167
159168 areatype = (enum emmc_area_type)this_card->ext_csd.part_config
160169 & EXT_CSD_PART_CONFIG_ACC_MASK;
....@@ -186,7 +195,12 @@
186195 }
187196
188197 exit:
198
+ if (this_card->reenable_cmdq && !this_card->ext_csd.cmdq_en)
199
+ mmc_cmdq_enable(this_card);
200
+
189201 mmc_release_host(this_card->host);
202
+ pm_runtime_put(&this_card->dev);
203
+
190204 return ret;
191205 }
192206 EXPORT_SYMBOL(rk_emmc_transfer);