qemu-arm
[Top][All Lists]
Advanced

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

Re: [Qemu-arm] [PATCH v2 6/6] arm: Add an RX8900 RTC to the ASpeed board


From: Cédric Le Goater
Subject: Re: [Qemu-arm] [PATCH v2 6/6] arm: Add an RX8900 RTC to the ASpeed board
Date: Wed, 30 Nov 2016 09:16:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 11/30/2016 06:36 AM, Alastair D'Silva wrote:
> From: Alastair D'Silva <address@hidden>
> 
> Connect an RX8900 RTC to i2c12 of the AST2500 SOC at address 0x32
> 
> Signed-off-by: Alastair D'Silva <address@hidden>
> ---
>  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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]