blob: a98a39bbd8839e446e6be44defd9bdb4cd615358 [file] [log] [blame]
Andrew Victor2eeaaa22006-09-27 10:50:59 +01001/*
Andrew Victor9d041262007-02-05 11:42:07 +01002 * linux/arch/arm/mach-at91/clock.h
Andrew Victor2eeaaa22006-09-27 10:50:59 +01003 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
Jean-Christophe PLAGNIOL-VILLARDbd602992011-02-02 07:27:07 +01009#include <linux/clkdev.h>
10
Andrew Victor2eeaaa22006-09-27 10:50:59 +010011#define CLK_TYPE_PRIMARY 0x1
12#define CLK_TYPE_PLL 0x2
13#define CLK_TYPE_PROGRAMMABLE 0x4
14#define CLK_TYPE_PERIPHERAL 0x8
Andrew Victord481f862006-12-01 11:27:31 +010015#define CLK_TYPE_SYSTEM 0x10
Andrew Victor2eeaaa22006-09-27 10:50:59 +010016
17
18struct clk {
19 struct list_head node;
20 const char *name; /* unique clock name */
Jean-Christophe PLAGNIOL-VILLARDbd602992011-02-02 07:27:07 +010021 struct clk_lookup cl;
Andrew Victor2eeaaa22006-09-27 10:50:59 +010022 unsigned long rate_hz;
Ludovic Desroches8f4b4792013-03-22 13:24:12 +000023 unsigned div; /* parent clock divider */
Andrew Victor2eeaaa22006-09-27 10:50:59 +010024 struct clk *parent;
Ludovic Desroches8f4b4792013-03-22 13:24:12 +000025 unsigned pid; /* peripheral ID */
Andrew Victor2eeaaa22006-09-27 10:50:59 +010026 u32 pmc_mask;
27 void (*mode)(struct clk *, int);
Andrew Victor5e38efa2009-12-15 21:57:27 +010028 unsigned id:3; /* PCK0..4, or 32k/main/a/b */
Andrew Victor2eeaaa22006-09-27 10:50:59 +010029 unsigned type; /* clock type */
30 u16 users;
31};
32
33
34extern int __init clk_register(struct clk *clk);
Jean-Christophe PLAGNIOL-VILLARDbd602992011-02-02 07:27:07 +010035extern struct clk mck;
36extern struct clk utmi_clk;
37
38#define CLKDEV_CON_ID(_id, _clk) \
39 { \
40 .con_id = _id, \
41 .clk = _clk, \
42 }
43
44#define CLKDEV_CON_DEV_ID(_con_id, _dev_id, _clk) \
45 { \
46 .con_id = _con_id, \
47 .dev_id = _dev_id, \
48 .clk = _clk, \
49 }