lkml.org 
[lkml]   [2019]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH resend] serial: 8250: Add support for using platform_device resources
On Tue, May 21, 2019 at 01:34:26PM +0200, Esben Haabendal wrote:
> Allow getting memory resource (mapbase or iobase) as well as irq from
> platform_device resources.
>
> The UPF_DEV_RESOURCES flag must be set for devices where platform_device
> resources are to be used. When not set, driver behaves as before.
>
> This allows use of the serial8250 driver together with devices with
> resources added by platform_device_add_resources(), such as mfd child
> devices added with mfd_add_devices().
>
> When UPF_DEV_RESOURCES flag is set, the following platform_data fields should
> not be used: mapbase, iobase, mapsize, and irq. They are superseded by the
> resources attached to the device.
>

Same comment here: Requesting resource is orthogonal to the retrieving or
slicing them.

> + if (p->flags & UPF_DEV_RESOURCES) {
> + serial8250_probe_resources(dev, i, p, &uart);

This can be easily detected by checking for the resources directly, like

res = platform_get_resource(...);
if (res)
new_scheme();
else
old_scheme();

Otherwise looks good.


> - if (!request_mem_region(port->mapbase, size, "serial")) {
> + if (!(port->flags & UPF_DEV_RESOURCES) &&
> + !request_mem_region(port->mapbase, size, "serial")) {

> - release_mem_region(port->mapbase, size);
> + if (!(port->flags & UPF_DEV_RESOURCES))
> + release_mem_region(port->mapbase, size);

> - if (!request_region(port->iobase, size, "serial"))
> + if (!(port->flags & UPF_DEV_RESOURCES) &&
> + !request_region(port->iobase, size, "serial"))

> - release_mem_region(port->mapbase, size);
> + if (!(port->flags & UPF_DEV_RESOURCES))
> + release_mem_region(port->mapbase, size);

> - release_region(port->iobase, size);
> + if (!(port->flags & UPF_DEV_RESOURCES))
> + release_region(port->iobase, size);

All these changes are not related to what you describe in the commit message.
is a workaround for the bug in the parent MFD driver of the 8250.

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2019-05-21 14:42    [W:0.189 / U:2.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site