1
2
3
4
5
6
7
8
9 #ifndef _LINUX_MFD_KEMPLD_H_
10 #define _LINUX_MFD_KEMPLD_H_
11
12
13 #define KEMPLD_IOINDEX 0xa80
14 #define KEMPLD_IODATA 0xa81
15 #define KEMPLD_MUTEX_KEY 0x80
16 #define KEMPLD_VERSION 0x00
17 #define KEMPLD_VERSION_LSB 0x00
18 #define KEMPLD_VERSION_MSB 0x01
19 #define KEMPLD_VERSION_GET_MINOR(x) (x & 0x1f)
20 #define KEMPLD_VERSION_GET_MAJOR(x) ((x >> 5) & 0x1f)
21 #define KEMPLD_VERSION_GET_NUMBER(x) ((x >> 10) & 0xf)
22 #define KEMPLD_VERSION_GET_TYPE(x) ((x >> 14) & 0x3)
23 #define KEMPLD_BUILDNR 0x02
24 #define KEMPLD_BUILDNR_LSB 0x02
25 #define KEMPLD_BUILDNR_MSB 0x03
26 #define KEMPLD_FEATURE 0x04
27 #define KEMPLD_FEATURE_LSB 0x04
28 #define KEMPLD_FEATURE_MSB 0x05
29 #define KEMPLD_FEATURE_BIT_I2C (1 << 0)
30 #define KEMPLD_FEATURE_BIT_WATCHDOG (1 << 1)
31 #define KEMPLD_FEATURE_BIT_GPIO (1 << 2)
32 #define KEMPLD_FEATURE_MASK_UART (7 << 3)
33 #define KEMPLD_FEATURE_BIT_NMI (1 << 8)
34 #define KEMPLD_FEATURE_BIT_SMI (1 << 9)
35 #define KEMPLD_FEATURE_BIT_SCI (1 << 10)
36 #define KEMPLD_SPEC 0x06
37 #define KEMPLD_SPEC_GET_MINOR(x) (x & 0x0f)
38 #define KEMPLD_SPEC_GET_MAJOR(x) ((x >> 4) & 0x0f)
39 #define KEMPLD_IRQ_GPIO 0x35
40 #define KEMPLD_IRQ_I2C 0x36
41 #define KEMPLD_CFG 0x37
42 #define KEMPLD_CFG_GPIO_I2C_MUX (1 << 0)
43 #define KEMPLD_CFG_BIOS_WP (1 << 7)
44
45 #define KEMPLD_CLK 33333333
46
47 #define KEMPLD_TYPE_RELEASE 0x0
48 #define KEMPLD_TYPE_DEBUG 0x1
49 #define KEMPLD_TYPE_CUSTOM 0x2
50
51 #define KEMPLD_VERSION_LEN 10
52
53
54
55
56
57
58
59
60
61
62
63
64 struct kempld_info {
65 unsigned int major;
66 unsigned int minor;
67 unsigned int buildnr;
68 unsigned int number;
69 unsigned int type;
70 unsigned int spec_major;
71 unsigned int spec_minor;
72 char version[KEMPLD_VERSION_LEN];
73 };
74
75
76
77
78
79
80
81
82
83
84
85
86 struct kempld_device_data {
87 void __iomem *io_base;
88 void __iomem *io_index;
89 void __iomem *io_data;
90 u32 pld_clock;
91 u32 feature_mask;
92 struct device *dev;
93 struct kempld_info info;
94 struct mutex lock;
95 };
96
97
98
99
100
101
102
103
104
105
106
107 struct kempld_platform_data {
108 u32 pld_clock;
109 int gpio_base;
110 struct resource *ioresource;
111 void (*get_hardware_mutex) (struct kempld_device_data *);
112 void (*release_hardware_mutex) (struct kempld_device_data *);
113 int (*get_info) (struct kempld_device_data *);
114 int (*register_cells) (struct kempld_device_data *);
115 };
116
117 extern void kempld_get_mutex(struct kempld_device_data *pld);
118 extern void kempld_release_mutex(struct kempld_device_data *pld);
119 extern u8 kempld_read8(struct kempld_device_data *pld, u8 index);
120 extern void kempld_write8(struct kempld_device_data *pld, u8 index, u8 data);
121 extern u16 kempld_read16(struct kempld_device_data *pld, u8 index);
122 extern void kempld_write16(struct kempld_device_data *pld, u8 index, u16 data);
123 extern u32 kempld_read32(struct kempld_device_data *pld, u8 index);
124 extern void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data);
125
126 #endif