2008-03-18 21:09:51 +08:00
|
|
|
/*
|
|
|
|
* OMAP3-specific clock framework functions
|
|
|
|
*
|
2008-07-03 17:24:45 +08:00
|
|
|
* Copyright (C) 2007-2008 Texas Instruments, Inc.
|
OMAP3 clock: correct module IDLEST bits: SSI; DSS; USBHOST; HSOTGUSB
Fix two bugs in the OMAP3 clock tree pertaining to the SSI, DSS,
USBHOST, and HSOTGUSB devices. These devices are both interconnect
initiators and targets. Without this patch, clk_enable()s on clocks for
these modules can be very high latency (potentially up to ~200
milliseconds) and message such as the following are generated:
Clock usbhost_48m_fck didn't enable in 100000 tries
Two bugs are fixed by this patch. First, OMAP hardware only supports
target CM_IDLEST register bits on ES2+ chips and beyond. ES1 chips
should not wait for these clocks to enable. So, split the appropriate
clocks into ES1 and ES2+ variants, so that kernels running on ES1
devices won't try to wait.
Second, the current heuristic in omap2_clk_dflt_find_idlest() will
fail for these clocks. It assumes that the CM_IDLEST bit to wait upon
is the same as the CM_*CLKEN bit, which is false[1]. Fix by
implementing custom clkops .find_idlest function pointers for the
appropriate clocks that return the correct slave IDLEST bit shift.
This was originally fixed in the linux-omap kernel during 2.6.29 in a
slightly different manner[2][3].
In the medium-term future, all of the module IDLEST code will
eventually be moved to the omap_hwmod code.
Problem reported by Jarkko Nikula <jhnikula@gmail.com>:
http://marc.info/?l=linux-omap&m=124306184903679&w=2
...
1. See for example 34xx TRM Revision P Table 4-213 and 4-217 (for the
DSS case).
2. http://www.spinics.net/lists/linux-omap/msg05512.html et seq.
3. http://lkml.indiana.edu/hypermail/linux/kernel/0901.3/01498.html
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Jarkko Nikula <jhnikula@gmail.com>
2009-07-25 09:44:06 +08:00
|
|
|
* Copyright (C) 2007-2009 Nokia Corporation
|
2008-03-18 21:09:51 +08:00
|
|
|
*
|
|
|
|
* Written by Paul Walmsley
|
2008-07-03 17:24:45 +08:00
|
|
|
* Testing and integration fixes by Jouni Högander
|
2008-03-18 21:09:51 +08:00
|
|
|
*
|
|
|
|
* Parts of this code are based on code written by
|
|
|
|
* Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
#undef DEBUG
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/clk.h>
|
|
|
|
#include <linux/io.h>
|
2008-07-03 17:24:45 +08:00
|
|
|
#include <linux/limits.h>
|
2008-09-06 19:13:59 +08:00
|
|
|
#include <linux/bitops.h>
|
2008-03-18 21:09:51 +08:00
|
|
|
|
2009-10-21 00:40:47 +08:00
|
|
|
#include <plat/cpu.h>
|
|
|
|
#include <plat/clock.h>
|
|
|
|
#include <plat/sram.h>
|
2009-12-09 07:18:47 +08:00
|
|
|
#include <plat/sdrc.h>
|
2008-03-18 21:09:51 +08:00
|
|
|
#include <asm/div64.h>
|
2009-01-19 23:51:11 +08:00
|
|
|
#include <asm/clkdev.h>
|
2008-03-18 21:09:51 +08:00
|
|
|
|
|
|
|
#include "clock.h"
|
2009-12-09 07:18:47 +08:00
|
|
|
#include "clock34xx.h"
|
|
|
|
#include "sdrc.h"
|
2008-03-18 21:09:51 +08:00
|
|
|
#include "prm.h"
|
|
|
|
#include "prm-regbits-34xx.h"
|
|
|
|
#include "cm.h"
|
|
|
|
#include "cm-regbits-34xx.h"
|
|
|
|
|
2009-06-20 09:08:26 +08:00
|
|
|
#define CYCLES_PER_MHZ 1000000
|
|
|
|
|
2009-10-06 04:31:44 +08:00
|
|
|
/*
|
|
|
|
* DPLL5_FREQ_FOR_USBHOST: USBHOST and USBTLL are the only clocks
|
|
|
|
* that are sourced by DPLL5, and both of these require this clock
|
|
|
|
* to be at 120 MHz for proper operation.
|
|
|
|
*/
|
|
|
|
#define DPLL5_FREQ_FOR_USBHOST 120000000
|
|
|
|
|
2009-12-09 07:18:47 +08:00
|
|
|
/* needed by omap3_core_dpll_m2_set_rate() */
|
|
|
|
struct clk *sdrc_ick_p, *arm_fck_p;
|
|
|
|
|
OMAP3 clock: correct module IDLEST bits: SSI; DSS; USBHOST; HSOTGUSB
Fix two bugs in the OMAP3 clock tree pertaining to the SSI, DSS,
USBHOST, and HSOTGUSB devices. These devices are both interconnect
initiators and targets. Without this patch, clk_enable()s on clocks for
these modules can be very high latency (potentially up to ~200
milliseconds) and message such as the following are generated:
Clock usbhost_48m_fck didn't enable in 100000 tries
Two bugs are fixed by this patch. First, OMAP hardware only supports
target CM_IDLEST register bits on ES2+ chips and beyond. ES1 chips
should not wait for these clocks to enable. So, split the appropriate
clocks into ES1 and ES2+ variants, so that kernels running on ES1
devices won't try to wait.
Second, the current heuristic in omap2_clk_dflt_find_idlest() will
fail for these clocks. It assumes that the CM_IDLEST bit to wait upon
is the same as the CM_*CLKEN bit, which is false[1]. Fix by
implementing custom clkops .find_idlest function pointers for the
appropriate clocks that return the correct slave IDLEST bit shift.
This was originally fixed in the linux-omap kernel during 2.6.29 in a
slightly different manner[2][3].
In the medium-term future, all of the module IDLEST code will
eventually be moved to the omap_hwmod code.
Problem reported by Jarkko Nikula <jhnikula@gmail.com>:
http://marc.info/?l=linux-omap&m=124306184903679&w=2
...
1. See for example 34xx TRM Revision P Table 4-213 and 4-217 (for the
DSS case).
2. http://www.spinics.net/lists/linux-omap/msg05512.html et seq.
3. http://lkml.indiana.edu/hypermail/linux/kernel/0901.3/01498.html
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Jarkko Nikula <jhnikula@gmail.com>
2009-07-25 09:44:06 +08:00
|
|
|
/**
|
|
|
|
* omap3430es2_clk_ssi_find_idlest - return CM_IDLEST info for SSI
|
|
|
|
* @clk: struct clk * being enabled
|
|
|
|
* @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
|
|
|
|
* @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
|
|
|
|
*
|
|
|
|
* The OMAP3430ES2 SSI target CM_IDLEST bit is at a different shift
|
|
|
|
* from the CM_{I,F}CLKEN bit. Pass back the correct info via
|
|
|
|
* @idlest_reg and @idlest_bit. No return value.
|
|
|
|
*/
|
|
|
|
static void omap3430es2_clk_ssi_find_idlest(struct clk *clk,
|
|
|
|
void __iomem **idlest_reg,
|
|
|
|
u8 *idlest_bit)
|
|
|
|
{
|
|
|
|
u32 r;
|
|
|
|
|
|
|
|
r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
|
|
|
|
*idlest_reg = (__force void __iomem *)r;
|
|
|
|
*idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
|
|
|
|
}
|
|
|
|
|
2009-12-09 07:18:47 +08:00
|
|
|
const struct clkops clkops_omap3430es2_ssi_wait = {
|
|
|
|
.enable = omap2_dflt_clk_enable,
|
|
|
|
.disable = omap2_dflt_clk_disable,
|
|
|
|
.find_idlest = omap3430es2_clk_ssi_find_idlest,
|
|
|
|
.find_companion = omap2_clk_dflt_find_companion,
|
|
|
|
};
|
|
|
|
|
OMAP3 clock: correct module IDLEST bits: SSI; DSS; USBHOST; HSOTGUSB
Fix two bugs in the OMAP3 clock tree pertaining to the SSI, DSS,
USBHOST, and HSOTGUSB devices. These devices are both interconnect
initiators and targets. Without this patch, clk_enable()s on clocks for
these modules can be very high latency (potentially up to ~200
milliseconds) and message such as the following are generated:
Clock usbhost_48m_fck didn't enable in 100000 tries
Two bugs are fixed by this patch. First, OMAP hardware only supports
target CM_IDLEST register bits on ES2+ chips and beyond. ES1 chips
should not wait for these clocks to enable. So, split the appropriate
clocks into ES1 and ES2+ variants, so that kernels running on ES1
devices won't try to wait.
Second, the current heuristic in omap2_clk_dflt_find_idlest() will
fail for these clocks. It assumes that the CM_IDLEST bit to wait upon
is the same as the CM_*CLKEN bit, which is false[1]. Fix by
implementing custom clkops .find_idlest function pointers for the
appropriate clocks that return the correct slave IDLEST bit shift.
This was originally fixed in the linux-omap kernel during 2.6.29 in a
slightly different manner[2][3].
In the medium-term future, all of the module IDLEST code will
eventually be moved to the omap_hwmod code.
Problem reported by Jarkko Nikula <jhnikula@gmail.com>:
http://marc.info/?l=linux-omap&m=124306184903679&w=2
...
1. See for example 34xx TRM Revision P Table 4-213 and 4-217 (for the
DSS case).
2. http://www.spinics.net/lists/linux-omap/msg05512.html et seq.
3. http://lkml.indiana.edu/hypermail/linux/kernel/0901.3/01498.html
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Jarkko Nikula <jhnikula@gmail.com>
2009-07-25 09:44:06 +08:00
|
|
|
/**
|
|
|
|
* omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST
|
|
|
|
* @clk: struct clk * being enabled
|
|
|
|
* @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
|
|
|
|
* @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
|
|
|
|
*
|
|
|
|
* Some OMAP modules on OMAP3 ES2+ chips have both initiator and
|
|
|
|
* target IDLEST bits. For our purposes, we are concerned with the
|
|
|
|
* target IDLEST bits, which exist at a different bit position than
|
|
|
|
* the *CLKEN bit position for these modules (DSS and USBHOST) (The
|
|
|
|
* default find_idlest code assumes that they are at the same
|
|
|
|
* position.) No return value.
|
|
|
|
*/
|
|
|
|
static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk,
|
|
|
|
void __iomem **idlest_reg,
|
|
|
|
u8 *idlest_bit)
|
|
|
|
{
|
|
|
|
u32 r;
|
|
|
|
|
|
|
|
r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
|
|
|
|
*idlest_reg = (__force void __iomem *)r;
|
|
|
|
/* USBHOST_IDLE has same shift */
|
|
|
|
*idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT;
|
|
|
|
}
|
|
|
|
|
2009-12-09 07:18:47 +08:00
|
|
|
const struct clkops clkops_omap3430es2_dss_usbhost_wait = {
|
|
|
|
.enable = omap2_dflt_clk_enable,
|
|
|
|
.disable = omap2_dflt_clk_disable,
|
|
|
|
.find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
|
|
|
|
.find_companion = omap2_clk_dflt_find_companion,
|
|
|
|
};
|
|
|
|
|
OMAP3 clock: correct module IDLEST bits: SSI; DSS; USBHOST; HSOTGUSB
Fix two bugs in the OMAP3 clock tree pertaining to the SSI, DSS,
USBHOST, and HSOTGUSB devices. These devices are both interconnect
initiators and targets. Without this patch, clk_enable()s on clocks for
these modules can be very high latency (potentially up to ~200
milliseconds) and message such as the following are generated:
Clock usbhost_48m_fck didn't enable in 100000 tries
Two bugs are fixed by this patch. First, OMAP hardware only supports
target CM_IDLEST register bits on ES2+ chips and beyond. ES1 chips
should not wait for these clocks to enable. So, split the appropriate
clocks into ES1 and ES2+ variants, so that kernels running on ES1
devices won't try to wait.
Second, the current heuristic in omap2_clk_dflt_find_idlest() will
fail for these clocks. It assumes that the CM_IDLEST bit to wait upon
is the same as the CM_*CLKEN bit, which is false[1]. Fix by
implementing custom clkops .find_idlest function pointers for the
appropriate clocks that return the correct slave IDLEST bit shift.
This was originally fixed in the linux-omap kernel during 2.6.29 in a
slightly different manner[2][3].
In the medium-term future, all of the module IDLEST code will
eventually be moved to the omap_hwmod code.
Problem reported by Jarkko Nikula <jhnikula@gmail.com>:
http://marc.info/?l=linux-omap&m=124306184903679&w=2
...
1. See for example 34xx TRM Revision P Table 4-213 and 4-217 (for the
DSS case).
2. http://www.spinics.net/lists/linux-omap/msg05512.html et seq.
3. http://lkml.indiana.edu/hypermail/linux/kernel/0901.3/01498.html
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Jarkko Nikula <jhnikula@gmail.com>
2009-07-25 09:44:06 +08:00
|
|
|
/**
|
|
|
|
* omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB
|
|
|
|
* @clk: struct clk * being enabled
|
|
|
|
* @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
|
|
|
|
* @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
|
|
|
|
*
|
|
|
|
* The OMAP3430ES2 HSOTGUSB target CM_IDLEST bit is at a different
|
|
|
|
* shift from the CM_{I,F}CLKEN bit. Pass back the correct info via
|
|
|
|
* @idlest_reg and @idlest_bit. No return value.
|
|
|
|
*/
|
|
|
|
static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk,
|
|
|
|
void __iomem **idlest_reg,
|
|
|
|
u8 *idlest_bit)
|
|
|
|
{
|
|
|
|
u32 r;
|
|
|
|
|
|
|
|
r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
|
|
|
|
*idlest_reg = (__force void __iomem *)r;
|
|
|
|
*idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT;
|
|
|
|
}
|
|
|
|
|
2009-12-09 07:18:47 +08:00
|
|
|
const struct clkops clkops_omap3430es2_hsotgusb_wait = {
|
|
|
|
.enable = omap2_dflt_clk_enable,
|
|
|
|
.disable = omap2_dflt_clk_disable,
|
|
|
|
.find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
|
|
|
|
.find_companion = omap2_clk_dflt_find_companion,
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct clkops clkops_noncore_dpll_ops = {
|
|
|
|
.enable = omap3_noncore_dpll_enable,
|
|
|
|
.disable = omap3_noncore_dpll_disable,
|
|
|
|
};
|
2009-01-28 10:12:47 +08:00
|
|
|
|
2009-12-09 07:18:47 +08:00
|
|
|
int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)
|
2009-01-28 10:12:47 +08:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* According to the 12-5 CDP code from TI, "Limitation 2.5"
|
|
|
|
* on 3430ES1 prevents us from changing DPLL multipliers or dividers
|
|
|
|
* on DPLL4.
|
|
|
|
*/
|
|
|
|
if (omap_rev() == OMAP3430_REV_ES1_0) {
|
|
|
|
printk(KERN_ERR "clock: DPLL4 cannot change rate due to "
|
|
|
|
"silicon 'Limitation 2.5' on 3430ES1.\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
return omap3_noncore_dpll_set_rate(clk, rate);
|
|
|
|
}
|
|
|
|
|
2009-01-29 03:27:42 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* CORE DPLL (DPLL3) rate programming functions
|
|
|
|
*
|
|
|
|
* These call into SRAM code to do the actual CM writes, since the SDRAM
|
|
|
|
* is clocked from DPLL3.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* omap3_core_dpll_m2_set_rate - set CORE DPLL M2 divider
|
|
|
|
* @clk: struct clk * of DPLL to set
|
|
|
|
* @rate: rounded target rate
|
|
|
|
*
|
|
|
|
* Program the DPLL M2 divider with the rounded target rate. Returns
|
|
|
|
* -EINVAL upon error, or 0 upon success.
|
|
|
|
*/
|
2009-12-09 07:18:47 +08:00
|
|
|
int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
|
2009-01-29 03:27:42 +08:00
|
|
|
{
|
|
|
|
u32 new_div = 0;
|
2009-05-13 07:26:32 +08:00
|
|
|
u32 unlock_dll = 0;
|
2009-06-20 09:08:26 +08:00
|
|
|
u32 c;
|
2009-12-09 07:18:47 +08:00
|
|
|
unsigned long validrate, sdrcrate, _mpurate;
|
2009-07-25 09:43:25 +08:00
|
|
|
struct omap_sdrc_params *sdrc_cs0;
|
|
|
|
struct omap_sdrc_params *sdrc_cs1;
|
|
|
|
int ret;
|
2009-01-29 03:27:42 +08:00
|
|
|
|
|
|
|
if (!clk || !rate)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
validrate = omap2_clksel_round_rate_div(clk, rate, &new_div);
|
|
|
|
if (validrate != rate)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2009-12-09 07:18:47 +08:00
|
|
|
sdrcrate = sdrc_ick_p->rate;
|
2009-01-29 03:27:42 +08:00
|
|
|
if (rate > clk->rate)
|
2009-06-20 09:08:29 +08:00
|
|
|
sdrcrate <<= ((rate / clk->rate) >> 1);
|
2009-01-29 03:27:42 +08:00
|
|
|
else
|
2009-06-20 09:08:29 +08:00
|
|
|
sdrcrate >>= ((clk->rate / rate) >> 1);
|
2009-01-29 03:27:42 +08:00
|
|
|
|
2009-07-25 09:43:25 +08:00
|
|
|
ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
|
|
|
|
if (ret)
|
2009-01-29 03:27:42 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
2009-05-13 07:26:32 +08:00
|
|
|
if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) {
|
|
|
|
pr_debug("clock: will unlock SDRC DLL\n");
|
|
|
|
unlock_dll = 1;
|
|
|
|
}
|
|
|
|
|
2009-06-20 09:08:26 +08:00
|
|
|
/*
|
|
|
|
* XXX This only needs to be done when the CPU frequency changes
|
|
|
|
*/
|
2009-12-09 07:18:47 +08:00
|
|
|
_mpurate = arm_fck_p->rate / CYCLES_PER_MHZ;
|
|
|
|
c = (_mpurate << SDRC_MPURATE_SCALE) >> SDRC_MPURATE_BASE_SHIFT;
|
2009-06-20 09:08:26 +08:00
|
|
|
c += 1; /* for safety */
|
|
|
|
c *= SDRC_MPURATE_LOOPS;
|
|
|
|
c >>= SDRC_MPURATE_SCALE;
|
|
|
|
if (c == 0)
|
|
|
|
c = 1;
|
|
|
|
|
2009-05-13 07:27:10 +08:00
|
|
|
pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate,
|
|
|
|
validrate);
|
2009-07-25 09:43:25 +08:00
|
|
|
pr_debug("clock: SDRC CS0 timing params used:"
|
|
|
|
" RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
|
|
|
|
sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
|
|
|
|
sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
|
|
|
|
if (sdrc_cs1)
|
|
|
|
pr_debug("clock: SDRC CS1 timing params used: "
|
|
|
|
" RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
|
|
|
|
sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
|
|
|
|
sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
|
|
|
|
|
|
|
|
if (sdrc_cs1)
|
|
|
|
omap3_configure_core_dpll(
|
|
|
|
new_div, unlock_dll, c, rate > clk->rate,
|
|
|
|
sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
|
|
|
|
sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
|
|
|
|
sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
|
|
|
|
sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
|
|
|
|
else
|
|
|
|
omap3_configure_core_dpll(
|
|
|
|
new_div, unlock_dll, c, rate > clk->rate,
|
|
|
|
sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
|
|
|
|
sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
|
|
|
|
0, 0, 0, 0);
|
2009-01-29 03:27:42 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-07-03 17:24:45 +08:00
|
|
|
/* Common clock code */
|
|
|
|
|
2008-03-18 21:09:51 +08:00
|
|
|
/*
|
|
|
|
* As it is structured now, this will prevent an OMAP2/3 multiboot
|
|
|
|
* kernel from compiling. This will need further attention.
|
|
|
|
*/
|
|
|
|
#if defined(CONFIG_ARCH_OMAP3)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set clocks for bypass mode for reboot to work.
|
|
|
|
*/
|
|
|
|
void omap2_clk_prepare_for_reboot(void)
|
|
|
|
{
|
|
|
|
/* REVISIT: Not ready for 343x */
|
|
|
|
#if 0
|
|
|
|
u32 rate;
|
|
|
|
|
|
|
|
if (vclk == NULL || sclk == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
rate = clk_get_rate(sclk);
|
|
|
|
clk_set_rate(vclk, rate);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-12-09 07:18:47 +08:00
|
|
|
void omap3_clk_lock_dpll5(void)
|
2009-10-06 04:31:44 +08:00
|
|
|
{
|
|
|
|
struct clk *dpll5_clk;
|
|
|
|
struct clk *dpll5_m2_clk;
|
|
|
|
|
|
|
|
dpll5_clk = clk_get(NULL, "dpll5_ck");
|
|
|
|
clk_set_rate(dpll5_clk, DPLL5_FREQ_FOR_USBHOST);
|
|
|
|
clk_enable(dpll5_clk);
|
|
|
|
|
|
|
|
/* Enable autoidle to allow it to enter low power bypass */
|
|
|
|
omap3_dpll_allow_idle(dpll5_clk);
|
|
|
|
|
|
|
|
/* Program dpll5_m2_clk divider for no division */
|
|
|
|
dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck");
|
|
|
|
clk_enable(dpll5_m2_clk);
|
|
|
|
clk_set_rate(dpll5_m2_clk, DPLL5_FREQ_FOR_USBHOST);
|
|
|
|
|
|
|
|
clk_disable(dpll5_m2_clk);
|
|
|
|
clk_disable(dpll5_clk);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-03-18 21:09:51 +08:00
|
|
|
/* REVISIT: Move this init stuff out into clock.c */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Switch the MPU rate if specified on cmdline.
|
|
|
|
* We cannot do this early until cmdline is parsed.
|
|
|
|
*/
|
|
|
|
static int __init omap2_clk_arch_init(void)
|
|
|
|
{
|
2009-12-09 07:18:47 +08:00
|
|
|
struct clk *osc_sys_ck, *dpll1_ck, *arm_fck, *core_ck;
|
|
|
|
unsigned long osc_sys_rate;
|
|
|
|
|
2008-03-18 21:09:51 +08:00
|
|
|
if (!mpurate)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2009-12-09 07:18:47 +08:00
|
|
|
/* XXX test these for success */
|
|
|
|
dpll1_ck = clk_get(NULL, "dpll1_ck");
|
|
|
|
arm_fck = clk_get(NULL, "arm_fck");
|
|
|
|
core_ck = clk_get(NULL, "core_ck");
|
|
|
|
osc_sys_ck = clk_get(NULL, "osc_sys_ck");
|
|
|
|
|
2008-03-18 21:09:51 +08:00
|
|
|
/* REVISIT: not yet ready for 343x */
|
2009-12-09 07:18:47 +08:00
|
|
|
if (clk_set_rate(dpll1_ck, mpurate))
|
2009-09-04 01:13:58 +08:00
|
|
|
printk(KERN_ERR "*** Unable to set MPU rate\n");
|
2008-03-18 21:09:51 +08:00
|
|
|
|
|
|
|
recalculate_root_clocks();
|
|
|
|
|
2009-12-09 07:18:47 +08:00
|
|
|
osc_sys_rate = clk_get_rate(osc_sys_ck);
|
|
|
|
|
|
|
|
pr_info("Switched to new clocking rate (Crystal/Core/MPU): "
|
|
|
|
"%ld.%01ld/%ld/%ld MHz\n",
|
|
|
|
(osc_sys_rate / 1000000),
|
|
|
|
((osc_sys_rate / 100000) % 10),
|
|
|
|
(clk_get_rate(core_ck) / 1000000),
|
|
|
|
(clk_get_rate(arm_fck) / 1000000));
|
2009-09-04 01:13:58 +08:00
|
|
|
|
|
|
|
calibrate_delay();
|
2008-03-18 21:09:51 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
arch_initcall(omap2_clk_arch_init);
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|