diff mbox series

[12/20] hw/rx/rx62n: Use New SCI module.

Message ID 20200827123859.81793-13-ysato@users.sourceforge.jp
State New
Headers show
Series [01/20] loader.c: Add support Motrola S-record format. | expand

Commit Message

Yoshinori Sato Aug. 27, 2020, 12:38 p.m. UTC
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
 include/hw/rx/rx62n.h | 2 +-
 hw/rx/rx62n.c         | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé Oct. 25, 2020, 12:33 a.m. UTC | #1
On 8/27/20 2:38 PM, Yoshinori Sato wrote:
> Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>

> ---

>   include/hw/rx/rx62n.h | 2 +-

>   hw/rx/rx62n.c         | 7 ++++++-

>   2 files changed, 7 insertions(+), 2 deletions(-)

> 

> diff --git a/include/hw/rx/rx62n.h b/include/hw/rx/rx62n.h

> index 1182ca24de..f463148799 100644

> --- a/include/hw/rx/rx62n.h

> +++ b/include/hw/rx/rx62n.h

> @@ -70,7 +70,7 @@ typedef struct RX62NState {

>       RXICUState icu;

>       RenesasTMR8State tmr[RX62N_NR_TMR];

>       RenesasCMTState cmt[RX62N_NR_CMT];

> -    RSCIState sci[RX62N_NR_SCI];

> +    RSCIAState sci[RX62N_NR_SCI];

>       RX62NCPGState cpg;

>   

>       MemoryRegion *sysmem;

> diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c

> index 0223396110..f61383a4c2 100644

> --- a/hw/rx/rx62n.c

> +++ b/hw/rx/rx62n.c

> @@ -191,11 +191,13 @@ static void register_sci(RX62NState *s, int unit)

>   {

>       SysBusDevice *sci;

>       int i, irqbase;

> +    char ckname[16];

>   

>       object_initialize_child(OBJECT(s), "sci[*]",

> -                            &s->sci[unit], TYPE_RENESAS_SCI);

> +                            &s->sci[unit], TYPE_RENESAS_SCIA);

>       sci = SYS_BUS_DEVICE(&s->sci[unit]);

>       qdev_prop_set_chr(DEVICE(sci), "chardev", serial_hd(unit));

> +    qdev_prop_set_uint32(DEVICE(sci), "unit", unit);

>       sysbus_realize(sci, &error_abort);

>   

>       irqbase = RX62N_SCI_IRQ + SCI_NR_IRQ * unit;

> @@ -203,6 +205,9 @@ static void register_sci(RX62NState *s, int unit)

>           sysbus_connect_irq(sci, i, s->irq[irqbase + i]);

>       }

>       sysbus_mmio_map(sci, 0, RX62N_SCI_BASE + unit * 0x08);

> +    snprintf(ckname, sizeof(ckname), "pck_sci-%d", unit);

> +    qdev_connect_clock_in(DEVICE(sci), "pck",

> +                          qdev_get_clock_out(DEVICE(&s->cpg), ckname));

>   }

>   

>   static void register_cpg(RX62NState *s)

> 


This makes the test_linux_sash test timeout:

$ avocado --show=app,console run -t arch:rx  tests/acceptance/
Fetching asset from 
tests/acceptance/machine_rx_gdbsim.py:RxGdbSimMachine.test_uboot
Fetching asset from 
tests/acceptance/machine_rx_gdbsim.py:RxGdbSimMachine.test_linux_sash
Fetching asset from 
tests/acceptance/machine_rx_gdbsim.py:RxGdbSimMachine.test_linux_sash
JOB ID     : 932d3a7a15be19e0d9772705d69d5b815793b1d3
JOB LOG    : 
/home/phil/avocado/job-results/job-2020-10-25T02.18-932d3a7/job.log
  (1/2) 
tests/acceptance/machine_rx_gdbsim.py:RxGdbSimMachine.test_uboot: 
console: U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty (Feb 05 2019 - 
21:56:06 +0900)
PASS (0.11 s)
  (2/2) 
tests/acceptance/machine_rx_gdbsim.py:RxGdbSimMachine.test_linux_sash: 
console: Linux version 4.19.0+ (yo-satoh@yo-satoh-debian) (gcc version 
9.0.0 20181105 (experimental) (GCC)) #137 Wed Feb 20 23:20:02 JST 2019
console: Built 1 zonelists, mobility grouping on.  Total pages: 8128
console: Kernel command line:
console: Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
console: Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
console: Memory: 14648K/32768K available (871K kernel code, 95K rwdata, 
140K rodata, 96K init, 175K bss, 18120K reserved, 0K cma-reserved)
console: NR_IRQS: 256
console: rx-cmt: used for periodic clock events
console: clocksource: rx-tpu: mask: 0xffffffff max_cycles: 0xffffffff, 
max_idle_ns: 1274173631191 ns
console: 96.00 BogoMIPS (lpj=480000)
console: pid_max: default: 4096 minimum: 301
console: Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
console: Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
console: clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, 
max_idle_ns: 19112604462750000 ns
console: clocksource: Switched to clocksource rx-tpu
console: workingset: timestamp_bits=30 max_order=12 bucket_order=0
console: SuperH (H)SCI(F) driver initialized
console: 88240.serial: ttySC0 at MMIO 0x88240 (irq = 215, base_baud = 0) 
is a sci
console: console [ttySC0] enabled
console: 88248.serial: ttySC1 at MMIO 0x88248 (irq = 219, base_baud = 0) 
is a sci
console: random: get_random_bytes called from 0x01002e48 with crng_init=0
console: Freeing unused kernel memory: 96K
console: This architecture does not have kernel memory protection.
console: Run /sbin/init as init process
console: Run /etc/init as init process
console: Run /bin/init as init process
console: Run /bin/sh as init process
\console: random: fast init done
INTERRUPTED: Test interrupted by SIGTERM\nRunner error occurred: Timeout 
reached\nOriginal status: ERROR\n{'name': 
'2-tests/acceptance/machine_rx_gdbsim.py:RxGdbSimMachine.test_linux_sash', 
'logdir': 
'/home/phil/avocado/job-results/job-2020-10-25T02.18-932d3a7/test-resul... 
(30.23 s)
RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 1 | 
CANCEL 0
JOB TIME   : 30.73 s
diff mbox series

Patch

diff --git a/include/hw/rx/rx62n.h b/include/hw/rx/rx62n.h
index 1182ca24de..f463148799 100644
--- a/include/hw/rx/rx62n.h
+++ b/include/hw/rx/rx62n.h
@@ -70,7 +70,7 @@  typedef struct RX62NState {
     RXICUState icu;
     RenesasTMR8State tmr[RX62N_NR_TMR];
     RenesasCMTState cmt[RX62N_NR_CMT];
-    RSCIState sci[RX62N_NR_SCI];
+    RSCIAState sci[RX62N_NR_SCI];
     RX62NCPGState cpg;
 
     MemoryRegion *sysmem;
diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c
index 0223396110..f61383a4c2 100644
--- a/hw/rx/rx62n.c
+++ b/hw/rx/rx62n.c
@@ -191,11 +191,13 @@  static void register_sci(RX62NState *s, int unit)
 {
     SysBusDevice *sci;
     int i, irqbase;
+    char ckname[16];
 
     object_initialize_child(OBJECT(s), "sci[*]",
-                            &s->sci[unit], TYPE_RENESAS_SCI);
+                            &s->sci[unit], TYPE_RENESAS_SCIA);
     sci = SYS_BUS_DEVICE(&s->sci[unit]);
     qdev_prop_set_chr(DEVICE(sci), "chardev", serial_hd(unit));
+    qdev_prop_set_uint32(DEVICE(sci), "unit", unit);
     sysbus_realize(sci, &error_abort);
 
     irqbase = RX62N_SCI_IRQ + SCI_NR_IRQ * unit;
@@ -203,6 +205,9 @@  static void register_sci(RX62NState *s, int unit)
         sysbus_connect_irq(sci, i, s->irq[irqbase + i]);
     }
     sysbus_mmio_map(sci, 0, RX62N_SCI_BASE + unit * 0x08);
+    snprintf(ckname, sizeof(ckname), "pck_sci-%d", unit);
+    qdev_connect_clock_in(DEVICE(sci), "pck",
+                          qdev_get_clock_out(DEVICE(&s->cpg), ckname));
 }
 
 static void register_cpg(RX62NState *s)