From: sashiko-bot@kernel.org
To: "Jacky Chou" <jacky_chou@aspeedtech.com>
Cc: linux-phy@lists.infradead.org, neil.armstrong@linaro.org,
robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org,
vkoul@kernel.org, olteanv@gmail.com
Subject: Re: [PATCH 2/3] phy: aspeed: Add ASPEED PCIe PHY driver
Date: Thu, 08 Oct 2026 11:39:37 +0000 [thread overview]
Message-ID: <sashiko-outbox-164098@kernel.org> (raw)
In-Reply-To: <20261008-aspeed_pcie_phy-v1-2-96764937aef0@aspeedtech.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] phy: aspeed: Destructive overwrite of PEHR_GLOBAL and PEHR_MISC_5C registers
- [Low] build: missing <linux/bitfield.h> and <linux/io.h> causes COMPILE_TEST failures
--
commit d6c687af08f52ce8c5106883a0ada373528fe1b8
Author: Jacky Chou <jacky_chou@aspeedtech.com>
phy: aspeed: Add ASPEED PCIe PHY driver
This commit introduces the Aspeed PCIe PHY controller driver for
AST2600/2700 platforms. It adds Kconfig and Makefile changes alongside
the main driver code implementing PHY operations.
> diff --git a/drivers/phy/aspeed/phy-aspeed-pcie.c b/drivers/phy/aspeed/phy-aspeed-pcie.c
> new file mode 100644
> index 0000000000000..eb300887b6441
> --- /dev/null
> +++ b/drivers/phy/aspeed/phy-aspeed-pcie.c
> @@ -0,0 +1,237 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2025 Aspeed Technology Inc.
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/err.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/phy/pcie.h>
> +#include <linux/phy/phy.h>
[Severity: Low]
Can this cause build failures when COMPILE_TEST is enabled on architectures
that do not implicitly include <linux/bitfield.h> and <linux/io.h>?
The FIELD_PREP, FIELD_MODIFY, readl, and writel macros and functions are
used throughout this file, but their headers are not explicitly included.
[ ... ]
> +static int ast2600_phy_set_mode(struct phy *phy, enum phy_mode mode,
> + int submode)
> +{
> + struct aspeed_pcie_phy *pcie_phy = phy_get_drvdata(phy);
> +
> + switch (submode) {
> + case PHY_MODE_PCIE_RC:
> + writel(AST2600_PORT_TYPE(0x3), pcie_phy->reg + PEHR_GLOBAL);
[Severity: Medium]
Could this write unintentionally clear other configuration bits in PEHR_GLOBAL?
It overwrites the entire register instead of performing a read-modify-write
operation.
> + break;
> + default:
> + dev_err(&phy->dev, "Unsupported submode %d\n", submode);
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
[ ... ]
> +static int ast2700_phy_set_mode(struct phy *phy, enum phy_mode mode,
> + int submode)
> +{
> + struct aspeed_pcie_phy *pcie_phy = phy_get_drvdata(phy);
> + u32 cfg_val;
> +
> + switch (submode) {
> + case PHY_MODE_PCIE_RC:
> + writel(0, pcie_phy->reg + PEHR_MISC_278);
> + writel(SEL_INTERNAL_RESET, pcie_phy->reg + PEHR_MISC_280);
> + writel(POSTED_DATA_CREDITS(0xc0) | POSTED_HEADER_CREDITS(0xa),
> + pcie_phy->reg + PEHR_MISC_70);
> + writel(COMPLETION_DATA_CREDITS(0x30) | COMPLETION_HEADER_CREDITS(0x8),
> + pcie_phy->reg + PEHR_MISC_78);
> + writel(LOCAL_SCALE_SUP, pcie_phy->reg + PEHR_MISC_58);
> + writel(CONFIG_RC_DEVICE, pcie_phy->reg + PEHR_MISC_5C);
[Severity: Medium]
Does writing CONFIG_RC_DEVICE directly to PEHR_MISC_5C risk zeroing out other
bits in this register?
A read-modify-write pattern might be needed here, similar to how PEHR_MISC_60
is handled just below this.
> + cfg_val = readl(pcie_phy->reg + PEHR_MISC_60);
> + FIELD_MODIFY(AST2700_PORT_TYPE_MASK, &cfg_val,
> + PORT_TYPE_ROOT);
> + writel(cfg_val, pcie_phy->reg + PEHR_MISC_60);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008-aspeed_pcie_phy-v1-0-96764937aef0@aspeedtech.com?part=2
next prev parent reply other threads:[~2026-10-08 11:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 11:28 [PATCH 0/3] phy: aspeed: Add ASPEED PCIe PHY support Jacky Chou
2026-10-08 11:28 ` [PATCH 1/3] dt-bindings: phy: aspeed: Add ASPEED PCIe PHY Jacky Chou
2026-10-09 10:31 ` Krzysztof Kozlowski
2026-10-08 11:28 ` [PATCH 2/3] phy: aspeed: Add ASPEED PCIe PHY driver Jacky Chou
2026-10-08 11:39 ` sashiko-bot [this message]
2026-10-08 21:40 ` kernel test robot
2026-10-09 6:52 ` kernel test robot
2026-10-09 10:33 ` Krzysztof Kozlowski
2026-10-08 11:28 ` [PATCH 3/3] MAINTAINERS: " Jacky Chou
2026-10-09 10:32 ` [PATCH 0/3] phy: aspeed: Add ASPEED PCIe PHY support Krzysztof Kozlowski
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=sashiko-outbox-164098@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jacky_chou@aspeedtech.com \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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