All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dragos Carp <dragos.carp-+ybMorV4k0dBDgjK7y7TUQ@public.gmane.org>
To: Domen Puncer <domen-CvScVCPLwOZg9hUCZPvPmw@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	David Brownell
	<dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	linuxppc-embedded-mnsaURCQ41sdnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH] mpc52xx_psc_spi: fix it for CONFIG_PPC_MERGE
Date: Mon, 21 May 2007 09:31:18 +0200	[thread overview]
Message-ID: <46514AC6.8080704@toptica.com> (raw)
In-Reply-To: <20070516073707.GD9667-yTFm/CsSGdPT0JcTxXCzFdi2O/JbrIOy@public.gmane.org>

Acked-by: Dragos Carp <dragos.carp-+ybMorV4k0dBDgjK7y7TUQ@public.gmane.org>

Domen Puncer wrote:
> Fix mpc5200 PSC SPI driver to actually work for CONFIG_PPC_MERGE
> - s/mpc52xx/mpc5200/, as this was changed in device tree some time ago
> - fix spi id detection
>
>
> Signed-off-by: Domen Puncer <domen.puncer-P35k8AZwkyRBDgjK7y7TUQ@public.gmane.org>
>
> ---
>  drivers/spi/mpc52xx_psc_spi.c |   25 +++++++++++--------------
>  1 file changed, 11 insertions(+), 14 deletions(-)
>
> Index: work-powerpc.git/drivers/spi/mpc52xx_psc_spi.c
> ===================================================================
> --- work-powerpc.git.orig/drivers/spi/mpc52xx_psc_spi.c
> +++ work-powerpc.git/drivers/spi/mpc52xx_psc_spi.c
> @@ -329,8 +329,8 @@ static int mpc52xx_psc_spi_port_config(i
>  	int ret = 0;
>  
>  #if defined(CONFIG_PPC_MERGE)
> -	cdm = mpc52xx_find_and_map("mpc52xx-cdm");
> -	gpio = mpc52xx_find_and_map("mpc52xx-gpio");
> +	cdm = mpc52xx_find_and_map("mpc5200-cdm");
> +	gpio = mpc52xx_find_and_map("mpc5200-gpio");
>  #else
>  	cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
>  	gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
> @@ -445,9 +445,6 @@ static int __init mpc52xx_psc_spi_do_pro
>  	struct spi_master *master;
>  	int ret;
>  
> -	if (pdata == NULL)
> -		return -ENODEV;
> -
>  	master = spi_alloc_master(dev, sizeof *mps);
>  	if (master == NULL)
>  		return -ENOMEM;
> @@ -594,17 +591,17 @@ static int __init mpc52xx_psc_spi_of_pro
>  	}
>  	regaddr64 = of_translate_address(op->node, regaddr_p);
>  
> +	/* get PSC id (1..6, used by port_config) */
>  	if (op->dev.platform_data == NULL) {
> -		struct device_node *np;
> -		int i = 0;
> +		const u32 *psc_nump;
>  
> -		for_each_node_by_type(np, "spi") {
> -			if (of_find_device_by_node(np) == op) {
> -				id = i;
> -				break;
> -			}
> -			i++;
> +		psc_nump = of_get_property(op->node, "cell-index", NULL);
> +		if (!psc_nump || *psc_nump > 5) {
> +			printk(KERN_ERR "mpc52xx_psc_spi: Device node %s has invalid "
> +					"cell-index property\n", op->node->full_name);
> +			return -EINVAL;
>  		}
> +		id = *psc_nump + 1;
>  	}
>  
>  	return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64,
> @@ -617,7 +614,7 @@ static int __exit mpc52xx_psc_spi_of_rem
>  }
>  
>  static struct of_device_id mpc52xx_psc_spi_of_match[] = {
> -	{ .type = "spi", .compatible = "mpc52xx-psc-spi", },
> +	{ .type = "spi", .compatible = "mpc5200-psc-spi", },
>  	{},
>  };
>  
>
>
>   


-- 

Dragos Carp
Research & Development

Phone: +49 89 85837-159, Fax: +49 89 85837-200
Address: TOPTICA Photonics AG, Lochhamer Schlag 19, D-82166 Graefelfing, Germany

TOPTICA – A Passion for Precision
TOPTICA Photonics AG, Registered Office: 82166 Graefelfing, Germany
Companies' Register: Amtsgericht München, HRB 137368
Executive Directors: Dr. Wilhelm Kaenders, Dr. Thomas Weber
Chairman of the Supervisory Board: Dr. Kristian Hohla
www.toptica.com


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

WARNING: multiple messages have this Message-ID (diff)
From: Dragos Carp <dragos.carp@toptica.com>
To: Domen Puncer <domen@coderock.org>
Cc: spi-devel-general@lists.sourceforge.net,
	David Brownell <dbrownell@users.sourceforge.net>,
	linuxppc-embedded@ozlabs.org
Subject: Re: [PATCH] mpc52xx_psc_spi: fix it for CONFIG_PPC_MERGE
Date: Mon, 21 May 2007 09:31:18 +0200	[thread overview]
Message-ID: <46514AC6.8080704@toptica.com> (raw)
In-Reply-To: <20070516073707.GD9667@nd47.coderock.org>

Acked-by: Dragos Carp <dragos.carp@toptica.com>

Domen Puncer wrote:
> Fix mpc5200 PSC SPI driver to actually work for CONFIG_PPC_MERGE
> - s/mpc52xx/mpc5200/, as this was changed in device tree some time ago
> - fix spi id detection
>
>
> Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
>
> ---
>  drivers/spi/mpc52xx_psc_spi.c |   25 +++++++++++--------------
>  1 file changed, 11 insertions(+), 14 deletions(-)
>
> Index: work-powerpc.git/drivers/spi/mpc52xx_psc_spi.c
> ===================================================================
> --- work-powerpc.git.orig/drivers/spi/mpc52xx_psc_spi.c
> +++ work-powerpc.git/drivers/spi/mpc52xx_psc_spi.c
> @@ -329,8 +329,8 @@ static int mpc52xx_psc_spi_port_config(i
>  	int ret = 0;
>  
>  #if defined(CONFIG_PPC_MERGE)
> -	cdm = mpc52xx_find_and_map("mpc52xx-cdm");
> -	gpio = mpc52xx_find_and_map("mpc52xx-gpio");
> +	cdm = mpc52xx_find_and_map("mpc5200-cdm");
> +	gpio = mpc52xx_find_and_map("mpc5200-gpio");
>  #else
>  	cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
>  	gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
> @@ -445,9 +445,6 @@ static int __init mpc52xx_psc_spi_do_pro
>  	struct spi_master *master;
>  	int ret;
>  
> -	if (pdata == NULL)
> -		return -ENODEV;
> -
>  	master = spi_alloc_master(dev, sizeof *mps);
>  	if (master == NULL)
>  		return -ENOMEM;
> @@ -594,17 +591,17 @@ static int __init mpc52xx_psc_spi_of_pro
>  	}
>  	regaddr64 = of_translate_address(op->node, regaddr_p);
>  
> +	/* get PSC id (1..6, used by port_config) */
>  	if (op->dev.platform_data == NULL) {
> -		struct device_node *np;
> -		int i = 0;
> +		const u32 *psc_nump;
>  
> -		for_each_node_by_type(np, "spi") {
> -			if (of_find_device_by_node(np) == op) {
> -				id = i;
> -				break;
> -			}
> -			i++;
> +		psc_nump = of_get_property(op->node, "cell-index", NULL);
> +		if (!psc_nump || *psc_nump > 5) {
> +			printk(KERN_ERR "mpc52xx_psc_spi: Device node %s has invalid "
> +					"cell-index property\n", op->node->full_name);
> +			return -EINVAL;
>  		}
> +		id = *psc_nump + 1;
>  	}
>  
>  	return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64,
> @@ -617,7 +614,7 @@ static int __exit mpc52xx_psc_spi_of_rem
>  }
>  
>  static struct of_device_id mpc52xx_psc_spi_of_match[] = {
> -	{ .type = "spi", .compatible = "mpc52xx-psc-spi", },
> +	{ .type = "spi", .compatible = "mpc5200-psc-spi", },
>  	{},
>  };
>  
>
>
>   


-- 

Dragos Carp
Research & Development

Phone: +49 89 85837-159, Fax: +49 89 85837-200
Address: TOPTICA Photonics AG, Lochhamer Schlag 19, D-82166 Graefelfing, Germany

TOPTICA – A Passion for Precision
TOPTICA Photonics AG, Registered Office: 82166 Graefelfing, Germany
Companies' Register: Amtsgericht München, HRB 137368
Executive Directors: Dr. Wilhelm Kaenders, Dr. Thomas Weber
Chairman of the Supervisory Board: Dr. Kristian Hohla
www.toptica.com

  parent reply	other threads:[~2007-05-21  7:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-16  7:37 [PATCH] mpc52xx_psc_spi: fix it for CONFIG_PPC_MERGE Domen Puncer
2007-05-16  8:19 ` Sylvain Munaut
2007-05-16 16:11   ` David Brownell
2007-05-16 16:34     ` Sylvain Munaut
2007-05-18  7:44       ` Dragos Carp
2007-05-25  8:43   ` [RFC 1/3] " Domen Puncer
2007-05-25 14:50     ` Sylvain Munaut
2007-05-25 17:02       ` Grant Likely
2007-05-25  8:45   ` [RFC 2/3] " Domen Puncer
2007-05-25  8:47   ` [RFC 3/3] " Domen Puncer
2007-05-25 16:34     ` David Brownell
2007-05-25 18:00       ` Domen Puncer
     [not found] ` <20070516073707.GD9667-yTFm/CsSGdPT0JcTxXCzFdi2O/JbrIOy@public.gmane.org>
2007-05-21  7:31   ` Dragos Carp [this message]
2007-05-21  7:31     ` Dragos Carp

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=46514AC6.8080704@toptica.com \
    --to=dragos.carp-+ybmorv4k0dbdgjk7y7tuq@public.gmane.org \
    --cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=domen-CvScVCPLwOZg9hUCZPvPmw@public.gmane.org \
    --cc=linuxppc-embedded-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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.