mtd: bcm47xxnflash: fix typo in freq calculation

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Oct 15 23:59:06 PDT 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=785e5e111f2187ea3e6f4035f6009da62dd5c043
Commit:     785e5e111f2187ea3e6f4035f6009da62dd5c043
Parent:     024629fdca1bbb44a25d40c2362a878a7a67ce3b
Author:     Rafał Miłecki <zajec5 at gmail.com>
AuthorDate: Tue Aug 19 09:14:13 2014 +0200
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed Sep 17 23:18:50 2014 -0700

    mtd: bcm47xxnflash: fix typo in freq calculation
    
    We are supposed to mask value, not multiply it. Add some comments btw.
    
    Signed-off-by: Rafał Miłecki <zajec5 at gmail.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
index b2ab373..dc204f3 100644
--- a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
+++ b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
@@ -364,11 +364,13 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *b47n)
 
 	/* Configure wait counters */
 	if (b47n->cc->status & BCMA_CC_CHIPST_4706_PKG_OPTION) {
-		freq = 100000000;
+		/* 400 MHz */
+		freq = 400000000 / 4;
 	} else {
 		freq = bcma_chipco_pll_read(b47n->cc, 4);
-		freq = (freq * 0xFFF) >> 3;
-		freq = (freq * 25000000) >> 3;
+		freq = (freq & 0xFFF) >> 3;
+		/* Fixed reference clock 25 MHz and m = 2 */
+		freq = (freq * 25000000 / 2) / 4;
 	}
 	clock = freq / 1000000;
 	w0 = bcm47xxnflash_ops_bcm4706_ns_to_cycle(15, clock);



More information about the linux-mtd-cvs mailing list