Linux-GPIO Archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Aapo Vienamo <aapo.vienamo@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	 Bartosz Golaszewski <brgl@bgdev.pl>,
	Andy Shevchenko <andy@kernel.org>,
	 linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	 Mika Westerberg <mika.westerberg@linux.intel.com>,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH] gpio: Add Intel Granite Rapids-D vGPIO driver
Date: Tue, 23 Apr 2024 16:47:53 +0300 (EEST)	[thread overview]
Message-ID: <b3f2fad7-85aa-d1db-46ab-b3debd84caa7@linux.intel.com> (raw)
In-Reply-To: <20240419080555.97343-1-aapo.vienamo@linux.intel.com>

On Fri, 19 Apr 2024, Aapo Vienamo wrote:

> This driver provides a basic GPIO driver for the Intel Granite Rapids-D
> virtual GPIOs. On SoCs with limited physical pins on the package, the
> physical pins controlled by this driver would be exposed on an external
> device such as a BMC or CPLD.
> 
> Signed-off-by: Aapo Vienamo <aapo.vienamo@linux.intel.com>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


> diff --git a/drivers/gpio/gpio-graniterapids.c b/drivers/gpio/gpio-graniterapids.c
> new file mode 100644
> index 000000000000..61bcafe1985e
> --- /dev/null
> +++ b/drivers/gpio/gpio-graniterapids.c
> @@ -0,0 +1,382 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Intel Granite Rapids-D vGPIO driver
> + *
> + * Copyright (c) 2024, Intel Corporation.
> + *
> + * Author: Aapo Vienamo <aapo.vienamo@linux.intel.com>
> + */
> +
> +#include <linux/array_size.h>
> +#include <linux/bitmap.h>
> +#include <linux/cleanup.h>
> +#include <linux/device.h>
> +#include <linux/err.h>
> +#include <linux/gfp_types.h>
> +#include <linux/interrupt.h>
> +#include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/math.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/module.h>
> +#include <linux/overflow.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm.h>
> +#include <linux/spinlock.h>
> +#include <linux/types.h>
> +
> +#include <linux/gpio/driver.h>
> +
> +#define GNR_NUM_PINS 128
> +#define GNR_PINS_PER_REG 32
> +#define GNR_NUM_REGS DIV_ROUND_UP(GNR_NUM_PINS, GNR_PINS_PER_REG)
> +
> +#define GNR_CFG_BAR		0x00
> +#define GNR_CFG_LOCK_OFFSET	0x04
> +#define GNR_GPI_STATUS_OFFSET	0x20
> +#define GNR_GPI_ENABLE_OFFSET	0x24
> +
> +#define GNR_CFG_DW_RX_MASK	(3 << 22)

GENMASK()

+ #include <linux/bits.h>

> +#define GNR_CFG_DW_RX_DISABLE	(2 << 22)
> +#define GNR_CFG_DW_RX_EDGE	(1 << 22)
> +#define GNR_CFG_DW_RX_LEVEL	(0 << 22)

FIELD_PREP(GNR_CFG_DW_RX_MASK, xx) x 3

> +#define GNR_CFG_DW_RXDIS	BIT(4)
> +#define GNR_CFG_DW_TXDIS	BIT(3)
> +#define GNR_CFG_DW_RXSTATE	BIT(1)
> +#define GNR_CFG_DW_TXSTATE	BIT(0)

These require #include <linux/bits.h> (just pointing this out so you know
in future, you'll need to add it anyway for GENMASK() as mentioned above).

-- 
 i.


      parent reply	other threads:[~2024-04-23 13:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19  8:05 [PATCH] gpio: Add Intel Granite Rapids-D vGPIO driver Aapo Vienamo
2024-04-19 13:11 ` Linus Walleij
2024-04-19 14:42   ` Aapo Vienamo
2024-04-21 18:33     ` Linus Walleij
2024-04-19 13:12 ` Andy Shevchenko
2024-04-19 13:32   ` Aapo Vienamo
2024-04-19 19:59 ` Elliott, Robert (Servers)
2024-04-19 22:02   ` Andy Shevchenko
2024-04-22 10:20     ` Bartosz Golaszewski
2024-04-22 20:59     ` Elliott, Robert (Servers)
2024-04-23 13:47 ` Ilpo Järvinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b3f2fad7-85aa-d1db-46ab-b3debd84caa7@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=aapo.vienamo@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).