From: "Sunny Wang" <Sunny.Wang@arm.com>
To: devel@edk2.groups.io
Cc: "Sunny Wang" <Sunny.Wang@arm.com>,
"Samer El-Haj-Mahmoud" <samer.el-haj-mahmoud@arm.com>,
"Sami Mujawar" <sami.mujawar@arm.com>,
"Jeremy Linton" <jeremy.linton@arm.com>,
"Pete Batard" <pete@akeo.ie>,
"Ard Biesheuvel" <ardb+tianocore@kernel.org>,
"Mario Bălănică" <mariobalanica02@gmail.com>,
"Sunny Wang" <sunny.wang@arm.com>
Subject: [PATCH v4 3/3] Platform/RaspberryPi: Enable Bluetooth and UART in Windows OS
Date: Mon, 7 Jun 2021 15:53:39 +0800 [thread overview]
Message-ID: <20210607075339.342-4-Sunny.Wang@arm.com> (raw)
In-Reply-To: <20210607075339.342-1-Sunny.Wang@arm.com>
This change is based on edk2-platforms-raspberrypi-pl011-bth-noflow.diff
in https://github.com/worproject/RPi-Bluetooth-Testing/ with the
modifications and additional changes below for enabling Bluetooth
and serial port (Mini UART) in Windows IOT.
- Remove RPIQ connection for BT_ON/OFF in Uart.asl because it is
useless. The firmware already turns on the Bluetooth by default.
- Move the GPIO pin muxing stuff from Uart.asl to ConfigDxe driver.
Testing Done:
- Successfully booted Windows Windows 10 IOT (20279.1) on SD (made by
WOR) with the RPi-Windows-Drivers release ver 0.5 downloaded from
https://github.com/worproject/RPi-Windows-Drivers/releases
and checked that both Bluetooth and serial port (Mini UART) can
work fine.
- Successfully booted VMware ESXi-Arm Fling v1.3 with only serial
console connection (PL011 UART).
Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jeremy Linton <jeremy.linton@arm.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Mario Bălănică <mariobalanica02@gmail.com>
Signed-off-by: Sunny Wang <sunny.wang@arm.com>
---
Platform/RaspberryPi/AcpiTables/Uart.asl | 16 --------------
.../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 22 +++++++++++++++++++
2 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryPi/AcpiTables/Uart.asl
index bac9d791eb..167f94e889 100644
--- a/Platform/RaspberryPi/AcpiTables/Uart.asl
+++ b/Platform/RaspberryPi/AcpiTables/Uart.asl
@@ -71,14 +71,6 @@ Device (URTM)
MEMORY32FIXED (ReadWrite, 0, BCM2836_MINI_UART_LENGTH, RMEM)
Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_MINI_UART_INTERRUPT }
- // NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART muxing
- // until a proper solution can be created for the dmap conflict.
- // When muxing is enabled, must consider DBG2 table conflict.
- // The alternate function resource needs to be reserved when
- // the kernel debugger is enabled to prevent another client
- // from muxing the pins away.
-
- // PinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.GPI0", 0, ResourceConsumer, , ) { 14, 15 }
})
Method (_CRS, 0x0, Serialized)
{
@@ -143,10 +135,6 @@ Device(BTH0)
UAR0, // DescriptorName: creates name
// for offset of resource descriptor
) // Vendor data
- //
- // RPIQ connection for BT_ON/OFF
- //
- GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GDV0.RPIQ", 0, ResourceConsumer, , ) { 128 }
})
//
@@ -190,10 +178,6 @@ Device(BTH0)
UARM, // DescriptorName: creates name
// for offset of resource descriptor
) // Vendor data
- //
- // RPIQ connection for BT_ON/OFF
- //
- GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GDV0.RPIQ", 0, ResourceConsumer, , ) { 128 }
})
Method (_CRS, 0x0, Serialized)
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index d6efb59793..cf9880bd20 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -618,6 +618,28 @@ ApplyVariables (
DEBUG ((DEBUG_INFO, "Fan enabled on GPIO %d\n", FanOnGpio));
GpioPinFuncSet (FanOnGpio, GPIO_FSEL_OUTPUT);
}
+
+ //
+ // Fake the CTS signal as we don't support HW flow control yet.
+ // Pin 31 must be held LOW so that we can talk to the BT chip
+ // without flow control
+ //
+ GpioPinFuncSet (31, GPIO_FSEL_OUTPUT);
+ GpioPinConfigure (31, CLEAR_GPIO);
+
+ //
+ // Bluetooth pin muxing
+ //
+ if ((PcdGet32 (PcdUartInUse) == PL011_UART_IN_USE)) {
+ DEBUG ((DEBUG_INFO, "Enable Bluetooth over MiniUART\n"));
+ GpioPinFuncSet (32, GPIO_FSEL_ALT5);
+ GpioPinFuncSet (33, GPIO_FSEL_ALT5);
+ } else {
+ DEBUG ((DEBUG_INFO, "Enable Bluetooth over PL011 UART\n"));
+ GpioPinFuncSet (32, GPIO_FSEL_ALT3);
+ GpioPinFuncSet (33, GPIO_FSEL_ALT3);
+ }
+
}
--
2.31.0.windows.1
next prev parent reply other threads:[~2021-06-07 7:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-07 7:53 [PATCH v4 0/3] Dynamically build UARTs info in ACPI Sunny Wang
2021-06-07 7:53 ` [PATCH v4 1/3] Platform/RaspberryPi: " Sunny Wang
2021-06-12 13:39 ` Pete Batard
2021-06-12 20:08 ` Ard Biesheuvel
2021-06-07 7:53 ` [PATCH v4 2/3] Silicon/Broadcom/Bcm283x: Clean up GpioPinSet function Sunny Wang
2021-06-12 13:40 ` Pete Batard
2021-06-07 7:53 ` Sunny Wang [this message]
2021-06-07 15:04 ` [PATCH v4 3/3] Platform/RaspberryPi: Enable Bluetooth and UART in Windows OS Mario Bălănică
2021-06-12 13:40 ` Pete Batard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210607075339.342-4-Sunny.Wang@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox