diff options
l--------- | board/minimuffin | 1 | ||||
-rw-r--r-- | board/zinger/board.h | 12 | ||||
-rw-r--r-- | board/zinger/usb_pd_policy.c | 21 | ||||
-rw-r--r-- | chip/stm32/config-stm32f03x.h | 3 | ||||
-rw-r--r-- | chip/stm32/usb_pd_phy.c | 2 | ||||
-rw-r--r-- | include/config.h | 3 | ||||
-rwxr-xr-x | util/flash_ec | 1 |
7 files changed, 32 insertions, 11 deletions
diff --git a/board/minimuffin b/board/minimuffin new file mode 120000 index 0000000000..caf3ff6e0a --- /dev/null +++ b/board/minimuffin @@ -0,0 +1 @@ +zinger/
\ No newline at end of file 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); diff --git a/chip/stm32/config-stm32f03x.h b/chip/stm32/config-stm32f03x.h index e7a4a6b3ed..32238c5361 100644 --- a/chip/stm32/config-stm32f03x.h +++ b/chip/stm32/config-stm32f03x.h @@ -31,8 +31,7 @@ * Put pstate after RO to give RW more space and make RO write protect region * contiguous. */ -#ifdef BOARD_ZINGER -/* Do not use pstate for zinger. Flash space is limited */ +#if defined(BOARD_ZINGER) || defined(BOARD_MINIMUFFIN) #define CONFIG_FW_PSTATE_SIZE 0 #else #define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE diff --git a/chip/stm32/usb_pd_phy.c b/chip/stm32/usb_pd_phy.c index a19bcc7969..041d5b5c58 100644 --- a/chip/stm32/usb_pd_phy.c +++ b/chip/stm32/usb_pd_phy.c @@ -456,7 +456,7 @@ void pd_rx_handler(void) } } } -#ifndef BOARD_ZINGER +#ifdef CONFIG_USB_PD_RX_COMP_IRQ DECLARE_IRQ(STM32_IRQ_COMP, pd_rx_handler, 1); #endif diff --git a/include/config.h b/include/config.h index 7902a39639..897478ac18 100644 --- a/include/config.h +++ b/include/config.h @@ -1019,6 +1019,9 @@ /* Define to have PD state machine send read info VDM on connection */ #undef CONFIG_USB_PD_READ_INFO_ON_CONNECT +/* Use comparator module for PD RX interrupt */ +#define CONFIG_USB_PD_RX_COMP_IRQ + /* USB PD transmit uses SPI master */ #undef CONFIG_USB_PD_TX_USES_SPI_MASTER diff --git a/util/flash_ec b/util/flash_ec index 7282381eb9..ec35591481 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -74,6 +74,7 @@ BOARDS_STM32=( spring veyron zinger + minimuffin ) BOARDS_STM32_PROG_EN=( |