mtd: bcm47xxnflash: fix typo in freq calculation
authorRafał Miłecki <zajec5@gmail.com>
Tue, 19 Aug 2014 07:14:13 +0000 (09:14 +0200)
committerBrian Norris <computersforpeace@gmail.com>
Thu, 18 Sep 2014 06:18:50 +0000 (23:18 -0700)
We are supposed to mask value, not multiply it. Add some comments btw.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c

index b2ab373c9eefd37c3ab970d078501a9ad423d698..dc204f3a47ed58b1a08ed1abb22a4d7e29e7ee0e 100644 (file)
@@ -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);