Lines Matching full:etha

116 	/* For ETHA */  in rswitch_fwd_init()
455 desc->info1 = cpu_to_le64(INFO1_SPN(rdev->etha->index)); in rswitch_gwca_queue_ext_ts_fill()
1068 /* Ethernet TSN Agent block (ETHA) and Ethernet MAC IP block (RMAC) */
1069 static int rswitch_etha_change_mode(struct rswitch_etha *etha, in rswitch_etha_change_mode() argument
1074 if (!rswitch_agent_clock_is_enabled(etha->coma_addr, etha->index)) in rswitch_etha_change_mode()
1075 rswitch_agent_clock_ctrl(etha->coma_addr, etha->index, 1); in rswitch_etha_change_mode()
1077 iowrite32(mode, etha->addr + EAMC); in rswitch_etha_change_mode()
1079 ret = rswitch_reg_wait(etha->addr, EAMS, EAMS_OPS_MASK, mode); in rswitch_etha_change_mode()
1082 rswitch_agent_clock_ctrl(etha->coma_addr, etha->index, 0); in rswitch_etha_change_mode()
1087 static void rswitch_etha_read_mac_address(struct rswitch_etha *etha) in rswitch_etha_read_mac_address() argument
1089 u32 mrmac0 = ioread32(etha->addr + MRMAC0); in rswitch_etha_read_mac_address()
1090 u32 mrmac1 = ioread32(etha->addr + MRMAC1); in rswitch_etha_read_mac_address()
1091 u8 *mac = &etha->mac_addr[0]; in rswitch_etha_read_mac_address()
1101 static void rswitch_etha_write_mac_address(struct rswitch_etha *etha, const u8 *mac) in rswitch_etha_write_mac_address() argument
1103 iowrite32((mac[0] << 8) | mac[1], etha->addr + MRMAC0); in rswitch_etha_write_mac_address()
1105 etha->addr + MRMAC1); in rswitch_etha_write_mac_address()
1108 static int rswitch_etha_wait_link_verification(struct rswitch_etha *etha) in rswitch_etha_wait_link_verification() argument
1110 iowrite32(MLVC_PLV, etha->addr + MLVC); in rswitch_etha_wait_link_verification()
1112 return rswitch_reg_wait(etha->addr, MLVC, MLVC_PLV, 0); in rswitch_etha_wait_link_verification()
1115 static void rswitch_rmac_setting(struct rswitch_etha *etha, const u8 *mac) in rswitch_rmac_setting() argument
1119 rswitch_etha_write_mac_address(etha, mac); in rswitch_rmac_setting()
1121 switch (etha->speed) { in rswitch_rmac_setting()
1135 iowrite32(MPIC_PIS_GMII | val, etha->addr + MPIC); in rswitch_rmac_setting()
1138 static void rswitch_etha_enable_mii(struct rswitch_etha *etha) in rswitch_etha_enable_mii() argument
1140 rswitch_modify(etha->addr, MPIC, MPIC_PSMCS_MASK | MPIC_PSMHT_MASK, in rswitch_etha_enable_mii()
1141 MPIC_PSMCS(etha->psmcs) | MPIC_PSMHT(0x06)); in rswitch_etha_enable_mii()
1142 rswitch_modify(etha->addr, MPSM, 0, MPSM_MFF_C45); in rswitch_etha_enable_mii()
1145 static int rswitch_etha_hw_init(struct rswitch_etha *etha, const u8 *mac) in rswitch_etha_hw_init() argument
1149 err = rswitch_etha_change_mode(etha, EAMC_OPC_DISABLE); in rswitch_etha_hw_init()
1152 err = rswitch_etha_change_mode(etha, EAMC_OPC_CONFIG); in rswitch_etha_hw_init()
1156 iowrite32(EAVCC_VEM_SC_TAG, etha->addr + EAVCC); in rswitch_etha_hw_init()
1157 rswitch_rmac_setting(etha, mac); in rswitch_etha_hw_init()
1158 rswitch_etha_enable_mii(etha); in rswitch_etha_hw_init()
1160 err = rswitch_etha_wait_link_verification(etha); in rswitch_etha_hw_init()
1164 err = rswitch_etha_change_mode(etha, EAMC_OPC_DISABLE); in rswitch_etha_hw_init()
1168 return rswitch_etha_change_mode(etha, EAMC_OPC_OPERATION); in rswitch_etha_hw_init()
1171 static int rswitch_etha_set_access(struct rswitch_etha *etha, bool read, in rswitch_etha_set_access() argument
1181 writel(MMIS1_CLEAR_FLAGS, etha->addr + MMIS1); in rswitch_etha_set_access()
1184 iowrite32((regad << 16) | (devad << 8) | (phyad << 3) | val, etha->addr + MPSM); in rswitch_etha_set_access()
1186 ret = rswitch_reg_wait(etha->addr, MMIS1, MMIS1_PAACS, MMIS1_PAACS); in rswitch_etha_set_access()
1190 rswitch_modify(etha->addr, MMIS1, MMIS1_PAACS, MMIS1_PAACS); in rswitch_etha_set_access()
1193 writel((pop << 13) | (devad << 8) | (phyad << 3) | val, etha->addr + MPSM); in rswitch_etha_set_access()
1195 ret = rswitch_reg_wait(etha->addr, MMIS1, MMIS1_PRACS, MMIS1_PRACS); in rswitch_etha_set_access()
1199 ret = (ioread32(etha->addr + MPSM) & MPSM_PRD_MASK) >> 16; in rswitch_etha_set_access()
1201 rswitch_modify(etha->addr, MMIS1, MMIS1_PRACS, MMIS1_PRACS); in rswitch_etha_set_access()
1204 etha->addr + MPSM); in rswitch_etha_set_access()
1206 ret = rswitch_reg_wait(etha->addr, MMIS1, MMIS1_PWACS, MMIS1_PWACS); in rswitch_etha_set_access()
1215 struct rswitch_etha *etha = bus->priv; in rswitch_etha_mii_read_c45() local
1217 return rswitch_etha_set_access(etha, true, addr, devad, regad, 0); in rswitch_etha_mii_read_c45()
1223 struct rswitch_etha *etha = bus->priv; in rswitch_etha_mii_write_c45() local
1225 return rswitch_etha_set_access(etha, false, addr, devad, regad, val); in rswitch_etha_mii_write_c45()
1246 if (index == rdev->etha->index) { in rswitch_get_port_node()
1267 err = of_get_phy_mode(rdev->np_port, &rdev->etha->phy_interface); in rswitch_etha_get_params()
1273 rdev->etha->speed = max_speed; in rswitch_etha_get_params()
1278 switch (rdev->etha->phy_interface) { in rswitch_etha_get_params()
1280 rdev->etha->speed = SPEED_100; in rswitch_etha_get_params()
1283 rdev->etha->speed = SPEED_1000; in rswitch_etha_get_params()
1286 rdev->etha->speed = SPEED_2500; in rswitch_etha_get_params()
1306 sprintf(mii_bus->id, "etha%d", rdev->etha->index); in rswitch_mii_register()
1307 mii_bus->priv = rdev->etha; in rswitch_mii_register()
1319 rdev->etha->mii = mii_bus; in rswitch_mii_register()
1329 if (rdev->etha->mii) { in rswitch_mii_unregister()
1330 mdiobus_unregister(rdev->etha->mii); in rswitch_mii_unregister()
1331 mdiobus_free(rdev->etha->mii); in rswitch_mii_unregister()
1332 rdev->etha->mii = NULL; in rswitch_mii_unregister()
1341 if (phydev->link != rdev->etha->link) { in rswitch_adjust_link()
1348 rdev->etha->link = phydev->link; in rswitch_adjust_link()
1351 phydev->speed != rdev->etha->speed) { in rswitch_adjust_link()
1352 rdev->etha->speed = phydev->speed; in rswitch_adjust_link()
1354 rswitch_etha_hw_init(rdev->etha, rdev->ndev->dev_addr); in rswitch_adjust_link()
1355 phy_set_speed(rdev->serdes, rdev->etha->speed); in rswitch_adjust_link()
1366 switch (rdev->etha->speed) { in rswitch_phy_remove_link_mode()
1383 phy_set_max_speed(phydev, rdev->etha->speed); in rswitch_phy_remove_link_mode()
1405 __set_bit(rdev->etha->phy_interface, phydev->host_interfaces); in rswitch_phy_device_init()
1409 rdev->etha->phy_interface); in rswitch_phy_device_init()
1440 rdev->etha->phy_interface); in rswitch_serdes_set_params()
1444 return phy_set_speed(rdev->serdes, rdev->etha->speed); in rswitch_serdes_set_params()
1451 if (!rdev->etha->operated) { in rswitch_ether_port_init_one()
1452 err = rswitch_etha_hw_init(rdev->etha, rdev->ndev->dev_addr); in rswitch_ether_port_init_one()
1456 rdev->etha->operated = true; in rswitch_ether_port_init_one()
1594 desc->info1 = cpu_to_le64(INFO1_DV(BIT(rdev->etha->index)) | in rswitch_ext_desc_set_info1()
1841 struct rswitch_etha *etha = &priv->etha[index]; in rswitch_etha_init() local
1843 memset(etha, 0, sizeof(*etha)); in rswitch_etha_init()
1844 etha->index = index; in rswitch_etha_init()
1845 etha->addr = priv->addr + RSWITCH_ETHA_OFFSET + index * RSWITCH_ETHA_SIZE; in rswitch_etha_init()
1846 etha->coma_addr = priv->addr; in rswitch_etha_init()
1852 etha->psmcs = clk_get_rate(priv->clk) / 100000 / (25 * 2) - 1; in rswitch_etha_init()
1877 rdev->etha = &priv->etha[index]; in rswitch_device_alloc()
1894 if (is_valid_ether_addr(rdev->etha->mac_addr)) in rswitch_device_alloc()
1895 eth_hw_addr_set(ndev, rdev->etha->mac_addr); in rswitch_device_alloc()
1904 if (rdev->priv->gwca.speed < rdev->etha->speed) in rswitch_device_alloc()
1905 rdev->priv->gwca.speed = rdev->etha->speed; in rswitch_device_alloc()
1949 rswitch_etha_read_mac_address(&priv->etha[i]); in rswitch_init()