[PATCH 1/2] mtd: nand: add generic helpers to check, match, maximize ECC settings
Boris Brezillon
boris.brezillon at free-electrons.com
Thu May 18 00:09:57 PDT 2017
On Thu, 18 May 2017 15:27:11 +0900
Masahiro Yamada <yamada.masahiro at socionext.com> wrote:
> Hi Boris,
>
>
>
> 2017-05-15 20:54 GMT+09:00 Boris Brezillon <boris.brezillon at free-electrons.com>:
> > Hi Masahiro,
> >
> > Sorry for the late reply.
> >
> > On Mon, 8 May 2017 12:40:47 +0900
> > Masahiro Yamada <yamada.masahiro at socionext.com> wrote:
> >
> >> Hi Boris,
> >>
> >>
> >> 2017-04-29 1:32 GMT+09:00 Boris Brezillon <boris.brezillon at free-electrons.com>:
> >>
> >> >> + for (setting = caps->ecc_settings; setting->step; setting++) {
> >> >> + /* If chip->ecc.size is already set, respect it. */
> >> >> + if (chip->ecc.size && setting->step != chip->ecc.size)
> >> >> + continue;
> >> >> +
> >> >> + /* If chip->ecc.strength is already set, respect it. */
> >> >> + if (chip->ecc.strength &&
> >> >> + setting->strength != chip->ecc.strength)
> >> >> + continue;
> >> >
> >> > Hm, I don't get it. If chip->ecc.strength and chip->ecc.size are
> >> > explicitly set, you should just call nand_check_ecc_caps() and skip
> >> > nand_try_to_match_ecc_req(). Why would you call
> >> > nand_try_to_match_ecc_req() in this case?
> >>
> >>
> >> I want to call this function if
> >> ecc.size is specified but ecc.strength is not
> >> (or vice versa).
> >
> > That's not a valid combination. I accepted the case where
> > nand-ecc-step-size is not defined in the DT just because sometime you
> > only have one possible setting which is imposed by the controller. In
> > this case ecc.size should be explicitly set by the driver not left to 0.
> >
> >>
> >>
> >> If both ecc.size and ecc.strength are already specified,
> >> you are right, no need to call this function.
> >> This function can check the sanity of the specified
> >> combination of (step, strength), but this is the same
> >> as what nand_check_ecc_caps() does.
>
>
> I am working on the next version because I really need to
> merge all of my Denali controller patches for my SoCs.
Okay.
>
>
> One question about this part.
>
>
> /* If chip->ecc.size is already set, respect it. */
> if (chip->ecc.size && step_size != chip->ecc.size)
> continue;
>
> Does this make sense for nand_try_to_maximize_ecc()?
>
> (In other words, can nand-ecc-maximize stand together with nand-ecc-step-size?)
It could make sense if one wants to maximize the strength for a
specific step-size, but most of the time the user will let the driver
choose the best step-size+strength pair.
More information about the linux-mtd
mailing list