Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4163335pxb; Tue, 17 Nov 2020 13:03:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/HuKy8y1YGoOQ1beYm7kTeYIWcBd/GSuDAEV54MmFEr4s4+jSC3tnXXIZpiXCG7Hlz8J7 X-Received: by 2002:aa7:cd41:: with SMTP id v1mr6225156edw.147.1605646995578; Tue, 17 Nov 2020 13:03:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605646995; cv=none; d=google.com; s=arc-20160816; b=vwKVGLQfs2n6m/KGPqd0WdB0pvhd2tVUWZyqpT+aFSEzMc0icmOJL7Jt8vmqQ+OheW 3gBDlWZ4UTH6N4Q4VtSzHWCQ0X1mPFiLbGb1TPKNZqPqsL+cqBieT9/qrODUlYULNva+ P8oDluIMwThB9KmjuOVRBzsiccSgCYnglXOhxBH9f73Koizvu/NK3ubnMr0F5y9QK2qL AHl9rqR+IFtTABvxJj5YFdrzwcIXLHs3cvIrtjuPeclQB3cVD+/kWORaVDQNb7hhixN+ FJVjRB3Fu4VKUk/cmYvi0x9S8Cqs7Vnrb16DN5cZlAHzFxnPzO6U3iW4YQ1+hVj2SD8M AXrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=lhOVKceVBv7kVKCgOWNBzO70XQrC0EF5U4LspVOWhdQ=; b=CGFnVokGGWF9sMUxy5FojUFALZFYS6MfikO0hIjd5EoPon9oSGXL0hYZU7eV/UNwDi 6oB+oJ8ScXdhsWfQtSO2cd26YHc0nQZ4m1WdUgNc8IVPdu8xyAjUHtjVuOTDtXyI73vA NydeG3w1gh7jzAHAZ9ZT+AmGdOCUB0jLex+G3vO1qN3YNL5ibW2sEoVZq3UgBv4sa89r E/dbDYevyJXjo3ZxE8S7dZFokWXPEWa1tqSD7ZWUHCGcPkXvOfpc5oEuxBBzW+clIzQB dr35QAx7e5jExni1hp2WmDnOpaOdkP4roXFQcL1eLfiVw6UY9KZgkaYjYhaZP8WA/2bo TKfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jFWNWp2T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si14287898ejy.467.2020.11.17.13.02.40; Tue, 17 Nov 2020 13:03:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jFWNWp2T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726199AbgKQU7T (ORCPT + 99 others); Tue, 17 Nov 2020 15:59:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726136AbgKQU7T (ORCPT ); Tue, 17 Nov 2020 15:59:19 -0500 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F763C0613CF for ; Tue, 17 Nov 2020 12:59:18 -0800 (PST) Received: by mail-lj1-x241.google.com with SMTP id h23so25883077ljg.13 for ; Tue, 17 Nov 2020 12:59:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lhOVKceVBv7kVKCgOWNBzO70XQrC0EF5U4LspVOWhdQ=; b=jFWNWp2TgwOeIaJn/jRrE7BtuYTGCLhCbYE1gTAv9xgjHbnUiLNIEgwBwRvKlTP/bW EYstaUc5JEc0i4QC2VMllWpVxHobX2i95V0FGI/LQF35NIJjY9Pn96rE2RzgO588ungl EXiEGgjrT3HGHa4BzkBHA5XlatVXLUwTAANULsOvBtkNeGKIFfqsqwrxasdbzxiFLpoZ jOhE37cjXz3dN7vSaw2HY19SCUhSz0AkicBVW49Ovamx3xoTaRKO7MgaJkI+oTEcIeoY k9GBD+p52hRY5liL5DAx6xBuZH1JDEFrh6/uuxfbnU+tma0kHkEcZX2ImRsdqCo9WCZN t7rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lhOVKceVBv7kVKCgOWNBzO70XQrC0EF5U4LspVOWhdQ=; b=Eh/5HoVC0D6iAyiuP6kFAxNjgMtICmPVYjWJHBZk3PyTXa+nnp0LeYie8NNVizVPZ+ hYwVcOz+LNMMM/onEORitfk9ionLrBRufwoYfnaoH61jkIq1Opc64F3RI7Hr+CiDrmqO cnZucaGKi+x7AVFweZPYRmalo7TyIZB23GWJX1F7gGHtxREvALxoqyq7Ima/h6R8gFZ/ jCYA6rBfShLnBkD/roOMxfLQJccgkd0Hyl8k6vXgArKqqkEnrMXKFuOItxU5HxaL5Eg7 dGmZCjHUVo99xhcHlA1trpQ2+SxRo3qap7+WIxZuw7teBgEpVZQ9naeDWzKn36IoixZU W0iQ== X-Gm-Message-State: AOAM533OiB+Jrcam3ocMXeafPe8Mb+K1AJcVWnQT6wf7EYgREuXtTssH VrqNP/1nr1XHGp9dW2p09ThK7NwCvCPgaZoy9fjRog== X-Received: by 2002:a2e:321a:: with SMTP id y26mr2883348ljy.293.1605646757115; Tue, 17 Nov 2020 12:59:17 -0800 (PST) MIME-Version: 1.0 References: <20201112084057.1399983-1-nobuhiro1.iwamatsu@toshiba.co.jp> <20201112084057.1399983-3-nobuhiro1.iwamatsu@toshiba.co.jp> In-Reply-To: <20201112084057.1399983-3-nobuhiro1.iwamatsu@toshiba.co.jp> From: Linus Walleij Date: Tue, 17 Nov 2020 21:59:06 +0100 Message-ID: Subject: Re: [PATCH v2 2/4] gpio: visoconti: Add Toshiba Visconti GPIO support To: Nobuhiro Iwamatsu Cc: Rob Herring , Punit Agrawal , yuji2.ishikawa@toshiba.co.jp, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux ARM , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nobuhiro, On Thu, Nov 12, 2020 at 12:42 AM Nobuhiro Iwamatsu wrote: > Add the GPIO driver for Toshiba Visconti ARM SoCs. > > Signed-off-by: Nobuhiro Iwamatsu I just noticed this: > +config GPIO_VISCONTI > + tristate "Toshiba Visconti GPIO support" > + depends on ARCH_VISCONTI || COMPILE_TEST > + depends on OF_GPIO > + select GPIOLIB_IRQCHIP > + help > + Say yes here to support GPIO on Tohisba Visconti. Add: select GPIO_GENERIC Then all of these: > +static int visconti_gpio_get(struct gpio_chip *chip, unsigned int offset) > +static void visconti_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) > +static int visconti_gpio_get_dir(struct gpio_chip *chip, unsigned int offset) > +static int visconti_gpio_dir_in(struct gpio_chip *chip, unsigned int offset) > +static int visconti_gpio_dir_out(struct gpio_chip *chip, unsigned int offset, int value) Can be implemented by the genric MMIO GPIO library. > + gpio_chip = &priv->gpio_chip; > + gpio_chip->label = name; > + gpio_chip->owner = THIS_MODULE; > + gpio_chip->parent = dev; > + gpio_chip->request = gpiochip_generic_request; > + gpio_chip->free = gpiochip_generic_free; > + gpio_chip->get = visconti_gpio_get; > + gpio_chip->set = visconti_gpio_set; > + gpio_chip->get_direction = visconti_gpio_get_dir; > + gpio_chip->direction_input = visconti_gpio_dir_in; > + gpio_chip->direction_output = visconti_gpio_dir_out; > + gpio_chip->base = 0; > + gpio_chip->ngpio = VISCONTI_GPIO_NR; > + gpio_chip->irq.init_valid_mask = visconti_init_irq_valid_mask; Initialized the generic helpers using the addresses of the GPIO registers here by a call to bgpio_init(). Check this driver for an example: drivers/gpio/gpio-ftgpio010.c If you get uncertain about the arguments to bgpio_init() check drivers/gpio/gpio-mmio.c, there is kerneldoc for the function. By doing this you get implementations of gpio_[get|set]_multiple() for free. Yours, Linus Walleij