From patchwork Tue Nov 19 15:01:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Brugger X-Patchwork-Id: 1197504 X-Patchwork-Delegate: matthias.bgg@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="ckCxOIrf"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47HTbS3wPGz9sPf for ; Wed, 20 Nov 2019 02:03:16 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 42F0EC21FC2; Tue, 19 Nov 2019 15:01:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5E19DC21FB3; Tue, 19 Nov 2019 15:01:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4BE65C21FBE; Tue, 19 Nov 2019 15:01:20 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by lists.denx.de (Postfix) with ESMTPS id DDFBEC21FB4 for ; Tue, 19 Nov 2019 15:01:17 +0000 (UTC) Received: from ziggy.de (unknown [37.223.145.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4B0802231D; Tue, 19 Nov 2019 15:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574175676; bh=3dBuf7hEWiQj0IY9b5MWDDs2q8YX2GQYz7nSZomTUw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ckCxOIrfeg9uSLd7Q9MYbU0vXZwblVvcQgq/XkXAWkvneFYk02Fdjri+b/0K+vVXb E56+BfyL2UnIiB5l0Rb5CVdT68KZieCkbs7gaZ39HDDC3oLvzaeNivKQH+tY8HZ4eF xk9ujnY5KP2lCbOs3tcAPeLoC0gZTRm2fKHEl6PQ= From: matthias.bgg@kernel.org To: u-boot@lists.denx.de, Alexander Graf , fvogt@suse.com, matthias.bgg@kernel.org Date: Tue, 19 Nov 2019 16:01:04 +0100 Message-Id: <20191119150105.6515-4-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119150105.6515-1-matthias.bgg@kernel.org> References: <20191119150105.6515-1-matthias.bgg@kernel.org> MIME-Version: 1.0 Cc: Matthias Brugger Subject: [U-Boot] [PATCH v4 3/4] ARM: bcm283x: Set rpi_bcm283x_base at run-time X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Matthias Brugger As part of the effort to create one binary for several bcm83x SoCs we read the IO base address from device-tree. Signed-off-by: Matthias Brugger --- Changes in v4: - read IO base from device-tree Changes in v3: None Changes in v2: - rename BCM2838 to BCM2711 in the correct patch - push rpi_bcm283x_base into the .data section arch/arm/mach-bcm283x/Kconfig | 6 ------ arch/arm/mach-bcm283x/init.c | 20 ++++++++++++++++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig index b08275f598..e8e0ff0eb4 100644 --- a/arch/arm/mach-bcm283x/Kconfig +++ b/arch/arm/mach-bcm283x/Kconfig @@ -202,10 +202,4 @@ config SYS_SOC config SYS_CONFIG_NAME default "rpi" -config BCM283x_BASE - hex - default "0x20000000" if BCM2835 - default "0x3f000000" if BCM2836 || BCM2837 - default "0xfe000000" if BCM2711 - endmenu diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index d36017e823..b3f3dfabea 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -7,8 +7,10 @@ */ #include +#include +#include -unsigned long rpi_bcm283x_base; +unsigned long rpi_bcm283x_base = 0x3f000000; int arch_cpu_init(void) { @@ -19,10 +21,24 @@ int arch_cpu_init(void) int mach_cpu_init(void) { - rpi_bcm283x_base = CONFIG_BCM283x_BASE; + int ret, soc_offset; + u64 io_base, size; + + /* Get IO base from device tree */ + soc_offset = fdt_path_offset(gd->fdt_blob, "/soc"); + if (soc_offset < 0) + return soc_offset; + + ret = fdt_read_range((void *)gd->fdt_blob, soc_offset, 0, NULL, + &io_base, &size); + if (ret) + return ret; + + rpi_bcm283x_base = io_base; return 0; } + #ifdef CONFIG_ARMV7_LPAE void enable_caches(void) {