[RFC PATCH v1 00/12] *** Add allwinner R40 device support ***

qianfanguijin@163.com posted 12 patches 1 year, 1 month ago
Only 10 patches received!
configs/devices/arm-softmmu/default.mak |   1 +
hw/arm/Kconfig                          |  10 +
hw/arm/allwinner-h3.c                   |  29 +-
hw/arm/allwinner-r40.c                  | 555 ++++++++++++++++++++++++
hw/arm/bananapi_m2u.c                   | 128 ++++++
hw/arm/meson.build                      |   1 +
hw/i2c/allwinner-i2c.c                  | 136 +++++-
hw/i2c/trace-events                     |   5 +-
hw/misc/Kconfig                         |   4 +
hw/misc/allwinner-r40-ccu.c             | 207 +++++++++
hw/misc/allwinner-r40-dramc.c           | 499 +++++++++++++++++++++
hw/misc/axp221.c                        | 196 +++++++++
hw/misc/meson.build                     |   3 +
hw/misc/trace-events                    |  19 +
hw/sd/allwinner-sdhost.c                |  70 ++-
include/hw/arm/allwinner-h3.h           |   6 +
include/hw/arm/allwinner-r40.h          | 148 +++++++
include/hw/i2c/allwinner-i2c.h          |   6 +
include/hw/misc/allwinner-r40-ccu.h     |  65 +++
include/hw/misc/allwinner-r40-dramc.h   | 108 +++++
include/hw/sd/allwinner-sdhost.h        |   9 +
21 files changed, 2191 insertions(+), 14 deletions(-)
create mode 100644 hw/arm/allwinner-r40.c
create mode 100644 hw/arm/bananapi_m2u.c
create mode 100644 hw/misc/allwinner-r40-ccu.c
create mode 100644 hw/misc/allwinner-r40-dramc.c
create mode 100644 hw/misc/axp221.c
create mode 100644 include/hw/arm/allwinner-r40.h
create mode 100644 include/hw/misc/allwinner-r40-ccu.h
create mode 100644 include/hw/misc/allwinner-r40-dramc.h
[RFC PATCH v1 00/12] *** Add allwinner R40 device support ***
Posted by qianfanguijin@163.com 1 year, 1 month ago
From: qianfan Zhao <qianfanguijin@163.com>

v1: 2023-03-02

The first three patches try fix allwinner i2c driver and I already send them
as a standalone PR and can read it from: 

https://patchwork.kernel.org/project/qemu-devel/patch/20230220081252.25348-3-qianfanguijin@163.com/

Hope that patch can merged first before this.

The next patches will add allwinner R40 device support, including ccu, mmc, i2c,
axp221 pmic, sdram controller, emac and gmac. Now the mainline u-boot and
kernel can work fine (It doesn't support booting allwinner bsp code and there
are no plans to support it now).

qianfan Zhao (12):
  hw: allwinner-i2c: Make the trace message more readable
  hw: allwinner-i2c: Fix TWI_CNTR_INT_FLAG on SUN6i SoCs
  hw: arm: allwinner-h3: Fix and complete H3 i2c devices
  hw: arm: Add bananapi M2-Ultra and allwinner-r40 support
  hw/arm/allwinner-r40: add Clock Control Unit
  hw: allwinner-r40: Complete uart devices
  hw: arm: allwinner-r40: Add 5 TWI controllers
  hw/misc: AXP221 PMU Emulation
  hw/arm/allwinner-r40: add SDRAM controller device
  hw: sd: allwinner-sdhost: Add sun50i-a64 SoC support
  hw: arm: allwinner-r40: Fix the mmc controller's type
  hw: arm: allwinner-r40: Add emac and gmac support

 configs/devices/arm-softmmu/default.mak |   1 +
 hw/arm/Kconfig                          |  10 +
 hw/arm/allwinner-h3.c                   |  29 +-
 hw/arm/allwinner-r40.c                  | 555 ++++++++++++++++++++++++
 hw/arm/bananapi_m2u.c                   | 128 ++++++
 hw/arm/meson.build                      |   1 +
 hw/i2c/allwinner-i2c.c                  | 136 +++++-
 hw/i2c/trace-events                     |   5 +-
 hw/misc/Kconfig                         |   4 +
 hw/misc/allwinner-r40-ccu.c             | 207 +++++++++
 hw/misc/allwinner-r40-dramc.c           | 499 +++++++++++++++++++++
 hw/misc/axp221.c                        | 196 +++++++++
 hw/misc/meson.build                     |   3 +
 hw/misc/trace-events                    |  19 +
 hw/sd/allwinner-sdhost.c                |  70 ++-
 include/hw/arm/allwinner-h3.h           |   6 +
 include/hw/arm/allwinner-r40.h          | 148 +++++++
 include/hw/i2c/allwinner-i2c.h          |   6 +
 include/hw/misc/allwinner-r40-ccu.h     |  65 +++
 include/hw/misc/allwinner-r40-dramc.h   | 108 +++++
 include/hw/sd/allwinner-sdhost.h        |   9 +
 21 files changed, 2191 insertions(+), 14 deletions(-)
 create mode 100644 hw/arm/allwinner-r40.c
 create mode 100644 hw/arm/bananapi_m2u.c
 create mode 100644 hw/misc/allwinner-r40-ccu.c
 create mode 100644 hw/misc/allwinner-r40-dramc.c
 create mode 100644 hw/misc/axp221.c
 create mode 100644 include/hw/arm/allwinner-r40.h
 create mode 100644 include/hw/misc/allwinner-r40-ccu.h
 create mode 100644 include/hw/misc/allwinner-r40-dramc.h

-- 
2.25.1
Re: [RFC PATCH v1 00/12] *** Add allwinner R40 device support ***
Posted by Niek Linnenbank 1 year, 1 month ago
Hello Qianfan Zhao,

Thanks for contributing this work to Qemu! With your contribution, we would
get yet another Allwinner SoC supported, making it three in total
(A10/H3/R40). That's great.
My thoughts are that maybe we should try to re-use commonality between
these SoCs where we can. Ofcourse, that may be difficult as the
internals/peripherals of these SoCs often really are different.

Your patches look good already, and I saw patches 02 and 03 are already
merged too. I did a quick regression test with
avocado for cubieboard/orangepi-pc with your patches applied and that went
OK:

$ ARMBIAN_ARTIFACTS_CACHED=yes AVOCADO_ALLOW_LARGE_STORAGE=yes
./build/tests/venv/bin/avocado --show=app,console run -t
machine:orangepi-pc -t machine:cubieboard
tests/avocado/boot_linux_console.py
...
PASS (22.09 s)
RESULTS    : PASS 8 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 |
CANCEL 0
JOB TIME   : 169.73 s

For now, I have only two suggestions for you to consider:
1) You could add a new acceptance test for the new bananapi board to
./tests/avocado/boot_linux_console.py.
This helps in your current work to (re)test your code quickly, and after
the code is merged it helps to keep to board working when other changes are
done.
2) If time permits, it may be interesting to document your board for
example in a new file at ./docs/system/arm/bananapi.rst
   If you do this, it will make the board a lot more valuable for other
people to use, since you can add some basic instructions on how to use the
board with qemu there.
   Additionally, it also helps yourself to store this information
somewhere, since it can be easy to forget all the specific
commands/flags/arguments and links to board specific images.

Once you have progressed with your patches beyond the RFC stage, I'll try
to find some time for a more detailed review of your patches.

Kind regards,
Niek Linnenbank

On Thu, Mar 2, 2023 at 12:41 PM <qianfanguijin@163.com> wrote:

> From: qianfan Zhao <qianfanguijin@163.com>
>
> v1: 2023-03-02
>
> The first three patches try fix allwinner i2c driver and I already send
> them
> as a standalone PR and can read it from:
>
>
> https://patchwork.kernel.org/project/qemu-devel/patch/20230220081252.25348-3-qianfanguijin@163.com/
>
> Hope that patch can merged first before this.
>
> The next patches will add allwinner R40 device support, including ccu,
> mmc, i2c,
> axp221 pmic, sdram controller, emac and gmac. Now the mainline u-boot and
> kernel can work fine (It doesn't support booting allwinner bsp code and
> there
> are no plans to support it now).
>
> qianfan Zhao (12):
>   hw: allwinner-i2c: Make the trace message more readable
>   hw: allwinner-i2c: Fix TWI_CNTR_INT_FLAG on SUN6i SoCs
>   hw: arm: allwinner-h3: Fix and complete H3 i2c devices
>   hw: arm: Add bananapi M2-Ultra and allwinner-r40 support
>   hw/arm/allwinner-r40: add Clock Control Unit
>   hw: allwinner-r40: Complete uart devices
>   hw: arm: allwinner-r40: Add 5 TWI controllers
>   hw/misc: AXP221 PMU Emulation
>   hw/arm/allwinner-r40: add SDRAM controller device
>   hw: sd: allwinner-sdhost: Add sun50i-a64 SoC support
>   hw: arm: allwinner-r40: Fix the mmc controller's type
>   hw: arm: allwinner-r40: Add emac and gmac support
>
>  configs/devices/arm-softmmu/default.mak |   1 +
>  hw/arm/Kconfig                          |  10 +
>  hw/arm/allwinner-h3.c                   |  29 +-
>  hw/arm/allwinner-r40.c                  | 555 ++++++++++++++++++++++++
>  hw/arm/bananapi_m2u.c                   | 128 ++++++
>  hw/arm/meson.build                      |   1 +
>  hw/i2c/allwinner-i2c.c                  | 136 +++++-
>  hw/i2c/trace-events                     |   5 +-
>  hw/misc/Kconfig                         |   4 +
>  hw/misc/allwinner-r40-ccu.c             | 207 +++++++++
>  hw/misc/allwinner-r40-dramc.c           | 499 +++++++++++++++++++++
>  hw/misc/axp221.c                        | 196 +++++++++
>  hw/misc/meson.build                     |   3 +
>  hw/misc/trace-events                    |  19 +
>  hw/sd/allwinner-sdhost.c                |  70 ++-
>  include/hw/arm/allwinner-h3.h           |   6 +
>  include/hw/arm/allwinner-r40.h          | 148 +++++++
>  include/hw/i2c/allwinner-i2c.h          |   6 +
>  include/hw/misc/allwinner-r40-ccu.h     |  65 +++
>  include/hw/misc/allwinner-r40-dramc.h   | 108 +++++
>  include/hw/sd/allwinner-sdhost.h        |   9 +
>  21 files changed, 2191 insertions(+), 14 deletions(-)
>  create mode 100644 hw/arm/allwinner-r40.c
>  create mode 100644 hw/arm/bananapi_m2u.c
>  create mode 100644 hw/misc/allwinner-r40-ccu.c
>  create mode 100644 hw/misc/allwinner-r40-dramc.c
>  create mode 100644 hw/misc/axp221.c
>  create mode 100644 include/hw/arm/allwinner-r40.h
>  create mode 100644 include/hw/misc/allwinner-r40-ccu.h
>  create mode 100644 include/hw/misc/allwinner-r40-dramc.h
>
> --
> 2.25.1
>
>

-- 
Niek Linnenbank
Re: [RFC PATCH v1 00/12] *** Add allwinner R40 device support ***
Posted by qianfan 1 year, 1 month ago

在 2023/3/9 4:47, Niek Linnenbank 写道:
> Hello Qianfan Zhao,
>
> Thanks for contributing this work to Qemu! With your contribution, we 
> would get yet another Allwinner SoC supported, making it three in 
> total (A10/H3/R40). That's great.
> My thoughts are that maybe we should try to re-use commonality between 
> these SoCs where we can. Ofcourse, that may be difficult as the 
> internals/peripherals of these SoCs often really are different.
>
> Your patches look good already, and I saw patches 02 and 03 are 
> already merged too. I did a quick regression test with
> avocado for cubieboard/orangepi-pc with your patches applied and that 
> went OK:
>
> $ ARMBIAN_ARTIFACTS_CACHED=yes AVOCADO_ALLOW_LARGE_STORAGE=yes 
> ./build/tests/venv/bin/avocado --show=app,console run -t 
> machine:orangepi-pc -t machine:cubieboard 
> tests/avocado/boot_linux_console.py
> ...
> PASS (22.09 s)
> RESULTS    : PASS 8 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 
> | CANCEL 0
> JOB TIME   : 169.73 s
>
> For now, I have only two suggestions for you to consider:
> 1) You could add a new acceptance test for the new bananapi board to 
> ./tests/avocado/boot_linux_console.py.
> This helps in your current work to (re)test your code quickly, and 
> after the code is merged it helps to keep to board working when other 
> changes are done.
> 2) If time permits, it may be interesting to document your board for 
> example in a new file at ./docs/system/arm/bananapi.rst
>    If you do this, it will make the board a lot more valuable for 
> other people to use, since you can add some basic instructions on how 
> to use the board with qemu there.
>    Additionally, it also helps yourself to store this information 
> somewhere, since it can be easy to forget all the specific 
> commands/flags/arguments and links to board specific images.
>
> Once you have progressed with your patches beyond the RFC stage, I'll 
> try to find some time for a more detailed review of your patches.
Hi:

Thanks for yours guide. avocado test case and documents will be 
introduced later.

My work are stucked when I am writting avocado test case due to the 
armbian image with
linux 6.1 can't boot, the kernel paniced when loading hdmi driver:

[    0.925906] sun8i-dw-hdmi 1ee0000.hdmi: supply hvcc not found, using 
dummy regulator
Invalid read at addr 0x1EF002C, size 4, region '(null)', reason: rejected
[    0.927444] 8<--- cut here ---
[    0.927780] Unhandled fault: external abort on non-linefetch (0x008) 
at 0xe091002c
[    0.928250] [e091002c] *pgd=4100a811, *pte=01ef0653, *ppte=01ef0453
[    0.929441] Internal error: : 8 [#1] SMP ARM
[    0.929925] Modules linked in:
[    0.930332] CPU: 3 PID: 52 Comm: kworker/u8:2 Not tainted 
6.3.0-rc3-ge8d018dd0257 #217
[    0.931082] Hardware name: Allwinner sun8i Family
[    0.931630] Workqueue: events_unbound deferred_probe_work_func
[    0.932443] PC is at regmap_mmio_read32le+0x8/0x14
[    0.932888] LR is at regmap_mmio_read+0x38/0x54

All my work are based on linux 5.15 in the previous days, I will take 
many times to solve this.

>
> Kind regards,
> Niek Linnenbank
>
> On Thu, Mar 2, 2023 at 12:41 PM <qianfanguijin@163.com> wrote:
>
>     From: qianfan Zhao <qianfanguijin@163.com>
>
>     v1: 2023-03-02
>
>     The first three patches try fix allwinner i2c driver and I already
>     send them
>     as a standalone PR and can read it from:
>
>     https://patchwork.kernel.org/project/qemu-devel/patch/20230220081252.25348-3-qianfanguijin@163.com/
>
>     Hope that patch can merged first before this.
>
>     The next patches will add allwinner R40 device support, including
>     ccu, mmc, i2c,
>     axp221 pmic, sdram controller, emac and gmac. Now the mainline
>     u-boot and
>     kernel can work fine (It doesn't support booting allwinner bsp
>     code and there
>     are no plans to support it now).
>
>     qianfan Zhao (12):
>       hw: allwinner-i2c: Make the trace message more readable
>       hw: allwinner-i2c: Fix TWI_CNTR_INT_FLAG on SUN6i SoCs
>       hw: arm: allwinner-h3: Fix and complete H3 i2c devices
>       hw: arm: Add bananapi M2-Ultra and allwinner-r40 support
>       hw/arm/allwinner-r40: add Clock Control Unit
>       hw: allwinner-r40: Complete uart devices
>       hw: arm: allwinner-r40: Add 5 TWI controllers
>       hw/misc: AXP221 PMU Emulation
>       hw/arm/allwinner-r40: add SDRAM controller device
>       hw: sd: allwinner-sdhost: Add sun50i-a64 SoC support
>       hw: arm: allwinner-r40: Fix the mmc controller's type
>       hw: arm: allwinner-r40: Add emac and gmac support
>
>      configs/devices/arm-softmmu/default.mak |   1 +
>      hw/arm/Kconfig                          |  10 +
>      hw/arm/allwinner-h3.c                   |  29 +-
>      hw/arm/allwinner-r40.c                  | 555
>     ++++++++++++++++++++++++
>      hw/arm/bananapi_m2u.c                   | 128 ++++++
>      hw/arm/meson.build                      |   1 +
>      hw/i2c/allwinner-i2c.c                  | 136 +++++-
>      hw/i2c/trace-events                     |   5 +-
>      hw/misc/Kconfig                         |   4 +
>      hw/misc/allwinner-r40-ccu.c             | 207 +++++++++
>      hw/misc/allwinner-r40-dramc.c           | 499 +++++++++++++++++++++
>      hw/misc/axp221.c                        | 196 +++++++++
>      hw/misc/meson.build                     |   3 +
>      hw/misc/trace-events                    |  19 +
>      hw/sd/allwinner-sdhost.c                |  70 ++-
>      include/hw/arm/allwinner-h3.h           |   6 +
>      include/hw/arm/allwinner-r40.h          | 148 +++++++
>      include/hw/i2c/allwinner-i2c.h          |   6 +
>      include/hw/misc/allwinner-r40-ccu.h     |  65 +++
>      include/hw/misc/allwinner-r40-dramc.h   | 108 +++++
>      include/hw/sd/allwinner-sdhost.h        |   9 +
>      21 files changed, 2191 insertions(+), 14 deletions(-)
>      create mode 100644 hw/arm/allwinner-r40.c
>      create mode 100644 hw/arm/bananapi_m2u.c
>      create mode 100644 hw/misc/allwinner-r40-ccu.c
>      create mode 100644 hw/misc/allwinner-r40-dramc.c
>      create mode 100644 hw/misc/axp221.c
>      create mode 100644 include/hw/arm/allwinner-r40.h
>      create mode 100644 include/hw/misc/allwinner-r40-ccu.h
>      create mode 100644 include/hw/misc/allwinner-r40-dramc.h
>
>     -- 
>     2.25.1
>
>
>
> -- 
> Niek Linnenbank
>


Re: [RFC PATCH v1 00/12] *** Add allwinner R40 device support ***
Posted by Strahinja Jankovic 1 year, 1 month ago
Hi,

Could you try maybe running OpenWRT instead of Armbian?

Link to the stable image for M2 Ultra is is
https://downloads.openwrt.org/releases/22.03.3/targets/sunxi/cortexa7/openwrt-22.03.3-sunxi-cortexa7-sinovoip_bananapi-m2-ultra-ext4-sdcard.img.gz

Best reregards ,
Strahinja



On Mon, Mar 20, 2023, 9:52 AM qianfan <qianfanguijin@163.com> wrote:

>
>
> 在 2023/3/9 4:47, Niek Linnenbank 写道:
> > Hello Qianfan Zhao,
> >
> > Thanks for contributing this work to Qemu! With your contribution, we
> > would get yet another Allwinner SoC supported, making it three in
> > total (A10/H3/R40). That's great.
> > My thoughts are that maybe we should try to re-use commonality between
> > these SoCs where we can. Ofcourse, that may be difficult as the
> > internals/peripherals of these SoCs often really are different.
> >
> > Your patches look good already, and I saw patches 02 and 03 are
> > already merged too. I did a quick regression test with
> > avocado for cubieboard/orangepi-pc with your patches applied and that
> > went OK:
> >
> > $ ARMBIAN_ARTIFACTS_CACHED=yes AVOCADO_ALLOW_LARGE_STORAGE=yes
> > ./build/tests/venv/bin/avocado --show=app,console run -t
> > machine:orangepi-pc -t machine:cubieboard
> > tests/avocado/boot_linux_console.py
> > ...
> > PASS (22.09 s)
> > RESULTS    : PASS 8 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0
> > | CANCEL 0
> > JOB TIME   : 169.73 s
> >
> > For now, I have only two suggestions for you to consider:
> > 1) You could add a new acceptance test for the new bananapi board to
> > ./tests/avocado/boot_linux_console.py.
> > This helps in your current work to (re)test your code quickly, and
> > after the code is merged it helps to keep to board working when other
> > changes are done.
> > 2) If time permits, it may be interesting to document your board for
> > example in a new file at ./docs/system/arm/bananapi.rst
> >    If you do this, it will make the board a lot more valuable for
> > other people to use, since you can add some basic instructions on how
> > to use the board with qemu there.
> >    Additionally, it also helps yourself to store this information
> > somewhere, since it can be easy to forget all the specific
> > commands/flags/arguments and links to board specific images.
> >
> > Once you have progressed with your patches beyond the RFC stage, I'll
> > try to find some time for a more detailed review of your patches.
> Hi:
>
> Thanks for yours guide. avocado test case and documents will be
> introduced later.
>
> My work are stucked when I am writting avocado test case due to the
> armbian image with
> linux 6.1 can't boot, the kernel paniced when loading hdmi driver:
>
> [    0.925906] sun8i-dw-hdmi 1ee0000.hdmi: supply hvcc not found, using
> dummy regulator
> Invalid read at addr 0x1EF002C, size 4, region '(null)', reason: rejected
> [    0.927444] 8<--- cut here ---
> [    0.927780] Unhandled fault: external abort on non-linefetch (0x008)
> at 0xe091002c
> [    0.928250] [e091002c] *pgd=4100a811, *pte=01ef0653, *ppte=01ef0453
> [    0.929441] Internal error: : 8 [#1] SMP ARM
> [    0.929925] Modules linked in:
> [    0.930332] CPU: 3 PID: 52 Comm: kworker/u8:2 Not tainted
> 6.3.0-rc3-ge8d018dd0257 #217
> [    0.931082] Hardware name: Allwinner sun8i Family
> [    0.931630] Workqueue: events_unbound deferred_probe_work_func
> [    0.932443] PC is at regmap_mmio_read32le+0x8/0x14
> [    0.932888] LR is at regmap_mmio_read+0x38/0x54
>
> All my work are based on linux 5.15 in the previous days, I will take
> many times to solve this.
>
> >
> > Kind regards,
> > Niek Linnenbank
> >
> > On Thu, Mar 2, 2023 at 12:41 PM <qianfanguijin@163.com> wrote:
> >
> >     From: qianfan Zhao <qianfanguijin@163.com>
> >
> >     v1: 2023-03-02
> >
> >     The first three patches try fix allwinner i2c driver and I already
> >     send them
> >     as a standalone PR and can read it from:
> >
> >
> https://patchwork.kernel.org/project/qemu-devel/patch/20230220081252.25348-3-qianfanguijin@163.com/
> >
> >     Hope that patch can merged first before this.
> >
> >     The next patches will add allwinner R40 device support, including
> >     ccu, mmc, i2c,
> >     axp221 pmic, sdram controller, emac and gmac. Now the mainline
> >     u-boot and
> >     kernel can work fine (It doesn't support booting allwinner bsp
> >     code and there
> >     are no plans to support it now).
> >
> >     qianfan Zhao (12):
> >       hw: allwinner-i2c: Make the trace message more readable
> >       hw: allwinner-i2c: Fix TWI_CNTR_INT_FLAG on SUN6i SoCs
> >       hw: arm: allwinner-h3: Fix and complete H3 i2c devices
> >       hw: arm: Add bananapi M2-Ultra and allwinner-r40 support
> >       hw/arm/allwinner-r40: add Clock Control Unit
> >       hw: allwinner-r40: Complete uart devices
> >       hw: arm: allwinner-r40: Add 5 TWI controllers
> >       hw/misc: AXP221 PMU Emulation
> >       hw/arm/allwinner-r40: add SDRAM controller device
> >       hw: sd: allwinner-sdhost: Add sun50i-a64 SoC support
> >       hw: arm: allwinner-r40: Fix the mmc controller's type
> >       hw: arm: allwinner-r40: Add emac and gmac support
> >
> >      configs/devices/arm-softmmu/default.mak |   1 +
> >      hw/arm/Kconfig                          |  10 +
> >      hw/arm/allwinner-h3.c                   |  29 +-
> >      hw/arm/allwinner-r40.c                  | 555
> >     ++++++++++++++++++++++++
> >      hw/arm/bananapi_m2u.c                   | 128 ++++++
> >      hw/arm/meson.build                      |   1 +
> >      hw/i2c/allwinner-i2c.c                  | 136 +++++-
> >      hw/i2c/trace-events                     |   5 +-
> >      hw/misc/Kconfig                         |   4 +
> >      hw/misc/allwinner-r40-ccu.c             | 207 +++++++++
> >      hw/misc/allwinner-r40-dramc.c           | 499 +++++++++++++++++++++
> >      hw/misc/axp221.c                        | 196 +++++++++
> >      hw/misc/meson.build                     |   3 +
> >      hw/misc/trace-events                    |  19 +
> >      hw/sd/allwinner-sdhost.c                |  70 ++-
> >      include/hw/arm/allwinner-h3.h           |   6 +
> >      include/hw/arm/allwinner-r40.h          | 148 +++++++
> >      include/hw/i2c/allwinner-i2c.h          |   6 +
> >      include/hw/misc/allwinner-r40-ccu.h     |  65 +++
> >      include/hw/misc/allwinner-r40-dramc.h   | 108 +++++
> >      include/hw/sd/allwinner-sdhost.h        |   9 +
> >      21 files changed, 2191 insertions(+), 14 deletions(-)
> >      create mode 100644 hw/arm/allwinner-r40.c
> >      create mode 100644 hw/arm/bananapi_m2u.c
> >      create mode 100644 hw/misc/allwinner-r40-ccu.c
> >      create mode 100644 hw/misc/allwinner-r40-dramc.c
> >      create mode 100644 hw/misc/axp221.c
> >      create mode 100644 include/hw/arm/allwinner-r40.h
> >      create mode 100644 include/hw/misc/allwinner-r40-ccu.h
> >      create mode 100644 include/hw/misc/allwinner-r40-dramc.h
> >
> >     --
> >     2.25.1
> >
> >
> >
> > --
> > Niek Linnenbank
> >
>
>
Re: [RFC PATCH v1 00/12] *** Add allwinner R40 device support ***
Posted by qianfan 1 year, 1 month ago

在 2023/3/20 17:50, Strahinja Jankovic 写道:
> Hi,
>
> Could you try maybe running OpenWRT instead of Armbian?
>
> Link to the stable image for M2 Ultra is is 
> https://downloads.openwrt.org/releases/22.03.3/targets/sunxi/cortexa7/openwrt-22.03.3-sunxi-cortexa7-sinovoip_bananapi-m2-ultra-ext4-sdcard.img.gz
Thanks, I will try both armbian and openwrt.

And the armbian can work now, due to the newer user manual of allwinner 
R40 removed the HDMI section
and it's registers. Register hdmi registers as unimplemented device can 
resolve this problem.

The build system of armbian and openwrt is very interesting but I don't 
have any experience with them.
My custom image was build with buildroot. I very take somedays to learn 
how it works.

There are so much things to learn.
>
> Best reregards ,
> Strahinja
>
>
>
> On Mon, Mar 20, 2023, 9:52 AM qianfan <qianfanguijin@163.com> wrote:
>
>
>
>     在 2023/3/9 4:47, Niek Linnenbank 写道:
>     > Hello Qianfan Zhao,
>     >
>     > Thanks for contributing this work to Qemu! With your
>     contribution, we
>     > would get yet another Allwinner SoC supported, making it three in
>     > total (A10/H3/R40). That's great.
>     > My thoughts are that maybe we should try to re-use commonality
>     between
>     > these SoCs where we can. Ofcourse, that may be difficult as the
>     > internals/peripherals of these SoCs often really are different.
>     >
>     > Your patches look good already, and I saw patches 02 and 03 are
>     > already merged too. I did a quick regression test with
>     > avocado for cubieboard/orangepi-pc with your patches applied and
>     that
>     > went OK:
>     >
>     > $ ARMBIAN_ARTIFACTS_CACHED=yes AVOCADO_ALLOW_LARGE_STORAGE=yes
>     > ./build/tests/venv/bin/avocado --show=app,console run -t
>     > machine:orangepi-pc -t machine:cubieboard
>     > tests/avocado/boot_linux_console.py
>     > ...
>     > PASS (22.09 s)
>     > RESULTS    : PASS 8 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 |
>     INTERRUPT 0
>     > | CANCEL 0
>     > JOB TIME   : 169.73 s
>     >
>     > For now, I have only two suggestions for you to consider:
>     > 1) You could add a new acceptance test for the new bananapi
>     board to
>     > ./tests/avocado/boot_linux_console.py.
>     > This helps in your current work to (re)test your code quickly, and
>     > after the code is merged it helps to keep to board working when
>     other
>     > changes are done.
>     > 2) If time permits, it may be interesting to document your board
>     for
>     > example in a new file at ./docs/system/arm/bananapi.rst
>     >    If you do this, it will make the board a lot more valuable for
>     > other people to use, since you can add some basic instructions
>     on how
>     > to use the board with qemu there.
>     >    Additionally, it also helps yourself to store this information
>     > somewhere, since it can be easy to forget all the specific
>     > commands/flags/arguments and links to board specific images.
>     >
>     > Once you have progressed with your patches beyond the RFC stage,
>     I'll
>     > try to find some time for a more detailed review of your patches.
>     Hi:
>
>     Thanks for yours guide. avocado test case and documents will be
>     introduced later.
>
>     My work are stucked when I am writting avocado test case due to the
>     armbian image with
>     linux 6.1 can't boot, the kernel paniced when loading hdmi driver:
>
>     [    0.925906] sun8i-dw-hdmi 1ee0000.hdmi: supply hvcc not found,
>     using
>     dummy regulator
>     Invalid read at addr 0x1EF002C, size 4, region '(null)', reason:
>     rejected
>     [    0.927444] 8<--- cut here ---
>     [    0.927780] Unhandled fault: external abort on non-linefetch
>     (0x008)
>     at 0xe091002c
>     [    0.928250] [e091002c] *pgd=4100a811, *pte=01ef0653, *ppte=01ef0453
>     [    0.929441] Internal error: : 8 [#1] SMP ARM
>     [    0.929925] Modules linked in:
>     [    0.930332] CPU: 3 PID: 52 Comm: kworker/u8:2 Not tainted
>     6.3.0-rc3-ge8d018dd0257 #217
>     [    0.931082] Hardware name: Allwinner sun8i Family
>     [    0.931630] Workqueue: events_unbound deferred_probe_work_func
>     [    0.932443] PC is at regmap_mmio_read32le+0x8/0x14
>     [    0.932888] LR is at regmap_mmio_read+0x38/0x54
>
>     All my work are based on linux 5.15 in the previous days, I will take
>     many times to solve this.
>
>     >
>     > Kind regards,
>     > Niek Linnenbank
>     >
>     > On Thu, Mar 2, 2023 at 12:41 PM <qianfanguijin@163.com> wrote:
>     >
>     >     From: qianfan Zhao <qianfanguijin@163.com>
>     >
>     >     v1: 2023-03-02
>     >
>     >     The first three patches try fix allwinner i2c driver and I
>     already
>     >     send them
>     >     as a standalone PR and can read it from:
>     >
>     >
>     https://patchwork.kernel.org/project/qemu-devel/patch/20230220081252.25348-3-qianfanguijin@163.com/
>     >
>     >     Hope that patch can merged first before this.
>     >
>     >     The next patches will add allwinner R40 device support,
>     including
>     >     ccu, mmc, i2c,
>     >     axp221 pmic, sdram controller, emac and gmac. Now the mainline
>     >     u-boot and
>     >     kernel can work fine (It doesn't support booting allwinner bsp
>     >     code and there
>     >     are no plans to support it now).
>     >
>     >     qianfan Zhao (12):
>     >       hw: allwinner-i2c: Make the trace message more readable
>     >       hw: allwinner-i2c: Fix TWI_CNTR_INT_FLAG on SUN6i SoCs
>     >       hw: arm: allwinner-h3: Fix and complete H3 i2c devices
>     >       hw: arm: Add bananapi M2-Ultra and allwinner-r40 support
>     >       hw/arm/allwinner-r40: add Clock Control Unit
>     >       hw: allwinner-r40: Complete uart devices
>     >       hw: arm: allwinner-r40: Add 5 TWI controllers
>     >       hw/misc: AXP221 PMU Emulation
>     >       hw/arm/allwinner-r40: add SDRAM controller device
>     >       hw: sd: allwinner-sdhost: Add sun50i-a64 SoC support
>     >       hw: arm: allwinner-r40: Fix the mmc controller's type
>     >       hw: arm: allwinner-r40: Add emac and gmac support
>     >
>     >      configs/devices/arm-softmmu/default.mak |   1 +
>     >      hw/arm/Kconfig                          |  10 +
>     >      hw/arm/allwinner-h3.c                   |  29 +-
>     >      hw/arm/allwinner-r40.c                  | 555
>     >     ++++++++++++++++++++++++
>     >      hw/arm/bananapi_m2u.c                   | 128 ++++++
>     >      hw/arm/meson.build                      |   1 +
>     >      hw/i2c/allwinner-i2c.c                  | 136 +++++-
>     >      hw/i2c/trace-events                     |   5 +-
>     >      hw/misc/Kconfig                         |   4 +
>     >      hw/misc/allwinner-r40-ccu.c             | 207 +++++++++
>     >      hw/misc/allwinner-r40-dramc.c           | 499
>     +++++++++++++++++++++
>     >      hw/misc/axp221.c                        | 196 +++++++++
>     >      hw/misc/meson.build                     |   3 +
>     >      hw/misc/trace-events                    |  19 +
>     >      hw/sd/allwinner-sdhost.c                |  70 ++-
>     >      include/hw/arm/allwinner-h3.h           |   6 +
>     >      include/hw/arm/allwinner-r40.h          | 148 +++++++
>     >      include/hw/i2c/allwinner-i2c.h          |   6 +
>     >      include/hw/misc/allwinner-r40-ccu.h     |  65 +++
>     >      include/hw/misc/allwinner-r40-dramc.h   | 108 +++++
>     >      include/hw/sd/allwinner-sdhost.h        |   9 +
>     >      21 files changed, 2191 insertions(+), 14 deletions(-)
>     >      create mode 100644 hw/arm/allwinner-r40.c
>     >      create mode 100644 hw/arm/bananapi_m2u.c
>     >      create mode 100644 hw/misc/allwinner-r40-ccu.c
>     >      create mode 100644 hw/misc/allwinner-r40-dramc.c
>     >      create mode 100644 hw/misc/axp221.c
>     >      create mode 100644 include/hw/arm/allwinner-r40.h
>     >      create mode 100644 include/hw/misc/allwinner-r40-ccu.h
>     >      create mode 100644 include/hw/misc/allwinner-r40-dramc.h
>     >
>     >     --
>     >     2.25.1
>     >
>     >
>     >
>     > --
>     > Niek Linnenbank
>     >
>


Re: [RFC PATCH v1 00/12] *** Add allwinner R40 device support ***
Posted by Peter Maydell 1 year, 1 month ago
On Wed, 8 Mar 2023 at 20:47, Niek Linnenbank <nieklinnenbank@gmail.com> wrote:
> Thanks for contributing this work to Qemu! With your contribution, we would get yet another Allwinner SoC supported, making it three in total (A10/H3/R40). That's great.
> My thoughts are that maybe we should try to re-use commonality between these SoCs where we can. Ofcourse, that may be difficult as the internals/peripherals of these SoCs often really are different.

Thanks for having had a look at this patchset, Niek -- it
has saved me a job :-)

> Your patches look good already, and I saw patches 02 and 03 are already merged too. I did a quick regression test with
> avocado for cubieboard/orangepi-pc with your patches applied and that went OK:
>
> $ ARMBIAN_ARTIFACTS_CACHED=yes AVOCADO_ALLOW_LARGE_STORAGE=yes ./build/tests/venv/bin/avocado --show=app,console run -t machine:orangepi-pc -t machine:cubieboard tests/avocado/boot_linux_console.py
> ...
> PASS (22.09 s)
> RESULTS    : PASS 8 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
> JOB TIME   : 169.73 s
>
> For now, I have only two suggestions for you to consider:
> 1) You could add a new acceptance test for the new bananapi board to ./tests/avocado/boot_linux_console.py.
> This helps in your current work to (re)test your code quickly, and after the code is merged it helps to keep to board working when other changes are done.
> 2) If time permits, it may be interesting to document your board for example in a new file at ./docs/system/arm/bananapi.rst
>    If you do this, it will make the board a lot more valuable for other people to use, since you can add some basic instructions on how to use the board with qemu there.
>    Additionally, it also helps yourself to store this information somewhere, since it can be easy to forget all the specific commands/flags/arguments and links to board specific images.

I think I would raise this to "definitely provide board documentation".
All our board models should have at least a basic documentation
page that says what the board model is, lists what QEMU does or
doesn't implement, and describes any QEMU-specific oddities.

thanks
-- PMM
Re: [RFC PATCH v1 00/12] *** Add allwinner R40 device support ***
Posted by Peter Maydell 1 year, 1 month ago
On Thu, 2 Mar 2023 at 11:41, <qianfanguijin@163.com> wrote:
>
> From: qianfan Zhao <qianfanguijin@163.com>
>
> v1: 2023-03-02
>
> The first three patches try fix allwinner i2c driver and I already send them
> as a standalone PR and can read it from:
>
> https://patchwork.kernel.org/project/qemu-devel/patch/20230220081252.25348-3-qianfanguijin@163.com/
>
> Hope that patch can merged first before this.

Ah, I missed that patch, probably because you sent it without
a cover letter (all multi-patch series should have a cover letter).
I'll go and look at it now.

thanks
-- PMM