Message ID | 20211117141841.4696-10-francisco.iglesias@xilinx.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Xilinx Versal's PMC SLCR and OSPI support | expand |
On Wed, Nov 17, 2021 at 02:18:41PM +0000, Francisco Iglesias wrote: > Connect Micron Xccela mt35xu01g flashes to the OSPI flash memory > controller. > > Signed-off-by: Francisco Iglesias <francisco.iglesias@xilinx.com> > --- > hw/arm/xlnx-versal-virt.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c > index d2f55e29b6..f2f12a781e 100644 > --- a/hw/arm/xlnx-versal-virt.c > +++ b/hw/arm/xlnx-versal-virt.c > @@ -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; > > @@ -690,6 +692,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_next(IF_MTD); There's a patch from Markus on the list that is getting rid of drive_get_next(), we'll need to merge with that at some point... > + > + 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) > -- > 2.11.0 >
Hi Edgar, Thank you for having a look at the series! I made the updates in v2! Best regards, Francisco Iglesias On [2021 Nov 19] Fri 18:16:23, Edgar E. Iglesias wrote: > On Wed, Nov 17, 2021 at 02:18:41PM +0000, Francisco Iglesias wrote: > > Connect Micron Xccela mt35xu01g flashes to the OSPI flash memory > > controller. > > > > Signed-off-by: Francisco Iglesias <francisco.iglesias@xilinx.com> > > --- > > hw/arm/xlnx-versal-virt.c | 23 +++++++++++++++++++++++ > > 1 file changed, 23 insertions(+) > > > > diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c > > index d2f55e29b6..f2f12a781e 100644 > > --- a/hw/arm/xlnx-versal-virt.c > > +++ b/hw/arm/xlnx-versal-virt.c > > @@ -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; > > > > @@ -690,6 +692,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_next(IF_MTD); > > There's a patch from Markus on the list that is getting rid of > drive_get_next(), we'll need to merge with that at some point... > > > > > > + > > + 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) > > -- > > 2.11.0 > >
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index d2f55e29b6..f2f12a781e 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -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; @@ -690,6 +692,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_next(IF_MTD); + + 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)
Connect Micron Xccela mt35xu01g flashes to the OSPI flash memory controller. Signed-off-by: Francisco Iglesias <francisco.iglesias@xilinx.com> --- hw/arm/xlnx-versal-virt.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)