aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDomen Puncer <domen@coderock.org>2007-05-23 16:57:32 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-23 23:14:11 -0400
commit8888735fcaac7681dbcca67fbcc88cf627c47b3a (patch)
tree1c3400a5c6fa6555174a1320e1a4de8538a800f4
parentb9ba347f27f2508e3da023688d047e111cbbe2da (diff)
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: Domen Puncer <domen.puncer@telargo.com> Acked-by: Dragos Carp <dragos.carp@toptica.com> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 052359fc41ee..11f36bef3057 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -329,8 +329,8 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
329 int ret = 0; 329 int ret = 0;
330 330
331#if defined(CONFIG_PPC_MERGE) 331#if defined(CONFIG_PPC_MERGE)
332 cdm = mpc52xx_find_and_map("mpc52xx-cdm"); 332 cdm = mpc52xx_find_and_map("mpc5200-cdm");
333 gpio = mpc52xx_find_and_map("mpc52xx-gpio"); 333 gpio = mpc52xx_find_and_map("mpc5200-gpio");
334#else 334#else
335 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE); 335 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
336 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE); 336 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 struct spi_master *master; 445 struct spi_master *master;
446 int ret; 446 int ret;
447 447
448 if (pdata == NULL)
449 return -ENODEV;
450
451 master = spi_alloc_master(dev, sizeof *mps); 448 master = spi_alloc_master(dev, sizeof *mps);
452 if (master == NULL) 449 if (master == NULL)
453 return -ENOMEM; 450 return -ENOMEM;
@@ -594,17 +591,17 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op,
594 } 591 }
595 regaddr64 = of_translate_address(op->node, regaddr_p); 592 regaddr64 = of_translate_address(op->node, regaddr_p);
596 593
594 /* get PSC id (1..6, used by port_config) */
597 if (op->dev.platform_data == NULL) { 595 if (op->dev.platform_data == NULL) {
598 struct device_node *np; 596 const u32 *psc_nump;
599 int i = 0;
600 597
601 for_each_node_by_type(np, "spi") { 598 psc_nump = of_get_property(op->node, "cell-index", NULL);
602 if (of_find_device_by_node(np) == op) { 599 if (!psc_nump || *psc_nump > 5) {
603 id = i; 600 printk(KERN_ERR "mpc52xx_psc_spi: Device node %s has invalid "
604 break; 601 "cell-index property\n", op->node->full_name);
605 } 602 return -EINVAL;
606 i++;
607 } 603 }
604 id = *psc_nump + 1;
608 } 605 }
609 606
610 return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64, 607 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} 614}
618 615
619static struct of_device_id mpc52xx_psc_spi_of_match[] = { 616static struct of_device_id mpc52xx_psc_spi_of_match[] = {
620 { .type = "spi", .compatible = "mpc52xx-psc-spi", }, 617 { .type = "spi", .compatible = "mpc5200-psc-spi", },
621 {}, 618 {},
622}; 619};
623 620