From: Krzysztof Kozlowski <krzk@kernel.org>
To: Karthik Poduval <kpoduval@lab126.com>
Cc: jyxiong@amazon.com, miguel.lopes@synopsys.com,
anishkmr@amazon.com, vkoul@kernel.org, kishon@kernel.org,
linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 1/2] phy: dw-dphy-rx: Add Synopsys DesignWare D-PHY RX
Date: Thu, 10 Jul 2025 09:26:02 +0200 [thread overview]
Message-ID: <20250710-sly-rigorous-silkworm-6d67ea@krzk-bin> (raw)
In-Reply-To: <2383f8cf2a8f5e1b914d4cf9bd11674ed55876d2.1752106239.git.kpoduval@lab126.com>
On Wed, Jul 09, 2025 at 07:42:20PM -0700, Karthik Poduval wrote:
> +static const struct regmap_config dw_dphy_regmap_cfg1 = {
> + .reg_bits = 32,
> + .val_bits = 32,
> + .reg_stride = 4,
> + .name = "dw-dhpy-cfg1",
> + .fast_io = true,
> +};
> +
> +/**
> + * dw_dphy_regmap_cfg2 - Register map configuration for DW DPHY
> + * @reg_bits: Width of register address in bits (32)
> + * @val_bits: Width of register value in bits (32)
> + * @reg_stride: Number of bytes between registers (4)
> + * @name: Name identifier for this register map
> + * @fast_io: Flag to indicate fast I/O operations are supported
> + *
> + **/
Drop
> +static const struct regmap_config dw_dphy_regmap_cfg2 = {
> + .reg_bits = 32,
> + .val_bits = 32,
> + .reg_stride = 4,
> + .name = "dw-dhpy-cfg2",
> + .fast_io = true,
> +};
> +
> +/**
> + * dw_dphy_probe - Probe and initialize DW DPHY device
> + * @pdev: Platform device pointer
> + * Return: 0 on success, negative error code on failure
> + *
> + **/
Drop
> +static int dw_dphy_probe(struct platform_device *pdev)
> +{
> + struct dw_dphy *dphy;
> + struct resource *res;
> + struct device *dev = &pdev->dev;
> + struct phy_provider *phy_provider;
> + int ret;
> +
> + dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL);
> + if (!dphy)
> + return -ENOMEM;
> +
> + dphy->dt_data =
> + (struct dt_data_dw_dphy *)of_device_get_match_data(&pdev->dev);
> + dev_set_drvdata(&pdev->dev, dphy);
> + dphy->dev = &pdev->dev;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + dphy->iomem_cfg1 = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(dphy->iomem_cfg1))
> + return PTR_ERR(dphy->iomem_cfg1);
> +
> + dphy->regmap_cfg1 =
> + devm_regmap_init_mmio(dev, dphy->iomem_cfg1, &dw_dphy_regmap_cfg1);
> + if (IS_ERR(dphy->regmap_cfg1))
> + return PTR_ERR(dphy->regmap_cfg1);
> +
> + ret = devm_regmap_field_bulk_alloc(dev, dphy->regmap_cfg1, dphy->rf_cfg1,
> + dw_dphy_v1_2_cfg1, DW_DPHY_RF_CFG1_MAX);
> + if (ret < 0) {
> + dev_err(dev, "Could not alloc RF\n");
> + return ret;
> + }
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> + dphy->iomem_cfg2 = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(dphy->iomem_cfg2))
> + return PTR_ERR(dphy->iomem_cfg2);
> +
> + dphy->regmap_cfg2 = devm_regmap_init_mmio(dev, dphy->iomem_cfg2,
> + &dw_dphy_regmap_cfg2);
> + if (IS_ERR(dphy->regmap_cfg2))
> + return PTR_ERR(dphy->regmap_cfg2);
> +
> + ret = devm_regmap_field_bulk_alloc(dev, dphy->regmap_cfg2, dphy->rf_cfg2,
> + dw_dphy_v1_2_cfg2, DW_DPHY_RF_CFG2_MAX);
> + if (ret < 0) {
> + dev_err(dev, "Could not alloc RF\n");
> + return ret;
> + }
> +
> + dphy->phy = devm_phy_create(&pdev->dev, NULL, dphy->dt_data->phy_ops);
> + if (IS_ERR(dphy->phy)) {
> + dev_err(dev, "failed to create PHY\n");
> + return PTR_ERR(dphy->phy);
> + }
> +
> + phy_set_drvdata(dphy->phy, dphy);
> + phy_provider =
> + devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);
> +
> + return PTR_ERR_OR_ZERO(phy_provider);
> +}
> +
> +/**
> + * dw_dphy_of_match - Device tree match table for DW DPHY
> + * @compatible: Compatible string to match device tree node
> + * @data: Pointer to configuration data for matched device
> + *
> + * Table of compatible strings and associated configuration data
> + * for supported DW DPHY variants.
> + * Currently supports:
> + * - DW DPHY v1.2 ("snps,dw-dphy-1p2")
> + *
> + **/
Drop
> +static const struct of_device_id dw_dphy_of_match[] = {
> + { .compatible = "snps,dw-dphy-1p2", .data = &dw_dphy_1p2 },
> + { /* sentinel */ },
> +};
> +MODULE_DEVICE_TABLE(of, dw_dphy_of_match);
> +
> +/**
> + * dw_dphy_platform_driver - Platform driver structure for DW DPHY
> + * @probe: Pointer to probe function called on device discovery
> + * @driver: Core driver structure containing:
> + * - name: Driver name used for matching and debugging
> + * - of_match_table: Table of compatible device tree matches
> + *
> + **/
Drop all such useless generic kerneldocs. Not helpful. Keep useful ones,
so ones not saying obvious parts of core
> +static struct platform_driver dw_dphy_platform_driver = {
> + .probe = dw_dphy_probe,
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-07-10 7:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 2:42 [PATCH v2 0/2] Synopsys DW DPHY Driver Karthik Poduval
2025-07-10 2:42 ` [PATCH v2 1/2] phy: dw-dphy-rx: Add Synopsys DesignWare D-PHY RX Karthik Poduval
2025-07-10 4:08 ` Frank Li
2025-07-10 5:12 ` Poduval, Karthik
2025-07-10 19:48 ` Frank Li
2025-07-10 4:14 ` Frank Li
2025-07-10 5:15 ` Poduval, Karthik
2025-07-10 7:26 ` Krzysztof Kozlowski [this message]
2025-07-10 22:13 ` kernel test robot
2025-07-11 7:13 ` kernel test robot
2025-07-10 2:42 ` [PATCH v2 2/2] phy: dw-dphy-rx: Add dt bindings for Synopsys MIPI " Karthik Poduval
2025-07-10 3:32 ` Rob Herring (Arm)
2025-07-10 4:02 ` Frank Li
2025-07-10 7:24 ` Krzysztof Kozlowski
2025-07-10 21:24 ` Poduval, Karthik
2025-07-11 7:09 ` Krzysztof Kozlowski
2025-07-10 7:27 ` Krzysztof Kozlowski
2025-07-10 3:56 ` [PATCH v2 0/2] Synopsys DW DPHY Driver Frank Li
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=20250710-sly-rigorous-silkworm-6d67ea@krzk-bin \
--to=krzk@kernel.org \
--cc=anishkmr@amazon.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jyxiong@amazon.com \
--cc=kishon@kernel.org \
--cc=kpoduval@lab126.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=miguel.lopes@synopsys.com \
--cc=robh@kernel.org \
--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