From patchwork Wed Sep 25 06:43:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFtZXMgVGFpIFvmiLTlv5fls7Bd?= X-Patchwork-Id: 11160061 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BF511599 for ; Wed, 25 Sep 2019 06:45:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F20C821D7B for ; Wed, 25 Sep 2019 06:45:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AjWoBGkE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F20C821D7B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=u9LbbxnssG+OBFmP3d3tMt1zkhJDx/MvXviPaCHdRss=; b=AjWoBGkEYFc+sY PJSg90v4ARMTPxU0J5owfrxOrYpoRE7T26kMo34iE8XQLVVtRxDGITRPJvmh7KpmtxmOAEda7NwXC Yjcuv7q/mgIKSsgTxK7/1mZFgap5YCwQCOpzD6K8wb4CExDfunr5zxonDzzL+Qoa8AuxX6tVaLAy7 shfCnbS2TSuUUaNBn3IKs0g4srNPmPqvVEo1nZ20Cah+IRtdHm4LWKi6BEODiuRBIaXg8vkws/5OM /YhuFZd43q3ek2MilGqN2N6AJAPrUmFxcFhp3eCrR7V7HBdu8fPgHYwUM4ru4Ra8Jm+MstWTa8Tir I97DiCWaC00rv1Lkqe5g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iD131-00045L-0D; Wed, 25 Sep 2019 06:45:11 +0000 Received: from rtits2.realtek.com ([211.75.126.72] helo=rtits2.realtek.com.tw) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iD12x-0002lU-5F for linux-arm-kernel@lists.infradead.org; Wed, 25 Sep 2019 06:45:09 +0000 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x8P6hmvS000685, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTITCAS11.realtek.com.tw[172.21.6.12]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x8P6hmvS000685 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Sep 2019 14:43:48 +0800 Received: from RTITMBSVM04.realtek.com.tw ([fe80::e404:880:2ef1:1aa1]) by RTITCAS11.realtek.com.tw ([fe80::7c6d:ced5:c4ff:8297%15]) with mapi id 14.03.0468.000; Wed, 25 Sep 2019 14:43:46 +0800 From: James Tai To: "'Masahiro Yamada'" , "'Arnd Bergmann'" Subject: [PATCH v1] ARM: Add support for Realtek SOC Thread-Topic: [PATCH v1] ARM: Add support for Realtek SOC Thread-Index: AdVza7e7/HSc6pgzSMeYxrV2x7H8ew== Date: Wed, 25 Sep 2019 06:43:45 +0000 Message-ID: <43B123F21A8CFE44A9641C099E4196FFCF8EA2B1@RTITMBSVM04.realtek.com.tw> Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.21.6.95] MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190924_234507_459071_387C70B3 X-CRM114-Status: GOOD ( 14.30 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "'Jason A . Donenfeld'" , =?utf-8?b?Q1lfSHVhbmdb6buD?= =?utf-8?b?6Ymm5pmPXQ==?= , 'Linus Walleij' , 'Stefan Agner' , 'Benjamin Gaignard' , =?utf-8?b?U2ltb24gSHN1?= =?utf-8?b?W+W+kOaWh+e/sF0=?= , 'Mauro Carvalho Chehab' , =?utf-8?b?VG9tIFRp?= =?utf-8?b?bmdb5LiB6YOB5bqtXQ==?= , =?utf-8?b?SmltIFRz?= =?utf-8?b?YWkgW+iUoee2reaZiV0=?= , Phinex Hung , =?utf-8?b?RWR3YXJkIFd1W+WQs+WlleWvrF0=?= , 'Rob Herring' , 'Lorenzo Pieralisi' , 'Russell King' , 'Mike Rapoport' , =?utf-8?b?WUhfSHNpZWhb6Kyd5a6H5YuzXQ==?= , =?utf-8?b?VFlfQ2hhbmdb5by15a2Q6YC4XQ==?= , 'Thierry Reding' , "'jamestai.sky@gmail.com'" , =?utf-8?b?WlJfQ2hlbls=?= =?utf-8?b?6Zmz5oyv5qauXQ==?= , Hau , Yukuen , =?utf-8?b?Smlubi5DaGVu?= =?utf-8?b?Z1vphK3miY3pgLJd?= , =?utf-8?b?Q2hhc2Ug?= =?utf-8?b?WWVuIFvpoY/lkYjogrJd?= , =?utf-8?b?U3Rh?= =?utf-8?b?bmxleSBDaGFuZ1vmmIzogrLlvrdd?= , 'Doug Anderson' , 'Linux ARM' , =?utf-8?b?RXJpYyBXYW5n?= =?utf-8?b?W+eOi+WBieWFqF0=?= , Adklei , James Tai , =?utf-8?b?RWRnYXIgTGVlIFvmnY7mib/oq61d?= , 'Ard Biesheuvel' , =?utf-8?b?UEsuQ2h1YW5nIFs=?= =?utf-8?b?6I6K5Y2a5YexXQ==?= , 'Nicolas Pitre' , 'Nick Desaulniers' , "'linux-kernel@vger.kernel.org'" , 'Paul Burton' , phelic , =?utf-8?b?J0FuZHJlYXMgRsOkcmJlcic=?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: "james.tai" This patch adds the basic machine file for the Realtek RTD16XX and RTD13XX platform. Signed-off-by: james.tai --- Changes since last version: - Add RTD13XX platform. - Add PSCI support. - Add ARCH_MULTI_V7 config. - remove 'textofs-$(CONFIG_ARCH_REALTEK) := 0x00208000' from 'arch/arm/Makefile'. - remove map_io,init_time,init_machine and smp_init from machine descriptor. --- arch/arm/Kconfig | 2 ++ arch/arm/Makefile | 1 + arch/arm/mach-realtek/Kconfig | 20 +++++++++++++ arch/arm/mach-realtek/Makefile | 3 ++ arch/arm/mach-realtek/platsmp.c | 51 +++++++++++++++++++++++++++++++++ arch/arm/mach-realtek/platsmp.h | 6 ++++ arch/arm/mach-realtek/realtek.c | 43 +++++++++++++++++++++++++++ 7 files changed, 126 insertions(+) create mode 100644 arch/arm/mach-realtek/Kconfig create mode 100644 arch/arm/mach-realtek/Makefile create mode 100644 arch/arm/mach-realtek/platsmp.c create mode 100644 arch/arm/mach-realtek/platsmp.h create mode 100644 arch/arm/mach-realtek/realtek.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 33b00579beff..1f7967c97267 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -793,6 +793,8 @@ source "arch/arm/mach-realview/Kconfig" source "arch/arm/mach-rockchip/Kconfig" +source "arch/arm/mach-realtek/Kconfig" + source "arch/arm/mach-s3c24xx/Kconfig" source "arch/arm/mach-s3c64xx/Kconfig" diff --git a/arch/arm/Makefile b/arch/arm/Makefile index c3624ca6c0bc..560ae7d72aab 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -205,6 +205,7 @@ machine-$(CONFIG_ARCH_RDA) += rda machine-$(CONFIG_ARCH_REALVIEW) += realview machine-$(CONFIG_ARCH_ROCKCHIP) += rockchip machine-$(CONFIG_ARCH_RPC) += rpc +machine-$(CONFIG_ARCH_REALTEK) += realtek machine-$(CONFIG_ARCH_S3C24XX) += s3c24xx machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx machine-$(CONFIG_ARCH_S5PV210) += s5pv210 diff --git a/arch/arm/mach-realtek/Kconfig b/arch/arm/mach-realtek/Kconfig new file mode 100644 index 000000000000..a638f4322bb2 --- /dev/null +++ b/arch/arm/mach-realtek/Kconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only +menuconfig ARCH_REALTEK + bool "Realtek SoC Support" + depends on ARCH_MULTI_V7 + help + Support for Realtek rtd16xx & rtd13xx SoCs. + +if ARCH_REALTEK + +config ARCH_RTD13XX + bool "Enable support for RTD1319" + select ARM_GIC_V3 + select ARM_PSCI + +config ARCH_RTD16XX + bool "Enable support for RTD1619" + select ARM_GIC_V3 + select ARM_PSCI + +endif diff --git a/arch/arm/mach-realtek/Makefile b/arch/arm/mach-realtek/Makefile new file mode 100644 index 000000000000..9cdc1f1f2917 --- /dev/null +++ b/arch/arm/mach-realtek/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_ARCH_REALTEK) += realtek.o +obj-$(CONFIG_SMP) += platsmp.o diff --git a/arch/arm/mach-realtek/platsmp.c b/arch/arm/mach-realtek/platsmp.c new file mode 100644 index 000000000000..b3fc99447ad4 --- /dev/null +++ b/arch/arm/mach-realtek/platsmp.c @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2019 Realtek Semiconductor Corp. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BL31_CMD 0x8400ff04 +#define BL31_DAT 0x00001619 +#define CORE_PWRDN_EN 0x1 + +#define CPUPWRCTLR __ACCESS_CP15(c15, 0, c2, 7) + +#ifdef CONFIG_HOTPLUG_CPU + +static void rtk_cpu_die(unsigned int cpu) +{ + struct arm_smccc_res res; + unsigned int cpu_pwr_ctrl; + + /* notify BL31 cpu hotplug */ + arm_smccc_smc(BL31_CMD, BL31_DAT, 0, 0, 0, 0, 0, 0, &res); + v7_exit_coherency_flush(louis); + + cpu_pwr_ctrl = read_sysreg(CPUPWRCTLR); + cpu_pwr_ctrl |= CORE_PWRDN_EN; + write_sysreg(cpu_pwr_ctrl, CPUPWRCTLR); + + dsb(sy); + + for (;;) + wfi(); +} +#endif + +struct smp_operations rtk_smp_ops __initdata = { +#ifdef CONFIG_HOTPLUG_CPU + .cpu_die = rtk_cpu_die, +#endif +}; diff --git a/arch/arm/mach-realtek/platsmp.h b/arch/arm/mach-realtek/platsmp.h new file mode 100644 index 000000000000..c9c4d712369c --- /dev/null +++ b/arch/arm/mach-realtek/platsmp.h @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2019 Realtek Semiconductor Corp. + */ + +extern struct smp_operations rtk_smp_ops; diff --git a/arch/arm/mach-realtek/realtek.c b/arch/arm/mach-realtek/realtek.c new file mode 100644 index 000000000000..2692ac53f59b --- /dev/null +++ b/arch/arm/mach-realtek/realtek.c @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2019 Realtek Semiconductor Corp. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "platsmp.h" + +static const char *const rtd13xx_board_dt_compat[] = { + "realtek,rtd1319", + NULL, +}; + +static const char *const rtd16xx_board_dt_compat[] = { + "realtek,rtd1619", + NULL, +}; + +DT_MACHINE_START(RTD13XX, "Realtek rtd13xx platform") + .dt_compat = rtd13xx_board_dt_compat, + .smp = smp_ops(rtk_smp_ops), +MACHINE_END + +DT_MACHINE_START(RTD16XX, "Realtek rtd16xx platform") + .dt_compat = rtd16xx_board_dt_compat, + .smp = smp_ops(rtk_smp_ops), +MACHINE_END