Skip to contentSkip to conversation

Convert CONFIG_SYS_DV_CLKMODE et al to Kconfig

PATCH New Adam Ford 2 participants 5 messages Jan 11, 2018

Subsystems (3)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 Convert CONFIG_SYS_DV_CLKMODE et al to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_DV_CLKMODE
CONFIG_SYS_DA850_PLL0_POSTDIV
CONFIG_SYS_DA850_PLL0_PLLDIV1
CONFIG_SYS_DA850_PLL0_PLLDIV2
CONFIG_SYS_DA850_PLL0_PLLDIV3
CONFIG_SYS_DA850_PLL0_PLLDIV4
CONFIG_SYS_DA850_PLL0_PLLDIV5
CONFIG_SYS_DA850_PLL0_PLLDIV7
CONFIG_SYS_DA850_PLL1_POSTDIV
CONFIG_SYS_DA850_PLL1_PLLDIV1
CONFIG_SYS_DA850_PLL1_PLLDIV2
CONFIG_SYS_DA850_PLL1_PLLDIV3

---

This patch is a continuation of Convert CONFIG_SOC_DA8XX et al This also showed warnings when used with the legoev3_defconfig, however it seems like the ev3 board was defining things in the header it didn't need since it doesn't seem to be building da850_lowlevel.c. I don't have the hardware to test that board.

 arch/arm/mach-davinci/Kconfig   | 59 ++++++++++++++++++++++++++++++++++++++++-
 configs/omapl138_lcdk_defconfig |  1 +
 include/configs/calimain.h      | 13 ---------
 include/configs/da850evm.h      | 13 ---------
 include/configs/ipam390.h       | 13 ---------
 include/configs/legoev3.h       | 13 ---------
 include/configs/omapl138_lcdk.h | 13 ---------
 scripts/config_whitelist.txt    | 12 ---------
 8 files changed, 59 insertions(+), 78 deletions(-)
arch/arm/mach-davinci/Kconfig +58 -1
index ae9c0fd..c9c517e 100644
@@ -24,7 +24,7 @@ config TARGET_EA20
 
 config TARGET_OMAPL138_LCDK
 	bool "OMAPL138 LCDK"
-	select SOC_DA8XX
+	select SOC_DA850
 	select SUPPORT_SPL
 
 config TARGET_CALIMAIN
@@ -63,6 +63,63 @@ config SOC_DA8XX
 config MACH_DAVINCI_DA850_EVM
 	bool
 
+if SYS_DA850_PLL_INIT
+comment "DA850 PLL Initialization Parameters"
+
+config SYS_DV_CLKMODE
+	int "SYS_DV_CLKMODE"
+	default 0 if SOC_DA850
+
+config SYS_DA850_PLL0_POSTDIV
+	int "SYS_DA850_PLL0_POSTDIV"
+	default 1 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV1
+	hex "SYS_DA850_PLL0_PLLDIV1"
+	default 0x8000 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV2
+	hex "SYS_DA850_PLL0_PLLDIV2"
+	default 0x8001 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV3
+	hex "SYS_DA850_PLL0_PLLDIV3"
+	default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV4
+	hex "SYS_DA850_PLL0_PLLDIV4"
+	default 0x8003 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV5
+	hex "SYS_DA850_PLL0_PLLDIV5"
+	default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV7
+	hex "SYS_DA850_PLL0_PLLDIV7"
+	default 0x8005 if SOC_DA850
+
+config SYS_DA850_PLL1_POSTDIV
+	hex "SYS_DA850_PLL1_POSTDIV"
+	default 1 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLDIV1
+	hex "SYS_DA850_PLL1_PLLDIV1"
+	default 0x8000 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLDIV2
+	hex "SYS_DA850_PLL1_PLLDIV2"
+	default 0x8001 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLDIV3
+	hex "SYS_DA850_PLL1_PLLDIV3"
+	default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLM
+	int
+	default 21 if SOC_DA850
+
+endif
+
 source "board/Barix/ipam390/Kconfig"
 source "board/davinci/da8xxevm/Kconfig"
 source "board/davinci/ea20/Kconfig"
configs/omapl138_lcdk_defconfig +1 -0
index 8d6b12f..2498126 100644
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_DAVINCI=y
 CONFIG_TARGET_OMAPL138_LCDK=y
+CONFIG_SYS_DA850_PLL1_PLLDIV3=0x8003
 CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
include/configs/calimain.h +0 -13
index 7dfc1fa..8605487 100644
@@ -39,20 +39,7 @@
 /*
  * PLL configuration
  */
-#define CONFIG_SYS_DV_CLKMODE          0
-#define CONFIG_SYS_DA850_PLL0_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL0_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL0_PLLDIV3  0x8002
-#define CONFIG_SYS_DA850_PLL0_PLLDIV4  0x8003
-#define CONFIG_SYS_DA850_PLL0_PLLDIV5  0x8002
 #define CONFIG_SYS_DA850_PLL0_PLLDIV6  CONFIG_SYS_DA850_PLL0_PLLDIV1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV7  0x8005
-
-#define CONFIG_SYS_DA850_PLL1_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL1_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL1_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL1_PLLDIV3  0x8002
 
 #define CONFIG_SYS_DA850_PLL0_PLLM \
 	((calimain_get_osc_freq() == 25000000) ? 23 : 24)
include/configs/da850evm.h +0 -13
index 5159a6f..a356871 100644
@@ -74,20 +74,7 @@
 /*
  * PLL configuration
  */
-#define CONFIG_SYS_DV_CLKMODE          0
-#define CONFIG_SYS_DA850_PLL0_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL0_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL0_PLLDIV3  0x8002
-#define CONFIG_SYS_DA850_PLL0_PLLDIV4  0x8003
-#define CONFIG_SYS_DA850_PLL0_PLLDIV5  0x8002
 #define CONFIG_SYS_DA850_PLL0_PLLDIV6  CONFIG_SYS_DA850_PLL0_PLLDIV1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV7  0x8005
-
-#define CONFIG_SYS_DA850_PLL1_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL1_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL1_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL1_PLLDIV3  0x8002
 
 #define CONFIG_SYS_DA850_PLL0_PLLM     24
 #define CONFIG_SYS_DA850_PLL1_PLLM     21
include/configs/ipam390.h +0 -13
index 618bf72..e66c008 100644
@@ -56,20 +56,7 @@
 /*
  * PLL configuration
  */
-#define CONFIG_SYS_DV_CLKMODE          0
-#define CONFIG_SYS_DA850_PLL0_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL0_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL0_PLLDIV3  0x8002
-#define CONFIG_SYS_DA850_PLL0_PLLDIV4  0x8003
-#define CONFIG_SYS_DA850_PLL0_PLLDIV5  0x8002
 #define CONFIG_SYS_DA850_PLL0_PLLDIV6  CONFIG_SYS_DA850_PLL0_PLLDIV1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV7  0x8005
-
-#define CONFIG_SYS_DA850_PLL1_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL1_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL1_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL1_PLLDIV3  0x8002
 
 #define CONFIG_SYS_DA850_PLL0_PLLM     24
 #define CONFIG_SYS_DA850_PLL1_PLLM     24
include/configs/legoev3.h +0 -13
index 105429b..26376a8 100644
@@ -52,20 +52,7 @@
 /*
  * PLL configuration
  */
-#define CONFIG_SYS_DV_CLKMODE          0
-#define CONFIG_SYS_DA850_PLL0_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL0_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL0_PLLDIV3  0x8002
-#define CONFIG_SYS_DA850_PLL0_PLLDIV4  0x8003
-#define CONFIG_SYS_DA850_PLL0_PLLDIV5  0x8002
 #define CONFIG_SYS_DA850_PLL0_PLLDIV6  CONFIG_SYS_DA850_PLL0_PLLDIV1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV7  0x8005
-
-#define CONFIG_SYS_DA850_PLL1_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL1_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL1_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL1_PLLDIV3  0x8002
 
 #define CONFIG_SYS_DA850_PLL0_PLLM     24
 #define CONFIG_SYS_DA850_PLL1_PLLM     21
include/configs/omapl138_lcdk.h +0 -13
index 570322e..1ad176e 100644
@@ -58,20 +58,7 @@
 /*
  * PLL configuration
  */
-#define CONFIG_SYS_DV_CLKMODE          0
-#define CONFIG_SYS_DA850_PLL0_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL0_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL0_PLLDIV3  0x8002
-#define CONFIG_SYS_DA850_PLL0_PLLDIV4  0x8003
-#define CONFIG_SYS_DA850_PLL0_PLLDIV5  0x8002
 #define CONFIG_SYS_DA850_PLL0_PLLDIV6  CONFIG_SYS_DA850_PLL0_PLLDIV1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV7  0x8005
-
-#define CONFIG_SYS_DA850_PLL1_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL1_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL1_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL1_PLLDIV3  0x8003
 
 #define CONFIG_SYS_DA850_PLL0_PLLM     37
 #define CONFIG_SYS_DA850_PLL1_PLLM     21
scripts/config_whitelist.txt +0 -12
index 7e99a7a..c9955a3 100644
@@ -2478,21 +2478,10 @@ CONFIG_SYS_DA850_DDR2_SDBCR2
 CONFIG_SYS_DA850_DDR2_SDRCR
 CONFIG_SYS_DA850_DDR2_SDTIMR
 CONFIG_SYS_DA850_DDR2_SDTIMR2
-CONFIG_SYS_DA850_PLL0_PLLDIV1
-CONFIG_SYS_DA850_PLL0_PLLDIV2
-CONFIG_SYS_DA850_PLL0_PLLDIV3
-CONFIG_SYS_DA850_PLL0_PLLDIV4
-CONFIG_SYS_DA850_PLL0_PLLDIV5
 CONFIG_SYS_DA850_PLL0_PLLDIV6
-CONFIG_SYS_DA850_PLL0_PLLDIV7
 CONFIG_SYS_DA850_PLL0_PLLM
-CONFIG_SYS_DA850_PLL0_POSTDIV
 CONFIG_SYS_DA850_PLL0_PREDIV
-CONFIG_SYS_DA850_PLL1_PLLDIV1
-CONFIG_SYS_DA850_PLL1_PLLDIV2
-CONFIG_SYS_DA850_PLL1_PLLDIV3
 CONFIG_SYS_DA850_PLL1_PLLM
-CONFIG_SYS_DA850_PLL1_POSTDIV
 CONFIG_SYS_DA850_SYSCFG_SUSPSRC
 CONFIG_SYS_DAVINCI_EMAC_PHY_COUNT
 CONFIG_SYS_DAVINCI_I2C_SLAVE
@@ -2735,7 +2724,6 @@ CONFIG_SYS_DSPI_CTAR4
 CONFIG_SYS_DSPI_CTAR5
 CONFIG_SYS_DSPI_CTAR6
 CONFIG_SYS_DSPI_CTAR7
-CONFIG_SYS_DV_CLKMODE
 CONFIG_SYS_DV_NOR_BOOT_CFG
 CONFIG_SYS_EBI_CFGR_VAL
 CONFIG_SYS_EBI_CSA_VAL
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 Convert CONFIG_SYS_DV_CLKMODE et al to Kconfig

Quoted 14 lines · Adam Ford

This converts the following to Kconfig:

    CONFIG_SYS_DV_CLKMODE
    CONFIG_SYS_DA850_PLL0_POSTDIV
    CONFIG_SYS_DA850_PLL0_PLLDIV1
    CONFIG_SYS_DA850_PLL0_PLLDIV2
    CONFIG_SYS_DA850_PLL0_PLLDIV3
    CONFIG_SYS_DA850_PLL0_PLLDIV4
    CONFIG_SYS_DA850_PLL0_PLLDIV5
    CONFIG_SYS_DA850_PLL0_PLLDIV7
    CONFIG_SYS_DA850_PLL1_POSTDIV
    CONFIG_SYS_DA850_PLL1_PLLDIV1
    CONFIG_SYS_DA850_PLL1_PLLDIV2
    CONFIG_SYS_DA850_PLL1_PLLDIV3
Quoted 8 lines

---

This patch is a continuation of Convert CONFIG_SOC_DA8XX et al This also showed warnings when used with the legoev3_defconfig, however it seems like the ev3 board was defining things in the header it didn't need since it doesn't seem to be building da850_lowlevel.c. I don't have the hardware to test that board.

I have a whole series of patches cleaning up the LEGO EV3 board and adding device tree support, but I have been holding off sending because it conflicts with the changes you have been making. There is quite a bit of stuff there that was cargo-culted and is going away, including the stuff that is causing warnings here.

Quoted 25 lines
  arch/arm/mach-davinci/Kconfig   | 59 ++++++++++++++++++++++++++++++++++++++++-
  configs/omapl138_lcdk_defconfig |  1 +
  include/configs/calimain.h      | 13 ---------
  include/configs/da850evm.h      | 13 ---------
  include/configs/ipam390.h       | 13 ---------
  include/configs/legoev3.h       | 13 ---------
  include/configs/omapl138_lcdk.h | 13 ---------
  scripts/config_whitelist.txt    | 12 ---------
  8 files changed, 59 insertions(+), 78 deletions(-)
arch/arm/mach-davinci/Kconfig +1 -1
index ae9c0fd..c9c517e 100644
@@ -24,7 +24,7 @@ config TARGET_EA20
 
  config TARGET_OMAPL138_LCDK
  	bool "OMAPL138 LCDK"
-	select SOC_DA8XX
+	select SOC_DA850
  	select SUPPORT_SPL
 
  config TARGET_CALIMAIN

arch/arm/mach-davinci/Kconfig config SOC_DA8XX · line 70

Quoted 8 lines
arch/arm/mach-davinci/Kconfig +5 -0
@@ -63,6 +63,63 @@ config SOC_DA8XX
  config MACH_DAVINCI_DA850_EVM
  	bool
 
+if SYS_DA850_PLL_INIT
+comment "DA850 PLL Initialization Parameters"
+
+config SYS_DV_CLKMODE
+	int "SYS_DV_CLKMODE"

Is DV short for DaVinci? If so, please spell it out. If not, please add a "DA850" prefix like the other parameters and add a description to explain what this option does.

arch/arm/mach-davinci/Kconfig config SOC_DA8XX · line 75

Quoted 5 lines
arch/arm/mach-davinci/Kconfig +5 -0
+	default 0 if SOC_DA850
+
+config SYS_DA850_PLL0_POSTDIV
+	int "SYS_DA850_PLL0_POSTDIV"
+	default 1 if SOC_DA850

All of these POSTDIV parameters don't really seem to me like something that should be in Kconfig. I think it would be much cleaner to just define a static array with these values and pass it to the da850_pll_init() function.

Quoted 37 lines
arch/arm/mach-davinci/Kconfig +37 -0
+
+config SYS_DA850_PLL0_PLLDIV1
+	hex "SYS_DA850_PLL0_PLLDIV1"
+	default 0x8000 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV2
+	hex "SYS_DA850_PLL0_PLLDIV2"
+	default 0x8001 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV3
+	hex "SYS_DA850_PLL0_PLLDIV3"
+	default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV4
+	hex "SYS_DA850_PLL0_PLLDIV4"
+	default 0x8003 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV5
+	hex "SYS_DA850_PLL0_PLLDIV5"
+	default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV7
+	hex "SYS_DA850_PLL0_PLLDIV7"
+	default 0x8005 if SOC_DA850
+
+config SYS_DA850_PLL1_POSTDIV
+	hex "SYS_DA850_PLL1_POSTDIV"
+	default 1 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLDIV1
+	hex "SYS_DA850_PLL1_PLLDIV1"
+	default 0x8000 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLDIV2
+	hex "SYS_DA850_PLL1_PLLDIV2"
+	default 0x8001 if SOC_DA850
+

arch/arm/mach-davinci/Kconfig config SOC_DA8XX · line 122

Quoted 10 lines
arch/arm/mach-davinci/Kconfig +10 -0
+config SYS_DA850_PLL1_PLLDIV3
+	hex "SYS_DA850_PLL1_PLLDIV3"
+	default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLM
+	int
+	default 21 if SOC_DA850
+
+endif
+

If all of these really need to be Kconfig options, they need explanations of what the values mean, for example, 0x8002 means that you are setting the enable bit at bit 15 and you are setting the divider value to divide by 3 because the register value is one less than the actual value.

Quoted 168 lines
arch/arm/mach-davinci/Kconfig +0 -0
  source "board/Barix/ipam390/Kconfig"
  source "board/davinci/da8xxevm/Kconfig"
  source "board/davinci/ea20/Kconfig"
configs/omapl138_lcdk_defconfig +1 -0
index 8d6b12f..2498126 100644
@@ -1,6 +1,7 @@
  CONFIG_ARM=y
  CONFIG_ARCH_DAVINCI=y
  CONFIG_TARGET_OMAPL138_LCDK=y
+CONFIG_SYS_DA850_PLL1_PLLDIV3=0x8003
  CONFIG_TI_COMMON_CMD_OPTIONS=y
  CONFIG_SPL_LIBCOMMON_SUPPORT=y
  CONFIG_SPL_LIBGENERIC_SUPPORT=y
include/configs/calimain.h +0 -13
index 7dfc1fa..8605487 100644
@@ -39,20 +39,7 @@
  /*
   * PLL configuration
   */
-#define CONFIG_SYS_DV_CLKMODE          0
-#define CONFIG_SYS_DA850_PLL0_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL0_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL0_PLLDIV3  0x8002
-#define CONFIG_SYS_DA850_PLL0_PLLDIV4  0x8003
-#define CONFIG_SYS_DA850_PLL0_PLLDIV5  0x8002
  #define CONFIG_SYS_DA850_PLL0_PLLDIV6  CONFIG_SYS_DA850_PLL0_PLLDIV1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV7  0x8005
-
-#define CONFIG_SYS_DA850_PLL1_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL1_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL1_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL1_PLLDIV3  0x8002
 
  #define CONFIG_SYS_DA850_PLL0_PLLM \
  	((calimain_get_osc_freq() == 25000000) ? 23 : 24)
include/configs/da850evm.h +0 -13
index 5159a6f..a356871 100644
@@ -74,20 +74,7 @@
  /*
   * PLL configuration
   */
-#define CONFIG_SYS_DV_CLKMODE          0
-#define CONFIG_SYS_DA850_PLL0_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL0_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL0_PLLDIV3  0x8002
-#define CONFIG_SYS_DA850_PLL0_PLLDIV4  0x8003
-#define CONFIG_SYS_DA850_PLL0_PLLDIV5  0x8002
  #define CONFIG_SYS_DA850_PLL0_PLLDIV6  CONFIG_SYS_DA850_PLL0_PLLDIV1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV7  0x8005
-
-#define CONFIG_SYS_DA850_PLL1_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL1_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL1_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL1_PLLDIV3  0x8002
 
  #define CONFIG_SYS_DA850_PLL0_PLLM     24
  #define CONFIG_SYS_DA850_PLL1_PLLM     21
include/configs/ipam390.h +0 -13
index 618bf72..e66c008 100644
@@ -56,20 +56,7 @@
  /*
   * PLL configuration
   */
-#define CONFIG_SYS_DV_CLKMODE          0
-#define CONFIG_SYS_DA850_PLL0_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL0_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL0_PLLDIV3  0x8002
-#define CONFIG_SYS_DA850_PLL0_PLLDIV4  0x8003
-#define CONFIG_SYS_DA850_PLL0_PLLDIV5  0x8002
  #define CONFIG_SYS_DA850_PLL0_PLLDIV6  CONFIG_SYS_DA850_PLL0_PLLDIV1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV7  0x8005
-
-#define CONFIG_SYS_DA850_PLL1_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL1_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL1_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL1_PLLDIV3  0x8002
 
  #define CONFIG_SYS_DA850_PLL0_PLLM     24
  #define CONFIG_SYS_DA850_PLL1_PLLM     24
include/configs/legoev3.h +0 -13
index 105429b..26376a8 100644
@@ -52,20 +52,7 @@
  /*
   * PLL configuration
   */
-#define CONFIG_SYS_DV_CLKMODE          0
-#define CONFIG_SYS_DA850_PLL0_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL0_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL0_PLLDIV3  0x8002
-#define CONFIG_SYS_DA850_PLL0_PLLDIV4  0x8003
-#define CONFIG_SYS_DA850_PLL0_PLLDIV5  0x8002
  #define CONFIG_SYS_DA850_PLL0_PLLDIV6  CONFIG_SYS_DA850_PLL0_PLLDIV1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV7  0x8005
-
-#define CONFIG_SYS_DA850_PLL1_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL1_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL1_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL1_PLLDIV3  0x8002
 
  #define CONFIG_SYS_DA850_PLL0_PLLM     24
  #define CONFIG_SYS_DA850_PLL1_PLLM     21
include/configs/omapl138_lcdk.h +0 -13
index 570322e..1ad176e 100644
@@ -58,20 +58,7 @@
  /*
   * PLL configuration
   */
-#define CONFIG_SYS_DV_CLKMODE          0
-#define CONFIG_SYS_DA850_PLL0_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL0_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL0_PLLDIV3  0x8002
-#define CONFIG_SYS_DA850_PLL0_PLLDIV4  0x8003
-#define CONFIG_SYS_DA850_PLL0_PLLDIV5  0x8002
  #define CONFIG_SYS_DA850_PLL0_PLLDIV6  CONFIG_SYS_DA850_PLL0_PLLDIV1
-#define CONFIG_SYS_DA850_PLL0_PLLDIV7  0x8005
-
-#define CONFIG_SYS_DA850_PLL1_POSTDIV  1
-#define CONFIG_SYS_DA850_PLL1_PLLDIV1  0x8000
-#define CONFIG_SYS_DA850_PLL1_PLLDIV2  0x8001
-#define CONFIG_SYS_DA850_PLL1_PLLDIV3  0x8003
 
  #define CONFIG_SYS_DA850_PLL0_PLLM     37
  #define CONFIG_SYS_DA850_PLL1_PLLM     21
scripts/config_whitelist.txt +0 -11
index 7e99a7a..c9955a3 100644
@@ -2478,21 +2478,10 @@ CONFIG_SYS_DA850_DDR2_SDBCR2
  CONFIG_SYS_DA850_DDR2_SDRCR
  CONFIG_SYS_DA850_DDR2_SDTIMR
  CONFIG_SYS_DA850_DDR2_SDTIMR2
-CONFIG_SYS_DA850_PLL0_PLLDIV1
-CONFIG_SYS_DA850_PLL0_PLLDIV2
-CONFIG_SYS_DA850_PLL0_PLLDIV3
-CONFIG_SYS_DA850_PLL0_PLLDIV4
-CONFIG_SYS_DA850_PLL0_PLLDIV5
  CONFIG_SYS_DA850_PLL0_PLLDIV6
-CONFIG_SYS_DA850_PLL0_PLLDIV7
  CONFIG_SYS_DA850_PLL0_PLLM
-CONFIG_SYS_DA850_PLL0_POSTDIV
  CONFIG_SYS_DA850_PLL0_PREDIV
-CONFIG_SYS_DA850_PLL1_PLLDIV1
-CONFIG_SYS_DA850_PLL1_PLLDIV2
-CONFIG_SYS_DA850_PLL1_PLLDIV3
  CONFIG_SYS_DA850_PLL1_PLLM
-CONFIG_SYS_DA850_PLL1_POSTDIV
  CONFIG_SYS_DA850_SYSCFG_SUSPSRC
  CONFIG_SYS_DAVINCI_EMAC_PHY_COUNT
  CONFIG_SYS_DAVINCI_I2C_SLAVE

scripts/config_whitelist.txt CONFIG_SYS_DSPI_CTAR4 · line 2729

Quoted 7 lines
scripts/config_whitelist.txt +0 -1
@@ -2735,7 +2724,6 @@ CONFIG_SYS_DSPI_CTAR4
  CONFIG_SYS_DSPI_CTAR5
  CONFIG_SYS_DSPI_CTAR6
  CONFIG_SYS_DSPI_CTAR7
-CONFIG_SYS_DV_CLKMODE
  CONFIG_SYS_DV_NOR_BOOT_CFG
  CONFIG_SYS_EBI_CFGR_VAL
  CONFIG_SYS_EBI_CSA_VAL

So, to sum up. Basically, this looks fine other than the lack of descriptions in the Kconfig. But, I don't think this stuff should have been implemented using config options in the first place. I would rather see da850_lowlevel.c get cleaned up to be more generic and pass stuff as function parameters rather than using config macros. But, since LEGO EV3 doesn't use any of this, it won't really make a difference to me either way.

author
#2 lore raw

PATCH 1/1 Convert CONFIG_SYS_DV_CLKMODE et al to Kconfig

Quoted 63 lines · David Lechner
Quoted 16 lines · Adam Ford

This converts the following to Kconfig:

    CONFIG_SYS_DV_CLKMODE
    CONFIG_SYS_DA850_PLL0_POSTDIV
    CONFIG_SYS_DA850_PLL0_PLLDIV1
    CONFIG_SYS_DA850_PLL0_PLLDIV2
    CONFIG_SYS_DA850_PLL0_PLLDIV3
    CONFIG_SYS_DA850_PLL0_PLLDIV4
    CONFIG_SYS_DA850_PLL0_PLLDIV5
    CONFIG_SYS_DA850_PLL0_PLLDIV7
    CONFIG_SYS_DA850_PLL1_POSTDIV
    CONFIG_SYS_DA850_PLL1_PLLDIV1
    CONFIG_SYS_DA850_PLL1_PLLDIV2
    CONFIG_SYS_DA850_PLL1_PLLDIV3
Quoted 8 lines

---

This patch is a continuation of Convert CONFIG_SOC_DA8XX et al This also showed warnings when used with the legoev3_defconfig, however it seems like the ev3 board was defining things in the header it didn't need
since it doesn't seem to be building da850_lowlevel.c. I don't have the hardware to test that board.

I have a whole series of patches cleaning up the LEGO EV3 board and adding device tree support, but I have been holding off sending because it conflicts
with the changes you have been making. There is quite a bit of stuff there that was cargo-culted and is going away, including the stuff that is causing warnings here.

Quoted 28 lines
  arch/arm/mach-davinci/Kconfig   | 59
++++++++++++++++++++++++++++++++++++++++-
  configs/omapl138_lcdk_defconfig |  1 +
  include/configs/calimain.h      | 13 ---------
  include/configs/da850evm.h      | 13 ---------
  include/configs/ipam390.h       | 13 ---------
  include/configs/legoev3.h       | 13 ---------
  include/configs/omapl138_lcdk.h | 13 ---------
  scripts/config_whitelist.txt    | 12 ---------
  8 files changed, 59 insertions(+), 78 deletions(-)
arch/arm/mach-davinci/Kconfig +2 -1
index ae9c0fd..c9c517e 100644
@@ -24,7 +24,7 @@ config TARGET_EA20
    config TARGET_OMAPL138_LCDK
        bool "OMAPL138 LCDK"
-       select SOC_DA8XX
+       select SOC_DA850
        select SUPPORT_SPL
    config TARGET_CALIMAIN
@@ -63,6 +63,63 @@ config SOC_DA8XX
  config MACH_DAVINCI_DA850_EVM
        bool
  +if SYS_DA850_PLL_INIT
+comment "DA850 PLL Initialization Parameters"
Quoted 8 lines

arch/arm/mach-davinci/Kconfig config SOC_DA8XX · line 70

Quoted 3 lines
arch/arm/mach-davinci/Kconfig +3 -0
+
+config SYS_DV_CLKMODE
+       int "SYS_DV_CLKMODE"

Is DV short for DaVinci? If so, please spell it out. If not, please add a "DA850" prefix like the other parameters and add a description to explain what this option does.

I don't know where the name originate. I am simply making the Kconfig match the names that were given before, so the tool that migrates from include/configs/* can operate. If we change the names, this tool doesn't work cleanly.

Quoted 12 lines

arch/arm/mach-davinci/Kconfig config SOC_DA8XX · line 75

Quoted 6 lines
arch/arm/mach-davinci/Kconfig +5 -0
+       default 0 if SOC_DA850
+
+config SYS_DA850_PLL0_POSTDIV
+       int "SYS_DA850_PLL0_POSTDIV"
+       default 1 if SOC_DA850

All of these POSTDIV parameters don't really seem to me like something that should be in Kconfig. I think it would be much cleaner to just define a static array with these values and pass it to the da850_pll_init() function.

I don't disagree at all with you. My main goal was to shrink the include/config/*.h file options and move them into Kconfig. It's not part of the scope of what I'm trying to do to make an assessment of the quality of the code or question. The vast majority of these options are the same for every board, but someone where thought it was important to make them a configuration option, so I left it configurable. There is one board that uses a slightly different value than the rest of the boards, so I don't think that putting all these 'configs' into the source file would be the best.

Quoted 47 lines
Quoted 47 lines
arch/arm/mach-davinci/Kconfig +45 -0
+
+config SYS_DA850_PLL0_PLLDIV1
+       hex "SYS_DA850_PLL0_PLLDIV1"
+       default 0x8000 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV2
+       hex "SYS_DA850_PLL0_PLLDIV2"
+       default 0x8001 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV3
+       hex "SYS_DA850_PLL0_PLLDIV3"
+       default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV4
+       hex "SYS_DA850_PLL0_PLLDIV4"
+       default 0x8003 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV5
+       hex "SYS_DA850_PLL0_PLLDIV5"
+       default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV7
+       hex "SYS_DA850_PLL0_PLLDIV7"
+       default 0x8005 if SOC_DA850
+
+config SYS_DA850_PLL1_POSTDIV
+       hex "SYS_DA850_PLL1_POSTDIV"
+       default 1 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLDIV1
+       hex "SYS_DA850_PLL1_PLLDIV1"
+       default 0x8000 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLDIV2
+       hex "SYS_DA850_PLL1_PLLDIV2"
+       default 0x8001 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLDIV3
+       hex "SYS_DA850_PLL1_PLLDIV3"
+       default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLM
+       int
+       default 21 if SOC_DA850
+
Quoted 8 lines

arch/arm/mach-davinci/Kconfig config SOC_DA8XX · line 122

Quoted 2 lines
arch/arm/mach-davinci/Kconfig +2 -0
+endif
+

If all of these really need to be Kconfig options, they need explanations of what the values mean, for example, 0x8002 means that you are setting the enable bit at bit 15 and you are setting the divider value to divide by 3 because the register value is one less than the actual value.

I honestly don't have any idea what these values mean or how they were derrived. I didn't bother looking. I'm just trying to help the U-Boot community migrate from include/configs/*.h to Kconfig.

Quoted 2 lines

[snip]

Quoted 3 lines

So, to sum up. Basically, this looks fine other than the lack of descriptions in the Kconfig. But, I don't think this stuff should

I tried find descriptions, but there weren't any README files that referenced these values, so I wasn't sure what to put.

Quoted 5 lines

have been implemented using config options in the first place. I would rather see da850_lowlevel.c get cleaned up to be more generic and pass stuff as function parameters rather than using config macros. But, since LEGO EV3 doesn't use any of this, it won't really make a difference to me either way.

I'd like to see lowlevel.c get cleaned up too, but in my mind that's a separate task from the config.h -> Kconfig migration.

adam

Quoted 1 line
#3 lore raw

PATCH 1/1 Convert CONFIG_SYS_DV_CLKMODE et al to Kconfig

Quoted 172 lines · Adam Ford
Quoted 63 lines · David Lechner
Quoted 16 lines · Adam Ford

This converts the following to Kconfig:

     CONFIG_SYS_DV_CLKMODE
     CONFIG_SYS_DA850_PLL0_POSTDIV
     CONFIG_SYS_DA850_PLL0_PLLDIV1
     CONFIG_SYS_DA850_PLL0_PLLDIV2
     CONFIG_SYS_DA850_PLL0_PLLDIV3
     CONFIG_SYS_DA850_PLL0_PLLDIV4
     CONFIG_SYS_DA850_PLL0_PLLDIV5
     CONFIG_SYS_DA850_PLL0_PLLDIV7
     CONFIG_SYS_DA850_PLL1_POSTDIV
     CONFIG_SYS_DA850_PLL1_PLLDIV1
     CONFIG_SYS_DA850_PLL1_PLLDIV2
     CONFIG_SYS_DA850_PLL1_PLLDIV3
Quoted 8 lines

---

This patch is a continuation of Convert CONFIG_SOC_DA8XX et al This also showed warnings when used with the legoev3_defconfig, however it seems like the ev3 board was defining things in the header it didn't need
since it doesn't seem to be building da850_lowlevel.c. I don't have the hardware to test that board.

I have a whole series of patches cleaning up the LEGO EV3 board and adding device tree support, but I have been holding off sending because it conflicts
with the changes you have been making. There is quite a bit of stuff there that was cargo-culted and is going away, including the stuff that is causing warnings here.

Quoted 28 lines
   arch/arm/mach-davinci/Kconfig   | 59
++++++++++++++++++++++++++++++++++++++++-
   configs/omapl138_lcdk_defconfig |  1 +
   include/configs/calimain.h      | 13 ---------
   include/configs/da850evm.h      | 13 ---------
   include/configs/ipam390.h       | 13 ---------
   include/configs/legoev3.h       | 13 ---------
   include/configs/omapl138_lcdk.h | 13 ---------
   scripts/config_whitelist.txt    | 12 ---------
   8 files changed, 59 insertions(+), 78 deletions(-)
arch/arm/mach-davinci/Kconfig +2 -1
index ae9c0fd..c9c517e 100644
@@ -24,7 +24,7 @@ config TARGET_EA20
     config TARGET_OMAPL138_LCDK
         bool "OMAPL138 LCDK"
-       select SOC_DA8XX
+       select SOC_DA850
         select SUPPORT_SPL
     config TARGET_CALIMAIN
@@ -63,6 +63,63 @@ config SOC_DA8XX
   config MACH_DAVINCI_DA850_EVM
         bool
   +if SYS_DA850_PLL_INIT
+comment "DA850 PLL Initialization Parameters"
Quoted 8 lines

arch/arm/mach-davinci/Kconfig config SOC_DA8XX · line 70

Quoted 3 lines
arch/arm/mach-davinci/Kconfig +3 -0
+
+config SYS_DV_CLKMODE
+       int "SYS_DV_CLKMODE"

Is DV short for DaVinci? If so, please spell it out. If not, please add a "DA850" prefix like the other parameters and add a description to explain what this option does.

I don't know where the name originate. I am simply making the Kconfig match the names that were given before, so the tool that migrates from include/configs/* can operate. If we change the names, this tool doesn't work cleanly.

Quoted 12 lines

arch/arm/mach-davinci/Kconfig config SOC_DA8XX · line 75

Quoted 6 lines
arch/arm/mach-davinci/Kconfig +5 -0
+       default 0 if SOC_DA850
+
+config SYS_DA850_PLL0_POSTDIV
+       int "SYS_DA850_PLL0_POSTDIV"
+       default 1 if SOC_DA850

All of these POSTDIV parameters don't really seem to me like something that should be in Kconfig. I think it would be much cleaner to just define a static array with these values and pass it to the da850_pll_init() function.

I don't disagree at all with you. My main goal was to shrink the include/config/*.h file options and move them into Kconfig. It's not part of the scope of what I'm trying to do to make an assessment of the quality of the code or question. The vast majority of these options are the same for every board, but someone where thought it was important to make them a configuration option, so I left it configurable. There is one board that uses a slightly different value than the rest of the boards, so I don't think that putting all these 'configs' into the source file would be the best.

Quoted 47 lines
Quoted 47 lines
arch/arm/mach-davinci/Kconfig +45 -0
+
+config SYS_DA850_PLL0_PLLDIV1
+       hex "SYS_DA850_PLL0_PLLDIV1"
+       default 0x8000 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV2
+       hex "SYS_DA850_PLL0_PLLDIV2"
+       default 0x8001 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV3
+       hex "SYS_DA850_PLL0_PLLDIV3"
+       default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV4
+       hex "SYS_DA850_PLL0_PLLDIV4"
+       default 0x8003 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV5
+       hex "SYS_DA850_PLL0_PLLDIV5"
+       default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL0_PLLDIV7
+       hex "SYS_DA850_PLL0_PLLDIV7"
+       default 0x8005 if SOC_DA850
+
+config SYS_DA850_PLL1_POSTDIV
+       hex "SYS_DA850_PLL1_POSTDIV"
+       default 1 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLDIV1
+       hex "SYS_DA850_PLL1_PLLDIV1"
+       default 0x8000 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLDIV2
+       hex "SYS_DA850_PLL1_PLLDIV2"
+       default 0x8001 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLDIV3
+       hex "SYS_DA850_PLL1_PLLDIV3"
+       default 0x8002 if SOC_DA850
+
+config SYS_DA850_PLL1_PLLM
+       int
+       default 21 if SOC_DA850
+
Quoted 8 lines

arch/arm/mach-davinci/Kconfig config SOC_DA8XX · line 122

Quoted 2 lines
arch/arm/mach-davinci/Kconfig +2 -0
+endif
+

If all of these really need to be Kconfig options, they need explanations of what the values mean, for example, 0x8002 means that you are setting the enable bit at bit 15 and you are setting the divider value to divide by 3 because the register value is one less than the actual value.

I honestly don't have any idea what these values mean or how they were derrived. I didn't bother looking. I'm just trying to help the U-Boot community migrate from include/configs/*.h to Kconfig.

Quoted 2 lines

[snip]

Quoted 3 lines

So, to sum up. Basically, this looks fine other than the lack of descriptions in the Kconfig. But, I don't think this stuff should

I tried find descriptions, but there weren't any README files that referenced these values, so I wasn't sure what to put.

Quoted 9 lines
Quoted 5 lines

have been implemented using config options in the first place. I would rather see da850_lowlevel.c get cleaned up to be more generic and pass stuff as function parameters rather than using config macros. But, since LEGO EV3 doesn't use any of this, it won't really make a difference to me either way.

I'd like to see lowlevel.c get cleaned up too, but in my mind that's a separate task from the config.h -> Kconfig migration.

Understood. If you would like to add a short description to these options, you can just say that the value will be written directly to the PLLDIVn register (or PLLM register). That should be good enough.

author
#4 lore raw

PATCH 1/1 Convert CONFIG_SYS_DV_CLKMODE et al to Kconfig

Quoted 24 lines · David Lechner
Quoted 23 lines · Adam Ford
Quoted 20 lines · David Lechner
Quoted 18 lines · Adam Ford

This converts the following to Kconfig:

     CONFIG_SYS_DV_CLKMODE
     CONFIG_SYS_DA850_PLL0_POSTDIV
     CONFIG_SYS_DA850_PLL0_PLLDIV1
     CONFIG_SYS_DA850_PLL0_PLLDIV2
     CONFIG_SYS_DA850_PLL0_PLLDIV3
     CONFIG_SYS_DA850_PLL0_PLLDIV4
     CONFIG_SYS_DA850_PLL0_PLLDIV5
     CONFIG_SYS_DA850_PLL0_PLLDIV7
     CONFIG_SYS_DA850_PLL1_POSTDIV
     CONFIG_SYS_DA850_PLL1_PLLDIV1
     CONFIG_SYS_DA850_PLL1_PLLDIV2
     CONFIG_SYS_DA850_PLL1_PLLDIV3

---

[snip]

Quoted 7 lines

Understood. If you would like to add a short description to these options, you can just say that the value will be written directly to the PLLDIVn register (or PLLM register). That should be good enough.

I can do that. That makes sense, and it's at least a slight improvement from what we had before.

Quoted 1 line

adam

Quoted 1 line