aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorRoland Stigge <stigge@antcom.de>2012-04-22 05:59:47 -0400
committerRoland Stigge <stigge@antcom.de>2012-04-22 05:59:47 -0400
commitbe460385af1c40905dd6858a475bc949a3072b08 (patch)
treebaa676725d348a9f862e390478b91d021af2bd81 /drivers/i2c
parent1451ba3a5fa52d874e03a3380d053f3e6a5fcae4 (diff)
i2c-pnx.c: Remove duplicated i2c.h
The platforms using i2c-pnx.c both defined a duplicated i2c.h (used nowhere else). This patch removes those and integrates the contents into the driver itself. Signed-off-by: Roland Stigge <stigge@antcom.de> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-pnx.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 6fb97aef046..f69d80b8d73 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -24,13 +24,56 @@
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include <mach/hardware.h>
28#include <mach/i2c.h>
29
30#define I2C_PNX_TIMEOUT 10 /* msec */ 27#define I2C_PNX_TIMEOUT 10 /* msec */
31#define I2C_PNX_SPEED_KHZ 100 28#define I2C_PNX_SPEED_KHZ 100
32#define I2C_PNX_REGION_SIZE 0x100 29#define I2C_PNX_REGION_SIZE 0x100
33 30
31enum {
32 mstatus_tdi = 0x00000001,
33 mstatus_afi = 0x00000002,
34 mstatus_nai = 0x00000004,
35 mstatus_drmi = 0x00000008,
36 mstatus_active = 0x00000020,
37 mstatus_scl = 0x00000040,
38 mstatus_sda = 0x00000080,
39 mstatus_rff = 0x00000100,
40 mstatus_rfe = 0x00000200,
41 mstatus_tff = 0x00000400,
42 mstatus_tfe = 0x00000800,
43};
44
45enum {
46 mcntrl_tdie = 0x00000001,
47 mcntrl_afie = 0x00000002,
48 mcntrl_naie = 0x00000004,
49 mcntrl_drmie = 0x00000008,
50 mcntrl_daie = 0x00000020,
51 mcntrl_rffie = 0x00000040,
52 mcntrl_tffie = 0x00000080,
53 mcntrl_reset = 0x00000100,
54 mcntrl_cdbmode = 0x00000400,
55};
56
57enum {
58 rw_bit = 1 << 0,
59 start_bit = 1 << 8,
60 stop_bit = 1 << 9,
61};
62
63#define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */
64#define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */
65#define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */
66#define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */
67#define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */
68#define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */
69#define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */
70#define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */
71#define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */
72#define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */
73#define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */
74#define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */
75#define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */
76
34static inline int wait_timeout(long timeout, struct i2c_pnx_algo_data *data) 77static inline int wait_timeout(long timeout, struct i2c_pnx_algo_data *data)
35{ 78{
36 while (timeout > 0 && 79 while (timeout > 0 &&