Purna Chandra Mandal | ce6e118 | 2016-05-13 13:22:40 +0530 | [diff] [blame] | 1 | /* |
| 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 */ |
| 20 | struct pic32_clk_common { |
| 21 | struct device *dev; |
| 22 | void __iomem *iobase; |
| 23 | spinlock_t reg_lock; /* clock lock */ |
| 24 | }; |
| 25 | |
| 26 | /* System PLL clock */ |
| 27 | struct 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 */ |
| 35 | struct 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 */ |
| 44 | struct 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 */ |
| 51 | struct pic32_periph_clk_data { |
| 52 | struct clk_init_data init_data; |
| 53 | const u32 ctrl_reg; |
| 54 | }; |
| 55 | |
| 56 | /* External Secondary Oscillator clock */ |
| 57 | struct 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 | |
| 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; |
| 72 | |
| 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); |
| 83 | |
| 84 | #endif /* __MICROCHIP_CLK_PIC32_H_*/ |