[U-Boot] [PATCH 1/2] RFC: dm: Kconfig: Move all driver model CONFIGs to Kconfig

Kconfig has been available for a while but there are still driver model CONFIG options. Move all of these to Kconfig.
This patch isn't final - I need to wait until the SPL series can be fully applied, which is in turn waiting on some ARM SPL problems. So for now it is just a placeholder. But it needs to be sent out otherwise we will never move over.
Signed-off-by: Simon Glass sjg@chromium.org ---
Kconfig | 2 + arch/arm/Kconfig | 2 + arch/arm/cpu/arm1176/bcm2835/Kconfig | 12 +++ arch/arm/cpu/armv7/exynos/Kconfig | 15 ++++ arch/arm/cpu/armv7/tegra-common/Kconfig | 21 +++++ arch/sandbox/Kconfig | 39 ++++++++++ arch/x86/Kconfig | 9 +++ board/isee/igep0033/Kconfig | 9 +++ board/isee/igep00x0/Kconfig | 9 +++ board/logicpd/am3517evm/Kconfig | 9 +++ board/logicpd/omap3som/Kconfig | 9 +++ board/logicpd/zoom1/Kconfig | 9 +++ board/overo/Kconfig | 9 +++ board/samsung/goni/Kconfig | 9 +++ board/samsung/smdk5420/Kconfig | 6 ++ board/samsung/smdkc100/Kconfig | 9 +++ board/ti/am335x/Kconfig | 10 +++ common/Kconfig | 23 ++++++ configs/Linksprite_pcDuino3_fdt_defconfig | 2 + configs/cm_fx6_defconfig | 3 + configs/mx6qsabreauto_defconfig | 2 + configs/mx6sabresd_spl_defconfig | 3 +- configs/omap3_beagle_defconfig | 3 + configs/omap3_pandora_defconfig | 3 + configs/snapper9260_defconfig | 3 + configs/snapper9g20_defconfig | 3 + doc/driver-model/spi-howto.txt | 4 +- drivers/Kconfig | 4 + drivers/core/Kconfig | 122 +++++++++++++++++++++++++++++- drivers/demo/Kconfig | 26 +++++++ drivers/thermal/Kconfig | 7 ++ include/config_defaults.h | 6 -- include/configs/cm_fx6.h | 4 - include/configs/exynos-common.h | 6 -- include/configs/mx6sabre_common.h | 2 - include/configs/peach-pi.h | 1 - include/configs/peach-pit.h | 1 - include/configs/rpi.h | 6 -- include/configs/s5p_goni.h | 4 - include/configs/sandbox.h | 13 ---- include/configs/smdkc100.h | 4 - include/configs/snapper9260.h | 4 - include/configs/sunxi-common.h | 3 - include/configs/tegra-common.h | 9 --- include/configs/ti_am335x_common.h | 4 - include/configs/ti_omap3_common.h | 4 - include/configs/x86-common.h | 5 -- test/dm/Kconfig | 8 ++ 48 files changed, 399 insertions(+), 81 deletions(-) create mode 100644 arch/arm/cpu/arm1176/bcm2835/Kconfig create mode 100644 drivers/demo/Kconfig create mode 100644 drivers/thermal/Kconfig create mode 100644 test/dm/Kconfig
diff --git a/Kconfig b/Kconfig index 153ee2b..d4ca152 100644 --- a/Kconfig +++ b/Kconfig @@ -158,3 +158,5 @@ source "drivers/Kconfig" source "fs/Kconfig"
source "lib/Kconfig" + +source "test/dm/Kconfig" diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 7a64b66..d46362c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -799,6 +799,8 @@ endchoice
source "arch/arm/cpu/arm926ejs/davinci/Kconfig"
+source "arch/arm/cpu/arm1176/bcm2835/Kconfig" + source "arch/arm/cpu/armv7/exynos/Kconfig"
source "arch/arm/cpu/armv7/highbank/Kconfig" diff --git a/arch/arm/cpu/arm1176/bcm2835/Kconfig b/arch/arm/cpu/arm1176/bcm2835/Kconfig new file mode 100644 index 0000000..cb88664 --- /dev/null +++ b/arch/arm/cpu/arm1176/bcm2835/Kconfig @@ -0,0 +1,12 @@ +if TARGET_RPI_B + +config DM + default y + +config DM_SERIAL + default y + +config DM_GPIO + default y + +endif diff --git a/arch/arm/cpu/armv7/exynos/Kconfig b/arch/arm/cpu/armv7/exynos/Kconfig index f3eadb4..a5748ad 100644 --- a/arch/arm/cpu/armv7/exynos/Kconfig +++ b/arch/arm/cpu/armv7/exynos/Kconfig @@ -61,6 +61,21 @@ endchoice config SYS_SOC default "exynos"
+config DM + default y + +config DM_SERIAL + default y + +config DM_SPI + default y + +config DM_SPI_FLASH + default y + +config DM_GPIO + default y + source "board/samsung/smdkv310/Kconfig" source "board/samsung/trats/Kconfig" source "board/samsung/universal_c210/Kconfig" diff --git a/arch/arm/cpu/armv7/tegra-common/Kconfig b/arch/arm/cpu/armv7/tegra-common/Kconfig index 1446452..898e86d 100644 --- a/arch/arm/cpu/armv7/tegra-common/Kconfig +++ b/arch/arm/cpu/armv7/tegra-common/Kconfig @@ -20,6 +20,27 @@ endchoice config USE_PRIVATE_LIBGCC default y if SPL_BUILD
+config DM + default y + +config SPL_DM + default y + +config DM_SERIAL + default y + +config DM_SPI + default y + +config DM_SPI_FLASH + default y + +config DM_I2C + default y + +config DM_GPIO + default y + source "arch/arm/cpu/armv7/tegra20/Kconfig" source "arch/arm/cpu/armv7/tegra30/Kconfig" source "arch/arm/cpu/armv7/tegra114/Kconfig" diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 3057325..1b4cbce 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -10,4 +10,43 @@ config SYS_BOARD config SYS_CONFIG_NAME default "sandbox"
+config DM + default y + +config DM_GPIO + default y + +config DM_SERIAL + default y + +config CMD_DEMO + default y + +config CMD_DM + default y + +config DM_DEMO + default y + +config DM_DEMO_SIMPLE + default y + +config DM_DEMO_SHAPE + default y + +config DM_TEST + default y + +config DM_CROS_EC + default y + +config DM_SPI + default y + +config DM_SPI_FLASH + default y + +config DM_I2C + default y + endmenu diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 4f5ce38..b523f25 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -34,6 +34,15 @@ config TARGET_CHROMEBOOK_LINK
endchoice
+config DM + default y + +config DM_GPIO + default y + +config DM_SERIAL + default y + config RAMBASE hex default 0x100000 diff --git a/board/isee/igep0033/Kconfig b/board/isee/igep0033/Kconfig index e989e4b..9a8421e 100644 --- a/board/isee/igep0033/Kconfig +++ b/board/isee/igep0033/Kconfig @@ -12,4 +12,13 @@ config SYS_SOC config SYS_CONFIG_NAME default "am335x_igep0033"
+config DM + default y + +config DM_GPIO + default y + +config DM_SERIAL + default y + endif diff --git a/board/isee/igep00x0/Kconfig b/board/isee/igep00x0/Kconfig index aa46882..d383822 100644 --- a/board/isee/igep00x0/Kconfig +++ b/board/isee/igep00x0/Kconfig @@ -9,4 +9,13 @@ config SYS_VENDOR config SYS_CONFIG_NAME default "omap3_igep00x0"
+config DM + default y + +config DM_GPIO + default y + +config DM_SERIAL + default y + endif diff --git a/board/logicpd/am3517evm/Kconfig b/board/logicpd/am3517evm/Kconfig index 901f609..014ed27 100644 --- a/board/logicpd/am3517evm/Kconfig +++ b/board/logicpd/am3517evm/Kconfig @@ -9,4 +9,13 @@ config SYS_VENDOR config SYS_CONFIG_NAME default "am3517_evm"
+config DM + default y + +config DM_GPIO + default y + +config DM_SERIAL + default y + endif diff --git a/board/logicpd/omap3som/Kconfig b/board/logicpd/omap3som/Kconfig index 03d272a..0039344 100644 --- a/board/logicpd/omap3som/Kconfig +++ b/board/logicpd/omap3som/Kconfig @@ -9,4 +9,13 @@ config SYS_VENDOR config SYS_CONFIG_NAME default "omap3_logic"
+config DM + default y + +config DM_GPIO + default y + +config DM_SERIAL + default y + endif diff --git a/board/logicpd/zoom1/Kconfig b/board/logicpd/zoom1/Kconfig index d76cb66..b25e5c7 100644 --- a/board/logicpd/zoom1/Kconfig +++ b/board/logicpd/zoom1/Kconfig @@ -9,4 +9,13 @@ config SYS_VENDOR config SYS_CONFIG_NAME default "omap3_zoom1"
+config DM + default y + +config DM_GPIO + default y + +config DM_SERIAL + default y + endif diff --git a/board/overo/Kconfig b/board/overo/Kconfig index 74572a6..8f22235 100644 --- a/board/overo/Kconfig +++ b/board/overo/Kconfig @@ -6,4 +6,13 @@ config SYS_BOARD config SYS_CONFIG_NAME default "omap3_overo"
+config DM + default y + +config DM_GPIO + default y + +config DM_SERIAL + default y + endif diff --git a/board/samsung/goni/Kconfig b/board/samsung/goni/Kconfig index cbbf5a9..006e864 100644 --- a/board/samsung/goni/Kconfig +++ b/board/samsung/goni/Kconfig @@ -12,4 +12,13 @@ config SYS_SOC config SYS_CONFIG_NAME default "s5p_goni"
+config DM + default y + +config DM_GPIO + default y + +config DM_SERIAL + default y + endif diff --git a/board/samsung/smdk5420/Kconfig b/board/samsung/smdk5420/Kconfig index e7aafe5..9f22aac 100644 --- a/board/samsung/smdk5420/Kconfig +++ b/board/samsung/smdk5420/Kconfig @@ -12,6 +12,9 @@ config SYS_CONFIG_NAME string default "peach-pi"
+config DM_CROS_EC + default y + endif
if TARGET_PEACH_PIT @@ -25,6 +28,9 @@ config SYS_VENDOR config SYS_CONFIG_NAME default "peach-pit"
+config DM_CROS_EC + default y + endif
if TARGET_SMDK5420 diff --git a/board/samsung/smdkc100/Kconfig b/board/samsung/smdkc100/Kconfig index d2157b4..ea87166 100644 --- a/board/samsung/smdkc100/Kconfig +++ b/board/samsung/smdkc100/Kconfig @@ -12,4 +12,13 @@ config SYS_SOC config SYS_CONFIG_NAME default "smdkc100"
+config DM + default y + +config DM_GPIO + default y + +config DM_SERIAL + default y + endif diff --git a/board/ti/am335x/Kconfig b/board/ti/am335x/Kconfig index 1ddbb2c..f0ca351 100644 --- a/board/ti/am335x/Kconfig +++ b/board/ti/am335x/Kconfig @@ -37,4 +37,14 @@ config NOR_BOOT booted via NOR. In this case we will enable certain pinmux early as the ROM only partially sets up pinmux. We also default to using NOR for environment. + +config DM + default y + +config DM_GPIO + default y + +config DM_SERIAL + default y + endif diff --git a/common/Kconfig b/common/Kconfig index fd84fa0..174bf4f 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -153,6 +153,29 @@ endmenu
menu "Device access commands"
+config CMD_DM + bool "dm - Access to driver model information" + depends on DM + default y + help + Provides access to driver model data structures and information, + such as a list of devices, list of uclasses and the state of each + device (e.g. activated). This is not required for operation, but + can be useful to see the state of driver model for debugging or + interest. + +config CMD_DEMO + bool "demo - Demonstration commands for driver model" + depends on DM + help + Procides a 'demo' command which can be used to play around with + driver model. To use this properly you will need to enable one or + both of the demo devices (DM_DEMO_SHAPE and DM_DEMO_SIMPLE). + Otherwise you will always get an empty list of devices. The demo + devices are defined in the sandbox device tree, so the easiest + option is to use sandbox and pass the -d point to sandbox's + u-boot.dtb file. + config CMD_LOADB bool "loadb" help diff --git a/configs/Linksprite_pcDuino3_fdt_defconfig b/configs/Linksprite_pcDuino3_fdt_defconfig index a33f3a7..931b5dd 100644 --- a/configs/Linksprite_pcDuino3_fdt_defconfig +++ b/configs/Linksprite_pcDuino3_fdt_defconfig @@ -2,6 +2,8 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI" CONFIG_FDTFILE="sun7i-a20-pcduino3.dtb" CONFIG_DM=y +CONFIG_DM_GPIO=y +CONFIG_DM_SERIAL=y CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3" CONFIG_OF_CONTROL=y CONFIG_OF_SEPARATE=y diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig index 3c0d64f..d2ebf69 100644 --- a/configs/cm_fx6_defconfig +++ b/configs/cm_fx6_defconfig @@ -2,3 +2,6 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,MX6QDL,SPL" +S:CONFIG_ARM=y +S:CONFIG_TARGET_CM_FX6=y +CONFIG_DM=y +CONFIG_DM_GPIO=y +CONFIG_DM_SERIAL=y diff --git a/configs/mx6qsabreauto_defconfig b/configs/mx6qsabreauto_defconfig index 7d86700..ba9e512 100644 --- a/configs/mx6qsabreauto_defconfig +++ b/configs/mx6qsabreauto_defconfig @@ -1,3 +1,5 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6qsabreauto/imximage.cfg,MX6Q" CONFIG_ARM=y CONFIG_TARGET_MX6QSABREAUTO=y +CONFIG_DM=y +CONFIG_DM_THERMAL=y diff --git a/configs/mx6sabresd_spl_defconfig b/configs/mx6sabresd_spl_defconfig index 12e7844..67079ba 100644 --- a/configs/mx6sabresd_spl_defconfig +++ b/configs/mx6sabresd_spl_defconfig @@ -2,4 +2,5 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,SPL,MX6Q" +S:CONFIG_ARM=y +S:CONFIG_TARGET_MX6SABRESD=y - +CONFIG_DM=y +CONFIG_DM_THERMAL=y diff --git a/configs/omap3_beagle_defconfig b/configs/omap3_beagle_defconfig index a3e4c2c..5a2d20b 100644 --- a/configs/omap3_beagle_defconfig +++ b/configs/omap3_beagle_defconfig @@ -3,3 +3,6 @@ CONFIG_SYS_EXTRA_OPTIONS="NAND" +S:CONFIG_ARM=y +S:CONFIG_OMAP34XX=y +S:CONFIG_TARGET_OMAP3_BEAGLE=y +CONFIG_DM=y +CONFIG_DM_GPIO=y +CONFIG_DM_SERIAL=y diff --git a/configs/omap3_pandora_defconfig b/configs/omap3_pandora_defconfig index bf28537..ddc5f99 100644 --- a/configs/omap3_pandora_defconfig +++ b/configs/omap3_pandora_defconfig @@ -1,3 +1,6 @@ CONFIG_ARM=y CONFIG_OMAP34XX=y CONFIG_TARGET_OMAP3_PANDORA=y +CONFIG_DM=y +CONFIG_DM_GPIO=y +CONFIG_DM_SERIAL=y diff --git a/configs/snapper9260_defconfig b/configs/snapper9260_defconfig index 7055e2a..035146c 100644 --- a/configs/snapper9260_defconfig +++ b/configs/snapper9260_defconfig @@ -1,3 +1,6 @@ CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9260" CONFIG_ARM=y CONFIG_TARGET_SNAPPER9260=y +CONFIG_DM=y +CONFIG_DM_GPIO=y +CONFIG_DM_SERIAL=y diff --git a/configs/snapper9g20_defconfig b/configs/snapper9g20_defconfig index 2faae15..66c44cc 100644 --- a/configs/snapper9g20_defconfig +++ b/configs/snapper9g20_defconfig @@ -1,3 +1,6 @@ CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9G20" CONFIG_ARM=y CONFIG_TARGET_SNAPPER9260=y +CONFIG_DM=y +CONFIG_DM_GPIO=y +CONFIG_DM_SERIAL=y diff --git a/doc/driver-model/spi-howto.txt b/doc/driver-model/spi-howto.txt index 719dbd5..12dfc90 100644 --- a/doc/driver-model/spi-howto.txt +++ b/doc/driver-model/spi-howto.txt @@ -39,8 +39,8 @@ with only minor changes:
Add these to your board config:
-#define CONFIG_DM_SPI -#define CONFIG_DM_SPI_FLASH +CONFIG_DM_SPI +CONFIG_DM_SPI_FLASH
2. Add the skeleton diff --git a/drivers/Kconfig b/drivers/Kconfig index 128736d..dcce532 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -2,6 +2,8 @@ menu "Device Drivers"
source "drivers/core/Kconfig"
+source "drivers/demo/Kconfig" + source "drivers/pci/Kconfig"
source "drivers/pcmcia/Kconfig" @@ -48,4 +50,6 @@ source "drivers/dma/Kconfig"
source "drivers/crypto/Kconfig"
+source "drivers/thermal/Kconfig" + endmenu diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index d2799dc..2ae2cc4 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -2,5 +2,123 @@ config DM bool "Enable Driver Model" depends on !SPL_BUILD help - This config option enables Driver Model. - To use legacy drivers, say N. + This config option enables Driver Model. This brings in the core + support, including scanning of platform data on start-up. If + CONFIG_OF_CONTROL is enabled, the device tree will be scanned also + when available. + +config DM_SERIAL + bool "Enable Driver Model for serial" + depends on DM + help + Enable driver model for serial. This replaces + drivers/serial/serial.c with the serial uclass, which + implements serial_putc() etc. The uclass interface is + defined in include/serial.h. + +config DM_GPIO + bool "Enable Driver Model for GPIO" + depends on DM + help + Enable driver model for GPIO access. The standard GPIO + interface (gpio_get_value(), etc.) is then implemented by + the GPIO uclass. Drivers provide methods to query the + particular GPIOs that they provide. The uclass interface + is defined in include/asm-generic/gpio.h. + +config DM_SPI + bool "Enable Driver Model for SPI" + depends on DM + help + Enable driver model for SPI. The SPI slave interface + (spi_setup_slave(), spi_xfer(), etc.) is then implemented by + the SPI uclass. Drivers provide methods to access the SPI + buses that they control. The uclass interface is defined in + include/spi.h. The existing spi_slave structure is attached + as 'parent data' to every slave on each bus. Slaves + typically use driver-private data instead of extending the + spi_slave structure. + +config DM_I2C + bool "Enable Driver Model for I2C" + depends on DM + help + Enable driver model for I2C. This SPI flash interface + (spi_flash_probe(), spi_flash_write(), etc.) is then + implemented by the SPI flash uclass. There is one standard + SPI flash driver which knows how to probe most chips + supported by U-Boot. The uclass interface is defined in + include/spi_flash.h, but is currently fully compatible + with the old interface to avoid confusion and duplication + during the transition parent. SPI and SPI flash must be + enabled together (it is not possible to use driver model + for one and not the other). + +config DM_SPI_FLASH + bool "Enable Driver Model for SPI flash" + depends on DM && SPI + help + Enable driver model for SPI flash. This SPI flash interface + (spi_flash_probe(), spi_flash_write(), etc.) is then + implemented by the SPI flash uclass. There is one standard + SPI flash driver which knows how to probe most chips + supported by U-Boot. The uclass interface is defined in + include/spi_flash.h, but is currently fully compatible + with the old interface to avoid confusion and duplication + during the transition parent. SPI and SPI flash must be + enabled together (it is not possible to use driver model + for one and not the other). + +config DM_CROS_EC + bool "Enable Driver Model for Chrome OS EC" + depends on DM + help + Enable driver model for the Chrome OS EC interface. This + allows the cros_ec SPI driver to operate with CONFIG_DM_SPI + but otherwise makes few changes. Since cros_ec also supports + I2C and LPC (which don't support driver model yet), a full + conversion is not yet possible. + +config SPL_DM + bool "Enable Driver Model for SPL" + depends on DM && SPL + help + Enable driver model in SPL. You will need to provide a + suitable malloc() implementation. If you are not using the + full malloc() enabled by CONFIG_SYS_SPL_MALLOC_START, + consider using CONFIG_SYS_MALLOC_SIMPLE. In that case you + must provide CONFIG_SYS_MALLOC_F_LEN to set the size. + In most cases driver model will only allocate a few uclasses + and devices in SPL, so 1KB should be enable. See + CONFIG_SYS_MALLOC_F_LEN for more details on how to enable it. + +config DM_WARN + bool "Enable warnings in driver model" + help + The dm_warn() function can use up quite a bit of space for its + strings. By default this is disabled for SPL builds to save space. + This will cause dm_warn() to be compiled out - it will do nothing + when called. + depends on DM + default y if !SPL_BUILD + default n if SPL_BUILD + +config DM_DEVICE_REMOVE + bool "Support device removal" + help + We can save some code space by dropping support for removing a + device. This is not normally required in SPL, so by default this + option is disabled for SPL. + depends on DM + default y if !SPL_BUILD + default n if SPL_BUILD + +config DM_STDIO + bool "Support stdio registration" + help + Normally serial drivers register with stdio so that they can be used + as normal output devices. In SPL we don't normally use stdio, so + we can omit this feature. + depends on DM + default y if !SPL_BUILD + default n if SPL_BUILD diff --git a/drivers/demo/Kconfig b/drivers/demo/Kconfig new file mode 100644 index 0000000..4234fe4 --- /dev/null +++ b/drivers/demo/Kconfig @@ -0,0 +1,26 @@ +config DM_DEMO + bool "Enable demo uclass support" + depends on DM + help + This uclass allows you to play around with driver model. It provides + an interface to a couple of demo devices. You can access it using + the 'demo' command or by calling the uclass functions from your + own code. + +config DM_DEMO_SIMPLE + bool "Enable simple demo device for driver model" + depends on DM + help + This device allows you to play around with driver model. It prints + a message when the 'demo hello' command is executed which targets + this device. It can be used to help understand how driver model + works. + +config DM_DEMO_SHAPE + bool "Enable shape demo device for driver model" + depends on DM + help + This device allows you to play around with driver model. It prints + a shape when the 'demo hello' command is executed which targets + this device. It can be used to help understand how driver model + works. diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig new file mode 100644 index 0000000..3c6b36d --- /dev/null +++ b/drivers/thermal/Kconfig @@ -0,0 +1,7 @@ +config DM_THERMAL + bool "Driver support for thermal devices" + help + Enable support for temporary-sensing devices. Some SoCs have on-chip + temperature sensors to permit warnings, speed throttling or even + automatic power-off when the temperature gets too high or low. Other + devices may be discrete but connected on a suitable bus. diff --git a/include/config_defaults.h b/include/config_defaults.h index 4d49315..ad08c1d 100644 --- a/include/config_defaults.h +++ b/include/config_defaults.h @@ -20,10 +20,4 @@ #define CONFIG_ZLIB 1 #define CONFIG_PARTITIONS 1
-#ifndef CONFIG_SPL_BUILD -#define CONFIG_DM_WARN -#define CONFIG_DM_DEVICE_REMOVE -#define CONFIG_DM_STDIO -#endif - #endif diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index f7277eb..0a4d93f 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -21,13 +21,9 @@ #define CONFIG_MACH_TYPE 4273
#ifndef CONFIG_SPL_BUILD -#define CONFIG_DM -#define CONFIG_CMD_DM
-#define CONFIG_DM_GPIO #define CONFIG_CMD_GPIO
-#define CONFIG_DM_SERIAL #define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #endif
diff --git a/include/configs/exynos-common.h b/include/configs/exynos-common.h index 1f3ee55..2c4f35a 100644 --- a/include/configs/exynos-common.h +++ b/include/configs/exynos-common.h @@ -17,12 +17,6 @@ #include <linux/sizes.h>
#define CONFIG_SYS_GENERIC_BOARD -#define CONFIG_DM -#define CONFIG_CMD_DM -#define CONFIG_DM_GPIO -#define CONFIG_DM_SERIAL -#define CONFIG_DM_SPI -#define CONFIG_DM_SPI_FLASH
#define CONFIG_ARCH_CPU_INIT #define CONFIG_DISPLAY_CPUINFO diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h index 9fdd841..379a25d 100644 --- a/include/configs/mx6sabre_common.h +++ b/include/configs/mx6sabre_common.h @@ -25,8 +25,6 @@ #define CONFIG_INITRD_TAG #define CONFIG_REVISION_TAG
-#define CONFIG_DM -#define CONFIG_DM_THERMAL #define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #define CONFIG_IMX6_THERMAL
diff --git a/include/configs/peach-pi.h b/include/configs/peach-pi.h index 8a82402..ccba3eb 100644 --- a/include/configs/peach-pi.h +++ b/include/configs/peach-pi.h @@ -38,7 +38,6 @@
#define CONFIG_POWER_TPS65090_EC #define CONFIG_CROS_EC_SPI /* Support CROS_EC over SPI */ -#define CONFIG_DM_CROS_EC
#define CONFIG_USB_XHCI #define CONFIG_USB_XHCI_EXYNOS diff --git a/include/configs/peach-pit.h b/include/configs/peach-pit.h index ad5db57..5cbaa54 100644 --- a/include/configs/peach-pit.h +++ b/include/configs/peach-pit.h @@ -38,7 +38,6 @@
#define CONFIG_POWER_TPS65090_EC #define CONFIG_CROS_EC_SPI /* Support CROS_EC over SPI */ -#define CONFIG_DM_CROS_EC
#define CONFIG_USB_XHCI #define CONFIG_USB_XHCI_EXYNOS diff --git a/include/configs/rpi.h b/include/configs/rpi.h index c94f411..ea19ad8 100644 --- a/include/configs/rpi.h +++ b/include/configs/rpi.h @@ -30,12 +30,6 @@ */ #define CONFIG_MACH_TYPE MACH_TYPE_BCM2708
-/* Enable driver model */ -#define CONFIG_DM -#define CONFIG_CMD_DM -#define CONFIG_DM_GPIO -#define CONFIG_DM_SERIAL - /* Memory layout */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE 0x00000000 diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h index dfa2e07..26167a4 100644 --- a/include/configs/s5p_goni.h +++ b/include/configs/s5p_goni.h @@ -290,9 +290,5 @@ #define CONFIG_OF_LIBFDT
#define CONFIG_SYS_GENERIC_BOARD -#define CONFIG_DM -#define CONFIG_CMD_DM -#define CONFIG_DM_GPIO -#define CONFIG_DM_SERIAL
#endif /* __CONFIG_H */ diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 657f751..3f4d588 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -23,16 +23,6 @@
#define CONFIG_BOOTSTAGE #define CONFIG_BOOTSTAGE_REPORT -#define CONFIG_DM -#define CONFIG_CMD_DEMO -#define CONFIG_CMD_DM -#define CONFIG_DM_DEMO -#define CONFIG_DM_DEMO_SIMPLE -#define CONFIG_DM_DEMO_SHAPE -#define CONFIG_DM_GPIO -#define CONFIG_DM_TEST -#define CONFIG_DM_SERIAL -#define CONFIG_DM_CROS_EC
#define CONFIG_SYS_STDIO_DEREGISTER
@@ -100,8 +90,6 @@ #define CONFIG_CMD_SF_TEST #define CONFIG_CMD_SPI #define CONFIG_SPI_FLASH -#define CONFIG_DM_SPI -#define CONFIG_DM_SPI_FLASH #define CONFIG_SPI_FLASH_ATMEL #define CONFIG_SPI_FLASH_EON #define CONFIG_SPI_FLASH_GIGADEVICE @@ -112,7 +100,6 @@ #define CONFIG_SPI_FLASH_STMICRO #define CONFIG_SPI_FLASH_WINBOND
-#define CONFIG_DM_I2C #define CONFIG_CMD_I2C #define CONFIG_SYS_I2C_SANDBOX #define CONFIG_I2C_EDID diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h index 982d0dc..a7eb33e 100644 --- a/include/configs/smdkc100.h +++ b/include/configs/smdkc100.h @@ -224,9 +224,5 @@ #define CONFIG_OF_LIBFDT
#define CONFIG_SYS_GENERIC_BOARD -#define CONFIG_DM -#define CONFIG_CMD_DM -#define CONFIG_DM_GPIO -#define CONFIG_DM_SERIAL
#endif /* __CONFIG_H */ diff --git a/include/configs/snapper9260.h b/include/configs/snapper9260.h index 942af2e..504e456 100644 --- a/include/configs/snapper9260.h +++ b/include/configs/snapper9260.h @@ -21,10 +21,6 @@ #define CONFIG_SYS_AT91_MAIN_CLOCK 18432000 /* External Crystal, in Hz */ #define CONFIG_SYS_AT91_SLOW_CLOCK 32768 #define CONFIG_SYS_GENERIC_BOARD -#define CONFIG_DM -#define CONFIG_CMD_DM -#define CONFIG_DM_GPIO -#define CONFIG_DM_SERIAL #define CONFIG_SYS_MALLOC_F_LEN (1 << 10)
/* CPU */ diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 3f890b2..5e9223a 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -28,9 +28,6 @@ #define CONFIG_SYS_TEXT_BASE 0x4a000000
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM) -# define CONFIG_CMD_DM -# define CONFIG_DM_GPIO -# define CONFIG_DM_SERIAL # define CONFIG_DW_SERIAL # define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #endif diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h index 3ce566c..08f0b2a 100644 --- a/include/configs/tegra-common.h +++ b/include/configs/tegra-common.h @@ -18,15 +18,6 @@
#include <asm/arch/tegra.h> /* get chip and board defs */
-#define CONFIG_DM -#define CONFIG_SPL_DM -#define CONFIG_CMD_DM -#define CONFIG_DM_SERIAL -#define CONFIG_DM_SPI -#define CONFIG_DM_SPI_FLASH -#define CONFIG_DM_I2C -#define CONFIG_DM_GPIO - #define CONFIG_SYS_TIMER_RATE 1000000 #define CONFIG_SYS_TIMER_COUNTER NV_PA_TMRUS_BASE
diff --git a/include/configs/ti_am335x_common.h b/include/configs/ti_am335x_common.h index 5ed86d9..4ce9d49 100644 --- a/include/configs/ti_am335x_common.h +++ b/include/configs/ti_am335x_common.h @@ -20,10 +20,6 @@ #define CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC
#ifndef CONFIG_SPL_BUILD -# define CONFIG_DM -# define CONFIG_CMD_DM -# define CONFIG_DM_GPIO -# define CONFIG_DM_SERIAL # define CONFIG_OMAP_SERIAL # define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #endif diff --git a/include/configs/ti_omap3_common.h b/include/configs/ti_omap3_common.h index 3c634ee..77211de 100644 --- a/include/configs/ti_omap3_common.h +++ b/include/configs/ti_omap3_common.h @@ -19,10 +19,6 @@ #include <asm/arch/omap3.h>
#ifndef CONFIG_SPL_BUILD -# define CONFIG_DM -# define CONFIG_CMD_DM -# define CONFIG_DM_GPIO -# define CONFIG_DM_SERIAL # define CONFIG_OMAP_SERIAL # define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #endif diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h index f16ae32..30f0d57 100644 --- a/include/configs/x86-common.h +++ b/include/configs/x86-common.h @@ -22,11 +22,6 @@ #define CONFIG_DISPLAY_BOARDINFO_LATE #define CONFIG_DISPLAY_CPUINFO
-#define CONFIG_DM -#define CONFIG_CMD_DM -#define CONFIG_DM_GPIO -#define CONFIG_DM_SERIAL - #define CONFIG_LMB #define CONFIG_OF_LIBFDT
diff --git a/test/dm/Kconfig b/test/dm/Kconfig new file mode 100644 index 0000000..2e7e031 --- /dev/null +++ b/test/dm/Kconfig @@ -0,0 +1,8 @@ +config DM_TEST + bool "Enable driver model test command" + depends on SANDBOX + help + This enables the 'dm test' command which runs a series of unit + tests on the driver model code. Each subsystem (uclass) is tested. + If all is well then all tests pass although there will be a few + messages printed along the way.

Move this option to Kconfig and update all boards. Signed-off-by: Simon Glass sjg@chromium.org ---
Kconfig | 9 +++++++++ arch/arm/cpu/armv7/tegra-common/Kconfig | 3 +++ arch/arm/cpu/armv7/uniphier/Kconfig | 3 +++ arch/x86/Kconfig | 3 +++ include/configs/cm_fx6.h | 3 --- include/configs/exynos-common.h | 1 - include/configs/mx6sabre_common.h | 1 - include/configs/rpi.h | 1 - include/configs/s5p_goni.h | 1 - include/configs/sandbox.h | 1 - include/configs/smdkc100.h | 3 --- include/configs/snapper9260.h | 1 - include/configs/sunxi-common.h | 1 - include/configs/tegra-common.h | 1 - include/configs/ti_am335x_common.h | 1 - include/configs/ti_omap3_common.h | 1 - include/configs/uniphier-common.h | 2 -- include/configs/x86-common.h | 1 - 18 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/Kconfig b/Kconfig index d4ca152..9208d40 100644 --- a/Kconfig +++ b/Kconfig @@ -56,6 +56,15 @@ config CC_OPTIMIZE_FOR_SIZE
This option is enabled by default for U-Boot.
+config SYS_MALLOC_F_LEN + hex "Size of malloc() pool before relocation" + default 0x400 + help + Before relocation memory is very limited on many platforms. Still, + we can provide a small malloc() pool if needed. Driver model in + particular needs this to operate, so that it can allocate the + initial serial device and any others that are needed. + endmenu # General setup
menuconfig EXPERT diff --git a/arch/arm/cpu/armv7/tegra-common/Kconfig b/arch/arm/cpu/armv7/tegra-common/Kconfig index 898e86d..9c98d19 100644 --- a/arch/arm/cpu/armv7/tegra-common/Kconfig +++ b/arch/arm/cpu/armv7/tegra-common/Kconfig @@ -17,6 +17,9 @@ config TEGRA124
endchoice
+config SYS_MALLOC_F_LEN + default 0x1800 + config USE_PRIVATE_LIBGCC default y if SPL_BUILD
diff --git a/arch/arm/cpu/armv7/uniphier/Kconfig b/arch/arm/cpu/armv7/uniphier/Kconfig index 36b7f11..d68a262 100644 --- a/arch/arm/cpu/armv7/uniphier/Kconfig +++ b/arch/arm/cpu/armv7/uniphier/Kconfig @@ -23,6 +23,9 @@ config MACH_PH1_SLD8
endchoice
+config SYS_MALLOC_F_LEN + default 0x2000 + config CMD_PINMON bool "Enable boot mode pins monitor command" depends on !SPL_BUILD diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index b523f25..969634f 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -43,6 +43,9 @@ config DM_GPIO config DM_SERIAL default y
+config SYS_MALLOC_F_LEN + default 0x800 + config RAMBASE hex default 0x100000 diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index 0a4d93f..94ef7ab 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -21,10 +21,7 @@ #define CONFIG_MACH_TYPE 4273
#ifndef CONFIG_SPL_BUILD - #define CONFIG_CMD_GPIO - -#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #endif
/* Display information on boot */ diff --git a/include/configs/exynos-common.h b/include/configs/exynos-common.h index 2c4f35a..59676ae 100644 --- a/include/configs/exynos-common.h +++ b/include/configs/exynos-common.h @@ -36,7 +36,6 @@ #define CONFIG_ENV_OVERWRITE
/* Size of malloc() pool before and after relocation */ -#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (80 << 20))
/* select serial console configuration */ diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h index 379a25d..d174f97 100644 --- a/include/configs/mx6sabre_common.h +++ b/include/configs/mx6sabre_common.h @@ -25,7 +25,6 @@ #define CONFIG_INITRD_TAG #define CONFIG_REVISION_TAG
-#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #define CONFIG_IMX6_THERMAL
#define CONFIG_SYS_GENERIC_BOARD diff --git a/include/configs/rpi.h b/include/configs/rpi.h index ea19ad8..7ad8d08 100644 --- a/include/configs/rpi.h +++ b/include/configs/rpi.h @@ -46,7 +46,6 @@ CONFIG_SYS_SDRAM_SIZE - \ GENERATED_GBL_DATA_SIZE) #define CONFIG_SYS_MALLOC_LEN SZ_4M -#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #define CONFIG_SYS_MEMTEST_START 0x00100000 #define CONFIG_SYS_MEMTEST_END 0x00200000 #define CONFIG_LOADADDR 0x00200000 diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h index 26167a4..8fadc68 100644 --- a/include/configs/s5p_goni.h +++ b/include/configs/s5p_goni.h @@ -40,7 +40,6 @@ #define CONFIG_CMDLINE_EDITING
/* Size of malloc() pool before and after relocation */ -#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (80 << 20))
/* diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 3f4d588..977b1ab 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -63,7 +63,6 @@ /* * Size of malloc() pool, before and after relocation */ -#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #define CONFIG_MALLOC_F_ADDR 0x0010000 #define CONFIG_SYS_MALLOC_LEN (32 << 20) /* 32MB */
diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h index a7eb33e..080fc3a 100644 --- a/include/configs/smdkc100.h +++ b/include/configs/smdkc100.h @@ -48,9 +48,6 @@ */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (1 << 20))
-/* Small malloc pool before relocation */ -#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) - /* * select serial console configuration */ diff --git a/include/configs/snapper9260.h b/include/configs/snapper9260.h index 504e456..4836ca3 100644 --- a/include/configs/snapper9260.h +++ b/include/configs/snapper9260.h @@ -21,7 +21,6 @@ #define CONFIG_SYS_AT91_MAIN_CLOCK 18432000 /* External Crystal, in Hz */ #define CONFIG_SYS_AT91_SLOW_CLOCK 32768 #define CONFIG_SYS_GENERIC_BOARD -#define CONFIG_SYS_MALLOC_F_LEN (1 << 10)
/* CPU */ #define CONFIG_ARCH_CPU_INIT diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 5e9223a..b92d853 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -29,7 +29,6 @@
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM) # define CONFIG_DW_SERIAL -# define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #endif
/* diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h index 08f0b2a..945ccd1 100644 --- a/include/configs/tegra-common.h +++ b/include/configs/tegra-common.h @@ -37,7 +37,6 @@ * Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (4 << 20) /* 4MB */ -#define CONFIG_SYS_MALLOC_F_LEN (4 << 10) #ifdef CONFIG_SPL_BUILD #define CONFIG_SYS_MALLOC_SIMPLE #endif diff --git a/include/configs/ti_am335x_common.h b/include/configs/ti_am335x_common.h index 4ce9d49..20a55f4 100644 --- a/include/configs/ti_am335x_common.h +++ b/include/configs/ti_am335x_common.h @@ -21,7 +21,6 @@
#ifndef CONFIG_SPL_BUILD # define CONFIG_OMAP_SERIAL -# define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #endif
#include <asm/arch/omap.h> diff --git a/include/configs/ti_omap3_common.h b/include/configs/ti_omap3_common.h index 77211de..840e108 100644 --- a/include/configs/ti_omap3_common.h +++ b/include/configs/ti_omap3_common.h @@ -20,7 +20,6 @@
#ifndef CONFIG_SPL_BUILD # define CONFIG_OMAP_SERIAL -# define CONFIG_SYS_MALLOC_F_LEN (1 << 10) #endif
/* The chip has SDRC controller */ diff --git a/include/configs/uniphier-common.h b/include/configs/uniphier-common.h index 2140fcc..76ab4f6 100644 --- a/include/configs/uniphier-common.h +++ b/include/configs/uniphier-common.h @@ -43,8 +43,6 @@ are defined. Select only one of them." #define CONFIG_SMC911X_BASE CONFIG_SUPPORT_CARD_ETHER_BASE #define CONFIG_SMC911X_32_BIT
-#define CONFIG_SYS_MALLOC_F_LEN 0x2000 - /*----------------------------------------------------------------------- * MMU and Cache Setting *----------------------------------------------------------------------*/ diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h index 30f0d57..48cf2fc 100644 --- a/include/configs/x86-common.h +++ b/include/configs/x86-common.h @@ -187,7 +187,6 @@ #define CONFIG_SYS_STACK_SIZE (32 * 1024) #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_MALLOC_LEN 0x200000 -#define CONFIG_SYS_MALLOC_F_LEN (2 << 10)
/* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE

Hi Simon,
2014-12-09 22:21 GMT+09:00 Simon Glass sjg@chromium.org:
diff --git a/arch/arm/cpu/armv7/tegra-common/Kconfig b/arch/arm/cpu/armv7/tegra-common/Kconfig index 898e86d..9c98d19 100644 --- a/arch/arm/cpu/armv7/tegra-common/Kconfig +++ b/arch/arm/cpu/armv7/tegra-common/Kconfig @@ -17,6 +17,9 @@ config TEGRA124
endchoice
+config SYS_MALLOC_F_LEN
default 0x1800
I do not object against your way now, but it seems unfortunate because I think this kind of stuff should go to _defconfig.
The problem is that we have much more defconfig files than Linux without much differences but we do not have something like tegra-common_defconfig.
I have been thinking of this these days.
Perhaps, one possible solution I have come up with is to use scripts/kconfig/merge_config.sh For example,
- "make tegra30_defconfig" + tegra30_harmony.config -> Harmony board - "make tegra30_defconfig" + tegra30_seaboard.config -> Seaboard

Hi Masahiro,
On 11 December 2014 at 10:53, Masahiro YAMADA yamada.m@jp.panasonic.com wrote:
Hi Simon,
2014-12-09 22:21 GMT+09:00 Simon Glass sjg@chromium.org:
diff --git a/arch/arm/cpu/armv7/tegra-common/Kconfig b/arch/arm/cpu/armv7/tegra-common/Kconfig index 898e86d..9c98d19 100644 --- a/arch/arm/cpu/armv7/tegra-common/Kconfig +++ b/arch/arm/cpu/armv7/tegra-common/Kconfig @@ -17,6 +17,9 @@ config TEGRA124
endchoice
+config SYS_MALLOC_F_LEN
default 0x1800
I do not object against your way now, but it seems unfortunate because I think this kind of stuff should go to _defconfig.
The problem is that we have much more defconfig files than Linux without much differences but we do not have something like tegra-common_defconfig.
I have been thinking of this these days.
Perhaps, one possible solution I have come up with is to use scripts/kconfig/merge_config.sh For example,
- "make tegra30_defconfig" + tegra30_harmony.config -> Harmony board
- "make tegra30_defconfig" + tegra30_seaboard.config -> Seaboard
Yes something like this was the discussion I was wanting to have.
As you can see I found myself adding things to Kconfig to avoid needing to add loads of common stuff to multiple files. It otherwise rapidly becomes unmaintainable I think. I personally find the kernel Kconfigs a pain in that way - in Chrome OS we have a config merging script to try to make it less painful. Something like you proposed would solve this, but IMO it should be part of the build system, not hacked in by each vendor.
Regards, Simon

Hi Simon,
diff --git a/Kconfig b/Kconfig index 153ee2b..d4ca152 100644 --- a/Kconfig +++ b/Kconfig @@ -158,3 +158,5 @@ source "drivers/Kconfig" source "fs/Kconfig"
source "lib/Kconfig"
+source "test/dm/Kconfig"
Perhaps we might want "test/Kconfig" in the future.
--- a/arch/arm/cpu/armv7/tegra-common/Kconfig +++ b/arch/arm/cpu/armv7/tegra-common/Kconfig @@ -20,6 +20,27 @@ endchoice config USE_PRIVATE_LIBGCC default y if SPL_BUILD
+config DM
default y
+config SPL_DM
default y
+config DM_SERIAL
default y
+config DM_SPI
default y
+config DM_SPI_FLASH
default y
+config DM_I2C
default y
+config DM_GPIO
default y
Are all of these user-configurable?
I mean, do Tegra boards work fine without CONFIG_DM_* ? I doubt it because you have already converted Tegra drivers.
- Use "select" if the option is mandatory for that board
- Use "default y" if the option is still optional, but recommended.
source "arch/arm/cpu/armv7/tegra20/Kconfig" source "arch/arm/cpu/armv7/tegra30/Kconfig" source "arch/arm/cpu/armv7/tegra114/Kconfig" diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 3057325..1b4cbce 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -10,4 +10,43 @@ config SYS_BOARD config SYS_CONFIG_NAME default "sandbox"
+config DM
default y
+config DM_GPIO
default y
+config DM_SERIAL
default y
+config CMD_DEMO
default y
+config CMD_DM
default y
+config DM_DEMO
default y
+config DM_DEMO_SIMPLE
default y
+config DM_DEMO_SHAPE
default y
+config DM_TEST
default y
+config DM_CROS_EC
default y
+config DM_SPI
default y
+config DM_SPI_FLASH
default y
+config DM_I2C
default y
Why do you like this syntax?
- If the option is not user-configurable, use "select" - If the option is user-configurable and you want change the default value, add it to configs/sandbox_defconfig
diff --git a/board/samsung/goni/Kconfig b/board/samsung/goni/Kconfig index cbbf5a9..006e864 100644 --- a/board/samsung/goni/Kconfig +++ b/board/samsung/goni/Kconfig @@ -12,4 +12,13 @@ config SYS_SOC config SYS_CONFIG_NAME default "s5p_goni"
+config DM
default y
+config DM_GPIO
default y
+config DM_SERIAL
default y
"select" or "_defconfig"
diff --git a/common/Kconfig b/common/Kconfig index fd84fa0..174bf4f 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -153,6 +153,29 @@ endmenu
menu "Device access commands"
+config CMD_DM
bool "dm - Access to driver model information"
depends on DM
default y
help
Provides access to driver model data structures and information,
such as a list of devices, list of uclasses and the state of each
device (e.g. activated). This is not required for operation, but
can be useful to see the state of driver model for debugging or
interest.
+config CMD_DEMO
bool "demo - Demonstration commands for driver model"
depends on DM
help
Procides a 'demo' command which can be used to play around with
driver model. To use this properly you will need to enable one or
both of the demo devices (DM_DEMO_SHAPE and DM_DEMO_SIMPLE).
Otherwise you will always get an empty list of devices. The demo
devices are defined in the sandbox device tree, so the easiest
option is to use sandbox and pass the -d point to sandbox's
u-boot.dtb file.
These seems rather "Misc commands".
config CMD_LOADB bool "loadb" help diff --git a/configs/Linksprite_pcDuino3_fdt_defconfig b/configs/Linksprite_pcDuino3_fdt_defconfig index a33f3a7..931b5dd 100644 --- a/configs/Linksprite_pcDuino3_fdt_defconfig +++ b/configs/Linksprite_pcDuino3_fdt_defconfig @@ -2,6 +2,8 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI" CONFIG_FDTFILE="sun7i-a20-pcduino3.dtb" CONFIG_DM=y +CONFIG_DM_GPIO=y +CONFIG_DM_SERIAL=y CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3" CONFIG_OF_CONTROL=y CONFIG_OF_SEPARATE=y
Here, you use _defconfig.
What is the difference?
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index d2799dc..2ae2cc4 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -2,5 +2,123 @@ config DM bool "Enable Driver Model" depends on !SPL_BUILD help
This config option enables Driver Model.
To use legacy drivers, say N.
This config option enables Driver Model. This brings in the core
support, including scanning of platform data on start-up. If
CONFIG_OF_CONTROL is enabled, the device tree will be scanned also
when available.
+config DM_SERIAL
bool "Enable Driver Model for serial"
depends on DM
help
Enable driver model for serial. This replaces
drivers/serial/serial.c with the serial uclass, which
implements serial_putc() etc. The uclass interface is
defined in include/serial.h.
+config DM_GPIO
bool "Enable Driver Model for GPIO"
depends on DM
help
Enable driver model for GPIO access. The standard GPIO
interface (gpio_get_value(), etc.) is then implemented by
the GPIO uclass. Drivers provide methods to query the
particular GPIOs that they provide. The uclass interface
is defined in include/asm-generic/gpio.h.
+config DM_SPI
bool "Enable Driver Model for SPI"
depends on DM
help
Enable driver model for SPI. The SPI slave interface
(spi_setup_slave(), spi_xfer(), etc.) is then implemented by
the SPI uclass. Drivers provide methods to access the SPI
buses that they control. The uclass interface is defined in
include/spi.h. The existing spi_slave structure is attached
as 'parent data' to every slave on each bus. Slaves
typically use driver-private data instead of extending the
spi_slave structure.
DM_{SERIAL,GPIO,SPI} is already in drivers/{serial,gpio,spi}/Kconfig.
IMHO, I think drivers/*/Kconfig would be a suitable place, but it is OK if you want to move them.
Anyway, these configs are temporary. When we finish DM conversion, CONFIG_DM* will go away.
new file mode 100644 index 0000000..4234fe4 --- /dev/null +++ b/drivers/demo/Kconfig @@ -0,0 +1,26 @@ +config DM_DEMO
bool "Enable demo uclass support"
depends on DM
help
This uclass allows you to play around with driver model. It provides
an interface to a couple of demo devices. You can access it using
the 'demo' command or by calling the uclass functions from your
own code.
+config DM_DEMO_SIMPLE
bool "Enable simple demo device for driver model"
depends on DM
depends on DM_DEMO
help
This device allows you to play around with driver model. It prints
a message when the 'demo hello' command is executed which targets
this device. It can be used to help understand how driver model
works.
+config DM_DEMO_SHAPE
bool "Enable shape demo device for driver model"
depends on DM
Ditto.
+++ b/test/dm/Kconfig @@ -0,0 +1,8 @@ +config DM_TEST
bool "Enable driver model test command"
depends on SANDBOX
also depends on CMD_DM ??

Hi Masahiro,
On 11 December 2014 at 10:37, Masahiro YAMADA yamada.m@jp.panasonic.com wrote:
Hi Simon,
diff --git a/Kconfig b/Kconfig index 153ee2b..d4ca152 100644 --- a/Kconfig +++ b/Kconfig @@ -158,3 +158,5 @@ source "drivers/Kconfig" source "fs/Kconfig"
source "lib/Kconfig"
+source "test/dm/Kconfig"
Perhaps we might want "test/Kconfig" in the future.
--- a/arch/arm/cpu/armv7/tegra-common/Kconfig +++ b/arch/arm/cpu/armv7/tegra-common/Kconfig @@ -20,6 +20,27 @@ endchoice config USE_PRIVATE_LIBGCC default y if SPL_BUILD
+config DM
default y
+config SPL_DM
default y
+config DM_SERIAL
default y
+config DM_SPI
default y
+config DM_SPI_FLASH
default y
+config DM_I2C
default y
+config DM_GPIO
default y
Are all of these user-configurable?
I mean, do Tegra boards work fine without CONFIG_DM_* ? I doubt it because you have already converted Tegra drivers.
Use "select" if the option is mandatory for that board
Use "default y" if the option is still optional, but recommended.
OK will change this for tegra.
source "arch/arm/cpu/armv7/tegra20/Kconfig" source "arch/arm/cpu/armv7/tegra30/Kconfig" source "arch/arm/cpu/armv7/tegra114/Kconfig" diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 3057325..1b4cbce 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -10,4 +10,43 @@ config SYS_BOARD config SYS_CONFIG_NAME default "sandbox"
+config DM
default y
+config DM_GPIO
default y
+config DM_SERIAL
default y
+config CMD_DEMO
default y
+config CMD_DM
default y
+config DM_DEMO
default y
+config DM_DEMO_SIMPLE
default y
+config DM_DEMO_SHAPE
default y
+config DM_TEST
default y
+config DM_CROS_EC
default y
+config DM_SPI
default y
+config DM_SPI_FLASH
default y
+config DM_I2C
default y
Why do you like this syntax?
- If the option is not user-configurable, use "select"
- If the option is user-configurable and you want change the default value, add it to configs/sandbox_defconfig
OK I'll split these into two types.
diff --git a/board/samsung/goni/Kconfig b/board/samsung/goni/Kconfig index cbbf5a9..006e864 100644 --- a/board/samsung/goni/Kconfig +++ b/board/samsung/goni/Kconfig @@ -12,4 +12,13 @@ config SYS_SOC config SYS_CONFIG_NAME default "s5p_goni"
+config DM
default y
+config DM_GPIO
default y
+config DM_SERIAL
default y
"select" or "_defconfig"
Will go with select here.
diff --git a/common/Kconfig b/common/Kconfig index fd84fa0..174bf4f 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -153,6 +153,29 @@ endmenu
menu "Device access commands"
+config CMD_DM
bool "dm - Access to driver model information"
depends on DM
default y
help
Provides access to driver model data structures and information,
such as a list of devices, list of uclasses and the state of each
device (e.g. activated). This is not required for operation, but
can be useful to see the state of driver model for debugging or
interest.
+config CMD_DEMO
bool "demo - Demonstration commands for driver model"
depends on DM
help
Procides a 'demo' command which can be used to play around with
driver model. To use this properly you will need to enable one or
both of the demo devices (DM_DEMO_SHAPE and DM_DEMO_SIMPLE).
Otherwise you will always get an empty list of devices. The demo
devices are defined in the sandbox device tree, so the easiest
option is to use sandbox and pass the -d point to sandbox's
u-boot.dtb file.
These seems rather "Misc commands".
They are driver-model-related though.
config CMD_LOADB bool "loadb" help diff --git a/configs/Linksprite_pcDuino3_fdt_defconfig b/configs/Linksprite_pcDuino3_fdt_defconfig index a33f3a7..931b5dd 100644 --- a/configs/Linksprite_pcDuino3_fdt_defconfig +++ b/configs/Linksprite_pcDuino3_fdt_defconfig @@ -2,6 +2,8 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI" CONFIG_FDTFILE="sun7i-a20-pcduino3.dtb" CONFIG_DM=y +CONFIG_DM_GPIO=y +CONFIG_DM_SERIAL=y CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3" CONFIG_OF_CONTROL=y CONFIG_OF_SEPARATE=y
Here, you use _defconfig.
What is the difference?
This board shares config with others so I can't change the defaults. In fact this board still uses CONFIG_SYS_EXTRA_OPTIONS which is unfortunate a) because it should use device tree for GPIOs and b) because we are trying to deprecate these.
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index d2799dc..2ae2cc4 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -2,5 +2,123 @@ config DM bool "Enable Driver Model" depends on !SPL_BUILD help
This config option enables Driver Model.
To use legacy drivers, say N.
This config option enables Driver Model. This brings in the core
support, including scanning of platform data on start-up. If
CONFIG_OF_CONTROL is enabled, the device tree will be scanned also
when available.
+config DM_SERIAL
bool "Enable Driver Model for serial"
depends on DM
help
Enable driver model for serial. This replaces
drivers/serial/serial.c with the serial uclass, which
implements serial_putc() etc. The uclass interface is
defined in include/serial.h.
+config DM_GPIO
bool "Enable Driver Model for GPIO"
depends on DM
help
Enable driver model for GPIO access. The standard GPIO
interface (gpio_get_value(), etc.) is then implemented by
the GPIO uclass. Drivers provide methods to query the
particular GPIOs that they provide. The uclass interface
is defined in include/asm-generic/gpio.h.
+config DM_SPI
bool "Enable Driver Model for SPI"
depends on DM
help
Enable driver model for SPI. The SPI slave interface
(spi_setup_slave(), spi_xfer(), etc.) is then implemented by
the SPI uclass. Drivers provide methods to access the SPI
buses that they control. The uclass interface is defined in
include/spi.h. The existing spi_slave structure is attached
as 'parent data' to every slave on each bus. Slaves
typically use driver-private data instead of extending the
spi_slave structure.
DM_{SERIAL,GPIO,SPI} is already in drivers/{serial,gpio,spi}/Kconfig.
IMHO, I think drivers/*/Kconfig would be a suitable place, but it is OK if you want to move them.
Yes I agree, let's leave them there. Maybe I didn't notice that you had already done this work.
Anyway, these configs are temporary. When we finish DM conversion, CONFIG_DM* will go away.
Yes, looking forward to it. I'm planning to start deprecation for serial and GPIO soon.
new file mode 100644 index 0000000..4234fe4 --- /dev/null +++ b/drivers/demo/Kconfig @@ -0,0 +1,26 @@ +config DM_DEMO
bool "Enable demo uclass support"
depends on DM
help
This uclass allows you to play around with driver model. It provides
an interface to a couple of demo devices. You can access it using
the 'demo' command or by calling the uclass functions from your
own code.
+config DM_DEMO_SIMPLE
bool "Enable simple demo device for driver model"
depends on DM
depends on DM_DEMO
help
This device allows you to play around with driver model. It prints
a message when the 'demo hello' command is executed which targets
this device. It can be used to help understand how driver model
works.
+config DM_DEMO_SHAPE
bool "Enable shape demo device for driver model"
depends on DM
Ditto.
OK
+++ b/test/dm/Kconfig @@ -0,0 +1,8 @@ +config DM_TEST
bool "Enable driver model test command"
depends on SANDBOX
also depends on CMD_DM ??
Yes, that seem right.
Regards, Simon

On Tue, Dec 9, 2014 at 7:21 AM, Simon Glass sjg@chromium.org wrote:
Kconfig has been available for a while but there are still driver model CONFIG options. Move all of these to Kconfig.
This patch isn't final - I need to wait until the SPL series can be fully applied, which is in turn waiting on some ARM SPL problems. So for now it is just a placeholder. But it needs to be sent out otherwise we will never move over.
Signed-off-by: Simon Glass sjg@chromium.org
diff --git a/common/Kconfig b/common/Kconfig index fd84fa0..174bf4f 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -153,6 +153,29 @@ endmenu
menu "Device access commands"
+config CMD_DM
bool "dm - Access to driver model information"
depends on DM
default y
help
Provides access to driver model data structures and information,
such as a list of devices, list of uclasses and the state of
each
device (e.g. activated). This is not required for operation, but
can be useful to see the state of driver model for debugging or
interest.
+config CMD_DEMO
bool "demo - Demonstration commands for driver model"
depends on DM
help
Procides a 'demo' command which can be used to play around with
Provides
driver model. To use this properly you will need to enable one
or
both of the demo devices (DM_DEMO_SHAPE and DM_DEMO_SIMPLE).
Otherwise you will always get an empty list of devices. The demo
devices are defined in the sandbox device tree, so the easiest
option is to use sandbox and pass the -d point to sandbox's
u-boot.dtb file.
config CMD_LOADB bool "loadb" help
participants (3)
-
Joe Hershberger
-
Masahiro YAMADA
-
Simon Glass