aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/lantiq/ltq-ptm
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
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')
-rw-r--r--package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c38
-rw-r--r--package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.h2
-rw-r--r--package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_amazon_se.c10
-rw-r--r--package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_ar9.c10
-rw-r--r--package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_danube.c10
-rw-r--r--package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c37
-rw-r--r--package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.h2
-rw-r--r--package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c61
8 files changed, 128 insertions, 42 deletions
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
index 43e171a2b4..186c848693 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
@@ -44,6 +44,8 @@
#include <linux/etherdevice.h>
#include <linux/interrupt.h>
#include <linux/netdevice.h>
+#include <linux/platform_device.h>
+#include <linux/of_device.h>
#include <asm/io.h>
/*
@@ -1448,6 +1450,19 @@ static int ptm_showtime_exit(void)
}
+static const struct of_device_id ltq_ptm_match[] = {
+#ifdef CONFIG_DANUBE
+ { .compatible = "lantiq,ppe-danube", .data = NULL },
+#elif defined CONFIG_AMAZON_SE
+ { .compatible = "lantiq,ppe-ase", .data = NULL },
+#elif defined CONFIG_AR9
+ { .compatible = "lantiq,ppe-arx100", .data = NULL },
+#elif defined CONFIG_VR9
+ { .compatible = "lantiq,ppe-xrx200", .data = NULL },
+#endif
+ {},
+};
+MODULE_DEVICE_TABLE(of, ltq_ptm_match);
/*
* ####################################
@@ -1465,7 +1480,7 @@ static int ptm_showtime_exit(void)
* 0 --- successful
* else --- failure, usually it is negative value of error code
*/
-static int ifx_ptm_init(void)
+static int ltq_ptm_probe(struct platform_device *pdev)
{
int ret;
struct port_cell_info port_cell = {0};
@@ -1481,7 +1496,7 @@ static int ifx_ptm_init(void)
goto INIT_PRIV_DATA_FAIL;
}
- ifx_ptm_init_chip();
+ ifx_ptm_init_chip(pdev);
init_tables();
for ( i = 0; i < ARRAY_SIZE(g_net_dev); i++ ) {
@@ -1570,7 +1585,7 @@ INIT_PRIV_DATA_FAIL:
* Output:
* none
*/
-static void __exit ifx_ptm_exit(void)
+static int ltq_ptm_remove(struct platform_device *pdev)
{
int i;
@@ -1595,7 +1610,20 @@ static void __exit ifx_ptm_exit(void)
ifx_ptm_uninit_chip();
clear_priv_data();
+
+ return 0;
}
-module_init(ifx_ptm_init);
-module_exit(ifx_ptm_exit);
+static struct platform_driver ltq_ptm_driver = {
+ .probe = ltq_ptm_probe,
+ .remove = ltq_ptm_remove,
+ .driver = {
+ .name = "ptm",
+ .owner = THIS_MODULE,
+ .of_match_table = ltq_ptm_match,
+ },
+};
+
+module_platform_driver(ltq_ptm_driver);
+
+MODULE_LICENSE("GPL");
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.h b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.h
index de307bf732..6d1cbc7ea3 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.h
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.h
@@ -122,7 +122,7 @@ extern unsigned int ifx_ptm_dbg_enable;
extern void ifx_ptm_get_fw_ver(unsigned int *major, unsigned int *minor);
-extern void ifx_ptm_init_chip(void);
+extern void ifx_ptm_init_chip(struct platform_device *pdev);
extern void ifx_ptm_uninit_chip(void);
extern int ifx_pp32_start(int pp32);
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_amazon_se.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_amazon_se.c
index 077c900e27..81ed7f7805 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_amazon_se.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_amazon_se.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>
/*
@@ -84,7 +86,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);
@@ -129,7 +131,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)
{
#ifdef MODULE
unsigned int etop_cfg;
@@ -260,11 +262,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_ema();
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_ar9.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_ar9.c
index 777d5cfc9b..2f108286e2 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_ar9.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_ar9.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>
/*
@@ -80,7 +82,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);
@@ -130,7 +132,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
@@ -283,11 +285,11 @@ 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_ema();
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_danube.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_danube.c
index 279b03ba3a..47ee4110a3 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_danube.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_danube.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 <linux/delay.h>
/*
@@ -79,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);
@@ -125,7 +127,7 @@ static inline void uninit_pmu(void)
IFX_PMU_MODULE_DSL_DFE);
}
-static inline void reset_ppe(void)
+static inline void reset_ppe(struct platform_device *pdev)
{
#ifdef MODULE
/*unsigned int etop_cfg;
@@ -255,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_ema();
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
index 9cfeefd80e..9e24c69d94 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
@@ -33,6 +33,8 @@
#include <linux/etherdevice.h>
#include <linux/interrupt.h>
#include <linux/netdevice.h>
+#include <linux/platform_device.h>
+#include <linux/of_device.h>
#include "ifxmips_ptm_vdsl.h"
#include <lantiq_soc.h>
@@ -971,9 +973,21 @@ static int ptm_showtime_exit(void)
return 0;
}
+static const struct of_device_id ltq_ptm_match[] = {
+#ifdef CONFIG_DANUBE
+ { .compatible = "lantiq,ppe-danube", .data = NULL },
+#elif defined CONFIG_AMAZON_SE
+ { .compatible = "lantiq,ppe-ase", .data = NULL },
+#elif defined CONFIG_AR9
+ { .compatible = "lantiq,ppe-arx100", .data = NULL },
+#elif defined CONFIG_VR9
+ { .compatible = "lantiq,ppe-xrx200", .data = NULL },
+#endif
+ {},
+};
+MODULE_DEVICE_TABLE(of, ltq_ptm_match);
-
-static int ifx_ptm_init(void)
+static int ltq_ptm_probe(struct platform_device *pdev)
{
int ret;
int i;
@@ -986,7 +1000,7 @@ static int ifx_ptm_init(void)
goto INIT_PRIV_DATA_FAIL;
}
- ifx_ptm_init_chip();
+ ifx_ptm_init_chip(pdev);
ret = init_tables();
if ( ret != 0 ) {
err("INIT_TABLES_FAIL");
@@ -1068,7 +1082,7 @@ INIT_PRIV_DATA_FAIL:
return ret;
}
-static void __exit ifx_ptm_exit(void)
+static int ltq_ptm_remove(struct platform_device *pdev)
{
int i;
ifx_mei_atm_showtime_enter = NULL;
@@ -1092,6 +1106,8 @@ static void __exit ifx_ptm_exit(void)
ifx_ptm_uninit_chip();
clear_priv_data();
+
+ return 0;
}
#ifndef MODULE
@@ -1120,8 +1136,17 @@ static int __init queue_gamma_map_setup(char *line)
return 0;
}
#endif
-module_init(ifx_ptm_init);
-module_exit(ifx_ptm_exit);
+static struct platform_driver ltq_ptm_driver = {
+ .probe = ltq_ptm_probe,
+ .remove = ltq_ptm_remove,
+ .driver = {
+ .name = "ptm",
+ .owner = THIS_MODULE,
+ .of_match_table = ltq_ptm_match,
+ },
+};
+
+module_platform_driver(ltq_ptm_driver);
#ifndef MODULE
__setup("wanqos_en=", wanqos_en_setup);
__setup("queue_gamma_map=", queue_gamma_map_setup);
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.h b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.h
index b06232d0f8..c0318805c5 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.h
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.h
@@ -113,7 +113,7 @@ extern unsigned int ifx_ptm_dbg_enable;
extern void ifx_ptm_get_fw_ver(unsigned int *major, unsigned int *minor);
-extern void ifx_ptm_init_chip(void);
+extern void ifx_ptm_init_chip(struct platform_device *pdev);
extern void ifx_ptm_uninit_chip(void);
extern int ifx_pp32_start(int pp32);
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();