From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752460AbcBWLEn (ORCPT ); Tue, 23 Feb 2016 06:04:43 -0500 Received: from mga04.intel.com ([192.55.52.120]:28359 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752138AbcBWLEl (ORCPT ); Tue, 23 Feb 2016 06:04:41 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,488,1449561600"; d="scan'208";a="892577810" Message-ID: <1456225517.13244.41.camel@linux.intel.com> Subject: Re: [PATCH V4 1/4] mfd: f81504-core: Add Fintek F81504/508/512 PCIE-to-UART/GPIO core support From: Andy Shevchenko To: Peter Hung , linus.walleij@linaro.org, gnurou@gmail.com, gregkh@linuxfoundation.org, paul.gortmaker@windriver.com, lee.jones@linaro.org, jslaby@suse.com, gnomes@lxorguk.ukuu.org.uk, peter_hong@fintek.com.tw Cc: heikki.krogerus@linux.intel.com, peter@hurleysoftware.com, soeren.grunewald@desy.de, udknight@gmail.com, adam.lee@canonical.com, arnd@arndb.de, manabian@gmail.com, scottwood@freescale.com, yamada.masahiro@socionext.com, paul.burton@imgtec.com, mans@mansr.com, matthias.bgg@gmail.com, ralf@linux-mips.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org, tom_tsai@fintek.com.tw, Peter Hung Date: Tue, 23 Feb 2016 13:05:17 +0200 In-Reply-To: <1456209003-22396-2-git-send-email-hpeter+linux_kernel@gmail.com> References: <1456209003-22396-1-git-send-email-hpeter+linux_kernel@gmail.com> <1456209003-22396-2-git-send-email-hpeter+linux_kernel@gmail.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Intel Finland Oy