Re: [RFC PATCH] mtd: rawnand: ams-delta: use ->exec_op()

From: Boris Brezillon
Date: Wed Oct 03 2018 - 10:06:41 EST


On Wed, 03 Oct 2018 15:55:25 +0200
Janusz Krzysztofik <jmkrzyszt@xxxxxxxxx> wrote:

> > >
> > > Implementation of NAND_OP_WAITRDY_INSTR has been based on legacy
> > > nand_wait_ready(),
> >
> > I don't remember what the ams-delta ->dev_ready()/->waitfunc() hooks
> > are doing, but is shouldn't be too hard to replace them by an
> > ams_delta_wait_ready() func.
>
> Default nand_wait() is used as ->waitfunc(), and ->dev_ready() returns R/B
> GPIO pin status.

Okay. Then it might make sense to provide a generic helper to poll a
gpio.

void nand_gpio_waitrdy(struct nand_chip *chip, struct gpio_desc *gpiod)
{
...
}

>
> > > otherwise that function would probabaly have to be
> >
> > ^ probably
>
> Do you think other drivers which now provide ->dev_ready() won't require
> reimplementation of nand_wait_ready()?

It depends. I mean, most controllers support native R/B sensing, and in
case they do actually require you to poll the RB pin status, duplicating
the wait_ready() logic shouldn't be a problem. On the other hand, I
really want to get rid of ->dev_ready().