@@ -721,30 +721,41 @@ static int reset_hw_v2_hw(struct hisi_hba *hisi_hba)
721721 return - EIO ;
722722 }
723723
724- /* reset and disable clock*/
725- regmap_write (hisi_hba -> ctrl , hisi_hba -> ctrl_reset_reg ,
726- reset_val );
727- regmap_write (hisi_hba -> ctrl , hisi_hba -> ctrl_clock_ena_reg + 4 ,
728- reset_val );
729- msleep (1 );
730- regmap_read (hisi_hba -> ctrl , hisi_hba -> ctrl_reset_sts_reg , & val );
731- if (reset_val != (val & reset_val )) {
732- dev_err (dev , "SAS reset fail.\n" );
733- return - EIO ;
734- }
724+ if (ACPI_HANDLE (dev )) {
725+ acpi_status s ;
735726
736- /* De-reset and enable clock*/
737- regmap_write (hisi_hba -> ctrl , hisi_hba -> ctrl_reset_reg + 4 ,
738- reset_val );
739- regmap_write (hisi_hba -> ctrl , hisi_hba -> ctrl_clock_ena_reg ,
740- reset_val );
741- msleep (1 );
742- regmap_read (hisi_hba -> ctrl , hisi_hba -> ctrl_reset_sts_reg ,
743- & val );
744- if (val & reset_val ) {
745- dev_err (dev , "SAS de-reset fail.\n" );
746- return - EIO ;
747- }
727+ s = acpi_evaluate_object (ACPI_HANDLE (dev ), "_RST" , NULL , NULL );
728+ if (ACPI_FAILURE (s )) {
729+ dev_err (dev , "Reset failed\n" );
730+ return - EIO ;
731+ }
732+ } else if (hisi_hba -> ctrl ) {
733+ /* reset and disable clock*/
734+ regmap_write (hisi_hba -> ctrl , hisi_hba -> ctrl_reset_reg ,
735+ reset_val );
736+ regmap_write (hisi_hba -> ctrl , hisi_hba -> ctrl_clock_ena_reg + 4 ,
737+ reset_val );
738+ msleep (1 );
739+ regmap_read (hisi_hba -> ctrl , hisi_hba -> ctrl_reset_sts_reg , & val );
740+ if (reset_val != (val & reset_val )) {
741+ dev_err (dev , "SAS reset fail.\n" );
742+ return - EIO ;
743+ }
744+
745+ /* De-reset and enable clock*/
746+ regmap_write (hisi_hba -> ctrl , hisi_hba -> ctrl_reset_reg + 4 ,
747+ reset_val );
748+ regmap_write (hisi_hba -> ctrl , hisi_hba -> ctrl_clock_ena_reg ,
749+ reset_val );
750+ msleep (1 );
751+ regmap_read (hisi_hba -> ctrl , hisi_hba -> ctrl_reset_sts_reg ,
752+ & val );
753+ if (val & reset_val ) {
754+ dev_err (dev , "SAS de-reset fail.\n" );
755+ return - EIO ;
756+ }
757+ } else
758+ dev_warn (dev , "no reset method\n" );
748759
749760 return 0 ;
750761}
@@ -2257,12 +2268,20 @@ static const struct of_device_id sas_v2_of_match[] = {
22572268};
22582269MODULE_DEVICE_TABLE (of , sas_v2_of_match );
22592270
2271+ static const struct acpi_device_id sas_v2_acpi_match [] = {
2272+ { "HISI0162" , 0 },
2273+ { }
2274+ };
2275+
2276+ MODULE_DEVICE_TABLE (acpi , sas_v2_acpi_match );
2277+
22602278static struct platform_driver hisi_sas_v2_driver = {
22612279 .probe = hisi_sas_v2_probe ,
22622280 .remove = hisi_sas_v2_remove ,
22632281 .driver = {
22642282 .name = DRV_NAME ,
22652283 .of_match_table = sas_v2_of_match ,
2284+ .acpi_match_table = ACPI_PTR (sas_v2_acpi_match ),
22662285 },
22672286};
22682287
0 commit comments