15857974dSAndrew Jeffery /* 25857974dSAndrew Jeffery * Aspeed ADC 35857974dSAndrew Jeffery * 45857974dSAndrew Jeffery * Copyright 2017-2021 IBM Corp. 55857974dSAndrew Jeffery * 65857974dSAndrew Jeffery * Andrew Jeffery <andrew@aj.id.au> 75857974dSAndrew Jeffery * 85857974dSAndrew Jeffery * SPDX-License-Identifier: GPL-2.0-or-later 95857974dSAndrew Jeffery */ 105857974dSAndrew Jeffery 115857974dSAndrew Jeffery #ifndef HW_ADC_ASPEED_ADC_H 125857974dSAndrew Jeffery #define HW_ADC_ASPEED_ADC_H 135857974dSAndrew Jeffery 145857974dSAndrew Jeffery #include "hw/sysbus.h" 155857974dSAndrew Jeffery 165857974dSAndrew Jeffery #define TYPE_ASPEED_ADC "aspeed.adc" 175857974dSAndrew Jeffery #define TYPE_ASPEED_2400_ADC TYPE_ASPEED_ADC "-ast2400" 185857974dSAndrew Jeffery #define TYPE_ASPEED_2500_ADC TYPE_ASPEED_ADC "-ast2500" 195857974dSAndrew Jeffery #define TYPE_ASPEED_2600_ADC TYPE_ASPEED_ADC "-ast2600" 205c5e0445SSteven Lee #define TYPE_ASPEED_1030_ADC TYPE_ASPEED_ADC "-ast1030" 21*13b5ae94SJamin Lin #define TYPE_ASPEED_2700_ADC TYPE_ASPEED_ADC "-ast2700" 225857974dSAndrew Jeffery OBJECT_DECLARE_TYPE(AspeedADCState, AspeedADCClass, ASPEED_ADC) 235857974dSAndrew Jeffery 245857974dSAndrew Jeffery #define TYPE_ASPEED_ADC_ENGINE "aspeed.adc.engine" 255857974dSAndrew Jeffery OBJECT_DECLARE_SIMPLE_TYPE(AspeedADCEngineState, ASPEED_ADC_ENGINE) 265857974dSAndrew Jeffery 275857974dSAndrew Jeffery #define ASPEED_ADC_NR_CHANNELS 16 285857974dSAndrew Jeffery #define ASPEED_ADC_NR_REGS (0xD0 >> 2) 295857974dSAndrew Jeffery 305857974dSAndrew Jeffery struct AspeedADCEngineState { 315857974dSAndrew Jeffery /* <private> */ 325857974dSAndrew Jeffery SysBusDevice parent; 335857974dSAndrew Jeffery 345857974dSAndrew Jeffery MemoryRegion mmio; 355857974dSAndrew Jeffery qemu_irq irq; 365857974dSAndrew Jeffery uint32_t engine_id; 375857974dSAndrew Jeffery uint32_t nr_channels; 385857974dSAndrew Jeffery uint32_t regs[ASPEED_ADC_NR_REGS]; 395857974dSAndrew Jeffery }; 405857974dSAndrew Jeffery 415857974dSAndrew Jeffery struct AspeedADCState { 425857974dSAndrew Jeffery /* <private> */ 435857974dSAndrew Jeffery SysBusDevice parent; 445857974dSAndrew Jeffery 455857974dSAndrew Jeffery MemoryRegion mmio; 465857974dSAndrew Jeffery qemu_irq irq; 475857974dSAndrew Jeffery 485857974dSAndrew Jeffery AspeedADCEngineState engines[2]; 495857974dSAndrew Jeffery }; 505857974dSAndrew Jeffery 515857974dSAndrew Jeffery struct AspeedADCClass { 525857974dSAndrew Jeffery SysBusDeviceClass parent_class; 535857974dSAndrew Jeffery 545857974dSAndrew Jeffery uint32_t nr_engines; 555857974dSAndrew Jeffery }; 565857974dSAndrew Jeffery 575857974dSAndrew Jeffery #endif /* HW_ADC_ASPEED_ADC_H */ 58