Simon Arlott | 75fabc3 | 2012-09-10 23:26:15 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 Broadcom |
| 3 | * Copyright (C) 2012 Stephen Warren |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | */ |
| 19 | |
| 20 | #include <linux/clk-provider.h> |
| 21 | #include <linux/clkdev.h> |
| 22 | #include <linux/clk/bcm2835.h> |
Stephen Warren | 526d239 | 2012-12-24 21:55:01 -0700 | [diff] [blame] | 23 | #include <linux/clk-provider.h> |
| 24 | #include <linux/of.h> |
| 25 | |
| 26 | static const __initconst struct of_device_id clk_match[] = { |
| 27 | { .compatible = "fixed-clock", .data = of_fixed_clk_setup, }, |
| 28 | { } |
| 29 | }; |
Simon Arlott | 75fabc3 | 2012-09-10 23:26:15 -0600 | [diff] [blame] | 30 | |
| 31 | /* |
| 32 | * These are fixed clocks. They're probably not all root clocks and it may |
| 33 | * be possible to turn them on and off but until this is mapped out better |
| 34 | * it's the only way they can be used. |
| 35 | */ |
| 36 | void __init bcm2835_init_clocks(void) |
| 37 | { |
| 38 | struct clk *clk; |
| 39 | int ret; |
| 40 | |
| 41 | clk = clk_register_fixed_rate(NULL, "sys_pclk", NULL, CLK_IS_ROOT, |
| 42 | 250000000); |
Wei Yongjun | 0de9f23 | 2012-10-09 10:46:00 +0800 | [diff] [blame] | 43 | if (IS_ERR(clk)) |
Simon Arlott | 75fabc3 | 2012-09-10 23:26:15 -0600 | [diff] [blame] | 44 | pr_err("sys_pclk not registered\n"); |
| 45 | |
| 46 | clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, CLK_IS_ROOT, |
| 47 | 126000000); |
Wei Yongjun | 0de9f23 | 2012-10-09 10:46:00 +0800 | [diff] [blame] | 48 | if (IS_ERR(clk)) |
Simon Arlott | 75fabc3 | 2012-09-10 23:26:15 -0600 | [diff] [blame] | 49 | pr_err("apb_pclk not registered\n"); |
| 50 | |
| 51 | clk = clk_register_fixed_rate(NULL, "uart0_pclk", NULL, CLK_IS_ROOT, |
| 52 | 3000000); |
Wei Yongjun | 0de9f23 | 2012-10-09 10:46:00 +0800 | [diff] [blame] | 53 | if (IS_ERR(clk)) |
Simon Arlott | 75fabc3 | 2012-09-10 23:26:15 -0600 | [diff] [blame] | 54 | pr_err("uart0_pclk not registered\n"); |
| 55 | ret = clk_register_clkdev(clk, NULL, "20201000.uart"); |
| 56 | if (ret) |
| 57 | pr_err("uart0_pclk alias not registered\n"); |
| 58 | |
| 59 | clk = clk_register_fixed_rate(NULL, "uart1_pclk", NULL, CLK_IS_ROOT, |
| 60 | 125000000); |
Wei Yongjun | 0de9f23 | 2012-10-09 10:46:00 +0800 | [diff] [blame] | 61 | if (IS_ERR(clk)) |
Simon Arlott | 75fabc3 | 2012-09-10 23:26:15 -0600 | [diff] [blame] | 62 | pr_err("uart1_pclk not registered\n"); |
| 63 | ret = clk_register_clkdev(clk, NULL, "20215000.uart"); |
| 64 | if (ret) |
Domenico Andreoli | 686ea585 | 2012-10-20 03:35:28 +0200 | [diff] [blame] | 65 | pr_err("uart1_pclk alias not registered\n"); |
Stephen Warren | 526d239 | 2012-12-24 21:55:01 -0700 | [diff] [blame] | 66 | |
| 67 | of_clk_init(clk_match); |
Simon Arlott | 75fabc3 | 2012-09-10 23:26:15 -0600 | [diff] [blame] | 68 | } |