Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 1 | /* |
Paul Walmsley | da4d290 | 2010-01-26 20:13:10 -0700 | [diff] [blame] | 2 | * clock2xxx.c - OMAP2xxx-specific clock integration code |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 3 | * |
Paul Walmsley | da4d290 | 2010-01-26 20:13:10 -0700 | [diff] [blame] | 4 | * Copyright (C) 2005-2008 Texas Instruments, Inc. |
| 5 | * Copyright (C) 2004-2010 Nokia Corporation |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 6 | * |
Paul Walmsley | da4d290 | 2010-01-26 20:13:10 -0700 | [diff] [blame] | 7 | * Contacts: |
| 8 | * Richard Woodruff <r-woodruff2@ti.com> |
| 9 | * Paul Walmsley |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 10 | * |
Paul Walmsley | da4d290 | 2010-01-26 20:13:10 -0700 | [diff] [blame] | 11 | * Based on earlier work by Tuukka Tikkanen, Tony Lindgren, |
| 12 | * Gordon McNutt and RidgeRun, Inc. |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 13 | * |
| 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 Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 20 | #include <linux/kernel.h> |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 21 | #include <linux/errno.h> |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 22 | #include <linux/clk.h> |
| 23 | #include <linux/io.h> |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 24 | |
Tony Lindgren | 2c799ce | 2012-02-24 10:34:35 -0800 | [diff] [blame] | 25 | #include <plat/cpu.h> |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 26 | #include <plat/clock.h> |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 27 | |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 28 | #include "clock.h" |
| 29 | #include "clock2xxx.h" |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 30 | #include "cm.h" |
| 31 | #include "cm-regbits-24xx.h" |
| 32 | |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 33 | struct clk *vclk, *sclk, *dclk; |
| 34 | |
Paul Walmsley | da4d290 | 2010-01-26 20:13:10 -0700 | [diff] [blame] | 35 | /* |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 36 | * Omap24xx specific clock functions |
Paul Walmsley | da4d290 | 2010-01-26 20:13:10 -0700 | [diff] [blame] | 37 | */ |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 38 | |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 39 | /* |
| 40 | * Set clocks for bypass mode for reboot to work. |
| 41 | */ |
Paul Walmsley | feec127 | 2010-01-26 20:13:11 -0700 | [diff] [blame] | 42 | void omap2xxx_clk_prepare_for_reboot(void) |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 43 | { |
| 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 Walmsley | 4d30e82 | 2010-02-22 22:09:36 -0700 | [diff] [blame] | 54 | * 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 Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 57 | */ |
Paul Walmsley | 4680c29 | 2010-01-26 20:13:09 -0700 | [diff] [blame] | 58 | static int __init omap2xxx_clk_arch_init(void) |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 59 | { |
Paul Walmsley | 4d30e82 | 2010-02-22 22:09:36 -0700 | [diff] [blame] | 60 | int ret; |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 61 | |
Paul Walmsley | 4680c29 | 2010-01-26 20:13:09 -0700 | [diff] [blame] | 62 | if (!cpu_is_omap24xx()) |
| 63 | return 0; |
| 64 | |
Paul Walmsley | 4d30e82 | 2010-02-22 22:09:36 -0700 | [diff] [blame] | 65 | 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 Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 68 | |
Paul Walmsley | 4d30e82 | 2010-02-22 22:09:36 -0700 | [diff] [blame] | 69 | return ret; |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 70 | } |
Paul Walmsley | 4d30e82 | 2010-02-22 22:09:36 -0700 | [diff] [blame] | 71 | |
Paul Walmsley | 4680c29 | 2010-01-26 20:13:09 -0700 | [diff] [blame] | 72 | arch_initcall(omap2xxx_clk_arch_init); |
Paul Walmsley | d8a9445 | 2009-12-08 16:21:29 -0700 | [diff] [blame] | 73 | |
| 74 | |