From patchwork Mon Oct 25 18:06:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12582569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3C9DC433F5 for ; Mon, 25 Oct 2021 18:07:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73DF6601FF for ; Mon, 25 Oct 2021 18:07:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 73DF6601FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=seco.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=aX8huOEqtFqmnsCT+tSCE6zjerRn3hCZrTsDD8crN24=; b=uu8xcichzkHI9R Wi2FZMmH83DuGAl2j1h8TdwYI049pVu/2yuDjIGKUGREQcoQCCa7akBtJVOSWRcxvcJJ4/FPqmVyK zhIWhHgVNIZWY6Jook++tN7wFAyUTh6sgMGxA4x6tS/457wznCC4JOxkItCP+41WMoZVCqZ2npqnB OBSwtX23tNq/vHRzj8el5VKcP4slGgUDfEdztYKvWggsnsah2xDI+8eGmoQ1nLH7eWPR9R85T1EiT M3Ma9K409Pu+YcqSgeOm2N8kvjNPj0xUmdUqyg4ybnTS/EY9zdneavP99PuafZ+2v39xXl28elcj9 hdlxLO7yJYBJc92d8aKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mf4Mb-00HHkQ-7D; Mon, 25 Oct 2021 18:06:25 +0000 Received: from mail-eopbgr70087.outbound.protection.outlook.com ([40.107.7.87] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mf4MY-00HHjg-5y for linux-arm-kernel@lists.infradead.org; Mon, 25 Oct 2021 18:06:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MJB/spn90/bcaED957bXPn//sm0gcxEdJTouTBz/oyyJyFlgO6oDtb74TaP8EhNSafr3DoNcZcbC59Gco1Vf37WQT0b9g5wJWiRL1MrIgJzLdl3ikaRyoK/Bf6Hy0c4t/UFkWxfLIiq2nhN0q8GrsCaBm5l0cvKQbr7GReGDeFH5NY4zhSxDHBVbUPyNgAmkqtNmyaAUYt8b9O1q3TOxoSg/v5/wuZJ9MpncXHKxWavL9Y06fLYAeD2tthSdp9YFOLKQ+F1s0ht3kpYEznJcCHS9LZ1CYpQac3mAzO+m5ZqnmwzuRMZHH5Tv2d1si00gNE6XBD3wY6quS7RSEjzvoA== 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=FT7nABvr0awVz/BPsNd5qvSkD7NT1Hd45qJXEzS7Vug=; b=oK3NmhalEWrzzAqNFs778dSNVx4pgENLk73WX1N5xrYLbvCx/BEWd2n4YR05HILmjxULpHiaWsBMELXg39RDgiUwDgoMrVDMIWN+X5QzI/nZwy4SCyj2JDz9n1kiJx6SrY6PdymnVa1GSX3dHZlHxDARzqMISiQwlMw9E9Ar1XSGyHIq7QYGt8OU7RR7m7Z1sekiv9ZtywKUVajqrXHExWgOLC1nCYx2O/Ey0/XA/vdlcNA6ERHPWt5GrrA9PjXSy7ubnmi88bdHXTL420xspJmqU21FWzdeQB4ik8ACKzEP3zlpwCGQK4nXmPDOqryJ0R1fNOcY9kKbnX3ZIiEZbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FT7nABvr0awVz/BPsNd5qvSkD7NT1Hd45qJXEzS7Vug=; b=aGSRbMGr619LKj1qLk0gEDiL2zO52px7cmNQAtbDHoRkP8cIBj/MBEmGngi62ZqQonR9rjNWNQdK1UzFj/bfO/iac23hpAg9DzunW590Y92PzrE+uCPOW+Wy+WmkrbzrIVGx0A62ViAbW0y8ieBtAytcfi/IxXVbsZou7zWGRF8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) by DB6PR0302MB2823.eurprd03.prod.outlook.com (2603:10a6:4:af::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Mon, 25 Oct 2021 18:06:18 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf%6]) with mapi id 15.20.4628.020; Mon, 25 Oct 2021 18:06:17 +0000 From: Sean Anderson To: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, Thierry Reding Cc: Alvaro Gamez , Lee Jones , linux-kernel@vger.kernel.org, michal.simek@xilinx.com, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Sean Anderson , Rob Herring Subject: [PATCH v9 1/3] microblaze: timer: Remove unused properties Date: Mon, 25 Oct 2021 14:06:03 -0400 Message-Id: <20211025180605.252476-1-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: BLAPR03CA0036.namprd03.prod.outlook.com (2603:10b6:208:32d::11) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 Received: from plantagenet.inhand.com (50.195.82.171) by BLAPR03CA0036.namprd03.prod.outlook.com (2603:10b6:208:32d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 18:06:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf6fb383-6396-4e45-7f5e-08d997e2243f X-MS-TrafficTypeDiagnostic: DB6PR0302MB2823: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /jwo+1wR1pdW9WloeHgoeUlc/qF4k56ov/Km52xpR6sXpsMU8bE95fuwnUaLoK6lb+OrysUPFGanigaTR/l/lnJpkb3G713z+5ySVa5cAzYbtqpIjPIRLvX1FiAIMlng/TLbovrh3hm42sxKANfKC2a6+nITfarvqfUlMS7Du+uOKrzz5tvPWpy0hw8ZmugCBOjnZlhGob6i9ecJK24bPA8FUmgrqj6GUBztajDgbT2J6JswIFH3A4MG/ZFN0sNmkDI1vMip0noyKrsf8EgxF17U+gVckLfJkihf9b9YNhuNR5d7E441H7QZkF/h8E+TbLDcGgmq5QbMxjpC/Ynt5Uz41xxGyQ/eKOWFZdwNnMHM8Emegrln/o8UaNkGWaJI1CDiuwdKwULhCxpnMpf5h2J1ECKfperjzso66MGV1md0l1PpIw54maQALZ4FmqFwSUJ+Gt7+TnQZmg2ftm1O0JfZ7wOAWlWWT2NZJy7Z0P+dmEMMmhnRnMOHU4eXuu56FGf0E9GRtqD9tQk112KCYCM/3gm6khjDf1I7dWQPA6Sdzh4koHJoPYvnMKJXDCx4BxrHjCmLwbDfZrZsgI+k3suHGUsedeQLaOkm9EmPRtKc1SWD5s1dYkA5PT/dSO9cLLLVJefT5bCsGc6XL1AMEneQBLtPPH+HwL1MZqGybT7ZtV/3bPW5K0QaV5M9P31/rLuJirlu/jGHHmkJRrlxAQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR03MB4523.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(4326008)(6486002)(6666004)(54906003)(4744005)(7416002)(2616005)(44832011)(956004)(5660300002)(83380400001)(508600001)(2906002)(6916009)(6506007)(316002)(1076003)(36756003)(66476007)(8936002)(66556008)(38350700002)(186003)(38100700002)(6512007)(66946007)(86362001)(52116002)(8676002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gRpjntArHjgMWpwJMCLJF+M8TTkLb8VJr/hrstEt0guZlksrKMwLgFqTVk02ACK6P1a3jTlcM/FBLoHSvU/DEP4H5iAoaDks8erlOXrcH7/wBKWAYuSBYz7R+UXVWFlpCs7JqLNQaFI7S0IJGBRh+5TKPJdby1IXpA4CtiRnbmHYObLYfuY1OhrKvKQCUkEYrX3jHhS0mZdp6qkZze64F+ESvVi+IrFaluPCiCTAo+nMIdsxs+K5AFG4Ix4jb66njvEjSxGWIcH7M+icSvee2joS+P6w3aCZnw4s/nYk0OUIiAkGSidelb3YSbcI8c4UM3drkBTNYhV+/kmYpASGmeXX3YmfaPtoHtBSiWHDPjU8hE6+OMcmyz8Ecv1hq1gbrPqj4VSwxujBcKqjaBC1sx3OEHb4sDbNIerFg7++/gPR9Ww7skRRdmiolpNzwSTHtMyurGnl9iwU9uAb9OFzJXZT6wFuGYQll4MfQBHf9z7KATboEpw1OYSrekk7/aisccFuBRNRBVJJA4NbhR9IpBaFRuDC64SUXSs/SrSHfGC9vaC6TfYxHv1ErjmPGQo4WpzeFq/S/k6oPD1xq2CAJYg57b+lDVdIcbVbedahFiOSMGyBEO3eLimm4BRyK2ob21qMSSttOwi/2T2/S3SfJwRLtvD2hmkQZkBOAWGo4zsTvysa/tIPDNUwbxOyjGV8taRfAB9lEHE5QmmchP6tt6lfVAAAfObGS9eQgITdLtwAjc6AFctVLli3fz38l5Bvz/j99L8z/pNADCFOnCWdDvn94uDLXamsijjpihTwr0ozav8m4Cr9kXIb1aWj4TbJ6AqdJlkyCJHC4+CCJhyKpCHelSAAHWVHz3mVw/ol900A2U5nZFNq1lGSdWpjqhxSBui6FBQjlVwCTPu5OeLbhOGz3OlbaCUHwHoQzSc2z+Yy/zTL7TC8I24gD4Gq4HTMP3DmtlEfULZvthccB8vWYPoJGdgS+wBTncIfPCtOOUs6drByQh2L60GhUy/5V3SI852dBJXjPEvkFxvj8Hit9/bgH1enYVb6f/qsZU5UBemt9iWI0RAbkTiwtjK570ZLxw3716ErXfu3xG6qNhiDESDo74pbadMcREuuGUyc5CVwP33ivciIo5GO4WEKZfBX3coOf8bosB6PnIIWKhfn3B8zvThGBuyPXmwBAYNjgksN07fi8XIEWtjfDBfG26jN5jSMit5aoIsp0Dvr+52LjtlGO8QPWVEP6zSWtuKoFuhI6V3U6RwIGjiBg9nfG4y0StHyGQxPZuHS8LZwx2K01unz/kWF4NT51kGcncuU5LxFtfUtVuyYkBTBGwibIK3DGDoCm/3E7VRhl546gJvBFUD/WWgyeRDd/Pyv2+VDHDUtyvn7xqa+FGqOS/usQHHbt+/75FCtTVxZTgJmt9bEZ+E3bVy7MsdqlBJGlcIameGqHDI7Z8RsmYDDQIeXu/iOSTnNoV1SnSzTqKcaOe9tOcXybOli719S0dI13Ev97glFpoWxsZDfFhqfcNYnERsyS5NPbJq9GAEBIwVzrRas41lXB8KB8SJi61lQd1Kd8wUN/XIpusoXaHwR0UsYX6PrAqeULfUpAQtOeZ8xSLcXQ2DwTHBzkq1i50TVY1hJcFQ= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf6fb383-6396-4e45-7f5e-08d997e2243f X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 18:06:17.8298 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7P/rhBBEdvvNTMjOrZocHpNAmhSfaES9FAqE1SxxEVBO28zi/jSxiI7EFOPEtNGVBS9EZHgfOuChNv2k6LLopw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0302MB2823 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211025_110622_248964_271CDC09 X-CRM114-Status: UNSURE ( 7.87 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This removes properties not used by either the PWM or timer drivers. This lets us set additionalProperties: false. Signed-off-by: Sean Anderson Acked-by: Michal Simek --- (no changes since v8) Changes in v8: - Remove additional properties from microblaze device tree arch/microblaze/boot/dts/system.dts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/arch/microblaze/boot/dts/system.dts b/arch/microblaze/boot/dts/system.dts index b7ee1056779e..22252451ec09 100644 --- a/arch/microblaze/boot/dts/system.dts +++ b/arch/microblaze/boot/dts/system.dts @@ -347,12 +347,7 @@ xps_timer_1: timer@83c00000 { interrupts = < 3 2 >; reg = < 0x83c00000 0x10000 >; xlnx,count-width = <0x20>; - xlnx,family = "virtex5"; - xlnx,gen0-assert = <0x1>; - xlnx,gen1-assert = <0x1>; xlnx,one-timer-only = <0x0>; - xlnx,trig0-assert = <0x1>; - xlnx,trig1-assert = <0x1>; } ; } ; } ; From patchwork Mon Oct 25 18:06:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12582571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3130BC433EF for ; Mon, 25 Oct 2021 18:07:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DB70F60F46 for ; Mon, 25 Oct 2021 18:07:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DB70F60F46 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=seco.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=q906Scrl22an8icXe3sbloMj0nMcYdE6vz4LZuBeKRg=; b=sQ3d+7tNYaoWqQ PeOeMB/hdDn2cBYVS0UoaE6qzeaeTqRe6YsxqTkGbPLbyxaKBCjQhJRv7u74XFoTPyJkicmlvU0rU 2q9PWbRzF0iPekcmtBs7ha255bxWpbLNPSj7HljcStBg5WnIuAnbCjMvZgC5c1iOdcFctWFjibdwO xoCzrOuzbITEkXd55PUQjTnaS2WeaGEx54xjcQ+RCzGMM09ZA5A/Gdq/ZfbPXqxMh57oYYTEFOSF/ wbO8RbXT6ds6C+uEEu17uFSnwfH47L66D9dq59YthLA2FK0doxUgs41Hp1snoQRk851h00tQKR+Hp ArJCkEprwmuEHAxVQvdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mf4Mm-00HHmm-1b; Mon, 25 Oct 2021 18:06:36 +0000 Received: from mail-eopbgr70087.outbound.protection.outlook.com ([40.107.7.87] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mf4MZ-00HHjg-Vq for linux-arm-kernel@lists.infradead.org; Mon, 25 Oct 2021 18:06:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kax4IbwjuTx9+1ikEXYwL8DF9QaigN8IwYBamCT4zg8WAIo1kFFHI9bkNn1fruGjzqsQsb4jKlh+E6MYS2qSSajAyymjWx8BE/pBIJ4qzjU/qTA1g6LLTUnlZvaNgMRnr3A1hNSsMX74G9UcNBmxtMycD7JglQQn0c3BLMa2xPNRqbW+fGvOI4/G6n9qC7UGFz2PiyjsknZfyOmBGz8QWDqlFnwAkRcvBqbUxsTnolEGtjW8vAyNsM4avU5t2IAXIOOk6WYaaiWffkCN+k7CoQ2rmdbvd9wT2Wd4ght2dtEAOxQ2vqKR4tW4MO75Hh+KaVOn9hqc1qIDkmtN1cnLGQ== 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=5K6zQeSq3sQcrKCaApSUoICBfsJi/RsiIe4H2tEgccw=; b=h7gltaICtLVq+vgX+41/ZXhYSjqFW7l5ZPaqshYVPoth0nzoKZhshWZqJc5ZEjy0SETHzQC12OEnLErMQQ3AtHWlwmgUjkNuwax05S7B0A9PZEJ7GdSg8vksSr5ShCObTM7Yt1vGmRsWg9O4gsBht/FMJraMrMwvZlvWGAuRy5RUuA+Gd1zCf6CBJ0iOG4U7ikHr8KStOmuh0IOer6GCT3Em1w1hWK3uMPumN5ixVWQJCsDxWy2csEr1THBpy7JnvOxwkUcjALma1KJoBmRbGAhj2t4U3P6I0Fo5Opt/3cBgNphCL/MoZdCONG/S0JDyFQk+bvtHQLmMyu0aEh6Dmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5K6zQeSq3sQcrKCaApSUoICBfsJi/RsiIe4H2tEgccw=; b=HBbTadaXGtvysgCnF4qWzYd8exqQdZ+7fwSVe/dxJk/zShslJLotzzk/8vmoQ4HvWRPbgexm2T2AcSWiq8N8UXo5E6rPqaS7YT2740Axm2S2i7kGG3oq9xhazvsNB4KYWrmhX36P65ns7AsrCOBxcSkPb1VKARAY05wO9Hbqgck= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) by DB6PR0302MB2823.eurprd03.prod.outlook.com (2603:10a6:4:af::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Mon, 25 Oct 2021 18:06:20 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf%6]) with mapi id 15.20.4628.020; Mon, 25 Oct 2021 18:06:20 +0000 From: Sean Anderson To: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, Thierry Reding Cc: Alvaro Gamez , Lee Jones , linux-kernel@vger.kernel.org, michal.simek@xilinx.com, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Sean Anderson , Rob Herring Subject: [PATCH v9 2/3] dt-bindings: pwm: Add Xilinx AXI Timer Date: Mon, 25 Oct 2021 14:06:04 -0400 Message-Id: <20211025180605.252476-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211025180605.252476-1-sean.anderson@seco.com> References: <20211025180605.252476-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0036.namprd03.prod.outlook.com (2603:10b6:208:32d::11) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 Received: from plantagenet.inhand.com (50.195.82.171) by BLAPR03CA0036.namprd03.prod.outlook.com (2603:10b6:208:32d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 18:06:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6fa8ba43-5d49-4476-ba71-08d997e22593 X-MS-TrafficTypeDiagnostic: DB6PR0302MB2823: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4jajTX74m5loCPjPI8eScWFDOd74Se/oZX2j/CBu9AYDUqToYV7ZYXd/P8g8NhboutHlbESErhZwm7VQFpUXvAE5Dwog39FGIyaonANKEU0y5u9Z4+5GH616F2gWk0AgmTteI0wAPVMydvCZ+Xw4HnOKB3H8+Fx3OV//mrUNziGL5384tjopLonIK2NyWl0u8DGDa6NpeT6rip+E2xbM8e6sEDCMZ34948TLhEdql7LEtOw/SoM8arQPgoUNHc/ZeGiMSlvqd/SWDiHOyyOU9BQwAcKp5V0L72jPnlz9/g26aCTP4BWMvWt0dSZoaN3dfJvfNZhdjCif/o0hti5T5oas0r3N6AFNDkZoPJJeHlzM3sNPHylk+3uv0/kSnp+u06GLQbTuCf+TBfJ1LGXwt0K2NDiTGgzMGowjTQz+X6cDxyJLJUoBsjNDecOaKmAi/unJGQuRZl5FnCsjMBm2qrBHvm6j6OkEnptmuB0sM1RrKttI4PVFqgwXcpM/BQMaZrxKiM9W01zWnFzVEeGOOsVFo9XmaVKGLEJKWFrSMIlz7/IO4BuG+A9lYXZxUddwjwQpuQvsU2BZRKGANF3LMPrFSpq7EV3SnJ8r3E6QoEQMHwODw56v4gscJb/AUUpRJXHi6FFl4wno5WmoZ8yqvTemrYS7w4B9IBW06wr7oU5ht8Vsxy0pCh41TS7stjecqKGDEtzbIxyjuFU7cowHV1sboq6RQJ+bl+cveLdsTeVCpEt1hPTmu9oLQNUV5SXWnWc0fFgb/ASLYzBuVE+Ui7mjEB49jLabAio1hhtlhvg= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR03MB4523.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(4326008)(6486002)(6666004)(54906003)(7416002)(2616005)(44832011)(956004)(5660300002)(83380400001)(508600001)(2906002)(6916009)(6506007)(316002)(1076003)(36756003)(66476007)(8936002)(66556008)(38350700002)(186003)(38100700002)(6512007)(66946007)(86362001)(52116002)(966005)(8676002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GxEhVOcNjdVz41sZhaMMXwyz4ng+hc8x/pnEaWzCgyXR+ryJ3xw91RxMHjEyZXNA81PQzIJRIRUhMkeotD4ecNWvRqF073mCD5QfR6imLHroLPtYhdW8ZBAMcz2exj36FrGK2U+RjOfnr4S8O4+fgw7h4zHi5DWtGNAyZnn/39oS68sCkAnjB9lktkZ5z9mlV9JDjZRy+ynzigiw445CT0XjxzLVZvZSGoRtif89+Q0LyYjbexi6SBuDwmYpMGi4V2fDDH+9ePehue6lMgrf12SjoUSHJCAtoh6s5WbR57aubgulKr2TS1Umgiv6yXId6azegwdV8DpZVHxV//obe1rzB3AO854Ik7T+gCJQ8Ij0Mfa0g4es97tiZr6XKQjZFGmcMvA603ea0rB3l0ZXiClzPkOjnhzM1g2SLFX/TJ+zRa9GGN5av38M4vSUTQFHpCNIWp1oZWz24ZakxVqtTyrfoVaCbzHnBnsbxFmG3dK27kPIPH4GsMVhq4/JQqpcgSnxjduEm3lb5a64f8met4igtLbzwT/fj9EJzPPO7GUapbAcBpHkQTh1JG/2QI4qsx4q8t4l0DwLrOSTrmRsLJ5nUV85pjGdi4g8oDNivlVXjetkIeFojoppUvrCvTv/ABfQN4tIcL8HIuDov/SzwtwjJfebRHdj68O/P05MLS5l9GKwtWU8P8d22/eZVzSmLOQfQVmTP3fTeQpFBhqVpn3ZrrAE9oqdQC0KF/CKB4kVEwvyC+8887xBnclYQ7q9k/cEsfTlhrCxp6ET6aVhctne4ODJ4jrrFOHGHsZtCjdvcmsWOQ8brhYOm1oTxeixuEYTFuvRzFs+mIxrUS7kjo+ERuhlp3ZDcPR+rLM49ANlS4qQQFaX2xHruyjDghMTuqC3aT7jNiMgcgCjtLZbxPjT9C+KVs5gTAWsAIFMymxaKS7xe1hV36Fqr9HuQ8JMeQripkI1dlm5DH9ahO4zOXwnLooN/qUtKvbvcqXakw1g0wQWcEkRTiZGTIBq48UzMnIUGDclu0TtEeHoddWxANHv9ycIoT0Z+NV0DoHKqA7gVhYHnZzdfi7mRS/fcXIugdZe0jFRoLykoRY8XBBf5LwCdXc5jJm5CeFmJYtjOgRWTQ9O3AW9ngip+QBuewudPKI+4t/SjrLoFADW0M3YM4R+S+lHLRtbhieXhrJcS0DJ4M3TRQEEOLUTKWREoD2YKk7QpGH7jozd6NBqBqPm/nSLl++J8524tnaU8R3eam91+nG+QJWKKbwcLUkZuyaiQIE5MB/dQh5Ah+1AV1grO4pgS8rY9ch+PFqEQrQrljrm9CtQVg4j3MPLaKh/9ENm5fL600SPdE/21uwZxEITLk/B4+fuK7IvNe1pExxiP2fE4lkm3MpMyy0Op8V8h5XrTbL8sPizcyuRh+/L7g4AtKPwZD9THKRISMPQumzT3it1F0gCQIVAX5PBKhjL/iTaiQ3Ara6PhTOnkHbCwaZ2I9p//8kZFd0FZo/+JCRQcp5iNj2ggLgWhm0G6eBirtw+1sOiE/qg4TSrNJAGn/u4DCbfa3rVKYuz5ZB8430hD3ETx6+sg/OhI45x6REn61HbjzdvjRFqiofANoo5HVutjMScAKXPtK8uqUZnBskBAPM= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6fa8ba43-5d49-4476-ba71-08d997e22593 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 18:06:19.9386 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aMDrej3ZfDdeL+dhHL3Nq25ikLCOEiGqGPtJ47Y0YrizU8Yj2d9/mux/lliZebKDKwO1ZKc7iggEuwfqCHqQlA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0302MB2823 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211025_110624_054912_46845114 X-CRM114-Status: GOOD ( 19.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds a binding for the Xilinx LogiCORE IP AXI Timer. This device is a "soft" block, so it has some parameters which would not be configurable in most hardware. This binding is usually automatically generated by Xilinx's tools, so the names and values of some properties should be kept as they are, if possible. In addition, this binding is already in the kernel at arch/microblaze/boot/dts/system.dts, and in user software such as QEMU. The existing driver uses the clock-frequency property, or alternatively the /cpus/timebase-frequency property as its frequency input. Because these properties are deprecated, they have not been included with this schema. All new bindings should use the clocks/clock-names properties to specify the parent clock. Because we need to init timer devices so early in boot, we determine if we should use the PWM driver or the clocksource/clockevent driver by the presence/absence, respectively, of #pwm-cells. Because both counters are used by the PWM, there is no need for a separate property specifying which counters are to be used for the PWM. Signed-off-by: Sean Anderson Reviewed-by: Rob Herring --- (no changes since v8) Changes in v8: - Set additionalProperties: false Changes in v7: - Add #pwm-cells to properties - Document why additionalProperties is true Changes in v6: - Enumerate possible counter widths - Fix incorrect schema id Changes in v5: - Add example for timer binding - Fix indentation lint - Move schema into the timer directory - Remove xlnx,axi-timer-2.0 compatible string - Update commit message to reflect revisions Changes in v4: - Make some properties optional for clocksource drivers - Predicate PWM driver on the presence of #pwm-cells - Remove references to generate polarity so this can get merged Changes in v3: - Add an example with non-deprecated properties only. - Add xlnx,pwm and xlnx,gen?-active-low properties. - Make newer replacement properties mutually-exclusive with what they replace - Mark all boolean-as-int properties as deprecated Changes in v2: - Use 32-bit addresses for example binding .../bindings/timer/xlnx,xps-timer.yaml | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/xlnx,xps-timer.yaml diff --git a/Documentation/devicetree/bindings/timer/xlnx,xps-timer.yaml b/Documentation/devicetree/bindings/timer/xlnx,xps-timer.yaml new file mode 100644 index 000000000000..dd168d41d2e0 --- /dev/null +++ b/Documentation/devicetree/bindings/timer/xlnx,xps-timer.yaml @@ -0,0 +1,92 @@ +# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/timer/xlnx,xps-timer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Xilinx LogiCORE IP AXI Timer Device Tree Binding + +maintainers: + - Sean Anderson + +properties: + compatible: + contains: + const: xlnx,xps-timer-1.00.a + + clocks: + maxItems: 1 + + clock-names: + const: s_axi_aclk + + interrupts: + maxItems: 1 + + reg: + maxItems: 1 + + '#pwm-cells': true + + xlnx,count-width: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [8, 16, 32] + default: 32 + description: + The width of the counter(s), in bits. + + xlnx,one-timer-only: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [ 0, 1 ] + description: + Whether only one timer is present in this block. + +required: + - compatible + - reg + - xlnx,one-timer-only + +allOf: + - if: + required: + - '#pwm-cells' + then: + allOf: + - required: + - clocks + - properties: + xlnx,one-timer-only: + const: 0 + else: + required: + - interrupts + - if: + required: + - clocks + then: + required: + - clock-names + +additionalProperties: false + +examples: + - | + timer@800e0000 { + clock-names = "s_axi_aclk"; + clocks = <&zynqmp_clk 71>; + compatible = "xlnx,xps-timer-1.00.a"; + reg = <0x800e0000 0x10000>; + interrupts = <0 39 2>; + xlnx,count-width = <16>; + xlnx,one-timer-only = <0x0>; + }; + + timer@800f0000 { + #pwm-cells = <0>; + clock-names = "s_axi_aclk"; + clocks = <&zynqmp_clk 71>; + compatible = "xlnx,xps-timer-1.00.a"; + reg = <0x800e0000 0x10000>; + xlnx,count-width = <32>; + xlnx,one-timer-only = <0x0>; + }; From patchwork Mon Oct 25 18:06:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12582583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24280C433EF for ; Mon, 25 Oct 2021 18:08:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF6B860F46 for ; Mon, 25 Oct 2021 18:08:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DF6B860F46 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=seco.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/N3GH2TLoO4hKYHiiJkc7X9XrSBryXaCUcmAdWPeYZE=; b=xiyc7fNzCuqlRF 5JmEYgHa60i7aXxY83cV8ujZFomSg5Xkz7KVfqUWmXU11m4cipl2BRJiPXY2gQdC9ZtJ/hKvB5Nzp nZvkxnMTMEmGydWBZ8OcUz9NAuFO0CFb9KbgPoas4HPDkClScciAUpZLKAKytGnlSNG2bscvS1K9X 6/Acj1FZ3kSgTnl4j5gBR5Mt78kJmSXHLNymWuSpLqpCqfPuYI0ReKJ3nB2gzV4Nj5Pi4DAjZR1F7 yW9/kl/89509+bWXU44QzFHNP0kinbg9N74dkjwT8HKJ/VBaVkSA3mr2ey9lYTcI6iK1cfuRqValp 7e44Du+PnydZ+4wG2OOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mf4Mw-00HHp6-VX; Mon, 25 Oct 2021 18:06:47 +0000 Received: from mail-eopbgr70087.outbound.protection.outlook.com ([40.107.7.87] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mf4Mc-00HHjg-8g for linux-arm-kernel@lists.infradead.org; Mon, 25 Oct 2021 18:06:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BiUBvUK1U++XkRmGfQrJk5ehNtmvAsGxTEDWgZtYXFdrrQV+UPVeXZ6IDKtXM4OpPWMfLPyhX0t/KU6F4KpoWQTWVkdB4C95/MegjfLyMG8l0hU+W1+JriP56EGyEDScLuATQHcSAMA8nrpfxb99FGVanvIH4x9RVsTRACHQwrl6KdKWm+0yhSwEWrmLB3rPekHqGyWAm+3vTJqsnWcxLTM8Eb5IzsWiSwBdgBfw4BwxKrvRxgiZUS4Jgk1EaE7SCFVMaU0GCi3ZzNTxJSEQsl1Hqf2+cYOQ2G4cCLf/e8Kn8L2xMoFVUq/qBcplRBrtvgkAHOlKgXG+it9EGdiJQA== 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=spUM5s6nxVjKztS+n6VWlowtATDvPT1YSncx/oXqEJA=; b=l4dVlo4CnMQszo9Bn3ub/vlbkhfkO2+cShIBZqkXpKmO0UCnJo1HBYyj40w3l6Yc8/opNuHr0aBnAVwAKogdUt0fi7zAODjWIBIYcdINA43uDpGmxDWeiUUii5YGAkt0LTJEt9uMzXO1cjrnGdZoV7Lk06Am5aDvXgwe95ezyVdnAHoIfujSrTrD05ovJG8U+58owCpWqjtga+bJXbMT79EWQIpgYUH42v768grFh9V9KfgkBQmE2e579dsuoaJSkvvnfurxJ1FFru+5WLpUC4K7EqsF+GbRVUsjtz5zdwBvplqXiiCa6lT2GbvJEMjc61QX9ISI4fS3b38nAI65zA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=spUM5s6nxVjKztS+n6VWlowtATDvPT1YSncx/oXqEJA=; b=ILZ4recRuhVgGRjF9qaYmuZTwUwovx2KBQ6M7biOQGhEZFaMZyYuI56Q1512DNGEt3c8jx9PjxaxPHqF306YH7+t4rIm3EyH43c9Mf/tge2DiUugvyN+S+eozTA7qWW48VReGghvbZ9Qe63qrVsuODNhnN36N4eyJ2S38BfIoW0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) by DB6PR0302MB2823.eurprd03.prod.outlook.com (2603:10a6:4:af::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Mon, 25 Oct 2021 18:06:22 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::a9aa:f363:66e:fadf%6]) with mapi id 15.20.4628.020; Mon, 25 Oct 2021 18:06:22 +0000 From: Sean Anderson To: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, Thierry Reding Cc: Alvaro Gamez , Lee Jones , linux-kernel@vger.kernel.org, michal.simek@xilinx.com, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Sean Anderson Subject: [PATCH v9 3/3] pwm: Add support for Xilinx AXI Timer Date: Mon, 25 Oct 2021 14:06:05 -0400 Message-Id: <20211025180605.252476-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211025180605.252476-1-sean.anderson@seco.com> References: <20211025180605.252476-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0036.namprd03.prod.outlook.com (2603:10b6:208:32d::11) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 Received: from plantagenet.inhand.com (50.195.82.171) by BLAPR03CA0036.namprd03.prod.outlook.com (2603:10b6:208:32d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 18:06:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 137c71a9-7157-4243-64c3-08d997e226bf X-MS-TrafficTypeDiagnostic: DB6PR0302MB2823: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8MbV4n++NYqKqI4xc2+0pj5qI2bmD5Mw7fu+pmFVJYbCQmxcUUKV0CMAlI2T5pMd6xRRJb8k6GBkQ6aYUh7/J9RA+9f1fzuSWCVNRNLlMoLZIdNqiJR7xecL7m1dJl0ywxNtyMTLnVu/SgWBpeFPKAT44OlXgA3OpMneqfhFi597MMHJsQPsuaMo7O0bK+xNAY16BJJ+02VX4oTMa4f6QRHHhSVxEjpQ6yN1HvqeioiGyuCgSQHliNTaxO3q6aRfhaNQRzIAJabUYIYKbplR9ExndB712+9BrgpkpjKOzejb8kiY8CXlNBXjAC7crH8nAunbp31KJDo/WC/J42HhdzdSo5LV3ZxIdesHfmnRjXM6sylxlMZdrfUdBmz4a7NsqScZaKyvpZW1lItHrqgyWm/uZqwcc37qCL5RkLGKWAJLOrCj/8lXYdjeSlmFreV7yL0aD9T+Zdt/pdgsjYyuGBNLOQ1DIKrjnlyHxT5LXNyrBrjVUlqpMt3MCHoZ27ZTdoRHWyjpkEOEmD2wRq8VhfdMb2QRAk09BajlSYjK4EpHBoV28XpcX/ruiX+YV8fQSeGpwFrowEUaoYjEeDdIG4bqi9nWzexbRkwpBkgSSUHiLxb/dV5H/vswv7DN/RIKO4hJSN2U5FNFqR7OewwQAdtm7pbgCqtmN72UYa0Jm6gWaeE9O+Ep9nhR6HtFtP57rSC9JtYEGmUyOM5WtCEC+Mo2vCHydZWX5CLJ58n6SIgmvzEPWqNjbts0kriPvgSpSJO/0UTOpGlZBzPeu53tmrX7zEIi9DuaqHGjROn+e7A= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR03MB4523.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(4326008)(6486002)(6666004)(54906003)(30864003)(107886003)(2616005)(44832011)(956004)(5660300002)(83380400001)(508600001)(2906002)(6916009)(6506007)(316002)(1076003)(36756003)(66476007)(8936002)(66556008)(38350700002)(186003)(38100700002)(6512007)(66946007)(86362001)(52116002)(966005)(8676002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7ax69UfckwmEwowFYokSrNXPb5Fa?= =?utf-8?q?0aRLgFxHG8/DTMGPMfnbHQ/kOOWEKDVjBHf6YaGHBP22d+pYFnKJpEBvOwMm6ZRg7?= =?utf-8?q?FS6+RdP/WS+jygKtVdpmKVe33ax/R1Gws14n7rURcljnja9vs5OOuJw56wdBX+VJq?= =?utf-8?q?n1PqVfp1v44JgJAZAWEss3OZkHnYWpIC487iuBTy5kvZ8QzSvmrKqtHYRYd3VHeAj?= =?utf-8?q?Sb3X+E1IBRcqvAmUVieDtoe2lURE6HzkTxF+AcU+cJodBrqGdzdauIKL420GlIdeE?= =?utf-8?q?SSq+opBP3X9FhYSaNvpbZ2GVo9IOJPtfksmMyqOVAv0IrQzOTIBhJoEd7s7kXnh5G?= =?utf-8?q?QzIx6jZjQDv15+B52Xf+x6rQh0OmMeSqxBjeW04RSiKbRcrwKfNZStWvHvEvRMg86?= =?utf-8?q?+bfYDPqymtLqB22FVFk75BoWGkIkA3Ux68n6fNRBvSWp3JkPeQdNjwZezZupd9h+Z?= =?utf-8?q?R6h9sE9NR7WkyrspzIQpeLDcw7NDg/O5Jl1NIWfrwoKy3/zoCeR4dnjVUQUA2tTE0?= =?utf-8?q?Pw6Ccd275a2xoPAKEkgOBm6EICWkfD5Q2yzZ6fPXG3sr2Vwk7yHDmQI1/ErVRGO+I?= =?utf-8?q?o2KS5BYxZ1k5QyUm7nnTy85CvI++b/EOmKvaCHRPFQR69+9zkS1MnsIEGNzGjv6a2?= =?utf-8?q?IxYM/91P8YZxzTsrU6lvXW3WjEKQIQD70gw6oxJDkB7g3HZY/ViUcvDp8BOpZaA73?= =?utf-8?q?IeSB4xaReQMZVJ1JBWvRp0TBEmB5DtwjpFf8ucCr7HhNJHdZIMdpp6SoD4lmdhfST?= =?utf-8?q?2ieaqspl6K6HE/BVAGD87sH5h9v3y2dQKLzWsAQMk/0EtxXGxW3KtpxYr0ZdzObrI?= =?utf-8?q?yA/L4zKf+BkNKr4uJNTLlQ3aBcyW7VHSG8zi1pVtgVDdIM/cCGRgoQiblVZqcATE9?= =?utf-8?q?WhKISe9BR7TUARR9sPCTGkxz23fZ7MBBekCl9mqT58nC58Dy5HcmsurvfBiZAIACW?= =?utf-8?q?7P2pLlzz1n0o7nRJcfxt1diitrgPFY7DntMw3EElC3p2+YoVfI2wATeQSKNzsR8Zj?= =?utf-8?q?I1LSY7HTeNqhoFytAonHP+Eb+A7R2smc5FDlbTHJvC+AZRGG/PAxIT3D5p/MwAn0Q?= =?utf-8?q?vUkQ0bSw7EkUJgJtZDPfzlVDAdPR0c8A4pe2IiBEMJeg38FaklkEqrHrop7AohFA4?= =?utf-8?q?MTsmuHxUmn8Oail9LukoPagA1ATcH2CoUdkQOwpMhXDlOuNHCPrIVdZzVnIL7vc4U?= =?utf-8?q?EK0g3/EI5fd5ArVuTX9kTKyEIJyxB8wRXn64MxZP6IQW7+VirGZnXlV97SNTrFIF/?= =?utf-8?q?A4xH9kizK8uDe+hOaBT46JeAfuEFM9ouC3pl1Z5Ico6hSFn1CqsyE444FM33NUnzB?= =?utf-8?q?VV8SCkUmLhsZYpFzmefqC2a88URWHdzuGq8mjNYsc6FGWNNh4LCX4YqekfA6Xibl4?= =?utf-8?q?hMoMOPBFZWWBm/ziUhV35CG+lpqEkrougtZzfa7pkRsml0uXB9+EvpKIh5nCu+x/H?= =?utf-8?q?8a2zIwdibG+j5IGDL3fVGizdBWvEqz5ytI0/YmF6xaH40RKdABhdbNBoFon2ce75S?= =?utf-8?q?LfUS0sXFt6yBT8Eabt0VOOn51gbwbXlT6E5ij9/ZxXj/zJruhQ/CXO8=3D?= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 137c71a9-7157-4243-64c3-08d997e226bf X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 18:06:21.9315 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zVaOJD1+LXt/SWrlenSzTYepwX8etFaRsVp+jn/NwgXALUmjjUJepH+5jr9BEtXlPhgYkaamRfFLftssIRfP1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0302MB2823 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211025_110626_366699_961E2DE5 X-CRM114-Status: GOOD ( 38.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds PWM support for Xilinx LogiCORE IP AXI soft timers commonly found on Xilinx FPGAs. At the moment clock control is very basic: we just enable the clock during probe and pin the frequency. In the future, someone could add support for disabling the clock when not in use. Some common code has been specially demarcated. While currently only used by the PWM driver, it is anticipated that it may be split off in the future to be used by the timer driver as well. This driver was written with reference to Xilinx DS764 for v1.03.a [1]. [1] https://www.xilinx.com/support/documentation/ip_documentation/axi_timer/v1_03_a/axi_timer_ds764.pdf Signed-off-by: Sean Anderson Reported-by: kernel test robot --- Changes in v9: - Refactor "if { return } else if { }" to "if { return } if { }" - Remove drivers/clocksource/timer-xilinx-common.c from MAINTAINERS - Remove xilinx_timer_common_init and integrate it into xilinx_timer_probe Changes in v8: - Drop new timer driver; it has been deferred for future series Changes in v7: - Add dependency on OF_ADDRESS - Fix period_cycles calculation - Fix typo in limitations Changes in v6: - Capitalize error messages - Don't disable regmap locking to allow inspection of registers via debugfs - Prevent overflow when calculating period_cycles - Remove enabled variable from xilinx_pwm_apply - Swap order of period_cycle range comparisons Changes in v5: - Allow non-zero #pwm-cells - Correctly set duty_cycle in get_state when TLR0=TLR1 - Elaborate on limitation section - Perform some additional checks/rounding in apply_state - Remove xlnx,axi-timer-2.0 compatible string - Rework duty-cycle and period calculations with feedback from Uwe - Switch to regmap to abstract endianness issues - Use more verbose error messages Changes in v4: - Don't use volatile in read/write replacements. Some arches have it and some don't. - Put common timer properties into their own struct to better reuse code. - Remove references to properties which are not good enough for Linux. Changes in v3: - Add clockevent and clocksource support - Remove old microblaze driver - Rewrite probe to only use a device_node, since timers may need to be initialized before we have proper devices. This does bloat the code a bit since we can no longer rely on helpers such as dev_err_probe. We also cannot rely on device resources being free'd on failure, so we must free them manually. - We now access registers through xilinx_timer_(read|write). This allows us to deal with endianness issues, as originally seen in the microblaze driver. CAVEAT EMPTOR: I have not tested this on big-endian! Changes in v2: - Add comment describing device - Add comment explaining why we depend on !MICROBLAZE - Add dependencies on COMMON_CLK and HAS_IOMEM - Cast dividends to u64 to avoid overflow - Check for over- and underflow when calculating TLR - Check range of xlnx,count-width - Don't compile this module by default for arm64 - Don't set pwmchip.base to -1 - Ensure the clock is always running when the pwm is registered - Remove debugfs file :l - Rename TCSR_(SET|CLEAR) to TCSR_RUN_(SET|CLEAR) - Report errors with dev_error_probe - Set xilinx_pwm_ops.owner - Use NSEC_TO_SEC instead of defining our own - Use TCSR_RUN_MASK to check if the PWM is enabled, as suggested by Uwe MAINTAINERS | 6 + arch/microblaze/kernel/timer.c | 3 + drivers/pwm/Kconfig | 14 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-xilinx.c | 311 +++++++++++++++++++++++++++++ include/clocksource/timer-xilinx.h | 91 +++++++++ 6 files changed, 426 insertions(+) create mode 100644 drivers/pwm/pwm-xilinx.c create mode 100644 include/clocksource/timer-xilinx.h diff --git a/MAINTAINERS b/MAINTAINERS index f26920f0fa65..6cc3be5d5e99 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20603,6 +20603,12 @@ F: drivers/misc/Makefile F: drivers/misc/xilinx_sdfec.c F: include/uapi/misc/xilinx_sdfec.h +XILINX PWM DRIVER +M: Sean Anderson +S: Maintained +F: drivers/pwm/pwm-xilinx.c +F: include/clocksource/timer-xilinx.h + XILINX UARTLITE SERIAL DRIVER M: Peter Korsgaard L: linux-serial@vger.kernel.org diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index f8832cf49384..20e2669b533d 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c @@ -251,6 +251,9 @@ static int __init xilinx_timer_init(struct device_node *timer) u32 timer_num = 1; int ret; + if (of_property_read_bool(np, "#pwm-cells")) + return 0; + if (initialized) return -EINVAL; diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index aa29841bbb79..47f25237754f 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -638,4 +638,18 @@ config PWM_VT8500 To compile this driver as a module, choose M here: the module will be called pwm-vt8500. +config PWM_XILINX + tristate "Xilinx AXI Timer PWM support" + depends on OF_ADDRESS + depends on COMMON_CLK + select REGMAP_MMIO + help + PWM driver for Xilinx LogiCORE IP AXI timers. This timer is + typically a soft core which may be present in Xilinx FPGAs. + This device may also be present in Microblaze soft processors. + If you don't have this IP in your design, choose N. + + To compile this driver as a module, choose M here: the module + will be called pwm-xilinx. + endif diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index 708840b7fba8..ea785480359b 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -60,3 +60,4 @@ obj-$(CONFIG_PWM_TWL) += pwm-twl.o obj-$(CONFIG_PWM_TWL_LED) += pwm-twl-led.o obj-$(CONFIG_PWM_VISCONTI) += pwm-visconti.o obj-$(CONFIG_PWM_VT8500) += pwm-vt8500.o +obj-$(CONFIG_PWM_XILINX) += pwm-xilinx.o diff --git a/drivers/pwm/pwm-xilinx.c b/drivers/pwm/pwm-xilinx.c new file mode 100644 index 000000000000..d79ef202d62f --- /dev/null +++ b/drivers/pwm/pwm-xilinx.c @@ -0,0 +1,311 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2021 Sean Anderson + * + * Limitations: + * - When changing both duty cycle and period, we may end up with one cycle + * with the old duty cycle and the new period. This is because the counters + * may only be reloaded by first stopping them, or by letting them be + * automatically reloaded at the end of a cycle. If this automatic reload + * happens after we set TLR0 but before we set TLR1 then we will have a + * bad cycle. This could probably be fixed by reading TCR0 just before + * reprogramming, but I think it would add complexity for little gain. + * - Cannot produce 100% duty cycle by configuring the TLRs. This might be + * possible by stopping the counters at an appropriate point in the cycle, + * but this is not (yet) implemented. + * - Only produces "normal" output. + * - Always produces low output if disabled. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * The following functions are "common" to drivers for this device, and may be + * exported at a future date. + */ +u32 xilinx_timer_tlr_cycles(struct xilinx_timer_priv *priv, u32 tcsr, + u64 cycles) +{ + WARN_ON(cycles < 2 || cycles - 2 > priv->max); + + if (tcsr & TCSR_UDT) + return cycles - 2; + return priv->max - cycles + 2; +} + +unsigned int xilinx_timer_get_period(struct xilinx_timer_priv *priv, + u32 tlr, u32 tcsr) +{ + u64 cycles; + + if (tcsr & TCSR_UDT) + cycles = tlr + 2; + else + cycles = (u64)priv->max - tlr + 2; + + /* cycles has a max of 2^32 + 2 */ + return DIV64_U64_ROUND_CLOSEST(cycles * NSEC_PER_SEC, + clk_get_rate(priv->clk)); +} + +/* + * The idea here is to capture whether the PWM is actually running (e.g. + * because we or the bootloader set it up) and we need to be careful to ensure + * we don't cause a glitch. According to the data sheet, to enable the PWM we + * need to + * + * - Set both timers to generate mode (MDT=1) + * - Set both timers to PWM mode (PWMA=1) + * - Enable the generate out signals (GENT=1) + * + * In addition, + * + * - The timer must be running (ENT=1) + * - The timer must auto-reload TLR into TCR (ARHT=1) + * - We must not be in the process of loading TLR into TCR (LOAD=0) + * - Cascade mode must be disabled (CASC=0) + * + * If any of these differ from usual, then the PWM is either disabled, or is + * running in a mode that this driver does not support. + */ +#define TCSR_PWM_SET (TCSR_GENT | TCSR_ARHT | TCSR_ENT | TCSR_PWMA) +#define TCSR_PWM_CLEAR (TCSR_MDT | TCSR_LOAD) +#define TCSR_PWM_MASK (TCSR_PWM_SET | TCSR_PWM_CLEAR) + +struct xilinx_pwm_device { + struct pwm_chip chip; + struct xilinx_timer_priv priv; +}; + +static inline struct xilinx_timer_priv +*xilinx_pwm_chip_to_priv(struct pwm_chip *chip) +{ + return &container_of(chip, struct xilinx_pwm_device, chip)->priv; +} + +static bool xilinx_timer_pwm_enabled(u32 tcsr0, u32 tcsr1) +{ + return ((TCSR_PWM_MASK | TCSR_CASC) & tcsr0) == TCSR_PWM_SET && + (TCSR_PWM_MASK & tcsr1) == TCSR_PWM_SET; +} + +static int xilinx_pwm_apply(struct pwm_chip *chip, struct pwm_device *unused, + const struct pwm_state *state) +{ + struct xilinx_timer_priv *priv = xilinx_pwm_chip_to_priv(chip); + u32 tlr0, tlr1, tcsr0, tcsr1; + u64 period_cycles, duty_cycles; + unsigned long rate; + + if (state->polarity != PWM_POLARITY_NORMAL) + return -EINVAL; + + /* + * To be representable by TLR, cycles must be between 2 and + * priv->max + 2. To enforce this we can reduce the duty + * cycle, but we may not increase it. + */ + rate = clk_get_rate(priv->clk); + /* Prevent overflow by clamping to the worst case of rate */ + period_cycles = min_t(u64, state->period, ULONG_MAX * NSEC_PER_SEC); + period_cycles = mul_u64_u32_div(period_cycles, rate, NSEC_PER_SEC); + if (period_cycles < 2 || period_cycles - 2 > priv->max) + return -ERANGE; + duty_cycles = mul_u64_u32_div(state->duty_cycle, rate, NSEC_PER_SEC); + + /* + * If we specify 100% duty cycle, we will get 0% instead, so decrease + * the duty cycle count by one. + */ + if (period_cycles == duty_cycles) + duty_cycles--; + + /* Round down to 0% duty cycle for unrepresentable duty cycles */ + if (duty_cycles < 2) + duty_cycles = period_cycles; + + regmap_read(priv->map, TCSR0, &tcsr0); + regmap_read(priv->map, TCSR1, &tcsr1); + tlr0 = xilinx_timer_tlr_cycles(priv, tcsr0, period_cycles); + tlr1 = xilinx_timer_tlr_cycles(priv, tcsr1, duty_cycles); + regmap_write(priv->map, TLR0, tlr0); + regmap_write(priv->map, TLR1, tlr1); + + if (state->enabled) { + /* + * If the PWM is already running, then the counters will be + * reloaded at the end of the current cycle. + */ + if (!xilinx_timer_pwm_enabled(tcsr0, tcsr1)) { + /* Load TLR into TCR */ + regmap_write(priv->map, TCSR0, tcsr0 | TCSR_LOAD); + regmap_write(priv->map, TCSR1, tcsr1 | TCSR_LOAD); + /* Enable timers all at once with ENALL */ + tcsr0 = (TCSR_PWM_SET & ~TCSR_ENT) | (tcsr0 & TCSR_UDT); + tcsr1 = TCSR_PWM_SET | TCSR_ENALL | (tcsr1 & TCSR_UDT); + regmap_write(priv->map, TCSR0, tcsr0); + regmap_write(priv->map, TCSR1, tcsr1); + } + } else { + regmap_write(priv->map, TCSR0, 0); + regmap_write(priv->map, TCSR1, 0); + } + + return 0; +} + +static void xilinx_pwm_get_state(struct pwm_chip *chip, + struct pwm_device *unused, + struct pwm_state *state) +{ + struct xilinx_timer_priv *priv = xilinx_pwm_chip_to_priv(chip); + u32 tlr0, tlr1, tcsr0, tcsr1; + + regmap_read(priv->map, TLR0, &tlr0); + regmap_read(priv->map, TLR1, &tlr1); + regmap_read(priv->map, TCSR0, &tcsr0); + regmap_read(priv->map, TCSR1, &tcsr1); + state->period = xilinx_timer_get_period(priv, tlr0, tcsr0); + state->duty_cycle = xilinx_timer_get_period(priv, tlr1, tcsr1); + state->enabled = xilinx_timer_pwm_enabled(tcsr0, tcsr1); + state->polarity = PWM_POLARITY_NORMAL; + + /* 100% duty cycle results in constant low output */ + if (state->period == state->duty_cycle) + state->duty_cycle = 0; +} + +static const struct pwm_ops xilinx_pwm_ops = { + .apply = xilinx_pwm_apply, + .get_state = xilinx_pwm_get_state, + .owner = THIS_MODULE, +}; + +static const struct regmap_config xilinx_pwm_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .val_format_endian = REGMAP_ENDIAN_LITTLE, + .max_register = TCR1, +}; + +static int xilinx_timer_probe(struct platform_device *pdev) +{ + int ret; + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct xilinx_timer_priv *priv; + struct xilinx_pwm_device *pwm; + u32 pwm_cells, one_timer, width; + void __iomem *regs; + + 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"); + + pwm = devm_kzalloc(dev, sizeof(*pwm), GFP_KERNEL); + if (!pwm) + return -ENOMEM; + platform_set_drvdata(pdev, pwm); + priv = &pwm->priv; + + regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(regs)) + return PTR_ERR(regs); + + priv->map = devm_regmap_init_mmio(dev, regs, + &xilinx_pwm_regmap_config); + if (IS_ERR(priv->map)) + return dev_err_probe(dev, PTR_ERR(priv->map), + "Could not create regmap\n"); + + ret = of_property_read_u32(np, "xlnx,one-timer-only", &one_timer); + if (ret) + return dev_err_probe(dev, ret, + "Could not read xlnx,one-timer-only\n"); + + if (one_timer) + return dev_err_probe(dev, -EINVAL, + "Two timers required for PWM mode\n"); + + + ret = of_property_read_u32(np, "xlnx,count-width", &width); + if (ret == -EINVAL) + width = 32; + else if (ret) + return dev_err_probe(dev, ret, + "Could not read xlnx,count-width\n"); + + if (width != 8 && width != 16 && width != 32) + return dev_err_probe(dev, -EINVAL, + "Invalid counter width %d\n", width); + priv->max = BIT_ULL(width) - 1; + + /* + * The polarity of the generate outputs must be active high for PWM + * mode to work. We could determine this from the device tree, but + * alas, such properties are not allowed to be used. + */ + + priv->clk = devm_clk_get(dev, "s_axi_aclk"); + if (IS_ERR(priv->clk)) + return dev_err_probe(dev, PTR_ERR(priv->clk), + "Could not get clock\n"); + + ret = clk_prepare_enable(priv->clk); + if (ret) + return dev_err_probe(dev, ret, "Clock enable failed\n"); + clk_rate_exclusive_get(priv->clk); + + pwm->chip.dev = dev; + pwm->chip.ops = &xilinx_pwm_ops; + pwm->chip.npwm = 1; + ret = pwmchip_add(&pwm->chip); + if (ret) { + clk_rate_exclusive_put(priv->clk); + clk_disable_unprepare(priv->clk); + return dev_err_probe(dev, ret, "Could not register PWM chip\n"); + } + + return 0; +} + +static int xilinx_timer_remove(struct platform_device *pdev) +{ + struct xilinx_pwm_device *pwm = platform_get_drvdata(pdev); + + pwmchip_remove(&pwm->chip); + clk_rate_exclusive_put(pwm->priv.clk); + clk_disable_unprepare(pwm->priv.clk); + return 0; +} + +static const struct of_device_id xilinx_timer_of_match[] = { + { .compatible = "xlnx,xps-timer-1.00.a", }, + {}, +}; +MODULE_DEVICE_TABLE(of, xilinx_timer_of_match); + +static struct platform_driver xilinx_timer_driver = { + .probe = xilinx_timer_probe, + .remove = xilinx_timer_remove, + .driver = { + .name = "xilinx-timer", + .of_match_table = of_match_ptr(xilinx_timer_of_match), + }, +}; +module_platform_driver(xilinx_timer_driver); + +MODULE_ALIAS("platform:xilinx-timer"); +MODULE_DESCRIPTION("Xilinx LogiCORE IP AXI Timer driver"); +MODULE_LICENSE("GPL v2"); diff --git a/include/clocksource/timer-xilinx.h b/include/clocksource/timer-xilinx.h new file mode 100644 index 000000000000..1f7757b84a5e --- /dev/null +++ b/include/clocksource/timer-xilinx.h @@ -0,0 +1,91 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2021 Sean Anderson + */ + +#ifndef XILINX_TIMER_H +#define XILINX_TIMER_H + +#include + +#define TCSR0 0x00 +#define TLR0 0x04 +#define TCR0 0x08 +#define TCSR1 0x10 +#define TLR1 0x14 +#define TCR1 0x18 + +#define TCSR_MDT BIT(0) +#define TCSR_UDT BIT(1) +#define TCSR_GENT BIT(2) +#define TCSR_CAPT BIT(3) +#define TCSR_ARHT BIT(4) +#define TCSR_LOAD BIT(5) +#define TCSR_ENIT BIT(6) +#define TCSR_ENT BIT(7) +#define TCSR_TINT BIT(8) +#define TCSR_PWMA BIT(9) +#define TCSR_ENALL BIT(10) +#define TCSR_CASC BIT(11) + +struct clk; +struct device_node; +struct regmap; + +/** + * struct xilinx_timer_priv - Private data for Xilinx AXI timer drivers + * @map: Regmap of the device, possibly with an offset + * @clk: Parent clock + * @max: Maximum value of the counters + */ +struct xilinx_timer_priv { + struct regmap *map; + struct clk *clk; + u32 max; +}; + +/** + * xilinx_timer_tlr_cycles() - Calculate the TLR for a period specified + * in clock cycles + * @priv: The timer's private data + * @tcsr: The value of the TCSR register for this counter + * @cycles: The number of cycles in this period + * + * Callers of this function MUST ensure that @cycles is representable as + * a TLR. + * + * Return: The calculated value for TLR + */ +u32 xilinx_timer_tlr_cycles(struct xilinx_timer_priv *priv, u32 tcsr, + u64 cycles); + +/** + * xilinx_timer_get_period() - Get the current period of a counter + * @priv: The timer's private data + * @tlr: The value of TLR for this counter + * @tcsr: The value of TCSR for this counter + * + * Return: The period, in ns + */ +unsigned int xilinx_timer_get_period(struct xilinx_timer_priv *priv, + u32 tlr, u32 tcsr); + +/** + * xilinx_timer_common_init() - Perform common initialization for Xilinx + * AXI timer drivers. + * @priv: The timer's private data + * @np: The devicetree node for the timer + * @one_timer: Set to %1 if there is only one timer + * + * This performs common initialization, such as detecting endianness, + * and parsing devicetree properties. @priv->regs must be initialized + * before calling this function. This function initializes @priv->read, + * @priv->write, and @priv->width. + * + * Return: 0, or negative errno + */ +int xilinx_timer_common_init(struct device_node *np, + struct xilinx_timer_priv *priv, + u32 *one_timer); + +#endif /* XILINX_TIMER_H */