summaryrefslogtreecommitdiff
path: root/board/pdeval-stm32f072
diff options
context:
space:
mode:
Diffstat (limited to 'board/pdeval-stm32f072')
-rw-r--r--board/pdeval-stm32f072/PD_evaluation.md177
-rw-r--r--board/pdeval-stm32f072/board.c80
-rw-r--r--board/pdeval-stm32f072/board.h106
-rw-r--r--board/pdeval-stm32f072/build.mk13
-rw-r--r--board/pdeval-stm32f072/ec.tasklist13
-rw-r--r--board/pdeval-stm32f072/gpio.inc36
-rw-r--r--board/pdeval-stm32f072/openocd-flash.cfg19
-rw-r--r--board/pdeval-stm32f072/usb_pd_policy.c296
-rw-r--r--board/pdeval-stm32f072/vif_override.xml3
9 files changed, 0 insertions, 743 deletions
diff --git a/board/pdeval-stm32f072/PD_evaluation.md b/board/pdeval-stm32f072/PD_evaluation.md
deleted file mode 100644
index 4f1c8636c6..0000000000
--- a/board/pdeval-stm32f072/PD_evaluation.md
+++ /dev/null
@@ -1,177 +0,0 @@
-# USB PD chip evaluation configuration
-
-This board configuration implements a USB Power Delivery TCPM in order to
-evaluate various TCPC chips. The code tries to follow the preliminary USB PD
-interface standard but for TCPC chip implementing proprietary I2C protocol, a
-new TCPM file can be implemented as explained in the
-[Updating the code](#Updating-the-code) section below.
-
-## Building
-
-### Chromium OS chroot
-
-All the following instructions have been verified in a ChromiumOS chroot. You
-can find how to set one up on the Chromium development:
-[http://dev.chromium.org/chromium-os/quick-start-guide](http://dev.chromium.org/chromium-os/quick-start-guide)
-
-### Build the TCPM code
-
-`cd src/platform/ec`
-
-`make BOARD=pdeval-stm32f072`
-
-## Updating the code
-
-### TCPC Communication code
-
-Please duplicate [driver/tcpm/tcpci.c](../../driver/tcpm/tcpci.c) into
-**driver/tcpm/##chip#name##.c**. Then update the control logic through I2C
-there.
-
-In order for your new code to compile, you need to update
-[driver/build.mk](../../driver/build.mk) with the new file :
-`driver-$(CONFIG_USB_PD_TCPM_##CHIP#NAME##)+=tcpm/##chip#name##.o` then document
-the new `CONFIG_USB_PD_TCPM_` variable in the
-[include/config.h](../../include/config.h) file and define it in the board
-configuration in [board/pdeval-stm32f072/board.h](board.h).
-
-### Board configuration
-
-In [board/pdeval-stm32f072/board.h](board.h), you can update
-`CONFIG_USB_PD_PORT_MAX_COUNT` to the actual number of ports on your board. You
-also need to create/delete the corresponding `PD_Cx` tasks in
-[board/pdeval-stm32f072/ec.tasklist](ec.tasklist).
-
-By default, the firmware is using I2C1 with SCL/SDA on pins PB6 and PB7, running
-with a 100kHz clock, and tries to talk to TCPCs at i2c slave addresses 0x9c and
-0x9e. To change the pins or speed, you need to edit `i2c_ports` in
-[board/pdeval-stm32f072/board.c](board.c), update `I2C_PORT_TCPC` in
-[board/pdeval-stm32f072/board.h](board.h) with the right controller number, and
-change the pin mux in [board/pdeval-stm32f072/gpio.inc](gpio.inc). To change
-TCPC i2c slave addresses, update `TCPC1_I2C_ADDR` and `TCPC2_I2C_ADDR` in
-[board/pdeval-stm32f072/board.h](board.h).
-
-The I2C bus needs pull-up resistors on SCL/SDA. If your setup doesn't have
-external pull-ups on those lines, you can activate the chip internal pull-ups
-(but they are a bit weak for I2C) by editing
-[board/pdeval-stm32f072/gpio.inc](gpio.inc) and updating the alternate mode
-configuration flags with `GPIO_PULL_UP` e.g. : `ALTERNATE(PIN_MASK(B, 0x00c0),
-1, MODULE_I2C, GPIO_PULL_UP) /* I2C MASTER:PB6/7 */`
-
-An interrupt line, PA1, is configured to be used for the TCPC to get the
-attention of the TCPM. The GPIO is configured to trigger an interrupt on the
-falling edge and will call `tcpc_alert()`, which must be implemented in
-**driver/tcpm/<vendor>.c**, and should determine the cause of the interrupt and
-take action. The GPIO can be changed in
-[board/pdeval-stm32f072/gpio.inc](gpio.inc).
-
-## Flashing and Running
-
-### Flashing the firmware binary
-
-To flash through JTAG with OpenOCD, you can just run:
-
-`sudo make flash BOARD=pdeval-stm32f072`
-
-Note: you need to do that with your USB mini-B cable is connected to the **USB
-ST-LINK** plug on the discovery board.
-
-### Connecting to the firmware console
-
-Connect a USB cable to the **USB USER** mini-B receptacle on the board. `lsusb`
-should show you a device with the following ID : 18d1:500f
-
-You can get a console over USB by issuing the following command on a Linux
-computer:
-
-`echo '18d1 500f' | sudo tee /sys/bus/usb-serial/drivers/generic/new_id`
-
-## Testing
-
-Currently, the TCPM is expecting to have a GPIO to detect VBUS, but to minimize
-the HW setup with the discovery board the alternative is to fake VBUS detection
-using either the **USER** button on the discovery board, or the `vbus` console
-command, both of which toggle the state of VBUS detected. For example, to make
-get a PD contract with a power adapter, plug in the adapter and then toggle VBUS
-on. When a PD contract above 6V is made, LED5 on the discovery board will light.
-To disconnect, toggle VBUS off.
-
-EC command line commands
-
-- `help` List all available EC console commands
-- `vbus` Toggle VBUS on/off
-- `pd <port> state` Print PD protocol state information
-- `pd <port> swap data` Request data role swap on port
-- `pd <port> swap power` Request power role swap on port
-- `i2cscan` Scan i2c bus for any responsive devices
-- `i2cxfer` Perform an i2c transaction
-
-On the console, you will the PD state machine transitioning through its states
-with traces like `C0 st5`. You can always the human readable name of the current
-state by doing `pd 0 state` returning something like : `Port C0 CC1, Ena - Role:
-SNK-UFP State: SNK_DISCOVERY, Flags: 0x0608` else the numbering of the state is
-defined in [include/usb_pd.h](../../include/us_pd.h) by the `PD_STATE_`
-constants. It should be by default :
-
-```
-[0] DISABLED
-[1] SUSPENDED
-[2] SNK_DISCONNECTED
-[3] SNK_DISCONNECTED_DEBOUNCE
-[4] SNK_HARD_RESET_RECOVER
-[5] SNK_DISCOVERY
-[6] SNK_REQUESTED
-[7] SNK_TRANSITION
-[8] SNK_READY
-[9] SNK_SWAP_INIT
-[10] SNK_SWAP_SNK_DISABLE
-[11] SNK_SWAP_SRC_DISABLE
-[12] SNK_SWAP_STANDBY
-[13] SNK_SWAP_COMPLETE
-[14] SRC_DISCONNECTED
-[15] SRC_DISCONNECTED_DEBOUNCE
-[16] SRC_ACCESSORY
-[17] SRC_HARD_RESET_RECOVER
-[18] SRC_STARTUP
-[19] SRC_DISCOVERY
-[20] SRC_NEGOCIATE
-[21] SRC_ACCEPTED
-[22] SRC_POWERED
-[23] SRC_TRANSITION
-[24] SRC_READY
-[25] SRC_GET_SINK_CAP
-[26] DR_SWAP
-[27] SRC_SWAP_INIT
-[28] SRC_SWAP_SNK_DISABLE
-[29] SRC_SWAP_SRC_DISABLE
-[30] SRC_SWAP_STANDBY
-[31] SOFT_RESET
-[32] HARD_RESET_SEND
-[33] HARD_RESET_EXECUTE
-[34] BIST_RX
-[35] BIST_TX
-```
-
-## Known Issues
-
-1. This doc is not finished yet ...
-
-2. You might need a ChromeOS chroot ...
-
-## Troubleshooting
-
-1. OpenOCD is not finding the device.
-
- 1. Check that your USB mini-B cable is connected to the **USB ST-LINK**
- plug on the discovery board.
- 2. What color is the LD1 LED on the board ?
-
-1. On the I2C bus, SDA/SCL lines are staying always low
-
- 1. You might be missing some pull-up resistors on the bus.
- 1. Check the [Board configuration](#Board-configuration) section if you
- cannot add external pull-ups.
-
-1. You got black smoke
-
- 1. Time to buy a new one.
diff --git a/board/pdeval-stm32f072/board.c b/board/pdeval-stm32f072/board.c
deleted file mode 100644
index 8c62c10b79..0000000000
--- a/board/pdeval-stm32f072/board.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-/* STM32F072-discovery board based USB PD evaluation configuration */
-
-#include "common.h"
-#include "anx7447.h"
-#include "ec_version.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "i2c.h"
-#include "registers.h"
-#include "task.h"
-#include "tcpm/tcpci.h"
-#include "usb_descriptor.h"
-#include "usb_pd.h"
-#include "usb_pd_tcpm.h"
-#include "util.h"
-
-void button_event(enum gpio_signal signal);
-
-void alert_event(enum gpio_signal signal)
-{
- /* Exchange status with PD MCU. */
- host_command_pd_send_status(PD_CHARGE_NO_CHANGE);
-}
-
-#include "gpio_list.h"
-
-const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("PDeval-stm32f072"),
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Shell"),
-};
-
-BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
-
-/* Initialize board. */
-static void board_init(void)
-{
- gpio_enable_interrupt(GPIO_USER_BUTTON);
- gpio_enable_interrupt(GPIO_PD_MCU_INT);
-}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
-void board_reset_pd_mcu(void)
-{
-}
-
-/* I2C ports */
-const struct i2c_port_t i2c_ports[] = {
- {"tcpc", I2C_PORT_TCPC, 400 /* kHz */, GPIO_I2C0_SCL, GPIO_I2C0_SDA}
-};
-const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_TCPC,
- .addr_flags = AN7447_TCPC3_I2C_ADDR_FLAGS,
- },
- .drv = &anx7447_tcpm_drv,
- },
-};
-
-uint16_t tcpc_get_alert_status(void)
-{
- uint16_t status = 0;
-
- if (!gpio_get_level(GPIO_PD_MCU_INT)) {
- status = PD_STATUS_TCPC_ALERT_0;
- }
-
- return status;
-}
diff --git a/board/pdeval-stm32f072/board.h b/board/pdeval-stm32f072/board.h
deleted file mode 100644
index e0b364e2c9..0000000000
--- a/board/pdeval-stm32f072/board.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* STM32F072-discovery board based USB PD evaluation configuration */
-
-#ifndef __BOARD_H
-#define __BOARD_H
-
-/* 48 MHz SYSCLK clock frequency */
-#define CPU_CLOCK 48000000
-
-/* the UART console is on USART2 (PA14/PA15) */
-#undef CONFIG_UART_CONSOLE
-#define CONFIG_UART_CONSOLE 2
-
-/* Optional features */
-#define CONFIG_HW_CRC
-#define CONFIG_I2C
-#define CONFIG_I2C_CONTROLLER
-#define CONFIG_STM_HWTIMER32
-/* USB Power Delivery configuration */
-#define CONFIG_USB_POWER_DELIVERY
-#define CONFIG_USB_PD_TCPMV1
-#define CONFIG_USB_PD_ALT_MODE
-#define CONFIG_USB_PD_ALT_MODE_DFP
-#define CONFIG_USB_PD_CUSTOM_PDO
-#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_PORT_MAX_COUNT 1
-#define CONFIG_USB_PD_TCPM_TCPCI
-#define CONFIG_USB_PD_VBUS_DETECT_TCPC
-#define CONFIG_USB_PD_TCPM_ANX7447
-#define CONFIG_USB_PD_TCPM_MUX
-
-#undef CONFIG_USB_PD_INITIAL_DRP_STATE
-#define CONFIG_USB_PD_INITIAL_DRP_STATE PD_DRP_TOGGLE_ON
-
-#undef CONFIG_USB_PD_PULLUP
-#define CONFIG_USB_PD_PULLUP TYPEC_RP_USB
-
-/* fake board specific type-C power constants */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 650000 /* us */
-
-/* Define typical operating power and max power */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
-
-/* I2C master port connected to the TCPC */
-#define I2C_PORT_TCPC 0
-#define I2C_PORT_PD_MCU 0
-
-/* Timer selection */
-
-#define CONFIG_USBC_VCONN
-#define CONFIG_USBC_VCONN_SWAP
-/* delay to turn on/off vconn */
-
-/* USB Configuration */
-#define CONFIG_USB
-#define CONFIG_USB_PID 0x500f
-#define CONFIG_USB_CONSOLE
-
-/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_CONSOLE 0
-#define USB_IFACE_COUNT 1
-
-/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_CONSOLE 1
-#define USB_EP_COUNT 2
-
-#undef CONFIG_WATCHDOG_HELP
-#undef CONFIG_LID_SWITCH
-
-/*
- * Allow dangerous commands all the time, since we don't have a write protect
- * switch.
- */
-#define CONFIG_SYSTEM_UNLOCKED
-
-#ifndef __ASSEMBLER__
-
-/* Timer selection */
-#define TIM_CLOCK32 2
-
-#include "gpio_signal.h"
-
-/* USB string indexes */
-enum usb_strings {
- USB_STR_DESC = 0,
- USB_STR_VENDOR,
- USB_STR_PRODUCT,
- USB_STR_VERSION,
- USB_STR_CONSOLE_NAME,
-
- USB_STR_COUNT
-};
-
-void board_reset_pd_mcu(void);
-
-#endif /* !__ASSEMBLER__ */
-#endif /* __BOARD_H */
diff --git a/board/pdeval-stm32f072/build.mk b/board/pdeval-stm32f072/build.mk
deleted file mode 100644
index ef1346d534..0000000000
--- a/board/pdeval-stm32f072/build.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Board specific files build
-
-# the IC is STmicro STM32F072RBT6
-CHIP:=stm32
-CHIP_FAMILY:=stm32f0
-CHIP_VARIANT:=stm32f07x
-
-board-y=board.o usb_pd_policy.o
diff --git a/board/pdeval-stm32f072/ec.tasklist b/board/pdeval-stm32f072/ec.tasklist
deleted file mode 100644
index 5003fc7ba1..0000000000
--- a/board/pdeval-stm32f072/ec.tasklist
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/**
- * See CONFIG_TASK_LIST in config.h for details.
- */
-#define CONFIG_TASK_LIST \
- TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
- TASK_ALWAYS(PDCMD, pd_command_task,NULL, TASK_STACK_SIZE) \
- TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE)
diff --git a/board/pdeval-stm32f072/gpio.inc b/board/pdeval-stm32f072/gpio.inc
deleted file mode 100644
index 5409077c34..0000000000
--- a/board/pdeval-stm32f072/gpio.inc
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- mode:c -*-
- *
- * Copyright 2015 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Declare symbolic names for all the GPIOs that we care about.
- * Note: Those with interrupt handlers must be declared first. */
-
-GPIO_INT(USER_BUTTON, PIN(A, 0), GPIO_INT_FALLING, button_event)
-GPIO_INT(PD_MCU_INT, PIN(A, 1), GPIO_INT_FALLING, alert_event)
-
-/* Outputs */
-GPIO(LED_U, PIN(C, 6), GPIO_OUT_LOW)
-GPIO(LED_D, PIN(C, 7), GPIO_OUT_LOW)
-GPIO(LED_L, PIN(C, 8), GPIO_OUT_LOW)
-GPIO(LED_R, PIN(C, 9), GPIO_OUT_LOW)
-GPIO(USB_C0_DVDDIO, PIN(C, 14), GPIO_OUT_HIGH)
-GPIO(USB_C0_AVDD33, PIN(C, 15), GPIO_OUT_HIGH)
-GPIO(VBUS_PMIC_CTRL, PIN(A, 4), GPIO_OUT_LOW)
-
-/*
- * I2C pins should be configured as inputs until I2C module is
- * initialized. This will avoid driving the lines unintentionally.
- */
-GPIO(I2C0_SCL, PIN(B, 6), GPIO_INPUT)
-GPIO(I2C0_SDA, PIN(B, 7), GPIO_INPUT)
-
-/* Unimplemented signals which we need to emulate for now */
-UNIMPLEMENTED(ENTERING_RW)
-UNIMPLEMENTED(WP_L)
-
-ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_USART, 0) /* USART1: PA09/PA10 */
-ALTERNATE(PIN_MASK(A, 0xC000), 1, MODULE_UART, 0) /* USART2: PA14/PA15 */
-ALTERNATE(PIN_MASK(B, 0x00c0), 1, MODULE_I2C, 0) /* I2C MASTER:PB6/7 */
diff --git a/board/pdeval-stm32f072/openocd-flash.cfg b/board/pdeval-stm32f072/openocd-flash.cfg
deleted file mode 100644
index ec32416934..0000000000
--- a/board/pdeval-stm32f072/openocd-flash.cfg
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 2014 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-source [find board/stm32f0discovery.cfg]
-
-# For flashing, force the board into reset on connect, this ensures that
-# code running on the core can't interfere with programming.
-reset_config connect_assert_srst
-
-gdb_port 0
-tcl_port 0
-telnet_port 0
-init
-reset init
-flash write_image erase $BUILD_DIR/ec.bin 0x08000000
-reset halt
-resume
-shutdown
diff --git a/board/pdeval-stm32f072/usb_pd_policy.c b/board/pdeval-stm32f072/usb_pd_policy.c
deleted file mode 100644
index 2f7941321b..0000000000
--- a/board/pdeval-stm32f072/usb_pd_policy.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "common.h"
-#include "anx7447.h"
-#include "console.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "registers.h"
-#include "system.h"
-#include "task.h"
-#include "timer.h"
-#include "util.h"
-#include "usb_mux.h"
-#include "usb_pd.h"
-
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
-
-#define PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP)
-
-/* Used to fake VBUS presence since no GPIO is available to read VBUS */
-static int vbus_present;
-
-const uint32_t pd_src_pdo[] = {
- PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS),
-};
-const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo);
-
-const uint32_t pd_snk_pdo[] = {
- PDO_FIXED(5000, 900, PDO_FIXED_FLAGS),
- PDO_BATT(5000, 21000, 30000),
-};
-const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
-
-#if defined(CONFIG_USB_PD_TCPM_MUX) && defined(CONFIG_USB_PD_TCPM_ANX7447)
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .usb_port = 0,
- .driver = &anx7447_usb_mux_driver,
- },
-};
-#endif
-
-#ifdef CONFIG_USB_PD_TCPM_ANX7447
-int pd_set_power_supply_ready(int port)
-{
- /* Disable charging */
- anx7447_board_charging_enable(port, 0);
-
- /* Provide VBUS */
- gpio_set_level(GPIO_VBUS_PMIC_CTRL, 1);
- anx7447_set_power_supply_ready(port);
-
- /* notify host of power info change */
-
- CPRINTS("Enable VBUS, port%d", port);
-
- return EC_SUCCESS;
-}
-
-void pd_power_supply_reset(int port)
-{
- /* Disable VBUS */
- anx7447_power_supply_reset(port);
- gpio_set_level(GPIO_VBUS_PMIC_CTRL, 0);
- CPRINTS("Disable VBUS, port%d", port);
-
- /* Enable charging */
- anx7447_board_charging_enable(port, 1);
-}
-#else
-int pd_set_power_supply_ready(int port)
-{
- /* Turn on the "up" LED when we output VBUS */
- gpio_set_level(GPIO_LED_U, 1);
- CPRINTS("Power supply ready/%d", port);
- return EC_SUCCESS; /* we are ready */
-}
-
-void pd_power_supply_reset(int port)
-{
- /* Turn off the "up" LED when we shutdown VBUS */
- gpio_set_level(GPIO_LED_U, 0);
- /* Disable VBUS */
- CPRINTS("Disable VBUS", port);
-}
-#endif /* CONFIG_USB_PD_TCPM_ANX7447 */
-
-void pd_set_input_current_limit(int port, uint32_t max_ma,
- uint32_t supply_voltage)
-{
- CPRINTS("USBPD current limit port %d max %d mA %d mV",
- port, max_ma, supply_voltage);
- /* do some LED coding of the power we can sink */
- if (max_ma) {
- if (supply_voltage > 6500)
- gpio_set_level(GPIO_LED_R, 1);
- else
- gpio_set_level(GPIO_LED_L, 1);
- } else {
- gpio_set_level(GPIO_LED_L, 0);
- gpio_set_level(GPIO_LED_R, 0);
- }
-}
-
-__override void typec_set_input_current_limit(int port, uint32_t max_ma,
- uint32_t supply_voltage)
-{
- CPRINTS("TYPEC current limit port %d max %d mA %d mV",
- port, max_ma, supply_voltage);
- gpio_set_level(GPIO_LED_R, !!max_ma);
-}
-
-void button_event(enum gpio_signal signal)
-{
- vbus_present = !vbus_present;
- CPRINTS("VBUS %d", vbus_present);
-}
-
-static int command_vbus_toggle(int argc, char **argv)
-{
- vbus_present = !vbus_present;
- CPRINTS("VBUS %d", vbus_present);
-
- return EC_SUCCESS;
-}
-DECLARE_CONSOLE_COMMAND(vbus, command_vbus_toggle,
- "",
- "Toggle VBUS detected");
-
-int pd_snk_is_vbus_provided(int port)
-{
- return vbus_present;
-}
-
-__override int pd_check_data_swap(int port,
- enum pd_data_role data_role)
-{
- /* Always allow data swap */
- return 1;
-}
-
-#ifdef CONFIG_USBC_VCONN_SWAP
-int pd_check_vconn_swap(int port)
-{
- /*
- * Allow vconn swap as long as we are acting as a dual role device,
- * otherwise assume our role is fixed (not in S0 or console command
- * to fix our role).
- */
- return pd_get_dual_role(port) == PD_DRP_TOGGLE_ON;
-}
-#endif
-
-__override void pd_check_pr_role(int port,
- enum pd_power_role pr_role,
- int flags)
-{
-}
-
-__override void pd_check_dr_role(int port,
- enum pd_data_role dr_role,
- int flags)
-{
-}
-/* ----------------- Vendor Defined Messages ------------------ */
-const uint32_t vdo_idh = VDO_IDH(1, /* data caps as USB host */
- 0, /* data caps as USB device */
- IDH_PTYPE_PERIPH,
- 0, /* supports alt modes */
- 0x0000);
-
-const uint32_t vdo_product = VDO_PRODUCT(0x0000, 0x0000);
-
-static int svdm_response_identity(int port, uint32_t *payload)
-{
- payload[VDO_I(IDH)] = vdo_idh;
- payload[VDO_I(CSTAT)] = VDO_CSTAT(0);
- payload[VDO_I(PRODUCT)] = vdo_product;
- return VDO_I(PRODUCT) + 1;
-}
-
-__override const struct svdm_response svdm_rsp = {
- .identity = &svdm_response_identity,
- .svids = NULL,
- .modes = NULL,
-};
-
-#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-__override void svdm_safe_dp_mode(int port)
-{
- /* make DP interface safe until configure */
- dp_flags[port] = 0;
- /*
- * board_set_usb_mux(port, USB_PD_MUX_NONE,
- * polarity_rm_dts(pd_get_polarity(port)));
- */
-}
-
-__override int svdm_dp_config(int port, uint32_t *payload)
-{
- int opos = pd_alt_mode(port, TCPCI_MSG_SOP, USB_SID_DISPLAYPORT);
- int pin_mode = pd_dfp_dp_get_pin_mode(port, dp_status[port]);
- bool unused;
-#if defined(CONFIG_USB_PD_TCPM_MUX) && defined(CONFIG_USB_PD_TCPM_ANX7447)
- const struct usb_mux *mux = &usb_muxes[port];
-#endif
-
-#ifdef CONFIG_USB_PD_TCPM_ANX7447
- mux_state_t mux_state = USB_PD_MUX_NONE;
- if (polarity_rm_dts(pd_get_polarity(port)))
- mux_state |= USB_PD_MUX_POLARITY_INVERTED;
-#endif
-
- CPRINTS("pin_mode = %d", pin_mode);
- if (!pin_mode)
- return 0;
-
-#if defined(CONFIG_USB_PD_TCPM_MUX) && defined(CONFIG_USB_PD_TCPM_ANX7447)
- switch (pin_mode) {
- case MODE_DP_PIN_A:
- case MODE_DP_PIN_C:
- case MODE_DP_PIN_E:
- mux_state |= USB_PD_MUX_DP_ENABLED;
- /*
- * Note: Direct mux driver calls are deprecated. Calls
- * should go through the usb_mux APIs instead.
- */
- mux->driver->set(mux, mux_state, &unused);
- break;
- case MODE_DP_PIN_B:
- case MODE_DP_PIN_D:
- case MODE_DP_PIN_F:
- mux_state |= USB_PD_MUX_DOCK;
- mux->driver->set(mux, mux_state, &unused);
- break;
- }
-#endif
-
- /*
- * board_set_usb_mux(port, USB_PD_MUX_DP_ENABLED,
- * polarity_rm_dts(pd_get_polarity(port)));
- */
- payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
- CMD_DP_CONFIG | VDO_OPOS(opos));
- payload[1] = VDO_DP_CFG(pin_mode, /* pin mode */
- 1, /* DPv1.3 signaling */
- 2); /* UFP connected */
- return 2;
-}
-
-__override void svdm_dp_post_config(int port)
-{
- const struct usb_mux *mux = &usb_muxes[port];
-
- dp_flags[port] |= DP_FLAGS_DP_ON;
- if (!(dp_flags[port] & DP_FLAGS_HPD_HI_PENDING))
- return;
-
- /* Note: Usage is deprecated, use usb_mux_hpd_update instead */
- if (IS_ENABLED(CONFIG_USB_PD_TCPM_ANX7447))
- anx7447_tcpc_update_hpd_status(mux, USB_PD_MUX_HPD_LVL |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
-}
-
-__override int svdm_dp_attention(int port, uint32_t *payload)
-{
-#ifdef CONFIG_USB_PD_TCPM_ANX7447
- int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]);
- int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]);
- const struct usb_mux *mux = &usb_muxes[port];
- mux_state_t mux_state = (lvl ? USB_PD_MUX_HPD_LVL :
- USB_PD_MUX_HPD_LVL_DEASSERTED) |
- (irq ? USB_PD_MUX_HPD_IRQ :
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
-
- /* Note: Usage is deprecated, use usb_mux_hpd_update instead */
- CPRINTS("Attention: 0x%x", payload[1]);
- anx7447_tcpc_update_hpd_status(mux, mux_state);
-#endif
- dp_status[port] = payload[1];
-
- /* ack */
- return 1;
-}
-
-__override void svdm_exit_dp_mode(int port)
-{
-#ifdef CONFIG_USB_PD_TCPM_ANX7447
- anx7447_tcpc_clear_hpd_status(port);
-#endif
-}
-#endif /* CONFIG_USB_PD_ALT_MODE_DFP */
diff --git a/board/pdeval-stm32f072/vif_override.xml b/board/pdeval-stm32f072/vif_override.xml
deleted file mode 100644
index 32736caf64..0000000000
--- a/board/pdeval-stm32f072/vif_override.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<!-- Add VIF field overrides here. See genvif.c and the Vendor Info File
- Definition from the USB-IF.
--->