aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_os.c
diff options
context:
space:
mode:
authorHimanshu Madhani <himanshu.madhani@qlogic.com>2014-09-25 05:16:55 -0400
committerChristoph Hellwig <hch@lst.de>2014-09-25 08:25:04 -0400
commit2d5a4c344ad35eaaab59a5079eb6c62a843fb9d6 (patch)
tree6041dfa969231bf11cf53c51ea8ea1bce3dcf031 /drivers/scsi/qla2xxx/qla_os.c
parent25232cc9b8eca0406f51e61e944e854ed021a9d7 (diff)
qla2xxx: Disable laser for ISP2031 while unloading driver.
Nameserver data on FC switch is not refreshed when qla2xxx driver is unloaded. Disabling laser for ISP2031 will force FC switch to rescan ports and clear fdmi entries from Nameserver. Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 72b94f9ca637..e742890d5d1b 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -240,6 +240,7 @@ static int qla2x00_change_queue_depth(struct scsi_device *, int, int);
240static int qla2x00_change_queue_type(struct scsi_device *, int); 240static int qla2x00_change_queue_type(struct scsi_device *, int);
241static void qla2x00_clear_drv_active(struct qla_hw_data *); 241static void qla2x00_clear_drv_active(struct qla_hw_data *);
242static void qla2x00_free_device(scsi_qla_host_t *); 242static void qla2x00_free_device(scsi_qla_host_t *);
243static void qla83xx_disable_laser(scsi_qla_host_t *vha);
243 244
244struct scsi_host_template qla2xxx_driver_template = { 245struct scsi_host_template qla2xxx_driver_template = {
245 .module = THIS_MODULE, 246 .module = THIS_MODULE,
@@ -3177,6 +3178,10 @@ qla2x00_remove_one(struct pci_dev *pdev)
3177 3178
3178 qla84xx_put_chip(base_vha); 3179 qla84xx_put_chip(base_vha);
3179 3180
3181 /* Laser should be disabled only for ISP2031 */
3182 if (IS_QLA2031(ha))
3183 qla83xx_disable_laser(base_vha);
3184
3180 /* Disable timer */ 3185 /* Disable timer */
3181 if (base_vha->timer_active) 3186 if (base_vha->timer_active)
3182 qla2x00_stop_timer(base_vha); 3187 qla2x00_stop_timer(base_vha);
@@ -5701,6 +5706,32 @@ qla2xxx_pci_resume(struct pci_dev *pdev)
5701 ha->flags.eeh_busy = 0; 5706 ha->flags.eeh_busy = 0;
5702} 5707}
5703 5708
5709static void
5710qla83xx_disable_laser(scsi_qla_host_t *vha)
5711{
5712 uint32_t reg, data, fn;
5713 struct qla_hw_data *ha = vha->hw;
5714 struct device_reg_24xx __iomem *isp_reg = &ha->iobase->isp24;
5715
5716 /* pci func #/port # */
5717 ql_dbg(ql_dbg_init, vha, 0x004b,
5718 "Disabling Laser for hba: %p\n", vha);
5719
5720 fn = (RD_REG_DWORD(&isp_reg->ctrl_status) &
5721 (BIT_15|BIT_14|BIT_13|BIT_12));
5722
5723 fn = (fn >> 12);
5724
5725 if (fn & 1)
5726 reg = PORT_1_2031;
5727 else
5728 reg = PORT_0_2031;
5729
5730 data = LASER_OFF_2031;
5731
5732 qla83xx_wr_reg(vha, reg, data);
5733}
5734
5704static const struct pci_error_handlers qla2xxx_err_handler = { 5735static const struct pci_error_handlers qla2xxx_err_handler = {
5705 .error_detected = qla2xxx_pci_error_detected, 5736 .error_detected = qla2xxx_pci_error_detected,
5706 .mmio_enabled = qla2xxx_pci_mmio_enabled, 5737 .mmio_enabled = qla2xxx_pci_mmio_enabled,