Patchwork [1/4] mtd: bcm47xxnflash: fix typo in freq calculation

login
register
mail settings
Submitter Rafał Miłecki
Date Aug. 19, 2014, 7:14 a.m.
Message ID <1408432456-27280-1-git-send-email-zajec5@gmail.com>
Download mbox | patch
Permalink /patch/381258/
State Accepted
Commit 785e5e111f2187ea3e6f4035f6009da62dd5c043
Headers show

Comments

Rafał Miłecki - Aug. 19, 2014, 7:14 a.m.
We are supposed to mask value, not multiply it. Add some comments btw.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Brian Norris - Sept. 18, 2014, 6:25 a.m.
On Tue, Aug 19, 2014 at 09:14:13AM +0200, Rafał Miłecki wrote:
> We are supposed to mask value, not multiply it. Add some comments btw.
> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

Pushed all 4 to l2-mtd.git. Thanks!

Brian

Patch

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);