From patchwork Fri Sep 18 13:22:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhen Lei X-Patchwork-Id: 313197 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp1333762ilg; Fri, 18 Sep 2020 06:23:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOIVg+5Va6SCXC4d25UlJgbfxmGoKYasR6GxLepgk/x1nQk5rYhSpSABA46ds+6pfvDAAB X-Received: by 2002:a17:906:ce30:: with SMTP id sd16mr35417291ejb.53.1600435427313; Fri, 18 Sep 2020 06:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600435427; cv=none; d=google.com; s=arc-20160816; b=RubC+nyrhKGZ7+1IGu6bcM2qzIvoQT3wwq4oxtMyVLN1MtXYlqEH+vO+5Z+qXomVXp HOJQ0ub0c/XhhyVHa8MLyous1bv1STB4cuogMd9smB1H/pJVHjGF77KDvVLipDpmqJ0T osMTZWVV97Z5HZ76cgAdZ6PbACyYBDh0m7SVzlLqvtyp+t8tHWdZthhnlLnIsheka48U 0ZKW+OdTuWHlJT25fI2Bvby3RcP0Jt9iWqHqlVTunxH7A43DZkU6uo6Jwsv8nRVqvNEd iyRxoCBvmPWm1/bM+37rSlp1lsUlx0SDSYTYdJkKUpBu3byoF/KdXpE1+1FouKv2IF8F Ccxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=lxFxSlson/CldG/QOpSxeNqpsjNt5fGmkTweY0CCyVc=; b=yBGsrY3/B0T93j+XIm23EQHX8JadCg8ZXGkVp+8JFNtti8S9DGdwZZASzzxgpiYAkj yU//tXIwHjHP9iNbGoVthOK/6zguBXsOzX6L8KBCOk5yAsUFHX+2ONneJPbJlTLT/xlM z165dmZy5gKTVnTl4CQTjt+BJ50haxNZGabfdg7dCxSMsP1pReFL44aUNm34Gyo06Kr6 /wj7MZ13JbTA0soV3zNXM5glO3X19e8CxId9r5nqVtZ6Oc3AeUVrAVxLeKCMJgADccpr JmRwndK6YB2MOf3MPbKT91IedwTqkcrMtTY1aIOVb4CPS9rhroSprTsyhHPYJXqo4ULR teZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si2186445edr.49.2020.09.18.06.23.47; Fri, 18 Sep 2020 06:23:47 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726301AbgIRNXq (ORCPT + 6 others); Fri, 18 Sep 2020 09:23:46 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13308 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726129AbgIRNXM (ORCPT ); Fri, 18 Sep 2020 09:23:12 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 8FD234D8814BFEC69583; Fri, 18 Sep 2020 21:23:08 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.177.253) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Fri, 18 Sep 2020 21:22:58 +0800 From: Zhen Lei To: Rob Herring , devicetree , Daniel Lezcano , Thomas Gleixner , Haojian Zhuang , linux-kernel CC: Zhen Lei , Libin , Kefeng Wang , Jianguo Chen Subject: [PATCH v3 0/9] clocksource: sp804: add support for Hisilicon sp804 timer Date: Fri, 18 Sep 2020 21:22:28 +0800 Message-ID: <20200918132237.3552-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.177.253] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org v2 --> v3: 1. Move the marcos of Hisilicon 64-bit timer, such as HISI_TIMER_LOAD, from "drivers/clocksource/timer-sp.h" into "drivers/clocksource/timer-sp804.c", involved Patch7-8. 2. Because the DT binding of ARM SP-804 has been converted to json-schema recently, so rewrote Patch9, it based on below patch https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git/patch/?id=a85a4aa32ab9568751b7aff8bd33e1b44b1cd3a1 3. Other patches have no chnage. v1 --> v2: 1. Split the Patch 3 of v1 into three patches: Patch 3-5 2. Change compatible "hisi,sp804" to "hisilicon,sp804" in Patch 7. 3. Add dt-binding description of "hisilicon,sp804", Patch 9 Other patches are not changed. v1: The ARM SP804 supports a maximum of 32-bit counter, but Hisilicon extends it to 64-bit. That means, the registers: TimerXload, TimerXValue and TimerXBGLoad are 64bits, all other registers are the same as those in the SP804. The driver code can be completely reused except that the register offset is different The register offset differences between ARM-SP804 and HISI-SP804 are as follows: ARM-SP804 HISI-SP804 TIMER_LOAD 0x00 HISI_TIMER_LOAD 0x00 HISI_TIMER_LOAD_H 0x04 TIMER_VALUE 0x04 HISI_TIMER_VALUE 0x08 HISI_TIMER_VALUE_H 0x0c TIMER_CTRL 0x08 HISI_TIMER_CTRL 0x10 TIMER_INTCLR 0x0c HISI_TIMER_INTCLR 0x14 TIMER_RIS 0x10 HISI_TIMER_RIS 0x18 TIMER_MIS 0x14 HISI_TIMER_MIS 0x1c TIMER_BGLOAD 0x18 HISI_TIMER_BGLOAD 0x20 HISI_TIMER_BGLOAD_H 0x24 TIMER_2_BASE 0x20 HISI_TIMER_2_BASE 0x40 ---------------- In order to make the timer-sp804 driver support both ARM-SP804 and HISI-SP804. Create a new structure "sp804_clkevt" to record the calculated registers address in advance, avoid judging and calculating the register address every place that is used. For example: struct sp804_timer arm_sp804_timer = { .ctrl = TIMER_CTRL, }; struct sp804_timer hisi_sp804_timer = { .ctrl = HISI_TIMER_CTRL, }; struct sp804_clkevt clkevt; In the initialization phase: if (hisi_sp804) clkevt.ctrl = base + hisi_sp804_timer.ctrl; else if (arm_sp804) clkevt.ctrl = base + arm_sp804_timer.ctrl; After initialization: - writel(0, base + TIMER_CTRL); + writel(0, clkevt.ctrl); ---------------- Additional information: These patch series are the V2 of https://lore.kernel.org/patchwork/cover/681876/ And many of the main ideas in https://lore.kernel.org/patchwork/patch/681875/ have been considered. Thanks for Daniel Lezcano's review comments. Kefeng Wang (1): clocksource: sp804: cleanup clk_get_sys() Zhen Lei (8): clocksource: sp804: remove unused sp804_timer_disable() and timer-sp804.h clocksource: sp804: delete the leading "__" of some functions clocksource: sp804: remove a mismatched comment clocksource: sp804: prepare for support non-standard register offset clocksource: sp804: support non-standard register offset clocksource: sp804: add support for Hisilicon sp804 timer clocksource: sp804: enable Hisilicon sp804 timer 64bit mode dt-bindings: sp804: add support for Hisilicon sp804 timer .../devicetree/bindings/timer/arm,sp804.yaml | 7 +- drivers/clocksource/timer-sp.h | 32 ++++ drivers/clocksource/timer-sp804.c | 210 ++++++++++++++------- include/clocksource/timer-sp804.h | 29 --- 4 files changed, 185 insertions(+), 93 deletions(-) delete mode 100644 include/clocksource/timer-sp804.h -- 1.8.3