All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mason <slash.tmp@free.fr>
To: Steve deRosier <derosier@gmail.com>
Cc: linux-mtd <linux-mtd@lists.infradead.org>,
	Sebastian Frias <sf84@laposte.net>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: Using a generic upstream driver with a custom NAND controller
Date: Thu, 21 Jan 2016 15:05:19 +0100	[thread overview]
Message-ID: <56A0E59F.4090602@free.fr> (raw)
In-Reply-To: <CALupW3A8Wz72enL3Gqpx0=HdOQW0DqQtfVLUQmF=NeyoySn_aQ@mail.gmail.com>

On 19/01/2016 22:15, Steve deRosier wrote:

> Mason wrote:
>
>> Is there some generic driver upstream that I could try to see if
>> it works with this controller?
>>
>> Note: the SoC is using these chips:
>> nand: Micron NAND 512MiB 3,3V 8-bit
>> nand: 512MiB, SLC, page size: 2048, OOB size: 64
> 
> That's a common chip configuration. Calling out the chip ID
> specifically might also be of some help.

<confused> IIUC, /which NAND chips/ are connected to the
controller is not really relevant. What kind of info would
the chip ID give me?

> What you have to do is enable
> the driver for your NAND controller, the NAND chip isn't that
> relevant. Nearly every mainline SoC or processor would have a driver.

Note: the SoC isn't mainline yet as I'm the one trying to
make that happen (I work for the SoC manufacturer BTW).

The problem is that all our drivers were written in the
2.6.x era, and porting them to 4.4 is really involved
because

1) the APIs have often significantly changed (this is an issue
for all out-of-tree drivers)

2) the coders in my company will often pick the quick and dirty
solution, which often means altering core files, instead of
using registration APIs, custom call-backs, or what-have-you.

The result is that I get a deluge of conflicts just rebasing
the driver, and that's even before I get to the API issues.

> If it's truly custom, then in my opinion, you're going to need to
> write a driver. Though it should be provided to you by your SoC
> vendor. Shame on them for not building the driver right and
> upstreaming it.

(Maybe you can help me find convincing arguments why upstreaming
is good. The logic around here is "the hardware is custom, no one
will benefit from having the driver, no point in sharing".)

Anyway, I may not have been clear about this, but there /is/
a driver for this custom controller (it's not an IP block from
a third-party vendor). The driver works with the 3.4 kernel.

In my original message, I provided the diff between vanilla
3.4 and our custom 3.4 (for the drivers/mtd directory).

 drivers/mtd/Kconfig                                            |    3 +-
 drivers/mtd/chips/cfi_cmdset_0002.c                            |  127 ++-
 drivers/mtd/devices/m25p80.c                                   |  100 +-
 drivers/mtd/maps/Kconfig                                       |   11 +-
 drivers/mtd/maps/physmap.c                                     |  195 ++++
 drivers/mtd/mtdchar.c                                          |   54 ++
 drivers/mtd/nand/Kconfig                                       |    8 +
 drivers/mtd/nand/Makefile                                      |    1 +
 drivers/mtd/nand/nand_base.c                                   |    6 +-
 drivers/mtd/nand/nand_ids.c                                    |   18 +
 drivers/mtd/nand/foobar_nand.c                                 | 1903 ++++++++++++++++++++

So foobar_nand.c is the NAND driver for this SoC.
The problem comes from the modifications "around" the driver,
in the "core" source files.

I guess I could make a zero-order approximation that
all these changes are unnecessary, and just port the
main driver code. But I have a feeling that won't work.

> Odds are they didn't create one from scratch however. That would be
> truly strange. Likely they took a stock one and made some custom
> changes. You might be able to ask what it was based on and make
> changes to the base driver.

That's a good idea. Although I fear it was indeed written
from scratch, since the controller is custom-made.

Anyway, I'm open to comments and suggestions about this issue.
I'm sure a lot of you have had to deal with these situations.

Regards.

  reply	other threads:[~2016-01-21 14:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19 19:30 Using a generic upstream driver with a custom NAND controller Mason
2016-01-19 21:15 ` Steve deRosier
2016-01-21 14:05   ` Mason [this message]
2016-01-21 14:12     ` David Woodhouse
2016-01-21 14:44       ` Mason
2016-01-22  9:29     ` Ricard Wanderlof

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=56A0E59F.4090602@free.fr \
    --to=slash.tmp@free.fr \
    --cc=computersforpeace@gmail.com \
    --cc=derosier@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=sf84@laposte.net \
    /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.