From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-mtd@lists.infradead.org, "Rafał Miłecki" <zajec5@gmail.com>,
"Richard Weinberger" <richard@nod.at>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
"Brian Norris" <computersforpeace@gmail.com>,
"Kamal Dasu" <kdasu.kdev@gmail.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Cai Huoqing" <caihuoqing@baidu.com>,
"Colin Ian King" <colin.king@intel.com>,
linux-kernel@vger.kernel.org (open list),
linux-wireless@vger.kernel.org (open list:BROADCOM SPECIFIC AMBA
DRIVER (BCMA)),
bcm-kernel-feedback-list@broadcom.com (open list:BROADCOM STB
NAND FLASH DRIVER)
Subject: Re: [PATCH 4/9] mtd: rawnand: brcmnand: Move OF operations out of brcmnand_init_cs()
Date: Mon, 3 Jan 2022 17:56:06 +0100 [thread overview]
Message-ID: <20220103175606.71a4eb93@xps13> (raw)
In-Reply-To: <20211223002225.3738385-5-f.fainelli@gmail.com>
Hi Florian,
f.fainelli@gmail.com wrote on Wed, 22 Dec 2021 16:22:20 -0800:
> 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.
TBH I'm note a big fan of the idea. I'm not sure going back to
supporting platform data this way really is a good idea... There are so
much things that are well described with DT that we now rely upon that
I am not entirely convinced by these changes :-/ The move is generally
in the other direction: getting rid of the legacy platform data.
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Cheers,
Miquèl
> ---
> drivers/mtd/nand/raw/brcmnand/brcmnand.c | 20 +++++++++++---------
> 1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> index 35f8d8e02d4a..60a7f375df83 100644
> --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> @@ -2760,7 +2760,7 @@ static const struct nand_controller_ops brcmnand_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;
> @@ -2769,16 +2769,9 @@ static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn)
> 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);
> @@ -3179,7 +3172,16 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)
> host->pdev = pdev;
> host->ctrl = ctrl;
>
> - ret = brcmnand_init_cs(host, child);
> + ret = of_property_read_u32(dn, "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, dn);
> +
> + ret = brcmnand_init_cs(host);
> if (ret) {
> devm_kfree(dev, host);
> continue; /* Try all chip-selects */
next prev parent reply other threads:[~2022-01-03 16:56 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-23 0:22 [PATCH 0/9] BCMA support for brcmnand Florian Fainelli
2021-12-23 0:22 ` [PATCH 1/9] mtd: rawnand: brcmnand: Allow SoC to provide I/O operations Florian Fainelli
2022-01-03 16:49 ` Miquel Raynal
2022-01-03 17:24 ` Florian Fainelli
2022-01-04 8:32 ` Miquel Raynal
2022-01-04 8:57 ` Miquel Raynal
2022-01-04 18:34 ` Florian Fainelli
2022-01-04 18:37 ` Miquel Raynal
2021-12-23 0:22 ` [PATCH 2/9] mtd: rawnand: brcmnand: Assign soc as early as possible Florian Fainelli
2021-12-23 0:22 ` [PATCH 3/9] mtd: rawnand: brcmnand: Avoid pdev in brcmnand_init_cs() Florian Fainelli
2021-12-23 0:22 ` [PATCH 4/9] mtd: rawnand: brcmnand: Move OF operations out of brcmnand_init_cs() Florian Fainelli
2022-01-03 16:56 ` Miquel Raynal [this message]
2022-01-03 17:27 ` Florian Fainelli
2022-01-04 8:30 ` Miquel Raynal
2021-12-23 0:22 ` [PATCH 5/9] mtd: rawnand: brcmnand: Allow working without interrupts Florian Fainelli
2021-12-25 17:45 ` Andy Shevchenko
2021-12-27 17:05 ` Florian Fainelli
2021-12-23 0:22 ` [PATCH 6/9] mtd: rawnand: brcmnand: Add platform data structure for BCMA Florian Fainelli
2021-12-23 0:22 ` [PATCH 7/9] mtd: rawnand: brcmnand: Allow platform data instantation Florian Fainelli
2021-12-23 0:22 ` [PATCH 8/9] mtd: rawnand: brcmnand: BCMA controller uses command shift of 0 Florian Fainelli
2021-12-23 0:22 ` [PATCH 9/9] mtd: rawnand: brcmnand: Add BCMA shim Florian Fainelli
2022-01-03 17:06 ` Miquel Raynal
2022-01-03 17:28 ` Florian Fainelli
2022-01-03 17:12 ` Miquel Raynal
2022-01-03 17:28 ` Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220103175606.71a4eb93@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=arnd@arndb.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=caihuoqing@baidu.com \
--cc=colin.king@intel.com \
--cc=computersforpeace@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=kdasu.kdev@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).