linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vignesh Raghavendra <vigneshr@ti.com>
To: Boris Brezillon <bbrezillon@kernel.org>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	Rob Herring <robh+dt@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	"tudor.ambarus@microchip.com" <tudor.ambarus@microchip.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Nori, Sekhar" <nsekhar@ti.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>
Subject: Re: [RFC PATCH 3/5] mtd: Add support for Hyperbus memory devices
Date: Wed, 27 Feb 2019 15:42:27 +0530	[thread overview]
Message-ID: <acde502c-63fb-e272-d701-4ee63eac4eaa@ti.com> (raw)
In-Reply-To: <20190227105937.527c6573@kernel.org>



On 27/02/19 3:29 PM, Boris Brezillon wrote:
> On Wed, 27 Feb 2019 15:22:19 +0530
> Vignesh Raghavendra <vigneshr@ti.com> wrote:
> 
>> On 26/02/19 11:46 PM, Sergei Shtylyov wrote:
>>> On 02/19/2019 09:36 AM, Vignesh R (by way of Boris Brezillon <bbrezillon@kernel.org>) wrote:
>>>   
>
[...]
>>>> + */
>>>> +
>>>> +struct hb_device {
>>>> +	struct map_info map;
>>>> +	struct device *dev;
>>>> +	struct device_node *np;
>>>> +	struct mtd_info *mtd;
>>>> +	struct hb_ops *ops;
>>>> +	enum hb_memtype memtype;
>>>> +	bool needs_calib;
>>>> +	bool registered;
>>>> +};
>>>> +
>>>> +/**
>>>> + * struct hb_ops - struct representing custom Hyperbus operations
>>>> + * @read16: read 16 bit of data, usually from register/ID-CFI space
>>>> + * @write16: write 16 bit of data, usually to register/ID-CFI space
>>>> + * copy_from: copy data from flash memory
>>>> + * copy_to: copy data to flash_memory
>>>> + */
>>>> +
>>>> +struct hb_ops {
>>>> +	u16 (*read16)(struct hb_device *hbdev, unsigned long addr);
>>>> +	void (*write16)(struct hb_device *hbdev, unsigned long addr, u16 val);
>>>> +
>>>> +	void (*copy_from)(struct hb_device *hbdev, void *to,
>>>> +			  unsigned long from, ssize_t len);
>>>> +	void (*copy_to)(struct hb_device *dev, unsigned long to,
>>>> +			const void *from, ssize_t len);  
>>>
>>>    ... else these methods won't fly if you need to "massage" the controller
>>> registers inside them...
>>>   
>>
>> If accessing controller register is the only need, wouldn't a private
>> data pointer within struct hb_device be sufficient to hold pointer to
>> controller specific struct?
>>
>> struct hb_device {
>> 	...
>> 	void *priv; /* points to controller's private data */
>> };
>>
>>
>> Or do you see a need for separate structure for the HyperBus controller?
> 
> Sorry to chime in. Just want to share my experience here: properly
> splitting the controller/device representation is always a good thing.
> When it's not done from the beginning and people start to add their own
> controller drivers as if it was a flash device driver it becomes messy
> pretty quickly and people add hacks to support that (look at the raw
> NAND framework if you need a proof). So, I'd recommend having this
> separation now, even if the onle controllers we support have a 1:1
> relationship between HB controller and HB device.
> 
>>

Alright, will separate controller and slave representation. Thanks for
the feedback!


-- 
Regards
Vignesh

  reply	other threads:[~2019-02-27 10:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19  6:36 [RFC PATCH 0/5] MTD: Add Initial Hyperbus support Vignesh R
2019-02-19  6:36 ` [RFC PATCH 1/5] mtd: cfi_cmdset_0002: Add support for polling status register Vignesh R
2019-02-23 18:41   ` Sergei Shtylyov
2019-02-23 18:44   ` Sergei Shtylyov
2019-02-19  6:36 ` [RFC PATCH 2/5] dt-bindings: mtd: Add binding documentation for Hyperbus memory devices Vignesh R
2019-02-19  6:36 ` [RFC PATCH 3/5] mtd: Add support " Vignesh R
2019-02-23 20:19   ` Sergei Shtylyov
2019-02-25 18:21     ` Vignesh R
2019-02-25 19:33       ` Sergei Shtylyov
2019-02-26 10:26         ` Vignesh R
2019-02-26 11:08           ` Sergei Shtylyov
2019-02-26 11:00     ` Vignesh R
2019-02-25 18:26   ` Sergei Shtylyov
2019-02-26 18:16   ` Sergei Shtylyov
2019-02-27  9:52     ` Vignesh Raghavendra
2019-02-27  9:59       ` Boris Brezillon
2019-02-27 10:12         ` Vignesh Raghavendra [this message]
2019-02-19  6:36 ` [RFC PATCH 4/5] dt-bindings: mtd: Add bindings for TI's AM654 Hyperbus memory controller Vignesh R
2019-02-19  6:36 ` [RFC PATCH 5/5] mtd: hyperbus: Add driver for TI's " Vignesh R
2019-02-24 14:06   ` Sergei Shtylyov
2019-02-25 16:29   ` Sergei Shtylyov
2019-02-26 10:18     ` Vignesh R
2019-02-26 18:28   ` Sergei Shtylyov
2019-02-19  7:24 ` [RFC PATCH 0/5] MTD: Add Initial Hyperbus support Vignesh R
2019-02-19  7:52 ` Boris Brezillon

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=acde502c-63fb-e272-d701-4ee63eac4eaa@ti.com \
    --to=vigneshr@ti.com \
    --cc=arnd@arndb.de \
    --cc=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=nsekhar@ti.com \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=tudor.ambarus@microchip.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).