3 * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 #ifndef __MICROCHIP_CLK_PIC32_H_
15 #define __MICROCHIP_CLK_PIC32_H_
17 #include <linux/clk-provider.h>
19 /* PIC32 clock data */
20 struct pic32_clk_common {
23 spinlock_t reg_lock; /* clock lock */
26 /* System PLL clock */
27 struct pic32_sys_pll_data {
28 struct clk_init_data init_data;
35 struct pic32_sys_clk_data {
36 struct clk_init_data init_data;
39 const u32 *parent_map;
43 /* Reference Oscillator clock */
44 struct pic32_ref_osc_data {
45 struct clk_init_data init_data;
47 const u32 *parent_map;
50 /* Peripheral Bus clock */
51 struct pic32_periph_clk_data {
52 struct clk_init_data init_data;
56 /* External Secondary Oscillator clock */
57 struct pic32_sec_osc_data {
58 struct clk_init_data init_data;
61 const u32 enable_mask;
62 const u32 status_mask;
63 const unsigned long fixed_rate;
66 extern const struct clk_ops pic32_pbclk_ops;
67 extern const struct clk_ops pic32_sclk_ops;
68 extern const struct clk_ops pic32_sclk_no_div_ops;
69 extern const struct clk_ops pic32_spll_ops;
70 extern const struct clk_ops pic32_roclk_ops;
71 extern const struct clk_ops pic32_sosc_ops;
73 struct clk *pic32_periph_clk_register(const struct pic32_periph_clk_data *data,
74 struct pic32_clk_common *core);
75 struct clk *pic32_refo_clk_register(const struct pic32_ref_osc_data *data,
76 struct pic32_clk_common *core);
77 struct clk *pic32_sys_clk_register(const struct pic32_sys_clk_data *data,
78 struct pic32_clk_common *core);
79 struct clk *pic32_spll_clk_register(const struct pic32_sys_pll_data *data,
80 struct pic32_clk_common *core);
81 struct clk *pic32_sosc_clk_register(const struct pic32_sec_osc_data *data,
82 struct pic32_clk_common *core);
84 #endif /* __MICROCHIP_CLK_PIC32_H_*/