@@ -975,44 +975,43 @@ int ahci_reset_controller(struct ata_host *host)
975975 void __iomem * mmio = hpriv -> mmio ;
976976 u32 tmp ;
977977
978- /* we must be in AHCI mode, before using anything
979- * AHCI-specific, such as HOST_RESET.
978+ /*
979+ * We must be in AHCI mode, before using anything AHCI-specific, such
980+ * as HOST_RESET.
980981 */
981982 ahci_enable_ahci (mmio );
982983
983- /* global controller reset */
984- if (!ahci_skip_host_reset ) {
985- tmp = readl (mmio + HOST_CTL );
986- if ((tmp & HOST_RESET ) == 0 ) {
987- writel (tmp | HOST_RESET , mmio + HOST_CTL );
988- readl (mmio + HOST_CTL ); /* flush */
989- }
984+ /* Global controller reset */
985+ if (ahci_skip_host_reset ) {
986+ dev_info (host -> dev , "Skipping global host reset\n" );
987+ return 0 ;
988+ }
990989
991- /*
992- * to perform host reset, OS should set HOST_RESET
993- * and poll until this bit is read to be "0".
994- * reset must complete within 1 second, or
995- * the hardware should be considered fried.
996- */
997- tmp = ata_wait_register (NULL , mmio + HOST_CTL , HOST_RESET ,
998- HOST_RESET , 10 , 1000 );
990+ tmp = readl (mmio + HOST_CTL );
991+ if (!(tmp & HOST_RESET )) {
992+ writel (tmp | HOST_RESET , mmio + HOST_CTL );
993+ readl (mmio + HOST_CTL ); /* flush */
994+ }
999995
1000- if (tmp & HOST_RESET ) {
1001- dev_err (host -> dev , "controller reset failed (0x%x)\n" ,
1002- tmp );
1003- return - EIO ;
1004- }
996+ /*
997+ * To perform host reset, OS should set HOST_RESET and poll until this
998+ * bit is read to be "0". Reset must complete within 1 second, or the
999+ * hardware should be considered fried.
1000+ */
1001+ tmp = ata_wait_register (NULL , mmio + HOST_CTL , HOST_RESET ,
1002+ HOST_RESET , 10 , 1000 );
1003+ if (tmp & HOST_RESET ) {
1004+ dev_err (host -> dev , "Controller reset failed (0x%x)\n" ,
1005+ tmp );
1006+ return - EIO ;
1007+ }
10051008
1006- /* turn on AHCI mode */
1007- ahci_enable_ahci (mmio );
1009+ /* Turn on AHCI mode */
1010+ ahci_enable_ahci (mmio );
10081011
1009- /* Some registers might be cleared on reset. Restore
1010- * initial values.
1011- */
1012- if (!(hpriv -> flags & AHCI_HFLAG_NO_WRITE_TO_RO ))
1013- ahci_restore_initial_config (host );
1014- } else
1015- dev_info (host -> dev , "skipping global host reset\n" );
1012+ /* Some registers might be cleared on reset. Restore initial values. */
1013+ if (!(hpriv -> flags & AHCI_HFLAG_NO_WRITE_TO_RO ))
1014+ ahci_restore_initial_config (host );
10161015
10171016 return 0 ;
10181017}
0 commit comments