summaryrefslogtreecommitdiff
path: root/board/zinger
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-09-30 17:19:50 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-02 20:51:10 +0000
commit0330d9adf2602c44201d5e1b842747caf7dd83b1 (patch)
tree29f7a8613e0090f8ff9d224faae5d299131b2116 /board/zinger
parent4be45e962cba218c07944dd97935361be9017224 (diff)
downloadchrome-ec-0330d9adf2602c44201d5e1b842747caf7dd83b1.tar.gz
zinger: minimuffin: add board support for minimuffin
Minimuffin is identical to zinger, same MCU, same gpio, same circuitry aroundt the MCU with two differences: - Rated current is 2.25A instead of 3A - USB PD hardware device ID needs to be different so that host can differentiate between the two. Due to the similarity between the two, minimuffin is defined as a symlink to the zinger board. BUG=none BRANCH=samus TEST=make BOARD=minimuffin load onto a zinger and verify that samus reads device ID correctly and limits input current limit to 2.25mA. Change-Id: Ie39ec43262c7d14663eb68abff073bfeec451a24 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220689 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/zinger')
-rw-r--r--board/zinger/board.h12
-rw-r--r--board/zinger/usb_pd_policy.c21
2 files changed, 25 insertions, 8 deletions
diff --git a/board/zinger/board.h b/board/zinger/board.h
index 639991be33..daca59de8f 100644
--- a/board/zinger/board.h
+++ b/board/zinger/board.h
@@ -3,7 +3,10 @@
* found in the LICENSE file.
*/
-/* Tiny charger configuration */
+/*
+ * Tiny charger configuration. This config is used for multiple boards
+ * including zinger and minimuffin.
+ */
#ifndef __BOARD_H
#define __BOARD_H
@@ -19,6 +22,7 @@
#undef CONFIG_USB_PD_DUAL_ROLE
#undef CONFIG_USB_PD_INTERNAL_COMP
#define CONFIG_USB_PD_CUSTOM_VDM
+#undef CONFIG_USB_PD_RX_COMP_IRQ
#define CONFIG_HW_CRC
#define CONFIG_SHA1
#undef CONFIG_WATCHDOG_HELP
@@ -43,7 +47,13 @@
#define UARTN_BASE STM32_USART_BASE(CONFIG_UART_CONSOLE)
/* USB PD ChromeOS VDM information */
+#if defined(BOARD_ZINGER)
#define USB_PD_HARDWARE_DEVICE_ID 1
+#elif defined(BOARD_MINIMUFFIN)
+#define USB_PD_HARDWARE_DEVICE_ID 2
+#else
+#error "Board does not have a USB-PD HW Device ID"
+#endif
#ifndef __ASSEMBLER__
diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c
index 6ef6fee461..bc2a0ede3b 100644
--- a/board/zinger/usb_pd_policy.c
+++ b/board/zinger/usb_pd_policy.c
@@ -88,10 +88,17 @@ static timestamp_t fault_deadline;
/* convert raw ADC value to mV */
#define ADC_TO_VOLT_MV(vbus) ((vbus)*VOLT_DIV*VDDA_MV/ADC_SCALE)
-/* Max current : 20% over 3A = 3.6A */
-#define MAX_CURRENT VBUS_MA(3600)
-/* Fast short circuit protection : 4.5A */
-#define MAX_CURRENT_FAST VBUS_MA(4500)
+/* Max current */
+#if defined(BOARD_ZINGER)
+#define RATED_CURRENT 3000
+#elif defined(BOARD_MINIMUFFIN)
+#define RATED_CURRENT 2250
+#endif
+
+/* Max current : 20% over rated current */
+#define MAX_CURRENT VBUS_MA(RATED_CURRENT * 6/5)
+/* Fast short circuit protection : 50% over rated current */
+#define MAX_CURRENT_FAST VBUS_MA(RATED_CURRENT * 3/2)
/* reset over-current after 1 second */
#define OCP_TIMEOUT SECOND
@@ -143,9 +150,9 @@ static void discharge_voltage(int target_volt)
/* Power Delivery Objects */
const uint32_t pd_src_pdo[] = {
PDO_FIXED(5000, 500, PDO_FIXED_EXTERNAL),
- PDO_FIXED(5000, 3000, 0),
- PDO_FIXED(12000, 3000, 0),
- PDO_FIXED(20000, 3000, 0),
+ PDO_FIXED(5000, RATED_CURRENT, 0),
+ PDO_FIXED(12000, RATED_CURRENT, 0),
+ PDO_FIXED(20000, RATED_CURRENT, 0),
};
const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo);