116020011SCédric Le Goater /* 216020011SCédric Le Goater * ASPEED AST2400 I2C Controller 316020011SCédric Le Goater * 416020011SCédric Le Goater * Copyright (C) 2016 IBM Corp. 516020011SCédric Le Goater * 616020011SCédric Le Goater * This program is free software; you can redistribute it and/or modify 716020011SCédric Le Goater * it under the terms of the GNU General Public License as published by 816020011SCédric Le Goater * the Free Software Foundation; either version 2 of the License, or 916020011SCédric Le Goater * (at your option) any later version. 1016020011SCédric Le Goater * 1116020011SCédric Le Goater * This program is distributed in the hope that it will be useful, 1216020011SCédric Le Goater * but WITHOUT ANY WARRANTY; without even the implied warranty of 1316020011SCédric Le Goater * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1416020011SCédric Le Goater * GNU General Public License for more details. 1516020011SCédric Le Goater * 1616020011SCédric Le Goater * You should have received a copy of the GNU General Public License along 1716020011SCédric Le Goater * with this program; if not, write to the Free Software Foundation, Inc., 1816020011SCédric Le Goater * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 1916020011SCédric Le Goater */ 20*ec150c7eSMarkus Armbruster 2116020011SCédric Le Goater #ifndef ASPEED_I2C_H 2216020011SCédric Le Goater #define ASPEED_I2C_H 2316020011SCédric Le Goater 2416020011SCédric Le Goater #include "hw/i2c/i2c.h" 25*ec150c7eSMarkus Armbruster #include "hw/sysbus.h" 2616020011SCédric Le Goater 2716020011SCédric Le Goater #define TYPE_ASPEED_I2C "aspeed.i2c" 2816020011SCédric Le Goater #define ASPEED_I2C(obj) \ 2916020011SCédric Le Goater OBJECT_CHECK(AspeedI2CState, (obj), TYPE_ASPEED_I2C) 3016020011SCédric Le Goater 3116020011SCédric Le Goater #define ASPEED_I2C_NR_BUSSES 14 3216020011SCédric Le Goater 3316020011SCédric Le Goater struct AspeedI2CState; 3416020011SCédric Le Goater 3516020011SCédric Le Goater typedef struct AspeedI2CBus { 3616020011SCédric Le Goater struct AspeedI2CState *controller; 3716020011SCédric Le Goater 3816020011SCédric Le Goater MemoryRegion mr; 3916020011SCédric Le Goater 4016020011SCédric Le Goater I2CBus *bus; 4116020011SCédric Le Goater uint8_t id; 4216020011SCédric Le Goater 4316020011SCédric Le Goater uint32_t ctrl; 4416020011SCédric Le Goater uint32_t timing[2]; 4516020011SCédric Le Goater uint32_t intr_ctrl; 4616020011SCédric Le Goater uint32_t intr_status; 4716020011SCédric Le Goater uint32_t cmd; 4816020011SCédric Le Goater uint32_t buf; 4916020011SCédric Le Goater } AspeedI2CBus; 5016020011SCédric Le Goater 5116020011SCédric Le Goater typedef struct AspeedI2CState { 5216020011SCédric Le Goater SysBusDevice parent_obj; 5316020011SCédric Le Goater 5416020011SCédric Le Goater MemoryRegion iomem; 5516020011SCédric Le Goater qemu_irq irq; 5616020011SCédric Le Goater 5716020011SCédric Le Goater uint32_t intr_status; 5816020011SCédric Le Goater 5916020011SCédric Le Goater AspeedI2CBus busses[ASPEED_I2C_NR_BUSSES]; 6016020011SCédric Le Goater } AspeedI2CState; 6116020011SCédric Le Goater 6216020011SCédric Le Goater I2CBus *aspeed_i2c_get_bus(DeviceState *dev, int busnr); 6316020011SCédric Le Goater 6416020011SCédric Le Goater #endif /* ASPEED_I2C_H */ 65