summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2016-04-22 17:07:46 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-04-25 12:56:42 -0700
commita1fc785977074b4d5b6ebaa826a07374353374dd (patch)
tree4ae2fca9e35aee3f6552d3e48bea4dccecbb992c
parent37c577cbfbc54f98c15ee8003b24e75eb9dd8f9a (diff)
downloadchrome-ec-a1fc785977074b4d5b6ebaa826a07374353374dd.tar.gz
snoball: GPIO changes for proto 1
BUG=chrome-os-partner:52690 BRANCH=None TEST=`make buildall -j` Change-Id: I787e8bc2fb5ca04a0879eeec7a8d7169e36b7661 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/340445 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/snoball/build.mk1
-rw-r--r--board/snoball/gpio.inc19
-rw-r--r--board/snoball/usb_pd_policy.c138
3 files changed, 6 insertions, 152 deletions
diff --git a/board/snoball/build.mk b/board/snoball/build.mk
index ce52e7678f..91ec2c756b 100644
--- a/board/snoball/build.mk
+++ b/board/snoball/build.mk
@@ -11,7 +11,6 @@ CHIP_FAMILY:=stm32f0
CHIP_VARIANT:=stm32f03x8
board-y=board.o
-board-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o
# This target builds RW only. Therefore, remove RO from dependencies.
all_deps=$(patsubst ro,,$(def_all_deps))
diff --git a/board/snoball/gpio.inc b/board/snoball/gpio.inc
index d92a999c6b..a2cccc46c6 100644
--- a/board/snoball/gpio.inc
+++ b/board/snoball/gpio.inc
@@ -10,29 +10,24 @@
/* TCPC alert / interrupt inputs */
GPIO_INT(TCPC1_INT, PIN(A, 0), GPIO_INT_FALLING | GPIO_PULL_UP, tcpc_alert_event)
-GPIO_INT(TCPC2_INT, PIN(C, 13), GPIO_INT_FALLING | GPIO_PULL_UP, tcpc_alert_event)
+GPIO_INT(TCPC2_INT, PIN(F, 7), GPIO_INT_FALLING | GPIO_PULL_UP, tcpc_alert_event)
+
+GPIO(OPTO_TX_1, PIN(A, 2), GPIO_OUT_LOW)
+GPIO(OPTO_TX_2, PIN(A, 3), GPIO_OUT_LOW)
/* ADCs */
GPIO(VBIAS, PIN(A, 4), GPIO_ANALOG)
GPIO(VOUT_1, PIN(A, 5), GPIO_ANALOG)
GPIO(VOUT_2, PIN(A, 6), GPIO_ANALOG)
-/* Test points */
-GPIO(TP1, PIN(B, 0), GPIO_OUT_LOW)
-GPIO(TP2, PIN(B, 1), GPIO_OUT_LOW)
-
/*
* I2C pins should be configured as inputs until I2C module is
* initialized. This will avoid driving the lines unintentionally.
*/
GPIO(I2C1_SCL, PIN(B, 6), GPIO_INPUT | GPIO_PULL_UP)
GPIO(I2C1_SDA, PIN(B, 7), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(I2C2_SCL, PIN(A, 11), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(I2C2_SDA, PIN(A, 12), GPIO_INPUT | GPIO_PULL_UP)
-
-/* Original I2C2 pins (invalid pin mux) on P0.9 boards */
-GPIO(GPIO_PB11, PIN(B, 11), GPIO_INPUT)
-GPIO(GPIO_PB12, PIN(B, 12), GPIO_INPUT)
+GPIO(I2C2_SCL, PIN(A, 11), GPIO_INPUT | GPIO_PULL_UP) /* bitbang */
+GPIO(I2C2_SDA, PIN(A, 12), GPIO_INPUT | GPIO_PULL_UP) /* bitbang */
/* Unimplemented signals which we need to emulate for now */
UNIMPLEMENTED(ENTERING_RW)
@@ -47,8 +42,6 @@ GPIO(EC_UART_RX, PIN(A, 10), GPIO_INPUT)
/* PB6 / PB7 I2C1_SCL / I2C1_SDA */
ALTERNATE(PIN_MASK(B, 0x00C0), 1, MODULE_I2C, GPIO_PULL_UP)
-/* PA11 / PA12 I2C2_SCL / I2C2_SDA */
-ALTERNATE(PIN_MASK(A, 0x1800), 5, MODULE_I2C, GPIO_PULL_UP)
/* PA2 / PA9 / PA10: USART1 */
ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0)
diff --git a/board/snoball/usb_pd_policy.c b/board/snoball/usb_pd_policy.c
deleted file mode 100644
index 2c65199180..0000000000
--- a/board/snoball/usb_pd_policy.c
+++ /dev/null
@@ -1,138 +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 "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_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_EXTERNAL | PDO_FIXED_DATA_SWAP)
-
-const uint32_t pd_src_pdo[] = {
- PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS),
- /* TODO: Add additional source modes when tested */
- /* PDO_FIXED(12000, 3000, PDO_FIXED_FLAGS), */
- /* PDO_FIXED(20000, 3000, PDO_FIXED_FLAGS), */
-};
-const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo);
-
-static const int pd_src_pdo_cnts[3] = {
- [SRC_CAP_5V] = 1,
- /* [SRC_CAP_12V] = 2, */
- /* [SRC_CAP_20V] = 3, */
-};
-
-static int pd_src_pdo_idx;
-
-int pd_get_source_pdo(const uint32_t **src_pdo)
-{
- *src_pdo = pd_src_pdo;
- return pd_src_pdo_cnts[pd_src_pdo_idx];
-}
-
-int pd_is_valid_input_voltage(int mv)
-{
- return 1;
-}
-
-void pd_transition_voltage(int idx)
-{
- /* No-operation: we are always 5V */
-}
-
-int pd_set_power_supply_ready(int port)
-{
- CPRINTS("Power supply ready/%d", port);
- return EC_SUCCESS; /* we are ready */
-}
-
-void pd_power_supply_reset(int port)
-{
- CPRINTS("Power supply reset/%d", port);
-}
-
-int pd_board_checks(void)
-{
- return EC_SUCCESS;
-}
-
-void pd_check_dr_role(int port, int dr_role, int flags)
-{
- /* If DFP, try to switch to UFP */
- if ((flags & PD_FLAGS_PARTNER_DR_DATA) && dr_role == PD_ROLE_DFP)
- pd_request_data_swap(port);
-}
-
-void pd_check_pr_role(int port, int pr_role, int flags)
-{
-}
-
-int pd_check_data_swap(int port, int data_role)
-{
- /* Allow data swap if we are a DFP, otherwise don't allow */
- return (data_role == PD_ROLE_DFP) ? 1 : 0;
-}
-
-void pd_execute_data_swap(int port, int data_role)
-{
- /* Do nothing */
-}
-
-/* ----------------- Vendor Defined Messages ------------------ */
-/* TODO: Add identify and GFU modes similar to Zinger */
-const struct svdm_response svdm_rsp = {
- .identity = NULL,
- .svids = NULL,
- .modes = NULL,
-};
-
-int pd_custom_vdm(int port, int cnt, uint32_t *payload,
- uint32_t **rpayload)
-{
- int cmd = PD_VDO_CMD(payload[0]);
- uint16_t dev_id = 0;
- int is_rw;
-
- /* make sure we have some payload */
- if (cnt == 0)
- return 0;
-
- switch (cmd) {
- case VDO_CMD_VERSION:
- /* guarantee last byte of payload is null character */
- *(payload + cnt - 1) = 0;
- CPRINTF("version: %s\n", (char *)(payload+1));
- break;
- case VDO_CMD_READ_INFO:
- case VDO_CMD_SEND_INFO:
- /* copy hash */
- if (cnt == 7) {
- dev_id = VDO_INFO_HW_DEV_ID(payload[6]);
- is_rw = VDO_INFO_IS_RW(payload[6]);
-
- CPRINTF("DevId:%d.%d SW:%d RW:%d\n",
- HW_DEV_ID_MAJ(dev_id),
- HW_DEV_ID_MIN(dev_id),
- VDO_INFO_SW_DBG_VER(payload[6]),
- is_rw);
- } else if (cnt == 6) {
- /* really old devices don't have last byte */
- pd_dev_store_rw_hash(port, dev_id, payload + 1,
- SYSTEM_IMAGE_UNKNOWN);
- }
- break;
- }
-
- return 0;
-}