RE: [v8] i2c: imx: support slave mode for imx I2C driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > > +/*
> > > + * Enable bus idle interrupts
> > > + * Note: IBIC register will be cleared after disabled i2c module.
> > > + */
> > > +static void i2c_imx_enable_bus_idle(struct imx_i2c_struct *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); }
> > > +
> > > +static void i2c_imx_clr_if_bit(unsigned int status, struct
> > > +imx_i2c_struct *i2c_imx) {
> > > +	status &= ~I2SR_IIF;
> > > +	status |= (i2c_imx->hwdata->i2sr_clr_opcode & I2SR_IIF);
> > > +	imx_i2c_write_reg(status, i2c_imx, IMX_I2C_I2SR); }
> > > +
> > > +/* Clear arbitration lost bit */
> > > +static void i2c_imx_clr_al_bit(unsigned int status, struct
> > > +imx_i2c_struct *i2c_imx) {
> > > +	status &= ~I2SR_IAL;
> > > +	status |= (i2c_imx->hwdata->i2sr_clr_opcode & I2SR_IAL);
> > > +	imx_i2c_write_reg(status, i2c_imx, IMX_I2C_I2SR); }
> > > +
> > > +#if IS_ENABLED(CONFIG_I2C_SLAVE)
> >
> > Last year (to be more precise Date: Fri, 6 Dec 2019 08:38:20 +0100),
> > Sascha asked you to make I2C_SLAVE support not optional.
> > In the V7 of this patch you even tried to do so...
> > Please, patch drivers/i2c/busses/Kconfig and add "select I2C_SLAVE" to
> > the I2C_IMX node.
> Sure, np. Will add it in v4.
Correct it, it's v9. 
> >
> > > +static irqreturn_t i2c_imx_slave_isr(struct imx_i2c_struct *i2c_imx,
> > > +				     unsigned int status, unsigned int ctl) {
> > > +	u8 value;
> > > +
> > > +	if (status & I2SR_IAL) { /* Arbitration lost */
> > > +		i2c_imx_clr_al_bit(status | I2SR_IIF, i2c_imx);
> > > +	} else if (status & I2SR_IAAS) { /* Addressed as a slave */
> > > +		if (status & I2SR_SRW) { /* Master wants to read from us*/
> > > +			dev_dbg(&i2c_imx->adapter.dev, "read requested");
> > > +			i2c_slave_event(i2c_imx->slave, I2C_SLAVE_READ_REQUESTED,
> > &value);
> > > +





[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux