xref: /qemu/include/hw/i2c/ppc4xx_i2c.h (revision db1015e92e04835c9eb50c29625fe566d1202dbd)
13b09bb0fSBALATON Zoltan /*
23b09bb0fSBALATON Zoltan  * PPC4xx I2C controller emulation
33b09bb0fSBALATON Zoltan  *
43b09bb0fSBALATON Zoltan  * Copyright (c) 2007 Jocelyn Mayer
57709dbf1SBALATON Zoltan  * Copyright (c) 2012 François Revol
639aeba6cSBALATON Zoltan  * Copyright (c) 2016-2018 BALATON Zoltan
73b09bb0fSBALATON Zoltan  *
83b09bb0fSBALATON Zoltan  * Permission is hereby granted, free of charge, to any person obtaining a copy
93b09bb0fSBALATON Zoltan  * of this software and associated documentation files (the "Software"), to deal
103b09bb0fSBALATON Zoltan  * in the Software without restriction, including without limitation the rights
113b09bb0fSBALATON Zoltan  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
123b09bb0fSBALATON Zoltan  * copies of the Software, and to permit persons to whom the Software is
133b09bb0fSBALATON Zoltan  * furnished to do so, subject to the following conditions:
143b09bb0fSBALATON Zoltan  *
153b09bb0fSBALATON Zoltan  * The above copyright notice and this permission notice shall be included in
163b09bb0fSBALATON Zoltan  * all copies or substantial portions of the Software.
173b09bb0fSBALATON Zoltan  *
183b09bb0fSBALATON Zoltan  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
193b09bb0fSBALATON Zoltan  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
203b09bb0fSBALATON Zoltan  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
213b09bb0fSBALATON Zoltan  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
223b09bb0fSBALATON Zoltan  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
233b09bb0fSBALATON Zoltan  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
243b09bb0fSBALATON Zoltan  * THE SOFTWARE.
253b09bb0fSBALATON Zoltan  */
263b09bb0fSBALATON Zoltan 
273b09bb0fSBALATON Zoltan #ifndef PPC4XX_I2C_H
283b09bb0fSBALATON Zoltan #define PPC4XX_I2C_H
293b09bb0fSBALATON Zoltan 
303b09bb0fSBALATON Zoltan #include "hw/sysbus.h"
31d718b747SBALATON Zoltan #include "hw/i2c/bitbang_i2c.h"
32*db1015e9SEduardo Habkost #include "qom/object.h"
333b09bb0fSBALATON Zoltan 
343b09bb0fSBALATON Zoltan #define TYPE_PPC4xx_I2C "ppc4xx-i2c"
35*db1015e9SEduardo Habkost typedef struct PPC4xxI2CState PPC4xxI2CState;
363b09bb0fSBALATON Zoltan #define PPC4xx_I2C(obj) OBJECT_CHECK(PPC4xxI2CState, (obj), TYPE_PPC4xx_I2C)
373b09bb0fSBALATON Zoltan 
38*db1015e9SEduardo Habkost struct PPC4xxI2CState {
393b09bb0fSBALATON Zoltan     /*< private >*/
403b09bb0fSBALATON Zoltan     SysBusDevice parent_obj;
413b09bb0fSBALATON Zoltan 
423b09bb0fSBALATON Zoltan     /*< public >*/
433b09bb0fSBALATON Zoltan     I2CBus *bus;
443b09bb0fSBALATON Zoltan     qemu_irq irq;
453b09bb0fSBALATON Zoltan     MemoryRegion iomem;
4641742927SPeter Maydell     bitbang_i2c_interface bitbang;
47afb6e204SBALATON Zoltan     int mdidx;
48afb6e204SBALATON Zoltan     uint8_t mdata[4];
493b09bb0fSBALATON Zoltan     uint8_t lmadr;
503b09bb0fSBALATON Zoltan     uint8_t hmadr;
513b09bb0fSBALATON Zoltan     uint8_t cntl;
523b09bb0fSBALATON Zoltan     uint8_t mdcntl;
533b09bb0fSBALATON Zoltan     uint8_t sts;
543b09bb0fSBALATON Zoltan     uint8_t extsts;
553b09bb0fSBALATON Zoltan     uint8_t lsadr;
563b09bb0fSBALATON Zoltan     uint8_t hsadr;
573b09bb0fSBALATON Zoltan     uint8_t clkdiv;
583b09bb0fSBALATON Zoltan     uint8_t intrmsk;
593b09bb0fSBALATON Zoltan     uint8_t xfrcnt;
603b09bb0fSBALATON Zoltan     uint8_t xtcntlss;
613b09bb0fSBALATON Zoltan     uint8_t directcntl;
62*db1015e9SEduardo Habkost };
633b09bb0fSBALATON Zoltan 
643b09bb0fSBALATON Zoltan #endif /* PPC4XX_I2C_H */
65