powerpc: Introduce device tree control and driver model
cover powerpc: Introduce device tree control and driver model
This series does a small amount of tweaking to support device tree control (CONFIG_OF_CONTROL) on PowerPC platforms. It also adds support for driver model. In both cases the main effort is to set things up correctly before calling board_init_f().
A new generic function, board_init_f_mem() is introduced. This does the various memory calculations in C code, since they are messy in assembler and every architecture should in fact be the same. A later series will adjust ARM and x86 to use this function.
As an example, the Canyonlands boards are converted over to use device tree control and driver model for their serial console. It should be fairly straightforward to convert over other boards.
Simon Glass (18):
Introduce board_init_f_mem() to handle early memory layout
powerpc: Permit device tree control of U-Boot (CONFIG_OF_CONTROL)
powerpc: ppc4xx: canyonlands: config: Tidy up CONFIGs and config.mk
powerpc: ppc4xx: Move CANYONLANDS/GLACIER/ARCHES to Kconfig
powerpc: ppc4xx: Add ramboot config for glacier
powerpc: ppc4xx: canyonlands: Move to generic board
powerpc: ppc4xx: dts: Bring in canyonlands device tree files
powerpc: ppc4xx: Call board_init_f_mem() for generic board
powerpc: ppc4xx: Add a gpio.h header file
powerpc: ppc4xx: Allow the end of u-boot.bin to be found
powerpc: ppc4xx: Use CONFIG_OF_CONTROL for canyonlands boards
ppc: amcc: Omit unneeded ns16550 CONFIG if using driver model
powerpc: Add serial driver for driver model
dm: powerpc: ppc4xx: Move glacier to use driver model for serial
powerpc: Add linkage.h file
serial: Support an early UART for debugging
serial: ns16550: Support debug UART
powerpc: ppc4xx: Provide early debug UART defaults
Stefan Roese (1):
WIP: powerpc: ppc4xx: Somehow BSS is not cleared in RAMBOOT case
arch/Kconfig | 1 + arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c | 8 + arch/powerpc/cpu/ppc4xx/config.mk | 5 +- arch/powerpc/cpu/ppc4xx/cpu_init.c | 2 + arch/powerpc/cpu/ppc4xx/start.S | 18 +- arch/powerpc/cpu/ppc4xx/u-boot.lds | 8 +- arch/powerpc/dts/Makefile | 11 + arch/powerpc/dts/arches.dts | 339 ++++++++++++++++ arch/powerpc/dts/canyonlands.dts | 555 ++++++++++++++++++++++++++ arch/powerpc/dts/glacier.dts | 579 ++++++++++++++++++++++++++++ arch/powerpc/include/asm/arch-ppc4xx/gpio.h | 7 + arch/powerpc/include/asm/linkage.h | 7 + arch/powerpc/include/asm/ppc460ex_gt.h | 2 + arch/powerpc/lib/board.c | 3 + board/amcc/canyonlands/Kconfig | 35 ++ board/amcc/canyonlands/MAINTAINERS | 1 + board/amcc/canyonlands/config.mk | 2 - board/amcc/canyonlands/u-boot-ram.lds | 85 ++++ common/board_f.c | 18 + common/board_r.c | 8 +- configs/arches_defconfig | 5 +- configs/canyonlands_defconfig | 5 +- configs/glacier_defconfig | 5 +- configs/glacier_ramboot_defconfig | 8 + drivers/serial/Kconfig | 59 +++ drivers/serial/Makefile | 1 + drivers/serial/ns16550.c | 42 +- drivers/serial/serial_ppc.c | 40 ++ include/configs/amcc-common.h | 2 + include/configs/canyonlands.h | 38 +- include/debug_uart.h | 139 +++++++ 31 files changed, 2006 insertions(+), 32 deletions(-) create mode 100644 arch/powerpc/dts/Makefile create mode 100644 arch/powerpc/dts/arches.dts create mode 100644 arch/powerpc/dts/canyonlands.dts create mode 100644 arch/powerpc/dts/glacier.dts create mode 100644 arch/powerpc/include/asm/arch-ppc4xx/gpio.h create mode 100644 arch/powerpc/include/asm/linkage.h create mode 100644 board/amcc/canyonlands/u-boot-ram.lds create mode 100644 configs/glacier_ramboot_defconfig create mode 100644 drivers/serial/serial_ppc.c create mode 100644 include/debug_uart.h
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 1/19 Introduce board_init_f_mem() to handle early memory layout
At present on some architectures we set up the following before calling board_init_f():
- global_data
- stack
- early malloc memory
Adding the code to support early malloc and global data setup to every arch's assembler start-up is a pain. Also this code is not actually architecture-specific. We can use common code for all architectures and with a bit of care we can write this code in C.
Add a new function to deal with this. It should be called after memory is available, with a pointer to the top of the area that should be used before relocation. The function will set things up and return the lowest memory address that it allocated/used. That can then be set as the top of the stack.
Note that on some archs this function will use the stack, so the stack pointer should be set to same value as is pased to board_init_f_mem(). A margin of 128 bytes will be left for this stack, so that it is not overwritten. This means that 128 bytes is wasted by this early call. This is not strictly necessary on several more modern archs, so we could remove this at the cost of some arch-dependent code.
With this function there is no-longer any need for the assembler code to zero global_data or set up the early malloc pointers.
---
common/board_f.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
common/board_f.c +18 -0
@@ -1064,4 +1064,22 @@ void board_init_f_r(void)/* NOTREACHED - board_init_r() does not return */ hang(); } +#else +ulong board_init_f_mem (ulong top) +{ +/* Leave space for the stack we are running with now */ + top -=0x80 ; + + top -=sizeof (struct global_data ); + top =ALIGN (top,16 ); + gd = (struct global_data *)top; +memset ((void *)gd,'\0' ,sizeof (*gd)); + +#ifdef CONFIG_SYS_MALLOC_F_LEN + top -=CONFIG_SYS_MALLOC_F_LEN ; + gd->malloc_base = top; +#endif + +return top; +}#endif /* CONFIG_X86 */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 2/19 powerpc: Permit device tree control of U-Boot (CONFIG_OF_CONTROL)
In reply to Simon GlassEnable this in the Kconfig so that PowerPC boards can use device tree to configure U-Boot.
---
arch/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/Kconfig +1 -0
@@ -39,6 +39,7 @@ config OPENRISC config PPC bool "PowerPC architecture" select HAVE_PRIVATE_LIBGCC + select SUPPORT_OF_CONTROL config SANDBOX bool "Sandbox"
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 3/19 powerpc: ppc4xx: canyonlands: config: Tidy up CONFIGs and config.mk
In reply to Simon GlassMany CONFIG options have an unnecessary value of 1. CONFIG_440 is set in the various board config files. Also simplify the CONFIG_440 check in config.mk
---
arch/powerpc/cpu/ppc4xx/config.mk | 5 +---- board/amcc/canyonlands/config.mk | 2 -- include/configs/canyonlands.h | 34 +++++++++++++++++----------------- 3 files changed, 18 insertions(+), 23 deletions(-)
arch/powerpc/cpu/ppc4xx/config.mk +1 -4
@@ -7,10 +7,7 @@ PLATFORM_CPPFLAGS += -mstring -msoft-float -cfg=$(srctree)/include/configs/$(CONFIG_SYS_CONFIG_NAME:"%"=%).h -is440:=$(shell grep CONFIG_440 $(cfg)) - -ifneq (,$(findstring CONFIG_440,$(is440))) +ifneq (,$(CONFIG_440)) PLATFORM_CPPFLAGS += -Wa,-m440 -mcpu=440 else PLATFORM_CPPFLAGS += -Wa,-m405 -mcpu=405
board/amcc/canyonlands/config.mk +0 -2
@@ -8,8 +8,6 @@ # AMCC 460EX/460GT Evaluation Board (Canyonlands) board # -PLATFORM_CPPFLAGS += -DCONFIG_440=1 - ifeq ($(debug),1) PLATFORM_CPPFLAGS += -DDEBUG endif
include/configs/canyonlands.h +17 -17
@@ -19,10 +19,10 @@* and Arches dual (460GT) */ #ifdef CONFIG_CANYONLANDS -#define CONFIG_460EX 1/* Specific PPC460EX */ +#define CONFIG_460EX /* Specific PPC460EX */ #define CONFIG_HOSTNAME canyonlands#else -#define CONFIG_460GT 1/* Specific PPC460GT */ +#define CONFIG_460GT /* Specific PPC460GT */ #ifdef CONFIG_GLACIER #define CONFIG_HOSTNAME glacier#else
@@ -32,7 +32,7 @@#endif #endif -#define CONFIG_440 1 +#define CONFIG_440 #ifndef CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_TEXT_BASE 0xFFF80000
@@ -45,10 +45,10 @@#define CONFIG_SYS_CLK_FREQ 66666667/* external freq to pll */ -#define CONFIG_BOARD_EARLY_INIT_F 1/* Call board_early_init_f */ -#define CONFIG_BOARD_EARLY_INIT_R 1/* Call board_early_init_r */ -#define CONFIG_MISC_INIT_R 1/* Call misc_init_r */ -#define CONFIG_BOARD_TYPES 1/* support board types */ +#define CONFIG_BOARD_EARLY_INIT_F /* Call board_early_init_f */ +#define CONFIG_BOARD_EARLY_INIT_R /* Call board_early_init_r */ +#define CONFIG_MISC_INIT_R /* Call misc_init_r */ +#define CONFIG_BOARD_TYPES /* support board types */ /*----------------------------------------------------------------------- * Base addresses -- Note these are effective addresses where the
@@ -134,7 +134,7 @@*----------------------------------------------------------------------*/ #define CONFIG_SYS_FLASH_CFI /* The flash is CFI compatible */ #define CONFIG_FLASH_CFI_DRIVER /* Use common CFI driver */ -#define CONFIG_SYS_FLASH_CFI_AMD_RESET 1/* Use AMD (Spansion) reset cmd */ +#define CONFIG_SYS_FLASH_CFI_AMD_RESET /* Use AMD (Spansion) reset cmd */ #define CONFIG_SYS_FLASH_BANKS_LIST {CONFIG_SYS_FLASH_BASE}#define CONFIG_SYS_MAX_FLASH_BANKS 1/* max number of memory banks */
@@ -172,9 +172,9 @@* I2C SPD DIMM autodetection/calibration doesn't fit into the 4k of boot * code. */ -#define CONFIG_SPD_EEPROM 1/* Use SPD EEPROM for setup */ +#define CONFIG_SPD_EEPROM /* Use SPD EEPROM for setup */ #define SPD_EEPROM_ADDRESS {0x50, 0x51}/* SPD i2c spd addresses*/ -#define CONFIG_DDR_ECC 1/* with ECC support */ +#define CONFIG_DDR_ECC /* with ECC support */ #define CONFIG_DDR_RQDC_FIXED 0x80000038/* fixed value for RQDC */ #else /* defined(CONFIG_ARCHES) */
@@ -262,8 +262,8 @@#define CONFIG_4xx_CONFIG_BLOCKSIZE 16/* I2C SYSMON (LM75, AD7414 is almost compatible) */ -#define CONFIG_DTT_LM75 1/* ON Semi's LM75 */ -#define CONFIG_DTT_AD7414 1/* use AD7414 */ +#define CONFIG_DTT_LM75 /* ON Semi's LM75 */ +#define CONFIG_DTT_AD7414 /* use AD7414 */ #define CONFIG_DTT_SENSORS {0}/* Sensor addresses */ #define CONFIG_SYS_DTT_MAX_TEMP 70#define CONFIG_SYS_DTT_LOW_TEMP -30
@@ -275,14 +275,14 @@#if !defined(CONFIG_ARCHES )/* RTC configuration */ -#define CONFIG_RTC_M41T62 1 +#define CONFIG_RTC_M41T62 #define CONFIG_SYS_I2C_RTC_ADDR 0x68#endif /*----------------------------------------------------------------------- * Ethernet *----------------------------------------------------------------------*/ -#define CONFIG_IBM_EMAC4_V4 1 +#define CONFIG_IBM_EMAC4_V4 #define CONFIG_HAS_ETH0 #define CONFIG_HAS_ETH1
@@ -322,9 +322,9 @@#define CONFIG_GPCS_PHY2_ADDR 0xC#endif /* !defined(CONFIG_ARCHES) */ -#define CONFIG_PHY_RESET 1/* reset phy upon startup */ -#define CONFIG_PHY_GIGE 1/* Include GbE speed/duplex detection */ -#define CONFIG_PHY_DYNAMIC_ANEG 1 +#define CONFIG_PHY_RESET /* reset phy upon startup */ +#define CONFIG_PHY_GIGE /* Include GbE speed/duplex detection */ +#define CONFIG_PHY_DYNAMIC_ANEG /*----------------------------------------------------------------------- * USB-OHCI
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 4/19 powerpc: ppc4xx: Move CANYONLANDS/GLACIER/ARCHES to Kconfig
In reply to Simon GlassMove these options to Kconfig and remove them from the CONFIG files.
---
board/amcc/canyonlands/Kconfig | 20 ++++++++++++++++++++ configs/arches_defconfig | 2 +- configs/canyonlands_defconfig | 2 +- configs/glacier_defconfig | 2 +- include/configs/canyonlands.h | 2 ++ 5 files changed, 25 insertions(+), 3 deletions(-)
board/amcc/canyonlands/Kconfig +20 -0
@@ -9,4 +9,24 @@ config SYS_VENDOR config SYS_CONFIG_NAME default "canyonlands" +choice BOARD_TYPE + prompt "Select which board to build for" + +config CANYONLANDS + bool "Glacier" + help + Select this to build for the Canyonlands 460EX board. + +config GLACIER + bool "Glacier" + help + Select this to build for the Glacier 460GT board. + +config ARCHES + bool "Arches" + help + Select this to build for the Arches dual 460GT board. + +endchoice + endif
configs/arches_defconfig +1 -1
@@ -1,4 +1,4 @@ -CONFIG_SYS_EXTRA_OPTIONS="ARCHES" CONFIG_PPC=y CONFIG_4xx=y CONFIG_TARGET_CANYONLANDS=y +CONFIG_ARCHES=y
configs/canyonlands_defconfig +1 -1
@@ -1,4 +1,4 @@ -CONFIG_SYS_EXTRA_OPTIONS="CANYONLANDS" CONFIG_PPC=y CONFIG_4xx=y CONFIG_TARGET_CANYONLANDS=y +CONFIG_CANYONLANDS=y
configs/glacier_defconfig +1 -1
@@ -1,4 +1,4 @@ -CONFIG_SYS_EXTRA_OPTIONS="GLACIER" CONFIG_PPC=y CONFIG_4xx=y CONFIG_TARGET_CANYONLANDS=y +CONFIG_GLACIER=y
include/configs/canyonlands.h +2 -0
@@ -11,6 +11,8 @@#ifndef __CONFIG_H#define __CONFIG_H +#include <linux/kconfig.h> +/*----------------------------------------------------------------------- * High Level Configuration Options *----------------------------------------------------------------------*/
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 4/19 powerpc: ppc4xx: Move CANYONLANDS/GLACIER/ARCHES to Kconfig
Hi Simon,
include/configs/canyonlands.h line 15
Quoted 10 lines · On Mon, 15 Dec 2014 07:19:39 -0700 Simon Glass <[email protected]> wrote:
include/configs/canyonlands.h +2
-0@@ -11,6 +11,8 @@#ifndef __CONFIG_H#define __CONFIG_H +#include <linux/kconfig.h> +
Please do not explicitely include <linux/kconfig.h> from C sources. It is automatically included.
See Makefile
UBOOTINCLUDE := \
-Iinclude \
$(if $(KBUILD_SRC), -I$(srctree)/include) \
-I$(srctree)/arch/$(ARCH)/include \
-include $(srctree)/include/linux/kconfig.hBest Regards
Masahiro Yamada
PATCH 5/19 powerpc: ppc4xx: Add ramboot config for glacier
In reply to Simon GlassAdd a new ramboot config for glacier so that it is possible to test U-Boot loaded over Ethernet instead of using JTAG.
---
arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c | 8 ++++ board/amcc/canyonlands/MAINTAINERS | 1 + board/amcc/canyonlands/u-boot-ram.lds | 79 ++++++++++++++++++++++++++++++++++ configs/glacier_ramboot_defconfig | 5 +++ 4 files changed, 93 insertions(+) create mode 100644 board/amcc/canyonlands/u-boot-ram.lds create mode 100644 configs/glacier_ramboot_defconfig
arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c +8 -0
@@ -424,6 +424,14 @@ phys_size_t initdram(int board_type)int write_recovery;phys_size_t dram_size =0 ; +if (IS_ENABLED (CONFIG_SYS_RAMBOOT )) { +/* +* Reduce RAM size to avoid overwriting memory used by +* current stack? Not sure what is happening. +*/ +return sdram_memsize () /2 ; + } + num_dimm_banks =sizeof (iic0_dimm_addr);/*------------------------------------------------------------------
board/amcc/canyonlands/MAINTAINERS +1 -0
@@ -6,3 +6,4 @@ F: include/configs/canyonlands.h F: configs/arches_defconfig F: configs/canyonlands_defconfig F: configs/glacier_defconfig +F: configs/glacier_ramboot_defconfig
board/amcc/canyonlands/u-boot-ram.lds new file +79 -0
79 lines not on this page · raw message
configs/glacier_ramboot_defconfig new file +5 -0
@@ -0,0 +1,5 @@ +CONFIG_SYS_EXTRA_OPTIONS="SYS_RAMBOOT,SYS_TEXT_BASE=0x01000000,SYS_LDSCRIPT=board/amcc/canyonlands/u-boot-ram.lds" +CONFIG_PPC=y +CONFIG_4xx=y +CONFIG_TARGET_CANYONLANDS=y +CONFIG_GLACIER=y
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 6/19 WIP: powerpc: ppc4xx: Somehow BSS is not cleared in RAMBOOT case
In reply to Simon GlassFrom: Stefan Roese <[email protected]>
(NOT TO APPLY)
I'm really not sure why this doesn't work in the RAMBOOT case. But BSS is not cleared and because of this booting crashed / hangs at some stage later. Something with the GOT calculation / handling is incorrect.
To get this going for now, just clear the BSS again in the C code.
---
arch/powerpc/lib/board.c | 3 +++ common/board_r.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-)
arch/powerpc/lib/board.c +3 -0
@@ -108,6 +108,7 @@ DECLARE_GLOBAL_DATA_PTR;extern ulong __init_end;extern ulong __bss_end;ulong monitor_flash_len; +extern ulong __bss_start;#if defined(CONFIG_CMD_BEDBUG )#include <bedbug/type.h>
@@ -611,6 +612,8 @@ void board_init_r(gd_t *id, ulong dest_addr)/* The Malloc area is immediately below the monitor copy in DRAM */ malloc_start = dest_addr -TOTAL_MALLOC_LEN ; +memset (&__bss_start,0 , &__bss_end - &__bss_start); +#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)/* * The gd->arch.cpu pointer is set to an address in flash before
common/board_r.c +7 -1
@@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2011 The Chromium OS Authors. * (C) Copyright 2002-2006 * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
@@ -886,6 +886,12 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) gd = new_gd;#endif +#ifdef CONFIG_GLACIER +ulong bss_start = (ulong)&__bss_start; +ulong bss_end = (ulong)&__bss_end; +memset ((void *)bss_start,0 , bss_end - bss_start); +#endif +#ifdef CONFIG_NEEDS_MANUAL_RELOC for (i =0 ; i <ARRAY_SIZE (init_sequence_r); i++) init_sequence_r[i] += gd->reloc_off;
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 7/19 powerpc: ppc4xx: canyonlands: Move to generic board
In reply to Simon GlassSwitch to generic board so that this board will not be broken/removed.
---
arch/powerpc/cpu/ppc4xx/cpu_init.c | 2 ++ include/configs/canyonlands.h | 2 ++ 2 files changed, 4 insertions(+)
arch/powerpc/cpu/ppc4xx/cpu_init.c +2 -0
@@ -450,10 +450,12 @@ cpu_init_f (void) PLB4Ax_ACR_RDP_4DEEP);#endif /* CONFIG_440SP/SPE || CONFIG_460EX/GT || CONFIG_405EX */ +#ifndef CONFIG_SYS_GENERIC_BOARD gd = (gd_t *)(CONFIG_SYS_INIT_RAM_ADDR +CONFIG_SYS_GBL_DATA_OFFSET );/* Clear initial global data */ memset ((void *)gd,0 ,sizeof (gd_t)); +#endif }/*
include/configs/canyonlands.h +2 -0
@@ -13,6 +13,8 @@#include <linux/kconfig.h> +#define CONFIG_SYS_GENERIC_BOARD +/*----------------------------------------------------------------------- * High Level Configuration Options *----------------------------------------------------------------------*/
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 8/19 powerpc: ppc4xx: dts: Bring in canyonlands device tree files
In reply to Simon GlassThe canyonlands.h config file works with canyonlands, glacier and arches boards. Bring in the device tree files for these from Linux 3.17.
---
arch/powerpc/dts/Makefile | 11 + arch/powerpc/dts/arches.dts | 339 +++++++++++++++++++++++ arch/powerpc/dts/canyonlands.dts | 555 +++++++++++++++++++++++++++++++++++++ arch/powerpc/dts/glacier.dts | 579 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 1484 insertions(+) create mode 100644 arch/powerpc/dts/Makefile create mode 100644 arch/powerpc/dts/arches.dts create mode 100644 arch/powerpc/dts/canyonlands.dts create mode 100644 arch/powerpc/dts/glacier.dts
arch/powerpc/dts/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +dtb-$(CONFIG_TARGET_CANYONLANDS) += arches.dtb canyonlands.dtb glacier.dtb + +targets += $(dtb-y) + +DTC_FLAGS += -R 4 -p 0x1000 + +PHONY += dtbs +dtbs: $(addprefix $(obj)/, $(dtb-y)) + @: + +clean-files := *.dtb
arch/powerpc/dts/arches.dts new file +339 -0
339 lines not on this page · raw message
arch/powerpc/dts/canyonlands.dts new file +555 -0
555 lines not on this page · raw message
arch/powerpc/dts/glacier.dts new file +579 -0
579 lines not on this page · raw message
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 9/19 powerpc: ppc4xx: Call board_init_f_mem() for generic board
In reply to Simon GlassCall this function to set up our early memory.
---
arch/powerpc/cpu/ppc4xx/start.S | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
arch/powerpc/cpu/ppc4xx/start.S +17 -1
@@ -760,6 +760,15 @@ _start: #endif bl cpu_init_f /* run low-level CPU init code (from Flash) */ +#ifdef CONFIG_SYS_GENERIC_BOARD + mr r3, r1 + bl board_init_f_mem + mr r1, r3 + li r0,0 + stwu r0, -4(r1) + stwu r0, -4(r1) +#endif + li r3, 0 bl board_init_f /* NOTREACHED - board_init_f() does not return */
@@ -1027,7 +1036,14 @@ _start: GET_GOT /* initialize GOT access */ bl cpu_init_f /* run low-level CPU init code (from Flash) */ - +#ifdef CONFIG_SYS_GENERIC_BOARD + mr r3, r1 + bl board_init_f_mem + mr r1, r3 + stwu r0, -4(r1) + stwu r0, -4(r1) +#endif + li r3, 0 bl board_init_f /* run first part of init code (from Flash) */ /* NOTREACHED - board_init_f() does not return */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 10/19 powerpc: ppc4xx: Add a gpio.h header file
In reply to Simon GlassThis is required at present for device tree control. The ppc4xx does support GPIOs but does not seem to have a proper driver. So this file is empty.
---
arch/powerpc/include/asm/arch-ppc4xx/gpio.h | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 arch/powerpc/include/asm/arch-ppc4xx/gpio.h
arch/powerpc/include/asm/arch-ppc4xx/gpio.h new file +7 -0
@@ -0,0 +1,7 @@ +/* +* (C) Copyright 2014 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/* This is empty for now as we don't support the generic GPIO interface */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 11/19 powerpc: ppc4xx: Allow the end of u-boot.bin to be found
In reply to Simon GlassDefine an _end symbol indicating the end of u-boot.bin. Also add some dummy words into the link script to ensure that u-boot.bin will always extend that far. There may be a better way of doing this.
---
arch/powerpc/cpu/ppc4xx/u-boot.lds | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/cpu/ppc4xx/u-boot.lds +6 -2
@@ -76,9 +76,13 @@ SECTIONS . = ALIGN(256); __init_begin = .; .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); + .data.init : { + *(.data.init) + . = ALIGN(256); + LONG(0) LONG(0) /* Extend u-boot.bin to here */ + } __init_end = .; + _end = .; #ifndef CONFIG_SPL #ifdef CONFIG_440
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 12/19 powerpc: ppc4xx: Use CONFIG_OF_CONTROL for canyonlands boards
In reply to Simon GlassEnable CONFIG_OF_CONTROL so that U-Boot on these three boards uses a device tree for its configuration.
---
board/amcc/canyonlands/u-boot-ram.lds | 10 ++++++++-- configs/arches_defconfig | 3 +++ configs/canyonlands_defconfig | 3 +++ configs/glacier_defconfig | 3 +++ configs/glacier_ramboot_defconfig | 3 +++ 5 files changed, 20 insertions(+), 2 deletions(-)
board/amcc/canyonlands/u-boot-ram.lds +8 -2
@@ -12,6 +12,7 @@ SECTIONS . = + SIZEOF_HEADERS; .text : { + _image_copy_start = .; arch/powerpc/cpu/ppc4xx/start.o (.text*) board/amcc/canyonlands/init.o (.text*)
@@ -61,9 +62,14 @@ SECTIONS . = ALIGN(256); __init_begin = .; .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); + .data.init : { + *(.data.init) + . = ALIGN(256); + LONG(0) LONG(0) /* Extend u-boot.bin to here */ + } __init_end = .; + _end = .; + _image_binary_end = .; __bss_start = .; .bss (NOLOAD) :
configs/arches_defconfig +3 -0
@@ -2,3 +2,6 @@ CONFIG_PPC=y CONFIG_4xx=y CONFIG_TARGET_CANYONLANDS=y CONFIG_ARCHES=y +CONFIG_DEFAULT_DEVICE_TREE="arches" +CONFIG_OF_CONTROL=y +CONFIG_OF_SEPARATE=y
configs/canyonlands_defconfig +3 -0
@@ -2,3 +2,6 @@ CONFIG_PPC=y CONFIG_4xx=y CONFIG_TARGET_CANYONLANDS=y CONFIG_CANYONLANDS=y +CONFIG_DEFAULT_DEVICE_TREE="canyonlands" +CONFIG_OF_CONTROL=y +CONFIG_OF_SEPARATE=y
configs/glacier_defconfig +3 -0
@@ -2,3 +2,6 @@ CONFIG_PPC=y CONFIG_4xx=y CONFIG_TARGET_CANYONLANDS=y CONFIG_GLACIER=y +CONFIG_DEFAULT_DEVICE_TREE="glacier" +CONFIG_OF_CONTROL=y +CONFIG_OF_SEPARATE=y
configs/glacier_ramboot_defconfig +3 -0
@@ -3,3 +3,6 @@ CONFIG_PPC=y CONFIG_4xx=y CONFIG_TARGET_CANYONLANDS=y CONFIG_GLACIER=y +CONFIG_DEFAULT_DEVICE_TREE="glacier" +CONFIG_OF_CONTROL=y +CONFIG_OF_SEPARATE=y
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 12/19 powerpc: ppc4xx: Use CONFIG_OF_CONTROL for canyonlands boards
Quoted 4 lines · Simon Glass
Enable
CONFIG_OF_CONTROLso that U-Boot on these three boards uses a device tree for its configuration.Signed-off-by Simon Glass <[email protected]>
This need further work on the ppc4xx platforms to get it booting from flash. As now the dtb is appended to the "normal" U-Boot image. And this image is fine-tuned to fit into currently 512KiB. With the last word (reset vector of the ppc4xx) located at 0xffff.fffc. So we need to include this dtb into the image this way:
0xfff8.0000 U-Boot code / text etc
...
dtb
0xffff.fffc reset vector
Looking for the current options shows that perhaps CONFIG_OF_EMBED seems to be exactly what we are need. I'll got it working on Canyonlands after a bit of debugging. I'll post the necessary small patches soon...
Thanks,
Stefan
PATCH 12/19 powerpc: ppc4xx: Use CONFIG_OF_CONTROL for canyonlands boards
Hi Stefan,
Quoted 15 lines · Stefan Roese
Quoted 6 lines · Simon Glass
Enable
CONFIG_OF_CONTROLso that U-Boot on these three boards uses a device
tree for its configuration.Signed-off-by Simon Glass <[email protected]>This need further work on the ppc4xx platforms to get it booting from flash. As now the dtb is appended to the "normal" U-Boot image. And this image is fine-tuned to fit into currently 512KiB. With the last word (reset vector of the ppc4xx) located at 0xffff.fffc. So we need to include this dtb into the image this way:
Quoted 8 lines
0xfff8.0000 U-Boot code / text etc
...
dtb
0xffff.fffc reset vectorLooking for the current options shows that perhaps
CONFIG_OF_EMBEDseems to be exactly what we are need. I'll got it working on Canyonlands after a bit of debugging. I'll post the necessary small patches soon...
Sounds good, thanks!
It almost feels like you should have a mkimage image for this, to create a 512KB blob from u-boot.bin and u-boot.dtb. There must be linker magic to make this all hold together. But yes the embed option will build it in, so avoiding that.
Regards,
Simon
PATCH 12/19 powerpc: ppc4xx: Use CONFIG_OF_CONTROL for canyonlands boards
Hi Simon,
Quoted 23 lines · Simon Glass
Hi Stefan,
Quoted 20 lines · Stefan Roese
Quoted 6 lines · Simon Glass
Enable
CONFIG_OF_CONTROLso that U-Boot on these three boards uses a device
tree for its configuration.Signed-off-by Simon Glass <[email protected]>This need further work on the ppc4xx platforms to get it booting from flash. As now the dtb is appended to the "normal" U-Boot image. And this image is fine-tuned to fit into currently 512KiB. With the last word (reset vector of the ppc4xx) located at 0xffff.fffc. So we need to include this dtb into the image this way:
0xfff8.0000 U-Boot code / text etc
...
dtb
0xffff.fffc reset vector
Quoted 6 lines
Quoted 3 lines
Looking for the current options shows that perhaps
CONFIG_OF_EMBEDseems to be exactly what we are need. I'll got it working on Canyonlands after a bit of debugging. I'll post the necessary small patches soon...Sounds good, thanks!
We need do the same for Freescale BookE powerpc series too.
Quoted 5 lines
It almost feels like you should have a mkimage image for this, to create a 512KB blob from u-boot.bin and u-boot.dtb. There must be linker magic to make this all hold together. But yes the embed option will build it in, so avoiding that.
Or maybe we can extend x86 solution (like ifdtool) to non-x86 architectures like BookE powerpc?
Regards,
Bin
PATCH 13/19 ppc: amcc: Omit unneeded ns16550 CONFIG if using driver model
In reply to Simon GlassThis comes from the device tree or a call to get_uart_clock().
---
arch/powerpc/include/asm/ppc460ex_gt.h | 2 ++ include/configs/amcc-common.h | 2 ++ 2 files changed, 4 insertions(+)
arch/powerpc/include/asm/ppc460ex_gt.h +2 -0
@@ -19,10 +19,12 @@/* Memory mapped registers */ #define CONFIG_SYS_PERIPHERAL_BASE 0xef600000/* Internal Peripherals */ +#ifndef CONFIG_DM_SERIAL #define CONFIG_SYS_NS16550_COM1 (CONFIG_SYS_PERIPHERAL_BASE + 0x0300)#define CONFIG_SYS_NS16550_COM2 (CONFIG_SYS_PERIPHERAL_BASE + 0x0400)#define CONFIG_SYS_NS16550_COM3 (CONFIG_SYS_PERIPHERAL_BASE + 0x0500)#define CONFIG_SYS_NS16550_COM4 (CONFIG_SYS_PERIPHERAL_BASE + 0x0600) +#endif #define GPIO0_BASE (CONFIG_SYS_PERIPHERAL_BASE + 0x0b00)#define GPIO1_BASE (CONFIG_SYS_PERIPHERAL_BASE + 0x0c00)
include/configs/amcc-common.h +2 -0
@@ -20,8 +20,10 @@*/ #define CONFIG_SYS_NS16550 #define CONFIG_SYS_NS16550_SERIAL +#ifndef CONFIG_DM_SERIAL #define CONFIG_SYS_NS16550_REG_SIZE 1#define CONFIG_SYS_NS16550_CLK get_serial_clock() +#endif #define CONFIG_BAUDRATE 115200#define CONFIG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 14/19 powerpc: Add serial driver for driver model
In reply to Simon GlassThis uses the ns16550 driver but sets up the clock at run-time. It does not seem to be available in the device tree.
---
drivers/serial/Makefile | 1 + drivers/serial/serial_ppc.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 drivers/serial/serial_ppc.c
drivers/serial/Makefile +1 -0
@@ -8,6 +8,7 @@ ifdef CONFIG_DM_SERIAL obj-y += serial-uclass.o obj-$(CONFIG_PL01X_SERIAL) += serial_pl01x.o +obj-$(CONFIG_PPC) += serial_ppc.o else obj-y += serial.o obj-$(CONFIG_PL010_SERIAL) += serial_pl01x.o
drivers/serial/serial_ppc.c new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Copyright (c) 2014 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <ns16550.h> +#include <serial.h> + +static const struct udevice_id ppc_serial_ids[] = { + { .compatible ="ns16550" }, + { } +}; + +static int ppc_serial_ofdata_to_platdata (struct udevice *dev) +{ +struct ns16550_platdata *plat =dev_get_platdata (dev); +int ret; + + ret =ns16550_serial_ofdata_to_platdata (dev); +if (ret) +return ret; + plat->clock =get_serial_clock (); + +return 0 ; +} + +U_BOOT_DRIVER (serial_ns16550) = { + .name ="serial_ppc" , + .id =UCLASS_SERIAL , + .of_match = ppc_serial_ids, + .ofdata_to_platdata = ppc_serial_ofdata_to_platdata, + .platdata_auto_alloc_size =sizeof (struct ns16550_platdata ), + .priv_auto_alloc_size =sizeof (struct NS16550 ), + .probe = ns16550_serial_probe, + .ops = &ns16550_serial_ops, + .flags =DM_FLAG_PRE_RELOC , +};
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 15/19 dm: powerpc: ppc4xx: Move glacier to use driver model for serial
In reply to Simon GlassAdjust Kconfig to default to driver model for glacier, canyonlands and arches.
---
board/amcc/canyonlands/Kconfig | 9 +++++++++ 1 file changed, 9 insertions(+)
board/amcc/canyonlands/Kconfig +9 -0
@@ -29,4 +29,13 @@ config ARCHES endchoice +config DM + default y + +config DM_SERIAL + default y + +config SYS_MALLOC_F_LEN + default 0x400 + endif
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 15/19 dm: powerpc: ppc4xx: Move glacier to use driver model for serial
Hi Simon,
finally I'm testing your patchset. Again sorry for the big delay here.
Quoted 16 lines · Simon Glass
Adjust
Kconfigto default to driver model for glacier, canyonlands and arches.Signed-off-by Simon Glass <[email protected]>---
board/amcc/canyonlands/Kconfig | 9 +++++++++ 1 file changed, 9 insertions(+)board/amcc/canyonlands/Kconfig +0
-0@@ -29,4 +29,13 @@ config ARCHES endchoice
board/amcc/canyonlands/Kconfig config ARCHES · line 40
Quoted 10 lines
board/amcc/canyonlands/Kconfig +9
-0+config DM + default y + +config DM_SERIAL + default y + +config SYS_MALLOC_F_LEN + default 0x400 +
Hmmm. This does not seem to work. With your patch series applied on current top-of-tree I get this error (for glacier_ramboot or canyonlands):
$ make -s -j10 board/amcc/canyonlands/Kconfig:38:warning: config symbol defined without type drivers/serial/serial-uclass.c:29:2: error: #error "Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN to make this work" make[1]: *** [drivers/serial/serial-uclass.o] Error 1
Somehow the CONFIG_SYS_MALLOC_F_LEN define is not available in the .config used. Do you have any idea why it might be missing?
Thanks,
Stefan
PATCH 15/19 dm: powerpc: ppc4xx: Move glacier to use driver model for serial
Quoted 22 lines · Stefan Roese
Quoted 7 lines
board/amcc/canyonlands/Kconfig +0
-0@@ -29,4 +29,13 @@ config ARCHES endchoiceboard/amcc/canyonlands/Kconfig config ARCHES · line 40
Quoted 10 lines
board/amcc/canyonlands/Kconfig +9
-0+config DM + default y + +config DM_SERIAL + default y + +config SYS_MALLOC_F_LEN + default 0x400 +Hmmm. This does not seem to work. With your patch series applied on current top-of-tree I get this error (for
glacier_rambootor canyonlands):
Quoted 7 lines
$ make -s -j10 board/amcc/canyonlands/Kconfig:38:warning: config symbol defined without type drivers/serial/serial-uclass.c:29:2: error: #error "Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN to make this work" make[1]: *** [drivers/serial/serial-uclass.o] Error 1Somehow the
CONFIG_SYS_MALLOC_F_LENdefine is not available in the .config used. Do you have any idea why it might be missing?
Okay. Found it. Its the missing type here. I'll send some follow-up patches once I have all tested on canyonlands here.
Thanks,
Stefan
PATCH 15/19 dm: powerpc: ppc4xx: Move glacier to use driver model for serial
Hi Stefan,
Quoted 33 lines · Stefan Roese
Quoted 32 lines · Stefan Roese
Quoted 9 lines
board/amcc/canyonlands/Kconfig +0
-0@@ -29,4 +29,13 @@ config ARCHES endchoiceboard/amcc/canyonlands/Kconfig config ARCHES · line 40
Quoted 10 lines
board/amcc/canyonlands/Kconfig +9
-0+config DM + default y + +config DM_SERIAL + default y + +config SYS_MALLOC_F_LEN + default 0x400 +Hmmm. This does not seem to work. With your patch series applied on current top-of-tree I get this error (for
glacier_rambootor canyonlands):$ make -s -j10 board/amcc/canyonlands/Kconfig:38:warning: config symbol defined without type drivers/serial/serial-uclass.c:29:2: error: #error "Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN to make this work" make[1]: *** [drivers/serial/serial-uclass.o] Error 1
Quoted 6 lines
Quoted 2 lines
Somehow the
CONFIG_SYS_MALLOC_F_LENdefine is not available in the .config used. Do you have any idea why it might be missing?Okay. Found it. Its the missing type here. I'll send some follow-up patches once I have all tested on canyonlands here.
OK good. Also see u-boot-dm branch ppc-working if you need more context.
Regards,
Simon
PATCH 15/19 dm: powerpc: ppc4xx: Move glacier to use driver model for serial
Hi Simon,
Quoted 11 lines · Simon Glass
Quoted 11 lines
Quoted 11 lines
Hmmm. This does not seem to work. With your patch series applied on current top-of-tree I get this error (for
glacier_rambootor canyonlands):$ make -s -j10 board/amcc/canyonlands/Kconfig:38:warning: config symbol defined without type drivers/serial/serial-uclass.c:29:2: error: #error "Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN to make this work" make[1]: *** [drivers/serial/serial-uclass.o] Error 1
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Somehow the
CONFIG_SYS_MALLOC_F_LENdefine is not available in the .config used. Do you have any idea why it might be missing?Okay. Found it. Its the missing type here. I'll send some follow-up patches once I have all tested on canyonlands here.
OK good. Also see u-boot-dm branch ppc-working if you need more context.
I just posted 4 patches that are needed on top of your patchset from mid December. Please either include them in your next patchset or fold them into your patches. With these patches on top I can boot Canyonlands from NOR flash. So for the complete patch series:
Thanks,
Stefan
PATCH 16/19 powerpc: Add linkage.h file
In reply to Simon GlassThis permits us to use linux/linkage.h on PowerPC machines.
---
arch/powerpc/include/asm/linkage.h | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 arch/powerpc/include/asm/linkage.h
arch/powerpc/include/asm/linkage.h new file +7 -0
@@ -0,0 +1,7 @@ +/* +* Copyright (c) 2014 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/* We don't need anything here at present */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 17/19 serial: Support an early UART for debugging
In reply to Simon GlassThis came up in a discussion on the mailing list here:
https://patchwork.ozlabs.org/patch/384613/
My concerns at the time were:
- it doesn't need to be written in assembler
- it doesn't need to be ARM-specific
This patch provides a possible alternative. It works by allowing any serial driver to export one init function and provide a putc() function. These can be used to output debug data before the real serial driver is available.
This implementation does not depend on driver model, and it is possible for it to operate without a stack on some architectures (e.g. PowerPC, ARM). It provides the same features as the ARM-specific debug.S but with more UART and architecture support.
---
drivers/serial/Kconfig | 46 ++++++++++++++++ include/debug_uart.h | 139 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 185 insertions(+) create mode 100644 include/debug_uart.h
drivers/serial/Kconfig +46 -0
@@ -5,6 +5,52 @@ config DM_SERIAL If you want to use driver model for serial drivers, say Y. To use legacy serial drivers, say N. +config DEBUG_UART + bool "Enable an early debug UART for debugging" + help + The debug UART is intended for use very early in U-Boot to debug + problems when an ICE or other debug mechanism is not available. + + To use it you should: + - Make sure your UART supports this interface + - Enable CONFIG_DEBUG_UART + - Enable the CONFIG for your UART to tell it to provide this interface + (e.g. CONFIG_DEBUG_UART_NS16550) + - Define the required settings as needed (see below) + - Call debug_uart_init() before use + - Call debug_uart_putc() to output a character + + Depending on your platform it may be possible to use this UART before + a stack is available. + + If your UART does not support this interface you can probably add + support quite easily. Remember that you cannot use driver model and + it is preferred to use no stack. + + You must not use this UART once driver model is working and the + serial drivers are up and running (done in serial_init()). Otherwise + the drivers may conflict and you will get strange output. + +config DEBUG_UART_BASE + hex "Base address of UART" + depends on DEBUG_UART + help + This is the base address of your UART for memory-mapped UARTs. + + A default should be provided by your board, but if not you will need + to use the correct value here. + +config DEBUG_UART_CLOCK + int "UART input clock" + depends on DEBUG_UART + help + The UART input clock determines the speed of the internal UART + circuitry. The baud rate is derived from this by dividing the input + clock down. + + A default should be provided by your board, but if not you will need + to use the correct value here. + config UNIPHIER_SERIAL bool "UniPhier on-chip UART support" depends on ARCH_UNIPHIER && DM_SERIAL
include/debug_uart.h new file +139 -0
139 lines not on this page · raw message
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 17/19 serial: Support an early UART for debugging
Hi Simon,
Quoted 6 lines · On Mon, 15 Dec 2014 07:19:52 -0700 Simon Glass <[email protected]> wrote:
This came up in a discussion on the mailing list here:
https://patchwork.ozlabs.org/patch/384613/
My concerns at the time were:
- it doesn't need to be written in assembler
Assembler can guarantee that stack is not used.
Quoted 1 line
- it doesn't need to be ARM-specific
OK.
Quoted 5 lines
This patch provides a possible alternative. It works by allowing any serial driver to export one init function and provide a
putc()function. These can be used to output debug data before the real serial driver is available.This implementation does not depend on driver model,
OK.
Quoted 2 lines
and it is possible for
it to operate without a stack on some architectures (e.g. PowerPC, ARM).
It depends on the optimization option -O2 / -Os.
In 18/19, you add "static inline" to calc_divisor().
"static inline" does not force-inline the code, but still leaves it to the compiler decision. (Marek Vasut also mentioned this in commit 4425e62856)
Best Regards
Masahiro Yamada
PATCH 17/19 serial: Support an early UART for debugging
Hi Masahiro,
Quoted 7 lines · Masahiro Yamada
Hi Simon,
On Mon, 15 Dec 2014 07:19:52 -0700
Simon Glass <[email protected]> wrote:
Quoted 8 lines
Quoted 6 lines
This came up in a discussion on the mailing list here:
https://patchwork.ozlabs.org/patch/384613/
My concerns at the time were:
- it doesn't need to be written in assemblerAssembler can guarantee that stack is not used.
So can C if written correctly, at least on PowerPC, ARM and a few other archs.
Quoted 10 lines
Quoted 3 lines
- it doesn't need to be ARM-specific
OK.
Quoted 4 lines
This patch provides a possible alternative. It works by allowing any serial driver to export one init function and provide a
putc()function. These can be used to output debug data before the real serial driver is available.
Quoted 8 lines
Quoted 1 line
This implementation does not depend on driver model,
OK.
Quoted 2 lines
and it is possible for
it to operate without a stack on some architectures (e.g. PowerPC, ARM).It depends on the optimization option -O2 / -Os.
OK, fair enough.
Quoted 6 lines
In 18/19, you add "static inline" to
calc_divisor()."static inline" does not force-inline the code, but still leaves it to the compiler decision. (Marek Vasut also mentioned this in commit
4425e62856)
Sure, I understand.
For me this implementation works on ARM and PowerPC, and can be applied for any UART in U-Boot. We don't need to write assembler in each UART for each architecture we support. That's my point.
I'm not suggesting we drop the assembler version, just that we have another option. Of course if a particular UART driver wants to include assembler it can.
Regards,
Simon
PATCH 18/19 serial: ns16550: Support debug UART
In reply to Simon GlassAdd debug UART functions to permit ns16550 to provide an early debug UART. Try to avoid using the stack so that this can be called from assembler before a stack is set up (at least on ARM and PowerPC).
---
drivers/serial/Kconfig | 13 +++++++++++++ drivers/serial/ns16550.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 2 deletions(-)
drivers/serial/Kconfig +13 -0
@@ -31,6 +31,19 @@ config DEBUG_UART serial drivers are up and running (done in serial_init()). Otherwise the drivers may conflict and you will get strange output. +choice + prompt "Select which UART will provide the debug UART" + depends on DEBUG_UART + +config DEBUG_UART_NS16550 + bool "ns16550" + help + Select this to enable a debug UART using the ns16550 driver. You + will need to provide parameters to make this work. The driver will + be available until the real driver model serial is running. + +endchoice + config DEBUG_UART_BASE hex "Base address of UART" depends on DEBUG_UART
drivers/serial/ns16550.c +40 -2
69 lines not on this page · raw message
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 18/19 serial: ns16550: Support debug UART
Hi Simon,
Quoted 8 lines · On Mon, 15 Dec 2014 07:19:53 -0700 Simon Glass <[email protected]> wrote:
drivers/serial/ns16550.c +8
-0+#ifdef CONFIG_DEBUG_UART_NS16550 +void debug_uart_init (void ) +{ +struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE ; +int baud_divisor; + + baud_divisor =calc_divisor (com_port,CONFIG_DEBUG_UART_CLOCK , +CONFIG_BAUDRATE );
drivers/serial/ns16550.c int NS16550_tstc(NS16550_t com_port) · line 245
Quoted 10 lines
drivers/serial/ns16550.c +10
-0+ +writeb (CONFIG_SYS_NS16550_IER , &com_port->ier); +writeb (UART_MCRVAL , &com_port->mcr); +writeb (UART_FCRVAL , &com_port->fcr); + +writeb (UART_LCR_BKSE |UART_LCRVAL , &com_port->lcr); +writeb (baud_divisor &0xff , &com_port->dll); +writeb ((baud_divisor >>8 ) &0xff , &com_port->dlm); +writeb (UART_LCRVAL , &com_port->lcr); +}
This function is duplicating NS16550_init() and NS16550_setbrg().
drivers/serial/ns16550.c int NS16550_tstc(NS16550_t com_port) · line 254
Quoted 8 lines
drivers/serial/ns16550.c +8
-0+static inline void _debug_uart_putc (int ch) +{ +struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE ; + +while (!(readb (&com_port->lsr) &UART_LSR_THRE )) + ; +writeb (ch, &com_port->thr); +}
This is duplicating ns16550_serial_putc().
What does this patch save?
It looks like the driver code is just getting dirtier.
Best Regards
Masahiro Yamada
PATCH 18/19 serial: ns16550: Support debug UART
Hi Masahiro,
Quoted 18 lines · Masahiro Yamada
Hi Simon,
Quoted 12 lines · On Mon, 15 Dec 2014 07:19:53 -0700 Simon Glass <[email protected]> wrote:
drivers/serial/ns16550.c +12
-0+#ifdef CONFIG_DEBUG_UART_NS16550 +void debug_uart_init (void ) +{ +struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE ; +int baud_divisor; + + baud_divisor =calc_divisor (com_port,CONFIG_DEBUG_UART_CLOCK , +CONFIG_BAUDRATE ); + +writeb (CONFIG_SYS_NS16550_IER , &com_port->ier); +writeb (UART_MCRVAL , &com_port->mcr); +writeb (UART_FCRVAL , &com_port->fcr);
Quoted 8 lines
drivers/serial/ns16550.c int NS16550_tstc(NS16550_t com_port) · line 245
Quoted 6 lines
drivers/serial/ns16550.c +6
-0+ +writeb (UART_LCR_BKSE |UART_LCRVAL , &com_port->lcr); +writeb (baud_divisor &0xff , &com_port->dll); +writeb ((baud_divisor >>8 ) &0xff , &com_port->dlm); +writeb (UART_LCRVAL , &com_port->lcr); +}This function is duplicating
NS16550_init()andNS16550_setbrg().
Yes I should fix that.
Quoted 13 lines
drivers/serial/ns16550.c int NS16550_tstc(NS16550_t com_port) · line 254
Quoted 11 lines
drivers/serial/ns16550.c +8
-0+static inline void _debug_uart_putc (int ch) +{ +struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE ; + +while (!(readb (&com_port->lsr) &UART_LSR_THRE )) + ; +writeb (ch, &com_port->thr); +}This is duplicating
ns16550_serial_putc().
Ditto.
Quoted 6 lines
What does this patch save?
It looks like the driver code is just getting dirtier.
See my other patch for an explanation. We could add this feature to any serial driver.
Regards,
Simon
PATCH 19/19 powerpc: ppc4xx: Provide early debug UART defaults
In reply to Simon GlassProvide defaults so that the early debug UART can be enabled.
---
board/amcc/canyonlands/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+)
board/amcc/canyonlands/Kconfig +6 -0
@@ -38,4 +38,10 @@ config DM_SERIAL config SYS_MALLOC_F_LEN default 0x400 +config DEBUG_UART_BASE + default 0xef600300 + +config DEBUG_UART_CLOCK + default 7372800 + endif
Signature · 1 line
2.2.0.rc0.207.ga3a616c
cover powerpc: Introduce device tree control and driver model
In reply to Simon Glass+Tom
Hi,
Quoted 35 lines · Simon Glass
This series does a small amount of tweaking to support device tree control (
CONFIG_OF_CONTROL) on PowerPC platforms. It also adds support for driver model. In both cases the main effort is to set things up correctly before callingboard_init_f().A new generic function,
board_init_f_mem()is introduced. This does the various memory calculations in C code, since they are messy in assembler and every architecture should in fact be the same. A later series will adjust ARM and x86 to use this function.As an example, the Canyonlands boards are converted over to use device tree control and driver model for their serial console. It should be fairly straightforward to convert over other boards.
Simon Glass (18):
Introduceboard_init_f_mem()to handle early memory layout
powerpc: Permit device tree control of U-Boot (CONFIG_OF_CONTROL)
powerpc: ppc4xx: canyonlands: config: Tidy up CONFIGs and config.mk
powerpc: ppc4xx: Move CANYONLANDS/GLACIER/ARCHES toKconfig
powerpc: ppc4xx: Add ramboot config for glacier
powerpc: ppc4xx: canyonlands: Move to generic board
powerpc: ppc4xx: dts: Bring in canyonlands device tree files
powerpc: ppc4xx: Callboard_init_f_mem()for generic board
powerpc: ppc4xx: Add agpio.hheader file
powerpc: ppc4xx: Allow the end of u-boot.bin to be found
powerpc: ppc4xx: UseCONFIG_OF_CONTROLfor canyonlands boards
ppc: amcc: Omit unneeded ns16550 CONFIG if using driver model
powerpc: Add serial driver for driver model
dm: powerpc: ppc4xx: Move glacier to use driver model for serial
powerpc: Addlinkage.hfile
serial: Support an early UART for debugging
serial: ns16550: Support debug UART
powerpc: ppc4xx: Provide early debug UART defaults
Quoted 3 lines
Stefan Roese (1):
WIP: powerpc: ppc4xx: Somehow BSS is not cleared in RAMBOOT case
Are there any comments on this series? How should I go about getting it applied?
Quoted 43 lines
arch/Kconfig | 1 + arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c | 8 + arch/powerpc/cpu/ppc4xx/config.mk | 5 +- arch/powerpc/cpu/ppc4xx/cpu_init.c | 2 + arch/powerpc/cpu/ppc4xx/start.S | 18 +- arch/powerpc/cpu/ppc4xx/u-boot.lds | 8 +- arch/powerpc/dts/Makefile | 11 + arch/powerpc/dts/arches.dts | 339 ++++++++++++++++ arch/powerpc/dts/canyonlands.dts | 555 ++++++++++++++++++++++++++ arch/powerpc/dts/glacier.dts | 579 ++++++++++++++++++++++++++++ arch/powerpc/include/asm/arch-ppc4xx/gpio.h | 7 + arch/powerpc/include/asm/linkage.h | 7 + arch/powerpc/include/asm/ppc460ex_gt.h | 2 + arch/powerpc/lib/board.c | 3 + board/amcc/canyonlands/Kconfig | 35 ++ board/amcc/canyonlands/MAINTAINERS | 1 + board/amcc/canyonlands/config.mk | 2 - board/amcc/canyonlands/u-boot-ram.lds | 85 ++++ common/board_f.c | 18 + common/board_r.c | 8 +- configs/arches_defconfig | 5 +- configs/canyonlands_defconfig | 5 +- configs/glacier_defconfig | 5 +- configs/glacier_ramboot_defconfig | 8 + drivers/serial/Kconfig | 59 +++ drivers/serial/Makefile | 1 + drivers/serial/ns16550.c | 42 +- drivers/serial/serial_ppc.c | 40 ++ include/configs/amcc-common.h | 2 + include/configs/canyonlands.h | 38 +- include/debug_uart.h | 139 +++++++ 31 files changed, 2006 insertions(+), 32 deletions(-) create mode 100644 arch/powerpc/dts/Makefile create mode 100644 arch/powerpc/dts/arches.dts create mode 100644 arch/powerpc/dts/canyonlands.dts create mode 100644 arch/powerpc/dts/glacier.dts create mode 100644 arch/powerpc/include/asm/arch-ppc4xx/gpio.h create mode 100644 arch/powerpc/include/asm/linkage.h create mode 100644 board/amcc/canyonlands/u-boot-ram.lds create mode 100644 configs/glacier_ramboot_defconfig create mode 100644 drivers/serial/serial_ppc.c create mode 100644 include/debug_uart.h
Quoted 3 lines
--
2.2.0.rc0.207.ga3a616c
Regards,
Simon