<div dir="ltr">Looks good to me.<div>Thanks for working on this!</div><div><br></div><div>--Mario</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">În lun., 7 iun. 2021 la 10:54, Sunny Wang <<a href="mailto:Sunny.Wang@arm.com">Sunny.Wang@arm.com</a>> a scris:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This change is based on edk2-platforms-raspberrypi-pl011-bth-noflow.diff<br>
in <a href="https://github.com/worproject/RPi-Bluetooth-Testing/" rel="noreferrer" target="_blank">https://github.com/worproject/RPi-Bluetooth-Testing/</a> with the<br>
modifications and additional changes below for enabling Bluetooth<br>
and serial port (Mini UART) in Windows IOT.<br>
  - Remove RPIQ connection for BT_ON/OFF in Uart.asl because it is<br>
    useless. The firmware already turns on the Bluetooth by default.<br>
  - Move the GPIO pin muxing stuff from Uart.asl to ConfigDxe driver.<br>
<br>
Testing Done:<br>
  - Successfully booted Windows Windows 10 IOT (20279.1) on SD (made by<br>
    WOR) with the RPi-Windows-Drivers release ver 0.5 downloaded from<br>
    <a href="https://github.com/worproject/RPi-Windows-Drivers/releases" rel="noreferrer" target="_blank">https://github.com/worproject/RPi-Windows-Drivers/releases</a><br>
    and checked that both Bluetooth and serial port (Mini UART) can<br>
    work fine.<br>
  - Successfully booted VMware ESXi-Arm Fling v1.3 with only serial<br>
    console connection (PL011 UART).<br>
<br>
Cc: Samer El-Haj-Mahmoud <<a href="mailto:samer.el-haj-mahmoud@arm.com" target="_blank">samer.el-haj-mahmoud@arm.com</a>><br>
Cc: Sami Mujawar <<a href="mailto:sami.mujawar@arm.com" target="_blank">sami.mujawar@arm.com</a>><br>
Cc: Jeremy Linton <<a href="mailto:jeremy.linton@arm.com" target="_blank">jeremy.linton@arm.com</a>><br>
Cc: Pete Batard <<a href="mailto:pete@akeo.ie" target="_blank">pete@akeo.ie</a>><br>
Cc: Ard Biesheuvel <<a href="mailto:ardb%2Btianocore@kernel.org" target="_blank">ardb+tianocore@kernel.org</a>><br>
Cc: Mario Bălănică <<a href="mailto:mariobalanica02@gmail.com" target="_blank">mariobalanica02@gmail.com</a>><br>
Signed-off-by: Sunny Wang <<a href="mailto:sunny.wang@arm.com" target="_blank">sunny.wang@arm.com</a>><br>
---<br>
 Platform/RaspberryPi/AcpiTables/Uart.asl      | 16 --------------<br>
 .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 22 +++++++++++++++++++<br>
 2 files changed, 22 insertions(+), 16 deletions(-)<br>
<br>
diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryPi/AcpiTables/Uart.asl<br>
index bac9d791eb..167f94e889 100644<br>
--- a/Platform/RaspberryPi/AcpiTables/Uart.asl<br>
+++ b/Platform/RaspberryPi/AcpiTables/Uart.asl<br>
@@ -71,14 +71,6 @@ Device (URTM)<br>
     MEMORY32FIXED (ReadWrite, 0, BCM2836_MINI_UART_LENGTH, RMEM)<br>
     Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_MINI_UART_INTERRUPT }<br>
<br>
-    // NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART muxing<br>
-    // until a proper solution can be created for the dmap conflict.<br>
-    // When muxing is enabled, must consider DBG2 table conflict.<br>
-    // The alternate function resource needs to be reserved when<br>
-    // the kernel debugger is enabled to prevent another client<br>
-    // from muxing the pins away.<br>
-<br>
-    // PinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 14, 15 }<br>
   })<br>
   Method (_CRS, 0x0, Serialized)<br>
   {<br>
@@ -143,10 +135,6 @@ Device(BTH0)<br>
       UAR0,          // DescriptorName: creates name<br>
                     //   for offset of resource descriptor<br>
     )                // Vendor data<br>
-    //<br>
-    // RPIQ connection for BT_ON/OFF<br>
-    //<br>
-    GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GDV0.RPIQ", 0, ResourceConsumer, , ) { 128 }<br>
   })<br>
<br>
   //<br>
@@ -190,10 +178,6 @@ Device(BTH0)<br>
       UARM,          // DescriptorName: creates name<br>
                     //   for offset of resource descriptor<br>
     )                // Vendor data<br>
-    //<br>
-    // RPIQ connection for BT_ON/OFF<br>
-    //<br>
-    GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GDV0.RPIQ", 0, ResourceConsumer, , ) { 128 }<br>
   })<br>
<br>
   Method (_CRS, 0x0, Serialized)<br>
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c<br>
index d6efb59793..cf9880bd20 100644<br>
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c<br>
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c<br>
@@ -618,6 +618,28 @@ ApplyVariables (<br>
     DEBUG ((DEBUG_INFO, "Fan enabled on GPIO %d\n", FanOnGpio));<br>
     GpioPinFuncSet (FanOnGpio, GPIO_FSEL_OUTPUT);<br>
   }<br>
+<br>
+  //<br>
+  // Fake the CTS signal as we don't support HW flow control yet.<br>
+  // Pin 31 must be held LOW so that we can talk to the BT chip<br>
+  // without flow control<br>
+  //<br>
+  GpioPinFuncSet (31, GPIO_FSEL_OUTPUT);<br>
+  GpioPinConfigure (31, CLEAR_GPIO);<br>
+<br>
+  //<br>
+  // Bluetooth pin muxing<br>
+  //<br>
+  if ((PcdGet32 (PcdUartInUse) == PL011_UART_IN_USE)) {<br>
+    DEBUG ((DEBUG_INFO, "Enable Bluetooth over MiniUART\n"));<br>
+    GpioPinFuncSet (32, GPIO_FSEL_ALT5);<br>
+    GpioPinFuncSet (33, GPIO_FSEL_ALT5);<br>
+  } else {<br>
+    DEBUG ((DEBUG_INFO, "Enable Bluetooth over PL011 UART\n"));<br>
+    GpioPinFuncSet (32, GPIO_FSEL_ALT3);<br>
+    GpioPinFuncSet (33, GPIO_FSEL_ALT3);<br>
+  }<br>
+<br>
 }<br>
<br>
<br>
-- <br>
2.31.0.windows.1<br>
<br>
</blockquote></div>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr>   Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/76135">View/Reply Online (#76135)</a> |    |  <a target="_blank" href="https://groups.io/mt/83365133/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>