allwinner-i2c.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Allwinner I2C Bus Serial Interface registers definition
  3. *
  4. * Copyright (C) 2022 Strahinja Jankovic. <strahinja.p.jankovic@gmail.com>
  5. *
  6. * This file is derived from IMX I2C controller,
  7. * by Jean-Christophe DUBOIS .
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but WITHOUT
  15. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  17. * for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. #ifndef ALLWINNER_I2C_H
  24. #define ALLWINNER_I2C_H
  25. #include "hw/sysbus.h"
  26. #include "qom/object.h"
  27. #define TYPE_AW_I2C "allwinner.i2c"
  28. /** Allwinner I2C sun6i family and newer (A31, H2+, H3, etc) */
  29. #define TYPE_AW_I2C_SUN6I TYPE_AW_I2C "-sun6i"
  30. OBJECT_DECLARE_SIMPLE_TYPE(AWI2CState, AW_I2C)
  31. #define AW_I2C_MEM_SIZE 0x24
  32. struct AWI2CState {
  33. /*< private >*/
  34. SysBusDevice parent_obj;
  35. /*< public >*/
  36. MemoryRegion iomem;
  37. I2CBus *bus;
  38. qemu_irq irq;
  39. uint8_t addr;
  40. uint8_t xaddr;
  41. uint8_t data;
  42. uint8_t cntr;
  43. uint8_t stat;
  44. uint8_t ccr;
  45. uint8_t srst;
  46. uint8_t efr;
  47. uint8_t lcr;
  48. bool irq_clear_inverted;
  49. };
  50. #endif /* ALLWINNER_I2C_H */