0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LINUX_MFD_KEMPLD_H_
0010 #define _LINUX_MFD_KEMPLD_H_
0011
0012
0013 #define KEMPLD_IOINDEX 0xa80
0014 #define KEMPLD_IODATA 0xa81
0015 #define KEMPLD_MUTEX_KEY 0x80
0016 #define KEMPLD_VERSION 0x00
0017 #define KEMPLD_VERSION_LSB 0x00
0018 #define KEMPLD_VERSION_MSB 0x01
0019 #define KEMPLD_VERSION_GET_MINOR(x) (x & 0x1f)
0020 #define KEMPLD_VERSION_GET_MAJOR(x) ((x >> 5) & 0x1f)
0021 #define KEMPLD_VERSION_GET_NUMBER(x) ((x >> 10) & 0xf)
0022 #define KEMPLD_VERSION_GET_TYPE(x) ((x >> 14) & 0x3)
0023 #define KEMPLD_BUILDNR 0x02
0024 #define KEMPLD_BUILDNR_LSB 0x02
0025 #define KEMPLD_BUILDNR_MSB 0x03
0026 #define KEMPLD_FEATURE 0x04
0027 #define KEMPLD_FEATURE_LSB 0x04
0028 #define KEMPLD_FEATURE_MSB 0x05
0029 #define KEMPLD_FEATURE_BIT_I2C (1 << 0)
0030 #define KEMPLD_FEATURE_BIT_WATCHDOG (1 << 1)
0031 #define KEMPLD_FEATURE_BIT_GPIO (1 << 2)
0032 #define KEMPLD_FEATURE_MASK_UART (7 << 3)
0033 #define KEMPLD_FEATURE_BIT_NMI (1 << 8)
0034 #define KEMPLD_FEATURE_BIT_SMI (1 << 9)
0035 #define KEMPLD_FEATURE_BIT_SCI (1 << 10)
0036 #define KEMPLD_SPEC 0x06
0037 #define KEMPLD_SPEC_GET_MINOR(x) (x & 0x0f)
0038 #define KEMPLD_SPEC_GET_MAJOR(x) ((x >> 4) & 0x0f)
0039 #define KEMPLD_IRQ_GPIO 0x35
0040 #define KEMPLD_IRQ_I2C 0x36
0041 #define KEMPLD_CFG 0x37
0042 #define KEMPLD_CFG_GPIO_I2C_MUX (1 << 0)
0043 #define KEMPLD_CFG_BIOS_WP (1 << 7)
0044
0045 #define KEMPLD_CLK 33333333
0046
0047 #define KEMPLD_TYPE_RELEASE 0x0
0048 #define KEMPLD_TYPE_DEBUG 0x1
0049 #define KEMPLD_TYPE_CUSTOM 0x2
0050
0051 #define KEMPLD_VERSION_LEN 10
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064 struct kempld_info {
0065 unsigned int major;
0066 unsigned int minor;
0067 unsigned int buildnr;
0068 unsigned int number;
0069 unsigned int type;
0070 unsigned int spec_major;
0071 unsigned int spec_minor;
0072 char version[KEMPLD_VERSION_LEN];
0073 };
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086 struct kempld_device_data {
0087 void __iomem *io_base;
0088 void __iomem *io_index;
0089 void __iomem *io_data;
0090 u32 pld_clock;
0091 u32 feature_mask;
0092 struct device *dev;
0093 struct kempld_info info;
0094 struct mutex lock;
0095 };
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107 struct kempld_platform_data {
0108 u32 pld_clock;
0109 int gpio_base;
0110 struct resource *ioresource;
0111 void (*get_hardware_mutex) (struct kempld_device_data *);
0112 void (*release_hardware_mutex) (struct kempld_device_data *);
0113 int (*get_info) (struct kempld_device_data *);
0114 int (*register_cells) (struct kempld_device_data *);
0115 };
0116
0117 extern void kempld_get_mutex(struct kempld_device_data *pld);
0118 extern void kempld_release_mutex(struct kempld_device_data *pld);
0119 extern u8 kempld_read8(struct kempld_device_data *pld, u8 index);
0120 extern void kempld_write8(struct kempld_device_data *pld, u8 index, u8 data);
0121 extern u16 kempld_read16(struct kempld_device_data *pld, u8 index);
0122 extern void kempld_write16(struct kempld_device_data *pld, u8 index, u16 data);
0123 extern u32 kempld_read32(struct kempld_device_data *pld, u8 index);
0124 extern void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data);
0125
0126 #endif