diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-arm/arch-pnx4008/i2c.h | 67 | ||||
-rw-r--r-- | include/linux/i2c-pnx.h | 43 |
2 files changed, 110 insertions, 0 deletions
diff --git a/include/asm-arm/arch-pnx4008/i2c.h b/include/asm-arm/arch-pnx4008/i2c.h new file mode 100644 index 000000000000..92e8d65006f7 --- /dev/null +++ b/include/asm-arm/arch-pnx4008/i2c.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * PNX4008-specific tweaks for I2C IP3204 block | ||
3 | * | ||
4 | * Author: Vitaly Wool <vwool@ru.mvista.com> | ||
5 | * | ||
6 | * 2005 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASM_ARCH_I2C_H__ | ||
13 | #define __ASM_ARCH_I2C_H__ | ||
14 | |||
15 | #include <linux/pm.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | enum { | ||
19 | mstatus_tdi = 0x00000001, | ||
20 | mstatus_afi = 0x00000002, | ||
21 | mstatus_nai = 0x00000004, | ||
22 | mstatus_drmi = 0x00000008, | ||
23 | mstatus_active = 0x00000020, | ||
24 | mstatus_scl = 0x00000040, | ||
25 | mstatus_sda = 0x00000080, | ||
26 | mstatus_rff = 0x00000100, | ||
27 | mstatus_rfe = 0x00000200, | ||
28 | mstatus_tff = 0x00000400, | ||
29 | mstatus_tfe = 0x00000800, | ||
30 | }; | ||
31 | |||
32 | enum { | ||
33 | mcntrl_tdie = 0x00000001, | ||
34 | mcntrl_afie = 0x00000002, | ||
35 | mcntrl_naie = 0x00000004, | ||
36 | mcntrl_drmie = 0x00000008, | ||
37 | mcntrl_daie = 0x00000020, | ||
38 | mcntrl_rffie = 0x00000040, | ||
39 | mcntrl_tffie = 0x00000080, | ||
40 | mcntrl_reset = 0x00000100, | ||
41 | mcntrl_cdbmode = 0x00000400, | ||
42 | }; | ||
43 | |||
44 | enum { | ||
45 | rw_bit = 1 << 0, | ||
46 | start_bit = 1 << 8, | ||
47 | stop_bit = 1 << 9, | ||
48 | }; | ||
49 | |||
50 | #define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */ | ||
51 | #define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */ | ||
52 | #define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */ | ||
53 | #define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */ | ||
54 | #define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */ | ||
55 | #define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */ | ||
56 | #define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */ | ||
57 | #define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */ | ||
58 | #define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */ | ||
59 | #define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */ | ||
60 | #define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */ | ||
61 | #define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */ | ||
62 | #define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */ | ||
63 | |||
64 | #define HCLK_MHZ 13 | ||
65 | #define I2C_CHIP_NAME "PNX4008-I2C" | ||
66 | |||
67 | #endif /* __ASM_ARCH_I2C_H___ */ | ||
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h new file mode 100644 index 000000000000..e6e9c814da61 --- /dev/null +++ b/include/linux/i2c-pnx.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Header file for I2C support on PNX010x/4008. | ||
3 | * | ||
4 | * Author: Dennis Kovalev <dkovalev@ru.mvista.com> | ||
5 | * | ||
6 | * 2004-2006 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | |||
12 | #ifndef __I2C_PNX_H__ | ||
13 | #define __I2C_PNX_H__ | ||
14 | |||
15 | #include <asm/arch/i2c.h> | ||
16 | |||
17 | struct i2c_pnx_mif { | ||
18 | int ret; /* Return value */ | ||
19 | int mode; /* Interface mode */ | ||
20 | struct completion complete; /* I/O completion */ | ||
21 | struct timer_list timer; /* Timeout */ | ||
22 | char * buf; /* Data buffer */ | ||
23 | int len; /* Length of data buffer */ | ||
24 | }; | ||
25 | |||
26 | struct i2c_pnx_algo_data { | ||
27 | u32 base; | ||
28 | u32 ioaddr; | ||
29 | int irq; | ||
30 | struct i2c_pnx_mif mif; | ||
31 | int last; | ||
32 | }; | ||
33 | |||
34 | struct i2c_pnx_data { | ||
35 | int (*suspend) (struct platform_device *pdev, pm_message_t state); | ||
36 | int (*resume) (struct platform_device *pdev); | ||
37 | u32 (*calculate_input_freq) (struct platform_device *pdev); | ||
38 | int (*set_clock_run) (struct platform_device *pdev); | ||
39 | int (*set_clock_stop) (struct platform_device *pdev); | ||
40 | struct i2c_adapter *adapter; | ||
41 | }; | ||
42 | |||
43 | #endif /* __I2C_PNX_H__ */ | ||