Loading drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +64 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ static unsigned char dev_addr[ETH_ALEN] = { 0, 0x55, 0x7b, 0xb5, 0x7d, 0xf7}; void *ipc_stmmac_log_ctxt; void *ipc_stmmac_log_ctxt_low; int stmmac_enable_ipc_low; #define MAX_PROC_SIZE 1024 char tmp_buff[MAX_PROC_SIZE]; static struct qmp_pkt pkt; static char qmp_buf[MAX_QMP_MSG_SIZE + 1] = {0}; static struct ip_params pparams = {"", "", "", ""}; Loading Loading @@ -1172,10 +1176,55 @@ static const struct file_operations fops_rgmii_reg_dump = { .llseek = default_llseek, }; static ssize_t write_ipc_stmmac_log_ctxt_low(struct file *file, const char __user *buf, size_t count, loff_t *data) { int tmp = 0; if (count > MAX_PROC_SIZE) count = MAX_PROC_SIZE; if (copy_from_user(tmp_buff, buf, count)) return -EFAULT; if (sscanf(tmp_buff, "%du", &tmp) < 0) { pr_err("sscanf failed\n"); } else { if (tmp) { if (!ipc_stmmac_log_ctxt_low) { ipc_stmmac_log_ctxt_low = ipc_log_context_create(IPCLOG_STATE_PAGES, "stmmac_low", 0); } if (!ipc_stmmac_log_ctxt_low) { pr_err("failed to create ipc stmmac low context\n"); return -EFAULT; } } else { if (ipc_stmmac_log_ctxt_low) { ipc_log_context_destroy( ipc_stmmac_log_ctxt_low ); } ipc_stmmac_log_ctxt_low = NULL; } } stmmac_enable_ipc_low = tmp; return count; } static const struct file_operations fops_ipc_stmmac_log_low = { .write = write_ipc_stmmac_log_ctxt_low, .open = simple_open, .owner = THIS_MODULE, .llseek = default_llseek, }; static int ethqos_create_debugfs(struct qcom_ethqos *ethqos) { static struct dentry *phy_reg_dump; static struct dentry *rgmii_reg_dump; static struct dentry *ipc_stmmac_log_low; if (!ethqos) { ETHQOSERR("Null Param %s\n", __func__); Loading Loading @@ -1204,6 +1253,16 @@ static int ethqos_create_debugfs(struct qcom_ethqos *ethqos) ETHQOSERR("Can't create rgmii_dump %d\n", (int)rgmii_reg_dump); goto fail; } ipc_stmmac_log_low = debugfs_create_file("ipc_stmmac_log_low", 0220, ethqos->debugfs_dir, ethqos, &fops_ipc_stmmac_log_low); if (!ipc_stmmac_log_low || IS_ERR(ipc_stmmac_log_low)) { ETHQOSERR("Cannot create debugfs ipc_stmmac_log_low %d\n", (int)ipc_stmmac_log_low); goto fail; } return 0; fail: Loading Loading @@ -1972,6 +2031,11 @@ static void __exit qcom_ethqos_exit_module(void) if (!ipc_stmmac_log_ctxt) ipc_log_context_destroy(ipc_stmmac_log_ctxt); if (!ipc_stmmac_log_ctxt_low) ipc_log_context_destroy(ipc_stmmac_log_ctxt_low); ipc_stmmac_log_ctxt = NULL; ipc_stmmac_log_ctxt_low = NULL; ETHQOSINFO("\n"); } Loading drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h +45 −3 Original line number Diff line number Diff line Loading @@ -28,29 +28,71 @@ #include <linux/uaccess.h> extern void *ipc_stmmac_log_ctxt; extern void *ipc_stmmac_log_ctxt_low; #define QCOM_ETH_QOS_MAC_ADDR_LEN 6 #define QCOM_ETH_QOS_MAC_ADDR_STR_LEN 18 #define IPCLOG_STATE_PAGES 50 #define MAX_QMP_MSG_SIZE 96 #define IPC_RATELIMIT_BURST 1 #define __FILENAME__ (strrchr(__FILE__, '/') ? \ strrchr(__FILE__, '/') + 1 : __FILE__) #define DRV_NAME "qcom-ethqos" #define ETHQOSDBG(fmt, args...) \ pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args) do {\ pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\ if (ipc_stmmac_log_ctxt) { \ ipc_log_string(ipc_stmmac_log_ctxt, \ "%s: %s[%u]:[stmmac] DEBUG:" fmt, __FILENAME__,\ __func__, __LINE__, ## args); \ } \ } while (0) #define ETHQOSERR(fmt, args...) \ do {\ pr_err(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\ if (ipc_stmmac_log_ctxt) { \ ipc_log_string(ipc_stmmac_log_ctxt, \ "%s: %s[%u]:[emac] ERROR:" fmt, __FILENAME__,\ "%s: %s[%u]:[stmmac] ERROR:" fmt, __FILENAME__,\ __func__, __LINE__, ## args); \ } \ } while (0) #define ETHQOSINFO(fmt, args...) \ pr_info(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args) do {\ pr_info(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\ if (ipc_stmmac_log_ctxt) { \ ipc_log_string(ipc_stmmac_log_ctxt, \ "%s: %s[%u]:[stmmac] INFO:" fmt, __FILENAME__,\ __func__, __LINE__, ## args); \ } \ } while (0) #define IPC_LOW(fmt, args...) \ do {\ if (ipc_stmmac_log_ctxt_low) { \ ipc_log_string(ipc_stmmac_log_ctxt_low, \ "%s: %s[%u]:[stmmac] DEBUG:" fmt, __FILENAME__, \ __func__, __LINE__, ## args); \ } \ } while (0) /* Printing one error message in 5 seconds if multiple error messages * are coming back to back. */ #define pr_err_ratelimited_ipc(fmt, ...) \ printk_ratelimited_ipc(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) #define printk_ratelimited_ipc(fmt, ...) \ ({ \ static DEFINE_RATELIMIT_STATE(_rs, DEFAULT_RATELIMIT_INTERVAL, \ IPC_RATELIMIT_BURST); \ if (__ratelimit(&_rs)) \ printk(fmt, ##__VA_ARGS__); \ }) #define IPCERR_RL(fmt, args...) \ pr_err_ratelimited_ipc(DRV_NAME " %s:%d " fmt, __func__,\ __LINE__, ## args) #define RGMII_IO_MACRO_CONFIG 0x0 #define SDCC_HC_REG_DLL_CONFIG 0x4 #define SDCC_HC_REG_DDR_CONFIG 0xC Loading Loading
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +64 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ static unsigned char dev_addr[ETH_ALEN] = { 0, 0x55, 0x7b, 0xb5, 0x7d, 0xf7}; void *ipc_stmmac_log_ctxt; void *ipc_stmmac_log_ctxt_low; int stmmac_enable_ipc_low; #define MAX_PROC_SIZE 1024 char tmp_buff[MAX_PROC_SIZE]; static struct qmp_pkt pkt; static char qmp_buf[MAX_QMP_MSG_SIZE + 1] = {0}; static struct ip_params pparams = {"", "", "", ""}; Loading Loading @@ -1172,10 +1176,55 @@ static const struct file_operations fops_rgmii_reg_dump = { .llseek = default_llseek, }; static ssize_t write_ipc_stmmac_log_ctxt_low(struct file *file, const char __user *buf, size_t count, loff_t *data) { int tmp = 0; if (count > MAX_PROC_SIZE) count = MAX_PROC_SIZE; if (copy_from_user(tmp_buff, buf, count)) return -EFAULT; if (sscanf(tmp_buff, "%du", &tmp) < 0) { pr_err("sscanf failed\n"); } else { if (tmp) { if (!ipc_stmmac_log_ctxt_low) { ipc_stmmac_log_ctxt_low = ipc_log_context_create(IPCLOG_STATE_PAGES, "stmmac_low", 0); } if (!ipc_stmmac_log_ctxt_low) { pr_err("failed to create ipc stmmac low context\n"); return -EFAULT; } } else { if (ipc_stmmac_log_ctxt_low) { ipc_log_context_destroy( ipc_stmmac_log_ctxt_low ); } ipc_stmmac_log_ctxt_low = NULL; } } stmmac_enable_ipc_low = tmp; return count; } static const struct file_operations fops_ipc_stmmac_log_low = { .write = write_ipc_stmmac_log_ctxt_low, .open = simple_open, .owner = THIS_MODULE, .llseek = default_llseek, }; static int ethqos_create_debugfs(struct qcom_ethqos *ethqos) { static struct dentry *phy_reg_dump; static struct dentry *rgmii_reg_dump; static struct dentry *ipc_stmmac_log_low; if (!ethqos) { ETHQOSERR("Null Param %s\n", __func__); Loading Loading @@ -1204,6 +1253,16 @@ static int ethqos_create_debugfs(struct qcom_ethqos *ethqos) ETHQOSERR("Can't create rgmii_dump %d\n", (int)rgmii_reg_dump); goto fail; } ipc_stmmac_log_low = debugfs_create_file("ipc_stmmac_log_low", 0220, ethqos->debugfs_dir, ethqos, &fops_ipc_stmmac_log_low); if (!ipc_stmmac_log_low || IS_ERR(ipc_stmmac_log_low)) { ETHQOSERR("Cannot create debugfs ipc_stmmac_log_low %d\n", (int)ipc_stmmac_log_low); goto fail; } return 0; fail: Loading Loading @@ -1972,6 +2031,11 @@ static void __exit qcom_ethqos_exit_module(void) if (!ipc_stmmac_log_ctxt) ipc_log_context_destroy(ipc_stmmac_log_ctxt); if (!ipc_stmmac_log_ctxt_low) ipc_log_context_destroy(ipc_stmmac_log_ctxt_low); ipc_stmmac_log_ctxt = NULL; ipc_stmmac_log_ctxt_low = NULL; ETHQOSINFO("\n"); } Loading
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h +45 −3 Original line number Diff line number Diff line Loading @@ -28,29 +28,71 @@ #include <linux/uaccess.h> extern void *ipc_stmmac_log_ctxt; extern void *ipc_stmmac_log_ctxt_low; #define QCOM_ETH_QOS_MAC_ADDR_LEN 6 #define QCOM_ETH_QOS_MAC_ADDR_STR_LEN 18 #define IPCLOG_STATE_PAGES 50 #define MAX_QMP_MSG_SIZE 96 #define IPC_RATELIMIT_BURST 1 #define __FILENAME__ (strrchr(__FILE__, '/') ? \ strrchr(__FILE__, '/') + 1 : __FILE__) #define DRV_NAME "qcom-ethqos" #define ETHQOSDBG(fmt, args...) \ pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args) do {\ pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\ if (ipc_stmmac_log_ctxt) { \ ipc_log_string(ipc_stmmac_log_ctxt, \ "%s: %s[%u]:[stmmac] DEBUG:" fmt, __FILENAME__,\ __func__, __LINE__, ## args); \ } \ } while (0) #define ETHQOSERR(fmt, args...) \ do {\ pr_err(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\ if (ipc_stmmac_log_ctxt) { \ ipc_log_string(ipc_stmmac_log_ctxt, \ "%s: %s[%u]:[emac] ERROR:" fmt, __FILENAME__,\ "%s: %s[%u]:[stmmac] ERROR:" fmt, __FILENAME__,\ __func__, __LINE__, ## args); \ } \ } while (0) #define ETHQOSINFO(fmt, args...) \ pr_info(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args) do {\ pr_info(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\ if (ipc_stmmac_log_ctxt) { \ ipc_log_string(ipc_stmmac_log_ctxt, \ "%s: %s[%u]:[stmmac] INFO:" fmt, __FILENAME__,\ __func__, __LINE__, ## args); \ } \ } while (0) #define IPC_LOW(fmt, args...) \ do {\ if (ipc_stmmac_log_ctxt_low) { \ ipc_log_string(ipc_stmmac_log_ctxt_low, \ "%s: %s[%u]:[stmmac] DEBUG:" fmt, __FILENAME__, \ __func__, __LINE__, ## args); \ } \ } while (0) /* Printing one error message in 5 seconds if multiple error messages * are coming back to back. */ #define pr_err_ratelimited_ipc(fmt, ...) \ printk_ratelimited_ipc(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) #define printk_ratelimited_ipc(fmt, ...) \ ({ \ static DEFINE_RATELIMIT_STATE(_rs, DEFAULT_RATELIMIT_INTERVAL, \ IPC_RATELIMIT_BURST); \ if (__ratelimit(&_rs)) \ printk(fmt, ##__VA_ARGS__); \ }) #define IPCERR_RL(fmt, args...) \ pr_err_ratelimited_ipc(DRV_NAME " %s:%d " fmt, __func__,\ __LINE__, ## args) #define RGMII_IO_MACRO_CONFIG 0x0 #define SDCC_HC_REG_DLL_CONFIG 0x4 #define SDCC_HC_REG_DDR_CONFIG 0xC Loading