mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Jonathan Bakker <xc-racer2@live.ca>,
	Miquel Raynal <miquel.raynal@bootlin.com>
Cc: "Kyungmin Park" <kyungmin.park@samsung.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org,
	"Tomasz Figa" <tomasz.figa@gmail.com>,
	"Paweł Chmiel" <pawel.mikolaj.chmiel@gmail.com>
Subject: Re: [PATCH 5/5] mtd: onenand: samsung: Add device tree support
Date: Sun, 24 Apr 2022 13:12:01 +0200	[thread overview]
Message-ID: <70db8ad7-ba2e-ac08-492c-b2117c3235e5@linaro.org> (raw)
In-Reply-To: <CY4PR04MB056716B2AE01D243F6AE3C13CBF69@CY4PR04MB0567.namprd04.prod.outlook.com>

On 23/04/2022 05:46, Jonathan Bakker wrote:
> From: Tomasz Figa <tomasz.figa@gmail.com>
> 
> This patch adds support for instantation using Device Tree.
> 
> Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
> Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> 
> ---
> Changes from previous patchset
> - Adjust to having a nand child node as per binding feedback
> ---
>  drivers/mtd/nand/onenand/onenand_samsung.c | 67 +++++++++++++++++++++-
>  1 file changed, 65 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/onenand/onenand_samsung.c b/drivers/mtd/nand/onenand/onenand_samsung.c
> index 62014f8d27b6..0108c8c75d5b 100644
> --- a/drivers/mtd/nand/onenand/onenand_samsung.c
> +++ b/drivers/mtd/nand/onenand/onenand_samsung.c
> @@ -22,6 +22,7 @@
>  #include <linux/dma-mapping.h>
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
> +#include <linux/of.h>
>  
>  #include "samsung.h"
>  
> @@ -832,8 +833,36 @@ static void s3c_onenand_setup(struct mtd_info *mtd)
>  	this->write_bufferram = onenand_write_bufferram;
>  }
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id s3c_onenand_of_match[] = {
> +	{ .compatible = "samsung,s3c6400-onenand",
> +		.data = (void *)TYPE_S3C6400 },
> +	{ .compatible = "samsung,s3c6410-onenand",
> +		.data = (void *)TYPE_S3C6410 },
> +	{ .compatible = "samsung,s5pv210-onenand",
> +		.data = (void *)TYPE_S5PC110 },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, onenand_s3c_dt_match);
> +#endif
> +
> +static enum soc_type s3c_onenand_get_device_id(struct platform_device *pdev)
> +{
> +	struct device_node *np = pdev->dev.of_node;
> +
> +	if (IS_ENABLED(CONFIG_OF) && np) {
> +		const struct of_device_id *match;
> +
> +		match = of_match_node(s3c_onenand_of_match, np);
> +		return (enum soc_type)match->data;
> +	}

This can be simpler:

if (dev_of_node(&pdev->dev))
	return of_device_get_match_data(&pdev->dev);

This allows you to put the of_device_id table in usual place, so just
before the platform_driver structure.

> +
> +	return platform_get_device_id(pdev)->driver_data;
> +}
> +
>  static int s3c_onenand_probe(struct platform_device *pdev)
>  {
> +	struct device_node *np = pdev->dev.of_node;

dev_of_node()


Best regards,
Krzysztof

      reply	other threads:[~2022-04-24 11:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220423034524.366612-1-xc-racer2@live.ca>
2022-04-23  3:46 ` [PATCH 2/5] mtd: onenand: samsung: Set name field of mtd_info struct Jonathan Bakker
     [not found] ` <20220423034622.366696-1-xc-racer2@live.ca>
2022-04-23  3:46   ` [PATCH 3/5] mtd: onenand: samsung: Unify resource order for controller variants Jonathan Bakker
2022-04-24 11:05     ` Krzysztof Kozlowski
2022-04-23  3:46   ` [PATCH 4/5] mtd: onenand: samsung: Make sure that bus clock is enabled Jonathan Bakker
2022-04-24 11:06     ` Krzysztof Kozlowski
2022-04-23  3:46   ` [PATCH 5/5] mtd: onenand: samsung: Add device tree support Jonathan Bakker
2022-04-24 11:12     ` Krzysztof Kozlowski [this message]

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=70db8ad7-ba2e-ac08-492c-b2117c3235e5@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=pawel.mikolaj.chmiel@gmail.com \
    --cc=richard@nod.at \
    --cc=tomasz.figa@gmail.com \
    --cc=vigneshr@ti.com \
    --cc=xc-racer2@live.ca \
    /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

all inboxes | Powered by JetHome®