From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Noam Camus <noamc@ezchip.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"jslaby@suse.com" <jslaby@suse.com>,
"peter@hurleysoftware.com" <peter@hurleysoftware.com>,
"fransklaver@gmail.com" <fransklaver@gmail.com>,
"Alexey.Brodkin@synopsys.com" <Alexey.Brodkin@synopsys.com>,
"vgupta@synopsys.com" <vgupta@synopsys.com>
Subject: Re: [PATCH-v8] serial: 8250_dw: Add support for big-endian MMIO accesses
Date: Thu, 10 Dec 2015 12:33:38 +0200 [thread overview]
Message-ID: <20151210103338.GE4884@kuha.fi.intel.com> (raw)
In-Reply-To: <20151210093104.GD4884@kuha.fi.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]
On Thu, Dec 10, 2015 at 11:31:04AM +0200, Heikki Krogerus wrote:
> Hi Noam,
>
> On Thu, Dec 10, 2015 at 07:26:42AM +0000, Noam Camus wrote:
> > >From: Heikki Krogerus [mailto:heikki.krogerus@linux.intel.com]
> > >Sent: Wednesday, December 09, 2015 3:20 PM
> >
> >
> > >> @@ -171,7 +174,8 @@ static void dw8250_serial_out32(struct uart_port *p, int offset, int value)
> > >> if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR))
> > >> return;
> > >> dw8250_force_idle(p);
> > >> - writel(value, p->membase + (UART_LCR << p->regshift));
> > >> + d->serial_out(value,
> > >> + p->membase + (UART_LCR << p->regshift));
> > >> }
> >
> > >.. The way I see it, this is the only place where you would really need the
> > >new private serial_in/out hooks, so why not just check the >iotype here and
> > >based on that use writeb/writel/iowrite32be or what ever ..
> >
> > In previous versions (V2) Greg dis-liked using iotype here this is why I added
> > the private serial_in/serial_out
>
> I couldn't find that comment in the thread? All he said in his
> comment for this was that you should use real if condition instead of
> the ternary operator you had there (condition ? true : false).
>
> Why would it not be acceptable? If it would really not be acceptable
> (which I don't believe) then you should simply duplicate the lcr
> checking to dw8250_seria_out32be like it is done now in
> dw8250_serial_out and dw8250_serial_out32, but there still is no need
> for the private serial_in/out hooks.
>
> I'm attaching a diff that I think would work as a good starting point
> for you.
Now actually attaching the diff :).
--
heikki
[-- Attachment #2: dw8250_check_lcr.diff --]
[-- Type: text/plain, Size: 2912 bytes --]
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index a5d319e..b2ea0c2 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -95,25 +95,39 @@ static void dw8250_force_idle(struct uart_port *p)
(void)p->serial_in(p, UART_RX);
}
+static void dw8250_check_lcr(struct uart_port *p, int value)
+{
+ void __iomem *offset = p->membase + (UART_LCR << p->regshift);
+ int tries = 1000;
+
+ while (tries--) {
+ unsigned int lcr = p->serial_in(p, UART_LCR);
+
+ if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR))
+ return;
+
+ dw8250_force_idle(p);
+
+ if (p->iotype == UPIO_MEM32)
+ writel(value, offset);
+ else
+ writeb(value, offset);
+ }
+ /*
+ * FIXME: this deadlocks if port->lock is already held
+ * dev_err(p->dev, "Couldn't set LCR to %d\n", value);
+ */
+}
+
static void dw8250_serial_out(struct uart_port *p, int offset, int value)
{
+ struct dw8250_data *d = p->private_data;
+
writeb(value, p->membase + (offset << p->regshift));
/* Make sure LCR write wasn't ignored */
- if (offset == UART_LCR) {
- int tries = 1000;
- while (tries--) {
- unsigned int lcr = p->serial_in(p, UART_LCR);
- if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR))
- return;
- dw8250_force_idle(p);
- writeb(value, p->membase + (UART_LCR << p->regshift));
- }
- /*
- * FIXME: this deadlocks if port->lock is already held
- * dev_err(p->dev, "Couldn't set LCR to %d\n", value);
- */
- }
+ if (offset == UART_LCR && !d->uart_16550_compatible)
+ dw8250_check_lcr(p, value);
}
static unsigned int dw8250_serial_in(struct uart_port *p, int offset)
@@ -161,23 +175,13 @@ static void dw8250_serial_outq(struct uart_port *p, int offset, int value)
static void dw8250_serial_out32(struct uart_port *p, int offset, int value)
{
+ struct dw8250_data *d = p->private_data;
+
writel(value, p->membase + (offset << p->regshift));
/* Make sure LCR write wasn't ignored */
- if (offset == UART_LCR) {
- int tries = 1000;
- while (tries--) {
- unsigned int lcr = p->serial_in(p, UART_LCR);
- if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR))
- return;
- dw8250_force_idle(p);
- writel(value, p->membase + (UART_LCR << p->regshift));
- }
- /*
- * FIXME: this deadlocks if port->lock is already held
- * dev_err(p->dev, "Couldn't set LCR to %d\n", value);
- */
- }
+ if (offset == UART_LCR && !d->uart_16550_compatible)
+ dw8250_check_lcr(p, value);
}
static unsigned int dw8250_serial_in32(struct uart_port *p, int offset)
@@ -463,10 +467,8 @@ static int dw8250_probe(struct platform_device *pdev)
dw8250_quirks(p, data);
/* If the Busy Functionality is not implemented, don't handle it */
- if (data->uart_16550_compatible) {
- p->serial_out = NULL;
+ if (data->uart_16550_compatible)
p->handle_irq = NULL;
- }
if (!data->skip_autocfg)
dw8250_setup_port(p);
next prev parent reply other threads:[~2015-12-10 10:33 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 9:34 [PATCH 0/4] *** 8250_dw *** Noam Camus
2015-07-22 9:34 ` [PATCH 1/4] serial: 8250_dw: Add support for big-endian MMIO accesses Noam Camus
2015-07-22 9:34 ` [PATCH 2/4] serial: 8250_dw: Add UPF_SKIP_TEST to flags depend on device tree Noam Camus
2015-07-22 9:34 ` [PATCH 3/4] serial: 8250_dw: Add UPF_FIXED_TYPE to flags Noam Camus
2015-07-22 9:34 ` [PATCH 4/4] serial: 8250_dw: use serial_in() and not readl() Noam Camus
2015-07-22 12:51 ` Peter Hurley
2015-07-23 10:40 ` Noam Camus
2015-07-22 12:38 ` [PATCH 3/4] serial: 8250_dw: Add UPF_FIXED_TYPE to flags Peter Hurley
2015-07-23 10:38 ` Noam Camus
2015-07-22 12:20 ` [PATCH 2/4] serial: 8250_dw: Add UPF_SKIP_TEST to flags depend on device tree Peter Hurley
2015-07-23 6:21 ` Noam Camus
2015-07-23 6:46 ` Frans Klaver
2015-07-22 12:19 ` [PATCH 1/4] serial: 8250_dw: Add support for big-endian MMIO accesses Peter Hurley
2015-07-22 12:41 ` Peter Hurley
2015-07-23 6:15 ` Noam Camus
2015-07-23 6:13 ` Noam Camus
[not found] ` <1437886478-29273-1-git-send-email-noamc@ezchip.com>
[not found] ` <1437886478-29273-2-git-send-email-noamc@ezchip.com>
[not found] ` <1437886478-29273-3-git-send-email-noamc@ezchip.com>
2015-08-03 23:42 ` [v2 2/3] serial: 8250_dw: dw8250_setup_port() use endianness aware read Greg KH
2015-08-10 19:13 ` Noam Camus
[not found] ` <1437886478-29273-4-git-send-email-noamc@ezchip.com>
2015-08-03 23:44 ` [v2 3/3] serial: 8250_dw: Add UPF_SKIP_TEST to flags depend on device tree Greg KH
2015-08-10 19:21 ` Noam Camus
2015-08-03 23:43 ` [v2 1/3] serial: 8250_dw: Add support for big-endian MMIO accesses Greg KH
2015-08-10 19:08 ` Noam Camus
[not found] ` <1439378312-6463-1-git-send-email-noamc@ezchip.com>
[not found] ` <1439378312-6463-2-git-send-email-noamc@ezchip.com>
[not found] ` <1439378312-6463-3-git-send-email-noamc@ezchip.com>
[not found] ` <1439378312-6463-4-git-send-email-noamc@ezchip.com>
2015-08-12 13:16 ` [v3 3/3] serial: 8250_dw: Add UPF_SKIP_TEST to flags depend on device tree Peter Hurley
2015-08-12 15:51 ` Noam Camus
2015-08-13 14:20 ` Vineet Gupta
2015-08-21 10:33 ` [v4 0/2] *** 8250_dw *** Noam Camus
2015-08-21 10:33 ` [v4 1/2] serial: 8250_dw: Add support for big-endian MMIO accesses Noam Camus
2015-08-21 10:33 ` [v4 2/2] serial: 8250_dw: dw8250_setup_port() use endianness aware read Noam Camus
2015-08-21 10:41 ` Vineet Gupta
2015-08-25 8:57 ` [v5] *** 8250_dw *** Noam Camus
2015-08-25 8:57 ` [v5] serial: 8250_dw: Add support for big-endian MMIO accesses Noam Camus
2015-10-04 17:37 ` Greg KH
2015-10-06 6:39 ` [v6] *** 8250_dw *** Noam Camus
2015-10-06 6:39 ` [v6] serial: 8250_dw: Add support for big-endian MMIO accesses Noam Camus
2015-10-06 7:25 ` kbuild test robot
2015-10-06 7:27 ` kbuild test robot
2015-10-06 7:56 ` Greg KH
2015-10-06 8:01 ` kbuild test robot
2015-10-06 8:53 ` [v7] *** 8250_dw *** Noam Camus
2015-10-06 8:53 ` [v7] serial: 8250_dw: Add support for big-endian MMIO accesses Noam Camus
2015-10-18 4:06 ` Greg KH
2015-10-18 5:30 ` Noam Camus
2015-10-18 5:57 ` Greg KH
2015-12-08 22:57 ` Noam Camus
2015-12-09 14:18 ` Andy Shevchenko
2015-12-10 7:30 ` Noam Camus
2015-10-18 9:01 ` [PATCH-v8] " Noam Camus
2015-12-09 13:19 ` Heikki Krogerus
2015-12-09 13:21 ` Heikki Krogerus
2015-12-10 7:26 ` Noam Camus
2015-12-10 9:31 ` Heikki Krogerus
2015-12-10 10:33 ` Heikki Krogerus [this message]
[not found] <45xw80lci7vs893wq469l1b0.1449765214447@com.syntomo.email>
2015-12-11 8:37 ` Heikki Krogerus
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=20151210103338.GE4884@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=Alexey.Brodkin@synopsys.com \
--cc=fransklaver@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=noamc@ezchip.com \
--cc=peter@hurleysoftware.com \
--cc=vgupta@synopsys.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome