aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@nokia.com>2011-02-07 03:46:59 -0500
committerTony Lindgren <tony@atomide.com>2011-02-17 18:44:45 -0500
commit3ad2d861362031dac8b2bba78a8f4c575300948f (patch)
tree24dbf3d99034234dac78b3c001eac5c8470d514b /drivers/mtd
parent1435ca0fc1a269f9496343e24223a0fc430aff7a (diff)
OMAP: OneNAND: determine frequency in one place
OneNAND frequency is determined when calculating GPMC timings. Return that value instead of determining it again in the OMAP OneNAND driver. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/onenand/omap2.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index ac31f461cc1c..3e1bb9568823 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -63,7 +63,7 @@ struct omap2_onenand {
63 struct completion dma_done; 63 struct completion dma_done;
64 int dma_channel; 64 int dma_channel;
65 int freq; 65 int freq;
66 int (*setup)(void __iomem *base, int freq); 66 int (*setup)(void __iomem *base, int *freq_ptr);
67 struct regulator *regulator; 67 struct regulator *regulator;
68}; 68};
69 69
@@ -581,7 +581,7 @@ static int __adjust_timing(struct device *dev, void *data)
581 581
582 /* DMA is not in use so this is all that is needed */ 582 /* DMA is not in use so this is all that is needed */
583 /* Revisit for OMAP3! */ 583 /* Revisit for OMAP3! */
584 ret = c->setup(c->onenand.base, c->freq); 584 ret = c->setup(c->onenand.base, &c->freq);
585 585
586 return ret; 586 return ret;
587} 587}
@@ -673,7 +673,7 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
673 } 673 }
674 674
675 if (pdata->onenand_setup != NULL) { 675 if (pdata->onenand_setup != NULL) {
676 r = pdata->onenand_setup(c->onenand.base, c->freq); 676 r = pdata->onenand_setup(c->onenand.base, &c->freq);
677 if (r < 0) { 677 if (r < 0) {
678 dev_err(&pdev->dev, "Onenand platform setup failed: " 678 dev_err(&pdev->dev, "Onenand platform setup failed: "
679 "%d\n", r); 679 "%d\n", r);
@@ -718,8 +718,8 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
718 } 718 }
719 719
720 dev_info(&pdev->dev, "initializing on CS%d, phys base 0x%08lx, virtual " 720 dev_info(&pdev->dev, "initializing on CS%d, phys base 0x%08lx, virtual "
721 "base %p\n", c->gpmc_cs, c->phys_base, 721 "base %p, freq %d MHz\n", c->gpmc_cs, c->phys_base,
722 c->onenand.base); 722 c->onenand.base, c->freq);
723 723
724 c->pdev = pdev; 724 c->pdev = pdev;
725 c->mtd.name = dev_name(&pdev->dev); 725 c->mtd.name = dev_name(&pdev->dev);
@@ -754,24 +754,6 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
754 if ((r = onenand_scan(&c->mtd, 1)) < 0) 754 if ((r = onenand_scan(&c->mtd, 1)) < 0)
755 goto err_release_regulator; 755 goto err_release_regulator;
756 756
757 switch ((c->onenand.version_id >> 4) & 0xf) {
758 case 0:
759 c->freq = 40;
760 break;
761 case 1:
762 c->freq = 54;
763 break;
764 case 2:
765 c->freq = 66;
766 break;
767 case 3:
768 c->freq = 83;
769 break;
770 case 4:
771 c->freq = 104;
772 break;
773 }
774
775#ifdef CONFIG_MTD_PARTITIONS 757#ifdef CONFIG_MTD_PARTITIONS
776 r = parse_mtd_partitions(&c->mtd, part_probes, &c->parts, 0); 758 r = parse_mtd_partitions(&c->mtd, part_probes, &c->parts, 0);
777 if (r > 0) 759 if (r > 0)