[U-Boot] [RFC PATCH 01/21] ARM: at91: move board select menu and common settings

2015-01-25 Thread Masahiro Yamada
The board select menu in arch/arm/Kconfig is still big.
To slim down it, this commit moves AT91 boards to
arch/arm/mach-at91/Kconfig.
Also, consolidate "config SYS_SOC" in each board Kconfig.

The Kconfig files under board/ directory were modified with the
following command:

find board -name Kconfig | xargs sed -i -e '
/config SYS_SOC/ {
N
/default "at91"/ {
N
d
}
}
'

Signed-off-by: Masahiro Yamada 
---

 arch/arm/Kconfig   | 157 +--
 arch/arm/mach-at91/Kconfig | 166 +
 board/BuS/eb_cpux9k2/Kconfig   |   3 -
 board/BuS/vl_ma2sc/Kconfig |   3 -
 board/afeb9260/Kconfig |   3 -
 board/atmel/at91rm9200ek/Kconfig   |   3 -
 board/atmel/at91sam9260ek/Kconfig  |   3 -
 board/atmel/at91sam9261ek/Kconfig  |   3 -
 board/atmel/at91sam9263ek/Kconfig  |   3 -
 board/atmel/at91sam9m10g45ek/Kconfig   |   3 -
 board/atmel/at91sam9n12ek/Kconfig  |   3 -
 board/atmel/at91sam9rlek/Kconfig   |   3 -
 board/atmel/at91sam9x5ek/Kconfig   |   3 -
 board/atmel/sama5d3_xplained/Kconfig   |   3 -
 board/atmel/sama5d3xek/Kconfig |   3 -
 board/atmel/sama5d4_xplained/Kconfig   |   3 -
 board/atmel/sama5d4ek/Kconfig  |   3 -
 board/bluewater/snapper9260/Kconfig|   3 -
 board/calao/sbc35_a9g20/Kconfig|   3 -
 board/calao/tny_a9260/Kconfig  |   3 -
 board/calao/usb_a9263/Kconfig  |   3 -
 board/egnite/ethernut5/Kconfig |   3 -
 board/esd/meesc/Kconfig|   3 -
 board/esd/otc570/Kconfig   |   3 -
 board/eukrea/cpu9260/Kconfig   |   3 -
 board/eukrea/cpuat91/Kconfig   |   3 -
 board/ronetix/pm9261/Kconfig   |   3 -
 board/ronetix/pm9263/Kconfig   |   3 -
 board/ronetix/pm9g45/Kconfig   |   3 -
 board/siemens/corvus/Kconfig   |   3 -
 board/siemens/taurus/Kconfig   |   3 -
 board/taskit/stamp9g20/Kconfig |   3 -
 configs/afeb9260_defconfig |   1 +
 configs/at91rm9200ek_defconfig |   1 +
 configs/at91rm9200ek_ram_defconfig |   1 +
 configs/at91sam9260ek_dataflash_cs0_defconfig  |   1 +
 configs/at91sam9260ek_dataflash_cs1_defconfig  |   1 +
 configs/at91sam9260ek_nandflash_defconfig  |   1 +
 configs/at91sam9261ek_dataflash_cs0_defconfig  |   1 +
 configs/at91sam9261ek_dataflash_cs3_defconfig  |   1 +
 configs/at91sam9261ek_nandflash_defconfig  |   1 +
 configs/at91sam9263ek_dataflash_cs0_defconfig  |   1 +
 configs/at91sam9263ek_dataflash_defconfig  |   1 +
 configs/at91sam9263ek_nandflash_defconfig  |   1 +
 configs/at91sam9263ek_norflash_boot_defconfig  |   1 +
 configs/at91sam9263ek_norflash_defconfig   |   1 +
 configs/at91sam9g10ek_dataflash_cs0_defconfig  |   1 +
 configs/at91sam9g10ek_dataflash_cs3_defconfig  |   1 +
 configs/at91sam9g10ek_nandflash_defconfig  |   1 +
 configs/at91sam9g20ek_2mmc_nandflash_defconfig |   1 +
 configs/at91sam9g20ek_dataflash_cs0_defconfig  |   1 +
 configs/at91sam9g20ek_dataflash_cs1_defconfig  |   1 +
 configs/at91sam9g20ek_mmc_defconfig|   1 +
 configs/at91sam9g20ek_nandflash_defconfig  |   1 +
 configs/at91sam9m10g45ek_mmc_defconfig |   1 +
 configs/at91sam9m10g45ek_nandflash_defconfig   |   1 +
 configs/at91sam9n12ek_mmc_defconfig|   1 +
 configs/at91sam9n12ek_nandflash_defconfig  |   1 +
 configs/at91sam9n12ek_spiflash_defconfig   |   1 +
 configs/at91sam9rlek_dataflash_defconfig   |   1 +
 configs/at91sam9rlek_nandflash_defconfig   |   1 +
 configs/at91sam9x5ek_dataflash_defconfig   |   1 +
 configs/at91sam9x5ek_mmc_defconfig |   1 +
 configs/at91sam9x5ek_nandflash_defconfig   |   1 +
 configs/at91sam9x5ek_spiflash_defconfig|   1 +
 configs/at91sam9xeek_dataflash_cs0_defconfig   |   1 +
 configs/at91sam9xeek_dataflash_cs1_defconfig   |   1 +
 configs/at91sam9xeek_nandflash_defconfig   |   1 +
 configs/axm_defconfig  |   1 +
 configs/corvus_defconfig   |   1 +
 configs/cpu9260_128M_defconfig |   1 +
 configs/cpu9260_defconfig  |   1 +
 configs/cpu9260_nand_128M_defconfig|   1 +
 configs/cpu9260_nand_defconfig |   1 +
 configs/cpu9G20_128M_defconfig |   1 +
 configs/cpu9G20_defconfig  |   1 +
 configs/cpu9G20_nand_128M_defconfig|   1 +
 configs/cpu9G20_nand_defconfig |   1 +
 configs/cpuat91_defconfig  |   1 +
 configs/cpuat91_ram_defconfig  |   1 +

[U-Boot] [RFC PATCH 03/21] ARM: at91: collect SoC sources into mach-at91

2015-01-25 Thread Masahiro Yamada
This commit moves source files as follows:

  arch/arm/cpu/arm920t/at91/*   -> arch/arm/mach-at91/arm920t/*
  arch/arm/cpu/arm926ejs/at91/* -> arch/arm/mach-at91/arm926ejs/*
  arch/arm/cpu/armv7/at91/* -> arch/arm/mach-at91/armv7/*
  arch/arm/cpu/at91-common/*-> arch/arm/mach-at91/*

Signed-off-by: Masahiro Yamada 
Cc: Andreas Bießmann 
---

 MAINTAINERS|  3 +--
 arch/arm/Makefile  |  1 +
 arch/arm/cpu/Makefile  |  1 -
 arch/arm/cpu/arm920t/Makefile  |  1 -
 arch/arm/cpu/arm926ejs/Makefile|  1 -
 arch/arm/cpu/arm926ejs/at91/config.mk  |  2 --
 arch/arm/cpu/armv7/Makefile|  1 -
 arch/arm/cpu/armv7/at91/config.mk  |  8 
 arch/arm/{cpu/at91-common => mach-at91}/Makefile   | 14 --
 arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/Makefile  |  0
 .../at91 => mach-at91/arm920t}/at91rm9200_devices.c|  0
 arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/clock.c   |  0
 arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/cpu.c |  0
 .../arm920t/at91 => mach-at91/arm920t}/lowlevel_init.S |  0
 arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/reset.c   |  0
 arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/timer.c   |  0
 .../{cpu/arm926ejs/at91 => mach-at91/arm926ejs}/Makefile   |  0
 .../at91 => mach-at91/arm926ejs}/at91cap9_devices.c|  0
 .../at91 => mach-at91/arm926ejs}/at91sam9260_devices.c |  0
 .../at91 => mach-at91/arm926ejs}/at91sam9261_devices.c |  0
 .../at91 => mach-at91/arm926ejs}/at91sam9263_devices.c |  0
 .../at91 => mach-at91/arm926ejs}/at91sam9m10g45_devices.c  |  0
 .../at91 => mach-at91/arm926ejs}/at91sam9n12_devices.c |  0
 .../at91 => mach-at91/arm926ejs}/at91sam9rl_devices.c  |  0
 .../at91 => mach-at91/arm926ejs}/at91sam9x5_devices.c  |  0
 .../{cpu/arm926ejs/at91 => mach-at91/arm926ejs}/clock.c|  0
 arch/arm/{cpu/arm926ejs/at91 => mach-at91/arm926ejs}/cpu.c |  0
 .../{cpu/arm926ejs/at91 => mach-at91/arm926ejs}/eflash.c   |  0
 arch/arm/{cpu/arm926ejs/at91 => mach-at91/arm926ejs}/led.c |  0
 .../arm926ejs/at91 => mach-at91/arm926ejs}/lowlevel_init.S |  0
 .../{cpu/arm926ejs/at91 => mach-at91/arm926ejs}/reset.c|  0
 .../{cpu/arm926ejs/at91 => mach-at91/arm926ejs}/timer.c|  0
 arch/arm/{cpu/armv7/at91 => mach-at91/armv7}/Makefile  |  0
 arch/arm/{cpu/armv7/at91 => mach-at91/armv7}/clock.c   |  0
 arch/arm/{cpu/armv7/at91 => mach-at91/armv7}/cpu.c |  0
 arch/arm/{cpu/armv7/at91 => mach-at91/armv7}/reset.c   |  0
 .../{cpu/armv7/at91 => mach-at91/armv7}/sama5d3_devices.c  |  0
 .../{cpu/armv7/at91 => mach-at91/armv7}/sama5d4_devices.c  |  0
 arch/arm/{cpu/armv7/at91 => mach-at91/armv7}/timer.c   |  0
 arch/arm/mach-at91/config.mk   |  9 +
 arch/arm/{cpu/at91-common => mach-at91}/mpddrc.c   |  0
 arch/arm/{cpu/at91-common => mach-at91}/phy.c  |  0
 arch/arm/{cpu/at91-common => mach-at91}/sdram.c|  0
 arch/arm/{cpu/at91-common => mach-at91}/spl.c  |  0
 arch/arm/{cpu/at91-common => mach-at91}/spl_at91.c |  0
 arch/arm/{cpu/at91-common => mach-at91}/spl_atmel.c|  0
 arch/arm/{cpu/at91-common => mach-at91}/u-boot-spl.lds |  0
 include/configs/sama5d3_xplained.h |  2 +-
 include/configs/sama5d3xek.h   |  2 +-
 49 files changed, 17 insertions(+), 28 deletions(-)
 delete mode 100644 arch/arm/cpu/arm926ejs/at91/config.mk
 delete mode 100644 arch/arm/cpu/armv7/at91/config.mk
 rename arch/arm/{cpu/at91-common => mach-at91}/Makefile (54%)
 rename arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/Makefile (100%)
 rename arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/at91rm9200_devices.c 
(100%)
 rename arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/clock.c (100%)
 rename arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/cpu.c (100%)
 rename arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/lowlevel_init.S (100%)
 rename arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/reset.c (100%)
 rename arch/arm/{cpu/arm920t/at91 => mach-at91/arm920t}/timer.c (100%)
 rename arch/arm/{cpu/arm926ejs/at91 => mach-at91/arm926ejs}/Makefile (100%)
 rename arch/arm/{cpu/arm926ejs/at91 => mach-at91/arm926ejs}/at91cap9_devices.c 
(100%)
 rename arch/arm/{cpu/arm926ejs/at91 => 
mach-at91/arm926ejs}/at91sam9260_devices.c (100%)
 rename arch/arm/{cpu/arm926ejs/at91 => 
mach-at91/arm926ejs}/at91sam9261_devices.c (100%)
 rename arch/arm/{cpu/arm926ejs/at91 => 
mach-at91/arm926ejs}/at91sam9263_devices.c (100%)
 rename arch/arm/{cpu/arm926ejs/at91 => 
mach-at91/arm926ejs}/at91sam9m10g45_devices.c (100%)
 rename arch/arm/{cpu/arm926ejs/at91 => 
mach-at91/arm926ejs}/at91sam9n12_devices.c (100%)
 rename arch/arm/{cpu/arm926e

[U-Boot] [RFC PATCH 0/21] ARM: start to move SoC code into arch/arm/mach-*

2015-01-25 Thread Masahiro Yamada

This series can be applied on the current u-boot/master
(commit 37b608a52dcb133)

Buildman test passed.

$ tools/buildman/buildman -s -b mach arm
boards.cfg is up to date. Nothing to do.
Summary of 22 commits for 474 boards (8 threads, 1 job per thread)
01: powerpc: remove icecube_5200, Lite5200, cpci5200, mecp5200, pf5200
   arm: +   openrd_base s5pc210_universal maxbcm odroid smdkv310 snow 
openrd_ultimate smdk5250 peach-pi openrd_client smdk5420 origen odroid-xu3 
db-mv784mp-gp trats arndale peach-pit trats2
02: ARM: at91: move board select menu and common settings
03: ARM: prepare for moving SoC sources into mach-*
04: ARM: at91: collect SoC sources into mach-at91
05: ARM: tegra: collect SoC sources into mach-tegra
06: ARM: UniPhier: move SoC sources to mach-uniphier
07: ARM: davinci: move SoC sources to mach-davinci
08: ARM: kirkwood: move SOC sources to mach-kirkwood
09: ARM: nomadik: move SoC sources to mach-nomadik
10: ARM: highbank: move SoC sources to mach-highbank
11: ARM: orion5x: move SoC sources to mach-orion5x
12: ARM: versatile: move SoC sources to mach-versatile
13: ARM: keystone: move SoC sources to mach-keystone
14: kbuild: prepare for moving headers into mach-*/include/mach
15: ARM: at91: move SoC headers to mach-at91/include/mach
16: ARM: UniPhier: move SoC headers to mach-uniphier/include/mach
17: ARM: davinci: move SoC headers to mach-davinci/include/mach
18: ARM: kirkwood: move SoC headers to mach-kirkwood/include/mach
19: ARM: nomadik: move SoC headers to mach-nomadik/include/mach
20: ARM: orion5x: move SoC headers to mach-orion5x/include/mach
21: ARM: keystone: move SoC headers to mach-keystone/include/mach
22: ARM: prepare for including 



Masahiro Yamada (21):
  ARM: at91: move board select menu and common settings
  ARM: prepare for moving SoC sources into mach-*
  ARM: at91: collect SoC sources into mach-at91
  ARM: tegra: collect SoC sources into mach-tegra
  ARM: UniPhier: move SoC sources to mach-uniphier
  ARM: davinci: move SoC sources to mach-davinci
  ARM: kirkwood: move SOC sources to mach-kirkwood
  ARM: nomadik: move SoC sources to mach-nomadik
  ARM: highbank: move SoC sources to mach-highbank
  ARM: orion5x: move SoC sources to mach-orion5x
  ARM: versatile: move SoC sources to mach-versatile
  ARM: keystone: move SoC sources to mach-keystone
  kbuild: prepare for moving headers into mach-*/include/mach
  ARM: at91: move SoC headers to mach-at91/include/mach
  ARM: UniPhier: move SoC headers to mach-uniphier/include/mach
  ARM: davinci: move SoC headers to mach-davinci/include/mach
  ARM: kirkwood: move SoC headers to mach-kirkwood/include/mach
  ARM: nomadik: move SoC headers to mach-nomadik/include/mach
  ARM: orion5x: move SoC headers to mach-orion5x/include/mach
  ARM: keystone: move SoC headers to mach-keystone/include/mach
  ARM: prepare for including 

 MAINTAINERS|  14 +-
 arch/arm/Kconfig   | 175 ++---
 arch/arm/Makefile  |  25 +++
 arch/arm/cpu/Makefile  |   7 +-
 arch/arm/cpu/arm720t/Makefile  |   6 -
 arch/arm/cpu/arm720t/tegra-common/Makefile |  11 --
 arch/arm/cpu/arm720t/tegra114/Makefile |  21 ---
 arch/arm/cpu/arm720t/tegra124/Makefile |   8 -
 arch/arm/cpu/arm720t/tegra20/Makefile  |  10 --
 arch/arm/cpu/arm720t/tegra30/Makefile  |  20 ---
 arch/arm/cpu/arm920t/Makefile  |   1 -
 arch/arm/cpu/arm926ejs/Makefile|   6 -
 arch/arm/cpu/arm926ejs/at91/config.mk  |   2 -
 arch/arm/cpu/armv7/Makefile|   6 -
 arch/arm/cpu/armv7/at91/config.mk  |   8 -
 arch/arm/cpu/armv7/tegra-common/Makefile   |  10 --
 arch/arm/cpu/armv7/tegra20/Makefile|  11 --
 arch/arm/mach-at91/Kconfig | 166 +++
 arch/arm/{cpu/at91-common => mach-at91}/Makefile   |  14 +-
 .../arm920t/at91 => mach-at91/arm920t}/Makefile|   0
 .../arm920t}/at91rm9200_devices.c  |   0
 .../arm920t/at91 => mach-at91/arm920t}/clock.c |   0
 .../{cpu/arm920t/at91 => mach-at91/arm920t}/cpu.c  |   0
 .../at91 => mach-at91/arm920t}/lowlevel_init.S |   0
 .../arm920t/at91 => mach-at91/arm920t}/reset.c |   0
 .../arm920t/at91 => mach-at91/arm920t}/timer.c |   0
 .../at91 => mach-at91/arm926ejs}/Makefile  |   0
 .../arm926ejs}/at91cap9_devices.c  |   0
 .../arm926ejs}/at91sam9260_devices.c   |   0
 .../arm926ejs}/at91sam9261_devices.c   |   0
 .../arm926ejs}/at91sam9263_devices.c   |   0
 .../arm926ejs}/at91sam9m10g45_devices.c|   0
 .../arm926ejs}/at91sam9n12_devices.c   |   0
 .../arm926ejs}/at91sam9rl_devices.c|   0
 .../arm926ejs}/at91sam9x5_devices.c|   0
 .../arm926ejs/at91 =>

[U-Boot] [RFC PATCH 17/21] ARM: kirkwood: move SoC headers to mach-kirkwood/include/mach

2015-01-25 Thread Masahiro Yamada
Move arch/arm/include/asm/arch-kirkwood/*
  -> arch/arm/mach-kirkwood/include/mach/*

Signed-off-by: Masahiro Yamada 
Cc: Prafulla Wadaskar 
Cc: Luka Perkov 
Cc: Stefan Roese 
---

 MAINTAINERS | 1 -
 .../{include/asm/arch-kirkwood => mach-kirkwood/include/mach}/config.h  | 0
 .../arm/{include/asm/arch-kirkwood => mach-kirkwood/include/mach}/cpu.h | 0
 .../{include/asm/arch-kirkwood => mach-kirkwood/include/mach}/gpio.h| 0
 .../asm/arch-kirkwood => mach-kirkwood/include/mach}/kw88f6192.h| 0
 .../asm/arch-kirkwood => mach-kirkwood/include/mach}/kw88f6281.h| 0
 .../arm/{include/asm/arch-kirkwood => mach-kirkwood/include/mach}/mpp.h | 0
 .../arm/{include/asm/arch-kirkwood => mach-kirkwood/include/mach}/soc.h | 0
 include/configs/km/km_arm.h | 2 +-
 9 files changed, 1 insertion(+), 2 deletions(-)
 rename arch/arm/{include/asm/arch-kirkwood => 
mach-kirkwood/include/mach}/config.h (100%)
 rename arch/arm/{include/asm/arch-kirkwood => 
mach-kirkwood/include/mach}/cpu.h (100%)
 rename arch/arm/{include/asm/arch-kirkwood => 
mach-kirkwood/include/mach}/gpio.h (100%)
 rename arch/arm/{include/asm/arch-kirkwood => 
mach-kirkwood/include/mach}/kw88f6192.h (100%)
 rename arch/arm/{include/asm/arch-kirkwood => 
mach-kirkwood/include/mach}/kw88f6281.h (100%)
 rename arch/arm/{include/asm/arch-kirkwood => 
mach-kirkwood/include/mach}/mpp.h (100%)
 rename arch/arm/{include/asm/arch-kirkwood => 
mach-kirkwood/include/mach}/soc.h (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index e0a7c3f..7349348 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -99,7 +99,6 @@ M:Luka Perkov 
 S: Maintained
 T: git git://git.denx.de/u-boot-marvell.git
 F: arch/arm/mach-kirkwood/
-F: arch/arm/include/asm/arch-kirkwood/
 
 ARM MARVELL PXA
 M: Marek Vasut 
diff --git a/arch/arm/include/asm/arch-kirkwood/config.h 
b/arch/arm/mach-kirkwood/include/mach/config.h
similarity index 100%
rename from arch/arm/include/asm/arch-kirkwood/config.h
rename to arch/arm/mach-kirkwood/include/mach/config.h
diff --git a/arch/arm/include/asm/arch-kirkwood/cpu.h 
b/arch/arm/mach-kirkwood/include/mach/cpu.h
similarity index 100%
rename from arch/arm/include/asm/arch-kirkwood/cpu.h
rename to arch/arm/mach-kirkwood/include/mach/cpu.h
diff --git a/arch/arm/include/asm/arch-kirkwood/gpio.h 
b/arch/arm/mach-kirkwood/include/mach/gpio.h
similarity index 100%
rename from arch/arm/include/asm/arch-kirkwood/gpio.h
rename to arch/arm/mach-kirkwood/include/mach/gpio.h
diff --git a/arch/arm/include/asm/arch-kirkwood/kw88f6192.h 
b/arch/arm/mach-kirkwood/include/mach/kw88f6192.h
similarity index 100%
rename from arch/arm/include/asm/arch-kirkwood/kw88f6192.h
rename to arch/arm/mach-kirkwood/include/mach/kw88f6192.h
diff --git a/arch/arm/include/asm/arch-kirkwood/kw88f6281.h 
b/arch/arm/mach-kirkwood/include/mach/kw88f6281.h
similarity index 100%
rename from arch/arm/include/asm/arch-kirkwood/kw88f6281.h
rename to arch/arm/mach-kirkwood/include/mach/kw88f6281.h
diff --git a/arch/arm/include/asm/arch-kirkwood/mpp.h 
b/arch/arm/mach-kirkwood/include/mach/mpp.h
similarity index 100%
rename from arch/arm/include/asm/arch-kirkwood/mpp.h
rename to arch/arm/mach-kirkwood/include/mach/mpp.h
diff --git a/arch/arm/include/asm/arch-kirkwood/soc.h 
b/arch/arm/mach-kirkwood/include/mach/soc.h
similarity index 100%
rename from arch/arm/include/asm/arch-kirkwood/soc.h
rename to arch/arm/mach-kirkwood/include/mach/soc.h
diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index f780f8b..2ed0855 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -195,7 +195,7 @@
}
 
 #ifndef __ASSEMBLY__
-#include 
+#include 
 extern void __set_direction(unsigned pin, int high);
 void set_sda(int state);
 void set_scl(int state);
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC PATCH 15/21] ARM: UniPhier: move SoC headers to mach-uniphier/include/mach

2015-01-25 Thread Masahiro Yamada
Move arch/arm/include/asm/arch-uniphier/*
  -> arch/arm/mach-uniphier/include/mach/*

Signed-off-by: Masahiro Yamada 
---

 MAINTAINERS  | 1 -
 .../asm/arch-uniphier => mach-uniphier/include/mach}/arm-mpcore.h| 0
 .../{include/asm/arch-uniphier => mach-uniphier/include/mach}/bcu-regs.h | 0
 .../{include/asm/arch-uniphier => mach-uniphier/include/mach}/board.h| 0
 .../asm/arch-uniphier => mach-uniphier/include/mach}/boot-device.h   | 0
 .../asm/arch-uniphier => mach-uniphier/include/mach}/ddrphy-regs.h   | 0
 .../asm/arch-uniphier => mach-uniphier/include/mach}/debug-uart.S| 0
 .../asm/arch-uniphier => mach-uniphier/include/mach}/ehci-uniphier.h | 0
 .../arm/{include/asm/arch-uniphier => mach-uniphier/include/mach}/gpio.h | 0
 arch/arm/{include/asm/arch-uniphier => mach-uniphier/include/mach}/led.h | 0
 .../{include/asm/arch-uniphier => mach-uniphier/include/mach}/mio-regs.h | 0
 .../asm/arch-uniphier => mach-uniphier/include/mach}/platdevice.h| 0
 .../{include/asm/arch-uniphier => mach-uniphier/include/mach}/sbc-regs.h | 0
 .../{include/asm/arch-uniphier => mach-uniphier/include/mach}/sc-regs.h  | 0
 .../{include/asm/arch-uniphier => mach-uniphier/include/mach}/sg-regs.h  | 0
 .../{include/asm/arch-uniphier => mach-uniphier/include/mach}/ssc-regs.h | 0
 .../{include/asm/arch-uniphier => mach-uniphier/include/mach}/umc-regs.h | 0
 17 files changed, 1 deletion(-)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/arm-mpcore.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/bcu-regs.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/board.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/boot-device.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/ddrphy-regs.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/debug-uart.S (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/ehci-uniphier.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/gpio.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/led.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/mio-regs.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/platdevice.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/sbc-regs.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/sc-regs.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/sg-regs.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/ssc-regs.h (100%)
 rename arch/arm/{include/asm/arch-uniphier => 
mach-uniphier/include/mach}/umc-regs.h (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 32428a2..e0a7c3f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -164,7 +164,6 @@ M:  Masahiro Yamada 
 S: Maintained
 T: git git://git.denx.de/u-boot-uniphier.git
 F: arch/arm/mach-uniphier/
-F: arch/arm/include/asm/arch-uniphier/
 F: configs/ph1_*_defconfig
 F: drivers/serial/serial_uniphier.c
 
diff --git a/arch/arm/include/asm/arch-uniphier/arm-mpcore.h 
b/arch/arm/mach-uniphier/include/mach/arm-mpcore.h
similarity index 100%
rename from arch/arm/include/asm/arch-uniphier/arm-mpcore.h
rename to arch/arm/mach-uniphier/include/mach/arm-mpcore.h
diff --git a/arch/arm/include/asm/arch-uniphier/bcu-regs.h 
b/arch/arm/mach-uniphier/include/mach/bcu-regs.h
similarity index 100%
rename from arch/arm/include/asm/arch-uniphier/bcu-regs.h
rename to arch/arm/mach-uniphier/include/mach/bcu-regs.h
diff --git a/arch/arm/include/asm/arch-uniphier/board.h 
b/arch/arm/mach-uniphier/include/mach/board.h
similarity index 100%
rename from arch/arm/include/asm/arch-uniphier/board.h
rename to arch/arm/mach-uniphier/include/mach/board.h
diff --git a/arch/arm/include/asm/arch-uniphier/boot-device.h 
b/arch/arm/mach-uniphier/include/mach/boot-device.h
similarity index 100%
rename from arch/arm/include/asm/arch-uniphier/boot-device.h
rename to arch/arm/mach-uniphier/include/mach/boot-device.h
diff --git a/arch/arm/include/asm/arch-uniphier/ddrphy-regs.h 
b/arch/arm/mach-uniphier/include/mach/ddrphy-regs.h
similarity index 100%
rename from arch/arm/include/asm/arch-uniphier/ddrphy-regs.h
rename to arch/arm/mach-uniphier/include/mach/ddrphy-regs.h
diff --git a/arch/arm/include/asm/arch-uniphier/debug-uart.S 
b/arch/arm/mach-uniphier/include/mach/debug-uart.S
similarity index 100%
rename from arch/arm/include/asm/arch-uniphier/debug-uart.S
rename to arch/arm/mach-uniphier/include/mach/debug-uart.S
diff --git a/arch/arm/include/asm/arch-uniphier/ehci-uniphier.h 
b/arch/arm/mach-uniphier/include/mach/ehci-uniphier.h
similarity index 1

[U-Boot] [RFC PATCH 05/21] ARM: UniPhier: move SoC sources to mach-uniphier

2015-01-25 Thread Masahiro Yamada
Move
arch/arm/cpu/armv7/uniphier/* -> arch/arm/mach-uniphier/*

Signed-off-by: Masahiro Yamada 
---

 MAINTAINERS | 2 +-
 arch/arm/Kconfig| 2 +-
 arch/arm/Makefile   | 1 +
 arch/arm/cpu/armv7/Makefile | 1 -
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/Kconfig  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/Makefile | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/board_common.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/board_early_init_r.c | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/board_late_init.c| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/board_postclk_init.c | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/cache_uniphier.c | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/cmd_ddrphy.c | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/cmd_pinmon.c | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/cpu_info.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ddrphy_training.c| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/dram_init.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/init_page_table.S| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/lowlevel_init.S  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/Makefile | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/bcu_init.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/board_info.c | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/boot-mode.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/clkrst_init.c| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/ddrphy_init.c| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/lowlevel_debug.S | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/pinctrl.c| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/platdevice.c | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/pll_init.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/pll_spectrum.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/sbc_init.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/sg_init.c| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-ld4/umc_init.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/Makefile| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/board_info.c| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/boot-mode.c | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/clkrst_init.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/ddrphy_init.c   | 0
 .../arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/lowlevel_debug.S | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/pinctrl.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/platdevice.c| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/pll_init.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/pll_spectrum.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/sbc_init.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/sg_init.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-pro4/umc_init.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/Makefile| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/bcu_init.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/board_info.c| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/boot-mode.c | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/clkrst_init.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/ddrphy_init.c   | 0
 .../arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/lowlevel_debug.S | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/pinctrl.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/platdevice.c| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/pll_init.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/pll_spectrum.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/sbc_init.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/sg_init.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/ph1-sld8/umc_init.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/reset.c  | 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/smp.S| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/spl.c| 0
 arch/arm/{cpu/armv7/uniphier => mach-uniphier}/support_card.c   | 0
 arch/arm/{cpu/armv7/uniphier => mach

[U-Boot] [RFC PATCH 04/21] ARM: tegra: collect SoC sources into mach-tegra

2015-01-25 Thread Masahiro Yamada
This commit moves files as follows:

 arch/arm/cpu/arm720t/tegra20/*  -> arch/arm/mach-tegra/tegra20/*
 arch/arm/cpu/arm720t/tegra30/*  -> arch/arm/mach-tegra/tegra30/*
 arch/arm/cpu/arm720t/tegra114/* -> arch/arm/mach-tegra/tegra114/*
 arch/arm/cpu/arm720t/tegra124*  -> arch/arm/mach-tegra/tegra124/*
 arch/arm/cpu/arm720t/tegra-common/* -> arch/arm/mach-tegra/*
 arch/arm/cpu/armv7/tegra20/*-> arch/arm/mach-tegra/tegra20/*
 arch/arm/cpu/armv7/tegra30/*-> arch/arm/mach-tegra/tegra30/*
 arch/arm/cpu/armv7/tegra114/*   -> arch/arm/mach-tegra/tegra114/*
 arch/arm/cpu/armv7/tegra124/*   -> arch/arm/mach-tegra/tegra124/*
 arch/arm/cpu/armv7/tegra-common/*   -> arch/arm/mach-tegra/*
 arch/arm/cpu/tegra20-common/*   -> arch/arm/mach-tegra/tegra20/*
 arch/arm/cpu/tegra30-common/*   -> arch/arm/mach-tegra/tegra30/*
 arch/arm/cpu/tegra114-common/*  -> arch/arm/mach-tegra/tegra114/*
 arch/arm/cpu/tegra124-common/*  -> arch/arm/mach-tegra/tegra124/*
 arch/arm/cpu/tegra-common/* -> arch/arm/mach-tegra/*

Signed-off-by: Masahiro Yamada 
Cc: Stephen Warren 
Cc: Tom Warren 
Cc: Simon Glass 
---

 MAINTAINERS |  4 +---
 arch/arm/Kconfig|  2 +-
 arch/arm/Makefile   |  2 ++
 arch/arm/cpu/Makefile   |  6 +-
 arch/arm/cpu/arm720t/Makefile   |  6 --
 arch/arm/cpu/arm720t/tegra-common/Makefile  | 11 ---
 arch/arm/cpu/arm720t/tegra114/Makefile  | 21 -
 arch/arm/cpu/arm720t/tegra124/Makefile  |  8 
 arch/arm/cpu/arm720t/tegra20/Makefile   | 10 --
 arch/arm/cpu/arm720t/tegra30/Makefile   | 20 
 arch/arm/cpu/armv7/Makefile |  2 --
 arch/arm/cpu/armv7/tegra-common/Makefile| 10 --
 arch/arm/cpu/armv7/tegra20/Makefile | 11 ---
 .../{cpu/armv7/tegra-common => mach-tegra}/Kconfig  |  8 
 arch/arm/{cpu/tegra-common => mach-tegra}/Makefile  | 12 
 arch/arm/{cpu/tegra-common => mach-tegra}/ap.c  |  0
 arch/arm/{cpu/tegra-common => mach-tegra}/board.c   |  0
 arch/arm/{cpu/tegra-common => mach-tegra}/cache.c   |  0
 arch/arm/{cpu/tegra-common => mach-tegra}/clock.c   |  0
 .../tegra-common => mach-tegra}/cmd_enterrcm.c  |  0
 .../{cpu/arm720t/tegra-common => mach-tegra}/cpu.c  |  0
 .../{cpu/arm720t/tegra-common => mach-tegra}/cpu.h  |  0
 .../tegra-common => mach-tegra}/lowlevel_init.S |  0
 .../tegra-common => mach-tegra}/pinmux-common.c |  0
 .../{cpu/tegra-common => mach-tegra}/powergate.c|  0
 .../{cpu/arm720t/tegra-common => mach-tegra}/spl.c  |  0
 .../arm/{cpu/tegra-common => mach-tegra}/sys_info.c |  0
 arch/arm/{cpu/armv7 => mach-tegra}/tegra114/Kconfig |  0
 .../tegra114}/Makefile  |  5 ++---
 .../tegra114-common => mach-tegra/tegra114}/clock.c |  0
 arch/arm/{cpu/arm720t => mach-tegra}/tegra114/cpu.c |  2 +-
 .../tegra114}/funcmux.c |  0
 .../tegra114}/pinmux.c  |  0
 arch/arm/{cpu/armv7 => mach-tegra}/tegra124/Kconfig |  0
 .../tegra124}/Makefile  |  2 ++
 .../tegra124-common => mach-tegra/tegra124}/clock.c |  0
 arch/arm/{cpu/arm720t => mach-tegra}/tegra124/cpu.c |  2 +-
 .../tegra124}/funcmux.c |  0
 .../tegra124}/pinmux.c  |  0
 .../tegra124}/xusb-padctl.c |  0
 arch/arm/{cpu/armv7 => mach-tegra}/tegra20/Kconfig  |  0
 .../tegra20-common => mach-tegra/tegra20}/Makefile  | 10 +++---
 .../tegra20-common => mach-tegra/tegra20}/clock.c   |  0
 arch/arm/{cpu/arm720t => mach-tegra}/tegra20/cpu.c  |  2 +-
 .../tegra20-common => mach-tegra/tegra20}/crypto.c  |  0
 .../tegra20-common => mach-tegra/tegra20}/crypto.h  |  0
 .../arm/{cpu/armv7 => mach-tegra}/tegra20/display.c |  0
 .../tegra20-common => mach-tegra/tegra20}/emc.c |  0
 .../tegra20-common => mach-tegra/tegra20}/funcmux.c |  0
 .../tegra20-common => mach-tegra/tegra20}/pinmux.c  |  0
 .../tegra20-common => mach-tegra/tegra20}/pmu.c |  0
 arch/arm/{cpu/armv7 => mach-tegra}/tegra20/pwm.c|  0
 .../tegra20}/warmboot.c |  0
 .../tegra20}/warmboot_avp.c |  0
 .../tegra20}/warmboot_avp.h |  0
 arch/arm/{cpu/armv7 => mach-tegra}/tegra30/Kconfig  |  0
 .../tegra30-common => mach-tegra/tegra30}/Makefile  |  5 ++---
 .../tegra30-common => mach-tegra/tegra30}/clock.c   |  0
 arch/arm/{cpu/arm720t => mach-tegra}/tegra30/cpu.c  |  2 +-
 .../tegra30-common => mach-tegra/tegra30}/funcmux.c |  0
 .../tegra30-common => mach-tegra/tegra30}/pinmux.c  |  0
 arch/arm/{cpu/tegra-common => mach-tegra}/vpr.c |  0
 .../{cpu/tegra-common => mach-tegra}/xusb-padctl.c  |  0

[U-Boot] [RFC PATCH 07/21] ARM: kirkwood: move SOC sources to mach-kirkwood

2015-01-25 Thread Masahiro Yamada
Move
arch/arm/cpu/arm926ejs/kirkwood/* -> arch/arm/mach-kirkwood/*

Note:
 Perhaps, can we merge arch/arm/mach-kirkwood and
 arch/arm/mvebu-common into arch/arm/mach-mvebu, like Linux?

Signed-off-by: Masahiro Yamada 
Cc: Prafulla Wadaskar 
Cc: Luka Perkov 
Cc: Stefan Roese 
---

 MAINTAINERS | 2 +-
 arch/arm/Kconfig| 2 +-
 arch/arm/Makefile   | 2 ++
 arch/arm/cpu/arm926ejs/Makefile | 1 -
 arch/arm/{cpu/arm926ejs/kirkwood => mach-kirkwood}/Kconfig  | 0
 arch/arm/{cpu/arm926ejs/kirkwood => mach-kirkwood}/Makefile | 0
 arch/arm/{cpu/arm926ejs/kirkwood => mach-kirkwood}/cache.c  | 0
 arch/arm/{cpu/arm926ejs/kirkwood => mach-kirkwood}/cpu.c| 0
 arch/arm/{cpu/arm926ejs/kirkwood => mach-kirkwood}/mpp.c| 0
 9 files changed, 4 insertions(+), 3 deletions(-)
 rename arch/arm/{cpu/arm926ejs/kirkwood => mach-kirkwood}/Kconfig (100%)
 rename arch/arm/{cpu/arm926ejs/kirkwood => mach-kirkwood}/Makefile (100%)
 rename arch/arm/{cpu/arm926ejs/kirkwood => mach-kirkwood}/cache.c (100%)
 rename arch/arm/{cpu/arm926ejs/kirkwood => mach-kirkwood}/cpu.c (100%)
 rename arch/arm/{cpu/arm926ejs/kirkwood => mach-kirkwood}/mpp.c (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 697cc1b..84d5b05 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -99,7 +99,7 @@ M:Prafulla Wadaskar 
 M: Luka Perkov 
 S: Maintained
 T: git git://git.denx.de/u-boot-marvell.git
-F: arch/arm/cpu/arm926ejs/kirkwood/
+F: arch/arm/mach-kirkwood/
 F: arch/arm/include/asm/arch-kirkwood/
 
 ARM MARVELL PXA
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8cd7c14..961ab4d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -694,7 +694,7 @@ source "arch/arm/cpu/armv7/highbank/Kconfig"
 
 source "arch/arm/cpu/armv7/keystone/Kconfig"
 
-source "arch/arm/cpu/arm926ejs/kirkwood/Kconfig"
+source "arch/arm/mach-kirkwood/Kconfig"
 
 source "arch/arm/cpu/arm926ejs/nomadik/Kconfig"
 
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index b6e9323..7a244af 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -6,6 +6,8 @@
 # by CONFIG_* macro name.
 machine-$(CONFIG_ARCH_AT91)+= at91
 machine-$(CONFIG_ARCH_DAVINCI) += davinci
+# TODO: rename CONFIG_KIRKWOOD -> CONFIG_ARCH_KIRKWOOD
+machine-$(CONFIG_KIRKWOOD) += kirkwood
 # TODO: rename CONFIG_TEGRA -> CONFIG_ARCH_TEGRA
 machine-$(CONFIG_TEGRA)+= tegra
 machine-$(CONFIG_ARCH_UNIPHIER)+= uniphier
diff --git a/arch/arm/cpu/arm926ejs/Makefile b/arch/arm/cpu/arm926ejs/Makefile
index 27b4353..0b43a90 100644
--- a/arch/arm/cpu/arm926ejs/Makefile
+++ b/arch/arm/cpu/arm926ejs/Makefile
@@ -15,7 +15,6 @@ endif
 endif
 
 obj-$(CONFIG_ARMADA100) += armada100/
-obj-$(CONFIG_KIRKWOOD) += kirkwood/
 obj-$(if $(filter lpc32xx,$(SOC)),y) += lpc32xx/
 obj-$(CONFIG_MB86R0x) += mb86r0x/
 obj-$(CONFIG_MX25) += mx25/
diff --git a/arch/arm/cpu/arm926ejs/kirkwood/Kconfig 
b/arch/arm/mach-kirkwood/Kconfig
similarity index 100%
rename from arch/arm/cpu/arm926ejs/kirkwood/Kconfig
rename to arch/arm/mach-kirkwood/Kconfig
diff --git a/arch/arm/cpu/arm926ejs/kirkwood/Makefile 
b/arch/arm/mach-kirkwood/Makefile
similarity index 100%
rename from arch/arm/cpu/arm926ejs/kirkwood/Makefile
rename to arch/arm/mach-kirkwood/Makefile
diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cache.c 
b/arch/arm/mach-kirkwood/cache.c
similarity index 100%
rename from arch/arm/cpu/arm926ejs/kirkwood/cache.c
rename to arch/arm/mach-kirkwood/cache.c
diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c 
b/arch/arm/mach-kirkwood/cpu.c
similarity index 100%
rename from arch/arm/cpu/arm926ejs/kirkwood/cpu.c
rename to arch/arm/mach-kirkwood/cpu.c
diff --git a/arch/arm/cpu/arm926ejs/kirkwood/mpp.c 
b/arch/arm/mach-kirkwood/mpp.c
similarity index 100%
rename from arch/arm/cpu/arm926ejs/kirkwood/mpp.c
rename to arch/arm/mach-kirkwood/mpp.c
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 4/4] sunxi: video: Force h/vsync active high when using ext. vga dac

2015-01-25 Thread Hans de Goede
On both my A13-OLinuxIno and my A13-OLinuxIno-Micro, the vga output gives an
unstable image when active low v or hsync is used, so when an external vga dac
is used force v and hsync active high independent of what the modeline says.

This fixes the unstable image.

Signed-off-by: Hans de Goede 
---
 drivers/video/sunxi_display.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index af728b5..6b8845f 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -645,7 +645,8 @@ static int sunxi_lcdc_get_clk_delay(const struct 
ctfb_res_modes *mode)
return (delay > 30) ? 30 : delay;
 }
 
-static void sunxi_lcdc_tcon0_mode_set(const struct ctfb_res_modes *mode)
+static void sunxi_lcdc_tcon0_mode_set(const struct ctfb_res_modes *mode,
+ bool for_ext_vga_dac)
 {
struct sunxi_lcdc_reg * const lcdc =
(struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE;
@@ -719,6 +720,11 @@ static void sunxi_lcdc_tcon0_mode_set(const struct 
ctfb_res_modes *mode)
val |= SUNXI_LCDC_TCON_HSYNC_MASK;
if (!(mode->sync & FB_SYNC_VERT_HIGH_ACT))
val |= SUNXI_LCDC_TCON_VSYNC_MASK;
+
+   /* Some dacs do not work well with active low, so force syncs high */
+   if (for_ext_vga_dac)
+   val = 0;
+
writel(val, &lcdc->tcon0_io_polarity);
 
writel(0, &lcdc->tcon0_io_tristate);
@@ -1015,7 +1021,7 @@ static void sunxi_mode_set(const struct ctfb_res_modes 
*mode,
hitachi_tx18d42vm_init();
}
sunxi_composer_mode_set(mode, address);
-   sunxi_lcdc_tcon0_mode_set(mode);
+   sunxi_lcdc_tcon0_mode_set(mode, false);
sunxi_composer_enable();
sunxi_lcdc_enable();
 #ifdef CONFIG_VIDEO_LCD_SSD2828
@@ -1033,7 +1039,7 @@ static void sunxi_mode_set(const struct ctfb_res_modes 
*mode,
sunxi_vga_enable();
 #elif defined CONFIG_VIDEO_VGA_VIA_LCD
sunxi_composer_mode_set(mode, address);
-   sunxi_lcdc_tcon0_mode_set(mode);
+   sunxi_lcdc_tcon0_mode_set(mode, true);
sunxi_composer_enable();
sunxi_lcdc_enable();
sunxi_vga_external_dac_enable();
-- 
2.1.0

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/4] sunxi: Add a GMAC Transmit Clock Delay Chain Kconfig option

2015-01-25 Thread Hans de Goede
And use this to set the GMAC Transmit Clock Delay Chain value on Banana
boards, rather then keying of CONFIG_TARGET_FOO.

Signed-off-by: Hans de Goede 
---
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h |  2 ++
 arch/arm/include/asm/arch-sunxi/clock_sun6i.h |  2 ++
 board/sunxi/Kconfig   |  6 ++
 board/sunxi/gmac.c| 11 ++-
 configs/Bananapi_defconfig|  1 +
 configs/Bananapro_defconfig   |  1 +
 6 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun4i.h 
b/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
index 05fbad3..d297ed0 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
@@ -305,6 +305,8 @@ struct sunxi_ccm_reg {
 #define CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII 0x2
 #define CCM_GMAC_CTRL_GPIT_MII (0x0 << 2)
 #define CCM_GMAC_CTRL_GPIT_RGMII (0x1 << 2)
+#define CCM_GMAC_CTRL_RX_CLK_DELAY(x)  ((x) << 5)
+#define CCM_GMAC_CTRL_TX_CLK_DELAY(x)  ((x) << 10)
 
 #define CCM_USB_CTRL_PHY0_RST (0x1 << 0)
 #define CCM_USB_CTRL_PHY1_RST (0x1 << 1)
diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h 
b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
index e101c54..8a80385 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
@@ -243,6 +243,8 @@ struct sunxi_ccm_reg {
 #define CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII 0x2
 #define CCM_GMAC_CTRL_GPIT_MII (0x0 << 2)
 #define CCM_GMAC_CTRL_GPIT_RGMII   (0x1 << 2)
+#define CCM_GMAC_CTRL_RX_CLK_DELAY(x)  ((x) << 5)
+#define CCM_GMAC_CTRL_TX_CLK_DELAY(x)  ((x) << 10)
 
 #define MDFS_CLK_DEFAULT   0x8102 /* PLL6 / 3 */
 
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 648516e..561fd6b 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -385,4 +385,10 @@ config USB_KEYBOARD
Say Y here to add support for using a USB keyboard (typically used
in combination with a graphical console).
 
+config GMAC_TX_DELAY
+   int "GMAC Transmit Clock Delay Chain"
+   default 0
+   ---help---
+   Set the GMAC Transmit Clock Delay Chain value.
+
 endif
diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c
index 4e4615e..8849132 100644
--- a/board/sunxi/gmac.c
+++ b/board/sunxi/gmac.c
@@ -24,20 +24,13 @@ int sunxi_gmac_initialize(bd_t *bis)
 #ifdef CONFIG_RGMII
setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII |
CCM_GMAC_CTRL_GPIT_RGMII);
+   setbits_le32(&ccm->gmac_clk_cfg,
+CCM_GMAC_CTRL_TX_CLK_DELAY(CONFIG_GMAC_TX_DELAY));
 #else
setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_MII |
CCM_GMAC_CTRL_GPIT_MII);
 #endif
 
-   /*
-* In order for the gmac nic to work reliable on the Bananapi, we
-* need to set bits 10-12 GTXDC "GMAC Transmit Clock Delay Chain"
-* of the GMAC clk register to 3.
-*/
-#if defined CONFIG_TARGET_BANANAPI || defined CONFIG_TARGET_BANANAPRO
-   setbits_le32(&ccm->gmac_clk_cfg, 0x3 << 10);
-#endif
-
 #ifndef CONFIG_MACH_SUN6I
/* Configure pin mux settings for GMAC */
for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(16); pin++) {
diff --git a/configs/Bananapi_defconfig b/configs/Bananapi_defconfig
index d94e08e..4cff573 100644
--- a/configs/Bananapi_defconfig
+++ b/configs/Bananapi_defconfig
@@ -1,6 +1,7 @@
 CONFIG_SPL=y
 
CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI,USB_EHCI"
 CONFIG_FDTFILE="sun7i-a20-bananapi.dtb"
+CONFIG_GMAC_TX_DELAY=3
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
diff --git a/configs/Bananapro_defconfig b/configs/Bananapro_defconfig
index 02e4f3e..0512019 100644
--- a/configs/Bananapro_defconfig
+++ b/configs/Bananapro_defconfig
@@ -3,6 +3,7 @@ 
CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHC
 CONFIG_FDTFILE="sun7i-a20-bananapro.dtb"
 CONFIG_USB1_VBUS_PIN="PH0"
 CONFIG_USB2_VBUS_PIN="PH1"
+CONFIG_GMAC_TX_DELAY=3
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
-- 
2.1.0

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/4] sunxi: Remove CONFIG_TARGET_FOO for sun5i and sun7i boards

2015-01-25 Thread Hans de Goede
CONFIG_TARGET_FOO was only used in board/sunxi/Makefile to select the
dram config for sun5i and sun7i boards and in board/sunxi/gmac.c for some
special handling of the bananapi/bananapro (both sun7i), all sun5i and sun7i
boards have been moved over to using a single dram_sun5i_autoconfig file,
and the tx clk delay handling for the Banana boards now has its own Kconfig.

IOW nothing is using CONFIG_TARGET_FOO anymore, so remove it.

Signed-off-by: Hans de Goede 
---
 board/sunxi/Kconfig   | 82 ---
 configs/A10s-OLinuXino-M_defconfig|  1 -
 configs/A13-OLinuXinoM_defconfig  |  1 -
 configs/A13-OLinuXino_defconfig   |  1 -
 configs/A20-OLinuXino-Lime2_defconfig |  1 -
 configs/A20-OLinuXino-Lime_defconfig  |  1 -
 configs/A20-OLinuXino_MICRO_defconfig |  1 -
 configs/Auxtek-T004_defconfig |  1 -
 configs/Bananapi_defconfig|  1 -
 configs/Bananapro_defconfig   |  1 -
 configs/Cubieboard2_defconfig |  1 -
 configs/Cubietruck_defconfig  |  1 -
 configs/Ippo_q8h_v5_defconfig |  1 -
 configs/Linksprite_pcDuino3_defconfig |  1 -
 configs/Linksprite_pcDuino3_fdt_defconfig |  1 -
 configs/MSI_Primo73_defconfig |  9 +++-
 configs/Mele_M3_defconfig |  1 -
 configs/i12-tvbox_defconfig   |  1 -
 configs/mk802_a10s_defconfig  |  1 -
 configs/r7-tv-dongle_defconfig|  1 -
 20 files changed, 8 insertions(+), 101 deletions(-)

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 561fd6b..8b94311 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -69,88 +69,6 @@ config SYS_CONFIG_NAME
default "sun8i" if MACH_SUN8I
default "sun9i" if MACH_SUN9I
 
-choice
-   prompt "Board"
-
-config TARGET_A10S_OLINUXINO_M
-   bool "A10S_OLINUXINO_M"
-   depends on MACH_SUN5I
-
-config TARGET_A13_OLINUXINOM
-   bool "A13_OLINUXINOM"
-   depends on MACH_SUN5I
-
-config TARGET_A13_OLINUXINO
-   bool "A13_OLINUXINO"
-   depends on MACH_SUN5I
-
-config TARGET_A20_OLINUXINO_L2
-   bool "A20_OLINUXINO_L2"
-   depends on MACH_SUN7I
-
-config TARGET_A20_OLINUXINO_L
-   bool "A20_OLINUXINO_L"
-   depends on MACH_SUN7I
-
-config TARGET_A20_OLINUXINO_M
-   bool "A20_OLINUXINO_M"
-   depends on MACH_SUN7I
-
-config TARGET_AUXTEK_T004
-   bool "AUXTEK_T004"
-   depends on MACH_SUN5I
-
-config TARGET_BANANAPI
-   bool "BANANAPI"
-   depends on MACH_SUN7I
-
-config TARGET_BANANAPRO
-   bool "BANANAPRO"
-   depends on MACH_SUN7I
-
-config TARGET_CUBIEBOARD2
-   bool "CUBIEBOARD2"
-   depends on MACH_SUN7I
-
-config TARGET_CUBIETRUCK
-   bool "CUBIETRUCK"
-   depends on MACH_SUN7I
-
-config TARGET_PCDUINO3
-   bool "PCDUINO3"
-   depends on MACH_SUN7I
-
-config TARGET_MELE_M3
-   bool "MELE_M3"
-   depends on MACH_SUN7I
-
-config TARGET_MK802_A10S
-   bool "MK802_A10S"
-   depends on MACH_SUN5I
-
-config TARGET_MSI_PRIMO73
-   bool "MSI Primo73 (7\" tablet)"
-   depends on MACH_SUN7I
-   ---help---
-   The MSI Primo73 is an A20 based tablet, with 1G RAM, 16G NAND,
-   1024x600 TN LCD display, mono speaker, 0.3 MP front camera, 2.0 MP
-   rear camera, 3000 mAh battery, gt911 touchscreen, mma8452 accelerometer
-   and rtl8188etv usb wifi. Has "power", "volume+" and "volume-" buttons
-   (both volume buttons are also connected to the UBOOT_SEL pin). The
-   external connectors are represented by MicroSD slot, MiniHDMI, MicroUSB
-   OTG and 3.5mm headphone jack. More details are available at
-   http://linux-sunxi.org/MSI_Primo73
-
-config TARGET_I12_TVBOX
-   bool "I12_TVBOX"
-   depends on MACH_SUN7I
-
-config TARGET_R7DONGLE
-   bool "R7DONGLE"
-   depends on MACH_SUN5I
-
-endchoice
-
 config SYS_BOARD
default "sunxi"
 
diff --git a/configs/A10s-OLinuXino-M_defconfig 
b/configs/A10s-OLinuXino-M_defconfig
index 79a27db..b5f0a0f 100644
--- a/configs/A10s-OLinuXino-M_defconfig
+++ b/configs/A10s-OLinuXino-M_defconfig
@@ -8,7 +8,6 @@ CONFIG_USB1_VBUS_PIN="PB10"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
-+S:CONFIG_TARGET_A10S_OLINUXINO_M=y
 +S:CONFIG_DRAM_CLK=432
 +S:CONFIG_DRAM_ZQ=123
 +S:CONFIG_DRAM_EMR1=4
diff --git a/configs/A13-OLinuXinoM_defconfig b/configs/A13-OLinuXinoM_defconfig
index d392ec4..1c3fc3a 100644
--- a/configs/A13-OLinuXinoM_defconfig
+++ b/configs/A13-OLinuXinoM_defconfig
@@ -12,7 +12,6 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN5I=y
-+S:CONFIG_TARGET_A13_OLINUXINOM=y
 +S:CONFIG_DRAM_CLK=408
 +S:CONFIG_DRAM_ZQ=123
 +S:CONFIG_DRAM_EMR1=0
diff --git a/configs/A13-OLinuXino_defconfig b/configs/A13-OLinuXino_defconfig
index cf205a7..0de 100644
--- a/configs/A13-OLinuXino_defconfig
+++ b/configs/A13-OLinuXino_defconfig
@@ -12,7 +12,

[U-Boot] [PATCH 1/4] sunxi: Convert sun5i boards to use auto dram configuration

2015-01-25 Thread Hans de Goede
Currently we've separate detailed dram settings for all sun5i boards, this
moves them over to using auto dram configuration so that we can get rid of
all the per board dram_foo.c files.

This has been tested on a A10s-Olinuxino, A13-Olinuxino, A13-OlinuxinoM,
mk802-a10s and r7-tv-dongle board.

Signed-off-by: Hans de Goede 
---
 board/sunxi/Kconfig |  9 +++--
 board/sunxi/Makefile|  8 +---
 board/sunxi/dram_a10s_olinuxino_m.c | 31 ---
 board/sunxi/dram_a13_oli_micro.c| 32 
 board/sunxi/dram_a13_olinuxino.c| 31 ---
 board/sunxi/dram_bananapi.c | 31 ---
 board/sunxi/dram_r7dongle.c | 31 ---
 configs/A10s-OLinuXino-M_defconfig  |  3 +++
 configs/A13-OLinuXinoM_defconfig|  3 +++
 configs/A13-OLinuXino_defconfig |  3 +++
 configs/Auxtek-T004_defconfig   |  3 +++
 configs/r7-tv-dongle_defconfig  |  3 +++
 12 files changed, 19 insertions(+), 169 deletions(-)
 delete mode 100644 board/sunxi/dram_a10s_olinuxino_m.c
 delete mode 100644 board/sunxi/dram_a13_oli_micro.c
 delete mode 100644 board/sunxi/dram_a13_olinuxino.c
 delete mode 100644 board/sunxi/dram_bananapi.c
 delete mode 100644 board/sunxi/dram_r7dongle.c

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 11da4ef..648516e 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -43,16 +43,14 @@ config DRAM_CLK
default 360 if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
---help---
Set the dram clock speed, valid range 240 - 480, must be a multiple
-   of 24. Note on sun4i / sun5i / sun7i this is only used by boards
-   which use dram autoconfig.
+   of 24.
 
 config DRAM_ZQ
int "sunxi dram zq value"
default 123 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN8I
default 127 if MACH_SUN7I
---help---
-   Set the dram zq value. Note on sun4i / sun5i / sun7i this is only
-   used by boards which use dram autoconfig.
+   Set the dram zq value.
 
 if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
 config DRAM_EMR1
@@ -60,8 +58,7 @@ config DRAM_EMR1
default 0 if MACH_SUN4I
default 4 if MACH_SUN5I || MACH_SUN7I
---help---
-   Set the dram controller emr1 value. Note this is only used by boards
-   which use dram autoconfig.
+   Set the dram controller emr1 value.
 endif
 
 config SYS_CONFIG_NAME
diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index 71edb83..43766e0 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -12,11 +12,5 @@ obj-y+= board.o
 obj-$(CONFIG_SUNXI_GMAC)   += gmac.o
 obj-$(CONFIG_SUNXI_AHCI)   += ahci.o
 obj-$(CONFIG_MACH_SUN4I)   += dram_sun4i_auto.o
+obj-$(CONFIG_MACH_SUN5I)   += dram_sun5i_auto.o
 obj-$(CONFIG_MACH_SUN7I)   += dram_sun5i_auto.o
-obj-$(CONFIG_TARGET_A10S_OLINUXINO_M)  += dram_a10s_olinuxino_m.o
-obj-$(CONFIG_TARGET_A13_OLINUXINO) += dram_a13_olinuxino.o
-obj-$(CONFIG_TARGET_A13_OLINUXINOM)+= dram_a13_oli_micro.o
-# This is not a typo, uses the same mem settings as the a10s-olinuxino-m
-obj-$(CONFIG_TARGET_AUXTEK_T004)   += dram_a10s_olinuxino_m.o
-obj-$(CONFIG_TARGET_MK802_A10S)+= dram_sun5i_auto.o
-obj-$(CONFIG_TARGET_R7DONGLE)  += dram_r7dongle.o
diff --git a/board/sunxi/dram_a10s_olinuxino_m.c 
b/board/sunxi/dram_a10s_olinuxino_m.c
deleted file mode 100644
index 8900539..000
--- a/board/sunxi/dram_a10s_olinuxino_m.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* this file is generated, don't edit it yourself */
-
-#include 
-#include 
-
-static struct dram_para dram_para = {
-   .clock = 432,
-   .type = 3,
-   .rank_num = 1,
-   .density = 4096,
-   .io_width = 16,
-   .bus_width = 16,
-   .cas = 9,
-   .zq = 123,
-   .odt_en = 0,
-   .size = 512,
-   .tpr0 = 0x42d899b7,
-   .tpr1 = 0xa090,
-   .tpr2 = 0x22a00,
-   .tpr3 = 0,
-   .tpr4 = 0,
-   .tpr5 = 0,
-   .emr1 = 0x4,
-   .emr2 = 0x10,
-   .emr3 = 0,
-};
-
-unsigned long sunxi_dram_init(void)
-{
-   return dramc_init(&dram_para);
-}
diff --git a/board/sunxi/dram_a13_oli_micro.c b/board/sunxi/dram_a13_oli_micro.c
deleted file mode 100644
index 8154ea2..000
--- a/board/sunxi/dram_a13_oli_micro.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* this file is generated, don't edit it yourself */
-
-#include 
-#include 
-
-static struct dram_para dram_para = {
-   .clock = 408,
-   .type = 3,
-   .rank_num = 1,
-   .density = 2048,
-   .io_width = 16,
-   .bus_width = 16,
-   .cas = 9,
-   .zq = 123,
-   .odt_en = 0,
-   .size = 256,
-   .tpr0 = 0x42d899b7,
-   .tpr1 = 0xa090,
-   .tpr2 = 0x22a00,
-   .tpr3 = 0,
-   .tpr4 = 0,
-   .tpr5 = 0,
-   .emr1 = 0,
-   .emr2 = 0x10,
-   .emr3 = 0,
-
-};
-
-unsigned long sunxi_d

[U-Boot] [PATCH v3 0/26] dm: Add additional bus functionality

2015-01-25 Thread Simon Glass
The current bus implementation is simple but leaves some things to drivers
which are better handled in the uclass.

At present uclasses cannot provide a common way of dealing with children
(i.e. devices on the bus), so we have duplication in the drivers. The same
code is repeated in each driver when it would be better to put it in the
uclass.

Secondly, we don't have the concept of per-child platform data for devices
on the bus. Instead the per-child data can only exist when the child is
actually probed. This is not really suitable. Examples of things we want to
know before a child is probed are:

   - chip address (for I2C)
   - chip select (for SPI)
   - device address (for PCI)

These things are static and do not change when the device is probed and
removed. In some cases (such as SPI mode and maximum speed), the data may
be copied to run-time data when the device is probed. It may then be changed
while the driver is active, but the original platform data is never changed
by drivers once it is set up.

To address these issues, additional functions are added:

- per-child platform data, which can be defined by the uclass and (if
necessary) overriden by the bus driver. This allows the bus's uclass to
provide some consistency here
- per-child post-bind and pre-probe methods in the uclass. These allow the
bus uclass to set up the per-child platform data, and also to do any
last-minute adjustments before the child is probed.

With these changes, some code can be removed from the existing I2C and SPI
drivers and this has been done as part of this series.

With this series I2C and SPI are tested on:
- jetson-tk1 (Tegra 124)
- beaver (Tegra 30)
- seaboard (Tegra 20, I2C only)
- trimslice (Tegra 20, SPI only)
- snow (Exynos 5250)
- pit (Exynos 5420, note I2C probe is previously broken)
- link (x86)
- sandbox

Note: Some of these changes were previously included in the DM PCI RFC. This
series is available at u-boot-dm/i2c-working.

Changes in v3:
- Add missing 'static' to two functions
- Change variable name from parent_drv to uc_drv
- Fix comment to say 'node references' instead of 'phandles'
- Fix stale comment in device_probe_child()
- Fix typo in commit subject
- Remove unnecessary check that dev->parent_platdata is NULL
- Remove unnecessary per_child_auto_alloc_size value

Changes in v2:
- Add a TODO to remove struct dm_spi_bus
- Add additional comments to spi.h
- Add new patch to provide an offset length parameter where needed
- Add patches to tidy up cros_ec using new I2C/SPI features
- Copy max_hz and mode from platdata to spi_slave when probing
- Drop RFC prefix since this series has been properly tested now
- Tidy up soft_spi driver also
- Update commit message to describe immuatable platform data
- Update the spi-howto docs

Simon Glass (26):
  dm: i2c: Provide an offset length parameter where needed
  dm: Don't run tests if U-Boot cannot be built
  dm: core: Improve comments for uclass_first/next_device()
  dm: core: Set device tree node for root device
  dm: core: Tidy up error handling in device_bind()
  dm: core: Allocate platform data when binding a device
  dm: core: Allow parents to have platform data for their children
  dm: core: Allow uclasses to specify platdata for a device's children
  dm: core: Add a post_bind method for parents
  dm: core: Add a function to get a device's uclass ID
  dm: core: Add a flag to control sequence numbering
  dm: core: Allow uclasses to specify private data for a device's
children
  dm: spi: Move the per-child data size to the uclass
  dm: core: Allow the uclass to set up a device's child after binding
  dm: sandbox: sf: Tidy up the error handling in sandbox_sf_probe()
  dm: core: Allow uclass to set up a device's child before it is probed
  dm: spi: Set up the spi_slave device pointer in child_pre_probe()
  dm: spi: Move slave details to child platdata
  dm: i2c: Move slave details to child platdata
  dm: tegra: Drop unused COMPAT features for I2C, SPI
  dm: exynos: Drop unused COMPAT features for SPI
  dm: core: Ignore disabled devices when binding
  dm: cros_ec: Don't require protocol 3 support
  dm: cros_ec: Move cros_ec_i2c over to driver model
  dm: cros_ec_spi: Remove old pre-driver-model code
  dm: Update documentation for new bus features

 arch/arm/cpu/tegra20-common/pmu.c |   2 +-
 board/avionic-design/common/tamonten-ng.c |   2 +-
 board/nvidia/cardhu/cardhu.c  |   4 +-
 board/nvidia/dalmore/dalmore.c|   4 +-
 board/nvidia/whistler/whistler.c  |   4 +-
 board/toradex/apalis_t30/apalis_t30.c |   2 +-
 common/cmd_i2c.c  |   2 +-
 doc/driver-model/README.txt   |  91 +--
 doc/driver-model/spi-howto.txt|  40 -
 drivers/core/device-remove.c  |  16 +-
 drivers/core/device.c | 121 +++
 drivers/core/root.c   |   8 +
 drivers/core/uclass.c |  34 +++-
 drivers/i2c/i2c-ucl

[U-Boot] [PATCH v3 02/26] dm: Don't run tests if U-Boot cannot be built

2015-01-25 Thread Simon Glass
There is no point in running the tests if U-Boot cannot be built. Abort in
this case.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 test/dm/test-dm.sh | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/test/dm/test-dm.sh b/test/dm/test-dm.sh
index bb99677..8ebc392 100755
--- a/test/dm/test-dm.sh
+++ b/test/dm/test-dm.sh
@@ -1,9 +1,14 @@
 #!/bin/sh
 
+die() {
+   echo $1
+   exit 1
+}
+
 NUM_CPUS=$(cat /proc/cpuinfo |grep -c processor)
 dtc -I dts -O dtb test/dm/test.dts -o test/dm/test.dtb
-make O=sandbox sandbox_config
-make O=sandbox -s -j${NUM_CPUS}
+make O=sandbox sandbox_config || die "Cannot configure U-Boot"
+make O=sandbox -s -j${NUM_CPUS} || die "Cannot build U-Boot"
 dd if=/dev/zero of=spi.bin bs=1M count=2
 ./sandbox/u-boot -d test/dm/test.dtb -c "dm test"
 rm spi.bin
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 03/26] dm: core: Improve comments for uclass_first/next_device()

2015-01-25 Thread Simon Glass
Mention that the devices are probed ready for use.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 include/dm/uclass.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index f6ec6d7..2577ae6 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -141,6 +141,8 @@ int uclass_get_device_by_of_offset(enum uclass_id id, int 
node,
 /**
  * uclass_first_device() - Get the first device in a uclass
  *
+ * The device returned is probed if necessary, and ready for use
+ *
  * @id: Uclass ID to look up
  * @devp: Returns pointer to the first device in that uclass, or NULL if none
  * @return 0 if OK (found or not found), -1 on error
@@ -150,6 +152,8 @@ int uclass_first_device(enum uclass_id id, struct udevice 
**devp);
 /**
  * uclass_next_device() - Get the next device in a uclass
  *
+ * The device returned is probed if necessary, and ready for use
+ *
  * @devp: On entry, pointer to device to lookup. On exit, returns pointer
  * to the next device in the same uclass, or NULL if none
  * @return 0 if OK (found or not found), -1 on error
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 06/26] dm: core: Allocate platform data when binding a device

2015-01-25 Thread Simon Glass
When using allocated platform data, allocate it when we bind the device.
This makes it possible to fill in this information before the device is
probed.

This fits with the platform data model (when not using device tree),
since platform data exists at bind-time.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Fix stale comment in device_probe_child()

Changes in v2: None

 drivers/core/device-remove.c |  8 
 drivers/core/device.c| 22 +-
 test/dm/test-fdt.c   |  4 ++--
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 8fc6b71..2c82577 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -88,6 +88,10 @@ int device_unbind(struct udevice *dev)
if (ret)
return ret;
 
+   if (dev->flags & DM_FLAG_ALLOC_PDATA) {
+   free(dev->platdata);
+   dev->platdata = NULL;
+   }
ret = uclass_unbind_device(dev);
if (ret)
return ret;
@@ -111,10 +115,6 @@ void device_free(struct udevice *dev)
free(dev->priv);
dev->priv = NULL;
}
-   if (dev->flags & DM_FLAG_ALLOC_PDATA) {
-   free(dev->platdata);
-   dev->platdata = NULL;
-   }
size = dev->uclass->uc_drv->per_device_auto_alloc_size;
if (size) {
free(dev->uclass_priv);
diff --git a/drivers/core/device.c b/drivers/core/device.c
index eca8eda..366cffe 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -72,8 +72,14 @@ int device_bind(struct udevice *parent, struct driver *drv, 
const char *name,
 #else
dev->req_seq = -1;
 #endif
-   if (!dev->platdata && drv->platdata_auto_alloc_size)
+   if (!dev->platdata && drv->platdata_auto_alloc_size) {
dev->flags |= DM_FLAG_ALLOC_PDATA;
+   dev->platdata = calloc(1, drv->platdata_auto_alloc_size);
+   if (!dev->platdata) {
+   ret = -ENOMEM;
+   goto fail_alloc1;
+   }
+   }
 
/* put dev into parent's successor list */
if (parent)
@@ -103,6 +109,11 @@ fail_bind:
 fail_uclass_bind:
if (parent)
list_del(&dev->sibling_node);
+   if (dev->flags & DM_FLAG_ALLOC_PDATA) {
+   free(dev->platdata);
+   dev->platdata = NULL;
+   }
+fail_alloc1:
free(dev);
 
return ret;
@@ -139,7 +150,7 @@ int device_probe_child(struct udevice *dev, void 
*parent_priv)
drv = dev->driver;
assert(drv);
 
-   /* Allocate private data and platdata if requested */
+   /* Allocate private data if requested */
if (drv->priv_auto_alloc_size) {
dev->priv = calloc(1, drv->priv_auto_alloc_size);
if (!dev->priv) {
@@ -148,13 +159,6 @@ int device_probe_child(struct udevice *dev, void 
*parent_priv)
}
}
/* Allocate private data if requested */
-   if (dev->flags & DM_FLAG_ALLOC_PDATA) {
-   dev->platdata = calloc(1, drv->platdata_auto_alloc_size);
-   if (!dev->platdata) {
-   ret = -ENOMEM;
-   goto fail;
-   }
-   }
size = dev->uclass->uc_drv->per_device_auto_alloc_size;
if (size) {
dev->uclass_priv = calloc(1, size);
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index cd2c389..dc4ebf9 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -143,12 +143,12 @@ static int dm_test_fdt(struct dm_test_state *dms)
/* These are num_devices compatible root-level device tree nodes */
ut_asserteq(num_devices, list_count_items(&uc->dev_head));
 
-   /* Each should have no platdata / priv */
+   /* Each should have platform data but no private data */
for (i = 0; i < num_devices; i++) {
ret = uclass_find_device(UCLASS_TEST_FDT, i, &dev);
ut_assert(!ret);
ut_assert(!dev_get_priv(dev));
-   ut_assert(!dev->platdata);
+   ut_assert(dev->platdata);
}
 
ut_assertok(dm_check_devices(dms, num_devices));
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 01/26] dm: i2c: Provide an offset length parameter where needed

2015-01-25 Thread Simon Glass
Rather than assuming that the chip offset length is 1, allow it to be
provided. This allows chips that don't use the default offset length to
be used (at present they are only supported by the command line 'i2c'
command which sets the offset length explicitly).

Signed-off-by: Simon Glass 
Acked-by: Heiko Schocher 
---

Changes in v3: None
Changes in v2:
- Add new patch to provide an offset length parameter where needed

 arch/arm/cpu/tegra20-common/pmu.c |  2 +-
 board/avionic-design/common/tamonten-ng.c |  2 +-
 board/nvidia/cardhu/cardhu.c  |  4 ++--
 board/nvidia/dalmore/dalmore.c|  4 ++--
 board/nvidia/whistler/whistler.c  |  4 ++--
 board/toradex/apalis_t30/apalis_t30.c |  2 +-
 common/cmd_i2c.c  |  2 +-
 drivers/i2c/i2c-uclass.c  | 16 +---
 drivers/i2c/sandbox_i2c.c |  2 +-
 drivers/power/as3722.c|  2 +-
 include/i2c.h |  8 ++--
 test/dm/i2c.c | 10 +-
 12 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/arch/arm/cpu/tegra20-common/pmu.c 
b/arch/arm/cpu/tegra20-common/pmu.c
index 36a76a2..a774246 100644
--- a/arch/arm/cpu/tegra20-common/pmu.c
+++ b/arch/arm/cpu/tegra20-common/pmu.c
@@ -52,7 +52,7 @@ int pmu_set_nominal(void)
debug("%s: Cannot find DVC I2C bus\n", __func__);
return ret;
}
-   ret = i2c_get_chip(bus, PMI_I2C_ADDRESS, &dev);
+   ret = i2c_get_chip(bus, PMI_I2C_ADDRESS, 1, &dev);
if (ret) {
debug("%s: Cannot find DVC I2C chip\n", __func__);
return ret;
diff --git a/board/avionic-design/common/tamonten-ng.c 
b/board/avionic-design/common/tamonten-ng.c
index bca9183..1704627 100644
--- a/board/avionic-design/common/tamonten-ng.c
+++ b/board/avionic-design/common/tamonten-ng.c
@@ -55,7 +55,7 @@ void pmu_write(uchar reg, uchar data)
struct udevice *dev;
int ret;
 
-   ret = i2c_get_chip_for_busnum(4, PMU_I2C_ADDRESS, &dev);
+   ret = i2c_get_chip_for_busnum(4, PMU_I2C_ADDRESS, 1, &dev);
if (ret) {
debug("%s: Cannot find PMIC I2C chip\n", __func__);
return;
diff --git a/board/nvidia/cardhu/cardhu.c b/board/nvidia/cardhu/cardhu.c
index fc31d29..1540526 100644
--- a/board/nvidia/cardhu/cardhu.c
+++ b/board/nvidia/cardhu/cardhu.c
@@ -46,7 +46,7 @@ void board_sdmmc_voltage_init(void)
int ret;
int i;
 
-   ret = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, &dev);
+   ret = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, 1, &dev);
if (ret) {
debug("%s: Cannot find PMIC I2C chip\n", __func__);
return;
@@ -94,7 +94,7 @@ int tegra_pcie_board_init(void)
u8 addr, data[1];
int err;
 
-   err = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, &dev);
+   err = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, 1, &dev);
if (err) {
debug("failed to find PMU bus\n");
return err;
diff --git a/board/nvidia/dalmore/dalmore.c b/board/nvidia/dalmore/dalmore.c
index c0991c5..d7c1a69 100644
--- a/board/nvidia/dalmore/dalmore.c
+++ b/board/nvidia/dalmore/dalmore.c
@@ -55,7 +55,7 @@ void board_sdmmc_voltage_init(void)
uchar reg, data_buffer[1];
int ret;
 
-   ret = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, &dev);
+   ret = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, 1, &dev);
if (ret) {
debug("%s: Cannot find PMIC I2C chip\n", __func__);
return;
@@ -83,7 +83,7 @@ void board_sdmmc_voltage_init(void)
data_buffer[0] = 0x03;
reg = 0x14;
 
-   ret = i2c_get_chip_for_busnum(0, BAT_I2C_ADDRESS, &dev);
+   ret = i2c_get_chip_for_busnum(0, BAT_I2C_ADDRESS, 1, &dev);
if (ret) {
debug("%s: Cannot find charger I2C chip\n", __func__);
return;
diff --git a/board/nvidia/whistler/whistler.c b/board/nvidia/whistler/whistler.c
index ad6ea09..3476f11 100644
--- a/board/nvidia/whistler/whistler.c
+++ b/board/nvidia/whistler/whistler.c
@@ -27,7 +27,7 @@ void pin_mux_mmc(void)
int ret;
 
/* Turn on MAX8907B LDO12 to 2.8V for J40 power */
-   ret = i2c_get_chip_for_busnum(0, 0x3c, &dev);
+   ret = i2c_get_chip_for_busnum(0, 0x3c, 1, &dev);
if (ret) {
printf("%s: Cannot find MAX8907B I2C chip\n", __func__);
return;
@@ -64,7 +64,7 @@ void pin_mux_usb(void)
 */
 
/* Turn on TAC6416's GPIO 0+1 for USB1/3's VBUS */
-   ret = i2c_get_chip_for_busnum(0, 0x20, &dev);
+   ret = i2c_get_chip_for_busnum(0, 0x20, 1, &dev);
if (ret) {
printf("%s: Cannot find TAC6416 I2C chip\n", __func__);
return;
diff --git a/board/toradex/apalis_t30/apalis_t30.c 
b/board/toradex/apalis_t30/apalis_t30.c
index 1c4b4c1..6244214 100644
--- a/board/to

[U-Boot] [PATCH v3 04/26] dm: core: Set device tree node for root device

2015-01-25 Thread Simon Glass
The root device corresponds to the root device tree node, so set this up.
Also add a few notes to the documentation.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 doc/driver-model/README.txt | 4 
 drivers/core/root.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index eafa825..4041569 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -363,6 +363,10 @@ can leave out platdata_auto_alloc_size. In this case you 
can use malloc
 in your ofdata_to_platdata (or probe) method to allocate the required memory,
 and you should free it in the remove method.
 
+The driver model tree is intended to mirror that of the device tree. The
+root driver is at device tree offset 0 (the root node, '/'), and its
+children are the children of the root node.
+
 
 Declaring Uclasses
 --
diff --git a/drivers/core/root.c b/drivers/core/root.c
index 47b3acf..a5b0a61 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -49,6 +49,9 @@ int dm_init(void)
ret = device_bind_by_name(NULL, false, &root_info, &DM_ROOT_NON_CONST);
if (ret)
return ret;
+#ifdef CONFIG_OF_CONTROL
+   DM_ROOT_NON_CONST->of_offset = 0;
+#endif
ret = device_probe(DM_ROOT_NON_CONST);
if (ret)
return ret;
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 15/26] dm: sandbox: sf: Tidy up the error handling in sandbox_sf_probe()

2015-01-25 Thread Simon Glass
Use a single exit point when we have an error and add debugging there.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 drivers/mtd/spi/sandbox.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c
index 3024b98..106dda9 100644
--- a/drivers/mtd/spi/sandbox.c
+++ b/drivers/mtd/spi/sandbox.c
@@ -141,8 +141,10 @@ static int sandbox_sf_probe(struct udevice *dev)
assert(bus->seq != -1);
if (bus->seq < CONFIG_SANDBOX_SPI_MAX_BUS)
spec = state->spi[bus->seq][cs].spec;
-   if (!spec)
-   return -ENOENT;
+   if (!spec) {
+   ret = -ENOENT;
+   goto error;
+   }
 
file = strchr(spec, ':');
if (!file) {
@@ -196,6 +198,7 @@ static int sandbox_sf_probe(struct udevice *dev)
return 0;
 
  error:
+   debug("%s: Got error %d\n", __func__, ret);
return ret;
 }
 
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 09/26] dm: core: Add a post_bind method for parents

2015-01-25 Thread Simon Glass
Allow parent drivers to be called when a new child is bound to them. This
allows a bus to set up information it needs for that child.

Signed-off-by: Simon Glass 
Reviewed-by: Masahiro Yamada 
---

Changes in v3: None
Changes in v2: None

 drivers/core/device.c | 12 
 include/dm/device.h   |  2 ++
 test/dm/bus.c | 35 +++
 3 files changed, 49 insertions(+)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 2f33b0e..365676b 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -111,12 +111,24 @@ int device_bind(struct udevice *parent, struct driver 
*drv, const char *name,
if (ret)
goto fail_bind;
}
+   if (parent && parent->driver->child_post_bind) {
+   ret = parent->driver->child_post_bind(dev);
+   if (ret)
+   goto fail_child_post_bind;
+   }
+
if (parent)
dm_dbg("Bound device %s to %s\n", dev->name, parent->name);
*devp = dev;
 
return 0;
 
+fail_child_post_bind:
+   if (drv->unbind && drv->unbind(dev)) {
+   dm_warn("unbind() method failed on dev '%s' on error path\n",
+   dev->name);
+   }
+
 fail_bind:
if (uclass_unbind_device(dev)) {
dm_warn("Failed to unbind dev '%s' on error path\n",
diff --git a/include/dm/device.h b/include/dm/device.h
index 096d84b..50f1b4f 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -132,6 +132,7 @@ struct udevice_id {
  * @remove: Called to remove a device, i.e. de-activate it
  * @unbind: Called to unbind a device from its driver
  * @ofdata_to_platdata: Called before probe to decode device tree data
+ * @child_post_bind: Called after a new child has been bound
  * @child_pre_probe: Called before a child device is probed. The device has
  * memory allocated but it has not yet been probed.
  * @child_post_remove: Called after a child device is removed. The device
@@ -168,6 +169,7 @@ struct driver {
int (*remove)(struct udevice *dev);
int (*unbind)(struct udevice *dev);
int (*ofdata_to_platdata)(struct udevice *dev);
+   int (*child_post_bind)(struct udevice *dev);
int (*child_pre_probe)(struct udevice *dev);
int (*child_post_remove)(struct udevice *dev);
int priv_auto_alloc_size;
diff --git a/test/dm/bus.c b/test/dm/bus.c
index 26b8293..e18a6f7 100644
--- a/test/dm/bus.c
+++ b/test/dm/bus.c
@@ -17,6 +17,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 struct dm_test_parent_platdata {
int count;
+   int bind_flag;
 };
 
 enum {
@@ -31,6 +32,16 @@ static int testbus_drv_probe(struct udevice *dev)
return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
 }
 
+static int testbus_child_post_bind(struct udevice *dev)
+{
+   struct dm_test_parent_platdata *plat;
+
+   plat = dev_get_parent_platdata(dev);
+   plat->bind_flag = 1;
+
+   return 0;
+}
+
 static int testbus_child_pre_probe(struct udevice *dev)
 {
struct dm_test_parent_data *parent_data = dev_get_parentdata(dev);
@@ -64,6 +75,7 @@ U_BOOT_DRIVER(testbus_drv) = {
.of_match   = testbus_ids,
.id = UCLASS_TEST_BUS,
.probe  = testbus_drv_probe,
+   .child_post_bind = testbus_child_post_bind,
.priv_auto_alloc_size = sizeof(struct dm_test_priv),
.platdata_auto_alloc_size = sizeof(struct dm_test_pdata),
.per_child_auto_alloc_size = sizeof(struct dm_test_parent_data),
@@ -380,3 +392,26 @@ static int dm_test_bus_parent_platdata_uclass(struct 
dm_test_state *dms)
 }
 DM_TEST(dm_test_bus_parent_platdata_uclass,
DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test that the child post_bind method is called */
+static int dm_test_bus_child_post_bind(struct dm_test_state *dms)
+{
+   struct dm_test_parent_platdata *plat;
+   struct udevice *bus, *dev;
+   int child_count;
+
+   ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, &bus));
+   for (device_find_first_child(bus, &dev), child_count = 0;
+dev;
+device_find_next_child(&dev)) {
+   /* Check that platform data is allocated */
+   plat = dev_get_parent_platdata(dev);
+   ut_assert(plat != NULL);
+   ut_asserteq(1, plat->bind_flag);
+   child_count++;
+   }
+   ut_asserteq(3, child_count);
+
+   return 0;
+}
+DM_TEST(dm_test_bus_child_post_bind, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 08/26] dm: core: Allow uclasses to specify platdata for a device's children

2015-01-25 Thread Simon Glass
In many cases the child platform data for a device's children is defined by
the uclass rather than the individual devices. For example, a SPI bus needs
to know the chip select and speed for each of its children. It makes sense
to allow this information to be defined the SPI uclass rather than each
individual driver.

If the device provides a size value for its child platdata, then use it.
Failng that, fall back to that provided by the uclass.

Reviewed-by: Masahiro Yamada 
Signed-off-by: Simon Glass 
---

Changes in v3:
- Fix typo in commit subject

Changes in v2: None

 drivers/core/device.c |  4 
 include/dm/uclass.h   |  5 +
 test/dm/bus.c | 32 ++--
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index ee97cc8..2f33b0e 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -83,6 +83,10 @@ int device_bind(struct udevice *parent, struct driver *drv, 
const char *name,
if (parent) {
int size = parent->driver->per_child_platdata_auto_alloc_size;
 
+   if (!size) {
+   size = parent->uclass->uc_drv->
+   per_child_platdata_auto_alloc_size;
+   }
if (size) {
dev->flags |= DM_FLAG_ALLOC_PARENT_PDATA;
dev->parent_platdata = calloc(1, size);
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 2577ae6..7d92d34 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -60,6 +60,10 @@ struct udevice;
  * @per_device_auto_alloc_size: Each device can hold private data owned
  * by the uclass. If required this will be automatically allocated if this
  * value is non-zero.
+ * @per_child_platdata_auto_alloc_size: A bus likes to store information about
+ * its children. If non-zero this is the size of this data, to be allocated
+ * in the child device's parent_platdata pointer. This value is only used as
+ * a falback if this member is 0 in the driver.
  * @ops: Uclass operations, providing the consistent interface to devices
  * within the uclass.
  */
@@ -74,6 +78,7 @@ struct uclass_driver {
int (*destroy)(struct uclass *class);
int priv_auto_alloc_size;
int per_device_auto_alloc_size;
+   int per_child_platdata_auto_alloc_size;
const void *ops;
 };
 
diff --git a/test/dm/bus.c b/test/dm/bus.c
index 63c8a9f..26b8293 100644
--- a/test/dm/bus.c
+++ b/test/dm/bus.c
@@ -279,8 +279,7 @@ static int dm_test_bus_parent_ops(struct dm_test_state *dms)
 }
 DM_TEST(dm_test_bus_parent_ops, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
 
-/* Test that the bus can store platform data about each child */
-static int dm_test_bus_parent_platdata(struct dm_test_state *dms)
+static int test_bus_parent_platdata(struct dm_test_state *dms)
 {
struct dm_test_parent_platdata *plat;
struct udevice *bus, *dev;
@@ -351,4 +350,33 @@ static int dm_test_bus_parent_platdata(struct 
dm_test_state *dms)
 
return 0;
 }
+
+/* Test that the bus can store platform data about each child */
+static int dm_test_bus_parent_platdata(struct dm_test_state *dms)
+{
+   return test_bus_parent_platdata(dms);
+}
 DM_TEST(dm_test_bus_parent_platdata, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* As above but the size is controlled by the uclass */
+static int dm_test_bus_parent_platdata_uclass(struct dm_test_state *dms)
+{
+   struct udevice *bus;
+   int size;
+   int ret;
+
+   /* Set the driver size to 0 so that the uclass size is used */
+   ut_assertok(uclass_find_device(UCLASS_TEST_BUS, 0, &bus));
+   size = bus->driver->per_child_platdata_auto_alloc_size;
+   bus->uclass->uc_drv->per_child_platdata_auto_alloc_size = size;
+   bus->driver->per_child_platdata_auto_alloc_size = 0;
+   ret = test_bus_parent_platdata(dms);
+   if (ret)
+   return ret;
+   bus->uclass->uc_drv->per_child_platdata_auto_alloc_size = 0;
+   bus->driver->per_child_platdata_auto_alloc_size = size;
+
+   return 0;
+}
+DM_TEST(dm_test_bus_parent_platdata_uclass,
+   DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 07/26] dm: core: Allow parents to have platform data for their children

2015-01-25 Thread Simon Glass
For buses it is common for parents to need to know the address of the child
on the bus, the bus speed to use for that child, and other information. This
can be provided in platform data attached to each child.

Add driver model support for this, including auto-allocation which can be
requested using a new property to specify the size of the data.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Remove unnecessary check that dev->parent_platdata is NULL

Changes in v2: None

 drivers/core/device-remove.c |  4 +++
 drivers/core/device.c| 30 ++--
 include/dm/device.h  | 19 +++
 test/dm/bus.c| 81 
 4 files changed, 132 insertions(+), 2 deletions(-)

diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 2c82577..56c358a 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -92,6 +92,10 @@ int device_unbind(struct udevice *dev)
free(dev->platdata);
dev->platdata = NULL;
}
+   if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) {
+   free(dev->parent_platdata);
+   dev->parent_platdata = NULL;
+   }
ret = uclass_unbind_device(dev);
if (ret)
return ret;
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 366cffe..ee97cc8 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -80,6 +80,18 @@ int device_bind(struct udevice *parent, struct driver *drv, 
const char *name,
goto fail_alloc1;
}
}
+   if (parent) {
+   int size = parent->driver->per_child_platdata_auto_alloc_size;
+
+   if (size) {
+   dev->flags |= DM_FLAG_ALLOC_PARENT_PDATA;
+   dev->parent_platdata = calloc(1, size);
+   if (!dev->parent_platdata) {
+   ret = -ENOMEM;
+   goto fail_alloc2;
+   }
+   }
+   }
 
/* put dev into parent's successor list */
if (parent)
@@ -107,8 +119,12 @@ fail_bind:
dev->name);
}
 fail_uclass_bind:
-   if (parent)
-   list_del(&dev->sibling_node);
+   list_del(&dev->sibling_node);
+   if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) {
+   free(dev->parent_platdata);
+   dev->parent_platdata = NULL;
+   }
+fail_alloc2:
if (dev->flags & DM_FLAG_ALLOC_PDATA) {
free(dev->platdata);
dev->platdata = NULL;
@@ -247,6 +263,16 @@ void *dev_get_platdata(struct udevice *dev)
return dev->platdata;
 }
 
+void *dev_get_parent_platdata(struct udevice *dev)
+{
+   if (!dev) {
+   dm_warn("%s: null device", __func__);
+   return NULL;
+   }
+
+   return dev->parent_platdata;
+}
+
 void *dev_get_priv(struct udevice *dev)
 {
if (!dev) {
diff --git a/include/dm/device.h b/include/dm/device.h
index 13598a1..096d84b 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -26,6 +26,9 @@ struct driver_info;
 /* DM should init this device prior to relocation */
 #define DM_FLAG_PRE_RELOC  (1 << 2)
 
+/* DM is responsible for allocating and freeing parent_platdata */
+#define DM_FLAG_ALLOC_PARENT_PDATA (1 << 3)
+
 /**
  * struct udevice - An instance of a driver
  *
@@ -46,6 +49,7 @@ struct driver_info;
  * @driver: The driver used by this device
  * @name: Name of device, typically the FDT node name
  * @platdata: Configuration data for this device
+ * @parent_platdata: The parent bus's configuration data for this device
  * @of_offset: Device tree node offset for this device (- for none)
  * @of_id: Pointer to the udevice_id structure which created the device
  * @parent: Parent of this device, or NULL for the top level device
@@ -65,6 +69,7 @@ struct udevice {
struct driver *driver;
const char *name;
void *platdata;
+   void *parent_platdata;
int of_offset;
const struct udevice_id *of_id;
struct udevice *parent;
@@ -146,6 +151,9 @@ struct udevice_id {
  * device_probe_child() pass it in. So far the use case for allocating it
  * is SPI, but I found that unsatisfactory. Since it is here I will leave it
  * until things are clearer.
+ * @per_child_platdata_auto_alloc_size: A bus likes to store information about
+ * its children. If non-zero this is the size of this data, to be allocated
+ * in the child's parent_platdata pointer.
  * @ops: Driver-specific operations. This is typically a list of function
  * pointers defined by the driver, to implement driver functions required by
  * the uclass.
@@ -165,6 +173,7 @@ struct driver {
int priv_auto_alloc_size;
int platdata_auto_alloc_size;
int per_child_auto_alloc_size;
+   int per_child_platdata_auto_alloc_size;
const void *ops; 

[U-Boot] [PATCH v3 05/26] dm: core: Tidy up error handling in device_bind()

2015-01-25 Thread Simon Glass
Make the error handling more standard to make it easier to build on top of
it. Also correct a bug in the error path where there is no parent.

Signed-off-by: Simon Glass 
Reviewed-by: Masahiro Yamada 
---

Changes in v3: None
Changes in v2: None

 drivers/core/device.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 963b16f..eca8eda 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -81,18 +81,13 @@ int device_bind(struct udevice *parent, struct driver *drv, 
const char *name,
 
ret = uclass_bind_device(dev);
if (ret)
-   goto fail_bind;
+   goto fail_uclass_bind;
 
/* if we fail to bind we remove device from successors and free it */
if (drv->bind) {
ret = drv->bind(dev);
-   if (ret) {
-   if (uclass_unbind_device(dev)) {
-   dm_warn("Failed to unbind dev '%s' on error 
path\n",
-   dev->name);
-   }
+   if (ret)
goto fail_bind;
-   }
}
if (parent)
dm_dbg("Bound device %s to %s\n", dev->name, parent->name);
@@ -101,8 +96,15 @@ int device_bind(struct udevice *parent, struct driver *drv, 
const char *name,
return 0;
 
 fail_bind:
-   list_del(&dev->sibling_node);
+   if (uclass_unbind_device(dev)) {
+   dm_warn("Failed to unbind dev '%s' on error path\n",
+   dev->name);
+   }
+fail_uclass_bind:
+   if (parent)
+   list_del(&dev->sibling_node);
free(dev);
+
return ret;
 }
 
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 20/26] dm: tegra: Drop unused COMPAT features for I2C, SPI

2015-01-25 Thread Simon Glass
These have moved to driver model so we don't need the fdtdec support.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 include/fdtdec.h | 6 --
 lib/fdtdec.c | 6 --
 2 files changed, 12 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index f0d2412..094a8e3 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -115,9 +115,6 @@ enum fdt_compat_id {
COMPAT_NVIDIA_TEGRA20_USB,  /* Tegra20 USB port */
COMPAT_NVIDIA_TEGRA30_USB,  /* Tegra30 USB port */
COMPAT_NVIDIA_TEGRA114_USB, /* Tegra114 USB port */
-   COMPAT_NVIDIA_TEGRA114_I2C, /* Tegra114 I2C w/single clock source */
-   COMPAT_NVIDIA_TEGRA20_I2C,  /* Tegra20 i2c */
-   COMPAT_NVIDIA_TEGRA20_DVC,  /* Tegra20 dvc (really just i2c) */
COMPAT_NVIDIA_TEGRA20_EMC,  /* Tegra20 memory controller */
COMPAT_NVIDIA_TEGRA20_EMC_TABLE, /* Tegra20 memory timing table */
COMPAT_NVIDIA_TEGRA20_KBC,  /* Tegra20 Keyboard */
@@ -127,9 +124,6 @@ enum fdt_compat_id {
COMPAT_NVIDIA_TEGRA124_SDMMC,   /* Tegra124 SDMMC controller */
COMPAT_NVIDIA_TEGRA30_SDMMC,/* Tegra30 SDMMC controller */
COMPAT_NVIDIA_TEGRA20_SDMMC,/* Tegra20 SDMMC controller */
-   COMPAT_NVIDIA_TEGRA20_SFLASH,   /* Tegra 2 SPI flash controller */
-   COMPAT_NVIDIA_TEGRA20_SLINK,/* Tegra 2 SPI SLINK controller */
-   COMPAT_NVIDIA_TEGRA114_SPI, /* Tegra 114 SPI controller */
COMPAT_NVIDIA_TEGRA124_PCIE,/* Tegra 124 PCIe controller */
COMPAT_NVIDIA_TEGRA30_PCIE, /* Tegra 30 PCIe controller */
COMPAT_NVIDIA_TEGRA20_PCIE, /* Tegra 20 PCIe controller */
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index fe30305..5c79afd 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -24,9 +24,6 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(NVIDIA_TEGRA20_USB, "nvidia,tegra20-ehci"),
COMPAT(NVIDIA_TEGRA30_USB, "nvidia,tegra30-ehci"),
COMPAT(NVIDIA_TEGRA114_USB, "nvidia,tegra114-ehci"),
-   COMPAT(NVIDIA_TEGRA114_I2C, "nvidia,tegra114-i2c"),
-   COMPAT(NVIDIA_TEGRA20_I2C, "nvidia,tegra20-i2c"),
-   COMPAT(NVIDIA_TEGRA20_DVC, "nvidia,tegra20-i2c-dvc"),
COMPAT(NVIDIA_TEGRA20_EMC, "nvidia,tegra20-emc"),
COMPAT(NVIDIA_TEGRA20_EMC_TABLE, "nvidia,tegra20-emc-table"),
COMPAT(NVIDIA_TEGRA20_KBC, "nvidia,tegra20-kbc"),
@@ -36,9 +33,6 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(NVIDIA_TEGRA124_SDMMC, "nvidia,tegra124-sdhci"),
COMPAT(NVIDIA_TEGRA30_SDMMC, "nvidia,tegra30-sdhci"),
COMPAT(NVIDIA_TEGRA20_SDMMC, "nvidia,tegra20-sdhci"),
-   COMPAT(NVIDIA_TEGRA20_SFLASH, "nvidia,tegra20-sflash"),
-   COMPAT(NVIDIA_TEGRA20_SLINK, "nvidia,tegra20-slink"),
-   COMPAT(NVIDIA_TEGRA114_SPI, "nvidia,tegra114-spi"),
COMPAT(NVIDIA_TEGRA124_PCIE, "nvidia,tegra124-pcie"),
COMPAT(NVIDIA_TEGRA30_PCIE, "nvidia,tegra30-pcie"),
COMPAT(NVIDIA_TEGRA20_PCIE, "nvidia,tegra20-pcie"),
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 11/26] dm: core: Add a flag to control sequence numbering

2015-01-25 Thread Simon Glass
At present we try to use the 'reg' property and device tree aliases to give
devices a sequence number. The 'reg' property is often actually a memory
address, so the sequence numbers thus-obtained are not useful. It would be
better if the devices were just sequentially numbered in that case. In fact
neither I2C nor SPI use this feature, so drop it.

Some devices need us to look up an alias to number them within the uclass.
Add a flag to control this, so it is not done unless it is needed.

Adjust the tests to test this new behaviour.

Signed-off-by: Simon Glass 
Reviewed-by: Masahiro Yamada 
---

Changes in v3:
- Fix comment to say 'node references' instead of 'phandles'

Changes in v2: None

 doc/driver-model/README.txt| 51 +++---
 drivers/core/device.c  | 28 +++
 drivers/i2c/i2c-uclass.c   |  1 +
 drivers/serial/serial-uclass.c |  1 +
 drivers/spi/spi-uclass.c   |  1 +
 include/dm/uclass.h|  5 +
 test/dm/bus.c  |  3 ++-
 test/dm/test-fdt.c |  9 
 test/dm/test.dts   | 16 +
 9 files changed, 57 insertions(+), 58 deletions(-)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index 4041569..0c1292b 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -388,12 +388,12 @@ Device Sequence Numbers
 U-Boot numbers devices from 0 in many situations, such as in the command
 line for I2C and SPI buses, and the device names for serial ports (serial0,
 serial1, ...). Driver model supports this numbering and permits devices
-to be locating by their 'sequence'. This numbering unique identifies a
+to be locating by their 'sequence'. This numbering uniquely identifies a
 device in its uclass, so no two devices within a particular uclass can have
 the same sequence number.
 
 Sequence numbers start from 0 but gaps are permitted. For example, a board
-may have I2C buses 0, 1, 4, 5 but no 2 or 3. The choice of how devices are
+may have I2C buses 1, 4, 5 but no 0, 2 or 3. The choice of how devices are
 numbered is up to a particular board, and may be set by the SoC in some
 cases. While it might be tempting to automatically renumber the devices
 where there are gaps in the sequence, this can lead to confusion and is
@@ -403,7 +403,7 @@ Each device can request a sequence number. If none is 
required then the
 device will be automatically allocated the next available sequence number.
 
 To specify the sequence number in the device tree an alias is typically
-used.
+used. Make sure that the uclass has the DM_UC_FLAG_SEQ_ALIAS flag set.
 
 aliases {
serial2 = "/serial@2223";
@@ -413,43 +413,18 @@ This indicates that in the uclass called "serial", the 
named node
 ("/serial@2223") will be given sequence number 2. Any command or driver
 which requests serial device 2 will obtain this device.
 
-Some devices represent buses where the devices on the bus are numbered or
-addressed. For example, SPI typically numbers its slaves from 0, and I2C
-uses a 7-bit address. In these cases the 'reg' property of the subnode is
-used, for example:
+More commonly you can use node references, which expand to the full path:
 
-{
-   aliases {
-   spi2 = "/spi@2230";
-   };
-
-   spi@2230 {
-   #address-cells = <1>;
-   #size-cells = <1>;
-   spi-flash@0 {
-   reg = <0>;
-   ...
-   }
-   eeprom@1 {
-   reg = <1>;
-   };
-   };
-
-In this case we have a SPI bus with two slaves at 0 and 1. The SPI bus
-itself is numbered 2. So we might access the SPI flash with:
-
-   sf probe 2:0
-
-and the eeprom with
-
-   sspi 2:1 32 ef
-
-These commands simply need to look up the 2nd device in the SPI uclass to
-find the right SPI bus. Then, they look at the children of that bus for the
-right sequence number (0 or 1 in this case).
+aliases {
+   serial2 = &serial_2;
+};
+...
+serial_2: serial@2223 {
+...
+};
 
-Typically the alias method is used for top-level nodes and the 'reg' method
-is used only for buses.
+The alias resolves to the same string in this case, but this version is
+easier to read.
 
 Device sequence numbers are resolved when a device is probed. Before then
 the sequence number is only a request which may or may not be honoured,
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 2606d18..f78b78a 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -53,24 +53,22 @@ int device_bind(struct udevice *parent, struct driver *drv, 
const char *name,
dev->driver = drv;
dev->uclass = uc;
 
-   /*
-* For some devices, such as a SPI or I2C bus, the 'reg' property
-* is a reasonable indicator of the sequence number. But if there is
-* an alias, we use that in preference. In any case, this is just
- 

[U-Boot] [PATCH v3 18/26] dm: spi: Move slave details to child platdata

2015-01-25 Thread Simon Glass
At present we go through various contortions to store the SPI slave's chip
select in its private data. This only exists when the slave is active so
must be set up when it is probed. Until the device is probed we don't
actually know what chip select it will appear on.

However, now that we can support per-child platform data, we can use that
instead. This allows us to set up the chip select when the child is bound,
and avoid the messy contortions.

Unfortunately this is a fairly large change and it seems to be difficult to
break it down further.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Add a TODO to remove struct dm_spi_bus
- Add additional comments to spi.h
- Copy max_hz and mode from platdata to spi_slave when probing
- Tidy up soft_spi driver also

 drivers/misc/cros_ec_spi.c | 19 ---
 drivers/mtd/spi/sandbox.c  |  5 +++
 drivers/mtd/spi/sf_probe.c |  3 +-
 drivers/spi/soft_spi.c |  9 -
 drivers/spi/spi-uclass.c   | 83 +++---
 include/spi.h  | 42 +--
 test/dm/spi.c  |  6 ++--
 7 files changed, 91 insertions(+), 76 deletions(-)

diff --git a/drivers/misc/cros_ec_spi.c b/drivers/misc/cros_ec_spi.c
index e6dba29..25a5a04 100644
--- a/drivers/misc/cros_ec_spi.c
+++ b/drivers/misc/cros_ec_spi.c
@@ -202,25 +202,6 @@ int cros_ec_spi_init(struct cros_ec_dev *dev, const void 
*blob)
 #ifdef CONFIG_DM_CROS_EC
 int cros_ec_probe(struct udevice *dev)
 {
-   struct spi_slave *slave = dev_get_parentdata(dev);
-   int ret;
-
-   /*
-* TODO(s...@chromium.org)
-*
-* This is really horrible at present. It is an artifact of removing
-* the child_pre_probe() method for SPI. Everything here could go in
-* an automatic function, except that spi_get_bus_and_cs() wants to
-* set it up manually and call device_probe_child().
-*
-* The solution may be to re-enable the child_pre_probe() method for
-* SPI and have it do nothing if the child is already passed in via
-* device_probe_child().
-*/
-   slave->dev = dev;
-   ret = spi_ofdata_to_platdata(gd->fdt_blob, dev->of_offset, slave);
-   if (ret)
-   return ret;
return cros_ec_register(dev);
 }
 
diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c
index 106dda9..d576d31 100644
--- a/drivers/mtd/spi/sandbox.c
+++ b/drivers/mtd/spi/sandbox.c
@@ -590,6 +590,11 @@ int sandbox_sf_bind_emul(struct sandbox_state *state, int 
busnum, int cs,
 
 void sandbox_sf_unbind_emul(struct sandbox_state *state, int busnum, int cs)
 {
+   struct udevice *dev;
+
+   dev = state->spi[busnum][cs].emul;
+   device_remove(dev);
+   device_unbind(dev);
state->spi[busnum][cs].emul = NULL;
 }
 
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index ce9987f..4103723 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -481,11 +481,12 @@ int spi_flash_std_erase(struct udevice *dev, u32 offset, 
size_t len)
 int spi_flash_std_probe(struct udevice *dev)
 {
struct spi_slave *slave = dev_get_parentdata(dev);
+   struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
struct spi_flash *flash;
 
flash = dev->uclass_priv;
flash->dev = dev;
-   debug("%s: slave=%p, cs=%d\n", __func__, slave, slave->cs);
+   debug("%s: slave=%p, cs=%d\n", __func__, slave, plat->cs);
return spi_flash_probe_slave(slave, flash);
 }
 
diff --git a/drivers/spi/soft_spi.c b/drivers/spi/soft_spi.c
index 9f7d80e..6ae45f5 100644
--- a/drivers/spi/soft_spi.c
+++ b/drivers/spi/soft_spi.c
@@ -179,14 +179,6 @@ static int soft_spi_set_mode(struct udevice *dev, unsigned 
int mode)
return 0;
 }
 
-static int soft_spi_child_pre_probe(struct udevice *dev)
-{
-   struct spi_slave *slave = dev_get_parentdata(dev);
-
-   slave->dev = dev;
-   return spi_ofdata_to_platdata(gd->fdt_blob, dev->of_offset, slave);
-}
-
 static const struct dm_spi_ops soft_spi_ops = {
.claim_bus  = soft_spi_claim_bus,
.release_bus= soft_spi_release_bus,
@@ -241,5 +233,4 @@ U_BOOT_DRIVER(soft_spi) = {
.platdata_auto_alloc_size = sizeof(struct soft_spi_platdata),
.priv_auto_alloc_size = sizeof(struct soft_spi_priv),
.probe  = soft_spi_probe,
-   .child_pre_probe= soft_spi_child_pre_probe,
 };
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 2c134eb..63a6217 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -98,11 +98,21 @@ int spi_post_bind(struct udevice *dev)
return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
 }
 
-int spi_post_probe(struct udevice *dev)
+int spi_child_post_bind(struct udevice *dev)
 {
-   struct dm_spi_bus *spi = dev->uclass_priv;
+   struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
 
- 

[U-Boot] [PATCH v3 12/26] dm: core: Allow uclasses to specify private data for a device's children

2015-01-25 Thread Simon Glass
In many cases the per-child private data for a device's children is defined
by the uclass rather than the individual driver. For example, a SPI bus
needs to store information about each of its children, but all SPI drivers
store the same information. It makes sense to allow the uclass to define
this data.

If the driver provides a size value for its per-child private data, then use
it. Failng that, fall back to that provided by the uclass.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Fix typo in commit subject

Changes in v2: None

 drivers/core/device-remove.c |  4 
 drivers/core/device.c|  4 
 include/dm/uclass.h  |  4 
 test/dm/bus.c| 31 +--
 4 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 56c358a..3a5f48d 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -126,6 +126,10 @@ void device_free(struct udevice *dev)
}
if (dev->parent) {
size = dev->parent->driver->per_child_auto_alloc_size;
+   if (!size) {
+   size = dev->parent->uclass->uc_drv->
+   per_child_auto_alloc_size;
+   }
if (size) {
free(dev->parent_priv);
dev->parent_priv = NULL;
diff --git a/drivers/core/device.c b/drivers/core/device.c
index f78b78a..78bc460 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -201,6 +201,10 @@ int device_probe_child(struct udevice *dev, void 
*parent_priv)
/* Ensure all parents are probed */
if (dev->parent) {
size = dev->parent->driver->per_child_auto_alloc_size;
+   if (!size) {
+   size = dev->parent->uclass->uc_drv->
+   per_child_auto_alloc_size;
+   }
if (size) {
dev->parent_priv = calloc(1, size);
if (!dev->parent_priv) {
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 9000b22..ac6c850 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -63,6 +63,9 @@ struct udevice;
  * @per_device_auto_alloc_size: Each device can hold private data owned
  * by the uclass. If required this will be automatically allocated if this
  * value is non-zero.
+ * @per_child_auto_alloc_size: Each child device (of a parent in this
+ * uclass) can hold parent data for the device/uclass. This value is only
+ * used as a falback if this member is 0 in the driver.
  * @per_child_platdata_auto_alloc_size: A bus likes to store information about
  * its children. If non-zero this is the size of this data, to be allocated
  * in the child device's parent_platdata pointer. This value is only used as
@@ -82,6 +85,7 @@ struct uclass_driver {
int (*destroy)(struct uclass *class);
int priv_auto_alloc_size;
int per_device_auto_alloc_size;
+   int per_child_auto_alloc_size;
int per_child_platdata_auto_alloc_size;
const void *ops;
uint32_t flags;
diff --git a/test/dm/bus.c b/test/dm/bus.c
index 972c449..e909697 100644
--- a/test/dm/bus.c
+++ b/test/dm/bus.c
@@ -192,7 +192,7 @@ DM_TEST(dm_test_bus_children_iterators,
DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
 
 /* Test that the bus can store data about each child */
-static int dm_test_bus_parent_data(struct dm_test_state *dms)
+static int test_bus_parent_data(struct dm_test_state *dms)
 {
struct dm_test_parent_data *parent_data;
struct udevice *bus, *dev;
@@ -251,9 +251,36 @@ static int dm_test_bus_parent_data(struct dm_test_state 
*dms)
 
return 0;
 }
-
+/* Test that the bus can store data about each child */
+static int dm_test_bus_parent_data(struct dm_test_state *dms)
+{
+   return test_bus_parent_data(dms);
+}
 DM_TEST(dm_test_bus_parent_data, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
 
+/* As above but the size is controlled by the uclass */
+static int dm_test_bus_parent_data_uclass(struct dm_test_state *dms)
+{
+   struct udevice *bus;
+   int size;
+   int ret;
+
+   /* Set the driver size to 0 so that the uclass size is used */
+   ut_assertok(uclass_find_device(UCLASS_TEST_BUS, 0, &bus));
+   size = bus->driver->per_child_auto_alloc_size;
+   bus->uclass->uc_drv->per_child_auto_alloc_size = size;
+   bus->driver->per_child_auto_alloc_size = 0;
+   ret = test_bus_parent_data(dms);
+   if (ret)
+   return ret;
+   bus->uclass->uc_drv->per_child_auto_alloc_size = 0;
+   bus->driver->per_child_auto_alloc_size = size;
+
+   return 0;
+}
+DM_TEST(dm_test_bus_parent_data_uclass,
+   DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
 /* Test that the bus ops are called when a child is probed/removed */
 static int dm_test_bus_parent_ops(struct dm_test_state *dms)
 {
-- 
2.2.0.

[U-Boot] [PATCH v3 24/26] dm: cros_ec: Move cros_ec_i2c over to driver model

2015-01-25 Thread Simon Glass
Update the driver model support, and remove the old code. Change snow to
use this new support.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Add patches to tidy up cros_ec using new I2C/SPI features

 drivers/misc/cros_ec_i2c.c | 107 +
 include/configs/snow.h |   5 +++
 2 files changed, 45 insertions(+), 67 deletions(-)

diff --git a/drivers/misc/cros_ec_i2c.c b/drivers/misc/cros_ec_i2c.c
index 513cdb1..c9d1b49 100644
--- a/drivers/misc/cros_ec_i2c.c
+++ b/drivers/misc/cros_ec_i2c.c
@@ -14,20 +14,16 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 
-#ifdef DEBUG_TRACE
-#define debug_trace(fmt, b...) debug(fmt, #b)
-#else
-#define debug_trace(fmt, b...)
-#endif
-
-int cros_ec_i2c_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
+int cros_ec_i2c_command(struct udevice *udev, uint8_t cmd, int cmd_version,
 const uint8_t *dout, int dout_len,
 uint8_t **dinp, int din_len)
 {
-   int old_bus = 0;
+   struct cros_ec_dev *dev = udev->uclass_priv;
/* version8, cmd8, arglen8, out8[dout_len], csum8 */
int out_bytes = dout_len + 4;
/* response8, arglen8, in8[din_len], checksum8 */
@@ -37,19 +33,17 @@ int cros_ec_i2c_command(struct cros_ec_dev *dev, uint8_t 
cmd, int cmd_version,
uint8_t *in_ptr;
int len, csum, ret;
 
-   old_bus = i2c_get_bus_num();
-
/*
 * Sanity-check I/O sizes given transaction overhead in internal
 * buffers.
 */
if (out_bytes > sizeof(dev->dout)) {
debug("%s: Cannot send %d bytes\n", __func__, dout_len);
-   return -1;
+   return -ENOSPC;
}
if (in_bytes > sizeof(dev->din)) {
debug("%s: Cannot receive %d bytes\n", __func__, din_len);
-   return -1;
+   return -ENOSPC;
}
assert(dout_len >= 0);
assert(dinp);
@@ -72,7 +66,7 @@ int cros_ec_i2c_command(struct cros_ec_dev *dev, uint8_t cmd, 
int cmd_version,
/* Something we don't support */
debug("%s: Protocol version %d unsupported\n",
  __func__, dev->protocol_version);
-   return -1;
+   return -EPROTONOSUPPORT;
}
 
*ptr++ = EC_CMD_VERSION0 + cmd_version;
@@ -86,36 +80,18 @@ int cros_ec_i2c_command(struct cros_ec_dev *dev, uint8_t 
cmd, int cmd_version,
*ptr++ = (uint8_t)
cros_ec_calc_checksum(dev->dout, dout_len + 3);
 
-   /* Set to the proper i2c bus */
-   if (i2c_set_bus_num(dev->bus_num)) {
-   debug("%s: Cannot change to I2C bus %d\n", __func__,
-   dev->bus_num);
-   return -1;
-   }
-
/* Send output data */
cros_ec_dump_data("out", -1, dev->dout, out_bytes);
-   ret = i2c_write(dev->addr, 0, 0, dev->dout, out_bytes);
-   if (ret) {
-   debug("%s: Cannot complete I2C write to 0x%x\n",
-   __func__, dev->addr);
-   ret = -1;
-   }
+   ret = dm_i2c_write(udev, 0, dev->dout, out_bytes);
+   if (ret)
+   debug("%s: Cannot complete I2C write\n", udev->name);
 
if (!ret) {
-   ret = i2c_read(dev->addr, 0, 0, in_ptr, in_bytes);
-   if (ret) {
-   debug("%s: Cannot complete I2C read from 0x%x\n",
-   __func__, dev->addr);
-   ret = -1;
-   }
+   ret = dm_i2c_read(udev, 0, in_ptr, in_bytes);
+   if (ret)
+   debug("%s: Cannot complete I2C read\n", udev->name);
}
 
-   /* Return to original bus number */
-   i2c_set_bus_num(old_bus);
-   if (ret)
-   return ret;
-
if (*in_ptr != EC_RES_SUCCESS) {
debug("%s: Received bad result code %d\n", __func__, *in_ptr);
return -(int)*in_ptr;
@@ -125,13 +101,13 @@ int cros_ec_i2c_command(struct cros_ec_dev *dev, uint8_t 
cmd, int cmd_version,
if (len + 3 > sizeof(dev->din)) {
debug("%s: Received length %#02x too large\n",
  __func__, len);
-   return -1;
+   return -ENOSPC;
}
csum = cros_ec_calc_checksum(in_ptr, 2 + len);
if (csum != in_ptr[2 + len]) {
debug("%s: Invalid checksum rx %#02x, calced %#02x\n",
  __func__, in_ptr[2 + din_len], csum);
-   return -1;
+   return -EBADMSG;
}
din_len = min(din_len, len);
cros_ec_dump_data("in", -1, in_ptr, din_len + 3);
@@ -142,35 +118,32 @@ int cros_ec_i2c_command(struct cros_ec_dev *dev, uint8_t 
cmd, int cmd_version,
return din_len;
 }
 
-int cros_ec_i2c_decode_fdt(struct cros_ec_dev *dev, const void *blob)
+static int cros_ec_probe(struct udevice *dev)
 {
-  

[U-Boot] [PATCH v3 17/26] dm: spi: Set up the spi_slave device pointer in child_pre_probe()

2015-01-25 Thread Simon Glass
At present we use struct spi_slave as our device pointer in a lot of places
to avoid changing the old SPI API. At some point this will go away.

But for now, it is better if the SPI uclass sets up this pointer, rather
than relying on passing it into the device when it is probed. We can use the
new uclass child_pre_probe() method to do this.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 drivers/spi/spi-uclass.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index e5dfb30..2c134eb 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -108,6 +108,15 @@ int spi_post_probe(struct udevice *dev)
return 0;
 }
 
+int spi_child_pre_probe(struct udevice *dev)
+{
+   struct spi_slave *slave = dev_get_parentdata(dev);
+
+   slave->dev = dev;
+
+   return 0;
+}
+
 int spi_chip_select(struct udevice *dev)
 {
struct spi_slave *slave = dev_get_parentdata(dev);
@@ -347,6 +356,7 @@ UCLASS_DRIVER(spi) = {
.flags  = DM_UC_FLAG_SEQ_ALIAS,
.post_bind  = spi_post_bind,
.post_probe = spi_post_probe,
+   .child_pre_probe = spi_child_pre_probe,
.per_device_auto_alloc_size = sizeof(struct dm_spi_bus),
.per_child_auto_alloc_size = sizeof(struct spi_slave),
 };
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 16/26] dm: core: Allow uclass to set up a device's child before it is probed

2015-01-25 Thread Simon Glass
Some buses need to set up their devices before they can be used. This setup
may well be common to all buses in a particular uclass. Support a common
pre-probe method for the uclass, called before any bus devices are probed.

Signed-off-by: Simon Glass 
Reviewed-by: Masahiro Yamada 
---

Changes in v3: None
Changes in v2: None

 drivers/core/device.c|  4 
 drivers/core/uclass.c| 13 +
 include/dm/test.h|  3 +++
 include/dm/uclass-internal.h | 11 +++
 include/dm/uclass.h  |  1 +
 test/dm/bus.c| 46 
 test/dm/test-fdt.c   |  7 +++
 7 files changed, 85 insertions(+)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 78bc460..b73d3b8 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -227,6 +227,10 @@ int device_probe_child(struct udevice *dev, void 
*parent_priv)
}
dev->seq = seq;
 
+   ret = uclass_pre_probe_child(dev);
+   if (ret)
+   goto fail;
+
if (dev->parent && dev->parent->driver->child_pre_probe) {
ret = dev->parent->driver->child_pre_probe(dev);
if (ret)
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index a544551..289a5d2 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -391,6 +391,19 @@ int uclass_resolve_seq(struct udevice *dev)
return seq;
 }
 
+int uclass_pre_probe_child(struct udevice *dev)
+{
+   struct uclass_driver *uc_drv;
+
+   if (!dev->parent)
+   return 0;
+   uc_drv = dev->parent->uclass->uc_drv;
+   if (uc_drv->child_pre_probe)
+   return uc_drv->child_pre_probe(dev);
+
+   return 0;
+}
+
 int uclass_post_probe_device(struct udevice *dev)
 {
struct uclass_driver *uc_drv = dev->uclass->uc_drv;
diff --git a/include/dm/test.h b/include/dm/test.h
index f08c05d..707c69e 100644
--- a/include/dm/test.h
+++ b/include/dm/test.h
@@ -67,6 +67,8 @@ enum {
 struct dm_test_priv {
int ping_total;
int op_count[DM_TEST_OP_COUNT];
+   int uclass_flag;
+   int uclass_total;
 };
 
 /**
@@ -88,6 +90,7 @@ struct dm_test_uclass_priv {
  *
  * @sum: Test value used to check parent data works correctly
  * @flag: Used to track calling of parent operations
+ * @uclass_flag: Used to track calling of parent operations by uclass
  */
 struct dm_test_parent_data {
int sum;
diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h
index f718f37..f2f254a 100644
--- a/include/dm/uclass-internal.h
+++ b/include/dm/uclass-internal.h
@@ -44,6 +44,17 @@ int uclass_bind_device(struct udevice *dev);
 int uclass_unbind_device(struct udevice *dev);
 
 /**
+ * uclass_pre_probe_child() - Deal with a child that is about to be probed
+ *
+ * Perform any pre-processing that is needed by the uclass before it can be
+ * probed.
+ *
+ * @dev:   Pointer to the device
+ * #return 0 on success, -ve on error
+ */
+int uclass_pre_probe_child(struct udevice *dev);
+
+/**
  * uclass_post_probe_device() - Deal with a device that has just been probed
  *
  * Perform any post-processing of a probed device that is needed by the
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 5c5b8f4..d6c40c6 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -83,6 +83,7 @@ struct uclass_driver {
int (*post_probe)(struct udevice *dev);
int (*pre_remove)(struct udevice *dev);
int (*child_post_bind)(struct udevice *dev);
+   int (*child_pre_probe)(struct udevice *dev);
int (*init)(struct uclass *class);
int (*destroy)(struct uclass *class);
int priv_auto_alloc_size;
diff --git a/test/dm/bus.c b/test/dm/bus.c
index c123ed7..faffe6a 100644
--- a/test/dm/bus.c
+++ b/test/dm/bus.c
@@ -53,6 +53,15 @@ static int testbus_child_pre_probe(struct udevice *dev)
return 0;
 }
 
+static int testbus_child_pre_probe_uclass(struct udevice *dev)
+{
+   struct dm_test_priv *priv = dev_get_priv(dev);
+
+   priv->uclass_flag++;
+
+   return 0;
+}
+
 static int testbus_child_post_remove(struct udevice *dev)
 {
struct dm_test_parent_data *parent_data = dev_get_parentdata(dev);
@@ -91,6 +100,7 @@ UCLASS_DRIVER(testbus) = {
.name   = "testbus",
.id = UCLASS_TEST_BUS,
.flags  = DM_UC_FLAG_SEQ_ALIAS,
+   .child_pre_probe = testbus_child_pre_probe_uclass,
 };
 
 /* Test that we can probe for children */
@@ -469,3 +479,39 @@ static int dm_test_bus_child_post_bind_uclass(struct 
dm_test_state *dms)
 }
 DM_TEST(dm_test_bus_child_post_bind_uclass,
DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/*
+ * Test that the bus' uclass' child_pre_probe() is called before the
+ * device's probe() method
+ */
+static int dm_test_bus_child_pre_probe_uclass(struct dm_test_state *dms)
+{
+   struct udevice *bus, *dev;
+   int child_count;
+
+   /*
+* See te

[U-Boot] [PATCH v3 21/26] dm: exynos: Drop unused COMPAT features for SPI

2015-01-25 Thread Simon Glass
This has moved to driver model so we don't need the fdtdec support.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 include/fdtdec.h | 1 -
 lib/fdtdec.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index 094a8e3..4cc69de 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -134,7 +134,6 @@ enum fdt_compat_id {
COMPAT_SAMSUNG_S3C2440_I2C, /* Exynos I2C Controller */
COMPAT_SAMSUNG_EXYNOS5_SOUND,   /* Exynos Sound */
COMPAT_WOLFSON_WM8994_CODEC,/* Wolfson WM8994 Sound Codec */
-   COMPAT_SAMSUNG_EXYNOS_SPI,  /* Exynos SPI */
COMPAT_GOOGLE_CROS_EC,  /* Google CROS_EC Protocol */
COMPAT_GOOGLE_CROS_EC_KEYB, /* Google CROS_EC Keyboard */
COMPAT_SAMSUNG_EXYNOS_EHCI, /* Exynos EHCI controller */
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 5c79afd..7509cd6 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -42,7 +42,6 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(SAMSUNG_S3C2440_I2C, "samsung,s3c2440-i2c"),
COMPAT(SAMSUNG_EXYNOS5_SOUND, "samsung,exynos-sound"),
COMPAT(WOLFSON_WM8994_CODEC, "wolfson,wm8994-codec"),
-   COMPAT(SAMSUNG_EXYNOS_SPI, "samsung,exynos-spi"),
COMPAT(GOOGLE_CROS_EC, "google,cros-ec"),
COMPAT(GOOGLE_CROS_EC_KEYB, "google,cros-ec-keyb"),
COMPAT(SAMSUNG_EXYNOS_EHCI, "samsung,exynos-ehci"),
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 23/26] dm: cros_ec: Don't require protocol 3 support

2015-01-25 Thread Simon Glass
I2C is now deprecated on ARM platforms and there are no devices that use it
with the v3 protocol. We can't require v3 support if we want to support I2C.
Adjust the error handling to suit.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Add patches to tidy up cros_ec using new I2C/SPI features

 drivers/misc/cros_ec.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index 7b20ffc..5846e76 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -154,7 +154,9 @@ static int prepare_proto3_response_buffer(struct 
cros_ec_dev *dev, int din_len)
  * @param dev  CROS-EC device
  * @param dinp  Returns pointer to response data
  * @param din_len   Maximum size of response in bytes
- * @return number of bytes of response data, or <0 if error
+ * @return number of bytes of response data, or <0 if error. Note that error
+ * codes can be from errno.h or -ve EC_RES_INVALID_CHECKSUM values (and they
+ * overlap!)
  */
 static int handle_proto3_response(struct cros_ec_dev *dev,
  uint8_t **dinp, int din_len)
@@ -228,7 +230,7 @@ static int send_command_proto3(struct cros_ec_dev *dev,
 
 #ifdef CONFIG_DM_CROS_EC
ops = dm_cros_ec_get_ops(dev->dev);
-   rv = ops->packet(dev->dev, out_bytes, in_bytes);
+   rv = ops->packet ? ops->packet(dev->dev, out_bytes, in_bytes) : -ENOSYS;
 #else
switch (dev->interface) {
 #ifdef CONFIG_CROS_EC_SPI
@@ -320,7 +322,7 @@ static int send_command(struct cros_ec_dev *dev, uint8_t 
cmd, int cmd_version,
  * If not NULL, it will be updated to point to the data
  * and will always be double word aligned (64-bits)
  * @param din_len   Maximum size of response in bytes
- * @return number of bytes in response, or -1 on error
+ * @return number of bytes in response, or -ve on error
  */
 static int ec_command_inptr(struct cros_ec_dev *dev, uint8_t cmd,
int cmd_version, const void *dout, int dout_len, uint8_t **dinp,
@@ -387,7 +389,7 @@ static int ec_command_inptr(struct cros_ec_dev *dev, 
uint8_t cmd,
  * It not NULL, it is a place for ec_command() to copy the
  *  data to.
  * @param din_len   Maximum size of response in bytes
- * @return number of bytes in response, or -1 on error
+ * @return number of bytes in response, or -ve on error
  */
 static int ec_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
  const void *dout, int dout_len,
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 19/26] dm: i2c: Move slave details to child platdata

2015-01-25 Thread Simon Glass
At present we go through various contortions to store the I2C's chip
address in its private data. This only exists when the chip is active so
must be set up when it is probed. Until the device is probed we don't
actually record what address it will appear on.

However, now that we can support per-child platform data, we can use that
instead. This allows us to set up the address when the child is bound,
and avoid the messy contortions.

Unfortunately this is a fairly large change and it seems to be difficult to
break it down further.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Add missing 'static' to two functions
- Remove unnecessary per_child_auto_alloc_size value

Changes in v2: None

 drivers/i2c/i2c-uclass-compat.c |  2 +-
 drivers/i2c/i2c-uclass.c| 54 -
 drivers/i2c/i2c-uniphier-f.c| 12 -
 drivers/i2c/i2c-uniphier.c  | 12 -
 drivers/i2c/s3c24x0_i2c.c   | 12 -
 drivers/i2c/sandbox_i2c.c   | 28 +
 drivers/i2c/tegra_i2c.c | 18 --
 include/i2c.h   |  4 +--
 8 files changed, 41 insertions(+), 101 deletions(-)

diff --git a/drivers/i2c/i2c-uclass-compat.c b/drivers/i2c/i2c-uclass-compat.c
index c29fc89..11239da 100644
--- a/drivers/i2c/i2c-uclass-compat.c
+++ b/drivers/i2c/i2c-uclass-compat.c
@@ -20,7 +20,7 @@ static int i2c_compat_get_device(uint chip_addr, int alen,
ret = i2c_get_chip_for_busnum(cur_busnum, chip_addr, devp);
if (ret)
return ret;
-   chip = dev_get_parentdata(*devp);
+   chip = dev_get_parent_platdata(*devp);
if (chip->offset_len != alen) {
printf("Requested alen %d does not match chip offset_len %d\n",
   alen, chip->offset_len);
diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c
index 94b49df..393cd6f 100644
--- a/drivers/i2c/i2c-uclass.c
+++ b/drivers/i2c/i2c-uclass.c
@@ -50,7 +50,7 @@ static int i2c_setup_offset(struct dm_i2c_chip *chip, uint 
offset,
 static int i2c_read_bytewise(struct udevice *dev, uint offset,
 uint8_t *buffer, int len)
 {
-   struct dm_i2c_chip *chip = dev_get_parentdata(dev);
+   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
struct udevice *bus = dev_get_parent(dev);
struct dm_i2c_ops *ops = i2c_get_ops(bus);
struct i2c_msg msg[2], *ptr;
@@ -79,7 +79,7 @@ static int i2c_read_bytewise(struct udevice *dev, uint offset,
 static int i2c_write_bytewise(struct udevice *dev, uint offset,
 const uint8_t *buffer, int len)
 {
-   struct dm_i2c_chip *chip = dev_get_parentdata(dev);
+   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
struct udevice *bus = dev_get_parent(dev);
struct dm_i2c_ops *ops = i2c_get_ops(bus);
struct i2c_msg msg[1];
@@ -102,7 +102,7 @@ static int i2c_write_bytewise(struct udevice *dev, uint 
offset,
 
 int dm_i2c_read(struct udevice *dev, uint offset, uint8_t *buffer, int len)
 {
-   struct dm_i2c_chip *chip = dev_get_parentdata(dev);
+   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
struct udevice *bus = dev_get_parent(dev);
struct dm_i2c_ops *ops = i2c_get_ops(bus);
struct i2c_msg msg[2], *ptr;
@@ -133,7 +133,7 @@ int dm_i2c_read(struct udevice *dev, uint offset, uint8_t 
*buffer, int len)
 int dm_i2c_write(struct udevice *dev, uint offset, const uint8_t *buffer,
 int len)
 {
-   struct dm_i2c_chip *chip = dev_get_parentdata(dev);
+   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
struct udevice *bus = dev_get_parent(dev);
struct dm_i2c_ops *ops = i2c_get_ops(bus);
struct i2c_msg msg[1];
@@ -223,7 +223,7 @@ static int i2c_probe_chip(struct udevice *bus, uint 
chip_addr,
 static int i2c_bind_driver(struct udevice *bus, uint chip_addr, uint 
offset_len,
   struct udevice **devp)
 {
-   struct dm_i2c_chip chip;
+   struct dm_i2c_chip *chip;
char name[30], *str;
struct udevice *dev;
int ret;
@@ -236,11 +236,11 @@ static int i2c_bind_driver(struct udevice *bus, uint 
chip_addr, uint offset_len,
goto err_bind;
 
/* Tell the device what we know about it */
-   memset(&chip, '\0', sizeof(chip));
-   chip.chip_addr = chip_addr;
-   chip.offset_len = offset_len;
-   ret = device_probe_child(dev, &chip);
-   debug("%s:  device_probe_child: ret=%d\n", __func__, ret);
+   chip = dev_get_parent_platdata(dev);
+   chip->chip_addr = chip_addr;
+   chip->offset_len = offset_len;
+   ret = device_probe(dev);
+   debug("%s:  device_probe: ret=%d\n", __func__, ret);
if (ret)
goto err_probe;
 
@@ -248,6 +248,10 @@ static int i2c_bind_driver(struct udevice *bus, uint 
chip_addr, uint offset_len,
return 0;
 
 err_probe:
+   /*
+*

[U-Boot] [PATCH v3 26/26] dm: Update documentation for new bus features

2015-01-25 Thread Simon Glass
Now that we have new bus features, update README.txt and the SPI docs to
explain these.
Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Drop RFC prefix since this series has been properly tested now
- Update commit message to describe immuatable platform data
- Update the spi-howto docs

 doc/driver-model/README.txt| 36 ++--
 doc/driver-model/spi-howto.txt | 40 +---
 2 files changed, 63 insertions(+), 13 deletions(-)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index 0c1292b..f83264d 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -441,11 +441,18 @@ access to other devices. Example of buses include SPI and 
I2C. Typically
 the bus provides some sort of transport or translation that makes it
 possible to talk to the devices on the bus.
 
-Driver model provides a few useful features to help with implementing
-buses. Firstly, a bus can request that its children store some 'parent
-data' which can be used to keep track of child state. Secondly, the bus can
-define methods which are called when a child is probed or removed. This is
-similar to the methods the uclass driver provides.
+Driver model provides some useful features to help with implementing buses.
+Firstly, a bus can request that its children store some 'parent data' which
+can be used to keep track of child state. Secondly, the bus can define
+methods which are called when a child is probed or removed. This is similar
+to the methods the uclass driver provides. Thirdly, per-child platform data
+can be provided to specify things like the child's address on the bus. This
+persists across child probe()/remove() cycles.
+
+For consistency and ease of implementation, the bus uclass can specify the
+per-child platform data, so that it can be the same for all children of buses
+in that uclass. There are also uclass methods which can be called when
+children are bound and probed.
 
 Here an explanation of how a bus fits with a uclass may be useful. Consider
 a USB bus with several devices attached to it, each from a different (made
@@ -460,15 +467,23 @@ Each of the devices is connected to a different address 
on the USB bus.
 The bus device wants to store this address and some other information such
 as the bus speed for each device.
 
-To achieve this, the bus device can use dev->parent_priv in each of its
-three children. This can be auto-allocated if the bus driver has a non-zero
-value for per_child_auto_alloc_size. If not, then the bus device can
-allocate the space itself before the child device is probed.
+To achieve this, the bus device can use dev->parent_platdata in each of its
+three children. This can be auto-allocated if the bus driver (or bus uclass)
+has a non-zero value for per_child_platdata_auto_alloc_size. If not, then
+the bus device or uclass can allocate the space itself before the child
+device is probed.
 
 Also the bus driver can define the child_pre_probe() and child_post_remove()
 methods to allow it to do some processing before the child is activated or
 after it is deactivated.
 
+Similarly the bus uclass can define the child_post_bind() method to obtain
+the per-child platform data from the device tree and set it up for the child.
+The bus uclass can also provide a child_pre_probe() method. Very often it is
+the bus uclass that controls these features, since it avoids each driver
+having to do the same processing. Of course the driver can still tweak and
+override these activities.
+
 Note that the information that controls this behaviour is in the bus's
 driver, not the child's. In fact it is possible that child has no knowledge
 that it is connected to a bus. The same child device may even be used on two
@@ -495,7 +510,8 @@ bus device, regardless of its own views on the matter.
 The uclass for the device can also contain data private to that uclass.
 But note that each device on the bus may be a memeber of a different
 uclass, and this data has nothing to do with the child data for each child
-on the bus.
+on the bus. It is the bus' uclass that controls the child with respect to
+the bus.
 
 
 Driver Lifecycle
diff --git a/doc/driver-model/spi-howto.txt b/doc/driver-model/spi-howto.txt
index 719dbd5..5bc29ad 100644
--- a/doc/driver-model/spi-howto.txt
+++ b/doc/driver-model/spi-howto.txt
@@ -3,7 +3,8 @@ How to port a SPI driver to driver model
 
 Here is a rough step-by-step guide. It is based around converting the
 exynos SPI driver to driver model (DM) and the example code is based
-around U-Boot v2014.10-rc2 (commit be9f643).
+around U-Boot v2014.10-rc2 (commit be9f643). This has been updated for
+v2015.04.
 
 It is quite long since it includes actual code examples.
 
@@ -262,8 +263,8 @@ U_BOOT_DEVICE(board_spi0) = {
.platdata = &platdata_spi0,
 };
 
-You will unfortunately need to put the struct into a header file in this
-case so that your board file can use it.
+Y

[U-Boot] [PATCH v3 25/26] dm: cros_ec_spi: Remove old pre-driver-model code

2015-01-25 Thread Simon Glass
This is no-longer needed since all platforms use SPI for cros_ec.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Add patches to tidy up cros_ec using new I2C/SPI features

 drivers/misc/cros_ec_spi.c | 51 ++
 1 file changed, 2 insertions(+), 49 deletions(-)

diff --git a/drivers/misc/cros_ec_spi.c b/drivers/misc/cros_ec_spi.c
index 25a5a04..9359c56 100644
--- a/drivers/misc/cros_ec_spi.c
+++ b/drivers/misc/cros_ec_spi.c
@@ -21,14 +21,9 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_DM_CROS_EC
 int cros_ec_spi_packet(struct udevice *udev, int out_bytes, int in_bytes)
 {
struct cros_ec_dev *dev = udev->uclass_priv;
-#else
-int cros_ec_spi_packet(struct cros_ec_dev *dev, int out_bytes, int in_bytes)
-{
-#endif
struct spi_slave *slave = dev_get_parentdata(dev->dev);
int rv;
 
@@ -67,18 +62,11 @@ int cros_ec_spi_packet(struct cros_ec_dev *dev, int 
out_bytes, int in_bytes)
  * @param din_len  Maximum size of response in bytes
  * @return number of bytes in response, or -1 on error
  */
-#ifdef CONFIG_DM_CROS_EC
 int cros_ec_spi_command(struct udevice *udev, uint8_t cmd, int cmd_version,
 const uint8_t *dout, int dout_len,
 uint8_t **dinp, int din_len)
 {
struct cros_ec_dev *dev = udev->uclass_priv;
-#else
-int cros_ec_spi_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
-const uint8_t *dout, int dout_len,
-uint8_t **dinp, int din_len)
-{
-#endif
struct spi_slave *slave = dev_get_parentdata(dev->dev);
int in_bytes = din_len + 4; /* status, length, checksum, trailer */
uint8_t *out;
@@ -166,46 +154,12 @@ int cros_ec_spi_command(struct cros_ec_dev *dev, uint8_t 
cmd, int cmd_version,
return len;
 }
 
-#ifndef CONFIG_DM_CROS_EC
-int cros_ec_spi_decode_fdt(struct cros_ec_dev *dev, const void *blob)
-{
-   /* Decode interface-specific FDT params */
-   dev->max_frequency = fdtdec_get_int(blob, dev->node,
-   "spi-max-frequency", 50);
-   dev->cs = fdtdec_get_int(blob, dev->node, "reg", 0);
-
-   return 0;
-}
-
-/**
- * Initialize SPI protocol.
- *
- * @param dev  CROS_EC device
- * @param blob Device tree blob
- * @return 0 if ok, -1 on error
- */
-int cros_ec_spi_init(struct cros_ec_dev *dev, const void *blob)
-{
-   int ret;
-
-   ret = spi_setup_slave_fdt(blob, dev->node, dev->parent_node,
- &slave);
-   if (ret) {
-   debug("%s: Could not setup SPI slave\n", __func__);
-   return ret;
-   }
-
-   return 0;
-}
-#endif
-
-#ifdef CONFIG_DM_CROS_EC
-int cros_ec_probe(struct udevice *dev)
+static int cros_ec_probe(struct udevice *dev)
 {
return cros_ec_register(dev);
 }
 
-struct dm_cros_ec_ops cros_ec_ops = {
+static struct dm_cros_ec_ops cros_ec_ops = {
.packet = cros_ec_spi_packet,
.command = cros_ec_spi_command,
 };
@@ -222,4 +176,3 @@ U_BOOT_DRIVER(cros_ec_spi) = {
.probe  = cros_ec_probe,
.ops= &cros_ec_ops,
 };
-#endif
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 14/26] dm: core: Allow the uclass to set up a device's child after binding

2015-01-25 Thread Simon Glass
For buses, after a child is bound, allow the uclass to perform some
processing. This can be used to figure out the address of the child (e.g.
the chip select for SPI slaves) so that it is ready to be probed.

This avoids bus drivers having to repeat the same process, which really
should be done by the uclass, since it is common.

Signed-off-by: Simon Glass 
Reviewed-by: Masahiro Yamada 
---

Changes in v3:
- Change variable name from parent_drv to uc_drv

Changes in v2: None

 drivers/core/uclass.c | 21 -
 include/dm/uclass.h   |  2 ++
 test/dm/bus.c | 26 ++
 3 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 901b06e..a544551 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -319,18 +319,29 @@ int uclass_bind_device(struct udevice *dev)
int ret;
 
uc = dev->uclass;
-
list_add_tail(&dev->uclass_node, &uc->dev_head);
 
+   if (dev->parent) {
+   struct uclass_driver *uc_drv = dev->parent->uclass->uc_drv;
+
+   if (uc_drv->child_post_bind) {
+   ret = uc_drv->child_post_bind(dev);
+   if (ret)
+   goto err;
+   }
+   }
if (uc->uc_drv->post_bind) {
ret = uc->uc_drv->post_bind(dev);
-   if (ret) {
-   list_del(&dev->uclass_node);
-   return ret;
-   }
+   if (ret)
+   goto err;
}
 
return 0;
+err:
+   /* There is no need to undo the parent's post_bind call */
+   list_del(&dev->uclass_node);
+
+   return ret;
 }
 
 int uclass_unbind_device(struct udevice *dev)
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index ac6c850..5c5b8f4 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -55,6 +55,7 @@ struct udevice;
  * @pre_unbind: Called before a device is unbound from this uclass
  * @post_probe: Called after a new device is probed
  * @pre_remove: Called before a device is removed
+ * @child_post_bind: Called after a child is bound to a device in this uclass
  * @init: Called to set up the uclass
  * @destroy: Called to destroy the uclass
  * @priv_auto_alloc_size: If non-zero this is the size of the private data
@@ -81,6 +82,7 @@ struct uclass_driver {
int (*pre_unbind)(struct udevice *dev);
int (*post_probe)(struct udevice *dev);
int (*pre_remove)(struct udevice *dev);
+   int (*child_post_bind)(struct udevice *dev);
int (*init)(struct uclass *class);
int (*destroy)(struct uclass *class);
int priv_auto_alloc_size;
diff --git a/test/dm/bus.c b/test/dm/bus.c
index e909697..c123ed7 100644
--- a/test/dm/bus.c
+++ b/test/dm/bus.c
@@ -18,6 +18,7 @@ DECLARE_GLOBAL_DATA_PTR;
 struct dm_test_parent_platdata {
int count;
int bind_flag;
+   int uclass_bind_flag;
 };
 
 enum {
@@ -38,6 +39,7 @@ static int testbus_child_post_bind(struct udevice *dev)
 
plat = dev_get_parent_platdata(dev);
plat->bind_flag = 1;
+   plat->uclass_bind_flag = 2;
 
return 0;
 }
@@ -443,3 +445,27 @@ static int dm_test_bus_child_post_bind(struct 
dm_test_state *dms)
return 0;
 }
 DM_TEST(dm_test_bus_child_post_bind, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test that the child post_bind method is called */
+static int dm_test_bus_child_post_bind_uclass(struct dm_test_state *dms)
+{
+   struct dm_test_parent_platdata *plat;
+   struct udevice *bus, *dev;
+   int child_count;
+
+   ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, &bus));
+   for (device_find_first_child(bus, &dev), child_count = 0;
+dev;
+device_find_next_child(&dev)) {
+   /* Check that platform data is allocated */
+   plat = dev_get_parent_platdata(dev);
+   ut_assert(plat != NULL);
+   ut_asserteq(2, plat->uclass_bind_flag);
+   child_count++;
+   }
+   ut_asserteq(3, child_count);
+
+   return 0;
+}
+DM_TEST(dm_test_bus_child_post_bind_uclass,
+   DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 22/26] dm: core: Ignore disabled devices when binding

2015-01-25 Thread Simon Glass
We don't want to bind devices which should never be used.

Signed-off-by: Simon Glass 
Reviewed-by: Masahiro Yamada 
---

Changes in v3: None
Changes in v2:
- Add patches to tidy up cros_ec using new I2C/SPI features

 drivers/core/root.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index a5b0a61..73e3c72 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,6 +93,10 @@ int dm_scan_fdt_node(struct udevice *parent, const void 
*blob, int offset,
if (pre_reloc_only &&
!fdt_getprop(blob, offset, "u-boot,dm-pre-reloc", NULL))
continue;
+   if (!fdtdec_get_is_enabled(blob, offset)) {
+   dm_dbg("   - ignoring disabled device\n");
+   continue;
+   }
err = lists_bind_fdt(parent, blob, offset, NULL);
if (err && !ret)
ret = err;
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 13/26] dm: spi: Move the per-child data size to the uclass

2015-01-25 Thread Simon Glass
This is common to all SPI drivers and specifies a structure used by the
uclass. It makes more sense to define it in the uclass.

Reviewed-by: Masahiro Yamada 
Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 drivers/spi/cadence_qspi.c   | 1 -
 drivers/spi/designware_spi.c | 1 -
 drivers/spi/exynos_spi.c | 1 -
 drivers/spi/sandbox_spi.c| 1 -
 drivers/spi/soft_spi.c   | 1 -
 drivers/spi/spi-uclass.c | 1 +
 drivers/spi/tegra114_spi.c   | 1 -
 drivers/spi/tegra20_sflash.c | 1 -
 drivers/spi/tegra20_slink.c  | 1 -
 9 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index 98ae3b8..a75fc46 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -340,6 +340,5 @@ U_BOOT_DRIVER(cadence_spi) = {
.ofdata_to_platdata = cadence_spi_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct cadence_spi_platdata),
.priv_auto_alloc_size = sizeof(struct cadence_spi_priv),
-   .per_child_auto_alloc_size = sizeof(struct spi_slave),
.probe = cadence_spi_probe,
 };
diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index 700f616..2624844 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -421,6 +421,5 @@ U_BOOT_DRIVER(dw_spi) = {
.ofdata_to_platdata = dw_spi_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct dw_spi_platdata),
.priv_auto_alloc_size = sizeof(struct dw_spi_priv),
-   .per_child_auto_alloc_size = sizeof(struct spi_slave),
.probe = dw_spi_probe,
 };
diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c
index f078973..a46d8c1 100644
--- a/drivers/spi/exynos_spi.c
+++ b/drivers/spi/exynos_spi.c
@@ -425,6 +425,5 @@ U_BOOT_DRIVER(exynos_spi) = {
.ofdata_to_platdata = exynos_spi_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct exynos_spi_platdata),
.priv_auto_alloc_size = sizeof(struct exynos_spi_priv),
-   .per_child_auto_alloc_size  = sizeof(struct spi_slave),
.probe  = exynos_spi_probe,
 };
diff --git a/drivers/spi/sandbox_spi.c b/drivers/spi/sandbox_spi.c
index e717424..bad5660 100644
--- a/drivers/spi/sandbox_spi.c
+++ b/drivers/spi/sandbox_spi.c
@@ -160,6 +160,5 @@ U_BOOT_DRIVER(spi_sandbox) = {
.name   = "spi_sandbox",
.id = UCLASS_SPI,
.of_match = sandbox_spi_ids,
-   .per_child_auto_alloc_size  = sizeof(struct spi_slave),
.ops= &sandbox_spi_ops,
 };
diff --git a/drivers/spi/soft_spi.c b/drivers/spi/soft_spi.c
index 423c98d..9f7d80e 100644
--- a/drivers/spi/soft_spi.c
+++ b/drivers/spi/soft_spi.c
@@ -240,7 +240,6 @@ U_BOOT_DRIVER(soft_spi) = {
.ofdata_to_platdata = soft_spi_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct soft_spi_platdata),
.priv_auto_alloc_size = sizeof(struct soft_spi_priv),
-   .per_child_auto_alloc_size  = sizeof(struct spi_slave),
.probe  = soft_spi_probe,
.child_pre_probe= soft_spi_child_pre_probe,
 };
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 35756ad..e5dfb30 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -348,6 +348,7 @@ UCLASS_DRIVER(spi) = {
.post_bind  = spi_post_bind,
.post_probe = spi_post_probe,
.per_device_auto_alloc_size = sizeof(struct dm_spi_bus),
+   .per_child_auto_alloc_size = sizeof(struct spi_slave),
 };
 
 UCLASS_DRIVER(spi_generic) = {
diff --git a/drivers/spi/tegra114_spi.c b/drivers/spi/tegra114_spi.c
index 2d97625..53ff9ea 100644
--- a/drivers/spi/tegra114_spi.c
+++ b/drivers/spi/tegra114_spi.c
@@ -407,6 +407,5 @@ U_BOOT_DRIVER(tegra114_spi) = {
.ofdata_to_platdata = tegra114_spi_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct tegra_spi_platdata),
.priv_auto_alloc_size = sizeof(struct tegra114_spi_priv),
-   .per_child_auto_alloc_size  = sizeof(struct spi_slave),
.probe  = tegra114_spi_probe,
 };
diff --git a/drivers/spi/tegra20_sflash.c b/drivers/spi/tegra20_sflash.c
index 7d0d0f3..78c74cd 100644
--- a/drivers/spi/tegra20_sflash.c
+++ b/drivers/spi/tegra20_sflash.c
@@ -348,6 +348,5 @@ U_BOOT_DRIVER(tegra20_sflash) = {
.ofdata_to_platdata = tegra20_sflash_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct tegra_spi_platdata),
.priv_auto_alloc_size = sizeof(struct tegra20_sflash_priv),
-   .per_child_auto_alloc_size  = sizeof(struct spi_slave),
.probe  = tegra20_sflash_probe,
 };
diff --git a/drivers/spi/tegra20_slink.c b/drivers/spi/tegra20_slink.c
index 213fa5f..597d6ad 100644
--- a/drivers/spi/tegra20_slink.c
+++ b/drivers/spi/tegra20_slink.c
@@ -361,6 +361,5 @@ U_BOOT_DRIVER(tegra30_spi) = {
.ofdata_to_platdata = tegra30_spi_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct tegra_spi_platdata),
.priv

[U-Boot] [PATCH v3 10/26] dm: core: Add a function to get a device's uclass ID

2015-01-25 Thread Simon Glass
This is useful to check which uclass a device is in.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 drivers/core/device.c |  5 +
 include/dm/device.h   |  8 
 test/dm/core.c| 11 +++
 3 files changed, 24 insertions(+)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 365676b..2606d18 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -438,3 +438,8 @@ ulong dev_get_of_data(struct udevice *dev)
 {
return dev->of_id->data;
 }
+
+enum uclass_id device_get_uclass_id(struct udevice *dev)
+{
+   return dev->uclass->uc_drv->id;
+}
diff --git a/include/dm/device.h b/include/dm/device.h
index 50f1b4f..81afa8c 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -245,6 +245,14 @@ struct udevice *dev_get_parent(struct udevice *child);
  */
 ulong dev_get_of_data(struct udevice *dev);
 
+/*
+ * device_get_uclass_id() - return the uclass ID of a device
+ *
+ * @dev:   Device to check
+ * @return uclass ID for the device
+ */
+enum uclass_id device_get_uclass_id(struct udevice *dev);
+
 /**
  * device_get_child() - Get the child of a device by index
  *
diff --git a/test/dm/core.c b/test/dm/core.c
index ff5c2a7..eccda09 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -598,3 +598,14 @@ static int dm_test_uclass_before_ready(struct 
dm_test_state *dms)
 }
 
 DM_TEST(dm_test_uclass_before_ready, 0);
+
+static int dm_test_device_get_uclass_id(struct dm_test_state *dms)
+{
+   struct udevice *dev;
+
+   ut_assertok(uclass_get_device(UCLASS_TEST, 0, &dev));
+   ut_asserteq(UCLASS_TEST, device_get_uclass_id(dev));
+
+   return 0;
+}
+DM_TEST(dm_test_device_get_uclass_id, DM_TESTF_SCAN_PDATA);
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] sunxi: Add Linksprite_pcDuino3_Nano board / defconfig

2015-01-25 Thread Adam Sampson
This is a low-cost Allwinner A20 board with Arduino-style GPIO headers;
it features 1G RAM, 4G NAND flash, 1 micro-SD, 2 USB sockets, 1 micro
USB socket for OTG and another for power in, HDMI, SATA, 5V power for
SATA devices, gigabit Ethernet, an IR receiver, 3.5mm audio out and a
MIPI camera connector.

For more details, see: http://linux-sunxi.org/LinkSprite_pcDuino3_Nano

Signed-off-by: Adam Sampson 
---
 board/sunxi/MAINTAINERS|5 +
 configs/Linksprite_pcDuino3_Nano_defconfig |   11 +++
 2 files changed, 16 insertions(+)
 create mode 100644 configs/Linksprite_pcDuino3_Nano_defconfig

diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS
index 743e7f5..479d147 100644
--- a/board/sunxi/MAINTAINERS
+++ b/board/sunxi/MAINTAINERS
@@ -100,3 +100,8 @@ MELE M5 BOARD
 M: Ian Campbell 
 S: Maintained
 F: configs/Mele_M5_defconfig
+
+LINKSPRITE-PCDUINO3-NANO BOARD
+M: Adam Sampson 
+S: Maintained
+F: configs/Linksprite_pcDuino3_Nano_defconfig
diff --git a/configs/Linksprite_pcDuino3_Nano_defconfig 
b/configs/Linksprite_pcDuino3_Nano_defconfig
new file mode 100644
index 000..22435eb
--- /dev/null
+++ b/configs/Linksprite_pcDuino3_Nano_defconfig
@@ -0,0 +1,11 @@
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI"
+CONFIG_FDTFILE="sun7i-a20-pcduino3-nano.dtb"
+CONFIG_USB1_VBUS_PIN="PH11"
++S:CONFIG_ARM=y
++S:CONFIG_ARCH_SUNXI=y
++S:CONFIG_MACH_SUN7I=y
++S:CONFIG_TARGET_PCDUINO3_NANO=y
++S:CONFIG_DRAM_CLK=408
++S:CONFIG_DRAM_ZQ=122
++S:CONFIG_DRAM_EMR1=4
-- 
1.7.10.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Please pull u-boot-marvell master

2015-01-25 Thread Luka Perkov
Hi Albert,

this series contains pending kirkwood patches that have been posted on
the mailing list for some time now.


The following changes since commit 37b608a52dcb13312a4f7ccea199cd6bac76d298:

  powerpc: remove icecube_5200, Lite5200, cpci5200, mecp5200, pf5200 
(2015-01-23 16:56:09 -0500)

are available in the git repository at:

  git://git.denx.de/u-boot-marvell.git master

for you to fetch changes up to 361b3d8613f57e137a9048ef69e58e9bcaf51b78:

  marvell: kirkwood: guruplug refresh for newer kernel (2015-01-26 00:25:29 
+0100)


Gerald Kerma (1):
  marvell: kirkwood: guruplug refresh for newer kernel

Luka Perkov (9):
  cosmetic: kirkwood: style fixes in kwbimage.cfg files
  kirkwood: define empty CONFIG_MVGBE_PORTS by default
  ARM: kirkwood: fix cpu info for 6282 device id
  kirkwood: ib62x0: add CONFIG_SYS_GENERIC_BOARD define
  kirkwood: dockstar: add CONFIG_SYS_GENERIC_BOARD define
  kirkwood: goflexhome: add CONFIG_SYS_GENERIC_BOARD define
  kirkwood: iconnect: add CONFIG_SYS_GENERIC_BOARD define
  kirkwood: pogo_e02: add CONFIG_SYS_GENERIC_BOARD define
  kirkwood: sheevaplug: add CONFIG_SYS_GENERIC_BOARD define

 arch/arm/cpu/arm926ejs/kirkwood/cpu.c | 11 +++--
 board/iomega/iconnect/kwbimage.cfg|  4 +-
 board/raidsonic/ib62x0/kwbimage.cfg   | 22 -
 drivers/net/mvgbe.c   |  4 ++
 include/configs/dockstar.h|  2 +
 include/configs/goflexhome.h  |  2 +
 include/configs/guruplug.h| 84 ---
 include/configs/ib62x0.h  |  2 +
 include/configs/iconnect.h|  2 +
 include/configs/pogo_e02.h|  2 +
 include/configs/sheevaplug.h  |  2 +
 11 files changed, 104 insertions(+), 33 deletions(-)

Regards,
Luka
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 06/26] dm: core: Allocate platform data when binding a device

2015-01-25 Thread Masahiro Yamada

On Sun, 25 Jan 2015 08:27:00 -0700
Simon Glass  wrote:

> When using allocated platform data, allocate it when we bind the device.
> This makes it possible to fill in this information before the device is
> probed.
> 
> This fits with the platform data model (when not using device tree),
> since platform data exists at bind-time.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v3:
> - Fix stale comment in device_probe_child()
> 
> Changes in v2: None



Reviewed-by: Masahiro Yamada 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 07/26] dm: core: Allow parents to have platform data for their children

2015-01-25 Thread Masahiro Yamada

On Sun, 25 Jan 2015 08:27:01 -0700
Simon Glass  wrote:

> For buses it is common for parents to need to know the address of the child
> on the bus, the bus speed to use for that child, and other information. This
> can be provided in platform data attached to each child.
> 
> Add driver model support for this, including auto-allocation which can be
> requested using a new property to specify the size of the data.
> 
> Signed-off-by: Simon Glass 



Reviewed-by: Masahiro Yamada 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 10/26] dm: core: Add a function to get a device's uclass ID

2015-01-25 Thread Masahiro Yamada

On Sun, 25 Jan 2015 08:27:04 -0700
Simon Glass  wrote:

> This is useful to check which uclass a device is in.
> 
> Signed-off-by: Simon Glass 


Reviewed-by: Masahiro Yamada 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 12/26] dm: core: Allow uclasses to specify private data for a device's children

2015-01-25 Thread Masahiro Yamada

On Sun, 25 Jan 2015 08:27:06 -0700
Simon Glass  wrote:

> In many cases the per-child private data for a device's children is defined
> by the uclass rather than the individual driver. For example, a SPI bus
> needs to store information about each of its children, but all SPI drivers
> store the same information. It makes sense to allow the uclass to define
> this data.
> 
> If the driver provides a size value for its per-child private data, then use
> it. Failng that, fall back to that provided by the uclass.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v3:
> - Fix typo in commit subject
> 
> Changes in v2: None



Reviewed-by: Masahiro Yamada 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 19/26] dm: i2c: Move slave details to child platdata

2015-01-25 Thread Masahiro Yamada

On Sun, 25 Jan 2015 08:27:13 -0700
Simon Glass  wrote:

> At present we go through various contortions to store the I2C's chip
> address in its private data. This only exists when the chip is active so
> must be set up when it is probed. Until the device is probed we don't
> actually record what address it will appear on.
> 
> However, now that we can support per-child platform data, we can use that
> instead. This allows us to set up the address when the child is bound,
> and avoid the messy contortions.
> 
> Unfortunately this is a fairly large change and it seems to be difficult to
> break it down further.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v3:
> - Add missing 'static' to two functions
> - Remove unnecessary per_child_auto_alloc_size value


I tested this series on my board.
I am OK with the change in the UniPhier I2C driver area.


Reviewed-by: Masahiro Yamada 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/26] dm: Add additional bus functionality

2015-01-25 Thread Masahiro Yamada
Hi Simon,



On Sun, 25 Jan 2015 08:26:54 -0700
Simon Glass  wrote:

> The current bus implementation is simple but leaves some things to drivers
> which are better handled in the uclass.
> 
> At present uclasses cannot provide a common way of dealing with children
> (i.e. devices on the bus), so we have duplication in the drivers. The same
> code is repeated in each driver when it would be better to put it in the
> uclass.
> 
> Secondly, we don't have the concept of per-child platform data for devices
> on the bus. Instead the per-child data can only exist when the child is
> actually probed. This is not really suitable. Examples of things we want to
> know before a child is probed are:
> 
>- chip address (for I2C)
>- chip select (for SPI)
>- device address (for PCI)
> 
> These things are static and do not change when the device is probed and
> removed. In some cases (such as SPI mode and maximum speed), the data may
> be copied to run-time data when the device is probed. It may then be changed
> while the driver is active, but the original platform data is never changed
> by drivers once it is set up.
> 
> To address these issues, additional functions are added:
> 
> - per-child platform data, which can be defined by the uclass and (if
> necessary) overriden by the bus driver. This allows the bus's uclass to
> provide some consistency here
> - per-child post-bind and pre-probe methods in the uclass. These allow the
> bus uclass to set up the per-child platform data, and also to do any
> last-minute adjustments before the child is probed.
> 
> With these changes, some code can be removed from the existing I2C and SPI
> drivers and this has been done as part of this series.
> 
> With this series I2C and SPI are tested on:
> - jetson-tk1 (Tegra 124)
> - beaver (Tegra 30)
> - seaboard (Tegra 20, I2C only)
> - trimslice (Tegra 20, SPI only)
> - snow (Exynos 5250)
> - pit (Exynos 5420, note I2C probe is previously broken)
> - link (x86)
> - sandbox
> 
> Note: Some of these changes were previously included in the DM PCI RFC. This
> series is available at u-boot-dm/i2c-working.
> 
> Changes in v3:
> - Add missing 'static' to two functions
> - Change variable name from parent_drv to uc_drv
> - Fix comment to say 'node references' instead of 'phandles'
> - Fix stale comment in device_probe_child()
> - Fix typo in commit subject
> - Remove unnecessary check that dev->parent_platdata is NULL
> - Remove unnecessary per_child_auto_alloc_size value


I issued my Reviewed-by to some rest of the patches.

V3 looks good enough to be applied.  Thank you!


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] sunxi: Add Linksprite_pcDuino3_Nano board / defconfig

2015-01-25 Thread Simon Glass
Hi Adam,

On 25 January 2015 at 08:24, Adam Sampson  wrote:
> This is a low-cost Allwinner A20 board with Arduino-style GPIO headers;
> it features 1G RAM, 4G NAND flash, 1 micro-SD, 2 USB sockets, 1 micro
> USB socket for OTG and another for power in, HDMI, SATA, 5V power for
> SATA devices, gigabit Ethernet, an IR receiver, 3.5mm audio out and a
> MIPI camera connector.
>
> For more details, see: http://linux-sunxi.org/LinkSprite_pcDuino3_Nano
>
> Signed-off-by: Adam Sampson 
> ---
>  board/sunxi/MAINTAINERS|5 +
>  configs/Linksprite_pcDuino3_Nano_defconfig |   11 +++
>  2 files changed, 16 insertions(+)
>  create mode 100644 configs/Linksprite_pcDuino3_Nano_defconfig
>
> diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS
> index 743e7f5..479d147 100644
> --- a/board/sunxi/MAINTAINERS
> +++ b/board/sunxi/MAINTAINERS
> @@ -100,3 +100,8 @@ MELE M5 BOARD
>  M: Ian Campbell 
>  S: Maintained
>  F: configs/Mele_M5_defconfig
> +
> +LINKSPRITE-PCDUINO3-NANO BOARD
> +M: Adam Sampson 
> +S: Maintained
> +F: configs/Linksprite_pcDuino3_Nano_defconfig
> diff --git a/configs/Linksprite_pcDuino3_Nano_defconfig 
> b/configs/Linksprite_pcDuino3_Nano_defconfig
> new file mode 100644
> index 000..22435eb
> --- /dev/null
> +++ b/configs/Linksprite_pcDuino3_Nano_defconfig
> @@ -0,0 +1,11 @@
> +CONFIG_SPL=y
> +CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI"
> +CONFIG_FDTFILE="sun7i-a20-pcduino3-nano.dtb"
> +CONFIG_USB1_VBUS_PIN="PH11"
> ++S:CONFIG_ARM=y
> ++S:CONFIG_ARCH_SUNXI=y
> ++S:CONFIG_MACH_SUN7I=y
> ++S:CONFIG_TARGET_PCDUINO3_NANO=y
> ++S:CONFIG_DRAM_CLK=408
> ++S:CONFIG_DRAM_ZQ=122
> ++S:CONFIG_DRAM_EMR1=4

Since this is a new board, could it follow along ith the Linksprice
pcDuino3 and support driver rmodel / device tree?

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC PATCH v2] Add support for ReachTech G2C1 board

2015-01-25 Thread Graeme Russ
This patch adds U-Boot support for the Reachtech G2C1 board. G2C1 U-Boot
images created with this patch will perform the following:
 - Initialise the MX28 for 'No Battery' mode
 - Configure all IOMUXs
 - Configure GPIO directions for all IOMUXs designed for GPIO use
 - Inilialise the MMC sub-system
 - Initialise the Ethernet sub-system

NOTE: The 'arm: mxs: Enable booting of mx28 without battery' patch MUST be
applied prior to building G2C1 images using this patch

Refer to the README file for detailed documentation

Signed-off-by: Graeme Russ 
Cc: Albert Aribaud 
Cc: Stefano Babic 
Cc: Marek Vasut 
Cc: u-boot@lists.denx.de
Cc: Brent Larson 
Cc: Jonathan More 
Cc: Jeff Horn 
Cc: Wolfgang Denk 

---
Changes in v2
 - Moved IOMUX documenations into README file
 - Expanded README file to cover considerably more information
 - Setup all GPIO pins in g2c1.c
 - Created two configurations - g2c1_mmc_defconfig for building for MMC image
   and g2c1_nand_defconfig for building NAND image
 - Fixed up Ethernet initialisation

 arch/arm/Kconfig |  13 ++
 board/reachtech/g2c1/Kconfig |  15 ++
 board/reachtech/g2c1/MAINTAINERS |   7 +
 board/reachtech/g2c1/Makefile|  12 ++
 board/reachtech/g2c1/README  | 438 +++
 board/reachtech/g2c1/g2c1.c  | 142 +
 board/reachtech/g2c1/spl_boot.c  | 236 +
 configs/g2c1_mmc_defconfig   |   4 +
 configs/g2c1_nand_defconfig  |   4 +
 include/configs/g2c1.h   | 307 +++
 10 files changed, 1178 insertions(+)
 create mode 100644 board/reachtech/g2c1/Kconfig
 create mode 100644 board/reachtech/g2c1/MAINTAINERS
 create mode 100644 board/reachtech/g2c1/Makefile
 create mode 100644 board/reachtech/g2c1/README
 create mode 100644 board/reachtech/g2c1/g2c1.c
 create mode 100644 board/reachtech/g2c1/spl_boot.c
 create mode 100644 configs/g2c1_mmc_defconfig
 create mode 100644 configs/g2c1_nand_defconfig
 create mode 100644 include/configs/g2c1.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5eb1d03..320041e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -278,6 +278,18 @@ config TARGET_XFI3
select CPU_ARM926EJS
select SUPPORT_SPL
 
+config TARGET_G2C1
+   bool "Support ReachTech G2C1"
+   select CPU_ARM926EJS
+   select SUPPORT_SPL
+   help
+ This is the Reachtech G2C1 development board. It contains a
+ Freescale MX28 SoC, 128MB DDR2 SDRAM, 128MB SLC NAND, 1x Ethernet
+ port, 2x USB Host ports, 1x USB OTG port, 1x RS-232 Debug port,
+ 1x RS-232 User port, 2x RS485 ports, Onboard audio, LCD Touch
+ screen interface, SD Card slot, I2C and SPI (with 2x slave select
+ lines) interfaces, CAN interface, and 8 GPIO (I2C slave interface)
+
 config TARGET_M28EVK
bool "Support m28evk"
select CPU_ARM926EJS
@@ -940,6 +952,7 @@ source "board/phytec/pcm051/Kconfig"
 source "board/ppcag/bg0900/Kconfig"
 source "board/pxa255_idp/Kconfig"
 source "board/raspberrypi/rpi/Kconfig"
+source "board/reachtech/g2c1/Kconfig"
 source "board/ronetix/pm9261/Kconfig"
 source "board/ronetix/pm9263/Kconfig"
 source "board/ronetix/pm9g45/Kconfig"
diff --git a/board/reachtech/g2c1/Kconfig b/board/reachtech/g2c1/Kconfig
new file mode 100644
index 000..5ef821f
--- /dev/null
+++ b/board/reachtech/g2c1/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_G2C1
+
+config SYS_BOARD
+   default "g2c1"
+
+config SYS_VENDOR
+   default "reachtech"
+
+config SYS_SOC
+   default "mxs"
+
+config SYS_CONFIG_NAME
+   default "g2c1"
+
+endif
diff --git a/board/reachtech/g2c1/MAINTAINERS b/board/reachtech/g2c1/MAINTAINERS
new file mode 100644
index 000..257888b
--- /dev/null
+++ b/board/reachtech/g2c1/MAINTAINERS
@@ -0,0 +1,7 @@
+G2C1 BOARD
+M: Graeme Russ 
+S: Maintained
+F: board/reachtech/g2c1/
+F: include/configs/mx28evk.h
+F: configs/g2c1_mmcconfig
+F: configs/g2c1_nandconfig
diff --git a/board/reachtech/g2c1/Makefile b/board/reachtech/g2c1/Makefile
new file mode 100644
index 000..9bb55e8
--- /dev/null
+++ b/board/reachtech/g2c1/Makefile
@@ -0,0 +1,12 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+ifndef CONFIG_SPL_BUILD
+obj-y  := g2c1.o
+else
+obj-y  := spl_boot.o
+endif
diff --git a/board/reachtech/g2c1/README b/board/reachtech/g2c1/README
new file mode 100644
index 000..745bcdc
--- /dev/null
+++ b/board/reachtech/g2c1/README
@@ -0,0 +1,438 @@
+ReachTech G2C1
+==
+
+Supported hardware: ReachTech G2C1
+
+Reference Documentation
+---
+doc/README.mxs
+
+Files of the G2C1 port
+--
+arch/arm/cpu/arm926ejs/mxs/- The CPU support code for the Freescale i.MX28
+arch/arm/include/asm/arch-mxs/ - Header files for the Freescale i.MX28
+board/reachtech/g2c1/  - G2C1 board specific files
+include/configs/

Re: [U-Boot] [PATCH] lcd: fix console address is not initialized

2015-01-25 Thread Bo Shen

Hi Nikita Kiryanov,
 + Andreas, Tom

On 01/23/2015 09:20 AM, Bo Shen wrote:

Hi Nikita Kiryanov,

On 01/22/2015 09:10 PM, Nikita Kiryanov wrote:

Hi Bo,

On 01/21/2015 06:37 AM, Bo Shen wrote:

This commit 904672e (lcd: refactor lcd console stuff into its
own file), which cause lcd console address is not initialized.


Based on your fix, I'm certain that the bug was introduced in a
previous patch, perhaps 140beb9 (lcd: expand console api).

Also, can you provide a more detailed explanation of when this
happens and how?


It will cause the system hang.

Before this patch, lcd_logo -> lcd_show_board_info (CONFIG_LCD_INFO) ->
.. -> lcd_drawchars. It has the following lines:
--->8---
dest = (uchar *)(lcd_base + y * lcd_line_length + x * NBITS(LCD_BPP)/8);
---8<---

while with the patch,
--->8---
dest = (uchar *)(lcd_console_address +
  y * lcd_line_length + x * NBITS(LCD_BPP) / 8);
---8<---

As the lcd_console_address is initialized after lcd_logo return, so the
lcd_console_address is not initialized, it is 0. When try to write to
address 0, the system hang.



This patch split lcd console address initialize and lcd logo
display into two functions.

Signed-off-by: Bo Shen 
---

  common/lcd.c | 11 ---
  1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index cc34b8a..f435e2a 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -82,7 +82,8 @@ DECLARE_GLOBAL_DATA_PTR;

  static int lcd_init(void *lcdbase);

-static void *lcd_logo(void);
+static void lcd_logo(void);
+static void *lcd_console_address(void);

  static void lcd_setfgcolor(int color);
  static void lcd_setbgcolor(int color);
@@ -268,7 +269,8 @@ void lcd_clear(void)
  console_rows = panel_info.vl_row / VIDEO_FONT_HEIGHT;
  #endif
  console_cols = panel_info.vl_col / VIDEO_FONT_WIDTH;
-lcd_init_console(lcd_logo(), console_rows, console_cols);
+lcd_init_console(lcd_console_address(), console_rows,
console_cols);
+lcd_logo();
  lcd_sync();
  }

@@ -849,7 +851,7 @@ int lcd_display_bitmap(ulong bmp_image, int x,
int y)
  }
  #endif

-static void *lcd_logo(void)
+static void lcd_logo(void)
  {
  #ifdef CONFIG_SPLASH_SCREEN
  char *s;
@@ -879,7 +881,10 @@ static void *lcd_logo(void)
  lcd_set_row(LCD_INFO_Y / VIDEO_FONT_HEIGHT);
  lcd_show_board_info();
  #endif /* CONFIG_LCD_INFO */
+}

+static void *lcd_console_address(void)
+{
  #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
  return (void *)((ulong)lcd_base + BMP_LOGO_HEIGHT *
lcd_line_length);
  #else



I would like to see some mention of why it's ok to redefine the console
address in such a way. At first glance it looks like there is a slight
change of
behavior (the value no longer depends on whether splash image was loaded
or not), but it seems to be ok if you go over the various cases. The only
instance where I see the difference could manifest itself is if lcd
console
would start writing to the frame buffer while the splash screen is still
on,
but that doesn't look good regardless of where the console starts, so
I'm ok
with that.



Thanks for reminder this, I will check whether this will break the
splash screen.


Can we use the following patch to fix this issue?
--->8---
diff --git a/common/lcd.c b/common/lcd.c
index cc34b8a..1195a54 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -268,6 +268,7 @@ void lcd_clear(void)
console_rows = panel_info.vl_row / VIDEO_FONT_HEIGHT;
 #endif
console_cols = panel_info.vl_col / VIDEO_FONT_WIDTH;
+   lcd_init_console(lcd_base, console_rows, console_cols);
lcd_init_console(lcd_logo(), console_rows, console_cols);
lcd_sync();
 }
---8<---

It first initializes the lcd console with LCD base, if the splash screen 
is used, new address is updated.


I need this kind of fix to be applied as soon as possible, or else, most 
Atmel related board are broken on u-boot master branch.


Best Regards,
Bo Shen
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] usb flash boot on am335x machines

2015-01-25 Thread matti kaasinen
Hi!

I have tried to find solution to get am335x based Silica/Pengwyn board
booting from usb flash. U-boot on that board is based on u-boot 2013.10. I
flashed it with similar configuration as mmc flash, but I did not find
combination of configuration variables to get proper spl code generated. I
studied codes and it seemed like am33x devices were left out from usb spl
generation parts. Is there some kind of fundamental reason to prevent
am335x devices not to boot from usb flash. If not, would anyone know the
configuration combination for this set-up.

In fact, I found more than three years old patch that seems to make usb
boot set-up for am335x devices:
https://gitorious.org/rowboat/u-boot/commit/aaa9d5c083252218fd89afa68161f96bb7daa04c
However, it seems that these changed have somehow not been included in the
mainline codes. Is  there specific reason for this?

Best regards,
Matti Kaasinen
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 21/26] dm: exynos: Drop unused COMPAT features for SPI

2015-01-25 Thread Minkyu Kang
On 26/01/15 00:27, Simon Glass wrote:
> This has moved to driver model so we don't need the fdtdec support.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  include/fdtdec.h | 1 -
>  lib/fdtdec.c | 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/include/fdtdec.h b/include/fdtdec.h
> index 094a8e3..4cc69de 100644
> --- a/include/fdtdec.h
> +++ b/include/fdtdec.h
> @@ -134,7 +134,6 @@ enum fdt_compat_id {
>   COMPAT_SAMSUNG_S3C2440_I2C, /* Exynos I2C Controller */
>   COMPAT_SAMSUNG_EXYNOS5_SOUND,   /* Exynos Sound */
>   COMPAT_WOLFSON_WM8994_CODEC,/* Wolfson WM8994 Sound Codec */
> - COMPAT_SAMSUNG_EXYNOS_SPI,  /* Exynos SPI */
>   COMPAT_GOOGLE_CROS_EC,  /* Google CROS_EC Protocol */
>   COMPAT_GOOGLE_CROS_EC_KEYB, /* Google CROS_EC Keyboard */
>   COMPAT_SAMSUNG_EXYNOS_EHCI, /* Exynos EHCI controller */
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index 5c79afd..7509cd6 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -42,7 +42,6 @@ static const char * const compat_names[COMPAT_COUNT] = {
>   COMPAT(SAMSUNG_S3C2440_I2C, "samsung,s3c2440-i2c"),
>   COMPAT(SAMSUNG_EXYNOS5_SOUND, "samsung,exynos-sound"),
>   COMPAT(WOLFSON_WM8994_CODEC, "wolfson,wm8994-codec"),
> - COMPAT(SAMSUNG_EXYNOS_SPI, "samsung,exynos-spi"),
>   COMPAT(GOOGLE_CROS_EC, "google,cros-ec"),
>   COMPAT(GOOGLE_CROS_EC_KEYB, "google,cros-ec-keyb"),
>   COMPAT(SAMSUNG_EXYNOS_EHCI, "samsung,exynos-ehci"),
> 

Acked-by: Minkyu Kang 

Thanks,
Minkyu Kang.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ahci: fix compile warning under 64 bit mode

2015-01-25 Thread shh.xie
From: Shaohui Xie 

When compiling under 64 bit mode, there are warnings as below:

In file included from drivers/block/ahci.c:16:0:
drivers/block/ahci.c: In function 'ahci_reset':
./arch/arm/include/asm/io.h:72:28: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]
 #define __arch_getl(a)   (*(volatile unsigned int *)(a))
^
./arch/arm/include/asm/io.h:151:31: note: in expansion of macro
'__arch_getl'
 #define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; })
   ^
drivers/block/ahci.c:144:12: note: in expansion of macro 'readl'
  u32 tmp = readl(host_ctl_reg); /* global controller reset */
^
./arch/arm/include/asm/io.h:77:29: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]
 #define __arch_putl(v,a)  (*(volatile unsigned int *)(a) = (v))
 ^
./arch/arm/include/asm/io.h:146:48: note: in expansion of macro
'__arch_putl'
 #define writel(v,c) ({ u32 __v = v; __iowmb(); __arch_putl(__v,c); __v;
})
^
drivers/block/ahci.c:28:37: note: in expansion of macro 'writel'
 #define writel_with_flush(a,b) do { writel(a,b); readl(b); } while (0)
 ^
drivers/block/ahci.c:147:3: note: in expansion of macro
'writel_with_flush'
   writel_with_flush(tmp | HOST_RESET, host_ctl_reg);
   ^
./arch/arm/include/asm/io.h:72:28: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]
 #define __arch_getl(a)   (*(volatile unsigned int *)(a))
^
./arch/arm/include/asm/io.h:151:31: note: in expansion of macro
'__arch_getl'
 #define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; })
   ^
drivers/block/ahci.c:28:50: note: in expansion of macro 'readl'
 #define writel_with_flush(a,b) do { writel(a,b); readl(b); } while (0)
  ^
drivers/block/ahci.c:147:3: note: in expansion of macro
'writel_with_flush'
   writel_with_flush(tmp | HOST_RESET, host_ctl_reg);
   ^
./arch/arm/include/asm/io.h:72:28: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]
 #define __arch_getl(a)   (*(volatile unsigned int *)(a))
^
./arch/arm/include/asm/io.h:151:31: note: in expansion of macro
'__arch_getl'
 #define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; })
   ^
drivers/block/ahci.c:155:9: note: in expansion of macro 'readl'
   tmp = readl(host_ctl_reg);
 ^
drivers/block/ahci.c: In function 'ahci_host_init':
drivers/block/ahci.c:174:22: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
  volatile u8 *mmio = (volatile u8 *)probe_ent->mmio_base;
  ^
drivers/block/ahci.c:218:49: warning: cast from pointer to integer of
different size [-Wpointer-to-int-cast]
   probe_ent->port[i].port_mmio = ahci_port_base((u32) mmio, i);
 ^
drivers/block/ahci.c:219:15: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
   port_mmio = (u8 *) probe_ent->port[i].port_mmio;
   ^
drivers/block/ahci.c: In function 'ahci_print_info':
drivers/block/ahci.c:332:22: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
  volatile u8 *mmio = (volatile u8 *)probe_ent->mmio_base;
  ^
In file included from ./arch/arm/include/asm/byteorder.h:29:0,
 from include/compiler.h:125,
 from include/image.h:19,
 from include/common.h:82,
 from drivers/block/ahci.c:10:
drivers/block/ahci.c: In function 'ahci_fill_sg':
drivers/block/ahci.c:464:19: warning: cast from pointer to integer of
different size [-Wpointer-to-int-cast]
   cpu_to_le32((u32) buf + i * MAX_DATA_BYTE_COUNT);
   ^
include/linux/byteorder/little_endian.h:34:51: note: in definition of
macro '__cpu_to_le32'
 #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
   ^
drivers/block/ahci.c:464:7: note: in expansion of macro 'cpu_to_le32'
   cpu_to_le32((u32) buf + i * MAX_DATA_BYTE_COUNT);
   ^
drivers/block/ahci.c: In function 'ahci_port_start':
drivers/block/ahci.c:520:27: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
  volatile u8 *port_mmio = (volatile u8 *)pp->port_mmio;
   ^
drivers/block/ahci.c:532:8: warning: cast from pointer to integer of
different size [-Wpointer-to-int-cast]
  mem = (u32) malloc(AHCI_PORT_PRIV_DMA_SZ + 2048);
^
drivers/block/ahci.c:540:9: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
  memset((u8 *) mem, 0, AHCI_PORT_PRIV_DMA_SZ);
 ^
drivers/block/ahci.c:547:50: warning: cast to pointer from integer of
different size [-Wint

Re: [U-Boot] [PATCH] sunxi: Add Linksprite_pcDuino3_Nano board / defconfig

2015-01-25 Thread Hans de Goede

Hi,

On 26-01-15 04:30, Simon Glass wrote:

Hi Adam,

On 25 January 2015 at 08:24, Adam Sampson  wrote:

This is a low-cost Allwinner A20 board with Arduino-style GPIO headers;
it features 1G RAM, 4G NAND flash, 1 micro-SD, 2 USB sockets, 1 micro
USB socket for OTG and another for power in, HDMI, SATA, 5V power for
SATA devices, gigabit Ethernet, an IR receiver, 3.5mm audio out and a
MIPI camera connector.

For more details, see: http://linux-sunxi.org/LinkSprite_pcDuino3_Nano

Signed-off-by: Adam Sampson 
---
  board/sunxi/MAINTAINERS|5 +
  configs/Linksprite_pcDuino3_Nano_defconfig |   11 +++
  2 files changed, 16 insertions(+)
  create mode 100644 configs/Linksprite_pcDuino3_Nano_defconfig

diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS
index 743e7f5..479d147 100644
--- a/board/sunxi/MAINTAINERS
+++ b/board/sunxi/MAINTAINERS
@@ -100,3 +100,8 @@ MELE M5 BOARD
  M: Ian Campbell 
  S: Maintained
  F: configs/Mele_M5_defconfig
+
+LINKSPRITE-PCDUINO3-NANO BOARD
+M: Adam Sampson 
+S: Maintained
+F: configs/Linksprite_pcDuino3_Nano_defconfig
diff --git a/configs/Linksprite_pcDuino3_Nano_defconfig 
b/configs/Linksprite_pcDuino3_Nano_defconfig
new file mode 100644
index 000..22435eb
--- /dev/null
+++ b/configs/Linksprite_pcDuino3_Nano_defconfig
@@ -0,0 +1,11 @@
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI"
+CONFIG_FDTFILE="sun7i-a20-pcduino3-nano.dtb"
+CONFIG_USB1_VBUS_PIN="PH11"
++S:CONFIG_ARM=y
++S:CONFIG_ARCH_SUNXI=y
++S:CONFIG_MACH_SUN7I=y
++S:CONFIG_TARGET_PCDUINO3_NANO=y
++S:CONFIG_DRAM_CLK=408
++S:CONFIG_DRAM_ZQ=122
++S:CONFIG_DRAM_EMR1=4


Since this is a new board, could it follow along ith the Linksprice
pcDuino3 and support driver rmodel / device tree?


That is a good idea, I think we should be slowly moving over all sunxi
boards to this. Note I'll merge this version as is for now, lets wait
with the devicetree version till the dts is accepted in the upstream
kernel (*).

While on this subject I do want to move to devicetree everywhere, but
I don't want 2 configs per board like with the Linksprite_pcDuino3
from an end user pov the resulting u-boot-sunxi-with-spl.bin works
identical, and that is what we tell sunxi users to use.

So my plan is to just drop the non fdt version of the Linksprite_pcDuino3
config and drop the _fdt suffix on the fdt version, any objections
against that ?

Regards,

Hans




*) Once we've gone all devicetree we need to revisit this as I don't
want new board additions be blocked on this
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] fpga: Extend dump description

2015-01-25 Thread Michal Simek
There are missing parameters in help which fpga dump command
requires.

Signed-off-by: Michal Simek 
---

 common/cmd_fpga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index 484a6c6ce036..7f99aabf8a5c 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -346,7 +346,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga,
   "loadable FPGA image support",
   "[operation type] [device number] [image address] [image size]\n"
   "fpga operations:\n"
-  "  dump\t[dev]\t\t\tLoad device to memory buffer\n"
+  "  dump\t[dev] [address] [size]\tLoad device to memory buffer\n"
   "  info\t[dev]\t\t\tlist known device information\n"
   "  load\t[dev] [address] [size]\tLoad device from memory buffer\n"
 #if defined(CONFIG_CMD_FPGA_LOADP)
--
1.8.2.3



pgpUVz7cZW0hX.pgp
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot