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: <HK0PR06MB3380CCA6A264A6D0E6E462FDF2299@HK0PR06MB3380.apcprd06.prod.outlook.com>
Date:   Fri, 21 May 2021 06:09:57 +0000
From:   Ryan Chen <ryan_chen@...eedtech.com>
To:     Quan Nguyen <quan@...amperecomputing.com>,
        Corey Minyard <minyard@....org>,
        Rob Herring <robh+dt@...nel.org>,
        Joel Stanley <joel@....id.au>,
        Andrew Jeffery <andrew@...id.au>,
        Brendan Higgins <brendanhiggins@...gle.com>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Wolfram Sang <wsa@...nel.org>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        "openipmi-developer@...ts.sourceforge.net" 
        <openipmi-developer@...ts.sourceforge.net>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-aspeed@...ts.ozlabs.org" <linux-aspeed@...ts.ozlabs.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>
CC:     Open Source Submission <patches@...erecomputing.com>,
        "Thang Q . Nguyen" <thang@...amperecomputing.com>,
        Phong Vo <phong@...amperecomputing.com>,
        "openbmc@...ts.ozlabs.org" <openbmc@...ts.ozlabs.org>
Subject: RE: [PATCH v3 5/7] i2c: aspeed: Add aspeed_set_slave_busy()

> -----Original Message-----
> From: Quan Nguyen <quan@...amperecomputing.com>
> Sent: Thursday, May 20, 2021 10:10 PM
> To: Ryan Chen <ryan_chen@...eedtech.com>; Corey Minyard
> <minyard@....org>; Rob Herring <robh+dt@...nel.org>; Joel Stanley
> <joel@....id.au>; Andrew Jeffery <andrew@...id.au>; Brendan Higgins
> <brendanhiggins@...gle.com>; Benjamin Herrenschmidt
> <benh@...nel.crashing.org>; Wolfram Sang <wsa@...nel.org>; Philipp Zabel
> <p.zabel@...gutronix.de>; openipmi-developer@...ts.sourceforge.net;
> devicetree@...r.kernel.org; linux-arm-kernel@...ts.infradead.org;
> linux-aspeed@...ts.ozlabs.org; linux-kernel@...r.kernel.org;
> linux-i2c@...r.kernel.org
> Cc: Open Source Submission <patches@...erecomputing.com>; Thang Q .
> Nguyen <thang@...amperecomputing.com>; Phong Vo
> <phong@...amperecomputing.com>; openbmc@...ts.ozlabs.org
> Subject: Re: [PATCH v3 5/7] i2c: aspeed: Add aspeed_set_slave_busy()
> 
> On 20/05/2021 18:06, Ryan Chen wrote:
> >> -----Original Message-----
> >> From: openbmc
> >> <openbmc-bounces+ryan_chen=aspeedtech.com@...ts.ozlabs.org> On
> Behalf
> >> Of Quan Nguyen
> >> Sent: Wednesday, May 19, 2021 3:50 PM
> >> To: Corey Minyard <minyard@....org>; Rob Herring
> >> <robh+dt@...nel.org>; Joel Stanley <joel@....id.au>; Andrew Jeffery
> >> <andrew@...id.au>; Brendan Higgins <brendanhiggins@...gle.com>;
> >> Benjamin Herrenschmidt <benh@...nel.crashing.org>; Wolfram Sang
> >> <wsa@...nel.org>; Philipp Zabel <p.zabel@...gutronix.de>;
> >> openipmi-developer@...ts.sourceforge.net;
> >> devicetree@...r.kernel.org; linux-arm-kernel@...ts.infradead.org;
> >> linux-aspeed@...ts.ozlabs.org; linux-kernel@...r.kernel.org;
> >> linux-i2c@...r.kernel.org
> >> Cc: Open Source Submission <patches@...erecomputing.com>; Thang Q .
> >> Nguyen <thang@...amperecomputing.com>; Phong Vo
> >> <phong@...amperecomputing.com>; openbmc@...ts.ozlabs.org
> >> Subject: [PATCH v3 5/7] i2c: aspeed: Add aspeed_set_slave_busy()
> >>
> >> Slave i2c device on AST2500 received a lot of slave irq while it is
> >> busy processing the response. To handle this case, adds and exports
> >> aspeed_set_slave_busy() for controller to temporary stop slave irq
> >> while slave is handling the response, and re-enable them again when the
> response is ready.
> >>
> >> Signed-off-by: Quan Nguyen <quan@...amperecomputing.com>
> >> ---
> >> v3:
> >>    + First introduce in v3 [Quan]
> >>
> >>   drivers/i2c/busses/i2c-aspeed.c | 20 ++++++++++++++++++++
> >>   1 file changed, 20 insertions(+)
> >>
> >> diff --git a/drivers/i2c/busses/i2c-aspeed.c
> >> b/drivers/i2c/busses/i2c-aspeed.c index b2e9c8f0ddf7..9926d04831a2
> >> 100644
> >> --- a/drivers/i2c/busses/i2c-aspeed.c
> >> +++ b/drivers/i2c/busses/i2c-aspeed.c
> >> @@ -944,6 +944,26 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus
> >> *bus,
> >>   	return 0;
> >>   }
> >>
> >> +#if IS_ENABLED(CONFIG_I2C_SLAVE)
> >> +void aspeed_set_slave_busy(struct i2c_adapter *adap, bool busy) {
> >> +	struct aspeed_i2c_bus *bus = i2c_get_adapdata(adap);
> >> +	unsigned long current_mask, flags;
> >> +
> >> +	spin_lock_irqsave(&bus->lock, flags);
> >> +
> >> +	current_mask = readl(bus->base + ASPEED_I2C_INTR_CTRL_REG);
> >> +	if (busy)
> >> +		current_mask &= ~(ASPEED_I2CD_INTR_RX_DONE |
> >> ASPEED_I2CD_INTR_SLAVE_MATCH);
> >> +	else
> >> +		current_mask |= ASPEED_I2CD_INTR_RX_DONE |
> >> ASPEED_I2CD_INTR_SLAVE_MATCH;
> >> +	writel(current_mask, bus->base + ASPEED_I2C_INTR_CTRL_REG);
> >> +
> >> +	spin_unlock_irqrestore(&bus->lock, flags); }
> >> +EXPORT_SYMBOL_GPL(aspeed_set_slave_busy);
> >> +#endif
> >> +
> >>   static int aspeed_i2c_reset(struct aspeed_i2c_bus *bus)  {
> >>   	struct platform_device *pdev = to_platform_device(bus->dev);
> >> --
> >> 2.28.0
> >
> > Hello,
> > 	The better idea is use disable i2c slave mode.
> > 	Due to if i2c controller running in slave will get slave match, and latch the
> SCL.
> > 	Until cpu clear interrupt status.
> > Ryan
> >
> Thanks Ryan,
> 
> Do you mean to enable/disable slave function as per example code below ?
Yes. it is.
> 
>          /* Turn on slave mode. */
>          func_ctrl_reg_val = readl(bus->base +
> ASPEED_I2C_FUN_CTRL_REG);
>          func_ctrl_reg_val |= ASPEED_I2CD_SLAVE_EN;
>          writel(func_ctrl_reg_val, bus->base +
> ASPEED_I2C_FUN_CTRL_REG);
> 
> Will try this idea.
> - Quan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ