diff mbox series

[v2,2/2] arm: exynos4: Add dma support for smdkc210

Message ID 20181030114048.21527-3-philmd@redhat.com
State New
Headers show
Series hw/arm/exynos4: Add DMA support for SMDKC210 board | expand

Commit Message

Philippe Mathieu-Daudé Oct. 30, 2018, 11:40 a.m. UTC
From: Guenter Roeck <linux@roeck-us.net>

QEMU already supports pl330. Instantiate it for smdkc210.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
[PMD: Do not set default qdev properties]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/arm/exynos4_boards.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Peter Maydell Oct. 30, 2018, 2:06 p.m. UTC | #1
On 30 October 2018 at 11:40, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> From: Guenter Roeck <linux@roeck-us.net>
>
> QEMU already supports pl330. Instantiate it for smdkc210.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> [PMD: Do not set default qdev properties]
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/arm/exynos4_boards.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)

>  static void exynos4_boards_init_ram(Exynos4BoardState *s,
>                                      MemoryRegion *system_mem,
>                                      unsigned long ram_size)
> @@ -171,6 +187,14 @@ static void smdkc210_init(MachineState *machine)
>
>      lan9215_init(SMDK_LAN9118_BASE_ADDR,
>              qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(37, 1)]));
> +
> +    pl330_init(SMDK_PL330_BASE0_ADDR,
> +            qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(35, 1)]), 32);
> +    pl330_init(SMDK_PL330_BASE1_ADDR,
> +            qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(36, 1)]), 32);
> +    pl330_init(SMDK_PL330_BASE2_ADDR,
> +            qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(34, 1)]), 1);
> +
>      arm_load_kernel(ARM_CPU(first_cpu), &exynos4_board_binfo);
>  }

Are the PL330s really on the board and not part of the SoC? The
layout of the dts files in the kernel suggests they're in the
SoC, in which case they would belong in hw/arm/exynos4210.c.

thanks
-- PMM
Philippe Mathieu-Daudé Oct. 30, 2018, 2:27 p.m. UTC | #2
On 30/10/18 15:06, Peter Maydell wrote:
> On 30 October 2018 at 11:40, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>> From: Guenter Roeck <linux@roeck-us.net>
>>
>> QEMU already supports pl330. Instantiate it for smdkc210.
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
>> [PMD: Do not set default qdev properties]
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>   hw/arm/exynos4_boards.c | 24 ++++++++++++++++++++++++
>>   1 file changed, 24 insertions(+)
> 
>>   static void exynos4_boards_init_ram(Exynos4BoardState *s,
>>                                       MemoryRegion *system_mem,
>>                                       unsigned long ram_size)
>> @@ -171,6 +187,14 @@ static void smdkc210_init(MachineState *machine)
>>
>>       lan9215_init(SMDK_LAN9118_BASE_ADDR,
>>               qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(37, 1)]));
>> +
>> +    pl330_init(SMDK_PL330_BASE0_ADDR,
>> +            qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(35, 1)]), 32);
>> +    pl330_init(SMDK_PL330_BASE1_ADDR,
>> +            qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(36, 1)]), 32);
>> +    pl330_init(SMDK_PL330_BASE2_ADDR,
>> +            qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(34, 1)]), 1);
>> +
>>       arm_load_kernel(ARM_CPU(first_cpu), &exynos4_board_binfo);
>>   }
> 
> Are the PL330s really on the board and not part of the SoC? The
> layout of the dts files in the kernel suggests they're in the
> SoC, in which case they would belong in hw/arm/exynos4210.c.

Yes you are right, I missed that :|
diff mbox series

Patch

diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c
index 750162cc95..5696b37bf2 100644
--- a/hw/arm/exynos4_boards.c
+++ b/hw/arm/exynos4_boards.c
@@ -49,6 +49,9 @@ 
 #endif
 
 #define SMDK_LAN9118_BASE_ADDR      0x05000000
+#define SMDK_PL330_BASE0_ADDR       0x12680000
+#define SMDK_PL330_BASE1_ADDR       0x12690000
+#define SMDK_PL330_BASE2_ADDR       0x12850000
 
 typedef enum Exynos4BoardType {
     EXYNOS4_BOARD_NURI,
@@ -102,6 +105,19 @@  static void lan9215_init(uint32_t base, qemu_irq irq)
     }
 }
 
+static void pl330_init(uint32_t base, qemu_irq irq, int nreq)
+{
+    SysBusDevice *busdev;
+    DeviceState *dev;
+
+    dev = qdev_create(NULL, "pl330");
+    qdev_prop_set_uint8(dev, "num_periph_req",  nreq);
+    qdev_init_nofail(dev);
+    busdev = SYS_BUS_DEVICE(dev);
+    sysbus_mmio_map(busdev, 0, base);
+    sysbus_connect_irq(busdev, 0, irq);
+}
+
 static void exynos4_boards_init_ram(Exynos4BoardState *s,
                                     MemoryRegion *system_mem,
                                     unsigned long ram_size)
@@ -171,6 +187,14 @@  static void smdkc210_init(MachineState *machine)
 
     lan9215_init(SMDK_LAN9118_BASE_ADDR,
             qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(37, 1)]));
+
+    pl330_init(SMDK_PL330_BASE0_ADDR,
+            qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(35, 1)]), 32);
+    pl330_init(SMDK_PL330_BASE1_ADDR,
+            qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(36, 1)]), 32);
+    pl330_init(SMDK_PL330_BASE2_ADDR,
+            qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(34, 1)]), 1);
+
     arm_load_kernel(ARM_CPU(first_cpu), &exynos4_board_binfo);
 }