Add support for Reston debug interface

Allow to flash the STM32 over the built-in FT230X chip
and use the serial port.

BUG=none
TEST=launch servod, flash_ec and serial console
Change-Id: I7d66ca81a5c28f3989adbee931b163264c914e28
Reviewed-on: https://chromium-review.googlesource.com/174308
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
diff --git a/servo/data/reston.xml b/servo/data/reston.xml
new file mode 100644
index 0000000..97fab57
--- /dev/null
+++ b/servo/data/reston.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<root>
+  <include>
+    <name>common.xml</name>
+  </include>
+  <!-- STM32 UART -->
+  <control>
+    <name>ec_uart_pty</name>
+    <doc>Pseudo-terminal (pty) thats connected to uart console</doc>
+    <params cmd="get" interface="2" subtype="pty" drv="uart">
+    </params>
+  </control>
+  <control>
+    <name>ec_uart_baudrate</name>
+    <doc>Baudrate for CPU's uart console</doc>
+    <params drv="uart" subtype="props" line_prop="baudrate"
+    interface="2"></params>
+  </control>
+  <control>
+    <name>ec_uart_parity</name>
+    <doc>Parity for CPU's uart console</doc>
+    <params drv="uart" subtype="props" line_prop="parity"
+    interface="2" map="uart_parity"></params>
+  </control>
+  <control>
+    <name>ec_uart_sbits</name>
+    <doc>Number of stop bits for CPU's uart console</doc>
+    <params drv="uart" subtype="props" line_prop="sbits"
+    interface="2" map="uart_sbits"></params>
+  </control>
+  <control>
+    <name>ec_uart_bits</name>
+    <doc>Number of data bits for CPU's uart console</doc>
+    <params drv="uart" subtype="props" line_prop="bits"
+    interface="2" map="uart_bits"></params>
+  </control>
+  <!-- GPIOS -->
+  <control>
+    <name>boot_mode</name>
+    <doc>EC monitor mode gpio</doc>
+    <params interface="1" drv="gpio" offset="0" map="yesno">
+    </params>
+  </control>
+  <control>
+    <name>cold_reset</name>
+    <doc>STM32 reset line</doc>
+    <params interface="1" drv="gpio" offset="1" map="onoff_i" od="PU">
+    </params>
+  </control>
+</root>
diff --git a/servo/ftdi_common.py b/servo/ftdi_common.py
index a9300dd..ce70c85 100644
--- a/servo/ftdi_common.py
+++ b/servo/ftdi_common.py
@@ -30,6 +30,7 @@
      'servo_v2': [0x5002],
      'servo_v3': [0x5004, 0x6014],
      'toad_v1': [0x6015], #Vendor ID is 0x403 : FTDI
+     'reston': [0x5007],
      }
 
 SERVO_CONFIG_DEFAULTS = \
@@ -39,6 +40,7 @@
      'servo_v2': ['servo_v2_r1.xml'],
      'servo_v3': ['servo_v3_r0.xml'],
      'toad_v1': ['toad.xml'],
+     'reston': ['reston.xml'],
      }
 
 class FtdiContext(ctypes.Structure):
diff --git a/servo/servo_interfaces.py b/servo/servo_interfaces.py
index c9ef1c1..149f6a5 100644
--- a/servo/servo_interfaces.py
+++ b/servo/servo_interfaces.py
@@ -50,3 +50,10 @@
   INTERFACE_DEFAULTS[vid][pid] = ['ftdi_gpiouart']
 
 SERVO_ID_DEFAULTS.extend(TOAD_ID_DEFAULTS)
+
+# Reston
+RESTON_ID_DEFAULTS = [(0x18d1, 0x5007)]
+for vid, pid in RESTON_ID_DEFAULTS:
+  INTERFACE_DEFAULTS[vid][pid] = ['ftdi_gpiouart']
+
+SERVO_ID_DEFAULTS.extend(RESTON_ID_DEFAULTS)