NetBSD Problem Report #58173

From www@netbsd.org  Fri Apr 19 01:32:19 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 1C1251A9238
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 19 Apr 2024 01:32:19 +0000 (UTC)
Message-Id: <20240419013218.217941A923A@mollari.NetBSD.org>
Date: Fri, 19 Apr 2024 01:32:18 +0000 (UTC)
From: lloyd@must-have-coffee.gen.nz
Reply-To: lloyd@must-have-coffee.gen.nz
To: gnats-bugs@NetBSD.org
Subject: gpio-line-names not used on TI ARM
X-Send-Pr-Version: www-1.0

>Number:         58173
>Category:       kern
>Synopsis:       gpio-line-names not used on TI ARM
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 19 01:35:00 +0000 2024
>Originator:     Lloyd Parkes
>Release:        current Fri 19 Apr 2024 13:25:14 NZST
>Organization:
Must Have Coffee
>Environment:
NetBSD  10.99.10 NetBSD 10.99.10 (GENERIC) #1: Fri Apr 19 13:19:48 NZST 2024  lloyd@ceph4.must-have-coffee.gen.nz:/vol/build/gpio-line-names/objdir.evbearmv7hf-el/sys/arch/evbarm/compile/GENERIC evbarm
>Description:
The GPIO line names that are present in the FDT do not appear in the gpioN devices on a BeagleBone Black.

>How-To-Repeat:
Boot in single user mode, run the command "gpioctl gpio0 list" and note the lack of pin names on the 32 pins listed.
>Fix:
The following patch fixes this by passing the FDT device handle to config_found() so that the MI gpio device can access the FDT and extract the gpio-line-names attribute.

I also moved the call to ti_gpio_attach_ports() to the bottom of ti_gpio_attach() so that the configuration messages are printed to the console in the right order. 

I copied both of these code changes from the way the Broadcom code works.

--- a/sys/arch/arm/ti/ti_gpio.c Wed Apr 17 18:10:27 2024 +0000
+++ b/sys/arch/arm/ti/ti_gpio.c Fri Apr 19 13:23:17 2024 +1200
@@ -560,7 +560,8 @@
        gba.gba_gc = gp;
        gba.gba_pins = sc->sc_pins;
        gba.gba_npins = __arraycount(sc->sc_pins);
-       sc->sc_gpiodev = config_found(sc->sc_dev, &gba, NULL, CFARGS_NONE);
+       sc->sc_gpiodev = config_found(sc->sc_dev, &gba, gpiobus_print,
+                             CFARGS(.devhandle = device_handle(sc->sc_dev)));
 }

 static int
@@ -642,8 +643,6 @@

        fdtbus_register_gpio_controller(self, phandle, &ti_gpio_funcs);

-       ti_gpio_attach_ports(sc);
-
        sc->sc_ih = fdtbus_intr_establish_xname(phandle, 0, IPL_VM,
            FDT_INTR_MPSAFE, ti_gpio_intr, sc, device_xname(self));
        if (sc->sc_ih == NULL) {
@@ -653,4 +652,6 @@
        }
        aprint_normal_dev(self, "interrupting on %s\n", intrstr);
        fdtbus_register_interrupt_controller(self, phandle, &ti_gpio_intrfuncs);
+
+       ti_gpio_attach_ports(sc);
 }

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.