From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cC04K-0004dg-77 for qemu-devel@nongnu.org; Wed, 30 Nov 2016 03:16:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cC04H-0002xb-23 for qemu-devel@nongnu.org; Wed, 30 Nov 2016 03:16:44 -0500 Received: from 6.mo69.mail-out.ovh.net ([46.105.50.107]:36565) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cC04G-0002uT-Qe for qemu-devel@nongnu.org; Wed, 30 Nov 2016 03:16:40 -0500 Received: from player699.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo69.mail-out.ovh.net (Postfix) with ESMTP id 11E5BD099 for ; Wed, 30 Nov 2016 09:16:39 +0100 (CET) References: <20161130053629.23340-1-alastair@au1.ibm.com> <20161130053629.23340-7-alastair@au1.ibm.com> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: <31f8bcf5-825f-3ea5-8457-f96eb08a75cd@kaod.org> Date: Wed, 30 Nov 2016 09:16:31 +0100 MIME-Version: 1.0 In-Reply-To: <20161130053629.23340-7-alastair@au1.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 6/6] arm: Add an RX8900 RTC to the ASpeed board List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alastair D'Silva , qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, Peter Maydell , Andrew Jeffery , Joel Stanley , Alastair D'Silva On 11/30/2016 06:36 AM, Alastair D'Silva wrote: > From: Alastair D'Silva > > Connect an RX8900 RTC to i2c12 of the AST2500 SOC at address 0x32 > > Signed-off-by: Alastair D'Silva > --- > hw/arm/aspeed.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c > index c7206fd..8de95f2 100644 > --- a/hw/arm/aspeed.c > +++ b/hw/arm/aspeed.c > @@ -166,7 +166,19 @@ static const TypeInfo palmetto_bmc_type = { > > static void ast2500_evb_init(MachineState *machine) > { > + AspeedSoCState *soc; > + I2CBus *i2c12; > + DeviceState *rx8900; > + > aspeed_board_init(machine, &aspeed_boards[AST2500_EVB]); > + > + soc = ASPEED_SOC(object_resolve_path_component(OBJECT(machine), "soc")); > + > + i2c12 = aspeed_i2c_get_bus((DeviceState *)&soc->i2c, 11); > + rx8900 = i2c_create_slave(i2c12, "rx8900", 0x32); > + > + qdev_connect_gpio_out_named(rx8900, "rx8900-interrupt-out", 0, > + qdev_get_gpio_in(DEVICE(&soc->vic), 22)); > } > > static void ast2500_evb_class_init(ObjectClass *oc, void *data) > I think it would be nicer to define a handler under AspeedBoardConfig, something like : int (*i2c_init)(AspeedBoardState *bmc); when a board needs I2C devices. The handler would be called from aspeed_board_init() directly. This is similar to what we do for the flash modules but we didn't have to add a specific handler for the flash. Thoughts ? C.