From mboxrd@z Thu Jan 1 00:00:00 1970 From: khilman@baylibre.com (Kevin Hilman) Date: Fri, 24 Mar 2017 13:11:32 -0700 Subject: [RFT PATCH 0/6] pinctrl: meson: Fix gpio-ranged for GPIO Hog In-Reply-To: <1490286449-19448-1-git-send-email-narmstrong@baylibre.com> (Neil Armstrong's message of "Thu, 23 Mar 2017 17:27:23 +0100") References: <1490286449-19448-1-git-send-email-narmstrong@baylibre.com> Message-ID: To: linus-amlogic@lists.infradead.org List-Id: linus-amlogic.lists.infradead.org Neil Armstrong writes: > Whem trying to add a gpio hog to enable the USB Hub on the Odroid-C2, I > encountered a strange bug where when calling gpiochip_add_data() the gpiolib > code was trying to add the Hog but failed because the gpio ranges were missing. > > In the meson-pinctrl driver, the gpio ranges are added manually /after/ the > call to gpiochip_add_data(). > The arch/arm meson8 and meson8b patches has not been tested, this is why this > patchset is an RFT. > > So this patchset uses the DT gpio-ranges attribute instead and solves the issue. > > The final patch is the actual GPIO Hog for the Odroid-C2 board, which is an ugly > hack but is necessary to have USB Ports working on the board until the generic > power sequence framework is merged. > > Neil Armstrong (6): > ARM64: dts: meson-gxbb: Add gpio-ranges properties > ARM64: dts: meson-gxl: Add gpio-ranges properties > ARM: dts: meson8: Add gpio-ranges properties > ARM: dts: meson8b: Add gpio-ranges properties > pinctrl: meson: use gpio-ranges from DT > ARM64: dts: meson-gxbb: Add USB Hub GPIO hog Not sure what kind of extra testing is needed on meson8*, but I tested on meson8b-odroidc1 by replacing the heartbeat LED GPIO with a GPIO hog[1] and see the LED turn on and stay on, so it seems good to me. Tested-by: Kevin Hilman Kevin [1] diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts index e50f1a1fdbc7..d750d6b4c9f1 100644 --- a/arch/arm/boot/dts/meson8b-odroidc1.dts +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts @@ -60,6 +60,7 @@ reg = <0x40000000 0x40000000>; }; +/* leds { compatible = "gpio-leds"; blue { @@ -69,10 +70,18 @@ default-state = "off"; }; }; +*/ }; &uart_AO { status = "okay"; pinctrl-0 = <&uart_ao_a_pins>; pinctrl-names = "default"; + + usb-hub { + gpio-hog; + gpios = ; + output-high; + line-name = "usb-hub-reset"; + }; }; From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Hilman Subject: Re: [RFT PATCH 0/6] pinctrl: meson: Fix gpio-ranged for GPIO Hog Date: Fri, 24 Mar 2017 13:11:32 -0700 Message-ID: References: <1490286449-19448-1-git-send-email-narmstrong@baylibre.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from mail-pf0-f179.google.com ([209.85.192.179]:35439 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967365AbdCXULf (ORCPT ); Fri, 24 Mar 2017 16:11:35 -0400 Received: by mail-pf0-f179.google.com with SMTP id 20so289650pfk.2 for ; Fri, 24 Mar 2017 13:11:34 -0700 (PDT) In-Reply-To: <1490286449-19448-1-git-send-email-narmstrong@baylibre.com> (Neil Armstrong's message of "Thu, 23 Mar 2017 17:27:23 +0100") Sender: linux-gpio-owner@vger.kernel.org List-Id: linux-gpio@vger.kernel.org To: Neil Armstrong Cc: carlo@caione.org, linus.walleij@linaro.org, linux-amlogic@lists.infradead.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Neil Armstrong writes: > Whem trying to add a gpio hog to enable the USB Hub on the Odroid-C2, I > encountered a strange bug where when calling gpiochip_add_data() the gpiolib > code was trying to add the Hog but failed because the gpio ranges were missing. > > In the meson-pinctrl driver, the gpio ranges are added manually /after/ the > call to gpiochip_add_data(). > The arch/arm meson8 and meson8b patches has not been tested, this is why this > patchset is an RFT. > > So this patchset uses the DT gpio-ranges attribute instead and solves the issue. > > The final patch is the actual GPIO Hog for the Odroid-C2 board, which is an ugly > hack but is necessary to have USB Ports working on the board until the generic > power sequence framework is merged. > > Neil Armstrong (6): > ARM64: dts: meson-gxbb: Add gpio-ranges properties > ARM64: dts: meson-gxl: Add gpio-ranges properties > ARM: dts: meson8: Add gpio-ranges properties > ARM: dts: meson8b: Add gpio-ranges properties > pinctrl: meson: use gpio-ranges from DT > ARM64: dts: meson-gxbb: Add USB Hub GPIO hog Not sure what kind of extra testing is needed on meson8*, but I tested on meson8b-odroidc1 by replacing the heartbeat LED GPIO with a GPIO hog[1] and see the LED turn on and stay on, so it seems good to me. Tested-by: Kevin Hilman Kevin [1] diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts index e50f1a1fdbc7..d750d6b4c9f1 100644 --- a/arch/arm/boot/dts/meson8b-odroidc1.dts +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts @@ -60,6 +60,7 @@ reg = <0x40000000 0x40000000>; }; +/* leds { compatible = "gpio-leds"; blue { @@ -69,10 +70,18 @@ default-state = "off"; }; }; +*/ }; &uart_AO { status = "okay"; pinctrl-0 = <&uart_ao_a_pins>; pinctrl-names = "default"; + + usb-hub { + gpio-hog; + gpios = ; + output-high; + line-name = "usb-hub-reset"; + }; }; From mboxrd@z Thu Jan 1 00:00:00 1970 From: khilman@baylibre.com (Kevin Hilman) Date: Fri, 24 Mar 2017 13:11:32 -0700 Subject: [RFT PATCH 0/6] pinctrl: meson: Fix gpio-ranged for GPIO Hog In-Reply-To: <1490286449-19448-1-git-send-email-narmstrong@baylibre.com> (Neil Armstrong's message of "Thu, 23 Mar 2017 17:27:23 +0100") References: <1490286449-19448-1-git-send-email-narmstrong@baylibre.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Neil Armstrong writes: > Whem trying to add a gpio hog to enable the USB Hub on the Odroid-C2, I > encountered a strange bug where when calling gpiochip_add_data() the gpiolib > code was trying to add the Hog but failed because the gpio ranges were missing. > > In the meson-pinctrl driver, the gpio ranges are added manually /after/ the > call to gpiochip_add_data(). > The arch/arm meson8 and meson8b patches has not been tested, this is why this > patchset is an RFT. > > So this patchset uses the DT gpio-ranges attribute instead and solves the issue. > > The final patch is the actual GPIO Hog for the Odroid-C2 board, which is an ugly > hack but is necessary to have USB Ports working on the board until the generic > power sequence framework is merged. > > Neil Armstrong (6): > ARM64: dts: meson-gxbb: Add gpio-ranges properties > ARM64: dts: meson-gxl: Add gpio-ranges properties > ARM: dts: meson8: Add gpio-ranges properties > ARM: dts: meson8b: Add gpio-ranges properties > pinctrl: meson: use gpio-ranges from DT > ARM64: dts: meson-gxbb: Add USB Hub GPIO hog Not sure what kind of extra testing is needed on meson8*, but I tested on meson8b-odroidc1 by replacing the heartbeat LED GPIO with a GPIO hog[1] and see the LED turn on and stay on, so it seems good to me. Tested-by: Kevin Hilman Kevin [1] diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts index e50f1a1fdbc7..d750d6b4c9f1 100644 --- a/arch/arm/boot/dts/meson8b-odroidc1.dts +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts @@ -60,6 +60,7 @@ reg = <0x40000000 0x40000000>; }; +/* leds { compatible = "gpio-leds"; blue { @@ -69,10 +70,18 @@ default-state = "off"; }; }; +*/ }; &uart_AO { status = "okay"; pinctrl-0 = <&uart_ao_a_pins>; pinctrl-names = "default"; + + usb-hub { + gpio-hog; + gpios = ; + output-high; + line-name = "usb-hub-reset"; + }; };