summaryrefslogtreecommitdiff
path: root/board/twinkie
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-05-11 17:31:16 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-27 02:39:41 +0000
commit5b5f737d8f6f1be15d4ab5f42f290d20576307c4 (patch)
treebe384973f533436d9a53c46b742be35f5b377a4f /board/twinkie
parent25ce43fc3d35669500d74e44f3b7c96302ee2ade (diff)
downloadchrome-ec-5b5f737d8f6f1be15d4ab5f42f290d20576307c4.tar.gz
pd: move non-phy layer config out of usb_pd_config.h
Move parts of usb_pd_config.h that are not part of the phy layer out of usb_pd_config.h and into board.h. This cleans up the division between the TCPC and TCPM as only the TCPC needs to use usb_pd_config.h. Also cleans up the use of the CC detection voltage thresholds by creating standard macros to use based on Rp strength for the board. BUG=none BRANCH=none TEST=make -j buildall Change-Id: I946cceb38bea8233095b8a4b287102bb8a3a296d Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/270337 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/twinkie')
-rw-r--r--board/twinkie/board.h18
-rw-r--r--board/twinkie/injector.c1
-rw-r--r--board/twinkie/usb_pd_config.h34
-rw-r--r--board/twinkie/usb_pd_policy.c6
4 files changed, 24 insertions, 35 deletions
diff --git a/board/twinkie/board.h b/board/twinkie/board.h
index d8550ff9cd..3181be1a2d 100644
--- a/board/twinkie/board.h
+++ b/board/twinkie/board.h
@@ -21,6 +21,7 @@
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_INTERNAL_COMP
+#define CONFIG_USB_PD_PORT_COUNT 1
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
#define CONFIG_PD_USE_DAC_AS_REF
@@ -96,6 +97,23 @@ enum usb_strings {
USB_STR_COUNT
};
+/* Standard-current Rp */
+#define PD_SRC_VNC PD_SRC_DEF_VNC_MV
+#define PD_SRC_RD_THRESHOLD PD_SRC_DEF_RD_THRESH_MV
+
+/* start as a sink in case we have no other power supply/battery */
+#define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED
+
+/* delay necessary for the voltage transition on the power supply */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* 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
+
#endif /* !__ASSEMBLER__ */
/* USB interface indexes (use define rather than enum to expand them) */
diff --git a/board/twinkie/injector.c b/board/twinkie/injector.c
index 6c5116c9e6..62e1ccd940 100644
--- a/board/twinkie/injector.c
+++ b/board/twinkie/injector.c
@@ -62,7 +62,6 @@ static const struct res_cfg {
{GPIO_C, 0x8000, GPIO_OUT_HIGH} } },
};
-#define PD_SRC_RD_THRESHOLD 200 /* mV */
#define CC_RA(cc) (cc < PD_SRC_RD_THRESHOLD)
#define CC_RD(cc) ((cc > PD_SRC_RD_THRESHOLD) && (cc < PD_SRC_VNC))
#define GET_POLARITY(cc1, cc2) (CC_RD(cc2) || CC_RA(cc1))
diff --git a/board/twinkie/usb_pd_config.h b/board/twinkie/usb_pd_config.h
index 7645d7500b..73cb7b578f 100644
--- a/board/twinkie/usb_pd_config.h
+++ b/board/twinkie/usb_pd_config.h
@@ -10,15 +10,6 @@
#include "ina2xx.h"
-/* Port and task configuration */
-#define PD_PORT_COUNT 1
-#ifdef HAS_TASK_PD /* PD message injector mode */
-#define PORT_TO_TASK_ID(port) TASK_ID_PD
-#else
-#define PORT_TO_TASK_ID(port) -1
-#endif
-#define TASK_ID_TO_PORT(id) 0
-
/* Timer selection for baseband PD communication */
#define TIM_CLOCK_PD_TX_C0 17
#define TIM_CLOCK_PD_RX_C0 1
@@ -186,29 +177,4 @@ static inline int pd_adc_read(int port, int cc)
return adc_read_channel(ADC_CH_CC2_PD);
}
-static inline int pd_snk_is_vbus_provided(int port)
-{
- /* assume the alert was programmed to detect bus voltage above 4.5V */
- return (gpio_get_level(GPIO_VBUS_ALERT_L) == 0);
-}
-
-/* Standard-current DFP : no-connect voltage is 1.55V */
-#define PD_SRC_VNC 1550 /* mV */
-
-/* UFP-side : threshold for DFP connection detection */
-#define PD_SNK_VA 200 /* mV */
-
-/* start as a sink in case we have no other power supply/battery */
-#define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED
-
-/* delay necessary for the voltage transition on the power supply */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* 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
-
#endif /* __USB_PD_CONFIG_H */
diff --git a/board/twinkie/usb_pd_policy.c b/board/twinkie/usb_pd_policy.c
index 8b19031f32..0553bdad3c 100644
--- a/board/twinkie/usb_pd_policy.c
+++ b/board/twinkie/usb_pd_policy.c
@@ -89,6 +89,12 @@ void pd_power_supply_reset(int port)
{
}
+int pd_snk_is_vbus_provided(int port)
+{
+ /* assume the alert was programmed to detect bus voltage above 4.5V */
+ return (gpio_get_level(GPIO_VBUS_ALERT_L) == 0);
+}
+
int pd_board_checks(void)
{
return EC_SUCCESS;