Re: [PATCH v4 2/2] mtd: mediatek: driver for MTK Smart Device Gen1 NAND

Jorge Ramirez
2016-05-10T18:14:39Z

On 05/10/2016 10:53 AM, Jorge Ramirez wrote:
> On 05/10/2016 08:13 AM, Boris Brezillon wrote:
>>> +
>>> >+void mtk_ecc_disable(struct mtk_ecc *ecc, struct mtk_ecc_config
>>> *config)
>> If you save the mode somewhere in mtk_ecc (or just write in both ENC
>> and DEC registers), you won't need this extra config arg here.
>
> ok.

actually as I was implementing this change (and it is a simple change to
do) I am not sure that it is a good idea to store the state of the
engine in the ecc_driver (ie: codec_x active sort of flag). And writing
to both set of registers looks ugly to me.

the way the nand driver is written, it is the nand driver the one that
controls the ecc engine 'states' (init, enable_x,disable_x). Why do we
want the ecc engine to remember that it was running the encoder or the
decoder? I think keeping the parameter in this function makes more
sense, that way the ecc driver itself completely stateless.

however let me see if there is a register I can poke to find out the
active codec (then I could remove the config parameter that you pointed
out without having to store state). I should be able to just read the
ECC control register to determine this.