[LINUX,v2,1/3] clocksource: timer-cadence-ttc: Do not probe TTC device configured as PWM
Message ID | 20231114124748.581850-2-mubin.sayyed@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1832712vqg; Tue, 14 Nov 2023 04:49:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFO/i3SF6uRaG+sdFIBSuSe3zy0tRmfhRCo7sNfueu/FyeHJT9c93gFfhdSiI0ldXrIGO1X X-Received: by 2002:a05:6830:124f:b0:6d3:165d:f19c with SMTP id s15-20020a056830124f00b006d3165df19cmr2110339otp.11.1699966161397; Tue, 14 Nov 2023 04:49:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699966161; cv=pass; d=google.com; s=arc-20160816; b=GNuxgoMsBf8A1K3qC4cQqJw3IfAb+u1lV9WJcXvA2zoN5HfL7TDd+y6NRbcXo2yyaQ F9fsfr3K90MVHjX7aq7SezLLgIq0u//zh24Sxz6556ksJC+YpIvWj7GQW1kkKMElhkfF HOblQzgq9r/v9ucu09/Xov8/hxJV/J1y4Y1H3OnXEUj/s08fp7FMso2a38glWY/WBdb2 9qD3UhHnYXJ5gEQnPTXE9GcqV6iQMPrg42dnqAN5JBEziNitAYZEFfJcMh8NAnAOYbvu mFrEorblzXaSCFFe64Mg2ogYEavj019EKMkpMWlSyNLuv/HbRPl3kKJJLSdfnca+mhwE LPxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1cVqEYWO+Z8cW3AEkiPy+S/F1V+uR/k0EnPZghsCxRo=; fh=wHWLybIYgsdSFq1KmdlghAR48ihMPeTHNeC/btuoPtQ=; b=a4C68zmm/dokb76YyHke5c85Zespoci4IMmW36x2vQaSnatZSURHgQ8hYT7jVEjE/r SLzjEl+tRRdtWRsuw4dS9IALsvZUct0Y8uhxGikEW2ndT9L3kWx4HH4StoD4ZRZNTeNj 3mhvZ6bCi38aaIBLsYlmi/22Fus5IEMJPpZNtHMAPez0CmYh6tKvcDIhSj9l8angudoU sOBISSwhprHo1lD2uDjry7hVexBbo+mgsKgTfoQB5HLkxiy5nsFyBFvdcvV39VqZIvtb LKDxle6vy/yP4vEtWQfl0x22zbIbJO2AqpmcBWyjCAyyxXjIIe9NsQCtW9rj9K0E0vbt zyKA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GSuT2LhP; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id j65-20020a638b44000000b005be1ee5bea2si7983428pge.374.2023.11.14.04.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 04:49:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GSuT2LhP; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 45FF08035139; Tue, 14 Nov 2023 04:49:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232733AbjKNMsm (ORCPT <rfc822;lhua1029@gmail.com> + 29 others); Tue, 14 Nov 2023 07:48:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjKNMsk (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 14 Nov 2023 07:48:40 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2067.outbound.protection.outlook.com [40.107.237.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 367B213A; Tue, 14 Nov 2023 04:48:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O/k2f+aEAKDsc+Hscd6Imqd/z12v11re2vcD775bKNC5axclMmwjsyeguN41cdve7M2zy7rSmyzX0vde+bmwqiyUHtftQEhLpaswI0NHhS1Tm2mopjQtsrr6pKSep5qtmRr2EmFIvVceUNEXv/bBOtmy/ilQqWPKXBwqX7GX3EI9xs48DtwDitIsNecJHtZsPCEuRyXLEQShRhoz8I+7mEX6hBu6LDuY6XGy6+qYp7/3Cv2jfKiNSbZSb6CChWIaHfglwMZMQqqB+pyS9xfCFTGM6JQB2b8o653K9tHoARGEfIF16nisEbcPOMrdfe0PwojJ5Ltawa4C+KiorQ1dKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1cVqEYWO+Z8cW3AEkiPy+S/F1V+uR/k0EnPZghsCxRo=; b=fk6ykiKDQAH9H8J/ykZBIrObi23zaTE5f1WY3ke1GBA2Ge0i1/FFGu8d0YD17xzTVaOtQK58sZzvHfENSxpeY+rZD4fTOWXsVhio+i+xKleo8Xbq9sZn/qBiCQlR9rK0AV4IItnbMxAz+CxvedX3cNe2EVxQXhXryEyw115m3PU3eA21MylxdTRZhWYbFb480bf+gmSu6CObeLaOh9UAYiRz/qWACXwpM8v5jwO8PC+r/+arG2VK3b49JRUYUI9roIdziSBnSCUQ7OCH9iEp7GcSf0Hypzftc49xrqppleRLzMZgdbYfRAfpXjnZQORlO/+FPfq0Li2aWy6ZGE0GQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1cVqEYWO+Z8cW3AEkiPy+S/F1V+uR/k0EnPZghsCxRo=; b=GSuT2LhPumT97yGtqFkDhnPsXk0xj6XdixHFDDsPyaRyUBMK6VktFcx539dORdN4T3Ma4fc7MESvjJbNW6lZ2Q0+E0NcA6lyNwyhsxMhPQQrag9YEw/0+50aT9PTKV3yxzb0bN0b6pUlZQgdmMaOEbgyl2mVR0XMKVdEPdKb4yU= Received: from SA0PR11CA0005.namprd11.prod.outlook.com (2603:10b6:806:d3::10) by DM3PR12MB9416.namprd12.prod.outlook.com (2603:10b6:0:4b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.29; Tue, 14 Nov 2023 12:48:34 +0000 Received: from SA2PEPF00001504.namprd04.prod.outlook.com (2603:10b6:806:d3:cafe::d4) by SA0PR11CA0005.outlook.office365.com (2603:10b6:806:d3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31 via Frontend Transport; Tue, 14 Nov 2023 12:48:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00001504.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7002.13 via Frontend Transport; Tue, 14 Nov 2023 12:48:34 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Tue, 14 Nov 2023 06:48:33 -0600 Received: from xhdmubinusm40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Tue, 14 Nov 2023 06:48:30 -0600 From: Mubin Sayyed <mubin.sayyed@amd.com> To: <krzysztof.kozlowski+dt@linaro.org>, <u.kleine-koenig@pengutronix.de>, <thierry.reding@gmail.com>, <robh+dt@kernel.org>, <conor+dt@kernel.org>, <tglx@linutronix.de>, <daniel.lezcano@linaro.org>, <michal.simek@amd.com> CC: <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-pwm@vger.kernel.org>, <git@amd.com>, <mubin10@gmail.com>, Mubin Sayyed <mubin.sayyed@amd.com> Subject: [LINUX PATCH v2 1/3] clocksource: timer-cadence-ttc: Do not probe TTC device configured as PWM Date: Tue, 14 Nov 2023 18:17:46 +0530 Message-ID: <20231114124748.581850-2-mubin.sayyed@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231114124748.581850-1-mubin.sayyed@amd.com> References: <20231114124748.581850-1-mubin.sayyed@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001504:EE_|DM3PR12MB9416:EE_ X-MS-Office365-Filtering-Correlation-Id: b9a22b87-8bd8-456c-3a14-08dbe5100396 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MEE6rtxE8SVb/6YrTx0VAk89s7ylZ/rpNdtrgR4shIV0qZKDkb0x8XwEvz8RXLZgdN3D2StafJOQetcTPkAWRixjPgLe5TC1tyLGcQAByOvt3zfI6cisvxqSN93qKBEVsAXE7n1Hzdx/pyp5f/fg2Da1e9rNatdIT2hnSrcOtMtn+u+z7Pbfj+WufGYcPx7SZG4bN3T2gYqk2FGKd++nnzAnmjdPNXjCy2XH6M4j/BDnNUwgD239hPpPcFI/o5ZAmtWfkVwP6OcZVunFokHUwWPzhxKmFLP/3josvvNPLTwLW87N05gd+TFlpvvt7AuqCIS1hOKkTK8dzcunZbfm2yLJa6hRvQItqxcNQ5GDzr2LYpe7TWAEUGOkn6dj4CqWpJv/IDC2vevwpi4S9PvFl9PozZetCL66W9uw4yCapC/Z/Pizlkw7kIkn8cgLqMtoFf62wPeAcAPgjwJ5JpmsYWXujrMpLcvEQR1toreSc+fXyhvRudoqETl9fsjt/VX0lfzwYdAxoUKIA2+0mLOj/L/eFnNpVuhkevktopUF5qfhRnl6/7pydbikIIs2BN1PI2xUCXLDhZyd5rJpT62drM+4S21x8EaTkvxlQwIwn9ynXWA9vg/EuFbpTxhxWnvqDiZPdZizyLohJ3PzvppWG+aJfKiIRlKbcljhyMifZE4eiRmSlTUMacJ82RUDl5FGUU4sVOgvKHcf3brpOQ/6gDo7S9PP+FA8KX1fUA55hTI9suYka0C5crpRmbf6uMa7bmVzLh5OaIzirrZAf86gQA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(376002)(39860400002)(396003)(346002)(230922051799003)(64100799003)(451199024)(82310400011)(186009)(1800799009)(46966006)(40470700004)(36840700001)(44832011)(478600001)(6666004)(4326008)(8936002)(8676002)(41300700001)(70586007)(6636002)(316002)(70206006)(54906003)(1076003)(110136005)(7416002)(5660300002)(2616005)(26005)(336012)(40480700001)(2906002)(426003)(40460700003)(47076005)(356005)(81166007)(36860700001)(83380400001)(82740400003)(86362001)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 12:48:34.4846 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9a22b87-8bd8-456c-3a14-08dbe5100396 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001504.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB9416 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 14 Nov 2023 04:49:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782543717324783426 X-GMAIL-MSGID: 1782543717324783426 |
Series |
Add initial support for TTC PWM driver
|
|
Commit Message
Mubin Sayyed
Nov. 14, 2023, 12:47 p.m. UTC
TTC device can act either as clocksource/clockevent or
PWM generator, it would be decided by pwm-cells property.
TTC PWM feature would be supported through separate driver
based on PWM framework.
If pwm-cells property is present in TTC node, it would be
treated as PWM device, and clocksource driver should just
skip it.
Signed-off-by: Mubin Sayyed <mubin.sayyed@amd.com>
---
Changes for v2:
- Added comment regarding pwm-cells property
---
drivers/clocksource/timer-cadence-ttc.c | 7 +++++++
1 file changed, 7 insertions(+)
Comments
On 14/11/2023 13:47, Mubin Sayyed wrote: > TTC device can act either as clocksource/clockevent or > PWM generator, it would be decided by pwm-cells property. > TTC PWM feature would be supported through separate driver > based on PWM framework. > > If pwm-cells property is present in TTC node, it would be > treated as PWM device, and clocksource driver should just > skip it. > > Signed-off-by: Mubin Sayyed <mubin.sayyed@amd.com> > --- > Changes for v2: > - Added comment regarding pwm-cells property > --- > drivers/clocksource/timer-cadence-ttc.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/clocksource/timer-cadence-ttc.c b/drivers/clocksource/timer-cadence-ttc.c > index 32daaac9b132..f8fcb1a4bdd0 100644 > --- a/drivers/clocksource/timer-cadence-ttc.c > +++ b/drivers/clocksource/timer-cadence-ttc.c > @@ -477,6 +477,13 @@ static int __init ttc_timer_probe(struct platform_device *pdev) > u32 timer_width = 16; > struct device_node *timer = pdev->dev.of_node; > > + /* > + * If pwm-cells property is present in TTC node, > + * it would be treated as PWM device. > + */ > + if (of_property_read_bool(timer, "#pwm-cells")) > + return -ENODEV; You will introduce dmesg errors, so regressions. This does not look right. What you want is to bind one device driver and choose different functionality based on properties. Best regards, Krzysztof
Hi, > -----Original Message----- > From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > Sent: Wednesday, November 15, 2023 2:41 AM > To: Sayyed, Mubin <mubin.sayyed@amd.com>; > krzysztof.kozlowski+dt@linaro.org; u.kleine-koenig@pengutronix.de; > thierry.reding@gmail.com; robh+dt@kernel.org; conor+dt@kernel.org; > tglx@linutronix.de; daniel.lezcano@linaro.org; Simek, Michal > <michal.simek@amd.com> > Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > devicetree@vger.kernel.org; linux-pwm@vger.kernel.org; git (AMD-Xilinx) > <git@amd.com>; mubin10@gmail.com > Subject: Re: [LINUX PATCH v2 1/3] clocksource: timer-cadence-ttc: Do not > probe TTC device configured as PWM > > On 14/11/2023 13:47, Mubin Sayyed wrote: > > TTC device can act either as clocksource/clockevent or PWM generator, > > it would be decided by pwm-cells property. > > TTC PWM feature would be supported through separate driver based on > > PWM framework. > > > > If pwm-cells property is present in TTC node, it would be treated as > > PWM device, and clocksource driver should just skip it. > > > > Signed-off-by: Mubin Sayyed <mubin.sayyed@amd.com> > > --- > > Changes for v2: > > - Added comment regarding pwm-cells property > > --- > > drivers/clocksource/timer-cadence-ttc.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/drivers/clocksource/timer-cadence-ttc.c > > b/drivers/clocksource/timer-cadence-ttc.c > > index 32daaac9b132..f8fcb1a4bdd0 100644 > > --- a/drivers/clocksource/timer-cadence-ttc.c > > +++ b/drivers/clocksource/timer-cadence-ttc.c > > @@ -477,6 +477,13 @@ static int __init ttc_timer_probe(struct > platform_device *pdev) > > u32 timer_width = 16; > > struct device_node *timer = pdev->dev.of_node; > > > > + /* > > + * If pwm-cells property is present in TTC node, > > + * it would be treated as PWM device. > > + */ > > + if (of_property_read_bool(timer, "#pwm-cells")) > > + return -ENODEV; > > You will introduce dmesg errors, so regressions. > [Mubin]: I will change it to "return 0" to avoid dmesg errors. > This does not look right. What you want is to bind one device driver and > choose different functionality based on properties. [Mubin]: I am doing it based on earlier discussion related to AXI Timer PWM driver. It was suggested to use #pwm-cells property for identifying role of device(PWM/clocksource) https://lore.kernel.org/linux-devicetree/20210513021631.GA878860@robh.at.kernel.org/. Thanks, Mubin > > Best regards, > Krzysztof
On 15/11/2023 06:55, Sayyed, Mubin wrote: >>> + /* >>> + * If pwm-cells property is present in TTC node, >>> + * it would be treated as PWM device. >>> + */ >>> + if (of_property_read_bool(timer, "#pwm-cells")) >>> + return -ENODEV; >> >> You will introduce dmesg errors, so regressions. >> > [Mubin]: I will change it to "return 0" to avoid dmesg errors. No, because solution is wrong. > >> This does not look right. What you want is to bind one device driver and >> choose different functionality based on properties. > [Mubin]: I am doing it based on earlier discussion related to AXI Timer PWM driver. It was suggested to use #pwm-cells property for identifying role of device(PWM/clocksource) https://lore.kernel.org/linux-devicetree/20210513021631.GA878860@robh.at.kernel.org/. You are mixing bindings with driver. I said here about driver and yes - you must use pwm-cells to differentiate that. It's obvious. So again, one driver binding. Wrap your emails to mailing list discussion style. Best regards, Krzysztof
Hi Krzysztof, > -----Original Message----- > From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > Sent: Wednesday, November 15, 2023 5:41 PM > To: Sayyed, Mubin <mubin.sayyed@amd.com> > Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > devicetree@vger.kernel.org; linux-pwm@vger.kernel.org; git (AMD-Xilinx) > <git@amd.com>; mubin10@gmail.com; krzysztof.kozlowski+dt@linaro.org; > u.kleine-koenig@pengutronix.de; thierry.reding@gmail.com; > robh+dt@kernel.org; conor+dt@kernel.org; tglx@linutronix.de; > daniel.lezcano@linaro.org; Simek, Michal <michal.simek@amd.com> > Subject: Re: [LINUX PATCH v2 1/3] clocksource: timer-cadence-ttc: Do not probe > TTC device configured as PWM > > On 15/11/2023 06:55, Sayyed, Mubin wrote: > >>> + /* > >>> + * If pwm-cells property is present in TTC node, > >>> + * it would be treated as PWM device. > >>> + */ > >>> + if (of_property_read_bool(timer, "#pwm-cells")) > >>> + return -ENODEV; > >> > >> You will introduce dmesg errors, so regressions. > >> > > [Mubin]: I will change it to "return 0" to avoid dmesg errors. > > No, because solution is wrong. > > > > >> This does not look right. What you want is to bind one device driver > >> and choose different functionality based on properties. > > [Mubin]: I am doing it based on earlier discussion related to AXI Timer PWM > driver. It was suggested to use #pwm-cells property for identifying role of > device(PWM/clocksource) https://lore.kernel.org/linux- > devicetree/20210513021631.GA878860@robh.at.kernel.org/. > > You are mixing bindings with driver. I said here about driver and yes - you must > use pwm-cells to differentiate that. It's obvious. > > So again, one driver binding. [Mubin]: I will explore whether mfd framework can be used to handle this. Thanks, Mubin > > Wrap your emails to mailing list discussion style. > > Best regards, > Krzysztof
On 24/11/2023 12:03, Sayyed, Mubin wrote: > Hi Krzysztof, > >> -----Original Message----- >> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> >> Sent: Wednesday, November 15, 2023 5:41 PM >> To: Sayyed, Mubin <mubin.sayyed@amd.com> >> Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; >> devicetree@vger.kernel.org; linux-pwm@vger.kernel.org; git (AMD-Xilinx) >> <git@amd.com>; mubin10@gmail.com; krzysztof.kozlowski+dt@linaro.org; >> u.kleine-koenig@pengutronix.de; thierry.reding@gmail.com; >> robh+dt@kernel.org; conor+dt@kernel.org; tglx@linutronix.de; >> daniel.lezcano@linaro.org; Simek, Michal <michal.simek@amd.com> >> Subject: Re: [LINUX PATCH v2 1/3] clocksource: timer-cadence-ttc: Do not probe >> TTC device configured as PWM >> >> On 15/11/2023 06:55, Sayyed, Mubin wrote: >>>>> + /* >>>>> + * If pwm-cells property is present in TTC node, >>>>> + * it would be treated as PWM device. >>>>> + */ >>>>> + if (of_property_read_bool(timer, "#pwm-cells")) >>>>> + return -ENODEV; >>>> >>>> You will introduce dmesg errors, so regressions. >>>> >>> [Mubin]: I will change it to "return 0" to avoid dmesg errors. >> >> No, because solution is wrong. >> >>> >>>> This does not look right. What you want is to bind one device driver >>>> and choose different functionality based on properties. >>> [Mubin]: I am doing it based on earlier discussion related to AXI Timer PWM >> driver. It was suggested to use #pwm-cells property for identifying role of >> device(PWM/clocksource) https://lore.kernel.org/linux- >> devicetree/20210513021631.GA878860@robh.at.kernel.org/. >> >> You are mixing bindings with driver. I said here about driver and yes - you must >> use pwm-cells to differentiate that. It's obvious. >> >> So again, one driver binding. > [Mubin]: I will explore whether mfd framework can be used to handle this. You do not need MFD for this, because you do not have a really MFD. This is just one device, so I expect here one driver. Why do you need multiple drivers (which also would solve that problem but why?)? Best regards, Krzysztof
On 11/24/23 12:35, Krzysztof Kozlowski wrote: > On 24/11/2023 12:03, Sayyed, Mubin wrote: >> Hi Krzysztof, >> >>> -----Original Message----- >>> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> >>> Sent: Wednesday, November 15, 2023 5:41 PM >>> To: Sayyed, Mubin <mubin.sayyed@amd.com> >>> Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; >>> devicetree@vger.kernel.org; linux-pwm@vger.kernel.org; git (AMD-Xilinx) >>> <git@amd.com>; mubin10@gmail.com; krzysztof.kozlowski+dt@linaro.org; >>> u.kleine-koenig@pengutronix.de; thierry.reding@gmail.com; >>> robh+dt@kernel.org; conor+dt@kernel.org; tglx@linutronix.de; >>> daniel.lezcano@linaro.org; Simek, Michal <michal.simek@amd.com> >>> Subject: Re: [LINUX PATCH v2 1/3] clocksource: timer-cadence-ttc: Do not probe >>> TTC device configured as PWM >>> >>> On 15/11/2023 06:55, Sayyed, Mubin wrote: >>>>>> + /* >>>>>> + * If pwm-cells property is present in TTC node, >>>>>> + * it would be treated as PWM device. >>>>>> + */ >>>>>> + if (of_property_read_bool(timer, "#pwm-cells")) >>>>>> + return -ENODEV; >>>>> >>>>> You will introduce dmesg errors, so regressions. >>>>> >>>> [Mubin]: I will change it to "return 0" to avoid dmesg errors. >>> >>> No, because solution is wrong. >>> >>>> >>>>> This does not look right. What you want is to bind one device driver >>>>> and choose different functionality based on properties. >>>> [Mubin]: I am doing it based on earlier discussion related to AXI Timer PWM >>> driver. It was suggested to use #pwm-cells property for identifying role of >>> device(PWM/clocksource) https://lore.kernel.org/linux- >>> devicetree/20210513021631.GA878860@robh.at.kernel.org/. >>> >>> You are mixing bindings with driver. I said here about driver and yes - you must >>> use pwm-cells to differentiate that. It's obvious. >>> >>> So again, one driver binding. >> [Mubin]: I will explore whether mfd framework can be used to handle this. > > You do not need MFD for this, because you do not have a really MFD. This > is just one device, so I expect here one driver. Why do you need > multiple drivers (which also would solve that problem but why?)? this driver is following pattern which is xps-timer (soff IP) Documentation/devicetree/bindings/timer/xlnx,xps-timer.yaml which has two drivers in the kernel. On for clocksource arch/microblaze/kernel/timer.c and pwm one drivers/pwm/pwm-xilinx.c clocksource driver will be at some point moved to drivers/clocksource because that's what will be used in connection to MicroBlaze V. I have looked at TTC and functionality wise it is related to Documentation/devicetree/bindings/mfd/st,stm32-timers.yaml or Documentation/devicetree/bindings/mfd/st,stm32-lptimer.yaml which are based on MFD. Timer there is only clockevent not clocksource but it shouldn't really matter. The biggest issue what I see is that ttc clocksource driver is used on arm32 Zynq family for a lot of years. It means moving to different binding based on mfd would require keeping support for old dt binding too. That would be from my point of view thing to start with. What do you think what would be the best way forward? But I need to do my homework first to see what functionality that IP has but I am quite sure there could be at least multiple PMWs. Thanks, Michal
Hi, > -----Original Message----- > From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > Sent: Friday, November 24, 2023 5:06 PM > To: Sayyed, Mubin <mubin.sayyed@amd.com> > Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > devicetree@vger.kernel.org; linux-pwm@vger.kernel.org; git (AMD-Xilinx) > <git@amd.com>; mubin10@gmail.com; krzysztof.kozlowski+dt@linaro.org; > u.kleine-koenig@pengutronix.de; thierry.reding@gmail.com; > robh+dt@kernel.org; conor+dt@kernel.org; tglx@linutronix.de; > daniel.lezcano@linaro.org; Simek, Michal <michal.simek@amd.com> > Subject: Re: [LINUX PATCH v2 1/3] clocksource: timer-cadence-ttc: Do not probe > TTC device configured as PWM > > On 24/11/2023 12:03, Sayyed, Mubin wrote: > > Hi Krzysztof, > > > >> -----Original Message----- > >> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > >> Sent: Wednesday, November 15, 2023 5:41 PM > >> To: Sayyed, Mubin <mubin.sayyed@amd.com> > >> Cc: linux-arm-kernel@lists.infradead.org; > >> linux-kernel@vger.kernel.org; devicetree@vger.kernel.org; > >> linux-pwm@vger.kernel.org; git (AMD-Xilinx) <git@amd.com>; > >> mubin10@gmail.com; krzysztof.kozlowski+dt@linaro.org; > >> u.kleine-koenig@pengutronix.de; thierry.reding@gmail.com; > >> robh+dt@kernel.org; conor+dt@kernel.org; tglx@linutronix.de; > >> daniel.lezcano@linaro.org; Simek, Michal <michal.simek@amd.com> > >> Subject: Re: [LINUX PATCH v2 1/3] clocksource: timer-cadence-ttc: Do > >> not probe TTC device configured as PWM > >> > >> On 15/11/2023 06:55, Sayyed, Mubin wrote: > >>>>> + /* > >>>>> + * If pwm-cells property is present in TTC node, > >>>>> + * it would be treated as PWM device. > >>>>> + */ > >>>>> + if (of_property_read_bool(timer, "#pwm-cells")) > >>>>> + return -ENODEV; > >>>> > >>>> You will introduce dmesg errors, so regressions. > >>>> > >>> [Mubin]: I will change it to "return 0" to avoid dmesg errors. > >> > >> No, because solution is wrong. > >> > >>> > >>>> This does not look right. What you want is to bind one device > >>>> driver and choose different functionality based on properties. > >>> [Mubin]: I am doing it based on earlier discussion related to AXI > >>> Timer PWM > >> driver. It was suggested to use #pwm-cells property for identifying > >> role of > >> device(PWM/clocksource) https://lore.kernel.org/linux- > >> devicetree/20210513021631.GA878860@robh.at.kernel.org/. > >> > >> You are mixing bindings with driver. I said here about driver and yes > >> - you must use pwm-cells to differentiate that. It's obvious. > >> > >> So again, one driver binding. > > [Mubin]: I will explore whether mfd framework can be used to handle this. > > You do not need MFD for this, because you do not have a really MFD. This is just > one device, so I expect here one driver. Why do you need multiple drivers (which > also would solve that problem but why?)? Cadence TTC IP can be used as timer(clocksource/clockevent) and PWM device. We have drivers/clocksource/timer-cadence-ttc.c for clocksource/clockevent functionality. New driver for PWM functionality will be added to drivers/pwm/pwm-cadence.c (3/3 of this Series). In given SoC, multiple instances of TTC IP are possible(ZynqMP Ultrscale SoC has 4 Instances), few of them could be configured as clocksource/clockevent devices and others as PWM ones. So, cloksource as well as PWM drivers for cadence TTC IP would be enabled in the kernel. Now in this scenario, each TTC device would be matching with 2 drivers, clocksource and PWM, since compatible string is same. If I don’t add #pwm-cells checking in clocksource driver and return -ENODEV based on that, each device would always bind with clocksource driver. PWM driver would never probe since clocksource driver probes ahead of PWM one in probing order. I am exploring mfd to deal with said scenario. Do you see any better way to handle this? Thanks, Mubin > > Best regards, > Krzysztof
On 24/11/2023 13:07, Sayyed, Mubin wrote: >>>>>> This does not look right. What you want is to bind one device >>>>>> driver and choose different functionality based on properties. >>>>> [Mubin]: I am doing it based on earlier discussion related to AXI >>>>> Timer PWM >>>> driver. It was suggested to use #pwm-cells property for identifying >>>> role of >>>> device(PWM/clocksource) https://lore.kernel.org/linux- >>>> devicetree/20210513021631.GA878860@robh.at.kernel.org/. >>>> >>>> You are mixing bindings with driver. I said here about driver and yes >>>> - you must use pwm-cells to differentiate that. It's obvious. >>>> >>>> So again, one driver binding. >>> [Mubin]: I will explore whether mfd framework can be used to handle this. >> >> You do not need MFD for this, because you do not have a really MFD. This is just >> one device, so I expect here one driver. Why do you need multiple drivers (which >> also would solve that problem but why?)? > Cadence TTC IP can be used as timer(clocksource/clockevent) and PWM device. > We have drivers/clocksource/timer-cadence-ttc.c for clocksource/clockevent functionality. > New driver for PWM functionality will be added to drivers/pwm/pwm-cadence.c (3/3 of this > Series). In given SoC, multiple instances of TTC IP are possible(ZynqMP Ultrscale SoC has 4 > Instances), few of them could be configured as clocksource/clockevent devices and others > as PWM ones. So, cloksource as well as PWM drivers for cadence TTC IP would be enabled in > the kernel. > > Now in this scenario, each TTC device would be matching with 2 drivers, clocksource and PWM, since > compatible string is same. If I don’t add #pwm-cells checking in clocksource driver and return > -ENODEV based on that, each device would always bind with clocksource driver. PWM driver > would never probe since clocksource driver probes ahead of PWM one in probing order. None of these above explain why you need two drivers. > > I am exploring mfd to deal with said scenario. Do you see any better way to handle this? You basically repeated previous sentence about MFD without answering. Yeah, better way could be to have one driver. Why you cannot have it that way? Best regards, Krzysztof
On 24/11/2023 17:24, Krzysztof Kozlowski wrote: >>>>> So again, one driver binding. >>>> [Mubin]: I will explore whether mfd framework can be used to handle this. >>> >>> You do not need MFD for this, because you do not have a really MFD. This is just >>> one device, so I expect here one driver. Why do you need multiple drivers (which >>> also would solve that problem but why?)? >> Cadence TTC IP can be used as timer(clocksource/clockevent) and PWM device. >> We have drivers/clocksource/timer-cadence-ttc.c for clocksource/clockevent functionality. >> New driver for PWM functionality will be added to drivers/pwm/pwm-cadence.c (3/3 of this >> Series). In given SoC, multiple instances of TTC IP are possible(ZynqMP Ultrscale SoC has 4 >> Instances), few of them could be configured as clocksource/clockevent devices and others >> as PWM ones. So, cloksource as well as PWM drivers for cadence TTC IP would be enabled in >> the kernel. >> >> Now in this scenario, each TTC device would be matching with 2 drivers, clocksource and PWM, since >> compatible string is same. If I don’t add #pwm-cells checking in clocksource driver and return >> -ENODEV based on that, each device would always bind with clocksource driver. PWM driver >> would never probe since clocksource driver probes ahead of PWM one in probing order. > > None of these above explain why you need two drivers. And please do not answer to this with again: "I have two drivers...". > >> >> I am exploring mfd to deal with said scenario. Do you see any better way to handle this? > > You basically repeated previous sentence about MFD without answering. > Yeah, better way could be to have one driver. Why you cannot have it > that way? > > > Best regards, > Krzysztof > Best regards, Krzysztof
diff --git a/drivers/clocksource/timer-cadence-ttc.c b/drivers/clocksource/timer-cadence-ttc.c index 32daaac9b132..f8fcb1a4bdd0 100644 --- a/drivers/clocksource/timer-cadence-ttc.c +++ b/drivers/clocksource/timer-cadence-ttc.c @@ -477,6 +477,13 @@ static int __init ttc_timer_probe(struct platform_device *pdev) u32 timer_width = 16; struct device_node *timer = pdev->dev.of_node; + /* + * If pwm-cells property is present in TTC node, + * it would be treated as PWM device. + */ + if (of_property_read_bool(timer, "#pwm-cells")) + return -ENODEV; + if (initialized) return 0;