[OpenWrt-Devel] [PATCH] ath79: fix NAND driver compilation for kernel 5.4
David Bauer
mail at david-bauer.net
Sun Mar 22 15:01:57 EDT 2020
Hi Michal
On 3/22/20 12:35 PM, Michal Cieslakiewicz wrote:
> On Tue, 17 Mar 2020 21:59:27 +0100
> David Bauer <mail at david-bauer.net> wrote:
>
>> This fixes the compilation of the AR934x NAND controller
>> driver for kernel 5.4 while leaving it untouched for
>> kernel 4.19.
>>
>> This change is currently not run-tested, as i do not have such
>> a device at hand.
>>
>
> Hello David,
>
> Good news, Netgear WNDR4300 runs fine on kernel 5.4 with this patch
> applied.
Great to hear!
>
> Tested-by: Michal Cieslakiewicz <michal.cieslakiewicz at wp.pl>
>
> I would also propose to mitigate two compilation warnings by
> introducing a return value here (by integrating into your patch):
I was thinking about the same, but i would like to have this patch touch as little 4.19
code as possible. However, i will look into fixing this in a seperate patch (in case you
are not faster than me) ;)
>
> =========
> diff --git a/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c b/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c
> index 70aa396e25..0e33b07146 100644
> --- a/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c
> +++ b/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c
> @@ -1082,14 +1082,24 @@ static int ar934x_nfc_write_page(struct nand_chip *chip,
> return err;
> }
>
> -static int ar934x_nfc_hw_reset_assert(struct ar934x_nfc *nfc) {
> - reset_control_assert(nfc->rst);
> +static int ar934x_nfc_hw_reset_assert(struct ar934x_nfc *nfc)
> +{
> + int err;
> +
> + err = reset_control_assert(nfc->rst);
> udelay(250);
> +
> + return err;
> }
>
> -static int ar934x_nfc_hw_reset_deassert(struct ar934x_nfc *nfc) {
> - reset_control_deassert(nfc->rst);
> +static int ar934x_nfc_hw_reset_deassert(struct ar934x_nfc *nfc)
> +{
> + int err;
> +
> + err = reset_control_deassert(nfc->rst);
> udelay(250);
> +
> + return err;
> }
>
> static int ar934x_nfc_hw_init(struct ar934x_nfc *nfc)
> =========
>
> And finally, an important information:
>
> Enabling 5.4 for this device exposes a mtd concat issue unrelated
> to ar934x-nand driver, apparently affecting all routers that use
> concatenation of flash areas to form one larger volume for ubi.
> This appears to be a generic 5.x kernel problem not introduced by
> OpenWrt in any way.
>
> The quick and dirty solution that worked for me was reverting kernel
> patch:
>
> commit 2431c4f5b46c32c4ac495456b1ef4ce59c0bb85d
> Author: Boris Brezillon <bbrezillon at kernel.org>
> Date: Thu Dec 20 15:13:20 2018 +0100
>
> mtd: Implement mtd_{read,write}() as wrappers around
> mtd_{read,write}_oob()
>
> mtd_{read,write}_oob() already take care of checking the params and
> calling ->_{read,write}() or ->_{read,write}_oob() based on the
> request and the operations supported by the MTD device.
> No need to duplicate the logic, we can simply implement
> mtd_{read,write}() as wrappers around mtd_{read,write}_oob().
>
> Above commit makes router to oops on WARN_ON canary and exit with error
> when creating mtd concat, entering boot loop. Without it my WNDR4300 runs
> fine so far.
I'm not that deep into the mtd-concat hack (expecially on NAND flash). We might also run
into issues when migrating to the new NAND interface. If you you've found a fix for
this, it would be great to have it up for discussion on ML or GitHub. Especially as this
is more or less target independant and not directly associated with the ath79 driver.
Best wishes
David
>
> Best regards
> Michal
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list