From patchwork Wed Sep 20 13:39:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9961445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5B432600C5 for ; Wed, 20 Sep 2017 13:40:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D24F2907D for ; Wed, 20 Sep 2017 13:40:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BD1529081; Wed, 20 Sep 2017 13:40:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 84EDE2907E for ; Wed, 20 Sep 2017 13:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=quVRLjiMfo4yT/RztOZ5Sy00CRvb4/kY1JNE/OFqlnE=; b=jyuke8Qz0mlziqKMvphsnGzfl6 o1TSXRUvmnDmbQWD/RBaSL+LeyFkIOIWi/ruLxN8L/zIIXn3WS3azTnuR31ehF57l9UUvVka0BLiW mRgoccveS5Ft2ouJ3pVilVQP5a+QRkkpqMhm8mYO2NgshGI55y9Vz6fvhIOo2CBi5rkMAruj9MJZu tJyoGRzAkFGpfV2PMt8Afrn8/usY9VGgKBXlhP9fnuu33fjBtPsOr3d5bDdbAtBOcVxHo7FLWGof7 QB5xvZVempC0mSmLKdIz4NpFq3yA+a+AAIn5QU9nN9mvbhDKuH21mAbH1Iz2AJriuhwE4DdNfUSrr VlhR0Bsg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dufFB-0001Oz-H7; Wed, 20 Sep 2017 13:40:49 +0000 Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dufEM-00089l-HV for linux-arm-kernel@lists.infradead.org; Wed, 20 Sep 2017 13:40:10 +0000 Received: by mail-wr0-x232.google.com with SMTP id z39so2191168wrb.8 for ; Wed, 20 Sep 2017 06:39:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4pL8lYlIG0VE/UHKe/eSABGAGTxykr6LtJmjM1gqqR8=; b=QRPa5vk39Yg3zvU1FNnH0wA0BvsI8ltaFPVCPuih5eCTmN20afYcx4RfJSkleXH72Y aynRVdSPsExsxDR8J96j9Z3hpXRRLs5Wocu63ZfwaO60tF+aj88WHIVDLdE5jM6uJGyG YICgOTV8d6n672z+yNcK1tZqMyLsIdmUsFZkRh6BdX9Os742phc1F2Qly6n19M6u7xa3 1EXs6hFfKA6qP9WzlnZQbZ6oWhaiZsjUIw4xGYJEedwZOLhYVnQxjsnTfWKfA/sG1yQB i4ybmYS+mx53O7v04nZTdZUlw16YH6iJ9v2OqDjGyow7WJIOYzLeNbZpMovzzGAzvuw1 NFFA== 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=4pL8lYlIG0VE/UHKe/eSABGAGTxykr6LtJmjM1gqqR8=; b=mebPT6KvRuyx07WxBh3RwtDgk0k/NDeTOb74vE5TUu7ELwkO2YXjEJnogIBdPAWESL TgHk4Ybjc8r9+3J3y5arFTsuRK2mLRsa2satXFLLlrAYBINfpeDFMAHwWe3KvLBe0C7r w/iMdh/CCGWCBtwSe0ry/Aa5QaQ6kIihdWu0Zw/1v3JswrP3GEokMsutyqn/wCIK7bBw AzNEcMLqUvdRrK8/SEWVhXtg6RzVyvma2A0a9BPhhFnKjnszpdJSUsib+5CYzyxCkZxn h9P2QsxcX7n+XMZEQ5zz7V7c6zdsxMiUXTjzXseFhdmFfqi2Khn/YKhdtFTtZxpIkpn6 5nag== X-Gm-Message-State: AHPjjUh0hWXOFrKcQmgfsrkrO3mqYbtTMF0P1qGsGvcUsPawtcv+2CL2 +fEj90PSJSRNYydaJazBCCzIsA== X-Google-Smtp-Source: AOwi7QDEwdBYoou/Mn0vbwv5Lw+reKBdniHzwkuTjIHX3Ce75Lpn7Rfi/A/g841MS8LgSoQdIKjuEA== X-Received: by 10.223.167.79 with SMTP id e15mr4901433wrd.92.1505914776795; Wed, 20 Sep 2017 06:39:36 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id a39sm1938888wrc.48.2017.09.20.06.39.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Sep 2017 06:39:36 -0700 (PDT) From: Jerome Brunet To: Linus Walleij , Kevin Hilman , Carlo Caione Subject: [PATCH 1/8] pinctrl: meson: remove offset from pinctrl Date: Wed, 20 Sep 2017 15:39:20 +0200 Message-Id: <20170920133927.17390-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170920133927.17390-1-jbrunet@baylibre.com> References: <20170920133927.17390-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170920_063958_819579_3E9197AE X-CRM114-Status: GOOD ( 12.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Martin Blumenstingl , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Offset on meson pinctrl and gpios is something that was carried from the vendor driver, where there is a weird link between the 2 controllers. Since these 2 controllers are independent, this offset adds an unnecessary complexity. This patch remove this manually set offset and rely on pinctrl to figure out the gpio base offset Tested-by: Martin Blumenstingl Signed-off-by: Jerome Brunet --- drivers/pinctrl/meson/pinctrl-meson.c | 18 +++--------------- drivers/pinctrl/meson/pinctrl-meson.h | 8 +++----- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index 66ed70c12733..247208150b19 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c @@ -410,18 +410,6 @@ static const struct pinconf_ops meson_pinconf_ops = { .is_generic = true, }; -static int meson_gpio_request(struct gpio_chip *chip, unsigned gpio) -{ - return pinctrl_request_gpio(chip->base + gpio); -} - -static void meson_gpio_free(struct gpio_chip *chip, unsigned gpio) -{ - struct meson_pinctrl *pc = gpiochip_get_data(chip); - - pinctrl_free_gpio(pc->data->pin_base + gpio); -} - static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) { struct meson_pinctrl *pc = gpiochip_get_data(chip); @@ -539,13 +527,13 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc) pc->chip.label = pc->data->name; pc->chip.parent = pc->dev; - pc->chip.request = meson_gpio_request; - pc->chip.free = meson_gpio_free; + pc->chip.request = gpiochip_generic_request; + pc->chip.free = gpiochip_generic_free; pc->chip.direction_input = meson_gpio_direction_input; pc->chip.direction_output = meson_gpio_direction_output; pc->chip.get = meson_gpio_get; pc->chip.set = meson_gpio_set; - pc->chip.base = pc->data->pin_base; + pc->chip.base = -1; pc->chip.ngpio = pc->data->num_pins; pc->chip.can_sleep = false; pc->chip.of_node = pc->of_node; diff --git a/drivers/pinctrl/meson/pinctrl-meson.h b/drivers/pinctrl/meson/pinctrl-meson.h index 890f296f5840..227b72a60c22 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.h +++ b/drivers/pinctrl/meson/pinctrl-meson.h @@ -124,8 +124,6 @@ struct meson_pinctrl { struct device_node *of_node; }; -#define PIN(x, b) (b + x) - #define GROUP(grp, r, b) \ { \ .name = #grp, \ @@ -135,10 +133,10 @@ struct meson_pinctrl { .bit = b, \ } -#define GPIO_GROUP(gpio, b) \ +#define GPIO_GROUP(gpio) \ { \ .name = #gpio, \ - .pins = (const unsigned int[]){ PIN(gpio, b) }, \ + .pins = (const unsigned int[]){ gpio }, \ .num_pins = 1, \ .is_gpio = true, \ } @@ -166,7 +164,7 @@ struct meson_pinctrl { }, \ } -#define MESON_PIN(x, b) PINCTRL_PIN(PIN(x, b), #x) +#define MESON_PIN(x) PINCTRL_PIN(x, #x) extern struct meson_pinctrl_data meson8_cbus_pinctrl_data; extern struct meson_pinctrl_data meson8_aobus_pinctrl_data;