diff options
author | Deepak Ukey <deepak.ukey@microchip.com> | 2018-09-11 04:48:02 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-09-11 21:13:08 -0400 |
commit | cd135754d837bc4b15a9211d30bfc23f2247afb9 (patch) | |
tree | 9443a9c827b0e13c9d79d0730927ab78f1c74305 /drivers/scsi/pm8001/pm8001_sas.c | |
parent | 0b1b1d88614fcd90c65d27dbd14490dcbf2c9b5f (diff) |
scsi: pm80xx: Fix for phy enable/disable functionality
Added proper mask for phy id in mpi_phy_stop_resp().
Signed-off-by: Deepak Ukey <deepak.ukey@microchip.com>
Signed-off-by: Viswas G <Viswas.G@microchip.com>
Acked-by: Jack Wang <jinpu.wang@profitbricks.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/pm8001/pm8001_sas.c')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_sas.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index 947d6017d004..d8249675371e 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c | |||
@@ -157,9 +157,12 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, | |||
157 | int rc = 0, phy_id = sas_phy->id; | 157 | int rc = 0, phy_id = sas_phy->id; |
158 | struct pm8001_hba_info *pm8001_ha = NULL; | 158 | struct pm8001_hba_info *pm8001_ha = NULL; |
159 | struct sas_phy_linkrates *rates; | 159 | struct sas_phy_linkrates *rates; |
160 | struct sas_ha_struct *sas_ha; | ||
161 | struct pm8001_phy *phy; | ||
160 | DECLARE_COMPLETION_ONSTACK(completion); | 162 | DECLARE_COMPLETION_ONSTACK(completion); |
161 | unsigned long flags; | 163 | unsigned long flags; |
162 | pm8001_ha = sas_phy->ha->lldd_ha; | 164 | pm8001_ha = sas_phy->ha->lldd_ha; |
165 | phy = &pm8001_ha->phy[phy_id]; | ||
163 | pm8001_ha->phy[phy_id].enable_completion = &completion; | 166 | pm8001_ha->phy[phy_id].enable_completion = &completion; |
164 | switch (func) { | 167 | switch (func) { |
165 | case PHY_FUNC_SET_LINK_RATE: | 168 | case PHY_FUNC_SET_LINK_RATE: |
@@ -172,7 +175,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, | |||
172 | pm8001_ha->phy[phy_id].maximum_linkrate = | 175 | pm8001_ha->phy[phy_id].maximum_linkrate = |
173 | rates->maximum_linkrate; | 176 | rates->maximum_linkrate; |
174 | } | 177 | } |
175 | if (pm8001_ha->phy[phy_id].phy_state == 0) { | 178 | if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_DISABLE) { |
176 | PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); | 179 | PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); |
177 | wait_for_completion(&completion); | 180 | wait_for_completion(&completion); |
178 | } | 181 | } |
@@ -180,7 +183,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, | |||
180 | PHY_LINK_RESET); | 183 | PHY_LINK_RESET); |
181 | break; | 184 | break; |
182 | case PHY_FUNC_HARD_RESET: | 185 | case PHY_FUNC_HARD_RESET: |
183 | if (pm8001_ha->phy[phy_id].phy_state == 0) { | 186 | if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_DISABLE) { |
184 | PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); | 187 | PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); |
185 | wait_for_completion(&completion); | 188 | wait_for_completion(&completion); |
186 | } | 189 | } |
@@ -188,7 +191,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, | |||
188 | PHY_HARD_RESET); | 191 | PHY_HARD_RESET); |
189 | break; | 192 | break; |
190 | case PHY_FUNC_LINK_RESET: | 193 | case PHY_FUNC_LINK_RESET: |
191 | if (pm8001_ha->phy[phy_id].phy_state == 0) { | 194 | if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_DISABLE) { |
192 | PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); | 195 | PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); |
193 | wait_for_completion(&completion); | 196 | wait_for_completion(&completion); |
194 | } | 197 | } |
@@ -200,6 +203,25 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, | |||
200 | PHY_LINK_RESET); | 203 | PHY_LINK_RESET); |
201 | break; | 204 | break; |
202 | case PHY_FUNC_DISABLE: | 205 | case PHY_FUNC_DISABLE: |
206 | if (pm8001_ha->chip_id != chip_8001) { | ||
207 | if (pm8001_ha->phy[phy_id].phy_state == | ||
208 | PHY_STATE_LINK_UP_SPCV) { | ||
209 | sas_ha = pm8001_ha->sas; | ||
210 | sas_phy_disconnected(&phy->sas_phy); | ||
211 | sas_ha->notify_phy_event(&phy->sas_phy, | ||
212 | PHYE_LOSS_OF_SIGNAL); | ||
213 | phy->phy_attached = 0; | ||
214 | } | ||
215 | } else { | ||
216 | if (pm8001_ha->phy[phy_id].phy_state == | ||
217 | PHY_STATE_LINK_UP_SPC) { | ||
218 | sas_ha = pm8001_ha->sas; | ||
219 | sas_phy_disconnected(&phy->sas_phy); | ||
220 | sas_ha->notify_phy_event(&phy->sas_phy, | ||
221 | PHYE_LOSS_OF_SIGNAL); | ||
222 | phy->phy_attached = 0; | ||
223 | } | ||
224 | } | ||
203 | PM8001_CHIP_DISP->phy_stop_req(pm8001_ha, phy_id); | 225 | PM8001_CHIP_DISP->phy_stop_req(pm8001_ha, phy_id); |
204 | break; | 226 | break; |
205 | case PHY_FUNC_GET_EVENTS: | 227 | case PHY_FUNC_GET_EVENTS: |