lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <12878F9DA586AA19+aQv0bKwLTzw_kJOq@kernel.org>
Date: Thu, 6 Nov 2025 09:05:48 +0800
From: Troy Mitchell <troy.mitchell@...ux.spacemit.com>
To: Troy Mitchell <troy.mitchell@...ux.spacemit.com>,
	Andi Shyti <andi.shyti@...nel.org>, Yixun Lan <dlan@...too.org>,
	Alex Elder <elder@...cstar.com>,
	Michael Opdenacker <michael.opdenacker@...tcommit.com>,
	Troy Mitchell <troymitchell988@...il.com>,
	linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-riscv@...ts.infradead.org, spacemit@...ts.linux.dev
Subject: Re: [PATCH] i2c: spacemit: fix detect issue

On Wed, Nov 05, 2025 at 11:44:00PM +0100, Aurelien Jarno wrote:
> Hi,
> 
> On 2025-11-03 15:06, Troy Mitchell wrote:
[...]
> >  	if (i2c->status & (SPACEMIT_SR_BED | SPACEMIT_SR_ALD)) {
> >  		spacemit_i2c_reset(i2c);
> > -		return -EAGAIN;
> > +		if (i2c->status & SPACEMIT_SR_ALD)
> > +			return -EAGAIN;
> >  	}
> 
> This makes the resulting code, while correct, complex to understand as 
> it is now two really different errors, as you explained well in the 
> commit message.
> 
> I therefore suggest to organize the code as:
> 
> 	/* Arbitration Loss Detected */
> 	if (i2c->status & SPACEMIT_SR_ALD) {
> 		spacemit_i2c_reset(i2c);
> 		return -EAGAIN;
> 	}
> 
> 	/* Bus Error No ACK/NAK */
> 	if (i2c->status & SPACEMIT_SR_BED) {
> 		spacemit_i2c_reset(i2c);
> 	}
Thanks. I'll fix it in the next version.
> 
> 
> >  	return i2c->status & SPACEMIT_SR_ACKNAK ? -ENXIO : -EIO;
> > @@ -491,6 +492,8 @@ static int spacemit_i2c_xfer(struct i2c_adapter *adapt, struct i2c_msg *msgs, in
> >  
> >  	spacemit_i2c_init(i2c);
> >  
> > +	spacemit_i2c_clear_int_status(i2c, SPACEMIT_I2C_INT_STATUS_MASK);
> > +
> 
> This sounds good to start the transfer with a clean interrupt state. I 
> just wonder if it should be moved to spacemit_i2c_init(), ie where the 
> corresponding interrupts are enabled.
Uh, We can move it actually. But is it essentail?
> 
> >  	spacemit_i2c_enable(i2c);
> >  
> >  	ret = spacemit_i2c_wait_bus_idle(i2c);
> 
> Anyway:
> 
> Tested-by: Aurelien Jarno <aurelien@...el32.net>
Thanks!

                          - Troy
> 
> 
> Regards
> Aurelien
> 
> -- 
> Aurelien Jarno                          GPG: 4096R/1DDD8C9B
> aurelien@...el32.net                     http://aurel32.net
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ