From patchwork Sun Nov 17 07:21:03 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: 179563 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1380408ilf; Sat, 16 Nov 2019 23:21:33 -0800 (PST) X-Google-Smtp-Source: APXvYqw2ZBbgMhcawPE4X7Ixo12IE/XrHOQqN3Ej4MDGU4K6E1X84Yweanbx4QHc9Rpa4lrk6v3V X-Received: by 2002:a17:906:6dcf:: with SMTP id j15mr16157041ejt.104.1573975293842; Sat, 16 Nov 2019 23:21:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573975293; cv=none; d=google.com; s=arc-20160816; b=I19gzxPMKMfKMjlHMg7M7Loz1ZVgxJtg1M7IM8W9wZvxsG3eZv648bAwEP4Qb2hOed fiv8F0V7OBdPPf7qU0yKljl/zPm/akNNaaRY7hcZzm0QqgZM1jZLjQay02b7Ezwk+NCh JNyMq3+slBeBpIPPjp933VipqxztZMDDo3By+MJxmKzwj5tF00nNc+CcrVUv0mf790Mr RTWLfLPSBiKF/NisaYRZi/63l6IR0ewEavchGki08VEXiJLXPvV1HQtwREVpieovudhm ZSckfjUNctgrKxZv9ARTSAlQNzlj85ReiLsEShDlxq+TVRnLOZFRLiFBk8buC0cc5cPU faFQ== 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=TumL4ZCNcMXddkAYqjm06THVgNFJBGfu9nrzrtN5PnI=; b=I2RBgGBks8mgcctoqZhFqnWb4dxu2My4kfAPDzjhxCDIqmbBgwZLUWh7+P1Zey78+n NJdFVDQu5aDMqIvyUUPUsrd5fTZT150JjmpekqLILi2PwVbVHXZIjuPPci7ALLbNmsBt xvQlc6Cu68W9HurBcYeFDhMo1PXdneTp5JIlu61n8S9d8d/pMujhHBBRsdYsyeYPqR2M 3Uw6wmNZjG+R6Azi3hJLW4dZEvuA2jt301T8sj9iROcHCoeOWcTacmEqSfr04Rq+u9rz lIwp3dtTMTR6wcOmmX2aZa3ath0lQWgKEYaRVetgs+7WbCGA3g/fJW57DFSfdrHua5hd C2Yw== 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 q20si9182013eja.339.2019.11.16.23.21.33; Sat, 16 Nov 2019 23:21:33 -0800 (PST) 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 S1726104AbfKQHVW (ORCPT + 26 others); Sun, 17 Nov 2019 02:21:22 -0500 Received: from mx2.suse.de ([195.135.220.15]:40748 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725909AbfKQHVW (ORCPT ); Sun, 17 Nov 2019 02:21:22 -0500 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 CA4DFB22C; Sun, 17 Nov 2019 07:21:19 +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 v3 2/8] ARM: Prepare Realtek RTD1195 Date: Sun, 17 Nov 2019 08:21:03 +0100 Message-Id: <20191117072109.20402-3-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191117072109.20402-1-afaerber@suse.de> References: <20191117072109.20402-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 --- v2 -> v3: * Fixed r-bus size in .reserve from 0x100000 to 0x70000 (James) 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 9771b56e79f1..cd37b5e9f86d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -699,6 +699,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..b31a4066be87 --- /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, 0x00070000); + 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