main.c (1ad6364eeb4f578e423081d1748e8a3fdf1ab01d) | main.c (34e026f9b1eb3bcffb38e7787c2e6eac0e88ba85) |
---|---|
1/* | 1/* |
2 * Copyright 2008-2012 Freescale Semiconductor, Inc. | 2 * Copyright 2008-2014 Freescale Semiconductor, Inc. |
3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * Version 2 as published by the Free Software Foundation. 7 */ 8 9/* 10 * Generic driver for Freescale DDR/DDR2/DDR3 memory controller. --- 65 unchanged lines hidden (view full) --- 76 [1][0] = SPD_EEPROM_ADDRESS3, /* controller 2 */ 77 [1][1] = SPD_EEPROM_ADDRESS4, /* controller 2 */ 78 [2][0] = SPD_EEPROM_ADDRESS5, /* controller 3 */ 79 [2][1] = SPD_EEPROM_ADDRESS6, /* controller 3 */ 80}; 81 82#endif 83 | 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * Version 2 as published by the Free Software Foundation. 7 */ 8 9/* 10 * Generic driver for Freescale DDR/DDR2/DDR3 memory controller. --- 65 unchanged lines hidden (view full) --- 76 [1][0] = SPD_EEPROM_ADDRESS3, /* controller 2 */ 77 [1][1] = SPD_EEPROM_ADDRESS4, /* controller 2 */ 78 [2][0] = SPD_EEPROM_ADDRESS5, /* controller 3 */ 79 [2][1] = SPD_EEPROM_ADDRESS6, /* controller 3 */ 80}; 81 82#endif 83 |
84#define SPD_SPA0_ADDRESS 0x36 85#define SPD_SPA1_ADDRESS 0x37 86 |
|
84static void __get_spd(generic_spd_eeprom_t *spd, u8 i2c_address) 85{ 86 int ret; | 87static void __get_spd(generic_spd_eeprom_t *spd, u8 i2c_address) 88{ 89 int ret; |
90#ifdef CONFIG_SYS_FSL_DDR4 91 uint8_t dummy = 0; 92#endif |
|
87 88 i2c_set_bus_num(CONFIG_SYS_SPD_BUS_NUM); 89 | 93 94 i2c_set_bus_num(CONFIG_SYS_SPD_BUS_NUM); 95 |
96#ifdef CONFIG_SYS_FSL_DDR4 97 /* 98 * DDR4 SPD has 384 to 512 bytes 99 * To access the lower 256 bytes, we need to set EE page address to 0 100 * To access the upper 256 bytes, we need to set EE page address to 1 101 * See Jedec standar No. 21-C for detail 102 */ 103 i2c_write(SPD_SPA0_ADDRESS, 0, 1, &dummy, 1); 104 ret = i2c_read(i2c_address, 0, 1, (uchar *)spd, 256); 105 if (!ret) { 106 i2c_write(SPD_SPA1_ADDRESS, 0, 1, &dummy, 1); 107 ret = i2c_read(i2c_address, 0, 1, 108 (uchar *)((ulong)spd + 256), 109 min(256, sizeof(generic_spd_eeprom_t) - 256)); 110 } 111#else |
|
90 ret = i2c_read(i2c_address, 0, 1, (uchar *)spd, 91 sizeof(generic_spd_eeprom_t)); | 112 ret = i2c_read(i2c_address, 0, 1, (uchar *)spd, 113 sizeof(generic_spd_eeprom_t)); |
114#endif |
|
92 93 if (ret) { 94 if (i2c_address == 95#ifdef SPD_EEPROM_ADDRESS 96 SPD_EEPROM_ADDRESS 97#elif defined(SPD_EEPROM_ADDRESS1) 98 SPD_EEPROM_ADDRESS1 99#endif --- 638 unchanged lines hidden --- | 115 116 if (ret) { 117 if (i2c_address == 118#ifdef SPD_EEPROM_ADDRESS 119 SPD_EEPROM_ADDRESS 120#elif defined(SPD_EEPROM_ADDRESS1) 121 SPD_EEPROM_ADDRESS1 122#endif --- 638 unchanged lines hidden --- |