Add support for Broadcom MIPS SoCs
v5 cover Add support for Broadcom MIPS SoCs
This adds support for some of the xDSL Broadcom MIPS SoCs:
- BCM6358
- BCM6328
- BCM63268
However, support for other SoCs could be added in the future:
- Other BCM63xx
- BCM33xx
- BCM71xx
v5: Improve BMIPS CPU driver
v4: Introduce changes suggested by Simon Glass:
- Refactor cmd/cpu.
- Remove device_probe patch for sysreset.
v3: Introduce changes suggested by Simon Glass.
v2: Introduce changes suggested by Daniel Schwierzeck.
Álvaro Fernández Rojas (14):
cmd: cpu: fix NULL cpu feature prints
sysreset: add syscon-reboot driver
MIPS: allow using generic sysreset drivers
serial: add serial driver for BCM6345
cmd: cpu: refactor to ensure devices are probed and improve code style
cpu: add CPU driver for Broadcom MIPS SoCs
ram: add RAM driver for Broadcom MIPS SoCs
MIPS: add initial infrastructure for Broadcom MIPS SoCs
MIPS: add support for Broadcom MIPS BCM6358 SoC family
MIPS: add BMIPS Huawei HG556a board
MIPS: add support for Broadcom MIPS BCM6328 SoC family
MIPS: add BMIPS Comtrend AR-5387un board
MIPS: add support for Broadcom MIPS BCM63268 SoC family
MIPS: add BMIPS Comtrend VR-3032u board
arch/mips/Kconfig | 10 + arch/mips/Makefile | 1 + arch/mips/cpu/cpu.c | 2 + arch/mips/cpu/start.S | 5 + arch/mips/dts/Makefile | 3 + arch/mips/dts/brcm,bcm63268.dtsi | 88 +++++++++ arch/mips/dts/brcm,bcm6328.dtsi | 88 +++++++++ arch/mips/dts/brcm,bcm6358.dtsi | 98 ++++++++++ arch/mips/dts/comtrend,ar-5387un.dts | 27 +++ arch/mips/dts/comtrend,vr-3032u.dts | 27 +++ arch/mips/dts/huawei,hg556a.dts | 31 ++++ arch/mips/mach-bmips/Kconfig | 86 +++++++++ arch/mips/mach-bmips/Makefile | 5 + arch/mips/mach-bmips/dram.c | 37 ++++ arch/mips/mach-bmips/include/ioremap.h | 45 +++++ board/comtrend/ar5387un/Kconfig | 12 ++ board/comtrend/ar5387un/MAINTAINERS | 6 + board/comtrend/ar5387un/Makefile | 5 + board/comtrend/ar5387un/ar-5387un.c | 7 + board/comtrend/vr3032u/Kconfig | 12 ++ board/comtrend/vr3032u/MAINTAINERS | 6 + board/comtrend/vr3032u/Makefile | 5 + board/comtrend/vr3032u/vr-3032u.c | 7 + board/huawei/hg556a/Kconfig | 12 ++ board/huawei/hg556a/MAINTAINERS | 6 + board/huawei/hg556a/Makefile | 5 + board/huawei/hg556a/hg556a.c | 7 + cmd/cpu.c | 31 ++-- configs/comtrend_ar5387un_ram_defconfig | 42 +++++ configs/comtrend_vr3032u_ram_defconfig | 42 +++++ configs/huawei_hg556a_ram_defconfig | 45 +++++ drivers/cpu/Makefile | 2 + drivers/cpu/bmips_cpu.c | 310 +++++++++++++++++++++++++++++++ drivers/ram/Makefile | 2 + drivers/ram/bmips_ram.c | 126 +++++++++++++ drivers/serial/Kconfig | 14 ++ drivers/serial/Makefile | 1 + drivers/serial/serial_bcm6345.c | 311 ++++++++++++++++++++++++++++++++ drivers/sysreset/Kconfig | 8 + drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_syscon.c | 76 ++++++++ include/configs/bmips_bcm63268.h | 25 +++ include/configs/bmips_bcm6328.h | 25 +++ include/configs/bmips_bcm6358.h | 30 +++ include/configs/bmips_common.h | 27 +++ include/configs/comtrend_ar5387un.h | 15 ++ include/configs/comtrend_vr3032u.h | 15 ++ include/configs/huawei_hg556a.h | 18 ++ 48 files changed, 1792 insertions(+), 17 deletions(-) create mode 100644 arch/mips/dts/brcm,bcm63268.dtsi create mode 100644 arch/mips/dts/brcm,bcm6328.dtsi create mode 100644 arch/mips/dts/brcm,bcm6358.dtsi create mode 100644 arch/mips/dts/comtrend,ar-5387un.dts create mode 100644 arch/mips/dts/comtrend,vr-3032u.dts create mode 100644 arch/mips/dts/huawei,hg556a.dts create mode 100644 arch/mips/mach-bmips/Kconfig create mode 100644 arch/mips/mach-bmips/Makefile create mode 100644 arch/mips/mach-bmips/dram.c create mode 100644 arch/mips/mach-bmips/include/ioremap.h create mode 100644 board/comtrend/ar5387un/Kconfig create mode 100644 board/comtrend/ar5387un/MAINTAINERS create mode 100644 board/comtrend/ar5387un/Makefile create mode 100644 board/comtrend/ar5387un/ar-5387un.c create mode 100644 board/comtrend/vr3032u/Kconfig create mode 100644 board/comtrend/vr3032u/MAINTAINERS create mode 100644 board/comtrend/vr3032u/Makefile create mode 100644 board/comtrend/vr3032u/vr-3032u.c create mode 100644 board/huawei/hg556a/Kconfig create mode 100644 board/huawei/hg556a/MAINTAINERS create mode 100644 board/huawei/hg556a/Makefile create mode 100644 board/huawei/hg556a/hg556a.c create mode 100644 configs/comtrend_ar5387un_ram_defconfig create mode 100644 configs/comtrend_vr3032u_ram_defconfig create mode 100644 configs/huawei_hg556a_ram_defconfig create mode 100644 drivers/cpu/bmips_cpu.c create mode 100644 drivers/ram/bmips_ram.c create mode 100644 drivers/serial/serial_bcm6345.c create mode 100644 drivers/sysreset/sysreset_syscon.c create mode 100644 include/configs/bmips_bcm63268.h create mode 100644 include/configs/bmips_bcm6328.h create mode 100644 include/configs/bmips_bcm6358.h create mode 100644 include/configs/bmips_common.h create mode 100644 include/configs/comtrend_ar5387un.h create mode 100644 include/configs/comtrend_vr3032u.h create mode 100644 include/configs/huawei_hg556a.h
Signature · 1 line
2.1.4
PATCH v5 1/14 cmd: cpu: fix NULL cpu feature prints
Commit 740d5d3 added two new features but only one feature name, which results in NULL prints when device_id feature is selected.
Before:
HG556a # cpu detail -1: cpu at 0 BCM6358A1 ID = 0, freq = 300 MHz: L1 cache, MMU, NULL Device ID 0x2a010 -1: cpu at 1 BCM6358A1 ID = 1, freq = 300 MHz: L1 cache, MMU, NULL Device ID 0x2a010 After: HG556a # cpu detail -1: cpu at 0 BCM6358A1 ID = 0, freq = 300 MHz: L1 cache, MMU, Device ID Device ID 0x2a010 -1: cpu at 1 BCM6358A1 ID = 1, freq = 300 MHz: L1 cache, MMU, Device ID Device ID 0x2a010
---
v5: No changes.
v4: No changes.
v3: No changes.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Add the missing name instead of checking for null names.
cmd/cpu.c | 1 + 1 file changed, 1 insertion(+)
cmd/cpu.c +1 -0
@@ -15,6 +15,7 @@ static const char *cpu_feature_name[CPU_FEAT_COUNT] = {"L1 cache" ,"MMU" ,"Microcode" , + "Device ID", };static int print_cpu_list (bool detail)
Signature · 1 line
2.1.4
PATCH v5 2/14 sysreset: add syscon-reboot driver
In reply to Álvaro Fernández RojasAdd a new sysreset driver based on linux/drivers/power/reset/syscon-reboot.c, which provides a generic driver for platforms that only require writing a mask to a regmap offset.
---
v5: No chnages.
v4: Rebased.
v3: Introduce changes suggested by Simon Glass:
- Add missing driver description.
- Alphabetically order includes.
- Add priv struct to store regmap during probe.
- Cosmetic fixes.
v2: No changes.
drivers/sysreset/Kconfig | 8 ++++ drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_syscon.c | 76 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 drivers/sysreset/sysreset_syscon.c
drivers/sysreset/Kconfig +8 -0
@@ -23,4 +23,12 @@ config SYSRESET_PSCI must be running on your system. endif + +config SYSRESET_SYSCON + bool "Enable support for mfd syscon reboot driver" + select REGMAP + select SYSCON + help + Reboot support for generic SYSCON mapped register reset. + endmenu
drivers/sysreset/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_SYSRESET) += sysreset-uclass.o obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o +obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o ifndef CONFIG_SPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3036) += sysreset_rk3036.o
drivers/sysreset/sysreset_syscon.c new file +76 -0
76 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v5 2/14 sysreset: add syscon-reboot driver
Am 23.04.2017 um 10:43 schrieb Álvaro Fernández Rojas:
Quoted 106 lines
Add a new sysreset driver based on
linux/drivers/power/reset/syscon-reboot.c, which provides a generic driver for platforms that only require writing a mask to a regmap offset.Signed-off-by Álvaro Fernández Rojas <[email protected]>Reviewed-by Simon Glass <[email protected]>---
v5: No chnages.
v4: Rebased.
v3: Introduce changes suggested by Simon Glass:
- Add missing driver description.
- Alphabetically order includes.
- Add priv struct to store regmap during probe.
- Cosmetic fixes.
v2: No changes.drivers/sysreset/Kconfig | 8 ++++ drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_syscon.c | 76 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 drivers/sysreset/sysreset_syscon.cdrivers/sysreset/Kconfig +8
-0@@ -23,4 +23,12 @@ config SYSRESET_PSCI must be running on your system. endif + +config SYSRESET_SYSCON + bool "Enable support for mfd syscon reboot driver" + select REGMAP + select SYSCON + help + Reboot support for generic SYSCON mapped register reset. + endmenudrivers/sysreset/Makefile +1
-0@@ -6,6 +6,7 @@ obj-$(CONFIG_SYSRESET) += sysreset-uclass.o obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o +obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o ifndef CONFIG_SPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3036) += sysreset_rk3036.odrivers/sysreset/sysreset_syscon.c new file +49
-0@@ -0,0 +1,76 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* Derived from linux/drivers/power/reset/syscon-reboot.c: +* Copyright (C) 2013, Applied Micro Circuits Corporation +* Author: Feng Kan <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <regmap.h> +#include <sysreset.h> +#include <syscon.h> + +DECLARE_GLOBAL_DATA_PTR ; + +struct syscon_reboot_priv { +struct regmap *regmap; +unsigned int offset; +unsigned int mask; +}; + +static int syscon_reboot_request (struct udevice *dev,enum sysreset_t type) +{ +struct syscon_reboot_priv *priv =dev_get_priv (dev); + +regmap_write (priv->regmap, priv->offset, priv->mask); + +return -EINPROGRESS ; +} + +static struct sysreset_ops syscon_reboot_ops = { + .request = syscon_reboot_request, +}; + +int syscon_reboot_probe (struct udevice *dev) +{ +struct udevice *syscon; +struct syscon_reboot_priv *priv =dev_get_priv (dev); +int err; + + err =uclass_get_device_by_phandle (UCLASS_SYSCON , dev, +"regmap" , &syscon); +if (err) { +error ("unable to find syscon device\n" ); +return err;
drivers/sysreset/sysreset_syscon.c line 59
Quoted 10 lines
drivers/sysreset/sysreset_syscon.c new file +10
-0+ } + + priv->regmap =syscon_get_regmap (syscon); +if (!priv->regmap) { +error ("unable to find regmap\n" ); +return -ENODEV ; + } + + priv->offset =fdtdec_get_uint (gd->fdt_blob,dev_of_offset (dev),"offset" ,0 ); + priv->mask =fdtdec_get_uint (gd->fdt_blob,dev_of_offset (dev),"mask" ,0 );
checkpatch.pl: WARNING: line over 80 characters
Quoted 18 lines
drivers/sysreset/sysreset_syscon.c new file +17
-0+ +return 0 ; +} + +static const struct udevice_id syscon_reboot_ids[] = { + { .compatible ="syscon-reboot" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (syscon_reboot) = { + .name ="syscon_reboot" , + .id =UCLASS_SYSRESET , + .of_match = syscon_reboot_ids, + .probe = syscon_reboot_probe, + .priv_auto_alloc_size =sizeof (struct syscon_reboot_priv ), + .ops = &syscon_reboot_ops, +};
Signature · 9 lines
- Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170423/e47e0dd3/attachment.sig>
PATCH v5 3/14 MIPS: allow using generic sysreset drivers
In reply to Álvaro Fernández RojasAvoid duplicating do_reset definition if SYSRESET is enabled for MIPS
---
v5: No changes.
v4: No changes.
v3: No changes.
v2: No changes.
arch/mips/cpu/cpu.c | 2 ++ 1 file changed, 2 insertions(+)
arch/mips/cpu/cpu.c +2 -0
@@ -12,6 +12,7 @@#include <asm/mipsregs.h> #include <asm/reboot.h> +#ifndef CONFIG_SYSRESET void __weak _machine_restart (void ) {fprintf (stderr,"*** reset failed ***\n" );
@@ -26,6 +27,7 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } +#endif void write_one_tlb (int index,u32 pagemask,u32 hi,u32 low0,u32 low1) {
Signature · 1 line
2.1.4
PATCH v5 4/14 serial: add serial driver for BCM6345
In reply to Álvaro Fernández RojasIt is based on linux/drivers/tty/serial/bcm63xx_uart.c
---
v5: No changes.
v4: Add more missing register configurations based on CFE.
v3: Several improvements:
- Add missing register configurations based on CFE.
- Replace tabs with whitespaces.
- Cosmetic fixes.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Remove unneeded defines.
- Fix incorrect multi-line comment.
drivers/serial/Kconfig | 14 ++ drivers/serial/Makefile | 1 + drivers/serial/serial_bcm6345.c | 311 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 326 insertions(+) create mode 100644 drivers/serial/serial_bcm6345.c
drivers/serial/Kconfig +14 -0
@@ -134,6 +134,14 @@ config DEBUG_UART_ATMEL will need to provide parameters to make this work. The driver will be available until the real driver-model serial is running. +config DEBUG_UART_BCM6345 + bool "BCM6345 UART" + depends on BCM6345_SERIAL + help + Select this to enable a debug UART on BCM6345 SoCs. You + will need to provide parameters to make this work. The driver will + be available until the real driver model serial is running. + config DEBUG_UART_NS16550 bool "ns16550" help
@@ -339,6 +347,12 @@ config ATMEL_USART configured in the device tree, and input clock frequency can be got from the clk node. +config BCM6345_SERIAL + bool "Support for BCM6345 UART" + depends on DM_SERIAL + help + Select this to enable UART on BCM6345 SoCs. + config FSL_LPUART bool "Freescale LPUART support" help
drivers/serial/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o obj-$(CONFIG_AR933X_UART) += serial_ar933x.o obj-$(CONFIG_ARM_DCC) += arm_dcc.o obj-$(CONFIG_ATMEL_USART) += atmel_usart.o +obj-$(CONFIG_BCM6345_SERIAL) += serial_bcm6345.o obj-$(CONFIG_EFI_APP) += serial_efi.o obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o obj-$(CONFIG_MCFUART) += mcfuart.o
drivers/serial/serial_bcm6345.c new file +311 -0
311 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v5 4/14 serial: add serial driver for BCM6345
Am 23.04.2017 um 10:43 schrieb Álvaro Fernández Rojas:
Quoted 40 lines
It is based on
linux/drivers/tty/serial/bcm63xx_uart.cSigned-off-by Álvaro Fernández Rojas <[email protected]>---
v5: No changes.
v4: Add more missing register configurations based on CFE.
v3: Several improvements:
- Add missing register configurations based on CFE.
- Replace tabs with whitespaces.
- Cosmetic fixes.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Remove unneeded defines.
- Fix incorrect multi-line comment.drivers/serial/Kconfig | 14 ++ drivers/serial/Makefile | 1 + drivers/serial/serial_bcm6345.c | 311 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 326 insertions(+) create mode 100644 drivers/serial/serial_bcm6345.cdrivers/serial/Kconfig +8
-0@@ -134,6 +134,14 @@ config DEBUG_UART_ATMEL will need to provide parameters to make this work. The driver will be available until the real driver-model serial is running. +config DEBUG_UART_BCM6345 + bool "BCM6345 UART" + depends on BCM6345_SERIAL + help + Select this to enable a debug UART on BCM6345 SoCs. You + will need to provide parameters to make this work. The driver will + be available until the real driver model serial is running. + config DEBUG_UART_NS16550 bool "ns16550" help
drivers/serial/Kconfig config ATMEL_USART · line 352
Quoted 6 lines
drivers/serial/Kconfig +3
-0@@ -339,6 +347,12 @@ config ATMEL_USART configured in the device tree, and input clock frequency can be got from the clk node. +config BCM6345_SERIAL + bool "Support for BCM6345 UART" + depends on DM_SERIAL
depends on DM_SERIAL && ARCH_BMIPS
Quoted 109 lines
drivers/serial/Kconfig +3
-0+ help + Select this to enable UART on BCM6345 SoCs. + config FSL_LPUART bool "Freescale LPUART support" helpdrivers/serial/Makefile +1
-0@@ -20,6 +20,7 @@ obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o obj-$(CONFIG_AR933X_UART) += serial_ar933x.o obj-$(CONFIG_ARM_DCC) += arm_dcc.o obj-$(CONFIG_ATMEL_USART) += atmel_usart.o +obj-$(CONFIG_BCM6345_SERIAL) += serial_bcm6345.o obj-$(CONFIG_EFI_APP) += serial_efi.o obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o obj-$(CONFIG_MCFUART) += mcfuart.odrivers/serial/serial_bcm6345.c new file +85
-0@@ -0,0 +1,311 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* Derived from linux/drivers/tty/serial/bcm63xx_uart.c: +* Copyright (C) 2008 Maxime Bizon <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <clk.h> +#include <debug_uart.h> +#include <errno.h> +#include <serial.h> +#include <asm/io.h> +#include <asm/types.h> +#include <dm/device.h> + +/* UART Control register */ +#define UART_CTL_REG 0x0 +#define UART_CTL_RXTIMEOUT_MASK 0x1f +#define UART_CTL_RSTRXFIFO_SHIFT 6 +#define UART_CTL_RSTRXFIFO_MASK (1 << UART_CTL_RSTRXFIFO_SHIFT) +#define UART_CTL_RSTTXFIFO_SHIFT 7 +#define UART_CTL_RSTTXFIFO_MASK (1 << UART_CTL_RSTTXFIFO_SHIFT) +#define UART_CTL_STOPBITS_SHIFT 8 +#define UART_CTL_STOPBITS_MASK (0xf << UART_CTL_STOPBITS_SHIFT) +#define UART_CTL_STOPBITS_1 (0x7 << UART_CTL_STOPBITS_SHIFT) +#define UART_CTL_BITSPERSYM_SHIFT 12 +#define UART_CTL_BITSPERSYM_MASK (0x3 << UART_CTL_BITSPERSYM_SHIFT) +#define UART_CTL_XMITBRK_SHIFT 14 +#define UART_CTL_XMITBRK_MASK (1 << UART_CTL_XMITBRK_SHIFT) +#define UART_CTL_RSVD_SHIFT 15 +#define UART_CTL_RSVD_MASK (1 << UART_CTL_RSVD_SHIFT) +#define UART_CTL_RXPAREVEN_SHIFT 16 +#define UART_CTL_RXPAREVEN_MASK (1 << UART_CTL_RXPAREVEN_SHIFT) +#define UART_CTL_RXPAREN_SHIFT 17 +#define UART_CTL_RXPAREN_MASK (1 << UART_CTL_RXPAREN_SHIFT) +#define UART_CTL_TXPAREVEN_SHIFT 18 +#define UART_CTL_TXPAREVEN_MASK (1 << UART_CTL_TXPAREVEN_SHIFT) +#define UART_CTL_TXPAREN_SHIFT 19 +#define UART_CTL_TXPAREN_MASK (1 << UART_CTL_TXPAREN_SHIFT) +#define UART_CTL_LOOPBACK_SHIFT 20 +#define UART_CTL_LOOPBACK_MASK (1 << UART_CTL_LOOPBACK_SHIFT) +#define UART_CTL_RXEN_SHIFT 21 +#define UART_CTL_RXEN_MASK (1 << UART_CTL_RXEN_SHIFT) +#define UART_CTL_TXEN_SHIFT 22 +#define UART_CTL_TXEN_MASK (1 << UART_CTL_TXEN_SHIFT) +#define UART_CTL_BRGEN_SHIFT 23 +#define UART_CTL_BRGEN_MASK (1 << UART_CTL_BRGEN_SHIFT) + +/* UART Baudword register */ +#define UART_BAUD_REG 0x4 + +/* UART FIFO Config register */ +#define UART_FIFO_CFG_REG 0x8 +#define UART_FIFO_CFG_RX_SHIFT 8 +#define UART_FIFO_CFG_RX_MASK (0xf << UART_FIFO_CFG_RX_SHIFT) +#define UART_FIFO_CFG_TX_SHIFT 12 +#define UART_FIFO_CFG_TX_MASK (0xf << UART_FIFO_CFG_TX_SHIFT) + +/* UART Interrupt register */ +#define UART_IR_REG 0x10 +#define UART_IR_STAT (x) (1 << (x)) +#define UART_IR_TXEMPTY 5 +#define UART_IR_RXOVER 7 +#define UART_IR_RXNOTEMPTY 11 + +/* UART FIFO register */ +#define UART_FIFO_REG 0x14 +#define UART_FIFO_VALID_MASK 0xff +#define UART_FIFO_FRAMEERR_SHIFT 8 +#define UART_FIFO_FRAMEERR_MASK (1 << UART_FIFO_FRAMEERR_SHIFT) +#define UART_FIFO_PARERR_SHIFT 9 +#define UART_FIFO_PARERR_MASK (1 << UART_FIFO_PARERR_SHIFT) +#define UART_FIFO_BRKDET_SHIFT 10 +#define UART_FIFO_BRKDET_MASK (1 << UART_FIFO_BRKDET_SHIFT) +#define UART_FIFO_ANYERR_MASK (UART_FIFO_FRAMEERR_MASK | \ + UART_FIFO_PARERR_MASK | \ + UART_FIFO_BRKDET_MASK) + +struct bcm6345_serial_priv { +void __iomem *base; +ulong uartclk; +}; +
drivers/serial/serial_bcm6345.c line 95
Quoted 10 lines
drivers/serial/serial_bcm6345.c new file +10
-0+/* +* enable rx & tx operation on uart +*/ +static void bcm6345_serial_enable (void __iomem *base) +{ +u32 val; + + val =__raw_readl (base +UART_CTL_REG ); + val |= (UART_CTL_BRGEN_MASK |UART_CTL_TXEN_MASK |UART_CTL_RXEN_MASK ); +__raw_writel (val, base +UART_CTL_REG );
please use the generic I/O accessors like readl and setbits_32 (or readl_be and setbits_be32 since you have selected CONFIG_SWAP_IO_SPACE in your SoC config).
This would be shorter and cleaner:
static void bcm6345_serial_enable(void __iomem *base) {
setbits_be32(base + UART_CTL_REG, UART_CTL_BRGEN_MASK |
UART_CTL_TXEN_MASK | UART_CTL_RXEN_MASK);
}
Quoted 128 lines
drivers/serial/serial_bcm6345.c new file +128
-0+} + +/* +* disable rx & tx operation on uart +*/ +static void bcm6345_serial_disable (void __iomem *base) +{ +u32 val; + + val =__raw_readl (base +UART_CTL_REG ); + val &= ~(UART_CTL_BRGEN_MASK |UART_CTL_TXEN_MASK | +UART_CTL_RXEN_MASK ); +__raw_writel (val, base +UART_CTL_REG ); +} + +/* +* clear all unread data in rx fifo and unsent data in tx fifo +*/ +static void bcm6345_serial_flush (void __iomem *base) +{ +u32 val; + +/* empty rx and tx fifo */ + val =__raw_readl (base +UART_CTL_REG ); + val |=UART_CTL_RSTRXFIFO_MASK |UART_CTL_RSTTXFIFO_MASK ; +__raw_writel (val, base +UART_CTL_REG ); + +/* read any pending char to make sure all irq status are cleared */ +__raw_readl (base +UART_FIFO_REG ); +} + +static int bcm6345_serial_init (void __iomem *base,ulong clk,u32 baudrate) +{ +u32 val; + +/* mask all irq and flush port */ +bcm6345_serial_disable (base); +bcm6345_serial_flush (base); + + val =__raw_readl (base +UART_CTL_REG ); +/* set rx timeout */ + val &= ~UART_CTL_RXTIMEOUT_MASK ; + val |=0x5 ; +/* set stop bits */ + val &= ~UART_CTL_STOPBITS_MASK ; + val |=UART_CTL_STOPBITS_1 ; +/* set bits per symbol */ + val &= ~UART_CTL_BITSPERSYM_MASK ; + val |= (3 <<UART_CTL_BITSPERSYM_SHIFT ); +/* clear xmit break */ + val &= ~UART_CTL_XMITBRK_MASK ; +/* clear reserved bit */ + val &= ~UART_CTL_RSVD_MASK ; +/* disable parity */ + val |=UART_CTL_RXPAREVEN_MASK |UART_CTL_TXPAREVEN_MASK ; + val &= ~(UART_CTL_RXPAREN_MASK |UART_CTL_TXPAREN_MASK ); +/* disable loopback */ + val &= ~UART_CTL_LOOPBACK_MASK ; +__raw_writel (val, base +UART_CTL_REG ); + + val =__raw_readl (base +UART_FIFO_CFG_REG ); +/* set rx fifo config */ + val &= ~UART_FIFO_CFG_RX_MASK ; + val |= (4 <<UART_FIFO_CFG_RX_SHIFT ); +/* set tx fifo config */ + val &= ~UART_FIFO_CFG_TX_MASK ; + val |= (4 <<UART_FIFO_CFG_TX_SHIFT ); +__raw_writel (val, base +UART_FIFO_CFG_REG ); + +/* set baud rate */ + val = (clk / baudrate) /16 ; +if (val &0x1 ) + val = val; +else + val = val /2 -1 ; +__raw_writel (val, base +UART_BAUD_REG ); + +/* clear interrupts */ +__raw_writel (0 , base +UART_IR_REG ); + +/* enable uart */ +bcm6345_serial_enable (base); + +return 0 ; +} + +static int bcm6345_serial_pending (struct udevice *dev,bool input) +{ +struct bcm6345_serial_priv *priv =dev_get_priv (dev); +u32 val =__raw_readl (priv->base +UART_IR_REG ); + +if (input) +return (val &UART_IR_STAT (UART_IR_RXNOTEMPTY )) ?1 :0 ; +else +return (val &UART_IR_STAT (UART_IR_TXEMPTY )) ?0 :1 ; +} + +static int bcm6345_serial_setbrg (struct udevice *dev,int baudrate) +{ +struct bcm6345_serial_priv *priv =dev_get_priv (dev); + +return bcm6345_serial_init (priv->base, priv->uartclk, baudrate); +} + +static int bcm6345_serial_putc (struct udevice *dev,const char ch) +{ +struct bcm6345_serial_priv *priv =dev_get_priv (dev); +u32 val; + + val =__raw_readl (priv->base +UART_IR_REG ); +if (!(val &UART_IR_STAT (UART_IR_TXEMPTY ))) +return -EAGAIN ; + +__raw_writel (ch, priv->base +UART_FIFO_REG ); + +return 0 ; +} + +static int bcm6345_serial_getc (struct udevice *dev) +{ +struct bcm6345_serial_priv *priv =dev_get_priv (dev); +u32 val; + + val =__raw_readl (priv->base +UART_IR_REG ); +if (val &UART_IR_STAT (UART_IR_RXOVER )) { +/* fifo reset is required to clear interrupt */ + val =__raw_readl (priv->base +UART_CTL_REG ); + val |=UART_CTL_RSTRXFIFO_MASK ;
drivers/serial/serial_bcm6345.c line 233
Quoted 10 lines
drivers/serial/serial_bcm6345.c new file +10
-0+__raw_writel (val, priv->base +UART_CTL_REG ); + } +if (!(val &UART_IR_STAT (UART_IR_RXNOTEMPTY ))) +return -EAGAIN ; + + val =__raw_readl (priv->base +UART_FIFO_REG ); +if (val &UART_FIFO_ANYERR_MASK ) +return -EAGAIN ; + +return (val &UART_FIFO_VALID_MASK );
checkpatch.pl: ERROR: return is not a function, parentheses are not required
Quoted 79 lines
drivers/serial/serial_bcm6345.c new file +78
-0+} + +static int bcm6345_serial_probe (struct udevice *dev) +{ +struct bcm6345_serial_priv *priv =dev_get_priv (dev); +struct clk clk; +fdt_addr_t addr; +fdt_size_t size; +int ret; + +/* get address */ + addr =dev_get_addr_size_index (dev,0 , &size); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + priv->base =ioremap (addr, size); + +/* get clock rate */ + ret =clk_get_by_index (dev,0 , &clk); +if (ret <0 ) +return ret; + priv->uartclk =clk_get_rate (&clk) /2 ; +clk_free (&clk); + +/* initialize serial */ +return bcm6345_serial_init (priv->base, priv->uartclk,CONFIG_BAUDRATE ); +} + +static const struct dm_serial_ops bcm6345_serial_ops = { + .putc = bcm6345_serial_putc, + .pending = bcm6345_serial_pending, + .getc = bcm6345_serial_getc, + .setbrg = bcm6345_serial_setbrg, +}; + +static const struct udevice_id bcm6345_serial_ids[] = { + { .compatible ="brcm,bcm6345-uart" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (bcm6345_serial) = { + .name ="bcm6345-uart" , + .id =UCLASS_SERIAL , + .of_match = bcm6345_serial_ids, + .probe = bcm6345_serial_probe, + .priv_auto_alloc_size =sizeof (struct bcm6345_serial_priv ), + .ops = &bcm6345_serial_ops, + .flags =DM_FLAG_PRE_RELOC , +}; + +#ifdef CONFIG_DEBUG_UART_BCM6345 +static inline void _debug_uart_init (void ) +{ +void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE ; + +bcm6345_serial_init (base,CONFIG_DEBUG_UART_CLOCK ,CONFIG_BAUDRATE ); +} + +static inline void wait_xfered (void __iomem *base) +{ +do { +u32 val =__raw_readl (base +UART_IR_REG ); +if (val &UART_IR_STAT (UART_IR_TXEMPTY )) +break ; + }while (1 ); +} + +static inline void _debug_uart_putc (int ch) +{ +void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE ; + +wait_xfered (base); +__raw_writel (ch, base +UART_FIFO_REG ); +wait_xfered (base); +} + +DEBUG_UART_FUNCS +#endif
Signature · 9 lines
- Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170423/7741fbda/attachment.sig>
PATCH v5 5/14 cmd: cpu: refactor to ensure devices are probed and improve code style
In reply to Álvaro Fernández RojasUse uclass_first_device and uclass_next_device in order to avoid exceptions for drivers that aren't probed when cpu ops are requested. Improve code style and fix indentations.
Fix incorrect line break when cpu info is not available.
Remove unneeded brackets.
---
v5: No changes.
v4: Refactor code to use uclass_first_device and uclass_next_device as
requested by Simon Glass.
v3: add new patch to ensure that device is probed.
cmd/cpu.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
cmd/cpu.c +13 -17
@@ -1,6 +1,7 @@/* * Copyright (c) 2015 Google, Inc * Written by Simon Glass <[email protected]> +* Copyright (c) 2017 Álvaro Fernández Rojas <[email protected]> * * SPDX-License-Identifier: GPL-2.0+ */
@@ -21,20 +22,15 @@ static const char *cpu_feature_name[CPU_FEAT_COUNT] = {static int print_cpu_list (bool detail) {struct udevice *dev; -struct uclass *uc;char buf[100 ]; -int ret; - ret =uclass_get (UCLASS_CPU , &uc); -if (ret) { -printf ("Cannot find CPU uclass\n" ); -return ret; - } - uclass_foreach_dev(dev, uc) { +for (uclass_first_device (UCLASS_CPU , &dev); + dev; +uclass_next_device (&dev)) {struct cpu_platdata *plat =dev_get_parent_platdata (dev);struct cpu_info info; -bool first; -int i; +bool first = true; +int ret, i; ret =cpu_get_desc (dev, buf,sizeof (buf)); printf("%3d: %-10s %s\n", dev->seq, dev->name,
@@ -45,13 +41,12 @@ static int print_cpu_list(bool detail)if (ret) {printf ("\t(no detail available" );if (ret != -ENOSYS ) -printf (": err=%d\n" , ret); +printf (": err=%d" , ret);printf (")\n" );continue ; }printf ("\tID = %d, freq = " , plat->cpu_id);print_freq (info.cpu_freq,"" ); - first = true;for (i =0 ; i <CPU_FEAT_COUNT ; i++) {if (info.features & (1 << i)) { printf("%s%s", first ? ": " : ", ",
@@ -60,10 +55,9 @@ static int print_cpu_list(bool detail) } }printf ("\n" ); -if (info.features & (1 <<CPU_FEAT_UCODE )) { +if (info.features & (1 <<CPU_FEAT_UCODE ))printf ("\tMicrocode version %#x\n" , plat->ucode_version); - }if (info.features & (1 <<CPU_FEAT_DEVICE_ID ))printf ("\tDevice ID %#lx\n" , plat->device_id); }
@@ -71,7 +65,8 @@ static int print_cpu_list(bool detail)return 0 ; } -static int do_cpu_list (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +static int do_cpu_list (cmd_tbl_t *cmdtp,int flag,int argc, +char *const argv[]) {if (print_cpu_list (false))return CMD_RET_FAILURE ;
@@ -97,7 +92,7 @@ static cmd_tbl_t cmd_cpu_sub[] = {* Process a cpu sub-command */ static int do_cpu (cmd_tbl_t *cmdtp,int flag,int argc, -char *const argv[]) +char *const argv[]) {cmd_tbl_t *c =NULL ;
@@ -106,7 +101,8 @@ static int do_cpu(cmd_tbl_t *cmdtp, int flag, int argc, argv++;if (argc) - c =find_cmd_tbl (argv[0 ], cmd_cpu_sub,ARRAY_SIZE (cmd_cpu_sub)); + c =find_cmd_tbl (argv[0 ], cmd_cpu_sub, +ARRAY_SIZE (cmd_cpu_sub));if (c)return c->cmd (cmdtp, flag, argc, argv);
Signature · 1 line
2.1.4
PATCH v5 5/14 cmd: cpu: refactor to ensure devices are probed and improve code style
Quoted 7 lines · Álvaro Fernández Rojas
Use
uclass_first_deviceanduclass_next_devicein order to avoid exceptions for drivers that aren't probed when cpu ops are requested. Improve code style and fix indentations.
Fix incorrect line break when cpu info is not available.
Remove unneeded brackets.Signed-off-by Álvaro Fernández Rojas <[email protected]>
Quoted 8 lines
---
v5: No changes.
v4: Refactor code to useuclass_first_deviceanduclass_next_deviceas
requested by Simon Glass.
v3: add new patch to ensure that device is probed.cmd/cpu.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
PATCH v5 6/14 cpu: add CPU driver for Broadcom MIPS SoCs
In reply to Álvaro Fernández Rojas---
v5: Add specific desc functions.
v4: No changes.
v3: Several improvements:
- Probe driver correctly.
- Allocate size for priv struct.
- Cosmetic fixes.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
- Get register base from DT.
drivers/cpu/Makefile | 2 + drivers/cpu/bmips_cpu.c | 310 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+) create mode 100644 drivers/cpu/bmips_cpu.c
drivers/cpu/Makefile +2 -0
@@ -5,3 +5,5 @@ # SPDX-License-Identifier: GPL-2.0+ # obj-$(CONFIG_CPU) += cpu-uclass.o + +obj-$(CONFIG_ARCH_BMIPS) += bmips_cpu.o
drivers/cpu/bmips_cpu.c new file +310 -0
310 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v5 6/14 cpu: add CPU driver for Broadcom MIPS SoCs
Quoted 12 lines · Álvaro Fernández Rojas
Signed-off-by Álvaro Fernández Rojas <[email protected]>---
v5: Add specific desc functions.
v4: No changes.
v3: Several improvements:
- Probe driver correctly.
- Allocate size for priv struct.
- Cosmetic fixes.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
- Get register base from DT.
Quoted 4 lines
drivers/cpu/Makefile | 2 + drivers/cpu/bmips_cpu.c | 310 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+) create mode 100644 drivers/cpu/bmips_cpu.c
But please use readl() instead of __raw_readl()
PATCH v5 7/14 ram: add RAM driver for Broadcom MIPS SoCs
In reply to Álvaro Fernández Rojas---
v5: No changes.
v4: No changes.
v3: Rename of_match to ids.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
drivers/ram/Makefile | 2 + drivers/ram/bmips_ram.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 drivers/ram/bmips_ram.c
drivers/ram/Makefile +2 -0
@@ -6,3 +6,5 @@ # obj-$(CONFIG_RAM) += ram-uclass.o obj-$(CONFIG_SANDBOX) += sandbox_ram.o + +obj-$(CONFIG_ARCH_BMIPS) += bmips_ram.o
drivers/ram/bmips_ram.c new file +126 -0
126 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v5 8/14 MIPS: add initial infrastructure for Broadcom MIPS SoCs
In reply to Álvaro Fernández RojasCFE checks CPU Thread in a different way (using register $22):
mfc0 t1, C0_BCM_CONFIG, 3 # $22
li t2, CP0_CMT_TPID # (1 << 31)
and t1, t2
bnez t1, 2f # if we are running on thread 1, skip init
nop
---
v4: No changes.
v5: No changes.
v3: Select CONFIG_REMAKE_ELF.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
- Replace initdram with dram_init.
- Merge with "fix first CPU check" patch.
arch/mips/Kconfig | 10 ++++++++++ arch/mips/Makefile | 1 + arch/mips/cpu/start.S | 5 +++++ arch/mips/mach-bmips/Kconfig | 22 ++++++++++++++++++++++ arch/mips/mach-bmips/Makefile | 5 +++++ arch/mips/mach-bmips/dram.c | 37 +++++++++++++++++++++++++++++++++++++ include/configs/bmips_common.h | 27 +++++++++++++++++++++++++++ 7 files changed, 107 insertions(+) create mode 100644 arch/mips/mach-bmips/Kconfig create mode 100644 arch/mips/mach-bmips/Makefile create mode 100644 arch/mips/mach-bmips/dram.c create mode 100644 include/configs/bmips_common.h
arch/mips/Kconfig +10 -0
@@ -75,6 +75,15 @@ config ARCH_ATH79 select OF_CONTROL select DM +config ARCH_BMIPS + bool "Support BMIPS SoCs" + select OF_CONTROL + select DM + select CLK + select CPU + select RAM + select SYSRESET + config MACH_PIC32 bool "Support Microchip PIC32" select OF_CONTROL
@@ -123,6 +132,7 @@ source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" source "arch/mips/mach-ath79/Kconfig" +source "arch/mips/mach-bmips/Kconfig" source "arch/mips/mach-pic32/Kconfig" if MIPS
arch/mips/Makefile +1 -0
@@ -15,6 +15,7 @@ libs-y += arch/mips/lib/ machine-$(CONFIG_SOC_AU1X00) += au1x00 machine-$(CONFIG_ARCH_ATH79) += ath79 +machine-$(CONFIG_ARCH_BMIPS) += bmips machine-$(CONFIG_MACH_PIC32) += pic32 machdirs := $(patsubst %,arch/mips/mach-%/,$(machine-y))
arch/mips/cpu/start.S +5 -0
@@ -151,8 +151,13 @@ reset: mfc0 t0, CP0_GLOBALNUMBER #endif +#ifdef CONFIG_ARCH_BMIPS +1: mfc0 t0, CP0_DIAGNOSTIC, 3 + and t0, t0, (1 << 31) +#else 1: mfc0 t0, CP0_EBASE and t0, t0, EBASE_CPUNUM +#endif /* Hang if this isn't the first CPU in the system */ 2: beqz t0, 4f
arch/mips/mach-bmips/Kconfig new file +22 -0
@@ -0,0 +1,22 @@ +menu "Broadcom MIPS platforms" + depends on ARCH_BMIPS + +config SYS_SOC + default "none" + +choice + prompt "Boot mode" + +config BMIPS_BOOT_RAM + bool "RAM boot" + depends on BMIPS_SUPPORTS_BOOT_RAM + help + This builds an image that is linked to a RAM address. Caches are + disabled and environment is built in. + +endchoice + +config BMIPS_SUPPORTS_BOOT_RAM + bool + +endmenu
arch/mips/mach-bmips/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += dram.o
arch/mips/mach-bmips/dram.c new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (C) 2016 Daniel Schwierzeck <[email protected]> +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <ram.h> +#include <dm.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int dram_init (void ) +{ +struct ram_info ram; +struct udevice *dev; +int err; + + err =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (err) { +debug ("DRAM init failed: %d\n" , err); +return 0 ; + } + + err =ram_get_info (dev, &ram); +if (err) { +debug ("Cannot get DRAM size: %d\n" , err); +return 0 ; + } + +debug ("SDRAM base=%zx, size=%x\n" , ram.base, ram.size); + + gd->ram_size = ram.size; + +return 0 ; +}
include/configs/bmips_common.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_BMIPS_COMMON_H +#define __CONFIG_BMIPS_COMMON_H + +/* RAM */ +#define CONFIG_SYS_MEMTEST_START 0xa0000000 +#define CONFIG_SYS_MEMTEST_END 0xa2000000 + +/* Serial */ +#define CONFIG_BAUDRATE 115200 + +/* Memory usage */ +#define CONFIG_SYS_MAXARGS 24 +#define CONFIG_SYS_MALLOC_LEN (1024 * 1024) +#define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024) +#define CONFIG_SYS_CBSIZE 512 + +/* U-Boot */ +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE +#define CONFIG_REMAKE_ELF + +#endif /* __CONFIG_BMIPS_COMMON_H */
Signature · 1 line
2.1.4
PATCH v5 8/14 MIPS: add initial infrastructure for Broadcom MIPS SoCs
Am 23.04.2017 um 10:43 schrieb Álvaro Fernández Rojas:
Quoted 99 lines
CFE checks CPU Thread in a different way (using register $22):
mfc0 t1,C0_BCM_CONFIG, 3 # $22
li t2,CP0_CMT_TPID# (1 << 31)
and t1, t2
bnez t1, 2f # if we are running on thread 1, skip init
nopSigned-off-by Álvaro Fernández Rojas <[email protected]>---
v4: No changes.
v5: No changes.
v3: SelectCONFIG_REMAKE_ELF.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
- Replace initdram withdram_init.
- Merge with "fix first CPU check" patch.arch/mips/Kconfig | 10 ++++++++++ arch/mips/Makefile | 1 + arch/mips/cpu/start.S | 5 +++++ arch/mips/mach-bmips/Kconfig | 22 ++++++++++++++++++++++ arch/mips/mach-bmips/Makefile | 5 +++++ arch/mips/mach-bmips/dram.c | 37 +++++++++++++++++++++++++++++++++++++ include/configs/bmips_common.h | 27 +++++++++++++++++++++++++++ 7 files changed, 107 insertions(+) create mode 100644 arch/mips/mach-bmips/Kconfig create mode 100644 arch/mips/mach-bmips/Makefile create mode 100644 arch/mips/mach-bmips/dram.c create mode 100644 include/configs/bmips_common.harch/mips/Kconfig +10
-0@@ -75,6 +75,15 @@ config ARCH_ATH79 select OF_CONTROL select DM +config ARCH_BMIPS + bool "Support BMIPS SoCs" + select OF_CONTROL + select DM + select CLK + select CPU + select RAM + select SYSRESET + config MACH_PIC32 bool "Support Microchip PIC32" select OF_CONTROL@@ -123,6 +132,7 @@ source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" source "arch/mips/mach-ath79/Kconfig" +source "arch/mips/mach-bmips/Kconfig" source "arch/mips/mach-pic32/Kconfig" if MIPSarch/mips/Makefile +1
-0@@ -15,6 +15,7 @@ libs-y += arch/mips/lib/ machine-$(CONFIG_SOC_AU1X00) += au1x00 machine-$(CONFIG_ARCH_ATH79) += ath79 +machine-$(CONFIG_ARCH_BMIPS) += bmips machine-$(CONFIG_MACH_PIC32) += pic32 machdirs := $(patsubst %,arch/mips/mach-%/,$(machine-y))arch/mips/cpu/start.S +5
-0@@ -151,8 +151,13 @@ reset: mfc0 t0, CP0_GLOBALNUMBER #endif +#ifdef CONFIG_ARCH_BMIPS +1: mfc0 t0, CP0_DIAGNOSTIC, 3 + and t0, t0, (1 << 31) +#else 1: mfc0 t0, CP0_EBASE and t0, t0, EBASE_CPUNUM +#endif /* Hang if this isn't the first CPU in the system */ 2: beqz t0, 4farch/mips/mach-bmips/Kconfig new file +5
-0@@ -0,0 +1,22 @@ +menu "Broadcom MIPS platforms" + depends on ARCH_BMIPS + +config SYS_SOC + default "none"
arch/mips/mach-bmips/Kconfig line 15
Quoted 10 lines
arch/mips/mach-bmips/Kconfig new file +10
-0+ +choice + prompt "Boot mode" + +config BMIPS_BOOT_RAM + bool "RAM boot" + depends on BMIPS_SUPPORTS_BOOT_RAM + help + This builds an image that is linked to a RAM address. Caches are + disabled and environment is built in.
maybe you should rename the Kconfig symbol and rephrase the help text. You want to have a stage2 loader in ELF format. For this, caches shouldn't be disabled or touched at all. Also it's up to the user if he wants a persistent environment in flash.
Quoted 95 lines
arch/mips/mach-bmips/Kconfig new file +7
-0+ +endchoice + +config BMIPS_SUPPORTS_BOOT_RAM + bool + +endmenuarch/mips/mach-bmips/Makefile new file +5
-0@@ -0,0 +1,5 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += dram.oarch/mips/mach-bmips/dram.c new file +37
-0@@ -0,0 +1,37 @@ +/* +* Copyright (C) 2016 Daniel Schwierzeck <[email protected]> +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <ram.h> +#include <dm.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int dram_init (void ) +{ +struct ram_info ram; +struct udevice *dev; +int err; + + err =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (err) { +debug ("DRAM init failed: %d\n" , err); +return 0 ; + } + + err =ram_get_info (dev, &ram); +if (err) { +debug ("Cannot get DRAM size: %d\n" , err); +return 0 ; + } + +debug ("SDRAM base=%zx, size=%x\n" , ram.base, ram.size); + + gd->ram_size = ram.size; + +return 0 ; +}include/configs/bmips_common.h new file +27
-0@@ -0,0 +1,27 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_BMIPS_COMMON_H +#define __CONFIG_BMIPS_COMMON_H + +/* RAM */ +#define CONFIG_SYS_MEMTEST_START 0xa0000000 +#define CONFIG_SYS_MEMTEST_END 0xa2000000 + +/* Serial */ +#define CONFIG_BAUDRATE 115200 + +/* Memory usage */ +#define CONFIG_SYS_MAXARGS 24 +#define CONFIG_SYS_MALLOC_LEN (1024 * 1024) +#define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024) +#define CONFIG_SYS_CBSIZE 512 + +/* U-Boot */ +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE +#define CONFIG_REMAKE_ELF + +#endif /* __CONFIG_BMIPS_COMMON_H */
Signature · 9 lines
- Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170423/c428988c/attachment.sig>
PATCH v5 8/14 MIPS: add initial infrastructure for Broadcom MIPS SoCs
Hi Daniel,
I'm not using it as a second stage loader yet, but I plan to do that in the future (or at least on 63268 NAND devices).Right now I'm testing BMIPS support by booting u-boot.elf from RAM (loaded via TFTP from CFE bootloader).
On the other hand, I haven't yet checked what CFE loads from NAND on 63268 devices, but it's probably a bin cferam and not an elf.However, I can describe you what I think I know from 63268 devices:- They boot from a minimal CFE version stored in NAND (stage 1 CFE or cferom).- Then, CFE reads a JFFS2 partition from and loads a second stage CFE (or cferam). This is the one I plan to replace with u-boot since there's no documentation available for 63268 low level init.- After that, cferam loads and boots linux from that same JFFS2 partition where cferam is stored. So, I still think that BMIPS_BOOT_RAM is appropriate, but you're right about changing the description.
BTW, sorry for sending this email in HTML, but I can only send it from my phone right now.
Regards,Álvaro.
On Sun, Apr 23, 2017 at 10:23 PM +0200, "Daniel Schwierzeck" <[email protected]> wrote:
Am 23.04.2017 um 10:43 schrieb Álvaro Fernández Rojas:
Quoted 99 lines
CFE checks CPU Thread in a different way (using register $22):
mfc0 t1,C0_BCM_CONFIG, 3 # $22
li t2,CP0_CMT_TPID# (1 << 31)
and t1, t2
bnez t1, 2f # if we are running on thread 1, skip init
nopSigned-off-by Álvaro Fernández Rojas---
v4: No changes.
v5: No changes.
v3: SelectCONFIG_REMAKE_ELF.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
- Replace initdram withdram_init.
- Merge with "fix first CPU check" patch.arch/mips/Kconfig | 10 ++++++++++ arch/mips/Makefile | 1 + arch/mips/cpu/start.S | 5 +++++ arch/mips/mach-bmips/Kconfig | 22 ++++++++++++++++++++++ arch/mips/mach-bmips/Makefile | 5 +++++ arch/mips/mach-bmips/dram.c | 37 +++++++++++++++++++++++++++++++++++++ include/configs/bmips_common.h | 27 +++++++++++++++++++++++++++ 7 files changed, 107 insertions(+) create mode 100644 arch/mips/mach-bmips/Kconfig create mode 100644 arch/mips/mach-bmips/Makefile create mode 100644 arch/mips/mach-bmips/dram.c create mode 100644 include/configs/bmips_common.harch/mips/Kconfig +10
-0@@ -75,6 +75,15 @@ config ARCH_ATH79 select OF_CONTROL select DM +config ARCH_BMIPS + bool "Support BMIPS SoCs" + select OF_CONTROL + select DM + select CLK + select CPU + select RAM + select SYSRESET + config MACH_PIC32 bool "Support Microchip PIC32" select OF_CONTROL@@ -123,6 +132,7 @@ source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" source "arch/mips/mach-ath79/Kconfig" +source "arch/mips/mach-bmips/Kconfig" source "arch/mips/mach-pic32/Kconfig" if MIPSarch/mips/Makefile +1
-0@@ -15,6 +15,7 @@ libs-y += arch/mips/lib/ machine-$(CONFIG_SOC_AU1X00) += au1x00 machine-$(CONFIG_ARCH_ATH79) += ath79 +machine-$(CONFIG_ARCH_BMIPS) += bmips machine-$(CONFIG_MACH_PIC32) += pic32 machdirs := $(patsubst %,arch/mips/mach-%/,$(machine-y))arch/mips/cpu/start.S +5
-0@@ -151,8 +151,13 @@ reset: mfc0 t0, CP0_GLOBALNUMBER #endif +#ifdef CONFIG_ARCH_BMIPS +1: mfc0 t0, CP0_DIAGNOSTIC, 3 + and t0, t0, (1 << 31) +#else 1: mfc0 t0, CP0_EBASE and t0, t0, EBASE_CPUNUM +#endif /* Hang if this isn't the first CPU in the system */ 2: beqz t0, 4farch/mips/mach-bmips/Kconfig new file +5
-0@@ -0,0 +1,22 @@ +menu "Broadcom MIPS platforms" + depends on ARCH_BMIPS + +config SYS_SOC + default "none"
arch/mips/mach-bmips/Kconfig line 15
Quoted 10 lines
arch/mips/mach-bmips/Kconfig new file +10
-0+ +choice + prompt "Boot mode" + +config BMIPS_BOOT_RAM + bool "RAM boot" + depends on BMIPS_SUPPORTS_BOOT_RAM + help + This builds an image that is linked to a RAM address. Caches are + disabled and environment is built in.
maybe you should rename the Kconfig symbol and rephrase the help text. You want to have a stage2 loader in ELF format. For this, caches shouldn't be disabled or touched at all. Also it's up to the user if he wants a persistent environment in flash.
Quoted 36 lines
arch/mips/mach-bmips/Kconfig new file +7
-0+ +endchoice + +config BMIPS_SUPPORTS_BOOT_RAM + bool + +endmenuarch/mips/mach-bmips/Makefile new file +5
-0@@ -0,0 +1,5 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += dram.oarch/mips/mach-bmips/dram.c new file +12
-0@@ -0,0 +1,37 @@ +/* +* Copyright (C) 2016 Daniel Schwierzeck +* Copyright (C) 2017 Álvaro Fernández Rojas +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR;
arch/mips/mach-bmips/dram.c line 22
Quoted 10 lines
arch/mips/mach-bmips/dram.c new file +10
-0+ +int dram_init (void ) +{ +struct ram_info ram; +struct udevice *dev; +int err; + + err =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (err) { + debug("DRAM init failed: %d
", err);
arch/mips/mach-bmips/dram.c
Quoted 6 lines
arch/mips/mach-bmips/dram.c new file +6
-0+return 0 ; + } + + err =ram_get_info (dev, &ram); +if (err) { + debug("Cannot get DRAM size: %d
", err);
arch/mips/mach-bmips/dram.c
Quoted 4 lines
arch/mips/mach-bmips/dram.c new file +4
-0+return 0 ; + } + + debug("SDRAM base=%zx, size=%x
", ram.base, ram.size);
Quoted 39 lines
arch/mips/mach-bmips/dram.c new file +5
-0+ + gd->ram_size = ram.size; + +return 0 ; +}include/configs/bmips_common.h new file +27
-0@@ -0,0 +1,27 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_BMIPS_COMMON_H +#define __CONFIG_BMIPS_COMMON_H + +/* RAM */ +#define CONFIG_SYS_MEMTEST_START 0xa0000000 +#define CONFIG_SYS_MEMTEST_END 0xa2000000 + +/* Serial */ +#define CONFIG_BAUDRATE 115200 + +/* Memory usage */ +#define CONFIG_SYS_MAXARGS 24 +#define CONFIG_SYS_MALLOC_LEN (1024 * 1024) +#define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024) +#define CONFIG_SYS_CBSIZE 512 + +/* U-Boot */ +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE +#define CONFIG_REMAKE_ELF + +#endif /* __CONFIG_BMIPS_COMMON_H */
Signature · 1 line
- Daniel
PATCH v5 9/14 MIPS: add support for Broadcom MIPS BCM6358 SoC family
In reply to Álvaro Fernández Rojas---
v5: No changes.
v4: No changes.
v3: Add cfi-flash defines.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
- Add PERF_BASE to cpus.
- Merge with "fix ioremap for BCM6358" patch.
- Add a custom ioremap.h instead of modifying the generic one.
arch/mips/dts/brcm,bcm6358.dtsi | 98 ++++++++++++++++++++++++++++++++++ arch/mips/mach-bmips/Kconfig | 18 ++++++- arch/mips/mach-bmips/include/ioremap.h | 45 ++++++++++++++++ include/configs/bmips_bcm6358.h | 30 +++++++++++ 4 files changed, 190 insertions(+), 1 deletion(-) create mode 100644 arch/mips/dts/brcm,bcm6358.dtsi create mode 100644 arch/mips/mach-bmips/include/ioremap.h create mode 100644 include/configs/bmips_bcm6358.h
arch/mips/dts/brcm,bcm6358.dtsi new file +98 -0
@@ -0,0 +1,98 @@ +/* + * Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <dt-bindings/gpio/gpio.h> +#include "skeleton.dtsi" + +/ { + compatible = "brcm,bcm6358"; + + cpus { + reg = <0xfffe0000 0x4>; + #address-cells = <1>; + #size-cells = <0>; + u-boot,dm-pre-reloc; + + cpu at 0 { + compatible = "brcm,bcm6358-cpu", "mips,mips4Kc"; + device_type = "cpu"; + reg = <0>; + u-boot,dm-pre-reloc; + }; + + cpu at 1 { + compatible = "brcm,bcm6358-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; + }; + }; + + pflash: nor at 1e000000 { + compatible = "cfi-flash"; + reg = <0x1e000000 0x2000000>; + bank-width = <2>; + #address-cells = <1>; + #size-cells = <1>; + + status = "disabled"; + }; + + ubus { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + u-boot,dm-pre-reloc; + + periph_cntl: syscon at fffe0000 { + compatible = "syscon"; + reg = <0xfffe0000 0xc>; + }; + + reboot: syscon-reboot { + compatible = "syscon-reboot"; + regmap = <&periph_cntl>; + offset = <0x8>; + mask = <0x1>; + }; + + uart0: serial at fffe0100 { + compatible = "brcm,bcm6345-uart"; + reg = <0xfffe0100 0x18>; + clocks = <&periph_osc>; + + status = "disabled"; + }; + + uart1: serial at fffe0120 { + compatible = "brcm,bcm6345-uart"; + reg = <0xfffe0120 0x18>; + clocks = <&periph_osc>; + + status = "disabled"; + }; + + memory-controller at fffe1200 { + compatible = "brcm,bcm6358-mc"; + reg = <0xfffe1200 0x1000>; + u-boot,dm-pre-reloc; + }; + }; +};
arch/mips/mach-bmips/Kconfig +17 -1
@@ -2,7 +2,23 @@ menu "Broadcom MIPS platforms" depends on ARCH_BMIPS config SYS_SOC - default "none" + default "bcm6358" if SOC_BMIPS_BCM6358 + +choice + prompt "Broadcom MIPS SoC select" + +config SOC_BMIPS_BCM6358 + bool "BMIPS BCM6358 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 BCM6358 family including BCM6358 and BCM6359. + +endchoice choice prompt "Boot mode"
arch/mips/mach-bmips/include/ioremap.h new file +45 -0
45 lines not on this page · raw message
include/configs/bmips_bcm6358.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_BMIPS_BCM6358_H +#define __CONFIG_BMIPS_BCM6358_H + +/* CPU */ +#define CONFIG_SYS_MIPS_TIMER_FREQ 150000000 + +/* 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_SYS_INIT_SP_OFFSET 0x2000 +#define CONFIG_SKIP_LOWLEVEL_INIT +#endif + +#define CONFIG_SYS_FLASH_BASE 0xbe000000 +#define CONFIG_SYS_FLASH_EMPTY_INFO +#define CONFIG_SYS_FLASH_PROTECTION +#define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1 + +#endif /* __CONFIG_BMIPS_BCM6358_H */
Signature · 1 line
2.1.4
PATCH v5 10/14 MIPS: add BMIPS Huawei HG556a board
In reply to Álvaro Fernández Rojas---
v5: No changes.
v4: No changes.
v3: Add cfi-flash support.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
- Remove DEBUG_UART from defconfig.
arch/mips/dts/Makefile | 1 + arch/mips/dts/huawei,hg556a.dts | 31 +++++++++++++++++++++++++ arch/mips/mach-bmips/Kconfig | 12 ++++++++++ board/huawei/hg556a/Kconfig | 12 ++++++++++ board/huawei/hg556a/MAINTAINERS | 6 +++++ board/huawei/hg556a/Makefile | 5 +++++ board/huawei/hg556a/hg556a.c | 7 ++++++ configs/huawei_hg556a_ram_defconfig | 45 +++++++++++++++++++++++++++++++++++++ include/configs/huawei_hg556a.h | 18 +++++++++++++++ 9 files changed, 137 insertions(+) create mode 100644 arch/mips/dts/huawei,hg556a.dts create mode 100644 board/huawei/hg556a/Kconfig create mode 100644 board/huawei/hg556a/MAINTAINERS create mode 100644 board/huawei/hg556a/Makefile create mode 100644 board/huawei/hg556a/hg556a.c create mode 100644 configs/huawei_hg556a_ram_defconfig create mode 100644 include/configs/huawei_hg556a.h
arch/mips/dts/Makefile +1 -0
@@ -8,6 +8,7 @@ dtb-$(CONFIG_TARGET_BOSTON) += img,boston.dtb dtb-$(CONFIG_TARGET_MALTA) += mti,malta.dtb dtb-$(CONFIG_TARGET_PIC32MZDASK) += pic32mzda_sk.dtb dtb-$(CONFIG_TARGET_XILFPGA) += nexys4ddr.dtb +dtb-$(CONFIG_BOARD_HUAWEI_HG556A) += huawei,hg556a.dtb dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb targets += $(dtb-y)
arch/mips/dts/huawei,hg556a.dts new file +31 -0
@@ -0,0 +1,31 @@ +/* + * Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/dts-v1/; + +#include "brcm,bcm6358.dtsi" + +/ { + model = "Huawei HG556a Board"; + compatible = "huawei,hg556a", "brcm,bcm6358"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&pflash { + status = "okay"; +}; + +&uart0 { + u-boot,dm-pre-reloc; + status = "okay"; +};
arch/mips/mach-bmips/Kconfig +12 -0
@@ -21,6 +21,16 @@ config SOC_BMIPS_BCM6358 endchoice choice + prompt "Board select" + +config BOARD_HUAWEI_HG556A + bool "Huawei HG556a board" + depends on SOC_BMIPS_BCM6358 + select BMIPS_SUPPORTS_BOOT_RAM + +endchoice + +choice prompt "Boot mode" config BMIPS_BOOT_RAM
@@ -35,4 +45,6 @@ endchoice config BMIPS_SUPPORTS_BOOT_RAM bool +source "board/huawei/hg556a/Kconfig" + endmenu
board/huawei/hg556a/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +if BOARD_HUAWEI_HG556A + +config SYS_BOARD + default "hg556a" + +config SYS_VENDOR + default "huawei" + +config SYS_CONFIG_NAME + default "huawei_hg556a" + +endif
board/huawei/hg556a/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +HUAWEI HG556A BOARD +M: Álvaro Fernández Rojas <[email protected]> +S: Maintained +F: board/huawei/hg556a/ +F: include/configs/huawei_hg556a.h +F: configs/huawei_hg556a_ram_defconfig
board/huawei/hg556a/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += hg556a.o
board/huawei/hg556a/hg556a.c new file +7 -0
@@ -0,0 +1,7 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h>
configs/huawei_hg556a_ram_defconfig new file +45 -0
45 lines not on this page · raw message
include/configs/huawei_hg556a.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <configs/bmips_common.h> +#include <configs/bmips_bcm6358.h> + +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE (8 * 1024) + +#define CONFIG_SYS_LONGHELP +#define CONFIG_AUTO_COMPLETE +#define CONFIG_CMDLINE_EDITING + +#define CONFIG_SYS_FLASH_CFI 1 +#define CONFIG_FLASH_CFI_DRIVER 1
Signature · 1 line
2.1.4
PATCH v5 11/14 MIPS: add support for Broadcom MIPS BCM6328 SoC family
In reply to Álvaro Fernández Rojas---
v5: No changes.
v4: No changes.
v3: No changes.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
- Add PERF_BASE to cpus.
arch/mips/dts/brcm,bcm6328.dtsi | 88 +++++++++++++++++++++++++++++++++++++++++ arch/mips/mach-bmips/Kconfig | 12 ++++++ include/configs/bmips_bcm6328.h | 25 ++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 arch/mips/dts/brcm,bcm6328.dtsi create mode 100644 include/configs/bmips_bcm6328.h
arch/mips/dts/brcm,bcm6328.dtsi new file +88 -0
@@ -0,0 +1,88 @@ +/* + * Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <dt-bindings/gpio/gpio.h> +#include "skeleton.dtsi" + +/ { + compatible = "brcm,bcm6328"; + + cpus { + reg = <0x10000000 0x4>; + #address-cells = <1>; + #size-cells = <0>; + u-boot,dm-pre-reloc; + + cpu at 0 { + compatible = "brcm,bcm6328-cpu", "mips,mips4Kc"; + device_type = "cpu"; + reg = <0>; + u-boot,dm-pre-reloc; + }; + + cpu at 1 { + compatible = "brcm,bcm6328-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; + + reset_cntl: syscon at 10000068 { + compatible = "syscon"; + reg = <0x10000068 0x4>; + }; + + reboot: syscon-reboot { + compatible = "syscon-reboot"; + regmap = <&reset_cntl>; + offset = <0>; + mask = <0x1>; + }; + + uart0: serial at 10000100 { + compatible = "brcm,bcm6345-uart"; + reg = <0x10000100 0x18>; + clocks = <&periph_osc>; + + status = "disabled"; + }; + + uart1: serial at 10000120 { + compatible = "brcm,bcm6345-uart"; + reg = <0x10000120 0x18>; + clocks = <&periph_osc>; + + status = "disabled"; + }; + + memory-controller at 10003000 { + compatible = "brcm,bcm6328-mc"; + reg = <0x10003000 0x1000>; + u-boot,dm-pre-reloc; + }; + }; +};
arch/mips/mach-bmips/Kconfig +12 -0
@@ -2,11 +2,23 @@ menu "Broadcom MIPS platforms" depends on ARCH_BMIPS config SYS_SOC + default "bcm6328" if SOC_BMIPS_BCM6328 default "bcm6358" if SOC_BMIPS_BCM6358 choice prompt "Broadcom MIPS SoC select" +config SOC_BMIPS_BCM6328 + bool "BMIPS BCM6328 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 BCM6328 family including BCM63281 and BCM63283. + config SOC_BMIPS_BCM6358 bool "BMIPS BCM6358 family" select SUPPORTS_BIG_ENDIAN
include/configs/bmips_bcm6328.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_BMIPS_BCM6328_H +#define __CONFIG_BMIPS_BCM6328_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_SYS_INIT_SP_OFFSET 0x2000 +#define CONFIG_SKIP_LOWLEVEL_INIT +#endif + +#endif /* __CONFIG_BMIPS_BCM6328_H */
Signature · 1 line
2.1.4
PATCH v5 12/14 MIPS: add BMIPS Comtrend AR-5387un board
In reply to Álvaro Fernández Rojas---
v5: No changes.
v4: No changes.
v3: No changes.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
- Remove DEBUG_UART from defconfig.
arch/mips/dts/Makefile | 1 + arch/mips/dts/comtrend,ar-5387un.dts | 27 +++++++++++++++++++++ arch/mips/mach-bmips/Kconfig | 6 +++++ board/comtrend/ar5387un/Kconfig | 12 ++++++++++ board/comtrend/ar5387un/MAINTAINERS | 6 +++++ board/comtrend/ar5387un/Makefile | 5 ++++ board/comtrend/ar5387un/ar-5387un.c | 7 ++++++ configs/comtrend_ar5387un_ram_defconfig | 42 +++++++++++++++++++++++++++++++++ include/configs/comtrend_ar5387un.h | 15 ++++++++++++ 9 files changed, 121 insertions(+) create mode 100644 arch/mips/dts/comtrend,ar-5387un.dts create mode 100644 board/comtrend/ar5387un/Kconfig create mode 100644 board/comtrend/ar5387un/MAINTAINERS create mode 100644 board/comtrend/ar5387un/Makefile create mode 100644 board/comtrend/ar5387un/ar-5387un.c create mode 100644 configs/comtrend_ar5387un_ram_defconfig create mode 100644 include/configs/comtrend_ar5387un.h
arch/mips/dts/Makefile +1 -0
@@ -8,6 +8,7 @@ dtb-$(CONFIG_TARGET_BOSTON) += img,boston.dtb dtb-$(CONFIG_TARGET_MALTA) += mti,malta.dtb dtb-$(CONFIG_TARGET_PIC32MZDASK) += pic32mzda_sk.dtb dtb-$(CONFIG_TARGET_XILFPGA) += nexys4ddr.dtb +dtb-$(CONFIG_BOARD_COMTREND_AR5387UN) += comtrend,ar-5387un.dtb dtb-$(CONFIG_BOARD_HUAWEI_HG556A) += huawei,hg556a.dtb dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb
arch/mips/dts/comtrend,ar-5387un.dts new file +27 -0
@@ -0,0 +1,27 @@ +/* + * Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/dts-v1/; + +#include "brcm,bcm6328.dtsi" + +/ { + model = "Comtrend AR-5387un Board"; + compatible = "comtrend,ar5387-un", "brcm,bcm6328"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&uart0 { + u-boot,dm-pre-reloc; + status = "okay"; +};
arch/mips/mach-bmips/Kconfig +6 -0
@@ -35,6 +35,11 @@ endchoice choice prompt "Board select" +config BOARD_COMTREND_AR5387UN + bool "Comtrend AR-5387un board" + depends on SOC_BMIPS_BCM6328 + select BMIPS_SUPPORTS_BOOT_RAM + config BOARD_HUAWEI_HG556A bool "Huawei HG556a board" depends on SOC_BMIPS_BCM6358
@@ -57,6 +62,7 @@ endchoice config BMIPS_SUPPORTS_BOOT_RAM bool +source "board/comtrend/ar5387un/Kconfig" source "board/huawei/hg556a/Kconfig" endmenu
board/comtrend/ar5387un/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +if BOARD_COMTREND_AR5387UN + +config SYS_BOARD + default "ar5387un" + +config SYS_VENDOR + default "comtrend" + +config SYS_CONFIG_NAME + default "comtrend_ar5387un" + +endif
board/comtrend/ar5387un/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +COMTREND AR-5387UN BOARD +M: Álvaro Fernández Rojas <[email protected]> +S: Maintained +F: board/comtrend/ar-5387un/ +F: include/configs/comtrend_ar5387un.h +F: configs/comtrend_ar5387un_ram_defconfig
board/comtrend/ar5387un/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += ar-5387un.o
board/comtrend/ar5387un/ar-5387un.c new file +7 -0
@@ -0,0 +1,7 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h>
configs/comtrend_ar5387un_ram_defconfig new file +42 -0
42 lines not on this page · raw message
include/configs/comtrend_ar5387un.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <configs/bmips_common.h> +#include <configs/bmips_bcm6328.h> + +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE (8 * 1024) + +#define CONFIG_SYS_LONGHELP +#define CONFIG_AUTO_COMPLETE +#define CONFIG_CMDLINE_EDITING
Signature · 1 line
2.1.4
PATCH v5 13/14 MIPS: add support for Broadcom MIPS BCM63268 SoC family
In reply to Álvaro Fernández Rojas---
v5: No changes.
v4: No changes.
v3: No changes.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
- Add PERF_BASE to cpus.
arch/mips/dts/brcm,bcm63268.dtsi | 88 ++++++++++++++++++++++++++++++++++++++++ arch/mips/mach-bmips/Kconfig | 12 ++++++ include/configs/bmips_bcm63268.h | 25 ++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 arch/mips/dts/brcm,bcm63268.dtsi create mode 100644 include/configs/bmips_bcm63268.h
arch/mips/dts/brcm,bcm63268.dtsi new file +88 -0
@@ -0,0 +1,88 @@ +/* + * Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <dt-bindings/gpio/gpio.h> +#include "skeleton.dtsi" + +/ { + compatible = "brcm,bcm63268"; + + cpus { + reg = <0x10000000 0x4>; + #address-cells = <1>; + #size-cells = <0>; + u-boot,dm-pre-reloc; + + cpu at 0 { + compatible = "brcm,bcm63268-cpu", "mips,mips4Kc"; + device_type = "cpu"; + reg = <0>; + u-boot,dm-pre-reloc; + }; + + cpu at 1 { + compatible = "brcm,bcm63268-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; + + periph_cntl: syscon at 10000000 { + compatible = "syscon"; + reg = <0x10000000 0x14>; + }; + + reboot: syscon-reboot { + compatible = "syscon-reboot"; + regmap = <&periph_cntl>; + offset = <0x8>; + mask = <0x1>; + }; + + uart0: serial at 10000180 { + compatible = "brcm,bcm6345-uart"; + reg = <0x10000180 0x18>; + clocks = <&periph_osc>; + + status = "disabled"; + }; + + uart1: serial at 100001a0 { + compatible = "brcm,bcm6345-uart"; + reg = <0x100001a0 0x18>; + clocks = <&periph_osc>; + + status = "disabled"; + }; + + memory-controller at 10003000 { + compatible = "brcm,bcm6328-mc"; + reg = <0x10003000 0x1000>; + u-boot,dm-pre-reloc; + }; + }; +};
arch/mips/mach-bmips/Kconfig +12 -0
@@ -4,6 +4,7 @@ menu "Broadcom MIPS platforms" config SYS_SOC default "bcm6328" if SOC_BMIPS_BCM6328 default "bcm6358" if SOC_BMIPS_BCM6358 + default "bcm63268" if SOC_BMIPS_BCM63268 choice prompt "Broadcom MIPS SoC select"
@@ -30,6 +31,17 @@ config SOC_BMIPS_BCM6358 help This supports BMIPS BCM6358 family including BCM6358 and BCM6359. +config SOC_BMIPS_BCM63268 + bool "BMIPS BCM63268 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 BCM63268 family including BCM63168, BCM63169, BCM63268 and BCM63269. + endchoice choice
include/configs/bmips_bcm63268.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_BMIPS_BCM63268_H +#define __CONFIG_BMIPS_BCM63268_H + +/* CPU */ +#define CONFIG_SYS_MIPS_TIMER_FREQ 200000000 + +/* 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_SYS_INIT_SP_OFFSET 0x2000 +#define CONFIG_SKIP_LOWLEVEL_INIT +#endif + +#endif /* __CONFIG_BMIPS_BCM63268_H */
Signature · 1 line
2.1.4
PATCH v5 14/14 MIPS: add BMIPS Comtrend VR-3032u board
In reply to Álvaro Fernández Rojas---
v5: No changes.
v4: No changes.
v3: No changes.
v2: Introduce changes suggested by Daniel Schwierzeck:
- Split BMIPS support patches.
- Remove DEBUG_UART from defconfig.
arch/mips/dts/Makefile | 1 + arch/mips/dts/comtrend,vr-3032u.dts | 27 ++++++++++++++++++++++ arch/mips/mach-bmips/Kconfig | 6 +++++ board/comtrend/vr3032u/Kconfig | 12 ++++++++++ board/comtrend/vr3032u/MAINTAINERS | 6 +++++ board/comtrend/vr3032u/Makefile | 5 ++++ board/comtrend/vr3032u/vr-3032u.c | 7 ++++++ configs/comtrend_vr3032u_ram_defconfig | 42 ++++++++++++++++++++++++++++++++++ include/configs/comtrend_vr3032u.h | 15 ++++++++++++ 9 files changed, 121 insertions(+) create mode 100644 arch/mips/dts/comtrend,vr-3032u.dts create mode 100644 board/comtrend/vr3032u/Kconfig create mode 100644 board/comtrend/vr3032u/MAINTAINERS create mode 100644 board/comtrend/vr3032u/Makefile create mode 100644 board/comtrend/vr3032u/vr-3032u.c create mode 100644 configs/comtrend_vr3032u_ram_defconfig create mode 100644 include/configs/comtrend_vr3032u.h
arch/mips/dts/Makefile +1 -0
@@ -9,6 +9,7 @@ dtb-$(CONFIG_TARGET_MALTA) += mti,malta.dtb dtb-$(CONFIG_TARGET_PIC32MZDASK) += pic32mzda_sk.dtb dtb-$(CONFIG_TARGET_XILFPGA) += nexys4ddr.dtb dtb-$(CONFIG_BOARD_COMTREND_AR5387UN) += comtrend,ar-5387un.dtb +dtb-$(CONFIG_BOARD_COMTREND_VR3032U) += comtrend,vr-3032u.dtb dtb-$(CONFIG_BOARD_HUAWEI_HG556A) += huawei,hg556a.dtb dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb
arch/mips/dts/comtrend,vr-3032u.dts new file +27 -0
@@ -0,0 +1,27 @@ +/* + * Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/dts-v1/; + +#include "brcm,bcm63268.dtsi" + +/ { + model = "Comtrend VR-3032u Board"; + compatible = "comtrend,vr-3032u", "brcm,bcm63268"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&uart0 { + u-boot,dm-pre-reloc; + status = "okay"; +};
arch/mips/mach-bmips/Kconfig +6 -0
@@ -57,6 +57,11 @@ config BOARD_HUAWEI_HG556A depends on SOC_BMIPS_BCM6358 select BMIPS_SUPPORTS_BOOT_RAM +config BOARD_COMTREND_VR3032U + bool "Comtrend VR-3032u board" + depends on SOC_BMIPS_BCM63268 + select BMIPS_SUPPORTS_BOOT_RAM + endchoice choice
@@ -75,6 +80,7 @@ config BMIPS_SUPPORTS_BOOT_RAM bool source "board/comtrend/ar5387un/Kconfig" +source "board/comtrend/vr3032u/Kconfig" source "board/huawei/hg556a/Kconfig" endmenu
board/comtrend/vr3032u/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +if BOARD_COMTREND_VR3032U + +config SYS_BOARD + default "vr3032u" + +config SYS_VENDOR + default "comtrend" + +config SYS_CONFIG_NAME + default "comtrend_vr3032u" + +endif
board/comtrend/vr3032u/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +COMTREND VR-3032U BOARD +M: Álvaro Fernández Rojas <[email protected]> +S: Maintained +F: board/comtrend/vr-3032u/ +F: include/configs/comtrend_vr-3032u.h +F: configs/comtrend_vr3032u_ram_defconfig
board/comtrend/vr3032u/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += vr-3032u.o
board/comtrend/vr3032u/vr-3032u.c new file +7 -0
@@ -0,0 +1,7 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h>
configs/comtrend_vr3032u_ram_defconfig new file +42 -0
42 lines not on this page · raw message
include/configs/comtrend_vr3032u.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <configs/bmips_common.h> +#include <configs/bmips_bcm63268.h> + +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE (8 * 1024) + +#define CONFIG_SYS_LONGHELP +#define CONFIG_AUTO_COMPLETE +#define CONFIG_CMDLINE_EDITING
Signature · 1 line
2.1.4