Re: [PATCH 2/6] serial: samsung: Add device tree support for s5pv210 uart driver
On Fri, Jun 24, 2011 at 6:27 AM, Thomas Abraham wrote: > Hi Grant, > > On 24 June 2011 01:38, Grant Likely wrote: >> Despite the fact that this is exactly what I asked you to write, this >> ends up being rather ugly. (I originally put in the '*4' to match the >> behaviour of the existing of_read_number(), but that was a mistake. >> tglx also pointed it out). How about this instead: > > Your draft implementation below is suggesting that the offset should > be in bytes and not cells and so maybe you are suggesting the new > approach to support multi-format property values. I have changed the > implementation as per your code below. I've been going back and forth on this. The offset is most flexible if it is in bytes, but most DT data is organized into cells, so a byte offset is a little intuitive. For string properties, it really doesn't make sense to have the offset in bytes because the offset generally either cannot be known until after reading earlier values in the property, or is meaningless without the earlier data in the case of mixed value properties. However, I think I've gotten caught up into a case of feature creep on these functions and I've tried to make them as flexible as possible. The reality is that it will almost never be useful to obtain only the 2nd or 3rd cell in a property. In those cases, the driver probably needs to parse all the data in the property, and therefore it is better to obtain a pointer to the entire data block for parsing instead of searching for the property over and over again (which is what of_getprop_u32() will do). So, I'm changing the design (for the last time, I promise!). Rather than trying to solve some future theoretical use case, the functions should focus on what is actually needed immediately. Let's drop the u64 version, and only implement of_getprop_u32() and of_getprop_string(). u64 can always be added at a later date if we need it. Also, we'll drop the offset parameter because I don't foresee any situation where it is the right thing to do. Something like this (modifying your latest code): /** * of_property_read_u32 - Find a property in a device node and read a 32-bit value * @np: device node from which the property value is to be read. * @propname: name of the property to be searched. * @out_value: returned value. * * Search for a property in a device node and read a 32-bit value from a * property. Returns -EINVAL, if the property does not exist, -ENODATA, if * property does not have a value, -EOVERFLOW, if the property data isn't large * enough, and 0 on success. * * The out_value is only modified if a valid u32 can be decoded. */ int of_property_read_u32(struct device_node *np, char *propname, u32 *out_value) { struct property *prop = of_find_property(np, propname, NULL), if (!prop) return -EINVAL; if (!prop->value) return -ENODATA; if (sizeof(*out_value) > prop->length) return -EOVERFLOW; *out_value = be32_to_cpup(prop->value); return 0; } EXPORT_SYMBOL_GPL(of_property_read_u32); /** * of_property_read_u32 - Find a property in a device node and read a 32-bit value * @np: device node from which the property value is to be read. * @propname: name of the property to be searched. * @out_string: pointer to a null terminated string, valid only if the return * value is 0. * * Returns a pointer to a null terminated property string value. Returns -EINVAL, * if the property does not exist, -ENODATA, if property does not have a value, * -EILSEQ, if the string is not null-terminated within the length of the property. * * The out_string value is only modified if a valid string can be decoded. */ int of_property_read_u32(struct device_node *np, char *propname, char **out_string) { struct property *prop = of_find_property(np, propname, NULL), if (!prop) return -EINVAL; if (!prop->value) return -ENODATA; if (strnlen(prop->value, prop->length) == prop->length) return -EILSEQ; *out_string = prop->value; return 0; } EXPORT_SYMBOL_GPL(of_property_read_u32); I think overall this will be the most useful, and it can always be expanded at a later date if more use cases show up. g. ___ linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev
Re: [PATCH 2/6] serial: samsung: Add device tree support for s5pv210 uart driver
Hi Grant, On 24 June 2011 01:38, Grant Likely wrote: > Despite the fact that this is exactly what I asked you to write, this > ends up being rather ugly. (I originally put in the '*4' to match the > behaviour of the existing of_read_number(), but that was a mistake. > tglx also pointed it out). How about this instead: Your draft implementation below is suggesting that the offset should be in bytes and not cells and so maybe you are suggesting the new approach to support multi-format property values. I have changed the implementation as per your code below. > > int of_read_property_u32(struct property *prop, unsigned int offset, > u32 *out_value) > { > if (!prop || !out_value) > return -EINVAL; > if (!prop->value) > return -ENODATA; > if (offset + sizeof(*out_value) > prop->length) > return -EOVERFLOW; > *out_value = be32_to_cpup(prop->data + offset); > return 0; > } [...] >> +/** >> + * of_read_property_string - Returns a pointer to a indexed null terminated >> + * property value string >> + * @prop: property to read from. >> + * @offset: index of the property string to be read. >> + * @string: pointer to a null terminated string, valid only if the return >> + * value is 0. >> + * >> + * Returns a pointer to a indexed null terminated property cell string, >> -EINVAL >> + * in case the cell does not exist. >> + */ >> +int of_read_property_string(struct property *prop, int offset, char >> **string) >> +{ >> + char *c; >> + >> + if (!prop || !prop->value) >> + return -EINVAL; > > Ditto here about return values. > >> + >> + c = (char *)prop->value; > > You don't need the cast. prop->value is a void* pointer. However, > 'c' does need to be const char. > >> + while (offset--) >> + while (*c++) >> + ; > > Rather than open coding this, you should use the string library > functions. Something like: > > c = prop->value; > while (offset-- && (c - prop->value) < prop->size) > c += strlen(c) + 1; > if ((c - prop->value) + strlen(c) >= prop->size) > return -EOVERFLOW; > *out_value = c; > > Plus it catches more error conditions that way. If we change the offset to represent bytes and not cell index in the u32 and u64 versions, shouldn't offset represent bytes for the string version as well? In case of multi-format property values, there could be u32 or u64 values intermixed with string values. So, some modifications have been made to your above implementation of the string version. The new diff is listed below. Would there be any changes required. If this is acceptable, I will submit a separate patch. drivers/of/base.c | 142 include/linux/of.h | 12 2 files changed, 154 insertions(+), 0 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 632ebae..e9acbea 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -596,6 +596,148 @@ struct device_node *of_find_node_by_phandle(phandle handle) EXPORT_SYMBOL(of_find_node_by_phandle); /** + * of_read_property_u32 - Reads a 32-bit property value + * @prop: property to read from. + * @offset:offset into property value to read from (in bytes). + * @out_value: returned value. + * + * Returns a 32-bit value from a property. Returns -EINVAL, if the property does + * not exist, -ENODATA, if property does not have a value, -EOVERFLOW, if + * reading from offset overshoots the length of the property. + */ +int of_read_property_u32(struct property *prop, u32 offset, u32 *out_value) +{ + if (!prop || !out_value) + return -EINVAL; + if (!prop->value) + return -ENODATA; + if (offset + sizeof(*out_value) > prop->length) + return -EOVERFLOW; + + *out_value = be32_to_cpup(prop->value + offset); + return 0; +} +EXPORT_SYMBOL_GPL(of_read_property_u32); + +/** + * of_getprop_u32 - Find a property in a device node and read a 32-bit value + * @np:device node from which the property value is to be read. + * @propname name of the property to be searched. + * @offset:offset into property value to read from (in bytes). + * @out_value: returned value. + * + * Search for a property in a device node and read a 32-bit value from a + * property. Returns -EINVAL, if the property does not exist, -ENODATA, if + * property does not have a value, -EOVERFLOW, if reading from offset overshoots + * the length of the property. + */ +int of_getprop_u32(struct device_node *np, char *propname, int offset, + u32 *out_value) +{ + return of_read_property_u32(of_find_property(np, propname, NULL), + offset, out_value); +} +EXPORT_SYMBOL_GPL(of_getprop_u32); + +/** + * of_read_property_u64 - Reads a 6
Re: [PATCH 2/6] serial: samsung: Add device tree support for s5pv210 uart driver
On Wed, Jun 22, 2011 at 10:22 AM, Thomas Abraham wrote: > > I have added the functions as you have suggested and the diff is > listed below. Could you please review the diff and suggest any changes > required. Thanks Thomas. Comments below... > drivers/of/base.c | 129 > > include/linux/of.h | 10 > 2 files changed, 139 insertions(+), 0 deletions(-) > > diff --git a/drivers/of/base.c b/drivers/of/base.c > index 632ebae..73f0144 100644 > --- a/drivers/of/base.c > +++ b/drivers/of/base.c > @@ -596,6 +596,135 @@ struct device_node > *of_find_node_by_phandle(phandle handle) > EXPORT_SYMBOL(of_find_node_by_phandle); > > /** > + * of_read_property_u32 - Reads a indexed 32-bit property value > + * @prop: property to read from. > + * @offset: cell number to read. > + * value: returned cell value > + * > + * Returns a indexed 32-bit value of a property cell, -EINVAL in case the > cell > + * does not exist > + */ > +int of_read_property_u32(struct property *prop, u32 offset, u32 *value) > +{ > + if (!prop || !prop->value) > + return -EINVAL; Hmmm, it would probably be a good idea to differentiate return code depending on whether or not the property was found vs. the property data not large enough. > + if ((offset + 1) * 4 > prop->length) > + return -EINVAL; > + > + *value = of_read_ulong(prop->value + (offset * 4), 1); > + return 0; Despite the fact that this is exactly what I asked you to write, this ends up being rather ugly. (I originally put in the '*4' to match the behaviour of the existing of_read_number(), but that was a mistake. tglx also pointed it out). How about this instead: int of_read_property_u32(struct property *prop, unsigned int offset, u32 *out_value) { if (!prop || !out_value) return -EINVAL; if (!prop->value) return -ENODATA; if (offset + sizeof(*out_value) > prop->length) return -EOVERFLOW; *out_value = be32_to_cpup(prop->data + offset); return 0; } int of_read_property_u64(struct property *prop, unsigned int offset, u64 *out_value) { if (!prop || !out_value) return -EINVAL; if (!prop->value) return -ENODATA; if (offset + sizeof(*out_value) > prop->length) return -EOVERFLOW; *out_value = be32_to_cpup(prop->value + offset); *out_value = (*out_value << 32) | be32_to_cpup(prop->value + offset + sizeof(u32)); return 0; } > +} > +EXPORT_SYMBOL(of_read_property_u32); EXPORT_SYMBOL_GPL() > + > +/** > + * of_getprop_u32 - Find a property in a device node and read a 32-bit value > + * @np: device node from which the property value is to be > read. > + * @propname name of the property to be searched. > + * @offset: cell number to read. > + * @value: returned value of the cell > + * > + * Search for a property in a device node and read a indexed 32-bit value of > a > + * property cell. Returns the 32-bit cell value, -EINVAL in case the > property or > + * the indexed cell does not exist. > + */ > +int > +of_getprop_u32(struct device_node *np, char *propname, int offset, u32 > *value) > +{ > + return of_read_property_u32(of_find_property(np, propname, NULL), > + offset, value); > +} > +EXPORT_SYMBOL(of_getprop_u32); > + > +/** > + * of_read_property_u64 - Reads a indexed 64-bit property value > + * @prop: property to read from. > + * @offset: cell number to read (each cell is 64-bits). > + * @value: returned cell value > + * > + * Returns a indexed 64-bit value of a property cell, -EINVAL in case the > cell > + * does not exist > + */ > +int of_read_property_u64(struct property *prop, int offset, u64 *value) > +{ > + if (!prop || !prop->value) > + return -EINVAL; > + if ((offset + 1) * 8 > prop->length) > + return -EINVAL; > + > + *value = of_read_number(prop->value + (offset * 8), 2); > + return 0; > +} > +EXPORT_SYMBOL(of_read_property_u64); > + > +/** > + * of_getprop_u64 - Find a property in a device node and read a 64-bit value > + * @np: device node from which the property value is to be > read. > + * @propname name of the property to be searched. > + * @offset: cell number to read (each cell is 64-bits). > + * @value: returned value of the cell > + * > + * Search for a property in a device node and read a indexed 64-bit value of > a > + * property cell. Returns the 64-bit cell value, -EINVAL in case the > property or > + * the indexed cell does not exist. > + */ > +int > +of_getprop_u64(struct device_node *np, char *propname, int offset, u64 > *value) > +{ > + return of_read_property_u64(of_find_property(np, propname, NULL), > + offset, value); > +} > +EXPORT_SYMBOL(of_get
Re: [PATCH 2/6] serial: samsung: Add device tree support for s5pv210 uart driver
Hi Grant, On 20 June 2011 22:13, Grant Likely wrote: > Okay, this is getting ugly (not your fault, but this pattern has > become too common. Can you craft and post a patch that adds the > following functions to drivers/of/base.c and include/linux/of.h > > /* offset in cells, not bytes */ > int dt_decode_u32(struct *property, int offset, u32 *out_val) > { > if (!property || !property->value) > return -EINVAL; > if ((offset + 1) * 4 > property->length) > return -EINVAL; > *out_val = of_read_number(property->value + (offset * 4), 1); > return 0; > } > int dt_decode_u64(struct *property, int offset, u64 *out_val) > { > ... > } > int dt_decode_string(struct *property, int index, char **out_string); > { > ... > } > > Plus a set of companion functions: > int dt_getprop_u32(struct device_node *np, char *propname, int offset, > u32 *out_val) > { > return dt_decode_u32(of_find_property(np, propname, NULL), > offset, out_val); > } > int dt_getprop_u64(struct *device_node, char *propname, int offset, > u64 *out_val); > { > ... > } > int dt_getprop_string(struct *device_node, char *propname, int index, > char **out_string); > { > ... > } > > Then you'll be able to simply do the following to decode each > property, with fifosize being left alone if the property cannot be > found or decoded: > > dt_getprop_u32(pdev->dev.of_node, "samsung,fifosize", &fifosize); I have added the functions as you have suggested and the diff is listed below. Could you please review the diff and suggest any changes required. drivers/of/base.c | 129 include/linux/of.h | 10 2 files changed, 139 insertions(+), 0 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 632ebae..73f0144 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -596,6 +596,135 @@ struct device_node *of_find_node_by_phandle(phandle handle) EXPORT_SYMBOL(of_find_node_by_phandle); /** + * of_read_property_u32 - Reads a indexed 32-bit property value + * @prop: property to read from. + * @offset:cell number to read. + * value: returned cell value + * + * Returns a indexed 32-bit value of a property cell, -EINVAL in case the cell + * does not exist + */ +int of_read_property_u32(struct property *prop, u32 offset, u32 *value) +{ + if (!prop || !prop->value) + return -EINVAL; + if ((offset + 1) * 4 > prop->length) + return -EINVAL; + + *value = of_read_ulong(prop->value + (offset * 4), 1); + return 0; +} +EXPORT_SYMBOL(of_read_property_u32); + +/** + * of_getprop_u32 - Find a property in a device node and read a 32-bit value + * @np:device node from which the property value is to be read. + * @propname name of the property to be searched. + * @offset:cell number to read. + * @value: returned value of the cell + * + * Search for a property in a device node and read a indexed 32-bit value of a + * property cell. Returns the 32-bit cell value, -EINVAL in case the property or + * the indexed cell does not exist. + */ +int +of_getprop_u32(struct device_node *np, char *propname, int offset, u32 *value) +{ + return of_read_property_u32(of_find_property(np, propname, NULL), + offset, value); +} +EXPORT_SYMBOL(of_getprop_u32); + +/** + * of_read_property_u64 - Reads a indexed 64-bit property value + * @prop: property to read from. + * @offset:cell number to read (each cell is 64-bits). + * @value: returned cell value + * + * Returns a indexed 64-bit value of a property cell, -EINVAL in case the cell + * does not exist + */ +int of_read_property_u64(struct property *prop, int offset, u64 *value) +{ + if (!prop || !prop->value) + return -EINVAL; + if ((offset + 1) * 8 > prop->length) + return -EINVAL; + + *value = of_read_number(prop->value + (offset * 8), 2); + return 0; +} +EXPORT_SYMBOL(of_read_property_u64); + +/** + * of_getprop_u64 - Find a property in a device node and read a 64-bit value + * @np:device node from which the property value is to be read. + * @propname name of the property to be searched. + * @offset:cell number to read (each cell is 64-bits). + * @value: returned value of the cell + * + * Search for a property in a device node and read a indexed 64-bit value of a + * property cell. Returns the 64-bit cell value, -EINVAL in case the property or + * the indexed cell does not exist. + */ +int +of_getprop_u64(struct device_node *np, char *propname, int offset, u64 *value) +{ + return of_read_property_u64(of_find_property(np, propname, NULL), + offset, value); +} +EXPORT_SYMBOL(of_getprop_u64); + +/** + * of_read_property_string - Returns a pointer to a indexed null terminated + * property value string + * @prop: prope
Re: [PATCH 2/6] serial: samsung: Add device tree support for s5pv210 uart driver
On Mon, Jun 20, 2011 at 10:43:50AM -0600, Grant Likely wrote: > I think I've commented on this before, but I do try to avoid direct > coding registers into the DT. That said, sometimes there really isn't > a nice human-friendly way of encoding things and direct register > values is the best approach. Hrm, that's going to mean a *lot* of code doing parsing, especially if we also follow through and also have proper parsers for all the bitfields and don't just push the magic numbers down a level. In principal I agree with you that that's what we should be doing but in practice it seems like an awful lot of effort on all sides. I'm not against it but if we're going to go down this road I think we need to put some work into helpers to cut down on the parsing code. The obvious one is a helper which maps a table of strings into numbers for things like selecting multi-function pin functions. ___ linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev
Re: [PATCH 2/6] serial: samsung: Add device tree support for s5pv210 uart driver
Hi Grant, On 20 June 2011 22:13, Grant Likely wrote: > > For custom properties, you should prefix the property name with 'samsung,'. > > This looks very much like directly encoding the Linux flags into the > device tree. The binding should be completely contained within > itself, and not refer to OS implementation details. It is fine to use > the same values that Linux happens to use, but they need to still be > explicitly documented as to what they mean. Also, a 'flags' property > usually isn't very friendly to mere-mortals when the explicit > behaviour can be enabled with the presence of a named property. For > example; something like a "samsung,uart-has-rtscts" to enable rts/cts. I will ensure that the next version of the patch do not have any linux specific bindings. > >> + >> +- has_fracval : Set to 1, if the controller supports fractional part of >> + for the baud divisor, otherwise, set to 0. > > Boolean stuff often doesn't need a value. If the property is present, > it is a '1'. If it isn't, then it is a '0'. > >> + >> +- ucon_default : Default board specific setting of UCON register. >> + >> +- ulcon_default : Default board specific setting of ULCON register. >> + >> +- ufcon_default : Default board specific setting of UFCON register. > > I think I've commented on this before, but I do try to avoid direct > coding registers into the DT. That said, sometimes there really isn't > a nice human-friendly way of encoding things and direct register > values is the best approach. Instead of default register values, is it acceptable to include custom properties like "samsung,txfifo-trig-level" and then convert it to corresponding register settings? > >> + >> +- uart_clksrc : One or more child nodes representing the clock sources that >> + could be used to derive the buad rate. Each of these child nodes >> + has four required properties. >> + >> + - name : Name of the parent clock. >> + - divisor : divisor from the clock to the uart controller. >> + - min_baud : Minimum baud rate for which this clock can be used. >> + Set to zero, if there is no limitation. >> + - max_buad : Maximum baud rate for which this clock can be used. > > typo: s/buad/baud/ > >> + Set to zero, if there is no limitation. > > This looks to be directly encoding the current Linux implementation > details into the device tree (it is a direct copy of the config > structure members), and it doesn't use the common clock binding. It's > fine to use sub nodes for each clock attachment, particularly because > it looks like the uart is able to apply it's own divisor to the clock > input, but I would definitely encode the data using the existing > struct clock binding. > >> + >> +Optional properties: >> +- fifosize: Size of the tx/rx fifo used in the controller. If not specified, >> + the default value of the fifosize is 16. >> diff --git a/drivers/tty/serial/s5pv210.c b/drivers/tty/serial/s5pv210.c >> index 3b2021a..9aacbda 100644 >> --- a/drivers/tty/serial/s5pv210.c >> +++ b/drivers/tty/serial/s5pv210.c >> @@ -18,6 +18,7 @@ >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -131,15 +132,39 @@ static struct s3c24xx_uart_info *s5p_uart_inf[] = { >> /* device management */ >> static int s5p_serial_probe(struct platform_device *pdev) >> { >> - return s3c24xx_serial_probe(pdev, s5p_uart_inf[pdev->id]); >> + const void *prop; >> + unsigned int port = pdev->id; >> + unsigned int fifosize = 16; >> + static unsigned int probe_index; >> + >> + if (pdev->dev.of_node) { >> + prop = of_get_property(pdev->dev.of_node, "fifosize", NULL); >> + if (prop) >> + fifosize = be32_to_cpu(*(u32 *)prop); > > Okay, this is getting ugly (not your fault, but this pattern has > become too common. Can you craft and post a patch that adds the > following functions to drivers/of/base.c and include/linux/of.h > > /* offset in cells, not bytes */ > int dt_decode_u32(struct *property, int offset, u32 *out_val) > { > if (!property || !property->value) > return -EINVAL; > if ((offset + 1) * 4 > property->length) > return -EINVAL; > *out_val = of_read_number(property->value + (offset * 4), 1); > return 0; > } > int dt_decode_u64(struct *property, int offset, u64 *out_val) > { > ... > } > int dt_decode_string(struct *property, int index, char **out_string); > { > ... > } > > Plus a set of companion functions: > int dt_getprop_u32(struct device_node *np, char *propname, int offset, > u32 *out_val) > { > return dt_decode_u32(of_find_property(np, propname, NULL), > offset, out_val); > } > int dt_getprop_u64(struct *device_node, char *propname, int offset, > u64 *out_val); > { > ... > } > int dt_getprop_string(struct *device_node, char *propname, int index, > char **out_string); > { > ..
Re: [PATCH 2/6] serial: samsung: Add device tree support for s5pv210 uart driver
On Mon, Jun 20, 2011 at 5:02 AM, Thomas Abraham wrote: > For device tree based probe, the dependecy on pdev->id to attach a > corresponding default port info to the driver's private data is > removed. The fifosize parameter is obtained from the device tree > node and the next available instance of port info is updated > with the fifosize value and attached to the driver's private data. > > The samsung uart core driver is also modified to parse the device > tree node and pick up the platform data from the node. > > Signed-off-by: Thomas Abraham > --- > .../bindings/tty/serial/samsung_uart.txt | 50 +++ > drivers/tty/serial/s5pv210.c | 27 ++- > drivers/tty/serial/samsung.c | 90 > > 3 files changed, 166 insertions(+), 1 deletions(-) > create mode 100644 > Documentation/devicetree/bindings/tty/serial/samsung_uart.txt > > diff --git a/Documentation/devicetree/bindings/tty/serial/samsung_uart.txt > b/Documentation/devicetree/bindings/tty/serial/samsung_uart.txt > new file mode 100644 > index 000..4c0783d > --- /dev/null > +++ b/Documentation/devicetree/bindings/tty/serial/samsung_uart.txt > @@ -0,0 +1,50 @@ > +* Samsung's UART Controller > + > +The Samsung's UART controller is used for serial communications on all of > +Samsung's s3c24xx, s3c64xx and s5p series application processors. > + > +Required properties: > +- compatible : should be specific to the application processor > + - "samsung,s5pv210-uart" , for s5pc110, s5pv210 and Exynos4 family. > + - "samsung,s3c6400-uart", for s3c64xx, s5p64xx and s5pc100. > + - "samsung,s3c2410-uart", for s3c2410. > + - "samsung,s3c2412-uart", for s3c2412. > + - "samsung,s3c2440-uart", for s3c244x. > + > +- reg : base physical address of the controller and length of memory > mapped > + region. > + > +- interrupts : Three interrupt numbers should be specified in the following > + order - TX interrupt, RX interrupt, Error Interrupt. > + > +- hwport : Instance number of the UART controller in the processor. > + (ToDo: Remove this from the driver). > + > +- flags : Not used, but set value as 0. (ToDo: Remove this flag from driver). If they are to be removed, then you should drop them from the documentation. > + > +- uart_flags : Additional serial core flags to passed to the serial core > + when the driver is registred. For example: UPF_CONS_FLOW. Underscores are discouraged in property and node names. Use '-' instead. For custom properties, you should prefix the property name with 'samsung,'. This looks very much like directly encoding the Linux flags into the device tree. The binding should be completely contained within itself, and not refer to OS implementation details. It is fine to use the same values that Linux happens to use, but they need to still be explicitly documented as to what they mean. Also, a 'flags' property usually isn't very friendly to mere-mortals when the explicit behaviour can be enabled with the presence of a named property. For example; something like a "samsung,uart-has-rtscts" to enable rts/cts. > + > +- has_fracval : Set to 1, if the controller supports fractional part of > + for the baud divisor, otherwise, set to 0. Boolean stuff often doesn't need a value. If the property is present, it is a '1'. If it isn't, then it is a '0'. > + > +- ucon_default : Default board specific setting of UCON register. > + > +- ulcon_default : Default board specific setting of ULCON register. > + > +- ufcon_default : Default board specific setting of UFCON register. I think I've commented on this before, but I do try to avoid direct coding registers into the DT. That said, sometimes there really isn't a nice human-friendly way of encoding things and direct register values is the best approach. > + > +- uart_clksrc : One or more child nodes representing the clock sources that > + could be used to derive the buad rate. Each of these child nodes > + has four required properties. > + > + - name : Name of the parent clock. > + - divisor : divisor from the clock to the uart controller. > + - min_baud : Minimum baud rate for which this clock can be used. > + Set to zero, if there is no limitation. > + - max_buad : Maximum baud rate for which this clock can be used. typo: s/buad/baud/ > + Set to zero, if there is no limitation. This looks to be directly encoding the current Linux implementation details into the device tree (it is a direct copy of the config structure members), and it doesn't use the common clock binding. It's fine to use sub nodes for each clock attachment, particularly because it looks like the uart is able to apply it's own divisor to the clock input, but I would definitely encode the data using the existing struct clock binding. > + > +Optional properties: > +- fifosize: Size of the