]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
i.MX25: fix get_rate_otg to return the correct value
authorEric Bénard <eric@eukrea.com>
Tue, 8 Jun 2010 09:02:57 +0000 (11:02 +0200)
committerSascha Hauer <s.hauer@pengutronix.de>
Mon, 26 Jul 2010 12:18:09 +0000 (14:18 +0200)
usb drivers need to get the right value for otg clock so
calculate and return it

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
arch/arm/mach-mx25/clock.c

index f44d65765b9aa4223ce9ee77645568041ff21018..84f0f1efea4b4dfbc53899759cb9b7027fcda25d 100644 (file)
@@ -131,7 +131,10 @@ static unsigned long get_rate_lcdc(struct clk *clk)
 
 static unsigned long get_rate_otg(struct clk *clk)
 {
-       return 48000000; /* FIXME */
+       unsigned long cctl = readl(CRM_BASE + CCM_CCTL);
+       unsigned long rate = get_rate_upll();
+
+       return (cctl & (1 << 23)) ? 0 : rate / ((0x3F & (cctl >> 16)) + 1);
 }
 
 static int clk_cgcr_enable(struct clk *clk)