Messages in this thread Patch in this message | | | Date | Fri, 18 Mar 2022 16:37:21 +0200 | From | Heikki Krogerus <> | Subject | Re: ucsi_acpi: probe of USBC000:00 fails with ioremap error |
| |
Hi Paul,
On Fri, Mar 18, 2022 at 01:36:37PM +0100, Paul Menzel wrote: > Dear Linux folks, > > > On a Dell Precision 3540, Linux 5.16.12 reports an ioremap error: > > [ 0.000000] Linux version 5.16.0-4-amd64 > (debian-kernel@lists.debian.org) (gcc-11 (Debian 11.2.0-18) 11.2.0, GNU ld > (GNU Binutils for Debian) 2.38) #1 SMP PREEMPT Debian 5.16.12-1 (2022-03-08) > [ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-5.16.0-4-amd64 > root=UUID=c9342a55-b747-4442-b2f4-bc03eb7a51cf ro quiet noisapnp > log_buf_len=2M cryptomgr.notests btusb.enable_autosuspend=y > random.trust_cpu=on > […] > [ 0.000000] DMI: Dell Inc. Precision 3540/0M14W7, BIOS 1.15.0 > 12/08/2021 > […] > [ 24.230968] videodev: Linux video capture interface: v2.00 > [ 24.237747] ioremap error for 0x78e31000-0x78e32000, requested 0x2, > got 0x0 > [ 24.238100] ucsi_acpi: probe of USBC000:00 failed with error -12 > […] > $ sudo more /proc/iomem > […] > 78a04000-78ea2fff : ACPI Non-volatile Storage > 78e31000-78e31fff : USBC000:00 > […] > > This seems to happen on a lot of Dell devices, cf. bug 199741 (ioremap error > on Dell XPS 9370) [1].
I'm not sure if this helps, but I'm going to change the ioremap() call to memremap() soon in any case in this driver. Can you test the attached patch?
thanks,
-- heikki From be67ec57a68e28877e4d379d7624d30141e324ab Mon Sep 17 00:00:00 2001 From: Heikki Krogerus <heikki.krogerus@linux.intel.com> Date: Fri, 18 Mar 2022 17:23:09 +0300 Subject: [PATCH] usb: typec: ucsi: acpi: Map the mailbox with memremap()
Interim.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> --- drivers/usb/typec/ucsi/ucsi_acpi.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c index 6771f05e32c29..7455e3aff2be0 100644 --- a/drivers/usb/typec/ucsi/ucsi_acpi.c +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c @@ -19,7 +19,7 @@ struct ucsi_acpi { struct device *dev; struct ucsi *ucsi; - void __iomem *base; + void *base; struct completion complete; unsigned long flags; guid_t guid; @@ -51,7 +51,7 @@ static int ucsi_acpi_read(struct ucsi *ucsi, unsigned int offset, if (ret) return ret; - memcpy(val, (const void __force *)(ua->base + offset), val_len); + memcpy(val, ua->base + offset, val_len); return 0; } @@ -61,7 +61,7 @@ static int ucsi_acpi_async_write(struct ucsi *ucsi, unsigned int offset, { struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); - memcpy((void __force *)(ua->base + offset), val, val_len); + memcpy(ua->base + offset, val, val_len); return ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_WRITE); } @@ -132,18 +132,7 @@ static int ucsi_acpi_probe(struct platform_device *pdev) return -ENODEV; } - /* This will make sure we can use ioremap() */ - status = acpi_release_memory(ACPI_HANDLE(&pdev->dev), res, 1); - if (ACPI_FAILURE(status)) - return -ENOMEM; - - /* - * NOTE: The memory region for the data structures is used also in an - * operation region, which means ACPI has already reserved it. Therefore - * it can not be requested here, and we can not use - * devm_ioremap_resource(). - */ - ua->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + ua->base = devm_memremap(&pdev->dev, res->start, resource_size(res), MEMREMAP_WB); if (!ua->base) return -ENOMEM; -- 2.35.1
| |