From patchwork Sat Nov 26 08:00:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 84264 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp395913qgi; Sat, 26 Nov 2016 00:05:26 -0800 (PST) X-Received: by 10.99.8.133 with SMTP id 127mr21768968pgi.76.1480147526589; Sat, 26 Nov 2016 00:05:26 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z67si19411252plh.114.2016.11.26.00.05.26; Sat, 26 Nov 2016 00:05:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750783AbcKZIFZ (ORCPT + 7 others); Sat, 26 Nov 2016 03:05:25 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:28113 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750799AbcKZIFZ (ORCPT ); Sat, 26 Nov 2016 03:05:25 -0500 Received: from 172.24.1.47 (EHLO SZXEML423-HUB.china.huawei.com) ([172.24.1.47]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DRH44415; Sat, 26 Nov 2016 16:01:17 +0800 (CST) Received: from localhost (10.177.23.32) by SZXEML423-HUB.china.huawei.com (10.82.67.154) with Microsoft SMTP Server id 14.3.235.1; Sat, 26 Nov 2016 16:01:09 +0800 From: Ding Tianhong To: , , , , , , , , , , CC: Ding Tianhong Subject: [PATCH v4 5/6] arm64: arch_timer: apci: Introduce a generic aquirk framework for erratum Date: Sat, 26 Nov 2016 16:00:47 +0800 Message-ID: <1480147248-12828-6-git-send-email-dingtianhong@huawei.com> X-Mailer: git-send-email 1.8.5.2.msysgit.0 In-Reply-To: <1480147248-12828-1-git-send-email-dingtianhong@huawei.com> References: <1480147248-12828-1-git-send-email-dingtianhong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.23.32] X-CFilter-Loop: Reflected Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Hanjun Guo Introduce a general quirk framework for each timer erratum in ACPI, which use the oem information in GTDT table for platform specific erratums. The struct gtdt_arch_timer_fixup is introduced to record the oem information to match the quirk and handle the erratum. v3: Introduce a generic aquick framework for erratum in ACPI mode. v4: rename the quirk handler parameter to make it more generic, and avoid break loop when handling the quirk becasue it need to support multi quirks handler. Signed-off-by: Hanjun Guo Signed-off-by: Ding Tianhong --- drivers/clocksource/arm_arch_timer.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) -- 1.9.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 3d59af1..d4f4a0d 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -1068,6 +1068,39 @@ static int __init arch_timer_mem_init(struct device_node *np) arch_timer_mem_init); #ifdef CONFIG_ACPI +struct gtdt_arch_timer_fixup { + char oem_id[ACPI_OEM_ID_SIZE]; + char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; + u32 oem_revision; + + /* quirk handler for arch timer erratum */ + void (*handler)(void *context); + void *context; +}; + +/* note: this needs to be updated according to the doc of OEM ID + * and TABLE ID for different board. + */ +struct gtdt_arch_timer_fixup arch_timer_quirks[] __initdata = { +}; + +void __init arch_timer_acpi_quirks_handler(char *oem_id, + char *oem_table_id, + u32 oem_revision) +{ + struct gtdt_arch_timer_fixup *quirks = arch_timer_quirks; + int i; + + for (i = 0; i < ARRAY_SIZE(arch_timer_quirks); i++, quirks++) { + if (!memcmp(quirks->oem_id, oem_id, ACPI_OEM_ID_SIZE) && + !memcmp(quirks->oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE) && + quirks->oem_revision == oem_revision) { + if (quirks->handler && quirks->context) + quirks->handler(quirks->context); + } + } +} + static int __init map_generic_timer_interrupt(u32 interrupt, u32 flags) { int trigger, polarity; @@ -1094,6 +1127,9 @@ static int __init arch_timer_acpi_init(struct acpi_table_header *table) return -EINVAL; } + arch_timer_acpi_quirks_handler(table->oem_id, table->oem_table_id, + table->oem_revision); + gtdt = container_of(table, struct acpi_table_gtdt, header); arch_timers_present |= ARCH_CP15_TIMER;