diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-07-01 14:41:21 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:52 -0400 |
commit | dc00c8b6940aa10ab1ce6a4d10b1bfe7b848781b (patch) | |
tree | 2f62620a348a5f6635413db4f5a0725c248a222b /drivers/scsi | |
parent | 4e4dca3de9658f364d34924e072f2b64e5c3d267 (diff) |
isci: cleanup silicon revision detection
Perform checking per-pci device (even though all systems will only have
1 pci device in this generation), and delete support for silicon that
does not report a proper revision (i.e. A0).
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/isci/host.c | 31 | ||||
-rw-r--r-- | drivers/scsi/isci/host.h | 32 | ||||
-rw-r--r-- | drivers/scsi/isci/init.c | 33 | ||||
-rw-r--r-- | drivers/scsi/isci/phy.c | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/probe_roms.c | 6 |
5 files changed, 31 insertions, 73 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index b554ea271ba6..26072f1e9852 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -1886,6 +1886,7 @@ void sci_controller_power_control_queue_remove(struct isci_host *ihost, | |||
1886 | static void sci_controller_afe_initialization(struct isci_host *ihost) | 1886 | static void sci_controller_afe_initialization(struct isci_host *ihost) |
1887 | { | 1887 | { |
1888 | const struct sci_oem_params *oem = &ihost->oem_parameters; | 1888 | const struct sci_oem_params *oem = &ihost->oem_parameters; |
1889 | struct pci_dev *pdev = ihost->pdev; | ||
1889 | u32 afe_status; | 1890 | u32 afe_status; |
1890 | u32 phy_id; | 1891 | u32 phy_id; |
1891 | 1892 | ||
@@ -1893,7 +1894,7 @@ static void sci_controller_afe_initialization(struct isci_host *ihost) | |||
1893 | writel(0x0081000f, &ihost->scu_registers->afe.afe_dfx_master_control0); | 1894 | writel(0x0081000f, &ihost->scu_registers->afe.afe_dfx_master_control0); |
1894 | udelay(AFE_REGISTER_WRITE_DELAY); | 1895 | udelay(AFE_REGISTER_WRITE_DELAY); |
1895 | 1896 | ||
1896 | if (is_b0()) { | 1897 | if (is_b0(pdev)) { |
1897 | /* PM Rx Equalization Save, PM SPhy Rx Acknowledgement | 1898 | /* PM Rx Equalization Save, PM SPhy Rx Acknowledgement |
1898 | * Timer, PM Stagger Timer */ | 1899 | * Timer, PM Stagger Timer */ |
1899 | writel(0x0007BFFF, &ihost->scu_registers->afe.afe_pmsn_master_control2); | 1900 | writel(0x0007BFFF, &ihost->scu_registers->afe.afe_pmsn_master_control2); |
@@ -1901,17 +1902,15 @@ static void sci_controller_afe_initialization(struct isci_host *ihost) | |||
1901 | } | 1902 | } |
1902 | 1903 | ||
1903 | /* Configure bias currents to normal */ | 1904 | /* Configure bias currents to normal */ |
1904 | if (is_a0()) | 1905 | if (is_a2(pdev)) |
1905 | writel(0x00005500, &ihost->scu_registers->afe.afe_bias_control); | ||
1906 | else if (is_a2()) | ||
1907 | writel(0x00005A00, &ihost->scu_registers->afe.afe_bias_control); | 1906 | writel(0x00005A00, &ihost->scu_registers->afe.afe_bias_control); |
1908 | else if (is_b0() || is_c0()) | 1907 | else if (is_b0(pdev) || is_c0(pdev)) |
1909 | writel(0x00005F00, &ihost->scu_registers->afe.afe_bias_control); | 1908 | writel(0x00005F00, &ihost->scu_registers->afe.afe_bias_control); |
1910 | 1909 | ||
1911 | udelay(AFE_REGISTER_WRITE_DELAY); | 1910 | udelay(AFE_REGISTER_WRITE_DELAY); |
1912 | 1911 | ||
1913 | /* Enable PLL */ | 1912 | /* Enable PLL */ |
1914 | if (is_b0() || is_c0()) | 1913 | if (is_b0(pdev) || is_c0(pdev)) |
1915 | writel(0x80040A08, &ihost->scu_registers->afe.afe_pll_control0); | 1914 | writel(0x80040A08, &ihost->scu_registers->afe.afe_pll_control0); |
1916 | else | 1915 | else |
1917 | writel(0x80040908, &ihost->scu_registers->afe.afe_pll_control0); | 1916 | writel(0x80040908, &ihost->scu_registers->afe.afe_pll_control0); |
@@ -1924,7 +1923,7 @@ static void sci_controller_afe_initialization(struct isci_host *ihost) | |||
1924 | udelay(AFE_REGISTER_WRITE_DELAY); | 1923 | udelay(AFE_REGISTER_WRITE_DELAY); |
1925 | } while ((afe_status & 0x00001000) == 0); | 1924 | } while ((afe_status & 0x00001000) == 0); |
1926 | 1925 | ||
1927 | if (is_a0() || is_a2()) { | 1926 | if (is_a2(pdev)) { |
1928 | /* Shorten SAS SNW lock time (RxLock timer value from 76 us to 50 us) */ | 1927 | /* Shorten SAS SNW lock time (RxLock timer value from 76 us to 50 us) */ |
1929 | writel(0x7bcc96ad, &ihost->scu_registers->afe.afe_pmsn_master_control0); | 1928 | writel(0x7bcc96ad, &ihost->scu_registers->afe.afe_pmsn_master_control0); |
1930 | udelay(AFE_REGISTER_WRITE_DELAY); | 1929 | udelay(AFE_REGISTER_WRITE_DELAY); |
@@ -1933,11 +1932,11 @@ static void sci_controller_afe_initialization(struct isci_host *ihost) | |||
1933 | for (phy_id = 0; phy_id < SCI_MAX_PHYS; phy_id++) { | 1932 | for (phy_id = 0; phy_id < SCI_MAX_PHYS; phy_id++) { |
1934 | const struct sci_phy_oem_params *oem_phy = &oem->phys[phy_id]; | 1933 | const struct sci_phy_oem_params *oem_phy = &oem->phys[phy_id]; |
1935 | 1934 | ||
1936 | if (is_b0()) { | 1935 | if (is_b0(pdev)) { |
1937 | /* Configure transmitter SSC parameters */ | 1936 | /* Configure transmitter SSC parameters */ |
1938 | writel(0x00030000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); | 1937 | writel(0x00030000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); |
1939 | udelay(AFE_REGISTER_WRITE_DELAY); | 1938 | udelay(AFE_REGISTER_WRITE_DELAY); |
1940 | } else if (is_c0()) { | 1939 | } else if (is_c0(pdev)) { |
1941 | /* Configure transmitter SSC parameters */ | 1940 | /* Configure transmitter SSC parameters */ |
1942 | writel(0x0003000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); | 1941 | writel(0x0003000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); |
1943 | udelay(AFE_REGISTER_WRITE_DELAY); | 1942 | udelay(AFE_REGISTER_WRITE_DELAY); |
@@ -1961,11 +1960,9 @@ static void sci_controller_afe_initialization(struct isci_host *ihost) | |||
1961 | /* | 1960 | /* |
1962 | * Power up TX and RX out from power down (PWRDNTX and PWRDNRX) | 1961 | * Power up TX and RX out from power down (PWRDNTX and PWRDNRX) |
1963 | * & increase TX int & ext bias 20%....(0xe85c) */ | 1962 | * & increase TX int & ext bias 20%....(0xe85c) */ |
1964 | if (is_a0()) | 1963 | if (is_a2(pdev)) |
1965 | writel(0x000003D4, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); | ||
1966 | else if (is_a2()) | ||
1967 | writel(0x000003F0, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); | 1964 | writel(0x000003F0, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); |
1968 | else if (is_b0()) { | 1965 | else if (is_b0(pdev)) { |
1969 | /* Power down TX and RX (PWRDNTX and PWRDNRX) */ | 1966 | /* Power down TX and RX (PWRDNTX and PWRDNRX) */ |
1970 | writel(0x000003D7, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); | 1967 | writel(0x000003D7, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); |
1971 | udelay(AFE_REGISTER_WRITE_DELAY); | 1968 | udelay(AFE_REGISTER_WRITE_DELAY); |
@@ -1985,7 +1982,7 @@ static void sci_controller_afe_initialization(struct isci_host *ihost) | |||
1985 | } | 1982 | } |
1986 | udelay(AFE_REGISTER_WRITE_DELAY); | 1983 | udelay(AFE_REGISTER_WRITE_DELAY); |
1987 | 1984 | ||
1988 | if (is_a0() || is_a2()) { | 1985 | if (is_a2(pdev)) { |
1989 | /* Enable TX equalization (0xe824) */ | 1986 | /* Enable TX equalization (0xe824) */ |
1990 | writel(0x00040000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); | 1987 | writel(0x00040000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); |
1991 | udelay(AFE_REGISTER_WRITE_DELAY); | 1988 | udelay(AFE_REGISTER_WRITE_DELAY); |
@@ -1998,11 +1995,9 @@ static void sci_controller_afe_initialization(struct isci_host *ihost) | |||
1998 | udelay(AFE_REGISTER_WRITE_DELAY); | 1995 | udelay(AFE_REGISTER_WRITE_DELAY); |
1999 | 1996 | ||
2000 | /* Leave DFE/FFE on */ | 1997 | /* Leave DFE/FFE on */ |
2001 | if (is_a0()) | 1998 | if (is_a2(pdev)) |
2002 | writel(0x3F09983F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); | ||
2003 | else if (is_a2()) | ||
2004 | writel(0x3F11103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); | 1999 | writel(0x3F11103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); |
2005 | else if (is_b0()) { | 2000 | else if (is_b0(pdev)) { |
2006 | writel(0x3F11103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); | 2001 | writel(0x3F11103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); |
2007 | udelay(AFE_REGISTER_WRITE_DELAY); | 2002 | udelay(AFE_REGISTER_WRITE_DELAY); |
2008 | /* Enable TX equalization (0xe824) */ | 2003 | /* Enable TX equalization (0xe824) */ |
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h index ec0bba5367ba..062101a39f79 100644 --- a/drivers/scsi/isci/host.h +++ b/drivers/scsi/isci/host.h | |||
@@ -416,33 +416,25 @@ static inline struct device *scirdev_to_dev(struct isci_remote_device *idev) | |||
416 | return &idev->isci_port->isci_host->pdev->dev; | 416 | return &idev->isci_port->isci_host->pdev->dev; |
417 | } | 417 | } |
418 | 418 | ||
419 | enum { | 419 | static inline bool is_a2(struct pci_dev *pdev) |
420 | ISCI_SI_REVA0, | ||
421 | ISCI_SI_REVA2, | ||
422 | ISCI_SI_REVB0, | ||
423 | ISCI_SI_REVC0 | ||
424 | }; | ||
425 | |||
426 | extern int isci_si_rev; | ||
427 | |||
428 | static inline bool is_a0(void) | ||
429 | { | ||
430 | return isci_si_rev == ISCI_SI_REVA0; | ||
431 | } | ||
432 | |||
433 | static inline bool is_a2(void) | ||
434 | { | 420 | { |
435 | return isci_si_rev == ISCI_SI_REVA2; | 421 | if (pdev->revision < 4) |
422 | return true; | ||
423 | return false; | ||
436 | } | 424 | } |
437 | 425 | ||
438 | static inline bool is_b0(void) | 426 | static inline bool is_b0(struct pci_dev *pdev) |
439 | { | 427 | { |
440 | return isci_si_rev == ISCI_SI_REVB0; | 428 | if (pdev->revision == 4) |
429 | return true; | ||
430 | return false; | ||
441 | } | 431 | } |
442 | 432 | ||
443 | static inline bool is_c0(void) | 433 | static inline bool is_c0(struct pci_dev *pdev) |
444 | { | 434 | { |
445 | return isci_si_rev > ISCI_SI_REVB0; | 435 | if (pdev->revision >= 5) |
436 | return true; | ||
437 | return false; | ||
446 | } | 438 | } |
447 | 439 | ||
448 | void sci_controller_post_request(struct isci_host *ihost, | 440 | void sci_controller_post_request(struct isci_host *ihost, |
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c index 8d9a8bfff4d5..61e0d09e2b57 100644 --- a/drivers/scsi/isci/init.c +++ b/drivers/scsi/isci/init.c | |||
@@ -85,10 +85,6 @@ MODULE_DEVICE_TABLE(pci, isci_id_table); | |||
85 | 85 | ||
86 | /* linux isci specific settings */ | 86 | /* linux isci specific settings */ |
87 | 87 | ||
88 | int isci_si_rev = ISCI_SI_REVA2; | ||
89 | module_param(isci_si_rev, int, 0); | ||
90 | MODULE_PARM_DESC(isci_si_rev, "(deprecated) override default si rev (0: A0 1: A2 2: B0)"); | ||
91 | |||
92 | unsigned char no_outbound_task_to = 20; | 88 | unsigned char no_outbound_task_to = 20; |
93 | module_param(no_outbound_task_to, byte, 0); | 89 | module_param(no_outbound_task_to, byte, 0); |
94 | MODULE_PARM_DESC(no_outbound_task_to, "No Outbound Task Timeout (1us incr)"); | 90 | MODULE_PARM_DESC(no_outbound_task_to, "No Outbound Task Timeout (1us incr)"); |
@@ -435,32 +431,6 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id) | |||
435 | return NULL; | 431 | return NULL; |
436 | } | 432 | } |
437 | 433 | ||
438 | static void check_si_rev(struct pci_dev *pdev) | ||
439 | { | ||
440 | switch (pdev->revision) { | ||
441 | case 0: | ||
442 | case 1: | ||
443 | /* if the id is ambiguous don't update isci_si_rev */ | ||
444 | break; | ||
445 | case 3: | ||
446 | isci_si_rev = ISCI_SI_REVA2; | ||
447 | break; | ||
448 | case 4: | ||
449 | isci_si_rev = ISCI_SI_REVB0; | ||
450 | break; | ||
451 | default: | ||
452 | case 5: | ||
453 | isci_si_rev = ISCI_SI_REVC0; | ||
454 | break; | ||
455 | } | ||
456 | |||
457 | dev_info(&pdev->dev, "driver configured for %s silicon (rev: %d)\n", | ||
458 | isci_si_rev == ISCI_SI_REVA0 ? "A0" : | ||
459 | isci_si_rev == ISCI_SI_REVA2 ? "A2" : | ||
460 | isci_si_rev == ISCI_SI_REVB0 ? "B0" : "C0", pdev->revision); | ||
461 | |||
462 | } | ||
463 | |||
464 | static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 434 | static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
465 | { | 435 | { |
466 | struct isci_pci_info *pci_info; | 436 | struct isci_pci_info *pci_info; |
@@ -470,7 +440,8 @@ static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_devic | |||
470 | struct isci_orom *orom = NULL; | 440 | struct isci_orom *orom = NULL; |
471 | char *source = "(platform)"; | 441 | char *source = "(platform)"; |
472 | 442 | ||
473 | check_si_rev(pdev); | 443 | dev_info(&pdev->dev, "driver configured for rev: %d silicon\n", |
444 | pdev->revision); | ||
474 | 445 | ||
475 | pci_info = devm_kzalloc(&pdev->dev, sizeof(*pci_info), GFP_KERNEL); | 446 | pci_info = devm_kzalloc(&pdev->dev, sizeof(*pci_info), GFP_KERNEL); |
476 | if (!pci_info) | 447 | if (!pci_info) |
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index e56080af78f4..d8f893ee7d03 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c | |||
@@ -211,7 +211,7 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, | |||
211 | llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate); | 211 | llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate); |
212 | writel(llctl, &iphy->link_layer_registers->link_layer_control); | 212 | writel(llctl, &iphy->link_layer_registers->link_layer_control); |
213 | 213 | ||
214 | if (is_a0() || is_a2()) { | 214 | if (is_a2(ihost->pdev)) { |
215 | /* Program the max ARB time for the PHY to 700us so we inter-operate with | 215 | /* Program the max ARB time for the PHY to 700us so we inter-operate with |
216 | * the PMC expander which shuts down PHYs if the expander PHY generates too | 216 | * the PMC expander which shuts down PHYs if the expander PHY generates too |
217 | * many breaks. This time value will guarantee that the initiator PHY will | 217 | * many breaks. This time value will guarantee that the initiator PHY will |
diff --git a/drivers/scsi/isci/probe_roms.c b/drivers/scsi/isci/probe_roms.c index c7732fb28889..4b9d813c63b1 100644 --- a/drivers/scsi/isci/probe_roms.c +++ b/drivers/scsi/isci/probe_roms.c | |||
@@ -146,13 +146,13 @@ struct isci_orom *isci_request_firmware(struct pci_dev *pdev, const struct firmw | |||
146 | 146 | ||
147 | memcpy(orom, fw->data, fw->size); | 147 | memcpy(orom, fw->data, fw->size); |
148 | 148 | ||
149 | if (is_c0(pdev)) | ||
150 | goto out; | ||
151 | |||
149 | /* | 152 | /* |
150 | * deprecated: override default amp_control for pre-preproduction | 153 | * deprecated: override default amp_control for pre-preproduction |
151 | * silicon revisions | 154 | * silicon revisions |
152 | */ | 155 | */ |
153 | if (isci_si_rev <= ISCI_SI_REVB0) | ||
154 | goto out; | ||
155 | |||
156 | for (i = 0; i < ARRAY_SIZE(orom->ctrl); i++) | 156 | for (i = 0; i < ARRAY_SIZE(orom->ctrl); i++) |
157 | for (j = 0; j < ARRAY_SIZE(orom->ctrl[i].phys); j++) { | 157 | for (j = 0; j < ARRAY_SIZE(orom->ctrl[i].phys); j++) { |
158 | orom->ctrl[i].phys[j].afe_tx_amp_control0 = 0xe7c03; | 158 | orom->ctrl[i].phys[j].afe_tx_amp_control0 = 0xe7c03; |