blob: c6eded5eea767ae0c519138346cd8cdf4284f80b [file] [log] [blame]
Tero Kristoa8acecc2013-07-18 11:52:33 +03001/*
2 * TI clock drivers support
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#ifndef __LINUX_CLK_TI_H__
16#define __LINUX_CLK_TI_H__
17
18#include <linux/clkdev.h>
19
20/**
21 * struct ti_dt_clk - OMAP DT clock alias declarations
22 * @lk: clock lookup definition
23 * @node_name: clock DT node to map to
24 */
25struct ti_dt_clk {
26 struct clk_lookup lk;
27 char *node_name;
28};
29
30#define DT_CLK(dev, con, name) \
31 { \
32 .lk = { \
33 .dev_id = dev, \
34 .con_id = con, \
35 }, \
36 .node_name = name, \
37 }
38
Tero Kristo819b4862013-10-22 11:39:36 +030039/* Maximum number of clock memmaps */
40#define CLK_MAX_MEMMAPS 4
Tero Kristoa8acecc2013-07-18 11:52:33 +030041
Tero Kristo819b4862013-10-22 11:39:36 +030042typedef void (*ti_of_clk_init_cb_t)(struct clk_hw *, struct device_node *);
43
44/**
45 * struct clk_omap_reg - OMAP register declaration
46 * @offset: offset from the master IP module base address
47 * @index: index of the master IP module
48 */
49struct clk_omap_reg {
50 u16 offset;
51 u16 index;
52};
53
54/**
55 * struct ti_clk_ll_ops - low-level register access ops for a clock
56 * @clk_readl: pointer to register read function
57 * @clk_writel: pointer to register write function
58 *
59 * Low-level register access ops are generally used by the basic clock types
60 * (clk-gate, clk-mux, clk-divider etc.) to provide support for various
61 * low-level hardware interfaces (direct MMIO, regmap etc.), but can also be
62 * used by other hardware-specific clock drivers if needed.
63 */
64struct ti_clk_ll_ops {
65 u32 (*clk_readl)(void __iomem *reg);
66 void (*clk_writel)(u32 val, void __iomem *reg);
67};
68
69extern struct ti_clk_ll_ops *ti_clk_ll_ops;
70
71void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index);
Tero Kristoa8acecc2013-07-18 11:52:33 +030072void ti_dt_clocks_register(struct ti_dt_clk *oclks);
Tero Kristo819b4862013-10-22 11:39:36 +030073void ti_dt_clk_init_provider(struct device_node *np, int index);
74int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
75 ti_of_clk_init_cb_t func);
Tero Kristoa8acecc2013-07-18 11:52:33 +030076
77#endif