From patchwork Sat Jun 4 07:10:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 9154521 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 CDAC060467 for ; Sat, 4 Jun 2016 07:18:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF17D27F2B for ; Sat, 4 Jun 2016 07:18:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B37D82832B; Sat, 4 Jun 2016 07:18:54 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 26F0F267EC for ; Sat, 4 Jun 2016 07:18:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b95qK-0006r4-Gp; Sat, 04 Jun 2016 07:18:00 +0000 Received: from smtp31.i.mail.ru ([94.100.177.91]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b95jo-0005mj-UG for linux-arm-kernel@lists.infradead.org; Sat, 04 Jun 2016 07:11:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=rdc4V/O1Ezjad0CPrL5w1/hj0TxsYDbSyAEKWvpRyYQ=; b=hIzqZWdkspdPZ60gr1+mLE3/vRR0MbxDhj6elWjWNJMksmK6inhw69aQ/5kNxXcL5EnJ+gjEIyJ3ev9X56DZC6IR0sBxggkbk1H+Q1UoULfq3GganTDkX0z495c3ahuDCModBnksqz1hCO34aRgDyPqoxfKZAA1qM16YfTnyp70=; Received: from [5.18.96.7] (port=41685 helo=shc.zet) by smtp31.i.mail.ru with esmtpa (envelope-from ) id 1b95jU-0000n0-B8; Sat, 04 Jun 2016 10:10:56 +0300 From: Alexander Shiyan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 11/22] ARM: clps711x: Add basic DT support Date: Sat, 4 Jun 2016 10:10:03 +0300 Message-Id: <1465024214-22120-12-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 2.4.9 In-Reply-To: <1465024214-22120-1-git-send-email-shc_work@mail.ru> References: <1465024214-22120-1-git-send-email-shc_work@mail.ru> X-Mras: OK X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160604_001117_524354_617E8D50 X-CRM114-Status: GOOD ( 16.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Shiyan , Russell King , Arnd Bergmann 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 This patch adds basic support to run Cirrus Logic ARMv4T CPUs with device-tree support. Signed-off-by: Alexander Shiyan --- arch/arm/mach-clps711x/Kconfig | 9 +++++ arch/arm/mach-clps711x/Makefile | 1 + arch/arm/mach-clps711x/board-dt.c | 82 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 arch/arm/mach-clps711x/board-dt.c diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig index f711498..f21700c 100644 --- a/arch/arm/mach-clps711x/Kconfig +++ b/arch/arm/mach-clps711x/Kconfig @@ -2,6 +2,15 @@ if ARCH_CLPS711X menu "CLPS711X/EP721X/EP731X Implementations" +config MACH_CLPS711X_DT + bool "Device-tree support" + select CLKSRC_OF + select OF_IRQ + select USE_OF + help + Select this if you want to experiment device-tree with + ARMv4T Cirrus Logic chips. + config ARCH_AUTCPU12 bool "AUTCPU12" help diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile index f04151e..ef6df40 100644 --- a/arch/arm/mach-clps711x/Makefile +++ b/arch/arm/mach-clps711x/Makefile @@ -6,6 +6,7 @@ obj-y := common.o devices.o +obj-$(CONFIG_MACH_CLPS711X_DT) += board-dt.o obj-$(CONFIG_ARCH_AUTCPU12) += board-autcpu12.o obj-$(CONFIG_ARCH_CDB89712) += board-cdb89712.o obj-$(CONFIG_ARCH_CLEP7312) += board-clep7312.o diff --git a/arch/arm/mach-clps711x/board-dt.c b/arch/arm/mach-clps711x/board-dt.c new file mode 100644 index 0000000..ee1f83b --- /dev/null +++ b/arch/arm/mach-clps711x/board-dt.c @@ -0,0 +1,82 @@ +/* + * Author: Alexander Shiyan , 2016 + * + * 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 + +#include +#include +#include +#include + +#define CLPS711X_VIRT_BASE IOMEM(0xfeff4000) +#define CLPS711X_PHYS_BASE (0x80000000) +# define SYSFLG1 (0x0140) +# define HALT (0x0800) +# define UNIQID (0x2440) +# define RANDID0 (0x2700) +# define RANDID1 (0x2704) +# define RANDID2 (0x2708) +# define RANDID3 (0x270c) + +static struct map_desc clps711x_io_desc __initdata = { + .virtual = (unsigned long)CLPS711X_VIRT_BASE, + .pfn = __phys_to_pfn(CLPS711X_PHYS_BASE), + .length = 48 * SZ_1K, + .type = MT_DEVICE, +}; + +static void __init clps711x_map_io(void) +{ + iotable_init(&clps711x_io_desc, 1); +} + +static const struct resource clps711x_cpuidle_res = + DEFINE_RES_MEM(CLPS711X_PHYS_BASE + HALT, SZ_128); + +static void __init clps711x_init(void) +{ + u32 id[5]; + + id[0] = readl(CLPS711X_VIRT_BASE + UNIQID); + id[1] = readl(CLPS711X_VIRT_BASE + RANDID0); + id[2] = readl(CLPS711X_VIRT_BASE + RANDID1); + id[3] = readl(CLPS711X_VIRT_BASE + RANDID2); + id[4] = readl(CLPS711X_VIRT_BASE + RANDID3); + system_rev = SYSFLG1_VERID(readl(CLPS711X_VIRT_BASE + SYSFLG1)); + + add_device_randomness(id, sizeof(id)); + + system_serial_low = id[0]; + + platform_device_register_simple("clps711x-cpuidle", PLATFORM_DEVID_NONE, + &clps711x_cpuidle_res, 1); +} + +static void clps711x_restart(enum reboot_mode mode, const char *cmd) +{ + soft_restart(0); +} + +static const char *clps711x_compat[] __initconst = { + "cirrus,ep7209", + NULL +}; + +DT_MACHINE_START(CLPS711X_DT, "Cirrus Logic CLPS711X (Device Tree Support)") + .dt_compat = clps711x_compat, + .map_io = clps711x_map_io, + .init_late = clps711x_init, + .restart = clps711x_restart, +MACHINE_END