[usbdev] Clean up confusing uses of "differential"

Explicitly refer to a receiver wherever "differential" is used with
"rx".

Previously, the term on RX would mean that an *external* differential
receiver would be used, delivering a *single-ended* data signal to the
IP. However, this top-level definition causes too much confusion.

Similarly, for TX, avoid using "differential" altogether, as neither the
driver nor the signals are truly differential. Instead, refer to the two
interfaces by the component signal names.

Signed-off-by: Alexander Williams <awill@google.com>
diff --git a/sw/device/lib/dif/dif_usbdev.c b/sw/device/lib/dif/dif_usbdev.c
index 1de79a4..89db6d0 100644
--- a/sw/device/lib/dif/dif_usbdev.c
+++ b/sw/device/lib/dif/dif_usbdev.c
@@ -233,7 +233,7 @@
   }
 
   // Check enum fields.
-  if (!is_valid_toggle(config.differential_rx) ||
+  if (!is_valid_toggle(config.have_differential_receiver) ||
       !is_valid_toggle(config.use_tx_d_se0) ||
       !is_valid_toggle(config.single_bit_eop) ||
       !is_valid_toggle(config.pin_flip) ||
@@ -244,14 +244,14 @@
   // Determine the value of the PHY_CONFIG register.
   uint32_t phy_config_val = 0;
 
-  if (config.differential_rx == kDifToggleEnabled) {
-    phy_config_val = bitfield_field32_write(
-        phy_config_val,
-        (bitfield_field32_t){
-            .mask = 1,
-            .index = USBDEV_PHY_CONFIG_RX_DIFFERENTIAL_MODE_BIT,
-        },
-        1);
+  if (config.have_differential_receiver == kDifToggleEnabled) {
+    phy_config_val =
+        bitfield_field32_write(phy_config_val,
+                               (bitfield_field32_t){
+                                   .mask = 1,
+                                   .index = USBDEV_PHY_CONFIG_USE_DIFF_RCVR_BIT,
+                               },
+                               1);
   }
 
   if (config.use_tx_d_se0 == kDifToggleEnabled) {
diff --git a/sw/device/lib/dif/dif_usbdev.h b/sw/device/lib/dif/dif_usbdev.h
index 46b7240..4c7a57c 100644
--- a/sw/device/lib/dif/dif_usbdev.h
+++ b/sw/device/lib/dif/dif_usbdev.h
@@ -123,9 +123,10 @@
  */
 typedef struct dif_usbdev_config {
   /**
-   * Use the differential rx signal instead of the single-ended signals.
+   * Activate the single-ended D signal for detecting K and J symbols, for use
+   * with a differential receiver.
    */
-  dif_toggle_t differential_rx;
+  dif_toggle_t have_differential_receiver;
   /**
    * Use the TX interface with D and SE0 signals instead of Dp/Dn, for use with
    * certain transceivers.
diff --git a/sw/device/lib/usbdev.c b/sw/device/lib/usbdev.c
index 9de3848..63e1689 100644
--- a/sw/device/lib/usbdev.c
+++ b/sw/device/lib/usbdev.c
@@ -299,7 +299,7 @@
       (1 << USBDEV_USBCTRL_ENABLE_BIT);
 }
 
-void usbdev_init(usbdev_ctx_t *ctx, bool pinflip, bool diff_rx,
+void usbdev_init(usbdev_ctx_t *ctx, bool pinflip, bool en_diff_rcvr,
                  bool tx_use_d_se0) {
   // setup context
   for (int i = 0; i < NUM_ENDPOINTS; i++) {
@@ -326,11 +326,10 @@
   REG32(USBDEV_BASE_ADDR + USBDEV_IN_STALL_REG_OFFSET) = 0;
   REG32(USBDEV_BASE_ADDR + USBDEV_OUT_STALL_REG_OFFSET) = 0;
 
-  uint32_t phy_config =
-      (pinflip << USBDEV_PHY_CONFIG_PINFLIP_BIT) |
-      (diff_rx << USBDEV_PHY_CONFIG_RX_DIFFERENTIAL_MODE_BIT) |
-      (tx_use_d_se0 << USBDEV_PHY_CONFIG_TX_USE_D_SE0_BIT) |
-      (1 << USBDEV_PHY_CONFIG_EOP_SINGLE_BIT_BIT);
+  uint32_t phy_config = (pinflip << USBDEV_PHY_CONFIG_PINFLIP_BIT) |
+                        (en_diff_rcvr << USBDEV_PHY_CONFIG_USE_DIFF_RCVR_BIT) |
+                        (tx_use_d_se0 << USBDEV_PHY_CONFIG_TX_USE_D_SE0_BIT) |
+                        (1 << USBDEV_PHY_CONFIG_EOP_SINGLE_BIT_BIT);
   REG32(USBDEV_BASE_ADDR + USBDEV_PHY_CONFIG_REG_OFFSET) = phy_config;
 }
 
diff --git a/sw/device/lib/usbdev.h b/sw/device/lib/usbdev.h
index b8f356e..54fa3ba 100644
--- a/sw/device/lib/usbdev.h
+++ b/sw/device/lib/usbdev.h
@@ -239,11 +239,13 @@
  *
  * @param ctx uninitialized usbdev context pointer
  * @param pinflip boolean to indicate if PHY should be configured for D+/D- flip
- * @param diff_rx boolean to indicate if PHY uses differential RX
+ * @param en_diff_rcvr boolean to indicate if PHY should enable an external
+ *                     differential receiver, activating the single-ended D
+ *                     input
  * @param tx_use_d_se0 boolean to indicate if PHY uses D/SE0 for TX instead of
  *                     Dp/Dn
  */
-void usbdev_init(usbdev_ctx_t *ctx, bool pinflip, bool diff_rx,
+void usbdev_init(usbdev_ctx_t *ctx, bool pinflip, bool en_diff_rcvr,
                  bool tx_use_d_se0);
 
 /**
diff --git a/sw/device/tests/usbdev_test.c b/sw/device/tests/usbdev_test.c
index 4d48502..2102034 100644
--- a/sw/device/tests/usbdev_test.c
+++ b/sw/device/tests/usbdev_test.c
@@ -108,7 +108,7 @@
   // Call `usbdev_init` here so that DPI will not start until the
   // simulation has finished all of the printing, which takes a while
   // if `--trace` was passed in.
-  usbdev_init(&usbdev, /* pinflip= */ false, /* rx_diff= */ false,
+  usbdev_init(&usbdev, /* pinflip= */ false, /* en_diff_rcvr= */ false,
               /* tx_use_d_se0= */ false);
   usb_controlep_init(&usbdev_control, &usbdev, 0, config_descriptors,
                      sizeof(config_descriptors));