Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp537612pxb; Tue, 5 Apr 2022 13:16:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5q/MHsDAd+T/ATc/V5YJa7ebmXUl7Rl338w5MhtsSvpaHjhHCN3GK6gD/vdJV5m6B2Api X-Received: by 2002:a05:6a00:124f:b0:4fb:37ad:16d3 with SMTP id u15-20020a056a00124f00b004fb37ad16d3mr5391017pfi.14.1649189813742; Tue, 05 Apr 2022 13:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649189813; cv=none; d=google.com; s=arc-20160816; b=N+z+bVE8YJY5nXniFdmZnqPazmT+vlSwkTx6UkGgv/ls08/4JR7WveQPdWD87veXcf lrFFG/c+mtB8J41gfbSx3sVXtJTf4rQdZ0P1K5U7bmjqAYN4WM1KRtTS/hOzXL166Q58 AiliwmJEgjR43ZEdB1kztVE9By5xylAZX3kVOTsDT9DDblIp8P4X5xuKCGlJA1GmsoUr Qxl43YLw6MeSoP1Z5MbybfxwyXEGBQyY7nBGua97OkfisTQHvisvufiU7eIaiZu4muAJ mWQw7x0qxRyRCMz/i/9PCHY97yT15lf+cjhgg4RjAiLOmHhpd1P/LNnJFoipXqbK1p5R DUyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=VB2GOO75wRQ8o8TKtdAJv2rMOudd+8BVIu80NZtk9Ks=; b=uSZUA8D6tLc+tDdSb7LBaCwxr32Lo9PK+y4M4WXhR1a/VEQ/wsmaPXKg//Pwqo+thH WTjaTBHy1sQFflYfuc/djzsk+bJCXmIQHhxlqppGUDwHTdW41yH2WwHESlDr+7klZvVY 0Omms4JPoX97S7cr55TSlFY6I6wXgN2W1T8P4j+lvWkl0OpDvt064EUQPw+Jg+RFzGBT sTPSGdzFyk7lLEUEXBR4z0wxnEc8X8llBih6VOQq72X8ayqxMyrKQMR5a3NPgGEc/nPr qk91Z1e5XLHhUj2U6J4cjGtUkzfqZSlGkzPjjNCgbf8FzExQQ64nlvO4O3wGTzENrG6s l49A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=sbF8ZztC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j14-20020a63b60e000000b003816043f0cdsi13356955pgf.706.2022.04.05.13.16.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 13:16:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=sbF8ZztC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A40B2DFDF6; Tue, 5 Apr 2022 13:15:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245305AbiDEOMJ (ORCPT + 99 others); Tue, 5 Apr 2022 10:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236135AbiDEJbN (ORCPT ); Tue, 5 Apr 2022 05:31:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4CFF26FA; Tue, 5 Apr 2022 02:18:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 65FAEB81B62; Tue, 5 Apr 2022 09:18:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 200F6C385AC; Tue, 5 Apr 2022 09:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649150313; bh=J6wtCACpXBxLmkz/EnCKwxs03UNfKLPJWoTIRgLakyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sbF8ZztCBrqYcjuwKSVQCiU3VGjPjEz3Tye5ptnnpKrxGhc8riDbmT+V8Oq5SZGyy dEzr2RGLAXRp5rN636zq2zXhCJIUbvm3fYB2A68PY9RufYkgdmj7D+7BymNlCCdZs/ eRzM5C760LUirkjJvrgnDwVWGShrPVJiFvQyYVJVIMmZ6OwMk6KcDI/LpW5G4kU8dt d/kbIFqmxXff97E9GGvcxxcBTFZW5GhgosYEaOtAkKeE/lO4gTG5hb6WUjfEPTsSTc Q2N8r2QLLzL8A9Xmr0B7IPyd5oddNm1Oasj71bxHcpZDtlJ/XhJBYFQpbLBaa/3ST9 xzLnDaOFom/Ew== From: Arnd Bergmann Cc: Arnd Bergmann , Russell King , Hartley Sweeten , Alexander Sverdlin , Hubert Feurstein , Lukasz Majewski , Krzysztof Kozlowski , Alim Akhtar , Linus Walleij , Imre Kaloz , Krzysztof Halasa , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Simtec Linux Team , Liviu Dudau , Sudeep Holla , Lorenzo Pieralisi , Ard Biesheuvel , Stephen Boyd , Geert Uytterhoeven , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, patches@opensource.cirrus.com Subject: [PATCH 05/12] ARM: ep93xx: multiplatform support Date: Tue, 5 Apr 2022 11:17:43 +0200 Message-Id: <20220405091750.3076973-6-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20220405091750.3076973-1-arnd@kernel.org> References: <20220405091750.3076973-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann With the clock support and the interrupts out of the way, ep93xx can be compiled into the same kernel image as the other ARMv4/v5 platforms. The last obstacle are the two workarounds for broken boot loaders that require us to re-initialize the ethernet controller and/or the watchdog on certain machines. Move this code into the decompressor sources directly, checking for each possibly affected machine individually. Signed-off-by: Arnd Bergmann --- arch/arm/Kconfig | 16 ----- .../compressed/misc-ep93xx.h} | 69 +++++++++---------- arch/arm/boot/compressed/misc.c | 4 ++ arch/arm/configs/ep93xx_defconfig | 2 + arch/arm/mach-ep93xx/Kconfig | 12 ++++ 5 files changed, 51 insertions(+), 52 deletions(-) rename arch/arm/{mach-ep93xx/include/mach/uncompress.h => boot/compressed/misc-ep93xx.h} (51%) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5177e54cc14c..2bd611beefe1 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -347,22 +347,6 @@ config ARCH_MULTIPLATFORM select SPARSE_IRQ select USE_OF -config ARCH_EP93XX - bool "EP93xx-based" - select ARCH_SPARSEMEM_ENABLE - select ARM_AMBA - imply ARM_PATCH_PHYS_VIRT - select ARM_VIC - select AUTO_ZRELADDR - select CLKSRC_MMIO - select CPU_ARM920T - select GPIOLIB - select COMMON_CLK - select IRQ_DOMAIN - select SPARSE_IRQ - help - This enables support for the Cirrus EP93xx series of CPUs. - config ARCH_FOOTBRIDGE bool "FootBridge" select CPU_SA110 diff --git a/arch/arm/mach-ep93xx/include/mach/uncompress.h b/arch/arm/boot/compressed/misc-ep93xx.h similarity index 51% rename from arch/arm/mach-ep93xx/include/mach/uncompress.h rename to arch/arm/boot/compressed/misc-ep93xx.h index e20bcab702b2..3dc942589cba 100644 --- a/arch/arm/mach-ep93xx/include/mach/uncompress.h +++ b/arch/arm/boot/compressed/misc-ep93xx.h @@ -1,54 +1,25 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ /* - * arch/arm/mach-ep93xx/include/mach/uncompress.h - * * Copyright (C) 2006 Lennert Buytenhek */ #include -static unsigned char __raw_readb(unsigned int ptr) -{ - return *((volatile unsigned char *)ptr); -} - -static unsigned int __raw_readl(unsigned int ptr) +static inline unsigned int __raw_readl(unsigned int ptr) { return *((volatile unsigned int *)ptr); } -static void __raw_writeb(unsigned char value, unsigned int ptr) +static inline void __raw_writeb(unsigned char value, unsigned int ptr) { *((volatile unsigned char *)ptr) = value; } -static void __raw_writel(unsigned int value, unsigned int ptr) +static inline void __raw_writel(unsigned int value, unsigned int ptr) { *((volatile unsigned int *)ptr) = value; } -#define PHYS_UART_DATA (CONFIG_DEBUG_UART_PHYS + 0x00) -#define PHYS_UART_FLAG (CONFIG_DEBUG_UART_PHYS + 0x18) -#define UART_FLAG_TXFF 0x20 - -static inline void putc(int c) -{ - int i; - - for (i = 0; i < 10000; i++) { - /* Transmit fifo not full? */ - if (!(__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF)) - break; - } - - __raw_writeb(c, PHYS_UART_DATA); -} - -static inline void flush(void) -{ -} - - /* * Some bootloaders don't turn off DMA from the ethernet MAC before * jumping to linux, which means that we might end up with bits of RX @@ -58,7 +29,7 @@ static inline void flush(void) #define PHYS_ETH_SELF_CTL 0x80010020 #define ETH_SELF_CTL_RESET 0x00000001 -static void ethernet_reset(void) +static inline void ep93xx_ethernet_reset(void) { unsigned int v; @@ -75,15 +46,41 @@ static void ethernet_reset(void) #define TS72XX_WDT_FEED_PHYS_BASE 0x23c00000 #define TS72XX_WDT_FEED_VAL 0x05 -static void __maybe_unused ts72xx_watchdog_disable(void) +static inline void __maybe_unused ts72xx_watchdog_disable(void) { __raw_writeb(TS72XX_WDT_FEED_VAL, TS72XX_WDT_FEED_PHYS_BASE); __raw_writeb(0, TS72XX_WDT_CONTROL_PHYS_BASE); } -static void arch_decomp_setup(void) +static inline void ep93xx_decomp_setup(void) { if (machine_is_ts72xx()) ts72xx_watchdog_disable(); - ethernet_reset(); + + if (machine_is_adssphere() || + machine_is_edb9301() || + machine_is_edb9302() || + machine_is_edb9302a() || + machine_is_edb9302a() || + machine_is_edb9307() || + machine_is_edb9307a() || + machine_is_edb9307a() || + machine_is_edb9312() || + machine_is_edb9315() || + machine_is_edb9315a() || + machine_is_edb9315a() || + machine_is_gesbc9312() || + machine_is_micro9() || + machine_is_micro9l() || + machine_is_micro9m() || + machine_is_micro9s() || + machine_is_micro9m() || + machine_is_micro9l() || + machine_is_micro9s() || + machine_is_sim_one() || + machine_is_snapper_cl15() || + machine_is_ts72xx() || + machine_is_bk3() || + machine_is_vision_ep9307()) + ep93xx_ethernet_reset(); } diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index c3c66ff2d696..cb2e069dc73f 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -23,6 +23,7 @@ unsigned int __machine_arch_type; #include #include #include "misc.h" +#include "misc-ep93xx.h" static void putstr(const char *ptr); @@ -143,6 +144,9 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, free_mem_end_ptr = free_mem_ptr_end_p; __machine_arch_type = arch_id; +#ifdef CONFIG_ARCH_EP93XX + ep93xx_decomp_setup(); +#endif arch_decomp_setup(); putstr("Uncompressing Linux..."); diff --git a/arch/arm/configs/ep93xx_defconfig b/arch/arm/configs/ep93xx_defconfig index 88d5ecc2121e..fef802b7af8c 100644 --- a/arch/arm/configs/ep93xx_defconfig +++ b/arch/arm/configs/ep93xx_defconfig @@ -11,6 +11,8 @@ CONFIG_MODULE_UNLOAD=y CONFIG_MODULE_FORCE_UNLOAD=y # CONFIG_BLK_DEV_BSG is not set CONFIG_PARTITION_ADVANCED=y +CONFIG_ARCH_MULTI_V4T=y +# CONFIG_ARCH_MULTI_V7 is not set CONFIG_ARCH_EP93XX=y CONFIG_MACH_ADSSPHERE=y CONFIG_MACH_EDB9301=y diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig index 15c68a646d51..aa502ab57404 100644 --- a/arch/arm/mach-ep93xx/Kconfig +++ b/arch/arm/mach-ep93xx/Kconfig @@ -1,4 +1,16 @@ # SPDX-License-Identifier: GPL-2.0-only +menuconfig ARCH_EP93XX + bool "EP93xx-based" + depends on ARCH_MULTI_V4T + select ARCH_SPARSEMEM_ENABLE + select ARM_AMBA + select ARM_VIC + select CLKSRC_MMIO + select CPU_ARM920T + select GPIOLIB + help + This enables support for the Cirrus EP93xx series of CPUs. + if ARCH_EP93XX menu "Cirrus EP93xx Implementation Options" -- 2.29.2