[U-Boot] [PATCH] ARM: rmobile: ulcb/salvator-x: re-enable rcar-common/common.c

v2018.01 commit e23eb942ad103f ("ARM: rmobile: Stop using rcar-common/common.c on Gen3") removed board/renesas/rcar-common/common.c from the build chain. The reasoning is that calling arch_preboot_os() is no more needed.
However, we use this file as a place for R-Car common features / functionalities, shared by both Renesas reference targets and any custom R-Car boards. Without such file, we have to duplicate lots of code into board-specific *.c files.
Restore rcar-common/common.c and zap the unneeded arch_preboot_os(). No functional change intended.
Signed-off-by: Eugeniu Rosca erosca@de.adit-jv.com --- board/renesas/rcar-common/common.c | 53 ------------------------------ board/renesas/salvator-x/Makefile | 2 +- board/renesas/ulcb/Makefile | 2 +- 3 files changed, 2 insertions(+), 55 deletions(-)
diff --git a/board/renesas/rcar-common/common.c b/board/renesas/rcar-common/common.c index 1129f4bf0c08..1ce6e2eac1bf 100644 --- a/board/renesas/rcar-common/common.c +++ b/board/renesas/rcar-common/common.c @@ -8,57 +8,4 @@ */
#include <common.h> -#include <asm/io.h> -#include <asm/arch/sys_proto.h> #include <asm/arch/rmobile.h> -#include <asm/arch/rcar-mstp.h> - -#define TSTR0 0x04 -#define TSTR0_STR0 0x01 - -static struct mstp_ctl mstptbl[] = { - { SMSTPCR0, MSTP0_BITS, CONFIG_SMSTP0_ENA, - RMSTPCR0, MSTP0_BITS, CONFIG_RMSTP0_ENA }, - { SMSTPCR1, MSTP1_BITS, CONFIG_SMSTP1_ENA, - RMSTPCR1, MSTP1_BITS, CONFIG_RMSTP1_ENA }, - { SMSTPCR2, MSTP2_BITS, CONFIG_SMSTP2_ENA, - RMSTPCR2, MSTP2_BITS, CONFIG_RMSTP2_ENA }, - { SMSTPCR3, MSTP3_BITS, CONFIG_SMSTP3_ENA, - RMSTPCR3, MSTP3_BITS, CONFIG_RMSTP3_ENA }, - { SMSTPCR4, MSTP4_BITS, CONFIG_SMSTP4_ENA, - RMSTPCR4, MSTP4_BITS, CONFIG_RMSTP4_ENA }, - { SMSTPCR5, MSTP5_BITS, CONFIG_SMSTP5_ENA, - RMSTPCR5, MSTP5_BITS, CONFIG_RMSTP5_ENA }, -#ifdef CONFIG_RCAR_GEN3 - { SMSTPCR6, MSTP6_BITS, CONFIG_SMSTP6_ENA, - RMSTPCR6, MSTP6_BITS, CONFIG_RMSTP6_ENA }, -#endif - { SMSTPCR7, MSTP7_BITS, CONFIG_SMSTP7_ENA, - RMSTPCR7, MSTP7_BITS, CONFIG_RMSTP7_ENA }, - { SMSTPCR8, MSTP8_BITS, CONFIG_SMSTP8_ENA, - RMSTPCR8, MSTP8_BITS, CONFIG_RMSTP8_ENA }, - { SMSTPCR9, MSTP9_BITS, CONFIG_SMSTP9_ENA, - RMSTPCR9, MSTP9_BITS, CONFIG_RMSTP9_ENA }, - { SMSTPCR10, MSTP10_BITS, CONFIG_SMSTP10_ENA, - RMSTPCR10, MSTP10_BITS, CONFIG_RMSTP10_ENA }, - { SMSTPCR11, MSTP11_BITS, CONFIG_SMSTP1_ENA, - RMSTPCR11, MSTP11_BITS, CONFIG_RMSTP11_ENA }, -}; - -void arch_preboot_os(void) -{ - int i; - - /* stop TMU0 */ - mstp_clrbits_le32(TMU_BASE + TSTR0, TMU_BASE + TSTR0, TSTR0_STR0); - - /* Stop module clock */ - for (i = 0; i < ARRAY_SIZE(mstptbl); i++) { - mstp_setclrbits_le32((uintptr_t)mstptbl[i].s_addr, - mstptbl[i].s_dis, - mstptbl[i].s_ena); - mstp_setclrbits_le32((uintptr_t)mstptbl[i].r_addr, - mstptbl[i].r_dis, - mstptbl[i].r_ena); - } -} diff --git a/board/renesas/salvator-x/Makefile b/board/renesas/salvator-x/Makefile index 5b4dea91c141..61b0d063e592 100644 --- a/board/renesas/salvator-x/Makefile +++ b/board/renesas/salvator-x/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y := salvator-x.o +obj-y := salvator-x.o ../rcar-common/common.o diff --git a/board/renesas/ulcb/Makefile b/board/renesas/ulcb/Makefile index 406fdc8fa404..6fe0b480f77e 100644 --- a/board/renesas/ulcb/Makefile +++ b/board/renesas/ulcb/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y := ulcb.o cpld.o +obj-y := ulcb.o cpld.o ../rcar-common/common.o

On 4/9/19 5:08 PM, Eugeniu Rosca wrote:
v2018.01 commit e23eb942ad103f ("ARM: rmobile: Stop using rcar-common/common.c on Gen3") removed board/renesas/rcar-common/common.c from the build chain. The reasoning is that calling arch_preboot_os() is no more needed.
However, we use this file as a place for R-Car common features / functionalities, shared by both Renesas reference targets and any custom R-Car boards. Without such file, we have to duplicate lots of code into board-specific *.c files.
Restore rcar-common/common.c and zap the unneeded arch_preboot_os(). No functional change intended.
Signed-off-by: Eugeniu Rosca erosca@de.adit-jv.com
board/renesas/rcar-common/common.c | 53 ------------------------------ board/renesas/salvator-x/Makefile | 2 +- board/renesas/ulcb/Makefile | 2 +- 3 files changed, 2 insertions(+), 55 deletions(-)
diff --git a/board/renesas/rcar-common/common.c b/board/renesas/rcar-common/common.c index 1129f4bf0c08..1ce6e2eac1bf 100644 --- a/board/renesas/rcar-common/common.c +++ b/board/renesas/rcar-common/common.c @@ -8,57 +8,4 @@ */
#include <common.h> -#include <asm/io.h> -#include <asm/arch/sys_proto.h> #include <asm/arch/rmobile.h> -#include <asm/arch/rcar-mstp.h>
-#define TSTR0 0x04 -#define TSTR0_STR0 0x01
-static struct mstp_ctl mstptbl[] = {
- { SMSTPCR0, MSTP0_BITS, CONFIG_SMSTP0_ENA,
RMSTPCR0, MSTP0_BITS, CONFIG_RMSTP0_ENA },
- { SMSTPCR1, MSTP1_BITS, CONFIG_SMSTP1_ENA,
RMSTPCR1, MSTP1_BITS, CONFIG_RMSTP1_ENA },
- { SMSTPCR2, MSTP2_BITS, CONFIG_SMSTP2_ENA,
RMSTPCR2, MSTP2_BITS, CONFIG_RMSTP2_ENA },
- { SMSTPCR3, MSTP3_BITS, CONFIG_SMSTP3_ENA,
RMSTPCR3, MSTP3_BITS, CONFIG_RMSTP3_ENA },
- { SMSTPCR4, MSTP4_BITS, CONFIG_SMSTP4_ENA,
RMSTPCR4, MSTP4_BITS, CONFIG_RMSTP4_ENA },
- { SMSTPCR5, MSTP5_BITS, CONFIG_SMSTP5_ENA,
RMSTPCR5, MSTP5_BITS, CONFIG_RMSTP5_ENA },
-#ifdef CONFIG_RCAR_GEN3
- { SMSTPCR6, MSTP6_BITS, CONFIG_SMSTP6_ENA,
RMSTPCR6, MSTP6_BITS, CONFIG_RMSTP6_ENA },
-#endif
- { SMSTPCR7, MSTP7_BITS, CONFIG_SMSTP7_ENA,
RMSTPCR7, MSTP7_BITS, CONFIG_RMSTP7_ENA },
- { SMSTPCR8, MSTP8_BITS, CONFIG_SMSTP8_ENA,
RMSTPCR8, MSTP8_BITS, CONFIG_RMSTP8_ENA },
- { SMSTPCR9, MSTP9_BITS, CONFIG_SMSTP9_ENA,
RMSTPCR9, MSTP9_BITS, CONFIG_RMSTP9_ENA },
- { SMSTPCR10, MSTP10_BITS, CONFIG_SMSTP10_ENA,
RMSTPCR10, MSTP10_BITS, CONFIG_RMSTP10_ENA },
- { SMSTPCR11, MSTP11_BITS, CONFIG_SMSTP1_ENA,
RMSTPCR11, MSTP11_BITS, CONFIG_RMSTP11_ENA },
-};
-void arch_preboot_os(void) -{
- int i;
- /* stop TMU0 */
- mstp_clrbits_le32(TMU_BASE + TSTR0, TMU_BASE + TSTR0, TSTR0_STR0);
- /* Stop module clock */
- for (i = 0; i < ARRAY_SIZE(mstptbl); i++) {
mstp_setclrbits_le32((uintptr_t)mstptbl[i].s_addr,
mstptbl[i].s_dis,
mstptbl[i].s_ena);
mstp_setclrbits_le32((uintptr_t)mstptbl[i].r_addr,
mstptbl[i].r_dis,
mstptbl[i].r_ena);
- }
-}
This should be a separate patch, one which only removes this code which is unused. Presumably the whole file should just be removed.
diff --git a/board/renesas/salvator-x/Makefile b/board/renesas/salvator-x/Makefile index 5b4dea91c141..61b0d063e592 100644 --- a/board/renesas/salvator-x/Makefile +++ b/board/renesas/salvator-x/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y := salvator-x.o +obj-y := salvator-x.o ../rcar-common/common.o diff --git a/board/renesas/ulcb/Makefile b/board/renesas/ulcb/Makefile index 406fdc8fa404..6fe0b480f77e 100644 --- a/board/renesas/ulcb/Makefile +++ b/board/renesas/ulcb/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y := ulcb.o cpld.o +obj-y := ulcb.o cpld.o ../rcar-common/common.o
This ends up including an empty file, which is useless.

On Tue, Apr 09, 2019 at 05:23:17PM +0200, Marek Vasut wrote:
On 4/9/19 5:08 PM, Eugeniu Rosca wrote:
[..]
diff --git a/board/renesas/rcar-common/common.c b/board/renesas/rcar-common/common.c
[..]
This should be a separate patch, one which only removes this code which is unused. Presumably the whole file should just be removed.
[..]
diff --git a/board/renesas/ulcb/Makefile b/board/renesas/ulcb/Makefile
-obj-y := ulcb.o cpld.o +obj-y := ulcb.o cpld.o ../rcar-common/common.o
This ends up including an empty file, which is useless.
Do you plan to push a v2 for https://patchwork.ozlabs.org/patch/1051603/ ?
If so, board/renesas/rcar-common/common.c might be the perfect place to host the duplicated code, i.e. you will need to re-add board/renesas/rcar-common/common.c to the build chain.
-- Best regards, Marek Vasut
Best regards, Eugeniu.

On 4/9/19 5:34 PM, Eugeniu Rosca wrote:
On Tue, Apr 09, 2019 at 05:23:17PM +0200, Marek Vasut wrote:
On 4/9/19 5:08 PM, Eugeniu Rosca wrote:
[..]
diff --git a/board/renesas/rcar-common/common.c b/board/renesas/rcar-common/common.c
[..]
This should be a separate patch, one which only removes this code which is unused. Presumably the whole file should just be removed.
[..]
diff --git a/board/renesas/ulcb/Makefile b/board/renesas/ulcb/Makefile
-obj-y := ulcb.o cpld.o +obj-y := ulcb.o cpld.o ../rcar-common/common.o
This ends up including an empty file, which is useless.
Do you plan to push a v2 for https://patchwork.ozlabs.org/patch/1051603/ ?
I was rather thinking of doing a follow-up patch, so that in case something broke, I could bisect it. And maybe this is actually better, since I could apply the patches in this order: - The DRAM DT config - The common.c cleanup of this patch - Perform the deduplication as needed and enable common.c in the build
So can you split the common.c cleanup from this patch so I can use it?
If so, board/renesas/rcar-common/common.c might be the perfect place to host the duplicated code, i.e. you will need to re-add board/renesas/rcar-common/common.c to the build chain.
-- Best regards, Marek Vasut
Best regards, Eugeniu.

On Tue, Apr 09, 2019 at 06:00:57PM +0200, Marek Vasut wrote:
On 4/9/19 5:34 PM, Eugeniu Rosca wrote:
On Tue, Apr 09, 2019 at 05:23:17PM +0200, Marek Vasut wrote:
On 4/9/19 5:08 PM, Eugeniu Rosca wrote:
[..]
diff --git a/board/renesas/rcar-common/common.c b/board/renesas/rcar-common/common.c
[..]
This should be a separate patch, one which only removes this code which is unused. Presumably the whole file should just be removed.
[..]
diff --git a/board/renesas/ulcb/Makefile b/board/renesas/ulcb/Makefile
-obj-y := ulcb.o cpld.o +obj-y := ulcb.o cpld.o ../rcar-common/common.o
This ends up including an empty file, which is useless.
Do you plan to push a v2 for https://patchwork.ozlabs.org/patch/1051603/ ?
I was rather thinking of doing a follow-up patch, so that in case something broke, I could bisect it. And maybe this is actually better, since I could apply the patches in this order:
- The DRAM DT config
- The common.c cleanup of this patch
- Perform the deduplication as needed and enable common.c in the build
The sequence looks good to me.
So can you split the common.c cleanup from this patch so I can use it?
Done in https://patchwork.ozlabs.org/patch/1082549/
If so, board/renesas/rcar-common/common.c might be the perfect place to host the duplicated code, i.e. you will need to re-add board/renesas/rcar-common/common.c to the build chain.
-- Best regards, Marek Vasut
Best regards, Eugeniu.
participants (2)
-
Eugeniu Rosca
-
Marek Vasut