Bug 266657 - Clearfog pro boot hang
Summary: Clearfog pro boot hang
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm Any
: --- Affects Many People
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-27 13:23 UTC by Priit Trees
Modified: 2022-10-06 14:53 UTC (History)
1 user (show)

See Also:


Attachments
staller clearfrog pro dmesg (8.36 KB, text/plain)
2022-09-27 13:23 UTC, Priit Trees
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Priit Trees 2022-09-27 13:23:18 UTC
Created attachment 236875 [details]
staller clearfrog pro dmesg

After commit 'Import device-tree files from Linux 5.17' (https://github.com/freebsd/freebsd-src/commit/e67e85659c0de33e617e5fbf1028c6e8b49eee53), Clearfrog pro not boot up any more. Then I make rollback sys/contrib/device-tree/src/arm/armada-38x.dtsi file all start to works again. 

The stalled output is on file staller_clearfrog_pro.tst


diff --git a/sys/contrib/device-tree/src/arm/armada-38x.dtsi b/sys/contrib/device-tree/src/arm/armada-38x.dtsi
index df3c8d1d8f64..9b1a24cc5e91 100644
--- a/sys/contrib/device-tree/src/arm/armada-38x.dtsi
+++ b/sys/contrib/device-tree/src/arm/armada-38x.dtsi
@@ -168,7 +168,7 @@
                        };

                        uart0: serial@12000 {
-                               compatible = "marvell,armada-38x-uart", "ns16550a";
+                               compatible = "marvell,armada-38x-uart";
                                reg = <0x12000 0x100>;
                                reg-shift = <2>;
                                interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
@@ -178,7 +178,7 @@
                        };

                        uart1: serial@12100 {
-                               compatible = "marvell,armada-38x-uart", "ns16550a";
+                               compatible = "marvell,armada-38x-uart";
                                reg = <0x12100 0x100>;
                                reg-shift = <2>;
                                interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
Comment 1 Kornel Dulęba freebsd_committer freebsd_triage 2022-10-04 12:12:35 UTC
Hi,

I think I might know what is going on.
Please try the patch below and let me know if it works.

diff --git a/sys/dev/uart/uart_dev_snps.c b/sys/dev/uart/uart_dev_snps.c
index b29fc48e5422..040f0ea00f0e 100644
--- a/sys/dev/uart/uart_dev_snps.c
+++ b/sys/dev/uart/uart_dev_snps.c
@@ -216,7 +216,7 @@ snps_probe(device_t dev)
                device_printf(dev, "could not determine frequency\n");
 
        error = uart_bus_probe(dev, (int)shift, (int)iowidth, (int)clock, 0, 0, UART_F_BUSY_DETECT);
-       if (error != 0)
+       if (error > 0)
                return (error);
 
        /* XXX uart_bus_probe has changed the softc, so refresh it */
@@ -227,7 +227,7 @@ snps_probe(device_t dev)
        sc->apb_pclk = apb_pclk;
        sc->reset = reset;
 
-       return (0);
+       return (BUS_PROBE_VENDOR);
 }
 
 static int
Comment 2 Priit Trees 2022-10-04 21:36:30 UTC
Hi, 

Yes, The patch is worked. Thank you very much.
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-10-06 14:53:39 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6bdc398832a60f94a2d895f64b5546eec3af2da8

commit 6bdc398832a60f94a2d895f64b5546eec3af2da8
Author:     Kornel Dulęba <kd@FreeBSD.org>
AuthorDate: 2022-10-06 14:25:47 +0000
Commit:     Kornel Dulęba <kd@FreeBSD.org>
CommitDate: 2022-10-06 14:42:51 +0000

    uart_dev_snps: Fix device probing

    The "uart_bus_probe" function is used as a generic part of uart probe
    logic. It returns a driver priority(negative number) if successful and
    an error code otherwise.
    Fix the error checking condition to account for that.
    Also, while here return "BUS_PROBE_VENDOR", instead of "0".
    This fixes uart on clearfog pro with recent DT.

    PR:             266657
    Reviewed by:    mw
    Obtained from:  Semihalf
    Differential Revision: https://reviews.freebsd.org/D36880

 sys/dev/uart/uart_dev_snps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)