diff mbox series

[v1,15/15] aspeed: add tmp105 in i2c bus 0 for AST2700

Message ID 20240718064925.1846074-16-jamin_lin@aspeedtech.com (mailing list archive)
State New, archived
Headers show
Series support ADC and I2C for AST2700 | expand

Commit Message

Jamin Lin July 18, 2024, 6:49 a.m. UTC
ASPEED SDK add lm75 in i2c bus 0 for AST2700.
LM75 is compatible with TMP105 driver.

Introduce a new i2c init function and
add tmp105 device model in i2c bus 0.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/arm/aspeed.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Cédric Le Goater July 18, 2024, 8:55 a.m. UTC | #1
On 7/18/24 08:49, Jamin Lin wrote:
> ASPEED SDK add lm75 in i2c bus 0 for AST2700.
> LM75 is compatible with TMP105 driver.
> 
> Introduce a new i2c init function and
> add tmp105 device model in i2c bus 0.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>

As a followup, you could modify test_aarch64_ast2700_evb_sdk_v09_02
to read the sensor value.

Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
>   hw/arm/aspeed.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index f8766ea462..ed98758708 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -1604,6 +1604,15 @@ static void aspeed_minibmc_machine_ast1030_evb_class_init(ObjectClass *oc,
>   }
>   
>   #ifdef TARGET_AARCH64
> +static void ast2700_evb_i2c_init(AspeedMachineState *bmc)
> +{
> +    AspeedSoCState *soc = bmc->soc;
> +
> +    /* LM75 is compatible with TMP105 driver */
> +    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 0),
> +                            TYPE_TMP105, 0x4d);
> +}
> +
>   static void aspeed_machine_ast2700_evb_class_init(ObjectClass *oc, void *data)
>   {
>       MachineClass *mc = MACHINE_CLASS(oc);
> @@ -1618,6 +1627,7 @@ static void aspeed_machine_ast2700_evb_class_init(ObjectClass *oc, void *data)
>       amc->num_cs    = 2;
>       amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON | ASPEED_MAC2_ON;
>       amc->uart_default = ASPEED_DEV_UART12;
> +    amc->i2c_init  = ast2700_evb_i2c_init;
>       mc->default_ram_size = 1 * GiB;
>       aspeed_machine_class_init_cpus_defaults(mc);
>   }
Jamin Lin July 18, 2024, 9:33 a.m. UTC | #2
Hi Cedric,

> Subject: Re: [PATCH v1 15/15] aspeed: add tmp105 in i2c bus 0 for AST2700
>
> On 7/18/24 08:49, Jamin Lin wrote:
> > ASPEED SDK add lm75 in i2c bus 0 for AST2700.
> > LM75 is compatible with TMP105 driver.
> >
> > Introduce a new i2c init function and
> > add tmp105 device model in i2c bus 0.
> >
> > Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
>
> As a followup, you could modify test_aarch64_ast2700_evb_sdk_v09_02
> to read the sensor value.
>
Thanks for review and suggestion.
Will update avocado test case.

Jamin
> Reviewed-by: Cédric Le Goater <clg@redhat.com>
>
> Thanks,
>
> C.
>
>
> > ---
> >   hw/arm/aspeed.c | 10 ++++++++++
> >   1 file changed, 10 insertions(+)
> >
> > diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index
> > f8766ea462..ed98758708 100644
> > --- a/hw/arm/aspeed.c
> > +++ b/hw/arm/aspeed.c
> > @@ -1604,6 +1604,15 @@ static void
> aspeed_minibmc_machine_ast1030_evb_class_init(ObjectClass *oc,
> >   }
> >
> >   #ifdef TARGET_AARCH64
> > +static void ast2700_evb_i2c_init(AspeedMachineState *bmc) {
> > +    AspeedSoCState *soc = bmc->soc;
> > +
> > +    /* LM75 is compatible with TMP105 driver */
> > +    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 0),
> > +                            TYPE_TMP105, 0x4d); }
> > +
> >   static void aspeed_machine_ast2700_evb_class_init(ObjectClass *oc, void
> *data)
> >   {
> >       MachineClass *mc = MACHINE_CLASS(oc); @@ -1618,6 +1627,7
> @@
> > static void aspeed_machine_ast2700_evb_class_init(ObjectClass *oc, void
> *data)
> >       amc->num_cs    = 2;
> >       amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON |
> ASPEED_MAC2_ON;
> >       amc->uart_default = ASPEED_DEV_UART12;
> > +    amc->i2c_init  = ast2700_evb_i2c_init;
> >       mc->default_ram_size = 1 * GiB;
> >       aspeed_machine_class_init_cpus_defaults(mc);
> >   }

************* Email Confidentiality Notice ********************
免責聲明:
本信件(或其附件)可能包含機密資訊,並受法律保護。如 台端非指定之收件者,請以電子郵件通知本電子郵件之發送者, 並請立即刪除本電子郵件及其附件和銷毀所有複印件。謝謝您的合作!

DISCLAIMER:
This message (and any attachments) may contain legally privileged and/or other confidential information. If you have received it in error, please notify the sender by reply e-mail and immediately delete the e-mail and any attachments without copying or disclosing the contents. Thank you.
diff mbox series

Patch

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index f8766ea462..ed98758708 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -1604,6 +1604,15 @@  static void aspeed_minibmc_machine_ast1030_evb_class_init(ObjectClass *oc,
 }
 
 #ifdef TARGET_AARCH64
+static void ast2700_evb_i2c_init(AspeedMachineState *bmc)
+{
+    AspeedSoCState *soc = bmc->soc;
+
+    /* LM75 is compatible with TMP105 driver */
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 0),
+                            TYPE_TMP105, 0x4d);
+}
+
 static void aspeed_machine_ast2700_evb_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -1618,6 +1627,7 @@  static void aspeed_machine_ast2700_evb_class_init(ObjectClass *oc, void *data)
     amc->num_cs    = 2;
     amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON | ASPEED_MAC2_ON;
     amc->uart_default = ASPEED_DEV_UART12;
+    amc->i2c_init  = ast2700_evb_i2c_init;
     mc->default_ram_size = 1 * GiB;
     aspeed_machine_class_init_cpus_defaults(mc);
 }