2020-12-12 16:42:51

by Kevin Paul Herbert

[permalink] [raw]
Subject: Re: [EXT] Re: [v10] i2c: imx: support slave mode for imx I2C driver

Thanks for the tip. I attempted to see if the register was implemented
on the i.mx6, and it doesn't appear to be. I'll reach out to my FAE. I
found the datasheet and the register definitely isn't documented
there.

I was thinking of a patch that would keep track of state, and
synthesize the I2C_SLAVE_STOP on the next interrupt if it was a new
transaction. Does this seem too hacky to you? What are your thoughts?

Thanks,
Kevin

Thanks,
Kevin


On Wed, Dec 9, 2020 at 6:16 PM Biwen Li <[email protected]> wrote:
>
> Hi Kevin,
>
>
>
> After enabling idle interrupts, the i2c register will generate an idle interrupts(whatever read or write) when i2c bus enter idle status. Then get I2C_SLAVE_STOP event.
>
> But don’t have the IBIC register(Maybe it’s a hidden register) in imx. You can query about the AE of imx about this.
>
> static void i2c_imx_enable_bus_idle(struct imx_i2c_struct *i2c_imx)
>
> {
>
> if (is_vf610_i2c(i2c_imx)) {
>
> unsigned int temp;
>
>
>
> temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_IBIC);
>
> temp |= IBIC_BIIE;
>
> imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_IBIC);
>
> }
>
> }
>
>
>
> Best Regards,
>
> Biwen Li
>
> From: Kevin Herbert <[email protected]>
> Sent: 2020年12月10日 1:18
> To: Wolfram Sang <[email protected]>; Kevin Herbert <[email protected]>; Biwen Li (OSS) <[email protected]>; Leo Li <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Aisheng Dong <[email protected]>; Clark Wang <[email protected]>; [email protected]; [email protected]; [email protected]; Jiafei Pan <[email protected]>; Xiaobo Xie <[email protected]>; [email protected]; Biwen Li <[email protected]>
> Subject: [EXT] Re: [v10] i2c: imx: support slave mode for imx I2C driver
>
>
>
> Caution: EXT Email
>
> Even on an operation like writing a byte, I get I2C_SLAVE_WRITE_REQUESTED followed by I2C_SLAVE_WRITE_RECEIVED, but no I2C_SLAVE_STOP. If I do a I2C write of multiple bytes, I get I2c_SLAVE_WRITE_REQUESTED followed by multiple I2C_SLAVE_WRITE_RECEIVED.
>
>
>
> Kevin
>
>
>
> On Wed, Dec 9, 2020 at 9:10 AM Wolfram Sang <[email protected]> wrote:
>
> On Wed, Dec 09, 2020 at 09:03:50AM -0800, Kevin Herbert wrote:
> > What is the protocol for the I2C_SLAVE_STOP event? I am working on my own
> > backend, and I've only tried it with this i.mx driver, and I do not receive
> > I2C_SLAVE_STOP at the end of every I2C transaction. It was my expectation
> > I'd receive this event at the end of every frame. In my testing, I've never
> > received this event at all.
> >
> > Where are the I2C registers on the i.mx documented? My board is an i.mx6sx.
>
> Hmm, from a glimpse, it looks the STOP event is only sent after a write
> and not after a read? Does this match your findings?


2020-12-13 14:32:33

by Oleksij Rempel

[permalink] [raw]
Subject: Re: [v10] i2c: imx: support slave mode for imx I2C driver

On Fri, Dec 11, 2020 at 09:57:19AM -0800, Kevin Herbert wrote:
> Thanks for the tip. I attempted to see if the register was implemented
> on the i.mx6, and it doesn't appear to be. I'll reach out to my FAE. I
> found the datasheet and the register definitely isn't documented
> there.
>
> I was thinking of a patch that would keep track of state, and
> synthesize the I2C_SLAVE_STOP on the next interrupt if it was a new
> transaction. Does this seem too hacky to you? What are your thoughts?

I would say, send patches :)
Please provide in to the commit message enough description to understand and
reproduce your issue.

>
> On Wed, Dec 9, 2020 at 6:16 PM Biwen Li <[email protected]> wrote:
> >
> > Hi Kevin,
> >
> >
> >
> > After enabling idle interrupts, the i2c register will generate an idle interrupts(whatever read or write) when i2c bus enter idle status. Then get I2C_SLAVE_STOP event.
> >
> > But don’t have the IBIC register(Maybe it’s a hidden register) in imx. You can query about the AE of imx about this.
> >
> > static void i2c_imx_enable_bus_idle(struct imx_i2c_struct *i2c_imx)
> >
> > {
> >
> > if (is_vf610_i2c(i2c_imx)) {
> >
> > unsigned int temp;
> >
> >
> >
> > temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_IBIC);
> >
> > temp |= IBIC_BIIE;
> >
> > imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_IBIC);
> >
> > }
> >
> > }
> >
> >
> >
> > Best Regards,
> >
> > Biwen Li
> >
> > From: Kevin Herbert <[email protected]>
> > Sent: 2020年12月10日 1:18
> > To: Wolfram Sang <[email protected]>; Kevin Herbert <[email protected]>; Biwen Li (OSS) <[email protected]>; Leo Li <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Aisheng Dong <[email protected]>; Clark Wang <[email protected]>; [email protected]; [email protected]; [email protected]; Jiafei Pan <[email protected]>; Xiaobo Xie <[email protected]>; [email protected]; Biwen Li <[email protected]>
> > Subject: [EXT] Re: [v10] i2c: imx: support slave mode for imx I2C driver
> >
> >
> >
> > Caution: EXT Email
> >
> > Even on an operation like writing a byte, I get I2C_SLAVE_WRITE_REQUESTED followed by I2C_SLAVE_WRITE_RECEIVED, but no I2C_SLAVE_STOP. If I do a I2C write of multiple bytes, I get I2c_SLAVE_WRITE_REQUESTED followed by multiple I2C_SLAVE_WRITE_RECEIVED.
> >
> >
> >
> > Kevin
> >
> >
> >
> > On Wed, Dec 9, 2020 at 9:10 AM Wolfram Sang <[email protected]> wrote:
> >
> > On Wed, Dec 09, 2020 at 09:03:50AM -0800, Kevin Herbert wrote:
> > > What is the protocol for the I2C_SLAVE_STOP event? I am working on my own
> > > backend, and I've only tried it with this i.mx driver, and I do not receive
> > > I2C_SLAVE_STOP at the end of every I2C transaction. It was my expectation
> > > I'd receive this event at the end of every frame. In my testing, I've never
> > > received this event at all.
> > >
> > > Where are the I2C registers on the i.mx documented? My board is an i.mx6sx.
> >
> > Hmm, from a glimpse, it looks the STOP event is only sent after a write
> > and not after a read? Does this match your findings?
>
>

--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |