.. | .. |
---|
22 | 22 | #include <linux/seq_file.h> |
---|
23 | 23 | #include <linux/mutex.h> |
---|
24 | 24 | #include <linux/miscdevice.h> |
---|
| 25 | +#include <linux/pm.h> |
---|
| 26 | +#include <linux/pm_runtime.h> |
---|
25 | 27 | #include "../core/block.h" |
---|
26 | 28 | #include "../core/card.h" |
---|
27 | 29 | #include "../core/core.h" |
---|
.. | .. |
---|
131 | 133 | /* |
---|
132 | 134 | * Transfer a single sector of kernel addressable data |
---|
133 | 135 | */ |
---|
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) |
---|
135 | 137 | { |
---|
136 | 138 | int ret = 0; |
---|
137 | 139 | enum emmc_area_type areatype; |
---|
.. | .. |
---|
150 | 152 | mrq.data = &data; |
---|
151 | 153 | mrq.stop = &stop; |
---|
152 | 154 | |
---|
153 | | - sg_init_one(&sg, buffer, blksz); |
---|
| 155 | + sg_init_one(&sg, buffer, datasz); |
---|
154 | 156 | |
---|
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); |
---|
156 | 158 | |
---|
| 159 | + pm_runtime_get_sync(&this_card->dev); |
---|
157 | 160 | 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 | + } |
---|
158 | 167 | |
---|
159 | 168 | areatype = (enum emmc_area_type)this_card->ext_csd.part_config |
---|
160 | 169 | & EXT_CSD_PART_CONFIG_ACC_MASK; |
---|
.. | .. |
---|
186 | 195 | } |
---|
187 | 196 | |
---|
188 | 197 | exit: |
---|
| 198 | + if (this_card->reenable_cmdq && !this_card->ext_csd.cmdq_en) |
---|
| 199 | + mmc_cmdq_enable(this_card); |
---|
| 200 | + |
---|
189 | 201 | mmc_release_host(this_card->host); |
---|
| 202 | + pm_runtime_put(&this_card->dev); |
---|
| 203 | + |
---|
190 | 204 | return ret; |
---|
191 | 205 | } |
---|
192 | 206 | EXPORT_SYMBOL(rk_emmc_transfer); |
---|