From patchwork Tue Nov 14 12:47:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mubin Sayyed X-Patchwork-Id: 164886 Return-Path: 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 + 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 ); 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 To: , , , , , , , CC: , , , , , , Mubin Sayyed 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 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: 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 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 --- 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; + if (initialized) return 0; From patchwork Tue Nov 14 12:47:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mubin Sayyed X-Patchwork-Id: 164887 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1832861vqg; Tue, 14 Nov 2023 04:49:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHL2gjZfNiSfSfBgKvT4aqSGwi0F/mnoKq7e5uIUCDJ/oE1z2jTtki0Qqd1SHlYTkPGWgo X-Received: by 2002:a17:902:8603:b0:1cc:449b:68a8 with SMTP id f3-20020a170902860300b001cc449b68a8mr2167161plo.46.1699966177476; Tue, 14 Nov 2023 04:49:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699966177; cv=pass; d=google.com; s=arc-20160816; b=cz99HcbBQuo2Di2WnANA+FzR2tlKSjxzRYyEayGWPPmtBy7uhMcc5Y6BNpx9abGjnK aIPHkb6MFnBpROIDW8/NE1JWb3yhIIfmwkx8iyunu0NCQQXXMqDJMBc8Dro/sKFM12YO vqIbgKgaK8owzoHSeyUVQ0GUCZcg9oeSMz/gGXnsSRxToBAKS5daZgm0YBZxZ4Xgj6ij /rDNK/ZKv8sfWMKIZhyUxLsi12pyyOXSY7asDWs0uiIwnr981pakzNHX5UEh1TAEVcoB PMkIUB2FOAOshyjVZEluAoDFYheMbBIiFpRJBrZvwL2i7dnG1KjOUbRxwiiaBxowg+k4 k9Mw== 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=jQpXlyDONzimOsaHr6N0meVwJEruFBCSVGiH0P1lF/Y=; fh=wHWLybIYgsdSFq1KmdlghAR48ihMPeTHNeC/btuoPtQ=; b=C6rctZPx1oSTP4hDV/D8JrOZc+TRnfmgNXIJUHOJtVXNsyzNIA39eSaN7+4G/BFyx+ ZNEZTaJHOx5xIQjPwSyxEWarV+Lrmo0Y5SqOj9cokDdQ0t3r7a/cFkDDokSNGzRthmaX Hw2AWKWx9JyNM2gDYvsQWvXkywvOwTVUU2jzTyRk+OSAy8EkZYqHp7RPczOhNCgZoZPK bWDix43h2kRjtOSJkiWZ/Uz2TpnlEUGsD9+o/ROH2T4coBd1FVjM5EGqW8tmPVG4gYD3 gCRPTlyOefSZFvOTrbugcPmvzSstJ8zS9HwDGVFMThsRpQDVarOMXSpRSKzETYQ7Ek+L jl1A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ymOScf6k; 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 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id e3-20020a17090301c300b001c60636e426si8347246plh.432.2023.11.14.04.49.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 04:49:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ymOScf6k; 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 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id A9E2980E06BF; Tue, 14 Nov 2023 04:49:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233061AbjKNMt2 (ORCPT + 29 others); Tue, 14 Nov 2023 07:49:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232883AbjKNMtT (ORCPT ); Tue, 14 Nov 2023 07:49:19 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCEBF1A7; Tue, 14 Nov 2023 04:49:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JwpwaT8s6iKScHChRQV903JQ6/GsHfEq7gccAD2KgSIwOA8o/v09ENEUDa1AgDtm1ucIw1H5FMITSKem1v/WaQgcsEXg5jpybG/vNYw00SeTWOV7brjs0cMPcvAc0uPcErjTDGXeo2bDpnVU/uMwOJJ8yflSRkNZoq3LneI01hMSqPsBDEKFnhyenEMH0SQwgOG9POLtM/MSFaGyw0z/2HeTIoy+NpL8TQ0kEAm51yp7IOKzkER8AABamRrAHpTyOgCy1r3lo8xvFbvVG2o8HjB7abEloVqwg35FdHdY1Gfwlpcpiqg86XgWz2AcWfrgjzM36c+AwFv7Ff9gj5pRfQ== 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=jQpXlyDONzimOsaHr6N0meVwJEruFBCSVGiH0P1lF/Y=; b=iyreijANeNJ+q+bHefy5sAyZMrIPZMjFO8Kyz4XuAHKyTl5ChWtf8RnLczpZFCfAo1gC7XTwic6nreadbg6KkcbQmfGFu3jVaK5u9eTPEwZ3UZgik188v/in6valOodkac/i140TcsyNsrY+ov/uEMCFe+pbWrUyeuh14mediyDGB5X3P6fus6cA4Z1QD7C6/90W0QvbAwkZNe8ADAeqtEjHtVEJmyh8AUzc5IawIqya2im4Vzl5a/gJBCF3OTmcO0zhz8YzKR3Ofwr6wfvz2CcRNSg+mRB5Fd0ejr/PzAr8raYKQTtaA76cL1b7Mis3W2d2JBI3zRu2uTac2LiOlg== 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=jQpXlyDONzimOsaHr6N0meVwJEruFBCSVGiH0P1lF/Y=; b=ymOScf6kcNYQe+6euvlIVEBqRo8a4vg/qf+6NDBdgkVdmUg7QGdIrtJnVeagoWOCGRZM5uNYUc0W7tI8O2g6+WSsrLPuI9VBQuXEEUP7k/c5J5uH/pq6Z9DP7GM5ctfNHVJEXxdVzk58p83+o3LYqHhDV65399G3kDMID1gMfVM= Received: from MN2PR12CA0020.namprd12.prod.outlook.com (2603:10b6:208:a8::33) by DS0PR12MB6487.namprd12.prod.outlook.com (2603:10b6:8:c4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 12:49:10 +0000 Received: from BL6PEPF0001AB4A.namprd04.prod.outlook.com (2603:10b6:208:a8:cafe::26) by MN2PR12CA0020.outlook.office365.com (2603:10b6:208:a8::33) 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:49:10 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BL6PEPF0001AB4A.mail.protection.outlook.com (10.167.242.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7002.14 via Frontend Transport; Tue, 14 Nov 2023 12:48:43 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) 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:38 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) 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 04:48:37 -0800 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:34 -0600 From: Mubin Sayyed To: , , , , , , , CC: , , , , , , Mubin Sayyed Subject: [LINUX PATCH v2 2/3] dt-bindings: timer: Add bindings for TTC PWM Date: Tue, 14 Nov 2023 18:17:47 +0530 Message-ID: <20231114124748.581850-3-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 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4A:EE_|DS0PR12MB6487:EE_ X-MS-Office365-Filtering-Correlation-Id: f3b602e4-0dd0-4e20-c528-08dbe51018c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kHMgSg2FmBbWoeBxmOOi4hfe2SACmbD0xZKBb3q1sods81yv33T873ADOEG0jDe2hWh6uaBiOgP+I0mENzOKTLhaIzrbnOgyUd7RZDo6M7UeD0dbimGunIq2KJjGSHfrowSXO591nm/tPkUV6ZPQf9TWiAnnfUsz8WGcsf3vLB7ZdEfY4C45q0cP9TAbgxWpoBkz7qi/C5nTZl5F5ggDGD5C3ejY4HyOveBCSw94UuGAOYaRsZAK6qrucSTcEIgluRSM1/9Qs1OFkLbpP4eF276t1plEw5DpCQm4Ars8p7Fi1CIFxpb+ACGV6qC7UGDBRXRXYOE2isVNknPIZ+xquF7bahvvNqXqFTuZb12ul7rfqpOcXfrsESoeIeBIbpa1YliEE8qo/Z8iXfgFiQQ/eWdIOUnADJHAyZRoLG08Am+sNK9Ofsa3BiupIZJAiqEE8d/Sp6WdumHiYXXvNu6jHTIEsSZ1viJe++sTl1v23RMYr6T59LE++tZGDrpbwjLwmjnwhAzSmpUP8mq3+qsKOFxsNQgQ+Pm2h5xmsV10lk9CHvMj3z8JKCDoGmNCtmHPO2hVlbEASakVuNEqYMIZiknulcgfO36byqGj4Y8eJssoyoOC5Fw58K5BB3X0FOWdvdDqRQhw/S3c324m+ayxCjZTwVJu6u3SotE9yInr9UKFEjdHlzaUDZCQrjkQMYjNo4i0qw3iayqn3bRK8E3ezU2id02LF2eg0Sv9LZYrTtAQLo3mPKCm2aSFVhvSx0jt7AdNCFghtUzYaVtsltF8iw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(346002)(396003)(39860400002)(376002)(230922051799003)(451199024)(186009)(82310400011)(64100799003)(1800799009)(36840700001)(46966006)(40470700004)(40480700001)(40460700003)(70586007)(70206006)(110136005)(6636002)(316002)(54906003)(81166007)(82740400003)(356005)(36756003)(86362001)(83380400001)(336012)(426003)(26005)(6666004)(2616005)(36860700001)(478600001)(2906002)(5660300002)(47076005)(44832011)(41300700001)(4326008)(8676002)(7416002)(1076003)(8936002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 12:48:43.9345 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3b602e4-0dd0-4e20-c528-08dbe51018c5 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB4A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6487 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 14 Nov 2023 04:49:36 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782543734735519553 X-GMAIL-MSGID: 1782543734735519553 Cadence TTC can act as PWM device, it is supported through separate PWM framework based driver. Decision to configure specific TTC device as PWM or clocksource/clockevent would be done based on presence of "#pwm-cells" property. Also, interrupt property is not required for TTC PWM driver. Update bindings to support TTC PWM configuration. Signed-off-by: Mubin Sayyed Reviewed-by: Krzysztof Kozlowski --- Changes for v2: Update subject Modify #pwm-cells to constant 3 Update example to use generic name --- .../devicetree/bindings/timer/cdns,ttc.yaml | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/timer/cdns,ttc.yaml b/Documentation/devicetree/bindings/timer/cdns,ttc.yaml index dbba780c9b02..da342464d32e 100644 --- a/Documentation/devicetree/bindings/timer/cdns,ttc.yaml +++ b/Documentation/devicetree/bindings/timer/cdns,ttc.yaml @@ -32,12 +32,23 @@ properties: description: | Bit width of the timer, necessary if not 16. + "#pwm-cells": + const: 3 + required: - compatible - reg - - interrupts - clocks +allOf: + - if: + not: + required: + - "#pwm-cells" + then: + required: + - interrupts + additionalProperties: false examples: @@ -50,3 +61,12 @@ examples: clocks = <&cpu_clk 3>; timer-width = <32>; }; + + - | + pwm: pwm@f8002000 { + compatible = "cdns,ttc"; + reg = <0xf8002000 0x1000>; + clocks = <&cpu_clk 3>; + timer-width = <32>; + #pwm-cells = <3>; + }; From patchwork Tue Nov 14 12:47:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mubin Sayyed X-Patchwork-Id: 164888 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1833099vqg; Tue, 14 Nov 2023 04:50:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOMqik7NJ0uNkQs2QrAr/eP3ruSxm6YjNUHPQvFBDZvc4Yq7MxSdj+xTwJAWzTaxOB4eC7 X-Received: by 2002:a17:902:7682:b0:1cc:6acc:8fa4 with SMTP id m2-20020a170902768200b001cc6acc8fa4mr1750559pll.32.1699966208421; Tue, 14 Nov 2023 04:50:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699966208; cv=pass; d=google.com; s=arc-20160816; b=wCVMLopMVM5GgSnKO6No9rjOhPhCTpCYv61GuhVBjbB2iEe+6M4wuARoC3TPMzqIzX 6n2QFRd3e5q6f46gAxAjZIoNp876N4n9tmzHPu+1QuOx2rJOAcwxwEpfgSGhNi0+pEZv 6RyqCdPy4/LDVu+5dTjoZkZYeIuyGX3HjaUb4Fy6yZ+4L5yDKgSYz8FB8Kvqtq/vsPFM F5RQboRmUfKNWGKRT6kYi0+QTyFd4QPGl60D9W94PXNpynrvSvG29HC3w7i+zdHmDc7w U2vyldjmlg28SUI/7Ldsd9fEeSwEKchSbnM+CtGfIFMhS5qQRxYbqFWKA6fEj4WthjKO U+hA== 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=gyzCluOXSX0AuRgqG25XGUkoJ32Gr/T+43uwSFGn0uc=; fh=wHWLybIYgsdSFq1KmdlghAR48ihMPeTHNeC/btuoPtQ=; b=oWapviMU7+zJg2a5LFDQMRSkW4rZK/96+cP50eMgKJgjreBRDlaCcFq0cbcb0EGfiY ukFYP5KacM3JAt/pKLRvsKTHRgbJrd9GgI1UgXdhUbWQR8DeaiKUMuUrtkVoNgEwZARo WdTuAgjoQhnW2yGr2Onkh26mdwM4HVOuU2k6nMwlrbVqZbu9BbGEma74kpGwacZ2KqqA Luu9Va0WHCqJbs7W6wL1+DJ4SfFtq40HLKZtks8OUgepU2R6eiPbArPhf9knh39K6tyB YGkiLHfUq7AXsIlTqxc94uJj5IcpYIQ8RAOQj0HTbaQvHy/2VVcqCTnAWI4bdzcHlefA 5+Zg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="tDa8/rdQ"; 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:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id m4-20020a170902f64400b001bbf293f45esi8385555plg.625.2023.11.14.04.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 04:50:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="tDa8/rdQ"; 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:2 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 agentk.vger.email (Postfix) with ESMTP id EEDDA80A9175; Tue, 14 Nov 2023 04:50:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232730AbjKNMtU (ORCPT + 29 others); Tue, 14 Nov 2023 07:49:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232283AbjKNMtN (ORCPT ); Tue, 14 Nov 2023 07:49:13 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2088.outbound.protection.outlook.com [40.107.92.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40B0A18D; Tue, 14 Nov 2023 04:49:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PbtlPgFZhBDKBUm9d6qPFRloDdRUvbnMn6zsBO+yeSKTUonqhE70gChlu52rtYbnOC/VUrGVmc2h08Zv1nYOhjqs5YU5vC/BbKo6q7Xog7wUiqfH/wxzi139ro0tmWZFTeS1Hh2JWKfdlrwsFxD3BlqKBP1o8zqycMVc7Jy/mK2mrCsnGQmpYmKbkSZyWNaVQolOcxuZOlFowNISWmh1JDJMQ/NdAR1JqvSsg1KCqqx2TiVGI0jj6qgCXqPDPzfgbr8uA1XnPhD/zzu+sERzpCllHEJAY/ohxhsAOJVI0mZYaSp3gD4hQHxXn7Zi9FkYjZwOWVdXrnEFhxFOyT2dzw== 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=gyzCluOXSX0AuRgqG25XGUkoJ32Gr/T+43uwSFGn0uc=; b=Ibtvu7pnpF7XKfdPAFtQiOXcl49DWgTnkjW3w60Z1nVIE3n/+HDpUvwjs9t0jUp+dL8lms42aa0TO7so4RWe84aJxBgH7Rdgt+e1whDDcWsJl9uqn4hH4R0KQsbwEgO13Hpm+nYxez16qLAmzESzMX+J/13x9ZKfwZmGgg4BqWjLVI67K1Di+ho7UtKMtVbG+WWybLcwI5Nu/jhRh6zYPOxBMaYQcIOAQulZ6oJoNBhvKdyQa8/y7e0xiXPDaqZpKrpNx953QbYmfI0g0l/kGQLg/sgfRB3ZW8+LoUdiwAwHnx9XRjHyJbIIY6/inOWIEzltv9sxjww2my7pR2i/lA== 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=gyzCluOXSX0AuRgqG25XGUkoJ32Gr/T+43uwSFGn0uc=; b=tDa8/rdQKzT2N5VhpP00wEMghKHBoUGDbTK5mlo0k6jIH5+5JuiM9olZnqW6F3tosPvonUxeKeKywyE4KEzPhULhdCJbMFKsS8wV0kIJcX4USTpHuU5F/PL0B0H/zpY1rBvnHPaS/HIxfznaV3SmB76mwUfIEcLwFKODd+JQGZA= Received: from MN2PR20CA0035.namprd20.prod.outlook.com (2603:10b6:208:e8::48) by CY5PR12MB6036.namprd12.prod.outlook.com (2603:10b6:930:2c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.17; Tue, 14 Nov 2023 12:49:04 +0000 Received: from BL6PEPF0001AB51.namprd04.prod.outlook.com (2603:10b6:208:e8:cafe::8e) by MN2PR20CA0035.outlook.office365.com (2603:10b6:208:e8::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.17 via Frontend Transport; Tue, 14 Nov 2023 12:49:03 +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 BL6PEPF0001AB51.mail.protection.outlook.com (10.167.242.75) 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:49:03 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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:55 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) 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 04:48:41 -0800 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:38 -0600 From: Mubin Sayyed To: , , , , , , , CC: , , , , , , Mubin Sayyed Subject: [LINUX PATCH v2 3/3] pwm: pwm-cadence: Add support for TTC PWM Date: Tue, 14 Nov 2023 18:17:48 +0530 Message-ID: <20231114124748.581850-4-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 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB51:EE_|CY5PR12MB6036:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b5494cc-2cbc-4f14-9764-08dbe510151a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p3WeKWf0KqyRDc5P1kNa0ownyLtZolfFVBoJmquZGUK4l/FbHtOFj4hCiOro9zB8KfFVFJcZyKCcE+Rv/YXzkKHvJu0EiQIZ4zbS+DPjwnjw+XAIhOeLp0oxoKAtbpYEIaFoIk2SG3UubBKBavbKQWIEwLFzBbcyfHS0Cp2a6oTjoJTuecUqWFsnytNHj1M5xNMlIEwEOW4y8K0rxE5Ttn15LvKkvChyuoo3w8vbeO9qeyW0FN8Hy4dgo7z0VqdqHkFGzmVhEX/25DCTNbjOrstdeOlzJ6jPao/jVeC20S1Za9nplPbtoXr9kp4ZioPR9ssQMustAmLt325i3ljDosvY3h7wdXnISX0UQHwjQ7GiAUPbcMVErSIA5be7xqA5nV9AA6mTLMUrOfu5zsflxwtHGAyf10BlNvAeS/zVWtDNtw+XF+aBW2ntj/OAwsuNfs3nAEsuK85w+UoA2vAx3GvDhDd7bmYcFT4HwKx2fv393X443uD2XBDP+7GjQoP/c/o+LpI4KlGyOpzy2qLrUFQI20VtDx+eBIEdOlDzxPMZjepaNNoJVmcrzmkxmvc2bQIYPmUfV3ut4f9FM8fUOp7oi8YkgV3SuyNpoowSYOwoM9PlR8FTSTHHPXpL+NTeTRuICutG+crXYjJFwOC92GBdmwaogfRhCwTLPUoLyGre5DW+ODYS5gtLix5lsTWb6wxki15/xA75dTDryQhsZG+X8FdyN7GMuJOy75i020JRTdhNTDyzgXwoVvPo/d0k78PfK3rf2ZTCOFl7czmbvg== 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)(346002)(136003)(396003)(376002)(39860400002)(230922051799003)(451199024)(1800799009)(186009)(82310400011)(64100799003)(40470700004)(46966006)(36840700001)(2906002)(40460700003)(5660300002)(7416002)(30864003)(41300700001)(36860700001)(356005)(86362001)(36756003)(316002)(6636002)(70206006)(82740400003)(478600001)(81166007)(110136005)(70586007)(2616005)(1076003)(26005)(6666004)(336012)(47076005)(426003)(966005)(83380400001)(4326008)(44832011)(54906003)(8676002)(8936002)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 12:49:03.8890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b5494cc-2cbc-4f14-9764-08dbe510151a 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: BL6PEPF0001AB51.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6036 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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 14 Nov 2023 04:50:05 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782543766982135996 X-GMAIL-MSGID: 1782543766982135996 Cadence TTC timer can be configured as clocksource/clockevent or PWM device. Specific TTC device would be configured as PWM device, if pwm-cells property is present in the device tree node. In case of Zynq, ZynqMP and Versal SoC's, each TTC device has 3 timers/counters, so maximum 3 PWM channels can be configured for each TTC IP instance. Also, output of 0th PWM channel of each TTC device can be routed to MIO or EMIO, and output of 2nd and 3rd PWM channel can be routed only to EMIO. Period for given PWM channel is configured through interval timer and duty cycle through match counter. Details for cadence TTC IP can be found in Zynq UltraScale+ TRM. Signed-off-by: Mubin Sayyed --- Refer link given below for Zynq UltraScale+ TRM https://docs.xilinx.com/r/en-US/ug1085-zynq-ultrascale-trm Changes for v2: Use maybe_unused attribute for ttc_pwm_of_match_driver structure Add new function ttc_pwm_set_polarity Removed calls to pwm_get_state Replace DIV_ROUNF_CLOSEST with mul_u64_u64_div_u64 Modify ttc_pwm_apply to remove while loop in prescalar logic and avoid glitch Calculate rate in probe and add it to private structure for further Drop ttc_pwm_of_xlate Replace of_clk_get with devm_clk_get_enabled Drop _OFFSET and _MASK from definitions Keep Kconfig and Makefile changes alphabetically sorted Use remove_new instead of remove Document limitations in driver file --- drivers/pwm/Kconfig | 11 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-cadence.c | 370 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 382 insertions(+) create mode 100644 drivers/pwm/pwm-cadence.c diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 8ebcddf91f7b..7fd493f06496 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -152,6 +152,17 @@ config PWM_BRCMSTB To compile this driver as a module, choose M Here: the module will be called pwm-brcmstb.c. +config PWM_CADENCE + tristate "Cadence PWM support" + depends on OF + depends on COMMON_CLK + help + Generic PWM framework driver for cadence TTC IP found on + Xilinx Zynq/ZynqMP/Versal SOCs. Each TTC device has 3 PWM + channels. Output of 0th PWM channel of each TTC device can + be routed to MIO or EMIO, and output of 1st and 2nd PWM + channels can be routed only to EMIO. + config PWM_CLK tristate "Clock based PWM support" depends on HAVE_CLK || COMPILE_TEST diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index c822389c2a24..a8a11dbcb00f 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_PWM_BCM_KONA) += pwm-bcm-kona.o obj-$(CONFIG_PWM_BCM2835) += pwm-bcm2835.o obj-$(CONFIG_PWM_BERLIN) += pwm-berlin.o obj-$(CONFIG_PWM_BRCMSTB) += pwm-brcmstb.o +obj-$(CONFIG_PWM_CADENCE) += pwm-cadence.o obj-$(CONFIG_PWM_CLK) += pwm-clk.o obj-$(CONFIG_PWM_CLPS711X) += pwm-clps711x.o obj-$(CONFIG_PWM_CRC) += pwm-crc.o diff --git a/drivers/pwm/pwm-cadence.c b/drivers/pwm/pwm-cadence.c new file mode 100644 index 000000000000..12aaa004bf7f --- /dev/null +++ b/drivers/pwm/pwm-cadence.c @@ -0,0 +1,370 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver to configure cadence TTC timer as PWM + * generator + * + * Limitations: + * - When PWM is stopped, timer counter gets stopped immediately. This + * doesn't allow the current PWM period to complete and stops abruptly. + * - Disabled PWM emits inactive level. + * - When user requests a change in any parameter of PWM (period/duty cycle/polarity) + * while PWM is in enabled state: + * - PWM is stopped abruptly. + * - Requested parameter is changed. + * - Fresh PWM cycle is started. + * + * Copyright (C) 2023, Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include +#include +#include + +#define TTC_CLK_CNTRL 0x00 +#define TTC_CNT_CNTRL 0x0C +#define TTC_MATCH_CNT_VAL 0x30 +#define TTC_COUNT_VAL 0x18 +#define TTC_INTR_VAL 0x24 +#define TTC_ISR 0x54 +#define TTC_IER 0x60 +#define TTC_PWM_CHANNEL 0x4 + +#define TTC_CLK_CNTRL_CSRC BIT(5) +#define TTC_CLK_CNTRL_PSV GENMASK(4, 1) +#define TTC_CLK_CNTRL_PS_EN BIT(0) + +#define TTC_CNTR_CTRL_DIS BIT(0) +#define TTC_CNTR_CTRL_INTR_MODE_EN BIT(1) +#define TTC_CNTR_CTRL_MATCH_MODE_EN BIT(3) +#define TTC_CNTR_CTRL_RST BIT(4) +#define TTC_CNTR_CTRL_WAVE_EN BIT(5) +#define TTC_CNTR_CTRL_WAVE_POL BIT(6) + +#define TTC_CNTR_CTRL_WAVE_POL_SHIFT 6 +#define TTC_CNTR_CTRL_PRESCALE_SHIFT 1 +#define TTC_PWM_MAX_CH 3 + +/** + * struct ttc_pwm_priv - Private data for TTC PWM drivers + * @chip: PWM chip structure representing PWM controller + * @clk: TTC input clock + * @rate: TTC input clock rate + * @max: Maximum value of the counters + * @base: Base address of TTC instance + */ +struct ttc_pwm_priv { + struct pwm_chip chip; + struct clk *clk; + unsigned long rate; + u32 max; + void __iomem *base; +}; + +static inline u32 ttc_pwm_readl(struct ttc_pwm_priv *priv, + unsigned long offset) +{ + return readl_relaxed(priv->base + offset); +} + +static inline void ttc_pwm_writel(struct ttc_pwm_priv *priv, + unsigned long offset, + unsigned long val) +{ + writel_relaxed(val, priv->base + offset); +} + +static inline u32 ttc_pwm_ch_readl(struct ttc_pwm_priv *priv, + unsigned int chnum, + unsigned long offset) +{ + unsigned long pwm_ch_offset = offset + + (TTC_PWM_CHANNEL * chnum); + + return ttc_pwm_readl(priv, pwm_ch_offset); +} + +static inline void ttc_pwm_ch_writel(struct ttc_pwm_priv *priv, + unsigned int chnum, + unsigned long offset, + unsigned long val) +{ + unsigned long pwm_ch_offset = offset + + (TTC_PWM_CHANNEL * chnum); + + ttc_pwm_writel(priv, pwm_ch_offset, val); +} + +static inline struct ttc_pwm_priv *xilinx_pwm_chip_to_priv(struct pwm_chip *chip) +{ + return container_of(chip, struct ttc_pwm_priv, chip); +} + +static void ttc_pwm_enable(struct ttc_pwm_priv *priv, struct pwm_device *pwm) +{ + u32 ctrl_reg; + + ctrl_reg = ttc_pwm_ch_readl(priv, pwm->hwpwm, TTC_CNT_CNTRL); + ctrl_reg |= (TTC_CNTR_CTRL_INTR_MODE_EN + | TTC_CNTR_CTRL_MATCH_MODE_EN | TTC_CNTR_CTRL_RST); + ctrl_reg &= ~(TTC_CNTR_CTRL_DIS | TTC_CNTR_CTRL_WAVE_EN); + ttc_pwm_ch_writel(priv, pwm->hwpwm, TTC_CNT_CNTRL, ctrl_reg); +} + +static void ttc_pwm_disable(struct ttc_pwm_priv *priv, struct pwm_device *pwm) +{ + u32 ctrl_reg; + + ctrl_reg = ttc_pwm_ch_readl(priv, pwm->hwpwm, TTC_CNT_CNTRL); + ctrl_reg |= TTC_CNTR_CTRL_DIS; + + ttc_pwm_ch_writel(priv, pwm->hwpwm, TTC_CNT_CNTRL, ctrl_reg); +} + +static void ttc_pwm_set_polarity(struct ttc_pwm_priv *priv, struct pwm_device *pwm, + enum pwm_polarity polarity) +{ + u32 ctrl_reg; + + ctrl_reg = ttc_pwm_ch_readl(priv, pwm->hwpwm, TTC_CNT_CNTRL); + + if (polarity == PWM_POLARITY_NORMAL) + ctrl_reg |= TTC_CNTR_CTRL_WAVE_POL; + else + ctrl_reg &= (~TTC_CNTR_CTRL_WAVE_POL); + + ttc_pwm_ch_writel(priv, pwm->hwpwm, TTC_CNT_CNTRL, ctrl_reg); +} + +static void ttc_pwm_set_counters(struct ttc_pwm_priv *priv, + struct pwm_device *pwm, + u32 period_cycles, + u32 duty_cycles) +{ + /* Set up period */ + ttc_pwm_ch_writel(priv, pwm->hwpwm, TTC_INTR_VAL, period_cycles); + + /* Set up duty cycle */ + ttc_pwm_ch_writel(priv, pwm->hwpwm, TTC_MATCH_CNT_VAL, duty_cycles); +} + +static void ttc_pwm_set_prescalar(struct ttc_pwm_priv *priv, + struct pwm_device *pwm, + u32 div, bool is_enable) +{ + u32 clk_reg; + + if (is_enable) { + /* Set up prescalar */ + clk_reg = ttc_pwm_ch_readl(priv, pwm->hwpwm, TTC_CLK_CNTRL); + clk_reg &= ~TTC_CLK_CNTRL_PSV; + clk_reg |= (div << TTC_CNTR_CTRL_PRESCALE_SHIFT); + clk_reg |= TTC_CLK_CNTRL_PS_EN; + ttc_pwm_ch_writel(priv, pwm->hwpwm, TTC_CLK_CNTRL, clk_reg); + } else { + /* Disable prescalar */ + clk_reg = ttc_pwm_ch_readl(priv, pwm->hwpwm, TTC_CLK_CNTRL); + clk_reg &= ~TTC_CLK_CNTRL_PS_EN; + ttc_pwm_ch_writel(priv, pwm->hwpwm, TTC_CLK_CNTRL, clk_reg); + } +} + +static int ttc_pwm_apply(struct pwm_chip *chip, + struct pwm_device *pwm, + const struct pwm_state *state) +{ + struct ttc_pwm_priv *priv = xilinx_pwm_chip_to_priv(chip); + u64 duty_cycles, period_cycles; + struct pwm_state cstate; + unsigned long rate; + bool flag = false; + u32 div = 0; + + cstate = pwm->state; + + if (state->polarity != cstate.polarity) { + if (cstate.enabled) + ttc_pwm_disable(priv, pwm); + + ttc_pwm_set_polarity(priv, pwm, state->polarity); + } + + rate = priv->rate; + + /* Prevent overflow by limiting to the maximum possible period */ + period_cycles = min_t(u64, state->period, ULONG_MAX * NSEC_PER_SEC); + period_cycles = mul_u64_u64_div_u64(period_cycles, rate, NSEC_PER_SEC); + + if (period_cycles > priv->max) { + /* + * Prescale frequency to fit requested period cycles within limit. + * Prescalar divides input clock by 2^(prescale_value + 1). Maximum + * supported prescalar value is 15. + */ + div = mul_u64_u64_div_u64(state->period, rate, (NSEC_PER_SEC * priv->max)); + div = order_base_2(div); + if (div) + div -= 1; + + if (div > 15) + return -ERANGE; + + rate = DIV_ROUND_CLOSEST(rate, BIT(div + 1)); + period_cycles = mul_u64_u64_div_u64(state->period, rate, + NSEC_PER_SEC); + flag = true; + } + + if (cstate.enabled) + ttc_pwm_disable(priv, pwm); + + duty_cycles = mul_u64_u64_div_u64(state->duty_cycle, rate, + NSEC_PER_SEC); + ttc_pwm_set_counters(priv, pwm, period_cycles, duty_cycles); + + ttc_pwm_set_prescalar(priv, pwm, div, flag); + + if (state->enabled) + ttc_pwm_enable(priv, pwm); + else + ttc_pwm_disable(priv, pwm); + + return 0; +} + +static int ttc_pwm_get_state(struct pwm_chip *chip, + struct pwm_device *pwm, + struct pwm_state *state) +{ + struct ttc_pwm_priv *priv = xilinx_pwm_chip_to_priv(chip); + u32 value, pres_en, pres = 1; + unsigned long rate; + u64 tmp; + + value = ttc_pwm_ch_readl(priv, pwm->hwpwm, TTC_CNT_CNTRL); + + if (value & TTC_CNTR_CTRL_WAVE_POL) + state->polarity = PWM_POLARITY_NORMAL; + else + state->polarity = PWM_POLARITY_INVERSED; + + if (value & TTC_CNTR_CTRL_DIS) + state->enabled = false; + else + state->enabled = true; + + rate = priv->rate; + + pres_en = ttc_pwm_ch_readl(priv, pwm->hwpwm, TTC_CLK_CNTRL); + pres_en &= TTC_CLK_CNTRL_PS_EN; + + if (pres_en) { + pres = ttc_pwm_ch_readl(priv, pwm->hwpwm, TTC_CLK_CNTRL) & TTC_CLK_CNTRL_PSV; + pres >>= TTC_CNTR_CTRL_PRESCALE_SHIFT; + /* If prescale is enabled, the count rate is divided by 2^(pres + 1) */ + pres = BIT(pres + 1); + } + + tmp = ttc_pwm_ch_readl(priv, pwm->hwpwm, TTC_INTR_VAL); + tmp *= pres; + state->period = DIV64_U64_ROUND_UP(tmp * NSEC_PER_SEC, rate); + + tmp = ttc_pwm_ch_readl(priv, pwm->hwpwm, TTC_MATCH_CNT_VAL); + tmp *= pres; + state->duty_cycle = DIV64_U64_ROUND_UP(tmp * NSEC_PER_SEC, rate); + + return 0; +} + +static const struct pwm_ops ttc_pwm_ops = { + .apply = ttc_pwm_apply, + .get_state = ttc_pwm_get_state, + .owner = THIS_MODULE, +}; + +static int ttc_pwm_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + u32 pwm_cells, timer_width; + struct ttc_pwm_priv *priv; + int ret; + + /* + * If pwm-cells property is not present in TTC node, + * it would be treated as clocksource/clockevent + * device. + */ + ret = of_property_read_u32(np, "#pwm-cells", &pwm_cells); + if (ret == -EINVAL) + return -ENODEV; + + if (ret) + return dev_err_probe(dev, ret, "could not read #pwm-cells\n"); + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + + ret = of_property_read_u32(np, "timer-width", &timer_width); + if (ret) + timer_width = 16; + + priv->max = BIT(timer_width) - 1; + + priv->clk = devm_clk_get_enabled(dev, NULL); + if (IS_ERR(priv->clk)) + return dev_err_probe(dev, PTR_ERR(priv->clk), + "ERROR: timer input clock not found\n"); + + priv->rate = clk_get_rate(priv->clk); + + clk_rate_exclusive_get(priv->clk); + + priv->chip.dev = dev; + priv->chip.ops = &ttc_pwm_ops; + priv->chip.npwm = TTC_PWM_MAX_CH; + ret = pwmchip_add(&priv->chip); + if (ret) { + clk_rate_exclusive_put(priv->clk); + return dev_err_probe(dev, ret, "Could not register PWM chip\n"); + } + + platform_set_drvdata(pdev, priv); + + return 0; +} + +static void ttc_pwm_remove(struct platform_device *pdev) +{ + struct ttc_pwm_priv *priv = platform_get_drvdata(pdev); + + pwmchip_remove(&priv->chip); + clk_rate_exclusive_put(priv->clk); +} + +static const struct of_device_id __maybe_unused ttc_pwm_of_match[] = { + { .compatible = "cdns,ttc"}, + {}, +}; +MODULE_DEVICE_TABLE(of, ttc_pwm_of_match); + +static struct platform_driver ttc_pwm_driver = { + .probe = ttc_pwm_probe, + .remove_new = ttc_pwm_remove, + .driver = { + .name = "ttc-pwm", + .of_match_table = of_match_ptr(ttc_pwm_of_match), + }, +}; +module_platform_driver(ttc_pwm_driver); + +MODULE_AUTHOR("Mubin Sayyed "); +MODULE_DESCRIPTION("Cadence TTC PWM driver"); +MODULE_LICENSE("GPL");