From patchwork Wed Aug 28 06:55:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bo Gan X-Patchwork-Id: 13780879 X-Patchwork-Delegate: mail@conchuod.ie 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 56A58C5474A for ; Wed, 28 Aug 2024 08:00:49 +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:References:In-Reply-To: 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: List-Owner; bh=+4dhJWMoarmU0mgaid7/cqAnYKv9OaI/l0O2S2Xt+jA=; b=QHN3weSvhd+rUW lQaQY4Q1MnK5NiK48eCHhE2RHja7EkmQVjRi9urZO8qvzD1sG1fq9cqxCpBjSKU6LrKrd/Ox5cCSj Dvwgi3Qtz5BcQO2G8ugjlKf0usaqbbrPnis0sGznVA37PWpaN7q1OIZa+0Ctmw764YcQop1uXkxpC +ihlRD9NjumcFI6xOIDLaDRhfgu97P+3D1WRFdHJvadbmIPQrM6SM90+VZswegYKxA9TnZI8JS+9C 8ZKUDAViCRo6701k5B2di9d+fGEG2JqVPRkUQ/kvbn5A6o1EDDKg+dTYBd9pQ9kd0sexOeOZpOS55 2Nadu5lXZjYS6dHtQTYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjDbi-0000000EROG-1j00; Wed, 28 Aug 2024 08:00:46 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjCac-0000000EAAp-1m3S for linux-riscv@bombadil.infradead.org; Wed, 28 Aug 2024 06:55:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=6ROqg56FyItnNUDdC6ELchQJJpYcKYxLCDK9KVx4Stg=; b=cs1lhpe4jfbx3DHR2FLHbXT3wF CaJlaHu3XiTy2qX6thZLvmUKwk/9KEhR7+rjva1plpQ/xGxttHMYcUQFUkxk1jvE7OiUlsUJnSSMD E231We9XOFkYGGGg5Z66oIkDAWoOWcs6w1n/Qg8NbhEcehxEE5S6QHK8DVz6DzwpOW6XRcG0ocKhw bbaAm3lmtbRGdDGExsS4jDndLWWIvimn6Nca0Tu64uHwfCeygAphq7lyocOqZvXK+qK+MvdcqJcTO hEEfKMFPATMT4SXspZBNRcmT1xL/5AFiSlk4bNjPzGf9Y40kj8WJqObuljhGk0xwAuDgq6W17huqG Evb0d87g==; Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjCaT-0000000B4hN-37O6 for linux-riscv@lists.infradead.org; Wed, 28 Aug 2024 06:55:30 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1fec34f94abso65984625ad.2 for ; Tue, 27 Aug 2024 23:55:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724828122; x=1725432922; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6ROqg56FyItnNUDdC6ELchQJJpYcKYxLCDK9KVx4Stg=; b=lEHKdqAzZ1N1pxIJTdhnPlNnThlkaud3/BGB+Vuh2tstCYkP+zgPzWvi3eWnSx/wZm 2Em7fIVFDfud2m4aPZC7oyKLhOzaQB17eoVBPPb2X9EOV+ua4LuiZuUO3bWNjhe9ojTA xT10u4o4T4M2Vrdj/ehBEKSG1raJEJHwohv6jV2hoAXMxnE/l0zn/gExXD6NsAE3tOH7 8fJGWn/zAHOXG80xmS4qeup1X29d+MJ/pdWzYikJNbCcPd3gtUpMoC7cGAjYsSii3zQV Ghq8/U6jHZXfk8UlaDkxcDSCijPHyvJUkb6zMrLMwzk5eRrsE+Glz/mlaHMNF0GzFo2R wAMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724828122; x=1725432922; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6ROqg56FyItnNUDdC6ELchQJJpYcKYxLCDK9KVx4Stg=; b=lp4r+B+6PMb5onoFByp8TIz9CnO+2hoeVkWkbDEcCSXAlzjhpFsfHgaAB82vVQ+a1a a8YO+dU/XPgqdvbIam9jWKDyUKUSBPDRwyw3eIiuLa1mHAPEs8LIrlOAdRi0wofTWxBX AO7GVy6EsfbAvwgpGpLvuQjU/dvjHdvtE/he0ht6fi+K/dd9/plrjB8zVu6rewCYAtjk 4GEFqqBowb4Y8SNkr5hSgG+oqqC+ofYAtcI1sCo0Bclyv1Sfg9gim0qeAsgwg1wupxMh lif3PO4E/G+U1keOf0xpAs0Yl1vuJWQF4ouVdyd8Ywkufqi/BRq1jNYlawdW+f24Nx23 vvvQ== X-Forwarded-Encrypted: i=1; AJvYcCUpDOB2LieX0trwb65S1FRh6f4ZiAF9rEEQ/hHBZElq3bHIZ9l6kW635ERBmOmn4qlcUuJtF+nSNEUP3A==@lists.infradead.org X-Gm-Message-State: AOJu0YzSlCUEy9PnbiZbUSXieapqHM4fu2BU3gJ3ZFXwXRwmg3pAygpR Op+onbw72FJFmzqrsGC6YNHiirqPw+rAOrxCH6n5jiv2NVDVQ0q0 X-Google-Smtp-Source: AGHT+IHyK9Bwbr9j/dan60lKEiq/HvBRavSYzYIR//sllCCG1mgrUDVgkeTETlOetRIPEotRmP5cOA== X-Received: by 2002:a17:902:aa04:b0:202:4b99:fd27 with SMTP id d9443c01a7336-2039e4ef20amr113649585ad.51.1724828121819; Tue, 27 Aug 2024 23:55:21 -0700 (PDT) Received: from m91p.airy.home ([172.92.174.232]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20385607f94sm92816005ad.182.2024.08.27.23.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 23:55:21 -0700 (PDT) From: Bo Gan To: zong.li@sifive.com, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Pragnesh.patel@sifive.com, aou@eecs.berkeley.edu, erik.danie@sifive.com, hes@sifive.com, mturquette@baylibre.com, palmer@dabbelt.com, palmerdabbelt@google.com, paul.walmsley@sifive.com, pragnesh.patel@openfive.com, sboyd@kernel.org, schwab@linux-m68k.org, yash.shah@sifive.com Subject: [PATCH 1/3] dt-bindings: reset: sifive: add fu540/fu740 reset indexes Date: Tue, 27 Aug 2024 23:55:18 -0700 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_075528_439342_8F351E32 X-CRM114-Status: GOOD ( 11.60 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add bindings for FU540/FU740 clock/reset controller. The header is taken from the same path in U-Boot with macros renamed to have FU540/740 prefix. Signed-off-by: Bo Gan --- include/dt-bindings/reset/sifive-fu540-prci.h | 19 +++++++++++++++++++ include/dt-bindings/reset/sifive-fu740-prci.h | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 include/dt-bindings/reset/sifive-fu540-prci.h create mode 100644 include/dt-bindings/reset/sifive-fu740-prci.h diff --git a/include/dt-bindings/reset/sifive-fu540-prci.h b/include/dt-bindings/reset/sifive-fu540-prci.h new file mode 100644 index 000000000000..dbaf602262d2 --- /dev/null +++ b/include/dt-bindings/reset/sifive-fu540-prci.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2020 Sifive, Inc. + * Author: Sagar Kadam + */ + +#ifndef __DT_BINDINGS_RESET_SIFIVE_FU540_PRCI_H +#define __DT_BINDINGS_RESET_SIFIVE_FU540_PRCI_H + +/* Reset indexes for use by device tree data and the PRCI driver */ +#define FU540_PRCI_RST_DDR_CTRL_N 0 +#define FU540_PRCI_RST_DDR_AXI_N 1 +#define FU540_PRCI_RST_DDR_AHB_N 2 +#define FU540_PRCI_RST_DDR_PHY_N 3 +/* bit 4 is reserved bit */ +#define FU540_PRCI_RST_RSVD_N 4 +#define FU540_PRCI_RST_GEMGXL_N 5 + +#endif diff --git a/include/dt-bindings/reset/sifive-fu740-prci.h b/include/dt-bindings/reset/sifive-fu740-prci.h new file mode 100644 index 000000000000..74d60ca9f1df --- /dev/null +++ b/include/dt-bindings/reset/sifive-fu740-prci.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* + * Copyright (C) 2020-2021 Sifive, Inc. + * Author: Pragnesh Patel + */ + +#ifndef __DT_BINDINGS_RESET_SIFIVE_FU740_PRCI_H +#define __DT_BINDINGS_RESET_SIFIVE_FU740_PRCI_H + +/* Reset indexes for use by device tree data and the PRCI driver */ +#define FU740_PRCI_RST_DDR_CTRL_N 0 +#define FU740_PRCI_RST_DDR_AXI_N 1 +#define FU740_PRCI_RST_DDR_AHB_N 2 +#define FU740_PRCI_RST_DDR_PHY_N 3 +#define FU740_PRCI_RST_PCIE_POWER_UP_N 4 +#define FU740_PRCI_RST_GEMGXL_N 5 +#define FU740_PRCI_RST_CLTX_N 6 + +#endif From patchwork Wed Aug 28 06:55:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bo Gan X-Patchwork-Id: 13780878 X-Patchwork-Delegate: mail@conchuod.ie 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 30260C54750 for ; Wed, 28 Aug 2024 08:00:48 +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:References:In-Reply-To: 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: List-Owner; bh=D3N3f4JL3cUtVzoNb6QltHH3DMm8vaD7KJVLqxSBS5s=; b=1HINuKajX2Iabi JAb5jmMJYwcF2Nd4aNQhaf+05hkN5BfMvW8E9JR9tW8GdVbXCxUJs54RY8247rDIUmX/3i86qZXfi xJFIl/Pia2RGkFXvziTQgkc4AfSwU/VYU4fms72F0lN1aYLfmmGT6s2F4LIkuhJG6WXJIR4K9MQC/ /T1gaGCV8jMhC167/KXIwiOaaIYUh871BbgWIjSnfnNrVVH5GqaiS+bbWK87sco608r0yPx2gzLem phBJkHtCDBYhSd/HeNcm5WjUKdU03cEzm0gPwaQMlbW4HPJZyiy5qI0oyktkorU8/7/zLyaCIKOhk T9A6j7LWSwjhhHC9ZTsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjDbh-0000000ERNQ-1HFn; Wed, 28 Aug 2024 08:00:45 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjCac-0000000EAAq-1m4m for linux-riscv@bombadil.infradead.org; Wed, 28 Aug 2024 06:55:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=xRxYEethFaPHbS9fj3JDuM9MZyXWGe/oMxrByYjDscI=; b=dSkmZFd78ebnLppGNfBTC++ibx E0oOvMgPaIR6Y+fc0CtC3M5R9qHAi3JqM5rJjRpIIOONjoOKyYh3Wvs33HkvC41RcJJ1VYhbOlXZK SPFz4nImYAMdAGjM1FrhdrGvzfRxy4mlkFuG1sjo8QmerQbOJzsIlFB26ot78x/9hzN00tGzpcNQN dfF8xbsgoNshLXchn7k1tzFe1RpJQOix7ThUvvHPSPHHB4vt26NrMVqq0OCwlo3kqeF6aUeQknnb7 OAydih2v/2Sj3mX2FOyaokuKHGod8wKGEcheNLhRlC8X8h4aCEC3+2jJKZn53CHj5QJXhqkQXTfoF KQD96Prw==; Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjCaU-0000000B4hP-1WzR for linux-riscv@lists.infradead.org; Wed, 28 Aug 2024 06:55:31 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2020b730049so50081235ad.3 for ; Tue, 27 Aug 2024 23:55:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724828124; x=1725432924; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xRxYEethFaPHbS9fj3JDuM9MZyXWGe/oMxrByYjDscI=; b=cblB/MZHwPXhEFXmWEZ/SSYwYyRUKZAgJ4qmg3ZLm/c1iAlNAkVNNTgc+3xjDOQU+6 6YWLgXTkzUcZvwPww6PWDdAzSfKAIxBimTuC7v8ueyG7omz0DuwlMPXzDOF/qnMWINtF 7tzEXNmHena8ymT84XPLgV7YzXyaOWniHSG4J70/1NN2+G0a3hFzVzq2Fn4ErL6SNHji PjiVlO8vne8WxjWPJ4m/8bfQtuo4mSSOpiBD3NptToDevdtNScesqPYY/GGd3wFqcbmh 0s1T9NoA+ZBugoGjeIITqefr+nIobO/7D/a3H8qKPWLnPN8JUDX+5Opz9HylmHqsdky2 TdnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724828124; x=1725432924; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xRxYEethFaPHbS9fj3JDuM9MZyXWGe/oMxrByYjDscI=; b=bOagpDm8w6sH5Drc8atUuwonwrZRJiwp15bgV6snCP2FiQp+5OSTXwzFWvL137wrss EYypsHsIquOPluarEPlECrczmfEs3dxTOa9TiFXX5+w9OphRV9698Xthm2thNCMex8US 1TaAeRztCnpUOqqhcUDjnRTvdK5ba3wVEVL/soMtXSO66Ht2f0q/s1pCm6d04fds9ERi N2IF+FB+J0RedNdkUxO81meR2LwJZz2hdPJ1mN/s5mey9/cPCjufU9+40r3i/1gKKdoX tzjtBbBi8V7cjOkeAuSr0WlPwu6QVSnYAOFg89ewoTPXYErNxU4kaXzXU8s9GF2MEaSD IWMA== X-Forwarded-Encrypted: i=1; AJvYcCUgOiJ4qTD4OoBaVe1EALzVv+AHuZRUPU0ASPJ1bKfhzCyn23UliF02gUumwi9bpjRSbvjDN0XbJKXc/Q==@lists.infradead.org X-Gm-Message-State: AOJu0YxmEWoPKzAbfLbaPgbhvMP9ksr5cGsf/SwLLLIxdlE0WzYS+kwW 7C+x2P5wKLrOZ2QhC/9mjIo6Tf2IBUYkZp+gdezeBJQkWJKaerEs X-Google-Smtp-Source: AGHT+IFNEx4Dk5gs2p6bZvs7Rq9HQ8hMPHB0qibnOdi772UG3c9oJXf1TaaHf1ctBf8WV+Gpt55VlQ== X-Received: by 2002:a17:902:e891:b0:202:38be:7b20 with SMTP id d9443c01a7336-2039e4cd9d5mr157176925ad.38.1724828123590; Tue, 27 Aug 2024 23:55:23 -0700 (PDT) Received: from m91p.airy.home ([172.92.174.232]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20385607f94sm92816005ad.182.2024.08.27.23.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 23:55:22 -0700 (PDT) From: Bo Gan To: zong.li@sifive.com, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Pragnesh.patel@sifive.com, aou@eecs.berkeley.edu, erik.danie@sifive.com, hes@sifive.com, mturquette@baylibre.com, palmer@dabbelt.com, palmerdabbelt@google.com, paul.walmsley@sifive.com, pragnesh.patel@openfive.com, sboyd@kernel.org, schwab@linux-m68k.org, yash.shah@sifive.com Subject: [PATCH 2/3] riscv: dts: sifive: fu740: Use reset index from header Date: Tue, 27 Aug 2024 23:55:19 -0700 Message-Id: <93f4603de5056c94085cd2a91934563789701795.1724827635.git.ganboing@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_075528_583384_2B0F511C X-CRM114-Status: UNSURE ( 9.32 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The hard-coded index is removed. Signed-off-by: Bo Gan --- arch/riscv/boot/dts/sifive/fu740-c000.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/boot/dts/sifive/fu740-c000.dtsi b/arch/riscv/boot/dts/sifive/fu740-c000.dtsi index 6150f3397bff..a2c09033a9ed 100644 --- a/arch/riscv/boot/dts/sifive/fu740-c000.dtsi +++ b/arch/riscv/boot/dts/sifive/fu740-c000.dtsi @@ -4,6 +4,7 @@ /dts-v1/; #include +#include / { #address-cells = <2>; @@ -358,7 +359,7 @@ pcie@e00000000 { clocks = <&prci FU740_PRCI_CLK_PCIE_AUX>; pwren-gpios = <&gpio 5 0>; reset-gpios = <&gpio 8 0>; - resets = <&prci 4>; + resets = <&prci FU740_PRCI_RST_PCIE_POWER_UP_N>; status = "okay"; }; }; From patchwork Wed Aug 28 06:55:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bo Gan X-Patchwork-Id: 13780880 X-Patchwork-Delegate: mail@conchuod.ie 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 A9DE1C5474A for ; Wed, 28 Aug 2024 08:00:53 +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:References:In-Reply-To: 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: List-Owner; bh=OhPDSpC4jSkXz5Ofe6r13DcSbw78Pipz4IajvrOr2Mg=; b=mZQecIYQLFsBjP VqjK6nU5GQa5eILMjvG6c0OxggBzcl3p1Z8Hdcfqvz15imsxCcQn2yLPHbrNKAOY+yYoi56C0brlp 3WBGBqaaOLWqNC1iwUK3oaJ+KRCzICwX3uERVnRSOytBVhiIvB3nClr/58GXiQ7q7rcO5Gim4KcTt x6pZm+izTHeI4Bdi/M/M2U2TJQT0zwbRYk3nb17f+ytyOuz6xShN5xqCvHUcOc3+4Ep8cyh4duU8P /P/WStDwo4CVG6cCNgZr4GPAQ4D9AnMjGjORxRE9r1PX60WQU0T7WpGKmYnUU3Pfzfa6DcTat1LW7 IvnU2i57NnvDQAquJnCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjDbj-0000000ERPk-3wS9; Wed, 28 Aug 2024 08:00:47 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjCac-0000000EAAr-27hQ for linux-riscv@bombadil.infradead.org; Wed, 28 Aug 2024 06:55:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ADaFrHDK9ZOzAQCFKsnssz1RoZQI/sdKuq5QgfmMJBo=; b=nja579DsPrRyoCW7rSjMJNGu8u liJUifqx2UrwkH40lNXTBUciW0JX6n6tHmRiF0Bj3YnvmqpTnZFCb4wElHJBR6UG2wuC9zAV8OWDZ +ZcmjI91A/AjfkUKrEzK3YI7uFOdV1X0oIEc64KwFoG/TQWZAVVOfLnNRIqknBA/Svb8gjebxVg7k ghVnGwtyttfyx0BbTngCwMTYymsww+gmt7EPttZq4kWSusmPUSy7vIgztfa3MvHwgUI2NOVeJQ5xT +K0kcZZRF4a+++2i1ONA7kmeniVDzA7XrPD4GyE8jJxV2aHS8Naqh9grachb2HZO3W577bI6Hsnfl aiuv8ZDA==; Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjCaV-0000000B4hX-08J4 for linux-riscv@lists.infradead.org; Wed, 28 Aug 2024 06:55:31 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1fee6435a34so43820445ad.0 for ; Tue, 27 Aug 2024 23:55:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724828125; x=1725432925; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ADaFrHDK9ZOzAQCFKsnssz1RoZQI/sdKuq5QgfmMJBo=; b=Qx4/Hy6k8wwFVe7uthEr3MnFJIjR8XnKR6LPqpvmoDjp1vCKpXovSsCBgGXL/nA0UG vmqEof8uUGdLTue2Hpj7TAq2lMK/g1HjchqvNNRng8ASpFIATV+QtJWAdsTIx12/xHCO uegC/etWviCCmC8nznq/Za+KVCEHt2/JCP+jGe97SVlKNopIhixkDpN9SSGFdAmaGxi4 h6tYyT2IVYbxjHzTPUpoowIZ5+lSpKNuuInyXKv6G0/8/oQdzqTgRrJaW2J+9Myz7YS1 U8OumHb4U+a3dP0iVM+cfrv6Vepdp5gG/y2yNR9GrIO5FpjHOdT8tl/T8jppIyya+fJ1 176g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724828125; x=1725432925; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ADaFrHDK9ZOzAQCFKsnssz1RoZQI/sdKuq5QgfmMJBo=; b=hjd62KULO49r0zqQQwhzosZA2MehtXaXSPDcBD3uBjDj6cmskluhT88z2tT3mUeTK/ Nwp22LXLJ6UfEBFxKIC6id5vkJVswqr0Wf3VY0ddD1n8UsUx2W4MTd7GGJx92FwwP2Jh Ro20/3Jy0fy25j8xMVWAtSas6WOQ5sostDA1vwO/0+u1SqpYCONCccLL+eKpHeeU1Iyg weRDOW+bBaywf39q+i+37sXfjRSui2JpkFnCLG30yD2I42VVn6ZtCiv6geXVllb+3cKt XRd7oW1M2urI9zwKo0AoSx9qikXHe83dnz7UopblqWpSR2cIklSRv27J/cHiCss1PEwQ EepA== X-Forwarded-Encrypted: i=1; AJvYcCWlLYg1vkaxctOwys3vot2tdJ+yuwPjDr24g+9bfMbkjHJ9WeNNzRBr4+BqXhrM0f+UED5KNndrtX3MgQ==@lists.infradead.org X-Gm-Message-State: AOJu0YzFBgGznKtsu2IawmS6NVye+IjZ2yfdgfZKWccWT6ArpodYlNcd Wc9V6q97cuwjc88FoFGpfuhDZNiIy8MAYDU0SboVjgSXkH8wggDQ X-Google-Smtp-Source: AGHT+IF4i+BjBUycmBUoKtnssqJR+p5OnuLE/Jpi6Rk+k1EXgavhtDmvGzw4sUvLwFCHusYKmK+ctg== X-Received: by 2002:a17:902:c946:b0:202:4464:c5f3 with SMTP id d9443c01a7336-2039e4f6368mr146874035ad.52.1724828125157; Tue, 27 Aug 2024 23:55:25 -0700 (PDT) Received: from m91p.airy.home ([172.92.174.232]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20385607f94sm92816005ad.182.2024.08.27.23.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 23:55:24 -0700 (PDT) From: Bo Gan To: zong.li@sifive.com, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Pragnesh.patel@sifive.com, aou@eecs.berkeley.edu, erik.danie@sifive.com, hes@sifive.com, mturquette@baylibre.com, palmer@dabbelt.com, palmerdabbelt@google.com, paul.walmsley@sifive.com, pragnesh.patel@openfive.com, sboyd@kernel.org, schwab@linux-m68k.org, yash.shah@sifive.com Subject: [PATCH 3/3] clk: sifive: prci: Add release_reset hooks for gemgxlpll/cltxpll Date: Tue, 27 Aug 2024 23:55:20 -0700 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_075529_015976_C37CF3DC X-CRM114-Status: GOOD ( 24.21 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org This patch adds the release_reset hook interface to __prci_wrpll_data. During clock enablement, the function (if present) will be called after PLL registers are configured. It aligns the logic to the driver in u-boot. When there's a previous bootloader stage, such as u-boot, it usually enables the gemgxlpll clock when trying to PXE/network boot. The kernel boots fine, but we should not depend on it being our previous stage, and the logic within: a. We (linux) can get directly invoked by firmware (OpenSBI). b. U-boot doesn't necessarily have to initialize ethernet and enable the clock (when not enabled in CONFIG). When the kernel is the first to initialize gemgxlpll, it must also release the corresponding reset. Otherwise the chip will just hang during macb initialization, and even external JTAG debugger will lose control over the risc-v debug module. (Observed with my Sifive Unmatched Rev.B board) The patch took the dt-bindings and logics directly from u-boot with some additional modifications: - Use __prci_writel after __prci_readl to have barrier semantic. U-boot has the strong version of readl/writel, but linux has the relaxed ones. - Use pd->reset.rcdev.ops to access the reset regs. - Split reset bindings for FU540/FU740 and use them directly, instead of looking it up through reset-names. Signed-off-by: Bo Gan --- drivers/clk/sifive/fu540-prci.h | 16 ++++++++++++++++ drivers/clk/sifive/fu740-prci.h | 31 +++++++++++++++++++++++++++++++ drivers/clk/sifive/sifive-prci.c | 23 +++++++++++++++++++++++ drivers/clk/sifive/sifive-prci.h | 8 ++++++++ 4 files changed, 78 insertions(+) diff --git a/drivers/clk/sifive/fu540-prci.h b/drivers/clk/sifive/fu540-prci.h index e0173324f3c5..9d2ca18f47a4 100644 --- a/drivers/clk/sifive/fu540-prci.h +++ b/drivers/clk/sifive/fu540-prci.h @@ -23,9 +23,24 @@ #include #include +#include #include "sifive-prci.h" +/** + * sifive_fu540_prci_ethernet_release_reset() - Release ethernet reset + * @pd: struct __prci_data * for the PRCI containing the Ethernet CLK mux reg + * + */ +static void sifive_fu540_prci_ethernet_release_reset(struct __prci_data *pd) +{ + /* Release GEMGXL reset */ + pd->reset.rcdev.ops->deassert(&pd->reset.rcdev, FU540_PRCI_RST_GEMGXL_N); + + /* Procmon => core clock */ + sifive_prci_set_procmoncfg(pd, PRCI_PROCMONCFG_CORE_CLOCK_MASK); +} + /* PRCI integration data for each WRPLL instance */ static struct __prci_wrpll_data sifive_fu540_prci_corepll_data = { @@ -43,6 +58,7 @@ static struct __prci_wrpll_data sifive_fu540_prci_ddrpll_data = { static struct __prci_wrpll_data sifive_fu540_prci_gemgxlpll_data = { .cfg0_offs = PRCI_GEMGXLPLLCFG0_OFFSET, .cfg1_offs = PRCI_GEMGXLPLLCFG1_OFFSET, + .release_reset = sifive_fu540_prci_ethernet_release_reset, }; /* Linux clock framework integration */ diff --git a/drivers/clk/sifive/fu740-prci.h b/drivers/clk/sifive/fu740-prci.h index f31cd30fc395..dd0f54277a99 100644 --- a/drivers/clk/sifive/fu740-prci.h +++ b/drivers/clk/sifive/fu740-prci.h @@ -10,9 +10,38 @@ #include #include +#include #include "sifive-prci.h" +/** + * sifive_fu740_prci_ethernet_release_reset() - Release ethernet reset + * @pd: struct __prci_data * for the PRCI containing the Ethernet CLK mux reg + * + */ +static void sifive_fu740_prci_ethernet_release_reset(struct __prci_data *pd) +{ + /* Release GEMGXL reset */ + pd->reset.rcdev.ops->deassert(&pd->reset.rcdev, FU740_PRCI_RST_GEMGXL_N); + + /* Procmon => core clock */ + sifive_prci_set_procmoncfg(pd, PRCI_PROCMONCFG_CORE_CLOCK_MASK); + + /* Release Chiplink reset */ + pd->reset.rcdev.ops->deassert(&pd->reset.rcdev, FU740_PRCI_RST_CLTX_N); +} + +/** + * sifive_fu740_prci_cltx_release_reset() - Release cltx reset + * @pd: struct __prci_data * for the PRCI containing the Ethernet CLK mux reg + * + */ +static void sifive_fu740_prci_cltx_release_reset(struct __prci_data *pd) +{ + /* Release CLTX reset */ + pd->reset.rcdev.ops->deassert(&pd->reset.rcdev, FU740_PRCI_RST_CLTX_N); +} + /* PRCI integration data for each WRPLL instance */ static struct __prci_wrpll_data sifive_fu740_prci_corepll_data = { @@ -30,6 +59,7 @@ static struct __prci_wrpll_data sifive_fu740_prci_ddrpll_data = { static struct __prci_wrpll_data sifive_fu740_prci_gemgxlpll_data = { .cfg0_offs = PRCI_GEMGXLPLLCFG0_OFFSET, .cfg1_offs = PRCI_GEMGXLPLLCFG1_OFFSET, + .release_reset = sifive_fu740_prci_ethernet_release_reset, }; static struct __prci_wrpll_data sifive_fu740_prci_dvfscorepll_data = { @@ -49,6 +79,7 @@ static struct __prci_wrpll_data sifive_fu740_prci_hfpclkpll_data = { static struct __prci_wrpll_data sifive_fu740_prci_cltxpll_data = { .cfg0_offs = PRCI_CLTXPLLCFG0_OFFSET, .cfg1_offs = PRCI_CLTXPLLCFG1_OFFSET, + .release_reset = sifive_fu740_prci_cltx_release_reset, }; /* Linux clock framework integration */ diff --git a/drivers/clk/sifive/sifive-prci.c b/drivers/clk/sifive/sifive-prci.c index caba0400f8a2..ae8055a84466 100644 --- a/drivers/clk/sifive/sifive-prci.c +++ b/drivers/clk/sifive/sifive-prci.c @@ -249,6 +249,9 @@ int sifive_prci_clock_enable(struct clk_hw *hw) if (pwd->disable_bypass) pwd->disable_bypass(pd); + if (pwd->release_reset) + pwd->release_reset(pd); + return 0; } @@ -448,6 +451,26 @@ void sifive_prci_hfpclkpllsel_use_hfpclkpll(struct __prci_data *pd) r = __prci_readl(pd, PRCI_HFPCLKPLLSEL_OFFSET); /* barrier */ } +/* + * PROCMONCFG + */ + +/** + * sifive_prci_set_procmoncfg() - set PROCMONCFG + * @pd: struct __prci_data * PRCI context + * @val: u32 value to write to PROCMONCFG register + * + * Set the PROCMONCFG register to @val + * + * Context: Any context. Caller must prevent concurrent changes to the + * PROCMONCFG_OFFSET register. + */ +void sifive_prci_set_procmoncfg(struct __prci_data *pd, u32 val) +{ + __prci_writel(val, PRCI_PROCMONCFG_OFFSET, pd); + __prci_readl(pd, PRCI_PROCMONCFG_OFFSET); /* barrier */ +} + /* PCIE AUX clock APIs for enable, disable. */ int sifive_prci_pcie_aux_clock_is_enabled(struct clk_hw *hw) { diff --git a/drivers/clk/sifive/sifive-prci.h b/drivers/clk/sifive/sifive-prci.h index 91658a88af4e..825a0aef9fd5 100644 --- a/drivers/clk/sifive/sifive-prci.h +++ b/drivers/clk/sifive/sifive-prci.h @@ -210,6 +210,9 @@ /* PROCMONCFG */ #define PRCI_PROCMONCFG_OFFSET 0xf0 +#define PRCI_PROCMONCFG_CORE_CLOCK_SHIFT 24 +#define PRCI_PROCMONCFG_CORE_CLOCK_MASK \ + (0x1 << PRCI_PROCMONCFG_CORE_CLOCK_SHIFT) /* * Private structures @@ -235,6 +238,7 @@ struct __prci_data { * @disable_bypass: fn ptr to code to not bypass the WRPLL (or NULL) * @cfg0_offs: WRPLL CFG0 register offset (in bytes) from the PRCI base address * @cfg1_offs: WRPLL CFG1 register offset (in bytes) from the PRCI base address + * @release_reset: fn ptr to code to release clock reset * * @enable_bypass and @disable_bypass are used for WRPLL instances * that contain a separate external glitchless clock mux downstream @@ -246,6 +250,7 @@ struct __prci_wrpll_data { void (*disable_bypass)(struct __prci_data *pd); u8 cfg0_offs; u8 cfg1_offs; + void (*release_reset)(struct __prci_data *pd); }; /** @@ -290,6 +295,9 @@ void sifive_prci_corepllsel_use_corepll(struct __prci_data *pd); void sifive_prci_hfpclkpllsel_use_hfclk(struct __prci_data *pd); void sifive_prci_hfpclkpllsel_use_hfpclkpll(struct __prci_data *pd); +/* PROCMONCFG */ +void sifive_prci_set_procmoncfg(struct __prci_data *pd, u32 val); + /* Linux clock framework integration */ long sifive_prci_wrpll_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *parent_rate);