All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] grlib_apbuart: always enable tx and rx
@ 2018-03-01 10:02 KONRAD Frederic
  2018-03-01 10:49 ` [Qemu-devel] [Qemu-trivial] " Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: KONRAD Frederic @ 2018-03-01 10:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: jcd, chouteau, mark.cave-ayland, qemu-trivial, frederic.konrad

We often use a bootloader for this board. So lets set the uart in a state
which it can emit characters as if we were using a bootloader.

Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
---
 hw/char/grlib_apbuart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c
index bac11be..a8020ea 100644
--- a/hw/char/grlib_apbuart.c
+++ b/hw/char/grlib_apbuart.c
@@ -265,8 +265,8 @@ static void grlib_apbuart_reset(DeviceState *d)
 
     /* Transmitter FIFO and shift registers are always empty in QEMU */
     uart->status =  UART_TRANSMIT_FIFO_EMPTY | UART_TRANSMIT_SHIFT_EMPTY;
-    /* Everything is off */
-    uart->control = 0;
+    /* Enable Tx and Rx as the bootloader would do */
+    uart->control = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE;
     /* Flush receive FIFO */
     uart->len = 0;
     uart->current = 0;
-- 
1.8.3.1

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] grlib_apbuart: always enable tx and rx
  2018-03-01 10:02 [Qemu-devel] [PATCH] grlib_apbuart: always enable tx and rx KONRAD Frederic
@ 2018-03-01 10:49 ` Philippe Mathieu-Daudé
  2018-03-01 14:32   ` KONRAD Frederic
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-03-01 10:49 UTC (permalink / raw)
  To: KONRAD Frederic, qemu-devel; +Cc: qemu-trivial, mark.cave-ayland, jcd

Hi Frederic,

On 03/01/2018 07:02 AM, KONRAD Frederic wrote:
> We often use a bootloader for this board. So lets set the uart in a state
> which it can emit characters as if we were using a bootloader.
> 
> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
> ---
>  hw/char/grlib_apbuart.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c
> index bac11be..a8020ea 100644
> --- a/hw/char/grlib_apbuart.c
> +++ b/hw/char/grlib_apbuart.c
> @@ -265,8 +265,8 @@ static void grlib_apbuart_reset(DeviceState *d)
>  
>      /* Transmitter FIFO and shift registers are always empty in QEMU */
>      uart->status =  UART_TRANSMIT_FIFO_EMPTY | UART_TRANSMIT_SHIFT_EMPTY;
> -    /* Everything is off */
> -    uart->control = 0;
> +    /* Enable Tx and Rx as the bootloader would do */
> +    uart->control = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE;

I don't think this is the correct approach, as we want to reflect the
real hardware behavior here.

I think the correct QEMU-way is add a tiny asm bootloader in ram in
leon3_generic_hw_init(), which enables the UART.
See write_bootloader() in hw/mips/mips_fulong2e.c for example.

Regards,

Phil.

>      /* Flush receive FIFO */
>      uart->len = 0;
>      uart->current = 0;
> 

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] grlib_apbuart: always enable tx and rx
  2018-03-01 10:49 ` [Qemu-devel] [Qemu-trivial] " Philippe Mathieu-Daudé
@ 2018-03-01 14:32   ` KONRAD Frederic
  0 siblings, 0 replies; 3+ messages in thread
From: KONRAD Frederic @ 2018-03-01 14:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, mark.cave-ayland, jcd

Hi Phil,

I see your point. But I tend to prefer modifying the uart than
having a bunch of hand assembled code in the machine.

Note that the result is the same.

Thanks,
Fred

On 03/01/2018 11:49 AM, Philippe Mathieu-Daudé wrote:
> Hi Frederic,
> 
> On 03/01/2018 07:02 AM, KONRAD Frederic wrote:
>> We often use a bootloader for this board. So lets set the uart in a state
>> which it can emit characters as if we were using a bootloader.
>>
>> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
>> ---
>>   hw/char/grlib_apbuart.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c
>> index bac11be..a8020ea 100644
>> --- a/hw/char/grlib_apbuart.c
>> +++ b/hw/char/grlib_apbuart.c
>> @@ -265,8 +265,8 @@ static void grlib_apbuart_reset(DeviceState *d)
>>   
>>       /* Transmitter FIFO and shift registers are always empty in QEMU */
>>       uart->status =  UART_TRANSMIT_FIFO_EMPTY | UART_TRANSMIT_SHIFT_EMPTY;
>> -    /* Everything is off */
>> -    uart->control = 0;
>> +    /* Enable Tx and Rx as the bootloader would do */
>> +    uart->control = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE;
> 
> I don't think this is the correct approach, as we want to reflect the
> real hardware behavior here.
> 
> I think the correct QEMU-way is add a tiny asm bootloader in ram in
> leon3_generic_hw_init(), which enables the UART.
> See write_bootloader() in hw/mips/mips_fulong2e.c for example.
> 
> Regards,
> 
> Phil.
> 
>>       /* Flush receive FIFO */
>>       uart->len = 0;
>>       uart->current = 0;
>>

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

end of thread, other threads:[~2018-03-01 14:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01 10:02 [Qemu-devel] [PATCH] grlib_apbuart: always enable tx and rx KONRAD Frederic
2018-03-01 10:49 ` [Qemu-devel] [Qemu-trivial] " Philippe Mathieu-Daudé
2018-03-01 14:32   ` KONRAD Frederic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.