mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-04-01 12:01:31 +00:00
cmd: i2c: Fix use sdram sub command with CONFIG_DM_I2C
sdram sub command of i2c command does not support Drivers Model. This adds Drivers Model support to sdram sub command. Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
parent
cab8a27d80
commit
28df8ed07f
1 changed files with 12 additions and 2 deletions
14
cmd/i2c.c
14
cmd/i2c.c
|
@ -1156,7 +1156,10 @@ static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
|
||||||
uint chip;
|
uint chip;
|
||||||
u_char data[128];
|
u_char data[128];
|
||||||
u_char cksum;
|
u_char cksum;
|
||||||
int j;
|
int j, ret;
|
||||||
|
#ifdef CONFIG_DM_I2C
|
||||||
|
struct udevice *dev;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *decode_CAS_DDR2[] = {
|
static const char *decode_CAS_DDR2[] = {
|
||||||
" TBD", " 6", " 5", " 4", " 3", " 2", " TBD", " TBD"
|
" TBD", " 6", " 5", " 4", " 3", " 2", " TBD", " TBD"
|
||||||
|
@ -1210,7 +1213,14 @@ static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
|
||||||
*/
|
*/
|
||||||
chip = simple_strtoul (argv[1], NULL, 16);
|
chip = simple_strtoul (argv[1], NULL, 16);
|
||||||
|
|
||||||
if (i2c_read (chip, 0, 1, data, sizeof (data)) != 0) {
|
#ifdef CONFIG_DM_I2C
|
||||||
|
ret = i2c_get_cur_bus_chip(chip, &dev);
|
||||||
|
if (!ret)
|
||||||
|
ret = dm_i2c_read(dev, 0, data, sizeof(data));
|
||||||
|
#else
|
||||||
|
ret = i2c_read(chip, 0, 1, data, sizeof(data));
|
||||||
|
#endif
|
||||||
|
if (ret) {
|
||||||
puts ("No SDRAM Serial Presence Detect found.\n");
|
puts ("No SDRAM Serial Presence Detect found.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue