public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: John Crispin <john@phrozen.org>,
	computersforpeace@gmail.com, linux-mtd@lists.infradead.org,
	David.Woodhouse@intel.com
Subject: Re: [PATCH 0/6] MTD: xway: updates from OpenWrt/LEDE
Date: Tue, 7 Jun 2016 21:01:55 +0200	[thread overview]
Message-ID: <20160607210155.4a2a45ca@bbrezillon> (raw)
In-Reply-To: <2dc426aa-0591-490f-07b3-84e95396fcc0@hauke-m.de>

On Tue, 7 Jun 2016 19:36:15 +0200
Hauke Mehrtens <hauke@hauke-m.de> wrote:

> On 06/07/2016 12:12 PM, John Crispin wrote:
> > 
> > 
> > On 07/06/2016 11:48, Boris Brezillon wrote:  
> >> On Sun,  5 Jun 2016 23:20:03 +0200
> >> Hauke Mehrtens <hauke@hauke-m.de> wrote:
> >>  
> >>> These patches are in OpenWrt for years now and should go upstream. They 
> >>> are fixing some problems in the NAND driver.  
> >>
> >> Just had a closer look at the xway NAND controller driver, and it's
> >> just a big pile of hacks :-(. I'll take those patches if nobody is
> >> willing to maintain this driver, but honestly, I'd prefer a complete
> >> rework of the driver.
> >>  
> > 
> > Hi Boris,
> > 
> > it is indeed a horrific pile of doo doo. it has grown historically over
> > a few years and then became sort of abandoned. i have been keeping it
> > artificially alive inside openwrt as we have users with boards that have
> > nand. i dont even own a lantiq board with nand, so patches were sort of
> > merged on cruise control and with compile testing only.
> > 
> > the SoCs have 2 ways of controlling the nand core. the easy one is this,
> > which is basically nothing more than a nand flash aware 16bit
> > intel/hitachi bus interafec called EBU. There is a more advanced dma
> > based way of doing nand I/O though.
> > 
> > ideally there should be a driver for the so called "high speed nand"
> > interface which would allow us to nuke this one.  
> 
> Hi,
> 
> I want to look into other drivers first before looking into the DMA nand
> driver, it took me some time to understand how this driver works and the
> controller is strange and also this driver is strange. I was wondering
> how this went into mainline kernel. ;-)

I'm asking myself the same question, maybe the framework was not so 

> 
> I could/would send a patch which converts this from some hack to the
> generic platform driver to a normal platform driver, it will probably
> add ~50 lines of code, but makes it a lot easier to understand.

Yep, that would be a good start.

> 
> I will also try to make handling of the IO_ADDR_R look better with less
> casts.

Actually, I would get rid of ->IO_ADDR_X completely. and implement my
own set of ->read/write_buf() functions using a private __iomem pointer.

> 
> What else do you not like about this driver when we still use this
> hardware interface?

Well, the first thing would be to properly separate the controller and
chip concepts, and replacing all global variables by you own private
chip structure that would be dynamically allocated at probe time.

Also, I see that this driver is mixing platform specific initialization
[1] and driver implementation, but I guess this is part of your first
suggestion (moving to a real platform driver and getting rid of the
platform_nand abstraction layer).

Once you're there, you'll be able to add extra features, like DMA
support.

If you need an example, you can have a look at the sunxi_nand driver.

Regards,

Boris

[1]http://lxr.free-electrons.com/source/drivers/mtd/nand/xway_nand.c#L163


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2016-06-07 19:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-05 21:20 [PATCH 0/6] MTD: xway: updates from OpenWrt/LEDE Hauke Mehrtens
2016-06-05 21:20 ` [PATCH 1/6] MTD: xway: add some more documentation Hauke Mehrtens
2016-06-05 21:20 ` [PATCH 2/6] MTD: xway: fix invalid operator Hauke Mehrtens
2016-06-07  9:28   ` Boris Brezillon
2016-06-07 17:40     ` Hauke Mehrtens
2016-06-07 19:04       ` Boris Brezillon
2016-06-05 21:20 ` [PATCH 3/6] MTD: xway: the latched command should be persistent Hauke Mehrtens
2016-06-07  9:30   ` Boris Brezillon
2016-06-05 21:20 ` [PATCH 4/6] MTD: xway: remove endless loop Hauke Mehrtens
2016-06-05 21:20 ` [PATCH 5/6] MTD: xway: add missing write_buf and read_buf to nand driver Hauke Mehrtens
2016-06-07  9:34   ` Boris Brezillon
2016-06-05 21:20 ` [PATCH 6/6] MTD: xway: fix nand locking Hauke Mehrtens
2016-06-07  9:24 ` [PATCH 0/6] MTD: xway: updates from OpenWrt/LEDE Boris Brezillon
2016-06-07 17:37   ` Hauke Mehrtens
2016-06-07  9:48 ` Boris Brezillon
2016-06-07 10:12   ` John Crispin
2016-06-07 17:36     ` Hauke Mehrtens
2016-06-07 19:01       ` Boris Brezillon [this message]
2016-06-07 19:10         ` 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=20160607210155.4a2a45ca@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=David.Woodhouse@intel.com \
    --cc=computersforpeace@gmail.com \
    --cc=hauke@hauke-m.de \
    --cc=john@phrozen.org \
    --cc=linux-mtd@lists.infradead.org \
    /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