1# Copyright 2019 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5from autotest_lib.server import utils
6
7AUTHOR = "alevkoy"
8NAME = "firmware_Cr50WilcoRmaFactoryMode"
9PURPOSE = "Verify Wilco-specific Cr50 behavior for factory mode"
10ATTRIBUTES = "suite:faft_wilco, suite:faft_cr50_prepvt, suite:faft_cr50_pvt"
11TIME = "SHORT"
12TEST_TYPE = "server"
13DEPENDENCIES = "servo_state:WORKING, board:sarien"
14JOB_RETRIES = 0
15
16DOC = """Make sure Cr50's factory mode sets GPIOs correctly.
17
18Cr50 drives the GPIO lines ENTRY_TO_FACT_MODE and SPI_CHROME_SEL, connected to
19the Wilco EC. Normally, ENTRY_TO_FACT_MODE is deasserted, and CHROME_SEL is
20asserted. When Cr50 enters factory mode, they should each switch. When Cr50
21leaves factory mode, they should go back to the original state.
22"""
23
24if 'args_dict' not in locals():
25    args_dict = {}
26
27args_dict.update(utils.args_to_dict(args))
28servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
29
30def run(machine):
31    host = hosts.create_host(machine, servo_args=servo_args)
32
33    iterations = int(args_dict.get("iterations", 1))
34
35    job.run_test("firmware_Cr50WilcoRmaFactoryMode", host=host,
36            cmdline_args=args, full_args=args_dict, iterations=iterations)
37
38parallel_simple(run, machines)
39