summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-06-09 07:59:04 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-06-17 08:28:55 +0200
commit47740c32087930089fc9e0a07fd254676780554a (patch)
treea285aded16eafc7882c9594fc81fa6ec01165527 /arch
parenta38be63831aa3c5696581a58c8afb5bfc11e45d5 (diff)
downloadbarebox-47740c32087930089fc9e0a07fd254676780554a.tar.gz
barebox-47740c32087930089fc9e0a07fd254676780554a.tar.xz
ARM: rpi: move bcm2835_add_device_sdram() into header
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> Link: https://lore.barebox.org/20220609055922.667016-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boards/raspberry-pi/rpi-common.c4
-rw-r--r--arch/arm/mach-bcm283x/Makefile2
-rw-r--r--arch/arm/mach-bcm283x/core.c40
-rw-r--r--arch/arm/mach-bcm283x/include/mach/core.h21
4 files changed, 13 insertions, 54 deletions
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 05d59ae6bf..aeb7eef145 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 e5ef78af97..d681764413 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 f2528cf1f1..0000000000
--- 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 a1c47f9154..bd272b925d 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)
{