diff mbox

[v10,5/5] hw/arm: add cubieboard support

Message ID 1386547806-22298-6-git-send-email-lig.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

liguang Dec. 9, 2013, 12:10 a.m. UTC
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 hw/arm/Makefile.objs |    2 +-
 hw/arm/cubieboard.c  |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 1 deletions(-)
 create mode 100644 hw/arm/cubieboard.c

Comments

Peter Crosthwaite Dec. 11, 2013, 5:59 a.m. UTC | #1
On Mon, Dec 9, 2013 at 10:10 AM, liguang <lig.fnst@cn.fujitsu.com> wrote:
> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>

Acked-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

> ---
>  hw/arm/Makefile.objs |    2 +-
>  hw/arm/cubieboard.c  |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 70 insertions(+), 1 deletions(-)
>  create mode 100644 hw/arm/cubieboard.c
>
> diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
> index 012bd2c..1dd94de 100644
> --- a/hw/arm/Makefile.objs
> +++ b/hw/arm/Makefile.objs
> @@ -5,4 +5,4 @@ obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o
>
>  obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
>  obj-y += omap1.o omap2.o strongarm.o
> -obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o
> +obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o
> diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
> new file mode 100644
> index 0000000..3fcb6d2
> --- /dev/null
> +++ b/hw/arm/cubieboard.c
> @@ -0,0 +1,69 @@
> +/*
> + * cubieboard emulation
> + *
> + * Copyright (C) 2013 Li Guang
> + * Written by Li Guang <lig.fnst@cn.fujitsu.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> + * for more details.
> + */
> +
> +#include "hw/sysbus.h"
> +#include "hw/devices.h"
> +#include "hw/boards.h"
> +#include "hw/arm/allwinner-a10.h"
> +
> +static struct arm_boot_info cubieboard_binfo = {
> +    .loader_start = AW_A10_SDRAM_BASE,
> +    .board_id = 0x1008,
> +};
> +
> +typedef struct CubieBoardState {
> +    AwA10State *a10;
> +    MemoryRegion sdram;
> +} CubieBoardState;
> +
> +static void cubieboard_init(QEMUMachineInitArgs *args)
> +{
> +    CubieBoardState *s = g_new(CubieBoardState, 1);
> +    Error *err = NULL;
> +
> +    s->a10 = AW_A10(object_new(TYPE_AW_A10));
> +    object_property_set_bool(OBJECT(s->a10), true, "realized", &err);
> +    if (err != NULL) {
> +        error_report("Couldn't realize Allwinner A10: %s\n",
> +                error_get_pretty(err));
> +        exit(1);
> +    }
> +
> +    memory_region_init_ram(&s->sdram, NULL, "cubieboard.ram", args->ram_size);
> +    vmstate_register_ram_global(&s->sdram);
> +    memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE,
> +                                &s->sdram);
> +
> +    cubieboard_binfo.ram_size = args->ram_size;
> +    cubieboard_binfo.kernel_filename = args->kernel_filename;
> +    cubieboard_binfo.kernel_cmdline = args->kernel_cmdline;
> +    arm_load_kernel(&s->a10->cpu, &cubieboard_binfo);
> +}
> +
> +static QEMUMachine cubieboard_machine = {
> +    .name = "cubieboard",
> +    .desc = "cubietech cubieboard",
> +    .init = cubieboard_init,
> +};
> +
> +
> +static void cubieboard_machine_init(void)
> +{
> +    qemu_register_machine(&cubieboard_machine);
> +}
> +
> +machine_init(cubieboard_machine_init)
> --
> 1.7.2.5
>
>
Peter Maydell Dec. 11, 2013, 9:56 a.m. UTC | #2
On 11 December 2013 05:59, Peter Crosthwaite
<peter.crosthwaite@xilinx.com> wrote:
> On Mon, Dec 9, 2013 at 10:10 AM, liguang <lig.fnst@cn.fujitsu.com> wrote:
>> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
>
> Acked-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Why Acked-by rather than Reviewed-by ?

thanks
-- PMM
Peter Crosthwaite Dec. 11, 2013, 10:24 a.m. UTC | #3
On Wed, Dec 11, 2013 at 7:56 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 11 December 2013 05:59, Peter Crosthwaite
> <peter.crosthwaite@xilinx.com> wrote:
>> On Mon, Dec 9, 2013 at 10:10 AM, liguang <lig.fnst@cn.fujitsu.com> wrote:
>>> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
>>
>> Acked-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> Why Acked-by rather than Reviewed-by ?
>

Not 100% myself on the new QOM styles and standards around boards and
SoC. But it is reviewed by me to the best of my knowledge. If that is
enough, please feel free to promote to Reviewed-by.

> thanks
> -- PMM
>
Peter Maydell Dec. 11, 2013, 10:31 a.m. UTC | #4
On 11 December 2013 10:24, Peter Crosthwaite
<peter.crosthwaite@xilinx.com> wrote:
> On Wed, Dec 11, 2013 at 7:56 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 11 December 2013 05:59, Peter Crosthwaite
>> <peter.crosthwaite@xilinx.com> wrote:
>>> On Mon, Dec 9, 2013 at 10:10 AM, liguang <lig.fnst@cn.fujitsu.com> wrote:
>>>> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
>>>
>>> Acked-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>
>> Why Acked-by rather than Reviewed-by ?
>>
>
> Not 100% myself on the new QOM styles and standards around boards and
> SoC. But it is reviewed by me to the best of my knowledge. If that is
> enough, please feel free to promote to Reviewed-by.

I'd call that Reviewed-by, yes. Acked-by is just "I don't object to this"
which is a sufficiently weak statement that it's not often used...

thanks
-- PMM
Peter Crosthwaite Dec. 11, 2013, 10:36 a.m. UTC | #5
On Wed, Dec 11, 2013 at 8:31 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 11 December 2013 10:24, Peter Crosthwaite
> <peter.crosthwaite@xilinx.com> wrote:
>> On Wed, Dec 11, 2013 at 7:56 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> On 11 December 2013 05:59, Peter Crosthwaite
>>> <peter.crosthwaite@xilinx.com> wrote:
>>>> On Mon, Dec 9, 2013 at 10:10 AM, liguang <lig.fnst@cn.fujitsu.com> wrote:
>>>>> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
>>>>
>>>> Acked-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>>
>>> Why Acked-by rather than Reviewed-by ?
>>>
>>
>> Not 100% myself on the new QOM styles and standards around boards and
>> SoC. But it is reviewed by me to the best of my knowledge. If that is
>> enough, please feel free to promote to Reviewed-by.
>
> I'd call that Reviewed-by, yes. Acked-by is just "I don't object to this"
> which is a sufficiently weak statement that it's not often used...
>

Ok,

Liguang, please drop the acks on p4 and p5 and replace by Reviewed-by
on next spin.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Regards,
Peter

> thanks
> -- PMM
>
liguang Dec. 11, 2013, 11:54 p.m. UTC | #6
Peter Crosthwaite wrote:
> On Wed, Dec 11, 2013 at 8:31 PM, Peter Maydell<peter.maydell@linaro.org>  wrote:
>    
>> On 11 December 2013 10:24, Peter Crosthwaite
>> <peter.crosthwaite@xilinx.com>  wrote:
>>      
>>> On Wed, Dec 11, 2013 at 7:56 PM, Peter Maydell<peter.maydell@linaro.org>  wrote:
>>>        
>>>> On 11 December 2013 05:59, Peter Crosthwaite
>>>> <peter.crosthwaite@xilinx.com>  wrote:
>>>>          
>>>>> On Mon, Dec 9, 2013 at 10:10 AM, liguang<lig.fnst@cn.fujitsu.com>  wrote:
>>>>>            
>>>>>> Signed-off-by: liguang<lig.fnst@cn.fujitsu.com>
>>>>>>              
>>>>> Acked-by: Peter Crosthwaite<peter.crosthwaite@xilinx.com>
>>>>>            
>>>> Why Acked-by rather than Reviewed-by ?
>>>>
>>>>          
>>> Not 100% myself on the new QOM styles and standards around boards and
>>> SoC. But it is reviewed by me to the best of my knowledge. If that is
>>> enough, please feel free to promote to Reviewed-by.
>>>        
>> I'd call that Reviewed-by, yes. Acked-by is just "I don't object to this"
>> which is a sufficiently weak statement that it's not often used...
>>
>>      
> Ok,
>
> Liguang, please drop the acks on p4 and p5 and replace by Reviewed-by
> on next spin.
>
> Reviewed-by: Peter Crosthwaite<peter.crosthwaite@xilinx.com>
>    

Ok, thanks!
diff mbox

Patch

diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
index 012bd2c..1dd94de 100644
--- a/hw/arm/Makefile.objs
+++ b/hw/arm/Makefile.objs
@@ -5,4 +5,4 @@  obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o
 
 obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
 obj-y += omap1.o omap2.o strongarm.o
-obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o
+obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o
diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
new file mode 100644
index 0000000..3fcb6d2
--- /dev/null
+++ b/hw/arm/cubieboard.c
@@ -0,0 +1,69 @@ 
+/*
+ * cubieboard emulation
+ *
+ * Copyright (C) 2013 Li Guang
+ * Written by Li Guang <lig.fnst@cn.fujitsu.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "hw/sysbus.h"
+#include "hw/devices.h"
+#include "hw/boards.h"
+#include "hw/arm/allwinner-a10.h"
+
+static struct arm_boot_info cubieboard_binfo = {
+    .loader_start = AW_A10_SDRAM_BASE,
+    .board_id = 0x1008,
+};
+
+typedef struct CubieBoardState {
+    AwA10State *a10;
+    MemoryRegion sdram;
+} CubieBoardState;
+
+static void cubieboard_init(QEMUMachineInitArgs *args)
+{
+    CubieBoardState *s = g_new(CubieBoardState, 1);
+    Error *err = NULL;
+
+    s->a10 = AW_A10(object_new(TYPE_AW_A10));
+    object_property_set_bool(OBJECT(s->a10), true, "realized", &err);
+    if (err != NULL) {
+        error_report("Couldn't realize Allwinner A10: %s\n",
+                error_get_pretty(err));
+        exit(1);
+    }
+
+    memory_region_init_ram(&s->sdram, NULL, "cubieboard.ram", args->ram_size);
+    vmstate_register_ram_global(&s->sdram);
+    memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE,
+                                &s->sdram);
+
+    cubieboard_binfo.ram_size = args->ram_size;
+    cubieboard_binfo.kernel_filename = args->kernel_filename;
+    cubieboard_binfo.kernel_cmdline = args->kernel_cmdline;
+    arm_load_kernel(&s->a10->cpu, &cubieboard_binfo);
+}
+
+static QEMUMachine cubieboard_machine = {
+    .name = "cubieboard",
+    .desc = "cubietech cubieboard",
+    .init = cubieboard_init,
+};
+
+
+static void cubieboard_machine_init(void)
+{
+    qemu_register_machine(&cubieboard_machine);
+}
+
+machine_init(cubieboard_machine_init)