mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Imran Shaik <imran.shaik@oss.qualcomm.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Richard Cochran <richardcochran@gmail.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: Ajit Pandey <ajit.pandey@oss.qualcomm.com>,
	Taniya Das <taniya.das@oss.qualcomm.com>,
	Jagadeesh Kona <jagadeesh.kona@oss.qualcomm.com>,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 3/6] ptp: qcom: Add PTP driver for the Qualcomm TSC hardware
Date: Thu, 30 Jul 2026 16:28:54 +0530	[thread overview]
Message-ID: <a1894c1e-6e32-42a7-91c4-720e2634b1de@oss.qualcomm.com> (raw)
In-Reply-To: <c2a7c6fe-60bb-49b7-b877-20fbf948b5de@kernel.org>



On 27-07-2026 09:23 pm, Krzysztof Kozlowski wrote:
> On 27/07/2026 16:10, Imran Shaik wrote:
>> Add a PTP Hardware Clock driver for the Qualcomm Timestamp Counter (TSC)
>> hardware found on Qualcomm Lemans and QDU1000 SoCs. The TSC is a free
>> running hardware counter used for time synchronization, clocked by an AHB
>> configuration clock and a global counter clock, with the counter resolution
>> varying across SoCs.
>>
>> Co-developed-by: Taniya Das <taniya.das@oss.qualcomm.com>
>> Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
>> Signed-off-by: Imran Shaik <imran.shaik@oss.qualcomm.com>
>> ---
>>   drivers/ptp/Kconfig        |  10 ++
>>   drivers/ptp/Makefile       |   1 +
>>   drivers/ptp/ptp_qcom_tsc.c | 413 +++++++++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 424 insertions(+)
>>
>> diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
>> index b93640ca08b7286fd4298519a17d1daf19056498..d3ceb1ee01a505cdd0bd056649d245308fc9f140 100644
>> --- a/drivers/ptp/Kconfig
>> +++ b/drivers/ptp/Kconfig
>> @@ -263,4 +263,14 @@ config PTP_NETC_V4_TIMER
>>   	  synchronization. It also supports periodic output signal (e.g. PPS)
>>   	  and external trigger timestamping.
>>   
>> +config PTP_QCOM_TSC
>> +	tristate "Qualcomm TSC as PTP clock"
> 
> Missing depensd on ARCH_QCOM
> 

Will fix it in the next series.

>> +	depends on COMMON_CLK && PTP_1588_CLOCK
>> +	help
>> +	  This driver adds support for using the Qualcomm Timestamp Counter
>> +	  Subsystem (TSCSS) as a PTP clock.
>> +
>> +	  To compile this driver as a module, choose M here: the module
>> +	  will be called ptp_qcom_tsc.
>> +
>>   endmenu
> 
> ...
> 
>> +
>> +static const struct of_device_id qcom_tsc_of_match[] = {
>> +	{ .compatible = "qcom,lemans-tscss", .data = &qcom_tsc_lemans },
>> +	{ .compatible = "qcom,qdu1000-tscss", .data = &qcom_tsc_qdu1000 },
>> +	{ }
>> +};
>> +MODULE_DEVICE_TABLE(of, qcom_tsc_of_match);
>> +
>> +static void qcom_ptp_tsc_remove(struct platform_device *pdev)
> 
> Completely broken order of ID table, remove() and probe(). Remove ALWAYS
> follows probe. Table is next to them. Please look at other drivers.
> 

Sure, will correct the order in the next series.

>> +{
>> +	struct qcom_tsc *tsc = platform_get_drvdata(pdev);
>> +
>> +	if (tsc && tsc->ptp) {
>> +		ptp_clock_unregister(tsc->ptp);
>> +		tsc->ptp = NULL;
>> +	}
>> +}
>> +
>> +static int qcom_ptp_tsc_probe(struct platform_device *pdev)
>> +{
>> +	const struct qcom_tsc_soc_data *soc;
>> +	struct qcom_tsc *tsc;
>> +	struct resource *r_mem;
>> +	int ret;
>> +
>> +	soc = of_device_get_match_data(&pdev->dev);
>> +	if (!soc)
>> +		return -ENODEV;
>> +
>> +	tsc = devm_kzalloc(&pdev->dev, sizeof(*tsc), GFP_KERNEL);
>> +	if (!tsc)
>> +		return -ENOMEM;
>> +
>> +	tsc->dev = &pdev->dev;
>> +	tsc->soc = soc;
>> +
>> +	ret = devm_mutex_init(&pdev->dev, &tsc->lock);
>> +	if (ret)
>> +		return ret;
>> +
>> +	r_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tsc");
>> +	if (!r_mem) {
>> +		dev_err(&pdev->dev, "no IO resource defined\n");
>> +		return -ENXIO;
>> +	}
>> +
>> +	tsc->base = devm_ioremap_resource(&pdev->dev, r_mem);
>> +	if (IS_ERR(tsc->base))
>> +		return PTR_ERR(tsc->base);
>> +
>> +	tsc->ahb_clk = devm_clk_get_enabled(&pdev->dev, "ahb");
>> +	if (IS_ERR(tsc->ahb_clk))
>> +		return PTR_ERR(tsc->ahb_clk);
>> +
>> +	tsc->cntr_clk = devm_clk_get_enabled(&pdev->dev, "cntr");
>> +	if (IS_ERR(tsc->cntr_clk))
>> +		return PTR_ERR(tsc->cntr_clk);
>> +
>> +	/* ETU clock is optional, only required when the ETU block is used */
>> +	tsc->etu_clk = devm_clk_get_optional_enabled(&pdev->dev, "etu");
>> +	if (IS_ERR(tsc->etu_clk))
>> +		return PTR_ERR(tsc->etu_clk);
>> +
>> +	tsc->ptp_info = qcom_ptp_info;
>> +
>> +	tsc->ptp = ptp_clock_register(&tsc->ptp_info, &pdev->dev);
>> +	if (IS_ERR(tsc->ptp)) {
>> +		ret = PTR_ERR(tsc->ptp);
>> +		dev_err(&pdev->dev, "Failed to register ptp clock\n");
>> +		return ret;
> 
> Why aren't you using dev_err_probe?
> 

Sure, will use the dev_err_probe in the next series.

Thanks,
Imran

>> +	}
>> +
>> +	platform_set_drvdata(pdev, tsc);
>> +
>> +	return 0;
>> +}
>> +
>> +static struct platform_driver qcom_ptp_tsc_driver = {
>> +	.probe  = qcom_ptp_tsc_probe,
>> +	.remove = qcom_ptp_tsc_remove,
>> +	.driver = {
>> +		.name = "qcom_ptp_tsc",
>> +		.of_match_table = qcom_tsc_of_match,
>> +	},
>> +};
>> +module_platform_driver(qcom_ptp_tsc_driver);
>> +
>> +MODULE_DESCRIPTION("PTP QCOM TSC driver");
>> +MODULE_LICENSE("GPL");
>>
> 
> 
> Best regards,
> Krzysztof


  reply	other threads:[~2026-07-30 10:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 14:10 [PATCH 0/6] Add support for Qualcomm TSCSS hardware Imran Shaik
2026-07-27 14:10 ` [PATCH 1/6] dt-bindings: ptp: Document the TSCSS on Qualcomm Lemans and Monaco SoCs Imran Shaik
2026-07-27 15:50   ` Krzysztof Kozlowski
2026-09-01  6:31     ` Imran Shaik
2026-09-01  6:40       ` Krzysztof Kozlowski
2026-10-13 11:49         ` Imran Shaik
2026-07-27 14:10 ` [PATCH 2/6] dt-bindings: ptp: Document TSCSS hardware on Qualcomm QDU1000 SoC Imran Shaik
2026-07-27 15:51   ` Krzysztof Kozlowski
2026-09-01  6:31     ` Imran Shaik
2026-07-27 14:10 ` [PATCH 3/6] ptp: qcom: Add PTP driver for the Qualcomm TSC hardware Imran Shaik
2026-07-27 15:53   ` Krzysztof Kozlowski
2026-07-30 10:58     ` Imran Shaik [this message]
2026-07-27 23:20   ` Jakub Kicinski
2026-07-30 10:56     ` Imran Shaik
2026-07-27 14:11 ` [PATCH 4/6] arm64: defconfig: Enable Qualcomm TSC driver Imran Shaik
2026-07-27 14:11 ` [PATCH 5/6] arm64: dts: qcom: lemans: Add support for TSCSS node Imran Shaik
2026-07-27 14:44   ` Konrad Dybcio
2026-09-01  6:41     ` Imran Shaik
2026-09-02 15:58       ` Konrad Dybcio
2026-07-27 14:11 ` [PATCH 6/6] arm64: dts: qcom: qdu1000: " Imran Shaik
2026-07-27 15:54   ` 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=a1894c1e-6e32-42a7-91c4-720e2634b1de@oss.qualcomm.com \
    --to=imran.shaik@oss.qualcomm.com \
    --cc=ajit.pandey@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=jagadeesh.kona@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=taniya.das@oss.qualcomm.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

all inboxes | Powered by JetHome®