From patchwork Thu Oct 31 16:53:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 178214 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3110391ill; Thu, 31 Oct 2019 09:53:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDS+Fv9uV92/T5rnrV/32h6/y2DaIRyg9zUZLmaLqRWzp4LDUh9/l/NdgKf21KNPvkthQ+ X-Received: by 2002:aa7:c645:: with SMTP id z5mr7349114edr.204.1572540809901; Thu, 31 Oct 2019 09:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572540809; cv=none; d=google.com; s=arc-20160816; b=xQDJgsCzoStLYkBP3iYQgeg+p4gAzdPVwzukFo713OyTseYC/VcS8DTJ7VALp/rFt1 08fC3+6XjY2zD82VAJelU5QQaxGK+uJ+hqCV17Krd6HV2YpD40wq2n3NWNfHs7TzRAtB /Pp7DUOhdAuPf7TEWUHzAPy1s1g+1gpTHDG1T6Bmes8l7LChh3u75LsAhMdXNg7oQwKB mlSyKfmMrc1qgTloIHi44Lgz6MoWBpaD0VoKRnbMXfTZASFSsbeuIz9tsk+/2HbXFNkt VIDZr3ZyZoSRW9Swkg6kb3C5l4XdXl3hc6sLKHX4Y28x2bpLoL8c39wTj1FI9o2bgVXf DykQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8ZzIXs2yJa3exw9aKtugL5ki2HiCl42YHYzKv54KIOw=; b=kzf72vNzGc7xCdgU0vMZDgRkLQQzbnsKv4+sGDbSsdjxdq9LuW6Qw7aZORr+AmI7mu kLnnmKgeakFbYQ6BHOTlTxgEkjaSKrFLKDgQkO4EU9xQ7c5wHGpem9qdiLnxlVaMOK9T UcCFhkTGVdO5Kl5TWK+GgbwGWMUv6ScR7zzSKKCAScM0sOElXbiwkUymnDG6K7/fOYaQ +HxykwG0uv+RQ0TM6kJa912iKxcNPyBJzFqMgH270YHdyKjOPnF9SYA/kxXm00qbBJZU WhutiuX4nxXhvutIhNxsj+pznAC9WpJrypaGNLLgsDM5HelgKaq0ObKmJMIIhRpH78tI NSSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si3762898ejv.227.2019.10.31.09.53.29; Thu, 31 Oct 2019 09:53:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728834AbfJaQx0 (ORCPT + 26 others); Thu, 31 Oct 2019 12:53:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:34782 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728750AbfJaQxN (ORCPT ); Thu, 31 Oct 2019 12:53:13 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 27ED6B302; Thu, 31 Oct 2019 16:53:12 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= , Russell King Subject: [PATCH v2 2/4] ARM: Prepare Realtek RTD1195 Date: Thu, 31 Oct 2019 17:53:05 +0100 Message-Id: <20191031165308.14102-3-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191031165308.14102-1-afaerber@suse.de> References: <20191031165308.14102-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce ARCH_REALTEK Kconfig option also for 32-bit Arm. Override the text offset to cope with boot ROM occupying first 0xa800 bytes and further reservations up to 0xf4000 (compare Device Tree). Add a custom machine_desc to enforce memory carveout for I/O registers. Signed-off-by: Andreas Färber --- v1 -> v2: * Dropped selection of COMMON_CLK (Arnd) * Dropped selection of AMBA, SCU, TWD * Added comment about text offset to distinguish from HTC comment above * Added machine_desc with .reserve to exclude peripheral spaces (Rob) arch/arm/Kconfig | 2 ++ arch/arm/Makefile | 3 +++ arch/arm/mach-realtek/Kconfig | 11 +++++++++++ arch/arm/mach-realtek/Makefile | 2 ++ arch/arm/mach-realtek/rtd1195.c | 37 +++++++++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+) create mode 100644 arch/arm/mach-realtek/Kconfig create mode 100644 arch/arm/mach-realtek/Makefile create mode 100644 arch/arm/mach-realtek/rtd1195.c -- 2.16.4 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index b7dbeb652cb1..d800b3240790 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -700,6 +700,8 @@ source "arch/arm/mach-qcom/Kconfig" source "arch/arm/mach-rda/Kconfig" +source "arch/arm/mach-realtek/Kconfig" + source "arch/arm/mach-realview/Kconfig" source "arch/arm/mach-rockchip/Kconfig" diff --git a/arch/arm/Makefile b/arch/arm/Makefile index db857d07114f..16d41efea7f2 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -148,6 +148,8 @@ head-y := arch/arm/kernel/head$(MMUEXT).o textofs-y := 0x00008000 # We don't want the htc bootloader to corrupt kernel during resume textofs-$(CONFIG_PM_H1940) := 0x00108000 +# RTD1195 has Boot ROM at start of address space +textofs-$(CONFIG_ARCH_REALTEK) := 0x00108000 # SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory ifeq ($(CONFIG_ARCH_SA1100),y) textofs-$(CONFIG_SA1111) := 0x00208000 @@ -207,6 +209,7 @@ machine-$(CONFIG_ARCH_PICOXCELL) += picoxcell machine-$(CONFIG_ARCH_PXA) += pxa machine-$(CONFIG_ARCH_QCOM) += qcom machine-$(CONFIG_ARCH_RDA) += rda +machine-$(CONFIG_ARCH_REALTEK) += realtek machine-$(CONFIG_ARCH_REALVIEW) += realview machine-$(CONFIG_ARCH_ROCKCHIP) += rockchip machine-$(CONFIG_ARCH_RPC) += rpc diff --git a/arch/arm/mach-realtek/Kconfig b/arch/arm/mach-realtek/Kconfig new file mode 100644 index 000000000000..19fdcf093fd1 --- /dev/null +++ b/arch/arm/mach-realtek/Kconfig @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +menuconfig ARCH_REALTEK + bool "Realtek SoCs" + depends on ARCH_MULTI_V7 + select ARM_GIC + select ARM_GLOBAL_TIMER + select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK + select GENERIC_IRQ_CHIP + select RESET_CONTROLLER + help + This enables support for the Realtek RTD1195 SoC family. diff --git a/arch/arm/mach-realtek/Makefile b/arch/arm/mach-realtek/Makefile new file mode 100644 index 000000000000..5382d5bbdd3c --- /dev/null +++ b/arch/arm/mach-realtek/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +obj-y += rtd1195.o diff --git a/arch/arm/mach-realtek/rtd1195.c b/arch/arm/mach-realtek/rtd1195.c new file mode 100644 index 000000000000..99e5d3e96a8e --- /dev/null +++ b/arch/arm/mach-realtek/rtd1195.c @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Realtek RTD1195 + * + * Copyright (c) 2017-2019 Andreas Färber + */ + +#include +#include + +static void __init rtd1195_memblock_remove(phys_addr_t base, phys_addr_t size) +{ + int ret; + + ret = memblock_remove(base, size); + if (ret) + pr_err("Failed to remove memblock %pa (%d)\n", &base, ret); +} + +static void __init rtd1195_reserve(void) +{ + /* Exclude peripheral register spaces from RAM */ + rtd1195_memblock_remove(0x18000000, 0x00100000); + rtd1195_memblock_remove(0x18100000, 0x01000000); +} + +static const char *const rtd1195_dt_compat[] __initconst = { + "realtek,rtd1195", + NULL +}; + +DT_MACHINE_START(rtd1195, "Realtek RTD1195") + .dt_compat = rtd1195_dt_compat, + .reserve = rtd1195_reserve, + .l2c_aux_val = 0x0, + .l2c_aux_mask = ~0x0, +MACHINE_END From patchwork Thu Oct 31 16:53:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 178212 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3110230ill; Thu, 31 Oct 2019 09:53:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbvfreR6wPSXHQvrqGJKlJV1/W5Ye/mgE0P5Y9xxU7EzlfhSgv1e4FvHPFG+RJJePvn2Jk X-Received: by 2002:a17:906:4bcb:: with SMTP id x11mr5176663ejv.9.1572540801243; Thu, 31 Oct 2019 09:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572540801; cv=none; d=google.com; s=arc-20160816; b=NLjET8LtiEeKClO6BR1OneazFkKtsCSuWPSO5tMoBNqsAJ9E8qgOxxb1gXiJkKFaNi UJXABwgiY6xPoQxbAb32pkAYjCF8ltNZcvoh8GhHG1K276prnSy2T8UNdo0fb/lurU/b CY1n5izb6J1T1HisMfiH/I0+93S5BRHh0WBMyXsrTQtpCDatG8QM6840iId6GBaqyihg GaZJLSKGzViPJECAJ/bHJmt29ABNpFi9E1hMUtBZaCZ6Uw9bXKNpH1x7TvjBMkmkwMtv fWAdol9RoIjb+1OVuj5IX5nLTT2JbaROj1soyuFTHgw4xOc2gU82VFkzJSe1pJxAzSud PMxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=VO90jkr8UVLWUhwHWwmGTRXgc7q1cdz5y6VBnUkA3tw=; b=S0Tfcb7hHl2NXuTop8PG6VTY2KfOe48Wxm1vcPYdxnv8mXEoYz9fbB75eCkc9LGRKf qN+IwHZxERnLX2Frk7Au3O0MM8OrSBEi9+9UAiiFkodX9Q5R82RCjITuzJ71sgUT1SbF ophd5d/57FB5gdXq8K7t4aw98yrBlFNYg7sQ+58vuT0SiqnlXGI/fogujJIimCcSZLtv Dj8UvQggXBIGUwUXt71GAB/Ui9hM4fjK2bPb46PWhJqz31eRwEwpVOmFS6nhNxcCSKpB 6Y8l5H0xQpfDASB7H+MoajRi/uyPg9YaFBQYQHNXL9OX+YCfb4LhBSqqvoW8XPHdU2hA 8uJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si4693143edl.371.2019.10.31.09.53.20; Thu, 31 Oct 2019 09:53:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728804AbfJaQxR (ORCPT + 26 others); Thu, 31 Oct 2019 12:53:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:34808 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728753AbfJaQxO (ORCPT ); Thu, 31 Oct 2019 12:53:14 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BE77AB30A; Thu, 31 Oct 2019 16:53:12 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= , Russell King Subject: [PATCH v2 4/4] ARM: realtek: Enable RTD1195 arch timer Date: Thu, 31 Oct 2019 17:53:07 +0100 Message-Id: <20191031165308.14102-5-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191031165308.14102-1-afaerber@suse.de> References: <20191031165308.14102-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Without this magic write the timer doesn't work and boot gets stuck. Signed-off-by: Andreas Färber --- v2: New arch/arm/mach-realtek/rtd1195.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.16.4 diff --git a/arch/arm/mach-realtek/rtd1195.c b/arch/arm/mach-realtek/rtd1195.c index 99e5d3e96a8e..cd16f1e99646 100644 --- a/arch/arm/mach-realtek/rtd1195.c +++ b/arch/arm/mach-realtek/rtd1195.c @@ -5,6 +5,9 @@ * Copyright (c) 2017-2019 Andreas Färber */ +#include +#include +#include #include #include @@ -24,6 +27,18 @@ static void __init rtd1195_reserve(void) rtd1195_memblock_remove(0x18100000, 0x01000000); } +static void __init rtd1195_init_time(void) +{ + void __iomem *base; + + base = ioremap(0xff018000, 4); + writel(0x1, base); + iounmap(base); + + of_clk_init(NULL); + timer_probe(); +} + static const char *const rtd1195_dt_compat[] __initconst = { "realtek,rtd1195", NULL @@ -31,6 +46,7 @@ static const char *const rtd1195_dt_compat[] __initconst = { DT_MACHINE_START(rtd1195, "Realtek RTD1195") .dt_compat = rtd1195_dt_compat, + .init_time = rtd1195_init_time, .reserve = rtd1195_reserve, .l2c_aux_val = 0x0, .l2c_aux_mask = ~0x0,