diff options
Diffstat (limited to 'target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch')
-rw-r--r-- | target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch b/target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch new file mode 100644 index 0000000000..34fd1b47ea --- /dev/null +++ b/target/linux/bcm47xx/patches-5.15/103-v5.18-mtd-rawnand-brcmnand-Move-OF-operations-out-of-brcmnand_init_cs.patch @@ -0,0 +1,63 @@ +From: Florian Fainelli <f.fainelli@gmail.com> +Subject: [PATCH v3 4/9] mtd: rawnand: brcmnand: Move OF operations out of brcmnand_init_cs() +Date: Fri, 07 Jan 2022 10:46:09 -0800 +Content-Type: text/plain; charset="utf-8" + +In order to initialize a given chip select object for use by the +brcmnand driver, move all of the Device Tree specific routines outside +of brcmnand_init_cs() in order to make it usable in a platform data +configuration which will be necessary for supporting BCMA chips. + +No functional changes introduced. + +Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> +--- + drivers/mtd/nand/raw/brcmnand/brcmnand.c | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c ++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c +@@ -2719,7 +2719,7 @@ static const struct nand_controller_ops + .attach_chip = brcmnand_attach_chip, + }; + +-static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn) ++static int brcmnand_init_cs(struct brcmnand_host *host) + { + struct brcmnand_controller *ctrl = host->ctrl; + struct device *dev = ctrl->dev; +@@ -2728,16 +2728,9 @@ static int brcmnand_init_cs(struct brcmn + int ret; + u16 cfg_offs; + +- ret = of_property_read_u32(dn, "reg", &host->cs); +- if (ret) { +- dev_err(dev, "can't get chip-select\n"); +- return -ENXIO; +- } +- + mtd = nand_to_mtd(&host->chip); + chip = &host->chip; + +- nand_set_flash_node(chip, dn); + nand_set_controller_data(chip, host); + mtd->name = devm_kasprintf(dev, GFP_KERNEL, "brcmnand.%d", + host->cs); +@@ -3144,7 +3137,16 @@ int brcmnand_probe(struct platform_devic + host->pdev = pdev; + host->ctrl = ctrl; + +- ret = brcmnand_init_cs(host, child); ++ ret = of_property_read_u32(child, "reg", &host->cs); ++ if (ret) { ++ dev_err(dev, "can't get chip-select\n"); ++ devm_kfree(dev, host); ++ continue; ++ } ++ ++ nand_set_flash_node(&host->chip, child); ++ ++ ret = brcmnand_init_cs(host); + if (ret) { + devm_kfree(dev, host); + continue; /* Try all chip-selects */ |