Lines Matching +full:default +full:- +full:state
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
64 static const char *phy_state_name(enum sci_phy_states state) in phy_state_name() argument
68 return strings[state]; in phy_state_name()
72 /* Maximum arbitration wait time in micro-seconds */
77 return iphy->max_negotiated_speed; in sci_phy_linkrate()
82 struct isci_phy *table = iphy - iphy->phy_index; in phy_to_host()
90 return &phy_to_host(iphy)->pdev->dev; in sciphy_to_dev()
99 iphy->transport_layer_registers = reg; in sci_phy_transport_layer_initialization()
102 &iphy->transport_layer_registers->stp_rni); in sci_phy_transport_layer_initialization()
108 tl_control = readl(&iphy->transport_layer_registers->control); in sci_phy_transport_layer_initialization()
110 writel(tl_control, &iphy->transport_layer_registers->control); in sci_phy_transport_layer_initialization()
119 struct isci_host *ihost = iphy->owning_port->owning_controller; in sci_phy_link_layer_initialization()
122 int phy_idx = iphy->phy_index; in sci_phy_link_layer_initialization()
131 phy_user = &ihost->user_parameters.phys[phy_idx]; in sci_phy_link_layer_initialization()
132 phy_oem = &ihost->oem_parameters.phys[phy_idx]; in sci_phy_link_layer_initialization()
133 iphy->link_layer_registers = llr; in sci_phy_link_layer_initialization()
143 &llr->transmit_identification); in sci_phy_link_layer_initialization()
146 writel(0xFEDCBA98, &llr->sas_device_name_high); in sci_phy_link_layer_initialization()
147 writel(phy_idx, &llr->sas_device_name_low); in sci_phy_link_layer_initialization()
150 writel(phy_oem->sas_address.high, &llr->source_sas_address_high); in sci_phy_link_layer_initialization()
151 writel(phy_oem->sas_address.low, &llr->source_sas_address_low); in sci_phy_link_layer_initialization()
154 writel(0, &llr->identify_frame_phy_id); in sci_phy_link_layer_initialization()
155 writel(SCU_SAS_TIPID_GEN_VALUE(ID, phy_idx), &llr->identify_frame_phy_id); in sci_phy_link_layer_initialization()
157 /* Change the initial state of the phy configuration register */ in sci_phy_link_layer_initialization()
158 phy_configuration = readl(&llr->phy_configuration); in sci_phy_link_layer_initialization()
160 /* Hold OOB state machine in reset */ in sci_phy_link_layer_initialization()
162 writel(phy_configuration, &llr->phy_configuration); in sci_phy_link_layer_initialization()
170 if (ihost->oem_parameters.controller.do_enable_ssc) { in sci_phy_link_layer_initialization()
171 struct scu_afe_registers __iomem *afe = &ihost->scu_registers->afe; in sci_phy_link_layer_initialization()
172 struct scu_afe_transceiver __iomem *xcvr = &afe->scu_afe_xcvr[phy_idx]; in sci_phy_link_layer_initialization()
173 struct isci_pci_info *pci_info = to_pci_info(ihost->pdev); in sci_phy_link_layer_initialization()
184 if (pci_info->orom->hdr.version < ISCI_ROM_VER_1_1) in sci_phy_link_layer_initialization()
187 sata_spread = ihost->oem_parameters.controller.ssc_sata_tx_spread_level; in sci_phy_link_layer_initialization()
188 sas_spread = ihost->oem_parameters.controller.ssc_sas_tx_spread_level; in sci_phy_link_layer_initialization()
195 sas_type = ihost->oem_parameters.controller.ssc_sas_tx_type; in sci_phy_link_layer_initialization()
203 reg = readl(&xcvr->afe_xcvr_control0); in sci_phy_link_layer_initialization()
205 writel(reg, &xcvr->afe_xcvr_control0); in sci_phy_link_layer_initialization()
207 reg = readl(&xcvr->afe_tx_ssc_control); in sci_phy_link_layer_initialization()
209 writel(reg, &xcvr->afe_tx_ssc_control); in sci_phy_link_layer_initialization()
215 reg = readl(&xcvr->afe_tx_ssc_control); in sci_phy_link_layer_initialization()
217 writel(reg, &xcvr->afe_tx_ssc_control); in sci_phy_link_layer_initialization()
219 reg = readl(&llr->stp_control); in sci_phy_link_layer_initialization()
221 writel(reg, &llr->stp_control); in sci_phy_link_layer_initialization()
241 writel(phy_cap.all, &llr->phy_capabilities); in sci_phy_link_layer_initialization()
247 phy_user->notify_enable_spin_up_insertion_frequency), in sci_phy_link_layer_initialization()
248 &llr->notify_enable_spinup_control); in sci_phy_link_layer_initialization()
251 * inpendent of connected state in sci_phy_link_layer_initialization()
254 phy_user->in_connection_align_insertion_frequency); in sci_phy_link_layer_initialization()
257 phy_user->align_insertion_frequency); in sci_phy_link_layer_initialization()
259 writel(clksm_value, &llr->clock_skew_management); in sci_phy_link_layer_initialization()
261 if (is_c0(ihost->pdev) || is_c1(ihost->pdev)) { in sci_phy_link_layer_initialization()
262 writel(0x04210400, &llr->afe_lookup_table_control); in sci_phy_link_layer_initialization()
263 writel(0x020A7C05, &llr->sas_primitive_timeout); in sci_phy_link_layer_initialization()
265 writel(0x02108421, &llr->afe_lookup_table_control); in sci_phy_link_layer_initialization()
268 (u8)ihost->user_parameters.no_outbound_task_timeout); in sci_phy_link_layer_initialization()
270 switch (phy_user->max_speed_generation) { in sci_phy_link_layer_initialization()
277 default: in sci_phy_link_layer_initialization()
282 writel(llctl, &llr->link_layer_control); in sci_phy_link_layer_initialization()
284 sp_timeouts = readl(&llr->sas_phy_timeouts); in sci_phy_link_layer_initialization()
286 /* Clear the default 0x36 (54us) RATE_CHANGE timeout value. */ in sci_phy_link_layer_initialization()
294 writel(sp_timeouts, &llr->sas_phy_timeouts); in sci_phy_link_layer_initialization()
296 if (is_a2(ihost->pdev)) { in sci_phy_link_layer_initialization()
298 * inter-operate with the PMC expander which shuts down in sci_phy_link_layer_initialization()
304 &llr->maximum_arbitration_wait_timer_timeout); in sci_phy_link_layer_initialization()
310 writel(0, &llr->link_layer_hang_detection_timeout); in sci_phy_link_layer_initialization()
312 /* We can exit the initial state to the stopped state */ in sci_phy_link_layer_initialization()
313 sci_change_state(&iphy->sm, SCI_PHY_STOPPED); in sci_phy_link_layer_initialization()
322 struct isci_host *ihost = iphy->owning_port->owning_controller; in phy_sata_timeout()
325 spin_lock_irqsave(&ihost->scic_lock, flags); in phy_sata_timeout()
327 if (tmr->cancel) in phy_sata_timeout()
336 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in phy_sata_timeout()
338 spin_unlock_irqrestore(&ihost->scic_lock, flags); in phy_sata_timeout()
355 struct isci_port *iport = iphy->owning_port; in phy_get_non_dummy_port()
357 if (iport->physical_port_index == SCIC_SDS_DUMMY_PORT) in phy_get_non_dummy_port()
360 return iphy->owning_port; in phy_get_non_dummy_port()
374 iphy->owning_port = iport; in sci_phy_set_port()
376 if (iphy->bcn_received_while_port_unassigned) { in sci_phy_set_port()
377 iphy->bcn_received_while_port_unassigned = false; in sci_phy_set_port()
378 sci_port_broadcast_change_received(iphy->owning_port, iphy); in sci_phy_set_port()
392 /* There is nothing that needs to be done in this state just in sci_phy_initialize()
393 * transition to the stopped state in sci_phy_initialize()
395 sci_change_state(&iphy->sm, SCI_PHY_STOPPED); in sci_phy_initialize()
413 writel(device_id, &iphy->transport_layer_registers->stp_rni); in sci_phy_setup_transport()
419 tl_control = readl(&iphy->transport_layer_registers->control); in sci_phy_setup_transport()
421 writel(tl_control, &iphy->transport_layer_registers->control); in sci_phy_setup_transport()
429 readl(&iphy->link_layer_registers->phy_configuration); in sci_phy_suspend()
432 &iphy->link_layer_registers->phy_configuration); in sci_phy_suspend()
442 readl(&iphy->link_layer_registers->phy_configuration); in sci_phy_resume()
445 &iphy->link_layer_registers->phy_configuration); in sci_phy_resume()
450 sas->high = readl(&iphy->link_layer_registers->source_sas_address_high); in sci_phy_get_sas_address()
451 sas->low = readl(&iphy->link_layer_registers->source_sas_address_low); in sci_phy_get_sas_address()
458 iaf = &iphy->frame_rcvd.iaf; in sci_phy_get_attached_sas_address()
459 memcpy(sas, iaf->sas_addr, SAS_ADDR_SIZE); in sci_phy_get_attached_sas_address()
464 proto->all = readl(&iphy->link_layer_registers->transmit_identification); in sci_phy_get_protocols()
469 enum sci_phy_states state = iphy->sm.current_state_id; in sci_phy_start() local
471 if (state != SCI_PHY_STOPPED) { in sci_phy_start()
472 dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n", in sci_phy_start()
473 __func__, phy_state_name(state)); in sci_phy_start()
477 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_start()
483 enum sci_phy_states state = iphy->sm.current_state_id; in sci_phy_stop() local
485 switch (state) { in sci_phy_stop()
497 default: in sci_phy_stop()
498 dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n", in sci_phy_stop()
499 __func__, phy_state_name(state)); in sci_phy_stop()
503 sci_change_state(&iphy->sm, SCI_PHY_STOPPED); in sci_phy_stop()
509 enum sci_phy_states state = iphy->sm.current_state_id; in sci_phy_reset() local
511 if (state != SCI_PHY_READY) { in sci_phy_reset()
512 dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n", in sci_phy_reset()
513 __func__, phy_state_name(state)); in sci_phy_reset()
517 sci_change_state(&iphy->sm, SCI_PHY_RESETTING); in sci_phy_reset()
523 enum sci_phy_states state = iphy->sm.current_state_id; in sci_phy_consume_power_handler() local
525 switch (state) { in sci_phy_consume_power_handler()
529 enable_spinup = readl(&iphy->link_layer_registers->notify_enable_spinup_control); in sci_phy_consume_power_handler()
531 writel(enable_spinup, &iphy->link_layer_registers->notify_enable_spinup_control); in sci_phy_consume_power_handler()
533 /* Change state to the final state this substate machine has run to completion */ in sci_phy_consume_power_handler()
534 sci_change_state(&iphy->sm, SCI_PHY_SUB_FINAL); in sci_phy_consume_power_handler()
541 /* Release the spinup hold state and reset the OOB state machine */ in sci_phy_consume_power_handler()
543 readl(&iphy->link_layer_registers->phy_configuration); in sci_phy_consume_power_handler()
548 &iphy->link_layer_registers->phy_configuration); in sci_phy_consume_power_handler()
554 &iphy->link_layer_registers->phy_configuration); in sci_phy_consume_power_handler()
556 /* Change state to the final state this substate machine has run to completion */ in sci_phy_consume_power_handler()
557 sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_SATA_PHY_EN); in sci_phy_consume_power_handler()
561 default: in sci_phy_consume_power_handler()
562 dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n", in sci_phy_consume_power_handler()
563 __func__, phy_state_name(state)); in sci_phy_consume_power_handler()
572 * PHY DETECTED event when the state machine was expecting a SATA PHY event. in sci_phy_start_sas_link_training()
576 phy_control = readl(&iphy->link_layer_registers->phy_configuration); in sci_phy_start_sas_link_training()
579 &iphy->link_layer_registers->phy_configuration); in sci_phy_start_sas_link_training()
581 sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_SAS_SPEED_EN); in sci_phy_start_sas_link_training()
583 iphy->protocol = SAS_PROTOCOL_SSP; in sci_phy_start_sas_link_training()
590 * SPINUP HOLD event when the state machine was expecting a SAS PHY event. none in sci_phy_start_sata_link_training()
592 sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_SATA_POWER); in sci_phy_start_sata_link_training()
594 iphy->protocol = SAS_PROTOCOL_SATA; in sci_phy_start_sata_link_training()
598 * sci_phy_complete_link_training - perform processing common to
604 * @next_state: This parameter specifies the next state for the phy's starting
605 * sub-state machine.
612 iphy->max_negotiated_speed = max_link_rate; in sci_phy_complete_link_training()
614 sci_change_state(&iphy->sm, next_state); in sci_phy_complete_link_training()
656 default: in phy_event_name()
661 #define phy_event_dbg(iphy, state, code) \ argument
662 dev_dbg(sciphy_to_dev(iphy), "phy-%d:%d: %s event: %s (%x)\n", \
663 phy_to_host(iphy)->id, iphy->phy_index, \
664 phy_state_name(state), phy_event_name(code), code)
666 #define phy_event_warn(iphy, state, code) \ argument
667 dev_warn(sciphy_to_dev(iphy), "phy-%d:%d: %s event: %s (%x)\n", \
668 phy_to_host(iphy)->id, iphy->phy_index, \
669 phy_state_name(state), phy_event_name(code), code)
677 val = readl(&iphy->link_layer_registers->transmit_comsas_signal); in scu_link_layer_set_txcomsas_timeout()
681 writel(val, &iphy->link_layer_registers->transmit_comsas_signal); in scu_link_layer_set_txcomsas_timeout()
686 enum sci_phy_states state = iphy->sm.current_state_id; in sci_phy_event_handler() local
688 switch (state) { in sci_phy_event_handler()
693 iphy->is_in_link_training = true; in sci_phy_event_handler()
697 iphy->is_in_link_training = true; in sci_phy_event_handler()
703 /* Start the oob/sn state machine over again */ in sci_phy_event_handler()
704 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
706 default: in sci_phy_event_handler()
707 phy_event_dbg(iphy, state, event_code); in sci_phy_event_handler()
716 * We would re-enter this state so just stay here */ in sci_phy_event_handler()
740 /* Change the timeout value to default */ in sci_phy_event_handler()
743 /* Link failure change state back to the starting state */ in sci_phy_event_handler()
744 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
750 /* Start the oob/sn state machine over again */ in sci_phy_event_handler()
751 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
753 default: in sci_phy_event_handler()
754 phy_event_warn(iphy, state, event_code); in sci_phy_event_handler()
762 /* Backup the state machine */ in sci_phy_event_handler()
776 /* Start the oob/sn state machine over again */ in sci_phy_event_handler()
777 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
783 /* Start the oob/sn state machine over again */ in sci_phy_event_handler()
784 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
786 default: in sci_phy_event_handler()
787 phy_event_warn(iphy, state, event_code); in sci_phy_event_handler()
794 /* Change the timeout value to default */ in sci_phy_event_handler()
797 /* Link failure change state back to the starting state */ in sci_phy_event_handler()
798 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
800 default: in sci_phy_event_handler()
801 phy_event_warn(iphy, state, event_code); in sci_phy_event_handler()
808 /* Change the timeout value to default */ in sci_phy_event_handler()
811 /* Link failure change state back to the starting state */ in sci_phy_event_handler()
812 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
816 * expected while in this state in sci_phy_event_handler()
827 default: in sci_phy_event_handler()
828 phy_event_warn(iphy, state, event_code); in sci_phy_event_handler()
835 /* Change the timeout value to default */ in sci_phy_event_handler()
838 /* Link failure change state back to the starting state */ in sci_phy_event_handler()
839 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
847 iphy->protocol = SAS_PROTOCOL_SATA; in sci_phy_event_handler()
849 /* We have received the SATA PHY notification change state */ in sci_phy_event_handler()
850 sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_SATA_SPEED_EN); in sci_phy_event_handler()
858 default: in sci_phy_event_handler()
859 phy_event_warn(iphy, state, event_code); in sci_phy_event_handler()
886 /* Change the timeout value to default */ in sci_phy_event_handler()
889 /* Link failure change state back to the starting state */ in sci_phy_event_handler()
890 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
898 default: in sci_phy_event_handler()
899 phy_event_warn(iphy, state, event_code); in sci_phy_event_handler()
907 /* Backup the state machine */ in sci_phy_event_handler()
908 sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_SATA_SPEED_EN); in sci_phy_event_handler()
912 /* Change the timeout value to default */ in sci_phy_event_handler()
915 /* Link failure change state back to the starting state */ in sci_phy_event_handler()
916 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
919 default: in sci_phy_event_handler()
920 phy_event_warn(iphy, state, event_code); in sci_phy_event_handler()
927 /* Set default timeout */ in sci_phy_event_handler()
930 /* Link failure change state back to the starting state */ in sci_phy_event_handler()
931 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
941 sci_port_broadcast_change_received(iphy->owning_port, iphy); in sci_phy_event_handler()
943 iphy->bcn_received_while_port_unassigned = true; in sci_phy_event_handler()
947 default: in sci_phy_event_handler()
948 phy_event_warn(iphy, state, event_code); in sci_phy_event_handler()
955 /* Link failure change state back to the starting state */ in sci_phy_event_handler()
956 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_event_handler()
958 default: in sci_phy_event_handler()
959 phy_event_warn(iphy, state, event_code); in sci_phy_event_handler()
964 default: in sci_phy_event_handler()
965 dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n", in sci_phy_event_handler()
966 __func__, phy_state_name(state)); in sci_phy_event_handler()
973 enum sci_phy_states state = iphy->sm.current_state_id; in sci_phy_frame_handler() local
974 struct isci_host *ihost = iphy->owning_port->owning_controller; in sci_phy_frame_handler()
978 switch (state) { in sci_phy_frame_handler()
983 result = sci_unsolicited_frame_control_get_header(&ihost->uf_control, in sci_phy_frame_handler()
992 u32 state; in sci_phy_frame_handler() local
994 spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); in sci_phy_frame_handler()
995 memcpy(&iphy->frame_rcvd.iaf, &iaf, sizeof(iaf)); in sci_phy_frame_handler()
996 spin_unlock_irqrestore(&iphy->sas_phy.frame_rcvd_lock, flags); in sci_phy_frame_handler()
999 * state since there are no power requirements for in sci_phy_frame_handler()
1002 state = SCI_PHY_SUB_FINAL; in sci_phy_frame_handler()
1005 * semaphore state in sci_phy_frame_handler()
1007 state = SCI_PHY_SUB_AWAIT_SAS_POWER; in sci_phy_frame_handler()
1009 sci_change_state(&iphy->sm, state); in sci_phy_frame_handler()
1024 result = sci_unsolicited_frame_control_get_header(&ihost->uf_control, in sci_phy_frame_handler()
1031 if ((frame_header->fis_type == FIS_REGD2H) && in sci_phy_frame_handler()
1032 !(frame_header->status & ATA_BUSY)) { in sci_phy_frame_handler()
1033 sci_unsolicited_frame_control_get_buffer(&ihost->uf_control, in sci_phy_frame_handler()
1037 spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); in sci_phy_frame_handler()
1038 sci_controller_copy_sata_response(&iphy->frame_rcvd.fis, in sci_phy_frame_handler()
1041 spin_unlock_irqrestore(&iphy->sas_phy.frame_rcvd_lock, flags); in sci_phy_frame_handler()
1043 /* got IAF we can now go to the await spinup semaphore state */ in sci_phy_frame_handler()
1044 sci_change_state(&iphy->sm, SCI_PHY_SUB_FINAL); in sci_phy_frame_handler()
1058 default: in sci_phy_frame_handler()
1059 dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n", in sci_phy_frame_handler()
1060 __func__, phy_state_name(state)); in sci_phy_frame_handler()
1070 /* This is just an temporary state go off to the starting state */ in sci_phy_starting_initial_substate_enter()
1071 sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_OSSP_EN); in sci_phy_starting_initial_substate_enter()
1077 struct isci_host *ihost = iphy->owning_port->owning_controller; in sci_phy_starting_await_sas_power_substate_enter()
1085 struct isci_host *ihost = iphy->owning_port->owning_controller; in sci_phy_starting_await_sas_power_substate_exit()
1093 struct isci_host *ihost = iphy->owning_port->owning_controller; in sci_phy_starting_await_sata_power_substate_enter()
1101 struct isci_host *ihost = iphy->owning_port->owning_controller; in sci_phy_starting_await_sata_power_substate_exit()
1110 sci_mod_timer(&iphy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT); in sci_phy_starting_await_sata_phy_substate_enter()
1117 sci_del_timer(&iphy->sata_timer); in sci_phy_starting_await_sata_phy_substate_exit()
1124 sci_mod_timer(&iphy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT); in sci_phy_starting_await_sata_speed_substate_enter()
1131 sci_del_timer(&iphy->sata_timer); in sci_phy_starting_await_sata_speed_substate_exit()
1138 if (sci_port_link_detected(iphy->owning_port, iphy)) { in sci_phy_starting_await_sig_fis_uf_substate_enter()
1148 sci_mod_timer(&iphy->sata_timer, in sci_phy_starting_await_sig_fis_uf_substate_enter()
1151 iphy->is_in_link_training = false; in sci_phy_starting_await_sig_fis_uf_substate_enter()
1158 sci_del_timer(&iphy->sata_timer); in sci_phy_starting_await_sig_fis_uf_substate_exit()
1165 /* State machine has run to completion so exit out and change in sci_phy_starting_final_substate_enter()
1166 * the base state machine to the ready state in sci_phy_starting_final_substate_enter()
1168 sci_change_state(&iphy->sm, SCI_PHY_READY); in sci_phy_starting_final_substate_enter()
1176 * protocol engine it just suspends it and places it in a state where it will
1185 /* Suspend the protocol engine and place it in a sata spinup hold state */ in scu_link_layer_stop_protocol_engine()
1187 readl(&iphy->link_layer_registers->phy_configuration); in scu_link_layer_stop_protocol_engine()
1193 &iphy->link_layer_registers->phy_configuration); in scu_link_layer_stop_protocol_engine()
1196 enable_spinup_value = readl(&iphy->link_layer_registers->notify_enable_spinup_control); in scu_link_layer_stop_protocol_engine()
1198 writel(enable_spinup_value, &iphy->link_layer_registers->notify_enable_spinup_control); in scu_link_layer_stop_protocol_engine()
1203 struct scu_link_layer_registers __iomem *ll = iphy->link_layer_registers; in scu_link_layer_start_oob()
1206 /** Reset OOB sequence - start */ in scu_link_layer_start_oob()
1207 val = readl(&ll->phy_configuration); in scu_link_layer_start_oob()
1211 writel(val, &ll->phy_configuration); in scu_link_layer_start_oob()
1212 readl(&ll->phy_configuration); /* flush */ in scu_link_layer_start_oob()
1213 /** Reset OOB sequence - end */ in scu_link_layer_start_oob()
1215 /** Start OOB sequence - start */ in scu_link_layer_start_oob()
1216 val = readl(&ll->phy_configuration); in scu_link_layer_start_oob()
1218 writel(val, &ll->phy_configuration); in scu_link_layer_start_oob()
1219 readl(&ll->phy_configuration); /* flush */ in scu_link_layer_start_oob()
1220 /** Start OOB sequence - end */ in scu_link_layer_start_oob()
1227 * hardware requires that we reset the OOB state machine and set the hard reset
1238 * to the starting state. */ in scu_link_layer_tx_hard_reset()
1240 readl(&iphy->link_layer_registers->phy_configuration); in scu_link_layer_tx_hard_reset()
1246 &iphy->link_layer_registers->phy_configuration); in scu_link_layer_tx_hard_reset()
1248 /* Now take the OOB state machine out of reset */ in scu_link_layer_tx_hard_reset()
1252 &iphy->link_layer_registers->phy_configuration); in scu_link_layer_tx_hard_reset()
1258 struct isci_port *iport = iphy->owning_port; in sci_phy_stopped_state_enter()
1259 struct isci_host *ihost = iport->owning_controller; in sci_phy_stopped_state_enter()
1263 * reset state in sci_phy_stopped_state_enter()
1265 sci_del_timer(&iphy->sata_timer); in sci_phy_stopped_state_enter()
1269 if (iphy->sm.previous_state_id != SCI_PHY_INITIAL) in sci_phy_stopped_state_enter()
1276 struct isci_port *iport = iphy->owning_port; in sci_phy_starting_state_enter()
1277 struct isci_host *ihost = iport->owning_controller; in sci_phy_starting_state_enter()
1283 iphy->protocol = SAS_PROTOCOL_NONE; in sci_phy_starting_state_enter()
1284 iphy->bcn_received_while_port_unassigned = false; in sci_phy_starting_state_enter()
1286 if (iphy->sm.previous_state_id == SCI_PHY_READY) in sci_phy_starting_state_enter()
1289 sci_change_state(&iphy->sm, SCI_PHY_SUB_INITIAL); in sci_phy_starting_state_enter()
1295 struct isci_port *iport = iphy->owning_port; in sci_phy_ready_state_enter()
1296 struct isci_host *ihost = iport->owning_controller; in sci_phy_ready_state_enter()
1313 * the resetting state we don't notify the user regarding link up and in sci_phy_resetting_state_enter()
1316 sci_port_deactivate_phy(iphy->owning_port, iphy, false); in sci_phy_resetting_state_enter()
1318 if (iphy->protocol == SAS_PROTOCOL_SSP) { in sci_phy_resetting_state_enter()
1321 /* The SCU does not need to have a discrete reset state so in sci_phy_resetting_state_enter()
1322 * just go back to the starting state. in sci_phy_resetting_state_enter()
1324 sci_change_state(&iphy->sm, SCI_PHY_STARTING); in sci_phy_resetting_state_enter()
1378 sci_init_sm(&iphy->sm, sci_phy_state_table, SCI_PHY_INITIAL); in sci_phy_construct()
1381 iphy->owning_port = iport; in sci_phy_construct()
1382 iphy->phy_index = phy_index; in sci_phy_construct()
1383 iphy->bcn_received_while_port_unassigned = false; in sci_phy_construct()
1384 iphy->protocol = SAS_PROTOCOL_NONE; in sci_phy_construct()
1385 iphy->link_layer_registers = NULL; in sci_phy_construct()
1386 iphy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN; in sci_phy_construct()
1389 sci_init_timer(&iphy->sata_timer, phy_sata_timeout); in sci_phy_construct()
1394 struct sci_oem_params *oem = &ihost->oem_parameters; in isci_phy_init()
1398 sci_sas_addr = oem->phys[index].sas_address.high; in isci_phy_init()
1400 sci_sas_addr |= oem->phys[index].sas_address.low; in isci_phy_init()
1402 memcpy(iphy->sas_addr, &sas_addr, sizeof(sas_addr)); in isci_phy_init()
1404 iphy->sas_phy.enabled = 0; in isci_phy_init()
1405 iphy->sas_phy.id = index; in isci_phy_init()
1406 iphy->sas_phy.sas_addr = &iphy->sas_addr[0]; in isci_phy_init()
1407 iphy->sas_phy.frame_rcvd = (u8 *)&iphy->frame_rcvd; in isci_phy_init()
1408 iphy->sas_phy.ha = &ihost->sas_ha; in isci_phy_init()
1409 iphy->sas_phy.lldd_phy = iphy; in isci_phy_init()
1410 iphy->sas_phy.enabled = 1; in isci_phy_init()
1411 iphy->sas_phy.class = SAS; in isci_phy_init()
1412 iphy->sas_phy.iproto = SAS_PROTOCOL_ALL; in isci_phy_init()
1413 iphy->sas_phy.tproto = 0; in isci_phy_init()
1414 iphy->sas_phy.type = PHY_TYPE_PHYSICAL; in isci_phy_init()
1415 iphy->sas_phy.role = PHY_ROLE_INITIATOR; in isci_phy_init()
1416 iphy->sas_phy.oob_mode = OOB_NOT_CONNECTED; in isci_phy_init()
1417 iphy->sas_phy.linkrate = SAS_LINK_RATE_UNKNOWN; in isci_phy_init()
1418 memset(&iphy->frame_rcvd, 0, sizeof(iphy->frame_rcvd)); in isci_phy_init()
1423 * isci_phy_control() - This function is one of the SAS Domain Template
1436 struct isci_phy *iphy = sas_phy->lldd_phy; in isci_phy_control()
1437 struct asd_sas_port *port = sas_phy->port; in isci_phy_control()
1438 struct isci_host *ihost = sas_phy->ha->lldd_ha; in isci_phy_control()
1441 dev_dbg(&ihost->pdev->dev, in isci_phy_control()
1447 spin_lock_irqsave(&ihost->scic_lock, flags); in isci_phy_control()
1450 spin_unlock_irqrestore(&ihost->scic_lock, flags); in isci_phy_control()
1454 spin_lock_irqsave(&ihost->scic_lock, flags); in isci_phy_control()
1458 spin_unlock_irqrestore(&ihost->scic_lock, flags); in isci_phy_control()
1463 return -ENODEV; in isci_phy_control()
1465 ret = isci_port_perform_hard_reset(ihost, port->lldd_port, iphy); in isci_phy_control()
1470 struct sas_phy *phy = sas_phy->phy; in isci_phy_control()
1472 r = iphy->link_layer_registers; in isci_phy_control()
1473 phy->running_disparity_error_count = readl(&r->running_disparity_error_count); in isci_phy_control()
1474 phy->loss_of_dword_sync_count = readl(&r->loss_of_sync_error_count); in isci_phy_control()
1475 phy->phy_reset_problem_count = readl(&r->phy_reset_problem_count); in isci_phy_control()
1476 phy->invalid_dword_count = readl(&r->invalid_dword_counter); in isci_phy_control()
1480 default: in isci_phy_control()
1481 dev_dbg(&ihost->pdev->dev, in isci_phy_control()
1484 ret = -ENOSYS; in isci_phy_control()