All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: devicetree-discuss@lists.ozlabs.org,
	linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 5/6 V2] atmel/nand: add DT support
Date: Tue, 07 Feb 2012 11:30:35 +0100	[thread overview]
Message-ID: <4F30FD4B.4050501@atmel.com> (raw)
In-Reply-To: <1328524512-18159-2-git-send-email-plagnioj@jcrosoft.com>

On 02/06/2012 11:35 AM, Jean-Christophe PLAGNIOL-VILLARD :
> use a local copy of board informatin and fill with DT data
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: devicetree-discuss@lists.ozlabs.org
> Cc: linux-mtd@lists.infradead.org

[..]

> +static int __devinit atmel_of_init_port(struct atmel_nand_host *host,
> +					 struct device_node *np)

Maybe you will need to protect this function in case of !DT builds: I
suspect that some of the of_xxxxx() calls are not provided if !CONFIG_OF.

> +{
> +	u32 val;
> +	int ecc_mode;
> +	struct atmel_nand_data *board = &host->board;
> +	enum of_gpio_flags flags;
> +
> +	if (of_property_read_u32(np, "atmel,nand-addr-offset", &val) == 0) {
> +		if (val >= 32) {
> +			dev_err(host->dev, "invalid addr-offset %u\n", val);
> +			return -EINVAL;
> +		}
> +		board->ale = val;
> +	}
> +
> +	if (of_property_read_u32(np, "atmel,nand-cmd-offset", &val) == 0) {
> +		if (val >= 32) {
> +			dev_err(host->dev, "invalid cmd-offset %u\n", val);
> +			return -EINVAL;
> +		}
> +		board->cle = val;
> +	}
> +
> +	ecc_mode = of_get_nand_ecc_mode(np);
> +
> +	board->ecc_mode = ecc_mode < 0 ? NAND_ECC_SOFT : ecc_mode;
> +
> +	board->on_flash_bbt = of_get_nand_on_flash_bbt(np);
> +
> +	if (of_get_nand_bus_width(np) == 16)
> +		board->bus_width_16 = 1;
> +
> +	board->rdy_pin = of_get_gpio_flags(np, 0, &flags);
> +	board->rdy_pin_active_low = (flags == OF_GPIO_ACTIVE_LOW);
> +
> +	board->enable_pin = of_get_gpio(np, 1);
> +	board->det_pin = of_get_gpio(np, 2);
> +
> +	return 0;
> +}
> +
>  /*
>   * Probe for the NAND device.
>   */
> @@ -479,6 +525,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
>  	struct nand_chip *nand_chip;
>  	struct resource *regs;
>  	struct resource *mem;
> +	struct mtd_part_parser_data ppdata = {};
>  	int res;
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -505,8 +552,15 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
>  
>  	mtd = &host->mtd;
>  	nand_chip = &host->nand_chip;
> -	host->board = pdev->dev.platform_data;
>  	host->dev = &pdev->dev;
> +	if (pdev->dev.of_node) {
> +		res = atmel_of_init_port(host, pdev->dev.of_node);

Called here: must compile with !CONFIG_OF

> +		if (res)
> +			goto err_nand_ioremap;
> +	} else {
> +		memcpy(&host->board, pdev->dev.platform_data,
> +		       sizeof(struct atmel_nand_data));
> +	}
>  
>  	nand_chip->priv = host;		/* link the private data structures */
>  	mtd->priv = nand_chip;

Best regards,
-- 
Nicolas Ferre

WARNING: multiple messages have this Message-ID (diff)
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/6 V2] atmel/nand: add DT support
Date: Tue, 07 Feb 2012 11:30:35 +0100	[thread overview]
Message-ID: <4F30FD4B.4050501@atmel.com> (raw)
In-Reply-To: <1328524512-18159-2-git-send-email-plagnioj@jcrosoft.com>

On 02/06/2012 11:35 AM, Jean-Christophe PLAGNIOL-VILLARD :
> use a local copy of board informatin and fill with DT data
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: devicetree-discuss at lists.ozlabs.org
> Cc: linux-mtd at lists.infradead.org

[..]

> +static int __devinit atmel_of_init_port(struct atmel_nand_host *host,
> +					 struct device_node *np)

Maybe you will need to protect this function in case of !DT builds: I
suspect that some of the of_xxxxx() calls are not provided if !CONFIG_OF.

> +{
> +	u32 val;
> +	int ecc_mode;
> +	struct atmel_nand_data *board = &host->board;
> +	enum of_gpio_flags flags;
> +
> +	if (of_property_read_u32(np, "atmel,nand-addr-offset", &val) == 0) {
> +		if (val >= 32) {
> +			dev_err(host->dev, "invalid addr-offset %u\n", val);
> +			return -EINVAL;
> +		}
> +		board->ale = val;
> +	}
> +
> +	if (of_property_read_u32(np, "atmel,nand-cmd-offset", &val) == 0) {
> +		if (val >= 32) {
> +			dev_err(host->dev, "invalid cmd-offset %u\n", val);
> +			return -EINVAL;
> +		}
> +		board->cle = val;
> +	}
> +
> +	ecc_mode = of_get_nand_ecc_mode(np);
> +
> +	board->ecc_mode = ecc_mode < 0 ? NAND_ECC_SOFT : ecc_mode;
> +
> +	board->on_flash_bbt = of_get_nand_on_flash_bbt(np);
> +
> +	if (of_get_nand_bus_width(np) == 16)
> +		board->bus_width_16 = 1;
> +
> +	board->rdy_pin = of_get_gpio_flags(np, 0, &flags);
> +	board->rdy_pin_active_low = (flags == OF_GPIO_ACTIVE_LOW);
> +
> +	board->enable_pin = of_get_gpio(np, 1);
> +	board->det_pin = of_get_gpio(np, 2);
> +
> +	return 0;
> +}
> +
>  /*
>   * Probe for the NAND device.
>   */
> @@ -479,6 +525,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
>  	struct nand_chip *nand_chip;
>  	struct resource *regs;
>  	struct resource *mem;
> +	struct mtd_part_parser_data ppdata = {};
>  	int res;
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -505,8 +552,15 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
>  
>  	mtd = &host->mtd;
>  	nand_chip = &host->nand_chip;
> -	host->board = pdev->dev.platform_data;
>  	host->dev = &pdev->dev;
> +	if (pdev->dev.of_node) {
> +		res = atmel_of_init_port(host, pdev->dev.of_node);

Called here: must compile with !CONFIG_OF

> +		if (res)
> +			goto err_nand_ioremap;
> +	} else {
> +		memcpy(&host->board, pdev->dev.platform_data,
> +		       sizeof(struct atmel_nand_data));
> +	}
>  
>  	nand_chip->priv = host;		/* link the private data structures */
>  	mtd->priv = nand_chip;

Best regards,
-- 
Nicolas Ferre

WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
To: Jean-Christophe PLAGNIOL-VILLARD
	<plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 5/6 V2] atmel/nand: add DT support
Date: Tue, 07 Feb 2012 11:30:35 +0100	[thread overview]
Message-ID: <4F30FD4B.4050501@atmel.com> (raw)
In-Reply-To: <1328524512-18159-2-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>

On 02/06/2012 11:35 AM, Jean-Christophe PLAGNIOL-VILLARD :
> use a local copy of board informatin and fill with DT data
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Cc: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> Cc: linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org

[..]

> +static int __devinit atmel_of_init_port(struct atmel_nand_host *host,
> +					 struct device_node *np)

Maybe you will need to protect this function in case of !DT builds: I
suspect that some of the of_xxxxx() calls are not provided if !CONFIG_OF.

> +{
> +	u32 val;
> +	int ecc_mode;
> +	struct atmel_nand_data *board = &host->board;
> +	enum of_gpio_flags flags;
> +
> +	if (of_property_read_u32(np, "atmel,nand-addr-offset", &val) == 0) {
> +		if (val >= 32) {
> +			dev_err(host->dev, "invalid addr-offset %u\n", val);
> +			return -EINVAL;
> +		}
> +		board->ale = val;
> +	}
> +
> +	if (of_property_read_u32(np, "atmel,nand-cmd-offset", &val) == 0) {
> +		if (val >= 32) {
> +			dev_err(host->dev, "invalid cmd-offset %u\n", val);
> +			return -EINVAL;
> +		}
> +		board->cle = val;
> +	}
> +
> +	ecc_mode = of_get_nand_ecc_mode(np);
> +
> +	board->ecc_mode = ecc_mode < 0 ? NAND_ECC_SOFT : ecc_mode;
> +
> +	board->on_flash_bbt = of_get_nand_on_flash_bbt(np);
> +
> +	if (of_get_nand_bus_width(np) == 16)
> +		board->bus_width_16 = 1;
> +
> +	board->rdy_pin = of_get_gpio_flags(np, 0, &flags);
> +	board->rdy_pin_active_low = (flags == OF_GPIO_ACTIVE_LOW);
> +
> +	board->enable_pin = of_get_gpio(np, 1);
> +	board->det_pin = of_get_gpio(np, 2);
> +
> +	return 0;
> +}
> +
>  /*
>   * Probe for the NAND device.
>   */
> @@ -479,6 +525,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
>  	struct nand_chip *nand_chip;
>  	struct resource *regs;
>  	struct resource *mem;
> +	struct mtd_part_parser_data ppdata = {};
>  	int res;
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -505,8 +552,15 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
>  
>  	mtd = &host->mtd;
>  	nand_chip = &host->nand_chip;
> -	host->board = pdev->dev.platform_data;
>  	host->dev = &pdev->dev;
> +	if (pdev->dev.of_node) {
> +		res = atmel_of_init_port(host, pdev->dev.of_node);

Called here: must compile with !CONFIG_OF

> +		if (res)
> +			goto err_nand_ioremap;
> +	} else {
> +		memcpy(&host->board, pdev->dev.platform_data,
> +		       sizeof(struct atmel_nand_data));
> +	}
>  
>  	nand_chip->priv = host;		/* link the private data structures */
>  	mtd->priv = nand_chip;

Best regards,
-- 
Nicolas Ferre

  reply	other threads:[~2012-02-07 10:30 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-28  5:10 [FOR 3.3 PATCH 1/6] ATMEL: fix nand ecc support Jean-Christophe PLAGNIOL-VILLARD
2012-01-28  5:10 ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-28  5:10 ` [FOR 3.3 PATCH 2/6] mtd/atmel_nand: add on_flash_bbt to enable the use of On Flash BBT Jean-Christophe PLAGNIOL-VILLARD
2012-01-28  5:10   ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-28  5:10 ` [FOR 3.3 PATCH 3/6] ARM: at91: enable on flash bbt for Atmel Reference and DT boards Jean-Christophe PLAGNIOL-VILLARD
2012-01-28  5:10 ` [FOR 3.4 PATCH 4/6] of/mtd/nand: add generic bindings and helpers Jean-Christophe PLAGNIOL-VILLARD
2012-01-28  5:10   ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-28 20:05   ` Grant Likely
2012-01-28 20:05     ` Grant Likely
2012-01-28  5:10 ` [FOR 3.4 PATCH 5/6] atmel/nand: add DT support Jean-Christophe PLAGNIOL-VILLARD
2012-01-28  5:10   ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-28 20:08   ` Grant Likely
2012-01-28 20:08     ` Grant Likely
2012-01-28 20:08     ` Grant Likely
2012-01-29 18:31   ` Simon Glass
2012-01-29 18:31     ` Simon Glass
2012-01-29 18:31     ` Simon Glass
2012-01-30  5:56     ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-30  5:56       ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-30  5:56       ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-28  5:10 ` [FOR 3.4 PATCH 6/6] ARM: at91: board-dt nand switch to DT Jean-Christophe PLAGNIOL-VILLARD
2012-02-06 10:35 ` [PATCH 4/6 V2] of/mtd/nand: add generic bindings and helpers Jean-Christophe PLAGNIOL-VILLARD
2012-02-06 10:35   ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-06 16:20   ` Stefan Roese
2012-02-06 16:20     ` Stefan Roese
2012-02-07  4:16     ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-07  4:16       ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-07  4:16       ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-07  9:45       ` Stefan Roese
2012-02-07  9:45         ` Stefan Roese
2012-02-07  9:45         ` Stefan Roese
2012-02-07 10:10         ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-07 10:10           ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-07 10:10           ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-07 16:18   ` [PATCH 4/6 v3] " Jean-Christophe PLAGNIOL-VILLARD
2012-02-07 16:18     ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-08  7:16     ` Stefan Roese
2012-02-08  7:16       ` Stefan Roese
2012-02-06 10:35 ` [PATCH 5/6 V2] atmel/nand: add DT support Jean-Christophe PLAGNIOL-VILLARD
2012-02-06 10:35   ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-07 10:30   ` Nicolas Ferre [this message]
2012-02-07 10:30     ` Nicolas Ferre
2012-02-07 10:30     ` Nicolas Ferre
2012-02-07 11:53     ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-07 11:53       ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-21  9:22       ` Nicolas Ferre
2012-02-21  9:22         ` Nicolas Ferre
2012-02-21  9:22         ` Nicolas Ferre
2012-02-21  9:32         ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-21  9:32           ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20 17:17   ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20 17:17     ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20 17:17     ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20 21:37     ` David Woodhouse
2012-02-20 21:37       ` David Woodhouse
2012-02-20 21:37       ` David Woodhouse
2012-02-21  9:46   ` [PATCH 5/6 V3] " Jean-Christophe PLAGNIOL-VILLARD
2012-02-21  9:46     ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-21  9:59     ` Nicolas Ferre
2012-02-21  9:59       ` Nicolas Ferre
2012-02-21  9:59       ` Nicolas Ferre
2012-02-21 11:00       ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-21 11:00         ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-21 11:00         ` Jean-Christophe PLAGNIOL-VILLARD

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=4F30FD4B.4050501@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=plagnioj@jcrosoft.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.