From: Niek Linnenbank <nieklinnenbank@gmail.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Peter Maydell <peter.maydell@linaro.org>,
QEMU Developers <qemu-devel@nongnu.org>,
Wainer dos Santos Moschetta <wainersm@redhat.com>,
Beniamino Galvani <b.galvani@gmail.com>,
qemu-arm <qemu-arm@nongnu.org>,
Willian Rampazzo <wrampazz@redhat.com>,
Cleber Rosa <crosa@redhat.com>
Subject: Re: [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob
Date: Mon, 30 Dec 2019 12:33:59 +0100 [thread overview]
Message-ID: <CAPan3WrBN77rcczzQ1knMEKCaCUSCb6RtdhSMiDWE9Ah7jvgjg@mail.gmail.com> (raw)
In-Reply-To: <20191230110953.25496-7-f4bug@amsat.org>
[-- Attachment #1: Type: text/plain, Size: 6340 bytes --]
Hello Philippe,
I have a suggestion: probably you can apply (almost) the same patch to get
USB
working for A10 as I did in the Allwinner H3, in patch #4 "add USB host
controller" [1]
That way you can avoid the DTB modifications and with low effort get USB
working as well for this board.
As far as I can see, in Section 21.1 in the A10 user manual [2] has the
same description
as for the H3. It basically has the standard EHCI and OHCI interfaces.
[1] https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg03266.html
[2] https://linux-sunxi.org/File:Allwinner_A10_User_manual_V1.5.pdf
Regards,
Niek
On Mon, Dec 30, 2019 at 12:10 PM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:
> We do not model the Sunxi Multipoint USB.
> The Linux kernel OOPS when booting:
>
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 144 at drivers/usb/musb/sunxi.c:400
> sunxi_musb_ep_offset+0x39/0x3c
> sunxi_musb_ep_offset called with non 0 offset
> Modules linked in:
> CPU: 0 PID: 144 Comm: kworker/0:2 Not tainted 4.20.7-sunxi #5.75
> Hardware name: Allwinner sun4i/sun5i Families
> Workqueue: events deferred_probe_work_func
> [<c010d77d>] (unwind_backtrace) from [<c010a425>] (show_stack+0x11/0x14)
> [<c010a425>] (show_stack) from [<c08d9141>] (dump_stack+0x69/0x78)
> [<c08d9141>] (dump_stack) from [<c011b161>] (__warn+0xa1/0xb4)
> [<c011b161>] (__warn) from [<c011b1a7>] (warn_slowpath_fmt+0x33/0x48)
> [<c011b1a7>] (warn_slowpath_fmt) from [<c0725c81>]
> (sunxi_musb_ep_offset+0x39/0x3c)
> [<c0725c81>] (sunxi_musb_ep_offset) from [<c071b481>]
> (ep_config_from_hw+0x99/0x104)
> [<c071b481>] (ep_config_from_hw) from [<c071c8d9>]
> (musb_probe+0x765/0xa0c)
> [<c071c8d9>] (musb_probe) from [<c063fa4f>]
> (platform_drv_probe+0x33/0x68)
> [<c063fa4f>] (platform_drv_probe) from [<c063e4ef>]
> (really_probe+0x16f/0x1e0)
> [<c063e4ef>] (really_probe) from [<c063e67f>]
> (driver_probe_device+0x43/0x11c)
> [<c063e67f>] (driver_probe_device) from [<c063d0cf>]
> (bus_for_each_drv+0x37/0x70)
> [<c063d0cf>] (bus_for_each_drv) from [<c063e32f>]
> (__device_attach+0x83/0xc8)
> [<c063e32f>] (__device_attach) from [<c063da8b>]
> (bus_probe_device+0x5b/0x60)
> [<c063da8b>] (bus_probe_device) from [<c063b7a5>]
> (device_add+0x2f5/0x474)
> [<c063b7a5>] (device_add) from [<c063f8ef>]
> (platform_device_add+0xb7/0x184)
> [<c063f8ef>] (platform_device_add) from [<c06400df>]
> (platform_device_register_full+0xb3/0xc4)
> [<c06400df>] (platform_device_register_full) from [<c0725a2f>]
> (sunxi_musb_probe+0x1d7/0x2f4)
> [<c0725a2f>] (sunxi_musb_probe) from [<c063fa4f>]
> (platform_drv_probe+0x33/0x68)
> [<c063fa4f>] (platform_drv_probe) from [<c063e4ef>]
> (really_probe+0x16f/0x1e0)
> [<c063e4ef>] (really_probe) from [<c063e67f>]
> (driver_probe_device+0x43/0x11c)
> [<c063e67f>] (driver_probe_device) from [<c063d0cf>]
> (bus_for_each_drv+0x37/0x70)
> [<c063d0cf>] (bus_for_each_drv) from [<c063e32f>]
> (__device_attach+0x83/0xc8)
> [<c063e32f>] (__device_attach) from [<c063da8b>]
> (bus_probe_device+0x5b/0x60)
> [<c063da8b>] (bus_probe_device) from [<c063ddcf>]
> (deferred_probe_work_func+0x4b/0x6c)
> [<c063ddcf>] (deferred_probe_work_func) from [<c012e38b>]
> (process_one_work+0x167/0x384)
> [<c012e38b>] (process_one_work) from [<c012f07d>]
> (worker_thread+0x251/0x3fc)
> [<c012f07d>] (worker_thread) from [<c0132949>] (kthread+0xfd/0x104)
> [<c0132949>] (kthread) from [<c01010f9>] (ret_from_fork+0x11/0x38)
> Exception stack(0xc6999fb0 to 0xc6999ff8)
> 9fa0: 00000000 00000000 00000000
> 00000000
> 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> 00000000
> 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> ---[ end trace b309edbca98c7de2 ]---
> musb-sunxi 1c13000.usb: Error unknown readb offset 128
> musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -22
> musb-hdrc: probe of musb-hdrc.1.auto failed with error -22
>
> This is not critical but confusing. To avoid the Linux kernel to
> probe this device, mark it disabled in the device tree blob.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> I'm not sure if this is a QEMU anti-pattern or bad practice.
> I know we prefer to be as close to the hardware as possible,
> but here the hardware is not changed, the dtb is. However
> this makes the guest behave differently. At least we don't
> have to manually edit the dts. If this is only annoying for
> acceptance testing, we might consider manually editing the
> dts in the tests setup().
> ---
> hw/arm/cubieboard.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
> index 6dc2f1d6b6..dd10577696 100644
> --- a/hw/arm/cubieboard.c
> +++ b/hw/arm/cubieboard.c
> @@ -22,10 +22,34 @@
> #include "hw/sysbus.h"
> #include "hw/boards.h"
> #include "hw/arm/allwinner-a10.h"
> +#include <libfdt.h>
> +
> +static void cubieboard_modify_dtb(const struct arm_boot_info *info, void
> *fdt)
> +{
> + static const char unsupported_compat[] = "allwinner,sun4i-a10-musb";
> + char node_path[72];
> + int offset;
> +
> + offset = fdt_node_offset_by_compatible(fdt, -1, unsupported_compat);
> + while (offset >= 0) {
> + int r = fdt_get_path(fdt, offset, node_path, sizeof(node_path));
> + assert(r >= 0);
> + r = fdt_setprop_string(fdt, offset, "status", "disabled");
> + if (r < 0) {
> + error_report("%s: Couldn't disable %s: %s", __func__,
> + unsupported_compat, fdt_strerror(r));
> + exit(1);
> + }
> + warn_report("cubieboard: disabled unsupported node %s (%s) "
> + "in device tree", node_path, unsupported_compat);
> + offset = fdt_node_offset_by_compatible(fdt, offset,
> unsupported_compat);
> + }
> +}
>
> static struct arm_boot_info cubieboard_binfo = {
> .loader_start = AW_A10_SDRAM_BASE,
> .board_id = 0x1008,
> + .modify_dtb = cubieboard_modify_dtb,
> };
>
> typedef struct CubieBoardState {
> --
> 2.21.0
>
>
--
Niek Linnenbank
[-- Attachment #2: Type: text/html, Size: 7821 bytes --]
next prev parent reply other threads:[~2019-12-30 11:35 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-30 11:09 [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Philippe Mathieu-Daudé
2019-12-30 11:09 ` [PATCH 1/6] tests/boot_linux_console: Add initrd test for the CubieBoard Philippe Mathieu-Daudé
2019-12-30 20:52 ` Wainer dos Santos Moschetta
2019-12-31 11:41 ` Philippe Mathieu-Daudé
2020-01-03 13:31 ` Wainer dos Santos Moschetta
2019-12-30 11:09 ` [PATCH 2/6] tests/boot_linux_console: Add a SD card " Philippe Mathieu-Daudé
2019-12-30 11:09 ` [PATCH 3/6] hw/arm/allwinner-a10: Move SoC definitions out of header Philippe Mathieu-Daudé
2020-01-06 15:59 ` Peter Maydell
2019-12-30 11:09 ` [PATCH 4/6] hw/arm/allwinner-a10: Simplify by passing IRQs with qdev_pass_gpios() Philippe Mathieu-Daudé
2020-01-06 16:01 ` Peter Maydell
2019-12-30 11:09 ` [PATCH 5/6] hw/arm/allwinner-a10: Remove local qemu_irq variables Philippe Mathieu-Daudé
2020-01-06 16:01 ` Peter Maydell
2019-12-30 11:09 ` [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob Philippe Mathieu-Daudé
2019-12-30 11:33 ` Niek Linnenbank [this message]
2019-12-30 13:55 ` Philippe Mathieu-Daudé
2019-12-30 20:05 ` Niek Linnenbank
2020-01-06 16:07 ` Peter Maydell
2020-01-06 16:36 ` Philippe Mathieu-Daudé
2020-01-06 16:24 ` [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPan3WrBN77rcczzQ1knMEKCaCUSCb6RtdhSMiDWE9Ah7jvgjg@mail.gmail.com \
--to=nieklinnenbank@gmail.com \
--cc=b.galvani@gmail.com \
--cc=crosa@redhat.com \
--cc=f4bug@amsat.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@redhat.com \
--cc=wrampazz@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).