usb_c: Remove unnecessary PE_FLAGS_PROTOCOL_ERROR flag
Remove unnecessary PE_FLAGS_PROTOCOL_ERROR flag Signed-off-by: Sam Hurst <sbh1187@gmail.com>
This commit is contained in:
parent
77c7a51e4d
commit
0ed5c886c9
3 changed files with 29 additions and 26 deletions
|
@ -228,7 +228,8 @@ void pe_report_error(const struct device *dev, const enum pe_error e,
|
|||
* Generate Hard Reset if Protocol Error occurred
|
||||
* while in PE_Send_Soft_Reset state.
|
||||
*/
|
||||
if (pe_get_state(dev) == PE_SEND_SOFT_RESET) {
|
||||
if (pe_get_state(dev) == PE_SEND_SOFT_RESET ||
|
||||
pe_get_state(dev) == PE_SOFT_RESET) {
|
||||
pe_set_state(dev, PE_SNK_HARD_RESET);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -66,51 +66,46 @@ enum usbc_pe_state {
|
|||
enum pe_flags {
|
||||
/** Accept message received from port partner */
|
||||
PE_FLAGS_ACCEPT = 0,
|
||||
/**
|
||||
* Protocol Error was determined based on error recovery
|
||||
* current state
|
||||
*/
|
||||
PE_FLAGS_PROTOCOL_ERROR = 1,
|
||||
/** A message we requested to be sent has been transmitted */
|
||||
PE_FLAGS_TX_COMPLETE = 2,
|
||||
PE_FLAGS_TX_COMPLETE = 1,
|
||||
/** A message sent by a port partner has been received */
|
||||
PE_FLAGS_MSG_RECEIVED = 3,
|
||||
PE_FLAGS_MSG_RECEIVED = 2,
|
||||
/**
|
||||
* A hard reset has been requested by the DPM but has not been sent,
|
||||
* not currently used
|
||||
*/
|
||||
PE_FLAGS_HARD_RESET_PENDING = 4,
|
||||
PE_FLAGS_HARD_RESET_PENDING = 3,
|
||||
/** An explicit contract is in place with our port partner */
|
||||
PE_FLAGS_EXPLICIT_CONTRACT = 5,
|
||||
PE_FLAGS_EXPLICIT_CONTRACT = 4,
|
||||
/**
|
||||
* Waiting for Sink Capabailities timed out. Used for retry error
|
||||
* handling
|
||||
*/
|
||||
PE_FLAGS_SNK_WAIT_CAP_TIMEOUT = 6,
|
||||
PE_FLAGS_SNK_WAIT_CAP_TIMEOUT = 5,
|
||||
/**
|
||||
* Flag to note current Atomic Message Sequence (AMS) is interruptible.
|
||||
* If this flag is not set the AMS is non-interruptible. This flag must
|
||||
* be set in the interruptible's message state entry.
|
||||
*/
|
||||
PE_FLAGS_INTERRUPTIBLE_AMS = 7,
|
||||
PE_FLAGS_INTERRUPTIBLE_AMS = 6,
|
||||
/** Flag to trigger sending a Data Role Swap */
|
||||
PE_FLAGS_DR_SWAP_TO_DFP = 8,
|
||||
PE_FLAGS_DR_SWAP_TO_DFP = 7,
|
||||
/** Flag is set when an AMS is initiated by the Device Policy Manager */
|
||||
PE_FLAGS_DPM_INITIATED_AMS = 9,
|
||||
PE_FLAGS_DPM_INITIATED_AMS = 8,
|
||||
/** Flag to note message was discarded due to incoming message */
|
||||
PE_FLAGS_MSG_DISCARDED = 10,
|
||||
PE_FLAGS_MSG_DISCARDED = 9,
|
||||
/** Flag to trigger sending a soft reset */
|
||||
PE_FLAGS_SEND_SOFT_RESET = 11,
|
||||
PE_FLAGS_SEND_SOFT_RESET = 10,
|
||||
/**
|
||||
* This flag is set when a Wait message is received in response to a
|
||||
* Sink REQUEST
|
||||
*/
|
||||
PE_FLAGS_WAIT_SINK_REQUEST = 12,
|
||||
PE_FLAGS_WAIT_SINK_REQUEST = 11,
|
||||
/**
|
||||
* This flag is set when a Wait message is received in response to a
|
||||
* Data Role Swap
|
||||
*/
|
||||
PE_FLAGS_WAIT_DATA_ROLE_SWAP = 13,
|
||||
PE_FLAGS_WAIT_DATA_ROLE_SWAP = 12,
|
||||
|
||||
/** Number of PE Flags */
|
||||
PE_FLAGS_COUNT
|
||||
|
|
|
@ -527,7 +527,6 @@ void pe_snk_hard_reset_entry(void *obj)
|
|||
atomic_set_bit(pe->flags, PE_FLAGS_HARD_RESET_PENDING);
|
||||
|
||||
atomic_clear_bit(pe->flags, PE_FLAGS_SNK_WAIT_CAP_TIMEOUT);
|
||||
atomic_clear_bit(pe->flags, PE_FLAGS_PROTOCOL_ERROR);
|
||||
|
||||
/* Request the generation of Hard Reset Signaling by the PHY Layer */
|
||||
prl_execute_hard_reset(dev);
|
||||
|
@ -715,7 +714,7 @@ void pe_send_soft_reset_run(void *obj)
|
|||
/*
|
||||
* The Policy Engine Shall transition to the PE_SNK_Wait_for_Capabilities
|
||||
* state when:
|
||||
* 1: An Accept Message has been received on SOP
|
||||
* 1: An Accept Message has been received on SOP
|
||||
*/
|
||||
else if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_MSG_RECEIVED)) {
|
||||
header = prl_rx->emsg.header;
|
||||
|
@ -726,11 +725,10 @@ void pe_send_soft_reset_run(void *obj)
|
|||
}
|
||||
/*
|
||||
* The Policy Engine Shall transition to the PE_SNK_Hard_Reset state when:
|
||||
* 1: A SenderResponseTimer timeout occurs
|
||||
* 2: Or the Protocol Layer indicates that a transmission error has occurred
|
||||
* 1: A SenderResponseTimer timeout occurs (Handled in pe_report_error function)
|
||||
* 2: Or the Protocol Layer indicates that a transmission error has occurred
|
||||
*/
|
||||
else if (atomic_test_bit(pe->flags, PE_FLAGS_PROTOCOL_ERROR) ||
|
||||
usbc_timer_expired(&pe->pd_t_sender_response)) {
|
||||
else if (usbc_timer_expired(&pe->pd_t_sender_response)) {
|
||||
pe_set_state(dev, PE_SNK_HARD_RESET);
|
||||
}
|
||||
}
|
||||
|
@ -779,11 +777,20 @@ void pe_soft_reset_run(void *obj)
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The Policy Engine Shall transition to the PE_SNK_Wait_for_Capabilities
|
||||
* state when:
|
||||
* 1: The Accept Message has been sent on SOP.
|
||||
*/
|
||||
if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_TX_COMPLETE)) {
|
||||
pe_set_state(dev, PE_SNK_WAIT_FOR_CAPABILITIES);
|
||||
} else if (atomic_test_and_clear_bit(pe->flags, PE_FLAGS_PROTOCOL_ERROR)) {
|
||||
pe_set_state(dev, PE_SNK_HARD_RESET);
|
||||
}
|
||||
/*
|
||||
* The Policy Engine Shall transition to the PE_SNK_Hard_Reset
|
||||
* state when:
|
||||
* 1: The Protocol Layer indicates that a transmission error
|
||||
* has occurred. (Handled in pe_report_error function)
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue