[U-Boot] [PATCH 01/10] dm: imx: serial: support device tree
Stefan Agner
stefan at agner.ch
Mon Aug 29 02:00:31 CEST 2016
On 2016-08-26 07:10, Stefano Babic wrote:
> On 26/07/2016 08:22, Stefan Agner wrote:
>> From: Stefan Agner <stefan.agner at toradex.com>
>>
>> Support instatiation through device tree. Also parse the fsl,dte-mode
>> property to determine whether DTE mode shall be used.
>>
>> Signed-off-by: Stefan Agner <stefan.agner at toradex.com>
>> ---
>> The kernel uses fsl,imx21-uart as "base" compatible, should we follow
>> that?
>>
>> doc/device-tree-bindings/serial/mxc-serial.txt | 8 ++++++++
>> drivers/serial/serial_mxc.c | 28 ++++++++++++++++++++++++--
>> 2 files changed, 34 insertions(+), 2 deletions(-)
>> create mode 100644 doc/device-tree-bindings/serial/mxc-serial.txt
>>
>> diff --git a/doc/device-tree-bindings/serial/mxc-serial.txt b/doc/device-tree-bindings/serial/mxc-serial.txt
>> new file mode 100644
>> index 0000000..ede92a4
>> --- /dev/null
>> +++ b/doc/device-tree-bindings/serial/mxc-serial.txt
>> @@ -0,0 +1,8 @@
>> +NXP i.MX (MXC) UART
>> +
>> +Required properties:
>> +- compatible: must be "fsl,imx7d-uart"
>> +- reg: start address and size of the registers
>> +
>> +Optional properties:
>> +- fsl,dte-mode: use DTE mode
>> diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
>> index 1960bbc..bd850d7 100644
>> --- a/drivers/serial/serial_mxc.c
>> +++ b/drivers/serial/serial_mxc.c
>> @@ -108,6 +108,8 @@
>> #define UTS_RXFULL (1<<3) /* RxFIFO full */
>> #define UTS_SOFTRST (1<<0) /* Software reset */
>>
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> #ifndef CONFIG_DM_SERIAL
>>
>> #ifndef CONFIG_MXC_UART_BASE
>> @@ -135,8 +137,6 @@
>> #define UBRC 0xac /* Baud Rate Count Register */
>> #define UTS 0xb4 /* UART Test Register (mx31) */
>>
>> -DECLARE_GLOBAL_DATA_PTR;
>> -
>> #define TXTL 2 /* reset default */
>> #define RXTL 1 /* reset default */
>> #define RFDIV 4 /* divide input clock by 2 */
>> @@ -348,9 +348,33 @@ static const struct dm_serial_ops mxc_serial_ops = {
>> .setbrg = mxc_serial_setbrg,
>> };
>>
>> +static int mxc_serial_ofdata_to_platdata(struct udevice *dev)
>> +{
>> + struct mxc_serial_platdata *plat = dev->platdata;
>> + fdt_addr_t addr;
>> +
>> + addr = dev_get_addr(dev);
>> + if (addr == FDT_ADDR_T_NONE)
>> + return -EINVAL;
>> +
>> + plat->reg = (struct mxc_uart *)addr;
>> +
>> + plat->use_dte = fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
>> + "fsl,dte-mode");
>
> I have applied it, I just noted a slight drawback because this breaks
> boards that do not have CONFIG_FIT set.
Hm, maybe due to missing CONFIG_OF_LIBFDT? Do you want me to fix it, do
you have a certain board you can reproduce it?
--
Stefan
More information about the U-Boot
mailing list