diff mbox series

[RFC,06/12] npu2-opencapi: Simplify freset states

Message ID 20190619124510.25182-7-fbarrat@linux.ibm.com
State RFC
Headers show
Series opencapi: enable card reset and link retraining | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (b904cb733750de1bb0e04e5012c391a9c3094d11)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot fail Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Frederic Barrat June 19, 2019, 12:45 p.m. UTC
Let's get rid of one transitional state, since there's no need to
pause in between releasing the reset signals of the ODL and the
adapter.

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
---
 hw/npu2-opencapi.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

Comments

Andrew Donnellan June 21, 2019, 12:27 a.m. UTC | #1
On 19/6/19 10:45 pm, Frederic Barrat wrote:
> Let's get rid of one transitional state, since there's no need to
> pause in between releasing the reset signals of the ODL and the
> adapter.
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
> -		/*
> -		 * Minimal delay before taking adapter out of
> -		 * reset. Could be useless, but doesn't hurt
> -		 */
> -		return pci_slot_set_sm_timeout(slot, msecs_to_tb(1));
> -

So it turns out this is indeed useless?

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>

> -	case OCAPI_SLOT_FRESET_DEASSERT_DELAY:
>   		deassert_adapter_reset(dev);
>   		pci_slot_set_state(slot,
> -				OCAPI_SLOT_FRESET_DEASSERT_DELAY2);
> +				OCAPI_SLOT_FRESET_DEASSERT_DELAY);
>   		/* give 250ms to device to be ready */
>   		return pci_slot_set_sm_timeout(slot, msecs_to_tb(250));
>   
> -	case OCAPI_SLOT_FRESET_DEASSERT_DELAY2:
> +	case OCAPI_SLOT_FRESET_DEASSERT_DELAY:
>   		unfence_brick(dev);
>   		set_init_pattern(chip_id, dev);
>   		pci_slot_set_state(slot,
>
Frederic Barrat June 21, 2019, 9:15 a.m. UTC | #2
Le 21/06/2019 à 02:27, Andrew Donnellan a écrit :
> On 19/6/19 10:45 pm, Frederic Barrat wrote:
>> Let's get rid of one transitional state, since there's no need to
>> pause in between releasing the reset signals of the ODL and the
>> adapter.
>>
>> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
>> -        /*
>> -         * Minimal delay before taking adapter out of
>> -         * reset. Could be useless, but doesn't hurt
>> -         */
>> -        return pci_slot_set_sm_timeout(slot, msecs_to_tb(1));
>> -
> 
> So it turns out this is indeed useless?

Yes. The DLx designer had always stated so. I added the delay as a 
conservative measure a while back, as it took some time for the link 
retrain to become stable (needed a patch in the DLx/TLx + the new PHY 
settings + me understanding what was going on). But I've removed it in 
my setup for quite a while now, and my boot loop and reset loops have 
been working well, so I'm confident to remove it.

   Fred

> Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>
> 
>> -    case OCAPI_SLOT_FRESET_DEASSERT_DELAY:
>>           deassert_adapter_reset(dev);
>>           pci_slot_set_state(slot,
>> -                OCAPI_SLOT_FRESET_DEASSERT_DELAY2);
>> +                OCAPI_SLOT_FRESET_DEASSERT_DELAY);
>>           /* give 250ms to device to be ready */
>>           return pci_slot_set_sm_timeout(slot, msecs_to_tb(250));
>> -    case OCAPI_SLOT_FRESET_DEASSERT_DELAY2:
>> +    case OCAPI_SLOT_FRESET_DEASSERT_DELAY:
>>           unfence_brick(dev);
>>           set_init_pattern(chip_id, dev);
>>           pci_slot_set_state(slot,
>>
>
diff mbox series

Patch

diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
index f9cb1d26..1328ee93 100644
--- a/hw/npu2-opencapi.c
+++ b/hw/npu2-opencapi.c
@@ -66,8 +66,7 @@ 
 #define   OCAPI_SLOT_FRESET_INIT            (OCAPI_SLOT_FRESET + 2)
 #define   OCAPI_SLOT_FRESET_ASSERT_DELAY    (OCAPI_SLOT_FRESET + 3)
 #define   OCAPI_SLOT_FRESET_DEASSERT_DELAY  (OCAPI_SLOT_FRESET + 4)
-#define   OCAPI_SLOT_FRESET_DEASSERT_DELAY2 (OCAPI_SLOT_FRESET + 5)
-#define   OCAPI_SLOT_FRESET_INIT_DELAY      (OCAPI_SLOT_FRESET + 6)
+#define   OCAPI_SLOT_FRESET_INIT_DELAY      (OCAPI_SLOT_FRESET + 5)
 
 #define OCAPI_LINK_TRAINING_RETRIES	2
 #define OCAPI_LINK_TRAINING_TIMEOUT	3000 /* ms */
@@ -1232,22 +1231,13 @@  static int64_t npu2_opencapi_freset(struct pci_slot *slot)
 	case OCAPI_SLOT_FRESET_ASSERT_DELAY:
 		npu2_opencapi_phy_reset(dev);
 		deassert_odl_reset(chip_id, dev->brick_index);
-		pci_slot_set_state(slot,
-				OCAPI_SLOT_FRESET_DEASSERT_DELAY);
-		/*
-		 * Minimal delay before taking adapter out of
-		 * reset. Could be useless, but doesn't hurt
-		 */
-		return pci_slot_set_sm_timeout(slot, msecs_to_tb(1));
-
-	case OCAPI_SLOT_FRESET_DEASSERT_DELAY:
 		deassert_adapter_reset(dev);
 		pci_slot_set_state(slot,
-				OCAPI_SLOT_FRESET_DEASSERT_DELAY2);
+				OCAPI_SLOT_FRESET_DEASSERT_DELAY);
 		/* give 250ms to device to be ready */
 		return pci_slot_set_sm_timeout(slot, msecs_to_tb(250));
 
-	case OCAPI_SLOT_FRESET_DEASSERT_DELAY2:
+	case OCAPI_SLOT_FRESET_DEASSERT_DELAY:
 		unfence_brick(dev);
 		set_init_pattern(chip_id, dev);
 		pci_slot_set_state(slot,