aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c
diff options
context:
space:
mode:
authorMartin Schiller <ms@dev.tdt.de>2018-12-05 08:51:13 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2019-03-10 16:49:31 +0100
commitff3cfe084885662843a6cc95a547eb9f8ef48fa5 (patch)
treeba59b42001269fb03490e5d5b03cbd706b66bbdd /package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c
parenteae6cac6a30b95bef04d033ed8a303b7e35a078b (diff)
downloadupstream-ff3cfe084885662843a6cc95a547eb9f8ef48fa5.tar.gz
upstream-ff3cfe084885662843a6cc95a547eb9f8ef48fa5.tar.bz2
upstream-ff3cfe084885662843a6cc95a547eb9f8ef48fa5.zip
ltq-atm/ltq-ptm: re-enable/fix reset_ppe() functionality for VR9
This patch re-enables the reset_ppe() functionality for VR9 targets by using the new lantiq rcu subsystem. The reset sequence in the reset_ppe() function was taken from the ppa datapath driver of lantiq UGW 7.4.1. Additionally it adds the required reset definitions to the vr9 dtsi file. It also prepares the reset_ppe() function calls for the other lantiq targets. This feature is needed to be able to switch between ltq-atm/ltq-ptm driver in ATM/PTM Auto-Mode at runtime. Signed-off-by: Martin Schiller <ms@dev.tdt.de>
Diffstat (limited to 'package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c')
-rw-r--r--package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c61
1 files changed, 44 insertions, 17 deletions
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c
index 0a02569cef..cf0897b563 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c
@@ -40,6 +40,8 @@
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/ioctl.h>
+#include <linux/platform_device.h>
+#include <linux/reset.h>
#include <asm/delay.h>
/*
@@ -52,7 +54,7 @@
static inline void init_pmu(void);
static inline void uninit_pmu(void);
-static inline void reset_ppe(void);
+static inline void reset_ppe(struct platform_device *pdev);
static inline void init_pdma(void);
static inline void init_mailbox(void);
static inline void init_atm_tc(void);
@@ -80,21 +82,46 @@ static inline void uninit_pmu(void)
{
}
-static inline void reset_ppe(void)
+static inline void reset_ppe(struct platform_device *pdev)
{
-/*#ifdef MODULE
- // reset PPE
- ifx_rcu_rst(IFX_RCU_DOMAIN_DSLDFE, IFX_RCU_MODULE_PTM);
- udelay(1000);
- ifx_rcu_rst(IFX_RCU_DOMAIN_DSLTC, IFX_RCU_MODULE_PTM);
- udelay(1000);
- ifx_rcu_rst(IFX_RCU_DOMAIN_PPE, IFX_RCU_MODULE_PTM);
- udelay(1000);
- *PP32_SRST &= ~0x000303CF;
- udelay(1000);
- *PP32_SRST |= 0x000303CF;
- udelay(1000);
-#endif*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
+ struct device *dev = &pdev->dev;
+ struct reset_control *dsp;
+ struct reset_control *dfe;
+ struct reset_control *tc;
+
+ dsp = devm_reset_control_get(dev, "dsp");
+ if (IS_ERR(dsp)) {
+ if (PTR_ERR(dsp) != -EPROBE_DEFER)
+ dev_err(dev, "Failed to lookup dsp reset\n");
+// return PTR_ERR(dsp);
+ }
+
+ dfe = devm_reset_control_get(dev, "dfe");
+ if (IS_ERR(dfe)) {
+ if (PTR_ERR(dfe) != -EPROBE_DEFER)
+ dev_err(dev, "Failed to lookup dfe reset\n");
+// return PTR_ERR(dfe);
+ }
+
+ tc = devm_reset_control_get(dev, "tc");
+ if (IS_ERR(tc)) {
+ if (PTR_ERR(tc) != -EPROBE_DEFER)
+ dev_err(dev, "Failed to lookup tc reset\n");
+// return PTR_ERR(tc);
+ }
+
+ reset_control_assert(dsp);
+ udelay(1000);
+ reset_control_assert(dfe);
+ udelay(1000);
+ reset_control_assert(tc);
+ udelay(1000);
+ *PP32_SRST &= ~0x000303CF;
+ udelay(1000);
+ *PP32_SRST |= 0x000303CF;
+ udelay(1000);
+#endif
}
static inline void init_pdma(void)
@@ -230,11 +257,11 @@ extern void ifx_ptm_get_fw_ver(unsigned int *major, unsigned int *minor)
*minor = FW_VER_ID->minor;
}
-void ifx_ptm_init_chip(void)
+void ifx_ptm_init_chip(struct platform_device *pdev)
{
init_pmu();
- reset_ppe();
+ reset_ppe(pdev);
init_pdma();