[U-Boot] [PATCH v5 3/5] mips: ath79: add serial driver for ar933x SOC

Wills Wang wills.wang at live.com
Wed Dec 30 02:06:48 CET 2015



On 12/29/2015 08:26 PM, Thomas Chou wrote:
> Hi Wills,
>
> On 2015年12月29日 19:17, Wills Wang wrote:
>
> > +DECLARE_GLOBAL_DATA_PTR;
>
> The gd is not used in this patch. It can be removed.
>
>> +static int ar933x_serial_putc(struct udevice *dev, const char c)
>> +{
>> +    u32 data;
>> +
>
>> +    do {
>> +        data = ar933x_serial_read(dev, AR933X_UART_DATA_REG);
>> +    } while (!(data & AR933X_UART_DATA_TX_CSR));
>
>     data = ar933x_serial_read(dev, AR933X_UART_DATA_REG);
>     if (!(data & AR933X_UART_DATA_TX_CSR))
>         return -EAGAIN;
>
>> +
>> +    data  = (u32)c | AR933X_UART_DATA_TX_CSR;
>> +    ar933x_serial_write(dev, data, AR933X_UART_DATA_REG);
>> +
>> +    return 0;
>> +}
>> +
>> +static int ar933x_serial_getc(struct udevice *dev)
>> +{
>> +    u32 data;
>> +
>
>> +    do {
>> +        data = ar933x_serial_read(dev, AR933X_UART_DATA_REG);
>> +    } while (!(data & AR933X_UART_DATA_RX_CSR));
>
>     data = ar933x_serial_read(dev, AR933X_UART_DATA_REG);
>     if (!(data & AR933X_UART_DATA_RX_CSR))
>         return -EAGAIN;
>
>> +
>> +    data = ar933x_serial_read(dev, AR933X_UART_DATA_REG);
>> +    ar933x_serial_write(dev, AR933X_UART_DATA_RX_CSR,
>> +                AR933X_UART_DATA_REG);
>> +    return data & AR933X_UART_DATA_TX_RX_MASK;
>> +}
>> +
>
> > +static int ar933x_serial_probe(struct udevice *dev)
> > +{
> > +    struct ar933x_serial_priv *priv = dev_get_priv(dev);
> > +    u32 val;
> > +
> > +    fdt_addr_t addr;
>
> Why extra blank line above "fdt_addr_t addr;"?
>
> =========================
>
> checkpatch.pl,
>
> WARNING: Missing a blank line after declarations
> #206: FILE: drivers/serial/serial_ar933x.c:45:
> +    struct ar933x_serial_priv *priv = dev_get_priv(dev);
> +    return readl(priv->regs + offset);
>
> CHECK: Alignment should match open parenthesis
> #210: FILE: drivers/serial/serial_ar933x.c:49:
> +static inline void ar933x_serial_write(struct udevice *dev,
> +                    u32 val, u32 offset)
>
> WARNING: Missing a blank line after declarations
> #213: FILE: drivers/serial/serial_ar933x.c:52:
> +    struct ar933x_serial_priv *priv = dev_get_priv(dev);
> +    writel(val, priv->regs + offset);
>
> CHECK: Alignment should match open parenthesis
> #234: FILE: drivers/serial/serial_ar933x.c:73:
> +static void ar933x_serial_get_scale_step(u32 clk, u32 baud,
> +                       u32 *scale, u32 *step)
>
> CHECK: Please don't use multiple blank lines
> #393: FILE: drivers/serial/serial_ar933x.c:232:
> +
> +
>
> Thanks.
>
> Regards,
> Thomas
>
Ok.

-- 
Best Regards
Wills



More information about the U-Boot mailing list