Skip to content

Commit

Permalink
osfv_cli: introduce flash power state param
Browse files Browse the repository at this point in the history
Fixes: #37
Fixes: #15

Tested:

* MSI Z690

DUT model retrieved from snipeit: MSI PRO Z690-A DDR4
Found Macronix flash chip "MX25U25635F" (32768 kB, SPI) on linux_spi.

* Protectli V1410

DUT model retrieved from snipeit: V1410
Found Winbond flash chip "W25Q128.V" (16384 kB, SPI) on ch341a_spi.

* Protectli VP6650

DUT model retrieved from snipeit: VP6650
Found Macronix flash chip "MX25L12833F/MX25L12835F/MX25L12845E/MX25L12865E/MX25L12873F" (16384 kB, SPI) on linux_spi.

* PC Engines APU3

DUT model retrieved from snipeit: APU3
Found Winbond flash chip "W25Q64JV-.Q" (8192 kB, SPI) on linux_spi.

* PC Engines APU4

DUT model retrieved from snipeit: APU4
Found Winbond flash chip "W25Q64JV-.Q" (8192 kB, SPI) on linux_spi.

* Protecli VP46XX - none in lab currently fully connected

Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
  • Loading branch information
macpijan committed Jun 11, 2024
1 parent a082ed9 commit b12aaa4
Show file tree
Hide file tree
Showing 23 changed files with 46 additions and 48 deletions.
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/APU2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ programmer:
pwr_ctrl:
sonoff: false
relay: true
init_on: true
flashing_power_state: "G3"

reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/APU3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ programmer:
pwr_ctrl:
sonoff: false
relay: true
init_on: true
flashing_power_state: "G3"

reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/APU4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ programmer:
pwr_ctrl:
sonoff: false
relay: true
init_on: true
flashing_power_state: "G3"

reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/APU5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ programmer:
pwr_ctrl:
sonoff: false
relay: true
init_on: true
flashing_power_state: "G3"

reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/APU6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ programmer:
pwr_ctrl:
sonoff: false
relay: true
init_on: true
flashing_power_state: "G3"

reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/APU7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ programmer:
pwr_ctrl:
sonoff: false
relay: true
init_on: true
flashing_power_state: "G3"

reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/EA-0113.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ programmer:
pwr_ctrl:
sonoff: false
relay: true
init_on: true
flashing_power_state: "G3"
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/FW4C.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pwr_ctrl:
sonoff: false
# whether power is controller via on-board RTE relay (required)
relay: true
init_on: false
flashing_power_state: "OFF"

# whether CMOS reset is required after flashing (optional - defaults to false)
reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/MSI PRO Z690-A DDR4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ programmer:
pwr_ctrl:
sonoff: true
relay: false
init_on: false
flashing_power_state: "OFF"
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/MSI PRO Z690-A DDR5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ programmer:
pwr_ctrl:
sonoff: true
relay: false
init_on: false
flashing_power_state: "OFF"
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/MSI PRO Z790-P WIFI DDR5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ programmer:
pwr_ctrl:
sonoff: true
relay: false
init_on: false
flashing_power_state: "OFF"
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/MinnowBoard Turbot B41.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ programmer:
pwr_ctrl:
sonoff: false
relay: true
init_on: false
flashing_power_state: "OFF"

reset_cmos: false
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/V1210.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pwr_ctrl:
sonoff: false
# whether power is controller via on-board RTE relay (required)
relay: true
init_on: false
flashing_power_state: "OFF"

# whether CMOS reset is required after flashing (optional - defaults to false)
reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/V1410.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pwr_ctrl:
sonoff: false
# whether power is controller via on-board RTE relay (required)
relay: true
init_on: false
flashing_power_state: "OFF"

# whether CMOS reset is required after flashing (optional - defaults to false)
reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/V1610.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pwr_ctrl:
sonoff: false
# whether power is controller via on-board RTE relay (required)
relay: true
init_on: false
flashing_power_state: "OFF"

# whether CMOS reset is required after flashing (optional - defaults to false)
reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/VP2410.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pwr_ctrl:
sonoff: false
# whether power is controller via on-board RTE relay (required)
relay: true
init_on: false
flashing_power_state: "OFF"

# whether CMOS reset is required after flashing (optional - defaults to false)
reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/VP2420.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ programmer:
pwr_ctrl:
sonoff: false
relay: true
init_on: true
flashing_power_sate: "G3"

reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/VP4630.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pwr_ctrl:
sonoff: false
# whether power is controller via on-board RTE relay (required)
relay: true
init_on: true
flashing_power_state: "OFF"

# whether CMOS reset is required after flashing (optional - defaults to false)
reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/VP4650.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pwr_ctrl:
sonoff: true
# whether power is controller via on-board RTE relay (required)
relay: false
init_on: true
flashing_power_state: "OFF"

# whether CMOS reset is required after flashing (optional - defaults to false)
reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/VP4670.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pwr_ctrl:
sonoff: true
# whether power is controller via on-board RTE relay (required)
relay: false
init_on: true
flashing_power_state: "OFF"

# whether CMOS reset is required after flashing (optional - defaults to false)
reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/VP6650.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ programmer:
pwr_ctrl:
sonoff: true
relay: false
init_on: true
flashing_power_state: "OFF"

reset_cmos: true
2 changes: 1 addition & 1 deletion osfv_cli/osfv_cli/models/VP6670.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ programmer:
pwr_ctrl:
sonoff: true
relay: false
init_on: true
flashing_power_state: "OFF"

reset_cmos: true
50 changes: 24 additions & 26 deletions osfv_cli/osfv_cli/rte.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def load_model_data(self):

voltage_validator = Any("1.8V", "3.3V")
programmer_name_validator = Any("rte_1_1", "rte_1_0", "ch341a")
flashing_power_state_validator = Any("G3", "OFF")

schema = Schema(
{
Expand All @@ -65,7 +66,7 @@ def load_model_data(self):
Required("pwr_ctrl"): {
Required("sonoff"): bool,
Required("relay"): bool,
Required("init_on"): bool,
Required("flashing_power_state"): flashing_power_state_validator,
},
Optional("reset_cmos", default=False): bool,
}
Expand Down Expand Up @@ -189,45 +190,42 @@ def discharge_psu(self):
for _ in range(5):
self.power_off(3)

def pwr_ctrl_before_flash(self, programmer):
# 1. sonoff/relay ON
# 2. sleep 5
# Some flash scripts started with power platform ON, but some others
# not (like FW4C).
if self.dut_data["pwr_ctrl"]["init_on"] is True:
self.pwr_ctrl_on()
time.sleep(5)
self.power_off(6)
time.sleep(10)
else:
# 3. RTE POFF
# 4. sleep 3
self.pwr_ctrl_off()
self.discharge_psu()
def pwr_ctrl_before_flash(self, programmer, power_state):

# Always start from the same state (PSU active)
self.pwr_ctrl_on()
time.sleep(5)
self.power_off(6)
time.sleep(10)

# Some platforms need to enable SPI lines at this point
# when PSU is active (e.g. VP6650). Otherwise the chip is not detected.
# So we must turn the PSU ON first in the middle of power cycle,
# even if we perform flashing with the PSU OFF.
if programmer == "rte_1_1":
# 5. SPI ON
# 6. sleep 2
self.spi_enable()
time.sleep(3)

if self.dut_data["pwr_ctrl"]["init_on"] is True:
# 7. sonoff/relay OFF
# 8. sleep 2
if power_state == "G3":
pass
elif power_state == "OFF":
self.pwr_ctrl_off()
self.discharge_psu()
else:
exit(
f"Power state: '{power_state}' is not supported. Please check model config."
)

def pwr_ctrl_after_flash(self, programmer):
if programmer == "rte_1_1":
# 10. SPI OFF
# 11. sleep 2
self.spi_disable()
time.sleep(2)

def flash_cmd(self, args, read_file=None, write_file=None):
self.pwr_ctrl_before_flash(self.dut_data["programmer"]["name"])

# 9. flashrom
self.pwr_ctrl_before_flash(
self.dut_data["programmer"]["name"],
self.dut_data["pwr_ctrl"]["flashing_power_state"],
)

# Create SSH client
ssh = paramiko.SSHClient()
Expand Down

0 comments on commit b12aaa4

Please sign in to comment.