Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1374074
| From | Jiancheng Xue <xuejiancheng@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RESEND PATCH v9] mtd: spi-nor: add hisilicon spi-nor flash controller driver |
| Date | 2016-04-08 10:30 +0200 |
| Message-ID | <rlzXH-XP-1@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <rh801-1by-1@gated-at.bofh.it> <rhBv4-4QJ-5@gated-at.bofh.it> <rk6uJ-7BH-5@gated-at.bofh.it> <rl7I6-5dH-15@gated-at.bofh.it> <rl7RL-5jp-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi,
On 2016/4/7 10:28, Marek Vasut wrote:
> On 04/07/2016 04:10 AM, Jiancheng Xue wrote:
>> Hi Brian,
>> Thank you very much for your comments. I'll fix these issues in next version.
>> In addition, for easy understanding I'd like to rewrite hisi_spi_nor_write and
>> hisi_spi_nor_read. Your comments on these modifications will be highly appreciated.
>
> Would you please stop top-posting ? It rubs some people the wrong way.
>
I feel very sorry about that. I have read the etiquette and won't make the same mistake again.
>> static int hisi_spi_nor_read(struct spi_nor *nor, loff_t from, size_t len,
>> size_t *retlen, u_char *read_buf)
>> {
>> struct hifmc_priv *priv = nor->priv;
>> struct hifmc_host *host = priv->host;
>> int i;
>>
>> /* read all bytes in only one time */
>> if (len <= HIFMC_DMA_MAX_LEN) {
>> hisi_spi_nor_dma_transfer(nor, from, host->dma_buffer,
>> len, FMC_OP_READ);
>> memcpy(read_buf, host->buffer, len);
>
> Is all the ad-hoc memcpying necessary? I think you can use
> dma_map_single() and co to obtain DMAble memory for your
> controller's use and then you can probably get rid of most
> of this stuff.
>
Considering read_buf >= high_mem case, I think it is also complicated to use dma_map_*
and the DMA buffer allocated by the driver is still needed. But I am not sure about
this. Please let me know if I am wrong. Thank you!
Regards,
Jiancheng
>> } else {
>> /* read HIFMC_DMA_MAX_LEN bytes at a time */
>> for (i = 0; i < len; i += HIFMC_DMA_MAX_LEN) {
>> hisi_spi_nor_dma_transfer(nor, from + i, host->dma_buffer,
>> HIFMC_DMA_MAX_LEN, FMC_OP_READ);
>> memcpy(read_buf + i, host->buffer, HIFMC_DMA_MAX_LEN);
>> }
>> /* read remaining bytes */
>> i -= HIFMC_DMA_MAX_LEN;
>> hisi_spi_nor_dma_transfer(nor, from + i, host->dma_buffer,
>> len - i, FMC_OP_READ);
>> memcpy(read_buf + i, host->buffer, len - i);
>> }
>> *retlen = len;
>>
>> return 0;
>> }
>>
[...]
>> On 2016/4/4 14:44, Brian Norris wrote:
>>> Hi Jiancheng,
>>>
>>> Looking good. In addition to Marek's comments, I have just a few small
>>> comments. I'll post a small diff at the end, and a few inline comments.
>>>
>
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [RESEND PATCH v9] mtd: spi-nor: add hisilicon spi-nor flash controller driver Brian Norris <computersforpeace@gmail.com> - 2016-04-04 08:50 +0200
Re: [RESEND PATCH v9] mtd: spi-nor: add hisilicon spi-nor flash controller driver Jiancheng Xue <xuejiancheng@huawei.com> - 2016-04-07 04:20 +0200
Re: [RESEND PATCH v9] mtd: spi-nor: add hisilicon spi-nor flash controller driver Marek Vasut <marex@denx.de> - 2016-04-07 04:30 +0200
Re: [RESEND PATCH v9] mtd: spi-nor: add hisilicon spi-nor flash controller driver Jiancheng Xue <xuejiancheng@huawei.com> - 2016-04-08 10:30 +0200
Re: [RESEND PATCH v9] mtd: spi-nor: add hisilicon spi-nor flash controller driver Marek Vasut <marex@denx.de> - 2016-04-08 12:20 +0200
Re: [RESEND PATCH v9] mtd: spi-nor: add hisilicon spi-nor flash controller driver Jiancheng Xue <xuejiancheng@huawei.com> - 2016-04-11 03:40 +0200
Re: [RESEND PATCH v9] mtd: spi-nor: add hisilicon spi-nor flash controller driver Marek Vasut <marex@denx.de> - 2016-04-11 21:40 +0200
Re: [RESEND PATCH v9] mtd: spi-nor: add hisilicon spi-nor flash controller driver Jiancheng Xue <xuejiancheng@huawei.com> - 2016-04-12 11:40 +0200
Re: [RESEND PATCH v9] mtd: spi-nor: add hisilicon spi-nor flash controller driver Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-12 11:50 +0200
Re: [RESEND PATCH v9] mtd: spi-nor: add hisilicon spi-nor flash controller driver Jiancheng Xue <xuejiancheng@huawei.com> - 2016-04-13 11:30 +0200
csiph-web