diff options
author | James Bottomley <jejb@titanic.(none)> | 2005-08-09 17:20:49 -0400 |
---|---|---|
committer | James Bottomley <jejb@titanic.(none)> | 2005-08-09 17:20:49 -0400 |
commit | 471417c9cfb4c2574e2c03bf2273fe12f5388a8e (patch) | |
tree | ac026ba976bc253fc87a5cdec8f33d24d03e1c9c /drivers | |
parent | 20e007b8cc1266ff78810457d6e26c35c6b810ba (diff) | |
parent | db29e85a7ece62de1899917c1ec0ffe55cf1d3a0 (diff) |
Merge ../linux-2.6
Diffstat (limited to 'drivers')
29 files changed, 743 insertions, 912 deletions
diff --git a/drivers/acorn/block/fd1772.c b/drivers/acorn/block/fd1772.c index 3cd2e968e96c..c0a37d98b4f3 100644 --- a/drivers/acorn/block/fd1772.c +++ b/drivers/acorn/block/fd1772.c | |||
@@ -1283,8 +1283,7 @@ static void do_fd_request(request_queue_t* q) | |||
1283 | if (fdc_busy) return; | 1283 | if (fdc_busy) return; |
1284 | save_flags(flags); | 1284 | save_flags(flags); |
1285 | cli(); | 1285 | cli(); |
1286 | while (fdc_busy) | 1286 | wait_event(fdc_wait, !fdc_busy); |
1287 | sleep_on(&fdc_wait); | ||
1288 | fdc_busy = 1; | 1287 | fdc_busy = 1; |
1289 | ENABLE_IRQ(); | 1288 | ENABLE_IRQ(); |
1290 | restore_flags(flags); | 1289 | restore_flags(flags); |
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index 2771c861f185..f696da6f417b 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c | |||
@@ -367,11 +367,8 @@ static inline void bpa10x_free_urb(struct urb *urb) | |||
367 | if (!urb) | 367 | if (!urb) |
368 | return; | 368 | return; |
369 | 369 | ||
370 | if (urb->setup_packet) | 370 | kfree(urb->setup_packet); |
371 | kfree(urb->setup_packet); | 371 | kfree(urb->transfer_buffer); |
372 | |||
373 | if (urb->transfer_buffer) | ||
374 | kfree(urb->transfer_buffer); | ||
375 | 372 | ||
376 | usb_free_urb(urb); | 373 | usb_free_urb(urb); |
377 | } | 374 | } |
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c index c0ed213fc857..858fddb046de 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c | |||
@@ -58,8 +58,6 @@ | |||
58 | #ifndef CONFIG_BT_HCIUART_DEBUG | 58 | #ifndef CONFIG_BT_HCIUART_DEBUG |
59 | #undef BT_DBG | 59 | #undef BT_DBG |
60 | #define BT_DBG( A... ) | 60 | #define BT_DBG( A... ) |
61 | #undef BT_DMP | ||
62 | #define BT_DMP( A... ) | ||
63 | #endif | 61 | #endif |
64 | 62 | ||
65 | static int hciextn = 1; | 63 | static int hciextn = 1; |
diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c index ade94a57bb11..533323b60e63 100644 --- a/drivers/bluetooth/hci_h4.c +++ b/drivers/bluetooth/hci_h4.c | |||
@@ -57,8 +57,6 @@ | |||
57 | #ifndef CONFIG_BT_HCIUART_DEBUG | 57 | #ifndef CONFIG_BT_HCIUART_DEBUG |
58 | #undef BT_DBG | 58 | #undef BT_DBG |
59 | #define BT_DBG( A... ) | 59 | #define BT_DBG( A... ) |
60 | #undef BT_DMP | ||
61 | #define BT_DMP( A... ) | ||
62 | #endif | 60 | #endif |
63 | 61 | ||
64 | /* Initialize protocol */ | 62 | /* Initialize protocol */ |
@@ -125,7 +123,6 @@ static inline int h4_check_data_len(struct h4_struct *h4, int len) | |||
125 | 123 | ||
126 | BT_DBG("len %d room %d", len, room); | 124 | BT_DBG("len %d room %d", len, room); |
127 | if (!len) { | 125 | if (!len) { |
128 | BT_DMP(h4->rx_skb->data, h4->rx_skb->len); | ||
129 | hci_recv_frame(h4->rx_skb); | 126 | hci_recv_frame(h4->rx_skb); |
130 | } else if (len > room) { | 127 | } else if (len > room) { |
131 | BT_ERR("Data length is too large"); | 128 | BT_ERR("Data length is too large"); |
@@ -169,8 +166,6 @@ static int h4_recv(struct hci_uart *hu, void *data, int count) | |||
169 | case H4_W4_DATA: | 166 | case H4_W4_DATA: |
170 | BT_DBG("Complete data"); | 167 | BT_DBG("Complete data"); |
171 | 168 | ||
172 | BT_DMP(h4->rx_skb->data, h4->rx_skb->len); | ||
173 | |||
174 | hci_recv_frame(h4->rx_skb); | 169 | hci_recv_frame(h4->rx_skb); |
175 | 170 | ||
176 | h4->rx_state = H4_W4_PACKET_TYPE; | 171 | h4->rx_state = H4_W4_PACKET_TYPE; |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index f766bc22c6bb..90be2eae52e0 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -57,8 +57,6 @@ | |||
57 | #ifndef CONFIG_BT_HCIUART_DEBUG | 57 | #ifndef CONFIG_BT_HCIUART_DEBUG |
58 | #undef BT_DBG | 58 | #undef BT_DBG |
59 | #define BT_DBG( A... ) | 59 | #define BT_DBG( A... ) |
60 | #undef BT_DMP | ||
61 | #define BT_DMP( A... ) | ||
62 | #endif | 60 | #endif |
63 | 61 | ||
64 | static int reset = 0; | 62 | static int reset = 0; |
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c index b120ecf7b8c9..657719b8254f 100644 --- a/drivers/bluetooth/hci_usb.c +++ b/drivers/bluetooth/hci_usb.c | |||
@@ -57,8 +57,6 @@ | |||
57 | #ifndef CONFIG_BT_HCIUSB_DEBUG | 57 | #ifndef CONFIG_BT_HCIUSB_DEBUG |
58 | #undef BT_DBG | 58 | #undef BT_DBG |
59 | #define BT_DBG(D...) | 59 | #define BT_DBG(D...) |
60 | #undef BT_DMP | ||
61 | #define BT_DMP(D...) | ||
62 | #endif | 60 | #endif |
63 | 61 | ||
64 | #ifndef CONFIG_BT_HCIUSB_ZERO_PACKET | 62 | #ifndef CONFIG_BT_HCIUSB_ZERO_PACKET |
@@ -110,6 +108,9 @@ static struct usb_device_id blacklist_ids[] = { | |||
110 | /* Microsoft Wireless Transceiver for Bluetooth 2.0 */ | 108 | /* Microsoft Wireless Transceiver for Bluetooth 2.0 */ |
111 | { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET }, | 109 | { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET }, |
112 | 110 | ||
111 | /* Kensington Bluetooth USB adapter */ | ||
112 | { USB_DEVICE(0x047d, 0x105d), .driver_info = HCI_RESET }, | ||
113 | |||
113 | /* ISSC Bluetooth Adapter v3.1 */ | 114 | /* ISSC Bluetooth Adapter v3.1 */ |
114 | { USB_DEVICE(0x1131, 0x1001), .driver_info = HCI_RESET }, | 115 | { USB_DEVICE(0x1131, 0x1001), .driver_info = HCI_RESET }, |
115 | 116 | ||
@@ -387,10 +388,8 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb) | |||
387 | urb = &_urb->urb; | 388 | urb = &_urb->urb; |
388 | BT_DBG("%s freeing _urb %p type %d urb %p", | 389 | BT_DBG("%s freeing _urb %p type %d urb %p", |
389 | husb->hdev->name, _urb, _urb->type, urb); | 390 | husb->hdev->name, _urb, _urb->type, urb); |
390 | if (urb->setup_packet) | 391 | kfree(urb->setup_packet); |
391 | kfree(urb->setup_packet); | 392 | kfree(urb->transfer_buffer); |
392 | if (urb->transfer_buffer) | ||
393 | kfree(urb->transfer_buffer); | ||
394 | _urb_free(_urb); | 393 | _urb_free(_urb); |
395 | } | 394 | } |
396 | 395 | ||
diff --git a/drivers/char/watchdog/i8xx_tco.c b/drivers/char/watchdog/i8xx_tco.c index f975dab1ddf9..a13395e2c372 100644 --- a/drivers/char/watchdog/i8xx_tco.c +++ b/drivers/char/watchdog/i8xx_tco.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * i8xx_tco 0.07: TCO timer driver for i8xx chipsets | 2 | * i8xx_tco: TCO timer driver for i8xx chipsets |
3 | * | 3 | * |
4 | * (c) Copyright 2000 kernel concepts <nils@kernelconcepts.de>, All Rights Reserved. | 4 | * (c) Copyright 2000 kernel concepts <nils@kernelconcepts.de>, All Rights Reserved. |
5 | * http://www.kernelconcepts.de | 5 | * http://www.kernelconcepts.de |
@@ -63,6 +63,9 @@ | |||
63 | * 20050128 Wim Van Sebroeck <wim@iguana.be> | 63 | * 20050128 Wim Van Sebroeck <wim@iguana.be> |
64 | * 0.07 Added support for the ICH4-M, ICH6, ICH6R, ICH6-M, ICH6W and ICH6RW | 64 | * 0.07 Added support for the ICH4-M, ICH6, ICH6R, ICH6-M, ICH6W and ICH6RW |
65 | * chipsets. Also added support for the "undocumented" ICH7 chipset. | 65 | * chipsets. Also added support for the "undocumented" ICH7 chipset. |
66 | * 20050807 Wim Van Sebroeck <wim@iguana.be> | ||
67 | * 0.08 Make sure that the watchdog is only "armed" when started. | ||
68 | * (Kernel Bug 4251) | ||
66 | */ | 69 | */ |
67 | 70 | ||
68 | /* | 71 | /* |
@@ -87,7 +90,7 @@ | |||
87 | #include "i8xx_tco.h" | 90 | #include "i8xx_tco.h" |
88 | 91 | ||
89 | /* Module and version information */ | 92 | /* Module and version information */ |
90 | #define TCO_VERSION "0.07" | 93 | #define TCO_VERSION "0.08" |
91 | #define TCO_MODULE_NAME "i8xx TCO timer" | 94 | #define TCO_MODULE_NAME "i8xx TCO timer" |
92 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION | 95 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION |
93 | #define PFX TCO_MODULE_NAME ": " | 96 | #define PFX TCO_MODULE_NAME ": " |
@@ -125,10 +128,18 @@ static int tco_timer_start (void) | |||
125 | unsigned char val; | 128 | unsigned char val; |
126 | 129 | ||
127 | spin_lock(&tco_lock); | 130 | spin_lock(&tco_lock); |
131 | |||
132 | /* disable chipset's NO_REBOOT bit */ | ||
133 | pci_read_config_byte (i8xx_tco_pci, 0xd4, &val); | ||
134 | val &= 0xfd; | ||
135 | pci_write_config_byte (i8xx_tco_pci, 0xd4, val); | ||
136 | |||
137 | /* Bit 11: TCO Timer Halt -> 0 = The TCO timer is enabled to count */ | ||
128 | val = inb (TCO1_CNT + 1); | 138 | val = inb (TCO1_CNT + 1); |
129 | val &= 0xf7; | 139 | val &= 0xf7; |
130 | outb (val, TCO1_CNT + 1); | 140 | outb (val, TCO1_CNT + 1); |
131 | val = inb (TCO1_CNT + 1); | 141 | val = inb (TCO1_CNT + 1); |
142 | |||
132 | spin_unlock(&tco_lock); | 143 | spin_unlock(&tco_lock); |
133 | 144 | ||
134 | if (val & 0x08) | 145 | if (val & 0x08) |
@@ -138,13 +149,20 @@ static int tco_timer_start (void) | |||
138 | 149 | ||
139 | static int tco_timer_stop (void) | 150 | static int tco_timer_stop (void) |
140 | { | 151 | { |
141 | unsigned char val; | 152 | unsigned char val, val1; |
142 | 153 | ||
143 | spin_lock(&tco_lock); | 154 | spin_lock(&tco_lock); |
155 | /* Bit 11: TCO Timer Halt -> 1 = The TCO timer is disabled */ | ||
144 | val = inb (TCO1_CNT + 1); | 156 | val = inb (TCO1_CNT + 1); |
145 | val |= 0x08; | 157 | val |= 0x08; |
146 | outb (val, TCO1_CNT + 1); | 158 | outb (val, TCO1_CNT + 1); |
147 | val = inb (TCO1_CNT + 1); | 159 | val = inb (TCO1_CNT + 1); |
160 | |||
161 | /* Set the NO_REBOOT bit to prevent later reboots, just for sure */ | ||
162 | pci_read_config_byte (i8xx_tco_pci, 0xd4, &val1); | ||
163 | val1 |= 0x02; | ||
164 | pci_write_config_byte (i8xx_tco_pci, 0xd4, val1); | ||
165 | |||
148 | spin_unlock(&tco_lock); | 166 | spin_unlock(&tco_lock); |
149 | 167 | ||
150 | if ((val & 0x08) == 0) | 168 | if ((val & 0x08) == 0) |
@@ -155,6 +173,7 @@ static int tco_timer_stop (void) | |||
155 | static int tco_timer_keepalive (void) | 173 | static int tco_timer_keepalive (void) |
156 | { | 174 | { |
157 | spin_lock(&tco_lock); | 175 | spin_lock(&tco_lock); |
176 | /* Reload the timer by writing to the TCO Timer Reload register */ | ||
158 | outb (0x01, TCO1_RLD); | 177 | outb (0x01, TCO1_RLD); |
159 | spin_unlock(&tco_lock); | 178 | spin_unlock(&tco_lock); |
160 | return 0; | 179 | return 0; |
@@ -417,9 +436,8 @@ static unsigned char __init i8xx_tco_getdevice (void) | |||
417 | printk (KERN_ERR PFX "failed to get TCOBASE address\n"); | 436 | printk (KERN_ERR PFX "failed to get TCOBASE address\n"); |
418 | return 0; | 437 | return 0; |
419 | } | 438 | } |
420 | /* | 439 | |
421 | * Check chipset's NO_REBOOT bit | 440 | /* Check chipset's NO_REBOOT bit */ |
422 | */ | ||
423 | pci_read_config_byte (i8xx_tco_pci, 0xd4, &val1); | 441 | pci_read_config_byte (i8xx_tco_pci, 0xd4, &val1); |
424 | if (val1 & 0x02) { | 442 | if (val1 & 0x02) { |
425 | val1 &= 0xfd; | 443 | val1 &= 0xfd; |
@@ -430,6 +448,10 @@ static unsigned char __init i8xx_tco_getdevice (void) | |||
430 | return 0; /* Cannot reset NO_REBOOT bit */ | 448 | return 0; /* Cannot reset NO_REBOOT bit */ |
431 | } | 449 | } |
432 | } | 450 | } |
451 | /* Disable reboots untill the watchdog starts */ | ||
452 | val1 |= 0x02; | ||
453 | pci_write_config_byte (i8xx_tco_pci, 0xd4, val1); | ||
454 | |||
433 | /* Set the TCO_EN bit in SMI_EN register */ | 455 | /* Set the TCO_EN bit in SMI_EN register */ |
434 | if (!request_region (SMI_EN + 1, 1, "i8xx TCO")) { | 456 | if (!request_region (SMI_EN + 1, 1, "i8xx TCO")) { |
435 | printk (KERN_ERR PFX "I/O address 0x%04x already in use\n", | 457 | printk (KERN_ERR PFX "I/O address 0x%04x already in use\n", |
@@ -505,17 +527,10 @@ out: | |||
505 | 527 | ||
506 | static void __exit watchdog_cleanup (void) | 528 | static void __exit watchdog_cleanup (void) |
507 | { | 529 | { |
508 | u8 val; | ||
509 | |||
510 | /* Stop the timer before we leave */ | 530 | /* Stop the timer before we leave */ |
511 | if (!nowayout) | 531 | if (!nowayout) |
512 | tco_timer_stop (); | 532 | tco_timer_stop (); |
513 | 533 | ||
514 | /* Set the NO_REBOOT bit to prevent later reboots, just for sure */ | ||
515 | pci_read_config_byte (i8xx_tco_pci, 0xd4, &val); | ||
516 | val |= 0x02; | ||
517 | pci_write_config_byte (i8xx_tco_pci, 0xd4, val); | ||
518 | |||
519 | /* Deregister */ | 534 | /* Deregister */ |
520 | misc_deregister (&i8xx_tco_miscdev); | 535 | misc_deregister (&i8xx_tco_miscdev); |
521 | unregister_reboot_notifier(&i8xx_tco_notifier); | 536 | unregister_reboot_notifier(&i8xx_tco_notifier); |
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c index 1c99536b673b..fa503ed9f86d 100644 --- a/drivers/i2c/busses/i2c-sibyte.c +++ b/drivers/i2c/busses/i2c-sibyte.c | |||
@@ -23,8 +23,8 @@ | |||
23 | #include <asm/sibyte/sb1250_smbus.h> | 23 | #include <asm/sibyte/sb1250_smbus.h> |
24 | 24 | ||
25 | static struct i2c_algo_sibyte_data sibyte_board_data[2] = { | 25 | static struct i2c_algo_sibyte_data sibyte_board_data[2] = { |
26 | { NULL, 0, (void *) (KSEG1+A_SMB_BASE(0)) }, | 26 | { NULL, 0, (void *) (CKSEG1+A_SMB_BASE(0)) }, |
27 | { NULL, 1, (void *) (KSEG1+A_SMB_BASE(1)) } | 27 | { NULL, 1, (void *) (CKSEG1+A_SMB_BASE(1)) } |
28 | }; | 28 | }; |
29 | 29 | ||
30 | static struct i2c_adapter sibyte_board_adapter[2] = { | 30 | static struct i2c_adapter sibyte_board_adapter[2] = { |
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c index e0d1b01cc74c..386df71eee74 100644 --- a/drivers/isdn/icn/icn.c +++ b/drivers/isdn/icn/icn.c | |||
@@ -1650,7 +1650,7 @@ static void __exit icn_exit(void) | |||
1650 | { | 1650 | { |
1651 | isdn_ctrl cmd; | 1651 | isdn_ctrl cmd; |
1652 | icn_card *card = cards; | 1652 | icn_card *card = cards; |
1653 | icn_card *last; | 1653 | icn_card *last, *tmpcard; |
1654 | int i; | 1654 | int i; |
1655 | unsigned long flags; | 1655 | unsigned long flags; |
1656 | 1656 | ||
@@ -1670,8 +1670,9 @@ static void __exit icn_exit(void) | |||
1670 | for (i = 0; i < ICN_BCH; i++) | 1670 | for (i = 0; i < ICN_BCH; i++) |
1671 | icn_free_queue(card, i); | 1671 | icn_free_queue(card, i); |
1672 | } | 1672 | } |
1673 | card = card->next; | 1673 | tmpcard = card->next; |
1674 | spin_unlock_irqrestore(&card->lock, flags); | 1674 | spin_unlock_irqrestore(&card->lock, flags); |
1675 | card = tmpcard; | ||
1675 | } | 1676 | } |
1676 | card = cards; | 1677 | card = cards; |
1677 | cards = NULL; | 1678 | cards = NULL; |
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 5264310c070e..536c35d969b7 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -225,6 +225,22 @@ struct dvb_pll_desc dvb_pll_tua6034 = { | |||
225 | }; | 225 | }; |
226 | EXPORT_SYMBOL(dvb_pll_tua6034); | 226 | EXPORT_SYMBOL(dvb_pll_tua6034); |
227 | 227 | ||
228 | /* Infineon TUA6034 | ||
229 | * used in LG Innotek TDVS-H062F | ||
230 | */ | ||
231 | struct dvb_pll_desc dvb_pll_tdvs_tua6034 = { | ||
232 | .name = "LG/Infineon TUA6034", | ||
233 | .min = 54000000, | ||
234 | .max = 863000000, | ||
235 | .count = 3, | ||
236 | .entries = { | ||
237 | { 160000000, 44000000, 62500, 0xce, 0x01 }, | ||
238 | { 455000000, 44000000, 62500, 0xce, 0x02 }, | ||
239 | { 999999999, 44000000, 62500, 0xce, 0x04 }, | ||
240 | }, | ||
241 | }; | ||
242 | EXPORT_SYMBOL(dvb_pll_tdvs_tua6034); | ||
243 | |||
228 | /* Philips FMD1216ME | 244 | /* Philips FMD1216ME |
229 | * used in Medion Hybrid PCMCIA card and USB Box | 245 | * used in Medion Hybrid PCMCIA card and USB Box |
230 | */ | 246 | */ |
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h index cb794759d89e..205b2d1a8852 100644 --- a/drivers/media/dvb/frontends/dvb-pll.h +++ b/drivers/media/dvb/frontends/dvb-pll.h | |||
@@ -31,6 +31,7 @@ extern struct dvb_pll_desc dvb_pll_unknown_1; | |||
31 | extern struct dvb_pll_desc dvb_pll_tua6010xs; | 31 | extern struct dvb_pll_desc dvb_pll_tua6010xs; |
32 | extern struct dvb_pll_desc dvb_pll_env57h1xd5; | 32 | extern struct dvb_pll_desc dvb_pll_env57h1xd5; |
33 | extern struct dvb_pll_desc dvb_pll_tua6034; | 33 | extern struct dvb_pll_desc dvb_pll_tua6034; |
34 | extern struct dvb_pll_desc dvb_pll_tdvs_tua6034; | ||
34 | extern struct dvb_pll_desc dvb_pll_tda665x; | 35 | extern struct dvb_pll_desc dvb_pll_tda665x; |
35 | extern struct dvb_pll_desc dvb_pll_fmd1216me; | 36 | extern struct dvb_pll_desc dvb_pll_fmd1216me; |
36 | extern struct dvb_pll_desc dvb_pll_tded4; | 37 | extern struct dvb_pll_desc dvb_pll_tded4; |
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c index e94dee50eecd..c48e7c11d708 100644 --- a/drivers/media/dvb/frontends/lgdt330x.c +++ b/drivers/media/dvb/frontends/lgdt330x.c | |||
@@ -1,11 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Support for LGDT3302 & LGDT3303 (DViCO FusionHDTV Gold) - VSB/QAM | 2 | * Support for LGDT3302 and LGDT3303 - VSB/QAM |
3 | * | 3 | * |
4 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> | 4 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> |
5 | * | 5 | * |
6 | * Based on code from Kirk Lapray <kirk_lapray@bigfoot.com> | ||
7 | * Copyright (C) 2005 | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2 of the License, or | 8 | * the Free Software Foundation; either version 2 of the License, or |
@@ -25,11 +22,13 @@ | |||
25 | /* | 22 | /* |
26 | * NOTES ABOUT THIS DRIVER | 23 | * NOTES ABOUT THIS DRIVER |
27 | * | 24 | * |
28 | * This driver supports DViCO FusionHDTV Gold under Linux. | 25 | * This Linux driver supports: |
26 | * DViCO FusionHDTV 3 Gold-Q | ||
27 | * DViCO FusionHDTV 3 Gold-T | ||
28 | * DViCO FusionHDTV 5 Gold | ||
29 | * | 29 | * |
30 | * TODO: | 30 | * TODO: |
31 | * BER and signal strength always return 0. | 31 | * signal strength always returns 0. |
32 | * Include support for LGDT3303 | ||
33 | * | 32 | * |
34 | */ | 33 | */ |
35 | 34 | ||
@@ -41,7 +40,6 @@ | |||
41 | #include <asm/byteorder.h> | 40 | #include <asm/byteorder.h> |
42 | 41 | ||
43 | #include "dvb_frontend.h" | 42 | #include "dvb_frontend.h" |
44 | #include "dvb-pll.h" | ||
45 | #include "lgdt330x_priv.h" | 43 | #include "lgdt330x_priv.h" |
46 | #include "lgdt330x.h" | 44 | #include "lgdt330x.h" |
47 | 45 | ||
@@ -70,55 +68,37 @@ struct lgdt330x_state | |||
70 | u32 current_frequency; | 68 | u32 current_frequency; |
71 | }; | 69 | }; |
72 | 70 | ||
73 | static int i2c_writebytes (struct lgdt330x_state* state, | 71 | static int i2c_write_demod_bytes (struct lgdt330x_state* state, |
74 | u8 addr, /* demod_address or pll_address */ | ||
75 | u8 *buf, /* data bytes to send */ | 72 | u8 *buf, /* data bytes to send */ |
76 | int len /* number of bytes to send */ ) | 73 | int len /* number of bytes to send */ ) |
77 | { | 74 | { |
78 | u8 tmp[] = { buf[0], buf[1] }; | ||
79 | struct i2c_msg msg = | 75 | struct i2c_msg msg = |
80 | { .addr = addr, .flags = 0, .buf = tmp, .len = 2 }; | 76 | { .addr = state->config->demod_address, |
81 | int err; | 77 | .flags = 0, |
78 | .buf = buf, | ||
79 | .len = 2 }; | ||
82 | int i; | 80 | int i; |
81 | int err; | ||
83 | 82 | ||
84 | for (i=1; i<len; i++) { | 83 | for (i=0; i<len-1; i+=2){ |
85 | tmp[1] = buf[i]; | ||
86 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 84 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
87 | printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); | 85 | printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, msg.buf[0], msg.buf[1], err); |
88 | if (err < 0) | 86 | if (err < 0) |
89 | return err; | 87 | return err; |
90 | else | 88 | else |
91 | return -EREMOTEIO; | 89 | return -EREMOTEIO; |
92 | } | 90 | } |
93 | tmp[0]++; | 91 | msg.buf += 2; |
94 | } | ||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | #if 0 | ||
99 | static int i2c_readbytes (struct lgdt330x_state* state, | ||
100 | u8 addr, /* demod_address or pll_address */ | ||
101 | u8 *buf, /* holds data bytes read */ | ||
102 | int len /* number of bytes to read */ ) | ||
103 | { | ||
104 | struct i2c_msg msg = | ||
105 | { .addr = addr, .flags = I2C_M_RD, .buf = buf, .len = len }; | ||
106 | int err; | ||
107 | |||
108 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | ||
109 | printk(KERN_WARNING "lgdt330x: %s error (addr %02x, err == %i)\n", __FUNCTION__, addr, err); | ||
110 | return -EREMOTEIO; | ||
111 | } | 92 | } |
112 | return 0; | 93 | return 0; |
113 | } | 94 | } |
114 | #endif | ||
115 | 95 | ||
116 | /* | 96 | /* |
117 | * This routine writes the register (reg) to the demod bus | 97 | * This routine writes the register (reg) to the demod bus |
118 | * then reads the data returned for (len) bytes. | 98 | * then reads the data returned for (len) bytes. |
119 | */ | 99 | */ |
120 | 100 | ||
121 | static u8 i2c_selectreadbytes (struct lgdt330x_state* state, | 101 | static u8 i2c_read_demod_bytes (struct lgdt330x_state* state, |
122 | enum I2C_REG reg, u8* buf, int len) | 102 | enum I2C_REG reg, u8* buf, int len) |
123 | { | 103 | { |
124 | u8 wr [] = { reg }; | 104 | u8 wr [] = { reg }; |
@@ -139,7 +119,7 @@ static u8 i2c_selectreadbytes (struct lgdt330x_state* state, | |||
139 | } | 119 | } |
140 | 120 | ||
141 | /* Software reset */ | 121 | /* Software reset */ |
142 | int lgdt330x_SwReset(struct lgdt330x_state* state) | 122 | static int lgdt3302_SwReset(struct lgdt330x_state* state) |
143 | { | 123 | { |
144 | u8 ret; | 124 | u8 ret; |
145 | u8 reset[] = { | 125 | u8 reset[] = { |
@@ -148,23 +128,83 @@ int lgdt330x_SwReset(struct lgdt330x_state* state) | |||
148 | * bits 5-0 are 1 to mask interrupts */ | 128 | * bits 5-0 are 1 to mask interrupts */ |
149 | }; | 129 | }; |
150 | 130 | ||
151 | ret = i2c_writebytes(state, | 131 | ret = i2c_write_demod_bytes(state, |
152 | state->config->demod_address, | ||
153 | reset, sizeof(reset)); | 132 | reset, sizeof(reset)); |
154 | if (ret == 0) { | 133 | if (ret == 0) { |
155 | /* spec says reset takes 100 ns why wait */ | 134 | |
156 | /* mdelay(100); */ /* keep low for 100mS */ | 135 | /* force reset high (inactive) and unmask interrupts */ |
157 | reset[1] = 0x7f; /* force reset high (inactive) | 136 | reset[1] = 0x7f; |
158 | * and unmask interrupts */ | 137 | ret = i2c_write_demod_bytes(state, |
159 | ret = i2c_writebytes(state, | ||
160 | state->config->demod_address, | ||
161 | reset, sizeof(reset)); | 138 | reset, sizeof(reset)); |
162 | } | 139 | } |
163 | /* Spec does not indicate a need for this either */ | ||
164 | /*mdelay(5); */ /* wait 5 msec before doing more */ | ||
165 | return ret; | 140 | return ret; |
166 | } | 141 | } |
167 | 142 | ||
143 | static int lgdt3303_SwReset(struct lgdt330x_state* state) | ||
144 | { | ||
145 | u8 ret; | ||
146 | u8 reset[] = { | ||
147 | 0x02, | ||
148 | 0x00 /* bit 0 is active low software reset */ | ||
149 | }; | ||
150 | |||
151 | ret = i2c_write_demod_bytes(state, | ||
152 | reset, sizeof(reset)); | ||
153 | if (ret == 0) { | ||
154 | |||
155 | /* force reset high (inactive) */ | ||
156 | reset[1] = 0x01; | ||
157 | ret = i2c_write_demod_bytes(state, | ||
158 | reset, sizeof(reset)); | ||
159 | } | ||
160 | return ret; | ||
161 | } | ||
162 | |||
163 | static int lgdt330x_SwReset(struct lgdt330x_state* state) | ||
164 | { | ||
165 | switch (state->config->demod_chip) { | ||
166 | case LGDT3302: | ||
167 | return lgdt3302_SwReset(state); | ||
168 | case LGDT3303: | ||
169 | return lgdt3303_SwReset(state); | ||
170 | default: | ||
171 | return -ENODEV; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | #ifdef MUTE_TDA9887 | ||
176 | static int i2c_write_ntsc_demod (struct lgdt330x_state* state, u8 buf[2]) | ||
177 | { | ||
178 | struct i2c_msg msg = | ||
179 | { .addr = 0x43, | ||
180 | .flags = 0, | ||
181 | .buf = buf, | ||
182 | .len = 2 }; | ||
183 | int err; | ||
184 | |||
185 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | ||
186 | printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, msg.buf[0], msg.buf[1], err); | ||
187 | if (err < 0) | ||
188 | return err; | ||
189 | else | ||
190 | return -EREMOTEIO; | ||
191 | } | ||
192 | return 0; | ||
193 | } | ||
194 | |||
195 | static void fiddle_with_ntsc_if_demod(struct lgdt330x_state* state) | ||
196 | { | ||
197 | // Experimental code | ||
198 | u8 buf0[] = {0x00, 0x20}; | ||
199 | u8 buf1[] = {0x01, 0x00}; | ||
200 | u8 buf2[] = {0x02, 0x00}; | ||
201 | |||
202 | i2c_write_ntsc_demod(state, buf0); | ||
203 | i2c_write_ntsc_demod(state, buf1); | ||
204 | i2c_write_ntsc_demod(state, buf2); | ||
205 | } | ||
206 | #endif | ||
207 | |||
168 | static int lgdt330x_init(struct dvb_frontend* fe) | 208 | static int lgdt330x_init(struct dvb_frontend* fe) |
169 | { | 209 | { |
170 | /* Hardware reset is done using gpio[0] of cx23880x chip. | 210 | /* Hardware reset is done using gpio[0] of cx23880x chip. |
@@ -173,22 +213,101 @@ static int lgdt330x_init(struct dvb_frontend* fe) | |||
173 | * Maybe there needs to be a callable function in cx88-core or | 213 | * Maybe there needs to be a callable function in cx88-core or |
174 | * the caller of this function needs to do it. */ | 214 | * the caller of this function needs to do it. */ |
175 | 215 | ||
176 | dprintk("%s entered\n", __FUNCTION__); | 216 | /* |
177 | return lgdt330x_SwReset((struct lgdt330x_state*) fe->demodulator_priv); | 217 | * Array of byte pairs <address, value> |
218 | * to initialize each different chip | ||
219 | */ | ||
220 | static u8 lgdt3302_init_data[] = { | ||
221 | /* Use 50MHz parameter values from spec sheet since xtal is 50 */ | ||
222 | /* Change the value of NCOCTFV[25:0] of carrier | ||
223 | recovery center frequency register */ | ||
224 | VSB_CARRIER_FREQ0, 0x00, | ||
225 | VSB_CARRIER_FREQ1, 0x87, | ||
226 | VSB_CARRIER_FREQ2, 0x8e, | ||
227 | VSB_CARRIER_FREQ3, 0x01, | ||
228 | /* Change the TPCLK pin polarity | ||
229 | data is valid on falling clock */ | ||
230 | DEMUX_CONTROL, 0xfb, | ||
231 | /* Change the value of IFBW[11:0] of | ||
232 | AGC IF/RF loop filter bandwidth register */ | ||
233 | AGC_RF_BANDWIDTH0, 0x40, | ||
234 | AGC_RF_BANDWIDTH1, 0x93, | ||
235 | AGC_RF_BANDWIDTH2, 0x00, | ||
236 | /* Change the value of bit 6, 'nINAGCBY' and | ||
237 | 'NSSEL[1:0] of ACG function control register 2 */ | ||
238 | AGC_FUNC_CTRL2, 0xc6, | ||
239 | /* Change the value of bit 6 'RFFIX' | ||
240 | of AGC function control register 3 */ | ||
241 | AGC_FUNC_CTRL3, 0x40, | ||
242 | /* Set the value of 'INLVTHD' register 0x2a/0x2c | ||
243 | to 0x7fe */ | ||
244 | AGC_DELAY0, 0x07, | ||
245 | AGC_DELAY2, 0xfe, | ||
246 | /* Change the value of IAGCBW[15:8] | ||
247 | of inner AGC loop filter bandwith */ | ||
248 | AGC_LOOP_BANDWIDTH0, 0x08, | ||
249 | AGC_LOOP_BANDWIDTH1, 0x9a | ||
250 | }; | ||
251 | |||
252 | static u8 lgdt3303_init_data[] = { | ||
253 | 0x4c, 0x14 | ||
254 | }; | ||
255 | |||
256 | struct lgdt330x_state* state = fe->demodulator_priv; | ||
257 | char *chip_name; | ||
258 | int err; | ||
259 | |||
260 | switch (state->config->demod_chip) { | ||
261 | case LGDT3302: | ||
262 | chip_name = "LGDT3302"; | ||
263 | err = i2c_write_demod_bytes(state, lgdt3302_init_data, | ||
264 | sizeof(lgdt3302_init_data)); | ||
265 | break; | ||
266 | case LGDT3303: | ||
267 | chip_name = "LGDT3303"; | ||
268 | err = i2c_write_demod_bytes(state, lgdt3303_init_data, | ||
269 | sizeof(lgdt3303_init_data)); | ||
270 | #ifdef MUTE_TDA9887 | ||
271 | fiddle_with_ntsc_if_demod(state); | ||
272 | #endif | ||
273 | break; | ||
274 | default: | ||
275 | chip_name = "undefined"; | ||
276 | printk (KERN_WARNING "Only LGDT3302 and LGDT3303 are supported chips.\n"); | ||
277 | err = -ENODEV; | ||
278 | } | ||
279 | dprintk("%s entered as %s\n", __FUNCTION__, chip_name); | ||
280 | if (err < 0) | ||
281 | return err; | ||
282 | return lgdt330x_SwReset(state); | ||
178 | } | 283 | } |
179 | 284 | ||
180 | static int lgdt330x_read_ber(struct dvb_frontend* fe, u32* ber) | 285 | static int lgdt330x_read_ber(struct dvb_frontend* fe, u32* ber) |
181 | { | 286 | { |
182 | *ber = 0; /* Dummy out for now */ | 287 | *ber = 0; /* Not supplied by the demod chips */ |
183 | return 0; | 288 | return 0; |
184 | } | 289 | } |
185 | 290 | ||
186 | static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 291 | static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
187 | { | 292 | { |
188 | struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; | 293 | struct lgdt330x_state* state = fe->demodulator_priv; |
294 | int err; | ||
189 | u8 buf[2]; | 295 | u8 buf[2]; |
190 | 296 | ||
191 | i2c_selectreadbytes(state, PACKET_ERR_COUNTER1, buf, sizeof(buf)); | 297 | switch (state->config->demod_chip) { |
298 | case LGDT3302: | ||
299 | err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1, | ||
300 | buf, sizeof(buf)); | ||
301 | break; | ||
302 | case LGDT3303: | ||
303 | err = i2c_read_demod_bytes(state, LGDT3303_PACKET_ERR_COUNTER1, | ||
304 | buf, sizeof(buf)); | ||
305 | break; | ||
306 | default: | ||
307 | printk(KERN_WARNING | ||
308 | "Only LGDT3302 and LGDT3303 are supported chips.\n"); | ||
309 | err = -ENODEV; | ||
310 | } | ||
192 | 311 | ||
193 | *ucblocks = (buf[0] << 8) | buf[1]; | 312 | *ucblocks = (buf[0] << 8) | buf[1]; |
194 | return 0; | 313 | return 0; |
@@ -197,123 +316,113 @@ static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
197 | static int lgdt330x_set_parameters(struct dvb_frontend* fe, | 316 | static int lgdt330x_set_parameters(struct dvb_frontend* fe, |
198 | struct dvb_frontend_parameters *param) | 317 | struct dvb_frontend_parameters *param) |
199 | { | 318 | { |
200 | struct lgdt330x_state* state = | 319 | /* |
201 | (struct lgdt330x_state*) fe->demodulator_priv; | 320 | * Array of byte pairs <address, value> |
321 | * to initialize 8VSB for lgdt3303 chip 50 MHz IF | ||
322 | */ | ||
323 | static u8 lgdt3303_8vsb_44_data[] = { | ||
324 | 0x04, 0x00, | ||
325 | 0x0d, 0x40, | ||
326 | 0x0e, 0x87, | ||
327 | 0x0f, 0x8e, | ||
328 | 0x10, 0x01, | ||
329 | 0x47, 0x8b }; | ||
330 | |||
331 | /* | ||
332 | * Array of byte pairs <address, value> | ||
333 | * to initialize QAM for lgdt3303 chip | ||
334 | */ | ||
335 | static u8 lgdt3303_qam_data[] = { | ||
336 | 0x04, 0x00, | ||
337 | 0x0d, 0x00, | ||
338 | 0x0e, 0x00, | ||
339 | 0x0f, 0x00, | ||
340 | 0x10, 0x00, | ||
341 | 0x51, 0x63, | ||
342 | 0x47, 0x66, | ||
343 | 0x48, 0x66, | ||
344 | 0x4d, 0x1a, | ||
345 | 0x49, 0x08, | ||
346 | 0x4a, 0x9b }; | ||
347 | |||
348 | struct lgdt330x_state* state = fe->demodulator_priv; | ||
202 | 349 | ||
203 | /* Use 50MHz parameter values from spec sheet since xtal is 50 */ | ||
204 | static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 }; | 350 | static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 }; |
205 | static u8 vsb_freq_cfg[] = { VSB_CARRIER_FREQ0, 0x00, 0x87, 0x8e, 0x01 }; | ||
206 | static u8 demux_ctrl_cfg[] = { DEMUX_CONTROL, 0xfb }; | ||
207 | static u8 agc_rf_cfg[] = { AGC_RF_BANDWIDTH0, 0x40, 0x93, 0x00 }; | ||
208 | static u8 agc_ctrl_cfg[] = { AGC_FUNC_CTRL2, 0xc6, 0x40 }; | ||
209 | static u8 agc_delay_cfg[] = { AGC_DELAY0, 0x07, 0x00, 0xfe }; | ||
210 | static u8 agc_loop_cfg[] = { AGC_LOOP_BANDWIDTH0, 0x08, 0x9a }; | ||
211 | 351 | ||
352 | int err; | ||
212 | /* Change only if we are actually changing the modulation */ | 353 | /* Change only if we are actually changing the modulation */ |
213 | if (state->current_modulation != param->u.vsb.modulation) { | 354 | if (state->current_modulation != param->u.vsb.modulation) { |
214 | switch(param->u.vsb.modulation) { | 355 | switch(param->u.vsb.modulation) { |
215 | case VSB_8: | 356 | case VSB_8: |
216 | dprintk("%s: VSB_8 MODE\n", __FUNCTION__); | 357 | dprintk("%s: VSB_8 MODE\n", __FUNCTION__); |
217 | 358 | ||
218 | /* Select VSB mode and serial MPEG interface */ | 359 | /* Select VSB mode */ |
219 | top_ctrl_cfg[1] = 0x07; | 360 | top_ctrl_cfg[1] = 0x03; |
220 | 361 | ||
221 | /* Select ANT connector if supported by card */ | 362 | /* Select ANT connector if supported by card */ |
222 | if (state->config->pll_rf_set) | 363 | if (state->config->pll_rf_set) |
223 | state->config->pll_rf_set(fe, 1); | 364 | state->config->pll_rf_set(fe, 1); |
365 | |||
366 | if (state->config->demod_chip == LGDT3303) { | ||
367 | err = i2c_write_demod_bytes(state, lgdt3303_8vsb_44_data, | ||
368 | sizeof(lgdt3303_8vsb_44_data)); | ||
369 | } | ||
224 | break; | 370 | break; |
225 | 371 | ||
226 | case QAM_64: | 372 | case QAM_64: |
227 | dprintk("%s: QAM_64 MODE\n", __FUNCTION__); | 373 | dprintk("%s: QAM_64 MODE\n", __FUNCTION__); |
228 | 374 | ||
229 | /* Select QAM_64 mode and serial MPEG interface */ | 375 | /* Select QAM_64 mode */ |
230 | top_ctrl_cfg[1] = 0x04; | 376 | top_ctrl_cfg[1] = 0x00; |
231 | 377 | ||
232 | /* Select CABLE connector if supported by card */ | 378 | /* Select CABLE connector if supported by card */ |
233 | if (state->config->pll_rf_set) | 379 | if (state->config->pll_rf_set) |
234 | state->config->pll_rf_set(fe, 0); | 380 | state->config->pll_rf_set(fe, 0); |
381 | |||
382 | if (state->config->demod_chip == LGDT3303) { | ||
383 | err = i2c_write_demod_bytes(state, lgdt3303_qam_data, | ||
384 | sizeof(lgdt3303_qam_data)); | ||
385 | } | ||
235 | break; | 386 | break; |
236 | 387 | ||
237 | case QAM_256: | 388 | case QAM_256: |
238 | dprintk("%s: QAM_256 MODE\n", __FUNCTION__); | 389 | dprintk("%s: QAM_256 MODE\n", __FUNCTION__); |
239 | 390 | ||
240 | /* Select QAM_256 mode and serial MPEG interface */ | 391 | /* Select QAM_256 mode */ |
241 | top_ctrl_cfg[1] = 0x05; | 392 | top_ctrl_cfg[1] = 0x01; |
242 | 393 | ||
243 | /* Select CABLE connector if supported by card */ | 394 | /* Select CABLE connector if supported by card */ |
244 | if (state->config->pll_rf_set) | 395 | if (state->config->pll_rf_set) |
245 | state->config->pll_rf_set(fe, 0); | 396 | state->config->pll_rf_set(fe, 0); |
397 | |||
398 | if (state->config->demod_chip == LGDT3303) { | ||
399 | err = i2c_write_demod_bytes(state, lgdt3303_qam_data, | ||
400 | sizeof(lgdt3303_qam_data)); | ||
401 | } | ||
246 | break; | 402 | break; |
247 | default: | 403 | default: |
248 | printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation); | 404 | printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation); |
249 | return -1; | 405 | return -1; |
250 | } | 406 | } |
251 | /* Initializations common to all modes */ | 407 | /* |
408 | * select serial or parallel MPEG harware interface | ||
409 | * Serial: 0x04 for LGDT3302 or 0x40 for LGDT3303 | ||
410 | * Parallel: 0x00 | ||
411 | */ | ||
412 | top_ctrl_cfg[1] |= state->config->serial_mpeg; | ||
252 | 413 | ||
253 | /* Select the requested mode */ | 414 | /* Select the requested mode */ |
254 | i2c_writebytes(state, state->config->demod_address, | 415 | i2c_write_demod_bytes(state, top_ctrl_cfg, |
255 | top_ctrl_cfg, sizeof(top_ctrl_cfg)); | 416 | sizeof(top_ctrl_cfg)); |
256 | |||
257 | /* Change the value of IFBW[11:0] | ||
258 | of AGC IF/RF loop filter bandwidth register */ | ||
259 | i2c_writebytes(state, state->config->demod_address, | ||
260 | agc_rf_cfg, sizeof(agc_rf_cfg)); | ||
261 | |||
262 | /* Change the value of bit 6, 'nINAGCBY' and | ||
263 | 'NSSEL[1:0] of ACG function control register 2 */ | ||
264 | /* Change the value of bit 6 'RFFIX' | ||
265 | of AGC function control register 3 */ | ||
266 | i2c_writebytes(state, state->config->demod_address, | ||
267 | agc_ctrl_cfg, sizeof(agc_ctrl_cfg)); | ||
268 | |||
269 | /* Change the TPCLK pin polarity | ||
270 | data is valid on falling clock */ | ||
271 | i2c_writebytes(state, state->config->demod_address, | ||
272 | demux_ctrl_cfg, sizeof(demux_ctrl_cfg)); | ||
273 | |||
274 | /* Change the value of NCOCTFV[25:0] of carrier | ||
275 | recovery center frequency register */ | ||
276 | i2c_writebytes(state, state->config->demod_address, | ||
277 | vsb_freq_cfg, sizeof(vsb_freq_cfg)); | ||
278 | |||
279 | /* Set the value of 'INLVTHD' register 0x2a/0x2c to 0x7fe */ | ||
280 | i2c_writebytes(state, state->config->demod_address, | ||
281 | agc_delay_cfg, sizeof(agc_delay_cfg)); | ||
282 | |||
283 | /* Change the value of IAGCBW[15:8] | ||
284 | of inner AGC loop filter bandwith */ | ||
285 | i2c_writebytes(state, state->config->demod_address, | ||
286 | agc_loop_cfg, sizeof(agc_loop_cfg)); | ||
287 | |||
288 | state->config->set_ts_params(fe, 0); | 417 | state->config->set_ts_params(fe, 0); |
289 | state->current_modulation = param->u.vsb.modulation; | 418 | state->current_modulation = param->u.vsb.modulation; |
290 | } | 419 | } |
291 | 420 | ||
292 | /* Change only if we are actually changing the channel */ | 421 | /* Change only if we are actually changing the channel */ |
293 | if (state->current_frequency != param->frequency) { | 422 | if (state->current_frequency != param->frequency) { |
294 | u8 buf[5]; | 423 | /* Tune to the new frequency */ |
295 | struct i2c_msg msg = { .flags = 0, .buf = &buf[1], .len = 4 }; | 424 | state->config->pll_set(fe, param); |
296 | int err; | 425 | /* Keep track of the new frequency */ |
297 | |||
298 | state->config->pll_set(fe, param, buf); | ||
299 | msg.addr = buf[0]; | ||
300 | |||
301 | dprintk("%s: tuner at 0x%02x bytes: 0x%02x 0x%02x " | ||
302 | "0x%02x 0x%02x\n", __FUNCTION__, | ||
303 | buf[0],buf[1],buf[2],buf[3],buf[4]); | ||
304 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | ||
305 | printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, buf[0], buf[1], err); | ||
306 | if (err < 0) | ||
307 | return err; | ||
308 | else | ||
309 | return -EREMOTEIO; | ||
310 | } | ||
311 | #if 0 | ||
312 | /* Check the status of the tuner pll */ | ||
313 | i2c_readbytes(state, buf[0], &buf[1], 1); | ||
314 | dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[1]); | ||
315 | #endif | ||
316 | /* Update current frequency */ | ||
317 | state->current_frequency = param->frequency; | 426 | state->current_frequency = param->frequency; |
318 | } | 427 | } |
319 | lgdt330x_SwReset(state); | 428 | lgdt330x_SwReset(state); |
@@ -328,21 +437,15 @@ static int lgdt330x_get_frontend(struct dvb_frontend* fe, | |||
328 | return 0; | 437 | return 0; |
329 | } | 438 | } |
330 | 439 | ||
331 | static int lgdt330x_read_status(struct dvb_frontend* fe, fe_status_t* status) | 440 | static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status) |
332 | { | 441 | { |
333 | struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; | 442 | struct lgdt330x_state* state = fe->demodulator_priv; |
334 | u8 buf[3]; | 443 | u8 buf[3]; |
335 | 444 | ||
336 | *status = 0; /* Reset status result */ | 445 | *status = 0; /* Reset status result */ |
337 | 446 | ||
338 | /* | ||
339 | * You must set the Mask bits to 1 in the IRQ_MASK in order | ||
340 | * to see that status bit in the IRQ_STATUS register. | ||
341 | * This is done in SwReset(); | ||
342 | */ | ||
343 | |||
344 | /* AGC status register */ | 447 | /* AGC status register */ |
345 | i2c_selectreadbytes(state, AGC_STATUS, buf, 1); | 448 | i2c_read_demod_bytes(state, AGC_STATUS, buf, 1); |
346 | dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]); | 449 | dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]); |
347 | if ((buf[0] & 0x0c) == 0x8){ | 450 | if ((buf[0] & 0x0c) == 0x8){ |
348 | /* Test signal does not exist flag */ | 451 | /* Test signal does not exist flag */ |
@@ -353,16 +456,15 @@ static int lgdt330x_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
353 | return 0; | 456 | return 0; |
354 | } | 457 | } |
355 | 458 | ||
459 | /* | ||
460 | * You must set the Mask bits to 1 in the IRQ_MASK in order | ||
461 | * to see that status bit in the IRQ_STATUS register. | ||
462 | * This is done in SwReset(); | ||
463 | */ | ||
356 | /* signal status */ | 464 | /* signal status */ |
357 | i2c_selectreadbytes(state, TOP_CONTROL, buf, sizeof(buf)); | 465 | i2c_read_demod_bytes(state, TOP_CONTROL, buf, sizeof(buf)); |
358 | dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]); | 466 | dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]); |
359 | 467 | ||
360 | #if 0 | ||
361 | /* Alternative method to check for a signal */ | ||
362 | /* using the SNR good/bad interrupts. */ | ||
363 | if ((buf[2] & 0x30) == 0x10) | ||
364 | *status |= FE_HAS_SIGNAL; | ||
365 | #endif | ||
366 | 468 | ||
367 | /* sync status */ | 469 | /* sync status */ |
368 | if ((buf[2] & 0x03) == 0x01) { | 470 | if ((buf[2] & 0x03) == 0x01) { |
@@ -376,7 +478,7 @@ static int lgdt330x_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
376 | } | 478 | } |
377 | 479 | ||
378 | /* Carrier Recovery Lock Status Register */ | 480 | /* Carrier Recovery Lock Status Register */ |
379 | i2c_selectreadbytes(state, CARRIER_LOCK, buf, 1); | 481 | i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1); |
380 | dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]); | 482 | dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]); |
381 | switch (state->current_modulation) { | 483 | switch (state->current_modulation) { |
382 | case QAM_256: | 484 | case QAM_256: |
@@ -396,13 +498,75 @@ static int lgdt330x_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
396 | return 0; | 498 | return 0; |
397 | } | 499 | } |
398 | 500 | ||
501 | static int lgdt3303_read_status(struct dvb_frontend* fe, fe_status_t* status) | ||
502 | { | ||
503 | struct lgdt330x_state* state = fe->demodulator_priv; | ||
504 | int err; | ||
505 | u8 buf[3]; | ||
506 | |||
507 | *status = 0; /* Reset status result */ | ||
508 | |||
509 | /* lgdt3303 AGC status register */ | ||
510 | err = i2c_read_demod_bytes(state, 0x58, buf, 1); | ||
511 | if (err < 0) | ||
512 | return err; | ||
513 | |||
514 | dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]); | ||
515 | if ((buf[0] & 0x21) == 0x01){ | ||
516 | /* Test input signal does not exist flag */ | ||
517 | /* as well as the AGC lock flag. */ | ||
518 | *status |= FE_HAS_SIGNAL; | ||
519 | } else { | ||
520 | /* Without a signal all other status bits are meaningless */ | ||
521 | return 0; | ||
522 | } | ||
523 | |||
524 | /* Carrier Recovery Lock Status Register */ | ||
525 | i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1); | ||
526 | dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]); | ||
527 | switch (state->current_modulation) { | ||
528 | case QAM_256: | ||
529 | case QAM_64: | ||
530 | /* Need to undestand why there are 3 lock levels here */ | ||
531 | if ((buf[0] & 0x07) == 0x07) | ||
532 | *status |= FE_HAS_CARRIER; | ||
533 | else | ||
534 | break; | ||
535 | i2c_read_demod_bytes(state, 0x8a, buf, 1); | ||
536 | if ((buf[0] & 0x04) == 0x04) | ||
537 | *status |= FE_HAS_SYNC; | ||
538 | if ((buf[0] & 0x01) == 0x01) | ||
539 | *status |= FE_HAS_LOCK; | ||
540 | if ((buf[0] & 0x08) == 0x08) | ||
541 | *status |= FE_HAS_VITERBI; | ||
542 | break; | ||
543 | case VSB_8: | ||
544 | if ((buf[0] & 0x80) == 0x80) | ||
545 | *status |= FE_HAS_CARRIER; | ||
546 | else | ||
547 | break; | ||
548 | i2c_read_demod_bytes(state, 0x38, buf, 1); | ||
549 | if ((buf[0] & 0x02) == 0x00) | ||
550 | *status |= FE_HAS_SYNC; | ||
551 | if ((buf[0] & 0x01) == 0x01) { | ||
552 | *status |= FE_HAS_LOCK; | ||
553 | *status |= FE_HAS_VITERBI; | ||
554 | } | ||
555 | break; | ||
556 | default: | ||
557 | printk("KERN_WARNING lgdt330x: %s: Modulation set to unsupported value\n", __FUNCTION__); | ||
558 | } | ||
559 | return 0; | ||
560 | } | ||
561 | |||
399 | static int lgdt330x_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 562 | static int lgdt330x_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
400 | { | 563 | { |
401 | /* not directly available. */ | 564 | /* not directly available. */ |
565 | *strength = 0; | ||
402 | return 0; | 566 | return 0; |
403 | } | 567 | } |
404 | 568 | ||
405 | static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr) | 569 | static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr) |
406 | { | 570 | { |
407 | #ifdef SNR_IN_DB | 571 | #ifdef SNR_IN_DB |
408 | /* | 572 | /* |
@@ -451,7 +615,7 @@ static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr) | |||
451 | 91, 115, 144, 182, 229, 288, 362, 456, 574, 722, | 615 | 91, 115, 144, 182, 229, 288, 362, 456, 574, 722, |
452 | 909, 1144, 1440, 1813, 2282, 2873, 3617, 4553, 5732, 7216, | 616 | 909, 1144, 1440, 1813, 2282, 2873, 3617, 4553, 5732, 7216, |
453 | 9084, 11436, 14396, 18124, 22817, 28724, 36161, 45524, 57312, 72151, | 617 | 9084, 11436, 14396, 18124, 22817, 28724, 36161, 45524, 57312, 72151, |
454 | 90833, 114351, 143960, 181235, 228161, 0x040000 | 618 | 90833, 114351, 143960, 181235, 228161, 0x080000 |
455 | }; | 619 | }; |
456 | 620 | ||
457 | static u8 buf[5];/* read data buffer */ | 621 | static u8 buf[5];/* read data buffer */ |
@@ -459,8 +623,8 @@ static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr) | |||
459 | static u32 snr_db; /* index into SNR_EQ[] */ | 623 | static u32 snr_db; /* index into SNR_EQ[] */ |
460 | struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; | 624 | struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; |
461 | 625 | ||
462 | /* read both equalizer and pase tracker noise data */ | 626 | /* read both equalizer and phase tracker noise data */ |
463 | i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf)); | 627 | i2c_read_demod_bytes(state, EQPH_ERR0, buf, sizeof(buf)); |
464 | 628 | ||
465 | if (state->current_modulation == VSB_8) { | 629 | if (state->current_modulation == VSB_8) { |
466 | /* Equalizer Mean-Square Error Register for VSB */ | 630 | /* Equalizer Mean-Square Error Register for VSB */ |
@@ -496,19 +660,20 @@ static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr) | |||
496 | struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; | 660 | struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; |
497 | 661 | ||
498 | /* read both equalizer and pase tracker noise data */ | 662 | /* read both equalizer and pase tracker noise data */ |
499 | i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf)); | 663 | i2c_read_demod_bytes(state, EQPH_ERR0, buf, sizeof(buf)); |
500 | 664 | ||
501 | if (state->current_modulation == VSB_8) { | 665 | if (state->current_modulation == VSB_8) { |
502 | /* Equalizer Mean-Square Error Register for VSB */ | 666 | /* Phase Tracker Mean-Square Error Register for VSB */ |
503 | noise = ((buf[0] & 7) << 16) | (buf[1] << 8) | buf[2]; | ||
504 | } else { | ||
505 | /* Phase Tracker Mean-Square Error Register for QAM */ | ||
506 | noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4]; | 667 | noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4]; |
668 | } else { | ||
669 | |||
670 | /* Carrier Recovery Mean-Square Error for QAM */ | ||
671 | i2c_read_demod_bytes(state, 0x1a, buf, 2); | ||
672 | noise = ((buf[0] & 3) << 8) | buf[1]; | ||
507 | } | 673 | } |
508 | 674 | ||
509 | /* Small values for noise mean signal is better so invert noise */ | 675 | /* Small values for noise mean signal is better so invert noise */ |
510 | /* Noise is 19 bit value so discard 3 LSB*/ | 676 | *snr = ~noise; |
511 | *snr = ~noise>>3; | ||
512 | #endif | 677 | #endif |
513 | 678 | ||
514 | dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr); | 679 | dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr); |
@@ -516,6 +681,32 @@ static int lgdt330x_read_snr(struct dvb_frontend* fe, u16* snr) | |||
516 | return 0; | 681 | return 0; |
517 | } | 682 | } |
518 | 683 | ||
684 | static int lgdt3303_read_snr(struct dvb_frontend* fe, u16* snr) | ||
685 | { | ||
686 | /* Return the raw noise value */ | ||
687 | static u8 buf[5];/* read data buffer */ | ||
688 | static u32 noise; /* noise value */ | ||
689 | struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; | ||
690 | |||
691 | if (state->current_modulation == VSB_8) { | ||
692 | |||
693 | /* Phase Tracker Mean-Square Error Register for VSB */ | ||
694 | noise = ((buf[0] & 7) << 16) | (buf[3] << 8) | buf[4]; | ||
695 | } else { | ||
696 | |||
697 | /* Carrier Recovery Mean-Square Error for QAM */ | ||
698 | i2c_read_demod_bytes(state, 0x1a, buf, 2); | ||
699 | noise = (buf[0] << 8) | buf[1]; | ||
700 | } | ||
701 | |||
702 | /* Small values for noise mean signal is better so invert noise */ | ||
703 | *snr = ~noise; | ||
704 | |||
705 | dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr); | ||
706 | |||
707 | return 0; | ||
708 | } | ||
709 | |||
519 | static int lgdt330x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings) | 710 | static int lgdt330x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings) |
520 | { | 711 | { |
521 | /* I have no idea about this - it may not be needed */ | 712 | /* I have no idea about this - it may not be needed */ |
@@ -531,7 +722,8 @@ static void lgdt330x_release(struct dvb_frontend* fe) | |||
531 | kfree(state); | 722 | kfree(state); |
532 | } | 723 | } |
533 | 724 | ||
534 | static struct dvb_frontend_ops lgdt330x_ops; | 725 | static struct dvb_frontend_ops lgdt3302_ops; |
726 | static struct dvb_frontend_ops lgdt3303_ops; | ||
535 | 727 | ||
536 | struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, | 728 | struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, |
537 | struct i2c_adapter* i2c) | 729 | struct i2c_adapter* i2c) |
@@ -548,9 +740,19 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, | |||
548 | /* Setup the state */ | 740 | /* Setup the state */ |
549 | state->config = config; | 741 | state->config = config; |
550 | state->i2c = i2c; | 742 | state->i2c = i2c; |
551 | memcpy(&state->ops, &lgdt330x_ops, sizeof(struct dvb_frontend_ops)); | 743 | switch (config->demod_chip) { |
744 | case LGDT3302: | ||
745 | memcpy(&state->ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops)); | ||
746 | break; | ||
747 | case LGDT3303: | ||
748 | memcpy(&state->ops, &lgdt3303_ops, sizeof(struct dvb_frontend_ops)); | ||
749 | break; | ||
750 | default: | ||
751 | goto error; | ||
752 | } | ||
753 | |||
552 | /* Verify communication with demod chip */ | 754 | /* Verify communication with demod chip */ |
553 | if (i2c_selectreadbytes(state, 2, buf, 1)) | 755 | if (i2c_read_demod_bytes(state, 2, buf, 1)) |
554 | goto error; | 756 | goto error; |
555 | 757 | ||
556 | state->current_frequency = -1; | 758 | state->current_frequency = -1; |
@@ -568,9 +770,33 @@ error: | |||
568 | return NULL; | 770 | return NULL; |
569 | } | 771 | } |
570 | 772 | ||
571 | static struct dvb_frontend_ops lgdt330x_ops = { | 773 | static struct dvb_frontend_ops lgdt3302_ops = { |
774 | .info = { | ||
775 | .name= "LG Electronics LGDT3302/LGDT3303 VSB/QAM Frontend", | ||
776 | .type = FE_ATSC, | ||
777 | .frequency_min= 54000000, | ||
778 | .frequency_max= 858000000, | ||
779 | .frequency_stepsize= 62500, | ||
780 | /* Symbol rate is for all VSB modes need to check QAM */ | ||
781 | .symbol_rate_min = 10762000, | ||
782 | .symbol_rate_max = 10762000, | ||
783 | .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB | ||
784 | }, | ||
785 | .init = lgdt330x_init, | ||
786 | .set_frontend = lgdt330x_set_parameters, | ||
787 | .get_frontend = lgdt330x_get_frontend, | ||
788 | .get_tune_settings = lgdt330x_get_tune_settings, | ||
789 | .read_status = lgdt3302_read_status, | ||
790 | .read_ber = lgdt330x_read_ber, | ||
791 | .read_signal_strength = lgdt330x_read_signal_strength, | ||
792 | .read_snr = lgdt3302_read_snr, | ||
793 | .read_ucblocks = lgdt330x_read_ucblocks, | ||
794 | .release = lgdt330x_release, | ||
795 | }; | ||
796 | |||
797 | static struct dvb_frontend_ops lgdt3303_ops = { | ||
572 | .info = { | 798 | .info = { |
573 | .name= "LG Electronics lgdt330x VSB/QAM Frontend", | 799 | .name= "LG Electronics LGDT3303 VSB/QAM Frontend", |
574 | .type = FE_ATSC, | 800 | .type = FE_ATSC, |
575 | .frequency_min= 54000000, | 801 | .frequency_min= 54000000, |
576 | .frequency_max= 858000000, | 802 | .frequency_max= 858000000, |
@@ -584,15 +810,15 @@ static struct dvb_frontend_ops lgdt330x_ops = { | |||
584 | .set_frontend = lgdt330x_set_parameters, | 810 | .set_frontend = lgdt330x_set_parameters, |
585 | .get_frontend = lgdt330x_get_frontend, | 811 | .get_frontend = lgdt330x_get_frontend, |
586 | .get_tune_settings = lgdt330x_get_tune_settings, | 812 | .get_tune_settings = lgdt330x_get_tune_settings, |
587 | .read_status = lgdt330x_read_status, | 813 | .read_status = lgdt3303_read_status, |
588 | .read_ber = lgdt330x_read_ber, | 814 | .read_ber = lgdt330x_read_ber, |
589 | .read_signal_strength = lgdt330x_read_signal_strength, | 815 | .read_signal_strength = lgdt330x_read_signal_strength, |
590 | .read_snr = lgdt330x_read_snr, | 816 | .read_snr = lgdt3303_read_snr, |
591 | .read_ucblocks = lgdt330x_read_ucblocks, | 817 | .read_ucblocks = lgdt330x_read_ucblocks, |
592 | .release = lgdt330x_release, | 818 | .release = lgdt330x_release, |
593 | }; | 819 | }; |
594 | 820 | ||
595 | MODULE_DESCRIPTION("lgdt330x [DViCO FusionHDTV 3 Gold] (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver"); | 821 | MODULE_DESCRIPTION("LGDT330X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver"); |
596 | MODULE_AUTHOR("Wilson Michaels"); | 822 | MODULE_AUTHOR("Wilson Michaels"); |
597 | MODULE_LICENSE("GPL"); | 823 | MODULE_LICENSE("GPL"); |
598 | 824 | ||
@@ -601,6 +827,5 @@ EXPORT_SYMBOL(lgdt330x_attach); | |||
601 | /* | 827 | /* |
602 | * Local variables: | 828 | * Local variables: |
603 | * c-basic-offset: 8 | 829 | * c-basic-offset: 8 |
604 | * compile-command: "make DVB=1" | ||
605 | * End: | 830 | * End: |
606 | */ | 831 | */ |
diff --git a/drivers/media/dvb/frontends/lgdt330x.h b/drivers/media/dvb/frontends/lgdt330x.h index 04986f8e7565..e209ba1e47c5 100644 --- a/drivers/media/dvb/frontends/lgdt330x.h +++ b/drivers/media/dvb/frontends/lgdt330x.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Support for LGDT3302 & LGDT3303 (DViCO FustionHDTV Gold) - VSB/QAM | 2 | * Support for LGDT3302 and LGDT3303 - VSB/QAM |
3 | * | 3 | * |
4 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> | 4 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> |
5 | * | 5 | * |
@@ -24,14 +24,26 @@ | |||
24 | 24 | ||
25 | #include <linux/dvb/frontend.h> | 25 | #include <linux/dvb/frontend.h> |
26 | 26 | ||
27 | typedef enum lg_chip_t { | ||
28 | UNDEFINED, | ||
29 | LGDT3302, | ||
30 | LGDT3303 | ||
31 | }lg_chip_type; | ||
32 | |||
27 | struct lgdt330x_config | 33 | struct lgdt330x_config |
28 | { | 34 | { |
29 | /* The demodulator's i2c address */ | 35 | /* The demodulator's i2c address */ |
30 | u8 demod_address; | 36 | u8 demod_address; |
31 | 37 | ||
38 | /* LG demodulator chip LGDT3302 or LGDT3303 */ | ||
39 | lg_chip_type demod_chip; | ||
40 | |||
41 | /* MPEG hardware interface - 0:parallel 1:serial */ | ||
42 | int serial_mpeg; | ||
43 | |||
32 | /* PLL interface */ | 44 | /* PLL interface */ |
33 | int (*pll_rf_set) (struct dvb_frontend* fe, int index); | 45 | int (*pll_rf_set) (struct dvb_frontend* fe, int index); |
34 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pll_address); | 46 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); |
35 | 47 | ||
36 | /* Need to set device param for start_dma */ | 48 | /* Need to set device param for start_dma */ |
37 | int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); | 49 | int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); |
diff --git a/drivers/media/dvb/frontends/lgdt330x_priv.h b/drivers/media/dvb/frontends/lgdt330x_priv.h index 4143ce8f1a95..59b7c5b9012d 100644 --- a/drivers/media/dvb/frontends/lgdt330x_priv.h +++ b/drivers/media/dvb/frontends/lgdt330x_priv.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Support for LGDT3302 & LGDT3303 (DViCO FustionHDTV Gold) - VSB/QAM | 2 | * Support for LGDT3302 and LGDT3303 - VSB/QAM |
3 | * | 3 | * |
4 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> | 4 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> |
5 | * | 5 | * |
@@ -57,8 +57,10 @@ enum I2C_REG { | |||
57 | PH_ERR1= 0x4a, | 57 | PH_ERR1= 0x4a, |
58 | PH_ERR2= 0x4b, | 58 | PH_ERR2= 0x4b, |
59 | DEMUX_CONTROL= 0x66, | 59 | DEMUX_CONTROL= 0x66, |
60 | PACKET_ERR_COUNTER1= 0x6a, | 60 | LGDT3302_PACKET_ERR_COUNTER1= 0x6a, |
61 | PACKET_ERR_COUNTER2= 0x6b, | 61 | LGDT3302_PACKET_ERR_COUNTER2= 0x6b, |
62 | LGDT3303_PACKET_ERR_COUNTER1= 0x8b, | ||
63 | LGDT3303_PACKET_ERR_COUNTER2= 0x8c, | ||
62 | }; | 64 | }; |
63 | 65 | ||
64 | #endif /* _LGDT330X_PRIV_ */ | 66 | #endif /* _LGDT330X_PRIV_ */ |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index ef0e9a85c359..78d223257a68 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-dvb.c,v 1.54 2005/07/25 05:13:50 mkrufky Exp $ | 2 | * $Id: cx88-dvb.c,v 1.58 2005/08/07 09:24:08 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * MPEG Transport Stream (DVB) routines | 5 | * MPEG Transport Stream (DVB) routines |
@@ -208,14 +208,26 @@ static struct or51132_config pchdtv_hd3000 = { | |||
208 | 208 | ||
209 | #ifdef HAVE_LGDT330X | 209 | #ifdef HAVE_LGDT330X |
210 | static int lgdt330x_pll_set(struct dvb_frontend* fe, | 210 | static int lgdt330x_pll_set(struct dvb_frontend* fe, |
211 | struct dvb_frontend_parameters* params, | 211 | struct dvb_frontend_parameters* params) |
212 | u8* pllbuf) | ||
213 | { | 212 | { |
214 | struct cx8802_dev *dev= fe->dvb->priv; | 213 | struct cx8802_dev *dev= fe->dvb->priv; |
214 | u8 buf[4]; | ||
215 | struct i2c_msg msg = | ||
216 | { .addr = dev->core->pll_addr, .flags = 0, .buf = buf, .len = 4 }; | ||
217 | int err; | ||
215 | 218 | ||
216 | pllbuf[0] = dev->core->pll_addr; | 219 | dvb_pll_configure(dev->core->pll_desc, buf, params->frequency, 0); |
217 | dvb_pll_configure(dev->core->pll_desc, &pllbuf[1], | 220 | dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n", |
218 | params->frequency, 0); | 221 | __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); |
222 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { | ||
223 | printk(KERN_WARNING "cx88-dvb: %s error " | ||
224 | "(addr %02x <- %02x, err = %i)\n", | ||
225 | __FUNCTION__, buf[0], buf[1], err); | ||
226 | if (err < 0) | ||
227 | return err; | ||
228 | else | ||
229 | return -EREMOTEIO; | ||
230 | } | ||
219 | return 0; | 231 | return 0; |
220 | } | 232 | } |
221 | 233 | ||
@@ -244,6 +256,8 @@ static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured) | |||
244 | 256 | ||
245 | static struct lgdt330x_config fusionhdtv_3_gold = { | 257 | static struct lgdt330x_config fusionhdtv_3_gold = { |
246 | .demod_address = 0x0e, | 258 | .demod_address = 0x0e, |
259 | .demod_chip = LGDT3302, | ||
260 | .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */ | ||
247 | .pll_set = lgdt330x_pll_set, | 261 | .pll_set = lgdt330x_pll_set, |
248 | .set_ts_params = lgdt330x_set_ts_param, | 262 | .set_ts_params = lgdt330x_set_ts_param, |
249 | }; | 263 | }; |
diff --git a/drivers/message/i2o/Kconfig b/drivers/message/i2o/Kconfig index 06e8eb19a05c..43a942a29c2e 100644 --- a/drivers/message/i2o/Kconfig +++ b/drivers/message/i2o/Kconfig | |||
@@ -53,6 +53,9 @@ config I2O_CONFIG | |||
53 | To compile this support as a module, choose M here: the | 53 | To compile this support as a module, choose M here: the |
54 | module will be called i2o_config. | 54 | module will be called i2o_config. |
55 | 55 | ||
56 | Note: If you want to use the new API you have to download the | ||
57 | i2o_config patch from http://i2o.shadowconnect.com/ | ||
58 | |||
56 | config I2O_CONFIG_OLD_IOCTL | 59 | config I2O_CONFIG_OLD_IOCTL |
57 | bool "Enable ioctls (OBSOLETE)" | 60 | bool "Enable ioctls (OBSOLETE)" |
58 | depends on I2O_CONFIG | 61 | depends on I2O_CONFIG |
diff --git a/drivers/message/i2o/config-osm.c b/drivers/message/i2o/config-osm.c index fe2e7afc9eae..af32ab4e90cd 100644 --- a/drivers/message/i2o/config-osm.c +++ b/drivers/message/i2o/config-osm.c | |||
@@ -30,503 +30,9 @@ | |||
30 | 30 | ||
31 | static struct i2o_driver i2o_config_driver; | 31 | static struct i2o_driver i2o_config_driver; |
32 | 32 | ||
33 | /* Special file operations for sysfs */ | ||
34 | struct fops_attribute { | ||
35 | struct bin_attribute bin; | ||
36 | struct file_operations fops; | ||
37 | }; | ||
38 | |||
39 | /** | ||
40 | * sysfs_read_dummy | ||
41 | */ | ||
42 | static ssize_t sysfs_read_dummy(struct kobject *kobj, char *buf, loff_t offset, | ||
43 | size_t count) | ||
44 | { | ||
45 | return 0; | ||
46 | }; | ||
47 | |||
48 | /** | ||
49 | * sysfs_write_dummy | ||
50 | */ | ||
51 | static ssize_t sysfs_write_dummy(struct kobject *kobj, char *buf, loff_t offset, | ||
52 | size_t count) | ||
53 | { | ||
54 | return 0; | ||
55 | }; | ||
56 | |||
57 | /** | ||
58 | * sysfs_create_fops_file - Creates attribute with special file operations | ||
59 | * @kobj: kobject which should contains the attribute | ||
60 | * @attr: attributes which should be used to create file | ||
61 | * | ||
62 | * First creates attribute @attr in kobject @kobj. If it is the first time | ||
63 | * this function is called, merge old fops from sysfs with new one and | ||
64 | * write it back. Afterwords the new fops will be set for the created | ||
65 | * attribute. | ||
66 | * | ||
67 | * Returns 0 on success or negative error code on failure. | ||
68 | */ | ||
69 | static int sysfs_create_fops_file(struct kobject *kobj, | ||
70 | struct fops_attribute *attr) | ||
71 | { | ||
72 | struct file_operations tmp, *fops; | ||
73 | struct dentry *d; | ||
74 | struct qstr qstr; | ||
75 | int rc; | ||
76 | |||
77 | fops = &attr->fops; | ||
78 | |||
79 | if (fops->read) | ||
80 | attr->bin.read = sysfs_read_dummy; | ||
81 | |||
82 | if (fops->write) | ||
83 | attr->bin.write = sysfs_write_dummy; | ||
84 | |||
85 | if ((rc = sysfs_create_bin_file(kobj, &attr->bin))) | ||
86 | return rc; | ||
87 | |||
88 | qstr.name = attr->bin.attr.name; | ||
89 | qstr.len = strlen(qstr.name); | ||
90 | qstr.hash = full_name_hash(qstr.name, qstr.len); | ||
91 | |||
92 | if ((d = lookup_hash(&qstr, kobj->dentry))) { | ||
93 | if (!fops->owner) { | ||
94 | memcpy(&tmp, d->d_inode->i_fop, sizeof(tmp)); | ||
95 | if (fops->read) | ||
96 | tmp.read = fops->read; | ||
97 | if (fops->write) | ||
98 | tmp.write = fops->write; | ||
99 | memcpy(fops, &tmp, sizeof(tmp)); | ||
100 | } | ||
101 | |||
102 | d->d_inode->i_fop = fops; | ||
103 | } else | ||
104 | sysfs_remove_bin_file(kobj, &attr->bin); | ||
105 | |||
106 | return -ENOENT; | ||
107 | }; | ||
108 | |||
109 | /** | ||
110 | * sysfs_remove_fops_file - Remove attribute with special file operations | ||
111 | * @kobj: kobject which contains the attribute | ||
112 | * @attr: attributes which are used to create file | ||
113 | * | ||
114 | * Only wrapper arround sysfs_remove_bin_file() | ||
115 | * | ||
116 | * Returns 0 on success or negative error code on failure. | ||
117 | */ | ||
118 | static inline int sysfs_remove_fops_file(struct kobject *kobj, | ||
119 | struct fops_attribute *attr) | ||
120 | { | ||
121 | return sysfs_remove_bin_file(kobj, &attr->bin); | ||
122 | }; | ||
123 | |||
124 | /** | ||
125 | * i2o_config_read_hrt - Returns the HRT of the controller | ||
126 | * @kob: kernel object handle | ||
127 | * @buf: buffer into which the HRT should be copied | ||
128 | * @off: file offset | ||
129 | * @count: number of bytes to read | ||
130 | * | ||
131 | * Put @count bytes starting at @off into @buf from the HRT of the I2O | ||
132 | * controller corresponding to @kobj. | ||
133 | * | ||
134 | * Returns number of bytes copied into buffer. | ||
135 | */ | ||
136 | static ssize_t i2o_config_read_hrt(struct kobject *kobj, char *buf, | ||
137 | loff_t offset, size_t count) | ||
138 | { | ||
139 | struct i2o_controller *c = kobj_to_i2o_device(kobj)->iop; | ||
140 | i2o_hrt *hrt = c->hrt.virt; | ||
141 | |||
142 | u32 size = (hrt->num_entries * hrt->entry_len + 2) * 4; | ||
143 | |||
144 | if (offset > size) | ||
145 | return 0; | ||
146 | |||
147 | if (offset + count > size) | ||
148 | count = size - offset; | ||
149 | |||
150 | memcpy(buf, (u8 *) hrt + offset, count); | ||
151 | |||
152 | return count; | ||
153 | }; | ||
154 | |||
155 | /** | ||
156 | * i2o_config_read_lct - Returns the LCT of the controller | ||
157 | * @kob: kernel object handle | ||
158 | * @buf: buffer into which the LCT should be copied | ||
159 | * @off: file offset | ||
160 | * @count: number of bytes to read | ||
161 | * | ||
162 | * Put @count bytes starting at @off into @buf from the LCT of the I2O | ||
163 | * controller corresponding to @kobj. | ||
164 | * | ||
165 | * Returns number of bytes copied into buffer. | ||
166 | */ | ||
167 | static ssize_t i2o_config_read_lct(struct kobject *kobj, char *buf, | ||
168 | loff_t offset, size_t count) | ||
169 | { | ||
170 | struct i2o_controller *c = kobj_to_i2o_device(kobj)->iop; | ||
171 | u32 size = c->lct->table_size * 4; | ||
172 | |||
173 | if (offset > size) | ||
174 | return 0; | ||
175 | |||
176 | if (offset + count > size) | ||
177 | count = size - offset; | ||
178 | |||
179 | memcpy(buf, (u8 *) c->lct + offset, count); | ||
180 | |||
181 | return count; | ||
182 | }; | ||
183 | |||
184 | #define I2O_CONFIG_SW_ATTR(_name,_mode,_type,_swid) \ | ||
185 | static ssize_t i2o_config_##_name##_read(struct file *file, char __user *buf, size_t count, loff_t * offset) { \ | ||
186 | return i2o_config_sw_read(file, buf, count, offset, _type, _swid); \ | ||
187 | };\ | ||
188 | \ | ||
189 | static ssize_t i2o_config_##_name##_write(struct file *file, const char __user *buf, size_t count, loff_t * offset) { \ | ||
190 | return i2o_config_sw_write(file, buf, count, offset, _type, _swid); \ | ||
191 | }; \ | ||
192 | \ | ||
193 | static struct fops_attribute i2o_config_attr_##_name = { \ | ||
194 | .bin = { .attr = { .name = __stringify(_name), .mode = _mode, \ | ||
195 | .owner = THIS_MODULE }, \ | ||
196 | .size = 0, }, \ | ||
197 | .fops = { .write = i2o_config_##_name##_write, \ | ||
198 | .read = i2o_config_##_name##_read} \ | ||
199 | }; | ||
200 | |||
201 | #ifdef CONFIG_I2O_EXT_ADAPTEC | ||
202 | |||
203 | /** | ||
204 | * i2o_config_dpt_reagion - Converts type and id to flash region | ||
205 | * @swtype: type of software module reading | ||
206 | * @swid: id of software which should be read | ||
207 | * | ||
208 | * Converts type and id from I2O spec to the matching region for DPT / | ||
209 | * Adaptec controllers. | ||
210 | * | ||
211 | * Returns region which match type and id or -1 on error. | ||
212 | */ | ||
213 | static u32 i2o_config_dpt_region(u8 swtype, u8 swid) | ||
214 | { | ||
215 | switch (swtype) { | ||
216 | case I2O_SOFTWARE_MODULE_IRTOS: | ||
217 | /* | ||
218 | * content: operation firmware | ||
219 | * region size: | ||
220 | * 0xbc000 for 2554, 3754, 2564, 3757 | ||
221 | * 0x170000 for 2865 | ||
222 | * 0x17c000 for 3966 | ||
223 | */ | ||
224 | if (!swid) | ||
225 | return 0; | ||
226 | |||
227 | break; | ||
228 | |||
229 | case I2O_SOFTWARE_MODULE_IOP_PRIVATE: | ||
230 | /* | ||
231 | * content: BIOS and SMOR | ||
232 | * BIOS size: first 0x8000 bytes | ||
233 | * region size: | ||
234 | * 0x40000 for 2554, 3754, 2564, 3757 | ||
235 | * 0x80000 for 2865, 3966 | ||
236 | */ | ||
237 | if (!swid) | ||
238 | return 1; | ||
239 | |||
240 | break; | ||
241 | |||
242 | case I2O_SOFTWARE_MODULE_IOP_CONFIG: | ||
243 | switch (swid) { | ||
244 | case 0: | ||
245 | /* | ||
246 | * content: NVRAM defaults | ||
247 | * region size: 0x2000 bytes | ||
248 | */ | ||
249 | return 2; | ||
250 | case 1: | ||
251 | /* | ||
252 | * content: serial number | ||
253 | * region size: 0x2000 bytes | ||
254 | */ | ||
255 | return 3; | ||
256 | } | ||
257 | break; | ||
258 | } | ||
259 | |||
260 | return -1; | ||
261 | }; | ||
262 | |||
263 | #endif | ||
264 | |||
265 | /** | ||
266 | * i2o_config_sw_read - Read a software module from controller | ||
267 | * @file: file pointer | ||
268 | * @buf: buffer into which the data should be copied | ||
269 | * @count: number of bytes to read | ||
270 | * @off: file offset | ||
271 | * @swtype: type of software module reading | ||
272 | * @swid: id of software which should be read | ||
273 | * | ||
274 | * Transfers @count bytes at offset @offset from IOP into buffer using | ||
275 | * type @swtype and id @swid as described in I2O spec. | ||
276 | * | ||
277 | * Returns number of bytes copied into buffer or error code on failure. | ||
278 | */ | ||
279 | static ssize_t i2o_config_sw_read(struct file *file, char __user * buf, | ||
280 | size_t count, loff_t * offset, u8 swtype, | ||
281 | u32 swid) | ||
282 | { | ||
283 | struct sysfs_dirent *sd = file->f_dentry->d_parent->d_fsdata; | ||
284 | struct kobject *kobj = sd->s_element; | ||
285 | struct i2o_controller *c = kobj_to_i2o_device(kobj)->iop; | ||
286 | u32 m, function = I2O_CMD_SW_UPLOAD; | ||
287 | struct i2o_dma buffer; | ||
288 | struct i2o_message __iomem *msg; | ||
289 | u32 __iomem *mptr; | ||
290 | int rc, status; | ||
291 | |||
292 | m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET); | ||
293 | if (m == I2O_QUEUE_EMPTY) | ||
294 | return -EBUSY; | ||
295 | |||
296 | mptr = &msg->body[3]; | ||
297 | |||
298 | if ((rc = i2o_dma_alloc(&c->pdev->dev, &buffer, count, GFP_KERNEL))) { | ||
299 | i2o_msg_nop(c, m); | ||
300 | return rc; | ||
301 | } | ||
302 | #ifdef CONFIG_I2O_EXT_ADAPTEC | ||
303 | if (c->adaptec) { | ||
304 | mptr = &msg->body[4]; | ||
305 | function = I2O_CMD_PRIVATE; | ||
306 | |||
307 | writel(TEN_WORD_MSG_SIZE | SGL_OFFSET_8, &msg->u.head[0]); | ||
308 | |||
309 | writel(I2O_VENDOR_DPT << 16 | I2O_DPT_FLASH_READ, | ||
310 | &msg->body[0]); | ||
311 | writel(i2o_config_dpt_region(swtype, swid), &msg->body[1]); | ||
312 | writel(*offset, &msg->body[2]); | ||
313 | writel(count, &msg->body[3]); | ||
314 | } else | ||
315 | #endif | ||
316 | writel(NINE_WORD_MSG_SIZE | SGL_OFFSET_7, &msg->u.head[0]); | ||
317 | |||
318 | writel(0xD0000000 | count, mptr++); | ||
319 | writel(buffer.phys, mptr); | ||
320 | |||
321 | writel(function << 24 | HOST_TID << 12 | ADAPTER_TID, &msg->u.head[1]); | ||
322 | writel(i2o_config_driver.context, &msg->u.head[2]); | ||
323 | writel(0, &msg->u.head[3]); | ||
324 | |||
325 | #ifdef CONFIG_I2O_EXT_ADAPTEC | ||
326 | if (!c->adaptec) | ||
327 | #endif | ||
328 | { | ||
329 | writel((u32) swtype << 16 | (u32) 1 << 8, &msg->body[0]); | ||
330 | writel(0, &msg->body[1]); | ||
331 | writel(swid, &msg->body[2]); | ||
332 | } | ||
333 | |||
334 | status = i2o_msg_post_wait_mem(c, m, 60, &buffer); | ||
335 | |||
336 | if (status == I2O_POST_WAIT_OK) { | ||
337 | if (!(rc = copy_to_user(buf, buffer.virt, count))) { | ||
338 | rc = count; | ||
339 | *offset += count; | ||
340 | } | ||
341 | } else | ||
342 | rc = -EIO; | ||
343 | |||
344 | if (status != -ETIMEDOUT) | ||
345 | i2o_dma_free(&c->pdev->dev, &buffer); | ||
346 | |||
347 | return rc; | ||
348 | }; | ||
349 | |||
350 | /** | ||
351 | * i2o_config_sw_write - Write a software module to controller | ||
352 | * @file: file pointer | ||
353 | * @buf: buffer into which the data should be copied | ||
354 | * @count: number of bytes to read | ||
355 | * @off: file offset | ||
356 | * @swtype: type of software module writing | ||
357 | * @swid: id of software which should be written | ||
358 | * | ||
359 | * Transfers @count bytes at offset @offset from buffer to IOP using | ||
360 | * type @swtype and id @swid as described in I2O spec. | ||
361 | * | ||
362 | * Returns number of bytes copied from buffer or error code on failure. | ||
363 | */ | ||
364 | static ssize_t i2o_config_sw_write(struct file *file, const char __user * buf, | ||
365 | size_t count, loff_t * offset, u8 swtype, | ||
366 | u32 swid) | ||
367 | { | ||
368 | struct sysfs_dirent *sd = file->f_dentry->d_parent->d_fsdata; | ||
369 | struct kobject *kobj = sd->s_element; | ||
370 | struct i2o_controller *c = kobj_to_i2o_device(kobj)->iop; | ||
371 | u32 m, function = I2O_CMD_SW_DOWNLOAD; | ||
372 | struct i2o_dma buffer; | ||
373 | struct i2o_message __iomem *msg; | ||
374 | u32 __iomem *mptr; | ||
375 | int rc, status; | ||
376 | |||
377 | m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET); | ||
378 | if (m == I2O_QUEUE_EMPTY) | ||
379 | return -EBUSY; | ||
380 | |||
381 | mptr = &msg->body[3]; | ||
382 | |||
383 | if ((rc = i2o_dma_alloc(&c->pdev->dev, &buffer, count, GFP_KERNEL))) | ||
384 | goto nop_msg; | ||
385 | |||
386 | if ((rc = copy_from_user(buffer.virt, buf, count))) | ||
387 | goto free_buffer; | ||
388 | |||
389 | #ifdef CONFIG_I2O_EXT_ADAPTEC | ||
390 | if (c->adaptec) { | ||
391 | mptr = &msg->body[4]; | ||
392 | function = I2O_CMD_PRIVATE; | ||
393 | |||
394 | writel(TEN_WORD_MSG_SIZE | SGL_OFFSET_8, &msg->u.head[0]); | ||
395 | |||
396 | writel(I2O_VENDOR_DPT << 16 | I2O_DPT_FLASH_WRITE, | ||
397 | &msg->body[0]); | ||
398 | writel(i2o_config_dpt_region(swtype, swid), &msg->body[1]); | ||
399 | writel(*offset, &msg->body[2]); | ||
400 | writel(count, &msg->body[3]); | ||
401 | } else | ||
402 | #endif | ||
403 | writel(NINE_WORD_MSG_SIZE | SGL_OFFSET_7, &msg->u.head[0]); | ||
404 | |||
405 | writel(0xD4000000 | count, mptr++); | ||
406 | writel(buffer.phys, mptr); | ||
407 | |||
408 | writel(function << 24 | HOST_TID << 12 | ADAPTER_TID, &msg->u.head[1]); | ||
409 | writel(i2o_config_driver.context, &msg->u.head[2]); | ||
410 | writel(0, &msg->u.head[3]); | ||
411 | |||
412 | #ifdef CONFIG_I2O_EXT_ADAPTEC | ||
413 | if (!c->adaptec) | ||
414 | #endif | ||
415 | { | ||
416 | writel((u32) swtype << 16 | (u32) 1 << 8, &msg->body[0]); | ||
417 | writel(0, &msg->body[1]); | ||
418 | writel(swid, &msg->body[2]); | ||
419 | } | ||
420 | |||
421 | status = i2o_msg_post_wait_mem(c, m, 60, &buffer); | ||
422 | |||
423 | if (status != -ETIMEDOUT) | ||
424 | i2o_dma_free(&c->pdev->dev, &buffer); | ||
425 | |||
426 | if (status != I2O_POST_WAIT_OK) | ||
427 | return -EIO; | ||
428 | |||
429 | *offset += count; | ||
430 | |||
431 | return count; | ||
432 | |||
433 | free_buffer: | ||
434 | i2o_dma_free(&c->pdev->dev, &buffer); | ||
435 | |||
436 | nop_msg: | ||
437 | i2o_msg_nop(c, m); | ||
438 | |||
439 | return rc; | ||
440 | }; | ||
441 | |||
442 | /* attribute for HRT in sysfs */ | ||
443 | static struct bin_attribute i2o_config_hrt_attr = { | ||
444 | .attr = { | ||
445 | .name = "hrt", | ||
446 | .mode = S_IRUGO, | ||
447 | .owner = THIS_MODULE}, | ||
448 | .size = 0, | ||
449 | .read = i2o_config_read_hrt | ||
450 | }; | ||
451 | |||
452 | /* attribute for LCT in sysfs */ | ||
453 | static struct bin_attribute i2o_config_lct_attr = { | ||
454 | .attr = { | ||
455 | .name = "lct", | ||
456 | .mode = S_IRUGO, | ||
457 | .owner = THIS_MODULE}, | ||
458 | .size = 0, | ||
459 | .read = i2o_config_read_lct | ||
460 | }; | ||
461 | |||
462 | /* IRTOS firmware access */ | ||
463 | I2O_CONFIG_SW_ATTR(irtos, S_IWRSR, I2O_SOFTWARE_MODULE_IRTOS, 0); | ||
464 | |||
465 | #ifdef CONFIG_I2O_EXT_ADAPTEC | ||
466 | |||
467 | /* | ||
468 | * attribute for BIOS / SMOR, nvram and serial number access on DPT / Adaptec | ||
469 | * controllers | ||
470 | */ | ||
471 | I2O_CONFIG_SW_ATTR(bios, S_IWRSR, I2O_SOFTWARE_MODULE_IOP_PRIVATE, 0); | ||
472 | I2O_CONFIG_SW_ATTR(nvram, S_IWRSR, I2O_SOFTWARE_MODULE_IOP_CONFIG, 0); | ||
473 | I2O_CONFIG_SW_ATTR(serial, S_IWRSR, I2O_SOFTWARE_MODULE_IOP_CONFIG, 1); | ||
474 | |||
475 | #endif | ||
476 | |||
477 | /** | ||
478 | * i2o_config_notify_controller_add - Notify of added controller | ||
479 | * @c: the controller which was added | ||
480 | * | ||
481 | * If a I2O controller is added, we catch the notification to add sysfs | ||
482 | * entries. | ||
483 | */ | ||
484 | static void i2o_config_notify_controller_add(struct i2o_controller *c) | ||
485 | { | ||
486 | struct kobject *kobj = &c->exec->device.kobj; | ||
487 | |||
488 | sysfs_create_bin_file(kobj, &i2o_config_hrt_attr); | ||
489 | sysfs_create_bin_file(kobj, &i2o_config_lct_attr); | ||
490 | |||
491 | sysfs_create_fops_file(kobj, &i2o_config_attr_irtos); | ||
492 | #ifdef CONFIG_I2O_EXT_ADAPTEC | ||
493 | if (c->adaptec) { | ||
494 | sysfs_create_fops_file(kobj, &i2o_config_attr_bios); | ||
495 | sysfs_create_fops_file(kobj, &i2o_config_attr_nvram); | ||
496 | sysfs_create_fops_file(kobj, &i2o_config_attr_serial); | ||
497 | } | ||
498 | #endif | ||
499 | }; | ||
500 | |||
501 | /** | ||
502 | * i2o_config_notify_controller_remove - Notify of removed controller | ||
503 | * @c: the controller which was removed | ||
504 | * | ||
505 | * If a I2O controller is removed, we catch the notification to remove the | ||
506 | * sysfs entries. | ||
507 | */ | ||
508 | static void i2o_config_notify_controller_remove(struct i2o_controller *c) | ||
509 | { | ||
510 | struct kobject *kobj = &c->exec->device.kobj; | ||
511 | |||
512 | #ifdef CONFIG_I2O_EXT_ADAPTEC | ||
513 | if (c->adaptec) { | ||
514 | sysfs_remove_fops_file(kobj, &i2o_config_attr_serial); | ||
515 | sysfs_remove_fops_file(kobj, &i2o_config_attr_nvram); | ||
516 | sysfs_remove_fops_file(kobj, &i2o_config_attr_bios); | ||
517 | } | ||
518 | #endif | ||
519 | sysfs_remove_fops_file(kobj, &i2o_config_attr_irtos); | ||
520 | |||
521 | sysfs_remove_bin_file(kobj, &i2o_config_lct_attr); | ||
522 | sysfs_remove_bin_file(kobj, &i2o_config_hrt_attr); | ||
523 | }; | ||
524 | |||
525 | /* Config OSM driver struct */ | 33 | /* Config OSM driver struct */ |
526 | static struct i2o_driver i2o_config_driver = { | 34 | static struct i2o_driver i2o_config_driver = { |
527 | .name = OSM_NAME, | 35 | .name = OSM_NAME, |
528 | .notify_controller_add = i2o_config_notify_controller_add, | ||
529 | .notify_controller_remove = i2o_config_notify_controller_remove | ||
530 | }; | 36 | }; |
531 | 37 | ||
532 | #ifdef CONFIG_I2O_CONFIG_OLD_IOCTL | 38 | #ifdef CONFIG_I2O_CONFIG_OLD_IOCTL |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 201a550f0bcc..368b8fb14023 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -66,8 +66,8 @@ | |||
66 | 66 | ||
67 | #define DRV_MODULE_NAME "tg3" | 67 | #define DRV_MODULE_NAME "tg3" |
68 | #define PFX DRV_MODULE_NAME ": " | 68 | #define PFX DRV_MODULE_NAME ": " |
69 | #define DRV_MODULE_VERSION "3.34" | 69 | #define DRV_MODULE_VERSION "3.35" |
70 | #define DRV_MODULE_RELDATE "July 25, 2005" | 70 | #define DRV_MODULE_RELDATE "August 6, 2005" |
71 | 71 | ||
72 | #define TG3_DEF_MAC_MODE 0 | 72 | #define TG3_DEF_MAC_MODE 0 |
73 | #define TG3_DEF_RX_MODE 0 | 73 | #define TG3_DEF_RX_MODE 0 |
@@ -10421,6 +10421,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
10421 | 10421 | ||
10422 | tg3_init_coal(tp); | 10422 | tg3_init_coal(tp); |
10423 | 10423 | ||
10424 | /* Now that we have fully setup the chip, save away a snapshot | ||
10425 | * of the PCI config space. We need to restore this after | ||
10426 | * GRC_MISC_CFG core clock resets and some resume events. | ||
10427 | */ | ||
10428 | pci_save_state(tp->pdev); | ||
10429 | |||
10424 | err = register_netdev(dev); | 10430 | err = register_netdev(dev); |
10425 | if (err) { | 10431 | if (err) { |
10426 | printk(KERN_ERR PFX "Cannot register net device, " | 10432 | printk(KERN_ERR PFX "Cannot register net device, " |
@@ -10430,12 +10436,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
10430 | 10436 | ||
10431 | pci_set_drvdata(pdev, dev); | 10437 | pci_set_drvdata(pdev, dev); |
10432 | 10438 | ||
10433 | /* Now that we have fully setup the chip, save away a snapshot | ||
10434 | * of the PCI config space. We need to restore this after | ||
10435 | * GRC_MISC_CFG core clock resets and some resume events. | ||
10436 | */ | ||
10437 | pci_save_state(tp->pdev); | ||
10438 | |||
10439 | printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (PCI%s:%s:%s) %sBaseT Ethernet ", | 10439 | printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (PCI%s:%s:%s) %sBaseT Ethernet ", |
10440 | dev->name, | 10440 | dev->name, |
10441 | tp->board_part_number, | 10441 | tp->board_part_number, |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 65ea7d25f691..1b34fc56067e 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -222,37 +222,6 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) | |||
222 | } | 222 | } |
223 | 223 | ||
224 | /** | 224 | /** |
225 | * pci_restore_bars - restore a devices BAR values (e.g. after wake-up) | ||
226 | * @dev: PCI device to have its BARs restored | ||
227 | * | ||
228 | * Restore the BAR values for a given device, so as to make it | ||
229 | * accessible by its driver. | ||
230 | */ | ||
231 | void | ||
232 | pci_restore_bars(struct pci_dev *dev) | ||
233 | { | ||
234 | int i, numres; | ||
235 | |||
236 | switch (dev->hdr_type) { | ||
237 | case PCI_HEADER_TYPE_NORMAL: | ||
238 | numres = 6; | ||
239 | break; | ||
240 | case PCI_HEADER_TYPE_BRIDGE: | ||
241 | numres = 2; | ||
242 | break; | ||
243 | case PCI_HEADER_TYPE_CARDBUS: | ||
244 | numres = 1; | ||
245 | break; | ||
246 | default: | ||
247 | /* Should never get here, but just in case... */ | ||
248 | return; | ||
249 | } | ||
250 | |||
251 | for (i = 0; i < numres; i ++) | ||
252 | pci_update_resource(dev, &dev->resource[i], i); | ||
253 | } | ||
254 | |||
255 | /** | ||
256 | * pci_set_power_state - Set the power state of a PCI device | 225 | * pci_set_power_state - Set the power state of a PCI device |
257 | * @dev: PCI device to be suspended | 226 | * @dev: PCI device to be suspended |
258 | * @state: PCI power state (D0, D1, D2, D3hot, D3cold) we're entering | 227 | * @state: PCI power state (D0, D1, D2, D3hot, D3cold) we're entering |
@@ -270,7 +239,7 @@ int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t t); | |||
270 | int | 239 | int |
271 | pci_set_power_state(struct pci_dev *dev, pci_power_t state) | 240 | pci_set_power_state(struct pci_dev *dev, pci_power_t state) |
272 | { | 241 | { |
273 | int pm, need_restore = 0; | 242 | int pm; |
274 | u16 pmcsr, pmc; | 243 | u16 pmcsr, pmc; |
275 | 244 | ||
276 | /* bound the state we're entering */ | 245 | /* bound the state we're entering */ |
@@ -309,17 +278,14 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
309 | return -EIO; | 278 | return -EIO; |
310 | } | 279 | } |
311 | 280 | ||
312 | pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr); | ||
313 | |||
314 | /* If we're in D3, force entire word to 0. | 281 | /* If we're in D3, force entire word to 0. |
315 | * This doesn't affect PME_Status, disables PME_En, and | 282 | * This doesn't affect PME_Status, disables PME_En, and |
316 | * sets PowerState to 0. | 283 | * sets PowerState to 0. |
317 | */ | 284 | */ |
318 | if (dev->current_state >= PCI_D3hot) { | 285 | if (dev->current_state >= PCI_D3hot) |
319 | if (!(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET)) | ||
320 | need_restore = 1; | ||
321 | pmcsr = 0; | 286 | pmcsr = 0; |
322 | } else { | 287 | else { |
288 | pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr); | ||
323 | pmcsr &= ~PCI_PM_CTRL_STATE_MASK; | 289 | pmcsr &= ~PCI_PM_CTRL_STATE_MASK; |
324 | pmcsr |= state; | 290 | pmcsr |= state; |
325 | } | 291 | } |
@@ -342,22 +308,6 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
342 | platform_pci_set_power_state(dev, state); | 308 | platform_pci_set_power_state(dev, state); |
343 | 309 | ||
344 | dev->current_state = state; | 310 | dev->current_state = state; |
345 | |||
346 | /* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT | ||
347 | * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning | ||
348 | * from D3hot to D0 _may_ perform an internal reset, thereby | ||
349 | * going to "D0 Uninitialized" rather than "D0 Initialized". | ||
350 | * For example, at least some versions of the 3c905B and the | ||
351 | * 3c556B exhibit this behaviour. | ||
352 | * | ||
353 | * At least some laptop BIOSen (e.g. the Thinkpad T21) leave | ||
354 | * devices in a D3hot state at boot. Consequently, we need to | ||
355 | * restore at least the BARs so that the device will be | ||
356 | * accessible to its driver. | ||
357 | */ | ||
358 | if (need_restore) | ||
359 | pci_restore_bars(dev); | ||
360 | |||
361 | return 0; | 311 | return 0; |
362 | } | 312 | } |
363 | 313 | ||
@@ -855,7 +805,6 @@ struct pci_dev *isa_bridge; | |||
855 | EXPORT_SYMBOL(isa_bridge); | 805 | EXPORT_SYMBOL(isa_bridge); |
856 | #endif | 806 | #endif |
857 | 807 | ||
858 | EXPORT_SYMBOL_GPL(pci_restore_bars); | ||
859 | EXPORT_SYMBOL(pci_enable_device_bars); | 808 | EXPORT_SYMBOL(pci_enable_device_bars); |
860 | EXPORT_SYMBOL(pci_enable_device); | 809 | EXPORT_SYMBOL(pci_enable_device); |
861 | EXPORT_SYMBOL(pci_disable_device); | 810 | EXPORT_SYMBOL(pci_disable_device); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 8d0968bd527e..a9160ad16581 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -373,6 +373,25 @@ static void __devinit quirk_vt82c686_acpi(struct pci_dev *dev) | |||
373 | } | 373 | } |
374 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi ); | 374 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi ); |
375 | 375 | ||
376 | /* | ||
377 | * VIA VT8235 ISA Bridge: Two IO regions pointed to by words at | ||
378 | * 0x88 (128 bytes of power management registers) | ||
379 | * 0xd0 (16 bytes of SMB registers) | ||
380 | */ | ||
381 | static void __devinit quirk_vt8235_acpi(struct pci_dev *dev) | ||
382 | { | ||
383 | u16 pm, smb; | ||
384 | |||
385 | pci_read_config_word(dev, 0x88, &pm); | ||
386 | pm &= PCI_BASE_ADDRESS_IO_MASK; | ||
387 | quirk_io_region(dev, pm, 128, PCI_BRIDGE_RESOURCES); | ||
388 | |||
389 | pci_read_config_word(dev, 0xd0, &smb); | ||
390 | smb &= PCI_BASE_ADDRESS_IO_MASK; | ||
391 | quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 1); | ||
392 | } | ||
393 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi); | ||
394 | |||
376 | 395 | ||
377 | #ifdef CONFIG_X86_IO_APIC | 396 | #ifdef CONFIG_X86_IO_APIC |
378 | 397 | ||
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 878fd0a65c02..84eedc965688 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -26,13 +26,18 @@ | |||
26 | #include "pci.h" | 26 | #include "pci.h" |
27 | 27 | ||
28 | 28 | ||
29 | void | 29 | static void |
30 | pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) | 30 | pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) |
31 | { | 31 | { |
32 | struct pci_bus_region region; | 32 | struct pci_bus_region region; |
33 | u32 new, check, mask; | 33 | u32 new, check, mask; |
34 | int reg; | 34 | int reg; |
35 | 35 | ||
36 | /* Ignore resources for unimplemented BARs and unused resource slots | ||
37 | for 64 bit BARs. */ | ||
38 | if (!res->flags) | ||
39 | return; | ||
40 | |||
36 | pcibios_resource_to_bus(dev, ®ion, res); | 41 | pcibios_resource_to_bus(dev, ®ion, res); |
37 | 42 | ||
38 | pr_debug(" got res [%lx:%lx] bus [%lx:%lx] flags %lx for " | 43 | pr_debug(" got res [%lx:%lx] bus [%lx:%lx] flags %lx for " |
@@ -67,7 +72,7 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) | |||
67 | 72 | ||
68 | if ((new & (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) == | 73 | if ((new & (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) == |
69 | (PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64)) { | 74 | (PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64)) { |
70 | new = 0; /* currently everyone zeros the high address */ | 75 | new = region.start >> 16 >> 16; |
71 | pci_write_config_dword(dev, reg + 4, new); | 76 | pci_write_config_dword(dev, reg + 4, new); |
72 | pci_read_config_dword(dev, reg + 4, &check); | 77 | pci_read_config_dword(dev, reg + 4, &check); |
73 | if (check != new) { | 78 | if (check != new) { |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 8f4d2999af8e..79c74f3a11f5 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -8120,20 +8120,22 @@ static struct notifier_block qeth_ip6_notifier = { | |||
8120 | #endif | 8120 | #endif |
8121 | 8121 | ||
8122 | static int | 8122 | static int |
8123 | qeth_reboot_event(struct notifier_block *this, unsigned long event, void *ptr) | 8123 | __qeth_reboot_event_card(struct device *dev, void *data) |
8124 | { | 8124 | { |
8125 | |||
8126 | struct device *entry; | ||
8127 | struct qeth_card *card; | 8125 | struct qeth_card *card; |
8128 | 8126 | ||
8129 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 8127 | card = (struct qeth_card *) dev->driver_data; |
8130 | list_for_each_entry(entry, &qeth_ccwgroup_driver.driver.devices, | 8128 | qeth_clear_ip_list(card, 0, 0); |
8131 | driver_list) { | 8129 | qeth_qdio_clear_card(card, 0); |
8132 | card = (struct qeth_card *) entry->driver_data; | 8130 | return 0; |
8133 | qeth_clear_ip_list(card, 0, 0); | 8131 | } |
8134 | qeth_qdio_clear_card(card, 0); | 8132 | |
8135 | } | 8133 | static int |
8136 | up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 8134 | qeth_reboot_event(struct notifier_block *this, unsigned long event, void *ptr) |
8135 | { | ||
8136 | |||
8137 | driver_for_each_device(&qeth_ccwgroup_driver.driver, NULL, NULL, | ||
8138 | __qeth_reboot_event_card); | ||
8137 | return NOTIFY_DONE; | 8139 | return NOTIFY_DONE; |
8138 | } | 8140 | } |
8139 | 8141 | ||
diff --git a/drivers/s390/net/qeth_proc.c b/drivers/s390/net/qeth_proc.c index 04719196fd20..f2ccfea8fdb8 100644 --- a/drivers/s390/net/qeth_proc.c +++ b/drivers/s390/net/qeth_proc.c | |||
@@ -27,23 +27,33 @@ const char *VERSION_QETH_PROC_C = "$Revision: 1.13 $"; | |||
27 | #define QETH_PROCFILE_NAME "qeth" | 27 | #define QETH_PROCFILE_NAME "qeth" |
28 | static struct proc_dir_entry *qeth_procfile; | 28 | static struct proc_dir_entry *qeth_procfile; |
29 | 29 | ||
30 | static int | ||
31 | qeth_procfile_seq_match(struct device *dev, void *data) | ||
32 | { | ||
33 | return 1; | ||
34 | } | ||
35 | |||
30 | static void * | 36 | static void * |
31 | qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) | 37 | qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) |
32 | { | 38 | { |
33 | struct list_head *next_card = NULL; | 39 | struct device *dev; |
34 | int i = 0; | 40 | loff_t nr; |
35 | 41 | ||
36 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 42 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); |
37 | 43 | ||
38 | if (*offset == 0) | 44 | nr = *offset; |
45 | if (nr == 0) | ||
39 | return SEQ_START_TOKEN; | 46 | return SEQ_START_TOKEN; |
40 | 47 | ||
41 | /* get card at pos *offset */ | 48 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, |
42 | list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices) | 49 | NULL, qeth_procfile_seq_match); |
43 | if (++i == *offset) | ||
44 | return next_card; | ||
45 | 50 | ||
46 | return NULL; | 51 | /* get card at pos *offset */ |
52 | nr = *offset; | ||
53 | while (nr-- > 1 && dev) | ||
54 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, | ||
55 | NULL, qeth_procfile_seq_match); | ||
56 | return (void *) dev; | ||
47 | } | 57 | } |
48 | 58 | ||
49 | static void | 59 | static void |
@@ -55,23 +65,21 @@ qeth_procfile_seq_stop(struct seq_file *s, void* it) | |||
55 | static void * | 65 | static void * |
56 | qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) | 66 | qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) |
57 | { | 67 | { |
58 | struct list_head *next_card = NULL; | 68 | struct device *prev, *next; |
59 | struct list_head *current_card; | ||
60 | 69 | ||
61 | if (it == SEQ_START_TOKEN) { | 70 | if (it == SEQ_START_TOKEN) { |
62 | next_card = qeth_ccwgroup_driver.driver.devices.next; | 71 | next = driver_find_device(&qeth_ccwgroup_driver.driver, |
63 | if (next_card->next == next_card) /* list empty */ | 72 | NULL, NULL, qeth_procfile_seq_match); |
64 | return NULL; | 73 | if (next) |
65 | (*offset)++; | 74 | (*offset)++; |
66 | } else { | 75 | return (void *) next; |
67 | current_card = (struct list_head *)it; | ||
68 | if (current_card->next == &qeth_ccwgroup_driver.driver.devices) | ||
69 | return NULL; /* end of list reached */ | ||
70 | next_card = current_card->next; | ||
71 | (*offset)++; | ||
72 | } | 76 | } |
73 | 77 | prev = (struct device *) it; | |
74 | return next_card; | 78 | next = driver_find_device(&qeth_ccwgroup_driver.driver, |
79 | prev, NULL, qeth_procfile_seq_match); | ||
80 | if (next) | ||
81 | (*offset)++; | ||
82 | return (void *) next; | ||
75 | } | 83 | } |
76 | 84 | ||
77 | static inline const char * | 85 | static inline const char * |
@@ -126,7 +134,7 @@ qeth_procfile_seq_show(struct seq_file *s, void *it) | |||
126 | "-------------- ---- ------ ---------- ---- " | 134 | "-------------- ---- ------ ---------- ---- " |
127 | "---- ----- -----\n"); | 135 | "---- ----- -----\n"); |
128 | } else { | 136 | } else { |
129 | device = list_entry(it, struct device, driver_list); | 137 | device = (struct device *) it; |
130 | card = device->driver_data; | 138 | card = device->driver_data; |
131 | seq_printf(s, "%s/%s/%s x%02X %-10s %-14s %-4i ", | 139 | seq_printf(s, "%s/%s/%s x%02X %-10s %-14s %-4i ", |
132 | CARD_RDEV_ID(card), | 140 | CARD_RDEV_ID(card), |
@@ -180,17 +188,20 @@ static struct proc_dir_entry *qeth_perf_procfile; | |||
180 | static void * | 188 | static void * |
181 | qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset) | 189 | qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset) |
182 | { | 190 | { |
183 | struct list_head *next_card = NULL; | 191 | struct device *dev = NULL; |
184 | int i = 0; | 192 | int nr; |
185 | 193 | ||
186 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 194 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); |
187 | /* get card at pos *offset */ | 195 | /* get card at pos *offset */ |
188 | list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices){ | 196 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL, |
189 | if (i == *offset) | 197 | qeth_procfile_seq_match); |
190 | return next_card; | 198 | |
191 | i++; | 199 | /* get card at pos *offset */ |
192 | } | 200 | nr = *offset; |
193 | return NULL; | 201 | while (nr-- > 1 && dev) |
202 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, | ||
203 | NULL, qeth_procfile_seq_match); | ||
204 | return (void *) dev; | ||
194 | } | 205 | } |
195 | 206 | ||
196 | static void | 207 | static void |
@@ -202,12 +213,14 @@ qeth_perf_procfile_seq_stop(struct seq_file *s, void* it) | |||
202 | static void * | 213 | static void * |
203 | qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) | 214 | qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) |
204 | { | 215 | { |
205 | struct list_head *current_card = (struct list_head *)it; | 216 | struct device *prev, *next; |
206 | 217 | ||
207 | if (current_card->next == &qeth_ccwgroup_driver.driver.devices) | 218 | prev = (struct device *) it; |
208 | return NULL; /* end of list reached */ | 219 | next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, |
209 | (*offset)++; | 220 | NULL, qeth_procfile_seq_match); |
210 | return current_card->next; | 221 | if (next) |
222 | (*offset)++; | ||
223 | return (void *) next; | ||
211 | } | 224 | } |
212 | 225 | ||
213 | static int | 226 | static int |
@@ -216,7 +229,7 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it) | |||
216 | struct device *device; | 229 | struct device *device; |
217 | struct qeth_card *card; | 230 | struct qeth_card *card; |
218 | 231 | ||
219 | device = list_entry(it, struct device, driver_list); | 232 | device = (struct device *) it; |
220 | card = device->driver_data; | 233 | card = device->driver_data; |
221 | seq_printf(s, "For card with devnos %s/%s/%s (%s):\n", | 234 | seq_printf(s, "For card with devnos %s/%s/%s (%s):\n", |
222 | CARD_RDEV_ID(card), | 235 | CARD_RDEV_ID(card), |
@@ -318,8 +331,8 @@ static struct proc_dir_entry *qeth_ipato_procfile; | |||
318 | static void * | 331 | static void * |
319 | qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) | 332 | qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) |
320 | { | 333 | { |
321 | struct list_head *next_card = NULL; | 334 | struct device *dev; |
322 | int i = 0; | 335 | loff_t nr; |
323 | 336 | ||
324 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 337 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); |
325 | /* TODO: finish this */ | 338 | /* TODO: finish this */ |
@@ -328,13 +341,16 @@ qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) | |||
328 | * output driver settings then; | 341 | * output driver settings then; |
329 | * else output setting for respective card | 342 | * else output setting for respective card |
330 | */ | 343 | */ |
344 | |||
345 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL, | ||
346 | qeth_procfile_seq_match); | ||
347 | |||
331 | /* get card at pos *offset */ | 348 | /* get card at pos *offset */ |
332 | list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices){ | 349 | nr = *offset; |
333 | if (i == *offset) | 350 | while (nr-- > 1 && dev) |
334 | return next_card; | 351 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, |
335 | i++; | 352 | NULL, qeth_procfile_seq_match); |
336 | } | 353 | return (void *) dev; |
337 | return NULL; | ||
338 | } | 354 | } |
339 | 355 | ||
340 | static void | 356 | static void |
@@ -346,18 +362,14 @@ qeth_ipato_procfile_seq_stop(struct seq_file *s, void* it) | |||
346 | static void * | 362 | static void * |
347 | qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) | 363 | qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) |
348 | { | 364 | { |
349 | struct list_head *current_card = (struct list_head *)it; | 365 | struct device *prev, *next; |
350 | 366 | ||
351 | /* TODO: finish this */ | 367 | prev = (struct device *) it; |
352 | /* | 368 | next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, |
353 | * maybe SEQ_SATRT_TOKEN can be returned for offset 0 | 369 | NULL, qeth_procfile_seq_match); |
354 | * output driver settings then; | 370 | if (next) |
355 | * else output setting for respective card | 371 | (*offset)++; |
356 | */ | 372 | return (void *) next; |
357 | if (current_card->next == &qeth_ccwgroup_driver.driver.devices) | ||
358 | return NULL; /* end of list reached */ | ||
359 | (*offset)++; | ||
360 | return current_card->next; | ||
361 | } | 373 | } |
362 | 374 | ||
363 | static int | 375 | static int |
@@ -372,7 +384,7 @@ qeth_ipato_procfile_seq_show(struct seq_file *s, void *it) | |||
372 | * output driver settings then; | 384 | * output driver settings then; |
373 | * else output setting for respective card | 385 | * else output setting for respective card |
374 | */ | 386 | */ |
375 | device = list_entry(it, struct device, driver_list); | 387 | device = (struct device *) it; |
376 | card = device->driver_data; | 388 | card = device->driver_data; |
377 | 389 | ||
378 | return 0; | 390 | return 0; |
diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h index 5f6187baad86..73c8a088c160 100644 --- a/drivers/serial/cpm_uart/cpm_uart.h +++ b/drivers/serial/cpm_uart/cpm_uart.h | |||
@@ -40,13 +40,15 @@ | |||
40 | #define TX_NUM_FIFO 4 | 40 | #define TX_NUM_FIFO 4 |
41 | #define TX_BUF_SIZE 32 | 41 | #define TX_BUF_SIZE 32 |
42 | 42 | ||
43 | #define SCC_WAIT_CLOSING 100 | ||
44 | |||
43 | struct uart_cpm_port { | 45 | struct uart_cpm_port { |
44 | struct uart_port port; | 46 | struct uart_port port; |
45 | u16 rx_nrfifos; | 47 | u16 rx_nrfifos; |
46 | u16 rx_fifosize; | 48 | u16 rx_fifosize; |
47 | u16 tx_nrfifos; | 49 | u16 tx_nrfifos; |
48 | u16 tx_fifosize; | 50 | u16 tx_fifosize; |
49 | smc_t *smcp; | 51 | smc_t *smcp; |
50 | smc_uart_t *smcup; | 52 | smc_uart_t *smcup; |
51 | scc_t *sccp; | 53 | scc_t *sccp; |
52 | scc_uart_t *sccup; | 54 | scc_uart_t *sccup; |
@@ -67,6 +69,8 @@ struct uart_cpm_port { | |||
67 | int bits; | 69 | int bits; |
68 | /* Keep track of 'odd' SMC2 wirings */ | 70 | /* Keep track of 'odd' SMC2 wirings */ |
69 | int is_portb; | 71 | int is_portb; |
72 | /* wait on close if needed */ | ||
73 | int wait_closing; | ||
70 | }; | 74 | }; |
71 | 75 | ||
72 | extern int cpm_uart_port_map[UART_NR]; | 76 | extern int cpm_uart_port_map[UART_NR]; |
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index 29db677d4284..d639ac92a117 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c | |||
@@ -9,9 +9,10 @@ | |||
9 | * | 9 | * |
10 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) (CPM2) | 10 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) (CPM2) |
11 | * Pantelis Antoniou (panto@intracom.gr) (CPM1) | 11 | * Pantelis Antoniou (panto@intracom.gr) (CPM1) |
12 | * | 12 | * |
13 | * Copyright (C) 2004 Freescale Semiconductor, Inc. | 13 | * Copyright (C) 2004 Freescale Semiconductor, Inc. |
14 | * (C) 2004 Intracom, S.A. | 14 | * (C) 2004 Intracom, S.A. |
15 | * (C) 2005 MontaVista Software, Inc. by Vitaly Bordug <vbordug@ru.mvista.com> | ||
15 | * | 16 | * |
16 | * This program is free software; you can redistribute it and/or modify | 17 | * This program is free software; you can redistribute it and/or modify |
17 | * it under the terms of the GNU General Public License as published by | 18 | * it under the terms of the GNU General Public License as published by |
@@ -70,8 +71,22 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo); | |||
70 | 71 | ||
71 | /**************************************************************/ | 72 | /**************************************************************/ |
72 | 73 | ||
74 | static inline unsigned long cpu2cpm_addr(void *addr) | ||
75 | { | ||
76 | if ((unsigned long)addr >= CPM_ADDR) | ||
77 | return (unsigned long)addr; | ||
78 | return virt_to_bus(addr); | ||
79 | } | ||
80 | |||
81 | static inline void *cpm2cpu_addr(unsigned long addr) | ||
82 | { | ||
83 | if (addr >= CPM_ADDR) | ||
84 | return (void *)addr; | ||
85 | return bus_to_virt(addr); | ||
86 | } | ||
87 | |||
73 | /* | 88 | /* |
74 | * Check, if transmit buffers are processed | 89 | * Check, if transmit buffers are processed |
75 | */ | 90 | */ |
76 | static unsigned int cpm_uart_tx_empty(struct uart_port *port) | 91 | static unsigned int cpm_uart_tx_empty(struct uart_port *port) |
77 | { | 92 | { |
@@ -143,15 +158,18 @@ static void cpm_uart_start_tx(struct uart_port *port, unsigned int tty_start) | |||
143 | } | 158 | } |
144 | 159 | ||
145 | if (cpm_uart_tx_pump(port) != 0) { | 160 | if (cpm_uart_tx_pump(port) != 0) { |
146 | if (IS_SMC(pinfo)) | 161 | if (IS_SMC(pinfo)) { |
147 | smcp->smc_smcm |= SMCM_TX; | 162 | smcp->smc_smcm |= SMCM_TX; |
148 | else | 163 | smcp->smc_smcmr |= SMCMR_TEN; |
164 | } else { | ||
149 | sccp->scc_sccm |= UART_SCCM_TX; | 165 | sccp->scc_sccm |= UART_SCCM_TX; |
166 | pinfo->sccp->scc_gsmrl |= SCC_GSMRL_ENT; | ||
167 | } | ||
150 | } | 168 | } |
151 | } | 169 | } |
152 | 170 | ||
153 | /* | 171 | /* |
154 | * Stop receiver | 172 | * Stop receiver |
155 | */ | 173 | */ |
156 | static void cpm_uart_stop_rx(struct uart_port *port) | 174 | static void cpm_uart_stop_rx(struct uart_port *port) |
157 | { | 175 | { |
@@ -176,7 +194,7 @@ static void cpm_uart_enable_ms(struct uart_port *port) | |||
176 | } | 194 | } |
177 | 195 | ||
178 | /* | 196 | /* |
179 | * Generate a break. | 197 | * Generate a break. |
180 | */ | 198 | */ |
181 | static void cpm_uart_break_ctl(struct uart_port *port, int break_state) | 199 | static void cpm_uart_break_ctl(struct uart_port *port, int break_state) |
182 | { | 200 | { |
@@ -231,7 +249,7 @@ static void cpm_uart_int_rx(struct uart_port *port, struct pt_regs *regs) | |||
231 | /* get number of characters, and check spce in flip-buffer */ | 249 | /* get number of characters, and check spce in flip-buffer */ |
232 | i = bdp->cbd_datlen; | 250 | i = bdp->cbd_datlen; |
233 | 251 | ||
234 | /* If we have not enough room in tty flip buffer, then we try | 252 | /* If we have not enough room in tty flip buffer, then we try |
235 | * later, which will be the next rx-interrupt or a timeout | 253 | * later, which will be the next rx-interrupt or a timeout |
236 | */ | 254 | */ |
237 | if ((tty->flip.count + i) >= TTY_FLIPBUF_SIZE) { | 255 | if ((tty->flip.count + i) >= TTY_FLIPBUF_SIZE) { |
@@ -243,7 +261,7 @@ static void cpm_uart_int_rx(struct uart_port *port, struct pt_regs *regs) | |||
243 | } | 261 | } |
244 | 262 | ||
245 | /* get pointer */ | 263 | /* get pointer */ |
246 | cp = (unsigned char *)bus_to_virt(bdp->cbd_bufaddr); | 264 | cp = cpm2cpu_addr(bdp->cbd_bufaddr); |
247 | 265 | ||
248 | /* loop through the buffer */ | 266 | /* loop through the buffer */ |
249 | while (i-- > 0) { | 267 | while (i-- > 0) { |
@@ -265,13 +283,14 @@ static void cpm_uart_int_rx(struct uart_port *port, struct pt_regs *regs) | |||
265 | } /* End while (i--) */ | 283 | } /* End while (i--) */ |
266 | 284 | ||
267 | /* This BD is ready to be used again. Clear status. get next */ | 285 | /* This BD is ready to be used again. Clear status. get next */ |
268 | bdp->cbd_sc &= ~(BD_SC_BR | BD_SC_FR | BD_SC_PR | BD_SC_OV); | 286 | bdp->cbd_sc &= ~(BD_SC_BR | BD_SC_FR | BD_SC_PR | BD_SC_OV | BD_SC_ID); |
269 | bdp->cbd_sc |= BD_SC_EMPTY; | 287 | bdp->cbd_sc |= BD_SC_EMPTY; |
270 | 288 | ||
271 | if (bdp->cbd_sc & BD_SC_WRAP) | 289 | if (bdp->cbd_sc & BD_SC_WRAP) |
272 | bdp = pinfo->rx_bd_base; | 290 | bdp = pinfo->rx_bd_base; |
273 | else | 291 | else |
274 | bdp++; | 292 | bdp++; |
293 | |||
275 | } /* End for (;;) */ | 294 | } /* End for (;;) */ |
276 | 295 | ||
277 | /* Write back buffer pointer */ | 296 | /* Write back buffer pointer */ |
@@ -336,22 +355,22 @@ static irqreturn_t cpm_uart_int(int irq, void *data, struct pt_regs *regs) | |||
336 | 355 | ||
337 | if (IS_SMC(pinfo)) { | 356 | if (IS_SMC(pinfo)) { |
338 | events = smcp->smc_smce; | 357 | events = smcp->smc_smce; |
358 | smcp->smc_smce = events; | ||
339 | if (events & SMCM_BRKE) | 359 | if (events & SMCM_BRKE) |
340 | uart_handle_break(port); | 360 | uart_handle_break(port); |
341 | if (events & SMCM_RX) | 361 | if (events & SMCM_RX) |
342 | cpm_uart_int_rx(port, regs); | 362 | cpm_uart_int_rx(port, regs); |
343 | if (events & SMCM_TX) | 363 | if (events & SMCM_TX) |
344 | cpm_uart_int_tx(port, regs); | 364 | cpm_uart_int_tx(port, regs); |
345 | smcp->smc_smce = events; | ||
346 | } else { | 365 | } else { |
347 | events = sccp->scc_scce; | 366 | events = sccp->scc_scce; |
367 | sccp->scc_scce = events; | ||
348 | if (events & UART_SCCM_BRKE) | 368 | if (events & UART_SCCM_BRKE) |
349 | uart_handle_break(port); | 369 | uart_handle_break(port); |
350 | if (events & UART_SCCM_RX) | 370 | if (events & UART_SCCM_RX) |
351 | cpm_uart_int_rx(port, regs); | 371 | cpm_uart_int_rx(port, regs); |
352 | if (events & UART_SCCM_TX) | 372 | if (events & UART_SCCM_TX) |
353 | cpm_uart_int_tx(port, regs); | 373 | cpm_uart_int_tx(port, regs); |
354 | sccp->scc_scce = events; | ||
355 | } | 374 | } |
356 | return (events) ? IRQ_HANDLED : IRQ_NONE; | 375 | return (events) ? IRQ_HANDLED : IRQ_NONE; |
357 | } | 376 | } |
@@ -360,6 +379,7 @@ static int cpm_uart_startup(struct uart_port *port) | |||
360 | { | 379 | { |
361 | int retval; | 380 | int retval; |
362 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; | 381 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; |
382 | int line = pinfo - cpm_uart_ports; | ||
363 | 383 | ||
364 | pr_debug("CPM uart[%d]:startup\n", port->line); | 384 | pr_debug("CPM uart[%d]:startup\n", port->line); |
365 | 385 | ||
@@ -376,9 +396,19 @@ static int cpm_uart_startup(struct uart_port *port) | |||
376 | pinfo->sccp->scc_sccm |= UART_SCCM_RX; | 396 | pinfo->sccp->scc_sccm |= UART_SCCM_RX; |
377 | } | 397 | } |
378 | 398 | ||
399 | if (!(pinfo->flags & FLAG_CONSOLE)) | ||
400 | cpm_line_cr_cmd(line,CPM_CR_INIT_TRX); | ||
379 | return 0; | 401 | return 0; |
380 | } | 402 | } |
381 | 403 | ||
404 | inline void cpm_uart_wait_until_send(struct uart_cpm_port *pinfo) | ||
405 | { | ||
406 | unsigned long target_jiffies = jiffies + pinfo->wait_closing; | ||
407 | |||
408 | while (!time_after(jiffies, target_jiffies)) | ||
409 | schedule(); | ||
410 | } | ||
411 | |||
382 | /* | 412 | /* |
383 | * Shutdown the uart | 413 | * Shutdown the uart |
384 | */ | 414 | */ |
@@ -394,6 +424,12 @@ static void cpm_uart_shutdown(struct uart_port *port) | |||
394 | 424 | ||
395 | /* If the port is not the console, disable Rx and Tx. */ | 425 | /* If the port is not the console, disable Rx and Tx. */ |
396 | if (!(pinfo->flags & FLAG_CONSOLE)) { | 426 | if (!(pinfo->flags & FLAG_CONSOLE)) { |
427 | /* Wait for all the BDs marked sent */ | ||
428 | while(!cpm_uart_tx_empty(port)) | ||
429 | schedule_timeout(2); | ||
430 | if(pinfo->wait_closing) | ||
431 | cpm_uart_wait_until_send(pinfo); | ||
432 | |||
397 | /* Stop uarts */ | 433 | /* Stop uarts */ |
398 | if (IS_SMC(pinfo)) { | 434 | if (IS_SMC(pinfo)) { |
399 | volatile smc_t *smcp = pinfo->smcp; | 435 | volatile smc_t *smcp = pinfo->smcp; |
@@ -502,7 +538,7 @@ static void cpm_uart_set_termios(struct uart_port *port, | |||
502 | */ | 538 | */ |
503 | if ((termios->c_cflag & CREAD) == 0) | 539 | if ((termios->c_cflag & CREAD) == 0) |
504 | port->read_status_mask &= ~BD_SC_EMPTY; | 540 | port->read_status_mask &= ~BD_SC_EMPTY; |
505 | 541 | ||
506 | spin_lock_irqsave(&port->lock, flags); | 542 | spin_lock_irqsave(&port->lock, flags); |
507 | 543 | ||
508 | /* Start bit has not been added (so don't, because we would just | 544 | /* Start bit has not been added (so don't, because we would just |
@@ -569,7 +605,8 @@ static int cpm_uart_tx_pump(struct uart_port *port) | |||
569 | /* Pick next descriptor and fill from buffer */ | 605 | /* Pick next descriptor and fill from buffer */ |
570 | bdp = pinfo->tx_cur; | 606 | bdp = pinfo->tx_cur; |
571 | 607 | ||
572 | p = bus_to_virt(bdp->cbd_bufaddr); | 608 | p = cpm2cpu_addr(bdp->cbd_bufaddr); |
609 | |||
573 | *p++ = xmit->buf[xmit->tail]; | 610 | *p++ = xmit->buf[xmit->tail]; |
574 | bdp->cbd_datlen = 1; | 611 | bdp->cbd_datlen = 1; |
575 | bdp->cbd_sc |= BD_SC_READY; | 612 | bdp->cbd_sc |= BD_SC_READY; |
@@ -595,7 +632,7 @@ static int cpm_uart_tx_pump(struct uart_port *port) | |||
595 | 632 | ||
596 | while (!(bdp->cbd_sc & BD_SC_READY) && (xmit->tail != xmit->head)) { | 633 | while (!(bdp->cbd_sc & BD_SC_READY) && (xmit->tail != xmit->head)) { |
597 | count = 0; | 634 | count = 0; |
598 | p = bus_to_virt(bdp->cbd_bufaddr); | 635 | p = cpm2cpu_addr(bdp->cbd_bufaddr); |
599 | while (count < pinfo->tx_fifosize) { | 636 | while (count < pinfo->tx_fifosize) { |
600 | *p++ = xmit->buf[xmit->tail]; | 637 | *p++ = xmit->buf[xmit->tail]; |
601 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | 638 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
@@ -606,6 +643,7 @@ static int cpm_uart_tx_pump(struct uart_port *port) | |||
606 | } | 643 | } |
607 | bdp->cbd_datlen = count; | 644 | bdp->cbd_datlen = count; |
608 | bdp->cbd_sc |= BD_SC_READY; | 645 | bdp->cbd_sc |= BD_SC_READY; |
646 | __asm__("eieio"); | ||
609 | /* Get next BD. */ | 647 | /* Get next BD. */ |
610 | if (bdp->cbd_sc & BD_SC_WRAP) | 648 | if (bdp->cbd_sc & BD_SC_WRAP) |
611 | bdp = pinfo->tx_bd_base; | 649 | bdp = pinfo->tx_bd_base; |
@@ -643,12 +681,12 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo) | |||
643 | mem_addr = pinfo->mem_addr; | 681 | mem_addr = pinfo->mem_addr; |
644 | bdp = pinfo->rx_cur = pinfo->rx_bd_base; | 682 | bdp = pinfo->rx_cur = pinfo->rx_bd_base; |
645 | for (i = 0; i < (pinfo->rx_nrfifos - 1); i++, bdp++) { | 683 | for (i = 0; i < (pinfo->rx_nrfifos - 1); i++, bdp++) { |
646 | bdp->cbd_bufaddr = virt_to_bus(mem_addr); | 684 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); |
647 | bdp->cbd_sc = BD_SC_EMPTY | BD_SC_INTRPT; | 685 | bdp->cbd_sc = BD_SC_EMPTY | BD_SC_INTRPT; |
648 | mem_addr += pinfo->rx_fifosize; | 686 | mem_addr += pinfo->rx_fifosize; |
649 | } | 687 | } |
650 | 688 | ||
651 | bdp->cbd_bufaddr = virt_to_bus(mem_addr); | 689 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); |
652 | bdp->cbd_sc = BD_SC_WRAP | BD_SC_EMPTY | BD_SC_INTRPT; | 690 | bdp->cbd_sc = BD_SC_WRAP | BD_SC_EMPTY | BD_SC_INTRPT; |
653 | 691 | ||
654 | /* Set the physical address of the host memory | 692 | /* Set the physical address of the host memory |
@@ -658,12 +696,12 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo) | |||
658 | mem_addr = pinfo->mem_addr + L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize); | 696 | mem_addr = pinfo->mem_addr + L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize); |
659 | bdp = pinfo->tx_cur = pinfo->tx_bd_base; | 697 | bdp = pinfo->tx_cur = pinfo->tx_bd_base; |
660 | for (i = 0; i < (pinfo->tx_nrfifos - 1); i++, bdp++) { | 698 | for (i = 0; i < (pinfo->tx_nrfifos - 1); i++, bdp++) { |
661 | bdp->cbd_bufaddr = virt_to_bus(mem_addr); | 699 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); |
662 | bdp->cbd_sc = BD_SC_INTRPT; | 700 | bdp->cbd_sc = BD_SC_INTRPT; |
663 | mem_addr += pinfo->tx_fifosize; | 701 | mem_addr += pinfo->tx_fifosize; |
664 | } | 702 | } |
665 | 703 | ||
666 | bdp->cbd_bufaddr = virt_to_bus(mem_addr); | 704 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); |
667 | bdp->cbd_sc = BD_SC_WRAP | BD_SC_INTRPT; | 705 | bdp->cbd_sc = BD_SC_WRAP | BD_SC_INTRPT; |
668 | } | 706 | } |
669 | 707 | ||
@@ -763,6 +801,8 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo) | |||
763 | /* Using idle charater time requires some additional tuning. */ | 801 | /* Using idle charater time requires some additional tuning. */ |
764 | up->smc_mrblr = pinfo->rx_fifosize; | 802 | up->smc_mrblr = pinfo->rx_fifosize; |
765 | up->smc_maxidl = pinfo->rx_fifosize; | 803 | up->smc_maxidl = pinfo->rx_fifosize; |
804 | up->smc_brklen = 0; | ||
805 | up->smc_brkec = 0; | ||
766 | up->smc_brkcr = 1; | 806 | up->smc_brkcr = 1; |
767 | 807 | ||
768 | cpm_line_cr_cmd(line, CPM_CR_INIT_TRX); | 808 | cpm_line_cr_cmd(line, CPM_CR_INIT_TRX); |
@@ -796,7 +836,7 @@ static int cpm_uart_request_port(struct uart_port *port) | |||
796 | /* | 836 | /* |
797 | * Setup any port IO, connect any baud rate generators, | 837 | * Setup any port IO, connect any baud rate generators, |
798 | * etc. This is expected to be handled by board | 838 | * etc. This is expected to be handled by board |
799 | * dependant code | 839 | * dependant code |
800 | */ | 840 | */ |
801 | if (pinfo->set_lineif) | 841 | if (pinfo->set_lineif) |
802 | pinfo->set_lineif(pinfo); | 842 | pinfo->set_lineif(pinfo); |
@@ -815,6 +855,10 @@ static int cpm_uart_request_port(struct uart_port *port) | |||
815 | return ret; | 855 | return ret; |
816 | 856 | ||
817 | cpm_uart_initbd(pinfo); | 857 | cpm_uart_initbd(pinfo); |
858 | if (IS_SMC(pinfo)) | ||
859 | cpm_uart_init_smc(pinfo); | ||
860 | else | ||
861 | cpm_uart_init_scc(pinfo); | ||
818 | 862 | ||
819 | return 0; | 863 | return 0; |
820 | } | 864 | } |
@@ -869,7 +913,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = { | |||
869 | .flags = FLAG_SMC, | 913 | .flags = FLAG_SMC, |
870 | .tx_nrfifos = TX_NUM_FIFO, | 914 | .tx_nrfifos = TX_NUM_FIFO, |
871 | .tx_fifosize = TX_BUF_SIZE, | 915 | .tx_fifosize = TX_BUF_SIZE, |
872 | .rx_nrfifos = RX_NUM_FIFO, | 916 | .rx_nrfifos = RX_NUM_FIFO, |
873 | .rx_fifosize = RX_BUF_SIZE, | 917 | .rx_fifosize = RX_BUF_SIZE, |
874 | .set_lineif = smc1_lineif, | 918 | .set_lineif = smc1_lineif, |
875 | }, | 919 | }, |
@@ -883,7 +927,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = { | |||
883 | .flags = FLAG_SMC, | 927 | .flags = FLAG_SMC, |
884 | .tx_nrfifos = TX_NUM_FIFO, | 928 | .tx_nrfifos = TX_NUM_FIFO, |
885 | .tx_fifosize = TX_BUF_SIZE, | 929 | .tx_fifosize = TX_BUF_SIZE, |
886 | .rx_nrfifos = RX_NUM_FIFO, | 930 | .rx_nrfifos = RX_NUM_FIFO, |
887 | .rx_fifosize = RX_BUF_SIZE, | 931 | .rx_fifosize = RX_BUF_SIZE, |
888 | .set_lineif = smc2_lineif, | 932 | .set_lineif = smc2_lineif, |
889 | #ifdef CONFIG_SERIAL_CPM_ALT_SMC2 | 933 | #ifdef CONFIG_SERIAL_CPM_ALT_SMC2 |
@@ -899,9 +943,10 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = { | |||
899 | }, | 943 | }, |
900 | .tx_nrfifos = TX_NUM_FIFO, | 944 | .tx_nrfifos = TX_NUM_FIFO, |
901 | .tx_fifosize = TX_BUF_SIZE, | 945 | .tx_fifosize = TX_BUF_SIZE, |
902 | .rx_nrfifos = RX_NUM_FIFO, | 946 | .rx_nrfifos = RX_NUM_FIFO, |
903 | .rx_fifosize = RX_BUF_SIZE, | 947 | .rx_fifosize = RX_BUF_SIZE, |
904 | .set_lineif = scc1_lineif, | 948 | .set_lineif = scc1_lineif, |
949 | .wait_closing = SCC_WAIT_CLOSING, | ||
905 | }, | 950 | }, |
906 | [UART_SCC2] = { | 951 | [UART_SCC2] = { |
907 | .port = { | 952 | .port = { |
@@ -912,9 +957,10 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = { | |||
912 | }, | 957 | }, |
913 | .tx_nrfifos = TX_NUM_FIFO, | 958 | .tx_nrfifos = TX_NUM_FIFO, |
914 | .tx_fifosize = TX_BUF_SIZE, | 959 | .tx_fifosize = TX_BUF_SIZE, |
915 | .rx_nrfifos = RX_NUM_FIFO, | 960 | .rx_nrfifos = RX_NUM_FIFO, |
916 | .rx_fifosize = RX_BUF_SIZE, | 961 | .rx_fifosize = RX_BUF_SIZE, |
917 | .set_lineif = scc2_lineif, | 962 | .set_lineif = scc2_lineif, |
963 | .wait_closing = SCC_WAIT_CLOSING, | ||
918 | }, | 964 | }, |
919 | [UART_SCC3] = { | 965 | [UART_SCC3] = { |
920 | .port = { | 966 | .port = { |
@@ -925,9 +971,10 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = { | |||
925 | }, | 971 | }, |
926 | .tx_nrfifos = TX_NUM_FIFO, | 972 | .tx_nrfifos = TX_NUM_FIFO, |
927 | .tx_fifosize = TX_BUF_SIZE, | 973 | .tx_fifosize = TX_BUF_SIZE, |
928 | .rx_nrfifos = RX_NUM_FIFO, | 974 | .rx_nrfifos = RX_NUM_FIFO, |
929 | .rx_fifosize = RX_BUF_SIZE, | 975 | .rx_fifosize = RX_BUF_SIZE, |
930 | .set_lineif = scc3_lineif, | 976 | .set_lineif = scc3_lineif, |
977 | .wait_closing = SCC_WAIT_CLOSING, | ||
931 | }, | 978 | }, |
932 | [UART_SCC4] = { | 979 | [UART_SCC4] = { |
933 | .port = { | 980 | .port = { |
@@ -938,9 +985,10 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = { | |||
938 | }, | 985 | }, |
939 | .tx_nrfifos = TX_NUM_FIFO, | 986 | .tx_nrfifos = TX_NUM_FIFO, |
940 | .tx_fifosize = TX_BUF_SIZE, | 987 | .tx_fifosize = TX_BUF_SIZE, |
941 | .rx_nrfifos = RX_NUM_FIFO, | 988 | .rx_nrfifos = RX_NUM_FIFO, |
942 | .rx_fifosize = RX_BUF_SIZE, | 989 | .rx_fifosize = RX_BUF_SIZE, |
943 | .set_lineif = scc4_lineif, | 990 | .set_lineif = scc4_lineif, |
991 | .wait_closing = SCC_WAIT_CLOSING, | ||
944 | }, | 992 | }, |
945 | }; | 993 | }; |
946 | 994 | ||
@@ -983,11 +1031,8 @@ static void cpm_uart_console_write(struct console *co, const char *s, | |||
983 | * If the buffer address is in the CPM DPRAM, don't | 1031 | * If the buffer address is in the CPM DPRAM, don't |
984 | * convert it. | 1032 | * convert it. |
985 | */ | 1033 | */ |
986 | if ((uint) (bdp->cbd_bufaddr) > (uint) CPM_ADDR) | 1034 | cp = cpm2cpu_addr(bdp->cbd_bufaddr); |
987 | cp = (unsigned char *) (bdp->cbd_bufaddr); | 1035 | |
988 | else | ||
989 | cp = bus_to_virt(bdp->cbd_bufaddr); | ||
990 | |||
991 | *cp = *s; | 1036 | *cp = *s; |
992 | 1037 | ||
993 | bdp->cbd_datlen = 1; | 1038 | bdp->cbd_datlen = 1; |
@@ -1003,10 +1048,7 @@ static void cpm_uart_console_write(struct console *co, const char *s, | |||
1003 | while ((bdp->cbd_sc & BD_SC_READY) != 0) | 1048 | while ((bdp->cbd_sc & BD_SC_READY) != 0) |
1004 | ; | 1049 | ; |
1005 | 1050 | ||
1006 | if ((uint) (bdp->cbd_bufaddr) > (uint) CPM_ADDR) | 1051 | cp = cpm2cpu_addr(bdp->cbd_bufaddr); |
1007 | cp = (unsigned char *) (bdp->cbd_bufaddr); | ||
1008 | else | ||
1009 | cp = bus_to_virt(bdp->cbd_bufaddr); | ||
1010 | 1052 | ||
1011 | *cp = 13; | 1053 | *cp = 13; |
1012 | bdp->cbd_datlen = 1; | 1054 | bdp->cbd_datlen = 1; |
@@ -1045,7 +1087,7 @@ static int __init cpm_uart_console_setup(struct console *co, char *options) | |||
1045 | port = | 1087 | port = |
1046 | (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; | 1088 | (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; |
1047 | pinfo = (struct uart_cpm_port *)port; | 1089 | pinfo = (struct uart_cpm_port *)port; |
1048 | 1090 | ||
1049 | pinfo->flags |= FLAG_CONSOLE; | 1091 | pinfo->flags |= FLAG_CONSOLE; |
1050 | 1092 | ||
1051 | if (options) { | 1093 | if (options) { |
@@ -1062,7 +1104,7 @@ static int __init cpm_uart_console_setup(struct console *co, char *options) | |||
1062 | /* | 1104 | /* |
1063 | * Setup any port IO, connect any baud rate generators, | 1105 | * Setup any port IO, connect any baud rate generators, |
1064 | * etc. This is expected to be handled by board | 1106 | * etc. This is expected to be handled by board |
1065 | * dependant code | 1107 | * dependant code |
1066 | */ | 1108 | */ |
1067 | if (pinfo->set_lineif) | 1109 | if (pinfo->set_lineif) |
1068 | pinfo->set_lineif(pinfo); | 1110 | pinfo->set_lineif(pinfo); |
@@ -1092,14 +1134,14 @@ static int __init cpm_uart_console_setup(struct console *co, char *options) | |||
1092 | return 0; | 1134 | return 0; |
1093 | } | 1135 | } |
1094 | 1136 | ||
1095 | extern struct uart_driver cpm_reg; | 1137 | static struct uart_driver cpm_reg; |
1096 | static struct console cpm_scc_uart_console = { | 1138 | static struct console cpm_scc_uart_console = { |
1097 | .name "ttyCPM", | 1139 | .name = "ttyCPM", |
1098 | .write cpm_uart_console_write, | 1140 | .write = cpm_uart_console_write, |
1099 | .device uart_console_device, | 1141 | .device = uart_console_device, |
1100 | .setup cpm_uart_console_setup, | 1142 | .setup = cpm_uart_console_setup, |
1101 | .flags CON_PRINTBUFFER, | 1143 | .flags = CON_PRINTBUFFER, |
1102 | .index -1, | 1144 | .index = -1, |
1103 | .data = &cpm_reg, | 1145 | .data = &cpm_reg, |
1104 | }; | 1146 | }; |
1105 | 1147 | ||
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c index 8efbd6d1d6a4..4b0786e7eb7f 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) (CPM2) | 6 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) (CPM2) |
7 | * Pantelis Antoniou (panto@intracom.gr) (CPM1) | 7 | * Pantelis Antoniou (panto@intracom.gr) (CPM1) |
8 | * | 8 | * |
9 | * Copyright (C) 2004 Freescale Semiconductor, Inc. | 9 | * Copyright (C) 2004 Freescale Semiconductor, Inc. |
10 | * (C) 2004 Intracom, S.A. | 10 | * (C) 2004 Intracom, S.A. |
11 | * | 11 | * |
@@ -82,6 +82,17 @@ void cpm_line_cr_cmd(int line, int cmd) | |||
82 | void smc1_lineif(struct uart_cpm_port *pinfo) | 82 | void smc1_lineif(struct uart_cpm_port *pinfo) |
83 | { | 83 | { |
84 | volatile cpm8xx_t *cp = cpmp; | 84 | volatile cpm8xx_t *cp = cpmp; |
85 | |||
86 | (void)cp; /* fix warning */ | ||
87 | #if defined (CONFIG_MPC885ADS) | ||
88 | /* Enable SMC1 transceivers */ | ||
89 | { | ||
90 | cp->cp_pepar |= 0x000000c0; | ||
91 | cp->cp_pedir &= ~0x000000c0; | ||
92 | cp->cp_peso &= ~0x00000040; | ||
93 | cp->cp_peso |= 0x00000080; | ||
94 | } | ||
95 | #elif defined (CONFIG_MPC86XADS) | ||
85 | unsigned int iobits = 0x000000c0; | 96 | unsigned int iobits = 0x000000c0; |
86 | 97 | ||
87 | if (!pinfo->is_portb) { | 98 | if (!pinfo->is_portb) { |
@@ -93,41 +104,33 @@ void smc1_lineif(struct uart_cpm_port *pinfo) | |||
93 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_padir &= ~iobits; | 104 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_padir &= ~iobits; |
94 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_paodr &= ~iobits; | 105 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_paodr &= ~iobits; |
95 | } | 106 | } |
96 | |||
97 | #ifdef CONFIG_MPC885ADS | ||
98 | /* Enable SMC1 transceivers */ | ||
99 | { | ||
100 | volatile uint __iomem *bcsr1 = ioremap(BCSR1, 4); | ||
101 | uint tmp; | ||
102 | |||
103 | tmp = in_be32(bcsr1); | ||
104 | tmp &= ~BCSR1_RS232EN_1; | ||
105 | out_be32(bcsr1, tmp); | ||
106 | iounmap(bcsr1); | ||
107 | } | ||
108 | #endif | 107 | #endif |
109 | |||
110 | pinfo->brg = 1; | 108 | pinfo->brg = 1; |
111 | } | 109 | } |
112 | 110 | ||
113 | void smc2_lineif(struct uart_cpm_port *pinfo) | 111 | void smc2_lineif(struct uart_cpm_port *pinfo) |
114 | { | 112 | { |
115 | #ifdef CONFIG_MPC885ADS | ||
116 | volatile cpm8xx_t *cp = cpmp; | 113 | volatile cpm8xx_t *cp = cpmp; |
117 | volatile uint __iomem *bcsr1; | ||
118 | uint tmp; | ||
119 | 114 | ||
115 | (void)cp; /* fix warning */ | ||
116 | #if defined (CONFIG_MPC885ADS) | ||
120 | cp->cp_pepar |= 0x00000c00; | 117 | cp->cp_pepar |= 0x00000c00; |
121 | cp->cp_pedir &= ~0x00000c00; | 118 | cp->cp_pedir &= ~0x00000c00; |
122 | cp->cp_peso &= ~0x00000400; | 119 | cp->cp_peso &= ~0x00000400; |
123 | cp->cp_peso |= 0x00000800; | 120 | cp->cp_peso |= 0x00000800; |
121 | #elif defined (CONFIG_MPC86XADS) | ||
122 | unsigned int iobits = 0x00000c00; | ||
123 | |||
124 | if (!pinfo->is_portb) { | ||
125 | cp->cp_pbpar |= iobits; | ||
126 | cp->cp_pbdir &= ~iobits; | ||
127 | cp->cp_pbodr &= ~iobits; | ||
128 | } else { | ||
129 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_papar |= iobits; | ||
130 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_padir &= ~iobits; | ||
131 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_paodr &= ~iobits; | ||
132 | } | ||
124 | 133 | ||
125 | /* Enable SMC2 transceivers */ | ||
126 | bcsr1 = ioremap(BCSR1, 4); | ||
127 | tmp = in_be32(bcsr1); | ||
128 | tmp &= ~BCSR1_RS232EN_2; | ||
129 | out_be32(bcsr1, tmp); | ||
130 | iounmap(bcsr1); | ||
131 | #endif | 134 | #endif |
132 | 135 | ||
133 | pinfo->brg = 2; | 136 | pinfo->brg = 2; |
@@ -158,7 +161,7 @@ void scc4_lineif(struct uart_cpm_port *pinfo) | |||
158 | } | 161 | } |
159 | 162 | ||
160 | /* | 163 | /* |
161 | * Allocate DP-Ram and memory buffers. We need to allocate a transmit and | 164 | * Allocate DP-Ram and memory buffers. We need to allocate a transmit and |
162 | * receive buffer descriptors from dual port ram, and a character | 165 | * receive buffer descriptors from dual port ram, and a character |
163 | * buffer area from host mem. If we are allocating for the console we need | 166 | * buffer area from host mem. If we are allocating for the console we need |
164 | * to do it from bootmem | 167 | * to do it from bootmem |
@@ -185,6 +188,8 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
185 | memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) + | 188 | memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) + |
186 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); | 189 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); |
187 | if (is_con) { | 190 | if (is_con) { |
191 | /* was hostalloc but changed cause it blows away the */ | ||
192 | /* large tlb mapping when pinning the kernel area */ | ||
188 | mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); | 193 | mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); |
189 | dma_addr = 0; | 194 | dma_addr = 0; |
190 | } else | 195 | } else |
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index fbf659b6dab0..3edc9f49344b 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c | |||
@@ -246,6 +246,11 @@ static const struct fb_videomode modedb[] = { | |||
246 | /* 480x300 @ 72 Hz, 48.0 kHz hsync */ | 246 | /* 480x300 @ 72 Hz, 48.0 kHz hsync */ |
247 | NULL, 72, 480, 300, 33386, 40, 24, 11, 19, 80, 3, | 247 | NULL, 72, 480, 300, 33386, 40, 24, 11, 19, 80, 3, |
248 | 0, FB_VMODE_DOUBLE | 248 | 0, FB_VMODE_DOUBLE |
249 | }, { | ||
250 | /* 1920x1200 @ 60 Hz, 74.5 Khz hsync */ | ||
251 | NULL, 60, 1920, 1200, 5177, 128, 336, 1, 38, 208, 3, | ||
252 | FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
253 | FB_VMODE_NONINTERLACED | ||
249 | }, | 254 | }, |
250 | }; | 255 | }; |
251 | 256 | ||
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index b2e6b2407869..52b16850a54e 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c | |||
@@ -1324,6 +1324,13 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info) | |||
1324 | 1324 | ||
1325 | fb_videomode_to_var(&nvidiafb_default_var, &modedb); | 1325 | fb_videomode_to_var(&nvidiafb_default_var, &modedb); |
1326 | nvidiafb_default_var.bits_per_pixel = 8; | 1326 | nvidiafb_default_var.bits_per_pixel = 8; |
1327 | } else if (par->fpWidth && par->fpHeight) { | ||
1328 | char buf[16]; | ||
1329 | |||
1330 | memset(buf, 0, 16); | ||
1331 | snprintf(buf, 15, "%dx%d", par->fpWidth, par->fpHeight); | ||
1332 | fb_find_mode(&nvidiafb_default_var, info, buf, specs->modedb, | ||
1333 | specs->modedb_len, &modedb, 8); | ||
1327 | } | 1334 | } |
1328 | 1335 | ||
1329 | if (mode_option) | 1336 | if (mode_option) |
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index 2d29db7ef800..beeec7b51425 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c | |||
@@ -598,7 +598,7 @@ sa1100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
598 | * requests for the LCD controller. If we hit this, it means we're | 598 | * requests for the LCD controller. If we hit this, it means we're |
599 | * doing nothing but LCD DMA. | 599 | * doing nothing but LCD DMA. |
600 | */ | 600 | */ |
601 | static unsigned int sa1100fb_display_dma_period(struct fb_var_screeninfo *var) | 601 | static inline unsigned int sa1100fb_display_dma_period(struct fb_var_screeninfo *var) |
602 | { | 602 | { |
603 | /* | 603 | /* |
604 | * Period = pixclock * bits_per_byte * bytes_per_transfer | 604 | * Period = pixclock * bits_per_byte * bytes_per_transfer |