hw/arm/fsl-imx8mp: Add inital FlexCAN support
v2 cover hw/arm/fsl-imx8mp: Add inital FlexCAN support
Now that FlexCAN emulation has landed in master, let's add it to imx8mp-evk as well. While the real i.MX8M Plus supports CAN FD which isn't emulated yet, the non-FD mode works well under Linux: It is possible to use cangen and candump either way on the host and on the guest, as described in docs/system/devices/can.rst.
This series consists of five patches where the first four are preparations. The last patch integrates FlexCAN into the i.MX8M Plus SoC and EVK board. The first preparation addresses the review comment from [1], and could be applied independently.
It would be nice if this series could make it into 11.1.
Testing done:
* Start imx8mp-evk and run cangen can0 there. Observe on the host that candump vcan0 prints the traffic.
* make check
v2:
Thanks for the very helpful and super quick review, Phil! Here we go:
* Add patch "hw/net/can/flexcan: Wire clock control module via link property"
* Have separate MemoryRegionOps for 32 and 64 bit
[1] https://lore.kernel.org/qemu-devel/[email protected]/
---
base-commit: a59157f98f0b69b0bbdb26bc15fbc4d6c8060799
Bernhard Beschow (5):
hw/net/can/flexcan: Wire clock control module via link property hw/net/can/flexcan: Subclass TYPE_CAN_FLEXCAN hw/arm/imx8mp-evk: Open code DEFINE_MACHINE_AARCH64 hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState
hw/arm: Add basic FlexCAN3 support to TYPE_FSL_IMX8MP and imx8mp-evk
docs/system/arm/imx8m.rst | 1 + include/hw/arm/fsl-imx8mp.h | 8 ++++ include/hw/net/flexcan.h | 4 +- hw/arm/fsl-imx6.c | 5 ++- hw/arm/fsl-imx8mp.c | 38 ++++++++++++++++ hw/arm/imx8mp-evk.c | 64 ++++++++++++++++++++++----- hw/misc/imx8mp_ccm.c | 3 ++ hw/net/can/flexcan.c | 88 ++++++++++++++++++++++++++++++------- hw/arm/Kconfig | 1 + 9 files changed, 182 insertions(+), 30 deletions(-)
Signature · 1 line
2.55.0
PATCH v2 1/5 hw/net/can/flexcan: Wire clock control module via link property
When wiring struct FlexcanState to the clock control module, it is currently necessary to reach into its private data. Moreover, when forgetting to wire the clock control module, QEMU will crash after the guest has already started. Fix both by letting struct FlexcanState expose a link property whose sanity is checked at realize time.
--- hw/arm/fsl-imx6.c | 3 ++- hw/net/can/flexcan.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-)
hw/arm/fsl-imx6.c +2 -1
@@ -391,7 +391,8 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) { FSL_IMX6_CAN2_ADDR, FSL_IMX6_FLEXCAN2_IRQ }, }; - s->flexcan[i].ccm =IMX_CCM (&s->ccm); +object_property_set_link (OBJECT (&s->flexcan[i]),"clock-control-module" , +OBJECT (&s->ccm), &error_abort);object_property_set_link (OBJECT (&s->flexcan[i]),"canbus" ,OBJECT (s->canbus[i]), &error_abort);
hw/net/can/flexcan.c +8 -2
@@ -333,8 +333,6 @@ static uint32_t flexcan_get_bitrate(FlexcanState *s)uint32_t pe_freq, s_freq, bitrate; -assert (s->ccm); -/* s_freq: CAN clock from CCM divided by the prescaler */ pe_freq =imx_ccm_get_clock_frequency (s->ccm,CLK_CAN ); s_freq = pe_freq / (1 + conf_presdiv);
@@ -1346,6 +1344,12 @@ static void flexcan_realize(DeviceState *dev, Error **errp) } } +if (!s->ccm) { +error_setg (errp,"%s 'clock-control-module' link property not set" , + dev->canonical_path); +return ; + } +sysbus_init_mmio (SYS_BUS_DEVICE (dev), &s->iomem);sysbus_init_irq (SYS_BUS_DEVICE (SYS_BUS_DEVICE (dev)), &s->irq); }
@@ -1366,6 +1370,8 @@ static const VMStateDescription vmstate_can = {static const Property flexcan_properties[] = {DEFINE_PROP_LINK ("canbus" , FlexcanState, canbus,TYPE_CAN_BUS , CanBusState *), +DEFINE_PROP_LINK ("clock-control-module" , FlexcanState, ccm,TYPE_IMX_CCM , + IMXCCMState *), };static void flexcan_class_init (ObjectClass *klass,const void *data)
Signature · 1 line
2.55.0
Re: [PATCH v2 1/5] hw/net/can/flexcan: Wire clock control module via link property
Quoted 6 lines · Bernhard Beschow
When wiring struct FlexcanState to the clock control module, it is currently necessary to reach into its private data. Moreover, when forgetting to wire the clock control module, QEMU will crash after the guest has already started. Fix both by letting struct FlexcanState expose a link property whose sanity is checked at realize time.
Quoted 6 lines
Suggested-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Bernhard Beschow <[email protected]>--- hw/arm/fsl-imx6.c | 3 ++- hw/net/can/flexcan.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-)
PATCH v2 2/5 hw/net/can/flexcan: Subclass TYPE_CAN_FLEXCAN
In reply to Bernhard BeschowSubclass TYPE_CAN_FLEXCAN, yielding TYPE_CAN_FLEXCAN2 and TYPE_CAN_FLEXCAN3.
Since TYPE_CAN_FLEXCAN is now abstract, TYPE_FSL_IMX6 needs to use TYPE_CAN_FLEXCAN2. TYPE_CAN_FLEXCAN3 will be used in TYPE_FSL_IMX8MP.
--- include/hw/net/flexcan.h | 4 ++- hw/arm/fsl-imx6.c | 2 +- hw/net/can/flexcan.c | 78 ++++++++++++++++++++++++++++++++-------- 3 files changed, 68 insertions(+), 16 deletions(-)
include/hw/net/flexcan.h +3 -1
@@ -139,7 +139,9 @@ typedef struct FlexcanState { } FlexcanState;#define TYPE_CAN_FLEXCAN "flexcan" -OBJECT_DECLARE_SIMPLE_TYPE (FlexcanState,CAN_FLEXCAN ); +#define TYPE_CAN_FLEXCAN2 "flexcan2" +#define TYPE_CAN_FLEXCAN3 "flexcan3" +#endif
hw/arm/fsl-imx6.c +1 -1
@@ -92,7 +92,7 @@ static void fsl_imx6_init(Object *obj) }for (i =0 ; i <FSL_IMX6_NUM_CANS ; i++) {snprintf (name,NAME_SIZE ,"flexcan%d" , i +1 ); -object_initialize_child (obj, name, &s->flexcan[i],TYPE_CAN_FLEXCAN ); +object_initialize_child (obj, name, &s->flexcan[i],TYPE_CAN_FLEXCAN2 ); }for (i =0 ; i <FSL_IMX6_NUM_WDTS ; i++) {snprintf (name,NAME_SIZE ,"wdt%d" , i);
hw/net/can/flexcan.c +64 -14
112 lines not on this page · raw message
Signature · 1 line
2.55.0
Re: [PATCH v2 2/5] hw/net/can/flexcan: Subclass TYPE_CAN_FLEXCAN
Quoted 11 lines · Bernhard Beschow
Subclass
TYPE_CAN_FLEXCAN, yieldingTYPE_CAN_FLEXCAN2andTYPE_CAN_FLEXCAN3.
SinceTYPE_CAN_FLEXCANis now abstract,TYPE_FSL_IMX6needs to useTYPE_CAN_FLEXCAN2.TYPE_CAN_FLEXCAN3will be used inTYPE_FSL_IMX8MP.Signed-off-by Bernhard Beschow <[email protected]>--- include/hw/net/flexcan.h | 4 ++- hw/arm/fsl-imx6.c | 2 +- hw/net/can/flexcan.c | 78 ++++++++++++++++++++++++++++++++-------- 3 files changed, 68 insertions(+), 16 deletions(-)
PATCH v2 3/5 hw/arm/imx8mp-evk: Open code DEFINE_MACHINE_AARCH64
In reply to Bernhard BeschowOpen code the DEFINE_MACHINE_AARCH64 macro in preparation of creating FslImx8mpEvkState class, needed for FlexCAN emulation.
--- hw/arm/imx8mp-evk.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
hw/arm/imx8mp-evk.c +13 -2
@@ -113,8 +113,10 @@ static const char *imx8mp_evk_get_default_cpu_type(const MachineState *ms)return ARM_CPU_TYPE_NAME ("cortex-a53" ); } -static void imx8mp_evk_machine_init (MachineClass *mc) +static void imx8mp_evk_machine_class_init (ObjectClass *oc,const void *data) { +MachineClass *mc =MACHINE_CLASS (oc); + mc->desc ="NXP i.MX 8M Plus EVK Board" ; mc->init = imx8mp_evk_init; mc->default_cpus =4 ;
@@ -124,4 +126,13 @@ static void imx8mp_evk_machine_init(MachineClass *mc) mc->get_default_cpu_type = imx8mp_evk_get_default_cpu_type; } -DEFINE_MACHINE_AARCH64 ("imx8mp-evk" , imx8mp_evk_machine_init) +static const TypeInfo imx8mp_evk_machine_types[] = { + { + .name =MACHINE_TYPE_NAME ("imx8mp-evk" ), + .parent =TYPE_MACHINE , + .class_init = imx8mp_evk_machine_class_init, + .interfaces = aarch64_machine_interfaces, + }, +}; + +DEFINE_TYPES (imx8mp_evk_machine_types)
Signature · 1 line
2.55.0
PATCH v2 4/5 hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState
In reply to Bernhard BeschowIntroduce class FslImx8mpEvkState which will be needed for holding CanBusState attributes and associated properties.
--- hw/arm/imx8mp-evk.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-)
hw/arm/imx8mp-evk.c +20 -10
@@ -19,6 +19,17 @@#include "qapi/error.h" #include <libfdt.h> +#define TYPE_IMX8MPEVK_MACHINE MACHINE_TYPE_NAME("imx8mp-evk") +OBJECT_DECLARE_SIMPLE_TYPE(FslImx8mpEvkState, IMX8MPEVK_MACHINE) + +struct FslImx8mpEvkState { +MachineState parent_obj; + +FslImx8mpState soc; + +struct arm_boot_info boot_info; +}; +static void imx8mp_evk_modify_dtb (const struct arm_boot_info *info,void *fdt) {int i, offset;
@@ -57,8 +68,7 @@ static void imx8mp_evk_modify_dtb(const struct arm_boot_info *info, void *fdt)static void imx8mp_evk_init (MachineState *machine) { -static struct arm_boot_info boot_info; -FslImx8mpState *s; +FslImx8mpEvkState *s =IMX8MPEVK_MACHINE (machine);if (machine->ram_size >FSL_IMX8MP_RAM_SIZE_MAX ) { error_report("RAM size " RAM_ADDR_FMT " above max supported (%08" PRIx64 ")",
@@ -66,7 +76,7 @@ static void imx8mp_evk_init(MachineState *machine)exit (1 ); } - boot_info = (struct arm_boot_info ) { + s->boot_info = (struct arm_boot_info ) { .loader_start =FSL_IMX8MP_RAM_START , .board_id =-1 , .ram_size = machine->ram_size,
@@ -74,10 +84,9 @@ static void imx8mp_evk_init(MachineState *machine) .modify_dtb = imx8mp_evk_modify_dtb, }; - s =FSL_IMX8MP (object_new (TYPE_FSL_IMX8MP )); -object_property_add_child (OBJECT (machine),"soc" ,OBJECT (s)); -object_property_set_uint (OBJECT (s),"fec1-phy-num" ,1 , &error_fatal); -sysbus_realize_and_unref (SYS_BUS_DEVICE (s), &error_fatal); +object_initialize_child (OBJECT (machine),"soc" , &s->soc,TYPE_FSL_IMX8MP ); +object_property_set_uint (OBJECT (&s->soc),"fec1-phy-num" ,1 , &error_fatal); +sysbus_realize_and_unref (SYS_BUS_DEVICE (&s->soc), &error_fatal);memory_region_add_subregion (get_system_memory (),FSL_IMX8MP_RAM_START , machine->ram);
@@ -93,14 +102,14 @@ static void imx8mp_evk_init(MachineState *machine) } blk =blk_by_legacy_dinfo (di); - bus =qdev_get_child_bus (DEVICE (&s->usdhc[i]),"sd-bus" ); + bus =qdev_get_child_bus (DEVICE (&s->soc.usdhc[i]),"sd-bus" ); carddev =qdev_new (TYPE_SD_CARD );qdev_prop_set_drive_err (carddev,"drive" , blk, &error_fatal);qdev_realize_and_unref (carddev, bus, &error_fatal); }if (!qtest_enabled ()) { -arm_load_kernel (&s->cpu[0 ], machine, &boot_info); +arm_load_kernel (&s->soc.cpu[0 ], machine, &s->boot_info); } }
@@ -128,9 +137,10 @@ static void imx8mp_evk_machine_class_init(ObjectClass *oc, const void *data)static const TypeInfo imx8mp_evk_machine_types[] = { { - .name =MACHINE_TYPE_NAME ("imx8mp-evk" ), + .name =TYPE_IMX8MPEVK_MACHINE , .parent =TYPE_MACHINE , .class_init = imx8mp_evk_machine_class_init, + .instance_size =sizeof (FslImx8mpEvkState), .interfaces = aarch64_machine_interfaces, }, };
Signature · 1 line
2.55.0
PATCH v2 5/5 hw/arm: Add basic FlexCAN3 support to TYPE_FSL_IMX8MP and imx8mp-evk
In reply to Bernhard BeschowReal hardware supports CAN FD which is missing in the emulation and is considered future work. Still, CAN communication already works under Linux.
--- docs/system/arm/imx8m.rst | 1 + include/hw/arm/fsl-imx8mp.h | 8 ++++++++ hw/arm/fsl-imx8mp.c | 38 +++++++++++++++++++++++++++++++++++++ hw/arm/imx8mp-evk.c | 21 ++++++++++++++++++++ hw/misc/imx8mp_ccm.c | 3 +++ hw/arm/Kconfig | 1 + 6 files changed, 72 insertions(+)
docs/system/arm/imx8m.rst +1 -0
@@ -18,6 +18,7 @@ following devices: * 1 Designware PCI Express Controller * 1 Ethernet Controller * 2 Designware USB 3 Controllers + * 2 FlexCAN 3 CAN Controllers (``imx8mp-evk`` only) * 5 GPIO Controllers * 6 I2C Controllers * 3 SPI Controllers
include/hw/arm/fsl-imx8mp.h +8 -0
@@ -17,6 +17,7 @@#include "hw/misc/imx7_snvs.h" #include "hw/misc/imx8mp_analog.h" #include "hw/misc/imx8mp_ccm.h" +#include "hw/net/flexcan.h" #include "hw/net/imx_fec.h" #include "hw/core/or-irq.h" #include "hw/pci-host/designware.h"
@@ -37,6 +38,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(FslImx8mpState, FSL_IMX8MP)#define FSL_IMX8MP_RAM_SIZE_MAX (8 * GiB)enum FslImx8mpConfiguration { +FSL_IMX8MP_NUM_CANS =2 ,FSL_IMX8MP_NUM_CPUS =4 ,FSL_IMX8MP_NUM_ECSPIS =3 ,FSL_IMX8MP_NUM_GPIOS =5 ,
@@ -68,11 +70,14 @@ struct FslImx8mpState {USBDWC3 usb[FSL_IMX8MP_NUM_USBS ];DesignwarePCIEHost pcie;FslImx8mPciePhyState pcie_phy; +FlexcanState flexcan[FSL_IMX8MP_NUM_CANS ];OrIRQState gpt5_gpt6_irq;MemoryRegion ocram;uint32_t phy_num;bool phy_connected; + +CanBusState *canbus[FSL_IMX8MP_NUM_CANS ]; };enum FslImx8mpMemoryRegions {
@@ -279,6 +284,9 @@ enum FslImx8mpIrqs {FSL_IMX8MP_PCI_INTC_IRQ =124 ,FSL_IMX8MP_PCI_INTD_IRQ =123 ,FSL_IMX8MP_PCI_MSI_IRQ =140 , + +FSL_IMX8MP_FLEXCAN1_IRQ =142 , + FSL_IMX8MP_FLEXCAN2_IRQ = 144, };#endif /* FSL_IMX8MP_H */
hw/arm/fsl-imx8mp.c +38 -0
@@ -246,6 +246,11 @@ static void fsl_imx8mp_init(Object *obj)object_initialize_child (obj, name, &s->wdt[i],TYPE_IMX2_WDT ); } +for (i =0 ; i <FSL_IMX8MP_NUM_CANS ; i++) { + g_autofree char *name = g_strdup_printf("flexcan%d", i); +object_initialize_child (obj, name, &s->flexcan[i],TYPE_CAN_FLEXCAN3 ); + } +object_initialize_child (obj,"eth0" , &s->enet,TYPE_IMX_ENET );object_initialize_child (obj,"pcie" , &s->pcie,TYPE_DESIGNWARE_PCIE_HOST );
@@ -669,6 +674,34 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->pcie_phy),0 , fsl_imx8mp_memmap[FSL_IMX8MP_PCIE_PHY1 ].addr); +/* FlexCANs */ +for (i =0 ; i <FSL_IMX8MP_NUM_CANS ; i++) { +static const struct { +hwaddr addr; +unsigned int irq; + } flexcan_table[FSL_IMX8MP_NUM_CANS ] = { + { + fsl_imx8mp_memmap[FSL_IMX8MP_FLEXCAN1 ].addr, +FSL_IMX8MP_FLEXCAN1_IRQ + }, { + fsl_imx8mp_memmap[FSL_IMX8MP_FLEXCAN2 ].addr, +FSL_IMX8MP_FLEXCAN2_IRQ + }, + }; + +object_property_set_link (OBJECT (&s->flexcan[i]),"clock-control-module" , +OBJECT (&s->ccm), &error_abort); +object_property_set_link (OBJECT (&s->flexcan[i]),"canbus" , +OBJECT (s->canbus[i]), &error_abort); + +sysbus_realize (SYS_BUS_DEVICE (&s->flexcan[i]), &error_abort); + +sysbus_mmio_map (SYS_BUS_DEVICE (&s->flexcan[i]),0 , + flexcan_table[i].addr); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->flexcan[i]),0 , +qdev_get_gpio_in (gicdev, flexcan_table[i].irq)); + } +/* On-Chip RAM */ if (!memory_region_init_ram(&s->ocram, OBJECT(dev), "imx8mp.ocram", fsl_imx8mp_memmap[FSL_IMX8MP_OCRAM].size,
@@ -684,6 +717,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)switch (i) {case FSL_IMX8MP_ANA_PLL :case FSL_IMX8MP_CCM : + case FSL_IMX8MP_FLEXCAN1 ... FSL_IMX8MP_FLEXCAN2:case FSL_IMX8MP_GIC_DIST :case FSL_IMX8MP_GIC_REDIST : case FSL_IMX8MP_GPIO1 ... FSL_IMX8MP_GPIO5:
@@ -715,6 +749,10 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)static const Property fsl_imx8mp_properties[] = {DEFINE_PROP_UINT32 ("fec1-phy-num" , FslImx8mpState, phy_num,0 ),DEFINE_PROP_BOOL ("fec1-phy-connected" , FslImx8mpState, phy_connected, true), +DEFINE_PROP_LINK ("canbus0" , FslImx8mpState, canbus[0 ],TYPE_CAN_BUS , + CanBusState *), +DEFINE_PROP_LINK ("canbus1" , FslImx8mpState, canbus[1 ],TYPE_CAN_BUS , + CanBusState *), };static void fsl_imx8mp_class_init (ObjectClass *oc,const void *data)
hw/arm/imx8mp-evk.c +21 -0
@@ -26,6 +26,7 @@ struct FslImx8mpEvkState {MachineState parent_obj;FslImx8mpState soc; +CanBusState *canbus[FSL_IMX8MP_NUM_CANS ];struct arm_boot_info boot_info; };
@@ -86,6 +87,12 @@ static void imx8mp_evk_init(MachineState *machine)object_initialize_child (OBJECT (machine),"soc" , &s->soc,TYPE_FSL_IMX8MP );object_property_set_uint (OBJECT (&s->soc),"fec1-phy-num" ,1 , &error_fatal); +for (int i =0 ; i <FSL_IMX8MP_NUM_CANS ; i++) { + g_autofree char *bus_name = g_strdup_printf("canbus%d", i); + +object_property_set_link (OBJECT (&s->soc), bus_name, +OBJECT (s->canbus[i]), &error_fatal); + }sysbus_realize_and_unref (SYS_BUS_DEVICE (&s->soc), &error_fatal); memory_region_add_subregion(get_system_memory(), FSL_IMX8MP_RAM_START,
@@ -122,6 +129,19 @@ static const char *imx8mp_evk_get_default_cpu_type(const MachineState *ms)return ARM_CPU_TYPE_NAME ("cortex-a53" ); } +static void imx8mp_evk_machine_init (Object *obj) +{ +FslImx8mpEvkState *s =IMX8MPEVK_MACHINE (obj); + +object_property_add_link (obj,"canbus0" ,TYPE_CAN_BUS , + (Object **)&s->canbus[0 ], + object_property_allow_set_link,0 ); + +object_property_add_link (obj,"canbus1" ,TYPE_CAN_BUS , + (Object **)&s->canbus[1 ], + object_property_allow_set_link,0 ); +} +static void imx8mp_evk_machine_class_init (ObjectClass *oc,const void *data) {MachineClass *mc =MACHINE_CLASS (oc);
@@ -140,6 +160,7 @@ static const TypeInfo imx8mp_evk_machine_types[] = { .name = TYPE_IMX8MPEVK_MACHINE, .parent = TYPE_MACHINE, .class_init = imx8mp_evk_machine_class_init, + .instance_init = imx8mp_evk_machine_init, .instance_size = sizeof(FslImx8mpEvkState), .interfaces = aarch64_machine_interfaces, },
hw/misc/imx8mp_ccm.c +3 -0
@@ -129,6 +129,9 @@ static uint32_t imx8mp_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)case CLK_HIGH : freq =CKIH_FREQ ;break ; +case CLK_CAN : + freq =40000000 ;/* 40Mhz, taken from device tree */ +break ;case CLK_IPG :case CLK_IPG_HIGH :/*
hw/arm/Kconfig +1 -0
@@ -600,6 +600,7 @@ config FSL_IMX8MP imply I2C_DEVICES imply PCI_DEVICES select ARM_GIC + select CAN_FLEXCAN select FSL_IMX8MP_ANALOG select FSL_IMX8MP_CCM select IMX
Signature · 1 line
2.55.0
Dear Bernhard,
Quoted 35 lines · On Thursday 02 of July 2026 20:40:33 Bernhard Beschow wrote:
Now that FlexCAN emulation has landed in master, let's add it to imx8mp-evk as well. While the real i.MX8M Plus supports CAN FD which isn't emulated yet, the non-FD mode works well under Linux: It is possible to use
cangenandcandumpeither way on the host and on the guest, as described indocs/system/devices/can.rst.This series consists of five patches where the first four are preparations. The last patch integrates FlexCAN into the i.MX8M Plus SoC and EVK board. The first preparation addresses the review comment from [1], and could be applied independently.
It would be nice if this series could make it into 11.1.
Testing done:
* Start imx8mp-evk and runcangen can0there. Observe on the host thatcandump vcan0prints the traffic.
*make checkv2:
Thanks for the very helpful and super quick review, Phil! Here we go:
* Add patch "hw/net/can/flexcan: Wire clock control module via link property" * Have separate MemoryRegionOps for 32 and 64 bit[1]
https://lore.kernel.org/qemu-devel/77d5891c-de12-467e-8746-02fe43121e3e@oss
.qualcomm.com/ ---
base-commit:a59157f98f0b69b0bbdb26bc15fbc4d6c8060799Bernhard Beschow (5):
hw/net/can/flexcan: Wire clock control module via link property hw/net/can/flexcan: SubclassTYPE_CAN_FLEXCANhw/arm/imx8mp-evk: Open codeDEFINE_MACHINE_AARCH64hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState
hw/arm: Add basic FlexCAN3 support toTYPE_FSL_IMX8MPand imx8mp-evk
Quoted 10 lines
docs/system/arm/imx8m.rst | 1 + include/hw/arm/fsl-imx8mp.h | 8 ++++ include/hw/net/flexcan.h | 4 +- hw/arm/fsl-imx6.c | 5 ++- hw/arm/fsl-imx8mp.c | 38 ++++++++++++++++ hw/arm/imx8mp-evk.c | 64 ++++++++++++++++++++++----- hw/misc/imx8mp_ccm.c | 3 ++ hw/net/can/flexcan.c | 88 ++++++++++++++++++++++++++++++------- hw/arm/Kconfig | 1 + 9 files changed, 182 insertions(+), 30 deletions(-)
Thanks for the work. I have tested the series on the top of your imx8mp-flexcan branch, commit
3b7289419cac5b712faeadf6b4a6203579d08f76
with our test setup for iMX6
qemu-system-arm -m 1G -M sabrelite -smp 4 ...
and it worked as intended. I have looked at all patches from your series and I do not see anything problematic.
You can add my confirmation to the series and or individual patches
By the way, I have noticed your iMX53 branch. We have some old kits for this because we used it for yet another generation of medical infusion system prototypes/instruments fully functional demonstrators but before final HW design with safety.
The fully realized and produced systems with iMX1 there
https://www.pikron.com/pages/devel/medinst.html
Functional demonstrators with iMX53 there
https://onimed.cz/wp-content/uploads/2021/02/medicina.png
Best wishes,
Pavel
Pavel Pisa
phone: +420 603531357
e-mail: [email protected]
Department of Control Engineering FEE CVUT Karlovo namesti 13, 121 35, Prague 2
university: http://control.fel.cvut.cz/
personal: http://cmp.felk.cvut.cz/~pisa
social: https://social.kernel.org/ppisa
projects: https://www.openhub.net/accounts/ppisa
CAN related:http://canbus.pages.fel.cvut.cz/ RISC-V education: https://comparch.edu.cvut.cz/
Open Technologies Research Education and Exchange Services
https://gitlab.fel.cvut.cz/otrees/org/-/wikis/home
Am 6. Juli 2026 11:44:14 UTC schrieb Pavel Pisa <[email protected]>:
Quoted 58 lines
Dear Bernhard,
Quoted 35 lines · On Thursday 02 of July 2026 20:40:33 Bernhard Beschow wrote:
Now that FlexCAN emulation has landed in master, let's add it to imx8mp-evk as well. While the real i.MX8M Plus supports CAN FD which isn't emulated yet, the non-FD mode works well under Linux: It is possible to use
cangenandcandumpeither way on the host and on the guest, as described indocs/system/devices/can.rst.This series consists of five patches where the first four are preparations. The last patch integrates FlexCAN into the i.MX8M Plus SoC and EVK board. The first preparation addresses the review comment from [1], and could be applied independently.
It would be nice if this series could make it into 11.1.
Testing done:
* Start imx8mp-evk and runcangen can0there. Observe on the host thatcandump vcan0prints the traffic.
*make checkv2:
Thanks for the very helpful and super quick review, Phil! Here we go:
* Add patch "hw/net/can/flexcan: Wire clock control module via link property" * Have separate MemoryRegionOps for 32 and 64 bit[1]
https://lore.kernel.org/qemu-devel/77d5891c-de12-467e-8746-02fe43121e3e@oss
.qualcomm.com/ ---
base-commit:a59157f98f0b69b0bbdb26bc15fbc4d6c8060799Bernhard Beschow (5):
hw/net/can/flexcan: Wire clock control module via link property hw/net/can/flexcan: SubclassTYPE_CAN_FLEXCANhw/arm/imx8mp-evk: Open codeDEFINE_MACHINE_AARCH64hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState
hw/arm: Add basic FlexCAN3 support toTYPE_FSL_IMX8MPand imx8mp-evkQuoted 10 lines
docs/system/arm/imx8m.rst | 1 + include/hw/arm/fsl-imx8mp.h | 8 ++++ include/hw/net/flexcan.h | 4 +- hw/arm/fsl-imx6.c | 5 ++- hw/arm/fsl-imx8mp.c | 38 ++++++++++++++++ hw/arm/imx8mp-evk.c | 64 ++++++++++++++++++++++----- hw/misc/imx8mp_ccm.c | 3 ++ hw/net/can/flexcan.c | 88 ++++++++++++++++++++++++++++++------- hw/arm/Kconfig | 1 + 9 files changed, 182 insertions(+), 30 deletions(-)Thanks for the work. I have tested the series on the top of your imx8mp-flexcan branch, commit
3b7289419cac5b712faeadf6b4a6203579d08f76with our test setup for iMX6
qemu-system-arm -m 1G -M sabrelite -smp 4 ...
Quoted 8 lines
and it worked as intended. I have looked at all patches from your series and I do not see anything problematic.
You can add my confirmation to the series and or individual patches
Acked-by Pavel Pisa <[email protected]>Tested-by Pavel Pisa <[email protected]>
Thanks!
Quoted 2 lines
By the way, I have noticed your iMX53 branch.
I haven't decided yet whether to upstream it because I wonder if anyone would be interested in this rather old but (IIUC) longterm SoC. For some reason I get file system corruption there which should be resolved before upstreaming can be considered.
Best regards,
Bernhard
Quoted 29 lines
We have some
old kits for this because we used it for yet another generation of medical infusion system prototypes/instruments fully functional demonstrators but before final HW design with safety.The fully realized and produced systems with iMX1 there
https://www.pikron.com/pages/devel/medinst.htmlFunctional demonstrators with iMX53 there
https://onimed.cz/wp-content/uploads/2021/02/medicina.pngBest wishes,
Pavel
Pavel Pisa
phone: +420 603531357
e-mail: [email protected]
Department of Control Engineering FEE CVUT
Karlovo namesti 13, 121 35, Prague 2
university: http://control.fel.cvut.cz/personal: http://cmp.felk.cvut.cz/~pisa social: https://social.kernel.org/ppisa projects: https://www.openhub.net/accounts/ppisaCAN related:http://canbus.pages.fel.cvut.cz/ RISC-V education: https://comparch.edu.cvut.cz/
Open Technologies Research Education and Exchange Services
https://gitlab.fel.cvut.cz/otrees/org/-/wikis/home
Quoted 27 lines · Bernhard Beschow
Now that FlexCAN emulation has landed in master, let's add it to imx8mp-evk as well. While the real i.MX8M Plus supports CAN FD which isn't emulated yet, the non-FD mode works well under Linux: It is possible to use
cangenandcandumpeither way on the host and on the guest, as described indocs/system/devices/can.rst.This series consists of five patches where the first four are preparations. The last patch integrates FlexCAN into the i.MX8M Plus SoC and EVK board. The first preparation addresses the review comment from [1], and could be applied independently.
It would be nice if this series could make it into 11.1.
Testing done:
* Start imx8mp-evk and runcangen can0there. Observe on the host thatcandump vcan0prints the traffic.
*make checkv2:
Thanks for the very helpful and super quick review, Phil! Here we go:
* Add patch "hw/net/can/flexcan: Wire clock control module via link property"
* Have separate MemoryRegionOps for 32 and 64 bit[1] https://lore.kernel.org/qemu-devel/[email protected]/
---
base-commit:a59157f98f0b69b0bbdb26bc15fbc4d6c8060799
Quoted 6 lines
Bernhard Beschow (5):
hw/net/can/flexcan: Wire clock control module via link property hw/net/can/flexcan: SubclassTYPE_CAN_FLEXCANhw/arm/imx8mp-evk: Open codeDEFINE_MACHINE_AARCH64hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState
hw/arm: Add basic FlexCAN3 support toTYPE_FSL_IMX8MPand imx8mp-evk
Peter, you just sent your (IIUC) last target-arm PR. I'm about to post my hw-misc one, do you mind if you take this series which is fully reviewed/tested?
Regards,
Phil.
Am 6. Juli 2026 13:25:51 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:
Quoted 35 lines · Bernhard Beschow
Quoted 27 lines
Now that FlexCAN emulation has landed in master, let's add it to imx8mp-evk as well. While the real i.MX8M Plus supports CAN FD which isn't emulated yet, the non-FD mode works well under Linux: It is possible to use
cangenandcandumpeither way on the host and on the guest, as described indocs/system/devices/can.rst.This series consists of five patches where the first four are preparations. The last patch integrates FlexCAN into the i.MX8M Plus SoC and EVK board. The first preparation addresses the review comment from [1], and could be applied independently.
It would be nice if this series could make it into 11.1.
Testing done:
* Start imx8mp-evk and runcangen can0there. Observe on the host thatcandump vcan0prints the traffic.
*make checkv2:
Thanks for the very helpful and super quick review, Phil! Here we go:
* Add patch "hw/net/can/flexcan: Wire clock control module via link property"
* Have separate MemoryRegionOps for 32 and 64 bit[1] https://lore.kernel.org/qemu-devel/[email protected]/
---
base-commit:a59157f98f0b69b0bbdb26bc15fbc4d6c8060799Quoted 6 lines
Bernhard Beschow (5):
hw/net/can/flexcan: Wire clock control module via link property hw/net/can/flexcan: SubclassTYPE_CAN_FLEXCANhw/arm/imx8mp-evk: Open codeDEFINE_MACHINE_AARCH64hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState
hw/arm: Add basic FlexCAN3 support toTYPE_FSL_IMX8MPand imx8mp-evk
Quoted 3 lines
Peter, you just sent your (IIUC) last target-arm PR. I'm about to post my hw-misc one, do you mind if you take this series which is fully reviewed/tested?
Thanks a lot Phil for your R-b's!
Any chance we can still get this series mergend for the upcoming release?
Thanks,
Bernhard
Quoted 36 lines · Philippe Mathieu-Daudé
Quoted 27 lines · Bernhard Beschow
Now that FlexCAN emulation has landed in master, let's add it to imx8mp-evk as well. While the real i.MX8M Plus supports CAN FD which isn't emulated yet, the non-FD mode works well under Linux: It is possible to use
cangenandcandumpeither way on the host and on the guest, as described indocs/system/devices/can.rst.This series consists of five patches where the first four are preparations. The last patch integrates FlexCAN into the i.MX8M Plus SoC and EVK board. The first preparation addresses the review comment from [1], and could be applied independently.
It would be nice if this series could make it into 11.1.
Testing done:
* Start imx8mp-evk and runcangen can0there. Observe on the host thatcandump vcan0prints the traffic.
*make checkv2:
Thanks for the very helpful and super quick review, Phil! Here we go:
* Add patch "hw/net/can/flexcan: Wire clock control module via link property"
* Have separate MemoryRegionOps for 32 and 64 bit[1] https://lore.kernel.org/qemu-devel/[email protected]/
---
base-commit:a59157f98f0b69b0bbdb26bc15fbc4d6c8060799Quoted 6 lines
Bernhard Beschow (5):
hw/net/can/flexcan: Wire clock control module via link property hw/net/can/flexcan: SubclassTYPE_CAN_FLEXCANhw/arm/imx8mp-evk: Open codeDEFINE_MACHINE_AARCH64hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState
hw/arm: Add basic FlexCAN3 support toTYPE_FSL_IMX8MPand imx8mp-evk
Quoted 3 lines
Peter, you just sent your (IIUC) last target-arm PR. I'm about to post my hw-misc one, do you mind if you take this series which is fully reviewed/tested?
As you note, I've already sent the last target-arm PR for pre-freeze yesterday; I'm not going to do another one. So from my POV this has just missed the deadline and will have to wait for 11.2.
thanks
-- PMM
Quoted 38 lines · Peter Maydell
Quoted 36 lines · Philippe Mathieu-Daudé
Quoted 33 lines · Bernhard Beschow
Now that FlexCAN emulation has landed in master, let's add it to imx8mp-evk as well. While the real i.MX8M Plus supports CAN FD which isn't emulated yet, the non-FD mode works well under Linux: It is possible to use
cangenandcandumpeither way on the host and on the guest, as described indocs/system/devices/can.rst.This series consists of five patches where the first four are preparations. The last patch integrates FlexCAN into the i.MX8M Plus SoC and EVK board. The first preparation addresses the review comment from [1], and could be applied independently.
It would be nice if this series could make it into 11.1.
Testing done:
* Start imx8mp-evk and runcangen can0there. Observe on the host thatcandump vcan0prints the traffic.
*make checkv2:
Thanks for the very helpful and super quick review, Phil! Here we go:
* Add patch "hw/net/can/flexcan: Wire clock control module via link property"
* Have separate MemoryRegionOps for 32 and 64 bit[1] https://lore.kernel.org/qemu-devel/[email protected]/
---
base-commit:a59157f98f0b69b0bbdb26bc15fbc4d6c8060799Bernhard Beschow (5):
hw/net/can/flexcan: Wire clock control module via link property hw/net/can/flexcan: SubclassTYPE_CAN_FLEXCANhw/arm/imx8mp-evk: Open codeDEFINE_MACHINE_AARCH64hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState
hw/arm: Add basic FlexCAN3 support toTYPE_FSL_IMX8MPand imx8mp-evk
Quoted 7 lines
Quoted 3 lines
Peter, you just sent your (IIUC) last target-arm PR. I'm about to post my hw-misc one, do you mind if you take this series which is fully reviewed/tested?
As you note, I've already sent the last target-arm PR for pre-freeze yesterday; I'm not going to do another one. So from my POV this has just missed the deadline and will have to wait for 11.2.
Err, I meant "do you mind if [I] take" ... :/
Quoted 44 lines · Philippe Mathieu-Daudé
Quoted 42 lines · Peter Maydell
Quoted 39 lines · Philippe Mathieu-Daudé
Quoted 27 lines · Bernhard Beschow
Now that FlexCAN emulation has landed in master, let's add it to imx8mp-evk as well. While the real i.MX8M Plus supports CAN FD which isn't emulated yet, the non-FD mode works well under Linux: It is possible to use
cangenandcandumpeither way on the host and on the guest, as described indocs/system/devices/can.rst.This series consists of five patches where the first four are preparations. The last patch integrates FlexCAN into the i.MX8M Plus SoC and EVK board. The first preparation addresses the review comment from [1], and could be applied independently.
It would be nice if this series could make it into 11.1.
Testing done:
* Start imx8mp-evk and runcangen can0there. Observe on the host thatcandump vcan0prints the traffic.
*make checkv2:
Thanks for the very helpful and super quick review, Phil! Here we go:
* Add patch "hw/net/can/flexcan: Wire clock control module via link property"
* Have separate MemoryRegionOps for 32 and 64 bit[1] https://lore.kernel.org/qemu-devel/[email protected]/
---
base-commit:a59157f98f0b69b0bbdb26bc15fbc4d6c8060799Quoted 6 lines
Bernhard Beschow (5):
hw/net/can/flexcan: Wire clock control module via link property hw/net/can/flexcan: SubclassTYPE_CAN_FLEXCANhw/arm/imx8mp-evk: Open codeDEFINE_MACHINE_AARCH64hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState
hw/arm: Add basic FlexCAN3 support toTYPE_FSL_IMX8MPand imx8mp-evkPeter, you just sent your (IIUC) last target-arm PR. I'm about to post my hw-misc one, do you mind if you take this series which is fully reviewed/tested?
Quoted 5 lines
Quoted 3 lines
As you note, I've already sent the last target-arm PR for pre-freeze yesterday; I'm not going to do another one. So from my POV this has just missed the deadline and will have to wait for 11.2.
Err, I meant "do you mind if [I] take" ... :/
Sure, if they've been reviewed and you're happy with them you can do that.
-- PMM
Quoted 46 lines · Peter Maydell
Quoted 44 lines · Philippe Mathieu-Daudé
Quoted 42 lines · Peter Maydell
Quoted 39 lines · Philippe Mathieu-Daudé
Quoted 27 lines · Bernhard Beschow
Now that FlexCAN emulation has landed in master, let's add it to imx8mp-evk as well. While the real i.MX8M Plus supports CAN FD which isn't emulated yet, the non-FD mode works well under Linux: It is possible to use
cangenandcandumpeither way on the host and on the guest, as described indocs/system/devices/can.rst.This series consists of five patches where the first four are preparations. The last patch integrates FlexCAN into the i.MX8M Plus SoC and EVK board. The first preparation addresses the review comment from [1], and could be applied independently.
It would be nice if this series could make it into 11.1.
Testing done:
* Start imx8mp-evk and runcangen can0there. Observe on the host thatcandump vcan0prints the traffic.
*make checkv2:
Thanks for the very helpful and super quick review, Phil! Here we go:
* Add patch "hw/net/can/flexcan: Wire clock control module via link property"
* Have separate MemoryRegionOps for 32 and 64 bit[1] https://lore.kernel.org/qemu-devel/[email protected]/
---
base-commit:a59157f98f0b69b0bbdb26bc15fbc4d6c8060799Quoted 6 lines
Bernhard Beschow (5):
hw/net/can/flexcan: Wire clock control module via link property hw/net/can/flexcan: SubclassTYPE_CAN_FLEXCANhw/arm/imx8mp-evk: Open codeDEFINE_MACHINE_AARCH64hw/arm/imx8mp-evk: Introduce FslImx8mpEvkState
hw/arm: Add basic FlexCAN3 support toTYPE_FSL_IMX8MPand imx8mp-evkPeter, you just sent your (IIUC) last target-arm PR. I'm about to post my hw-misc one, do you mind if you take this series which is fully reviewed/tested?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
As you note, I've already sent the last target-arm PR for pre-freeze yesterday; I'm not going to do another one. So from my POV this has just missed the deadline and will have to wait for 11.2.
Err, I meant "do you mind if [I] take" ... :/
Sure, if they've been reviewed and you're happy with them you can do that.
Thanks!