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" 32db1015e9SEduardo Habkost #include "qom/object.h" 333b09bb0fSBALATON Zoltan 343b09bb0fSBALATON Zoltan #define TYPE_PPC4xx_I2C "ppc4xx-i2c" 35*8063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(PPC4xxI2CState, PPC4xx_I2C) 363b09bb0fSBALATON Zoltan 37db1015e9SEduardo Habkost struct PPC4xxI2CState { 383b09bb0fSBALATON Zoltan /*< private >*/ 393b09bb0fSBALATON Zoltan SysBusDevice parent_obj; 403b09bb0fSBALATON Zoltan 413b09bb0fSBALATON Zoltan /*< public >*/ 423b09bb0fSBALATON Zoltan I2CBus *bus; 433b09bb0fSBALATON Zoltan qemu_irq irq; 443b09bb0fSBALATON Zoltan MemoryRegion iomem; 4541742927SPeter Maydell bitbang_i2c_interface bitbang; 46afb6e204SBALATON Zoltan int mdidx; 47afb6e204SBALATON Zoltan uint8_t mdata[4]; 483b09bb0fSBALATON Zoltan uint8_t lmadr; 493b09bb0fSBALATON Zoltan uint8_t hmadr; 503b09bb0fSBALATON Zoltan uint8_t cntl; 513b09bb0fSBALATON Zoltan uint8_t mdcntl; 523b09bb0fSBALATON Zoltan uint8_t sts; 533b09bb0fSBALATON Zoltan uint8_t extsts; 543b09bb0fSBALATON Zoltan uint8_t lsadr; 553b09bb0fSBALATON Zoltan uint8_t hsadr; 563b09bb0fSBALATON Zoltan uint8_t clkdiv; 573b09bb0fSBALATON Zoltan uint8_t intrmsk; 583b09bb0fSBALATON Zoltan uint8_t xfrcnt; 593b09bb0fSBALATON Zoltan uint8_t xtcntlss; 603b09bb0fSBALATON Zoltan uint8_t directcntl; 61db1015e9SEduardo Habkost }; 623b09bb0fSBALATON Zoltan 633b09bb0fSBALATON Zoltan #endif /* PPC4XX_I2C_H */ 64