Lines Matching refs:iphy
94 struct isci_phy *iphy = iport->phy_table[index]; in sci_port_get_protocols() local
96 if (!iphy) in sci_port_get_protocols()
98 sci_phy_get_protocols(iphy, proto); in sci_port_get_protocols()
145 struct isci_phy *iphy; in sci_port_bcn_enable() local
150 iphy = iport->phy_table[i]; in sci_port_bcn_enable()
151 if (!iphy) in sci_port_bcn_enable()
153 val = readl(&iphy->link_layer_registers->link_layer_control); in sci_port_bcn_enable()
155 writel(val, &iphy->link_layer_registers->link_layer_control); in sci_port_bcn_enable()
161 struct isci_phy *iphy) in isci_port_bc_change_received() argument
165 __func__, iphy, &iphy->sas_phy); in isci_port_bc_change_received()
167 ihost->sas_ha.notify_port_event(&iphy->sas_phy, PORTE_BROADCAST_RCVD); in isci_port_bc_change_received()
173 struct isci_phy *iphy) in isci_port_link_up() argument
183 spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); in isci_port_link_up()
187 if (iphy->protocol == SAS_PROTOCOL_SATA) { in isci_port_link_up()
190 iphy->sas_phy.oob_mode = SATA_OOB_MODE; in isci_port_link_up()
191 iphy->sas_phy.frame_rcvd_size = sizeof(struct dev_to_host_fis); in isci_port_link_up()
205 memcpy(&iphy->sas_phy.attached_sas_addr, in isci_port_link_up()
207 } else if (iphy->protocol == SAS_PROTOCOL_SSP) { in isci_port_link_up()
208 iphy->sas_phy.oob_mode = SAS_OOB_MODE; in isci_port_link_up()
209 iphy->sas_phy.frame_rcvd_size = sizeof(struct sas_identify_frame); in isci_port_link_up()
212 memcpy(iphy->sas_phy.attached_sas_addr, in isci_port_link_up()
213 iphy->frame_rcvd.iaf.sas_addr, SAS_ADDR_SIZE); in isci_port_link_up()
219 iphy->sas_phy.phy->negotiated_linkrate = sci_phy_linkrate(iphy); in isci_port_link_up()
221 spin_unlock_irqrestore(&iphy->sas_phy.frame_rcvd_lock, flags); in isci_port_link_up()
226 isci_host->sas_ha.notify_port_event(&iphy->sas_phy, in isci_port_link_up()
332 struct isci_phy *iphy = &ihost->phys[phy_idx]; in isci_port_hard_reset_complete() local
338 isci_port_link_down(ihost, iphy, isci_port); in isci_port_hard_reset_complete()
447 struct isci_phy *iphy; in sci_port_get_a_connected_phy() local
453 iphy = iport->phy_table[index]; in sci_port_get_a_connected_phy()
454 if (iphy && sci_port_active_phy(iport, iphy)) in sci_port_get_a_connected_phy()
455 return iphy; in sci_port_get_a_connected_phy()
461 static enum sci_status sci_port_set_phy(struct isci_port *iport, struct isci_phy *iphy) in sci_port_set_phy() argument
467 if (!iport->phy_table[iphy->phy_index] && in sci_port_set_phy()
468 !phy_get_non_dummy_port(iphy) && in sci_port_set_phy()
469 sci_port_is_valid_phy_assignment(iport, iphy->phy_index)) { in sci_port_set_phy()
474 iport->phy_table[iphy->phy_index] = iphy; in sci_port_set_phy()
475 sci_phy_set_port(iphy, iport); in sci_port_set_phy()
483 static enum sci_status sci_port_clear_phy(struct isci_port *iport, struct isci_phy *iphy) in sci_port_clear_phy() argument
486 if (iport->phy_table[iphy->phy_index] == iphy && in sci_port_clear_phy()
487 phy_get_non_dummy_port(iphy) == iport) { in sci_port_clear_phy()
491 sci_phy_set_port(iphy, &ihost->ports[SCI_MAX_PORTS]); in sci_port_clear_phy()
492 iport->phy_table[iphy->phy_index] = NULL; in sci_port_clear_phy()
512 struct isci_phy *iphy; in sci_port_get_attached_sas_address() local
518 iphy = sci_port_get_a_connected_phy(iport); in sci_port_get_attached_sas_address()
519 if (iphy) { in sci_port_get_attached_sas_address()
520 if (iphy->protocol != SAS_PROTOCOL_SATA) { in sci_port_get_attached_sas_address()
521 sci_phy_get_attached_sas_address(iphy, sas); in sci_port_get_attached_sas_address()
523 sci_phy_get_sas_address(iphy, sas); in sci_port_get_attached_sas_address()
524 sas->low += iphy->phy_index; in sci_port_get_attached_sas_address()
615 static void sci_port_resume_phy(struct isci_port *iport, struct isci_phy *iphy) in sci_port_resume_phy() argument
617 sci_phy_resume(iphy); in sci_port_resume_phy()
618 iport->enabled_phy_mask |= 1 << iphy->phy_index; in sci_port_resume_phy()
622 struct isci_phy *iphy, in sci_port_activate_phy() argument
627 if (iphy->protocol != SAS_PROTOCOL_SATA && (flags & PF_RESUME)) in sci_port_activate_phy()
628 sci_phy_resume(iphy); in sci_port_activate_phy()
630 iport->active_phy_mask |= 1 << iphy->phy_index; in sci_port_activate_phy()
632 sci_controller_clear_invalid_phy(ihost, iphy); in sci_port_activate_phy()
635 isci_port_link_up(ihost, iport, iphy); in sci_port_activate_phy()
638 void sci_port_deactivate_phy(struct isci_port *iport, struct isci_phy *iphy, in sci_port_deactivate_phy() argument
643 iport->active_phy_mask &= ~(1 << iphy->phy_index); in sci_port_deactivate_phy()
644 iport->enabled_phy_mask &= ~(1 << iphy->phy_index); in sci_port_deactivate_phy()
646 iport->last_active_phy = iphy->phy_index; in sci_port_deactivate_phy()
648 iphy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN; in sci_port_deactivate_phy()
655 writel(iphy->phy_index, in sci_port_deactivate_phy()
656 &iport->port_pe_configuration_register[iphy->phy_index]); in sci_port_deactivate_phy()
659 isci_port_link_down(ihost, iphy, iport); in sci_port_deactivate_phy()
662 static void sci_port_invalid_link_up(struct isci_port *iport, struct isci_phy *iphy) in sci_port_invalid_link_up() argument
671 if ((ihost->invalid_phy_mask & (1 << iphy->phy_index)) == 0) { in sci_port_invalid_link_up()
672 ihost->invalid_phy_mask |= 1 << iphy->phy_index; in sci_port_invalid_link_up()
689 struct isci_phy *iphy, in sci_port_general_link_up_handler() argument
696 sci_phy_get_attached_sas_address(iphy, &phy_sas_address); in sci_port_general_link_up_handler()
708 sci_port_activate_phy(iport, iphy, flags); in sci_port_general_link_up_handler()
712 sci_port_invalid_link_up(iport, iphy); in sci_port_general_link_up_handler()
754 bool sci_port_link_detected(struct isci_port *iport, struct isci_phy *iphy) in sci_port_link_detected() argument
757 (iphy->protocol == SAS_PROTOCOL_SATA)) { in sci_port_link_detected()
759 sci_port_invalid_link_up(iport, iphy); in sci_port_link_detected()
763 struct isci_port *dst_port = &(ihost->ports[iphy->phy_index]); in sci_port_link_detected()
764 writel(iphy->phy_index, in sci_port_link_detected()
765 &dst_port->port_pe_configuration_register[iphy->phy_index]); in sci_port_link_detected()
849 struct isci_phy *iphy; in sci_port_get_max_allowed_speed() local
856 iphy = iport->phy_table[index]; in sci_port_get_max_allowed_speed()
857 if (iphy && sci_port_active_phy(iport, iphy) && in sci_port_get_max_allowed_speed()
858 iphy->max_negotiated_speed < max_allowed_speed) in sci_port_get_max_allowed_speed()
859 max_allowed_speed = iphy->max_negotiated_speed; in sci_port_get_max_allowed_speed()
1149 struct isci_phy *iphy = NULL; in sci_port_hard_reset() local
1161 for (phy_index = 0; phy_index < SCI_MAX_PHYS && !iphy; phy_index++) { in sci_port_hard_reset()
1162 iphy = iport->phy_table[phy_index]; in sci_port_hard_reset()
1163 if (iphy && !sci_port_active_phy(iport, iphy)) { in sci_port_hard_reset()
1168 iphy = NULL; in sci_port_hard_reset()
1173 if (!iphy) in sci_port_hard_reset()
1175 status = sci_phy_reset(iphy); in sci_port_hard_reset()
1197 struct isci_phy *iphy) in sci_port_add_phy() argument
1218 sci_phy_get_sas_address(iphy, &phy_sas_address); in sci_port_add_phy()
1224 return sci_port_set_phy(iport, iphy); in sci_port_add_phy()
1228 status = sci_port_set_phy(iport, iphy); in sci_port_add_phy()
1233 sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY|PF_RESUME); in sci_port_add_phy()
1239 status = sci_port_set_phy(iport, iphy); in sci_port_add_phy()
1243 sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY); in sci_port_add_phy()
1268 struct isci_phy *iphy) in sci_port_remove_phy() argument
1277 return sci_port_clear_phy(iport, iphy); in sci_port_remove_phy()
1279 status = sci_port_clear_phy(iport, iphy); in sci_port_remove_phy()
1283 sci_port_deactivate_phy(iport, iphy, true); in sci_port_remove_phy()
1289 status = sci_port_clear_phy(iport, iphy); in sci_port_remove_phy()
1293 sci_port_deactivate_phy(iport, iphy, true); in sci_port_remove_phy()
1309 struct isci_phy *iphy) in sci_port_link_up() argument
1319 sci_port_activate_phy(iport, iphy, PF_NOTIFY|PF_RESUME); in sci_port_link_up()
1325 sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY|PF_RESUME); in sci_port_link_up()
1342 sci_port_general_link_up_handler(iport, iphy, PF_RESUME); in sci_port_link_up()
1352 struct isci_phy *iphy) in sci_port_link_down() argument
1359 sci_port_deactivate_phy(iport, iphy, true); in sci_port_link_down()
1372 sci_port_deactivate_phy(iport, iphy, false); in sci_port_link_down()
1635 void sci_port_broadcast_change_received(struct isci_port *iport, struct isci_phy *iphy) in sci_port_broadcast_change_received() argument
1640 isci_port_bc_change_received(ihost, iport, iphy); in sci_port_broadcast_change_received()
1649 struct isci_phy *iphy) in isci_port_perform_hard_reset() argument
1747 struct isci_phy *iphy = to_iphy(phy); in isci_port_formed() local
1761 if (iport->active_phy_mask & 1 << iphy->phy_index) in isci_port_formed()