From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] serial: add BCM283x mini UART driver
Date: Sat, 9 Apr 2016 21:45:36 -0600 [thread overview]
Message-ID: <5709CC60.1010801@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ2Qu9US8r9C=OST7=gmU8Cyysn=wD_kBRNM64XmfckcdQ@mail.gmail.com>
On 04/09/2016 12:34 PM, Simon Glass wrote:
> Hi Stephen,
>
> On 16 March 2016 at 21:46, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> The RPi3 typically uses the regular UART for high-speed communication with
>> the Bluetooth device, leaving us the mini UART to use for the serial
>> console. Add support for this UART so we can use it.
>>
>> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
>> ---
>> (This will be a dependency for the RPi 3 patches, so it'd be good if it
>> could make it into mainline pretty quickly if acceptable.)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Not sure if this went in already. But see comment below.
It has, but I can send a fix.
>> diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c
>> +static int bcm283x_mu_serial_setbrg(struct udevice *dev, int baudrate)
>> +{
>> + struct bcm283x_mu_priv *priv = dev_get_priv(dev);
>> + struct bcm283x_mu_regs *regs = priv->regs;
>> + /* FIXME: Get this from plat data later */
>> + u32 clock_rate = 250000000;
>
> Or device tree?
Well even if DT were used on this platform, the code right here would
get the clock rate from platform data. Now, whether the platform data
came from a board file or was parsed from DT is another matter.
>> +static int bcm283x_mu_serial_pending(struct udevice *dev, bool input)
>> +{
>> + struct bcm283x_mu_priv *priv = dev_get_priv(dev);
>> + struct bcm283x_mu_regs *regs = priv->regs;
>> + unsigned int lsr = readl(®s->lsr);
>> +
>> + if (input) {
>> + WATCHDOG_RESET();
>> + return lsr & BCM283X_MU_LSR_RX_READY;
>> + } else {
>> + return !(lsr & BCM283X_MU_LSR_TX_IDLE);
>
> These look like flags - be care to return 1 if there is an unknown
> number of characters, rather than (e.g. 4). The latter might cause the
> uclass to expect 4 characters to be present.
>
> Suggest putting ? 1 : 0 or ? 0 : 1 on the end.
Luckily BCM283X_MU_LSR_RX_READY is BIT(0) so there's no practical issue.
A !! would make this more obvious at this point in the code though. Do
you think that warrants a patch? The ! on the second return also ensure
the correct return value.
next prev parent reply other threads:[~2016-04-10 3:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 3:46 [U-Boot] [PATCH] serial: add BCM283x mini UART driver Stephen Warren
2016-04-09 18:34 ` Simon Glass
2016-04-10 3:45 ` Stephen Warren [this message]
2016-04-11 0:58 ` Tom Rini
2016-04-11 1:17 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5709CC60.1010801@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.