[U-Boot] [RFC PATCH 1/7] Allow checking in multiple partitions for scan_dev_for_boot.
Signed-off-by: Vagrant Cascadian vagr...@debian.org --- include/config_distro_bootcmd.h | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index be616e8..5e5e5e3 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -163,7 +163,7 @@ boot_prefixes=/ /boot/\0 \ boot_scripts=boot.scr.uimg boot.scr\0 \ BOOTENV_BOOT_TARGETS \ - bootpart=1\0 \ + boot_partitions=1\0 \ \ boot_extlinux= \ sysboot ${devtype} ${devnum}:${bootpart} any\ @@ -194,10 +194,13 @@ done\0 \ \ scan_dev_for_boot= \ - echo Scanning ${devtype} ${devnum}...; \ - for prefix in ${boot_prefixes}; do \ - run scan_dev_for_extlinux; \ - run scan_dev_for_scripts; \ + for partition in ${boot_partitions}; do \ + echo Scanning ${devtype} ${devnum}:${partition}...; \ + setenv bootpart ${partition}; \ + for prefix in ${boot_prefixes}; do \ + run scan_dev_for_extlinux; \ + run scan_dev_for_scripts; \ + done; \ done\0 \ \ BOOT_TARGET_DEVICES(BOOTENV_DEV) \ -- 2.1.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH 4/7] Add BOOTENV_POST_COMMAND, which is appended to the end of bootcmd.
Signed-off-by: Vagrant Cascadian vagr...@debian.org --- include/config_distro_bootcmd.h | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 515a2f9..2503431 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -160,6 +160,10 @@ #define BOOTENV_INIT_COMMAND #endif +#ifndef BOOTENV_POST_COMMAND +#define BOOTENV_POST_COMMAND +#endif + #define BOOTENV_DEV(devtypeu, devtypel, instance) \ BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance) #define BOOTENV \ @@ -217,6 +221,8 @@ BOOTENV_SET_USB_NEED_INIT BOOTENV_SET_SCSI_NEED_INIT \ for target in ${boot_targets}; do \ run bootcmd_${target}; \ - done\0 + done; \ + BOOTENV_POST_COMMAND \ + \0 #endif /* _CONFIG_CMD_DISTRO_BOOTCMD_H */ -- 2.1.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH 6/7] Add support for loading environment from uEnv.txt in config_distro_bootcmd.
Signed-off-by: Vagrant Cascadian vagr...@debian.org --- include/config_distro_bootcmd.h | 21 + 1 file changed, 21 insertions(+) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 2503431..aaa010e 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -174,6 +174,7 @@ BOOTENV_SHARED_IDE \ boot_prefixes=/ /boot/\0 \ boot_scripts=boot.scr.uimg boot.scr\0 \ + boot_uenv_files=uEnv.txt\0 \ BOOTENV_BOOT_TARGETS \ boot_partitions=BOOTENV_BOOT_PARTITIONS\0 \ \ @@ -205,6 +206,25 @@ fi; \ done\0 \ \ + import_uenv_file= \ + load ${devtype} ${devnum}:${bootpart} \ + ${scriptaddr} ${prefix}${uenv_file};\ + env import -t -r ${scriptaddr} ${filesize}\0; \ + if test -n $uenvcmd; then \ + echo Running uenvcmd ...; \ + run uenvcmd;\ + fi;\0 \ + \ + scan_dev_for_uenv_files=\ + for uenv_file in ${boot_uenv_files}; do \ + if test -e ${devtype} ${devnum}:${bootpart} \ + ${prefix}${uenv_file}; then \ + echo Found U-boot env file \ + ${prefix}${uenv_file}; \ + run import_uenv_file; \ + fi; \ + done\0 \ + \ scan_dev_for_boot= \ for partition in ${boot_partitions}; do \ echo Scanning ${devtype} ${devnum}:${partition}...; \ @@ -212,6 +232,7 @@ for prefix in ${boot_prefixes}; do \ run scan_dev_for_extlinux; \ run scan_dev_for_scripts; \ + run scan_dev_for_uenv_files;\ done; \ done\0 \ \ -- 2.1.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH 3/7] Add BOOTENV_INIT_COMMAND for commands that may be needed to run before bootcmd, such as setting the fdt file variables for platfroms that detect on boot.
Signed-off-by: Vagrant Cascadian vagr...@debian.org --- include/config_distro_bootcmd.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index a93354a..515a2f9 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -156,6 +156,10 @@ #define BOOTENV_BOOT_PARTITIONS 1 #endif +#ifndef BOOTENV_INIT_COMMAND +#define BOOTENV_INIT_COMMAND +#endif + #define BOOTENV_DEV(devtypeu, devtypel, instance) \ BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance) #define BOOTENV \ @@ -209,7 +213,8 @@ \ BOOT_TARGET_DEVICES(BOOTENV_DEV) \ \ - bootcmd= BOOTENV_SET_USB_NEED_INIT BOOTENV_SET_SCSI_NEED_INIT \ + bootcmd= BOOTENV_INIT_COMMAND \ + BOOTENV_SET_USB_NEED_INIT BOOTENV_SET_SCSI_NEED_INIT \ for target in ${boot_targets}; do \ run bootcmd_${target}; \ done\0 -- 2.1.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH 0/7] Switch am335x_evm.h based boards to use config_distro_bootcmd.
In order to not change behavior significantly, several changes to config_distro_bootcmd were added to make it more flexible, and am335x_evm.h was adapted to make use of them: - Allow multiple partitions per device, rather than only searching on partition 1. Make the number of partitions configurable. - Added BOOTENV_INIT_COMMAND and BOOTENV_POST_COMMAND as definitions for commands that need to be run before or after the standard bootcmd. - Added support for importing uEnv.txt files to config_distro_bootcmd.h. include/config_distro_bootcmd.h | 53 ++--- include/config_distro_defaults.h | 2 ++ include/configs/am335x_evm.h | 26 +- include/configs/ti_armv7_common.h | 1 + 4 files changed, 66 insertions(+), 16 deletions(-) Vagrant Cascadian (7): Allow checking in multiple partitions for scan_dev_for_boot. Allow overriding boot_partitions default value by setting BOOTENV_BOOT_PARTITIONS before including config_distro_bootcmd. Add BOOTENV_INIT_COMMAND for commands that may be needed to run before bootcmd, such as setting the fdt file variables for platfroms that detect on boot. Add BOOTENV_POST_COMMAND, which is appended to the end of bootcmd. Only set CONFIG_BOOTDELAY if not already set. Add support for loading environment from uEnv.txt in config_distro_bootcmd. Switch am335x_evm.h to use config_distro_defaults and config_distro_bootcmd. Add scriptaddr to DEFAULT_LINUX_BOOT_ENV, as scriptaddr is used for boot scripts in config_distro_bootcmd. include/config_distro_bootcmd.h | 53 +-- include/config_distro_defaults.h | 2 ++ include/configs/am335x_evm.h | 26 --- include/configs/ti_armv7_common.h | 1 + 4 files changed, 66 insertions(+), 16 deletions(-) -- 2.1.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH 7/7] Switch am335x_evm.h to use config_distro_defaults and config_distro_bootcmd. Add scriptaddr to DEFAULT_LINUX_BOOT_ENV, as scriptaddr is used for boot scripts in config_distro_
Signed-off-by: Vagrant Cascadian vagr...@debian.org --- include/configs/am335x_evm.h | 26 +- include/configs/ti_armv7_common.h | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index e2f7ead..b25d990 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -18,6 +18,21 @@ #include configs/ti_am335x_common.h +#include config_distro_defaults.h + +#define BOOTENV_BOOT_PARTITIONS 2 + +#define BOOTENV_INIT_COMMAND run findfdt ; +#ifdef CONFIG_NAND +#define BOOTENV_POST_COMMAND run nandboot ; +#endif + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) \ + func(MMC, mmc, 1) + +#include config_distro_bootcmd.h + #ifndef CONFIG_SPL_BUILD # define CONFIG_FIT # define CONFIG_TIMESTAMP @@ -185,17 +200,10 @@ if test $fdtfile = undefined; then \ echo WARNING: Could not determine device tree to use; fi; \0 \ NANDARGS \ - DFUARGS + DFUARGS \ + BOOTENV #endif -#define CONFIG_BOOTCOMMAND \ - run findfdt; \ - run mmcboot; \ - setenv mmcdev 1; \ - setenv bootpart 1:2; \ - run mmcboot; \ - run nandboot; - /* NS16550 Configuration */ #define CONFIG_SYS_NS16550_COM10x44e09000 /* Base EVM has UART0 */ #define CONFIG_SYS_NS16550_COM20x48022000 /* UART1 */ diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h index 85171db..f405fea 100644 --- a/include/configs/ti_armv7_common.h +++ b/include/configs/ti_armv7_common.h @@ -54,6 +54,7 @@ #define DEFAULT_LINUX_BOOT_ENV \ loadaddr=0x8200\0 \ kernel_addr_r=0x8200\0 \ + scriptaddr=0x8200\0 \ fdtaddr=0x8800\0 \ fdt_addr_r=0x8800\0 \ rdaddr=0x8808\0 \ -- 2.1.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH 5/7] Only set CONFIG_BOOTDELAY if not already set.
Signed-off-by: Vagrant Cascadian vagr...@debian.org --- include/config_distro_defaults.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/config_distro_defaults.h b/include/config_distro_defaults.h index 5d18a4b..fc67c42 100644 --- a/include/config_distro_defaults.h +++ b/include/config_distro_defaults.h @@ -45,7 +45,9 @@ #define CONFIG_CMDLINE_EDITING #define CONFIG_AUTO_COMPLETE +#ifndef CONFIG_BOOTDELAY #define CONFIG_BOOTDELAY 2 +#endif #define CONFIG_SYS_LONGHELP #define CONFIG_MENU #define CONFIG_DOS_PARTITION -- 2.1.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH 2/7] Allow overriding boot_partitions default value by setting BOOTENV_BOOT_PARTITIONS before including config_distro_bootcmd.
Signed-off-by: Vagrant Cascadian vagr...@debian.org --- include/config_distro_bootcmd.h | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 5e5e5e3..a93354a 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -152,6 +152,10 @@ #define BOOTENV_BOOT_TARGETS \ boot_targets= BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) \0 +#ifndef BOOTENV_BOOT_PARTITIONS +#define BOOTENV_BOOT_PARTITIONS 1 +#endif + #define BOOTENV_DEV(devtypeu, devtypel, instance) \ BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance) #define BOOTENV \ @@ -163,7 +167,7 @@ boot_prefixes=/ /boot/\0 \ boot_scripts=boot.scr.uimg boot.scr\0 \ BOOTENV_BOOT_TARGETS \ - boot_partitions=1\0 \ + boot_partitions=BOOTENV_BOOT_PARTITIONS\0 \ \ boot_extlinux= \ sysboot ${devtype} ${devnum}:${bootpart} any\ -- 2.1.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/6] sunxi: Add sunxi_gpio_get_val function
On Fri, 2014-10-03 at 17:05 +0200, Hans de Goede wrote: Signed-off-by: Hans de Goede hdego...@redhat.com drivers/gpio/sunxi_gpio.c already has sunxi_gpio_input exported via the standard gpio_get_value name. Ian. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/6] sunxi: Add mmc card-detect functionality
On Fri, 2014-10-03 at 17:05 +0200, Hans de Goede wrote: Signed-off-by: Hans de Goede hdego...@redhat.com --- board/sunxi/Kconfig | 27 +++ drivers/mmc/sunxi_mmc.c | 20 2 files changed, 47 insertions(+) diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 622f7b4..72d6dfa 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -32,4 +32,31 @@ config USB_KEYBOARD Say Y here to add support for using a USB keyboard (typically used in combination with a graphical console on HDMI). +config MMC0_CD_PIN + int Card detect pin for mmc0 + default -1 + ---help--- + Set the card detect pin for mmc0, set to -1 to not use cd. The pins + are numbered as follows PA0 - PA17 are pin number 0 - 17, PB0 - PB23 + are 32 - 55, PC0 - PC24 are 64 - 88, etc. Most boards use PH1 for + mmc0 cd, which is pin nr 225. Is there any way we could use the same trick as for SATAPWR and allow this to be specified as something like GPx(y) instead of requiring this complex mapping in the help text? Might be possible with some combination of Kconfig and cpp trickery? Maybe the simplest solution is to make this a string and pass it to name_to_gpio at runtime (e.g gpio = name_to_gpio(CONFIG_MMC0_CD_PIN)), although that has the disadvantage of being runtime only check. Ian. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/6] sunxi: Turn MMC_SUNXI_SLOT_EXTRA into a proper Kconfig option
On Fri, 2014-10-03 at 17:05 +0200, Hans de Goede wrote: Note we also drop the SPL check for initializing the 2nd mmc slot, the SPL check is not necessary with Kconfig, because only options explicitly marked as also being for the SPL get set during SPL builds. Signed-off-by: Hans de Goede hdego...@redhat.com If we come across a system with e.g. 3 slots then this is just going to get more complex, isn't it? Shall we bite the bullet now and got straight to a bool option per potential slot? --- board/sunxi/Kconfig | 8 board/sunxi/board.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 72d6dfa..c9b459a 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -32,6 +32,14 @@ config USB_KEYBOARD Say Y here to add support for using a USB keyboard (typically used in combination with a graphical console on HDMI). +config MMC_SUNXI_SLOT_EXTRA + int mmc extra slot number + default -1 + ---help--- + sunxi builds always enable mmc0, some boards also have a sdcard slot + or emmc on mmc2 or mmc3. Setting this to 2 or 3 will enable support + for this. + config MMC0_CD_PIN int Card detect pin for mmc0 default -1 diff --git a/board/sunxi/board.c b/board/sunxi/board.c index e819b12..4d602ca 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -110,7 +110,7 @@ int board_mmc_init(bd_t *bis) { mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT); sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT); -#if !defined (CONFIG_SPL_BUILD) defined (CONFIG_MMC_SUNXI_SLOT_EXTRA) +#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA); sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA); #endif ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/6] sunxi: When we've both mmc0 and mmc2, detect from which one we're booting
On Fri, 2014-10-03 at 17:05 +0200, Hans de Goede wrote: sunxi SOCs can boot from both mmc0 and mmc2, detect from which one we're booting, and make that one mmc dev 0 so that a single u-boot binary can be used for both the onboard eMMC and for external sdcards. Where does the dependency on dev 0 being the boot device come from? Is it just the env via CONFIG_SYS_MMC_ENV_DEV? If it's just that then is it allowable to define CONFIG_SYS_MMC_ENV_DEV as a call to a function which returns the appropriate number? Or maybe mmc-block_dev.dev already doesn't correspond to the h/w controller number? So dev==0 is completely arbitrary? +#if CONFIG_MMC_SUNXI_SLOT == 0 CONFIG_MMC_SUNXI_SLOT_EXTRA == 2 + /* + * Both mmc0 and mmc2 are bootable, figure out where we're booting + * from. Try mmc0 first, just like the brom does. + */ + if (mmc_getcd(mmc0) mmc_init(mmc0) == 0 + mmc0-block_dev.block_read(0, 16, 1, buf) == 1) { + buf[12] = 0; + if (strcmp(buf[4], eGON.BT0) == 0) + return 0; This just checks if the mmc is bootable, not necessarily that we booted from it, does it? Or is just like the brom does implying that the bootrom would always have booted mmc0 if this signature was there? is that check sufficient or does the brom check other stuff, e.g. signatures etc or have a fallback path if mmc0 fails to boot somehow? Ian. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 5/6] sunxi: Use PG3 - PG8 as io-pins for mmc1
On Fri, 2014-10-03 at 17:05 +0200, Hans de Goede wrote: None of the known sunxi devices actually use mmc1 routed through PH, where as some devices do actually use mmc1 routed through PG, so change the routing of mmc1 to PG. If in the future we encounter devices with mmc1 routed through PH, we will need to change things to be a bit more flexible. Signed-off-by: Hans de Goede hdego...@redhat.com Acked-by: Ian Campbell ian.campb...@citrix.com Although it seems that adding a Kconfig choice option would only be a dozen or so lines of pretty trivial stuff if we wanted to do it now. Ian. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 6/6] sunxi: Enable second sdcard slot found on some boards
On Fri, 2014-10-03 at 17:05 +0200, Hans de Goede wrote: diff --git a/configs/Mele_M3_defconfig b/configs/Mele_M3_defconfig index 645b236..50979e2 100644 --- a/configs/Mele_M3_defconfig +++ b/configs/Mele_M3_defconfig @@ -1,5 +1,7 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS=MELE_M3,AXP209_POWER,SUNXI_GMAC,USB_EHCI CONFIG_FDTFILE=sun7i-a20-m3.dtb ++S:CONFIG_MMC_SUNXI_SLOT_EXTRA=2 This one is +S (regular+SPL) while the other two are just S (regular only). Is that deliberate? Ian. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 6/6] sunxi: Enable second sdcard slot found on some boards
On Sat, 2014-10-04 at 09:38 +0100, Ian Campbell wrote: On Fri, 2014-10-03 at 17:05 +0200, Hans de Goede wrote: diff --git a/configs/Mele_M3_defconfig b/configs/Mele_M3_defconfig index 645b236..50979e2 100644 --- a/configs/Mele_M3_defconfig +++ b/configs/Mele_M3_defconfig @@ -1,5 +1,7 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS=MELE_M3,AXP209_POWER,SUNXI_GMAC,USB_EHCI CONFIG_FDTFILE=sun7i-a20-m3.dtb ++S:CONFIG_MMC_SUNXI_SLOT_EXTRA=2 This one is +S (regular+SPL) while the other two are just S (regular only). Is that deliberate? Sorry, I should have read the commit message more carefully as you explained it quite clearly there! This patch looks good, except insofar as some of my comments on earlier patches could result in it looking completely different, sorry about that! Ian. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH for-next 0/3] sunxi: Kconfig consolidation and cleanup
A few simple patches which consolidate some Kconfig options and make SPL_FEL a first class .config member instead of putting it in CONFIG_SYS_EXTRA_OPTIONS. This means it is possible to do a FEL build for any board with: make board_config echo CONFIG_SPL_FEL=y .config echo CONFIG_SPL_FEL=y spl/.config or better make board_config sed -i -e 's/\# CONFIG_SPL_FEL is not set/CONFIG_SPL_FEL=y/g' .config spl/.config which is still one more step than I would like but still preferable IMHO to: sed -i -e 's/^CONFIG_SYS_EXTRA_OPTIONS=[^]*/,SPL_FEL/g' .config spl/.config I've been using a little hack (below) to MAKEALL to help build test this. There's still plenty of stuff in sunxi CONFIG_SYS_EXTRA_OPTIONS which could be moved out, but most of it is dependent on drivers/*/Kconfig switching first. Probably the board and power controller selection could be moved out without any dependencies, although the board one in particular will be quite a big patch I think it would be worth it. Ian. My MAKEALL hack, surely not upstreamable ;-) diff --git a/MAKEALL b/MAKEALL index 7c16319..3a8d1d0 100755 --- a/MAKEALL +++ b/MAKEALL @@ -660,6 +660,11 @@ build_target() { echo Building ${target} board... ${MAKE} -s ${target}_defconfig /dev/null + if [ -n $SUNXI_FORCE_FEL ] ; then + sed -i -e 's/\# CONFIG_SPL_FEL is not set/CONFIG_SPL_FEL=y/g' \ + .config spl/.config + fi + ${MAKE} ${JOBS} ${CHECK} all \ ${LOG_DIR}/$target.MAKELOG 2 ${LOG_DIR}/$target.ERR ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH for-next 1/3] sunxi: Kconfig: Consolidate SYS_CONFIG_NAME settings
No need to be so repetitive. Signed-off-by: Ian Campbell i...@hellion.org.uk --- board/sunxi/Kconfig | 31 --- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 05defac..c4b3167 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -1,31 +1,8 @@ -if TARGET_SUN4I - -config SYS_CONFIG_NAME - default sun4i - -endif - -if TARGET_SUN5I - -config SYS_CONFIG_NAME - default sun5i - -endif - -if TARGET_SUN6I - config SYS_CONFIG_NAME - string - default sun6i - -endif - -if TARGET_SUN7I - -config SYS_CONFIG_NAME - default sun7i - -endif + default sun4i if TARGET_SUN4I + default sun5i if TARGET_SUN5I + default sun6i if TARGET_SUN6I + default sun7i if TARGET_SUN7I if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I -- 2.1.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH for-next 2/3] sunxi: kconfig: Add top-level TARGET_SUNXI
And make TARGET_SUN[457]I a choice variable under this. configs updated with: sed -i -e 's/^\+S:CONFIG_TARGET_SUN.I=y/+S:CONFIG_TARGET_SUNXI=y\n/g' configs/* Signed-off-by: Ian Campbell i...@hellion.org.uk --- arch/arm/Kconfig | 13 ++--- board/sunxi/Kconfig | 21 +++-- configs/A10-OLinuXino-Lime_defconfig | 1 + configs/A10s-OLinuXino-M_defconfig| 1 + configs/A13-OLinuXinoM_defconfig | 1 + configs/A13-OLinuXino_defconfig | 1 + configs/A20-OLinuXino-Lime_defconfig | 1 + configs/A20-OLinuXino_MICRO_defconfig | 1 + configs/Auxtek-T004_defconfig | 1 + configs/Bananapi_defconfig| 1 + configs/Cubieboard2_FEL_defconfig | 1 + configs/Cubieboard2_defconfig | 1 + configs/Cubieboard_defconfig | 1 + configs/Cubietruck_FEL_defconfig | 1 + configs/Cubietruck_defconfig | 1 + configs/Linksprite_pcDuino3_defconfig | 1 + configs/Mele_A1000G_defconfig | 1 + configs/Mele_A1000_defconfig | 1 + configs/Mini-X-1Gb_defconfig | 1 + configs/Mini-X_defconfig | 1 + configs/ba10_tv_box_defconfig | 1 + configs/i12-tvbox_defconfig | 1 + configs/qt840a_defconfig | 1 + configs/r7-tv-dongle_defconfig| 1 + 24 files changed, 43 insertions(+), 13 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index e3e7e78..54d2fbb 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -438,17 +438,8 @@ config TARGET_SMDKC100 config TARGET_SOCFPGA_CYCLONE5 bool Support socfpga_cyclone5 -config TARGET_SUN4I - bool Support sun4i - -config TARGET_SUN5I - bool Support sun5i - -config TARGET_SUN6I - bool Support sun6i - -config TARGET_SUN7I - bool Support sun7i +config TARGET_SUNXI + bool Support sunxi config TARGET_SNOWBALL bool Support snowball diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index c4b3167..6e9308d 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -1,11 +1,28 @@ +if TARGET_SUNXI + +choice + prompt Sunxi SoC + +config TARGET_SUN4I + bool sun4i family + +config TARGET_SUN5I + bool sun5i family + +config TARGET_SUN6I + bool sun6i family + +config TARGET_SUN7I + bool sun7i family + +endchoice + config SYS_CONFIG_NAME default sun4i if TARGET_SUN4I default sun5i if TARGET_SUN5I default sun6i if TARGET_SUN6I default sun7i if TARGET_SUN7I -if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I - config SYS_CPU default armv7 diff --git a/configs/A10-OLinuXino-Lime_defconfig b/configs/A10-OLinuXino-Lime_defconfig index f992293..35cc2ca 100644 --- a/configs/A10-OLinuXino-Lime_defconfig +++ b/configs/A10-OLinuXino-Lime_defconfig @@ -2,4 +2,5 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS=A10_OLINUXINO_L,AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI CONFIG_FDTFILE=sun4i-a10-olinuxino-lime.dtb +S:CONFIG_ARM=y ++S:CONFIG_TARGET_SUNXI=y +S:CONFIG_TARGET_SUN4I=y diff --git a/configs/A10s-OLinuXino-M_defconfig b/configs/A10s-OLinuXino-M_defconfig index a578c06..2ab8d3e 100644 --- a/configs/A10s-OLinuXino-M_defconfig +++ b/configs/A10s-OLinuXino-M_defconfig @@ -2,4 +2,5 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS=A10S_OLINUXINO_M,AXP152_POWER,SUNXI_EMAC,USB_EHCI,SUNXI_USB_VBUS0_GPIO=SUNXI_GPB(10) CONFIG_FDTFILE=sun5i-a10s-olinuxino-micro.dtb +S:CONFIG_ARM=y ++S:CONFIG_TARGET_SUNXI=y +S:CONFIG_TARGET_SUN5I=y diff --git a/configs/A13-OLinuXinoM_defconfig b/configs/A13-OLinuXinoM_defconfig index 9ae7b12..5fb3556 100644 --- a/configs/A13-OLinuXinoM_defconfig +++ b/configs/A13-OLinuXinoM_defconfig @@ -2,4 +2,5 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS=A13_OLINUXINOM,CONS_INDEX=2,USB_EHCI,SUNXI_USB_VBUS0_GPIO=SUNXI_GPG(11) CONFIG_FDTFILE=sun5i-a13-olinuxino-micro.dtb +S:CONFIG_ARM=y ++S:CONFIG_TARGET_SUNXI=y +S:CONFIG_TARGET_SUN5I=y diff --git a/configs/A13-OLinuXino_defconfig b/configs/A13-OLinuXino_defconfig index 2c726f3..3632f95 100644 --- a/configs/A13-OLinuXino_defconfig +++ b/configs/A13-OLinuXino_defconfig @@ -2,4 +2,5 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS=A13_OLINUXINO,CONS_INDEX=2,AXP209_POWER,USB_EHCI,SUNXI_USB_VBUS0_GPIO=SUNXI_GPG(11) CONFIG_FDTFILE=sun5i-a13-olinuxino.dtb +S:CONFIG_ARM=y ++S:CONFIG_TARGET_SUNXI=y +S:CONFIG_TARGET_SUN5I=y diff --git a/configs/A20-OLinuXino-Lime_defconfig b/configs/A20-OLinuXino-Lime_defconfig index ca79fd5..2317d1f 100644 --- a/configs/A20-OLinuXino-Lime_defconfig +++ b/configs/A20-OLinuXino-Lime_defconfig @@ -2,4 +2,5 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS=A20_OLINUXINO_L,AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI CONFIG_FDTFILE=sun7i-a20-olinuxino-lime.dtb +S:CONFIG_ARM=y ++S:CONFIG_TARGET_SUNXI=y +S:CONFIG_TARGET_SUN7I=y diff --git a/configs/A20-OLinuXino_MICRO_defconfig b/configs/A20-OLinuXino_MICRO_defconfig index 20a947c..ca68a9f 100644
[U-Boot] [PATCH for-next 3/3] sunxi: Kconfig: Make SPL_FEL a toplevel Kconfig option
It's unfortunate that this needs to be present in both .config and spl/.config since it makes it slightly hard to enable FEL mode for a regular defconfig. It can be done with: echo CONFIG_SPL_FEL=y .config echo CONFIG_SPL_FEL=y spl/.config Ideally only one of those would be needed. Signed-off-by: Ian Campbell i...@hellion.org.uk --- board/sunxi/Kconfig | 4 configs/Cubieboard2_FEL_defconfig | 3 ++- configs/Cubietruck_FEL_defconfig | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 6e9308d..f467ade 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -32,6 +32,10 @@ config SYS_BOARD config SYS_SOC default sunxi +config SPL_FEL + bool SPL/FEL mode support + default n + config FDTFILE string Default fdtfile env setting for this board diff --git a/configs/Cubieboard2_FEL_defconfig b/configs/Cubieboard2_FEL_defconfig index 967be18..8d68275 100644 --- a/configs/Cubieboard2_FEL_defconfig +++ b/configs/Cubieboard2_FEL_defconfig @@ -1,5 +1,6 @@ CONFIG_SPL=y -CONFIG_SYS_EXTRA_OPTIONS=CUBIEBOARD2,SPL_FEL,AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8),USB_EHCI ++S:CONFIG_SPL_FEL=y +CONFIG_SYS_EXTRA_OPTIONS=CUBIEBOARD2,AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8),USB_EHCI CONFIG_FDTFILE=sun7i-a20-cubieboard2.dtb +S:CONFIG_ARM=y +S:CONFIG_TARGET_SUNXI=y diff --git a/configs/Cubietruck_FEL_defconfig b/configs/Cubietruck_FEL_defconfig index 1cda577..64fbc34 100644 --- a/configs/Cubietruck_FEL_defconfig +++ b/configs/Cubietruck_FEL_defconfig @@ -1,5 +1,6 @@ CONFIG_SPL=y -CONFIG_SYS_EXTRA_OPTIONS=CUBIETRUCK,SPL_FEL,AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(12),USB_EHCI ++S:CONFIG_SPL_FEL=y +CONFIG_SYS_EXTRA_OPTIONS=CUBIETRUCK,AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(12),USB_EHCI CONFIG_FDTFILE=sun7i-a20-cubietruck.dtb +S:CONFIG_ARM=y +S:CONFIG_TARGET_SUNXI=y -- 2.1.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/4] Add snoop disable for slave port 0, port 1 and port 2
Hi Alison, On Mon, 29 Sep 2014 10:53:11 +0800, Alison Wang b18...@freescale.com wrote: From: Jason Jin jason@freescale.com Disable the snoop for slave interface 0, 1 and 2 to avoid the interleaving on the CCI400 BUS. Please be more specific: this patch specifically targets arch ls102xa and some associated boards, but the subject/commit summary (and commit message) does not mention that, making it look like a very generic patch. Amicalement, -- Albert. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH RESEND] vf610twr: Tune DDR initialization settings
Hi Stefan, On Thu, 02 Oct 2014 09:09:48 +0200, Stefan Agner ste...@agner.ch wrote: Am 2014-09-09 17:19, schrieb Stefano Babic: Hi Stefan, Albert, On 09/09/2014 17:14, Stefan Agner wrote: Hi Albert, The RESEND version of the patch is actually an updated version (maybe I should have increased the version number?) For me, that patch applies cleanly on U-Boot master 0b703dbcee7103f07804d0a4328d1593355c4324 patman: Fix detection of git version Also I tested on U-Boot ARM master and next branch, applies without errors for me. I have tried myself and I can confirm that patch can be applied fine. Albert, should I apply it to u-boot-imx (vf610twr is part of iMX) and then send it in my next PR ? I guess this would be the correct path to go. Any chance this still makes into 2014.10? Sorry, for some reason this thread has escaped me. If the patch applies I will take it directly. Amicalement, -- Albert. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH for-next 0/3] sunxi: Kconfig consolidation and cleanup
On Sat, 2014-10-04 at 09:47 +0100, Ian Campbell wrote: Probably the board [...] selection could be moved out without any dependencies, although the board one in particular will be quite a big patch I think it would be worth it. On the topic of board selection which way round should the SoC vs. board options be arrange? Should we have invisible TARGET_SUN?I options which are selected by each board, or should we have the boards depend on the appropriate TARGET? In the first case a user would need to choose from a pretty long list of boards, in the second case they would need to know which SoC the board has. I'm leaning towards the first. I don't think either would be an impediment to an eventually single common binary which I'm imagining would appear as a Generic board option which depends/selects all appropriate SoCs. Ian. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/3] ARM: sunxi: Move watchdog register definitions to separate file
On later Allwinner SoCs, the watchdog hardware is by all means a separate hardware block, with its own address range and interrupt line. Move the register definitions to a separate file to facilitate supporting newer SoCs. Signed-off-by: Chen-Yu Tsai w...@csie.org --- arch/arm/include/asm/arch-sunxi/timer.h| 17 +++-- arch/arm/include/asm/arch-sunxi/watchdog.h | 24 2 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 arch/arm/include/asm/arch-sunxi/watchdog.h diff --git a/arch/arm/include/asm/arch-sunxi/timer.h b/arch/arm/include/asm/arch-sunxi/timer.h index 58e14fd..8ed383e 100644 --- a/arch/arm/include/asm/arch-sunxi/timer.h +++ b/arch/arm/include/asm/arch-sunxi/timer.h @@ -11,14 +11,10 @@ #ifndef _SUNXI_TIMER_H_ #define _SUNXI_TIMER_H_ -#define WDT_CTRL_RESTART (0x1 0) -#define WDT_CTRL_KEY (0x0a57 1) -#define WDT_MODE_EN(0x1 0) -#define WDT_MODE_RESET_EN (0x1 1) - #ifndef __ASSEMBLY__ #include linux/types.h +#include asm/arch/watchdog.h /* General purpose timer */ struct sunxi_timer { @@ -43,12 +39,6 @@ struct sunxi_64cnt { u32 hi; /* 0xa8 */ }; -/* Watchdog */ -struct sunxi_wdog { - u32 ctl;/* 0x90 */ - u32 mode; /* 0x94 */ -}; - /* Rtc */ struct sunxi_rtc { u32 ctl;/* 0x100 */ @@ -77,9 +67,8 @@ struct sunxi_timer_reg { struct sunxi_timer timer[6];/* We have 6 timers */ u8 res2[16]; struct sunxi_avs avs; - struct sunxi_wdog wdog; - u8 res3[8]; - struct sunxi_64cnt cnt64; + struct sunxi_wdog wdog; /* 0x90 */ + struct sunxi_64cnt cnt64; /* 0xa0 */ u8 res4[0x58]; struct sunxi_rtc rtc; struct sunxi_alarm alarm; diff --git a/arch/arm/include/asm/arch-sunxi/watchdog.h b/arch/arm/include/asm/arch-sunxi/watchdog.h new file mode 100644 index 000..5b755e3 --- /dev/null +++ b/arch/arm/include/asm/arch-sunxi/watchdog.h @@ -0,0 +1,24 @@ +/* + * (C) Copyright 2014 + * Chen-Yu Tsai w...@csie.org + * + * Watchdog register definitions + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#ifndef _SUNXI_WATCHDOG_H_ +#define _SUNXI_WATCHDOG_H_ + +#define WDT_CTRL_RESTART (0x1 0) +#define WDT_CTRL_KEY (0x0a57 1) +#define WDT_MODE_EN(0x1 0) +#define WDT_MODE_RESET_EN (0x1 1) + +struct sunxi_wdog { + u32 ctl;/* 0x00 */ + u32 mode; /* 0x04 */ + u32 res[2]; +}; + +#endif /* _SUNXI_WATCHDOG_H_ */ -- 2.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/3] ARM: sunxi: Fix reset support on sun6i/sun8i
Hi, This series fixes support for the reset command on sun6i/sun8i. The watchdog hardware has changed in sun6i, both the register addresses and definitions. This makes the reset command unusable on sun6i. Patch 1 moves the watchdog register definitions into a separate file. The rationale behind this is that on sun6i, the watchdog is effectively a separate piece of hardware and not part of the timer. Patch 2 fixes the register definitions for sun6i, most importantly the watchdog offsets. Patch 3 adds the sun6i version of reset via watchdog timeout. I intended to submit this series after the basic sun8i series. It just so happens that I forgot to leave my A23 tablet on at the office, hence I won't be able to test that series until next week. Since this series has no dependencies nor conflicts, I decided to send this one first. Cheers ChenYu Chen-Yu Tsai (3): ARM: sunxi: Move watchdog register definitions to separate file ARM: sunxi: Add sun6i/sun8i timer block register definition ARM: sunxi: Fix reset command on sun6i/sun8i arch/arm/cpu/armv7/sunxi/board.c | 15 ++ arch/arm/include/asm/arch-sunxi/timer.h| 23 ++-- arch/arm/include/asm/arch-sunxi/watchdog.h | 44 ++ 3 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 arch/arm/include/asm/arch-sunxi/watchdog.h -- 2.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/3] ARM: sunxi: Fix reset command on sun6i/sun8i
The watchdog on sun6i/sun8i has a different layout. Add the new layout and fix up the setup functions so that reset works. Signed-off-by: Chen-Yu Tsai w...@csie.org --- arch/arm/cpu/armv7/sunxi/board.c | 15 +++ arch/arm/include/asm/arch-sunxi/watchdog.h | 20 2 files changed, 35 insertions(+) diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c index b6d63db..ecf3ff9 100644 --- a/arch/arm/cpu/armv7/sunxi/board.c +++ b/arch/arm/cpu/armv7/sunxi/board.c @@ -75,6 +75,7 @@ int gpio_init(void) void reset_cpu(ulong addr) { +#if defined(CONFIG_SUN4I) || defined(CONFIG_SUN5I) || defined(CONFIG_SUN7I) static const struct sunxi_wdog *wdog = ((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)-wdog; @@ -86,6 +87,20 @@ void reset_cpu(ulong addr) /* sun5i sometimes gets stuck without this */ writel(WDT_MODE_RESET_EN | WDT_MODE_EN, wdog-mode); } +#else /* CONFIG_SUN6I || CONFIG_SUN8I || .. */ + static const struct sunxi_wdog *wdog = +((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)-wdog; + + /* Set the watchdog for its shortest interval (.5s) and wait */ + writel(WDT_CFG_RESET, wdog-cfg); + writel(WDT_MODE_EN, wdog-mode); + writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, wdog-ctl); + + while (1) { + /* sun5i sometimes gets stuck without this */ + writel(WDT_MODE_EN, wdog-mode); + } +#endif } /* do some early init */ diff --git a/arch/arm/include/asm/arch-sunxi/watchdog.h b/arch/arm/include/asm/arch-sunxi/watchdog.h index 5b755e3..ccc8fa3 100644 --- a/arch/arm/include/asm/arch-sunxi/watchdog.h +++ b/arch/arm/include/asm/arch-sunxi/watchdog.h @@ -12,6 +12,9 @@ #define WDT_CTRL_RESTART (0x1 0) #define WDT_CTRL_KEY (0x0a57 1) + +#if defined(CONFIG_SUN4I) || defined(CONFIG_SUN5I) || defined(CONFIG_SUN7I) + #define WDT_MODE_EN(0x1 0) #define WDT_MODE_RESET_EN (0x1 1) @@ -21,4 +24,21 @@ struct sunxi_wdog { u32 res[2]; }; +#else + +#define WDT_CFG_RESET (0x1) +#define WDT_MODE_EN(0x1) + +struct sunxi_wdog { + u32 irq_en; /* 0x00 */ + u32 irq_sta;/* 0x04 */ + u32 res1[2]; + u32 ctl;/* 0x10 */ + u32 cfg;/* 0x14 */ + u32 mode; /* 0x18 */ + u32 res2; +}; + +#endif + #endif /* _SUNXI_WATCHDOG_H_ */ -- 2.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/3] ARM: sunxi: Add sun6i/sun8i timer block register definition
The RTC hardware has been moved out of the timer block on sun6i/sun8i. In addition, there are more watchdogs available. Also note that the timer block definition is not completely accurate for sun5i/sun7i. Various blocks are missing or have been moved out. Signed-off-by: Chen-Yu Tsai w...@csie.org --- arch/arm/include/asm/arch-sunxi/timer.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/include/asm/arch-sunxi/timer.h b/arch/arm/include/asm/arch-sunxi/timer.h index 8ed383e..03a0684 100644 --- a/arch/arm/include/asm/arch-sunxi/timer.h +++ b/arch/arm/include/asm/arch-sunxi/timer.h @@ -67,7 +67,9 @@ struct sunxi_timer_reg { struct sunxi_timer timer[6];/* We have 6 timers */ u8 res2[16]; struct sunxi_avs avs; +#if defined(CONFIG_SUN4I) || defined(CONFIG_SUN5I) || defined(CONFIG_SUN7I) struct sunxi_wdog wdog; /* 0x90 */ + /* XXX the following is not accurate for sun5i/sun7i */ struct sunxi_64cnt cnt64; /* 0xa0 */ u8 res4[0x58]; struct sunxi_rtc rtc; @@ -75,6 +77,10 @@ struct sunxi_timer_reg { struct sunxi_tgp tgp[4]; u8 res5[8]; u32 cpu_cfg; +#else /* CONFIG_SUN6I || CONFIG_SUN8I || ... */ + u8 res3[16]; + struct sunxi_wdog wdog[5]; /* We have 5 watchdogs */ +#endif }; #endif /* __ASSEMBLY__ */ -- 2.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] How does Driver Model UART work?
Hi Simon, 2014-10-03 22:51 GMT+09:00 Simon Glass s...@chromium.org: Hi Masahiro, On 3 October 2014 07:04, Masahiro Yamada yamad...@jp.panasonic.com wrote: Simon, I am totally being confused. As far as I looked at the dm code, the private data is calloc'ed in device_probe() function if (drv-priv_auto_alloc_size) { dev-priv = calloc(1, drv-priv_auto_alloc_size); if (!dev-priv) { ret = -ENOMEM; goto fail; } } So, dev-priv is storing the address of the allocated memory. Am I understanding correctly? Yes, it always does in driver model. This driver is no different. BTW the ns16550 driver is probably the oddest in U-Boot - it looks like UniPhier has its own UART driver so it would be better to convert that I think. See below for ideas on other UART drivers to look at which are much more normal. If so, I can't understand the following code: static int ns16550_serial_getc(struct udevice *dev) { struct NS16550 *const com_port = dev_get_priv(dev); if (!serial_in(com_port-lsr) UART_LSR_DR) return -EAGAIN; com_port is dev-priv, so it is pointing to the allocated area on RAM, I guess. It looks like serial_in(com_port-lsr) is trying to read from the hardware register ? Or reading from malloc area RAM ?? If you go one level deeper you will see that serial_in() is defined at the top in about 5 ways, one of which is used for driver model: #define serial_in(addr) \ ns16550_readb(com_port, addr - (unsigned char *)com_port) So it used com_port which is not an parameter. The parameter addr is only used to specify the register. This is actually the same as the non-DM code except in that case the parameter specifies the register and hardware address at the same time. Without your help, I never could have understood this code. Now it is clearer, thanks! (although this code is really unfortunate...) This is done since the internal NS16550_t type is unfortunately exported all over U-Boot. This is annoying because it is actually an internal register format for the UART. Even worse is the fact that the structure changes depending on CONFIG_SYS_NS16550_REG_SIZE. We can't have this sort of thing in driver model - we need to be able to cope with the device tree specifying all the information that the UART needs. So for driver model: Agreed. We should pass reg-shift from a device tree or a board-file. If all the board switched to the driver model, the driver code would become much clean. /* * For driver model we always use one byte per register, and sort out the * differences in the driver */ #define CONFIG_SYS_NS16550_REG_SIZE (-1) (see ns16550.h header for where this is used) I would like to avoid having that type exported and use a different method to pass the UART information around. But it is used in about 30 places . So this approach allows us to move forward bit by bit, without duplicating the UART driver and creating a maintenance headache. In terns of implementing a new UART driver, are you using device tree? UniPhier SoCs have not supported the device tree control yet. I am planning to do the dm conversion with a board file. If so then you should just be able to follow along with Tegra - it's really easy - just copy that serial_tegra.c and adjust the device tree compat string and input clock. Other examples are serial_omap and serial_dw. (See u-boot-dm/working) These are unfortunate. They are borrowing ns16550 code. If you are using platform data, then the examples are serial_mxc and serial_pl01x. I am doing this way. Anyway, the register map of UniPhier is not 8250-compatible. It cannot borrow ns16550 code. -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [linux-sunxi] [PATCH 0/3] ARM: sunxi: Fix reset support on sun6i/sun8i
Hi, On Sat, Oct 4, 2014 at 11:02 PM, Julian Calaby julian.cal...@gmail.com wrote: Hi, On Sat, Oct 4, 2014 at 10:37 PM, Chen-Yu Tsai w...@csie.org wrote: Hi, This series fixes support for the reset command on sun6i/sun8i. The watchdog hardware has changed in sun6i, both the register addresses and definitions. This makes the reset command unusable on sun6i. Doesn't this break building multi-sub-arch kernels that support both sun4i/sun5i/sun7i and sun6i/sun8i? Last time I checked, U-boot doesn't do multi-arch kernels. Would it be possible to just add a new driver for the modified watchdog or put all the bits that changed into the device tree? That is pretty much what the kernel version of this does. See: http://www.spinics.net/lists/arm-kernel/msg362853.html Cheers ChenYu ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] U-Boot Mini Summit
Hi Detlev, 2014-10-03 2:09 GMT+09:00 Detlev Zundel d...@denx.de: Hi, the agenda for the U-Boot Mini Summit in a few days in Düsseldorf has now been finalized[1]. It is very encouraging to see such a lot of high-class content and I'm very excited to also meet a lot of new people. Please note that we would like to have as many custodians present as possible at 11:15 so that we can have a short round of introductions. I'm sure it will be a very pleasant experience to match names with faces known only from the mailing list so far :) Also note that the agenda allows everybody to attend Toms talk Redundant booting with U-Boot at 16:30[2] and of course it has no chance to collide with Mareks talk Secure and flexible boot with U-Boot on Wednesday at 15:30[2]. Thanks for all the input so far and I'm looking forward to seeing you all in a few days! Detlev [1] http://www.denx.de/wiki/U-Boot/MiniSummitELCE2014 [2] http://events.linuxfoundation.org/events/embedded-linux-conference-europe/program/schedule Perhaps, is it better to insert 5-minute break between talks? Speakers might need to get something prepared. (connecting their laptop to the beamer, etc.) -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] U-Boot Mini Summit
Hi Il 02/ott/2014 23:07 Albert ARIBAUD albert.u.b...@aribaud.net ha scritto: Hi Detlev, On Thu, 02 Oct 2014 19:09:07 +0200, Detlev Zundel d...@denx.de wrote: Hi, the agenda for the U-Boot Mini Summit in a few days in Düsseldorf has now been finalized[1]. It is very encouraging to see such a lot of high-class content and I'm very excited to also meet a lot of new people. Please note that we would like to have as many custodians present as possible at 11:15 so that we can have a short round of introductions. I'm sure it will be a very pleasant experience to match names with faces known only from the mailing list so far :) I would have liked to attend, but for personal reasons could not free myself up. Is there any possibility of a Google Hangout or anything similar? Well I'm not active so much on mailing list but I have the same question Michael Also note that the agenda allows everybody to attend Toms talk Redundant booting with U-Boot at 16:30[2] and of course it has no chance to collide with Mareks talk Secure and flexible boot with U-Boot on Wednesday at 15:30[2]. Thanks for all the input so far and I'm looking forward to seeing you all in a few days! Detlev [1] http://www.denx.de/wiki/U-Boot/MiniSummitELCE2014 [2] http://events.linuxfoundation.org/events/embedded-linux-conference-europe/program/schedule Amicalement, -- Albert. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Pull request: u-boot-mmc 03102014
On Fri, Oct 03, 2014 at 05:41:05PM +0300, Pantelis Antoniou wrote: Hi Tom, The following changes since commit be9f643ae6aa9044c60fe80e3a2c10be8371c692: Merge branch 'for-tom' of git://git.denx.de/u-boot-dm (2014-09-26 20:10:48 -0400) are available in the git repository at: git://git.denx.de/u-boot-mmc.git master for you to fetch changes up to b966db0d7259293e2c9c216c7a5dce30dacacfd9: dw_mmc: cleanups (2014-10-03 17:26:50 +0300) Hannes Petermaier (1): mmc: fix ERASE_GRP_DEF handling Mario Schuknecht (2): mvebu_mmc: Driver addition mmc: Fix mmc bus width Pavel Machek (1): dw_mmc: cleanups Peter Bigot (2): mmc: restore capacity when switching to partition 0 env_mmc: correct fini partition to match init partition Sonic Zhang (1): mmc: set correct block size value in bfin sdh driver Wally Yeh (1): cmd_mmc: fix bootpart-resize maxarg to 4 common/cmd_mmc.c| 2 +- common/env_mmc.c| 2 +- drivers/mmc/bfin_sdh.c | 7 --- drivers/mmc/dw_mmc.c| 24 +--- drivers/mmc/mmc.c | 18 +- drivers/mmc/mvebu_mmc.c | 62 +- 6 files changed, 93 insertions(+), 22 deletions(-) Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] common: Makefile: allow for spl builds with env_fat
On Fri, Oct 03, 2014 at 03:48:35PM -0500, Felipe Balbi wrote: On Thu, Sep 25, 2014 at 07:38:26PM -0500, Felipe Balbi wrote: On Tue, Sep 23, 2014 at 10:44:17AM -0500, Felipe Balbi wrote: If CONFIG_SPL_BUILD and CONFIG_ENV_IS_IN_FAT are defined, u-boot spl will fail to build. Fix that. Signed-off-by: Felipe Balbi ba...@ti.com ping ping here Looks fine, will take it for the next merge window. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] How does Driver Model UART work?
Hi Masahiro, On 4 October 2014 06:57, Masahiro YAMADA yamad...@jp.panasonic.com wrote: Hi Simon, 2014-10-03 22:51 GMT+09:00 Simon Glass s...@chromium.org: Hi Masahiro, On 3 October 2014 07:04, Masahiro Yamada yamad...@jp.panasonic.com wrote: Simon, I am totally being confused. As far as I looked at the dm code, the private data is calloc'ed in device_probe() function if (drv-priv_auto_alloc_size) { dev-priv = calloc(1, drv-priv_auto_alloc_size); if (!dev-priv) { ret = -ENOMEM; goto fail; } } So, dev-priv is storing the address of the allocated memory. Am I understanding correctly? Yes, it always does in driver model. This driver is no different. BTW the ns16550 driver is probably the oddest in U-Boot - it looks like UniPhier has its own UART driver so it would be better to convert that I think. See below for ideas on other UART drivers to look at which are much more normal. If so, I can't understand the following code: static int ns16550_serial_getc(struct udevice *dev) { struct NS16550 *const com_port = dev_get_priv(dev); if (!serial_in(com_port-lsr) UART_LSR_DR) return -EAGAIN; com_port is dev-priv, so it is pointing to the allocated area on RAM, I guess. It looks like serial_in(com_port-lsr) is trying to read from the hardware register ? Or reading from malloc area RAM ?? If you go one level deeper you will see that serial_in() is defined at the top in about 5 ways, one of which is used for driver model: #define serial_in(addr) \ ns16550_readb(com_port, addr - (unsigned char *)com_port) So it used com_port which is not an parameter. The parameter addr is only used to specify the register. This is actually the same as the non-DM code except in that case the parameter specifies the register and hardware address at the same time. Without your help, I never could have understood this code. Now it is clearer, thanks! (although this code is really unfortunate...) It felt like laparoscopic surgery - there is a nicely-healed wound but inside is another story. This is done since the internal NS16550_t type is unfortunately exported all over U-Boot. This is annoying because it is actually an internal register format for the UART. Even worse is the fact that the structure changes depending on CONFIG_SYS_NS16550_REG_SIZE. We can't have this sort of thing in driver model - we need to be able to cope with the device tree specifying all the information that the UART needs. So for driver model: Agreed. We should pass reg-shift from a device tree or a board-file. If all the board switched to the driver model, the driver code would become much clean. Yes, I'm looking forward to that day. /* * For driver model we always use one byte per register, and sort out the * differences in the driver */ #define CONFIG_SYS_NS16550_REG_SIZE (-1) (see ns16550.h header for where this is used) I would like to avoid having that type exported and use a different method to pass the UART information around. But it is used in about 30 places . So this approach allows us to move forward bit by bit, without duplicating the UART driver and creating a maintenance headache. In terns of implementing a new UART driver, are you using device tree? UniPhier SoCs have not supported the device tree control yet. I am planning to do the dm conversion with a board file. If so then you should just be able to follow along with Tegra - it's really easy - just copy that serial_tegra.c and adjust the device tree compat string and input clock. Other examples are serial_omap and serial_dw. (See u-boot-dm/working) These are unfortunate. They are borrowing ns16550 code. Tegra and many other SOCs have used this code for a while, just with some defines to make it work. I didn't want to copy it. If you are using platform data, then the examples are serial_mxc and serial_pl01x. I am doing this way. Anyway, the register map of UniPhier is not 8250-compatible. It cannot borrow ns16550 code. That's probably for the best. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 02/23] dm: sunxi: Add a new config for an FDT-based pcDuino3
For now we won't want to mess with the existing configurations. Create a new one which will enable device tree and driver model. Note that this brings the device tree binary into u-boot-sunxi-with-spl.bin. Signed-off-by: Simon Glass s...@chromium.org --- Makefile | 3 ++- arch/arm/dts/Makefile | 1 + board/sunxi/MAINTAINERS | 1 + configs/Linksprite_pcDuino3_fdt_defconfig | 8 include/configs/sun7i.h | 4 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 configs/Linksprite_pcDuino3_fdt_defconfig diff --git a/Makefile b/Makefile index 6221113..85b90b7 100644 --- a/Makefile +++ b/Makefile @@ -941,7 +941,8 @@ u-boot-nand.gph: u-boot.bin FORCE ifneq ($(CONFIG_SUNXI),) OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \ --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff -u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img FORCE +u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin \ + u-boot$(if $(CONFIG_OF_CONTROL),-dtb,).img FORCE $(call if_changed,pad_cat) endif diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 3299817..564eb76 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1,3 +1,4 @@ +dtb-$(CONFIG_SUN7I) += sun7i-a20-pcduino3.dtb dtb-$(CONFIG_S5PC100) += s5pc1xx-smdkc100.dtb dtb-$(CONFIG_S5PC110) += s5pc1xx-goni.dtb dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \ diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS index 4f32195..3dbfe15 100644 --- a/board/sunxi/MAINTAINERS +++ b/board/sunxi/MAINTAINERS @@ -21,6 +21,7 @@ F:configs/A20-OLinuXino_MICRO_defconfig F: configs/Bananapi_defconfig F: configs/i12-tvbox_defconfig F: configs/Linksprite_pcDuino3_defconfig +F: configs/Linksprite_pcDuino3_fdt_defconfig F: configs/qt840a_defconfig CUBIEBOARD2 BOARD diff --git a/configs/Linksprite_pcDuino3_fdt_defconfig b/configs/Linksprite_pcDuino3_fdt_defconfig new file mode 100644 index 000..e5f6236 --- /dev/null +++ b/configs/Linksprite_pcDuino3_fdt_defconfig @@ -0,0 +1,8 @@ +CONFIG_SPL=y +CONFIG_SYS_EXTRA_OPTIONS=PCDUINO3,AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI,DM +CONFIG_FDTFILE=sun7i-a20-pcduino3.dtb +CONFIG_DEFAULT_DEVICE_TREE=sun7i-a20-pcduino3 +CONFIG_OF_CONTROL=y +CONFIG_OF_SEPARATE=y ++S:CONFIG_ARM=y ++S:CONFIG_TARGET_SUN7I=y diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h index a902b84..500d0e3 100644 --- a/include/configs/sun7i.h +++ b/include/configs/sun7i.h @@ -36,6 +36,10 @@ #define CONFIG_ARMV7_SECURE_BASE SUNXI_SRAM_B_BASE #define CONFIG_SYS_CLK_FREQ2400 +#if !defined(CONFIG_SPL_BUILD) defined(CONFIG_DM) +# define CONFIG_CMD_DM +#endif + /* * Include common sunxi configuration where most the settings are */ -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 14/23] test: dm: Update GPIO tests for new gpio_request() method
Now that gpio_request() is handled by the uclass, updates the tests accordingly. Signed-off-by: Simon Glass s...@chromium.org --- doc/driver-model/README.txt | 25 +++-- test/dm/gpio.c | 55 +++-- 2 files changed, 56 insertions(+), 24 deletions(-) diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt index 8dfcf75..1ff454a 100644 --- a/doc/driver-model/README.txt +++ b/doc/driver-model/README.txt @@ -95,7 +95,7 @@ are provided in test/dm. To run them, try: You should see something like this: ...U-Boot banner... -Running 22 driver model tests +Running 26 driver model tests Test: dm_test_autobind Test: dm_test_autoprobe Test: dm_test_bus_children @@ -115,7 +115,8 @@ You should see something like this: Device 'd-test': seq 3 is in use by 'b-test' Device 'a-test': seq 0 is in use by 'd-test' Test: dm_test_gpio -sandbox_gpio: sb_gpio_get_value: error: offset 4 not reserved +extra-gpios: get_value: error: gpio b5 not reserved +Test: dm_test_gpio_anon Test: dm_test_leak Test: dm_test_lifecycle Test: dm_test_operations @@ -123,6 +124,26 @@ You should see something like this: Test: dm_test_platdata Test: dm_test_pre_reloc Test: dm_test_remove +Test: dm_test_spi_find +Invalid chip select 0:0 (err=-19) +SF: Failed to get idcodes +Device 'name-emul': seq 0 is in use by 'name-emul' +SF: Detected M25P16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB +Test: dm_test_spi_flash +2097152 bytes written in 0 ms +SF: Detected M25P16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB +SPI flash test: +0 erase: 0 ticks, 65536000 KiB/s 524288.000 Mbps +1 check: 0 ticks, 65536000 KiB/s 524288.000 Mbps +2 write: 0 ticks, 65536000 KiB/s 524288.000 Mbps +3 read: 0 ticks, 65536000 KiB/s 524288.000 Mbps +Test passed +0 erase: 0 ticks, 65536000 KiB/s 524288.000 Mbps +1 check: 0 ticks, 65536000 KiB/s 524288.000 Mbps +2 write: 0 ticks, 65536000 KiB/s 524288.000 Mbps +3 read: 0 ticks, 65536000 KiB/s 524288.000 Mbps +Test: dm_test_spi_xfer +SF: Detected M25P16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB Test: dm_test_uclass Test: dm_test_uclass_before_ready Failures: 0 diff --git a/test/dm/gpio.c b/test/dm/gpio.c index 2b2b0b5..ad56ca5 100644 --- a/test/dm/gpio.c +++ b/test/dm/gpio.c @@ -39,52 +39,51 @@ static int dm_test_gpio(struct dm_test_state *dms) /* Get the operations for this device */ ops = gpio_get_ops(dev); - ut_assert(ops-get_state); + ut_assert(ops-get_function); /* Cannot get a value until it is reserved */ - ut_asserteq(-1, ops-get_value(dev, offset)); - + ut_asserteq(-EBUSY, gpio_get_value(gpio + 1)); /* * Now some tests that use the 'sandbox' back door. All GPIOs * should default to input, include b4 that we are using here. */ - ut_assertok(ops-get_state(dev, offset, buf, sizeof(buf))); - ut_asserteq_str(b4: in: 0 [ ], buf); + ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf))); + ut_asserteq_str(b4: input: 0 [ ], buf); /* Change it to an output */ sandbox_gpio_set_direction(dev, offset, 1); - ut_assertok(ops-get_state(dev, offset, buf, sizeof(buf))); - ut_asserteq_str(b4: out: 0 [ ], buf); + ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf))); + ut_asserteq_str(b4: output: 0 [ ], buf); sandbox_gpio_set_value(dev, offset, 1); - ut_assertok(ops-get_state(dev, offset, buf, sizeof(buf))); - ut_asserteq_str(b4: out: 1 [ ], buf); + ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf))); + ut_asserteq_str(b4: output: 1 [ ], buf); - ut_assertok(ops-request(dev, offset, testing)); - ut_assertok(ops-get_state(dev, offset, buf, sizeof(buf))); - ut_asserteq_str(b4: out: 1 [x] testing, buf); + ut_assertok(gpio_request(gpio, testing)); + ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf))); + ut_asserteq_str(b4: output: 1 [x] testing, buf); /* Change the value a bit */ ut_asserteq(1, ops-get_value(dev, offset)); ut_assertok(ops-set_value(dev, offset, 0)); ut_asserteq(0, ops-get_value(dev, offset)); - ut_assertok(ops-get_state(dev, offset, buf, sizeof(buf))); - ut_asserteq_str(b4: out: 0 [x] testing, buf); + ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf))); + ut_asserteq_str(b4: output: 0 [x] testing, buf); ut_assertok(ops-set_value(dev, offset, 1)); ut_asserteq(1, ops-get_value(dev, offset)); /* Make it an input */ ut_assertok(ops-direction_input(dev, offset)); - ut_assertok(ops-get_state(dev, offset, buf, sizeof(buf))); - ut_asserteq_str(b4: in: 1 [x] testing, buf); +
[U-Boot] [PATCH 0/23] dm: Introduce driver model for sunxi
This series adds driver model support for serial and GPIO for sunxi. Since I only have a sun7i board to test with, I have added a new config for the pcDuino3, which uses device tree and driver model. This should make it fairly easy to enable for the other boards at some point. Now that we have about 5 GPIO drivers it is clear that the request()/free() logic should be in the uclass rather than the driver. So far drivers don't have to do anything in those methods except adjust pin configuration. Patches are included to make this change, including removing the redundant code in the various GPIO drivers. The sunxi driver works the same way. So far at least GPIO drivers don't tend to have anything special to report for the 'gpio status' command. Partly this is because we only support a simple concept of GPIOs so far (no drive strength, function selection, etc.) but even if this were to be supported it would be better to handle it generically where possible. So the get_state() call can be replaced with a generic one in the uclass. This can be implemented with the existing uclass interface: get_function() to find out if the pin is set as an input, output or not a GPIO, and get_value() to find its value. As a result, it is safe to remove the get_state() method, and this series does that also. This series is available at u-boot-dm/sunix-working. Simon Glass (23): dm: sunxi: dts: Add sun7i device tree files dm: sunxi: Add a new config for an FDT-based pcDuino3 dm: core: Add support for simple-bus dm: sunxi: Add pinmux functions which take a bank parameter dm: sunxi: Make sure that GPIOs are requested dm: sunxi: Modify the GPIO driver to support driver model dm: sunxi: Add support for serial using driver model dm: gpio: Implement GPIO reservation in the uclass dm: gpio: Add gpio_get_function() and friends dm: Move the function for getting GPIO status into the uclass dm: gpio: sandbox: Implement the get_function() method dm: gpio: sandbox: Implement the remove() method dm: gpio: sandbox: Drop request()/free() in the driver test: dm: Update GPIO tests for new gpio_request() method dm: gpio: Add gpio_requestf() helper for printf() strings test: dm: Support memory leak checking as a core feature test: dm: Add additional GPIO tests dm: gpio: tegra: Drop request()/free() in the driver dm: gpio: omap3: Drop request()/free() in the driver dm: gpio: rpi_b: Drop request()/free() in the driver dm: gpio: exynos: Drop request()/free() in the driver dm: gpio: imx: Drop request()/free() in the driver dm: gpio: Remove unused get_state() uclass method Makefile | 3 +- arch/arm/cpu/armv7/sunxi/pinmux.c | 32 +- arch/arm/dts/Makefile | 1 + arch/arm/dts/sun7i-a20-pcduino3.dts | 177 ++ arch/arm/dts/sun7i-a20.dtsi | 988 ++ arch/arm/dts/sunxi-common-regulators.dtsi | 89 +++ arch/arm/include/asm/arch-sunxi/gpio.h| 4 +- board/sunxi/MAINTAINERS | 1 + board/sunxi/ahci.c| 1 + common/cmd_gpio.c | 57 +- configs/Linksprite_pcDuino3_fdt_defconfig | 8 + doc/driver-model/README.txt | 29 +- drivers/core/Makefile | 1 + drivers/core/simple-bus.c | 33 + drivers/gpio/bcm2835_gpio.c | 89 --- drivers/gpio/gpio-uclass.c| 199 +- drivers/gpio/mxc_gpio.c | 116 drivers/gpio/omap_gpio.c | 116 +--- drivers/gpio/s5p_gpio.c | 101 --- drivers/gpio/sandbox.c| 93 +-- drivers/gpio/sunxi_gpio.c | 170 + drivers/gpio/tegra_gpio.c | 110 drivers/serial/Makefile | 1 + drivers/serial/serial_dw.c| 39 ++ include/asm-generic/gpio.h| 70 ++- include/configs/sun7i.h | 8 + include/configs/sunxi-common.h| 12 +- include/dm/test.h | 23 + include/dm/uclass-id.h| 1 + include/dt-bindings/input/input.h | 525 test/dm/core.c| 46 +- test/dm/gpio.c| 111 +++- test/dm/test-main.c | 2 + 33 files changed, 2534 insertions(+), 722 deletions(-) create mode 100644 arch/arm/dts/sun7i-a20-pcduino3.dts create mode 100644 arch/arm/dts/sun7i-a20.dtsi create mode 100644 arch/arm/dts/sunxi-common-regulators.dtsi create mode 100644 configs/Linksprite_pcDuino3_fdt_defconfig create mode 100644 drivers/core/simple-bus.c create mode 100644 drivers/serial/serial_dw.c create mode 100644 include/dt-bindings/input/input.h -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 16/23] test: dm: Support memory leak checking as a core feature
Check the state of the malloc() heap before each test is run, so that tests can verify that all is well at the end. Provide helper functions to mark the heap and to check that it returns to its initial state. Signed-off-by: Simon Glass s...@chromium.org --- include/dm/test.h | 23 +++ test/dm/core.c | 46 ++ test/dm/test-main.c | 2 ++ 3 files changed, 55 insertions(+), 16 deletions(-) diff --git a/include/dm/test.h b/include/dm/test.h index 235d728..f08c05d 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -8,6 +8,7 @@ #define __DM_TEST_H #include dm.h +#include malloc.h /** * struct dm_test_cdata - configuration data for test instance @@ -120,6 +121,7 @@ struct dm_test_state { int force_fail_alloc; int skip_post_probe; struct udevice *removed; + struct mallinfo start; }; /* Test flags for each test */ @@ -178,6 +180,27 @@ int dm_check_operations(struct dm_test_state *dms, struct udevice *dev, int dm_check_devices(struct dm_test_state *dms, int num_devices); /** + * dm_leak_check_start() - Prepare to check for a memory leak + * + * Call this before allocating memory to record the amount of memory being + * used. + * + * @dms: Overall test state + */ +void dm_leak_check_start(struct dm_test_state *dms); + +/** + * dm_leak_check_end() - Check that no memory has leaked + * + * Call this after dm_leak_check_start() and after you have hopefuilly freed + * all the memory that was allocated. This function will print an error if + * it sees a different amount of total memory allocated than before. + * + * @dms: Overall test state + */int dm_leak_check_end(struct dm_test_state *dms); + + +/** * dm_test_main() - Run all the tests * * This runs all available driver model tests diff --git a/test/dm/core.c b/test/dm/core.c index b0cfb42..ff5c2a7 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -67,6 +67,34 @@ static struct driver_info driver_info_pre_reloc = { .platdata = test_pdata_manual, }; +void dm_leak_check_start(struct dm_test_state *dms) +{ + dms-start = mallinfo(); + if (!dms-start.uordblks) + puts(Warning: Please add '#define DEBUG' to the top of common/dlmalloc.c\n); +} + +int dm_leak_check_end(struct dm_test_state *dms) +{ + struct mallinfo end; + int id; + + /* Don't delete the root class, since we started with that */ + for (id = UCLASS_ROOT + 1; id UCLASS_COUNT; id++) { + struct uclass *uc; + + uc = uclass_find(id); + if (!uc) + continue; + ut_assertok(uclass_destroy(uc)); + } + + end = mallinfo(); + ut_asserteq(dms-start.uordblks, end.uordblks); + + return 0; +} + /* Test that binding with platdata occurs correctly */ static int dm_test_autobind(struct dm_test_state *dms) { @@ -377,14 +405,11 @@ static int dm_test_leak(struct dm_test_state *dms) int i; for (i = 0; i 2; i++) { - struct mallinfo start, end; struct udevice *dev; int ret; int id; - start = mallinfo(); - if (!start.uordblks) - puts(Warning: Please add '#define DEBUG' to the top of common/dlmalloc.c\n); + dm_leak_check_start(dms); ut_assertok(dm_scan_platdata(false)); ut_assertok(dm_scan_fdt(gd-fdt_blob, false)); @@ -398,18 +423,7 @@ static int dm_test_leak(struct dm_test_state *dms) ut_assertok(ret); } - /* Don't delete the root class, since we started with that */ - for (id = UCLASS_ROOT + 1; id UCLASS_COUNT; id++) { - struct uclass *uc; - - uc = uclass_find(id); - if (!uc) - continue; - ut_assertok(uclass_destroy(uc)); - } - - end = mallinfo(); - ut_asserteq(start.uordblks, end.uordblks); + ut_assertok(dm_leak_check_end(dms)); } return 0; diff --git a/test/dm/test-main.c b/test/dm/test-main.c index 94ce72a..90ca810 100644 --- a/test/dm/test-main.c +++ b/test/dm/test-main.c @@ -7,6 +7,7 @@ #include common.h #include dm.h #include errno.h +#include malloc.h #include dm/test.h #include dm/root.h #include dm/uclass-internal.h @@ -88,6 +89,7 @@ int dm_test_main(void) printf(Test: %s\n, test-name); ut_assertok(dm_test_init(dms)); + dms-start = mallinfo(); if (test-flags DM_TESTF_SCAN_PDATA) ut_assertok(dm_scan_platdata(false)); if (test-flags DM_TESTF_PROBE_TEST) -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de
[U-Boot] [PATCH 04/23] dm: sunxi: Add pinmux functions which take a bank parameter
With driver model we will have access to a bank pointer, so we want to use it rather than converting back to a number, and then back to a bank pointer. Add functions to provide this feature. Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/cpu/armv7/sunxi/pinmux.c | 32 +--- arch/arm/include/asm/arch-sunxi/gpio.h | 4 +++- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/arch/arm/cpu/armv7/sunxi/pinmux.c b/arch/arm/cpu/armv7/sunxi/pinmux.c index 1f2843f..b026f78 100644 --- a/arch/arm/cpu/armv7/sunxi/pinmux.c +++ b/arch/arm/cpu/armv7/sunxi/pinmux.c @@ -10,32 +10,42 @@ #include asm/io.h #include asm/arch/gpio.h -int sunxi_gpio_set_cfgpin(u32 pin, u32 val) +void sunxi_gpio_set_cfgbank(struct sunxi_gpio *pio, int bank_offset, u32 val) { - u32 bank = GPIO_BANK(pin); - u32 index = GPIO_CFG_INDEX(pin); - u32 offset = GPIO_CFG_OFFSET(pin); - struct sunxi_gpio *pio = BANK_TO_GPIO(bank); + u32 index = GPIO_CFG_INDEX(bank_offset); + u32 offset = GPIO_CFG_OFFSET(bank_offset); clrsetbits_le32(pio-cfg[0] + index, 0xf offset, val offset); - - return 0; } -int sunxi_gpio_get_cfgpin(u32 pin) +void sunxi_gpio_set_cfgpin(u32 pin, u32 val) { - u32 cfg; u32 bank = GPIO_BANK(pin); - u32 index = GPIO_CFG_INDEX(pin); - u32 offset = GPIO_CFG_OFFSET(pin); struct sunxi_gpio *pio = BANK_TO_GPIO(bank); + sunxi_gpio_set_cfgbank(pio, pin, val); +} + +int sunxi_gpio_get_cfgbank(struct sunxi_gpio *pio, int bank_offset) +{ + u32 index = GPIO_CFG_INDEX(bank_offset); + u32 offset = GPIO_CFG_OFFSET(bank_offset); + u32 cfg; + cfg = readl(pio-cfg[0] + index); cfg = offset; return cfg 0xf; } +int sunxi_gpio_get_cfgpin(u32 pin) +{ + u32 bank = GPIO_BANK(pin); + struct sunxi_gpio *pio = BANK_TO_GPIO(bank); + + return sunxi_gpio_get_cfgbank(pio, pin); +} + int sunxi_gpio_set_drv(u32 pin, u32 val) { u32 bank = GPIO_BANK(pin); diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h index f7f3d8c..f72e2fd 100644 --- a/arch/arm/include/asm/arch-sunxi/gpio.h +++ b/arch/arm/include/asm/arch-sunxi/gpio.h @@ -139,7 +139,9 @@ enum sunxi_gpio_number { #define SUNXI_GPIO_PULL_UP 1 #define SUNXI_GPIO_PULL_DOWN 2 -int sunxi_gpio_set_cfgpin(u32 pin, u32 val); +void sunxi_gpio_set_cfgbank(struct sunxi_gpio *pio, int bank_offset, u32 val); +void sunxi_gpio_set_cfgpin(u32 pin, u32 val); +int sunxi_gpio_get_cfgbank(struct sunxi_gpio *pio, int bank_offset); int sunxi_gpio_get_cfgpin(u32 pin); int sunxi_gpio_set_drv(u32 pin, u32 val); int sunxi_gpio_set_pull(u32 pin, u32 val); -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 09/23] dm: gpio: Add gpio_get_function() and friends
Add helpers to the uclass to allow finding out the pin function. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/gpio-uclass.c | 47 ++ include/asm-generic/gpio.h | 34 - 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index e11c5a6..04b7b16 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -283,6 +283,53 @@ const char *gpio_get_bank_info(struct udevice *dev, int *bit_count) return priv-bank_name; } +static const char * const gpio_function[GPIOF_COUNT] = { + input, + output, + unused, + unknown, + func, +}; + +int get_function(struct udevice *dev, int offset, bool skip_unused, +const char **namep) +{ + struct gpio_dev_priv *uc_priv = dev-uclass_priv; + struct dm_gpio_ops *ops = gpio_get_ops(dev); + + BUILD_BUG_ON(GPIOF_COUNT != ARRAY_SIZE(gpio_function)); + if (!device_active(dev)) + return -ENODEV; + if (offset 0 || offset = uc_priv-gpio_count) + return -EINVAL; + if (namep) + *namep = uc_priv-name[offset]; + if (skip_unused !uc_priv-name[offset]) + return GPIOF_UNUSED; + if (ops-get_function) { + int ret; + + ret = ops-get_function(dev, offset); + if (ret 0) + return ret; + if (ret = ARRAY_SIZE(gpio_function)) + return -ENODATA; + return ret; + } + + return GPIOF_UNKNOWN; +} + +int gpio_get_function(struct udevice *dev, int offset, const char **namep) +{ + return get_function(dev, offset, true, namep); +} + +int gpio_get_raw_function(struct udevice *dev, int offset, const char **namep) +{ + return get_function(dev, offset, false, namep); +} + /* We need to renumber the GPIOs when any driver is probed/removed */ static int gpio_renumber(struct udevice *removed_dev) { diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index cdacc75..86b9747 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -83,7 +83,7 @@ int gpio_get_value(unsigned gpio); int gpio_set_value(unsigned gpio, int value); /* State of a GPIO, as reported by get_function() */ -enum { +enum gpio_func_t { GPIOF_INPUT = 0, GPIOF_OUTPUT, GPIOF_UNUSED, /* Not claimed */ @@ -96,6 +96,38 @@ enum { struct udevice; /** + * gpio_get_function() - get the current function for a GPIO pin + * + * Note this returns GPIOF_UNUSED if the GPIO is not requested. + * + * @dev: Device to check + * @offset:Offset of device GPIO to check + * @namep: If non-NULL, this is set to the nane given when the GPIO + * was requested, or -1 if it has not been requested + * @return -ENODATA if the driver returned an unknown function, + * -ENODEV if the device is not active, -EINVAL if the offset is invalid. + * GPIOF_UNUSED if the GPIO has not been requested. Otherwise returns the + * function from enum gpio_func_t. + */ +int gpio_get_function(struct udevice *dev, int offset, const char **namep); + +/** + * gpio_get_raw_function() - get the current raw function for a GPIO pin + * + * Note this does not return GPIOF_UNUSED - it will always return the GPIO + * driver's view of a pin function, even if it is not correctly set up. + * + * @dev: Device to check + * @offset:Offset of device GPIO to check + * @namep: If non-NULL, this is set to the nane given when the GPIO + * was requested, or -1 if it has not been requested + * @return -ENODATA if the driver returned an unknown function, + * -ENODEV if the device is not active, -EINVAL if the offset is invalid. + * Otherwise returns the function from enum gpio_func_t. + */ +int gpio_get_raw_function(struct udevice *dev, int offset, const char **namep); + +/** * struct struct dm_gpio_ops - Driver model GPIO operations * * Refer to functions above for description. These function largely copy -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 07/23] dm: sunxi: Add support for serial using driver model
Add a driver for the designware serial UART used on sunxi. This just redirects to the normal ns16550 driver. Add a stdout-path to the device tree so that the correct UART is chosen. Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/dts/sun7i-a20-pcduino3.dts | 4 drivers/serial/Makefile | 1 + drivers/serial/serial_dw.c | 39 + include/configs/sun7i.h | 3 +++ include/configs/sunxi-common.h | 12 +++- 5 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 drivers/serial/serial_dw.c diff --git a/arch/arm/dts/sun7i-a20-pcduino3.dts b/arch/arm/dts/sun7i-a20-pcduino3.dts index 046dfc0..f7cc8e7 100644 --- a/arch/arm/dts/sun7i-a20-pcduino3.dts +++ b/arch/arm/dts/sun7i-a20-pcduino3.dts @@ -20,6 +20,10 @@ model = LinkSprite pcDuino3; compatible = linksprite,pcduino3, allwinner,sun7i-a20; + chosen { + stdout-path = uart0; + }; + soc@01c0 { mmc0: mmc@01c0f000 { pinctrl-names = default; diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index edf6936..f57a664 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_ALTERA_UART) += altera_uart.o obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o obj-$(CONFIG_ARM_DCC) += arm_dcc.o obj-$(CONFIG_ATMEL_USART) += atmel_usart.o +obj-$(CONFIG_DW_SERIAL) += serial_dw.o obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o obj-$(CONFIG_MCFUART) += mcfuart.o obj-$(CONFIG_OPENCORES_YANU) += opencores_yanu.o diff --git a/drivers/serial/serial_dw.c b/drivers/serial/serial_dw.c new file mode 100644 index 000..a348f29 --- /dev/null +++ b/drivers/serial/serial_dw.c @@ -0,0 +1,39 @@ +/* + * 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 dw_serial_ids[] = { + { .compatible = snps,dw-apb-uart }, + { } +}; + +static int dw_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 = CONFIG_SYS_NS16550_CLK; + + return 0; +} + +U_BOOT_DRIVER(serial_ns16550) = { + .name = serial_dw, + .id = UCLASS_SERIAL, + .of_match = dw_serial_ids, + .ofdata_to_platdata = dw_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, +}; diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h index 2314e97..108694a 100644 --- a/include/configs/sun7i.h +++ b/include/configs/sun7i.h @@ -39,6 +39,9 @@ #if !defined(CONFIG_SPL_BUILD) defined(CONFIG_DM) # define CONFIG_CMD_DM # define CONFIG_DM_GPIO +# define CONFIG_DM_SERIAL +# define CONFIG_SYS_MALLOC_F_LEN (1 10) +# define CONFIG_DW_SERIAL #endif /* diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 1d947d7..e26bdf9 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -36,12 +36,14 @@ #define CONFIG_SYS_NS16550 #define CONFIG_SYS_NS16550_SERIAL /* ns16550 reg in the low bits of cpu reg */ -#define CONFIG_SYS_NS16550_REG_SIZE-4 #define CONFIG_SYS_NS16550_CLK 2400 -#define CONFIG_SYS_NS16550_COM1SUNXI_UART0_BASE -#define CONFIG_SYS_NS16550_COM2SUNXI_UART1_BASE -#define CONFIG_SYS_NS16550_COM3SUNXI_UART2_BASE -#define CONFIG_SYS_NS16550_COM4SUNXI_UART3_BASE +#ifndef CONFIG_DM_SERIAL +# define CONFIG_SYS_NS16550_REG_SIZE -4 +# define CONFIG_SYS_NS16550_COM1 SUNXI_UART0_BASE +# define CONFIG_SYS_NS16550_COM2 SUNXI_UART1_BASE +# define CONFIG_SYS_NS16550_COM3 SUNXI_UART2_BASE +# define CONFIG_SYS_NS16550_COM4 SUNXI_UART3_BASE +#endif /* DRAM Base */ #define CONFIG_SYS_SDRAM_BASE 0x4000 -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 01/23] dm: sunxi: dts: Add sun7i device tree files
These are from Linux 3.17-rc7 (commit fe82dcec). U-Boot only uses a small portion of these, but we may as well have something to look forward to. The total compiled size is about 25KB. Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/dts/sun7i-a20-pcduino3.dts | 173 ++ arch/arm/dts/sun7i-a20.dtsi | 988 ++ arch/arm/dts/sunxi-common-regulators.dtsi | 89 +++ include/dt-bindings/input/input.h | 525 4 files changed, 1775 insertions(+) create mode 100644 arch/arm/dts/sun7i-a20-pcduino3.dts create mode 100644 arch/arm/dts/sun7i-a20.dtsi create mode 100644 arch/arm/dts/sunxi-common-regulators.dtsi create mode 100644 include/dt-bindings/input/input.h diff --git a/arch/arm/dts/sun7i-a20-pcduino3.dts b/arch/arm/dts/sun7i-a20-pcduino3.dts new file mode 100644 index 000..046dfc0 --- /dev/null +++ b/arch/arm/dts/sun7i-a20-pcduino3.dts @@ -0,0 +1,173 @@ +/* + * Copyright 2014 Zoltan HERPAI + * Zoltan HERPAI wigy...@uid0.hu + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +/dts-v1/; +/include/ sun7i-a20.dtsi +/include/ sunxi-common-regulators.dtsi +#include dt-bindings/gpio/gpio.h +#include dt-bindings/input/input.h + +/ { + model = LinkSprite pcDuino3; + compatible = linksprite,pcduino3, allwinner,sun7i-a20; + + soc@01c0 { + mmc0: mmc@01c0f000 { + pinctrl-names = default; + pinctrl-0 = mmc0_pins_a, mmc0_cd_pin_reference_design; + vmmc-supply = reg_vcc3v3; + bus-width = 4; + cd-gpios = pio 7 1 0; /* PH1 */ + cd-inverted; + status = okay; + }; + + usbphy: phy@01c13400 { + usb1_vbus-supply = reg_usb1_vbus; + usb2_vbus-supply = reg_usb2_vbus; + status = okay; + }; + + ehci0: usb@01c14000 { + status = okay; + }; + + ohci0: usb@01c14400 { + status = okay; + }; + + ahci: sata@01c18000 { + target-supply = reg_ahci_5v; + status = okay; + }; + + ehci1: usb@01c1c000 { + status = okay; + }; + + ohci1: usb@01c1c400 { + status = okay; + }; + + pinctrl@01c20800 { + ahci_pwr_pin_a: ahci_pwr_pin@0 { + allwinner,pins = PH2; + }; + + led_pins_pcduino3: led_pins@0 { + allwinner,pins = PH15, PH16; + allwinner,function = gpio_out; + allwinner,drive = 0; + allwinner,pull = 0; + }; + + key_pins_pcduino3: key_pins@0 { + allwinner,pins = PH17, PH18, PH19; + allwinner,function = gpio_in; + allwinner,drive = 0; + allwinner,pull = 0; + }; + }; + + ir0: ir@01c21800 { + pinctrl-names = default; + pinctrl-0 = ir0_pins_a; + status = okay; + }; + + uart0: serial@01c28000 { + pinctrl-names = default; + pinctrl-0 = uart0_pins_a; + status = okay; + }; + + i2c0: i2c@01c2ac00 { + pinctrl-names = default; + pinctrl-0 = i2c0_pins_a; + status = okay; + + axp209: pmic@34 { + compatible = x-powers,axp209; + reg = 0x34; + interrupt-parent = nmi_intc; + interrupts = 0 8; + + interrupt-controller; + #interrupt-cells = 1; + }; + }; + + gmac: ethernet@01c5 { + pinctrl-names = default; + pinctrl-0 = gmac_pins_mii_a; + phy = phy1; + phy-mode = mii; + status = okay; + + phy1: ethernet-phy@1 { + reg = 1; + }; + }; + }; + +
[U-Boot] [PATCH 12/23] dm: gpio: sandbox: Implement the remove() method
This method frees memory so we must make sure to implement it. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/sandbox.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c index 7aa8b1f..13b3253 100644 --- a/drivers/gpio/sandbox.c +++ b/drivers/gpio/sandbox.c @@ -246,6 +246,13 @@ static int gpio_sandbox_probe(struct udevice *dev) return 0; } +static int gpio_sandbox_remove(struct udevice *dev) +{ + free(dev-priv); + + return 0; +} + static const struct udevice_id sandbox_gpio_ids[] = { { .compatible = sandbox,gpio }, { } @@ -257,5 +264,6 @@ U_BOOT_DRIVER(gpio_sandbox) = { .of_match = sandbox_gpio_ids, .ofdata_to_platdata = sandbox_gpio_ofdata_to_platdata, .probe = gpio_sandbox_probe, + .remove = gpio_sandbox_remove, .ops= gpio_sandbox_ops, }; -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 06/23] dm: sunxi: Modify the GPIO driver to support driver model
This adds driver model support to the sunxi GPIO driver, using the device tree to trigger binding of the driver. The driver will still operate without driver model too. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/sunxi_gpio.c | 170 ++ include/configs/sun7i.h | 1 + 2 files changed, 171 insertions(+) diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c index 0c50a8f..f633c04 100644 --- a/drivers/gpio/sunxi_gpio.c +++ b/drivers/gpio/sunxi_gpio.c @@ -11,9 +11,25 @@ */ #include common.h +#include dm.h +#include errno.h +#include fdtdec.h +#include malloc.h #include asm/io.h #include asm/gpio.h +#include dm/device-internal.h +DECLARE_GLOBAL_DATA_PTR; + +#define SUNXI_GPIOS_PER_PORT SUNXI_GPIO_A_NR + +struct sunxi_gpio_platdata { + struct sunxi_gpio *regs; + const char *bank_name; /* Name of port, e.g. B */ + int gpio_count; +}; + +#ifndef CONFIG_DM_GPIO static int sunxi_gpio_output(u32 pin, u32 val) { u32 dat; @@ -100,3 +116,157 @@ int sunxi_name_to_gpio(const char *name) return -1; return group * 32 + pin; } +#endif + +#ifdef CONFIG_DM_GPIO +static int sunxi_gpio_direction_input(struct udevice *dev, unsigned offset) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + + sunxi_gpio_set_cfgbank(plat-regs, offset, SUNXI_GPIO_INPUT); + + return 0; +} + +static int sunxi_gpio_direction_output(struct udevice *dev, unsigned offset, + int value) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + u32 num = GPIO_NUM(offset); + + sunxi_gpio_set_cfgbank(plat-regs, offset, SUNXI_GPIO_OUTPUT); + clrsetbits_le32(plat-regs-dat, 1 num, value ? (1 num) : 0); + + return 0; +} + +static int sunxi_gpio_get_value(struct udevice *dev, unsigned offset) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + u32 num = GPIO_NUM(offset); + unsigned dat; + + dat = readl(plat-regs-dat); + dat = num; + + return dat 0x1; +} + +static int sunxi_gpio_set_value(struct udevice *dev, unsigned offset, + int value) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + u32 num = GPIO_NUM(offset); + + clrsetbits_le32(plat-regs-dat, 1 num, value ? (1 num) : 0); + return 0; +} + +static int sunxi_gpio_get_function(struct udevice *dev, unsigned offset) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + int func; + + func = sunxi_gpio_get_cfgbank(plat-regs, offset); + if (func == SUNXI_GPIO_OUTPUT) + return GPIOF_OUTPUT; + else if (func == SUNXI_GPIO_INPUT) + return GPIOF_INPUT; + else + return GPIOF_FUNC; +} + +static const struct dm_gpio_ops gpio_sunxi_ops = { + .direction_input= sunxi_gpio_direction_input, + .direction_output = sunxi_gpio_direction_output, + .get_value = sunxi_gpio_get_value, + .set_value = sunxi_gpio_set_value, + .get_function = sunxi_gpio_get_function, +}; + +/** + * Returns the name of a GPIO bank + * + * GPIO banks are named A, B, C, ... + * + * @bank: Bank number (0, 1..n-1) + * @return allocated string containing the name + */ +static char *gpio_bank_name(int bank) +{ + char *name; + + name = malloc(2); + if (name) { + name[0] = 'A' + bank; + name[1] = '\0'; + } + + return name; +} + +static int gpio_sunxi_probe(struct udevice *dev) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + struct gpio_dev_priv *uc_priv = dev-uclass_priv; + + /* Tell the uclass how many GPIOs we have */ + if (plat) { + uc_priv-gpio_count = plat-gpio_count; + uc_priv-bank_name = plat-bank_name; + } + + return 0; +} +/** + * We have a top-level GPIO device with no actual GPIOs. It has a child + * device for each Tegra port. + */ +static int gpio_sunxi_bind(struct udevice *parent) +{ + struct sunxi_gpio_platdata *plat = parent-platdata; + struct sunxi_gpio_reg *ctlr; + int bank; + int ret; + + /* If this is a child device, there is nothing to do here */ + if (plat) + return 0; + + ctlr = (struct sunxi_gpio_reg *)fdtdec_get_addr(gd-fdt_blob, + parent-of_offset, reg); + for (bank = 0; bank SUNXI_GPIO_BANKS; bank++) { + struct sunxi_gpio_platdata *plat; + struct udevice *dev; + + plat = calloc(1, sizeof(*plat)); + if (!plat) + return -ENOMEM; + plat-regs = ctlr-gpio_bank[bank]; + plat-bank_name = gpio_bank_name(bank); + plat-gpio_count =
[U-Boot] [PATCH 15/23] dm: gpio: Add gpio_requestf() helper for printf() strings
Add a helper which permits a printf()-style format string for the requester string. Signed-off-by: Simon Glass s...@chromium.org --- doc/driver-model/README.txt | 3 ++- drivers/gpio/gpio-uclass.c | 21 + include/asm-generic/gpio.h | 10 ++ test/dm/gpio.c | 18 ++ 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt index 1ff454a..f4395c1 100644 --- a/doc/driver-model/README.txt +++ b/doc/driver-model/README.txt @@ -95,7 +95,7 @@ are provided in test/dm. To run them, try: You should see something like this: ...U-Boot banner... -Running 26 driver model tests +Running 27 driver model tests Test: dm_test_autobind Test: dm_test_autoprobe Test: dm_test_bus_children @@ -117,6 +117,7 @@ You should see something like this: Test: dm_test_gpio extra-gpios: get_value: error: gpio b5 not reserved Test: dm_test_gpio_anon +Test: dm_test_gpio_requestf Test: dm_test_leak Test: dm_test_lifecycle Test: dm_test_operations diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 6367093..45e9a5a 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -131,6 +131,27 @@ int gpio_request(unsigned gpio, const char *label) } /** + * gpio_requestf() - [COMPAT] Request GPIO + * @gpio: GPIO number + * @fmt: Format string for the requested GPIO + * @...: Arguments for the printf() format string + * + * This function implements the API that's compatible with current + * GPIO API used in U-Boot. The request is forwarded to particular + * GPIO driver. Returns 0 on success, negative value on error. + */ +int gpio_requestf(unsigned gpio, const char *fmt, ...) +{ + va_list args; + char buf[40]; + + va_start(args, fmt); + vscnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + return gpio_request(gpio, buf); +} + +/** * gpio_free() - [COMPAT] Relinquish GPIO * gpio: GPIO number * diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 5c9bd5f..2a32c93 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -146,6 +146,16 @@ int gpio_get_function(struct udevice *dev, int offset, const char **namep); int gpio_get_raw_function(struct udevice *dev, int offset, const char **namep); /** + * gpio_requestf() - request a GPIO using a format string for the owner + * + * This is a helper function for gpio_request(). It allows you to provide + * a printf()-format string for the GPIO owner. It calls gpio_request() with + * the string that is created + */ +int gpio_requestf(unsigned gpio, const char *fmt, ...) + __attribute__ ((format (__printf__, 2, 3))); + +/** * struct struct dm_gpio_ops - Driver model GPIO operations * * Refer to functions above for description. These function largely copy diff --git a/test/dm/gpio.c b/test/dm/gpio.c index ad56ca5..5174ced 100644 --- a/test/dm/gpio.c +++ b/test/dm/gpio.c @@ -120,3 +120,21 @@ static int dm_test_gpio_anon(struct dm_test_state *dms) return 0; } DM_TEST(dm_test_gpio_anon, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Test that gpio_requestf() works as expected */ +static int dm_test_gpio_requestf(struct dm_test_state *dms) +{ + unsigned int offset, gpio; + struct udevice *dev; + char buf[80]; + + ut_assertok(gpio_lookup_name(b5, dev, offset, gpio)); + ut_assertok(gpio_requestf(gpio, testing %d %s, 1, hi)); + sandbox_gpio_set_direction(dev, offset, 1); + sandbox_gpio_set_value(dev, offset, 1); + ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf))); + ut_asserteq_str(b5: output: 1 [x] testing 1 hi, buf); + + return 0; +} +DM_TEST(dm_test_gpio_requestf, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 17/23] test: dm: Add additional GPIO tests
Add tests for gpio_requestf() and for memory leaks. Signed-off-by: Simon Glass s...@chromium.org --- doc/driver-model/README.txt | 5 - test/dm/gpio.c | 38 ++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt index f4395c1..0278dda 100644 --- a/doc/driver-model/README.txt +++ b/doc/driver-model/README.txt @@ -95,7 +95,7 @@ are provided in test/dm. To run them, try: You should see something like this: ...U-Boot banner... -Running 27 driver model tests +Running 29 driver model tests Test: dm_test_autobind Test: dm_test_autoprobe Test: dm_test_bus_children @@ -117,6 +117,9 @@ You should see something like this: Test: dm_test_gpio extra-gpios: get_value: error: gpio b5 not reserved Test: dm_test_gpio_anon +Test: dm_test_gpio_copy +Test: dm_test_gpio_leak +extra-gpios: get_value: error: gpio b5 not reserved Test: dm_test_gpio_requestf Test: dm_test_leak Test: dm_test_lifecycle diff --git a/test/dm/gpio.c b/test/dm/gpio.c index 5174ced..94bd0d9 100644 --- a/test/dm/gpio.c +++ b/test/dm/gpio.c @@ -7,11 +7,14 @@ #include common.h #include fdtdec.h #include dm.h +#include dm/root.h #include dm/ut.h #include dm/test.h #include dm/util.h #include asm/gpio.h +DECLARE_GLOBAL_DATA_PTR; + /* Test that sandbox GPIOs work correctly */ static int dm_test_gpio(struct dm_test_state *dms) { @@ -138,3 +141,38 @@ static int dm_test_gpio_requestf(struct dm_test_state *dms) return 0; } DM_TEST(dm_test_gpio_requestf, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Test that gpio_request() copies its string */ +static int dm_test_gpio_copy(struct dm_test_state *dms) +{ + unsigned int offset, gpio; + struct udevice *dev; + char buf[80], name[10]; + + ut_assertok(gpio_lookup_name(b6, dev, offset, gpio)); + strcpy(name, odd_name); + ut_assertok(gpio_request(gpio, name)); + sandbox_gpio_set_direction(dev, offset, 1); + sandbox_gpio_set_value(dev, offset, 1); + ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf))); + ut_asserteq_str(b6: output: 1 [x] odd_name, buf); + strcpy(name, nothing); + ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf))); + ut_asserteq_str(b6: output: 1 [x] odd_name, buf); + + return 0; +} +DM_TEST(dm_test_gpio_copy, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Test that we don't leak memory with GPIOs */ +static int dm_test_gpio_leak(struct dm_test_state *dms) +{ + ut_assertok(dm_test_gpio(dms)); + ut_assertok(dm_test_gpio_anon(dms)); + ut_assertok(dm_test_gpio_requestf(dms)); + ut_assertok(dm_leak_check_end(dms)); + + return 0; +} + +DM_TEST(dm_test_gpio_leak, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 18/23] dm: gpio: tegra: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/tegra_gpio.c | 110 -- 1 file changed, 110 deletions(-) diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c index 1cc4abb..88f7ef5 100644 --- a/drivers/gpio/tegra_gpio.c +++ b/drivers/gpio/tegra_gpio.c @@ -39,7 +39,6 @@ struct tegra_gpio_platdata { /* Information about each port at run-time */ struct tegra_port_info { - char label[TEGRA_GPIOS_PER_PORT][GPIO_NAME_SIZE]; struct gpio_ctlr_bank *bank; int base_gpio; /* Port number for this port (0, 1,.., n-1) */ }; @@ -132,21 +131,6 @@ static void set_level(unsigned gpio, int high) writel(u, bank-gpio_out[GPIO_PORT(gpio)]); } -static int check_reserved(struct udevice *dev, unsigned offset, - const char *func) -{ - struct tegra_port_info *state = dev_get_priv(dev); - struct gpio_dev_priv *uc_priv = dev-uclass_priv; - - if (!*state-label[offset]) { - printf(tegra_gpio: %s: error: gpio %s%d not reserved\n, - func, uc_priv-bank_name, offset); - return -EBUSY; - } - - return 0; -} - /* set GPIO pin 'gpio' as an output, with polarity 'value' */ int tegra_spl_gpio_direction_output(int gpio, int value) { @@ -171,56 +155,16 @@ static int tegra_gpio_request(struct udevice *dev, unsigned offset, { struct tegra_port_info *state = dev_get_priv(dev); - if (*state-label[offset]) - return -EBUSY; - - strncpy(state-label[offset], label, GPIO_NAME_SIZE); - state-label[offset][GPIO_NAME_SIZE - 1] = '\0'; - /* Configure as a GPIO */ set_config(state-base_gpio + offset, 1); return 0; } -static int tegra_gpio_free(struct udevice *dev, unsigned offset) -{ - struct tegra_port_info *state = dev_get_priv(dev); - int ret; - - ret = check_reserved(dev, offset, __func__); - if (ret) - return ret; - state-label[offset][0] = '\0'; - - return 0; -} - -/* read GPIO OUT value of pin 'gpio' */ -static int tegra_gpio_get_output_value(unsigned gpio) -{ - struct gpio_ctlr *ctlr = (struct gpio_ctlr *)NV_PA_GPIO_BASE; - struct gpio_ctlr_bank *bank = ctlr-gpio_bank[GPIO_BANK(gpio)]; - int val; - - debug(gpio_get_output_value: pin = %d (port %d:bit %d)\n, - gpio, GPIO_FULLPORT(gpio), GPIO_BIT(gpio)); - - val = readl(bank-gpio_out[GPIO_PORT(gpio)]); - - return (val GPIO_BIT(gpio)) 1; -} - - /* set GPIO pin 'gpio' as an input */ static int tegra_gpio_direction_input(struct udevice *dev, unsigned offset) { struct tegra_port_info *state = dev_get_priv(dev); - int ret; - - ret = check_reserved(dev, offset, __func__); - if (ret) - return ret; /* Configure GPIO direction as input. */ set_direction(state-base_gpio + offset, 0); @@ -234,11 +178,6 @@ static int tegra_gpio_direction_output(struct udevice *dev, unsigned offset, { struct tegra_port_info *state = dev_get_priv(dev); int gpio = state-base_gpio + offset; - int ret; - - ret = check_reserved(dev, offset, __func__); - if (ret) - return ret; /* Configure GPIO output value. */ set_level(gpio, value); @@ -254,13 +193,8 @@ static int tegra_gpio_get_value(struct udevice *dev, unsigned offset) { struct tegra_port_info *state = dev_get_priv(dev); int gpio = state-base_gpio + offset; - int ret; int val; - ret = check_reserved(dev, offset, __func__); - if (ret) - return ret; - debug(%s: pin = %d (port %d:bit %d)\n, __func__, gpio, GPIO_FULLPORT(gpio), GPIO_BIT(gpio)); @@ -274,11 +208,6 @@ static int tegra_gpio_set_value(struct udevice *dev, unsigned offset, int value) { struct tegra_port_info *state = dev_get_priv(dev); int gpio = state-base_gpio + offset; - int ret; - - ret = check_reserved(dev, offset, __func__); - if (ret) - return ret; debug(gpio_set_value: pin = %d (port %d:bit %d), value = %d\n, gpio, GPIO_FULLPORT(gpio), GPIO_BIT(gpio), value); @@ -314,8 +243,6 @@ static int tegra_gpio_get_function(struct udevice *dev, unsigned offset) struct tegra_port_info *state = dev_get_priv(dev); int gpio = state-base_gpio + offset; - if (!*state-label[offset]) - return GPIOF_UNUSED; if (!get_config(gpio)) return GPIOF_FUNC; else if (get_direction(gpio)) @@ -324,50 +251,13 @@ static int tegra_gpio_get_function(struct udevice *dev, unsigned offset) return GPIOF_INPUT; } -static int tegra_gpio_get_state(struct udevice *dev,
[U-Boot] [PATCH 23/23] dm: gpio: Remove unused get_state() uclass method
This is no longer used so drop it. Signed-off-by: Simon Glass s...@chromium.org --- include/asm-generic/gpio.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 2a32c93..0cfbd46 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -198,8 +198,6 @@ struct dm_gpio_ops { * @return current function - GPIOF_... */ int (*get_function)(struct udevice *dev, unsigned offset); - int (*get_state)(struct udevice *dev, unsigned offset, char *state, -int maxlen); }; /** -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 13/23] dm: gpio: sandbox: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/sandbox.c | 82 -- 1 file changed, 82 deletions(-) diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c index 13b3253..53c80d5 100644 --- a/drivers/gpio/sandbox.c +++ b/drivers/gpio/sandbox.c @@ -14,7 +14,6 @@ DECLARE_GLOBAL_DATA_PTR; /* Flags for each GPIO */ #define GPIOF_OUTPUT (1 0)/* Currently set as an output */ #define GPIOF_HIGH (1 1)/* Currently set high */ -#define GPIOF_RESERVED (1 2)/* Is in use / requested */ struct gpio_state { const char *label; /* label given by requester */ @@ -54,18 +53,6 @@ static int set_gpio_flag(struct udevice *dev, unsigned offset, int flag, return 0; } -static int check_reserved(struct udevice *dev, unsigned offset, - const char *func) -{ - if (!get_gpio_flag(dev, offset, GPIOF_RESERVED)) { - printf(sandbox_gpio: %s: error: offset %u not reserved\n, - func, offset); - return -1; - } - - return 0; -} - /* * Back-channel sandbox-internal-only access to GPIO state */ @@ -101,9 +88,6 @@ static int sb_gpio_direction_input(struct udevice *dev, unsigned offset) { debug(%s: offset:%u\n, __func__, offset); - if (check_reserved(dev, offset, __func__)) - return -1; - return sandbox_gpio_set_direction(dev, offset, 0); } @@ -113,9 +97,6 @@ static int sb_gpio_direction_output(struct udevice *dev, unsigned offset, { debug(%s: offset:%u, value = %d\n, __func__, offset, value); - if (check_reserved(dev, offset, __func__)) - return -1; - return sandbox_gpio_set_direction(dev, offset, 1) | sandbox_gpio_set_value(dev, offset, value); } @@ -125,9 +106,6 @@ static int sb_gpio_get_value(struct udevice *dev, unsigned offset) { debug(%s: offset:%u\n, __func__, offset); - if (check_reserved(dev, offset, __func__)) - return -1; - return sandbox_gpio_get_value(dev, offset); } @@ -136,9 +114,6 @@ static int sb_gpio_set_value(struct udevice *dev, unsigned offset, int value) { debug(%s: offset:%u, value = %d\n, __func__, offset, value); - if (check_reserved(dev, offset, __func__)) - return -1; - if (!sandbox_gpio_get_direction(dev, offset)) { printf(sandbox_gpio: error: set_value on input gpio %u\n, offset); @@ -148,61 +123,6 @@ static int sb_gpio_set_value(struct udevice *dev, unsigned offset, int value) return sandbox_gpio_set_value(dev, offset, value); } -static int sb_gpio_request(struct udevice *dev, unsigned offset, - const char *label) -{ - struct gpio_dev_priv *uc_priv = dev-uclass_priv; - struct gpio_state *state = dev_get_priv(dev); - - debug(%s: offset:%u, label:%s\n, __func__, offset, label); - - if (offset = uc_priv-gpio_count) { - printf(sandbox_gpio: error: invalid gpio %u\n, offset); - return -1; - } - - if (get_gpio_flag(dev, offset, GPIOF_RESERVED)) { - printf(sandbox_gpio: error: gpio %u already reserved\n, - offset); - return -1; - } - - state[offset].label = label; - return set_gpio_flag(dev, offset, GPIOF_RESERVED, 1); -} - -static int sb_gpio_free(struct udevice *dev, unsigned offset) -{ - struct gpio_state *state = dev_get_priv(dev); - - debug(%s: offset:%u\n, __func__, offset); - - if (check_reserved(dev, offset, __func__)) - return -1; - - state[offset].label = NULL; - return set_gpio_flag(dev, offset, GPIOF_RESERVED, 0); -} - -static int sb_gpio_get_state(struct udevice *dev, unsigned int offset, -char *buf, int bufsize) -{ - struct gpio_dev_priv *uc_priv = dev-uclass_priv; - struct gpio_state *state = dev_get_priv(dev); - const char *label; - - label = state[offset].label; - snprintf(buf, bufsize, %s%d: %s: %d [%c]%s%s, -uc_priv-bank_name ? uc_priv-bank_name : , offset, -sandbox_gpio_get_direction(dev, offset) ? out : in, -sandbox_gpio_get_value(dev, offset), -get_gpio_flag(dev, offset, GPIOF_RESERVED) ? 'x' : ' ', -label ? : , -label ? label : ); - - return 0; -} - static int sb_gpio_get_function(struct udevice *dev, unsigned offset) { if (get_gpio_flag(dev, offset, GPIOF_OUTPUT)) @@ -211,8 +131,6 @@ static int sb_gpio_get_function(struct udevice *dev, unsigned offset) } static const struct dm_gpio_ops gpio_sandbox_ops = { - .request=
[U-Boot] [PATCH 08/23] dm: gpio: Implement GPIO reservation in the uclass
We have several GPIO drivers now and all are doing similar things to record which GPIOs are reserved. Move this logic into the uclass to make the drivers similar. We retain the request()/free() methods since currently one driver does use these for setting up the pin. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/gpio-uclass.c | 92 +++--- include/asm-generic/gpio.h | 6 +++ 2 files changed, 84 insertions(+), 14 deletions(-) diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index a5ffd85..e11c5a6 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -7,6 +7,7 @@ #include common.h #include dm.h #include errno.h +#include malloc.h #include asm/gpio.h #include linux/ctype.h @@ -92,24 +93,41 @@ int gpio_lookup_name(const char *name, struct udevice **devp, * gpio: GPIO number * label: Name for the requested GPIO * + * The label is copied and allocated so the caller does not need to keep + * the pointer around. + * * This function implements the API that's compatible with current * GPIO API used in U-Boot. The request is forwarded to particular * GPIO driver. Returns 0 on success, negative value on error. */ int gpio_request(unsigned gpio, const char *label) { + struct gpio_dev_priv *uc_priv; unsigned int offset; struct udevice *dev; + char *str; int ret; ret = gpio_to_device(gpio, dev, offset); if (ret) return ret; - if (!gpio_get_ops(dev)-request) - return 0; + uc_priv = dev-uclass_priv; + if (uc_priv-name[offset]) + return -EBUSY; + str = strdup(label); + if (!str) + return -ENOMEM; + if (gpio_get_ops(dev)-request) { + ret = gpio_get_ops(dev)-request(dev, offset, label); + if (ret) { + free(str); + return ret; + } + } + uc_priv-name[offset] = str; - return gpio_get_ops(dev)-request(dev, offset, label); + return 0; } /** @@ -122,6 +140,7 @@ int gpio_request(unsigned gpio, const char *label) */ int gpio_free(unsigned gpio) { + struct gpio_dev_priv *uc_priv; unsigned int offset; struct udevice *dev; int ret; @@ -130,9 +149,34 @@ int gpio_free(unsigned gpio) if (ret) return ret; - if (!gpio_get_ops(dev)-free) - return 0; - return gpio_get_ops(dev)-free(dev, offset); + uc_priv = dev-uclass_priv; + if (!uc_priv-name[offset]) + return -ENXIO; + if (gpio_get_ops(dev)-free) { + ret = gpio_get_ops(dev)-free(dev, offset); + if (ret) + return ret; + } + + free(uc_priv-name[offset]); + uc_priv-name[offset] = NULL; + + return 0; +} + +static int check_reserved(struct udevice *dev, unsigned offset, + const char *func) +{ + struct gpio_dev_priv *uc_priv = dev-uclass_priv; + + if (!uc_priv-name[offset]) { + printf(%s: %s: error: gpio %s%d not reserved\n, + dev-name, func, + uc_priv-bank_name ? uc_priv-bank_name : , offset); + return -EBUSY; + } + + return 0; } /** @@ -152,8 +196,9 @@ int gpio_direction_input(unsigned gpio) ret = gpio_to_device(gpio, dev, offset); if (ret) return ret; + ret = check_reserved(dev, offset, dir_input); - return gpio_get_ops(dev)-direction_input(dev, offset); + return ret ? ret : gpio_get_ops(dev)-direction_input(dev, offset); } /** @@ -174,8 +219,10 @@ int gpio_direction_output(unsigned gpio, int value) ret = gpio_to_device(gpio, dev, offset); if (ret) return ret; + ret = check_reserved(dev, offset, dir_output); - return gpio_get_ops(dev)-direction_output(dev, offset, value); + return ret ? ret : + gpio_get_ops(dev)-direction_output(dev, offset, value); } /** @@ -196,8 +243,9 @@ int gpio_get_value(unsigned gpio) ret = gpio_to_device(gpio, dev, offset); if (ret) return ret; + ret = check_reserved(dev, offset, get_value); - return gpio_get_ops(dev)-get_value(dev, offset); + return ret ? ret : gpio_get_ops(dev)-get_value(dev, offset); } /** @@ -218,8 +266,9 @@ int gpio_set_value(unsigned gpio, int value) ret = gpio_to_device(gpio, dev, offset); if (ret) return ret; + ret = check_reserved(dev, offset, set_value); - return gpio_get_ops(dev)-set_value(dev, offset, value); + return ret ? ret : gpio_get_ops(dev)-set_value(dev, offset, value); } const char *gpio_get_bank_info(struct udevice *dev, int *bit_count) @@ -235,7 +284,7 @@ const char
[U-Boot] [PATCH 10/23] dm: Move the function for getting GPIO status into the uclass
This function can be more easily tested if it is in the uclass. Signed-off-by: Simon Glass s...@chromium.org --- common/cmd_gpio.c | 57 +- drivers/gpio/gpio-uclass.c | 39 +++ include/asm-generic/gpio.h | 18 +++ 3 files changed, 78 insertions(+), 36 deletions(-) diff --git a/common/cmd_gpio.c b/common/cmd_gpio.c index 11f4e40..c0cdc5f 100644 --- a/common/cmd_gpio.c +++ b/common/cmd_gpio.c @@ -25,13 +25,6 @@ enum gpio_cmd { }; #if defined(CONFIG_DM_GPIO) !defined(gpio_status) -static const char * const gpio_function[GPIOF_COUNT] = { - input, - output, - unused, - unknown, - func, -}; /* A few flags used by show_gpio() */ enum { @@ -40,22 +33,16 @@ enum { FLAG_SHOW_NEWLINE = 1 2, }; -static void show_gpio(struct udevice *dev, const char *bank_name, int offset, - int *flagsp) +static void gpio_get_description(struct udevice *dev, const char *bank_name, +int offset, int *flagsp) { - struct dm_gpio_ops *ops = gpio_get_ops(dev); - int func = GPIOF_UNKNOWN; char buf[80]; int ret; - BUILD_BUG_ON(GPIOF_COUNT != ARRAY_SIZE(gpio_function)); - - if (ops-get_function) { - ret = ops-get_function(dev, offset); - if (ret = 0 ret ARRAY_SIZE(gpio_function)) - func = ret; - } - if (!(*flagsp FLAG_SHOW_ALL) func == GPIOF_UNUSED) + ret = gpio_get_function(dev, offset, NULL); + if (ret 0) + goto err; + if (!(*flagsp FLAG_SHOW_ALL) ret == GPIOF_UNUSED) return; if ((*flagsp FLAG_SHOW_BANK) bank_name) { if (*flagsp FLAG_SHOW_NEWLINE) { @@ -65,20 +52,15 @@ static void show_gpio(struct udevice *dev, const char *bank_name, int offset, printf(Bank %s:\n, bank_name); *flagsp = ~FLAG_SHOW_BANK; } - *buf = '\0'; - if (ops-get_state) { - ret = ops-get_state(dev, offset, buf, sizeof(buf)); - if (ret) { - puts(unknown); - return; - } - } else { - sprintf(buf, %s%u: %8s %d, bank_name, offset, - gpio_function[func], ops-get_value(dev, offset)); - } - puts(buf); - puts(\n); + ret = gpio_get_status(dev, offset, buf, sizeof(buf)); + if (ret) + goto err; + + printf(%s\n, buf); + return; +err: + printf(Error %d\n, ret); } static int do_gpio_status(bool all, const char *gpio_name) @@ -101,8 +83,10 @@ static int do_gpio_status(bool all, const char *gpio_name) if (all) flags |= FLAG_SHOW_ALL; bank_name = gpio_get_bank_info(dev, num_bits); - if (!num_bits) + if (!num_bits) { + debug(GPIO device %s has no bits\n, dev-name); continue; + } banklen = bank_name ? strlen(bank_name) : 0; if (!gpio_name || !bank_name || @@ -113,11 +97,12 @@ static int do_gpio_status(bool all, const char *gpio_name) p = gpio_name + banklen; if (gpio_name *p) { offset = simple_strtoul(p, NULL, 10); - show_gpio(dev, bank_name, offset, flags); + gpio_get_description(dev, bank_name, offset, +flags); } else { for (offset = 0; offset num_bits; offset++) { - show_gpio(dev, bank_name, offset, - flags); + gpio_get_description(dev, bank_name, +offset, flags); } } } diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 04b7b16..6367093 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -330,6 +330,45 @@ int gpio_get_raw_function(struct udevice *dev, int offset, const char **namep) return get_function(dev, offset, false, namep); } +int gpio_get_status(struct udevice *dev, int offset, char *buf, int buffsize) +{ + struct dm_gpio_ops *ops = gpio_get_ops(dev); + struct gpio_dev_priv *priv; + char *str = buf; + int func; + int ret; + int len; + + BUILD_BUG_ON(GPIOF_COUNT != ARRAY_SIZE(gpio_function)); + + *buf = 0; + priv = dev-uclass_priv; + ret = gpio_get_raw_function(dev, offset, NULL); + if (ret 0) + return ret; + func = ret; + len =
[U-Boot] [PATCH 03/23] dm: core: Add support for simple-bus
Add a driver for the simple-bus nodes, which allows devices within these nodes to be bound. Signed-off-by: Simon Glass s...@chromium.org --- drivers/core/Makefile | 1 + drivers/core/simple-bus.c | 33 + include/dm/uclass-id.h| 1 + 3 files changed, 35 insertions(+) create mode 100644 drivers/core/simple-bus.c diff --git a/drivers/core/Makefile b/drivers/core/Makefile index c7905b1..151c239 100644 --- a/drivers/core/Makefile +++ b/drivers/core/Makefile @@ -5,3 +5,4 @@ # obj-y := device.o lists.o root.o uclass.o util.o +obj-$(CONFIG_OF_CONTROL) += simple-bus.o diff --git a/drivers/core/simple-bus.c b/drivers/core/simple-bus.c new file mode 100644 index 000..3ea4d82 --- /dev/null +++ b/drivers/core/simple-bus.c @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2014 Google, Inc + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include common.h +#include dm.h +#include dm/root.h + +DECLARE_GLOBAL_DATA_PTR; + +static int simple_bus_post_bind(struct udevice *dev) +{ + return dm_scan_fdt_node(dev, gd-fdt_blob, dev-of_offset, false); +} + +UCLASS_DRIVER(simple_bus) = { + .id = UCLASS_SIMPLE_BUS, + .name = simple_bus, + .post_bind = simple_bus_post_bind, +}; + +static const struct udevice_id generic_simple_bus_ids[] = { + { .compatible = simple-bus }, + { } +}; + +U_BOOT_DRIVER(simple_bus_drv) = { + .name = generic_simple_bus, + .id = UCLASS_SIMPLE_BUS, + .of_match = generic_simple_bus_ids, +}; diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 9800777..e3e9296 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -19,6 +19,7 @@ enum uclass_id { UCLASS_TEST_FDT, UCLASS_TEST_BUS, UCLASS_SPI_EMUL,/* sandbox SPI device emulator */ + UCLASS_SIMPLE_BUS, /* U-Boot uclasses start here */ UCLASS_GPIO,/* Bank of general-purpose I/O pins */ -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 20/23] dm: gpio: rpi_b: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/bcm2835_gpio.c | 89 - 1 file changed, 89 deletions(-) diff --git a/drivers/gpio/bcm2835_gpio.c b/drivers/gpio/bcm2835_gpio.c index 332cfc2..0244c01 100644 --- a/drivers/gpio/bcm2835_gpio.c +++ b/drivers/gpio/bcm2835_gpio.c @@ -11,67 +11,10 @@ #include asm/gpio.h #include asm/io.h -#define GPIO_NAME_SIZE 20 - struct bcm2835_gpios { - char label[BCM2835_GPIO_COUNT][GPIO_NAME_SIZE]; struct bcm2835_gpio_regs *reg; }; -/** - * gpio_is_requested() - check if a GPIO has been requested - * - * @bank: Bank to check - * @offset:GPIO offset within bank to check - * @return true if marked as requested, false if not - */ -static inline bool gpio_is_requested(struct bcm2835_gpios *gpios, int offset) -{ - return *gpios-label[offset] != '\0'; -} - -static int check_requested(struct udevice *dev, unsigned offset, - const char *func) -{ - struct bcm2835_gpios *gpios = dev_get_priv(dev); - struct gpio_dev_priv *uc_priv = dev-uclass_priv; - - if (!gpio_is_requested(gpios, offset)) { - printf(omap_gpio: %s: error: gpio %s%d not requested\n, - func, uc_priv-bank_name, offset); - return -EPERM; - } - - return 0; -} - -static int bcm2835_gpio_request(struct udevice *dev, unsigned offset, - const char *label) -{ - struct bcm2835_gpios *gpios = dev_get_priv(dev); - - if (gpio_is_requested(gpios, offset)) - return -EBUSY; - - strncpy(gpios-label[offset], label, GPIO_NAME_SIZE); - gpios-label[offset][GPIO_NAME_SIZE - 1] = '\0'; - - return 0; -} - -static int bcm2835_gpio_free(struct udevice *dev, unsigned offset) -{ - struct bcm2835_gpios *gpios = dev_get_priv(dev); - int ret; - - ret = check_requested(dev, offset, __func__); - if (ret) - return ret; - gpios-label[offset][0] = '\0'; - - return 0; -} - static int bcm2835_gpio_direction_input(struct udevice *dev, unsigned gpio) { struct bcm2835_gpios *gpios = dev_get_priv(dev); @@ -142,9 +85,6 @@ static int bcm2835_gpio_get_function(struct udevice *dev, unsigned offset) { struct bcm2835_gpios *gpios = dev_get_priv(dev); - if (!gpio_is_requested(gpios, offset)) - return GPIOF_UNUSED; - /* GPIOF_FUNC is not implemented yet */ if (bcm2835_gpio_is_output(gpios, offset)) return GPIOF_OUTPUT; @@ -152,42 +92,13 @@ static int bcm2835_gpio_get_function(struct udevice *dev, unsigned offset) return GPIOF_INPUT; } -static int bcm2835_gpio_get_state(struct udevice *dev, unsigned int offset, - char *buf, int bufsize) -{ - struct gpio_dev_priv *uc_priv = dev-uclass_priv; - struct bcm2835_gpios *gpios = dev_get_priv(dev); - const char *label; - bool requested; - bool is_output; - int size; - - label = gpios-label[offset]; - is_output = bcm2835_gpio_is_output(gpios, offset); - size = snprintf(buf, bufsize, %s%d: , - uc_priv-bank_name ? uc_priv-bank_name : , offset); - buf += size; - bufsize -= size; - requested = gpio_is_requested(gpios, offset); - snprintf(buf, bufsize, %s: %d [%c]%s%s, -is_output ? out : in, -bcm2835_get_value(gpios, offset), -requested ? 'x' : ' ', -requested ? : , -label); - - return 0; -} static const struct dm_gpio_ops gpio_bcm2835_ops = { - .request= bcm2835_gpio_request, - .free = bcm2835_gpio_free, .direction_input= bcm2835_gpio_direction_input, .direction_output = bcm2835_gpio_direction_output, .get_value = bcm2835_gpio_get_value, .set_value = bcm2835_gpio_set_value, .get_function = bcm2835_gpio_get_function, - .get_state = bcm2835_gpio_get_state, }; static int bcm2835_gpio_probe(struct udevice *dev) -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 11/23] dm: gpio: sandbox: Implement the get_function() method
Implement this method so that the 'gpio' command can do its job correctly. For sandbox we only support input and output states for a gpio. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/sandbox.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c index 75ada5d..7aa8b1f 100644 --- a/drivers/gpio/sandbox.c +++ b/drivers/gpio/sandbox.c @@ -203,6 +203,13 @@ static int sb_gpio_get_state(struct udevice *dev, unsigned int offset, return 0; } +static int sb_gpio_get_function(struct udevice *dev, unsigned offset) +{ + if (get_gpio_flag(dev, offset, GPIOF_OUTPUT)) + return GPIOF_OUTPUT; + return GPIOF_INPUT; +} + static const struct dm_gpio_ops gpio_sandbox_ops = { .request= sb_gpio_request, .free = sb_gpio_free, @@ -210,7 +217,7 @@ static const struct dm_gpio_ops gpio_sandbox_ops = { .direction_output = sb_gpio_direction_output, .get_value = sb_gpio_get_value, .set_value = sb_gpio_set_value, - .get_state = sb_gpio_get_state, + .get_function = sb_gpio_get_function, }; static int sandbox_gpio_ofdata_to_platdata(struct udevice *dev) -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 21/23] dm: gpio: exynos: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/s5p_gpio.c | 101 1 file changed, 101 deletions(-) diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c index 13d74eb..6c41a42 100644 --- a/drivers/gpio/s5p_gpio.c +++ b/drivers/gpio/s5p_gpio.c @@ -33,8 +33,6 @@ DECLARE_GLOBAL_DATA_PTR; #define RATE_MASK(gpio)(0x1 (gpio + 16)) #define RATE_SET(gpio) (0x1 (gpio + 16)) -#define GPIO_NAME_SIZE 20 - /* Platform data for each bank */ struct exynos_gpio_platdata { struct s5p_gpio_bank *bank; @@ -43,7 +41,6 @@ struct exynos_gpio_platdata { /* Information about each bank at run-time */ struct exynos_bank_info { - char label[GPIO_PER_BANK][GPIO_NAME_SIZE]; struct s5p_gpio_bank *bank; }; @@ -189,61 +186,10 @@ int s5p_gpio_get_pin(unsigned gpio) /* Driver model interface */ #ifndef CONFIG_SPL_BUILD -static int exynos_gpio_get_state(struct udevice *dev, unsigned int offset, - char *buf, int bufsize) -{ - struct gpio_dev_priv *uc_priv = dev-uclass_priv; - struct exynos_bank_info *state = dev_get_priv(dev); - const char *label; - bool is_output; - int size; - int cfg; - - label = state-label[offset]; - cfg = s5p_gpio_get_cfg_pin(state-bank, offset); - is_output = cfg == S5P_GPIO_OUTPUT; - size = snprintf(buf, bufsize, %s%d: , - uc_priv-bank_name ? uc_priv-bank_name : , offset); - buf += size; - bufsize -= size; - if (is_output || cfg == S5P_GPIO_INPUT) { - snprintf(buf, bufsize, %s: %d [%c]%s%s, -is_output ? out : in, -s5p_gpio_get_value(state-bank, offset), -*label ? 'x' : ' ', -*label ? : , -label); - } else { - snprintf(buf, bufsize, sfpio); - } - - return 0; -} - -static int check_reserved(struct udevice *dev, unsigned offset, - const char *func) -{ - struct exynos_bank_info *state = dev_get_priv(dev); - struct gpio_dev_priv *uc_priv = dev-uclass_priv; - - if (!*state-label[offset]) { - printf(exynos_gpio: %s: error: gpio %s%d not reserved\n, - func, uc_priv-bank_name, offset); - return -EPERM; - } - - return 0; -} - /* set GPIO pin 'gpio' as an input */ static int exynos_gpio_direction_input(struct udevice *dev, unsigned offset) { struct exynos_bank_info *state = dev_get_priv(dev); - int ret; - - ret = check_reserved(dev, offset, __func__); - if (ret) - return ret; /* Configure GPIO direction as input. */ s5p_gpio_cfg_pin(state-bank, offset, S5P_GPIO_INPUT); @@ -256,11 +202,6 @@ static int exynos_gpio_direction_output(struct udevice *dev, unsigned offset, int value) { struct exynos_bank_info *state = dev_get_priv(dev); - int ret; - - ret = check_reserved(dev, offset, __func__); - if (ret) - return ret; /* Configure GPIO output value. */ s5p_gpio_set_value(state-bank, offset, value); @@ -275,11 +216,6 @@ static int exynos_gpio_direction_output(struct udevice *dev, unsigned offset, static int exynos_gpio_get_value(struct udevice *dev, unsigned offset) { struct exynos_bank_info *state = dev_get_priv(dev); - int ret; - - ret = check_reserved(dev, offset, __func__); - if (ret) - return ret; return s5p_gpio_get_value(state-bank, offset); } @@ -289,43 +225,11 @@ static int exynos_gpio_set_value(struct udevice *dev, unsigned offset, int value) { struct exynos_bank_info *state = dev_get_priv(dev); - int ret; - - ret = check_reserved(dev, offset, __func__); - if (ret) - return ret; s5p_gpio_set_value(state-bank, offset, value); return 0; } - -static int exynos_gpio_request(struct udevice *dev, unsigned offset, - const char *label) -{ - struct exynos_bank_info *state = dev_get_priv(dev); - - if (*state-label[offset]) - return -EBUSY; - - strncpy(state-label[offset], label, GPIO_NAME_SIZE); - state-label[offset][GPIO_NAME_SIZE - 1] = '\0'; - - return 0; -} - -static int exynos_gpio_free(struct udevice *dev, unsigned offset) -{ - struct exynos_bank_info *state = dev_get_priv(dev); - int ret; - - ret = check_reserved(dev, offset, __func__); - if (ret) - return ret; - state-label[offset][0] = '\0'; - - return 0; -} #endif
[U-Boot] [PATCH 05/23] dm: sunxi: Make sure that GPIOs are requested
The scsi_init() function uses a GPIO so should request it. There is no way to return an error here, and the request may be made multiple times, so just ignore errors for now. Signed-off-by: Simon Glass s...@chromium.org --- board/sunxi/ahci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/board/sunxi/ahci.c b/board/sunxi/ahci.c index 0c262ea..5e12328 100644 --- a/board/sunxi/ahci.c +++ b/board/sunxi/ahci.c @@ -74,6 +74,7 @@ void scsi_init(void) { printf(SUNXI SCSI INIT\n); #ifdef CONFIG_SATAPWR + gpio_request(CONFIG_SATAPWR, satapwr); gpio_direction_output(CONFIG_SATAPWR, 1); #endif -- 2.1.0.rc2.206.gedb03e5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 19/23] dm: gpio: omap3: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/omap_gpio.c | 116 +-- 1 file changed, 1 insertion(+), 115 deletions(-) diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c index a4651bc..f3a7ccb 100644 --- a/drivers/gpio/omap_gpio.c +++ b/drivers/gpio/omap_gpio.c @@ -29,11 +29,9 @@ #ifdef CONFIG_DM_GPIO -#define GPIO_NAME_SIZE 20 #define GPIO_PER_BANK 32 struct gpio_bank { - char label[GPIO_PER_BANK][GPIO_NAME_SIZE]; /* TODO(s...@chromium.org): Can we use a struct here? */ void *base; /* address of registers in physical memory */ enum gpio_method method; @@ -246,47 +244,10 @@ int gpio_free(unsigned gpio) #else /* new driver model interface CONFIG_DM_GPIO */ -/** - * gpio_is_requested() - check if a GPIO has been requested - * - * @bank: Bank to check - * @offset:GPIO offset within bank to check - * @return true if marked as requested, false if not - */ -static inline bool gpio_is_requested(struct gpio_bank *bank, int offset) -{ - return *bank-label[offset] != '\0'; -} - -static int omap_gpio_is_output(struct gpio_bank *bank, int offset) -{ - return _get_gpio_direction(bank, offset) == OMAP_GPIO_DIR_OUT; -} - -static int check_requested(struct udevice *dev, unsigned offset, - const char *func) -{ - struct gpio_bank *bank = dev_get_priv(dev); - struct gpio_dev_priv *uc_priv = dev-uclass_priv; - - if (!gpio_is_requested(bank, offset)) { - printf(omap_gpio: %s: error: gpio %s%d not requested\n, - func, uc_priv-bank_name, offset); - return -EPERM; - } - - return 0; -} - /* set GPIO pin 'gpio' as an input */ static int omap_gpio_direction_input(struct udevice *dev, unsigned offset) { struct gpio_bank *bank = dev_get_priv(dev); - int ret; - - ret = check_requested(dev, offset, __func__); - if (ret) - return ret; /* Configure GPIO direction as input. */ _set_gpio_direction(bank, offset, 1); @@ -299,11 +260,6 @@ static int omap_gpio_direction_output(struct udevice *dev, unsigned offset, int value) { struct gpio_bank *bank = dev_get_priv(dev); - int ret; - - ret = check_requested(dev, offset, __func__); - if (ret) - return ret; _set_gpio_dataout(bank, offset, value); _set_gpio_direction(bank, offset, 0); @@ -315,11 +271,6 @@ static int omap_gpio_direction_output(struct udevice *dev, unsigned offset, static int omap_gpio_get_value(struct udevice *dev, unsigned offset) { struct gpio_bank *bank = dev_get_priv(dev); - int ret; - - ret = check_requested(dev, offset, __func__); - if (ret) - return ret; return _get_gpio_value(bank, offset); } @@ -329,94 +280,29 @@ static int omap_gpio_set_value(struct udevice *dev, unsigned offset, int value) { struct gpio_bank *bank = dev_get_priv(dev); - int ret; - - ret = check_requested(dev, offset, __func__); - if (ret) - return ret; _set_gpio_dataout(bank, offset, value); return 0; } -static int omap_gpio_get_state(struct udevice *dev, unsigned int offset, - char *buf, int bufsize) -{ - struct gpio_dev_priv *uc_priv = dev-uclass_priv; - struct gpio_bank *bank = dev_get_priv(dev); - const char *label; - bool requested; - bool is_output; - int size; - - label = bank-label[offset]; - is_output = omap_gpio_is_output(bank-base, offset); - size = snprintf(buf, bufsize, %s%d: , - uc_priv-bank_name ? uc_priv-bank_name : , offset); - buf += size; - bufsize -= size; - requested = gpio_is_requested(bank, offset); - snprintf(buf, bufsize, %s: %d [%c]%s%s, -is_output ? out : in, -_get_gpio_value(bank, offset), -requested ? 'x' : ' ', -requested ? : , -label); - - return 0; -} - -static int omap_gpio_request(struct udevice *dev, unsigned offset, - const char *label) -{ - struct gpio_bank *bank = dev_get_priv(dev); - - if (gpio_is_requested(bank, offset)) - return -EBUSY; - - strncpy(bank-label[offset], label, GPIO_NAME_SIZE); - bank-label[offset][GPIO_NAME_SIZE - 1] = '\0'; - - return 0; -} - -static int omap_gpio_free(struct udevice *dev, unsigned offset) -{ - struct gpio_bank *bank = dev_get_priv(dev); - int ret; - - ret = check_requested(dev, offset, __func__); - if (ret) -
[U-Boot] [PATCH 22/23] dm: gpio: imx: Drop request()/free() in the driver
Now that the uclass supports gpio_request/free() there is no need for the driver to implement it too. Drop this unnecessary code. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/mxc_gpio.c | 116 1 file changed, 116 deletions(-) diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c index 3f7b7d2..8bb9e39 100644 --- a/drivers/gpio/mxc_gpio.c +++ b/drivers/gpio/mxc_gpio.c @@ -20,7 +20,6 @@ enum mxc_gpio_direction { MXC_GPIO_DIRECTION_OUT, }; -#define GPIO_NAME_SIZE 20 #define GPIO_PER_BANK 32 struct mxc_gpio_plat { @@ -28,7 +27,6 @@ struct mxc_gpio_plat { }; struct mxc_bank_info { - char label[GPIO_PER_BANK][GPIO_NAME_SIZE]; struct gpio_regs *regs; }; @@ -152,18 +150,6 @@ int gpio_direction_output(unsigned gpio, int value) #endif #ifdef CONFIG_DM_GPIO -/** - * gpio_is_requested() - check if a GPIO has been requested - * - * @bank: Bank to check - * @offset:GPIO offset within bank to check - * @return true if marked as requested, false if not - */ -static inline bool gpio_is_requested(struct mxc_bank_info *bank, int offset) -{ - return *bank-label[offset] != '\0'; -} - static int mxc_gpio_is_output(struct gpio_regs *regs, int offset) { u32 val; @@ -208,35 +194,10 @@ static int mxc_gpio_bank_get_value(struct gpio_regs *regs, int offset) return (readl(regs-gpio_psr) offset) 0x01; } -static int mxc_gpio_bank_get_output_value(struct gpio_regs *regs, int offset) -{ - return (readl(regs-gpio_dr) offset) 0x01; -} - -static int check_requested(struct udevice *dev, unsigned offset, - const char *func) -{ - struct mxc_bank_info *bank = dev_get_priv(dev); - struct gpio_dev_priv *uc_priv = dev-uclass_priv; - - if (!gpio_is_requested(bank, offset)) { - printf(mxc_gpio: %s: error: gpio %s%d not requested\n, - func, uc_priv-bank_name, offset); - return -EPERM; - } - - return 0; -} - /* set GPIO pin 'gpio' as an input */ static int mxc_gpio_direction_input(struct udevice *dev, unsigned offset) { struct mxc_bank_info *bank = dev_get_priv(dev); - int ret; - - ret = check_requested(dev, offset, __func__); - if (ret) - return ret; /* Configure GPIO direction as input. */ mxc_gpio_bank_direction(bank-regs, offset, MXC_GPIO_DIRECTION_IN); @@ -249,11 +210,6 @@ static int mxc_gpio_direction_output(struct udevice *dev, unsigned offset, int value) { struct mxc_bank_info *bank = dev_get_priv(dev); - int ret; - - ret = check_requested(dev, offset, __func__); - if (ret) - return ret; /* Configure GPIO output value. */ mxc_gpio_bank_set_value(bank-regs, offset, value); @@ -268,11 +224,6 @@ static int mxc_gpio_direction_output(struct udevice *dev, unsigned offset, static int mxc_gpio_get_value(struct udevice *dev, unsigned offset) { struct mxc_bank_info *bank = dev_get_priv(dev); - int ret; - - ret = check_requested(dev, offset, __func__); - if (ret) - return ret; return mxc_gpio_bank_get_value(bank-regs, offset); } @@ -282,80 +233,16 @@ static int mxc_gpio_set_value(struct udevice *dev, unsigned offset, int value) { struct mxc_bank_info *bank = dev_get_priv(dev); - int ret; - - ret = check_requested(dev, offset, __func__); - if (ret) - return ret; mxc_gpio_bank_set_value(bank-regs, offset, value); return 0; } -static int mxc_gpio_get_state(struct udevice *dev, unsigned int offset, - char *buf, int bufsize) -{ - struct gpio_dev_priv *uc_priv = dev-uclass_priv; - struct mxc_bank_info *bank = dev_get_priv(dev); - const char *label; - bool requested; - bool is_output; - int size; - - label = bank-label[offset]; - is_output = mxc_gpio_is_output(bank-regs, offset); - size = snprintf(buf, bufsize, %s%d: , - uc_priv-bank_name ? uc_priv-bank_name : , offset); - buf += size; - bufsize -= size; - requested = gpio_is_requested(bank, offset); - snprintf(buf, bufsize, %s: %d [%c]%s%s, -is_output ? out : in, -is_output ? - mxc_gpio_bank_get_output_value(bank-regs, offset) : - mxc_gpio_bank_get_value(bank-regs, offset), -requested ? 'x' : ' ', -requested ? : , -label); - - return 0; -} - -static int mxc_gpio_request(struct udevice *dev, unsigned offset, - const char *label) -{ - struct mxc_bank_info *bank = dev_get_priv(dev); - - if (gpio_is_requested(bank,
Re: [U-Boot] [PATCH] mx6sxsabresd: Fix PCI reset and power GPIO assignments
Hi Stefano, On Tue, Sep 30, 2014 at 2:05 PM, Fabio Estevam fabio.este...@freescale.com wrote: PERST_GPIO and POWER_GPIO are currently swapped. Fix the GPIO assignments as per the board schematics. Signed-off-by: Fabio Estevam fabio.este...@freescale.com Would it be possible to get this one into 2014.10? Thanks ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 06/23] dm: sunxi: Modify the GPIO driver to support driver model
Hi, On Sun, Oct 5, 2014 at 1:29 AM, Simon Glass s...@chromium.org wrote: This adds driver model support to the sunxi GPIO driver, using the device tree to trigger binding of the driver. The driver will still operate without driver model too. Signed-off-by: Simon Glass s...@chromium.org --- drivers/gpio/sunxi_gpio.c | 170 ++ include/configs/sun7i.h | 1 + 2 files changed, 171 insertions(+) diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c index 0c50a8f..f633c04 100644 --- a/drivers/gpio/sunxi_gpio.c +++ b/drivers/gpio/sunxi_gpio.c @@ -11,9 +11,25 @@ */ #include common.h +#include dm.h +#include errno.h +#include fdtdec.h +#include malloc.h #include asm/io.h #include asm/gpio.h +#include dm/device-internal.h +DECLARE_GLOBAL_DATA_PTR; + +#define SUNXI_GPIOS_PER_PORT SUNXI_GPIO_A_NR + +struct sunxi_gpio_platdata { + struct sunxi_gpio *regs; + const char *bank_name; /* Name of port, e.g. B */ + int gpio_count; +}; + +#ifndef CONFIG_DM_GPIO static int sunxi_gpio_output(u32 pin, u32 val) { u32 dat; @@ -100,3 +116,157 @@ int sunxi_name_to_gpio(const char *name) return -1; return group * 32 + pin; } +#endif + +#ifdef CONFIG_DM_GPIO +static int sunxi_gpio_direction_input(struct udevice *dev, unsigned offset) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + + sunxi_gpio_set_cfgbank(plat-regs, offset, SUNXI_GPIO_INPUT); + + return 0; +} + +static int sunxi_gpio_direction_output(struct udevice *dev, unsigned offset, + int value) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + u32 num = GPIO_NUM(offset); + + sunxi_gpio_set_cfgbank(plat-regs, offset, SUNXI_GPIO_OUTPUT); + clrsetbits_le32(plat-regs-dat, 1 num, value ? (1 num) : 0); + + return 0; +} + +static int sunxi_gpio_get_value(struct udevice *dev, unsigned offset) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + u32 num = GPIO_NUM(offset); + unsigned dat; + + dat = readl(plat-regs-dat); + dat = num; + + return dat 0x1; +} + +static int sunxi_gpio_set_value(struct udevice *dev, unsigned offset, + int value) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + u32 num = GPIO_NUM(offset); + + clrsetbits_le32(plat-regs-dat, 1 num, value ? (1 num) : 0); + return 0; +} + +static int sunxi_gpio_get_function(struct udevice *dev, unsigned offset) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + int func; + + func = sunxi_gpio_get_cfgbank(plat-regs, offset); + if (func == SUNXI_GPIO_OUTPUT) + return GPIOF_OUTPUT; + else if (func == SUNXI_GPIO_INPUT) + return GPIOF_INPUT; + else + return GPIOF_FUNC; +} + +static const struct dm_gpio_ops gpio_sunxi_ops = { + .direction_input= sunxi_gpio_direction_input, + .direction_output = sunxi_gpio_direction_output, + .get_value = sunxi_gpio_get_value, + .set_value = sunxi_gpio_set_value, + .get_function = sunxi_gpio_get_function, +}; + +/** + * Returns the name of a GPIO bank + * + * GPIO banks are named A, B, C, ... + * + * @bank: Bank number (0, 1..n-1) + * @return allocated string containing the name + */ +static char *gpio_bank_name(int bank) +{ + char *name; + + name = malloc(2); + if (name) { + name[0] = 'A' + bank; + name[1] = '\0'; + } + + return name; +} + +static int gpio_sunxi_probe(struct udevice *dev) +{ + struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + struct gpio_dev_priv *uc_priv = dev-uclass_priv; + + /* Tell the uclass how many GPIOs we have */ + if (plat) { + uc_priv-gpio_count = plat-gpio_count; + uc_priv-bank_name = plat-bank_name; + } + + return 0; +} +/** + * We have a top-level GPIO device with no actual GPIOs. It has a child + * device for each Tegra port. Might we get rid of references to Tegra? + */ +static int gpio_sunxi_bind(struct udevice *parent) +{ + struct sunxi_gpio_platdata *plat = parent-platdata; + struct sunxi_gpio_reg *ctlr; + int bank; + int ret; + + /* If this is a child device, there is nothing to do here */ + if (plat) + return 0; + + ctlr = (struct sunxi_gpio_reg *)fdtdec_get_addr(gd-fdt_blob, + parent-of_offset, reg); + for (bank = 0; bank SUNXI_GPIO_BANKS; bank++) { + struct sunxi_gpio_platdata *plat; + struct udevice
Re: [U-Boot] [PATCH for-next 2/3] sunxi: kconfig: Add top-level TARGET_SUNXI
On Sat, Oct 4, 2014 at 4:48 PM, Ian Campbell i...@hellion.org.uk wrote: And make TARGET_SUN[457]I a choice variable under this. configs updated with: sed -i -e 's/^\+S:CONFIG_TARGET_SUN.I=y/+S:CONFIG_TARGET_SUNXI=y\n/g' configs/* Signed-off-by: Ian Campbell i...@hellion.org.uk --- arch/arm/Kconfig | 13 ++--- board/sunxi/Kconfig | 21 +++-- configs/A10-OLinuXino-Lime_defconfig | 1 + configs/A10s-OLinuXino-M_defconfig| 1 + configs/A13-OLinuXinoM_defconfig | 1 + configs/A13-OLinuXino_defconfig | 1 + configs/A20-OLinuXino-Lime_defconfig | 1 + configs/A20-OLinuXino_MICRO_defconfig | 1 + configs/Auxtek-T004_defconfig | 1 + configs/Bananapi_defconfig| 1 + configs/Cubieboard2_FEL_defconfig | 1 + configs/Cubieboard2_defconfig | 1 + configs/Cubieboard_defconfig | 1 + configs/Cubietruck_FEL_defconfig | 1 + configs/Cubietruck_defconfig | 1 + configs/Linksprite_pcDuino3_defconfig | 1 + configs/Mele_A1000G_defconfig | 1 + configs/Mele_A1000_defconfig | 1 + configs/Mini-X-1Gb_defconfig | 1 + configs/Mini-X_defconfig | 1 + configs/ba10_tv_box_defconfig | 1 + configs/i12-tvbox_defconfig | 1 + configs/qt840a_defconfig | 1 + configs/r7-tv-dongle_defconfig| 1 + 24 files changed, 43 insertions(+), 13 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index e3e7e78..54d2fbb 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -438,17 +438,8 @@ config TARGET_SMDKC100 config TARGET_SOCFPGA_CYCLONE5 bool Support socfpga_cyclone5 -config TARGET_SUN4I - bool Support sun4i - -config TARGET_SUN5I - bool Support sun5i - -config TARGET_SUN6I - bool Support sun6i - -config TARGET_SUN7I - bool Support sun7i +config TARGET_SUNXI + bool Support sunxi Should we mention Allwinner SoCs? config TARGET_SNOWBALL bool Support snowball diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index c4b3167..6e9308d 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -1,11 +1,28 @@ +if TARGET_SUNXI + +choice + prompt Sunxi SoC + +config TARGET_SUN4I + bool sun4i family And name the SoC models? It would be easier for users to find what they need. + +config TARGET_SUN5I + bool sun5i family + +config TARGET_SUN6I + bool sun6i family + +config TARGET_SUN7I + bool sun7i family + +endchoice + config SYS_CONFIG_NAME default sun4i if TARGET_SUN4I default sun5i if TARGET_SUN5I default sun6i if TARGET_SUN6I default sun7i if TARGET_SUN7I -if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I - config SYS_CPU default armv7 diff --git a/configs/A10-OLinuXino-Lime_defconfig b/configs/A10-OLinuXino-Lime_defconfig index f992293..35cc2ca 100644 --- a/configs/A10-OLinuXino-Lime_defconfig +++ b/configs/A10-OLinuXino-Lime_defconfig @@ -2,4 +2,5 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS=A10_OLINUXINO_L,AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI CONFIG_FDTFILE=sun4i-a10-olinuxino-lime.dtb +S:CONFIG_ARM=y ++S:CONFIG_TARGET_SUNXI=y +S:CONFIG_TARGET_SUN4I=y diff --git a/configs/A10s-OLinuXino-M_defconfig b/configs/A10s-OLinuXino-M_defconfig index a578c06..2ab8d3e 100644 --- a/configs/A10s-OLinuXino-M_defconfig +++ b/configs/A10s-OLinuXino-M_defconfig @@ -2,4 +2,5 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS=A10S_OLINUXINO_M,AXP152_POWER,SUNXI_EMAC,USB_EHCI,SUNXI_USB_VBUS0_GPIO=SUNXI_GPB(10) CONFIG_FDTFILE=sun5i-a10s-olinuxino-micro.dtb +S:CONFIG_ARM=y ++S:CONFIG_TARGET_SUNXI=y +S:CONFIG_TARGET_SUN5I=y diff --git a/configs/A13-OLinuXinoM_defconfig b/configs/A13-OLinuXinoM_defconfig index 9ae7b12..5fb3556 100644 --- a/configs/A13-OLinuXinoM_defconfig +++ b/configs/A13-OLinuXinoM_defconfig @@ -2,4 +2,5 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS=A13_OLINUXINOM,CONS_INDEX=2,USB_EHCI,SUNXI_USB_VBUS0_GPIO=SUNXI_GPG(11) CONFIG_FDTFILE=sun5i-a13-olinuxino-micro.dtb +S:CONFIG_ARM=y ++S:CONFIG_TARGET_SUNXI=y +S:CONFIG_TARGET_SUN5I=y diff --git a/configs/A13-OLinuXino_defconfig b/configs/A13-OLinuXino_defconfig index 2c726f3..3632f95 100644 --- a/configs/A13-OLinuXino_defconfig +++ b/configs/A13-OLinuXino_defconfig @@ -2,4 +2,5 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS=A13_OLINUXINO,CONS_INDEX=2,AXP209_POWER,USB_EHCI,SUNXI_USB_VBUS0_GPIO=SUNXI_GPG(11) CONFIG_FDTFILE=sun5i-a13-olinuxino.dtb +S:CONFIG_ARM=y ++S:CONFIG_TARGET_SUNXI=y +S:CONFIG_TARGET_SUN5I=y diff --git a/configs/A20-OLinuXino-Lime_defconfig b/configs/A20-OLinuXino-Lime_defconfig index ca79fd5..2317d1f 100644 --- a/configs/A20-OLinuXino-Lime_defconfig +++ b/configs/A20-OLinuXino-Lime_defconfig @@ -2,4 +2,5 @@ CONFIG_SPL=y
Re: [U-Boot] [PATCH v6 1/7] mtd: denali: add Denali controller configs to Kconfig
2014-10-03 19:21 GMT+09:00 Masahiro Yamada yamad...@jp.panasonic.com: Commit 3eb3e72a3f66 (nand/denali: Adding Denali NAND driver support) introduced some new options, and some of them were documented by commit f9860cf081ef (nand/denali: Document CONFIG symbols). This commit allows users to enable/disable them via Kconfig with more detailed help docs. Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com Cc: Chin Liang See cl...@altera.com Cc: Scott Wood scottw...@freescale.com --- Changes in v6: - Rename oob - OOB Changes in v5: - Newly added Changes in v4: None Changes in v3: None Changes in v2: None Applied to u-boot-uniphier/master. -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v6 2/7] mtd: denali: add Denali NAND driver for SPL
2014-10-03 19:21 GMT+09:00 Masahiro Yamada yamad...@jp.panasonic.com: The SPL-mode driver for Denali(Cadence) NAND Flash Memory Controller IP. This driver requires two CONFIG macros: - CONFIG_SPL_NAND_DENALI Define to enable this driver. - CONFIG_SYS_NAND_BAD_BLOCK_POS Specify bad block mark position in the oob space. Typically 0. Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com Cc: Chin Liang See cl...@altera.com Cc: Scott Wood scottw...@freescale.com --- Changes in v6: None Changes in v5: - Remove the workaround added by v4 because the denali.h was merget into the mainline - Add Kconfig entry - Add comments where we read out some register values Changes in v4: - Add a workaround to not depend on the Denali driver posted by Chin Liang See. This driver has been taking too long: http://patchwork.ozlabs.org/patch/381305/ Changes in v3: None Changes in v2: - Avoid unaligned access - Replace a magic number 0x2000 with PIPELINE_ACCESS Applied to u-boot-uniphier/master. -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v6 3/7] serial: add UniPhier serial driver
2014-10-03 19:21 GMT+09:00 Masahiro Yamada yamad...@jp.panasonic.com: The driver for on-chip UART used on Panasonic UniPhier platform. Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - Use const unsigned int mode_x_div = 16 instead of #define MODE_X_DIV 16 - Use DIV_ROUND_CLOSEST() macro to compute the divisor Applied to u-boot-uniphier/master. -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v6 4/7] ARM: UniPhier: add UniPhier SoC support code
2014-10-03 19:21 GMT+09:00 Masahiro Yamada yamad...@jp.panasonic.com: These are used by Panasonic UniPhier SoC family. Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com --- Changes in v6: - Increase malloc area from 1MB to 4MB - Improve comments in header files - Add SPDX to umc-regs.h Changes in v5: - Move Denali configs to defconfigs - Enable CONFIG_SYS_NAND_ONFI_DETECTION - Add UMC settings - Re-enable Denali driver Changes in v4: - Disable Denali NAND driver. This driver has been taking too long: http://patchwork.ozlabs.org/patch/381305/ Changes in v3: - Add Denali fixup code for PH1-sLD8 and PH1-Pro4 Changes in v2: - Rebase - Remove unnecessary CONFIG_SYS_NAND_PAGE_SIZE definition - Fix a typo in the subject Applied to u-boot-uniphier/master. -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v6 6/7] MAINTAINERS: add me as a maintainer of UniPhier platform
2014-10-03 19:21 GMT+09:00 Masahiro Yamada yamad...@jp.panasonic.com: Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com Acked-by: Albert ARIBAUD albert.u.b...@aribaud.net Acked-by: Michal Simek mon...@monstr.eu --- Changes in v6: None Changes in v5: - Add u-boot-uniphier repo info Changes in v4: None Changes in v3: None Changes in v2: - Newly added Applied to u-boot-uniphier/master. -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v6 7/7] git-mailrc: add me as a maintainer of UniPhier platform
2014-10-03 19:21 GMT+09:00 Masahiro Yamada yamad...@jp.panasonic.com: Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - Rebase Applied to u-boot-uniphier/master. -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v6 5/7] ARM: UniPhier: add Kconfig and defconfig
2014-10-03 19:21 GMT+09:00 Masahiro Yamada yamad...@jp.panasonic.com: This commit allows to build Panasonic UniPhier family: PH1-LD4, PH1-Pro4, PH1-sLD8 Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com --- Changes in v6: None Changes in v5: - Add Denali config options to defconfigs Changes in v4: None Changes in v3: - Rebase on the current u-boot/master Changes in v2: - Rebase on the current u-boot/master Applied to u-boot-uniphier/master. -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Pull request: u-boot-uniphier/master
Hi Albert, The following changes since commit be9f643ae6aa9044c60fe80e3a2c10be8371c692: Merge branch 'for-tom' of git://git.denx.de/u-boot-dm (2014-09-26 20:10:48 -0400) are available in the git repository at: git://git.denx.de/u-boot-uniphier.git master for you to fetch changes up to 6dd0e7c00bfa5ce861a72b8e4a3ef9e787306125: git-mailrc: add me as a maintainer of UniPhier platform (2014-10-05 14:10:09 +0900) Masahiro Yamada (7): mtd: denali: add Denali controller configs to Kconfig mtd: denali: add Denali NAND driver for SPL serial: add UniPhier serial driver ARM: UniPhier: add UniPhier SoC support code ARM: UniPhier: add Kconfig and defconfig MAINTAINERS: add me as a maintainer of UniPhier platform git-mailrc: add me as a maintainer of UniPhier platform MAINTAINERS |9 + arch/arm/Kconfig |5 + arch/arm/cpu/armv7/uniphier/Kconfig | 32 ++ arch/arm/cpu/armv7/uniphier/Makefile | 23 ++ arch/arm/cpu/armv7/uniphier/board_common.c| 32 ++ arch/arm/cpu/armv7/uniphier/board_late_init.c | 91 + arch/arm/cpu/armv7/uniphier/cache_uniphier.c | 154 arch/arm/cpu/armv7/uniphier/cmd_pinmon.c | 33 ++ arch/arm/cpu/armv7/uniphier/cpu_info.c| 59 +++ arch/arm/cpu/armv7/uniphier/dram_init.c | 37 ++ arch/arm/cpu/armv7/uniphier/init_page_table.c | 1068 + arch/arm/cpu/armv7/uniphier/lowlevel_init.S | 159 arch/arm/cpu/armv7/uniphier/ph1-ld4/Makefile | 10 + arch/arm/cpu/armv7/uniphier/ph1-ld4/bcu_init.c| 33 ++ arch/arm/cpu/armv7/uniphier/ph1-ld4/board_info.c | 16 + arch/arm/cpu/armv7/uniphier/ph1-ld4/board_postclk_init.c | 42 +++ arch/arm/cpu/armv7/uniphier/ph1-ld4/boot-mode.c |1 + arch/arm/cpu/armv7/uniphier/ph1-ld4/clkrst_init.c | 29 ++ arch/arm/cpu/armv7/uniphier/ph1-ld4/pinctrl.c | 63 arch/arm/cpu/armv7/uniphier/ph1-ld4/pll_init.c| 189 ++ arch/arm/cpu/armv7/uniphier/ph1-ld4/pll_spectrum.c|1 + arch/arm/cpu/armv7/uniphier/ph1-ld4/sbc_init.c| 44 +++ arch/arm/cpu/armv7/uniphier/ph1-ld4/sg_init.c | 28 ++ arch/arm/cpu/armv7/uniphier/ph1-ld4/umc_init.c| 162 arch/arm/cpu/armv7/uniphier/ph1-pro4/Makefile | 10 + arch/arm/cpu/armv7/uniphier/ph1-pro4/board_info.c | 16 + arch/arm/cpu/armv7/uniphier/ph1-pro4/board_postclk_init.c | 39 ++ arch/arm/cpu/armv7/uniphier/ph1-pro4/boot-mode.c | 66 arch/arm/cpu/armv7/uniphier/ph1-pro4/clkrst_init.c| 29 ++ arch/arm/cpu/armv7/uniphier/ph1-pro4/pinctrl.c| 45 +++ arch/arm/cpu/armv7/uniphier/ph1-pro4/pll_init.c | 168 + arch/arm/cpu/armv7/uniphier/ph1-pro4/pll_spectrum.c | 18 + arch/arm/cpu/armv7/uniphier/ph1-pro4/sbc_init.c | 75 arch/arm/cpu/armv7/uniphier/ph1-pro4/sg_init.c| 28 ++ arch/arm/cpu/armv7/uniphier/ph1-pro4/umc_init.c | 136 +++ arch/arm/cpu/armv7/uniphier/ph1-sld8/Makefile | 10 + arch/arm/cpu/armv7/uniphier/ph1-sld8/bcu_init.c |1 + arch/arm/cpu/armv7/uniphier/ph1-sld8/board_info.c | 16 + arch/arm/cpu/armv7/uniphier/ph1-sld8/board_postclk_init.c |1 + arch/arm/cpu/armv7/uniphier/ph1-sld8/boot-mode.c |1 + arch/arm/cpu/armv7/uniphier/ph1-sld8/clkrst_init.c| 29 ++ arch/arm/cpu/armv7/uniphier/ph1-sld8/pinctrl.c| 57 +++ arch/arm/cpu/armv7/uniphier/ph1-sld8/pll_init.c | 201 ++ arch/arm/cpu/armv7/uniphier/ph1-sld8/pll_spectrum.c |1 + arch/arm/cpu/armv7/uniphier/ph1-sld8/sbc_init.c | 51 +++ arch/arm/cpu/armv7/uniphier/ph1-sld8/sg_init.c|1 + arch/arm/cpu/armv7/uniphier/ph1-sld8/umc_init.c | 142 +++ arch/arm/cpu/armv7/uniphier/reset.c | 29 ++ arch/arm/cpu/armv7/uniphier/smp.S | 54 +++ arch/arm/cpu/armv7/uniphier/spl.c | 17 + arch/arm/cpu/armv7/uniphier/support_card.c| 180 + arch/arm/cpu/armv7/uniphier/timer.c | 39 ++ arch/arm/include/asm/arch-uniphier/arm-mpcore.h | 46 +++ arch/arm/include/asm/arch-uniphier/bcu-regs.h | 30 ++ arch/arm/include/asm/arch-uniphier/board.h| 35 ++ arch/arm/include/asm/arch-uniphier/boot-device.h | 20 + arch/arm/include/asm/arch-uniphier/led.h | 101 + arch/arm/include/asm/arch-uniphier/sbc-regs.h | 108