[U-Boot] [PATCH 1/3] bmips: ram: add an option to force the size of the ram

This adds an option to force the size of the ram, and avoid the detection of ram size.
Signed-off-by: Philippe Reynes philippe.reynes@softathome.com --- drivers/ram/bmips_ram.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/ram/bmips_ram.c b/drivers/ram/bmips_ram.c index cc37dfa..b5f19c9 100644 --- a/drivers/ram/bmips_ram.c +++ b/drivers/ram/bmips_ram.c @@ -43,6 +43,7 @@ struct bmips_ram_hw {
struct bmips_ram_priv { void __iomem *regs; + u32 force_size; const struct bmips_ram_hw *hw; };
@@ -104,7 +105,10 @@ static int bmips_ram_get_info(struct udevice *dev, struct ram_info *info) const struct bmips_ram_hw *hw = priv->hw;
info->base = 0x80000000; - info->size = hw->get_ram_size(priv); + if (priv->force_size) + info->size = priv->force_size; + else + info->size = hw->get_ram_size(priv);
return 0; } @@ -155,6 +159,8 @@ static int bmips_ram_probe(struct udevice *dev) if (!priv->regs) return -EINVAL;
+ dev_read_u32(dev, "force-size", &priv->force_size); + priv->hw = hw;
return 0;

This adds the initial support of the Broadcom BCM6838 SoC familly, only cpu, dram, uart and leds are supported.
Signed-off-by: Philippe Reynes philippe.reynes@softathome.com --- arch/mips/dts/brcm,bcm6838.dtsi | 75 +++++++++++++++++++++++++++++++++++++++++ arch/mips/mach-bmips/Kconfig | 13 +++++++ drivers/cpu/bmips_cpu.c | 33 ++++++++++++++++++ include/configs/bmips_bcm6838.h | 24 +++++++++++++ 4 files changed, 145 insertions(+) create mode 100644 arch/mips/dts/brcm,bcm6838.dtsi create mode 100644 include/configs/bmips_bcm6838.h
diff --git a/arch/mips/dts/brcm,bcm6838.dtsi b/arch/mips/dts/brcm,bcm6838.dtsi new file mode 100644 index 0000000..d365d0f --- /dev/null +++ b/arch/mips/dts/brcm,bcm6838.dtsi @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Philippe Reynes philippe.reynes@softathome.com + */ + +#include "skeleton.dtsi" + +/ { + compatible = "brcm,bcm6838"; + + cpus { + reg = <0x14e00000 0x4>; + #address-cells = <1>; + #size-cells = <0>; + u-boot,dm-pre-reloc; + + cpu@0 { + compatible = "brcm,bcm6838-cpu", "mips,mips4Kc"; + device_type = "cpu"; + reg = <0>; + u-boot,dm-pre-reloc; + }; + + cpu@1 { + compatible = "brcm,bcm6838-cpu", "mips,mips4Kc"; + device_type = "cpu"; + reg = <1>; + u-boot,dm-pre-reloc; + }; + }; + + clocks { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + u-boot,dm-pre-reloc; + + periph_osc: periph-osc { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <50000000>; + u-boot,dm-pre-reloc; + }; + }; + + ubus { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + u-boot,dm-pre-reloc; + + memory: memory-controller@12000000 { + compatible = "brcm,bcm6328-mc"; + reg = <0x12000000 0x1000>; + u-boot,dm-pre-reloc; + }; + + uart0: serial@14e00500 { + compatible = "brcm,bcm6345-uart"; + reg = <0x14e00500 0x18>; + clocks = <&periph_osc>; + + status = "disabled"; + }; + + leds: led-controller@14e00f00 { + compatible = "brcm,bcm6328-leds"; + reg = <0x14e00f00 0x28>; + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + }; + }; +}; diff --git a/arch/mips/mach-bmips/Kconfig b/arch/mips/mach-bmips/Kconfig index 10900bf..dffffe5 100644 --- a/arch/mips/mach-bmips/Kconfig +++ b/arch/mips/mach-bmips/Kconfig @@ -14,6 +14,7 @@ config SYS_SOC default "bcm6368" if SOC_BMIPS_BCM6368 default "bcm6362" if SOC_BMIPS_BCM6362 default "bcm63268" if SOC_BMIPS_BCM63268 + default "bcm6838" if SOC_BMIPS_BCM6838
choice prompt "Broadcom MIPS SoC select" @@ -118,6 +119,18 @@ config SOC_BMIPS_BCM63268 This supports BMIPS BCM63268 family including BCM63168, BCM63169, BCM63268 and BCM63269.
+config SOC_BMIPS_BCM6838 + bool "BMIPS BCM6838 family" + select SUPPORTS_BIG_ENDIAN + select SUPPORTS_CPU_MIPS32_R1 + select MIPS_TUNE_4KC + select MIPS_L1_CACHE_SHIFT_4 + select SWAP_IO_SPACE + select SYSRESET_SYSCON + help + This supports BMIPS BCM6838 family including BCM68380, BCM68381, + and BCM68385. + endchoice
choice diff --git a/drivers/cpu/bmips_cpu.c b/drivers/cpu/bmips_cpu.c index 78560b0..fc04747 100644 --- a/drivers/cpu/bmips_cpu.c +++ b/drivers/cpu/bmips_cpu.c @@ -66,6 +66,10 @@ #define STRAPBUS_63268_FCVO_SHIFT 21 #define STRAPBUS_63268_FCVO_MASK (0xf << STRAPBUS_63268_FCVO_SHIFT)
+#define REG_BCM6838_OTP_BRCMBITS0 0x440 +#define VIPER_6838_FREQ_SHIFT 18 +#define VIPER_6838_FREQ_MASK (0x7 << VIPER_6838_FREQ_SHIFT) + struct bmips_cpu_priv;
struct bmips_cpu_hw { @@ -272,6 +276,26 @@ static ulong bcm63268_get_cpu_freq(struct bmips_cpu_priv *priv) } }
+static ulong bcm6838_get_cpu_freq(struct bmips_cpu_priv *priv) +{ + unsigned int mips_viper_freq; + + mips_viper_freq = readl_be(priv->regs + REG_BCM6838_OTP_BRCMBITS0); + mips_viper_freq = (mips_viper_freq & VIPER_6838_FREQ_MASK) + >> VIPER_6838_FREQ_SHIFT; + + switch (mips_viper_freq) { + case 0x0: + return 600000000; + case 0x1: + return 400000000; + case 0x2: + return 240000000; + default: + return 0; + } +} + static int bcm6328_get_cpu_count(struct bmips_cpu_priv *priv) { u32 val = readl_be(priv->regs + REG_BCM6328_OTP); @@ -346,6 +370,12 @@ static const struct bmips_cpu_hw bmips_cpu_bcm63268 = { .get_cpu_count = bcm6358_get_cpu_count, };
+static const struct bmips_cpu_hw bmips_cpu_bcm6838 = { + .get_cpu_desc = bmips_short_cpu_desc, + .get_cpu_freq = bcm6838_get_cpu_freq, + .get_cpu_count = bcm6358_get_cpu_count, +}; + /* Generic CPU Ops */ static int bmips_cpu_get_desc(struct udevice *dev, char *buf, int size) { @@ -444,6 +474,9 @@ static const struct udevice_id bmips_cpu_ids[] = { }, { .compatible = "brcm,bcm63268-cpu", .data = (ulong)&bmips_cpu_bcm63268, + }, { + .compatible = "brcm,bcm6838-cpu", + .data = (ulong)&bmips_cpu_bcm6838, }, { /* sentinel */ } }; diff --git a/include/configs/bmips_bcm6838.h b/include/configs/bmips_bcm6838.h new file mode 100644 index 0000000..e79a982 --- /dev/null +++ b/include/configs/bmips_bcm6838.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2018 Philippe Reynes philippe.reynes@softathome.com + */ + +#ifndef __CONFIG_BMIPS_BCM6838_H +#define __CONFIG_BMIPS_BCM6838_H + +/* CPU */ +#define CONFIG_SYS_MIPS_TIMER_FREQ 160000000 + +/* RAM */ +#define CONFIG_NR_DRAM_BANKS 1 +#define CONFIG_SYS_SDRAM_BASE 0x80000000 + +/* U-Boot */ +#define CONFIG_SYS_LOAD_ADDR CONFIG_SYS_SDRAM_BASE + 0x100000 + +#if defined(CONFIG_BMIPS_BOOT_RAM) +#define CONFIG_SKIP_LOWLEVEL_INIT +#define CONFIG_SYS_INIT_SP_OFFSET 0x2000 +#endif + +#endif /* __CONFIG_BMIPS_BCM6838_H */

On 16.07.2018 19:06, Philippe Reynes wrote:
This adds the initial support of the Broadcom BCM6838 SoC familly, only cpu, dram, uart and leds are supported.
Signed-off-by: Philippe Reynes philippe.reynes@softathome.com
arch/mips/dts/brcm,bcm6838.dtsi | 75 +++++++++++++++++++++++++++++++++++++++++ arch/mips/mach-bmips/Kconfig | 13 +++++++ drivers/cpu/bmips_cpu.c | 33 ++++++++++++++++++ include/configs/bmips_bcm6838.h | 24 +++++++++++++ 4 files changed, 145 insertions(+) create mode 100644 arch/mips/dts/brcm,bcm6838.dtsi create mode 100644 include/configs/bmips_bcm6838.h
Reviewed-by: Daniel Schwierzeck daniel.schwierzeck@gmail.com

This add the initial support of the broadcom reference board bcm968380gerg with a bcm68380 SoC.
This board has 512 MB of RAM, 128 MB of flash (nand), 2 USB port, 1 UART, 4 ethernet ports and BCM43217 (wifi).
Signed-off-by: Philippe Reynes philippe.reynes@softathome.com --- arch/mips/dts/brcm,bcm968380gerg.dts | 40 +++++++++++++++++++++++ arch/mips/mach-bmips/Kconfig | 12 +++++++ board/broadcom/bcm968380gerg/Kconfig | 12 +++++++ board/broadcom/bcm968380gerg/Makefile | 3 ++ board/broadcom/bcm968380gerg/bcm968380gerg.c | 6 ++++ board/broadcom/bcm968380gerg/board.c | 6 ++++ configs/bcm968380gerg_ram_defconfig | 48 ++++++++++++++++++++++++++++ include/configs/broadcom_bcm968380gerg.h | 9 ++++++ 8 files changed, 136 insertions(+) create mode 100644 arch/mips/dts/brcm,bcm968380gerg.dts create mode 100644 board/broadcom/bcm968380gerg/Kconfig create mode 100644 board/broadcom/bcm968380gerg/Makefile create mode 100644 board/broadcom/bcm968380gerg/bcm968380gerg.c create mode 100644 board/broadcom/bcm968380gerg/board.c create mode 100644 configs/bcm968380gerg_ram_defconfig create mode 100644 include/configs/broadcom_bcm968380gerg.h
diff --git a/arch/mips/dts/brcm,bcm968380gerg.dts b/arch/mips/dts/brcm,bcm968380gerg.dts new file mode 100644 index 0000000..513045e --- /dev/null +++ b/arch/mips/dts/brcm,bcm968380gerg.dts @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Philippe Reynes philippe.reynes@softathome.com + */ + +/dts-v1/; + +#include "brcm,bcm6838.dtsi" + +/ { + model = "Broadcom bcm68380gerg"; + compatible = "broadcom,bcm68380gerg", "brcm,bcm6838"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&memory { + force-size = <0x10000000>; +}; + +&uart0 { + u-boot,dm-pre-reloc; + status = "okay"; +}; + +&leds { + status = "okay"; + + led@0 { + reg = <0>; + active-low; + label = "bcm968380gerg:green:usb"; + }; +}; diff --git a/arch/mips/mach-bmips/Kconfig b/arch/mips/mach-bmips/Kconfig index dffffe5..96970f9 100644 --- a/arch/mips/mach-bmips/Kconfig +++ b/arch/mips/mach-bmips/Kconfig @@ -136,6 +136,17 @@ endchoice choice prompt "Board select"
+config BOARD_BROADCOM_BCM968380GERG + bool "Broadcom bcm968380gerg" + depends on SOC_BMIPS_BCM6838 + select BMIPS_SUPPORTS_BOOT_RAM + help + Broadcom BCM968380GERG reference board with BCM68380 SoC with 512 MB + of RAM and 128 MB of flash (nand). + Between its different peripherals there's an integrated switch with 4 + ethernet ports, 2 USB ports, 1 UART, GPIO buttons and LEDs, and + a BCM43217 (PCIe). + config BOARD_COMTREND_AR5315U bool "Comtrend AR-5315u" depends on SOC_BMIPS_BCM6318 @@ -264,6 +275,7 @@ endchoice config BMIPS_SUPPORTS_BOOT_RAM bool
+source "board/broadcom/bcm968380gerg/Kconfig" source "board/comtrend/ar5315u/Kconfig" source "board/comtrend/ar5387un/Kconfig" source "board/comtrend/ct5361/Kconfig" diff --git a/board/broadcom/bcm968380gerg/Kconfig b/board/broadcom/bcm968380gerg/Kconfig new file mode 100644 index 0000000..c33e25d --- /dev/null +++ b/board/broadcom/bcm968380gerg/Kconfig @@ -0,0 +1,12 @@ +if BOARD_BROADCOM_BCM968380GERG + +config SYS_BOARD + default "bcm968380gerg" + +config SYS_VENDOR + default "broadcom" + +config SYS_CONFIG_NAME + default "broadcom_bcm968380gerg" + +endif diff --git a/board/broadcom/bcm968380gerg/Makefile b/board/broadcom/bcm968380gerg/Makefile new file mode 100644 index 0000000..a525b7b --- /dev/null +++ b/board/broadcom/bcm968380gerg/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += bcm968380gerg.o diff --git a/board/broadcom/bcm968380gerg/bcm968380gerg.c b/board/broadcom/bcm968380gerg/bcm968380gerg.c new file mode 100644 index 0000000..044b355 --- /dev/null +++ b/board/broadcom/bcm968380gerg/bcm968380gerg.c @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Philippe Reynes philippe.reynes@softathome.com + */ + +#include <common.h> diff --git a/board/broadcom/bcm968380gerg/board.c b/board/broadcom/bcm968380gerg/board.c new file mode 100644 index 0000000..044b355 --- /dev/null +++ b/board/broadcom/bcm968380gerg/board.c @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Philippe Reynes philippe.reynes@softathome.com + */ + +#include <common.h> diff --git a/configs/bcm968380gerg_ram_defconfig b/configs/bcm968380gerg_ram_defconfig new file mode 100644 index 0000000..3354a5e --- /dev/null +++ b/configs/bcm968380gerg_ram_defconfig @@ -0,0 +1,48 @@ +CONFIG_MIPS=y +CONFIG_SYS_TEXT_BASE=0x80010000 +CONFIG_ARCH_BMIPS=y +CONFIG_SOC_BMIPS_BCM6838=y +# CONFIG_MIPS_BOOT_CMDLINE_LEGACY is not set +# CONFIG_MIPS_BOOT_ENV_LEGACY is not set +CONFIG_MIPS_BOOT_FDT=y +CONFIG_DEFAULT_DEVICE_TREE="brcm,bcm968380gerg" +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_OF_STDOUT_VIA_ALIAS=y +CONFIG_DISPLAY_CPUINFO=y +CONFIG_HUSH_PARSER=y +CONFIG_SYS_PROMPT="bcm968380gerg # " +CONFIG_CMD_CPU=y +CONFIG_CMD_LICENSE=y +# CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_EXPORTENV is not set +# CONFIG_CMD_IMPORTENV is not set +# CONFIG_CMD_EDITENV is not set +# CONFIG_CMD_SAVEENV is not set +# CONFIG_CMD_ENV_EXISTS is not set +# CONFIG_CMD_CRC32 is not set +CONFIG_CMD_MEMINFO=y +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_MISC is not set +CONFIG_OF_EMBED=y +# CONFIG_NET is not set +# CONFIG_DM_DEVICE_REMOVE is not set +CONFIG_HAVE_BLOCK_DEVICE=y +CONFIG_DM_GPIO=y +CONFIG_LED=y +CONFIG_LED_BCM6328=y +CONFIG_LED_BLINK=y +CONFIG_SPI_FLASH=y +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set +CONFIG_PHY=y +CONFIG_BCM6368_USBH_PHY=y +CONFIG_POWER_DOMAIN=y +CONFIG_BCM6328_POWER_DOMAIN=y +CONFIG_DM_RESET=y +CONFIG_RESET_BCM6345=y +# CONFIG_SPL_SERIAL_PRESENT is not set +CONFIG_DM_SERIAL=y +CONFIG_BCM6345_SERIAL=y +CONFIG_LZO=y diff --git a/include/configs/broadcom_bcm968380gerg.h b/include/configs/broadcom_bcm968380gerg.h new file mode 100644 index 0000000..6126a88 --- /dev/null +++ b/include/configs/broadcom_bcm968380gerg.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2018 Philippe Reynes philippe.reynes@softathome.com + */ + +#include <configs/bmips_common.h> +#include <configs/bmips_bcm6838.h> + +#define CONFIG_ENV_SIZE (8 * 1024)

On 16.07.2018 19:06, Philippe Reynes wrote:
This add the initial support of the broadcom reference board bcm968380gerg with a bcm68380 SoC.
This board has 512 MB of RAM, 128 MB of flash (nand), 2 USB port, 1 UART, 4 ethernet ports and BCM43217 (wifi).
Signed-off-by: Philippe Reynes philippe.reynes@softathome.com
arch/mips/dts/brcm,bcm968380gerg.dts | 40 +++++++++++++++++++++++ arch/mips/mach-bmips/Kconfig | 12 +++++++ board/broadcom/bcm968380gerg/Kconfig | 12 +++++++ board/broadcom/bcm968380gerg/Makefile | 3 ++ board/broadcom/bcm968380gerg/bcm968380gerg.c | 6 ++++ board/broadcom/bcm968380gerg/board.c | 6 ++++ configs/bcm968380gerg_ram_defconfig | 48 ++++++++++++++++++++++++++++ include/configs/broadcom_bcm968380gerg.h | 9 ++++++ 8 files changed, 136 insertions(+) create mode 100644 arch/mips/dts/brcm,bcm968380gerg.dts create mode 100644 board/broadcom/bcm968380gerg/Kconfig create mode 100644 board/broadcom/bcm968380gerg/Makefile create mode 100644 board/broadcom/bcm968380gerg/bcm968380gerg.c create mode 100644 board/broadcom/bcm968380gerg/board.c create mode 100644 configs/bcm968380gerg_ram_defconfig create mode 100644 include/configs/broadcom_bcm968380gerg.h
Reviewed-by: Daniel Schwierzeck daniel.schwierzeck@gmail.com

On 16.07.2018 19:06, Philippe Reynes wrote:
This adds an option to force the size of the ram, and avoid the detection of ram size.
Signed-off-by: Philippe Reynes philippe.reynes@softathome.com
drivers/ram/bmips_ram.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Reviewed-by: Daniel Schwierzeck daniel.schwierzeck@gmail.com
participants (2)
-
Daniel Schwierzeck
-
Philippe Reynes