From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Subject: Re: [PATCH v2] pinctrl: cherryview: Add support for GMMR GPIO opregion Date: Wed, 22 Mar 2017 19:00:54 +0200 Message-ID: <1490202054.19767.173.camel@linux.intel.com> References: <20170322153858.19656-1-hdegoede@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: Received: from mga05.intel.com ([192.55.52.43]:53695 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760972AbdCVRBI (ORCPT ); Wed, 22 Mar 2017 13:01:08 -0400 In-Reply-To: <20170322153858.19656-1-hdegoede@redhat.com> Sender: linux-gpio-owner@vger.kernel.org List-Id: linux-gpio@vger.kernel.org To: Hans de Goede , Mika Westerberg , Heikki Krogerus , Linus Walleij Cc: linux-gpio@vger.kernel.org On Wed, 2017-03-22 at 16:38 +0100, Hans de Goede wrote: > On some Cherry Trail devices the ASL uses the GMMR GPIO to access > GPIOs so as to serialize MMIO accesses to GPIO registers with the > OS, because: > > "Due to a silicon issue, a shared lock must be used to prevent > concurrent > accesses across the 4 GPIO controllers. > > See Intel Atom Z8000 Processor Series Specification Update (Rev. 005), > errata #CHT34, for further information." > > This commit adds support for this opregion, this fixes a number of > ASL errors on my Ezpad mini3 tablet and makes the otg port device/host > muxing which is controlled in firmware on this model work properly. > > Signed-off-by: Hans de Goede > Reviewed-by: Andy Shevchenko > +static acpi_status chv_pinctrl_mmio_access_handler(u32 function, > + acpi_physical_address address, u32 bits, u64 *value, > + void *handler_context, void *region_context) > +{ > + struct chv_pinctrl *pctrl = region_context; > + unsigned long flags; > + acpi_status ret = AE_OK; > + > + raw_spin_lock_irqsave(&chv_lock, flags); > + > + if (function == ACPI_WRITE) > + chv_writel((u32)(*value), pctrl->regs + > (u32)address); > + else if (function == ACPI_READ) > + *value = readl(pctrl->regs + (u32)address); > + else > + ret = AE_BAD_PARAMETER; > + > + raw_spin_unlock_irqrestore(&chv_lock, flags); > + > + return AE_OK; return ret; Didn't notice before, sorry. -- Andy Shevchenko Intel Finland Oy