All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Behme Dirk (CM/ESO2)" <dirk.behme@de.bosch.com>
To: Vignesh Raghavendra <vigneshr@ti.com>,
	Sergei Shtylyov <sergei.shtylyov@gmail.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	<linux-mtd@lists.infradead.org>
Subject: Re: [PATCH v2] mtd: hyperbus: add Renesas RPC-IF driver
Date: Tue, 15 Sep 2020 06:07:55 +0200	[thread overview]
Message-ID: <663f56cb-d38c-1e38-8459-4306a6da88db@de.bosch.com> (raw)
In-Reply-To: <c3cbbc7e-ded0-86dc-8582-af80ff641cfa@ti.com>



On 14.09.2020 15:09, Vignesh Raghavendra wrote:
> Hi Sergei,
> 
> On 5/14/20 2:13 AM, Sergei Shtylyov wrote:
>> Add the HyperFLash driver for the Renesas RPC-IF.  It's the "front end"
>> driver using the "back end" APIs in the main driver to talk to the real
>> hardware.
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>
> 
> Mails to this ID is bouncing which meant I could not ask status of
> dependencies.
> 
>> ---
>> This patch is against the 'mtd/next' branch of the MTD 'linux.git' repo.
>> Requires  the RPC-IF main driver patch in order to build/work:
>>
>> [1] https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.kernel.org%2Fpatch%2F11283127%2F&amp;data=02%7C01%7Cdirk.behme%40de.bosch.com%7C67d24357a6644232518008d858af6cd0%7C0ae51e1907c84e4bbb6d648ee58410f4%7C0%7C0%7C637356857751715684&amp;sdata=XDR3Nu15LcC3G5C4HZgb9UH8eNGWDpuxupf6zoXcM%2Fc%3D&amp;reserved=0
>>
> [...]
>> --- /dev/null
>> +++ linux/drivers/mtd/hyperbus/rpc-if.c
>> @@ -0,0 +1,165 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Linux driver for RPC-IF HyperFlash
>> + *
>> + * Copyright (C) 2019-2020 Cogent Embedded, Inc.
>> + */
>> +
>> +#include <linux/err.h>
>> +#include <linux/kernel.h>
>> +#include <linux/module.h>
>> +#include <linux/mtd/hyperbus.h>
>> +#include <linux/mtd/mtd.h>
>> +#include <linux/mux/consumer.h>
>> +#include <linux/of.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/types.h>
>> +
>> +#include <memory/renesas-rpc-if.h>
>> +
>> +/* FIXME: How to drop this? */
>> +#ifndef CONFIG_MTD_CFI_BE_BYTE_SWAP
>> +#error Enable config "Flash cmd/query data swapping (BIG_ENDIAN_BYTE)"
>> +#endif
> 
> select MTD_CFI_BE_BYTE_SWAP in Kconfig does not help?


If I remember correctly 'select MTD_CFI_BE_BYTE_SWAP' in Kconfig doesn't 
seem to work. Therefore the FIXME. I can't remember exactly the root 
cause for that any more, but maybe it was the 'bool' type of 
MTD_CFI_BE_BYTE_SWAP?

If anybody has a nice solution for that, it would be welcome :)

Best regards

Dirk


>> +
>> + struct	rpcif_hyperbus {
> 
> WARNING: please, no spaces at the start of a line
> #73: FILE: drivers/mtd/hyperbus/rpc-if.c:25:
> + struct^Irpcif_hyperbus {$
> 
> 
> 
>> +	struct rpcif rpc;
>> +	struct hyperbus_ctlr ctlr;
>> +	struct hyperbus_device hbdev;
>> +};
>> +
>> +static const struct rpcif_op rpcif_op_tmpl = {
>> +	.cmd = {
>> +		.buswidth = 8,
>> +		.ddr = true,
>> +	},
>> +	.ocmd = {
>> +		.buswidth = 8,
>> +		.ddr = true,
>> +	},
>> +	.addr = {
>> +		.nbytes = 1,
>> +		.buswidth = 8,
>> +		.ddr = true,
>> +	},
>> +	.data = {
>> +		.buswidth = 8,
>> +		.ddr = true,
>> +	},
>> +};
>> +
>> +static u16 rpcif_hb_read16(struct hyperbus_device *hbdev, unsigned long addr)
>> +{
>> +	struct rpcif_hyperbus *hyperbus =
>> +		container_of(hbdev, struct rpcif_hyperbus, hbdev);
>> +	struct rpcif_op op = rpcif_op_tmpl;
>> +	map_word data;
>> +
>> +	op.cmd.opcode = 0x80;
> 
> Here and elsewhere what does 0x80 represent? Maybe using a self
> describing macro would be helpful when assigning values to op.cmd.opcode?
> 
>> +	op.addr.val = addr >> 1;
>> +	op.dummy.buswidth = 1;
>> +	op.dummy.ncycles = 15;
>> +	op.data.dir = RPCIF_DATA_IN;
>> +	op.data.nbytes = 2;
>> +	op.data.buf.in = &data;
> 
> This code block seems like a good candidate to be converted to a macro/
> template to avoid repetition. Template can initializes few values remain
> common across the driver and override others based on parameters passed.
> You could probably have one for write op and one for read op, if needed.
> 
> [...]
> 
> Regards
> Vignesh
> 

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2020-09-15  4:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 20:43 [PATCH v2] mtd: hyperbus: add Renesas RPC-IF driver Sergei Shtylyov
2020-05-14  8:38 ` Sergei Shtylyov
2020-09-12 19:15 ` Sergei Shtylyov
2020-09-14 13:09 ` Vignesh Raghavendra
2020-09-15  4:07   ` Behme Dirk (CM/ESO2) [this message]
2020-09-15  5:27     ` Vignesh Raghavendra
2020-09-15  9:37       ` Behme Dirk (CM/ESO2)
2020-09-16  6:10         ` Vignesh Raghavendra
2020-09-19 16:37   ` Sergei Shtylyov
2020-09-21  7:29     ` Vignesh Raghavendra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=663f56cb-d38c-1e38-8459-4306a6da88db@de.bosch.com \
    --to=dirk.behme@de.bosch.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=sergei.shtylyov@gmail.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.