From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNunf-0002OU-SI for qemu-devel@nongnu.org; Wed, 30 May 2018 02:41:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNunb-0001A9-Tc for qemu-devel@nongnu.org; Wed, 30 May 2018 02:41:35 -0400 Received: from 16.mo4.mail-out.ovh.net ([188.165.55.104]:45189) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fNunb-00019j-NE for qemu-devel@nongnu.org; Wed, 30 May 2018 02:41:31 -0400 Received: from player159.ha.ovh.net (unknown [10.109.122.99]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 0181717A969 for ; Wed, 30 May 2018 08:41:29 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Wed, 30 May 2018 08:40:45 +0200 Message-Id: <20180530064049.27976-4-clg@kaod.org> In-Reply-To: <20180530064049.27976-1-clg@kaod.org> References: <20180530064049.27976-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v7 3/7] aspeed: add an I2C RTC device to all machines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, Joel Stanley , Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= The AST2500 EVB does not have an RTC but we can pretend that one is plugged on the I2C bus header. The romulus and witherspoon boards expects an Epson RX8900 I2C RTC but a ds1338 is good enough for the basic features we need. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Andrew Jeffery --- hw/arm/aspeed.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 96790af0cf50..8efa783722c5 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -89,6 +89,7 @@ enum { =20 static void palmetto_bmc_i2c_init(AspeedBoardState *bmc); static void ast2500_evb_i2c_init(AspeedBoardState *bmc); +static void romulus_bmc_i2c_init(AspeedBoardState *bmc); static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc); =20 static const AspeedBoardConfig aspeed_boards[] =3D { @@ -114,6 +115,7 @@ static const AspeedBoardConfig aspeed_boards[] =3D { .fmc_model =3D "n25q256a", .spi_model =3D "mx66l1g45g", .num_cs =3D 2, + .i2c_init =3D romulus_bmc_i2c_init, }, [WITHERSPOON_BMC] =3D { .soc_name =3D "ast2500-a1", @@ -306,6 +308,10 @@ static void ast2500_evb_i2c_init(AspeedBoardState *b= mc) =20 /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "tmp105",= 0x4d); + + /* The AST2500 EVB does not have an RTC. Let's pretend that one is + * plugged on the I2C bus header */ + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338"= , 0x32); } =20 static void ast2500_evb_init(MachineState *machine) @@ -332,6 +338,15 @@ static const TypeInfo ast2500_evb_type =3D { .class_init =3D ast2500_evb_class_init, }; =20 +static void romulus_bmc_i2c_init(AspeedBoardState *bmc) +{ + AspeedSoCState *soc =3D &bmc->soc; + + /* The romulus board expects Epson RX8900 I2C RTC but a ds1338 is + * good enough */ + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338"= , 0x32); +} + static void romulus_bmc_init(MachineState *machine) { aspeed_board_init(machine, &aspeed_boards[ROMULUS_BMC]); @@ -365,6 +380,10 @@ static void witherspoon_bmc_i2c_init(AspeedBoardStat= e *bmc) =20 /* The Witherspoon expects a TMP275 but a TMP105 is compatible */ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), "tmp105",= 0x4a); + + /* The witherspoon board expects Epson RX8900 I2C RTC but a ds1338 i= s + * good enough */ + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338"= , 0x32); } =20 static void witherspoon_bmc_init(MachineState *machine) --=20 2.13.6