summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-01-06 11:00:36 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-15 01:07:02 +0000
commit4e75e20f4ec5cecda6742d821b1a4484952fd07e (patch)
tree210a7f79055092da7b180a27a67f7d3331b339ee /board
parent389ef0f90ff9318ced905d7a1ed8c025953aebc3 (diff)
downloadchrome-ec-4e75e20f4ec5cecda6742d821b1a4484952fd07e.tar.gz
Add PD events logging
Add a FIFO to log important events on the PD MCU and coming from the PD accessories. The retrieval of the accessories log from the accessories by the PD MCU is not implemented yet. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:32785 TEST=execute "ectool --name=cros_pd pdlog" before and after plugging Zinger charger. Change-Id: If96d73e711ff6ad64cfb99bd3e4d2d8f2643f19a Reviewed-on: https://chromium-review.googlesource.com/238854 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/dingdong/board.h2
-rw-r--r--board/dingdong/usb_pd_policy.c13
-rw-r--r--board/hoho/board.h2
-rw-r--r--board/hoho/usb_pd_policy.c13
-rw-r--r--board/samus_pd/board.h2
-rw-r--r--board/zinger/board.h2
-rw-r--r--board/zinger/runtime.c10
-rw-r--r--board/zinger/usb_pd_policy.c3
8 files changed, 43 insertions, 4 deletions
diff --git a/board/dingdong/board.h b/board/dingdong/board.h
index 6247ae5fcc..666ab2699e 100644
--- a/board/dingdong/board.h
+++ b/board/dingdong/board.h
@@ -36,6 +36,8 @@
#define CONFIG_USB_PD_IDENTITY_HW_VERS 1
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
#define CONFIG_USB_PD_NO_VBUS_DETECT
+#define CONFIG_USB_PD_LOGGING
+#define CONFIG_USB_PD_LOG_SIZE 256
#undef CONFIG_WATCHDOG_HELP
#undef CONFIG_LID_SWITCH
#undef CONFIG_TASK_PROFILING
diff --git a/board/dingdong/usb_pd_policy.c b/board/dingdong/usb_pd_policy.c
index 5c14e4a6da..520732cd26 100644
--- a/board/dingdong/usb_pd_policy.c
+++ b/board/dingdong/usb_pd_policy.c
@@ -244,8 +244,17 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
*rpayload = payload;
rsize = pd_custom_flash_vdm(port, cnt, payload);
- if (!rsize)
- return 0;
+ if (!rsize) {
+ int cmd = PD_VDO_CMD(payload[0]);
+ switch (cmd) {
+ case VDO_CMD_GET_LOG:
+ rsize = pd_vdm_get_log_entry(payload);
+ break;
+ default:
+ /* Unknown : do not answer */
+ return 0;
+ }
+ }
/* respond (positively) to the request */
payload[0] |= VDO_SRC_RESPONDER;
diff --git a/board/hoho/board.h b/board/hoho/board.h
index 74e3951b53..58dc4db20a 100644
--- a/board/hoho/board.h
+++ b/board/hoho/board.h
@@ -42,6 +42,8 @@
#define CONFIG_USB_PD_INTERNAL_COMP
#define CONFIG_USB_PD_IDENTITY_HW_VERS 1
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
+#define CONFIG_USB_PD_LOGGING
+#define CONFIG_USB_PD_LOG_SIZE 256
#define CONFIG_USB_PD_NO_VBUS_DETECT
/* mcdp2850 serial interface */
#define CONFIG_MCDP28X0 usart3_hw
diff --git a/board/hoho/usb_pd_policy.c b/board/hoho/usb_pd_policy.c
index 9ecfd38611..efd1bbc243 100644
--- a/board/hoho/usb_pd_policy.c
+++ b/board/hoho/usb_pd_policy.c
@@ -243,8 +243,17 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
*rpayload = payload;
rsize = pd_custom_flash_vdm(port, cnt, payload);
- if (!rsize)
- return 0;
+ if (!rsize) {
+ int cmd = PD_VDO_CMD(payload[0]);
+ switch (cmd) {
+ case VDO_CMD_GET_LOG:
+ rsize = pd_vdm_get_log_entry(payload);
+ break;
+ default:
+ /* Unknown : do not answer */
+ return 0;
+ }
+ }
/* respond (positively) to the request */
payload[0] |= VDO_SRC_RESPONDER;
diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h
index c3ee3a1b39..6df6a4f0ff 100644
--- a/board/samus_pd/board.h
+++ b/board/samus_pd/board.h
@@ -45,6 +45,8 @@
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_FLASH_ERASE_CHECK
#define CONFIG_USB_PD_INTERNAL_COMP
+#define CONFIG_USB_PD_LOGGING
+#define CONFIG_USB_PD_LOG_SIZE 512
#define CONFIG_USB_SWITCH_PI3USB9281
#undef CONFIG_USB_SWITCH_PI3USB9281_MUX_GPIO
#define CONFIG_USB_SWITCH_PI3USB9281_MUX_GPIO GPIO_USB_C_BC12_SEL
diff --git a/board/zinger/board.h b/board/zinger/board.h
index e307c6ff27..8eba23e214 100644
--- a/board/zinger/board.h
+++ b/board/zinger/board.h
@@ -51,6 +51,8 @@
#define CONFIG_USB_PD_CUSTOM_VDM
#undef CONFIG_USB_PD_DUAL_ROLE
#undef CONFIG_USB_PD_INTERNAL_COMP
+#define CONFIG_USB_PD_LOGGING
+#define CONFIG_USB_PD_LOG_SIZE 256
#undef CONFIG_USB_PD_RX_COMP_IRQ
#define CONFIG_USB_PD_SIMPLE_DFP
#undef CONFIG_WATCHDOG_HELP
diff --git a/board/zinger/runtime.c b/board/zinger/runtime.c
index 9d644e763a..0dfb51aed4 100644
--- a/board/zinger/runtime.c
+++ b/board/zinger/runtime.c
@@ -56,6 +56,16 @@ void task_clear_pending_irq(int irq)
CPU_NVIC_UNPEND(0) = 1 << irq;
}
+void interrupt_disable(void)
+{
+ asm("cpsid i");
+}
+
+void interrupt_enable(void)
+{
+ asm("cpsie i");
+}
+
uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
{
last_event = event;
diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c
index 59c49012d3..a228712290 100644
--- a/board/zinger/usb_pd_policy.c
+++ b/board/zinger/usb_pd_policy.c
@@ -554,6 +554,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
payload[1] = ADC_TO_CURR_MA(vbus_amp);
rsize = 2;
break;
+ case VDO_CMD_GET_LOG:
+ rsize = pd_vdm_get_log_entry(payload);
+ break;
default:
/* Unknown : do not answer */
return 0;