qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] SH4: SCI improvement
@ 2008-11-23 14:41 Shin-ichiro KAWASAKI
  2008-11-23 22:26 ` Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Shin-ichiro KAWASAKI @ 2008-11-23 14:41 UTC (permalink / raw)
  To: qemu-devel

This patch simply implement one register of SH4's SCI := Serial Communication Interface.

R2D evaluation board uses SCI for SPI connection.  So, Linux kernel for R2D with
default configuration causes a QEMU assertion failure when it initializes SPI driver.
This patch avoids it and reduces the kernel config modification work for QEMU.

Completing SCI implementation task is left.  Other board support is desirable to confirm
this task, which uses SCI for a serial terminal.

Regards,
Shin-ichiro KAWASAKI


Signed-off-by: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>

Index: trunk/hw/sh_serial.c
===================================================================
--- trunk/hw/sh_serial.c	(revision 5771)
+++ trunk/hw/sh_serial.c	(working copy)
@@ -168,19 +168,19 @@
         }
     }
     else {
+        switch(offs) {
 #if 0
-        switch(offs) {
         case 0x0c:
             ret = s->dr;
             break;
         case 0x10:
             ret = 0;
             break;
+#endif
         case 0x1c:
-            ret = s->sptr;
-            break;
+            s->sptr = val & 0x8f;
+            return;
         }
-#endif
     }
 
     fprintf(stderr, "sh_serial: unsupported write to 0x%02x\n", offs);
@@ -260,8 +260,8 @@
         }
     }
     else {
+        switch(offs) {
 #if 0
-        switch(offs) {
         case 0x0c:
             ret = s->dr;
             break;
@@ -271,11 +271,11 @@
         case 0x14:
             ret = s->rx_fifo[0];
             break;
+#endif
         case 0x1c:
             ret = s->sptr;
             break;
         }
-#endif
     }
 #ifdef DEBUG_SERIAL
     printf("sh_serial: read base=0x%08lx offs=0x%02x val=0x%x\n",

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] SH4: SCI improvement
  2008-11-23 14:41 [Qemu-devel] [PATCH] SH4: SCI improvement Shin-ichiro KAWASAKI
@ 2008-11-23 22:26 ` Jean-Christophe PLAGNIOL-VILLARD
  2008-11-24  4:39   ` Shin-ichiro KAWASAKI
  2008-12-07 22:46 ` Aurelien Jarno
  2008-12-08  3:50 ` Paul Mundt
  2 siblings, 1 reply; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-11-23 22:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Shin-ichiro KAWASAKI

hi Shin-san,

	I'm trying to use u-boot with qemu on the r2d but I've the following
	problem maybe you can help me.

	I've add the flash support at 0xA0000000
	and have qemu refusing to boot from it
	qemu: fatal: Trying to execute code outside RAM or ROM at 0xa000000A

	I've also try to boot u-boot as a kernel and have the output working
	but not the input. Impossible to type anything

U-Boot 2008.10-00237-g6d56cf3 (Nov 23 2008 - 21:08:17)

CPU: SH4
BOARD: Renesas Solutions R2D Plus
DRAM:  64MB
Timer with period zero, disabling
## Unknown FLASH on Bank 1 - Size = 0x00000000 = 0 MB
FLASH: 0MB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
=> 

Best Regards,
J.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] SH4: SCI improvement
  2008-11-23 22:26 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2008-11-24  4:39   ` Shin-ichiro KAWASAKI
  2008-12-06  9:44     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 9+ messages in thread
From: Shin-ichiro KAWASAKI @ 2008-11-24  4:39 UTC (permalink / raw)
  To: qemu-devel

Hi, Jean-san!

It seems a good idea to make u-boot run on SH4-QEMU,
for brushing up SH4 emulation.

Jean-Christophe PLAGNIOL-VILLARD wrote:
> 	I've add the flash support at 0xA0000000
> 	and have qemu refusing to boot from it
> 	qemu: fatal: Trying to execute code outside RAM or ROM at 0xa000000A

> 	I've also try to boot u-boot as a kernel and have the output working
> 	but not the input. Impossible to type anything

I'm afraid that I have no idea about these two points now.
I just guess MMU emulation and SCIF emulation might not be enough to run u-boot.

To investigate them more closely, I downloaded current u-boot git repository,
build if for r2d, and run u-boot.bin with -kernel option.  But u-boot couldn't
boot with assertion failures.  Following two parts caused them.

 - MMUCR initialization with 16 bit word write causes failure.
   QEMU only implements 32 bit write for it, following SH7750 document.
 - BSC's PCR access cause failure. 
   QEMU does not implement it yet.

Have you handled them?


Regards,
Shin-ichiro KAWASAKI


 
> U-Boot 2008.10-00237-g6d56cf3 (Nov 23 2008 - 21:08:17)
> 
> CPU: SH4
> BOARD: Renesas Solutions R2D Plus
> DRAM:  64MB
> Timer with period zero, disabling
> ## Unknown FLASH on Bank 1 - Size = 0x00000000 = 0 MB
> FLASH: 0MB
> *** Warning - bad CRC, using default environment
> 
> In:    serial
> Out:   serial
> Err:   serial
> Net:   No ethernet found.
> => 
> 
> Best Regards,
> J.
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] SH4: SCI improvement
  2008-11-24  4:39   ` Shin-ichiro KAWASAKI
@ 2008-12-06  9:44     ` Jean-Christophe PLAGNIOL-VILLARD
  2008-12-14 11:55       ` Shin-ichiro KAWASAKI
  0 siblings, 1 reply; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-12-06  9:44 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1379 bytes --]

On 13:39 Mon 24 Nov     , Shin-ichiro KAWASAKI wrote:
> Hi, Jean-san!
>
> It seems a good idea to make u-boot run on SH4-QEMU,
> for brushing up SH4 emulation.
>
> Jean-Christophe PLAGNIOL-VILLARD wrote:
>> 	I've add the flash support at 0xA0000000
>> 	and have qemu refusing to boot from it
>> 	qemu: fatal: Trying to execute code outside RAM or ROM at 0xa000000A
>
>> 	I've also try to boot u-boot as a kernel and have the output working
>> 	but not the input. Impossible to type anything
>
> I'm afraid that I have no idea about these two points now.
> I just guess MMU emulation and SCIF emulation might not be enough to run u-boot.
>
> To investigate them more closely, I downloaded current u-boot git repository,
> build if for r2d, and run u-boot.bin with -kernel option.  But u-boot couldn't
> boot with assertion failures.  Following two parts caused them.
>
> - MMUCR initialization with 16 bit word write causes failure.
>   QEMU only implements 32 bit write for it, following SH7750 document.
> - BSC's PCR access cause failure.   QEMU does not implement it yet.
>
> Have you handled them?
>
you need to apply 1 patch on u-boot

r2dplus fix register access
I've send to the U-Boot ML

and 2 patchs to qemu

>From you
sh4: pci and mmu support
and from I
SH7750/51: add register BCR3, NCR4, PCR, RTCOR, RTCNT, RTCSR, SDMR2, SDMR3 and
fix BCR2 support

Best Regards,
J.

[-- Attachment #2: 0001-r2dplus-fix-register-access.patch --]
[-- Type: text/x-diff, Size: 1428 bytes --]

>From 54e5318dbc1beb1eb37843dc94331ce2d6d48f60 Mon Sep 17 00:00:00 2001
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Date: Thu, 4 Dec 2008 13:24:00 +0100
Subject: [PATCH] r2dplus fix register access

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 board/renesas/r2dplus/lowlevel_init.S |    2 +-
 drivers/pci/pci_sh7751.c              |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/board/renesas/r2dplus/lowlevel_init.S b/board/renesas/r2dplus/lowlevel_init.S
index 87e30c5..28d2b37 100644
--- a/board/renesas/r2dplus/lowlevel_init.S
+++ b/board/renesas/r2dplus/lowlevel_init.S
@@ -21,7 +21,7 @@ lowlevel_init:
 
 	mov.l	MMUCR_A,r1
 	mov.l	MMUCR_D,r0
-	mov.w	r0,@r1
+	mov.l	r0,@r1
 
 	mov.l	BCR1_A,r1
 	mov.l	BCR1_D,r0
diff --git a/drivers/pci/pci_sh7751.c b/drivers/pci/pci_sh7751.c
index e3a0ea0..df6d76f 100644
--- a/drivers/pci/pci_sh7751.c
+++ b/drivers/pci/pci_sh7751.c
@@ -187,8 +187,8 @@ int pci_sh7751_init(struct pci_controller *hose)
 
 	/* Copy BSC registers into PCI BSC */
 	p4_out(inl(SH7751_BCR1), SH7751_PCIBCR1);
-	p4_out(inl(SH7751_BCR2), SH7751_PCIBCR2);
-	p4_out(inl(SH7751_BCR3), SH7751_PCIBCR3);
+	p4_out(inw(SH7751_BCR2), SH7751_PCIBCR2);
+	p4_out(inw(SH7751_BCR3), SH7751_PCIBCR3);
 	p4_out(inl(SH7751_WCR1), SH7751_PCIWCR1);
 	p4_out(inl(SH7751_WCR2), SH7751_PCIWCR2);
 	p4_out(inl(SH7751_WCR3), SH7751_PCIWCR3);
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] SH4: SCI improvement
  2008-11-23 14:41 [Qemu-devel] [PATCH] SH4: SCI improvement Shin-ichiro KAWASAKI
  2008-11-23 22:26 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2008-12-07 22:46 ` Aurelien Jarno
  2008-12-08  3:50 ` Paul Mundt
  2 siblings, 0 replies; 9+ messages in thread
From: Aurelien Jarno @ 2008-12-07 22:46 UTC (permalink / raw)
  To: qemu-devel

On Sun, Nov 23, 2008 at 11:41:25PM +0900, Shin-ichiro KAWASAKI wrote:
> This patch simply implement one register of SH4's SCI := Serial Communication Interface.
> 
> R2D evaluation board uses SCI for SPI connection.  So, Linux kernel for R2D with
> default configuration causes a QEMU assertion failure when it initializes SPI driver.
> This patch avoids it and reduces the kernel config modification work for QEMU.
> 
> Completing SCI implementation task is left.  Other board support is desirable to confirm
> this task, which uses SCI for a serial terminal.
> 
> Regards,
> Shin-ichiro KAWASAKI
 
Thanks, applied.

> Signed-off-by: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>
> 
> Index: trunk/hw/sh_serial.c
> ===================================================================
> --- trunk/hw/sh_serial.c	(revision 5771)
> +++ trunk/hw/sh_serial.c	(working copy)
> @@ -168,19 +168,19 @@
>          }
>      }
>      else {
> +        switch(offs) {
>  #if 0
> -        switch(offs) {
>          case 0x0c:
>              ret = s->dr;
>              break;
>          case 0x10:
>              ret = 0;
>              break;
> +#endif
>          case 0x1c:
> -            ret = s->sptr;
> -            break;
> +            s->sptr = val & 0x8f;
> +            return;
>          }
> -#endif
>      }
>  
>      fprintf(stderr, "sh_serial: unsupported write to 0x%02x\n", offs);
> @@ -260,8 +260,8 @@
>          }
>      }
>      else {
> +        switch(offs) {
>  #if 0
> -        switch(offs) {
>          case 0x0c:
>              ret = s->dr;
>              break;
> @@ -271,11 +271,11 @@
>          case 0x14:
>              ret = s->rx_fifo[0];
>              break;
> +#endif
>          case 0x1c:
>              ret = s->sptr;
>              break;
>          }
> -#endif
>      }
>  #ifdef DEBUG_SERIAL
>      printf("sh_serial: read base=0x%08lx offs=0x%02x val=0x%x\n",
> 
> 
> 

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] SH4: SCI improvement
  2008-11-23 14:41 [Qemu-devel] [PATCH] SH4: SCI improvement Shin-ichiro KAWASAKI
  2008-11-23 22:26 ` Jean-Christophe PLAGNIOL-VILLARD
  2008-12-07 22:46 ` Aurelien Jarno
@ 2008-12-08  3:50 ` Paul Mundt
  2008-12-08 15:25   ` Shin-ichiro KAWASAKI
  2 siblings, 1 reply; 9+ messages in thread
From: Paul Mundt @ 2008-12-08  3:50 UTC (permalink / raw)
  To: Shin-ichiro KAWASAKI; +Cc: qemu-devel

On Sun, Nov 23, 2008 at 11:41:25PM +0900, Shin-ichiro KAWASAKI wrote:
> This patch simply implement one register of SH4's SCI := Serial Communication Interface.
> 
> R2D evaluation board uses SCI for SPI connection.  So, Linux kernel for R2D with
> default configuration causes a QEMU assertion failure when it initializes SPI driver.
> This patch avoids it and reduces the kernel config modification work for QEMU.
> 
> Completing SCI implementation task is left.  Other board support is desirable to confirm
> this task, which uses SCI for a serial terminal.
> 
> Regards,
> Shin-ichiro KAWASAKI
> 
> 
> Signed-off-by: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>
> 
After this, are you able to use the standard defconfig for R2D? If so, I
can kill off the qemu defconfig in-tree. If not, please send updates for
the qemu defconfig so we can make sure that the kernel and the qemu tree
are in sync with regards to feature completeness.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] SH4: SCI improvement
  2008-12-08  3:50 ` Paul Mundt
@ 2008-12-08 15:25   ` Shin-ichiro KAWASAKI
  0 siblings, 0 replies; 9+ messages in thread
From: Shin-ichiro KAWASAKI @ 2008-12-08 15:25 UTC (permalink / raw)
  To: qemu-devel

Paul Mundt wrote:
> On Sun, Nov 23, 2008 at 11:41:25PM +0900, Shin-ichiro KAWASAKI wrote:
>> This patch simply implement one register of SH4's SCI := Serial Communication Interface.
>>
>> R2D evaluation board uses SCI for SPI connection.  So, Linux kernel for R2D with
>> default configuration causes a QEMU assertion failure when it initializes SPI driver.
>> This patch avoids it and reduces the kernel config modification work for QEMU.
>>
>> Completing SCI implementation task is left.  Other board support is desirable to confirm
>> this task, which uses SCI for a serial terminal.
>>
>> Regards,
>> Shin-ichiro KAWASAKI
>>
>>
>> Signed-off-by: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>
>>
> After this, are you able to use the standard defconfig for R2D? 

Yes.  With current QEMU svn HEAD, we can use rts7751r2dplus_defconfig
with no kernel halts nor segmentation fault.
# USB and NIC are not available, but drivers for them cause no drawbacks.

> If so, I
> can kill off the qemu defconfig in-tree. If not, please send updates for
> the qemu defconfig so we can make sure that the kernel and the qemu tree
> are in sync with regards to feature completeness.

I think the qemu defconfig's role is over.
It's earlier than I expected.  Thank you all!

Regards,
Shin-ichiro KAWASAKI

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] SH4: SCI improvement
  2008-12-06  9:44     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2008-12-14 11:55       ` Shin-ichiro KAWASAKI
  2008-12-14 14:53         ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 9+ messages in thread
From: Shin-ichiro KAWASAKI @ 2008-12-14 11:55 UTC (permalink / raw)
  To: qemu-devel

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 13:39 Mon 24 Nov     , Shin-ichiro KAWASAKI wrote:
>> Hi, Jean-san!
>>
>> It seems a good idea to make u-boot run on SH4-QEMU,
>> for brushing up SH4 emulation.
>>
>> Jean-Christophe PLAGNIOL-VILLARD wrote:
>>> 	I've add the flash support at 0xA0000000
>>> 	and have qemu refusing to boot from it
>>> 	qemu: fatal: Trying to execute code outside RAM or ROM at 0xa000000A
>>> 	I've also try to boot u-boot as a kernel and have the output working
>>> 	but not the input. Impossible to type anything
>> I'm afraid that I have no idea about these two points now.
>> I just guess MMU emulation and SCIF emulation might not be enough to run u-boot.
>>
>> To investigate them more closely, I downloaded current u-boot git repository,
>> build if for r2d, and run u-boot.bin with -kernel option.  But u-boot couldn't
>> boot with assertion failures.  Following two parts caused them.
>>
>> - MMUCR initialization with 16 bit word write causes failure.
>>   QEMU only implements 32 bit write for it, following SH7750 document.
>> - BSC's PCR access cause failure.   QEMU does not implement it yet.
>>
>> Have you handled them?
>>
> you need to apply 1 patch on u-boot
> 
> r2dplus fix register access
> I've send to the U-Boot ML
> 
> and 2 patchs to qemu
> 
>>From you
> sh4: pci and mmu support
> and from I
> SH7750/51: add register BCR3, NCR4, PCR, RTCOR, RTCNT, RTCSR, SDMR2, SDMR3 and
> fix BCR2 support

Thanks.

One more simple modification seems necessary to avoid assertion error,
as attached to this mail.  With these patches, I saw that the U-boot
for r2dplus boots cleanly when it is passed with -kernel option to qemu.
Does it help you?
# Please be sure to give two '-serial' options in qemu command line.

I'm interested in the flash support, which will make it more easy
to handle linux kernel boot conditions for qemu-sh users.

Regards,
Shin-ichiro KAWASAKI


diff --git a/hw/sh_serial.c b/hw/sh_serial.c
index da1a2ca..bf1d609 100644
--- a/hw/sh_serial.c
+++ b/hw/sh_serial.c
@@ -242,11 +242,9 @@ static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs)
                     s->flags &= ~SH_SERIAL_FLAG_RDF;
             }
             break;
-#if 0
         case 0x18:
             ret = s->fcr;
             break;
-#endif
         case 0x1c:
             ret = s->rx_cnt;
             break;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] SH4: SCI improvement
  2008-12-14 11:55       ` Shin-ichiro KAWASAKI
@ 2008-12-14 14:53         ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-12-14 14:53 UTC (permalink / raw)
  To: qemu-devel

On 20:55 Sun 14 Dec     , Shin-ichiro KAWASAKI wrote:
> Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 13:39 Mon 24 Nov     , Shin-ichiro KAWASAKI wrote:
> >> Hi, Jean-san!
> >>
> >> It seems a good idea to make u-boot run on SH4-QEMU,
> >> for brushing up SH4 emulation.
> >>
> >> Jean-Christophe PLAGNIOL-VILLARD wrote:
> >>> 	I've add the flash support at 0xA0000000
> >>> 	and have qemu refusing to boot from it
> >>> 	qemu: fatal: Trying to execute code outside RAM or ROM at 0xa000000A
> >>> 	I've also try to boot u-boot as a kernel and have the output working
> >>> 	but not the input. Impossible to type anything
> >> I'm afraid that I have no idea about these two points now.
> >> I just guess MMU emulation and SCIF emulation might not be enough to run u-boot.
> >>
> >> To investigate them more closely, I downloaded current u-boot git repository,
> >> build if for r2d, and run u-boot.bin with -kernel option.  But u-boot couldn't
> >> boot with assertion failures.  Following two parts caused them.
> >>
> >> - MMUCR initialization with 16 bit word write causes failure.
> >>   QEMU only implements 32 bit write for it, following SH7750 document.
> >> - BSC's PCR access cause failure.   QEMU does not implement it yet.
> >>
> >> Have you handled them?
> >>
> > you need to apply 1 patch on u-boot
> > 
> > r2dplus fix register access
> > I've send to the U-Boot ML
> > 
> > and 2 patchs to qemu
> > 
> >>From you
> > sh4: pci and mmu support
> > and from I
> > SH7750/51: add register BCR3, NCR4, PCR, RTCOR, RTCNT, RTCSR, SDMR2, SDMR3 and
> > fix BCR2 support
> 
> Thanks.
> 
> One more simple modification seems necessary to avoid assertion error,
> as attached to this mail.  With these patches, I saw that the U-boot
> for r2dplus boots cleanly when it is passed with -kernel option to qemu.
> Does it help you?
> # Please be sure to give two '-serial' options in qemu command line.
> 
> I'm interested in the flash support, which will make it more easy
> to handle linux kernel boot conditions for qemu-sh users.
I've add it but I need to add the 0xa0000000 accessible
Maybe Yoshii-san have a patch about it

Best Regards,
J.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-12-14 14:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-23 14:41 [Qemu-devel] [PATCH] SH4: SCI improvement Shin-ichiro KAWASAKI
2008-11-23 22:26 ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-24  4:39   ` Shin-ichiro KAWASAKI
2008-12-06  9:44     ` Jean-Christophe PLAGNIOL-VILLARD
2008-12-14 11:55       ` Shin-ichiro KAWASAKI
2008-12-14 14:53         ` Jean-Christophe PLAGNIOL-VILLARD
2008-12-07 22:46 ` Aurelien Jarno
2008-12-08  3:50 ` Paul Mundt
2008-12-08 15:25   ` Shin-ichiro KAWASAKI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).