From nobody Sun Apr 21 22:50:00 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VN3Vc4ljjz5Hxry; Sun, 21 Apr 2024 22:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VN3Vc4GsYz4HFL; Sun, 21 Apr 2024 22:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713739800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+hM6nqKcmKPWKRhhkRwdyqMsspo82CD8i4KQB8eWNjM=; b=lukNhvH8zk5sqO+ESuLmahpmky/2++GQEy+mxbdb9MINLzmXCviQhsS9VXNWAGoNlf0MCA RvpOkzOUE2GSASf6zzEucOByJWW2TfCOuhrF5pKawZLO3EFcnuRWt8OP5/FZCsFfiPc2kI axjmWr+Bxd9KKPiim0b1qYBKjf94urdnzU7CH/fzLptFs4NP+Kt1LgAPtm4yKmUNyTONcP LvBDzUg8Ogx1xDql/VW3YLodmSASI5jqE6IMHDMz/VsGuj5WvKGkzpWHIBiQI18PqqTZNA gl5GATDud0p2EiSKvqHvjsnU1Y49UfcVJ0zw26+0jBnhZNn80zjRvQIEKwaHNw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713739800; a=rsa-sha256; cv=none; b=F+HokaUFXk/NMfEqSeC0V3wwWF+xKUhXjXDGdOoIZ7JhsKIackbnuJzYWhVBeUjec5wLEd IpDc7Ys0qjf4/+NXRJubKsWwBstP8YI327X6syJK4mtV6fD4yXwhUUt1+pF/T7bhfrp2Ys pLmx89zvAipvooNp2lSka7fOvi7cdQjIrlFSjaSvy2C848xhTErhInS4GDUBSQCYJGyl6Q f5wa8YgVyYYkbteUVa4UpBqjM7Vx7cS3Vuot30B8kx6sgT/tQltPDTQ955cCq/hiTEkVPL ffhUwoWhEmYhrpCjWdcIBT/lE2//3QOn0ZJrRoE/YTEMYTO4QBePlI43Dw6dbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713739800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+hM6nqKcmKPWKRhhkRwdyqMsspo82CD8i4KQB8eWNjM=; b=Eydlhs+uet9h+//4ecK7fMs0ZBXOaPux7U43y4BMi0vWaLkWYfiq055dX8pNXrlRefziuS 2KDNg1eZTziM7VkHfiKkChXNhzRQL45QYhb5Ew3ii/jDfgiCORPuw8tCUTGL+cyqmEJnn5 SEqWCMesK16uRgnWnHzL3PCDZlDBYWZLABVC7e+uq7clpatmI9Jkqixy8gSHoiMlsLcIkB 7sn+UHrRXG+NNGzeSzUSB6f+ONSeVyWEFtGe26vQLjSsHYRVlSPRwgY5hyv5lA585fAOEP eQ9CjM7UvL1zqYtLS7iS7epXcTMKo+39v6uApc1ioOpdZLogx+0n3a9zklaclw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VN3Vc3st5zP0y; Sun, 21 Apr 2024 22:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43LMo0g6001192; Sun, 21 Apr 2024 22:50:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43LMo0pg001170; Sun, 21 Apr 2024 22:50:00 GMT (envelope-from git) Date: Sun, 21 Apr 2024 22:50:00 GMT Message-Id: <202404212250.43LMo0pg001170@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 10e0c34bf842 - main - Enable L1SS handling on RPI4 pcib List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 10e0c34bf842885b4bd78adbbdbd7fb00f133cb5 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=10e0c34bf842885b4bd78adbbdbd7fb00f133cb5 commit 10e0c34bf842885b4bd78adbbdbd7fb00f133cb5 Author: HP van Braam AuthorDate: 2024-04-16 23:01:20 +0000 Commit: Ed Maste CommitDate: 2024-04-21 22:34:05 +0000 Enable L1SS handling on RPI4 pcib Thanks to @kevans91 for pointing me in the right direction. FreeBSD had the same bug as Linux (see https://bugzilla.kernel.org/show_bug.cgi?id=217276) where the ultimate solution was to honor the brcm,enable-l1ss FDT property. In current versions of the dtb files this property has been added by default. Without this on many, many pcie addin cards the pcib will Serror when trying to assert the clreq# pin on the pcie bus. Many cards do not have these hooked up. PR: 260131, 277638, 277605 Reviewed-by: emaste Signed-off-by: HP van Braam Pull-request: https://github.com/freebsd/freebsd-src/pull/1179 --- sys/arm/broadcom/bcm2835/bcm2838_pci.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/sys/arm/broadcom/bcm2835/bcm2838_pci.c b/sys/arm/broadcom/bcm2835/bcm2838_pci.c index 921d675aae4d..f5304525a6fb 100644 --- a/sys/arm/broadcom/bcm2835/bcm2838_pci.c +++ b/sys/arm/broadcom/bcm2835/bcm2838_pci.c @@ -60,7 +60,7 @@ #define REG_BRIDGE_CTRL 0x9210 #define BRIDGE_DISABLE_FLAG 0x1 #define BRIDGE_RESET_FLAG 0x2 -#define REG_BRIDGE_SERDES_MODE 0x4204 +#define REG_PCIE_HARD_DEBUG 0x4204 #define REG_DMA_CONFIG 0x4008 #define REG_DMA_WINDOW_LOW 0x4034 #define REG_DMA_WINDOW_HIGH 0x4038 @@ -86,6 +86,9 @@ #define REG_EP_CONFIG_CHOICE 0x9000 #define REG_EP_CONFIG_DATA 0x8000 +#define L1SS_ENABLE 0x00200000 +#define CLKREQ_ENABLE 0x2 + /* * The system memory controller can address up to 16 GiB of physical memory * (although at time of writing the largest memory size available for purchase @@ -190,7 +193,7 @@ bcm_pcib_reset_controller(struct bcm_pcib_softc *sc) DELAY(100); - bcm_pcib_set_reg(sc, REG_BRIDGE_SERDES_MODE, 0); + bcm_pcib_set_reg(sc, REG_PCIE_HARD_DEBUG, 0); DELAY(100); } @@ -613,7 +616,7 @@ bcm_pcib_attach(device_t dev) struct bcm_pcib_softc *sc; pci_addr_t phys_base, pci_base; bus_size_t size; - uint32_t hardware_rev, bridge_state, link_state; + uint32_t hardware_rev, bridge_state, link_state, tmp; int error, tries; sc = device_get_softc(dev); @@ -719,7 +722,18 @@ bcm_pcib_attach(device_t dev) bcm_pcib_set_reg(sc, PCI_ID_VAL3, PCIC_BRIDGE << CLASS_SHIFT | PCIS_BRIDGE_PCI << SUBCLASS_SHIFT); - bcm_pcib_set_reg(sc, REG_BRIDGE_SERDES_MODE, 0x2); + tmp = bcm_pcib_read_reg(sc, REG_PCIE_HARD_DEBUG); + tmp |= CLKREQ_ENABLE; + + if (ofw_bus_has_prop(dev, "brcm,enable-l1ss")) { + if (bootverbose) + device_printf(dev, "note: enabling L1SS due to OF " + "property brcm,enable-l1ss\n"); + + tmp |= L1SS_ENABLE; + } + + bcm_pcib_set_reg(sc, REG_PCIE_HARD_DEBUG, tmp); DELAY(100); bcm_pcib_relocate_bridge_window(dev);