diff mbox series

[11/21] test/avocado/machine_aspeed.py: Add an I2C RTC test

Message ID 20220606150732.2282041-12-clg@kaod.org (mailing list archive)
State New, archived
Headers show
Series aspeed: Extend ast2600 I2C model with new mode | expand

Commit Message

Cédric Le Goater June 6, 2022, 3:07 p.m. UTC
Add a RTC device on bus 15 and check that the ouput of the hwclock
command matches the current year.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 tests/avocado/machine_aspeed.py | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Joel Stanley June 6, 2022, 11:16 p.m. UTC | #1
On Mon, 6 Jun 2022 at 15:08, Cédric Le Goater <clg@kaod.org> wrote:
>
> Add a RTC device on bus 15 and check that the ouput of the hwclock

spelling: output

> command matches the current year.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Reviewed-by: Joel Stanley <joel@jms.id.au>

> ---
>  tests/avocado/machine_aspeed.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed.py
> index a3b4b9e5093c..28b8a4c8124b 100644
> --- a/tests/avocado/machine_aspeed.py
> +++ b/tests/avocado/machine_aspeed.py
> @@ -136,10 +136,18 @@ def test_arm_ast2600_evb_builroot(self):
>
>          self.vm.add_args('-device',
>                           'tmp423,bus=aspeed.i2c.bus.15,address=0x4c');
> +        self.vm.add_args('-device',
> +                         'ds1338,bus=aspeed.i2c.bus.15,address=0x32');

Is there any value running this on the 2400 and 2500 machine types
too? They all use the same model so perhaps not?

>          self.do_test_arm_aspeed_buidroot_start(image_path, '0xf00')
>          exec_command_and_wait_for_pattern(self,
>                                            'i2cget -y 15 0x4c 0xff', '0x23');
>          exec_command_and_wait_for_pattern(self,
>                                            'i2cget -y 15 0x4c 0xfe', '0x55');
>
> +        exec_command_and_wait_for_pattern(self,
> +             'echo ds1307 0x32 > /sys/class/i2c-dev/i2c-15/device/new_device',
> +             'i2c i2c-15: new_device: Instantiated device ds1307 at 0x32');
> +        year = time.strftime("%Y")
> +        exec_command_and_wait_for_pattern(self, 'hwclock -f /dev/rtc1', year);
> +
>          self.do_test_arm_aspeed_buidroot_poweroff()
> --
> 2.35.3
>
Cédric Le Goater June 7, 2022, 10:17 a.m. UTC | #2
On 6/7/22 01:16, Joel Stanley wrote:
> On Mon, 6 Jun 2022 at 15:08, Cédric Le Goater <clg@kaod.org> wrote:
>>
>> Add a RTC device on bus 15 and check that the ouput of the hwclock
> 
> spelling: output
> 
>> command matches the current year.
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> 
> Reviewed-by: Joel Stanley <joel@jms.id.au>
> 
>> ---
>>   tests/avocado/machine_aspeed.py | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed.py
>> index a3b4b9e5093c..28b8a4c8124b 100644
>> --- a/tests/avocado/machine_aspeed.py
>> +++ b/tests/avocado/machine_aspeed.py
>> @@ -136,10 +136,18 @@ def test_arm_ast2600_evb_builroot(self):
>>
>>           self.vm.add_args('-device',
>>                            'tmp423,bus=aspeed.i2c.bus.15,address=0x4c');
>> +        self.vm.add_args('-device',
>> +                         'ds1338,bus=aspeed.i2c.bus.15,address=0x32');
> 
> Is there any value running this on the 2400 and 2500 machine types
> too?

We could do that, yes. Send patches !

> They all use the same model so perhaps not?

Currently, all models are exercised more or less in the same way by
the upstream Linux driver. Things are different for the AST1030 using
Zephir and for the AST2600 when using newer drivers from the SDK.

These images seem to be using the new AST2600 register mode:

   https://github.com/AspeedTech-BMC/openbmc/releases/

   root@ast2600-default:~# dmesg | grep i2c
   [    0.211289] i2c global registered
   [    1.442027] i2c_dev: i2c /dev entries driver
   [    1.447944] i2c_new_aspeed 1e78a280.i2c-bus: NEW-I2C: i2c-bus [4]: adapter [100 khz] mode [2]
   [    1.451158] ipmb-dev 5-0010: i2c_slave_register: client slave flag not set. You might see address collisions
   [    1.451660] i2c_new_aspeed 1e78a300.i2c-bus: NEW-I2C: i2c-bus [5]: adapter [100 khz] mode [2]
   [    1.454567] ipmb-dev 6-0012: i2c_slave_register: client slave flag not set. You might see address collisions
   [    1.454938] i2c_new_aspeed 1e78a380.i2c-bus: NEW-I2C: i2c-bus [6]: adapter [100 khz] mode [2]
   [    1.462953] i2c_new_aspeed 1e78a400.i2c-bus: NEW-I2C: i2c-bus [7]: adapter [95 khz] mode [2]
   [    1.466394] i2c_new_aspeed 1e78a480.i2c-bus: NEW-I2C: i2c-bus [8]: adapter [100 khz] mode [2]
   [    1.468394] i2c_new_aspeed 1e78a500.i2c-bus: NEW-I2C: i2c-bus [9]: adapter [100 khz] mode [2]

It could be an additional avocado test.


C.


>>           self.do_test_arm_aspeed_buidroot_start(image_path, '0xf00')
>>           exec_command_and_wait_for_pattern(self,
>>                                             'i2cget -y 15 0x4c 0xff', '0x23');
>>           exec_command_and_wait_for_pattern(self,
>>                                             'i2cget -y 15 0x4c 0xfe', '0x55');
>>
>> +        exec_command_and_wait_for_pattern(self,
>> +             'echo ds1307 0x32 > /sys/class/i2c-dev/i2c-15/device/new_device',
>> +             'i2c i2c-15: new_device: Instantiated device ds1307 at 0x32');
>> +        year = time.strftime("%Y")
>> +        exec_command_and_wait_for_pattern(self, 'hwclock -f /dev/rtc1', year);
>> +
>>           self.do_test_arm_aspeed_buidroot_poweroff()
>> --
>> 2.35.3
>>
diff mbox series

Patch

diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed.py
index a3b4b9e5093c..28b8a4c8124b 100644
--- a/tests/avocado/machine_aspeed.py
+++ b/tests/avocado/machine_aspeed.py
@@ -136,10 +136,18 @@  def test_arm_ast2600_evb_builroot(self):
 
         self.vm.add_args('-device',
                          'tmp423,bus=aspeed.i2c.bus.15,address=0x4c');
+        self.vm.add_args('-device',
+                         'ds1338,bus=aspeed.i2c.bus.15,address=0x32');
         self.do_test_arm_aspeed_buidroot_start(image_path, '0xf00')
         exec_command_and_wait_for_pattern(self,
                                           'i2cget -y 15 0x4c 0xff', '0x23');
         exec_command_and_wait_for_pattern(self,
                                           'i2cget -y 15 0x4c 0xfe', '0x55');
 
+        exec_command_and_wait_for_pattern(self,
+             'echo ds1307 0x32 > /sys/class/i2c-dev/i2c-15/device/new_device',
+             'i2c i2c-15: new_device: Instantiated device ds1307 at 0x32');
+        year = time.strftime("%Y")
+        exec_command_and_wait_for_pattern(self, 'hwclock -f /dev/rtc1', year);
+
         self.do_test_arm_aspeed_buidroot_poweroff()