Loading drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +47 −46 Original line number Original line Diff line number Diff line Loading @@ -34,11 +34,12 @@ static unsigned long tlmm_central_base_addr; bool phy_intr_en; bool phy_intr_en; struct qcom_ethqos *pethqos; struct qcom_ethqos *pethqos; struct emac_emb_smmu_cb_ctx emac_emb_smmu_ctx = {0}; struct stmmac_emb_smmu_cb_ctx stmmac_emb_smmu_ctx = {0}; static unsigned char dev_addr[ETH_ALEN] = { static unsigned char dev_addr[ETH_ALEN] = { 0, 0x55, 0x7b, 0xb5, 0x7d, 0xf7}; 0, 0x55, 0x7b, 0xb5, 0x7d, 0xf7}; void *ipc_emac_log_ctxt; void *ipc_stmmac_log_ctxt; static struct qmp_pkt pkt; static struct qmp_pkt pkt; static char qmp_buf[MAX_QMP_MSG_SIZE + 1] = {0}; static char qmp_buf[MAX_QMP_MSG_SIZE + 1] = {0}; static struct ip_params pparams = {"", "", "", ""}; static struct ip_params pparams = {"", "", "", ""}; Loading Loading @@ -1218,22 +1219,22 @@ static void ethqos_emac_mem_base(struct qcom_ethqos *ethqos) ethqos->emac_mem_size = resource_size(resource); ethqos->emac_mem_size = resource_size(resource); } } static void emac_emb_smmu_exit(void) static void stmmac_emb_smmu_exit(void) { { if (emac_emb_smmu_ctx.valid) { if (stmmac_emb_smmu_ctx.valid) { if (emac_emb_smmu_ctx.smmu_pdev) if (stmmac_emb_smmu_ctx.smmu_pdev) arm_iommu_detach_device arm_iommu_detach_device (&emac_emb_smmu_ctx.smmu_pdev->dev); (&stmmac_emb_smmu_ctx.smmu_pdev->dev); if (emac_emb_smmu_ctx.mapping) if (stmmac_emb_smmu_ctx.mapping) arm_iommu_release_mapping(emac_emb_smmu_ctx.mapping); arm_iommu_release_mapping(stmmac_emb_smmu_ctx.mapping); emac_emb_smmu_ctx.valid = false; stmmac_emb_smmu_ctx.valid = false; emac_emb_smmu_ctx.mapping = NULL; stmmac_emb_smmu_ctx.mapping = NULL; emac_emb_smmu_ctx.pdev_master = NULL; stmmac_emb_smmu_ctx.pdev_master = NULL; emac_emb_smmu_ctx.smmu_pdev = NULL; stmmac_emb_smmu_ctx.smmu_pdev = NULL; } } } } static int emac_emb_smmu_cb_probe(struct platform_device *pdev) static int stmmac_emb_smmu_cb_probe(struct platform_device *pdev) { { int result; int result; u32 iova_ap_mapping[2]; u32 iova_ap_mapping[2]; Loading @@ -1250,12 +1251,12 @@ static int emac_emb_smmu_cb_probe(struct platform_device *pdev) ETHQOSERR("Failed to read EMB start/size iova addresses\n"); ETHQOSERR("Failed to read EMB start/size iova addresses\n"); return result; return result; } } emac_emb_smmu_ctx.va_start = iova_ap_mapping[0]; stmmac_emb_smmu_ctx.va_start = iova_ap_mapping[0]; emac_emb_smmu_ctx.va_size = iova_ap_mapping[1]; stmmac_emb_smmu_ctx.va_size = iova_ap_mapping[1]; emac_emb_smmu_ctx.va_end = emac_emb_smmu_ctx.va_start + stmmac_emb_smmu_ctx.va_end = stmmac_emb_smmu_ctx.va_start + emac_emb_smmu_ctx.va_size; stmmac_emb_smmu_ctx.va_size; emac_emb_smmu_ctx.smmu_pdev = pdev; stmmac_emb_smmu_ctx.smmu_pdev = pdev; if (dma_set_mask(dev, DMA_BIT_MASK(32)) || if (dma_set_mask(dev, DMA_BIT_MASK(32)) || dma_set_coherent_mask(dev, DMA_BIT_MASK(32))) { dma_set_coherent_mask(dev, DMA_BIT_MASK(32))) { Loading @@ -1263,18 +1264,18 @@ static int emac_emb_smmu_cb_probe(struct platform_device *pdev) return -EOPNOTSUPP; return -EOPNOTSUPP; } } emac_emb_smmu_ctx.mapping = arm_iommu_create_mapping stmmac_emb_smmu_ctx.mapping = arm_iommu_create_mapping (dev->bus, emac_emb_smmu_ctx.va_start, emac_emb_smmu_ctx.va_size); (dev->bus, stmmac_emb_smmu_ctx.va_start, stmmac_emb_smmu_ctx.va_size); if (IS_ERR_OR_NULL(emac_emb_smmu_ctx.mapping)) { if (IS_ERR_OR_NULL(stmmac_emb_smmu_ctx.mapping)) { ETHQOSDBG("Fail to create mapping\n"); ETHQOSDBG("Fail to create mapping\n"); /* assume this failure is because iommu driver is not ready */ /* assume this failure is because iommu driver is not ready */ return -EPROBE_DEFER; return -EPROBE_DEFER; } } ETHQOSDBG("Successfully Created SMMU mapping\n"); ETHQOSDBG("Successfully Created SMMU mapping\n"); emac_emb_smmu_ctx.valid = true; stmmac_emb_smmu_ctx.valid = true; if (of_property_read_bool(dev->of_node, "qcom,smmu-s1-bypass")) { if (of_property_read_bool(dev->of_node, "qcom,smmu-s1-bypass")) { if (iommu_domain_set_attr(emac_emb_smmu_ctx.mapping->domain, if (iommu_domain_set_attr(stmmac_emb_smmu_ctx.mapping->domain, DOMAIN_ATTR_S1_BYPASS, DOMAIN_ATTR_S1_BYPASS, &bypass)) { &bypass)) { ETHQOSERR("Couldn't set SMMU S1 bypass\n"); ETHQOSERR("Couldn't set SMMU S1 bypass\n"); Loading @@ -1283,7 +1284,7 @@ static int emac_emb_smmu_cb_probe(struct platform_device *pdev) } } ETHQOSDBG("SMMU S1 BYPASS set\n"); ETHQOSDBG("SMMU S1 BYPASS set\n"); } else { } else { if (iommu_domain_set_attr(emac_emb_smmu_ctx.mapping->domain, if (iommu_domain_set_attr(stmmac_emb_smmu_ctx.mapping->domain, DOMAIN_ATTR_ATOMIC, DOMAIN_ATTR_ATOMIC, &atomic_ctx)) { &atomic_ctx)) { ETHQOSERR("Couldn't set SMMU domain as atomic\n"); ETHQOSERR("Couldn't set SMMU domain as atomic\n"); Loading @@ -1291,7 +1292,7 @@ static int emac_emb_smmu_cb_probe(struct platform_device *pdev) goto err_smmu_probe; goto err_smmu_probe; } } ETHQOSDBG("SMMU atomic set\n"); ETHQOSDBG("SMMU atomic set\n"); if (iommu_domain_set_attr(emac_emb_smmu_ctx.mapping->domain, if (iommu_domain_set_attr(stmmac_emb_smmu_ctx.mapping->domain, DOMAIN_ATTR_FAST, DOMAIN_ATTR_FAST, &fast)) { &fast)) { ETHQOSERR("Couldn't set FAST SMMU\n"); ETHQOSERR("Couldn't set FAST SMMU\n"); Loading @@ -1301,27 +1302,27 @@ static int emac_emb_smmu_cb_probe(struct platform_device *pdev) ETHQOSDBG("SMMU fast map set\n"); ETHQOSDBG("SMMU fast map set\n"); } } result = arm_iommu_attach_device(&emac_emb_smmu_ctx.smmu_pdev->dev, result = arm_iommu_attach_device(&stmmac_emb_smmu_ctx.smmu_pdev->dev, emac_emb_smmu_ctx.mapping); stmmac_emb_smmu_ctx.mapping); if (result) { if (result) { ETHQOSERR("couldn't attach to IOMMU ret=%d\n", result); ETHQOSERR("couldn't attach to IOMMU ret=%d\n", result); goto err_smmu_probe; goto err_smmu_probe; } } emac_emb_smmu_ctx.iommu_domain = stmmac_emb_smmu_ctx.iommu_domain = iommu_get_domain_for_dev(&emac_emb_smmu_ctx.smmu_pdev->dev); iommu_get_domain_for_dev(&stmmac_emb_smmu_ctx.smmu_pdev->dev); ETHQOSDBG("Successfully attached to IOMMU\n"); ETHQOSDBG("Successfully attached to IOMMU\n"); if (emac_emb_smmu_ctx.pdev_master) if (stmmac_emb_smmu_ctx.pdev_master) goto smmu_probe_done; goto smmu_probe_done; err_smmu_probe: err_smmu_probe: if (emac_emb_smmu_ctx.mapping) if (stmmac_emb_smmu_ctx.mapping) arm_iommu_release_mapping(emac_emb_smmu_ctx.mapping); arm_iommu_release_mapping(stmmac_emb_smmu_ctx.mapping); emac_emb_smmu_ctx.valid = false; stmmac_emb_smmu_ctx.valid = false; smmu_probe_done: smmu_probe_done: emac_emb_smmu_ctx.ret = result; stmmac_emb_smmu_ctx.ret = result; return result; return result; } } Loading Loading @@ -1639,16 +1640,16 @@ static int qcom_ethqos_probe(struct platform_device *pdev) place_marker("M - Ethernet probe start"); place_marker("M - Ethernet probe start"); #endif #endif ipc_emac_log_ctxt = ipc_log_context_create(IPCLOG_STATE_PAGES, ipc_stmmac_log_ctxt = ipc_log_context_create(IPCLOG_STATE_PAGES, "emac", 0); "emac", 0); if (!ipc_emac_log_ctxt) if (!ipc_stmmac_log_ctxt) ETHQOSINFO("Error creating logging context for emac\n"); ETHQOSERR("Error creating logging context for emac\n"); else else ETHQOSINFO("IPC logging has been enabled for emac\n"); ETHQOSINFO("IPC logging has been enabled for emac\n"); if (of_device_is_compatible(pdev->dev.of_node, if (of_device_is_compatible(pdev->dev.of_node, "qcom,emac-smmu-embedded")) "qcom,emac-smmu-embedded")) return emac_emb_smmu_cb_probe(pdev); return stmmac_emb_smmu_cb_probe(pdev); ret = stmmac_get_platform_resources(pdev, &stmmac_res); ret = stmmac_get_platform_resources(pdev, &stmmac_res); if (ret) if (ret) return ret; return ret; Loading Loading @@ -1721,16 +1722,16 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->early_eth = ethqos->early_eth_enabled; plat_dat->early_eth = ethqos->early_eth_enabled; if (of_property_read_bool(pdev->dev.of_node, "qcom,arm-smmu")) { if (of_property_read_bool(pdev->dev.of_node, "qcom,arm-smmu")) { emac_emb_smmu_ctx.pdev_master = pdev; stmmac_emb_smmu_ctx.pdev_master = pdev; ret = of_platform_populate(pdev->dev.of_node, ret = of_platform_populate(pdev->dev.of_node, qcom_ethqos_match, NULL, &pdev->dev); qcom_ethqos_match, NULL, &pdev->dev); if (ret) if (ret) ETHQOSERR("Failed to populate EMAC platform\n"); ETHQOSERR("Failed to populate EMAC platform\n"); if (emac_emb_smmu_ctx.ret) { if (stmmac_emb_smmu_ctx.ret) { ETHQOSERR("smmu probe failed\n"); ETHQOSERR("smmu probe failed\n"); of_platform_depopulate(&pdev->dev); of_platform_depopulate(&pdev->dev); ret = emac_emb_smmu_ctx.ret; ret = stmmac_emb_smmu_ctx.ret; emac_emb_smmu_ctx.ret = 0; stmmac_emb_smmu_ctx.ret = 0; } } } } Loading Loading @@ -1843,7 +1844,7 @@ static int qcom_ethqos_remove(struct platform_device *pdev) if (phy_intr_en) if (phy_intr_en) cancel_work_sync(ðqos->emac_phy_work); cancel_work_sync(ðqos->emac_phy_work); emac_emb_smmu_exit(); stmmac_emb_smmu_exit(); ethqos_disable_regulators(ethqos); ethqos_disable_regulators(ethqos); return ret; return ret; Loading Loading @@ -1962,8 +1963,8 @@ static void __exit qcom_ethqos_exit_module(void) platform_driver_unregister(&qcom_ethqos_driver); platform_driver_unregister(&qcom_ethqos_driver); if (!ipc_emac_log_ctxt) if (!ipc_stmmac_log_ctxt) ipc_log_context_destroy(ipc_emac_log_ctxt); ipc_log_context_destroy(ipc_stmmac_log_ctxt); ETHQOSINFO("\n"); ETHQOSINFO("\n"); } } Loading drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h +3 −3 Original line number Original line Diff line number Diff line Loading @@ -27,7 +27,7 @@ #include <linux/uaccess.h> #include <linux/uaccess.h> extern void *ipc_emac_log_ctxt; extern void *ipc_stmmac_log_ctxt; #define QCOM_ETH_QOS_MAC_ADDR_LEN 6 #define QCOM_ETH_QOS_MAC_ADDR_LEN 6 #define QCOM_ETH_QOS_MAC_ADDR_STR_LEN 18 #define QCOM_ETH_QOS_MAC_ADDR_STR_LEN 18 Loading @@ -43,8 +43,8 @@ extern void *ipc_emac_log_ctxt; #define ETHQOSERR(fmt, args...) \ #define ETHQOSERR(fmt, args...) \ do {\ do {\ pr_err(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\ pr_err(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\ if (ipc_emac_log_ctxt) { \ if (ipc_stmmac_log_ctxt) { \ ipc_log_string(ipc_emac_log_ctxt, \ ipc_log_string(ipc_stmmac_log_ctxt, \ "%s: %s[%u]:[emac] ERROR:" fmt, __FILENAME__,\ "%s: %s[%u]:[emac] ERROR:" fmt, __FILENAME__,\ __func__, __LINE__, ## args); \ __func__, __LINE__, ## args); \ } \ } \ Loading drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ipa.c +4 −4 Original line number Original line Diff line number Diff line Loading @@ -1676,7 +1676,7 @@ static int ethqos_ipa_offload_connect(struct qcom_ethqos *ethqos) in.clnt_hndl = eth_ipa->ipa_client_hndl; in.clnt_hndl = eth_ipa->ipa_client_hndl; /* Uplink Setup */ /* Uplink Setup */ if (emac_emb_smmu_ctx.valid) if (stmmac_emb_smmu_ctx.valid) rx_setup_info.smmu_enabled = true; rx_setup_info.smmu_enabled = true; else else rx_setup_info.smmu_enabled = false; rx_setup_info.smmu_enabled = false; Loading Loading @@ -1705,7 +1705,7 @@ static int ethqos_ipa_offload_connect(struct qcom_ethqos *ethqos) (((unsigned long)(DMA_CR0_RGOFFADDR - BASE_ADDRESS)) + (((unsigned long)(DMA_CR0_RGOFFADDR - BASE_ADDRESS)) + (unsigned long)ethqos->emac_mem_base); (unsigned long)ethqos->emac_mem_base); /* Downlink Setup */ /* Downlink Setup */ if (emac_emb_smmu_ctx.valid) if (stmmac_emb_smmu_ctx.valid) tx_setup_info.smmu_enabled = true; tx_setup_info.smmu_enabled = true; else else tx_setup_info.smmu_enabled = false; tx_setup_info.smmu_enabled = false; Loading Loading @@ -1773,7 +1773,7 @@ static int ethqos_ipa_offload_connect(struct qcom_ethqos *ethqos) = eth_ipa_ctx.tx_queue->ipa_tx_buff_phy_addr[i]; = eth_ipa_ctx.tx_queue->ipa_tx_buff_phy_addr[i]; } } if (emac_emb_smmu_ctx.valid) { if (stmmac_emb_smmu_ctx.valid) { ret = ethqos_set_ul_dl_smmu_ipa_params(ethqos, &rx_setup_info, ret = ethqos_set_ul_dl_smmu_ipa_params(ethqos, &rx_setup_info, &tx_setup_info); &tx_setup_info); if (ret) { if (ret) { Loading Loading @@ -1823,7 +1823,7 @@ static int ethqos_ipa_offload_connect(struct qcom_ethqos *ethqos) kfree(tx_setup_info.data_buff_list); kfree(tx_setup_info.data_buff_list); tx_setup_info.data_buff_list = NULL; tx_setup_info.data_buff_list = NULL; if (emac_emb_smmu_ctx.valid) { if (stmmac_emb_smmu_ctx.valid) { if (rx_setup_info.ring_base_sgt) { if (rx_setup_info.ring_base_sgt) { sg_free_table(rx_setup_info.ring_base_sgt); sg_free_table(rx_setup_info.ring_base_sgt); kfree(rx_setup_info.ring_base_sgt); kfree(rx_setup_info.ring_base_sgt); Loading drivers/net/ethernet/stmicro/stmmac/stmmac.h +4 −4 Original line number Original line Diff line number Diff line Loading @@ -155,7 +155,7 @@ struct stmmac_priv { #endif #endif }; }; struct emac_emb_smmu_cb_ctx { struct stmmac_emb_smmu_cb_ctx { bool valid; bool valid; struct platform_device *pdev_master; struct platform_device *pdev_master; struct platform_device *smmu_pdev; struct platform_device *smmu_pdev; Loading @@ -167,10 +167,10 @@ struct emac_emb_smmu_cb_ctx { int ret; int ret; }; }; extern struct emac_emb_smmu_cb_ctx emac_emb_smmu_ctx; extern struct stmmac_emb_smmu_cb_ctx stmmac_emb_smmu_ctx; #define GET_MEM_PDEV_DEV (emac_emb_smmu_ctx.valid ? \ #define GET_MEM_PDEV_DEV (stmmac_emb_smmu_ctx.valid ? \ &emac_emb_smmu_ctx.smmu_pdev->dev : priv->device) &stmmac_emb_smmu_ctx.smmu_pdev->dev : priv->device) int ethqos_handle_prv_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int ethqos_handle_prv_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int ethqos_init_pps(struct stmmac_priv *priv); int ethqos_init_pps(struct stmmac_priv *priv); Loading Loading
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +47 −46 Original line number Original line Diff line number Diff line Loading @@ -34,11 +34,12 @@ static unsigned long tlmm_central_base_addr; bool phy_intr_en; bool phy_intr_en; struct qcom_ethqos *pethqos; struct qcom_ethqos *pethqos; struct emac_emb_smmu_cb_ctx emac_emb_smmu_ctx = {0}; struct stmmac_emb_smmu_cb_ctx stmmac_emb_smmu_ctx = {0}; static unsigned char dev_addr[ETH_ALEN] = { static unsigned char dev_addr[ETH_ALEN] = { 0, 0x55, 0x7b, 0xb5, 0x7d, 0xf7}; 0, 0x55, 0x7b, 0xb5, 0x7d, 0xf7}; void *ipc_emac_log_ctxt; void *ipc_stmmac_log_ctxt; static struct qmp_pkt pkt; static struct qmp_pkt pkt; static char qmp_buf[MAX_QMP_MSG_SIZE + 1] = {0}; static char qmp_buf[MAX_QMP_MSG_SIZE + 1] = {0}; static struct ip_params pparams = {"", "", "", ""}; static struct ip_params pparams = {"", "", "", ""}; Loading Loading @@ -1218,22 +1219,22 @@ static void ethqos_emac_mem_base(struct qcom_ethqos *ethqos) ethqos->emac_mem_size = resource_size(resource); ethqos->emac_mem_size = resource_size(resource); } } static void emac_emb_smmu_exit(void) static void stmmac_emb_smmu_exit(void) { { if (emac_emb_smmu_ctx.valid) { if (stmmac_emb_smmu_ctx.valid) { if (emac_emb_smmu_ctx.smmu_pdev) if (stmmac_emb_smmu_ctx.smmu_pdev) arm_iommu_detach_device arm_iommu_detach_device (&emac_emb_smmu_ctx.smmu_pdev->dev); (&stmmac_emb_smmu_ctx.smmu_pdev->dev); if (emac_emb_smmu_ctx.mapping) if (stmmac_emb_smmu_ctx.mapping) arm_iommu_release_mapping(emac_emb_smmu_ctx.mapping); arm_iommu_release_mapping(stmmac_emb_smmu_ctx.mapping); emac_emb_smmu_ctx.valid = false; stmmac_emb_smmu_ctx.valid = false; emac_emb_smmu_ctx.mapping = NULL; stmmac_emb_smmu_ctx.mapping = NULL; emac_emb_smmu_ctx.pdev_master = NULL; stmmac_emb_smmu_ctx.pdev_master = NULL; emac_emb_smmu_ctx.smmu_pdev = NULL; stmmac_emb_smmu_ctx.smmu_pdev = NULL; } } } } static int emac_emb_smmu_cb_probe(struct platform_device *pdev) static int stmmac_emb_smmu_cb_probe(struct platform_device *pdev) { { int result; int result; u32 iova_ap_mapping[2]; u32 iova_ap_mapping[2]; Loading @@ -1250,12 +1251,12 @@ static int emac_emb_smmu_cb_probe(struct platform_device *pdev) ETHQOSERR("Failed to read EMB start/size iova addresses\n"); ETHQOSERR("Failed to read EMB start/size iova addresses\n"); return result; return result; } } emac_emb_smmu_ctx.va_start = iova_ap_mapping[0]; stmmac_emb_smmu_ctx.va_start = iova_ap_mapping[0]; emac_emb_smmu_ctx.va_size = iova_ap_mapping[1]; stmmac_emb_smmu_ctx.va_size = iova_ap_mapping[1]; emac_emb_smmu_ctx.va_end = emac_emb_smmu_ctx.va_start + stmmac_emb_smmu_ctx.va_end = stmmac_emb_smmu_ctx.va_start + emac_emb_smmu_ctx.va_size; stmmac_emb_smmu_ctx.va_size; emac_emb_smmu_ctx.smmu_pdev = pdev; stmmac_emb_smmu_ctx.smmu_pdev = pdev; if (dma_set_mask(dev, DMA_BIT_MASK(32)) || if (dma_set_mask(dev, DMA_BIT_MASK(32)) || dma_set_coherent_mask(dev, DMA_BIT_MASK(32))) { dma_set_coherent_mask(dev, DMA_BIT_MASK(32))) { Loading @@ -1263,18 +1264,18 @@ static int emac_emb_smmu_cb_probe(struct platform_device *pdev) return -EOPNOTSUPP; return -EOPNOTSUPP; } } emac_emb_smmu_ctx.mapping = arm_iommu_create_mapping stmmac_emb_smmu_ctx.mapping = arm_iommu_create_mapping (dev->bus, emac_emb_smmu_ctx.va_start, emac_emb_smmu_ctx.va_size); (dev->bus, stmmac_emb_smmu_ctx.va_start, stmmac_emb_smmu_ctx.va_size); if (IS_ERR_OR_NULL(emac_emb_smmu_ctx.mapping)) { if (IS_ERR_OR_NULL(stmmac_emb_smmu_ctx.mapping)) { ETHQOSDBG("Fail to create mapping\n"); ETHQOSDBG("Fail to create mapping\n"); /* assume this failure is because iommu driver is not ready */ /* assume this failure is because iommu driver is not ready */ return -EPROBE_DEFER; return -EPROBE_DEFER; } } ETHQOSDBG("Successfully Created SMMU mapping\n"); ETHQOSDBG("Successfully Created SMMU mapping\n"); emac_emb_smmu_ctx.valid = true; stmmac_emb_smmu_ctx.valid = true; if (of_property_read_bool(dev->of_node, "qcom,smmu-s1-bypass")) { if (of_property_read_bool(dev->of_node, "qcom,smmu-s1-bypass")) { if (iommu_domain_set_attr(emac_emb_smmu_ctx.mapping->domain, if (iommu_domain_set_attr(stmmac_emb_smmu_ctx.mapping->domain, DOMAIN_ATTR_S1_BYPASS, DOMAIN_ATTR_S1_BYPASS, &bypass)) { &bypass)) { ETHQOSERR("Couldn't set SMMU S1 bypass\n"); ETHQOSERR("Couldn't set SMMU S1 bypass\n"); Loading @@ -1283,7 +1284,7 @@ static int emac_emb_smmu_cb_probe(struct platform_device *pdev) } } ETHQOSDBG("SMMU S1 BYPASS set\n"); ETHQOSDBG("SMMU S1 BYPASS set\n"); } else { } else { if (iommu_domain_set_attr(emac_emb_smmu_ctx.mapping->domain, if (iommu_domain_set_attr(stmmac_emb_smmu_ctx.mapping->domain, DOMAIN_ATTR_ATOMIC, DOMAIN_ATTR_ATOMIC, &atomic_ctx)) { &atomic_ctx)) { ETHQOSERR("Couldn't set SMMU domain as atomic\n"); ETHQOSERR("Couldn't set SMMU domain as atomic\n"); Loading @@ -1291,7 +1292,7 @@ static int emac_emb_smmu_cb_probe(struct platform_device *pdev) goto err_smmu_probe; goto err_smmu_probe; } } ETHQOSDBG("SMMU atomic set\n"); ETHQOSDBG("SMMU atomic set\n"); if (iommu_domain_set_attr(emac_emb_smmu_ctx.mapping->domain, if (iommu_domain_set_attr(stmmac_emb_smmu_ctx.mapping->domain, DOMAIN_ATTR_FAST, DOMAIN_ATTR_FAST, &fast)) { &fast)) { ETHQOSERR("Couldn't set FAST SMMU\n"); ETHQOSERR("Couldn't set FAST SMMU\n"); Loading @@ -1301,27 +1302,27 @@ static int emac_emb_smmu_cb_probe(struct platform_device *pdev) ETHQOSDBG("SMMU fast map set\n"); ETHQOSDBG("SMMU fast map set\n"); } } result = arm_iommu_attach_device(&emac_emb_smmu_ctx.smmu_pdev->dev, result = arm_iommu_attach_device(&stmmac_emb_smmu_ctx.smmu_pdev->dev, emac_emb_smmu_ctx.mapping); stmmac_emb_smmu_ctx.mapping); if (result) { if (result) { ETHQOSERR("couldn't attach to IOMMU ret=%d\n", result); ETHQOSERR("couldn't attach to IOMMU ret=%d\n", result); goto err_smmu_probe; goto err_smmu_probe; } } emac_emb_smmu_ctx.iommu_domain = stmmac_emb_smmu_ctx.iommu_domain = iommu_get_domain_for_dev(&emac_emb_smmu_ctx.smmu_pdev->dev); iommu_get_domain_for_dev(&stmmac_emb_smmu_ctx.smmu_pdev->dev); ETHQOSDBG("Successfully attached to IOMMU\n"); ETHQOSDBG("Successfully attached to IOMMU\n"); if (emac_emb_smmu_ctx.pdev_master) if (stmmac_emb_smmu_ctx.pdev_master) goto smmu_probe_done; goto smmu_probe_done; err_smmu_probe: err_smmu_probe: if (emac_emb_smmu_ctx.mapping) if (stmmac_emb_smmu_ctx.mapping) arm_iommu_release_mapping(emac_emb_smmu_ctx.mapping); arm_iommu_release_mapping(stmmac_emb_smmu_ctx.mapping); emac_emb_smmu_ctx.valid = false; stmmac_emb_smmu_ctx.valid = false; smmu_probe_done: smmu_probe_done: emac_emb_smmu_ctx.ret = result; stmmac_emb_smmu_ctx.ret = result; return result; return result; } } Loading Loading @@ -1639,16 +1640,16 @@ static int qcom_ethqos_probe(struct platform_device *pdev) place_marker("M - Ethernet probe start"); place_marker("M - Ethernet probe start"); #endif #endif ipc_emac_log_ctxt = ipc_log_context_create(IPCLOG_STATE_PAGES, ipc_stmmac_log_ctxt = ipc_log_context_create(IPCLOG_STATE_PAGES, "emac", 0); "emac", 0); if (!ipc_emac_log_ctxt) if (!ipc_stmmac_log_ctxt) ETHQOSINFO("Error creating logging context for emac\n"); ETHQOSERR("Error creating logging context for emac\n"); else else ETHQOSINFO("IPC logging has been enabled for emac\n"); ETHQOSINFO("IPC logging has been enabled for emac\n"); if (of_device_is_compatible(pdev->dev.of_node, if (of_device_is_compatible(pdev->dev.of_node, "qcom,emac-smmu-embedded")) "qcom,emac-smmu-embedded")) return emac_emb_smmu_cb_probe(pdev); return stmmac_emb_smmu_cb_probe(pdev); ret = stmmac_get_platform_resources(pdev, &stmmac_res); ret = stmmac_get_platform_resources(pdev, &stmmac_res); if (ret) if (ret) return ret; return ret; Loading Loading @@ -1721,16 +1722,16 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->early_eth = ethqos->early_eth_enabled; plat_dat->early_eth = ethqos->early_eth_enabled; if (of_property_read_bool(pdev->dev.of_node, "qcom,arm-smmu")) { if (of_property_read_bool(pdev->dev.of_node, "qcom,arm-smmu")) { emac_emb_smmu_ctx.pdev_master = pdev; stmmac_emb_smmu_ctx.pdev_master = pdev; ret = of_platform_populate(pdev->dev.of_node, ret = of_platform_populate(pdev->dev.of_node, qcom_ethqos_match, NULL, &pdev->dev); qcom_ethqos_match, NULL, &pdev->dev); if (ret) if (ret) ETHQOSERR("Failed to populate EMAC platform\n"); ETHQOSERR("Failed to populate EMAC platform\n"); if (emac_emb_smmu_ctx.ret) { if (stmmac_emb_smmu_ctx.ret) { ETHQOSERR("smmu probe failed\n"); ETHQOSERR("smmu probe failed\n"); of_platform_depopulate(&pdev->dev); of_platform_depopulate(&pdev->dev); ret = emac_emb_smmu_ctx.ret; ret = stmmac_emb_smmu_ctx.ret; emac_emb_smmu_ctx.ret = 0; stmmac_emb_smmu_ctx.ret = 0; } } } } Loading Loading @@ -1843,7 +1844,7 @@ static int qcom_ethqos_remove(struct platform_device *pdev) if (phy_intr_en) if (phy_intr_en) cancel_work_sync(ðqos->emac_phy_work); cancel_work_sync(ðqos->emac_phy_work); emac_emb_smmu_exit(); stmmac_emb_smmu_exit(); ethqos_disable_regulators(ethqos); ethqos_disable_regulators(ethqos); return ret; return ret; Loading Loading @@ -1962,8 +1963,8 @@ static void __exit qcom_ethqos_exit_module(void) platform_driver_unregister(&qcom_ethqos_driver); platform_driver_unregister(&qcom_ethqos_driver); if (!ipc_emac_log_ctxt) if (!ipc_stmmac_log_ctxt) ipc_log_context_destroy(ipc_emac_log_ctxt); ipc_log_context_destroy(ipc_stmmac_log_ctxt); ETHQOSINFO("\n"); ETHQOSINFO("\n"); } } Loading
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h +3 −3 Original line number Original line Diff line number Diff line Loading @@ -27,7 +27,7 @@ #include <linux/uaccess.h> #include <linux/uaccess.h> extern void *ipc_emac_log_ctxt; extern void *ipc_stmmac_log_ctxt; #define QCOM_ETH_QOS_MAC_ADDR_LEN 6 #define QCOM_ETH_QOS_MAC_ADDR_LEN 6 #define QCOM_ETH_QOS_MAC_ADDR_STR_LEN 18 #define QCOM_ETH_QOS_MAC_ADDR_STR_LEN 18 Loading @@ -43,8 +43,8 @@ extern void *ipc_emac_log_ctxt; #define ETHQOSERR(fmt, args...) \ #define ETHQOSERR(fmt, args...) \ do {\ do {\ pr_err(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\ pr_err(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\ if (ipc_emac_log_ctxt) { \ if (ipc_stmmac_log_ctxt) { \ ipc_log_string(ipc_emac_log_ctxt, \ ipc_log_string(ipc_stmmac_log_ctxt, \ "%s: %s[%u]:[emac] ERROR:" fmt, __FILENAME__,\ "%s: %s[%u]:[emac] ERROR:" fmt, __FILENAME__,\ __func__, __LINE__, ## args); \ __func__, __LINE__, ## args); \ } \ } \ Loading
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ipa.c +4 −4 Original line number Original line Diff line number Diff line Loading @@ -1676,7 +1676,7 @@ static int ethqos_ipa_offload_connect(struct qcom_ethqos *ethqos) in.clnt_hndl = eth_ipa->ipa_client_hndl; in.clnt_hndl = eth_ipa->ipa_client_hndl; /* Uplink Setup */ /* Uplink Setup */ if (emac_emb_smmu_ctx.valid) if (stmmac_emb_smmu_ctx.valid) rx_setup_info.smmu_enabled = true; rx_setup_info.smmu_enabled = true; else else rx_setup_info.smmu_enabled = false; rx_setup_info.smmu_enabled = false; Loading Loading @@ -1705,7 +1705,7 @@ static int ethqos_ipa_offload_connect(struct qcom_ethqos *ethqos) (((unsigned long)(DMA_CR0_RGOFFADDR - BASE_ADDRESS)) + (((unsigned long)(DMA_CR0_RGOFFADDR - BASE_ADDRESS)) + (unsigned long)ethqos->emac_mem_base); (unsigned long)ethqos->emac_mem_base); /* Downlink Setup */ /* Downlink Setup */ if (emac_emb_smmu_ctx.valid) if (stmmac_emb_smmu_ctx.valid) tx_setup_info.smmu_enabled = true; tx_setup_info.smmu_enabled = true; else else tx_setup_info.smmu_enabled = false; tx_setup_info.smmu_enabled = false; Loading Loading @@ -1773,7 +1773,7 @@ static int ethqos_ipa_offload_connect(struct qcom_ethqos *ethqos) = eth_ipa_ctx.tx_queue->ipa_tx_buff_phy_addr[i]; = eth_ipa_ctx.tx_queue->ipa_tx_buff_phy_addr[i]; } } if (emac_emb_smmu_ctx.valid) { if (stmmac_emb_smmu_ctx.valid) { ret = ethqos_set_ul_dl_smmu_ipa_params(ethqos, &rx_setup_info, ret = ethqos_set_ul_dl_smmu_ipa_params(ethqos, &rx_setup_info, &tx_setup_info); &tx_setup_info); if (ret) { if (ret) { Loading Loading @@ -1823,7 +1823,7 @@ static int ethqos_ipa_offload_connect(struct qcom_ethqos *ethqos) kfree(tx_setup_info.data_buff_list); kfree(tx_setup_info.data_buff_list); tx_setup_info.data_buff_list = NULL; tx_setup_info.data_buff_list = NULL; if (emac_emb_smmu_ctx.valid) { if (stmmac_emb_smmu_ctx.valid) { if (rx_setup_info.ring_base_sgt) { if (rx_setup_info.ring_base_sgt) { sg_free_table(rx_setup_info.ring_base_sgt); sg_free_table(rx_setup_info.ring_base_sgt); kfree(rx_setup_info.ring_base_sgt); kfree(rx_setup_info.ring_base_sgt); Loading
drivers/net/ethernet/stmicro/stmmac/stmmac.h +4 −4 Original line number Original line Diff line number Diff line Loading @@ -155,7 +155,7 @@ struct stmmac_priv { #endif #endif }; }; struct emac_emb_smmu_cb_ctx { struct stmmac_emb_smmu_cb_ctx { bool valid; bool valid; struct platform_device *pdev_master; struct platform_device *pdev_master; struct platform_device *smmu_pdev; struct platform_device *smmu_pdev; Loading @@ -167,10 +167,10 @@ struct emac_emb_smmu_cb_ctx { int ret; int ret; }; }; extern struct emac_emb_smmu_cb_ctx emac_emb_smmu_ctx; extern struct stmmac_emb_smmu_cb_ctx stmmac_emb_smmu_ctx; #define GET_MEM_PDEV_DEV (emac_emb_smmu_ctx.valid ? \ #define GET_MEM_PDEV_DEV (stmmac_emb_smmu_ctx.valid ? \ &emac_emb_smmu_ctx.smmu_pdev->dev : priv->device) &stmmac_emb_smmu_ctx.smmu_pdev->dev : priv->device) int ethqos_handle_prv_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int ethqos_handle_prv_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int ethqos_init_pps(struct stmmac_priv *priv); int ethqos_init_pps(struct stmmac_priv *priv); Loading