Hi, On Mon, Dec 02, 2013 at 03:46:22PM +0400, Sergei Ianovich wrote: > On Mon, 2013-12-02 at 10:48 +0200, Heikki Krogerus wrote: > > On Sun, Dec 01, 2013 at 10:26:18AM +0400, Sergei Ianovich wrote: > > > +static int request_and_remap(int i) > > > +{ > > > + if (!request_mem_region(extra_mem[i], 1, "serial")) > > > + return -EBUSY; > > > + > > > + lp8x4x_data[i].private_data = ioremap(extra_mem[i], 1); > > > + if (lp8x4x_data[i].private_data) > > > + return 0; > > > + > > > + release_mem_region(extra_mem[i], 1); > > > + return -ENODEV; > > > Instead of registering a platform device for serial8250 here, you need > > to simply register a platform driver for something like lp8x4x_serial. > > The platform code will to registers the platform devices for it. You > > will use serial8250_register_8250_port() in your probe to register a > > new port. Use 8250_em.c and 8250_dw.c under drivers/tty/serial/8250/ > > as an example. > > > > You don't need to introduce plat_serial8250_port so you won't need > > the QUIRK_PORT stuff. You deliver the iomem and the irq as normal > > resources that the driver uses when you create the platform device. > > That of course also means the driver does not need to care about the > > instances. The platform code will generate a platform device for as > > many ports you have and set to resources accordingly. > > 8250_core.c doesn't use platform infrastructure to request and map IO > memory. There will be a conflict (and an error in > serial8250_request_std_resource()), if main IO memory is requested by > the platform device, won't it? You don't need to request the mem region in your probe driver. You can still map it. You have the flag UPF_IOREMAP that you can use to tell 8250_code.c to map the region. If you don't set the flag, 8250_core.c will in practice expect that port->membase is already set by the probe driver. Check 8250_dw.c. It does the mapping on it's own and simply doesn't set the flag. Br, -- heikki -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html