Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1391809ybx; Thu, 31 Oct 2019 09:55:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqws5U8v6C8FdMwSsl3QKOuwRR7EzsfWxWi8B/uhv2+1aRI3uEJiMG+yucq9hq2W3Gz5RbLG X-Received: by 2002:a17:906:1942:: with SMTP id b2mr5114628eje.36.1572540941875; Thu, 31 Oct 2019 09:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572540941; cv=none; d=google.com; s=arc-20160816; b=TAZMxWSH+yo5PcHjLhTguCE/4yfNN3SEJekKjv0jpQn80yKdz5aXle+jE0bZdGYmFM 0REM9ct7HkTgjvKlUAEWXZwIG/SCjhZQ0lvuErToINBYg5A6LEV2WrdFim6YiInKtODr 0V5JyuOrDLp8e6H36t97Isz3datZiU8cvsb7clIUDf0H4nMUlikxintvvXjcvHwoFiIF Io9qV+6kbyfiJ7vigluBlaGAUOyrjkduybXzEWNyQ1jeT95ILCvY/AL3DtENiaYjsdsn Hhg2vtbungOVHOOprN6AiPpaGSAd+SRwXTq3mpv+zcxVClZJvSsS9Cbq1NkYBkXBqMUF bpvA== 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 26si4351197edz.340.2019.10.31.09.55.18; Thu, 31 Oct 2019 09:55:41 -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 S1728828AbfJaQx0 (ORCPT + 99 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=20F=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=20F=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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 -- 2.16.4