[U-Boot] [PATCH 04/12] ns16550: add generic binding to unify the drivers

Thomas Chou thomas at wytron.com.tw
Wed Nov 18 02:59:42 CET 2015


Hi Bin,

On 2015年11月18日 09:03, Bin Meng wrote:
>> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
>> index 8d028de..f0a9aac 100644
>> --- a/drivers/serial/ns16550.c
>> +++ b/drivers/serial/ns16550.c
>> @@ -56,6 +56,10 @@ DECLARE_GLOBAL_DATA_PTR;
>>
>>   #ifdef CONFIG_DM_SERIAL
>>
>> +#ifndef CONFIG_SYS_NS16550_CLK
>> +#define CONFIG_SYS_NS16550_CLK  0
>> +#endif
>> +
>>   static inline void serial_out_shift(void *addr, int shift, int value)
>>   {
>>   #ifdef CONFIG_SYS_NS16550_PORT_MAPPED
>> @@ -400,6 +404,15 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
>>          plat->base = addr;
>>          plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
>>                                           "reg-shift", 1);
>> +#ifdef CONFIG_NS16550_SERIAL
>
> Is this #ifdef necessary?
>
>> +       plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
>> +                                    "clock-frequency",
>> +                                    CONFIG_SYS_NS16550_CLK);
>> +       if (!plat->clock) {
>> +               debug("ns16550 clock not defined\n");
>> +               return -EINVAL;
>> +       }
>> +#endif /* CONFIG_NS16550_SERIAL */
>>
>>          return 0;
>>   }
>> @@ -411,4 +424,35 @@ const struct dm_serial_ops ns16550_serial_ops = {
>>          .getc = ns16550_serial_getc,
>>          .setbrg = ns16550_serial_setbrg,
>>   };
>> +
>> +#ifdef CONFIG_NS16550_SERIAL
>
> Ditto.

These #ifdef is needed during the transition. They will be removed as a 
follow-up of this series.

>
>> +#if CONFIG_IS_ENABLED(OF_CONTROL)
>
> This line should be removed too?
>

Some spl build with DM platdata but not of_control. So this is needed.

Best regards,
Thomas


More information about the U-Boot mailing list