I2C: DWC3 USB: Add support for ACPI based AArch64 Laptops
v4 cover I2C: DWC3 USB: Add support for ACPI based AArch64 Laptops
This patch-set ensures the kernel is bootable on the newly released AArch64 based Laptops using ACPI configuration tables. The Pinctrl changes have been accepted, leaving only I2C (keyboard, touchpad, touchscreen, fingerprint, etc, HID device) and USB (root filesystem, camera, networking, etc) enablement.
RESEND: Stripped I2C patches as they have also been merged into
their respective subsystem.
v4:
* Collecting Acks
* Adding Andy Gross' new email
* Removing applied Pinctrl patches
Lee Jones (4):
soc: qcom: geni: Add support for ACPI
usb: dwc3: qcom: Add support for booting with ACPI
usb: dwc3: qcom: Start USB in 'host mode' on the SDM845
usb: dwc3: qcom: Improve error handling
drivers/soc/qcom/qcom-geni-se.c | 21 ++- drivers/usb/dwc3/Kconfig | 2 +- drivers/usb/dwc3/dwc3-qcom.c | 221 ++++++++++++++++++++++++++++---- 3 files changed, 209 insertions(+), 35 deletions(-)
Signature · 1 line
2.17.1
PATCH RESEND v4 1/4 soc: qcom: geni: Add support for ACPI
When booting with ACPI as the active set of configuration tables, all; clocks, regulators, pin functions ect are expected to be at their ideal values/levels/rates, thus the associated frameworks are unavailable. Ensure calls to these APIs are shielded when ACPI is enabled.
--- drivers/soc/qcom/qcom-geni-se.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/soc/qcom/qcom-geni-se.c +15 -6
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. +#include <linux/acpi.h> #include <linux/clk.h> #include <linux/slab.h> #include <linux/dma-mapping.h>
@@ -450,6 +451,9 @@ int geni_se_resources_off(struct geni_se *se) {int ret; +if (has_acpi_companion (se->dev)) +return 0 ; + ret =pinctrl_pm_select_sleep_state (se->dev);if (ret)return ret;
@@ -487,6 +491,9 @@ int geni_se_resources_on(struct geni_se *se) {int ret; +if (has_acpi_companion (se->dev)) +return 0 ; + ret =geni_se_clks_on (se);if (ret)return ret;
@@ -724,12 +731,14 @@ static int geni_se_probe(struct platform_device *pdev)if (IS_ERR (wrapper->base))return PTR_ERR (wrapper->base); - wrapper->ahb_clks[0 ].id ="m-ahb" ; - wrapper->ahb_clks[1 ].id ="s-ahb" ; - ret =devm_clk_bulk_get (dev,NUM_AHB_CLKS , wrapper->ahb_clks); -if (ret) { -dev_err (dev,"Err getting AHB clks %d\n" , ret); -return ret; +if (!has_acpi_companion (&pdev->dev)) { + wrapper->ahb_clks[0 ].id ="m-ahb" ; + wrapper->ahb_clks[1 ].id ="s-ahb" ; + ret =devm_clk_bulk_get (dev,NUM_AHB_CLKS , wrapper->ahb_clks); +if (ret) { +dev_err (dev,"Err getting AHB clks %d\n" , ret); +return ret; + } }dev_set_drvdata (dev, wrapper);
Signature · 1 line
2.17.1
Andy Gross
AppliedRe: [RESEND v4 1/4] soc: qcom: geni: Add support for ACPI
Quoted 8 lines · Lee Jones
When booting with ACPI as the active set of configuration tables, all; clocks, regulators, pin functions ect are expected to be at their ideal values/levels/rates, thus the associated frameworks are unavailable. Ensure calls to these APIs are shielded when ACPI is enabled.
Signed-off-by Lee Jones <[email protected]>Acked-by Ard Biesheuvel <[email protected]>
Applied.
Thanks,
Andy
Re: [RESEND v4 1/4] soc: qcom: geni: Add support for ACPI
Quoted 11 lines · Andy Gross
Quoted 8 lines · Lee Jones
When booting with ACPI as the active set of configuration tables, all; clocks, regulators, pin functions ect are expected to be at their ideal values/levels/rates, thus the associated frameworks are unavailable. Ensure calls to these APIs are shielded when ACPI is enabled.
Signed-off-by Lee Jones <[email protected]>Acked-by Ard Biesheuvel <[email protected]>Applied.
Thanks Bjorn and Andy.
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH RESEND v4 2/4 usb: dwc3: qcom: Add support for booting with ACPI
In reply to Lee JonesIn Linux, the DWC3 core exists as its own independent platform device. Thus when describing relationships in Device Tree, the current default boot configuration table option, the DWC3 core often resides as a child of the platform specific node. Both of which are given their own address space descriptions and the drivers can be mostly agnostic to each other.
However, other Operating Systems have taken a more monolithic approach, which is evident in the configuration ACPI tables for the Qualcomm Snapdragon SDM850, where all DWC3 (core and platform) components are described under a single IO memory region.
To ensure successful booting using the supplied ACPI tables, we need to devise a way to chop up the address regions provided and subsequently register the DWC3 core with the resultant information, which is precisely what this patch aims to achieve.
--- drivers/usb/dwc3/Kconfig | 2 +- drivers/usb/dwc3/dwc3-qcom.c | 206 ++++++++++++++++++++++++++++++----- 2 files changed, 179 insertions(+), 29 deletions(-)
drivers/usb/dwc3/Kconfig +1 -1
@@ -128,7 +128,7 @@ config USB_DWC3_QCOM tristate "Qualcomm Platform" depends on ARCH_QCOM || COMPILE_TEST depends on EXTCON || !EXTCON - depends on OF + depends on (OF || ACPI) default USB_DWC3 help Some Qualcomm SoCs use DesignWare Core IP for USB2/3
drivers/usb/dwc3/dwc3-qcom.c +178 -28
313 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH RESEND v4 3/4 usb: dwc3: qcom: Start USB in 'host mode' on the SDM845
In reply to Lee JonesWhen booting with Device Tree, the current default boot configuration table option, the request to boot via 'host mode' comes from the 'dr_mode' property. A property of the same name can be used inside ACPI tables too. However it is missing from the SDM845's ACPI tables so we have to supply this information using Platform Device Properties instead.
This does not change the behaviour of any currently supported devices. The property is only set on ACPI enabled platforms, thus for H/W booting DT, unless a 'dr_mode' property is present, the default is still OTG (On-The-Go) as per [0]. Any new ACPI devices added will also be able to over-ride this implementation by providing a 'dr_mode' property in their ACPI tables. In cases where 'dr_mode' is omitted from the tables AND 'host mode' should not be the default (very unlikely), then we will have to add some way of choosing between them at run time - most likely by ACPI HID.
[0] Documentation/devicetree/bindings/usb/generic.txt
--- drivers/usb/dwc3/dwc3-qcom.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/dwc3/dwc3-qcom.c +12 -0
@@ -444,6 +444,11 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)return 0 ; } +static const struct property_entry dwc3_qcom_acpi_properties[] = { +PROPERTY_ENTRY_STRING ("dr_mode" ,"host" ), + {} +}; +static int dwc3_qcom_acpi_register_core (struct platform_device *pdev) {struct dwc3_qcom *qcom =platform_get_drvdata (pdev);
@@ -488,6 +493,13 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) goto out; } + ret =platform_device_add_properties (qcom->dwc3, + dwc3_qcom_acpi_properties); +if (ret <0 ) { +dev_err (&pdev->dev,"failed to add properties\n" ); + goto out; + } + ret =platform_device_add (qcom->dwc3);if (ret)dev_err (&pdev->dev,"failed to add device\n" );
Signature · 1 line
2.17.1
PATCH RESEND v4 4/4 usb: dwc3: qcom: Improve error handling
In reply to Lee Jonesdwc3_qcom_clk_init() is called with of_count_phandle_with_args() as an argument. If of_count_phandle_with_args() returns an error, the number of clocks will be a negative value and will lead to undefined behaviour.
Ensure we check for an error before attempting to blindly use the value.
--- drivers/usb/dwc3/dwc3-qcom.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/dwc3/dwc3-qcom.c +3 -0
@@ -409,6 +409,9 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)if (!np || !count)return 0 ; +if (count <0 ) +return count; + qcom->num_clocks = count; qcom->clks = devm_kcalloc(dev, qcom->num_clocks,
Signature · 1 line
2.17.1
Quoted 14 lines · Lee Jones
This patch-set ensures the kernel is bootable on the newly released AArch64 based Laptops using ACPI configuration tables. The Pinctrl changes have been accepted, leaving only I2C (keyboard, touchpad, touchscreen, fingerprint, etc, HID device) and USB (root filesystem, camera, networking, etc) enablement.
RESEND: Stripped I2C patches as they have also been merged into
their respective subsystem.v4:
* Collecting Acks
* Adding Andy Gross' new email
* Removing applied Pinctrl patches
Quoted 5 lines
Lee Jones (4):
soc: qcom: geni: Add support for ACPI
usb: dwc3: qcom: Add support for booting with ACPI
usb: dwc3: qcom: Start USB in 'host mode' on the SDM845
usb: dwc3: qcom: Improve error handling
pushed to testing/next
Signature · 1 line
balbi
Quoted 16 lines · Felipe Balbi
Quoted 14 lines · Lee Jones
This patch-set ensures the kernel is bootable on the newly released AArch64 based Laptops using ACPI configuration tables. The Pinctrl changes have been accepted, leaving only I2C (keyboard, touchpad, touchscreen, fingerprint, etc, HID device) and USB (root filesystem, camera, networking, etc) enablement.
RESEND: Stripped I2C patches as they have also been merged into
their respective subsystem.v4:
* Collecting Acks
* Adding Andy Gross' new email
* Removing applied Pinctrl patches
Quoted 7 lines
Quoted 5 lines
Lee Jones (4):
soc: qcom: geni: Add support for ACPI
usb: dwc3: qcom: Add support for booting with ACPI
usb: dwc3: qcom: Start USB in 'host mode' on the SDM845
usb: dwc3: qcom: Improve error handlingpushed to testing/next
Sounds promising, thanks Felipe.
OOI, what is your process?
How does do the patches typically sit in there?
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Hi,
Quoted 24 lines · Lee Jones
Quoted 22 lines · Felipe Balbi
Quoted 19 lines · Lee Jones
This patch-set ensures the kernel is bootable on the newly released AArch64 based Laptops using ACPI configuration tables. The Pinctrl changes have been accepted, leaving only I2C (keyboard, touchpad, touchscreen, fingerprint, etc, HID device) and USB (root filesystem, camera, networking, etc) enablement.
RESEND: Stripped I2C patches as they have also been merged into
their respective subsystem.v4:
* Collecting Acks
* Adding Andy Gross' new email
* Removing applied Pinctrl patchesLee Jones (4):
soc: qcom: geni: Add support for ACPI
usb: dwc3: qcom: Add support for booting with ACPI
usb: dwc3: qcom: Start USB in 'host mode' on the SDM845
usb: dwc3: qcom: Improve error handling
Quoted 7 lines
Quoted 1 line
pushed to testing/next
Sounds promising, thanks Felipe.
OOI, what is your process?
How does do the patches typically sit in there?
I'll probably merge to my 'next' branch today. I leave them in testing/next for a couple days, usually, so 0-day can run its thing and I get a chance of at least boot testing on our machines in the lab here.
Since this doesn't touch anything "generic", I don't _have_ to boot test, so I'll probably merge to 'next' today.
Signature · 1 line
balbi
Quoted 31 lines · Felipe Balbi
Quoted 30 lines · Lee Jones
Quoted 16 lines · Felipe Balbi
Quoted 14 lines · Lee Jones
This patch-set ensures the kernel is bootable on the newly released AArch64 based Laptops using ACPI configuration tables. The Pinctrl changes have been accepted, leaving only I2C (keyboard, touchpad, touchscreen, fingerprint, etc, HID device) and USB (root filesystem, camera, networking, etc) enablement.
RESEND: Stripped I2C patches as they have also been merged into
their respective subsystem.v4:
* Collecting Acks
* Adding Andy Gross' new email
* Removing applied Pinctrl patchesQuoted 7 lines
Quoted 5 lines
Lee Jones (4):
soc: qcom: geni: Add support for ACPI
usb: dwc3: qcom: Add support for booting with ACPI
usb: dwc3: qcom: Start USB in 'host mode' on the SDM845
usb: dwc3: qcom: Improve error handlingpushed to testing/next
Sounds promising, thanks Felipe.
OOI, what is your process?
Quoted 8 lines
Quoted 1 line
How does do the patches typically sit in there?
I'll probably merge to my 'next' branch today. I leave them in testing/next for a couple days, usually, so 0-day can run its thing and I get a chance of at least boot testing on our machines in the lab here.
Since this doesn't touch anything "generic", I don't _have_ to boot test, so I'll probably merge to 'next' today.
You're a star. Thanks Felipe.
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Hi,
Quoted 34 lines · Lee Jones
Quoted 33 lines · Felipe Balbi
Quoted 31 lines · Lee Jones
Quoted 16 lines · Felipe Balbi
Quoted 14 lines · Lee Jones
This patch-set ensures the kernel is bootable on the newly released AArch64 based Laptops using ACPI configuration tables. The Pinctrl changes have been accepted, leaving only I2C (keyboard, touchpad, touchscreen, fingerprint, etc, HID device) and USB (root filesystem, camera, networking, etc) enablement.
RESEND: Stripped I2C patches as they have also been merged into
their respective subsystem.v4:
* Collecting Acks
* Adding Andy Gross' new email
* Removing applied Pinctrl patchesQuoted 7 lines
Quoted 5 lines
Lee Jones (4):
soc: qcom: geni: Add support for ACPI
usb: dwc3: qcom: Add support for booting with ACPI
usb: dwc3: qcom: Start USB in 'host mode' on the SDM845
usb: dwc3: qcom: Improve error handlingpushed to testing/next
Sounds promising, thanks Felipe.
OOI, what is your process?
How does do the patches typically sit in there?
Quoted 8 lines
Quoted 6 lines
I'll probably merge to my 'next' branch today. I leave them in testing/next for a couple days, usually, so 0-day can run its thing and I get a chance of at least boot testing on our machines in the lab here.
Since this doesn't touch anything "generic", I don't _have_ to boot test, so I'll probably merge to 'next' today.
You're a star. Thanks Felipe.
it's in my 'next' now. Should be in tomorrow's linux next.
Signature · 1 line
balbi