1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * drivers/i2c/busses/i2c-ibm_iic.h
5 * Support for the IIC peripheral on IBM PPC 4xx
7 * Copyright (c) 2003 Zultys Technologies.
8 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
10 * Based on original work by
11 * Ian DaSilva <idasilva@mvista.com>
12 * Armin Kuster <akuster@mvista.com>
13 * Matt Porter <mporter@mvista.com>
15 * Copyright 2000-2003 MontaVista Software Inc.
17 #ifndef __I2C_IBM_IIC_H_
18 #define __I2C_IBM_IIC_H_
20 #include <linux/i2c.h>
40 struct ibm_iic_private
{
41 struct i2c_adapter adap
;
42 volatile struct iic_regs __iomem
*vaddr
;
50 /* IICx_CNTL register */
53 #define CNTL_TCT_MASK 0x30
54 #define CNTL_TCT_SHIFT 4
55 #define CNTL_RPST 0x08
60 /* IICx_MDCNTL register */
61 #define MDCNTL_FSDB 0x80
62 #define MDCNTL_FMDB 0x40
63 #define MDCNTL_EGC 0x20
64 #define MDCNTL_FSM 0x10
65 #define MDCNTL_ESM 0x08
66 #define MDCNTL_EINT 0x04
67 #define MDCNTL_EUBS 0x02
68 #define MDCNTL_HSCL 0x01
70 /* IICx_STS register */
80 /* IICx_EXTSTS register */
81 #define EXTSTS_IRQP 0x80
82 #define EXTSTS_BCS_MASK 0x70
83 #define EXTSTS_BCS_FREE 0x40
84 #define EXTSTS_IRQD 0x08
85 #define EXTSTS_LA 0x04
86 #define EXTSTS_ICT 0x02
87 #define EXTSTS_XFRA 0x01
89 /* IICx_INTRMSK register */
90 #define INTRMSK_EIRC 0x80
91 #define INTRMSK_EIRS 0x40
92 #define INTRMSK_EIWC 0x20
93 #define INTRMSK_EIWS 0x10
94 #define INTRMSK_EIHE 0x08
95 #define INTRMSK_EIIC 0x04
96 #define INTRMSK_EITA 0x02
97 #define INTRMSK_EIMTC 0x01
99 /* IICx_XFRCNT register */
100 #define XFRCNT_MTC_MASK 0x07
102 /* IICx_XTCNTLSS register */
103 #define XTCNTLSS_SRC 0x80
104 #define XTCNTLSS_SRS 0x40
105 #define XTCNTLSS_SWC 0x20
106 #define XTCNTLSS_SWS 0x10
107 #define XTCNTLSS_SRST 0x01
109 /* IICx_DIRECTCNTL register */
110 #define DIRCNTL_SDAC 0x08
111 #define DIRCNTL_SCC 0x04
112 #define DIRCNTL_MSDA 0x02
113 #define DIRCNTL_MSC 0x01
115 /* Check if we really control the I2C bus and bus is free */
116 #define DIRCTNL_FREE(v) (((v) & 0x0f) == 0x0f)
118 #endif /* __I2C_IBM_IIC_H_ */