aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2023-04-10 11:32:06 +0100
committerMarc Zyngier <maz@kernel.org>2023-04-10 11:32:06 +0100
commit98970a980bfec9fc8a18558142f64f9f629f53f6 (patch)
tree7c47f612b0d979eaf96e6902c22860bdf4e7f850
parent72c947a6cbd48c4df25278529a75aead8744126d (diff)
downloadcs-sw-98970a980bfec9fc8a18558142f64f9f629f53f6.tar.gz
Allow selection of Primary USB as the serial pin setpin-sets
Signed-off-by: Marc Zyngier <maz@kernel.org>
-rw-r--r--README.txt11
-rw-r--r--m1-pd-bmc.h2
-rw-r--r--vdmtool.c13
3 files changed, 24 insertions, 2 deletions
diff --git a/README.txt b/README.txt
index a7ac2c3..9e28cd0 100644
--- a/README.txt
+++ b/README.txt
@@ -88,6 +88,14 @@ doesn't). None of my cables labelled USB2.0 seem to work. I've had
good results with cables designed to carry video signals, and USB3.1
cables seem to do the trick.
+If you are stuck with a USB2.0 cable that doesn't have the SBU1/2
+signals, there is still a way to get a serial console by using the
+USB2.0 lines and connecting the SBU1 to USB_TX and SBU2 to USB_RX. On
+revision v2 of the board, this is only a matter of linking two sets of
+pins next to the micro-USB connector. In such a configuration, *DO NOT
+USE* the micro-USB connector *AT ALL* (put some tape or glue on it).
+If you don't know how to perform this change, please don't try.
+
Because I'm lazy, the hardware only connects a single CC line to the
board's PD controller, and there is no provision to swap TX and RX.
Which means that on the board side, there is only a single valid
@@ -109,7 +117,8 @@ No idea about other machines.
Optionally, you can make use of the micro-USB connector that is on
the other side of the board. It's main use it to allow interacting
-with the Asahi m1n1 firmware, such as tethered booting.
+with the Asahi m1n1 firmware, such as tethered booting. Do not connect
+it to anything if you use the USB2.0 lines as the serial console.
** Use it
diff --git a/m1-pd-bmc.h b/m1-pd-bmc.h
index d350c80..d93430a 100644
--- a/m1-pd-bmc.h
+++ b/m1-pd-bmc.h
@@ -46,7 +46,7 @@ void usb_tx_bytes(int32_t port, const char *ptr, int len);
void usb_tx_str(int32_t port, char *ptr);
int32_t usb_rx_byte(int32_t port);
-#define PRINTF_SIZE 256
+#define PRINTF_SIZE 512
#define __printf(__p, __f, ...) do { \
char __str[PRINTF_SIZE]; \
diff --git a/vdmtool.c b/vdmtool.c
index 48926c4..1376ed8 100644
--- a/vdmtool.c
+++ b/vdmtool.c
@@ -405,6 +405,13 @@ static void vdm_send_msg(struct vdm_context *cxt, const uint32_t *vdm, int nr_u3
fusb302_tcpm_transmit(PORT(cxt), TCPC_TX_SOP_DEBUG_PRIME_PRIME, hdr, vdm);
}
+static void vdm_pd_reset(struct vdm_context *cxt)
+{
+ uint32_t vdm[] = { 0x5ac8012, 0x0103, 0x8000<<16 };
+ vdm_send_msg(cxt, vdm, ARRAY_SIZE(vdm));
+ cprintf(cxt, ">VDM SET ACTION PD reset\n");
+}
+
static void vdm_claim_serial(struct vdm_context *cxt)
{
static const char *pinsets[] = {
@@ -448,6 +455,8 @@ static void help(struct vdm_context *cxt)
"^_ ^^ Central Scrutinizer reset to programming mode\n"
"^_ ^D Toggle debug\n"
"^_ ^M Send empty debug VDM\n"
+ "^_ 1 Serial on Primary USB pins\n"
+ "^_ 2 Serial on SBU pins\n"
"^_ ? This message\n");
for (int i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++)
cprintf(cxt, "Port %d: %s\n",
@@ -497,6 +506,10 @@ static bool serial_handler(struct vdm_context *cxt)
case '\r': /* Enter */
debug_poke(cxt);
break;
+ case '1' ... '2':
+ cxt->serial_pin_set = c - '0';
+ vdm_pd_reset(cxt);
+ break;
case '?':
help(cxt);
break;