Skip to contentSkip to conversation

keystone2: use SPD info to configure K2HK and K2E DDR3

PATCH New Vitaly Andrianov 2 participants 3 messages Jun 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 keystone2: use SPD info to configure K2HK and K2E DDR3

This commit replaces hard-coded EMIF and PHY DDR3 configurations for predefined SODIMMs to a calculated configuration. The SODIMM parameters are read from SODIMM's SPD and used to calculated the configuration.

The current commit supports calculation for DDR3 with 1600MHz and 1333MHz only.

---
 board/ti/ks2_evm/Makefile    |   5 +-
 board/ti/ks2_evm/ddr3_cfg.c  |   2 +
 board/ti/ks2_evm/ddr3_cfg.h  |  10 +-
 board/ti/ks2_evm/ddr3_k2e.c  |  56 ++---
 board/ti/ks2_evm/ddr3_k2hk.c | 103 ++++-----
 board/ti/ks2_evm/ddr3_spd.c  | 531 +++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 616 insertions(+), 91 deletions(-)
 create mode 100644 board/ti/ks2_evm/ddr3_spd.c
board/ti/ks2_evm/Makefile +4 -1
index 071dbee..c888ab3 100644
@@ -1,6 +1,6 @@
 #
 # KS2-EVM: board Makefile
-# (C) Copyright 2012-2014
+# (C) Copyright 2012-2015
 #     Texas Instruments Incorporated, <www.ti.com>
 # SPDX-License-Identifier:     GPL-2.0+
 #
@@ -9,7 +9,10 @@ obj-y += board.o
 obj-y += ddr3_cfg.o
 obj-$(CONFIG_K2HK_EVM) += board_k2hk.o
 obj-$(CONFIG_K2HK_EVM) += ddr3_k2hk.o
+obj-$(CONFIG_K2HK_EVM) += ddr3_spd.o
 obj-$(CONFIG_K2E_EVM) += board_k2e.o
 obj-$(CONFIG_K2E_EVM) += ddr3_k2e.o
+obj-$(CONFIG_K2E_EVM) += ddr3_spd.o
 obj-$(CONFIG_K2L_EVM) += board_k2l.o
 obj-$(CONFIG_K2L_EVM) += ddr3_k2l.o
+
board/ti/ks2_evm/ddr3_cfg.c +2 -0
index ab44676..34b4103 100644
@@ -169,6 +169,7 @@ struct ddr3_emif_config ddr3_1600_2g = {
 	.sdrfc          = 0x00001869ul,
 };
 
+#ifndef CONFIG_SOC_K2HK
 int ddr3_get_dimm_params(char *dimm_name)
 {
 	int ret;
@@ -204,3 +205,4 @@ int ddr3_get_dimm_params(char *dimm_name)
 
 	return 0;
 }
+#endif
board/ti/ks2_evm/ddr3_cfg.h +7 -3
index 5bd786c..5084508 100644
@@ -10,18 +10,22 @@
 #ifndef __DDR3_CFG_H
 #define __DDR3_CFG_H
 
+extern struct ddr3_phy_config phy_spd_cfg;
+extern struct ddr3_emif_config emif_spd_cfg;
+int ddr3_get_dimm_params_from_spd(u8 *spd_params, int *ddr_clk,
+				  int *ddr_size);
+
 extern struct ddr3_phy_config ddr3phy_1600_8g;
 extern struct ddr3_emif_config ddr3_1600_8g;
 
 extern struct ddr3_phy_config ddr3phy_1333_2g;
 extern struct ddr3_emif_config ddr3_1333_2g;
 
-extern struct ddr3_phy_config ddr3phy_1600_4g;
-extern struct ddr3_emif_config ddr3_1600_4g;
-
 extern struct ddr3_phy_config ddr3phy_1600_2g;
 extern struct ddr3_emif_config ddr3_1600_2g;
 
 int ddr3_get_dimm_params(char *dimm_name);
 
+
+
 #endif /* __DDR3_CFG_H */
board/ti/ks2_evm/ddr3_k2e.c +30 -26

79 lines not on this page · raw message

board/ti/ks2_evm/ddr3_k2hk.c +42 -61

116 lines not on this page · raw message

board/ti/ks2_evm/ddr3_spd.c new file +531 -0

531 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 keystone2: use SPD info to configure K2HK and K2E DDR3

Quoted 8 lines · Vitaly Andrianov

This commit replaces hard-coded EMIF and PHY DDR3 configurations for predefined SODIMMs to a calculated configuration. The SODIMM parameters are read from SODIMM's SPD and used to calculated the configuration.

The current commit supports calculation for DDR3 with 1600MHz and 1333MHz only.

There's two problems here. The first is, no floating point math in U-Boot. The second is that between board/ti/ks2_evm/ddr3_spd.c that you're adding and drivers/ddr/fsl/ddr3_dimm_params.c and drivers/ddr/mvebu/ddr3_spd.c it seems like we have two and you would add a 3rd file for reading the standard-defined SPD data. We need one set of functions in drivers/ddr/ to read the spd information and do whatever really common bits can be done with it and the rest in drivers/ddr/subdir/.

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

PATCH 1/1 keystone2: use SPD info to configure K2HK and K2E DDR3

Quoted 11 lines · Tom Rini
Quoted 8 lines · Vitaly Andrianov

This commit replaces hard-coded EMIF and PHY DDR3 configurations for predefined SODIMMs to a calculated configuration. The SODIMM parameters are read from SODIMM's SPD and used to calculated the configuration.

The current commit supports calculation for DDR3 with 1600MHz and 1333MHz only.

Quoted 9 lines

There's two problems here. The first is, no floating point math in U-Boot. The second is that between board/ti/ks2_evm/ddr3_spd.c that you're adding and drivers/ddr/fsl/ddr3_dimm_params.c and drivers/ddr/mvebu/ddr3_spd.c it seems like we have two and you would add a 3rd file for reading the standard-defined SPD data. We need one set of functions in drivers/ddr/ to read the spd information and do whatever really common bits can be done with it and the rest in drivers/ddr/subdir/.

Tom,

Thank you. I'll rework the calculation not to use floating point math. Also I'll check whether I can reuse existing drivers.

Regards,
Vitaly