1 From: Florian Fainelli <f.fainelli@gmail.com>
2 Subject: [PATCH v3 4/9] mtd: rawnand: brcmnand: Move OF operations out of brcmnand_init_cs()
3 Date: Fri, 07 Jan 2022 10:46:09 -0800
4 Content-Type: text/plain; charset="utf-8"
6 In order to initialize a given chip select object for use by the
7 brcmnand driver, move all of the Device Tree specific routines outside
8 of brcmnand_init_cs() in order to make it usable in a platform data
9 configuration which will be necessary for supporting BCMA chips.
11 No functional changes introduced.
13 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
15 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 20 +++++++++++---------
16 1 file changed, 11 insertions(+), 9 deletions(-)
18 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
19 +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
20 @@ -2719,7 +2719,7 @@ static const struct nand_controller_ops
21 .attach_chip = brcmnand_attach_chip,
24 -static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn)
25 +static int brcmnand_init_cs(struct brcmnand_host *host)
27 struct brcmnand_controller *ctrl = host->ctrl;
28 struct device *dev = ctrl->dev;
29 @@ -2728,16 +2728,9 @@ static int brcmnand_init_cs(struct brcmn
33 - ret = of_property_read_u32(dn, "reg", &host->cs);
35 - dev_err(dev, "can't get chip-select\n");
39 mtd = nand_to_mtd(&host->chip);
42 - nand_set_flash_node(chip, dn);
43 nand_set_controller_data(chip, host);
44 mtd->name = devm_kasprintf(dev, GFP_KERNEL, "brcmnand.%d",
46 @@ -3144,7 +3137,16 @@ int brcmnand_probe(struct platform_devic
50 - ret = brcmnand_init_cs(host, child);
51 + ret = of_property_read_u32(child, "reg", &host->cs);
53 + dev_err(dev, "can't get chip-select\n");
54 + devm_kfree(dev, host);
58 + nand_set_flash_node(&host->chip, child);
60 + ret = brcmnand_init_cs(host);
62 devm_kfree(dev, host);
63 continue; /* Try all chip-selects */