From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mx.groups.io with SMTP id smtpd.web08.37009.1623078296028510838 for ; Mon, 07 Jun 2021 08:04:56 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KiRDfwyo; spf=pass (domain: gmail.com, ip: 209.85.221.46, mailfrom: mariobalanica02@gmail.com) Received: by mail-wr1-f46.google.com with SMTP id a20so18065885wrc.0 for ; Mon, 07 Jun 2021 08:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YllircE8O3sQqTBdUcqiBNiWG0V3VIB9tC172Oeumcc=; b=KiRDfwyoIEE8EwRhphniQc9fLS4UfthiBGAsByuui8xE9IDnwvlCwgUwSj3ZIY7hn0 vHaBHgpz/Zbw2OFVxTjHzy4vf8NRpjODLbzLEiw5RpaHjYM1D7cZ8vdzkNQ6/DeIA9px wP1fhYh1AqhXHDIu08fTOQB3QBOrmLTPD82PoBGvKM56emfKmVkb3G58LDE1N/y9Hpe3 b5auVUbdIRcxipQiB01kxoodWu//86mU2hAFM7Q4+lYtOYgthZBGvUIA6BWHARGGUY0x KXym70c4ZudtiDkce2DwYOsEx9hiEhvzEwAPa8BExVUI2ExNEuXiw/DoX16U1m2Qgexz cDgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YllircE8O3sQqTBdUcqiBNiWG0V3VIB9tC172Oeumcc=; b=p8exFztuafAmm6lAH+7i0IAUXpYAn71jkycgX6FuvSrJrkqbPKZHce046Eg0N1TzqH kdg7ep0p2LcXHqzbzNkoDTue7XG94Ypm9Afc6PnfcbAfMGm6PNeqYzuOmpRe1LXLAMqy 8E5yuBSzMmoD2urXjHnzQDx3cSvujFjCtZd4AI/d40XuWvtEfZwaBzleNPvSTnUXe2Jc 9sb5oSg+ZQbLKbPmm+IgHdSi8YaeYRYLYooqdB0LUJoz5qhW+P1Fq08ji0HzCkwtxv3t j899+4zPSYLg+a1Hf8Rh0jXxVWUllfhzgcnzuJ0Kh6z/1X2nsFcCNysG7xk+mgP0qwzm eReA== X-Gm-Message-State: AOAM532JHyeX0YO9ayDpF2EOgUNSVlqC6Flh7yuxpQwM2ploEs4MHaAw Ci8AiYh/aa24/fPadpkloli4fFOtHWDkIztCaOc= X-Google-Smtp-Source: ABdhPJw5xt4NP5KL5uQ8MYEq6tN2hDipl9PGiKy6d8JAz3qfX3Y4rZ1w2tapQhtDff76T8i2MpkIUGDaHxzq7VYpTco= X-Received: by 2002:a5d:474d:: with SMTP id o13mr17204174wrs.176.1623078294574; Mon, 07 Jun 2021 08:04:54 -0700 (PDT) MIME-Version: 1.0 References: <20210607075339.342-1-Sunny.Wang@arm.com> <20210607075339.342-4-Sunny.Wang@arm.com> In-Reply-To: <20210607075339.342-4-Sunny.Wang@arm.com> From: =?UTF-8?B?TWFyaW8gQsSDbMSDbmljxIM=?= Date: Mon, 7 Jun 2021 18:04:43 +0300 Message-ID: Subject: Re: [PATCH v4 3/3] Platform/RaspberryPi: Enable Bluetooth and UART in Windows OS To: Sunny Wang Cc: devel@edk2.groups.io, Samer El-Haj-Mahmoud , Sami Mujawar , Jeremy Linton , Pete Batard , Ard Biesheuvel Content-Type: multipart/alternative; boundary="00000000000030d87305c42e5d9b" --00000000000030d87305c42e5d9b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Looks good to me. Thanks for working on this! --Mario =C3=8En lun., 7 iun. 2021 la 10:54, Sunny Wang a scris= : > 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 > Cc: Sami Mujawar > Cc: Jeremy Linton > Cc: Pete Batard > Cc: Ard Biesheuvel > Cc: Mario B=C4=83l=C4=83nic=C4=83 > Signed-off-by: Sunny Wang > --- > 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) =3D=3D 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 > > --00000000000030d87305c42e5d9b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Looks good to me.
Thanks for working on this!

--Mario

=C3=8En lun., 7 iun. 2021 la 10:54, Sunny Wan= g <Sunny.Wang@arm.com> a sc= ris:
This change= is based on edk2-platforms-raspberrypi-pl011-bth-noflow.diff
in https://github.com/worproject/RPi-Bluetooth-T= esting/ with the
modifications and additional changes below for enabling Bluetooth
and serial port (Mini UART) in Windows IOT.
=C2=A0 - Remove RPIQ connection for BT_ON/OFF in Uart.asl because it is
=C2=A0 =C2=A0 useless. The firmware already turns on the Bluetooth by defau= lt.
=C2=A0 - Move the GPIO pin muxing stuff from Uart.asl to ConfigDxe driver.<= br>
Testing Done:
=C2=A0 - Successfully booted Windows Windows 10 IOT (20279.1) on SD (made b= y
=C2=A0 =C2=A0 WOR) with the RPi-Windows-Drivers release ver 0.5 downloaded = from
=C2=A0 =C2=A0 https://github.com/worprojec= t/RPi-Windows-Drivers/releases
=C2=A0 =C2=A0 and checked that both Bluetooth and serial port (Mini UART) c= an
=C2=A0 =C2=A0 work fine.
=C2=A0 - Successfully booted VMware ESXi-Arm Fling v1.3 with only serial =C2=A0 =C2=A0 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=C4=83l=C4=83nic=C4=83 <mariobalanica02@gmail.com>
Signed-off-by: Sunny Wang <sunny.wang@arm.com>
---
=C2=A0Platform/RaspberryPi/AcpiTables/Uart.asl=C2=A0 =C2=A0 =C2=A0 | 16 ---= -----------
=C2=A0.../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 22 ++++++++++++++++++= +
=C2=A02 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryP= i/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)
=C2=A0 =C2=A0 =C2=A0MEMORY32FIXED (ReadWrite, 0, BCM2836_MINI_UART_LENGTH, = RMEM)
=C2=A0 =C2=A0 =C2=A0Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) = { BCM2836_MINI_UART_INTERRUPT }

-=C2=A0 =C2=A0 // NTRAID#MSFT-7141401-2016/04/7-jordanrh - disable UART mux= ing
-=C2=A0 =C2=A0 // until a proper solution can be created for the dmap confl= ict.
-=C2=A0 =C2=A0 // When muxing is enabled, must consider DBG2 table conflict= .
-=C2=A0 =C2=A0 // The alternate function resource needs to be reserved when=
-=C2=A0 =C2=A0 // the kernel debugger is enabled to prevent another client<= br> -=C2=A0 =C2=A0 // from muxing the pins away.
-
-=C2=A0 =C2=A0 // PinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.G= PI0", 0, ResourceConsumer, , ) { 14, 15 }
=C2=A0 =C2=A0})
=C2=A0 =C2=A0Method (_CRS, 0x0, Serialized)
=C2=A0 =C2=A0{
@@ -143,10 +135,6 @@ Device(BTH0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0UAR0,=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // Descr= iptorName: creates name
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0//=C2=A0 =C2=A0for offset of resource descriptor
=C2=A0 =C2=A0 =C2=A0)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 // Vendor data
-=C2=A0 =C2=A0 //
-=C2=A0 =C2=A0 // RPIQ connection for BT_ON/OFF
-=C2=A0 =C2=A0 //
-=C2=A0 =C2=A0 GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB= .GDV0.RPIQ", 0, ResourceConsumer, , ) { 128 }
=C2=A0 =C2=A0})

=C2=A0 =C2=A0//
@@ -190,10 +178,6 @@ Device(BTH0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0UARM,=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // Descr= iptorName: creates name
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0//=C2=A0 =C2=A0for offset of resource descriptor
=C2=A0 =C2=A0 =C2=A0)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 // Vendor data
-=C2=A0 =C2=A0 //
-=C2=A0 =C2=A0 // RPIQ connection for BT_ON/OFF
-=C2=A0 =C2=A0 //
-=C2=A0 =C2=A0 GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB= .GDV0.RPIQ", 0, ResourceConsumer, , ) { 128 }
=C2=A0 =C2=A0})

=C2=A0 =C2=A0Method (_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 (
=C2=A0 =C2=A0 =C2=A0DEBUG ((DEBUG_INFO, "Fan enabled on GPIO %d\n"= ;, FanOnGpio));
=C2=A0 =C2=A0 =C2=A0GpioPinFuncSet (FanOnGpio, GPIO_FSEL_OUTPUT);
=C2=A0 =C2=A0}
+
+=C2=A0 //
+=C2=A0 // Fake the CTS signal as we don't support HW flow control yet.=
+=C2=A0 // Pin 31 must be held LOW so that we can talk to the BT chip
+=C2=A0 // without flow control
+=C2=A0 //
+=C2=A0 GpioPinFuncSet (31, GPIO_FSEL_OUTPUT);
+=C2=A0 GpioPinConfigure (31, CLEAR_GPIO);
+
+=C2=A0 //
+=C2=A0 // Bluetooth pin muxing
+=C2=A0 //
+=C2=A0 if ((PcdGet32 (PcdUartInUse) =3D=3D PL011_UART_IN_USE)) {
+=C2=A0 =C2=A0 DEBUG ((DEBUG_INFO, "Enable Bluetooth over MiniUART\n&q= uot;));
+=C2=A0 =C2=A0 GpioPinFuncSet (32, GPIO_FSEL_ALT5);
+=C2=A0 =C2=A0 GpioPinFuncSet (33, GPIO_FSEL_ALT5);
+=C2=A0 } else {
+=C2=A0 =C2=A0 DEBUG ((DEBUG_INFO, "Enable Bluetooth over PL011 UART\n= "));
+=C2=A0 =C2=A0 GpioPinFuncSet (32, GPIO_FSEL_ALT3);
+=C2=A0 =C2=A0 GpioPinFuncSet (33, GPIO_FSEL_ALT3);
+=C2=A0 }
+
=C2=A0}


--
2.31.0.windows.1

--00000000000030d87305c42e5d9b--