diff mbox

[5/5] tty: amba-pl011: Add earlycon support for SBSA UART

Message ID 1474708465-38958-6-git-send-email-wangkefeng.wang@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kefeng Wang Sept. 24, 2016, 9:14 a.m. UTC
Declare an OF early console for SBSA UART so that the early console device
can be specified via the "stdout-path" property in device-tree.

Cc: Russell King <linux@armlinux.org.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/tty/serial/amba-pl011.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Greg KH Sept. 27, 2016, 10:57 a.m. UTC | #1
On Sat, Sep 24, 2016 at 05:14:25PM +0800, Kefeng Wang wrote:
> Declare an OF early console for SBSA UART so that the early console device
> can be specified via the "stdout-path" property in device-tree.
> 
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/tty/serial/amba-pl011.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 7d9b291..3688d3b 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -2330,6 +2330,7 @@ static int __init pl011_early_console_setup(struct earlycon_device *device,
>  	return 0;
>  }
>  OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);
> +OF_EARLYCON_DECLARE(pl011, "arm,sbsa-uart", pl011_early_console_setup);

Why do you need another option for the same thing?

confused,

greg k-h
Kefeng Wang Sept. 27, 2016, 1:15 p.m. UTC | #2
On 2016/9/27 18:57, Greg Kroah-Hartman wrote:
> On Sat, Sep 24, 2016 at 05:14:25PM +0800, Kefeng Wang wrote:
>> Declare an OF early console for SBSA UART so that the early console device
>> can be specified via the "stdout-path" property in device-tree.
>>
>> Cc: Russell King <linux@armlinux.org.uk>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
>>  drivers/tty/serial/amba-pl011.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
>> index 7d9b291..3688d3b 100644
>> --- a/drivers/tty/serial/amba-pl011.c
>> +++ b/drivers/tty/serial/amba-pl011.c
>> @@ -2330,6 +2330,7 @@ static int __init pl011_early_console_setup(struct earlycon_device *device,
>>  	return 0;
>>  }
>>  OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);
>> +OF_EARLYCON_DECLARE(pl011, "arm,sbsa-uart", pl011_early_console_setup);
> 
> Why do you need another option for the same thing?


It is used to support earlycon(without option) for sbsa-uart in bootargs.

	chosen {
		stdout-path = "serial0:115200n8";
		bootargs = "earlycon"
	};

	uart0: uart@602b0000 {
		compatible = "arm,sbsa-uart";
		reg = <0x0 0x602b0000 0x0 0x1000>;
		...
	};

We setup a unique struct with compatible name by OF_EARLYCON_DECLARE,
#define OF_EARLYCON_DECLARE(_name, compat, fn)				\
	static const struct earlycon_id __UNIQUE_ID(__earlycon_##_name)	\
	     __used __section(__earlycon_table)				\
		= { .name = __stringify(_name),				\
		    .compatible = compat,				\
		    .setup = fn  }

if without this patch(see drivers/of/fdt.c),

early_init_dt_scan_chosen_serial()
 - for (match = __earlycon_table; match < __earlycon_table_end; match++)
  -- if (fdt_node_check_compatible(fdt, offset, match->compatible))
	countinue;
  -- of_setup_earlycon(match, offset, options); // will never touch here.

Thanks,
Kefeng

> 
> confused,
> 
> greg k-h
> 
> .
>
Kefeng Wang Oct. 24, 2016, 3:59 a.m. UTC | #3
Hi Greg, any more comments, thanks.

On 2016/9/27 21:15, Kefeng Wang wrote:
> 
> 
> On 2016/9/27 18:57, Greg Kroah-Hartman wrote:
>> On Sat, Sep 24, 2016 at 05:14:25PM +0800, Kefeng Wang wrote:
>>> Declare an OF early console for SBSA UART so that the early console device
>>> can be specified via the "stdout-path" property in device-tree.
>>>
>>> Cc: Russell King <linux@armlinux.org.uk>
>>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>>> ---
>>>  drivers/tty/serial/amba-pl011.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
>>> index 7d9b291..3688d3b 100644
>>> --- a/drivers/tty/serial/amba-pl011.c
>>> +++ b/drivers/tty/serial/amba-pl011.c
>>> @@ -2330,6 +2330,7 @@ static int __init pl011_early_console_setup(struct earlycon_device *device,
>>>  	return 0;
>>>  }
>>>  OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);
>>> +OF_EARLYCON_DECLARE(pl011, "arm,sbsa-uart", pl011_early_console_setup);
>>
>> Why do you need another option for the same thing?
> 
> 
> It is used to support earlycon(without option) for sbsa-uart in bootargs.
> 
> 	chosen {
> 		stdout-path = "serial0:115200n8";
> 		bootargs = "earlycon"
> 	};
> 
> 	uart0: uart@602b0000 {
> 		compatible = "arm,sbsa-uart";
> 		reg = <0x0 0x602b0000 0x0 0x1000>;
> 		...
> 	};
> 
> We setup a unique struct with compatible name by OF_EARLYCON_DECLARE,
> #define OF_EARLYCON_DECLARE(_name, compat, fn)				\
> 	static const struct earlycon_id __UNIQUE_ID(__earlycon_##_name)	\
> 	     __used __section(__earlycon_table)				\
> 		= { .name = __stringify(_name),				\
> 		    .compatible = compat,				\
> 		    .setup = fn  }
> 
> if without this patch(see drivers/of/fdt.c),
> 
> early_init_dt_scan_chosen_serial()
>  - for (match = __earlycon_table; match < __earlycon_table_end; match++)
>   -- if (fdt_node_check_compatible(fdt, offset, match->compatible))
> 	countinue;
>   -- of_setup_earlycon(match, offset, options); // will never touch here.
> 
> Thanks,
> Kefeng
> 
>>
>> confused,
>>
>> greg k-h
>>
>> .
>>
> 
> 
> .
>
Greg KH Oct. 27, 2016, 3:18 p.m. UTC | #4
On Mon, Oct 24, 2016 at 11:59:20AM +0800, Kefeng Wang wrote:
> Hi Greg, any more comments, thanks.

Never wait, just resend if you have comments and you know you have to
fix them up...
Kefeng Wang Oct. 30, 2016, 8:49 a.m. UTC | #5
On 2016/10/27 23:18, Greg Kroah-Hartman wrote:
> On Mon, Oct 24, 2016 at 11:59:20AM +0800, Kefeng Wang wrote:
>> Hi Greg, any more comments, thanks.
> 
> Never wait, just resend if you have comments and you know you have to
> fix them up...
> 

Hi Greg, as I mentioned in previous mail, compatible "arm,sbsa-uart" need
be provided by adding a new OF_EARLYCON_DECLARE(), this is the patch's point.

And I no further update, could this patch be acceptable and be picked up?

Thanks,
Kefeng

> .
>
Greg KH Oct. 30, 2016, 1:31 p.m. UTC | #6
On Sun, Oct 30, 2016 at 04:49:30PM +0800, Kefeng Wang wrote:
> 
> 
> On 2016/10/27 23:18, Greg Kroah-Hartman wrote:
> > On Mon, Oct 24, 2016 at 11:59:20AM +0800, Kefeng Wang wrote:
> >> Hi Greg, any more comments, thanks.
> > 
> > Never wait, just resend if you have comments and you know you have to
> > fix them up...
> > 
> 
> Hi Greg, as I mentioned in previous mail, compatible "arm,sbsa-uart" need
> be provided by adding a new OF_EARLYCON_DECLARE(), this is the patch's point.
> 
> And I no further update, could this patch be acceptable and be picked up?

It's long gone from my queue, please resend it if you think it should be
applied.

thanks,

greg k-h
diff mbox

Patch

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 7d9b291..3688d3b 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2330,6 +2330,7 @@  static int __init pl011_early_console_setup(struct earlycon_device *device,
 	return 0;
 }
 OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);
+OF_EARLYCON_DECLARE(pl011, "arm,sbsa-uart", pl011_early_console_setup);
 
 #else
 #define AMBA_CONSOLE	NULL