* [PATCH v3 0/2] PCI: mediatek-gen3: Set PBUS_CSR regs for Airoha EN7581 SoC.
@ 2025-02-22 10:43 Lorenzo Bianconi
2025-02-22 10:43 ` [PATCH v3 1/2] dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle array property Lorenzo Bianconi
2025-02-22 10:43 ` [PATCH v3 2/2] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 SoC Lorenzo Bianconi
0 siblings, 2 replies; 10+ messages in thread
From: Lorenzo Bianconi @ 2025-02-22 10:43 UTC (permalink / raw)
To: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi,
Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Matthias Brugger, AngeloGioacchino Del Regno, Lorenzo Bianconi
Cc: linux-pci, linux-mediatek, devicetree, linux-arm-kernel,
Krzysztof Wilczyński
Configure PBus base address and base address mask to allow the hw
to detect if a given address is accessible on the PCIe controller.
Introduce mediatek,pbus-csr phandle array property.
Changes in v3:
- Get base address and base address mask from range property
- Define mediatek,pbus-csr as phandle array
- Link to v2: https://lore.kernel.org/r/20250202-en7581-pcie-pbus-csr-v2-0-65dcb201c9a9@kernel.org
Changes in v2:
- Introduce mediatek,pbus-csr phandle property
- Drop patch 1/2 in v1
- Do not hard-code compatible sting in the driver and use phandle
instead
---
Lorenzo Bianconi (2):
dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle array property
PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 SoC
.../bindings/pci/mediatek-pcie-gen3.yaml | 17 +++++++++++
drivers/pci/controller/pcie-mediatek-gen3.c | 34 +++++++++++++++++++++-
2 files changed, 50 insertions(+), 1 deletion(-)
---
base-commit: b6d7bb0d3bd74b491e2e6fd59c4d5110d06fd63b
change-id: 20250201-en7581-pcie-pbus-csr-f9c4f88ce5b3
Best regards,
--
Lorenzo Bianconi <lorenzo@kernel.org>
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v3 1/2] dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle array property 2025-02-22 10:43 [PATCH v3 0/2] PCI: mediatek-gen3: Set PBUS_CSR regs for Airoha EN7581 SoC Lorenzo Bianconi @ 2025-02-22 10:43 ` Lorenzo Bianconi 2025-02-23 9:43 ` Krzysztof Kozlowski 2025-02-24 5:43 ` Manivannan Sadhasivam 2025-02-22 10:43 ` [PATCH v3 2/2] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 SoC Lorenzo Bianconi 1 sibling, 2 replies; 10+ messages in thread From: Lorenzo Bianconi @ 2025-02-22 10:43 UTC (permalink / raw) To: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi, Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, Lorenzo Bianconi Cc: linux-pci, linux-mediatek, devicetree, linux-arm-kernel, Krzysztof Wilczyński Introduce the mediatek,pbus-csr property for the pbus-csr syscon node available on EN7581 SoC. The airoha pbus-csr block provides a configuration interface for the PBUS controller used to detect if a given address is accessible on PCIe controller. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> --- .../devicetree/bindings/pci/mediatek-pcie-gen3.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/mediatek-pcie-gen3.yaml b/Documentation/devicetree/bindings/pci/mediatek-pcie-gen3.yaml index f05aab2b1addcac91d4685d7d94f421814822b92..162406e0691a81044406aa8f9e60605d0d917811 100644 --- a/Documentation/devicetree/bindings/pci/mediatek-pcie-gen3.yaml +++ b/Documentation/devicetree/bindings/pci/mediatek-pcie-gen3.yaml @@ -109,6 +109,17 @@ properties: power-domains: maxItems: 1 + mediatek,pbus-csr: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to pbus-csr syscon + - description: offset of pbus-csr base address register + - description: offset of pbus-csr base address mask register + description: + Phandle with two arguments to the syscon node used to detect if + a given address is accessible on PCIe controller. + '#interrupt-cells': const: 1 @@ -168,6 +179,8 @@ allOf: minItems: 1 maxItems: 2 + mediatek,pbus-csr: false + - if: properties: compatible: @@ -197,6 +210,8 @@ allOf: minItems: 1 maxItems: 2 + mediatek,pbus-csr: false + - if: properties: compatible: @@ -224,6 +239,8 @@ allOf: minItems: 1 maxItems: 2 + mediatek,pbus-csr: false + - if: properties: compatible: -- 2.48.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle array property 2025-02-22 10:43 ` [PATCH v3 1/2] dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle array property Lorenzo Bianconi @ 2025-02-23 9:43 ` Krzysztof Kozlowski 2025-02-23 13:39 ` Lorenzo Bianconi 2025-02-24 5:43 ` Manivannan Sadhasivam 1 sibling, 1 reply; 10+ messages in thread From: Krzysztof Kozlowski @ 2025-02-23 9:43 UTC (permalink / raw) To: Lorenzo Bianconi Cc: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi, Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, linux-pci, linux-mediatek, devicetree, linux-arm-kernel, Krzysztof Wilczyński On Sat, Feb 22, 2025 at 11:43:44AM +0100, Lorenzo Bianconi wrote: > Introduce the mediatek,pbus-csr property for the pbus-csr syscon node > available on EN7581 SoC. The airoha pbus-csr block provides a configuration > interface for the PBUS controller used to detect if a given address is > accessible on PCIe controller. > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > --- > .../devicetree/bindings/pci/mediatek-pcie-gen3.yaml | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > You got review tag, so if you decided to skip it, this should be mentioned why. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle array property 2025-02-23 9:43 ` Krzysztof Kozlowski @ 2025-02-23 13:39 ` Lorenzo Bianconi 2025-02-24 8:26 ` Krzysztof Kozlowski 0 siblings, 1 reply; 10+ messages in thread From: Lorenzo Bianconi @ 2025-02-23 13:39 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi, Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, linux-pci, linux-mediatek, devicetree, linux-arm-kernel, Krzysztof Wilczyński [-- Attachment #1: Type: text/plain, Size: 931 bytes --] > On Sat, Feb 22, 2025 at 11:43:44AM +0100, Lorenzo Bianconi wrote: > > Introduce the mediatek,pbus-csr property for the pbus-csr syscon node > > available on EN7581 SoC. The airoha pbus-csr block provides a configuration > > interface for the PBUS controller used to detect if a given address is > > accessible on PCIe controller. > > > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > > --- > > .../devicetree/bindings/pci/mediatek-pcie-gen3.yaml | 17 +++++++++++++++++ > > 1 file changed, 17 insertions(+) > > > > You got review tag, so if you decided to skip it, this should be > mentioned why. > > > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Since I modified the patch with respect to the previous version, I was thinking you want to review it again before applying the Reviewed-by tag. Added it now. Regards, Lorenzo > > Best regards, > Krzysztof > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle array property 2025-02-23 13:39 ` Lorenzo Bianconi @ 2025-02-24 8:26 ` Krzysztof Kozlowski 0 siblings, 0 replies; 10+ messages in thread From: Krzysztof Kozlowski @ 2025-02-24 8:26 UTC (permalink / raw) To: Lorenzo Bianconi Cc: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi, Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, linux-pci, linux-mediatek, devicetree, linux-arm-kernel, Krzysztof Wilczyński On 23/02/2025 14:39, Lorenzo Bianconi wrote: >> On Sat, Feb 22, 2025 at 11:43:44AM +0100, Lorenzo Bianconi wrote: >>> Introduce the mediatek,pbus-csr property for the pbus-csr syscon node >>> available on EN7581 SoC. The airoha pbus-csr block provides a configuration >>> interface for the PBUS controller used to detect if a given address is >>> accessible on PCIe controller. >>> >>> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> >>> --- >>> .../devicetree/bindings/pci/mediatek-pcie-gen3.yaml | 17 +++++++++++++++++ >>> 1 file changed, 17 insertions(+) >>> >> >> You got review tag, so if you decided to skip it, this should be >> mentioned why. >> >> >> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > > Since I modified the patch with respect to the previous version, I was thinking I know > you want to review it again before applying the Reviewed-by tag. Added it now. That was not my comment. I commented that you must explicitly say that you dropped someone's tag. And docs clearly ask for that: "Usually removal of someone's Tested-by or Reviewed-by tags should be mentioned in the patch changelog (after the '---' separator)." Best regards, Krzysztof ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle array property 2025-02-22 10:43 ` [PATCH v3 1/2] dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle array property Lorenzo Bianconi 2025-02-23 9:43 ` Krzysztof Kozlowski @ 2025-02-24 5:43 ` Manivannan Sadhasivam 1 sibling, 0 replies; 10+ messages in thread From: Manivannan Sadhasivam @ 2025-02-24 5:43 UTC (permalink / raw) To: Lorenzo Bianconi Cc: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, linux-pci, linux-mediatek, devicetree, linux-arm-kernel, Krzysztof Wilczyński On Sat, Feb 22, 2025 at 11:43:44AM +0100, Lorenzo Bianconi wrote: > Introduce the mediatek,pbus-csr property for the pbus-csr syscon node > available on EN7581 SoC. The airoha pbus-csr block provides a configuration > interface for the PBUS controller used to detect if a given address is > accessible on PCIe controller. > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> - Mani > --- > .../devicetree/bindings/pci/mediatek-pcie-gen3.yaml | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/Documentation/devicetree/bindings/pci/mediatek-pcie-gen3.yaml b/Documentation/devicetree/bindings/pci/mediatek-pcie-gen3.yaml > index f05aab2b1addcac91d4685d7d94f421814822b92..162406e0691a81044406aa8f9e60605d0d917811 100644 > --- a/Documentation/devicetree/bindings/pci/mediatek-pcie-gen3.yaml > +++ b/Documentation/devicetree/bindings/pci/mediatek-pcie-gen3.yaml > @@ -109,6 +109,17 @@ properties: > power-domains: > maxItems: 1 > > + mediatek,pbus-csr: > + $ref: /schemas/types.yaml#/definitions/phandle-array > + items: > + - items: > + - description: phandle to pbus-csr syscon > + - description: offset of pbus-csr base address register > + - description: offset of pbus-csr base address mask register > + description: > + Phandle with two arguments to the syscon node used to detect if > + a given address is accessible on PCIe controller. > + > '#interrupt-cells': > const: 1 > > @@ -168,6 +179,8 @@ allOf: > minItems: 1 > maxItems: 2 > > + mediatek,pbus-csr: false > + > - if: > properties: > compatible: > @@ -197,6 +210,8 @@ allOf: > minItems: 1 > maxItems: 2 > > + mediatek,pbus-csr: false > + > - if: > properties: > compatible: > @@ -224,6 +239,8 @@ allOf: > minItems: 1 > maxItems: 2 > > + mediatek,pbus-csr: false > + > - if: > properties: > compatible: > > -- > 2.48.1 > -- மணிவண்ணன் சதாசிவம் ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 2/2] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 SoC 2025-02-22 10:43 [PATCH v3 0/2] PCI: mediatek-gen3: Set PBUS_CSR regs for Airoha EN7581 SoC Lorenzo Bianconi 2025-02-22 10:43 ` [PATCH v3 1/2] dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle array property Lorenzo Bianconi @ 2025-02-22 10:43 ` Lorenzo Bianconi 2025-02-24 5:52 ` Manivannan Sadhasivam 1 sibling, 1 reply; 10+ messages in thread From: Lorenzo Bianconi @ 2025-02-22 10:43 UTC (permalink / raw) To: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi, Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, Lorenzo Bianconi Cc: linux-pci, linux-mediatek, devicetree, linux-arm-kernel, Krzysztof Wilczyński Configure PBus base address and address mask to allow the hw to detect if a given address is accessible on PCIe controller. Fixes: f6ab898356dd ("PCI: mediatek-gen3: Add Airoha EN7581 support") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> --- drivers/pci/controller/pcie-mediatek-gen3.c | 34 ++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c index 0f64e76e2111468e6a453889ead7fbc75804faf7..51103b7624c09ca957c22a25536dc9da25428e48 100644 --- a/drivers/pci/controller/pcie-mediatek-gen3.c +++ b/drivers/pci/controller/pcie-mediatek-gen3.c @@ -15,6 +15,7 @@ #include <linux/irqchip/chained_irq.h> #include <linux/irqdomain.h> #include <linux/kernel.h> +#include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/msi.h> #include <linux/of_device.h> @@ -24,6 +25,7 @@ #include <linux/platform_device.h> #include <linux/pm_domain.h> #include <linux/pm_runtime.h> +#include <linux/regmap.h> #include <linux/reset.h> #include "../pci.h" @@ -930,9 +932,13 @@ static int mtk_pcie_parse_port(struct mtk_gen3_pcie *pcie) static int mtk_pcie_en7581_power_up(struct mtk_gen3_pcie *pcie) { + struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie); struct device *dev = pcie->dev; + struct resource_entry *entry; + u32 val, args[2], size, mask; + struct regmap *pbus_regmap; + resource_size_t addr; int err; - u32 val; /* * The controller may have been left out of reset by the bootloader @@ -944,6 +950,32 @@ static int mtk_pcie_en7581_power_up(struct mtk_gen3_pcie *pcie) /* Wait for the time needed to complete the reset lines assert. */ msleep(PCIE_EN7581_RESET_TIME_MS); + /* + * Configure PBus base address and base address mask to allow the + * hw to detect if a given address is accessible on PCIe controller. + */ + pbus_regmap = syscon_regmap_lookup_by_phandle_args(dev->of_node, + "mediatek,pbus-csr", + ARRAY_SIZE(args), + args); + if (IS_ERR(pbus_regmap)) + return PTR_ERR(pbus_regmap); + + entry = resource_list_first_type(&host->windows, IORESOURCE_MEM); + if (!entry) + return -EINVAL; + + addr = entry->res->start - entry->offset; + err = regmap_write(pbus_regmap, args[0], lower_32_bits(addr)); + if (err) + return err; + + size = lower_32_bits(resource_size(entry->res)); + mask = size ? GENMASK(31, __fls(size)) : 0; + err = regmap_write(pbus_regmap, args[1], mask); + if (err) + return err; + /* * Unlike the other MediaTek Gen3 controllers, the Airoha EN7581 * requires PHY initialization and power-on before PHY reset deassert. -- 2.48.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 2/2] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 SoC 2025-02-22 10:43 ` [PATCH v3 2/2] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 SoC Lorenzo Bianconi @ 2025-02-24 5:52 ` Manivannan Sadhasivam 2025-02-24 10:05 ` Lorenzo Bianconi 0 siblings, 1 reply; 10+ messages in thread From: Manivannan Sadhasivam @ 2025-02-24 5:52 UTC (permalink / raw) To: Lorenzo Bianconi Cc: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, linux-pci, linux-mediatek, devicetree, linux-arm-kernel, Krzysztof Wilczyński On Sat, Feb 22, 2025 at 11:43:45AM +0100, Lorenzo Bianconi wrote: > Configure PBus base address and address mask to allow the hw > to detect if a given address is accessible on PCIe controller. > > Fixes: f6ab898356dd ("PCI: mediatek-gen3: Add Airoha EN7581 support") > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > --- > drivers/pci/controller/pcie-mediatek-gen3.c | 34 ++++++++++++++++++++++++++++- > 1 file changed, 33 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c > index 0f64e76e2111468e6a453889ead7fbc75804faf7..51103b7624c09ca957c22a25536dc9da25428e48 100644 > --- a/drivers/pci/controller/pcie-mediatek-gen3.c > +++ b/drivers/pci/controller/pcie-mediatek-gen3.c > @@ -15,6 +15,7 @@ > #include <linux/irqchip/chained_irq.h> > #include <linux/irqdomain.h> > #include <linux/kernel.h> > +#include <linux/mfd/syscon.h> > #include <linux/module.h> > #include <linux/msi.h> > #include <linux/of_device.h> > @@ -24,6 +25,7 @@ > #include <linux/platform_device.h> > #include <linux/pm_domain.h> > #include <linux/pm_runtime.h> > +#include <linux/regmap.h> > #include <linux/reset.h> > > #include "../pci.h" > @@ -930,9 +932,13 @@ static int mtk_pcie_parse_port(struct mtk_gen3_pcie *pcie) > > static int mtk_pcie_en7581_power_up(struct mtk_gen3_pcie *pcie) > { > + struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie); > struct device *dev = pcie->dev; > + struct resource_entry *entry; > + u32 val, args[2], size, mask; > + struct regmap *pbus_regmap; > + resource_size_t addr; > int err; > - u32 val; > > /* > * The controller may have been left out of reset by the bootloader > @@ -944,6 +950,32 @@ static int mtk_pcie_en7581_power_up(struct mtk_gen3_pcie *pcie) > /* Wait for the time needed to complete the reset lines assert. */ > msleep(PCIE_EN7581_RESET_TIME_MS); > > + /* > + * Configure PBus base address and base address mask to allow the > + * hw to detect if a given address is accessible on PCIe controller. > + */ > + pbus_regmap = syscon_regmap_lookup_by_phandle_args(dev->of_node, > + "mediatek,pbus-csr", > + ARRAY_SIZE(args), > + args); > + if (IS_ERR(pbus_regmap)) > + return PTR_ERR(pbus_regmap); > + > + entry = resource_list_first_type(&host->windows, IORESOURCE_MEM); > + if (!entry) > + return -EINVAL; -ENODEV or -ENOMEM > + > + addr = entry->res->start - entry->offset; > + err = regmap_write(pbus_regmap, args[0], lower_32_bits(addr)); > + if (err) MMIO write is not supposed to fail. > + return err; > + > + size = lower_32_bits(resource_size(entry->res)); > + mask = size ? GENMASK(31, __fls(size)) : 0; Size of MEM region could be 0? > + err = regmap_write(pbus_regmap, args[1], mask); > + if (err) MMIO write is not supposed to fail. - Mani -- மணிவண்ணன் சதாசிவம் ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 2/2] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 SoC 2025-02-24 5:52 ` Manivannan Sadhasivam @ 2025-02-24 10:05 ` Lorenzo Bianconi 2025-02-24 13:18 ` Manivannan Sadhasivam 0 siblings, 1 reply; 10+ messages in thread From: Lorenzo Bianconi @ 2025-02-24 10:05 UTC (permalink / raw) To: Manivannan Sadhasivam Cc: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, linux-pci, linux-mediatek, devicetree, linux-arm-kernel, Krzysztof Wilczyński [-- Attachment #1: Type: text/plain, Size: 1158 bytes --] > On Sat, Feb 22, 2025 at 11:43:45AM +0100, Lorenzo Bianconi wrote: [...] > > + > > + entry = resource_list_first_type(&host->windows, IORESOURCE_MEM); > > + if (!entry) > > + return -EINVAL; > > -ENODEV or -ENOMEM ack, I will fix it in v4 > > > + > > + addr = entry->res->start - entry->offset; > > + err = regmap_write(pbus_regmap, args[0], lower_32_bits(addr)); > > + if (err) > > MMIO write is not supposed to fail. ack, I will fix it in v4 > > > + return err; > > + > > + size = lower_32_bits(resource_size(entry->res)); > > + mask = size ? GENMASK(31, __fls(size)) : 0; > > Size of MEM region could be 0? I added this check since we consider just lower_32_bits(). Do you think we should remove it? > > > + err = regmap_write(pbus_regmap, args[1], mask); > > + if (err) > > MMIO write is not supposed to fail. ack, I will fix it in v4 BTW I will remove your Reviwed-by tag since the patch has changed with respect to the one you added it. Please let me know if you prepfer to keep it. Regards, Lorenzo > > - Mani > > -- > மணிவண்ணன் சதாசிவம் [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 2/2] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 SoC 2025-02-24 10:05 ` Lorenzo Bianconi @ 2025-02-24 13:18 ` Manivannan Sadhasivam 0 siblings, 0 replies; 10+ messages in thread From: Manivannan Sadhasivam @ 2025-02-24 13:18 UTC (permalink / raw) To: Lorenzo Bianconi Cc: Ryder Lee, Jianjun Wang, Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, linux-pci, linux-mediatek, devicetree, linux-arm-kernel, Krzysztof Wilczyński On Mon, Feb 24, 2025 at 11:05:24AM +0100, Lorenzo Bianconi wrote: > > On Sat, Feb 22, 2025 at 11:43:45AM +0100, Lorenzo Bianconi wrote: > > [...] > > > > + > > > + entry = resource_list_first_type(&host->windows, IORESOURCE_MEM); > > > + if (!entry) > > > + return -EINVAL; > > > > -ENODEV or -ENOMEM > > ack, I will fix it in v4 > > > > > > + > > > + addr = entry->res->start - entry->offset; > > > + err = regmap_write(pbus_regmap, args[0], lower_32_bits(addr)); > > > + if (err) > > > > MMIO write is not supposed to fail. > > ack, I will fix it in v4 > > > > > > + return err; > > > + > > > + size = lower_32_bits(resource_size(entry->res)); > > > + mask = size ? GENMASK(31, __fls(size)) : 0; > > > > Size of MEM region could be 0? > > I added this check since we consider just lower_32_bits(). > Do you think we should remove it? > Yes please. > > > > > + err = regmap_write(pbus_regmap, args[1], mask); > > > + if (err) > > > > MMIO write is not supposed to fail. > > ack, I will fix it in v4 > > BTW I will remove your Reviwed-by tag since the patch has changed > with respect to the one you added it. Please let me know if you > prepfer to keep it. > Sure, fine with me. - Mani -- மணிவண்ணன் சதாசிவம் ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-02-24 13:20 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-02-22 10:43 [PATCH v3 0/2] PCI: mediatek-gen3: Set PBUS_CSR regs for Airoha EN7581 SoC Lorenzo Bianconi 2025-02-22 10:43 ` [PATCH v3 1/2] dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle array property Lorenzo Bianconi 2025-02-23 9:43 ` Krzysztof Kozlowski 2025-02-23 13:39 ` Lorenzo Bianconi 2025-02-24 8:26 ` Krzysztof Kozlowski 2025-02-24 5:43 ` Manivannan Sadhasivam 2025-02-22 10:43 ` [PATCH v3 2/2] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 SoC Lorenzo Bianconi 2025-02-24 5:52 ` Manivannan Sadhasivam 2025-02-24 10:05 ` Lorenzo Bianconi 2025-02-24 13:18 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).