* Re: [PATCH] tty/serial/8250: Make omap hardware workarounds local to 8250.h
From: Greg Kroah-Hartman @ 2012-10-03 23:25 UTC (permalink / raw)
To: Tony Lindgren; +Cc: linux-serial, Alan Cox
In-Reply-To: <20121003223158.GL4840@atomide.com>
On Wed, Oct 03, 2012 at 03:31:58PM -0700, Tony Lindgren wrote:
> This allows us to get rid of the ifdefs in 8250.c.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Alan Cox <alan@linux.intel.com>
> Cc: linux-serial@vger.kernel.org
> Cc: linux-omap@vger.kernel.org
> Signed-off-by: Tony Lindgren <tony@atomide.com>
>
> ---
>
> Would appreciate some minimal immutable branch
> with this commit that I can also pull in to my
> upcoming omap cleanup branch for v3.8 merge window
> as I'll be moving plat/serial.h for the ARM common
> zImage changes.
Please wait for 3.7-rc1 to come out before I can do that.
thanks,
greg k-h
^ permalink raw reply
* [PATCH] tty/serial/8250: Make omap hardware workarounds local to 8250.h
From: Tony Lindgren @ 2012-10-03 22:31 UTC (permalink / raw)
Cc: Alan Cox, Greg Kroah-Hartman, linux-serial
This allows us to get rid of the ifdefs in 8250.c.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Cox <alan@linux.intel.com>
Cc: linux-serial@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
Would appreciate some minimal immutable branch
with this commit that I can also pull in to my
upcoming omap cleanup branch for v3.8 merge window
as I'll be moving plat/serial.h for the ARM common
zImage changes.
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -109,15 +109,6 @@
#define OMAP5UART4 OMAP4UART4
#define ZOOM_UART 95 /* Only on zoom2/3 */
-/* This is only used by 8250.c for omap1510 */
-#define is_omap_port(pt) ({int __ret = 0; \
- if ((pt)->port.mapbase == OMAP1_UART1_BASE || \
- (pt)->port.mapbase == OMAP1_UART2_BASE || \
- (pt)->port.mapbase == OMAP1_UART3_BASE) \
- __ret = 1; \
- __ret; \
- })
-
#ifndef __ASSEMBLER__
struct omap_board_data;
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -2349,16 +2349,14 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
serial_port_out(port, UART_EFR, efr);
}
-#ifdef CONFIG_ARCH_OMAP1
/* Workaround to enable 115200 baud on OMAP1510 internal ports */
- if (cpu_is_omap1510() && is_omap_port(up)) {
+ if (is_omap1510_8250(up)) {
if (baud == 115200) {
quot = 1;
serial_port_out(port, UART_OMAP_OSC_12M_SEL, 1);
} else
serial_port_out(port, UART_OMAP_OSC_12M_SEL, 0);
}
-#endif
/*
* For NatSemi, switch to bank 2 not bank 1, to avoid resetting EXCR2,
@@ -2439,10 +2437,9 @@ static unsigned int serial8250_port_size(struct uart_8250_port *pt)
{
if (pt->port.iotype == UPIO_AU)
return 0x1000;
-#ifdef CONFIG_ARCH_OMAP1
- if (is_omap_port(pt))
+ if (is_omap1_8250(pt))
return 0x16 << pt->port.regshift;
-#endif
+
return 8 << pt->port.regshift;
}
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -106,3 +106,39 @@ static inline int serial8250_pnp_init(void) { return 0; }
static inline void serial8250_pnp_exit(void) { }
#endif
+#ifdef CONFIG_ARCH_OMAP1
+static inline int is_omap1_8250(struct uart_8250_port *pt)
+{
+ int res;
+
+ switch (pt->port.mapbase) {
+ case OMAP1_UART1_BASE:
+ case OMAP1_UART2_BASE:
+ case OMAP1_UART3_BASE:
+ res = 1;
+ break;
+ default:
+ res = 0;
+ break;
+ }
+
+ return res;
+}
+
+static inline int is_omap1510_8250(struct uart_8250_port *pt)
+{
+ if (!cpu_is_omap1510())
+ return 0;
+
+ return is_omap1_8250(pt);
+}
+#else
+static inline int is_omap1_8250(struct uart_8250_port *pt)
+{
+ return 0;
+}
+static inline int is_omap1510_8250(struct uart_8250_port *pt)
+{
+ return 0;
+}
+#endif
^ permalink raw reply
* Re: [PATCH 09/17] serial/8250: Limit the omap workarounds to omap1
From: Tony Lindgren @ 2012-10-03 22:26 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-arm-kernel, Greg Kroah-Hartman, linux-omap, linux-serial
In-Reply-To: <20120911201919.58d44dcb@bob.linux.org.uk>
* Alan Cox <alan@linux.intel.com> [120911 12:02]:
> > > Even better would be if for other cases is_omap_port and friends
> > > returned 0...
> >
> > Yes it seems that those macros could be moved from plat-omap/serial.h
> > to live in drivers/tty/serial/8250/8250.h? Or do you have some better
> > place in mind?
>
> I've not looked at it enough to decide if it's doable or not. I'm happy
> either way - both patches are progress the right way!
FYI, I'll send something along these lines as a separate patch as
"[PATCH] tty/serial/8250: Make omap hardware workarounds local to 8250.h"
Regards,
Tony
^ permalink raw reply
* Re: [PATCH v3] serial/8250/8250_early: Prevent rounding error in uartclk
From: Alexey Brodkin @ 2012-10-03 12:53 UTC (permalink / raw)
To: Alan Cox
Cc: Alexey Brodkin, linux-serial, linux-kernel, gregkh, Vineet.Gupta1
In-Reply-To: <20121003133740.69c9dbce@bob.linux.org.uk>
On 03.10.2012 16:37, Alan Cox wrote:
>> So the bug had been latent and it only showed up with such low cock
>> rates.
>
> clock ?
>
> Perhaps Greg can tweak the description as it goes in - otherwise all
> fine with me
>
Sorry for this.
Essentially I meant "clock".
May do another respin if needed.
^ permalink raw reply
* Re: [PATCH v3] serial/8250/8250_early: Prevent rounding error in uartclk
From: Alan Cox @ 2012-10-03 12:37 UTC (permalink / raw)
To: Alexey Brodkin; +Cc: linux-serial, linux-kernel, gregkh, Vineet.Gupta1
In-Reply-To: <1349267263-21683-1-git-send-email-abrodkin@synopsys.com>
> So the bug had been latent and it only showed up with such low cock
> rates.
clock ?
Perhaps Greg can tweak the description as it goes in - otherwise all
fine with me
^ permalink raw reply
* [PATCH v3] serial/8250/8250_early: Prevent rounding error in uartclk
From: Alexey Brodkin @ 2012-10-03 12:27 UTC (permalink / raw)
To: linux-serial, linux-kernel; +Cc: alan, gregkh, Vineet.Gupta1, Alexey Brodkin
Modify divisor to select the nearest baud rate divider rather than the
lowest. It minimizes baud rate errors especially on low UART clock
frequencies.
For example, if uartclk is 33000000 and baud is 115200 the ratio is
about 17.9 The current code selects 17 (5% error) but should select 18
(0.5% error).
This 5% error in baud rate leads to garbage on receiving end, while 0.5%
doesn't.
The issue showed up when using the stock 8250 driver for
Synopsys DW UART. This was on a FPGA with ~12MHz UART clock.
When we enabled early serial, we saw garbage which was narrowed down
to the rounding error.
So the bug had been latent and it only showed up with such low cock rates.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
drivers/tty/serial/8250/8250_early.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index eaafb98..843a150 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -140,7 +140,7 @@ static void __init init_port(struct early_serial8250_device *device)
serial_out(port, UART_FCR, 0); /* no fifo */
serial_out(port, UART_MCR, 0x3); /* DTR + RTS */
- divisor = port->uartclk / (16 * device->baud);
+ divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * device->baud);
c = serial_in(port, UART_LCR);
serial_out(port, UART_LCR, c | UART_LCR_DLAB);
serial_out(port, UART_DLL, divisor & 0xff);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/3] serial: omap: Make context_loss_cnt signed
From: Shubhrajyoti D @ 2012-10-03 11:54 UTC (permalink / raw)
To: linux-serial; +Cc: linux-omap, linux-arm-kernel, sourav.poddar, Shubhrajyoti D
get_context_loss_count returns an int however it is stored in
unsigned integer context_loss_cnt . This patch tries to make
context_loss_cnt int. So that in case of errors the value
(which may be negative) is not interpreted wrongly.
In serial_omap_runtime_resume in case of errors returned by
get_context_loss_count print a warning and do a restore.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/tty/serial/omap-serial.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 6ede6fd..fd0fb8c 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -96,7 +96,7 @@ struct uart_omap_port {
unsigned char msr_saved_flags;
char name[20];
unsigned long port_activity;
- u32 context_loss_cnt;
+ int context_loss_cnt;
u32 errata;
u8 wakeups_enabled;
unsigned int irq_pending:1;
@@ -1556,11 +1556,15 @@ static int serial_omap_runtime_resume(struct device *dev)
{
struct uart_omap_port *up = dev_get_drvdata(dev);
- u32 loss_cnt = serial_omap_get_context_loss_count(up);
+ int loss_cnt = serial_omap_get_context_loss_count(up);
- if (up->context_loss_cnt != loss_cnt)
+ if (loss_cnt < 0) {
+ dev_err(dev, "serial_omap_get_context_loss_count failed : %d\n",
+ loss_cnt);
serial_omap_restore_context(up);
-
+ } else if (up->context_loss_cnt != loss_cnt) {
+ serial_omap_restore_context(up);
+ }
up->latency = up->calc_latency;
schedule_work(&up->qos_work);
--
1.7.5.4
^ permalink raw reply related
* [PATCH 2/3] serial: omap: Remove the default setting of special character
From: Shubhrajyoti D @ 2012-10-03 11:54 UTC (permalink / raw)
To: linux-serial; +Cc: linux-omap, linux-arm-kernel, sourav.poddar, Shubhrajyoti D
In-Reply-To: <1349265278-27763-1-git-send-email-shubhrajyoti@ti.com>
Special character detect enable if enabled by default.Received data
comparison with XOFF2 data happens by default.
tty provides only XOFF1 no X0FF2 is provided so no need
to enable check for XOFF2.
Keeping this enabled might give some slow transfers due to dummy xoff2
comparison with xoff2 reset value.
Since not all want the XOFF2 support lets not enable it by
default.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/tty/serial/omap-serial.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index fd0fb8c..caf49a6 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -702,11 +702,7 @@ serial_omap_configure_xonxoff
serial_out(up, UART_MCR, up->mcr | UART_MCR_TCRTLR);
serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
serial_out(up, UART_TI752_TCR, OMAP_UART_TCR_TRIG);
- /* Enable special char function UARTi.EFR_REG[5] and
- * load the new software flow control mode IXON or IXOFF
- * and restore the UARTi.EFR_REG[4] ENHANCED_EN value.
- */
- serial_out(up, UART_EFR, up->efr | UART_EFR_SCD);
+
serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A);
serial_out(up, UART_MCR, up->mcr & ~UART_MCR_TCRTLR);
--
1.7.5.4
^ permalink raw reply related
* [PATCH 3/3] serial: omap: Remove the hardcode serial_omap_console_ports array.
From: Shubhrajyoti D @ 2012-10-03 11:54 UTC (permalink / raw)
To: linux-serial
Cc: linux-omap, linux-arm-kernel, sourav.poddar, Shubhrajyoti D,
AnilKumar Ch
In-Reply-To: <1349265278-27763-1-git-send-email-shubhrajyoti@ti.com>
Currently the array serial_omap_console_ports is hard coded to 4.
Make it depend on the maximum uart count.
Post to [cfc55bc ARM: OMAP2+: serial: Change MAX_HSUART_PORTS to 6]
the max ports is 6.
Cc: AnilKumar Ch <anilkumar@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/tty/serial/omap-serial.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index caf49a6..478383d 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1077,7 +1077,7 @@ out:
#ifdef CONFIG_SERIAL_OMAP_CONSOLE
-static struct uart_omap_port *serial_omap_console_ports[4];
+static struct uart_omap_port *serial_omap_console_ports[OMAP_MAX_HSUART_PORTS];
static struct uart_driver serial_omap_reg;
--
1.7.5.4
^ permalink raw reply related
* Re: [PATCH v2] serial/arc-uart: Add new driver
From: Vineet Gupta @ 2012-10-03 7:10 UTC (permalink / raw)
To: Alan Cox; +Cc: gregkh, linux-serial, linux-kernel
In-Reply-To: <20121002124707.32b70292@bob.linux.org.uk>
On Tuesday 02 October 2012 05:17 PM, Alan Cox wrote:
>> +/* Is this for UART emulation on ARC Instruction Set Simulator (ISS)
>> */ +int __attribute__((weak)) running_on_iss;
> Why not pass a quirks field in your platform data instead - much
> cleaner than a global.
I'd thought about it too. However the platform data is retrieved in
arc_uart_init_one() while it's usage in arc_serial_set_termios() will be
in a different call chain, meaning this info will have to be anyways
saved in "some" data structure - probably within struct arc_uart_port -
and that too per port - which is not clean either. However if you
strongly feel that the global is a must go - I can rework it that way.
thx,
-Vineet
^ permalink raw reply
* Re: [RFT/PATCH] serial: omap: prevent resume if device is not suspended.
From: Kevin Hilman @ 2012-10-03 0:33 UTC (permalink / raw)
To: Poddar, Sourav
Cc: Russell King - ARM Linux, Felipe Balbi, gregkh, paul, tony,
linux-kernel, santosh.shilimkar, linux-serial, linux-omap,
linux-arm-kernel, alan
In-Reply-To: <CAKdam57bpTJ94Gn=mKVw1Fm-76fVPp3DGjFuNu_HfesybM1hPg@mail.gmail.com>
"Poddar, Sourav" <sourav.poddar@ti.com> writes:
> Hi,
>
> On Tue, Sep 25, 2012 at 2:51 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
>> On Tue, Sep 25, 2012 at 12:11:14PM +0300, Felipe Balbi wrote:
>>> On Tue, Sep 25, 2012 at 10:12:28AM +0100, Russell King - ARM Linux wrote:
>>> > On Tue, Sep 25, 2012 at 11:31:20AM +0300, Felipe Balbi wrote:
>>> > > On Tue, Sep 25, 2012 at 09:30:29AM +0100, Russell King - ARM Linux wrote:
>>> > > > How is this happening? I think that needs proper investigation - or if
>>> > > > it's had more investigation, then the results needs to be included in
>>> > > > the commit description so that everyone can understand the issue here.
>>> > > >
>>> > > > We should not be resuming a device which hasn't been suspended. Maybe
>>> > > > the runtime PM enable sequence is wrong, and that's what should be fixed
>>> > > > instead?
>>> > > >
>>> > > > This sequence in the probe() function:
>>> > > >
>>> > > > pm_runtime_irq_safe(&pdev->dev);
>>> > > > pm_runtime_enable(&pdev->dev);
>>> > > > pm_runtime_get_sync(&pdev->dev);
>>> > > >
>>> > > > would enable runtime PM while the s/w state indicates that it's disabled,
>>> > > > and then that pm_runtime_get_sync() will want to resume the device. See
>>> > > > the section "5. Runtime PM Initialization, Device Probing and Removal"
>>> > > > in Documentation/power/runtime_pm.txt, specifically the second paragraph
>>> > > > of that section.
>>> > >
>>> > > that was tested. It worked in pandaboard but didn't work on beagleboard
>>> > > XM. Sourav tried to start a discussion about that, but it simply died...
>>> > >
>>> > > In any case, pm_runtime_get_sync() in probe will always call
>>> > > runtime_resume callback, right ?
>>> >
>>> > Well, if the runtime PM state says it's suspended, and then you enable
>>> > runtime PM, the first call to pm_runtime_get_sync() will trigger a resume
>>> > attempt. The patch description is complaining about resume events without
>>> > there being a preceding suspend event.
>>> >
>>> > This could well be why.
>>>
>>> that's most likely, of course. But should we cause a regression to
>>> beagleboard XM because of that ?
>>
>> What would cause a regression on beagleboard XM? I have not suggested
>> any change other than more investigation of the issue and a fuller patch
>> description - yet you're screaming (idiotically IMHO) that mere
>> investigation would break beagleboard.
>>
>> Well, if it's _that_ fragile, that mere investigation of this issue by
>> someone elsewhere on the planet would break your beagleboard, maybe it
>> deserves to be broken!
>
> The issue was observed at serial init itself in the N800 board and the
> log does not
> show up much.
> http://www.pwsan.com/omap/testlogs/test_tty_next_e36851d0/20120910020323/boot/2420n800/2420n800_log.txt
> What we thought the problem might be with n800 is that it tries to
> resume when it didn't suspend before.
>
> There are two ways through which we thought of handling this issue:
>
> a) set device as active before enabling pm (which will prevent
>
> pm_runtime_set_active(dev);
> pm_runtime_enable(dev);
>
> OR
>
> b) adding a "suspended" flag to struct omap_uart_port which gets set on
> suspend and cleared on resume. Then on resume you can check:
>
> if (!up->suspended)
> return 0;
>
> But using "pm_runtime_set_active" approach breaks things even on
> beagle board xm, though
> it works fine on Panda.
> Therefore, we used the "suspended" flag approach.
>
> So. I just wanted to get some feedback from community about how using
> "pm_runtime_set_active"
> behaves differently in omap3 and omap4.
As Russell has already pointed out in great detail, the difference is
simply a mismatch between assumed HW stated and actual hardware state
between various boards. Put simply, the driver assumes the HW is
disabled (runtime suspended) when it loads, and the first runtime resume
is meant to enable the HW. If that assumption is wrong, it needs to be
fixed.
Have you figured out why the HW is already active on OMAP2? (probably
bootloader?)
That being said, already active HW should not cause this problem. In
fact, because of possible early console use, the hwmod init of the UART
hwmods does not idle/reset them on boot, so they are left in the state
that the bootloader set them in.
When the hwmod is later enabled for real during probe, the hwmod muxing
is done for that IP. So, I suspect what is really happening is that the
mux settings are not right for the UARTS on n800, so when the probe
happens, the UART mux settings are changed and you lose the UART.
Can you double check the UART mux settings for that board? You might
need some different mux settings in the board file.
Kevin
^ permalink raw reply
* [PATCH] serial: samsung: use clk_prepare_enable and clk_disable_unprepare
From: Thomas Abraham @ 2012-10-02 22:40 UTC (permalink / raw)
To: linux-serial; +Cc: gregkh, ben-linux, kgene.kim
Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare
calls as required by common clock framework.
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
---
drivers/tty/serial/samsung.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 7f04717..740458c 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -530,16 +530,16 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
switch (level) {
case 3:
if (!IS_ERR(ourport->baudclk))
- clk_disable(ourport->baudclk);
+ clk_disable_unprepare(ourport->baudclk);
- clk_disable(ourport->clk);
+ clk_disable_unprepare(ourport->clk);
break;
case 0:
- clk_enable(ourport->clk);
+ clk_prepare_enable(ourport->clk);
if (!IS_ERR(ourport->baudclk))
- clk_enable(ourport->baudclk);
+ clk_prepare_enable(ourport->baudclk);
break;
default:
@@ -713,11 +713,11 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
s3c24xx_serial_setsource(port, clk_sel);
if (!IS_ERR(ourport->baudclk)) {
- clk_disable(ourport->baudclk);
+ clk_disable_unprepare(ourport->baudclk);
ourport->baudclk = ERR_PTR(-EINVAL);
}
- clk_enable(clk);
+ clk_prepare_enable(clk);
ourport->baudclk = clk;
ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0;
@@ -1287,9 +1287,9 @@ static int s3c24xx_serial_resume(struct device *dev)
struct s3c24xx_uart_port *ourport = to_ourport(port);
if (port) {
- clk_enable(ourport->clk);
+ clk_prepare_enable(ourport->clk);
s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port));
- clk_disable(ourport->clk);
+ clk_disable_unprepare(ourport->clk);
uart_resume_port(&s3c24xx_uart_drv, port);
}
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH v2] serial/arc-uart: Add new driver
From: Alan Cox @ 2012-10-02 11:47 UTC (permalink / raw)
To: Vineet.Gupta1; +Cc: gregkh, linux-serial, linux-kernel
In-Reply-To: <1349154216-7906-1-git-send-email-vgupta@synopsys.com>
> +/* Is this for UART emulation on ARC Instruction Set Simulator (ISS)
> */ +int __attribute__((weak)) running_on_iss;
Why not pass a quirks field in your platform data instead - much
cleaner than a global.
> +static void arc_serial_set_ldisc(struct uart_port *port, int ld)
> +{
> +}
If you don't need it just remove this one
> + new->c_cflag &= ~(CMSPAR|CRTSCTS);
also force the CSIZE bits to CS8 if you only do 8N1.
Alan
^ permalink raw reply
* [PATCH v2] serial/arc-uart: Add new driver
From: Vineet.Gupta1 @ 2012-10-02 5:03 UTC (permalink / raw)
To: alan, gregkh; +Cc: linux-serial, linux-kernel, Vineet.Gupta1
From: Vineet Gupta <vgupta@synopsys.com>
Driver for non-standard on-chip UART, instantiated in the ARC (Synopsys)
FPGA Boards such as ARCAngel4/ML50x
v2:
* ttyARC used as device name
* Dynamic assignment of major/minor numbers.
* Ref counting tty in rx routine to prevent it from disappearing in
case of a hangup
* set_termios fixes:
- hardware flow control/parity are marked as unsupported
- baud written back to termios
* cosmetics such as commenting the need for @running_on_iss, empty lines
etc
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
drivers/tty/serial/Kconfig | 25 ++
drivers/tty/serial/Makefile | 1 +
drivers/tty/serial/arc_uart.c | 746 +++++++++++++++++++++++++++++++++++++++++
include/linux/serial_core.h | 3 +
4 files changed, 775 insertions(+), 0 deletions(-)
create mode 100644 drivers/tty/serial/arc_uart.c
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 4720b4b..af4bd69 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1360,4 +1360,29 @@ config SERIAL_EFM32_UART_CONSOLE
depends on SERIAL_EFM32_UART=y
select SERIAL_CORE_CONSOLE
+config SERIAL_ARC
+ bool "ARC UART driver support"
+ select SERIAL_CORE
+ default y
+ help
+ Driver for on-chip UART for ARC(Synopsys) for the legacy
+ FPGA Boards (ML50x/ARCAngel4)
+
+config SERIAL_ARC_CONSOLE
+ bool
+ select SERIAL_CORE_CONSOLE
+ depends on SERIAL_ARC=y
+ default y
+ help
+ Enable system Console on ARC UART
+
+config SERIAL_ARC_NR_PORTS
+ int 'Number of ports'
+ range 1 3
+ default 1
+ depends on SERIAL_ARC
+ help
+ Set this to the number of serial ports you want the driver
+ to support.
+
endmenu
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index 7257c5d..2b70b5f 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -79,3 +79,4 @@ obj-$(CONFIG_SERIAL_XILINX_PS_UART) += xilinx_uartps.o
obj-$(CONFIG_SERIAL_SIRFSOC) += sirfsoc_uart.o
obj-$(CONFIG_SERIAL_AR933X) += ar933x_uart.o
obj-$(CONFIG_SERIAL_EFM32_UART) += efm32-uart.o
+obj-$(CONFIG_SERIAL_ARC) += arc_uart.o
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
new file mode 100644
index 0000000..b65bfe4
--- /dev/null
+++ b/drivers/tty/serial/arc_uart.c
@@ -0,0 +1,746 @@
+/*
+ * ARC On-Chip(fpga) UART Driver
+ *
+ * Copyright (C) 2010-2012 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * vineetg: July 10th 2012
+ * -Decoupled the driver from arch/arc
+ * +Using platform_get_resource() for irq/membase (thx to bfin_uart.c)
+ * +Using early_platform_xxx() for early console (thx to mach-shmobile/xxx)
+ *
+ * Vineetg: Aug 21st 2010
+ * -Is uart_tx_stopped() not done in tty write path as it has already been
+ * taken care of, in serial core
+ *
+ * Vineetg: Aug 18th 2010
+ * -New Serial Core based ARC UART driver
+ * -Derived largely from blackfin driver albiet with some major tweaks
+ *
+ * TODO:
+ * -check if sysreq works
+ */
+
+#if defined(CONFIG_SERIAL_ARC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+#define SUPPORT_SYSRQ
+#endif
+
+#include <linux/module.h>
+#include <linux/serial.h>
+#include <linux/console.h>
+#include <linux/sysrq.h>
+#include <linux/platform_device.h>
+#include <linux/tty.h>
+#include <linux/tty_flip.h>
+#include <linux/serial_core.h>
+#include <linux/io.h>
+
+/*************************************
+ * ARC UART Hardware Specs
+ ************************************/
+#define ARC_UART_TX_FIFO_SIZE 1
+
+/*
+ * UART Register set (this is not a Standards Compliant IP)
+ * Also each reg is Word aligned, but only 8 bits wide
+ */
+#define R_ID0 0
+#define R_ID1 1
+#define R_ID2 2
+#define R_ID3 3
+#define R_DATA 4
+#define R_STS 5
+#define R_BAUDL 6
+#define R_BAUDH 7
+
+/* Bits for UART Status Reg (R/W) */
+#define RXIENB 0x04 /* Receive Interrupt Enable */
+#define TXIENB 0x40 /* Transmit Interrupt Enable */
+
+#define RXEMPTY 0x20 /* Receive FIFO Empty: No char receivede */
+#define TXEMPTY 0x80 /* Transmit FIFO Empty, thus char can be written into */
+
+#define RXFULL 0x08 /* Receive FIFO full */
+#define RXFULL1 0x10 /* Receive FIFO has space for 1 char (tot space=4) */
+
+#define RXFERR 0x01 /* Frame Error: Stop Bit not detected */
+#define RXOERR 0x02 /* OverFlow Err: Char recv but RXFULL still set */
+
+/* Uart bit fiddling helpers: lowest level */
+#define RBASE(uart, reg) ((unsigned int *)uart->port.membase + reg)
+#define UART_REG_SET(u, r, v) writeb((v), RBASE(u, r))
+#define UART_REG_GET(u, r) readb(RBASE(u, r))
+
+#define UART_REG_OR(u, r, v) UART_REG_SET(u, r, UART_REG_GET(u, r) | (v))
+#define UART_REG_CLR(u, r, v) UART_REG_SET(u, r, UART_REG_GET(u, r) & ~(v))
+
+/* Uart bit fiddling helpers: API level */
+#define UART_SET_DATA(uart, val) UART_REG_SET(uart, R_DATA, val)
+#define UART_GET_DATA(uart) UART_REG_GET(uart, R_DATA)
+
+#define UART_SET_BAUDH(uart, val) UART_REG_SET(uart, R_BAUDH, val)
+#define UART_SET_BAUDL(uart, val) UART_REG_SET(uart, R_BAUDL, val)
+
+#define UART_CLR_STATUS(uart, val) UART_REG_CLR(uart, R_STS, val)
+#define UART_GET_STATUS(uart) UART_REG_GET(uart, R_STS)
+
+#define UART_ALL_IRQ_DISABLE(uart) UART_REG_CLR(uart, R_STS, RXIENB|TXIENB)
+#define UART_RX_IRQ_DISABLE(uart) UART_REG_CLR(uart, R_STS, RXIENB)
+#define UART_TX_IRQ_DISABLE(uart) UART_REG_CLR(uart, R_STS, TXIENB)
+
+#define UART_ALL_IRQ_ENABLE(uart) UART_REG_OR(uart, R_STS, RXIENB|TXIENB)
+#define UART_RX_IRQ_ENABLE(uart) UART_REG_OR(uart, R_STS, RXIENB)
+#define UART_TX_IRQ_ENABLE(uart) UART_REG_OR(uart, R_STS, TXIENB)
+
+#define ARC_SERIAL_DEV_NAME "ttyARC"
+
+struct arc_uart_port {
+ struct uart_port port;
+ unsigned long baud;
+};
+
+static struct arc_uart_port arc_uart_ports[CONFIG_SERIAL_ARC_NR_PORTS];
+
+#ifdef CONFIG_SERIAL_ARC_CONSOLE
+static struct console arc_console;
+#endif
+
+/* Is this for UART emulation on ARC Instruction Set Simulator (ISS) */
+int __attribute__((weak)) running_on_iss;
+
+#define DRIVER_NAME "arc-uart"
+
+static struct uart_driver arc_uart_driver = {
+ .owner = THIS_MODULE,
+ .driver_name = DRIVER_NAME,
+ .dev_name = ARC_SERIAL_DEV_NAME,
+ .major = 0,
+ .minor = 0,
+ .nr = CONFIG_SERIAL_ARC_NR_PORTS,
+#ifdef CONFIG_SERIAL_ARC_CONSOLE
+ .cons = &arc_console,
+#else
+ .cons = NULL,
+#endif
+};
+
+static void arc_serial_stop_rx(struct uart_port *port)
+{
+ struct arc_uart_port *uart = (struct arc_uart_port *)port;
+
+ UART_RX_IRQ_DISABLE(uart);
+}
+
+static void arc_serial_stop_tx(struct uart_port *port)
+{
+ struct arc_uart_port *uart = (struct arc_uart_port *)port;
+
+ while (!(UART_GET_STATUS(uart) & TXEMPTY))
+ cpu_relax();
+
+ UART_TX_IRQ_DISABLE(uart);
+}
+
+/*
+ * Return TIOCSER_TEMT when transmitter is not busy.
+ */
+static unsigned int arc_serial_tx_empty(struct uart_port *port)
+{
+ struct arc_uart_port *uart = (struct arc_uart_port *)port;
+ unsigned int stat;
+
+ stat = UART_GET_STATUS(uart);
+ if (stat & TXEMPTY)
+ return TIOCSER_TEMT;
+ else
+ return 0;
+}
+
+/*
+ * Driver internal routine, used by both tty(serial core) as well as tx-isr
+ * -Called under spinlock in either cases
+ * -also tty->stopped / tty->hw_stopped has already been checked
+ * = by uart_start( ) before calling us
+ * = tx_ist checks that too before calling
+ */
+static void arc_serial_tx_chars(struct arc_uart_port *uart)
+{
+ struct circ_buf *xmit = &uart->port.state->xmit;
+ int sent = 0;
+ unsigned char ch;
+
+ if (unlikely(uart->port.x_char)) {
+ UART_SET_DATA(uart, uart->port.x_char);
+ uart->port.icount.tx++;
+ uart->port.x_char = 0;
+ sent = 1;
+ } else if (xmit->tail != xmit->head) { /* TODO: uart_circ_empty */
+ ch = xmit->buf[xmit->tail];
+ xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
+ uart->port.icount.tx++;
+ while (!(UART_GET_STATUS(uart) & TXEMPTY))
+ cpu_relax();
+ UART_SET_DATA(uart, ch);
+ sent = 1;
+ }
+
+ /*
+ * If num chars in xmit buffer are too few, ask tty layer for more.
+ * By Hard ISR to schedule processing in software interrupt part
+ */
+ if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
+ uart_write_wakeup(&uart->port);
+
+ if (sent)
+ UART_TX_IRQ_ENABLE(uart);
+}
+
+/*
+ * port is locked and interrupts are disabled
+ * uart_start( ) calls us under the port spinlock irqsave
+ */
+static void arc_serial_start_tx(struct uart_port *port)
+{
+ struct arc_uart_port *uart = (struct arc_uart_port *)port;
+
+ arc_serial_tx_chars(uart);
+}
+
+static void arc_serial_rx_chars(struct arc_uart_port *uart)
+{
+ struct tty_struct *tty = tty_port_tty_get(&uart->port.state->port);
+ unsigned int status, ch, flg = 0;
+
+ if (!tty)
+ return;
+
+ /*
+ * UART has 4 deep RX-FIFO. Driver's recongnition of this fact
+ * is very subtle. Here's how ...
+ * Upon getting a RX-Intr, such that RX-EMPTY=0, meaning data available,
+ * driver reads the DATA Reg and keeps doing that in a loop, until
+ * RX-EMPTY=1. Multiple chars being avail, with a single Interrupt,
+ * before RX-EMPTY=0, implies some sort of buffering going on in the
+ * controller, which is indeed the Rx-FIFO.
+ */
+ while (!((status = UART_GET_STATUS(uart)) & RXEMPTY)) {
+
+ ch = UART_GET_DATA(uart);
+ uart->port.icount.rx++;
+
+ if (unlikely(status & (RXOERR | RXFERR))) {
+ if (status & RXOERR) {
+ uart->port.icount.overrun++;
+ flg = TTY_OVERRUN;
+ UART_CLR_STATUS(uart, RXOERR);
+ }
+
+ if (status & RXFERR) {
+ uart->port.icount.frame++;
+ flg = TTY_FRAME;
+ UART_CLR_STATUS(uart, RXFERR);
+ }
+ } else
+ flg = TTY_NORMAL;
+
+ if (unlikely(uart_handle_sysrq_char(&uart->port, ch)))
+ goto done;
+
+ uart_insert_char(&uart->port, status, RXOERR, ch, flg);
+
+done:
+ tty_flip_buffer_push(tty);
+ }
+
+ tty_kref_put(tty);
+}
+
+/*
+ * A note on the Interrupt handling state machine of this driver
+ *
+ * kernel printk writes funnel thru the console driver framework and in order
+ * to keep things simple as well as efficient, it writes to UART in polled
+ * mode, in one shot, and exits.
+ *
+ * OTOH, Userland output (via tty layer), uses interrupt based writes as there
+ * can be undeterministic delay between char writes.
+ *
+ * Thus Rx-interrupts are always enabled, while tx-interrupts are by default
+ * disabled.
+ *
+ * When tty has some data to send out, serial core calls driver's start_tx
+ * which
+ * -checks-if-tty-buffer-has-char-to-send
+ * -writes-data-to-uart
+ * -enable-tx-intr
+ *
+ * Once data bits are pushed out, controller raises the Tx-room-avail-Interrupt.
+ * The first thing Tx ISR does is disable further Tx interrupts (as this could
+ * be the last char to send, before settling down into the quiet polled mode).
+ * It then calls the exact routine used by tty layer write to send out any
+ * more char in tty buffer. In case of sending, it re-enables Tx-intr. In case
+ * of no data, it remains disabled.
+ * This is how the transmit state machine is dynamically switched on/off
+ */
+
+static irqreturn_t arc_serial_isr(int irq, void *dev_id)
+{
+ struct arc_uart_port *uart = dev_id;
+ unsigned int status;
+
+ status = UART_GET_STATUS(uart);
+
+ /*
+ * Single IRQ for both Rx (data available) Tx (room available) Interrupt
+ * notifications from the UART Controller.
+ * To demultiplex between the two, we check the relevant bits
+ */
+ if ((status & RXIENB) && !(status & RXEMPTY)) {
+
+ /* already in ISR, no need of xx_irqsave */
+ spin_lock(&uart->port.lock);
+ arc_serial_rx_chars(uart);
+ spin_unlock(&uart->port.lock);
+ }
+
+ if ((status & TXIENB) && (status & TXEMPTY)) {
+
+ /* Unconditionally disable further Tx-Interrupts.
+ * will be enabled by tx_chars() if needed.
+ */
+ UART_TX_IRQ_DISABLE(uart);
+
+ spin_lock(&uart->port.lock);
+
+ if (!uart_tx_stopped(&uart->port))
+ arc_serial_tx_chars(uart);
+
+ spin_unlock(&uart->port.lock);
+ }
+
+ return IRQ_HANDLED;
+}
+
+static unsigned int arc_serial_get_mctrl(struct uart_port *port)
+{
+ /*
+ * Pretend we have a Modem status reg and following bits are
+ * always set, to satify the serial core state machine
+ * (DSR) Data Set Ready
+ * (CTS) Clear To Send
+ * (CAR) Carrier Detect
+ */
+ return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
+}
+
+static void arc_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
+{
+ /* MCR not present */
+}
+
+/* Enable Modem Status Interrupts */
+
+static void arc_serial_enable_ms(struct uart_port *port)
+{
+ /* MSR not present */
+}
+
+static void arc_serial_break_ctl(struct uart_port *port, int break_state)
+{
+ /* ARC UART doesn't support sending Break signal */
+}
+
+static int arc_serial_startup(struct uart_port *port)
+{
+ struct arc_uart_port *uart = (struct arc_uart_port *)port;
+
+ /* Before we hook up the ISR, Disable all UART Interrupts */
+ UART_ALL_IRQ_DISABLE(uart);
+
+ if (request_irq(uart->port.irq, arc_serial_isr, 0, "arc uart rx-tx",
+ uart)) {
+ pr_warn("Unable to attach ARC UART interrupt\n");
+ return -EBUSY;
+ }
+
+ UART_RX_IRQ_ENABLE(uart); /* Only Rx IRQ enabled to begin with */
+
+ return 0;
+}
+
+/* This is not really needed */
+static void arc_serial_shutdown(struct uart_port *port)
+{
+ struct arc_uart_port *uart = (struct arc_uart_port *)port;
+ free_irq(uart->port.irq, uart);
+}
+
+static void arc_serial_set_ldisc(struct uart_port *port, int ld)
+{
+}
+
+static void
+arc_serial_set_termios(struct uart_port *port, struct ktermios *new,
+ struct ktermios *old)
+{
+ struct arc_uart_port *uart = (struct arc_uart_port *)port;
+ unsigned int baud, uartl, uarth, hw_val;
+ unsigned long flags;
+
+ /*
+ * Use the generic handler so that any specially encoded baud rates
+ * such as SPD_xx flags or "%B0" can be handled
+ * Max Baud I suppose will not be more than current 115K * 4
+ * Formula for ARC UART is: hw-val = ((CLK/(BAUD*4)) -1)
+ * spread over two 8-bit registers
+ */
+ baud = uart_get_baud_rate(port, new, old, 0, 460800);
+
+ hw_val = port->uartclk / (uart->baud * 4) - 1;
+ uartl = hw_val & 0xFF;
+ uarth = (hw_val >> 8) & 0xFF;
+
+ /*
+ * ISS UART emulation has a subtle bug:
+ * A existing value of Baudh = 0 is used as a indication to startup
+ * it's internal state machine.
+ * Thus if baudh is set to 0, 2 times, it chokes.
+ * This happens with BAUD=115200 and the formaula above
+ * Until that is fixed, when running on ISS, we will set baudh to !0
+ */
+ if (running_on_iss)
+ uarth = 1;
+
+ spin_lock_irqsave(&port->lock, flags);
+
+ UART_ALL_IRQ_DISABLE(uart);
+
+ UART_SET_BAUDL(uart, uartl);
+ UART_SET_BAUDH(uart, uarth);
+
+ UART_RX_IRQ_ENABLE(uart);
+
+ new->c_cflag &= ~(CMSPAR|CRTSCTS);
+
+ if (old)
+ tty_termios_copy_hw(new, old);
+
+ /* Don't rewrite B0 */
+ if (tty_termios_baud_rate(new))
+ tty_termios_encode_baud_rate(new, baud, baud);
+
+ uart_update_timeout(port, new->c_cflag, baud);
+
+ spin_unlock_irqrestore(&port->lock, flags);
+}
+
+static const char *arc_serial_type(struct uart_port *port)
+{
+ struct arc_uart_port *uart = (struct arc_uart_port *)port;
+
+ return uart->port.type == PORT_ARC ? DRIVER_NAME : NULL;
+}
+
+/*
+ * Release the memory region(s) being used by 'port'.
+ */
+static void arc_serial_release_port(struct uart_port *port)
+{
+}
+
+/*
+ * Request the memory region(s) being used by 'port'.
+ */
+static int arc_serial_request_port(struct uart_port *port)
+{
+ return 0;
+}
+
+/*
+ * Verify the new serial_struct (for TIOCSSERIAL).
+ */
+static int
+arc_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
+{
+ return 0;
+}
+
+/*
+ * Configure/autoconfigure the port.
+ */
+static void arc_serial_config_port(struct uart_port *port, int flags)
+{
+ struct arc_uart_port *uart = (struct arc_uart_port *)port;
+
+ if (flags & UART_CONFIG_TYPE &&
+ arc_serial_request_port(&uart->port) == 0)
+ uart->port.type = PORT_ARC;
+}
+
+static void arc_serial_poll_putchar(struct uart_port *port, unsigned char chr)
+{
+ struct arc_uart_port *uart = (struct arc_uart_port *)port;
+
+ while (!(UART_GET_STATUS(uart) & TXEMPTY))
+ cpu_relax();
+
+ UART_SET_DATA(uart, chr);
+}
+
+#ifdef CONFIG_CONSOLE_POLL
+static int arc_serial_poll_getchar(struct uart_port *port)
+{
+ struct arc_uart_port *uart = (struct arc_uart_port *)port;
+ unsigned char chr;
+
+ while (!(UART_GET_STATUS(uart) & RXEMPTY))
+ cpu_relax();
+
+ chr = UART_GET_DATA(uart);
+ return chr;
+}
+#endif
+
+static struct uart_ops arc_serial_pops = {
+ .tx_empty = arc_serial_tx_empty,
+ .set_mctrl = arc_serial_set_mctrl,
+ .get_mctrl = arc_serial_get_mctrl,
+ .stop_tx = arc_serial_stop_tx,
+ .start_tx = arc_serial_start_tx,
+ .stop_rx = arc_serial_stop_rx,
+ .enable_ms = arc_serial_enable_ms,
+ .break_ctl = arc_serial_break_ctl,
+ .startup = arc_serial_startup,
+ .shutdown = arc_serial_shutdown,
+ .set_termios = arc_serial_set_termios,
+ .set_ldisc = arc_serial_set_ldisc,
+ .type = arc_serial_type,
+ .release_port = arc_serial_release_port,
+ .request_port = arc_serial_request_port,
+ .config_port = arc_serial_config_port,
+ .verify_port = arc_serial_verify_port,
+#ifdef CONFIG_CONSOLE_POLL
+ .poll_put_char = arc_serial_poll_putchar,
+ .poll_get_char = arc_serial_poll_getchar,
+#endif
+};
+
+static int __devinit
+arc_uart_init_one(struct platform_device *pdev, struct arc_uart_port *uart)
+{
+ struct resource *res, *res2;
+ unsigned long *plat_data;
+
+ if (pdev->id < 0 || pdev->id >= CONFIG_SERIAL_ARC_NR_PORTS) {
+ dev_err(&pdev->dev, "Wrong uart platform device id.\n");
+ return -ENOENT;
+ }
+
+ plat_data = ((unsigned long *)(pdev->dev.platform_data));
+ uart->baud = plat_data[0];
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENODEV;
+
+ res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+ if (!res2)
+ return -ENODEV;
+
+ uart->port.mapbase = res->start;
+ uart->port.membase = ioremap_nocache(res->start, resource_size(res));
+ if (!uart->port.membase)
+ /* No point of pr_err since UART itself is hosed here */
+ return -ENXIO;
+
+ uart->port.irq = res2->start;
+ uart->port.dev = &pdev->dev;
+ uart->port.iotype = UPIO_MEM;
+ uart->port.flags = UPF_BOOT_AUTOCONF;
+ uart->port.line = pdev->id;
+ uart->port.ops = &arc_serial_pops;
+
+ uart->port.uartclk = plat_data[1];
+ uart->port.fifosize = ARC_UART_TX_FIFO_SIZE;
+
+ /*
+ * uart_insert_char( ) uses it in decideding whether to ignore a
+ * char or not. Explicitly setting it here, removes the subtelty
+ */
+ uart->port.ignore_status_mask = 0;
+
+ return 0;
+}
+
+#ifdef CONFIG_SERIAL_ARC_CONSOLE
+
+static int __devinit arc_serial_console_setup(struct console *co, char *options)
+{
+ struct uart_port *port;
+ int baud = 115200;
+ int bits = 8;
+ int parity = 'n';
+ int flow = 'n';
+
+ if (co->index < 0 || co->index >= CONFIG_SERIAL_ARC_NR_PORTS)
+ return -ENODEV;
+
+ /*
+ * The uart port backing the console (e.g. ttyARC1) might not have been
+ * init yet. If so, defer the console setup to after the port.
+ */
+ port = &arc_uart_ports[co->index].port;
+ if (!port->membase)
+ return -ENODEV;
+
+ if (options)
+ uart_parse_options(options, &baud, &parity, &bits, &flow);
+
+ /*
+ * Serial core will call port->ops->set_termios( )
+ * which will set the baud reg
+ */
+ return uart_set_options(port, co, baud, parity, bits, flow);
+}
+
+static void arc_serial_console_putchar(struct uart_port *port, int ch)
+{
+ arc_serial_poll_putchar(port, (unsigned char)ch);
+}
+
+/*
+ * Interrupts are disabled on entering
+ */
+static void arc_serial_console_write(struct console *co, const char *s,
+ unsigned int count)
+{
+ struct uart_port *port = &arc_uart_ports[co->index].port;
+ unsigned long flags;
+
+ spin_lock_irqsave(&port->lock, flags);
+ uart_console_write(port, s, count, arc_serial_console_putchar);
+ spin_unlock_irqrestore(&port->lock, flags);
+}
+
+static struct console arc_console = {
+ .name = ARC_SERIAL_DEV_NAME,
+ .write = arc_serial_console_write,
+ .device = uart_console_device,
+ .setup = arc_serial_console_setup,
+ .flags = CON_PRINTBUFFER,
+ .index = -1,
+ .data = &arc_uart_driver
+};
+
+static __init void early_serial_write(struct console *con, const char *s,
+ unsigned int n)
+{
+ struct uart_port *port = &arc_uart_ports[con->index].port;
+ unsigned int i;
+
+ for (i = 0; i < n; i++, s++) {
+ if (*s == '\n')
+ arc_serial_poll_putchar(port, '\r');
+ arc_serial_poll_putchar(port, *s);
+ }
+}
+
+static struct __initdata console arc_early_serial_console = {
+ .name = "early_ARCuart",
+ .write = early_serial_write,
+ .flags = CON_PRINTBUFFER | CON_BOOT,
+ .index = -1
+};
+
+static int __devinit arc_serial_probe_earlyprintk(struct platform_device *pdev)
+{
+ arc_early_serial_console.index = pdev->id;
+
+ arc_uart_init_one(pdev, &arc_uart_ports[pdev->id]);
+
+ arc_serial_console_setup(&arc_early_serial_console, NULL);
+
+ register_console(&arc_early_serial_console);
+ return 0;
+}
+#endif
+
+
+static int __devinit arc_serial_probe(struct platform_device *pdev)
+{
+ struct arc_uart_port *uart;
+ int rc;
+
+ if (is_early_platform_device(pdev))
+ return arc_serial_probe_earlyprintk(pdev);
+
+ uart = &arc_uart_ports[pdev->id];
+ rc = arc_uart_init_one(pdev, uart);
+ if (rc)
+ return rc;
+
+ return uart_add_one_port(&arc_uart_driver, &uart->port);
+}
+
+static int __devexit arc_serial_remove(struct platform_device *pdev)
+{
+ /* This will never be called */
+ return 0;
+}
+
+static struct platform_driver arc_platform_driver = {
+ .probe = arc_serial_probe,
+ .remove = __devexit_p(arc_serial_remove),
+ .driver = {
+ .name = DRIVER_NAME,
+ .owner = THIS_MODULE,
+ },
+};
+
+#ifdef CONFIG_SERIAL_ARC_CONSOLE
+/*
+ * Register an early platform driver of "earlyprintk" class.
+ * ARCH platform code installs the driver and probes the early devices
+ * The installation could rely on user specifying earlyprintk=xyx in cmd line
+ * or it could be done independently, for all "earlyprintk" class drivers.
+ * [see arch/arc/plat-arcfpga/platform.c]
+ */
+early_platform_init("earlyprintk", &arc_platform_driver);
+
+#endif /* CONFIG_SERIAL_ARC_CONSOLE */
+
+static int __init arc_serial_init(void)
+{
+ int ret;
+
+ pr_info("Serial: ARC serial driver: platform register\n");
+
+ ret = uart_register_driver(&arc_uart_driver);
+ if (ret)
+ return ret;
+
+ ret = platform_driver_register(&arc_platform_driver);
+ if (ret) {
+ pr_debug("uart register failed\n");
+ uart_unregister_driver(&arc_uart_driver);
+ }
+
+ return ret;
+}
+
+static void __exit arc_serial_exit(void)
+{
+ platform_driver_unregister(&arc_platform_driver);
+ uart_unregister_driver(&arc_uart_driver);
+}
+
+module_init(arc_serial_init);
+module_exit(arc_serial_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("plat-arcfpga/uart");
+MODULE_AUTHOR("Vineet Gupta");
+MODULE_DESCRIPTION("ARC(Synopsys) On-Chip(fpga) serial driver");
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 0253c20..706a042 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -214,6 +214,9 @@
/* Energy Micro efm32 SoC */
#define PORT_EFMUART 100
+/* ARC (Synopsys) on-chip UART */
+#define PORT_ARC 101
+
#ifdef __KERNEL__
#include <linux/compiler.h>
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH] serial/arc-uart: Add new driver
From: Vineet Gupta @ 2012-10-02 4:33 UTC (permalink / raw)
To: Alan Cox; +Cc: gregkh, linux-serial, linux-kernel
In-Reply-To: <20120928140248.54a10d06@bob.linux.org.uk>
On Friday 28 September 2012 06:32 PM, Alan Cox wrote:
>> +static void
>> +arc_serial_set_termios(struct uart_port *port, struct ktermios
>> *termios,
>> + struct ktermios *old)
>> +{
>> + struct arc_uart_port *uart = (struct arc_uart_port *)port;
>> + unsigned int baud, uartl, uarth, hw_val;
>> + unsigned long flags;
>> +
> Two things here. Firstly you want to write the actual baud back to the
> termios (tty_termios_encode_baud_rate) unless B0 is set.
>
> Secondly if you don't support hardware flow control, character size
> setting etc then you need to set those bits back so the caller knows.
> Two ways to do that. Either initialise the default termios for the tty
> type to the correct values and use tty_termios_copy_hw() or set them in
> the termios handler.
Just to give you an idea, is something on the lines of following OK for
both the above points above !
- uart_update_timeout(port, termios->c_cflag, baud);
+ new->c_cflag &= ~(CMSPAR|CRTSCTS); /* Don't care for
parity/flow ctrl */
+
+ if (old)
+ tty_termios_copy_hw(new, old);
+
+ /* Don't rewrite B0 */
+ if (tty_termios_baud_rate(new))
+ tty_termios_encode_baud_rate(new, baud, baud);
+
+ uart_update_timeout(port, new->c_cflag, baud);
Respun patch to follow shortly.
Thx,
Vineet
^ permalink raw reply
* Re: [GIT PATCH] TTY patches for 3.7-rc1
From: Greg KH @ 2012-10-01 22:13 UTC (permalink / raw)
To: Jiri Slaby; +Cc: Alan Cox, linux-kernel, linux-serial, Stanislav Kozina
In-Reply-To: <506A0FCA.2020908@suse.cz>
On Mon, Oct 01, 2012 at 11:48:58PM +0200, Jiri Slaby wrote:
> On 10/01/2012 08:30 PM, Greg KH wrote:
> > Stanislav Kozina (2):
> > tty: Fix possible race in n_tty_read()
>
> The (pretty hopeless) commit log says:
> Fix possible panic caused by unlocked access to tty->read_cnt in
> while-loop condition in n_tty_read().
>
> Just curious, what kind of panic that can cause, can you be more
> concrete on that? I suppose two readers, one eats everything, the other
> is a killer? And should we backport to -stable?
Stanislav, you are the one who could reproduce this, any answers here?
thanks,
greg k-h
^ permalink raw reply
* Re: [GIT PATCH] TTY patches for 3.7-rc1
From: Jiri Slaby @ 2012-10-01 21:48 UTC (permalink / raw)
To: Greg KH; +Cc: Alan Cox, linux-kernel, linux-serial, Stanislav Kozina
In-Reply-To: <20121001183046.GA13042@kroah.com>
On 10/01/2012 08:30 PM, Greg KH wrote:
> Stanislav Kozina (2):
> tty: Fix possible race in n_tty_read()
The (pretty hopeless) commit log says:
Fix possible panic caused by unlocked access to tty->read_cnt in
while-loop condition in n_tty_read().
Just curious, what kind of panic that can cause, can you be more
concrete on that? I suppose two readers, one eats everything, the other
is a killer? And should we backport to -stable?
thanks,
--
js
suse labs
^ permalink raw reply
* [GIT PATCH] TTY patches for 3.7-rc1
From: Greg KH @ 2012-10-01 18:30 UTC (permalink / raw)
To: Linus Torvalds, Alan Cox, Jiri Slaby
Cc: Andrew Morton, linux-kernel, linux-serial
The following changes since commit 5698bd757d55b1bb87edd1a9744ab09c142abfc2:
Linux 3.6-rc6 (2012-09-16 14:58:51 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git/ tags/tty-3.6
for you to fetch changes up to 0c57dfcc6c1d037243c2f8fbf62eab3633326ec0:
tty/serial: Add kgdb_nmi driver (2012-09-26 13:52:36 -0700)
----------------------------------------------------------------
TTY merge for 3.7-rc1
As we skipped the merge window for 3.6-rc1 for the tty tree, everything
is now settled down and working properly, so we are ready for 3.7-rc1.
Here's the patchset, it's big, but the large changes are removing a
firmware file and adding a staging tty driver (it depended on the tty
core changes, so it's going through this tree instead of the staging
tree.)
All of these patches have been in the linux-next tree for a while.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----------------------------------------------------------------
Alan Cox (31):
tty: note race we need to fix
tty: localise the lock
usb: fix sillies in the metro USB driver
8250: use the 8250 register interface not the legacy one
8250: propogate the bugs field
8250: add support for ASIX devices with a FIFO bug
tty: revert incorrectly applied lock patch
tty: move the termios object into the tty
f81232: correct stubbed termios handler
usb, kobil: Sort out some bogus tty handling
tty: Fix up PPC fallout from the termios move
8250: three way resolve of the 8250 diffs
vt: fix the keyboard/led locking
tty: Move the handling of the tty release logic
pch_uart: Fix missing break for 16 byte fifo
pcmcia,synclink_cs: fix termios port I missed
tty: Fix race in tty release
serqt_usb2: drag screaming into the 21st century
tty: fix the metro-usb change I messed up
tty: localise the lock
ipoctal: make it compile with the termios changes
8250: add AgeStar AS-PRS2-009
tty: Split the serial_core helpers for setserial into two
tty: move the async flags from the serial code into the tty includes
8250_pci: Add additional WCH CHC353 devices
tty: Fix hvc return
tty: serial: max3100: Fix error case
tty: ipwireless: check ppp register worked
tty: n_gsm: Fix incorrect debug display
serial_core: Fix race in uart_handle_dcd_change
pty: Fix locking bug on error path
Alexander Shiyan (7):
serial: sc26xx: Fix compile breakage
serial: New serial driver MAX310X
serial: New serial driver SCCNXP
serial: Add note about migration to driver SCCNXP
serial: sccnxp: Report actual baudrate back to core
serial: sccnxp: Remove mask termios caps for SW flow control
serial: sccnxp: Make 'default' choice in switch last
Anton Vorontsov (7):
kernel/debug: Mask KGDB NMI upon entry
kdb: Implement disable_nmi command
kdb: Turn KGDB_KDB=n stubs into static inlines
tty/serial/core: Introduce poll_init callback
tty/serial/amba-pl011: Implement poll_init callback
tty/serial/amba-pl011: Quiesce interrupts in poll_get_char
tty/serial: Add kgdb_nmi driver
Bill Pemberton (3):
staging: Add dgrp driver for Digi Realport devices
staging: dgrp: add dgrp to the build
staging: dgrp: fix potential call to strncpy with a negative number
Chao Xie (1):
serial: pxa: add spin lock for console write
Christophe Leroy (4):
Powerpc 8xx CPM_UART desynchronisation
Powerpc 8xx CPM_UART too many interrupts
Powerpc 8xx CPM_UART maxidl should not depend on fifo size
Powerpc 8xx CPM_UART setting MAXIDL register proportionaly to baud rate
Christopher Brannon (1):
tty: keyboard.c: Remove locking from vt_get_leds.
Corbin (1):
serial_core: Update buffer overrun statistics.
Dan Carpenter (4):
tty: double unlock on error in ptmx_open()
tty: fix missing assignment
tty: handle NULL parameters in free_tty_struct()
TTY: tty_alloc_driver() returns error pointers
Darren Hart (1):
pch_uart: Add eg20t_port lock field, avoid recursive spinlocks
David Brown (1):
msm_serial: fix clock rate on DMA-based uarts
David Daney (1):
MIPS: OCTEON: Fix breakage due to 8250 changes.
Devendra Naga (1):
tty: max3100: use module_spi_driver
Emil Goode (2):
tty: serial: max310x: Check return code of gpiochip_remove
tty: serial: max310x: Remove explicit use of devm_kfree
Felipe Balbi (22):
serial: omap: define and use to_uart_omap_port()
serial: omap: define helpers for pdata function pointers
serial: omap: don't access the platform_device
serial: omap: drop DMA support
serial: add OMAP-specific defines
serial: omap: simplify IRQ handling
serial: omap: refactor receive_chars() into rdi/rlsi handlers
serial: omap: move THRE check to transmit_chars()
serial: omap: stick to put_autosuspend
serial: omap: set dev->drvdata before enabling pm_runtime
serial: omap: drop unnecessary check from remove
serial: omap: make sure to suspend device before remove
serial: omap: don't save IRQ flags on hardirq
serial: omap: optimization with section annotations
serial: omap: drop "inline" from IRQ handler prototype
serial: omap: implement set_wake
serial: omap: make sure to put() on poll_get_char
serial: omap: remove unnecessary header and add a missing one
serial: omap: move uart_omap_port definition to C file
serial: omap: enable RX and TX FIFO usage
serial: omap: fix compile breakage
serial: omap: fix DeviceTree boot
Fengguang Wu (2):
pch_uart: check kzalloc result in dma_handle_tx()
serial_core: fix sizeof(pointer)
Flavio Leitner (2):
8250: fix autoconfig to work with serial console
serial: set correct baud_base for EXSYS EX-41092 Dual 16950
Frederic Berat (1):
n_gsm : Flow control handling in Mux driver
Gabor Juhos (1):
tty: of_serial: add no-loopback-test property
Greg Kroah-Hartman (7):
Merge 3.5-rc4 into tty-next
Merge branch 'v3.6-rc7' into tty-next
Merge tty-next into 3.6-rc1
Merge 3.6-rc3 into tty-next
Merge 3.6-rc6 into tty-next
tty/serial: remove CONFIG_EXPERIMENTAL dependencies
tty/serial: put (EXPERIMENTAL) marking back on N_GSM and SERIAL_IFX6X60
Guainluca Anzolin (1):
parport_serial: Add support for the WCH353 2S/1P multi-IO card
Huang Shijie (4):
serial: add a new helper function
serial: mxs-auart: fix the wrong setting order
serial: mxs-auart: put the device in mxs_auart_probe()
serial: mxs-auart: put the device in the error path
Jaeden Amero (3):
n_tty: Don't lose characters when PARMRK is enabled
compat_ioctl: Add RS-485 IOCTLs to the list
compat_ioctl: Avoid using undefined RS-485 IOCTLs
Jean-François Moine (1):
tty vt: Fix line garbage in virtual console on command line edition
Jiri Slaby (67):
TTY: cyclades, add local pointer for card
TTY: ircomm, add tty_port
TTY: ircomm, use close times from tty_port
TTY: ircomm, use open counts from tty_port
TTY: ircomm, use flags from tty_port
TTY: ircomm, revamp locking
TTY: ircomm, use tty from tty_port
TTY: ircomm, define local tty_port
TTY: ircomm, define carrier routines
TTY: ircomm, use tty_port_close_end helper
TTY: ircomm, use tty_port_close_start helper
TTY: um/line, add tty_port
TTY: um/line, use tty from tty_port
PTY: remove one empty ops->remove
PTY: merge pty_install implementations
PTY: add tty_port
TTY: vt, remove con_schedule_flip
TTY: provide drivers with tty_port_install
TTY: vt, add ->install
TTY: usb-serial, use tty_port_install
TTY: centralize fail paths in tty_register_driver
TTY: add ports array to tty_driver
TTY: add tty_port_register_device helper
TTY: pty, stop passing NULL to free_tty_struct
TTY: 68328serial, fix compilation
TTY: n_gsm, use tty_port_install
misc: pti, add const to pci_device_id table
misc: pti, pci drvdata cannot be NULL in ->remove
misc: pti, stop using iomap's unmap on ioremap space
misc: pti, move ->remove to the PCI code
misc: pti, do the opposite of ->probe in ->remove
misc: pti, fix fail paths
misc: pti, fix tty_port count
misc: pti, use tty_port_register_device
mxser: allow overlapping vector
TTY: ttyprintk, unregister tty driver on failure
TTY: ttyprintk, don't touch behind tty->write_buf
TTY: ttyprintk, initialize tty_port earlier
TTY: tty3270, free tty driver properly
TTY: pass flags to alloc_tty_driver
TTY: pty, switch to tty_alloc_driver
TTY: move allocations to tty_alloc_driver
TTY: add support for unnumbered device nodes
TTY: move cdev_add to tty_register_device
TTY: use tty_port_register_device
TTY: automatically create nodes for some drivers
TTY: tty_port, add some documentation
TTY: add tty_port_link_device
TTY: use tty_port_link_device
TTY: synclink_cs, sanitize fail paths
TTY: synclink_cs, use dynamic tty devices
TTY: synclink_cs, final cleanup in synclink_cs_init
TTY: moxa, convert to dynamic device
TTY: nfcon, add tty_port and link it
TTY: con3215, unset raw3215[line]
TTY: con3215, add tty install
TTY: i4l, add tty install
TTY: synclink, add tty install
TTY: synclinkmp, add tty install
TTY: ircomm_tty, add tty install
TTY: tty3270, add tty install
TTY: hvc_console, add tty install
TTY: hvcs, clean hvcs_open a bit
TTY: hvcs, add tty install
TTY: mxser, fix invalid module_parm permissions
TTY: synclink_cs, fix build
TTY: check if tty->port is assigned
Julia Lawall (3):
drivers/tty/moxa.c: fix error return code
drivers/tty/serial/amba-pl0{10,11}.c: use clk_prepare_enable and clk_disable_unprepare
drivers/tty/serial/sirfsoc_uart.c: drop frees of devm_ alloc'd data
Julien Pichon (1):
serial: samsung: Add poll_get_char & poll_put_char
KeyYoung Park (1):
serial: samsung: protect NULL dereference of clock name
Kyoungil Kim (2):
serial: samsung: Remove NULL checking for baud clock
serial: samsung: Fixed wrong comparison for baudclk_rate
Laurent Pinchart (2):
serial: sh-sci: Fix probe error paths
serial: sh-sci: Make probe fail for ports that exceed the maximum count
Linus Walleij (4):
serial/amba-pl011: fix ages old copy-paste errors
serial: pl011: delete dangling bug flag
serial: pl011: delete reset callback
serial: pl011: handle corruption at high clock speeds
Matthew Leach (1):
serial: pl011: honour serial aliases in device tree
NeilBrown (1):
OMAP/serial: Add support for driving a GPIO as DTR.
Paul Bolle (2):
delete seven tty headers
Delete generic_serial.h
Paul Gortmaker (3):
m32r_sio: remove dependency on struct serial_uart_config
serial: sunsu.c - don't explicitly tie array size to dynamic entity
serial: diminish usage of struct serial_uart_config
Rabin Vincent (1):
vt: fix race in vt_waitactive()
Richard Zhao (2):
serial: imx: set sport as drvdata, like it's used elsewhere
serial: imx: remove null check of sport in suspend/resume function
Roland Stigge (3):
serial/8250: Add LPC3220 standard UART type
serial/of-serial: Add LPC3220 standard UART compatible string
serial: Add driver for LPC32xx High Speed UARTs
Ruchika Kharwar (2):
serial: omap: fix sequence of pm_runtime_* calls.
serial: omap: unlock the port lock
Russ Gorby (5):
n_gsm: uplink SKBs accumulate on list
n_gsm: added interlocking for gsm_data_lock for certain code paths
n_gsm: avoid accessing freed memory during CMD_FCOFF condition
n_gsm: replace kfree_skb w/ appropriate dev_* versions
n_gsm: memory leak in uplink error path
Sachin Kamat (3):
serial: Samsung: Replace printk with dev_* functions
serial: Samsung: Silence some checkpatch errors and warnings
tty: serial: Samsung: Fix return value
Sean Young (2):
8250_pnp: do pnp probe before legacy probe
8250: blacklist Winbond CIR port
Shachar Shemesh (1):
tty ldisc: Close/Reopen race prevention should check the proper flag
Shawn Bohrer (1):
8250_pci: Remove duplicate struct pciserial_board
Shubhrajyoti D (1):
serial: omap: fix the reciever line error case
Sourav Poddar (1):
serial: omap: Remove unnecessary checks from suspend/resume
Stanislav Kozina (2):
tty: Fix possible race in n_tty_read()
Remove BUG_ON from n_tty_read()
Stephen Rothwell (3):
tty: fix up usb serial console for termios change.
serial: serial_core.h needs console.h included first
staging: dgrp: using vmalloc needs to include vmalloc.h
Tim Gardner (1):
firmware: remove computone driver firmware and documentation
Tobias Klauser (1):
tty: serial: altera_uart: Use platform_{get,set}_drvdata
Tomas Hlavacek (2):
tty: uartclk value from serial_core exposed to sysfs
tty_register_device_attr updated for tty-next
Tomoya MORINAGA (2):
pch_uart: Fix rx error interrupt setting issue
pch_uart: Fix parity setting issue
Tony Lindgren (2):
serial: omap: Request pins using pinctrl framework
serial/8250: Limit the omap workarounds to omap1
Uwe Kleine-König (2):
serial/imx: make devdata member point to const data
serial/imx: improve error diagnosics for clock and pinctrl failures
Vikram Pandita (1):
serial: omap: fix software flow control
Wanlong Gao (1):
drivers:tty:fix up ENOIOCTLCMD error handling
Wei Yongjun (2):
parport: fix possible memory leak in parport_gsc_probe_port()
TTY: serial: move the dereference below the NULL test
Wolfram Sang (1):
tty: serial: mpc5xxx: add support for mark/space parity
samix.lebsir (1):
char: n_gsm: remove message filtering for contipated DLCI
xiaojin (1):
n_gsm.c: Implement 3GPP27.010 DLC start-up procedure in MUX
Documentation/ABI/testing/sysfs-tty | 9 +
Documentation/devicetree/bindings/tty/serial/nxp-lpc32xx-hsuart.txt | 14 +
Documentation/devicetree/bindings/tty/serial/of-serial.txt | 2 +
Documentation/serial/00-INDEX | 2 -
Documentation/serial/computone.txt | 520 ------
arch/alpha/kernel/srmcons.c | 1 +
arch/arm/mach-omap2/serial.c | 18 +-
arch/arm/mach-ux500/board-mop500.c | 21 -
arch/arm/plat-omap/include/plat/omap-serial.h | 50 +-
arch/ia64/hp/sim/simserial.c | 3 +-
arch/m68k/emu/nfcon.c | 4 +
arch/mips/cavium-octeon/serial.c | 30 +-
arch/mips/sni/a20r.c | 32 +
arch/parisc/kernel/pdc_cons.c | 1 +
arch/um/drivers/line.c | 3 +-
arch/xtensa/platforms/iss/console.c | 1 +
drivers/bluetooth/hci_ath.c | 2 +-
drivers/char/mwave/mwavedd.c | 16 +-
drivers/char/pcmcia/synclink_cs.c | 131 +-
drivers/char/ttyprintk.c | 33 +-
drivers/isdn/capi/capi.c | 3 +-
drivers/isdn/gigaset/interface.c | 7 +-
drivers/isdn/i4l/isdn_tty.c | 41 +-
drivers/misc/ibmasm/uart.c | 16 +-
drivers/misc/pti.c | 128 +-
drivers/mmc/card/sdio_uart.c | 24 +-
drivers/net/ethernet/sgi/ioc3-eth.c | 22 +-
drivers/net/irda/irtty-sir.c | 10 +-
drivers/net/usb/hso.c | 19 +-
drivers/parport/parport_gsc.c | 1 +
drivers/parport/parport_serial.c | 11 +-
drivers/s390/char/con3215.c | 28 +-
drivers/s390/char/sclp_tty.c | 1 +
drivers/s390/char/sclp_vt220.c | 1 +
drivers/s390/char/tty3270.c | 34 +-
drivers/staging/Kconfig | 2 +
drivers/staging/Makefile | 1 +
drivers/staging/dgrp/Kconfig | 9 +
drivers/staging/dgrp/Makefile | 12 +
drivers/staging/dgrp/README | 2 +
drivers/staging/dgrp/TODO | 13 +
drivers/staging/dgrp/dgrp_common.c | 200 +++
drivers/staging/dgrp/dgrp_common.h | 208 +++
drivers/staging/dgrp/dgrp_dpa_ops.c | 556 +++++++
drivers/staging/dgrp/dgrp_driver.c | 110 ++
drivers/staging/dgrp/dgrp_mon_ops.c | 346 ++++
drivers/staging/dgrp/dgrp_net_ops.c | 3737 ++++++++++++++++++++++++++++++++++++++++++
drivers/staging/dgrp/dgrp_ports_ops.c | 170 ++
drivers/staging/dgrp/dgrp_specproc.c | 822 ++++++++++
drivers/staging/dgrp/dgrp_sysfs.c | 555 +++++++
drivers/staging/dgrp/dgrp_tty.c | 3331 +++++++++++++++++++++++++++++++++++++
drivers/staging/dgrp/digirp.h | 129 ++
drivers/staging/dgrp/drp.h | 693 ++++++++
drivers/staging/ipack/devices/ipoctal.c | 14 +-
drivers/staging/serqt_usb2/serqt_usb2.c | 18 +-
drivers/staging/speakup/serialio.h | 3 +-
drivers/tty/Kconfig | 9 +-
drivers/tty/amiserial.c | 45 +-
drivers/tty/bfin_jtag_comm.c | 1 +
drivers/tty/cyclades.c | 102 +-
drivers/tty/ehv_bytechan.c | 9 +-
drivers/tty/hvc/Kconfig | 2 +-
drivers/tty/hvc/hvc_console.c | 33 +-
drivers/tty/hvc/hvcs.c | 82 +-
drivers/tty/hvc/hvsi.c | 2 +
drivers/tty/hvc/hvsi_lib.c | 2 +-
drivers/tty/ipwireless/network.c | 7 +-
drivers/tty/ipwireless/tty.c | 2 +-
drivers/tty/isicom.c | 13 +-
drivers/tty/moxa.c | 39 +-
drivers/tty/mxser.c | 63 +-
drivers/tty/n_gsm.c | 144 +-
drivers/tty/n_r3964.c | 10 +-
drivers/tty/n_tty.c | 29 +-
drivers/tty/nozomi.c | 4 +-
drivers/tty/pty.c | 234 +--
drivers/tty/rocket.c | 22 +-
drivers/tty/serial/68328serial.c | 23 +-
drivers/tty/serial/8250/8250.c | 156 +-
drivers/tty/serial/8250/8250.h | 43 +-
drivers/tty/serial/8250/8250_acorn.c | 22 +-
drivers/tty/serial/8250/8250_dw.c | 38 +-
drivers/tty/serial/8250/8250_gsc.c | 26 +-
drivers/tty/serial/8250/8250_hp300.c | 26 +-
drivers/tty/serial/8250/8250_pci.c | 214 ++-
drivers/tty/serial/8250/8250_pnp.c | 59 +-
drivers/tty/serial/8250/Kconfig | 16 +-
drivers/tty/serial/8250/Makefile | 5 +-
drivers/tty/serial/8250/serial_cs.c | 30 +-
drivers/tty/serial/Kconfig | 73 +-
drivers/tty/serial/Makefile | 5 +-
drivers/tty/serial/altera_uart.c | 6 +-
drivers/tty/serial/amba-pl010.c | 15 +-
drivers/tty/serial/amba-pl011.c | 177 +-
drivers/tty/serial/bfin_uart.c | 2 +-
drivers/tty/serial/cpm_uart/cpm_uart_core.c | 23 +-
drivers/tty/serial/crisv10.c | 45 +-
drivers/tty/serial/ifx6x60.c | 4 +-
drivers/tty/serial/imx.c | 13 +-
drivers/tty/serial/ioc3_serial.c | 3 +-
drivers/tty/serial/ioc4_serial.c | 5 +-
drivers/tty/serial/jsm/jsm_tty.c | 8 +-
drivers/tty/serial/kgdb_nmi.c | 402 +++++
drivers/tty/serial/kgdboc.c | 9 +
drivers/tty/serial/lpc32xx_hs.c | 823 ++++++++++
drivers/tty/serial/m32r_sio.c | 36 +-
drivers/tty/serial/max3100.c | 26 +-
drivers/tty/serial/max3107.c | 1215 --------------
drivers/tty/serial/max3107.h | 441 -----
drivers/tty/serial/max310x.c | 1260 ++++++++++++++
drivers/tty/serial/mpc52xx_uart.c | 8 +-
drivers/tty/serial/msm_serial.c | 2 +-
drivers/tty/serial/msm_smd_tty.c | 8 +-
drivers/tty/serial/mxs-auart.c | 8 +-
drivers/tty/serial/of_serial.c | 13 +-
drivers/tty/serial/omap-serial.c | 885 +++++-----
drivers/tty/serial/pch_uart.c | 4 +
drivers/tty/serial/pxa.c | 14 +
drivers/tty/serial/samsung.c | 95 +-
drivers/tty/serial/sc26xx.c | 4 +
drivers/tty/serial/sccnxp.c | 990 +++++++++++
drivers/tty/serial/serial_core.c | 251 +--
drivers/tty/serial/sirfsoc_uart.c | 8 +-
drivers/tty/serial/sunsu.c | 8 +-
drivers/tty/synclink.c | 86 +-
drivers/tty/synclink_gt.c | 37 +-
drivers/tty/synclinkmp.c | 58 +-
drivers/tty/tty_io.c | 375 +++--
drivers/tty/tty_ioctl.c | 100 +-
drivers/tty/tty_ldisc.c | 78 +-
drivers/tty/tty_mutex.c | 71 +-
drivers/tty/tty_port.c | 94 +-
drivers/tty/vt/keyboard.c | 50 +-
drivers/tty/vt/vt.c | 141 +-
drivers/usb/class/cdc-acm.c | 5 +-
drivers/usb/gadget/u_serial.c | 3 +-
drivers/usb/serial/ark3116.c | 4 +-
drivers/usb/serial/belkin_sa.c | 2 +-
drivers/usb/serial/console.c | 4 +-
drivers/usb/serial/cp210x.c | 8 +-
drivers/usb/serial/cypress_m8.c | 40 +-
drivers/usb/serial/digi_acceleport.c | 14 +-
drivers/usb/serial/empeg.c | 2 +-
drivers/usb/serial/f81232.c | 3 +-
drivers/usb/serial/ftdi_sio.c | 2 +-
drivers/usb/serial/io_edgeport.c | 12 +-
drivers/usb/serial/io_ti.c | 12 +-
drivers/usb/serial/ir-usb.c | 2 +-
drivers/usb/serial/iuu_phoenix.c | 28 +-
drivers/usb/serial/keyspan.c | 6 +-
drivers/usb/serial/keyspan_pda.c | 4 +-
drivers/usb/serial/kl5kusb105.c | 18 +-
drivers/usb/serial/kobil_sct.c | 14 +-
drivers/usb/serial/mct_u232.c | 4 +-
drivers/usb/serial/metro-usb.c | 6 -
drivers/usb/serial/mos7720.c | 14 +-
drivers/usb/serial/mos7840.c | 12 +-
drivers/usb/serial/oti6858.c | 10 +-
drivers/usb/serial/pl2303.c | 6 +-
drivers/usb/serial/quatech2.c | 4 +-
drivers/usb/serial/sierra.c | 2 +-
drivers/usb/serial/spcp8x5.c | 12 +-
drivers/usb/serial/ssu100.c | 4 +-
drivers/usb/serial/ti_usb_3410_5052.c | 10 +-
drivers/usb/serial/usb-serial.c | 7 +-
drivers/usb/serial/usb_wwan.c | 2 +-
drivers/usb/serial/whiteheat.c | 2 +-
firmware/Makefile | 1 -
firmware/intelliport2.bin.ihex | 2147 ------------------------
fs/compat_ioctl.c | 6 +
include/linux/Kbuild | 4 +-
include/linux/amba/serial.h | 1 -
include/linux/cd1400.h | 292 ----
include/linux/cdk.h | 486 ------
include/linux/comstats.h | 119 --
include/linux/generic_serial.h | 35 -
include/linux/istallion.h | 123 --
include/linux/kbd_kern.h | 13 -
include/linux/kdb.h | 29 +-
include/linux/kgdb.h | 13 +
include/linux/pci_ids.h | 1 -
include/linux/platform_data/max310x.h | 67 +
include/linux/platform_data/sccnxp.h | 93 ++
include/linux/sc26198.h | 533 ------
include/linux/serial.h | 81 +-
include/linux/serial167.h | 157 --
include/linux/serial_8250.h | 33 +-
include/linux/serial_core.h | 8 +-
include/linux/serial_reg.h | 4 +
include/linux/stallion.h | 147 --
include/linux/tty.h | 92 +-
include/linux/tty_driver.h | 47 +-
include/linux/tty_flags.h | 78 +
include/net/irda/ircomm_tty.h | 17 +-
kernel/debug/debug_core.c | 14 +-
kernel/debug/kdb/kdb_main.c | 31 +
net/bluetooth/rfcomm/tty.c | 10 +-
net/irda/ircomm/ircomm_param.c | 5 -
net/irda/ircomm/ircomm_tty.c | 320 ++--
net/irda/ircomm/ircomm_tty_attach.c | 40 +-
net/irda/ircomm/ircomm_tty_ioctl.c | 33 +-
201 files changed, 18056 insertions(+), 8963 deletions(-)
create mode 100644 Documentation/devicetree/bindings/tty/serial/nxp-lpc32xx-hsuart.txt
delete mode 100644 Documentation/serial/computone.txt
create mode 100644 drivers/staging/dgrp/Kconfig
create mode 100644 drivers/staging/dgrp/Makefile
create mode 100644 drivers/staging/dgrp/README
create mode 100644 drivers/staging/dgrp/TODO
create mode 100644 drivers/staging/dgrp/dgrp_common.c
create mode 100644 drivers/staging/dgrp/dgrp_common.h
create mode 100644 drivers/staging/dgrp/dgrp_dpa_ops.c
create mode 100644 drivers/staging/dgrp/dgrp_driver.c
create mode 100644 drivers/staging/dgrp/dgrp_mon_ops.c
create mode 100644 drivers/staging/dgrp/dgrp_net_ops.c
create mode 100644 drivers/staging/dgrp/dgrp_ports_ops.c
create mode 100644 drivers/staging/dgrp/dgrp_specproc.c
create mode 100644 drivers/staging/dgrp/dgrp_sysfs.c
create mode 100644 drivers/staging/dgrp/dgrp_tty.c
create mode 100644 drivers/staging/dgrp/digirp.h
create mode 100644 drivers/staging/dgrp/drp.h
create mode 100644 drivers/tty/serial/kgdb_nmi.c
create mode 100644 drivers/tty/serial/lpc32xx_hs.c
delete mode 100644 drivers/tty/serial/max3107.c
delete mode 100644 drivers/tty/serial/max3107.h
create mode 100644 drivers/tty/serial/max310x.c
create mode 100644 drivers/tty/serial/sccnxp.c
delete mode 100644 firmware/intelliport2.bin.ihex
delete mode 100644 include/linux/cd1400.h
delete mode 100644 include/linux/cdk.h
delete mode 100644 include/linux/comstats.h
delete mode 100644 include/linux/generic_serial.h
delete mode 100644 include/linux/istallion.h
create mode 100644 include/linux/platform_data/max310x.h
create mode 100644 include/linux/platform_data/sccnxp.h
delete mode 100644 include/linux/sc26198.h
delete mode 100644 include/linux/serial167.h
delete mode 100644 include/linux/stallion.h
create mode 100644 include/linux/tty_flags.h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH] serial: sccnxp: Allows the driver to be compiled as a module
From: Alexander Shiyan @ 2012-09-30 9:19 UTC (permalink / raw)
To: linux-serial; +Cc: Alan Cox, Greg Kroah-Hartman, Alexander Shiyan
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/tty/serial/Kconfig | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 750671d..b7aaa95 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1105,7 +1105,7 @@ config SERIAL_SC26XX_CONSOLE
Support for Console on SC2681/SC2692 serial ports.
config SERIAL_SCCNXP
- bool "SCCNXP serial port support"
+ tristate "SCCNXP serial port support"
depends on !SERIAL_SC26XX
select SERIAL_CORE
default n
@@ -1117,7 +1117,7 @@ config SERIAL_SCCNXP
config SERIAL_SCCNXP_CONSOLE
bool "Console on SCCNXP serial port"
- depends on SERIAL_SCCNXP
+ depends on SERIAL_SCCNXP=y
select SERIAL_CORE_CONSOLE
help
Support for console on SCCNXP serial ports.
--
1.7.8.6
^ permalink raw reply related
* Re: [PATCH] tty/8250_early: Prevent rounding error in uartclk to baud ratio
From: Vineet Gupta @ 2012-09-29 11:04 UTC (permalink / raw)
To: Jiri Slaby; +Cc: Alexey Brodkin, gregkh, alan, linux-serial, linux-kernel
In-Reply-To: <50669E35.20809@suse.cz>
On Saturday 29 September 2012 12:37 PM, Jiri Slaby wrote:
> On 09/29/2012 08:40 AM, Vineet Gupta wrote:
>> On Friday 28 September 2012 06:32 PM, Jiri Slaby wrote:
>>> On 09/28/2012 02:19 PM, Alexey Brodkin wrote:
>>>> Modify divisor to select the nearest baud rate divider rather than the
>>>> lowest. It minimizes baud rate errors especially on low UART clock
>>>> frequencies.
>>>>
>>>> For example, if uartclk is 33000000 and baud is 115200 the ratio is
>>>> about 17.9 The current code selects 17 (5% error) but should select 18
>>>> (0.5% error).
>>>>
>>>> On the same lines as following:
>>>> http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.9-rc3/2.6.9-rc3-mm2/broken-out/serial-pick-nearest-baud-rate-divider.patch
>>>>
>>>> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
>>>> ---
>>>> drivers/tty/serial/8250_early.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/tty/serial/8250_early.c b/drivers/tty/serial/8250_early.c
>>>> index eaafb98..cfc46b7 100644
>>>> --- a/drivers/tty/serial/8250_early.c
>>>> +++ b/drivers/tty/serial/8250_early.c
>>>> @@ -140,7 +140,7 @@ static void __init init_port(struct early_serial8250_device *device)
>>>> serial_out(port, UART_FCR, 0); /* no fifo */
>>>> serial_out(port, UART_MCR, 0x3); /* DTR + RTS */
>>>>
>>>> - divisor = port->uartclk / (16 * device->baud);
>>>> + divisor = (port->uartclk + (8 * device->baud)) / (16 * device->baud);
>>> So this should be in fact DIV_ROUND_CLOSEST(), right?
>>>
>>> But anyway I'm missing any explanation of *why* this is needed? This
>>> should be part of the commit log. Is there any bug you are fixing here?
>> Actually the issue showed up when using the stock 8250 driver for
>> Synopsys DW UART. This was on a FPGA with ~50MHz clk. When we enabled
>> early serial, we saw garbage which Alexey narrowed down to the rounding
>> error. So the bug had been latent and it only showed up with such low
>> clk rates.
> Yes, this is a perfect argument I was asking for and should have been a
> part of the commit...
First timer's anxiety I suppose ! Per your DIV_ROUND_CLOSEST()
suggestion, Alexey has already sent out a v2 patch. I presume he needs
to respin a v3 to beef up the commitlog along the lines of above !
Thx,
-Vineet
^ permalink raw reply
* Re: [PATCH] tty/8250_early: Prevent rounding error in uartclk to baud ratio
From: Jiri Slaby @ 2012-09-29 7:07 UTC (permalink / raw)
To: Vineet Gupta; +Cc: Alexey Brodkin, gregkh, alan, linux-serial, linux-kernel
In-Reply-To: <506697DC.50200@synopsys.com>
On 09/29/2012 08:40 AM, Vineet Gupta wrote:
> On Friday 28 September 2012 06:32 PM, Jiri Slaby wrote:
>> On 09/28/2012 02:19 PM, Alexey Brodkin wrote:
>>> Modify divisor to select the nearest baud rate divider rather than the
>>> lowest. It minimizes baud rate errors especially on low UART clock
>>> frequencies.
>>>
>>> For example, if uartclk is 33000000 and baud is 115200 the ratio is
>>> about 17.9 The current code selects 17 (5% error) but should select 18
>>> (0.5% error).
>>>
>>> On the same lines as following:
>>> http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.9-rc3/2.6.9-rc3-mm2/broken-out/serial-pick-nearest-baud-rate-divider.patch
>>>
>>> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
>>> ---
>>> drivers/tty/serial/8250_early.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/tty/serial/8250_early.c b/drivers/tty/serial/8250_early.c
>>> index eaafb98..cfc46b7 100644
>>> --- a/drivers/tty/serial/8250_early.c
>>> +++ b/drivers/tty/serial/8250_early.c
>>> @@ -140,7 +140,7 @@ static void __init init_port(struct early_serial8250_device *device)
>>> serial_out(port, UART_FCR, 0); /* no fifo */
>>> serial_out(port, UART_MCR, 0x3); /* DTR + RTS */
>>>
>>> - divisor = port->uartclk / (16 * device->baud);
>>> + divisor = (port->uartclk + (8 * device->baud)) / (16 * device->baud);
>> So this should be in fact DIV_ROUND_CLOSEST(), right?
>>
>> But anyway I'm missing any explanation of *why* this is needed? This
>> should be part of the commit log. Is there any bug you are fixing here?
>
> Actually the issue showed up when using the stock 8250 driver for
> Synopsys DW UART. This was on a FPGA with ~50MHz clk. When we enabled
> early serial, we saw garbage which Alexey narrowed down to the rounding
> error. So the bug had been latent and it only showed up with such low
> clk rates.
Yes, this is a perfect argument I was asking for and should have been a
part of the commit...
thanks,
--
js
suse labs
^ permalink raw reply
* Re: [PATCH] tty/8250_early: Prevent rounding error in uartclk to baud ratio
From: Vineet Gupta @ 2012-09-29 6:40 UTC (permalink / raw)
To: Jiri Slaby
Cc: Alexey Brodkin, gregkh, alan, linux-serial, linux-kernel,
Vineet.Gupta1
In-Reply-To: <5065A003.4090604@suse.cz>
On Friday 28 September 2012 06:32 PM, Jiri Slaby wrote:
> On 09/28/2012 02:19 PM, Alexey Brodkin wrote:
>> Modify divisor to select the nearest baud rate divider rather than the
>> lowest. It minimizes baud rate errors especially on low UART clock
>> frequencies.
>>
>> For example, if uartclk is 33000000 and baud is 115200 the ratio is
>> about 17.9 The current code selects 17 (5% error) but should select 18
>> (0.5% error).
>>
>> On the same lines as following:
>> http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.9-rc3/2.6.9-rc3-mm2/broken-out/serial-pick-nearest-baud-rate-divider.patch
>>
>> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
>> ---
>> drivers/tty/serial/8250_early.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/tty/serial/8250_early.c b/drivers/tty/serial/8250_early.c
>> index eaafb98..cfc46b7 100644
>> --- a/drivers/tty/serial/8250_early.c
>> +++ b/drivers/tty/serial/8250_early.c
>> @@ -140,7 +140,7 @@ static void __init init_port(struct early_serial8250_device *device)
>> serial_out(port, UART_FCR, 0); /* no fifo */
>> serial_out(port, UART_MCR, 0x3); /* DTR + RTS */
>>
>> - divisor = port->uartclk / (16 * device->baud);
>> + divisor = (port->uartclk + (8 * device->baud)) / (16 * device->baud);
> So this should be in fact DIV_ROUND_CLOSEST(), right?
>
> But anyway I'm missing any explanation of *why* this is needed? This
> should be part of the commit log. Is there any bug you are fixing here?
Actually the issue showed up when using the stock 8250 driver for
Synopsys DW UART. This was on a FPGA with ~50MHz clk. When we enabled
early serial, we saw garbage which Alexey narrowed down to the rounding
error. So the bug had been latent and it only showed up with such low
clk rates.
Thx,
Vineet
^ permalink raw reply
* [PATCH v2] serial/8250/8250_early: Prevent rounding error in uartclk to baud ratio
From: Alexey Brodkin @ 2012-09-28 15:00 UTC (permalink / raw)
To: gregkh, alan; +Cc: linux-serial, linux-kernel, Vineet.Gupta1, Alexey.Brodkin
Modify divisor to select the nearest baud rate divider rather than the
lowest. It minimizes baud rate errors especially on low UART clock
frequencies.
For example, if uartclk is 33000000 and baud is 115200 the ratio is
about 17.9 The current code selects 17 (5% error) but should select 18
(0.5% error).
This 5% error in baud rate leads to garbage on receiving end, while 0.5%
doesn't.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
drivers/tty/serial/8250/8250_early.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index eaafb98..843a150 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -140,7 +140,7 @@ static void __init init_port(struct early_serial8250_device *device)
serial_out(port, UART_FCR, 0); /* no fifo */
serial_out(port, UART_MCR, 0x3); /* DTR + RTS */
- divisor = port->uartclk / (16 * device->baud);
+ divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * device->baud);
c = serial_in(port, UART_LCR);
serial_out(port, UART_LCR, c | UART_LCR_DLAB);
serial_out(port, UART_DLL, divisor & 0xff);
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH] tty/8250_early: Prevent rounding error in uartclk to baud ratio
From: Jiri Slaby @ 2012-09-28 13:02 UTC (permalink / raw)
To: Alexey Brodkin; +Cc: gregkh, alan, linux-serial, linux-kernel, Vineet.Gupta1
In-Reply-To: <1348834748-31565-1-git-send-email-abrodkin@synopsys.com>
On 09/28/2012 02:19 PM, Alexey Brodkin wrote:
> Modify divisor to select the nearest baud rate divider rather than the
> lowest. It minimizes baud rate errors especially on low UART clock
> frequencies.
>
> For example, if uartclk is 33000000 and baud is 115200 the ratio is
> about 17.9 The current code selects 17 (5% error) but should select 18
> (0.5% error).
>
> On the same lines as following:
> http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.9-rc3/2.6.9-rc3-mm2/broken-out/serial-pick-nearest-baud-rate-divider.patch
>
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> ---
> drivers/tty/serial/8250_early.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250_early.c b/drivers/tty/serial/8250_early.c
> index eaafb98..cfc46b7 100644
> --- a/drivers/tty/serial/8250_early.c
> +++ b/drivers/tty/serial/8250_early.c
> @@ -140,7 +140,7 @@ static void __init init_port(struct early_serial8250_device *device)
> serial_out(port, UART_FCR, 0); /* no fifo */
> serial_out(port, UART_MCR, 0x3); /* DTR + RTS */
>
> - divisor = port->uartclk / (16 * device->baud);
> + divisor = (port->uartclk + (8 * device->baud)) / (16 * device->baud);
So this should be in fact DIV_ROUND_CLOSEST(), right?
But anyway I'm missing any explanation of *why* this is needed? This
should be part of the commit log. Is there any bug you are fixing here?
thanks,
--
js
suse labs
^ permalink raw reply
* Re: [PATCH] tty/8250_early: Prevent rounding error in uartclk to baud ratio
From: Alan Cox @ 2012-09-28 13:03 UTC (permalink / raw)
To: Alexey Brodkin; +Cc: gregkh, linux-serial, linux-kernel, Vineet.Gupta1
In-Reply-To: <1348834748-31565-1-git-send-email-abrodkin@synopsys.com>
On Fri, 28 Sep 2012 16:19:08 +0400
Alexey Brodkin <Alexey.Brodkin@synopsys.com> wrote:
> Modify divisor to select the nearest baud rate divider rather than the
> lowest. It minimizes baud rate errors especially on low UART clock
> frequencies.
>
> For example, if uartclk is 33000000 and baud is 115200 the ratio is
> about 17.9 The current code selects 17 (5% error) but should select 18
> (0.5% error).
>
> On the same lines as following:
> http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.9-rc3/2.6.9-rc3-mm2/broken-out/serial-pick-nearest-baud-rate-divider.patch
>
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Seems sensible to me.
Acked-by: Alan Cox <alan@linux.intel.com>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox