Re: [PATCH V4 1/4] mfd: f81504-core: Add Fintek F81504/508/512 PCIE-to-UART/GPIO core support

From: Andy Shevchenko
Date: Tue Feb 23 2016 - 06:04:47 EST


On Tue, 2016-02-23 at 14:30 +0800, Peter Hung wrote:
> The Fintek F81504/508/512 had implemented the basic serial port
> function in
> 8250_pci.c. We try to implement high baudrate & GPIOLIB with a spilt
> file
> 8250_f81504.c, but it seems too complex to add GPIOLIB.

[...]

> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -345,6 +345,18 @@ config HTC_I2CPLD
> Â ÂÂThis device provides input and output GPIOs through an I2C
> Â ÂÂinterface to one or more sub-chips.
> Â
> +config MFD_FINTEK_F81504_CORE
> +ÂÂÂÂÂÂÂÂtristate "Fintek F81504/508/512 PCIE-to-UART/GPIO MFD
> support"
> +ÂÂÂÂÂÂÂÂdepends on PCI
> +ÂÂÂÂÂÂÂÂselect MFD_CORE
> +ÂÂÂÂÂÂÂÂdefault SERIAL_8250

SERIAL_8250_PCI ?

> +static bool f81504_is_gpio(unsigned int idx, u8 gpio_en)
> +{
> + unsigned int i;
> +
> + /* Find every port to check is multi-function port */
> + for (i = 0; i < ARRAY_SIZE(fintek_gpio_mapping); i++) {


> + if (fintek_gpio_mapping[i] != idx || !(gpio_en &
> BIT(i)))
> + continue;
> +
> + /*
> + Â* This port is multi-function and enabled as gpio
> mode.
> + Â* So we'll not configure it as serial port.
> + Â*/
> + return true;

Perhaps

if (fintek_gpio_mapping[i] == idx && (gpio_en & BIT(i)))
Âreturn true;

?

> + }
> +
> + return false;
> +}

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy