From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.groups.io with SMTP id smtpd.web11.45906.1622476629778660839 for ; Mon, 31 May 2021 08:57:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Aow/bj2i; spf=pass (domain: gmail.com, ip: 209.85.221.48, mailfrom: mariobalanica02@gmail.com) Received: by mail-wr1-f48.google.com with SMTP id z8so6267448wrp.12 for ; Mon, 31 May 2021 08:57:09 -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=IuTbjygx3WXJSp+64TZoYYuk2++HUiPV4CXDiSvp1a0=; b=Aow/bj2iW6ha/uEMc5QI5rUI9MqtDCtQAmX0O6JEsSUiwhySDLqC5JJGKkBgzvCafd NnxK3UHg2U07ymrlZR6FNB/mDijflFs3wg/GE9WP1DmHTAh/1S2SeeJruhc1BHPeUN7F M2u+oTS9kM3H9LyHH+Fr4+VxEjqlIR4cJJ16iGoCDwp+XPPmT5ubbgBh6iRSJtkENbPK 5Hx40M8oyB93JbWWRisCT8hItOZEUdSvtWaFYuL09drE+2L25eYXjSyFZ83n6IOfFbSh YustqR2NSGp2vjJR1paywFXIo+S1dz2hXBC8zYYB9DsdeC62b+5F/3c1Y5MShUvu99XQ /lBw== 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=IuTbjygx3WXJSp+64TZoYYuk2++HUiPV4CXDiSvp1a0=; b=ktBXPhZXENErjRpL9WfheH5Qo8RjUvAF+p/271mS4nL9LMT4M1s2XiCOEPjhqEMSRJ cWokvcdkhSfEL7o4MF1D/dvs3K9xd22aXJ6TgY4eqZQUqj9kNdg/FX32GQvuyn4OXvPd 2Adt0PBiTwk1kctn+RyE8rALwV0J7ZWK3S0XVK68vkMbbF0MUYqBmbJ/j214iHu/SEtY hL+tRjviVRGT/PoaCmIAR/Snv5RIS1O9V7/3kSE/mUWWRHncoM0Syk1WRE5OXE35s/z/ mHRcwTVy7lmupZLqxMZDfKoTrtngA0aFy5TndX1hVPpESe1bHz3LMme3O9zAWhqCQOgP RFUg== X-Gm-Message-State: AOAM531082X9oesnKSKLF3xN0sVkbQZpUv/EuEMpvcXdmv8RMfDZi3EA TluIYYHYeRdV2SPXz/F6LQR6syfryaT8kyTGlpI= X-Google-Smtp-Source: ABdhPJweNtKD//VJAB3lKeZeoQ7YT5fW4Oac17q7NFOdqrJsd7THNrbNu15kdnaJxpBV6CJ8ZQVJiPUiyeotMKyq2pw= X-Received: by 2002:a5d:59a4:: with SMTP id p4mr23561476wrr.248.1622476628338; Mon, 31 May 2021 08:57:08 -0700 (PDT) MIME-Version: 1.0 References: <20210531082239.918-1-Sunny.Wang@arm.com> <20210531082239.918-3-Sunny.Wang@arm.com> In-Reply-To: From: =?UTF-8?B?TWFyaW8gQsSDbMSDbmljxIM=?= Date: Mon, 31 May 2021 18:56:57 +0300 Message-ID: Subject: Re: [edk2-devel] [PATCH v3 2/2] 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="00000000000016a9ba05c3a247d3" --00000000000016a9ba05c3a247d3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > If there is no COM port for PL011 UART, how can I check PL011 UART=E2=80= = =99s > functionality? How can I use a telnet tool like PuTTY to send messages f= rom > RPi4 to my laptop? You can use: samples/MinComm at develop =C2=B7 ms-iot/samples (github.com) (let me know if you need a precompiled binary) As for why I mux both UARTs to the BT chip, I was trying to address your > comment =E2=80=9CThis always assumes that PL011 is used for Bluetooth=E2= = =80=9D. Apparently, > it didn=E2=80=99t address your comment. No matter whether I add =E2=80= =9CPinFunction > (Exclusive, PullDown, BCM_ALT5, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, = , > ) { 32, 33 }=E2=80=9D or not, the Bluetooth has NOT worked when I config= ure PL011 > UART as the primary serial console. Bluetooth only works when I configur= e > Mini UART as the Primary serial console. I also confirmed that this prob= lem > also exists with RPi4 Release FW 1.26 + > edk2-platforms-raspberrypi-pl011-bth-noflow.diff in > https://github.com/worproject/RPi-Bluetooth-Testing/. Do you have any > idea to make the Bluetooth work with configuring PL011 UART as the prima= ry > serial console? Bluetooth doesn't really work with the mini UART driver at the moment. The chip stalls after a few transfers, as far as I remember. Haven't looked much into it. By the way, it is good to know the loading sequence. Do you know where I > can quickly find this information without using WinDbg? I'm not aware of any way to see the driver loading order without WinDbg. Also, verbose mode must be enabled before boot: View Verbose Output - Windows drivers | Microsoft Docs You could also test if Bluetooth will break by uninstalling / re-installin= g the mini UART driver while the system is running, then try to scan for nearby BT devices. 1. What is the connection between GPIO 128 and Bluetooth (BT_ON)? Why did > we add this line in the beginning? I just removed it by your request and > according to the change in worproject/RPi-Bluetooth-Testing/, but I=E2= =80=99m > still worried about if we did this for some other purposes. That is a leftover from the MS-IOT tables. It tries to toggle BT_ON from the GPIO expander (I2C) through RPIQ (mailbox), but the driver has no knowledge of it. And since the firmware blob turns on Bluetooth by default= , the line is completely useless. We may want to have something like this in the future, for power managemen= t of the BT chip (will require some driver changes too). 2. Why do we need to configure GPIO 32 and 33? Is the Bluetooth using GPI= O > 32 and 33? Or Is Windows OS checking GPIO 32 and 33 for Bluetooth? Where > can I find the information? Yes, the Bluetooth chip is available on pins 32, 33 (TX / RX). Also 30, 31 for hardware flow control (CTS / RTS). More info can be found in the BCM27= 11 datasheet (5.3. Alternative Function Assignments) 3. As for your comment about GPIO 31, I was confused, so I didn=E2=80=99t= update > anything for addressing this comment. My understanding was that It is > intended to override the BCM_ALT2=E2=80=99s default setting from PullLow= to > PullNone to fack the CTS signal. If we change it to PullLow, it will be > used for HW flow control, which is unwanted, isn=E2=80=99t it? What did = you want me > to change? Could you directly paste the code change you wanted here for = my > reference? The BCM_ALT2 thing is a dirty hack. Pin 31 must be held LOW so that we can talk to the BT chip without flow control. It seems this can't be described with PinFunction, so I've relied on the default value of ALT2 for pin 31 (which turns out to be always LOW). My proposal is to move the pin muxing stuff in ConfigDxe, like this: STATIC VOID > > ApplyVariables ( > > VOID > > ) > > { > > ... > > >> if (FanOnGpio) { > > DEBUG ((DEBUG_INFO, "Fan enabled on GPIO %d\n", FanOnGpio)); > > GpioPinFuncSet (FanOnGpio, GPIO_FSEL_OUTPUT); > > } > > >> /* > > * Bluetooth pin muxing > > */ > > GpioPinFuncSet (31, GPIO_FSEL_OUTPUT); > > GpioPinSet (31, 0); > > >> if ((PcdGet32 (PcdUartInUse) =3D=3D PL011_UART_IN_USE)) { > > GpioPinFuncSet (32, GPIO_FSEL_ALT3); > > GpioPinFuncSet (33, GPIO_FSEL_ALT3); > > } else { > > GpioPinFuncSet (32, GPIO_FSEL_ALT5); > > GpioPinFuncSet (33, GPIO_FSEL_ALT5); > > } > > } > > --Mario =C3=8En lun., 31 mai 2021 la 16:26, Sunny Wang a scri= s: > Hi Mario, > > > > Thanks for checking this. > > Yeah, the problem is NO COM port for PL011 UART in Windows IOT=E2=80=99s= device > manager, so I thought it doesn=E2=80=99t work. If there is no COM port f= or PL011 > UART, how can I check PL011 UART=E2=80=99s functionality? How can I use = a > telnet tool like PuTTY to send messages from RPi4 to my laptop? How to u= se > SerCx2? Is there a guideline for using PL011 UART on RPi4 with Windows I= oT? > > > > As for why I mux both UARTs to the BT chip, I was trying to address your > comment =E2=80=9CThis always assumes that PL011 is used for Bluetooth=E2= = =80=9D. Apparently, > it didn=E2=80=99t address your comment. No matter whether I add =E2=80= =9CPinFunction > (Exclusive, PullDown, BCM_ALT5, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, = , > ) { 32, 33 }=E2=80=9D or not, the Bluetooth has NOT worked when I config= ure PL011 > UART as the primary serial console. Bluetooth only works when I configur= e > Mini UART as the Primary serial console. I also confirmed that this prob= lem > also exists with RPi4 Release FW 1.26 + > edk2-platforms-raspberrypi-pl011-bth-noflow.diff in > https://github.com/worproject/RPi-Bluetooth-Testing/. Do you have any > idea to make the Bluetooth work with configuring PL011 UART as the prima= ry > serial console? By the way, it is good to know the loading sequence. Do = you > know where I can quickly find this information without using WinDbg? > > > > > > Actually, the original code change (Patch 2/2) is the patch > (edk2-platforms-raspberrypi-pl011-bth-noflow.diff) on > https://github.com/worproject/RPi-Bluetooth-Testing/. I=E2=80=99m not fa= miliar > with Windows drivers=E2=80=99 behavior, so I had no idea about why we ne= ed to > change them and couldn=E2=80=99t find more information about the changes= = =E2=80=99 > background either. It looks like you know the details. Could you share w= ith > me more information about the background of these changes? At least, I h= ave > some questions below: > > 1. What is the connection between GPIO 128 and Bluetooth (BT_ON)? Why d= id > we add this line in the beginning? I just removed it by your request and > according to the change in worproject/RPi-Bluetooth-Testing/, but I=E2= =80=99m still > worried about if we did this for some other purposes. > > 2. Why do we need to configure GPIO 32 and 33? Is the Bluetooth using > GPIO 32 and 33? Or Is Windows OS checking GPIO 32 and 33 for Bluetooth? > Where can I find the information? > > 3. As for your comment about GPIO 31, I was confused, so I didn=E2=80= =99t update > anything for addressing this comment. My understanding was that It is > intended to override the BCM_ALT2=E2=80=99s default setting from PullLow= to > PullNone to fack the CTS signal. If we change it to PullLow, it will be > used for HW flow control, which is unwanted, isn=E2=80=99t it? What did = you want me > to change? Could you directly paste the code change you wanted here for = my > reference? > > > > Moreover, for the changes you want, could you also paste the code change= ? > > > Best Regards, > > Sunny Wang > > > > *From:* devel@edk2.groups.io * On Behalf Of *Mari= o > Balanica via groups.io > *Sent:* Monday, May 31, 2021 8:41 PM > *To:* Sunny Wang > *Cc:* devel@edk2.groups.io; Samer El-Haj-Mahmoud < > Samer.El-Haj-Mahmoud@arm.com>; Sami Mujawar ; > Jeremy Linton ; Pete Batard ; Ard > Biesheuvel > *Subject:* Re: [edk2-devel] [PATCH v3 2/2] Platform/RaspberryPi: Enable > Bluetooth and UART in Windows OS > > > > Hi Sunny, > > > > What issues are you seeing with the PL011 UART in Windows? Last time I > checked, it worked fine, and the fact that Bluetooth works also confirms > this. > > It won't show up as a COM port (like mini UART does) as it's built using > SerCx2. > > > > @@ -30,6 +30,12 @@ Device (URT0) > { > MEMORY32FIXED (ReadWrite, 0, BCM2836_PL011_UART_LENGTH, RMEM) > Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { > BCM2836_PL011_UART_INTERRUPT } > + > + PinFunction (Exclusive, PullDown, BCM_ALT3, "\\_SB.GDV0.GPI0", 0, > ResourceConsumer, , ) { 32, 33 } > + > > > > @@ -79,6 +85,11 @@ Device (URTM) > // from muxing the pins away. > > // PinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.GPI0", 0, > ResourceConsumer, , ) { 14, 15 } > + PinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.GDV0.GPI0", 0, > ResourceConsumer, , ) { 32, 33 } > + > > > > What is the reason for trying to mux both UARTs to the BT chip? If PL011 > is used for Bluetooth and the mini UART driver loads *after* it, wouldn'= t > it mux away the pins and break Bluetooth? > > > > > > > > > > =C3=8En lun., 31 mai 2021 la 11:23, Sunny Wang a sc= ris: > > This change is based on edk2-platforms-raspberrypi-pl011-bth-noflow.diff > in https://github.com/worproject/RPi-Bluetooth-Testing/ for enabling > Bluetooth and serial port (Mini UART) in Windows IOT. > > Note that PL011 UART still doesn't work with Windows 10 IOT with this > change, but PL011 UART works fine with VMware ESXi-Arm Fling v1.3. > Therefore, there should be no issue with PL011 UART related changes, > and we will still need a Windows expert to take a further look in the > future. Making PL011 UART work properly with Windows 10 IOT may require > additional changes to Windows driver or firmware's ACPI table. > > 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 | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl > b/Platform/RaspberryPi/AcpiTables/Uart.asl > index bac9d791eb..cb99086d39 100644 > --- a/Platform/RaspberryPi/AcpiTables/Uart.asl > +++ b/Platform/RaspberryPi/AcpiTables/Uart.asl > @@ -30,6 +30,12 @@ Device (URT0) > { > MEMORY32FIXED (ReadWrite, 0, BCM2836_PL011_UART_LENGTH, RMEM) > Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { > BCM2836_PL011_UART_INTERRUPT } > + > + PinFunction (Exclusive, PullDown, BCM_ALT3, "\\_SB.GDV0.GPI0", 0, > ResourceConsumer, , ) { 32, 33 } > + > + // fake the CTS signal as we don't support HW flow control yet > + // BCM_ALT2 is set as output (low) by default > + PinFunction (Exclusive, PullNone, BCM_ALT2, "\\_SB.GDV0.GPI0", 0, > ResourceConsumer, , ) { 31 } > }) > Method (_CRS, 0x0, Serialized) > { > @@ -79,6 +85,11 @@ Device (URTM) > // from muxing the pins away. > > // PinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.GPI0", 0, > ResourceConsumer, , ) { 14, 15 } > + PinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.GDV0.GPI0", 0, > ResourceConsumer, , ) { 32, 33 } > + > + // fake the CTS signal as we don't support HW flow control yet > + // BCM_ALT2 is set as output (low) by default > + PinFunction (Exclusive, PullNone, BCM_ALT2, "\\_SB.GDV0.GPI0", 0, > ResourceConsumer, , ) { 31 } > }) > Method (_CRS, 0x0, Serialized) > { > @@ -143,10 +154,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 +197,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) > -- > 2.31.0.windows.1 > >=20 > IMPORTANT NOTICE: The contents of this email and any attachments are > confidential and may also be privileged. If you are not the intended > recipient, please notify the sender immediately and do not disclose the > contents to any other person, use it for any purpose, or store or copy t= he > information in any medium. Thank you. > --00000000000016a9ba05c3a247d3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
If there is no COM port fo= r PL011 UART, how can I check PL011 UART=E2=80=99s functionality? How can I= use a telnet=C2=A0tool like PuTTY to send messages from RPi4 to my laptop?= = =C2=A0
=C2=A0
You can use:=C2=A0samples/MinComm at develop =C2=B7 ms-iot/samples (github.com)=C2=A0= (let me know if you need a precompiled binary)

As for why I mux both UARTs to the BT chip, I was trying to address you= r comment =E2=80=9CThis always assumes that PL011 is used for Bluetooth=E2= =80=9D. Apparently, it didn=E2=80=99t address your comment. No matter whet= her I add =E2=80=9CPinFunction (Exclusive, PullDown, BCM_ALT5, "= ;\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 32, 33 }=E2=80=9D= = =C2=A0or not, the Bluetooth has NOT w= orked when I configure PL011 UART as the primary serial console. Bluetooth = only works when I configure Mini UART as the Primary serial console. I also= confirmed that this problem also exists with RPi4 Release FW 1.26 + edk2-p= latforms-raspberrypi-pl011-bth-noflow.diff in=C2=A0https://github.c= om/worproject/RPi-Bluetooth-Testing/. Do you have any idea to make the = Bluetooth work with configuring PL011 UART as the primary serial console?
=C2=A0
Bluetooth doesn't really work w= ith the mini UART driver at the moment. The chip stalls after a few transfe= rs, as far as I remember. Haven't looked much into it.

By the way, it is good to know the loading sequence. Do you= know where I can quickly find this information without using WinDbg?

I'm not aware of any way to see the d= river loading order without WinDbg. Also, verbose mode must be enabled befo= re boot:=C2=A0View Verbose Outp= ut - Windows drivers | Microsoft Docs

You coul= d also test if Bluetooth will break by uninstalling / re-installing the min= i UART driver while the system is running, then try to scan for nearby BT d= evices.

1.=C2=A0 What is the connection bet= ween GPIO 128 and Bluetooth (BT_ON)? Why did we add this line in the beginn= ing? I just removed it by your request and according to the change in worpr= oject/RPi-Bluetooth-Testing/, b= ut I=E2=80=99m still worried about if we did this for some other purposes.= =C2=A0=C2=A0
=C2=A0
That is a leftover f= rom the MS-IOT tables. It tries to toggle BT_ON from the GPIO expander (I2C= ) through RPIQ (mailbox), but the driver has no knowledge of it. And since = the firmware blob turns on Bluetooth by default, the line is completely use= less.

We may want to have something like this in t= he future, for power management of the BT chip (will require some driver ch= anges too).

2.=C2=A0 Why do we need to conf= igure GPIO 32 and 33? Is the Bluetooth using GPIO 32 and 33? Or Is Windows = OS checking GPIO 32 and 33 for Bluetooth? Where can I find the information?=

Yes, the Bluetooth chip is availabl= e on pins 32, 33 (TX / RX). Also 30, 31 for hardware flow control (CTS / RT= S). More info can be found in the BCM2711 datasheet=C2=A0(5.3. Alternative Function Assignments)

3.=C2=A0 As for your comment about GPIO 31, I was confused, so I didn= =E2=80=99t update anything for addressing this comment. My understanding w= as that It is intended to override the BCM_ALT2=E2=80=99s default setting f= rom PullLow to PullNone to fack the CTS signal. If we change it to PullLow,= it will be used for HW flow control, which is unwanted, isn=E2=80=99t it? = What did you want me to change? Could you directly paste the code change yo= u wanted here for my reference?

The = BCM_ALT2 thing is a dirty hack. Pin 31 must be held LOW so that we can talk= to the BT chip without flow control. It seems this can't be described = with PinFunction, so I've relied on the default value of ALT2 for pin 3= 1 (which turns out to be always LOW).=C2=A0

My pro= posal is to move the pin muxing stuff in ConfigDxe, like this:
STATIC VOID
ApplyVariables (
=C2=A0 VOID
=C2=A0 )
{
...

=C2=A0 if (FanOnGpio) {
=C2=A0 =C2=A0 DEBUG ((DEBUG_INFO, "Fan enabled on GPI= O %d\n", FanOnGpio));
=C2=A0 =C2=A0 GpioPinFuncSet (FanOnGpio, GPIO_FSEL_OUTPUT);
=C2=A0 }

<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">=C2=A0 /*
=C2=A0 =C2=A0* Bluetooth pin = muxing
=C2=A0= =C2=A0*/=C2=A0 =C2=A0
=C2=A0 GpioPinFuncSet (31, GPIO_FSEL_OUTPUT);
=C2=A0 GpioPinSet (31, 0);

=C2=A0 if ((PcdGet32 (Pc= dUartInUse) =3D=3D PL011_UART_IN_USE)) {=C2=A0=C2=A0
=C2=A0 =C2=A0 GpioPinFuncSet (32, G= PIO_FSEL_ALT3);
=C2=A0 =C2=A0 GpioPinFuncSet (33, GPIO_FSEL_ALT3);
=C2=A0 } else {
=C2=A0 =C2=A0 GpioPinFuncSet (3= 2, GPIO_FSEL_ALT5);
=C2=A0 =C2=A0 GpioPinFuncSet (33, GPIO_FSEL_ALT5);
=C2=A0 }}
= =C2=A0
--Mario

Hi Mario, <= /u>

=C2=A0<= u>

Thanks for che= cking this.

=

Yeah, the prob= lem is NO COM port for PL011 UART in Windows IOT=E2=80=99s device manager, = so I thought it doesn=E2=80=99t work. If there is no COM port for PL011 UAR= T, how can I check PL011 UART=E2=80=99s functionality? How can I use a telnet=C2=A0tool like PuTTY to send messages from RPi4 to my laptop? Ho= w to use SerCx2? Is there a guideline for using PL011 UART on RPi4 with Win= dows IoT?

=C2=A0<= u>

As for why I m= ux both UARTs to the BT chip, I was trying to address your comment =E2=80= =9CThis always assumes that PL011 is used for Bluetooth=E2=80=9D. Apparent= ly, it didn=E2=80=99t address your comment. No matter whether I add =E2=80= =9CPinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.GDV0.GPI0", 0, Re= sourceConsumer, , ) { 32, 33 }=E2=80=9D or not, the Bluetooth has NOT worked = when I configure PL011 UART as the primary serial console. Bluetooth only w= orks when I configure Mini UART as the Primary serial console. I also confi= rmed that this problem also exists with RPi4 Release FW 1.26 + edk2-platforms-raspberrypi-pl011-bth-noflow.diff in https://github.com/worproject/RPi-Bluetooth-Testing/. Do you have any = idea to make the Bluetooth work with configuring PL011 UART as the primary = serial console? By the way, it is good to know the loading sequence. Do you= know where I can quickly find this information without using WinDbg?

=C2=A0<= u>

=C2=A0<= u>

Actually, the = original code change (Patch 2/2) is the patch (edk2-platforms-raspberrypi-p= l011-bth-noflow.diff) on =C2=A0https://github.com/worproject/RPi-Bl= uetooth-Testing/. I=E2=80=99m not familiar with Windows drivers=E2=80=99 behavior, so I had= no idea about why we need to change them and couldn=E2=80=99t find more in= formation about the changes=E2=80=99 background either. It looks like you k= now the details. Could you share with me more information about the background of these changes? At least, I have some questions below:

1.=C2=A0 What = is the connection between GPIO 128 and Bluetooth (BT_ON)? Why did we add th= is line in the beginning? I just removed it by your request and according t= o the change in worproject/RPi-Bluetooth-Testing/, but I=E2=80=99m still worried about if we did this for some other purpose= s. =C2=A0

2.=C2=A0 Why d= o we need to configure GPIO 32 and 33? Is the Bluetooth using GPIO 32 and 3= 3? Or Is Windows OS checking GPIO 32 and 33 for Bluetooth? Where can I find= the information?

3.=C2=A0 As fo= r your comment about GPIO 31, I was confused, so I didn=E2=80=99t update an= ything for addressing this comment. My understanding was that It is intende= d to override the BCM_ALT2=E2=80=99s default setting from PullLow to PullNone to fack the CTS signal. If we change it to PullLow, it will b= e used for HW flow control, which is unwanted, isn=E2=80=99t it? What did y= ou want me to change? Could you directly paste the code change you wanted h= ere for my reference?

=C2=A0<= u>

Moreover, for = the changes you want, could you also paste the code change?


Best Regards,

Sunny Wang

=C2=A0

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Mario Balanica via groups.io
Sent: Monday, May 31, 2021 8:41 PM
To: Sunny Wang <Sunny.Wang@arm.com>
Cc: devel= @edk2.groups.io; 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>
Subject: Re: [edk2-devel] [PATCH v3 2/2] Platform/RaspberryPi: Enab= le Bluetooth and UART in Windows OS

=C2=A0

Hi Sunny,

=C2=A0

What issues are you seeing with the PL011 UART in W= indows? Last time I checked, it worked fine, and the fact that Bluetooth wo= rks also confirms this.

It won't show up as a COM port (like mini UART = does) as it's built using SerCx2.

=C2=A0

@@ -30,6 +30,12 @@ Device (URT0)
=C2=A0 =C2=A0{
=C2=A0 =C2=A0 =C2=A0MEMORY32FIXED (ReadWrite, 0, BCM2836_PL011_UART_LENGTH= , RMEM)
=C2=A0 =C2=A0 =C2=A0Interrupt (ResourceConsumer, Level, ActiveHigh, Exclus= ive) { BCM2836_PL011_UART_INTERRUPT }
+
+=C2=A0 =C2=A0 PinFunction (Exclusive, PullDown, BCM_ALT3, "\\_SB.= GDV0.GPI0", 0, ResourceConsumer, , ) { 32, 33 }
+

=C2=A0

@@ -79,6 +85,11 @@ Device (URTM)
=C2=A0 =C2=A0 =C2=A0// from muxing the pins away.

=C2=A0 =C2=A0 =C2=A0// PinFunction (Exclusive, PullDown, BCM_ALT5, "<= a>\\_SB.GPI0", 0, ResourceConsumer, , ) { 14, 15 }
+=C2=A0 =C2=A0 PinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.= GDV0.GPI0", 0, ResourceConsumer, , ) { 32, 33 }
+

=C2=A0

What is the reason for trying to mux both UARTs to = the BT chip? If PL011 is used for Bluetooth and the mini UART driver loads after=C2=A0it, wouldn't it mux away the pins and break Bluetoot= h?

=C2=A0

=C2=A0

=C2=A0

=C2=A0

=C3=8En lun., 31 mai 2021 la 11:23, Sunny Wang <= Sunny.Wang@arm.com<= /a>> a scris:

This change is based o= n edk2-platforms-raspberrypi-pl011-bth-noflow.diff
in
https://github.com/worproject/RPi-Bluetooth-Testing/ for enabling
Bluetooth and serial port (Mini UART) in Windows IOT.

Note that PL011 UART still doesn't work with Windows 10 IOT with this<= br> change, but PL011 UART works fine with VMware ESXi-Arm Fling v1.3.
Therefore, there should be no issue with PL011 UART related changes,
and we will still need a Windows expert to take a further look in the
future. Making PL011 UART work properly with Windows 10 IOT may require additional changes to Windows driver or firmware's ACPI table.

Testing Done:
=C2=A0 - Successfully booted Windows Windows 10 IOT (20279.1) on SD (made = by WOR) with
=C2=A0 =C2=A0 the RPi-Windows-Drivers release ver 0.5 downloaded from
=C2=A0 =C2=A0 https://github.com/worproject/RPi-Windows-Drivers/releases
=C2=A0 =C2=A0 and checked that both Bluetooth and serial port (Mini UART) = can
=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 | 19 +++++++++++-------- =C2=A01 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/Raspberry= Pi/AcpiTables/Uart.asl
index bac9d791eb..cb99086d39 100644
--- a/Platform/RaspberryPi/AcpiTables/Uart.asl
+++ b/Platform/RaspberryPi/AcpiTables/Uart.asl
@@ -30,6 +30,12 @@ Device (URT0)
=C2=A0 =C2=A0{
=C2=A0 =C2=A0 =C2=A0MEMORY32FIXED (ReadWrite, 0, BCM2836_PL011_UART_LENGTH= , RMEM)
=C2=A0 =C2=A0 =C2=A0Interrupt (ResourceConsumer, Level, ActiveHigh, Exclus= ive) { BCM2836_PL011_UART_INTERRUPT }
+
+=C2=A0 =C2=A0 PinFunction (Exclusive, PullDown, BCM_ALT3, "\\_SB.= GDV0.GPI0", 0, ResourceConsumer, , ) { 32, 33 }
+
+=C2=A0 =C2=A0 // fake the CTS signal as we don't support HW flow cont= rol yet
+=C2=A0 =C2=A0 // BCM_ALT2 is set as output (low) by default
+=C2=A0 =C2=A0 PinFunction (Exclusive, PullNone, BCM_ALT2, "\\_SB.= GDV0.GPI0", 0, ResourceConsumer, , ) { 31 }
=C2=A0 =C2=A0})
=C2=A0 =C2=A0Method (_CRS, 0x0, Serialized)
=C2=A0 =C2=A0{
@@ -79,6 +85,11 @@ Device (URTM)
=C2=A0 =C2=A0 =C2=A0// from muxing the pins away.

=C2=A0 =C2=A0 =C2=A0// PinFunction (Exclusive, PullDown, BCM_ALT5, "<= a>\\_SB.GPI0", 0, ResourceConsumer, , ) { 14, 15 }
+=C2=A0 =C2=A0 PinFunction (Exclusive, PullDown, BCM_ALT5, "\\_SB.= GDV0.GPI0", 0, ResourceConsumer, , ) { 32, 33 }
+
+=C2=A0 =C2=A0 // fake the CTS signal as we don't support HW flow cont= rol yet
+=C2=A0 =C2=A0 // BCM_ALT2 is set as output (low) by default
+=C2=A0 =C2=A0 PinFunction (Exclusive, PullNone, BCM_ALT2, "\\_SB.= GDV0.GPI0", 0, ResourceConsumer, , ) { 31 }
=C2=A0 =C2=A0})
=C2=A0 =C2=A0Method (_CRS, 0x0, Serialized)
=C2=A0 =C2=A0{
@@ -143,10 +154,6 @@ Device(BTH0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0UAR0,=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // Desc= riptorName: 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 +197,6 @@ Device(BTH0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0UARM,=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // Desc= riptorName: 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)
--
2.31.0.windows.1

IMPORTANT NOTICE: The contents of this email and any attachments are confi= dential and may also be privileged. If you are not the intended recipient, = please notify the sender immediately and do not disclose the contents to an= y other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--00000000000016a9ba05c3a247d3--