Skip to contentSkip to conversation

Convert CONFIG_SYS_DV_CLKMODE et al to Kconfig

PATCH Superseded Adam Ford 2 participants 2 messages Jan 11, 2018

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH v2 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

---
Changes in V2:
Expand Kconfig help definitions to give a small explanation of options
V1:
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   | 85 ++++++++++++++++++++++++++++++++++++++++-
 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, 85 insertions(+), 78 deletions(-)
arch/arm/mach-davinci/Kconfig +84 -1
index ae9c0fd..a6818a8 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,89 @@ 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
+	help
+	  Set PLLCTL Clock Mode bit as External Clock or On Chip oscillator
+
+config SYS_DA850_PLL0_POSTDIV
+	int "SYS_DA850_PLL0_POSTDIV"
+	default 1 if SOC_DA850
+	help
+	  Value written to PLL1, POSTDIV register
+
+config SYS_DA850_PLL0_PLLDIV1
+	hex "SYS_DA850_PLL0_PLLDIV1"
+	default 0x8000 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV1 register
+
+config SYS_DA850_PLL0_PLLDIV2
+	hex "SYS_DA850_PLL0_PLLDIV2"
+	default 0x8001 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV2 register
+
+config SYS_DA850_PLL0_PLLDIV3
+	hex "SYS_DA850_PLL0_PLLDIV3"
+	default 0x8002 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV3 register
+
+config SYS_DA850_PLL0_PLLDIV4
+	hex "SYS_DA850_PLL0_PLLDIV4"
+	default 0x8003 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV4 register
+
+config SYS_DA850_PLL0_PLLDIV5
+	hex "SYS_DA850_PLL0_PLLDIV5"
+	default 0x8002 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV5 register
+
+config SYS_DA850_PLL0_PLLDIV7
+	hex "SYS_DA850_PLL0_PLLDIV7"
+	default 0x8005 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV7 register
+
+config SYS_DA850_PLL1_POSTDIV
+	hex "SYS_DA850_PLL1_POSTDIV"
+	default 1 if SOC_DA850
+	help
+	  Value written to PLL1, POSTDIV register
+
+config SYS_DA850_PLL1_PLLDIV1
+	hex "SYS_DA850_PLL1_PLLDIV1"
+	default 0x8000 if SOC_DA850
+	help
+	  Value written to PLL1, DIV1 register
+
+config SYS_DA850_PLL1_PLLDIV2
+	hex "SYS_DA850_PLL1_PLLDIV2"
+	default 0x8001 if SOC_DA850
+	help
+	  Value written to PLL1, DIV2 register
+
+config SYS_DA850_PLL1_PLLDIV3
+	hex "SYS_DA850_PLL1_PLLDIV3"
+	default 0x8002 if SOC_DA850
+	help
+	  Value written to PLL1, DIV3 register
+
+config SYS_DA850_PLL1_PLLM
+	int "SYS_DA850_PLL1_PLLM"
+	default 21 if SOC_DA850
+	help
+	  Value written to PLL1 multiplier
+
+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 v2 1/1 Convert CONFIG_SYS_DV_CLKMODE et al to Kconfig

Quoted 56 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

---
Changes in V2:
Expand Kconfig help definitions to give a small explanation of options
V1:
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   | 85 ++++++++++++++++++++++++++++++++++++++++-
  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, 85 insertions(+), 78 deletions(-)
arch/arm/mach-davinci/Kconfig +5 -1
index ae9c0fd..a6818a8 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,89 @@ config SOC_DA8XX
  config MACH_DAVINCI_DA850_EVM
  	bool
 
+if SYS_DA850_PLL_INIT
+comment "DA850 PLL Initialization Parameters"
+
+config SYS_DV_CLKMODE

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

Quoted 10 lines
arch/arm/mach-davinci/Kconfig +10 -0
+	int "SYS_DV_CLKMODE"
+	default 0 if SOC_DA850
+	help
+	  Set PLLCTL Clock Mode bit as External Clock or On Chip oscillator
+
+config SYS_DA850_PLL0_POSTDIV
+	int "SYS_DA850_PLL0_POSTDIV"
+	default 1 if SOC_DA850
+	help
+	  Value written to PLL1, POSTDIV register

help does not match config - PLL1 vs. PLL0.

Quoted 38 lines
arch/arm/mach-davinci/Kconfig +38 -0
+
+config SYS_DA850_PLL0_PLLDIV1
+	hex "SYS_DA850_PLL0_PLLDIV1"
+	default 0x8000 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV1 register
+
+config SYS_DA850_PLL0_PLLDIV2
+	hex "SYS_DA850_PLL0_PLLDIV2"
+	default 0x8001 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV2 register
+
+config SYS_DA850_PLL0_PLLDIV3
+	hex "SYS_DA850_PLL0_PLLDIV3"
+	default 0x8002 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV3 register
+
+config SYS_DA850_PLL0_PLLDIV4
+	hex "SYS_DA850_PLL0_PLLDIV4"
+	default 0x8003 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV4 register
+
+config SYS_DA850_PLL0_PLLDIV5
+	hex "SYS_DA850_PLL0_PLLDIV5"
+	default 0x8002 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV5 register
+
+config SYS_DA850_PLL0_PLLDIV7
+	hex "SYS_DA850_PLL0_PLLDIV7"
+	default 0x8005 if SOC_DA850
+	help
+	  Value written to PLL0, PLLDIV7 register
+
+config SYS_DA850_PLL1_POSTDIV

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

Quoted 10 lines
arch/arm/mach-davinci/Kconfig +10 -0
+	hex "SYS_DA850_PLL1_POSTDIV"
+	default 1 if SOC_DA850
+	help
+	  Value written to PLL1, POSTDIV register
+
+config SYS_DA850_PLL1_PLLDIV1
+	hex "SYS_DA850_PLL1_PLLDIV1"
+	default 0x8000 if SOC_DA850
+	help
+	  Value written to PLL1, DIV1 register

In the TRM's (at least in AM1808/OMAP-L138) this register is "PLLDIV1", not just "DIV1".

Quoted 42 lines
arch/arm/mach-davinci/Kconfig +21 -0
+
+config SYS_DA850_PLL1_PLLDIV2
+	hex "SYS_DA850_PLL1_PLLDIV2"
+	default 0x8001 if SOC_DA850
+	help
+	  Value written to PLL1, DIV2 register
+
+config SYS_DA850_PLL1_PLLDIV3
+	hex "SYS_DA850_PLL1_PLLDIV3"
+	default 0x8002 if SOC_DA850
+	help
+	  Value written to PLL1, DIV3 register
+
+config SYS_DA850_PLL1_PLLM
+	int "SYS_DA850_PLL1_PLLM"
+	default 21 if SOC_DA850
+	help
+	  Value written to PLL1 multiplier
+
+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 -0
index 7dfc1fa..8605487 100644
@@ -39,20 +39,7 @@
  /*

include/configs/calimain.h line 42

Quoted 10 lines
include/configs/calimain.h +0 -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

I suppose you are not adding CONFIG_SYS_DA850_PLL0_PLLDIV6 to Kconfig because there is not a way to handle this relationship?

I think it would be just fine to move CONFIG_SYS_DA850_PLL0_PLLDIV6 to Kconfig and give it the default value 0x8000. I suspect that this comes from the fact that these clocks are supposed to be "fixed ratio" but there are other clocks that are also "fixed ratio" that are not handled this way already (PLL0_SYSCLK2, PLL0_SYSCLK4).

Quoted 7 lines
include/configs/calimain.h +0 -6
-#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