Skip to content

Commit 75ac944

Browse files
ffainellimiquelraynal
authored andcommitted
mtd: rawnand: brcmnand: Move OF operations out of brcmnand_init_cs()
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 <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent c0d08a1 commit 75ac944

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

drivers/mtd/nand/raw/brcmnand/brcmnand.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,7 +2768,7 @@ static const struct nand_controller_ops brcmnand_controller_ops = {
27682768
.attach_chip = brcmnand_attach_chip,
27692769
};
27702770

2771-
static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn)
2771+
static int brcmnand_init_cs(struct brcmnand_host *host)
27722772
{
27732773
struct brcmnand_controller *ctrl = host->ctrl;
27742774
struct device *dev = ctrl->dev;
@@ -2777,16 +2777,9 @@ static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn)
27772777
int ret;
27782778
u16 cfg_offs;
27792779

2780-
ret = of_property_read_u32(dn, "reg", &host->cs);
2781-
if (ret) {
2782-
dev_err(dev, "can't get chip-select\n");
2783-
return -ENXIO;
2784-
}
2785-
27862780
mtd = nand_to_mtd(&host->chip);
27872781
chip = &host->chip;
27882782

2789-
nand_set_flash_node(chip, dn);
27902783
nand_set_controller_data(chip, host);
27912784
mtd->name = devm_kasprintf(dev, GFP_KERNEL, "brcmnand.%d",
27922785
host->cs);
@@ -3193,7 +3186,16 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)
31933186
host->pdev = pdev;
31943187
host->ctrl = ctrl;
31953188

3196-
ret = brcmnand_init_cs(host, child);
3189+
ret = of_property_read_u32(child, "reg", &host->cs);
3190+
if (ret) {
3191+
dev_err(dev, "can't get chip-select\n");
3192+
devm_kfree(dev, host);
3193+
continue;
3194+
}
3195+
3196+
nand_set_flash_node(&host->chip, child);
3197+
3198+
ret = brcmnand_init_cs(host);
31973199
if (ret) {
31983200
devm_kfree(dev, host);
31993201
continue; /* Try all chip-selects */

0 commit comments

Comments
 (0)