Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254335
b: refs/heads/master
c: 3c06c28
h: refs/heads/master
i:
  254333: 1128b64
  254331: bc5757a
  254327: db177b1
  254319: 69133cc
  254303: f4293e7
  254271: 0ff3723
  254207: ef7cc8f
v: v3
  • Loading branch information
Dan Williams committed Jul 3, 2011
1 parent a943feb commit db73d86
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 122 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d9def184b39b966b7496dfbfad126808d3cd701b
refs/heads/master: 3c06c2839dac6db56a1e6bd11924db38eddfb2ed
4 changes: 2 additions & 2 deletions trunk/drivers/scsi/isci/core/scic_config_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ struct scic_sds_controller;
*
*/
struct scic_sds_user_parameters {
struct {
struct sci_phy_user_params {
/**
* This field specifies the NOTIFY (ENABLE SPIN UP) primitive
* insertion frequency for this phy index.
Expand Down Expand Up @@ -250,7 +250,7 @@ struct scic_sds_oem_parameters {

} ports[SCI_MAX_PORTS];

struct {
struct sci_phy_oem_params {
/**
* This field specifies the SAS address to be transmitted on
* for this phy index.
Expand Down
15 changes: 0 additions & 15 deletions trunk/drivers/scsi/isci/core/scic_sds_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,21 +584,6 @@ void scic_sds_controller_enable_port_task_scheduler(
*/
#define AFE_REGISTER_WRITE_DELAY 10

static bool is_a0(void)
{
return isci_si_rev == ISCI_SI_REVA0;
}

static bool is_a2(void)
{
return isci_si_rev == ISCI_SI_REVA2;
}

static bool is_b0(void)
{
return isci_si_rev > ISCI_SI_REVA2;
}

/* Initialize the AFE for this phy index. We need to read the AFE setup from
* the OEM parameters none
*/
Expand Down
173 changes: 69 additions & 104 deletions trunk/drivers/scsi/isci/core/scic_sds_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,71 +111,63 @@ static enum sci_status scic_sds_phy_transport_layer_initialization(

/**
* This method will initialize the phy link layer registers
* @this_phy:
* @sci_phy:
* @link_layer_registers:
*
* enum sci_status
*/
static enum sci_status scic_sds_phy_link_layer_initialization(
struct scic_sds_phy *this_phy,
struct scu_link_layer_registers __iomem *link_layer_registers)
static enum sci_status
scic_sds_phy_link_layer_initialization(struct scic_sds_phy *sci_phy,
struct scu_link_layer_registers __iomem *link_layer_registers)
{
struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller;
int phy_idx = sci_phy->phy_index;
struct sci_phy_user_params *phy_user = &scic->user_parameters.sds1.phys[phy_idx];
struct sci_phy_oem_params *phy_oem = &scic->oem_parameters.sds1.phys[phy_idx];
u32 phy_configuration;
struct sas_capabilities phy_capabilities;
u32 parity_check = 0;
u32 parity_count = 0;
u32 link_layer_control;
u32 llctl, link_rate;
u32 clksm_value = 0;

this_phy->link_layer_registers = link_layer_registers;
sci_phy->link_layer_registers = link_layer_registers;

/* Set our IDENTIFY frame data */
#define SCI_END_DEVICE 0x01

SCU_SAS_TIID_WRITE(
this_phy,
(SCU_SAS_TIID_GEN_BIT(SMP_INITIATOR)
| SCU_SAS_TIID_GEN_BIT(SSP_INITIATOR)
| SCU_SAS_TIID_GEN_BIT(STP_INITIATOR)
| SCU_SAS_TIID_GEN_BIT(DA_SATA_HOST)
| SCU_SAS_TIID_GEN_VAL(DEVICE_TYPE, SCI_END_DEVICE))
);
SCU_SAS_TIID_WRITE(sci_phy, (SCU_SAS_TIID_GEN_BIT(SMP_INITIATOR) |
SCU_SAS_TIID_GEN_BIT(SSP_INITIATOR) |
SCU_SAS_TIID_GEN_BIT(STP_INITIATOR) |
SCU_SAS_TIID_GEN_BIT(DA_SATA_HOST) |
SCU_SAS_TIID_GEN_VAL(DEVICE_TYPE, SCI_END_DEVICE)));

/* Write the device SAS Address */
SCU_SAS_TIDNH_WRITE(this_phy, 0xFEDCBA98);
SCU_SAS_TIDNL_WRITE(this_phy, this_phy->phy_index);
SCU_SAS_TIDNH_WRITE(sci_phy, 0xFEDCBA98);
SCU_SAS_TIDNL_WRITE(sci_phy, phy_idx);

/* Write the source SAS Address */
SCU_SAS_TISSAH_WRITE(
this_phy,
this_phy->owning_port->owning_controller->oem_parameters.sds1.phys[
this_phy->phy_index].sas_address.high
);
SCU_SAS_TISSAL_WRITE(
this_phy,
this_phy->owning_port->owning_controller->oem_parameters.sds1.phys[
this_phy->phy_index].sas_address.low
);
SCU_SAS_TISSAH_WRITE(sci_phy, phy_oem->sas_address.high);
SCU_SAS_TISSAL_WRITE(sci_phy, phy_oem->sas_address.low);

/* Clear and Set the PHY Identifier */
SCU_SAS_TIPID_WRITE(this_phy, 0x00000000);
SCU_SAS_TIPID_WRITE(this_phy, SCU_SAS_TIPID_GEN_VALUE(ID, this_phy->phy_index));
SCU_SAS_TIPID_WRITE(sci_phy, 0x00000000);
SCU_SAS_TIPID_WRITE(sci_phy, SCU_SAS_TIPID_GEN_VALUE(ID, phy_idx));

/* Change the initial state of the phy configuration register */
phy_configuration = SCU_SAS_PCFG_READ(this_phy);
phy_configuration = SCU_SAS_PCFG_READ(sci_phy);

/* Hold OOB state machine in reset */
phy_configuration |= SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
SCU_SAS_PCFG_WRITE(this_phy, phy_configuration);
SCU_SAS_PCFG_WRITE(sci_phy, phy_configuration);

/* Configure the SNW capabilities */
phy_capabilities.u.all = 0;
phy_capabilities.u.bits.start = 1;
phy_capabilities.u.bits.gen3_without_ssc_supported = 1;
phy_capabilities.u.bits.gen2_without_ssc_supported = 1;
phy_capabilities.u.bits.gen1_without_ssc_supported = 1;
if (this_phy->owning_port->owning_controller->oem_parameters.sds1.
controller.do_enable_ssc == true) {
if (scic->oem_parameters.sds1.controller.do_enable_ssc == true) {
phy_capabilities.u.bits.gen3_with_ssc_supported = 1;
phy_capabilities.u.bits.gen2_with_ssc_supported = 1;
phy_capabilities.u.bits.gen1_with_ssc_supported = 1;
Expand All @@ -197,93 +189,66 @@ static enum sci_status scic_sds_phy_link_layer_initialization(
if ((parity_count % 2) != 0)
phy_capabilities.u.bits.parity = 1;

SCU_SAS_PHYCAP_WRITE(this_phy, phy_capabilities.u.all);
SCU_SAS_PHYCAP_WRITE(sci_phy, phy_capabilities.u.all);

/* Set the enable spinup period but disable the ability to send notify enable spinup */
SCU_SAS_ENSPINUP_WRITE(this_phy, SCU_ENSPINUP_GEN_VAL(COUNT,
this_phy->owning_port->owning_controller->user_parameters.sds1.
phys[this_phy->phy_index].notify_enable_spin_up_insertion_frequency));
/* Set the enable spinup period but disable the ability to send
* notify enable spinup
*/
SCU_SAS_ENSPINUP_WRITE(sci_phy, SCU_ENSPINUP_GEN_VAL(COUNT,
phy_user->notify_enable_spin_up_insertion_frequency));

/* Write the ALIGN Insertion Ferequency for connected phy and inpendent of connected state */
/* Write the ALIGN Insertion Ferequency for connected phy and
* inpendent of connected state
*/
clksm_value = SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(CONNECTED,
this_phy->owning_port->owning_controller->user_parameters.sds1.
phys[this_phy->phy_index].in_connection_align_insertion_frequency);
phy_user->in_connection_align_insertion_frequency);

clksm_value |= SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(GENERAL,
this_phy->owning_port->owning_controller->user_parameters.sds1.
phys[this_phy->phy_index].align_insertion_frequency);

SCU_SAS_CLKSM_WRITE(this_phy, clksm_value);

#if defined(CONFIG_PBG_HBA_A0) || defined(CONFIG_PBG_HBA_A2) || defined(CONFIG_PBG_HBA_BETA)
/* / @todo Provide a way to write this register correctly */
scu_link_layer_register_write(this_phy, afe_lookup_table_control, 0x02108421);
#else
/* / @todo Provide a way to write this register correctly */
scu_link_layer_register_write(this_phy, afe_lookup_table_control, 0x0e739ce7);
#endif

link_layer_control = SCU_SAS_LLCTL_GEN_VAL(
NO_OUTBOUND_TASK_TIMEOUT,
(u8)this_phy->owning_port->owning_controller->
user_parameters.sds1.no_outbound_task_timeout
);
phy_user->align_insertion_frequency);

/* #define COMPILED_MAX_LINK_RATE SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN1 */
/* #define COMPILED_MAX_LINK_RATE SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN2 */
#define COMPILED_MAX_LINK_RATE SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN3
SCU_SAS_CLKSM_WRITE(sci_phy, clksm_value);

if (this_phy->owning_port->owning_controller->user_parameters.sds1.
phys[this_phy->phy_index].max_speed_generation == SCIC_SDS_PARM_GEN3_SPEED) {
link_layer_control |= SCU_SAS_LLCTL_GEN_VAL(
MAX_LINK_RATE, COMPILED_MAX_LINK_RATE
);
} else if (this_phy->owning_port->owning_controller->user_parameters.sds1.
phys[this_phy->phy_index].max_speed_generation == SCIC_SDS_PARM_GEN2_SPEED) {
link_layer_control |= SCU_SAS_LLCTL_GEN_VAL(
MAX_LINK_RATE,
min(
SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN2,
COMPILED_MAX_LINK_RATE)
);
} else {
link_layer_control |= SCU_SAS_LLCTL_GEN_VAL(
MAX_LINK_RATE,
min(
SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN1,
COMPILED_MAX_LINK_RATE)
);
}
/* @todo Provide a way to write this register correctly */
scu_link_layer_register_write(sci_phy, afe_lookup_table_control, 0x02108421);

scu_link_layer_register_write(
this_phy, link_layer_control, link_layer_control
);
llctl = SCU_SAS_LLCTL_GEN_VAL(NO_OUTBOUND_TASK_TIMEOUT,
(u8)scic->user_parameters.sds1.no_outbound_task_timeout);

/*
* Program the max ARB time for the PHY to 700us so we inter-operate with
* the PMC expander which shuts down PHYs if the expander PHY generates too
* many breaks. This time value will guarantee that the initiator PHY will
* generate the break. */
#if defined(CONFIG_PBG_HBA_A0) || defined(CONFIG_PBG_HBA_A2)
scu_link_layer_register_write(
this_phy,
maximum_arbitration_wait_timer_timeout,
SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME
);
#endif /* defined(CONFIG_PBG_HBA_A0) || defined(CONFIG_PBG_HBA_A2) */
switch(phy_user->max_speed_generation) {
case SCIC_SDS_PARM_GEN3_SPEED:
link_rate = SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN3;
break;
case SCIC_SDS_PARM_GEN2_SPEED:
link_rate = SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN2;
break;
default:
link_rate = SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN1;
break;
}
llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate);

scu_link_layer_register_write(sci_phy, link_layer_control, llctl);

if (is_a0() || is_a2()) {
/* Program the max ARB time for the PHY to 700us so we inter-operate with
* the PMC expander which shuts down PHYs if the expander PHY generates too
* many breaks. This time value will guarantee that the initiator PHY will
* generate the break.
*/
scu_link_layer_register_write(sci_phy,
maximum_arbitration_wait_timer_timeout,
SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME);
}

/*
* Set the link layer hang detection to 500ms (0x1F4) from its default
* value of 128ms. Max value is 511 ms. */
scu_link_layer_register_write(
this_phy, link_layer_hang_detection_timeout, 0x1F4
);
scu_link_layer_register_write(sci_phy, link_layer_hang_detection_timeout,
0x1F4);

/* We can exit the initial state to the stopped state */
sci_base_state_machine_change_state(
scic_sds_phy_get_base_state_machine(this_phy),
SCI_BASE_PHY_STATE_STOPPED
);
sci_base_state_machine_change_state(scic_sds_phy_get_base_state_machine(sci_phy),
SCI_BASE_PHY_STATE_STOPPED);

return SCI_SUCCESS;
}
Expand Down
14 changes: 14 additions & 0 deletions trunk/drivers/scsi/isci/sci_environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,19 @@ enum {

extern int isci_si_rev;

static inline bool is_a0(void)
{
return isci_si_rev == ISCI_SI_REVA0;
}

static inline bool is_a2(void)
{
return isci_si_rev == ISCI_SI_REVA2;
}

static inline bool is_b0(void)
{
return isci_si_rev > ISCI_SI_REVA2;
}

#endif

0 comments on commit db73d86

Please sign in to comment.