From 6756762024ccacf48e1419a02e0880f337a9030f Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 31 Aug 2019 17:33:06 +0200 Subject: sh: tmu: Fix SH4 TCNT0 offset Fix the offset of TCNT0 register, which is 0xc on SH4. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- arch/sh/include/asm/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/sh/include/asm/config.h b/arch/sh/include/asm/config.h index df38c82abc6..406156dff51 100644 --- a/arch/sh/include/asm/config.h +++ b/arch/sh/include/asm/config.h @@ -10,7 +10,7 @@ /* Timer */ #define CONFIG_SYS_TIMER_COUNTS_DOWN -#define CONFIG_SYS_TIMER_COUNTER (TMU_BASE + 0x8) /* TCNT0 */ +#define CONFIG_SYS_TIMER_COUNTER (TMU_BASE + 0xc) /* TCNT0 */ #define CONFIG_SYS_TIMER_RATE (CONFIG_SYS_CLK_FREQ / 4) #endif -- cgit v1.3.1 From ee3a4a708a36fec81126d86f6baabaf4e053ed22 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 1 Sep 2019 18:05:03 +0200 Subject: sh: Fix OF_SEPARATE support If the OF_SEPARATE is enabled, the DT is appended past the _end symbol. The current code however clears BSS very early, which overwrites the DT blob with zeroes. Moreover, the early code relocates U-Boot into RAM to the correct location, but does not relocate the DT. This patch adds code to relocate the DT and avoids clearing BSS too early, thus addressing both problems with OF_SEPARATE on SH. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- arch/sh/cpu/u-boot.lds | 1 + arch/sh/lib/start.S | 14 ++++++++++++++ 2 files changed, 15 insertions(+) (limited to 'arch') diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds index 7b225a6bd9a..47302da252a 100644 --- a/arch/sh/cpu/u-boot.lds +++ b/arch/sh/cpu/u-boot.lds @@ -75,6 +75,7 @@ SECTIONS PROVIDE (__init_end = .); PROVIDE (reloc_dst_end = .); + PROVIDE (_end = .); PROVIDE (bss_start = .); PROVIDE (__bss_start = .); diff --git a/arch/sh/lib/start.S b/arch/sh/lib/start.S index f5350b90643..f9f26d37798 100644 --- a/arch/sh/lib/start.S +++ b/arch/sh/lib/start.S @@ -22,6 +22,17 @@ _start: mov.l ._reloc_dst, r4 add #(_start-1b), r5 mov.l ._reloc_dst_end, r6 +#ifdef CONFIG_OF_SEPARATE + mov.l ._reloc_size, r0 + add r5, r0 + add #4, r0 + mov.l @r0, r0 + swap.b r0, r0 + swap.w r0, r0 + swap.b r0, r0 + add #4, r0 + add r0, r6 +#endif 2: mov.l @r5+, r1 mov.l r1, @r4 @@ -29,6 +40,7 @@ _start: cmp/hs r6, r4 bf 2b +#ifndef CONFIG_OF_SEPARATE mov.l ._bss_start, r4 mov.l ._bss_end, r5 mov #0, r1 @@ -37,6 +49,7 @@ _start: add #4, r4 cmp/hs r5, r4 bf 3b +#endif mov.l ._gd_init, r13 /* global data */ mov.l ._stack_init, r15 /* stack */ @@ -53,6 +66,7 @@ loop: ._lowlevel_init: .long (lowlevel_init - (100b + 4)) ._reloc_dst: .long _start ._reloc_dst_end: .long reloc_dst_end +._reloc_size: .long (_end - _start) ._bss_start: .long bss_start ._bss_end: .long bss_end ._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE) -- cgit v1.3.1 From 8c2c46350d937bae357dc3f69adcbff0022f70ec Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 31 Aug 2019 18:27:58 +0200 Subject: sh: r2dplus: Enable OF control Enable OF control for SH4 R2Dplus board. This is necessary, because the PCI uclass is designed in a way that makes it depend on DT and disallows instanciating devices without DT (e.g. with platdata). Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- arch/Kconfig | 1 + arch/sh/dts/Makefile | 12 ++++++++++++ arch/sh/dts/sh7751-r2dplus.dts | 12 ++++++++++++ arch/sh/include/asm/config.h | 2 ++ configs/r2dplus_defconfig | 2 ++ 5 files changed, 29 insertions(+) create mode 100644 arch/sh/dts/Makefile create mode 100644 arch/sh/dts/sh7751-r2dplus.dts (limited to 'arch') diff --git a/arch/Kconfig b/arch/Kconfig index f4ada57909a..141e48bc439 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -137,6 +137,7 @@ config SANDBOX config SH bool "SuperH architecture" select HAVE_PRIVATE_LIBGCC + select SUPPORT_OF_CONTROL config X86 bool "x86 architecture" diff --git a/arch/sh/dts/Makefile b/arch/sh/dts/Makefile new file mode 100644 index 00000000000..e423bfd5664 --- /dev/null +++ b/arch/sh/dts/Makefile @@ -0,0 +1,12 @@ +dtb-y += sh7751-r2dplus.dtb + +targets += $(dtb-y) + +# Add any required device tree compiler flags here +DTC_FLAGS += + +PHONY += dtbs +dtbs: $(addprefix $(obj)/, $(dtb-y)) + @: + +clean-files := *.dtb *_HS diff --git a/arch/sh/dts/sh7751-r2dplus.dts b/arch/sh/dts/sh7751-r2dplus.dts new file mode 100644 index 00000000000..2d291bf1ee2 --- /dev/null +++ b/arch/sh/dts/sh7751-r2dplus.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the SH7751 R2Dplus + * + * Copyright (C) 2019 Marek Vasut + */ + +/dts-v1/; +/ { + model = "R2D"; + compatible = "renesas,r2d", "renesas,sh7751"; +}; diff --git a/arch/sh/include/asm/config.h b/arch/sh/include/asm/config.h index 406156dff51..e1cd322152a 100644 --- a/arch/sh/include/asm/config.h +++ b/arch/sh/include/asm/config.h @@ -8,6 +8,8 @@ #include +#define CONFIG_LMB + /* Timer */ #define CONFIG_SYS_TIMER_COUNTS_DOWN #define CONFIG_SYS_TIMER_COUNTER (TMU_BASE + 0xc) /* TCNT0 */ diff --git a/configs/r2dplus_defconfig b/configs/r2dplus_defconfig index 43bf97cb771..51a8587b61a 100644 --- a/configs/r2dplus_defconfig +++ b/configs/r2dplus_defconfig @@ -16,6 +16,8 @@ CONFIG_CMD_PING=y CONFIG_CMD_CACHE=y CONFIG_CMD_EXT2=y CONFIG_DOS_PARTITION=y +CONFIG_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="sh7751-r2dplus" CONFIG_ENV_IS_IN_FLASH=y CONFIG_DM=y CONFIG_MTD_NOR_FLASH=y -- cgit v1.3.1 From eaae4ee2bd349797a69f74240abd8329e18d5dbd Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 31 Aug 2019 18:25:21 +0200 Subject: sh: r2dplus: Switch to DM PCI driver Add DT entry for the DM PCI driver, update board configs and drop ad-hoc board init code for the PCI bus. Instead, let the DM PCI driver initialize and operate the hardware. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- arch/sh/dts/sh7751-r2dplus.dts | 14 ++++++++++++++ board/renesas/r2dplus/r2dplus.c | 7 ------- configs/r2dplus_defconfig | 2 ++ include/configs/r2dplus.h | 13 ------------- 4 files changed, 16 insertions(+), 20 deletions(-) (limited to 'arch') diff --git a/arch/sh/dts/sh7751-r2dplus.dts b/arch/sh/dts/sh7751-r2dplus.dts index 2d291bf1ee2..ecaf0772d8f 100644 --- a/arch/sh/dts/sh7751-r2dplus.dts +++ b/arch/sh/dts/sh7751-r2dplus.dts @@ -9,4 +9,18 @@ / { model = "R2D"; compatible = "renesas,r2d", "renesas,sh7751"; + + pci@fe200000 { + compatible = "renesas,pci-sh7751"; + device_type = "pci"; + reg = <0 0xfe200000 0 0x1000>; + status = "okay"; + + bus-range = <0 0>; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + ranges = <0x01000000 0 0xfe240000 0 0xfe240000 0 0x00040000 + 0x02000000 0 0xfd000000 0 0xfd000000 0 0x01000000>; + }; }; diff --git a/board/renesas/r2dplus/r2dplus.c b/board/renesas/r2dplus/r2dplus.c index f0773267b10..6eff98706f7 100644 --- a/board/renesas/r2dplus/r2dplus.c +++ b/board/renesas/r2dplus/r2dplus.c @@ -9,7 +9,6 @@ #include #include #include -#include int checkboard(void) { @@ -45,12 +44,6 @@ void ide_set_reset(int idereset) } } -static struct pci_controller hose; -void pci_init_board(void) -{ - pci_sh7751_init(&hose); -} - int board_eth_init(bd_t *bis) { return pci_eth_init(bis); diff --git a/configs/r2dplus_defconfig b/configs/r2dplus_defconfig index 51a8587b61a..b2334affc3e 100644 --- a/configs/r2dplus_defconfig +++ b/configs/r2dplus_defconfig @@ -25,5 +25,7 @@ CONFIG_FLASH_CFI_DRIVER=y CONFIG_SYS_FLASH_CFI=y CONFIG_RTL8139=y CONFIG_PCI=y +CONFIG_DM_PCI=y +CONFIG_DM_PCI_COMPAT=y CONFIG_SCIF_CONSOLE=y CONFIG_USE_PRIVATE_LIBGCC=y diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h index e10de1b9207..0b16fb0f64e 100644 --- a/include/configs/r2dplus.h +++ b/include/configs/r2dplus.h @@ -64,19 +64,6 @@ /* * SuperH PCI Bridge Configration */ -#define CONFIG_SH4_PCI #define CONFIG_SH7751_PCI -#define CONFIG_PCI_SCAN_SHOW 1 -#define __mem_pci - -#define CONFIG_PCI_MEM_BUS 0xFD000000 /* Memory space base addr */ -#define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS -#define CONFIG_PCI_MEM_SIZE 0x01000000 /* Size of Memory window */ -#define CONFIG_PCI_IO_BUS 0xFE240000 /* IO space base address */ -#define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS -#define CONFIG_PCI_IO_SIZE 0x00040000 /* Size of IO window */ -#define CONFIG_PCI_SYS_BUS CONFIG_SYS_SDRAM_BASE -#define CONFIG_PCI_SYS_PHYS CONFIG_SYS_SDRAM_BASE -#define CONFIG_PCI_SYS_SIZE CONFIG_SYS_SDRAM_SIZE #endif /* __CONFIG_H */ -- cgit v1.3.1