Two driver bugfixes and a typo fix

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmLa9I4ACgkQFA3kzBSg
 KbYb6w/8CKvJ8R5hl7YNBIJSwRkaL/UrpcjgJ3fn/z7jEQDcjx/PdJczMMgNbUMY
 DNiwyQ3cOsivm/nWEkjDe42hoNY0uwZTBUg77ESLvgCrRS+2283TziNxzgW2Dzq7
 4LMqtfPdNEbhQUAEx4HchSILzMhfeS0yxMNjK+Crci+yUKgZ0sVY0L5huvsJMGOA
 p3TJE9KGEQP2TtDVP8nNzj53DaDQ1VIs4N3MZ7oeewN7m5Ka11zJsn4bG5f48pJ+
 cKambWxdpysaYb4WVIRv5/Q4Ubq1Aqk5tyPJHAYlNk08SQjxmEln+juM3uop1L9F
 /bGQMySvAkPN9lav/cy8X74l3snqjbxS+h3ZwAys8K0KiuVYP1oUcYf/vSKqHjbi
 lN7mbuHwltp5mxcL4hir1WdATxhhAOhl5j7IKH/d3G8oAOSzneZ0uoilA8UWSaaf
 LTqzXppb5pRl2w2gFAIB0mQ29Qx4YfIY7ZEkdbM5ukO5R5Sq97muW4vLzeAAh1vw
 lIcL7yb1OvVAPzrHbLBRzCTalsKcg3lsvY/l+H9ICycyNWnenX3Y8kGZaoC8EFz5
 eebre8vZ9rEQNPPYm/SXlAhw9cDwijgdXFKgrjnyRKV+cDBBz6e8lWpe8x4U+GsQ
 3KgFaHvoZfu/2WunKjD7BflEv8RXXFhd8qkQcv1geWISsQQ4J1k=
 =C/cu
 -----END PGP SIGNATURE-----

Merge tag 'i2c-for-5.19-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Two driver bugfixes and a typo fix"

* tag 'i2c-for-5.19-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: cadence: Change large transfer count reset logic to be unconditional
  i2c: imx: fix typo in comment
  i2c: mlxcpld: Fix register setting for 400KHz frequency
This commit is contained in:
Linus Torvalds 2022-07-22 12:36:59 -07:00
commit 4a1dcf77f4
3 changed files with 7 additions and 27 deletions

View File

@ -388,9 +388,9 @@ static irqreturn_t cdns_i2c_slave_isr(void *ptr)
*/
static irqreturn_t cdns_i2c_master_isr(void *ptr)
{
unsigned int isr_status, avail_bytes, updatetx;
unsigned int isr_status, avail_bytes;
unsigned int bytes_to_send;
bool hold_quirk;
bool updatetx;
struct cdns_i2c *id = ptr;
/* Signal completion only after everything is updated */
int done_flag = 0;
@ -410,11 +410,7 @@ static irqreturn_t cdns_i2c_master_isr(void *ptr)
* Check if transfer size register needs to be updated again for a
* large data receive operation.
*/
updatetx = 0;
if (id->recv_count > id->curr_recv_count)
updatetx = 1;
hold_quirk = (id->quirks & CDNS_I2C_BROKEN_HOLD_BIT) && updatetx;
updatetx = id->recv_count > id->curr_recv_count;
/* When receiving, handle data interrupt and completion interrupt */
if (id->p_recv_buf &&
@ -445,7 +441,7 @@ static irqreturn_t cdns_i2c_master_isr(void *ptr)
break;
}
if (cdns_is_holdquirk(id, hold_quirk))
if (cdns_is_holdquirk(id, updatetx))
break;
}
@ -456,7 +452,7 @@ static irqreturn_t cdns_i2c_master_isr(void *ptr)
* maintain transfer size non-zero while performing a large
* receive operation.
*/
if (cdns_is_holdquirk(id, hold_quirk)) {
if (cdns_is_holdquirk(id, updatetx)) {
/* wait while fifo is full */
while (cdns_i2c_readreg(CDNS_I2C_XFER_SIZE_OFFSET) !=
(id->curr_recv_count - CDNS_I2C_FIFO_DEPTH))
@ -478,22 +474,6 @@ static irqreturn_t cdns_i2c_master_isr(void *ptr)
CDNS_I2C_XFER_SIZE_OFFSET);
id->curr_recv_count = id->recv_count;
}
} else if (id->recv_count && !hold_quirk &&
!id->curr_recv_count) {
/* Set the slave address in address register*/
cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK,
CDNS_I2C_ADDR_OFFSET);
if (id->recv_count > CDNS_I2C_TRANSFER_SIZE) {
cdns_i2c_writereg(CDNS_I2C_TRANSFER_SIZE,
CDNS_I2C_XFER_SIZE_OFFSET);
id->curr_recv_count = CDNS_I2C_TRANSFER_SIZE;
} else {
cdns_i2c_writereg(id->recv_count,
CDNS_I2C_XFER_SIZE_OFFSET);
id->curr_recv_count = id->recv_count;
}
}
/* Clear hold (if not repeated start) and signal completion */

View File

@ -66,7 +66,7 @@
/* IMX I2C registers:
* the I2C register offset is different between SoCs,
* to provid support for all these chips, split the
* to provide support for all these chips, split the
* register offset into a fixed base address and a
* variable shift value, then the full register offset
* will be calculated by

View File

@ -49,7 +49,7 @@
#define MLXCPLD_LPCI2C_NACK_IND 2
#define MLXCPLD_I2C_FREQ_1000KHZ_SET 0x04
#define MLXCPLD_I2C_FREQ_400KHZ_SET 0x0c
#define MLXCPLD_I2C_FREQ_400KHZ_SET 0x0e
#define MLXCPLD_I2C_FREQ_100KHZ_SET 0x42
enum mlxcpld_i2c_frequency {