diff options
author | Dan Williams <dan.j.williams@intel.com> | 2012-01-04 04:32:34 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-01-16 02:39:52 -0500 |
commit | 2e5da889d44a3a9629f895de3488306e7f5ddf16 (patch) | |
tree | e7af1c412c85dcdb28023fca51f6089ff31474b5 | |
parent | 7d99b3abaf8412932269a2a2e561138326d61f8b (diff) |
[SCSI] isci: cleanup oem parameter and recipe handling
Before updating the code to support the latest platform updates and
silicon revision cleanup some of the long deref chains.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/isci/host.c | 107 | ||||
-rw-r--r-- | drivers/scsi/isci/phy.c | 81 |
2 files changed, 86 insertions, 102 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index e7fe9c4c85b8..8e7de192cf6d 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -1910,160 +1910,147 @@ void sci_controller_power_control_queue_remove(struct isci_host *ihost, | |||
1910 | 1910 | ||
1911 | #define AFE_REGISTER_WRITE_DELAY 10 | 1911 | #define AFE_REGISTER_WRITE_DELAY 10 |
1912 | 1912 | ||
1913 | /* Initialize the AFE for this phy index. We need to read the AFE setup from | ||
1914 | * the OEM parameters | ||
1915 | */ | ||
1916 | static void sci_controller_afe_initialization(struct isci_host *ihost) | 1913 | static void sci_controller_afe_initialization(struct isci_host *ihost) |
1917 | { | 1914 | { |
1915 | struct scu_afe_registers __iomem *afe = &ihost->scu_registers->afe; | ||
1918 | const struct sci_oem_params *oem = &ihost->oem_parameters; | 1916 | const struct sci_oem_params *oem = &ihost->oem_parameters; |
1919 | struct pci_dev *pdev = ihost->pdev; | 1917 | struct pci_dev *pdev = ihost->pdev; |
1920 | u32 afe_status; | 1918 | u32 afe_status; |
1921 | u32 phy_id; | 1919 | u32 phy_id; |
1922 | 1920 | ||
1923 | /* Clear DFX Status registers */ | 1921 | /* Clear DFX Status registers */ |
1924 | writel(0x0081000f, &ihost->scu_registers->afe.afe_dfx_master_control0); | 1922 | writel(0x0081000f, &afe->afe_dfx_master_control0); |
1925 | udelay(AFE_REGISTER_WRITE_DELAY); | 1923 | udelay(AFE_REGISTER_WRITE_DELAY); |
1926 | 1924 | ||
1927 | if (is_b0(pdev)) { | 1925 | if (is_b0(pdev)) { |
1928 | /* PM Rx Equalization Save, PM SPhy Rx Acknowledgement | 1926 | /* PM Rx Equalization Save, PM SPhy Rx Acknowledgement |
1929 | * Timer, PM Stagger Timer */ | 1927 | * Timer, PM Stagger Timer |
1930 | writel(0x0007BFFF, &ihost->scu_registers->afe.afe_pmsn_master_control2); | 1928 | */ |
1929 | writel(0x0007BFFF, &afe->afe_pmsn_master_control2); | ||
1931 | udelay(AFE_REGISTER_WRITE_DELAY); | 1930 | udelay(AFE_REGISTER_WRITE_DELAY); |
1932 | } | 1931 | } |
1933 | 1932 | ||
1934 | /* Configure bias currents to normal */ | 1933 | /* Configure bias currents to normal */ |
1935 | if (is_a2(pdev)) | 1934 | if (is_a2(pdev)) |
1936 | writel(0x00005A00, &ihost->scu_registers->afe.afe_bias_control); | 1935 | writel(0x00005A00, &afe->afe_bias_control); |
1937 | else if (is_b0(pdev) || is_c0(pdev)) | 1936 | else if (is_b0(pdev) || is_c0(pdev)) |
1938 | writel(0x00005F00, &ihost->scu_registers->afe.afe_bias_control); | 1937 | writel(0x00005F00, &afe->afe_bias_control); |
1939 | 1938 | ||
1940 | udelay(AFE_REGISTER_WRITE_DELAY); | 1939 | udelay(AFE_REGISTER_WRITE_DELAY); |
1941 | 1940 | ||
1942 | /* Enable PLL */ | 1941 | /* Enable PLL */ |
1943 | if (is_b0(pdev) || is_c0(pdev)) | 1942 | if (is_b0(pdev) || is_c0(pdev)) |
1944 | writel(0x80040A08, &ihost->scu_registers->afe.afe_pll_control0); | 1943 | writel(0x80040A08, &afe->afe_pll_control0); |
1945 | else | 1944 | else |
1946 | writel(0x80040908, &ihost->scu_registers->afe.afe_pll_control0); | 1945 | writel(0x80040908, &afe->afe_pll_control0); |
1947 | 1946 | ||
1948 | udelay(AFE_REGISTER_WRITE_DELAY); | 1947 | udelay(AFE_REGISTER_WRITE_DELAY); |
1949 | 1948 | ||
1950 | /* Wait for the PLL to lock */ | 1949 | /* Wait for the PLL to lock */ |
1951 | do { | 1950 | do { |
1952 | afe_status = readl(&ihost->scu_registers->afe.afe_common_block_status); | 1951 | afe_status = readl(&afe->afe_common_block_status); |
1953 | udelay(AFE_REGISTER_WRITE_DELAY); | 1952 | udelay(AFE_REGISTER_WRITE_DELAY); |
1954 | } while ((afe_status & 0x00001000) == 0); | 1953 | } while ((afe_status & 0x00001000) == 0); |
1955 | 1954 | ||
1956 | if (is_a2(pdev)) { | 1955 | if (is_a2(pdev)) { |
1957 | /* Shorten SAS SNW lock time (RxLock timer value from 76 us to 50 us) */ | 1956 | /* Shorten SAS SNW lock time (RxLock timer value from 76 |
1958 | writel(0x7bcc96ad, &ihost->scu_registers->afe.afe_pmsn_master_control0); | 1957 | * us to 50 us) |
1958 | */ | ||
1959 | writel(0x7bcc96ad, &afe->afe_pmsn_master_control0); | ||
1959 | udelay(AFE_REGISTER_WRITE_DELAY); | 1960 | udelay(AFE_REGISTER_WRITE_DELAY); |
1960 | } | 1961 | } |
1961 | 1962 | ||
1962 | for (phy_id = 0; phy_id < SCI_MAX_PHYS; phy_id++) { | 1963 | for (phy_id = 0; phy_id < SCI_MAX_PHYS; phy_id++) { |
1964 | struct scu_afe_transceiver *xcvr = &afe->scu_afe_xcvr[phy_id]; | ||
1963 | const struct sci_phy_oem_params *oem_phy = &oem->phys[phy_id]; | 1965 | const struct sci_phy_oem_params *oem_phy = &oem->phys[phy_id]; |
1964 | 1966 | ||
1965 | if (is_b0(pdev)) { | 1967 | if (is_b0(pdev)) { |
1966 | /* Configure transmitter SSC parameters */ | 1968 | /* Configure transmitter SSC parameters */ |
1967 | writel(0x00030000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); | 1969 | writel(0x00030000, &xcvr->afe_tx_ssc_control); |
1968 | udelay(AFE_REGISTER_WRITE_DELAY); | 1970 | udelay(AFE_REGISTER_WRITE_DELAY); |
1969 | } else if (is_c0(pdev)) { | 1971 | } else if (is_c0(pdev)) { |
1970 | /* Configure transmitter SSC parameters */ | 1972 | /* Configure transmitter SSC parameters */ |
1971 | writel(0x0003000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); | 1973 | writel(0x0003000, &xcvr->afe_tx_ssc_control); |
1972 | udelay(AFE_REGISTER_WRITE_DELAY); | 1974 | udelay(AFE_REGISTER_WRITE_DELAY); |
1973 | 1975 | ||
1974 | /* | 1976 | /* All defaults, except the Receive Word |
1975 | * All defaults, except the Receive Word Alignament/Comma Detect | 1977 | * Alignament/Comma Detect Enable....(0xe800) |
1976 | * Enable....(0xe800) */ | 1978 | */ |
1977 | writel(0x00004500, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); | 1979 | writel(0x00004500, &xcvr->afe_xcvr_control0); |
1978 | udelay(AFE_REGISTER_WRITE_DELAY); | 1980 | udelay(AFE_REGISTER_WRITE_DELAY); |
1979 | } else { | 1981 | } else { |
1980 | /* | 1982 | /* All defaults, except the Receive Word |
1981 | * All defaults, except the Receive Word Alignament/Comma Detect | 1983 | * Alignament/Comma Detect Enable....(0xe800) |
1982 | * Enable....(0xe800) */ | 1984 | */ |
1983 | writel(0x00004512, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); | 1985 | writel(0x00004512, &xcvr->afe_xcvr_control0); |
1984 | udelay(AFE_REGISTER_WRITE_DELAY); | 1986 | udelay(AFE_REGISTER_WRITE_DELAY); |
1985 | 1987 | ||
1986 | writel(0x0050100F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control1); | 1988 | writel(0x0050100F, &xcvr->afe_xcvr_control1); |
1987 | udelay(AFE_REGISTER_WRITE_DELAY); | 1989 | udelay(AFE_REGISTER_WRITE_DELAY); |
1988 | } | 1990 | } |
1989 | 1991 | ||
1990 | /* | 1992 | /* Power up TX and RX out from power down (PWRDNTX and PWRDNRX) |
1991 | * Power up TX and RX out from power down (PWRDNTX and PWRDNRX) | 1993 | * & increase TX int & ext bias 20%....(0xe85c) |
1992 | * & increase TX int & ext bias 20%....(0xe85c) */ | 1994 | */ |
1993 | if (is_a2(pdev)) | 1995 | if (is_a2(pdev)) |
1994 | writel(0x000003F0, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); | 1996 | writel(0x000003F0, &xcvr->afe_channel_control); |
1995 | else if (is_b0(pdev)) { | 1997 | else if (is_b0(pdev)) { |
1996 | /* Power down TX and RX (PWRDNTX and PWRDNRX) */ | 1998 | /* Power down TX and RX (PWRDNTX and PWRDNRX) */ |
1997 | writel(0x000003D7, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); | 1999 | writel(0x000003D7, &xcvr->afe_channel_control); |
1998 | udelay(AFE_REGISTER_WRITE_DELAY); | 2000 | udelay(AFE_REGISTER_WRITE_DELAY); |
1999 | 2001 | writel(0x000003D4, &xcvr->afe_channel_control); | |
2000 | /* | ||
2001 | * Power up TX and RX out from power down (PWRDNTX and PWRDNRX) | ||
2002 | * & increase TX int & ext bias 20%....(0xe85c) */ | ||
2003 | writel(0x000003D4, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); | ||
2004 | } else { | 2002 | } else { |
2005 | writel(0x000001E7, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); | 2003 | writel(0x000001E7, &xcvr->afe_channel_control); |
2006 | udelay(AFE_REGISTER_WRITE_DELAY); | 2004 | udelay(AFE_REGISTER_WRITE_DELAY); |
2007 | 2005 | writel(0x000001E4, &xcvr->afe_channel_control); | |
2008 | /* | ||
2009 | * Power up TX and RX out from power down (PWRDNTX and PWRDNRX) | ||
2010 | * & increase TX int & ext bias 20%....(0xe85c) */ | ||
2011 | writel(0x000001E4, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); | ||
2012 | } | 2006 | } |
2013 | udelay(AFE_REGISTER_WRITE_DELAY); | 2007 | udelay(AFE_REGISTER_WRITE_DELAY); |
2014 | 2008 | ||
2015 | if (is_a2(pdev)) { | 2009 | if (is_a2(pdev)) { |
2016 | /* Enable TX equalization (0xe824) */ | 2010 | /* Enable TX equalization (0xe824) */ |
2017 | writel(0x00040000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); | 2011 | writel(0x00040000, &xcvr->afe_tx_control); |
2018 | udelay(AFE_REGISTER_WRITE_DELAY); | 2012 | udelay(AFE_REGISTER_WRITE_DELAY); |
2019 | } | 2013 | } |
2020 | 2014 | ||
2021 | /* | 2015 | writel(0x00004100, &xcvr->afe_xcvr_control0); |
2022 | * RDPI=0x0(RX Power On), RXOOBDETPDNC=0x0, TPD=0x0(TX Power On), | ||
2023 | * RDD=0x0(RX Detect Enabled) ....(0xe800) */ | ||
2024 | writel(0x00004100, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); | ||
2025 | udelay(AFE_REGISTER_WRITE_DELAY); | 2016 | udelay(AFE_REGISTER_WRITE_DELAY); |
2026 | 2017 | ||
2027 | /* Leave DFE/FFE on */ | 2018 | /* Leave DFE/FFE on */ |
2028 | if (is_a2(pdev)) | 2019 | if (is_a2(pdev)) |
2029 | writel(0x3F11103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); | 2020 | writel(0x3F11103F, &xcvr->afe_rx_ssc_control0); |
2030 | else if (is_b0(pdev)) { | 2021 | else if (is_b0(pdev)) { |
2031 | writel(0x3F11103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); | 2022 | writel(0x3F11103F, &xcvr->afe_rx_ssc_control0); |
2032 | udelay(AFE_REGISTER_WRITE_DELAY); | 2023 | udelay(AFE_REGISTER_WRITE_DELAY); |
2033 | /* Enable TX equalization (0xe824) */ | 2024 | /* Enable TX equalization (0xe824) */ |
2034 | writel(0x00040000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); | 2025 | writel(0x00040000, &xcvr->afe_tx_control); |
2035 | } else { | 2026 | } else { |
2036 | writel(0x0140DF0F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control1); | 2027 | writel(0x0140DF0F, &xcvr->afe_rx_ssc_control1); |
2037 | udelay(AFE_REGISTER_WRITE_DELAY); | 2028 | udelay(AFE_REGISTER_WRITE_DELAY); |
2038 | 2029 | ||
2039 | writel(0x3F6F103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); | 2030 | writel(0x3F6F103F, &xcvr->afe_rx_ssc_control0); |
2040 | udelay(AFE_REGISTER_WRITE_DELAY); | 2031 | udelay(AFE_REGISTER_WRITE_DELAY); |
2041 | 2032 | ||
2042 | /* Enable TX equalization (0xe824) */ | 2033 | /* Enable TX equalization (0xe824) */ |
2043 | writel(0x00040000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); | 2034 | writel(0x00040000, &xcvr->afe_tx_control); |
2044 | } | 2035 | } |
2045 | 2036 | ||
2046 | udelay(AFE_REGISTER_WRITE_DELAY); | 2037 | udelay(AFE_REGISTER_WRITE_DELAY); |
2047 | 2038 | ||
2048 | writel(oem_phy->afe_tx_amp_control0, | 2039 | writel(oem_phy->afe_tx_amp_control0, &xcvr->afe_tx_amp_control0); |
2049 | &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control0); | ||
2050 | udelay(AFE_REGISTER_WRITE_DELAY); | 2040 | udelay(AFE_REGISTER_WRITE_DELAY); |
2051 | 2041 | ||
2052 | writel(oem_phy->afe_tx_amp_control1, | 2042 | writel(oem_phy->afe_tx_amp_control1, &xcvr->afe_tx_amp_control1); |
2053 | &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control1); | ||
2054 | udelay(AFE_REGISTER_WRITE_DELAY); | 2043 | udelay(AFE_REGISTER_WRITE_DELAY); |
2055 | 2044 | ||
2056 | writel(oem_phy->afe_tx_amp_control2, | 2045 | writel(oem_phy->afe_tx_amp_control2, &xcvr->afe_tx_amp_control2); |
2057 | &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control2); | ||
2058 | udelay(AFE_REGISTER_WRITE_DELAY); | 2046 | udelay(AFE_REGISTER_WRITE_DELAY); |
2059 | 2047 | ||
2060 | writel(oem_phy->afe_tx_amp_control3, | 2048 | writel(oem_phy->afe_tx_amp_control3, &xcvr->afe_tx_amp_control3); |
2061 | &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control3); | ||
2062 | udelay(AFE_REGISTER_WRITE_DELAY); | 2049 | udelay(AFE_REGISTER_WRITE_DELAY); |
2063 | } | 2050 | } |
2064 | 2051 | ||
2065 | /* Transfer control to the PEs */ | 2052 | /* Transfer control to the PEs */ |
2066 | writel(0x00010f00, &ihost->scu_registers->afe.afe_dfx_master_control0); | 2053 | writel(0x00010f00, &afe->afe_dfx_master_control0); |
2067 | udelay(AFE_REGISTER_WRITE_DELAY); | 2054 | udelay(AFE_REGISTER_WRITE_DELAY); |
2068 | } | 2055 | } |
2069 | 2056 | ||
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index 35f50c2183e1..0ae0990b39dd 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c | |||
@@ -91,22 +91,23 @@ sci_phy_transport_layer_initialization(struct isci_phy *iphy, | |||
91 | 91 | ||
92 | static enum sci_status | 92 | static enum sci_status |
93 | sci_phy_link_layer_initialization(struct isci_phy *iphy, | 93 | sci_phy_link_layer_initialization(struct isci_phy *iphy, |
94 | struct scu_link_layer_registers __iomem *reg) | 94 | struct scu_link_layer_registers __iomem *llr) |
95 | { | 95 | { |
96 | struct isci_host *ihost = iphy->owning_port->owning_controller; | 96 | struct isci_host *ihost = iphy->owning_port->owning_controller; |
97 | struct sci_phy_user_params *phy_user; | ||
98 | struct sci_phy_oem_params *phy_oem; | ||
97 | int phy_idx = iphy->phy_index; | 99 | int phy_idx = iphy->phy_index; |
98 | struct sci_phy_user_params *phy_user = &ihost->user_parameters.phys[phy_idx]; | ||
99 | struct sci_phy_oem_params *phy_oem = | ||
100 | &ihost->oem_parameters.phys[phy_idx]; | ||
101 | u32 phy_configuration; | ||
102 | struct sci_phy_cap phy_cap; | 100 | struct sci_phy_cap phy_cap; |
101 | u32 phy_configuration; | ||
103 | u32 parity_check = 0; | 102 | u32 parity_check = 0; |
104 | u32 parity_count = 0; | 103 | u32 parity_count = 0; |
105 | u32 llctl, link_rate; | 104 | u32 llctl, link_rate; |
106 | u32 clksm_value = 0; | 105 | u32 clksm_value = 0; |
107 | u32 sp_timeouts = 0; | 106 | u32 sp_timeouts = 0; |
108 | 107 | ||
109 | iphy->link_layer_registers = reg; | 108 | phy_user = &ihost->user_parameters.phys[phy_idx]; |
109 | phy_oem = &ihost->oem_parameters.phys[phy_idx]; | ||
110 | iphy->link_layer_registers = llr; | ||
110 | 111 | ||
111 | /* Set our IDENTIFY frame data */ | 112 | /* Set our IDENTIFY frame data */ |
112 | #define SCI_END_DEVICE 0x01 | 113 | #define SCI_END_DEVICE 0x01 |
@@ -116,32 +117,26 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, | |||
116 | SCU_SAS_TIID_GEN_BIT(STP_INITIATOR) | | 117 | SCU_SAS_TIID_GEN_BIT(STP_INITIATOR) | |
117 | SCU_SAS_TIID_GEN_BIT(DA_SATA_HOST) | | 118 | SCU_SAS_TIID_GEN_BIT(DA_SATA_HOST) | |
118 | SCU_SAS_TIID_GEN_VAL(DEVICE_TYPE, SCI_END_DEVICE), | 119 | SCU_SAS_TIID_GEN_VAL(DEVICE_TYPE, SCI_END_DEVICE), |
119 | &iphy->link_layer_registers->transmit_identification); | 120 | &llr->transmit_identification); |
120 | 121 | ||
121 | /* Write the device SAS Address */ | 122 | /* Write the device SAS Address */ |
122 | writel(0xFEDCBA98, | 123 | writel(0xFEDCBA98, &llr->sas_device_name_high); |
123 | &iphy->link_layer_registers->sas_device_name_high); | 124 | writel(phy_idx, &llr->sas_device_name_low); |
124 | writel(phy_idx, &iphy->link_layer_registers->sas_device_name_low); | ||
125 | 125 | ||
126 | /* Write the source SAS Address */ | 126 | /* Write the source SAS Address */ |
127 | writel(phy_oem->sas_address.high, | 127 | writel(phy_oem->sas_address.high, &llr->source_sas_address_high); |
128 | &iphy->link_layer_registers->source_sas_address_high); | 128 | writel(phy_oem->sas_address.low, &llr->source_sas_address_low); |
129 | writel(phy_oem->sas_address.low, | ||
130 | &iphy->link_layer_registers->source_sas_address_low); | ||
131 | 129 | ||
132 | /* Clear and Set the PHY Identifier */ | 130 | /* Clear and Set the PHY Identifier */ |
133 | writel(0, &iphy->link_layer_registers->identify_frame_phy_id); | 131 | writel(0, &llr->identify_frame_phy_id); |
134 | writel(SCU_SAS_TIPID_GEN_VALUE(ID, phy_idx), | 132 | writel(SCU_SAS_TIPID_GEN_VALUE(ID, phy_idx), &llr->identify_frame_phy_id); |
135 | &iphy->link_layer_registers->identify_frame_phy_id); | ||
136 | 133 | ||
137 | /* Change the initial state of the phy configuration register */ | 134 | /* Change the initial state of the phy configuration register */ |
138 | phy_configuration = | 135 | phy_configuration = readl(&llr->phy_configuration); |
139 | readl(&iphy->link_layer_registers->phy_configuration); | ||
140 | 136 | ||
141 | /* Hold OOB state machine in reset */ | 137 | /* Hold OOB state machine in reset */ |
142 | phy_configuration |= SCU_SAS_PCFG_GEN_BIT(OOB_RESET); | 138 | phy_configuration |= SCU_SAS_PCFG_GEN_BIT(OOB_RESET); |
143 | writel(phy_configuration, | 139 | writel(phy_configuration, &llr->phy_configuration); |
144 | &iphy->link_layer_registers->phy_configuration); | ||
145 | 140 | ||
146 | /* Configure the SNW capabilities */ | 141 | /* Configure the SNW capabilities */ |
147 | phy_cap.all = 0; | 142 | phy_cap.all = 0; |
@@ -155,9 +150,9 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, | |||
155 | phy_cap.gen1_ssc = 1; | 150 | phy_cap.gen1_ssc = 1; |
156 | } | 151 | } |
157 | 152 | ||
158 | /* | 153 | /* The SAS specification indicates that the phy_capabilities that |
159 | * The SAS specification indicates that the phy_capabilities that | 154 | * are transmitted shall have an even parity. Calculate the parity. |
160 | * are transmitted shall have an even parity. Calculate the parity. */ | 155 | */ |
161 | parity_check = phy_cap.all; | 156 | parity_check = phy_cap.all; |
162 | while (parity_check != 0) { | 157 | while (parity_check != 0) { |
163 | if (parity_check & 0x1) | 158 | if (parity_check & 0x1) |
@@ -165,20 +160,20 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, | |||
165 | parity_check >>= 1; | 160 | parity_check >>= 1; |
166 | } | 161 | } |
167 | 162 | ||
168 | /* | 163 | /* If parity indicates there are an odd number of bits set, then |
169 | * If parity indicates there are an odd number of bits set, then | 164 | * set the parity bit to 1 in the phy capabilities. |
170 | * set the parity bit to 1 in the phy capabilities. */ | 165 | */ |
171 | if ((parity_count % 2) != 0) | 166 | if ((parity_count % 2) != 0) |
172 | phy_cap.parity = 1; | 167 | phy_cap.parity = 1; |
173 | 168 | ||
174 | writel(phy_cap.all, &iphy->link_layer_registers->phy_capabilities); | 169 | writel(phy_cap.all, &llr->phy_capabilities); |
175 | 170 | ||
176 | /* Set the enable spinup period but disable the ability to send | 171 | /* Set the enable spinup period but disable the ability to send |
177 | * notify enable spinup | 172 | * notify enable spinup |
178 | */ | 173 | */ |
179 | writel(SCU_ENSPINUP_GEN_VAL(COUNT, | 174 | writel(SCU_ENSPINUP_GEN_VAL(COUNT, |
180 | phy_user->notify_enable_spin_up_insertion_frequency), | 175 | phy_user->notify_enable_spin_up_insertion_frequency), |
181 | &iphy->link_layer_registers->notify_enable_spinup_control); | 176 | &llr->notify_enable_spinup_control); |
182 | 177 | ||
183 | /* Write the ALIGN Insertion Ferequency for connected phy and | 178 | /* Write the ALIGN Insertion Ferequency for connected phy and |
184 | * inpendent of connected state | 179 | * inpendent of connected state |
@@ -189,11 +184,10 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, | |||
189 | clksm_value |= SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(GENERAL, | 184 | clksm_value |= SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(GENERAL, |
190 | phy_user->align_insertion_frequency); | 185 | phy_user->align_insertion_frequency); |
191 | 186 | ||
192 | writel(clksm_value, &iphy->link_layer_registers->clock_skew_management); | 187 | writel(clksm_value, &llr->clock_skew_management); |
193 | 188 | ||
194 | /* @todo Provide a way to write this register correctly */ | 189 | /* @todo Provide a way to write this register correctly */ |
195 | writel(0x02108421, | 190 | writel(0x02108421, &llr->afe_lookup_table_control); |
196 | &iphy->link_layer_registers->afe_lookup_table_control); | ||
197 | 191 | ||
198 | llctl = SCU_SAS_LLCTL_GEN_VAL(NO_OUTBOUND_TASK_TIMEOUT, | 192 | llctl = SCU_SAS_LLCTL_GEN_VAL(NO_OUTBOUND_TASK_TIMEOUT, |
199 | (u8)ihost->user_parameters.no_outbound_task_timeout); | 193 | (u8)ihost->user_parameters.no_outbound_task_timeout); |
@@ -210,9 +204,9 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, | |||
210 | break; | 204 | break; |
211 | } | 205 | } |
212 | llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate); | 206 | llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate); |
213 | writel(llctl, &iphy->link_layer_registers->link_layer_control); | 207 | writel(llctl, &llr->link_layer_control); |
214 | 208 | ||
215 | sp_timeouts = readl(&iphy->link_layer_registers->sas_phy_timeouts); | 209 | sp_timeouts = readl(&llr->sas_phy_timeouts); |
216 | 210 | ||
217 | /* Clear the default 0x36 (54us) RATE_CHANGE timeout value. */ | 211 | /* Clear the default 0x36 (54us) RATE_CHANGE timeout value. */ |
218 | sp_timeouts &= ~SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0xFF); | 212 | sp_timeouts &= ~SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0xFF); |
@@ -222,20 +216,23 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, | |||
222 | */ | 216 | */ |
223 | sp_timeouts |= SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0x3B); | 217 | sp_timeouts |= SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0x3B); |
224 | 218 | ||
225 | writel(sp_timeouts, &iphy->link_layer_registers->sas_phy_timeouts); | 219 | writel(sp_timeouts, &llr->sas_phy_timeouts); |
226 | 220 | ||
227 | if (is_a2(ihost->pdev)) { | 221 | if (is_a2(ihost->pdev)) { |
228 | /* Program the max ARB time for the PHY to 700us so we inter-operate with | 222 | /* Program the max ARB time for the PHY to 700us so we |
229 | * the PMC expander which shuts down PHYs if the expander PHY generates too | 223 | * inter-operate with the PMC expander which shuts down |
230 | * many breaks. This time value will guarantee that the initiator PHY will | 224 | * PHYs if the expander PHY generates too many breaks. |
231 | * generate the break. | 225 | * This time value will guarantee that the initiator PHY |
226 | * will generate the break. | ||
232 | */ | 227 | */ |
233 | writel(SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME, | 228 | writel(SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME, |
234 | &iphy->link_layer_registers->maximum_arbitration_wait_timer_timeout); | 229 | &llr->maximum_arbitration_wait_timer_timeout); |
235 | } | 230 | } |
236 | 231 | ||
237 | /* Disable link layer hang detection, rely on the OS timeout for I/O timeouts. */ | 232 | /* Disable link layer hang detection, rely on the OS timeout for |
238 | writel(0, &iphy->link_layer_registers->link_layer_hang_detection_timeout); | 233 | * I/O timeouts. |
234 | */ | ||
235 | writel(0, &llr->link_layer_hang_detection_timeout); | ||
239 | 236 | ||
240 | /* We can exit the initial state to the stopped state */ | 237 | /* We can exit the initial state to the stopped state */ |
241 | sci_change_state(&iphy->sm, SCI_PHY_STOPPED); | 238 | sci_change_state(&iphy->sm, SCI_PHY_STOPPED); |