Xilinx Versal's PMC SLCR and OSPI support
v6 cover Xilinx Versal's PMC SLCR and OSPI support
Hi,
This series attempts to add support for Xilinx Versal's PMC SLCR (system-level control registers) and OSPI flash memory controller to Xilinx Versal virt machine.
The series start with adding a model of Versal's PMC SLCR and connecting the model to the Versal virt machine. The series then adds a couple of headers into the xlnx_csu_dma.h needed for building and reusing it later with the OSPI. The series thereafter introduces a DMA control interface and implements the interface in the xlnx_csu_dma for being able to reuse and control the DMA with the OSPI controller. Thereafter a model of Versal's OSPI controller is added and connected to the Versal virt machine. The series then ends with adding initial support for the Micron Xccelera mt35xu01g flash and flashes of this type are connected to the OSPI in the Versal virt machine.
Best regards,
Francisco Iglesias
Changelog:
v5 -> v6:
* Corrected unimplemented log messages (patch: "hw/arm/xlnx-versal: Connect Versal's PMC SLCR")
* Modify dma_ctrl_if_read to return a MemTxResult carrying the result of the read operation
* Updated (and corrected) documentation
v4 -> v5
* Use named GPIOs for "sd-emmc-sel", "qspi-ospi-mux-sel", "ospi-mux-sel" in the PMC SLCR model
* Add a QEMU interface comment for the PMC SLCR model.
* Switch to use OBJECT_DECLARE_SIMPLE_TYPE in both "xlnx-versal-ospi.h" and "xlnx-versal-pmc-iou-slcr.h"
* Create a new patch 'or'ing the interrupts from the BBRAM and RTC model
* 'Or' the interrupt from the PMC SLCR with the BBRAM and RTC interrupt inside 'xlnx-versal.c'
* Connect other not yet implemented PMC SLCR GPIOs to unimplemented messages
* Reworked and simplified the DMA control interface by removing the notifier and refill mechanism
* Corrected various typos and grammatical errors in the DMA control interface documentation and comments
* Updated the DMA control interface documentation to describe the new simplified implementation
* Use ldl_le_p and ldq_le_p in the OSPI model (and remove the OSPIRdData union). Also assert in the locations that we are not overruning the new bytes buffer.
* Correct the single_cs function in the OSPI model (both comment and output)
* Correct a typo in a comment inside ospi_do_indirect_write (s/boundery/boundary/)
* Remove an unecesary assert in the OSPI model
* Add a QEMU interface comment for the OSPI model.
* Rename the OSPI irq in 'xlnx-versal.c' to include 'orgate' in the name for clarifying
v3 -> v4
* Correct indentation (patch: "hw/arm/xlnx-versal: Connect Versal's PMC
SLCR")
* Rename to include "If" in names related to the DMA control interface
* In dma-ctrl-if.h:
- Don't include qemu-common.h
- Use DECLARE_CLASS_CHECKERS dma-ctrl.h
* Add a docs/devel documentation patch for the DMA control interface
* Improve git messages on the dma-ctrl-if patches
v2 -> v3
* Correct and also include hw/sysbus.h and hw/register.h into xlnx_csu_dma.h (patch: "include/hw/dma/xlnx_csu_dma: Add in missing includes in the header")
v1 -> v2
* Correct the reset in the PMC SLCR model
* Create a sub structure for the OSPI in the Versal structure (in patch:
"hw/arm/xlnx-versal: Connect the OSPI flash memory controller model")
* Change to use 'drive_get' instead of 'drive_get_next' (in patch:
"hw/arm/xlnx-versal-virt: Connect mt35xu01g flashes to the OSPI")
* Add a maintainers patch and list myself as maintainer for the OSPI controller
Francisco Iglesias (12):
hw/misc: Add a model of Versal's PMC SLCR hw/arm/xlnx-versal: 'Or' the interrupts from the BBRAM and RTC models hw/arm/xlnx-versal: Connect Versal's PMC SLCR include/hw/dma/xlnx_csu_dma: Add in missing includes in the header hw/dma: Add the DMA control interface
hw/dma/xlnx_csu_dma: Implement the DMA control interface hw/ssi: Add a model of Xilinx Versal's OSPI flash memory controller hw/arm/xlnx-versal: Connect the OSPI flash memory controller model hw/block/m25p80: Add support for Micron Xccela flash mt35xu01g hw/arm/xlnx-versal-virt: Connect mt35xu01g flashes to the OSPI
MAINTAINERS: Add an entry for Xilinx Versal OSPI docs/devel: Add documentation for the DMA control interface
MAINTAINERS | 7 + docs/devel/dma-ctrl-if.rst | 243 ++++ docs/devel/index.rst | 1 + hw/arm/xlnx-versal-virt.c | 25 +- hw/arm/xlnx-versal.c | 190 ++- hw/block/m25p80.c | 2 + hw/dma/dma-ctrl-if.c | 30 + hw/dma/meson.build | 1 + hw/dma/xlnx_csu_dma.c | 20 + hw/misc/meson.build | 5 +- hw/misc/xlnx-versal-pmc-iou-slcr.c | 1446 ++++++++++++++++++++++ hw/ssi/meson.build | 1 + hw/ssi/xlnx-versal-ospi.c | 1856 ++++++++++++++++++++++++++++ include/hw/arm/xlnx-versal.h | 30 +- include/hw/dma/dma-ctrl-if.h | 58 + include/hw/dma/xlnx_csu_dma.h | 5 + include/hw/misc/xlnx-versal-pmc-iou-slcr.h | 78 ++ include/hw/ssi/xlnx-versal-ospi.h | 111 ++ 18 files changed, 4103 insertions(+), 6 deletions(-) create mode 100644 docs/devel/dma-ctrl-if.rst create mode 100644 hw/dma/dma-ctrl-if.c create mode 100644 hw/misc/xlnx-versal-pmc-iou-slcr.c create mode 100644 hw/ssi/xlnx-versal-ospi.c create mode 100644 include/hw/dma/dma-ctrl-if.h create mode 100644 include/hw/misc/xlnx-versal-pmc-iou-slcr.h create mode 100644 include/hw/ssi/xlnx-versal-ospi.h
Signature · 1 line
2.11.0
PATCH v6 1/12 hw/misc: Add a model of Versal's PMC SLCR
Add a model of Versal's PMC SLCR (system-level control registers).
--- hw/misc/meson.build | 5 +- hw/misc/xlnx-versal-pmc-iou-slcr.c | 1446 ++++++++++++++++++++++++++++ include/hw/misc/xlnx-versal-pmc-iou-slcr.h | 78 ++ 3 files changed, 1528 insertions(+), 1 deletion(-) create mode 100644 hw/misc/xlnx-versal-pmc-iou-slcr.c create mode 100644 include/hw/misc/xlnx-versal-pmc-iou-slcr.h
hw/misc/meson.build +4 -1
@@ -84,7 +84,10 @@ softmmu_ss.add(when: 'CONFIG_RASPI', if_true: files( )) softmmu_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c')) softmmu_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c')) -softmmu_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-xramc.c')) +softmmu_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files( + 'xlnx-versal-xramc.c', + 'xlnx-versal-pmc-iou-slcr.c', +)) softmmu_ss.add(when: 'CONFIG_STM32F2XX_SYSCFG', if_true: files('stm32f2xx_syscfg.c')) softmmu_ss.add(when: 'CONFIG_STM32F4XX_SYSCFG', if_true: files('stm32f4xx_syscfg.c')) softmmu_ss.add(when: 'CONFIG_STM32F4XX_EXTI', if_true: files('stm32f4xx_exti.c'))
hw/misc/xlnx-versal-pmc-iou-slcr.c new file +1446 -0
1,446 lines not on this page · raw message
include/hw/misc/xlnx-versal-pmc-iou-slcr.h new file +78 -0
78 lines not on this page · raw message
Signature · 1 line
2.11.0
Re: [PATCH v6 01/12] hw/misc: Add a model of Versal's PMC SLCR
Quoted 5 lines · Francisco Iglesias
Add a model of Versal's PMC SLCR (system-level control registers).
Signed-off-by Francisco Iglesias <[email protected]>Signed-off-by Edgar E. Iglesias <[email protected]>Reviewed-by Peter Maydell <[email protected]>
Quoted 1,564 lines
--- hw/misc/meson.build | 5 +- hw/misc/xlnx-versal-pmc-iou-slcr.c | 1446 ++++++++++++++++++++++++++++ include/hw/misc/xlnx-versal-pmc-iou-slcr.h | 78 ++ 3 files changed, 1528 insertions(+), 1 deletion(-) create mode 100644 hw/misc/xlnx-versal-pmc-iou-slcr.c create mode 100644 include/hw/misc/xlnx-versal-pmc-iou-slcr.hhw/misc/meson.build +4
-1@@ -84,7 +84,10 @@ softmmu_ss.add(when: 'CONFIG_RASPI', if_true: files( )) softmmu_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c')) softmmu_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c')) -softmmu_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-xramc.c')) +softmmu_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files( + 'xlnx-versal-xramc.c', + 'xlnx-versal-pmc-iou-slcr.c', +)) softmmu_ss.add(when: 'CONFIG_STM32F2XX_SYSCFG', if_true: files('stm32f2xx_syscfg.c')) softmmu_ss.add(when: 'CONFIG_STM32F4XX_SYSCFG', if_true: files('stm32f4xx_syscfg.c')) softmmu_ss.add(when: 'CONFIG_STM32F4XX_EXTI', if_true: files('stm32f4xx_exti.c'))hw/misc/xlnx-versal-pmc-iou-slcr.c new file +1446
-0@@ -0,0 +1,1446 @@ +/* +* QEMU model of Versal's PMC IOU SLCR (system level control registers) +* +* Copyright (c) 2021 Xilinx Inc. +* Written by Edgar E. Iglesias <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ + +#include "qemu/osdep.h" +#include "hw/sysbus.h" +#include "hw/register.h" +#include "hw/irq.h" +#include "qemu/bitops.h" +#include "qemu/log.h" +#include "migration/vmstate.h" +#include "hw/qdev-properties.h" +#include "hw/misc/xlnx-versal-pmc-iou-slcr.h" + +#ifndef XILINX_VERSAL_PMC_IOU_SLCR_ERR_DEBUG +#define XILINX_VERSAL_PMC_IOU_SLCR_ERR_DEBUG 0 +#endif + +REG32(MIO_PIN_0, 0x0) + FIELD(MIO_PIN_0, L3_SEL, 7, 3) + FIELD(MIO_PIN_0, L2_SEL, 5, 2) + FIELD(MIO_PIN_0, L1_SEL, 3, 2) + FIELD(MIO_PIN_0, L0_SEL, 1, 2) +REG32(MIO_PIN_1, 0x4) + FIELD(MIO_PIN_1, L3_SEL, 7, 3) + FIELD(MIO_PIN_1, L2_SEL, 5, 2) + FIELD(MIO_PIN_1, L1_SEL, 3, 2) + FIELD(MIO_PIN_1, L0_SEL, 1, 2) +REG32(MIO_PIN_2, 0x8) + FIELD(MIO_PIN_2, L3_SEL, 7, 3) + FIELD(MIO_PIN_2, L2_SEL, 5, 2) + FIELD(MIO_PIN_2, L1_SEL, 3, 2) + FIELD(MIO_PIN_2, L0_SEL, 1, 2) +REG32(MIO_PIN_3, 0xc) + FIELD(MIO_PIN_3, L3_SEL, 7, 3) + FIELD(MIO_PIN_3, L2_SEL, 5, 2) + FIELD(MIO_PIN_3, L1_SEL, 3, 2) + FIELD(MIO_PIN_3, L0_SEL, 1, 2) +REG32(MIO_PIN_4, 0x10) + FIELD(MIO_PIN_4, L3_SEL, 7, 3) + FIELD(MIO_PIN_4, L2_SEL, 5, 2) + FIELD(MIO_PIN_4, L1_SEL, 3, 2) + FIELD(MIO_PIN_4, L0_SEL, 1, 2) +REG32(MIO_PIN_5, 0x14) + FIELD(MIO_PIN_5, L3_SEL, 7, 3) + FIELD(MIO_PIN_5, L2_SEL, 5, 2) + FIELD(MIO_PIN_5, L1_SEL, 3, 2) + FIELD(MIO_PIN_5, L0_SEL, 1, 2) +REG32(MIO_PIN_6, 0x18) + FIELD(MIO_PIN_6, L3_SEL, 7, 3) + FIELD(MIO_PIN_6, L2_SEL, 5, 2) + FIELD(MIO_PIN_6, L1_SEL, 3, 2) + FIELD(MIO_PIN_6, L0_SEL, 1, 2) +REG32(MIO_PIN_7, 0x1c) + FIELD(MIO_PIN_7, L3_SEL, 7, 3) + FIELD(MIO_PIN_7, L2_SEL, 5, 2) + FIELD(MIO_PIN_7, L1_SEL, 3, 2) + FIELD(MIO_PIN_7, L0_SEL, 1, 2) +REG32(MIO_PIN_8, 0x20) + FIELD(MIO_PIN_8, L3_SEL, 7, 3) + FIELD(MIO_PIN_8, L2_SEL, 5, 2) + FIELD(MIO_PIN_8, L1_SEL, 3, 2) + FIELD(MIO_PIN_8, L0_SEL, 1, 2) +REG32(MIO_PIN_9, 0x24) + FIELD(MIO_PIN_9, L3_SEL, 7, 3) + FIELD(MIO_PIN_9, L2_SEL, 5, 2) + FIELD(MIO_PIN_9, L1_SEL, 3, 2) + FIELD(MIO_PIN_9, L0_SEL, 1, 2) +REG32(MIO_PIN_10, 0x28) + FIELD(MIO_PIN_10, L3_SEL, 7, 3) + FIELD(MIO_PIN_10, L2_SEL, 5, 2) + FIELD(MIO_PIN_10, L1_SEL, 3, 2) + FIELD(MIO_PIN_10, L0_SEL, 1, 2) +REG32(MIO_PIN_11, 0x2c) + FIELD(MIO_PIN_11, L3_SEL, 7, 3) + FIELD(MIO_PIN_11, L2_SEL, 5, 2) + FIELD(MIO_PIN_11, L1_SEL, 3, 2) + FIELD(MIO_PIN_11, L0_SEL, 1, 2) +REG32(MIO_PIN_12, 0x30) + FIELD(MIO_PIN_12, L3_SEL, 7, 3) + FIELD(MIO_PIN_12, L2_SEL, 5, 2) + FIELD(MIO_PIN_12, L1_SEL, 3, 2) + FIELD(MIO_PIN_12, L0_SEL, 1, 2) +REG32(MIO_PIN_13, 0x34) + FIELD(MIO_PIN_13, L3_SEL, 7, 3) + FIELD(MIO_PIN_13, L2_SEL, 5, 2) + FIELD(MIO_PIN_13, L1_SEL, 3, 2) + FIELD(MIO_PIN_13, L0_SEL, 1, 2) +REG32(MIO_PIN_14, 0x38) + FIELD(MIO_PIN_14, L3_SEL, 7, 3) + FIELD(MIO_PIN_14, L2_SEL, 5, 2) + FIELD(MIO_PIN_14, L1_SEL, 3, 2) + FIELD(MIO_PIN_14, L0_SEL, 1, 2) +REG32(MIO_PIN_15, 0x3c) + FIELD(MIO_PIN_15, L3_SEL, 7, 3) + FIELD(MIO_PIN_15, L2_SEL, 5, 2) + FIELD(MIO_PIN_15, L1_SEL, 3, 2) + FIELD(MIO_PIN_15, L0_SEL, 1, 2) +REG32(MIO_PIN_16, 0x40) + FIELD(MIO_PIN_16, L3_SEL, 7, 3) + FIELD(MIO_PIN_16, L2_SEL, 5, 2) + FIELD(MIO_PIN_16, L1_SEL, 3, 2) + FIELD(MIO_PIN_16, L0_SEL, 1, 2) +REG32(MIO_PIN_17, 0x44) + FIELD(MIO_PIN_17, L3_SEL, 7, 3) + FIELD(MIO_PIN_17, L2_SEL, 5, 2) + FIELD(MIO_PIN_17, L1_SEL, 3, 2) + FIELD(MIO_PIN_17, L0_SEL, 1, 2) +REG32(MIO_PIN_18, 0x48) + FIELD(MIO_PIN_18, L3_SEL, 7, 3) + FIELD(MIO_PIN_18, L2_SEL, 5, 2) + FIELD(MIO_PIN_18, L1_SEL, 3, 2) + FIELD(MIO_PIN_18, L0_SEL, 1, 2) +REG32(MIO_PIN_19, 0x4c) + FIELD(MIO_PIN_19, L3_SEL, 7, 3) + FIELD(MIO_PIN_19, L2_SEL, 5, 2) + FIELD(MIO_PIN_19, L1_SEL, 3, 2) + FIELD(MIO_PIN_19, L0_SEL, 1, 2) +REG32(MIO_PIN_20, 0x50) + FIELD(MIO_PIN_20, L3_SEL, 7, 3) + FIELD(MIO_PIN_20, L2_SEL, 5, 2) + FIELD(MIO_PIN_20, L1_SEL, 3, 2) + FIELD(MIO_PIN_20, L0_SEL, 1, 2) +REG32(MIO_PIN_21, 0x54) + FIELD(MIO_PIN_21, L3_SEL, 7, 3) + FIELD(MIO_PIN_21, L2_SEL, 5, 2) + FIELD(MIO_PIN_21, L1_SEL, 3, 2) + FIELD(MIO_PIN_21, L0_SEL, 1, 2) +REG32(MIO_PIN_22, 0x58) + FIELD(MIO_PIN_22, L3_SEL, 7, 3) + FIELD(MIO_PIN_22, L2_SEL, 5, 2) + FIELD(MIO_PIN_22, L1_SEL, 3, 2) + FIELD(MIO_PIN_22, L0_SEL, 1, 2) +REG32(MIO_PIN_23, 0x5c) + FIELD(MIO_PIN_23, L3_SEL, 7, 3) + FIELD(MIO_PIN_23, L2_SEL, 5, 2) + FIELD(MIO_PIN_23, L1_SEL, 3, 2) + FIELD(MIO_PIN_23, L0_SEL, 1, 2) +REG32(MIO_PIN_24, 0x60) + FIELD(MIO_PIN_24, L3_SEL, 7, 3) + FIELD(MIO_PIN_24, L2_SEL, 5, 2) + FIELD(MIO_PIN_24, L1_SEL, 3, 2) + FIELD(MIO_PIN_24, L0_SEL, 1, 2) +REG32(MIO_PIN_25, 0x64) + FIELD(MIO_PIN_25, L3_SEL, 7, 3) + FIELD(MIO_PIN_25, L2_SEL, 5, 2) + FIELD(MIO_PIN_25, L1_SEL, 3, 2) + FIELD(MIO_PIN_25, L0_SEL, 1, 2) +REG32(MIO_PIN_26, 0x68) + FIELD(MIO_PIN_26, L3_SEL, 7, 3) + FIELD(MIO_PIN_26, L2_SEL, 5, 2) + FIELD(MIO_PIN_26, L1_SEL, 3, 2) + FIELD(MIO_PIN_26, L0_SEL, 1, 2) +REG32(MIO_PIN_27, 0x6c) + FIELD(MIO_PIN_27, L3_SEL, 7, 3) + FIELD(MIO_PIN_27, L2_SEL, 5, 2) + FIELD(MIO_PIN_27, L1_SEL, 3, 2) + FIELD(MIO_PIN_27, L0_SEL, 1, 2) +REG32(MIO_PIN_28, 0x70) + FIELD(MIO_PIN_28, L3_SEL, 7, 3) + FIELD(MIO_PIN_28, L2_SEL, 5, 2) + FIELD(MIO_PIN_28, L1_SEL, 3, 2) + FIELD(MIO_PIN_28, L0_SEL, 1, 2) +REG32(MIO_PIN_29, 0x74) + FIELD(MIO_PIN_29, L3_SEL, 7, 3) + FIELD(MIO_PIN_29, L2_SEL, 5, 2) + FIELD(MIO_PIN_29, L1_SEL, 3, 2) + FIELD(MIO_PIN_29, L0_SEL, 1, 2) +REG32(MIO_PIN_30, 0x78) + FIELD(MIO_PIN_30, L3_SEL, 7, 3) + FIELD(MIO_PIN_30, L2_SEL, 5, 2) + FIELD(MIO_PIN_30, L1_SEL, 3, 2) + FIELD(MIO_PIN_30, L0_SEL, 1, 2) +REG32(MIO_PIN_31, 0x7c) + FIELD(MIO_PIN_31, L3_SEL, 7, 3) + FIELD(MIO_PIN_31, L2_SEL, 5, 2) + FIELD(MIO_PIN_31, L1_SEL, 3, 2) + FIELD(MIO_PIN_31, L0_SEL, 1, 2) +REG32(MIO_PIN_32, 0x80) + FIELD(MIO_PIN_32, L3_SEL, 7, 3) + FIELD(MIO_PIN_32, L2_SEL, 5, 2) + FIELD(MIO_PIN_32, L1_SEL, 3, 2) + FIELD(MIO_PIN_32, L0_SEL, 1, 2) +REG32(MIO_PIN_33, 0x84) + FIELD(MIO_PIN_33, L3_SEL, 7, 3) + FIELD(MIO_PIN_33, L2_SEL, 5, 2) + FIELD(MIO_PIN_33, L1_SEL, 3, 2) + FIELD(MIO_PIN_33, L0_SEL, 1, 2) +REG32(MIO_PIN_34, 0x88) + FIELD(MIO_PIN_34, L3_SEL, 7, 3) + FIELD(MIO_PIN_34, L2_SEL, 5, 2) + FIELD(MIO_PIN_34, L1_SEL, 3, 2) + FIELD(MIO_PIN_34, L0_SEL, 1, 2) +REG32(MIO_PIN_35, 0x8c) + FIELD(MIO_PIN_35, L3_SEL, 7, 3) + FIELD(MIO_PIN_35, L2_SEL, 5, 2) + FIELD(MIO_PIN_35, L1_SEL, 3, 2) + FIELD(MIO_PIN_35, L0_SEL, 1, 2) +REG32(MIO_PIN_36, 0x90) + FIELD(MIO_PIN_36, L3_SEL, 7, 3) + FIELD(MIO_PIN_36, L2_SEL, 5, 2) + FIELD(MIO_PIN_36, L1_SEL, 3, 2) + FIELD(MIO_PIN_36, L0_SEL, 1, 2) +REG32(MIO_PIN_37, 0x94) + FIELD(MIO_PIN_37, L3_SEL, 7, 3) + FIELD(MIO_PIN_37, L2_SEL, 5, 2) + FIELD(MIO_PIN_37, L1_SEL, 3, 2) + FIELD(MIO_PIN_37, L0_SEL, 1, 2) +REG32(MIO_PIN_38, 0x98) + FIELD(MIO_PIN_38, L3_SEL, 7, 3) + FIELD(MIO_PIN_38, L2_SEL, 5, 2) + FIELD(MIO_PIN_38, L1_SEL, 3, 2) + FIELD(MIO_PIN_38, L0_SEL, 1, 2) +REG32(MIO_PIN_39, 0x9c) + FIELD(MIO_PIN_39, L3_SEL, 7, 3) + FIELD(MIO_PIN_39, L2_SEL, 5, 2) + FIELD(MIO_PIN_39, L1_SEL, 3, 2) + FIELD(MIO_PIN_39, L0_SEL, 1, 2) +REG32(MIO_PIN_40, 0xa0) + FIELD(MIO_PIN_40, L3_SEL, 7, 3) + FIELD(MIO_PIN_40, L2_SEL, 5, 2) + FIELD(MIO_PIN_40, L1_SEL, 3, 2) + FIELD(MIO_PIN_40, L0_SEL, 1, 2) +REG32(MIO_PIN_41, 0xa4) + FIELD(MIO_PIN_41, L3_SEL, 7, 3) + FIELD(MIO_PIN_41, L2_SEL, 5, 2) + FIELD(MIO_PIN_41, L1_SEL, 3, 2) + FIELD(MIO_PIN_41, L0_SEL, 1, 2) +REG32(MIO_PIN_42, 0xa8) + FIELD(MIO_PIN_42, L3_SEL, 7, 3) + FIELD(MIO_PIN_42, L2_SEL, 5, 2) + FIELD(MIO_PIN_42, L1_SEL, 3, 2) + FIELD(MIO_PIN_42, L0_SEL, 1, 2) +REG32(MIO_PIN_43, 0xac) + FIELD(MIO_PIN_43, L3_SEL, 7, 3) + FIELD(MIO_PIN_43, L2_SEL, 5, 2) + FIELD(MIO_PIN_43, L1_SEL, 3, 2) + FIELD(MIO_PIN_43, L0_SEL, 1, 2) +REG32(MIO_PIN_44, 0xb0) + FIELD(MIO_PIN_44, L3_SEL, 7, 3) + FIELD(MIO_PIN_44, L2_SEL, 5, 2) + FIELD(MIO_PIN_44, L1_SEL, 3, 2) + FIELD(MIO_PIN_44, L0_SEL, 1, 2) +REG32(MIO_PIN_45, 0xb4) + FIELD(MIO_PIN_45, L3_SEL, 7, 3) + FIELD(MIO_PIN_45, L2_SEL, 5, 2) + FIELD(MIO_PIN_45, L1_SEL, 3, 2) + FIELD(MIO_PIN_45, L0_SEL, 1, 2) +REG32(MIO_PIN_46, 0xb8) + FIELD(MIO_PIN_46, L3_SEL, 7, 3) + FIELD(MIO_PIN_46, L2_SEL, 5, 2) + FIELD(MIO_PIN_46, L1_SEL, 3, 2) + FIELD(MIO_PIN_46, L0_SEL, 1, 2) +REG32(MIO_PIN_47, 0xbc) + FIELD(MIO_PIN_47, L3_SEL, 7, 3) + FIELD(MIO_PIN_47, L2_SEL, 5, 2) + FIELD(MIO_PIN_47, L1_SEL, 3, 2) + FIELD(MIO_PIN_47, L0_SEL, 1, 2) +REG32(MIO_PIN_48, 0xc0) + FIELD(MIO_PIN_48, L3_SEL, 7, 3) + FIELD(MIO_PIN_48, L2_SEL, 5, 2) + FIELD(MIO_PIN_48, L1_SEL, 3, 2) + FIELD(MIO_PIN_48, L0_SEL, 1, 2) +REG32(MIO_PIN_49, 0xc4) + FIELD(MIO_PIN_49, L3_SEL, 7, 3) + FIELD(MIO_PIN_49, L2_SEL, 5, 2) + FIELD(MIO_PIN_49, L1_SEL, 3, 2) + FIELD(MIO_PIN_49, L0_SEL, 1, 2) +REG32(MIO_PIN_50, 0xc8) + FIELD(MIO_PIN_50, L3_SEL, 7, 3) + FIELD(MIO_PIN_50, L2_SEL, 5, 2) + FIELD(MIO_PIN_50, L1_SEL, 3, 2) + FIELD(MIO_PIN_50, L0_SEL, 1, 2) +REG32(MIO_PIN_51, 0xcc) + FIELD(MIO_PIN_51, L3_SEL, 7, 3) + FIELD(MIO_PIN_51, L2_SEL, 5, 2) + FIELD(MIO_PIN_51, L1_SEL, 3, 2) + FIELD(MIO_PIN_51, L0_SEL, 1, 2) +REG32(BNK0_EN_RX, 0x100) + FIELD(BNK0_EN_RX, BNK0_EN_RX, 0, 26) +REG32(BNK0_SEL_RX0, 0x104) +REG32(BNK0_SEL_RX1, 0x108) + FIELD(BNK0_SEL_RX1, BNK0_SEL_RX, 0, 20) +REG32(BNK0_EN_RX_SCHMITT_HYST, 0x10c) + FIELD(BNK0_EN_RX_SCHMITT_HYST, BNK0_EN_RX_SCHMITT_HYST, 0, 26) +REG32(BNK0_EN_WK_PD, 0x110) + FIELD(BNK0_EN_WK_PD, BNK0_EN_WK_PD, 0, 26) +REG32(BNK0_EN_WK_PU, 0x114) + FIELD(BNK0_EN_WK_PU, BNK0_EN_WK_PU, 0, 26) +REG32(BNK0_SEL_DRV0, 0x118) +REG32(BNK0_SEL_DRV1, 0x11c) + FIELD(BNK0_SEL_DRV1, BNK0_SEL_DRV, 0, 20) +REG32(BNK0_SEL_SLEW, 0x120) + FIELD(BNK0_SEL_SLEW, BNK0_SEL_SLEW, 0, 26) +REG32(BNK0_EN_DFT_OPT_INV, 0x124) + FIELD(BNK0_EN_DFT_OPT_INV, BNK0_EN_DFT_OPT_INV, 0, 26) +REG32(BNK0_EN_PAD2PAD_LOOPBACK, 0x128) + FIELD(BNK0_EN_PAD2PAD_LOOPBACK, BNK0_EN_PAD2PAD_LOOPBACK, 0, 13) +REG32(BNK0_RX_SPARE0, 0x12c) +REG32(BNK0_RX_SPARE1, 0x130) + FIELD(BNK0_RX_SPARE1, BNK0_RX_SPARE, 0, 20) +REG32(BNK0_TX_SPARE0, 0x134) +REG32(BNK0_TX_SPARE1, 0x138) + FIELD(BNK0_TX_SPARE1, BNK0_TX_SPARE, 0, 20) +REG32(BNK0_SEL_EN1P8, 0x13c) + FIELD(BNK0_SEL_EN1P8, BNK0_SEL_EN1P8, 0, 1) +REG32(BNK0_EN_B_POR_DETECT, 0x140) + FIELD(BNK0_EN_B_POR_DETECT, BNK0_EN_B_POR_DETECT, 0, 1) +REG32(BNK0_LPF_BYP_POR_DETECT, 0x144) + FIELD(BNK0_LPF_BYP_POR_DETECT, BNK0_LPF_BYP_POR_DETECT, 0, 1) +REG32(BNK0_EN_LATCH, 0x148) + FIELD(BNK0_EN_LATCH, BNK0_EN_LATCH, 0, 1) +REG32(BNK0_VBG_LPF_BYP_B, 0x14c) + FIELD(BNK0_VBG_LPF_BYP_B, BNK0_VBG_LPF_BYP_B, 0, 1) +REG32(BNK0_EN_AMP_B, 0x150) + FIELD(BNK0_EN_AMP_B, BNK0_EN_AMP_B, 0, 2) +REG32(BNK0_SPARE_BIAS, 0x154) + FIELD(BNK0_SPARE_BIAS, BNK0_SPARE_BIAS, 0, 4) +REG32(BNK0_DRIVER_BIAS, 0x158) + FIELD(BNK0_DRIVER_BIAS, BNK0_DRIVER_BIAS, 0, 15) +REG32(BNK0_VMODE, 0x15c) + FIELD(BNK0_VMODE, BNK0_VMODE, 0, 1) +REG32(BNK0_SEL_AUX_IO_RX, 0x160) + FIELD(BNK0_SEL_AUX_IO_RX, BNK0_SEL_AUX_IO_RX, 0, 26) +REG32(BNK0_EN_TX_HS_MODE, 0x164) + FIELD(BNK0_EN_TX_HS_MODE, BNK0_EN_TX_HS_MODE, 0, 26) +REG32(MIO_MST_TRI0, 0x200) + FIELD(MIO_MST_TRI0, PIN_25_TRI, 25, 1) + FIELD(MIO_MST_TRI0, PIN_24_TRI, 24, 1) + FIELD(MIO_MST_TRI0, PIN_23_TRI, 23, 1) + FIELD(MIO_MST_TRI0, PIN_22_TRI, 22, 1) + FIELD(MIO_MST_TRI0, PIN_21_TRI, 21, 1) + FIELD(MIO_MST_TRI0, PIN_20_TRI, 20, 1) + FIELD(MIO_MST_TRI0, PIN_19_TRI, 19, 1) + FIELD(MIO_MST_TRI0, PIN_18_TRI, 18, 1) + FIELD(MIO_MST_TRI0, PIN_17_TRI, 17, 1) + FIELD(MIO_MST_TRI0, PIN_16_TRI, 16, 1) + FIELD(MIO_MST_TRI0, PIN_15_TRI, 15, 1) + FIELD(MIO_MST_TRI0, PIN_14_TRI, 14, 1) + FIELD(MIO_MST_TRI0, PIN_13_TRI, 13, 1) + FIELD(MIO_MST_TRI0, PIN_12_TRI, 12, 1) + FIELD(MIO_MST_TRI0, PIN_11_TRI, 11, 1) + FIELD(MIO_MST_TRI0, PIN_10_TRI, 10, 1) + FIELD(MIO_MST_TRI0, PIN_09_TRI, 9, 1) + FIELD(MIO_MST_TRI0, PIN_08_TRI, 8, 1) + FIELD(MIO_MST_TRI0, PIN_07_TRI, 7, 1) + FIELD(MIO_MST_TRI0, PIN_06_TRI, 6, 1) + FIELD(MIO_MST_TRI0, PIN_05_TRI, 5, 1) + FIELD(MIO_MST_TRI0, PIN_04_TRI, 4, 1) + FIELD(MIO_MST_TRI0, PIN_03_TRI, 3, 1) + FIELD(MIO_MST_TRI0, PIN_02_TRI, 2, 1) + FIELD(MIO_MST_TRI0, PIN_01_TRI, 1, 1) + FIELD(MIO_MST_TRI0, PIN_00_TRI, 0, 1) +REG32(MIO_MST_TRI1, 0x204) + FIELD(MIO_MST_TRI1, PIN_51_TRI, 25, 1) + FIELD(MIO_MST_TRI1, PIN_50_TRI, 24, 1) + FIELD(MIO_MST_TRI1, PIN_49_TRI, 23, 1) + FIELD(MIO_MST_TRI1, PIN_48_TRI, 22, 1) + FIELD(MIO_MST_TRI1, PIN_47_TRI, 21, 1) + FIELD(MIO_MST_TRI1, PIN_46_TRI, 20, 1) + FIELD(MIO_MST_TRI1, PIN_45_TRI, 19, 1) + FIELD(MIO_MST_TRI1, PIN_44_TRI, 18, 1) + FIELD(MIO_MST_TRI1, PIN_43_TRI, 17, 1) + FIELD(MIO_MST_TRI1, PIN_42_TRI, 16, 1) + FIELD(MIO_MST_TRI1, PIN_41_TRI, 15, 1) + FIELD(MIO_MST_TRI1, PIN_40_TRI, 14, 1) + FIELD(MIO_MST_TRI1, PIN_39_TRI, 13, 1) + FIELD(MIO_MST_TRI1, PIN_38_TRI, 12, 1) + FIELD(MIO_MST_TRI1, PIN_37_TRI, 11, 1) + FIELD(MIO_MST_TRI1, PIN_36_TRI, 10, 1) + FIELD(MIO_MST_TRI1, PIN_35_TRI, 9, 1) + FIELD(MIO_MST_TRI1, PIN_34_TRI, 8, 1) + FIELD(MIO_MST_TRI1, PIN_33_TRI, 7, 1) + FIELD(MIO_MST_TRI1, PIN_32_TRI, 6, 1) + FIELD(MIO_MST_TRI1, PIN_31_TRI, 5, 1) + FIELD(MIO_MST_TRI1, PIN_30_TRI, 4, 1) + FIELD(MIO_MST_TRI1, PIN_29_TRI, 3, 1) + FIELD(MIO_MST_TRI1, PIN_28_TRI, 2, 1) + FIELD(MIO_MST_TRI1, PIN_27_TRI, 1, 1) + FIELD(MIO_MST_TRI1, PIN_26_TRI, 0, 1) +REG32(BNK1_EN_RX, 0x300) + FIELD(BNK1_EN_RX, BNK1_EN_RX, 0, 26) +REG32(BNK1_SEL_RX0, 0x304) +REG32(BNK1_SEL_RX1, 0x308) + FIELD(BNK1_SEL_RX1, BNK1_SEL_RX, 0, 20) +REG32(BNK1_EN_RX_SCHMITT_HYST, 0x30c) + FIELD(BNK1_EN_RX_SCHMITT_HYST, BNK1_EN_RX_SCHMITT_HYST, 0, 26) +REG32(BNK1_EN_WK_PD, 0x310) + FIELD(BNK1_EN_WK_PD, BNK1_EN_WK_PD, 0, 26) +REG32(BNK1_EN_WK_PU, 0x314) + FIELD(BNK1_EN_WK_PU, BNK1_EN_WK_PU, 0, 26) +REG32(BNK1_SEL_DRV0, 0x318) +REG32(BNK1_SEL_DRV1, 0x31c) + FIELD(BNK1_SEL_DRV1, BNK1_SEL_DRV, 0, 20) +REG32(BNK1_SEL_SLEW, 0x320) + FIELD(BNK1_SEL_SLEW, BNK1_SEL_SLEW, 0, 26) +REG32(BNK1_EN_DFT_OPT_INV, 0x324) + FIELD(BNK1_EN_DFT_OPT_INV, BNK1_EN_DFT_OPT_INV, 0, 26) +REG32(BNK1_EN_PAD2PAD_LOOPBACK, 0x328) + FIELD(BNK1_EN_PAD2PAD_LOOPBACK, BNK1_EN_PAD2PAD_LOOPBACK, 0, 13) +REG32(BNK1_RX_SPARE0, 0x32c) +REG32(BNK1_RX_SPARE1, 0x330) + FIELD(BNK1_RX_SPARE1, BNK1_RX_SPARE, 0, 20) +REG32(BNK1_TX_SPARE0, 0x334) +REG32(BNK1_TX_SPARE1, 0x338) + FIELD(BNK1_TX_SPARE1, BNK1_TX_SPARE, 0, 20) +REG32(BNK1_SEL_EN1P8, 0x33c) + FIELD(BNK1_SEL_EN1P8, BNK1_SEL_EN1P8, 0, 1) +REG32(BNK1_EN_B_POR_DETECT, 0x340) + FIELD(BNK1_EN_B_POR_DETECT, BNK1_EN_B_POR_DETECT, 0, 1) +REG32(BNK1_LPF_BYP_POR_DETECT, 0x344) + FIELD(BNK1_LPF_BYP_POR_DETECT, BNK1_LPF_BYP_POR_DETECT, 0, 1) +REG32(BNK1_EN_LATCH, 0x348) + FIELD(BNK1_EN_LATCH, BNK1_EN_LATCH, 0, 1) +REG32(BNK1_VBG_LPF_BYP_B, 0x34c) + FIELD(BNK1_VBG_LPF_BYP_B, BNK1_VBG_LPF_BYP_B, 0, 1) +REG32(BNK1_EN_AMP_B, 0x350) + FIELD(BNK1_EN_AMP_B, BNK1_EN_AMP_B, 0, 2) +REG32(BNK1_SPARE_BIAS, 0x354) + FIELD(BNK1_SPARE_BIAS, BNK1_SPARE_BIAS, 0, 4) +REG32(BNK1_DRIVER_BIAS, 0x358) + FIELD(BNK1_DRIVER_BIAS, BNK1_DRIVER_BIAS, 0, 15) +REG32(BNK1_VMODE, 0x35c) + FIELD(BNK1_VMODE, BNK1_VMODE, 0, 1) +REG32(BNK1_SEL_AUX_IO_RX, 0x360) + FIELD(BNK1_SEL_AUX_IO_RX, BNK1_SEL_AUX_IO_RX, 0, 26) +REG32(BNK1_EN_TX_HS_MODE, 0x364) + FIELD(BNK1_EN_TX_HS_MODE, BNK1_EN_TX_HS_MODE, 0, 26) +REG32(SD0_CLK_CTRL, 0x400) + FIELD(SD0_CLK_CTRL, SDIO0_FBCLK_SEL, 2, 1) + FIELD(SD0_CLK_CTRL, SDIO0_RX_SRC_SEL, 0, 2) +REG32(SD0_CTRL_REG, 0x404) + FIELD(SD0_CTRL_REG, SD0_EMMC_SEL, 0, 1) +REG32(SD0_CONFIG_REG1, 0x410) + FIELD(SD0_CONFIG_REG1, SD0_BASECLK, 7, 8) + FIELD(SD0_CONFIG_REG1, SD0_TUNIGCOUNT, 1, 6) + FIELD(SD0_CONFIG_REG1, SD0_ASYNCWKPENA, 0, 1) +REG32(SD0_CONFIG_REG2, 0x414) + FIELD(SD0_CONFIG_REG2, SD0_SLOTTYPE, 12, 2) + FIELD(SD0_CONFIG_REG2, SD0_ASYCINTR, 11, 1) + FIELD(SD0_CONFIG_REG2, SD0_64BIT, 10, 1) + FIELD(SD0_CONFIG_REG2, SD0_1P8V, 9, 1) + FIELD(SD0_CONFIG_REG2, SD0_3P0V, 8, 1) + FIELD(SD0_CONFIG_REG2, SD0_3P3V, 7, 1) + FIELD(SD0_CONFIG_REG2, SD0_SUSPRES, 6, 1) + FIELD(SD0_CONFIG_REG2, SD0_SDMA, 5, 1) + FIELD(SD0_CONFIG_REG2, SD0_HIGHSPEED, 4, 1) + FIELD(SD0_CONFIG_REG2, SD0_ADMA2, 3, 1) + FIELD(SD0_CONFIG_REG2, SD0_8BIT, 2, 1) + FIELD(SD0_CONFIG_REG2, SD0_MAXBLK, 0, 2) +REG32(SD0_CONFIG_REG3, 0x418) + FIELD(SD0_CONFIG_REG3, SD0_TUNINGSDR50, 10, 1) + FIELD(SD0_CONFIG_REG3, SD0_RETUNETMR, 6, 4) + FIELD(SD0_CONFIG_REG3, SD0_DDRIVER, 5, 1) + FIELD(SD0_CONFIG_REG3, SD0_CDRIVER, 4, 1) + FIELD(SD0_CONFIG_REG3, SD0_ADRIVER, 3, 1) + FIELD(SD0_CONFIG_REG3, SD0_DDR50, 2, 1) + FIELD(SD0_CONFIG_REG3, SD0_SDR104, 1, 1) + FIELD(SD0_CONFIG_REG3, SD0_SDR50, 0, 1) +REG32(SD0_INITPRESET, 0x41c) + FIELD(SD0_INITPRESET, SD0_INITPRESET, 0, 13) +REG32(SD0_DSPPRESET, 0x420) + FIELD(SD0_DSPPRESET, SD0_DSPPRESET, 0, 13) +REG32(SD0_HSPDPRESET, 0x424) + FIELD(SD0_HSPDPRESET, SD0_HSPDPRESET, 0, 13) +REG32(SD0_SDR12PRESET, 0x428) + FIELD(SD0_SDR12PRESET, SD0_SDR12PRESET, 0, 13) +REG32(SD0_SDR25PRESET, 0x42c) + FIELD(SD0_SDR25PRESET, SD0_SDR25PRESET, 0, 13) +REG32(SD0_SDR50PRSET, 0x430) + FIELD(SD0_SDR50PRSET, SD0_SDR50PRESET, 0, 13) +REG32(SD0_SDR104PRST, 0x434) + FIELD(SD0_SDR104PRST, SD0_SDR104PRESET, 0, 13) +REG32(SD0_DDR50PRESET, 0x438) + FIELD(SD0_DDR50PRESET, SD0_DDR50PRESET, 0, 13) +REG32(SD0_MAXCUR1P8, 0x43c) + FIELD(SD0_MAXCUR1P8, SD0_MAXCUR1P8, 0, 8) +REG32(SD0_MAXCUR3P0, 0x440) + FIELD(SD0_MAXCUR3P0, SD0_MAXCUR3P0, 0, 8) +REG32(SD0_MAXCUR3P3, 0x444) + FIELD(SD0_MAXCUR3P3, SD0_MAXCUR3P3, 0, 8) +REG32(SD0_DLL_CTRL, 0x448) + FIELD(SD0_DLL_CTRL, SD0_CLKSTABLE_CFG, 9, 1) + FIELD(SD0_DLL_CTRL, SD0_DLL_CFG, 5, 4) + FIELD(SD0_DLL_CTRL, SD0_DLL_PSDONE, 4, 1) + FIELD(SD0_DLL_CTRL, SD0_DLL_OVF, 3, 1) + FIELD(SD0_DLL_CTRL, SD0_DLL_RST, 2, 1) + FIELD(SD0_DLL_CTRL, SD0_DLL_TESTMODE, 1, 1) + FIELD(SD0_DLL_CTRL, SD0_DLL_LOCK, 0, 1) +REG32(SD0_CDN_CTRL, 0x44c) + FIELD(SD0_CDN_CTRL, SD0_CDN_CTRL, 0, 1) +REG32(SD0_DLL_TEST, 0x450) + FIELD(SD0_DLL_TEST, DLL_DIV, 16, 8) + FIELD(SD0_DLL_TEST, DLL_TX_SEL, 9, 7) + FIELD(SD0_DLL_TEST, DLL_RX_SEL, 0, 9) +REG32(SD0_RX_TUNING_SEL, 0x454) + FIELD(SD0_RX_TUNING_SEL, SD0_RX_SEL, 0, 9) +REG32(SD0_DLL_DIV_MAP0, 0x458) + FIELD(SD0_DLL_DIV_MAP0, DIV_3, 24, 8) + FIELD(SD0_DLL_DIV_MAP0, DIV_2, 16, 8) + FIELD(SD0_DLL_DIV_MAP0, DIV_1, 8, 8) + FIELD(SD0_DLL_DIV_MAP0, DIV_0, 0, 8) +REG32(SD0_DLL_DIV_MAP1, 0x45c) + FIELD(SD0_DLL_DIV_MAP1, DIV_7, 24, 8) + FIELD(SD0_DLL_DIV_MAP1, DIV_6, 16, 8) + FIELD(SD0_DLL_DIV_MAP1, DIV_5, 8, 8) + FIELD(SD0_DLL_DIV_MAP1, DIV_4, 0, 8) +REG32(SD0_IOU_COHERENT_CTRL, 0x460) + FIELD(SD0_IOU_COHERENT_CTRL, SD0_AXI_COH, 0, 4) +REG32(SD0_IOU_INTERCONNECT_ROUTE, 0x464) + FIELD(SD0_IOU_INTERCONNECT_ROUTE, SD0, 0, 1) +REG32(SD0_IOU_RAM, 0x468) + FIELD(SD0_IOU_RAM, EMASA0, 6, 1) + FIELD(SD0_IOU_RAM, EMAB0, 3, 3) + FIELD(SD0_IOU_RAM, EMAA0, 0, 3) +REG32(SD0_IOU_INTERCONNECT_QOS, 0x46c) + FIELD(SD0_IOU_INTERCONNECT_QOS, SD0_QOS, 0, 4) +REG32(SD1_CLK_CTRL, 0x480) + FIELD(SD1_CLK_CTRL, SDIO1_FBCLK_SEL, 1, 1) + FIELD(SD1_CLK_CTRL, SDIO1_RX_SRC_SEL, 0, 1) +REG32(SD1_CTRL_REG, 0x484) + FIELD(SD1_CTRL_REG, SD1_EMMC_SEL, 0, 1) +REG32(SD1_CONFIG_REG1, 0x490) + FIELD(SD1_CONFIG_REG1, SD1_BASECLK, 7, 8) + FIELD(SD1_CONFIG_REG1, SD1_TUNIGCOUNT, 1, 6) + FIELD(SD1_CONFIG_REG1, SD1_ASYNCWKPENA, 0, 1) +REG32(SD1_CONFIG_REG2, 0x494) + FIELD(SD1_CONFIG_REG2, SD1_SLOTTYPE, 12, 2) + FIELD(SD1_CONFIG_REG2, SD1_ASYCINTR, 11, 1) + FIELD(SD1_CONFIG_REG2, SD1_64BIT, 10, 1) + FIELD(SD1_CONFIG_REG2, SD1_1P8V, 9, 1) + FIELD(SD1_CONFIG_REG2, SD1_3P0V, 8, 1) + FIELD(SD1_CONFIG_REG2, SD1_3P3V, 7, 1) + FIELD(SD1_CONFIG_REG2, SD1_SUSPRES, 6, 1) + FIELD(SD1_CONFIG_REG2, SD1_SDMA, 5, 1) + FIELD(SD1_CONFIG_REG2, SD1_HIGHSPEED, 4, 1) + FIELD(SD1_CONFIG_REG2, SD1_ADMA2, 3, 1) + FIELD(SD1_CONFIG_REG2, SD1_8BIT, 2, 1) + FIELD(SD1_CONFIG_REG2, SD1_MAXBLK, 0, 2) +REG32(SD1_CONFIG_REG3, 0x498) + FIELD(SD1_CONFIG_REG3, SD1_TUNINGSDR50, 10, 1) + FIELD(SD1_CONFIG_REG3, SD1_RETUNETMR, 6, 4) + FIELD(SD1_CONFIG_REG3, SD1_DDRIVER, 5, 1) + FIELD(SD1_CONFIG_REG3, SD1_CDRIVER, 4, 1) + FIELD(SD1_CONFIG_REG3, SD1_ADRIVER, 3, 1) + FIELD(SD1_CONFIG_REG3, SD1_DDR50, 2, 1) + FIELD(SD1_CONFIG_REG3, SD1_SDR104, 1, 1) + FIELD(SD1_CONFIG_REG3, SD1_SDR50, 0, 1) +REG32(SD1_INITPRESET, 0x49c) + FIELD(SD1_INITPRESET, SD1_INITPRESET, 0, 13) +REG32(SD1_DSPPRESET, 0x4a0) + FIELD(SD1_DSPPRESET, SD1_DSPPRESET, 0, 13) +REG32(SD1_HSPDPRESET, 0x4a4) + FIELD(SD1_HSPDPRESET, SD1_HSPDPRESET, 0, 13) +REG32(SD1_SDR12PRESET, 0x4a8) + FIELD(SD1_SDR12PRESET, SD1_SDR12PRESET, 0, 13) +REG32(SD1_SDR25PRESET, 0x4ac) + FIELD(SD1_SDR25PRESET, SD1_SDR25PRESET, 0, 13) +REG32(SD1_SDR50PRSET, 0x4b0) + FIELD(SD1_SDR50PRSET, SD1_SDR50PRESET, 0, 13) +REG32(SD1_SDR104PRST, 0x4b4) + FIELD(SD1_SDR104PRST, SD1_SDR104PRESET, 0, 13) +REG32(SD1_DDR50PRESET, 0x4b8) + FIELD(SD1_DDR50PRESET, SD1_DDR50PRESET, 0, 13) +REG32(SD1_MAXCUR1P8, 0x4bc) + FIELD(SD1_MAXCUR1P8, SD1_MAXCUR1P8, 0, 8) +REG32(SD1_MAXCUR3P0, 0x4c0) + FIELD(SD1_MAXCUR3P0, SD1_MAXCUR3P0, 0, 8) +REG32(SD1_MAXCUR3P3, 0x4c4) + FIELD(SD1_MAXCUR3P3, SD1_MAXCUR3P3, 0, 8) +REG32(SD1_DLL_CTRL, 0x4c8) + FIELD(SD1_DLL_CTRL, SD1_CLKSTABLE_CFG, 9, 1) + FIELD(SD1_DLL_CTRL, SD1_DLL_CFG, 5, 4) + FIELD(SD1_DLL_CTRL, SD1_DLL_PSDONE, 4, 1) + FIELD(SD1_DLL_CTRL, SD1_DLL_OVF, 3, 1) + FIELD(SD1_DLL_CTRL, SD1_DLL_RST, 2, 1) + FIELD(SD1_DLL_CTRL, SD1_DLL_TESTMODE, 1, 1) + FIELD(SD1_DLL_CTRL, SD1_DLL_LOCK, 0, 1) +REG32(SD1_CDN_CTRL, 0x4cc) + FIELD(SD1_CDN_CTRL, SD1_CDN_CTRL, 0, 1) +REG32(SD1_DLL_TEST, 0x4d0) + FIELD(SD1_DLL_TEST, DLL_DIV, 16, 8) + FIELD(SD1_DLL_TEST, DLL_TX_SEL, 9, 7) + FIELD(SD1_DLL_TEST, DLL_RX_SEL, 0, 9) +REG32(SD1_RX_TUNING_SEL, 0x4d4) + FIELD(SD1_RX_TUNING_SEL, SD1_RX_SEL, 0, 9) +REG32(SD1_DLL_DIV_MAP0, 0x4d8) + FIELD(SD1_DLL_DIV_MAP0, DIV_3, 24, 8) + FIELD(SD1_DLL_DIV_MAP0, DIV_2, 16, 8) + FIELD(SD1_DLL_DIV_MAP0, DIV_1, 8, 8) + FIELD(SD1_DLL_DIV_MAP0, DIV_0, 0, 8) +REG32(SD1_DLL_DIV_MAP1, 0x4dc) + FIELD(SD1_DLL_DIV_MAP1, DIV_7, 24, 8) + FIELD(SD1_DLL_DIV_MAP1, DIV_6, 16, 8) + FIELD(SD1_DLL_DIV_MAP1, DIV_5, 8, 8) + FIELD(SD1_DLL_DIV_MAP1, DIV_4, 0, 8) +REG32(SD1_IOU_COHERENT_CTRL, 0x4e0) + FIELD(SD1_IOU_COHERENT_CTRL, SD1_AXI_COH, 0, 4) +REG32(SD1_IOU_INTERCONNECT_ROUTE, 0x4e4) + FIELD(SD1_IOU_INTERCONNECT_ROUTE, SD1, 0, 1) +REG32(SD1_IOU_RAM, 0x4e8) + FIELD(SD1_IOU_RAM, EMASA0, 6, 1) + FIELD(SD1_IOU_RAM, EMAB0, 3, 3) + FIELD(SD1_IOU_RAM, EMAA0, 0, 3) +REG32(SD1_IOU_INTERCONNECT_QOS, 0x4ec) + FIELD(SD1_IOU_INTERCONNECT_QOS, SD1_QOS, 0, 4) +REG32(OSPI_QSPI_IOU_AXI_MUX_SEL, 0x504) + FIELD(OSPI_QSPI_IOU_AXI_MUX_SEL, OSPI_MUX_SEL, 1, 1) + FIELD(OSPI_QSPI_IOU_AXI_MUX_SEL, QSPI_OSPI_MUX_SEL, 0, 1) +REG32(QSPI_IOU_COHERENT_CTRL, 0x508) + FIELD(QSPI_IOU_COHERENT_CTRL, QSPI_AXI_COH, 0, 4) +REG32(QSPI_IOU_INTERCONNECT_ROUTE, 0x50c) + FIELD(QSPI_IOU_INTERCONNECT_ROUTE, QSPI, 0, 1) +REG32(QSPI_IOU_RAM, 0x510) + FIELD(QSPI_IOU_RAM, EMASA1, 13, 1) + FIELD(QSPI_IOU_RAM, EMAB1, 10, 3) + FIELD(QSPI_IOU_RAM, EMAA1, 7, 3) + FIELD(QSPI_IOU_RAM, EMASA0, 6, 1) + FIELD(QSPI_IOU_RAM, EMAB0, 3, 3) + FIELD(QSPI_IOU_RAM, EMAA0, 0, 3) +REG32(QSPI_IOU_INTERCONNECT_QOS, 0x514) + FIELD(QSPI_IOU_INTERCONNECT_QOS, QSPI_QOS, 0, 4) +REG32(OSPI_IOU_COHERENT_CTRL, 0x530) + FIELD(OSPI_IOU_COHERENT_CTRL, OSPI_AXI_COH, 0, 4) +REG32(OSPI_IOU_INTERCONNECT_ROUTE, 0x534) + FIELD(OSPI_IOU_INTERCONNECT_ROUTE, OSPI, 0, 1) +REG32(OSPI_IOU_RAM, 0x538) + FIELD(OSPI_IOU_RAM, EMAS0, 5, 1) + FIELD(OSPI_IOU_RAM, EMAW0, 3, 2) + FIELD(OSPI_IOU_RAM, EMA0, 0, 3) +REG32(OSPI_IOU_INTERCONNECT_QOS, 0x53c) + FIELD(OSPI_IOU_INTERCONNECT_QOS, OSPI_QOS, 0, 4) +REG32(OSPI_REFCLK_DLY_CTRL, 0x540) + FIELD(OSPI_REFCLK_DLY_CTRL, DLY1, 3, 2) + FIELD(OSPI_REFCLK_DLY_CTRL, DLY0, 0, 3) +REG32(CUR_PWR_ST, 0x600) + FIELD(CUR_PWR_ST, U2PMU, 0, 2) +REG32(CONNECT_ST, 0x604) + FIELD(CONNECT_ST, U2PMU, 0, 1) +REG32(PW_STATE_REQ, 0x608) + FIELD(PW_STATE_REQ, BIT_1_0, 0, 2) +REG32(HOST_U2_PORT_DISABLE, 0x60c) + FIELD(HOST_U2_PORT_DISABLE, BIT_0, 0, 1) +REG32(DBG_U2PMU, 0x610) +REG32(DBG_U2PMU_EXT1, 0x614) +REG32(DBG_U2PMU_EXT2, 0x618) + FIELD(DBG_U2PMU_EXT2, BIT_67_64, 0, 4) +REG32(PME_GEN_U2PMU, 0x61c) + FIELD(PME_GEN_U2PMU, BIT_0, 0, 1) +REG32(PWR_CONFIG_USB2, 0x620) + FIELD(PWR_CONFIG_USB2, STRAP, 0, 30) +REG32(PHY_HUB, 0x624) + FIELD(PHY_HUB, VBUS_CTRL, 1, 1) + FIELD(PHY_HUB, OVER_CURRENT, 0, 1) +REG32(CTRL, 0x700) + FIELD(CTRL, SLVERR_ENABLE, 0, 1) +REG32(ISR, 0x800) + FIELD(ISR, ADDR_DECODE_ERR, 0, 1) +REG32(IMR, 0x804) + FIELD(IMR, ADDR_DECODE_ERR, 0, 1) +REG32(IER, 0x808) + FIELD(IER, ADDR_DECODE_ERR, 0, 1) +REG32(IDR, 0x80c) + FIELD(IDR, ADDR_DECODE_ERR, 0, 1) +REG32(ITR, 0x810) + FIELD(ITR, ADDR_DECODE_ERR, 0, 1) +REG32(PARITY_ISR, 0x814) + FIELD(PARITY_ISR, PERR_AXI_SD1_IOU, 12, 1) + FIELD(PARITY_ISR, PERR_AXI_SD0_IOU, 11, 1) + FIELD(PARITY_ISR, PERR_AXI_QSPI_IOU, 10, 1) + FIELD(PARITY_ISR, PERR_AXI_OSPI_IOU, 9, 1) + FIELD(PARITY_ISR, PERR_IOU_SD1, 8, 1) + FIELD(PARITY_ISR, PERR_IOU_SD0, 7, 1) + FIELD(PARITY_ISR, PERR_IOU_QSPI1, 6, 1) + FIELD(PARITY_ISR, PERR_IOUSLCR_SECURE_APB, 5, 1) + FIELD(PARITY_ISR, PERR_IOUSLCR_APB, 4, 1) + FIELD(PARITY_ISR, PERR_QSPI0_APB, 3, 1) + FIELD(PARITY_ISR, PERR_OSPI_APB, 2, 1) + FIELD(PARITY_ISR, PERR_I2C_APB, 1, 1) + FIELD(PARITY_ISR, PERR_GPIO_APB, 0, 1) +REG32(PARITY_IMR, 0x818) + FIELD(PARITY_IMR, PERR_AXI_SD1_IOU, 12, 1) + FIELD(PARITY_IMR, PERR_AXI_SD0_IOU, 11, 1) + FIELD(PARITY_IMR, PERR_AXI_QSPI_IOU, 10, 1) + FIELD(PARITY_IMR, PERR_AXI_OSPI_IOU, 9, 1) + FIELD(PARITY_IMR, PERR_IOU_SD1, 8, 1) + FIELD(PARITY_IMR, PERR_IOU_SD0, 7, 1) + FIELD(PARITY_IMR, PERR_IOU_QSPI1, 6, 1) + FIELD(PARITY_IMR, PERR_IOUSLCR_SECURE_APB, 5, 1) + FIELD(PARITY_IMR, PERR_IOUSLCR_APB, 4, 1) + FIELD(PARITY_IMR, PERR_QSPI0_APB, 3, 1) + FIELD(PARITY_IMR, PERR_OSPI_APB, 2, 1) + FIELD(PARITY_IMR, PERR_I2C_APB, 1, 1) + FIELD(PARITY_IMR, PERR_GPIO_APB, 0, 1) +REG32(PARITY_IER, 0x81c) + FIELD(PARITY_IER, PERR_AXI_SD1_IOU, 12, 1) + FIELD(PARITY_IER, PERR_AXI_SD0_IOU, 11, 1) + FIELD(PARITY_IER, PERR_AXI_QSPI_IOU, 10, 1) + FIELD(PARITY_IER, PERR_AXI_OSPI_IOU, 9, 1) + FIELD(PARITY_IER, PERR_IOU_SD1, 8, 1) + FIELD(PARITY_IER, PERR_IOU_SD0, 7, 1) + FIELD(PARITY_IER, PERR_IOU_QSPI1, 6, 1) + FIELD(PARITY_IER, PERR_IOUSLCR_SECURE_APB, 5, 1) + FIELD(PARITY_IER, PERR_IOUSLCR_APB, 4, 1) + FIELD(PARITY_IER, PERR_QSPI0_APB, 3, 1) + FIELD(PARITY_IER, PERR_OSPI_APB, 2, 1) + FIELD(PARITY_IER, PERR_I2C_APB, 1, 1) + FIELD(PARITY_IER, PERR_GPIO_APB, 0, 1) +REG32(PARITY_IDR, 0x820) + FIELD(PARITY_IDR, PERR_AXI_SD1_IOU, 12, 1) + FIELD(PARITY_IDR, PERR_AXI_SD0_IOU, 11, 1) + FIELD(PARITY_IDR, PERR_AXI_QSPI_IOU, 10, 1) + FIELD(PARITY_IDR, PERR_AXI_OSPI_IOU, 9, 1) + FIELD(PARITY_IDR, PERR_IOU_SD1, 8, 1) + FIELD(PARITY_IDR, PERR_IOU_SD0, 7, 1) + FIELD(PARITY_IDR, PERR_IOU_QSPI1, 6, 1) + FIELD(PARITY_IDR, PERR_IOUSLCR_SECURE_APB, 5, 1) + FIELD(PARITY_IDR, PERR_IOUSLCR_APB, 4, 1) + FIELD(PARITY_IDR, PERR_QSPI0_APB, 3, 1) + FIELD(PARITY_IDR, PERR_OSPI_APB, 2, 1) + FIELD(PARITY_IDR, PERR_I2C_APB, 1, 1) + FIELD(PARITY_IDR, PERR_GPIO_APB, 0, 1) +REG32(PARITY_ITR, 0x824) + FIELD(PARITY_ITR, PERR_AXI_SD1_IOU, 12, 1) + FIELD(PARITY_ITR, PERR_AXI_SD0_IOU, 11, 1) + FIELD(PARITY_ITR, PERR_AXI_QSPI_IOU, 10, 1) + FIELD(PARITY_ITR, PERR_AXI_OSPI_IOU, 9, 1) + FIELD(PARITY_ITR, PERR_IOU_SD1, 8, 1) + FIELD(PARITY_ITR, PERR_IOU_SD0, 7, 1) + FIELD(PARITY_ITR, PERR_IOU_QSPI1, 6, 1) + FIELD(PARITY_ITR, PERR_IOUSLCR_SECURE_APB, 5, 1) + FIELD(PARITY_ITR, PERR_IOUSLCR_APB, 4, 1) + FIELD(PARITY_ITR, PERR_QSPI0_APB, 3, 1) + FIELD(PARITY_ITR, PERR_OSPI_APB, 2, 1) + FIELD(PARITY_ITR, PERR_I2C_APB, 1, 1) + FIELD(PARITY_ITR, PERR_GPIO_APB, 0, 1) +REG32(WPROT0, 0x828) + FIELD(WPROT0, ACTIVE, 0, 1) + +static void parity_imr_update_irq (XlnxVersalPmcIouSlcr *s) +{ +bool pending = s->regs[R_PARITY_ISR ] & ~s->regs[R_PARITY_IMR ]; +qemu_set_irq (s->irq_parity_imr, pending); +} + +static void parity_isr_postw (RegisterInfo *reg,uint64_t val64) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (reg->opaque); +parity_imr_update_irq (s); +} + +static uint64_t parity_ier_prew (RegisterInfo *reg,uint64_t val64) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (reg->opaque); +uint32_t val = val64; + + s->regs[R_PARITY_IMR ] &= ~val; +parity_imr_update_irq (s); +return 0 ; +} + +static uint64_t parity_idr_prew (RegisterInfo *reg,uint64_t val64) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (reg->opaque); +uint32_t val = val64; + + s->regs[R_PARITY_IMR ] |= val; +parity_imr_update_irq (s); +return 0 ; +} + +static uint64_t parity_itr_prew (RegisterInfo *reg,uint64_t val64) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (reg->opaque); +uint32_t val = val64; + + s->regs[R_PARITY_ISR ] |= val; +parity_imr_update_irq (s); +return 0 ; +} + +static void imr_update_irq (XlnxVersalPmcIouSlcr *s) +{ +bool pending = s->regs[R_ISR ] & ~s->regs[R_IMR ]; +qemu_set_irq (s->irq_imr, pending); +} + +static void isr_postw (RegisterInfo *reg,uint64_t val64) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (reg->opaque); +imr_update_irq (s); +} + +static uint64_t ier_prew (RegisterInfo *reg,uint64_t val64) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (reg->opaque); +uint32_t val = val64; + + s->regs[R_IMR ] &= ~val; +imr_update_irq (s); +return 0 ; +} + +static uint64_t idr_prew (RegisterInfo *reg,uint64_t val64) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (reg->opaque); +uint32_t val = val64; + + s->regs[R_IMR ] |= val; +imr_update_irq (s); +return 0 ; +} + +static uint64_t itr_prew (RegisterInfo *reg,uint64_t val64) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (reg->opaque); +uint32_t val = val64; + + s->regs[R_ISR ] |= val; +imr_update_irq (s); +return 0 ; +} + +static uint64_t sd0_ctrl_reg_prew (RegisterInfo *reg,uint64_t val64) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (reg->opaque); +uint32_t prev =ARRAY_FIELD_EX32 (s->regs,SD0_CTRL_REG ,SD0_EMMC_SEL ); + +if (prev != (val64 &R_SD0_CTRL_REG_SD0_EMMC_SEL_MASK )) { +qemu_set_irq (s->sd_emmc_sel[0 ], !!val64); + } + +return val64; +} + +static uint64_t sd1_ctrl_reg_prew (RegisterInfo *reg,uint64_t val64) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (reg->opaque); +uint32_t prev =ARRAY_FIELD_EX32 (s->regs,SD1_CTRL_REG ,SD1_EMMC_SEL ); + +if (prev != (val64 &R_SD1_CTRL_REG_SD1_EMMC_SEL_MASK )) { +qemu_set_irq (s->sd_emmc_sel[1 ], !!val64); + } + +return val64; +} + +static uint64_t ospi_qspi_iou_axi_mux_sel_prew (RegisterInfo *reg, +uint64_t val64) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (reg->opaque); +uint32_t val32 = (uint32_t ) val64; +uint8_t ospi_mux_sel =FIELD_EX32 (val32,OSPI_QSPI_IOU_AXI_MUX_SEL , +OSPI_MUX_SEL ); +uint8_t qspi_ospi_mux_sel =FIELD_EX32 (val32,OSPI_QSPI_IOU_AXI_MUX_SEL , +QSPI_OSPI_MUX_SEL ); + +if (ospi_mux_sel != +ARRAY_FIELD_EX32 (s->regs,OSPI_QSPI_IOU_AXI_MUX_SEL ,OSPI_MUX_SEL )) { +qemu_set_irq (s->ospi_mux_sel, !!ospi_mux_sel); + } + +if (qspi_ospi_mux_sel != +ARRAY_FIELD_EX32 (s->regs,OSPI_QSPI_IOU_AXI_MUX_SEL , +QSPI_OSPI_MUX_SEL )) { +qemu_set_irq (s->qspi_ospi_mux_sel, !!qspi_ospi_mux_sel); + } + +return val64; +} + +static RegisterAccessInfo pmc_iou_slcr_regs_info[] = { + { .name ="MIO_PIN_0" , .addr =A_MIO_PIN_0 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_1" , .addr =A_MIO_PIN_1 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_2" , .addr =A_MIO_PIN_2 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_3" , .addr =A_MIO_PIN_3 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_4" , .addr =A_MIO_PIN_4 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_5" , .addr =A_MIO_PIN_5 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_6" , .addr =A_MIO_PIN_6 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_7" , .addr =A_MIO_PIN_7 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_8" , .addr =A_MIO_PIN_8 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_9" , .addr =A_MIO_PIN_9 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_10" , .addr =A_MIO_PIN_10 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_11" , .addr =A_MIO_PIN_11 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_12" , .addr =A_MIO_PIN_12 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_13" , .addr =A_MIO_PIN_13 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_14" , .addr =A_MIO_PIN_14 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_15" , .addr =A_MIO_PIN_15 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_16" , .addr =A_MIO_PIN_16 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_17" , .addr =A_MIO_PIN_17 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_18" , .addr =A_MIO_PIN_18 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_19" , .addr =A_MIO_PIN_19 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_20" , .addr =A_MIO_PIN_20 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_21" , .addr =A_MIO_PIN_21 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_22" , .addr =A_MIO_PIN_22 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_23" , .addr =A_MIO_PIN_23 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_24" , .addr =A_MIO_PIN_24 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_25" , .addr =A_MIO_PIN_25 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_26" , .addr =A_MIO_PIN_26 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_27" , .addr =A_MIO_PIN_27 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_28" , .addr =A_MIO_PIN_28 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_29" , .addr =A_MIO_PIN_29 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_30" , .addr =A_MIO_PIN_30 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_31" , .addr =A_MIO_PIN_31 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_32" , .addr =A_MIO_PIN_32 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_33" , .addr =A_MIO_PIN_33 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_34" , .addr =A_MIO_PIN_34 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_35" , .addr =A_MIO_PIN_35 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_36" , .addr =A_MIO_PIN_36 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_37" , .addr =A_MIO_PIN_37 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_38" , .addr =A_MIO_PIN_38 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_39" , .addr =A_MIO_PIN_39 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_40" , .addr =A_MIO_PIN_40 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_41" , .addr =A_MIO_PIN_41 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_42" , .addr =A_MIO_PIN_42 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_43" , .addr =A_MIO_PIN_43 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_44" , .addr =A_MIO_PIN_44 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_45" , .addr =A_MIO_PIN_45 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_46" , .addr =A_MIO_PIN_46 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_47" , .addr =A_MIO_PIN_47 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_48" , .addr =A_MIO_PIN_48 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_49" , .addr =A_MIO_PIN_49 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_50" , .addr =A_MIO_PIN_50 , + .rsvd =0xfffffc01 , + },{ .name ="MIO_PIN_51" , .addr =A_MIO_PIN_51 , + .rsvd =0xfffffc01 , + },{ .name ="BNK0_EN_RX" , .addr =A_BNK0_EN_RX , + .reset =0x3ffffff , + .rsvd =0xfc000000 , + },{ .name ="BNK0_SEL_RX0" , .addr =A_BNK0_SEL_RX0 , + .reset =0xffffffff , + },{ .name ="BNK0_SEL_RX1" , .addr =A_BNK0_SEL_RX1 , + .reset =0xfffff , + .rsvd =0xfff00000 , + },{ .name ="BNK0_EN_RX_SCHMITT_HYST" , .addr =A_BNK0_EN_RX_SCHMITT_HYST , + .rsvd =0xfc000000 , + },{ .name ="BNK0_EN_WK_PD" , .addr =A_BNK0_EN_WK_PD , + .rsvd =0xfc000000 , + },{ .name ="BNK0_EN_WK_PU" , .addr =A_BNK0_EN_WK_PU , + .reset =0x3ffffff , + .rsvd =0xfc000000 , + },{ .name ="BNK0_SEL_DRV0" , .addr =A_BNK0_SEL_DRV0 , + .reset =0xffffffff , + },{ .name ="BNK0_SEL_DRV1" , .addr =A_BNK0_SEL_DRV1 , + .reset =0xfffff , + .rsvd =0xfff00000 , + },{ .name ="BNK0_SEL_SLEW" , .addr =A_BNK0_SEL_SLEW , + .rsvd =0xfc000000 , + },{ .name ="BNK0_EN_DFT_OPT_INV" , .addr =A_BNK0_EN_DFT_OPT_INV , + .rsvd =0xfc000000 , + },{ .name ="BNK0_EN_PAD2PAD_LOOPBACK" , + .addr =A_BNK0_EN_PAD2PAD_LOOPBACK , + .rsvd =0xffffe000 , + },{ .name ="BNK0_RX_SPARE0" , .addr =A_BNK0_RX_SPARE0 , + },{ .name ="BNK0_RX_SPARE1" , .addr =A_BNK0_RX_SPARE1 , + .rsvd =0xfff00000 , + },{ .name ="BNK0_TX_SPARE0" , .addr =A_BNK0_TX_SPARE0 , + },{ .name ="BNK0_TX_SPARE1" , .addr =A_BNK0_TX_SPARE1 , + .rsvd =0xfff00000 , + },{ .name ="BNK0_SEL_EN1P8" , .addr =A_BNK0_SEL_EN1P8 , + .rsvd =0xfffffffe , + },{ .name ="BNK0_EN_B_POR_DETECT" , .addr =A_BNK0_EN_B_POR_DETECT , + .rsvd =0xfffffffe , + },{ .name ="BNK0_LPF_BYP_POR_DETECT" , .addr =A_BNK0_LPF_BYP_POR_DETECT , + .reset =0x1 , + .rsvd =0xfffffffe , + },{ .name ="BNK0_EN_LATCH" , .addr =A_BNK0_EN_LATCH , + .rsvd =0xfffffffe , + },{ .name ="BNK0_VBG_LPF_BYP_B" , .addr =A_BNK0_VBG_LPF_BYP_B , + .reset =0x1 , + .rsvd =0xfffffffe , + },{ .name ="BNK0_EN_AMP_B" , .addr =A_BNK0_EN_AMP_B , + .rsvd =0xfffffffc , + },{ .name ="BNK0_SPARE_BIAS" , .addr =A_BNK0_SPARE_BIAS , + .rsvd =0xfffffff0 , + },{ .name ="BNK0_DRIVER_BIAS" , .addr =A_BNK0_DRIVER_BIAS , + .rsvd =0xffff8000 , + },{ .name ="BNK0_VMODE" , .addr =A_BNK0_VMODE , + .rsvd =0xfffffffe , + .ro =0x1 , + },{ .name ="BNK0_SEL_AUX_IO_RX" , .addr =A_BNK0_SEL_AUX_IO_RX , + .rsvd =0xfc000000 , + },{ .name ="BNK0_EN_TX_HS_MODE" , .addr =A_BNK0_EN_TX_HS_MODE , + .rsvd =0xfc000000 , + },{ .name ="MIO_MST_TRI0" , .addr =A_MIO_MST_TRI0 , + .reset =0x3ffffff , + .rsvd =0xfc000000 , + },{ .name ="MIO_MST_TRI1" , .addr =A_MIO_MST_TRI1 , + .reset =0x3ffffff , + .rsvd =0xfc000000 , + },{ .name ="BNK1_EN_RX" , .addr =A_BNK1_EN_RX , + .reset =0x3ffffff , + .rsvd =0xfc000000 , + },{ .name ="BNK1_SEL_RX0" , .addr =A_BNK1_SEL_RX0 , + .reset =0xffffffff , + },{ .name ="BNK1_SEL_RX1" , .addr =A_BNK1_SEL_RX1 , + .reset =0xfffff , + .rsvd =0xfff00000 , + },{ .name ="BNK1_EN_RX_SCHMITT_HYST" , .addr =A_BNK1_EN_RX_SCHMITT_HYST , + .rsvd =0xfc000000 , + },{ .name ="BNK1_EN_WK_PD" , .addr =A_BNK1_EN_WK_PD , + .rsvd =0xfc000000 , + },{ .name ="BNK1_EN_WK_PU" , .addr =A_BNK1_EN_WK_PU , + .reset =0x3ffffff , + .rsvd =0xfc000000 , + },{ .name ="BNK1_SEL_DRV0" , .addr =A_BNK1_SEL_DRV0 , + .reset =0xffffffff , + },{ .name ="BNK1_SEL_DRV1" , .addr =A_BNK1_SEL_DRV1 , + .reset =0xfffff , + .rsvd =0xfff00000 , + },{ .name ="BNK1_SEL_SLEW" , .addr =A_BNK1_SEL_SLEW , + .rsvd =0xfc000000 , + },{ .name ="BNK1_EN_DFT_OPT_INV" , .addr =A_BNK1_EN_DFT_OPT_INV , + .rsvd =0xfc000000 , + },{ .name ="BNK1_EN_PAD2PAD_LOOPBACK" , + .addr =A_BNK1_EN_PAD2PAD_LOOPBACK , + .rsvd =0xffffe000 , + },{ .name ="BNK1_RX_SPARE0" , .addr =A_BNK1_RX_SPARE0 , + },{ .name ="BNK1_RX_SPARE1" , .addr =A_BNK1_RX_SPARE1 , + .rsvd =0xfff00000 , + },{ .name ="BNK1_TX_SPARE0" , .addr =A_BNK1_TX_SPARE0 , + },{ .name ="BNK1_TX_SPARE1" , .addr =A_BNK1_TX_SPARE1 , + .rsvd =0xfff00000 , + },{ .name ="BNK1_SEL_EN1P8" , .addr =A_BNK1_SEL_EN1P8 , + .rsvd =0xfffffffe , + },{ .name ="BNK1_EN_B_POR_DETECT" , .addr =A_BNK1_EN_B_POR_DETECT , + .rsvd =0xfffffffe , + },{ .name ="BNK1_LPF_BYP_POR_DETECT" , .addr =A_BNK1_LPF_BYP_POR_DETECT , + .reset =0x1 , + .rsvd =0xfffffffe , + },{ .name ="BNK1_EN_LATCH" , .addr =A_BNK1_EN_LATCH , + .rsvd =0xfffffffe , + },{ .name ="BNK1_VBG_LPF_BYP_B" , .addr =A_BNK1_VBG_LPF_BYP_B , + .reset =0x1 , + .rsvd =0xfffffffe , + },{ .name ="BNK1_EN_AMP_B" , .addr =A_BNK1_EN_AMP_B , + .rsvd =0xfffffffc , + },{ .name ="BNK1_SPARE_BIAS" , .addr =A_BNK1_SPARE_BIAS , + .rsvd =0xfffffff0 , + },{ .name ="BNK1_DRIVER_BIAS" , .addr =A_BNK1_DRIVER_BIAS , + .rsvd =0xffff8000 , + },{ .name ="BNK1_VMODE" , .addr =A_BNK1_VMODE , + .rsvd =0xfffffffe , + .ro =0x1 , + },{ .name ="BNK1_SEL_AUX_IO_RX" , .addr =A_BNK1_SEL_AUX_IO_RX , + .rsvd =0xfc000000 , + },{ .name ="BNK1_EN_TX_HS_MODE" , .addr =A_BNK1_EN_TX_HS_MODE , + .rsvd =0xfc000000 , + },{ .name ="SD0_CLK_CTRL" , .addr =A_SD0_CLK_CTRL , + .rsvd =0xfffffff8 , + },{ .name ="SD0_CTRL_REG" , .addr =A_SD0_CTRL_REG , + .rsvd =0xfffffffe , + .pre_write = sd0_ctrl_reg_prew, + },{ .name ="SD0_CONFIG_REG1" , .addr =A_SD0_CONFIG_REG1 , + .reset =0x3250 , + .rsvd =0xffff8000 , + },{ .name ="SD0_CONFIG_REG2" , .addr =A_SD0_CONFIG_REG2 , + .reset =0xffc , + .rsvd =0xffffc000 , + },{ .name ="SD0_CONFIG_REG3" , .addr =A_SD0_CONFIG_REG3 , + .reset =0x407 , + .rsvd =0xfffff800 , + },{ .name ="SD0_INITPRESET" , .addr =A_SD0_INITPRESET , + .reset =0x100 , + .rsvd =0xffffe000 , + },{ .name ="SD0_DSPPRESET" , .addr =A_SD0_DSPPRESET , + .reset =0x4 , + .rsvd =0xffffe000 , + },{ .name ="SD0_HSPDPRESET" , .addr =A_SD0_HSPDPRESET , + .reset =0x2 , + .rsvd =0xffffe000 , + },{ .name ="SD0_SDR12PRESET" , .addr =A_SD0_SDR12PRESET , + .reset =0x4 , + .rsvd =0xffffe000 , + },{ .name ="SD0_SDR25PRESET" , .addr =A_SD0_SDR25PRESET , + .reset =0x2 , + .rsvd =0xffffe000 , + },{ .name ="SD0_SDR50PRSET" , .addr =A_SD0_SDR50PRSET , + .reset =0x1 , + .rsvd =0xffffe000 , + },{ .name ="SD0_SDR104PRST" , .addr =A_SD0_SDR104PRST , + .rsvd =0xffffe000 , + },{ .name ="SD0_DDR50PRESET" , .addr =A_SD0_DDR50PRESET , + .reset =0x2 , + .rsvd =0xffffe000 , + },{ .name ="SD0_MAXCUR1P8" , .addr =A_SD0_MAXCUR1P8 , + .rsvd =0xffffff00 , + },{ .name ="SD0_MAXCUR3P0" , .addr =A_SD0_MAXCUR3P0 , + .rsvd =0xffffff00 , + },{ .name ="SD0_MAXCUR3P3" , .addr =A_SD0_MAXCUR3P3 , + .rsvd =0xffffff00 , + },{ .name ="SD0_DLL_CTRL" , .addr =A_SD0_DLL_CTRL , + .reset =0x1 , + .rsvd =0xfffffc00 , + .ro =0x19 , + },{ .name ="SD0_CDN_CTRL" , .addr =A_SD0_CDN_CTRL , + .rsvd =0xfffffffe , + },{ .name ="SD0_DLL_TEST" , .addr =A_SD0_DLL_TEST , + .rsvd =0xff000000 , + },{ .name ="SD0_RX_TUNING_SEL" , .addr =A_SD0_RX_TUNING_SEL , + .rsvd =0xfffffe00 , + .ro =0x1ff , + },{ .name ="SD0_DLL_DIV_MAP0" , .addr =A_SD0_DLL_DIV_MAP0 , + .reset =0x50505050 , + },{ .name ="SD0_DLL_DIV_MAP1" , .addr =A_SD0_DLL_DIV_MAP1 , + .reset =0x50505050 , + },{ .name ="SD0_IOU_COHERENT_CTRL" , .addr =A_SD0_IOU_COHERENT_CTRL , + .rsvd =0xfffffff0 , + },{ .name ="SD0_IOU_INTERCONNECT_ROUTE" , + .addr =A_SD0_IOU_INTERCONNECT_ROUTE , + .rsvd =0xfffffffe , + },{ .name ="SD0_IOU_RAM" , .addr =A_SD0_IOU_RAM , + .reset =0x24 , + .rsvd =0xffffff80 , + },{ .name ="SD0_IOU_INTERCONNECT_QOS" , + .addr =A_SD0_IOU_INTERCONNECT_QOS , + .rsvd =0xfffffff0 , + },{ .name ="SD1_CLK_CTRL" , .addr =A_SD1_CLK_CTRL , + .rsvd =0xfffffffc , + },{ .name ="SD1_CTRL_REG" , .addr =A_SD1_CTRL_REG , + .rsvd =0xfffffffe , + .pre_write = sd1_ctrl_reg_prew, + },{ .name ="SD1_CONFIG_REG1" , .addr =A_SD1_CONFIG_REG1 , + .reset =0x3250 , + .rsvd =0xffff8000 , + },{ .name ="SD1_CONFIG_REG2" , .addr =A_SD1_CONFIG_REG2 , + .reset =0xffc , + .rsvd =0xffffc000 , + },{ .name ="SD1_CONFIG_REG3" , .addr =A_SD1_CONFIG_REG3 , + .reset =0x407 , + .rsvd =0xfffff800 , + },{ .name ="SD1_INITPRESET" , .addr =A_SD1_INITPRESET , + .reset =0x100 , + .rsvd =0xffffe000 , + },{ .name ="SD1_DSPPRESET" , .addr =A_SD1_DSPPRESET , + .reset =0x4 , + .rsvd =0xffffe000 , + },{ .name ="SD1_HSPDPRESET" , .addr =A_SD1_HSPDPRESET , + .reset =0x2 , + .rsvd =0xffffe000 , + },{ .name ="SD1_SDR12PRESET" , .addr =A_SD1_SDR12PRESET , + .reset =0x4 , + .rsvd =0xffffe000 , + },{ .name ="SD1_SDR25PRESET" , .addr =A_SD1_SDR25PRESET , + .reset =0x2 , + .rsvd =0xffffe000 , + },{ .name ="SD1_SDR50PRSET" , .addr =A_SD1_SDR50PRSET , + .reset =0x1 , + .rsvd =0xffffe000 , + },{ .name ="SD1_SDR104PRST" , .addr =A_SD1_SDR104PRST , + .rsvd =0xffffe000 , + },{ .name ="SD1_DDR50PRESET" , .addr =A_SD1_DDR50PRESET , + .reset =0x2 , + .rsvd =0xffffe000 , + },{ .name ="SD1_MAXCUR1P8" , .addr =A_SD1_MAXCUR1P8 , + .rsvd =0xffffff00 , + },{ .name ="SD1_MAXCUR3P0" , .addr =A_SD1_MAXCUR3P0 , + .rsvd =0xffffff00 , + },{ .name ="SD1_MAXCUR3P3" , .addr =A_SD1_MAXCUR3P3 , + .rsvd =0xffffff00 , + },{ .name ="SD1_DLL_CTRL" , .addr =A_SD1_DLL_CTRL , + .reset =0x1 , + .rsvd =0xfffffc00 , + .ro =0x19 , + },{ .name ="SD1_CDN_CTRL" , .addr =A_SD1_CDN_CTRL , + .rsvd =0xfffffffe , + },{ .name ="SD1_DLL_TEST" , .addr =A_SD1_DLL_TEST , + .rsvd =0xff000000 , + },{ .name ="SD1_RX_TUNING_SEL" , .addr =A_SD1_RX_TUNING_SEL , + .rsvd =0xfffffe00 , + .ro =0x1ff , + },{ .name ="SD1_DLL_DIV_MAP0" , .addr =A_SD1_DLL_DIV_MAP0 , + .reset =0x50505050 , + },{ .name ="SD1_DLL_DIV_MAP1" , .addr =A_SD1_DLL_DIV_MAP1 , + .reset =0x50505050 , + },{ .name ="SD1_IOU_COHERENT_CTRL" , .addr =A_SD1_IOU_COHERENT_CTRL , + .rsvd =0xfffffff0 , + },{ .name ="SD1_IOU_INTERCONNECT_ROUTE" , + .addr =A_SD1_IOU_INTERCONNECT_ROUTE , + .rsvd =0xfffffffe , + },{ .name ="SD1_IOU_RAM" , .addr =A_SD1_IOU_RAM , + .reset =0x24 , + .rsvd =0xffffff80 , + },{ .name ="SD1_IOU_INTERCONNECT_QOS" , + .addr =A_SD1_IOU_INTERCONNECT_QOS , + .rsvd =0xfffffff0 , + },{ .name ="OSPI_QSPI_IOU_AXI_MUX_SEL" , + .addr =A_OSPI_QSPI_IOU_AXI_MUX_SEL , + .reset =0x1 , + .rsvd =0xfffffffc , + .pre_write = ospi_qspi_iou_axi_mux_sel_prew, + },{ .name ="QSPI_IOU_COHERENT_CTRL" , .addr =A_QSPI_IOU_COHERENT_CTRL , + .rsvd =0xfffffff0 , + },{ .name ="QSPI_IOU_INTERCONNECT_ROUTE" , + .addr =A_QSPI_IOU_INTERCONNECT_ROUTE , + .rsvd =0xfffffffe , + },{ .name ="QSPI_IOU_RAM" , .addr =A_QSPI_IOU_RAM , + .reset =0x1224 , + .rsvd =0xffffc000 , + },{ .name ="QSPI_IOU_INTERCONNECT_QOS" , + .addr =A_QSPI_IOU_INTERCONNECT_QOS , + .rsvd =0xfffffff0 , + },{ .name ="OSPI_IOU_COHERENT_CTRL" , .addr =A_OSPI_IOU_COHERENT_CTRL , + .rsvd =0xfffffff0 , + },{ .name ="OSPI_IOU_INTERCONNECT_ROUTE" , + .addr =A_OSPI_IOU_INTERCONNECT_ROUTE , + .rsvd =0xfffffffe , + },{ .name ="OSPI_IOU_RAM" , .addr =A_OSPI_IOU_RAM , + .reset =0xa , + .rsvd =0xffffffc0 , + },{ .name ="OSPI_IOU_INTERCONNECT_QOS" , + .addr =A_OSPI_IOU_INTERCONNECT_QOS , + .rsvd =0xfffffff0 , + },{ .name ="OSPI_REFCLK_DLY_CTRL" , .addr =A_OSPI_REFCLK_DLY_CTRL , + .reset =0x13 , + .rsvd =0xffffffe0 , + },{ .name ="CUR_PWR_ST" , .addr =A_CUR_PWR_ST , + .rsvd =0xfffffffc , + .ro =0x3 , + },{ .name ="CONNECT_ST" , .addr =A_CONNECT_ST , + .rsvd =0xfffffffe , + .ro =0x1 , + },{ .name ="PW_STATE_REQ" , .addr =A_PW_STATE_REQ , + .rsvd =0xfffffffc , + },{ .name ="HOST_U2_PORT_DISABLE" , .addr =A_HOST_U2_PORT_DISABLE , + .rsvd =0xfffffffe , + },{ .name ="DBG_U2PMU" , .addr =A_DBG_U2PMU , + .ro =0xffffffff , + },{ .name ="DBG_U2PMU_EXT1" , .addr =A_DBG_U2PMU_EXT1 , + .ro =0xffffffff , + },{ .name ="DBG_U2PMU_EXT2" , .addr =A_DBG_U2PMU_EXT2 , + .rsvd =0xfffffff0 , + .ro =0xf , + },{ .name ="PME_GEN_U2PMU" , .addr =A_PME_GEN_U2PMU , + .rsvd =0xfffffffe , + .ro =0x1 , + },{ .name ="PWR_CONFIG_USB2" , .addr =A_PWR_CONFIG_USB2 , + .rsvd =0xc0000000 , + },{ .name ="PHY_HUB" , .addr =A_PHY_HUB , + .rsvd =0xfffffffc , + .ro =0x2 , + },{ .name ="CTRL" , .addr =A_CTRL , + },{ .name ="ISR" , .addr =A_ISR , + .w1c =0x1 , + .post_write = isr_postw, + },{ .name ="IMR" , .addr =A_IMR , + .reset =0x1 , + .ro =0x1 , + },{ .name ="IER" , .addr =A_IER , + .pre_write = ier_prew, + },{ .name ="IDR" , .addr =A_IDR , + .pre_write = idr_prew, + },{ .name ="ITR" , .addr =A_ITR , + .pre_write = itr_prew, + },{ .name ="PARITY_ISR" , .addr =A_PARITY_ISR , + .w1c =0x1fff , + .post_write = parity_isr_postw, + },{ .name ="PARITY_IMR" , .addr =A_PARITY_IMR , + .reset =0x1fff , + .ro =0x1fff , + },{ .name ="PARITY_IER" , .addr =A_PARITY_IER , + .pre_write = parity_ier_prew, + },{ .name ="PARITY_IDR" , .addr =A_PARITY_IDR , + .pre_write = parity_idr_prew, + },{ .name ="PARITY_ITR" , .addr =A_PARITY_ITR , + .pre_write = parity_itr_prew, + },{ .name ="WPROT0" , .addr =A_WPROT0 , + .reset =0x1 , + } +}; + +static void xlnx_versal_pmc_iou_slcr_reset_init (Object *obj,ResetType type) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (obj); +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (s->regs_info); ++i) { +register_reset (&s->regs_info[i]); + } +} + +static void xlnx_versal_pmc_iou_slcr_reset_hold (Object *obj) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (obj); + +parity_imr_update_irq (s); +imr_update_irq (s); + +/* +* Setup OSPI_QSPI mux +* By default axi slave interface is enabled for ospi-dma +*/ +qemu_set_irq (s->ospi_mux_sel,0 ); +qemu_set_irq (s->qspi_ospi_mux_sel,1 ); +} + +static const MemoryRegionOps pmc_iou_slcr_ops = { + .read = register_read_memory, + .write = register_write_memory, + .endianness =DEVICE_LITTLE_ENDIAN , + .valid = { + .min_access_size =4 , + .max_access_size =4 , + }, +}; + +static void xlnx_versal_pmc_iou_slcr_realize (DeviceState *dev,Error **errp) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (dev); + +qdev_init_gpio_out_named (dev, s->sd_emmc_sel,"sd-emmc-sel" ,2 ); +qdev_init_gpio_out_named (dev, &s->qspi_ospi_mux_sel, +"qspi-ospi-mux-sel" ,1 ); +qdev_init_gpio_out_named (dev, &s->ospi_mux_sel,"ospi-mux-sel" ,1 ); +} + +static void xlnx_versal_pmc_iou_slcr_init (Object *obj) +{ +XlnxVersalPmcIouSlcr *s =XILINX_VERSAL_PMC_IOU_SLCR (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); +RegisterInfoArray *reg_array; + +memory_region_init (&s->iomem, obj,TYPE_XILINX_VERSAL_PMC_IOU_SLCR , +XILINX_VERSAL_PMC_IOU_SLCR_R_MAX *4 ); + reg_array = +register_init_block32 (DEVICE (obj), pmc_iou_slcr_regs_info, +ARRAY_SIZE (pmc_iou_slcr_regs_info), + s->regs_info, s->regs, + &pmc_iou_slcr_ops, +XILINX_VERSAL_PMC_IOU_SLCR_ERR_DEBUG , +XILINX_VERSAL_PMC_IOU_SLCR_R_MAX *4 ); +memory_region_add_subregion (&s->iomem, +0x0 , + ®_array->mem); +sysbus_init_mmio (sbd, &s->iomem); +sysbus_init_irq (sbd, &s->irq_parity_imr); +sysbus_init_irq (sbd, &s->irq_imr); +} + +static const VMStateDescription vmstate_pmc_iou_slcr = { + .name =TYPE_XILINX_VERSAL_PMC_IOU_SLCR , + .version_id =1 , + .minimum_version_id =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32_ARRAY (regs, XlnxVersalPmcIouSlcr, +XILINX_VERSAL_PMC_IOU_SLCR_R_MAX ), +VMSTATE_END_OF_LIST (), + } +}; + +static void xlnx_versal_pmc_iou_slcr_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); + + dc->realize = xlnx_versal_pmc_iou_slcr_realize; + dc->vmsd = &vmstate_pmc_iou_slcr; + rc->phases.enter = xlnx_versal_pmc_iou_slcr_reset_init; + rc->phases.hold = xlnx_versal_pmc_iou_slcr_reset_hold; +} + +static const TypeInfo xlnx_versal_pmc_iou_slcr_info = { + .name =TYPE_XILINX_VERSAL_PMC_IOU_SLCR , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (XlnxVersalPmcIouSlcr), + .class_init = xlnx_versal_pmc_iou_slcr_class_init, + .instance_init = xlnx_versal_pmc_iou_slcr_init, +}; + +static void xlnx_versal_pmc_iou_slcr_register_types (void ) +{ +type_register_static (&xlnx_versal_pmc_iou_slcr_info); +} + +type_init (xlnx_versal_pmc_iou_slcr_register_types)include/hw/misc/xlnx-versal-pmc-iou-slcr.h new file +78
-0@@ -0,0 +1,78 @@ +/* +* Header file for the Xilinx Versal's PMC IOU SLCR +* +* Copyright (C) 2021 Xilinx Inc +* Written by Edgar E. Iglesias <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ + +/* +* This is a model of Xilinx Versal's PMC I/O Peripheral Control and Status +* module documented in Versal's Technical Reference manual [1] and the Versal +* ACAP Register reference [2]. +* +* References: +* +* [1] Versal ACAP Technical Reference Manual, +* https://www.xilinx.com/support/documentation/architecture-manuals/am011-versal-acap-trm.pdf +* +* [2] Versal ACAP Register Reference, +* https://www.xilinx.com/html_docs/registers/am012/am012-versal-register-reference.html#mod___pmc_iop_slcr.html +* +* QEMU interface: +* + sysbus MMIO region 0: MemoryRegion for the device's registers +* + sysbus IRQ 0: PMC (AXI and APB) parity error interrupt detected by the PMC +* I/O peripherals. +* + sysbus IRQ 1: Device interrupt. +* + Named GPIO output "sd-emmc-sel[0]": Enables 0: SD mode or 1: eMMC mode on +* SD/eMMC controller 0. +* + Named GPIO output "sd-emmc-sel[1]": Enables 0: SD mode or 1: eMMC mode on +* SD/eMMC controller 1. +* + Named GPIO output "qspi-ospi-mux-sel": Selects 0: QSPI linear region or 1: +* OSPI linear region. +* + Named GPIO output "ospi-mux-sel": Selects 0: OSPI Indirect access mode or +* 1: OSPI direct access mode. +*/ + +#ifndef XILINX_VERSAL_PMC_IOU_SLCR_H +#define XILINX_VERSAL_PMC_IOU_SLCR_H + +#include "hw/register.h" + +#define TYPE_XILINX_VERSAL_PMC_IOU_SLCR "xlnx.versal-pmc-iou-slcr" + +OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalPmcIouSlcr, XILINX_VERSAL_PMC_IOU_SLCR) + +#define XILINX_VERSAL_PMC_IOU_SLCR_R_MAX (0x828 / 4 + 1) + +struct XlnxVersalPmcIouSlcr { +SysBusDevice parent_obj; +MemoryRegion iomem; +qemu_irq irq_parity_imr; +qemu_irq irq_imr; +qemu_irq sd_emmc_sel[2 ]; +qemu_irq qspi_ospi_mux_sel; +qemu_irq ospi_mux_sel; + +uint32_t regs[XILINX_VERSAL_PMC_IOU_SLCR_R_MAX ]; +RegisterInfo regs_info[XILINX_VERSAL_PMC_IOU_SLCR_R_MAX ]; +}; + +#endif /* XILINX_VERSAL_PMC_IOU_SLCR_H */ Signature · 1 line
2.11.0
PATCH v6 2/12 hw/arm/xlnx-versal: 'Or' the interrupts from the BBRAM and RTC models
In reply to Francisco IglesiasAdd an orgate and 'or' the interrupts from the BBRAM and RTC models.
--- hw/arm/xlnx-versal-virt.c | 2 +- hw/arm/xlnx-versal.c | 28 ++++++++++++++++++++++++++-- include/hw/arm/xlnx-versal.h | 5 +++-- 3 files changed, 30 insertions(+), 5 deletions(-)
hw/arm/xlnx-versal-virt.c +1 -1
@@ -365,7 +365,7 @@ static void fdt_add_bbram_node(VersalVirt *s)qemu_fdt_add_subnode (s->fdt, name);qemu_fdt_setprop_cells (s->fdt, name,"interrupts" , -GIC_FDT_IRQ_TYPE_SPI ,VERSAL_BBRAM_APB_IRQ_0 , +GIC_FDT_IRQ_TYPE_SPI ,VERSAL_PMC_APB_IRQ ,GIC_FDT_IRQ_FLAGS_LEVEL_HI );qemu_fdt_setprop (s->fdt, name,"interrupt-names" , interrupt_names,sizeof (interrupt_names));
hw/arm/xlnx-versal.c +26 -2
@@ -25,6 +25,8 @@#define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")#define GEM_REVISION 0x40070106 +#define VERSAL_NUM_PMC_APB_IRQS 2 +static void versal_create_apu_cpus (Versal *s) {int i;
@@ -260,6 +262,25 @@ static void versal_create_sds(Versal *s, qemu_irq *pic) } } +static void versal_create_pmc_apb_irq_orgate (Versal *s,qemu_irq *pic) +{ +DeviceState *orgate; + +/* +* The VERSAL_PMC_APB_IRQ is an 'or' of the interrupts from the following +* models: +* - RTC +* - BBRAM +*/ +object_initialize_child (OBJECT (s),"pmc-apb-irq-orgate" , + &s->pmc.apb_irq_orgate,TYPE_OR_IRQ ); + orgate =DEVICE (&s->pmc.apb_irq_orgate); +object_property_set_int (OBJECT (orgate), +"num-lines" ,VERSAL_NUM_PMC_APB_IRQS , &error_fatal); +qdev_realize (orgate,NULL , &error_fatal); +qdev_connect_gpio_out (orgate,0 , pic[VERSAL_PMC_APB_IRQ ]); +} +static void versal_create_rtc (Versal *s,qemu_irq *pic) {SysBusDevice *sbd;
@@ -277,7 +298,8 @@ static void versal_create_rtc(Versal *s, qemu_irq *pic)* TODO: Connect the ALARM and SECONDS interrupts once our RTC model * supports them. */ -sysbus_connect_irq (sbd,1 , pic[VERSAL_RTC_APB_ERR_IRQ ]); +sysbus_connect_irq (sbd,1 , +qdev_get_gpio_in (DEVICE (&s->pmc.apb_irq_orgate),0 )); }static void versal_create_xrams (Versal *s,qemu_irq *pic)
@@ -328,7 +350,8 @@ static void versal_create_bbram(Versal *s, qemu_irq *pic)sysbus_realize (sbd, &error_fatal);memory_region_add_subregion (&s->mr_ps,MM_PMC_BBRAM_CTRL ,sysbus_mmio_get_region (sbd,0 )); -sysbus_connect_irq (sbd,0 , pic[VERSAL_BBRAM_APB_IRQ_0 ]); +sysbus_connect_irq (sbd,0 , +qdev_get_gpio_in (DEVICE (&s->pmc.apb_irq_orgate),1 )); }static void versal_realize_efuse_part (Versal *s,Object *dev,hwaddr base)
@@ -455,6 +478,7 @@ static void versal_realize(DeviceState *dev, Error **errp)versal_create_gems (s, pic);versal_create_admas (s, pic);versal_create_sds (s, pic); +versal_create_pmc_apb_irq_orgate (s, pic);versal_create_rtc (s, pic);versal_create_xrams (s, pic);versal_create_bbram (s, pic);
include/hw/arm/xlnx-versal.h +3 -2
@@ -85,6 +85,8 @@ struct Versal {XlnxEFuse efuse;XlnxVersalEFuseCtrl efuse_ctrl;XlnxVersalEFuseCache efuse_cache; + +qemu_or_irq apb_irq_orgate; } pmc;struct {
@@ -111,8 +113,7 @@ struct Versal {#define VERSAL_GEM1_WAKE_IRQ_0 59#define VERSAL_ADMA_IRQ_0 60#define VERSAL_XRAM_IRQ_0 79 -#define VERSAL_BBRAM_APB_IRQ_0 121 -#define VERSAL_RTC_APB_ERR_IRQ 121 +#define VERSAL_PMC_APB_IRQ 121#define VERSAL_SD0_IRQ_0 126#define VERSAL_EFUSE_IRQ 139#define VERSAL_RTC_ALARM_IRQ 142
Signature · 1 line
2.11.0
Re: [PATCH v6 02/12] hw/arm/xlnx-versal: 'Or' the interrupts from the BBRAM and RTC models
Quoted 4 lines · Francisco Iglesias
Add an orgate and 'or' the interrupts from the BBRAM and RTC models.
Signed-off-by Francisco Iglesias <[email protected]>Reviewed-by Peter Maydell <[email protected]>
Quoted 113 lines
--- hw/arm/xlnx-versal-virt.c | 2 +- hw/arm/xlnx-versal.c | 28 ++++++++++++++++++++++++++-- include/hw/arm/xlnx-versal.h | 5 +++-- 3 files changed, 30 insertions(+), 5 deletions(-)hw/arm/xlnx-versal-virt.c +1
-1@@ -365,7 +365,7 @@ static void fdt_add_bbram_node(VersalVirt *s)qemu_fdt_add_subnode (s->fdt, name);qemu_fdt_setprop_cells (s->fdt, name,"interrupts" , -GIC_FDT_IRQ_TYPE_SPI ,VERSAL_BBRAM_APB_IRQ_0 , +GIC_FDT_IRQ_TYPE_SPI ,VERSAL_PMC_APB_IRQ ,GIC_FDT_IRQ_FLAGS_LEVEL_HI );qemu_fdt_setprop (s->fdt, name,"interrupt-names" , interrupt_names,sizeof (interrupt_names));hw/arm/xlnx-versal.c +26
-2@@ -25,6 +25,8 @@#define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")#define GEM_REVISION 0x40070106 +#define VERSAL_NUM_PMC_APB_IRQS 2 +static void versal_create_apu_cpus (Versal *s) {int i;@@ -260,6 +262,25 @@ static void versal_create_sds(Versal *s, qemu_irq *pic) } } +static void versal_create_pmc_apb_irq_orgate (Versal *s,qemu_irq *pic) +{ +DeviceState *orgate; + +/* +* The VERSAL_PMC_APB_IRQ is an 'or' of the interrupts from the following +* models: +* - RTC +* - BBRAM +*/ +object_initialize_child (OBJECT (s),"pmc-apb-irq-orgate" , + &s->pmc.apb_irq_orgate,TYPE_OR_IRQ ); + orgate =DEVICE (&s->pmc.apb_irq_orgate); +object_property_set_int (OBJECT (orgate), +"num-lines" ,VERSAL_NUM_PMC_APB_IRQS , &error_fatal); +qdev_realize (orgate,NULL , &error_fatal); +qdev_connect_gpio_out (orgate,0 , pic[VERSAL_PMC_APB_IRQ ]); +} +static void versal_create_rtc (Versal *s,qemu_irq *pic) {SysBusDevice *sbd;@@ -277,7 +298,8 @@ static void versal_create_rtc(Versal *s, qemu_irq *pic)* TODO: Connect the ALARM and SECONDS interrupts once our RTC model * supports them. */ -sysbus_connect_irq (sbd,1 , pic[VERSAL_RTC_APB_ERR_IRQ ]); +sysbus_connect_irq (sbd,1 , +qdev_get_gpio_in (DEVICE (&s->pmc.apb_irq_orgate),0 )); }static void versal_create_xrams (Versal *s,qemu_irq *pic)@@ -328,7 +350,8 @@ static void versal_create_bbram(Versal *s, qemu_irq *pic)sysbus_realize (sbd, &error_fatal);memory_region_add_subregion (&s->mr_ps,MM_PMC_BBRAM_CTRL ,sysbus_mmio_get_region (sbd,0 )); -sysbus_connect_irq (sbd,0 , pic[VERSAL_BBRAM_APB_IRQ_0 ]); +sysbus_connect_irq (sbd,0 , +qdev_get_gpio_in (DEVICE (&s->pmc.apb_irq_orgate),1 )); }static void versal_realize_efuse_part (Versal *s,Object *dev,hwaddr base)@@ -455,6 +478,7 @@ static void versal_realize(DeviceState *dev, Error **errp)versal_create_gems (s, pic);versal_create_admas (s, pic);versal_create_sds (s, pic); +versal_create_pmc_apb_irq_orgate (s, pic);versal_create_rtc (s, pic);versal_create_xrams (s, pic);versal_create_bbram (s, pic);include/hw/arm/xlnx-versal.h +3
-2@@ -85,6 +85,8 @@ struct Versal {XlnxEFuse efuse;XlnxVersalEFuseCtrl efuse_ctrl;XlnxVersalEFuseCache efuse_cache; + +qemu_or_irq apb_irq_orgate; } pmc;struct {@@ -111,8 +113,7 @@ struct Versal {#define VERSAL_GEM1_WAKE_IRQ_0 59#define VERSAL_ADMA_IRQ_0 60#define VERSAL_XRAM_IRQ_0 79 -#define VERSAL_BBRAM_APB_IRQ_0 121 -#define VERSAL_RTC_APB_ERR_IRQ 121 +#define VERSAL_PMC_APB_IRQ 121#define VERSAL_SD0_IRQ_0 126#define VERSAL_EFUSE_IRQ 139#define VERSAL_RTC_ALARM_IRQ 142Signature · 1 line
2.11.0
PATCH v6 3/12 hw/arm/xlnx-versal: Connect Versal's PMC SLCR
In reply to Francisco IglesiasConnect Versal's PMC SLCR (system-level control registers) model.
--- hw/arm/xlnx-versal.c | 71 +++++++++++++++++++++++++++++++++++++++++++- include/hw/arm/xlnx-versal.h | 5 ++++ 2 files changed, 75 insertions(+), 1 deletion(-)
hw/arm/xlnx-versal.c +70 -1
@@ -21,11 +21,13 @@#include "kvm_arm.h" #include "hw/misc/unimp.h" #include "hw/arm/xlnx-versal.h" +#include "qemu/log.h" +#include "hw/sysbus.h" #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")#define GEM_REVISION 0x40070106 -#define VERSAL_NUM_PMC_APB_IRQS 2 +#define VERSAL_NUM_PMC_APB_IRQS 3static void versal_create_apu_cpus (Versal *s) {
@@ -271,6 +273,7 @@ static void versal_create_pmc_apb_irq_orgate(Versal *s, qemu_irq *pic)* models: * - RTC * - BBRAM +* - PMC SLCR */ object_initialize_child (OBJECT (s),"pmc-apb-irq-orgate" , &s->pmc.apb_irq_orgate,TYPE_OR_IRQ );
@@ -392,6 +395,23 @@ static void versal_create_efuse(Versal *s, qemu_irq *pic)sysbus_connect_irq (SYS_BUS_DEVICE (ctrl),0 , pic[VERSAL_EFUSE_IRQ ]); } +static void versal_create_pmc_iou_slcr (Versal *s,qemu_irq *pic) +{ +SysBusDevice *sbd; + +object_initialize_child (OBJECT (s),"versal-pmc-iou-slcr" , &s->pmc.iou.slcr, +TYPE_XILINX_VERSAL_PMC_IOU_SLCR ); + + sbd =SYS_BUS_DEVICE (&s->pmc.iou.slcr); +sysbus_realize (sbd, &error_fatal); + +memory_region_add_subregion (&s->mr_ps,MM_PMC_PMC_IOU_SLCR , +sysbus_mmio_get_region (sbd,0 )); + +sysbus_connect_irq (sbd,0 , +qdev_get_gpio_in (DEVICE (&s->pmc.apb_irq_orgate),2 )); +} +/* This takes the board allocated linear DDR memory and creates aliases * for each split DDR range/aperture on the Versal address map. */
@@ -448,8 +468,31 @@ static void versal_unimp_area(Versal *s, const char *name,memory_region_add_subregion (mr, base, mr_dev); } +static void versal_unimp_sd_emmc_sel (void *opaque,int n,int level) +{ +qemu_log_mask (LOG_UNIMP , +"Selecting between enabling SD mode or eMMC mode on " +"controller %d is not yet implemented\n" , n); +} + +static void versal_unimp_qspi_ospi_mux_sel (void *opaque,int n,int level) +{ +qemu_log_mask (LOG_UNIMP , +"Selecting between enabling the QSPI or OSPI linear address " +"region is not yet implemented\n" ); +} + +static void versal_unimp_irq_parity_imr (void *opaque,int n,int level) +{ +qemu_log_mask (LOG_UNIMP , +"PMC SLCR parity interrupt behaviour " +"is not yet implemented\n" ); +} +static void versal_unimp (Versal *s) { +qemu_irq gpio_in; +versal_unimp_area (s,"psm" , &s->mr_ps,MM_PSM_START ,MM_PSM_END -MM_PSM_START ); versal_unimp_area(s, "crl", &s->mr_ps,
@@ -464,6 +507,31 @@ static void versal_unimp(Versal *s) MM_IOU_SCNTR, MM_IOU_SCNTR_SIZE);versal_unimp_area (s,"iou-scntr-seucre" , &s->mr_ps,MM_IOU_SCNTRS ,MM_IOU_SCNTRS_SIZE ); + +qdev_init_gpio_in_named (DEVICE (s), versal_unimp_sd_emmc_sel, +"sd-emmc-sel-dummy" ,2 ); +qdev_init_gpio_in_named (DEVICE (s), versal_unimp_qspi_ospi_mux_sel, +"qspi-ospi-mux-sel-dummy" ,1 ); +qdev_init_gpio_in_named (DEVICE (s), versal_unimp_irq_parity_imr, +"irq-parity-imr-dummy" ,1 ); + + gpio_in =qdev_get_gpio_in_named (DEVICE (s),"sd-emmc-sel-dummy" ,0 ); +qdev_connect_gpio_out_named (DEVICE (&s->pmc.iou.slcr),"sd-emmc-sel" ,0 , + gpio_in); + + gpio_in =qdev_get_gpio_in_named (DEVICE (s),"sd-emmc-sel-dummy" ,1 ); +qdev_connect_gpio_out_named (DEVICE (&s->pmc.iou.slcr),"sd-emmc-sel" ,1 , + gpio_in); + + gpio_in =qdev_get_gpio_in_named (DEVICE (s),"qspi-ospi-mux-sel-dummy" ,0 ); +qdev_connect_gpio_out_named (DEVICE (&s->pmc.iou.slcr), +"qspi-ospi-mux-sel" ,0 , + gpio_in); + + gpio_in =qdev_get_gpio_in_named (DEVICE (s),"irq-parity-imr-dummy" ,0 ); +qdev_connect_gpio_out_named (DEVICE (&s->pmc.iou.slcr), +SYSBUS_DEVICE_GPIO_IRQ ,0 , + gpio_in); }static void versal_realize (DeviceState *dev,Error **errp)
@@ -483,6 +551,7 @@ static void versal_realize(DeviceState *dev, Error **errp)versal_create_xrams (s, pic);versal_create_bbram (s, pic);versal_create_efuse (s, pic); +versal_create_pmc_iou_slcr (s, pic);versal_map_ddr (s);versal_unimp (s);
include/hw/arm/xlnx-versal.h +5 -0
@@ -26,6 +26,7 @@#include "hw/misc/xlnx-versal-xramc.h" #include "hw/nvram/xlnx-bbram.h" #include "hw/nvram/xlnx-versal-efuse.h" +#include "hw/misc/xlnx-versal-pmc-iou-slcr.h" #define TYPE_XLNX_VERSAL "xlnx-versal"OBJECT_DECLARE_SIMPLE_TYPE (Versal,XLNX_VERSAL )
@@ -78,6 +79,7 @@ struct Versal {struct {struct {SDHCIState sd[XLNX_VERSAL_NR_SDS ]; +XlnxVersalPmcIouSlcr slcr; } iou;XlnxZynqMPRTC rtc;
@@ -179,6 +181,9 @@ struct Versal {#define MM_FPD_FPD_APU 0xfd5c0000#define MM_FPD_FPD_APU_SIZE 0x100 +#define MM_PMC_PMC_IOU_SLCR 0xf1060000 +#define MM_PMC_PMC_IOU_SLCR_SIZE 0x10000 +#define MM_PMC_SD0 0xf1040000U#define MM_PMC_SD0_SIZE 0x10000#define MM_PMC_BBRAM_CTRL 0xf11f0000
Signature · 1 line
2.11.0
Re: [PATCH v6 03/12] hw/arm/xlnx-versal: Connect Versal's PMC SLCR
Quoted 3 lines · Francisco Iglesias
Connect Versal's PMC SLCR (system-level control registers) model.
Signed-off-by Francisco Iglesias <[email protected]>
Quoted 162 lines
--- hw/arm/xlnx-versal.c | 71 +++++++++++++++++++++++++++++++++++++++++++- include/hw/arm/xlnx-versal.h | 5 ++++ 2 files changed, 75 insertions(+), 1 deletion(-)hw/arm/xlnx-versal.c +70
-1@@ -21,11 +21,13 @@#include "kvm_arm.h" #include "hw/misc/unimp.h" #include "hw/arm/xlnx-versal.h" +#include "qemu/log.h" +#include "hw/sysbus.h" #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")#define GEM_REVISION 0x40070106 -#define VERSAL_NUM_PMC_APB_IRQS 2 +#define VERSAL_NUM_PMC_APB_IRQS 3static void versal_create_apu_cpus (Versal *s) {@@ -271,6 +273,7 @@ static void versal_create_pmc_apb_irq_orgate(Versal *s, qemu_irq *pic)* models: * - RTC * - BBRAM +* - PMC SLCR */ object_initialize_child (OBJECT (s),"pmc-apb-irq-orgate" , &s->pmc.apb_irq_orgate,TYPE_OR_IRQ );@@ -392,6 +395,23 @@ static void versal_create_efuse(Versal *s, qemu_irq *pic)sysbus_connect_irq (SYS_BUS_DEVICE (ctrl),0 , pic[VERSAL_EFUSE_IRQ ]); } +static void versal_create_pmc_iou_slcr (Versal *s,qemu_irq *pic) +{ +SysBusDevice *sbd; + +object_initialize_child (OBJECT (s),"versal-pmc-iou-slcr" , &s->pmc.iou.slcr, +TYPE_XILINX_VERSAL_PMC_IOU_SLCR ); + + sbd =SYS_BUS_DEVICE (&s->pmc.iou.slcr); +sysbus_realize (sbd, &error_fatal); + +memory_region_add_subregion (&s->mr_ps,MM_PMC_PMC_IOU_SLCR , +sysbus_mmio_get_region (sbd,0 )); + +sysbus_connect_irq (sbd,0 , +qdev_get_gpio_in (DEVICE (&s->pmc.apb_irq_orgate),2 )); +} +/* This takes the board allocated linear DDR memory and creates aliases * for each split DDR range/aperture on the Versal address map. */ @@ -448,8 +468,31 @@ static void versal_unimp_area(Versal *s, const char *name,memory_region_add_subregion (mr, base, mr_dev); } +static void versal_unimp_sd_emmc_sel (void *opaque,int n,int level) +{ +qemu_log_mask (LOG_UNIMP , +"Selecting between enabling SD mode or eMMC mode on " +"controller %d is not yet implemented\n" , n); +} + +static void versal_unimp_qspi_ospi_mux_sel (void *opaque,int n,int level) +{ +qemu_log_mask (LOG_UNIMP , +"Selecting between enabling the QSPI or OSPI linear address " +"region is not yet implemented\n" ); +} + +static void versal_unimp_irq_parity_imr (void *opaque,int n,int level) +{ +qemu_log_mask (LOG_UNIMP , +"PMC SLCR parity interrupt behaviour " +"is not yet implemented\n" ); +} +static void versal_unimp (Versal *s) { +qemu_irq gpio_in; +versal_unimp_area (s,"psm" , &s->mr_ps,MM_PSM_START ,MM_PSM_END -MM_PSM_START ); versal_unimp_area(s, "crl", &s->mr_ps,@@ -464,6 +507,31 @@ static void versal_unimp(Versal *s) MM_IOU_SCNTR, MM_IOU_SCNTR_SIZE);versal_unimp_area (s,"iou-scntr-seucre" , &s->mr_ps,MM_IOU_SCNTRS ,MM_IOU_SCNTRS_SIZE ); + +qdev_init_gpio_in_named (DEVICE (s), versal_unimp_sd_emmc_sel, +"sd-emmc-sel-dummy" ,2 ); +qdev_init_gpio_in_named (DEVICE (s), versal_unimp_qspi_ospi_mux_sel, +"qspi-ospi-mux-sel-dummy" ,1 ); +qdev_init_gpio_in_named (DEVICE (s), versal_unimp_irq_parity_imr, +"irq-parity-imr-dummy" ,1 ); + + gpio_in =qdev_get_gpio_in_named (DEVICE (s),"sd-emmc-sel-dummy" ,0 ); +qdev_connect_gpio_out_named (DEVICE (&s->pmc.iou.slcr),"sd-emmc-sel" ,0 , + gpio_in); + + gpio_in =qdev_get_gpio_in_named (DEVICE (s),"sd-emmc-sel-dummy" ,1 ); +qdev_connect_gpio_out_named (DEVICE (&s->pmc.iou.slcr),"sd-emmc-sel" ,1 , + gpio_in); + + gpio_in =qdev_get_gpio_in_named (DEVICE (s),"qspi-ospi-mux-sel-dummy" ,0 ); +qdev_connect_gpio_out_named (DEVICE (&s->pmc.iou.slcr), +"qspi-ospi-mux-sel" ,0 , + gpio_in); + + gpio_in =qdev_get_gpio_in_named (DEVICE (s),"irq-parity-imr-dummy" ,0 ); +qdev_connect_gpio_out_named (DEVICE (&s->pmc.iou.slcr), +SYSBUS_DEVICE_GPIO_IRQ ,0 , + gpio_in); }static void versal_realize (DeviceState *dev,Error **errp)@@ -483,6 +551,7 @@ static void versal_realize(DeviceState *dev, Error **errp)versal_create_xrams (s, pic);versal_create_bbram (s, pic);versal_create_efuse (s, pic); +versal_create_pmc_iou_slcr (s, pic);versal_map_ddr (s);versal_unimp (s);include/hw/arm/xlnx-versal.h +5
-0@@ -26,6 +26,7 @@#include "hw/misc/xlnx-versal-xramc.h" #include "hw/nvram/xlnx-bbram.h" #include "hw/nvram/xlnx-versal-efuse.h" +#include "hw/misc/xlnx-versal-pmc-iou-slcr.h" #define TYPE_XLNX_VERSAL "xlnx-versal"OBJECT_DECLARE_SIMPLE_TYPE (Versal,XLNX_VERSAL )@@ -78,6 +79,7 @@ struct Versal {struct {struct {SDHCIState sd[XLNX_VERSAL_NR_SDS ]; +XlnxVersalPmcIouSlcr slcr; } iou;XlnxZynqMPRTC rtc;@@ -179,6 +181,9 @@ struct Versal {#define MM_FPD_FPD_APU 0xfd5c0000#define MM_FPD_FPD_APU_SIZE 0x100 +#define MM_PMC_PMC_IOU_SLCR 0xf1060000 +#define MM_PMC_PMC_IOU_SLCR_SIZE 0x10000 +#define MM_PMC_SD0 0xf1040000U#define MM_PMC_SD0_SIZE 0x10000#define MM_PMC_BBRAM_CTRL 0xf11f0000Signature · 1 line
2.11.0
PATCH v6 4/12 include/hw/dma/xlnx_csu_dma: Add in missing includes in the header
In reply to Francisco IglesiasAdd in the missing includes in the header for being able to build the DMA model when reusing it.
--- include/hw/dma/xlnx_csu_dma.h | 5 +++++ 1 file changed, 5 insertions(+)
include/hw/dma/xlnx_csu_dma.h +5 -0
@@ -21,6 +21,11 @@#ifndef XLNX_CSU_DMA_H #define XLNX_CSU_DMA_H +#include "hw/sysbus.h" +#include "hw/register.h" +#include "hw/ptimer.h" +#include "hw/stream.h" +#define TYPE_XLNX_CSU_DMA "xlnx.csu_dma"#define XLNX_CSU_DMA_R_MAX (0x2c / 4)
Signature · 1 line
2.11.0
Re: [PATCH v6 04/12] include/hw/dma/xlnx_csu_dma: Add in missing includes in the header
Quoted 5 lines · Francisco Iglesias
Add in the missing includes in the header for being able to build the DMA model when reusing it.
Signed-off-by Francisco Iglesias <[email protected]>Reviewed-by Peter Maydell <[email protected]>
Quoted 24 lines
--- include/hw/dma/xlnx_csu_dma.h | 5 +++++ 1 file changed, 5 insertions(+)include/hw/dma/xlnx_csu_dma.h +5
-0@@ -21,6 +21,11 @@#ifndef XLNX_CSU_DMA_H #define XLNX_CSU_DMA_H +#include "hw/sysbus.h" +#include "hw/register.h" +#include "hw/ptimer.h" +#include "hw/stream.h" +#define TYPE_XLNX_CSU_DMA "xlnx.csu_dma"#define XLNX_CSU_DMA_R_MAX (0x2c / 4)Signature · 1 line
2.11.0
PATCH v6 5/12 hw/dma: Add the DMA control interface
In reply to Francisco IglesiasAn option on real hardware when embedding a DMA engine into a peripheral is to make the peripheral control the engine through a custom DMA control (hardware) interface between the two. Software drivers in this scenario configure and trigger DMA operations through the controlling peripheral's register API (for example, writing a specific bit in a register could propagate down to a transfer start signal on the DMA control interface). At the same time the status, results and interrupts for the transfer might still be intended to be read and caught through the DMA engine's register API (and signals).
This patch adds a QEMU DMA control interface that can be used for modelling above scenario. Through this new interface a peripheral model embedding a DMA engine model will be able to directly initiate transfers through the DMA. At the same time the transfer state, result and completion signaling will be read and caught through the DMA engine model's register API and signaling.
--- hw/dma/dma-ctrl-if.c | 30 +++++++++++++++++++++++ hw/dma/meson.build | 1 + include/hw/dma/dma-ctrl-if.h | 58 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 hw/dma/dma-ctrl-if.c create mode 100644 include/hw/dma/dma-ctrl-if.h
hw/dma/dma-ctrl-if.c new file +30 -0
@@ -0,0 +1,30 @@ +/* +* DMA control interface. +* +* Copyright (c) 2021 Xilinx Inc. +* Written by Francisco Iglesias <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#include "qemu/osdep.h" +#include "exec/hwaddr.h" +#include "hw/dma/dma-ctrl-if.h" + +MemTxResult dma_ctrl_if_read (DmaCtrlIf *dma,hwaddr addr,uint32_t len) +{ +DmaCtrlIfClass *dcic =DMA_CTRL_IF_GET_CLASS (dma); +return dcic->read (dma, addr, len); +} + +static const TypeInfo dma_ctrl_if_info = { + .name =TYPE_DMA_CTRL_IF , + .parent =TYPE_INTERFACE , + .class_size =sizeof (DmaCtrlIfClass), +}; + +static void dma_ctrl_if_register_types (void ) +{ +type_register_static (&dma_ctrl_if_info); +} + +type_init (dma_ctrl_if_register_types)
hw/dma/meson.build +1 -0
@@ -14,3 +14,4 @@ softmmu_ss.add(when: 'CONFIG_PXA2XX', if_true: files('pxa2xx_dma.c')) softmmu_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_dma.c')) softmmu_ss.add(when: 'CONFIG_SIFIVE_PDMA', if_true: files('sifive_pdma.c')) softmmu_ss.add(when: 'CONFIG_XLNX_CSU_DMA', if_true: files('xlnx_csu_dma.c')) +common_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('dma-ctrl-if.c'))
include/hw/dma/dma-ctrl-if.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.11.0
Re: [PATCH v6 05/12] hw/dma: Add the DMA control interface
Hi Francisco!
Quoted 9 lines · Francisco Iglesias
An option on real hardware when embedding a DMA engine into a peripheral is to make the peripheral control the engine through a custom DMA control (hardware) interface between the two. Software drivers in this scenario configure and trigger DMA operations through the controlling peripheral's register API (for example, writing a specific bit in a register could propagate down to a transfer start signal on the DMA control interface). At the same time the status, results and interrupts for the transfer might still be intended to be read and caught through the DMA engine's register API (and signals).
I understand the goal you trying to achieve here. Having a generic interface between a peripheral and the internal DMA it's using for its memory transfers.
I wonder however how much this scenario can be generalized. I see that you have only one method in this interface, which is basically "perform a DMA transaction". Given the method's parameters, the peripheral can indicate what address/length it wants to read.
IIUC this is well suited to your case (the OSPI controller), because other DMA parameters are configured by other means (DMA or OSPI registers I guess).
But how much this will suite the next use case for this interface? Will the embedded DMA be configured the same way? Maybe the method will also require e.g., the destination buffer address?
My feeling is that this interface is quite ad-hoc for your case. It is either going to stay really simple as it is now, and won't necessarily fit the next similar use case, or is going to get pretty complicated to cover all cases. For an added value I'm not sure I can see because the pair "peripheral - DMA" seems tightly coupled to me. Do you foresee a case where you want to be able to e.g., instantiate DMA B instead of DMA A for the same controller?
I think you could have basically the same code by having a pointer to your XlnxCSUDMA object (instead of the iface) in the OSPI struct, and a function like xlnx_csu_dma_start_transfer declared in xlnx_csu_dma.h, having the same behaviour as dma_ctrl_if_read.
Maybe I'm wrong and you actually foresee cases where the genericity this interface gives is what you want? What do you think?
Luc
Quoted 130 lines
This patch adds a QEMU DMA control interface that can be used for modelling above scenario. Through this new interface a peripheral model embedding a DMA engine model will be able to directly initiate transfers through the DMA. At the same time the transfer state, result and completion signaling will be read and caught through the DMA engine model's register API and signaling.
Signed-off-by Francisco Iglesias <[email protected]>--- hw/dma/dma-ctrl-if.c | 30 +++++++++++++++++++++++ hw/dma/meson.build | 1 + include/hw/dma/dma-ctrl-if.h | 58 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 hw/dma/dma-ctrl-if.c create mode 100644 include/hw/dma/dma-ctrl-if.hhw/dma/dma-ctrl-if.c new file +30
-0@@ -0,0 +1,30 @@ +/* +* DMA control interface. +* +* Copyright (c) 2021 Xilinx Inc. +* Written by Francisco Iglesias <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#include "qemu/osdep.h" +#include "exec/hwaddr.h" +#include "hw/dma/dma-ctrl-if.h" + +MemTxResult dma_ctrl_if_read (DmaCtrlIf *dma,hwaddr addr,uint32_t len) +{ +DmaCtrlIfClass *dcic =DMA_CTRL_IF_GET_CLASS (dma); +return dcic->read (dma, addr, len); +} + +static const TypeInfo dma_ctrl_if_info = { + .name =TYPE_DMA_CTRL_IF , + .parent =TYPE_INTERFACE , + .class_size =sizeof (DmaCtrlIfClass), +}; + +static void dma_ctrl_if_register_types (void ) +{ +type_register_static (&dma_ctrl_if_info); +} + +type_init (dma_ctrl_if_register_types)hw/dma/meson.build +1
-0@@ -14,3 +14,4 @@ softmmu_ss.add(when: 'CONFIG_PXA2XX', if_true: files('pxa2xx_dma.c')) softmmu_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_dma.c')) softmmu_ss.add(when: 'CONFIG_SIFIVE_PDMA', if_true: files('sifive_pdma.c')) softmmu_ss.add(when: 'CONFIG_XLNX_CSU_DMA', if_true: files('xlnx_csu_dma.c')) +common_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('dma-ctrl-if.c'))include/hw/dma/dma-ctrl-if.h new file +58
-0@@ -0,0 +1,58 @@ +/* +* DMA control interface. +* +* Copyright (c) 2021 Xilinx Inc. +* Written by Francisco Iglesias <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef HW_DMA_CTRL_IF_H +#define HW_DMA_CTRL_IF_H + +#include "hw/hw.h" +#include "exec/memory.h" +#include "qom/object.h" + +#define TYPE_DMA_CTRL_IF "dma-ctrl-if" +typedef struct DmaCtrlIfClass DmaCtrlIfClass ; +DECLARE_CLASS_CHECKERS (DmaCtrlIfClass,DMA_CTRL_IF , + TYPE_DMA_CTRL_IF) + +#define DMA_CTRL_IF (obj) \ + INTERFACE_CHECK(DmaCtrlIf, (obj), TYPE_DMA_CTRL_IF) + +typedef struct DmaCtrlIf { +Object Parent; +}DmaCtrlIf ; + +typedef struct DmaCtrlIfClass { +InterfaceClass parent; + +/* +* read: Start a read transfer on the DMA engine implementing the DMA +* control interface +* +* @dma_ctrl: the DMA engine implementing this interface +* @addr: the address to read +* @len: the number of bytes to read at 'addr' +* +* @return a MemTxResult indicating whether the operation succeeded ('len' +* bytes were read) or failed. +*/ +MemTxResult (*read)(DmaCtrlIf *dma,hwaddr addr,uint32_t len); +}DmaCtrlIfClass ; + +/* +* Start a read transfer on a DMA engine implementing the DMA control +* interface. +* +* @dma_ctrl: the DMA engine implementing this interface +* @addr: the address to read +* @len: the number of bytes to read at 'addr' +* +* @return a MemTxResult indicating whether the operation succeeded ('len' +* bytes were read) or failed. +*/ +MemTxResult dma_ctrl_if_read (DmaCtrlIf *dma,hwaddr addr,uint32_t len); + +#endif /* HW_DMA_CTRL_IF_H */ Signature · 1 line
2.11.0
Re: [PATCH v6 05/12] hw/dma: Add the DMA control interface
Quoted 38 lines · Luc Michel
Hi Francisco!
Quoted 9 lines · Francisco Iglesias
An option on real hardware when embedding a DMA engine into a peripheral is to make the peripheral control the engine through a custom DMA control (hardware) interface between the two. Software drivers in this scenario configure and trigger DMA operations through the controlling peripheral's register API (for example, writing a specific bit in a register could propagate down to a transfer start signal on the DMA control interface). At the same time the status, results and interrupts for the transfer might still be intended to be read and caught through the DMA engine's register API (and signals).
I understand the goal you trying to achieve here. Having a generic interface between a peripheral and the internal DMA it's using for its memory transfers.
I wonder however how much this scenario can be generalized. I see that you have only one method in this interface, which is basically "perform a DMA transaction". Given the method's parameters, the peripheral can indicate what address/length it wants to read.
IIUC this is well suited to your case (the OSPI controller), because other DMA parameters are configured by other means (DMA or OSPI registers I guess).
But how much this will suite the next use case for this interface? Will the embedded DMA be configured the same way? Maybe the method will also require e.g., the destination buffer address?
My feeling is that this interface is quite ad-hoc for your case. It is either going to stay really simple as it is now, and won't necessarily fit the next similar use case, or is going to get pretty complicated to cover all cases. For an added value I'm not sure I can see because the pair "peripheral - DMA" seems tightly coupled to me. Do you foresee a case where you want to be able to e.g., instantiate DMA B instead of DMA A for the same controller?
Quoted 5 lines
I think you could have basically the same code by having a pointer to your XlnxCSUDMA object (instead of the iface) in the OSPI struct, and a function like
xlnx_csu_dma_start_transferdeclared inxlnx_csu_dma.h, having the same behaviour asdma_ctrl_if_read.
Hi Luc,
Quoted 2 lines
Maybe I'm wrong and you actually foresee cases where the genericity this interface gives is what you want? What do you think?
I see your point! Lets go with what you proposed above instead then! v7 will have taken that direction!
Thank you again for reviewing!
Best regards,
Francisco Iglesias
Quoted 135 lines
Luc
Quoted 130 lines
This patch adds a QEMU DMA control interface that can be used for modelling above scenario. Through this new interface a peripheral model embedding a DMA engine model will be able to directly initiate transfers through the DMA. At the same time the transfer state, result and completion signaling will be read and caught through the DMA engine model's register API and signaling.
Signed-off-by Francisco Iglesias <[email protected]>--- hw/dma/dma-ctrl-if.c | 30 +++++++++++++++++++++++ hw/dma/meson.build | 1 + include/hw/dma/dma-ctrl-if.h | 58 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 hw/dma/dma-ctrl-if.c create mode 100644 include/hw/dma/dma-ctrl-if.hhw/dma/dma-ctrl-if.c new file +30
-0@@ -0,0 +1,30 @@ +/* +* DMA control interface. +* +* Copyright (c) 2021 Xilinx Inc. +* Written by Francisco Iglesias <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#include "qemu/osdep.h" +#include "exec/hwaddr.h" +#include "hw/dma/dma-ctrl-if.h" + +MemTxResult dma_ctrl_if_read (DmaCtrlIf *dma,hwaddr addr,uint32_t len) +{ +DmaCtrlIfClass *dcic =DMA_CTRL_IF_GET_CLASS (dma); +return dcic->read (dma, addr, len); +} + +static const TypeInfo dma_ctrl_if_info = { + .name =TYPE_DMA_CTRL_IF , + .parent =TYPE_INTERFACE , + .class_size =sizeof (DmaCtrlIfClass), +}; + +static void dma_ctrl_if_register_types (void ) +{ +type_register_static (&dma_ctrl_if_info); +} + +type_init (dma_ctrl_if_register_types)hw/dma/meson.build +1
-0@@ -14,3 +14,4 @@ softmmu_ss.add(when: 'CONFIG_PXA2XX', if_true: files('pxa2xx_dma.c')) softmmu_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_dma.c')) softmmu_ss.add(when: 'CONFIG_SIFIVE_PDMA', if_true: files('sifive_pdma.c')) softmmu_ss.add(when: 'CONFIG_XLNX_CSU_DMA', if_true: files('xlnx_csu_dma.c')) +common_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('dma-ctrl-if.c'))include/hw/dma/dma-ctrl-if.h new file +58
-0@@ -0,0 +1,58 @@ +/* +* DMA control interface. +* +* Copyright (c) 2021 Xilinx Inc. +* Written by Francisco Iglesias <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef HW_DMA_CTRL_IF_H +#define HW_DMA_CTRL_IF_H + +#include "hw/hw.h" +#include "exec/memory.h" +#include "qom/object.h" + +#define TYPE_DMA_CTRL_IF "dma-ctrl-if" +typedef struct DmaCtrlIfClass DmaCtrlIfClass ; +DECLARE_CLASS_CHECKERS (DmaCtrlIfClass,DMA_CTRL_IF , + TYPE_DMA_CTRL_IF) + +#define DMA_CTRL_IF (obj) \ + INTERFACE_CHECK(DmaCtrlIf, (obj), TYPE_DMA_CTRL_IF) + +typedef struct DmaCtrlIf { +Object Parent; +}DmaCtrlIf ; + +typedef struct DmaCtrlIfClass { +InterfaceClass parent; + +/* +* read: Start a read transfer on the DMA engine implementing the DMA +* control interface +* +* @dma_ctrl: the DMA engine implementing this interface +* @addr: the address to read +* @len: the number of bytes to read at 'addr' +* +* @return a MemTxResult indicating whether the operation succeeded ('len' +* bytes were read) or failed. +*/ +MemTxResult (*read)(DmaCtrlIf *dma,hwaddr addr,uint32_t len); +}DmaCtrlIfClass ; + +/* +* Start a read transfer on a DMA engine implementing the DMA control +* interface. +* +* @dma_ctrl: the DMA engine implementing this interface +* @addr: the address to read +* @len: the number of bytes to read at 'addr' +* +* @return a MemTxResult indicating whether the operation succeeded ('len' +* bytes were read) or failed. +*/ +MemTxResult dma_ctrl_if_read (DmaCtrlIf *dma,hwaddr addr,uint32_t len); + +#endif /* HW_DMA_CTRL_IF_H */ Signature · 1 line
2.11.0
PATCH v6 6/12 hw/dma/xlnx_csu_dma: Implement the DMA control interface
In reply to Francisco IglesiasImplement the DMA control interface for allowing direct control of DMA operations from inside peripheral models embedding (and reusing) the Xilinx CSU DMA.
--- hw/dma/xlnx_csu_dma.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
hw/dma/xlnx_csu_dma.c +20 -0
@@ -30,6 +30,7 @@#include "hw/stream.h" #include "hw/register.h" #include "hw/dma/xlnx_csu_dma.h" +#include "hw/dma/dma-ctrl-if.h" /* * Ref: UG1087 (v1.7) February 8, 2019
@@ -472,6 +473,21 @@ static uint64_t addr_msb_pre_write(RegisterInfo *reg, uint64_t val)return val &R_ADDR_MSB_ADDR_MSB_MASK ; } +static MemTxResult xlnx_csu_dma_dma_ctrl_if_read (DmaCtrlIf *dma,hwaddr addr, +uint32_t len) +{ +XlnxCSUDMA *s =XLNX_CSU_DMA (dma); +RegisterInfo *reg = &s->regs_info[R_SIZE ]; +uint64_t we =MAKE_64BIT_MASK (0 ,4 *8 ); + + s->regs[R_ADDR ] = addr; + s->regs[R_ADDR_MSB ] = (uint64_t )addr >>32 ; + +register_write (reg, len, we,object_get_typename (OBJECT (s)), false); + +return (s->regs[R_SIZE ] ==0 ) ?MEMTX_OK :MEMTX_ERROR ; +} + static const RegisterAccessInfo *xlnx_csu_dma_regs_info[] = { #define DMACH_REGINFO(NAME, snd) \ (const RegisterAccessInfo []) { \
@@ -696,6 +712,7 @@ static void xlnx_csu_dma_class_init(ObjectClass *klass, void *data) {DeviceClass *dc =DEVICE_CLASS (klass);StreamSinkClass *ssc =STREAM_SINK_CLASS (klass); +DmaCtrlIfClass *dcic =DMA_CTRL_IF_CLASS (klass); dc->reset = xlnx_csu_dma_reset; dc->realize = xlnx_csu_dma_realize;
@@ -704,6 +721,8 @@ static void xlnx_csu_dma_class_init(ObjectClass *klass, void *data) ssc->push = xlnx_csu_dma_stream_push; ssc->can_push = xlnx_csu_dma_stream_can_push; + + dcic->read = xlnx_csu_dma_dma_ctrl_if_read; }static void xlnx_csu_dma_init (Object *obj)
@@ -731,6 +750,7 @@ static const TypeInfo xlnx_csu_dma_info = { .instance_init = xlnx_csu_dma_init, .interfaces = (InterfaceInfo []) { {TYPE_STREAM_SINK }, + {TYPE_DMA_CTRL_IF }, { } } };
Signature · 1 line
2.11.0
PATCH v6 7/12 hw/ssi: Add a model of Xilinx Versal's OSPI flash memory controller
In reply to Francisco IglesiasAdd a model of Xilinx Versal's OSPI flash memory controller.
--- hw/ssi/meson.build | 1 + hw/ssi/xlnx-versal-ospi.c | 1856 +++++++++++++++++++++++++++++++++++++ include/hw/ssi/xlnx-versal-ospi.h | 111 +++ 3 files changed, 1968 insertions(+) create mode 100644 hw/ssi/xlnx-versal-ospi.c create mode 100644 include/hw/ssi/xlnx-versal-ospi.h
hw/ssi/meson.build +1 -0
@@ -7,5 +7,6 @@ softmmu_ss.add(when: 'CONFIG_SSI', if_true: files('ssi.c')) softmmu_ss.add(when: 'CONFIG_STM32F2XX_SPI', if_true: files('stm32f2xx_spi.c')) softmmu_ss.add(when: 'CONFIG_XILINX_SPI', if_true: files('xilinx_spi.c')) softmmu_ss.add(when: 'CONFIG_XILINX_SPIPS', if_true: files('xilinx_spips.c')) +softmmu_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-ospi.c')) softmmu_ss.add(when: 'CONFIG_IMX', if_true: files('imx_spi.c')) softmmu_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_spi.c'))
hw/ssi/xlnx-versal-ospi.c new file +1856 -0
1,856 lines not on this page · raw message
include/hw/ssi/xlnx-versal-ospi.h new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
2.11.0
Re: [PATCH v6 07/12] hw/ssi: Add a model of Xilinx Versal's OSPI flash memory controller
Hi Francisco,
Impressive beast :-) Nicely done. Maybe I would have split it in a couple of commits to ease review. Also, you can use
[diff]
orderFile = scripts/git.orderfile
as a local config in your QEMU git so that files are placed in a sensible order (.h files will come first), which ease a bit the reviewing process.
See my remarks below. My biggest concern is about the tx_sram fifo. The rest are small suggestions here and there.
On 15:28 Fri 14 Jan , Francisco Iglesias wrote:
[snip]
hw/ssi/xlnx-versal-ospi.c line 402
Quoted 6 lines
hw/ssi/xlnx-versal-ospi.c new file +6
-0+ +static int ospi_stig_membank_rd_bytes (XlnxVersalOspi *s) +{ +int rd_data_fld =ARRAY_FIELD_EX32 (s->regs,FLASH_COMMAND_CTRL_MEM_REG , +NB_OF_STIG_READ_BYTES_FLD ); +int sizes[6 ] = {16 ,32 ,64 ,128 ,256 ,512 };
static const int sizes[6]
(or return (rd_data_fld < 6) ? (1 << (4 + rd_data_fld)) : 0; )
Quoted 3 lines
hw/ssi/xlnx-versal-ospi.c new file +3
-0+return (rd_data_fld <6 ) ? sizes[rd_data_fld] :0 ; +} +
[snip]
hw/ssi/xlnx-versal-ospi.c line 573
Quoted 12 lines
hw/ssi/xlnx-versal-ospi.c new file +12
-0+ +static void ospi_ahb_decoder_enable_cs (XlnxVersalOspi *s,hwaddr addr) +{ +int cs =ospi_ahb_decoder_cs (s, addr); + +if (cs >=0 ) { +for (int i =0 ; i < s->num_cs; i++) { +if (cs == i) { +qemu_set_irq (s->cs_lines[i],0 ); + }else { +qemu_set_irq (s->cs_lines[i],1 ); + }
Maybe qemu_set_irq(s->cs_lines[i], cs != i); instead of the if/else?
Quoted 4 lines
hw/ssi/xlnx-versal-ospi.c new file +4
-0+ } + } +} +
[snip]
hw/ssi/xlnx-versal-ospi.c line 1009
Quoted 11 lines
hw/ssi/xlnx-versal-ospi.c new file +11
-0+ +static void ospi_stig_fill_membank (XlnxVersalOspi *s) +{ +int num_rd_bytes =ospi_stig_membank_rd_bytes (s); +int idx = num_rd_bytes -8 ;/* first of last 8 */ +int i; + +for (i =0 ; i < num_rd_bytes; i++) { + s->stig_membank[i] =fifo8_pop (&s->rx_fifo); + } +
Even though ospi_stig_membank_rd_bytes is safe, I would add a
g_assert((idx + 4) < ARRAY_SIZE(s->stig_membank));
here, to be future proof :-)
Quoted 5 lines
hw/ssi/xlnx-versal-ospi.c new file +5
-0+/* Fill in lower upper regs */ + s->regs[R_FLASH_RD_DATA_LOWER_REG ] =ldl_le_p (&s->stig_membank[idx]); + s->regs[R_FLASH_RD_DATA_UPPER_REG ] =ldl_le_p (&s->stig_membank[idx +4 ]); +} +
[snip]
hw/ssi/xlnx-versal-ospi.c line 1132
Quoted 7 lines
hw/ssi/xlnx-versal-ospi.c new file +7
-0+ +static void ospi_tx_sram_write (XlnxVersalOspi *s,uint64_t value, +unsigned int size) +{ +int i; +for (i =0 ; i < size; i++) { +fifo8_push (&s->tx_sram, value >>8 * i);
By tracing the callers of this function, it seems that size' is the size of an MMIO access. But you don't seem to check if the tx_sram fifo can accept size' elements (the fifo8_push doc stats it is undefined behaviour to push on a full fifo).
hw/ssi/xlnx-versal-ospi.c line 1620
Quoted 11 lines
hw/ssi/xlnx-versal-ospi.c new file +11
-0+ } +} + + +static void ospi_indac_write (void *opaque,uint64_t value,unsigned int size) +{ +XlnxVersalOspi *s =XILINX_VERSAL_OSPI (opaque); + +if (s->ind_write_disabled) { +g_assert_not_reached (); + }
g_assert(!s->ind_write_disabled);
Quoted 10 lines
hw/ssi/xlnx-versal-ospi.c new file +10
-0+ +if (!ospi_ind_op_completed (s->wr_ind_op)) { +ospi_tx_sram_write (s, value, size); +ospi_do_indirect_write (s); + }else { +qemu_log_mask (LOG_GUEST_ERROR , +"OSPI wr into indac area while no ongoing indac wr\n" ); + } +} +
[snip]
Quoted 53 lines
include/hw/ssi/xlnx-versal-ospi.h new file +47
-0@@ -0,0 +1,111 @@ +/* +* Header file for the Xilinx Versal's OSPI controller +* +* Copyright (C) 2021 Xilinx Inc +* Written by Francisco Iglesias <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ + +/* +* This is a model of Xilinx Versal's Octal SPI flash memory controller +* documented in Versal's Technical Reference manual [1] and the Versal ACAP +* Register reference [2]. +* +* References: +* +* [1] Versal ACAP Technical Reference Manual, +* https://www.xilinx.com/support/documentation/architecture-manuals/am011-versal-acap-trm.pdf +* +* [2] Versal ACAP Register Reference, +* https://www.xilinx.com/html_docs/registers/am012/am012-versal-register-reference.html#mod___ospi.html +* +* +* QEMU interface: +* + sysbus MMIO region 0: MemoryRegion for the device's registers +* + sysbus MMIO region 1: MemoryRegion for flash memory linear address space +* (data transfer). +* + sysbus IRQ 0: Device interrupt. +* + Named GPIO input "ospi-mux-sel": 0: enables indirect access mode +* and 1: enables direct access mode. +* + Property "dac-with-indac": Allow both direct accesses and indirect
include/hw/ssi/xlnx-versal-ospi.h line 57
Quoted 10 lines
include/hw/ssi/xlnx-versal-ospi.h new file +10
-0+* accesses simultaneously. +* + Property "indac-write-disabled": Disable indirect access writes. +*/ + +#ifndef XILINX_VERSAL_OSPI_H +#define XILINX_VERSAL_OSPI_H + +#include "hw/register.h" +#include "hw/ssi/ssi.h" +#include "qemu/fifo32.h"
fifo8.h ?
Thanks.
Signature · 1 line
Luc
Re: [PATCH v6 07/12] hw/ssi: Add a model of Xilinx Versal's OSPI flash memory controller
Hi Luc,
All the suggestions and corrections look good to me so brought them in in v7!
Thank you very much reviewing!
Best regards,
Francisco Iglesias
Quoted 185 lines · Luc Michel
Hi Francisco,
Impressive beast :-) Nicely done. Maybe I would have split it in a couple of commits to ease review. Also, you can use
[diff]
orderFile =scripts/git.orderfileas a local config in your QEMU git so that files are placed in a sensible order (.h files will come first), which ease a bit the reviewing process.
See my remarks below. My biggest concern is about the
tx_sramfifo. The rest are small suggestions here and there.On 15:28 Fri 14 Jan , Francisco Iglesias wrote:
[snip]hw/ssi/xlnx-versal-ospi.c line 402
Quoted 6 lines
hw/ssi/xlnx-versal-ospi.c new file +6
-0+ +static int ospi_stig_membank_rd_bytes (XlnxVersalOspi *s) +{ +int rd_data_fld =ARRAY_FIELD_EX32 (s->regs,FLASH_COMMAND_CTRL_MEM_REG , +NB_OF_STIG_READ_BYTES_FLD ); +int sizes[6 ] = {16 ,32 ,64 ,128 ,256 ,512 };static const int sizes[6]
(or return (
rd_data_fld< 6) ? (1 << (4 +rd_data_fld)) : 0; )Quoted 3 lines
hw/ssi/xlnx-versal-ospi.c new file +3
-0+return (rd_data_fld <6 ) ? sizes[rd_data_fld] :0 ; +} +[snip]
hw/ssi/xlnx-versal-ospi.c line 573
Quoted 12 lines
hw/ssi/xlnx-versal-ospi.c new file +12
-0+ +static void ospi_ahb_decoder_enable_cs (XlnxVersalOspi *s,hwaddr addr) +{ +int cs =ospi_ahb_decoder_cs (s, addr); + +if (cs >=0 ) { +for (int i =0 ; i < s->num_cs; i++) { +if (cs == i) { +qemu_set_irq (s->cs_lines[i],0 ); + }else { +qemu_set_irq (s->cs_lines[i],1 ); + }Maybe
qemu_set_irq(s->cs_lines[i], cs != i);instead of the if/else?Quoted 4 lines
hw/ssi/xlnx-versal-ospi.c new file +4
-0+ } + } +} +[snip]
hw/ssi/xlnx-versal-ospi.c line 1009
Quoted 11 lines
hw/ssi/xlnx-versal-ospi.c new file +11
-0+ +static void ospi_stig_fill_membank (XlnxVersalOspi *s) +{ +int num_rd_bytes =ospi_stig_membank_rd_bytes (s); +int idx = num_rd_bytes -8 ;/* first of last 8 */ +int i; + +for (i =0 ; i < num_rd_bytes; i++) { + s->stig_membank[i] =fifo8_pop (&s->rx_fifo); + } +Even though
ospi_stig_membank_rd_bytesis safe, I would add a
g_assert((idx + 4) < ARRAY_SIZE(s->stig_membank));here, to be future proof :-)
Quoted 5 lines
hw/ssi/xlnx-versal-ospi.c new file +5
-0+/* Fill in lower upper regs */ + s->regs[R_FLASH_RD_DATA_LOWER_REG ] =ldl_le_p (&s->stig_membank[idx]); + s->regs[R_FLASH_RD_DATA_UPPER_REG ] =ldl_le_p (&s->stig_membank[idx +4 ]); +} +[snip]
hw/ssi/xlnx-versal-ospi.c line 1132
Quoted 7 lines
hw/ssi/xlnx-versal-ospi.c new file +7
-0+ +static void ospi_tx_sram_write (XlnxVersalOspi *s,uint64_t value, +unsigned int size) +{ +int i; +for (i =0 ; i < size; i++) { +fifo8_push (&s->tx_sram, value >>8 * i);By tracing the callers of this function, it seems that
size' is the size of an MMIO access. But you don't seem to check if the tx_sram fifo can acceptsize' elements (thefifo8_pushdoc stats it is undefined behaviour to push on a full fifo).hw/ssi/xlnx-versal-ospi.c line 1620
Quoted 11 lines
hw/ssi/xlnx-versal-ospi.c new file +11
-0+ } +} + + +static void ospi_indac_write (void *opaque,uint64_t value,unsigned int size) +{ +XlnxVersalOspi *s =XILINX_VERSAL_OSPI (opaque); + +if (s->ind_write_disabled) { +g_assert_not_reached (); + }
g_assert(!s->ind_write_disabled);Quoted 10 lines
hw/ssi/xlnx-versal-ospi.c new file +10
-0+ +if (!ospi_ind_op_completed (s->wr_ind_op)) { +ospi_tx_sram_write (s, value, size); +ospi_do_indirect_write (s); + }else { +qemu_log_mask (LOG_GUEST_ERROR , +"OSPI wr into indac area while no ongoing indac wr\n" ); + } +} +[snip]
Quoted 53 lines
include/hw/ssi/xlnx-versal-ospi.h new file +47
-0@@ -0,0 +1,111 @@ +/* +* Header file for the Xilinx Versal's OSPI controller +* +* Copyright (C) 2021 Xilinx Inc +* Written by Francisco Iglesias <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ + +/* +* This is a model of Xilinx Versal's Octal SPI flash memory controller +* documented in Versal's Technical Reference manual [1] and the Versal ACAP +* Register reference [2]. +* +* References: +* +* [1] Versal ACAP Technical Reference Manual, +* https://www.xilinx.com/support/documentation/architecture-manuals/am011-versal-acap-trm.pdf +* +* [2] Versal ACAP Register Reference, +* https://www.xilinx.com/html_docs/registers/am012/am012-versal-register-reference.html#mod___ospi.html +* +* +* QEMU interface: +* + sysbus MMIO region 0: MemoryRegion for the device's registers +* + sysbus MMIO region 1: MemoryRegion for flash memory linear address space +* (data transfer). +* + sysbus IRQ 0: Device interrupt. +* + Named GPIO input "ospi-mux-sel": 0: enables indirect access mode +* and 1: enables direct access mode. +* + Property "dac-with-indac": Allow both direct accesses and indirect include/hw/ssi/xlnx-versal-ospi.h line 57
Quoted 10 lines
include/hw/ssi/xlnx-versal-ospi.h new file +10
-0+* accesses simultaneously. +* + Property "indac-write-disabled": Disable indirect access writes. +*/ + +#ifndef XILINX_VERSAL_OSPI_H +#define XILINX_VERSAL_OSPI_H + +#include "hw/register.h" +#include "hw/ssi/ssi.h" +#include "qemu/fifo32.h"
fifo8.h?Thanks.
Signature · 1 line
Luc
PATCH v6 8/12 hw/arm/xlnx-versal: Connect the OSPI flash memory controller model
In reply to Francisco IglesiasConnect the OSPI flash memory controller model (including the source and destination DMA).
--- hw/arm/xlnx-versal.c | 93 ++++++++++++++++++++++++++++++++++++++++++++ include/hw/arm/xlnx-versal.h | 20 ++++++++++ 2 files changed, 113 insertions(+)
hw/arm/xlnx-versal.c +93 -0
@@ -28,6 +28,7 @@#define GEM_REVISION 0x40070106#define VERSAL_NUM_PMC_APB_IRQS 3 +#define NUM_OSPI_IRQ_LINES 3static void versal_create_apu_cpus (Versal *s) {
@@ -412,6 +413,97 @@ static void versal_create_pmc_iou_slcr(Versal *s, qemu_irq *pic) qdev_get_gpio_in(DEVICE(&s->pmc.apb_irq_orgate), 2)); } +static void versal_create_ospi (Versal *s,qemu_irq *pic) +{ +SysBusDevice *sbd; +MemoryRegion *mr_dac; +qemu_irq ospi_mux_sel; +DeviceState *orgate; + +memory_region_init (&s->pmc.iou.ospi.linear_mr,OBJECT (s), +"versal-ospi-linear-mr" ,MM_PMC_OSPI_DAC_SIZE ); + +object_initialize_child (OBJECT (s),"versal-ospi" , &s->pmc.iou.ospi.ospi, +TYPE_XILINX_VERSAL_OSPI ); + + mr_dac =sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->pmc.iou.ospi.ospi),1 ); +memory_region_add_subregion (&s->pmc.iou.ospi.linear_mr,0x0 , mr_dac); + +/* Create the OSPI destination DMA */ +object_initialize_child (OBJECT (s),"versal-ospi-dma-dst" , + &s->pmc.iou.ospi.dma_dst, +TYPE_XLNX_CSU_DMA ); + +object_property_set_link (OBJECT (&s->pmc.iou.ospi.dma_dst), +"dma" ,OBJECT (get_system_memory ()), + &error_abort); + + sbd =SYS_BUS_DEVICE (&s->pmc.iou.ospi.dma_dst); +sysbus_realize (sbd, &error_fatal); + +memory_region_add_subregion (&s->mr_ps,MM_PMC_OSPI_DMA_DST , +sysbus_mmio_get_region (sbd,0 )); + +/* Create the OSPI source DMA */ +object_initialize_child (OBJECT (s),"versal-ospi-dma-src" , + &s->pmc.iou.ospi.dma_src, +TYPE_XLNX_CSU_DMA ); + +object_property_set_bool (OBJECT (&s->pmc.iou.ospi.dma_src),"is-dst" , + false, &error_abort); + +object_property_set_link (OBJECT (&s->pmc.iou.ospi.dma_src), +"dma" ,OBJECT (mr_dac), &error_abort); + +object_property_set_link (OBJECT (&s->pmc.iou.ospi.dma_src), +"stream-connected-dma" , +OBJECT (&s->pmc.iou.ospi.dma_dst), + &error_abort); + + sbd =SYS_BUS_DEVICE (&s->pmc.iou.ospi.dma_src); +sysbus_realize (sbd, &error_fatal); + +memory_region_add_subregion (&s->mr_ps,MM_PMC_OSPI_DMA_SRC , +sysbus_mmio_get_region (sbd,0 )); + +/* Realize the OSPI */ +object_property_set_link (OBJECT (&s->pmc.iou.ospi.ospi),"dma-src" , +OBJECT (&s->pmc.iou.ospi.dma_src), &error_abort); + + sbd =SYS_BUS_DEVICE (&s->pmc.iou.ospi.ospi); +sysbus_realize (sbd, &error_fatal); + +memory_region_add_subregion (&s->mr_ps,MM_PMC_OSPI , +sysbus_mmio_get_region (sbd,0 )); + +memory_region_add_subregion (&s->mr_ps,MM_PMC_OSPI_DAC , + &s->pmc.iou.ospi.linear_mr); + +/* ospi_mux_sel */ + ospi_mux_sel =qdev_get_gpio_in_named (DEVICE (&s->pmc.iou.ospi.ospi), +"ospi-mux-sel" ,0 ); +qdev_connect_gpio_out_named (DEVICE (&s->pmc.iou.slcr),"ospi-mux-sel" ,0 , + ospi_mux_sel); + +/* OSPI irq */ +object_initialize_child (OBJECT (s),"ospi-irq-orgate" , + &s->pmc.iou.ospi.irq_orgate,TYPE_OR_IRQ ); +object_property_set_int (OBJECT (&s->pmc.iou.ospi.irq_orgate), +"num-lines" ,NUM_OSPI_IRQ_LINES , &error_fatal); + + orgate =DEVICE (&s->pmc.iou.ospi.irq_orgate); +qdev_realize (orgate,NULL , &error_fatal); + +sysbus_connect_irq (SYS_BUS_DEVICE (&s->pmc.iou.ospi.ospi),0 , +qdev_get_gpio_in (orgate,0 )); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->pmc.iou.ospi.dma_src),0 , +qdev_get_gpio_in (orgate,1 )); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->pmc.iou.ospi.dma_dst),0 , +qdev_get_gpio_in (orgate,2 )); + +qdev_connect_gpio_out (orgate,0 , pic[VERSAL_OSPI_IRQ ]); +} +/* This takes the board allocated linear DDR memory and creates aliases * for each split DDR range/aperture on the Versal address map. */
@@ -552,6 +644,7 @@ static void versal_realize(DeviceState *dev, Error **errp)versal_create_bbram (s, pic);versal_create_efuse (s, pic);versal_create_pmc_iou_slcr (s, pic); +versal_create_ospi (s, pic);versal_map_ddr (s);versal_unimp (s);
include/hw/arm/xlnx-versal.h +20 -0
@@ -26,6 +26,8 @@#include "hw/misc/xlnx-versal-xramc.h" #include "hw/nvram/xlnx-bbram.h" #include "hw/nvram/xlnx-versal-efuse.h" +#include "hw/ssi/xlnx-versal-ospi.h" +#include "hw/dma/xlnx_csu_dma.h" #include "hw/misc/xlnx-versal-pmc-iou-slcr.h" #define TYPE_XLNX_VERSAL "xlnx-versal"
@@ -80,6 +82,14 @@ struct Versal {struct {SDHCIState sd[XLNX_VERSAL_NR_SDS ];XlnxVersalPmcIouSlcr slcr; + +struct { +XlnxVersalOspi ospi; +XlnxCSUDMA dma_src; +XlnxCSUDMA dma_dst; +MemoryRegion linear_mr; +qemu_or_irq irq_orgate; + } ospi; } iou;XlnxZynqMPRTC rtc;
@@ -116,6 +126,7 @@ struct Versal {#define VERSAL_ADMA_IRQ_0 60#define VERSAL_XRAM_IRQ_0 79#define VERSAL_PMC_APB_IRQ 121 +#define VERSAL_OSPI_IRQ 124#define VERSAL_SD0_IRQ_0 126#define VERSAL_EFUSE_IRQ 139#define VERSAL_RTC_ALARM_IRQ 142
@@ -184,6 +195,15 @@ struct Versal {#define MM_PMC_PMC_IOU_SLCR 0xf1060000#define MM_PMC_PMC_IOU_SLCR_SIZE 0x10000 +#define MM_PMC_OSPI 0xf1010000 +#define MM_PMC_OSPI_SIZE 0x10000 + +#define MM_PMC_OSPI_DAC 0xc0000000 +#define MM_PMC_OSPI_DAC_SIZE 0x20000000 + +#define MM_PMC_OSPI_DMA_DST 0xf1011800 +#define MM_PMC_OSPI_DMA_SRC 0xf1011000 +#define MM_PMC_SD0 0xf1040000U#define MM_PMC_SD0_SIZE 0x10000#define MM_PMC_BBRAM_CTRL 0xf11f0000
Signature · 1 line
2.11.0
PATCH v6 9/12 hw/block/m25p80: Add support for Micron Xccela flash mt35xu01g
In reply to Francisco IglesiasAdd support for Micron Xccela flash mt35xu01g.
--- hw/block/m25p80.c | 2 ++ 1 file changed, 2 insertions(+)
hw/block/m25p80.c +2 -0
@@ -255,6 +255,8 @@ static const FlashPartInfo known_devices[] = { { INFO("n25q512a", 0x20ba20, 0, 64 << 10, 1024, ER_4K) }, { INFO("n25q512ax3", 0x20ba20, 0x1000, 64 << 10, 1024, ER_4K) }, { INFO("mt25ql512ab", 0x20ba20, 0x1044, 64 << 10, 1024, ER_4K | ER_32K) }, + { INFO_STACKED("mt35xu01g", 0x2c5b1b, 0x104100, 128 << 10, 1024, + ER_4K | ER_32K, 2) }, { INFO_STACKED("n25q00", 0x20ba21, 0x1000, 64 << 10, 2048, ER_4K, 4) }, { INFO_STACKED("n25q00a", 0x20bb21, 0x1000, 64 << 10, 2048, ER_4K, 4) }, { INFO_STACKED("mt25ql01g", 0x20ba21, 0x1040, 64 << 10, 2048, ER_4K, 2) },
Signature · 1 line
2.11.0
PATCH v6 10/12 hw/arm/xlnx-versal-virt: Connect mt35xu01g flashes to the OSPI
In reply to Francisco IglesiasConnect Micron Xccela mt35xu01g flashes to the OSPI flash memory controller.
--- hw/arm/xlnx-versal-virt.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
hw/arm/xlnx-versal-virt.c +23 -0
@@ -25,6 +25,8 @@#define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt") OBJECT_DECLARE_SIMPLE_TYPE(VersalVirt, XLNX_VERSAL_VIRT_MACHINE) +#define XLNX_VERSAL_NUM_OSPI_FLASH 4 +struct VersalVirt {MachineState parent_obj;
@@ -691,6 +693,27 @@ static void versal_virt_init(MachineState *machine)exit (EXIT_FAILURE ); } } + +for (i =0 ; i <XLNX_VERSAL_NUM_OSPI_FLASH ; i++) { +BusState *spi_bus; +DeviceState *flash_dev; +qemu_irq cs_line; +DriveInfo *dinfo =drive_get (IF_MTD ,0 , i); + + spi_bus =qdev_get_child_bus (DEVICE (&s->soc.pmc.iou.ospi),"spi0" ); + + flash_dev =qdev_new ("mt35xu01g" ); +if (dinfo) { +qdev_prop_set_drive_err (flash_dev,"drive" , +blk_by_legacy_dinfo (dinfo), &error_fatal); + } +qdev_realize_and_unref (flash_dev, spi_bus, &error_fatal); + + cs_line =qdev_get_gpio_in_named (flash_dev,SSI_GPIO_CS ,0 ); + +sysbus_connect_irq (SYS_BUS_DEVICE (&s->soc.pmc.iou.ospi), + i +1 , cs_line); + } }static void versal_virt_machine_instance_init (Object *obj)
Signature · 1 line
2.11.0
PATCH v6 11/12 MAINTAINERS: Add an entry for Xilinx Versal OSPI
In reply to Francisco IglesiasList myself as maintainer for the Xilinx Versal OSPI controller.
--- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -963,6 +963,12 @@ F: hw/display/dpcd.c F: include/hw/display/dpcd.h F: docs/system/arm/xlnx-versal-virt.rst +Xilinx Versal OSPI +M: Francisco Iglesias <[email protected]> +S: Maintained +F: hw/ssi/xlnx-versal-ospi.c +F: include/hw/ssi/xlnx-versal-ospi.h + ARM ACPI Subsystem M: Shannon Zhao <[email protected]> L: [email protected]
Signature · 1 line
2.11.0
PATCH v6 12/12 docs/devel: Add documentation for the DMA control interface
In reply to Francisco IglesiasAlso, since being the author, list myself as maintainer for the file.
--- MAINTAINERS | 1 + docs/devel/dma-ctrl-if.rst | 243 +++++++++++++++++++++++++++++++++++++++++++++ docs/devel/index.rst | 1 + 3 files changed, 245 insertions(+) create mode 100644 docs/devel/dma-ctrl-if.rst
MAINTAINERS +1 -0
@@ -968,6 +968,7 @@ M: Francisco Iglesias <[email protected]> S: Maintained F: hw/ssi/xlnx-versal-ospi.c F: include/hw/ssi/xlnx-versal-ospi.h +F: docs/devel/dma-ctrl-if.rst ARM ACPI Subsystem M: Shannon Zhao <[email protected]>
docs/devel/dma-ctrl-if.rst new file +243 -0
243 lines not on this page · raw message
docs/devel/index.rst +1 -0
@@ -37,6 +37,7 @@ modifying QEMU's source code. reset s390-dasd-ipl clocks + dma-ctrl-if qom modules block-coroutine-wrapper
Signature · 1 line
2.11.0