tty: metag_da: Add metag DA TTY driver
cover tty: metag_da: Add metag DA TTY driver
Greg: is it okay to take this into your tty tree as it depends on Jiri's tty_flip/tty_port changes? It won't get built until the arch/metag tree comes along and defines the METAG_DA Kconfig symbol.
This is the same metag_da driver as before, but rebased on tty-next and omitting all arch/metag bits. Both parts have already been reviewed (and I squashed the buffer flipping change into the first patch).
Sorry for all the resends by the way. I think I should have just aimed for the tty tree in the first place :-) I'll know for future.
James Hogan (2):
tty: metag_da: Add metag DA TTY driver
tty: metag_da: avoid getting tty kref in dashtty_timer()
drivers/tty/Kconfig | 13 + drivers/tty/Makefile | 1 + drivers/tty/metag_da.c | 677 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 691 insertions(+), 0 deletions(-) create mode 100644 drivers/tty/metag_da.c
Signature · 1 line
1.7.7.6
PATCH 1/2 tty: metag_da: Add metag DA TTY driver
Add a TTY driver for communicating over a Meta DA (Debug Adapter) channel using the bios channel SWITCH operation.
---
The only changes compared to v4 of arch/metag patchset are trivial:
* removal of arch/metag changes
* squashed in tty_prepare_flip_string and tty_flip_buffer_push fix
drivers/tty/Kconfig | 13 + drivers/tty/Makefile | 1 + drivers/tty/metag_da.c | 680 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 694 insertions(+), 0 deletions(-) create mode 100644 drivers/tty/metag_da.c
drivers/tty/Kconfig +13 -0
@@ -406,4 +406,17 @@ config GOLDFISH_TTY help Console and system TTY driver for the Goldfish virtual platform. +config DA_TTY + bool "DA TTY" + depends on METAG_DA + select SERIAL_NONSTANDARD + help + This enables a TTY on a Dash channel. + +config DA_CONSOLE + bool "DA Console" + depends on DA_TTY + help + This enables a console on a Dash channel. + endif # TTY
drivers/tty/Makefile +1 -0
@@ -28,5 +28,6 @@ obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o obj-$(CONFIG_SYNCLINK) += synclink.o obj-$(CONFIG_PPC_EPAPR_HV_BYTECHAN) += ehv_bytechan.o obj-$(CONFIG_GOLDFISH_TTY) += goldfish.o +obj-$(CONFIG_DA_TTY) += metag_da.o obj-y += ipwireless/
drivers/tty/metag_da.c new file +680 -0
680 lines not on this page · raw message
Signature · 1 line
1.7.7.6
PATCH 2/2 tty: metag_da: avoid getting tty kref in dashtty_timer()
In reply to James HoganGetting the tty kref in dashtty_timer() is no longer necessary since it isn't needed in fetch_data() any longer (due to changes which make the tty flip functions refer to tty_ports instead of tty_structs), so just pass around a channel number instead.
--- drivers/tty/metag_da.c | 31 ++++++++++++++----------------- 1 files changed, 14 insertions(+), 17 deletions(-)
drivers/tty/metag_da.c +14 -17
@@ -147,9 +147,8 @@ static int chancall(int in_bios_function, int in_channel,/* * Attempts to fetch count bytes from channel and returns actual count. */ -static int fetch_data (struct tty_struct *tty) +static int fetch_data (unsigned int channel) { -unsigned int channel = tty->index;struct dashtty_port *dport = &dashtty_ports[channel];int received =0 ;
@@ -180,31 +179,31 @@ unlock: }/** -* find_channel_to_poll() - Returns kref to the next channel tty to poll. -* Returns: The TTY of the next channel to poll, or NULL if no TTY needs -* polling. Release with tty_kref_put(). +* find_channel_to_poll() - Returns number of the next channel to poll. +* Returns: The number of the next channel to poll, or -1 if none need +* polling. */ -static struct tty_struct *find_channel_to_poll (void ) +static int find_channel_to_poll (void ) {static int last_polled_channel;int last = last_polled_channel;int chan; -struct tty_struct *tty =NULL ; +struct dashtty_port *dport;for (chan = last +1 ; ; ++chan) {if (chan >=NUM_TTY_CHANNELS ) chan =0 ; - tty =tty_port_tty_get (&dashtty_ports[chan].port); -if (tty) { + dport = &dashtty_ports[chan]; +if (dport->rx_buf) { last_polled_channel = chan; -return tty; +return chan; }if (chan == last)break ; } -return tty; +return -1 ; }/**
@@ -302,19 +301,17 @@ static int put_data(void *arg)*/ static void dashtty_timer (unsigned long ignored) { -struct tty_struct *tty; +int channel;/* If there are no ports open do nothing and don't poll again. */ if (!atomic_read (&num_channels_need_poll))return ; - tty =find_channel_to_poll (); + channel =find_channel_to_poll ();/* Did we find a channel to poll? */ -if (tty) { -fetch_data (tty); -tty_kref_put (tty); - } +if (channel >=0 ) +fetch_data (channel);mod_timer_pinned (&poll_timer, jiffies +DA_TTY_POLL ); }
Signature · 1 line
1.7.7.6
Greg Kroah-Hartman
maintainerQuoted 3 lines · James Hogan
Greg: is it okay to take this into your tty tree as it depends on Jiri's tty_flip/tty_port changes? It won't get built until the
arch/metagtree comes along and defines theMETAG_DAKconfigsymbol.
Sure, I'll pick it up and push it to Linus for 3.9-rc1.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 10 lines · James Hogan
Greg: is it okay to take this into your tty tree as it depends on Jiri's tty_flip/tty_port changes? It won't get built until the
arch/metagtree comes along and defines theMETAG_DAKconfigsymbol.This is the same
metag_dadriver as before, but rebased on tty-next and omitting allarch/metagbits. Both parts have already been reviewed (and I squashed the buffer flipping change into the first patch).Sorry for all the resends by the way. I think I should have just aimed for the tty tree in the first place :-) I'll know for future.
Ah, no problem with that, it's tough to figure out how to get a whole new arch merged at times, you've done a great job here, nice work.
greg k-h