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 /drivers/scsi/isci/host.c | |
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>
Diffstat (limited to 'drivers/scsi/isci/host.c')
-rw-r--r-- | drivers/scsi/isci/host.c | 107 |
1 files changed, 47 insertions, 60 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 | ||