[U-Boot] i2c_set_bus_num freeze

Hello,
I have some issue in u-boot trying to access bus #1.
I can access bus #0, #2 with i2c dev 0/2
I can also access bus #0,1,2 from linux.
But on trying to access i2c #1 in u-boot in hangs:
The function i2c_set_bus_num get stuck .
ret = i2c_set_bus_num(1);
<<------- never gets here ......... if (ret) printf("Failure changing bus number (%d)\n", ret);
It hangs in i2c_set_bus_num->i2c_init->
......
printf("i2c_init 8\n");
bus_initialized[current_bus] = 1; if (readw (I2C_CON) & I2C_CON_EN) { writew (0, I2C_CON); udelay (50000); }
writew(psc, I2C_PSC); writew(scll, I2C_SCLL); writew(sclh, I2C_SCLH);
/* own address */ writew (slaveadd, I2C_OA); writew (I2C_CON_EN, I2C_CON);
printf("i2c_init 9\n"); <<------ never get printed ..................
I have seen a similar question, yet I am doing this access after u-boot complete, and command prompt.
Is anyone familiar with this ?
Regards,
Ran

On Jan 26, 2017 11:44 AM, "Ran Shalit" ranshalit@gmail.com wrote:
Hello,
I have some issue in u-boot trying to access bus #1.
I can access bus #0, #2 with i2c dev 0/2
I can also access bus #0,1,2 from linux.
But on trying to access i2c #1 in u-boot in hangs:
The function i2c_set_bus_num get stuck .
ret = i2c_set_bus_num(1);
<<------- never gets here ......... if (ret) printf("Failure changing bus number (%d)\n", ret);
It hangs in i2c_set_bus_num->i2c_init->
......
printf("i2c_init 8\n");
bus_initialized[current_bus] = 1; if (readw (I2C_CON) & I2C_CON_EN) { writew (0, I2C_CON); udelay (50000); }
writew(psc, I2C_PSC); writew(scll, I2C_SCLL); writew(sclh, I2C_SCLH);
/* own address */ writew (slaveadd, I2C_OA); writew (I2C_CON_EN, I2C_CON);
printf("i2c_init 9\n"); <<------ never get printed ..................
I have seen a similar question, yet I am doing this access after u-boot complete, and command prompt.
Is anyone familiar with this ?
What platform are you using?
Regards,
Ran _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

On Jan 27, 2017 1:20 AM, "Adam Ford" aford173@gmail.com wrote:
On Jan 26, 2017 11:44 AM, "Ran Shalit" ranshalit@gmail.com wrote:
Hello,
I have some issue in u-boot trying to access bus #1.
I can access bus #0, #2 with i2c dev 0/2
I can also access bus #0,1,2 from linux.
But on trying to access i2c #1 in u-boot in hangs:
The function i2c_set_bus_num get stuck .
ret = i2c_set_bus_num(1);
<<------- never gets here ......... if (ret) printf("Failure changing bus number (%d)\n", ret);
It hangs in i2c_set_bus_num->i2c_init->
......
printf("i2c_init 8\n");
bus_initialized[current_bus] = 1; if (readw (I2C_CON) & I2C_CON_EN) { writew (0, I2C_CON); udelay (50000); }
writew(psc, I2C_PSC); writew(scll, I2C_SCLL); writew(sclh, I2C_SCLH);
/* own address */ writew (slaveadd, I2C_OA); writew (I2C_CON_EN, I2C_CON);
printf("i2c_init 9\n"); <<------ never get printed
..................
I have seen a similar question, yet I am doing this access after u-boot complete, and command prompt.
Is anyone familiar with this ?
What platform are you using?
I am using dm8148 TI. I suspected pinmux but it seems to be ok and it is the same pinmux used in linux. In linux access to i2c 0,1,2 works without issues.
Regards,
Ran _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hello Ran,
Am 26.01.2017 um 18:42 schrieb Ran Shalit:
Hello,
I have some issue in u-boot trying to access bus #1.
On which hardware? Is the board in mainline?
I can access bus #0, #2 with i2c dev 0/2
I can also access bus #0,1,2 from linux.
But on trying to access i2c #1 in u-boot in hangs:
The function i2c_set_bus_num get stuck .
ret = i2c_set_bus_num(1);
<<------- never gets here ......... if (ret) printf("Failure changing bus number (%d)\n", ret);
It hangs in i2c_set_bus_num->i2c_init->
......
printf("i2c_init 8\n");
You see this printf?
bus_initialized[current_bus] = 1; if (readw (I2C_CON) & I2C_CON_EN) { writew (0, I2C_CON); udelay (50000); }
writew(psc, I2C_PSC); writew(scll, I2C_SCLL); writew(sclh, I2C_SCLH);
/* own address */ writew (slaveadd, I2C_OA); writew (I2C_CON_EN, I2C_CON);
printf("i2c_init 9\n"); <<------ never get printed ..................
I have seen a similar question, yet I am doing this access after u-boot complete, and command prompt.
Is anyone familiar with this ?
Hmm.. no reason, why the last printf should not come ...
As I do not know, on which hw ... I just can speculate ...
Is the clock for the i2c subsystem 1 in the SoC enabled?
bye, Heiko
Regards,
Ran _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

On Fri, Jan 27, 2017 at 8:46 AM, Heiko Schocher hs@denx.de wrote:
Hello Ran,
Am 26.01.2017 um 18:42 schrieb Ran Shalit:
Hello,
I have some issue in u-boot trying to access bus #1.
On which hardware? Is the board in mainline?
Yes, it's TI's dm8148 (ti81xx, ti814x)
I can access bus #0, #2 with i2c dev 0/2
I can also access bus #0,1,2 from linux.
But on trying to access i2c #1 in u-boot in hangs:
The function i2c_set_bus_num get stuck .
ret = i2c_set_bus_num(1);
<<------- never gets here ......... if (ret) printf("Failure changing bus number (%d)\n", ret);
It hangs in i2c_set_bus_num->i2c_init->
......
printf("i2c_init 8\n");
You see this printf?
Yes, it seems to get stuck here:
if (readw (I2C_CON) & I2C_CON_EN) { <<--------- we never gets here !!!!!!!!!!!!!!!!!!!!!!!!!!! writew (0, I2C_CON);
bus_initialized[current_bus] = 1;
if (readw (I2C_CON) & I2C_CON_EN) { writew (0, I2C_CON); udelay (50000); }
writew(psc, I2C_PSC); writew(scll, I2C_SCLL); writew(sclh, I2C_SCLH);
/* own address */ writew (slaveadd, I2C_OA); writew (I2C_CON_EN, I2C_CON);
printf("i2c_init 9\n"); <<------ never get printed
..................
I have seen a similar question, yet I am doing this access after u-boot complete, and command prompt.
Is anyone familiar with this ?
Hmm.. no reason, why the last printf should not come ...
As I do not know, on which hw ... I just can speculate ...
Is the clock for the i2c subsystem 1 in the SoC enabled?
TI's DM8148. I remember that I once used that code and it works, so I quite amazed that it stopped working now. The board had some changes from that time when I tried the code, and the sw too some minor changes (i2c eerom added in bus #0), but I really don't understand why it doesn't work any more :(
It might be clock issue, I'll check.
bye, Heiko
Regards,
Ran _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
-- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

On Fri, Jan 27, 2017 at 9:08 AM, Ran Shalit ranshalit@gmail.com wrote:
On Fri, Jan 27, 2017 at 8:46 AM, Heiko Schocher hs@denx.de wrote:
Hello Ran,
Am 26.01.2017 um 18:42 schrieb Ran Shalit:
Hello,
I have some issue in u-boot trying to access bus #1.
On which hardware? Is the board in mainline?
Yes, it's TI's dm8148 (ti81xx, ti814x)
I can access bus #0, #2 with i2c dev 0/2
I can also access bus #0,1,2 from linux.
But on trying to access i2c #1 in u-boot in hangs:
The function i2c_set_bus_num get stuck .
ret = i2c_set_bus_num(1);
<<------- never gets here ......... if (ret) printf("Failure changing bus number (%d)\n", ret);
It hangs in i2c_set_bus_num->i2c_init->
......
printf("i2c_init 8\n");
You see this printf?
Yes, it seems to get stuck here:
if (readw (I2C_CON) & I2C_CON_EN) { <<--------- we never gets here !!!!!!!!!!!!!!!!!!!!!!!!!!! writew (0, I2C_CON);
bus_initialized[current_bus] = 1;
if (readw (I2C_CON) & I2C_CON_EN) { writew (0, I2C_CON); udelay (50000); }
writew(psc, I2C_PSC); writew(scll, I2C_SCLL); writew(sclh, I2C_SCLH);
/* own address */ writew (slaveadd, I2C_OA); writew (I2C_CON_EN, I2C_CON);
printf("i2c_init 9\n"); <<------ never get printed
..................
I have seen a similar question, yet I am doing this access after u-boot complete, and command prompt.
Is anyone familiar with this ?
Hmm.. no reason, why the last printf should not come ...
As I do not know, on which hw ... I just can speculate ...
Is the clock for the i2c subsystem 1 in the SoC enabled?
TI's DM8148. I remember that I once used that code and it works, so I quite amazed that it stopped working now. The board had some changes from that time when I tried the code, and the sw too some minor changes (i2c eerom added in bus #0), but I really don't understand why it doesn't work any more :(
It might be clock issue, I'll check.
I still don't understand what reason for it to get stuck in: if (readw (I2C_CON) & I2C_CON_EN) It's a simple register reading, Right ? So why should it hangs after calling ?
Regards, Ran
bye, Heiko
Regards,
Ran _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
-- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Hi
On 27 Jan 2017 3:13 p.m., "Ran Shalit" ranshalit@gmail.com wrote:
On Fri, Jan 27, 2017 at 9:08 AM, Ran Shalit ranshalit@gmail.com wrote:
On Fri, Jan 27, 2017 at 8:46 AM, Heiko Schocher hs@denx.de wrote:
Hello Ran,
Am 26.01.2017 um 18:42 schrieb Ran Shalit:
Hello,
I have some issue in u-boot trying to access bus #1.
On which hardware? Is the board in mainline?
Yes, it's TI's dm8148 (ti81xx, ti814x)
I can access bus #0, #2 with i2c dev 0/2
I can also access bus #0,1,2 from linux.
But on trying to access i2c #1 in u-boot in hangs:
The function i2c_set_bus_num get stuck .
ret = i2c_set_bus_num(1);
<<------- never gets here ......... if (ret) printf("Failure changing bus number (%d)\n", ret);
It hangs in i2c_set_bus_num->i2c_init->
......
printf("i2c_init 8\n");
You see this printf?
Yes, it seems to get stuck here:
if (readw (I2C_CON) & I2C_CON_EN) { <<--------- we never gets here !!!!!!!!!!!!!!!!!!!!!!!!!!! writew (0, I2C_CON);
bus_initialized[current_bus] = 1;
if (readw (I2C_CON) & I2C_CON_EN) { writew (0, I2C_CON); udelay (50000); }
writew(psc, I2C_PSC); writew(scll, I2C_SCLL); writew(sclh, I2C_SCLH);
/* own address */ writew (slaveadd, I2C_OA); writew (I2C_CON_EN, I2C_CON);
printf("i2c_init 9\n"); <<------ never get printed
..................
I have seen a similar question, yet I am doing this access after u-boot complete, and command prompt.
Is anyone familiar with this ?
Hmm.. no reason, why the last printf should not come ...
As I do not know, on which hw ... I just can speculate ...
Is the clock for the i2c subsystem 1 in the SoC enabled?
TI's DM8148. I remember that I once used that code and it works, so I quite amazed that it stopped working now. The board had some changes from that time when I tried the code, and the sw too some minor changes (i2c eerom added in bus #0), but I really don't understand why it doesn't work any more :(
It might be clock issue, I'll check.
I still don't understand what reason for it to get stuck in: if (readw (I2C_CON) & I2C_CON_EN) It's a simple register reading, Right ? So why should it hangs after calling ?
Regards, Ran
If the clock is not enable for the bus it can not work. Please check if you need to declare the i2c bus in use
Michael
bye, Heiko
Regards,
Ran _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
-- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hello Ran,
Am 27.01.2017 um 08:08 schrieb Ran Shalit:
On Fri, Jan 27, 2017 at 8:46 AM, Heiko Schocher <hs@denx.de mailto:hs@denx.de> wrote:
Hello Ran, Am 26.01.2017 um 18:42 schrieb Ran Shalit: Hello, I have some issue in u-boot trying to access bus #1. On which hardware? Is the board in mainline?
Yes, it's TI's dm8148 (ti81xx, ti814x)
Which defconfig do you use?
I can access bus #0, #2 with i2c dev 0/2 I can also access bus #0,1,2 from linux. But on trying to access i2c #1 in u-boot in hangs: The function i2c_set_bus_num get stuck . ret = i2c_set_bus_num(1); <<------- never gets here ......... if (ret) printf("Failure changing bus number (%d)\n", ret); It hangs in i2c_set_bus_num->i2c_init-> ...... printf("i2c_init 8\n"); You see this printf?
Yes, it seems to get stuck here:
if (readw (I2C_CON) & I2C_CON_EN) { <<--------- we never gets here !!!!!!!!!!!!!!!!!!!!!!!!!!! writew (0, I2C_CON);
bus_initialized[current_bus] = 1; if (readw (I2C_CON) & I2C_CON_EN) {
Hmm... if I search for "bus_initialized" in mainline code:
$ grep -lr bus_initialized drivers/i2c/ drivers/i2c/mv_i2c.c
I only find the mv_i2c driver ... do you use current mainline code?
writew (0, I2C_CON); udelay (50000); } writew(psc, I2C_PSC); writew(scll, I2C_SCLL); writew(sclh, I2C_SCLH); /* own address */ writew (slaveadd, I2C_OA); writew (I2C_CON_EN, I2C_CON); printf("i2c_init 9\n"); <<------ never get printed .................. I have seen a similar question, yet I am doing this access after u-boot complete, and command prompt. Is anyone familiar with this ? Hmm.. no reason, why the last printf should not come ... As I do not know, on which hw ... I just can speculate ... Is the clock for the i2c subsystem 1 in the SoC enabled?
TI's DM8148. I remember that I once used that code and it works, so I quite amazed that it stopped working now. The board had some changes from that time when I tried the code, and the sw too some minor changes (i2c eerom added in bus #0), but I really don't understand why it doesn't work any more :(
It might be clock issue, I'll check.
Thanks!
bye, Heiko
bye, Heiko Regards, Ran _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de <mailto:U-Boot@lists.denx.de> http://lists.denx.de/mailman/listinfo/u-boot <http://lists.denx.de/mailman/listinfo/u-boot> -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
participants (4)
-
Adam Ford
-
Heiko Schocher
-
Michael Nazzareno Trimarchi
-
Ran Shalit