From patchwork Fri Jan 17 12:25:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 3504281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C5E9C9F169 for ; Fri, 17 Jan 2014 12:57:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E468D20103 for ; Fri, 17 Jan 2014 12:57:11 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B0884200DB for ; Fri, 17 Jan 2014 12:57:10 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W48yr-0000xf-JK; Fri, 17 Jan 2014 12:57:01 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W48ym-000861-LP; Fri, 17 Jan 2014 12:56:56 +0000 Received: from mail-pa0-f48.google.com ([209.85.220.48]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W48yk-000853-6f for linux-arm-kernel@lists.infradead.org; Fri, 17 Jan 2014 12:56:54 +0000 Received: by mail-pa0-f48.google.com with SMTP id kx10so2528438pab.35 for ; Fri, 17 Jan 2014 04:56:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ASX5952h/7XuIJAxIujtVtGL4he3pqgR6WLfHTd77Mk=; b=f8vCstPMqL4OjOxYGFYgmOp/UHtq8AWMTdLjeIDeMl8laxIpgdhkAS8MPyzM1L/pbd uy57K+5xr3AcnC3qGJGjadOcW3/vzlhNLhBDfq57adPcgsdEKuw+aIsQ3TWu4y4WLzCM 7o59VN1X1ww8YncuOW8WwKGbFyLnxGGua6ROFUGgGTdTACriaRFjYQB+95bbAjIoZIEB rsDv4+eidWHjaT9FEOdq2j9ccPLxaL4KbJIyfsueq0jAm8ddQ+0OP1bcrvzPhziUvJ70 jA1cuICuc8lvOAERf8XkhGsZYrToTStZ2+GRqaoy0dM0T+zlCpR2z7DO/iM1lzjXwmKs 59uw== X-Gm-Message-State: ALoCoQnGU5SwL6g0+klPrKy/SVuZShDte6+MY44lsUrAPO/RdYfbvkJt7IDr5HsRXO7fgIkB4RJG X-Received: by 10.66.149.37 with SMTP id tx5mr1842405pab.81.1389963392749; Fri, 17 Jan 2014 04:56:32 -0800 (PST) Received: from localhost ([218.17.215.175]) by mx.google.com with ESMTPSA id bz4sm22679575pbb.12.2014.01.17.04.56.12 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 Jan 2014 04:56:32 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" , Catalin Marinas , Will Deacon , Russell King - ARM Linux Subject: [PATCH 18/20] clocksource / acpi: Add macro CLOCKSOURCE_ACPI_DECLARE Date: Fri, 17 Jan 2014 20:25:12 +0800 Message-Id: <1389961514-13562-19-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389961514-13562-1-git-send-email-hanjun.guo@linaro.org> References: <1389961514-13562-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140117_075654_356556_5868C8B9 X-CRM114-Status: GOOD ( 12.12 ) X-Spam-Score: -1.8 (-) Cc: Mark Rutland , Matthew Garrett , linaro-kernel@lists.linaro.org, Arnd Bergmann , Rob Herring , Linus Walleij , Olof Johansson , linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, linux-acpi@vger.kernel.org, Amit Daniel Kachhap , Hanjun Guo , patches@linaro.org, Grant Likely , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, Charles.Garcia-Tobin@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Amit Daniel Kachhap This macro does the same job as CLOCKSOURCE_OF_DECLARE. The device name from the ACPI timer table is matched with all the registered timer controllers and matching initialisation routine is invoked. Signed-off-by: Amit Daniel Kachhap Signed-off-by: Hanjun Guo --- include/asm-generic/vmlinux.lds.h | 10 ++++++++++ include/linux/clocksource.h | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index bc2121f..3216bee 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -148,6 +148,15 @@ #define CLKSRC_OF_TABLES() #endif +#ifdef CONFIG_ACPI +#define CLKSRC_ACPI_TABLES() . = ALIGN(8); \ + VMLINUX_SYMBOL(__clksrc_acpi_table) = .; \ + *(__clksrc_acpi_table) \ + *(__clksrc_acpi_table_end) +#else +#define CLKSRC_ACPI_TABLES() +#endif + #ifdef CONFIG_IRQCHIP #define IRQCHIP_OF_MATCH_TABLE() \ . = ALIGN(8); \ @@ -491,6 +500,7 @@ MEM_DISCARD(init.rodata) \ CLK_OF_TABLES() \ CLKSRC_OF_TABLES() \ + CLKSRC_ACPI_TABLES() \ KERNEL_DTB() \ IRQCHIP_OF_MATCH_TABLE() diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 67301a4..1d500cf 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h @@ -341,6 +341,8 @@ extern int clocksource_i8253_init(void); struct device_node; typedef void(*clocksource_of_init_fn)(struct device_node *); +typedef void(*clocksource_acpi_init_fn)(void); + #ifdef CONFIG_CLKSRC_OF extern void clocksource_of_init(void); @@ -358,4 +360,14 @@ static inline void clocksource_of_init(void) {} .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn } #endif +#ifdef CONFIG_ACPI +#define CLOCKSOURCE_ACPI_DECLARE(name, compat, fn) \ + static const struct acpi_device_id __clksrc_acpi_table_##name \ + __used __section(__clksrc_acpi_table) \ + = { .id = compat, \ + .driver_data = (kernel_ulong_t)fn } +#else +#define CLOCKSOURCE_ACPI_DECLARE(name, compat, fn) +#endif + #endif /* _LINUX_CLOCKSOURCE_H */