Re: [PATCH 7/8] pm80xx: wait a minimum of 500ms before issuing commands to SPCv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2015-10-30 15:53 GMT+01:00 Benjamin Rood <benjaminjrood@xxxxxxxxx>:
> The documentation for the 8070 and 8072 SPCv chip explicitly states that
> a minimum of 500ms must elapse before issuing commands, otherwise the
> SPCv may not process them and the firmware may get into an unrecoverable
> state requiring a reboot.  While the Linux guys will probably think this
> is 'racy', it is called out in the chip documentation and inserting this
> delay makes power management function properly.
>
> Signed-off-by: Benjamin Rood <brood@xxxxxxxxxxxx>
> ---
>  drivers/scsi/pm8001/pm8001_init.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
> index a0e55d4..ab99984 100644
> --- a/drivers/scsi/pm8001/pm8001_init.c
> +++ b/drivers/scsi/pm8001/pm8001_init.c
> @@ -1190,6 +1190,7 @@ static int pm8001_pci_resume(struct pci_dev *pdev)
>         int rc;
>         u8 i = 0, j;
>         u32 device_state;
> +       u32 wait_count;
>         DECLARE_COMPLETION_ONSTACK(completion);
>         pm8001_ha = sha->lldd_ha;
>         device_state = pdev->current_state;
> @@ -1243,6 +1244,17 @@ static int pm8001_pci_resume(struct pci_dev *pdev)
>                 for (i = 1; i < pm8001_ha->number_of_intr; i++)
>                         PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, i);
>         }
> +
> +       if (pm8001_ha->chip_id == chip_8070 ||
> +               pm8001_ha->chip_id == chip_8072) {
> +               wait_count = 500;
> +               do {
> +                       mdelay(1);
> +               } while (--wait_count);
> +       }
> +
> +       /* Spin up the PHYs */
> +
>         pm8001_ha->flags = PM8001F_RUN_TIME;
>         for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
>                 pm8001_ha->phy[i].enable_completion = &completion;
> --
> 2.4.3
>
Could we simply mdelay(500) instead the loop?
Also better to add a comment around.

Thanks,
Jack
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux