From nobody Wed Nov 27 03:46:11 2024 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AB3D1A4F20; Mon, 14 Oct 2024 13:07:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911257; cv=none; b=b6XJU3f4kk7M8LxJII7fPBpJHA0ueqZcpyg3IM8/OkirOly1P0xaRWe+MzxiBjwggXBYFhRNDbYPmMfg8sAlar1V4YJhLexv3FkaE+1DIUcAkI2CzHiADT64lutA8AUYoyIrkFxRq3q6HIg+inUQeynb9ffNb3eDNksH9lU+nmE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911257; c=relaxed/simple; bh=z6sB3e8cc5d1kVSrrj6PiNW1NIw+ViPa5TrND5u+Gdg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mAj7aGSjUpaU3eTnvPUjKLjz6tOc7x4ZA/VynerET5VxX1Yy39TMnz4eZwDVxbY1oxz48F3jdgk3dJUlWUK+yozlHZbbJgi70xRW65V9qpf07lCo9dFezgLOgD2Vd8uJOi2HPJdzJt0BQq7gF6rl2YGPi251RFOLYrZVoCJsiPQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=LyCcFPnd; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=xLRKonVj; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=LyCcFPnd; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=xLRKonVj; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="LyCcFPnd"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="xLRKonVj"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="LyCcFPnd"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="xLRKonVj" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 837191FE53; Mon, 14 Oct 2024 13:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911253; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9tl+ijzx8t0Wm+xYDI9MH7aQKiAFkxvERDwPC/kdMac=; b=LyCcFPnd7IPjfQPVm1777mM8KM/iLCIYxrnwfPIIITlPdWwmaN5VDpU7MPo1WZf44ZTfSP rTgBKBX+KQwrBq1U/IYnZ/0zoqjGgT7AckuE5lXymr/dylI29PGpaz8JrOV8djUtZPlZCg ApRb7wIs5qcqtnkJDFsDToST4kA2yYA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911253; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9tl+ijzx8t0Wm+xYDI9MH7aQKiAFkxvERDwPC/kdMac=; b=xLRKonVj4zdi/X4TAsFFa29y3S+CluFj9r8vFHsiA46oAo5H4zWyy0BIHJEenCaYMgLHNs C9JVs+74JC7mvNDg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911253; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9tl+ijzx8t0Wm+xYDI9MH7aQKiAFkxvERDwPC/kdMac=; b=LyCcFPnd7IPjfQPVm1777mM8KM/iLCIYxrnwfPIIITlPdWwmaN5VDpU7MPo1WZf44ZTfSP rTgBKBX+KQwrBq1U/IYnZ/0zoqjGgT7AckuE5lXymr/dylI29PGpaz8JrOV8djUtZPlZCg ApRb7wIs5qcqtnkJDFsDToST4kA2yYA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911253; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9tl+ijzx8t0Wm+xYDI9MH7aQKiAFkxvERDwPC/kdMac=; b=xLRKonVj4zdi/X4TAsFFa29y3S+CluFj9r8vFHsiA46oAo5H4zWyy0BIHJEenCaYMgLHNs C9JVs+74JC7mvNDg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 753F513A79; Mon, 14 Oct 2024 13:07:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id eBFDGpQXDWcqTwAAD6G6ig (envelope-from ); Mon, 14 Oct 2024 13:07:32 +0000 From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Broadcom internal kernel review list Cc: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , kw@linux.com, Philipp Zabel , Andrea della Porta , Phil Elwell , Jonathan Bell , Stanimir Varbanov Subject: [PATCH v3 01/11] dt-bindings: interrupt-controller: Add bcm2712 MSI-X DT bindings Date: Mon, 14 Oct 2024 16:07:00 +0300 Message-ID: <20241014130710.413-2-svarbanov@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014130710.413-1-svarbanov@suse.de> References: <20241014130710.413-1-svarbanov@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.30 X-Spamd-Result: default: False [-1.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWELVE(0.00)[21]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_CC(0.00)[linutronix.de,kernel.org,broadcom.com,gmail.com,google.com,linux.com,pengutronix.de,suse.com,raspberrypi.com,suse.de]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TAGGED_RCPT(0.00)[dt]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Flag: NO X-Spam-Level: Content-Type: text/plain; charset="utf-8" Adds DT bindings for bcm2712 MSI-X interrupt peripheral controller. Signed-off-by: Stanimir Varbanov Reviewed-by: Rob Herring (Arm) --- v2 -> v3: - dropped '>' from the description entry (Rob) - dropped interrupt-controller and interrupt-cells properties (Rob) - dropped msi-controller and use 'unevaluatedProperties' (Rob) - use const: 0 in msi-cells (Rob) - dropped msi-ranges property (Rob) - re-introduce brcm,msi-offset private property,=20 which looks unavoidable at that time .../brcm,bcm2712-msix.yaml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/= brcm,bcm2712-msix.yaml diff --git a/Documentation/devicetree/bindings/interrupt-controller/brcm,bc= m2712-msix.yaml b/Documentation/devicetree/bindings/interrupt-controller/br= cm,bcm2712-msix.yaml new file mode 100644 index 000000000000..c84614663b5d --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2712-m= six.yaml @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/brcm,bcm2712-msix.= yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom bcm2712 MSI-X Interrupt Peripheral support + +maintainers: + - Stanimir Varbanov + +description: + This interrupt controller is used to provide interrupt vectors to the + generic interrupt controller (GIC) on bcm2712. It will be used as + external MSI-X controller for PCIe root complex. + +allOf: + - $ref: /schemas/interrupt-controller/msi-controller.yaml# + +properties: + compatible: + const: brcm,bcm2712-mip + + reg: + items: + - description: Base register address + - description: PCIe message address + + "#msi-cells": + const: 0 + + brcm,msi-offset: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Shift the allocated MSI's. + +unevaluatedProperties: false + +required: + - compatible + - reg + - msi-controller + - msi-ranges + +examples: + - | + #include + + axi { + #address-cells =3D <2>; + #size-cells =3D <2>; + + msi-controller@1000130000 { + compatible =3D "brcm,bcm2712-mip"; + reg =3D <0x10 0x00130000 0x00 0xc0>, + <0xff 0xfffff000 0x00 0x1000>; + msi-controller; + #msi-cells =3D <0>; + msi-ranges =3D <&gicv2 GIC_SPI 128 IRQ_TYPE_EDGE_RISING 64>; + }; + }; --=20 2.43.0 From nobody Wed Nov 27 03:46:11 2024 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 664A11AA7BF; Mon, 14 Oct 2024 13:07:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911258; cv=none; b=Zdv/c4ODt72KL/rAtahWRIzPH5Bd2iDeQ/mNIspCmCH/1KZPld3Vi5tpysCgc/HJNQF3NjyOxcu9axVSii8cfwSjEisTJo4bWJbc0OG1iyZq0bPXmL/6InDj0Ix6wxapLA223c7lPQIk9STtqmTY3u4Svz6pFloOI0obJo0ruLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911258; c=relaxed/simple; bh=Vg83u49UwAxaabf4t/R4xzbWBzJ+2T7NgmUe2P23TkE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NFNEQTMcbFJHKwmqslZmgbPlJAu5QOjKkSngIMb2qlyQWm17vr0SQa22ezP/PxROV6d/yjUnGSMKuCi3YX2Kp32Fhh9IZ1xM54INy8PhDwDpgbzis09tiGcx9f6Vhr6x6llmgc1yOsYSjndoHArP/0okoRs+cVHyL9kdHt7Ln4A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=OT8O0qow; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=9tnAkSal; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=OT8O0qow; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=9tnAkSal; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="OT8O0qow"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="9tnAkSal"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="OT8O0qow"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="9tnAkSal" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7E89D1FE55; Mon, 14 Oct 2024 13:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911254; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zQQCuAZgUA0ZS2BddMPfeF3ByHWicC4N3TsbURbed0Y=; b=OT8O0qow8SJnU4rlrM75cajtggrAJQcoXCljMS/GN5JteVE2JWhxIwoNNYsFEKHoSXHNYW DP0mqFdxTsxWuD9L0+YdU1GCEQp7zNKaYYSVvfE6FzTQjYCDElcYiMqnwJj8EmjZstQ7pO 5vrpRq3qBdUekY4B/hZwgXAAxCLOHMk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911254; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zQQCuAZgUA0ZS2BddMPfeF3ByHWicC4N3TsbURbed0Y=; b=9tnAkSalx0tYxdTJe/lZMYZjayV2SmqfRsirmezlz8wUwbcJ5psrf5JS6NBGKpT6aNj9XU haAch/cyb4Lc0qBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911254; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zQQCuAZgUA0ZS2BddMPfeF3ByHWicC4N3TsbURbed0Y=; b=OT8O0qow8SJnU4rlrM75cajtggrAJQcoXCljMS/GN5JteVE2JWhxIwoNNYsFEKHoSXHNYW DP0mqFdxTsxWuD9L0+YdU1GCEQp7zNKaYYSVvfE6FzTQjYCDElcYiMqnwJj8EmjZstQ7pO 5vrpRq3qBdUekY4B/hZwgXAAxCLOHMk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911254; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zQQCuAZgUA0ZS2BddMPfeF3ByHWicC4N3TsbURbed0Y=; b=9tnAkSalx0tYxdTJe/lZMYZjayV2SmqfRsirmezlz8wUwbcJ5psrf5JS6NBGKpT6aNj9XU haAch/cyb4Lc0qBw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 868A713A42; Mon, 14 Oct 2024 13:07:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id SMJ3HpUXDWcqTwAAD6G6ig (envelope-from ); Mon, 14 Oct 2024 13:07:33 +0000 From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Broadcom internal kernel review list Cc: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , kw@linux.com, Philipp Zabel , Andrea della Porta , Phil Elwell , Jonathan Bell , Stanimir Varbanov Subject: [PATCH v3 02/11] dt-bindings: PCI: brcmstb: Update bindings for PCIe on bcm2712 Date: Mon, 14 Oct 2024 16:07:01 +0300 Message-ID: <20241014130710.413-3-svarbanov@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014130710.413-1-svarbanov@suse.de> References: <20241014130710.413-1-svarbanov@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.30 X-Spamd-Result: default: False [-1.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[dt]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; RCPT_COUNT_TWELVE(0.00)[21]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_CC(0.00)[linutronix.de,kernel.org,broadcom.com,gmail.com,google.com,linux.com,pengutronix.de,suse.com,raspberrypi.com,suse.de]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; R_RATELIMIT(0.00)[to_ip_from(RL7mwea5a3cdyragbzqhrtit3y)]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Flag: NO X-Spam-Level: Content-Type: text/plain; charset="utf-8" Update brcmstb PCIe controller bindings with bcm2712 compatible and add new resets. Signed-off-by: Stanimir Varbanov Reviewed-by: Florian Fainelli Acked-by: Rob Herring (Arm) --- v2 -> v3: - Added Reviewed-by/Acked-by tags. Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Doc= umentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 0925c520195a..8517dd9510ef 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -14,6 +14,7 @@ properties: items: - enum: - brcm,bcm2711-pcie # The Raspberry Pi 4 + - brcm,bcm2712-pcie # Raspberry Pi 5 - brcm,bcm4908-pcie - brcm,bcm7211-pcie # Broadcom STB version of RPi4 - brcm,bcm7216-pcie # Broadcom 7216 Arm @@ -158,7 +159,9 @@ allOf: properties: compatible: contains: - const: brcm,bcm7712-pcie + enum: + - brcm,bcm7712-pcie + - brcm,bcm2712-pcie then: properties: resets: --=20 2.43.0 From nobody Wed Nov 27 03:46:11 2024 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 782E11AAE19; Mon, 14 Oct 2024 13:07:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911259; cv=none; b=LWELIlm8y5k4dQd5vE9m4iko4IOBTfqC5Bd00kTbjBjYQFDPkSSymlqyZGydvxSQs4z1x6GktDpHrwUApRMIj/VI2WVmuTnfu6AMMRvORUZJndF+kHx6D+Z5h9t/mOqryaLEda0ypKlCu8CHR4THq+Yw2We331WihF1wFM3jMk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911259; c=relaxed/simple; bh=umW7E3c0IONdKjtw45huondRkDPGw3nZmBLbIDWxjdk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m20irbzYecbzwRVW/PYJuDi4+z6/C1LTyLiD4hGqQKGuWMkoSpz4A/Ns2Q2h8Nss5CFwQig/uSbhti/603wW+eh8KDhLemHRSf/XqHxFlyyx0jL2ZTXAjiFPUFXHjOoee4dbk1EvvPHxD110zQzycja4WqRIDlZ1Ge15d7OCgoE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=VSsO4La7; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=gQaXu1hv; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=VSsO4La7; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=gQaXu1hv; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="VSsO4La7"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="gQaXu1hv"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="VSsO4La7"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="gQaXu1hv" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 989EC21D42; Mon, 14 Oct 2024 13:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911255; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pIEeU1hAcE/BLDLKWl8mlq07XfHSZnCzIuU5q5eyXpI=; b=VSsO4La7sOYcpSxZeQWdKjy4OxHfhoUQb7fC7dCZSBLFZhKjQQ+YDq/73/Qwucx0Lhg6sj /aruLpcOyQwWkRoW21pgXIyyeMCvsOYGx8vALMUAlbDyOMoXRP/3DrHJdkhB2N/jQqbYy6 zAlNEgYX5j5dzWk/Oa9J6I1C+cHz0CY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911255; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pIEeU1hAcE/BLDLKWl8mlq07XfHSZnCzIuU5q5eyXpI=; b=gQaXu1hv+wv4Ye273yhC8B/020YLeygnGlPQRZnKfnJ0oRSkB6+E60h0pI4E4chK2qEMjI 5lHATCliDvxyQ8Cw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=VSsO4La7; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=gQaXu1hv DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911255; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pIEeU1hAcE/BLDLKWl8mlq07XfHSZnCzIuU5q5eyXpI=; b=VSsO4La7sOYcpSxZeQWdKjy4OxHfhoUQb7fC7dCZSBLFZhKjQQ+YDq/73/Qwucx0Lhg6sj /aruLpcOyQwWkRoW21pgXIyyeMCvsOYGx8vALMUAlbDyOMoXRP/3DrHJdkhB2N/jQqbYy6 zAlNEgYX5j5dzWk/Oa9J6I1C+cHz0CY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911255; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pIEeU1hAcE/BLDLKWl8mlq07XfHSZnCzIuU5q5eyXpI=; b=gQaXu1hv+wv4Ye273yhC8B/020YLeygnGlPQRZnKfnJ0oRSkB6+E60h0pI4E4chK2qEMjI 5lHATCliDvxyQ8Cw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A452413A79; Mon, 14 Oct 2024 13:07:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id MAlMIJYXDWcqTwAAD6G6ig (envelope-from ); Mon, 14 Oct 2024 13:07:34 +0000 From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Broadcom internal kernel review list Cc: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , kw@linux.com, Philipp Zabel , Andrea della Porta , Phil Elwell , Jonathan Bell , Stanimir Varbanov Subject: [PATCH v3 03/11] irqchip: mip: Add Broadcom bcm2712 MSI-X interrupt controller Date: Mon, 14 Oct 2024 16:07:02 +0300 Message-ID: <20241014130710.413-4-svarbanov@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014130710.413-1-svarbanov@suse.de> References: <20241014130710.413-1-svarbanov@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 989EC21D42 X-Spam-Score: -1.51 X-Rspamd-Action: no action X-Spamd-Result: default: False [-1.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_TWELVE(0.00)[21]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_CC(0.00)[linutronix.de,kernel.org,broadcom.com,gmail.com,google.com,linux.com,pengutronix.de,suse.com,raspberrypi.com,suse.de]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[dt]; DKIM_TRACE(0.00)[suse.de:+]; R_RATELIMIT(0.00)[to_ip_from(RLw7mkaud87zuqqztkur5718rm)]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Flag: NO X-Spam-Level: Content-Type: text/plain; charset="utf-8" Add an interrupt controller driver for MSI-X Interrupt Peripheral (MIP) hardware block found in bcm2712. The interrupt controller is used to handle MSI-X interrupts from peripherials behind PCIe endpoints like RP1 south bridge found in RPi5. There are two MIPs on bcm2712, the first has 64 consecutive SPIs assigned to 64 output vectors, and the second has 17 SPIs, but only 8 of them are consecutive starting at the 8th output vector. Signed-off-by: Stanimir Varbanov --- v2 -> v3: - converted to MSI-parent. - parse re-introduced brcm,msi-offset DT property. - use of IRQCHIP_PLATFORM_DRIVER macros to avoid interrupt-controller from DT node. drivers/irqchip/Kconfig | 16 ++ drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-bcm2712-mip.c | 308 ++++++++++++++++++++++++++++++ 3 files changed, 325 insertions(+) create mode 100644 drivers/irqchip/irq-bcm2712-mip.c diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 341cd9ca5a05..c9bd0a4f6871 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -116,6 +116,22 @@ config I8259 bool select IRQ_DOMAIN =20 +config BCM2712_MIP + tristate "Broadcom BCM2712 MSI-X Interrupt Peripheral support" + depends on ARCH_BRCMSTB || COMPILE_TEST + default m if ARCH_BRCMSTB + depends on ARM_GIC + select GENERIC_IRQ_CHIP + select IRQ_DOMAIN_HIERARCHY + select GENERIC_MSI_IRQ + select IRQ_MSI_LIB + help + Enable support for the Broadcom BCM2712 MSI-X target peripheral + (MIP) needed by brcmstb PCIe to handle MSI-X interrupts on + Raspberry Pi 5. + + If unsure say n. + config BCM6345_L1_IRQ bool select GENERIC_IRQ_CHIP diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index e3679ec2b9f7..a11307b1b610 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -62,6 +62,7 @@ obj-$(CONFIG_XTENSA_MX) +=3D irq-xtensa-mx.o obj-$(CONFIG_XILINX_INTC) +=3D irq-xilinx-intc.o obj-$(CONFIG_IRQ_CROSSBAR) +=3D irq-crossbar.o obj-$(CONFIG_SOC_VF610) +=3D irq-vf610-mscm-ir.o +obj-$(CONFIG_BCM2712_MIP) +=3D irq-bcm2712-mip.o obj-$(CONFIG_BCM6345_L1_IRQ) +=3D irq-bcm6345-l1.o obj-$(CONFIG_BCM7038_L1_IRQ) +=3D irq-bcm7038-l1.o obj-$(CONFIG_BCM7120_L2_IRQ) +=3D irq-bcm7120-l2.o diff --git a/drivers/irqchip/irq-bcm2712-mip.c b/drivers/irqchip/irq-bcm271= 2-mip.c new file mode 100644 index 000000000000..14f0369a7d10 --- /dev/null +++ b/drivers/irqchip/irq-bcm2712-mip.c @@ -0,0 +1,308 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2024 Raspberry Pi Ltd., All Rights Reserved. + * Copyright (c) 2024 SUSE + */ + +#include +#include +#include +#include +#include +#include + +#include "irq-msi-lib.h" + +#define MIP_INT_RAISE 0x00 +#define MIP_INT_CLEAR 0x10 +#define MIP_INT_CFGL_HOST 0x20 +#define MIP_INT_CFGH_HOST 0x30 +#define MIP_INT_MASKL_HOST 0x40 +#define MIP_INT_MASKH_HOST 0x50 +#define MIP_INT_MASKL_VPU 0x60 +#define MIP_INT_MASKH_VPU 0x70 +#define MIP_INT_STATUSL_HOST 0x80 +#define MIP_INT_STATUSH_HOST 0x90 +#define MIP_INT_STATUSL_VPU 0xa0 +#define MIP_INT_STATUSH_VPU 0xb0 + +/** + * struct mip_priv - MSI-X interrupt controller data + * @lock: Used to protect bitmap alloc/free + * @base: Base address of MMIO area + * @msg_addr: PCIe MSI-X address + * @msi_base: MSI base + * @num_msis: Count of MSIs + * @msi_offset: MSI offset + * @bitmap: A bitmap for hwirqs + * @parent: Parent domain (GIC) + */ +struct mip_priv { + spinlock_t lock; + void __iomem *base; + u64 msg_addr; + u32 msi_base; + u32 num_msis; + u32 msi_offset; + unsigned long *bitmap; + struct irq_domain *parent; + struct device *dev; +}; + +static void mip_compose_msi_msg(struct irq_data *d, struct msi_msg *msg) +{ + struct mip_priv *mip =3D irq_data_get_irq_chip_data(d); + + msg->address_hi =3D upper_32_bits(mip->msg_addr); + msg->address_lo =3D lower_32_bits(mip->msg_addr); + msg->data =3D d->hwirq; +} + +static struct irq_chip mip_middle_irq_chip =3D { + .name =3D "MIP", + .irq_mask =3D irq_chip_mask_parent, + .irq_unmask =3D irq_chip_unmask_parent, + .irq_eoi =3D irq_chip_eoi_parent, + .irq_set_affinity =3D irq_chip_set_affinity_parent, + .irq_set_type =3D irq_chip_set_type_parent, + .irq_compose_msi_msg =3D mip_compose_msi_msg, +}; + +static int mip_alloc_hwirq(struct mip_priv *mip, unsigned int nr_irqs, + unsigned int *hwirq) +{ + int bit; + + spin_lock(&mip->lock); + bit =3D bitmap_find_free_region(mip->bitmap, mip->num_msis, + ilog2(nr_irqs)); + spin_unlock(&mip->lock); + + if (bit < 0) + return bit; + + if (hwirq) + *hwirq =3D bit; + + return 0; +} + +static void mip_free_hwirq(struct mip_priv *mip, unsigned int hwirq, + unsigned int nr_irqs) +{ + spin_lock(&mip->lock); + bitmap_release_region(mip->bitmap, hwirq, ilog2(nr_irqs)); + spin_unlock(&mip->lock); +} + +static int mip_middle_domain_alloc(struct irq_domain *domain, unsigned int= virq, + unsigned int nr_irqs, void *arg) +{ + struct mip_priv *mip =3D domain->host_data; + struct irq_fwspec fwspec =3D {0}; + struct irq_data *irqd; + unsigned int hwirq, irq, i; + int ret; + + ret =3D mip_alloc_hwirq(mip, nr_irqs, &irq); + if (ret < 0) + return ret; + + hwirq =3D irq + mip->msi_offset; + + fwspec.fwnode =3D domain->parent->fwnode; + fwspec.param_count =3D 3; + fwspec.param[0] =3D 0; + fwspec.param[1] =3D hwirq + mip->msi_base; + fwspec.param[2] =3D IRQ_TYPE_EDGE_RISING; + + ret =3D irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &fwspec); + if (ret) { + mip_free_hwirq(mip, irq, nr_irqs); + return ret; + } + + for (i =3D 0; i < nr_irqs; i++) { + irqd =3D irq_domain_get_irq_data(domain->parent, virq + i); + irqd->chip->irq_set_type(irqd, IRQ_TYPE_EDGE_RISING); + + ret =3D irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i, + &mip_middle_irq_chip, mip); + if (ret) + goto err_free; + + irqd =3D irq_get_irq_data(virq + i); + irqd_set_single_target(irqd); + irqd_set_affinity_on_activate(irqd); + } + + return 0; + +err_free: + irq_domain_free_irqs_parent(domain, virq, nr_irqs); + mip_free_hwirq(mip, irq, nr_irqs); + return ret; +} + +static void mip_middle_domain_free(struct irq_domain *domain, unsigned int= virq, + unsigned int nr_irqs) +{ + struct irq_data *irqd =3D irq_domain_get_irq_data(domain, virq); + struct mip_priv *mip; + unsigned int hwirq; + + if (!irqd) + return; + + mip =3D irq_data_get_irq_chip_data(irqd); + hwirq =3D irqd_to_hwirq(irqd); + irq_domain_free_irqs_parent(domain, virq, nr_irqs); + mip_free_hwirq(mip, hwirq - mip->msi_offset, nr_irqs); +} + +static const struct irq_domain_ops mip_middle_domain_ops =3D { + .select =3D msi_lib_irq_domain_select, + .alloc =3D mip_middle_domain_alloc, + .free =3D mip_middle_domain_free, +}; + +#define MIP_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ + MSI_FLAG_USE_DEF_CHIP_OPS | \ + MSI_FLAG_PCI_MSI_MASK_PARENT | \ + MSI_FLAG_PCI_MSIX) + +#define MIP_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \ + MSI_FLAG_PCI_MSIX | \ + IRQ_DOMAIN_FLAG_MSI_PARENT) + +static const struct msi_parent_ops mip_msi_parent_ops =3D { + .supported_flags =3D MIP_MSI_FLAGS_SUPPORTED, + .required_flags =3D MIP_MSI_FLAGS_REQUIRED, + .bus_select_token =3D DOMAIN_BUS_PCI_MSI, + .bus_select_mask =3D MATCH_PCI_MSI, + .prefix =3D "MIP-MSI-", + .init_dev_msi_info =3D msi_lib_init_dev_msi_info, +}; + +static int mip_init_domains(struct mip_priv *mip, struct device_node *np) +{ + struct irq_domain *middle; + + middle =3D irq_domain_add_hierarchy(mip->parent, 0, mip->num_msis, np, + &mip_middle_domain_ops, mip); + if (!middle) + return -ENOMEM; + + irq_domain_update_bus_token(middle, DOMAIN_BUS_PCI_MSI); + middle->dev =3D mip->dev; + middle->flags |=3D IRQ_DOMAIN_FLAG_MSI_PARENT; + middle->msi_parent_ops =3D &mip_msi_parent_ops; + + return 0; +} + +static int mip_parse_dt(struct mip_priv *mip, struct device_node *np) +{ + struct of_phandle_args args; + u64 size; + int ret; + + ret =3D of_property_read_u32(np, "brcm,msi-offset", &mip->msi_offset); + if (ret) + mip->msi_offset =3D 0; + + ret =3D of_parse_phandle_with_args(np, "msi-ranges", "#interrupt-cells", + 0, &args); + if (ret) + return ret; + + ret =3D of_property_read_u32_index(np, "msi-ranges", args.args_count + 1, + &mip->num_msis); + if (ret) + goto err_put; + + ret =3D of_property_read_reg(np, 1, &mip->msg_addr, &size); + if (ret) + goto err_put; + + mip->msi_base =3D args.args[1]; + + mip->parent =3D irq_find_host(args.np); + if (!mip->parent) + ret =3D -EINVAL; + +err_put: + of_node_put(args.np); + return ret; +} + +static int __init mip_of_msi_init(struct device_node *node, + struct device_node *parent) +{ + struct platform_device *pdev; + struct mip_priv *mip; + int ret; + + pdev =3D of_find_device_by_node(node); + of_node_put(node); + if (!pdev) + return -EPROBE_DEFER; + + mip =3D kzalloc(sizeof(*mip), GFP_KERNEL); + if (!mip) + return -ENOMEM; + + spin_lock_init(&mip->lock); + mip->dev =3D &pdev->dev; + + ret =3D mip_parse_dt(mip, node); + if (ret) + goto err_priv; + + mip->base =3D of_iomap(node, 0); + if (!mip->base) { + ret =3D -ENXIO; + goto err_priv; + } + + mip->bitmap =3D bitmap_zalloc(mip->num_msis, GFP_KERNEL); + if (!mip->bitmap) { + ret =3D -ENOMEM; + goto err_base; + } + + /* + * All MSI-X masked in for the host, masked out for the + * VPU, and edge-triggered. + */ + writel(0, mip->base + MIP_INT_MASKL_HOST); + writel(0, mip->base + MIP_INT_MASKH_HOST); + writel(~0, mip->base + MIP_INT_MASKL_VPU); + writel(~0, mip->base + MIP_INT_MASKH_VPU); + writel(~0, mip->base + MIP_INT_CFGL_HOST); + writel(~0, mip->base + MIP_INT_CFGH_HOST); + + ret =3D mip_init_domains(mip, node); + if (ret) + goto err_map; + + dev_dbg(&pdev->dev, + "MIP: MSI-X count: %u, base: %u, offset: %u, msg_addr: %llx\n", + mip->num_msis, mip->msi_base, mip->msi_offset, mip->msg_addr); + + return 0; + +err_map: + bitmap_free(mip->bitmap); +err_base: + iounmap(mip->base); +err_priv: + kfree(mip); + return ret; +} + +IRQCHIP_PLATFORM_DRIVER_BEGIN(mip_msi) +IRQCHIP_MATCH("brcm,bcm2712-mip", mip_of_msi_init) +IRQCHIP_PLATFORM_DRIVER_END(mip_msi) +MODULE_DESCRIPTION("Broadcom BCM2712 MSI interrupt controller"); +MODULE_LICENSE("GPL"); --=20 2.43.0 From nobody Wed Nov 27 03:46:11 2024 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 860D61AB508; Mon, 14 Oct 2024 13:07:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911260; cv=none; b=g6YofNmIFT1U3eXQak4FBkNi7AZ/6Oq21rb1jFFA8pEhbE0lwsEO6de12FGRfxl7VHQkKEqIqZGHhXZuNVyu5SZ8V2pFqt+vtYlaBrT7gDE/Ajz2eJ4O96gDqx1vjrKvOSfIf6K7LYdkpie0XJtab/gAY0QJ8U6tHfK5h4iy4eU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911260; c=relaxed/simple; bh=9BTRwWkPM2WPp5j1i5kzqC7QIFL1b8FvDjCOakdpO3o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tHxQMrustCAt0AXULkiM8YWW0fjF5AbjOj2u5aiB+knbcff/1lN5BNuTohL2YJ5LORirGzePeJzPrJL44FcLZK/XV8tYZb6Fu+OEJe6JCELc0IogonJ1zDTb1dehnRrm+C/NUv9lvM8jivcEJog+z0UjP1fkh0hWxLl6H/gN3Rw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=RMWpEqQr; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=9VP4hrHH; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=RMWpEqQr; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=9VP4hrHH; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="RMWpEqQr"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="9VP4hrHH"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="RMWpEqQr"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="9VP4hrHH" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B67071FE61; Mon, 14 Oct 2024 13:07:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V2CRT0BA7K09BgT5YL2JQfhcvweXAfO6F7Tmt9UwGBs=; b=RMWpEqQrTz5dWbeRcC2GsLzQ24HBXqs8SlVufV1NMeeEkT7m7DG5JVFbTeTu/SEyiOeqCS 2LNwUdmdMyKtCCW/NAXI33Yb4Pp2RU+NomZezBXy9M8G8wb8KSNyRNfcBee6T9h7A0KBDb /D9K3IIZGzNDzLfVO+dt+CItxHmVMeE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V2CRT0BA7K09BgT5YL2JQfhcvweXAfO6F7Tmt9UwGBs=; b=9VP4hrHHVbM2n+KgaSy4/OZLkGoFHq1tsbY/0lCNoBGcfTjQ7c+MlxXo0T/HxFqt58Mn3j bwoUZGcVHdFqPACA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=RMWpEqQr; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=9VP4hrHH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V2CRT0BA7K09BgT5YL2JQfhcvweXAfO6F7Tmt9UwGBs=; b=RMWpEqQrTz5dWbeRcC2GsLzQ24HBXqs8SlVufV1NMeeEkT7m7DG5JVFbTeTu/SEyiOeqCS 2LNwUdmdMyKtCCW/NAXI33Yb4Pp2RU+NomZezBXy9M8G8wb8KSNyRNfcBee6T9h7A0KBDb /D9K3IIZGzNDzLfVO+dt+CItxHmVMeE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V2CRT0BA7K09BgT5YL2JQfhcvweXAfO6F7Tmt9UwGBs=; b=9VP4hrHHVbM2n+KgaSy4/OZLkGoFHq1tsbY/0lCNoBGcfTjQ7c+MlxXo0T/HxFqt58Mn3j bwoUZGcVHdFqPACA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A77BB13A42; Mon, 14 Oct 2024 13:07:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id WPpZJpcXDWcqTwAAD6G6ig (envelope-from ); Mon, 14 Oct 2024 13:07:35 +0000 From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Broadcom internal kernel review list Cc: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , kw@linux.com, Philipp Zabel , Andrea della Porta , Phil Elwell , Jonathan Bell , Stanimir Varbanov Subject: [PATCH v3 04/11] PCI: brcmstb: Expand inbound size calculation helper Date: Mon, 14 Oct 2024 16:07:03 +0300 Message-ID: <20241014130710.413-5-svarbanov@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014130710.413-1-svarbanov@suse.de> References: <20241014130710.413-1-svarbanov@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: B67071FE61 X-Spam-Level: X-Spamd-Result: default: False [-1.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_TWELVE(0.00)[21]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_CC(0.00)[linutronix.de,kernel.org,broadcom.com,gmail.com,google.com,linux.com,pengutronix.de,suse.com,raspberrypi.com,suse.de]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[dt]; DKIM_TRACE(0.00)[suse.de:+]; R_RATELIMIT(0.00)[to_ip_from(RLw7mkaud87zuqqztkur5718rm)]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -1.51 X-Spam-Flag: NO Content-Type: text/plain; charset="utf-8" BCM2712 memory map can supports up to 64GB of system memory, thus expand the inbound size calculation in helper function up to 64GB. Signed-off-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- v2 -> v3: - Added Reviewed-by tags. - Improved patch description (Florian). drivers/pci/controller/pcie-brcmstb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller= /pcie-brcmstb.c index 9321280f6edb..b0ef2f31914d 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -309,8 +309,8 @@ static int brcm_pcie_encode_ibar_size(u64 size) if (log2_in >=3D 12 && log2_in <=3D 15) /* Covers 4KB to 32KB (inclusive) */ return (log2_in - 12) + 0x1c; - else if (log2_in >=3D 16 && log2_in <=3D 35) - /* Covers 64KB to 32GB, (inclusive) */ + else if (log2_in >=3D 16 && log2_in <=3D 36) + /* Covers 64KB to 64GB, (inclusive) */ return log2_in - 15; /* Something is awry so disable */ return 0; --=20 2.43.0 From nobody Wed Nov 27 03:46:11 2024 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 694E31AB534; Mon, 14 Oct 2024 13:07:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911261; cv=none; b=cRCFa03R7hnQkozSK/TuEhl3m8XnohtsO3jeCOiHat5PkmnItR38We7BYgAkzqxxON99r5CDtKKKGyQJZpzqcfQiUX+ycP7IhynjuI7V/2C4YQM5e6ifZ8o2paUMvINeAVbwnVVymTKWaqF1jwW0j3DuftR5w8zR8VKe53ySd4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911261; c=relaxed/simple; bh=6GWRSgUpCdoUY9hh+1yTDdP86TiWongLkz8HE537dtM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KibaexeplQ1ro5OicAp2VAXT4uRjla8eVUq2MaBdofi3YTXntmQX8aM7wSn+LqRYAhartEseaezf563W9prryBchWRXxIpkHQC7fd7cAcNJqAuJW9B4RsCiPyhsxOps/r+T3MwiCsKZ4X++q6n9pefZsrvDN0apTqBGbLCJq1Co= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=ZAxlWxqi; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=5/Zp48/p; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=ZAxlWxqi; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=5/Zp48/p; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ZAxlWxqi"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="5/Zp48/p"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ZAxlWxqi"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="5/Zp48/p" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D24131FE57; Mon, 14 Oct 2024 13:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911257; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8DCAVJXCB/9zzBCk/NgKVl3/lMA3I5cjuushV32SkV0=; b=ZAxlWxqi4J8lej4rm8+JhepYDPLTp5ypbEP4s/QklpyYTRJjuw5XGPuWh0myFF27nuvGIc Yb/OWKt3i53k9vnPtKVgH0uRVt4lYE2/k/5BXH/WSyD/we3wXTNqUBL/vwza0INgWKbGkI cjyh91m5onuTsa2oyZOuj/2b70KZ+AI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911257; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8DCAVJXCB/9zzBCk/NgKVl3/lMA3I5cjuushV32SkV0=; b=5/Zp48/pk1hv3Ra5Vx7IRvZUeqMqa1QKfmd2R0lcILyp7m0M9/DQyQVYWlRoLqm2NpbS1Q HQoybphr0i/n9RBg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ZAxlWxqi; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="5/Zp48/p" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911257; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8DCAVJXCB/9zzBCk/NgKVl3/lMA3I5cjuushV32SkV0=; b=ZAxlWxqi4J8lej4rm8+JhepYDPLTp5ypbEP4s/QklpyYTRJjuw5XGPuWh0myFF27nuvGIc Yb/OWKt3i53k9vnPtKVgH0uRVt4lYE2/k/5BXH/WSyD/we3wXTNqUBL/vwza0INgWKbGkI cjyh91m5onuTsa2oyZOuj/2b70KZ+AI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911257; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8DCAVJXCB/9zzBCk/NgKVl3/lMA3I5cjuushV32SkV0=; b=5/Zp48/pk1hv3Ra5Vx7IRvZUeqMqa1QKfmd2R0lcILyp7m0M9/DQyQVYWlRoLqm2NpbS1Q HQoybphr0i/n9RBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C65CF13A79; Mon, 14 Oct 2024 13:07:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id CNT6LZgXDWcqTwAAD6G6ig (envelope-from ); Mon, 14 Oct 2024 13:07:36 +0000 From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Broadcom internal kernel review list Cc: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , kw@linux.com, Philipp Zabel , Andrea della Porta , Phil Elwell , Jonathan Bell , Stanimir Varbanov Subject: [PATCH v3 05/11] PCI: brcmstb: Enable external MSI-X if available Date: Mon, 14 Oct 2024 16:07:04 +0300 Message-ID: <20241014130710.413-6-svarbanov@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014130710.413-1-svarbanov@suse.de> References: <20241014130710.413-1-svarbanov@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: D24131FE57 X-Spam-Score: -1.51 X-Rspamd-Action: no action X-Spamd-Result: default: False [-1.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_TWELVE(0.00)[21]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_CC(0.00)[linutronix.de,kernel.org,broadcom.com,gmail.com,google.com,linux.com,pengutronix.de,suse.com,raspberrypi.com,suse.de]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[dt]; DKIM_TRACE(0.00)[suse.de:+]; R_RATELIMIT(0.00)[to_ip_from(RLw7mkaud87zuqqztkur5718rm)]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Flag: NO X-Spam-Level: Content-Type: text/plain; charset="utf-8" On RPi5 there is an external MIP MSI-X interrupt controller which can handle up to 64 interrupts. Signed-off-by: Stanimir Varbanov --- v2 -> v3: - No changes drivers/pci/controller/pcie-brcmstb.c | 63 +++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller= /pcie-brcmstb.c index b0ef2f31914d..b76c16287f37 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1323,6 +1323,52 @@ static int brcm_pcie_start_link(struct brcm_pcie *pc= ie) return 0; } =20 +static int brcm_pcie_enable_external_msix(struct brcm_pcie *pcie, + struct device_node *msi_np) +{ + struct inbound_win inbound_wins[PCIE_BRCM_MAX_INBOUND_WINS]; + u64 msi_pci_addr, msi_phys_addr; + struct resource r; + int mip_bar, ret; + u32 val, reg; + + ret =3D of_property_read_reg(msi_np, 1, &msi_pci_addr, NULL); + if (ret) + return ret; + + ret =3D of_address_to_resource(msi_np, 0, &r); + if (ret) + return ret; + + msi_phys_addr =3D r.start; + + /* Find free inbound window for MIP access */ + mip_bar =3D brcm_pcie_get_inbound_wins(pcie, inbound_wins); + if (mip_bar < 0) + return mip_bar; + + mip_bar +=3D 1; + reg =3D brcm_bar_reg_offset(mip_bar); + + val =3D lower_32_bits(msi_pci_addr); + val |=3D brcm_pcie_encode_ibar_size(SZ_4K); + writel(val, pcie->base + reg); + + val =3D upper_32_bits(msi_pci_addr); + writel(val, pcie->base + reg + 4); + + reg =3D brcm_ubus_reg_offset(mip_bar); + + val =3D lower_32_bits(msi_phys_addr); + val |=3D PCIE_MISC_UBUS_BAR1_CONFIG_REMAP_ACCESS_EN_MASK; + writel(val, pcie->base + reg); + + val =3D upper_32_bits(msi_phys_addr); + writel(val, pcie->base + reg + 4); + + return 0; +} + static const char * const supplies[] =3D { "vpcie3v3", "vpcie3v3aux", @@ -1888,11 +1934,20 @@ static int brcm_pcie_probe(struct platform_device *= pdev) goto fail; } =20 - msi_np =3D of_parse_phandle(pcie->np, "msi-parent", 0); - if (pci_msi_enabled() && msi_np =3D=3D pcie->np) { - ret =3D brcm_pcie_enable_msi(pcie); + if (pci_msi_enabled()) { + msi_np =3D of_parse_phandle(pcie->np, "msi-parent", 0); + const char *str; + + if (msi_np =3D=3D pcie->np) { + str =3D "internal MSI"; + ret =3D brcm_pcie_enable_msi(pcie); + } else { + str =3D "external MSI-X"; + ret =3D brcm_pcie_enable_external_msix(pcie, msi_np); + } + if (ret) { - dev_err(pcie->dev, "probe of internal MSI failed"); + dev_err(pcie->dev, "enable of %s failed\n", str); goto fail; } } --=20 2.43.0 From nobody Wed Nov 27 03:46:11 2024 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83D081ABEAD; Mon, 14 Oct 2024 13:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911262; cv=none; b=hzYPrQTALd6CKUIPujAvWGBCw1DbQzjEgCCdAfssPH1hij+fp1Xxb2EJjtCl3FtvsH4AGs+1ePWW4I8cOPN8p7GtPHcgCK1wwLcmwlRu1ZF2LF8LlSXSRiOmPqb8rYv9iteVIdPBzTA4qa2o9QtiAPbsS2WCB3LJ4KtYz2E2ayA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911262; c=relaxed/simple; bh=PrfP7Oac+w/o/H2gkwpbllj+z9evzAJFbgexhwyJMKo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lEGzXFJH9Opy80jIoUt0nKzNujGTc3AiEWBcs3Odk8Gm/opnrWo8n/gWYlrsXOT7LdCy5kfXmcR7I9mgg5USa8ehuuJzwkaV3XwNWu9QnbLiUT7WqCqFtj8VRpTqyr21+XJUspwkbfVcdUAZmxN9fVE3JZncnvoKxPkaekkQYgQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=HJXLGE4n; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=ssdhNbJw; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=HJXLGE4n; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=ssdhNbJw; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="HJXLGE4n"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="ssdhNbJw"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="HJXLGE4n"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="ssdhNbJw" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D71E421D47; Mon, 14 Oct 2024 13:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911258; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+eMhuTNIBdSJPh8TPKTFZlnEo8UZ6V6UxbrWcayc+o0=; b=HJXLGE4nqCmjxd7DHWJBgcLe4LF6mgkwBlzIDZHW8fhdHAieXlVWKXtw79DKYERHpV0ies HsnW+2ztvO4c9V2CgxitsFlYx4UBF9pHe0HgGw586StFCJjBVShx+2RAFp5L1mBDQXckJP hoGLDVhnjK0wS73stD1paUFTX463Ubk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911258; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+eMhuTNIBdSJPh8TPKTFZlnEo8UZ6V6UxbrWcayc+o0=; b=ssdhNbJwCYrh/oRnPPzEtGI/aW9xyupJogPqEj+srrqO5PK+lB6uoIGe6eTm+ALTzygPaG V6wBBWuWs0HGZ+BA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=HJXLGE4n; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ssdhNbJw DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911258; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+eMhuTNIBdSJPh8TPKTFZlnEo8UZ6V6UxbrWcayc+o0=; b=HJXLGE4nqCmjxd7DHWJBgcLe4LF6mgkwBlzIDZHW8fhdHAieXlVWKXtw79DKYERHpV0ies HsnW+2ztvO4c9V2CgxitsFlYx4UBF9pHe0HgGw586StFCJjBVShx+2RAFp5L1mBDQXckJP hoGLDVhnjK0wS73stD1paUFTX463Ubk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911258; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+eMhuTNIBdSJPh8TPKTFZlnEo8UZ6V6UxbrWcayc+o0=; b=ssdhNbJwCYrh/oRnPPzEtGI/aW9xyupJogPqEj+srrqO5PK+lB6uoIGe6eTm+ALTzygPaG V6wBBWuWs0HGZ+BA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D741513A42; Mon, 14 Oct 2024 13:07:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id eLgpMpkXDWcqTwAAD6G6ig (envelope-from ); Mon, 14 Oct 2024 13:07:37 +0000 From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Broadcom internal kernel review list Cc: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , kw@linux.com, Philipp Zabel , Andrea della Porta , Phil Elwell , Jonathan Bell , Stanimir Varbanov Subject: [PATCH v3 06/11] PCI: brcmstb: Avoid turn off of bridge reset Date: Mon, 14 Oct 2024 16:07:05 +0300 Message-ID: <20241014130710.413-7-svarbanov@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014130710.413-1-svarbanov@suse.de> References: <20241014130710.413-1-svarbanov@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: D71E421D47 X-Spam-Level: X-Spamd-Result: default: False [-1.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_TWELVE(0.00)[21]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_CC(0.00)[linutronix.de,kernel.org,broadcom.com,gmail.com,google.com,linux.com,pengutronix.de,suse.com,raspberrypi.com,suse.de]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[dt]; DKIM_TRACE(0.00)[suse.de:+]; R_RATELIMIT(0.00)[to_ip_from(RLw7mkaud87zuqqztkur5718rm)]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -1.51 X-Spam-Flag: NO Content-Type: text/plain; charset="utf-8" On PCIe turn off avoid shutdown of bridge reset, by introducing a quirk flag. Signed-off-by: Stanimir Varbanov --- v2 -> v3: - Added more descriptive comment on CFG_QUIRK_AVOID_BRIDGE_SHUTDOWN quirk. drivers/pci/controller/pcie-brcmstb.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller= /pcie-brcmstb.c index b76c16287f37..757a1646d53c 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -234,10 +234,20 @@ struct inbound_win { u64 cpu_addr; }; =20 +/* + * The RESCAL block is tied to PCIe controller #1, regardless of the numbe= r of + * controllers, and turning off PCIe controller #1 prevents access to the = RESCAL + * register blocks, therefore not other controller can access this register + * space, and depending upon the bus fabric we may get a timeout (UBUS/GIS= B), + * or a hang (AXI). + */ +#define CFG_QUIRK_AVOID_BRIDGE_SHUTDOWN BIT(0) + struct pcie_cfg_data { const int *offsets; const enum pcie_soc_base soc_base; const bool has_phy; + const u32 quirks; u8 num_inbound_wins; int (*perst_set)(struct brcm_pcie *pcie, u32 val); int (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); @@ -290,6 +300,7 @@ struct brcm_pcie { struct subdev_regulators *sr; bool ep_wakeup_capable; bool has_phy; + u32 quirks; u8 num_inbound_wins; }; =20 @@ -1539,8 +1550,9 @@ static int brcm_pcie_turn_off(struct brcm_pcie *pcie) u32p_replace_bits(&tmp, 1, PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MAS= K); writel(tmp, base + HARD_DEBUG(pcie)); =20 - /* Shutdown PCIe bridge */ - ret =3D pcie->bridge_sw_init_set(pcie, 1); + if (!(pcie->quirks & CFG_QUIRK_AVOID_BRIDGE_SHUTDOWN)) + /* Shutdown PCIe bridge */ + ret =3D pcie->bridge_sw_init_set(pcie, 1); =20 return ret; } @@ -1854,6 +1866,7 @@ static int brcm_pcie_probe(struct platform_device *pd= ev) pcie->perst_set =3D data->perst_set; pcie->bridge_sw_init_set =3D data->bridge_sw_init_set; pcie->has_phy =3D data->has_phy; + pcie->quirks =3D data->quirks; pcie->num_inbound_wins =3D data->num_inbound_wins; =20 pcie->base =3D devm_platform_ioremap_resource(pdev, 0); --=20 2.43.0 From nobody Wed Nov 27 03:46:11 2024 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98D0E1AC44A; Mon, 14 Oct 2024 13:07:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911263; cv=none; b=AwxXB5Bc8IuK2Dyrxl7NPhiOsnIdLU8c6CGp7UL3TGrBpdtoYcCUmF/F8XvUfd/eBx4RP6038iEWJvC+4oQMEx70zVje6jX48LR3RobPvOhMSZhqnt9fi8wJVlfnPoTw++NqzvxZI9EDtsIfIfKUIaXZAHTucr9xEPB5a73iOpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911263; c=relaxed/simple; bh=1/pECY5BgWk5R6zj9VBg1fvR1pxk7MteDmeN4jZ+mTA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZyhRrQaSkbW/ATuX4XJWYDGM6Q4KmjTokB58YPjvICWegpiziQ+X/bn2XBy/OpNrA1IywFlljX4akv8mJCtPSduW8MuSBAgo+dY2i8HC1nQJjn3jRNW+CgRpIl1jm3iuDuiyLoLkHZ1strNsHcHhX9aT3vk9+uwrfMXrJmzVsPk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=h9SCf268; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=RDzqrI4L; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=h9SCf268; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=RDzqrI4L; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="h9SCf268"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="RDzqrI4L"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="h9SCf268"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="RDzqrI4L" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D944E21D5E; Mon, 14 Oct 2024 13:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911259; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ze7Z2aH3luC3w6Fxj4fkEfmrSVJNlSGZRFhihWfWp/Q=; b=h9SCf268mOFWJH9sDh60Ig1A+NYISorDLMaEvEbePYoigprICtKrqqgwZ0an182lWwOjMD GMz9GYbwXS9TSen4QXnS2eaNmqP0JDhK4mp+FgedWncaLC2IJAwLnYHfOomti/dJYOQ/EE GSGEyjBhhHUK4mrI+a5SJ7dQXmeDplM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911259; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ze7Z2aH3luC3w6Fxj4fkEfmrSVJNlSGZRFhihWfWp/Q=; b=RDzqrI4L9pYL4AF+lKcyW9/QQMBMeFux4mpcYBd0lr4Vzw7rULU6kA6zlKSCWuTS7b7Xzq 682JcXyd1LYeuuAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911259; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ze7Z2aH3luC3w6Fxj4fkEfmrSVJNlSGZRFhihWfWp/Q=; b=h9SCf268mOFWJH9sDh60Ig1A+NYISorDLMaEvEbePYoigprICtKrqqgwZ0an182lWwOjMD GMz9GYbwXS9TSen4QXnS2eaNmqP0JDhK4mp+FgedWncaLC2IJAwLnYHfOomti/dJYOQ/EE GSGEyjBhhHUK4mrI+a5SJ7dQXmeDplM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911259; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ze7Z2aH3luC3w6Fxj4fkEfmrSVJNlSGZRFhihWfWp/Q=; b=RDzqrI4L9pYL4AF+lKcyW9/QQMBMeFux4mpcYBd0lr4Vzw7rULU6kA6zlKSCWuTS7b7Xzq 682JcXyd1LYeuuAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DC0DF13A79; Mon, 14 Oct 2024 13:07:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id wEReM5oXDWcqTwAAD6G6ig (envelope-from ); Mon, 14 Oct 2024 13:07:38 +0000 From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Broadcom internal kernel review list Cc: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , kw@linux.com, Philipp Zabel , Andrea della Porta , Phil Elwell , Jonathan Bell , Stanimir Varbanov Subject: [PATCH v3 07/11] PCI: brcmstb: Add bcm2712 support Date: Mon, 14 Oct 2024 16:07:06 +0300 Message-ID: <20241014130710.413-8-svarbanov@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014130710.413-1-svarbanov@suse.de> References: <20241014130710.413-1-svarbanov@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.30 X-Spamd-Result: default: False [-1.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[dt]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; RCPT_COUNT_TWELVE(0.00)[21]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_CC(0.00)[linutronix.de,kernel.org,broadcom.com,gmail.com,google.com,linux.com,pengutronix.de,suse.com,raspberrypi.com,suse.de]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; R_RATELIMIT(0.00)[to_ip_from(RL7mwea5a3cdyragbzqhrtit3y)]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Flag: NO X-Spam-Level: Content-Type: text/plain; charset="utf-8" Add bare minimum amount of changes in order to support PCIe RC hardware IP found in RPi5. Signed-off-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- v2 -> v3: - Added Reviewed-by tag. drivers/pci/controller/pcie-brcmstb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller= /pcie-brcmstb.c index 757a1646d53c..85dd328fa090 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1762,6 +1762,15 @@ static const struct pcie_cfg_data bcm2711_cfg =3D { .num_inbound_wins =3D 3, }; =20 +static const struct pcie_cfg_data bcm2712_cfg =3D { + .offsets =3D pcie_offsets_bcm7712, + .soc_base =3D BCM7712, + .perst_set =3D brcm_pcie_perst_set_7278, + .bridge_sw_init_set =3D brcm_pcie_bridge_sw_init_set_generic, + .quirks =3D CFG_QUIRK_AVOID_BRIDGE_SHUTDOWN, + .num_inbound_wins =3D 10, +}; + static const struct pcie_cfg_data bcm4908_cfg =3D { .offsets =3D pcie_offsets, .soc_base =3D BCM4908, @@ -1813,6 +1822,7 @@ static const struct pcie_cfg_data bcm7712_cfg =3D { =20 static const struct of_device_id brcm_pcie_match[] =3D { { .compatible =3D "brcm,bcm2711-pcie", .data =3D &bcm2711_cfg }, + { .compatible =3D "brcm,bcm2712-pcie", .data =3D &bcm2712_cfg }, { .compatible =3D "brcm,bcm4908-pcie", .data =3D &bcm4908_cfg }, { .compatible =3D "brcm,bcm7211-pcie", .data =3D &generic_cfg }, { .compatible =3D "brcm,bcm7216-pcie", .data =3D &bcm7216_cfg }, --=20 2.43.0 From nobody Wed Nov 27 03:46:11 2024 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A19A01AD41F; Mon, 14 Oct 2024 13:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911264; cv=none; b=AJYSFOY/KxmOXgCMpV51F2qo1yZKTcDB2Yj4+PDf1chy4ROefGEKnHg7YwasCZqVDOaHpZ8tFgzqJWQClv0fLgKYuUaCzXgdKp1er8VDSbcCBOp3E8W/OAbGW5eHyDf1DtbP5JOr74FtD9vdWEWChk5CYyliDIBtM+QWkMZqw2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911264; c=relaxed/simple; bh=VfMwt4E49EDq0+77GgEkpXpuQXZr+jLSMgitrb+US50=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lOrO5M4bcOVhQWFdxT5rM/920X/K/5bhFOep8oUMk74SRxPsStoPSD/6FQ3IHNTOF1CUVEAdtRKwQbdcJDT1yTx94bMUi98Z+m+NzpBXtYQ2h5Ekq+x/GhHw8ui7T1EY+Ds6HKso+Mkg+WxmnYQsyTvbrsLMxhBpnOaAB7jQ+3g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=cveed1kd; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=FitDP1FM; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=ZRHCEReI; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=2rA+o3TY; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="cveed1kd"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="FitDP1FM"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ZRHCEReI"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="2rA+o3TY" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EB7A421D78; Mon, 14 Oct 2024 13:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911261; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6eruRqjpFbE4e1Ftsz9x3mEtwvC+CXBNC7k6PQDj75g=; b=cveed1kd4BUYGyO9yD1nITiKZkfyc1CBAyfxajxtFTMINAhRSq34d41i5g3NpXD4moawyn aekfetvETkxlfygMxeA+wIYDe5WcJXgP5AO2khoioe65a4ahbAK9Bs+V+mqRjNdiGwCXLU zAS9Oci79Pa0g+z/Mcj7EI6E7QKmMxE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911261; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6eruRqjpFbE4e1Ftsz9x3mEtwvC+CXBNC7k6PQDj75g=; b=FitDP1FMPl2hxfF3Qgh/2rSLZMAdUc1NpIWekJFSEonnUafonX+kUrOVfdTB4Qfbbz7bk+ cQZrxMP41BZ+DhDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ZRHCEReI; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=2rA+o3TY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911260; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6eruRqjpFbE4e1Ftsz9x3mEtwvC+CXBNC7k6PQDj75g=; b=ZRHCEReIpDaeBq7VwE466PVRLTbAS3znbMTi2II3eyyWhrQK4w4rebRVtFcxti2OY1FOdg kvWp2BkcIUccsClkao9kSgWHFGl9xefpPf6WhEPnyVo/kgoq0gGwRANyH9c3mCyfOcL87m gXGk0H3TTxWGWU7JOueT+TZ/0SZQWX4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911260; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6eruRqjpFbE4e1Ftsz9x3mEtwvC+CXBNC7k6PQDj75g=; b=2rA+o3TY+bhz9C8epMOOCMPc7kX+vRe81ePfknLWvaR35AlODfM69GFzERis0btiMnwsNb C9LhZazSBZsUTKDQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E8EFA13A42; Mon, 14 Oct 2024 13:07:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 4Nd/NpsXDWcqTwAAD6G6ig (envelope-from ); Mon, 14 Oct 2024 13:07:39 +0000 From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Broadcom internal kernel review list Cc: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , kw@linux.com, Philipp Zabel , Andrea della Porta , Phil Elwell , Jonathan Bell , Stanimir Varbanov Subject: [PATCH v3 08/11] PCI: brcmstb: Reuse config structure Date: Mon, 14 Oct 2024 16:07:07 +0300 Message-ID: <20241014130710.413-9-svarbanov@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014130710.413-1-svarbanov@suse.de> References: <20241014130710.413-1-svarbanov@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: EB7A421D78 X-Spam-Score: -1.51 X-Rspamd-Action: no action X-Spamd-Result: default: False [-1.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_TWELVE(0.00)[21]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_CC(0.00)[linutronix.de,kernel.org,broadcom.com,gmail.com,google.com,linux.com,pengutronix.de,suse.com,raspberrypi.com,suse.de]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[dt]; DKIM_TRACE(0.00)[suse.de:+]; R_RATELIMIT(0.00)[to_ip_from(RLw7mkaud87zuqqztkur5718rm)]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Flag: NO X-Spam-Level: Content-Type: text/plain; charset="utf-8" Instead of copying fields from pcie_cfg_data structure to brcm_pcie reference it directly. Signed-off-by: Stanimir Varbanov Reviewed-by: Florian Fainelil --- v2 -> v3: - Added Reviewed-by tag. drivers/pci/controller/pcie-brcmstb.c | 76 ++++++++++++--------------- 1 file changed, 33 insertions(+), 43 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller= /pcie-brcmstb.c index 85dd328fa090..407343a30439 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -191,11 +191,11 @@ #define SSC_STATUS_PLL_LOCK_MASK 0x800 #define PCIE_BRCM_MAX_MEMC 3 =20 -#define IDX_ADDR(pcie) ((pcie)->reg_offsets[EXT_CFG_INDEX]) -#define DATA_ADDR(pcie) ((pcie)->reg_offsets[EXT_CFG_DATA]) -#define PCIE_RGR1_SW_INIT_1(pcie) ((pcie)->reg_offsets[RGR1_SW_INIT_1]) -#define HARD_DEBUG(pcie) ((pcie)->reg_offsets[PCIE_HARD_DEBUG]) -#define INTR2_CPU_BASE(pcie) ((pcie)->reg_offsets[PCIE_INTR2_CPU_BASE]) +#define IDX_ADDR(pcie) ((pcie)->cfg->offsets[EXT_CFG_INDEX]) +#define DATA_ADDR(pcie) ((pcie)->cfg->offsets[EXT_CFG_DATA]) +#define PCIE_RGR1_SW_INIT_1(pcie) ((pcie)->cfg->offsets[RGR1_SW_INIT_1]) +#define HARD_DEBUG(pcie) ((pcie)->cfg->offsets[PCIE_HARD_DEBUG]) +#define INTR2_CPU_BASE(pcie) ((pcie)->cfg->offsets[PCIE_INTR2_CPU_BASE]) =20 /* Rescal registers */ #define PCIE_DVT_PMU_PCIE_PHY_CTRL 0xc700 @@ -286,8 +286,6 @@ struct brcm_pcie { int gen; u64 msi_target_addr; struct brcm_msi *msi; - const int *reg_offsets; - enum pcie_soc_base soc_base; struct reset_control *rescal; struct reset_control *perst_reset; struct reset_control *bridge_reset; @@ -295,18 +293,14 @@ struct brcm_pcie { int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; - int (*perst_set)(struct brcm_pcie *pcie, u32 val); - int (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); struct subdev_regulators *sr; bool ep_wakeup_capable; - bool has_phy; - u32 quirks; - u8 num_inbound_wins; + const struct pcie_cfg_data *cfg; }; =20 static inline bool is_bmips(const struct brcm_pcie *pcie) { - return pcie->soc_base =3D=3D BCM7435 || pcie->soc_base =3D=3D BCM7425; + return pcie->cfg->soc_base =3D=3D BCM7435 || pcie->cfg->soc_base =3D=3D B= CM7425; } =20 /* @@ -866,7 +860,7 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie = *pcie, * security considerations, and is not implemented in our modern * SoCs. */ - if (pcie->soc_base !=3D BCM7712) + if (pcie->cfg->soc_base !=3D BCM7712) add_inbound_win(b++, &n, 0, 0, 0); =20 resource_list_for_each_entry(entry, &bridge->dma_ranges) { @@ -883,10 +877,10 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pci= e *pcie, * That being said, each BARs size must still be a power of * two. */ - if (pcie->soc_base =3D=3D BCM7712) + if (pcie->cfg->soc_base =3D=3D BCM7712) add_inbound_win(b++, &n, size, cpu_start, pcie_start); =20 - if (n > pcie->num_inbound_wins) + if (n > pcie->cfg->num_inbound_wins) break; } =20 @@ -900,7 +894,7 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie = *pcie, * that enables multiple memory controllers. As such, it can return * now w/o doing special configuration. */ - if (pcie->soc_base =3D=3D BCM7712) + if (pcie->cfg->soc_base =3D=3D BCM7712) return n; =20 ret =3D of_property_read_variable_u64_array(pcie->np, "brcm,scb-sizes", p= cie->memc_size, 1, @@ -1023,7 +1017,7 @@ static void set_inbound_win_registers(struct brcm_pci= e *pcie, * 7712: * All of their BARs need to be set. */ - if (pcie->soc_base =3D=3D BCM7712) { + if (pcie->cfg->soc_base =3D=3D BCM7712) { /* BUS remap register settings */ reg_offset =3D brcm_ubus_reg_offset(i); tmp =3D lower_32_bits(cpu_addr) & ~0xfff; @@ -1047,15 +1041,15 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) int memc, ret; =20 /* Reset the bridge */ - ret =3D pcie->bridge_sw_init_set(pcie, 1); + ret =3D pcie->cfg->bridge_sw_init_set(pcie, 1); if (ret) return ret; =20 /* Ensure that PERST# is asserted; some bootloaders may deassert it. */ - if (pcie->soc_base =3D=3D BCM2711) { - ret =3D pcie->perst_set(pcie, 1); + if (pcie->cfg->soc_base =3D=3D BCM2711) { + ret =3D pcie->cfg->perst_set(pcie, 1); if (ret) { - pcie->bridge_sw_init_set(pcie, 0); + pcie->cfg->bridge_sw_init_set(pcie, 0); return ret; } } @@ -1063,7 +1057,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) usleep_range(100, 200); =20 /* Take the bridge out of reset */ - ret =3D pcie->bridge_sw_init_set(pcie, 0); + ret =3D pcie->cfg->bridge_sw_init_set(pcie, 0); if (ret) return ret; =20 @@ -1083,9 +1077,9 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) */ if (is_bmips(pcie)) burst =3D 0x1; /* 256 bytes */ - else if (pcie->soc_base =3D=3D BCM2711) + else if (pcie->cfg->soc_base =3D=3D BCM2711) burst =3D 0x0; /* 128 bytes */ - else if (pcie->soc_base =3D=3D BCM7278) + else if (pcie->cfg->soc_base =3D=3D BCM7278) burst =3D 0x3; /* 512 bytes */ else burst =3D 0x2; /* 512 bytes */ @@ -1210,7 +1204,7 @@ static void brcm_extend_rbus_timeout(struct brcm_pcie= *pcie) u32 timeout_us =3D 4000000; /* 4 seconds, our setting for L1SS */ =20 /* 7712 does not have this (RGR1) timer */ - if (pcie->soc_base =3D=3D BCM7712) + if (pcie->cfg->soc_base =3D=3D BCM7712) return; =20 /* Each unit in timeout register is 1/216,000,000 seconds */ @@ -1288,7 +1282,7 @@ static int brcm_pcie_start_link(struct brcm_pcie *pci= e) int ret, i; =20 /* Unassert the fundamental reset */ - ret =3D pcie->perst_set(pcie, 0); + ret =3D pcie->cfg->perst_set(pcie, 0); if (ret) return ret; =20 @@ -1520,12 +1514,12 @@ static int brcm_phy_cntl(struct brcm_pcie *pcie, co= nst int start) =20 static inline int brcm_phy_start(struct brcm_pcie *pcie) { - return pcie->has_phy ? brcm_phy_cntl(pcie, 1) : 0; + return pcie->cfg->has_phy ? brcm_phy_cntl(pcie, 1) : 0; } =20 static inline int brcm_phy_stop(struct brcm_pcie *pcie) { - return pcie->has_phy ? brcm_phy_cntl(pcie, 0) : 0; + return pcie->cfg->has_phy ? brcm_phy_cntl(pcie, 0) : 0; } =20 static int brcm_pcie_turn_off(struct brcm_pcie *pcie) @@ -1536,7 +1530,7 @@ static int brcm_pcie_turn_off(struct brcm_pcie *pcie) if (brcm_pcie_link_up(pcie)) brcm_pcie_enter_l23(pcie); /* Assert fundamental reset */ - ret =3D pcie->perst_set(pcie, 1); + ret =3D pcie->cfg->perst_set(pcie, 1); if (ret) return ret; =20 @@ -1550,9 +1544,9 @@ static int brcm_pcie_turn_off(struct brcm_pcie *pcie) u32p_replace_bits(&tmp, 1, PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MAS= K); writel(tmp, base + HARD_DEBUG(pcie)); =20 - if (!(pcie->quirks & CFG_QUIRK_AVOID_BRIDGE_SHUTDOWN)) + if (!(pcie->cfg->quirks & CFG_QUIRK_AVOID_BRIDGE_SHUTDOWN)) /* Shutdown PCIe bridge */ - ret =3D pcie->bridge_sw_init_set(pcie, 1); + ret =3D pcie->cfg->bridge_sw_init_set(pcie, 1); =20 return ret; } @@ -1640,7 +1634,7 @@ static int brcm_pcie_resume_noirq(struct device *dev) goto err_reset; =20 /* Take bridge out of reset so we can access the SERDES reg */ - pcie->bridge_sw_init_set(pcie, 0); + pcie->cfg->bridge_sw_init_set(pcie, 0); =20 /* SERDES_IDDQ =3D 0 */ tmp =3D readl(base + HARD_DEBUG(pcie)); @@ -1871,13 +1865,7 @@ static int brcm_pcie_probe(struct platform_device *p= dev) pcie =3D pci_host_bridge_priv(bridge); pcie->dev =3D &pdev->dev; pcie->np =3D np; - pcie->reg_offsets =3D data->offsets; - pcie->soc_base =3D data->soc_base; - pcie->perst_set =3D data->perst_set; - pcie->bridge_sw_init_set =3D data->bridge_sw_init_set; - pcie->has_phy =3D data->has_phy; - pcie->quirks =3D data->quirks; - pcie->num_inbound_wins =3D data->num_inbound_wins; + pcie->cfg =3D data; =20 pcie->base =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) @@ -1912,7 +1900,7 @@ static int brcm_pcie_probe(struct platform_device *pd= ev) if (ret) return dev_err_probe(&pdev->dev, ret, "could not enable clock\n"); =20 - pcie->bridge_sw_init_set(pcie, 0); + pcie->cfg->bridge_sw_init_set(pcie, 0); =20 if (pcie->swinit_reset) { ret =3D reset_control_assert(pcie->swinit_reset); @@ -1951,7 +1939,8 @@ static int brcm_pcie_probe(struct platform_device *pd= ev) goto fail; =20 pcie->hw_rev =3D readl(pcie->base + PCIE_MISC_REVISION); - if (pcie->soc_base =3D=3D BCM4908 && pcie->hw_rev >=3D BRCM_PCIE_HW_REV_3= _20) { + if (pcie->cfg->soc_base =3D=3D BCM4908 && + pcie->hw_rev >=3D BRCM_PCIE_HW_REV_3_20) { dev_err(pcie->dev, "hardware revision with unsupported PERST# setup\n"); ret =3D -ENODEV; goto fail; @@ -1975,7 +1964,8 @@ static int brcm_pcie_probe(struct platform_device *pd= ev) } } =20 - bridge->ops =3D pcie->soc_base =3D=3D BCM7425 ? &brcm7425_pcie_ops : &brc= m_pcie_ops; + bridge->ops =3D pcie->cfg->soc_base =3D=3D BCM7425 ? + &brcm7425_pcie_ops : &brcm_pcie_ops; bridge->sysdata =3D pcie; =20 platform_set_drvdata(pdev, pcie); --=20 2.43.0 From nobody Wed Nov 27 03:46:11 2024 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B29601AE01D; Mon, 14 Oct 2024 13:07:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911265; cv=none; b=fuDl4n9DKsJLS6qsKZ+rpnK+BC1QPP8k27HA0QeWx10I7k+lZx5rwYVm0bK47zCRcbZfzyU0d4ydTJZ4JUc3Nb14Bks1P/JzRe7+uOZo35Sl2TDsLTY1xCea6FM1C52L26T6r2KWJwE+QYRD6FZooj7Utx+tYA8xHSQihgm4JeM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911265; c=relaxed/simple; bh=Re/QGG9c4MGrhUqDXKv6GdwzPh7orhMleqlGLWYZi1g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qND29YlBaxCpYVR/JokK+RBBsAq8HMYyGIZm0tsdfGWvaNPXu5gTBXBKSsf70Lb38gg/yCRyO6oNEuI8sBpV2A0VtXQL/SB/Ltm0RbwkX7+5cuZmvIv8FlhVJrx9We4yBW4AssX0HXPepiXvPTq7YxQMBaf7nIQNqvIbtEft5hU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=NLNcupGp; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=X3YVX3Ga; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=Sh7AI614; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=jmR8rWhy; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="NLNcupGp"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="X3YVX3Ga"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Sh7AI614"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="jmR8rWhy" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EE6511FE62; Mon, 14 Oct 2024 13:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911262; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UEo+f9srrd2OxsZkjWPR5yewyjOaUtrHuseqRED47jw=; b=NLNcupGpY1wn2VBM7lmtOEGpcSk8uerJmcDUX0Pe6tJkDPiaQ2y/Ay5sDwJklinPNOlBdF np9wwdyMbTcIJLncJYFFLXyoz6bsbt/2B+rFjFINAsrIXeAylW+2orIeOQ+eS4q9UBvoge cm9Nc9zGVP1Tu5xCR7A97dTGMoSLY0A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911262; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UEo+f9srrd2OxsZkjWPR5yewyjOaUtrHuseqRED47jw=; b=X3YVX3GavqYV853GSqFdPHqDtzlVFkwzlsrUNZD7YH4P9MxPrJG1weIx17TPA/71ZUpAmV EDYeDhWdbI3izOCQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911261; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UEo+f9srrd2OxsZkjWPR5yewyjOaUtrHuseqRED47jw=; b=Sh7AI614FJKfZYmYIje/xX6fB9qp5KHAyRzn2CXydyETMt6AQm7Wa368NCGhbws6Y9E2Ec gtoCKaYiodsjbAQxFKg2F69jZZrLhSBNqu2VG9bIpycxE2MUa3WH2i+4+5+eBn3De/PAvP zr0ulg03Yjp6Pmkqef4OR9nWY9Y59RM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911261; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UEo+f9srrd2OxsZkjWPR5yewyjOaUtrHuseqRED47jw=; b=jmR8rWhyoAaVC8vAYXjKAhgv7mYL8Ki6Gyo8neR7fpyzPUs83Xb5YFytU2Nm9LIsrteiSl NW86uU7n0cDXEkAw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0623013A79; Mon, 14 Oct 2024 13:07:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id KA/FOpwXDWcqTwAAD6G6ig (envelope-from ); Mon, 14 Oct 2024 13:07:40 +0000 From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Broadcom internal kernel review list Cc: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , kw@linux.com, Philipp Zabel , Andrea della Porta , Phil Elwell , Jonathan Bell , Stanimir Varbanov Subject: [PATCH v3 09/11] PCI: brcmstb: Adjust PHY PLL setup to use a 54MHz input refclk Date: Mon, 14 Oct 2024 16:07:08 +0300 Message-ID: <20241014130710.413-10-svarbanov@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014130710.413-1-svarbanov@suse.de> References: <20241014130710.413-1-svarbanov@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spamd-Result: default: False [-1.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[dt]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; RCPT_COUNT_TWELVE(0.00)[21]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_CC(0.00)[linutronix.de,kernel.org,broadcom.com,gmail.com,google.com,linux.com,pengutronix.de,suse.com,raspberrypi.com,suse.de]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; R_RATELIMIT(0.00)[to_ip_from(RL7mwea5a3cdyragbzqhrtit3y)]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Score: -1.30 X-Spam-Flag: NO Content-Type: text/plain; charset="utf-8" Use canned MDIO writes from Broadcom that switch the ref_clk output pair to run from the internal fractional PLL, and set the internal PLL to expect a 54MHz input reference clock. Without this RPi5 PCIe cannot enumerate endpoint devices on extension connector. Signed-off-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- v2 -> v3: - New patch. drivers/pci/controller/pcie-brcmstb.c | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller= /pcie-brcmstb.c index 407343a30439..12591e292c0c 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -55,6 +55,10 @@ #define PCIE_RC_DL_MDIO_WR_DATA 0x1104 #define PCIE_RC_DL_MDIO_RD_DATA 0x1108 =20 +#define PCIE_RC_PL_PHY_CTL_15 0x184c +#define PCIE_RC_PL_PHY_CTL_15_DIS_PLL_PD_MASK 0x400000 +#define PCIE_RC_PL_PHY_CTL_15_PM_CLK_PERIOD_MASK 0xff + #define PCIE_MISC_MISC_CTRL 0x4008 #define PCIE_MISC_MISC_CTRL_PCIE_RCB_64B_MODE_MASK 0x80 #define PCIE_MISC_MISC_CTRL_PCIE_RCB_MPS_MODE_MASK 0x400 @@ -251,6 +255,7 @@ struct pcie_cfg_data { u8 num_inbound_wins; int (*perst_set)(struct brcm_pcie *pcie, u32 val); int (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); + int (*post_setup)(struct brcm_pcie *pcie); }; =20 struct subdev_regulators { @@ -826,6 +831,32 @@ static int brcm_pcie_perst_set_generic(struct brcm_pci= e *pcie, u32 val) return 0; } =20 +static int brcm_pcie_post_setup_bcm2712(struct brcm_pcie *pcie) +{ + const u16 data[] =3D { 0x50b9, 0xbda1, 0x0094, 0x97b4, 0x5030, 0x5030, 0x= 0007 }; + const u8 regs[] =3D { 0x16, 0x17, 0x18, 0x19, 0x1b, 0x1c, 0x1e }; + u32 tmp; + int i; + + /* Allow a 54MHz (xosc) refclk source */ + + brcm_pcie_mdio_write(pcie->base, MDIO_PORT0, SET_ADDR_OFFSET, 0x1600); + + for (i =3D 0; i < ARRAY_SIZE(regs); i++) + brcm_pcie_mdio_write(pcie->base, MDIO_PORT0, regs[i], data[i]); + + usleep_range(100, 200); + + /* Fix for L1SS errata */ + tmp =3D readl(pcie->base + PCIE_RC_PL_PHY_CTL_15); + tmp &=3D ~PCIE_RC_PL_PHY_CTL_15_PM_CLK_PERIOD_MASK; + /* PM clock period is 18.52ns (round down) */ + tmp |=3D 0x12; + writel(tmp, pcie->base + PCIE_RC_PL_PHY_CTL_15); + + return 0; +} + static void add_inbound_win(struct inbound_win *b, u8 *count, u64 size, u64 cpu_addr, u64 pci_offset) { @@ -1189,6 +1220,9 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR2_MASK); writel(tmp, base + PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1); =20 + if (pcie->cfg->post_setup) + pcie->cfg->post_setup(pcie); + return 0; } =20 @@ -1761,6 +1795,7 @@ static const struct pcie_cfg_data bcm2712_cfg =3D { .soc_base =3D BCM7712, .perst_set =3D brcm_pcie_perst_set_7278, .bridge_sw_init_set =3D brcm_pcie_bridge_sw_init_set_generic, + .post_setup =3D brcm_pcie_post_setup_bcm2712, .quirks =3D CFG_QUIRK_AVOID_BRIDGE_SHUTDOWN, .num_inbound_wins =3D 10, }; --=20 2.43.0 From nobody Wed Nov 27 03:46:11 2024 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5FA51B4F15; Mon, 14 Oct 2024 13:07:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911266; cv=none; b=YuHZPuKCnpE+APzUAyYO5Dhj8/aMr1mSnwZ0wk8+f+LHRG8euo6VTo1ZCpcK0RlghXrxKjgH8JG+8s4YhCpYyTm3G1cyMvLCjk+eZXT9AtFQvX5zJLyu2q3LxqvU8wp3ACulFowwjuSRotiRzBlmzI23cy5zlhOea2Ow+QjMI/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728911266; c=relaxed/simple; bh=u2Z7lcwvvRxHIhUTFSqQVM6ChLp5cNHW2bk/dIImK9w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D7YUJfBIBtvm1cGO100vKF4GpwByvBU+eubjVRikXBH3HH+dRT+UsxXsuPqzggkpbiPSfJ+0Cnv92iiYnX9AT7mblbsGPZ1VsosAAOteoNTTYSs2XMT5IxYxoONvmlUIl12sLZLoiSnS0jR3ol+PbBG3cq9UcNzBZKcJDQ3Y1UQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=J5k5buL3; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=eGuDE/yS; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=J5k5buL3; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=eGuDE/yS; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="J5k5buL3"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="eGuDE/yS"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="J5k5buL3"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="eGuDE/yS" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0CBEE1FE59; Mon, 14 Oct 2024 13:07:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911263; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FEpzsrKRyO4Yy2bsVlZAct+Q7axO2e+hhJ6JBnpitqQ=; b=J5k5buL3sqx1OsDBzS/REyTsp6ICBHahgP05Xnzh8GWvMGBIV37MsEkHAm3JxBPdEWUaeP xB3jl+zMxC7O8vmwksq/tvCip0hICQTJv1kFCWEqQsOVDLZo3Dxir15xhGl5/MuK8NDR1X wF7nLMpzqwPSKhPjKwpB4tv6fqIllks= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911263; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FEpzsrKRyO4Yy2bsVlZAct+Q7axO2e+hhJ6JBnpitqQ=; b=eGuDE/yS1RNyh2yBKTU6LmV3NXVk7eRY2AHQjroET8QoBluiq216eqcy0yNIJWyEOfxr7C EkbGOcQUF8AUgqAg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728911263; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FEpzsrKRyO4Yy2bsVlZAct+Q7axO2e+hhJ6JBnpitqQ=; b=J5k5buL3sqx1OsDBzS/REyTsp6ICBHahgP05Xnzh8GWvMGBIV37MsEkHAm3JxBPdEWUaeP xB3jl+zMxC7O8vmwksq/tvCip0hICQTJv1kFCWEqQsOVDLZo3Dxir15xhGl5/MuK8NDR1X wF7nLMpzqwPSKhPjKwpB4tv6fqIllks= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728911263; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FEpzsrKRyO4Yy2bsVlZAct+Q7axO2e+hhJ6JBnpitqQ=; b=eGuDE/yS1RNyh2yBKTU6LmV3NXVk7eRY2AHQjroET8QoBluiq216eqcy0yNIJWyEOfxr7C EkbGOcQUF8AUgqAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 089FF13A42; Mon, 14 Oct 2024 13:07:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sA9aO50XDWcqTwAAD6G6ig (envelope-from ); Mon, 14 Oct 2024 13:07:41 +0000 From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Broadcom internal kernel review list Cc: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , kw@linux.com, Philipp Zabel , Andrea della Porta , Phil Elwell , Jonathan Bell , Stanimir Varbanov Subject: [PATCH v3 10/11] arm64: dts: broadcom: bcm2712: Add PCIe DT nodes Date: Mon, 14 Oct 2024 16:07:09 +0300 Message-ID: <20241014130710.413-11-svarbanov@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014130710.413-1-svarbanov@suse.de> References: <20241014130710.413-1-svarbanov@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spamd-Result: default: False [-1.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[dt]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; RCPT_COUNT_TWELVE(0.00)[21]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_CC(0.00)[linutronix.de,kernel.org,broadcom.com,gmail.com,google.com,linux.com,pengutronix.de,suse.com,raspberrypi.com,suse.de]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; R_RATELIMIT(0.00)[to_ip_from(RL7mwea5a3cdyragbzqhrtit3y)]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Score: -1.30 X-Spam-Flag: NO Content-Type: text/plain; charset="utf-8" Add PCIe devicetree nodes, plus needed reset and mip MSI-X controllers. Signed-off-by: Stanimir Varbanov --- v2 -> v3: - Added comments on ranges and dma-ranges properties (Florian) arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 160 ++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi b/arch/arm64/boot/dt= s/broadcom/bcm2712.dtsi index 6e5a984c1d4e..a83de23856e3 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi @@ -192,6 +192,12 @@ soc: soc@107c000000 { #address-cells =3D <1>; #size-cells =3D <1>; =20 + pcie_rescal: reset-controller@119500 { + compatible =3D "brcm,bcm7216-pcie-sata-rescal"; + reg =3D <0x00119500 0x10>; + #reset-cells =3D <0>; + }; + sdio1: mmc@fff000 { compatible =3D "brcm,bcm2712-sdhci", "brcm,sdhci-brcmstb"; @@ -204,6 +210,12 @@ sdio1: mmc@fff000 { mmc-ddr-3_3v; }; =20 + bcm_reset: reset-controller@1504318 { + compatible =3D "brcm,brcmstb-reset"; + reg =3D <0x01504318 0x30>; + #reset-cells =3D <1>; + }; + system_timer: timer@7c003000 { compatible =3D "brcm,bcm2835-system-timer"; reg =3D <0x7c003000 0x1000>; @@ -267,6 +279,154 @@ gicv2: interrupt-controller@7fff9000 { }; }; =20 + axi@1000000000 { + compatible =3D "simple-bus"; + #address-cells =3D <2>; + #size-cells =3D <2>; + + ranges =3D <0x00 0x00000000 0x10 0x00000000 0x01 0x00000000>, + <0x14 0x00000000 0x14 0x00000000 0x04 0x00000000>, + <0x18 0x00000000 0x18 0x00000000 0x04 0x00000000>, + <0x1c 0x00000000 0x1c 0x00000000 0x04 0x00000000>; + + dma-ranges =3D <0x00 0x00000000 0x00 0x00000000 0x10 0x00000000>, + <0x14 0x00000000 0x14 0x00000000 0x04 0x00000000>, + <0x18 0x00000000 0x18 0x00000000 0x04 0x00000000>, + <0x1c 0x00000000 0x1c 0x00000000 0x04 0x00000000>; + + pcie0: pcie@100000 { + compatible =3D "brcm,bcm2712-pcie"; + reg =3D <0x00 0x00100000 0x00 0x9310>; + device_type =3D "pci"; + linux,pci-domain =3D <0>; + max-link-speed =3D <2>; + bus-range =3D <0x00 0xff>; + num-lanes =3D <1>; + #address-cells =3D <3>; + #interrupt-cells =3D <1>; + #size-cells =3D <2>; + interrupt-parent =3D <&gicv2>; + interrupts =3D , + ; + interrupt-names =3D "pcie", "msi"; + interrupt-map-mask =3D <0x0 0x0 0x0 0x7>; + interrupt-map =3D <0 0 0 1 &gicv2 GIC_SPI 209 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 2 &gicv2 GIC_SPI 210 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 3 &gicv2 GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 4 &gicv2 GIC_SPI 212 IRQ_TYPE_LEVEL_HIGH>; + resets =3D <&bcm_reset 42>, <&pcie_rescal>; + reset-names =3D "bridge", "rescal"; + msi-controller; + msi-parent =3D <&pcie0>; + + ranges =3D + /* ~4GB, 32-bit, non-prefetchable at PCIe 00_0000_0000 */ + <0x02000000 0x00 0x00000000 0x17 0x00000000 0x00 0xfffffffc>, + /* 12GB, 64-bit, prefetchable at PCIe 04_0000_0000 */ + <0x43000000 0x04 0x00000000 0x14 0x00000000 0x03 0x00000000>; + + dma-ranges =3D + /* 64GB, 64-bit, prefetchable at PCIe 10_0000_0000 */ + <0x43000000 0x10 0x00000000 0x00 0x00000000 0x10 0x00000000>; + + status =3D "disabled"; + }; + + pcie1: pcie@110000 { + compatible =3D "brcm,bcm2712-pcie"; + reg =3D <0x00 0x00110000 0x00 0x9310>; + device_type =3D "pci"; + linux,pci-domain =3D <1>; + max-link-speed =3D <2>; + bus-range =3D <0x00 0xff>; + num-lanes =3D <1>; + #address-cells =3D <3>; + #interrupt-cells =3D <1>; + #size-cells =3D <2>; + interrupt-parent =3D <&gicv2>; + interrupts =3D , + ; + interrupt-names =3D "pcie", "msi"; + interrupt-map-mask =3D <0x0 0x0 0x0 0x7>; + interrupt-map =3D <0 0 0 1 &gicv2 GIC_SPI 219 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 2 &gicv2 GIC_SPI 220 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 3 &gicv2 GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 4 &gicv2 GIC_SPI 222 IRQ_TYPE_LEVEL_HIGH>; + resets =3D <&bcm_reset 43>, <&pcie_rescal>; + reset-names =3D "bridge", "rescal"; + msi-parent =3D <&mip1>; + + ranges =3D + /* ~4GB, 32-bit, non-prefetchable at PCIe 00_0000_0000 */ + <0x02000000 0x00 0x00000000 0x1b 0x00000000 0x00 0xfffffffc>, + /* 12GB, 64-bit, prefetchable at PCIe 04_0000_0000 */ + <0x43000000 0x04 0x00000000 0x18 0x00000000 0x03 0x00000000>; + + dma-ranges =3D + /* 64GB, 64-bit, non-prefetchable at PCIe 10_0000_0000 */ + <0x03000000 0x10 0x00000000 0x00 0x00000000 0x10 0x00000000>; + + status =3D "disabled"; + }; + + pcie2: pcie@120000 { + compatible =3D "brcm,bcm2712-pcie"; + reg =3D <0x00 0x00120000 0x00 0x9310>; + device_type =3D "pci"; + linux,pci-domain =3D <2>; + max-link-speed =3D <2>; + bus-range =3D <0x00 0xff>; + num-lanes =3D <4>; + #address-cells =3D <3>; + #interrupt-cells =3D <1>; + #size-cells =3D <2>; + interrupt-parent =3D <&gicv2>; + interrupts =3D , + ; + interrupt-names =3D "pcie", "msi"; + interrupt-map-mask =3D <0x0 0x0 0x0 0x7>; + interrupt-map =3D <0 0 0 1 &gicv2 GIC_SPI 229 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 2 &gicv2 GIC_SPI 230 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 3 &gicv2 GIC_SPI 231 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 4 &gicv2 GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>; + resets =3D <&bcm_reset 44>, <&pcie_rescal>; + reset-names =3D "bridge", "rescal"; + msi-parent =3D <&mip0>; + + ranges =3D + /* ~4GB, 32-bit, non-prefetchable at PCIe 00_0000_0000 */ + <0x02000000 0x00 0x00000000 0x1f 0x00000000 0x00 0xfffffffc>, + /* 12GB, 64-bit, prefetchable at PCIe 04_0000_0000 */ + <0x43000000 0x04 0x00000000 0x1c 0x00000000 0x03 0x00000000>; + + dma-ranges =3D + /* 4MB, 32-bit, non-prefetchable at PCIe 00_0000_0000 */ + <0x02000000 0x00 0x00000000 0x1f 0x00000000 0x00 0x00400000>, + /* 64GB, 64-bit, prefetchable at PCIe 10_0000_0000 */ + <0x43000000 0x10 0x00000000 0x00 0x00000000 0x10 0x00000000>; + + status =3D "disabled"; + }; + + mip0: msi-controller@130000 { + compatible =3D "brcm,bcm2712-mip"; + reg =3D <0x00 0x00130000 0x00 0xc0>, + <0xff 0xfffff000 0x00 0x1000>; + msi-controller; + msi-ranges =3D <&gicv2 GIC_SPI 128 IRQ_TYPE_EDGE_RISING 64>; + brcm,msi-offset =3D <0>; + }; + + mip1: msi-controller@131000 { + compatible =3D "brcm,bcm2712-mip"; + reg =3D <0x00 0x00131000 0x00 0xc0>, + <0xff 0xfffff000 0x00 0x1000>; + msi-controller; + msi-ranges =3D <&gicv2 GIC_SPI 247 IRQ_TYPE_EDGE_RISING 8>; + brcm,msi-offset =3D <8>; + }; + }; + timer { compatible =3D "arm,armv8-timer"; interrupts =3D ); Mon, 14 Oct 2024 13:07:43 +0000 From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Broadcom internal kernel review list Cc: Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , kw@linux.com, Philipp Zabel , Andrea della Porta , Phil Elwell , Jonathan Bell , Stanimir Varbanov Subject: [PATCH v3 11/11] arm64: dts: broadcom: bcm2712-rpi-5-b: Enable PCIe DT nodes Date: Mon, 14 Oct 2024 16:07:10 +0300 Message-ID: <20241014130710.413-12-svarbanov@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014130710.413-1-svarbanov@suse.de> References: <20241014130710.413-1-svarbanov@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spamd-Result: default: False [-1.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[dt]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid]; RCPT_COUNT_TWELVE(0.00)[21]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_CC(0.00)[linutronix.de,kernel.org,broadcom.com,gmail.com,google.com,linux.com,pengutronix.de,suse.com,raspberrypi.com,suse.de]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; R_RATELIMIT(0.00)[to_ip_from(RL7mwea5a3cdyragbzqhrtit3y)]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Score: -1.30 X-Spam-Flag: NO Content-Type: text/plain; charset="utf-8" Enable pcie1 and pcie2 DT nodes. Pcie1 is used for the extension connector and pcie2 is used for RP1 south-bridge. Signed-off-by: Stanimir Varbanov --- v2 -> v3: - No changes. arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts b/arch/arm64/= boot/dts/broadcom/bcm2712-rpi-5-b.dts index 2bdbb6780242..e970a6013c6f 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts +++ b/arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts @@ -62,3 +62,11 @@ &sdio1 { sd-uhs-ddr50; sd-uhs-sdr104; }; + +&pcie1 { + status =3D "okay"; +}; + +&pcie2 { + status =3D "okay"; +}; --=20 2.43.0