Lines Matching refs:prueth
234 struct prueth *prueth = emac->prueth; in prueth_ndev_add_tx_napi() local
246 dev_err(prueth->dev, "unable to request TX IRQ %d\n", in prueth_ndev_add_tx_napi()
267 struct device *dev = emac->prueth->dev; in prueth_init_tx_chns()
344 struct device *dev = emac->prueth->dev; in prueth_init_rx_chns()
413 rx_flow_cfg.rxfdq_cfg.mode = emac->prueth->pdata.fdqring_mode; in prueth_init_rx_chns()
500 u32 hi_sw = readl(emac->prueth->shram.va + in emac_rx_timestamp()
605 struct prueth *prueth = emac->prueth; in emac_get_tx_ts() local
609 addr = icssg_queue_pop(prueth, slice == 0 ? in emac_get_tx_ts()
614 memcpy_fromio(rsp, prueth->shram.va + addr, sizeof(*rsp)); in emac_get_tx_ts()
616 icssg_queue_push(prueth, slice == 0 ? in emac_get_tx_ts()
651 hi_sw = readl(emac->prueth->shram.va + in tx_ts_work()
908 static int prueth_emac_start(struct prueth *prueth, struct prueth_emac *emac) in prueth_emac_start() argument
911 struct device *dev = prueth->dev; in prueth_emac_start()
922 ret = icssg_config(prueth, emac, slice); in prueth_emac_start()
926 ret = rproc_set_firmware(prueth->pru[slice], firmwares[slice].pru); in prueth_emac_start()
927 ret = rproc_boot(prueth->pru[slice]); in prueth_emac_start()
933 ret = rproc_set_firmware(prueth->rtu[slice], firmwares[slice].rtu); in prueth_emac_start()
934 ret = rproc_boot(prueth->rtu[slice]); in prueth_emac_start()
940 ret = rproc_set_firmware(prueth->txpru[slice], firmwares[slice].txpru); in prueth_emac_start()
941 ret = rproc_boot(prueth->txpru[slice]); in prueth_emac_start()
951 rproc_shutdown(prueth->rtu[slice]); in prueth_emac_start()
954 rproc_shutdown(prueth->pru[slice]); in prueth_emac_start()
961 struct prueth *prueth = emac->prueth; in prueth_emac_stop() local
977 rproc_shutdown(prueth->txpru[slice]); in prueth_emac_stop()
978 rproc_shutdown(prueth->rtu[slice]); in prueth_emac_stop()
979 rproc_shutdown(prueth->pru[slice]); in prueth_emac_stop()
999 struct prueth *prueth = emac->prueth; in emac_adjust_link() local
1036 icssg_update_rgmii_cfg(prueth->miig_rt, emac); in emac_adjust_link()
1141 struct prueth *prueth = emac->prueth; in emac_phy_connect() local
1148 dev_err(prueth->dev, "couldn't connect to phy %s\n", in emac_phy_connect()
1170 struct prueth *prueth = emac->prueth; in prueth_iep_gettime() local
1178 fw_count_hi_addr = prueth->shram.va + TIMESYNC_FW_WC_COUNT_HI_SW_OFFSET_OFFSET; in prueth_iep_gettime()
1179 fw_hi_r_count_addr = prueth->shram.va + TIMESYNC_FW_WC_HI_ROLLOVER_COUNT_OFFSET; in prueth_iep_gettime()
1215 sc_descp = emac->prueth->shram.va + TIMESYNC_FW_WC_SETCLOCK_DESC_OFFSET; in prueth_iep_settime()
1239 dev_err(emac->prueth->dev, "settime timeout\n"); in prueth_iep_settime()
1286 writel(reduction_factor, emac->prueth->shram.va + in prueth_perout_enable()
1289 current_cycle = icssg_read_time(emac->prueth->shram.va + in prueth_perout_enable()
1295 hi_lo_writeq(start_offset, emac->prueth->shram.va + in prueth_perout_enable()
1319 struct prueth *prueth = emac->prueth; in emac_ndo_open() local
1321 struct device *dev = prueth->dev; in emac_ndo_open()
1326 if (!prueth->emacs_initialized) { in emac_ndo_open()
1327 memset_io(prueth->msmcram.va, 0, prueth->msmcram.size); in emac_ndo_open()
1328 memset_io(prueth->shram.va, 0, ICSSG_CONFIG_OFFSET_SLICE1 * PRUETH_NUM_MACS); in emac_ndo_open()
1334 icssg_class_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr); in emac_ndo_open()
1335 icssg_ft1_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr); in emac_ndo_open()
1337 icssg_class_default(prueth->miig_rt, slice, 0); in emac_ndo_open()
1375 ret = prueth_emac_start(prueth, emac); in emac_ndo_open()
1379 icssg_mii_update_mtu(prueth->mii_rt, slice, ndev->max_mtu); in emac_ndo_open()
1381 if (!prueth->emacs_initialized) { in emac_ndo_open()
1414 prueth->emacs_initialized++; in emac_ndo_open()
1454 struct prueth *prueth = emac->prueth; in emac_ndo_stop() local
1466 icssg_class_disable(prueth->miig_rt, prueth_emac_slice(emac)); in emac_ndo_stop()
1500 if (prueth->emacs_initialized == 1) in emac_ndo_stop()
1515 prueth->emacs_initialized--; in emac_ndo_stop()
1715 static int prueth_netdev_init(struct prueth *prueth, in prueth_netdev_init() argument
1738 emac->prueth = prueth; in prueth_netdev_init()
1750 ret = pruss_request_mem_region(prueth->pruss, in prueth_netdev_init()
1755 dev_err(prueth->dev, "unable to get DRAM: %d\n", ret); in prueth_netdev_init()
1765 emac->tx_ts_irq = platform_get_irq_byname_optional(prueth->pdev, irq_name); in prueth_netdev_init()
1767 ret = dev_err_probe(prueth->dev, emac->tx_ts_irq, "could not get tx_ts_irq\n"); in prueth_netdev_init()
1771 SET_NETDEV_DEV(ndev, prueth->dev); in prueth_netdev_init()
1777 dev_err(prueth->dev, "couldn't find phy-handle\n"); in prueth_netdev_init()
1783 ret = dev_err_probe(prueth->dev, ret, in prueth_netdev_init()
1793 dev_err(prueth->dev, "could not get phy-mode property\n"); in prueth_netdev_init()
1799 dev_err(prueth->dev, "PHY mode unsupported %s\n", phy_modes(emac->phy_if)); in prueth_netdev_init()
1818 dev_err(prueth->dev, "RGMII mode without TX delay is not supported"); in prueth_netdev_init()
1829 dev_warn(prueth->dev, "port %d: using random MAC addr: %pM\n", in prueth_netdev_init()
1842 prueth->emac[mac] = emac; in prueth_netdev_init()
1847 pruss_release_mem_region(prueth->pruss, &emac->dram); in prueth_netdev_init()
1852 prueth->emac[mac] = NULL; in prueth_netdev_init()
1858 static void prueth_netdev_exit(struct prueth *prueth, in prueth_netdev_exit() argument
1868 emac = prueth->emac[mac]; in prueth_netdev_exit()
1877 pruss_release_mem_region(prueth->pruss, &emac->dram); in prueth_netdev_exit()
1880 prueth->emac[mac] = NULL; in prueth_netdev_exit()
1883 static int prueth_get_cores(struct prueth *prueth, int slice) in prueth_get_cores() argument
1885 struct device *dev = prueth->dev; in prueth_get_cores()
1903 prueth->pru[slice] = pru_rproc_get(np, idx, &pruss_id); in prueth_get_cores()
1904 if (IS_ERR(prueth->pru[slice])) { in prueth_get_cores()
1905 ret = PTR_ERR(prueth->pru[slice]); in prueth_get_cores()
1906 prueth->pru[slice] = NULL; in prueth_get_cores()
1909 prueth->pru_id[slice] = pruss_id; in prueth_get_cores()
1912 prueth->rtu[slice] = pru_rproc_get(np, idx, NULL); in prueth_get_cores()
1913 if (IS_ERR(prueth->rtu[slice])) { in prueth_get_cores()
1914 ret = PTR_ERR(prueth->rtu[slice]); in prueth_get_cores()
1915 prueth->rtu[slice] = NULL; in prueth_get_cores()
1920 prueth->txpru[slice] = pru_rproc_get(np, idx, NULL); in prueth_get_cores()
1921 if (IS_ERR(prueth->txpru[slice])) { in prueth_get_cores()
1922 ret = PTR_ERR(prueth->txpru[slice]); in prueth_get_cores()
1923 prueth->txpru[slice] = NULL; in prueth_get_cores()
1930 static void prueth_put_cores(struct prueth *prueth, int slice) in prueth_put_cores() argument
1932 if (prueth->txpru[slice]) in prueth_put_cores()
1933 pru_rproc_put(prueth->txpru[slice]); in prueth_put_cores()
1935 if (prueth->rtu[slice]) in prueth_put_cores()
1936 pru_rproc_put(prueth->rtu[slice]); in prueth_put_cores()
1938 if (prueth->pru[slice]) in prueth_put_cores()
1939 pru_rproc_put(prueth->pru[slice]); in prueth_put_cores()
1955 struct prueth *prueth; in prueth_probe() local
1966 prueth = devm_kzalloc(dev, sizeof(*prueth), GFP_KERNEL); in prueth_probe()
1967 if (!prueth) in prueth_probe()
1970 dev_set_drvdata(dev, prueth); in prueth_probe()
1971 prueth->pdev = pdev; in prueth_probe()
1972 prueth->pdata = *(const struct prueth_pdata *)match->data; in prueth_probe()
1974 prueth->dev = dev; in prueth_probe()
2023 prueth->eth_node[PRUETH_MAC0] = eth0_node; in prueth_probe()
2024 prueth->eth_node[PRUETH_MAC1] = eth1_node; in prueth_probe()
2026 prueth->miig_rt = syscon_regmap_lookup_by_phandle(np, "ti,mii-g-rt"); in prueth_probe()
2027 if (IS_ERR(prueth->miig_rt)) { in prueth_probe()
2032 prueth->mii_rt = syscon_regmap_lookup_by_phandle(np, "ti,mii-rt"); in prueth_probe()
2033 if (IS_ERR(prueth->mii_rt)) { in prueth_probe()
2039 ret = prueth_get_cores(prueth, ICSS_SLICE0); in prueth_probe()
2045 ret = prueth_get_cores(prueth, ICSS_SLICE1); in prueth_probe()
2051 prueth->pru[ICSS_SLICE0] : prueth->pru[ICSS_SLICE1]); in prueth_probe()
2058 prueth->pruss = pruss; in prueth_probe()
2061 &prueth->shram); in prueth_probe()
2067 prueth->sram_pool = of_gen_pool_get(np, "sram", 0); in prueth_probe()
2068 if (!prueth->sram_pool) { in prueth_probe()
2078 prueth->msmcram.va = in prueth_probe()
2079 (void __iomem *)gen_pool_alloc_algo(prueth->sram_pool, in prueth_probe()
2084 if (!prueth->msmcram.va) { in prueth_probe()
2089 prueth->msmcram.pa = gen_pool_virt_to_phys(prueth->sram_pool, in prueth_probe()
2090 (unsigned long)prueth->msmcram.va); in prueth_probe()
2091 prueth->msmcram.size = msmc_ram_size; in prueth_probe()
2092 memset_io(prueth->msmcram.va, 0, msmc_ram_size); in prueth_probe()
2093 dev_dbg(dev, "sram: pa %llx va %p size %zx\n", prueth->msmcram.pa, in prueth_probe()
2094 prueth->msmcram.va, prueth->msmcram.size); in prueth_probe()
2096 prueth->iep0 = icss_iep_get_idx(np, 0); in prueth_probe()
2097 if (IS_ERR(prueth->iep0)) { in prueth_probe()
2098 ret = dev_err_probe(dev, PTR_ERR(prueth->iep0), "iep0 get failed\n"); in prueth_probe()
2099 prueth->iep0 = NULL; in prueth_probe()
2103 prueth->iep1 = icss_iep_get_idx(np, 1); in prueth_probe()
2104 if (IS_ERR(prueth->iep1)) { in prueth_probe()
2105 ret = dev_err_probe(dev, PTR_ERR(prueth->iep1), "iep1 get failed\n"); in prueth_probe()
2109 if (prueth->pdata.quirk_10m_link_issue) { in prueth_probe()
2113 icss_iep_init_fw(prueth->iep1); in prueth_probe()
2118 ret = prueth_netdev_init(prueth, eth0_node); in prueth_probe()
2124 prueth->emac[PRUETH_MAC0]->iep = prueth->iep0; in prueth_probe()
2128 ret = prueth_netdev_init(prueth, eth1_node); in prueth_probe()
2135 prueth->emac[PRUETH_MAC1]->iep = prueth->iep0; in prueth_probe()
2140 ret = register_netdev(prueth->emac[PRUETH_MAC0]->ndev); in prueth_probe()
2146 prueth->registered_netdevs[PRUETH_MAC0] = prueth->emac[PRUETH_MAC0]->ndev; in prueth_probe()
2148 ret = emac_phy_connect(prueth->emac[PRUETH_MAC0]); in prueth_probe()
2154 phy_attached_info(prueth->emac[PRUETH_MAC0]->ndev->phydev); in prueth_probe()
2158 ret = register_netdev(prueth->emac[PRUETH_MAC1]->ndev); in prueth_probe()
2164 prueth->registered_netdevs[PRUETH_MAC1] = prueth->emac[PRUETH_MAC1]->ndev; in prueth_probe()
2165 ret = emac_phy_connect(prueth->emac[PRUETH_MAC1]); in prueth_probe()
2171 phy_attached_info(prueth->emac[PRUETH_MAC1]->ndev->phydev); in prueth_probe()
2185 if (!prueth->registered_netdevs[i]) in prueth_probe()
2187 if (prueth->emac[i]->ndev->phydev) { in prueth_probe()
2188 phy_disconnect(prueth->emac[i]->ndev->phydev); in prueth_probe()
2189 prueth->emac[i]->ndev->phydev = NULL; in prueth_probe()
2191 unregister_netdev(prueth->registered_netdevs[i]); in prueth_probe()
2196 eth_node = prueth->eth_node[i]; in prueth_probe()
2200 prueth_netdev_exit(prueth, eth_node); in prueth_probe()
2204 if (prueth->pdata.quirk_10m_link_issue) in prueth_probe()
2205 icss_iep_exit_fw(prueth->iep1); in prueth_probe()
2206 icss_iep_put(prueth->iep1); in prueth_probe()
2209 icss_iep_put(prueth->iep0); in prueth_probe()
2210 prueth->iep0 = NULL; in prueth_probe()
2211 prueth->iep1 = NULL; in prueth_probe()
2214 gen_pool_free(prueth->sram_pool, in prueth_probe()
2215 (unsigned long)prueth->msmcram.va, msmc_ram_size); in prueth_probe()
2218 pruss_release_mem_region(prueth->pruss, &prueth->shram); in prueth_probe()
2221 pruss_put(prueth->pruss); in prueth_probe()
2225 prueth_put_cores(prueth, ICSS_SLICE1); in prueth_probe()
2230 prueth_put_cores(prueth, ICSS_SLICE0); in prueth_probe()
2239 struct prueth *prueth = platform_get_drvdata(pdev); in prueth_remove() local
2244 if (!prueth->registered_netdevs[i]) in prueth_remove()
2246 phy_stop(prueth->emac[i]->ndev->phydev); in prueth_remove()
2247 phy_disconnect(prueth->emac[i]->ndev->phydev); in prueth_remove()
2248 prueth->emac[i]->ndev->phydev = NULL; in prueth_remove()
2249 unregister_netdev(prueth->registered_netdevs[i]); in prueth_remove()
2253 eth_node = prueth->eth_node[i]; in prueth_remove()
2257 prueth_netdev_exit(prueth, eth_node); in prueth_remove()
2260 if (prueth->pdata.quirk_10m_link_issue) in prueth_remove()
2261 icss_iep_exit_fw(prueth->iep1); in prueth_remove()
2263 icss_iep_put(prueth->iep1); in prueth_remove()
2264 icss_iep_put(prueth->iep0); in prueth_remove()
2266 gen_pool_free(prueth->sram_pool, in prueth_remove()
2267 (unsigned long)prueth->msmcram.va, in prueth_remove()
2270 pruss_release_mem_region(prueth->pruss, &prueth->shram); in prueth_remove()
2272 pruss_put(prueth->pruss); in prueth_remove()
2274 if (prueth->eth_node[PRUETH_MAC1]) in prueth_remove()
2275 prueth_put_cores(prueth, ICSS_SLICE1); in prueth_remove()
2277 if (prueth->eth_node[PRUETH_MAC0]) in prueth_remove()
2278 prueth_put_cores(prueth, ICSS_SLICE0); in prueth_remove()
2284 struct prueth *prueth = dev_get_drvdata(dev); in prueth_suspend() local
2289 ndev = prueth->registered_netdevs[i]; in prueth_suspend()
2309 struct prueth *prueth = dev_get_drvdata(dev); in prueth_resume() local
2314 ndev = prueth->registered_netdevs[i]; in prueth_resume()