From patchwork Fri Oct 27 20:21:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 831493 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="E+57a4Tw"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yNwJx4cCVz9t3l for ; Sat, 28 Oct 2017 07:22:09 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751854AbdJ0UWJ (ORCPT ); Fri, 27 Oct 2017 16:22:09 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:53116 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751831AbdJ0UWI (ORCPT ); Fri, 27 Oct 2017 16:22:08 -0400 Received: by mail-wm0-f67.google.com with SMTP id t139so5844078wmt.1 for ; Fri, 27 Oct 2017 13:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vwEgeMlANj81tpLa4Ph8+3rET1AF6vw2TAj/lcZ6Ejo=; b=E+57a4TwMLTdIJNlJzxlur8g9O+1JqSNmAbQObzWYxuqC0Xz0nI4lleJb03VgJt7Y/ FcD+/99e0sOGygAf3W3TFzC7wc9b/IqdVkwqnjRWjiV2yO6VcJmcrtAH6VKpUb0f3EHi 8Wpd+6aw29CCfSDG2+39bHm3ELgH9527hshf0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vwEgeMlANj81tpLa4Ph8+3rET1AF6vw2TAj/lcZ6Ejo=; b=fjJ5yCtg2ospwAEkDtzaB6OGHk5BT6kmibupxDXnHO92QUtgXimnJ3C9XEAXcuuNZX Y02+RF/G4UeA3l802yu28O9+edG87cV8qneOQbbEfKMe9Bekexez1U1A7fdIXqd+j/tZ e/HbJuC32SCcS1KfclXB3S00jdRyOR9kjlUSYEegNexQ4ShheKODV+d45AaQcaFspQkU ZQNu/oFGQGMmkW1YS64odkjZxC+k8cMGrm+JWzK/2TsYbrcKF6nkXp95xgjKndNy6TDV EXiQwQVXzQe0jYdhPK7609YriCQ0pDbZBxnuergQtYOwQhOAAQmRSo5nUsqwRE0YHOjd lXPg== X-Gm-Message-State: AMCzsaVWVbyoXBptiUPXlWdVMfuLsIP4CeXI2/MQ709xAOd8JQXqaNp+ 8OpdfPnGByHOSnjBJ0cJf+jFbhkGYFo= X-Google-Smtp-Source: ABhQp+TEmqOrfvDer4dwTW7V9SmCOrD/Hq5eos+XIjZS/19sFyESNUPN8ZU34FqASF9CgZN284MB9g== X-Received: by 10.28.174.78 with SMTP id x75mr1427527wme.27.1509135727002; Fri, 27 Oct 2017 13:22:07 -0700 (PDT) Received: from localhost.localdomain ([160.171.245.11]) by smtp.gmail.com with ESMTPSA id c37sm10388722wrc.92.2017.10.27.13.22.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 13:22:05 -0700 (PDT) From: Ard Biesheuvel To: linux-gpio@vger.kernel.org Cc: linus.walleij@linaro.org, daniel.thompson@linaro.org, leif.lindholm@linaro.org, jaswinder.singh@linaro.org, masami.hiramatsu@linaro.org, Ard Biesheuvel , Geliang Tang , Paul Gortmaker Subject: [PATCH 1/2] gpio: mb86s7x: share with other SoCs as module Date: Fri, 27 Oct 2017 21:21:47 +0100 Message-Id: <20171027202148.4188-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171027202148.4188-1-ard.biesheuvel@linaro.org> References: <20171027202148.4188-1-ard.biesheuvel@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org In order to reuse this driver for the Socionext Synquacer SC2A11 SoC, which inherited this IP from Fujitsu, remove the ARCH_MB86S7X Kconfig dependency, and revert the changes that prevent it from being built as a module. This reverts commits d65aa4b67b4f47f303bdeaef1e4d42ef18e6b293 and d5610e514e92144d19bd5e39e5cf3804bbf85f3e. Cc: Geliang Tang Cc: Linus Walleij Cc: Paul Gortmaker Signed-off-by: Ard Biesheuvel --- drivers/gpio/Kconfig | 3 +-- drivers/gpio/gpio-mb86s7x.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 3f80f167ed56..bf40a948e4cc 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -286,8 +286,7 @@ config GPIO_LYNXPOINT Requires ACPI device enumeration code to set up a platform device. config GPIO_MB86S7X - bool "GPIO support for Fujitsu MB86S7x Platforms" - depends on ARCH_MB86S7X || COMPILE_TEST + tristate "GPIO support for Fujitsu MB86S7x Platforms" help Say yes here to support the GPIO controller in Fujitsu MB86S70 SoCs. diff --git a/drivers/gpio/gpio-mb86s7x.c b/drivers/gpio/gpio-mb86s7x.c index 94d772677ed6..6e1598471733 100644 --- a/drivers/gpio/gpio-mb86s7x.c +++ b/drivers/gpio/gpio-mb86s7x.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -209,6 +210,7 @@ static const struct of_device_id mb86s70_gpio_dt_ids[] = { { .compatible = "fujitsu,mb86s70-gpio" }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, mb86s70_gpio_dt_ids); static struct platform_driver mb86s70_gpio_driver = { .driver = { @@ -219,4 +221,12 @@ static struct platform_driver mb86s70_gpio_driver = { .remove = mb86s70_gpio_remove, }; -builtin_platform_driver(mb86s70_gpio_driver); +static int __init mb86s70_gpio_init(void) +{ + return platform_driver_register(&mb86s70_gpio_driver); +} +module_init(mb86s70_gpio_init); + +MODULE_DESCRIPTION("MB86S7x GPIO Driver"); +MODULE_ALIAS("platform:mb86s70-gpio"); +MODULE_LICENSE("GPL"); From patchwork Fri Oct 27 20:21:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 831494 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ZpBikJL1"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yNwK01G1hz9t3l for ; Sat, 28 Oct 2017 07:22:12 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751937AbdJ0UWL (ORCPT ); Fri, 27 Oct 2017 16:22:11 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:56575 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751831AbdJ0UWL (ORCPT ); Fri, 27 Oct 2017 16:22:11 -0400 Received: by mail-wm0-f68.google.com with SMTP id z3so5811324wme.5 for ; Fri, 27 Oct 2017 13:22:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0/NKbU3bn70N2wDAa/SJuZL5Bi72sfRkly7jnxJofBM=; b=ZpBikJL1ggvNWzPv3Bny1/uB4giQqGprbbknLJ/1K0XfIuE8QBuCuMtRZFP1TjSY0c tbnD4x4Ermh3uPHVPerS1eB5hmLpaorU43MmHd3YDliPSi2ujY/liM6zTR1R23eu/tFI x9PjmfS0sCYUiHUIevqNReIaQBncXeF1efwxU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0/NKbU3bn70N2wDAa/SJuZL5Bi72sfRkly7jnxJofBM=; b=q/oIVF9AVMzkYKxOsAsTm/cbp2EIbntFqYTUoG/E6rl9RFGOwCkFJQNpGdmmx0rMbX suFVHY7Onamv6elukgA9qd1sHiFg8J1wU3jdwIPQW31f9O+gVrqEPFDbrBwvZXFq4F72 IV1a4xbBWuBkYFIfHtWIGLFkw6pUBCXi1mWCJQJLzGjcwvubX/qVb4ujIQuFKCvuJ8Oy yK7tRc4aaTIYHdgtECE4Vn6w5Yiw3akPakAuYXpgxiDw4hfdUb/UDHf+Wuy0eMn+YWbY 18IxZPbek7pnSYt74EP/c7XU/WRyDkmsp2aYVdUb5jVeb2TV//VYWRLlWvHsqTbizxN0 6kUw== X-Gm-Message-State: AMCzsaVzbXKOopM9TN94ioClm5J85ZUaXvDfIpAGhU+3h3qEEBdCHdro NdDE5gjERnqvA/5zOzwD2PMESWf+EGg= X-Google-Smtp-Source: ABhQp+TF6ViWjz3yx2GqtAaY2HT0FUpctuZB0IdPLoIOte03F0PgNl1gxWR/T8ted3X2/Po01ltd+Q== X-Received: by 10.28.178.205 with SMTP id b196mr1272031wmf.103.1509135729647; Fri, 27 Oct 2017 13:22:09 -0700 (PDT) Received: from localhost.localdomain ([160.171.245.11]) by smtp.gmail.com with ESMTPSA id c37sm10388722wrc.92.2017.10.27.13.22.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 13:22:08 -0700 (PDT) From: Ard Biesheuvel To: linux-gpio@vger.kernel.org Cc: linus.walleij@linaro.org, daniel.thompson@linaro.org, leif.lindholm@linaro.org, jaswinder.singh@linaro.org, masami.hiramatsu@linaro.org, Ard Biesheuvel , Axel Lin Subject: [PATCH 2/2] gpio: mb86s70: Revert "Return error if requesting an already assigned gpio" Date: Fri, 27 Oct 2017 21:21:48 +0100 Message-Id: <20171027202148.4188-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171027202148.4188-1-ard.biesheuvel@linaro.org> References: <20171027202148.4188-1-ard.biesheuvel@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Commit fd9c963c5661 ("gpio: mb86s70: Return error if requesting an already assigned gpio") adds code that infers from the state of the GPIO Pin Function Register (PFR) whether a GPIO has been assigned already. This assumes that the pin functions are set to 'peripheral' when the driver is loaded, which is not guaranteed. Also, the GPIO layer is perfectly capable of keeping track of which GPIOs have been assigned already, so we shouldn't need this check in the first place. This reverts commit fd9c963c5661af3403e77e312c0d9941773b6c1b. Cc: Axel Lin Cc: Linus Walleij Signed-off-by: Ard Biesheuvel Acked-by: Axel Lin --- drivers/gpio/gpio-mb86s7x.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/gpio/gpio-mb86s7x.c b/drivers/gpio/gpio-mb86s7x.c index 6e1598471733..5cd77dcdbb16 100644 --- a/drivers/gpio/gpio-mb86s7x.c +++ b/drivers/gpio/gpio-mb86s7x.c @@ -53,11 +53,6 @@ static int mb86s70_gpio_request(struct gpio_chip *gc, unsigned gpio) spin_lock_irqsave(&gchip->lock, flags); val = readl(gchip->base + PFR(gpio)); - if (!(val & OFFSET(gpio))) { - spin_unlock_irqrestore(&gchip->lock, flags); - return -EINVAL; - } - val &= ~OFFSET(gpio); writel(val, gchip->base + PFR(gpio));