RE: [PATCH v12 2/2] i2c: aspeed: support ast2600 i2c new register mode driver

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

 



Hello,
> 
> On 14/07/2023 09:45, Ryan Chen wrote:
>> Add i2c new register mode driver to support AST2600 i2c new register 
>> mode. AST2600 i2c controller have legacy and new register mode. The 
>> new register mode have global register support 4 base clock for scl 
>> clock selection, and new clock divider mode. The i2c new register 
>> mode have separate register set to control i2c master and slave.
>>
>> Signed-off-by: Ryan Chen <ryan_chen@xxxxxxxxxxxxxx>
>> ---
> 
> ...
> 
>> +	ret = devm_i2c_add_adapter(dev, &i2c_bus->adap);
>> +	if (ret)
>> +		return ret;
>> +
>> +	return 0;
>> +}
>> +
>> +static int ast2600_i2c_remove(struct platform_device *pdev) {
>> +	struct ast2600_i2c_bus *i2c_bus = platform_get_drvdata(pdev);
>> +
>> +	/* Disable everything. */
>> +	writel(0, i2c_bus->reg_base + AST2600_I2CC_FUN_CTRL);
>> +	writel(0, i2c_bus->reg_base + AST2600_I2CM_IER);
>> +
>> +	i2c_del_adapter(&i2c_bus->adap);
> 
>> I have doubts that you tested this. I think you have here double free/del of the adapter.
> Sorry, i can't catch your point for double free the adapter.
> It should use i2c_del_adapter in driver remove function.
> All the driver doing this
> https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-n
> pcm7xx.c#L2373
> https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-a
> ltera.c#L473
> 
> Do you mean it is not necessary? 

>Instead of giving you the fish, I think much more learning experience is to teach you how to fish. Please unbind your driver (echo the device name to proper unbind file in sysfs). The best if you build your kernel with KASAN.

>Thanks, will do this test with unbind to understand your point. 
I do my the test with enable kernel config KASAN.
I don't see any error dump. You can see the following. It use i2c-0 bind/unbind.
Did I miss some test ??

root@ast2600-default:/sys/bus/platform/drivers/i2c_ast2600# i2cdetect -l
i2c-0   i2c             1e78a080.i2c-bus                        I2C adapter
i2c-1   i2c             1e78a100.i2c-bus                        I2C adapter
i2c-2   i2c             1e78a180.i2c-bus                        I2C adapter
i2c-3   i2c             1e78a200.i2c-bus                        I2C adapter
i2c-4   i2c             1e78a280.i2c-bus                        I2C adapter
i2c-5   i2c             1e78a300.i2c-bus                        I2C adapter
i2c-6   i2c             1e78a380.i2c-bus                        I2C adapter
i2c-7   i2c             1e78a400.i2c-bus                        I2C adapter
i2c-8   i2c             1e78a480.i2c-bus                        I2C adapter
i2c-9   i2c             1e78a500.i2c-bus                        I2C adapter
i2c-12  i2c             1e78a680.i2c-bus                        I2C adapter
i2c-13  i2c             1e78a700.i2c-bus                        I2C adapter
i2c-14  i2c             1e78a780.i2c-bus                        I2C adapter
i2c-15  i2c             1e78a800.i2c-bus                        I2C adapter
root@ast2600-default:/sys/bus/platform/drivers/i2c_ast2600# echo 1e78a080.i2c-bus > unbind
root@ast2600-default:/sys/bus/platform/drivers/i2c_ast2600# i2cdetect -l
i2c-1   i2c             1e78a100.i2c-bus                        I2C adapter
i2c-2   i2c             1e78a180.i2c-bus                        I2C adapter
i2c-3   i2c             1e78a200.i2c-bus                        I2C adapter
i2c-4   i2c             1e78a280.i2c-bus                        I2C adapter
i2c-5   i2c             1e78a300.i2c-bus                        I2C adapter
i2c-6   i2c             1e78a380.i2c-bus                        I2C adapter
i2c-7   i2c             1e78a400.i2c-bus                        I2C adapter
i2c-8   i2c             1e78a480.i2c-bus                        I2C adapter
i2c-9   i2c             1e78a500.i2c-bus                        I2C adapter
i2c-12  i2c             1e78a680.i2c-bus                        I2C adapter
i2c-13  i2c             1e78a700.i2c-bus                        I2C adapter
i2c-14  i2c             1e78a780.i2c-bus                        I2C adapter
i2c-15  i2c             1e78a800.i2c-bus                        I2C adapter
root@ast2600-default:/sys/bus/platform/drivers/i2c_ast2600# echo 1e78a080.i2c-bus > bind
[  388.177413] i2c_ast2600 1e78a080.i2c-bus: i2c-bus [0]: adapter [100 khz] mode [0]
root@ast2600-default:/sys/bus/platform/drivers/i2c_ast2600# i2cdetect -l
i2c-0   i2c             1e78a080.i2c-bus                        I2C adapter
i2c-1   i2c             1e78a100.i2c-bus                        I2C adapter
i2c-2   i2c             1e78a180.i2c-bus                        I2C adapter
i2c-3   i2c             1e78a200.i2c-bus                        I2C adapter
i2c-4   i2c             1e78a280.i2c-bus                        I2C adapter
i2c-5   i2c             1e78a300.i2c-bus                        I2C adapter
i2c-6   i2c             1e78a380.i2c-bus                        I2C adapter
i2c-7   i2c             1e78a400.i2c-bus                        I2C adapter
i2c-8   i2c             1e78a480.i2c-bus                        I2C adapter
i2c-9   i2c             1e78a500.i2c-bus                        I2C adapter
i2c-12  i2c             1e78a680.i2c-bus                        I2C adapter
i2c-13  i2c             1e78a700.i2c-bus                        I2C adapter
i2c-14  i2c             1e78a780.i2c-bus                        I2C adapter
i2c-15  i2c             1e78a800.i2c-bus                        I2C adapter




[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