mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 03/21] ARM: rpi: move bcm2835_add_device_sdram() into header
Date: Thu,  9 Jun 2022 07:59:04 +0200	[thread overview]
Message-ID: <20220609055922.667016-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20220609055922.667016-1-a.fatoum@pengutronix.de>

We will repurpose core.c in a later commit. It has a single function
similar in spirit to bcm2835_register_fb which lives in a header, so
move it there too.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/raspberry-pi/rpi-common.c |  4 ++-
 arch/arm/mach-bcm283x/Makefile            |  2 +-
 arch/arm/mach-bcm283x/core.c              | 40 -----------------------
 arch/arm/mach-bcm283x/include/mach/core.h | 21 +++++-------
 4 files changed, 13 insertions(+), 54 deletions(-)
 delete mode 100644 arch/arm/mach-bcm283x/core.c

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 05d59ae6bf97..aeb7eef145cd 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -221,8 +221,10 @@ static int rpi_mem_init(void)
 	int ret;
 
 	ret = rpi_get_arm_mem(&size);
-	if (ret)
+	if (ret) {
 		printf("could not query ARM memory size\n");
+		size = get_ram_size((ulong *) BCM2835_SDRAM_BASE, SZ_128M);
+	}
 
 	bcm2835_add_device_sdram(size);
 
diff --git a/arch/arm/mach-bcm283x/Makefile b/arch/arm/mach-bcm283x/Makefile
index e5ef78af978f..d68176441322 100644
--- a/arch/arm/mach-bcm283x/Makefile
+++ b/arch/arm/mach-bcm283x/Makefile
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-obj-y += core.o mbox.o
+obj-y += mbox.o
diff --git a/arch/arm/mach-bcm283x/core.c b/arch/arm/mach-bcm283x/core.c
deleted file mode 100644
index f2528cf1f150..000000000000
--- a/arch/arm/mach-bcm283x/core.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Carlo Caione <carlo@carlocaione.org>
- *
- * Based on mach-nomadik
- * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <common.h>
-#include <init.h>
-
-#include <linux/clk.h>
-#include <linux/clkdev.h>
-#include <linux/err.h>
-
-#include <io.h>
-#include <asm/armlinux.h>
-#include <linux/sizes.h>
-
-#include <mach/platform.h>
-#include <mach/core.h>
-#include <linux/amba/bus.h>
-
-void bcm2835_add_device_sdram(u32 size)
-{
-	if (!size)
-		size = get_ram_size((ulong *) BCM2835_SDRAM_BASE, SZ_128M);
-
-	arm_add_mem_device("ram0", BCM2835_SDRAM_BASE, size);
-}
diff --git a/arch/arm/mach-bcm283x/include/mach/core.h b/arch/arm/mach-bcm283x/include/mach/core.h
index a1c47f915448..bd272b925df5 100644
--- a/arch/arm/mach-bcm283x/include/mach/core.h
+++ b/arch/arm/mach-bcm283x/include/mach/core.h
@@ -1,24 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2009 Carlo Caione <carlo@carlocaione.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
  */
 
 #ifndef __BCM2835_CORE_H__
 #define __BCM2835_CORE_H__
 
+#include <common.h>
+#include <linux/types.h>
+#include <linux/sizes.h>
+#include <asm/memory.h>
 #include <mach/platform.h>
 
-void bcm2835_add_device_sdram(u32 size);
+static void inline bcm2835_add_device_sdram(u32 size)
+{
+	arm_add_mem_device("ram0", BCM2835_SDRAM_BASE, size);
+}
 
 static void inline bcm2835_register_fb(void)
 {
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2022-06-09  6:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 01/21] ARM64: asm: implement read_cpuid_id() Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 02/21] dma: add dma_sync nop stubs for PBL Ahmad Fatoum
2022-06-14  8:49   ` Sascha Hauer
2022-06-14  9:00     ` Ahmad Fatoum
2022-06-09  5:59 ` Ahmad Fatoum [this message]
2022-06-09  5:59 ` [PATCH v2 04/21] ARM: rpi: support PBL use of mbox Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 05/21] ARM: rpi: split out mbox helpers to share code with PBL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 06/21] ARM: rpi: switch to ARM_USE_COMPRESSED_DTB Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 07/21] ARM: rpi: add generic Raspberry Pi image Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 08/21] ARM: rpi: support FDT in x0 for 64bit configurations Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 09/21] serial: ns16550: rpi: remove ungating now done by proper clk driver Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 10/21] ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 11/21] ARM: cpu: remove unnecessary CONFIG_SYS_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 12/21] ARM: cpu: remove unused SYS_SUPPORTS_32BIT_KERNEL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 13/21] ARM: rpi: add Raspberry Pi 3 64-bit build support Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 14/21] ARM: rpi: rpi3: disallow MMU_EARLY && 64BIT Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 15/21] clk: rpi: add Raspberry Pi 4 support Ahmad Fatoum
2022-06-09 13:58   ` Sascha Hauer
2022-06-09 14:15     ` Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 16/21] mci: bcm2835: add bcm2711-emmc2 (Rpi4) support Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 17/21] clocksource: bcm2835: bump below architeced timer for AArch64 Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 18/21] ARM: rpi: add Raspberry Pi 4 support Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 19/21] ARM: rpi: add debug_ll support for Raspberry Pi 4 Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 20/21] doc: bcm283x: reference newer firmware Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 21/21] ARM: rpi: use correct kernel8.img as name for 64-bit Ahmad Fatoum
2022-06-10  8:33 ` [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220609055922.667016-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox