From patchwork Fri Jun 9 07:30:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jeffery X-Patchwork-Id: 9777447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7964A60318 for ; Fri, 9 Jun 2017 07:31:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69793205FD for ; Fri, 9 Jun 2017 07:31:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E34C2857D; Fri, 9 Jun 2017 07:31:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EE929205FD for ; Fri, 9 Jun 2017 07:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qPqC/SoTfvnVbTHbVF9HchdZA8AVUiVNgfbd0kTQPrA=; b=rrR277m74+eHXpfXJGreyJSvty 7Ol2eSV29p1cD9VLEhWquD5dMogKJ0xqshklXlf/FKm3J4WABB3dOvUVdGrToXQc9HpKDZ1Rmt6X8 6GqdApTr8R/4d2i5G6aytBke1mOpoSsgxZXORoD+9NNy5ScJlEyd2j2r+15L+TYzMcmwoopWA7BpH pD6agx1Cj2m0ZVjsWqyY+e8C9T//cG1yIRa2NLORqtPHa4g4PBTzFrPbsqN6UNtluTjdIqyV1pJ1j I0JhPpgJMlzMGZ3+JSN0PU4MbRZZ3oI4kluhCmnc24E9uU4ySF5mMqq3MdOZni2q2WMqpR4TvxJv0 jZmg1OUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dJEO5-00068s-43; Fri, 09 Jun 2017 07:31:17 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dJEO1-0005qh-5U for linux-arm-kernel@lists.infradead.org; Fri, 09 Jun 2017 07:31:14 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3FA3320A6C; Fri, 9 Jun 2017 03:30:50 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Fri, 09 Jun 2017 03:30:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=w7f1Ed I7qevdzhxJNUIjeRZWtWTtHbvld/X0vjDR7PQ=; b=nIMa+Ku50XlHbQN23PCt4P iIXdE8KdCmzwv9CtJx68LGouA/S2U/E8hfl8glO4PDtunnQ1k++/0TLUGke0ztev VnH+0eWs7mIL27fghsnjscYX1hnbddfwPlTpH4M1ZkuIcNK32tX4tkbq9H5jg27C GXWsyl0ICign6um5K8BNPwrfhtWB1MFvy9mBoRQ8Wajp+t3qG9kgv0P2Pixh1Pgk aGjcZCVAtljhgvwYWCx4zoc54NMLBOPHV7gJn2WVnFxeg405aAVkfNre8lOj8i6h 1ufTKMMOKlujh4P9yy1PLNnDZwfGSxhizMS9doDT7Io6b9u6xKjC1KNZWHSUpeAg == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=w7f1EdI7qevdzhxJNUIjeRZWtWTtHbvld/X0vjDR7 PQ=; b=m3uRfmMykN5KLJ7nuWAFufDYlgDXLQeJISfP2JkuB9J5IzeUXj9r5ZTvx IeLo4ycG6p6azpcWy1l9/ENrEbXD3etP7dHtTW6V7t442hge5uBz7p/xuWGgUyzw nPkqGKuMITFSj3vrQKC37uXEAxvXj6vysVKElXT12h/I9DAyO1yjGIPxhjQVmQu2 mDYjDlKsHKL7SmvUr9MotmxmdTPuAg2ne9QmPQ9TuCVKX56ZadmuGbl+DDvmTx2r MlM6TwQVE4x+t6C/SmBPfWYkIBV6k70NoHhuIfQmlGTaTWuHfnfLHnLs2kqsWlqH SSiTLtH8HLSmGJE4K5Q5DQ1K2WfUw== X-ME-Sender: X-Sasl-enc: vZuJ1QJ1corhkmWG2VG7rJjx/3N/yvUOOC7gAxtaK7V1 1496993449 Received: from keelia.au.ibm.com (unknown [203.0.153.9]) by mail.messagingengine.com (Postfix) with ESMTPA id 4BC3D7E7AA; Fri, 9 Jun 2017 03:30:47 -0400 (EDT) From: Andrew Jeffery To: arnd@arndb.de Subject: [PATCH] arm: aspeed: Add Aspeed board file with clocksource devicetree fixup Date: Fri, 9 Jun 2017 17:00:37 +0930 Message-Id: <20170609073037.21871-1-andrew@aj.id.au> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170609_003113_357198_CBBA0460 X-CRM114-Status: GOOD ( 14.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , linus.walleij@linaro.org, daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, joel@jms.id.au, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add the clock-names property in init_timer() to work-around Aspeed devicetrees from times prior to merging the Moxart/Aspeed and Faraday drivers. Signed-off-by: Andrew Jeffery --- Well, here's an implementation I knocked up. It's a fair chunk of code for marginal benefit. Joel is against it. At least it's something to debate. Tested under QEMU for both AST2400 and AST2500 SoCs. Cheers, Andrew arch/arm/Makefile | 1 + arch/arm/mach-aspeed/Makefile | 1 + arch/arm/mach-aspeed/aspeed.c | 73 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 arch/arm/mach-aspeed/Makefile create mode 100644 arch/arm/mach-aspeed/aspeed.c diff --git a/arch/arm/Makefile b/arch/arm/Makefile index ab30cc634d02..f3ed359e5b28 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -154,6 +154,7 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000 machine-$(CONFIG_ARCH_ALPINE) += alpine machine-$(CONFIG_ARCH_ARTPEC) += artpec machine-$(CONFIG_ARCH_AT91) += at91 +machine-$(CONFIG_ARCH_ASPEED) += aspeed machine-$(CONFIG_ARCH_AXXIA) += axxia machine-$(CONFIG_ARCH_BCM) += bcm machine-$(CONFIG_ARCH_BERLIN) += berlin diff --git a/arch/arm/mach-aspeed/Makefile b/arch/arm/mach-aspeed/Makefile new file mode 100644 index 000000000000..de8cd76fcf5d --- /dev/null +++ b/arch/arm/mach-aspeed/Makefile @@ -0,0 +1 @@ +obj-y += aspeed.o diff --git a/arch/arm/mach-aspeed/aspeed.c b/arch/arm/mach-aspeed/aspeed.c new file mode 100644 index 000000000000..feaac8eb5d2d --- /dev/null +++ b/arch/arm/mach-aspeed/aspeed.c @@ -0,0 +1,73 @@ +/* + * Copyright 2017 IBM Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include + +const char *aspeed_timer_compatibles[] = { + "aspeed,ast2400-timer", + "aspeed,ast2500-timer", + NULL, +}; + +/* + * For backwards compatibility with pre-4.13 devicetrees, populate the + * clock-names property in the clocksource node + */ +static void __init aspeed_timer_set_clock_names(void) +{ + const char **compatible = aspeed_timer_compatibles; + struct device_node *np; + + while (*compatible) { + for_each_compatible_node(np, NULL, *compatible) { + struct property *clock_names; + int rc; + + rc = of_property_count_strings(np, "clock-names"); + if (rc != -EINVAL) + continue; + + clock_names = kzalloc(sizeof(*clock_names), GFP_KERNEL); + + clock_names->name = kstrdup("clock-names", GFP_KERNEL); + clock_names->length = sizeof("PCLK"); + clock_names->value = kstrdup("PCLK", GFP_KERNEL); + + of_add_property(np, clock_names); + } + + compatible++; + } +} + +static void __init aspeed_init_time(void) +{ + aspeed_timer_set_clock_names(); + +#ifdef CONFIG_COMMON_CLK + of_clk_init(NULL); +#endif + timer_probe(); +} + +static const char *const aspeed_dt_match[] __initconst = { + "aspeed,ast2400", + "aspeed,ast2500", + NULL, +}; + +DT_MACHINE_START(aspeed_dt, "Aspeed SoC") + .init_time = aspeed_init_time, + .dt_compat = aspeed_dt_match, +MACHINE_END