From 98626f8441add596486b5fd176a5ea6fa16609c8 Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Thu, 29 Nov 2018 11:58:34 +0100 Subject: add RPI3 Support Signed-off-by: Rouven Czerwinski --- configs/platform-v7a/barebox-rpi2.config | 8 ++- configs/platform-v7a/config/images/rpi2.config | 2 +- configs/platform-v7a/config/images/rpi3.config | 30 +++++++++ configs/platform-v7a/kernelconfig | 29 ++++++-- ...001-ARM-imx-add-support-for-Udoo-Neo-full.patch | 20 +++--- .../0101-ARM-rpi-fix-typo-in-rpi-common.c.patch | 31 +++++++++ ...8.12.0-customers-pengutronix-multiv7-2018.patch | 22 ------ ...-move-clks-into-board-specific-rpi-common.patch | 77 +++++++++++++++++++++ ...rpi-retrieve-miniuart-clock-from-firmware.patch | 34 ++++++++++ ...erial_ns16550-handle-default-reg-io-width.patch | 78 ++++++++++++++++++++++ ...6550-add-raspberry-pi-compatible-and-init.patch | 62 +++++++++++++++++ .../0106-ARM-rpi-add-NS16550-support.patch | 24 +++++++ .../0107-ARM-rpi-choose-miniuart-as-stdout.patch | 34 ++++++++++ ...m283x-remove-miniuart-overlay-instruction.patch | 24 +++++++ ...8.12.0-customers-pengutronix-multiv7-2018.patch | 21 ++++++ .../platform-v7a/patches/barebox-2018.12.0/series | 21 ++++-- configs/platform-v7a/platformconfig | 4 +- configs/platform-v7a/platforms/blspec-rpi3.in | 5 ++ configs/platform-v7a/platforms/image-rpi3.in | 12 ++++ .../projectroot/loader/entries/rpi3.conf | 6 ++ configs/platform-v7a/rpi-firmware/config.txt | 18 +---- configs/platform-v7a/rules/barebox-rpi2.make | 2 +- configs/platform-v7a/rules/blspec-rpi3.make | 38 +++++++++++ configs/platform-v7a/rules/image-rpi2.make | 1 + configs/platform-v7a/rules/image-rpi3.make | 51 ++++++++++++++ 25 files changed, 591 insertions(+), 63 deletions(-) create mode 100644 configs/platform-v7a/config/images/rpi3.config create mode 100644 configs/platform-v7a/patches/barebox-2018.12.0/0101-ARM-rpi-fix-typo-in-rpi-common.c.patch delete mode 100644 configs/platform-v7a/patches/barebox-2018.12.0/0101-Release-2018.12.0-customers-pengutronix-multiv7-2018.patch create mode 100644 configs/platform-v7a/patches/barebox-2018.12.0/0102-ARM-rpi-move-clks-into-board-specific-rpi-common.patch create mode 100644 configs/platform-v7a/patches/barebox-2018.12.0/0103-ARM-rpi-retrieve-miniuart-clock-from-firmware.patch create mode 100644 configs/platform-v7a/patches/barebox-2018.12.0/0104-serial_ns16550-handle-default-reg-io-width.patch create mode 100644 configs/platform-v7a/patches/barebox-2018.12.0/0105-serial_ns16550-add-raspberry-pi-compatible-and-init.patch create mode 100644 configs/platform-v7a/patches/barebox-2018.12.0/0106-ARM-rpi-add-NS16550-support.patch create mode 100644 configs/platform-v7a/patches/barebox-2018.12.0/0107-ARM-rpi-choose-miniuart-as-stdout.patch create mode 100644 configs/platform-v7a/patches/barebox-2018.12.0/0108-doc-bcm283x-remove-miniuart-overlay-instruction.patch create mode 100644 configs/platform-v7a/patches/barebox-2018.12.0/0201-Release-2018.12.0-customers-pengutronix-multiv7-2018.patch create mode 100644 configs/platform-v7a/platforms/blspec-rpi3.in create mode 100644 configs/platform-v7a/platforms/image-rpi3.in create mode 100644 configs/platform-v7a/projectroot/loader/entries/rpi3.conf create mode 100644 configs/platform-v7a/rules/blspec-rpi3.make create mode 100644 configs/platform-v7a/rules/image-rpi3.make (limited to 'configs/platform-v7a') diff --git a/configs/platform-v7a/barebox-rpi2.config b/configs/platform-v7a/barebox-rpi2.config index 7a9b560..a6f4353 100644 --- a/configs/platform-v7a/barebox-rpi2.config +++ b/configs/platform-v7a/barebox-rpi2.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Barebox/arm 2018.12.0-20181207-1 Configuration +# Barebox/arm 2018.12.0-20181213-1 Configuration # CONFIG_ARM=y CONFIG_ARM_LINUX=y @@ -54,7 +54,7 @@ CONFIG_MACH_RPI_COMMON=y # # CONFIG_MACH_RPI is not set CONFIG_MACH_RPI2=y -# CONFIG_MACH_RPI3 is not set +CONFIG_MACH_RPI3=y CONFIG_BAREBOX_MAX_IMAGE_SIZE=0xffffffff CONFIG_AEABI=y # CONFIG_THUMB2_BAREBOX is not set @@ -67,6 +67,8 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y CONFIG_ARM_EXCEPTIONS=y CONFIG_ARM_UNWIND=y # CONFIG_ARM_SEMIHOSTING is not set +CONFIG_ARM_SMCCC=y +CONFIG_ARM_SECURE_MONITOR=y # CONFIG_ARM_PSCI is not set CONFIG_DEFCONFIG_LIST="$ARCH_DEFCONFIG" CONFIG_GREGORIAN_CALENDER=y @@ -373,7 +375,7 @@ CONFIG_ARM_AMBA=y # CONFIG_SERIAL_DEV_BUS is not set # CONFIG_DRIVER_SERIAL_ARM_DCC is not set CONFIG_SERIAL_AMBA_PL011=y -# CONFIG_DRIVER_SERIAL_NS16550 is not set +CONFIG_DRIVER_SERIAL_NS16550=y # CONFIG_DRIVER_SERIAL_CADENCE is not set # diff --git a/configs/platform-v7a/config/images/rpi2.config b/configs/platform-v7a/config/images/rpi2.config index 9ac19bb..428c00c 100644 --- a/configs/platform-v7a/config/images/rpi2.config +++ b/configs/platform-v7a/config/images/rpi2.config @@ -1,7 +1,7 @@ image rpi2-boot.vfat { vfat { files = { @FIRMWARE_RPI2@ } - file barebox.bin { image = barebox-raspberry-pi-2.img-rpi2 } + file barebox.img { image = barebox-raspberry-pi-2.img-rpi2 } } size = 32M } diff --git a/configs/platform-v7a/config/images/rpi3.config b/configs/platform-v7a/config/images/rpi3.config new file mode 100644 index 0000000..6491146 --- /dev/null +++ b/configs/platform-v7a/config/images/rpi3.config @@ -0,0 +1,30 @@ +image rpi3-boot.vfat { + vfat { + files = { @FIRMWARE_RPI3@ } + file barebox.img { image = barebox-raspberry-pi-3.img-rpi2 } + } + size = 32M +} + +image @IMAGE@ { + hdimage { + align = 1M + disk-signature = 0xbedf7893 + } + partition boot { + image = rpi3-boot.vfat + size = 32M + partition-type = 0xc + bootable = true + } + partition root-A { + image = root.ext2 + partition-type = 0x83 + size = 512M + } + partition data { + partition-type = 0x83 + size = 512M + } +} +/* vim: set tabstop=8 noexpandtab : */ diff --git a/configs/platform-v7a/kernelconfig b/configs/platform-v7a/kernelconfig index 6822576..8c37621 100644 --- a/configs/platform-v7a/kernelconfig +++ b/configs/platform-v7a/kernelconfig @@ -1519,7 +1519,26 @@ CONFIG_DEVKMEM=y # Serial drivers # CONFIG_SERIAL_EARLYCON=y -# CONFIG_SERIAL_8250 is not set +CONFIG_SERIAL_8250=y +# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set +# CONFIG_SERIAL_8250_FINTEK is not set +CONFIG_SERIAL_8250_CONSOLE=y +# CONFIG_SERIAL_8250_DMA is not set +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +CONFIG_SERIAL_8250_EXTENDED=y +# CONFIG_SERIAL_8250_MANY_PORTS is not set +# CONFIG_SERIAL_8250_ASPEED_VUART is not set +CONFIG_SERIAL_8250_SHARE_IRQ=y +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +# CONFIG_SERIAL_8250_RSA is not set +CONFIG_SERIAL_8250_BCM2835AUX=y +CONFIG_SERIAL_8250_FSL=y +# CONFIG_SERIAL_8250_DW is not set +# CONFIG_SERIAL_8250_EM is not set +# CONFIG_SERIAL_8250_RT288X is not set +# CONFIG_SERIAL_8250_OMAP is not set +# CONFIG_SERIAL_OF_PLATFORM is not set # # Non-8250 serial port support @@ -1626,7 +1645,7 @@ CONFIG_SPI_MASTER=y # CONFIG_SPI_ALTERA is not set # CONFIG_SPI_AXI_SPI_ENGINE is not set CONFIG_SPI_BCM2835=y -# CONFIG_SPI_BCM2835AUX is not set +CONFIG_SPI_BCM2835AUX=y # CONFIG_SPI_BCM_QSPI is not set CONFIG_SPI_BITBANG=y # CONFIG_SPI_CADENCE is not set @@ -1826,7 +1845,7 @@ CONFIG_IMX_THERMAL=y # # Broadcom thermal drivers # -# CONFIG_BCM2835_THERMAL is not set +CONFIG_BCM2835_THERMAL=y # # Texas Instruments thermal drivers @@ -2303,7 +2322,7 @@ CONFIG_MMC_SDHCI_OF_ESDHC=y # CONFIG_MMC_SDHCI_CADENCE is not set CONFIG_MMC_SDHCI_ESDHC_IMX=y # CONFIG_MMC_SDHCI_F_SDH30 is not set -# CONFIG_MMC_SDHCI_IPROC is not set +CONFIG_MMC_SDHCI_IPROC=y CONFIG_MMC_OMAP=y CONFIG_MMC_OMAP_HS=y # CONFIG_MMC_MXC is not set @@ -2313,7 +2332,7 @@ CONFIG_MMC_OMAP_HS=y # CONFIG_MMC_USHC is not set # CONFIG_MMC_USDHI6ROL0 is not set # CONFIG_MMC_CQHCI is not set -# CONFIG_MMC_BCM2835 is not set +CONFIG_MMC_BCM2835=y # CONFIG_MMC_MTK is not set # CONFIG_MMC_SDHCI_XENON is not set # CONFIG_MMC_SDHCI_OMAP is not set diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/0001-ARM-imx-add-support-for-Udoo-Neo-full.patch b/configs/platform-v7a/patches/barebox-2018.12.0/0001-ARM-imx-add-support-for-Udoo-Neo-full.patch index 885dd61..b5b5f6f 100644 --- a/configs/platform-v7a/patches/barebox-2018.12.0/0001-ARM-imx-add-support-for-Udoo-Neo-full.patch +++ b/configs/platform-v7a/patches/barebox-2018.12.0/0001-ARM-imx-add-support-for-Udoo-Neo-full.patch @@ -8,16 +8,16 @@ Content-Transfer-Encoding: 8bit Signed-off-by: Uwe Kleine-König Forwarded: id:20170627190317.19253-1-uwe@kleine-koenig.org --- - arch/arm/boards/Makefile | 1 + - arch/arm/boards/udoo-neo/Makefile | 2 + - arch/arm/boards/udoo-neo/board.c | 27 ++++ - .../flash-header-mx6sx-udoo-neo_full.imxcfg | 124 ++++++++++++++++++ - arch/arm/boards/udoo-neo/lowlevel.c | 39 ++++++ - arch/arm/dts/Makefile | 1 + - arch/arm/dts/imx6sx-udoo-neo-full.dts | 4 + - arch/arm/mach-imx/Kconfig | 4 + - arch/arm/mach-imx/include/mach/esdctl.h | 1 + - images/Makefile.imx | 5 + + arch/arm/boards/Makefile | 1 + + arch/arm/boards/udoo-neo/Makefile | 2 + + arch/arm/boards/udoo-neo/board.c | 27 +++++ + .../flash-header-mx6sx-udoo-neo_full.imxcfg | 124 +++++++++++++++++++++ + arch/arm/boards/udoo-neo/lowlevel.c | 39 +++++++ + arch/arm/dts/Makefile | 1 + + arch/arm/dts/imx6sx-udoo-neo-full.dts | 4 + + arch/arm/mach-imx/Kconfig | 4 + + arch/arm/mach-imx/include/mach/esdctl.h | 1 + + images/Makefile.imx | 5 + 10 files changed, 208 insertions(+) create mode 100644 arch/arm/boards/udoo-neo/Makefile create mode 100644 arch/arm/boards/udoo-neo/board.c diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/0101-ARM-rpi-fix-typo-in-rpi-common.c.patch b/configs/platform-v7a/patches/barebox-2018.12.0/0101-ARM-rpi-fix-typo-in-rpi-common.c.patch new file mode 100644 index 0000000..9473e9b --- /dev/null +++ b/configs/platform-v7a/patches/barebox-2018.12.0/0101-ARM-rpi-fix-typo-in-rpi-common.c.patch @@ -0,0 +1,31 @@ +From: Rouven Czerwinski +Date: Wed, 12 Dec 2018 16:43:06 +0100 +Subject: [PATCH] ARM: rpi: fix typo in rpi-common.c + +Signed-off-by: Rouven Czerwinski +--- + arch/arm/boards/raspberry-pi/rpi-common.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c +index b7ce0ad425e8..9f0531fd05d9 100644 +--- a/arch/arm/boards/raspberry-pi/rpi-common.c ++++ b/arch/arm/boards/raspberry-pi/rpi-common.c +@@ -73,7 +73,7 @@ static int rpi_get_arm_mem(u32 *size) + return 0; + } + +-static struct clk *rpi_register_firmare_clock(u32 clock_id, const char *name) ++static struct clk *rpi_register_firmware_clock(u32 clock_id, const char *name) + { + BCM2835_MBOX_STACK_ALIGN(struct msg_get_clock_rate, msg); + int ret; +@@ -285,7 +285,7 @@ static int rpi_clock_init(void) + { + struct clk *clk; + +- clk = rpi_register_firmare_clock(BCM2835_MBOX_CLOCK_ID_EMMC, ++ clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC, + "bcm2835_mci0"); + if (IS_ERR(clk)) + return PTR_ERR(clk); diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/0101-Release-2018.12.0-customers-pengutronix-multiv7-2018.patch b/configs/platform-v7a/patches/barebox-2018.12.0/0101-Release-2018.12.0-customers-pengutronix-multiv7-2018.patch deleted file mode 100644 index 836a7ff..0000000 --- a/configs/platform-v7a/patches/barebox-2018.12.0/0101-Release-2018.12.0-customers-pengutronix-multiv7-2018.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Rouven Czerwinski -Date: Fri, 7 Dec 2018 15:18:01 +0100 -Subject: [PATCH] Release 2018.12.0/customers/pengutronix/multiv7/20181207-1 - -Signed-off-by: Rouven Czerwinski ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index 1ce50d025e47..84de26cbb028 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - VERSION = 2018 - PATCHLEVEL = 12 - SUBLEVEL = 0 --EXTRAVERSION = -+EXTRAVERSION =-20181207-1 - NAME = None - - # *DOCUMENTATION* diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/0102-ARM-rpi-move-clks-into-board-specific-rpi-common.patch b/configs/platform-v7a/patches/barebox-2018.12.0/0102-ARM-rpi-move-clks-into-board-specific-rpi-common.patch new file mode 100644 index 0000000..38aa78e --- /dev/null +++ b/configs/platform-v7a/patches/barebox-2018.12.0/0102-ARM-rpi-move-clks-into-board-specific-rpi-common.patch @@ -0,0 +1,77 @@ +From: Rouven Czerwinski +Date: Wed, 12 Dec 2018 16:43:45 +0100 +Subject: [PATCH] ARM: rpi: move clks into board specific rpi-common + +We don't know if the firmware running on the raspberry pi is the same firmware +which is running on all bcm283x devices. +Therefore move the console clock initialization into the rpi-common.c board file. +A future commit will use this function to retrieve the miniuart clock from the +raspberry pi firmware. +No functional changes. + +Signed-off-by: Rouven Czerwinski +--- + arch/arm/boards/raspberry-pi/rpi-common.c | 19 +++++++++++++++++++ + arch/arm/mach-bcm283x/core.c | 19 ------------------- + 2 files changed, 19 insertions(+), 19 deletions(-) + +diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c +index 9f0531fd05d9..490aeef12306 100644 +--- a/arch/arm/boards/raspberry-pi/rpi-common.c ++++ b/arch/arm/boards/raspberry-pi/rpi-common.c +@@ -297,6 +297,25 @@ static int rpi_clock_init(void) + } + postconsole_initcall(rpi_clock_init); + ++static int rpi_console_clock_init(void) ++{ ++ struct clk *clk; ++ ++ clk = clk_fixed("apb_pclk", 0); ++ clk_register_clkdev(clk, "apb_pclk", NULL); ++ ++ clk = clk_fixed("uart0-pl0110", 3 * 1000 * 1000); ++ clk_register_clkdev(clk, NULL, "uart0-pl0110"); ++ clkdev_add_physbase(clk, 0x20201000, NULL); ++ clkdev_add_physbase(clk, 0x3f201000, NULL); ++ ++ clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000); ++ clk_register_clkdev(clk, NULL, "bcm2835-cs"); ++ ++ return 0; ++} ++postcore_initcall(rpi_console_clock_init); ++ + static int rpi_env_init(void) + { + struct stat s; +diff --git a/arch/arm/mach-bcm283x/core.c b/arch/arm/mach-bcm283x/core.c +index f1dcda86f7f0..f2528cf1f150 100644 +--- a/arch/arm/mach-bcm283x/core.c ++++ b/arch/arm/mach-bcm283x/core.c +@@ -31,25 +31,6 @@ + #include + #include + +-static int bcm2835_clk_init(void) +-{ +- struct clk *clk; +- +- clk = clk_fixed("apb_pclk", 0); +- clk_register_clkdev(clk, "apb_pclk", NULL); +- +- clk = clk_fixed("uart0-pl0110", 3 * 1000 * 1000); +- clk_register_clkdev(clk, NULL, "uart0-pl0110"); +- clkdev_add_physbase(clk, 0x20201000, NULL); +- clkdev_add_physbase(clk, 0x3f201000, NULL); +- +- clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000); +- clk_register_clkdev(clk, NULL, "bcm2835-cs"); +- +- return 0; +-} +-postcore_initcall(bcm2835_clk_init); +- + void bcm2835_add_device_sdram(u32 size) + { + if (!size) diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/0103-ARM-rpi-retrieve-miniuart-clock-from-firmware.patch b/configs/platform-v7a/patches/barebox-2018.12.0/0103-ARM-rpi-retrieve-miniuart-clock-from-firmware.patch new file mode 100644 index 0000000..95daa60 --- /dev/null +++ b/configs/platform-v7a/patches/barebox-2018.12.0/0103-ARM-rpi-retrieve-miniuart-clock-from-firmware.patch @@ -0,0 +1,34 @@ +From: Rouven Czerwinski +Date: Thu, 13 Dec 2018 07:23:37 +0100 +Subject: [PATCH] ARM: rpi: retrieve miniuart clock from firmware + +The miniuart uses the core clock as the clock source. This clock is fixed by the +firmware to 250Mhz if enable_uart=1 is set in the config.txt file. +However a user could still choose to overclock the core frequency, +which would result in wrong baudrates computed by barebox. +Retrieve the core clock frequency from the firmware to allow all potential +firmware configurations to work with barebox. + +Signed-off-by: Rouven Czerwinski +--- + arch/arm/boards/raspberry-pi/rpi-common.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c +index 490aeef12306..e29177d08e20 100644 +--- a/arch/arm/boards/raspberry-pi/rpi-common.c ++++ b/arch/arm/boards/raspberry-pi/rpi-common.c +@@ -309,6 +309,13 @@ static int rpi_console_clock_init(void) + clkdev_add_physbase(clk, 0x20201000, NULL); + clkdev_add_physbase(clk, 0x3f201000, NULL); + ++ clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_CORE, ++ "uart1-8250"); ++ if (IS_ERR(clk)) ++ return PTR_ERR(clk); ++ ++ clkdev_add_physbase(clk, 0x3f215040, NULL); ++ + clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000); + clk_register_clkdev(clk, NULL, "bcm2835-cs"); + diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/0104-serial_ns16550-handle-default-reg-io-width.patch b/configs/platform-v7a/patches/barebox-2018.12.0/0104-serial_ns16550-handle-default-reg-io-width.patch new file mode 100644 index 0000000..568d74d --- /dev/null +++ b/configs/platform-v7a/patches/barebox-2018.12.0/0104-serial_ns16550-handle-default-reg-io-width.patch @@ -0,0 +1,78 @@ +From: Rouven Czerwinski +Date: Tue, 11 Dec 2018 11:28:33 +0100 +Subject: [PATCH] serial_ns16550: handle default reg-io-width + +According to the device tree bindings for 8250, width is an optional property. +Default to 1 which is the same default value as used by the kernel. +Before this change the driver would not work for device trees which do not +include the optional binding. + +Signed-off-by: Rouven Czerwinski +--- + drivers/serial/serial_ns16550.c | 46 ++++++++++++++++++++--------------------- + 1 file changed, 23 insertions(+), 23 deletions(-) + +diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c +index 4d73ea8b8740..8ddcfdbefc1d 100644 +--- a/drivers/serial/serial_ns16550.c ++++ b/drivers/serial/serial_ns16550.c +@@ -297,36 +297,36 @@ static int ns16550_tstc(struct console_device *cdev) + static void ns16550_probe_dt(struct device_d *dev, struct ns16550_priv *priv) + { + struct device_node *np = dev->device_node; +- u32 width; ++ u32 width = 1; + + if (!IS_ENABLED(CONFIG_OFDEVICE)) + return; + + of_property_read_u32(np, "clock-frequency", &priv->plat.clock); + of_property_read_u32(np, "reg-shift", &priv->plat.shift); +- if (!of_property_read_u32(np, "reg-io-width", &width)) +- switch (width) { +- case 1: +- priv->read_reg = ns16550_read_reg_mmio_8; +- priv->write_reg = ns16550_write_reg_mmio_8; +- break; +- case 2: +- priv->read_reg = ns16550_read_reg_mmio_16; +- priv->write_reg = ns16550_write_reg_mmio_16; +- break; +- case 4: +- if (of_device_is_big_endian(np)) { +- priv->read_reg = ns16550_read_reg_mmio_32be; +- priv->write_reg = ns16550_write_reg_mmio_32be; +- } else { +- priv->read_reg = ns16550_read_reg_mmio_32; +- priv->write_reg = ns16550_write_reg_mmio_32; +- } +- break; +- default: +- dev_err(dev, "unsupported reg-io-width (%d)\n", +- width); ++ of_property_read_u32(np, "reg-io-width", &width); ++ switch (width) { ++ case 1: ++ priv->read_reg = ns16550_read_reg_mmio_8; ++ priv->write_reg = ns16550_write_reg_mmio_8; ++ break; ++ case 2: ++ priv->read_reg = ns16550_read_reg_mmio_16; ++ priv->write_reg = ns16550_write_reg_mmio_16; ++ break; ++ case 4: ++ if (of_device_is_big_endian(np)) { ++ priv->read_reg = ns16550_read_reg_mmio_32be; ++ priv->write_reg = ns16550_write_reg_mmio_32be; ++ } else { ++ priv->read_reg = ns16550_read_reg_mmio_32; ++ priv->write_reg = ns16550_write_reg_mmio_32; + } ++ break; ++ default: ++ dev_err(dev, "unsupported reg-io-width (%d)\n", ++ width); ++ } + } + + static struct ns16550_drvdata ns16450_drvdata = { diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/0105-serial_ns16550-add-raspberry-pi-compatible-and-init.patch b/configs/platform-v7a/patches/barebox-2018.12.0/0105-serial_ns16550-add-raspberry-pi-compatible-and-init.patch new file mode 100644 index 0000000..911a0e2 --- /dev/null +++ b/configs/platform-v7a/patches/barebox-2018.12.0/0105-serial_ns16550-add-raspberry-pi-compatible-and-init.patch @@ -0,0 +1,62 @@ +From: Rouven Czerwinski +Date: Tue, 11 Dec 2018 10:50:44 +0100 +Subject: [PATCH] serial_ns16550: add raspberry pi compatible and init + +Add the compatible for the Raspberry Pi AUX UART and an init function which +enables it via the aux register and configures the correct shift value. + +Signed-off-by: Rouven Czerwinski +--- + drivers/serial/serial_ns16550.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c +index 8ddcfdbefc1d..7a4054a67e41 100644 +--- a/drivers/serial/serial_ns16550.c ++++ b/drivers/serial/serial_ns16550.c +@@ -253,6 +253,20 @@ static void ns16550_jz_init_port(struct console_device *cdev) + ns16550_serial_init_port(cdev); + } + ++static void rpi_init_port(struct console_device *cdev) ++{ ++ struct ns16550_priv *priv = to_ns16550_priv(cdev); ++ ++ writeb(0x01, 0x3f215004); ++ priv->plat.shift = 2; ++ /* ++ * We double the clock rate since the 16550 will divide by 16 ++ * (instead of 8 required by the BCM2835 peripheral manual) ++ */ ++ priv->plat.clock = priv->plat.clock*2; ++ ns16550_serial_init_port(cdev); ++} ++ + /*********** Exposed Functions **********************************/ + + /** +@@ -353,6 +367,11 @@ static __maybe_unused struct ns16550_drvdata tegra_drvdata = { + .linux_console_name = "ttyS", + }; + ++static struct ns16550_drvdata rpi_drvdata = { ++ .init_port = rpi_init_port, ++ .linux_console_name = "ttyS", ++}; ++ + static int ns16550_init_iomem(struct device_d *dev, struct ns16550_priv *priv) + { + struct resource *iores; +@@ -527,6 +546,12 @@ static struct of_device_id ns16550_serial_dt_ids[] = { + .compatible = "ingenic,jz4740-uart", + .data = &jz_drvdata, + }, ++#endif ++#if IS_ENABLED(CONFIG_MACH_RPI_COMMON) ++ { ++ .compatible = "brcm,bcm2835-aux-uart", ++ .data = &rpi_drvdata, ++ }, + #endif + { + /* sentinel */ diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/0106-ARM-rpi-add-NS16550-support.patch b/configs/platform-v7a/patches/barebox-2018.12.0/0106-ARM-rpi-add-NS16550-support.patch new file mode 100644 index 0000000..2e368cf --- /dev/null +++ b/configs/platform-v7a/patches/barebox-2018.12.0/0106-ARM-rpi-add-NS16550-support.patch @@ -0,0 +1,24 @@ +From: Rouven Czerwinski +Date: Wed, 12 Dec 2018 14:33:43 +0100 +Subject: [PATCH] ARM: rpi: add NS16550 support + +Since the 16550 driver now supports the RPI3 miniuart, enable it in the default +config. + +Signed-off-by: Rouven Czerwinski +--- + arch/arm/configs/rpi_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig +index 2bb615849324..dc5ab1fe17f6 100644 +--- a/arch/arm/configs/rpi_defconfig ++++ b/arch/arm/configs/rpi_defconfig +@@ -63,6 +63,7 @@ CONFIG_CMD_OF_PROPERTY=y + CONFIG_CMD_OFTREE=y + CONFIG_CMD_TIME=y + CONFIG_SERIAL_AMBA_PL011=y ++CONFIG_DRIVER_SERIAL_NS16550=y + CONFIG_MCI=y + CONFIG_MCI_BCM283X=y + CONFIG_LED=y diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/0107-ARM-rpi-choose-miniuart-as-stdout.patch b/configs/platform-v7a/patches/barebox-2018.12.0/0107-ARM-rpi-choose-miniuart-as-stdout.patch new file mode 100644 index 0000000..126fe01 --- /dev/null +++ b/configs/platform-v7a/patches/barebox-2018.12.0/0107-ARM-rpi-choose-miniuart-as-stdout.patch @@ -0,0 +1,34 @@ +From: Rouven Czerwinski +Date: Tue, 11 Dec 2018 10:48:02 +0100 +Subject: [PATCH] ARM: rpi: choose miniuart as stdout + +Since we now support the miniuart, enable it as the default stdout port. +With this change the device tree overlay to switch the miniuart to bluetooth is +no longer necessary. + +Signed-off-by: Rouven Czerwinski +--- + arch/arm/dts/bcm2837-rpi-3.dts | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/arch/arm/dts/bcm2837-rpi-3.dts b/arch/arm/dts/bcm2837-rpi-3.dts +index d6ffc369122c..194b41c23b77 100644 +--- a/arch/arm/dts/bcm2837-rpi-3.dts ++++ b/arch/arm/dts/bcm2837-rpi-3.dts +@@ -2,15 +2,10 @@ + + / { + chosen { +- stdout-path = &uart0; ++ stdout-path = &uart1; + }; + + memory { + reg = <0x0 0x0>; + }; + }; +- +-&uart0 { +- status = "okay"; +- /delete-node/ bluetooth; +-}; diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/0108-doc-bcm283x-remove-miniuart-overlay-instruction.patch b/configs/platform-v7a/patches/barebox-2018.12.0/0108-doc-bcm283x-remove-miniuart-overlay-instruction.patch new file mode 100644 index 0000000..9d43761 --- /dev/null +++ b/configs/platform-v7a/patches/barebox-2018.12.0/0108-doc-bcm283x-remove-miniuart-overlay-instruction.patch @@ -0,0 +1,24 @@ +From: Rouven Czerwinski +Date: Wed, 12 Dec 2018 15:06:49 +0100 +Subject: [PATCH] doc: bcm283x: remove miniuart overlay instruction + +Since we now use the miniuart on the raspberry pi 3, the miniuart overlay is no +longer needed. + +Signed-off-by: Rouven Czerwinski +--- + Documentation/boards/bcm2835.rst | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst +index 79ea0ff7a78b..ea80d5834861 100644 +--- a/Documentation/boards/bcm2835.rst ++++ b/Documentation/boards/bcm2835.rst +@@ -22,7 +22,6 @@ Raspberry Pi + + kernel=barebox.img + enable_uart=1 +- dtoverlay=pi3-miniuart-bt + + (For more information, refer to the `documentation for config.txt`_.) + diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/0201-Release-2018.12.0-customers-pengutronix-multiv7-2018.patch b/configs/platform-v7a/patches/barebox-2018.12.0/0201-Release-2018.12.0-customers-pengutronix-multiv7-2018.patch new file mode 100644 index 0000000..38f2a36 --- /dev/null +++ b/configs/platform-v7a/patches/barebox-2018.12.0/0201-Release-2018.12.0-customers-pengutronix-multiv7-2018.patch @@ -0,0 +1,21 @@ +From: Rouven Czerwinski +Date: Thu, 13 Dec 2018 11:14:57 +0100 +Subject: [PATCH] Release 2018.12.0/customers/pengutronix/multiv7/20181213-1 + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 1ce50d025e47..f378f3dc7adf 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + VERSION = 2018 + PATCHLEVEL = 12 + SUBLEVEL = 0 +-EXTRAVERSION = ++EXTRAVERSION =-20181213-1 + NAME = None + + # *DOCUMENTATION* diff --git a/configs/platform-v7a/patches/barebox-2018.12.0/series b/configs/platform-v7a/patches/barebox-2018.12.0/series index 776d279..64d799d 100644 --- a/configs/platform-v7a/patches/barebox-2018.12.0/series +++ b/configs/platform-v7a/patches/barebox-2018.12.0/series @@ -1,11 +1,22 @@ # umpf-base: v2018.12.0 # umpf-name: 2018.12.0/customers/pengutronix/multiv7 -# umpf-version: 2018.12.0/customers/pengutronix/multiv7/20181207-1 +# umpf-version: 2018.12.0/customers/pengutronix/multiv7/20181213-1 # umpf-topic: v2018.11.0/customers/pengutronix/udoo-neo # umpf-hashinfo: c5f2e150d7e8d5439458df1a2cab71b25fc36e19 -# umpf-topic-range: 0b5361a328632e64c14a54306119093a0c7fecdf..91bbdb966ae2431a0fa298d5976e9435312f555a +# umpf-topic-range: 0b5361a328632e64c14a54306119093a0c7fecdf..6f54f9c6a2100a4c0fb8e9dff5250571de0c10b2 0001-ARM-imx-add-support-for-Udoo-Neo-full.patch -# umpf-release: 2018.12.0/customers/pengutronix/multiv7/20181207-1 -# umpf-topic-range: 91bbdb966ae2431a0fa298d5976e9435312f555a..aaff0754c24c6911d3ba72f96d37fedf8007d3e6 -0101-Release-2018.12.0-customers-pengutronix-multiv7-2018.patch +# umpf-topic: v2018.12.0/topic/rpi3_miniuart +# umpf-hashinfo: 53f22789068554eaf5f42f32a662c4acd98d4b38 +# umpf-topic-range: 6f54f9c6a2100a4c0fb8e9dff5250571de0c10b2..883529b323acca020c42e7de342d00ff2d222fd8 +0101-ARM-rpi-fix-typo-in-rpi-common.c.patch +0102-ARM-rpi-move-clks-into-board-specific-rpi-common.patch +0103-ARM-rpi-retrieve-miniuart-clock-from-firmware.patch +0104-serial_ns16550-handle-default-reg-io-width.patch +0105-serial_ns16550-add-raspberry-pi-compatible-and-init.patch +0106-ARM-rpi-add-NS16550-support.patch +0107-ARM-rpi-choose-miniuart-as-stdout.patch +0108-doc-bcm283x-remove-miniuart-overlay-instruction.patch +# umpf-release: 2018.12.0/customers/pengutronix/multiv7/20181213-1 +# umpf-topic-range: 883529b323acca020c42e7de342d00ff2d222fd8..806fa2b1b5f2491cefb2a76e6dc4c775874ad866 +0201-Release-2018.12.0-customers-pengutronix-multiv7-2018.patch # umpf-end diff --git a/configs/platform-v7a/platformconfig b/configs/platform-v7a/platformconfig index cdea840..0500abb 100644 --- a/configs/platform-v7a/platformconfig +++ b/configs/platform-v7a/platformconfig @@ -141,7 +141,7 @@ PTXCONF_KERNEL_EXTRA_MAKEVARS="" PTXCONF_DTC=y PTXCONF_DTC_INSTALL_OFTREE=y PTXCONF_DTC_OFTREE_DTS_PATH="${KERNEL_DIR}/arch/${PTXCONF_KERNEL_ARCH_STRING}/boot/dts" -PTXCONF_DTC_OFTREE_DTS="am335x-bone.dts am335x-boneblack.dts vexpress-v2p-ca9.dts bcm2836-rpi-2-b.dts imx6q-sabrelite.dts imx6sx-udoo-neo-full.dts imx6dl-riotboard.dts imx6q-nitrogen6x.dts" +PTXCONF_DTC_OFTREE_DTS="am335x-bone.dts am335x-boneblack.dts vexpress-v2p-ca9.dts bcm2836-rpi-2-b.dts imx6q-sabrelite.dts imx6sx-udoo-neo-full.dts imx6dl-riotboard.dts imx6q-nitrogen6x.dts bcm2837-rpi-3-b.dts" PTXCONF_DTC_KERNEL=y PTXCONF_DTC_EXTRA_ARGS="" @@ -189,6 +189,7 @@ PTXCONF_BLSPEC_GF=y PTXCONF_BLSPEC_NITROGEN6X=y PTXCONF_BLSPEC_RIOTBOARD=y PTXCONF_BLSPEC_RPI2=y +PTXCONF_BLSPEC_RPI3=y PTXCONF_BLSPEC_SABRELITE=y PTXCONF_BLSPEC_UDOO_NEO=y PTXCONF_BLSPEC_VEXPRESS=y @@ -232,6 +233,7 @@ PTXCONF_IMAGE_ROOT_TGZ_LABEL="" # PTXCONF_IMAGE_ROOT_UBI is not set # PTXCONF_IMAGE_ROOT_UBIFS is not set PTXCONF_IMAGE_RPI2=y +PTXCONF_IMAGE_RPI3=y PTXCONF_IMAGE_SABRELITE=y PTXCONF_IMAGE_UDOO_NEO=y PTXCONF_IMAGE_VEXPRESS_NOR=y diff --git a/configs/platform-v7a/platforms/blspec-rpi3.in b/configs/platform-v7a/platforms/blspec-rpi3.in new file mode 100644 index 0000000..21b3d44 --- /dev/null +++ b/configs/platform-v7a/platforms/blspec-rpi3.in @@ -0,0 +1,5 @@ +## SECTION=blspec + +config BLSPEC_RPI3 + tristate + prompt "/loader/entries/rpi3.conf bootloader spec entry" diff --git a/configs/platform-v7a/platforms/image-rpi3.in b/configs/platform-v7a/platforms/image-rpi3.in new file mode 100644 index 0000000..353414d --- /dev/null +++ b/configs/platform-v7a/platforms/image-rpi3.in @@ -0,0 +1,12 @@ +## SECTION=image + +config IMAGE_RPI3 + tristate + select HOST_GENIMAGE + select HOST_DOSFSTOOLS + select HOST_MTOOLS + select IMAGE_ROOT_EXT + select BAREBOX_RPI2 + prompt "Generate images/rpi3.hdimg" + help + FIXME diff --git a/configs/platform-v7a/projectroot/loader/entries/rpi3.conf b/configs/platform-v7a/projectroot/loader/entries/rpi3.conf new file mode 100644 index 0000000..0a9ef8c --- /dev/null +++ b/configs/platform-v7a/projectroot/loader/entries/rpi3.conf @@ -0,0 +1,6 @@ +title Raspberry Pi 3 - Pengutronix-DistroKit +version 4.6 +options rootwait rw +linux /boot/zImage +devicetree /boot/bcm2837-rpi-3-b.dtb +linux-appendroot true diff --git a/configs/platform-v7a/rpi-firmware/config.txt b/configs/platform-v7a/rpi-firmware/config.txt index d1abb30..75093b1 100644 --- a/configs/platform-v7a/rpi-firmware/config.txt +++ b/configs/platform-v7a/rpi-firmware/config.txt @@ -1,16 +1,4 @@ -# enable debug of early bootloader -uart_2ndstage=1 +# Enable the UART (miniuart for RPI3, PL011 for RPI2) +enable_uart=1 # Set barebox as third state bootloader -kernel=barebox -# Set stdv mode to PAL (as used in Europe) -sdtv_mode=2 -# Force the monitor to HDMI mode so that sound will be sent over HDMI cable -hdmi_drive=2 -# Set monitor mode to DMT -hdmi_group=1 -# Set monitor resolution to 1080p60 -hdmi_mode=16 -# No overscan -disable_overscan=1 -# GPU memory in megabyte -gpu_mem=@GPU_MEM@ +kernel=barebox.img diff --git a/configs/platform-v7a/rules/barebox-rpi2.make b/configs/platform-v7a/rules/barebox-rpi2.make index c09e911..47ad43b 100644 --- a/configs/platform-v7a/rules/barebox-rpi2.make +++ b/configs/platform-v7a/rules/barebox-rpi2.make @@ -43,7 +43,7 @@ BAREBOX_RPI2_CONF_OPT := $(call barebox-opts, BAREBOX_RPI2) BAREBOX_RPI2_MAKE_ENV := $(BAREBOX_RPI2_CONF_ENV) BAREBOX_RPI2_MAKE_OPT := $(BAREBOX_RPI2_CONF_OPT) -BAREBOX_RPI2_IMAGES := images/barebox-raspberry-pi-2.img +BAREBOX_RPI2_IMAGES := images/barebox-raspberry-pi-2.img images/barebox-raspberry-pi-3.img BAREBOX_RPI2_IMAGES := $(addprefix $(BAREBOX_RPI2_DIR)/,$(BAREBOX_RPI2_IMAGES)) ifdef PTXCONF_BAREBOX_RPI2 diff --git a/configs/platform-v7a/rules/blspec-rpi3.make b/configs/platform-v7a/rules/blspec-rpi3.make new file mode 100644 index 0000000..7d0fab6 --- /dev/null +++ b/configs/platform-v7a/rules/blspec-rpi3.make @@ -0,0 +1,38 @@ +# -*-makefile-*- +# +# Copyright (C) 2018 by Rouven Czerwinski +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# We provide this package +# +PACKAGES-$(PTXCONF_BLSPEC_RPI3) += blspec-rpi3 + +BLSPEC_RPI3_VERSION := 4.6 + +# ---------------------------------------------------------------------------- +# Target-Install +# ---------------------------------------------------------------------------- + +$(STATEDIR)/blspec-rpi3.targetinstall: + @$(call targetinfo) + + @$(call install_init, blspec-rpi3) + @$(call install_fixup,blspec-rpi3,PRIORITY,optional) + @$(call install_fixup,blspec-rpi3,SECTION,base) + @$(call install_fixup,blspec-rpi3,AUTHOR,"Rouven Czerwinski ") + @$(call install_fixup,blspec-rpi3,DESCRIPTION,missing) + + @$(call install_alternative, blspec-rpi3, 0, 0, 0644, \ + /loader/entries/rpi3.conf) + + @$(call install_finish,blspec-rpi3) + + @$(call touch) + +# vim: syntax=make diff --git a/configs/platform-v7a/rules/image-rpi2.make b/configs/platform-v7a/rules/image-rpi2.make index 6ca4827..e6b4e2e 100644 --- a/configs/platform-v7a/rules/image-rpi2.make +++ b/configs/platform-v7a/rules/image-rpi2.make @@ -26,6 +26,7 @@ IMAGE_RPI2_DATA := \ $(wildcard $(IMAGE_RPI2_DATA_DIR)/*.bin) \ $(wildcard $(IMAGE_RPI2_DATA_DIR)/*.elf) \ $(wildcard $(IMAGE_RPI2_DATA_DIR)/*.dat) \ + $(wildcard $(IMAGE_RPI2_DATA_DIR)/*.dtb) \ $(wildcard $(IMAGE_RPI2_DATA_DIR)/config.txt) # ---------------------------------------------------------------------------- diff --git a/configs/platform-v7a/rules/image-rpi3.make b/configs/platform-v7a/rules/image-rpi3.make new file mode 100644 index 0000000..600c406 --- /dev/null +++ b/configs/platform-v7a/rules/image-rpi3.make @@ -0,0 +1,51 @@ +# -*-makefile-*- +# +# Copyright (C) 2017 by Sascha Hauer +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# We provide this package +# +IMAGE_PACKAGES-$(PTXCONF_IMAGE_RPI3) += image-rpi3 + +# +# Paths and names +# +IMAGE_RPI3 := image-rpi3 +IMAGE_RPI3_DIR := $(BUILDDIR)/$(IMAGE_RPI3) +IMAGE_RPI3_IMAGE := $(IMAGEDIR)/rpi3.hdimg +IMAGE_RPI3_FILES := $(IMAGEDIR)/root.tgz +IMAGE_RPI3_CONFIG := rpi3.config +IMAGE_RPI3_DATA_DIR := $(call ptx/in-platformconfigdir, rpi-firmware) +IMAGE_RPI3_DATA := \ + $(wildcard $(IMAGE_RPI3_DATA_DIR)/*.bin) \ + $(wildcard $(IMAGE_RPI3_DATA_DIR)/*.elf) \ + $(wildcard $(IMAGE_RPI3_DATA_DIR)/*.dat) \ + $(wildcard $(IMAGE_RPI3_DATA_DIR)/*.dtb) \ + $(wildcard $(IMAGE_RPI3_DATA_DIR)/config.txt) + +# ---------------------------------------------------------------------------- +# Image +# ---------------------------------------------------------------------------- + +define squote_and_comma +$(subst $(ptx/def/space),$(comma) ,$(addsuffix $(ptx/def/squote),$(addprefix $(ptx/def/squote),$(1)))) +endef + +IMAGE_RPI3_ENV := \ + FIRMWARE_RPI3="$(call squote_and_comma,$(IMAGE_RPI3_DATA))" + +$(IMAGE_RPI3_IMAGE): + @$(call targetinfo) + @GPU_MEM=$(PTXCONF_IMAGE_RPI3_GPU_MEM) \ + ptxd_replace_magic "$(IMAGE_RPI3_DATA_DIR)/config.txt" > \ + "$(PTXDIST_TEMPDIR)/config.txt" + @$(call image/genimage, IMAGE_RPI3) + @$(call finish) + +# vim: syntax=make -- cgit v1.2.3