From patchwork Tue Sep 19 16:45:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Wolsieffer X-Patchwork-Id: 13391799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9223FCE79A9 for ; Tue, 19 Sep 2023 19:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=NfoN8Wl/FbKrdqnYIAbC/wo9jUs28yOJhxF+injRzlY=; b=TeA2jioeptcFtk GNlQ52F9sBClJKNkYF/e56wZSiZ+w3grTUd3FvZ1h8PTOSkTXgpY8FGmJi2dBwY7dE/nFYZt16GXS dad76ZZAsfw40DZLK9bjo1PAPWtLbIDpsS1cMvApFg7HNl36G4M4+DK1nsZrwZdeGfm4qgokoLOQ9 wZ5vt11JKBwHH05hiLYzS/6erSIjlnEIgVZv7gSvGYLMRd9hNX7H8n5qzHSKsRE4TU4RcTNyAMHYA 9LNGrjIIVaJ/dRITTsUzpa2WVNBBeN1iED7m2Hgf2F/eSc57plKpEszPQBI0XHHFZNsyDVcA9i7Kb 4GzmJsXvNDQIJ8IMXb1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qigGV-001999-1y; Tue, 19 Sep 2023 19:20:07 +0000 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qigGS-00197d-0s for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 19:20:05 +0000 Received: by mail-qk1-x72b.google.com with SMTP id af79cd13be357-773eedbd757so20761585a.3 for ; Tue, 19 Sep 2023 12:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hefring-com.20230601.gappssmtp.com; s=20230601; t=1695151200; x=1695756000; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Eyh1KouBtG7Iy09LS9HXsGpQo6L9jAzzmaZyqdFSGZk=; b=AXOMp9ejQJw1B4cRUrJUOpE2VrgGIYJdN7LqfHKtg0xPqx+967LlJ7jMR3hMxyHAQY UE2gUlpMB1SBlSevnnNsW/KfYOkchZgR0yuhF4Cu0NZruYQ3/JOkUsr4cPnsIzdEFEjH kqAOMloru9VXn5tIHsCWB4/i97giX70RXms/x5aWReNm9/d5CmUPtgkmp2hayP0TXwcb OImBihDAEprkssrtuDRryV8ayPElveTO53TJxRc4Iw8lBN5eRzzEDl7wCEr3qJvkpVEN eNrCt6PlssEJyDhCsFmyvIAMbqPZ+4Vkywa4Sdt75V3R/b3G088W4ldfmH6m5seD0q7Y ZRgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695151200; x=1695756000; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Eyh1KouBtG7Iy09LS9HXsGpQo6L9jAzzmaZyqdFSGZk=; b=TmEkKteL9DGsLeirA+UhSK07nc68/QtJQEeyUA+2zzzb4n/Qz0ScMd1l/f0jsokDGE b46TX7A2YhkH4Tdwauum91qTiW1H9uSezc8n2I2URBT64FVJlzqh5lwh3h9oVYqXhzA1 HasrkXHrifB0WxQ34EemhhcM7PWXAEAcr0UhbjOw1oD9O8HS/WPLsXYvlZnJQBI7lags 3Wlt7ziJA1SBBcfiT0YMDNB+TmsbAovJhfCT8NnANzNi/NjyLvDkTEC9bktWzCbkKHjz dNPIa9DxSsEVVt9s7dn9Xgvy1G3TiaNLF4W7ocHOv0gIuVbTw1x8sPN5oufI+OBT0OPi OWoA== X-Gm-Message-State: AOJu0YyNzTb8ExD0HJu9MxI/jGwtJI3feOlfUltCcSf1Pvp9XdH+Ryb2 MwUl0aFpWEckBrEaPLoB2TRw9Q== X-Google-Smtp-Source: AGHT+IFIzlQgbfEYm0jO/4QPXVzoFCq4BxIA1q1xLtcSRQPlfowW+Ybgvv+50FIj+ScdvLKfPVI38A== X-Received: by 2002:a05:620a:ec7:b0:76e:fea0:3f40 with SMTP id x7-20020a05620a0ec700b0076efea03f40mr562362qkm.8.1695151200597; Tue, 19 Sep 2023 12:20:00 -0700 (PDT) Received: from dell-precision-5540.lan ([2601:18c:8002:3d40:df77:9915:c17e:79]) by smtp.gmail.com with ESMTPSA id x12-20020ae9f80c000000b0076c60b95b87sm4179704qkh.96.2023.09.19.12.19.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 12:20:00 -0700 (PDT) From: Ben Wolsieffer To: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Christophe Roullier , Ben Wolsieffer Subject: [PATCH 0/2] net: stmmac: dwmac-stm32: fix resume on STM32 MCU Date: Tue, 19 Sep 2023 12:45:34 -0400 Message-ID: <20230919164535.128125-2-ben.wolsieffer@hefring.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_122004_502775_61D834FB X-CRM114-Status: GOOD ( 14.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On STM32 MCUs, Ethernet fails to come up after resume and the following errors appear in dmesg: [ 17.451148] stm32-dwmac 40028000.ethernet: Failed to reset the dma [ 17.451266] stm32-dwmac 40028000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed This occurs because clk_rx is never re-enabled during resume. On the STM32MP1, clk_rx is left running during suspend, and therefore doesn't need to be enabled during resume, but this code was mistakenly applied to the STM32 MCUs as well. The first patch in this series applies a minimal fix for the bug, while the second refactors the clock configuration to make it easier to spot such bugs in the future. I have tested that this series allows Ethernet to come back up correctly after resuming from s2idle on an STM32F746. I don't have STM32MP1 hardware to test. Ben Wolsieffer (2): net: stmmac: dwmac-stm32: fix resume on STM32 MCU net: stmmac: dwmac-stm32: refactor clock config .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 116 ++++++++---------- 1 file changed, 48 insertions(+), 68 deletions(-)