blob: 856664277a29078dea8000c969d12f40dc80f1ad [file] [log] [blame]
Purna Chandra Mandalce6e1182016-05-13 13:22:40 +05301/*
2 * Purna Chandra Mandal,<purna.mandal@microchip.com>
3 * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
4 *
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.
8 *
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
12 * for more details.
13 */
14#ifndef __MICROCHIP_CLK_PIC32_H_
15#define __MICROCHIP_CLK_PIC32_H_
16
17#include <linux/clk-provider.h>
18
19/* PIC32 clock data */
20struct pic32_clk_common {
21 struct device *dev;
22 void __iomem *iobase;
23 spinlock_t reg_lock; /* clock lock */
24};
25
26/* System PLL clock */
27struct pic32_sys_pll_data {
28 struct clk_init_data init_data;
29 const u32 ctrl_reg;
30 const u32 status_reg;
31 const u32 lock_mask;
32};
33
34/* System clock */
35struct pic32_sys_clk_data {
36 struct clk_init_data init_data;
37 const u32 mux_reg;
38 const u32 slew_reg;
39 const u32 *parent_map;
40 const u32 slew_div;
41};
42
43/* Reference Oscillator clock */
44struct pic32_ref_osc_data {
45 struct clk_init_data init_data;
46 const u32 ctrl_reg;
47 const u32 *parent_map;
48};
49
50/* Peripheral Bus clock */
51struct pic32_periph_clk_data {
52 struct clk_init_data init_data;
53 const u32 ctrl_reg;
54};
55
56/* External Secondary Oscillator clock */
57struct pic32_sec_osc_data {
58 struct clk_init_data init_data;
59 const u32 enable_reg;
60 const u32 status_reg;
61 const u32 enable_mask;
62 const u32 status_mask;
63 const unsigned long fixed_rate;
64};
65
66extern const struct clk_ops pic32_pbclk_ops;
67extern const struct clk_ops pic32_sclk_ops;
68extern const struct clk_ops pic32_sclk_no_div_ops;
69extern const struct clk_ops pic32_spll_ops;
70extern const struct clk_ops pic32_roclk_ops;
71extern const struct clk_ops pic32_sosc_ops;
72
73struct clk *pic32_periph_clk_register(const struct pic32_periph_clk_data *data,
74 struct pic32_clk_common *core);
75struct clk *pic32_refo_clk_register(const struct pic32_ref_osc_data *data,
76 struct pic32_clk_common *core);
77struct clk *pic32_sys_clk_register(const struct pic32_sys_clk_data *data,
78 struct pic32_clk_common *core);
79struct clk *pic32_spll_clk_register(const struct pic32_sys_pll_data *data,
80 struct pic32_clk_common *core);
81struct clk *pic32_sosc_clk_register(const struct pic32_sec_osc_data *data,
82 struct pic32_clk_common *core);
83
84#endif /* __MICROCHIP_CLK_PIC32_H_*/