diff options
author | Jacek Danecki <Jacek.Danecki@intel.com> | 2011-02-23 03:08:58 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 06:55:27 -0400 |
commit | d9def184b39b966b7496dfbfad126808d3cd701b (patch) | |
tree | ba846330e7f33dc8de24c236760a825e30ff75c1 /drivers | |
parent | 246214667f275a952b05a42b3c45a6fcb520bd28 (diff) |
isci: Add support for user parameters in SCIC layer
Add support for the following parameters in SCIC:
/**
* This field specifies the NOTIFY (ENABLE SPIN UP) primitive
* insertion frequency for this phy index.
*/
u32 notify_enable_spin_up_insertion_frequency;
/**
* This method specifies the number of transmitted DWORDs within which
* to transmit a single ALIGN primitive. This value applies regardless
* of what type of device is attached or connection state. A value of
* 0 indicates that no ALIGN primitives will be inserted.
*/
u16 align_insertion_frequency;
/**
* This method specifies the number of transmitted DWORDs within which
* to transmit 2 ALIGN primitives. This applies for SAS connections
* only. A minimum value of 3 is required for this field.
*/
u16 in_connection_align_insertion_frequency;
Signed-off-by: Krzysztof Wierzbicki <Krzysztof.Wierzbicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_controller.c | 58 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_phy.c | 16 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_phy_registers.h | 8 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scu_registers.h | 7 |
4 files changed, 66 insertions, 23 deletions
diff --git a/drivers/scsi/isci/core/scic_sds_controller.c b/drivers/scsi/isci/core/scic_sds_controller.c index e597c6b53eaa..d9fca9976889 100644 --- a/drivers/scsi/isci/core/scic_sds_controller.c +++ b/drivers/scsi/isci/core/scic_sds_controller.c | |||
@@ -616,7 +616,6 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic) | |||
616 | scu_afe_register_write(scic, afe_bias_control, 0x00005500); | 616 | scu_afe_register_write(scic, afe_bias_control, 0x00005500); |
617 | else | 617 | else |
618 | scu_afe_register_write(scic, afe_bias_control, 0x00005A00); | 618 | scu_afe_register_write(scic, afe_bias_control, 0x00005A00); |
619 | |||
620 | 619 | ||
621 | scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); | 620 | scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); |
622 | 621 | ||
@@ -625,7 +624,7 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic) | |||
625 | scu_afe_register_write(scic, afe_pll_control0, 0x80040A08); | 624 | scu_afe_register_write(scic, afe_pll_control0, 0x80040A08); |
626 | else | 625 | else |
627 | scu_afe_register_write(scic, afe_pll_control0, 0x80040908); | 626 | scu_afe_register_write(scic, afe_pll_control0, 0x80040908); |
628 | 627 | ||
629 | scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); | 628 | scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); |
630 | 629 | ||
631 | /* Wait for the PLL to lock */ | 630 | /* Wait for the PLL to lock */ |
@@ -1962,17 +1961,16 @@ void scic_sds_controller_release_frame( | |||
1962 | * configuration parameters to their default values. | 1961 | * configuration parameters to their default values. |
1963 | * | 1962 | * |
1964 | */ | 1963 | */ |
1965 | static void scic_sds_controller_set_default_config_parameters( | 1964 | static void scic_sds_controller_set_default_config_parameters(struct scic_sds_controller *scic) |
1966 | struct scic_sds_controller *this_controller) | ||
1967 | { | 1965 | { |
1968 | u16 index; | 1966 | u16 index; |
1969 | 1967 | ||
1970 | /* Default to no SSC operation. */ | 1968 | /* Default to no SSC operation. */ |
1971 | this_controller->oem_parameters.sds1.controller.do_enable_ssc = false; | 1969 | scic->oem_parameters.sds1.controller.do_enable_ssc = false; |
1972 | 1970 | ||
1973 | /* Initialize all of the port parameter information to narrow ports. */ | 1971 | /* Initialize all of the port parameter information to narrow ports. */ |
1974 | for (index = 0; index < SCI_MAX_PORTS; index++) { | 1972 | for (index = 0; index < SCI_MAX_PORTS; index++) { |
1975 | this_controller->oem_parameters.sds1.ports[index].phy_mask = 0; | 1973 | scic->oem_parameters.sds1.ports[index].phy_mask = 0; |
1976 | } | 1974 | } |
1977 | 1975 | ||
1978 | /* Initialize all of the phy parameter information. */ | 1976 | /* Initialize all of the phy parameter information. */ |
@@ -1980,24 +1978,27 @@ static void scic_sds_controller_set_default_config_parameters( | |||
1980 | /* | 1978 | /* |
1981 | * Default to 3G (i.e. Gen 2) for now. User can override if | 1979 | * Default to 3G (i.e. Gen 2) for now. User can override if |
1982 | * they choose. */ | 1980 | * they choose. */ |
1983 | this_controller->user_parameters.sds1.phys[index].max_speed_generation = 2; | 1981 | scic->user_parameters.sds1.phys[index].max_speed_generation = 2; |
1982 | |||
1983 | /* the frequencies cannot be 0 */ | ||
1984 | scic->user_parameters.sds1.phys[index].align_insertion_frequency = 0x7f; | ||
1985 | scic->user_parameters.sds1.phys[index].in_connection_align_insertion_frequency = 0xff; | ||
1986 | scic->user_parameters.sds1.phys[index].notify_enable_spin_up_insertion_frequency = 0x33; | ||
1984 | 1987 | ||
1985 | /* | 1988 | /* |
1986 | * Previous Vitesse based expanders had a arbitration issue that | 1989 | * Previous Vitesse based expanders had a arbitration issue that |
1987 | * is worked around by having the upper 32-bits of SAS address | 1990 | * is worked around by having the upper 32-bits of SAS address |
1988 | * with a value greater then the Vitesse company identifier. | 1991 | * with a value greater then the Vitesse company identifier. |
1989 | * Hence, usage of 0x5FCFFFFF. */ | 1992 | * Hence, usage of 0x5FCFFFFF. */ |
1990 | this_controller->oem_parameters.sds1.phys[index].sas_address.low | 1993 | scic->oem_parameters.sds1.phys[index].sas_address.low = 0x00000001; |
1991 | = 0x00000001; | 1994 | scic->oem_parameters.sds1.phys[index].sas_address.high = 0x5FCFFFFF; |
1992 | this_controller->oem_parameters.sds1.phys[index].sas_address.high | ||
1993 | = 0x5FCFFFFF; | ||
1994 | } | 1995 | } |
1995 | 1996 | ||
1996 | this_controller->user_parameters.sds1.stp_inactivity_timeout = 5; | 1997 | scic->user_parameters.sds1.stp_inactivity_timeout = 5; |
1997 | this_controller->user_parameters.sds1.ssp_inactivity_timeout = 5; | 1998 | scic->user_parameters.sds1.ssp_inactivity_timeout = 5; |
1998 | this_controller->user_parameters.sds1.stp_max_occupancy_timeout = 5; | 1999 | scic->user_parameters.sds1.stp_max_occupancy_timeout = 5; |
1999 | this_controller->user_parameters.sds1.ssp_max_occupancy_timeout = 20; | 2000 | scic->user_parameters.sds1.ssp_max_occupancy_timeout = 20; |
2000 | this_controller->user_parameters.sds1.no_outbound_task_timeout = 20; | 2001 | scic->user_parameters.sds1.no_outbound_task_timeout = 20; |
2001 | } | 2002 | } |
2002 | 2003 | ||
2003 | 2004 | ||
@@ -2103,9 +2104,9 @@ u32 scic_controller_get_suggested_start_timeout( | |||
2103 | * per interval - 1 (once OEM parameters are supported). | 2104 | * per interval - 1 (once OEM parameters are supported). |
2104 | * Currently we assume only 1 phy per interval. */ | 2105 | * Currently we assume only 1 phy per interval. */ |
2105 | 2106 | ||
2106 | return (SCIC_SDS_SIGNATURE_FIS_TIMEOUT | 2107 | return SCIC_SDS_SIGNATURE_FIS_TIMEOUT |
2107 | + SCIC_SDS_CONTROLLER_PHY_START_TIMEOUT | 2108 | + SCIC_SDS_CONTROLLER_PHY_START_TIMEOUT |
2108 | + ((SCI_MAX_PHYS - 1) * SCIC_SDS_CONTROLLER_POWER_CONTROL_INTERVAL)); | 2109 | + ((SCI_MAX_PHYS - 1) * SCIC_SDS_CONTROLLER_POWER_CONTROL_INTERVAL); |
2109 | } | 2110 | } |
2110 | 2111 | ||
2111 | /* --------------------------------------------------------------------------- */ | 2112 | /* --------------------------------------------------------------------------- */ |
@@ -2489,16 +2490,29 @@ enum sci_status scic_user_parameters_set( | |||
2489 | * Validate the user parameters. If they are not legal, then | 2490 | * Validate the user parameters. If they are not legal, then |
2490 | * return a failure. */ | 2491 | * return a failure. */ |
2491 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 2492 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
2492 | if (! | 2493 | if (!(scic_parms->sds1.phys[index].max_speed_generation |
2493 | (scic_parms->sds1.phys[index].max_speed_generation | ||
2494 | <= SCIC_SDS_PARM_MAX_SPEED | 2494 | <= SCIC_SDS_PARM_MAX_SPEED |
2495 | && scic_parms->sds1.phys[index].max_speed_generation | 2495 | && scic_parms->sds1.phys[index].max_speed_generation |
2496 | > SCIC_SDS_PARM_NO_SPEED | 2496 | > SCIC_SDS_PARM_NO_SPEED)) |
2497 | ) | 2497 | return SCI_FAILURE_INVALID_PARAMETER_VALUE; |
2498 | |||
2499 | if (scic_parms->sds1.phys[index].in_connection_align_insertion_frequency < 3) | ||
2500 | return SCI_FAILURE_INVALID_PARAMETER_VALUE; | ||
2501 | if ( | ||
2502 | (scic_parms->sds1.phys[index].in_connection_align_insertion_frequency < 3) || | ||
2503 | (scic_parms->sds1.phys[index].align_insertion_frequency == 0) || | ||
2504 | (scic_parms->sds1.phys[index].notify_enable_spin_up_insertion_frequency == 0) | ||
2498 | ) | 2505 | ) |
2499 | return SCI_FAILURE_INVALID_PARAMETER_VALUE; | 2506 | return SCI_FAILURE_INVALID_PARAMETER_VALUE; |
2500 | } | 2507 | } |
2501 | 2508 | ||
2509 | if ((scic_parms->sds1.stp_inactivity_timeout == 0) || | ||
2510 | (scic_parms->sds1.ssp_inactivity_timeout == 0) || | ||
2511 | (scic_parms->sds1.stp_max_occupancy_timeout == 0) || | ||
2512 | (scic_parms->sds1.ssp_max_occupancy_timeout == 0) || | ||
2513 | (scic_parms->sds1.no_outbound_task_timeout == 0)) | ||
2514 | return SCI_FAILURE_INVALID_PARAMETER_VALUE; | ||
2515 | |||
2502 | memcpy(&scic->user_parameters, scic_parms, sizeof(*scic_parms)); | 2516 | memcpy(&scic->user_parameters, scic_parms, sizeof(*scic_parms)); |
2503 | 2517 | ||
2504 | return SCI_SUCCESS; | 2518 | return SCI_SUCCESS; |
diff --git a/drivers/scsi/isci/core/scic_sds_phy.c b/drivers/scsi/isci/core/scic_sds_phy.c index bd0a6ba17b18..ecd7cc698ae6 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.c +++ b/drivers/scsi/isci/core/scic_sds_phy.c | |||
@@ -125,6 +125,7 @@ static enum sci_status scic_sds_phy_link_layer_initialization( | |||
125 | u32 parity_check = 0; | 125 | u32 parity_check = 0; |
126 | u32 parity_count = 0; | 126 | u32 parity_count = 0; |
127 | u32 link_layer_control; | 127 | u32 link_layer_control; |
128 | u32 clksm_value = 0; | ||
128 | 129 | ||
129 | this_phy->link_layer_registers = link_layer_registers; | 130 | this_phy->link_layer_registers = link_layer_registers; |
130 | 131 | ||
@@ -199,7 +200,20 @@ static enum sci_status scic_sds_phy_link_layer_initialization( | |||
199 | SCU_SAS_PHYCAP_WRITE(this_phy, phy_capabilities.u.all); | 200 | SCU_SAS_PHYCAP_WRITE(this_phy, phy_capabilities.u.all); |
200 | 201 | ||
201 | /* Set the enable spinup period but disable the ability to send notify enable spinup */ | 202 | /* Set the enable spinup period but disable the ability to send notify enable spinup */ |
202 | SCU_SAS_ENSPINUP_WRITE(this_phy, SCU_ENSPINUP_GEN_VAL(COUNT, 0x33)); | 203 | SCU_SAS_ENSPINUP_WRITE(this_phy, SCU_ENSPINUP_GEN_VAL(COUNT, |
204 | this_phy->owning_port->owning_controller->user_parameters.sds1. | ||
205 | phys[this_phy->phy_index].notify_enable_spin_up_insertion_frequency)); | ||
206 | |||
207 | /* Write the ALIGN Insertion Ferequency for connected phy and inpendent of connected state */ | ||
208 | clksm_value = SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(CONNECTED, | ||
209 | this_phy->owning_port->owning_controller->user_parameters.sds1. | ||
210 | phys[this_phy->phy_index].in_connection_align_insertion_frequency); | ||
211 | |||
212 | clksm_value |= SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(GENERAL, | ||
213 | this_phy->owning_port->owning_controller->user_parameters.sds1. | ||
214 | phys[this_phy->phy_index].align_insertion_frequency); | ||
215 | |||
216 | SCU_SAS_CLKSM_WRITE(this_phy, clksm_value); | ||
203 | 217 | ||
204 | #if defined(CONFIG_PBG_HBA_A0) || defined(CONFIG_PBG_HBA_A2) || defined(CONFIG_PBG_HBA_BETA) | 218 | #if defined(CONFIG_PBG_HBA_A0) || defined(CONFIG_PBG_HBA_A2) || defined(CONFIG_PBG_HBA_BETA) |
205 | /* / @todo Provide a way to write this register correctly */ | 219 | /* / @todo Provide a way to write this register correctly */ |
diff --git a/drivers/scsi/isci/core/scic_sds_phy_registers.h b/drivers/scsi/isci/core/scic_sds_phy_registers.h index 284217618031..ddbb2361510d 100644 --- a/drivers/scsi/isci/core/scic_sds_phy_registers.h +++ b/drivers/scsi/isci/core/scic_sds_phy_registers.h | |||
@@ -217,6 +217,14 @@ | |||
217 | #define SCU_SAS_ENSPINUP_WRITE(phy, value) \ | 217 | #define SCU_SAS_ENSPINUP_WRITE(phy, value) \ |
218 | scu_link_layer_register_write(phy, notify_enable_spinup_control, value) | 218 | scu_link_layer_register_write(phy, notify_enable_spinup_control, value) |
219 | 219 | ||
220 | /* This macro reads the CLKSM register */ | ||
221 | #define SCU_SAS_CLKSM_READ(phy) \ | ||
222 | scu_link_layer_register_read(phy, clock_skew_management) | ||
223 | |||
224 | /* This macro writes the CLKSM register */ | ||
225 | #define SCU_SAS_CLKSM_WRITE(phy, value) \ | ||
226 | scu_link_layer_register_write(phy, clock_skew_management, value) | ||
227 | |||
220 | /* / This macro reads the PHY Capacity register */ | 228 | /* / This macro reads the PHY Capacity register */ |
221 | #define SCU_SAS_PHYCAP_READ(phy) \ | 229 | #define SCU_SAS_PHYCAP_READ(phy) \ |
222 | scu_link_layer_register_read(phy, phy_capabilities) | 230 | scu_link_layer_register_read(phy, phy_capabilities) |
diff --git a/drivers/scsi/isci/core/scu_registers.h b/drivers/scsi/isci/core/scu_registers.h index de2ce93b7836..05a141181844 100644 --- a/drivers/scsi/isci/core/scu_registers.h +++ b/drivers/scsi/isci/core/scu_registers.h | |||
@@ -611,6 +611,13 @@ | |||
611 | #define SCU_SAS_PCFG_GEN_BIT(name) \ | 611 | #define SCU_SAS_PCFG_GEN_BIT(name) \ |
612 | SCU_GEN_BIT(SCU_SAS_PHY_CONFIGURATION_ ## name) | 612 | SCU_GEN_BIT(SCU_SAS_PHY_CONFIGURATION_ ## name) |
613 | 613 | ||
614 | #define SCU_LINK_LAYER_ALIGN_INSERTION_FREQUENCY_GENERAL_SHIFT (0) | ||
615 | #define SCU_LINK_LAYER_ALIGN_INSERTION_FREQUENCY_GENERAL_MASK (0x000007FF) | ||
616 | #define SCU_LINK_LAYER_ALIGN_INSERTION_FREQUENCY_CONNECTED_SHIFT (16) | ||
617 | #define SCU_LINK_LAYER_ALIGN_INSERTION_FREQUENCY_CONNECTED_MASK (0x00ff0000) | ||
618 | |||
619 | #define SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(name, value) \ | ||
620 | SCU_GEN_VALUE(SCU_LINK_LAYER_ALIGN_INSERTION_FREQUENCY_##name, value) | ||
614 | 621 | ||
615 | #define SCU_LINK_LAYER_ENABLE_SPINUP_CONTROL_COUNT_SHIFT (0) | 622 | #define SCU_LINK_LAYER_ENABLE_SPINUP_CONTROL_COUNT_SHIFT (0) |
616 | #define SCU_LINK_LAYER_ENABLE_SPINUP_CONTROL_COUNT_MASK (0x0003FFFF) | 623 | #define SCU_LINK_LAYER_ENABLE_SPINUP_CONTROL_COUNT_MASK (0x0003FFFF) |