diff mbox series

[v2,06/12] hw/arm/raspi: Consider network interface for B models

Message ID 20250204002240.97830-7-philmd@linaro.org (mailing list archive)
State New
Headers show
Series hw/arm/raspi: Allow creating any Raspberry Pi machine | expand

Commit Message

Philippe Mathieu-Daudé Feb. 4, 2025, 12:22 a.m. UTC
Raspberry Pi 'B' models have an ethernet chipset (the LAN9512).
Since we don't yet model it, add a /* TODO */ comment.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/arm/raspi.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Peter Maydell Feb. 4, 2025, 3:09 p.m. UTC | #1
On Tue, 4 Feb 2025 at 00:23, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Raspberry Pi 'B' models have an ethernet chipset (the LAN9512).
> Since we don't yet model it, add a /* TODO */ comment.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/arm/raspi.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> index 1a6a1f8ff22..68332fba027 100644
> --- a/hw/arm/raspi.c
> +++ b/hw/arm/raspi.c
> @@ -143,6 +143,16 @@ static const char *board_type(uint32_t board_rev)
>      return types[bt].model;
>  }
>
> +static bool is_model_b(uint32_t board_rev)
> +{
> +    return !!strchr(board_type(board_rev), 'B');
> +}
> +
> +static bool has_enet(uint32_t board_rev)
> +{
> +    return is_model_b(board_rev);
> +}
> +
>  static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)
>  {
>      static const ARMInsnFixup smpboot[] = {
> @@ -304,6 +314,10 @@ void raspi_base_machine_init(MachineState *machine,
>                              machine->kernel_cmdline, &error_abort);
>      qdev_realize(DEVICE(soc), NULL, &error_fatal);
>
> +    if (has_enet(board_rev)) {
> +        /* TODO: model LAN9512 and wire over USB2 */
> +    }
> +

Why bother, if we don't do anything anyway? We can
say in the TODO comment
 /* TODO: "B" models have a LAN9512 on the USB bus */

thanks
-- PMM
diff mbox series

Patch

diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 1a6a1f8ff22..68332fba027 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -143,6 +143,16 @@  static const char *board_type(uint32_t board_rev)
     return types[bt].model;
 }
 
+static bool is_model_b(uint32_t board_rev)
+{
+    return !!strchr(board_type(board_rev), 'B');
+}
+
+static bool has_enet(uint32_t board_rev)
+{
+    return is_model_b(board_rev);
+}
+
 static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)
 {
     static const ARMInsnFixup smpboot[] = {
@@ -304,6 +314,10 @@  void raspi_base_machine_init(MachineState *machine,
                             machine->kernel_cmdline, &error_abort);
     qdev_realize(DEVICE(soc), NULL, &error_fatal);
 
+    if (has_enet(board_rev)) {
+        /* TODO: model LAN9512 and wire over USB2 */
+    }
+
     /* Create and plug in the SD cards */
     di = drive_get(IF_SD, 0, 0);
     blk = di ? blk_by_legacy_dinfo(di) : NULL;