On 2/4/2022 2:45 PM, Florian Fainelli wrote:


On 2/4/2022 2:34 PM, Daniel González Cabanelas wrote:
El vie, 4 feb 2022 a las 23:02, Florian Fainelli
(<f.faine...@gmail.com>) escribió:



On 2/4/2022 11:21 AM, Álvaro Fernández Rojas wrote:
So the problem is that SET_FEATURES and GET_FEATURES isn’t supported by versions 2.1, 2.2 and 4.0 of the nand controller, which are the ones present on bcm63xx, right?

Yes, I suspect this is the problem since I do not see CMD_LOW_LEVEL_OP
being defined in the register database for the controllers v2.1 and
v2.2, v3.3. Staring with v4.0, the controllers do have the
CMD_LOW_LEVEL_OP. This is the version/feature table that I could
programmatically compile:

version: 0.1, ll: no
version: 1.0, ll: no
version: 2.0, ll: no
version: 2.1, ll: no
version: 2.2, ll: no
version: 3.0, ll: no
version: 3.2, ll: no
version: 3.3, ll: no
version: 3.4, ll: no
version: 4.0, ll: yes
version: 5.0, ll: yes
version: 6.0, ll: yes
version: 6.2, ll: yes
version: 7.0, ll: yes
version: 7.1, ll: yes
version: 7.2, ll: yes
version: 7.3, ll: yes

How about this patch, does it work better?

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index f75929783b94..06ac593beec0 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -1727,6 +1727,8 @@ static void brcmnand_cmdfunc(struct nand_chip
*chip, unsigned command,
                  break;
          case NAND_CMD_SET_FEATURES:
          case NAND_CMD_GET_FEATURES:
+               if (ctrl->nand_version < 0x0400)
+                       break;
                  brcmnand_low_level_op(host, LL_OP_CMD, command, false);                   brcmnand_low_level_op(host, LL_OP_ADDR, column, false);
                  break;

--
Florian

No, it didn't help:

OK, last tentative and then I think you should report this to linux-mtd such that the MTD maintainers may suggest whether we are missing something obvious here:

scratch that, can you try this instead:

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index f75929783b94..f49ef76bc2b8 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -1651,6 +1651,9 @@ static int brcmnand_low_level_op(struct brcmnand_host *host,
        struct brcmnand_controller *ctrl = host->ctrl;
        u32 tmp;

+       if (ctrl->nand_version < 0x0400)
+               return -EOPNOTSUPP;
+
        tmp = data & LLOP_DATA_MASK;
        switch (type) {
        case LL_OP_CMD:
@@ -1829,7 +1832,9 @@ static uint8_t brcmnand_read_byte(struct nand_chip *chip)
                } else {
                        bool last = host->last_byte ==
                                ONFI_SUBFEATURE_PARAM_LEN - 1;
-                       brcmnand_low_level_op(host, LL_OP_RD, 0, last);
+ ret = brcmnand_low_level_op(host, LL_OP_RD, 0, last);
+                       if (ret == -EOPNOTSUPP)
+                               return ret;
ret = brcmnand_read_reg(ctrl, BRCMNAND_LL_RDATA) & 0xff;
                }
        }


--
Florian

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to