board: stm32mp1: Update power supply check via USB TYPE-C
authorPatrice Chotard <patrice.chotard@st.com>
Tue, 30 Apr 2019 16:09:38 +0000 (18:09 +0200)
committerPatrice Chotard <patrice.chotard@st.com>
Thu, 6 Jun 2019 15:40:17 +0000 (17:40 +0200)
commit28c064e66bc4cd6097cdf39410cf4b9c2ad9d35d
tree2894960c518911a7af93ae0b89c89e5230c03e63
parentca9c5dccb7eec1a52dd39c6014279f1fab7d4fe6
board: stm32mp1: Update power supply check via USB TYPE-C

Add 2 new checks:
 - detect when USB TYPE-C cable is not plugged correctly.
   In this case, GND and VBUS pins are connected but not CC1
   and CC2 pins.

 - detect is an USB Type-C charger supplies more than 3 Amps
   which is not compliant with the USB Type-C specification

In these 2 situations, stop the boot process and let red led
blinks forever.

   V cc1      |   V cc2     | power supply | red led | console message
range (Volts) |range (Volts)|   (Amps)     | blinks  |
--------------|-------------|--------------|---------|-----------------------------------
    > 2.15    |   < 0.2     |     > 3      | for ever| USB TYPE-C charger not compliant with specification
[2.15 - 1.23[ |   < 0.2     |     3        |   NO    | NO
[1.23 - 0.66[ |   < 0.2     |     1.5      | 3 times | WARNING 1.5A power supply detected
[0.66 - 0]    |   < 0.2     |     0.5      | 2 times | WARNING 500mA power supply detected
    < 0.2     |   < 0.2     |              | for ever| ERROR USB TYPE-C connection in unattached mode
    > 0.2     |   > 0.2     |              | for ever| ERROR USB TYPE-C connection in unattached mode

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
board/st/stm32mp1/stm32mp1.c