From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1834BC43381 for ; Mon, 18 Feb 2019 13:31:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CEDA62147A for ; Mon, 18 Feb 2019 13:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550496685; bh=0l86DVp3hNeWfeopmWUYgRqRhWq/+hPxGFjXeSkJjBI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=WpZhFgJ+vctGwTj4oNPQdMia711U3FxDF68iPRRN2B8hjooDyFQDu6OmexzCKhiPM 5BM5zBrUfWG1/BM2y0QrApzB446kAfvIKc2b7jZJcwA5/kNR6p1ysD9ggTOUc32Azx rJXjMTBzkiX9yUspE4ipEsdxEiO4aH7lE8o/8HD8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730488AbfBRNbZ (ORCPT ); Mon, 18 Feb 2019 08:31:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:41842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728394AbfBRNbY (ORCPT ); Mon, 18 Feb 2019 08:31:24 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F6592147A; Mon, 18 Feb 2019 13:31:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550496683; bh=0l86DVp3hNeWfeopmWUYgRqRhWq/+hPxGFjXeSkJjBI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LtWqeVF8zEp3JYRb2FFb+OLXihVQfbKMWTMn7tb9Kbv35pkvpccxy3qEhEcMjIOLo 408zaznGz/pRnDEKQKrPJYDfDSOVvTlod4MSD25050t7NIgYxr4rIZh7/V1gQx7OEi mQzuwOMUKsQ3IXghOzyrTKSlaHXWM3FMAwmR/fnc= Date: Mon, 18 Feb 2019 14:31:21 +0100 From: Greg KH To: Amit Pundir Cc: Stable , Linus Walleij , Christian Lamparter Subject: Re: [PATCH for-3.18.y+] pinctrl: msm: fix gpio-hog related boot issues Message-ID: <20190218133121.GA30139@kroah.com> References: <1550493012-5959-1-git-send-email-amit.pundir@linaro.org> <1550493012-5959-2-git-send-email-amit.pundir@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1550493012-5959-2-git-send-email-amit.pundir@linaro.org> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Feb 18, 2019 at 06:00:11PM +0530, Amit Pundir wrote: > From: Christian Lamparter > > commit a86caa9ba5d70696ceb35d1d39caa20d8b641387 upstream. > > Sven Eckelmann reported an issue with the current IPQ4019 pinctrl. > Setting up any gpio-hog in the device-tree for his device would > "kill the bootup completely": > > | [ 0.477838] msm_serial 78af000.serial: could not find pctldev for node /soc/pinctrl@1000000/serial_pinmux, deferring probe > | [ 0.499828] spi_qup 78b5000.spi: could not find pctldev for node /soc/pinctrl@1000000/spi_0_pinmux, deferring probe > | [ 1.298883] requesting hog GPIO enable USB2 power (chip 1000000.pinctrl, offset 58) failed, -517 > | [ 1.299609] gpiochip_add_data: GPIOs 0..99 (1000000.pinctrl) failed to register > | [ 1.308589] ipq4019-pinctrl 1000000.pinctrl: Failed register gpiochip > | [ 1.316586] msm_serial 78af000.serial: could not find pctldev for node /soc/pinctrl@1000000/serial_pinmux, deferring probe > | [ 1.322415] spi_qup 78b5000.spi: could not find pctldev for node /soc/pinctrl@1000000/spi_0_pinmux, deferri > > This was also verified on a RT-AC58U (IPQ4018) which would > no longer boot, if a gpio-hog was specified. (Tried forcing > the USB LED PIN (GPIO0) to high.). > > The problem is that Pinctrl+GPIO registration is currently > peformed in the following order in pinctrl-msm.c: > 1. pinctrl_register() > 2. gpiochip_add() > 3. gpiochip_add_pin_range() > > The actual error code -517 == -EPROBE_DEFER is coming from > pinctrl_get_device_gpio_range(), which is called through: > gpiochip_add > of_gpiochip_add > of_gpiochip_scan_gpios > gpiod_hog > gpiochip_request_own_desc > __gpiod_request > chip->request > gpiochip_generic_request > pinctrl_gpio_request > pinctrl_get_device_gpio_range > > pinctrl_get_device_gpio_range() is unable to find any valid > pin ranges, since nothing has been added to the pinctrldev_list yet. > so the range can't be found, and the operation fails with -EPROBE_DEFER. > > This patch fixes the issue by adding the "gpio-ranges" property to > the pinctrl device node of all upstream Qcom SoC. The pin ranges are > then added by the gpio core. > > In order to remain compatible with older, existing DTs (and ACPI) > a check for the "gpio-ranges" property has been added to > msm_gpio_init(). This prevents the driver of adding the same entry > to the pinctrldev_list twice. > > Reported-by: Sven Eckelmann > Tested-by: Sven Eckelmann [ipq4019] > Reviewed-by: Bjorn Andersson > Signed-off-by: Christian Lamparter > Signed-off-by: Linus Walleij > [AmitP: Minor rebasing for Stable] > Signed-off-by: Amit Pundir > --- > Cherry-picked from lede tree https://git.lede-project.org/?p=source.git > and build tested for LTS trees up to v4.14.y for ARCH=arm/arm64 defconfig. Now applied, thanks. greg k-h