Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: remove bfin_jtag_comm and hvc_bfin_jtag drivers

The blackfin architecture is getting removed, so these drivers
are not needed any more.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Aaron Wu <aaron.wu@analog.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

-481
-13
drivers/tty/Kconfig
··· 151 151 When not in use, each legacy PTY occupies 12 bytes on 32-bit 152 152 architectures and 24 bytes on 64-bit architectures. 153 153 154 - config BFIN_JTAG_COMM 155 - tristate "Blackfin JTAG Communication" 156 - depends on BLACKFIN 157 - help 158 - Add support for emulating a TTY device over the Blackfin JTAG. 159 - 160 - To compile this driver as a module, choose M here: the 161 - module will be called bfin_jtag_comm. 162 - 163 - config BFIN_JTAG_COMM_CONSOLE 164 - bool "Console on Blackfin JTAG" 165 - depends on BFIN_JTAG_COMM=y 166 - 167 154 config SERIAL_NONSTANDARD 168 155 bool "Non-standard serial port support" 169 156 depends on HAS_IOMEM
-1
drivers/tty/Makefile
··· 20 20 21 21 # tty drivers 22 22 obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o 23 - obj-$(CONFIG_BFIN_JTAG_COMM) += bfin_jtag_comm.o 24 23 obj-$(CONFIG_CYCLADES) += cyclades.o 25 24 obj-$(CONFIG_ISI) += isicom.o 26 25 obj-$(CONFIG_MOXA_INTELLIO) += moxa.o
-353
drivers/tty/bfin_jtag_comm.c
··· 1 - // SPDX-License-Identifier: GPL-2.0+ 2 - /* 3 - * TTY over Blackfin JTAG Communication 4 - * 5 - * Copyright 2008-2009 Analog Devices Inc. 6 - * 7 - * Enter bugs at http://blackfin.uclinux.org/ 8 - */ 9 - 10 - #define DRV_NAME "bfin-jtag-comm" 11 - #define DEV_NAME "ttyBFJC" 12 - #define pr_fmt(fmt) DRV_NAME ": " fmt 13 - 14 - #include <linux/circ_buf.h> 15 - #include <linux/console.h> 16 - #include <linux/delay.h> 17 - #include <linux/err.h> 18 - #include <linux/kernel.h> 19 - #include <linux/kthread.h> 20 - #include <linux/module.h> 21 - #include <linux/mutex.h> 22 - #include <linux/sched.h> 23 - #include <linux/slab.h> 24 - #include <linux/tty.h> 25 - #include <linux/tty_driver.h> 26 - #include <linux/tty_flip.h> 27 - #include <linux/atomic.h> 28 - 29 - #define pr_init(fmt, args...) ({ static const __initconst char __fmt[] = fmt; printk(__fmt, ## args); }) 30 - 31 - /* See the Debug/Emulation chapter in the HRM */ 32 - #define EMUDOF 0x00000001 /* EMUDAT_OUT full & valid */ 33 - #define EMUDIF 0x00000002 /* EMUDAT_IN full & valid */ 34 - #define EMUDOOVF 0x00000004 /* EMUDAT_OUT overflow */ 35 - #define EMUDIOVF 0x00000008 /* EMUDAT_IN overflow */ 36 - 37 - static inline uint32_t bfin_write_emudat(uint32_t emudat) 38 - { 39 - __asm__ __volatile__("emudat = %0;" : : "d"(emudat)); 40 - return emudat; 41 - } 42 - 43 - static inline uint32_t bfin_read_emudat(void) 44 - { 45 - uint32_t emudat; 46 - __asm__ __volatile__("%0 = emudat;" : "=d"(emudat)); 47 - return emudat; 48 - } 49 - 50 - static inline uint32_t bfin_write_emudat_chars(char a, char b, char c, char d) 51 - { 52 - return bfin_write_emudat((a << 0) | (b << 8) | (c << 16) | (d << 24)); 53 - } 54 - 55 - #define CIRC_SIZE 2048 /* see comment in tty_io.c:do_tty_write() */ 56 - #define CIRC_MASK (CIRC_SIZE - 1) 57 - #define circ_empty(circ) ((circ)->head == (circ)->tail) 58 - #define circ_free(circ) CIRC_SPACE((circ)->head, (circ)->tail, CIRC_SIZE) 59 - #define circ_cnt(circ) CIRC_CNT((circ)->head, (circ)->tail, CIRC_SIZE) 60 - #define circ_byte(circ, idx) ((circ)->buf[(idx) & CIRC_MASK]) 61 - 62 - static struct tty_driver *bfin_jc_driver; 63 - static struct task_struct *bfin_jc_kthread; 64 - static struct tty_port port; 65 - static volatile struct circ_buf bfin_jc_write_buf; 66 - 67 - static int 68 - bfin_jc_emudat_manager(void *arg) 69 - { 70 - uint32_t inbound_len = 0, outbound_len = 0; 71 - 72 - while (!kthread_should_stop()) { 73 - struct tty_struct *tty = tty_port_tty_get(&port); 74 - /* no one left to give data to, so sleep */ 75 - if (tty == NULL && circ_empty(&bfin_jc_write_buf)) { 76 - pr_debug("waiting for readers\n"); 77 - __set_current_state(TASK_UNINTERRUPTIBLE); 78 - schedule(); 79 - continue; 80 - } 81 - 82 - /* no data available, so just chill */ 83 - if (!(bfin_read_DBGSTAT() & EMUDIF) && circ_empty(&bfin_jc_write_buf)) { 84 - pr_debug("waiting for data (in_len = %i) (circ: %i %i)\n", 85 - inbound_len, bfin_jc_write_buf.tail, bfin_jc_write_buf.head); 86 - tty_kref_put(tty); 87 - if (inbound_len) 88 - schedule(); 89 - else 90 - schedule_timeout_interruptible(HZ); 91 - continue; 92 - } 93 - 94 - /* if incoming data is ready, eat it */ 95 - if (bfin_read_DBGSTAT() & EMUDIF) { 96 - uint32_t emudat = bfin_read_emudat(); 97 - if (inbound_len == 0) { 98 - pr_debug("incoming length: 0x%08x\n", emudat); 99 - inbound_len = emudat; 100 - } else { 101 - size_t num_chars = (4 <= inbound_len ? 4 : inbound_len); 102 - pr_debug(" incoming data: 0x%08x (pushing %zu)\n", emudat, num_chars); 103 - inbound_len -= num_chars; 104 - tty_insert_flip_string(&port, (unsigned char *)&emudat, num_chars); 105 - tty_flip_buffer_push(&port); 106 - } 107 - } 108 - 109 - /* if outgoing data is ready, post it */ 110 - if (!(bfin_read_DBGSTAT() & EMUDOF) && !circ_empty(&bfin_jc_write_buf)) { 111 - if (outbound_len == 0) { 112 - outbound_len = circ_cnt(&bfin_jc_write_buf); 113 - bfin_write_emudat(outbound_len); 114 - pr_debug("outgoing length: 0x%08x\n", outbound_len); 115 - } else { 116 - int tail = bfin_jc_write_buf.tail; 117 - size_t ate = (4 <= outbound_len ? 4 : outbound_len); 118 - uint32_t emudat = 119 - bfin_write_emudat_chars( 120 - circ_byte(&bfin_jc_write_buf, tail + 0), 121 - circ_byte(&bfin_jc_write_buf, tail + 1), 122 - circ_byte(&bfin_jc_write_buf, tail + 2), 123 - circ_byte(&bfin_jc_write_buf, tail + 3) 124 - ); 125 - bfin_jc_write_buf.tail += ate; 126 - outbound_len -= ate; 127 - if (tty) 128 - tty_wakeup(tty); 129 - pr_debug(" outgoing data: 0x%08x (pushing %zu)\n", emudat, ate); 130 - } 131 - } 132 - tty_kref_put(tty); 133 - } 134 - 135 - __set_current_state(TASK_RUNNING); 136 - return 0; 137 - } 138 - 139 - static int 140 - bfin_jc_open(struct tty_struct *tty, struct file *filp) 141 - { 142 - unsigned long flags; 143 - 144 - spin_lock_irqsave(&port.lock, flags); 145 - port.count++; 146 - spin_unlock_irqrestore(&port.lock, flags); 147 - tty_port_tty_set(&port, tty); 148 - wake_up_process(bfin_jc_kthread); 149 - return 0; 150 - } 151 - 152 - static void 153 - bfin_jc_close(struct tty_struct *tty, struct file *filp) 154 - { 155 - unsigned long flags; 156 - bool last; 157 - 158 - spin_lock_irqsave(&port.lock, flags); 159 - last = --port.count == 0; 160 - spin_unlock_irqrestore(&port.lock, flags); 161 - if (last) 162 - tty_port_tty_set(&port, NULL); 163 - wake_up_process(bfin_jc_kthread); 164 - } 165 - 166 - /* XXX: we dont handle the put_char() case where we must handle count = 1 */ 167 - static int 168 - bfin_jc_circ_write(const unsigned char *buf, int count) 169 - { 170 - int i; 171 - count = min(count, circ_free(&bfin_jc_write_buf)); 172 - pr_debug("going to write chunk of %i bytes\n", count); 173 - for (i = 0; i < count; ++i) 174 - circ_byte(&bfin_jc_write_buf, bfin_jc_write_buf.head + i) = buf[i]; 175 - bfin_jc_write_buf.head += i; 176 - return i; 177 - } 178 - 179 - #ifndef CONFIG_BFIN_JTAG_COMM_CONSOLE 180 - # define console_lock() 181 - # define console_unlock() 182 - #endif 183 - static int 184 - bfin_jc_write(struct tty_struct *tty, const unsigned char *buf, int count) 185 - { 186 - int i; 187 - console_lock(); 188 - i = bfin_jc_circ_write(buf, count); 189 - console_unlock(); 190 - wake_up_process(bfin_jc_kthread); 191 - return i; 192 - } 193 - 194 - static void 195 - bfin_jc_flush_chars(struct tty_struct *tty) 196 - { 197 - wake_up_process(bfin_jc_kthread); 198 - } 199 - 200 - static int 201 - bfin_jc_write_room(struct tty_struct *tty) 202 - { 203 - return circ_free(&bfin_jc_write_buf); 204 - } 205 - 206 - static int 207 - bfin_jc_chars_in_buffer(struct tty_struct *tty) 208 - { 209 - return circ_cnt(&bfin_jc_write_buf); 210 - } 211 - 212 - static const struct tty_operations bfin_jc_ops = { 213 - .open = bfin_jc_open, 214 - .close = bfin_jc_close, 215 - .write = bfin_jc_write, 216 - /*.put_char = bfin_jc_put_char,*/ 217 - .flush_chars = bfin_jc_flush_chars, 218 - .write_room = bfin_jc_write_room, 219 - .chars_in_buffer = bfin_jc_chars_in_buffer, 220 - }; 221 - 222 - static int __init bfin_jc_init(void) 223 - { 224 - int ret; 225 - 226 - bfin_jc_kthread = kthread_create(bfin_jc_emudat_manager, NULL, DRV_NAME); 227 - if (IS_ERR(bfin_jc_kthread)) 228 - return PTR_ERR(bfin_jc_kthread); 229 - 230 - ret = -ENOMEM; 231 - 232 - bfin_jc_write_buf.head = bfin_jc_write_buf.tail = 0; 233 - bfin_jc_write_buf.buf = kmalloc(CIRC_SIZE, GFP_KERNEL); 234 - if (!bfin_jc_write_buf.buf) 235 - goto err_buf; 236 - 237 - bfin_jc_driver = alloc_tty_driver(1); 238 - if (!bfin_jc_driver) 239 - goto err_driver; 240 - 241 - tty_port_init(&port); 242 - 243 - bfin_jc_driver->driver_name = DRV_NAME; 244 - bfin_jc_driver->name = DEV_NAME; 245 - bfin_jc_driver->type = TTY_DRIVER_TYPE_SERIAL; 246 - bfin_jc_driver->subtype = SERIAL_TYPE_NORMAL; 247 - bfin_jc_driver->init_termios = tty_std_termios; 248 - tty_set_operations(bfin_jc_driver, &bfin_jc_ops); 249 - tty_port_link_device(&port, bfin_jc_driver, 0); 250 - 251 - ret = tty_register_driver(bfin_jc_driver); 252 - if (ret) 253 - goto err; 254 - 255 - pr_init(KERN_INFO DRV_NAME ": initialized\n"); 256 - 257 - return 0; 258 - 259 - err: 260 - tty_port_destroy(&port); 261 - put_tty_driver(bfin_jc_driver); 262 - err_driver: 263 - kfree(bfin_jc_write_buf.buf); 264 - err_buf: 265 - kthread_stop(bfin_jc_kthread); 266 - return ret; 267 - } 268 - module_init(bfin_jc_init); 269 - 270 - static void __exit bfin_jc_exit(void) 271 - { 272 - kthread_stop(bfin_jc_kthread); 273 - kfree(bfin_jc_write_buf.buf); 274 - tty_unregister_driver(bfin_jc_driver); 275 - put_tty_driver(bfin_jc_driver); 276 - tty_port_destroy(&port); 277 - } 278 - module_exit(bfin_jc_exit); 279 - 280 - #if defined(CONFIG_BFIN_JTAG_COMM_CONSOLE) || defined(CONFIG_EARLY_PRINTK) 281 - static void 282 - bfin_jc_straight_buffer_write(const char *buf, unsigned count) 283 - { 284 - unsigned ate = 0; 285 - while (bfin_read_DBGSTAT() & EMUDOF) 286 - continue; 287 - bfin_write_emudat(count); 288 - while (ate < count) { 289 - while (bfin_read_DBGSTAT() & EMUDOF) 290 - continue; 291 - bfin_write_emudat_chars(buf[ate], buf[ate+1], buf[ate+2], buf[ate+3]); 292 - ate += 4; 293 - } 294 - } 295 - #endif 296 - 297 - #ifdef CONFIG_BFIN_JTAG_COMM_CONSOLE 298 - static void 299 - bfin_jc_console_write(struct console *co, const char *buf, unsigned count) 300 - { 301 - if (bfin_jc_kthread == NULL) 302 - bfin_jc_straight_buffer_write(buf, count); 303 - else 304 - bfin_jc_circ_write(buf, count); 305 - } 306 - 307 - static struct tty_driver * 308 - bfin_jc_console_device(struct console *co, int *index) 309 - { 310 - *index = co->index; 311 - return bfin_jc_driver; 312 - } 313 - 314 - static struct console bfin_jc_console = { 315 - .name = DEV_NAME, 316 - .write = bfin_jc_console_write, 317 - .device = bfin_jc_console_device, 318 - .flags = CON_ANYTIME | CON_PRINTBUFFER, 319 - .index = -1, 320 - }; 321 - 322 - static int __init bfin_jc_console_init(void) 323 - { 324 - register_console(&bfin_jc_console); 325 - return 0; 326 - } 327 - console_initcall(bfin_jc_console_init); 328 - #endif 329 - 330 - #ifdef CONFIG_EARLY_PRINTK 331 - static void __init 332 - bfin_jc_early_write(struct console *co, const char *buf, unsigned int count) 333 - { 334 - bfin_jc_straight_buffer_write(buf, count); 335 - } 336 - 337 - static struct console bfin_jc_early_console __initdata = { 338 - .name = "early_BFJC", 339 - .write = bfin_jc_early_write, 340 - .flags = CON_ANYTIME | CON_PRINTBUFFER, 341 - .index = -1, 342 - }; 343 - 344 - struct console * __init 345 - bfin_jc_early_init(unsigned int port, unsigned int cflag) 346 - { 347 - return &bfin_jc_early_console; 348 - } 349 - #endif 350 - 351 - MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>"); 352 - MODULE_DESCRIPTION("TTY over Blackfin JTAG Communication"); 353 - MODULE_LICENSE("GPL");
-9
drivers/tty/hvc/Kconfig
··· 88 88 driver. This console is used through a JTAG only on ARM. If you don't have 89 89 a JTAG then you probably don't want this option. 90 90 91 - config HVC_BFIN_JTAG 92 - bool "Blackfin JTAG console" 93 - depends on BLACKFIN 94 - select HVC_DRIVER 95 - help 96 - This console uses the Blackfin JTAG to create a console under the 97 - the HVC driver. If you don't have JTAG, then you probably don't 98 - want this option. 99 - 100 91 config HVCS 101 92 tristate "IBM Hypervisor Virtual Console Server support" 102 93 depends on PPC_PSERIES && HVC_CONSOLE
-1
drivers/tty/hvc/Makefile
··· 10 10 obj-$(CONFIG_HVC_XEN) += hvc_xen.o 11 11 obj-$(CONFIG_HVC_IUCV) += hvc_iucv.o 12 12 obj-$(CONFIG_HVC_UDBG) += hvc_udbg.o 13 - obj-$(CONFIG_HVC_BFIN_JTAG) += hvc_bfin_jtag.o 14 13 obj-$(CONFIG_HVCS) += hvcs.o
-104
drivers/tty/hvc/hvc_bfin_jtag.c
··· 1 - // SPDX-License-Identifier: GPL-2.0+ 2 - /* 3 - * Console via Blackfin JTAG Communication 4 - * 5 - * Copyright 2008-2011 Analog Devices Inc. 6 - * 7 - * Enter bugs at http://blackfin.uclinux.org/ 8 - */ 9 - 10 - #include <linux/console.h> 11 - #include <linux/delay.h> 12 - #include <linux/err.h> 13 - #include <linux/init.h> 14 - #include <linux/moduleparam.h> 15 - #include <linux/types.h> 16 - 17 - #include "hvc_console.h" 18 - 19 - /* See the Debug/Emulation chapter in the HRM */ 20 - #define EMUDOF 0x00000001 /* EMUDAT_OUT full & valid */ 21 - #define EMUDIF 0x00000002 /* EMUDAT_IN full & valid */ 22 - #define EMUDOOVF 0x00000004 /* EMUDAT_OUT overflow */ 23 - #define EMUDIOVF 0x00000008 /* EMUDAT_IN overflow */ 24 - 25 - /* Helper functions to glue the register API to simple C operations */ 26 - static inline uint32_t bfin_write_emudat(uint32_t emudat) 27 - { 28 - __asm__ __volatile__("emudat = %0;" : : "d"(emudat)); 29 - return emudat; 30 - } 31 - 32 - static inline uint32_t bfin_read_emudat(void) 33 - { 34 - uint32_t emudat; 35 - __asm__ __volatile__("%0 = emudat;" : "=d"(emudat)); 36 - return emudat; 37 - } 38 - 39 - /* Send data to the host */ 40 - static int hvc_bfin_put_chars(uint32_t vt, const char *buf, int count) 41 - { 42 - static uint32_t outbound_len; 43 - uint32_t emudat; 44 - int ret; 45 - 46 - if (bfin_read_DBGSTAT() & EMUDOF) 47 - return 0; 48 - 49 - if (!outbound_len) { 50 - outbound_len = count; 51 - bfin_write_emudat(outbound_len); 52 - return 0; 53 - } 54 - 55 - ret = min(outbound_len, (uint32_t)4); 56 - memcpy(&emudat, buf, ret); 57 - bfin_write_emudat(emudat); 58 - outbound_len -= ret; 59 - 60 - return ret; 61 - } 62 - 63 - /* Receive data from the host */ 64 - static int hvc_bfin_get_chars(uint32_t vt, char *buf, int count) 65 - { 66 - static uint32_t inbound_len; 67 - uint32_t emudat; 68 - int ret; 69 - 70 - if (!(bfin_read_DBGSTAT() & EMUDIF)) 71 - return 0; 72 - emudat = bfin_read_emudat(); 73 - 74 - if (!inbound_len) { 75 - inbound_len = emudat; 76 - return 0; 77 - } 78 - 79 - ret = min(inbound_len, (uint32_t)4); 80 - memcpy(buf, &emudat, ret); 81 - inbound_len -= ret; 82 - 83 - return ret; 84 - } 85 - 86 - /* Glue the HVC layers to the Blackfin layers */ 87 - static const struct hv_ops hvc_bfin_get_put_ops = { 88 - .get_chars = hvc_bfin_get_chars, 89 - .put_chars = hvc_bfin_put_chars, 90 - }; 91 - 92 - static int __init hvc_bfin_console_init(void) 93 - { 94 - hvc_instantiate(0, 0, &hvc_bfin_get_put_ops); 95 - return 0; 96 - } 97 - console_initcall(hvc_bfin_console_init); 98 - 99 - static int __init hvc_bfin_init(void) 100 - { 101 - hvc_alloc(0, 0, &hvc_bfin_get_put_ops, 128); 102 - return 0; 103 - } 104 - device_initcall(hvc_bfin_init);