Re: [PATCH 2/2] serial: Add support for Fintek F81216A LPC to 4 UART

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +static int fintek_8250_get_index(resource_size_t base_addr)
> +{
> +	resource_size_t base[] = {0x3f8, 0x2f8, 0x3e8, 0x2e8};
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(base); i++)
> +		if (base_addr == base[i])
> +			return i;
> +
> +	return -ENODEV;

Less than ideal in some ways because the base may well be remapped by
other hardware or on non x86 devices. No obvious ideas how to fix it
though and PnP kind of implies x86.

> +	mutex_lock(&fintek_mutex);
> +	outb(LDN, ADDR_PORT);
> +	outb(index, DATA_PORT);
> +	outb(RS485, ADDR_PORT);
> +	outb(config, DATA_PORT);
> +	mutex_unlock(&fintek_mutex);

You really need to request that block of addresses because you may not be
the only superIO chip or driver playing with the various mux hack
registers that are used.

On the bright side you can then make the resource layer do your locking
work for you. We have an IORESOURCE_MUXED flag for these little horrors
so you can request the resource with IORESOURCE_MUXED. If the resource is
busy then you will get a failure back, if it is idle you will get the
resource, if it is busy but held by another driver using IORESOURCE_MUXED
then the request will block until they finish with it.

So you do

	request_muxed_region
	if failed then EBUSY
	prod stuff
	release_region


Alan

--
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




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux