ipq4019: patch initialization of Lantiq DSL on FritzBox 7530.
Some VRX518 modems fail to initialize properly with the error message "dc_ep_clk_on failed". As a result, the DSL data path doesn't work. This hack, which is based on code from the FRITZ!Box 7530 GPL archive, fixes the issue. It changes the PCIe vendor/device ID to values matching a Lantiq SoC. It also appears to emulate a Lantiq CPU ID register for connected PCIe devices, by remapping the matching address area to a specially crafted buffer using the address translation unit. A dedicated compatible is created to activate this in the device tree, so this shouldn't affect any devices other than FRITZ!Box 7530/7520. Original investigation was done in59f5212517which used the "avm,host_magic" property to enabled the patch. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Signed-off-by: Florian Maurer <f.maurer@outlook.de> Link: https://github.com/openwrt/openwrt/pull/17622 Signed-off-by: Robert Marko <robimarko@gmail.com> (cherry picked from commit676dcb1b2c)
This commit is contained in:
committed by
Robert Marko
parent
3207fe6636
commit
f31ab2abef
@@ -0,0 +1,42 @@
|
||||
From a78794562fcb2659c976388b1285eddda97e9954 Mon Sep 17 00:00:00 2001
|
||||
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
Date: Tue, 10 Oct 2023 21:29:13 +0530
|
||||
Subject: [PATCH] PCI: dwc: Add host_post_init() callback
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This callback can be used by the platform drivers to do configuration
|
||||
once all the devices are scanned. Like changing LNKCTL of all downstream
|
||||
devices to enable ASPM etc...
|
||||
|
||||
Link: https://lore.kernel.org/linux-pci/20231010155914.9516-2-manivannan.sadhasivam@linaro.org
|
||||
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
|
||||
---
|
||||
drivers/pci/controller/dwc/pcie-designware-host.c | 3 +++
|
||||
drivers/pci/controller/dwc/pcie-designware.h | 1 +
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
|
||||
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
|
||||
@@ -502,6 +502,9 @@ int dw_pcie_host_init(struct dw_pcie_rp
|
||||
if (ret)
|
||||
goto err_stop_link;
|
||||
|
||||
+ if (pp->ops->host_post_init)
|
||||
+ pp->ops->host_post_init(pp);
|
||||
+
|
||||
return 0;
|
||||
|
||||
err_stop_link:
|
||||
--- a/drivers/pci/controller/dwc/pcie-designware.h
|
||||
+++ b/drivers/pci/controller/dwc/pcie-designware.h
|
||||
@@ -301,6 +301,7 @@ enum dw_pcie_ltssm {
|
||||
struct dw_pcie_host_ops {
|
||||
int (*host_init)(struct dw_pcie_rp *pp);
|
||||
void (*host_deinit)(struct dw_pcie_rp *pp);
|
||||
+ void (*host_post_init)(struct dw_pcie_rp *pp);
|
||||
int (*msi_host_init)(struct dw_pcie_rp *pp);
|
||||
void (*pme_turn_off)(struct dw_pcie_rp *pp);
|
||||
};
|
||||
@@ -0,0 +1,102 @@
|
||||
From 9f4f3dfad8cf08208fbb78b1b9cbf957c12618b9 Mon Sep 17 00:00:00 2001
|
||||
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
Date: Tue, 10 Oct 2023 21:29:14 +0530
|
||||
Subject: [PATCH] PCI: qcom: Enable ASPM for platforms supporting 1.9.0 ops
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
ASPM is supported by Qcom host controllers/bridges on most of the recent
|
||||
platforms and so the devices tested so far. But for enabling ASPM by
|
||||
default (without using Kconfig, kernel command-line or sysfs), BIOS has
|
||||
to enable ASPM on both host bridge and downstream devices during boot.
|
||||
|
||||
Unfortunately, none of the BIOS available on Qcom platforms enables
|
||||
ASPM. Due to this, the platforms making use of Qcom SoCs draw high power
|
||||
during runtime.
|
||||
|
||||
To fix this power draw issue, users have to enable ASPM using Kconfig,
|
||||
kernel command-line, sysfs or the BIOS has to start enabling ASPM.
|
||||
|
||||
The latter may happen in the future, but that won't address the issue on
|
||||
current platforms. Also, asking users to enable a feature to get the power
|
||||
management right would provide an unpleasant out-of-the-box experience.
|
||||
|
||||
So the apt solution is to enable ASPM in the controller driver itself. And
|
||||
this is being accomplished by calling pci_enable_link_state() in the newly
|
||||
introduced host_post_init() callback for all the devices connected to the
|
||||
bus. This function enables all supported link low power states for both
|
||||
host bridge and the downstream devices.
|
||||
|
||||
Due to limited testing, ASPM is only enabled for platforms making use of
|
||||
ops_1_9_0 callbacks.
|
||||
|
||||
[kwilczynski: commit log]
|
||||
Link: https://lore.kernel.org/linux-pci/20231010155914.9516-3-manivannan.sadhasivam@linaro.org
|
||||
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
|
||||
---
|
||||
drivers/pci/controller/dwc/pcie-qcom.c | 28 ++++++++++++++++++++++++++
|
||||
1 file changed, 28 insertions(+)
|
||||
|
||||
--- a/drivers/pci/controller/dwc/pcie-qcom.c
|
||||
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
|
||||
@@ -222,6 +222,7 @@ struct qcom_pcie_ops {
|
||||
int (*get_resources)(struct qcom_pcie *pcie);
|
||||
int (*init)(struct qcom_pcie *pcie);
|
||||
int (*post_init)(struct qcom_pcie *pcie);
|
||||
+ void (*host_post_init)(struct qcom_pcie *pcie);
|
||||
void (*deinit)(struct qcom_pcie *pcie);
|
||||
void (*ltssm_enable)(struct qcom_pcie *pcie);
|
||||
int (*config_sid)(struct qcom_pcie *pcie);
|
||||
@@ -966,6 +967,22 @@ static int qcom_pcie_post_init_2_7_0(str
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int qcom_pcie_enable_aspm(struct pci_dev *pdev, void *userdata)
|
||||
+{
|
||||
+ /* Downstream devices need to be in D0 state before enabling PCI PM substates */
|
||||
+ pci_set_power_state(pdev, PCI_D0);
|
||||
+ pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void qcom_pcie_host_post_init_2_7_0(struct qcom_pcie *pcie)
|
||||
+{
|
||||
+ struct dw_pcie_rp *pp = &pcie->pci->pp;
|
||||
+
|
||||
+ pci_walk_bus(pp->bridge->bus, qcom_pcie_enable_aspm, NULL);
|
||||
+}
|
||||
+
|
||||
static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie)
|
||||
{
|
||||
struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0;
|
||||
@@ -1224,9 +1241,19 @@ static void qcom_pcie_host_deinit(struct
|
||||
pcie->cfg->ops->deinit(pcie);
|
||||
}
|
||||
|
||||
+static void qcom_pcie_host_post_init(struct dw_pcie_rp *pp)
|
||||
+{
|
||||
+ struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
|
||||
+ struct qcom_pcie *pcie = to_qcom_pcie(pci);
|
||||
+
|
||||
+ if (pcie->cfg->ops->host_post_init)
|
||||
+ pcie->cfg->ops->host_post_init(pcie);
|
||||
+}
|
||||
+
|
||||
static const struct dw_pcie_host_ops qcom_pcie_dw_ops = {
|
||||
.host_init = qcom_pcie_host_init,
|
||||
.host_deinit = qcom_pcie_host_deinit,
|
||||
+ .host_post_init = qcom_pcie_host_post_init,
|
||||
};
|
||||
|
||||
/* Qcom IP rev.: 2.1.0 Synopsys IP rev.: 4.01a */
|
||||
@@ -1288,6 +1315,7 @@ static const struct qcom_pcie_ops ops_1_
|
||||
.get_resources = qcom_pcie_get_resources_2_7_0,
|
||||
.init = qcom_pcie_init_2_7_0,
|
||||
.post_init = qcom_pcie_post_init_2_7_0,
|
||||
+ .host_post_init = qcom_pcie_host_post_init_2_7_0,
|
||||
.deinit = qcom_pcie_deinit_2_7_0,
|
||||
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
|
||||
.config_sid = qcom_pcie_config_sid_1_9_0,
|
||||
Reference in New Issue
Block a user