From patchwork Thu Apr 9 07:40:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 46903 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C5AA721416 for ; Thu, 9 Apr 2015 07:40:54 +0000 (UTC) Received: by wiaa2 with SMTP id a2sf15371617wia.1 for ; Thu, 09 Apr 2015 00:40:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=b+iRqymZ3vU2AqHIqjbOrJ0awUUnyBcTHHdouDgEbIo=; b=XyexrSEmyitKrORRhYb478C/bySw4GDBgzPC+ev7IB16w95NVTmPvaG8o8Y5/4nAMm V+LscfyGqKWqPDdKnoWq15UOwtQz3jzNaPRpSXj9KaV1ext/T4WLG884tlxWZLV1JZ0N bFR97VykQ/PiU8upxnborqGqWN2NBRxQjesobcw1yK5LP1ElbXeJM/28FGjmfK4IYh6F 3vYz11dV2cfn1PhdGx6TXac6bOoYHp1nNxBgcUzHOm1mK67uaV2xUdRjbv8RlgcByWjp D8SHrvHp6dqL6ZTPJrDjiIRoofF/bLf1y9CxnFjmzO028+WHTQ7NetUntHtEFyiHyffJ lxFA== X-Gm-Message-State: ALoCoQlBeHcJYSHG+S9EDHhV7BKHDkLFeZH2CvIjzCjTUfFXoncP9ZS9CZgkUJjknBCxoG9c2wro X-Received: by 10.180.10.136 with SMTP id i8mr326959wib.7.1428565254155; Thu, 09 Apr 2015 00:40:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.181.5 with SMTP id ds5ls300946lac.20.gmail; Thu, 09 Apr 2015 00:40:54 -0700 (PDT) X-Received: by 10.112.184.70 with SMTP id es6mr26473244lbc.117.1428565253993; Thu, 09 Apr 2015 00:40:53 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id cs3si10769321lbb.138.2015.04.09.00.40.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 00:40:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by labbd9 with SMTP id bd9so71889162lab.2 for ; Thu, 09 Apr 2015 00:40:53 -0700 (PDT) X-Received: by 10.112.204.6 with SMTP id ku6mr12572390lbc.73.1428565253899; Thu, 09 Apr 2015 00:40:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp310771lbt; Thu, 9 Apr 2015 00:40:52 -0700 (PDT) X-Received: by 10.66.55.74 with SMTP id q10mr53754760pap.94.1428565252015; Thu, 09 Apr 2015 00:40:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gg9si19922097pbc.104.2015.04.09.00.40.50; Thu, 09 Apr 2015 00:40:52 -0700 (PDT) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751583AbbDIHku (ORCPT + 4 others); Thu, 9 Apr 2015 03:40:50 -0400 Received: from mail-la0-f43.google.com ([209.85.215.43]:35485 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751539AbbDIHkt (ORCPT ); Thu, 9 Apr 2015 03:40:49 -0400 Received: by labbd9 with SMTP id bd9so71887350lab.2 for ; Thu, 09 Apr 2015 00:40:47 -0700 (PDT) X-Received: by 10.152.45.37 with SMTP id j5mr3298257lam.31.1428565247850; Thu, 09 Apr 2015 00:40:47 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id rp10sm2072393lbb.8.2015.04.09.00.40.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 00:40:46 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Tomasz Figa , Kukjin Kim , Ben Dooks Cc: Linus Walleij Subject: [PATCH] RFT: pinctrl: samsung: separate wakeup irqdomain Date: Thu, 9 Apr 2015 09:40:41 +0200 Message-Id: <1428565241-5099-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The Samsung pin control driver and subdrivers sometimes use both an irqdomain for some IRQs and another irqdomain for wakeup irqs, registering the first with a call to the per-SoC callback .eint_gpio_init() and the second with a call to .eint_wkup_init() however it seems both runpaths will assign the resulting irqdomain to the per-bank bank.irq_domain member, making the second (wakeup) irqdomain overwrite the first one. I'm surprised this even works, and it seems that the S3C per-domain "domain data" that seems to be used in part to work around this bug by creating a local array with copies of the irqdomain (!). This patch mainly adds a new record to the GPIO/pin "bank" for wakeups and use this in the .eint_wkup_init() callbacks to pave the way for more cleanups. Signed-off-by: Linus Walleij --- Tomasz etc: I don't know if I'm just misunderstanding this, can you look at it and tell me how badly I misunderstand these Samsung wakeups, to me it is a complete mystery. --- drivers/pinctrl/samsung/pinctrl-exynos.c | 6 +++--- drivers/pinctrl/samsung/pinctrl-s3c24xx.c | 6 +++--- drivers/pinctrl/samsung/pinctrl-s3c64xx.c | 6 +++--- drivers/pinctrl/samsung/pinctrl-samsung.h | 1 + 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index c8f83f96546c..6adf34e3cce6 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -469,7 +469,7 @@ static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc) + b->eint_offset); mask = readl(d->virt_base + b->irq_chip->eint_mask + b->eint_offset); - exynos_irq_demux_eint(pend & ~mask, b->irq_domain); + exynos_irq_demux_eint(pend & ~mask, b->wkup_domain); } chained_irq_exit(chip, desc); @@ -511,9 +511,9 @@ static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) if (bank->eint_type != EINT_TYPE_WKUP) continue; - bank->irq_domain = irq_domain_add_linear(bank->of_node, + bank->wkup_domain = irq_domain_add_linear(bank->of_node, bank->nr_pins, &exynos_eint_irqd_ops, bank); - if (!bank->irq_domain) { + if (!bank->wkup_domain) { dev_err(dev, "wkup irq domain add failed\n"); return -ENXIO; } diff --git a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c index f1993f42114c..1dd1e5a0ed58 100644 --- a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c +++ b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c @@ -539,9 +539,9 @@ static int s3c24xx_eint_init(struct samsung_pinctrl_drv_data *d) ops = (bank->eint_offset == 0) ? &s3c24xx_gpf_irq_ops : &s3c24xx_gpg_irq_ops; - bank->irq_domain = irq_domain_add_linear(bank->of_node, + bank->wkup_domain = irq_domain_add_linear(bank->of_node, bank->nr_pins, ops, ddata); - if (!bank->irq_domain) { + if (!bank->wkup_domain) { dev_err(dev, "wkup irq domain add failed\n"); return -ENXIO; } @@ -553,7 +553,7 @@ static int s3c24xx_eint_init(struct samsung_pinctrl_drv_data *d) break; if (!(mask & 1)) continue; - eint_data->domains[irq] = bank->irq_domain; + eint_data->domains[irq] = bank->wkup_domain; ++irq; } } diff --git a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c index 7756c1e9e763..9701424a8bea 100644 --- a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c +++ b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c @@ -757,9 +757,9 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) } ddata->bank = bank; - bank->irq_domain = irq_domain_add_linear(bank->of_node, + bank->wkup_domain = irq_domain_add_linear(bank->of_node, nr_eints, &s3c64xx_eint0_irqd_ops, ddata); - if (!bank->irq_domain) { + if (!bank->wkup_domain) { dev_err(dev, "wkup irq domain add failed\n"); return -ENXIO; } @@ -769,7 +769,7 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) for (pin = 0; mask; ++pin, mask >>= 1) { if (!(mask & 1)) continue; - data->domains[irq] = bank->irq_domain; + data->domains[irq] = bank->wkup_domain; data->pins[irq] = pin; ddata->eints[pin] = irq; ++irq; diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.h b/drivers/pinctrl/samsung/pinctrl-samsung.h index 1b8c0139d604..c97dd1e6ae2e 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.h +++ b/drivers/pinctrl/samsung/pinctrl-samsung.h @@ -170,6 +170,7 @@ struct samsung_pin_bank { struct device_node *of_node; struct samsung_pinctrl_drv_data *drvdata; struct irq_domain *irq_domain; + struct irq_domain *wkup_domain; struct gpio_chip gpio_chip; struct pinctrl_gpio_range grange; struct exynos_irq_chip *irq_chip;