* [PATCH v2 1/4] commands: reginfo: make command mpc5xxx-specific
@ 2024-11-25 15:13 Ahmad Fatoum
2024-11-25 15:13 ` [PATCH v2 2/4] include: common.h: move out get_ram_size Ahmad Fatoum
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2024-11-25 15:13 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The reginfo command sounds very generic, but it's actually only used on
the PowerPC MPC5xxx. Move the command there.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- define normal command instead of DEFINE_SIMPLE_COMMAND in previous
series
---
arch/powerpc/mach-mpc5xxx/Kconfig | 4 ----
arch/powerpc/mach-mpc5xxx/Makefile | 2 +-
arch/powerpc/mach-mpc5xxx/reginfo.c | 13 ++++++++++++-
commands/Kconfig | 11 -----------
commands/Makefile | 1 -
commands/reginfo.c | 21 ---------------------
include/common.h | 5 -----
7 files changed, 13 insertions(+), 44 deletions(-)
delete mode 100644 commands/reginfo.c
diff --git a/arch/powerpc/mach-mpc5xxx/Kconfig b/arch/powerpc/mach-mpc5xxx/Kconfig
index e78c2fa350b1..df6d8c187459 100644
--- a/arch/powerpc/mach-mpc5xxx/Kconfig
+++ b/arch/powerpc/mach-mpc5xxx/Kconfig
@@ -7,10 +7,6 @@ config ARCH_TEXT_BASE
default 0x00000000 if RELOCATABLE
default 0x01000000 if MACH_PHYCORE_MPC5200B_TINY
-config HAS_REGINFO
- bool
- default y if ARCH_MPC5200
-
choice
prompt "Select your board"
diff --git a/arch/powerpc/mach-mpc5xxx/Makefile b/arch/powerpc/mach-mpc5xxx/Makefile
index 9fc45c08bb31..b9b4cb8e434e 100644
--- a/arch/powerpc/mach-mpc5xxx/Makefile
+++ b/arch/powerpc/mach-mpc5xxx/Makefile
@@ -8,4 +8,4 @@ obj-y += traps.o
obj-y += time.o
extra-y += start.o
obj-$(CONFIG_MPC5200) += firmware_sc_task_bestcomm.impl.o
-obj-$(CONFIG_REGINFO) += reginfo.o
+obj-$(CONFIG_COMMAND_SUPPORT) += reginfo.o
diff --git a/arch/powerpc/mach-mpc5xxx/reginfo.c b/arch/powerpc/mach-mpc5xxx/reginfo.c
index 64816faffc22..dd33a82601ac 100644
--- a/arch/powerpc/mach-mpc5xxx/reginfo.c
+++ b/arch/powerpc/mach-mpc5xxx/reginfo.c
@@ -4,9 +4,11 @@
#include <common.h>
#include <config.h>
#include <mach/mpc5xxx.h>
+#include <command.h>
+#include <complete.h>
#include <asm/io.h>
-void reginfo(void)
+static int do_reginfo(int argc, char *argv[])
{
puts ("\nMPC5200 registers\n");
printf ("MBAR=%08x\n", CFG_MBAR);
@@ -60,4 +62,13 @@ void reginfo(void)
in_be32((void*)MPC5XXX_SDRAM_CS0CFG));
printf ("\tSDRAMCS1: %08X\n",
in_be32((void*)MPC5XXX_SDRAM_CS1CFG));
+
+ return 0;
}
+
+BAREBOX_CMD_START(reginfo)
+ .cmd = do_reginfo,
+ BAREBOX_CMD_DESC("print MPC5200 register information")
+ BAREBOX_CMD_GROUP(CMD_GRP_INFO)
+ BAREBOX_CMD_COMPLETE(empty_complete)
+BAREBOX_CMD_END
diff --git a/commands/Kconfig b/commands/Kconfig
index 4a0486861186..313fa51dcadd 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -1,8 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
-config REGINFO
- bool
-
config COMMAND_SUPPORT
bool
depends on !SHELL_NONE
@@ -247,14 +244,6 @@ config CMD_ARM_MMUINFO
SuperSection [1]: 0x0
Failure [0]: 0x0
-config CMD_REGINFO
- depends on HAS_REGINFO
- select REGINFO
- tristate
- prompt "reginfo"
- help
- Print register information.
-
config CMD_BLKSTATS
bool
depends on BLOCK
diff --git a/commands/Makefile b/commands/Makefile
index ff5d713ca72c..a98c39637cee 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -37,7 +37,6 @@ obj-$(CONFIG_CMD_CAT) += cat.o
obj-$(CONFIG_CMD_MOUNT) += mount.o
obj-$(CONFIG_CMD_UMOUNT) += umount.o
obj-$(CONFIG_CMD_FINDMNT) += findmnt.o
-obj-$(CONFIG_CMD_REGINFO) += reginfo.o
obj-$(CONFIG_CMD_CRC) += crc.o
obj-$(CONFIG_CMD_CLEAR) += clear.o
obj-$(CONFIG_CMD_TEST) += test.o
diff --git a/commands/reginfo.c b/commands/reginfo.c
deleted file mode 100644
index bd46cf15e7de..000000000000
--- a/commands/reginfo.c
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-// SPDX-FileCopyrightText: © 2007 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
-
-/* reginfo.c - print information about SoC specifc registers */
-
-#include <common.h>
-#include <command.h>
-#include <complete.h>
-
-static int do_reginfo(int argc, char *argv[])
-{
- reginfo();
- return 0;
-}
-
-BAREBOX_CMD_START(reginfo)
- .cmd = do_reginfo,
- BAREBOX_CMD_DESC("print register information")
- BAREBOX_CMD_GROUP(CMD_GRP_INFO)
- BAREBOX_CMD_COMPLETE(empty_complete)
-BAREBOX_CMD_END
diff --git a/include/common.h b/include/common.h
index dd0d6548e5db..1f00baf8067a 100644
--- a/include/common.h
+++ b/include/common.h
@@ -23,11 +23,6 @@
#include <linux/printk.h>
#include <barebox-info.h>
-/*
- * Function Prototypes
- */
-void reginfo(void);
-
/* common/memsize.c */
long get_ram_size (volatile long *, long);
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/4] include: common.h: move out get_ram_size
2024-11-25 15:13 [PATCH v2 1/4] commands: reginfo: make command mpc5xxx-specific Ahmad Fatoum
@ 2024-11-25 15:13 ` Ahmad Fatoum
2024-11-25 15:13 ` [PATCH v2 3/4] include: align: reword STACK_ALIGN_ARRAY macro parameter for clarity Ahmad Fatoum
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2024-11-25 15:13 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The function get_ram_size() is the last function remaining that's only
defined in common.h. Let's move it to barebox.h instead, so users don't
need to include everything else that's in common.h at the same time.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- no change
---
include/barebox.h | 2 ++
include/common.h | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/barebox.h b/include/barebox.h
index 45e95f187462..0341f303470b 100644
--- a/include/barebox.h
+++ b/include/barebox.h
@@ -43,4 +43,6 @@ enum autoboot_state do_autoboot_countdown(void);
void __noreturn start_barebox(void);
void shutdown_barebox(void);
+long get_ram_size(volatile long *base, long size);
+
#endif
diff --git a/include/common.h b/include/common.h
index 1f00baf8067a..16a08fe293af 100644
--- a/include/common.h
+++ b/include/common.h
@@ -23,7 +23,4 @@
#include <linux/printk.h>
#include <barebox-info.h>
-/* common/memsize.c */
-long get_ram_size (volatile long *, long);
-
#endif /* __COMMON_H_ */
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 3/4] include: align: reword STACK_ALIGN_ARRAY macro parameter for clarity
2024-11-25 15:13 [PATCH v2 1/4] commands: reginfo: make command mpc5xxx-specific Ahmad Fatoum
2024-11-25 15:13 ` [PATCH v2 2/4] include: common.h: move out get_ram_size Ahmad Fatoum
@ 2024-11-25 15:13 ` Ahmad Fatoum
2024-11-25 15:13 ` [PATCH v2 4/4] ARM: bcm283x: remove common.h include in mbox.h Ahmad Fatoum
2024-11-28 9:28 ` [PATCH v2 1/4] commands: reginfo: make command mpc5xxx-specific Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2024-11-25 15:13 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Instead of using an ambiguous parameter name 'size' and having a comment
to clarify what's meant by it, just rename it nelems to make clear that
it's the number of elements that should be specified as argument.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- no change
---
include/linux/align.h | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/include/linux/align.h b/include/linux/align.h
index 3b0c60d6e9ae..ff3134db9ea1 100644
--- a/include/linux/align.h
+++ b/include/linux/align.h
@@ -15,12 +15,9 @@
/*
* The STACK_ALIGN_ARRAY macro is used to allocate a buffer on the stack that
* meets a minimum alignment requirement.
- *
- * Note that the size parameter is the number of array elements to allocate,
- * not the number of bytes.
- */
-#define STACK_ALIGN_ARRAY(type, name, size, align) \
- char __##name[sizeof(type) * (size) + (align) - 1]; \
- type *name = (type *)ALIGN((unsigned long)__##name, align)
+ */
+#define STACK_ALIGN_ARRAY(type, name, nelems, align) \
+ char __##name[sizeof(type) * (nelems) + (align) - 1]; \
+ type *name = (type *)ALIGN((uintptr_t)__##name, align)
#endif
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 4/4] ARM: bcm283x: remove common.h include in mbox.h
2024-11-25 15:13 [PATCH v2 1/4] commands: reginfo: make command mpc5xxx-specific Ahmad Fatoum
2024-11-25 15:13 ` [PATCH v2 2/4] include: common.h: move out get_ram_size Ahmad Fatoum
2024-11-25 15:13 ` [PATCH v2 3/4] include: align: reword STACK_ALIGN_ARRAY macro parameter for clarity Ahmad Fatoum
@ 2024-11-25 15:13 ` Ahmad Fatoum
2024-11-28 9:28 ` [PATCH v2 1/4] commands: reginfo: make command mpc5xxx-specific Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2024-11-25 15:13 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Now that common.h is finally just a list of files to include, we can
start removing the inclusion of common.h in other headers and include
only what's actually needed.
Let's start with the raspberry Pi mailbox header and make it (and its
users) only include what's actually needed.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- no change
---
arch/arm/boards/raspberry-pi/mbox-helpers.c | 1 +
include/mach/bcm283x/mbox.h | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boards/raspberry-pi/mbox-helpers.c b/arch/arm/boards/raspberry-pi/mbox-helpers.c
index 3a76ac2b012f..489eb0c91313 100644
--- a/arch/arm/boards/raspberry-pi/mbox-helpers.c
+++ b/arch/arm/boards/raspberry-pi/mbox-helpers.c
@@ -2,6 +2,7 @@
// SPDX-FileCopyrightText: 2009 Carlo Caione <carlo@carlocaione.org>
#include <mach/bcm283x/mbox.h>
+#include <linux/printk.h>
#include "lowlevel.h"
struct msg_get_arm_mem {
diff --git a/include/mach/bcm283x/mbox.h b/include/mach/bcm283x/mbox.h
index cf5143673ab3..fc51b6597560 100644
--- a/include/mach/bcm283x/mbox.h
+++ b/include/mach/bcm283x/mbox.h
@@ -9,7 +9,9 @@
#ifndef _BCM2835_MBOX_H
#define _BCM2835_MBOX_H
-#include <common.h>
+#include <linux/align.h>
+#include <linux/types.h>
+#include <linux/string.h>
#include <mach/bcm283x/platform.h>
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/4] commands: reginfo: make command mpc5xxx-specific
2024-11-25 15:13 [PATCH v2 1/4] commands: reginfo: make command mpc5xxx-specific Ahmad Fatoum
` (2 preceding siblings ...)
2024-11-25 15:13 ` [PATCH v2 4/4] ARM: bcm283x: remove common.h include in mbox.h Ahmad Fatoum
@ 2024-11-28 9:28 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-11-28 9:28 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Mon, 25 Nov 2024 16:13:50 +0100, Ahmad Fatoum wrote:
> The reginfo command sounds very generic, but it's actually only used on
> the PowerPC MPC5xxx. Move the command there.
>
>
Applied, thanks!
[1/4] commands: reginfo: make command mpc5xxx-specific
https://git.pengutronix.de/cgit/barebox/commit/?id=e9a83b4c3fec (link may not be stable)
[2/4] include: common.h: move out get_ram_size
https://git.pengutronix.de/cgit/barebox/commit/?id=0ccff8cc19d3 (link may not be stable)
[3/4] include: align: reword STACK_ALIGN_ARRAY macro parameter for clarity
https://git.pengutronix.de/cgit/barebox/commit/?id=921613ba9c08 (link may not be stable)
[4/4] ARM: bcm283x: remove common.h include in mbox.h
https://git.pengutronix.de/cgit/barebox/commit/?id=e36001c647da (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-28 9:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-25 15:13 [PATCH v2 1/4] commands: reginfo: make command mpc5xxx-specific Ahmad Fatoum
2024-11-25 15:13 ` [PATCH v2 2/4] include: common.h: move out get_ram_size Ahmad Fatoum
2024-11-25 15:13 ` [PATCH v2 3/4] include: align: reword STACK_ALIGN_ARRAY macro parameter for clarity Ahmad Fatoum
2024-11-25 15:13 ` [PATCH v2 4/4] ARM: bcm283x: remove common.h include in mbox.h Ahmad Fatoum
2024-11-28 9:28 ` [PATCH v2 1/4] commands: reginfo: make command mpc5xxx-specific Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox