meta-facebook: minerva: send command for enable POE

Initial setting the UART device and send power source configuration command to STM32F for enable POE.

Change-Id: Ic9adab1f9cd36a5aff6aac420c3da3bcc93ec706
Signed-off-by: Yang Chen <yang.chen@quantatw.com>
diff --git a/meta-facebook/meta-minerva/recipes-phosphor/console/obmc-console/80-minerva-obmc-console-uart.rules b/meta-facebook/meta-minerva/recipes-phosphor/console/obmc-console/80-minerva-obmc-console-uart.rules
index 2b236f7..9f39f46 100644
--- a/meta-facebook/meta-minerva/recipes-phosphor/console/obmc-console/80-minerva-obmc-console-uart.rules
+++ b/meta-facebook/meta-minerva/recipes-phosphor/console/obmc-console/80-minerva-obmc-console-uart.rules
@@ -1 +1,5 @@
 SUBSYSTEM=="tty", ATTRS{iomem_base}=="0x1E790000", ENV{SYSTEMD_WANTS}="obmc-console@ttyS5", TAG+="systemd"
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011"
+SUBSYSTEM=="tty", ATTRS{bInterfaceNumber}=="03", SYMLINK+="ttyPOE"
+SUBSYSTEM=="tty", ATTRS{bInterfaceNumber}=="02", SYMLINK+="ttyRS485-1"
+SUBSYSTEM=="tty", ATTRS{bInterfaceNumber}=="01", SYMLINK+="ttyRS485-0"
diff --git a/meta-facebook/meta-minerva/recipes-phosphor/initrdscripts/phosphor-static-norootfs-init/99-platform-init b/meta-facebook/meta-minerva/recipes-phosphor/initrdscripts/phosphor-static-norootfs-init/99-platform-init
index d9def86..c40e647 100644
--- a/meta-facebook/meta-minerva/recipes-phosphor/initrdscripts/phosphor-static-norootfs-init/99-platform-init
+++ b/meta-facebook/meta-minerva/recipes-phosphor/initrdscripts/phosphor-static-norootfs-init/99-platform-init
@@ -20,4 +20,39 @@
     echo "0" > "$SLOT_FILE"
 fi
 
+# Below is the diagram of the smart valve implemtation on the CMM.
+# There are two end-device for smart valve and two communication interfaces.
+# One is Modbus (RS485) interface connected to FT4232H channel 1, 2.
+# Anorther is by ethernet interface which is connected to Marvell 88E6369X switch.
+# The PoE interface is connected to STM32F + BCM59011 PoE controller (Broadcom solution) for PoE power supply.
+# BMC can control the PoE power supply by sending command to STM32F via RS232.
+#
+# Diagram:
+#   D_485_x = End device for smart valve x via RS485
+#   D_POE_x = End device for smart valve x via PoE
+#
+#  +----------+                       +-------------+
+#  | FT4232H  |   <----- USB ---->    |     BMC     |
+#  +----------+                       +-------------+
+#   /   |   \    \                           |
+#  ch0  ch1  ch2 ch3                        RMII
+#   |    |     |   \                         |
+#   X    (RS485)    RS232             +-------------+
+#        /     \        \             |    Marvell  |
+#       /       \        \            |   88E6369X  |
+#|D_485_0|   |D_485_1|   |STM32F|     +-------------+
+#                           |            |       |
+#                          i2c           |       |
+#                           |            |       |
+#                        |BCM59011|      1000 Base-T
+#                           |            |        |
+#                           |(power      |(data   |(data
+#                           |            |        |
+#                        P54 POE----->|D_POE_0| |D_POE_1|
+POE_DEV="/dev/ttyPOE"
+# Set baud rate to 19200 and raw mode
+stty -F $POE_DEV 19200 raw
+# Send Power Source Configuration Command (0x18) to STM32F for enable PoE
+echo -e '\x18\x00\x00\x2c\x01\x00\x00\xff\xff\xff\xff\x41' > $POE_DEV
+
 exit 0