Skip to contentSkip to conversation

am335x: chilisom: Initial support for different DDR3 chips

PATCH New Maciej Zagrabski 3 participants 3 messages Jan 21, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 am335x: chilisom: Initial support for different DDR3 chips

Manufacturing process changes caused that several versions of chiliSOM with different memory chips are present on market. Patch introduces method for selecting actual memory chip on som through Kconfig. Patch creates space for adding more memory chips in future.

Memory chip configuration is constructed by preprocesor basing on DDR3 part no from Kconfig. To do this, Makefile translates string from Kconfig into preprocesor token.

---
 arch/arm/include/asm/arch-am33xx/ddr_defs.h | 16 ++++++++++
 arch/arm/mach-omap2/am33xx/Kconfig          | 21 +++++++++++++
 arch/arm/mach-omap2/am33xx/Makefile         |  1 +
 arch/arm/mach-omap2/am33xx/chilisom.c       | 48 ++++++++++++++++-------------
 4 files changed, 64 insertions(+), 22 deletions(-)
arch/arm/include/asm/arch-am33xx/ddr_defs.h +16 -0
index d8ddecc0bd2..94c1fac9a24 100644
@@ -154,6 +154,22 @@
 #define K4B2G1646EBIH9_PHY_WR_DATA		0x76
 #define K4B2G1646EBIH9_IOCTRL_VALUE		0x18B
 
+/* Samsung K4B4G1646D-BIK0 */
+#define K4B4G1646DBIK0_EMIF_READ_LATENCY	0x100007
+#define K4B4G1646DBIK0_EMIF_TIM1		0x0AAAE51B
+#define K4B4G1646DBIK0_EMIF_TIM2		0x2A6B7FDA
+#define K4B4G1646DBIK0_EMIF_TIM3		0x501F867F
+#define K4B4G1646DBIK0_EMIF_SDCFG		0x61C05332
+#define K4B4G1646DBIK0_EMIF_SDREF		0xC30
+#define K4B4G1646DBIK0_ZQ_CFG			0x50074BE4
+#define K4B4G1646DBIK0_RATIO			0x80
+#define K4B4G1646DBIK0_INVERT_CLKOUT		0x0
+#define K4B4G1646DBIK0_RD_DQS			0x3C
+#define K4B4G1646DBIK0_WR_DQS			0x38
+#define K4B4G1646DBIK0_PHY_FIFO_WE		0x98
+#define K4B4G1646DBIK0_PHY_WR_DATA		0x73
+#define K4B4G1646DBIK0_IOCTRL_VALUE		0x18B
+
 #define  LPDDR2_ADDRCTRL_IOCTRL_VALUE   0x294
 #define  LPDDR2_ADDRCTRL_WD0_IOCTRL_VALUE 0x00000000
 #define  LPDDR2_ADDRCTRL_WD1_IOCTRL_VALUE 0x00000000
arch/arm/mach-omap2/am33xx/Kconfig +21 -0
index 57284c4ae12..535bcd6c3d0 100644
@@ -24,6 +24,27 @@ config AM33XX_CHILISOM
 	bool
 	select SUPPORT_SPL
 
+if AM33XX_CHILISOM
+
+choice
+  prompt "DDR3 chip on chiliSOM"
+  default CHILISOM_MT41K256M16HA125E
+
+config CHILISOM_MT41K256M16HA125E
+  bool "Micron MT41K256"
+
+config CHILISOM_K4B4G1646DBIK0
+  bool "Samsung K4B4G1646"
+
+endchoice
+
+config CHILISOM_DDR3_CHIP_NAME
+  string
+  default K4B4G1646DBIK0 if CHILISOM_K4B4G1646DBIK0
+  default MT41K256M16HA125E
+
+endif
+
 choice
 	prompt "AM33xx board select"
 
arch/arm/mach-omap2/am33xx/Makefile +1 -0
index 61c76d045f3..81c7a82f21e 100644
@@ -26,3 +26,4 @@ obj-y	+= fdt.o
 obj-$(CONFIG_CLOCK_SYNTHESIZER)	+= clk_synthesizer.o
 
 obj-$(CONFIG_AM33XX_CHILISOM) += chilisom.o
+CFLAGS_chilisom.o := -DCHILISOM_DDR3_CHIP_NAME=$(CONFIG_CHILISOM_DDR3_CHIP_NAME)
arch/arm/mach-omap2/am33xx/chilisom.c +26 -22

75 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 am335x: chilisom: Initial support for different DDR3 chips

Quoted 11 lines · Maciej Zagrabski

Manufacturing process changes caused that several versions of chiliSOM with different memory chips are present on market. Patch introduces method for selecting actual memory chip on som through Kconfig. Patch creates space for adding more memory chips in future.

Memory chip configuration is constructed by preprocesor basing on DDR3 part no from Kconfig. To do this, Makefile translates string from Kconfig into preprocesor token.

[snip]

arch/arm/mach-omap2/am33xx/Makefile obj-y += fdt.o · line 29

Quoted 9 lines
arch/arm/mach-omap2/am33xx/Makefile +1 -0
index 61c76d045f3..81c7a82f21e 100644
@@ -26,3 +26,4 @@ obj-y	+= fdt.o
 obj-$(CONFIG_CLOCK_SYNTHESIZER)	+= clk_synthesizer.o
 
 obj-$(CONFIG_AM33XX_CHILISOM) += chilisom.o
+CFLAGS_chilisom.o := -DCHILISOM_DDR3_CHIP_NAME=$(CONFIG_CHILISOM_DDR3_CHIP_NAME)

I'm not super happy with this. Can't we use __stringify() in the code directly instead?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190121/12482496/attachment.sig>
#2 lore raw

PATCH 1/1 am335x: chilisom: Initial support for different DDR3 chips

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 11 lines · Maciej Zagrabski

Manufacturing process changes caused that several versions of chiliSOM with different memory chips are present on market. Patch introduces method for selecting actual memory chip on som through Kconfig. Patch creates space for adding more memory chips in future.

Memory chip configuration is constructed by preprocesor basing on DDR3 part no from Kconfig. To do this, Makefile translates string from Kconfig into preprocesor token.

[snip]

Quoted 7 lines
arch/arm/mach-omap2/am33xx/Makefile +0 -0
index 61c76d045f3..81c7a82f21e 100644
@@ -26,3 +26,4 @@ obj-y	+= fdt.o
 obj-$(CONFIG_CLOCK_SYNTHESIZER)	+= clk_synthesizer.o
 
Quoted 5 lines

arch/arm/mach-omap2/am33xx/Makefile obj-y += fdt.o · line 29

Quoted 2 lines
arch/arm/mach-omap2/am33xx/Makefile +1 -0
 obj-$(CONFIG_AM33XX_CHILISOM) += chilisom.o
+CFLAGS_chilisom.o := -DCHILISOM_DDR3_CHIP_NAME=$(CONFIG_CHILISOM_DDR3_CHIP_NAME)

I'm not super happy with this. Can't we use __stringify() in the code directly instead?

The problem is that we need the opposite convertion. Kconfig is generating macro value with "" quotes. We need that macro without quotes in C code.

--
Marcin Niestrój