Commit 8888735f authored by Domen Puncer's avatar Domen Puncer Committed by Linus Torvalds

mpc52xx_psc_spi: fix it for CONFIG_PPC_MERGE

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

The move from 'ppc' to 'powerpc' didn't quite match the latest
kernel.org code.
Signed-off-by: default avatarDomen Puncer <domen.puncer@telargo.com>
Acked-by: default avatarDragos Carp <dragos.carp@toptica.com>
Acked-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b9ba347f
...@@ -329,8 +329,8 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps) ...@@ -329,8 +329,8 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
int ret = 0; int ret = 0;
#if defined(CONFIG_PPC_MERGE) #if defined(CONFIG_PPC_MERGE)
cdm = mpc52xx_find_and_map("mpc52xx-cdm"); cdm = mpc52xx_find_and_map("mpc5200-cdm");
gpio = mpc52xx_find_and_map("mpc52xx-gpio"); gpio = mpc52xx_find_and_map("mpc5200-gpio");
#else #else
cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE); cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE); gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
...@@ -445,9 +445,6 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, ...@@ -445,9 +445,6 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
struct spi_master *master; struct spi_master *master;
int ret; int ret;
if (pdata == NULL)
return -ENODEV;
master = spi_alloc_master(dev, sizeof *mps); master = spi_alloc_master(dev, sizeof *mps);
if (master == NULL) if (master == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -594,17 +591,17 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op, ...@@ -594,17 +591,17 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op,
} }
regaddr64 = of_translate_address(op->node, regaddr_p); regaddr64 = of_translate_address(op->node, regaddr_p);
/* get PSC id (1..6, used by port_config) */
if (op->dev.platform_data == NULL) { if (op->dev.platform_data == NULL) {
struct device_node *np; const u32 *psc_nump;
int i = 0;
for_each_node_by_type(np, "spi") { psc_nump = of_get_property(op->node, "cell-index", NULL);
if (of_find_device_by_node(np) == op) { if (!psc_nump || *psc_nump > 5) {
id = i; printk(KERN_ERR "mpc52xx_psc_spi: Device node %s has invalid "
break; "cell-index property\n", op->node->full_name);
} return -EINVAL;
i++;
} }
id = *psc_nump + 1;
} }
return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64, return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64,
...@@ -617,7 +614,7 @@ static int __exit mpc52xx_psc_spi_of_remove(struct of_device *op) ...@@ -617,7 +614,7 @@ static int __exit mpc52xx_psc_spi_of_remove(struct of_device *op)
} }
static struct of_device_id mpc52xx_psc_spi_of_match[] = { static struct of_device_id mpc52xx_psc_spi_of_match[] = {
{ .type = "spi", .compatible = "mpc52xx-psc-spi", }, { .type = "spi", .compatible = "mpc5200-psc-spi", },
{}, {},
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment