yangsong8-a1 opened a new pull request, #22127:
URL: https://github.com/apache/nuttx/pull/22127

   ## Summary
     
     Register more devices from the flattened device tree:
     
     - SP804 dual timer ("arm,sp804", /dev/timerN) and the CMSDK APB
       watchdog ("arm,cmsdk-wdt", /dev/watchdogN), both called from the
       qemu-armv8a bringup.
     - QEMU fw_cfg: a new read-only driver (drivers/misc/qemu_fwcfg.c) for
       the "qemu,fw-cfg-mmio" device.  /dev/qemufwcfg gives the named files
       that QEMU publishes (-fw_cfg name=...) through the configdata ioctls.
       qemu-armv7a and qemu-armv8a register it with CONFIG_QEMU_FWCFG.
     - SiFive PWM ("sifive,pwm0", /dev/pwmN) and the i.MX GPT ("fsl,imx-gpt",
       OCU and ICU channels): fdt_*_devices_register() helpers that a board
       calls.
     - CTU CAN FD on a system bus: ctucanfd_register(base, irq) registers a
       memory-mapped controller, and CAN_CTUCANFD no longer requires PCI (the
       PCI probe path is unchanged).  fdt_ctucanfd_devices_register() and
       fdt_pl061_devices_register() register the "ctu,ctucanfd" and enabled
       "arm,pl061" nodes.
       The CAN channel number comes from the node's "can-id" property, or
       the discovery order when it is missing, and a node with a
       "cpu-affinity" property is only registered on that CPU.
     
     The timer, watchdog, PWM and GPT drivers are already upstream (#21849,
     #21850, #21887, #21935).
     
     ## Impact
     
     New files in drivers/devicetree and drivers/misc, new prototypes in
     include/nuttx/fdt.h and include/nuttx/can/ctucanfd_pci.h, new
     CONFIG_QEMU_FWCFG, CAN_CTUCANFD without "depends on PCI".  The qemu
     bringup files only call the new functions when the matching driver is
     enabled, so existing configurations are unchanged.
     
     ## Testing
     
     Ubuntu 22.04, gcc 13.2.Rel1 (arm, aarch64).  CMake and Make builds of
     qemu-armv8a:nsh with all the drivers enabled have no new warnings;
     CAN_CTUCANFD also builds with PCI + chardev and without PCI + SocketCAN.
     
     Upstream QEMU has no SP804, CMSDK watchdog, SiFive PWM or sysbus CTU CAN
     FD on virt.  The run below uses our QEMU 10.2.1 build, whose virt
     machine adds these devices to the DTB.  qemu-armv8a:nsh without PCI,
     with TIMER_SP804, WATCHDOG_CMSDK, PWM_SIFIVE, QEMU_FWCFG,
     CAN_CTUCANFD_CHARDEV, IOEXPANDER_PL061 and GPIO_LOWER_HALF:
     
     qemu-system-aarch64 -nic none -cpu cortex-a53 -nographic 
       -machine virt,virtualization=on,gic-version=3 
       -object can-bus,id=canbus0 
       -device ctucan-sysbus,canbus=canbus0 
       -device ctucan-sysbus,canbus=canbus0 
       -fw_cfg name=opt/nuttx/test,string=hello-fwcfg -kernel nuttx
     
     The bringup registers SP804, the watchdog and fw_cfg.  A test program
     calls the SiFive PWM, CTU CAN FD and PL061 helpers with fdt_get(), lists
     /dev, reads the fw_cfg file, starts timer0 and watchdog0, and sends a
     frame on /dev/can0 that /dev/can1 receives:
     
     fdt_sifive_pwm_devices_register: 0
     /dev/pwm0
     /dev/qemufwcfg
     /dev/timer0
     /dev/watchdog0
     open /dev/qemufwcfg: ok
     CFGDIOC_GETCONFIG opt/nuttx/test: ret 0 len 11 "hello-fwcfg"
     timer0: timeout 1000000, timeleft 999940 -> 799205 after 200 ms
     watchdog0: flags 0x3 timeout 5000 ms
     fdt_ctucanfd_devices_register: 0
     fdt_pl061_devices_register: 0
     /dev/can0
     /dev/can1
     gpio nodes: 8
     open can0 3 can1 4
     write can0: 7
     read can1: 7 id 0x123 dlc 4 data 11 22 33 44
     
     qemu-armv7a:nsh with DEVICE_TREE and QEMU_FWCFG on upstream QEMU 6.2
     (RAM_START at 0x40200000 as in qemu-armv7a:full, so the DTB is not
     overwritten):
     
     /dev/qemufwcfg
     open /dev/qemufwcfg: ok
     CFGDIOC_GETCONFIG opt/nuttx/test: ret 0 len 11 "hello-fwcfg"
     
     With `-device ctucan-sysbus,canbus=canbus0,can-id=3` and `can-id=5` the
     nodes are /dev/can3 and /dev/can5.  With `cpu-affinity=0` and
     `cpu-affinity=1` (single-core nsh) only the first one is registered:
     
     fdt_ctucanfd_devices_register: 0
     /dev/can0
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to