Message ID | 20190415011414.22315-1-rashmica.g@gmail.com |
---|---|
Headers | show |
Series | Add i2c put and get to pdbg | expand |
On Monday, 15 April 2019 11:14:11 AM AEST Rashmica Gupta wrote: > At the moment we only support multiples of 4 bytes. So if you just want to > set the device to read from it you need to do something like: > ./pdbg -P i2cm puti2c 0 0x50 10 3 0x000000 (the device addr counts as a > byte) It seems odd that the restriction includes the device address, or is that referring to the SMBus command-code/register offset? Also I couldn't quite grok what all the numbers in the puti2c command might be, maybe I should go read the code. > > The i2c reset function doesn't work as well as I would like... Sometimes > if you try to read from devices that don't exist, you can no longer read > from devices that do exist - using the reset func in skiboot (by doing > i2ctransfer from i2ctools on the host or a reboot) or resetting the lbus > (./pdbg -P fsi0 -D4 putcfam 0x80d 0x20000000) sometimes but not always > fixes things. > > > Rashmica Gupta (3): > libpdbg: use i2ctools lib > libpdbg: Add i2c get and put functions for i2c master on CFAM > libpdbg: Add i2c get and put for i2c masters on the PIB > > Makefile.am | 7 + > configure.ac | 5 + > libpdbg/i2cm.c | 667 ++++++++++++++++++++++++++++++++++++++++++++++ > libpdbg/libpdbg.h | 5 + > libpdbg/target.c | 24 ++ > libpdbg/target.h | 12 + > p9-fsi.dtsi.m4 | 7 + > p9-host.dts.m4 | 28 ++ > p9-i2c.dts.m4 | 21 ++ > p9-kernel.dts.m4 | 8 + > src/i2c.c | 82 ++++++ > src/main.c | 6 +- > src/parsers.c | 18 ++ > src/parsers.h | 2 + > 14 files changed, 890 insertions(+), 2 deletions(-) > create mode 100644 libpdbg/i2cm.c > create mode 100644 p9-i2c.dts.m4 > create mode 100644 src/i2c.c
On Mon, 2019-04-15 at 13:47 +1000, Alistair Popple wrote: > On Monday, 15 April 2019 11:14:11 AM AEST Rashmica Gupta wrote: > > At the moment we only support multiples of 4 bytes. So if you just > > want to > > set the device to read from it you need to do something like: > > ./pdbg -P i2cm puti2c 0 0x50 10 3 0x000000 (the device addr > > counts as a > > byte) > > It seems odd that the restriction includes the device address, or is > that > referring to the SMBus command-code/register offset? Also I couldn't > quite > grok what all the numbers in the puti2c command might be, maybe I > should go > read the code. > Ugh I guess you're right. The command should be ./pdbg -P i2cm puti2c <port> <addr> <size> <data> rather than what I have ./pdbg -P i2cm puti2c <port> <addr> <offset> <size> <data> and then the user needs to put the offset in the data field. And once I add the targeting for the port as you mentioned in your other reply, then it will become ./pdbg -P i2cm puti2c <addr> <size> <data> Maybe I should add the smbus read command as well since I seem to like that so much :) > > > > The i2c reset function doesn't work as well as I would like... > > Sometimes > > if you try to read from devices that don't exist, you can no longer > > read > > from devices that do exist - using the reset func in skiboot (by > > doing > > i2ctransfer from i2ctools on the host or a reboot) or resetting the > > lbus > > (./pdbg -P fsi0 -D4 putcfam 0x80d 0x20000000) sometimes but not > > always > > fixes things. > > > > > > Rashmica Gupta (3): > > libpdbg: use i2ctools lib > > libpdbg: Add i2c get and put functions for i2c master on CFAM > > libpdbg: Add i2c get and put for i2c masters on the PIB > > > > Makefile.am | 7 + > > configure.ac | 5 + > > libpdbg/i2cm.c | 667 > > ++++++++++++++++++++++++++++++++++++++++++++++ > > libpdbg/libpdbg.h | 5 + > > libpdbg/target.c | 24 ++ > > libpdbg/target.h | 12 + > > p9-fsi.dtsi.m4 | 7 + > > p9-host.dts.m4 | 28 ++ > > p9-i2c.dts.m4 | 21 ++ > > p9-kernel.dts.m4 | 8 + > > src/i2c.c | 82 ++++++ > > src/main.c | 6 +- > > src/parsers.c | 18 ++ > > src/parsers.h | 2 + > > 14 files changed, 890 insertions(+), 2 deletions(-) > > create mode 100644 libpdbg/i2cm.c > > create mode 100644 p9-i2c.dts.m4 > > create mode 100644 src/i2c.c > >
On Tue, 2019-04-16 at 09:17 +1000, Rashmica Gupta wrote: > On Mon, 2019-04-15 at 13:47 +1000, Alistair Popple wrote: > > On Monday, 15 April 2019 11:14:11 AM AEST Rashmica Gupta wrote: > > > At the moment we only support multiples of 4 bytes. So if you > > > just > > > want to > > > set the device to read from it you need to do something like: > > > ./pdbg -P i2cm puti2c 0 0x50 10 3 0x000000 (the device addr > > > counts as a > > > byte) > > > > It seems odd that the restriction includes the device address, or > > is > > that > > referring to the SMBus command-code/register offset? Also I > > couldn't > > quite > > grok what all the numbers in the puti2c command might be, maybe I > > should go > > read the code. > > > > Ugh I guess you're right. The command should be > ./pdbg -P i2cm puti2c <port> <addr> <size> <data> > rather than what I have > ./pdbg -P i2cm puti2c <port> <addr> <offset> <size> <data> > and then the user needs to put the offset in the data field. > > And once I add the targeting for the port as you mentioned in your > other reply, then it will become > ./pdbg -P i2cm puti2c <addr> <size> <data> Wouldn't that be: $ ./pdbg -P i2c-port puti2c ... We want to write to a specific port rather than i2c master. > > Maybe I should add the smbus read command as well since I seem to > like > that so much :) > > > > The i2c reset function doesn't work as well as I would like... > > > Sometimes > > > if you try to read from devices that don't exist, you can no > > > longer > > > read > > > from devices that do exist - using the reset func in skiboot (by > > > doing > > > i2ctransfer from i2ctools on the host or a reboot) or resetting > > > the > > > lbus > > > (./pdbg -P fsi0 -D4 putcfam 0x80d 0x20000000) sometimes but not > > > always > > > fixes things. > > > > > > > > > Rashmica Gupta (3): > > > libpdbg: use i2ctools lib > > > libpdbg: Add i2c get and put functions for i2c master on CFAM > > > libpdbg: Add i2c get and put for i2c masters on the PIB > > > > > > Makefile.am | 7 + > > > configure.ac | 5 + > > > libpdbg/i2cm.c | 667 > > > ++++++++++++++++++++++++++++++++++++++++++++++ > > > libpdbg/libpdbg.h | 5 + > > > libpdbg/target.c | 24 ++ > > > libpdbg/target.h | 12 + > > > p9-fsi.dtsi.m4 | 7 + > > > p9-host.dts.m4 | 28 ++ > > > p9-i2c.dts.m4 | 21 ++ > > > p9-kernel.dts.m4 | 8 + > > > src/i2c.c | 82 ++++++ > > > src/main.c | 6 +- > > > src/parsers.c | 18 ++ > > > src/parsers.h | 2 + > > > 14 files changed, 890 insertions(+), 2 deletions(-) > > > create mode 100644 libpdbg/i2cm.c > > > create mode 100644 p9-i2c.dts.m4 > > > create mode 100644 src/i2c.c Amitay.
On Tue, 2019-04-16 at 12:29 +1000, Amitay Isaacs wrote: > On Tue, 2019-04-16 at 09:17 +1000, Rashmica Gupta wrote: > > On Mon, 2019-04-15 at 13:47 +1000, Alistair Popple wrote: > > > On Monday, 15 April 2019 11:14:11 AM AEST Rashmica Gupta wrote: > > > > At the moment we only support multiples of 4 bytes. So if you > > > > just > > > > want to > > > > set the device to read from it you need to do something like: > > > > ./pdbg -P i2cm puti2c 0 0x50 10 3 0x000000 (the device addr > > > > counts as a > > > > byte) > > > > > > It seems odd that the restriction includes the device address, or > > > is > > > that > > > referring to the SMBus command-code/register offset? Also I > > > couldn't > > > quite > > > grok what all the numbers in the puti2c command might be, maybe I > > > should go > > > read the code. > > > > > > > Ugh I guess you're right. The command should be > > ./pdbg -P i2cm puti2c <port> <addr> <size> <data> > > rather than what I have > > ./pdbg -P i2cm puti2c <port> <addr> <offset> <size> <data> > > and then the user needs to put the offset in the data field. > > > > And once I add the targeting for the port as you mentioned in your > > other reply, then it will become > > ./pdbg -P i2cm puti2c <addr> <size> <data> > > Wouldn't that be: > > $ ./pdbg -P i2c-port puti2c ... > > We want to write to a specific port rather than i2c master. > Yup you're right. > > > > Maybe I should add the smbus read command as well since I seem to > > like > > that so much :) > > > > > > The i2c reset function doesn't work as well as I would like... > > > > Sometimes > > > > if you try to read from devices that don't exist, you can no > > > > longer > > > > read > > > > from devices that do exist - using the reset func in skiboot > > > > (by > > > > doing > > > > i2ctransfer from i2ctools on the host or a reboot) or resetting > > > > the > > > > lbus > > > > (./pdbg -P fsi0 -D4 putcfam 0x80d 0x20000000) sometimes but not > > > > always > > > > fixes things. > > > > > > > > > > > > Rashmica Gupta (3): > > > > libpdbg: use i2ctools lib > > > > libpdbg: Add i2c get and put functions for i2c master on CFAM > > > > libpdbg: Add i2c get and put for i2c masters on the PIB > > > > > > > > Makefile.am | 7 + > > > > configure.ac | 5 + > > > > libpdbg/i2cm.c | 667 > > > > ++++++++++++++++++++++++++++++++++++++++++++++ > > > > libpdbg/libpdbg.h | 5 + > > > > libpdbg/target.c | 24 ++ > > > > libpdbg/target.h | 12 + > > > > p9-fsi.dtsi.m4 | 7 + > > > > p9-host.dts.m4 | 28 ++ > > > > p9-i2c.dts.m4 | 21 ++ > > > > p9-kernel.dts.m4 | 8 + > > > > src/i2c.c | 82 ++++++ > > > > src/main.c | 6 +- > > > > src/parsers.c | 18 ++ > > > > src/parsers.h | 2 + > > > > 14 files changed, 890 insertions(+), 2 deletions(-) > > > > create mode 100644 libpdbg/i2cm.c > > > > create mode 100644 p9-i2c.dts.m4 > > > > create mode 100644 src/i2c.c > > Amitay.