Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2193505iof; Tue, 7 Jun 2022 22:47:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCGW8e+Z8HeUnlrhgFV0jPT+FyzjNF89LqArzOPOP4H4ZTm6jpoVAV6A54ShyC2a0Q4a6s X-Received: by 2002:a17:90b:358d:b0:1ea:4718:82b8 with SMTP id mm13-20020a17090b358d00b001ea471882b8mr619418pjb.244.1654667243264; Tue, 07 Jun 2022 22:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654667243; cv=none; d=google.com; s=arc-20160816; b=FVZ1I3d75fQH9Kdcj7hlhu87hOStSglGHlhj0hFbEANJY8xxlAvya2xveXRgPAxAE3 RKcEgqTGBcHHJS8QsA3Ubah5rRa1z2x3wQRUqvPMqIx2EwD8v11P2GPUzb+OQa1G9Fp/ 73dqgKh+w5aC9qhcxtPnopiww8lr17fot8hlNQ4dW5cnru6EvfNwM4IfqaDbvU1cJhib inj8ZqNedVtDmmkz0EFN26wmo5dkcZcjec6RHHk21n9hK7ejZOMue3tnOMKpWY04BHpA PlKlla9xHpJ3rFBDy+nXF7GRV/guvLCjtWW/ObtbT3pqWfGaxC/dyDIbA5r+dk8Y/M0E YSpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WVpu99XDpsW5hFQnwBfSLsnSOaVOjqC2oSagJdOFJUg=; b=vsCaP4aEGgwd6uYjYVSsPFzh3HamPU++gDKuhgoOKUVMbsHruvJZIcSHq8SZ14bT+O FU2atEcCu7btLrAv7oNEEdwL6OiN1wPGYZXZJCmikawYxFfoMdU/86i3DAbYLPvGaRBH 3VyxeGwpYlt8/uxv/WPf4GXKmDZIjJr0ZyUykLTCn+OPiv5/EO26rAEcqycix2SnGKbR mXWAXQraxfE0bnncMDZsOv3MKcrE+kSCIwxRYJusu/lEYvm3Z5P6wx9zEa+AluBXbrKQ CgwVL+HSKNcio34qISlQ+AN+e4mZMUQNiirB0JYuT/upENIZu37dh8klR8AAG1ZMeOmR jI1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NwgiBwqp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q68-20020a632a47000000b003fcda70f160si23247817pgq.784.2022.06.07.22.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:47:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NwgiBwqp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 63E323C6DAC; Tue, 7 Jun 2022 22:12:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351917AbiFHAX7 (ORCPT + 99 others); Tue, 7 Jun 2022 20:23:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382510AbiFGV56 (ORCPT ); Tue, 7 Jun 2022 17:57:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 737D024CC93; Tue, 7 Jun 2022 12:13:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 23C30B823AE; Tue, 7 Jun 2022 19:13:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 936EAC385A5; Tue, 7 Jun 2022 19:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629235; bh=BosxUKO/27/7KBdUbBO+j64psIFPo88G9Hi6DZud58k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NwgiBwqpsRGjvVkV1v4D6tWjvmiztU3PYCMSyiKC8kk7I0jiC4tYiVwgBekyYTekV NvwoliY7Iz915/9jcs2GNOnYNhYHvqGmBVMu8WzqXbXeNw7aFLKfoGuWCwoPZkVZdH QEQBmAAw2NCcXYFxLECy0sdG/N0GFmFpEmXKCW2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.18 617/879] PCI: mediatek-gen3: Assert resets to ensure expected init state Date: Tue, 7 Jun 2022 19:02:15 +0200 Message-Id: <20220607165020.757146074@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: AngeloGioacchino Del Regno [ Upstream commit 1d565935e3b9ccc682631e0bc6e415a7f48295d9 ] The controller may have been left out of reset by the bootloader, in which case, before the powerup sequence, the controller will be found preconfigured with values that were set before booting the kernel: this produces a controller failure, with the result of a failure during the mtk_pcie_startup_port() sequence as the PCIe link never gets up. To ensure that we get a clean start in an expected state, assert both the PHY and MAC resets before executing the controller power-up sequence. Link: https://lore.kernel.org/r/20220404144858.92390-1-angelogioacchino.delregno@collabora.com Fixes: d3bf75b579b9 ("PCI: mediatek-gen3: Add MediaTek Gen3 driver for MT8192") Signed-off-by: AngeloGioacchino Del Regno Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin --- drivers/pci/controller/pcie-mediatek-gen3.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c index 3e8d70bfabc6..5d9fd36b02d1 100644 --- a/drivers/pci/controller/pcie-mediatek-gen3.c +++ b/drivers/pci/controller/pcie-mediatek-gen3.c @@ -838,6 +838,14 @@ static int mtk_pcie_setup(struct mtk_gen3_pcie *pcie) if (err) return err; + /* + * The controller may have been left out of reset by the bootloader + * so make sure that we get a clean start by asserting resets here. + */ + reset_control_assert(pcie->phy_reset); + reset_control_assert(pcie->mac_reset); + usleep_range(10, 20); + /* Don't touch the hardware registers before power up */ err = mtk_pcie_power_up(pcie); if (err) -- 2.35.1