#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/ioctl.h>
+#include <linux/platform_device.h>
#include <asm/delay.h>
/*
*/
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);
//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;
*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();
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/ioctl.h>
+#include <linux/platform_device.h>
#include <asm/delay.h>
/*
*/
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);
{
}
-static inline void reset_ppe(void)
+static inline void reset_ppe(struct platform_device *pdev)
{
#ifdef MODULE
// reset PPE
*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();
#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);
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/ioctl.h>
+#include <linux/platform_device.h>
#include <linux/delay.h>
/*
#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)
#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;
*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;
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);
#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"
#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)
*minor = FW_VER_ID->minor;
}
-static void vr9_init(void)
+static void vr9_init(struct platform_device *pdev)
{
volatile u32 *p;
unsigned int i;
IFX_PMU_MODULE_AHBS |
IFX_PMU_MODULE_DSL_DFE);
- vr9_reset_ppe();
+ vr9_reset_ppe(pdev);
/* pdma init */
IFX_REG_W32(0x08, PDMA_CFG);
goto INIT_PRIV_DATA_FAIL;
}
- ops->init();
+ ops->init(pdev);
init_rx_tables();
init_tx_tables();
#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>
/*
}
+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);
/*
* ####################################
* 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};
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++ ) {
* Output:
* none
*/
-static void __exit ifx_ptm_exit(void)
+static int ltq_ptm_remove(struct platform_device *pdev)
{
int i;
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");
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);
#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>
/*
*/
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);
//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;
*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();
#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>
/*
*/
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);
}
-static inline void reset_ppe(void)
+static inline void reset_ppe(struct platform_device *pdev)
{
#ifdef MODULE
// reset PPE
*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();
#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>
/*
*/
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);
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;
*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();
#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>
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;
goto INIT_PRIV_DATA_FAIL;
}
- ifx_ptm_init_chip();
+ ifx_ptm_init_chip(pdev);
ret = init_tables();
if ( ret != 0 ) {
err("INIT_TABLES_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;
ifx_ptm_uninit_chip();
clear_priv_data();
+
+ return 0;
}
#ifndef MODULE
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);
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);
#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>
/*
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);
{
}
-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)
*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();
compatible = "lantiq,ppe-xrx200";
interrupt-parent = <&icu0>;
interrupts = <96>;
+ resets = <&reset0 3 3>, <&reset0 11 11>, <&reset0 23 23>;
+ reset-names = "dsp", "dfe", "tc";
};
pcie0: pcie@d900000 {