blob: e92be1fc1a00f7ccfeb2c7d11f83f22085de2b24 [file] [log] [blame]
Paul Walmsleyd8a94452009-12-08 16:21:29 -07001/*
Paul Walmsleyda4d2902010-01-26 20:13:10 -07002 * clock2xxx.c - OMAP2xxx-specific clock integration code
Paul Walmsleyd8a94452009-12-08 16:21:29 -07003 *
Paul Walmsleyda4d2902010-01-26 20:13:10 -07004 * Copyright (C) 2005-2008 Texas Instruments, Inc.
5 * Copyright (C) 2004-2010 Nokia Corporation
Paul Walmsleyd8a94452009-12-08 16:21:29 -07006 *
Paul Walmsleyda4d2902010-01-26 20:13:10 -07007 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
Paul Walmsleyd8a94452009-12-08 16:21:29 -070010 *
Paul Walmsleyda4d2902010-01-26 20:13:10 -070011 * Based on earlier work by Tuukka Tikkanen, Tony Lindgren,
12 * Gordon McNutt and RidgeRun, Inc.
Paul Walmsleyd8a94452009-12-08 16:21:29 -070013 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18#undef DEBUG
19
Paul Walmsleyd8a94452009-12-08 16:21:29 -070020#include <linux/kernel.h>
Paul Walmsleyd8a94452009-12-08 16:21:29 -070021#include <linux/errno.h>
Paul Walmsleyd8a94452009-12-08 16:21:29 -070022#include <linux/clk.h>
23#include <linux/io.h>
Paul Walmsleyd8a94452009-12-08 16:21:29 -070024
25#include <plat/clock.h>
Paul Walmsleyd8a94452009-12-08 16:21:29 -070026
Tony Lindgrendbc04162012-08-31 10:59:07 -070027#include "soc.h"
Paul Walmsleyd8a94452009-12-08 16:21:29 -070028#include "clock.h"
29#include "clock2xxx.h"
Paul Walmsleyd8a94452009-12-08 16:21:29 -070030#include "cm.h"
31#include "cm-regbits-24xx.h"
32
Paul Walmsleyd8a94452009-12-08 16:21:29 -070033struct clk *vclk, *sclk, *dclk;
34
Paul Walmsleyda4d2902010-01-26 20:13:10 -070035/*
Paul Walmsleyd8a94452009-12-08 16:21:29 -070036 * Omap24xx specific clock functions
Paul Walmsleyda4d2902010-01-26 20:13:10 -070037 */
Paul Walmsleyd8a94452009-12-08 16:21:29 -070038
Paul Walmsleyd8a94452009-12-08 16:21:29 -070039/*
40 * Set clocks for bypass mode for reboot to work.
41 */
Paul Walmsleyfeec1272010-01-26 20:13:11 -070042void omap2xxx_clk_prepare_for_reboot(void)
Paul Walmsleyd8a94452009-12-08 16:21:29 -070043{
44 u32 rate;
45
46 if (vclk == NULL || sclk == NULL)
47 return;
48
49 rate = clk_get_rate(sclk);
50 clk_set_rate(vclk, rate);
51}
52
53/*
Paul Walmsley4d30e822010-02-22 22:09:36 -070054 * Switch the MPU rate if specified on cmdline. We cannot do this
55 * early until cmdline is parsed. XXX This should be removed from the
56 * clock code and handled by the OPP layer code in the near future.
Paul Walmsleyd8a94452009-12-08 16:21:29 -070057 */
Paul Walmsley4680c292010-01-26 20:13:09 -070058static int __init omap2xxx_clk_arch_init(void)
Paul Walmsleyd8a94452009-12-08 16:21:29 -070059{
Paul Walmsley4d30e822010-02-22 22:09:36 -070060 int ret;
Paul Walmsleyd8a94452009-12-08 16:21:29 -070061
Paul Walmsley4680c292010-01-26 20:13:09 -070062 if (!cpu_is_omap24xx())
63 return 0;
64
Paul Walmsley4d30e822010-02-22 22:09:36 -070065 ret = omap2_clk_switch_mpurate_at_boot("virt_prcm_set");
66 if (!ret)
67 omap2_clk_print_new_rates("sys_ck", "dpll_ck", "mpu_ck");
Paul Walmsleyd8a94452009-12-08 16:21:29 -070068
Paul Walmsley4d30e822010-02-22 22:09:36 -070069 return ret;
Paul Walmsleyd8a94452009-12-08 16:21:29 -070070}
Paul Walmsley4d30e822010-02-22 22:09:36 -070071
Paul Walmsley4680c292010-01-26 20:13:09 -070072arch_initcall(omap2xxx_clk_arch_init);
Paul Walmsleyd8a94452009-12-08 16:21:29 -070073
74