public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] dm: serial: Do not panic if no serial ports are found
Date: Wed, 8 Jul 2015 13:56:26 +0200	[thread overview]
Message-ID: <559D0FEA.7070401@redhat.com> (raw)
In-Reply-To: <559B792B.7080305@redhat.com>

Hi Simon,

On 07-07-15 09:00, Hans de Goede wrote:
> Hi,
>
> On 06-07-15 18:39, Simon Glass wrote:
>> Hi Hans,
>>
>> On 5 July 2015 at 12:56, Hans de Goede <hdegoede@redhat.com> wrote:
>>> Some boards simply do not have any serial ports. Also no one will see the
>>> panic message as there is no where to print it if no serial port is found
>>> (and other stdout options are not yet set up at this point).
>>>
>>
>> It is visible (or will be when some patches land) if you have a debug
>> UART set up.
>
> Ok.
>
>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>> ---
>>>   drivers/serial/serial-uclass.c | 8 +++-----
>>>   1 file changed, 3 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
>>> index 815fec3..f036499 100644
>>> --- a/drivers/serial/serial-uclass.c
>>> +++ b/drivers/serial/serial-uclass.c
>>> @@ -27,7 +27,7 @@ static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE;
>>>   #error "Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN to make this work"
>>>   #endif
>>>
>>> -static void serial_find_console_or_panic(void)
>>> +static void serial_find_console(void)
>>>   {
>>>          struct udevice *dev;
>>>          int node;
>>> @@ -77,14 +77,12 @@ static void serial_find_console_or_panic(void)
>>>                  }
>>>   #undef INDEX
>>>          }
>>> -
>>> -       panic_str("No serial driver found");
>>>   }
>>>
>>>   /* Called prior to relocation */
>>>   int serial_init(void)
>>>   {
>>> -       serial_find_console_or_panic();
>>> +       serial_find_console();
>>>          gd->flags |= GD_FLG_SERIAL_READY;
>>>
>>>          return 0;
>>> @@ -93,7 +91,7 @@ int serial_init(void)
>>>   /* Called after relocation */
>>>   void serial_initialize(void)
>>>   {
>>> -       serial_find_console_or_panic();
>>> +       serial_find_console();
>>>   }
>>>
>>>   static void _serial_putc(struct udevice *dev, char ch)
>>
>> How is this handled before driver model?
>
> It was not, the boards involved all use the A13 SoC which is the
> same die as the A10s but then in a different (cheaper) package
> with way less pins. As such uart0 is not routed to the outside
> on the A13. When not setting CONFIG_DM_SERIAL we are simply using
> uart0 as serial console, and that ends at the bonding pads at the
> edge of the die. doing things that way is not really useful,
> but there is a serial console and u-boot is happy.
>
> In the non devicetree world this sort of was a natural hack, we
> simply left CONSOLE_INDEX undefined for these boards, which causes
> it to default to 1 / uart0 and things just work. I had never given
> this much thought until moving to devicetree.
>
> As you can hopefully understand I do not want to do the samething
> with DM_SERIAL builds as that would require hacking up the dts
> to add a node for hardware which is effectively disabled for the
> A13 package of the sun5i die.
>
>  > It is possible to mark a
>> device disabled in device tree - perhaps we should have a way to see
>> that the console is present (i.e. there is an alias) but it is
>> disabled?
>
> That seems rather ugly, I really do not want to add an alias to
> a non enabled device, that just feels wrong on all levels.
>
>> Normally a serial console is required, so I'd like to preserve this
>> behaviour for most boards.
>
> Ok, I actually expected as much, this was actually my second solution
> for the problem at hand, but as it was the simplest solution I decided
> to submit this version first. My first / original solution is to add a
> CONFIG_DM_SERIAL_NO_PANIC Kconfig option which can then be set on boards
> which have no serial port.
>
> Or probably better a CONFIG_DM_SERIAL_NO_SERIAL_CONSOLE option ?
>
> This option would disable the panic / disable probing all together while
> we would keep using DM_SERIAL on these boards, because:
>
> 1) Consistency I really want to use DM_FOO everywhere for sunxi
> 2) The non dm serial code cannot handle not having a serial port either,
>     and fixing it looks like it is going to be a bit harder (from a quick
>     glance).

You probably just have not gotten around to this yet, but in case it is
not clear, the above solution (adding a CONFIG_DM_SERIAL_NO_SERIAL_CONSOLE
Kconfig option) is a suggestion on how to fix. I'll happily implement this
if people like it, but atm I'm waiting for feedback on the suggestion.

Regards,

Hans

p.s.

I'm on vacation from July 11th - July 19th, so if I'm quiet that is why :)

  reply	other threads:[~2015-07-08 11:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-05 18:56 [U-Boot] [PATCH 0/3] sunxi: Update selects in arch/arm/Kconfig for DM Hans de Goede
2015-07-05 18:56 ` [U-Boot] [PATCH 1/3] dm: serial: Do not panic if no serial ports are found Hans de Goede
2015-07-06 16:39   ` Simon Glass
2015-07-07  7:00     ` Hans de Goede
2015-07-08 11:56       ` Hans de Goede [this message]
2015-07-08 14:08         ` Simon Glass
2015-07-08 14:16           ` Hans de Goede
2015-07-08 20:20             ` Simon Glass
2015-07-05 18:56 ` [U-Boot] [PATCH 2/3] sunxi: Update selects in arch/arm/Kconfig for DM conversions Hans de Goede
2015-07-06 16:39   ` Simon Glass
2015-07-07  7:27   ` Ian Campbell
2015-07-05 18:56 ` [U-Boot] [PATCH 3/3] sunxi: Enable CMD_USB and USB_STORAGE by default on sunxi Hans de Goede
2015-07-06 16:39   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=559D0FEA.7070401@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox