diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-24 12:33:34 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-24 12:33:34 -0400 |
| commit | 346ad4b7fe392571f19314f153db9151dbc1d82b (patch) | |
| tree | 2d4085338c9044bca2f6472893da60387db3c96f /drivers | |
| parent | 845199f194306dbd69ca42d3b40a5125cdb50b89 (diff) | |
| parent | 2dc63a84b2db23b9680646aff93917211613bf1a (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/blackfin-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/blackfin-2.6: (85 commits)
Blackfin char driver for Blackfin on-chip OTP memory (v3)
Blackfin Serial Driver: fix bug - use mod_timer to replace only add_timer.
Blackfin Serial Driver: the uart break anomaly has been given its own number, so switch to it
Blackfin Serial Driver: use BFIN_UART_NR_PORTS to help SIR driver in uart port.
Blackfin Serial Driver: Fix bug - kernel hangs when accessing uart 0 on bf537 when booting u-boot and linux on uart 1
Blackfin Serial Driver: punt unused lsr variable
Blackfin Serial Driver: Enable IR function when user application (irattach /dev/ttyBFx -s) call TIOCSETD ioctl with line discipline N_IRDA
[Blackfin] arch: add include/boot .gitignore files
[Blackfin] arch: Functional power management support: Add support for cpu frequency scaling
[Blackfin] arch: Functional power management support: Remove broken cpu frequency scaling drivers
[Blackfin] arch: Equalize include files: Add PLL_DIV Masks
[Blackfin] arch: Add a warning about the value of CLKIN.
[Blackfin] arch: take DDR DEVWD into consideration as well for BF548
[Blackfin] arch: Remove the circular buffering mechanism for exceptions
[Blackfin] arch: lose unnecessary dependency on CONFIG_BFIN_ICACHE for MPU
[Blackfin] arch: fix bug - before assign new channel to the map register, need clear the bits first.
[Blackfin] arch: add Blackfin on-chip SIR IrDA driver support
[Blackfin] arch: BF54x memsizes are in mbits, not mbytes
[Blackfin] arch: try to remove condition that causes double fault, by checking current before it gets dereferenced
[Blackfin] arch: Update anomaly list.
...
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/char/Kconfig | 28 | ||||
| -rw-r--r-- | drivers/char/Makefile | 1 | ||||
| -rw-r--r-- | drivers/char/bfin-otp.c | 189 | ||||
| -rw-r--r-- | drivers/net/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/serial/bfin_5xx.c | 56 |
5 files changed, 256 insertions, 20 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index a87b89db08e9..2906ee7bd298 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
| @@ -481,6 +481,34 @@ config BRIQ_PANEL | |||
| 481 | 481 | ||
| 482 | It's safe to say N here. | 482 | It's safe to say N here. |
| 483 | 483 | ||
| 484 | config BFIN_OTP | ||
| 485 | tristate "Blackfin On-Chip OTP Memory Support" | ||
| 486 | depends on BLACKFIN && (BF52x || BF54x) | ||
| 487 | default y | ||
| 488 | help | ||
| 489 | If you say Y here, you will get support for a character device | ||
| 490 | interface into the One Time Programmable memory pages that are | ||
| 491 | stored on the Blackfin processor. This will not get you access | ||
| 492 | to the secure memory pages however. You will need to write your | ||
| 493 | own secure code and reader for that. | ||
| 494 | |||
| 495 | To compile this driver as a module, choose M here: the module | ||
| 496 | will be called bfin-otp. | ||
| 497 | |||
| 498 | If unsure, it is safe to say Y. | ||
| 499 | |||
| 500 | config BFIN_OTP_WRITE_ENABLE | ||
| 501 | bool "Enable writing support of OTP pages" | ||
| 502 | depends on BFIN_OTP | ||
| 503 | default n | ||
| 504 | help | ||
| 505 | If you say Y here, you will enable support for writing of the | ||
| 506 | OTP pages. This is dangerous by nature as you can only program | ||
| 507 | the pages once, so only enable this option when you actually | ||
| 508 | need it so as to not inadvertently clobber data. | ||
| 509 | |||
| 510 | If unsure, say N. | ||
| 511 | |||
| 484 | config PRINTER | 512 | config PRINTER |
| 485 | tristate "Parallel printer support" | 513 | tristate "Parallel printer support" |
| 486 | depends on PARPORT | 514 | depends on PARPORT |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 5407b7615614..4c1c584e9eb6 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
| @@ -59,6 +59,7 @@ obj-$(CONFIG_VIOTAPE) += viotape.o | |||
| 59 | obj-$(CONFIG_HVCS) += hvcs.o | 59 | obj-$(CONFIG_HVCS) += hvcs.o |
| 60 | obj-$(CONFIG_SGI_MBCS) += mbcs.o | 60 | obj-$(CONFIG_SGI_MBCS) += mbcs.o |
| 61 | obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o | 61 | obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o |
| 62 | obj-$(CONFIG_BFIN_OTP) += bfin-otp.o | ||
| 62 | 63 | ||
| 63 | obj-$(CONFIG_PRINTER) += lp.o | 64 | obj-$(CONFIG_PRINTER) += lp.o |
| 64 | obj-$(CONFIG_TIPAR) += tipar.o | 65 | obj-$(CONFIG_TIPAR) += tipar.o |
diff --git a/drivers/char/bfin-otp.c b/drivers/char/bfin-otp.c new file mode 100644 index 000000000000..0a01329451e4 --- /dev/null +++ b/drivers/char/bfin-otp.c | |||
| @@ -0,0 +1,189 @@ | |||
| 1 | /* | ||
| 2 | * Blackfin On-Chip OTP Memory Interface | ||
| 3 | * Supports BF52x/BF54x | ||
| 4 | * | ||
| 5 | * Copyright 2007-2008 Analog Devices Inc. | ||
| 6 | * | ||
| 7 | * Enter bugs at http://blackfin.uclinux.org/ | ||
| 8 | * | ||
| 9 | * Licensed under the GPL-2 or later. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/device.h> | ||
| 13 | #include <linux/errno.h> | ||
| 14 | #include <linux/fs.h> | ||
| 15 | #include <linux/init.h> | ||
| 16 | #include <linux/miscdevice.h> | ||
| 17 | #include <linux/module.h> | ||
| 18 | #include <linux/mutex.h> | ||
| 19 | #include <linux/types.h> | ||
| 20 | |||
| 21 | #include <asm/blackfin.h> | ||
| 22 | #include <asm/uaccess.h> | ||
| 23 | |||
| 24 | #define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) | ||
| 25 | #define stampit() stamp("here i am") | ||
| 26 | #define pr_init(fmt, args...) ({ static const __initconst char __fmt[] = fmt; printk(__fmt, ## args); }) | ||
| 27 | |||
| 28 | #define DRIVER_NAME "bfin-otp" | ||
| 29 | #define PFX DRIVER_NAME ": " | ||
| 30 | |||
| 31 | static DEFINE_MUTEX(bfin_otp_lock); | ||
| 32 | |||
| 33 | /* OTP Boot ROM functions */ | ||
| 34 | #define _BOOTROM_OTP_COMMAND 0xEF000018 | ||
| 35 | #define _BOOTROM_OTP_READ 0xEF00001A | ||
| 36 | #define _BOOTROM_OTP_WRITE 0xEF00001C | ||
| 37 | |||
| 38 | static u32 (* const otp_command)(u32 command, u32 value) = (void *)_BOOTROM_OTP_COMMAND; | ||
| 39 | static u32 (* const otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)_BOOTROM_OTP_READ; | ||
| 40 | static u32 (* const otp_write)(u32 page, u32 flags, u64 *page_content) = (void *)_BOOTROM_OTP_WRITE; | ||
| 41 | |||
| 42 | /* otp_command(): defines for "command" */ | ||
| 43 | #define OTP_INIT 0x00000001 | ||
| 44 | #define OTP_CLOSE 0x00000002 | ||
| 45 | |||
| 46 | /* otp_{read,write}(): defines for "flags" */ | ||
| 47 | #define OTP_LOWER_HALF 0x00000000 /* select upper/lower 64-bit half (bit 0) */ | ||
| 48 | #define OTP_UPPER_HALF 0x00000001 | ||
| 49 | #define OTP_NO_ECC 0x00000010 /* do not use ECC */ | ||
| 50 | #define OTP_LOCK 0x00000020 /* sets page protection bit for page */ | ||
| 51 | #define OTP_ACCESS_READ 0x00001000 | ||
| 52 | #define OTP_ACCESS_READWRITE 0x00002000 | ||
| 53 | |||
| 54 | /* Return values for all functions */ | ||
| 55 | #define OTP_SUCCESS 0x00000000 | ||
| 56 | #define OTP_MASTER_ERROR 0x001 | ||
| 57 | #define OTP_WRITE_ERROR 0x003 | ||
| 58 | #define OTP_READ_ERROR 0x005 | ||
| 59 | #define OTP_ACC_VIO_ERROR 0x009 | ||
| 60 | #define OTP_DATA_MULT_ERROR 0x011 | ||
| 61 | #define OTP_ECC_MULT_ERROR 0x021 | ||
| 62 | #define OTP_PREV_WR_ERROR 0x041 | ||
| 63 | #define OTP_DATA_SB_WARN 0x100 | ||
| 64 | #define OTP_ECC_SB_WARN 0x200 | ||
| 65 | |||
| 66 | /** | ||
| 67 | * bfin_otp_read - Read OTP pages | ||
| 68 | * | ||
| 69 | * All reads must be in half page chunks (half page == 64 bits). | ||
| 70 | */ | ||
| 71 | static ssize_t bfin_otp_read(struct file *file, char __user *buff, size_t count, loff_t *pos) | ||
| 72 | { | ||
| 73 | ssize_t bytes_done; | ||
| 74 | u32 page, flags, ret; | ||
| 75 | u64 content; | ||
| 76 | |||
| 77 | stampit(); | ||
| 78 | |||
| 79 | if (count % sizeof(u64)) | ||
| 80 | return -EMSGSIZE; | ||
| 81 | |||
| 82 | if (mutex_lock_interruptible(&bfin_otp_lock)) | ||
| 83 | return -ERESTARTSYS; | ||
| 84 | |||
| 85 | bytes_done = 0; | ||
| 86 | page = *pos / (sizeof(u64) * 2); | ||
| 87 | while (bytes_done < count) { | ||
| 88 | flags = (*pos % (sizeof(u64) * 2) ? OTP_UPPER_HALF : OTP_LOWER_HALF); | ||
| 89 | stamp("processing page %i (%s)", page, (flags == OTP_UPPER_HALF ? "upper" : "lower")); | ||
| 90 | ret = otp_read(page, flags, &content); | ||
| 91 | if (ret & OTP_MASTER_ERROR) { | ||
| 92 | bytes_done = -EIO; | ||
| 93 | break; | ||
| 94 | } | ||
| 95 | if (copy_to_user(buff + bytes_done, &content, sizeof(content))) { | ||
| 96 | bytes_done = -EFAULT; | ||
| 97 | break; | ||
| 98 | } | ||
| 99 | if (flags == OTP_UPPER_HALF) | ||
| 100 | ++page; | ||
| 101 | bytes_done += sizeof(content); | ||
| 102 | *pos += sizeof(content); | ||
| 103 | } | ||
| 104 | |||
| 105 | mutex_unlock(&bfin_otp_lock); | ||
| 106 | |||
| 107 | return bytes_done; | ||
| 108 | } | ||
| 109 | |||
| 110 | #ifdef CONFIG_BFIN_OTP_WRITE_ENABLE | ||
| 111 | /** | ||
| 112 | * bfin_otp_write - Write OTP pages | ||
| 113 | * | ||
| 114 | * All writes must be in half page chunks (half page == 64 bits). | ||
| 115 | */ | ||
| 116 | static ssize_t bfin_otp_write(struct file *filp, const char __user *buff, size_t count, loff_t *pos) | ||
| 117 | { | ||
| 118 | stampit(); | ||
| 119 | |||
| 120 | if (count % sizeof(u64)) | ||
| 121 | return -EMSGSIZE; | ||
| 122 | |||
| 123 | if (mutex_lock_interruptible(&bfin_otp_lock)) | ||
| 124 | return -ERESTARTSYS; | ||
| 125 | |||
| 126 | /* need otp_init() documentation before this can be implemented */ | ||
| 127 | |||
| 128 | mutex_unlock(&bfin_otp_lock); | ||
| 129 | |||
| 130 | return -EINVAL; | ||
| 131 | } | ||
| 132 | #else | ||
| 133 | # define bfin_otp_write NULL | ||
| 134 | #endif | ||
| 135 | |||
| 136 | static struct file_operations bfin_otp_fops = { | ||
| 137 | .owner = THIS_MODULE, | ||
| 138 | .read = bfin_otp_read, | ||
| 139 | .write = bfin_otp_write, | ||
| 140 | }; | ||
| 141 | |||
| 142 | static struct miscdevice bfin_otp_misc_device = { | ||
| 143 | .minor = MISC_DYNAMIC_MINOR, | ||
| 144 | .name = DRIVER_NAME, | ||
| 145 | .fops = &bfin_otp_fops, | ||
| 146 | }; | ||
| 147 | |||
| 148 | /** | ||
| 149 | * bfin_otp_init - Initialize module | ||
| 150 | * | ||
| 151 | * Registers the device and notifier handler. Actual device | ||
| 152 | * initialization is handled by bfin_otp_open(). | ||
| 153 | */ | ||
| 154 | static int __init bfin_otp_init(void) | ||
| 155 | { | ||
| 156 | int ret; | ||
| 157 | |||
| 158 | stampit(); | ||
| 159 | |||
| 160 | ret = misc_register(&bfin_otp_misc_device); | ||
| 161 | if (ret) { | ||
| 162 | pr_init(KERN_ERR PFX "unable to register a misc device\n"); | ||
| 163 | return ret; | ||
| 164 | } | ||
| 165 | |||
| 166 | pr_init(KERN_INFO PFX "initialized\n"); | ||
| 167 | |||
| 168 | return 0; | ||
| 169 | } | ||
| 170 | |||
| 171 | /** | ||
| 172 | * bfin_otp_exit - Deinitialize module | ||
| 173 | * | ||
| 174 | * Unregisters the device and notifier handler. Actual device | ||
| 175 | * deinitialization is handled by bfin_otp_close(). | ||
| 176 | */ | ||
| 177 | static void __exit bfin_otp_exit(void) | ||
| 178 | { | ||
| 179 | stampit(); | ||
| 180 | |||
| 181 | misc_deregister(&bfin_otp_misc_device); | ||
| 182 | } | ||
| 183 | |||
| 184 | module_init(bfin_otp_init); | ||
| 185 | module_exit(bfin_otp_exit); | ||
| 186 | |||
| 187 | MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>"); | ||
| 188 | MODULE_DESCRIPTION("Blackfin OTP Memory Interface"); | ||
| 189 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 2399a3796f6e..015e16325973 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -827,7 +827,7 @@ config ULTRA32 | |||
| 827 | 827 | ||
| 828 | config BFIN_MAC | 828 | config BFIN_MAC |
| 829 | tristate "Blackfin 527/536/537 on-chip mac support" | 829 | tristate "Blackfin 527/536/537 on-chip mac support" |
| 830 | depends on NET_ETHERNET && (BF527 || BF537 || BF536) && (!BF537_PORT_H) | 830 | depends on NET_ETHERNET && (BF527 || BF537 || BF536) |
| 831 | select CRC32 | 831 | select CRC32 |
| 832 | select MII | 832 | select MII |
| 833 | select PHYLIB | 833 | select PHYLIB |
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 46bb47f37b9a..5f55534a290b 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c | |||
| @@ -151,7 +151,8 @@ void kgdb_put_debug_char(int chr) | |||
| 151 | { | 151 | { |
| 152 | struct bfin_serial_port *uart; | 152 | struct bfin_serial_port *uart; |
| 153 | 153 | ||
| 154 | if (CONFIG_KGDB_UART_PORT<0 || CONFIG_KGDB_UART_PORT>=NR_PORTS) | 154 | if (CONFIG_KGDB_UART_PORT < 0 |
| 155 | || CONFIG_KGDB_UART_PORT >= BFIN_UART_NR_PORTS) | ||
| 155 | uart = &bfin_serial_ports[0]; | 156 | uart = &bfin_serial_ports[0]; |
| 156 | else | 157 | else |
| 157 | uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT]; | 158 | uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT]; |
| @@ -173,7 +174,8 @@ int kgdb_get_debug_char(void) | |||
| 173 | struct bfin_serial_port *uart; | 174 | struct bfin_serial_port *uart; |
| 174 | unsigned char chr; | 175 | unsigned char chr; |
| 175 | 176 | ||
| 176 | if (CONFIG_KGDB_UART_PORT<0 || CONFIG_KGDB_UART_PORT>=NR_PORTS) | 177 | if (CONFIG_KGDB_UART_PORT < 0 |
| 178 | || CONFIG_KGDB_UART_PORT >= BFIN_UART_NR_PORTS) | ||
| 177 | uart = &bfin_serial_ports[0]; | 179 | uart = &bfin_serial_ports[0]; |
| 178 | else | 180 | else |
| 179 | uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT]; | 181 | uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT]; |
| @@ -192,7 +194,7 @@ int kgdb_get_debug_char(void) | |||
| 192 | } | 194 | } |
| 193 | #endif | 195 | #endif |
| 194 | 196 | ||
| 195 | #if ANOMALY_05000230 && defined(CONFIG_SERIAL_BFIN_PIO) | 197 | #if ANOMALY_05000363 && defined(CONFIG_SERIAL_BFIN_PIO) |
| 196 | # define UART_GET_ANOMALY_THRESHOLD(uart) ((uart)->anomaly_threshold) | 198 | # define UART_GET_ANOMALY_THRESHOLD(uart) ((uart)->anomaly_threshold) |
| 197 | # define UART_SET_ANOMALY_THRESHOLD(uart, v) ((uart)->anomaly_threshold = (v)) | 199 | # define UART_SET_ANOMALY_THRESHOLD(uart, v) ((uart)->anomaly_threshold = (v)) |
| 198 | #else | 200 | #else |
| @@ -237,7 +239,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | |||
| 237 | } | 239 | } |
| 238 | #endif | 240 | #endif |
| 239 | 241 | ||
| 240 | if (ANOMALY_05000230) { | 242 | if (ANOMALY_05000363) { |
| 241 | /* The BF533 (and BF561) family of processors have a nice anomaly | 243 | /* The BF533 (and BF561) family of processors have a nice anomaly |
| 242 | * where they continuously generate characters for a "single" break. | 244 | * where they continuously generate characters for a "single" break. |
| 243 | * We have to basically ignore this flood until the "next" valid | 245 | * We have to basically ignore this flood until the "next" valid |
| @@ -249,9 +251,6 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | |||
| 249 | * timeout was picked as it must absolutely be larger than 1 | 251 | * timeout was picked as it must absolutely be larger than 1 |
| 250 | * character time +/- some percent. So 1.5 sounds good. All other | 252 | * character time +/- some percent. So 1.5 sounds good. All other |
| 251 | * Blackfin families operate properly. Woo. | 253 | * Blackfin families operate properly. Woo. |
| 252 | * Note: While Anomaly 05000230 does not directly address this, | ||
| 253 | * the changes that went in for it also fixed this issue. | ||
| 254 | * That anomaly was fixed in 0.5+ silicon. I like bunnies. | ||
| 255 | */ | 254 | */ |
| 256 | if (anomaly_start.tv_sec) { | 255 | if (anomaly_start.tv_sec) { |
| 257 | struct timeval curr; | 256 | struct timeval curr; |
| @@ -285,7 +284,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | |||
| 285 | } | 284 | } |
| 286 | 285 | ||
| 287 | if (status & BI) { | 286 | if (status & BI) { |
| 288 | if (ANOMALY_05000230) | 287 | if (ANOMALY_05000363) |
| 289 | if (bfin_revid() < 5) | 288 | if (bfin_revid() < 5) |
| 290 | do_gettimeofday(&anomaly_start); | 289 | do_gettimeofday(&anomaly_start); |
| 291 | uart->port.icount.brk++; | 290 | uart->port.icount.brk++; |
| @@ -507,8 +506,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) | |||
| 507 | uart->rx_dma_buf.tail = uart->rx_dma_buf.head; | 506 | uart->rx_dma_buf.tail = uart->rx_dma_buf.head; |
| 508 | } | 507 | } |
| 509 | 508 | ||
| 510 | uart->rx_dma_timer.expires = jiffies + DMA_RX_FLUSH_JIFFIES; | 509 | mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES); |
| 511 | add_timer(&(uart->rx_dma_timer)); | ||
| 512 | } | 510 | } |
| 513 | 511 | ||
| 514 | static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id) | 512 | static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id) |
| @@ -551,9 +549,7 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id) | |||
| 551 | clear_dma_irqstat(uart->rx_dma_channel); | 549 | clear_dma_irqstat(uart->rx_dma_channel); |
| 552 | spin_unlock(&uart->port.lock); | 550 | spin_unlock(&uart->port.lock); |
| 553 | 551 | ||
| 554 | del_timer(&(uart->rx_dma_timer)); | 552 | mod_timer(&(uart->rx_dma_timer), jiffies); |
| 555 | uart->rx_dma_timer.expires = jiffies; | ||
| 556 | add_timer(&(uart->rx_dma_timer)); | ||
| 557 | 553 | ||
| 558 | return IRQ_HANDLED; | 554 | return IRQ_HANDLED; |
| 559 | } | 555 | } |
| @@ -749,7 +745,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 749 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; | 745 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; |
| 750 | unsigned long flags; | 746 | unsigned long flags; |
| 751 | unsigned int baud, quot; | 747 | unsigned int baud, quot; |
| 752 | unsigned short val, ier, lsr, lcr = 0; | 748 | unsigned short val, ier, lcr = 0; |
| 753 | 749 | ||
| 754 | switch (termios->c_cflag & CSIZE) { | 750 | switch (termios->c_cflag & CSIZE) { |
| 755 | case CS8: | 751 | case CS8: |
| @@ -806,10 +802,6 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 806 | 802 | ||
| 807 | UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15); | 803 | UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15); |
| 808 | 804 | ||
| 809 | do { | ||
| 810 | lsr = UART_GET_LSR(uart); | ||
| 811 | } while (!(lsr & TEMT)); | ||
| 812 | |||
| 813 | /* Disable UART */ | 805 | /* Disable UART */ |
| 814 | ier = UART_GET_IER(uart); | 806 | ier = UART_GET_IER(uart); |
| 815 | #ifdef CONFIG_BF54x | 807 | #ifdef CONFIG_BF54x |
| @@ -900,6 +892,31 @@ bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser) | |||
| 900 | return 0; | 892 | return 0; |
| 901 | } | 893 | } |
| 902 | 894 | ||
| 895 | /* | ||
| 896 | * Enable the IrDA function if tty->ldisc.num is N_IRDA. | ||
| 897 | * In other cases, disable IrDA function. | ||
| 898 | */ | ||
| 899 | static void bfin_set_ldisc(struct tty_struct *tty) | ||
| 900 | { | ||
| 901 | int line = tty->index; | ||
| 902 | unsigned short val; | ||
| 903 | |||
| 904 | if (line >= tty->driver->num) | ||
| 905 | return; | ||
| 906 | |||
| 907 | switch (tty->ldisc.num) { | ||
| 908 | case N_IRDA: | ||
| 909 | val = UART_GET_GCTL(&bfin_serial_ports[line]); | ||
| 910 | val |= (IREN | RPOLC); | ||
| 911 | UART_PUT_GCTL(&bfin_serial_ports[line], val); | ||
| 912 | break; | ||
| 913 | default: | ||
| 914 | val = UART_GET_GCTL(&bfin_serial_ports[line]); | ||
| 915 | val &= ~(IREN | RPOLC); | ||
| 916 | UART_PUT_GCTL(&bfin_serial_ports[line], val); | ||
| 917 | } | ||
| 918 | } | ||
| 919 | |||
| 903 | static struct uart_ops bfin_serial_pops = { | 920 | static struct uart_ops bfin_serial_pops = { |
| 904 | .tx_empty = bfin_serial_tx_empty, | 921 | .tx_empty = bfin_serial_tx_empty, |
| 905 | .set_mctrl = bfin_serial_set_mctrl, | 922 | .set_mctrl = bfin_serial_set_mctrl, |
| @@ -1172,7 +1189,7 @@ static struct uart_driver bfin_serial_reg = { | |||
| 1172 | .dev_name = BFIN_SERIAL_NAME, | 1189 | .dev_name = BFIN_SERIAL_NAME, |
| 1173 | .major = BFIN_SERIAL_MAJOR, | 1190 | .major = BFIN_SERIAL_MAJOR, |
| 1174 | .minor = BFIN_SERIAL_MINOR, | 1191 | .minor = BFIN_SERIAL_MINOR, |
| 1175 | .nr = NR_PORTS, | 1192 | .nr = BFIN_UART_NR_PORTS, |
| 1176 | .cons = BFIN_SERIAL_CONSOLE, | 1193 | .cons = BFIN_SERIAL_CONSOLE, |
| 1177 | }; | 1194 | }; |
| 1178 | 1195 | ||
| @@ -1261,6 +1278,7 @@ static int __init bfin_serial_init(void) | |||
| 1261 | 1278 | ||
| 1262 | ret = uart_register_driver(&bfin_serial_reg); | 1279 | ret = uart_register_driver(&bfin_serial_reg); |
| 1263 | if (ret == 0) { | 1280 | if (ret == 0) { |
| 1281 | bfin_serial_reg.tty_driver->set_ldisc = bfin_set_ldisc; | ||
| 1264 | ret = platform_driver_register(&bfin_serial_driver); | 1282 | ret = platform_driver_register(&bfin_serial_driver); |
| 1265 | if (ret) { | 1283 | if (ret) { |
| 1266 | pr_debug("uart register failed\n"); | 1284 | pr_debug("uart register failed\n"); |
