From: Paul Menzel <pmenzel@molgen.mpg.de>
To: Iwona Winiarska <iwona.winiarska@intel.com>
Cc: openbmc@lists.ozlabs.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Conor Dooley <conor+dt@kernel.org>,
Tyrone Ting <warp5tw@gmail.com>,
Benjamin Fair <benjaminfair@google.com>,
Avi Fishman <avifishman70@gmail.com>,
Patrick Venture <venture@google.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Tomer Maimon <tmaimon77@gmail.com>
Subject: Re: [PATCH 2/4] peci: Add peci-npcm controller driver
Date: Thu, 20 Jul 2023 08:20:05 +0200 [thread overview]
Message-ID: <dfda43af-e9b4-85bf-e165-02127e02fbf0@molgen.mpg.de> (raw)
In-Reply-To: <20230719220853.1029316-3-iwona.winiarska@intel.com>
Dear Iwona,
Am 20.07.23 um 00:08 schrieb Iwona Winiarska:
> From: Tomer Maimon <tmaimon77@gmail.com>
>
> Add support for Nuvoton NPCM BMC hardware to the Platform Environment
> Control Interface (PECI) subsystem.
Please elaborate on the implementation, and document the used datasheets.
Additionally, please document how you tested this.
> Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
> Signed-off-by: Tyrone Ting <warp5tw@gmail.com>
> Co-developed-by: Iwona Winiarska <iwona.winiarska@intel.com>
> Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
> ---
> drivers/peci/controller/Kconfig | 16 ++
> drivers/peci/controller/Makefile | 1 +
> drivers/peci/controller/peci-npcm.c | 298 ++++++++++++++++++++++++++++
> 3 files changed, 315 insertions(+)
> create mode 100644 drivers/peci/controller/peci-npcm.c
>
> diff --git a/drivers/peci/controller/Kconfig b/drivers/peci/controller/Kconfig
> index 2fc5e2abb74a..4f9c245ad042 100644
> --- a/drivers/peci/controller/Kconfig
> +++ b/drivers/peci/controller/Kconfig
> @@ -16,3 +16,19 @@ config PECI_ASPEED
>
> This driver can also be built as a module. If so, the module will
> be called peci-aspeed.
> +
> +config PECI_NPCM
> + tristate "Nuvoton NPCM PECI support"
> + depends on ARCH_NPCM || COMPILE_TEST
> + depends on OF
> + select REGMAP_MMIO
> + help
> + This option enables PECI controller driver for Nuvoton NPCM7XX
> + and NPCM8XX SoCs. It allows BMC to discover devices connected
> + to it and communicate with them using PECI protocol.
> +
> + Say Y here if you want support for the Platform Environment Control
> + Interface (PECI) bus adapter driver on the Nuvoton NPCM SoCs.
> +
> + This support is also available as a module. If so, the module
> + will be called peci-npcm.
> diff --git a/drivers/peci/controller/Makefile b/drivers/peci/controller/Makefile
> index 022c28ef1bf0..e247449bb423 100644
> --- a/drivers/peci/controller/Makefile
> +++ b/drivers/peci/controller/Makefile
> @@ -1,3 +1,4 @@
> # SPDX-License-Identifier: GPL-2.0-only
>
> obj-$(CONFIG_PECI_ASPEED) += peci-aspeed.o
> +obj-$(CONFIG_PECI_NPCM) += peci-npcm.o
> diff --git a/drivers/peci/controller/peci-npcm.c b/drivers/peci/controller/peci-npcm.c
> new file mode 100644
> index 000000000000..3647e3628a17
> --- /dev/null
> +++ b/drivers/peci/controller/peci-npcm.c
> @@ -0,0 +1,298 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (c) 2019 Nuvoton Technology corporation.
No dot/period at the end.
[…]
> +static int npcm_peci_xfer(struct peci_controller *controller, u8 addr, struct peci_request *req)
> +{
> + struct npcm_peci *priv = dev_get_drvdata(controller->dev.parent);
> + unsigned long timeout = msecs_to_jiffies(priv->cmd_timeout_ms);
> + unsigned int msg_rd;
> + u32 cmd_sts;
> + int i, ret;
> +
> + /* Check command sts and bus idle state */
> + ret = regmap_read_poll_timeout(priv->regmap, NPCM_PECI_CTL_STS, cmd_sts,
> + !(cmd_sts & NPCM_PECI_CTRL_START_BUSY),
> + NPCM_PECI_IDLE_CHECK_INTERVAL_USEC,
> + NPCM_PECI_IDLE_CHECK_TIMEOUT_USEC);
> + if (ret)
> + return ret; /* -ETIMEDOUT */
> +
> + spin_lock_irq(&priv->lock);
> + reinit_completion(&priv->xfer_complete);
> +
> + regmap_write(priv->regmap, NPCM_PECI_ADDR, addr);
> + regmap_write(priv->regmap, NPCM_PECI_RD_LENGTH, NPCM_PECI_WR_LEN_MASK & req->rx.len);
> + regmap_write(priv->regmap, NPCM_PECI_WR_LENGTH, NPCM_PECI_WR_LEN_MASK & req->tx.len);
> +
> + if (req->tx.len) {
> + regmap_write(priv->regmap, NPCM_PECI_CMD, req->tx.buf[0]);
> +
> + for (i = 0; i < (req->tx.len - 1); i++)
> + regmap_write(priv->regmap, NPCM_PECI_DAT_INOUT(i), req->tx.buf[i + 1]);
> + }
> +
> +#if IS_ENABLED(CONFIG_DYNAMIC_DEBUG)
> + dev_dbg(priv->dev, "addr : %#02x, tx.len : %#02x, rx.len : %#02x\n",
> + addr, req->tx.len, req->rx.len);
> + print_hex_dump_bytes("TX : ", DUMP_PREFIX_NONE, req->tx.buf, req->tx.len);
> +#endif
The preprocessor guards are not needed, as it’s taken care of in
`include/linux/printk.h`. Also in other parts of the patch.
[…]
> +module_platform_driver(npcm_peci_driver);
> +
> +MODULE_AUTHOR("Tomer Maimon <tomer.maimon@nuvoton.com>");
> +MODULE_DESCRIPTION("NPCM PECI driver");
> +MODULE_LICENSE("GPL");
> +MODULE_IMPORT_NS(PECI);
Also add an entry to `MAINTAINERS`, if Tomer is going to be the maintainer?
Kind regards,
Paul
next prev parent reply other threads:[~2023-07-20 6:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-19 22:08 [PATCH 0/4] Add support for PECI Nuvoton Iwona Winiarska
2023-07-19 22:08 ` [PATCH 1/4] dt-bindings: Add bindings for peci-npcm Iwona Winiarska
2023-07-20 6:18 ` Krzysztof Kozlowski
2023-07-20 8:03 ` Winiarska, Iwona
2023-07-24 14:38 ` Rob Herring
2023-07-24 17:02 ` Winiarska, Iwona
2023-07-19 22:08 ` [PATCH 2/4] peci: Add peci-npcm controller driver Iwona Winiarska
2023-07-20 6:20 ` Paul Menzel [this message]
2023-07-20 8:38 ` Winiarska, Iwona
2023-07-20 14:47 ` Paul Menzel
2023-07-20 20:20 ` Winiarska, Iwona
2023-07-21 6:30 ` Paul Menzel
2023-07-21 9:22 ` Winiarska, Iwona
2023-07-23 14:19 ` Tomer Maimon
2023-07-19 22:08 ` [PATCH 3/4] ARM: dts: nuvoton: Add PECI controller node Iwona Winiarska
2023-07-19 22:08 ` [PATCH 4/4] arm64: " Iwona Winiarska
2023-07-20 6:17 ` [PATCH 0/4] Add support for PECI Nuvoton Krzysztof Kozlowski
2023-07-20 8:00 ` Winiarska, Iwona
2023-07-20 8:40 ` Krzysztof Kozlowski
2023-07-20 13:06 ` Winiarska, Iwona
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=dfda43af-e9b4-85bf-e165-02127e02fbf0@molgen.mpg.de \
--to=pmenzel@molgen.mpg.de \
--cc=avifishman70@gmail.com \
--cc=benjaminfair@google.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=iwona.winiarska@intel.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=robh+dt@kernel.org \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
--cc=warp5tw@gmail.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