aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/lantiq/ltq-atm/src
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-atm/src
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-atm/src')
-rw-r--r--package/kernel/lantiq/ltq-atm/src/ifxmips_atm_amazon_se.c9
-rw-r--r--package/kernel/lantiq/ltq-atm/src/ifxmips_atm_ar9.c9
-rw-r--r--package/kernel/lantiq/ltq-atm/src/ifxmips_atm_core.h2
-rw-r--r--package/kernel/lantiq/ltq-atm/src/ifxmips_atm_danube.c9
-rw-r--r--package/kernel/lantiq/ltq-atm/src/ifxmips_atm_vr9.c45
-rw-r--r--package/kernel/lantiq/ltq-atm/src/ltq_atm.c2
6 files changed, 53 insertions, 23 deletions
diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_amazon_se.c b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_amazon_se.c
index 01a2e30abd..8777418dc5 100644
--- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_amazon_se.c
+++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_amazon_se.c
@@ -40,6 +40,7 @@
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/ioctl.h>
+#include <linux/platform_device.h>
#include <asm/delay.h>
/*
@@ -80,7 +81,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_ema(void);
static inline void init_mailbox(void);
static inline void init_atm_tc(void);
@@ -136,7 +137,7 @@ static inline void uninit_pmu(void)
//PPE_TOP_PMU_SETUP(IFX_PMU_DISABLE);*/
}
-static inline void reset_ppe(void)
+static inline void reset_ppe(struct platform_device *pdev)
{
#if 0 //MODULE
unsigned int etop_cfg;
@@ -262,11 +263,11 @@ extern void ase_fw_ver(unsigned int *major, unsigned int *minor)
*minor = FW_VER_ID->minor;
}
-void ase_init(void)
+void ase_init(struct platform_device *pdev)
{
init_pmu();
- reset_ppe();
+ reset_ppe(pdev);
init_ema();
diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_ar9.c b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_ar9.c
index b68848b22d..2100aea81e 100644
--- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_ar9.c
+++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_ar9.c
@@ -40,6 +40,7 @@
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/ioctl.h>
+#include <linux/platform_device.h>
#include <asm/delay.h>
/*
@@ -83,7 +84,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_ema(void);
static inline void init_mailbox(void);
static inline void clear_share_buffer(void);
@@ -125,7 +126,7 @@ 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
@@ -193,10 +194,10 @@ void ar9_fw_ver(unsigned int *major, unsigned int *minor)
*minor = FW_VER_ID->minor;
}
-void ar9_init(void)
+void ar9_init(struct platform_device *pdev)
{
init_pmu();
- reset_ppe();
+ reset_ppe(pdev);
init_ema();
init_mailbox();
clear_share_buffer();
diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_core.h b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_core.h
index 398be7d828..31b80cf86f 100644
--- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_core.h
+++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_core.h
@@ -34,7 +34,7 @@
#define SET_BITS(x, msb, lsb, value) (((x) & ~(((1 << ((msb) + 1)) - 1) ^ ((1 << (lsb)) - 1))) | (((value) & ((1 << (1 + (msb) - (lsb))) - 1)) << (lsb)))
struct ltq_atm_ops {
- void (*init)(void);
+ void (*init)(struct platform_device *pdev);
void (*shutdown)(void);
int (*start)(int pp32);
diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_danube.c b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_danube.c
index 9bab5b4a98..8302ae743a 100644
--- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_danube.c
+++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_danube.c
@@ -40,6 +40,7 @@
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/ioctl.h>
+#include <linux/platform_device.h>
#include <linux/delay.h>
/*
@@ -61,7 +62,7 @@
#define EMA_WRITE_BURST 0x2
#define EMA_READ_BURST 0x2
-static inline void reset_ppe(void);
+static inline void reset_ppe(struct platform_device *pdev);
#define IFX_PMU_MODULE_PPE_SLL01 BIT(19)
#define IFX_PMU_MODULE_PPE_TC BIT(21)
@@ -70,7 +71,7 @@ static inline void reset_ppe(void);
#define IFX_PMU_MODULE_TPE BIT(13)
#define IFX_PMU_MODULE_DSL_DFE BIT(9)
-static inline void reset_ppe(void)
+static inline void reset_ppe(struct platform_device *pdev)
{
/*#ifdef MODULE
unsigned int etop_cfg;
@@ -140,7 +141,7 @@ static void danube_fw_ver(unsigned int *major, unsigned int *minor)
*minor = FW_VER_ID->minor;
}
-static void danube_init(void)
+static void danube_init(struct platform_device *pdev)
{
volatile u32 *p = SB_RAM0_ADDR(0);
unsigned int i;
@@ -152,7 +153,7 @@ static void danube_init(void)
IFX_PMU_MODULE_TPE |
IFX_PMU_MODULE_DSL_DFE);
- reset_ppe();
+ reset_ppe(pdev);
/* init ema */
IFX_REG_W32((EMA_CMD_BUF_LEN << 16) | (EMA_CMD_BASE_ADDR >> 2), EMA_CMDCFG);
diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_vr9.c b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_vr9.c
index 89c71e37e6..8638b12b4e 100644
--- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_vr9.c
+++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_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>
#include "ifxmips_atm_core.h"
@@ -56,21 +58,46 @@
#define IFX_PMU_MODULE_AHBS BIT(13)
#define IFX_PMU_MODULE_DSL_DFE BIT(9)
-static inline void vr9_reset_ppe(void)
+static inline void vr9_reset_ppe(struct platform_device *pdev)
{
-/*#ifdef MODULE
- // reset PPE
- ifx_rcu_rst(IFX_RCU_DOMAIN_DSLDFE, IFX_RCU_MODULE_ATM);
+#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);
- ifx_rcu_rst(IFX_RCU_DOMAIN_DSLTC, IFX_RCU_MODULE_ATM);
+ reset_control_assert(dfe);
udelay(1000);
- ifx_rcu_rst(IFX_RCU_DOMAIN_PPE, IFX_RCU_MODULE_ATM);
+ reset_control_assert(tc);
udelay(1000);
*PP32_SRST &= ~0x000303CF;
udelay(1000);
*PP32_SRST |= 0x000303CF;
udelay(1000);
-#endif*/
+#endif
}
static inline int vr9_pp32_download_code(int pp32, u32 *code_src, unsigned int code_dword_len, u32 *data_src, unsigned int data_dword_len)
@@ -107,7 +134,7 @@ static void vr9_fw_ver(unsigned int *major, unsigned int *minor)
*minor = FW_VER_ID->minor;
}
-static void vr9_init(void)
+static void vr9_init(struct platform_device *pdev)
{
volatile u32 *p;
unsigned int i;
@@ -120,7 +147,7 @@ static void vr9_init(void)
IFX_PMU_MODULE_AHBS |
IFX_PMU_MODULE_DSL_DFE);
- vr9_reset_ppe();
+ vr9_reset_ppe(pdev);
/* pdma init */
IFX_REG_W32(0x08, PDMA_CFG);
diff --git a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c
index b7ac81ca80..6e6f4c66c7 100644
--- a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c
+++ b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c
@@ -1777,7 +1777,7 @@ static int ltq_atm_probe(struct platform_device *pdev)
goto INIT_PRIV_DATA_FAIL;
}
- ops->init();
+ ops->init(pdev);
init_rx_tables();
init_tx_tables();