diff options
Diffstat (limited to 'drivers/scsi/isci/host.c')
-rw-r--r-- | drivers/scsi/isci/host.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index ed1441c89577..9a52b984620f 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -1666,6 +1666,9 @@ static void sci_controller_set_default_config_parameters(struct isci_host *ihost | |||
1666 | /* Default to no SSC operation. */ | 1666 | /* Default to no SSC operation. */ |
1667 | ihost->oem_parameters.controller.do_enable_ssc = false; | 1667 | ihost->oem_parameters.controller.do_enable_ssc = false; |
1668 | 1668 | ||
1669 | /* Default to short cables on all phys. */ | ||
1670 | ihost->oem_parameters.controller.cable_selection_mask = 0; | ||
1671 | |||
1669 | /* Initialize all of the port parameter information to narrow ports. */ | 1672 | /* Initialize all of the port parameter information to narrow ports. */ |
1670 | for (index = 0; index < SCI_MAX_PORTS; index++) { | 1673 | for (index = 0; index < SCI_MAX_PORTS; index++) { |
1671 | ihost->oem_parameters.ports[index].phy_mask = 0; | 1674 | ihost->oem_parameters.ports[index].phy_mask = 0; |
@@ -1953,12 +1956,46 @@ void sci_controller_power_control_queue_remove(struct isci_host *ihost, | |||
1953 | 1956 | ||
1954 | static int is_long_cable(int phy, unsigned char selection_byte) | 1957 | static int is_long_cable(int phy, unsigned char selection_byte) |
1955 | { | 1958 | { |
1956 | return 0; | 1959 | return !!(selection_byte & (1 << phy)); |
1957 | } | 1960 | } |
1958 | 1961 | ||
1959 | static int is_medium_cable(int phy, unsigned char selection_byte) | 1962 | static int is_medium_cable(int phy, unsigned char selection_byte) |
1960 | { | 1963 | { |
1961 | return 0; | 1964 | return !!(selection_byte & (1 << (phy + 4))); |
1965 | } | ||
1966 | |||
1967 | static enum cable_selections decode_selection_byte( | ||
1968 | int phy, | ||
1969 | unsigned char selection_byte) | ||
1970 | { | ||
1971 | return ((selection_byte & (1 << phy)) ? 1 : 0) | ||
1972 | + (selection_byte & (1 << (phy + 4)) ? 2 : 0); | ||
1973 | } | ||
1974 | |||
1975 | static unsigned char *to_cable_select(struct isci_host *ihost) | ||
1976 | { | ||
1977 | if (is_cable_select_overridden()) | ||
1978 | return ((unsigned char *)&cable_selection_override) | ||
1979 | + ihost->id; | ||
1980 | else | ||
1981 | return &ihost->oem_parameters.controller.cable_selection_mask; | ||
1982 | } | ||
1983 | |||
1984 | enum cable_selections decode_cable_selection(struct isci_host *ihost, int phy) | ||
1985 | { | ||
1986 | return decode_selection_byte(phy, *to_cable_select(ihost)); | ||
1987 | } | ||
1988 | |||
1989 | char *lookup_cable_names(enum cable_selections selection) | ||
1990 | { | ||
1991 | static char *cable_names[] = { | ||
1992 | [short_cable] = "short", | ||
1993 | [long_cable] = "long", | ||
1994 | [medium_cable] = "medium", | ||
1995 | [undefined_cable] = "<undefined, assumed long>" /* bit 0==1 */ | ||
1996 | }; | ||
1997 | return (selection <= undefined_cable) ? cable_names[selection] | ||
1998 | : cable_names[undefined_cable]; | ||
1962 | } | 1999 | } |
1963 | 2000 | ||
1964 | #define AFE_REGISTER_WRITE_DELAY 10 | 2001 | #define AFE_REGISTER_WRITE_DELAY 10 |
@@ -1967,10 +2004,10 @@ static void sci_controller_afe_initialization(struct isci_host *ihost) | |||
1967 | { | 2004 | { |
1968 | struct scu_afe_registers __iomem *afe = &ihost->scu_registers->afe; | 2005 | struct scu_afe_registers __iomem *afe = &ihost->scu_registers->afe; |
1969 | const struct sci_oem_params *oem = &ihost->oem_parameters; | 2006 | const struct sci_oem_params *oem = &ihost->oem_parameters; |
1970 | unsigned char cable_selection_mask = 0; | ||
1971 | struct pci_dev *pdev = ihost->pdev; | 2007 | struct pci_dev *pdev = ihost->pdev; |
1972 | u32 afe_status; | 2008 | u32 afe_status; |
1973 | u32 phy_id; | 2009 | u32 phy_id; |
2010 | unsigned char cable_selection_mask = *to_cable_select(ihost); | ||
1974 | 2011 | ||
1975 | /* Clear DFX Status registers */ | 2012 | /* Clear DFX Status registers */ |
1976 | writel(0x0081000f, &afe->afe_dfx_master_control0); | 2013 | writel(0x0081000f, &afe->afe_dfx_master_control0); |