diff options
Diffstat (limited to 'drivers')
464 files changed, 7466 insertions, 6919 deletions
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h index 8e679ef5b231..a4471e3d3853 100644 --- a/drivers/acpi/acpica/acconfig.h +++ b/drivers/acpi/acpica/acconfig.h | |||
| @@ -103,9 +103,9 @@ | |||
| 103 | 103 | ||
| 104 | #define ACPI_MAX_REFERENCE_COUNT 0x1000 | 104 | #define ACPI_MAX_REFERENCE_COUNT 0x1000 |
| 105 | 105 | ||
| 106 | /* Size of cached memory mapping for system memory operation region */ | 106 | /* Default page size for use in mapping memory for operation regions */ |
| 107 | 107 | ||
| 108 | #define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 | 108 | #define ACPI_DEFAULT_PAGE_SIZE 4096 /* Must be power of 2 */ |
| 109 | 109 | ||
| 110 | /* owner_id tracking. 8 entries allows for 255 owner_ids */ | 110 | /* owner_id tracking. 8 entries allows for 255 owner_ids */ |
| 111 | 111 | ||
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h index cd80d1dd1950..57bdaf6ffab1 100644 --- a/drivers/acpi/acpica/acpredef.h +++ b/drivers/acpi/acpica/acpredef.h | |||
| @@ -203,8 +203,9 @@ static const union acpi_predefined_info predefined_names[] = | |||
| 203 | {{"_BCT", 1, ACPI_RTYPE_INTEGER}}, | 203 | {{"_BCT", 1, ACPI_RTYPE_INTEGER}}, |
| 204 | {{"_BDN", 0, ACPI_RTYPE_INTEGER}}, | 204 | {{"_BDN", 0, ACPI_RTYPE_INTEGER}}, |
| 205 | {{"_BFS", 1, 0}}, | 205 | {{"_BFS", 1, 0}}, |
| 206 | {{"_BIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (9 Int),(4 Str) */ | 206 | {{"_BIF", 0, ACPI_RTYPE_PACKAGE} }, /* Fixed-length (9 Int),(4 Str/Buf) */ |
| 207 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING}, 4,0}}, | 207 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, |
| 208 | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER}, 4, 0} }, | ||
| 208 | 209 | ||
| 209 | {{"_BIX", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int),(4 Str) */ | 210 | {{"_BIX", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int),(4 Str) */ |
| 210 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4, | 211 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4, |
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index 3a54b737d2da..2bd83ac57c3a 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c | |||
| @@ -77,7 +77,8 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
| 77 | void *logical_addr_ptr = NULL; | 77 | void *logical_addr_ptr = NULL; |
| 78 | struct acpi_mem_space_context *mem_info = region_context; | 78 | struct acpi_mem_space_context *mem_info = region_context; |
| 79 | u32 length; | 79 | u32 length; |
| 80 | acpi_size window_size; | 80 | acpi_size map_length; |
| 81 | acpi_size page_boundary_map_length; | ||
| 81 | #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED | 82 | #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED |
| 82 | u32 remainder; | 83 | u32 remainder; |
| 83 | #endif | 84 | #endif |
| @@ -144,25 +145,39 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
| 144 | } | 145 | } |
| 145 | 146 | ||
| 146 | /* | 147 | /* |
| 147 | * Don't attempt to map memory beyond the end of the region, and | 148 | * Attempt to map from the requested address to the end of the region. |
| 148 | * constrain the maximum mapping size to something reasonable. | 149 | * However, we will never map more than one page, nor will we cross |
| 150 | * a page boundary. | ||
| 149 | */ | 151 | */ |
| 150 | window_size = (acpi_size) | 152 | map_length = (acpi_size) |
| 151 | ((mem_info->address + mem_info->length) - address); | 153 | ((mem_info->address + mem_info->length) - address); |
| 152 | 154 | ||
| 153 | if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { | 155 | /* |
| 154 | window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; | 156 | * If mapping the entire remaining portion of the region will cross |
| 157 | * a page boundary, just map up to the page boundary, do not cross. | ||
| 158 | * On some systems, crossing a page boundary while mapping regions | ||
| 159 | * can cause warnings if the pages have different attributes | ||
| 160 | * due to resource management | ||
| 161 | */ | ||
| 162 | page_boundary_map_length = | ||
| 163 | ACPI_ROUND_UP(address, ACPI_DEFAULT_PAGE_SIZE) - address; | ||
| 164 | |||
| 165 | if (!page_boundary_map_length) { | ||
| 166 | page_boundary_map_length = ACPI_DEFAULT_PAGE_SIZE; | ||
| 167 | } | ||
| 168 | |||
| 169 | if (map_length > page_boundary_map_length) { | ||
| 170 | map_length = page_boundary_map_length; | ||
| 155 | } | 171 | } |
| 156 | 172 | ||
| 157 | /* Create a new mapping starting at the address given */ | 173 | /* Create a new mapping starting at the address given */ |
| 158 | 174 | ||
| 159 | mem_info->mapped_logical_address = | 175 | mem_info->mapped_logical_address = acpi_os_map_memory((acpi_physical_address) address, map_length); |
| 160 | acpi_os_map_memory((acpi_physical_address) address, window_size); | ||
| 161 | if (!mem_info->mapped_logical_address) { | 176 | if (!mem_info->mapped_logical_address) { |
| 162 | ACPI_ERROR((AE_INFO, | 177 | ACPI_ERROR((AE_INFO, |
| 163 | "Could not map memory at %8.8X%8.8X, size %X", | 178 | "Could not map memory at %8.8X%8.8X, size %X", |
| 164 | ACPI_FORMAT_NATIVE_UINT(address), | 179 | ACPI_FORMAT_NATIVE_UINT(address), |
| 165 | (u32) window_size)); | 180 | (u32) map_length)); |
| 166 | mem_info->mapped_length = 0; | 181 | mem_info->mapped_length = 0; |
| 167 | return_ACPI_STATUS(AE_NO_MEMORY); | 182 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 168 | } | 183 | } |
| @@ -170,7 +185,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
| 170 | /* Save the physical address and mapping size */ | 185 | /* Save the physical address and mapping size */ |
| 171 | 186 | ||
| 172 | mem_info->mapped_physical_address = address; | 187 | mem_info->mapped_physical_address = address; |
| 173 | mem_info->mapped_length = window_size; | 188 | mem_info->mapped_length = map_length; |
| 174 | } | 189 | } |
| 175 | 190 | ||
| 176 | /* | 191 | /* |
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index e56b2a7b53db..23e5a0519af5 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
| @@ -224,6 +224,7 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
| 224 | * _OSI(Linux) helps sound | 224 | * _OSI(Linux) helps sound |
| 225 | * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"), | 225 | * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"), |
| 226 | * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"), | 226 | * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"), |
| 227 | * T400, T500 | ||
| 227 | * _OSI(Linux) has Linux specific hooks | 228 | * _OSI(Linux) has Linux specific hooks |
| 228 | * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"), | 229 | * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"), |
| 229 | * _OSI(Linux) is a NOP: | 230 | * _OSI(Linux) is a NOP: |
| @@ -254,6 +255,22 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
| 254 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"), | 255 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"), |
| 255 | }, | 256 | }, |
| 256 | }, | 257 | }, |
| 258 | { | ||
| 259 | .callback = dmi_enable_osi_linux, | ||
| 260 | .ident = "Lenovo ThinkPad T400", | ||
| 261 | .matches = { | ||
| 262 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
| 263 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T400"), | ||
| 264 | }, | ||
| 265 | }, | ||
| 266 | { | ||
| 267 | .callback = dmi_enable_osi_linux, | ||
| 268 | .ident = "Lenovo ThinkPad T500", | ||
| 269 | .matches = { | ||
| 270 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
| 271 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T500"), | ||
| 272 | }, | ||
| 273 | }, | ||
| 257 | {} | 274 | {} |
| 258 | }; | 275 | }; |
| 259 | 276 | ||
diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c index e6bfd77986b8..2ef7030a0c28 100644 --- a/drivers/acpi/power_meter.c +++ b/drivers/acpi/power_meter.c | |||
| @@ -294,7 +294,11 @@ static int set_acpi_trip(struct acpi_power_meter_resource *resource) | |||
| 294 | return -EINVAL; | 294 | return -EINVAL; |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | return data; | 297 | /* _PTP returns 0 on success, nonzero otherwise */ |
| 298 | if (data) | ||
| 299 | return -EINVAL; | ||
| 300 | |||
| 301 | return 0; | ||
| 298 | } | 302 | } |
| 299 | 303 | ||
| 300 | static ssize_t set_trip(struct device *dev, struct device_attribute *devattr, | 304 | static ssize_t set_trip(struct device *dev, struct device_attribute *devattr, |
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index f8b6f555ba52..d0d25e2e1ced 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
| @@ -393,7 +393,7 @@ acpi_system_write_wakeup_device(struct file *file, | |||
| 393 | struct list_head *node, *next; | 393 | struct list_head *node, *next; |
| 394 | char strbuf[5]; | 394 | char strbuf[5]; |
| 395 | char str[5] = ""; | 395 | char str[5] = ""; |
| 396 | int len = count; | 396 | unsigned int len = count; |
| 397 | struct acpi_device *found_dev = NULL; | 397 | struct acpi_device *found_dev = NULL; |
| 398 | 398 | ||
| 399 | if (len > 4) | 399 | if (len > 4) |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index c567b46dfa0f..ec742a4e5635 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -770,7 +770,7 @@ static struct notifier_block acpi_cpu_notifier = | |||
| 770 | .notifier_call = acpi_cpu_soft_notify, | 770 | .notifier_call = acpi_cpu_soft_notify, |
| 771 | }; | 771 | }; |
| 772 | 772 | ||
| 773 | static int acpi_processor_add(struct acpi_device *device) | 773 | static int __cpuinit acpi_processor_add(struct acpi_device *device) |
| 774 | { | 774 | { |
| 775 | struct acpi_processor *pr = NULL; | 775 | struct acpi_processor *pr = NULL; |
| 776 | int result = 0; | 776 | int result = 0; |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 4c6c14c1e307..1c5d7a8b2fdf 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
| @@ -1133,15 +1133,15 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
| 1133 | int result = 0; | 1133 | int result = 0; |
| 1134 | struct acpi_processor_throttling *pthrottling; | 1134 | struct acpi_processor_throttling *pthrottling; |
| 1135 | 1135 | ||
| 1136 | if (!pr) | ||
| 1137 | return -EINVAL; | ||
| 1138 | |||
| 1136 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1139 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 1137 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", | 1140 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", |
| 1138 | pr->throttling.address, | 1141 | pr->throttling.address, |
| 1139 | pr->throttling.duty_offset, | 1142 | pr->throttling.duty_offset, |
| 1140 | pr->throttling.duty_width)); | 1143 | pr->throttling.duty_width)); |
| 1141 | 1144 | ||
| 1142 | if (!pr) | ||
| 1143 | return -EINVAL; | ||
| 1144 | |||
| 1145 | /* | 1145 | /* |
| 1146 | * Evaluate _PTC, _TSS and _TPC | 1146 | * Evaluate _PTC, _TSS and _TPC |
| 1147 | * They must all be present or none of them can be used. | 1147 | * They must all be present or none of them can be used. |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index a90afcc723ab..5f2c379ab7bf 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
| @@ -413,6 +413,38 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | |||
| 413 | }, | 413 | }, |
| 414 | }, | 414 | }, |
| 415 | { | 415 | { |
| 416 | .callback = init_set_sci_en_on_resume, | ||
| 417 | .ident = "Hewlett-Packard Pavilion dv4", | ||
| 418 | .matches = { | ||
| 419 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
| 420 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4"), | ||
| 421 | }, | ||
| 422 | }, | ||
| 423 | { | ||
| 424 | .callback = init_set_sci_en_on_resume, | ||
| 425 | .ident = "Hewlett-Packard Pavilion dv7", | ||
| 426 | .matches = { | ||
| 427 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
| 428 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv7"), | ||
| 429 | }, | ||
| 430 | }, | ||
| 431 | { | ||
| 432 | .callback = init_set_sci_en_on_resume, | ||
| 433 | .ident = "Hewlett-Packard Compaq Presario C700 Notebook PC", | ||
| 434 | .matches = { | ||
| 435 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
| 436 | DMI_MATCH(DMI_PRODUCT_NAME, "Compaq Presario C700 Notebook PC"), | ||
| 437 | }, | ||
| 438 | }, | ||
| 439 | { | ||
| 440 | .callback = init_set_sci_en_on_resume, | ||
| 441 | .ident = "Hewlett-Packard Compaq Presario CQ40 Notebook PC", | ||
| 442 | .matches = { | ||
| 443 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
| 444 | DMI_MATCH(DMI_PRODUCT_NAME, "Compaq Presario CQ40 Notebook PC"), | ||
| 445 | }, | ||
| 446 | }, | ||
| 447 | { | ||
| 416 | .callback = init_old_suspend_ordering, | 448 | .callback = init_old_suspend_ordering, |
| 417 | .ident = "Panasonic CF51-2L", | 449 | .ident = "Panasonic CF51-2L", |
| 418 | .matches = { | 450 | .matches = { |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 64e3c581b7a9..05dff631591c 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -1223,7 +1223,7 @@ acpi_video_device_write_state(struct file *file, | |||
| 1223 | u32 state = 0; | 1223 | u32 state = 0; |
| 1224 | 1224 | ||
| 1225 | 1225 | ||
| 1226 | if (!dev || count + 1 > sizeof str) | 1226 | if (!dev || count >= sizeof(str)) |
| 1227 | return -EINVAL; | 1227 | return -EINVAL; |
| 1228 | 1228 | ||
| 1229 | if (copy_from_user(str, buffer, count)) | 1229 | if (copy_from_user(str, buffer, count)) |
| @@ -1280,7 +1280,7 @@ acpi_video_device_write_brightness(struct file *file, | |||
| 1280 | int i; | 1280 | int i; |
| 1281 | 1281 | ||
| 1282 | 1282 | ||
| 1283 | if (!dev || !dev->brightness || count + 1 > sizeof str) | 1283 | if (!dev || !dev->brightness || count >= sizeof(str)) |
| 1284 | return -EINVAL; | 1284 | return -EINVAL; |
| 1285 | 1285 | ||
| 1286 | if (copy_from_user(str, buffer, count)) | 1286 | if (copy_from_user(str, buffer, count)) |
| @@ -1562,7 +1562,7 @@ acpi_video_bus_write_POST(struct file *file, | |||
| 1562 | unsigned long long opt, options; | 1562 | unsigned long long opt, options; |
| 1563 | 1563 | ||
| 1564 | 1564 | ||
| 1565 | if (!video || count + 1 > sizeof str) | 1565 | if (!video || count >= sizeof(str)) |
| 1566 | return -EINVAL; | 1566 | return -EINVAL; |
| 1567 | 1567 | ||
| 1568 | status = acpi_video_bus_POST_options(video, &options); | 1568 | status = acpi_video_bus_POST_options(video, &options); |
| @@ -1602,7 +1602,7 @@ acpi_video_bus_write_DOS(struct file *file, | |||
| 1602 | unsigned long opt; | 1602 | unsigned long opt; |
| 1603 | 1603 | ||
| 1604 | 1604 | ||
| 1605 | if (!video || count + 1 > sizeof str) | 1605 | if (!video || count >= sizeof(str)) |
| 1606 | return -EINVAL; | 1606 | return -EINVAL; |
| 1607 | 1607 | ||
| 1608 | if (copy_from_user(str, buffer, count)) | 1608 | if (copy_from_user(str, buffer, count)) |
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index dc99e26f8e5b..1b392c9e8531 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
| @@ -177,9 +177,6 @@ static struct ata_port_operations pcmcia_8bit_port_ops = { | |||
| 177 | .drain_fifo = pcmcia_8bit_drain_fifo, | 177 | .drain_fifo = pcmcia_8bit_drain_fifo, |
| 178 | }; | 178 | }; |
| 179 | 179 | ||
| 180 | #define CS_CHECK(fn, ret) \ | ||
| 181 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 182 | |||
| 183 | 180 | ||
| 184 | struct pcmcia_config_check { | 181 | struct pcmcia_config_check { |
| 185 | unsigned long ctl_base; | 182 | unsigned long ctl_base; |
| @@ -252,7 +249,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) | |||
| 252 | struct ata_port *ap; | 249 | struct ata_port *ap; |
| 253 | struct ata_pcmcia_info *info; | 250 | struct ata_pcmcia_info *info; |
| 254 | struct pcmcia_config_check *stk = NULL; | 251 | struct pcmcia_config_check *stk = NULL; |
| 255 | int last_ret = 0, last_fn = 0, is_kme = 0, ret = -ENOMEM, p; | 252 | int is_kme = 0, ret = -ENOMEM, p; |
| 256 | unsigned long io_base, ctl_base; | 253 | unsigned long io_base, ctl_base; |
| 257 | void __iomem *io_addr, *ctl_addr; | 254 | void __iomem *io_addr, *ctl_addr; |
| 258 | int n_ports = 1; | 255 | int n_ports = 1; |
| @@ -271,7 +268,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) | |||
| 271 | pdev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 268 | pdev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
| 272 | pdev->io.IOAddrLines = 3; | 269 | pdev->io.IOAddrLines = 3; |
| 273 | pdev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 270 | pdev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 274 | pdev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 275 | pdev->conf.Attributes = CONF_ENABLE_IRQ; | 271 | pdev->conf.Attributes = CONF_ENABLE_IRQ; |
| 276 | pdev->conf.IntType = INT_MEMORY_AND_IO; | 272 | pdev->conf.IntType = INT_MEMORY_AND_IO; |
| 277 | 273 | ||
| @@ -296,8 +292,13 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) | |||
| 296 | } | 292 | } |
| 297 | io_base = pdev->io.BasePort1; | 293 | io_base = pdev->io.BasePort1; |
| 298 | ctl_base = stk->ctl_base; | 294 | ctl_base = stk->ctl_base; |
| 299 | CS_CHECK(RequestIRQ, pcmcia_request_irq(pdev, &pdev->irq)); | 295 | ret = pcmcia_request_irq(pdev, &pdev->irq); |
| 300 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(pdev, &pdev->conf)); | 296 | if (ret) |
| 297 | goto failed; | ||
| 298 | |||
| 299 | ret = pcmcia_request_configuration(pdev, &pdev->conf); | ||
| 300 | if (ret) | ||
| 301 | goto failed; | ||
| 301 | 302 | ||
| 302 | /* iomap */ | 303 | /* iomap */ |
| 303 | ret = -ENOMEM; | 304 | ret = -ENOMEM; |
| @@ -351,8 +352,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) | |||
| 351 | kfree(stk); | 352 | kfree(stk); |
| 352 | return 0; | 353 | return 0; |
| 353 | 354 | ||
| 354 | cs_failed: | ||
| 355 | cs_error(pdev, last_fn, last_ret); | ||
| 356 | failed: | 355 | failed: |
| 357 | kfree(stk); | 356 | kfree(stk); |
| 358 | info->ndev = 0; | 357 | info->ndev = 0; |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index d344db42a002..172b57e6543f 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
| @@ -707,34 +707,17 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap) | |||
| 707 | return ata_dev_classify(&tf); | 707 | return ata_dev_classify(&tf); |
| 708 | } | 708 | } |
| 709 | 709 | ||
| 710 | static int sata_fsl_prereset(struct ata_link *link, unsigned long deadline) | 710 | static int sata_fsl_hardreset(struct ata_link *link, unsigned int *class, |
| 711 | { | ||
| 712 | /* FIXME: Never skip softreset, sata_fsl_softreset() is | ||
| 713 | * combination of soft and hard resets. sata_fsl_softreset() | ||
| 714 | * needs to be splitted into soft and hard resets. | ||
| 715 | */ | ||
| 716 | return 0; | ||
| 717 | } | ||
| 718 | |||
| 719 | static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, | ||
| 720 | unsigned long deadline) | 711 | unsigned long deadline) |
| 721 | { | 712 | { |
| 722 | struct ata_port *ap = link->ap; | 713 | struct ata_port *ap = link->ap; |
| 723 | struct sata_fsl_port_priv *pp = ap->private_data; | ||
| 724 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 714 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
| 725 | void __iomem *hcr_base = host_priv->hcr_base; | 715 | void __iomem *hcr_base = host_priv->hcr_base; |
| 726 | int pmp = sata_srst_pmp(link); | ||
| 727 | u32 temp; | 716 | u32 temp; |
| 728 | struct ata_taskfile tf; | ||
| 729 | u8 *cfis; | ||
| 730 | u32 Serror; | ||
| 731 | int i = 0; | 717 | int i = 0; |
| 732 | unsigned long start_jiffies; | 718 | unsigned long start_jiffies; |
| 733 | 719 | ||
| 734 | DPRINTK("in xx_softreset\n"); | 720 | DPRINTK("in xx_hardreset\n"); |
| 735 | |||
| 736 | if (pmp != SATA_PMP_CTRL_PORT) | ||
| 737 | goto issue_srst; | ||
| 738 | 721 | ||
| 739 | try_offline_again: | 722 | try_offline_again: |
| 740 | /* | 723 | /* |
| @@ -749,7 +732,7 @@ try_offline_again: | |||
| 749 | 732 | ||
| 750 | if (temp & ONLINE) { | 733 | if (temp & ONLINE) { |
| 751 | ata_port_printk(ap, KERN_ERR, | 734 | ata_port_printk(ap, KERN_ERR, |
| 752 | "Softreset failed, not off-lined %d\n", i); | 735 | "Hardreset failed, not off-lined %d\n", i); |
| 753 | 736 | ||
| 754 | /* | 737 | /* |
| 755 | * Try to offline controller atleast twice | 738 | * Try to offline controller atleast twice |
| @@ -761,7 +744,7 @@ try_offline_again: | |||
| 761 | goto try_offline_again; | 744 | goto try_offline_again; |
| 762 | } | 745 | } |
| 763 | 746 | ||
| 764 | DPRINTK("softreset, controller off-lined\n"); | 747 | DPRINTK("hardreset, controller off-lined\n"); |
| 765 | VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS)); | 748 | VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS)); |
| 766 | VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); | 749 | VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); |
| 767 | 750 | ||
| @@ -786,11 +769,11 @@ try_offline_again: | |||
| 786 | 769 | ||
| 787 | if (!(temp & ONLINE)) { | 770 | if (!(temp & ONLINE)) { |
| 788 | ata_port_printk(ap, KERN_ERR, | 771 | ata_port_printk(ap, KERN_ERR, |
| 789 | "Softreset failed, not on-lined\n"); | 772 | "Hardreset failed, not on-lined\n"); |
| 790 | goto err; | 773 | goto err; |
| 791 | } | 774 | } |
| 792 | 775 | ||
| 793 | DPRINTK("softreset, controller off-lined & on-lined\n"); | 776 | DPRINTK("hardreset, controller off-lined & on-lined\n"); |
| 794 | VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS)); | 777 | VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS)); |
| 795 | VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); | 778 | VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); |
| 796 | 779 | ||
| @@ -806,7 +789,7 @@ try_offline_again: | |||
| 806 | "No Device OR PHYRDY change,Hstatus = 0x%x\n", | 789 | "No Device OR PHYRDY change,Hstatus = 0x%x\n", |
| 807 | ioread32(hcr_base + HSTATUS)); | 790 | ioread32(hcr_base + HSTATUS)); |
| 808 | *class = ATA_DEV_NONE; | 791 | *class = ATA_DEV_NONE; |
| 809 | goto out; | 792 | return 0; |
| 810 | } | 793 | } |
| 811 | 794 | ||
| 812 | /* | 795 | /* |
| @@ -819,11 +802,44 @@ try_offline_again: | |||
| 819 | if ((temp & 0xFF) != 0x18) { | 802 | if ((temp & 0xFF) != 0x18) { |
| 820 | ata_port_printk(ap, KERN_WARNING, "No Signature Update\n"); | 803 | ata_port_printk(ap, KERN_WARNING, "No Signature Update\n"); |
| 821 | *class = ATA_DEV_NONE; | 804 | *class = ATA_DEV_NONE; |
| 822 | goto out; | 805 | goto do_followup_srst; |
| 823 | } else { | 806 | } else { |
| 824 | ata_port_printk(ap, KERN_INFO, | 807 | ata_port_printk(ap, KERN_INFO, |
| 825 | "Signature Update detected @ %d msecs\n", | 808 | "Signature Update detected @ %d msecs\n", |
| 826 | jiffies_to_msecs(jiffies - start_jiffies)); | 809 | jiffies_to_msecs(jiffies - start_jiffies)); |
| 810 | *class = sata_fsl_dev_classify(ap); | ||
| 811 | return 0; | ||
| 812 | } | ||
| 813 | |||
| 814 | do_followup_srst: | ||
| 815 | /* | ||
| 816 | * request libATA to perform follow-up softreset | ||
| 817 | */ | ||
| 818 | return -EAGAIN; | ||
| 819 | |||
| 820 | err: | ||
| 821 | return -EIO; | ||
| 822 | } | ||
| 823 | |||
| 824 | static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, | ||
| 825 | unsigned long deadline) | ||
| 826 | { | ||
| 827 | struct ata_port *ap = link->ap; | ||
| 828 | struct sata_fsl_port_priv *pp = ap->private_data; | ||
| 829 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | ||
| 830 | void __iomem *hcr_base = host_priv->hcr_base; | ||
| 831 | int pmp = sata_srst_pmp(link); | ||
| 832 | u32 temp; | ||
| 833 | struct ata_taskfile tf; | ||
| 834 | u8 *cfis; | ||
| 835 | u32 Serror; | ||
| 836 | |||
| 837 | DPRINTK("in xx_softreset\n"); | ||
| 838 | |||
| 839 | if (ata_link_offline(link)) { | ||
| 840 | DPRINTK("PHY reports no device\n"); | ||
| 841 | *class = ATA_DEV_NONE; | ||
| 842 | return 0; | ||
| 827 | } | 843 | } |
| 828 | 844 | ||
| 829 | /* | 845 | /* |
| @@ -834,7 +850,6 @@ try_offline_again: | |||
| 834 | * reached here, we can send a command to the target device | 850 | * reached here, we can send a command to the target device |
| 835 | */ | 851 | */ |
| 836 | 852 | ||
| 837 | issue_srst: | ||
| 838 | DPRINTK("Sending SRST/device reset\n"); | 853 | DPRINTK("Sending SRST/device reset\n"); |
| 839 | 854 | ||
| 840 | ata_tf_init(link->device, &tf); | 855 | ata_tf_init(link->device, &tf); |
| @@ -860,6 +875,8 @@ issue_srst: | |||
| 860 | ioread32(CA + hcr_base), ioread32(CC + hcr_base)); | 875 | ioread32(CA + hcr_base), ioread32(CC + hcr_base)); |
| 861 | 876 | ||
| 862 | iowrite32(0xFFFF, CC + hcr_base); | 877 | iowrite32(0xFFFF, CC + hcr_base); |
| 878 | if (pmp != SATA_PMP_CTRL_PORT) | ||
| 879 | iowrite32(pmp, CQPMP + hcr_base); | ||
| 863 | iowrite32(1, CQ + hcr_base); | 880 | iowrite32(1, CQ + hcr_base); |
| 864 | 881 | ||
| 865 | temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000); | 882 | temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000); |
| @@ -926,7 +943,6 @@ issue_srst: | |||
| 926 | VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE)); | 943 | VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE)); |
| 927 | } | 944 | } |
| 928 | 945 | ||
| 929 | out: | ||
| 930 | return 0; | 946 | return 0; |
| 931 | 947 | ||
| 932 | err: | 948 | err: |
| @@ -988,18 +1004,6 @@ static void sata_fsl_error_intr(struct ata_port *ap) | |||
| 988 | ehi->err_mask |= AC_ERR_ATA_BUS; | 1004 | ehi->err_mask |= AC_ERR_ATA_BUS; |
| 989 | ehi->action |= ATA_EH_SOFTRESET; | 1005 | ehi->action |= ATA_EH_SOFTRESET; |
| 990 | 1006 | ||
| 991 | /* | ||
| 992 | * Ignore serror in case of fatal errors as we always want | ||
| 993 | * to do a soft-reset of the FSL SATA controller. Analyzing | ||
| 994 | * serror may cause libata to schedule a hard-reset action, | ||
| 995 | * and hard-reset currently does not do controller | ||
| 996 | * offline/online, causing command timeouts and leads to an | ||
| 997 | * un-recoverable state, hence make libATA ignore | ||
| 998 | * autopsy in case of fatal errors. | ||
| 999 | */ | ||
| 1000 | |||
| 1001 | ehi->flags |= ATA_EHI_NO_AUTOPSY; | ||
| 1002 | |||
| 1003 | freeze = 1; | 1007 | freeze = 1; |
| 1004 | } | 1008 | } |
| 1005 | 1009 | ||
| @@ -1267,8 +1271,8 @@ static struct ata_port_operations sata_fsl_ops = { | |||
| 1267 | 1271 | ||
| 1268 | .freeze = sata_fsl_freeze, | 1272 | .freeze = sata_fsl_freeze, |
| 1269 | .thaw = sata_fsl_thaw, | 1273 | .thaw = sata_fsl_thaw, |
| 1270 | .prereset = sata_fsl_prereset, | ||
| 1271 | .softreset = sata_fsl_softreset, | 1274 | .softreset = sata_fsl_softreset, |
| 1275 | .hardreset = sata_fsl_hardreset, | ||
| 1272 | .pmp_softreset = sata_fsl_softreset, | 1276 | .pmp_softreset = sata_fsl_softreset, |
| 1273 | .error_handler = sata_fsl_error_handler, | 1277 | .error_handler = sata_fsl_error_handler, |
| 1274 | .post_internal_cmd = sata_fsl_post_internal_cmd, | 1278 | .post_internal_cmd = sata_fsl_post_internal_cmd, |
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index a770498a74ec..846d89e3d122 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
| @@ -328,11 +328,11 @@ int __pm_runtime_resume(struct device *dev, bool from_wq) | |||
| 328 | * necessary. | 328 | * necessary. |
| 329 | */ | 329 | */ |
| 330 | parent = dev->parent; | 330 | parent = dev->parent; |
| 331 | spin_unlock_irq(&dev->power.lock); | 331 | spin_unlock(&dev->power.lock); |
| 332 | 332 | ||
| 333 | pm_runtime_get_noresume(parent); | 333 | pm_runtime_get_noresume(parent); |
| 334 | 334 | ||
| 335 | spin_lock_irq(&parent->power.lock); | 335 | spin_lock(&parent->power.lock); |
| 336 | /* | 336 | /* |
| 337 | * We can resume if the parent's run-time PM is disabled or it | 337 | * We can resume if the parent's run-time PM is disabled or it |
| 338 | * is set to ignore children. | 338 | * is set to ignore children. |
| @@ -343,9 +343,9 @@ int __pm_runtime_resume(struct device *dev, bool from_wq) | |||
| 343 | if (parent->power.runtime_status != RPM_ACTIVE) | 343 | if (parent->power.runtime_status != RPM_ACTIVE) |
| 344 | retval = -EBUSY; | 344 | retval = -EBUSY; |
| 345 | } | 345 | } |
| 346 | spin_unlock_irq(&parent->power.lock); | 346 | spin_unlock(&parent->power.lock); |
| 347 | 347 | ||
| 348 | spin_lock_irq(&dev->power.lock); | 348 | spin_lock(&dev->power.lock); |
| 349 | if (retval) | 349 | if (retval) |
| 350 | goto out; | 350 | goto out; |
| 351 | goto repeat; | 351 | goto repeat; |
| @@ -777,7 +777,7 @@ int __pm_runtime_set_status(struct device *dev, unsigned int status) | |||
| 777 | } | 777 | } |
| 778 | 778 | ||
| 779 | if (parent) { | 779 | if (parent) { |
| 780 | spin_lock_irq(&parent->power.lock); | 780 | spin_lock(&parent->power.lock); |
| 781 | 781 | ||
| 782 | /* | 782 | /* |
| 783 | * It is invalid to put an active child under a parent that is | 783 | * It is invalid to put an active child under a parent that is |
| @@ -793,7 +793,7 @@ int __pm_runtime_set_status(struct device *dev, unsigned int status) | |||
| 793 | atomic_inc(&parent->power.child_count); | 793 | atomic_inc(&parent->power.child_count); |
| 794 | } | 794 | } |
| 795 | 795 | ||
| 796 | spin_unlock_irq(&parent->power.lock); | 796 | spin_unlock(&parent->power.lock); |
| 797 | 797 | ||
| 798 | if (error) | 798 | if (error) |
| 799 | goto out; | 799 | goto out; |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 965ece2c7e4d..13bb69d2abb3 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
| @@ -735,6 +735,21 @@ diskstats(struct gendisk *disk, struct bio *bio, ulong duration, sector_t sector | |||
| 735 | part_stat_unlock(); | 735 | part_stat_unlock(); |
| 736 | } | 736 | } |
| 737 | 737 | ||
| 738 | /* | ||
| 739 | * Ensure we don't create aliases in VI caches | ||
| 740 | */ | ||
| 741 | static inline void | ||
| 742 | killalias(struct bio *bio) | ||
| 743 | { | ||
| 744 | struct bio_vec *bv; | ||
| 745 | int i; | ||
| 746 | |||
| 747 | if (bio_data_dir(bio) == READ) | ||
| 748 | __bio_for_each_segment(bv, bio, i, 0) { | ||
| 749 | flush_dcache_page(bv->bv_page); | ||
| 750 | } | ||
| 751 | } | ||
| 752 | |||
| 738 | void | 753 | void |
| 739 | aoecmd_ata_rsp(struct sk_buff *skb) | 754 | aoecmd_ata_rsp(struct sk_buff *skb) |
| 740 | { | 755 | { |
| @@ -853,8 +868,12 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
| 853 | 868 | ||
| 854 | if (buf && --buf->nframesout == 0 && buf->resid == 0) { | 869 | if (buf && --buf->nframesout == 0 && buf->resid == 0) { |
| 855 | diskstats(d->gd, buf->bio, jiffies - buf->stime, buf->sector); | 870 | diskstats(d->gd, buf->bio, jiffies - buf->stime, buf->sector); |
| 856 | n = (buf->flags & BUFFL_FAIL) ? -EIO : 0; | 871 | if (buf->flags & BUFFL_FAIL) |
| 857 | bio_endio(buf->bio, n); | 872 | bio_endio(buf->bio, -EIO); |
| 873 | else { | ||
| 874 | killalias(buf->bio); | ||
| 875 | bio_endio(buf->bio, 0); | ||
| 876 | } | ||
| 858 | mempool_free(buf, d->bufpool); | 877 | mempool_free(buf, d->bufpool); |
| 859 | } | 878 | } |
| 860 | 879 | ||
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 6399e5090df4..92b126394fa1 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
| @@ -482,7 +482,7 @@ static ssize_t host_store_rescan(struct device *dev, | |||
| 482 | 482 | ||
| 483 | return count; | 483 | return count; |
| 484 | } | 484 | } |
| 485 | DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); | 485 | static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); |
| 486 | 486 | ||
| 487 | static ssize_t dev_show_unique_id(struct device *dev, | 487 | static ssize_t dev_show_unique_id(struct device *dev, |
| 488 | struct device_attribute *attr, | 488 | struct device_attribute *attr, |
| @@ -512,7 +512,7 @@ static ssize_t dev_show_unique_id(struct device *dev, | |||
| 512 | sn[8], sn[9], sn[10], sn[11], | 512 | sn[8], sn[9], sn[10], sn[11], |
| 513 | sn[12], sn[13], sn[14], sn[15]); | 513 | sn[12], sn[13], sn[14], sn[15]); |
| 514 | } | 514 | } |
| 515 | DEVICE_ATTR(unique_id, S_IRUGO, dev_show_unique_id, NULL); | 515 | static DEVICE_ATTR(unique_id, S_IRUGO, dev_show_unique_id, NULL); |
| 516 | 516 | ||
| 517 | static ssize_t dev_show_vendor(struct device *dev, | 517 | static ssize_t dev_show_vendor(struct device *dev, |
| 518 | struct device_attribute *attr, | 518 | struct device_attribute *attr, |
| @@ -536,7 +536,7 @@ static ssize_t dev_show_vendor(struct device *dev, | |||
| 536 | else | 536 | else |
| 537 | return snprintf(buf, sizeof(vendor) + 1, "%s\n", drv->vendor); | 537 | return snprintf(buf, sizeof(vendor) + 1, "%s\n", drv->vendor); |
| 538 | } | 538 | } |
| 539 | DEVICE_ATTR(vendor, S_IRUGO, dev_show_vendor, NULL); | 539 | static DEVICE_ATTR(vendor, S_IRUGO, dev_show_vendor, NULL); |
| 540 | 540 | ||
| 541 | static ssize_t dev_show_model(struct device *dev, | 541 | static ssize_t dev_show_model(struct device *dev, |
| 542 | struct device_attribute *attr, | 542 | struct device_attribute *attr, |
| @@ -560,7 +560,7 @@ static ssize_t dev_show_model(struct device *dev, | |||
| 560 | else | 560 | else |
| 561 | return snprintf(buf, sizeof(model) + 1, "%s\n", drv->model); | 561 | return snprintf(buf, sizeof(model) + 1, "%s\n", drv->model); |
| 562 | } | 562 | } |
| 563 | DEVICE_ATTR(model, S_IRUGO, dev_show_model, NULL); | 563 | static DEVICE_ATTR(model, S_IRUGO, dev_show_model, NULL); |
| 564 | 564 | ||
| 565 | static ssize_t dev_show_rev(struct device *dev, | 565 | static ssize_t dev_show_rev(struct device *dev, |
| 566 | struct device_attribute *attr, | 566 | struct device_attribute *attr, |
| @@ -584,7 +584,7 @@ static ssize_t dev_show_rev(struct device *dev, | |||
| 584 | else | 584 | else |
| 585 | return snprintf(buf, sizeof(rev) + 1, "%s\n", drv->rev); | 585 | return snprintf(buf, sizeof(rev) + 1, "%s\n", drv->rev); |
| 586 | } | 586 | } |
| 587 | DEVICE_ATTR(rev, S_IRUGO, dev_show_rev, NULL); | 587 | static DEVICE_ATTR(rev, S_IRUGO, dev_show_rev, NULL); |
| 588 | 588 | ||
| 589 | static ssize_t cciss_show_lunid(struct device *dev, | 589 | static ssize_t cciss_show_lunid(struct device *dev, |
| 590 | struct device_attribute *attr, char *buf) | 590 | struct device_attribute *attr, char *buf) |
| @@ -609,7 +609,7 @@ static ssize_t cciss_show_lunid(struct device *dev, | |||
| 609 | lunid[0], lunid[1], lunid[2], lunid[3], | 609 | lunid[0], lunid[1], lunid[2], lunid[3], |
| 610 | lunid[4], lunid[5], lunid[6], lunid[7]); | 610 | lunid[4], lunid[5], lunid[6], lunid[7]); |
| 611 | } | 611 | } |
| 612 | DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL); | 612 | static DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL); |
| 613 | 613 | ||
| 614 | static ssize_t cciss_show_raid_level(struct device *dev, | 614 | static ssize_t cciss_show_raid_level(struct device *dev, |
| 615 | struct device_attribute *attr, char *buf) | 615 | struct device_attribute *attr, char *buf) |
| @@ -632,7 +632,7 @@ static ssize_t cciss_show_raid_level(struct device *dev, | |||
| 632 | return snprintf(buf, strlen(raid_label[raid]) + 7, "RAID %s\n", | 632 | return snprintf(buf, strlen(raid_label[raid]) + 7, "RAID %s\n", |
| 633 | raid_label[raid]); | 633 | raid_label[raid]); |
| 634 | } | 634 | } |
| 635 | DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL); | 635 | static DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL); |
| 636 | 636 | ||
| 637 | static ssize_t cciss_show_usage_count(struct device *dev, | 637 | static ssize_t cciss_show_usage_count(struct device *dev, |
| 638 | struct device_attribute *attr, char *buf) | 638 | struct device_attribute *attr, char *buf) |
| @@ -651,7 +651,7 @@ static ssize_t cciss_show_usage_count(struct device *dev, | |||
| 651 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | 651 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); |
| 652 | return snprintf(buf, 20, "%d\n", count); | 652 | return snprintf(buf, 20, "%d\n", count); |
| 653 | } | 653 | } |
| 654 | DEVICE_ATTR(usage_count, S_IRUGO, cciss_show_usage_count, NULL); | 654 | static DEVICE_ATTR(usage_count, S_IRUGO, cciss_show_usage_count, NULL); |
| 655 | 655 | ||
| 656 | static struct attribute *cciss_host_attrs[] = { | 656 | static struct attribute *cciss_host_attrs[] = { |
| 657 | &dev_attr_rescan.attr, | 657 | &dev_attr_rescan.attr, |
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index b0e569ba730d..2acdc605cb4b 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
| @@ -867,11 +867,9 @@ static int bluecard_probe(struct pcmcia_device *link) | |||
| 867 | 867 | ||
| 868 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 868 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 869 | link->io.NumPorts1 = 8; | 869 | link->io.NumPorts1 = 8; |
| 870 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 870 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 871 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 872 | 871 | ||
| 873 | link->irq.Handler = bluecard_interrupt; | 872 | link->irq.Handler = bluecard_interrupt; |
| 874 | link->irq.Instance = info; | ||
| 875 | 873 | ||
| 876 | link->conf.Attributes = CONF_ENABLE_IRQ; | 874 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 877 | link->conf.IntType = INT_MEMORY_AND_IO; | 875 | link->conf.IntType = INT_MEMORY_AND_IO; |
| @@ -905,22 +903,16 @@ static int bluecard_config(struct pcmcia_device *link) | |||
| 905 | break; | 903 | break; |
| 906 | } | 904 | } |
| 907 | 905 | ||
| 908 | if (i != 0) { | 906 | if (i != 0) |
| 909 | cs_error(link, RequestIO, i); | ||
| 910 | goto failed; | 907 | goto failed; |
| 911 | } | ||
| 912 | 908 | ||
| 913 | i = pcmcia_request_irq(link, &link->irq); | 909 | i = pcmcia_request_irq(link, &link->irq); |
| 914 | if (i != 0) { | 910 | if (i != 0) |
| 915 | cs_error(link, RequestIRQ, i); | ||
| 916 | link->irq.AssignedIRQ = 0; | 911 | link->irq.AssignedIRQ = 0; |
| 917 | } | ||
| 918 | 912 | ||
| 919 | i = pcmcia_request_configuration(link, &link->conf); | 913 | i = pcmcia_request_configuration(link, &link->conf); |
| 920 | if (i != 0) { | 914 | if (i != 0) |
| 921 | cs_error(link, RequestConfiguration, i); | ||
| 922 | goto failed; | 915 | goto failed; |
| 923 | } | ||
| 924 | 916 | ||
| 925 | if (bluecard_open(info) != 0) | 917 | if (bluecard_open(info) != 0) |
| 926 | goto failed; | 918 | goto failed; |
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index d58e22b9f06a..d814a2755ccb 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
| @@ -659,11 +659,9 @@ static int bt3c_probe(struct pcmcia_device *link) | |||
| 659 | 659 | ||
| 660 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 660 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 661 | link->io.NumPorts1 = 8; | 661 | link->io.NumPorts1 = 8; |
| 662 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 662 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 663 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 664 | 663 | ||
| 665 | link->irq.Handler = bt3c_interrupt; | 664 | link->irq.Handler = bt3c_interrupt; |
| 666 | link->irq.Instance = info; | ||
| 667 | 665 | ||
| 668 | link->conf.Attributes = CONF_ENABLE_IRQ; | 666 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 669 | link->conf.IntType = INT_MEMORY_AND_IO; | 667 | link->conf.IntType = INT_MEMORY_AND_IO; |
| @@ -740,21 +738,16 @@ static int bt3c_config(struct pcmcia_device *link) | |||
| 740 | goto found_port; | 738 | goto found_port; |
| 741 | 739 | ||
| 742 | BT_ERR("No usable port range found"); | 740 | BT_ERR("No usable port range found"); |
| 743 | cs_error(link, RequestIO, -ENODEV); | ||
| 744 | goto failed; | 741 | goto failed; |
| 745 | 742 | ||
| 746 | found_port: | 743 | found_port: |
| 747 | i = pcmcia_request_irq(link, &link->irq); | 744 | i = pcmcia_request_irq(link, &link->irq); |
| 748 | if (i != 0) { | 745 | if (i != 0) |
| 749 | cs_error(link, RequestIRQ, i); | ||
| 750 | link->irq.AssignedIRQ = 0; | 746 | link->irq.AssignedIRQ = 0; |
| 751 | } | ||
| 752 | 747 | ||
| 753 | i = pcmcia_request_configuration(link, &link->conf); | 748 | i = pcmcia_request_configuration(link, &link->conf); |
| 754 | if (i != 0) { | 749 | if (i != 0) |
| 755 | cs_error(link, RequestConfiguration, i); | ||
| 756 | goto failed; | 750 | goto failed; |
| 757 | } | ||
| 758 | 751 | ||
| 759 | if (bt3c_open(info) != 0) | 752 | if (bt3c_open(info) != 0) |
| 760 | goto failed; | 753 | goto failed; |
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index efd689a062eb..d339464dc15e 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
| @@ -588,11 +588,9 @@ static int btuart_probe(struct pcmcia_device *link) | |||
| 588 | 588 | ||
| 589 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 589 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 590 | link->io.NumPorts1 = 8; | 590 | link->io.NumPorts1 = 8; |
| 591 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 591 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 592 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 593 | 592 | ||
| 594 | link->irq.Handler = btuart_interrupt; | 593 | link->irq.Handler = btuart_interrupt; |
| 595 | link->irq.Instance = info; | ||
| 596 | 594 | ||
| 597 | link->conf.Attributes = CONF_ENABLE_IRQ; | 595 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 598 | link->conf.IntType = INT_MEMORY_AND_IO; | 596 | link->conf.IntType = INT_MEMORY_AND_IO; |
| @@ -669,21 +667,16 @@ static int btuart_config(struct pcmcia_device *link) | |||
| 669 | goto found_port; | 667 | goto found_port; |
| 670 | 668 | ||
| 671 | BT_ERR("No usable port range found"); | 669 | BT_ERR("No usable port range found"); |
| 672 | cs_error(link, RequestIO, -ENODEV); | ||
| 673 | goto failed; | 670 | goto failed; |
| 674 | 671 | ||
| 675 | found_port: | 672 | found_port: |
| 676 | i = pcmcia_request_irq(link, &link->irq); | 673 | i = pcmcia_request_irq(link, &link->irq); |
| 677 | if (i != 0) { | 674 | if (i != 0) |
| 678 | cs_error(link, RequestIRQ, i); | ||
| 679 | link->irq.AssignedIRQ = 0; | 675 | link->irq.AssignedIRQ = 0; |
| 680 | } | ||
| 681 | 676 | ||
| 682 | i = pcmcia_request_configuration(link, &link->conf); | 677 | i = pcmcia_request_configuration(link, &link->conf); |
| 683 | if (i != 0) { | 678 | if (i != 0) |
| 684 | cs_error(link, RequestConfiguration, i); | ||
| 685 | goto failed; | 679 | goto failed; |
| 686 | } | ||
| 687 | 680 | ||
| 688 | if (btuart_open(info) != 0) | 681 | if (btuart_open(info) != 0) |
| 689 | goto failed; | 682 | goto failed; |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 7ba91aa3fe8b..44bc8bbabf54 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -591,6 +591,7 @@ static int btusb_close(struct hci_dev *hdev) | |||
| 591 | return 0; | 591 | return 0; |
| 592 | 592 | ||
| 593 | cancel_work_sync(&data->work); | 593 | cancel_work_sync(&data->work); |
| 594 | cancel_work_sync(&data->waker); | ||
| 594 | 595 | ||
| 595 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | 596 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); |
| 596 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | 597 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); |
| @@ -599,11 +600,13 @@ static int btusb_close(struct hci_dev *hdev) | |||
| 599 | btusb_stop_traffic(data); | 600 | btusb_stop_traffic(data); |
| 600 | err = usb_autopm_get_interface(data->intf); | 601 | err = usb_autopm_get_interface(data->intf); |
| 601 | if (err < 0) | 602 | if (err < 0) |
| 602 | return 0; | 603 | goto failed; |
| 603 | 604 | ||
| 604 | data->intf->needs_remote_wakeup = 0; | 605 | data->intf->needs_remote_wakeup = 0; |
| 605 | usb_autopm_put_interface(data->intf); | 606 | usb_autopm_put_interface(data->intf); |
| 606 | 607 | ||
| 608 | failed: | ||
| 609 | usb_scuttle_anchored_urbs(&data->deferred); | ||
| 607 | return 0; | 610 | return 0; |
| 608 | } | 611 | } |
| 609 | 612 | ||
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index b881a9cd8741..4f02a6f3c980 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
| @@ -573,11 +573,9 @@ static int dtl1_probe(struct pcmcia_device *link) | |||
| 573 | 573 | ||
| 574 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 574 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 575 | link->io.NumPorts1 = 8; | 575 | link->io.NumPorts1 = 8; |
| 576 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 576 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 577 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 578 | 577 | ||
| 579 | link->irq.Handler = dtl1_interrupt; | 578 | link->irq.Handler = dtl1_interrupt; |
| 580 | link->irq.Instance = info; | ||
| 581 | 579 | ||
| 582 | link->conf.Attributes = CONF_ENABLE_IRQ; | 580 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 583 | link->conf.IntType = INT_MEMORY_AND_IO; | 581 | link->conf.IntType = INT_MEMORY_AND_IO; |
| @@ -622,16 +620,12 @@ static int dtl1_config(struct pcmcia_device *link) | |||
| 622 | goto failed; | 620 | goto failed; |
| 623 | 621 | ||
| 624 | i = pcmcia_request_irq(link, &link->irq); | 622 | i = pcmcia_request_irq(link, &link->irq); |
| 625 | if (i != 0) { | 623 | if (i != 0) |
| 626 | cs_error(link, RequestIRQ, i); | ||
| 627 | link->irq.AssignedIRQ = 0; | 624 | link->irq.AssignedIRQ = 0; |
| 628 | } | ||
| 629 | 625 | ||
| 630 | i = pcmcia_request_configuration(link, &link->conf); | 626 | i = pcmcia_request_configuration(link, &link->conf); |
| 631 | if (i != 0) { | 627 | if (i != 0) |
| 632 | cs_error(link, RequestConfiguration, i); | ||
| 633 | goto failed; | 628 | goto failed; |
| 634 | } | ||
| 635 | 629 | ||
| 636 | if (dtl1_open(info) != 0) | 630 | if (dtl1_open(info) != 0) |
| 637 | goto failed; | 631 | goto failed; |
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig index ccb1fa89de29..2fb3a480f6b0 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig | |||
| @@ -56,9 +56,8 @@ config AGP_AMD | |||
| 56 | X on AMD Irongate, 761, and 762 chipsets. | 56 | X on AMD Irongate, 761, and 762 chipsets. |
| 57 | 57 | ||
| 58 | config AGP_AMD64 | 58 | config AGP_AMD64 |
| 59 | tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU | 59 | tristate "AMD Opteron/Athlon64 on-CPU GART support" |
| 60 | depends on AGP && X86 | 60 | depends on AGP && X86 |
| 61 | default y if GART_IOMMU | ||
| 62 | help | 61 | help |
| 63 | This option gives you AGP support for the GLX component of | 62 | This option gives you AGP support for the GLX component of |
| 64 | X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs. | 63 | X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs. |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 4068467ce7b9..3cb56a049e24 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
| @@ -62,6 +62,7 @@ | |||
| 62 | #define PCI_DEVICE_ID_INTEL_IGDNG_D_IG 0x0042 | 62 | #define PCI_DEVICE_ID_INTEL_IGDNG_D_IG 0x0042 |
| 63 | #define PCI_DEVICE_ID_INTEL_IGDNG_M_HB 0x0044 | 63 | #define PCI_DEVICE_ID_INTEL_IGDNG_M_HB 0x0044 |
| 64 | #define PCI_DEVICE_ID_INTEL_IGDNG_MA_HB 0x0062 | 64 | #define PCI_DEVICE_ID_INTEL_IGDNG_MA_HB 0x0062 |
| 65 | #define PCI_DEVICE_ID_INTEL_IGDNG_MC2_HB 0x006a | ||
| 65 | #define PCI_DEVICE_ID_INTEL_IGDNG_M_IG 0x0046 | 66 | #define PCI_DEVICE_ID_INTEL_IGDNG_M_IG 0x0046 |
| 66 | 67 | ||
| 67 | /* cover 915 and 945 variants */ | 68 | /* cover 915 and 945 variants */ |
| @@ -96,7 +97,8 @@ | |||
| 96 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_B43_HB || \ | 97 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_B43_HB || \ |
| 97 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_D_HB || \ | 98 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_D_HB || \ |
| 98 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_M_HB || \ | 99 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_M_HB || \ |
| 99 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_MA_HB) | 100 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_MA_HB || \ |
| 101 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_MC2_HB) | ||
| 100 | 102 | ||
| 101 | extern int agp_memory_reserved; | 103 | extern int agp_memory_reserved; |
| 102 | 104 | ||
| @@ -1161,12 +1163,6 @@ static int intel_i915_configure(void) | |||
| 1161 | 1163 | ||
| 1162 | intel_i9xx_setup_flush(); | 1164 | intel_i9xx_setup_flush(); |
| 1163 | 1165 | ||
| 1164 | #ifdef USE_PCI_DMA_API | ||
| 1165 | if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(36))) | ||
| 1166 | dev_err(&intel_private.pcidev->dev, | ||
| 1167 | "set gfx device dma mask 36bit failed!\n"); | ||
| 1168 | #endif | ||
| 1169 | |||
| 1170 | return 0; | 1166 | return 0; |
| 1171 | } | 1167 | } |
| 1172 | 1168 | ||
| @@ -1364,6 +1360,7 @@ static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size) | |||
| 1364 | case PCI_DEVICE_ID_INTEL_IGDNG_D_HB: | 1360 | case PCI_DEVICE_ID_INTEL_IGDNG_D_HB: |
| 1365 | case PCI_DEVICE_ID_INTEL_IGDNG_M_HB: | 1361 | case PCI_DEVICE_ID_INTEL_IGDNG_M_HB: |
| 1366 | case PCI_DEVICE_ID_INTEL_IGDNG_MA_HB: | 1362 | case PCI_DEVICE_ID_INTEL_IGDNG_MA_HB: |
| 1363 | case PCI_DEVICE_ID_INTEL_IGDNG_MC2_HB: | ||
| 1367 | *gtt_offset = *gtt_size = MB(2); | 1364 | *gtt_offset = *gtt_size = MB(2); |
| 1368 | break; | 1365 | break; |
| 1369 | default: | 1366 | default: |
| @@ -2365,6 +2362,8 @@ static const struct intel_driver_description { | |||
| 2365 | "IGDNG/M", NULL, &intel_i965_driver }, | 2362 | "IGDNG/M", NULL, &intel_i965_driver }, |
| 2366 | { PCI_DEVICE_ID_INTEL_IGDNG_MA_HB, PCI_DEVICE_ID_INTEL_IGDNG_M_IG, 0, | 2363 | { PCI_DEVICE_ID_INTEL_IGDNG_MA_HB, PCI_DEVICE_ID_INTEL_IGDNG_M_IG, 0, |
| 2367 | "IGDNG/MA", NULL, &intel_i965_driver }, | 2364 | "IGDNG/MA", NULL, &intel_i965_driver }, |
| 2365 | { PCI_DEVICE_ID_INTEL_IGDNG_MC2_HB, PCI_DEVICE_ID_INTEL_IGDNG_M_IG, 0, | ||
| 2366 | "IGDNG/MC2", NULL, &intel_i965_driver }, | ||
| 2368 | { 0, 0, 0, NULL, NULL, NULL } | 2367 | { 0, 0, 0, NULL, NULL, NULL } |
| 2369 | }; | 2368 | }; |
| 2370 | 2369 | ||
| @@ -2456,6 +2455,11 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
| 2456 | &bridge->mode); | 2455 | &bridge->mode); |
| 2457 | } | 2456 | } |
| 2458 | 2457 | ||
| 2458 | if (bridge->driver->mask_memory == intel_i965_mask_memory) | ||
| 2459 | if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(36))) | ||
| 2460 | dev_err(&intel_private.pcidev->dev, | ||
| 2461 | "set gfx device dma mask 36bit failed!\n"); | ||
| 2462 | |||
| 2459 | pci_set_drvdata(pdev, bridge); | 2463 | pci_set_drvdata(pdev, bridge); |
| 2460 | return agp_add_bridge(bridge); | 2464 | return agp_add_bridge(bridge); |
| 2461 | } | 2465 | } |
| @@ -2561,6 +2565,7 @@ static struct pci_device_id agp_intel_pci_table[] = { | |||
| 2561 | ID(PCI_DEVICE_ID_INTEL_IGDNG_D_HB), | 2565 | ID(PCI_DEVICE_ID_INTEL_IGDNG_D_HB), |
| 2562 | ID(PCI_DEVICE_ID_INTEL_IGDNG_M_HB), | 2566 | ID(PCI_DEVICE_ID_INTEL_IGDNG_M_HB), |
| 2563 | ID(PCI_DEVICE_ID_INTEL_IGDNG_MA_HB), | 2567 | ID(PCI_DEVICE_ID_INTEL_IGDNG_MA_HB), |
| 2568 | ID(PCI_DEVICE_ID_INTEL_IGDNG_MC2_HB), | ||
| 2564 | { } | 2569 | { } |
| 2565 | }; | 2570 | }; |
| 2566 | 2571 | ||
diff --git a/drivers/char/hvc_xen.c b/drivers/char/hvc_xen.c index eba999f8598d..a6ee32b599a8 100644 --- a/drivers/char/hvc_xen.c +++ b/drivers/char/hvc_xen.c | |||
| @@ -55,7 +55,7 @@ static inline void notify_daemon(void) | |||
| 55 | notify_remote_via_evtchn(xen_start_info->console.domU.evtchn); | 55 | notify_remote_via_evtchn(xen_start_info->console.domU.evtchn); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | static int write_console(uint32_t vtermno, const char *data, int len) | 58 | static int __write_console(const char *data, int len) |
| 59 | { | 59 | { |
| 60 | struct xencons_interface *intf = xencons_interface(); | 60 | struct xencons_interface *intf = xencons_interface(); |
| 61 | XENCONS_RING_IDX cons, prod; | 61 | XENCONS_RING_IDX cons, prod; |
| @@ -76,6 +76,29 @@ static int write_console(uint32_t vtermno, const char *data, int len) | |||
| 76 | return sent; | 76 | return sent; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | static int write_console(uint32_t vtermno, const char *data, int len) | ||
| 80 | { | ||
| 81 | int ret = len; | ||
| 82 | |||
| 83 | /* | ||
| 84 | * Make sure the whole buffer is emitted, polling if | ||
| 85 | * necessary. We don't ever want to rely on the hvc daemon | ||
| 86 | * because the most interesting console output is when the | ||
| 87 | * kernel is crippled. | ||
| 88 | */ | ||
| 89 | while (len) { | ||
| 90 | int sent = __write_console(data, len); | ||
| 91 | |||
| 92 | data += sent; | ||
| 93 | len -= sent; | ||
| 94 | |||
| 95 | if (unlikely(len)) | ||
| 96 | HYPERVISOR_sched_op(SCHEDOP_yield, NULL); | ||
| 97 | } | ||
| 98 | |||
| 99 | return ret; | ||
| 100 | } | ||
| 101 | |||
| 79 | static int read_console(uint32_t vtermno, char *buf, int len) | 102 | static int read_console(uint32_t vtermno, char *buf, int len) |
| 80 | { | 103 | { |
| 81 | struct xencons_interface *intf = xencons_interface(); | 104 | struct xencons_interface *intf = xencons_interface(); |
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 737be953cc58..950837cf9e9c 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
| @@ -1249,7 +1249,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) | |||
| 1249 | 1249 | ||
| 1250 | if (keycode >= NR_KEYS) | 1250 | if (keycode >= NR_KEYS) |
| 1251 | if (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT8) | 1251 | if (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT8) |
| 1252 | keysym = K(KT_BRL, keycode - KEY_BRL_DOT1 + 1); | 1252 | keysym = U(K(KT_BRL, keycode - KEY_BRL_DOT1 + 1)); |
| 1253 | else | 1253 | else |
| 1254 | return; | 1254 | return; |
| 1255 | else | 1255 | else |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index c250a31efa53..2db4c0a29b05 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
| @@ -23,8 +23,6 @@ | |||
| 23 | * All rights reserved. Licensed under dual BSD/GPL license. | 23 | * All rights reserved. Licensed under dual BSD/GPL license. |
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | /* #define PCMCIA_DEBUG 6 */ | ||
| 27 | |||
| 28 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
| 29 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 30 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| @@ -47,18 +45,17 @@ | |||
| 47 | 45 | ||
| 48 | /* #define ATR_CSUM */ | 46 | /* #define ATR_CSUM */ |
| 49 | 47 | ||
| 50 | #ifdef PCMCIA_DEBUG | 48 | #define reader_to_dev(x) (&x->p_dev->dev) |
| 51 | #define reader_to_dev(x) (&handle_to_dev(x->p_dev)) | 49 | |
| 52 | static int pc_debug = PCMCIA_DEBUG; | 50 | /* n (debug level) is ignored */ |
| 53 | module_param(pc_debug, int, 0600); | 51 | /* additional debug output may be enabled by re-compiling with |
| 54 | #define DEBUGP(n, rdr, x, args...) do { \ | 52 | * CM4000_DEBUG set */ |
| 55 | if (pc_debug >= (n)) \ | 53 | /* #define CM4000_DEBUG */ |
| 56 | dev_printk(KERN_DEBUG, reader_to_dev(rdr), "%s:" x, \ | 54 | #define DEBUGP(n, rdr, x, args...) do { \ |
| 57 | __func__ , ## args); \ | 55 | dev_dbg(reader_to_dev(rdr), "%s:" x, \ |
| 56 | __func__ , ## args); \ | ||
| 58 | } while (0) | 57 | } while (0) |
| 59 | #else | 58 | |
| 60 | #define DEBUGP(n, rdr, x, args...) | ||
| 61 | #endif | ||
| 62 | static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; | 59 | static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; |
| 63 | 60 | ||
| 64 | #define T_1SEC (HZ) | 61 | #define T_1SEC (HZ) |
| @@ -174,14 +171,13 @@ static unsigned char fi_di_table[10][14] = { | |||
| 174 | /* 9 */ {0x09,0x19,0x29,0x39,0x49,0x59,0x69,0x11,0x11,0x99,0xA9,0xB9,0xC9,0xD9} | 171 | /* 9 */ {0x09,0x19,0x29,0x39,0x49,0x59,0x69,0x11,0x11,0x99,0xA9,0xB9,0xC9,0xD9} |
| 175 | }; | 172 | }; |
| 176 | 173 | ||
| 177 | #ifndef PCMCIA_DEBUG | 174 | #ifndef CM4000_DEBUG |
| 178 | #define xoutb outb | 175 | #define xoutb outb |
| 179 | #define xinb inb | 176 | #define xinb inb |
| 180 | #else | 177 | #else |
| 181 | static inline void xoutb(unsigned char val, unsigned short port) | 178 | static inline void xoutb(unsigned char val, unsigned short port) |
| 182 | { | 179 | { |
| 183 | if (pc_debug >= 7) | 180 | pr_debug("outb(val=%.2x,port=%.4x)\n", val, port); |
| 184 | printk(KERN_DEBUG "outb(val=%.2x,port=%.4x)\n", val, port); | ||
| 185 | outb(val, port); | 181 | outb(val, port); |
| 186 | } | 182 | } |
| 187 | static inline unsigned char xinb(unsigned short port) | 183 | static inline unsigned char xinb(unsigned short port) |
| @@ -189,8 +185,7 @@ static inline unsigned char xinb(unsigned short port) | |||
| 189 | unsigned char val; | 185 | unsigned char val; |
| 190 | 186 | ||
| 191 | val = inb(port); | 187 | val = inb(port); |
| 192 | if (pc_debug >= 7) | 188 | pr_debug("%.2x=inb(%.4x)\n", val, port); |
| 193 | printk(KERN_DEBUG "%.2x=inb(%.4x)\n", val, port); | ||
| 194 | 189 | ||
| 195 | return val; | 190 | return val; |
| 196 | } | 191 | } |
| @@ -514,12 +509,10 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq) | |||
| 514 | for (i = 0; i < 4; i++) { | 509 | for (i = 0; i < 4; i++) { |
| 515 | xoutb(i, REG_BUF_ADDR(iobase)); | 510 | xoutb(i, REG_BUF_ADDR(iobase)); |
| 516 | xoutb(dev->pts[i], REG_BUF_DATA(iobase)); /* buf data */ | 511 | xoutb(dev->pts[i], REG_BUF_DATA(iobase)); /* buf data */ |
| 517 | #ifdef PCMCIA_DEBUG | 512 | #ifdef CM4000_DEBUG |
| 518 | if (pc_debug >= 5) | 513 | pr_debug("0x%.2x ", dev->pts[i]); |
| 519 | printk("0x%.2x ", dev->pts[i]); | ||
| 520 | } | 514 | } |
| 521 | if (pc_debug >= 5) | 515 | pr_debug("\n"); |
| 522 | printk("\n"); | ||
| 523 | #else | 516 | #else |
| 524 | } | 517 | } |
| 525 | #endif | 518 | #endif |
| @@ -579,14 +572,13 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq) | |||
| 579 | pts_reply[i] = inb(REG_BUF_DATA(iobase)); | 572 | pts_reply[i] = inb(REG_BUF_DATA(iobase)); |
| 580 | } | 573 | } |
| 581 | 574 | ||
| 582 | #ifdef PCMCIA_DEBUG | 575 | #ifdef CM4000_DEBUG |
| 583 | DEBUGP(2, dev, "PTSreply: "); | 576 | DEBUGP(2, dev, "PTSreply: "); |
| 584 | for (i = 0; i < num_bytes_read; i++) { | 577 | for (i = 0; i < num_bytes_read; i++) { |
| 585 | if (pc_debug >= 5) | 578 | pr_debug("0x%.2x ", pts_reply[i]); |
| 586 | printk("0x%.2x ", pts_reply[i]); | ||
| 587 | } | 579 | } |
| 588 | printk("\n"); | 580 | pr_debug("\n"); |
| 589 | #endif /* PCMCIA_DEBUG */ | 581 | #endif /* CM4000_DEBUG */ |
| 590 | 582 | ||
| 591 | DEBUGP(5, dev, "Clear Tactive in Flags1\n"); | 583 | DEBUGP(5, dev, "Clear Tactive in Flags1\n"); |
| 592 | xoutb(0x20, REG_FLAGS1(iobase)); | 584 | xoutb(0x20, REG_FLAGS1(iobase)); |
| @@ -655,7 +647,7 @@ static void terminate_monitor(struct cm4000_dev *dev) | |||
| 655 | 647 | ||
| 656 | DEBUGP(5, dev, "Delete timer\n"); | 648 | DEBUGP(5, dev, "Delete timer\n"); |
| 657 | del_timer_sync(&dev->timer); | 649 | del_timer_sync(&dev->timer); |
| 658 | #ifdef PCMCIA_DEBUG | 650 | #ifdef CM4000_DEBUG |
| 659 | dev->monitor_running = 0; | 651 | dev->monitor_running = 0; |
| 660 | #endif | 652 | #endif |
| 661 | 653 | ||
| @@ -898,7 +890,7 @@ static void monitor_card(unsigned long p) | |||
| 898 | DEBUGP(4, dev, "ATR checksum (0x%.2x, should " | 890 | DEBUGP(4, dev, "ATR checksum (0x%.2x, should " |
| 899 | "be zero) failed\n", dev->atr_csum); | 891 | "be zero) failed\n", dev->atr_csum); |
| 900 | } | 892 | } |
| 901 | #ifdef PCMCIA_DEBUG | 893 | #ifdef CM4000_DEBUG |
| 902 | else if (test_bit(IS_BAD_LENGTH, &dev->flags)) { | 894 | else if (test_bit(IS_BAD_LENGTH, &dev->flags)) { |
| 903 | DEBUGP(4, dev, "ATR length error\n"); | 895 | DEBUGP(4, dev, "ATR length error\n"); |
| 904 | } else { | 896 | } else { |
| @@ -1415,7 +1407,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 1415 | int size; | 1407 | int size; |
| 1416 | int rc; | 1408 | int rc; |
| 1417 | void __user *argp = (void __user *)arg; | 1409 | void __user *argp = (void __user *)arg; |
| 1418 | #ifdef PCMCIA_DEBUG | 1410 | #ifdef CM4000_DEBUG |
| 1419 | char *ioctl_names[CM_IOC_MAXNR + 1] = { | 1411 | char *ioctl_names[CM_IOC_MAXNR + 1] = { |
| 1420 | [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS", | 1412 | [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS", |
| 1421 | [_IOC_NR(CM_IOCGATR)] "CM_IOCGATR", | 1413 | [_IOC_NR(CM_IOCGATR)] "CM_IOCGATR", |
| @@ -1423,9 +1415,9 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 1423 | [_IOC_NR(CM_IOCSPTS)] "CM_IOCSPTS", | 1415 | [_IOC_NR(CM_IOCSPTS)] "CM_IOCSPTS", |
| 1424 | [_IOC_NR(CM_IOSDBGLVL)] "CM4000_DBGLVL", | 1416 | [_IOC_NR(CM_IOSDBGLVL)] "CM4000_DBGLVL", |
| 1425 | }; | 1417 | }; |
| 1426 | #endif | ||
| 1427 | DEBUGP(3, dev, "cmm_ioctl(device=%d.%d) %s\n", imajor(inode), | 1418 | DEBUGP(3, dev, "cmm_ioctl(device=%d.%d) %s\n", imajor(inode), |
| 1428 | iminor(inode), ioctl_names[_IOC_NR(cmd)]); | 1419 | iminor(inode), ioctl_names[_IOC_NR(cmd)]); |
| 1420 | #endif | ||
| 1429 | 1421 | ||
| 1430 | lock_kernel(); | 1422 | lock_kernel(); |
| 1431 | rc = -ENODEV; | 1423 | rc = -ENODEV; |
| @@ -1523,7 +1515,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 1523 | } | 1515 | } |
| 1524 | case CM_IOCARDOFF: | 1516 | case CM_IOCARDOFF: |
| 1525 | 1517 | ||
| 1526 | #ifdef PCMCIA_DEBUG | 1518 | #ifdef CM4000_DEBUG |
| 1527 | DEBUGP(4, dev, "... in CM_IOCARDOFF\n"); | 1519 | DEBUGP(4, dev, "... in CM_IOCARDOFF\n"); |
| 1528 | if (dev->flags0 & 0x01) { | 1520 | if (dev->flags0 & 0x01) { |
| 1529 | DEBUGP(4, dev, " Card inserted\n"); | 1521 | DEBUGP(4, dev, " Card inserted\n"); |
| @@ -1625,18 +1617,9 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 1625 | 1617 | ||
| 1626 | } | 1618 | } |
| 1627 | break; | 1619 | break; |
| 1628 | #ifdef PCMCIA_DEBUG | 1620 | #ifdef CM4000_DEBUG |
| 1629 | case CM_IOSDBGLVL: /* set debug log level */ | 1621 | case CM_IOSDBGLVL: |
| 1630 | { | 1622 | rc = -ENOTTY; |
| 1631 | int old_pc_debug = 0; | ||
| 1632 | |||
| 1633 | old_pc_debug = pc_debug; | ||
| 1634 | if (copy_from_user(&pc_debug, argp, sizeof(int))) | ||
| 1635 | rc = -EFAULT; | ||
| 1636 | else if (old_pc_debug != pc_debug) | ||
| 1637 | DEBUGP(0, dev, "Changed debug log level " | ||
| 1638 | "to %i\n", pc_debug); | ||
| 1639 | } | ||
| 1640 | break; | 1623 | break; |
| 1641 | #endif | 1624 | #endif |
| 1642 | default: | 1625 | default: |
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 4f0723b07974..a6a70e476bea 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
| @@ -17,8 +17,6 @@ | |||
| 17 | * All rights reserved, Dual BSD/GPL Licensed. | 17 | * All rights reserved, Dual BSD/GPL Licensed. |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | /* #define PCMCIA_DEBUG 6 */ | ||
| 21 | |||
| 22 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
| 23 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 24 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| @@ -41,18 +39,16 @@ | |||
| 41 | #include "cm4040_cs.h" | 39 | #include "cm4040_cs.h" |
| 42 | 40 | ||
| 43 | 41 | ||
| 44 | #ifdef PCMCIA_DEBUG | 42 | #define reader_to_dev(x) (&x->p_dev->dev) |
| 45 | #define reader_to_dev(x) (&handle_to_dev(x->p_dev)) | 43 | |
| 46 | static int pc_debug = PCMCIA_DEBUG; | 44 | /* n (debug level) is ignored */ |
| 47 | module_param(pc_debug, int, 0600); | 45 | /* additional debug output may be enabled by re-compiling with |
| 48 | #define DEBUGP(n, rdr, x, args...) do { \ | 46 | * CM4040_DEBUG set */ |
| 49 | if (pc_debug >= (n)) \ | 47 | /* #define CM4040_DEBUG */ |
| 50 | dev_printk(KERN_DEBUG, reader_to_dev(rdr), "%s:" x, \ | 48 | #define DEBUGP(n, rdr, x, args...) do { \ |
| 51 | __func__ , ##args); \ | 49 | dev_dbg(reader_to_dev(rdr), "%s:" x, \ |
| 50 | __func__ , ## args); \ | ||
| 52 | } while (0) | 51 | } while (0) |
| 53 | #else | ||
| 54 | #define DEBUGP(n, rdr, x, args...) | ||
| 55 | #endif | ||
| 56 | 52 | ||
| 57 | static char *version = | 53 | static char *version = |
| 58 | "OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte"; | 54 | "OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte"; |
| @@ -90,14 +86,13 @@ struct reader_dev { | |||
| 90 | 86 | ||
| 91 | static struct pcmcia_device *dev_table[CM_MAX_DEV]; | 87 | static struct pcmcia_device *dev_table[CM_MAX_DEV]; |
| 92 | 88 | ||
| 93 | #ifndef PCMCIA_DEBUG | 89 | #ifndef CM4040_DEBUG |
| 94 | #define xoutb outb | 90 | #define xoutb outb |
| 95 | #define xinb inb | 91 | #define xinb inb |
| 96 | #else | 92 | #else |
| 97 | static inline void xoutb(unsigned char val, unsigned short port) | 93 | static inline void xoutb(unsigned char val, unsigned short port) |
| 98 | { | 94 | { |
| 99 | if (pc_debug >= 7) | 95 | pr_debug("outb(val=%.2x,port=%.4x)\n", val, port); |
| 100 | printk(KERN_DEBUG "outb(val=%.2x,port=%.4x)\n", val, port); | ||
| 101 | outb(val, port); | 96 | outb(val, port); |
| 102 | } | 97 | } |
| 103 | 98 | ||
| @@ -106,8 +101,7 @@ static inline unsigned char xinb(unsigned short port) | |||
| 106 | unsigned char val; | 101 | unsigned char val; |
| 107 | 102 | ||
| 108 | val = inb(port); | 103 | val = inb(port); |
| 109 | if (pc_debug >= 7) | 104 | pr_debug("%.2x=inb(%.4x)\n", val, port); |
| 110 | printk(KERN_DEBUG "%.2x=inb(%.4x)\n", val, port); | ||
| 111 | return val; | 105 | return val; |
| 112 | } | 106 | } |
| 113 | #endif | 107 | #endif |
| @@ -260,23 +254,22 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf, | |||
| 260 | return -EIO; | 254 | return -EIO; |
| 261 | } | 255 | } |
| 262 | dev->r_buf[i] = xinb(iobase + REG_OFFSET_BULK_IN); | 256 | dev->r_buf[i] = xinb(iobase + REG_OFFSET_BULK_IN); |
| 263 | #ifdef PCMCIA_DEBUG | 257 | #ifdef CM4040_DEBUG |
| 264 | if (pc_debug >= 6) | 258 | pr_debug("%lu:%2x ", i, dev->r_buf[i]); |
| 265 | printk(KERN_DEBUG "%lu:%2x ", i, dev->r_buf[i]); | ||
| 266 | } | 259 | } |
| 267 | printk("\n"); | 260 | pr_debug("\n"); |
| 268 | #else | 261 | #else |
| 269 | } | 262 | } |
| 270 | #endif | 263 | #endif |
| 271 | 264 | ||
| 272 | bytes_to_read = 5 + le32_to_cpu(*(__le32 *)&dev->r_buf[1]); | 265 | bytes_to_read = 5 + le32_to_cpu(*(__le32 *)&dev->r_buf[1]); |
| 273 | 266 | ||
| 274 | DEBUGP(6, dev, "BytesToRead=%lu\n", bytes_to_read); | 267 | DEBUGP(6, dev, "BytesToRead=%zu\n", bytes_to_read); |
| 275 | 268 | ||
| 276 | min_bytes_to_read = min(count, bytes_to_read + 5); | 269 | min_bytes_to_read = min(count, bytes_to_read + 5); |
| 277 | min_bytes_to_read = min_t(size_t, min_bytes_to_read, READ_WRITE_BUFFER_SIZE); | 270 | min_bytes_to_read = min_t(size_t, min_bytes_to_read, READ_WRITE_BUFFER_SIZE); |
| 278 | 271 | ||
| 279 | DEBUGP(6, dev, "Min=%lu\n", min_bytes_to_read); | 272 | DEBUGP(6, dev, "Min=%zu\n", min_bytes_to_read); |
| 280 | 273 | ||
| 281 | for (i = 0; i < (min_bytes_to_read-5); i++) { | 274 | for (i = 0; i < (min_bytes_to_read-5); i++) { |
| 282 | rc = wait_for_bulk_in_ready(dev); | 275 | rc = wait_for_bulk_in_ready(dev); |
| @@ -288,11 +281,10 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf, | |||
| 288 | return -EIO; | 281 | return -EIO; |
| 289 | } | 282 | } |
| 290 | dev->r_buf[i+5] = xinb(iobase + REG_OFFSET_BULK_IN); | 283 | dev->r_buf[i+5] = xinb(iobase + REG_OFFSET_BULK_IN); |
| 291 | #ifdef PCMCIA_DEBUG | 284 | #ifdef CM4040_DEBUG |
| 292 | if (pc_debug >= 6) | 285 | pr_debug("%lu:%2x ", i, dev->r_buf[i]); |
| 293 | printk(KERN_DEBUG "%lu:%2x ", i, dev->r_buf[i]); | ||
| 294 | } | 286 | } |
| 295 | printk("\n"); | 287 | pr_debug("\n"); |
| 296 | #else | 288 | #else |
| 297 | } | 289 | } |
| 298 | #endif | 290 | #endif |
| @@ -547,7 +539,7 @@ static int cm4040_config_check(struct pcmcia_device *p_dev, | |||
| 547 | p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; | 539 | p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; |
| 548 | 540 | ||
| 549 | rc = pcmcia_request_io(p_dev, &p_dev->io); | 541 | rc = pcmcia_request_io(p_dev, &p_dev->io); |
| 550 | dev_printk(KERN_INFO, &handle_to_dev(p_dev), | 542 | dev_printk(KERN_INFO, &p_dev->dev, |
| 551 | "pcmcia_request_io returned 0x%x\n", rc); | 543 | "pcmcia_request_io returned 0x%x\n", rc); |
| 552 | return rc; | 544 | return rc; |
| 553 | } | 545 | } |
| @@ -569,7 +561,7 @@ static int reader_config(struct pcmcia_device *link, int devno) | |||
| 569 | 561 | ||
| 570 | fail_rc = pcmcia_request_configuration(link, &link->conf); | 562 | fail_rc = pcmcia_request_configuration(link, &link->conf); |
| 571 | if (fail_rc != 0) { | 563 | if (fail_rc != 0) { |
| 572 | dev_printk(KERN_INFO, &handle_to_dev(link), | 564 | dev_printk(KERN_INFO, &link->dev, |
| 573 | "pcmcia_request_configuration failed 0x%x\n", | 565 | "pcmcia_request_configuration failed 0x%x\n", |
| 574 | fail_rc); | 566 | fail_rc); |
| 575 | goto cs_release; | 567 | goto cs_release; |
diff --git a/drivers/char/pcmcia/ipwireless/hardware.c b/drivers/char/pcmcia/ipwireless/hardware.c index 4c1820cad712..99cffdab1056 100644 --- a/drivers/char/pcmcia/ipwireless/hardware.c +++ b/drivers/char/pcmcia/ipwireless/hardware.c | |||
| @@ -1213,12 +1213,12 @@ static irqreturn_t ipwireless_handle_v2_v3_interrupt(int irq, | |||
| 1213 | 1213 | ||
| 1214 | irqreturn_t ipwireless_interrupt(int irq, void *dev_id) | 1214 | irqreturn_t ipwireless_interrupt(int irq, void *dev_id) |
| 1215 | { | 1215 | { |
| 1216 | struct ipw_hardware *hw = dev_id; | 1216 | struct ipw_dev *ipw = dev_id; |
| 1217 | 1217 | ||
| 1218 | if (hw->hw_version == HW_VERSION_1) | 1218 | if (ipw->hardware->hw_version == HW_VERSION_1) |
| 1219 | return ipwireless_handle_v1_interrupt(irq, hw); | 1219 | return ipwireless_handle_v1_interrupt(irq, ipw->hardware); |
| 1220 | else | 1220 | else |
| 1221 | return ipwireless_handle_v2_v3_interrupt(irq, hw); | 1221 | return ipwireless_handle_v2_v3_interrupt(irq, ipw->hardware); |
| 1222 | } | 1222 | } |
| 1223 | 1223 | ||
| 1224 | static void flush_packets_to_hw(struct ipw_hardware *hw) | 1224 | static void flush_packets_to_hw(struct ipw_hardware *hw) |
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 5216fce0c62d..dff24dae1485 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c | |||
| @@ -65,10 +65,7 @@ static void signalled_reboot_work(struct work_struct *work_reboot) | |||
| 65 | struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev, | 65 | struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev, |
| 66 | work_reboot); | 66 | work_reboot); |
| 67 | struct pcmcia_device *link = ipw->link; | 67 | struct pcmcia_device *link = ipw->link; |
| 68 | int ret = pcmcia_reset_card(link->socket); | 68 | pcmcia_reset_card(link->socket); |
| 69 | |||
| 70 | if (ret != 0) | ||
| 71 | cs_error(link, ResetCard, ret); | ||
| 72 | } | 69 | } |
| 73 | 70 | ||
| 74 | static void signalled_reboot_callback(void *callback_data) | 71 | static void signalled_reboot_callback(void *callback_data) |
| @@ -79,208 +76,127 @@ static void signalled_reboot_callback(void *callback_data) | |||
| 79 | schedule_work(&ipw->work_reboot); | 76 | schedule_work(&ipw->work_reboot); |
| 80 | } | 77 | } |
| 81 | 78 | ||
| 82 | static int config_ipwireless(struct ipw_dev *ipw) | 79 | static int ipwireless_probe(struct pcmcia_device *p_dev, |
| 80 | cistpl_cftable_entry_t *cfg, | ||
| 81 | cistpl_cftable_entry_t *dflt, | ||
| 82 | unsigned int vcc, | ||
| 83 | void *priv_data) | ||
| 83 | { | 84 | { |
| 84 | struct pcmcia_device *link = ipw->link; | 85 | struct ipw_dev *ipw = priv_data; |
| 85 | int ret; | 86 | struct resource *io_resource; |
| 86 | tuple_t tuple; | ||
| 87 | unsigned short buf[64]; | ||
| 88 | cisparse_t parse; | ||
| 89 | unsigned short cor_value; | ||
| 90 | memreq_t memreq_attr_memory; | 87 | memreq_t memreq_attr_memory; |
| 91 | memreq_t memreq_common_memory; | 88 | memreq_t memreq_common_memory; |
| 89 | int ret; | ||
| 92 | 90 | ||
| 93 | ipw->is_v2_card = 0; | 91 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
| 94 | 92 | p_dev->io.BasePort1 = cfg->io.win[0].base; | |
| 95 | tuple.Attributes = 0; | 93 | p_dev->io.NumPorts1 = cfg->io.win[0].len; |
| 96 | tuple.TupleData = (cisdata_t *) buf; | 94 | p_dev->io.IOAddrLines = 16; |
| 97 | tuple.TupleDataMax = sizeof(buf); | ||
| 98 | tuple.TupleOffset = 0; | ||
| 99 | |||
| 100 | tuple.DesiredTuple = RETURN_FIRST_TUPLE; | ||
| 101 | |||
| 102 | ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 103 | |||
| 104 | while (ret == 0) { | ||
| 105 | ret = pcmcia_get_tuple_data(link, &tuple); | ||
| 106 | |||
| 107 | if (ret != 0) { | ||
| 108 | cs_error(link, GetTupleData, ret); | ||
| 109 | goto exit0; | ||
| 110 | } | ||
| 111 | ret = pcmcia_get_next_tuple(link, &tuple); | ||
| 112 | } | ||
| 113 | |||
| 114 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 115 | |||
| 116 | ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 117 | |||
| 118 | if (ret != 0) { | ||
| 119 | cs_error(link, GetFirstTuple, ret); | ||
| 120 | goto exit0; | ||
| 121 | } | ||
| 122 | |||
| 123 | ret = pcmcia_get_tuple_data(link, &tuple); | ||
| 124 | |||
| 125 | if (ret != 0) { | ||
| 126 | cs_error(link, GetTupleData, ret); | ||
| 127 | goto exit0; | ||
| 128 | } | ||
| 129 | |||
| 130 | ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 131 | |||
| 132 | if (ret != 0) { | ||
| 133 | cs_error(link, ParseTuple, ret); | ||
| 134 | goto exit0; | ||
| 135 | } | ||
| 136 | |||
| 137 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 138 | link->io.BasePort1 = parse.cftable_entry.io.win[0].base; | ||
| 139 | link->io.NumPorts1 = parse.cftable_entry.io.win[0].len; | ||
| 140 | link->io.IOAddrLines = 16; | ||
| 141 | |||
| 142 | link->irq.IRQInfo1 = parse.cftable_entry.irq.IRQInfo1; | ||
| 143 | 95 | ||
| 144 | /* 0x40 causes it to generate level mode interrupts. */ | 96 | /* 0x40 causes it to generate level mode interrupts. */ |
| 145 | /* 0x04 enables IREQ pin. */ | 97 | /* 0x04 enables IREQ pin. */ |
| 146 | cor_value = parse.cftable_entry.index | 0x44; | 98 | p_dev->conf.ConfigIndex = cfg->index | 0x44; |
| 147 | link->conf.ConfigIndex = cor_value; | 99 | ret = pcmcia_request_io(p_dev, &p_dev->io); |
| 100 | if (ret) | ||
| 101 | return ret; | ||
| 148 | 102 | ||
| 149 | /* IRQ and I/O settings */ | 103 | io_resource = request_region(p_dev->io.BasePort1, p_dev->io.NumPorts1, |
| 150 | tuple.DesiredTuple = CISTPL_CONFIG; | 104 | IPWIRELESS_PCCARD_NAME); |
| 151 | 105 | ||
| 152 | ret = pcmcia_get_first_tuple(link, &tuple); | 106 | if (cfg->mem.nwin == 0) |
| 107 | return 0; | ||
| 153 | 108 | ||
| 154 | if (ret != 0) { | 109 | ipw->request_common_memory.Attributes = |
| 155 | cs_error(link, GetFirstTuple, ret); | 110 | WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; |
| 156 | goto exit0; | 111 | ipw->request_common_memory.Base = cfg->mem.win[0].host_addr; |
| 157 | } | 112 | ipw->request_common_memory.Size = cfg->mem.win[0].len; |
| 113 | if (ipw->request_common_memory.Size < 0x1000) | ||
| 114 | ipw->request_common_memory.Size = 0x1000; | ||
| 115 | ipw->request_common_memory.AccessSpeed = 0; | ||
| 158 | 116 | ||
| 159 | ret = pcmcia_get_tuple_data(link, &tuple); | 117 | ret = pcmcia_request_window(p_dev, &ipw->request_common_memory, |
| 160 | 118 | &ipw->handle_common_memory); | |
| 161 | if (ret != 0) { | ||
| 162 | cs_error(link, GetTupleData, ret); | ||
| 163 | goto exit0; | ||
| 164 | } | ||
| 165 | 119 | ||
| 166 | ret = pcmcia_parse_tuple(&tuple, &parse); | 120 | if (ret != 0) |
| 121 | goto exit1; | ||
| 167 | 122 | ||
| 168 | if (ret != 0) { | 123 | memreq_common_memory.CardOffset = cfg->mem.win[0].card_addr; |
| 169 | cs_error(link, GetTupleData, ret); | 124 | memreq_common_memory.Page = 0; |
| 170 | goto exit0; | ||
| 171 | } | ||
| 172 | link->conf.Attributes = CONF_ENABLE_IRQ; | ||
| 173 | link->conf.ConfigBase = parse.config.base; | ||
| 174 | link->conf.Present = parse.config.rmask[0]; | ||
| 175 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
| 176 | 125 | ||
| 177 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 126 | ret = pcmcia_map_mem_page(p_dev, ipw->handle_common_memory, |
| 178 | link->irq.Handler = ipwireless_interrupt; | 127 | &memreq_common_memory); |
| 179 | link->irq.Instance = ipw->hardware; | ||
| 180 | 128 | ||
| 181 | ret = pcmcia_request_io(link, &link->io); | 129 | if (ret != 0) |
| 130 | goto exit2; | ||
| 182 | 131 | ||
| 183 | if (ret != 0) { | 132 | ipw->is_v2_card = cfg->mem.win[0].len == 0x100; |
| 184 | cs_error(link, RequestIO, ret); | ||
| 185 | goto exit0; | ||
| 186 | } | ||
| 187 | 133 | ||
| 188 | request_region(link->io.BasePort1, link->io.NumPorts1, | 134 | ipw->common_memory = ioremap(ipw->request_common_memory.Base, |
| 135 | ipw->request_common_memory.Size); | ||
| 136 | request_mem_region(ipw->request_common_memory.Base, | ||
| 137 | ipw->request_common_memory.Size, | ||
| 189 | IPWIRELESS_PCCARD_NAME); | 138 | IPWIRELESS_PCCARD_NAME); |
| 190 | 139 | ||
| 191 | /* memory settings */ | 140 | ipw->request_attr_memory.Attributes = |
| 192 | 141 | WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE; | |
| 193 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 142 | ipw->request_attr_memory.Base = 0; |
| 194 | 143 | ipw->request_attr_memory.Size = 0; /* this used to be 0x1000 */ | |
| 195 | ret = pcmcia_get_first_tuple(link, &tuple); | 144 | ipw->request_attr_memory.AccessSpeed = 0; |
| 196 | |||
| 197 | if (ret != 0) { | ||
| 198 | cs_error(link, GetFirstTuple, ret); | ||
| 199 | goto exit1; | ||
| 200 | } | ||
| 201 | |||
| 202 | ret = pcmcia_get_tuple_data(link, &tuple); | ||
| 203 | 145 | ||
| 204 | if (ret != 0) { | 146 | ret = pcmcia_request_window(p_dev, &ipw->request_attr_memory, |
| 205 | cs_error(link, GetTupleData, ret); | 147 | &ipw->handle_attr_memory); |
| 206 | goto exit1; | ||
| 207 | } | ||
| 208 | |||
| 209 | ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 210 | |||
| 211 | if (ret != 0) { | ||
| 212 | cs_error(link, ParseTuple, ret); | ||
| 213 | goto exit1; | ||
| 214 | } | ||
| 215 | 148 | ||
| 216 | if (parse.cftable_entry.mem.nwin > 0) { | 149 | if (ret != 0) |
| 217 | ipw->request_common_memory.Attributes = | 150 | goto exit2; |
| 218 | WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; | ||
| 219 | ipw->request_common_memory.Base = | ||
| 220 | parse.cftable_entry.mem.win[0].host_addr; | ||
| 221 | ipw->request_common_memory.Size = parse.cftable_entry.mem.win[0].len; | ||
| 222 | if (ipw->request_common_memory.Size < 0x1000) | ||
| 223 | ipw->request_common_memory.Size = 0x1000; | ||
| 224 | ipw->request_common_memory.AccessSpeed = 0; | ||
| 225 | |||
| 226 | ret = pcmcia_request_window(&link, &ipw->request_common_memory, | ||
| 227 | &ipw->handle_common_memory); | ||
| 228 | 151 | ||
| 229 | if (ret != 0) { | 152 | memreq_attr_memory.CardOffset = 0; |
| 230 | cs_error(link, RequestWindow, ret); | 153 | memreq_attr_memory.Page = 0; |
| 231 | goto exit1; | ||
| 232 | } | ||
| 233 | 154 | ||
| 234 | memreq_common_memory.CardOffset = | 155 | ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, |
| 235 | parse.cftable_entry.mem.win[0].card_addr; | 156 | &memreq_attr_memory); |
| 236 | memreq_common_memory.Page = 0; | ||
| 237 | 157 | ||
| 238 | ret = pcmcia_map_mem_page(ipw->handle_common_memory, | 158 | if (ret != 0) |
| 239 | &memreq_common_memory); | 159 | goto exit3; |
| 240 | 160 | ||
| 241 | if (ret != 0) { | 161 | ipw->attr_memory = ioremap(ipw->request_attr_memory.Base, |
| 242 | cs_error(link, MapMemPage, ret); | 162 | ipw->request_attr_memory.Size); |
| 243 | goto exit1; | 163 | request_mem_region(ipw->request_attr_memory.Base, |
| 244 | } | 164 | ipw->request_attr_memory.Size, IPWIRELESS_PCCARD_NAME); |
| 245 | 165 | ||
| 246 | ipw->is_v2_card = | 166 | return 0; |
| 247 | parse.cftable_entry.mem.win[0].len == 0x100; | ||
| 248 | 167 | ||
| 249 | ipw->common_memory = ioremap(ipw->request_common_memory.Base, | 168 | exit3: |
| 169 | pcmcia_release_window(p_dev, ipw->handle_attr_memory); | ||
| 170 | exit2: | ||
| 171 | if (ipw->common_memory) { | ||
| 172 | release_mem_region(ipw->request_common_memory.Base, | ||
| 250 | ipw->request_common_memory.Size); | 173 | ipw->request_common_memory.Size); |
| 251 | request_mem_region(ipw->request_common_memory.Base, | 174 | iounmap(ipw->common_memory); |
| 252 | ipw->request_common_memory.Size, IPWIRELESS_PCCARD_NAME); | 175 | pcmcia_release_window(p_dev, ipw->handle_common_memory); |
| 253 | 176 | } else | |
| 254 | ipw->request_attr_memory.Attributes = | 177 | pcmcia_release_window(p_dev, ipw->handle_common_memory); |
| 255 | WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE; | 178 | exit1: |
| 256 | ipw->request_attr_memory.Base = 0; | 179 | release_resource(io_resource); |
| 257 | ipw->request_attr_memory.Size = 0; /* this used to be 0x1000 */ | 180 | pcmcia_disable_device(p_dev); |
| 258 | ipw->request_attr_memory.AccessSpeed = 0; | 181 | return -1; |
| 259 | 182 | } | |
| 260 | ret = pcmcia_request_window(&link, &ipw->request_attr_memory, | ||
| 261 | &ipw->handle_attr_memory); | ||
| 262 | 183 | ||
| 263 | if (ret != 0) { | 184 | static int config_ipwireless(struct ipw_dev *ipw) |
| 264 | cs_error(link, RequestWindow, ret); | 185 | { |
| 265 | goto exit2; | 186 | struct pcmcia_device *link = ipw->link; |
| 266 | } | 187 | int ret = 0; |
| 267 | 188 | ||
| 268 | memreq_attr_memory.CardOffset = 0; | 189 | ipw->is_v2_card = 0; |
| 269 | memreq_attr_memory.Page = 0; | ||
| 270 | 190 | ||
| 271 | ret = pcmcia_map_mem_page(ipw->handle_attr_memory, | 191 | ret = pcmcia_loop_config(link, ipwireless_probe, ipw); |
| 272 | &memreq_attr_memory); | 192 | if (ret != 0) |
| 193 | return ret; | ||
| 273 | 194 | ||
| 274 | if (ret != 0) { | 195 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 275 | cs_error(link, MapMemPage, ret); | 196 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 276 | goto exit2; | ||
| 277 | } | ||
| 278 | 197 | ||
| 279 | ipw->attr_memory = ioremap(ipw->request_attr_memory.Base, | 198 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 280 | ipw->request_attr_memory.Size); | 199 | link->irq.Handler = ipwireless_interrupt; |
| 281 | request_mem_region(ipw->request_attr_memory.Base, ipw->request_attr_memory.Size, | ||
| 282 | IPWIRELESS_PCCARD_NAME); | ||
| 283 | } | ||
| 284 | 200 | ||
| 285 | INIT_WORK(&ipw->work_reboot, signalled_reboot_work); | 201 | INIT_WORK(&ipw->work_reboot, signalled_reboot_work); |
| 286 | 202 | ||
| @@ -291,10 +207,8 @@ static int config_ipwireless(struct ipw_dev *ipw) | |||
| 291 | 207 | ||
| 292 | ret = pcmcia_request_irq(link, &link->irq); | 208 | ret = pcmcia_request_irq(link, &link->irq); |
| 293 | 209 | ||
| 294 | if (ret != 0) { | 210 | if (ret != 0) |
| 295 | cs_error(link, RequestIRQ, ret); | 211 | goto exit; |
| 296 | goto exit3; | ||
| 297 | } | ||
| 298 | 212 | ||
| 299 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n", | 213 | printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n", |
| 300 | ipw->is_v2_card ? "V2/V3" : "V1"); | 214 | ipw->is_v2_card ? "V2/V3" : "V1"); |
| @@ -316,12 +230,12 @@ static int config_ipwireless(struct ipw_dev *ipw) | |||
| 316 | 230 | ||
| 317 | ipw->network = ipwireless_network_create(ipw->hardware); | 231 | ipw->network = ipwireless_network_create(ipw->hardware); |
| 318 | if (!ipw->network) | 232 | if (!ipw->network) |
| 319 | goto exit3; | 233 | goto exit; |
| 320 | 234 | ||
| 321 | ipw->tty = ipwireless_tty_create(ipw->hardware, ipw->network, | 235 | ipw->tty = ipwireless_tty_create(ipw->hardware, ipw->network, |
| 322 | ipw->nodes); | 236 | ipw->nodes); |
| 323 | if (!ipw->tty) | 237 | if (!ipw->tty) |
| 324 | goto exit3; | 238 | goto exit; |
| 325 | 239 | ||
| 326 | ipwireless_init_hardware_v2_v3(ipw->hardware); | 240 | ipwireless_init_hardware_v2_v3(ipw->hardware); |
| 327 | 241 | ||
| @@ -331,35 +245,27 @@ static int config_ipwireless(struct ipw_dev *ipw) | |||
| 331 | */ | 245 | */ |
| 332 | ret = pcmcia_request_configuration(link, &link->conf); | 246 | ret = pcmcia_request_configuration(link, &link->conf); |
| 333 | 247 | ||
| 334 | if (ret != 0) { | 248 | if (ret != 0) |
| 335 | cs_error(link, RequestConfiguration, ret); | 249 | goto exit; |
| 336 | goto exit4; | ||
| 337 | } | ||
| 338 | 250 | ||
| 339 | link->dev_node = &ipw->nodes[0]; | 251 | link->dev_node = &ipw->nodes[0]; |
| 340 | 252 | ||
| 341 | return 0; | 253 | return 0; |
| 342 | 254 | ||
| 343 | exit4: | 255 | exit: |
| 344 | pcmcia_disable_device(link); | ||
| 345 | exit3: | ||
| 346 | if (ipw->attr_memory) { | 256 | if (ipw->attr_memory) { |
| 347 | release_mem_region(ipw->request_attr_memory.Base, | 257 | release_mem_region(ipw->request_attr_memory.Base, |
| 348 | ipw->request_attr_memory.Size); | 258 | ipw->request_attr_memory.Size); |
| 349 | iounmap(ipw->attr_memory); | 259 | iounmap(ipw->attr_memory); |
| 350 | pcmcia_release_window(ipw->handle_attr_memory); | 260 | pcmcia_release_window(link, ipw->handle_attr_memory); |
| 351 | pcmcia_disable_device(link); | ||
| 352 | } | 261 | } |
| 353 | exit2: | ||
| 354 | if (ipw->common_memory) { | 262 | if (ipw->common_memory) { |
| 355 | release_mem_region(ipw->request_common_memory.Base, | 263 | release_mem_region(ipw->request_common_memory.Base, |
| 356 | ipw->request_common_memory.Size); | 264 | ipw->request_common_memory.Size); |
| 357 | iounmap(ipw->common_memory); | 265 | iounmap(ipw->common_memory); |
| 358 | pcmcia_release_window(ipw->handle_common_memory); | 266 | pcmcia_release_window(link, ipw->handle_common_memory); |
| 359 | } | 267 | } |
| 360 | exit1: | ||
| 361 | pcmcia_disable_device(link); | 268 | pcmcia_disable_device(link); |
| 362 | exit0: | ||
| 363 | return -1; | 269 | return -1; |
| 364 | } | 270 | } |
| 365 | 271 | ||
| @@ -378,9 +284,9 @@ static void release_ipwireless(struct ipw_dev *ipw) | |||
| 378 | iounmap(ipw->attr_memory); | 284 | iounmap(ipw->attr_memory); |
| 379 | } | 285 | } |
| 380 | if (ipw->common_memory) | 286 | if (ipw->common_memory) |
| 381 | pcmcia_release_window(ipw->handle_common_memory); | 287 | pcmcia_release_window(ipw->link, ipw->handle_common_memory); |
| 382 | if (ipw->attr_memory) | 288 | if (ipw->attr_memory) |
| 383 | pcmcia_release_window(ipw->handle_attr_memory); | 289 | pcmcia_release_window(ipw->link, ipw->handle_attr_memory); |
| 384 | 290 | ||
| 385 | /* Break the link with Card Services */ | 291 | /* Break the link with Card Services */ |
| 386 | pcmcia_disable_device(ipw->link); | 292 | pcmcia_disable_device(ipw->link); |
| @@ -406,7 +312,6 @@ static int ipwireless_attach(struct pcmcia_device *link) | |||
| 406 | 312 | ||
| 407 | ipw->link = link; | 313 | ipw->link = link; |
| 408 | link->priv = ipw; | 314 | link->priv = ipw; |
| 409 | link->irq.Instance = ipw; | ||
| 410 | 315 | ||
| 411 | /* Link this device into our device list. */ | 316 | /* Link this device into our device list. */ |
| 412 | link->dev_node = &ipw->nodes[0]; | 317 | link->dev_node = &ipw->nodes[0]; |
| @@ -421,7 +326,6 @@ static int ipwireless_attach(struct pcmcia_device *link) | |||
| 421 | ret = config_ipwireless(ipw); | 326 | ret = config_ipwireless(ipw); |
| 422 | 327 | ||
| 423 | if (ret != 0) { | 328 | if (ret != 0) { |
| 424 | cs_error(link, RegisterClient, ret); | ||
| 425 | ipwireless_detach(link); | 329 | ipwireless_detach(link); |
| 426 | return ret; | 330 | return ret; |
| 427 | } | 331 | } |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index caf6e4d19469..c31a0d913d37 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
| @@ -554,7 +554,6 @@ static int mgslpc_probe(struct pcmcia_device *link) | |||
| 554 | 554 | ||
| 555 | /* Interrupt setup */ | 555 | /* Interrupt setup */ |
| 556 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 556 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 557 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 558 | link->irq.Handler = NULL; | 557 | link->irq.Handler = NULL; |
| 559 | 558 | ||
| 560 | link->conf.Attributes = 0; | 559 | link->conf.Attributes = 0; |
| @@ -572,69 +571,51 @@ static int mgslpc_probe(struct pcmcia_device *link) | |||
| 572 | /* Card has been inserted. | 571 | /* Card has been inserted. |
| 573 | */ | 572 | */ |
| 574 | 573 | ||
| 575 | #define CS_CHECK(fn, ret) \ | 574 | static int mgslpc_ioprobe(struct pcmcia_device *p_dev, |
| 576 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 575 | cistpl_cftable_entry_t *cfg, |
| 576 | cistpl_cftable_entry_t *dflt, | ||
| 577 | unsigned int vcc, | ||
| 578 | void *priv_data) | ||
| 579 | { | ||
| 580 | if (cfg->io.nwin > 0) { | ||
| 581 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 582 | if (!(cfg->io.flags & CISTPL_IO_8BIT)) | ||
| 583 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 584 | if (!(cfg->io.flags & CISTPL_IO_16BIT)) | ||
| 585 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 586 | p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; | ||
| 587 | p_dev->io.BasePort1 = cfg->io.win[0].base; | ||
| 588 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | ||
| 589 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
| 590 | } | ||
| 591 | return -ENODEV; | ||
| 592 | } | ||
| 577 | 593 | ||
| 578 | static int mgslpc_config(struct pcmcia_device *link) | 594 | static int mgslpc_config(struct pcmcia_device *link) |
| 579 | { | 595 | { |
| 580 | MGSLPC_INFO *info = link->priv; | 596 | MGSLPC_INFO *info = link->priv; |
| 581 | tuple_t tuple; | 597 | int ret; |
| 582 | cisparse_t parse; | ||
| 583 | int last_fn, last_ret; | ||
| 584 | u_char buf[64]; | ||
| 585 | cistpl_cftable_entry_t dflt = { 0 }; | ||
| 586 | cistpl_cftable_entry_t *cfg; | ||
| 587 | 598 | ||
| 588 | if (debug_level >= DEBUG_LEVEL_INFO) | 599 | if (debug_level >= DEBUG_LEVEL_INFO) |
| 589 | printk("mgslpc_config(0x%p)\n", link); | 600 | printk("mgslpc_config(0x%p)\n", link); |
| 590 | 601 | ||
| 591 | tuple.Attributes = 0; | 602 | ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL); |
| 592 | tuple.TupleData = buf; | 603 | if (ret != 0) |
| 593 | tuple.TupleDataMax = sizeof(buf); | 604 | goto failed; |
| 594 | tuple.TupleOffset = 0; | ||
| 595 | |||
| 596 | /* get CIS configuration entry */ | ||
| 597 | |||
| 598 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 599 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
| 600 | |||
| 601 | cfg = &(parse.cftable_entry); | ||
| 602 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
| 603 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(&tuple, &parse)); | ||
| 604 | |||
| 605 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; | ||
| 606 | if (cfg->index == 0) | ||
| 607 | goto cs_failed; | ||
| 608 | |||
| 609 | link->conf.ConfigIndex = cfg->index; | ||
| 610 | link->conf.Attributes |= CONF_ENABLE_IRQ; | ||
| 611 | |||
| 612 | /* IO window settings */ | ||
| 613 | link->io.NumPorts1 = 0; | ||
| 614 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 615 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 616 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 617 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 618 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 619 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 620 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 621 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 622 | link->io.BasePort1 = io->win[0].base; | ||
| 623 | link->io.NumPorts1 = io->win[0].len; | ||
| 624 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | ||
| 625 | } | ||
| 626 | 605 | ||
| 627 | link->conf.Attributes = CONF_ENABLE_IRQ; | 606 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 628 | link->conf.IntType = INT_MEMORY_AND_IO; | 607 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 629 | link->conf.ConfigIndex = 8; | 608 | link->conf.ConfigIndex = 8; |
| 630 | link->conf.Present = PRESENT_OPTION; | 609 | link->conf.Present = PRESENT_OPTION; |
| 631 | 610 | ||
| 632 | link->irq.Attributes |= IRQ_HANDLE_PRESENT; | ||
| 633 | link->irq.Handler = mgslpc_isr; | 611 | link->irq.Handler = mgslpc_isr; |
| 634 | link->irq.Instance = info; | ||
| 635 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | ||
| 636 | 612 | ||
| 637 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 613 | ret = pcmcia_request_irq(link, &link->irq); |
| 614 | if (ret) | ||
| 615 | goto failed; | ||
| 616 | ret = pcmcia_request_configuration(link, &link->conf); | ||
| 617 | if (ret) | ||
| 618 | goto failed; | ||
| 638 | 619 | ||
| 639 | info->io_base = link->io.BasePort1; | 620 | info->io_base = link->io.BasePort1; |
| 640 | info->irq_level = link->irq.AssignedIRQ; | 621 | info->irq_level = link->irq.AssignedIRQ; |
| @@ -654,8 +635,7 @@ static int mgslpc_config(struct pcmcia_device *link) | |||
| 654 | printk("\n"); | 635 | printk("\n"); |
| 655 | return 0; | 636 | return 0; |
| 656 | 637 | ||
| 657 | cs_failed: | 638 | failed: |
| 658 | cs_error(link, last_fn, last_ret); | ||
| 659 | mgslpc_release((u_long)link); | 639 | mgslpc_release((u_long)link); |
| 660 | return -ENODEV; | 640 | return -ENODEV; |
| 661 | } | 641 | } |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 47c2d2763456..f06bb37defb1 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | enum tpm_const { | 32 | enum tpm_const { |
| 33 | TPM_MINOR = 224, /* officially assigned */ | 33 | TPM_MINOR = 224, /* officially assigned */ |
| 34 | TPM_BUFSIZE = 2048, | 34 | TPM_BUFSIZE = 4096, |
| 35 | TPM_NUM_DEVICES = 256, | 35 | TPM_NUM_DEVICES = 256, |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 0b73e4ec1add..2405f17b29dd 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
| @@ -257,6 +257,10 @@ out: | |||
| 257 | return size; | 257 | return size; |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | static int itpm; | ||
| 261 | module_param(itpm, bool, 0444); | ||
| 262 | MODULE_PARM_DESC(itpm, "Force iTPM workarounds (found on some Lenovo laptops)"); | ||
| 263 | |||
| 260 | /* | 264 | /* |
| 261 | * If interrupts are used (signaled by an irq set in the vendor structure) | 265 | * If interrupts are used (signaled by an irq set in the vendor structure) |
| 262 | * tpm.c can skip polling for the data to be available as the interrupt is | 266 | * tpm.c can skip polling for the data to be available as the interrupt is |
| @@ -293,7 +297,7 @@ static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) | |||
| 293 | wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, | 297 | wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, |
| 294 | &chip->vendor.int_queue); | 298 | &chip->vendor.int_queue); |
| 295 | status = tpm_tis_status(chip); | 299 | status = tpm_tis_status(chip); |
| 296 | if ((status & TPM_STS_DATA_EXPECT) == 0) { | 300 | if (!itpm && (status & TPM_STS_DATA_EXPECT) == 0) { |
| 297 | rc = -EIO; | 301 | rc = -EIO; |
| 298 | goto out_err; | 302 | goto out_err; |
| 299 | } | 303 | } |
| @@ -467,6 +471,10 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, | |||
| 467 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", | 471 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", |
| 468 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); | 472 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); |
| 469 | 473 | ||
| 474 | if (itpm) | ||
| 475 | dev_info(dev, "Intel iTPM workaround enabled\n"); | ||
| 476 | |||
| 477 | |||
| 470 | /* Figure out the capabilities */ | 478 | /* Figure out the capabilities */ |
| 471 | intfcaps = | 479 | intfcaps = |
| 472 | ioread32(chip->vendor.iobase + | 480 | ioread32(chip->vendor.iobase + |
| @@ -629,6 +637,7 @@ static struct pnp_device_id tpm_pnp_tbl[] __devinitdata = { | |||
| 629 | {"", 0}, /* User Specified */ | 637 | {"", 0}, /* User Specified */ |
| 630 | {"", 0} /* Terminator */ | 638 | {"", 0} /* Terminator */ |
| 631 | }; | 639 | }; |
| 640 | MODULE_DEVICE_TABLE(pnp, tpm_pnp_tbl); | ||
| 632 | 641 | ||
| 633 | static __devexit void tpm_tis_pnp_remove(struct pnp_dev *dev) | 642 | static __devexit void tpm_tis_pnp_remove(struct pnp_dev *dev) |
| 634 | { | 643 | { |
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c index a4bbb28f10be..c63f3d33914a 100644 --- a/drivers/char/tty_port.c +++ b/drivers/char/tty_port.c | |||
| @@ -219,8 +219,14 @@ int tty_port_block_til_ready(struct tty_port *port, | |||
| 219 | 219 | ||
| 220 | /* if non-blocking mode is set we can pass directly to open unless | 220 | /* if non-blocking mode is set we can pass directly to open unless |
| 221 | the port has just hung up or is in another error state */ | 221 | the port has just hung up or is in another error state */ |
| 222 | if ((filp->f_flags & O_NONBLOCK) || | 222 | if (tty->flags & (1 << TTY_IO_ERROR)) { |
| 223 | (tty->flags & (1 << TTY_IO_ERROR))) { | 223 | port->flags |= ASYNC_NORMAL_ACTIVE; |
| 224 | return 0; | ||
| 225 | } | ||
| 226 | if (filp->f_flags & O_NONBLOCK) { | ||
| 227 | /* Indicate we are open */ | ||
| 228 | if (tty->termios->c_cflag & CBAUD) | ||
| 229 | tty_port_raise_dtr_rts(port); | ||
| 224 | port->flags |= ASYNC_NORMAL_ACTIVE; | 230 | port->flags |= ASYNC_NORMAL_ACTIVE; |
| 225 | return 0; | 231 | return 0; |
| 226 | } | 232 | } |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index ed86d3bf249a..6aa10284104a 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
| @@ -103,8 +103,8 @@ void vt_event_post(unsigned int event, unsigned int old, unsigned int new) | |||
| 103 | ve->event.event = event; | 103 | ve->event.event = event; |
| 104 | /* kernel view is consoles 0..n-1, user space view is | 104 | /* kernel view is consoles 0..n-1, user space view is |
| 105 | console 1..n with 0 meaning current, so we must bias */ | 105 | console 1..n with 0 meaning current, so we must bias */ |
| 106 | ve->event.old = old + 1; | 106 | ve->event.oldev = old + 1; |
| 107 | ve->event.new = new + 1; | 107 | ve->event.newev = new + 1; |
| 108 | wake = 1; | 108 | wake = 1; |
| 109 | ve->done = 1; | 109 | ve->done = 1; |
| 110 | } | 110 | } |
| @@ -186,7 +186,7 @@ int vt_waitactive(int n) | |||
| 186 | vt_event_wait(&vw); | 186 | vt_event_wait(&vw); |
| 187 | if (vw.done == 0) | 187 | if (vw.done == 0) |
| 188 | return -EINTR; | 188 | return -EINTR; |
| 189 | } while (vw.event.new != n); | 189 | } while (vw.event.newev != n); |
| 190 | return 0; | 190 | return 0; |
| 191 | } | 191 | } |
| 192 | 192 | ||
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 3938c7817095..ff57c40e9b8b 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -41,7 +41,7 @@ static struct cpufreq_driver *cpufreq_driver; | |||
| 41 | static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data); | 41 | static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data); |
| 42 | #ifdef CONFIG_HOTPLUG_CPU | 42 | #ifdef CONFIG_HOTPLUG_CPU |
| 43 | /* This one keeps track of the previously set governor of a removed CPU */ | 43 | /* This one keeps track of the previously set governor of a removed CPU */ |
| 44 | static DEFINE_PER_CPU(struct cpufreq_governor *, cpufreq_cpu_governor); | 44 | static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor); |
| 45 | #endif | 45 | #endif |
| 46 | static DEFINE_SPINLOCK(cpufreq_driver_lock); | 46 | static DEFINE_SPINLOCK(cpufreq_driver_lock); |
| 47 | 47 | ||
| @@ -774,10 +774,12 @@ int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy, | |||
| 774 | #ifdef CONFIG_SMP | 774 | #ifdef CONFIG_SMP |
| 775 | unsigned long flags; | 775 | unsigned long flags; |
| 776 | unsigned int j; | 776 | unsigned int j; |
| 777 | |||
| 778 | #ifdef CONFIG_HOTPLUG_CPU | 777 | #ifdef CONFIG_HOTPLUG_CPU |
| 779 | if (per_cpu(cpufreq_cpu_governor, cpu)) { | 778 | struct cpufreq_governor *gov; |
| 780 | policy->governor = per_cpu(cpufreq_cpu_governor, cpu); | 779 | |
| 780 | gov = __find_governor(per_cpu(cpufreq_cpu_governor, cpu)); | ||
| 781 | if (gov) { | ||
| 782 | policy->governor = gov; | ||
| 781 | dprintk("Restoring governor %s for cpu %d\n", | 783 | dprintk("Restoring governor %s for cpu %d\n", |
| 782 | policy->governor->name, cpu); | 784 | policy->governor->name, cpu); |
| 783 | } | 785 | } |
| @@ -949,10 +951,13 @@ err_out_kobj_put: | |||
| 949 | static int cpufreq_add_dev(struct sys_device *sys_dev) | 951 | static int cpufreq_add_dev(struct sys_device *sys_dev) |
| 950 | { | 952 | { |
| 951 | unsigned int cpu = sys_dev->id; | 953 | unsigned int cpu = sys_dev->id; |
| 952 | int ret = 0; | 954 | int ret = 0, found = 0; |
| 953 | struct cpufreq_policy *policy; | 955 | struct cpufreq_policy *policy; |
| 954 | unsigned long flags; | 956 | unsigned long flags; |
| 955 | unsigned int j; | 957 | unsigned int j; |
| 958 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 959 | int sibling; | ||
| 960 | #endif | ||
| 956 | 961 | ||
| 957 | if (cpu_is_offline(cpu)) | 962 | if (cpu_is_offline(cpu)) |
| 958 | return 0; | 963 | return 0; |
| @@ -999,7 +1004,19 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
| 999 | INIT_WORK(&policy->update, handle_update); | 1004 | INIT_WORK(&policy->update, handle_update); |
| 1000 | 1005 | ||
| 1001 | /* Set governor before ->init, so that driver could check it */ | 1006 | /* Set governor before ->init, so that driver could check it */ |
| 1002 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 1007 | #ifdef CONFIG_HOTPLUG_CPU |
| 1008 | for_each_online_cpu(sibling) { | ||
| 1009 | struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling); | ||
| 1010 | if (cp && cp->governor && | ||
| 1011 | (cpumask_test_cpu(cpu, cp->related_cpus))) { | ||
| 1012 | policy->governor = cp->governor; | ||
| 1013 | found = 1; | ||
| 1014 | break; | ||
| 1015 | } | ||
| 1016 | } | ||
| 1017 | #endif | ||
| 1018 | if (!found) | ||
| 1019 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 1003 | /* call driver. From then on the cpufreq must be able | 1020 | /* call driver. From then on the cpufreq must be able |
| 1004 | * to accept all calls to ->verify and ->setpolicy for this CPU | 1021 | * to accept all calls to ->verify and ->setpolicy for this CPU |
| 1005 | */ | 1022 | */ |
| @@ -1111,7 +1128,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) | |||
| 1111 | #ifdef CONFIG_SMP | 1128 | #ifdef CONFIG_SMP |
| 1112 | 1129 | ||
| 1113 | #ifdef CONFIG_HOTPLUG_CPU | 1130 | #ifdef CONFIG_HOTPLUG_CPU |
| 1114 | per_cpu(cpufreq_cpu_governor, cpu) = data->governor; | 1131 | strncpy(per_cpu(cpufreq_cpu_governor, cpu), data->governor->name, |
| 1132 | CPUFREQ_NAME_LEN); | ||
| 1115 | #endif | 1133 | #endif |
| 1116 | 1134 | ||
| 1117 | /* if we have other CPUs still registered, we need to unlink them, | 1135 | /* if we have other CPUs still registered, we need to unlink them, |
| @@ -1135,7 +1153,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) | |||
| 1135 | continue; | 1153 | continue; |
| 1136 | dprintk("removing link for cpu %u\n", j); | 1154 | dprintk("removing link for cpu %u\n", j); |
| 1137 | #ifdef CONFIG_HOTPLUG_CPU | 1155 | #ifdef CONFIG_HOTPLUG_CPU |
| 1138 | per_cpu(cpufreq_cpu_governor, j) = data->governor; | 1156 | strncpy(per_cpu(cpufreq_cpu_governor, j), |
| 1157 | data->governor->name, CPUFREQ_NAME_LEN); | ||
| 1139 | #endif | 1158 | #endif |
| 1140 | cpu_sys_dev = get_cpu_sysdev(j); | 1159 | cpu_sys_dev = get_cpu_sysdev(j); |
| 1141 | sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); | 1160 | sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); |
| @@ -1606,9 +1625,22 @@ EXPORT_SYMBOL_GPL(cpufreq_register_governor); | |||
| 1606 | 1625 | ||
| 1607 | void cpufreq_unregister_governor(struct cpufreq_governor *governor) | 1626 | void cpufreq_unregister_governor(struct cpufreq_governor *governor) |
| 1608 | { | 1627 | { |
| 1628 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 1629 | int cpu; | ||
| 1630 | #endif | ||
| 1631 | |||
| 1609 | if (!governor) | 1632 | if (!governor) |
| 1610 | return; | 1633 | return; |
| 1611 | 1634 | ||
| 1635 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 1636 | for_each_present_cpu(cpu) { | ||
| 1637 | if (cpu_online(cpu)) | ||
| 1638 | continue; | ||
| 1639 | if (!strcmp(per_cpu(cpufreq_cpu_governor, cpu), governor->name)) | ||
| 1640 | strcpy(per_cpu(cpufreq_cpu_governor, cpu), "\0"); | ||
| 1641 | } | ||
| 1642 | #endif | ||
| 1643 | |||
| 1612 | mutex_lock(&cpufreq_governor_mutex); | 1644 | mutex_lock(&cpufreq_governor_mutex); |
| 1613 | list_del(&governor->governor_list); | 1645 | list_del(&governor->governor_list); |
| 1614 | mutex_unlock(&cpufreq_governor_mutex); | 1646 | mutex_unlock(&cpufreq_governor_mutex); |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index bc33ddc9c97c..c7b081b839ff 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
| @@ -116,9 +116,9 @@ static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu, | |||
| 116 | 116 | ||
| 117 | idle_time = cputime64_sub(cur_wall_time, busy_time); | 117 | idle_time = cputime64_sub(cur_wall_time, busy_time); |
| 118 | if (wall) | 118 | if (wall) |
| 119 | *wall = cur_wall_time; | 119 | *wall = (cputime64_t)jiffies_to_usecs(cur_wall_time); |
| 120 | 120 | ||
| 121 | return idle_time; | 121 | return (cputime64_t)jiffies_to_usecs(idle_time);; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall) | 124 | static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall) |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 071699de50ee..4b34ade2332b 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
| @@ -133,9 +133,9 @@ static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu, | |||
| 133 | 133 | ||
| 134 | idle_time = cputime64_sub(cur_wall_time, busy_time); | 134 | idle_time = cputime64_sub(cur_wall_time, busy_time); |
| 135 | if (wall) | 135 | if (wall) |
| 136 | *wall = cur_wall_time; | 136 | *wall = (cputime64_t)jiffies_to_usecs(cur_wall_time); |
| 137 | 137 | ||
| 138 | return idle_time; | 138 | return (cputime64_t)jiffies_to_usecs(idle_time); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall) | 141 | static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall) |
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index a9952b1236b0..84c51e177269 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c | |||
| @@ -236,7 +236,7 @@ static inline void ecb_crypt(const u8 *in, u8 *out, u32 *key, | |||
| 236 | /* Padlock in ECB mode fetches at least ecb_fetch_bytes of data. | 236 | /* Padlock in ECB mode fetches at least ecb_fetch_bytes of data. |
| 237 | * We could avoid some copying here but it's probably not worth it. | 237 | * We could avoid some copying here but it's probably not worth it. |
| 238 | */ | 238 | */ |
| 239 | if (unlikely(((unsigned long)in & PAGE_SIZE) + ecb_fetch_bytes > PAGE_SIZE)) { | 239 | if (unlikely(((unsigned long)in & ~PAGE_MASK) + ecb_fetch_bytes > PAGE_SIZE)) { |
| 240 | ecb_crypt_copy(in, out, key, cword, count); | 240 | ecb_crypt_copy(in, out, key, cword, count); |
| 241 | return; | 241 | return; |
| 242 | } | 242 | } |
| @@ -248,7 +248,7 @@ static inline u8 *cbc_crypt(const u8 *in, u8 *out, u32 *key, | |||
| 248 | u8 *iv, struct cword *cword, int count) | 248 | u8 *iv, struct cword *cword, int count) |
| 249 | { | 249 | { |
| 250 | /* Padlock in CBC mode fetches at least cbc_fetch_bytes of data. */ | 250 | /* Padlock in CBC mode fetches at least cbc_fetch_bytes of data. */ |
| 251 | if (unlikely(((unsigned long)in & PAGE_SIZE) + cbc_fetch_bytes > PAGE_SIZE)) | 251 | if (unlikely(((unsigned long)in & ~PAGE_MASK) + cbc_fetch_bytes > PAGE_SIZE)) |
| 252 | return cbc_crypt_copy(in, out, key, iv, cword, count); | 252 | return cbc_crypt_copy(in, out, key, iv, cword, count); |
| 253 | 253 | ||
| 254 | return rep_xcrypt_cbc(in, out, key, iv, cword, count); | 254 | return rep_xcrypt_cbc(in, out, key, iv, cword, count); |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 5903a88351bf..b401dadad4a8 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
| @@ -26,6 +26,8 @@ config INTEL_IOATDMA | |||
| 26 | select DMA_ENGINE | 26 | select DMA_ENGINE |
| 27 | select DCA | 27 | select DCA |
| 28 | select ASYNC_TX_DISABLE_CHANNEL_SWITCH | 28 | select ASYNC_TX_DISABLE_CHANNEL_SWITCH |
| 29 | select ASYNC_TX_DISABLE_PQ_VAL_DMA | ||
| 30 | select ASYNC_TX_DISABLE_XOR_VAL_DMA | ||
| 29 | help | 31 | help |
| 30 | Enable support for the Intel(R) I/OAT DMA engine present | 32 | Enable support for the Intel(R) I/OAT DMA engine present |
| 31 | in recent Intel Xeon chipsets. | 33 | in recent Intel Xeon chipsets. |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index bd0b248de2cf..8f99354082ce 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
| @@ -632,11 +632,21 @@ static bool device_has_all_tx_types(struct dma_device *device) | |||
| 632 | #if defined(CONFIG_ASYNC_XOR) || defined(CONFIG_ASYNC_XOR_MODULE) | 632 | #if defined(CONFIG_ASYNC_XOR) || defined(CONFIG_ASYNC_XOR_MODULE) |
| 633 | if (!dma_has_cap(DMA_XOR, device->cap_mask)) | 633 | if (!dma_has_cap(DMA_XOR, device->cap_mask)) |
| 634 | return false; | 634 | return false; |
| 635 | |||
| 636 | #ifndef CONFIG_ASYNC_TX_DISABLE_XOR_VAL_DMA | ||
| 637 | if (!dma_has_cap(DMA_XOR_VAL, device->cap_mask)) | ||
| 638 | return false; | ||
| 639 | #endif | ||
| 635 | #endif | 640 | #endif |
| 636 | 641 | ||
| 637 | #if defined(CONFIG_ASYNC_PQ) || defined(CONFIG_ASYNC_PQ_MODULE) | 642 | #if defined(CONFIG_ASYNC_PQ) || defined(CONFIG_ASYNC_PQ_MODULE) |
| 638 | if (!dma_has_cap(DMA_PQ, device->cap_mask)) | 643 | if (!dma_has_cap(DMA_PQ, device->cap_mask)) |
| 639 | return false; | 644 | return false; |
| 645 | |||
| 646 | #ifndef CONFIG_ASYNC_TX_DISABLE_PQ_VAL_DMA | ||
| 647 | if (!dma_has_cap(DMA_PQ_VAL, device->cap_mask)) | ||
| 648 | return false; | ||
| 649 | #endif | ||
| 640 | #endif | 650 | #endif |
| 641 | 651 | ||
| 642 | return true; | 652 | return true; |
diff --git a/drivers/dma/ioat/dca.c b/drivers/dma/ioat/dca.c index 69d02615c4d6..abd9038e06b1 100644 --- a/drivers/dma/ioat/dca.c +++ b/drivers/dma/ioat/dca.c | |||
| @@ -98,17 +98,17 @@ static int dca_enabled_in_bios(struct pci_dev *pdev) | |||
| 98 | cpuid_level_9 = cpuid_eax(9); | 98 | cpuid_level_9 = cpuid_eax(9); |
| 99 | res = test_bit(0, &cpuid_level_9); | 99 | res = test_bit(0, &cpuid_level_9); |
| 100 | if (!res) | 100 | if (!res) |
| 101 | dev_err(&pdev->dev, "DCA is disabled in BIOS\n"); | 101 | dev_dbg(&pdev->dev, "DCA is disabled in BIOS\n"); |
| 102 | 102 | ||
| 103 | return res; | 103 | return res; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | static int system_has_dca_enabled(struct pci_dev *pdev) | 106 | int system_has_dca_enabled(struct pci_dev *pdev) |
| 107 | { | 107 | { |
| 108 | if (boot_cpu_has(X86_FEATURE_DCA)) | 108 | if (boot_cpu_has(X86_FEATURE_DCA)) |
| 109 | return dca_enabled_in_bios(pdev); | 109 | return dca_enabled_in_bios(pdev); |
| 110 | 110 | ||
| 111 | dev_err(&pdev->dev, "boot cpu doesn't have X86_FEATURE_DCA\n"); | 111 | dev_dbg(&pdev->dev, "boot cpu doesn't have X86_FEATURE_DCA\n"); |
| 112 | return 0; | 112 | return 0; |
| 113 | } | 113 | } |
| 114 | 114 | ||
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index c14fdfeb7f33..45edde996480 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h | |||
| @@ -297,9 +297,7 @@ static inline bool is_ioat_suspended(unsigned long status) | |||
| 297 | /* channel was fatally programmed */ | 297 | /* channel was fatally programmed */ |
| 298 | static inline bool is_ioat_bug(unsigned long err) | 298 | static inline bool is_ioat_bug(unsigned long err) |
| 299 | { | 299 | { |
| 300 | return !!(err & (IOAT_CHANERR_SRC_ADDR_ERR|IOAT_CHANERR_DEST_ADDR_ERR| | 300 | return !!err; |
| 301 | IOAT_CHANERR_NEXT_ADDR_ERR|IOAT_CHANERR_CONTROL_ERR| | ||
| 302 | IOAT_CHANERR_LENGTH_ERR)); | ||
| 303 | } | 301 | } |
| 304 | 302 | ||
| 305 | static inline void ioat_unmap(struct pci_dev *pdev, dma_addr_t addr, size_t len, | 303 | static inline void ioat_unmap(struct pci_dev *pdev, dma_addr_t addr, size_t len, |
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index 96ffab7d37a7..8f1f7f05deaa 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c | |||
| @@ -279,6 +279,8 @@ void ioat2_timer_event(unsigned long data) | |||
| 279 | u32 chanerr; | 279 | u32 chanerr; |
| 280 | 280 | ||
| 281 | chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); | 281 | chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); |
| 282 | dev_err(to_dev(chan), "%s: Channel halted (%x)\n", | ||
| 283 | __func__, chanerr); | ||
| 282 | BUG_ON(is_ioat_bug(chanerr)); | 284 | BUG_ON(is_ioat_bug(chanerr)); |
| 283 | } | 285 | } |
| 284 | 286 | ||
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 35d1e33afd5b..42f6f10fb0cc 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
| @@ -378,6 +378,8 @@ static void ioat3_timer_event(unsigned long data) | |||
| 378 | u32 chanerr; | 378 | u32 chanerr; |
| 379 | 379 | ||
| 380 | chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); | 380 | chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); |
| 381 | dev_err(to_dev(chan), "%s: Channel halted (%x)\n", | ||
| 382 | __func__, chanerr); | ||
| 381 | BUG_ON(is_ioat_bug(chanerr)); | 383 | BUG_ON(is_ioat_bug(chanerr)); |
| 382 | } | 384 | } |
| 383 | 385 | ||
| @@ -569,7 +571,7 @@ __ioat3_prep_xor_lock(struct dma_chan *c, enum sum_check_flags *result, | |||
| 569 | dump_desc_dbg(ioat, compl_desc); | 571 | dump_desc_dbg(ioat, compl_desc); |
| 570 | 572 | ||
| 571 | /* we leave the channel locked to ensure in order submission */ | 573 | /* we leave the channel locked to ensure in order submission */ |
| 572 | return &desc->txd; | 574 | return &compl_desc->txd; |
| 573 | } | 575 | } |
| 574 | 576 | ||
| 575 | static struct dma_async_tx_descriptor * | 577 | static struct dma_async_tx_descriptor * |
| @@ -728,7 +730,7 @@ __ioat3_prep_pq_lock(struct dma_chan *c, enum sum_check_flags *result, | |||
| 728 | dump_desc_dbg(ioat, compl_desc); | 730 | dump_desc_dbg(ioat, compl_desc); |
| 729 | 731 | ||
| 730 | /* we leave the channel locked to ensure in order submission */ | 732 | /* we leave the channel locked to ensure in order submission */ |
| 731 | return &desc->txd; | 733 | return &compl_desc->txd; |
| 732 | } | 734 | } |
| 733 | 735 | ||
| 734 | static struct dma_async_tx_descriptor * | 736 | static struct dma_async_tx_descriptor * |
| @@ -736,10 +738,16 @@ ioat3_prep_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src, | |||
| 736 | unsigned int src_cnt, const unsigned char *scf, size_t len, | 738 | unsigned int src_cnt, const unsigned char *scf, size_t len, |
| 737 | unsigned long flags) | 739 | unsigned long flags) |
| 738 | { | 740 | { |
| 741 | /* specify valid address for disabled result */ | ||
| 742 | if (flags & DMA_PREP_PQ_DISABLE_P) | ||
| 743 | dst[0] = dst[1]; | ||
| 744 | if (flags & DMA_PREP_PQ_DISABLE_Q) | ||
| 745 | dst[1] = dst[0]; | ||
| 746 | |||
| 739 | /* handle the single source multiply case from the raid6 | 747 | /* handle the single source multiply case from the raid6 |
| 740 | * recovery path | 748 | * recovery path |
| 741 | */ | 749 | */ |
| 742 | if (unlikely((flags & DMA_PREP_PQ_DISABLE_P) && src_cnt == 1)) { | 750 | if ((flags & DMA_PREP_PQ_DISABLE_P) && src_cnt == 1) { |
| 743 | dma_addr_t single_source[2]; | 751 | dma_addr_t single_source[2]; |
| 744 | unsigned char single_source_coef[2]; | 752 | unsigned char single_source_coef[2]; |
| 745 | 753 | ||
| @@ -761,6 +769,12 @@ ioat3_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src, | |||
| 761 | unsigned int src_cnt, const unsigned char *scf, size_t len, | 769 | unsigned int src_cnt, const unsigned char *scf, size_t len, |
| 762 | enum sum_check_flags *pqres, unsigned long flags) | 770 | enum sum_check_flags *pqres, unsigned long flags) |
| 763 | { | 771 | { |
| 772 | /* specify valid address for disabled result */ | ||
| 773 | if (flags & DMA_PREP_PQ_DISABLE_P) | ||
| 774 | pq[0] = pq[1]; | ||
| 775 | if (flags & DMA_PREP_PQ_DISABLE_Q) | ||
| 776 | pq[1] = pq[0]; | ||
| 777 | |||
| 764 | /* the cleanup routine only sets bits on validate failure, it | 778 | /* the cleanup routine only sets bits on validate failure, it |
| 765 | * does not clear bits on validate success... so clear it here | 779 | * does not clear bits on validate success... so clear it here |
| 766 | */ | 780 | */ |
| @@ -778,9 +792,9 @@ ioat3_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src, | |||
| 778 | dma_addr_t pq[2]; | 792 | dma_addr_t pq[2]; |
| 779 | 793 | ||
| 780 | memset(scf, 0, src_cnt); | 794 | memset(scf, 0, src_cnt); |
| 781 | flags |= DMA_PREP_PQ_DISABLE_Q; | ||
| 782 | pq[0] = dst; | 795 | pq[0] = dst; |
| 783 | pq[1] = ~0; | 796 | flags |= DMA_PREP_PQ_DISABLE_Q; |
| 797 | pq[1] = dst; /* specify valid address for disabled result */ | ||
| 784 | 798 | ||
| 785 | return __ioat3_prep_pq_lock(chan, NULL, pq, src, src_cnt, scf, len, | 799 | return __ioat3_prep_pq_lock(chan, NULL, pq, src, src_cnt, scf, len, |
| 786 | flags); | 800 | flags); |
| @@ -800,9 +814,9 @@ ioat3_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src, | |||
| 800 | *result = 0; | 814 | *result = 0; |
| 801 | 815 | ||
| 802 | memset(scf, 0, src_cnt); | 816 | memset(scf, 0, src_cnt); |
| 803 | flags |= DMA_PREP_PQ_DISABLE_Q; | ||
| 804 | pq[0] = src[0]; | 817 | pq[0] = src[0]; |
| 805 | pq[1] = ~0; | 818 | flags |= DMA_PREP_PQ_DISABLE_Q; |
| 819 | pq[1] = pq[0]; /* specify valid address for disabled result */ | ||
| 806 | 820 | ||
| 807 | return __ioat3_prep_pq_lock(chan, result, pq, &src[1], src_cnt - 1, scf, | 821 | return __ioat3_prep_pq_lock(chan, result, pq, &src[1], src_cnt - 1, scf, |
| 808 | len, flags); | 822 | len, flags); |
| @@ -1117,6 +1131,7 @@ static int __devinit ioat3_dma_self_test(struct ioatdma_device *device) | |||
| 1117 | int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | 1131 | int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) |
| 1118 | { | 1132 | { |
| 1119 | struct pci_dev *pdev = device->pdev; | 1133 | struct pci_dev *pdev = device->pdev; |
| 1134 | int dca_en = system_has_dca_enabled(pdev); | ||
| 1120 | struct dma_device *dma; | 1135 | struct dma_device *dma; |
| 1121 | struct dma_chan *c; | 1136 | struct dma_chan *c; |
| 1122 | struct ioat_chan_common *chan; | 1137 | struct ioat_chan_common *chan; |
| @@ -1137,6 +1152,11 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | |||
| 1137 | dma->device_prep_dma_interrupt = ioat3_prep_interrupt_lock; | 1152 | dma->device_prep_dma_interrupt = ioat3_prep_interrupt_lock; |
| 1138 | 1153 | ||
| 1139 | cap = readl(device->reg_base + IOAT_DMA_CAP_OFFSET); | 1154 | cap = readl(device->reg_base + IOAT_DMA_CAP_OFFSET); |
| 1155 | |||
| 1156 | /* dca is incompatible with raid operations */ | ||
| 1157 | if (dca_en && (cap & (IOAT_CAP_XOR|IOAT_CAP_PQ))) | ||
| 1158 | cap &= ~(IOAT_CAP_XOR|IOAT_CAP_PQ); | ||
| 1159 | |||
| 1140 | if (cap & IOAT_CAP_XOR) { | 1160 | if (cap & IOAT_CAP_XOR) { |
| 1141 | is_raid_device = true; | 1161 | is_raid_device = true; |
| 1142 | dma->max_xor = 8; | 1162 | dma->max_xor = 8; |
| @@ -1186,6 +1206,16 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | |||
| 1186 | device->timer_fn = ioat2_timer_event; | 1206 | device->timer_fn = ioat2_timer_event; |
| 1187 | } | 1207 | } |
| 1188 | 1208 | ||
| 1209 | #ifdef CONFIG_ASYNC_TX_DISABLE_PQ_VAL_DMA | ||
| 1210 | dma_cap_clear(DMA_PQ_VAL, dma->cap_mask); | ||
| 1211 | dma->device_prep_dma_pq_val = NULL; | ||
| 1212 | #endif | ||
| 1213 | |||
| 1214 | #ifdef CONFIG_ASYNC_TX_DISABLE_XOR_VAL_DMA | ||
| 1215 | dma_cap_clear(DMA_XOR_VAL, dma->cap_mask); | ||
| 1216 | dma->device_prep_dma_xor_val = NULL; | ||
| 1217 | #endif | ||
| 1218 | |||
| 1189 | /* -= IOAT ver.3 workarounds =- */ | 1219 | /* -= IOAT ver.3 workarounds =- */ |
| 1190 | /* Write CHANERRMSK_INT with 3E07h to mask out the errors | 1220 | /* Write CHANERRMSK_INT with 3E07h to mask out the errors |
| 1191 | * that can cause stability issues for IOAT ver.3 | 1221 | * that can cause stability issues for IOAT ver.3 |
diff --git a/drivers/dma/ioat/hw.h b/drivers/dma/ioat/hw.h index 99afb12bd409..60e675455b6a 100644 --- a/drivers/dma/ioat/hw.h +++ b/drivers/dma/ioat/hw.h | |||
| @@ -39,6 +39,8 @@ | |||
| 39 | #define IOAT_VER_3_0 0x30 /* Version 3.0 */ | 39 | #define IOAT_VER_3_0 0x30 /* Version 3.0 */ |
| 40 | #define IOAT_VER_3_2 0x32 /* Version 3.2 */ | 40 | #define IOAT_VER_3_2 0x32 /* Version 3.2 */ |
| 41 | 41 | ||
| 42 | int system_has_dca_enabled(struct pci_dev *pdev); | ||
| 43 | |||
| 42 | struct ioat_dma_descriptor { | 44 | struct ioat_dma_descriptor { |
| 43 | uint32_t size; | 45 | uint32_t size; |
| 44 | union { | 46 | union { |
diff --git a/drivers/dma/ioat/registers.h b/drivers/dma/ioat/registers.h index 63038e18ab03..f015ec196700 100644 --- a/drivers/dma/ioat/registers.h +++ b/drivers/dma/ioat/registers.h | |||
| @@ -92,9 +92,7 @@ | |||
| 92 | #define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004 | 92 | #define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004 |
| 93 | #define IOAT_CHANCTRL_INT_REARM 0x0001 | 93 | #define IOAT_CHANCTRL_INT_REARM 0x0001 |
| 94 | #define IOAT_CHANCTRL_RUN (IOAT_CHANCTRL_INT_REARM |\ | 94 | #define IOAT_CHANCTRL_RUN (IOAT_CHANCTRL_INT_REARM |\ |
| 95 | IOAT_CHANCTRL_ERR_COMPLETION_EN |\ | 95 | IOAT_CHANCTRL_ANY_ERR_ABORT_EN) |
| 96 | IOAT_CHANCTRL_ANY_ERR_ABORT_EN |\ | ||
| 97 | IOAT_CHANCTRL_ERR_INT_EN) | ||
| 98 | 96 | ||
| 99 | #define IOAT_DMA_COMP_OFFSET 0x02 /* 16-bit DMA channel compatibility */ | 97 | #define IOAT_DMA_COMP_OFFSET 0x02 /* 16-bit DMA channel compatibility */ |
| 100 | #define IOAT_DMA_COMP_V1 0x0001 /* Compatibility with DMA version 1 */ | 98 | #define IOAT_DMA_COMP_V1 0x0001 /* Compatibility with DMA version 1 */ |
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index b3b065c4e5c1..034ecf0ace03 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
| @@ -640,17 +640,16 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
| 640 | #endif | 640 | #endif |
| 641 | struct sh_dmae_device *shdev; | 641 | struct sh_dmae_device *shdev; |
| 642 | 642 | ||
| 643 | /* get platform data */ | ||
| 644 | if (!pdev->dev.platform_data) | ||
| 645 | return -ENODEV; | ||
| 646 | |||
| 643 | shdev = kzalloc(sizeof(struct sh_dmae_device), GFP_KERNEL); | 647 | shdev = kzalloc(sizeof(struct sh_dmae_device), GFP_KERNEL); |
| 644 | if (!shdev) { | 648 | if (!shdev) { |
| 645 | dev_err(&pdev->dev, "No enough memory\n"); | 649 | dev_err(&pdev->dev, "No enough memory\n"); |
| 646 | err = -ENOMEM; | 650 | return -ENOMEM; |
| 647 | goto shdev_err; | ||
| 648 | } | 651 | } |
| 649 | 652 | ||
| 650 | /* get platform data */ | ||
| 651 | if (!pdev->dev.platform_data) | ||
| 652 | goto shdev_err; | ||
| 653 | |||
| 654 | /* platform data */ | 653 | /* platform data */ |
| 655 | memcpy(&shdev->pdata, pdev->dev.platform_data, | 654 | memcpy(&shdev->pdata, pdev->dev.platform_data, |
| 656 | sizeof(struct sh_dmae_pdata)); | 655 | sizeof(struct sh_dmae_pdata)); |
| @@ -722,7 +721,6 @@ eirq_err: | |||
| 722 | rst_err: | 721 | rst_err: |
| 723 | kfree(shdev); | 722 | kfree(shdev); |
| 724 | 723 | ||
| 725 | shdev_err: | ||
| 726 | return err; | 724 | return err; |
| 727 | } | 725 | } |
| 728 | 726 | ||
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index d4560d9d5a83..a38831c82649 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
| @@ -2254,7 +2254,7 @@ static inline void __amd64_decode_bus_error(struct mem_ctl_info *mci, | |||
| 2254 | { | 2254 | { |
| 2255 | u32 ec = ERROR_CODE(info->nbsl); | 2255 | u32 ec = ERROR_CODE(info->nbsl); |
| 2256 | u32 xec = EXT_ERROR_CODE(info->nbsl); | 2256 | u32 xec = EXT_ERROR_CODE(info->nbsl); |
| 2257 | int ecc_type = info->nbsh & (0x3 << 13); | 2257 | int ecc_type = (info->nbsh >> 13) & 0x3; |
| 2258 | 2258 | ||
| 2259 | /* Bail early out if this was an 'observed' error */ | 2259 | /* Bail early out if this was an 'observed' error */ |
| 2260 | if (PP(ec) == K8_NBSL_PP_OBS) | 2260 | if (PP(ec) == K8_NBSL_PP_OBS) |
| @@ -3163,7 +3163,7 @@ static int __init amd64_edac_init(void) | |||
| 3163 | opstate_init(); | 3163 | opstate_init(); |
| 3164 | 3164 | ||
| 3165 | if (cache_k8_northbridges() < 0) | 3165 | if (cache_k8_northbridges() < 0) |
| 3166 | goto err_exit; | 3166 | return err; |
| 3167 | 3167 | ||
| 3168 | err = pci_register_driver(&amd64_pci_driver); | 3168 | err = pci_register_driver(&amd64_pci_driver); |
| 3169 | if (err) | 3169 | if (err) |
| @@ -3189,8 +3189,6 @@ static int __init amd64_edac_init(void) | |||
| 3189 | 3189 | ||
| 3190 | err_2nd_stage: | 3190 | err_2nd_stage: |
| 3191 | debugf0("2nd stage failed\n"); | 3191 | debugf0("2nd stage failed\n"); |
| 3192 | |||
| 3193 | err_exit: | ||
| 3194 | pci_unregister_driver(&amd64_pci_driver); | 3192 | pci_unregister_driver(&amd64_pci_driver); |
| 3195 | 3193 | ||
| 3196 | return err; | 3194 | return err; |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 5d524254499e..94260aa76aa3 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
| @@ -275,7 +275,7 @@ static void log_irqs(u32 evt) | |||
| 275 | !(evt & OHCI1394_busReset)) | 275 | !(evt & OHCI1394_busReset)) |
| 276 | return; | 276 | return; |
| 277 | 277 | ||
| 278 | fw_notify("IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt, | 278 | fw_notify("IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt, |
| 279 | evt & OHCI1394_selfIDComplete ? " selfID" : "", | 279 | evt & OHCI1394_selfIDComplete ? " selfID" : "", |
| 280 | evt & OHCI1394_RQPkt ? " AR_req" : "", | 280 | evt & OHCI1394_RQPkt ? " AR_req" : "", |
| 281 | evt & OHCI1394_RSPkt ? " AR_resp" : "", | 281 | evt & OHCI1394_RSPkt ? " AR_resp" : "", |
| @@ -286,6 +286,7 @@ static void log_irqs(u32 evt) | |||
| 286 | evt & OHCI1394_postedWriteErr ? " postedWriteErr" : "", | 286 | evt & OHCI1394_postedWriteErr ? " postedWriteErr" : "", |
| 287 | evt & OHCI1394_cycleTooLong ? " cycleTooLong" : "", | 287 | evt & OHCI1394_cycleTooLong ? " cycleTooLong" : "", |
| 288 | evt & OHCI1394_cycle64Seconds ? " cycle64Seconds" : "", | 288 | evt & OHCI1394_cycle64Seconds ? " cycle64Seconds" : "", |
| 289 | evt & OHCI1394_cycleInconsistent ? " cycleInconsistent" : "", | ||
| 289 | evt & OHCI1394_regAccessFail ? " regAccessFail" : "", | 290 | evt & OHCI1394_regAccessFail ? " regAccessFail" : "", |
| 290 | evt & OHCI1394_busReset ? " busReset" : "", | 291 | evt & OHCI1394_busReset ? " busReset" : "", |
| 291 | evt & ~(OHCI1394_selfIDComplete | OHCI1394_RQPkt | | 292 | evt & ~(OHCI1394_selfIDComplete | OHCI1394_RQPkt | |
| @@ -293,6 +294,7 @@ static void log_irqs(u32 evt) | |||
| 293 | OHCI1394_respTxComplete | OHCI1394_isochRx | | 294 | OHCI1394_respTxComplete | OHCI1394_isochRx | |
| 294 | OHCI1394_isochTx | OHCI1394_postedWriteErr | | 295 | OHCI1394_isochTx | OHCI1394_postedWriteErr | |
| 295 | OHCI1394_cycleTooLong | OHCI1394_cycle64Seconds | | 296 | OHCI1394_cycleTooLong | OHCI1394_cycle64Seconds | |
| 297 | OHCI1394_cycleInconsistent | | ||
| 296 | OHCI1394_regAccessFail | OHCI1394_busReset) | 298 | OHCI1394_regAccessFail | OHCI1394_busReset) |
| 297 | ? " ?" : ""); | 299 | ? " ?" : ""); |
| 298 | } | 300 | } |
| @@ -1439,6 +1441,17 @@ static irqreturn_t irq_handler(int irq, void *data) | |||
| 1439 | OHCI1394_LinkControl_cycleMaster); | 1441 | OHCI1394_LinkControl_cycleMaster); |
| 1440 | } | 1442 | } |
| 1441 | 1443 | ||
| 1444 | if (unlikely(event & OHCI1394_cycleInconsistent)) { | ||
| 1445 | /* | ||
| 1446 | * We need to clear this event bit in order to make | ||
| 1447 | * cycleMatch isochronous I/O work. In theory we should | ||
| 1448 | * stop active cycleMatch iso contexts now and restart | ||
| 1449 | * them at least two cycles later. (FIXME?) | ||
| 1450 | */ | ||
| 1451 | if (printk_ratelimit()) | ||
| 1452 | fw_notify("isochronous cycle inconsistent\n"); | ||
| 1453 | } | ||
| 1454 | |||
| 1442 | if (event & OHCI1394_cycle64Seconds) { | 1455 | if (event & OHCI1394_cycle64Seconds) { |
| 1443 | cycle_time = reg_read(ohci, OHCI1394_IsochronousCycleTimer); | 1456 | cycle_time = reg_read(ohci, OHCI1394_IsochronousCycleTimer); |
| 1444 | if ((cycle_time & 0x80000000) == 0) | 1457 | if ((cycle_time & 0x80000000) == 0) |
| @@ -1528,6 +1541,7 @@ static int ohci_enable(struct fw_card *card, u32 *config_rom, size_t length) | |||
| 1528 | OHCI1394_reqTxComplete | OHCI1394_respTxComplete | | 1541 | OHCI1394_reqTxComplete | OHCI1394_respTxComplete | |
| 1529 | OHCI1394_isochRx | OHCI1394_isochTx | | 1542 | OHCI1394_isochRx | OHCI1394_isochTx | |
| 1530 | OHCI1394_postedWriteErr | OHCI1394_cycleTooLong | | 1543 | OHCI1394_postedWriteErr | OHCI1394_cycleTooLong | |
| 1544 | OHCI1394_cycleInconsistent | | ||
| 1531 | OHCI1394_cycle64Seconds | OHCI1394_regAccessFail | | 1545 | OHCI1394_cycle64Seconds | OHCI1394_regAccessFail | |
| 1532 | OHCI1394_masterIntEnable); | 1546 | OHCI1394_masterIntEnable); |
| 1533 | if (param_debug & OHCI_PARAM_DEBUG_BUSRESETS) | 1547 | if (param_debug & OHCI_PARAM_DEBUG_BUSRESETS) |
| @@ -1890,15 +1904,30 @@ static int handle_it_packet(struct context *context, | |||
| 1890 | { | 1904 | { |
| 1891 | struct iso_context *ctx = | 1905 | struct iso_context *ctx = |
| 1892 | container_of(context, struct iso_context, context); | 1906 | container_of(context, struct iso_context, context); |
| 1907 | int i; | ||
| 1908 | struct descriptor *pd; | ||
| 1893 | 1909 | ||
| 1894 | if (last->transfer_status == 0) | 1910 | for (pd = d; pd <= last; pd++) |
| 1895 | /* This descriptor isn't done yet, stop iteration. */ | 1911 | if (pd->transfer_status) |
| 1912 | break; | ||
| 1913 | if (pd > last) | ||
| 1914 | /* Descriptor(s) not done yet, stop iteration */ | ||
| 1896 | return 0; | 1915 | return 0; |
| 1897 | 1916 | ||
| 1898 | if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS) | 1917 | i = ctx->header_length; |
| 1918 | if (i + 4 < PAGE_SIZE) { | ||
| 1919 | /* Present this value as big-endian to match the receive code */ | ||
| 1920 | *(__be32 *)(ctx->header + i) = cpu_to_be32( | ||
| 1921 | ((u32)le16_to_cpu(pd->transfer_status) << 16) | | ||
| 1922 | le16_to_cpu(pd->res_count)); | ||
| 1923 | ctx->header_length += 4; | ||
| 1924 | } | ||
| 1925 | if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS) { | ||
| 1899 | ctx->base.callback(&ctx->base, le16_to_cpu(last->res_count), | 1926 | ctx->base.callback(&ctx->base, le16_to_cpu(last->res_count), |
| 1900 | 0, NULL, ctx->base.callback_data); | 1927 | ctx->header_length, ctx->header, |
| 1901 | 1928 | ctx->base.callback_data); | |
| 1929 | ctx->header_length = 0; | ||
| 1930 | } | ||
| 1902 | return 1; | 1931 | return 1; |
| 1903 | } | 1932 | } |
| 1904 | 1933 | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 662ed923d9eb..50de0f5750d8 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -661,7 +661,7 @@ int gpio_export(unsigned gpio, bool direction_may_change) | |||
| 661 | 661 | ||
| 662 | dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0), | 662 | dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0), |
| 663 | desc, ioname ? ioname : "gpio%d", gpio); | 663 | desc, ioname ? ioname : "gpio%d", gpio); |
| 664 | if (dev) { | 664 | if (!IS_ERR(dev)) { |
| 665 | if (direction_may_change) | 665 | if (direction_may_change) |
| 666 | status = sysfs_create_group(&dev->kobj, | 666 | status = sysfs_create_group(&dev->kobj, |
| 667 | &gpio_attr_group); | 667 | &gpio_attr_group); |
| @@ -679,7 +679,7 @@ int gpio_export(unsigned gpio, bool direction_may_change) | |||
| 679 | if (status != 0) | 679 | if (status != 0) |
| 680 | device_unregister(dev); | 680 | device_unregister(dev); |
| 681 | } else | 681 | } else |
| 682 | status = -ENODEV; | 682 | status = PTR_ERR(dev); |
| 683 | if (status == 0) | 683 | if (status == 0) |
| 684 | set_bit(FLAG_EXPORT, &desc->flags); | 684 | set_bit(FLAG_EXPORT, &desc->flags); |
| 685 | } | 685 | } |
| @@ -800,11 +800,11 @@ static int gpiochip_export(struct gpio_chip *chip) | |||
| 800 | mutex_lock(&sysfs_lock); | 800 | mutex_lock(&sysfs_lock); |
| 801 | dev = device_create(&gpio_class, chip->dev, MKDEV(0, 0), chip, | 801 | dev = device_create(&gpio_class, chip->dev, MKDEV(0, 0), chip, |
| 802 | "gpiochip%d", chip->base); | 802 | "gpiochip%d", chip->base); |
| 803 | if (dev) { | 803 | if (!IS_ERR(dev)) { |
| 804 | status = sysfs_create_group(&dev->kobj, | 804 | status = sysfs_create_group(&dev->kobj, |
| 805 | &gpiochip_attr_group); | 805 | &gpiochip_attr_group); |
| 806 | } else | 806 | } else |
| 807 | status = -ENODEV; | 807 | status = PTR_ERR(dev); |
| 808 | chip->exported = (status == 0); | 808 | chip->exported = (status == 0); |
| 809 | mutex_unlock(&sysfs_lock); | 809 | mutex_unlock(&sysfs_lock); |
| 810 | 810 | ||
diff --git a/drivers/gpio/langwell_gpio.c b/drivers/gpio/langwell_gpio.c index 5711ce5353c6..4baf3d7d0f8e 100644 --- a/drivers/gpio/langwell_gpio.c +++ b/drivers/gpio/langwell_gpio.c | |||
| @@ -144,13 +144,6 @@ static int lnw_irq_type(unsigned irq, unsigned type) | |||
| 144 | 144 | ||
| 145 | static void lnw_irq_unmask(unsigned irq) | 145 | static void lnw_irq_unmask(unsigned irq) |
| 146 | { | 146 | { |
| 147 | struct lnw_gpio *lnw = get_irq_chip_data(irq); | ||
| 148 | u32 gpio = irq - lnw->irq_base; | ||
| 149 | u8 reg = gpio / 32; | ||
| 150 | void __iomem *gedr; | ||
| 151 | |||
| 152 | gedr = (void __iomem *)(&lnw->reg_base->GEDR[reg]); | ||
| 153 | writel(BIT(gpio % 32), gedr); | ||
| 154 | }; | 147 | }; |
| 155 | 148 | ||
| 156 | static void lnw_irq_mask(unsigned irq) | 149 | static void lnw_irq_mask(unsigned irq) |
| @@ -183,13 +176,11 @@ static void lnw_irq_handler(unsigned irq, struct irq_desc *desc) | |||
| 183 | gedr_v = readl(gedr); | 176 | gedr_v = readl(gedr); |
| 184 | if (!gedr_v) | 177 | if (!gedr_v) |
| 185 | continue; | 178 | continue; |
| 186 | for (gpio = reg*32; gpio < reg*32+32; gpio++) { | 179 | for (gpio = reg*32; gpio < reg*32+32; gpio++) |
| 187 | gedr_v = readl(gedr); | ||
| 188 | if (gedr_v & BIT(gpio % 32)) { | 180 | if (gedr_v & BIT(gpio % 32)) { |
| 189 | pr_debug("pin %d triggered\n", gpio); | 181 | pr_debug("pin %d triggered\n", gpio); |
| 190 | generic_handle_irq(lnw->irq_base + gpio); | 182 | generic_handle_irq(lnw->irq_base + gpio); |
| 191 | } | 183 | } |
| 192 | } | ||
| 193 | /* clear the edge detect status bit */ | 184 | /* clear the edge detect status bit */ |
| 194 | writel(gedr_v, gedr); | 185 | writel(gedr_v, gedr); |
| 195 | } | 186 | } |
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index f831ea159291..96eddd17e050 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
| @@ -92,6 +92,7 @@ config DRM_I830 | |||
| 92 | config DRM_I915 | 92 | config DRM_I915 |
| 93 | tristate "i915 driver" | 93 | tristate "i915 driver" |
| 94 | depends on AGP_INTEL | 94 | depends on AGP_INTEL |
| 95 | select SHMEM | ||
| 95 | select DRM_KMS_HELPER | 96 | select DRM_KMS_HELPER |
| 96 | select FB_CFB_FILLRECT | 97 | select FB_CFB_FILLRECT |
| 97 | select FB_CFB_COPYAREA | 98 | select FB_CFB_COPYAREA |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 1fe4e1d344fd..bbfd110a7168 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
| @@ -331,6 +331,7 @@ create_mode: | |||
| 331 | cmdline_mode->refresh_specified ? cmdline_mode->refresh : 60, | 331 | cmdline_mode->refresh_specified ? cmdline_mode->refresh : 60, |
| 332 | cmdline_mode->rb, cmdline_mode->interlace, | 332 | cmdline_mode->rb, cmdline_mode->interlace, |
| 333 | cmdline_mode->margins); | 333 | cmdline_mode->margins); |
| 334 | drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); | ||
| 334 | list_add(&mode->head, &connector->modes); | 335 | list_add(&mode->head, &connector->modes); |
| 335 | return mode; | 336 | return mode; |
| 336 | } | 337 | } |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index cea665d86dd3..b54ba63d506e 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
| @@ -662,6 +662,12 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, | |||
| 662 | return NULL; | 662 | return NULL; |
| 663 | } | 663 | } |
| 664 | 664 | ||
| 665 | /* Some EDIDs have bogus h/vtotal values */ | ||
| 666 | if (mode->hsync_end > mode->htotal) | ||
| 667 | mode->htotal = mode->hsync_end + 1; | ||
| 668 | if (mode->vsync_end > mode->vtotal) | ||
| 669 | mode->vtotal = mode->vsync_end + 1; | ||
| 670 | |||
| 665 | drm_mode_set_name(mode); | 671 | drm_mode_set_name(mode); |
| 666 | 672 | ||
| 667 | if (pt->misc & DRM_EDID_PT_INTERLACED) | 673 | if (pt->misc & DRM_EDID_PT_INTERLACED) |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 9c924614c418..65ef011fa8ba 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
| @@ -599,7 +599,7 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, | |||
| 599 | struct drm_framebuffer *fb = fb_helper->fb; | 599 | struct drm_framebuffer *fb = fb_helper->fb; |
| 600 | int depth; | 600 | int depth; |
| 601 | 601 | ||
| 602 | if (var->pixclock == -1 || !var->pixclock) | 602 | if (var->pixclock != 0) |
| 603 | return -EINVAL; | 603 | return -EINVAL; |
| 604 | 604 | ||
| 605 | /* Need to resize the fb object !!! */ | 605 | /* Need to resize the fb object !!! */ |
| @@ -691,7 +691,7 @@ int drm_fb_helper_set_par(struct fb_info *info) | |||
| 691 | int ret; | 691 | int ret; |
| 692 | int i; | 692 | int i; |
| 693 | 693 | ||
| 694 | if (var->pixclock != -1) { | 694 | if (var->pixclock != 0) { |
| 695 | DRM_ERROR("PIXEL CLCOK SET\n"); | 695 | DRM_ERROR("PIXEL CLCOK SET\n"); |
| 696 | return -EINVAL; | 696 | return -EINVAL; |
| 697 | } | 697 | } |
| @@ -707,7 +707,7 @@ int drm_fb_helper_set_par(struct fb_info *info) | |||
| 707 | 707 | ||
| 708 | if (crtc->fb == fb_helper->crtc_info[i].mode_set.fb) { | 708 | if (crtc->fb == fb_helper->crtc_info[i].mode_set.fb) { |
| 709 | mutex_lock(&dev->mode_config.mutex); | 709 | mutex_lock(&dev->mode_config.mutex); |
| 710 | ret = crtc->funcs->set_config(&fb_helper->crtc_info->mode_set); | 710 | ret = crtc->funcs->set_config(&fb_helper->crtc_info[i].mode_set); |
| 711 | mutex_unlock(&dev->mode_config.mutex); | 711 | mutex_unlock(&dev->mode_config.mutex); |
| 712 | if (ret) | 712 | if (ret) |
| 713 | return ret; | 713 | return ret; |
| @@ -904,7 +904,7 @@ int drm_fb_helper_single_fb_probe(struct drm_device *dev, | |||
| 904 | fb_helper->fb = fb; | 904 | fb_helper->fb = fb; |
| 905 | 905 | ||
| 906 | if (new_fb) { | 906 | if (new_fb) { |
| 907 | info->var.pixclock = -1; | 907 | info->var.pixclock = 0; |
| 908 | if (register_framebuffer(info) < 0) | 908 | if (register_framebuffer(info) < 0) |
| 909 | return -EINVAL; | 909 | return -EINVAL; |
| 910 | } else { | 910 | } else { |
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 80391995bdec..e9dbb481c469 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
| @@ -552,7 +552,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) | |||
| 552 | vma->vm_flags |= VM_RESERVED | VM_IO | VM_PFNMAP | VM_DONTEXPAND; | 552 | vma->vm_flags |= VM_RESERVED | VM_IO | VM_PFNMAP | VM_DONTEXPAND; |
| 553 | vma->vm_ops = obj->dev->driver->gem_vm_ops; | 553 | vma->vm_ops = obj->dev->driver->gem_vm_ops; |
| 554 | vma->vm_private_data = map->handle; | 554 | vma->vm_private_data = map->handle; |
| 555 | vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); | 555 | vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); |
| 556 | 556 | ||
| 557 | /* Take a ref for this mapping of the object, so that the fault | 557 | /* Take a ref for this mapping of the object, so that the fault |
| 558 | * handler can dereference the mmap offset's pointer to the object. | 558 | * handler can dereference the mmap offset's pointer to the object. |
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index c861d80fd779..97dc5a4f0de4 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c | |||
| @@ -103,6 +103,11 @@ static struct drm_mm_node *drm_mm_kmalloc(struct drm_mm *mm, int atomic) | |||
| 103 | return child; | 103 | return child; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | /* drm_mm_pre_get() - pre allocate drm_mm_node structure | ||
| 107 | * drm_mm: memory manager struct we are pre-allocating for | ||
| 108 | * | ||
| 109 | * Returns 0 on success or -ENOMEM if allocation fails. | ||
| 110 | */ | ||
| 106 | int drm_mm_pre_get(struct drm_mm *mm) | 111 | int drm_mm_pre_get(struct drm_mm *mm) |
| 107 | { | 112 | { |
| 108 | struct drm_mm_node *node; | 113 | struct drm_mm_node *node; |
| @@ -253,12 +258,14 @@ void drm_mm_put_block(struct drm_mm_node *cur) | |||
| 253 | prev_node->size += next_node->size; | 258 | prev_node->size += next_node->size; |
| 254 | list_del(&next_node->ml_entry); | 259 | list_del(&next_node->ml_entry); |
| 255 | list_del(&next_node->fl_entry); | 260 | list_del(&next_node->fl_entry); |
| 261 | spin_lock(&mm->unused_lock); | ||
| 256 | if (mm->num_unused < MM_UNUSED_TARGET) { | 262 | if (mm->num_unused < MM_UNUSED_TARGET) { |
| 257 | list_add(&next_node->fl_entry, | 263 | list_add(&next_node->fl_entry, |
| 258 | &mm->unused_nodes); | 264 | &mm->unused_nodes); |
| 259 | ++mm->num_unused; | 265 | ++mm->num_unused; |
| 260 | } else | 266 | } else |
| 261 | kfree(next_node); | 267 | kfree(next_node); |
| 268 | spin_unlock(&mm->unused_lock); | ||
| 262 | } else { | 269 | } else { |
| 263 | next_node->size += cur->size; | 270 | next_node->size += cur->size; |
| 264 | next_node->start = cur->start; | 271 | next_node->start = cur->start; |
| @@ -271,11 +278,13 @@ void drm_mm_put_block(struct drm_mm_node *cur) | |||
| 271 | list_add(&cur->fl_entry, &mm->fl_entry); | 278 | list_add(&cur->fl_entry, &mm->fl_entry); |
| 272 | } else { | 279 | } else { |
| 273 | list_del(&cur->ml_entry); | 280 | list_del(&cur->ml_entry); |
| 281 | spin_lock(&mm->unused_lock); | ||
| 274 | if (mm->num_unused < MM_UNUSED_TARGET) { | 282 | if (mm->num_unused < MM_UNUSED_TARGET) { |
| 275 | list_add(&cur->fl_entry, &mm->unused_nodes); | 283 | list_add(&cur->fl_entry, &mm->unused_nodes); |
| 276 | ++mm->num_unused; | 284 | ++mm->num_unused; |
| 277 | } else | 285 | } else |
| 278 | kfree(cur); | 286 | kfree(cur); |
| 287 | spin_unlock(&mm->unused_lock); | ||
| 279 | } | 288 | } |
| 280 | } | 289 | } |
| 281 | 290 | ||
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index f8ce9a3a420d..26bf0552b3cb 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
| @@ -267,10 +267,10 @@ static void i915_dump_pages(struct seq_file *m, struct page **pages, int page_co | |||
| 267 | uint32_t *mem; | 267 | uint32_t *mem; |
| 268 | 268 | ||
| 269 | for (page = 0; page < page_count; page++) { | 269 | for (page = 0; page < page_count; page++) { |
| 270 | mem = kmap(pages[page]); | 270 | mem = kmap_atomic(pages[page], KM_USER0); |
| 271 | for (i = 0; i < PAGE_SIZE; i += 4) | 271 | for (i = 0; i < PAGE_SIZE; i += 4) |
| 272 | seq_printf(m, "%08x : %08x\n", i, mem[i / 4]); | 272 | seq_printf(m, "%08x : %08x\n", i, mem[i / 4]); |
| 273 | kunmap(pages[page]); | 273 | kunmap_atomic(pages[page], KM_USER0); |
| 274 | } | 274 | } |
| 275 | } | 275 | } |
| 276 | 276 | ||
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 92aeb918e0c0..e5b138be45fa 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
| @@ -1227,8 +1227,7 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
| 1227 | goto out; | 1227 | goto out; |
| 1228 | 1228 | ||
| 1229 | /* Try to set up FBC with a reasonable compressed buffer size */ | 1229 | /* Try to set up FBC with a reasonable compressed buffer size */ |
| 1230 | if (IS_MOBILE(dev) && (IS_I9XX(dev) || IS_I965G(dev) || IS_GM45(dev)) && | 1230 | if (I915_HAS_FBC(dev) && i915_powersave) { |
| 1231 | i915_powersave) { | ||
| 1232 | int cfb_size; | 1231 | int cfb_size; |
| 1233 | 1232 | ||
| 1234 | /* Try to get an 8M buffer... */ | 1233 | /* Try to get an 8M buffer... */ |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index c5df2234418d..a725f6591192 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
| @@ -296,6 +296,13 @@ typedef struct drm_i915_private { | |||
| 296 | u32 saveVBLANK_A; | 296 | u32 saveVBLANK_A; |
| 297 | u32 saveVSYNC_A; | 297 | u32 saveVSYNC_A; |
| 298 | u32 saveBCLRPAT_A; | 298 | u32 saveBCLRPAT_A; |
| 299 | u32 saveTRANSACONF; | ||
| 300 | u32 saveTRANS_HTOTAL_A; | ||
| 301 | u32 saveTRANS_HBLANK_A; | ||
| 302 | u32 saveTRANS_HSYNC_A; | ||
| 303 | u32 saveTRANS_VTOTAL_A; | ||
| 304 | u32 saveTRANS_VBLANK_A; | ||
| 305 | u32 saveTRANS_VSYNC_A; | ||
| 299 | u32 savePIPEASTAT; | 306 | u32 savePIPEASTAT; |
| 300 | u32 saveDSPASTRIDE; | 307 | u32 saveDSPASTRIDE; |
| 301 | u32 saveDSPASIZE; | 308 | u32 saveDSPASIZE; |
| @@ -304,8 +311,11 @@ typedef struct drm_i915_private { | |||
| 304 | u32 saveDSPASURF; | 311 | u32 saveDSPASURF; |
| 305 | u32 saveDSPATILEOFF; | 312 | u32 saveDSPATILEOFF; |
| 306 | u32 savePFIT_PGM_RATIOS; | 313 | u32 savePFIT_PGM_RATIOS; |
| 314 | u32 saveBLC_HIST_CTL; | ||
| 307 | u32 saveBLC_PWM_CTL; | 315 | u32 saveBLC_PWM_CTL; |
| 308 | u32 saveBLC_PWM_CTL2; | 316 | u32 saveBLC_PWM_CTL2; |
| 317 | u32 saveBLC_CPU_PWM_CTL; | ||
| 318 | u32 saveBLC_CPU_PWM_CTL2; | ||
| 309 | u32 saveFPB0; | 319 | u32 saveFPB0; |
| 310 | u32 saveFPB1; | 320 | u32 saveFPB1; |
| 311 | u32 saveDPLL_B; | 321 | u32 saveDPLL_B; |
| @@ -317,6 +327,13 @@ typedef struct drm_i915_private { | |||
| 317 | u32 saveVBLANK_B; | 327 | u32 saveVBLANK_B; |
| 318 | u32 saveVSYNC_B; | 328 | u32 saveVSYNC_B; |
| 319 | u32 saveBCLRPAT_B; | 329 | u32 saveBCLRPAT_B; |
| 330 | u32 saveTRANSBCONF; | ||
| 331 | u32 saveTRANS_HTOTAL_B; | ||
| 332 | u32 saveTRANS_HBLANK_B; | ||
| 333 | u32 saveTRANS_HSYNC_B; | ||
| 334 | u32 saveTRANS_VTOTAL_B; | ||
| 335 | u32 saveTRANS_VBLANK_B; | ||
| 336 | u32 saveTRANS_VSYNC_B; | ||
| 320 | u32 savePIPEBSTAT; | 337 | u32 savePIPEBSTAT; |
| 321 | u32 saveDSPBSTRIDE; | 338 | u32 saveDSPBSTRIDE; |
| 322 | u32 saveDSPBSIZE; | 339 | u32 saveDSPBSIZE; |
| @@ -342,6 +359,7 @@ typedef struct drm_i915_private { | |||
| 342 | u32 savePFIT_CONTROL; | 359 | u32 savePFIT_CONTROL; |
| 343 | u32 save_palette_a[256]; | 360 | u32 save_palette_a[256]; |
| 344 | u32 save_palette_b[256]; | 361 | u32 save_palette_b[256]; |
| 362 | u32 saveDPFC_CB_BASE; | ||
| 345 | u32 saveFBC_CFB_BASE; | 363 | u32 saveFBC_CFB_BASE; |
| 346 | u32 saveFBC_LL_BASE; | 364 | u32 saveFBC_LL_BASE; |
| 347 | u32 saveFBC_CONTROL; | 365 | u32 saveFBC_CONTROL; |
| @@ -349,6 +367,12 @@ typedef struct drm_i915_private { | |||
| 349 | u32 saveIER; | 367 | u32 saveIER; |
| 350 | u32 saveIIR; | 368 | u32 saveIIR; |
| 351 | u32 saveIMR; | 369 | u32 saveIMR; |
| 370 | u32 saveDEIER; | ||
| 371 | u32 saveDEIMR; | ||
| 372 | u32 saveGTIER; | ||
| 373 | u32 saveGTIMR; | ||
| 374 | u32 saveFDI_RXA_IMR; | ||
| 375 | u32 saveFDI_RXB_IMR; | ||
| 352 | u32 saveCACHE_MODE_0; | 376 | u32 saveCACHE_MODE_0; |
| 353 | u32 saveD_STATE; | 377 | u32 saveD_STATE; |
| 354 | u32 saveDSPCLK_GATE_D; | 378 | u32 saveDSPCLK_GATE_D; |
| @@ -382,6 +406,26 @@ typedef struct drm_i915_private { | |||
| 382 | u32 savePIPEB_DP_LINK_M; | 406 | u32 savePIPEB_DP_LINK_M; |
| 383 | u32 savePIPEA_DP_LINK_N; | 407 | u32 savePIPEA_DP_LINK_N; |
| 384 | u32 savePIPEB_DP_LINK_N; | 408 | u32 savePIPEB_DP_LINK_N; |
| 409 | u32 saveFDI_RXA_CTL; | ||
| 410 | u32 saveFDI_TXA_CTL; | ||
| 411 | u32 saveFDI_RXB_CTL; | ||
| 412 | u32 saveFDI_TXB_CTL; | ||
| 413 | u32 savePFA_CTL_1; | ||
| 414 | u32 savePFB_CTL_1; | ||
| 415 | u32 savePFA_WIN_SZ; | ||
| 416 | u32 savePFB_WIN_SZ; | ||
| 417 | u32 savePFA_WIN_POS; | ||
| 418 | u32 savePFB_WIN_POS; | ||
| 419 | u32 savePCH_DREF_CONTROL; | ||
| 420 | u32 saveDISP_ARB_CTL; | ||
| 421 | u32 savePIPEA_DATA_M1; | ||
| 422 | u32 savePIPEA_DATA_N1; | ||
| 423 | u32 savePIPEA_LINK_M1; | ||
| 424 | u32 savePIPEA_LINK_N1; | ||
| 425 | u32 savePIPEB_DATA_M1; | ||
| 426 | u32 savePIPEB_DATA_N1; | ||
| 427 | u32 savePIPEB_LINK_M1; | ||
| 428 | u32 savePIPEB_LINK_N1; | ||
| 385 | 429 | ||
| 386 | struct { | 430 | struct { |
| 387 | struct drm_mm gtt_space; | 431 | struct drm_mm gtt_space; |
| @@ -492,6 +536,8 @@ typedef struct drm_i915_private { | |||
| 492 | struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT]; | 536 | struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT]; |
| 493 | } mm; | 537 | } mm; |
| 494 | struct sdvo_device_mapping sdvo_mappings[2]; | 538 | struct sdvo_device_mapping sdvo_mappings[2]; |
| 539 | /* indicate whether the LVDS_BORDER should be enabled or not */ | ||
| 540 | unsigned int lvds_border_bits; | ||
| 495 | 541 | ||
| 496 | /* Reclocking support */ | 542 | /* Reclocking support */ |
| 497 | bool render_reclock_avail; | 543 | bool render_reclock_avail; |
| @@ -981,7 +1027,10 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
| 981 | 1027 | ||
| 982 | #define HAS_FW_BLC(dev) (IS_I9XX(dev) || IS_G4X(dev) || IS_IGDNG(dev)) | 1028 | #define HAS_FW_BLC(dev) (IS_I9XX(dev) || IS_G4X(dev) || IS_IGDNG(dev)) |
| 983 | #define HAS_PIPE_CXSR(dev) (IS_G4X(dev) || IS_IGDNG(dev)) | 1029 | #define HAS_PIPE_CXSR(dev) (IS_G4X(dev) || IS_IGDNG(dev)) |
| 984 | #define I915_HAS_FBC(dev) (IS_MOBILE(dev) && (IS_I9XX(dev) || IS_I965G(dev))) | 1030 | #define I915_HAS_FBC(dev) (IS_MOBILE(dev) && \ |
| 1031 | (IS_I9XX(dev) || IS_GM45(dev)) && \ | ||
| 1032 | !IS_IGD(dev) && \ | ||
| 1033 | !IS_IGDNG(dev)) | ||
| 985 | 1034 | ||
| 986 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) | 1035 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) |
| 987 | 1036 | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index c3ceffa46ea0..aa7fd82aa6eb 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
| @@ -254,10 +254,15 @@ irqreturn_t igdng_irq_handler(struct drm_device *dev) | |||
| 254 | { | 254 | { |
| 255 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 255 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
| 256 | int ret = IRQ_NONE; | 256 | int ret = IRQ_NONE; |
| 257 | u32 de_iir, gt_iir; | 257 | u32 de_iir, gt_iir, de_ier; |
| 258 | u32 new_de_iir, new_gt_iir; | 258 | u32 new_de_iir, new_gt_iir; |
| 259 | struct drm_i915_master_private *master_priv; | 259 | struct drm_i915_master_private *master_priv; |
| 260 | 260 | ||
| 261 | /* disable master interrupt before clearing iir */ | ||
| 262 | de_ier = I915_READ(DEIER); | ||
| 263 | I915_WRITE(DEIER, de_ier & ~DE_MASTER_IRQ_CONTROL); | ||
| 264 | (void)I915_READ(DEIER); | ||
| 265 | |||
| 261 | de_iir = I915_READ(DEIIR); | 266 | de_iir = I915_READ(DEIIR); |
| 262 | gt_iir = I915_READ(GTIIR); | 267 | gt_iir = I915_READ(GTIIR); |
| 263 | 268 | ||
| @@ -290,6 +295,9 @@ irqreturn_t igdng_irq_handler(struct drm_device *dev) | |||
| 290 | gt_iir = new_gt_iir; | 295 | gt_iir = new_gt_iir; |
| 291 | } | 296 | } |
| 292 | 297 | ||
| 298 | I915_WRITE(DEIER, de_ier); | ||
| 299 | (void)I915_READ(DEIER); | ||
| 300 | |||
| 293 | return ret; | 301 | return ret; |
| 294 | } | 302 | } |
| 295 | 303 | ||
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 0466ddbeba32..1687edf68795 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
| @@ -968,6 +968,8 @@ | |||
| 968 | #define LVDS_PORT_EN (1 << 31) | 968 | #define LVDS_PORT_EN (1 << 31) |
| 969 | /* Selects pipe B for LVDS data. Must be set on pre-965. */ | 969 | /* Selects pipe B for LVDS data. Must be set on pre-965. */ |
| 970 | #define LVDS_PIPEB_SELECT (1 << 30) | 970 | #define LVDS_PIPEB_SELECT (1 << 30) |
| 971 | /* Enable border for unscaled (or aspect-scaled) display */ | ||
| 972 | #define LVDS_BORDER_ENABLE (1 << 15) | ||
| 971 | /* | 973 | /* |
| 972 | * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per | 974 | * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per |
| 973 | * pixel. | 975 | * pixel. |
| @@ -1078,6 +1080,8 @@ | |||
| 1078 | #define BACKLIGHT_DUTY_CYCLE_SHIFT (0) | 1080 | #define BACKLIGHT_DUTY_CYCLE_SHIFT (0) |
| 1079 | #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff) | 1081 | #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff) |
| 1080 | 1082 | ||
| 1083 | #define BLC_HIST_CTL 0x61260 | ||
| 1084 | |||
| 1081 | /* TV port control */ | 1085 | /* TV port control */ |
| 1082 | #define TV_CTL 0x68000 | 1086 | #define TV_CTL 0x68000 |
| 1083 | /** Enables the TV encoder */ | 1087 | /** Enables the TV encoder */ |
| @@ -1780,6 +1784,11 @@ | |||
| 1780 | #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */ | 1784 | #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */ |
| 1781 | #define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1) | 1785 | #define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1) |
| 1782 | #define PIPE_OVERLAY_UPDATED_STATUS (1UL<<0) | 1786 | #define PIPE_OVERLAY_UPDATED_STATUS (1UL<<0) |
| 1787 | #define PIPE_BPC_MASK (7 << 5) /* Ironlake */ | ||
| 1788 | #define PIPE_8BPC (0 << 5) | ||
| 1789 | #define PIPE_10BPC (1 << 5) | ||
| 1790 | #define PIPE_6BPC (2 << 5) | ||
| 1791 | #define PIPE_12BPC (3 << 5) | ||
| 1783 | 1792 | ||
| 1784 | #define DSPARB 0x70030 | 1793 | #define DSPARB 0x70030 |
| 1785 | #define DSPARB_CSTART_MASK (0x7f << 7) | 1794 | #define DSPARB_CSTART_MASK (0x7f << 7) |
| @@ -1790,17 +1799,29 @@ | |||
| 1790 | #define DSPARB_AEND_SHIFT 0 | 1799 | #define DSPARB_AEND_SHIFT 0 |
| 1791 | 1800 | ||
| 1792 | #define DSPFW1 0x70034 | 1801 | #define DSPFW1 0x70034 |
| 1802 | #define DSPFW_SR_SHIFT 23 | ||
| 1803 | #define DSPFW_CURSORB_SHIFT 16 | ||
| 1804 | #define DSPFW_PLANEB_SHIFT 8 | ||
| 1793 | #define DSPFW2 0x70038 | 1805 | #define DSPFW2 0x70038 |
| 1806 | #define DSPFW_CURSORA_MASK 0x00003f00 | ||
| 1807 | #define DSPFW_CURSORA_SHIFT 16 | ||
| 1794 | #define DSPFW3 0x7003c | 1808 | #define DSPFW3 0x7003c |
| 1809 | #define DSPFW_HPLL_SR_EN (1<<31) | ||
| 1810 | #define DSPFW_CURSOR_SR_SHIFT 24 | ||
| 1795 | #define IGD_SELF_REFRESH_EN (1<<30) | 1811 | #define IGD_SELF_REFRESH_EN (1<<30) |
| 1796 | 1812 | ||
| 1797 | /* FIFO watermark sizes etc */ | 1813 | /* FIFO watermark sizes etc */ |
| 1814 | #define G4X_FIFO_LINE_SIZE 64 | ||
| 1798 | #define I915_FIFO_LINE_SIZE 64 | 1815 | #define I915_FIFO_LINE_SIZE 64 |
| 1799 | #define I830_FIFO_LINE_SIZE 32 | 1816 | #define I830_FIFO_LINE_SIZE 32 |
| 1817 | |||
| 1818 | #define G4X_FIFO_SIZE 127 | ||
| 1800 | #define I945_FIFO_SIZE 127 /* 945 & 965 */ | 1819 | #define I945_FIFO_SIZE 127 /* 945 & 965 */ |
| 1801 | #define I915_FIFO_SIZE 95 | 1820 | #define I915_FIFO_SIZE 95 |
| 1802 | #define I855GM_FIFO_SIZE 127 /* In cachelines */ | 1821 | #define I855GM_FIFO_SIZE 127 /* In cachelines */ |
| 1803 | #define I830_FIFO_SIZE 95 | 1822 | #define I830_FIFO_SIZE 95 |
| 1823 | |||
| 1824 | #define G4X_MAX_WM 0x3f | ||
| 1804 | #define I915_MAX_WM 0x3f | 1825 | #define I915_MAX_WM 0x3f |
| 1805 | 1826 | ||
| 1806 | #define IGD_DISPLAY_FIFO 512 /* in 64byte unit */ | 1827 | #define IGD_DISPLAY_FIFO 512 /* in 64byte unit */ |
| @@ -2030,6 +2051,11 @@ | |||
| 2030 | #define PFA_CTL_1 0x68080 | 2051 | #define PFA_CTL_1 0x68080 |
| 2031 | #define PFB_CTL_1 0x68880 | 2052 | #define PFB_CTL_1 0x68880 |
| 2032 | #define PF_ENABLE (1<<31) | 2053 | #define PF_ENABLE (1<<31) |
| 2054 | #define PF_FILTER_MASK (3<<23) | ||
| 2055 | #define PF_FILTER_PROGRAMMED (0<<23) | ||
| 2056 | #define PF_FILTER_MED_3x3 (1<<23) | ||
| 2057 | #define PF_FILTER_EDGE_ENHANCE (2<<23) | ||
| 2058 | #define PF_FILTER_EDGE_SOFTEN (3<<23) | ||
| 2033 | #define PFA_WIN_SZ 0x68074 | 2059 | #define PFA_WIN_SZ 0x68074 |
| 2034 | #define PFB_WIN_SZ 0x68874 | 2060 | #define PFB_WIN_SZ 0x68874 |
| 2035 | #define PFA_WIN_POS 0x68070 | 2061 | #define PFA_WIN_POS 0x68070 |
| @@ -2149,11 +2175,11 @@ | |||
| 2149 | #define DREF_CPU_SOURCE_OUTPUT_MASK (3<<13) | 2175 | #define DREF_CPU_SOURCE_OUTPUT_MASK (3<<13) |
| 2150 | #define DREF_SSC_SOURCE_DISABLE (0<<11) | 2176 | #define DREF_SSC_SOURCE_DISABLE (0<<11) |
| 2151 | #define DREF_SSC_SOURCE_ENABLE (2<<11) | 2177 | #define DREF_SSC_SOURCE_ENABLE (2<<11) |
| 2152 | #define DREF_SSC_SOURCE_MASK (2<<11) | 2178 | #define DREF_SSC_SOURCE_MASK (3<<11) |
| 2153 | #define DREF_NONSPREAD_SOURCE_DISABLE (0<<9) | 2179 | #define DREF_NONSPREAD_SOURCE_DISABLE (0<<9) |
| 2154 | #define DREF_NONSPREAD_CK505_ENABLE (1<<9) | 2180 | #define DREF_NONSPREAD_CK505_ENABLE (1<<9) |
| 2155 | #define DREF_NONSPREAD_SOURCE_ENABLE (2<<9) | 2181 | #define DREF_NONSPREAD_SOURCE_ENABLE (2<<9) |
| 2156 | #define DREF_NONSPREAD_SOURCE_MASK (2<<9) | 2182 | #define DREF_NONSPREAD_SOURCE_MASK (3<<9) |
| 2157 | #define DREF_SUPERSPREAD_SOURCE_DISABLE (0<<7) | 2183 | #define DREF_SUPERSPREAD_SOURCE_DISABLE (0<<7) |
| 2158 | #define DREF_SUPERSPREAD_SOURCE_ENABLE (2<<7) | 2184 | #define DREF_SUPERSPREAD_SOURCE_ENABLE (2<<7) |
| 2159 | #define DREF_SSC4_DOWNSPREAD (0<<6) | 2185 | #define DREF_SSC4_DOWNSPREAD (0<<6) |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index bd6d8d91ca9f..6eec8171a44e 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
| @@ -32,11 +32,15 @@ | |||
| 32 | static bool i915_pipe_enabled(struct drm_device *dev, enum pipe pipe) | 32 | static bool i915_pipe_enabled(struct drm_device *dev, enum pipe pipe) |
| 33 | { | 33 | { |
| 34 | struct drm_i915_private *dev_priv = dev->dev_private; | 34 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 35 | u32 dpll_reg; | ||
| 35 | 36 | ||
| 36 | if (pipe == PIPE_A) | 37 | if (IS_IGDNG(dev)) { |
| 37 | return (I915_READ(DPLL_A) & DPLL_VCO_ENABLE); | 38 | dpll_reg = (pipe == PIPE_A) ? PCH_DPLL_A: PCH_DPLL_B; |
| 38 | else | 39 | } else { |
| 39 | return (I915_READ(DPLL_B) & DPLL_VCO_ENABLE); | 40 | dpll_reg = (pipe == PIPE_A) ? DPLL_A: DPLL_B; |
| 41 | } | ||
| 42 | |||
| 43 | return (I915_READ(dpll_reg) & DPLL_VCO_ENABLE); | ||
| 40 | } | 44 | } |
| 41 | 45 | ||
| 42 | static void i915_save_palette(struct drm_device *dev, enum pipe pipe) | 46 | static void i915_save_palette(struct drm_device *dev, enum pipe pipe) |
| @@ -49,6 +53,9 @@ static void i915_save_palette(struct drm_device *dev, enum pipe pipe) | |||
| 49 | if (!i915_pipe_enabled(dev, pipe)) | 53 | if (!i915_pipe_enabled(dev, pipe)) |
| 50 | return; | 54 | return; |
| 51 | 55 | ||
| 56 | if (IS_IGDNG(dev)) | ||
| 57 | reg = (pipe == PIPE_A) ? LGC_PALETTE_A : LGC_PALETTE_B; | ||
| 58 | |||
| 52 | if (pipe == PIPE_A) | 59 | if (pipe == PIPE_A) |
| 53 | array = dev_priv->save_palette_a; | 60 | array = dev_priv->save_palette_a; |
| 54 | else | 61 | else |
| @@ -68,6 +75,9 @@ static void i915_restore_palette(struct drm_device *dev, enum pipe pipe) | |||
| 68 | if (!i915_pipe_enabled(dev, pipe)) | 75 | if (!i915_pipe_enabled(dev, pipe)) |
| 69 | return; | 76 | return; |
| 70 | 77 | ||
| 78 | if (IS_IGDNG(dev)) | ||
| 79 | reg = (pipe == PIPE_A) ? LGC_PALETTE_A : LGC_PALETTE_B; | ||
| 80 | |||
| 71 | if (pipe == PIPE_A) | 81 | if (pipe == PIPE_A) |
| 72 | array = dev_priv->save_palette_a; | 82 | array = dev_priv->save_palette_a; |
| 73 | else | 83 | else |
| @@ -229,13 +239,24 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
| 229 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 239 | if (drm_core_check_feature(dev, DRIVER_MODESET)) |
| 230 | return; | 240 | return; |
| 231 | 241 | ||
| 242 | if (IS_IGDNG(dev)) { | ||
| 243 | dev_priv->savePCH_DREF_CONTROL = I915_READ(PCH_DREF_CONTROL); | ||
| 244 | dev_priv->saveDISP_ARB_CTL = I915_READ(DISP_ARB_CTL); | ||
| 245 | } | ||
| 246 | |||
| 232 | /* Pipe & plane A info */ | 247 | /* Pipe & plane A info */ |
| 233 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); | 248 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); |
| 234 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); | 249 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); |
| 235 | dev_priv->saveFPA0 = I915_READ(FPA0); | 250 | if (IS_IGDNG(dev)) { |
| 236 | dev_priv->saveFPA1 = I915_READ(FPA1); | 251 | dev_priv->saveFPA0 = I915_READ(PCH_FPA0); |
| 237 | dev_priv->saveDPLL_A = I915_READ(DPLL_A); | 252 | dev_priv->saveFPA1 = I915_READ(PCH_FPA1); |
| 238 | if (IS_I965G(dev)) | 253 | dev_priv->saveDPLL_A = I915_READ(PCH_DPLL_A); |
| 254 | } else { | ||
| 255 | dev_priv->saveFPA0 = I915_READ(FPA0); | ||
| 256 | dev_priv->saveFPA1 = I915_READ(FPA1); | ||
| 257 | dev_priv->saveDPLL_A = I915_READ(DPLL_A); | ||
| 258 | } | ||
| 259 | if (IS_I965G(dev) && !IS_IGDNG(dev)) | ||
| 239 | dev_priv->saveDPLL_A_MD = I915_READ(DPLL_A_MD); | 260 | dev_priv->saveDPLL_A_MD = I915_READ(DPLL_A_MD); |
| 240 | dev_priv->saveHTOTAL_A = I915_READ(HTOTAL_A); | 261 | dev_priv->saveHTOTAL_A = I915_READ(HTOTAL_A); |
| 241 | dev_priv->saveHBLANK_A = I915_READ(HBLANK_A); | 262 | dev_priv->saveHBLANK_A = I915_READ(HBLANK_A); |
| @@ -243,7 +264,30 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
| 243 | dev_priv->saveVTOTAL_A = I915_READ(VTOTAL_A); | 264 | dev_priv->saveVTOTAL_A = I915_READ(VTOTAL_A); |
| 244 | dev_priv->saveVBLANK_A = I915_READ(VBLANK_A); | 265 | dev_priv->saveVBLANK_A = I915_READ(VBLANK_A); |
| 245 | dev_priv->saveVSYNC_A = I915_READ(VSYNC_A); | 266 | dev_priv->saveVSYNC_A = I915_READ(VSYNC_A); |
| 246 | dev_priv->saveBCLRPAT_A = I915_READ(BCLRPAT_A); | 267 | if (!IS_IGDNG(dev)) |
| 268 | dev_priv->saveBCLRPAT_A = I915_READ(BCLRPAT_A); | ||
| 269 | |||
| 270 | if (IS_IGDNG(dev)) { | ||
| 271 | dev_priv->savePIPEA_DATA_M1 = I915_READ(PIPEA_DATA_M1); | ||
| 272 | dev_priv->savePIPEA_DATA_N1 = I915_READ(PIPEA_DATA_N1); | ||
| 273 | dev_priv->savePIPEA_LINK_M1 = I915_READ(PIPEA_LINK_M1); | ||
| 274 | dev_priv->savePIPEA_LINK_N1 = I915_READ(PIPEA_LINK_N1); | ||
| 275 | |||
| 276 | dev_priv->saveFDI_TXA_CTL = I915_READ(FDI_TXA_CTL); | ||
| 277 | dev_priv->saveFDI_RXA_CTL = I915_READ(FDI_RXA_CTL); | ||
| 278 | |||
| 279 | dev_priv->savePFA_CTL_1 = I915_READ(PFA_CTL_1); | ||
| 280 | dev_priv->savePFA_WIN_SZ = I915_READ(PFA_WIN_SZ); | ||
| 281 | dev_priv->savePFA_WIN_POS = I915_READ(PFA_WIN_POS); | ||
| 282 | |||
| 283 | dev_priv->saveTRANSACONF = I915_READ(TRANSACONF); | ||
| 284 | dev_priv->saveTRANS_HTOTAL_A = I915_READ(TRANS_HTOTAL_A); | ||
| 285 | dev_priv->saveTRANS_HBLANK_A = I915_READ(TRANS_HBLANK_A); | ||
| 286 | dev_priv->saveTRANS_HSYNC_A = I915_READ(TRANS_HSYNC_A); | ||
| 287 | dev_priv->saveTRANS_VTOTAL_A = I915_READ(TRANS_VTOTAL_A); | ||
| 288 | dev_priv->saveTRANS_VBLANK_A = I915_READ(TRANS_VBLANK_A); | ||
| 289 | dev_priv->saveTRANS_VSYNC_A = I915_READ(TRANS_VSYNC_A); | ||
| 290 | } | ||
| 247 | 291 | ||
| 248 | dev_priv->saveDSPACNTR = I915_READ(DSPACNTR); | 292 | dev_priv->saveDSPACNTR = I915_READ(DSPACNTR); |
| 249 | dev_priv->saveDSPASTRIDE = I915_READ(DSPASTRIDE); | 293 | dev_priv->saveDSPASTRIDE = I915_READ(DSPASTRIDE); |
| @@ -260,10 +304,16 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
| 260 | /* Pipe & plane B info */ | 304 | /* Pipe & plane B info */ |
| 261 | dev_priv->savePIPEBCONF = I915_READ(PIPEBCONF); | 305 | dev_priv->savePIPEBCONF = I915_READ(PIPEBCONF); |
| 262 | dev_priv->savePIPEBSRC = I915_READ(PIPEBSRC); | 306 | dev_priv->savePIPEBSRC = I915_READ(PIPEBSRC); |
| 263 | dev_priv->saveFPB0 = I915_READ(FPB0); | 307 | if (IS_IGDNG(dev)) { |
| 264 | dev_priv->saveFPB1 = I915_READ(FPB1); | 308 | dev_priv->saveFPB0 = I915_READ(PCH_FPB0); |
| 265 | dev_priv->saveDPLL_B = I915_READ(DPLL_B); | 309 | dev_priv->saveFPB1 = I915_READ(PCH_FPB1); |
| 266 | if (IS_I965G(dev)) | 310 | dev_priv->saveDPLL_B = I915_READ(PCH_DPLL_B); |
| 311 | } else { | ||
| 312 | dev_priv->saveFPB0 = I915_READ(FPB0); | ||
| 313 | dev_priv->saveFPB1 = I915_READ(FPB1); | ||
| 314 | dev_priv->saveDPLL_B = I915_READ(DPLL_B); | ||
| 315 | } | ||
| 316 | if (IS_I965G(dev) && !IS_IGDNG(dev)) | ||
| 267 | dev_priv->saveDPLL_B_MD = I915_READ(DPLL_B_MD); | 317 | dev_priv->saveDPLL_B_MD = I915_READ(DPLL_B_MD); |
| 268 | dev_priv->saveHTOTAL_B = I915_READ(HTOTAL_B); | 318 | dev_priv->saveHTOTAL_B = I915_READ(HTOTAL_B); |
| 269 | dev_priv->saveHBLANK_B = I915_READ(HBLANK_B); | 319 | dev_priv->saveHBLANK_B = I915_READ(HBLANK_B); |
| @@ -271,7 +321,30 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
| 271 | dev_priv->saveVTOTAL_B = I915_READ(VTOTAL_B); | 321 | dev_priv->saveVTOTAL_B = I915_READ(VTOTAL_B); |
| 272 | dev_priv->saveVBLANK_B = I915_READ(VBLANK_B); | 322 | dev_priv->saveVBLANK_B = I915_READ(VBLANK_B); |
| 273 | dev_priv->saveVSYNC_B = I915_READ(VSYNC_B); | 323 | dev_priv->saveVSYNC_B = I915_READ(VSYNC_B); |
| 274 | dev_priv->saveBCLRPAT_A = I915_READ(BCLRPAT_A); | 324 | if (!IS_IGDNG(dev)) |
| 325 | dev_priv->saveBCLRPAT_B = I915_READ(BCLRPAT_B); | ||
| 326 | |||
| 327 | if (IS_IGDNG(dev)) { | ||
| 328 | dev_priv->savePIPEB_DATA_M1 = I915_READ(PIPEB_DATA_M1); | ||
| 329 | dev_priv->savePIPEB_DATA_N1 = I915_READ(PIPEB_DATA_N1); | ||
| 330 | dev_priv->savePIPEB_LINK_M1 = I915_READ(PIPEB_LINK_M1); | ||
| 331 | dev_priv->savePIPEB_LINK_N1 = I915_READ(PIPEB_LINK_N1); | ||
| 332 | |||
| 333 | dev_priv->saveFDI_TXB_CTL = I915_READ(FDI_TXB_CTL); | ||
| 334 | dev_priv->saveFDI_RXB_CTL = I915_READ(FDI_RXB_CTL); | ||
| 335 | |||
| 336 | dev_priv->savePFB_CTL_1 = I915_READ(PFB_CTL_1); | ||
| 337 | dev_priv->savePFB_WIN_SZ = I915_READ(PFB_WIN_SZ); | ||
| 338 | dev_priv->savePFB_WIN_POS = I915_READ(PFB_WIN_POS); | ||
| 339 | |||
| 340 | dev_priv->saveTRANSBCONF = I915_READ(TRANSBCONF); | ||
| 341 | dev_priv->saveTRANS_HTOTAL_B = I915_READ(TRANS_HTOTAL_B); | ||
| 342 | dev_priv->saveTRANS_HBLANK_B = I915_READ(TRANS_HBLANK_B); | ||
| 343 | dev_priv->saveTRANS_HSYNC_B = I915_READ(TRANS_HSYNC_B); | ||
| 344 | dev_priv->saveTRANS_VTOTAL_B = I915_READ(TRANS_VTOTAL_B); | ||
| 345 | dev_priv->saveTRANS_VBLANK_B = I915_READ(TRANS_VBLANK_B); | ||
| 346 | dev_priv->saveTRANS_VSYNC_B = I915_READ(TRANS_VSYNC_B); | ||
| 347 | } | ||
| 275 | 348 | ||
| 276 | dev_priv->saveDSPBCNTR = I915_READ(DSPBCNTR); | 349 | dev_priv->saveDSPBCNTR = I915_READ(DSPBCNTR); |
| 277 | dev_priv->saveDSPBSTRIDE = I915_READ(DSPBSTRIDE); | 350 | dev_priv->saveDSPBSTRIDE = I915_READ(DSPBSTRIDE); |
| @@ -290,23 +363,46 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
| 290 | static void i915_restore_modeset_reg(struct drm_device *dev) | 363 | static void i915_restore_modeset_reg(struct drm_device *dev) |
| 291 | { | 364 | { |
| 292 | struct drm_i915_private *dev_priv = dev->dev_private; | 365 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 366 | int dpll_a_reg, fpa0_reg, fpa1_reg; | ||
| 367 | int dpll_b_reg, fpb0_reg, fpb1_reg; | ||
| 293 | 368 | ||
| 294 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 369 | if (drm_core_check_feature(dev, DRIVER_MODESET)) |
| 295 | return; | 370 | return; |
| 296 | 371 | ||
| 372 | if (IS_IGDNG(dev)) { | ||
| 373 | dpll_a_reg = PCH_DPLL_A; | ||
| 374 | dpll_b_reg = PCH_DPLL_B; | ||
| 375 | fpa0_reg = PCH_FPA0; | ||
| 376 | fpb0_reg = PCH_FPB0; | ||
| 377 | fpa1_reg = PCH_FPA1; | ||
| 378 | fpb1_reg = PCH_FPB1; | ||
| 379 | } else { | ||
| 380 | dpll_a_reg = DPLL_A; | ||
| 381 | dpll_b_reg = DPLL_B; | ||
| 382 | fpa0_reg = FPA0; | ||
| 383 | fpb0_reg = FPB0; | ||
| 384 | fpa1_reg = FPA1; | ||
| 385 | fpb1_reg = FPB1; | ||
| 386 | } | ||
| 387 | |||
| 388 | if (IS_IGDNG(dev)) { | ||
| 389 | I915_WRITE(PCH_DREF_CONTROL, dev_priv->savePCH_DREF_CONTROL); | ||
| 390 | I915_WRITE(DISP_ARB_CTL, dev_priv->saveDISP_ARB_CTL); | ||
| 391 | } | ||
| 392 | |||
| 297 | /* Pipe & plane A info */ | 393 | /* Pipe & plane A info */ |
| 298 | /* Prime the clock */ | 394 | /* Prime the clock */ |
| 299 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { | 395 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { |
| 300 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A & | 396 | I915_WRITE(dpll_a_reg, dev_priv->saveDPLL_A & |
| 301 | ~DPLL_VCO_ENABLE); | 397 | ~DPLL_VCO_ENABLE); |
| 302 | DRM_UDELAY(150); | 398 | DRM_UDELAY(150); |
| 303 | } | 399 | } |
| 304 | I915_WRITE(FPA0, dev_priv->saveFPA0); | 400 | I915_WRITE(fpa0_reg, dev_priv->saveFPA0); |
| 305 | I915_WRITE(FPA1, dev_priv->saveFPA1); | 401 | I915_WRITE(fpa1_reg, dev_priv->saveFPA1); |
| 306 | /* Actually enable it */ | 402 | /* Actually enable it */ |
| 307 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A); | 403 | I915_WRITE(dpll_a_reg, dev_priv->saveDPLL_A); |
| 308 | DRM_UDELAY(150); | 404 | DRM_UDELAY(150); |
| 309 | if (IS_I965G(dev)) | 405 | if (IS_I965G(dev) && !IS_IGDNG(dev)) |
| 310 | I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD); | 406 | I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD); |
| 311 | DRM_UDELAY(150); | 407 | DRM_UDELAY(150); |
| 312 | 408 | ||
| @@ -317,7 +413,30 @@ static void i915_restore_modeset_reg(struct drm_device *dev) | |||
| 317 | I915_WRITE(VTOTAL_A, dev_priv->saveVTOTAL_A); | 413 | I915_WRITE(VTOTAL_A, dev_priv->saveVTOTAL_A); |
| 318 | I915_WRITE(VBLANK_A, dev_priv->saveVBLANK_A); | 414 | I915_WRITE(VBLANK_A, dev_priv->saveVBLANK_A); |
| 319 | I915_WRITE(VSYNC_A, dev_priv->saveVSYNC_A); | 415 | I915_WRITE(VSYNC_A, dev_priv->saveVSYNC_A); |
| 320 | I915_WRITE(BCLRPAT_A, dev_priv->saveBCLRPAT_A); | 416 | if (!IS_IGDNG(dev)) |
| 417 | I915_WRITE(BCLRPAT_A, dev_priv->saveBCLRPAT_A); | ||
| 418 | |||
| 419 | if (IS_IGDNG(dev)) { | ||
| 420 | I915_WRITE(PIPEA_DATA_M1, dev_priv->savePIPEA_DATA_M1); | ||
| 421 | I915_WRITE(PIPEA_DATA_N1, dev_priv->savePIPEA_DATA_N1); | ||
| 422 | I915_WRITE(PIPEA_LINK_M1, dev_priv->savePIPEA_LINK_M1); | ||
| 423 | I915_WRITE(PIPEA_LINK_N1, dev_priv->savePIPEA_LINK_N1); | ||
| 424 | |||
| 425 | I915_WRITE(FDI_RXA_CTL, dev_priv->saveFDI_RXA_CTL); | ||
| 426 | I915_WRITE(FDI_TXA_CTL, dev_priv->saveFDI_TXA_CTL); | ||
| 427 | |||
| 428 | I915_WRITE(PFA_CTL_1, dev_priv->savePFA_CTL_1); | ||
| 429 | I915_WRITE(PFA_WIN_SZ, dev_priv->savePFA_WIN_SZ); | ||
| 430 | I915_WRITE(PFA_WIN_POS, dev_priv->savePFA_WIN_POS); | ||
| 431 | |||
| 432 | I915_WRITE(TRANSACONF, dev_priv->saveTRANSACONF); | ||
| 433 | I915_WRITE(TRANS_HTOTAL_A, dev_priv->saveTRANS_HTOTAL_A); | ||
| 434 | I915_WRITE(TRANS_HBLANK_A, dev_priv->saveTRANS_HBLANK_A); | ||
| 435 | I915_WRITE(TRANS_HSYNC_A, dev_priv->saveTRANS_HSYNC_A); | ||
| 436 | I915_WRITE(TRANS_VTOTAL_A, dev_priv->saveTRANS_VTOTAL_A); | ||
| 437 | I915_WRITE(TRANS_VBLANK_A, dev_priv->saveTRANS_VBLANK_A); | ||
| 438 | I915_WRITE(TRANS_VSYNC_A, dev_priv->saveTRANS_VSYNC_A); | ||
| 439 | } | ||
| 321 | 440 | ||
| 322 | /* Restore plane info */ | 441 | /* Restore plane info */ |
| 323 | I915_WRITE(DSPASIZE, dev_priv->saveDSPASIZE); | 442 | I915_WRITE(DSPASIZE, dev_priv->saveDSPASIZE); |
| @@ -339,16 +458,16 @@ static void i915_restore_modeset_reg(struct drm_device *dev) | |||
| 339 | 458 | ||
| 340 | /* Pipe & plane B info */ | 459 | /* Pipe & plane B info */ |
| 341 | if (dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) { | 460 | if (dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) { |
| 342 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B & | 461 | I915_WRITE(dpll_b_reg, dev_priv->saveDPLL_B & |
| 343 | ~DPLL_VCO_ENABLE); | 462 | ~DPLL_VCO_ENABLE); |
| 344 | DRM_UDELAY(150); | 463 | DRM_UDELAY(150); |
| 345 | } | 464 | } |
| 346 | I915_WRITE(FPB0, dev_priv->saveFPB0); | 465 | I915_WRITE(fpb0_reg, dev_priv->saveFPB0); |
| 347 | I915_WRITE(FPB1, dev_priv->saveFPB1); | 466 | I915_WRITE(fpb1_reg, dev_priv->saveFPB1); |
| 348 | /* Actually enable it */ | 467 | /* Actually enable it */ |
| 349 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B); | 468 | I915_WRITE(dpll_b_reg, dev_priv->saveDPLL_B); |
| 350 | DRM_UDELAY(150); | 469 | DRM_UDELAY(150); |
| 351 | if (IS_I965G(dev)) | 470 | if (IS_I965G(dev) && !IS_IGDNG(dev)) |
| 352 | I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD); | 471 | I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD); |
| 353 | DRM_UDELAY(150); | 472 | DRM_UDELAY(150); |
| 354 | 473 | ||
| @@ -359,7 +478,30 @@ static void i915_restore_modeset_reg(struct drm_device *dev) | |||
| 359 | I915_WRITE(VTOTAL_B, dev_priv->saveVTOTAL_B); | 478 | I915_WRITE(VTOTAL_B, dev_priv->saveVTOTAL_B); |
| 360 | I915_WRITE(VBLANK_B, dev_priv->saveVBLANK_B); | 479 | I915_WRITE(VBLANK_B, dev_priv->saveVBLANK_B); |
| 361 | I915_WRITE(VSYNC_B, dev_priv->saveVSYNC_B); | 480 | I915_WRITE(VSYNC_B, dev_priv->saveVSYNC_B); |
| 362 | I915_WRITE(BCLRPAT_B, dev_priv->saveBCLRPAT_B); | 481 | if (!IS_IGDNG(dev)) |
| 482 | I915_WRITE(BCLRPAT_B, dev_priv->saveBCLRPAT_B); | ||
| 483 | |||
| 484 | if (IS_IGDNG(dev)) { | ||
| 485 | I915_WRITE(PIPEB_DATA_M1, dev_priv->savePIPEB_DATA_M1); | ||
| 486 | I915_WRITE(PIPEB_DATA_N1, dev_priv->savePIPEB_DATA_N1); | ||
| 487 | I915_WRITE(PIPEB_LINK_M1, dev_priv->savePIPEB_LINK_M1); | ||
| 488 | I915_WRITE(PIPEB_LINK_N1, dev_priv->savePIPEB_LINK_N1); | ||
| 489 | |||
| 490 | I915_WRITE(FDI_RXB_CTL, dev_priv->saveFDI_RXB_CTL); | ||
| 491 | I915_WRITE(FDI_TXB_CTL, dev_priv->saveFDI_TXB_CTL); | ||
| 492 | |||
| 493 | I915_WRITE(PFB_CTL_1, dev_priv->savePFB_CTL_1); | ||
| 494 | I915_WRITE(PFB_WIN_SZ, dev_priv->savePFB_WIN_SZ); | ||
| 495 | I915_WRITE(PFB_WIN_POS, dev_priv->savePFB_WIN_POS); | ||
| 496 | |||
| 497 | I915_WRITE(TRANSBCONF, dev_priv->saveTRANSBCONF); | ||
| 498 | I915_WRITE(TRANS_HTOTAL_B, dev_priv->saveTRANS_HTOTAL_B); | ||
| 499 | I915_WRITE(TRANS_HBLANK_B, dev_priv->saveTRANS_HBLANK_B); | ||
| 500 | I915_WRITE(TRANS_HSYNC_B, dev_priv->saveTRANS_HSYNC_B); | ||
| 501 | I915_WRITE(TRANS_VTOTAL_B, dev_priv->saveTRANS_VTOTAL_B); | ||
| 502 | I915_WRITE(TRANS_VBLANK_B, dev_priv->saveTRANS_VBLANK_B); | ||
| 503 | I915_WRITE(TRANS_VSYNC_B, dev_priv->saveTRANS_VSYNC_B); | ||
| 504 | } | ||
| 363 | 505 | ||
| 364 | /* Restore plane info */ | 506 | /* Restore plane info */ |
| 365 | I915_WRITE(DSPBSIZE, dev_priv->saveDSPBSIZE); | 507 | I915_WRITE(DSPBSIZE, dev_priv->saveDSPBSIZE); |
| @@ -404,21 +546,43 @@ void i915_save_display(struct drm_device *dev) | |||
| 404 | dev_priv->saveCURSIZE = I915_READ(CURSIZE); | 546 | dev_priv->saveCURSIZE = I915_READ(CURSIZE); |
| 405 | 547 | ||
| 406 | /* CRT state */ | 548 | /* CRT state */ |
| 407 | dev_priv->saveADPA = I915_READ(ADPA); | 549 | if (IS_IGDNG(dev)) { |
| 550 | dev_priv->saveADPA = I915_READ(PCH_ADPA); | ||
| 551 | } else { | ||
| 552 | dev_priv->saveADPA = I915_READ(ADPA); | ||
| 553 | } | ||
| 408 | 554 | ||
| 409 | /* LVDS state */ | 555 | /* LVDS state */ |
| 410 | dev_priv->savePP_CONTROL = I915_READ(PP_CONTROL); | 556 | if (IS_IGDNG(dev)) { |
| 411 | dev_priv->savePFIT_PGM_RATIOS = I915_READ(PFIT_PGM_RATIOS); | 557 | dev_priv->savePP_CONTROL = I915_READ(PCH_PP_CONTROL); |
| 412 | dev_priv->saveBLC_PWM_CTL = I915_READ(BLC_PWM_CTL); | 558 | dev_priv->saveBLC_PWM_CTL = I915_READ(BLC_PWM_PCH_CTL1); |
| 413 | if (IS_I965G(dev)) | 559 | dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_PCH_CTL2); |
| 414 | dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2); | 560 | dev_priv->saveBLC_CPU_PWM_CTL = I915_READ(BLC_PWM_CPU_CTL); |
| 415 | if (IS_MOBILE(dev) && !IS_I830(dev)) | 561 | dev_priv->saveBLC_CPU_PWM_CTL2 = I915_READ(BLC_PWM_CPU_CTL2); |
| 416 | dev_priv->saveLVDS = I915_READ(LVDS); | 562 | dev_priv->saveLVDS = I915_READ(PCH_LVDS); |
| 417 | if (!IS_I830(dev) && !IS_845G(dev)) | 563 | } else { |
| 564 | dev_priv->savePP_CONTROL = I915_READ(PP_CONTROL); | ||
| 565 | dev_priv->savePFIT_PGM_RATIOS = I915_READ(PFIT_PGM_RATIOS); | ||
| 566 | dev_priv->saveBLC_PWM_CTL = I915_READ(BLC_PWM_CTL); | ||
| 567 | dev_priv->saveBLC_HIST_CTL = I915_READ(BLC_HIST_CTL); | ||
| 568 | if (IS_I965G(dev)) | ||
| 569 | dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2); | ||
| 570 | if (IS_MOBILE(dev) && !IS_I830(dev)) | ||
| 571 | dev_priv->saveLVDS = I915_READ(LVDS); | ||
| 572 | } | ||
| 573 | |||
| 574 | if (!IS_I830(dev) && !IS_845G(dev) && !IS_IGDNG(dev)) | ||
| 418 | dev_priv->savePFIT_CONTROL = I915_READ(PFIT_CONTROL); | 575 | dev_priv->savePFIT_CONTROL = I915_READ(PFIT_CONTROL); |
| 419 | dev_priv->savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS); | 576 | |
| 420 | dev_priv->savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS); | 577 | if (IS_IGDNG(dev)) { |
| 421 | dev_priv->savePP_DIVISOR = I915_READ(PP_DIVISOR); | 578 | dev_priv->savePP_ON_DELAYS = I915_READ(PCH_PP_ON_DELAYS); |
| 579 | dev_priv->savePP_OFF_DELAYS = I915_READ(PCH_PP_OFF_DELAYS); | ||
| 580 | dev_priv->savePP_DIVISOR = I915_READ(PCH_PP_DIVISOR); | ||
| 581 | } else { | ||
| 582 | dev_priv->savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS); | ||
| 583 | dev_priv->savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS); | ||
| 584 | dev_priv->savePP_DIVISOR = I915_READ(PP_DIVISOR); | ||
| 585 | } | ||
| 422 | 586 | ||
| 423 | /* Display Port state */ | 587 | /* Display Port state */ |
| 424 | if (SUPPORTS_INTEGRATED_DP(dev)) { | 588 | if (SUPPORTS_INTEGRATED_DP(dev)) { |
| @@ -437,16 +601,23 @@ void i915_save_display(struct drm_device *dev) | |||
| 437 | /* FIXME: save TV & SDVO state */ | 601 | /* FIXME: save TV & SDVO state */ |
| 438 | 602 | ||
| 439 | /* FBC state */ | 603 | /* FBC state */ |
| 440 | dev_priv->saveFBC_CFB_BASE = I915_READ(FBC_CFB_BASE); | 604 | if (IS_GM45(dev)) { |
| 441 | dev_priv->saveFBC_LL_BASE = I915_READ(FBC_LL_BASE); | 605 | dev_priv->saveDPFC_CB_BASE = I915_READ(DPFC_CB_BASE); |
| 442 | dev_priv->saveFBC_CONTROL2 = I915_READ(FBC_CONTROL2); | 606 | } else { |
| 443 | dev_priv->saveFBC_CONTROL = I915_READ(FBC_CONTROL); | 607 | dev_priv->saveFBC_CFB_BASE = I915_READ(FBC_CFB_BASE); |
| 608 | dev_priv->saveFBC_LL_BASE = I915_READ(FBC_LL_BASE); | ||
| 609 | dev_priv->saveFBC_CONTROL2 = I915_READ(FBC_CONTROL2); | ||
| 610 | dev_priv->saveFBC_CONTROL = I915_READ(FBC_CONTROL); | ||
| 611 | } | ||
| 444 | 612 | ||
| 445 | /* VGA state */ | 613 | /* VGA state */ |
| 446 | dev_priv->saveVGA0 = I915_READ(VGA0); | 614 | dev_priv->saveVGA0 = I915_READ(VGA0); |
| 447 | dev_priv->saveVGA1 = I915_READ(VGA1); | 615 | dev_priv->saveVGA1 = I915_READ(VGA1); |
| 448 | dev_priv->saveVGA_PD = I915_READ(VGA_PD); | 616 | dev_priv->saveVGA_PD = I915_READ(VGA_PD); |
| 449 | dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); | 617 | if (IS_IGDNG(dev)) |
| 618 | dev_priv->saveVGACNTRL = I915_READ(CPU_VGACNTRL); | ||
| 619 | else | ||
| 620 | dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); | ||
| 450 | 621 | ||
| 451 | i915_save_vga(dev); | 622 | i915_save_vga(dev); |
| 452 | } | 623 | } |
| @@ -485,22 +656,41 @@ void i915_restore_display(struct drm_device *dev) | |||
| 485 | I915_WRITE(CURSIZE, dev_priv->saveCURSIZE); | 656 | I915_WRITE(CURSIZE, dev_priv->saveCURSIZE); |
| 486 | 657 | ||
| 487 | /* CRT state */ | 658 | /* CRT state */ |
| 488 | I915_WRITE(ADPA, dev_priv->saveADPA); | 659 | if (IS_IGDNG(dev)) |
| 660 | I915_WRITE(PCH_ADPA, dev_priv->saveADPA); | ||
| 661 | else | ||
| 662 | I915_WRITE(ADPA, dev_priv->saveADPA); | ||
| 489 | 663 | ||
| 490 | /* LVDS state */ | 664 | /* LVDS state */ |
| 491 | if (IS_I965G(dev)) | 665 | if (IS_I965G(dev) && !IS_IGDNG(dev)) |
| 492 | I915_WRITE(BLC_PWM_CTL2, dev_priv->saveBLC_PWM_CTL2); | 666 | I915_WRITE(BLC_PWM_CTL2, dev_priv->saveBLC_PWM_CTL2); |
| 493 | if (IS_MOBILE(dev) && !IS_I830(dev)) | 667 | |
| 668 | if (IS_IGDNG(dev)) { | ||
| 669 | I915_WRITE(PCH_LVDS, dev_priv->saveLVDS); | ||
| 670 | } else if (IS_MOBILE(dev) && !IS_I830(dev)) | ||
| 494 | I915_WRITE(LVDS, dev_priv->saveLVDS); | 671 | I915_WRITE(LVDS, dev_priv->saveLVDS); |
| 495 | if (!IS_I830(dev) && !IS_845G(dev)) | 672 | |
| 673 | if (!IS_I830(dev) && !IS_845G(dev) && !IS_IGDNG(dev)) | ||
| 496 | I915_WRITE(PFIT_CONTROL, dev_priv->savePFIT_CONTROL); | 674 | I915_WRITE(PFIT_CONTROL, dev_priv->savePFIT_CONTROL); |
| 497 | 675 | ||
| 498 | I915_WRITE(PFIT_PGM_RATIOS, dev_priv->savePFIT_PGM_RATIOS); | 676 | if (IS_IGDNG(dev)) { |
| 499 | I915_WRITE(BLC_PWM_CTL, dev_priv->saveBLC_PWM_CTL); | 677 | I915_WRITE(BLC_PWM_PCH_CTL1, dev_priv->saveBLC_PWM_CTL); |
| 500 | I915_WRITE(PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); | 678 | I915_WRITE(BLC_PWM_PCH_CTL2, dev_priv->saveBLC_PWM_CTL2); |
| 501 | I915_WRITE(PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); | 679 | I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->saveBLC_CPU_PWM_CTL); |
| 502 | I915_WRITE(PP_DIVISOR, dev_priv->savePP_DIVISOR); | 680 | I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->saveBLC_CPU_PWM_CTL2); |
| 503 | I915_WRITE(PP_CONTROL, dev_priv->savePP_CONTROL); | 681 | I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); |
| 682 | I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); | ||
| 683 | I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR); | ||
| 684 | I915_WRITE(PCH_PP_CONTROL, dev_priv->savePP_CONTROL); | ||
| 685 | } else { | ||
| 686 | I915_WRITE(PFIT_PGM_RATIOS, dev_priv->savePFIT_PGM_RATIOS); | ||
| 687 | I915_WRITE(BLC_PWM_CTL, dev_priv->saveBLC_PWM_CTL); | ||
| 688 | I915_WRITE(BLC_HIST_CTL, dev_priv->saveBLC_HIST_CTL); | ||
| 689 | I915_WRITE(PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); | ||
| 690 | I915_WRITE(PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); | ||
| 691 | I915_WRITE(PP_DIVISOR, dev_priv->savePP_DIVISOR); | ||
| 692 | I915_WRITE(PP_CONTROL, dev_priv->savePP_CONTROL); | ||
| 693 | } | ||
| 504 | 694 | ||
| 505 | /* Display Port state */ | 695 | /* Display Port state */ |
| 506 | if (SUPPORTS_INTEGRATED_DP(dev)) { | 696 | if (SUPPORTS_INTEGRATED_DP(dev)) { |
| @@ -511,13 +701,22 @@ void i915_restore_display(struct drm_device *dev) | |||
| 511 | /* FIXME: restore TV & SDVO state */ | 701 | /* FIXME: restore TV & SDVO state */ |
| 512 | 702 | ||
| 513 | /* FBC info */ | 703 | /* FBC info */ |
| 514 | I915_WRITE(FBC_CFB_BASE, dev_priv->saveFBC_CFB_BASE); | 704 | if (IS_GM45(dev)) { |
| 515 | I915_WRITE(FBC_LL_BASE, dev_priv->saveFBC_LL_BASE); | 705 | g4x_disable_fbc(dev); |
| 516 | I915_WRITE(FBC_CONTROL2, dev_priv->saveFBC_CONTROL2); | 706 | I915_WRITE(DPFC_CB_BASE, dev_priv->saveDPFC_CB_BASE); |
| 517 | I915_WRITE(FBC_CONTROL, dev_priv->saveFBC_CONTROL); | 707 | } else { |
| 708 | i8xx_disable_fbc(dev); | ||
| 709 | I915_WRITE(FBC_CFB_BASE, dev_priv->saveFBC_CFB_BASE); | ||
| 710 | I915_WRITE(FBC_LL_BASE, dev_priv->saveFBC_LL_BASE); | ||
| 711 | I915_WRITE(FBC_CONTROL2, dev_priv->saveFBC_CONTROL2); | ||
| 712 | I915_WRITE(FBC_CONTROL, dev_priv->saveFBC_CONTROL); | ||
| 713 | } | ||
| 518 | 714 | ||
| 519 | /* VGA state */ | 715 | /* VGA state */ |
| 520 | I915_WRITE(VGACNTRL, dev_priv->saveVGACNTRL); | 716 | if (IS_IGDNG(dev)) |
| 717 | I915_WRITE(CPU_VGACNTRL, dev_priv->saveVGACNTRL); | ||
| 718 | else | ||
| 719 | I915_WRITE(VGACNTRL, dev_priv->saveVGACNTRL); | ||
| 521 | I915_WRITE(VGA0, dev_priv->saveVGA0); | 720 | I915_WRITE(VGA0, dev_priv->saveVGA0); |
| 522 | I915_WRITE(VGA1, dev_priv->saveVGA1); | 721 | I915_WRITE(VGA1, dev_priv->saveVGA1); |
| 523 | I915_WRITE(VGA_PD, dev_priv->saveVGA_PD); | 722 | I915_WRITE(VGA_PD, dev_priv->saveVGA_PD); |
| @@ -543,8 +742,17 @@ int i915_save_state(struct drm_device *dev) | |||
| 543 | i915_save_display(dev); | 742 | i915_save_display(dev); |
| 544 | 743 | ||
| 545 | /* Interrupt state */ | 744 | /* Interrupt state */ |
| 546 | dev_priv->saveIER = I915_READ(IER); | 745 | if (IS_IGDNG(dev)) { |
| 547 | dev_priv->saveIMR = I915_READ(IMR); | 746 | dev_priv->saveDEIER = I915_READ(DEIER); |
| 747 | dev_priv->saveDEIMR = I915_READ(DEIMR); | ||
| 748 | dev_priv->saveGTIER = I915_READ(GTIER); | ||
| 749 | dev_priv->saveGTIMR = I915_READ(GTIMR); | ||
| 750 | dev_priv->saveFDI_RXA_IMR = I915_READ(FDI_RXA_IMR); | ||
| 751 | dev_priv->saveFDI_RXB_IMR = I915_READ(FDI_RXB_IMR); | ||
| 752 | } else { | ||
| 753 | dev_priv->saveIER = I915_READ(IER); | ||
| 754 | dev_priv->saveIMR = I915_READ(IMR); | ||
| 755 | } | ||
| 548 | 756 | ||
| 549 | /* Clock gating state */ | 757 | /* Clock gating state */ |
| 550 | dev_priv->saveD_STATE = I915_READ(D_STATE); | 758 | dev_priv->saveD_STATE = I915_READ(D_STATE); |
| @@ -609,8 +817,17 @@ int i915_restore_state(struct drm_device *dev) | |||
| 609 | i915_restore_display(dev); | 817 | i915_restore_display(dev); |
| 610 | 818 | ||
| 611 | /* Interrupt state */ | 819 | /* Interrupt state */ |
| 612 | I915_WRITE (IER, dev_priv->saveIER); | 820 | if (IS_IGDNG(dev)) { |
| 613 | I915_WRITE (IMR, dev_priv->saveIMR); | 821 | I915_WRITE(DEIER, dev_priv->saveDEIER); |
| 822 | I915_WRITE(DEIMR, dev_priv->saveDEIMR); | ||
| 823 | I915_WRITE(GTIER, dev_priv->saveGTIER); | ||
| 824 | I915_WRITE(GTIMR, dev_priv->saveGTIMR); | ||
| 825 | I915_WRITE(FDI_RXA_IMR, dev_priv->saveFDI_RXA_IMR); | ||
| 826 | I915_WRITE(FDI_RXB_IMR, dev_priv->saveFDI_RXB_IMR); | ||
| 827 | } else { | ||
| 828 | I915_WRITE (IER, dev_priv->saveIER); | ||
| 829 | I915_WRITE (IMR, dev_priv->saveIMR); | ||
| 830 | } | ||
| 614 | 831 | ||
| 615 | /* Clock gating state */ | 832 | /* Clock gating state */ |
| 616 | I915_WRITE (D_STATE, dev_priv->saveD_STATE); | 833 | I915_WRITE (D_STATE, dev_priv->saveD_STATE); |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 4337414846b6..96cd256e60e6 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
| @@ -351,20 +351,18 @@ parse_driver_features(struct drm_i915_private *dev_priv, | |||
| 351 | struct drm_device *dev = dev_priv->dev; | 351 | struct drm_device *dev = dev_priv->dev; |
| 352 | struct bdb_driver_features *driver; | 352 | struct bdb_driver_features *driver; |
| 353 | 353 | ||
| 354 | /* set default for chips without eDP */ | ||
| 355 | if (!SUPPORTS_EDP(dev)) { | ||
| 356 | dev_priv->edp_support = 0; | ||
| 357 | return; | ||
| 358 | } | ||
| 359 | |||
| 360 | driver = find_section(bdb, BDB_DRIVER_FEATURES); | 354 | driver = find_section(bdb, BDB_DRIVER_FEATURES); |
| 361 | if (!driver) | 355 | if (!driver) |
| 362 | return; | 356 | return; |
| 363 | 357 | ||
| 364 | if (driver->lvds_config == BDB_DRIVER_FEATURE_EDP) | 358 | if (driver && SUPPORTS_EDP(dev) && |
| 359 | driver->lvds_config == BDB_DRIVER_FEATURE_EDP) { | ||
| 365 | dev_priv->edp_support = 1; | 360 | dev_priv->edp_support = 1; |
| 361 | } else { | ||
| 362 | dev_priv->edp_support = 0; | ||
| 363 | } | ||
| 366 | 364 | ||
| 367 | if (driver->dual_frequency) | 365 | if (driver && driver->dual_frequency) |
| 368 | dev_priv->render_reclock_avail = true; | 366 | dev_priv->render_reclock_avail = true; |
| 369 | } | 367 | } |
| 370 | 368 | ||
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 212e22740fc1..e5051446c48e 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
| @@ -262,8 +262,8 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector) | |||
| 262 | } while (time_after(timeout, jiffies)); | 262 | } while (time_after(timeout, jiffies)); |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | if ((I915_READ(PORT_HOTPLUG_STAT) & CRT_HOTPLUG_MONITOR_MASK) == | 265 | if ((I915_READ(PORT_HOTPLUG_STAT) & CRT_HOTPLUG_MONITOR_MASK) != |
| 266 | CRT_HOTPLUG_MONITOR_COLOR) | 266 | CRT_HOTPLUG_MONITOR_NONE) |
| 267 | return true; | 267 | return true; |
| 268 | 268 | ||
| 269 | return false; | 269 | return false; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3c14240cc002..099f420de57a 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -863,10 +863,8 @@ intel_igdng_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
| 863 | struct drm_device *dev = crtc->dev; | 863 | struct drm_device *dev = crtc->dev; |
| 864 | struct drm_i915_private *dev_priv = dev->dev_private; | 864 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 865 | intel_clock_t clock; | 865 | intel_clock_t clock; |
| 866 | int max_n; | ||
| 867 | bool found; | ||
| 868 | int err_most = 47; | 866 | int err_most = 47; |
| 869 | found = false; | 867 | int err_min = 10000; |
| 870 | 868 | ||
| 871 | /* eDP has only 2 clock choice, no n/m/p setting */ | 869 | /* eDP has only 2 clock choice, no n/m/p setting */ |
| 872 | if (HAS_eDP) | 870 | if (HAS_eDP) |
| @@ -890,10 +888,9 @@ intel_igdng_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
| 890 | } | 888 | } |
| 891 | 889 | ||
| 892 | memset(best_clock, 0, sizeof(*best_clock)); | 890 | memset(best_clock, 0, sizeof(*best_clock)); |
| 893 | max_n = limit->n.max; | ||
| 894 | for (clock.p1 = limit->p1.max; clock.p1 >= limit->p1.min; clock.p1--) { | 891 | for (clock.p1 = limit->p1.max; clock.p1 >= limit->p1.min; clock.p1--) { |
| 895 | /* based on hardware requriment prefer smaller n to precision */ | 892 | /* based on hardware requriment prefer smaller n to precision */ |
| 896 | for (clock.n = limit->n.min; clock.n <= max_n; clock.n++) { | 893 | for (clock.n = limit->n.min; clock.n <= limit->n.max; clock.n++) { |
| 897 | /* based on hardware requirment prefere larger m1,m2 */ | 894 | /* based on hardware requirment prefere larger m1,m2 */ |
| 898 | for (clock.m1 = limit->m1.max; | 895 | for (clock.m1 = limit->m1.max; |
| 899 | clock.m1 >= limit->m1.min; clock.m1--) { | 896 | clock.m1 >= limit->m1.min; clock.m1--) { |
| @@ -907,18 +904,18 @@ intel_igdng_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
| 907 | this_err = abs((10000 - (target*10000/clock.dot))); | 904 | this_err = abs((10000 - (target*10000/clock.dot))); |
| 908 | if (this_err < err_most) { | 905 | if (this_err < err_most) { |
| 909 | *best_clock = clock; | 906 | *best_clock = clock; |
| 910 | err_most = this_err; | ||
| 911 | max_n = clock.n; | ||
| 912 | found = true; | ||
| 913 | /* found on first matching */ | 907 | /* found on first matching */ |
| 914 | goto out; | 908 | goto out; |
| 909 | } else if (this_err < err_min) { | ||
| 910 | *best_clock = clock; | ||
| 911 | err_min = this_err; | ||
| 915 | } | 912 | } |
| 916 | } | 913 | } |
| 917 | } | 914 | } |
| 918 | } | 915 | } |
| 919 | } | 916 | } |
| 920 | out: | 917 | out: |
| 921 | return found; | 918 | return true; |
| 922 | } | 919 | } |
| 923 | 920 | ||
| 924 | /* DisplayPort has only two frequencies, 162MHz and 270MHz */ | 921 | /* DisplayPort has only two frequencies, 162MHz and 270MHz */ |
| @@ -943,6 +940,7 @@ intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
| 943 | clock.m = 5 * (clock.m1 + 2) + (clock.m2 + 2); | 940 | clock.m = 5 * (clock.m1 + 2) + (clock.m2 + 2); |
| 944 | clock.p = (clock.p1 * clock.p2); | 941 | clock.p = (clock.p1 * clock.p2); |
| 945 | clock.dot = 96000 * clock.m / (clock.n + 2) / clock.p; | 942 | clock.dot = 96000 * clock.m / (clock.n + 2) / clock.p; |
| 943 | clock.vco = 0; | ||
| 946 | memcpy(best_clock, &clock, sizeof(intel_clock_t)); | 944 | memcpy(best_clock, &clock, sizeof(intel_clock_t)); |
| 947 | return true; | 945 | return true; |
| 948 | } | 946 | } |
| @@ -1260,9 +1258,11 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
| 1260 | return ret; | 1258 | return ret; |
| 1261 | } | 1259 | } |
| 1262 | 1260 | ||
| 1263 | /* Pre-i965 needs to install a fence for tiled scan-out */ | 1261 | /* Install a fence for tiled scan-out. Pre-i965 always needs a fence, |
| 1264 | if (!IS_I965G(dev) && | 1262 | * whereas 965+ only requires a fence if using framebuffer compression. |
| 1265 | obj_priv->fence_reg == I915_FENCE_REG_NONE && | 1263 | * For simplicity, we always install a fence as the cost is not that onerous. |
| 1264 | */ | ||
| 1265 | if (obj_priv->fence_reg == I915_FENCE_REG_NONE && | ||
| 1266 | obj_priv->tiling_mode != I915_TILING_NONE) { | 1266 | obj_priv->tiling_mode != I915_TILING_NONE) { |
| 1267 | ret = i915_gem_object_get_fence_reg(obj); | 1267 | ret = i915_gem_object_get_fence_reg(obj); |
| 1268 | if (ret != 0) { | 1268 | if (ret != 0) { |
| @@ -1513,7 +1513,7 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
| 1513 | /* Enable panel fitting for LVDS */ | 1513 | /* Enable panel fitting for LVDS */ |
| 1514 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | 1514 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { |
| 1515 | temp = I915_READ(pf_ctl_reg); | 1515 | temp = I915_READ(pf_ctl_reg); |
| 1516 | I915_WRITE(pf_ctl_reg, temp | PF_ENABLE); | 1516 | I915_WRITE(pf_ctl_reg, temp | PF_ENABLE | PF_FILTER_MED_3x3); |
| 1517 | 1517 | ||
| 1518 | /* currently full aspect */ | 1518 | /* currently full aspect */ |
| 1519 | I915_WRITE(pf_win_pos, 0); | 1519 | I915_WRITE(pf_win_pos, 0); |
| @@ -1801,6 +1801,8 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
| 1801 | case DRM_MODE_DPMS_ON: | 1801 | case DRM_MODE_DPMS_ON: |
| 1802 | case DRM_MODE_DPMS_STANDBY: | 1802 | case DRM_MODE_DPMS_STANDBY: |
| 1803 | case DRM_MODE_DPMS_SUSPEND: | 1803 | case DRM_MODE_DPMS_SUSPEND: |
| 1804 | intel_update_watermarks(dev); | ||
| 1805 | |||
| 1804 | /* Enable the DPLL */ | 1806 | /* Enable the DPLL */ |
| 1805 | temp = I915_READ(dpll_reg); | 1807 | temp = I915_READ(dpll_reg); |
| 1806 | if ((temp & DPLL_VCO_ENABLE) == 0) { | 1808 | if ((temp & DPLL_VCO_ENABLE) == 0) { |
| @@ -1838,7 +1840,6 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
| 1838 | 1840 | ||
| 1839 | /* Give the overlay scaler a chance to enable if it's on this pipe */ | 1841 | /* Give the overlay scaler a chance to enable if it's on this pipe */ |
| 1840 | //intel_crtc_dpms_video(crtc, true); TODO | 1842 | //intel_crtc_dpms_video(crtc, true); TODO |
| 1841 | intel_update_watermarks(dev); | ||
| 1842 | break; | 1843 | break; |
| 1843 | case DRM_MODE_DPMS_OFF: | 1844 | case DRM_MODE_DPMS_OFF: |
| 1844 | intel_update_watermarks(dev); | 1845 | intel_update_watermarks(dev); |
| @@ -2082,7 +2083,7 @@ fdi_reduce_ratio(u32 *num, u32 *den) | |||
| 2082 | #define LINK_N 0x80000 | 2083 | #define LINK_N 0x80000 |
| 2083 | 2084 | ||
| 2084 | static void | 2085 | static void |
| 2085 | igdng_compute_m_n(int bytes_per_pixel, int nlanes, | 2086 | igdng_compute_m_n(int bits_per_pixel, int nlanes, |
| 2086 | int pixel_clock, int link_clock, | 2087 | int pixel_clock, int link_clock, |
| 2087 | struct fdi_m_n *m_n) | 2088 | struct fdi_m_n *m_n) |
| 2088 | { | 2089 | { |
| @@ -2092,7 +2093,8 @@ igdng_compute_m_n(int bytes_per_pixel, int nlanes, | |||
| 2092 | 2093 | ||
| 2093 | temp = (u64) DATA_N * pixel_clock; | 2094 | temp = (u64) DATA_N * pixel_clock; |
| 2094 | temp = div_u64(temp, link_clock); | 2095 | temp = div_u64(temp, link_clock); |
| 2095 | m_n->gmch_m = div_u64(temp * bytes_per_pixel, nlanes); | 2096 | m_n->gmch_m = div_u64(temp * bits_per_pixel, nlanes); |
| 2097 | m_n->gmch_m >>= 3; /* convert to bytes_per_pixel */ | ||
| 2096 | m_n->gmch_n = DATA_N; | 2098 | m_n->gmch_n = DATA_N; |
| 2097 | fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); | 2099 | fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); |
| 2098 | 2100 | ||
| @@ -2140,6 +2142,13 @@ static struct intel_watermark_params igd_cursor_hplloff_wm = { | |||
| 2140 | IGD_CURSOR_GUARD_WM, | 2142 | IGD_CURSOR_GUARD_WM, |
| 2141 | IGD_FIFO_LINE_SIZE | 2143 | IGD_FIFO_LINE_SIZE |
| 2142 | }; | 2144 | }; |
| 2145 | static struct intel_watermark_params g4x_wm_info = { | ||
| 2146 | G4X_FIFO_SIZE, | ||
| 2147 | G4X_MAX_WM, | ||
| 2148 | G4X_MAX_WM, | ||
| 2149 | 2, | ||
| 2150 | G4X_FIFO_LINE_SIZE, | ||
| 2151 | }; | ||
| 2143 | static struct intel_watermark_params i945_wm_info = { | 2152 | static struct intel_watermark_params i945_wm_info = { |
| 2144 | I945_FIFO_SIZE, | 2153 | I945_FIFO_SIZE, |
| 2145 | I915_MAX_WM, | 2154 | I915_MAX_WM, |
| @@ -2430,17 +2439,74 @@ static int i830_get_fifo_size(struct drm_device *dev, int plane) | |||
| 2430 | return size; | 2439 | return size; |
| 2431 | } | 2440 | } |
| 2432 | 2441 | ||
| 2433 | static void g4x_update_wm(struct drm_device *dev, int unused, int unused2, | 2442 | static void g4x_update_wm(struct drm_device *dev, int planea_clock, |
| 2434 | int unused3, int unused4) | 2443 | int planeb_clock, int sr_hdisplay, int pixel_size) |
| 2435 | { | 2444 | { |
| 2436 | struct drm_i915_private *dev_priv = dev->dev_private; | 2445 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 2437 | u32 fw_blc_self = I915_READ(FW_BLC_SELF); | 2446 | int total_size, cacheline_size; |
| 2447 | int planea_wm, planeb_wm, cursora_wm, cursorb_wm, cursor_sr; | ||
| 2448 | struct intel_watermark_params planea_params, planeb_params; | ||
| 2449 | unsigned long line_time_us; | ||
| 2450 | int sr_clock, sr_entries = 0, entries_required; | ||
| 2438 | 2451 | ||
| 2439 | if (i915_powersave) | 2452 | /* Create copies of the base settings for each pipe */ |
| 2440 | fw_blc_self |= FW_BLC_SELF_EN; | 2453 | planea_params = planeb_params = g4x_wm_info; |
| 2441 | else | 2454 | |
| 2442 | fw_blc_self &= ~FW_BLC_SELF_EN; | 2455 | /* Grab a couple of global values before we overwrite them */ |
| 2443 | I915_WRITE(FW_BLC_SELF, fw_blc_self); | 2456 | total_size = planea_params.fifo_size; |
| 2457 | cacheline_size = planea_params.cacheline_size; | ||
| 2458 | |||
| 2459 | /* | ||
| 2460 | * Note: we need to make sure we don't overflow for various clock & | ||
| 2461 | * latency values. | ||
| 2462 | * clocks go from a few thousand to several hundred thousand. | ||
| 2463 | * latency is usually a few thousand | ||
| 2464 | */ | ||
| 2465 | entries_required = ((planea_clock / 1000) * pixel_size * latency_ns) / | ||
| 2466 | 1000; | ||
| 2467 | entries_required /= G4X_FIFO_LINE_SIZE; | ||
| 2468 | planea_wm = entries_required + planea_params.guard_size; | ||
| 2469 | |||
| 2470 | entries_required = ((planeb_clock / 1000) * pixel_size * latency_ns) / | ||
| 2471 | 1000; | ||
| 2472 | entries_required /= G4X_FIFO_LINE_SIZE; | ||
| 2473 | planeb_wm = entries_required + planeb_params.guard_size; | ||
| 2474 | |||
| 2475 | cursora_wm = cursorb_wm = 16; | ||
| 2476 | cursor_sr = 32; | ||
| 2477 | |||
| 2478 | DRM_DEBUG("FIFO watermarks - A: %d, B: %d\n", planea_wm, planeb_wm); | ||
| 2479 | |||
| 2480 | /* Calc sr entries for one plane configs */ | ||
| 2481 | if (sr_hdisplay && (!planea_clock || !planeb_clock)) { | ||
| 2482 | /* self-refresh has much higher latency */ | ||
| 2483 | const static int sr_latency_ns = 12000; | ||
| 2484 | |||
| 2485 | sr_clock = planea_clock ? planea_clock : planeb_clock; | ||
| 2486 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); | ||
| 2487 | |||
| 2488 | /* Use ns/us then divide to preserve precision */ | ||
| 2489 | sr_entries = (((sr_latency_ns / line_time_us) + 1) * | ||
| 2490 | pixel_size * sr_hdisplay) / 1000; | ||
| 2491 | sr_entries = roundup(sr_entries / cacheline_size, 1); | ||
| 2492 | DRM_DEBUG("self-refresh entries: %d\n", sr_entries); | ||
| 2493 | I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN); | ||
| 2494 | } | ||
| 2495 | |||
| 2496 | DRM_DEBUG("Setting FIFO watermarks - A: %d, B: %d, SR %d\n", | ||
| 2497 | planea_wm, planeb_wm, sr_entries); | ||
| 2498 | |||
| 2499 | planea_wm &= 0x3f; | ||
| 2500 | planeb_wm &= 0x3f; | ||
| 2501 | |||
| 2502 | I915_WRITE(DSPFW1, (sr_entries << DSPFW_SR_SHIFT) | | ||
| 2503 | (cursorb_wm << DSPFW_CURSORB_SHIFT) | | ||
| 2504 | (planeb_wm << DSPFW_PLANEB_SHIFT) | planea_wm); | ||
| 2505 | I915_WRITE(DSPFW2, (I915_READ(DSPFW2) & DSPFW_CURSORA_MASK) | | ||
| 2506 | (cursora_wm << DSPFW_CURSORA_SHIFT)); | ||
| 2507 | /* HPLL off in SR has some issues on G4x... disable it */ | ||
| 2508 | I915_WRITE(DSPFW3, (I915_READ(DSPFW3) & ~DSPFW_HPLL_SR_EN) | | ||
| 2509 | (cursor_sr << DSPFW_CURSOR_SR_SHIFT)); | ||
| 2444 | } | 2510 | } |
| 2445 | 2511 | ||
| 2446 | static void i965_update_wm(struct drm_device *dev, int unused, int unused2, | 2512 | static void i965_update_wm(struct drm_device *dev, int unused, int unused2, |
| @@ -2586,6 +2652,9 @@ static void intel_update_watermarks(struct drm_device *dev) | |||
| 2586 | unsigned long planea_clock = 0, planeb_clock = 0, sr_clock = 0; | 2652 | unsigned long planea_clock = 0, planeb_clock = 0, sr_clock = 0; |
| 2587 | int enabled = 0, pixel_size = 0; | 2653 | int enabled = 0, pixel_size = 0; |
| 2588 | 2654 | ||
| 2655 | if (!dev_priv->display.update_wm) | ||
| 2656 | return; | ||
| 2657 | |||
| 2589 | /* Get the clock config from both planes */ | 2658 | /* Get the clock config from both planes */ |
| 2590 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 2659 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
| 2591 | intel_crtc = to_intel_crtc(crtc); | 2660 | intel_crtc = to_intel_crtc(crtc); |
| @@ -2763,7 +2832,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
| 2763 | 2832 | ||
| 2764 | /* FDI link */ | 2833 | /* FDI link */ |
| 2765 | if (IS_IGDNG(dev)) { | 2834 | if (IS_IGDNG(dev)) { |
| 2766 | int lane, link_bw; | 2835 | int lane, link_bw, bpp; |
| 2767 | /* eDP doesn't require FDI link, so just set DP M/N | 2836 | /* eDP doesn't require FDI link, so just set DP M/N |
| 2768 | according to current link config */ | 2837 | according to current link config */ |
| 2769 | if (is_edp) { | 2838 | if (is_edp) { |
| @@ -2782,10 +2851,72 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
| 2782 | lane = 4; | 2851 | lane = 4; |
| 2783 | link_bw = 270000; | 2852 | link_bw = 270000; |
| 2784 | } | 2853 | } |
| 2785 | igdng_compute_m_n(3, lane, target_clock, | 2854 | |
| 2855 | /* determine panel color depth */ | ||
| 2856 | temp = I915_READ(pipeconf_reg); | ||
| 2857 | |||
| 2858 | switch (temp & PIPE_BPC_MASK) { | ||
| 2859 | case PIPE_8BPC: | ||
| 2860 | bpp = 24; | ||
| 2861 | break; | ||
| 2862 | case PIPE_10BPC: | ||
| 2863 | bpp = 30; | ||
| 2864 | break; | ||
| 2865 | case PIPE_6BPC: | ||
| 2866 | bpp = 18; | ||
| 2867 | break; | ||
| 2868 | case PIPE_12BPC: | ||
| 2869 | bpp = 36; | ||
| 2870 | break; | ||
| 2871 | default: | ||
| 2872 | DRM_ERROR("unknown pipe bpc value\n"); | ||
| 2873 | bpp = 24; | ||
| 2874 | } | ||
| 2875 | |||
| 2876 | igdng_compute_m_n(bpp, lane, target_clock, | ||
| 2786 | link_bw, &m_n); | 2877 | link_bw, &m_n); |
| 2787 | } | 2878 | } |
| 2788 | 2879 | ||
| 2880 | /* Ironlake: try to setup display ref clock before DPLL | ||
| 2881 | * enabling. This is only under driver's control after | ||
| 2882 | * PCH B stepping, previous chipset stepping should be | ||
| 2883 | * ignoring this setting. | ||
| 2884 | */ | ||
| 2885 | if (IS_IGDNG(dev)) { | ||
| 2886 | temp = I915_READ(PCH_DREF_CONTROL); | ||
| 2887 | /* Always enable nonspread source */ | ||
| 2888 | temp &= ~DREF_NONSPREAD_SOURCE_MASK; | ||
| 2889 | temp |= DREF_NONSPREAD_SOURCE_ENABLE; | ||
| 2890 | I915_WRITE(PCH_DREF_CONTROL, temp); | ||
| 2891 | POSTING_READ(PCH_DREF_CONTROL); | ||
| 2892 | |||
| 2893 | temp &= ~DREF_SSC_SOURCE_MASK; | ||
| 2894 | temp |= DREF_SSC_SOURCE_ENABLE; | ||
| 2895 | I915_WRITE(PCH_DREF_CONTROL, temp); | ||
| 2896 | POSTING_READ(PCH_DREF_CONTROL); | ||
| 2897 | |||
| 2898 | udelay(200); | ||
| 2899 | |||
| 2900 | if (is_edp) { | ||
| 2901 | if (dev_priv->lvds_use_ssc) { | ||
| 2902 | temp |= DREF_SSC1_ENABLE; | ||
| 2903 | I915_WRITE(PCH_DREF_CONTROL, temp); | ||
| 2904 | POSTING_READ(PCH_DREF_CONTROL); | ||
| 2905 | |||
| 2906 | udelay(200); | ||
| 2907 | |||
| 2908 | temp &= ~DREF_CPU_SOURCE_OUTPUT_MASK; | ||
| 2909 | temp |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD; | ||
| 2910 | I915_WRITE(PCH_DREF_CONTROL, temp); | ||
| 2911 | POSTING_READ(PCH_DREF_CONTROL); | ||
| 2912 | } else { | ||
| 2913 | temp |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; | ||
| 2914 | I915_WRITE(PCH_DREF_CONTROL, temp); | ||
| 2915 | POSTING_READ(PCH_DREF_CONTROL); | ||
| 2916 | } | ||
| 2917 | } | ||
| 2918 | } | ||
| 2919 | |||
| 2789 | if (IS_IGD(dev)) { | 2920 | if (IS_IGD(dev)) { |
| 2790 | fp = (1 << clock.n) << 16 | clock.m1 << 8 | clock.m2; | 2921 | fp = (1 << clock.n) << 16 | clock.m1 << 8 | clock.m2; |
| 2791 | if (has_reduced_clock) | 2922 | if (has_reduced_clock) |
| @@ -2936,6 +3067,8 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
| 2936 | 3067 | ||
| 2937 | lvds = I915_READ(lvds_reg); | 3068 | lvds = I915_READ(lvds_reg); |
| 2938 | lvds |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP | LVDS_PIPEB_SELECT; | 3069 | lvds |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP | LVDS_PIPEB_SELECT; |
| 3070 | /* set the corresponsding LVDS_BORDER bit */ | ||
| 3071 | lvds |= dev_priv->lvds_border_bits; | ||
| 2939 | /* Set the B0-B3 data pairs corresponding to whether we're going to | 3072 | /* Set the B0-B3 data pairs corresponding to whether we're going to |
| 2940 | * set the DPLLs for dual-channel mode or not. | 3073 | * set the DPLLs for dual-channel mode or not. |
| 2941 | */ | 3074 | */ |
| @@ -4124,7 +4257,9 @@ void intel_init_clock_gating(struct drm_device *dev) | |||
| 4124 | * Disable clock gating reported to work incorrectly according to the | 4257 | * Disable clock gating reported to work incorrectly according to the |
| 4125 | * specs, but enable as much else as we can. | 4258 | * specs, but enable as much else as we can. |
| 4126 | */ | 4259 | */ |
| 4127 | if (IS_G4X(dev)) { | 4260 | if (IS_IGDNG(dev)) { |
| 4261 | return; | ||
| 4262 | } else if (IS_G4X(dev)) { | ||
| 4128 | uint32_t dspclk_gate; | 4263 | uint32_t dspclk_gate; |
| 4129 | I915_WRITE(RENCLK_GATE_D1, 0); | 4264 | I915_WRITE(RENCLK_GATE_D1, 0); |
| 4130 | I915_WRITE(RENCLK_GATE_D2, VF_UNIT_CLOCK_GATE_DISABLE | | 4265 | I915_WRITE(RENCLK_GATE_D2, VF_UNIT_CLOCK_GATE_DISABLE | |
| @@ -4212,7 +4347,9 @@ static void intel_init_display(struct drm_device *dev) | |||
| 4212 | i830_get_display_clock_speed; | 4347 | i830_get_display_clock_speed; |
| 4213 | 4348 | ||
| 4214 | /* For FIFO watermark updates */ | 4349 | /* For FIFO watermark updates */ |
| 4215 | if (IS_G4X(dev)) | 4350 | if (IS_IGDNG(dev)) |
| 4351 | dev_priv->display.update_wm = NULL; | ||
| 4352 | else if (IS_G4X(dev)) | ||
| 4216 | dev_priv->display.update_wm = g4x_update_wm; | 4353 | dev_priv->display.update_wm = g4x_update_wm; |
| 4217 | else if (IS_I965G(dev)) | 4354 | else if (IS_I965G(dev)) |
| 4218 | dev_priv->display.update_wm = i965_update_wm; | 4355 | dev_priv->display.update_wm = i965_update_wm; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f4856a510476..d83447557f9b 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
| @@ -400,7 +400,7 @@ intel_dp_i2c_init(struct intel_output *intel_output, const char *name) | |||
| 400 | { | 400 | { |
| 401 | struct intel_dp_priv *dp_priv = intel_output->dev_priv; | 401 | struct intel_dp_priv *dp_priv = intel_output->dev_priv; |
| 402 | 402 | ||
| 403 | DRM_ERROR("i2c_init %s\n", name); | 403 | DRM_DEBUG_KMS("i2c_init %s\n", name); |
| 404 | dp_priv->algo.running = false; | 404 | dp_priv->algo.running = false; |
| 405 | dp_priv->algo.address = 0; | 405 | dp_priv->algo.address = 0; |
| 406 | dp_priv->algo.aux_ch = intel_dp_i2c_aux_ch; | 406 | dp_priv->algo.aux_ch = intel_dp_i2c_aux_ch; |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 663ab6de0b58..c33451aec1bd 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
| @@ -77,14 +77,32 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode) | |||
| 77 | struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; | 77 | struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; |
| 78 | u32 temp; | 78 | u32 temp; |
| 79 | 79 | ||
| 80 | if (mode != DRM_MODE_DPMS_ON) { | 80 | temp = I915_READ(hdmi_priv->sdvox_reg); |
| 81 | temp = I915_READ(hdmi_priv->sdvox_reg); | 81 | |
| 82 | /* HW workaround, need to toggle enable bit off and on for 12bpc, but | ||
| 83 | * we do this anyway which shows more stable in testing. | ||
| 84 | */ | ||
| 85 | if (IS_IGDNG(dev)) { | ||
| 82 | I915_WRITE(hdmi_priv->sdvox_reg, temp & ~SDVO_ENABLE); | 86 | I915_WRITE(hdmi_priv->sdvox_reg, temp & ~SDVO_ENABLE); |
| 87 | POSTING_READ(hdmi_priv->sdvox_reg); | ||
| 88 | } | ||
| 89 | |||
| 90 | if (mode != DRM_MODE_DPMS_ON) { | ||
| 91 | temp &= ~SDVO_ENABLE; | ||
| 83 | } else { | 92 | } else { |
| 84 | temp = I915_READ(hdmi_priv->sdvox_reg); | 93 | temp |= SDVO_ENABLE; |
| 85 | I915_WRITE(hdmi_priv->sdvox_reg, temp | SDVO_ENABLE); | ||
| 86 | } | 94 | } |
| 95 | |||
| 96 | I915_WRITE(hdmi_priv->sdvox_reg, temp); | ||
| 87 | POSTING_READ(hdmi_priv->sdvox_reg); | 97 | POSTING_READ(hdmi_priv->sdvox_reg); |
| 98 | |||
| 99 | /* HW workaround, need to write this twice for issue that may result | ||
| 100 | * in first write getting masked. | ||
| 101 | */ | ||
| 102 | if (IS_IGDNG(dev)) { | ||
| 103 | I915_WRITE(hdmi_priv->sdvox_reg, temp); | ||
| 104 | POSTING_READ(hdmi_priv->sdvox_reg); | ||
| 105 | } | ||
| 88 | } | 106 | } |
| 89 | 107 | ||
| 90 | static void intel_hdmi_save(struct drm_connector *connector) | 108 | static void intel_hdmi_save(struct drm_connector *connector) |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 808bbe412ba8..05598ae10c4b 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
| @@ -380,7 +380,7 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, | |||
| 380 | adjusted_mode->crtc_vblank_start + vsync_pos; | 380 | adjusted_mode->crtc_vblank_start + vsync_pos; |
| 381 | /* keep the vsync width constant */ | 381 | /* keep the vsync width constant */ |
| 382 | adjusted_mode->crtc_vsync_end = | 382 | adjusted_mode->crtc_vsync_end = |
| 383 | adjusted_mode->crtc_vblank_start + vsync_width; | 383 | adjusted_mode->crtc_vsync_start + vsync_width; |
| 384 | border = 1; | 384 | border = 1; |
| 385 | break; | 385 | break; |
| 386 | case DRM_MODE_SCALE_ASPECT: | 386 | case DRM_MODE_SCALE_ASPECT: |
| @@ -526,6 +526,14 @@ out: | |||
| 526 | lvds_priv->pfit_control = pfit_control; | 526 | lvds_priv->pfit_control = pfit_control; |
| 527 | lvds_priv->pfit_pgm_ratios = pfit_pgm_ratios; | 527 | lvds_priv->pfit_pgm_ratios = pfit_pgm_ratios; |
| 528 | /* | 528 | /* |
| 529 | * When there exists the border, it means that the LVDS_BORDR | ||
| 530 | * should be enabled. | ||
| 531 | */ | ||
| 532 | if (border) | ||
| 533 | dev_priv->lvds_border_bits |= LVDS_BORDER_ENABLE; | ||
| 534 | else | ||
| 535 | dev_priv->lvds_border_bits &= ~(LVDS_BORDER_ENABLE); | ||
| 536 | /* | ||
| 529 | * XXX: It would be nice to support lower refresh rates on the | 537 | * XXX: It would be nice to support lower refresh rates on the |
| 530 | * panels to reduce power consumption, and perhaps match the | 538 | * panels to reduce power consumption, and perhaps match the |
| 531 | * user's requested refresh rate. | 539 | * user's requested refresh rate. |
diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 09a28923f46e..b5713eedd6e1 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile | |||
| @@ -49,7 +49,7 @@ radeon-y += radeon_device.o radeon_kms.o \ | |||
| 49 | radeon_cs.o radeon_bios.o radeon_benchmark.o r100.o r300.o r420.o \ | 49 | radeon_cs.o radeon_bios.o radeon_benchmark.o r100.o r300.o r420.o \ |
| 50 | rs400.o rs600.o rs690.o rv515.o r520.o r600.o rv770.o radeon_test.o \ | 50 | rs400.o rs600.o rs690.o rv515.o r520.o r600.o rv770.o radeon_test.o \ |
| 51 | r200.o radeon_legacy_tv.o r600_cs.o r600_blit.o r600_blit_shaders.o \ | 51 | r200.o radeon_legacy_tv.o r600_cs.o r600_blit.o r600_blit_shaders.o \ |
| 52 | r600_blit_kms.o | 52 | r600_blit_kms.o radeon_pm.o |
| 53 | 53 | ||
| 54 | radeon-$(CONFIG_COMPAT) += radeon_ioc32.o | 54 | radeon-$(CONFIG_COMPAT) += radeon_ioc32.o |
| 55 | 55 | ||
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index 901befe03da2..d67c42555ab9 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
| @@ -107,6 +107,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | |||
| 107 | base += 3; | 107 | base += 3; |
| 108 | break; | 108 | break; |
| 109 | case ATOM_IIO_WRITE: | 109 | case ATOM_IIO_WRITE: |
| 110 | (void)ctx->card->reg_read(ctx->card, CU16(base + 1)); | ||
| 110 | ctx->card->reg_write(ctx->card, CU16(base + 1), temp); | 111 | ctx->card->reg_write(ctx->card, CU16(base + 1), temp); |
| 111 | base += 3; | 112 | base += 3; |
| 112 | break; | 113 | break; |
diff --git a/drivers/gpu/drm/radeon/atombios.h b/drivers/gpu/drm/radeon/atombios.h index 5d402086bc47..c11ddddfb3b6 100644 --- a/drivers/gpu/drm/radeon/atombios.h +++ b/drivers/gpu/drm/radeon/atombios.h | |||
| @@ -2314,7 +2314,7 @@ typedef struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT { | |||
| 2314 | UCHAR ucSS_Step; | 2314 | UCHAR ucSS_Step; |
| 2315 | UCHAR ucSS_Delay; | 2315 | UCHAR ucSS_Delay; |
| 2316 | UCHAR ucSS_Id; | 2316 | UCHAR ucSS_Id; |
| 2317 | UCHAR ucRecommandedRef_Div; | 2317 | UCHAR ucRecommendedRef_Div; |
| 2318 | UCHAR ucSS_Range; /* it was reserved for V11 */ | 2318 | UCHAR ucSS_Range; /* it was reserved for V11 */ |
| 2319 | } ATOM_SPREAD_SPECTRUM_ASSIGNMENT; | 2319 | } ATOM_SPREAD_SPECTRUM_ASSIGNMENT; |
| 2320 | 2320 | ||
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 14fa9701aeb3..c15287a590ff 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
| @@ -31,10 +31,6 @@ | |||
| 31 | #include "atom.h" | 31 | #include "atom.h" |
| 32 | #include "atom-bits.h" | 32 | #include "atom-bits.h" |
| 33 | 33 | ||
| 34 | /* evil but including atombios.h is much worse */ | ||
| 35 | bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, | ||
| 36 | SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION *crtc_timing, | ||
| 37 | int32_t *pixel_clock); | ||
| 38 | static void atombios_overscan_setup(struct drm_crtc *crtc, | 34 | static void atombios_overscan_setup(struct drm_crtc *crtc, |
| 39 | struct drm_display_mode *mode, | 35 | struct drm_display_mode *mode, |
| 40 | struct drm_display_mode *adjusted_mode) | 36 | struct drm_display_mode *adjusted_mode) |
| @@ -248,18 +244,18 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
| 248 | 244 | ||
| 249 | switch (mode) { | 245 | switch (mode) { |
| 250 | case DRM_MODE_DPMS_ON: | 246 | case DRM_MODE_DPMS_ON: |
| 247 | atombios_enable_crtc(crtc, 1); | ||
| 251 | if (ASIC_IS_DCE3(rdev)) | 248 | if (ASIC_IS_DCE3(rdev)) |
| 252 | atombios_enable_crtc_memreq(crtc, 1); | 249 | atombios_enable_crtc_memreq(crtc, 1); |
| 253 | atombios_enable_crtc(crtc, 1); | ||
| 254 | atombios_blank_crtc(crtc, 0); | 250 | atombios_blank_crtc(crtc, 0); |
| 255 | break; | 251 | break; |
| 256 | case DRM_MODE_DPMS_STANDBY: | 252 | case DRM_MODE_DPMS_STANDBY: |
| 257 | case DRM_MODE_DPMS_SUSPEND: | 253 | case DRM_MODE_DPMS_SUSPEND: |
| 258 | case DRM_MODE_DPMS_OFF: | 254 | case DRM_MODE_DPMS_OFF: |
| 259 | atombios_blank_crtc(crtc, 1); | 255 | atombios_blank_crtc(crtc, 1); |
| 260 | atombios_enable_crtc(crtc, 0); | ||
| 261 | if (ASIC_IS_DCE3(rdev)) | 256 | if (ASIC_IS_DCE3(rdev)) |
| 262 | atombios_enable_crtc_memreq(crtc, 0); | 257 | atombios_enable_crtc_memreq(crtc, 0); |
| 258 | atombios_enable_crtc(crtc, 0); | ||
| 263 | break; | 259 | break; |
| 264 | } | 260 | } |
| 265 | 261 | ||
| @@ -270,59 +266,147 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
| 270 | 266 | ||
| 271 | static void | 267 | static void |
| 272 | atombios_set_crtc_dtd_timing(struct drm_crtc *crtc, | 268 | atombios_set_crtc_dtd_timing(struct drm_crtc *crtc, |
| 273 | SET_CRTC_USING_DTD_TIMING_PARAMETERS * crtc_param) | 269 | struct drm_display_mode *mode) |
| 274 | { | 270 | { |
| 271 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
| 275 | struct drm_device *dev = crtc->dev; | 272 | struct drm_device *dev = crtc->dev; |
| 276 | struct radeon_device *rdev = dev->dev_private; | 273 | struct radeon_device *rdev = dev->dev_private; |
| 277 | SET_CRTC_USING_DTD_TIMING_PARAMETERS conv_param; | 274 | SET_CRTC_USING_DTD_TIMING_PARAMETERS args; |
| 278 | int index = GetIndexIntoMasterTable(COMMAND, SetCRTC_UsingDTDTiming); | 275 | int index = GetIndexIntoMasterTable(COMMAND, SetCRTC_UsingDTDTiming); |
| 276 | u16 misc = 0; | ||
| 279 | 277 | ||
| 280 | conv_param.usH_Size = cpu_to_le16(crtc_param->usH_Size); | 278 | memset(&args, 0, sizeof(args)); |
| 281 | conv_param.usH_Blanking_Time = | 279 | args.usH_Size = cpu_to_le16(mode->crtc_hdisplay); |
| 282 | cpu_to_le16(crtc_param->usH_Blanking_Time); | 280 | args.usH_Blanking_Time = |
| 283 | conv_param.usV_Size = cpu_to_le16(crtc_param->usV_Size); | 281 | cpu_to_le16(mode->crtc_hblank_end - mode->crtc_hdisplay); |
| 284 | conv_param.usV_Blanking_Time = | 282 | args.usV_Size = cpu_to_le16(mode->crtc_vdisplay); |
| 285 | cpu_to_le16(crtc_param->usV_Blanking_Time); | 283 | args.usV_Blanking_Time = |
| 286 | conv_param.usH_SyncOffset = cpu_to_le16(crtc_param->usH_SyncOffset); | 284 | cpu_to_le16(mode->crtc_vblank_end - mode->crtc_vdisplay); |
| 287 | conv_param.usH_SyncWidth = cpu_to_le16(crtc_param->usH_SyncWidth); | 285 | args.usH_SyncOffset = |
| 288 | conv_param.usV_SyncOffset = cpu_to_le16(crtc_param->usV_SyncOffset); | 286 | cpu_to_le16(mode->crtc_hsync_start - mode->crtc_hdisplay); |
| 289 | conv_param.usV_SyncWidth = cpu_to_le16(crtc_param->usV_SyncWidth); | 287 | args.usH_SyncWidth = |
| 290 | conv_param.susModeMiscInfo.usAccess = | 288 | cpu_to_le16(mode->crtc_hsync_end - mode->crtc_hsync_start); |
| 291 | cpu_to_le16(crtc_param->susModeMiscInfo.usAccess); | 289 | args.usV_SyncOffset = |
| 292 | conv_param.ucCRTC = crtc_param->ucCRTC; | 290 | cpu_to_le16(mode->crtc_vsync_start - mode->crtc_vdisplay); |
| 291 | args.usV_SyncWidth = | ||
| 292 | cpu_to_le16(mode->crtc_vsync_end - mode->crtc_vsync_start); | ||
| 293 | /*args.ucH_Border = mode->hborder;*/ | ||
| 294 | /*args.ucV_Border = mode->vborder;*/ | ||
| 295 | |||
| 296 | if (mode->flags & DRM_MODE_FLAG_NVSYNC) | ||
| 297 | misc |= ATOM_VSYNC_POLARITY; | ||
| 298 | if (mode->flags & DRM_MODE_FLAG_NHSYNC) | ||
| 299 | misc |= ATOM_HSYNC_POLARITY; | ||
| 300 | if (mode->flags & DRM_MODE_FLAG_CSYNC) | ||
| 301 | misc |= ATOM_COMPOSITESYNC; | ||
| 302 | if (mode->flags & DRM_MODE_FLAG_INTERLACE) | ||
| 303 | misc |= ATOM_INTERLACE; | ||
| 304 | if (mode->flags & DRM_MODE_FLAG_DBLSCAN) | ||
| 305 | misc |= ATOM_DOUBLE_CLOCK_MODE; | ||
| 306 | |||
| 307 | args.susModeMiscInfo.usAccess = cpu_to_le16(misc); | ||
| 308 | args.ucCRTC = radeon_crtc->crtc_id; | ||
| 293 | 309 | ||
| 294 | printk("executing set crtc dtd timing\n"); | 310 | printk("executing set crtc dtd timing\n"); |
| 295 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&conv_param); | 311 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
| 296 | } | 312 | } |
| 297 | 313 | ||
| 298 | void atombios_crtc_set_timing(struct drm_crtc *crtc, | 314 | static void atombios_crtc_set_timing(struct drm_crtc *crtc, |
| 299 | SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION * | 315 | struct drm_display_mode *mode) |
| 300 | crtc_param) | ||
| 301 | { | 316 | { |
| 317 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
| 302 | struct drm_device *dev = crtc->dev; | 318 | struct drm_device *dev = crtc->dev; |
| 303 | struct radeon_device *rdev = dev->dev_private; | 319 | struct radeon_device *rdev = dev->dev_private; |
| 304 | SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION conv_param; | 320 | SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION args; |
| 305 | int index = GetIndexIntoMasterTable(COMMAND, SetCRTC_Timing); | 321 | int index = GetIndexIntoMasterTable(COMMAND, SetCRTC_Timing); |
| 322 | u16 misc = 0; | ||
| 306 | 323 | ||
| 307 | conv_param.usH_Total = cpu_to_le16(crtc_param->usH_Total); | 324 | memset(&args, 0, sizeof(args)); |
| 308 | conv_param.usH_Disp = cpu_to_le16(crtc_param->usH_Disp); | 325 | args.usH_Total = cpu_to_le16(mode->crtc_htotal); |
| 309 | conv_param.usH_SyncStart = cpu_to_le16(crtc_param->usH_SyncStart); | 326 | args.usH_Disp = cpu_to_le16(mode->crtc_hdisplay); |
| 310 | conv_param.usH_SyncWidth = cpu_to_le16(crtc_param->usH_SyncWidth); | 327 | args.usH_SyncStart = cpu_to_le16(mode->crtc_hsync_start); |
| 311 | conv_param.usV_Total = cpu_to_le16(crtc_param->usV_Total); | 328 | args.usH_SyncWidth = |
| 312 | conv_param.usV_Disp = cpu_to_le16(crtc_param->usV_Disp); | 329 | cpu_to_le16(mode->crtc_hsync_end - mode->crtc_hsync_start); |
| 313 | conv_param.usV_SyncStart = cpu_to_le16(crtc_param->usV_SyncStart); | 330 | args.usV_Total = cpu_to_le16(mode->crtc_vtotal); |
| 314 | conv_param.usV_SyncWidth = cpu_to_le16(crtc_param->usV_SyncWidth); | 331 | args.usV_Disp = cpu_to_le16(mode->crtc_vdisplay); |
| 315 | conv_param.susModeMiscInfo.usAccess = | 332 | args.usV_SyncStart = cpu_to_le16(mode->crtc_vsync_start); |
| 316 | cpu_to_le16(crtc_param->susModeMiscInfo.usAccess); | 333 | args.usV_SyncWidth = |
| 317 | conv_param.ucCRTC = crtc_param->ucCRTC; | 334 | cpu_to_le16(mode->crtc_vsync_end - mode->crtc_vsync_start); |
| 318 | conv_param.ucOverscanRight = crtc_param->ucOverscanRight; | 335 | |
| 319 | conv_param.ucOverscanLeft = crtc_param->ucOverscanLeft; | 336 | if (mode->flags & DRM_MODE_FLAG_NVSYNC) |
| 320 | conv_param.ucOverscanBottom = crtc_param->ucOverscanBottom; | 337 | misc |= ATOM_VSYNC_POLARITY; |
| 321 | conv_param.ucOverscanTop = crtc_param->ucOverscanTop; | 338 | if (mode->flags & DRM_MODE_FLAG_NHSYNC) |
| 322 | conv_param.ucReserved = crtc_param->ucReserved; | 339 | misc |= ATOM_HSYNC_POLARITY; |
| 340 | if (mode->flags & DRM_MODE_FLAG_CSYNC) | ||
| 341 | misc |= ATOM_COMPOSITESYNC; | ||
| 342 | if (mode->flags & DRM_MODE_FLAG_INTERLACE) | ||
| 343 | misc |= ATOM_INTERLACE; | ||
| 344 | if (mode->flags & DRM_MODE_FLAG_DBLSCAN) | ||
| 345 | misc |= ATOM_DOUBLE_CLOCK_MODE; | ||
| 346 | |||
| 347 | args.susModeMiscInfo.usAccess = cpu_to_le16(misc); | ||
| 348 | args.ucCRTC = radeon_crtc->crtc_id; | ||
| 323 | 349 | ||
| 324 | printk("executing set crtc timing\n"); | 350 | printk("executing set crtc timing\n"); |
| 325 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&conv_param); | 351 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
| 352 | } | ||
| 353 | |||
| 354 | static void atombios_set_ss(struct drm_crtc *crtc, int enable) | ||
| 355 | { | ||
| 356 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
| 357 | struct drm_device *dev = crtc->dev; | ||
| 358 | struct radeon_device *rdev = dev->dev_private; | ||
| 359 | struct drm_encoder *encoder = NULL; | ||
| 360 | struct radeon_encoder *radeon_encoder = NULL; | ||
| 361 | struct radeon_encoder_atom_dig *dig = NULL; | ||
| 362 | int index = GetIndexIntoMasterTable(COMMAND, EnableSpreadSpectrumOnPPLL); | ||
| 363 | ENABLE_SPREAD_SPECTRUM_ON_PPLL_PS_ALLOCATION args; | ||
| 364 | ENABLE_LVDS_SS_PARAMETERS legacy_args; | ||
| 365 | uint16_t percentage = 0; | ||
| 366 | uint8_t type = 0, step = 0, delay = 0, range = 0; | ||
| 367 | |||
| 368 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | ||
| 369 | if (encoder->crtc == crtc) { | ||
| 370 | radeon_encoder = to_radeon_encoder(encoder); | ||
| 371 | /* only enable spread spectrum on LVDS */ | ||
| 372 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | ||
| 373 | dig = radeon_encoder->enc_priv; | ||
| 374 | if (dig && dig->ss) { | ||
| 375 | percentage = dig->ss->percentage; | ||
| 376 | type = dig->ss->type; | ||
| 377 | step = dig->ss->step; | ||
| 378 | delay = dig->ss->delay; | ||
| 379 | range = dig->ss->range; | ||
| 380 | } else if (enable) | ||
| 381 | return; | ||
| 382 | } else if (enable) | ||
| 383 | return; | ||
| 384 | break; | ||
| 385 | } | ||
| 386 | } | ||
| 387 | |||
| 388 | if (!radeon_encoder) | ||
| 389 | return; | ||
| 390 | |||
| 391 | if (ASIC_IS_AVIVO(rdev)) { | ||
| 392 | memset(&args, 0, sizeof(args)); | ||
| 393 | args.usSpreadSpectrumPercentage = cpu_to_le16(percentage); | ||
| 394 | args.ucSpreadSpectrumType = type; | ||
| 395 | args.ucSpreadSpectrumStep = step; | ||
| 396 | args.ucSpreadSpectrumDelay = delay; | ||
| 397 | args.ucSpreadSpectrumRange = range; | ||
| 398 | args.ucPpll = radeon_crtc->crtc_id ? ATOM_PPLL2 : ATOM_PPLL1; | ||
| 399 | args.ucEnable = enable; | ||
| 400 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 401 | } else { | ||
| 402 | memset(&legacy_args, 0, sizeof(legacy_args)); | ||
| 403 | legacy_args.usSpreadSpectrumPercentage = cpu_to_le16(percentage); | ||
| 404 | legacy_args.ucSpreadSpectrumType = type; | ||
| 405 | legacy_args.ucSpreadSpectrumStepSize_Delay = (step & 3) << 2; | ||
| 406 | legacy_args.ucSpreadSpectrumStepSize_Delay |= (delay & 7) << 4; | ||
| 407 | legacy_args.ucEnable = enable; | ||
| 408 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&legacy_args); | ||
| 409 | } | ||
| 326 | } | 410 | } |
| 327 | 411 | ||
| 328 | void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) | 412 | void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) |
| @@ -333,12 +417,13 @@ void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) | |||
| 333 | struct drm_encoder *encoder = NULL; | 417 | struct drm_encoder *encoder = NULL; |
| 334 | struct radeon_encoder *radeon_encoder = NULL; | 418 | struct radeon_encoder *radeon_encoder = NULL; |
| 335 | uint8_t frev, crev; | 419 | uint8_t frev, crev; |
| 336 | int index = GetIndexIntoMasterTable(COMMAND, SetPixelClock); | 420 | int index; |
| 337 | SET_PIXEL_CLOCK_PS_ALLOCATION args; | 421 | SET_PIXEL_CLOCK_PS_ALLOCATION args; |
| 338 | PIXEL_CLOCK_PARAMETERS *spc1_ptr; | 422 | PIXEL_CLOCK_PARAMETERS *spc1_ptr; |
| 339 | PIXEL_CLOCK_PARAMETERS_V2 *spc2_ptr; | 423 | PIXEL_CLOCK_PARAMETERS_V2 *spc2_ptr; |
| 340 | PIXEL_CLOCK_PARAMETERS_V3 *spc3_ptr; | 424 | PIXEL_CLOCK_PARAMETERS_V3 *spc3_ptr; |
| 341 | uint32_t sclock = mode->clock; | 425 | uint32_t pll_clock = mode->clock; |
| 426 | uint32_t adjusted_clock; | ||
| 342 | uint32_t ref_div = 0, fb_div = 0, frac_fb_div = 0, post_div = 0; | 427 | uint32_t ref_div = 0, fb_div = 0, frac_fb_div = 0, post_div = 0; |
| 343 | struct radeon_pll *pll; | 428 | struct radeon_pll *pll; |
| 344 | int pll_flags = 0; | 429 | int pll_flags = 0; |
| @@ -346,8 +431,6 @@ void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) | |||
| 346 | memset(&args, 0, sizeof(args)); | 431 | memset(&args, 0, sizeof(args)); |
| 347 | 432 | ||
| 348 | if (ASIC_IS_AVIVO(rdev)) { | 433 | if (ASIC_IS_AVIVO(rdev)) { |
| 349 | uint32_t ss_cntl; | ||
| 350 | |||
| 351 | if ((rdev->family == CHIP_RS600) || | 434 | if ((rdev->family == CHIP_RS600) || |
| 352 | (rdev->family == CHIP_RS690) || | 435 | (rdev->family == CHIP_RS690) || |
| 353 | (rdev->family == CHIP_RS740)) | 436 | (rdev->family == CHIP_RS740)) |
| @@ -358,15 +441,6 @@ void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) | |||
| 358 | pll_flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; | 441 | pll_flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; |
| 359 | else | 442 | else |
| 360 | pll_flags |= RADEON_PLL_PREFER_LOW_REF_DIV; | 443 | pll_flags |= RADEON_PLL_PREFER_LOW_REF_DIV; |
| 361 | |||
| 362 | /* disable spread spectrum clocking for now -- thanks Hedy Lamarr */ | ||
| 363 | if (radeon_crtc->crtc_id == 0) { | ||
| 364 | ss_cntl = RREG32(AVIVO_P1PLL_INT_SS_CNTL); | ||
| 365 | WREG32(AVIVO_P1PLL_INT_SS_CNTL, ss_cntl & ~1); | ||
| 366 | } else { | ||
| 367 | ss_cntl = RREG32(AVIVO_P2PLL_INT_SS_CNTL); | ||
| 368 | WREG32(AVIVO_P2PLL_INT_SS_CNTL, ss_cntl & ~1); | ||
| 369 | } | ||
| 370 | } else { | 444 | } else { |
| 371 | pll_flags |= RADEON_PLL_LEGACY; | 445 | pll_flags |= RADEON_PLL_LEGACY; |
| 372 | 446 | ||
| @@ -393,14 +467,43 @@ void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) | |||
| 393 | } | 467 | } |
| 394 | } | 468 | } |
| 395 | 469 | ||
| 470 | /* DCE3+ has an AdjustDisplayPll that will adjust the pixel clock | ||
| 471 | * accordingly based on the encoder/transmitter to work around | ||
| 472 | * special hw requirements. | ||
| 473 | */ | ||
| 474 | if (ASIC_IS_DCE3(rdev)) { | ||
| 475 | ADJUST_DISPLAY_PLL_PS_ALLOCATION adjust_pll_args; | ||
| 476 | |||
| 477 | if (!encoder) | ||
| 478 | return; | ||
| 479 | |||
| 480 | memset(&adjust_pll_args, 0, sizeof(adjust_pll_args)); | ||
| 481 | adjust_pll_args.usPixelClock = cpu_to_le16(mode->clock / 10); | ||
| 482 | adjust_pll_args.ucTransmitterID = radeon_encoder->encoder_id; | ||
| 483 | adjust_pll_args.ucEncodeMode = atombios_get_encoder_mode(encoder); | ||
| 484 | |||
| 485 | index = GetIndexIntoMasterTable(COMMAND, AdjustDisplayPll); | ||
| 486 | atom_execute_table(rdev->mode_info.atom_context, | ||
| 487 | index, (uint32_t *)&adjust_pll_args); | ||
| 488 | adjusted_clock = le16_to_cpu(adjust_pll_args.usPixelClock) * 10; | ||
| 489 | } else { | ||
| 490 | /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */ | ||
| 491 | if (ASIC_IS_AVIVO(rdev) && | ||
| 492 | (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1)) | ||
| 493 | adjusted_clock = mode->clock * 2; | ||
| 494 | else | ||
| 495 | adjusted_clock = mode->clock; | ||
| 496 | } | ||
| 497 | |||
| 396 | if (radeon_crtc->crtc_id == 0) | 498 | if (radeon_crtc->crtc_id == 0) |
| 397 | pll = &rdev->clock.p1pll; | 499 | pll = &rdev->clock.p1pll; |
| 398 | else | 500 | else |
| 399 | pll = &rdev->clock.p2pll; | 501 | pll = &rdev->clock.p2pll; |
| 400 | 502 | ||
| 401 | radeon_compute_pll(pll, mode->clock, &sclock, &fb_div, &frac_fb_div, | 503 | radeon_compute_pll(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, |
| 402 | &ref_div, &post_div, pll_flags); | 504 | &ref_div, &post_div, pll_flags); |
| 403 | 505 | ||
| 506 | index = GetIndexIntoMasterTable(COMMAND, SetPixelClock); | ||
| 404 | atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, | 507 | atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, |
| 405 | &crev); | 508 | &crev); |
| 406 | 509 | ||
| @@ -409,7 +512,7 @@ void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) | |||
| 409 | switch (crev) { | 512 | switch (crev) { |
| 410 | case 1: | 513 | case 1: |
| 411 | spc1_ptr = (PIXEL_CLOCK_PARAMETERS *) & args.sPCLKInput; | 514 | spc1_ptr = (PIXEL_CLOCK_PARAMETERS *) & args.sPCLKInput; |
| 412 | spc1_ptr->usPixelClock = cpu_to_le16(sclock); | 515 | spc1_ptr->usPixelClock = cpu_to_le16(mode->clock / 10); |
| 413 | spc1_ptr->usRefDiv = cpu_to_le16(ref_div); | 516 | spc1_ptr->usRefDiv = cpu_to_le16(ref_div); |
| 414 | spc1_ptr->usFbDiv = cpu_to_le16(fb_div); | 517 | spc1_ptr->usFbDiv = cpu_to_le16(fb_div); |
| 415 | spc1_ptr->ucFracFbDiv = frac_fb_div; | 518 | spc1_ptr->ucFracFbDiv = frac_fb_div; |
| @@ -422,7 +525,7 @@ void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) | |||
| 422 | case 2: | 525 | case 2: |
| 423 | spc2_ptr = | 526 | spc2_ptr = |
| 424 | (PIXEL_CLOCK_PARAMETERS_V2 *) & args.sPCLKInput; | 527 | (PIXEL_CLOCK_PARAMETERS_V2 *) & args.sPCLKInput; |
| 425 | spc2_ptr->usPixelClock = cpu_to_le16(sclock); | 528 | spc2_ptr->usPixelClock = cpu_to_le16(mode->clock / 10); |
| 426 | spc2_ptr->usRefDiv = cpu_to_le16(ref_div); | 529 | spc2_ptr->usRefDiv = cpu_to_le16(ref_div); |
| 427 | spc2_ptr->usFbDiv = cpu_to_le16(fb_div); | 530 | spc2_ptr->usFbDiv = cpu_to_le16(fb_div); |
| 428 | spc2_ptr->ucFracFbDiv = frac_fb_div; | 531 | spc2_ptr->ucFracFbDiv = frac_fb_div; |
| @@ -437,7 +540,7 @@ void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) | |||
| 437 | return; | 540 | return; |
| 438 | spc3_ptr = | 541 | spc3_ptr = |
| 439 | (PIXEL_CLOCK_PARAMETERS_V3 *) & args.sPCLKInput; | 542 | (PIXEL_CLOCK_PARAMETERS_V3 *) & args.sPCLKInput; |
| 440 | spc3_ptr->usPixelClock = cpu_to_le16(sclock); | 543 | spc3_ptr->usPixelClock = cpu_to_le16(mode->clock / 10); |
| 441 | spc3_ptr->usRefDiv = cpu_to_le16(ref_div); | 544 | spc3_ptr->usRefDiv = cpu_to_le16(ref_div); |
| 442 | spc3_ptr->usFbDiv = cpu_to_le16(fb_div); | 545 | spc3_ptr->usFbDiv = cpu_to_le16(fb_div); |
| 443 | spc3_ptr->ucFracFbDiv = frac_fb_div; | 546 | spc3_ptr->ucFracFbDiv = frac_fb_div; |
| @@ -527,6 +630,16 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y, | |||
| 527 | WREG32(AVIVO_D1VGA_CONTROL, 0); | 630 | WREG32(AVIVO_D1VGA_CONTROL, 0); |
| 528 | else | 631 | else |
| 529 | WREG32(AVIVO_D2VGA_CONTROL, 0); | 632 | WREG32(AVIVO_D2VGA_CONTROL, 0); |
| 633 | |||
| 634 | if (rdev->family >= CHIP_RV770) { | ||
| 635 | if (radeon_crtc->crtc_id) { | ||
| 636 | WREG32(R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH, 0); | ||
| 637 | WREG32(R700_D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH, 0); | ||
| 638 | } else { | ||
| 639 | WREG32(R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH, 0); | ||
| 640 | WREG32(R700_D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH, 0); | ||
| 641 | } | ||
| 642 | } | ||
| 530 | WREG32(AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, | 643 | WREG32(AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, |
| 531 | (u32) fb_location); | 644 | (u32) fb_location); |
| 532 | WREG32(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + | 645 | WREG32(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + |
| @@ -563,6 +676,10 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y, | |||
| 563 | radeon_fb = to_radeon_framebuffer(old_fb); | 676 | radeon_fb = to_radeon_framebuffer(old_fb); |
| 564 | radeon_gem_object_unpin(radeon_fb->obj); | 677 | radeon_gem_object_unpin(radeon_fb->obj); |
| 565 | } | 678 | } |
| 679 | |||
| 680 | /* Bytes per pixel may have changed */ | ||
| 681 | radeon_bandwidth_update(rdev); | ||
| 682 | |||
| 566 | return 0; | 683 | return 0; |
| 567 | } | 684 | } |
| 568 | 685 | ||
| @@ -574,134 +691,24 @@ int atombios_crtc_mode_set(struct drm_crtc *crtc, | |||
| 574 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 691 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
| 575 | struct drm_device *dev = crtc->dev; | 692 | struct drm_device *dev = crtc->dev; |
| 576 | struct radeon_device *rdev = dev->dev_private; | 693 | struct radeon_device *rdev = dev->dev_private; |
| 577 | struct drm_encoder *encoder; | ||
| 578 | SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION crtc_timing; | ||
| 579 | int need_tv_timings = 0; | ||
| 580 | bool ret; | ||
| 581 | 694 | ||
| 582 | /* TODO color tiling */ | 695 | /* TODO color tiling */ |
| 583 | memset(&crtc_timing, 0, sizeof(crtc_timing)); | ||
| 584 | |||
| 585 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | ||
| 586 | /* find tv std */ | ||
| 587 | if (encoder->crtc == crtc) { | ||
| 588 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
| 589 | |||
| 590 | if (radeon_encoder->active_device & ATOM_DEVICE_TV_SUPPORT) { | ||
| 591 | struct radeon_encoder_atom_dac *tv_dac = radeon_encoder->enc_priv; | ||
| 592 | if (tv_dac) { | ||
| 593 | if (tv_dac->tv_std == TV_STD_NTSC || | ||
| 594 | tv_dac->tv_std == TV_STD_NTSC_J || | ||
| 595 | tv_dac->tv_std == TV_STD_PAL_M) | ||
| 596 | need_tv_timings = 1; | ||
| 597 | else | ||
| 598 | need_tv_timings = 2; | ||
| 599 | break; | ||
| 600 | } | ||
| 601 | } | ||
| 602 | } | ||
| 603 | } | ||
| 604 | |||
| 605 | crtc_timing.ucCRTC = radeon_crtc->crtc_id; | ||
| 606 | if (need_tv_timings) { | ||
| 607 | ret = radeon_atom_get_tv_timings(rdev, need_tv_timings - 1, | ||
| 608 | &crtc_timing, &adjusted_mode->clock); | ||
| 609 | if (ret == false) | ||
| 610 | need_tv_timings = 0; | ||
| 611 | } | ||
| 612 | |||
| 613 | if (!need_tv_timings) { | ||
| 614 | crtc_timing.usH_Total = adjusted_mode->crtc_htotal; | ||
| 615 | crtc_timing.usH_Disp = adjusted_mode->crtc_hdisplay; | ||
| 616 | crtc_timing.usH_SyncStart = adjusted_mode->crtc_hsync_start; | ||
| 617 | crtc_timing.usH_SyncWidth = | ||
| 618 | adjusted_mode->crtc_hsync_end - adjusted_mode->crtc_hsync_start; | ||
| 619 | |||
| 620 | crtc_timing.usV_Total = adjusted_mode->crtc_vtotal; | ||
| 621 | crtc_timing.usV_Disp = adjusted_mode->crtc_vdisplay; | ||
| 622 | crtc_timing.usV_SyncStart = adjusted_mode->crtc_vsync_start; | ||
| 623 | crtc_timing.usV_SyncWidth = | ||
| 624 | adjusted_mode->crtc_vsync_end - adjusted_mode->crtc_vsync_start; | ||
| 625 | |||
| 626 | if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) | ||
| 627 | crtc_timing.susModeMiscInfo.usAccess |= ATOM_VSYNC_POLARITY; | ||
| 628 | |||
| 629 | if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) | ||
| 630 | crtc_timing.susModeMiscInfo.usAccess |= ATOM_HSYNC_POLARITY; | ||
| 631 | |||
| 632 | if (adjusted_mode->flags & DRM_MODE_FLAG_CSYNC) | ||
| 633 | crtc_timing.susModeMiscInfo.usAccess |= ATOM_COMPOSITESYNC; | ||
| 634 | |||
| 635 | if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) | ||
| 636 | crtc_timing.susModeMiscInfo.usAccess |= ATOM_INTERLACE; | ||
| 637 | |||
| 638 | if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) | ||
| 639 | crtc_timing.susModeMiscInfo.usAccess |= ATOM_DOUBLE_CLOCK_MODE; | ||
| 640 | } | ||
| 641 | 696 | ||
| 697 | atombios_set_ss(crtc, 0); | ||
| 642 | atombios_crtc_set_pll(crtc, adjusted_mode); | 698 | atombios_crtc_set_pll(crtc, adjusted_mode); |
| 643 | atombios_crtc_set_timing(crtc, &crtc_timing); | 699 | atombios_set_ss(crtc, 1); |
| 700 | atombios_crtc_set_timing(crtc, adjusted_mode); | ||
| 644 | 701 | ||
| 645 | if (ASIC_IS_AVIVO(rdev)) | 702 | if (ASIC_IS_AVIVO(rdev)) |
| 646 | atombios_crtc_set_base(crtc, x, y, old_fb); | 703 | atombios_crtc_set_base(crtc, x, y, old_fb); |
| 647 | else { | 704 | else { |
| 648 | if (radeon_crtc->crtc_id == 0) { | 705 | if (radeon_crtc->crtc_id == 0) |
| 649 | SET_CRTC_USING_DTD_TIMING_PARAMETERS crtc_dtd_timing; | 706 | atombios_set_crtc_dtd_timing(crtc, adjusted_mode); |
| 650 | memset(&crtc_dtd_timing, 0, sizeof(crtc_dtd_timing)); | ||
| 651 | |||
| 652 | /* setup FP shadow regs on R4xx */ | ||
| 653 | crtc_dtd_timing.ucCRTC = radeon_crtc->crtc_id; | ||
| 654 | crtc_dtd_timing.usH_Size = adjusted_mode->crtc_hdisplay; | ||
| 655 | crtc_dtd_timing.usV_Size = adjusted_mode->crtc_vdisplay; | ||
| 656 | crtc_dtd_timing.usH_Blanking_Time = | ||
| 657 | adjusted_mode->crtc_hblank_end - | ||
| 658 | adjusted_mode->crtc_hdisplay; | ||
| 659 | crtc_dtd_timing.usV_Blanking_Time = | ||
| 660 | adjusted_mode->crtc_vblank_end - | ||
| 661 | adjusted_mode->crtc_vdisplay; | ||
| 662 | crtc_dtd_timing.usH_SyncOffset = | ||
| 663 | adjusted_mode->crtc_hsync_start - | ||
| 664 | adjusted_mode->crtc_hdisplay; | ||
| 665 | crtc_dtd_timing.usV_SyncOffset = | ||
| 666 | adjusted_mode->crtc_vsync_start - | ||
| 667 | adjusted_mode->crtc_vdisplay; | ||
| 668 | crtc_dtd_timing.usH_SyncWidth = | ||
| 669 | adjusted_mode->crtc_hsync_end - | ||
| 670 | adjusted_mode->crtc_hsync_start; | ||
| 671 | crtc_dtd_timing.usV_SyncWidth = | ||
| 672 | adjusted_mode->crtc_vsync_end - | ||
| 673 | adjusted_mode->crtc_vsync_start; | ||
| 674 | /* crtc_dtd_timing.ucH_Border = adjusted_mode->crtc_hborder; */ | ||
| 675 | /* crtc_dtd_timing.ucV_Border = adjusted_mode->crtc_vborder; */ | ||
| 676 | |||
| 677 | if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) | ||
| 678 | crtc_dtd_timing.susModeMiscInfo.usAccess |= | ||
| 679 | ATOM_VSYNC_POLARITY; | ||
| 680 | |||
| 681 | if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) | ||
| 682 | crtc_dtd_timing.susModeMiscInfo.usAccess |= | ||
| 683 | ATOM_HSYNC_POLARITY; | ||
| 684 | |||
| 685 | if (adjusted_mode->flags & DRM_MODE_FLAG_CSYNC) | ||
| 686 | crtc_dtd_timing.susModeMiscInfo.usAccess |= | ||
| 687 | ATOM_COMPOSITESYNC; | ||
| 688 | |||
| 689 | if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) | ||
| 690 | crtc_dtd_timing.susModeMiscInfo.usAccess |= | ||
| 691 | ATOM_INTERLACE; | ||
| 692 | |||
| 693 | if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) | ||
| 694 | crtc_dtd_timing.susModeMiscInfo.usAccess |= | ||
| 695 | ATOM_DOUBLE_CLOCK_MODE; | ||
| 696 | |||
| 697 | atombios_set_crtc_dtd_timing(crtc, &crtc_dtd_timing); | ||
| 698 | } | ||
| 699 | radeon_crtc_set_base(crtc, x, y, old_fb); | 707 | radeon_crtc_set_base(crtc, x, y, old_fb); |
| 700 | radeon_legacy_atom_set_surface(crtc); | 708 | radeon_legacy_atom_set_surface(crtc); |
| 701 | } | 709 | } |
| 702 | atombios_overscan_setup(crtc, mode, adjusted_mode); | 710 | atombios_overscan_setup(crtc, mode, adjusted_mode); |
| 703 | atombios_scaler_setup(crtc); | 711 | atombios_scaler_setup(crtc); |
| 704 | radeon_bandwidth_update(rdev); | ||
| 705 | return 0; | 712 | return 0; |
| 706 | } | 713 | } |
| 707 | 714 | ||
diff --git a/drivers/gpu/drm/radeon/mkregtable.c b/drivers/gpu/drm/radeon/mkregtable.c index fb211e585dea..0d79577c1576 100644 --- a/drivers/gpu/drm/radeon/mkregtable.c +++ b/drivers/gpu/drm/radeon/mkregtable.c | |||
| @@ -561,7 +561,7 @@ struct table { | |||
| 561 | char *gpu_prefix; | 561 | char *gpu_prefix; |
| 562 | }; | 562 | }; |
| 563 | 563 | ||
| 564 | struct offset *offset_new(unsigned o) | 564 | static struct offset *offset_new(unsigned o) |
| 565 | { | 565 | { |
| 566 | struct offset *offset; | 566 | struct offset *offset; |
| 567 | 567 | ||
| @@ -573,12 +573,12 @@ struct offset *offset_new(unsigned o) | |||
| 573 | return offset; | 573 | return offset; |
| 574 | } | 574 | } |
| 575 | 575 | ||
| 576 | void table_offset_add(struct table *t, struct offset *offset) | 576 | static void table_offset_add(struct table *t, struct offset *offset) |
| 577 | { | 577 | { |
| 578 | list_add_tail(&offset->list, &t->offsets); | 578 | list_add_tail(&offset->list, &t->offsets); |
| 579 | } | 579 | } |
| 580 | 580 | ||
| 581 | void table_init(struct table *t) | 581 | static void table_init(struct table *t) |
| 582 | { | 582 | { |
| 583 | INIT_LIST_HEAD(&t->offsets); | 583 | INIT_LIST_HEAD(&t->offsets); |
| 584 | t->offset_max = 0; | 584 | t->offset_max = 0; |
| @@ -586,7 +586,7 @@ void table_init(struct table *t) | |||
| 586 | t->table = NULL; | 586 | t->table = NULL; |
| 587 | } | 587 | } |
| 588 | 588 | ||
| 589 | void table_print(struct table *t) | 589 | static void table_print(struct table *t) |
| 590 | { | 590 | { |
| 591 | unsigned nlloop, i, j, n, c, id; | 591 | unsigned nlloop, i, j, n, c, id; |
| 592 | 592 | ||
| @@ -611,7 +611,7 @@ void table_print(struct table *t) | |||
| 611 | printf("};\n"); | 611 | printf("};\n"); |
| 612 | } | 612 | } |
| 613 | 613 | ||
| 614 | int table_build(struct table *t) | 614 | static int table_build(struct table *t) |
| 615 | { | 615 | { |
| 616 | struct offset *offset; | 616 | struct offset *offset; |
| 617 | unsigned i, m; | 617 | unsigned i, m; |
| @@ -631,7 +631,7 @@ int table_build(struct table *t) | |||
| 631 | } | 631 | } |
| 632 | 632 | ||
| 633 | static char gpu_name[10]; | 633 | static char gpu_name[10]; |
| 634 | int parser_auth(struct table *t, const char *filename) | 634 | static int parser_auth(struct table *t, const char *filename) |
| 635 | { | 635 | { |
| 636 | FILE *file; | 636 | FILE *file; |
| 637 | regex_t mask_rex; | 637 | regex_t mask_rex; |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 161094c07d94..c9e93eabcf16 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
| @@ -186,7 +186,7 @@ static inline uint32_t r100_irq_ack(struct radeon_device *rdev) | |||
| 186 | 186 | ||
| 187 | int r100_irq_process(struct radeon_device *rdev) | 187 | int r100_irq_process(struct radeon_device *rdev) |
| 188 | { | 188 | { |
| 189 | uint32_t status; | 189 | uint32_t status, msi_rearm; |
| 190 | 190 | ||
| 191 | status = r100_irq_ack(rdev); | 191 | status = r100_irq_ack(rdev); |
| 192 | if (!status) { | 192 | if (!status) { |
| @@ -209,6 +209,21 @@ int r100_irq_process(struct radeon_device *rdev) | |||
| 209 | } | 209 | } |
| 210 | status = r100_irq_ack(rdev); | 210 | status = r100_irq_ack(rdev); |
| 211 | } | 211 | } |
| 212 | if (rdev->msi_enabled) { | ||
| 213 | switch (rdev->family) { | ||
| 214 | case CHIP_RS400: | ||
| 215 | case CHIP_RS480: | ||
| 216 | msi_rearm = RREG32(RADEON_AIC_CNTL) & ~RS400_MSI_REARM; | ||
| 217 | WREG32(RADEON_AIC_CNTL, msi_rearm); | ||
| 218 | WREG32(RADEON_AIC_CNTL, msi_rearm | RS400_MSI_REARM); | ||
| 219 | break; | ||
| 220 | default: | ||
| 221 | msi_rearm = RREG32(RADEON_MSI_REARM_EN) & ~RV370_MSI_REARM_EN; | ||
| 222 | WREG32(RADEON_MSI_REARM_EN, msi_rearm); | ||
| 223 | WREG32(RADEON_MSI_REARM_EN, msi_rearm | RV370_MSI_REARM_EN); | ||
| 224 | break; | ||
| 225 | } | ||
| 226 | } | ||
| 212 | return IRQ_HANDLED; | 227 | return IRQ_HANDLED; |
| 213 | } | 228 | } |
| 214 | 229 | ||
| @@ -240,7 +255,7 @@ int r100_wb_init(struct radeon_device *rdev) | |||
| 240 | int r; | 255 | int r; |
| 241 | 256 | ||
| 242 | if (rdev->wb.wb_obj == NULL) { | 257 | if (rdev->wb.wb_obj == NULL) { |
| 243 | r = radeon_object_create(rdev, NULL, 4096, | 258 | r = radeon_object_create(rdev, NULL, RADEON_GPU_PAGE_SIZE, |
| 244 | true, | 259 | true, |
| 245 | RADEON_GEM_DOMAIN_GTT, | 260 | RADEON_GEM_DOMAIN_GTT, |
| 246 | false, &rdev->wb.wb_obj); | 261 | false, &rdev->wb.wb_obj); |
| @@ -563,19 +578,19 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) | |||
| 563 | indirect1_start = 16; | 578 | indirect1_start = 16; |
| 564 | /* cp setup */ | 579 | /* cp setup */ |
| 565 | WREG32(0x718, pre_write_timer | (pre_write_limit << 28)); | 580 | WREG32(0x718, pre_write_timer | (pre_write_limit << 28)); |
| 566 | WREG32(RADEON_CP_RB_CNTL, | 581 | tmp = (REG_SET(RADEON_RB_BUFSZ, rb_bufsz) | |
| 567 | #ifdef __BIG_ENDIAN | ||
| 568 | RADEON_BUF_SWAP_32BIT | | ||
| 569 | #endif | ||
| 570 | REG_SET(RADEON_RB_BUFSZ, rb_bufsz) | | ||
| 571 | REG_SET(RADEON_RB_BLKSZ, rb_blksz) | | 582 | REG_SET(RADEON_RB_BLKSZ, rb_blksz) | |
| 572 | REG_SET(RADEON_MAX_FETCH, max_fetch) | | 583 | REG_SET(RADEON_MAX_FETCH, max_fetch) | |
| 573 | RADEON_RB_NO_UPDATE); | 584 | RADEON_RB_NO_UPDATE); |
| 585 | #ifdef __BIG_ENDIAN | ||
| 586 | tmp |= RADEON_BUF_SWAP_32BIT; | ||
| 587 | #endif | ||
| 588 | WREG32(RADEON_CP_RB_CNTL, tmp); | ||
| 589 | |||
| 574 | /* Set ring address */ | 590 | /* Set ring address */ |
| 575 | DRM_INFO("radeon: ring at 0x%016lX\n", (unsigned long)rdev->cp.gpu_addr); | 591 | DRM_INFO("radeon: ring at 0x%016lX\n", (unsigned long)rdev->cp.gpu_addr); |
| 576 | WREG32(RADEON_CP_RB_BASE, rdev->cp.gpu_addr); | 592 | WREG32(RADEON_CP_RB_BASE, rdev->cp.gpu_addr); |
| 577 | /* Force read & write ptr to 0 */ | 593 | /* Force read & write ptr to 0 */ |
| 578 | tmp = RREG32(RADEON_CP_RB_CNTL); | ||
| 579 | WREG32(RADEON_CP_RB_CNTL, tmp | RADEON_RB_RPTR_WR_ENA); | 594 | WREG32(RADEON_CP_RB_CNTL, tmp | RADEON_RB_RPTR_WR_ENA); |
| 580 | WREG32(RADEON_CP_RB_RPTR_WR, 0); | 595 | WREG32(RADEON_CP_RB_RPTR_WR, 0); |
| 581 | WREG32(RADEON_CP_RB_WPTR, 0); | 596 | WREG32(RADEON_CP_RB_WPTR, 0); |
| @@ -2364,7 +2379,7 @@ void r100_bandwidth_update(struct radeon_device *rdev) | |||
| 2364 | /* | 2379 | /* |
| 2365 | Find the total latency for the display data. | 2380 | Find the total latency for the display data. |
| 2366 | */ | 2381 | */ |
| 2367 | disp_latency_overhead.full = rfixed_const(80); | 2382 | disp_latency_overhead.full = rfixed_const(8); |
| 2368 | disp_latency_overhead.full = rfixed_div(disp_latency_overhead, sclk_ff); | 2383 | disp_latency_overhead.full = rfixed_div(disp_latency_overhead, sclk_ff); |
| 2369 | mc_latency_mclk.full += disp_latency_overhead.full + cur_latency_mclk.full; | 2384 | mc_latency_mclk.full += disp_latency_overhead.full + cur_latency_mclk.full; |
| 2370 | mc_latency_sclk.full += disp_latency_overhead.full + cur_latency_sclk.full; | 2385 | mc_latency_sclk.full += disp_latency_overhead.full + cur_latency_sclk.full; |
| @@ -2562,8 +2577,11 @@ void r100_bandwidth_update(struct radeon_device *rdev) | |||
| 2562 | static inline void r100_cs_track_texture_print(struct r100_cs_track_texture *t) | 2577 | static inline void r100_cs_track_texture_print(struct r100_cs_track_texture *t) |
| 2563 | { | 2578 | { |
| 2564 | DRM_ERROR("pitch %d\n", t->pitch); | 2579 | DRM_ERROR("pitch %d\n", t->pitch); |
| 2580 | DRM_ERROR("use_pitch %d\n", t->use_pitch); | ||
| 2565 | DRM_ERROR("width %d\n", t->width); | 2581 | DRM_ERROR("width %d\n", t->width); |
| 2582 | DRM_ERROR("width_11 %d\n", t->width_11); | ||
| 2566 | DRM_ERROR("height %d\n", t->height); | 2583 | DRM_ERROR("height %d\n", t->height); |
| 2584 | DRM_ERROR("height_11 %d\n", t->height_11); | ||
| 2567 | DRM_ERROR("num levels %d\n", t->num_levels); | 2585 | DRM_ERROR("num levels %d\n", t->num_levels); |
| 2568 | DRM_ERROR("depth %d\n", t->txdepth); | 2586 | DRM_ERROR("depth %d\n", t->txdepth); |
| 2569 | DRM_ERROR("bpp %d\n", t->cpp); | 2587 | DRM_ERROR("bpp %d\n", t->cpp); |
| @@ -2623,15 +2641,17 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev, | |||
| 2623 | else | 2641 | else |
| 2624 | w = track->textures[u].pitch / (1 << i); | 2642 | w = track->textures[u].pitch / (1 << i); |
| 2625 | } else { | 2643 | } else { |
| 2626 | w = track->textures[u].width / (1 << i); | 2644 | w = track->textures[u].width; |
| 2627 | if (rdev->family >= CHIP_RV515) | 2645 | if (rdev->family >= CHIP_RV515) |
| 2628 | w |= track->textures[u].width_11; | 2646 | w |= track->textures[u].width_11; |
| 2647 | w = w / (1 << i); | ||
| 2629 | if (track->textures[u].roundup_w) | 2648 | if (track->textures[u].roundup_w) |
| 2630 | w = roundup_pow_of_two(w); | 2649 | w = roundup_pow_of_two(w); |
| 2631 | } | 2650 | } |
| 2632 | h = track->textures[u].height / (1 << i); | 2651 | h = track->textures[u].height; |
| 2633 | if (rdev->family >= CHIP_RV515) | 2652 | if (rdev->family >= CHIP_RV515) |
| 2634 | h |= track->textures[u].height_11; | 2653 | h |= track->textures[u].height_11; |
| 2654 | h = h / (1 << i); | ||
| 2635 | if (track->textures[u].roundup_h) | 2655 | if (track->textures[u].roundup_h) |
| 2636 | h = roundup_pow_of_two(h); | 2656 | h = roundup_pow_of_two(h); |
| 2637 | size += w * h; | 2657 | size += w * h; |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index e08c4a8974ca..2f43ee8e4048 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
| @@ -113,7 +113,7 @@ int rv370_pcie_gart_enable(struct radeon_device *rdev) | |||
| 113 | tmp = RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_DISCARD; | 113 | tmp = RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_DISCARD; |
| 114 | WREG32_PCIE(RADEON_PCIE_TX_GART_CNTL, tmp); | 114 | WREG32_PCIE(RADEON_PCIE_TX_GART_CNTL, tmp); |
| 115 | WREG32_PCIE(RADEON_PCIE_TX_GART_START_LO, rdev->mc.gtt_location); | 115 | WREG32_PCIE(RADEON_PCIE_TX_GART_START_LO, rdev->mc.gtt_location); |
| 116 | tmp = rdev->mc.gtt_location + rdev->mc.gtt_size - 4096; | 116 | tmp = rdev->mc.gtt_location + rdev->mc.gtt_size - RADEON_GPU_PAGE_SIZE; |
| 117 | WREG32_PCIE(RADEON_PCIE_TX_GART_END_LO, tmp); | 117 | WREG32_PCIE(RADEON_PCIE_TX_GART_END_LO, tmp); |
| 118 | WREG32_PCIE(RADEON_PCIE_TX_GART_START_HI, 0); | 118 | WREG32_PCIE(RADEON_PCIE_TX_GART_START_HI, 0); |
| 119 | WREG32_PCIE(RADEON_PCIE_TX_GART_END_HI, 0); | 119 | WREG32_PCIE(RADEON_PCIE_TX_GART_END_HI, 0); |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 5c7fe52de30e..1cefdbcc0850 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
| @@ -311,6 +311,8 @@ int r420_init(struct radeon_device *rdev) | |||
| 311 | } | 311 | } |
| 312 | /* Initialize clocks */ | 312 | /* Initialize clocks */ |
| 313 | radeon_get_clock_info(rdev->ddev); | 313 | radeon_get_clock_info(rdev->ddev); |
| 314 | /* Initialize power management */ | ||
| 315 | radeon_pm_init(rdev); | ||
| 314 | /* Get vram informations */ | 316 | /* Get vram informations */ |
| 315 | r300_vram_info(rdev); | 317 | r300_vram_info(rdev); |
| 316 | /* Initialize memory controller (also test AGP) */ | 318 | /* Initialize memory controller (also test AGP) */ |
diff --git a/drivers/gpu/drm/radeon/r500_reg.h b/drivers/gpu/drm/radeon/r500_reg.h index 868add6e166d..7baa73955563 100644 --- a/drivers/gpu/drm/radeon/r500_reg.h +++ b/drivers/gpu/drm/radeon/r500_reg.h | |||
| @@ -384,9 +384,16 @@ | |||
| 384 | # define AVIVO_D1GRPH_TILED (1 << 20) | 384 | # define AVIVO_D1GRPH_TILED (1 << 20) |
| 385 | # define AVIVO_D1GRPH_MACRO_ADDRESS_MODE (1 << 21) | 385 | # define AVIVO_D1GRPH_MACRO_ADDRESS_MODE (1 << 21) |
| 386 | 386 | ||
| 387 | /* The R7xx *_HIGH surface regs are backwards; the D1 regs are in the D2 | ||
| 388 | * block and vice versa. This applies to GRPH, CUR, etc. | ||
| 389 | */ | ||
| 387 | #define AVIVO_D1GRPH_LUT_SEL 0x6108 | 390 | #define AVIVO_D1GRPH_LUT_SEL 0x6108 |
| 388 | #define AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS 0x6110 | 391 | #define AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS 0x6110 |
| 392 | #define R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6914 | ||
| 393 | #define R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6114 | ||
| 389 | #define AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS 0x6118 | 394 | #define AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS 0x6118 |
| 395 | #define R700_D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x691c | ||
| 396 | #define R700_D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x611c | ||
| 390 | #define AVIVO_D1GRPH_PITCH 0x6120 | 397 | #define AVIVO_D1GRPH_PITCH 0x6120 |
| 391 | #define AVIVO_D1GRPH_SURFACE_OFFSET_X 0x6124 | 398 | #define AVIVO_D1GRPH_SURFACE_OFFSET_X 0x6124 |
| 392 | #define AVIVO_D1GRPH_SURFACE_OFFSET_Y 0x6128 | 399 | #define AVIVO_D1GRPH_SURFACE_OFFSET_Y 0x6128 |
| @@ -404,6 +411,8 @@ | |||
| 404 | # define AVIVO_D1CURSOR_MODE_MASK (3 << 8) | 411 | # define AVIVO_D1CURSOR_MODE_MASK (3 << 8) |
| 405 | # define AVIVO_D1CURSOR_MODE_24BPP 2 | 412 | # define AVIVO_D1CURSOR_MODE_24BPP 2 |
| 406 | #define AVIVO_D1CUR_SURFACE_ADDRESS 0x6408 | 413 | #define AVIVO_D1CUR_SURFACE_ADDRESS 0x6408 |
| 414 | #define R700_D1CUR_SURFACE_ADDRESS_HIGH 0x6c0c | ||
| 415 | #define R700_D2CUR_SURFACE_ADDRESS_HIGH 0x640c | ||
| 407 | #define AVIVO_D1CUR_SIZE 0x6410 | 416 | #define AVIVO_D1CUR_SIZE 0x6410 |
| 408 | #define AVIVO_D1CUR_POSITION 0x6414 | 417 | #define AVIVO_D1CUR_POSITION 0x6414 |
| 409 | #define AVIVO_D1CUR_HOT_SPOT 0x6418 | 418 | #define AVIVO_D1CUR_HOT_SPOT 0x6418 |
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c index a555b7b19b48..f7435185c0a6 100644 --- a/drivers/gpu/drm/radeon/r520.c +++ b/drivers/gpu/drm/radeon/r520.c | |||
| @@ -260,6 +260,8 @@ int r520_init(struct radeon_device *rdev) | |||
| 260 | } | 260 | } |
| 261 | /* Initialize clocks */ | 261 | /* Initialize clocks */ |
| 262 | radeon_get_clock_info(rdev->ddev); | 262 | radeon_get_clock_info(rdev->ddev); |
| 263 | /* Initialize power management */ | ||
| 264 | radeon_pm_init(rdev); | ||
| 263 | /* Get vram informations */ | 265 | /* Get vram informations */ |
| 264 | r520_vram_info(rdev); | 266 | r520_vram_info(rdev); |
| 265 | /* Initialize memory controller (also test AGP) */ | 267 | /* Initialize memory controller (also test AGP) */ |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 609719490ec2..278f646bc18e 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -339,11 +339,10 @@ int r600_mc_init(struct radeon_device *rdev) | |||
| 339 | { | 339 | { |
| 340 | fixed20_12 a; | 340 | fixed20_12 a; |
| 341 | u32 tmp; | 341 | u32 tmp; |
| 342 | int chansize; | 342 | int chansize, numchan; |
| 343 | int r; | 343 | int r; |
| 344 | 344 | ||
| 345 | /* Get VRAM informations */ | 345 | /* Get VRAM informations */ |
| 346 | rdev->mc.vram_width = 128; | ||
| 347 | rdev->mc.vram_is_ddr = true; | 346 | rdev->mc.vram_is_ddr = true; |
| 348 | tmp = RREG32(RAMCFG); | 347 | tmp = RREG32(RAMCFG); |
| 349 | if (tmp & CHANSIZE_OVERRIDE) { | 348 | if (tmp & CHANSIZE_OVERRIDE) { |
| @@ -353,17 +352,23 @@ int r600_mc_init(struct radeon_device *rdev) | |||
| 353 | } else { | 352 | } else { |
| 354 | chansize = 32; | 353 | chansize = 32; |
| 355 | } | 354 | } |
| 356 | if (rdev->family == CHIP_R600) { | 355 | tmp = RREG32(CHMAP); |
| 357 | rdev->mc.vram_width = 8 * chansize; | 356 | switch ((tmp & NOOFCHAN_MASK) >> NOOFCHAN_SHIFT) { |
| 358 | } else if (rdev->family == CHIP_RV670) { | 357 | case 0: |
| 359 | rdev->mc.vram_width = 4 * chansize; | 358 | default: |
| 360 | } else if ((rdev->family == CHIP_RV610) || | 359 | numchan = 1; |
| 361 | (rdev->family == CHIP_RV620)) { | 360 | break; |
| 362 | rdev->mc.vram_width = chansize; | 361 | case 1: |
| 363 | } else if ((rdev->family == CHIP_RV630) || | 362 | numchan = 2; |
| 364 | (rdev->family == CHIP_RV635)) { | 363 | break; |
| 365 | rdev->mc.vram_width = 2 * chansize; | 364 | case 2: |
| 365 | numchan = 4; | ||
| 366 | break; | ||
| 367 | case 3: | ||
| 368 | numchan = 8; | ||
| 369 | break; | ||
| 366 | } | 370 | } |
| 371 | rdev->mc.vram_width = numchan * chansize; | ||
| 367 | /* Could aper size report 0 ? */ | 372 | /* Could aper size report 0 ? */ |
| 368 | rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0); | 373 | rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0); |
| 369 | rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0); | 374 | rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0); |
| @@ -404,35 +409,29 @@ int r600_mc_init(struct radeon_device *rdev) | |||
| 404 | rdev->mc.gtt_location = rdev->mc.mc_vram_size; | 409 | rdev->mc.gtt_location = rdev->mc.mc_vram_size; |
| 405 | } | 410 | } |
| 406 | } else { | 411 | } else { |
| 407 | if (rdev->family == CHIP_RS780 || rdev->family == CHIP_RS880) { | 412 | rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; |
| 408 | rdev->mc.vram_location = (RREG32(MC_VM_FB_LOCATION) & | 413 | rdev->mc.vram_location = (RREG32(MC_VM_FB_LOCATION) & |
| 409 | 0xFFFF) << 24; | 414 | 0xFFFF) << 24; |
| 410 | rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; | 415 | tmp = rdev->mc.vram_location + rdev->mc.mc_vram_size; |
| 411 | tmp = rdev->mc.vram_location + rdev->mc.mc_vram_size; | 416 | if ((0xFFFFFFFFUL - tmp) >= rdev->mc.gtt_size) { |
| 412 | if ((0xFFFFFFFFUL - tmp) >= rdev->mc.gtt_size) { | 417 | /* Enough place after vram */ |
| 413 | /* Enough place after vram */ | 418 | rdev->mc.gtt_location = tmp; |
| 414 | rdev->mc.gtt_location = tmp; | 419 | } else if (rdev->mc.vram_location >= rdev->mc.gtt_size) { |
| 415 | } else if (rdev->mc.vram_location >= rdev->mc.gtt_size) { | 420 | /* Enough place before vram */ |
| 416 | /* Enough place before vram */ | 421 | rdev->mc.gtt_location = 0; |
| 422 | } else { | ||
| 423 | /* Not enough place after or before shrink | ||
| 424 | * gart size | ||
| 425 | */ | ||
| 426 | if (rdev->mc.vram_location > (0xFFFFFFFFUL - tmp)) { | ||
| 417 | rdev->mc.gtt_location = 0; | 427 | rdev->mc.gtt_location = 0; |
| 428 | rdev->mc.gtt_size = rdev->mc.vram_location; | ||
| 418 | } else { | 429 | } else { |
| 419 | /* Not enough place after or before shrink | 430 | rdev->mc.gtt_location = tmp; |
| 420 | * gart size | 431 | rdev->mc.gtt_size = 0xFFFFFFFFUL - tmp; |
| 421 | */ | ||
| 422 | if (rdev->mc.vram_location > (0xFFFFFFFFUL - tmp)) { | ||
| 423 | rdev->mc.gtt_location = 0; | ||
| 424 | rdev->mc.gtt_size = rdev->mc.vram_location; | ||
| 425 | } else { | ||
| 426 | rdev->mc.gtt_location = tmp; | ||
| 427 | rdev->mc.gtt_size = 0xFFFFFFFFUL - tmp; | ||
| 428 | } | ||
| 429 | } | 432 | } |
| 430 | rdev->mc.gtt_location = rdev->mc.mc_vram_size; | ||
| 431 | } else { | ||
| 432 | rdev->mc.vram_location = 0x00000000UL; | ||
| 433 | rdev->mc.gtt_location = rdev->mc.mc_vram_size; | ||
| 434 | rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; | ||
| 435 | } | 433 | } |
| 434 | rdev->mc.gtt_location = rdev->mc.mc_vram_size; | ||
| 436 | } | 435 | } |
| 437 | rdev->mc.vram_start = rdev->mc.vram_location; | 436 | rdev->mc.vram_start = rdev->mc.vram_location; |
| 438 | rdev->mc.vram_end = rdev->mc.vram_location + rdev->mc.mc_vram_size - 1; | 437 | rdev->mc.vram_end = rdev->mc.vram_location + rdev->mc.mc_vram_size - 1; |
| @@ -859,7 +858,8 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
| 859 | ((rdev->family) == CHIP_RV630) || | 858 | ((rdev->family) == CHIP_RV630) || |
| 860 | ((rdev->family) == CHIP_RV610) || | 859 | ((rdev->family) == CHIP_RV610) || |
| 861 | ((rdev->family) == CHIP_RV620) || | 860 | ((rdev->family) == CHIP_RV620) || |
| 862 | ((rdev->family) == CHIP_RS780)) { | 861 | ((rdev->family) == CHIP_RS780) || |
| 862 | ((rdev->family) == CHIP_RS880)) { | ||
| 863 | WREG32(DB_DEBUG, PREZ_MUST_WAIT_FOR_POSTZ_DONE); | 863 | WREG32(DB_DEBUG, PREZ_MUST_WAIT_FOR_POSTZ_DONE); |
| 864 | } else { | 864 | } else { |
| 865 | WREG32(DB_DEBUG, 0); | 865 | WREG32(DB_DEBUG, 0); |
| @@ -876,7 +876,8 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
| 876 | tmp = RREG32(SQ_MS_FIFO_SIZES); | 876 | tmp = RREG32(SQ_MS_FIFO_SIZES); |
| 877 | if (((rdev->family) == CHIP_RV610) || | 877 | if (((rdev->family) == CHIP_RV610) || |
| 878 | ((rdev->family) == CHIP_RV620) || | 878 | ((rdev->family) == CHIP_RV620) || |
| 879 | ((rdev->family) == CHIP_RS780)) { | 879 | ((rdev->family) == CHIP_RS780) || |
| 880 | ((rdev->family) == CHIP_RS880)) { | ||
| 880 | tmp = (CACHE_FIFO_SIZE(0xa) | | 881 | tmp = (CACHE_FIFO_SIZE(0xa) | |
| 881 | FETCH_FIFO_HIWATER(0xa) | | 882 | FETCH_FIFO_HIWATER(0xa) | |
| 882 | DONE_FIFO_HIWATER(0xe0) | | 883 | DONE_FIFO_HIWATER(0xe0) | |
| @@ -919,7 +920,8 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
| 919 | NUM_ES_STACK_ENTRIES(0)); | 920 | NUM_ES_STACK_ENTRIES(0)); |
| 920 | } else if (((rdev->family) == CHIP_RV610) || | 921 | } else if (((rdev->family) == CHIP_RV610) || |
| 921 | ((rdev->family) == CHIP_RV620) || | 922 | ((rdev->family) == CHIP_RV620) || |
| 922 | ((rdev->family) == CHIP_RS780)) { | 923 | ((rdev->family) == CHIP_RS780) || |
| 924 | ((rdev->family) == CHIP_RS880)) { | ||
| 923 | /* no vertex cache */ | 925 | /* no vertex cache */ |
| 924 | sq_config &= ~VC_ENABLE; | 926 | sq_config &= ~VC_ENABLE; |
| 925 | 927 | ||
| @@ -976,7 +978,8 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
| 976 | 978 | ||
| 977 | if (((rdev->family) == CHIP_RV610) || | 979 | if (((rdev->family) == CHIP_RV610) || |
| 978 | ((rdev->family) == CHIP_RV620) || | 980 | ((rdev->family) == CHIP_RV620) || |
| 979 | ((rdev->family) == CHIP_RS780)) { | 981 | ((rdev->family) == CHIP_RS780) || |
| 982 | ((rdev->family) == CHIP_RS880)) { | ||
| 980 | WREG32(VGT_CACHE_INVALIDATION, CACHE_INVALIDATION(TC_ONLY)); | 983 | WREG32(VGT_CACHE_INVALIDATION, CACHE_INVALIDATION(TC_ONLY)); |
| 981 | } else { | 984 | } else { |
| 982 | WREG32(VGT_CACHE_INVALIDATION, CACHE_INVALIDATION(VC_AND_TC)); | 985 | WREG32(VGT_CACHE_INVALIDATION, CACHE_INVALIDATION(VC_AND_TC)); |
| @@ -1002,8 +1005,9 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
| 1002 | tmp = rdev->config.r600.max_pipes * 16; | 1005 | tmp = rdev->config.r600.max_pipes * 16; |
| 1003 | switch (rdev->family) { | 1006 | switch (rdev->family) { |
| 1004 | case CHIP_RV610: | 1007 | case CHIP_RV610: |
| 1005 | case CHIP_RS780: | ||
| 1006 | case CHIP_RV620: | 1008 | case CHIP_RV620: |
| 1009 | case CHIP_RS780: | ||
| 1010 | case CHIP_RS880: | ||
| 1007 | tmp += 32; | 1011 | tmp += 32; |
| 1008 | break; | 1012 | break; |
| 1009 | case CHIP_RV670: | 1013 | case CHIP_RV670: |
| @@ -1044,8 +1048,9 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
| 1044 | 1048 | ||
| 1045 | switch (rdev->family) { | 1049 | switch (rdev->family) { |
| 1046 | case CHIP_RV610: | 1050 | case CHIP_RV610: |
| 1047 | case CHIP_RS780: | ||
| 1048 | case CHIP_RV620: | 1051 | case CHIP_RV620: |
| 1052 | case CHIP_RS780: | ||
| 1053 | case CHIP_RS880: | ||
| 1049 | tmp = TC_L2_SIZE(8); | 1054 | tmp = TC_L2_SIZE(8); |
| 1050 | break; | 1055 | break; |
| 1051 | case CHIP_RV630: | 1056 | case CHIP_RV630: |
| @@ -1267,19 +1272,17 @@ int r600_cp_resume(struct radeon_device *rdev) | |||
| 1267 | 1272 | ||
| 1268 | /* Set ring buffer size */ | 1273 | /* Set ring buffer size */ |
| 1269 | rb_bufsz = drm_order(rdev->cp.ring_size / 8); | 1274 | rb_bufsz = drm_order(rdev->cp.ring_size / 8); |
| 1275 | tmp = RB_NO_UPDATE | (drm_order(RADEON_GPU_PAGE_SIZE/8) << 8) | rb_bufsz; | ||
| 1270 | #ifdef __BIG_ENDIAN | 1276 | #ifdef __BIG_ENDIAN |
| 1271 | WREG32(CP_RB_CNTL, BUF_SWAP_32BIT | RB_NO_UPDATE | | 1277 | tmp |= BUF_SWAP_32BIT; |
| 1272 | (drm_order(4096/8) << 8) | rb_bufsz); | ||
| 1273 | #else | ||
| 1274 | WREG32(CP_RB_CNTL, RB_NO_UPDATE | (drm_order(4096/8) << 8) | rb_bufsz); | ||
| 1275 | #endif | 1278 | #endif |
| 1279 | WREG32(CP_RB_CNTL, tmp); | ||
| 1276 | WREG32(CP_SEM_WAIT_TIMER, 0x4); | 1280 | WREG32(CP_SEM_WAIT_TIMER, 0x4); |
| 1277 | 1281 | ||
| 1278 | /* Set the write pointer delay */ | 1282 | /* Set the write pointer delay */ |
| 1279 | WREG32(CP_RB_WPTR_DELAY, 0); | 1283 | WREG32(CP_RB_WPTR_DELAY, 0); |
| 1280 | 1284 | ||
| 1281 | /* Initialize the ring buffer's read and write pointers */ | 1285 | /* Initialize the ring buffer's read and write pointers */ |
| 1282 | tmp = RREG32(CP_RB_CNTL); | ||
| 1283 | WREG32(CP_RB_CNTL, tmp | RB_RPTR_WR_ENA); | 1286 | WREG32(CP_RB_CNTL, tmp | RB_RPTR_WR_ENA); |
| 1284 | WREG32(CP_RB_RPTR_WR, 0); | 1287 | WREG32(CP_RB_RPTR_WR, 0); |
| 1285 | WREG32(CP_RB_WPTR, 0); | 1288 | WREG32(CP_RB_WPTR, 0); |
| @@ -1400,7 +1403,7 @@ int r600_wb_enable(struct radeon_device *rdev) | |||
| 1400 | int r; | 1403 | int r; |
| 1401 | 1404 | ||
| 1402 | if (rdev->wb.wb_obj == NULL) { | 1405 | if (rdev->wb.wb_obj == NULL) { |
| 1403 | r = radeon_object_create(rdev, NULL, 4096, true, | 1406 | r = radeon_object_create(rdev, NULL, RADEON_GPU_PAGE_SIZE, true, |
| 1404 | RADEON_GEM_DOMAIN_GTT, false, &rdev->wb.wb_obj); | 1407 | RADEON_GEM_DOMAIN_GTT, false, &rdev->wb.wb_obj); |
| 1405 | if (r) { | 1408 | if (r) { |
| 1406 | dev_warn(rdev->dev, "failed to create WB buffer (%d).\n", r); | 1409 | dev_warn(rdev->dev, "failed to create WB buffer (%d).\n", r); |
| @@ -1450,8 +1453,8 @@ int r600_copy_blit(struct radeon_device *rdev, | |||
| 1450 | uint64_t src_offset, uint64_t dst_offset, | 1453 | uint64_t src_offset, uint64_t dst_offset, |
| 1451 | unsigned num_pages, struct radeon_fence *fence) | 1454 | unsigned num_pages, struct radeon_fence *fence) |
| 1452 | { | 1455 | { |
| 1453 | r600_blit_prepare_copy(rdev, num_pages * 4096); | 1456 | r600_blit_prepare_copy(rdev, num_pages * RADEON_GPU_PAGE_SIZE); |
| 1454 | r600_kms_blit_copy(rdev, src_offset, dst_offset, num_pages * 4096); | 1457 | r600_kms_blit_copy(rdev, src_offset, dst_offset, num_pages * RADEON_GPU_PAGE_SIZE); |
| 1455 | r600_blit_done_copy(rdev, fence); | 1458 | r600_blit_done_copy(rdev, fence); |
| 1456 | return 0; | 1459 | return 0; |
| 1457 | } | 1460 | } |
| @@ -1632,10 +1635,13 @@ int r600_init(struct radeon_device *rdev) | |||
| 1632 | r600_scratch_init(rdev); | 1635 | r600_scratch_init(rdev); |
| 1633 | /* Initialize surface registers */ | 1636 | /* Initialize surface registers */ |
| 1634 | radeon_surface_init(rdev); | 1637 | radeon_surface_init(rdev); |
| 1638 | /* Initialize clocks */ | ||
| 1635 | radeon_get_clock_info(rdev->ddev); | 1639 | radeon_get_clock_info(rdev->ddev); |
| 1636 | r = radeon_clocks_init(rdev); | 1640 | r = radeon_clocks_init(rdev); |
| 1637 | if (r) | 1641 | if (r) |
| 1638 | return r; | 1642 | return r; |
| 1643 | /* Initialize power management */ | ||
| 1644 | radeon_pm_init(rdev); | ||
| 1639 | /* Fence driver */ | 1645 | /* Fence driver */ |
| 1640 | r = radeon_fence_driver_init(rdev); | 1646 | r = radeon_fence_driver_init(rdev); |
| 1641 | if (r) | 1647 | if (r) |
diff --git a/drivers/gpu/drm/radeon/r600_blit.c b/drivers/gpu/drm/radeon/r600_blit.c index dec501081608..5ea432347589 100644 --- a/drivers/gpu/drm/radeon/r600_blit.c +++ b/drivers/gpu/drm/radeon/r600_blit.c | |||
| @@ -582,6 +582,8 @@ r600_blit_copy(struct drm_device *dev, | |||
| 582 | u64 vb_addr; | 582 | u64 vb_addr; |
| 583 | u32 *vb; | 583 | u32 *vb; |
| 584 | 584 | ||
| 585 | vb = r600_nomm_get_vb_ptr(dev); | ||
| 586 | |||
| 585 | if ((size_bytes & 3) || (src_gpu_addr & 3) || (dst_gpu_addr & 3)) { | 587 | if ((size_bytes & 3) || (src_gpu_addr & 3) || (dst_gpu_addr & 3)) { |
| 586 | max_bytes = 8192; | 588 | max_bytes = 8192; |
| 587 | 589 | ||
| @@ -617,8 +619,8 @@ r600_blit_copy(struct drm_device *dev, | |||
| 617 | if (!dev_priv->blit_vb) | 619 | if (!dev_priv->blit_vb) |
| 618 | return; | 620 | return; |
| 619 | set_shaders(dev); | 621 | set_shaders(dev); |
| 622 | vb = r600_nomm_get_vb_ptr(dev); | ||
| 620 | } | 623 | } |
| 621 | vb = r600_nomm_get_vb_ptr(dev); | ||
| 622 | 624 | ||
| 623 | vb[0] = i2f(dst_x); | 625 | vb[0] = i2f(dst_x); |
| 624 | vb[1] = 0; | 626 | vb[1] = 0; |
| @@ -706,8 +708,8 @@ r600_blit_copy(struct drm_device *dev, | |||
| 706 | return; | 708 | return; |
| 707 | 709 | ||
| 708 | set_shaders(dev); | 710 | set_shaders(dev); |
| 711 | vb = r600_nomm_get_vb_ptr(dev); | ||
| 709 | } | 712 | } |
| 710 | vb = r600_nomm_get_vb_ptr(dev); | ||
| 711 | 713 | ||
| 712 | vb[0] = i2f(dst_x / 4); | 714 | vb[0] = i2f(dst_x / 4); |
| 713 | vb[1] = 0; | 715 | vb[1] = 0; |
| @@ -772,6 +774,7 @@ r600_blit_swap(struct drm_device *dev, | |||
| 772 | { | 774 | { |
| 773 | drm_radeon_private_t *dev_priv = dev->dev_private; | 775 | drm_radeon_private_t *dev_priv = dev->dev_private; |
| 774 | int cb_format, tex_format; | 776 | int cb_format, tex_format; |
| 777 | int sx2, sy2, dx2, dy2; | ||
| 775 | u64 vb_addr; | 778 | u64 vb_addr; |
| 776 | u32 *vb; | 779 | u32 *vb; |
| 777 | 780 | ||
| @@ -786,16 +789,10 @@ r600_blit_swap(struct drm_device *dev, | |||
| 786 | } | 789 | } |
| 787 | vb = r600_nomm_get_vb_ptr(dev); | 790 | vb = r600_nomm_get_vb_ptr(dev); |
| 788 | 791 | ||
| 789 | if (cpp == 4) { | 792 | sx2 = sx + w; |
| 790 | cb_format = COLOR_8_8_8_8; | 793 | sy2 = sy + h; |
| 791 | tex_format = FMT_8_8_8_8; | 794 | dx2 = dx + w; |
| 792 | } else if (cpp == 2) { | 795 | dy2 = dy + h; |
| 793 | cb_format = COLOR_5_6_5; | ||
| 794 | tex_format = FMT_5_6_5; | ||
| 795 | } else { | ||
| 796 | cb_format = COLOR_8; | ||
| 797 | tex_format = FMT_8; | ||
| 798 | } | ||
| 799 | 796 | ||
| 800 | vb[0] = i2f(dx); | 797 | vb[0] = i2f(dx); |
| 801 | vb[1] = i2f(dy); | 798 | vb[1] = i2f(dy); |
| @@ -803,31 +800,46 @@ r600_blit_swap(struct drm_device *dev, | |||
| 803 | vb[3] = i2f(sy); | 800 | vb[3] = i2f(sy); |
| 804 | 801 | ||
| 805 | vb[4] = i2f(dx); | 802 | vb[4] = i2f(dx); |
| 806 | vb[5] = i2f(dy + h); | 803 | vb[5] = i2f(dy2); |
| 807 | vb[6] = i2f(sx); | 804 | vb[6] = i2f(sx); |
| 808 | vb[7] = i2f(sy + h); | 805 | vb[7] = i2f(sy2); |
| 806 | |||
| 807 | vb[8] = i2f(dx2); | ||
| 808 | vb[9] = i2f(dy2); | ||
| 809 | vb[10] = i2f(sx2); | ||
| 810 | vb[11] = i2f(sy2); | ||
| 809 | 811 | ||
| 810 | vb[8] = i2f(dx + w); | 812 | switch(cpp) { |
| 811 | vb[9] = i2f(dy + h); | 813 | case 4: |
| 812 | vb[10] = i2f(sx + w); | 814 | cb_format = COLOR_8_8_8_8; |
| 813 | vb[11] = i2f(sy + h); | 815 | tex_format = FMT_8_8_8_8; |
| 816 | break; | ||
| 817 | case 2: | ||
| 818 | cb_format = COLOR_5_6_5; | ||
| 819 | tex_format = FMT_5_6_5; | ||
| 820 | break; | ||
| 821 | default: | ||
| 822 | cb_format = COLOR_8; | ||
| 823 | tex_format = FMT_8; | ||
| 824 | break; | ||
| 825 | } | ||
| 814 | 826 | ||
| 815 | /* src */ | 827 | /* src */ |
| 816 | set_tex_resource(dev_priv, tex_format, | 828 | set_tex_resource(dev_priv, tex_format, |
| 817 | src_pitch / cpp, | 829 | src_pitch / cpp, |
| 818 | sy + h, src_pitch / cpp, | 830 | sy2, src_pitch / cpp, |
| 819 | src_gpu_addr); | 831 | src_gpu_addr); |
| 820 | 832 | ||
| 821 | cp_set_surface_sync(dev_priv, | 833 | cp_set_surface_sync(dev_priv, |
| 822 | R600_TC_ACTION_ENA, (src_pitch * (sy + h)), src_gpu_addr); | 834 | R600_TC_ACTION_ENA, src_pitch * sy2, src_gpu_addr); |
| 823 | 835 | ||
| 824 | /* dst */ | 836 | /* dst */ |
| 825 | set_render_target(dev_priv, cb_format, | 837 | set_render_target(dev_priv, cb_format, |
| 826 | dst_pitch / cpp, dy + h, | 838 | dst_pitch / cpp, dy2, |
| 827 | dst_gpu_addr); | 839 | dst_gpu_addr); |
| 828 | 840 | ||
| 829 | /* scissors */ | 841 | /* scissors */ |
| 830 | set_scissors(dev_priv, dx, dy, dx + w, dy + h); | 842 | set_scissors(dev_priv, dx, dy, dx2, dy2); |
| 831 | 843 | ||
| 832 | /* Vertex buffer setup */ | 844 | /* Vertex buffer setup */ |
| 833 | vb_addr = dev_priv->gart_buffers_offset + | 845 | vb_addr = dev_priv->gart_buffers_offset + |
| @@ -840,7 +852,7 @@ r600_blit_swap(struct drm_device *dev, | |||
| 840 | 852 | ||
| 841 | cp_set_surface_sync(dev_priv, | 853 | cp_set_surface_sync(dev_priv, |
| 842 | R600_CB_ACTION_ENA | R600_CB0_DEST_BASE_ENA, | 854 | R600_CB_ACTION_ENA | R600_CB0_DEST_BASE_ENA, |
| 843 | dst_pitch * (dy + h), dst_gpu_addr); | 855 | dst_pitch * dy2, dst_gpu_addr); |
| 844 | 856 | ||
| 845 | dev_priv->blit_vb->used += 12 * 4; | 857 | dev_priv->blit_vb->used += 12 * 4; |
| 846 | } | 858 | } |
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 93108bb31d1d..dbf716e1fbf3 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
| @@ -368,7 +368,7 @@ set_default_state(struct radeon_device *rdev) | |||
| 368 | if ((rdev->family == CHIP_RV610) || | 368 | if ((rdev->family == CHIP_RV610) || |
| 369 | (rdev->family == CHIP_RV620) || | 369 | (rdev->family == CHIP_RV620) || |
| 370 | (rdev->family == CHIP_RS780) || | 370 | (rdev->family == CHIP_RS780) || |
| 371 | (rdev->family == CHIP_RS780) || | 371 | (rdev->family == CHIP_RS880) || |
| 372 | (rdev->family == CHIP_RV710)) | 372 | (rdev->family == CHIP_RV710)) |
| 373 | sq_config = 0; | 373 | sq_config = 0; |
| 374 | else | 374 | else |
| @@ -610,6 +610,7 @@ void r600_kms_blit_copy(struct radeon_device *rdev, | |||
| 610 | 610 | ||
| 611 | DRM_DEBUG("emitting copy %16llx %16llx %d %d\n", src_gpu_addr, dst_gpu_addr, | 611 | DRM_DEBUG("emitting copy %16llx %16llx %d %d\n", src_gpu_addr, dst_gpu_addr, |
| 612 | size_bytes, rdev->r600_blit.vb_used); | 612 | size_bytes, rdev->r600_blit.vb_used); |
| 613 | vb = (u32 *)(rdev->r600_blit.vb_ib->ptr + rdev->r600_blit.vb_used); | ||
| 613 | if ((size_bytes & 3) || (src_gpu_addr & 3) || (dst_gpu_addr & 3)) { | 614 | if ((size_bytes & 3) || (src_gpu_addr & 3) || (dst_gpu_addr & 3)) { |
| 614 | max_bytes = 8192; | 615 | max_bytes = 8192; |
| 615 | 616 | ||
| @@ -652,7 +653,6 @@ void r600_kms_blit_copy(struct radeon_device *rdev, | |||
| 652 | vb = r600_nomm_get_vb_ptr(dev); | 653 | vb = r600_nomm_get_vb_ptr(dev); |
| 653 | #endif | 654 | #endif |
| 654 | } | 655 | } |
| 655 | vb = (u32 *)(rdev->r600_blit.vb_ib->ptr + rdev->r600_blit.vb_used); | ||
| 656 | 656 | ||
| 657 | vb[0] = i2f(dst_x); | 657 | vb[0] = i2f(dst_x); |
| 658 | vb[1] = 0; | 658 | vb[1] = 0; |
| @@ -747,7 +747,6 @@ void r600_kms_blit_copy(struct radeon_device *rdev, | |||
| 747 | vb = r600_nomm_get_vb_ptr(dev); | 747 | vb = r600_nomm_get_vb_ptr(dev); |
| 748 | } | 748 | } |
| 749 | #endif | 749 | #endif |
| 750 | vb = (u32 *)(rdev->r600_blit.vb_ib->ptr + rdev->r600_blit.vb_used); | ||
| 751 | 750 | ||
| 752 | vb[0] = i2f(dst_x / 4); | 751 | vb[0] = i2f(dst_x / 4); |
| 753 | vb[1] = 0; | 752 | vb[1] = 0; |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 17e42195c632..0d820764f340 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
| @@ -466,6 +466,23 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
| 466 | for (i = 0; i < pkt->count; i++) { | 466 | for (i = 0; i < pkt->count; i++) { |
| 467 | reg = start_reg + (4 * i); | 467 | reg = start_reg + (4 * i); |
| 468 | switch (reg) { | 468 | switch (reg) { |
| 469 | case SQ_ESGS_RING_BASE: | ||
| 470 | case SQ_GSVS_RING_BASE: | ||
| 471 | case SQ_ESTMP_RING_BASE: | ||
| 472 | case SQ_GSTMP_RING_BASE: | ||
| 473 | case SQ_VSTMP_RING_BASE: | ||
| 474 | case SQ_PSTMP_RING_BASE: | ||
| 475 | case SQ_FBUF_RING_BASE: | ||
| 476 | case SQ_REDUC_RING_BASE: | ||
| 477 | case SX_MEMORY_EXPORT_BASE: | ||
| 478 | r = r600_cs_packet_next_reloc(p, &reloc); | ||
| 479 | if (r) { | ||
| 480 | DRM_ERROR("bad SET_CONFIG_REG " | ||
| 481 | "0x%04X\n", reg); | ||
| 482 | return -EINVAL; | ||
| 483 | } | ||
| 484 | ib[idx+1+i] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | ||
| 485 | break; | ||
| 469 | case CP_COHER_BASE: | 486 | case CP_COHER_BASE: |
| 470 | /* use PACKET3_SURFACE_SYNC */ | 487 | /* use PACKET3_SURFACE_SYNC */ |
| 471 | return -EINVAL; | 488 | return -EINVAL; |
| @@ -487,6 +504,7 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
| 487 | reg = start_reg + (4 * i); | 504 | reg = start_reg + (4 * i); |
| 488 | switch (reg) { | 505 | switch (reg) { |
| 489 | case DB_DEPTH_BASE: | 506 | case DB_DEPTH_BASE: |
| 507 | case DB_HTILE_DATA_BASE: | ||
| 490 | case CB_COLOR0_BASE: | 508 | case CB_COLOR0_BASE: |
| 491 | case CB_COLOR1_BASE: | 509 | case CB_COLOR1_BASE: |
| 492 | case CB_COLOR2_BASE: | 510 | case CB_COLOR2_BASE: |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 9b64d47f1f82..27ab428b149b 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
| @@ -119,6 +119,7 @@ | |||
| 119 | #define DB_DEBUG 0x9830 | 119 | #define DB_DEBUG 0x9830 |
| 120 | #define PREZ_MUST_WAIT_FOR_POSTZ_DONE (1 << 31) | 120 | #define PREZ_MUST_WAIT_FOR_POSTZ_DONE (1 << 31) |
| 121 | #define DB_DEPTH_BASE 0x2800C | 121 | #define DB_DEPTH_BASE 0x2800C |
| 122 | #define DB_HTILE_DATA_BASE 0x28014 | ||
| 122 | #define DB_WATERMARKS 0x9838 | 123 | #define DB_WATERMARKS 0x9838 |
| 123 | #define DEPTH_FREE(x) ((x) << 0) | 124 | #define DEPTH_FREE(x) ((x) << 0) |
| 124 | #define DEPTH_FLUSH(x) ((x) << 5) | 125 | #define DEPTH_FLUSH(x) ((x) << 5) |
| @@ -171,6 +172,14 @@ | |||
| 171 | #define SQ_STACK_RESOURCE_MGMT_2 0x8c14 | 172 | #define SQ_STACK_RESOURCE_MGMT_2 0x8c14 |
| 172 | # define NUM_GS_STACK_ENTRIES(x) ((x) << 0) | 173 | # define NUM_GS_STACK_ENTRIES(x) ((x) << 0) |
| 173 | # define NUM_ES_STACK_ENTRIES(x) ((x) << 16) | 174 | # define NUM_ES_STACK_ENTRIES(x) ((x) << 16) |
| 175 | #define SQ_ESGS_RING_BASE 0x8c40 | ||
| 176 | #define SQ_GSVS_RING_BASE 0x8c48 | ||
| 177 | #define SQ_ESTMP_RING_BASE 0x8c50 | ||
| 178 | #define SQ_GSTMP_RING_BASE 0x8c58 | ||
| 179 | #define SQ_VSTMP_RING_BASE 0x8c60 | ||
| 180 | #define SQ_PSTMP_RING_BASE 0x8c68 | ||
| 181 | #define SQ_FBUF_RING_BASE 0x8c70 | ||
| 182 | #define SQ_REDUC_RING_BASE 0x8c78 | ||
| 174 | 183 | ||
| 175 | #define GRBM_CNTL 0x8000 | 184 | #define GRBM_CNTL 0x8000 |
| 176 | # define GRBM_READ_TIMEOUT(x) ((x) << 0) | 185 | # define GRBM_READ_TIMEOUT(x) ((x) << 0) |
| @@ -271,6 +280,10 @@ | |||
| 271 | #define PCIE_PORT_INDEX 0x0038 | 280 | #define PCIE_PORT_INDEX 0x0038 |
| 272 | #define PCIE_PORT_DATA 0x003C | 281 | #define PCIE_PORT_DATA 0x003C |
| 273 | 282 | ||
| 283 | #define CHMAP 0x2004 | ||
| 284 | #define NOOFCHAN_SHIFT 12 | ||
| 285 | #define NOOFCHAN_MASK 0x00003000 | ||
| 286 | |||
| 274 | #define RAMCFG 0x2408 | 287 | #define RAMCFG 0x2408 |
| 275 | #define NOOFBANK_SHIFT 0 | 288 | #define NOOFBANK_SHIFT 0 |
| 276 | #define NOOFBANK_MASK 0x00000001 | 289 | #define NOOFBANK_MASK 0x00000001 |
| @@ -352,6 +365,7 @@ | |||
| 352 | 365 | ||
| 353 | 366 | ||
| 354 | #define SX_MISC 0x28350 | 367 | #define SX_MISC 0x28350 |
| 368 | #define SX_MEMORY_EXPORT_BASE 0x9010 | ||
| 355 | #define SX_DEBUG_1 0x9054 | 369 | #define SX_DEBUG_1 0x9054 |
| 356 | #define SMX_EVENT_RELEASE (1 << 0) | 370 | #define SMX_EVENT_RELEASE (1 << 0) |
| 357 | #define ENABLE_NEW_SMX_ADDRESS (1 << 16) | 371 | #define ENABLE_NEW_SMX_ADDRESS (1 << 16) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 5ab35b81c86b..224506a2f7b1 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
| @@ -139,6 +139,10 @@ struct radeon_clock { | |||
| 139 | uint32_t default_sclk; | 139 | uint32_t default_sclk; |
| 140 | }; | 140 | }; |
| 141 | 141 | ||
| 142 | /* | ||
| 143 | * Power management | ||
| 144 | */ | ||
| 145 | int radeon_pm_init(struct radeon_device *rdev); | ||
| 142 | 146 | ||
| 143 | /* | 147 | /* |
| 144 | * Fences. | 148 | * Fences. |
| @@ -276,6 +280,8 @@ union radeon_gart_table { | |||
| 276 | struct radeon_gart_table_vram vram; | 280 | struct radeon_gart_table_vram vram; |
| 277 | }; | 281 | }; |
| 278 | 282 | ||
| 283 | #define RADEON_GPU_PAGE_SIZE 4096 | ||
| 284 | |||
| 279 | struct radeon_gart { | 285 | struct radeon_gart { |
| 280 | dma_addr_t table_addr; | 286 | dma_addr_t table_addr; |
| 281 | unsigned num_gpu_pages; | 287 | unsigned num_gpu_pages; |
| @@ -513,6 +519,7 @@ typedef int (*radeon_packet3_check_t)(struct radeon_cs_parser *p, | |||
| 513 | * AGP | 519 | * AGP |
| 514 | */ | 520 | */ |
| 515 | int radeon_agp_init(struct radeon_device *rdev); | 521 | int radeon_agp_init(struct radeon_device *rdev); |
| 522 | void radeon_agp_resume(struct radeon_device *rdev); | ||
| 516 | void radeon_agp_fini(struct radeon_device *rdev); | 523 | void radeon_agp_fini(struct radeon_device *rdev); |
| 517 | 524 | ||
| 518 | 525 | ||
| @@ -621,7 +628,9 @@ struct radeon_asic { | |||
| 621 | uint64_t dst_offset, | 628 | uint64_t dst_offset, |
| 622 | unsigned num_pages, | 629 | unsigned num_pages, |
| 623 | struct radeon_fence *fence); | 630 | struct radeon_fence *fence); |
| 631 | uint32_t (*get_engine_clock)(struct radeon_device *rdev); | ||
| 624 | void (*set_engine_clock)(struct radeon_device *rdev, uint32_t eng_clock); | 632 | void (*set_engine_clock)(struct radeon_device *rdev, uint32_t eng_clock); |
| 633 | uint32_t (*get_memory_clock)(struct radeon_device *rdev); | ||
| 625 | void (*set_memory_clock)(struct radeon_device *rdev, uint32_t mem_clock); | 634 | void (*set_memory_clock)(struct radeon_device *rdev, uint32_t mem_clock); |
| 626 | void (*set_pcie_lanes)(struct radeon_device *rdev, int lanes); | 635 | void (*set_pcie_lanes)(struct radeon_device *rdev, int lanes); |
| 627 | void (*set_clock_gating)(struct radeon_device *rdev, int enable); | 636 | void (*set_clock_gating)(struct radeon_device *rdev, int enable); |
| @@ -783,6 +792,7 @@ struct radeon_device { | |||
| 783 | const struct firmware *me_fw; /* all family ME firmware */ | 792 | const struct firmware *me_fw; /* all family ME firmware */ |
| 784 | const struct firmware *pfp_fw; /* r6/700 PFP firmware */ | 793 | const struct firmware *pfp_fw; /* r6/700 PFP firmware */ |
| 785 | struct r600_blit r600_blit; | 794 | struct r600_blit r600_blit; |
| 795 | int msi_enabled; /* msi enabled */ | ||
| 786 | }; | 796 | }; |
| 787 | 797 | ||
| 788 | int radeon_device_init(struct radeon_device *rdev, | 798 | int radeon_device_init(struct radeon_device *rdev, |
| @@ -952,7 +962,9 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v) | |||
| 952 | #define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy_blit((rdev), (s), (d), (np), (f)) | 962 | #define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy_blit((rdev), (s), (d), (np), (f)) |
| 953 | #define radeon_copy_dma(rdev, s, d, np, f) (rdev)->asic->copy_dma((rdev), (s), (d), (np), (f)) | 963 | #define radeon_copy_dma(rdev, s, d, np, f) (rdev)->asic->copy_dma((rdev), (s), (d), (np), (f)) |
| 954 | #define radeon_copy(rdev, s, d, np, f) (rdev)->asic->copy((rdev), (s), (d), (np), (f)) | 964 | #define radeon_copy(rdev, s, d, np, f) (rdev)->asic->copy((rdev), (s), (d), (np), (f)) |
| 965 | #define radeon_get_engine_clock(rdev) (rdev)->asic->get_engine_clock((rdev)) | ||
| 955 | #define radeon_set_engine_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e)) | 966 | #define radeon_set_engine_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e)) |
| 967 | #define radeon_get_memory_clock(rdev) (rdev)->asic->get_memory_clock((rdev)) | ||
| 956 | #define radeon_set_memory_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e)) | 968 | #define radeon_set_memory_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e)) |
| 957 | #define radeon_set_pcie_lanes(rdev, l) (rdev)->asic->set_pcie_lanes((rdev), (l)) | 969 | #define radeon_set_pcie_lanes(rdev, l) (rdev)->asic->set_pcie_lanes((rdev), (l)) |
| 958 | #define radeon_set_clock_gating(rdev, e) (rdev)->asic->set_clock_gating((rdev), (e)) | 970 | #define radeon_set_clock_gating(rdev, e) (rdev)->asic->set_clock_gating((rdev), (e)) |
diff --git a/drivers/gpu/drm/radeon/radeon_agp.c b/drivers/gpu/drm/radeon/radeon_agp.c index 23ea9955ac59..54bf49a6d676 100644 --- a/drivers/gpu/drm/radeon/radeon_agp.c +++ b/drivers/gpu/drm/radeon/radeon_agp.c | |||
| @@ -237,6 +237,18 @@ int radeon_agp_init(struct radeon_device *rdev) | |||
| 237 | #endif | 237 | #endif |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | void radeon_agp_resume(struct radeon_device *rdev) | ||
| 241 | { | ||
| 242 | #if __OS_HAS_AGP | ||
| 243 | int r; | ||
| 244 | if (rdev->flags & RADEON_IS_AGP) { | ||
| 245 | r = radeon_agp_init(rdev); | ||
| 246 | if (r) | ||
| 247 | dev_warn(rdev->dev, "radeon AGP reinit failed\n"); | ||
| 248 | } | ||
| 249 | #endif | ||
| 250 | } | ||
| 251 | |||
| 240 | void radeon_agp_fini(struct radeon_device *rdev) | 252 | void radeon_agp_fini(struct radeon_device *rdev) |
| 241 | { | 253 | { |
| 242 | #if __OS_HAS_AGP | 254 | #if __OS_HAS_AGP |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index c3532c7a6f3f..c18fbee387d7 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
| @@ -31,10 +31,13 @@ | |||
| 31 | /* | 31 | /* |
| 32 | * common functions | 32 | * common functions |
| 33 | */ | 33 | */ |
| 34 | uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev); | ||
| 34 | void radeon_legacy_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock); | 35 | void radeon_legacy_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock); |
| 35 | void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable); | 36 | void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable); |
| 36 | 37 | ||
| 38 | uint32_t radeon_atom_get_engine_clock(struct radeon_device *rdev); | ||
| 37 | void radeon_atom_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock); | 39 | void radeon_atom_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock); |
| 40 | uint32_t radeon_atom_get_memory_clock(struct radeon_device *rdev); | ||
| 38 | void radeon_atom_set_memory_clock(struct radeon_device *rdev, uint32_t mem_clock); | 41 | void radeon_atom_set_memory_clock(struct radeon_device *rdev, uint32_t mem_clock); |
| 39 | void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable); | 42 | void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable); |
| 40 | 43 | ||
| @@ -95,7 +98,9 @@ static struct radeon_asic r100_asic = { | |||
| 95 | .copy_blit = &r100_copy_blit, | 98 | .copy_blit = &r100_copy_blit, |
| 96 | .copy_dma = NULL, | 99 | .copy_dma = NULL, |
| 97 | .copy = &r100_copy_blit, | 100 | .copy = &r100_copy_blit, |
| 101 | .get_engine_clock = &radeon_legacy_get_engine_clock, | ||
| 98 | .set_engine_clock = &radeon_legacy_set_engine_clock, | 102 | .set_engine_clock = &radeon_legacy_set_engine_clock, |
| 103 | .get_memory_clock = NULL, | ||
| 99 | .set_memory_clock = NULL, | 104 | .set_memory_clock = NULL, |
| 100 | .set_pcie_lanes = NULL, | 105 | .set_pcie_lanes = NULL, |
| 101 | .set_clock_gating = &radeon_legacy_set_clock_gating, | 106 | .set_clock_gating = &radeon_legacy_set_clock_gating, |
| @@ -148,7 +153,9 @@ static struct radeon_asic r300_asic = { | |||
| 148 | .copy_blit = &r100_copy_blit, | 153 | .copy_blit = &r100_copy_blit, |
| 149 | .copy_dma = &r300_copy_dma, | 154 | .copy_dma = &r300_copy_dma, |
| 150 | .copy = &r100_copy_blit, | 155 | .copy = &r100_copy_blit, |
| 156 | .get_engine_clock = &radeon_legacy_get_engine_clock, | ||
| 151 | .set_engine_clock = &radeon_legacy_set_engine_clock, | 157 | .set_engine_clock = &radeon_legacy_set_engine_clock, |
| 158 | .get_memory_clock = NULL, | ||
| 152 | .set_memory_clock = NULL, | 159 | .set_memory_clock = NULL, |
| 153 | .set_pcie_lanes = &rv370_set_pcie_lanes, | 160 | .set_pcie_lanes = &rv370_set_pcie_lanes, |
| 154 | .set_clock_gating = &radeon_legacy_set_clock_gating, | 161 | .set_clock_gating = &radeon_legacy_set_clock_gating, |
| @@ -185,7 +192,9 @@ static struct radeon_asic r420_asic = { | |||
| 185 | .copy_blit = &r100_copy_blit, | 192 | .copy_blit = &r100_copy_blit, |
| 186 | .copy_dma = &r300_copy_dma, | 193 | .copy_dma = &r300_copy_dma, |
| 187 | .copy = &r100_copy_blit, | 194 | .copy = &r100_copy_blit, |
| 195 | .get_engine_clock = &radeon_atom_get_engine_clock, | ||
| 188 | .set_engine_clock = &radeon_atom_set_engine_clock, | 196 | .set_engine_clock = &radeon_atom_set_engine_clock, |
| 197 | .get_memory_clock = &radeon_atom_get_memory_clock, | ||
| 189 | .set_memory_clock = &radeon_atom_set_memory_clock, | 198 | .set_memory_clock = &radeon_atom_set_memory_clock, |
| 190 | .set_pcie_lanes = &rv370_set_pcie_lanes, | 199 | .set_pcie_lanes = &rv370_set_pcie_lanes, |
| 191 | .set_clock_gating = &radeon_atom_set_clock_gating, | 200 | .set_clock_gating = &radeon_atom_set_clock_gating, |
| @@ -227,7 +236,9 @@ static struct radeon_asic rs400_asic = { | |||
| 227 | .copy_blit = &r100_copy_blit, | 236 | .copy_blit = &r100_copy_blit, |
| 228 | .copy_dma = &r300_copy_dma, | 237 | .copy_dma = &r300_copy_dma, |
| 229 | .copy = &r100_copy_blit, | 238 | .copy = &r100_copy_blit, |
| 239 | .get_engine_clock = &radeon_legacy_get_engine_clock, | ||
| 230 | .set_engine_clock = &radeon_legacy_set_engine_clock, | 240 | .set_engine_clock = &radeon_legacy_set_engine_clock, |
| 241 | .get_memory_clock = NULL, | ||
| 231 | .set_memory_clock = NULL, | 242 | .set_memory_clock = NULL, |
| 232 | .set_pcie_lanes = NULL, | 243 | .set_pcie_lanes = NULL, |
| 233 | .set_clock_gating = &radeon_legacy_set_clock_gating, | 244 | .set_clock_gating = &radeon_legacy_set_clock_gating, |
| @@ -273,7 +284,9 @@ static struct radeon_asic rs600_asic = { | |||
| 273 | .copy_blit = &r100_copy_blit, | 284 | .copy_blit = &r100_copy_blit, |
| 274 | .copy_dma = &r300_copy_dma, | 285 | .copy_dma = &r300_copy_dma, |
| 275 | .copy = &r100_copy_blit, | 286 | .copy = &r100_copy_blit, |
| 287 | .get_engine_clock = &radeon_atom_get_engine_clock, | ||
| 276 | .set_engine_clock = &radeon_atom_set_engine_clock, | 288 | .set_engine_clock = &radeon_atom_set_engine_clock, |
| 289 | .get_memory_clock = &radeon_atom_get_memory_clock, | ||
| 277 | .set_memory_clock = &radeon_atom_set_memory_clock, | 290 | .set_memory_clock = &radeon_atom_set_memory_clock, |
| 278 | .set_pcie_lanes = NULL, | 291 | .set_pcie_lanes = NULL, |
| 279 | .set_clock_gating = &radeon_atom_set_clock_gating, | 292 | .set_clock_gating = &radeon_atom_set_clock_gating, |
| @@ -312,7 +325,9 @@ static struct radeon_asic rs690_asic = { | |||
| 312 | .copy_blit = &r100_copy_blit, | 325 | .copy_blit = &r100_copy_blit, |
| 313 | .copy_dma = &r300_copy_dma, | 326 | .copy_dma = &r300_copy_dma, |
| 314 | .copy = &r300_copy_dma, | 327 | .copy = &r300_copy_dma, |
| 328 | .get_engine_clock = &radeon_atom_get_engine_clock, | ||
| 315 | .set_engine_clock = &radeon_atom_set_engine_clock, | 329 | .set_engine_clock = &radeon_atom_set_engine_clock, |
| 330 | .get_memory_clock = &radeon_atom_get_memory_clock, | ||
| 316 | .set_memory_clock = &radeon_atom_set_memory_clock, | 331 | .set_memory_clock = &radeon_atom_set_memory_clock, |
| 317 | .set_pcie_lanes = NULL, | 332 | .set_pcie_lanes = NULL, |
| 318 | .set_clock_gating = &radeon_atom_set_clock_gating, | 333 | .set_clock_gating = &radeon_atom_set_clock_gating, |
| @@ -357,7 +372,9 @@ static struct radeon_asic rv515_asic = { | |||
| 357 | .copy_blit = &r100_copy_blit, | 372 | .copy_blit = &r100_copy_blit, |
| 358 | .copy_dma = &r300_copy_dma, | 373 | .copy_dma = &r300_copy_dma, |
| 359 | .copy = &r100_copy_blit, | 374 | .copy = &r100_copy_blit, |
| 375 | .get_engine_clock = &radeon_atom_get_engine_clock, | ||
| 360 | .set_engine_clock = &radeon_atom_set_engine_clock, | 376 | .set_engine_clock = &radeon_atom_set_engine_clock, |
| 377 | .get_memory_clock = &radeon_atom_get_memory_clock, | ||
| 361 | .set_memory_clock = &radeon_atom_set_memory_clock, | 378 | .set_memory_clock = &radeon_atom_set_memory_clock, |
| 362 | .set_pcie_lanes = &rv370_set_pcie_lanes, | 379 | .set_pcie_lanes = &rv370_set_pcie_lanes, |
| 363 | .set_clock_gating = &radeon_atom_set_clock_gating, | 380 | .set_clock_gating = &radeon_atom_set_clock_gating, |
| @@ -393,7 +410,9 @@ static struct radeon_asic r520_asic = { | |||
| 393 | .copy_blit = &r100_copy_blit, | 410 | .copy_blit = &r100_copy_blit, |
| 394 | .copy_dma = &r300_copy_dma, | 411 | .copy_dma = &r300_copy_dma, |
| 395 | .copy = &r100_copy_blit, | 412 | .copy = &r100_copy_blit, |
| 413 | .get_engine_clock = &radeon_atom_get_engine_clock, | ||
| 396 | .set_engine_clock = &radeon_atom_set_engine_clock, | 414 | .set_engine_clock = &radeon_atom_set_engine_clock, |
| 415 | .get_memory_clock = &radeon_atom_get_memory_clock, | ||
| 397 | .set_memory_clock = &radeon_atom_set_memory_clock, | 416 | .set_memory_clock = &radeon_atom_set_memory_clock, |
| 398 | .set_pcie_lanes = &rv370_set_pcie_lanes, | 417 | .set_pcie_lanes = &rv370_set_pcie_lanes, |
| 399 | .set_clock_gating = &radeon_atom_set_clock_gating, | 418 | .set_clock_gating = &radeon_atom_set_clock_gating, |
| @@ -456,7 +475,9 @@ static struct radeon_asic r600_asic = { | |||
| 456 | .copy_blit = &r600_copy_blit, | 475 | .copy_blit = &r600_copy_blit, |
| 457 | .copy_dma = &r600_copy_blit, | 476 | .copy_dma = &r600_copy_blit, |
| 458 | .copy = &r600_copy_blit, | 477 | .copy = &r600_copy_blit, |
| 478 | .get_engine_clock = &radeon_atom_get_engine_clock, | ||
| 459 | .set_engine_clock = &radeon_atom_set_engine_clock, | 479 | .set_engine_clock = &radeon_atom_set_engine_clock, |
| 480 | .get_memory_clock = &radeon_atom_get_memory_clock, | ||
| 460 | .set_memory_clock = &radeon_atom_set_memory_clock, | 481 | .set_memory_clock = &radeon_atom_set_memory_clock, |
| 461 | .set_pcie_lanes = NULL, | 482 | .set_pcie_lanes = NULL, |
| 462 | .set_clock_gating = &radeon_atom_set_clock_gating, | 483 | .set_clock_gating = &radeon_atom_set_clock_gating, |
| @@ -493,7 +514,9 @@ static struct radeon_asic rv770_asic = { | |||
| 493 | .copy_blit = &r600_copy_blit, | 514 | .copy_blit = &r600_copy_blit, |
| 494 | .copy_dma = &r600_copy_blit, | 515 | .copy_dma = &r600_copy_blit, |
| 495 | .copy = &r600_copy_blit, | 516 | .copy = &r600_copy_blit, |
| 517 | .get_engine_clock = &radeon_atom_get_engine_clock, | ||
| 496 | .set_engine_clock = &radeon_atom_set_engine_clock, | 518 | .set_engine_clock = &radeon_atom_set_engine_clock, |
| 519 | .get_memory_clock = &radeon_atom_get_memory_clock, | ||
| 497 | .set_memory_clock = &radeon_atom_set_memory_clock, | 520 | .set_memory_clock = &radeon_atom_set_memory_clock, |
| 498 | .set_pcie_lanes = NULL, | 521 | .set_pcie_lanes = NULL, |
| 499 | .set_clock_gating = &radeon_atom_set_clock_gating, | 522 | .set_clock_gating = &radeon_atom_set_clock_gating, |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 5b6c08cee40e..2ed88a820935 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
| @@ -46,7 +46,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 46 | uint32_t supported_device, | 46 | uint32_t supported_device, |
| 47 | int connector_type, | 47 | int connector_type, |
| 48 | struct radeon_i2c_bus_rec *i2c_bus, | 48 | struct radeon_i2c_bus_rec *i2c_bus, |
| 49 | bool linkb, uint32_t igp_lane_info); | 49 | bool linkb, uint32_t igp_lane_info, |
| 50 | uint16_t connector_object_id); | ||
| 50 | 51 | ||
| 51 | /* from radeon_legacy_encoder.c */ | 52 | /* from radeon_legacy_encoder.c */ |
| 52 | extern void | 53 | extern void |
| @@ -193,6 +194,23 @@ const int supported_devices_connector_convert[] = { | |||
| 193 | DRM_MODE_CONNECTOR_DisplayPort | 194 | DRM_MODE_CONNECTOR_DisplayPort |
| 194 | }; | 195 | }; |
| 195 | 196 | ||
| 197 | const uint16_t supported_devices_connector_object_id_convert[] = { | ||
| 198 | CONNECTOR_OBJECT_ID_NONE, | ||
| 199 | CONNECTOR_OBJECT_ID_VGA, | ||
| 200 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I, /* not all boards support DL */ | ||
| 201 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D, /* not all boards support DL */ | ||
| 202 | CONNECTOR_OBJECT_ID_VGA, /* technically DVI-A */ | ||
| 203 | CONNECTOR_OBJECT_ID_COMPOSITE, | ||
| 204 | CONNECTOR_OBJECT_ID_SVIDEO, | ||
| 205 | CONNECTOR_OBJECT_ID_LVDS, | ||
| 206 | CONNECTOR_OBJECT_ID_9PIN_DIN, | ||
| 207 | CONNECTOR_OBJECT_ID_9PIN_DIN, | ||
| 208 | CONNECTOR_OBJECT_ID_DISPLAYPORT, | ||
| 209 | CONNECTOR_OBJECT_ID_HDMI_TYPE_A, | ||
| 210 | CONNECTOR_OBJECT_ID_HDMI_TYPE_B, | ||
| 211 | CONNECTOR_OBJECT_ID_SVIDEO | ||
| 212 | }; | ||
| 213 | |||
| 196 | const int object_connector_convert[] = { | 214 | const int object_connector_convert[] = { |
| 197 | DRM_MODE_CONNECTOR_Unknown, | 215 | DRM_MODE_CONNECTOR_Unknown, |
| 198 | DRM_MODE_CONNECTOR_DVII, | 216 | DRM_MODE_CONNECTOR_DVII, |
| @@ -229,7 +247,7 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
| 229 | ATOM_OBJECT_HEADER *obj_header; | 247 | ATOM_OBJECT_HEADER *obj_header; |
| 230 | int i, j, path_size, device_support; | 248 | int i, j, path_size, device_support; |
| 231 | int connector_type; | 249 | int connector_type; |
| 232 | uint16_t igp_lane_info, conn_id; | 250 | uint16_t igp_lane_info, conn_id, connector_object_id; |
| 233 | bool linkb; | 251 | bool linkb; |
| 234 | struct radeon_i2c_bus_rec ddc_bus; | 252 | struct radeon_i2c_bus_rec ddc_bus; |
| 235 | 253 | ||
| @@ -277,7 +295,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
| 277 | ATOM_DEVICE_CV_SUPPORT) | 295 | ATOM_DEVICE_CV_SUPPORT) |
| 278 | continue; | 296 | continue; |
| 279 | 297 | ||
| 280 | if ((rdev->family == CHIP_RS780) && | 298 | /* IGP chips */ |
| 299 | if ((rdev->flags & RADEON_IS_IGP) && | ||
| 281 | (con_obj_id == | 300 | (con_obj_id == |
| 282 | CONNECTOR_OBJECT_ID_PCIE_CONNECTOR)) { | 301 | CONNECTOR_OBJECT_ID_PCIE_CONNECTOR)) { |
| 283 | uint16_t igp_offset = 0; | 302 | uint16_t igp_offset = 0; |
| @@ -311,6 +330,7 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
| 311 | connector_type = | 330 | connector_type = |
| 312 | object_connector_convert | 331 | object_connector_convert |
| 313 | [ct]; | 332 | [ct]; |
| 333 | connector_object_id = ct; | ||
| 314 | igp_lane_info = | 334 | igp_lane_info = |
| 315 | slot_config & 0xffff; | 335 | slot_config & 0xffff; |
| 316 | } else | 336 | } else |
| @@ -321,6 +341,7 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
| 321 | igp_lane_info = 0; | 341 | igp_lane_info = 0; |
| 322 | connector_type = | 342 | connector_type = |
| 323 | object_connector_convert[con_obj_id]; | 343 | object_connector_convert[con_obj_id]; |
| 344 | connector_object_id = con_obj_id; | ||
| 324 | } | 345 | } |
| 325 | 346 | ||
| 326 | if (connector_type == DRM_MODE_CONNECTOR_Unknown) | 347 | if (connector_type == DRM_MODE_CONNECTOR_Unknown) |
| @@ -425,7 +446,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
| 425 | le16_to_cpu(path-> | 446 | le16_to_cpu(path-> |
| 426 | usDeviceTag), | 447 | usDeviceTag), |
| 427 | connector_type, &ddc_bus, | 448 | connector_type, &ddc_bus, |
| 428 | linkb, igp_lane_info); | 449 | linkb, igp_lane_info, |
| 450 | connector_object_id); | ||
| 429 | 451 | ||
| 430 | } | 452 | } |
| 431 | } | 453 | } |
| @@ -435,6 +457,45 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
| 435 | return true; | 457 | return true; |
| 436 | } | 458 | } |
| 437 | 459 | ||
| 460 | static uint16_t atombios_get_connector_object_id(struct drm_device *dev, | ||
| 461 | int connector_type, | ||
| 462 | uint16_t devices) | ||
| 463 | { | ||
| 464 | struct radeon_device *rdev = dev->dev_private; | ||
| 465 | |||
| 466 | if (rdev->flags & RADEON_IS_IGP) { | ||
| 467 | return supported_devices_connector_object_id_convert | ||
| 468 | [connector_type]; | ||
| 469 | } else if (((connector_type == DRM_MODE_CONNECTOR_DVII) || | ||
| 470 | (connector_type == DRM_MODE_CONNECTOR_DVID)) && | ||
| 471 | (devices & ATOM_DEVICE_DFP2_SUPPORT)) { | ||
| 472 | struct radeon_mode_info *mode_info = &rdev->mode_info; | ||
| 473 | struct atom_context *ctx = mode_info->atom_context; | ||
| 474 | int index = GetIndexIntoMasterTable(DATA, XTMDS_Info); | ||
| 475 | uint16_t size, data_offset; | ||
| 476 | uint8_t frev, crev; | ||
| 477 | ATOM_XTMDS_INFO *xtmds; | ||
| 478 | |||
| 479 | atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset); | ||
| 480 | xtmds = (ATOM_XTMDS_INFO *)(ctx->bios + data_offset); | ||
| 481 | |||
| 482 | if (xtmds->ucSupportedLink & ATOM_XTMDS_SUPPORTED_DUALLINK) { | ||
| 483 | if (connector_type == DRM_MODE_CONNECTOR_DVII) | ||
| 484 | return CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I; | ||
| 485 | else | ||
| 486 | return CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D; | ||
| 487 | } else { | ||
| 488 | if (connector_type == DRM_MODE_CONNECTOR_DVII) | ||
| 489 | return CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I; | ||
| 490 | else | ||
| 491 | return CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D; | ||
| 492 | } | ||
| 493 | } else { | ||
| 494 | return supported_devices_connector_object_id_convert | ||
| 495 | [connector_type]; | ||
| 496 | } | ||
| 497 | } | ||
| 498 | |||
| 438 | struct bios_connector { | 499 | struct bios_connector { |
| 439 | bool valid; | 500 | bool valid; |
| 440 | uint16_t line_mux; | 501 | uint16_t line_mux; |
| @@ -593,14 +654,20 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct | |||
| 593 | 654 | ||
| 594 | /* add the connectors */ | 655 | /* add the connectors */ |
| 595 | for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { | 656 | for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { |
| 596 | if (bios_connectors[i].valid) | 657 | if (bios_connectors[i].valid) { |
| 658 | uint16_t connector_object_id = | ||
| 659 | atombios_get_connector_object_id(dev, | ||
| 660 | bios_connectors[i].connector_type, | ||
| 661 | bios_connectors[i].devices); | ||
| 597 | radeon_add_atom_connector(dev, | 662 | radeon_add_atom_connector(dev, |
| 598 | bios_connectors[i].line_mux, | 663 | bios_connectors[i].line_mux, |
| 599 | bios_connectors[i].devices, | 664 | bios_connectors[i].devices, |
| 600 | bios_connectors[i]. | 665 | bios_connectors[i]. |
| 601 | connector_type, | 666 | connector_type, |
| 602 | &bios_connectors[i].ddc_bus, | 667 | &bios_connectors[i].ddc_bus, |
| 603 | false, 0); | 668 | false, 0, |
| 669 | connector_object_id); | ||
| 670 | } | ||
| 604 | } | 671 | } |
| 605 | 672 | ||
| 606 | radeon_link_encoder_connector(dev); | 673 | radeon_link_encoder_connector(dev); |
| @@ -641,8 +708,12 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
| 641 | le16_to_cpu(firmware_info->info.usReferenceClock); | 708 | le16_to_cpu(firmware_info->info.usReferenceClock); |
| 642 | p1pll->reference_div = 0; | 709 | p1pll->reference_div = 0; |
| 643 | 710 | ||
| 644 | p1pll->pll_out_min = | 711 | if (crev < 2) |
| 645 | le16_to_cpu(firmware_info->info.usMinPixelClockPLL_Output); | 712 | p1pll->pll_out_min = |
| 713 | le16_to_cpu(firmware_info->info.usMinPixelClockPLL_Output); | ||
| 714 | else | ||
| 715 | p1pll->pll_out_min = | ||
| 716 | le32_to_cpu(firmware_info->info_12.ulMinPixelClockPLL_Output); | ||
| 646 | p1pll->pll_out_max = | 717 | p1pll->pll_out_max = |
| 647 | le32_to_cpu(firmware_info->info.ulMaxPixelClockPLL_Output); | 718 | le32_to_cpu(firmware_info->info.ulMaxPixelClockPLL_Output); |
| 648 | 719 | ||
| @@ -651,6 +722,16 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
| 651 | p1pll->pll_out_min = 64800; | 722 | p1pll->pll_out_min = 64800; |
| 652 | else | 723 | else |
| 653 | p1pll->pll_out_min = 20000; | 724 | p1pll->pll_out_min = 20000; |
| 725 | } else if (p1pll->pll_out_min > 64800) { | ||
| 726 | /* Limiting the pll output range is a good thing generally as | ||
| 727 | * it limits the number of possible pll combinations for a given | ||
| 728 | * frequency presumably to the ones that work best on each card. | ||
| 729 | * However, certain duallink DVI monitors seem to like | ||
| 730 | * pll combinations that would be limited by this at least on | ||
| 731 | * pre-DCE 3.0 r6xx hardware. This might need to be adjusted per | ||
| 732 | * family. | ||
| 733 | */ | ||
| 734 | p1pll->pll_out_min = 64800; | ||
| 654 | } | 735 | } |
| 655 | 736 | ||
| 656 | p1pll->pll_in_min = | 737 | p1pll->pll_in_min = |
| @@ -767,6 +848,46 @@ bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, | |||
| 767 | return false; | 848 | return false; |
| 768 | } | 849 | } |
| 769 | 850 | ||
| 851 | static struct radeon_atom_ss *radeon_atombios_get_ss_info(struct | ||
| 852 | radeon_encoder | ||
| 853 | *encoder, | ||
| 854 | int id) | ||
| 855 | { | ||
| 856 | struct drm_device *dev = encoder->base.dev; | ||
| 857 | struct radeon_device *rdev = dev->dev_private; | ||
| 858 | struct radeon_mode_info *mode_info = &rdev->mode_info; | ||
| 859 | int index = GetIndexIntoMasterTable(DATA, PPLL_SS_Info); | ||
| 860 | uint16_t data_offset; | ||
| 861 | struct _ATOM_SPREAD_SPECTRUM_INFO *ss_info; | ||
| 862 | uint8_t frev, crev; | ||
| 863 | struct radeon_atom_ss *ss = NULL; | ||
| 864 | |||
| 865 | if (id > ATOM_MAX_SS_ENTRY) | ||
| 866 | return NULL; | ||
| 867 | |||
| 868 | atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, | ||
| 869 | &crev, &data_offset); | ||
| 870 | |||
| 871 | ss_info = | ||
| 872 | (struct _ATOM_SPREAD_SPECTRUM_INFO *)(mode_info->atom_context->bios + data_offset); | ||
| 873 | |||
| 874 | if (ss_info) { | ||
| 875 | ss = | ||
| 876 | kzalloc(sizeof(struct radeon_atom_ss), GFP_KERNEL); | ||
| 877 | |||
| 878 | if (!ss) | ||
| 879 | return NULL; | ||
| 880 | |||
| 881 | ss->percentage = le16_to_cpu(ss_info->asSS_Info[id].usSpreadSpectrumPercentage); | ||
| 882 | ss->type = ss_info->asSS_Info[id].ucSpreadSpectrumType; | ||
| 883 | ss->step = ss_info->asSS_Info[id].ucSS_Step; | ||
| 884 | ss->delay = ss_info->asSS_Info[id].ucSS_Delay; | ||
| 885 | ss->range = ss_info->asSS_Info[id].ucSS_Range; | ||
| 886 | ss->refdiv = ss_info->asSS_Info[id].ucRecommendedRef_Div; | ||
| 887 | } | ||
| 888 | return ss; | ||
| 889 | } | ||
| 890 | |||
| 770 | union lvds_info { | 891 | union lvds_info { |
| 771 | struct _ATOM_LVDS_INFO info; | 892 | struct _ATOM_LVDS_INFO info; |
| 772 | struct _ATOM_LVDS_INFO_V12 info_12; | 893 | struct _ATOM_LVDS_INFO_V12 info_12; |
| @@ -798,27 +919,31 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct | |||
| 798 | if (!lvds) | 919 | if (!lvds) |
| 799 | return NULL; | 920 | return NULL; |
| 800 | 921 | ||
| 801 | lvds->native_mode.dotclock = | 922 | lvds->native_mode.clock = |
| 802 | le16_to_cpu(lvds_info->info.sLCDTiming.usPixClk) * 10; | 923 | le16_to_cpu(lvds_info->info.sLCDTiming.usPixClk) * 10; |
| 803 | lvds->native_mode.panel_xres = | 924 | lvds->native_mode.hdisplay = |
| 804 | le16_to_cpu(lvds_info->info.sLCDTiming.usHActive); | 925 | le16_to_cpu(lvds_info->info.sLCDTiming.usHActive); |
| 805 | lvds->native_mode.panel_yres = | 926 | lvds->native_mode.vdisplay = |
| 806 | le16_to_cpu(lvds_info->info.sLCDTiming.usVActive); | 927 | le16_to_cpu(lvds_info->info.sLCDTiming.usVActive); |
| 807 | lvds->native_mode.hblank = | 928 | lvds->native_mode.htotal = lvds->native_mode.hdisplay + |
| 808 | le16_to_cpu(lvds_info->info.sLCDTiming.usHBlanking_Time); | 929 | le16_to_cpu(lvds_info->info.sLCDTiming.usHBlanking_Time); |
| 809 | lvds->native_mode.hoverplus = | 930 | lvds->native_mode.hsync_start = lvds->native_mode.hdisplay + |
| 810 | le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncOffset); | 931 | le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncOffset); |
| 811 | lvds->native_mode.hsync_width = | 932 | lvds->native_mode.hsync_end = lvds->native_mode.hsync_start + |
| 812 | le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncWidth); | 933 | le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncWidth); |
| 813 | lvds->native_mode.vblank = | 934 | lvds->native_mode.vtotal = lvds->native_mode.vdisplay + |
| 814 | le16_to_cpu(lvds_info->info.sLCDTiming.usVBlanking_Time); | 935 | le16_to_cpu(lvds_info->info.sLCDTiming.usVBlanking_Time); |
| 815 | lvds->native_mode.voverplus = | 936 | lvds->native_mode.vsync_start = lvds->native_mode.vdisplay + |
| 816 | le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncOffset); | 937 | le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncWidth); |
| 817 | lvds->native_mode.vsync_width = | 938 | lvds->native_mode.vsync_end = lvds->native_mode.vsync_start + |
| 818 | le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncWidth); | 939 | le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncWidth); |
| 819 | lvds->panel_pwr_delay = | 940 | lvds->panel_pwr_delay = |
| 820 | le16_to_cpu(lvds_info->info.usOffDelayInMs); | 941 | le16_to_cpu(lvds_info->info.usOffDelayInMs); |
| 821 | lvds->lvds_misc = lvds_info->info.ucLVDS_Misc; | 942 | lvds->lvds_misc = lvds_info->info.ucLVDS_Misc; |
| 943 | /* set crtc values */ | ||
| 944 | drm_mode_set_crtcinfo(&lvds->native_mode, CRTC_INTERLACE_HALVE_V); | ||
| 945 | |||
| 946 | lvds->ss = radeon_atombios_get_ss_info(encoder, lvds_info->info.ucSS_Id); | ||
| 822 | 947 | ||
| 823 | encoder->native_mode = lvds->native_mode; | 948 | encoder->native_mode = lvds->native_mode; |
| 824 | } | 949 | } |
| @@ -857,8 +982,7 @@ radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder) | |||
| 857 | } | 982 | } |
| 858 | 983 | ||
| 859 | bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, | 984 | bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, |
| 860 | SET_CRTC_TIMING_PARAMETERS_PS_ALLOCATION *crtc_timing, | 985 | struct drm_display_mode *mode) |
| 861 | int32_t *pixel_clock) | ||
| 862 | { | 986 | { |
| 863 | struct radeon_mode_info *mode_info = &rdev->mode_info; | 987 | struct radeon_mode_info *mode_info = &rdev->mode_info; |
| 864 | ATOM_ANALOG_TV_INFO *tv_info; | 988 | ATOM_ANALOG_TV_INFO *tv_info; |
| @@ -866,7 +990,7 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, | |||
| 866 | ATOM_DTD_FORMAT *dtd_timings; | 990 | ATOM_DTD_FORMAT *dtd_timings; |
| 867 | int data_index = GetIndexIntoMasterTable(DATA, AnalogTV_Info); | 991 | int data_index = GetIndexIntoMasterTable(DATA, AnalogTV_Info); |
| 868 | u8 frev, crev; | 992 | u8 frev, crev; |
| 869 | uint16_t data_offset; | 993 | u16 data_offset, misc; |
| 870 | 994 | ||
| 871 | atom_parse_data_header(mode_info->atom_context, data_index, NULL, &frev, &crev, &data_offset); | 995 | atom_parse_data_header(mode_info->atom_context, data_index, NULL, &frev, &crev, &data_offset); |
| 872 | 996 | ||
| @@ -876,28 +1000,37 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, | |||
| 876 | if (index > MAX_SUPPORTED_TV_TIMING) | 1000 | if (index > MAX_SUPPORTED_TV_TIMING) |
| 877 | return false; | 1001 | return false; |
| 878 | 1002 | ||
| 879 | crtc_timing->usH_Total = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Total); | 1003 | mode->crtc_htotal = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Total); |
| 880 | crtc_timing->usH_Disp = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Disp); | 1004 | mode->crtc_hdisplay = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Disp); |
| 881 | crtc_timing->usH_SyncStart = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_SyncStart); | 1005 | mode->crtc_hsync_start = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_SyncStart); |
| 882 | crtc_timing->usH_SyncWidth = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_SyncWidth); | 1006 | mode->crtc_hsync_end = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_SyncStart) + |
| 883 | 1007 | le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_SyncWidth); | |
| 884 | crtc_timing->usV_Total = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_Total); | 1008 | |
| 885 | crtc_timing->usV_Disp = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_Disp); | 1009 | mode->crtc_vtotal = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_Total); |
| 886 | crtc_timing->usV_SyncStart = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_SyncStart); | 1010 | mode->crtc_vdisplay = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_Disp); |
| 887 | crtc_timing->usV_SyncWidth = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_SyncWidth); | 1011 | mode->crtc_vsync_start = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_SyncStart); |
| 888 | 1012 | mode->crtc_vsync_end = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_SyncStart) + | |
| 889 | crtc_timing->susModeMiscInfo = tv_info->aModeTimings[index].susModeMiscInfo; | 1013 | le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_SyncWidth); |
| 890 | 1014 | ||
| 891 | crtc_timing->ucOverscanRight = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_OverscanRight); | 1015 | mode->flags = 0; |
| 892 | crtc_timing->ucOverscanLeft = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_OverscanLeft); | 1016 | misc = le16_to_cpu(tv_info->aModeTimings[index].susModeMiscInfo.usAccess); |
| 893 | crtc_timing->ucOverscanBottom = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_OverscanBottom); | 1017 | if (misc & ATOM_VSYNC_POLARITY) |
| 894 | crtc_timing->ucOverscanTop = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_OverscanTop); | 1018 | mode->flags |= DRM_MODE_FLAG_NVSYNC; |
| 895 | *pixel_clock = le16_to_cpu(tv_info->aModeTimings[index].usPixelClock) * 10; | 1019 | if (misc & ATOM_HSYNC_POLARITY) |
| 1020 | mode->flags |= DRM_MODE_FLAG_NHSYNC; | ||
| 1021 | if (misc & ATOM_COMPOSITESYNC) | ||
| 1022 | mode->flags |= DRM_MODE_FLAG_CSYNC; | ||
| 1023 | if (misc & ATOM_INTERLACE) | ||
| 1024 | mode->flags |= DRM_MODE_FLAG_INTERLACE; | ||
| 1025 | if (misc & ATOM_DOUBLE_CLOCK_MODE) | ||
| 1026 | mode->flags |= DRM_MODE_FLAG_DBLSCAN; | ||
| 1027 | |||
| 1028 | mode->clock = le16_to_cpu(tv_info->aModeTimings[index].usPixelClock) * 10; | ||
| 896 | 1029 | ||
| 897 | if (index == 1) { | 1030 | if (index == 1) { |
| 898 | /* PAL timings appear to have wrong values for totals */ | 1031 | /* PAL timings appear to have wrong values for totals */ |
| 899 | crtc_timing->usH_Total -= 1; | 1032 | mode->crtc_htotal -= 1; |
| 900 | crtc_timing->usV_Total -= 1; | 1033 | mode->crtc_vtotal -= 1; |
| 901 | } | 1034 | } |
| 902 | break; | 1035 | break; |
| 903 | case 2: | 1036 | case 2: |
| @@ -906,17 +1039,36 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, | |||
| 906 | return false; | 1039 | return false; |
| 907 | 1040 | ||
| 908 | dtd_timings = &tv_info_v1_2->aModeTimings[index]; | 1041 | dtd_timings = &tv_info_v1_2->aModeTimings[index]; |
| 909 | crtc_timing->usH_Total = le16_to_cpu(dtd_timings->usHActive) + le16_to_cpu(dtd_timings->usHBlanking_Time); | 1042 | mode->crtc_htotal = le16_to_cpu(dtd_timings->usHActive) + |
| 910 | crtc_timing->usH_Disp = le16_to_cpu(dtd_timings->usHActive); | 1043 | le16_to_cpu(dtd_timings->usHBlanking_Time); |
| 911 | crtc_timing->usH_SyncStart = le16_to_cpu(dtd_timings->usHActive) + le16_to_cpu(dtd_timings->usHSyncOffset); | 1044 | mode->crtc_hdisplay = le16_to_cpu(dtd_timings->usHActive); |
| 912 | crtc_timing->usH_SyncWidth = le16_to_cpu(dtd_timings->usHSyncWidth); | 1045 | mode->crtc_hsync_start = le16_to_cpu(dtd_timings->usHActive) + |
| 913 | crtc_timing->usV_Total = le16_to_cpu(dtd_timings->usVActive) + le16_to_cpu(dtd_timings->usVBlanking_Time); | 1046 | le16_to_cpu(dtd_timings->usHSyncOffset); |
| 914 | crtc_timing->usV_Disp = le16_to_cpu(dtd_timings->usVActive); | 1047 | mode->crtc_hsync_end = mode->crtc_hsync_start + |
| 915 | crtc_timing->usV_SyncStart = le16_to_cpu(dtd_timings->usVActive) + le16_to_cpu(dtd_timings->usVSyncOffset); | 1048 | le16_to_cpu(dtd_timings->usHSyncWidth); |
| 916 | crtc_timing->usV_SyncWidth = le16_to_cpu(dtd_timings->usVSyncWidth); | 1049 | |
| 917 | 1050 | mode->crtc_vtotal = le16_to_cpu(dtd_timings->usVActive) + | |
| 918 | crtc_timing->susModeMiscInfo.usAccess = le16_to_cpu(dtd_timings->susModeMiscInfo.usAccess); | 1051 | le16_to_cpu(dtd_timings->usVBlanking_Time); |
| 919 | *pixel_clock = le16_to_cpu(dtd_timings->usPixClk) * 10; | 1052 | mode->crtc_vdisplay = le16_to_cpu(dtd_timings->usVActive); |
| 1053 | mode->crtc_vsync_start = le16_to_cpu(dtd_timings->usVActive) + | ||
| 1054 | le16_to_cpu(dtd_timings->usVSyncOffset); | ||
| 1055 | mode->crtc_vsync_end = mode->crtc_vsync_start + | ||
| 1056 | le16_to_cpu(dtd_timings->usVSyncWidth); | ||
| 1057 | |||
| 1058 | mode->flags = 0; | ||
| 1059 | misc = le16_to_cpu(dtd_timings->susModeMiscInfo.usAccess); | ||
| 1060 | if (misc & ATOM_VSYNC_POLARITY) | ||
| 1061 | mode->flags |= DRM_MODE_FLAG_NVSYNC; | ||
| 1062 | if (misc & ATOM_HSYNC_POLARITY) | ||
| 1063 | mode->flags |= DRM_MODE_FLAG_NHSYNC; | ||
| 1064 | if (misc & ATOM_COMPOSITESYNC) | ||
| 1065 | mode->flags |= DRM_MODE_FLAG_CSYNC; | ||
| 1066 | if (misc & ATOM_INTERLACE) | ||
| 1067 | mode->flags |= DRM_MODE_FLAG_INTERLACE; | ||
| 1068 | if (misc & ATOM_DOUBLE_CLOCK_MODE) | ||
| 1069 | mode->flags |= DRM_MODE_FLAG_DBLSCAN; | ||
| 1070 | |||
| 1071 | mode->clock = le16_to_cpu(dtd_timings->usPixClk) * 10; | ||
| 920 | break; | 1072 | break; |
| 921 | } | 1073 | } |
| 922 | return true; | 1074 | return true; |
| @@ -981,6 +1133,24 @@ void radeon_atom_static_pwrmgt_setup(struct radeon_device *rdev, int enable) | |||
| 981 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 1133 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
| 982 | } | 1134 | } |
| 983 | 1135 | ||
| 1136 | uint32_t radeon_atom_get_engine_clock(struct radeon_device *rdev) | ||
| 1137 | { | ||
| 1138 | GET_ENGINE_CLOCK_PS_ALLOCATION args; | ||
| 1139 | int index = GetIndexIntoMasterTable(COMMAND, GetEngineClock); | ||
| 1140 | |||
| 1141 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 1142 | return args.ulReturnEngineClock; | ||
| 1143 | } | ||
| 1144 | |||
| 1145 | uint32_t radeon_atom_get_memory_clock(struct radeon_device *rdev) | ||
| 1146 | { | ||
| 1147 | GET_MEMORY_CLOCK_PS_ALLOCATION args; | ||
| 1148 | int index = GetIndexIntoMasterTable(COMMAND, GetMemoryClock); | ||
| 1149 | |||
| 1150 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 1151 | return args.ulReturnMemoryClock; | ||
| 1152 | } | ||
| 1153 | |||
| 984 | void radeon_atom_set_engine_clock(struct radeon_device *rdev, | 1154 | void radeon_atom_set_engine_clock(struct radeon_device *rdev, |
| 985 | uint32_t eng_clock) | 1155 | uint32_t eng_clock) |
| 986 | { | 1156 | { |
diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c index 2e938f7496fb..10bd50a7db87 100644 --- a/drivers/gpu/drm/radeon/radeon_benchmark.c +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c | |||
| @@ -63,7 +63,7 @@ void radeon_benchmark_move(struct radeon_device *rdev, unsigned bsize, | |||
| 63 | if (r) { | 63 | if (r) { |
| 64 | goto out_cleanup; | 64 | goto out_cleanup; |
| 65 | } | 65 | } |
| 66 | r = radeon_copy_dma(rdev, saddr, daddr, size / 4096, fence); | 66 | r = radeon_copy_dma(rdev, saddr, daddr, size / RADEON_GPU_PAGE_SIZE, fence); |
| 67 | if (r) { | 67 | if (r) { |
| 68 | goto out_cleanup; | 68 | goto out_cleanup; |
| 69 | } | 69 | } |
| @@ -88,7 +88,7 @@ void radeon_benchmark_move(struct radeon_device *rdev, unsigned bsize, | |||
| 88 | if (r) { | 88 | if (r) { |
| 89 | goto out_cleanup; | 89 | goto out_cleanup; |
| 90 | } | 90 | } |
| 91 | r = radeon_copy_blit(rdev, saddr, daddr, size / 4096, fence); | 91 | r = radeon_copy_blit(rdev, saddr, daddr, size / RADEON_GPU_PAGE_SIZE, fence); |
| 92 | if (r) { | 92 | if (r) { |
| 93 | goto out_cleanup; | 93 | goto out_cleanup; |
| 94 | } | 94 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c index 34a9b9119518..906921740c60 100644 --- a/drivers/gpu/drm/radeon/radeon_bios.c +++ b/drivers/gpu/drm/radeon/radeon_bios.c | |||
| @@ -50,19 +50,16 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev) | |||
| 50 | vram_base = drm_get_resource_start(rdev->ddev, 0); | 50 | vram_base = drm_get_resource_start(rdev->ddev, 0); |
| 51 | bios = ioremap(vram_base, size); | 51 | bios = ioremap(vram_base, size); |
| 52 | if (!bios) { | 52 | if (!bios) { |
| 53 | DRM_ERROR("Unable to mmap vram\n"); | ||
| 54 | return false; | 53 | return false; |
| 55 | } | 54 | } |
| 56 | 55 | ||
| 57 | if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { | 56 | if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { |
| 58 | iounmap(bios); | 57 | iounmap(bios); |
| 59 | DRM_ERROR("bad rom signature\n"); | ||
| 60 | return false; | 58 | return false; |
| 61 | } | 59 | } |
| 62 | rdev->bios = kmalloc(size, GFP_KERNEL); | 60 | rdev->bios = kmalloc(size, GFP_KERNEL); |
| 63 | if (rdev->bios == NULL) { | 61 | if (rdev->bios == NULL) { |
| 64 | iounmap(bios); | 62 | iounmap(bios); |
| 65 | DRM_ERROR("kmalloc failed\n"); | ||
| 66 | return false; | 63 | return false; |
| 67 | } | 64 | } |
| 68 | memcpy(rdev->bios, bios, size); | 65 | memcpy(rdev->bios, bios, size); |
diff --git a/drivers/gpu/drm/radeon/radeon_clocks.c b/drivers/gpu/drm/radeon/radeon_clocks.c index f5c32a766b10..a81354167621 100644 --- a/drivers/gpu/drm/radeon/radeon_clocks.c +++ b/drivers/gpu/drm/radeon/radeon_clocks.c | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | #include "atom.h" | 32 | #include "atom.h" |
| 33 | 33 | ||
| 34 | /* 10 khz */ | 34 | /* 10 khz */ |
| 35 | static uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev) | 35 | uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev) |
| 36 | { | 36 | { |
| 37 | struct radeon_pll *spll = &rdev->clock.spll; | 37 | struct radeon_pll *spll = &rdev->clock.spll; |
| 38 | uint32_t fb_div, ref_div, post_div, sclk; | 38 | uint32_t fb_div, ref_div, post_div, sclk; |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 748265a105b3..5253cbf6db1f 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
| @@ -49,7 +49,8 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 49 | uint32_t connector_id, | 49 | uint32_t connector_id, |
| 50 | uint32_t supported_device, | 50 | uint32_t supported_device, |
| 51 | int connector_type, | 51 | int connector_type, |
| 52 | struct radeon_i2c_bus_rec *i2c_bus); | 52 | struct radeon_i2c_bus_rec *i2c_bus, |
| 53 | uint16_t connector_object_id); | ||
| 53 | 54 | ||
| 54 | /* from radeon_legacy_encoder.c */ | 55 | /* from radeon_legacy_encoder.c */ |
| 55 | extern void | 56 | extern void |
| @@ -808,25 +809,25 @@ static struct radeon_encoder_lvds *radeon_legacy_get_lvds_info_from_regs(struct | |||
| 808 | lvds->panel_blon_delay = (lvds_ss_gen_cntl >> RADEON_LVDS_PWRSEQ_DELAY2_SHIFT) & 0xf; | 809 | lvds->panel_blon_delay = (lvds_ss_gen_cntl >> RADEON_LVDS_PWRSEQ_DELAY2_SHIFT) & 0xf; |
| 809 | 810 | ||
| 810 | if (fp_vert_stretch & RADEON_VERT_STRETCH_ENABLE) | 811 | if (fp_vert_stretch & RADEON_VERT_STRETCH_ENABLE) |
| 811 | lvds->native_mode.panel_yres = | 812 | lvds->native_mode.vdisplay = |
| 812 | ((fp_vert_stretch & RADEON_VERT_PANEL_SIZE) >> | 813 | ((fp_vert_stretch & RADEON_VERT_PANEL_SIZE) >> |
| 813 | RADEON_VERT_PANEL_SHIFT) + 1; | 814 | RADEON_VERT_PANEL_SHIFT) + 1; |
| 814 | else | 815 | else |
| 815 | lvds->native_mode.panel_yres = | 816 | lvds->native_mode.vdisplay = |
| 816 | (RREG32(RADEON_CRTC_V_TOTAL_DISP) >> 16) + 1; | 817 | (RREG32(RADEON_CRTC_V_TOTAL_DISP) >> 16) + 1; |
| 817 | 818 | ||
| 818 | if (fp_horz_stretch & RADEON_HORZ_STRETCH_ENABLE) | 819 | if (fp_horz_stretch & RADEON_HORZ_STRETCH_ENABLE) |
| 819 | lvds->native_mode.panel_xres = | 820 | lvds->native_mode.hdisplay = |
| 820 | (((fp_horz_stretch & RADEON_HORZ_PANEL_SIZE) >> | 821 | (((fp_horz_stretch & RADEON_HORZ_PANEL_SIZE) >> |
| 821 | RADEON_HORZ_PANEL_SHIFT) + 1) * 8; | 822 | RADEON_HORZ_PANEL_SHIFT) + 1) * 8; |
| 822 | else | 823 | else |
| 823 | lvds->native_mode.panel_xres = | 824 | lvds->native_mode.hdisplay = |
| 824 | ((RREG32(RADEON_CRTC_H_TOTAL_DISP) >> 16) + 1) * 8; | 825 | ((RREG32(RADEON_CRTC_H_TOTAL_DISP) >> 16) + 1) * 8; |
| 825 | 826 | ||
| 826 | if ((lvds->native_mode.panel_xres < 640) || | 827 | if ((lvds->native_mode.hdisplay < 640) || |
| 827 | (lvds->native_mode.panel_yres < 480)) { | 828 | (lvds->native_mode.vdisplay < 480)) { |
| 828 | lvds->native_mode.panel_xres = 640; | 829 | lvds->native_mode.hdisplay = 640; |
| 829 | lvds->native_mode.panel_yres = 480; | 830 | lvds->native_mode.vdisplay = 480; |
| 830 | } | 831 | } |
| 831 | 832 | ||
| 832 | ppll_div_sel = RREG8(RADEON_CLOCK_CNTL_INDEX + 1) & 0x3; | 833 | ppll_div_sel = RREG8(RADEON_CLOCK_CNTL_INDEX + 1) & 0x3; |
| @@ -846,8 +847,8 @@ static struct radeon_encoder_lvds *radeon_legacy_get_lvds_info_from_regs(struct | |||
| 846 | lvds->panel_vcc_delay = 200; | 847 | lvds->panel_vcc_delay = 200; |
| 847 | 848 | ||
| 848 | DRM_INFO("Panel info derived from registers\n"); | 849 | DRM_INFO("Panel info derived from registers\n"); |
| 849 | DRM_INFO("Panel Size %dx%d\n", lvds->native_mode.panel_xres, | 850 | DRM_INFO("Panel Size %dx%d\n", lvds->native_mode.hdisplay, |
| 850 | lvds->native_mode.panel_yres); | 851 | lvds->native_mode.vdisplay); |
| 851 | 852 | ||
| 852 | return lvds; | 853 | return lvds; |
| 853 | } | 854 | } |
| @@ -882,11 +883,11 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoder | |||
| 882 | 883 | ||
| 883 | DRM_INFO("Panel ID String: %s\n", stmp); | 884 | DRM_INFO("Panel ID String: %s\n", stmp); |
| 884 | 885 | ||
| 885 | lvds->native_mode.panel_xres = RBIOS16(lcd_info + 0x19); | 886 | lvds->native_mode.hdisplay = RBIOS16(lcd_info + 0x19); |
| 886 | lvds->native_mode.panel_yres = RBIOS16(lcd_info + 0x1b); | 887 | lvds->native_mode.vdisplay = RBIOS16(lcd_info + 0x1b); |
| 887 | 888 | ||
| 888 | DRM_INFO("Panel Size %dx%d\n", lvds->native_mode.panel_xres, | 889 | DRM_INFO("Panel Size %dx%d\n", lvds->native_mode.hdisplay, |
| 889 | lvds->native_mode.panel_yres); | 890 | lvds->native_mode.vdisplay); |
| 890 | 891 | ||
| 891 | lvds->panel_vcc_delay = RBIOS16(lcd_info + 0x2c); | 892 | lvds->panel_vcc_delay = RBIOS16(lcd_info + 0x2c); |
| 892 | if (lvds->panel_vcc_delay > 2000 || lvds->panel_vcc_delay < 0) | 893 | if (lvds->panel_vcc_delay > 2000 || lvds->panel_vcc_delay < 0) |
| @@ -944,27 +945,25 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoder | |||
| 944 | if (tmp == 0) | 945 | if (tmp == 0) |
| 945 | break; | 946 | break; |
| 946 | 947 | ||
| 947 | if ((RBIOS16(tmp) == lvds->native_mode.panel_xres) && | 948 | if ((RBIOS16(tmp) == lvds->native_mode.hdisplay) && |
| 948 | (RBIOS16(tmp + 2) == | 949 | (RBIOS16(tmp + 2) == |
| 949 | lvds->native_mode.panel_yres)) { | 950 | lvds->native_mode.vdisplay)) { |
| 950 | lvds->native_mode.hblank = | 951 | lvds->native_mode.htotal = RBIOS16(tmp + 17) * 8; |
| 951 | (RBIOS16(tmp + 17) - RBIOS16(tmp + 19)) * 8; | 952 | lvds->native_mode.hsync_start = RBIOS16(tmp + 21) * 8; |
| 952 | lvds->native_mode.hoverplus = | 953 | lvds->native_mode.hsync_end = (RBIOS8(tmp + 23) + |
| 953 | (RBIOS16(tmp + 21) - RBIOS16(tmp + 19) - | 954 | RBIOS16(tmp + 21)) * 8; |
| 954 | 1) * 8; | 955 | |
| 955 | lvds->native_mode.hsync_width = | 956 | lvds->native_mode.vtotal = RBIOS16(tmp + 24); |
| 956 | RBIOS8(tmp + 23) * 8; | 957 | lvds->native_mode.vsync_start = RBIOS16(tmp + 28) & 0x7ff; |
| 957 | 958 | lvds->native_mode.vsync_end = | |
| 958 | lvds->native_mode.vblank = (RBIOS16(tmp + 24) - | 959 | ((RBIOS16(tmp + 28) & 0xf800) >> 11) + |
| 959 | RBIOS16(tmp + 26)); | 960 | (RBIOS16(tmp + 28) & 0x7ff); |
| 960 | lvds->native_mode.voverplus = | 961 | |
| 961 | ((RBIOS16(tmp + 28) & 0x7ff) - | 962 | lvds->native_mode.clock = RBIOS16(tmp + 9) * 10; |
| 962 | RBIOS16(tmp + 26)); | ||
| 963 | lvds->native_mode.vsync_width = | ||
| 964 | ((RBIOS16(tmp + 28) & 0xf800) >> 11); | ||
| 965 | lvds->native_mode.dotclock = | ||
| 966 | RBIOS16(tmp + 9) * 10; | ||
| 967 | lvds->native_mode.flags = 0; | 963 | lvds->native_mode.flags = 0; |
| 964 | /* set crtc values */ | ||
| 965 | drm_mode_set_crtcinfo(&lvds->native_mode, CRTC_INTERLACE_HALVE_V); | ||
| 966 | |||
| 968 | } | 967 | } |
| 969 | } | 968 | } |
| 970 | } else { | 969 | } else { |
| @@ -1178,7 +1177,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1178 | radeon_add_legacy_connector(dev, 0, | 1177 | radeon_add_legacy_connector(dev, 0, |
| 1179 | ATOM_DEVICE_CRT1_SUPPORT, | 1178 | ATOM_DEVICE_CRT1_SUPPORT, |
| 1180 | DRM_MODE_CONNECTOR_VGA, | 1179 | DRM_MODE_CONNECTOR_VGA, |
| 1181 | &ddc_i2c); | 1180 | &ddc_i2c, |
| 1181 | CONNECTOR_OBJECT_ID_VGA); | ||
| 1182 | } else if (rdev->flags & RADEON_IS_MOBILITY) { | 1182 | } else if (rdev->flags & RADEON_IS_MOBILITY) { |
| 1183 | /* LVDS */ | 1183 | /* LVDS */ |
| 1184 | ddc_i2c = combios_setup_i2c_bus(RADEON_LCD_GPIO_MASK); | 1184 | ddc_i2c = combios_setup_i2c_bus(RADEON_LCD_GPIO_MASK); |
| @@ -1190,7 +1190,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1190 | radeon_add_legacy_connector(dev, 0, | 1190 | radeon_add_legacy_connector(dev, 0, |
| 1191 | ATOM_DEVICE_LCD1_SUPPORT, | 1191 | ATOM_DEVICE_LCD1_SUPPORT, |
| 1192 | DRM_MODE_CONNECTOR_LVDS, | 1192 | DRM_MODE_CONNECTOR_LVDS, |
| 1193 | &ddc_i2c); | 1193 | &ddc_i2c, |
| 1194 | CONNECTOR_OBJECT_ID_LVDS); | ||
| 1194 | 1195 | ||
| 1195 | /* VGA - primary dac */ | 1196 | /* VGA - primary dac */ |
| 1196 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1197 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); |
| @@ -1202,7 +1203,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1202 | radeon_add_legacy_connector(dev, 1, | 1203 | radeon_add_legacy_connector(dev, 1, |
| 1203 | ATOM_DEVICE_CRT1_SUPPORT, | 1204 | ATOM_DEVICE_CRT1_SUPPORT, |
| 1204 | DRM_MODE_CONNECTOR_VGA, | 1205 | DRM_MODE_CONNECTOR_VGA, |
| 1205 | &ddc_i2c); | 1206 | &ddc_i2c, |
| 1207 | CONNECTOR_OBJECT_ID_VGA); | ||
| 1206 | } else { | 1208 | } else { |
| 1207 | /* DVI-I - tv dac, int tmds */ | 1209 | /* DVI-I - tv dac, int tmds */ |
| 1208 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1210 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); |
| @@ -1220,7 +1222,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1220 | ATOM_DEVICE_DFP1_SUPPORT | | 1222 | ATOM_DEVICE_DFP1_SUPPORT | |
| 1221 | ATOM_DEVICE_CRT2_SUPPORT, | 1223 | ATOM_DEVICE_CRT2_SUPPORT, |
| 1222 | DRM_MODE_CONNECTOR_DVII, | 1224 | DRM_MODE_CONNECTOR_DVII, |
| 1223 | &ddc_i2c); | 1225 | &ddc_i2c, |
| 1226 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); | ||
| 1224 | 1227 | ||
| 1225 | /* VGA - primary dac */ | 1228 | /* VGA - primary dac */ |
| 1226 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1229 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); |
| @@ -1232,7 +1235,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1232 | radeon_add_legacy_connector(dev, 1, | 1235 | radeon_add_legacy_connector(dev, 1, |
| 1233 | ATOM_DEVICE_CRT1_SUPPORT, | 1236 | ATOM_DEVICE_CRT1_SUPPORT, |
| 1234 | DRM_MODE_CONNECTOR_VGA, | 1237 | DRM_MODE_CONNECTOR_VGA, |
| 1235 | &ddc_i2c); | 1238 | &ddc_i2c, |
| 1239 | CONNECTOR_OBJECT_ID_VGA); | ||
| 1236 | } | 1240 | } |
| 1237 | 1241 | ||
| 1238 | if (rdev->family != CHIP_R100 && rdev->family != CHIP_R200) { | 1242 | if (rdev->family != CHIP_R100 && rdev->family != CHIP_R200) { |
| @@ -1245,7 +1249,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1245 | radeon_add_legacy_connector(dev, 2, | 1249 | radeon_add_legacy_connector(dev, 2, |
| 1246 | ATOM_DEVICE_TV1_SUPPORT, | 1250 | ATOM_DEVICE_TV1_SUPPORT, |
| 1247 | DRM_MODE_CONNECTOR_SVIDEO, | 1251 | DRM_MODE_CONNECTOR_SVIDEO, |
| 1248 | &ddc_i2c); | 1252 | &ddc_i2c, |
| 1253 | CONNECTOR_OBJECT_ID_SVIDEO); | ||
| 1249 | } | 1254 | } |
| 1250 | break; | 1255 | break; |
| 1251 | case CT_IBOOK: | 1256 | case CT_IBOOK: |
| @@ -1259,7 +1264,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1259 | 0), | 1264 | 0), |
| 1260 | ATOM_DEVICE_LCD1_SUPPORT); | 1265 | ATOM_DEVICE_LCD1_SUPPORT); |
| 1261 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, | 1266 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, |
| 1262 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c); | 1267 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, |
| 1268 | CONNECTOR_OBJECT_ID_LVDS); | ||
| 1263 | /* VGA - TV DAC */ | 1269 | /* VGA - TV DAC */ |
| 1264 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1270 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); |
| 1265 | radeon_add_legacy_encoder(dev, | 1271 | radeon_add_legacy_encoder(dev, |
| @@ -1268,7 +1274,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1268 | 2), | 1274 | 2), |
| 1269 | ATOM_DEVICE_CRT2_SUPPORT); | 1275 | ATOM_DEVICE_CRT2_SUPPORT); |
| 1270 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT, | 1276 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT, |
| 1271 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c); | 1277 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c, |
| 1278 | CONNECTOR_OBJECT_ID_VGA); | ||
| 1272 | /* TV - TV DAC */ | 1279 | /* TV - TV DAC */ |
| 1273 | radeon_add_legacy_encoder(dev, | 1280 | radeon_add_legacy_encoder(dev, |
| 1274 | radeon_get_encoder_id(dev, | 1281 | radeon_get_encoder_id(dev, |
| @@ -1277,7 +1284,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1277 | ATOM_DEVICE_TV1_SUPPORT); | 1284 | ATOM_DEVICE_TV1_SUPPORT); |
| 1278 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, | 1285 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, |
| 1279 | DRM_MODE_CONNECTOR_SVIDEO, | 1286 | DRM_MODE_CONNECTOR_SVIDEO, |
| 1280 | &ddc_i2c); | 1287 | &ddc_i2c, |
| 1288 | CONNECTOR_OBJECT_ID_SVIDEO); | ||
| 1281 | break; | 1289 | break; |
| 1282 | case CT_POWERBOOK_EXTERNAL: | 1290 | case CT_POWERBOOK_EXTERNAL: |
| 1283 | DRM_INFO("Connector Table: %d (powerbook external tmds)\n", | 1291 | DRM_INFO("Connector Table: %d (powerbook external tmds)\n", |
| @@ -1290,7 +1298,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1290 | 0), | 1298 | 0), |
| 1291 | ATOM_DEVICE_LCD1_SUPPORT); | 1299 | ATOM_DEVICE_LCD1_SUPPORT); |
| 1292 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, | 1300 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, |
| 1293 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c); | 1301 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, |
| 1302 | CONNECTOR_OBJECT_ID_LVDS); | ||
| 1294 | /* DVI-I - primary dac, ext tmds */ | 1303 | /* DVI-I - primary dac, ext tmds */ |
| 1295 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1304 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); |
| 1296 | radeon_add_legacy_encoder(dev, | 1305 | radeon_add_legacy_encoder(dev, |
| @@ -1303,10 +1312,12 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1303 | ATOM_DEVICE_CRT1_SUPPORT, | 1312 | ATOM_DEVICE_CRT1_SUPPORT, |
| 1304 | 1), | 1313 | 1), |
| 1305 | ATOM_DEVICE_CRT1_SUPPORT); | 1314 | ATOM_DEVICE_CRT1_SUPPORT); |
| 1315 | /* XXX some are SL */ | ||
| 1306 | radeon_add_legacy_connector(dev, 1, | 1316 | radeon_add_legacy_connector(dev, 1, |
| 1307 | ATOM_DEVICE_DFP2_SUPPORT | | 1317 | ATOM_DEVICE_DFP2_SUPPORT | |
| 1308 | ATOM_DEVICE_CRT1_SUPPORT, | 1318 | ATOM_DEVICE_CRT1_SUPPORT, |
| 1309 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c); | 1319 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c, |
| 1320 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I); | ||
| 1310 | /* TV - TV DAC */ | 1321 | /* TV - TV DAC */ |
| 1311 | radeon_add_legacy_encoder(dev, | 1322 | radeon_add_legacy_encoder(dev, |
| 1312 | radeon_get_encoder_id(dev, | 1323 | radeon_get_encoder_id(dev, |
| @@ -1315,7 +1326,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1315 | ATOM_DEVICE_TV1_SUPPORT); | 1326 | ATOM_DEVICE_TV1_SUPPORT); |
| 1316 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, | 1327 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, |
| 1317 | DRM_MODE_CONNECTOR_SVIDEO, | 1328 | DRM_MODE_CONNECTOR_SVIDEO, |
| 1318 | &ddc_i2c); | 1329 | &ddc_i2c, |
| 1330 | CONNECTOR_OBJECT_ID_SVIDEO); | ||
| 1319 | break; | 1331 | break; |
| 1320 | case CT_POWERBOOK_INTERNAL: | 1332 | case CT_POWERBOOK_INTERNAL: |
| 1321 | DRM_INFO("Connector Table: %d (powerbook internal tmds)\n", | 1333 | DRM_INFO("Connector Table: %d (powerbook internal tmds)\n", |
| @@ -1328,7 +1340,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1328 | 0), | 1340 | 0), |
| 1329 | ATOM_DEVICE_LCD1_SUPPORT); | 1341 | ATOM_DEVICE_LCD1_SUPPORT); |
| 1330 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, | 1342 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, |
| 1331 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c); | 1343 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, |
| 1344 | CONNECTOR_OBJECT_ID_LVDS); | ||
| 1332 | /* DVI-I - primary dac, int tmds */ | 1345 | /* DVI-I - primary dac, int tmds */ |
| 1333 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1346 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); |
| 1334 | radeon_add_legacy_encoder(dev, | 1347 | radeon_add_legacy_encoder(dev, |
| @@ -1344,7 +1357,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1344 | radeon_add_legacy_connector(dev, 1, | 1357 | radeon_add_legacy_connector(dev, 1, |
| 1345 | ATOM_DEVICE_DFP1_SUPPORT | | 1358 | ATOM_DEVICE_DFP1_SUPPORT | |
| 1346 | ATOM_DEVICE_CRT1_SUPPORT, | 1359 | ATOM_DEVICE_CRT1_SUPPORT, |
| 1347 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c); | 1360 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c, |
| 1361 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); | ||
| 1348 | /* TV - TV DAC */ | 1362 | /* TV - TV DAC */ |
| 1349 | radeon_add_legacy_encoder(dev, | 1363 | radeon_add_legacy_encoder(dev, |
| 1350 | radeon_get_encoder_id(dev, | 1364 | radeon_get_encoder_id(dev, |
| @@ -1353,7 +1367,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1353 | ATOM_DEVICE_TV1_SUPPORT); | 1367 | ATOM_DEVICE_TV1_SUPPORT); |
| 1354 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, | 1368 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, |
| 1355 | DRM_MODE_CONNECTOR_SVIDEO, | 1369 | DRM_MODE_CONNECTOR_SVIDEO, |
| 1356 | &ddc_i2c); | 1370 | &ddc_i2c, |
| 1371 | CONNECTOR_OBJECT_ID_SVIDEO); | ||
| 1357 | break; | 1372 | break; |
| 1358 | case CT_POWERBOOK_VGA: | 1373 | case CT_POWERBOOK_VGA: |
| 1359 | DRM_INFO("Connector Table: %d (powerbook vga)\n", | 1374 | DRM_INFO("Connector Table: %d (powerbook vga)\n", |
| @@ -1366,7 +1381,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1366 | 0), | 1381 | 0), |
| 1367 | ATOM_DEVICE_LCD1_SUPPORT); | 1382 | ATOM_DEVICE_LCD1_SUPPORT); |
| 1368 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, | 1383 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, |
| 1369 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c); | 1384 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, |
| 1385 | CONNECTOR_OBJECT_ID_LVDS); | ||
| 1370 | /* VGA - primary dac */ | 1386 | /* VGA - primary dac */ |
| 1371 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1387 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); |
| 1372 | radeon_add_legacy_encoder(dev, | 1388 | radeon_add_legacy_encoder(dev, |
| @@ -1375,7 +1391,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1375 | 1), | 1391 | 1), |
| 1376 | ATOM_DEVICE_CRT1_SUPPORT); | 1392 | ATOM_DEVICE_CRT1_SUPPORT); |
| 1377 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT1_SUPPORT, | 1393 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT1_SUPPORT, |
| 1378 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c); | 1394 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c, |
| 1395 | CONNECTOR_OBJECT_ID_VGA); | ||
| 1379 | /* TV - TV DAC */ | 1396 | /* TV - TV DAC */ |
| 1380 | radeon_add_legacy_encoder(dev, | 1397 | radeon_add_legacy_encoder(dev, |
| 1381 | radeon_get_encoder_id(dev, | 1398 | radeon_get_encoder_id(dev, |
| @@ -1384,7 +1401,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1384 | ATOM_DEVICE_TV1_SUPPORT); | 1401 | ATOM_DEVICE_TV1_SUPPORT); |
| 1385 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, | 1402 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, |
| 1386 | DRM_MODE_CONNECTOR_SVIDEO, | 1403 | DRM_MODE_CONNECTOR_SVIDEO, |
| 1387 | &ddc_i2c); | 1404 | &ddc_i2c, |
| 1405 | CONNECTOR_OBJECT_ID_SVIDEO); | ||
| 1388 | break; | 1406 | break; |
| 1389 | case CT_MINI_EXTERNAL: | 1407 | case CT_MINI_EXTERNAL: |
| 1390 | DRM_INFO("Connector Table: %d (mini external tmds)\n", | 1408 | DRM_INFO("Connector Table: %d (mini external tmds)\n", |
| @@ -1401,10 +1419,12 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1401 | ATOM_DEVICE_CRT2_SUPPORT, | 1419 | ATOM_DEVICE_CRT2_SUPPORT, |
| 1402 | 2), | 1420 | 2), |
| 1403 | ATOM_DEVICE_CRT2_SUPPORT); | 1421 | ATOM_DEVICE_CRT2_SUPPORT); |
| 1422 | /* XXX are any DL? */ | ||
| 1404 | radeon_add_legacy_connector(dev, 0, | 1423 | radeon_add_legacy_connector(dev, 0, |
| 1405 | ATOM_DEVICE_DFP2_SUPPORT | | 1424 | ATOM_DEVICE_DFP2_SUPPORT | |
| 1406 | ATOM_DEVICE_CRT2_SUPPORT, | 1425 | ATOM_DEVICE_CRT2_SUPPORT, |
| 1407 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c); | 1426 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c, |
| 1427 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); | ||
| 1408 | /* TV - TV DAC */ | 1428 | /* TV - TV DAC */ |
| 1409 | radeon_add_legacy_encoder(dev, | 1429 | radeon_add_legacy_encoder(dev, |
| 1410 | radeon_get_encoder_id(dev, | 1430 | radeon_get_encoder_id(dev, |
| @@ -1413,7 +1433,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1413 | ATOM_DEVICE_TV1_SUPPORT); | 1433 | ATOM_DEVICE_TV1_SUPPORT); |
| 1414 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_TV1_SUPPORT, | 1434 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_TV1_SUPPORT, |
| 1415 | DRM_MODE_CONNECTOR_SVIDEO, | 1435 | DRM_MODE_CONNECTOR_SVIDEO, |
| 1416 | &ddc_i2c); | 1436 | &ddc_i2c, |
| 1437 | CONNECTOR_OBJECT_ID_SVIDEO); | ||
| 1417 | break; | 1438 | break; |
| 1418 | case CT_MINI_INTERNAL: | 1439 | case CT_MINI_INTERNAL: |
| 1419 | DRM_INFO("Connector Table: %d (mini internal tmds)\n", | 1440 | DRM_INFO("Connector Table: %d (mini internal tmds)\n", |
| @@ -1433,7 +1454,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1433 | radeon_add_legacy_connector(dev, 0, | 1454 | radeon_add_legacy_connector(dev, 0, |
| 1434 | ATOM_DEVICE_DFP1_SUPPORT | | 1455 | ATOM_DEVICE_DFP1_SUPPORT | |
| 1435 | ATOM_DEVICE_CRT2_SUPPORT, | 1456 | ATOM_DEVICE_CRT2_SUPPORT, |
| 1436 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c); | 1457 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c, |
| 1458 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); | ||
| 1437 | /* TV - TV DAC */ | 1459 | /* TV - TV DAC */ |
| 1438 | radeon_add_legacy_encoder(dev, | 1460 | radeon_add_legacy_encoder(dev, |
| 1439 | radeon_get_encoder_id(dev, | 1461 | radeon_get_encoder_id(dev, |
| @@ -1442,7 +1464,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1442 | ATOM_DEVICE_TV1_SUPPORT); | 1464 | ATOM_DEVICE_TV1_SUPPORT); |
| 1443 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_TV1_SUPPORT, | 1465 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_TV1_SUPPORT, |
| 1444 | DRM_MODE_CONNECTOR_SVIDEO, | 1466 | DRM_MODE_CONNECTOR_SVIDEO, |
| 1445 | &ddc_i2c); | 1467 | &ddc_i2c, |
| 1468 | CONNECTOR_OBJECT_ID_SVIDEO); | ||
| 1446 | break; | 1469 | break; |
| 1447 | case CT_IMAC_G5_ISIGHT: | 1470 | case CT_IMAC_G5_ISIGHT: |
| 1448 | DRM_INFO("Connector Table: %d (imac g5 isight)\n", | 1471 | DRM_INFO("Connector Table: %d (imac g5 isight)\n", |
| @@ -1455,7 +1478,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1455 | 0), | 1478 | 0), |
| 1456 | ATOM_DEVICE_DFP1_SUPPORT); | 1479 | ATOM_DEVICE_DFP1_SUPPORT); |
| 1457 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_DFP1_SUPPORT, | 1480 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_DFP1_SUPPORT, |
| 1458 | DRM_MODE_CONNECTOR_DVID, &ddc_i2c); | 1481 | DRM_MODE_CONNECTOR_DVID, &ddc_i2c, |
| 1482 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D); | ||
| 1459 | /* VGA - tv dac */ | 1483 | /* VGA - tv dac */ |
| 1460 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1484 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); |
| 1461 | radeon_add_legacy_encoder(dev, | 1485 | radeon_add_legacy_encoder(dev, |
| @@ -1464,7 +1488,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1464 | 2), | 1488 | 2), |
| 1465 | ATOM_DEVICE_CRT2_SUPPORT); | 1489 | ATOM_DEVICE_CRT2_SUPPORT); |
| 1466 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT, | 1490 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT, |
| 1467 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c); | 1491 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c, |
| 1492 | CONNECTOR_OBJECT_ID_VGA); | ||
| 1468 | /* TV - TV DAC */ | 1493 | /* TV - TV DAC */ |
| 1469 | radeon_add_legacy_encoder(dev, | 1494 | radeon_add_legacy_encoder(dev, |
| 1470 | radeon_get_encoder_id(dev, | 1495 | radeon_get_encoder_id(dev, |
| @@ -1473,7 +1498,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1473 | ATOM_DEVICE_TV1_SUPPORT); | 1498 | ATOM_DEVICE_TV1_SUPPORT); |
| 1474 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, | 1499 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, |
| 1475 | DRM_MODE_CONNECTOR_SVIDEO, | 1500 | DRM_MODE_CONNECTOR_SVIDEO, |
| 1476 | &ddc_i2c); | 1501 | &ddc_i2c, |
| 1502 | CONNECTOR_OBJECT_ID_SVIDEO); | ||
| 1477 | break; | 1503 | break; |
| 1478 | case CT_EMAC: | 1504 | case CT_EMAC: |
| 1479 | DRM_INFO("Connector Table: %d (emac)\n", | 1505 | DRM_INFO("Connector Table: %d (emac)\n", |
| @@ -1486,7 +1512,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1486 | 1), | 1512 | 1), |
| 1487 | ATOM_DEVICE_CRT1_SUPPORT); | 1513 | ATOM_DEVICE_CRT1_SUPPORT); |
| 1488 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_CRT1_SUPPORT, | 1514 | radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_CRT1_SUPPORT, |
| 1489 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c); | 1515 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c, |
| 1516 | CONNECTOR_OBJECT_ID_VGA); | ||
| 1490 | /* VGA - tv dac */ | 1517 | /* VGA - tv dac */ |
| 1491 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_CRT2_DDC); | 1518 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_CRT2_DDC); |
| 1492 | radeon_add_legacy_encoder(dev, | 1519 | radeon_add_legacy_encoder(dev, |
| @@ -1495,7 +1522,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1495 | 2), | 1522 | 2), |
| 1496 | ATOM_DEVICE_CRT2_SUPPORT); | 1523 | ATOM_DEVICE_CRT2_SUPPORT); |
| 1497 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT, | 1524 | radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT, |
| 1498 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c); | 1525 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c, |
| 1526 | CONNECTOR_OBJECT_ID_VGA); | ||
| 1499 | /* TV - TV DAC */ | 1527 | /* TV - TV DAC */ |
| 1500 | radeon_add_legacy_encoder(dev, | 1528 | radeon_add_legacy_encoder(dev, |
| 1501 | radeon_get_encoder_id(dev, | 1529 | radeon_get_encoder_id(dev, |
| @@ -1504,7 +1532,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1504 | ATOM_DEVICE_TV1_SUPPORT); | 1532 | ATOM_DEVICE_TV1_SUPPORT); |
| 1505 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, | 1533 | radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, |
| 1506 | DRM_MODE_CONNECTOR_SVIDEO, | 1534 | DRM_MODE_CONNECTOR_SVIDEO, |
| 1507 | &ddc_i2c); | 1535 | &ddc_i2c, |
| 1536 | CONNECTOR_OBJECT_ID_SVIDEO); | ||
| 1508 | break; | 1537 | break; |
| 1509 | default: | 1538 | default: |
| 1510 | DRM_INFO("Connector table: %d (invalid)\n", | 1539 | DRM_INFO("Connector table: %d (invalid)\n", |
| @@ -1581,11 +1610,63 @@ static bool radeon_apply_legacy_quirks(struct drm_device *dev, | |||
| 1581 | return true; | 1610 | return true; |
| 1582 | } | 1611 | } |
| 1583 | 1612 | ||
| 1613 | static bool radeon_apply_legacy_tv_quirks(struct drm_device *dev) | ||
| 1614 | { | ||
| 1615 | /* Acer 5102 has non-existent TV port */ | ||
| 1616 | if (dev->pdev->device == 0x5975 && | ||
| 1617 | dev->pdev->subsystem_vendor == 0x1025 && | ||
| 1618 | dev->pdev->subsystem_device == 0x009f) | ||
| 1619 | return false; | ||
| 1620 | |||
| 1621 | /* HP dc5750 has non-existent TV port */ | ||
| 1622 | if (dev->pdev->device == 0x5974 && | ||
| 1623 | dev->pdev->subsystem_vendor == 0x103c && | ||
| 1624 | dev->pdev->subsystem_device == 0x280a) | ||
| 1625 | return false; | ||
| 1626 | |||
| 1627 | return true; | ||
| 1628 | } | ||
| 1629 | |||
| 1630 | static uint16_t combios_check_dl_dvi(struct drm_device *dev, int is_dvi_d) | ||
| 1631 | { | ||
| 1632 | struct radeon_device *rdev = dev->dev_private; | ||
| 1633 | uint32_t ext_tmds_info; | ||
| 1634 | |||
| 1635 | if (rdev->flags & RADEON_IS_IGP) { | ||
| 1636 | if (is_dvi_d) | ||
| 1637 | return CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D; | ||
| 1638 | else | ||
| 1639 | return CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I; | ||
| 1640 | } | ||
| 1641 | ext_tmds_info = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE); | ||
| 1642 | if (ext_tmds_info) { | ||
| 1643 | uint8_t rev = RBIOS8(ext_tmds_info); | ||
| 1644 | uint8_t flags = RBIOS8(ext_tmds_info + 4 + 5); | ||
| 1645 | if (rev >= 3) { | ||
| 1646 | if (is_dvi_d) | ||
| 1647 | return CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D; | ||
| 1648 | else | ||
| 1649 | return CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I; | ||
| 1650 | } else { | ||
| 1651 | if (flags & 1) { | ||
| 1652 | if (is_dvi_d) | ||
| 1653 | return CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D; | ||
| 1654 | else | ||
| 1655 | return CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I; | ||
| 1656 | } | ||
| 1657 | } | ||
| 1658 | } | ||
| 1659 | if (is_dvi_d) | ||
| 1660 | return CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D; | ||
| 1661 | else | ||
| 1662 | return CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I; | ||
| 1663 | } | ||
| 1664 | |||
| 1584 | bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | 1665 | bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) |
| 1585 | { | 1666 | { |
| 1586 | struct radeon_device *rdev = dev->dev_private; | 1667 | struct radeon_device *rdev = dev->dev_private; |
| 1587 | uint32_t conn_info, entry, devices; | 1668 | uint32_t conn_info, entry, devices; |
| 1588 | uint16_t tmp; | 1669 | uint16_t tmp, connector_object_id; |
| 1589 | enum radeon_combios_ddc ddc_type; | 1670 | enum radeon_combios_ddc ddc_type; |
| 1590 | enum radeon_combios_connector connector; | 1671 | enum radeon_combios_connector connector; |
| 1591 | int i = 0; | 1672 | int i = 0; |
| @@ -1628,8 +1709,9 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 1628 | break; | 1709 | break; |
| 1629 | } | 1710 | } |
| 1630 | 1711 | ||
| 1631 | radeon_apply_legacy_quirks(dev, i, &connector, | 1712 | if (!radeon_apply_legacy_quirks(dev, i, &connector, |
| 1632 | &ddc_i2c); | 1713 | &ddc_i2c)) |
| 1714 | continue; | ||
| 1633 | 1715 | ||
| 1634 | switch (connector) { | 1716 | switch (connector) { |
| 1635 | case CONNECTOR_PROPRIETARY_LEGACY: | 1717 | case CONNECTOR_PROPRIETARY_LEGACY: |
| @@ -1644,7 +1726,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 1644 | radeon_add_legacy_connector(dev, i, devices, | 1726 | radeon_add_legacy_connector(dev, i, devices, |
| 1645 | legacy_connector_convert | 1727 | legacy_connector_convert |
| 1646 | [connector], | 1728 | [connector], |
| 1647 | &ddc_i2c); | 1729 | &ddc_i2c, |
| 1730 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D); | ||
| 1648 | break; | 1731 | break; |
| 1649 | case CONNECTOR_CRT_LEGACY: | 1732 | case CONNECTOR_CRT_LEGACY: |
| 1650 | if (tmp & 0x1) { | 1733 | if (tmp & 0x1) { |
| @@ -1669,7 +1752,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 1669 | devices, | 1752 | devices, |
| 1670 | legacy_connector_convert | 1753 | legacy_connector_convert |
| 1671 | [connector], | 1754 | [connector], |
| 1672 | &ddc_i2c); | 1755 | &ddc_i2c, |
| 1756 | CONNECTOR_OBJECT_ID_VGA); | ||
| 1673 | break; | 1757 | break; |
| 1674 | case CONNECTOR_DVI_I_LEGACY: | 1758 | case CONNECTOR_DVI_I_LEGACY: |
| 1675 | devices = 0; | 1759 | devices = 0; |
| @@ -1698,6 +1782,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 1698 | ATOM_DEVICE_DFP2_SUPPORT, | 1782 | ATOM_DEVICE_DFP2_SUPPORT, |
| 1699 | 0), | 1783 | 0), |
| 1700 | ATOM_DEVICE_DFP2_SUPPORT); | 1784 | ATOM_DEVICE_DFP2_SUPPORT); |
| 1785 | connector_object_id = combios_check_dl_dvi(dev, 0); | ||
| 1701 | } else { | 1786 | } else { |
| 1702 | devices |= ATOM_DEVICE_DFP1_SUPPORT; | 1787 | devices |= ATOM_DEVICE_DFP1_SUPPORT; |
| 1703 | radeon_add_legacy_encoder(dev, | 1788 | radeon_add_legacy_encoder(dev, |
| @@ -1706,19 +1791,24 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 1706 | ATOM_DEVICE_DFP1_SUPPORT, | 1791 | ATOM_DEVICE_DFP1_SUPPORT, |
| 1707 | 0), | 1792 | 0), |
| 1708 | ATOM_DEVICE_DFP1_SUPPORT); | 1793 | ATOM_DEVICE_DFP1_SUPPORT); |
| 1794 | connector_object_id = CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I; | ||
| 1709 | } | 1795 | } |
| 1710 | radeon_add_legacy_connector(dev, | 1796 | radeon_add_legacy_connector(dev, |
| 1711 | i, | 1797 | i, |
| 1712 | devices, | 1798 | devices, |
| 1713 | legacy_connector_convert | 1799 | legacy_connector_convert |
| 1714 | [connector], | 1800 | [connector], |
| 1715 | &ddc_i2c); | 1801 | &ddc_i2c, |
| 1802 | connector_object_id); | ||
| 1716 | break; | 1803 | break; |
| 1717 | case CONNECTOR_DVI_D_LEGACY: | 1804 | case CONNECTOR_DVI_D_LEGACY: |
| 1718 | if ((tmp >> 4) & 0x1) | 1805 | if ((tmp >> 4) & 0x1) { |
| 1719 | devices = ATOM_DEVICE_DFP2_SUPPORT; | 1806 | devices = ATOM_DEVICE_DFP2_SUPPORT; |
| 1720 | else | 1807 | connector_object_id = combios_check_dl_dvi(dev, 1); |
| 1808 | } else { | ||
| 1721 | devices = ATOM_DEVICE_DFP1_SUPPORT; | 1809 | devices = ATOM_DEVICE_DFP1_SUPPORT; |
| 1810 | connector_object_id = CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I; | ||
| 1811 | } | ||
| 1722 | radeon_add_legacy_encoder(dev, | 1812 | radeon_add_legacy_encoder(dev, |
| 1723 | radeon_get_encoder_id | 1813 | radeon_get_encoder_id |
| 1724 | (dev, devices, 0), | 1814 | (dev, devices, 0), |
| @@ -1726,7 +1816,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 1726 | radeon_add_legacy_connector(dev, i, devices, | 1816 | radeon_add_legacy_connector(dev, i, devices, |
| 1727 | legacy_connector_convert | 1817 | legacy_connector_convert |
| 1728 | [connector], | 1818 | [connector], |
| 1729 | &ddc_i2c); | 1819 | &ddc_i2c, |
| 1820 | connector_object_id); | ||
| 1730 | break; | 1821 | break; |
| 1731 | case CONNECTOR_CTV_LEGACY: | 1822 | case CONNECTOR_CTV_LEGACY: |
| 1732 | case CONNECTOR_STV_LEGACY: | 1823 | case CONNECTOR_STV_LEGACY: |
| @@ -1740,7 +1831,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 1740 | ATOM_DEVICE_TV1_SUPPORT, | 1831 | ATOM_DEVICE_TV1_SUPPORT, |
| 1741 | legacy_connector_convert | 1832 | legacy_connector_convert |
| 1742 | [connector], | 1833 | [connector], |
| 1743 | &ddc_i2c); | 1834 | &ddc_i2c, |
| 1835 | CONNECTOR_OBJECT_ID_SVIDEO); | ||
| 1744 | break; | 1836 | break; |
| 1745 | default: | 1837 | default: |
| 1746 | DRM_ERROR("Unknown connector type: %d\n", | 1838 | DRM_ERROR("Unknown connector type: %d\n", |
| @@ -1772,10 +1864,29 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 1772 | ATOM_DEVICE_CRT1_SUPPORT | | 1864 | ATOM_DEVICE_CRT1_SUPPORT | |
| 1773 | ATOM_DEVICE_DFP1_SUPPORT, | 1865 | ATOM_DEVICE_DFP1_SUPPORT, |
| 1774 | DRM_MODE_CONNECTOR_DVII, | 1866 | DRM_MODE_CONNECTOR_DVII, |
| 1775 | &ddc_i2c); | 1867 | &ddc_i2c, |
| 1868 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); | ||
| 1776 | } else { | 1869 | } else { |
| 1777 | DRM_DEBUG("No connector info found\n"); | 1870 | uint16_t crt_info = |
| 1778 | return false; | 1871 | combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); |
| 1872 | DRM_DEBUG("Found CRT table, assuming VGA connector\n"); | ||
| 1873 | if (crt_info) { | ||
| 1874 | radeon_add_legacy_encoder(dev, | ||
| 1875 | radeon_get_encoder_id(dev, | ||
| 1876 | ATOM_DEVICE_CRT1_SUPPORT, | ||
| 1877 | 1), | ||
| 1878 | ATOM_DEVICE_CRT1_SUPPORT); | ||
| 1879 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | ||
| 1880 | radeon_add_legacy_connector(dev, | ||
| 1881 | 0, | ||
| 1882 | ATOM_DEVICE_CRT1_SUPPORT, | ||
| 1883 | DRM_MODE_CONNECTOR_VGA, | ||
| 1884 | &ddc_i2c, | ||
| 1885 | CONNECTOR_OBJECT_ID_VGA); | ||
| 1886 | } else { | ||
| 1887 | DRM_DEBUG("No connector info found\n"); | ||
| 1888 | return false; | ||
| 1889 | } | ||
| 1779 | } | 1890 | } |
| 1780 | } | 1891 | } |
| 1781 | 1892 | ||
| @@ -1870,7 +1981,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 1870 | 5, | 1981 | 5, |
| 1871 | ATOM_DEVICE_LCD1_SUPPORT, | 1982 | ATOM_DEVICE_LCD1_SUPPORT, |
| 1872 | DRM_MODE_CONNECTOR_LVDS, | 1983 | DRM_MODE_CONNECTOR_LVDS, |
| 1873 | &ddc_i2c); | 1984 | &ddc_i2c, |
| 1985 | CONNECTOR_OBJECT_ID_LVDS); | ||
| 1874 | } | 1986 | } |
| 1875 | } | 1987 | } |
| 1876 | 1988 | ||
| @@ -1880,16 +1992,19 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 1880 | combios_get_table_offset(dev, COMBIOS_TV_INFO_TABLE); | 1992 | combios_get_table_offset(dev, COMBIOS_TV_INFO_TABLE); |
| 1881 | if (tv_info) { | 1993 | if (tv_info) { |
| 1882 | if (RBIOS8(tv_info + 6) == 'T') { | 1994 | if (RBIOS8(tv_info + 6) == 'T') { |
| 1883 | radeon_add_legacy_encoder(dev, | 1995 | if (radeon_apply_legacy_tv_quirks(dev)) { |
| 1884 | radeon_get_encoder_id | 1996 | radeon_add_legacy_encoder(dev, |
| 1885 | (dev, | 1997 | radeon_get_encoder_id |
| 1886 | ATOM_DEVICE_TV1_SUPPORT, | 1998 | (dev, |
| 1887 | 2), | 1999 | ATOM_DEVICE_TV1_SUPPORT, |
| 1888 | ATOM_DEVICE_TV1_SUPPORT); | 2000 | 2), |
| 1889 | radeon_add_legacy_connector(dev, 6, | 2001 | ATOM_DEVICE_TV1_SUPPORT); |
| 1890 | ATOM_DEVICE_TV1_SUPPORT, | 2002 | radeon_add_legacy_connector(dev, 6, |
| 1891 | DRM_MODE_CONNECTOR_SVIDEO, | 2003 | ATOM_DEVICE_TV1_SUPPORT, |
| 1892 | &ddc_i2c); | 2004 | DRM_MODE_CONNECTOR_SVIDEO, |
| 2005 | &ddc_i2c, | ||
| 2006 | CONNECTOR_OBJECT_ID_SVIDEO); | ||
| 2007 | } | ||
| 1893 | } | 2008 | } |
| 1894 | } | 2009 | } |
| 1895 | } | 2010 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index e376be47a4a0..29763ceae3af 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
| @@ -178,25 +178,12 @@ static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encode | |||
| 178 | struct drm_device *dev = encoder->dev; | 178 | struct drm_device *dev = encoder->dev; |
| 179 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 179 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 180 | struct drm_display_mode *mode = NULL; | 180 | struct drm_display_mode *mode = NULL; |
| 181 | struct radeon_native_mode *native_mode = &radeon_encoder->native_mode; | 181 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
| 182 | |||
| 183 | if (native_mode->panel_xres != 0 && | ||
| 184 | native_mode->panel_yres != 0 && | ||
| 185 | native_mode->dotclock != 0) { | ||
| 186 | mode = drm_mode_create(dev); | ||
| 187 | |||
| 188 | mode->hdisplay = native_mode->panel_xres; | ||
| 189 | mode->vdisplay = native_mode->panel_yres; | ||
| 190 | |||
| 191 | mode->htotal = mode->hdisplay + native_mode->hblank; | ||
| 192 | mode->hsync_start = mode->hdisplay + native_mode->hoverplus; | ||
| 193 | mode->hsync_end = mode->hsync_start + native_mode->hsync_width; | ||
| 194 | mode->vtotal = mode->vdisplay + native_mode->vblank; | ||
| 195 | mode->vsync_start = mode->vdisplay + native_mode->voverplus; | ||
| 196 | mode->vsync_end = mode->vsync_start + native_mode->vsync_width; | ||
| 197 | mode->clock = native_mode->dotclock; | ||
| 198 | mode->flags = 0; | ||
| 199 | 182 | ||
| 183 | if (native_mode->hdisplay != 0 && | ||
| 184 | native_mode->vdisplay != 0 && | ||
| 185 | native_mode->clock != 0) { | ||
| 186 | mode = drm_mode_duplicate(dev, native_mode); | ||
| 200 | mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; | 187 | mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; |
| 201 | drm_mode_set_name(mode); | 188 | drm_mode_set_name(mode); |
| 202 | 189 | ||
| @@ -210,7 +197,7 @@ static void radeon_add_common_modes(struct drm_encoder *encoder, struct drm_conn | |||
| 210 | struct drm_device *dev = encoder->dev; | 197 | struct drm_device *dev = encoder->dev; |
| 211 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 198 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 212 | struct drm_display_mode *mode = NULL; | 199 | struct drm_display_mode *mode = NULL; |
| 213 | struct radeon_native_mode *native_mode = &radeon_encoder->native_mode; | 200 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
| 214 | int i; | 201 | int i; |
| 215 | struct mode_size { | 202 | struct mode_size { |
| 216 | int w; | 203 | int w; |
| @@ -236,11 +223,16 @@ static void radeon_add_common_modes(struct drm_encoder *encoder, struct drm_conn | |||
| 236 | }; | 223 | }; |
| 237 | 224 | ||
| 238 | for (i = 0; i < 17; i++) { | 225 | for (i = 0; i < 17; i++) { |
| 226 | if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) { | ||
| 227 | if (common_modes[i].w > 1024 || | ||
| 228 | common_modes[i].h > 768) | ||
| 229 | continue; | ||
| 230 | } | ||
| 239 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 231 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
| 240 | if (common_modes[i].w > native_mode->panel_xres || | 232 | if (common_modes[i].w > native_mode->hdisplay || |
| 241 | common_modes[i].h > native_mode->panel_yres || | 233 | common_modes[i].h > native_mode->vdisplay || |
| 242 | (common_modes[i].w == native_mode->panel_xres && | 234 | (common_modes[i].w == native_mode->hdisplay && |
| 243 | common_modes[i].h == native_mode->panel_yres)) | 235 | common_modes[i].h == native_mode->vdisplay)) |
| 244 | continue; | 236 | continue; |
| 245 | } | 237 | } |
| 246 | if (common_modes[i].w < 320 || common_modes[i].h < 200) | 238 | if (common_modes[i].w < 320 || common_modes[i].h < 200) |
| @@ -344,28 +336,23 @@ static void radeon_fixup_lvds_native_mode(struct drm_encoder *encoder, | |||
| 344 | struct drm_connector *connector) | 336 | struct drm_connector *connector) |
| 345 | { | 337 | { |
| 346 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 338 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 347 | struct radeon_native_mode *native_mode = &radeon_encoder->native_mode; | 339 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
| 348 | 340 | ||
| 349 | /* Try to get native mode details from EDID if necessary */ | 341 | /* Try to get native mode details from EDID if necessary */ |
| 350 | if (!native_mode->dotclock) { | 342 | if (!native_mode->clock) { |
| 351 | struct drm_display_mode *t, *mode; | 343 | struct drm_display_mode *t, *mode; |
| 352 | 344 | ||
| 353 | list_for_each_entry_safe(mode, t, &connector->probed_modes, head) { | 345 | list_for_each_entry_safe(mode, t, &connector->probed_modes, head) { |
| 354 | if (mode->hdisplay == native_mode->panel_xres && | 346 | if (mode->hdisplay == native_mode->hdisplay && |
| 355 | mode->vdisplay == native_mode->panel_yres) { | 347 | mode->vdisplay == native_mode->vdisplay) { |
| 356 | native_mode->hblank = mode->htotal - mode->hdisplay; | 348 | *native_mode = *mode; |
| 357 | native_mode->hoverplus = mode->hsync_start - mode->hdisplay; | 349 | drm_mode_set_crtcinfo(native_mode, CRTC_INTERLACE_HALVE_V); |
| 358 | native_mode->hsync_width = mode->hsync_end - mode->hsync_start; | ||
| 359 | native_mode->vblank = mode->vtotal - mode->vdisplay; | ||
| 360 | native_mode->voverplus = mode->vsync_start - mode->vdisplay; | ||
| 361 | native_mode->vsync_width = mode->vsync_end - mode->vsync_start; | ||
| 362 | native_mode->dotclock = mode->clock; | ||
| 363 | DRM_INFO("Determined LVDS native mode details from EDID\n"); | 350 | DRM_INFO("Determined LVDS native mode details from EDID\n"); |
| 364 | break; | 351 | break; |
| 365 | } | 352 | } |
| 366 | } | 353 | } |
| 367 | } | 354 | } |
| 368 | if (!native_mode->dotclock) { | 355 | if (!native_mode->clock) { |
| 369 | DRM_INFO("No LVDS native mode details, disabling RMX\n"); | 356 | DRM_INFO("No LVDS native mode details, disabling RMX\n"); |
| 370 | radeon_encoder->rmx_type = RMX_OFF; | 357 | radeon_encoder->rmx_type = RMX_OFF; |
| 371 | } | 358 | } |
| @@ -410,13 +397,64 @@ static int radeon_lvds_get_modes(struct drm_connector *connector) | |||
| 410 | static int radeon_lvds_mode_valid(struct drm_connector *connector, | 397 | static int radeon_lvds_mode_valid(struct drm_connector *connector, |
| 411 | struct drm_display_mode *mode) | 398 | struct drm_display_mode *mode) |
| 412 | { | 399 | { |
| 400 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | ||
| 401 | |||
| 402 | if ((mode->hdisplay < 320) || (mode->vdisplay < 240)) | ||
| 403 | return MODE_PANEL; | ||
| 404 | |||
| 405 | if (encoder) { | ||
| 406 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
| 407 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; | ||
| 408 | |||
| 409 | /* AVIVO hardware supports downscaling modes larger than the panel | ||
| 410 | * to the panel size, but I'm not sure this is desirable. | ||
| 411 | */ | ||
| 412 | if ((mode->hdisplay > native_mode->hdisplay) || | ||
| 413 | (mode->vdisplay > native_mode->vdisplay)) | ||
| 414 | return MODE_PANEL; | ||
| 415 | |||
| 416 | /* if scaling is disabled, block non-native modes */ | ||
| 417 | if (radeon_encoder->rmx_type == RMX_OFF) { | ||
| 418 | if ((mode->hdisplay != native_mode->hdisplay) || | ||
| 419 | (mode->vdisplay != native_mode->vdisplay)) | ||
| 420 | return MODE_PANEL; | ||
| 421 | } | ||
| 422 | } | ||
| 423 | |||
| 413 | return MODE_OK; | 424 | return MODE_OK; |
| 414 | } | 425 | } |
| 415 | 426 | ||
| 416 | static enum drm_connector_status radeon_lvds_detect(struct drm_connector *connector) | 427 | static enum drm_connector_status radeon_lvds_detect(struct drm_connector *connector) |
| 417 | { | 428 | { |
| 418 | enum drm_connector_status ret = connector_status_connected; | 429 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 430 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | ||
| 431 | enum drm_connector_status ret = connector_status_disconnected; | ||
| 432 | |||
| 433 | if (encoder) { | ||
| 434 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
| 435 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; | ||
| 436 | |||
| 437 | /* check if panel is valid */ | ||
| 438 | if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) | ||
| 439 | ret = connector_status_connected; | ||
| 440 | |||
| 441 | } | ||
| 442 | |||
| 443 | /* check for edid as well */ | ||
| 444 | if (radeon_connector->edid) | ||
| 445 | ret = connector_status_connected; | ||
| 446 | else { | ||
| 447 | if (radeon_connector->ddc_bus) { | ||
| 448 | radeon_i2c_do_lock(radeon_connector, 1); | ||
| 449 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, | ||
| 450 | &radeon_connector->ddc_bus->adapter); | ||
| 451 | radeon_i2c_do_lock(radeon_connector, 0); | ||
| 452 | if (radeon_connector->edid) | ||
| 453 | ret = connector_status_connected; | ||
| 454 | } | ||
| 455 | } | ||
| 419 | /* check acpi lid status ??? */ | 456 | /* check acpi lid status ??? */ |
| 457 | |||
| 420 | radeon_connector_update_scratch_regs(connector, ret); | 458 | radeon_connector_update_scratch_regs(connector, ret); |
| 421 | return ret; | 459 | return ret; |
| 422 | } | 460 | } |
| @@ -427,6 +465,8 @@ static void radeon_connector_destroy(struct drm_connector *connector) | |||
| 427 | 465 | ||
| 428 | if (radeon_connector->ddc_bus) | 466 | if (radeon_connector->ddc_bus) |
| 429 | radeon_i2c_destroy(radeon_connector->ddc_bus); | 467 | radeon_i2c_destroy(radeon_connector->ddc_bus); |
| 468 | if (radeon_connector->edid) | ||
| 469 | kfree(radeon_connector->edid); | ||
| 430 | kfree(radeon_connector->con_priv); | 470 | kfree(radeon_connector->con_priv); |
| 431 | drm_sysfs_connector_remove(connector); | 471 | drm_sysfs_connector_remove(connector); |
| 432 | drm_connector_cleanup(connector); | 472 | drm_connector_cleanup(connector); |
| @@ -496,6 +536,8 @@ static int radeon_vga_get_modes(struct drm_connector *connector) | |||
| 496 | static int radeon_vga_mode_valid(struct drm_connector *connector, | 536 | static int radeon_vga_mode_valid(struct drm_connector *connector, |
| 497 | struct drm_display_mode *mode) | 537 | struct drm_display_mode *mode) |
| 498 | { | 538 | { |
| 539 | /* XXX check mode bandwidth */ | ||
| 540 | /* XXX verify against max DAC output frequency */ | ||
| 499 | return MODE_OK; | 541 | return MODE_OK; |
| 500 | } | 542 | } |
| 501 | 543 | ||
| @@ -514,9 +556,33 @@ static enum drm_connector_status radeon_vga_detect(struct drm_connector *connect | |||
| 514 | radeon_i2c_do_lock(radeon_connector, 1); | 556 | radeon_i2c_do_lock(radeon_connector, 1); |
| 515 | dret = radeon_ddc_probe(radeon_connector); | 557 | dret = radeon_ddc_probe(radeon_connector); |
| 516 | radeon_i2c_do_lock(radeon_connector, 0); | 558 | radeon_i2c_do_lock(radeon_connector, 0); |
| 517 | if (dret) | 559 | if (dret) { |
| 518 | ret = connector_status_connected; | 560 | if (radeon_connector->edid) { |
| 519 | else { | 561 | kfree(radeon_connector->edid); |
| 562 | radeon_connector->edid = NULL; | ||
| 563 | } | ||
| 564 | radeon_i2c_do_lock(radeon_connector, 1); | ||
| 565 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter); | ||
| 566 | radeon_i2c_do_lock(radeon_connector, 0); | ||
| 567 | |||
| 568 | if (!radeon_connector->edid) { | ||
| 569 | DRM_ERROR("%s: probed a monitor but no|invalid EDID\n", | ||
| 570 | drm_get_connector_name(connector)); | ||
| 571 | ret = connector_status_connected; | ||
| 572 | } else { | ||
| 573 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); | ||
| 574 | |||
| 575 | /* some oems have boards with separate digital and analog connectors | ||
| 576 | * with a shared ddc line (often vga + hdmi) | ||
| 577 | */ | ||
| 578 | if (radeon_connector->use_digital && radeon_connector->shared_ddc) { | ||
| 579 | kfree(radeon_connector->edid); | ||
| 580 | radeon_connector->edid = NULL; | ||
| 581 | ret = connector_status_disconnected; | ||
| 582 | } else | ||
| 583 | ret = connector_status_connected; | ||
| 584 | } | ||
| 585 | } else { | ||
| 520 | if (radeon_connector->dac_load_detect) { | 586 | if (radeon_connector->dac_load_detect) { |
| 521 | encoder_funcs = encoder->helper_private; | 587 | encoder_funcs = encoder->helper_private; |
| 522 | ret = encoder_funcs->detect(encoder, connector); | 588 | ret = encoder_funcs->detect(encoder, connector); |
| @@ -570,6 +636,8 @@ static int radeon_tv_get_modes(struct drm_connector *connector) | |||
| 570 | static int radeon_tv_mode_valid(struct drm_connector *connector, | 636 | static int radeon_tv_mode_valid(struct drm_connector *connector, |
| 571 | struct drm_display_mode *mode) | 637 | struct drm_display_mode *mode) |
| 572 | { | 638 | { |
| 639 | if ((mode->hdisplay > 1024) || (mode->vdisplay > 768)) | ||
| 640 | return MODE_CLOCK_RANGE; | ||
| 573 | return MODE_OK; | 641 | return MODE_OK; |
| 574 | } | 642 | } |
| 575 | 643 | ||
| @@ -644,20 +712,29 @@ static enum drm_connector_status radeon_dvi_detect(struct drm_connector *connect | |||
| 644 | dret = radeon_ddc_probe(radeon_connector); | 712 | dret = radeon_ddc_probe(radeon_connector); |
| 645 | radeon_i2c_do_lock(radeon_connector, 0); | 713 | radeon_i2c_do_lock(radeon_connector, 0); |
| 646 | if (dret) { | 714 | if (dret) { |
| 715 | if (radeon_connector->edid) { | ||
| 716 | kfree(radeon_connector->edid); | ||
| 717 | radeon_connector->edid = NULL; | ||
| 718 | } | ||
| 647 | radeon_i2c_do_lock(radeon_connector, 1); | 719 | radeon_i2c_do_lock(radeon_connector, 1); |
| 648 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter); | 720 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter); |
| 649 | radeon_i2c_do_lock(radeon_connector, 0); | 721 | radeon_i2c_do_lock(radeon_connector, 0); |
| 650 | 722 | ||
| 651 | if (!radeon_connector->edid) { | 723 | if (!radeon_connector->edid) { |
| 652 | DRM_ERROR("DDC responded but not EDID found for %s\n", | 724 | DRM_ERROR("%s: probed a monitor but no|invalid EDID\n", |
| 653 | drm_get_connector_name(connector)); | 725 | drm_get_connector_name(connector)); |
| 654 | } else { | 726 | } else { |
| 655 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); | 727 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); |
| 656 | 728 | ||
| 657 | /* if this isn't a digital monitor | 729 | /* some oems have boards with separate digital and analog connectors |
| 658 | then we need to make sure we don't have any | 730 | * with a shared ddc line (often vga + hdmi) |
| 659 | TV conflicts */ | 731 | */ |
| 660 | ret = connector_status_connected; | 732 | if ((!radeon_connector->use_digital) && radeon_connector->shared_ddc) { |
| 733 | kfree(radeon_connector->edid); | ||
| 734 | radeon_connector->edid = NULL; | ||
| 735 | ret = connector_status_disconnected; | ||
| 736 | } else | ||
| 737 | ret = connector_status_connected; | ||
| 661 | } | 738 | } |
| 662 | } | 739 | } |
| 663 | 740 | ||
| @@ -753,9 +830,27 @@ static void radeon_dvi_force(struct drm_connector *connector) | |||
| 753 | radeon_connector->use_digital = true; | 830 | radeon_connector->use_digital = true; |
| 754 | } | 831 | } |
| 755 | 832 | ||
| 833 | static int radeon_dvi_mode_valid(struct drm_connector *connector, | ||
| 834 | struct drm_display_mode *mode) | ||
| 835 | { | ||
| 836 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
| 837 | |||
| 838 | /* XXX check mode bandwidth */ | ||
| 839 | |||
| 840 | if (radeon_connector->use_digital && (mode->clock > 165000)) { | ||
| 841 | if ((radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) || | ||
| 842 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) || | ||
| 843 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) | ||
| 844 | return MODE_OK; | ||
| 845 | else | ||
| 846 | return MODE_CLOCK_HIGH; | ||
| 847 | } | ||
| 848 | return MODE_OK; | ||
| 849 | } | ||
| 850 | |||
| 756 | struct drm_connector_helper_funcs radeon_dvi_connector_helper_funcs = { | 851 | struct drm_connector_helper_funcs radeon_dvi_connector_helper_funcs = { |
| 757 | .get_modes = radeon_dvi_get_modes, | 852 | .get_modes = radeon_dvi_get_modes, |
| 758 | .mode_valid = radeon_vga_mode_valid, | 853 | .mode_valid = radeon_dvi_mode_valid, |
| 759 | .best_encoder = radeon_dvi_encoder, | 854 | .best_encoder = radeon_dvi_encoder, |
| 760 | }; | 855 | }; |
| 761 | 856 | ||
| @@ -775,13 +870,15 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 775 | int connector_type, | 870 | int connector_type, |
| 776 | struct radeon_i2c_bus_rec *i2c_bus, | 871 | struct radeon_i2c_bus_rec *i2c_bus, |
| 777 | bool linkb, | 872 | bool linkb, |
| 778 | uint32_t igp_lane_info) | 873 | uint32_t igp_lane_info, |
| 874 | uint16_t connector_object_id) | ||
| 779 | { | 875 | { |
| 780 | struct radeon_device *rdev = dev->dev_private; | 876 | struct radeon_device *rdev = dev->dev_private; |
| 781 | struct drm_connector *connector; | 877 | struct drm_connector *connector; |
| 782 | struct radeon_connector *radeon_connector; | 878 | struct radeon_connector *radeon_connector; |
| 783 | struct radeon_connector_atom_dig *radeon_dig_connector; | 879 | struct radeon_connector_atom_dig *radeon_dig_connector; |
| 784 | uint32_t subpixel_order = SubPixelNone; | 880 | uint32_t subpixel_order = SubPixelNone; |
| 881 | bool shared_ddc = false; | ||
| 785 | int ret; | 882 | int ret; |
| 786 | 883 | ||
| 787 | /* fixme - tv/cv/din */ | 884 | /* fixme - tv/cv/din */ |
| @@ -795,6 +892,13 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 795 | radeon_connector->devices |= supported_device; | 892 | radeon_connector->devices |= supported_device; |
| 796 | return; | 893 | return; |
| 797 | } | 894 | } |
| 895 | if (radeon_connector->ddc_bus && i2c_bus->valid) { | ||
| 896 | if (memcmp(&radeon_connector->ddc_bus->rec, i2c_bus, | ||
| 897 | sizeof(struct radeon_i2c_bus_rec)) == 0) { | ||
| 898 | radeon_connector->shared_ddc = true; | ||
| 899 | shared_ddc = true; | ||
| 900 | } | ||
| 901 | } | ||
| 798 | } | 902 | } |
| 799 | 903 | ||
| 800 | radeon_connector = kzalloc(sizeof(struct radeon_connector), GFP_KERNEL); | 904 | radeon_connector = kzalloc(sizeof(struct radeon_connector), GFP_KERNEL); |
| @@ -805,6 +909,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 805 | 909 | ||
| 806 | radeon_connector->connector_id = connector_id; | 910 | radeon_connector->connector_id = connector_id; |
| 807 | radeon_connector->devices = supported_device; | 911 | radeon_connector->devices = supported_device; |
| 912 | radeon_connector->shared_ddc = shared_ddc; | ||
| 913 | radeon_connector->connector_object_id = connector_object_id; | ||
| 808 | switch (connector_type) { | 914 | switch (connector_type) { |
| 809 | case DRM_MODE_CONNECTOR_VGA: | 915 | case DRM_MODE_CONNECTOR_VGA: |
| 810 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 916 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
| @@ -956,7 +1062,8 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 956 | uint32_t connector_id, | 1062 | uint32_t connector_id, |
| 957 | uint32_t supported_device, | 1063 | uint32_t supported_device, |
| 958 | int connector_type, | 1064 | int connector_type, |
| 959 | struct radeon_i2c_bus_rec *i2c_bus) | 1065 | struct radeon_i2c_bus_rec *i2c_bus, |
| 1066 | uint16_t connector_object_id) | ||
| 960 | { | 1067 | { |
| 961 | struct radeon_device *rdev = dev->dev_private; | 1068 | struct radeon_device *rdev = dev->dev_private; |
| 962 | struct drm_connector *connector; | 1069 | struct drm_connector *connector; |
| @@ -985,6 +1092,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 985 | 1092 | ||
| 986 | radeon_connector->connector_id = connector_id; | 1093 | radeon_connector->connector_id = connector_id; |
| 987 | radeon_connector->devices = supported_device; | 1094 | radeon_connector->devices = supported_device; |
| 1095 | radeon_connector->connector_object_id = connector_object_id; | ||
| 988 | switch (connector_type) { | 1096 | switch (connector_type) { |
| 989 | case DRM_MODE_CONNECTOR_VGA: | 1097 | case DRM_MODE_CONNECTOR_VGA: |
| 990 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 1098 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
| @@ -1042,6 +1150,13 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 1042 | if (ret) | 1150 | if (ret) |
| 1043 | goto failed; | 1151 | goto failed; |
| 1044 | radeon_connector->dac_load_detect = true; | 1152 | radeon_connector->dac_load_detect = true; |
| 1153 | /* RS400,RC410,RS480 chipset seems to report a lot | ||
| 1154 | * of false positive on load detect, we haven't yet | ||
| 1155 | * found a way to make load detect reliable on those | ||
| 1156 | * chipset, thus just disable it for TV. | ||
| 1157 | */ | ||
| 1158 | if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) | ||
| 1159 | radeon_connector->dac_load_detect = false; | ||
| 1045 | drm_connector_attach_property(&radeon_connector->base, | 1160 | drm_connector_attach_property(&radeon_connector->base, |
| 1046 | rdev->mode_info.load_detect_property, | 1161 | rdev->mode_info.load_detect_property, |
| 1047 | 1); | 1162 | 1); |
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c index b13c79e38bc0..28772a37009c 100644 --- a/drivers/gpu/drm/radeon/radeon_cursor.c +++ b/drivers/gpu/drm/radeon/radeon_cursor.c | |||
| @@ -109,9 +109,15 @@ static void radeon_set_cursor(struct drm_crtc *crtc, struct drm_gem_object *obj, | |||
| 109 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 109 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
| 110 | struct radeon_device *rdev = crtc->dev->dev_private; | 110 | struct radeon_device *rdev = crtc->dev->dev_private; |
| 111 | 111 | ||
| 112 | if (ASIC_IS_AVIVO(rdev)) | 112 | if (ASIC_IS_AVIVO(rdev)) { |
| 113 | if (rdev->family >= CHIP_RV770) { | ||
| 114 | if (radeon_crtc->crtc_id) | ||
| 115 | WREG32(R700_D2CUR_SURFACE_ADDRESS_HIGH, 0); | ||
| 116 | else | ||
| 117 | WREG32(R700_D1CUR_SURFACE_ADDRESS_HIGH, 0); | ||
| 118 | } | ||
| 113 | WREG32(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, gpu_addr); | 119 | WREG32(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, gpu_addr); |
| 114 | else { | 120 | } else { |
| 115 | radeon_crtc->legacy_cursor_offset = gpu_addr - radeon_crtc->legacy_display_base_addr; | 121 | radeon_crtc->legacy_cursor_offset = gpu_addr - radeon_crtc->legacy_display_base_addr; |
| 116 | /* offset is from DISP(2)_BASE_ADDRESS */ | 122 | /* offset is from DISP(2)_BASE_ADDRESS */ |
| 117 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, radeon_crtc->legacy_cursor_offset); | 123 | WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, radeon_crtc->legacy_cursor_offset); |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index df988142e6b0..41bb76fbe734 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
| @@ -444,20 +444,24 @@ static uint32_t cail_reg_read(struct card_info *info, uint32_t reg) | |||
| 444 | return r; | 444 | return r; |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | static struct card_info atom_card_info = { | ||
| 448 | .dev = NULL, | ||
| 449 | .reg_read = cail_reg_read, | ||
| 450 | .reg_write = cail_reg_write, | ||
| 451 | .mc_read = cail_mc_read, | ||
| 452 | .mc_write = cail_mc_write, | ||
| 453 | .pll_read = cail_pll_read, | ||
| 454 | .pll_write = cail_pll_write, | ||
| 455 | }; | ||
| 456 | |||
| 457 | int radeon_atombios_init(struct radeon_device *rdev) | 447 | int radeon_atombios_init(struct radeon_device *rdev) |
| 458 | { | 448 | { |
| 459 | atom_card_info.dev = rdev->ddev; | 449 | struct card_info *atom_card_info = |
| 460 | rdev->mode_info.atom_context = atom_parse(&atom_card_info, rdev->bios); | 450 | kzalloc(sizeof(struct card_info), GFP_KERNEL); |
| 451 | |||
| 452 | if (!atom_card_info) | ||
| 453 | return -ENOMEM; | ||
| 454 | |||
| 455 | rdev->mode_info.atom_card_info = atom_card_info; | ||
| 456 | atom_card_info->dev = rdev->ddev; | ||
| 457 | atom_card_info->reg_read = cail_reg_read; | ||
| 458 | atom_card_info->reg_write = cail_reg_write; | ||
| 459 | atom_card_info->mc_read = cail_mc_read; | ||
| 460 | atom_card_info->mc_write = cail_mc_write; | ||
| 461 | atom_card_info->pll_read = cail_pll_read; | ||
| 462 | atom_card_info->pll_write = cail_pll_write; | ||
| 463 | |||
| 464 | rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios); | ||
| 461 | radeon_atom_initialize_bios_scratch_regs(rdev->ddev); | 465 | radeon_atom_initialize_bios_scratch_regs(rdev->ddev); |
| 462 | return 0; | 466 | return 0; |
| 463 | } | 467 | } |
| @@ -465,6 +469,7 @@ int radeon_atombios_init(struct radeon_device *rdev) | |||
| 465 | void radeon_atombios_fini(struct radeon_device *rdev) | 469 | void radeon_atombios_fini(struct radeon_device *rdev) |
| 466 | { | 470 | { |
| 467 | kfree(rdev->mode_info.atom_context); | 471 | kfree(rdev->mode_info.atom_context); |
| 472 | kfree(rdev->mode_info.atom_card_info); | ||
| 468 | } | 473 | } |
| 469 | 474 | ||
| 470 | int radeon_combios_init(struct radeon_device *rdev) | 475 | int radeon_combios_init(struct radeon_device *rdev) |
| @@ -683,6 +688,8 @@ int radeon_resume_kms(struct drm_device *dev) | |||
| 683 | return -1; | 688 | return -1; |
| 684 | } | 689 | } |
| 685 | pci_set_master(dev->pdev); | 690 | pci_set_master(dev->pdev); |
| 691 | /* resume AGP if in use */ | ||
| 692 | radeon_agp_resume(rdev); | ||
| 686 | radeon_resume(rdev); | 693 | radeon_resume(rdev); |
| 687 | radeon_restore_bios_scratch_regs(rdev); | 694 | radeon_restore_bios_scratch_regs(rdev); |
| 688 | fb_set_suspend(rdev->fbdev_info, 0); | 695 | fb_set_suspend(rdev->fbdev_info, 0); |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 3655d91993a6..c85df4afcb7a 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
| @@ -137,9 +137,6 @@ static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | |||
| 137 | if (size != 256) { | 137 | if (size != 256) { |
| 138 | return; | 138 | return; |
| 139 | } | 139 | } |
| 140 | if (crtc->fb == NULL) { | ||
| 141 | return; | ||
| 142 | } | ||
| 143 | 140 | ||
| 144 | /* userspace palettes are always correct as is */ | 141 | /* userspace palettes are always correct as is */ |
| 145 | for (i = 0; i < 256; i++) { | 142 | for (i = 0; i < 256; i++) { |
| @@ -147,7 +144,6 @@ static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | |||
| 147 | radeon_crtc->lut_g[i] = green[i] >> 6; | 144 | radeon_crtc->lut_g[i] = green[i] >> 6; |
| 148 | radeon_crtc->lut_b[i] = blue[i] >> 6; | 145 | radeon_crtc->lut_b[i] = blue[i] >> 6; |
| 149 | } | 146 | } |
| 150 | |||
| 151 | radeon_crtc_load_lut(crtc); | 147 | radeon_crtc_load_lut(crtc); |
| 152 | } | 148 | } |
| 153 | 149 | ||
| @@ -338,27 +334,19 @@ static bool radeon_setup_enc_conn(struct drm_device *dev) | |||
| 338 | 334 | ||
| 339 | int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) | 335 | int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) |
| 340 | { | 336 | { |
| 341 | struct edid *edid; | ||
| 342 | int ret = 0; | 337 | int ret = 0; |
| 343 | 338 | ||
| 344 | if (!radeon_connector->ddc_bus) | 339 | if (!radeon_connector->ddc_bus) |
| 345 | return -1; | 340 | return -1; |
| 346 | if (!radeon_connector->edid) { | 341 | if (!radeon_connector->edid) { |
| 347 | radeon_i2c_do_lock(radeon_connector, 1); | 342 | radeon_i2c_do_lock(radeon_connector, 1); |
| 348 | edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter); | 343 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter); |
| 349 | radeon_i2c_do_lock(radeon_connector, 0); | 344 | radeon_i2c_do_lock(radeon_connector, 0); |
| 350 | } else | 345 | } |
| 351 | edid = radeon_connector->edid; | ||
| 352 | 346 | ||
| 353 | if (edid) { | 347 | if (radeon_connector->edid) { |
| 354 | /* update digital bits here */ | 348 | drm_mode_connector_update_edid_property(&radeon_connector->base, radeon_connector->edid); |
| 355 | if (edid->input & DRM_EDID_INPUT_DIGITAL) | 349 | ret = drm_add_edid_modes(&radeon_connector->base, radeon_connector->edid); |
| 356 | radeon_connector->use_digital = 1; | ||
| 357 | else | ||
| 358 | radeon_connector->use_digital = 0; | ||
| 359 | drm_mode_connector_update_edid_property(&radeon_connector->base, edid); | ||
| 360 | ret = drm_add_edid_modes(&radeon_connector->base, edid); | ||
| 361 | kfree(edid); | ||
| 362 | return ret; | 350 | return ret; |
| 363 | } | 351 | } |
| 364 | drm_mode_connector_update_edid_property(&radeon_connector->base, NULL); | 352 | drm_mode_connector_update_edid_property(&radeon_connector->base, NULL); |
| @@ -765,7 +753,7 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, | |||
| 765 | radeon_crtc->rmx_type = radeon_encoder->rmx_type; | 753 | radeon_crtc->rmx_type = radeon_encoder->rmx_type; |
| 766 | memcpy(&radeon_crtc->native_mode, | 754 | memcpy(&radeon_crtc->native_mode, |
| 767 | &radeon_encoder->native_mode, | 755 | &radeon_encoder->native_mode, |
| 768 | sizeof(struct radeon_native_mode)); | 756 | sizeof(struct drm_display_mode)); |
| 769 | first = false; | 757 | first = false; |
| 770 | } else { | 758 | } else { |
| 771 | if (radeon_crtc->rmx_type != radeon_encoder->rmx_type) { | 759 | if (radeon_crtc->rmx_type != radeon_encoder->rmx_type) { |
| @@ -783,10 +771,10 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, | |||
| 783 | if (radeon_crtc->rmx_type != RMX_OFF) { | 771 | if (radeon_crtc->rmx_type != RMX_OFF) { |
| 784 | fixed20_12 a, b; | 772 | fixed20_12 a, b; |
| 785 | a.full = rfixed_const(crtc->mode.vdisplay); | 773 | a.full = rfixed_const(crtc->mode.vdisplay); |
| 786 | b.full = rfixed_const(radeon_crtc->native_mode.panel_xres); | 774 | b.full = rfixed_const(radeon_crtc->native_mode.hdisplay); |
| 787 | radeon_crtc->vsc.full = rfixed_div(a, b); | 775 | radeon_crtc->vsc.full = rfixed_div(a, b); |
| 788 | a.full = rfixed_const(crtc->mode.hdisplay); | 776 | a.full = rfixed_const(crtc->mode.hdisplay); |
| 789 | b.full = rfixed_const(radeon_crtc->native_mode.panel_yres); | 777 | b.full = rfixed_const(radeon_crtc->native_mode.vdisplay); |
| 790 | radeon_crtc->hsc.full = rfixed_div(a, b); | 778 | radeon_crtc->hsc.full = rfixed_div(a, b); |
| 791 | } else { | 779 | } else { |
| 792 | radeon_crtc->vsc.full = rfixed_const(1); | 780 | radeon_crtc->vsc.full = rfixed_const(1); |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index a65ab1a0dad2..d42bc512d75a 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
| @@ -31,6 +31,10 @@ | |||
| 31 | 31 | ||
| 32 | extern int atom_debug; | 32 | extern int atom_debug; |
| 33 | 33 | ||
| 34 | /* evil but including atombios.h is much worse */ | ||
| 35 | bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, | ||
| 36 | struct drm_display_mode *mode); | ||
| 37 | |||
| 34 | uint32_t | 38 | uint32_t |
| 35 | radeon_get_encoder_id(struct drm_device *dev, uint32_t supported_device, uint8_t dac) | 39 | radeon_get_encoder_id(struct drm_device *dev, uint32_t supported_device, uint8_t dac) |
| 36 | { | 40 | { |
| @@ -167,49 +171,17 @@ void radeon_rmx_mode_fixup(struct drm_encoder *encoder, | |||
| 167 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 171 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 168 | struct drm_device *dev = encoder->dev; | 172 | struct drm_device *dev = encoder->dev; |
| 169 | struct radeon_device *rdev = dev->dev_private; | 173 | struct radeon_device *rdev = dev->dev_private; |
| 170 | struct radeon_native_mode *native_mode = &radeon_encoder->native_mode; | 174 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
| 171 | 175 | ||
| 172 | if (mode->hdisplay < native_mode->panel_xres || | 176 | if (mode->hdisplay < native_mode->hdisplay || |
| 173 | mode->vdisplay < native_mode->panel_yres) { | 177 | mode->vdisplay < native_mode->vdisplay) { |
| 174 | if (ASIC_IS_AVIVO(rdev)) { | 178 | int mode_id = adjusted_mode->base.id; |
| 175 | adjusted_mode->hdisplay = native_mode->panel_xres; | 179 | *adjusted_mode = *native_mode; |
| 176 | adjusted_mode->vdisplay = native_mode->panel_yres; | 180 | if (!ASIC_IS_AVIVO(rdev)) { |
| 177 | adjusted_mode->htotal = native_mode->panel_xres + native_mode->hblank; | 181 | adjusted_mode->hdisplay = mode->hdisplay; |
| 178 | adjusted_mode->hsync_start = native_mode->panel_xres + native_mode->hoverplus; | 182 | adjusted_mode->vdisplay = mode->vdisplay; |
| 179 | adjusted_mode->hsync_end = adjusted_mode->hsync_start + native_mode->hsync_width; | ||
| 180 | adjusted_mode->vtotal = native_mode->panel_yres + native_mode->vblank; | ||
| 181 | adjusted_mode->vsync_start = native_mode->panel_yres + native_mode->voverplus; | ||
| 182 | adjusted_mode->vsync_end = adjusted_mode->vsync_start + native_mode->vsync_width; | ||
| 183 | /* update crtc values */ | ||
| 184 | drm_mode_set_crtcinfo(adjusted_mode, CRTC_INTERLACE_HALVE_V); | ||
| 185 | /* adjust crtc values */ | ||
| 186 | adjusted_mode->crtc_hdisplay = native_mode->panel_xres; | ||
| 187 | adjusted_mode->crtc_vdisplay = native_mode->panel_yres; | ||
| 188 | adjusted_mode->crtc_htotal = adjusted_mode->crtc_hdisplay + native_mode->hblank; | ||
| 189 | adjusted_mode->crtc_hsync_start = adjusted_mode->crtc_hdisplay + native_mode->hoverplus; | ||
| 190 | adjusted_mode->crtc_hsync_end = adjusted_mode->crtc_hsync_start + native_mode->hsync_width; | ||
| 191 | adjusted_mode->crtc_vtotal = adjusted_mode->crtc_vdisplay + native_mode->vblank; | ||
| 192 | adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + native_mode->voverplus; | ||
| 193 | adjusted_mode->crtc_vsync_end = adjusted_mode->crtc_vsync_start + native_mode->vsync_width; | ||
| 194 | } else { | ||
| 195 | adjusted_mode->htotal = native_mode->panel_xres + native_mode->hblank; | ||
| 196 | adjusted_mode->hsync_start = native_mode->panel_xres + native_mode->hoverplus; | ||
| 197 | adjusted_mode->hsync_end = adjusted_mode->hsync_start + native_mode->hsync_width; | ||
| 198 | adjusted_mode->vtotal = native_mode->panel_yres + native_mode->vblank; | ||
| 199 | adjusted_mode->vsync_start = native_mode->panel_yres + native_mode->voverplus; | ||
| 200 | adjusted_mode->vsync_end = adjusted_mode->vsync_start + native_mode->vsync_width; | ||
| 201 | /* update crtc values */ | ||
| 202 | drm_mode_set_crtcinfo(adjusted_mode, CRTC_INTERLACE_HALVE_V); | ||
| 203 | /* adjust crtc values */ | ||
| 204 | adjusted_mode->crtc_htotal = adjusted_mode->crtc_hdisplay + native_mode->hblank; | ||
| 205 | adjusted_mode->crtc_hsync_start = adjusted_mode->crtc_hdisplay + native_mode->hoverplus; | ||
| 206 | adjusted_mode->crtc_hsync_end = adjusted_mode->crtc_hsync_start + native_mode->hsync_width; | ||
| 207 | adjusted_mode->crtc_vtotal = adjusted_mode->crtc_vdisplay + native_mode->vblank; | ||
| 208 | adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + native_mode->voverplus; | ||
| 209 | adjusted_mode->crtc_vsync_end = adjusted_mode->crtc_vsync_start + native_mode->vsync_width; | ||
| 210 | } | 183 | } |
| 211 | adjusted_mode->flags = native_mode->flags; | 184 | adjusted_mode->base.id = mode_id; |
| 212 | adjusted_mode->clock = native_mode->dotclock; | ||
| 213 | } | 185 | } |
| 214 | } | 186 | } |
| 215 | 187 | ||
| @@ -219,7 +191,11 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, | |||
| 219 | struct drm_display_mode *adjusted_mode) | 191 | struct drm_display_mode *adjusted_mode) |
| 220 | { | 192 | { |
| 221 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 193 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 194 | struct drm_device *dev = encoder->dev; | ||
| 195 | struct radeon_device *rdev = dev->dev_private; | ||
| 222 | 196 | ||
| 197 | /* set the active encoder to connector routing */ | ||
| 198 | radeon_encoder_set_active_device(encoder); | ||
| 223 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 199 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
| 224 | 200 | ||
| 225 | if (radeon_encoder->rmx_type != RMX_OFF) | 201 | if (radeon_encoder->rmx_type != RMX_OFF) |
| @@ -230,6 +206,18 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, | |||
| 230 | && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2))) | 206 | && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2))) |
| 231 | adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2; | 207 | adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2; |
| 232 | 208 | ||
| 209 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) { | ||
| 210 | struct radeon_encoder_atom_dac *tv_dac = radeon_encoder->enc_priv; | ||
| 211 | if (tv_dac) { | ||
| 212 | if (tv_dac->tv_std == TV_STD_NTSC || | ||
| 213 | tv_dac->tv_std == TV_STD_NTSC_J || | ||
| 214 | tv_dac->tv_std == TV_STD_PAL_M) | ||
| 215 | radeon_atom_get_tv_timings(rdev, 0, adjusted_mode); | ||
| 216 | else | ||
| 217 | radeon_atom_get_tv_timings(rdev, 1, adjusted_mode); | ||
| 218 | } | ||
| 219 | } | ||
| 220 | |||
| 233 | return true; | 221 | return true; |
| 234 | } | 222 | } |
| 235 | 223 | ||
| @@ -461,7 +449,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) | |||
| 461 | case 1: | 449 | case 1: |
| 462 | args.v1.ucMisc = 0; | 450 | args.v1.ucMisc = 0; |
| 463 | args.v1.ucAction = action; | 451 | args.v1.ucAction = action; |
| 464 | if (drm_detect_hdmi_monitor((struct edid *)connector->edid_blob_ptr)) | 452 | if (drm_detect_hdmi_monitor(radeon_connector->edid)) |
| 465 | args.v1.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; | 453 | args.v1.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; |
| 466 | args.v1.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | 454 | args.v1.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); |
| 467 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 455 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
| @@ -486,7 +474,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) | |||
| 486 | if (dig->coherent_mode) | 474 | if (dig->coherent_mode) |
| 487 | args.v2.ucMisc |= PANEL_ENCODER_MISC_COHERENT; | 475 | args.v2.ucMisc |= PANEL_ENCODER_MISC_COHERENT; |
| 488 | } | 476 | } |
| 489 | if (drm_detect_hdmi_monitor((struct edid *)connector->edid_blob_ptr)) | 477 | if (drm_detect_hdmi_monitor(radeon_connector->edid)) |
| 490 | args.v2.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; | 478 | args.v2.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; |
| 491 | args.v2.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | 479 | args.v2.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); |
| 492 | args.v2.ucTruncate = 0; | 480 | args.v2.ucTruncate = 0; |
| @@ -544,7 +532,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
| 544 | switch (connector->connector_type) { | 532 | switch (connector->connector_type) { |
| 545 | case DRM_MODE_CONNECTOR_DVII: | 533 | case DRM_MODE_CONNECTOR_DVII: |
| 546 | case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ | 534 | case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ |
| 547 | if (drm_detect_hdmi_monitor((struct edid *)connector->edid_blob_ptr)) | 535 | if (drm_detect_hdmi_monitor(radeon_connector->edid)) |
| 548 | return ATOM_ENCODER_MODE_HDMI; | 536 | return ATOM_ENCODER_MODE_HDMI; |
| 549 | else if (radeon_connector->use_digital) | 537 | else if (radeon_connector->use_digital) |
| 550 | return ATOM_ENCODER_MODE_DVI; | 538 | return ATOM_ENCODER_MODE_DVI; |
| @@ -554,7 +542,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
| 554 | case DRM_MODE_CONNECTOR_DVID: | 542 | case DRM_MODE_CONNECTOR_DVID: |
| 555 | case DRM_MODE_CONNECTOR_HDMIA: | 543 | case DRM_MODE_CONNECTOR_HDMIA: |
| 556 | default: | 544 | default: |
| 557 | if (drm_detect_hdmi_monitor((struct edid *)connector->edid_blob_ptr)) | 545 | if (drm_detect_hdmi_monitor(radeon_connector->edid)) |
| 558 | return ATOM_ENCODER_MODE_HDMI; | 546 | return ATOM_ENCODER_MODE_HDMI; |
| 559 | else | 547 | else |
| 560 | return ATOM_ENCODER_MODE_DVI; | 548 | return ATOM_ENCODER_MODE_DVI; |
| @@ -566,7 +554,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
| 566 | /*if (radeon_output->MonType == MT_DP) | 554 | /*if (radeon_output->MonType == MT_DP) |
| 567 | return ATOM_ENCODER_MODE_DP; | 555 | return ATOM_ENCODER_MODE_DP; |
| 568 | else*/ | 556 | else*/ |
| 569 | if (drm_detect_hdmi_monitor((struct edid *)connector->edid_blob_ptr)) | 557 | if (drm_detect_hdmi_monitor(radeon_connector->edid)) |
| 570 | return ATOM_ENCODER_MODE_HDMI; | 558 | return ATOM_ENCODER_MODE_HDMI; |
| 571 | else | 559 | else |
| 572 | return ATOM_ENCODER_MODE_DVI; | 560 | return ATOM_ENCODER_MODE_DVI; |
| @@ -734,14 +722,17 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action) | |||
| 734 | atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev); | 722 | atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev); |
| 735 | 723 | ||
| 736 | args.v1.ucAction = action; | 724 | args.v1.ucAction = action; |
| 737 | 725 | if (action == ATOM_TRANSMITTER_ACTION_INIT) { | |
| 726 | args.v1.usInitInfo = radeon_connector->connector_object_id; | ||
| 727 | } else { | ||
| 728 | if (radeon_encoder->pixel_clock > 165000) | ||
| 729 | args.v1.usPixelClock = cpu_to_le16((radeon_encoder->pixel_clock / 2) / 10); | ||
| 730 | else | ||
| 731 | args.v1.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | ||
| 732 | } | ||
| 738 | if (ASIC_IS_DCE32(rdev)) { | 733 | if (ASIC_IS_DCE32(rdev)) { |
| 739 | if (radeon_encoder->pixel_clock > 165000) { | 734 | if (radeon_encoder->pixel_clock > 165000) |
| 740 | args.v2.usPixelClock = cpu_to_le16((radeon_encoder->pixel_clock * 10 * 2) / 100); | 735 | args.v2.usPixelClock = cpu_to_le16((radeon_encoder->pixel_clock / 2) / 10); |
| 741 | args.v2.acConfig.fDualLinkConnector = 1; | ||
| 742 | } else { | ||
| 743 | args.v2.usPixelClock = cpu_to_le16((radeon_encoder->pixel_clock * 10 * 4) / 100); | ||
| 744 | } | ||
| 745 | if (dig->dig_block) | 736 | if (dig->dig_block) |
| 746 | args.v2.acConfig.ucEncoderSel = 1; | 737 | args.v2.acConfig.ucEncoderSel = 1; |
| 747 | 738 | ||
| @@ -766,7 +757,6 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action) | |||
| 766 | } | 757 | } |
| 767 | } else { | 758 | } else { |
| 768 | args.v1.ucConfig = ATOM_TRANSMITTER_CONFIG_CLKSRC_PPLL; | 759 | args.v1.ucConfig = ATOM_TRANSMITTER_CONFIG_CLKSRC_PPLL; |
| 769 | args.v1.usPixelClock = cpu_to_le16((radeon_encoder->pixel_clock) / 10); | ||
| 770 | 760 | ||
| 771 | switch (radeon_encoder->encoder_id) { | 761 | switch (radeon_encoder->encoder_id) { |
| 772 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: | 762 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: |
| @@ -874,16 +864,9 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
| 874 | DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; | 864 | DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; |
| 875 | int index = 0; | 865 | int index = 0; |
| 876 | bool is_dig = false; | 866 | bool is_dig = false; |
| 877 | int devices; | ||
| 878 | 867 | ||
| 879 | memset(&args, 0, sizeof(args)); | 868 | memset(&args, 0, sizeof(args)); |
| 880 | 869 | ||
| 881 | /* on DPMS off we have no idea if active device is meaningful */ | ||
| 882 | if (mode != DRM_MODE_DPMS_ON && !radeon_encoder->active_device) | ||
| 883 | devices = radeon_encoder->devices; | ||
| 884 | else | ||
| 885 | devices = radeon_encoder->active_device; | ||
| 886 | |||
| 887 | DRM_DEBUG("encoder dpms %d to mode %d, devices %08x, active_devices %08x\n", | 870 | DRM_DEBUG("encoder dpms %d to mode %d, devices %08x, active_devices %08x\n", |
| 888 | radeon_encoder->encoder_id, mode, radeon_encoder->devices, | 871 | radeon_encoder->encoder_id, mode, radeon_encoder->devices, |
| 889 | radeon_encoder->active_device); | 872 | radeon_encoder->active_device); |
| @@ -914,18 +897,18 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
| 914 | break; | 897 | break; |
| 915 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: | 898 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: |
| 916 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: | 899 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: |
| 917 | if (devices & (ATOM_DEVICE_TV_SUPPORT)) | 900 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) |
| 918 | index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); | 901 | index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); |
| 919 | else if (devices & (ATOM_DEVICE_CV_SUPPORT)) | 902 | else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) |
| 920 | index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); | 903 | index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); |
| 921 | else | 904 | else |
| 922 | index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl); | 905 | index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl); |
| 923 | break; | 906 | break; |
| 924 | case ENCODER_OBJECT_ID_INTERNAL_DAC2: | 907 | case ENCODER_OBJECT_ID_INTERNAL_DAC2: |
| 925 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: | 908 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: |
| 926 | if (devices & (ATOM_DEVICE_TV_SUPPORT)) | 909 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) |
| 927 | index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); | 910 | index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); |
| 928 | else if (devices & (ATOM_DEVICE_CV_SUPPORT)) | 911 | else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) |
| 929 | index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); | 912 | index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); |
| 930 | else | 913 | else |
| 931 | index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); | 914 | index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); |
| @@ -1104,8 +1087,11 @@ atombios_apply_encoder_quirks(struct drm_encoder *encoder, | |||
| 1104 | } | 1087 | } |
| 1105 | 1088 | ||
| 1106 | /* set scaler clears this on some chips */ | 1089 | /* set scaler clears this on some chips */ |
| 1107 | if (ASIC_IS_AVIVO(rdev) && (mode->flags & DRM_MODE_FLAG_INTERLACE)) | 1090 | if (!(radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))) { |
| 1108 | WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset, AVIVO_D1MODE_INTERLEAVE_EN); | 1091 | if (ASIC_IS_AVIVO(rdev) && (mode->flags & DRM_MODE_FLAG_INTERLACE)) |
| 1092 | WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset, | ||
| 1093 | AVIVO_D1MODE_INTERLEAVE_EN); | ||
| 1094 | } | ||
| 1109 | } | 1095 | } |
| 1110 | 1096 | ||
| 1111 | static void | 1097 | static void |
| @@ -1153,6 +1139,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
| 1153 | 1139 | ||
| 1154 | /* setup and enable the encoder and transmitter */ | 1140 | /* setup and enable the encoder and transmitter */ |
| 1155 | atombios_dig_encoder_setup(encoder, ATOM_ENABLE); | 1141 | atombios_dig_encoder_setup(encoder, ATOM_ENABLE); |
| 1142 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_INIT); | ||
| 1156 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP); | 1143 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP); |
| 1157 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE); | 1144 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE); |
| 1158 | break; | 1145 | break; |
| @@ -1268,8 +1255,6 @@ static void radeon_atom_encoder_prepare(struct drm_encoder *encoder) | |||
| 1268 | { | 1255 | { |
| 1269 | radeon_atom_output_lock(encoder, true); | 1256 | radeon_atom_output_lock(encoder, true); |
| 1270 | radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); | 1257 | radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); |
| 1271 | |||
| 1272 | radeon_encoder_set_active_device(encoder); | ||
| 1273 | } | 1258 | } |
| 1274 | 1259 | ||
| 1275 | static void radeon_atom_encoder_commit(struct drm_encoder *encoder) | 1260 | static void radeon_atom_encoder_commit(struct drm_encoder *encoder) |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index a931af065dd4..a68d7566178c 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
| @@ -140,15 +140,15 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, | |||
| 140 | WARN(1, "trying to unbind memory to unitialized GART !\n"); | 140 | WARN(1, "trying to unbind memory to unitialized GART !\n"); |
| 141 | return; | 141 | return; |
| 142 | } | 142 | } |
| 143 | t = offset / 4096; | 143 | t = offset / RADEON_GPU_PAGE_SIZE; |
| 144 | p = t / (PAGE_SIZE / 4096); | 144 | p = t / (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); |
| 145 | for (i = 0; i < pages; i++, p++) { | 145 | for (i = 0; i < pages; i++, p++) { |
| 146 | if (rdev->gart.pages[p]) { | 146 | if (rdev->gart.pages[p]) { |
| 147 | pci_unmap_page(rdev->pdev, rdev->gart.pages_addr[p], | 147 | pci_unmap_page(rdev->pdev, rdev->gart.pages_addr[p], |
| 148 | PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); | 148 | PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
| 149 | rdev->gart.pages[p] = NULL; | 149 | rdev->gart.pages[p] = NULL; |
| 150 | rdev->gart.pages_addr[p] = 0; | 150 | rdev->gart.pages_addr[p] = 0; |
| 151 | for (j = 0; j < (PAGE_SIZE / 4096); j++, t++) { | 151 | for (j = 0; j < (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); j++, t++) { |
| 152 | radeon_gart_set_page(rdev, t, 0); | 152 | radeon_gart_set_page(rdev, t, 0); |
| 153 | } | 153 | } |
| 154 | } | 154 | } |
| @@ -169,8 +169,8 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, | |||
| 169 | DRM_ERROR("trying to bind memory to unitialized GART !\n"); | 169 | DRM_ERROR("trying to bind memory to unitialized GART !\n"); |
| 170 | return -EINVAL; | 170 | return -EINVAL; |
| 171 | } | 171 | } |
| 172 | t = offset / 4096; | 172 | t = offset / RADEON_GPU_PAGE_SIZE; |
| 173 | p = t / (PAGE_SIZE / 4096); | 173 | p = t / (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); |
| 174 | 174 | ||
| 175 | for (i = 0; i < pages; i++, p++) { | 175 | for (i = 0; i < pages; i++, p++) { |
| 176 | /* we need to support large memory configurations */ | 176 | /* we need to support large memory configurations */ |
| @@ -185,9 +185,9 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, | |||
| 185 | } | 185 | } |
| 186 | rdev->gart.pages[p] = pagelist[i]; | 186 | rdev->gart.pages[p] = pagelist[i]; |
| 187 | page_base = rdev->gart.pages_addr[p]; | 187 | page_base = rdev->gart.pages_addr[p]; |
| 188 | for (j = 0; j < (PAGE_SIZE / 4096); j++, t++) { | 188 | for (j = 0; j < (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); j++, t++) { |
| 189 | radeon_gart_set_page(rdev, t, page_base); | 189 | radeon_gart_set_page(rdev, t, page_base); |
| 190 | page_base += 4096; | 190 | page_base += RADEON_GPU_PAGE_SIZE; |
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| 193 | mb(); | 193 | mb(); |
| @@ -200,14 +200,14 @@ int radeon_gart_init(struct radeon_device *rdev) | |||
| 200 | if (rdev->gart.pages) { | 200 | if (rdev->gart.pages) { |
| 201 | return 0; | 201 | return 0; |
| 202 | } | 202 | } |
| 203 | /* We need PAGE_SIZE >= 4096 */ | 203 | /* We need PAGE_SIZE >= RADEON_GPU_PAGE_SIZE */ |
| 204 | if (PAGE_SIZE < 4096) { | 204 | if (PAGE_SIZE < RADEON_GPU_PAGE_SIZE) { |
| 205 | DRM_ERROR("Page size is smaller than GPU page size!\n"); | 205 | DRM_ERROR("Page size is smaller than GPU page size!\n"); |
| 206 | return -EINVAL; | 206 | return -EINVAL; |
| 207 | } | 207 | } |
| 208 | /* Compute table size */ | 208 | /* Compute table size */ |
| 209 | rdev->gart.num_cpu_pages = rdev->mc.gtt_size / PAGE_SIZE; | 209 | rdev->gart.num_cpu_pages = rdev->mc.gtt_size / PAGE_SIZE; |
| 210 | rdev->gart.num_gpu_pages = rdev->mc.gtt_size / 4096; | 210 | rdev->gart.num_gpu_pages = rdev->mc.gtt_size / RADEON_GPU_PAGE_SIZE; |
| 211 | DRM_INFO("GART: num cpu pages %u, num gpu pages %u\n", | 211 | DRM_INFO("GART: num cpu pages %u, num gpu pages %u\n", |
| 212 | rdev->gart.num_cpu_pages, rdev->gart.num_gpu_pages); | 212 | rdev->gart.num_cpu_pages, rdev->gart.num_gpu_pages); |
| 213 | /* Allocate pages table */ | 213 | /* Allocate pages table */ |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 8e0a8759e428..a0fe6232dcb6 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
| @@ -92,6 +92,13 @@ int radeon_irq_kms_init(struct radeon_device *rdev) | |||
| 92 | if (r) { | 92 | if (r) { |
| 93 | return r; | 93 | return r; |
| 94 | } | 94 | } |
| 95 | /* enable msi */ | ||
| 96 | rdev->msi_enabled = 0; | ||
| 97 | if (rdev->family >= CHIP_RV380) { | ||
| 98 | int ret = pci_enable_msi(rdev->pdev); | ||
| 99 | if (!ret) | ||
| 100 | rdev->msi_enabled = 1; | ||
| 101 | } | ||
| 95 | drm_irq_install(rdev->ddev); | 102 | drm_irq_install(rdev->ddev); |
| 96 | rdev->irq.installed = true; | 103 | rdev->irq.installed = true; |
| 97 | DRM_INFO("radeon: irq initialized.\n"); | 104 | DRM_INFO("radeon: irq initialized.\n"); |
| @@ -103,5 +110,7 @@ void radeon_irq_kms_fini(struct radeon_device *rdev) | |||
| 103 | if (rdev->irq.installed) { | 110 | if (rdev->irq.installed) { |
| 104 | rdev->irq.installed = false; | 111 | rdev->irq.installed = false; |
| 105 | drm_irq_uninstall(rdev->ddev); | 112 | drm_irq_uninstall(rdev->ddev); |
| 113 | if (rdev->msi_enabled) | ||
| 114 | pci_disable_msi(rdev->pdev); | ||
| 106 | } | 115 | } |
| 107 | } | 116 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index 36410f85d705..8d0b7aa87fa4 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | |||
| @@ -48,7 +48,7 @@ static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc, | |||
| 48 | u32 fp_horz_stretch, fp_vert_stretch, fp_horz_vert_active; | 48 | u32 fp_horz_stretch, fp_vert_stretch, fp_horz_vert_active; |
| 49 | u32 fp_h_sync_strt_wid, fp_crtc_h_total_disp; | 49 | u32 fp_h_sync_strt_wid, fp_crtc_h_total_disp; |
| 50 | u32 fp_v_sync_strt_wid, fp_crtc_v_total_disp; | 50 | u32 fp_v_sync_strt_wid, fp_crtc_v_total_disp; |
| 51 | struct radeon_native_mode *native_mode = &radeon_crtc->native_mode; | 51 | struct drm_display_mode *native_mode = &radeon_crtc->native_mode; |
| 52 | 52 | ||
| 53 | fp_vert_stretch = RREG32(RADEON_FP_VERT_STRETCH) & | 53 | fp_vert_stretch = RREG32(RADEON_FP_VERT_STRETCH) & |
| 54 | (RADEON_VERT_STRETCH_RESERVED | | 54 | (RADEON_VERT_STRETCH_RESERVED | |
| @@ -95,19 +95,19 @@ static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc, | |||
| 95 | 95 | ||
| 96 | fp_horz_vert_active = 0; | 96 | fp_horz_vert_active = 0; |
| 97 | 97 | ||
| 98 | if (native_mode->panel_xres == 0 || | 98 | if (native_mode->hdisplay == 0 || |
| 99 | native_mode->panel_yres == 0) { | 99 | native_mode->vdisplay == 0) { |
| 100 | hscale = false; | 100 | hscale = false; |
| 101 | vscale = false; | 101 | vscale = false; |
| 102 | } else { | 102 | } else { |
| 103 | if (xres > native_mode->panel_xres) | 103 | if (xres > native_mode->hdisplay) |
| 104 | xres = native_mode->panel_xres; | 104 | xres = native_mode->hdisplay; |
| 105 | if (yres > native_mode->panel_yres) | 105 | if (yres > native_mode->vdisplay) |
| 106 | yres = native_mode->panel_yres; | 106 | yres = native_mode->vdisplay; |
| 107 | 107 | ||
| 108 | if (xres == native_mode->panel_xres) | 108 | if (xres == native_mode->hdisplay) |
| 109 | hscale = false; | 109 | hscale = false; |
| 110 | if (yres == native_mode->panel_yres) | 110 | if (yres == native_mode->vdisplay) |
| 111 | vscale = false; | 111 | vscale = false; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| @@ -119,11 +119,11 @@ static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc, | |||
| 119 | else { | 119 | else { |
| 120 | inc = (fp_horz_stretch & RADEON_HORZ_AUTO_RATIO_INC) ? 1 : 0; | 120 | inc = (fp_horz_stretch & RADEON_HORZ_AUTO_RATIO_INC) ? 1 : 0; |
| 121 | scale = ((xres + inc) * RADEON_HORZ_STRETCH_RATIO_MAX) | 121 | scale = ((xres + inc) * RADEON_HORZ_STRETCH_RATIO_MAX) |
| 122 | / native_mode->panel_xres + 1; | 122 | / native_mode->hdisplay + 1; |
| 123 | fp_horz_stretch |= (((scale) & RADEON_HORZ_STRETCH_RATIO_MASK) | | 123 | fp_horz_stretch |= (((scale) & RADEON_HORZ_STRETCH_RATIO_MASK) | |
| 124 | RADEON_HORZ_STRETCH_BLEND | | 124 | RADEON_HORZ_STRETCH_BLEND | |
| 125 | RADEON_HORZ_STRETCH_ENABLE | | 125 | RADEON_HORZ_STRETCH_ENABLE | |
| 126 | ((native_mode->panel_xres/8-1) << 16)); | 126 | ((native_mode->hdisplay/8-1) << 16)); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | if (!vscale) | 129 | if (!vscale) |
| @@ -131,11 +131,11 @@ static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc, | |||
| 131 | else { | 131 | else { |
| 132 | inc = (fp_vert_stretch & RADEON_VERT_AUTO_RATIO_INC) ? 1 : 0; | 132 | inc = (fp_vert_stretch & RADEON_VERT_AUTO_RATIO_INC) ? 1 : 0; |
| 133 | scale = ((yres + inc) * RADEON_VERT_STRETCH_RATIO_MAX) | 133 | scale = ((yres + inc) * RADEON_VERT_STRETCH_RATIO_MAX) |
| 134 | / native_mode->panel_yres + 1; | 134 | / native_mode->vdisplay + 1; |
| 135 | fp_vert_stretch |= (((scale) & RADEON_VERT_STRETCH_RATIO_MASK) | | 135 | fp_vert_stretch |= (((scale) & RADEON_VERT_STRETCH_RATIO_MASK) | |
| 136 | RADEON_VERT_STRETCH_ENABLE | | 136 | RADEON_VERT_STRETCH_ENABLE | |
| 137 | RADEON_VERT_STRETCH_BLEND | | 137 | RADEON_VERT_STRETCH_BLEND | |
| 138 | ((native_mode->panel_yres-1) << 12)); | 138 | ((native_mode->vdisplay-1) << 12)); |
| 139 | } | 139 | } |
| 140 | break; | 140 | break; |
| 141 | case RMX_CENTER: | 141 | case RMX_CENTER: |
| @@ -175,8 +175,8 @@ static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc, | |||
| 175 | ? RADEON_CRTC_V_SYNC_POL | 175 | ? RADEON_CRTC_V_SYNC_POL |
| 176 | : 0))); | 176 | : 0))); |
| 177 | 177 | ||
| 178 | fp_horz_vert_active = (((native_mode->panel_yres) & 0xfff) | | 178 | fp_horz_vert_active = (((native_mode->vdisplay) & 0xfff) | |
| 179 | (((native_mode->panel_xres / 8) & 0x1ff) << 16)); | 179 | (((native_mode->hdisplay / 8) & 0x1ff) << 16)); |
| 180 | break; | 180 | break; |
| 181 | case RMX_OFF: | 181 | case RMX_OFF: |
| 182 | default: | 182 | default: |
| @@ -532,6 +532,10 @@ int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y, | |||
| 532 | radeon_fb = to_radeon_framebuffer(old_fb); | 532 | radeon_fb = to_radeon_framebuffer(old_fb); |
| 533 | radeon_gem_object_unpin(radeon_fb->obj); | 533 | radeon_gem_object_unpin(radeon_fb->obj); |
| 534 | } | 534 | } |
| 535 | |||
| 536 | /* Bytes per pixel may have changed */ | ||
| 537 | radeon_bandwidth_update(rdev); | ||
| 538 | |||
| 535 | return 0; | 539 | return 0; |
| 536 | } | 540 | } |
| 537 | 541 | ||
| @@ -664,6 +668,9 @@ static bool radeon_set_crtc_timing(struct drm_crtc *crtc, struct drm_display_mod | |||
| 664 | 668 | ||
| 665 | WREG32(RADEON_DISP2_MERGE_CNTL, disp2_merge_cntl); | 669 | WREG32(RADEON_DISP2_MERGE_CNTL, disp2_merge_cntl); |
| 666 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); | 670 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); |
| 671 | |||
| 672 | WREG32(RADEON_FP_H2_SYNC_STRT_WID, crtc_h_sync_strt_wid); | ||
| 673 | WREG32(RADEON_FP_V2_SYNC_STRT_WID, crtc_v_sync_strt_wid); | ||
| 667 | } else { | 674 | } else { |
| 668 | uint32_t crtc_gen_cntl; | 675 | uint32_t crtc_gen_cntl; |
| 669 | uint32_t crtc_ext_cntl; | 676 | uint32_t crtc_ext_cntl; |
| @@ -1015,14 +1022,11 @@ static int radeon_crtc_mode_set(struct drm_crtc *crtc, | |||
| 1015 | int x, int y, struct drm_framebuffer *old_fb) | 1022 | int x, int y, struct drm_framebuffer *old_fb) |
| 1016 | { | 1023 | { |
| 1017 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 1024 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
| 1018 | struct drm_device *dev = crtc->dev; | ||
| 1019 | struct radeon_device *rdev = dev->dev_private; | ||
| 1020 | 1025 | ||
| 1021 | /* TODO TV */ | 1026 | /* TODO TV */ |
| 1022 | radeon_crtc_set_base(crtc, x, y, old_fb); | 1027 | radeon_crtc_set_base(crtc, x, y, old_fb); |
| 1023 | radeon_set_crtc_timing(crtc, adjusted_mode); | 1028 | radeon_set_crtc_timing(crtc, adjusted_mode); |
| 1024 | radeon_set_pll(crtc, adjusted_mode); | 1029 | radeon_set_pll(crtc, adjusted_mode); |
| 1025 | radeon_bandwidth_update(rdev); | ||
| 1026 | if (radeon_crtc->crtc_id == 0) { | 1030 | if (radeon_crtc->crtc_id == 0) { |
| 1027 | radeon_legacy_rmx_mode_set(crtc, mode, adjusted_mode); | 1031 | radeon_legacy_rmx_mode_set(crtc, mode, adjusted_mode); |
| 1028 | } else { | 1032 | } else { |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 6ceb958fd194..00382122869b 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
| @@ -107,8 +107,6 @@ static void radeon_legacy_lvds_prepare(struct drm_encoder *encoder) | |||
| 107 | else | 107 | else |
| 108 | radeon_combios_output_lock(encoder, true); | 108 | radeon_combios_output_lock(encoder, true); |
| 109 | radeon_legacy_lvds_dpms(encoder, DRM_MODE_DPMS_OFF); | 109 | radeon_legacy_lvds_dpms(encoder, DRM_MODE_DPMS_OFF); |
| 110 | |||
| 111 | radeon_encoder_set_active_device(encoder); | ||
| 112 | } | 110 | } |
| 113 | 111 | ||
| 114 | static void radeon_legacy_lvds_commit(struct drm_encoder *encoder) | 112 | static void radeon_legacy_lvds_commit(struct drm_encoder *encoder) |
| @@ -192,6 +190,8 @@ static bool radeon_legacy_lvds_mode_fixup(struct drm_encoder *encoder, | |||
| 192 | { | 190 | { |
| 193 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 191 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 194 | 192 | ||
| 193 | /* set the active encoder to connector routing */ | ||
| 194 | radeon_encoder_set_active_device(encoder); | ||
| 195 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 195 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
| 196 | 196 | ||
| 197 | if (radeon_encoder->rmx_type != RMX_OFF) | 197 | if (radeon_encoder->rmx_type != RMX_OFF) |
| @@ -218,7 +218,8 @@ static bool radeon_legacy_primary_dac_mode_fixup(struct drm_encoder *encoder, | |||
| 218 | struct drm_display_mode *mode, | 218 | struct drm_display_mode *mode, |
| 219 | struct drm_display_mode *adjusted_mode) | 219 | struct drm_display_mode *adjusted_mode) |
| 220 | { | 220 | { |
| 221 | 221 | /* set the active encoder to connector routing */ | |
| 222 | radeon_encoder_set_active_device(encoder); | ||
| 222 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 223 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
| 223 | 224 | ||
| 224 | return true; | 225 | return true; |
| @@ -272,7 +273,6 @@ static void radeon_legacy_primary_dac_prepare(struct drm_encoder *encoder) | |||
| 272 | else | 273 | else |
| 273 | radeon_combios_output_lock(encoder, true); | 274 | radeon_combios_output_lock(encoder, true); |
| 274 | radeon_legacy_primary_dac_dpms(encoder, DRM_MODE_DPMS_OFF); | 275 | radeon_legacy_primary_dac_dpms(encoder, DRM_MODE_DPMS_OFF); |
| 275 | radeon_encoder_set_active_device(encoder); | ||
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | static void radeon_legacy_primary_dac_commit(struct drm_encoder *encoder) | 278 | static void radeon_legacy_primary_dac_commit(struct drm_encoder *encoder) |
| @@ -468,7 +468,6 @@ static void radeon_legacy_tmds_int_prepare(struct drm_encoder *encoder) | |||
| 468 | else | 468 | else |
| 469 | radeon_combios_output_lock(encoder, true); | 469 | radeon_combios_output_lock(encoder, true); |
| 470 | radeon_legacy_tmds_int_dpms(encoder, DRM_MODE_DPMS_OFF); | 470 | radeon_legacy_tmds_int_dpms(encoder, DRM_MODE_DPMS_OFF); |
| 471 | radeon_encoder_set_active_device(encoder); | ||
| 472 | } | 471 | } |
| 473 | 472 | ||
| 474 | static void radeon_legacy_tmds_int_commit(struct drm_encoder *encoder) | 473 | static void radeon_legacy_tmds_int_commit(struct drm_encoder *encoder) |
| @@ -543,6 +542,14 @@ static void radeon_legacy_tmds_int_mode_set(struct drm_encoder *encoder, | |||
| 543 | 542 | ||
| 544 | fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN); | 543 | fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN); |
| 545 | 544 | ||
| 545 | fp_gen_cntl &= ~(RADEON_FP_RMX_HVSYNC_CONTROL_EN | | ||
| 546 | RADEON_FP_DFP_SYNC_SEL | | ||
| 547 | RADEON_FP_CRT_SYNC_SEL | | ||
| 548 | RADEON_FP_CRTC_LOCK_8DOT | | ||
| 549 | RADEON_FP_USE_SHADOW_EN | | ||
| 550 | RADEON_FP_CRTC_USE_SHADOW_VEND | | ||
| 551 | RADEON_FP_CRT_SYNC_ALT); | ||
| 552 | |||
| 546 | if (1) /* FIXME rgbBits == 8 */ | 553 | if (1) /* FIXME rgbBits == 8 */ |
| 547 | fp_gen_cntl |= RADEON_FP_PANEL_FORMAT; /* 24 bit format */ | 554 | fp_gen_cntl |= RADEON_FP_PANEL_FORMAT; /* 24 bit format */ |
| 548 | else | 555 | else |
| @@ -556,7 +563,7 @@ static void radeon_legacy_tmds_int_mode_set(struct drm_encoder *encoder, | |||
| 556 | else | 563 | else |
| 557 | fp_gen_cntl |= R200_FP_SOURCE_SEL_CRTC1; | 564 | fp_gen_cntl |= R200_FP_SOURCE_SEL_CRTC1; |
| 558 | } else | 565 | } else |
| 559 | fp_gen_cntl |= RADEON_FP_SEL_CRTC1; | 566 | fp_gen_cntl &= ~RADEON_FP_SEL_CRTC2; |
| 560 | } else { | 567 | } else { |
| 561 | if (ASIC_IS_R300(rdev) || rdev->family == CHIP_R200) { | 568 | if (ASIC_IS_R300(rdev) || rdev->family == CHIP_R200) { |
| 562 | fp_gen_cntl &= ~R200_FP_SOURCE_SEL_MASK; | 569 | fp_gen_cntl &= ~R200_FP_SOURCE_SEL_MASK; |
| @@ -593,7 +600,8 @@ static bool radeon_legacy_tmds_ext_mode_fixup(struct drm_encoder *encoder, | |||
| 593 | struct drm_display_mode *mode, | 600 | struct drm_display_mode *mode, |
| 594 | struct drm_display_mode *adjusted_mode) | 601 | struct drm_display_mode *adjusted_mode) |
| 595 | { | 602 | { |
| 596 | 603 | /* set the active encoder to connector routing */ | |
| 604 | radeon_encoder_set_active_device(encoder); | ||
| 597 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 605 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
| 598 | 606 | ||
| 599 | return true; | 607 | return true; |
| @@ -636,7 +644,6 @@ static void radeon_legacy_tmds_ext_prepare(struct drm_encoder *encoder) | |||
| 636 | else | 644 | else |
| 637 | radeon_combios_output_lock(encoder, true); | 645 | radeon_combios_output_lock(encoder, true); |
| 638 | radeon_legacy_tmds_ext_dpms(encoder, DRM_MODE_DPMS_OFF); | 646 | radeon_legacy_tmds_ext_dpms(encoder, DRM_MODE_DPMS_OFF); |
| 639 | radeon_encoder_set_active_device(encoder); | ||
| 640 | } | 647 | } |
| 641 | 648 | ||
| 642 | static void radeon_legacy_tmds_ext_commit(struct drm_encoder *encoder) | 649 | static void radeon_legacy_tmds_ext_commit(struct drm_encoder *encoder) |
| @@ -735,7 +742,8 @@ static bool radeon_legacy_tv_dac_mode_fixup(struct drm_encoder *encoder, | |||
| 735 | struct drm_display_mode *mode, | 742 | struct drm_display_mode *mode, |
| 736 | struct drm_display_mode *adjusted_mode) | 743 | struct drm_display_mode *adjusted_mode) |
| 737 | { | 744 | { |
| 738 | 745 | /* set the active encoder to connector routing */ | |
| 746 | radeon_encoder_set_active_device(encoder); | ||
| 739 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 747 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
| 740 | 748 | ||
| 741 | return true; | 749 | return true; |
| @@ -839,7 +847,6 @@ static void radeon_legacy_tv_dac_prepare(struct drm_encoder *encoder) | |||
| 839 | else | 847 | else |
| 840 | radeon_combios_output_lock(encoder, true); | 848 | radeon_combios_output_lock(encoder, true); |
| 841 | radeon_legacy_tv_dac_dpms(encoder, DRM_MODE_DPMS_OFF); | 849 | radeon_legacy_tv_dac_dpms(encoder, DRM_MODE_DPMS_OFF); |
| 842 | radeon_encoder_set_active_device(encoder); | ||
| 843 | } | 850 | } |
| 844 | 851 | ||
| 845 | static void radeon_legacy_tv_dac_commit(struct drm_encoder *encoder) | 852 | static void radeon_legacy_tv_dac_commit(struct drm_encoder *encoder) |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index e61226817ccf..ace726aa0d76 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
| @@ -172,6 +172,7 @@ enum radeon_connector_table { | |||
| 172 | 172 | ||
| 173 | struct radeon_mode_info { | 173 | struct radeon_mode_info { |
| 174 | struct atom_context *atom_context; | 174 | struct atom_context *atom_context; |
| 175 | struct card_info *atom_card_info; | ||
| 175 | enum radeon_connector_table connector_table; | 176 | enum radeon_connector_table connector_table; |
| 176 | bool mode_config_initialized; | 177 | bool mode_config_initialized; |
| 177 | struct radeon_crtc *crtcs[2]; | 178 | struct radeon_crtc *crtcs[2]; |
| @@ -186,17 +187,6 @@ struct radeon_mode_info { | |||
| 186 | 187 | ||
| 187 | }; | 188 | }; |
| 188 | 189 | ||
| 189 | struct radeon_native_mode { | ||
| 190 | /* preferred mode */ | ||
| 191 | uint32_t panel_xres, panel_yres; | ||
| 192 | uint32_t hoverplus, hsync_width; | ||
| 193 | uint32_t hblank; | ||
| 194 | uint32_t voverplus, vsync_width; | ||
| 195 | uint32_t vblank; | ||
| 196 | uint32_t dotclock; | ||
| 197 | uint32_t flags; | ||
| 198 | }; | ||
| 199 | |||
| 200 | #define MAX_H_CODE_TIMING_LEN 32 | 190 | #define MAX_H_CODE_TIMING_LEN 32 |
| 201 | #define MAX_V_CODE_TIMING_LEN 32 | 191 | #define MAX_V_CODE_TIMING_LEN 32 |
| 202 | 192 | ||
| @@ -228,7 +218,7 @@ struct radeon_crtc { | |||
| 228 | enum radeon_rmx_type rmx_type; | 218 | enum radeon_rmx_type rmx_type; |
| 229 | fixed20_12 vsc; | 219 | fixed20_12 vsc; |
| 230 | fixed20_12 hsc; | 220 | fixed20_12 hsc; |
| 231 | struct radeon_native_mode native_mode; | 221 | struct drm_display_mode native_mode; |
| 232 | }; | 222 | }; |
| 233 | 223 | ||
| 234 | struct radeon_encoder_primary_dac { | 224 | struct radeon_encoder_primary_dac { |
| @@ -248,7 +238,7 @@ struct radeon_encoder_lvds { | |||
| 248 | bool use_bios_dividers; | 238 | bool use_bios_dividers; |
| 249 | uint32_t lvds_gen_cntl; | 239 | uint32_t lvds_gen_cntl; |
| 250 | /* panel mode */ | 240 | /* panel mode */ |
| 251 | struct radeon_native_mode native_mode; | 241 | struct drm_display_mode native_mode; |
| 252 | }; | 242 | }; |
| 253 | 243 | ||
| 254 | struct radeon_encoder_tv_dac { | 244 | struct radeon_encoder_tv_dac { |
| @@ -271,6 +261,16 @@ struct radeon_encoder_int_tmds { | |||
| 271 | struct radeon_tmds_pll tmds_pll[4]; | 261 | struct radeon_tmds_pll tmds_pll[4]; |
| 272 | }; | 262 | }; |
| 273 | 263 | ||
| 264 | /* spread spectrum */ | ||
| 265 | struct radeon_atom_ss { | ||
| 266 | uint16_t percentage; | ||
| 267 | uint8_t type; | ||
| 268 | uint8_t step; | ||
| 269 | uint8_t delay; | ||
| 270 | uint8_t range; | ||
| 271 | uint8_t refdiv; | ||
| 272 | }; | ||
| 273 | |||
| 274 | struct radeon_encoder_atom_dig { | 274 | struct radeon_encoder_atom_dig { |
| 275 | /* atom dig */ | 275 | /* atom dig */ |
| 276 | bool coherent_mode; | 276 | bool coherent_mode; |
| @@ -278,8 +278,9 @@ struct radeon_encoder_atom_dig { | |||
| 278 | /* atom lvds */ | 278 | /* atom lvds */ |
| 279 | uint32_t lvds_misc; | 279 | uint32_t lvds_misc; |
| 280 | uint16_t panel_pwr_delay; | 280 | uint16_t panel_pwr_delay; |
| 281 | struct radeon_atom_ss *ss; | ||
| 281 | /* panel mode */ | 282 | /* panel mode */ |
| 282 | struct radeon_native_mode native_mode; | 283 | struct drm_display_mode native_mode; |
| 283 | }; | 284 | }; |
| 284 | 285 | ||
| 285 | struct radeon_encoder_atom_dac { | 286 | struct radeon_encoder_atom_dac { |
| @@ -294,7 +295,7 @@ struct radeon_encoder { | |||
| 294 | uint32_t flags; | 295 | uint32_t flags; |
| 295 | uint32_t pixel_clock; | 296 | uint32_t pixel_clock; |
| 296 | enum radeon_rmx_type rmx_type; | 297 | enum radeon_rmx_type rmx_type; |
| 297 | struct radeon_native_mode native_mode; | 298 | struct drm_display_mode native_mode; |
| 298 | void *enc_priv; | 299 | void *enc_priv; |
| 299 | }; | 300 | }; |
| 300 | 301 | ||
| @@ -308,12 +309,15 @@ struct radeon_connector { | |||
| 308 | uint32_t connector_id; | 309 | uint32_t connector_id; |
| 309 | uint32_t devices; | 310 | uint32_t devices; |
| 310 | struct radeon_i2c_chan *ddc_bus; | 311 | struct radeon_i2c_chan *ddc_bus; |
| 312 | /* some systems have a an hdmi and vga port with a shared ddc line */ | ||
| 313 | bool shared_ddc; | ||
| 311 | bool use_digital; | 314 | bool use_digital; |
| 312 | /* we need to mind the EDID between detect | 315 | /* we need to mind the EDID between detect |
| 313 | and get modes due to analog/digital/tvencoder */ | 316 | and get modes due to analog/digital/tvencoder */ |
| 314 | struct edid *edid; | 317 | struct edid *edid; |
| 315 | void *con_priv; | 318 | void *con_priv; |
| 316 | bool dac_load_detect; | 319 | bool dac_load_detect; |
| 320 | uint16_t connector_object_id; | ||
| 317 | }; | 321 | }; |
| 318 | 322 | ||
| 319 | struct radeon_framebuffer { | 323 | struct radeon_framebuffer { |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c new file mode 100644 index 000000000000..46146c6a2a06 --- /dev/null +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | /* | ||
| 2 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 3 | * copy of this software and associated documentation files (the "Software"), | ||
| 4 | * to deal in the Software without restriction, including without limitation | ||
| 5 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 6 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 7 | * Software is furnished to do so, subject to the following conditions: | ||
| 8 | * | ||
| 9 | * The above copyright notice and this permission notice shall be included in | ||
| 10 | * all copies or substantial portions of the Software. | ||
| 11 | * | ||
| 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 13 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 15 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 16 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 17 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 18 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 19 | * | ||
| 20 | * Authors: Rafał Miłecki <zajec5@gmail.com> | ||
| 21 | */ | ||
| 22 | #include "drmP.h" | ||
| 23 | #include "radeon.h" | ||
| 24 | |||
| 25 | int radeon_debugfs_pm_init(struct radeon_device *rdev); | ||
| 26 | |||
| 27 | int radeon_pm_init(struct radeon_device *rdev) | ||
| 28 | { | ||
| 29 | if (radeon_debugfs_pm_init(rdev)) { | ||
| 30 | DRM_ERROR("Failed to register debugfs file for CP !\n"); | ||
| 31 | } | ||
| 32 | |||
| 33 | return 0; | ||
| 34 | } | ||
| 35 | |||
| 36 | /* | ||
| 37 | * Debugfs info | ||
| 38 | */ | ||
| 39 | #if defined(CONFIG_DEBUG_FS) | ||
| 40 | |||
| 41 | static int radeon_debugfs_pm_info(struct seq_file *m, void *data) | ||
| 42 | { | ||
| 43 | struct drm_info_node *node = (struct drm_info_node *) m->private; | ||
| 44 | struct drm_device *dev = node->minor->dev; | ||
| 45 | struct radeon_device *rdev = dev->dev_private; | ||
| 46 | |||
| 47 | seq_printf(m, "engine clock: %u0 Hz\n", radeon_get_engine_clock(rdev)); | ||
| 48 | seq_printf(m, "memory clock: %u0 Hz\n", radeon_get_memory_clock(rdev)); | ||
| 49 | |||
| 50 | return 0; | ||
| 51 | } | ||
| 52 | |||
| 53 | static struct drm_info_list radeon_pm_info_list[] = { | ||
| 54 | {"radeon_pm_info", radeon_debugfs_pm_info, 0, NULL}, | ||
| 55 | }; | ||
| 56 | #endif | ||
| 57 | |||
| 58 | int radeon_debugfs_pm_init(struct radeon_device *rdev) | ||
| 59 | { | ||
| 60 | #if defined(CONFIG_DEBUG_FS) | ||
| 61 | return radeon_debugfs_add_files(rdev, radeon_pm_info_list, ARRAY_SIZE(radeon_pm_info_list)); | ||
| 62 | #else | ||
| 63 | return 0; | ||
| 64 | #endif | ||
| 65 | } | ||
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h index bfa1ab9c93e1..29ab75903ec1 100644 --- a/drivers/gpu/drm/radeon/radeon_reg.h +++ b/drivers/gpu/drm/radeon/radeon_reg.h | |||
| @@ -290,6 +290,8 @@ | |||
| 290 | #define RADEON_BUS_CNTL 0x0030 | 290 | #define RADEON_BUS_CNTL 0x0030 |
| 291 | # define RADEON_BUS_MASTER_DIS (1 << 6) | 291 | # define RADEON_BUS_MASTER_DIS (1 << 6) |
| 292 | # define RADEON_BUS_BIOS_DIS_ROM (1 << 12) | 292 | # define RADEON_BUS_BIOS_DIS_ROM (1 << 12) |
| 293 | # define RS600_BUS_MASTER_DIS (1 << 14) | ||
| 294 | # define RS600_MSI_REARM (1 << 20) /* rs600/rs690/rs740 */ | ||
| 293 | # define RADEON_BUS_RD_DISCARD_EN (1 << 24) | 295 | # define RADEON_BUS_RD_DISCARD_EN (1 << 24) |
| 294 | # define RADEON_BUS_RD_ABORT_EN (1 << 25) | 296 | # define RADEON_BUS_RD_ABORT_EN (1 << 25) |
| 295 | # define RADEON_BUS_MSTR_DISCONNECT_EN (1 << 28) | 297 | # define RADEON_BUS_MSTR_DISCONNECT_EN (1 << 28) |
| @@ -297,6 +299,9 @@ | |||
| 297 | # define RADEON_BUS_READ_BURST (1 << 30) | 299 | # define RADEON_BUS_READ_BURST (1 << 30) |
| 298 | #define RADEON_BUS_CNTL1 0x0034 | 300 | #define RADEON_BUS_CNTL1 0x0034 |
| 299 | # define RADEON_BUS_WAIT_ON_LOCK_EN (1 << 4) | 301 | # define RADEON_BUS_WAIT_ON_LOCK_EN (1 << 4) |
| 302 | /* rv370/rv380, rv410, r423/r430/r480, r5xx */ | ||
| 303 | #define RADEON_MSI_REARM_EN 0x0160 | ||
| 304 | # define RV370_MSI_REARM_EN (1 << 0) | ||
| 300 | 305 | ||
| 301 | /* #define RADEON_PCIE_INDEX 0x0030 */ | 306 | /* #define RADEON_PCIE_INDEX 0x0030 */ |
| 302 | /* #define RADEON_PCIE_DATA 0x0034 */ | 307 | /* #define RADEON_PCIE_DATA 0x0034 */ |
| @@ -3311,6 +3316,7 @@ | |||
| 3311 | #define RADEON_AIC_CNTL 0x01d0 | 3316 | #define RADEON_AIC_CNTL 0x01d0 |
| 3312 | # define RADEON_PCIGART_TRANSLATE_EN (1 << 0) | 3317 | # define RADEON_PCIGART_TRANSLATE_EN (1 << 0) |
| 3313 | # define RADEON_DIS_OUT_OF_PCI_GART_ACCESS (1 << 1) | 3318 | # define RADEON_DIS_OUT_OF_PCI_GART_ACCESS (1 << 1) |
| 3319 | # define RS400_MSI_REARM (1 << 3) /* rs400/rs480 */ | ||
| 3314 | #define RADEON_AIC_LO_ADDR 0x01dc | 3320 | #define RADEON_AIC_LO_ADDR 0x01dc |
| 3315 | #define RADEON_AIC_PT_BASE 0x01d8 | 3321 | #define RADEON_AIC_PT_BASE 0x01d8 |
| 3316 | #define RADEON_AIC_HI_ADDR 0x01e0 | 3322 | #define RADEON_AIC_HI_ADDR 0x01e0 |
diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c index 03c33cf4e14c..f8a465d9a1cf 100644 --- a/drivers/gpu/drm/radeon/radeon_test.c +++ b/drivers/gpu/drm/radeon/radeon_test.c | |||
| @@ -42,7 +42,7 @@ void radeon_test_moves(struct radeon_device *rdev) | |||
| 42 | /* Number of tests = | 42 | /* Number of tests = |
| 43 | * (Total GTT - IB pool - writeback page - ring buffer) / test size | 43 | * (Total GTT - IB pool - writeback page - ring buffer) / test size |
| 44 | */ | 44 | */ |
| 45 | n = (rdev->mc.gtt_size - RADEON_IB_POOL_SIZE*64*1024 - 4096 - | 45 | n = (rdev->mc.gtt_size - RADEON_IB_POOL_SIZE*64*1024 - RADEON_GPU_PAGE_SIZE - |
| 46 | rdev->cp.ring_size) / size; | 46 | rdev->cp.ring_size) / size; |
| 47 | 47 | ||
| 48 | gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL); | 48 | gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL); |
| @@ -102,7 +102,7 @@ void radeon_test_moves(struct radeon_device *rdev) | |||
| 102 | goto out_cleanup; | 102 | goto out_cleanup; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | r = radeon_copy(rdev, gtt_addr, vram_addr, size / 4096, fence); | 105 | r = radeon_copy(rdev, gtt_addr, vram_addr, size / RADEON_GPU_PAGE_SIZE, fence); |
| 106 | if (r) { | 106 | if (r) { |
| 107 | DRM_ERROR("Failed GTT->VRAM copy %d\n", i); | 107 | DRM_ERROR("Failed GTT->VRAM copy %d\n", i); |
| 108 | goto out_cleanup; | 108 | goto out_cleanup; |
| @@ -145,7 +145,7 @@ void radeon_test_moves(struct radeon_device *rdev) | |||
| 145 | goto out_cleanup; | 145 | goto out_cleanup; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | r = radeon_copy(rdev, vram_addr, gtt_addr, size / 4096, fence); | 148 | r = radeon_copy(rdev, vram_addr, gtt_addr, size / RADEON_GPU_PAGE_SIZE, fence); |
| 149 | if (r) { | 149 | if (r) { |
| 150 | DRM_ERROR("Failed VRAM->GTT copy %d\n", i); | 150 | DRM_ERROR("Failed VRAM->GTT copy %d\n", i); |
| 151 | goto out_cleanup; | 151 | goto out_cleanup; |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 765bd184b6fc..1381e06d6af3 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
| @@ -295,6 +295,12 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo, | |||
| 295 | if (unlikely(r)) { | 295 | if (unlikely(r)) { |
| 296 | return r; | 296 | return r; |
| 297 | } | 297 | } |
| 298 | |||
| 299 | r = ttm_tt_set_placement_caching(bo->ttm, tmp_mem.placement); | ||
| 300 | if (unlikely(r)) { | ||
| 301 | goto out_cleanup; | ||
| 302 | } | ||
| 303 | |||
| 298 | r = ttm_tt_bind(bo->ttm, &tmp_mem); | 304 | r = ttm_tt_bind(bo->ttm, &tmp_mem); |
| 299 | if (unlikely(r)) { | 305 | if (unlikely(r)) { |
| 300 | goto out_cleanup; | 306 | goto out_cleanup; |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index a769c296f6a6..ca037160a582 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
| @@ -418,6 +418,8 @@ int rs400_resume(struct radeon_device *rdev) | |||
| 418 | rs400_gart_disable(rdev); | 418 | rs400_gart_disable(rdev); |
| 419 | /* Resume clock before doing reset */ | 419 | /* Resume clock before doing reset */ |
| 420 | r300_clock_startup(rdev); | 420 | r300_clock_startup(rdev); |
| 421 | /* setup MC before calling post tables */ | ||
| 422 | rs400_mc_program(rdev); | ||
| 421 | /* Reset gpu before posting otherwise ATOM will enter infinite loop */ | 423 | /* Reset gpu before posting otherwise ATOM will enter infinite loop */ |
| 422 | if (radeon_gpu_reset(rdev)) { | 424 | if (radeon_gpu_reset(rdev)) { |
| 423 | dev_warn(rdev->dev, "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n", | 425 | dev_warn(rdev->dev, "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n", |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 10dfa78762da..5f117cd8736a 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
| @@ -242,7 +242,7 @@ void rs600_irq_disable(struct radeon_device *rdev) | |||
| 242 | 242 | ||
| 243 | int rs600_irq_process(struct radeon_device *rdev) | 243 | int rs600_irq_process(struct radeon_device *rdev) |
| 244 | { | 244 | { |
| 245 | uint32_t status; | 245 | uint32_t status, msi_rearm; |
| 246 | uint32_t r500_disp_int; | 246 | uint32_t r500_disp_int; |
| 247 | 247 | ||
| 248 | status = rs600_irq_ack(rdev, &r500_disp_int); | 248 | status = rs600_irq_ack(rdev, &r500_disp_int); |
| @@ -260,6 +260,22 @@ int rs600_irq_process(struct radeon_device *rdev) | |||
| 260 | drm_handle_vblank(rdev->ddev, 1); | 260 | drm_handle_vblank(rdev->ddev, 1); |
| 261 | status = rs600_irq_ack(rdev, &r500_disp_int); | 261 | status = rs600_irq_ack(rdev, &r500_disp_int); |
| 262 | } | 262 | } |
| 263 | if (rdev->msi_enabled) { | ||
| 264 | switch (rdev->family) { | ||
| 265 | case CHIP_RS600: | ||
| 266 | case CHIP_RS690: | ||
| 267 | case CHIP_RS740: | ||
| 268 | msi_rearm = RREG32(RADEON_BUS_CNTL) & ~RS600_MSI_REARM; | ||
| 269 | WREG32(RADEON_BUS_CNTL, msi_rearm); | ||
| 270 | WREG32(RADEON_BUS_CNTL, msi_rearm | RS600_MSI_REARM); | ||
| 271 | break; | ||
| 272 | default: | ||
| 273 | msi_rearm = RREG32(RADEON_MSI_REARM_EN) & ~RV370_MSI_REARM_EN; | ||
| 274 | WREG32(RADEON_MSI_REARM_EN, msi_rearm); | ||
| 275 | WREG32(RADEON_MSI_REARM_EN, msi_rearm | RV370_MSI_REARM_EN); | ||
| 276 | break; | ||
| 277 | } | ||
| 278 | } | ||
| 263 | return IRQ_HANDLED; | 279 | return IRQ_HANDLED; |
| 264 | } | 280 | } |
| 265 | 281 | ||
| @@ -472,6 +488,8 @@ int rs600_init(struct radeon_device *rdev) | |||
| 472 | } | 488 | } |
| 473 | /* Initialize clocks */ | 489 | /* Initialize clocks */ |
| 474 | radeon_get_clock_info(rdev->ddev); | 490 | radeon_get_clock_info(rdev->ddev); |
| 491 | /* Initialize power management */ | ||
| 492 | radeon_pm_init(rdev); | ||
| 475 | /* Get vram informations */ | 493 | /* Get vram informations */ |
| 476 | rs600_vram_info(rdev); | 494 | rs600_vram_info(rdev); |
| 477 | /* Initialize memory controller (also test AGP) */ | 495 | /* Initialize memory controller (also test AGP) */ |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 025e3225346c..27547175cf93 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
| @@ -706,6 +706,8 @@ int rs690_init(struct radeon_device *rdev) | |||
| 706 | } | 706 | } |
| 707 | /* Initialize clocks */ | 707 | /* Initialize clocks */ |
| 708 | radeon_get_clock_info(rdev->ddev); | 708 | radeon_get_clock_info(rdev->ddev); |
| 709 | /* Initialize power management */ | ||
| 710 | radeon_pm_init(rdev); | ||
| 709 | /* Get vram informations */ | 711 | /* Get vram informations */ |
| 710 | rs690_vram_info(rdev); | 712 | rs690_vram_info(rdev); |
| 711 | /* Initialize memory controller (also test AGP) */ | 713 | /* Initialize memory controller (also test AGP) */ |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 41a34c23e6d8..ba68c9fe90a1 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
| @@ -380,7 +380,6 @@ void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save) | |||
| 380 | save->d2crtc_control = RREG32(R_006880_D2CRTC_CONTROL); | 380 | save->d2crtc_control = RREG32(R_006880_D2CRTC_CONTROL); |
| 381 | 381 | ||
| 382 | /* Stop all video */ | 382 | /* Stop all video */ |
| 383 | WREG32(R_000330_D1VGA_CONTROL, 0); | ||
| 384 | WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0); | 383 | WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0); |
| 385 | WREG32(R_000300_VGA_RENDER_CONTROL, 0); | 384 | WREG32(R_000300_VGA_RENDER_CONTROL, 0); |
| 386 | WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 1); | 385 | WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 1); |
| @@ -389,6 +388,8 @@ void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save) | |||
| 389 | WREG32(R_006880_D2CRTC_CONTROL, 0); | 388 | WREG32(R_006880_D2CRTC_CONTROL, 0); |
| 390 | WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 0); | 389 | WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 0); |
| 391 | WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0); | 390 | WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0); |
| 391 | WREG32(R_000330_D1VGA_CONTROL, 0); | ||
| 392 | WREG32(R_000338_D2VGA_CONTROL, 0); | ||
| 392 | } | 393 | } |
| 393 | 394 | ||
| 394 | void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save) | 395 | void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save) |
| @@ -402,14 +403,14 @@ void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save) | |||
| 402 | WREG32(R_000328_VGA_HDP_CONTROL, save->vga_hdp_control); | 403 | WREG32(R_000328_VGA_HDP_CONTROL, save->vga_hdp_control); |
| 403 | mdelay(1); | 404 | mdelay(1); |
| 404 | /* Restore video state */ | 405 | /* Restore video state */ |
| 406 | WREG32(R_000330_D1VGA_CONTROL, save->d1vga_control); | ||
| 407 | WREG32(R_000338_D2VGA_CONTROL, save->d2vga_control); | ||
| 405 | WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 1); | 408 | WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 1); |
| 406 | WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 1); | 409 | WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 1); |
| 407 | WREG32(R_006080_D1CRTC_CONTROL, save->d1crtc_control); | 410 | WREG32(R_006080_D1CRTC_CONTROL, save->d1crtc_control); |
| 408 | WREG32(R_006880_D2CRTC_CONTROL, save->d2crtc_control); | 411 | WREG32(R_006880_D2CRTC_CONTROL, save->d2crtc_control); |
| 409 | WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 0); | 412 | WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 0); |
| 410 | WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0); | 413 | WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0); |
| 411 | WREG32(R_000330_D1VGA_CONTROL, save->d1vga_control); | ||
| 412 | WREG32(R_000338_D2VGA_CONTROL, save->d2vga_control); | ||
| 413 | WREG32(R_000300_VGA_RENDER_CONTROL, save->vga_render_control); | 414 | WREG32(R_000300_VGA_RENDER_CONTROL, save->vga_render_control); |
| 414 | } | 415 | } |
| 415 | 416 | ||
| @@ -585,6 +586,8 @@ int rv515_init(struct radeon_device *rdev) | |||
| 585 | } | 586 | } |
| 586 | /* Initialize clocks */ | 587 | /* Initialize clocks */ |
| 587 | radeon_get_clock_info(rdev->ddev); | 588 | radeon_get_clock_info(rdev->ddev); |
| 589 | /* Initialize power management */ | ||
| 590 | radeon_pm_init(rdev); | ||
| 588 | /* Get vram informations */ | 591 | /* Get vram informations */ |
| 589 | rv515_vram_info(rdev); | 592 | rv515_vram_info(rdev); |
| 590 | /* Initialize memory controller (also test AGP) */ | 593 | /* Initialize memory controller (also test AGP) */ |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 595ac638039d..b0efd0ddae7a 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
| @@ -529,11 +529,11 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
| 529 | if (rdev->family == CHIP_RV770) | 529 | if (rdev->family == CHIP_RV770) |
| 530 | gb_tiling_config |= BANK_TILING(1); | 530 | gb_tiling_config |= BANK_TILING(1); |
| 531 | else | 531 | else |
| 532 | gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_SHIFT) >> NOOFBANK_MASK); | 532 | gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); |
| 533 | 533 | ||
| 534 | gb_tiling_config |= GROUP_SIZE(0); | 534 | gb_tiling_config |= GROUP_SIZE(0); |
| 535 | 535 | ||
| 536 | if (((mc_arb_ramcfg & NOOFROWS_MASK) & NOOFROWS_SHIFT) > 3) { | 536 | if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) { |
| 537 | gb_tiling_config |= ROW_TILING(3); | 537 | gb_tiling_config |= ROW_TILING(3); |
| 538 | gb_tiling_config |= SAMPLE_SPLIT(3); | 538 | gb_tiling_config |= SAMPLE_SPLIT(3); |
| 539 | } else { | 539 | } else { |
| @@ -579,14 +579,14 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
| 579 | 579 | ||
| 580 | /* set HW defaults for 3D engine */ | 580 | /* set HW defaults for 3D engine */ |
| 581 | WREG32(CP_QUEUE_THRESHOLDS, (ROQ_IB1_START(0x16) | | 581 | WREG32(CP_QUEUE_THRESHOLDS, (ROQ_IB1_START(0x16) | |
| 582 | ROQ_IB2_START(0x2b))); | 582 | ROQ_IB2_START(0x2b))); |
| 583 | 583 | ||
| 584 | WREG32(CP_MEQ_THRESHOLDS, STQ_SPLIT(0x30)); | 584 | WREG32(CP_MEQ_THRESHOLDS, STQ_SPLIT(0x30)); |
| 585 | 585 | ||
| 586 | WREG32(TA_CNTL_AUX, (DISABLE_CUBE_ANISO | | 586 | WREG32(TA_CNTL_AUX, (DISABLE_CUBE_ANISO | |
| 587 | SYNC_GRADIENT | | 587 | SYNC_GRADIENT | |
| 588 | SYNC_WALKER | | 588 | SYNC_WALKER | |
| 589 | SYNC_ALIGNER)); | 589 | SYNC_ALIGNER)); |
| 590 | 590 | ||
| 591 | sx_debug_1 = RREG32(SX_DEBUG_1); | 591 | sx_debug_1 = RREG32(SX_DEBUG_1); |
| 592 | sx_debug_1 |= ENABLE_NEW_SMX_ADDRESS; | 592 | sx_debug_1 |= ENABLE_NEW_SMX_ADDRESS; |
| @@ -598,9 +598,9 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
| 598 | WREG32(SMX_DC_CTL0, smx_dc_ctl0); | 598 | WREG32(SMX_DC_CTL0, smx_dc_ctl0); |
| 599 | 599 | ||
| 600 | WREG32(SMX_EVENT_CTL, (ES_FLUSH_CTL(4) | | 600 | WREG32(SMX_EVENT_CTL, (ES_FLUSH_CTL(4) | |
| 601 | GS_FLUSH_CTL(4) | | 601 | GS_FLUSH_CTL(4) | |
| 602 | ACK_FLUSH_CTL(3) | | 602 | ACK_FLUSH_CTL(3) | |
| 603 | SYNC_FLUSH_CTL)); | 603 | SYNC_FLUSH_CTL)); |
| 604 | 604 | ||
| 605 | if (rdev->family == CHIP_RV770) | 605 | if (rdev->family == CHIP_RV770) |
| 606 | WREG32(DB_DEBUG3, DB_CLK_OFF_DELAY(0x1f)); | 606 | WREG32(DB_DEBUG3, DB_CLK_OFF_DELAY(0x1f)); |
| @@ -611,12 +611,12 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
| 611 | } | 611 | } |
| 612 | 612 | ||
| 613 | WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.rv770.sx_max_export_size / 4) - 1) | | 613 | WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.rv770.sx_max_export_size / 4) - 1) | |
| 614 | POSITION_BUFFER_SIZE((rdev->config.rv770.sx_max_export_pos_size / 4) - 1) | | 614 | POSITION_BUFFER_SIZE((rdev->config.rv770.sx_max_export_pos_size / 4) - 1) | |
| 615 | SMX_BUFFER_SIZE((rdev->config.rv770.sx_max_export_smx_size / 4) - 1))); | 615 | SMX_BUFFER_SIZE((rdev->config.rv770.sx_max_export_smx_size / 4) - 1))); |
| 616 | 616 | ||
| 617 | WREG32(PA_SC_FIFO_SIZE, (SC_PRIM_FIFO_SIZE(rdev->config.rv770.sc_prim_fifo_size) | | 617 | WREG32(PA_SC_FIFO_SIZE, (SC_PRIM_FIFO_SIZE(rdev->config.rv770.sc_prim_fifo_size) | |
| 618 | SC_HIZ_TILE_FIFO_SIZE(rdev->config.rv770.sc_hiz_tile_fifo_size) | | 618 | SC_HIZ_TILE_FIFO_SIZE(rdev->config.rv770.sc_hiz_tile_fifo_size) | |
| 619 | SC_EARLYZ_TILE_FIFO_SIZE(rdev->config.rv770.sc_earlyz_tile_fifo_fize))); | 619 | SC_EARLYZ_TILE_FIFO_SIZE(rdev->config.rv770.sc_earlyz_tile_fifo_fize))); |
| 620 | 620 | ||
| 621 | WREG32(PA_SC_MULTI_CHIP_CNTL, 0); | 621 | WREG32(PA_SC_MULTI_CHIP_CNTL, 0); |
| 622 | 622 | ||
| @@ -774,14 +774,36 @@ int rv770_mc_init(struct radeon_device *rdev) | |||
| 774 | { | 774 | { |
| 775 | fixed20_12 a; | 775 | fixed20_12 a; |
| 776 | u32 tmp; | 776 | u32 tmp; |
| 777 | int chansize, numchan; | ||
| 777 | int r; | 778 | int r; |
| 778 | 779 | ||
| 779 | /* Get VRAM informations */ | 780 | /* Get VRAM informations */ |
| 780 | /* FIXME: Don't know how to determine vram width, need to check | ||
| 781 | * vram_width usage | ||
| 782 | */ | ||
| 783 | rdev->mc.vram_width = 128; | ||
| 784 | rdev->mc.vram_is_ddr = true; | 781 | rdev->mc.vram_is_ddr = true; |
| 782 | tmp = RREG32(MC_ARB_RAMCFG); | ||
| 783 | if (tmp & CHANSIZE_OVERRIDE) { | ||
| 784 | chansize = 16; | ||
| 785 | } else if (tmp & CHANSIZE_MASK) { | ||
| 786 | chansize = 64; | ||
| 787 | } else { | ||
| 788 | chansize = 32; | ||
| 789 | } | ||
| 790 | tmp = RREG32(MC_SHARED_CHMAP); | ||
| 791 | switch ((tmp & NOOFCHAN_MASK) >> NOOFCHAN_SHIFT) { | ||
| 792 | case 0: | ||
| 793 | default: | ||
| 794 | numchan = 1; | ||
| 795 | break; | ||
| 796 | case 1: | ||
| 797 | numchan = 2; | ||
| 798 | break; | ||
| 799 | case 2: | ||
| 800 | numchan = 4; | ||
| 801 | break; | ||
| 802 | case 3: | ||
| 803 | numchan = 8; | ||
| 804 | break; | ||
| 805 | } | ||
| 806 | rdev->mc.vram_width = numchan * chansize; | ||
| 785 | /* Could aper size report 0 ? */ | 807 | /* Could aper size report 0 ? */ |
| 786 | rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0); | 808 | rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0); |
| 787 | rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0); | 809 | rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0); |
| @@ -961,10 +983,13 @@ int rv770_init(struct radeon_device *rdev) | |||
| 961 | r600_scratch_init(rdev); | 983 | r600_scratch_init(rdev); |
| 962 | /* Initialize surface registers */ | 984 | /* Initialize surface registers */ |
| 963 | radeon_surface_init(rdev); | 985 | radeon_surface_init(rdev); |
| 986 | /* Initialize clocks */ | ||
| 964 | radeon_get_clock_info(rdev->ddev); | 987 | radeon_get_clock_info(rdev->ddev); |
| 965 | r = radeon_clocks_init(rdev); | 988 | r = radeon_clocks_init(rdev); |
| 966 | if (r) | 989 | if (r) |
| 967 | return r; | 990 | return r; |
| 991 | /* Initialize power management */ | ||
| 992 | radeon_pm_init(rdev); | ||
| 968 | /* Fence driver */ | 993 | /* Fence driver */ |
| 969 | r = radeon_fence_driver_init(rdev); | 994 | r = radeon_fence_driver_init(rdev); |
| 970 | if (r) | 995 | if (r) |
diff --git a/drivers/gpu/drm/radeon/rv770d.h b/drivers/gpu/drm/radeon/rv770d.h index 4b9c3d6396ff..a1367ab6f261 100644 --- a/drivers/gpu/drm/radeon/rv770d.h +++ b/drivers/gpu/drm/radeon/rv770d.h | |||
| @@ -129,6 +129,10 @@ | |||
| 129 | #define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0 | 129 | #define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0 |
| 130 | #define HDP_TILING_CONFIG 0x2F3C | 130 | #define HDP_TILING_CONFIG 0x2F3C |
| 131 | 131 | ||
| 132 | #define MC_SHARED_CHMAP 0x2004 | ||
| 133 | #define NOOFCHAN_SHIFT 12 | ||
| 134 | #define NOOFCHAN_MASK 0x00003000 | ||
| 135 | |||
| 132 | #define MC_ARB_RAMCFG 0x2760 | 136 | #define MC_ARB_RAMCFG 0x2760 |
| 133 | #define NOOFBANK_SHIFT 0 | 137 | #define NOOFBANK_SHIFT 0 |
| 134 | #define NOOFBANK_MASK 0x00000003 | 138 | #define NOOFBANK_MASK 0x00000003 |
| @@ -142,6 +146,7 @@ | |||
| 142 | #define CHANSIZE_MASK 0x00000100 | 146 | #define CHANSIZE_MASK 0x00000100 |
| 143 | #define BURSTLENGTH_SHIFT 9 | 147 | #define BURSTLENGTH_SHIFT 9 |
| 144 | #define BURSTLENGTH_MASK 0x00000200 | 148 | #define BURSTLENGTH_MASK 0x00000200 |
| 149 | #define CHANSIZE_OVERRIDE (1 << 11) | ||
| 145 | #define MC_VM_AGP_TOP 0x2028 | 150 | #define MC_VM_AGP_TOP 0x2028 |
| 146 | #define MC_VM_AGP_BOT 0x202C | 151 | #define MC_VM_AGP_BOT 0x202C |
| 147 | #define MC_VM_AGP_BASE 0x2030 | 152 | #define MC_VM_AGP_BASE 0x2030 |
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index a55ee1a56c16..7bcb89f39ce8 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c | |||
| @@ -279,6 +279,7 @@ int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement) | |||
| 279 | 279 | ||
| 280 | return ttm_tt_set_caching(ttm, state); | 280 | return ttm_tt_set_caching(ttm, state); |
| 281 | } | 281 | } |
| 282 | EXPORT_SYMBOL(ttm_tt_set_placement_caching); | ||
| 282 | 283 | ||
| 283 | static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm) | 284 | static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm) |
| 284 | { | 285 | { |
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index d39877a7da63..b5a95193c694 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c | |||
| @@ -350,8 +350,7 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr, | |||
| 350 | 350 | ||
| 351 | case FAULT: | 351 | case FAULT: |
| 352 | /* Note - only for remote1 and remote2 */ | 352 | /* Note - only for remote1 and remote2 */ |
| 353 | out = data->alarms & (sattr->index ? 0x8000 : 0x4000); | 353 | out = !!(data->alarms & (sattr->index ? 0x8000 : 0x4000)); |
| 354 | out = out ? 0 : 1; | ||
| 355 | break; | 354 | break; |
| 356 | 355 | ||
| 357 | default: | 356 | default: |
| @@ -863,7 +862,7 @@ static SENSOR_DEVICE_ATTR_2(pwm1_freq, S_IRUGO | S_IWUSR, show_pwmfreq, | |||
| 863 | set_pwmfreq, INPUT, 0); | 862 | set_pwmfreq, INPUT, 0); |
| 864 | static SENSOR_DEVICE_ATTR_2(pwm1_enable, S_IRUGO | S_IWUSR, show_pwmctrl, | 863 | static SENSOR_DEVICE_ATTR_2(pwm1_enable, S_IRUGO | S_IWUSR, show_pwmctrl, |
| 865 | set_pwmctrl, INPUT, 0); | 864 | set_pwmctrl, INPUT, 0); |
| 866 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_channel_temp, S_IRUGO | S_IWUSR, | 865 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_channels_temp, S_IRUGO | S_IWUSR, |
| 867 | show_pwmchan, set_pwmchan, INPUT, 0); | 866 | show_pwmchan, set_pwmchan, INPUT, 0); |
| 868 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, | 867 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, |
| 869 | set_pwm, MIN, 0); | 868 | set_pwm, MIN, 0); |
| @@ -875,7 +874,7 @@ static SENSOR_DEVICE_ATTR_2(pwm2_freq, S_IRUGO | S_IWUSR, show_pwmfreq, | |||
| 875 | set_pwmfreq, INPUT, 1); | 874 | set_pwmfreq, INPUT, 1); |
| 876 | static SENSOR_DEVICE_ATTR_2(pwm2_enable, S_IRUGO | S_IWUSR, show_pwmctrl, | 875 | static SENSOR_DEVICE_ATTR_2(pwm2_enable, S_IRUGO | S_IWUSR, show_pwmctrl, |
| 877 | set_pwmctrl, INPUT, 1); | 876 | set_pwmctrl, INPUT, 1); |
| 878 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_channel_temp, S_IRUGO | S_IWUSR, | 877 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_channels_temp, S_IRUGO | S_IWUSR, |
| 879 | show_pwmchan, set_pwmchan, INPUT, 1); | 878 | show_pwmchan, set_pwmchan, INPUT, 1); |
| 880 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, | 879 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, |
| 881 | set_pwm, MIN, 1); | 880 | set_pwm, MIN, 1); |
| @@ -887,7 +886,7 @@ static SENSOR_DEVICE_ATTR_2(pwm3_freq, S_IRUGO | S_IWUSR, show_pwmfreq, | |||
| 887 | set_pwmfreq, INPUT, 2); | 886 | set_pwmfreq, INPUT, 2); |
| 888 | static SENSOR_DEVICE_ATTR_2(pwm3_enable, S_IRUGO | S_IWUSR, show_pwmctrl, | 887 | static SENSOR_DEVICE_ATTR_2(pwm3_enable, S_IRUGO | S_IWUSR, show_pwmctrl, |
| 889 | set_pwmctrl, INPUT, 2); | 888 | set_pwmctrl, INPUT, 2); |
| 890 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_channel_temp, S_IRUGO | S_IWUSR, | 889 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_channels_temp, S_IRUGO | S_IWUSR, |
| 891 | show_pwmchan, set_pwmchan, INPUT, 2); | 890 | show_pwmchan, set_pwmchan, INPUT, 2); |
| 892 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, | 891 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, |
| 893 | set_pwm, MIN, 2); | 892 | set_pwm, MIN, 2); |
| @@ -947,19 +946,19 @@ static struct attribute *adt7475_attrs[] = { | |||
| 947 | &sensor_dev_attr_pwm1.dev_attr.attr, | 946 | &sensor_dev_attr_pwm1.dev_attr.attr, |
| 948 | &sensor_dev_attr_pwm1_freq.dev_attr.attr, | 947 | &sensor_dev_attr_pwm1_freq.dev_attr.attr, |
| 949 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | 948 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, |
| 950 | &sensor_dev_attr_pwm1_auto_channel_temp.dev_attr.attr, | 949 | &sensor_dev_attr_pwm1_auto_channels_temp.dev_attr.attr, |
| 951 | &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, | 950 | &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, |
| 952 | &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, | 951 | &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, |
| 953 | &sensor_dev_attr_pwm2.dev_attr.attr, | 952 | &sensor_dev_attr_pwm2.dev_attr.attr, |
| 954 | &sensor_dev_attr_pwm2_freq.dev_attr.attr, | 953 | &sensor_dev_attr_pwm2_freq.dev_attr.attr, |
| 955 | &sensor_dev_attr_pwm2_enable.dev_attr.attr, | 954 | &sensor_dev_attr_pwm2_enable.dev_attr.attr, |
| 956 | &sensor_dev_attr_pwm2_auto_channel_temp.dev_attr.attr, | 955 | &sensor_dev_attr_pwm2_auto_channels_temp.dev_attr.attr, |
| 957 | &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr, | 956 | &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr, |
| 958 | &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr, | 957 | &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr, |
| 959 | &sensor_dev_attr_pwm3.dev_attr.attr, | 958 | &sensor_dev_attr_pwm3.dev_attr.attr, |
| 960 | &sensor_dev_attr_pwm3_freq.dev_attr.attr, | 959 | &sensor_dev_attr_pwm3_freq.dev_attr.attr, |
| 961 | &sensor_dev_attr_pwm3_enable.dev_attr.attr, | 960 | &sensor_dev_attr_pwm3_enable.dev_attr.attr, |
| 962 | &sensor_dev_attr_pwm3_auto_channel_temp.dev_attr.attr, | 961 | &sensor_dev_attr_pwm3_auto_channels_temp.dev_attr.attr, |
| 963 | &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr, | 962 | &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr, |
| 964 | &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr, | 963 | &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr, |
| 965 | NULL, | 964 | NULL, |
| @@ -1152,7 +1151,7 @@ static struct adt7475_data *adt7475_update_device(struct device *dev) | |||
| 1152 | } | 1151 | } |
| 1153 | 1152 | ||
| 1154 | /* Limits and settings, should never change update every 60 seconds */ | 1153 | /* Limits and settings, should never change update every 60 seconds */ |
| 1155 | if (time_after(jiffies, data->limits_updated + HZ * 2) || | 1154 | if (time_after(jiffies, data->limits_updated + HZ * 60) || |
| 1156 | !data->valid) { | 1155 | !data->valid) { |
| 1157 | data->config5 = adt7475_read(REG_CONFIG5); | 1156 | data->config5 = adt7475_read(REG_CONFIG5); |
| 1158 | 1157 | ||
diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c index 3a524f2fe493..71835412529f 100644 --- a/drivers/hwmon/s3c-hwmon.c +++ b/drivers/hwmon/s3c-hwmon.c | |||
| @@ -323,14 +323,21 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev) | |||
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | for (i = 0; i < ARRAY_SIZE(pdata->in); i++) { | 325 | for (i = 0; i < ARRAY_SIZE(pdata->in); i++) { |
| 326 | if (!pdata->in[i]) | 326 | struct s3c24xx_adc_hwmon_incfg *cfg = pdata->in[i]; |
| 327 | |||
| 328 | if (!cfg) | ||
| 327 | continue; | 329 | continue; |
| 328 | 330 | ||
| 329 | if (pdata->in[i]->mult >= 0x10000) | 331 | if (cfg->mult >= 0x10000) |
| 330 | dev_warn(&dev->dev, | 332 | dev_warn(&dev->dev, |
| 331 | "channel %d multiplier too large\n", | 333 | "channel %d multiplier too large\n", |
| 332 | i); | 334 | i); |
| 333 | 335 | ||
| 336 | if (cfg->divider == 0) { | ||
| 337 | dev_err(&dev->dev, "channel %d divider zero\n", i); | ||
| 338 | continue; | ||
| 339 | } | ||
| 340 | |||
| 334 | ret = s3c_hwmon_create_attr(&dev->dev, pdata->in[i], | 341 | ret = s3c_hwmon_create_attr(&dev->dev, pdata->in[i], |
| 335 | &hwmon->attrs[i], i); | 342 | &hwmon->attrs[i], i); |
| 336 | if (ret) { | 343 | if (ret) { |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 737335ff2b21..e8fe7f169e25 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
| @@ -128,7 +128,7 @@ config I2C_PIIX4 | |||
| 128 | ATI SB600 | 128 | ATI SB600 |
| 129 | ATI SB700 | 129 | ATI SB700 |
| 130 | ATI SB800 | 130 | ATI SB800 |
| 131 | AMD SB900 | 131 | AMD Hudson-2 |
| 132 | Serverworks OSB4 | 132 | Serverworks OSB4 |
| 133 | Serverworks CSB5 | 133 | Serverworks CSB5 |
| 134 | Serverworks CSB6 | 134 | Serverworks CSB6 |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index d26a972aacaa..1e245e9cad31 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | Intel PIIX4, 440MX | 22 | Intel PIIX4, 440MX |
| 23 | Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100 | 23 | Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100 |
| 24 | ATI IXP200, IXP300, IXP400, SB600, SB700, SB800 | 24 | ATI IXP200, IXP300, IXP400, SB600, SB700, SB800 |
| 25 | AMD SB900 | 25 | AMD Hudson-2 |
| 26 | SMSC Victory66 | 26 | SMSC Victory66 |
| 27 | 27 | ||
| 28 | Note: we assume there can only be one device, with one SMBus interface. | 28 | Note: we assume there can only be one device, with one SMBus interface. |
| @@ -233,9 +233,9 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev, | |||
| 233 | unsigned short smba_idx = 0xcd6; | 233 | unsigned short smba_idx = 0xcd6; |
| 234 | u8 smba_en_lo, smba_en_hi, i2ccfg, i2ccfg_offset = 0x10, smb_en = 0x2c; | 234 | u8 smba_en_lo, smba_en_hi, i2ccfg, i2ccfg_offset = 0x10, smb_en = 0x2c; |
| 235 | 235 | ||
| 236 | /* SB800 SMBus does not support forcing address */ | 236 | /* SB800 and later SMBus does not support forcing address */ |
| 237 | if (force || force_addr) { | 237 | if (force || force_addr) { |
| 238 | dev_err(&PIIX4_dev->dev, "SB800 SMBus does not support " | 238 | dev_err(&PIIX4_dev->dev, "SMBus does not support " |
| 239 | "forcing address!\n"); | 239 | "forcing address!\n"); |
| 240 | return -EINVAL; | 240 | return -EINVAL; |
| 241 | } | 241 | } |
| @@ -480,7 +480,7 @@ static struct pci_device_id piix4_ids[] = { | |||
| 480 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_SMBUS) }, | 480 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_SMBUS) }, |
| 481 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS) }, | 481 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS) }, |
| 482 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS) }, | 482 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS) }, |
| 483 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_SB900_SMBUS) }, | 483 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) }, |
| 484 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, | 484 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, |
| 485 | PCI_DEVICE_ID_SERVERWORKS_OSB4) }, | 485 | PCI_DEVICE_ID_SERVERWORKS_OSB4) }, |
| 486 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, | 486 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, |
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 6ff6c20f1e78..fbab6846ae64 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c | |||
| @@ -19,7 +19,9 @@ | |||
| 19 | #include <linux/completion.h> | 19 | #include <linux/completion.h> |
| 20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/i2c-pnx.h> | 21 | #include <linux/i2c-pnx.h> |
| 22 | #include <linux/io.h> | ||
| 22 | #include <mach/hardware.h> | 23 | #include <mach/hardware.h> |
| 24 | #include <mach/i2c.h> | ||
| 23 | #include <asm/irq.h> | 25 | #include <asm/irq.h> |
| 24 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
| 25 | 27 | ||
| @@ -54,6 +56,9 @@ static inline void i2c_pnx_arm_timer(struct i2c_adapter *adap) | |||
| 54 | struct timer_list *timer = &data->mif.timer; | 56 | struct timer_list *timer = &data->mif.timer; |
| 55 | int expires = I2C_PNX_TIMEOUT / (1000 / HZ); | 57 | int expires = I2C_PNX_TIMEOUT / (1000 / HZ); |
| 56 | 58 | ||
| 59 | if (expires <= 1) | ||
| 60 | expires = 2; | ||
| 61 | |||
| 57 | del_timer_sync(timer); | 62 | del_timer_sync(timer); |
| 58 | 63 | ||
| 59 | dev_dbg(&adap->dev, "Timer armed at %lu plus %u jiffies.\n", | 64 | dev_dbg(&adap->dev, "Timer armed at %lu plus %u jiffies.\n", |
| @@ -645,7 +650,7 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev) | |||
| 645 | return 0; | 650 | return 0; |
| 646 | 651 | ||
| 647 | out_irq: | 652 | out_irq: |
| 648 | free_irq(alg_data->irq, alg_data); | 653 | free_irq(alg_data->irq, i2c_pnx->adapter); |
| 649 | out_clock: | 654 | out_clock: |
| 650 | i2c_pnx->set_clock_stop(pdev); | 655 | i2c_pnx->set_clock_stop(pdev); |
| 651 | out_unmap: | 656 | out_unmap: |
| @@ -664,7 +669,7 @@ static int __devexit i2c_pnx_remove(struct platform_device *pdev) | |||
| 664 | struct i2c_adapter *adap = i2c_pnx->adapter; | 669 | struct i2c_adapter *adap = i2c_pnx->adapter; |
| 665 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | 670 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; |
| 666 | 671 | ||
| 667 | free_irq(alg_data->irq, alg_data); | 672 | free_irq(alg_data->irq, i2c_pnx->adapter); |
| 668 | i2c_del_adapter(adap); | 673 | i2c_del_adapter(adap); |
| 669 | i2c_pnx->set_clock_stop(pdev); | 674 | i2c_pnx->set_clock_stop(pdev); |
| 670 | iounmap((void *)alg_data->ioaddr); | 675 | iounmap((void *)alg_data->ioaddr); |
diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/i2c/chips/tsl2550.c index aa96bd2d27ea..a0702f36a72f 100644 --- a/drivers/i2c/chips/tsl2550.c +++ b/drivers/i2c/chips/tsl2550.c | |||
| @@ -257,6 +257,7 @@ static DEVICE_ATTR(operating_mode, S_IWUSR | S_IRUGO, | |||
| 257 | 257 | ||
| 258 | static ssize_t __tsl2550_show_lux(struct i2c_client *client, char *buf) | 258 | static ssize_t __tsl2550_show_lux(struct i2c_client *client, char *buf) |
| 259 | { | 259 | { |
| 260 | struct tsl2550_data *data = i2c_get_clientdata(client); | ||
| 260 | u8 ch0, ch1; | 261 | u8 ch0, ch1; |
| 261 | int ret; | 262 | int ret; |
| 262 | 263 | ||
| @@ -274,6 +275,8 @@ static ssize_t __tsl2550_show_lux(struct i2c_client *client, char *buf) | |||
| 274 | ret = tsl2550_calculate_lux(ch0, ch1); | 275 | ret = tsl2550_calculate_lux(ch0, ch1); |
| 275 | if (ret < 0) | 276 | if (ret < 0) |
| 276 | return ret; | 277 | return ret; |
| 278 | if (data->operating_mode == 1) | ||
| 279 | ret *= 5; | ||
| 277 | 280 | ||
| 278 | return sprintf(buf, "%d\n", ret); | 281 | return sprintf(buf, "%d\n", ret); |
| 279 | } | 282 | } |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 8d80fceca6a4..296504355142 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -762,6 +762,7 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
| 762 | { | 762 | { |
| 763 | int res = 0; | 763 | int res = 0; |
| 764 | struct i2c_adapter *found; | 764 | struct i2c_adapter *found; |
| 765 | struct i2c_client *client, *next; | ||
| 765 | 766 | ||
| 766 | /* First make sure that this adapter was ever added */ | 767 | /* First make sure that this adapter was ever added */ |
| 767 | mutex_lock(&core_lock); | 768 | mutex_lock(&core_lock); |
| @@ -781,6 +782,16 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
| 781 | if (res) | 782 | if (res) |
| 782 | return res; | 783 | return res; |
| 783 | 784 | ||
| 785 | /* Remove devices instantiated from sysfs */ | ||
| 786 | list_for_each_entry_safe(client, next, &userspace_devices, detected) { | ||
| 787 | if (client->adapter == adap) { | ||
| 788 | dev_dbg(&adap->dev, "Removing %s at 0x%x\n", | ||
| 789 | client->name, client->addr); | ||
| 790 | list_del(&client->detected); | ||
| 791 | i2c_unregister_device(client); | ||
| 792 | } | ||
| 793 | } | ||
| 794 | |||
| 784 | /* Detach any active clients. This can't fail, thus we do not | 795 | /* Detach any active clients. This can't fail, thus we do not |
| 785 | checking the returned value. */ | 796 | checking the returned value. */ |
| 786 | res = device_for_each_child(&adap->dev, NULL, __unregister_client); | 797 | res = device_for_each_child(&adap->dev, NULL, __unregister_client); |
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 063b933d864a..dd6396384c25 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c | |||
| @@ -60,15 +60,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); | |||
| 60 | MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver"); | 60 | MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver"); |
| 61 | MODULE_LICENSE("Dual MPL/GPL"); | 61 | MODULE_LICENSE("Dual MPL/GPL"); |
| 62 | 62 | ||
| 63 | #define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0) | ||
| 64 | |||
| 65 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 66 | INT_MODULE_PARM(pc_debug, 0); | ||
| 67 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 68 | #else | ||
| 69 | #define DEBUG(n, args...) | ||
| 70 | #endif | ||
| 71 | |||
| 72 | /*====================================================================*/ | 63 | /*====================================================================*/ |
| 73 | 64 | ||
| 74 | typedef struct ide_info_t { | 65 | typedef struct ide_info_t { |
| @@ -98,7 +89,7 @@ static int ide_probe(struct pcmcia_device *link) | |||
| 98 | { | 89 | { |
| 99 | ide_info_t *info; | 90 | ide_info_t *info; |
| 100 | 91 | ||
| 101 | DEBUG(0, "ide_attach()\n"); | 92 | dev_dbg(&link->dev, "ide_attach()\n"); |
| 102 | 93 | ||
| 103 | /* Create new ide device */ | 94 | /* Create new ide device */ |
| 104 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 95 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
| @@ -112,7 +103,6 @@ static int ide_probe(struct pcmcia_device *link) | |||
| 112 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 103 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
| 113 | link->io.IOAddrLines = 3; | 104 | link->io.IOAddrLines = 3; |
| 114 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 105 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 115 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 116 | link->conf.Attributes = CONF_ENABLE_IRQ; | 106 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 117 | link->conf.IntType = INT_MEMORY_AND_IO; | 107 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 118 | 108 | ||
| @@ -134,7 +124,7 @@ static void ide_detach(struct pcmcia_device *link) | |||
| 134 | ide_hwif_t *hwif = info->host->ports[0]; | 124 | ide_hwif_t *hwif = info->host->ports[0]; |
| 135 | unsigned long data_addr, ctl_addr; | 125 | unsigned long data_addr, ctl_addr; |
| 136 | 126 | ||
| 137 | DEBUG(0, "ide_detach(0x%p)\n", link); | 127 | dev_dbg(&link->dev, "ide_detach(0x%p)\n", link); |
| 138 | 128 | ||
| 139 | data_addr = hwif->io_ports.data_addr; | 129 | data_addr = hwif->io_ports.data_addr; |
| 140 | ctl_addr = hwif->io_ports.ctl_addr; | 130 | ctl_addr = hwif->io_ports.ctl_addr; |
| @@ -217,9 +207,6 @@ out_release: | |||
| 217 | 207 | ||
| 218 | ======================================================================*/ | 208 | ======================================================================*/ |
| 219 | 209 | ||
| 220 | #define CS_CHECK(fn, ret) \ | ||
| 221 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 222 | |||
| 223 | struct pcmcia_config_check { | 210 | struct pcmcia_config_check { |
| 224 | unsigned long ctl_base; | 211 | unsigned long ctl_base; |
| 225 | int skip_vcc; | 212 | int skip_vcc; |
| @@ -282,11 +269,11 @@ static int ide_config(struct pcmcia_device *link) | |||
| 282 | { | 269 | { |
| 283 | ide_info_t *info = link->priv; | 270 | ide_info_t *info = link->priv; |
| 284 | struct pcmcia_config_check *stk = NULL; | 271 | struct pcmcia_config_check *stk = NULL; |
| 285 | int last_ret = 0, last_fn = 0, is_kme = 0; | 272 | int ret = 0, is_kme = 0; |
| 286 | unsigned long io_base, ctl_base; | 273 | unsigned long io_base, ctl_base; |
| 287 | struct ide_host *host; | 274 | struct ide_host *host; |
| 288 | 275 | ||
| 289 | DEBUG(0, "ide_config(0x%p)\n", link); | 276 | dev_dbg(&link->dev, "ide_config(0x%p)\n", link); |
| 290 | 277 | ||
| 291 | is_kme = ((link->manf_id == MANFID_KME) && | 278 | is_kme = ((link->manf_id == MANFID_KME) && |
| 292 | ((link->card_id == PRODID_KME_KXLC005_A) || | 279 | ((link->card_id == PRODID_KME_KXLC005_A) || |
| @@ -306,8 +293,12 @@ static int ide_config(struct pcmcia_device *link) | |||
| 306 | io_base = link->io.BasePort1; | 293 | io_base = link->io.BasePort1; |
| 307 | ctl_base = stk->ctl_base; | 294 | ctl_base = stk->ctl_base; |
| 308 | 295 | ||
| 309 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 296 | ret = pcmcia_request_irq(link, &link->irq); |
| 310 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 297 | if (ret) |
| 298 | goto failed; | ||
| 299 | ret = pcmcia_request_configuration(link, &link->conf); | ||
| 300 | if (ret) | ||
| 301 | goto failed; | ||
| 311 | 302 | ||
| 312 | /* disable drive interrupts during IDE probe */ | 303 | /* disable drive interrupts during IDE probe */ |
| 313 | outb(0x02, ctl_base); | 304 | outb(0x02, ctl_base); |
| @@ -342,8 +333,6 @@ err_mem: | |||
| 342 | printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n"); | 333 | printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n"); |
| 343 | goto failed; | 334 | goto failed; |
| 344 | 335 | ||
| 345 | cs_failed: | ||
| 346 | cs_error(link, last_fn, last_ret); | ||
| 347 | failed: | 336 | failed: |
| 348 | kfree(stk); | 337 | kfree(stk); |
| 349 | ide_release(link); | 338 | ide_release(link); |
| @@ -363,7 +352,7 @@ static void ide_release(struct pcmcia_device *link) | |||
| 363 | ide_info_t *info = link->priv; | 352 | ide_info_t *info = link->priv; |
| 364 | struct ide_host *host = info->host; | 353 | struct ide_host *host = info->host; |
| 365 | 354 | ||
| 366 | DEBUG(0, "ide_release(0x%p)\n", link); | 355 | dev_dbg(&link->dev, "ide_release(0x%p)\n", link); |
| 367 | 356 | ||
| 368 | if (info->ndev) | 357 | if (info->ndev) |
| 369 | /* FIXME: if this fails we need to queue the cleanup somehow | 358 | /* FIXME: if this fails we need to queue the cleanup somehow |
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index d3440b5010a5..6e7ae2b6cfc6 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c | |||
| @@ -162,7 +162,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) | |||
| 162 | if (tf->command == ATA_CMD_SET_FEATURES && | 162 | if (tf->command == ATA_CMD_SET_FEATURES && |
| 163 | tf->feature == SETFEATURES_XFER && | 163 | tf->feature == SETFEATURES_XFER && |
| 164 | tf->nsect >= XFER_SW_DMA_0) { | 164 | tf->nsect >= XFER_SW_DMA_0) { |
| 165 | xfer_rate = ide_find_dma_mode(drive, XFER_UDMA_6); | 165 | xfer_rate = ide_find_dma_mode(drive, tf->nsect); |
| 166 | if (xfer_rate != tf->nsect) { | 166 | if (xfer_rate != tf->nsect) { |
| 167 | err = -EINVAL; | 167 | err = -EINVAL; |
| 168 | goto abort; | 168 | goto abort; |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 63c53d65e875..4d76ba473097 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
| @@ -1046,15 +1046,6 @@ static void ide_port_init_devices(ide_hwif_t *hwif) | |||
| 1046 | if (port_ops && port_ops->init_dev) | 1046 | if (port_ops && port_ops->init_dev) |
| 1047 | port_ops->init_dev(drive); | 1047 | port_ops->init_dev(drive); |
| 1048 | } | 1048 | } |
| 1049 | |||
| 1050 | ide_port_for_each_dev(i, drive, hwif) { | ||
| 1051 | /* | ||
| 1052 | * default to PIO Mode 0 before we figure out | ||
| 1053 | * the most suited mode for the attached device | ||
| 1054 | */ | ||
| 1055 | if (port_ops && port_ops->set_pio_mode) | ||
| 1056 | port_ops->set_pio_mode(drive, 0); | ||
| 1057 | } | ||
| 1058 | } | 1049 | } |
| 1059 | 1050 | ||
| 1060 | static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | 1051 | static void ide_init_port(ide_hwif_t *hwif, unsigned int port, |
diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c index 96a2959ce877..7c544f7c74c4 100644 --- a/drivers/ieee802154/fakehard.c +++ b/drivers/ieee802154/fakehard.c | |||
| @@ -260,15 +260,12 @@ static int ieee802154_fake_close(struct net_device *dev) | |||
| 260 | static netdev_tx_t ieee802154_fake_xmit(struct sk_buff *skb, | 260 | static netdev_tx_t ieee802154_fake_xmit(struct sk_buff *skb, |
| 261 | struct net_device *dev) | 261 | struct net_device *dev) |
| 262 | { | 262 | { |
| 263 | skb->iif = dev->ifindex; | ||
| 264 | skb->dev = dev; | ||
| 265 | dev->stats.tx_packets++; | 263 | dev->stats.tx_packets++; |
| 266 | dev->stats.tx_bytes += skb->len; | 264 | dev->stats.tx_bytes += skb->len; |
| 267 | 265 | ||
| 268 | dev->trans_start = jiffies; | ||
| 269 | |||
| 270 | /* FIXME: do hardware work here ... */ | 266 | /* FIXME: do hardware work here ... */ |
| 271 | 267 | ||
| 268 | dev_kfree_skb(skb); | ||
| 272 | return NETDEV_TX_OK; | 269 | return NETDEV_TX_OK; |
| 273 | } | 270 | } |
| 274 | 271 | ||
diff --git a/drivers/input/ff-core.c b/drivers/input/ff-core.c index 72c63e5dd630..38df81fcdc3a 100644 --- a/drivers/input/ff-core.c +++ b/drivers/input/ff-core.c | |||
| @@ -337,16 +337,16 @@ int input_ff_create(struct input_dev *dev, int max_effects) | |||
| 337 | dev->ff = ff; | 337 | dev->ff = ff; |
| 338 | dev->flush = flush_effects; | 338 | dev->flush = flush_effects; |
| 339 | dev->event = input_ff_event; | 339 | dev->event = input_ff_event; |
| 340 | set_bit(EV_FF, dev->evbit); | 340 | __set_bit(EV_FF, dev->evbit); |
| 341 | 341 | ||
| 342 | /* Copy "true" bits into ff device bitmap */ | 342 | /* Copy "true" bits into ff device bitmap */ |
| 343 | for (i = 0; i <= FF_MAX; i++) | 343 | for (i = 0; i <= FF_MAX; i++) |
| 344 | if (test_bit(i, dev->ffbit)) | 344 | if (test_bit(i, dev->ffbit)) |
| 345 | set_bit(i, ff->ffbit); | 345 | __set_bit(i, ff->ffbit); |
| 346 | 346 | ||
| 347 | /* we can emulate RUMBLE with periodic effects */ | 347 | /* we can emulate RUMBLE with periodic effects */ |
| 348 | if (test_bit(FF_PERIODIC, ff->ffbit)) | 348 | if (test_bit(FF_PERIODIC, ff->ffbit)) |
| 349 | set_bit(FF_RUMBLE, dev->ffbit); | 349 | __set_bit(FF_RUMBLE, dev->ffbit); |
| 350 | 350 | ||
| 351 | return 0; | 351 | return 0; |
| 352 | } | 352 | } |
| @@ -362,12 +362,14 @@ EXPORT_SYMBOL_GPL(input_ff_create); | |||
| 362 | */ | 362 | */ |
| 363 | void input_ff_destroy(struct input_dev *dev) | 363 | void input_ff_destroy(struct input_dev *dev) |
| 364 | { | 364 | { |
| 365 | clear_bit(EV_FF, dev->evbit); | 365 | struct ff_device *ff = dev->ff; |
| 366 | if (dev->ff) { | 366 | |
| 367 | if (dev->ff->destroy) | 367 | __clear_bit(EV_FF, dev->evbit); |
| 368 | dev->ff->destroy(dev->ff); | 368 | if (ff) { |
| 369 | kfree(dev->ff->private); | 369 | if (ff->destroy) |
| 370 | kfree(dev->ff); | 370 | ff->destroy(ff); |
| 371 | kfree(ff->private); | ||
| 372 | kfree(ff); | ||
| 371 | dev->ff = NULL; | 373 | dev->ff = NULL; |
| 372 | } | 374 | } |
| 373 | } | 375 | } |
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c index 2d1415e16834..b483b2995fa9 100644 --- a/drivers/input/ff-memless.c +++ b/drivers/input/ff-memless.c | |||
| @@ -61,7 +61,6 @@ struct ml_device { | |||
| 61 | struct ml_effect_state states[FF_MEMLESS_EFFECTS]; | 61 | struct ml_effect_state states[FF_MEMLESS_EFFECTS]; |
| 62 | int gain; | 62 | int gain; |
| 63 | struct timer_list timer; | 63 | struct timer_list timer; |
| 64 | spinlock_t timer_lock; | ||
| 65 | struct input_dev *dev; | 64 | struct input_dev *dev; |
| 66 | 65 | ||
| 67 | int (*play_effect)(struct input_dev *dev, void *data, | 66 | int (*play_effect)(struct input_dev *dev, void *data, |
| @@ -368,38 +367,38 @@ static void ml_effect_timer(unsigned long timer_data) | |||
| 368 | { | 367 | { |
| 369 | struct input_dev *dev = (struct input_dev *)timer_data; | 368 | struct input_dev *dev = (struct input_dev *)timer_data; |
| 370 | struct ml_device *ml = dev->ff->private; | 369 | struct ml_device *ml = dev->ff->private; |
| 370 | unsigned long flags; | ||
| 371 | 371 | ||
| 372 | debug("timer: updating effects"); | 372 | debug("timer: updating effects"); |
| 373 | 373 | ||
| 374 | spin_lock(&ml->timer_lock); | 374 | spin_lock_irqsave(&dev->event_lock, flags); |
| 375 | ml_play_effects(ml); | 375 | ml_play_effects(ml); |
| 376 | spin_unlock(&ml->timer_lock); | 376 | spin_unlock_irqrestore(&dev->event_lock, flags); |
| 377 | } | 377 | } |
| 378 | 378 | ||
| 379 | /* | ||
| 380 | * Sets requested gain for FF effects. Called with dev->event_lock held. | ||
| 381 | */ | ||
| 379 | static void ml_ff_set_gain(struct input_dev *dev, u16 gain) | 382 | static void ml_ff_set_gain(struct input_dev *dev, u16 gain) |
| 380 | { | 383 | { |
| 381 | struct ml_device *ml = dev->ff->private; | 384 | struct ml_device *ml = dev->ff->private; |
| 382 | int i; | 385 | int i; |
| 383 | 386 | ||
| 384 | spin_lock_bh(&ml->timer_lock); | ||
| 385 | |||
| 386 | ml->gain = gain; | 387 | ml->gain = gain; |
| 387 | 388 | ||
| 388 | for (i = 0; i < FF_MEMLESS_EFFECTS; i++) | 389 | for (i = 0; i < FF_MEMLESS_EFFECTS; i++) |
| 389 | __clear_bit(FF_EFFECT_PLAYING, &ml->states[i].flags); | 390 | __clear_bit(FF_EFFECT_PLAYING, &ml->states[i].flags); |
| 390 | 391 | ||
| 391 | ml_play_effects(ml); | 392 | ml_play_effects(ml); |
| 392 | |||
| 393 | spin_unlock_bh(&ml->timer_lock); | ||
| 394 | } | 393 | } |
| 395 | 394 | ||
| 395 | /* | ||
| 396 | * Start/stop specified FF effect. Called with dev->event_lock held. | ||
| 397 | */ | ||
| 396 | static int ml_ff_playback(struct input_dev *dev, int effect_id, int value) | 398 | static int ml_ff_playback(struct input_dev *dev, int effect_id, int value) |
| 397 | { | 399 | { |
| 398 | struct ml_device *ml = dev->ff->private; | 400 | struct ml_device *ml = dev->ff->private; |
| 399 | struct ml_effect_state *state = &ml->states[effect_id]; | 401 | struct ml_effect_state *state = &ml->states[effect_id]; |
| 400 | unsigned long flags; | ||
| 401 | |||
| 402 | spin_lock_irqsave(&ml->timer_lock, flags); | ||
| 403 | 402 | ||
| 404 | if (value > 0) { | 403 | if (value > 0) { |
| 405 | debug("initiated play"); | 404 | debug("initiated play"); |
| @@ -425,8 +424,6 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value) | |||
| 425 | ml_play_effects(ml); | 424 | ml_play_effects(ml); |
| 426 | } | 425 | } |
| 427 | 426 | ||
| 428 | spin_unlock_irqrestore(&ml->timer_lock, flags); | ||
| 429 | |||
| 430 | return 0; | 427 | return 0; |
| 431 | } | 428 | } |
| 432 | 429 | ||
| @@ -436,7 +433,7 @@ static int ml_ff_upload(struct input_dev *dev, | |||
| 436 | struct ml_device *ml = dev->ff->private; | 433 | struct ml_device *ml = dev->ff->private; |
| 437 | struct ml_effect_state *state = &ml->states[effect->id]; | 434 | struct ml_effect_state *state = &ml->states[effect->id]; |
| 438 | 435 | ||
| 439 | spin_lock_bh(&ml->timer_lock); | 436 | spin_lock_irq(&dev->event_lock); |
| 440 | 437 | ||
| 441 | if (test_bit(FF_EFFECT_STARTED, &state->flags)) { | 438 | if (test_bit(FF_EFFECT_STARTED, &state->flags)) { |
| 442 | __clear_bit(FF_EFFECT_PLAYING, &state->flags); | 439 | __clear_bit(FF_EFFECT_PLAYING, &state->flags); |
| @@ -448,7 +445,7 @@ static int ml_ff_upload(struct input_dev *dev, | |||
| 448 | ml_schedule_timer(ml); | 445 | ml_schedule_timer(ml); |
| 449 | } | 446 | } |
| 450 | 447 | ||
| 451 | spin_unlock_bh(&ml->timer_lock); | 448 | spin_unlock_irq(&dev->event_lock); |
| 452 | 449 | ||
| 453 | return 0; | 450 | return 0; |
| 454 | } | 451 | } |
| @@ -482,7 +479,6 @@ int input_ff_create_memless(struct input_dev *dev, void *data, | |||
| 482 | ml->private = data; | 479 | ml->private = data; |
| 483 | ml->play_effect = play_effect; | 480 | ml->play_effect = play_effect; |
| 484 | ml->gain = 0xffff; | 481 | ml->gain = 0xffff; |
| 485 | spin_lock_init(&ml->timer_lock); | ||
| 486 | setup_timer(&ml->timer, ml_effect_timer, (unsigned long)dev); | 482 | setup_timer(&ml->timer, ml_effect_timer, (unsigned long)dev); |
| 487 | 483 | ||
| 488 | set_bit(FF_GAIN, dev->ffbit); | 484 | set_bit(FF_GAIN, dev->ffbit); |
diff --git a/drivers/input/input.c b/drivers/input/input.c index cc763c96fada..2266ecbfbc01 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -1292,17 +1292,24 @@ static int input_dev_uevent(struct device *device, struct kobj_uevent_env *env) | |||
| 1292 | return 0; | 1292 | return 0; |
| 1293 | } | 1293 | } |
| 1294 | 1294 | ||
| 1295 | #define INPUT_DO_TOGGLE(dev, type, bits, on) \ | 1295 | #define INPUT_DO_TOGGLE(dev, type, bits, on) \ |
| 1296 | do { \ | 1296 | do { \ |
| 1297 | int i; \ | 1297 | int i; \ |
| 1298 | if (!test_bit(EV_##type, dev->evbit)) \ | 1298 | bool active; \ |
| 1299 | break; \ | 1299 | \ |
| 1300 | for (i = 0; i < type##_MAX; i++) { \ | 1300 | if (!test_bit(EV_##type, dev->evbit)) \ |
| 1301 | if (!test_bit(i, dev->bits##bit) || \ | 1301 | break; \ |
| 1302 | !test_bit(i, dev->bits)) \ | 1302 | \ |
| 1303 | continue; \ | 1303 | for (i = 0; i < type##_MAX; i++) { \ |
| 1304 | dev->event(dev, EV_##type, i, on); \ | 1304 | if (!test_bit(i, dev->bits##bit)) \ |
| 1305 | } \ | 1305 | continue; \ |
| 1306 | \ | ||
| 1307 | active = test_bit(i, dev->bits); \ | ||
| 1308 | if (!active && !on) \ | ||
| 1309 | continue; \ | ||
| 1310 | \ | ||
| 1311 | dev->event(dev, EV_##type, i, on ? active : 0); \ | ||
| 1312 | } \ | ||
| 1306 | } while (0) | 1313 | } while (0) |
| 1307 | 1314 | ||
| 1308 | #ifdef CONFIG_PM | 1315 | #ifdef CONFIG_PM |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 4452eabbee6d..28e6110d1ff8 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
| @@ -1174,6 +1174,18 @@ static int atkbd_reconnect(struct serio *serio) | |||
| 1174 | return -1; | 1174 | return -1; |
| 1175 | 1175 | ||
| 1176 | atkbd_activate(atkbd); | 1176 | atkbd_activate(atkbd); |
| 1177 | |||
| 1178 | /* | ||
| 1179 | * Restore LED state and repeat rate. While input core | ||
| 1180 | * will do this for us at resume time reconnect may happen | ||
| 1181 | * because user requested it via sysfs or simply because | ||
| 1182 | * keyboard was unplugged and plugged in again so we need | ||
| 1183 | * to do it ourselves here. | ||
| 1184 | */ | ||
| 1185 | atkbd_set_leds(atkbd); | ||
| 1186 | if (!atkbd->softrepeat) | ||
| 1187 | atkbd_set_repeat_rate(atkbd); | ||
| 1188 | |||
| 1177 | } | 1189 | } |
| 1178 | 1190 | ||
| 1179 | atkbd_enable(atkbd); | 1191 | atkbd_enable(atkbd); |
| @@ -1422,6 +1434,7 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) | |||
| 1422 | 1434 | ||
| 1423 | atkbd->dev = new_dev; | 1435 | atkbd->dev = new_dev; |
| 1424 | atkbd->set = atkbd_select_set(atkbd, value, atkbd->extra); | 1436 | atkbd->set = atkbd_select_set(atkbd, value, atkbd->extra); |
| 1437 | atkbd_reset_state(atkbd); | ||
| 1425 | atkbd_activate(atkbd); | 1438 | atkbd_activate(atkbd); |
| 1426 | atkbd_set_keycode_table(atkbd); | 1439 | atkbd_set_keycode_table(atkbd); |
| 1427 | atkbd_set_device_attrs(atkbd); | 1440 | atkbd_set_device_attrs(atkbd); |
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 5e6308694408..82811558ec33 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
| @@ -107,8 +107,7 @@ static const struct dmi_system_id lifebook_dmi_table[] = { | |||
| 107 | .matches = { | 107 | .matches = { |
| 108 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-72"), | 108 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-72"), |
| 109 | }, | 109 | }, |
| 110 | .callback = lifebook_set_serio_phys, | 110 | .callback = lifebook_set_6byte_proto, |
| 111 | .driver_data = "isa0060/serio3", | ||
| 112 | }, | 111 | }, |
| 113 | { | 112 | { |
| 114 | .ident = "Lifebook B142", | 113 | .ident = "Lifebook B142", |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 690aed905436..07c53798301a 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
| @@ -581,7 +581,7 @@ static int cortron_detect(struct psmouse *psmouse, bool set_properties) | |||
| 581 | static int psmouse_extensions(struct psmouse *psmouse, | 581 | static int psmouse_extensions(struct psmouse *psmouse, |
| 582 | unsigned int max_proto, bool set_properties) | 582 | unsigned int max_proto, bool set_properties) |
| 583 | { | 583 | { |
| 584 | bool synaptics_hardware = true; | 584 | bool synaptics_hardware = false; |
| 585 | 585 | ||
| 586 | /* | 586 | /* |
| 587 | * We always check for lifebook because it does not disturb mouse | 587 | * We always check for lifebook because it does not disturb mouse |
| @@ -1673,7 +1673,7 @@ static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp) | |||
| 1673 | { | 1673 | { |
| 1674 | int type = *((unsigned int *)kp->arg); | 1674 | int type = *((unsigned int *)kp->arg); |
| 1675 | 1675 | ||
| 1676 | return sprintf(buffer, "%s\n", psmouse_protocol_by_type(type)->name); | 1676 | return sprintf(buffer, "%s", psmouse_protocol_by_type(type)->name); |
| 1677 | } | 1677 | } |
| 1678 | 1678 | ||
| 1679 | static int __init psmouse_init(void) | 1679 | static int __init psmouse_init(void) |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index a537925f7651..2bcf1ace27c0 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
| @@ -447,6 +447,27 @@ static struct dmi_system_id __initdata i8042_dmi_reset_table[] = { | |||
| 447 | DMI_MATCH(DMI_PRODUCT_NAME, "N10"), | 447 | DMI_MATCH(DMI_PRODUCT_NAME, "N10"), |
| 448 | }, | 448 | }, |
| 449 | }, | 449 | }, |
| 450 | { | ||
| 451 | .ident = "Dell Vostro 1320", | ||
| 452 | .matches = { | ||
| 453 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
| 454 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1320"), | ||
| 455 | }, | ||
| 456 | }, | ||
| 457 | { | ||
| 458 | .ident = "Dell Vostro 1520", | ||
| 459 | .matches = { | ||
| 460 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
| 461 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1520"), | ||
| 462 | }, | ||
| 463 | }, | ||
| 464 | { | ||
| 465 | .ident = "Dell Vostro 1720", | ||
| 466 | .matches = { | ||
| 467 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
| 468 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"), | ||
| 469 | }, | ||
| 470 | }, | ||
| 450 | { } | 471 | { } |
| 451 | }; | 472 | }; |
| 452 | 473 | ||
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index c72565520e41..5a6ae646a636 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
| @@ -111,8 +111,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev) | |||
| 111 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 111 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
| 112 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; | 112 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
| 113 | 113 | ||
| 114 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 115 | |||
| 116 | /* General socket configuration */ | 114 | /* General socket configuration */ |
| 117 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 115 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
| 118 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 116 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
| @@ -198,7 +196,6 @@ static int avmcs_config(struct pcmcia_device *link) | |||
| 198 | */ | 196 | */ |
| 199 | i = pcmcia_request_irq(link, &link->irq); | 197 | i = pcmcia_request_irq(link, &link->irq); |
| 200 | if (i != 0) { | 198 | if (i != 0) { |
| 201 | cs_error(link, RequestIRQ, i); | ||
| 202 | /* undo */ | 199 | /* undo */ |
| 203 | pcmcia_disable_device(link); | 200 | pcmcia_disable_device(link); |
| 204 | break; | 201 | break; |
| @@ -209,7 +206,6 @@ static int avmcs_config(struct pcmcia_device *link) | |||
| 209 | */ | 206 | */ |
| 210 | i = pcmcia_request_configuration(link, &link->conf); | 207 | i = pcmcia_request_configuration(link, &link->conf); |
| 211 | if (i != 0) { | 208 | if (i != 0) { |
| 212 | cs_error(link, RequestConfiguration, i); | ||
| 213 | pcmcia_disable_device(link); | 209 | pcmcia_disable_device(link); |
| 214 | break; | 210 | break; |
| 215 | } | 211 | } |
diff --git a/drivers/isdn/hardware/eicon/maintidi.c b/drivers/isdn/hardware/eicon/maintidi.c index 23960cb6eaab..41c26e756452 100644 --- a/drivers/isdn/hardware/eicon/maintidi.c +++ b/drivers/isdn/hardware/eicon/maintidi.c | |||
| @@ -959,8 +959,9 @@ static int process_idi_event (diva_strace_context_t* pLib, | |||
| 959 | } | 959 | } |
| 960 | if (!strncmp("State\\Layer2 No1", path, pVar->path_length)) { | 960 | if (!strncmp("State\\Layer2 No1", path, pVar->path_length)) { |
| 961 | char* tmp = &pLib->lines[0].pInterface->Layer2[0]; | 961 | char* tmp = &pLib->lines[0].pInterface->Layer2[0]; |
| 962 | dword l2_state; | 962 | dword l2_state; |
| 963 | diva_strace_read_uint (pVar, &l2_state); | 963 | if (diva_strace_read_uint(pVar, &l2_state)) |
| 964 | return -1; | ||
| 964 | 965 | ||
| 965 | switch (l2_state) { | 966 | switch (l2_state) { |
| 966 | case 0: | 967 | case 0: |
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c index 27d5dd68f4fb..ae89fb89da64 100644 --- a/drivers/isdn/hardware/eicon/message.c +++ b/drivers/isdn/hardware/eicon/message.c | |||
| @@ -2692,7 +2692,7 @@ static byte connect_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a, | |||
| 2692 | if (!(fax_control_bits & T30_CONTROL_BIT_MORE_DOCUMENTS) | 2692 | if (!(fax_control_bits & T30_CONTROL_BIT_MORE_DOCUMENTS) |
| 2693 | || (fax_feature_bits & T30_FEATURE_BIT_MORE_DOCUMENTS)) | 2693 | || (fax_feature_bits & T30_FEATURE_BIT_MORE_DOCUMENTS)) |
| 2694 | { | 2694 | { |
| 2695 | len = (byte)(&(((T30_INFO *) 0)->universal_6)); | 2695 | len = offsetof(T30_INFO, universal_6); |
| 2696 | fax_info_change = false; | 2696 | fax_info_change = false; |
| 2697 | if (ncpi->length >= 4) | 2697 | if (ncpi->length >= 4) |
| 2698 | { | 2698 | { |
| @@ -2754,7 +2754,7 @@ static byte connect_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a, | |||
| 2754 | for (i = 0; i < w; i++) | 2754 | for (i = 0; i < w; i++) |
| 2755 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id[i] = fax_parms[4].info[1+i]; | 2755 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id[i] = fax_parms[4].info[1+i]; |
| 2756 | ((T30_INFO *)(plci->fax_connect_info_buffer))->head_line_len = 0; | 2756 | ((T30_INFO *)(plci->fax_connect_info_buffer))->head_line_len = 0; |
| 2757 | len = (byte)(((T30_INFO *) 0)->station_id + 20); | 2757 | len = offsetof(T30_INFO, station_id) + 20; |
| 2758 | w = fax_parms[5].length; | 2758 | w = fax_parms[5].length; |
| 2759 | if (w > 20) | 2759 | if (w > 20) |
| 2760 | w = 20; | 2760 | w = 20; |
| @@ -2788,7 +2788,7 @@ static byte connect_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a, | |||
| 2788 | } | 2788 | } |
| 2789 | else | 2789 | else |
| 2790 | { | 2790 | { |
| 2791 | len = (byte)(&(((T30_INFO *) 0)->universal_6)); | 2791 | len = offsetof(T30_INFO, universal_6); |
| 2792 | } | 2792 | } |
| 2793 | fax_info_change = true; | 2793 | fax_info_change = true; |
| 2794 | 2794 | ||
| @@ -2892,7 +2892,7 @@ static byte connect_b3_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a, | |||
| 2892 | && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_ENABLE_NSF) | 2892 | && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_ENABLE_NSF) |
| 2893 | && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_NEGOTIATE_RESP)) | 2893 | && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_NEGOTIATE_RESP)) |
| 2894 | { | 2894 | { |
| 2895 | len = ((byte)(((T30_INFO *) 0)->station_id + 20)); | 2895 | len = offsetof(T30_INFO, station_id) + 20; |
| 2896 | if (plci->fax_connect_info_length < len) | 2896 | if (plci->fax_connect_info_length < len) |
| 2897 | { | 2897 | { |
| 2898 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; | 2898 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; |
| @@ -3802,7 +3802,7 @@ static byte manufacturer_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a, | |||
| 3802 | break; | 3802 | break; |
| 3803 | } | 3803 | } |
| 3804 | ncpi = &m_parms[1]; | 3804 | ncpi = &m_parms[1]; |
| 3805 | len = ((byte)(((T30_INFO *) 0)->station_id + 20)); | 3805 | len = offsetof(T30_INFO, station_id) + 20; |
| 3806 | if (plci->fax_connect_info_length < len) | 3806 | if (plci->fax_connect_info_length < len) |
| 3807 | { | 3807 | { |
| 3808 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; | 3808 | ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; |
| @@ -6844,7 +6844,7 @@ static void nl_ind(PLCI *plci) | |||
| 6844 | if ((plci->requested_options_conn | plci->requested_options | a->requested_options_table[plci->appl->Id-1]) | 6844 | if ((plci->requested_options_conn | plci->requested_options | a->requested_options_table[plci->appl->Id-1]) |
| 6845 | & ((1L << PRIVATE_FAX_SUB_SEP_PWD) | (1L << PRIVATE_FAX_NONSTANDARD))) | 6845 | & ((1L << PRIVATE_FAX_SUB_SEP_PWD) | (1L << PRIVATE_FAX_NONSTANDARD))) |
| 6846 | { | 6846 | { |
| 6847 | i = ((word)(((T30_INFO *) 0)->station_id + 20)) + ((T30_INFO *)plci->NL.RBuffer->P)->head_line_len; | 6847 | i = offsetof(T30_INFO, station_id) + 20 + ((T30_INFO *)plci->NL.RBuffer->P)->head_line_len; |
| 6848 | while (i < plci->NL.RBuffer->length) | 6848 | while (i < plci->NL.RBuffer->length) |
| 6849 | plci->ncpi_buffer[++len] = plci->NL.RBuffer->P[i++]; | 6849 | plci->ncpi_buffer[++len] = plci->NL.RBuffer->P[i++]; |
| 6850 | } | 6850 | } |
| @@ -7236,7 +7236,7 @@ static void nl_ind(PLCI *plci) | |||
| 7236 | { | 7236 | { |
| 7237 | plci->RData[1].P = plci->RData[0].P; | 7237 | plci->RData[1].P = plci->RData[0].P; |
| 7238 | plci->RData[1].PLength = plci->RData[0].PLength; | 7238 | plci->RData[1].PLength = plci->RData[0].PLength; |
| 7239 | plci->RData[0].P = v120_header_buffer + (-((int) v120_header_buffer) & 3); | 7239 | plci->RData[0].P = v120_header_buffer + (-((unsigned long)v120_header_buffer) & 3); |
| 7240 | if ((plci->NL.RBuffer->P[0] & V120_HEADER_EXTEND_BIT) || (plci->NL.RLength == 1)) | 7240 | if ((plci->NL.RBuffer->P[0] & V120_HEADER_EXTEND_BIT) || (plci->NL.RLength == 1)) |
| 7241 | plci->RData[0].PLength = 1; | 7241 | plci->RData[0].PLength = 1; |
| 7242 | else | 7242 | else |
| @@ -8473,7 +8473,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp) | |||
| 8473 | fax_control_bits |= T30_CONTROL_BIT_ACCEPT_SEL_POLLING; | 8473 | fax_control_bits |= T30_CONTROL_BIT_ACCEPT_SEL_POLLING; |
| 8474 | } | 8474 | } |
| 8475 | len = nlc[0]; | 8475 | len = nlc[0]; |
| 8476 | pos = ((byte)(((T30_INFO *) 0)->station_id + 20)); | 8476 | pos = offsetof(T30_INFO, station_id) + 20; |
| 8477 | if (pos < plci->fax_connect_info_length) | 8477 | if (pos < plci->fax_connect_info_length) |
| 8478 | { | 8478 | { |
| 8479 | for (i = 1 + plci->fax_connect_info_buffer[pos]; i != 0; i--) | 8479 | for (i = 1 + plci->fax_connect_info_buffer[pos]; i != 0; i--) |
| @@ -8525,7 +8525,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp) | |||
| 8525 | } | 8525 | } |
| 8526 | 8526 | ||
| 8527 | PUT_WORD(&(((T30_INFO *)&nlc[1])->control_bits_low), fax_control_bits); | 8527 | PUT_WORD(&(((T30_INFO *)&nlc[1])->control_bits_low), fax_control_bits); |
| 8528 | len = ((byte)(((T30_INFO *) 0)->station_id + 20)); | 8528 | len = offsetof(T30_INFO, station_id) + 20; |
| 8529 | for (i = 0; i < len; i++) | 8529 | for (i = 0; i < len; i++) |
| 8530 | plci->fax_connect_info_buffer[i] = nlc[1+i]; | 8530 | plci->fax_connect_info_buffer[i] = nlc[1+i]; |
| 8531 | ((T30_INFO *) plci->fax_connect_info_buffer)->head_line_len = 0; | 8531 | ((T30_INFO *) plci->fax_connect_info_buffer)->head_line_len = 0; |
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c index faed794cf75a..a6624ad252c5 100644 --- a/drivers/isdn/hardware/mISDN/hfcmulti.c +++ b/drivers/isdn/hardware/mISDN/hfcmulti.c | |||
| @@ -5481,7 +5481,7 @@ HFCmulti_init(void) | |||
| 5481 | if (err) { | 5481 | if (err) { |
| 5482 | printk(KERN_ERR "error registering embedded driver: " | 5482 | printk(KERN_ERR "error registering embedded driver: " |
| 5483 | "%x\n", err); | 5483 | "%x\n", err); |
| 5484 | return -err; | 5484 | return err; |
| 5485 | } | 5485 | } |
| 5486 | HFC_cnt++; | 5486 | HFC_cnt++; |
| 5487 | printk(KERN_INFO "%d devices registered\n", HFC_cnt); | 5487 | printk(KERN_INFO "%d devices registered\n", HFC_cnt); |
diff --git a/drivers/isdn/hisax/amd7930_fn.c b/drivers/isdn/hisax/amd7930_fn.c index bf526a7a63af..d6fdf1f66754 100644 --- a/drivers/isdn/hisax/amd7930_fn.c +++ b/drivers/isdn/hisax/amd7930_fn.c | |||
| @@ -594,6 +594,7 @@ Amd7930_l1hw(struct PStack *st, int pr, void *arg) | |||
| 594 | if (cs->debug & L1_DEB_WARN) | 594 | if (cs->debug & L1_DEB_WARN) |
| 595 | debugl1(cs, "Amd7930: l1hw: l2l1 tx_skb exist this shouldn't happen"); | 595 | debugl1(cs, "Amd7930: l1hw: l2l1 tx_skb exist this shouldn't happen"); |
| 596 | skb_queue_tail(&cs->sq, skb); | 596 | skb_queue_tail(&cs->sq, skb); |
| 597 | spin_unlock_irqrestore(&cs->lock, flags); | ||
| 597 | break; | 598 | break; |
| 598 | } | 599 | } |
| 599 | if (cs->debug & DEB_DLOG_HEX) | 600 | if (cs->debug & DEB_DLOG_HEX) |
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 23560c897ec3..f9bdff39cf4a 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
| @@ -30,22 +30,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for AVM A1/Fritz!PCMCIA car | |||
| 30 | MODULE_AUTHOR("Carsten Paeth"); | 30 | MODULE_AUTHOR("Carsten Paeth"); |
| 31 | MODULE_LICENSE("GPL"); | 31 | MODULE_LICENSE("GPL"); |
| 32 | 32 | ||
| 33 | /* | ||
| 34 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 35 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 36 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 37 | be present but disabled -- but it can then be enabled for specific | ||
| 38 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 39 | */ | ||
| 40 | #ifdef PCMCIA_DEBUG | ||
| 41 | static int pc_debug = PCMCIA_DEBUG; | ||
| 42 | module_param(pc_debug, int, 0); | ||
| 43 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); | ||
| 44 | static char *version = | ||
| 45 | "avma1_cs.c 1.00 1998/01/23 10:00:00 (Carsten Paeth)"; | ||
| 46 | #else | ||
| 47 | #define DEBUG(n, args...) | ||
| 48 | #endif | ||
| 49 | 33 | ||
| 50 | /*====================================================================*/ | 34 | /*====================================================================*/ |
| 51 | 35 | ||
| @@ -119,7 +103,7 @@ static int avma1cs_probe(struct pcmcia_device *p_dev) | |||
| 119 | { | 103 | { |
| 120 | local_info_t *local; | 104 | local_info_t *local; |
| 121 | 105 | ||
| 122 | DEBUG(0, "avma1cs_attach()\n"); | 106 | dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); |
| 123 | 107 | ||
| 124 | /* Allocate space for private device-specific data */ | 108 | /* Allocate space for private device-specific data */ |
| 125 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); | 109 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
| @@ -139,8 +123,6 @@ static int avma1cs_probe(struct pcmcia_device *p_dev) | |||
| 139 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 123 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
| 140 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; | 124 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
| 141 | 125 | ||
| 142 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 143 | |||
| 144 | /* General socket configuration */ | 126 | /* General socket configuration */ |
| 145 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 127 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
| 146 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 128 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
| @@ -161,7 +143,7 @@ static int avma1cs_probe(struct pcmcia_device *p_dev) | |||
| 161 | 143 | ||
| 162 | static void avma1cs_detach(struct pcmcia_device *link) | 144 | static void avma1cs_detach(struct pcmcia_device *link) |
| 163 | { | 145 | { |
| 164 | DEBUG(0, "avma1cs_detach(0x%p)\n", link); | 146 | dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link); |
| 165 | avma1cs_release(link); | 147 | avma1cs_release(link); |
| 166 | kfree(link->priv); | 148 | kfree(link->priv); |
| 167 | } /* avma1cs_detach */ | 149 | } /* avma1cs_detach */ |
| @@ -203,7 +185,7 @@ static int avma1cs_config(struct pcmcia_device *link) | |||
| 203 | 185 | ||
| 204 | dev = link->priv; | 186 | dev = link->priv; |
| 205 | 187 | ||
| 206 | DEBUG(0, "avma1cs_config(0x%p)\n", link); | 188 | dev_dbg(&link->dev, "avma1cs_config(0x%p)\n", link); |
| 207 | 189 | ||
| 208 | devname[0] = 0; | 190 | devname[0] = 0; |
| 209 | if (link->prod_id[1]) | 191 | if (link->prod_id[1]) |
| @@ -218,7 +200,6 @@ static int avma1cs_config(struct pcmcia_device *link) | |||
| 218 | */ | 200 | */ |
| 219 | i = pcmcia_request_irq(link, &link->irq); | 201 | i = pcmcia_request_irq(link, &link->irq); |
| 220 | if (i != 0) { | 202 | if (i != 0) { |
| 221 | cs_error(link, RequestIRQ, i); | ||
| 222 | /* undo */ | 203 | /* undo */ |
| 223 | pcmcia_disable_device(link); | 204 | pcmcia_disable_device(link); |
| 224 | break; | 205 | break; |
| @@ -229,7 +210,6 @@ static int avma1cs_config(struct pcmcia_device *link) | |||
| 229 | */ | 210 | */ |
| 230 | i = pcmcia_request_configuration(link, &link->conf); | 211 | i = pcmcia_request_configuration(link, &link->conf); |
| 231 | if (i != 0) { | 212 | if (i != 0) { |
| 232 | cs_error(link, RequestConfiguration, i); | ||
| 233 | pcmcia_disable_device(link); | 213 | pcmcia_disable_device(link); |
| 234 | break; | 214 | break; |
| 235 | } | 215 | } |
| @@ -281,7 +261,7 @@ static void avma1cs_release(struct pcmcia_device *link) | |||
| 281 | { | 261 | { |
| 282 | local_info_t *local = link->priv; | 262 | local_info_t *local = link->priv; |
| 283 | 263 | ||
| 284 | DEBUG(0, "avma1cs_release(0x%p)\n", link); | 264 | dev_dbg(&link->dev, "avma1cs_release(0x%p)\n", link); |
| 285 | 265 | ||
| 286 | /* now unregister function with hisax */ | 266 | /* now unregister function with hisax */ |
| 287 | HiSax_closecard(local->node.minor); | 267 | HiSax_closecard(local->node.minor); |
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c index 018bd293e580..0b0c2e5d806b 100644 --- a/drivers/isdn/hisax/diva.c +++ b/drivers/isdn/hisax/diva.c | |||
| @@ -382,7 +382,7 @@ MemwaitforXFW(struct IsdnCardState *cs, int hscx) | |||
| 382 | { | 382 | { |
| 383 | int to = 50; | 383 | int to = 50; |
| 384 | 384 | ||
| 385 | while ((!(MemReadHSCX(cs, hscx, HSCX_STAR) & 0x44) == 0x40) && to) { | 385 | while (((MemReadHSCX(cs, hscx, HSCX_STAR) & 0x44) != 0x40) && to) { |
| 386 | udelay(1); | 386 | udelay(1); |
| 387 | to--; | 387 | to--; |
| 388 | } | 388 | } |
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index f4d0fe29bcf8..a2f709f53974 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c | |||
| @@ -57,23 +57,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Elsa PCM cards"); | |||
| 57 | MODULE_AUTHOR("Klaus Lichtenwalder"); | 57 | MODULE_AUTHOR("Klaus Lichtenwalder"); |
| 58 | MODULE_LICENSE("Dual MPL/GPL"); | 58 | MODULE_LICENSE("Dual MPL/GPL"); |
| 59 | 59 | ||
| 60 | /* | ||
| 61 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 62 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 63 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 64 | be present but disabled -- but it can then be enabled for specific | ||
| 65 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 66 | */ | ||
| 67 | |||
| 68 | #ifdef PCMCIA_DEBUG | ||
| 69 | static int pc_debug = PCMCIA_DEBUG; | ||
| 70 | module_param(pc_debug, int, 0); | ||
| 71 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); | ||
| 72 | static char *version = | ||
| 73 | "elsa_cs.c $Revision: 1.2.2.4 $ $Date: 2004/01/25 15:07:06 $ (K.Lichtenwalder)"; | ||
| 74 | #else | ||
| 75 | #define DEBUG(n, args...) | ||
| 76 | #endif | ||
| 77 | 60 | ||
| 78 | /*====================================================================*/ | 61 | /*====================================================================*/ |
| 79 | 62 | ||
| @@ -142,7 +125,7 @@ static int elsa_cs_probe(struct pcmcia_device *link) | |||
| 142 | { | 125 | { |
| 143 | local_info_t *local; | 126 | local_info_t *local; |
| 144 | 127 | ||
| 145 | DEBUG(0, "elsa_cs_attach()\n"); | 128 | dev_dbg(&link->dev, "elsa_cs_attach()\n"); |
| 146 | 129 | ||
| 147 | /* Allocate space for private device-specific data */ | 130 | /* Allocate space for private device-specific data */ |
| 148 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); | 131 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
| @@ -155,7 +138,6 @@ static int elsa_cs_probe(struct pcmcia_device *link) | |||
| 155 | 138 | ||
| 156 | /* Interrupt setup */ | 139 | /* Interrupt setup */ |
| 157 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; | 140 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
| 158 | link->irq.IRQInfo1 = IRQ_LEVEL_ID|IRQ_SHARE_ID; | ||
| 159 | link->irq.Handler = NULL; | 141 | link->irq.Handler = NULL; |
| 160 | 142 | ||
| 161 | /* | 143 | /* |
| @@ -188,7 +170,7 @@ static void elsa_cs_detach(struct pcmcia_device *link) | |||
| 188 | { | 170 | { |
| 189 | local_info_t *info = link->priv; | 171 | local_info_t *info = link->priv; |
| 190 | 172 | ||
| 191 | DEBUG(0, "elsa_cs_detach(0x%p)\n", link); | 173 | dev_dbg(&link->dev, "elsa_cs_detach(0x%p)\n", link); |
| 192 | 174 | ||
| 193 | info->busy = 1; | 175 | info->busy = 1; |
| 194 | elsa_cs_release(link); | 176 | elsa_cs_release(link); |
| @@ -231,30 +213,25 @@ static int elsa_cs_configcheck(struct pcmcia_device *p_dev, | |||
| 231 | static int elsa_cs_config(struct pcmcia_device *link) | 213 | static int elsa_cs_config(struct pcmcia_device *link) |
| 232 | { | 214 | { |
| 233 | local_info_t *dev; | 215 | local_info_t *dev; |
| 234 | int i, last_fn; | 216 | int i; |
| 235 | IsdnCard_t icard; | 217 | IsdnCard_t icard; |
| 236 | 218 | ||
| 237 | DEBUG(0, "elsa_config(0x%p)\n", link); | 219 | dev_dbg(&link->dev, "elsa_config(0x%p)\n", link); |
| 238 | dev = link->priv; | 220 | dev = link->priv; |
| 239 | 221 | ||
| 240 | i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL); | 222 | i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL); |
| 241 | if (i != 0) { | 223 | if (i != 0) |
| 242 | last_fn = RequestIO; | 224 | goto failed; |
| 243 | goto cs_failed; | ||
| 244 | } | ||
| 245 | 225 | ||
| 246 | i = pcmcia_request_irq(link, &link->irq); | 226 | i = pcmcia_request_irq(link, &link->irq); |
| 247 | if (i != 0) { | 227 | if (i != 0) { |
| 248 | link->irq.AssignedIRQ = 0; | 228 | link->irq.AssignedIRQ = 0; |
| 249 | last_fn = RequestIRQ; | 229 | goto failed; |
| 250 | goto cs_failed; | ||
| 251 | } | 230 | } |
| 252 | 231 | ||
| 253 | i = pcmcia_request_configuration(link, &link->conf); | 232 | i = pcmcia_request_configuration(link, &link->conf); |
| 254 | if (i != 0) { | 233 | if (i != 0) |
| 255 | last_fn = RequestConfiguration; | 234 | goto failed; |
| 256 | goto cs_failed; | ||
| 257 | } | ||
| 258 | 235 | ||
| 259 | /* At this point, the dev_node_t structure(s) should be | 236 | /* At this point, the dev_node_t structure(s) should be |
| 260 | initialized and arranged in a linked list at link->dev. *//* */ | 237 | initialized and arranged in a linked list at link->dev. *//* */ |
| @@ -290,8 +267,7 @@ static int elsa_cs_config(struct pcmcia_device *link) | |||
| 290 | ((local_info_t*)link->priv)->cardnr = i; | 267 | ((local_info_t*)link->priv)->cardnr = i; |
| 291 | 268 | ||
| 292 | return 0; | 269 | return 0; |
| 293 | cs_failed: | 270 | failed: |
| 294 | cs_error(link, last_fn, i); | ||
| 295 | elsa_cs_release(link); | 271 | elsa_cs_release(link); |
| 296 | return -ENODEV; | 272 | return -ENODEV; |
| 297 | } /* elsa_cs_config */ | 273 | } /* elsa_cs_config */ |
| @@ -308,7 +284,7 @@ static void elsa_cs_release(struct pcmcia_device *link) | |||
| 308 | { | 284 | { |
| 309 | local_info_t *local = link->priv; | 285 | local_info_t *local = link->priv; |
| 310 | 286 | ||
| 311 | DEBUG(0, "elsa_cs_release(0x%p)\n", link); | 287 | dev_dbg(&link->dev, "elsa_cs_release(0x%p)\n", link); |
| 312 | 288 | ||
| 313 | if (local) { | 289 | if (local) { |
| 314 | if (local->cardnr >= 0) { | 290 | if (local->cardnr >= 0) { |
diff --git a/drivers/isdn/hisax/elsa_ser.c b/drivers/isdn/hisax/elsa_ser.c index f181db464392..1657bba7879e 100644 --- a/drivers/isdn/hisax/elsa_ser.c +++ b/drivers/isdn/hisax/elsa_ser.c | |||
| @@ -477,62 +477,62 @@ static void | |||
| 477 | modem_set_init(struct IsdnCardState *cs) { | 477 | modem_set_init(struct IsdnCardState *cs) { |
| 478 | int timeout; | 478 | int timeout; |
| 479 | 479 | ||
| 480 | #define RCV_DELAY 20000 | 480 | #define RCV_DELAY 20 |
| 481 | modem_write_cmd(cs, MInit_1, strlen(MInit_1)); | 481 | modem_write_cmd(cs, MInit_1, strlen(MInit_1)); |
| 482 | timeout = 1000; | 482 | timeout = 1000; |
| 483 | while(timeout-- && cs->hw.elsa.transcnt) | 483 | while(timeout-- && cs->hw.elsa.transcnt) |
| 484 | udelay(1000); | 484 | udelay(1000); |
| 485 | debugl1(cs, "msi tout=%d", timeout); | 485 | debugl1(cs, "msi tout=%d", timeout); |
| 486 | udelay(RCV_DELAY); | 486 | mdelay(RCV_DELAY); |
| 487 | modem_write_cmd(cs, MInit_2, strlen(MInit_2)); | 487 | modem_write_cmd(cs, MInit_2, strlen(MInit_2)); |
| 488 | timeout = 1000; | 488 | timeout = 1000; |
| 489 | while(timeout-- && cs->hw.elsa.transcnt) | 489 | while(timeout-- && cs->hw.elsa.transcnt) |
| 490 | udelay(1000); | 490 | udelay(1000); |
| 491 | debugl1(cs, "msi tout=%d", timeout); | 491 | debugl1(cs, "msi tout=%d", timeout); |
| 492 | udelay(RCV_DELAY); | 492 | mdelay(RCV_DELAY); |
| 493 | modem_write_cmd(cs, MInit_3, strlen(MInit_3)); | 493 | modem_write_cmd(cs, MInit_3, strlen(MInit_3)); |
| 494 | timeout = 1000; | 494 | timeout = 1000; |
| 495 | while(timeout-- && cs->hw.elsa.transcnt) | 495 | while(timeout-- && cs->hw.elsa.transcnt) |
| 496 | udelay(1000); | 496 | udelay(1000); |
| 497 | debugl1(cs, "msi tout=%d", timeout); | 497 | debugl1(cs, "msi tout=%d", timeout); |
| 498 | udelay(RCV_DELAY); | 498 | mdelay(RCV_DELAY); |
| 499 | modem_write_cmd(cs, MInit_4, strlen(MInit_4)); | 499 | modem_write_cmd(cs, MInit_4, strlen(MInit_4)); |
| 500 | timeout = 1000; | 500 | timeout = 1000; |
| 501 | while(timeout-- && cs->hw.elsa.transcnt) | 501 | while(timeout-- && cs->hw.elsa.transcnt) |
| 502 | udelay(1000); | 502 | udelay(1000); |
| 503 | debugl1(cs, "msi tout=%d", timeout); | 503 | debugl1(cs, "msi tout=%d", timeout); |
| 504 | udelay(RCV_DELAY ); | 504 | mdelay(RCV_DELAY); |
| 505 | modem_write_cmd(cs, MInit_5, strlen(MInit_5)); | 505 | modem_write_cmd(cs, MInit_5, strlen(MInit_5)); |
| 506 | timeout = 1000; | 506 | timeout = 1000; |
| 507 | while(timeout-- && cs->hw.elsa.transcnt) | 507 | while(timeout-- && cs->hw.elsa.transcnt) |
| 508 | udelay(1000); | 508 | udelay(1000); |
| 509 | debugl1(cs, "msi tout=%d", timeout); | 509 | debugl1(cs, "msi tout=%d", timeout); |
| 510 | udelay(RCV_DELAY); | 510 | mdelay(RCV_DELAY); |
| 511 | modem_write_cmd(cs, MInit_6, strlen(MInit_6)); | 511 | modem_write_cmd(cs, MInit_6, strlen(MInit_6)); |
| 512 | timeout = 1000; | 512 | timeout = 1000; |
| 513 | while(timeout-- && cs->hw.elsa.transcnt) | 513 | while(timeout-- && cs->hw.elsa.transcnt) |
| 514 | udelay(1000); | 514 | udelay(1000); |
| 515 | debugl1(cs, "msi tout=%d", timeout); | 515 | debugl1(cs, "msi tout=%d", timeout); |
| 516 | udelay(RCV_DELAY); | 516 | mdelay(RCV_DELAY); |
| 517 | modem_write_cmd(cs, MInit_7, strlen(MInit_7)); | 517 | modem_write_cmd(cs, MInit_7, strlen(MInit_7)); |
| 518 | timeout = 1000; | 518 | timeout = 1000; |
| 519 | while(timeout-- && cs->hw.elsa.transcnt) | 519 | while(timeout-- && cs->hw.elsa.transcnt) |
| 520 | udelay(1000); | 520 | udelay(1000); |
| 521 | debugl1(cs, "msi tout=%d", timeout); | 521 | debugl1(cs, "msi tout=%d", timeout); |
| 522 | udelay(RCV_DELAY); | 522 | mdelay(RCV_DELAY); |
| 523 | } | 523 | } |
| 524 | 524 | ||
| 525 | static void | 525 | static void |
| 526 | modem_set_dial(struct IsdnCardState *cs, int outgoing) { | 526 | modem_set_dial(struct IsdnCardState *cs, int outgoing) { |
| 527 | int timeout; | 527 | int timeout; |
| 528 | #define RCV_DELAY 20000 | 528 | #define RCV_DELAY 20 |
| 529 | 529 | ||
| 530 | modem_write_cmd(cs, MInit_speed28800, strlen(MInit_speed28800)); | 530 | modem_write_cmd(cs, MInit_speed28800, strlen(MInit_speed28800)); |
| 531 | timeout = 1000; | 531 | timeout = 1000; |
| 532 | while(timeout-- && cs->hw.elsa.transcnt) | 532 | while(timeout-- && cs->hw.elsa.transcnt) |
| 533 | udelay(1000); | 533 | udelay(1000); |
| 534 | debugl1(cs, "msi tout=%d", timeout); | 534 | debugl1(cs, "msi tout=%d", timeout); |
| 535 | udelay(RCV_DELAY); | 535 | mdelay(RCV_DELAY); |
| 536 | if (outgoing) | 536 | if (outgoing) |
| 537 | modem_write_cmd(cs, MInit_dialout, strlen(MInit_dialout)); | 537 | modem_write_cmd(cs, MInit_dialout, strlen(MInit_dialout)); |
| 538 | else | 538 | else |
| @@ -541,7 +541,7 @@ modem_set_dial(struct IsdnCardState *cs, int outgoing) { | |||
| 541 | while(timeout-- && cs->hw.elsa.transcnt) | 541 | while(timeout-- && cs->hw.elsa.transcnt) |
| 542 | udelay(1000); | 542 | udelay(1000); |
| 543 | debugl1(cs, "msi tout=%d", timeout); | 543 | debugl1(cs, "msi tout=%d", timeout); |
| 544 | udelay(RCV_DELAY); | 544 | mdelay(RCV_DELAY); |
| 545 | } | 545 | } |
| 546 | 546 | ||
| 547 | static void | 547 | static void |
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c index 9de54202c90c..a420b64472e3 100644 --- a/drivers/isdn/hisax/hfc_usb.c +++ b/drivers/isdn/hisax/hfc_usb.c | |||
| @@ -817,8 +817,8 @@ collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish) | |||
| 817 | } | 817 | } |
| 818 | /* we have a complete hdlc packet */ | 818 | /* we have a complete hdlc packet */ |
| 819 | if (finish) { | 819 | if (finish) { |
| 820 | if ((!fifo->skbuff->data[fifo->skbuff->len - 1]) | 820 | if (fifo->skbuff->len > 3 && |
| 821 | && (fifo->skbuff->len > 3)) { | 821 | !fifo->skbuff->data[fifo->skbuff->len - 1]) { |
| 822 | 822 | ||
| 823 | if (fifon == HFCUSB_D_RX) { | 823 | if (fifon == HFCUSB_D_RX) { |
| 824 | DBG(HFCUSB_DBG_DCHANNEL, | 824 | DBG(HFCUSB_DBG_DCHANNEL, |
diff --git a/drivers/isdn/hisax/hscx_irq.c b/drivers/isdn/hisax/hscx_irq.c index 7b1ad5e4ecda..2387d76c721a 100644 --- a/drivers/isdn/hisax/hscx_irq.c +++ b/drivers/isdn/hisax/hscx_irq.c | |||
| @@ -32,7 +32,7 @@ waitforXFW(struct IsdnCardState *cs, int hscx) | |||
| 32 | { | 32 | { |
| 33 | int to = 50; | 33 | int to = 50; |
| 34 | 34 | ||
| 35 | while ((!(READHSCX(cs, hscx, HSCX_STAR) & 0x44) == 0x40) && to) { | 35 | while (((READHSCX(cs, hscx, HSCX_STAR) & 0x44) != 0x40) && to) { |
| 36 | udelay(1); | 36 | udelay(1); |
| 37 | to--; | 37 | to--; |
| 38 | } | 38 | } |
diff --git a/drivers/isdn/hisax/icc.c b/drivers/isdn/hisax/icc.c index 9aba646ba221..c80cbb8a2ef9 100644 --- a/drivers/isdn/hisax/icc.c +++ b/drivers/isdn/hisax/icc.c | |||
| @@ -468,6 +468,7 @@ ICC_l1hw(struct PStack *st, int pr, void *arg) | |||
| 468 | if (cs->debug & L1_DEB_WARN) | 468 | if (cs->debug & L1_DEB_WARN) |
| 469 | debugl1(cs, " l2l1 tx_skb exist this shouldn't happen"); | 469 | debugl1(cs, " l2l1 tx_skb exist this shouldn't happen"); |
| 470 | skb_queue_tail(&cs->sq, skb); | 470 | skb_queue_tail(&cs->sq, skb); |
| 471 | spin_unlock_irqrestore(&cs->lock, flags); | ||
| 471 | break; | 472 | break; |
| 472 | } | 473 | } |
| 473 | if (cs->debug & DEB_DLOG_HEX) | 474 | if (cs->debug & DEB_DLOG_HEX) |
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 9a3c9f5e4fe8..af5d393cc2d0 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
| @@ -57,24 +57,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Sedlbauer cards"); | |||
| 57 | MODULE_AUTHOR("Marcus Niemann"); | 57 | MODULE_AUTHOR("Marcus Niemann"); |
| 58 | MODULE_LICENSE("Dual MPL/GPL"); | 58 | MODULE_LICENSE("Dual MPL/GPL"); |
| 59 | 59 | ||
| 60 | /* | ||
| 61 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 62 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 63 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 64 | be present but disabled -- but it can then be enabled for specific | ||
| 65 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 66 | */ | ||
| 67 | |||
| 68 | #ifdef PCMCIA_DEBUG | ||
| 69 | static int pc_debug = PCMCIA_DEBUG; | ||
| 70 | module_param(pc_debug, int, 0); | ||
| 71 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); | ||
| 72 | static char *version = | ||
| 73 | "sedlbauer_cs.c 1.1a 2001/01/28 15:04:04 (M.Niemann)"; | ||
| 74 | #else | ||
| 75 | #define DEBUG(n, args...) | ||
| 76 | #endif | ||
| 77 | |||
| 78 | 60 | ||
| 79 | /*====================================================================*/ | 61 | /*====================================================================*/ |
| 80 | 62 | ||
| @@ -151,7 +133,7 @@ static int sedlbauer_probe(struct pcmcia_device *link) | |||
| 151 | { | 133 | { |
| 152 | local_info_t *local; | 134 | local_info_t *local; |
| 153 | 135 | ||
| 154 | DEBUG(0, "sedlbauer_attach()\n"); | 136 | dev_dbg(&link->dev, "sedlbauer_attach()\n"); |
| 155 | 137 | ||
| 156 | /* Allocate space for private device-specific data */ | 138 | /* Allocate space for private device-specific data */ |
| 157 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); | 139 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
| @@ -163,7 +145,6 @@ static int sedlbauer_probe(struct pcmcia_device *link) | |||
| 163 | 145 | ||
| 164 | /* Interrupt setup */ | 146 | /* Interrupt setup */ |
| 165 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; | 147 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
| 166 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 167 | link->irq.Handler = NULL; | 148 | link->irq.Handler = NULL; |
| 168 | 149 | ||
| 169 | /* | 150 | /* |
| @@ -198,7 +179,7 @@ static int sedlbauer_probe(struct pcmcia_device *link) | |||
| 198 | 179 | ||
| 199 | static void sedlbauer_detach(struct pcmcia_device *link) | 180 | static void sedlbauer_detach(struct pcmcia_device *link) |
| 200 | { | 181 | { |
| 201 | DEBUG(0, "sedlbauer_detach(0x%p)\n", link); | 182 | dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link); |
| 202 | 183 | ||
| 203 | ((local_info_t *)link->priv)->stop = 1; | 184 | ((local_info_t *)link->priv)->stop = 1; |
| 204 | sedlbauer_release(link); | 185 | sedlbauer_release(link); |
| @@ -214,9 +195,6 @@ static void sedlbauer_detach(struct pcmcia_device *link) | |||
| 214 | device available to the system. | 195 | device available to the system. |
| 215 | 196 | ||
| 216 | ======================================================================*/ | 197 | ======================================================================*/ |
| 217 | #define CS_CHECK(fn, ret) \ | ||
| 218 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 219 | |||
| 220 | static int sedlbauer_config_check(struct pcmcia_device *p_dev, | 198 | static int sedlbauer_config_check(struct pcmcia_device *p_dev, |
| 221 | cistpl_cftable_entry_t *cfg, | 199 | cistpl_cftable_entry_t *cfg, |
| 222 | cistpl_cftable_entry_t *dflt, | 200 | cistpl_cftable_entry_t *dflt, |
| @@ -293,11 +271,11 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
| 293 | req->Base = mem->win[0].host_addr; | 271 | req->Base = mem->win[0].host_addr; |
| 294 | req->Size = mem->win[0].len; | 272 | req->Size = mem->win[0].len; |
| 295 | req->AccessSpeed = 0; | 273 | req->AccessSpeed = 0; |
| 296 | if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0) | 274 | if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) |
| 297 | return -ENODEV; | 275 | return -ENODEV; |
| 298 | map.Page = 0; | 276 | map.Page = 0; |
| 299 | map.CardOffset = mem->win[0].card_addr; | 277 | map.CardOffset = mem->win[0].card_addr; |
| 300 | if (pcmcia_map_mem_page(p_dev->win, &map) != 0) | 278 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) |
| 301 | return -ENODEV; | 279 | return -ENODEV; |
| 302 | } | 280 | } |
| 303 | return 0; | 281 | return 0; |
| @@ -309,10 +287,10 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
| 309 | { | 287 | { |
| 310 | local_info_t *dev = link->priv; | 288 | local_info_t *dev = link->priv; |
| 311 | win_req_t *req; | 289 | win_req_t *req; |
| 312 | int last_fn, last_ret; | 290 | int ret; |
| 313 | IsdnCard_t icard; | 291 | IsdnCard_t icard; |
| 314 | 292 | ||
| 315 | DEBUG(0, "sedlbauer_config(0x%p)\n", link); | 293 | dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); |
| 316 | 294 | ||
| 317 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); | 295 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); |
| 318 | if (!req) | 296 | if (!req) |
| @@ -330,8 +308,8 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
| 330 | these things without consulting the CIS, and most client drivers | 308 | these things without consulting the CIS, and most client drivers |
| 331 | will only use the CIS to fill in implementation-defined details. | 309 | will only use the CIS to fill in implementation-defined details. |
| 332 | */ | 310 | */ |
| 333 | last_ret = pcmcia_loop_config(link, sedlbauer_config_check, req); | 311 | ret = pcmcia_loop_config(link, sedlbauer_config_check, req); |
| 334 | if (last_ret) | 312 | if (ret) |
| 335 | goto failed; | 313 | goto failed; |
| 336 | 314 | ||
| 337 | /* | 315 | /* |
| @@ -339,15 +317,20 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
| 339 | handler to the interrupt, unless the 'Handler' member of the | 317 | handler to the interrupt, unless the 'Handler' member of the |
| 340 | irq structure is initialized. | 318 | irq structure is initialized. |
| 341 | */ | 319 | */ |
| 342 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 320 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 343 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 321 | ret = pcmcia_request_irq(link, &link->irq); |
| 322 | if (ret) | ||
| 323 | goto failed; | ||
| 324 | } | ||
| 344 | 325 | ||
| 345 | /* | 326 | /* |
| 346 | This actually configures the PCMCIA socket -- setting up | 327 | This actually configures the PCMCIA socket -- setting up |
| 347 | the I/O windows and the interrupt mapping, and putting the | 328 | the I/O windows and the interrupt mapping, and putting the |
| 348 | card and host interface into "Memory and IO" mode. | 329 | card and host interface into "Memory and IO" mode. |
| 349 | */ | 330 | */ |
| 350 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 331 | ret = pcmcia_request_configuration(link, &link->conf); |
| 332 | if (ret) | ||
| 333 | goto failed; | ||
| 351 | 334 | ||
| 352 | /* | 335 | /* |
| 353 | At this point, the dev_node_t structure(s) need to be | 336 | At this point, the dev_node_t structure(s) need to be |
| @@ -380,19 +363,18 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
| 380 | icard.protocol = protocol; | 363 | icard.protocol = protocol; |
| 381 | icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; | 364 | icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; |
| 382 | 365 | ||
| 383 | last_ret = hisax_init_pcmcia(link, &(((local_info_t*)link->priv)->stop), &icard); | 366 | ret = hisax_init_pcmcia(link, |
| 384 | if (last_ret < 0) { | 367 | &(((local_info_t *)link->priv)->stop), &icard); |
| 385 | printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n", | 368 | if (ret < 0) { |
| 386 | last_ret, link->io.BasePort1); | 369 | printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n", |
| 370 | ret, link->io.BasePort1); | ||
| 387 | sedlbauer_release(link); | 371 | sedlbauer_release(link); |
| 388 | return -ENODEV; | 372 | return -ENODEV; |
| 389 | } else | 373 | } else |
| 390 | ((local_info_t*)link->priv)->cardnr = last_ret; | 374 | ((local_info_t *)link->priv)->cardnr = ret; |
| 391 | 375 | ||
| 392 | return 0; | 376 | return 0; |
| 393 | 377 | ||
| 394 | cs_failed: | ||
| 395 | cs_error(link, last_fn, last_ret); | ||
| 396 | failed: | 378 | failed: |
| 397 | sedlbauer_release(link); | 379 | sedlbauer_release(link); |
| 398 | return -ENODEV; | 380 | return -ENODEV; |
| @@ -410,7 +392,7 @@ failed: | |||
| 410 | static void sedlbauer_release(struct pcmcia_device *link) | 392 | static void sedlbauer_release(struct pcmcia_device *link) |
| 411 | { | 393 | { |
| 412 | local_info_t *local = link->priv; | 394 | local_info_t *local = link->priv; |
| 413 | DEBUG(0, "sedlbauer_release(0x%p)\n", link); | 395 | dev_dbg(&link->dev, "sedlbauer_release(0x%p)\n", link); |
| 414 | 396 | ||
| 415 | if (local) { | 397 | if (local) { |
| 416 | if (local->cardnr >= 0) { | 398 | if (local->cardnr >= 0) { |
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 623d111544d4..ea705394ce2b 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
| @@ -38,23 +38,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Teles PCMCIA cards"); | |||
| 38 | MODULE_AUTHOR("Christof Petig, christof.petig@wtal.de, Karsten Keil, kkeil@suse.de"); | 38 | MODULE_AUTHOR("Christof Petig, christof.petig@wtal.de, Karsten Keil, kkeil@suse.de"); |
| 39 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
| 40 | 40 | ||
| 41 | /* | ||
| 42 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 43 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 44 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 45 | be present but disabled -- but it can then be enabled for specific | ||
| 46 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 47 | */ | ||
| 48 | |||
| 49 | #ifdef PCMCIA_DEBUG | ||
| 50 | static int pc_debug = PCMCIA_DEBUG; | ||
| 51 | module_param(pc_debug, int, 0); | ||
| 52 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); | ||
| 53 | static char *version = | ||
| 54 | "teles_cs.c 2.10 2002/07/30 22:23:34 kkeil"; | ||
| 55 | #else | ||
| 56 | #define DEBUG(n, args...) | ||
| 57 | #endif | ||
| 58 | 41 | ||
| 59 | /*====================================================================*/ | 42 | /*====================================================================*/ |
| 60 | 43 | ||
| @@ -133,7 +116,7 @@ static int teles_probe(struct pcmcia_device *link) | |||
| 133 | { | 116 | { |
| 134 | local_info_t *local; | 117 | local_info_t *local; |
| 135 | 118 | ||
| 136 | DEBUG(0, "teles_attach()\n"); | 119 | dev_dbg(&link->dev, "teles_attach()\n"); |
| 137 | 120 | ||
| 138 | /* Allocate space for private device-specific data */ | 121 | /* Allocate space for private device-specific data */ |
| 139 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); | 122 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
| @@ -145,7 +128,6 @@ static int teles_probe(struct pcmcia_device *link) | |||
| 145 | 128 | ||
| 146 | /* Interrupt setup */ | 129 | /* Interrupt setup */ |
| 147 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; | 130 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
| 148 | link->irq.IRQInfo1 = IRQ_LEVEL_ID|IRQ_SHARE_ID; | ||
| 149 | link->irq.Handler = NULL; | 131 | link->irq.Handler = NULL; |
| 150 | 132 | ||
| 151 | /* | 133 | /* |
| @@ -178,7 +160,7 @@ static void teles_detach(struct pcmcia_device *link) | |||
| 178 | { | 160 | { |
| 179 | local_info_t *info = link->priv; | 161 | local_info_t *info = link->priv; |
| 180 | 162 | ||
| 181 | DEBUG(0, "teles_detach(0x%p)\n", link); | 163 | dev_dbg(&link->dev, "teles_detach(0x%p)\n", link); |
| 182 | 164 | ||
| 183 | info->busy = 1; | 165 | info->busy = 1; |
| 184 | teles_cs_release(link); | 166 | teles_cs_release(link); |
| @@ -221,30 +203,25 @@ static int teles_cs_configcheck(struct pcmcia_device *p_dev, | |||
| 221 | static int teles_cs_config(struct pcmcia_device *link) | 203 | static int teles_cs_config(struct pcmcia_device *link) |
| 222 | { | 204 | { |
| 223 | local_info_t *dev; | 205 | local_info_t *dev; |
| 224 | int i, last_fn; | 206 | int i; |
| 225 | IsdnCard_t icard; | 207 | IsdnCard_t icard; |
| 226 | 208 | ||
| 227 | DEBUG(0, "teles_config(0x%p)\n", link); | 209 | dev_dbg(&link->dev, "teles_config(0x%p)\n", link); |
| 228 | dev = link->priv; | 210 | dev = link->priv; |
| 229 | 211 | ||
| 230 | i = pcmcia_loop_config(link, teles_cs_configcheck, NULL); | 212 | i = pcmcia_loop_config(link, teles_cs_configcheck, NULL); |
| 231 | if (i != 0) { | 213 | if (i != 0) |
| 232 | last_fn = RequestIO; | ||
| 233 | goto cs_failed; | 214 | goto cs_failed; |
| 234 | } | ||
| 235 | 215 | ||
| 236 | i = pcmcia_request_irq(link, &link->irq); | 216 | i = pcmcia_request_irq(link, &link->irq); |
| 237 | if (i != 0) { | 217 | if (i != 0) { |
| 238 | link->irq.AssignedIRQ = 0; | 218 | link->irq.AssignedIRQ = 0; |
| 239 | last_fn = RequestIRQ; | ||
| 240 | goto cs_failed; | 219 | goto cs_failed; |
| 241 | } | 220 | } |
| 242 | 221 | ||
| 243 | i = pcmcia_request_configuration(link, &link->conf); | 222 | i = pcmcia_request_configuration(link, &link->conf); |
| 244 | if (i != 0) { | 223 | if (i != 0) |
| 245 | last_fn = RequestConfiguration; | ||
| 246 | goto cs_failed; | 224 | goto cs_failed; |
| 247 | } | ||
| 248 | 225 | ||
| 249 | /* At this point, the dev_node_t structure(s) should be | 226 | /* At this point, the dev_node_t structure(s) should be |
| 250 | initialized and arranged in a linked list at link->dev. *//* */ | 227 | initialized and arranged in a linked list at link->dev. *//* */ |
| @@ -283,7 +260,6 @@ static int teles_cs_config(struct pcmcia_device *link) | |||
| 283 | return 0; | 260 | return 0; |
| 284 | 261 | ||
| 285 | cs_failed: | 262 | cs_failed: |
| 286 | cs_error(link, last_fn, i); | ||
| 287 | teles_cs_release(link); | 263 | teles_cs_release(link); |
| 288 | return -ENODEV; | 264 | return -ENODEV; |
| 289 | } /* teles_cs_config */ | 265 | } /* teles_cs_config */ |
| @@ -300,7 +276,7 @@ static void teles_cs_release(struct pcmcia_device *link) | |||
| 300 | { | 276 | { |
| 301 | local_info_t *local = link->priv; | 277 | local_info_t *local = link->priv; |
| 302 | 278 | ||
| 303 | DEBUG(0, "teles_cs_release(0x%p)\n", link); | 279 | dev_dbg(&link->dev, "teles_cs_release(0x%p)\n", link); |
| 304 | 280 | ||
| 305 | if (local) { | 281 | if (local) { |
| 306 | if (local->cardnr >= 0) { | 282 | if (local->cardnr >= 0) { |
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 2d14b64202a3..642d5aaf53ce 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
| @@ -1535,10 +1535,8 @@ static int isdn_ppp_mp_bundle_array_init(void) | |||
| 1535 | int sz = ISDN_MAX_CHANNELS*sizeof(ippp_bundle); | 1535 | int sz = ISDN_MAX_CHANNELS*sizeof(ippp_bundle); |
| 1536 | if( (isdn_ppp_bundle_arr = kzalloc(sz, GFP_KERNEL)) == NULL ) | 1536 | if( (isdn_ppp_bundle_arr = kzalloc(sz, GFP_KERNEL)) == NULL ) |
| 1537 | return -ENOMEM; | 1537 | return -ENOMEM; |
| 1538 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) { | 1538 | for( i = 0; i < ISDN_MAX_CHANNELS; i++ ) |
| 1539 | spin_lock_init(&isdn_ppp_bundle_arr[i].lock); | 1539 | spin_lock_init(&isdn_ppp_bundle_arr[i].lock); |
| 1540 | skb_queue_head_init(&isdn_ppp_bundle_arr[i].frags); | ||
| 1541 | } | ||
| 1542 | return 0; | 1540 | return 0; |
| 1543 | } | 1541 | } |
| 1544 | 1542 | ||
| @@ -1571,7 +1569,7 @@ static int isdn_ppp_mp_init( isdn_net_local * lp, ippp_bundle * add_to ) | |||
| 1571 | if ((lp->netdev->pb = isdn_ppp_mp_bundle_alloc()) == NULL) | 1569 | if ((lp->netdev->pb = isdn_ppp_mp_bundle_alloc()) == NULL) |
| 1572 | return -ENOMEM; | 1570 | return -ENOMEM; |
| 1573 | lp->next = lp->last = lp; /* nobody else in a queue */ | 1571 | lp->next = lp->last = lp; /* nobody else in a queue */ |
| 1574 | skb_queue_head_init(&lp->netdev->pb->frags); | 1572 | lp->netdev->pb->frags = NULL; |
| 1575 | lp->netdev->pb->frames = 0; | 1573 | lp->netdev->pb->frames = 0; |
| 1576 | lp->netdev->pb->seq = UINT_MAX; | 1574 | lp->netdev->pb->seq = UINT_MAX; |
| 1577 | } | 1575 | } |
| @@ -1583,29 +1581,28 @@ static int isdn_ppp_mp_init( isdn_net_local * lp, ippp_bundle * add_to ) | |||
| 1583 | 1581 | ||
| 1584 | static u32 isdn_ppp_mp_get_seq( int short_seq, | 1582 | static u32 isdn_ppp_mp_get_seq( int short_seq, |
| 1585 | struct sk_buff * skb, u32 last_seq ); | 1583 | struct sk_buff * skb, u32 last_seq ); |
| 1586 | static void isdn_ppp_mp_discard(ippp_bundle *mp, struct sk_buff *from, | 1584 | static struct sk_buff * isdn_ppp_mp_discard( ippp_bundle * mp, |
| 1587 | struct sk_buff *to); | 1585 | struct sk_buff * from, struct sk_buff * to ); |
| 1588 | static void isdn_ppp_mp_reassembly(isdn_net_dev *net_dev, isdn_net_local *lp, | 1586 | static void isdn_ppp_mp_reassembly( isdn_net_dev * net_dev, isdn_net_local * lp, |
| 1589 | struct sk_buff *from, struct sk_buff *to, | 1587 | struct sk_buff * from, struct sk_buff * to ); |
| 1590 | u32 lastseq); | 1588 | static void isdn_ppp_mp_free_skb( ippp_bundle * mp, struct sk_buff * skb ); |
| 1591 | static void isdn_ppp_mp_free_skb(ippp_bundle *mp, struct sk_buff *skb); | ||
| 1592 | static void isdn_ppp_mp_print_recv_pkt( int slot, struct sk_buff * skb ); | 1589 | static void isdn_ppp_mp_print_recv_pkt( int slot, struct sk_buff * skb ); |
| 1593 | 1590 | ||
| 1594 | static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, | 1591 | static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, |
| 1595 | struct sk_buff *skb) | 1592 | struct sk_buff *skb) |
| 1596 | { | 1593 | { |
| 1597 | struct sk_buff *newfrag, *frag, *start, *nextf; | ||
| 1598 | u32 newseq, minseq, thisseq; | ||
| 1599 | isdn_mppp_stats *stats; | ||
| 1600 | struct ippp_struct *is; | 1594 | struct ippp_struct *is; |
| 1595 | isdn_net_local * lpq; | ||
| 1596 | ippp_bundle * mp; | ||
| 1597 | isdn_mppp_stats * stats; | ||
| 1598 | struct sk_buff * newfrag, * frag, * start, *nextf; | ||
| 1599 | u32 newseq, minseq, thisseq; | ||
| 1601 | unsigned long flags; | 1600 | unsigned long flags; |
| 1602 | isdn_net_local *lpq; | ||
| 1603 | ippp_bundle *mp; | ||
| 1604 | int slot; | 1601 | int slot; |
| 1605 | 1602 | ||
| 1606 | spin_lock_irqsave(&net_dev->pb->lock, flags); | 1603 | spin_lock_irqsave(&net_dev->pb->lock, flags); |
| 1607 | mp = net_dev->pb; | 1604 | mp = net_dev->pb; |
| 1608 | stats = &mp->stats; | 1605 | stats = &mp->stats; |
| 1609 | slot = lp->ppp_slot; | 1606 | slot = lp->ppp_slot; |
| 1610 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { | 1607 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { |
| 1611 | printk(KERN_ERR "%s: lp->ppp_slot(%d)\n", | 1608 | printk(KERN_ERR "%s: lp->ppp_slot(%d)\n", |
| @@ -1616,19 +1613,20 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, | |||
| 1616 | return; | 1613 | return; |
| 1617 | } | 1614 | } |
| 1618 | is = ippp_table[slot]; | 1615 | is = ippp_table[slot]; |
| 1619 | if (++mp->frames > stats->max_queue_len) | 1616 | if( ++mp->frames > stats->max_queue_len ) |
| 1620 | stats->max_queue_len = mp->frames; | 1617 | stats->max_queue_len = mp->frames; |
| 1621 | 1618 | ||
| 1622 | if (is->debug & 0x8) | 1619 | if (is->debug & 0x8) |
| 1623 | isdn_ppp_mp_print_recv_pkt(lp->ppp_slot, skb); | 1620 | isdn_ppp_mp_print_recv_pkt(lp->ppp_slot, skb); |
| 1624 | 1621 | ||
| 1625 | newseq = isdn_ppp_mp_get_seq(is->mpppcfg & SC_IN_SHORT_SEQ, | 1622 | newseq = isdn_ppp_mp_get_seq(is->mpppcfg & SC_IN_SHORT_SEQ, |
| 1626 | skb, is->last_link_seqno); | 1623 | skb, is->last_link_seqno); |
| 1624 | |||
| 1627 | 1625 | ||
| 1628 | /* if this packet seq # is less than last already processed one, | 1626 | /* if this packet seq # is less than last already processed one, |
| 1629 | * toss it right away, but check for sequence start case first | 1627 | * toss it right away, but check for sequence start case first |
| 1630 | */ | 1628 | */ |
| 1631 | if (mp->seq > MP_LONGSEQ_MAX && (newseq & MP_LONGSEQ_MAXBIT)) { | 1629 | if( mp->seq > MP_LONGSEQ_MAX && (newseq & MP_LONGSEQ_MAXBIT) ) { |
| 1632 | mp->seq = newseq; /* the first packet: required for | 1630 | mp->seq = newseq; /* the first packet: required for |
| 1633 | * rfc1990 non-compliant clients -- | 1631 | * rfc1990 non-compliant clients -- |
| 1634 | * prevents constant packet toss */ | 1632 | * prevents constant packet toss */ |
| @@ -1638,7 +1636,7 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, | |||
| 1638 | spin_unlock_irqrestore(&mp->lock, flags); | 1636 | spin_unlock_irqrestore(&mp->lock, flags); |
| 1639 | return; | 1637 | return; |
| 1640 | } | 1638 | } |
| 1641 | 1639 | ||
| 1642 | /* find the minimum received sequence number over all links */ | 1640 | /* find the minimum received sequence number over all links */ |
| 1643 | is->last_link_seqno = minseq = newseq; | 1641 | is->last_link_seqno = minseq = newseq; |
| 1644 | for (lpq = net_dev->queue;;) { | 1642 | for (lpq = net_dev->queue;;) { |
| @@ -1659,31 +1657,22 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, | |||
| 1659 | * packets */ | 1657 | * packets */ |
| 1660 | newfrag = skb; | 1658 | newfrag = skb; |
| 1661 | 1659 | ||
| 1662 | /* Insert new fragment into the proper sequence slot. */ | 1660 | /* if this new fragment is before the first one, then enqueue it now. */ |
| 1663 | skb_queue_walk(&mp->frags, frag) { | 1661 | if ((frag = mp->frags) == NULL || MP_LT(newseq, MP_SEQ(frag))) { |
| 1664 | if (MP_SEQ(frag) == newseq) { | 1662 | newfrag->next = frag; |
| 1665 | isdn_ppp_mp_free_skb(mp, newfrag); | 1663 | mp->frags = frag = newfrag; |
| 1666 | newfrag = NULL; | 1664 | newfrag = NULL; |
| 1667 | break; | 1665 | } |
| 1668 | } | ||
| 1669 | if (MP_LT(newseq, MP_SEQ(frag))) { | ||
| 1670 | __skb_queue_before(&mp->frags, frag, newfrag); | ||
| 1671 | newfrag = NULL; | ||
| 1672 | break; | ||
| 1673 | } | ||
| 1674 | } | ||
| 1675 | if (newfrag) | ||
| 1676 | __skb_queue_tail(&mp->frags, newfrag); | ||
| 1677 | 1666 | ||
| 1678 | frag = skb_peek(&mp->frags); | 1667 | start = MP_FLAGS(frag) & MP_BEGIN_FRAG && |
| 1679 | start = ((MP_FLAGS(frag) & MP_BEGIN_FRAG) && | 1668 | MP_SEQ(frag) == mp->seq ? frag : NULL; |
| 1680 | (MP_SEQ(frag) == mp->seq)) ? frag : NULL; | ||
| 1681 | if (!start) | ||
| 1682 | goto check_overflow; | ||
| 1683 | 1669 | ||
| 1684 | /* main fragment traversing loop | 1670 | /* |
| 1671 | * main fragment traversing loop | ||
| 1685 | * | 1672 | * |
| 1686 | * try to accomplish several tasks: | 1673 | * try to accomplish several tasks: |
| 1674 | * - insert new fragment into the proper sequence slot (once that's done | ||
| 1675 | * newfrag will be set to NULL) | ||
| 1687 | * - reassemble any complete fragment sequence (non-null 'start' | 1676 | * - reassemble any complete fragment sequence (non-null 'start' |
| 1688 | * indicates there is a continguous sequence present) | 1677 | * indicates there is a continguous sequence present) |
| 1689 | * - discard any incomplete sequences that are below minseq -- due | 1678 | * - discard any incomplete sequences that are below minseq -- due |
| @@ -1692,46 +1681,71 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, | |||
| 1692 | * come to complete such sequence and it should be discarded | 1681 | * come to complete such sequence and it should be discarded |
| 1693 | * | 1682 | * |
| 1694 | * loop completes when we accomplished the following tasks: | 1683 | * loop completes when we accomplished the following tasks: |
| 1684 | * - new fragment is inserted in the proper sequence ('newfrag' is | ||
| 1685 | * set to NULL) | ||
| 1695 | * - we hit a gap in the sequence, so no reassembly/processing is | 1686 | * - we hit a gap in the sequence, so no reassembly/processing is |
| 1696 | * possible ('start' would be set to NULL) | 1687 | * possible ('start' would be set to NULL) |
| 1697 | * | 1688 | * |
| 1698 | * algorithm for this code is derived from code in the book | 1689 | * algorithm for this code is derived from code in the book |
| 1699 | * 'PPP Design And Debugging' by James Carlson (Addison-Wesley) | 1690 | * 'PPP Design And Debugging' by James Carlson (Addison-Wesley) |
| 1700 | */ | 1691 | */ |
| 1701 | skb_queue_walk_safe(&mp->frags, frag, nextf) { | 1692 | while (start != NULL || newfrag != NULL) { |
| 1702 | thisseq = MP_SEQ(frag); | 1693 | |
| 1703 | 1694 | thisseq = MP_SEQ(frag); | |
| 1704 | /* check for misplaced start */ | 1695 | nextf = frag->next; |
| 1705 | if (start != frag && (MP_FLAGS(frag) & MP_BEGIN_FRAG)) { | 1696 | |
| 1706 | printk(KERN_WARNING"isdn_mppp(seq %d): new " | 1697 | /* drop any duplicate fragments */ |
| 1707 | "BEGIN flag with no prior END", thisseq); | 1698 | if (newfrag != NULL && thisseq == newseq) { |
| 1708 | stats->seqerrs++; | 1699 | isdn_ppp_mp_free_skb(mp, newfrag); |
| 1709 | stats->frame_drops++; | 1700 | newfrag = NULL; |
| 1710 | isdn_ppp_mp_discard(mp, start, frag); | 1701 | } |
| 1711 | start = frag; | 1702 | |
| 1712 | } else if (MP_LE(thisseq, minseq)) { | 1703 | /* insert new fragment before next element if possible. */ |
| 1713 | if (MP_FLAGS(frag) & MP_BEGIN_FRAG) | 1704 | if (newfrag != NULL && (nextf == NULL || |
| 1705 | MP_LT(newseq, MP_SEQ(nextf)))) { | ||
| 1706 | newfrag->next = nextf; | ||
| 1707 | frag->next = nextf = newfrag; | ||
| 1708 | newfrag = NULL; | ||
| 1709 | } | ||
| 1710 | |||
| 1711 | if (start != NULL) { | ||
| 1712 | /* check for misplaced start */ | ||
| 1713 | if (start != frag && (MP_FLAGS(frag) & MP_BEGIN_FRAG)) { | ||
| 1714 | printk(KERN_WARNING"isdn_mppp(seq %d): new " | ||
| 1715 | "BEGIN flag with no prior END", thisseq); | ||
| 1716 | stats->seqerrs++; | ||
| 1717 | stats->frame_drops++; | ||
| 1718 | start = isdn_ppp_mp_discard(mp, start,frag); | ||
| 1719 | nextf = frag->next; | ||
| 1720 | } | ||
| 1721 | } else if (MP_LE(thisseq, minseq)) { | ||
| 1722 | if (MP_FLAGS(frag) & MP_BEGIN_FRAG) | ||
| 1714 | start = frag; | 1723 | start = frag; |
| 1715 | else { | 1724 | else { |
| 1716 | if (MP_FLAGS(frag) & MP_END_FRAG) | 1725 | if (MP_FLAGS(frag) & MP_END_FRAG) |
| 1717 | stats->frame_drops++; | 1726 | stats->frame_drops++; |
| 1718 | __skb_unlink(skb, &mp->frags); | 1727 | if( mp->frags == frag ) |
| 1728 | mp->frags = nextf; | ||
| 1719 | isdn_ppp_mp_free_skb(mp, frag); | 1729 | isdn_ppp_mp_free_skb(mp, frag); |
| 1730 | frag = nextf; | ||
| 1720 | continue; | 1731 | continue; |
| 1721 | } | 1732 | } |
| 1722 | } | 1733 | } |
| 1723 | 1734 | ||
| 1724 | /* if we have end fragment, then we have full reassembly | 1735 | /* if start is non-null and we have end fragment, then |
| 1725 | * sequence -- reassemble and process packet now | 1736 | * we have full reassembly sequence -- reassemble |
| 1737 | * and process packet now | ||
| 1726 | */ | 1738 | */ |
| 1727 | if (MP_FLAGS(frag) & MP_END_FRAG) { | 1739 | if (start != NULL && (MP_FLAGS(frag) & MP_END_FRAG)) { |
| 1728 | minseq = mp->seq = (thisseq+1) & MP_LONGSEQ_MASK; | 1740 | minseq = mp->seq = (thisseq+1) & MP_LONGSEQ_MASK; |
| 1729 | /* Reassemble the packet then dispatch it */ | 1741 | /* Reassemble the packet then dispatch it */ |
| 1730 | isdn_ppp_mp_reassembly(net_dev, lp, start, frag, thisseq); | 1742 | isdn_ppp_mp_reassembly(net_dev, lp, start, nextf); |
| 1743 | |||
| 1744 | start = NULL; | ||
| 1745 | frag = NULL; | ||
| 1731 | 1746 | ||
| 1732 | start = NULL; | 1747 | mp->frags = nextf; |
| 1733 | frag = NULL; | 1748 | } |
| 1734 | } | ||
| 1735 | 1749 | ||
| 1736 | /* check if need to update start pointer: if we just | 1750 | /* check if need to update start pointer: if we just |
| 1737 | * reassembled the packet and sequence is contiguous | 1751 | * reassembled the packet and sequence is contiguous |
| @@ -1742,25 +1756,26 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, | |||
| 1742 | * below low watermark and set start to the next frag or | 1756 | * below low watermark and set start to the next frag or |
| 1743 | * clear start ptr. | 1757 | * clear start ptr. |
| 1744 | */ | 1758 | */ |
| 1745 | if (nextf != (struct sk_buff *)&mp->frags && | 1759 | if (nextf != NULL && |
| 1746 | ((thisseq+1) & MP_LONGSEQ_MASK) == MP_SEQ(nextf)) { | 1760 | ((thisseq+1) & MP_LONGSEQ_MASK) == MP_SEQ(nextf)) { |
| 1747 | /* if we just reassembled and the next one is here, | 1761 | /* if we just reassembled and the next one is here, |
| 1748 | * then start another reassembly. | 1762 | * then start another reassembly. */ |
| 1749 | */ | 1763 | |
| 1750 | if (frag == NULL) { | 1764 | if (frag == NULL) { |
| 1751 | if (MP_FLAGS(nextf) & MP_BEGIN_FRAG) | 1765 | if (MP_FLAGS(nextf) & MP_BEGIN_FRAG) |
| 1752 | start = nextf; | 1766 | start = nextf; |
| 1753 | else { | 1767 | else |
| 1754 | printk(KERN_WARNING"isdn_mppp(seq %d):" | 1768 | { |
| 1755 | " END flag with no following " | 1769 | printk(KERN_WARNING"isdn_mppp(seq %d):" |
| 1756 | "BEGIN", thisseq); | 1770 | " END flag with no following " |
| 1771 | "BEGIN", thisseq); | ||
| 1757 | stats->seqerrs++; | 1772 | stats->seqerrs++; |
| 1758 | } | 1773 | } |
| 1759 | } | 1774 | } |
| 1760 | } else { | 1775 | |
| 1761 | if (nextf != (struct sk_buff *)&mp->frags && | 1776 | } else { |
| 1762 | frag != NULL && | 1777 | if ( nextf != NULL && frag != NULL && |
| 1763 | MP_LT(thisseq, minseq)) { | 1778 | MP_LT(thisseq, minseq)) { |
| 1764 | /* we've got a break in the sequence | 1779 | /* we've got a break in the sequence |
| 1765 | * and we not at the end yet | 1780 | * and we not at the end yet |
| 1766 | * and we did not just reassembled | 1781 | * and we did not just reassembled |
| @@ -1769,39 +1784,41 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, | |||
| 1769 | * discard all the frames below low watermark | 1784 | * discard all the frames below low watermark |
| 1770 | * and start over */ | 1785 | * and start over */ |
| 1771 | stats->frame_drops++; | 1786 | stats->frame_drops++; |
| 1772 | isdn_ppp_mp_discard(mp, start, nextf); | 1787 | mp->frags = isdn_ppp_mp_discard(mp,start,nextf); |
| 1773 | } | 1788 | } |
| 1774 | /* break in the sequence, no reassembly */ | 1789 | /* break in the sequence, no reassembly */ |
| 1775 | start = NULL; | 1790 | start = NULL; |
| 1776 | } | 1791 | } |
| 1777 | if (!start) | 1792 | |
| 1778 | break; | 1793 | frag = nextf; |
| 1779 | } | 1794 | } /* while -- main loop */ |
| 1780 | 1795 | ||
| 1781 | check_overflow: | 1796 | if (mp->frags == NULL) |
| 1797 | mp->frags = frag; | ||
| 1798 | |||
| 1782 | /* rather straighforward way to deal with (not very) possible | 1799 | /* rather straighforward way to deal with (not very) possible |
| 1783 | * queue overflow | 1800 | * queue overflow */ |
| 1784 | */ | ||
| 1785 | if (mp->frames > MP_MAX_QUEUE_LEN) { | 1801 | if (mp->frames > MP_MAX_QUEUE_LEN) { |
| 1786 | stats->overflows++; | 1802 | stats->overflows++; |
| 1787 | skb_queue_walk_safe(&mp->frags, frag, nextf) { | 1803 | while (mp->frames > MP_MAX_QUEUE_LEN) { |
| 1788 | if (mp->frames <= MP_MAX_QUEUE_LEN) | 1804 | frag = mp->frags->next; |
| 1789 | break; | 1805 | isdn_ppp_mp_free_skb(mp, mp->frags); |
| 1790 | __skb_unlink(frag, &mp->frags); | 1806 | mp->frags = frag; |
| 1791 | isdn_ppp_mp_free_skb(mp, frag); | ||
| 1792 | } | 1807 | } |
| 1793 | } | 1808 | } |
| 1794 | spin_unlock_irqrestore(&mp->lock, flags); | 1809 | spin_unlock_irqrestore(&mp->lock, flags); |
| 1795 | } | 1810 | } |
| 1796 | 1811 | ||
| 1797 | static void isdn_ppp_mp_cleanup(isdn_net_local *lp) | 1812 | static void isdn_ppp_mp_cleanup( isdn_net_local * lp ) |
| 1798 | { | 1813 | { |
| 1799 | struct sk_buff *skb, *tmp; | 1814 | struct sk_buff * frag = lp->netdev->pb->frags; |
| 1800 | 1815 | struct sk_buff * nextfrag; | |
| 1801 | skb_queue_walk_safe(&lp->netdev->pb->frags, skb, tmp) { | 1816 | while( frag ) { |
| 1802 | __skb_unlink(skb, &lp->netdev->pb->frags); | 1817 | nextfrag = frag->next; |
| 1803 | isdn_ppp_mp_free_skb(lp->netdev->pb, skb); | 1818 | isdn_ppp_mp_free_skb(lp->netdev->pb, frag); |
| 1804 | } | 1819 | frag = nextfrag; |
| 1820 | } | ||
| 1821 | lp->netdev->pb->frags = NULL; | ||
| 1805 | } | 1822 | } |
| 1806 | 1823 | ||
| 1807 | static u32 isdn_ppp_mp_get_seq( int short_seq, | 1824 | static u32 isdn_ppp_mp_get_seq( int short_seq, |
| @@ -1838,115 +1855,72 @@ static u32 isdn_ppp_mp_get_seq( int short_seq, | |||
| 1838 | return seq; | 1855 | return seq; |
| 1839 | } | 1856 | } |
| 1840 | 1857 | ||
| 1841 | static void isdn_ppp_mp_discard(ippp_bundle *mp, struct sk_buff *from, | 1858 | struct sk_buff * isdn_ppp_mp_discard( ippp_bundle * mp, |
| 1842 | struct sk_buff *to) | 1859 | struct sk_buff * from, struct sk_buff * to ) |
| 1843 | { | 1860 | { |
| 1844 | if (from) { | 1861 | if( from ) |
| 1845 | struct sk_buff *skb, *tmp; | 1862 | while (from != to) { |
| 1846 | int freeing = 0; | 1863 | struct sk_buff * next = from->next; |
| 1847 | 1864 | isdn_ppp_mp_free_skb(mp, from); | |
| 1848 | skb_queue_walk_safe(&mp->frags, skb, tmp) { | 1865 | from = next; |
| 1849 | if (skb == to) | ||
| 1850 | break; | ||
| 1851 | if (skb == from) | ||
| 1852 | freeing = 1; | ||
| 1853 | if (!freeing) | ||
| 1854 | continue; | ||
| 1855 | __skb_unlink(skb, &mp->frags); | ||
| 1856 | isdn_ppp_mp_free_skb(mp, skb); | ||
| 1857 | } | 1866 | } |
| 1858 | } | 1867 | return from; |
| 1859 | } | ||
| 1860 | |||
| 1861 | static unsigned int calc_tot_len(struct sk_buff_head *queue, | ||
| 1862 | struct sk_buff *from, struct sk_buff *to) | ||
| 1863 | { | ||
| 1864 | unsigned int tot_len = 0; | ||
| 1865 | struct sk_buff *skb; | ||
| 1866 | int found_start = 0; | ||
| 1867 | |||
| 1868 | skb_queue_walk(queue, skb) { | ||
| 1869 | if (skb == from) | ||
| 1870 | found_start = 1; | ||
| 1871 | if (!found_start) | ||
| 1872 | continue; | ||
| 1873 | tot_len += skb->len - MP_HEADER_LEN; | ||
| 1874 | if (skb == to) | ||
| 1875 | break; | ||
| 1876 | } | ||
| 1877 | return tot_len; | ||
| 1878 | } | 1868 | } |
| 1879 | 1869 | ||
| 1880 | /* Reassemble packet using fragments in the reassembly queue from | 1870 | void isdn_ppp_mp_reassembly( isdn_net_dev * net_dev, isdn_net_local * lp, |
| 1881 | * 'from' until 'to', inclusive. | 1871 | struct sk_buff * from, struct sk_buff * to ) |
| 1882 | */ | ||
| 1883 | static void isdn_ppp_mp_reassembly(isdn_net_dev *net_dev, isdn_net_local *lp, | ||
| 1884 | struct sk_buff *from, struct sk_buff *to, | ||
| 1885 | u32 lastseq) | ||
| 1886 | { | 1872 | { |
| 1887 | ippp_bundle *mp = net_dev->pb; | 1873 | ippp_bundle * mp = net_dev->pb; |
| 1888 | unsigned int tot_len; | ||
| 1889 | struct sk_buff *skb; | ||
| 1890 | int proto; | 1874 | int proto; |
| 1875 | struct sk_buff * skb; | ||
| 1876 | unsigned int tot_len; | ||
| 1891 | 1877 | ||
| 1892 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { | 1878 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { |
| 1893 | printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", | 1879 | printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", |
| 1894 | __func__, lp->ppp_slot); | 1880 | __func__, lp->ppp_slot); |
| 1895 | return; | 1881 | return; |
| 1896 | } | 1882 | } |
| 1897 | 1883 | if( MP_FLAGS(from) == (MP_BEGIN_FRAG | MP_END_FRAG) ) { | |
| 1898 | tot_len = calc_tot_len(&mp->frags, from, to); | 1884 | if( ippp_table[lp->ppp_slot]->debug & 0x40 ) |
| 1899 | |||
| 1900 | if (MP_FLAGS(from) == (MP_BEGIN_FRAG | MP_END_FRAG)) { | ||
| 1901 | if (ippp_table[lp->ppp_slot]->debug & 0x40) | ||
| 1902 | printk(KERN_DEBUG "isdn_mppp: reassembly: frame %d, " | 1885 | printk(KERN_DEBUG "isdn_mppp: reassembly: frame %d, " |
| 1903 | "len %d\n", MP_SEQ(from), from->len); | 1886 | "len %d\n", MP_SEQ(from), from->len ); |
| 1904 | skb = from; | 1887 | skb = from; |
| 1905 | skb_pull(skb, MP_HEADER_LEN); | 1888 | skb_pull(skb, MP_HEADER_LEN); |
| 1906 | __skb_unlink(skb, &mp->frags); | ||
| 1907 | mp->frames--; | 1889 | mp->frames--; |
| 1908 | } else { | 1890 | } else { |
| 1909 | struct sk_buff *walk, *tmp; | 1891 | struct sk_buff * frag; |
| 1910 | int found_start = 0; | 1892 | int n; |
| 1911 | 1893 | ||
| 1912 | if (ippp_table[lp->ppp_slot]->debug & 0x40) | 1894 | for(tot_len=n=0, frag=from; frag != to; frag=frag->next, n++) |
| 1913 | printk(KERN_DEBUG"isdn_mppp: reassembling frames %d " | 1895 | tot_len += frag->len - MP_HEADER_LEN; |
| 1914 | "to %d, len %d\n", MP_SEQ(from), lastseq, | ||
| 1915 | tot_len); | ||
| 1916 | 1896 | ||
| 1917 | skb = dev_alloc_skb(tot_len); | 1897 | if( ippp_table[lp->ppp_slot]->debug & 0x40 ) |
| 1918 | if (!skb) | 1898 | printk(KERN_DEBUG"isdn_mppp: reassembling frames %d " |
| 1899 | "to %d, len %d\n", MP_SEQ(from), | ||
| 1900 | (MP_SEQ(from)+n-1) & MP_LONGSEQ_MASK, tot_len ); | ||
| 1901 | if( (skb = dev_alloc_skb(tot_len)) == NULL ) { | ||
| 1919 | printk(KERN_ERR "isdn_mppp: cannot allocate sk buff " | 1902 | printk(KERN_ERR "isdn_mppp: cannot allocate sk buff " |
| 1920 | "of size %d\n", tot_len); | 1903 | "of size %d\n", tot_len); |
| 1921 | 1904 | isdn_ppp_mp_discard(mp, from, to); | |
| 1922 | found_start = 0; | 1905 | return; |
| 1923 | skb_queue_walk_safe(&mp->frags, walk, tmp) { | 1906 | } |
| 1924 | if (walk == from) | ||
| 1925 | found_start = 1; | ||
| 1926 | if (!found_start) | ||
| 1927 | continue; | ||
| 1928 | 1907 | ||
| 1929 | if (skb) { | 1908 | while( from != to ) { |
| 1930 | unsigned int len = walk->len - MP_HEADER_LEN; | 1909 | unsigned int len = from->len - MP_HEADER_LEN; |
| 1931 | skb_copy_from_linear_data_offset(walk, MP_HEADER_LEN, | ||
| 1932 | skb_put(skb, len), | ||
| 1933 | len); | ||
| 1934 | } | ||
| 1935 | __skb_unlink(walk, &mp->frags); | ||
| 1936 | isdn_ppp_mp_free_skb(mp, walk); | ||
| 1937 | 1910 | ||
| 1938 | if (walk == to) | 1911 | skb_copy_from_linear_data_offset(from, MP_HEADER_LEN, |
| 1939 | break; | 1912 | skb_put(skb,len), |
| 1913 | len); | ||
| 1914 | frag = from->next; | ||
| 1915 | isdn_ppp_mp_free_skb(mp, from); | ||
| 1916 | from = frag; | ||
| 1940 | } | 1917 | } |
| 1941 | } | 1918 | } |
| 1942 | if (!skb) | ||
| 1943 | return; | ||
| 1944 | |||
| 1945 | proto = isdn_ppp_strip_proto(skb); | 1919 | proto = isdn_ppp_strip_proto(skb); |
| 1946 | isdn_ppp_push_higher(net_dev, lp, skb, proto); | 1920 | isdn_ppp_push_higher(net_dev, lp, skb, proto); |
| 1947 | } | 1921 | } |
| 1948 | 1922 | ||
| 1949 | static void isdn_ppp_mp_free_skb(ippp_bundle *mp, struct sk_buff *skb) | 1923 | static void isdn_ppp_mp_free_skb(ippp_bundle * mp, struct sk_buff * skb) |
| 1950 | { | 1924 | { |
| 1951 | dev_kfree_skb(skb); | 1925 | dev_kfree_skb(skb); |
| 1952 | mp->frames--; | 1926 | mp->frames--; |
diff --git a/drivers/isdn/mISDN/stack.c b/drivers/isdn/mISDN/stack.c index 3e1532a180ff..0d05ec43012c 100644 --- a/drivers/isdn/mISDN/stack.c +++ b/drivers/isdn/mISDN/stack.c | |||
| @@ -364,7 +364,7 @@ add_layer2(struct mISDNchannel *ch, struct mISDNstack *st) | |||
| 364 | static int | 364 | static int |
| 365 | st_own_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg) | 365 | st_own_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg) |
| 366 | { | 366 | { |
| 367 | if (!ch->st || ch->st->layer1) | 367 | if (!ch->st || !ch->st->layer1) |
| 368 | return -EINVAL; | 368 | return -EINVAL; |
| 369 | return ch->st->layer1->ctrl(ch->st->layer1, cmd, arg); | 369 | return ch->st->layer1->ctrl(ch->st->layer1, cmd, arg); |
| 370 | } | 370 | } |
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 7467980b8cf9..e5225d28f392 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c | |||
| @@ -78,6 +78,8 @@ static int __devinit create_gpio_led(const struct gpio_led *template, | |||
| 78 | { | 78 | { |
| 79 | int ret, state; | 79 | int ret, state; |
| 80 | 80 | ||
| 81 | led_dat->gpio = -1; | ||
| 82 | |||
| 81 | /* skip leds that aren't available */ | 83 | /* skip leds that aren't available */ |
| 82 | if (!gpio_is_valid(template->gpio)) { | 84 | if (!gpio_is_valid(template->gpio)) { |
| 83 | printk(KERN_INFO "Skipping unavailable LED gpio %d (%s)\n", | 85 | printk(KERN_INFO "Skipping unavailable LED gpio %d (%s)\n", |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 10eb1fce975e..b182f86a19dd 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -944,6 +944,14 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev) | |||
| 944 | desc->raid_disk < mddev->raid_disks */) { | 944 | desc->raid_disk < mddev->raid_disks */) { |
| 945 | set_bit(In_sync, &rdev->flags); | 945 | set_bit(In_sync, &rdev->flags); |
| 946 | rdev->raid_disk = desc->raid_disk; | 946 | rdev->raid_disk = desc->raid_disk; |
| 947 | } else if (desc->state & (1<<MD_DISK_ACTIVE)) { | ||
| 948 | /* active but not in sync implies recovery up to | ||
| 949 | * reshape position. We don't know exactly where | ||
| 950 | * that is, so set to zero for now */ | ||
| 951 | if (mddev->minor_version >= 91) { | ||
| 952 | rdev->recovery_offset = 0; | ||
| 953 | rdev->raid_disk = desc->raid_disk; | ||
| 954 | } | ||
| 947 | } | 955 | } |
| 948 | if (desc->state & (1<<MD_DISK_WRITEMOSTLY)) | 956 | if (desc->state & (1<<MD_DISK_WRITEMOSTLY)) |
| 949 | set_bit(WriteMostly, &rdev->flags); | 957 | set_bit(WriteMostly, &rdev->flags); |
| @@ -1032,8 +1040,19 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
| 1032 | list_for_each_entry(rdev2, &mddev->disks, same_set) { | 1040 | list_for_each_entry(rdev2, &mddev->disks, same_set) { |
| 1033 | mdp_disk_t *d; | 1041 | mdp_disk_t *d; |
| 1034 | int desc_nr; | 1042 | int desc_nr; |
| 1035 | if (rdev2->raid_disk >= 0 && test_bit(In_sync, &rdev2->flags) | 1043 | int is_active = test_bit(In_sync, &rdev2->flags); |
| 1036 | && !test_bit(Faulty, &rdev2->flags)) | 1044 | |
| 1045 | if (rdev2->raid_disk >= 0 && | ||
| 1046 | sb->minor_version >= 91) | ||
| 1047 | /* we have nowhere to store the recovery_offset, | ||
| 1048 | * but if it is not below the reshape_position, | ||
| 1049 | * we can piggy-back on that. | ||
| 1050 | */ | ||
| 1051 | is_active = 1; | ||
| 1052 | if (rdev2->raid_disk < 0 || | ||
| 1053 | test_bit(Faulty, &rdev2->flags)) | ||
| 1054 | is_active = 0; | ||
| 1055 | if (is_active) | ||
| 1037 | desc_nr = rdev2->raid_disk; | 1056 | desc_nr = rdev2->raid_disk; |
| 1038 | else | 1057 | else |
| 1039 | desc_nr = next_spare++; | 1058 | desc_nr = next_spare++; |
| @@ -1043,16 +1062,16 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
| 1043 | d->number = rdev2->desc_nr; | 1062 | d->number = rdev2->desc_nr; |
| 1044 | d->major = MAJOR(rdev2->bdev->bd_dev); | 1063 | d->major = MAJOR(rdev2->bdev->bd_dev); |
| 1045 | d->minor = MINOR(rdev2->bdev->bd_dev); | 1064 | d->minor = MINOR(rdev2->bdev->bd_dev); |
| 1046 | if (rdev2->raid_disk >= 0 && test_bit(In_sync, &rdev2->flags) | 1065 | if (is_active) |
| 1047 | && !test_bit(Faulty, &rdev2->flags)) | ||
| 1048 | d->raid_disk = rdev2->raid_disk; | 1066 | d->raid_disk = rdev2->raid_disk; |
| 1049 | else | 1067 | else |
| 1050 | d->raid_disk = rdev2->desc_nr; /* compatibility */ | 1068 | d->raid_disk = rdev2->desc_nr; /* compatibility */ |
| 1051 | if (test_bit(Faulty, &rdev2->flags)) | 1069 | if (test_bit(Faulty, &rdev2->flags)) |
| 1052 | d->state = (1<<MD_DISK_FAULTY); | 1070 | d->state = (1<<MD_DISK_FAULTY); |
| 1053 | else if (test_bit(In_sync, &rdev2->flags)) { | 1071 | else if (is_active) { |
| 1054 | d->state = (1<<MD_DISK_ACTIVE); | 1072 | d->state = (1<<MD_DISK_ACTIVE); |
| 1055 | d->state |= (1<<MD_DISK_SYNC); | 1073 | if (test_bit(In_sync, &rdev2->flags)) |
| 1074 | d->state |= (1<<MD_DISK_SYNC); | ||
| 1056 | active++; | 1075 | active++; |
| 1057 | working++; | 1076 | working++; |
| 1058 | } else { | 1077 | } else { |
| @@ -1382,8 +1401,6 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
| 1382 | 1401 | ||
| 1383 | if (rdev->raid_disk >= 0 && | 1402 | if (rdev->raid_disk >= 0 && |
| 1384 | !test_bit(In_sync, &rdev->flags)) { | 1403 | !test_bit(In_sync, &rdev->flags)) { |
| 1385 | if (mddev->curr_resync_completed > rdev->recovery_offset) | ||
| 1386 | rdev->recovery_offset = mddev->curr_resync_completed; | ||
| 1387 | if (rdev->recovery_offset > 0) { | 1404 | if (rdev->recovery_offset > 0) { |
| 1388 | sb->feature_map |= | 1405 | sb->feature_map |= |
| 1389 | cpu_to_le32(MD_FEATURE_RECOVERY_OFFSET); | 1406 | cpu_to_le32(MD_FEATURE_RECOVERY_OFFSET); |
| @@ -1917,6 +1934,14 @@ static void sync_sbs(mddev_t * mddev, int nospares) | |||
| 1917 | */ | 1934 | */ |
| 1918 | mdk_rdev_t *rdev; | 1935 | mdk_rdev_t *rdev; |
| 1919 | 1936 | ||
| 1937 | /* First make sure individual recovery_offsets are correct */ | ||
| 1938 | list_for_each_entry(rdev, &mddev->disks, same_set) { | ||
| 1939 | if (rdev->raid_disk >= 0 && | ||
| 1940 | !test_bit(In_sync, &rdev->flags) && | ||
| 1941 | mddev->curr_resync_completed > rdev->recovery_offset) | ||
| 1942 | rdev->recovery_offset = mddev->curr_resync_completed; | ||
| 1943 | |||
| 1944 | } | ||
| 1920 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 1945 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
| 1921 | if (rdev->sb_events == mddev->events || | 1946 | if (rdev->sb_events == mddev->events || |
| 1922 | (nospares && | 1947 | (nospares && |
| @@ -6504,8 +6529,9 @@ void md_do_sync(mddev_t *mddev) | |||
| 6504 | skip: | 6529 | skip: |
| 6505 | mddev->curr_resync = 0; | 6530 | mddev->curr_resync = 0; |
| 6506 | mddev->curr_resync_completed = 0; | 6531 | mddev->curr_resync_completed = 0; |
| 6507 | mddev->resync_min = 0; | 6532 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) |
| 6508 | mddev->resync_max = MaxSector; | 6533 | /* We completed so max setting can be forgotten. */ |
| 6534 | mddev->resync_max = MaxSector; | ||
| 6509 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); | 6535 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); |
| 6510 | wake_up(&resync_wait); | 6536 | wake_up(&resync_wait); |
| 6511 | set_bit(MD_RECOVERY_DONE, &mddev->recovery); | 6537 | set_bit(MD_RECOVERY_DONE, &mddev->recovery); |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index a053423785c9..e07ce2e033a9 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
| @@ -1650,11 +1650,12 @@ static void raid1d(mddev_t *mddev) | |||
| 1650 | r1_bio->sector, | 1650 | r1_bio->sector, |
| 1651 | r1_bio->sectors); | 1651 | r1_bio->sectors); |
| 1652 | unfreeze_array(conf); | 1652 | unfreeze_array(conf); |
| 1653 | } | 1653 | } else |
| 1654 | md_error(mddev, | ||
| 1655 | conf->mirrors[r1_bio->read_disk].rdev); | ||
| 1654 | 1656 | ||
| 1655 | bio = r1_bio->bios[r1_bio->read_disk]; | 1657 | bio = r1_bio->bios[r1_bio->read_disk]; |
| 1656 | if ((disk=read_balance(conf, r1_bio)) == -1 || | 1658 | if ((disk=read_balance(conf, r1_bio)) == -1) { |
| 1657 | disk == r1_bio->read_disk) { | ||
| 1658 | printk(KERN_ALERT "raid1: %s: unrecoverable I/O" | 1659 | printk(KERN_ALERT "raid1: %s: unrecoverable I/O" |
| 1659 | " read error for block %llu\n", | 1660 | " read error for block %llu\n", |
| 1660 | bdevname(bio->bi_bdev,b), | 1661 | bdevname(bio->bi_bdev,b), |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 81abefc172d9..d29215d966da 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -4049,6 +4049,8 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
| 4049 | sector_nr = conf->reshape_progress; | 4049 | sector_nr = conf->reshape_progress; |
| 4050 | sector_div(sector_nr, new_data_disks); | 4050 | sector_div(sector_nr, new_data_disks); |
| 4051 | if (sector_nr) { | 4051 | if (sector_nr) { |
| 4052 | mddev->curr_resync_completed = sector_nr; | ||
| 4053 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); | ||
| 4052 | *skipped = 1; | 4054 | *skipped = 1; |
| 4053 | return sector_nr; | 4055 | return sector_nr; |
| 4054 | } | 4056 | } |
| @@ -4821,11 +4823,40 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) | |||
| 4821 | return ERR_PTR(-ENOMEM); | 4823 | return ERR_PTR(-ENOMEM); |
| 4822 | } | 4824 | } |
| 4823 | 4825 | ||
| 4826 | |||
| 4827 | static int only_parity(int raid_disk, int algo, int raid_disks, int max_degraded) | ||
| 4828 | { | ||
| 4829 | switch (algo) { | ||
| 4830 | case ALGORITHM_PARITY_0: | ||
| 4831 | if (raid_disk < max_degraded) | ||
| 4832 | return 1; | ||
| 4833 | break; | ||
| 4834 | case ALGORITHM_PARITY_N: | ||
| 4835 | if (raid_disk >= raid_disks - max_degraded) | ||
| 4836 | return 1; | ||
| 4837 | break; | ||
| 4838 | case ALGORITHM_PARITY_0_6: | ||
| 4839 | if (raid_disk == 0 || | ||
| 4840 | raid_disk == raid_disks - 1) | ||
| 4841 | return 1; | ||
| 4842 | break; | ||
| 4843 | case ALGORITHM_LEFT_ASYMMETRIC_6: | ||
| 4844 | case ALGORITHM_RIGHT_ASYMMETRIC_6: | ||
| 4845 | case ALGORITHM_LEFT_SYMMETRIC_6: | ||
| 4846 | case ALGORITHM_RIGHT_SYMMETRIC_6: | ||
| 4847 | if (raid_disk == raid_disks - 1) | ||
| 4848 | return 1; | ||
| 4849 | } | ||
| 4850 | return 0; | ||
| 4851 | } | ||
| 4852 | |||
| 4824 | static int run(mddev_t *mddev) | 4853 | static int run(mddev_t *mddev) |
| 4825 | { | 4854 | { |
| 4826 | raid5_conf_t *conf; | 4855 | raid5_conf_t *conf; |
| 4827 | int working_disks = 0, chunk_size; | 4856 | int working_disks = 0, chunk_size; |
| 4857 | int dirty_parity_disks = 0; | ||
| 4828 | mdk_rdev_t *rdev; | 4858 | mdk_rdev_t *rdev; |
| 4859 | sector_t reshape_offset = 0; | ||
| 4829 | 4860 | ||
| 4830 | if (mddev->recovery_cp != MaxSector) | 4861 | if (mddev->recovery_cp != MaxSector) |
| 4831 | printk(KERN_NOTICE "raid5: %s is not clean" | 4862 | printk(KERN_NOTICE "raid5: %s is not clean" |
| @@ -4859,6 +4890,7 @@ static int run(mddev_t *mddev) | |||
| 4859 | "on a stripe boundary\n"); | 4890 | "on a stripe boundary\n"); |
| 4860 | return -EINVAL; | 4891 | return -EINVAL; |
| 4861 | } | 4892 | } |
| 4893 | reshape_offset = here_new * mddev->new_chunk_sectors; | ||
| 4862 | /* here_new is the stripe we will write to */ | 4894 | /* here_new is the stripe we will write to */ |
| 4863 | here_old = mddev->reshape_position; | 4895 | here_old = mddev->reshape_position; |
| 4864 | sector_div(here_old, mddev->chunk_sectors * | 4896 | sector_div(here_old, mddev->chunk_sectors * |
| @@ -4914,10 +4946,51 @@ static int run(mddev_t *mddev) | |||
| 4914 | /* | 4946 | /* |
| 4915 | * 0 for a fully functional array, 1 or 2 for a degraded array. | 4947 | * 0 for a fully functional array, 1 or 2 for a degraded array. |
| 4916 | */ | 4948 | */ |
| 4917 | list_for_each_entry(rdev, &mddev->disks, same_set) | 4949 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
| 4918 | if (rdev->raid_disk >= 0 && | 4950 | if (rdev->raid_disk < 0) |
| 4919 | test_bit(In_sync, &rdev->flags)) | 4951 | continue; |
| 4952 | if (test_bit(In_sync, &rdev->flags)) | ||
| 4920 | working_disks++; | 4953 | working_disks++; |
| 4954 | /* This disc is not fully in-sync. However if it | ||
| 4955 | * just stored parity (beyond the recovery_offset), | ||
| 4956 | * when we don't need to be concerned about the | ||
| 4957 | * array being dirty. | ||
| 4958 | * When reshape goes 'backwards', we never have | ||
| 4959 | * partially completed devices, so we only need | ||
| 4960 | * to worry about reshape going forwards. | ||
| 4961 | */ | ||
| 4962 | /* Hack because v0.91 doesn't store recovery_offset properly. */ | ||
| 4963 | if (mddev->major_version == 0 && | ||
| 4964 | mddev->minor_version > 90) | ||
| 4965 | rdev->recovery_offset = reshape_offset; | ||
| 4966 | |||
| 4967 | printk("%d: w=%d pa=%d pr=%d m=%d a=%d r=%d op1=%d op2=%d\n", | ||
| 4968 | rdev->raid_disk, working_disks, conf->prev_algo, | ||
| 4969 | conf->previous_raid_disks, conf->max_degraded, | ||
| 4970 | conf->algorithm, conf->raid_disks, | ||
| 4971 | only_parity(rdev->raid_disk, | ||
| 4972 | conf->prev_algo, | ||
| 4973 | conf->previous_raid_disks, | ||
| 4974 | conf->max_degraded), | ||
| 4975 | only_parity(rdev->raid_disk, | ||
| 4976 | conf->algorithm, | ||
| 4977 | conf->raid_disks, | ||
| 4978 | conf->max_degraded)); | ||
| 4979 | if (rdev->recovery_offset < reshape_offset) { | ||
| 4980 | /* We need to check old and new layout */ | ||
| 4981 | if (!only_parity(rdev->raid_disk, | ||
| 4982 | conf->algorithm, | ||
| 4983 | conf->raid_disks, | ||
| 4984 | conf->max_degraded)) | ||
| 4985 | continue; | ||
| 4986 | } | ||
| 4987 | if (!only_parity(rdev->raid_disk, | ||
| 4988 | conf->prev_algo, | ||
| 4989 | conf->previous_raid_disks, | ||
| 4990 | conf->max_degraded)) | ||
| 4991 | continue; | ||
| 4992 | dirty_parity_disks++; | ||
| 4993 | } | ||
| 4921 | 4994 | ||
| 4922 | mddev->degraded = (max(conf->raid_disks, conf->previous_raid_disks) | 4995 | mddev->degraded = (max(conf->raid_disks, conf->previous_raid_disks) |
| 4923 | - working_disks); | 4996 | - working_disks); |
| @@ -4933,7 +5006,7 @@ static int run(mddev_t *mddev) | |||
| 4933 | mddev->dev_sectors &= ~(mddev->chunk_sectors - 1); | 5006 | mddev->dev_sectors &= ~(mddev->chunk_sectors - 1); |
| 4934 | mddev->resync_max_sectors = mddev->dev_sectors; | 5007 | mddev->resync_max_sectors = mddev->dev_sectors; |
| 4935 | 5008 | ||
| 4936 | if (mddev->degraded > 0 && | 5009 | if (mddev->degraded > dirty_parity_disks && |
| 4937 | mddev->recovery_cp != MaxSector) { | 5010 | mddev->recovery_cp != MaxSector) { |
| 4938 | if (mddev->ok_start_degraded) | 5011 | if (mddev->ok_start_degraded) |
| 4939 | printk(KERN_WARNING | 5012 | printk(KERN_WARNING |
| @@ -5359,9 +5432,11 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
| 5359 | !test_bit(Faulty, &rdev->flags)) { | 5432 | !test_bit(Faulty, &rdev->flags)) { |
| 5360 | if (raid5_add_disk(mddev, rdev) == 0) { | 5433 | if (raid5_add_disk(mddev, rdev) == 0) { |
| 5361 | char nm[20]; | 5434 | char nm[20]; |
| 5362 | set_bit(In_sync, &rdev->flags); | 5435 | if (rdev->raid_disk >= conf->previous_raid_disks) |
| 5436 | set_bit(In_sync, &rdev->flags); | ||
| 5437 | else | ||
| 5438 | rdev->recovery_offset = 0; | ||
| 5363 | added_devices++; | 5439 | added_devices++; |
| 5364 | rdev->recovery_offset = 0; | ||
| 5365 | sprintf(nm, "rd%d", rdev->raid_disk); | 5440 | sprintf(nm, "rd%d", rdev->raid_disk); |
| 5366 | if (sysfs_create_link(&mddev->kobj, | 5441 | if (sysfs_create_link(&mddev->kobj, |
| 5367 | &rdev->kobj, nm)) | 5442 | &rdev->kobj, nm)) |
diff --git a/drivers/media/common/ir-functions.c b/drivers/media/common/ir-functions.c index 655474b29e21..abd4791acb0e 100644 --- a/drivers/media/common/ir-functions.c +++ b/drivers/media/common/ir-functions.c | |||
| @@ -64,7 +64,7 @@ void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | |||
| 64 | 64 | ||
| 65 | ir->ir_type = ir_type; | 65 | ir->ir_type = ir_type; |
| 66 | 66 | ||
| 67 | memset(ir->ir_codes, sizeof(ir->ir_codes), 0); | 67 | memset(ir->ir_codes, 0, sizeof(ir->ir_codes)); |
| 68 | 68 | ||
| 69 | /* | 69 | /* |
| 70 | * FIXME: This is a temporary workaround to use the new IR tables | 70 | * FIXME: This is a temporary workaround to use the new IR tables |
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c index 64595112000d..3a50ce96fcb9 100644 --- a/drivers/media/common/tuners/tda18271-fe.c +++ b/drivers/media/common/tuners/tda18271-fe.c | |||
| @@ -616,13 +616,13 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) | |||
| 616 | case RF2: | 616 | case RF2: |
| 617 | map[i].rf_a1 = (prog_cal[RF2] - prog_tab[RF2] - | 617 | map[i].rf_a1 = (prog_cal[RF2] - prog_tab[RF2] - |
| 618 | prog_cal[RF1] + prog_tab[RF1]) / | 618 | prog_cal[RF1] + prog_tab[RF1]) / |
| 619 | ((rf_freq[RF2] - rf_freq[RF1]) / 1000); | 619 | (s32)((rf_freq[RF2] - rf_freq[RF1]) / 1000); |
| 620 | map[i].rf2 = rf_freq[RF2] / 1000; | 620 | map[i].rf2 = rf_freq[RF2] / 1000; |
| 621 | break; | 621 | break; |
| 622 | case RF3: | 622 | case RF3: |
| 623 | map[i].rf_a2 = (prog_cal[RF3] - prog_tab[RF3] - | 623 | map[i].rf_a2 = (prog_cal[RF3] - prog_tab[RF3] - |
| 624 | prog_cal[RF2] + prog_tab[RF2]) / | 624 | prog_cal[RF2] + prog_tab[RF2]) / |
| 625 | ((rf_freq[RF3] - rf_freq[RF2]) / 1000); | 625 | (s32)((rf_freq[RF3] - rf_freq[RF2]) / 1000); |
| 626 | map[i].rf_b2 = prog_cal[RF2] - prog_tab[RF2]; | 626 | map[i].rf_b2 = prog_cal[RF2] - prog_tab[RF2]; |
| 627 | map[i].rf3 = rf_freq[RF3] / 1000; | 627 | map[i].rf3 = rf_freq[RF3] / 1000; |
| 628 | break; | 628 | break; |
| @@ -1000,12 +1000,12 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe, | |||
| 1000 | struct tda18271_std_map_item *map; | 1000 | struct tda18271_std_map_item *map; |
| 1001 | char *mode; | 1001 | char *mode; |
| 1002 | int ret; | 1002 | int ret; |
| 1003 | u32 freq = params->frequency * 62500; | 1003 | u32 freq = params->frequency * 125 * |
| 1004 | ((params->mode == V4L2_TUNER_RADIO) ? 1 : 1000) / 2; | ||
| 1004 | 1005 | ||
| 1005 | priv->mode = TDA18271_ANALOG; | 1006 | priv->mode = TDA18271_ANALOG; |
| 1006 | 1007 | ||
| 1007 | if (params->mode == V4L2_TUNER_RADIO) { | 1008 | if (params->mode == V4L2_TUNER_RADIO) { |
| 1008 | freq = freq / 1000; | ||
| 1009 | map = &std_map->fm_radio; | 1009 | map = &std_map->fm_radio; |
| 1010 | mode = "fm"; | 1010 | mode = "fm"; |
| 1011 | } else if (params->std & V4L2_STD_MN) { | 1011 | } else if (params->std & V4L2_STD_MN) { |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index ddf639ed2fd8..98082416aa52 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
| 32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
| 33 | #include <linux/poll.h> | 33 | #include <linux/poll.h> |
| 34 | #include <linux/semaphore.h> | ||
| 34 | #include <linux/module.h> | 35 | #include <linux/module.h> |
| 35 | #include <linux/list.h> | 36 | #include <linux/list.h> |
| 36 | #include <linux/freezer.h> | 37 | #include <linux/freezer.h> |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index 9744b0692417..0e4b97fba384 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
| @@ -75,7 +75,7 @@ config DVB_USB_DIB0700 | |||
| 75 | select DVB_DIB3000MC if !DVB_FE_CUSTOMISE | 75 | select DVB_DIB3000MC if !DVB_FE_CUSTOMISE |
| 76 | select DVB_S5H1411 if !DVB_FE_CUSTOMISE | 76 | select DVB_S5H1411 if !DVB_FE_CUSTOMISE |
| 77 | select DVB_LGDT3305 if !DVB_FE_CUSTOMISE | 77 | select DVB_LGDT3305 if !DVB_FE_CUSTOMISE |
| 78 | select DVB_TUNER_DIB0070 | 78 | select DVB_TUNER_DIB0070 if !DVB_FE_CUSTOMISE |
| 79 | select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMISE | 79 | select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMISE |
| 80 | select MEDIA_TUNER_MT2266 if !MEDIA_TUNER_CUSTOMISE | 80 | select MEDIA_TUNER_MT2266 if !MEDIA_TUNER_CUSTOMISE |
| 81 | select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE | 81 | select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE |
diff --git a/drivers/media/dvb/dvb-usb/ce6230.c b/drivers/media/dvb/dvb-usb/ce6230.c index 0737c6377892..3df2045b7d2d 100644 --- a/drivers/media/dvb/dvb-usb/ce6230.c +++ b/drivers/media/dvb/dvb-usb/ce6230.c | |||
| @@ -105,7 +105,7 @@ static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
| 105 | int i = 0; | 105 | int i = 0; |
| 106 | struct req_t req; | 106 | struct req_t req; |
| 107 | int ret = 0; | 107 | int ret = 0; |
| 108 | memset(&req, 0, sizeof(&req)); | 108 | memset(&req, 0, sizeof(req)); |
| 109 | 109 | ||
| 110 | if (num > 2) | 110 | if (num > 2) |
| 111 | return -EINVAL; | 111 | return -EINVAL; |
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index f65591fb7cec..2a53dd096eef 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
| @@ -663,6 +663,14 @@ static struct zl10353_config cxusb_zl10353_xc3028_config = { | |||
| 663 | .parallel_ts = 1, | 663 | .parallel_ts = 1, |
| 664 | }; | 664 | }; |
| 665 | 665 | ||
| 666 | static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate = { | ||
| 667 | .demod_address = 0x0f, | ||
| 668 | .if2 = 45600, | ||
| 669 | .no_tuner = 1, | ||
| 670 | .parallel_ts = 1, | ||
| 671 | .disable_i2c_gate_ctrl = 1, | ||
| 672 | }; | ||
| 673 | |||
| 666 | static struct mt352_config cxusb_mt352_xc3028_config = { | 674 | static struct mt352_config cxusb_mt352_xc3028_config = { |
| 667 | .demod_address = 0x0f, | 675 | .demod_address = 0x0f, |
| 668 | .if2 = 4560, | 676 | .if2 = 4560, |
| @@ -894,7 +902,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) | |||
| 894 | cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); | 902 | cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); |
| 895 | 903 | ||
| 896 | if ((adap->fe = dvb_attach(zl10353_attach, | 904 | if ((adap->fe = dvb_attach(zl10353_attach, |
| 897 | &cxusb_zl10353_xc3028_config, | 905 | &cxusb_zl10353_xc3028_config_no_i2c_gate, |
| 898 | &adap->dev->i2c_adap)) == NULL) | 906 | &adap->dev->i2c_adap)) == NULL) |
| 899 | return -EIO; | 907 | return -EIO; |
| 900 | 908 | ||
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 0b2812aa30a4..6bd8951ea02b 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
| @@ -1925,7 +1925,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 1925 | { NULL }, | 1925 | { NULL }, |
| 1926 | }, | 1926 | }, |
| 1927 | { "Leadtek Winfast DTV Dongle (STK7700P based)", | 1927 | { "Leadtek Winfast DTV Dongle (STK7700P based)", |
| 1928 | { &dib0700_usb_id_table[8] }, | 1928 | { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] }, |
| 1929 | { NULL }, | 1929 | { NULL }, |
| 1930 | }, | 1930 | }, |
| 1931 | { "AVerMedia AVerTV DVB-T Express", | 1931 | { "AVerMedia AVerTV DVB-T Express", |
| @@ -2064,7 +2064,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2064 | }, | 2064 | }, |
| 2065 | }, | 2065 | }, |
| 2066 | 2066 | ||
| 2067 | .num_device_descs = 12, | 2067 | .num_device_descs = 11, |
| 2068 | .devices = { | 2068 | .devices = { |
| 2069 | { "DiBcom STK7070P reference design", | 2069 | { "DiBcom STK7070P reference design", |
| 2070 | { &dib0700_usb_id_table[15], NULL }, | 2070 | { &dib0700_usb_id_table[15], NULL }, |
| @@ -2098,11 +2098,6 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2098 | { &dib0700_usb_id_table[30], NULL }, | 2098 | { &dib0700_usb_id_table[30], NULL }, |
| 2099 | { NULL }, | 2099 | { NULL }, |
| 2100 | }, | 2100 | }, |
| 2101 | { "Terratec Cinergy T USB XXS/ T3", | ||
| 2102 | { &dib0700_usb_id_table[33], | ||
| 2103 | &dib0700_usb_id_table[52], NULL }, | ||
| 2104 | { NULL }, | ||
| 2105 | }, | ||
| 2106 | { "Elgato EyeTV DTT", | 2101 | { "Elgato EyeTV DTT", |
| 2107 | { &dib0700_usb_id_table[49], NULL }, | 2102 | { &dib0700_usb_id_table[49], NULL }, |
| 2108 | { NULL }, | 2103 | { NULL }, |
| @@ -2343,8 +2338,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2343 | { &dib0700_usb_id_table[59], NULL }, | 2338 | { &dib0700_usb_id_table[59], NULL }, |
| 2344 | { NULL }, | 2339 | { NULL }, |
| 2345 | }, | 2340 | }, |
| 2346 | { "Terratec Cinergy T USB XXS (HD)", | 2341 | { "Terratec Cinergy T USB XXS (HD)/ T3", |
| 2347 | { &dib0700_usb_id_table[34], &dib0700_usb_id_table[60] }, | 2342 | { &dib0700_usb_id_table[33], |
| 2343 | &dib0700_usb_id_table[52], | ||
| 2344 | &dib0700_usb_id_table[60], NULL}, | ||
| 2348 | { NULL }, | 2345 | { NULL }, |
| 2349 | }, | 2346 | }, |
| 2350 | }, | 2347 | }, |
diff --git a/drivers/media/dvb/firewire/firedtv-avc.c b/drivers/media/dvb/firewire/firedtv-avc.c index d1b67fe0f011..485d061319ab 100644 --- a/drivers/media/dvb/firewire/firedtv-avc.c +++ b/drivers/media/dvb/firewire/firedtv-avc.c | |||
| @@ -1050,28 +1050,28 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) | |||
| 1050 | c->operand[4] = 0; /* slot */ | 1050 | c->operand[4] = 0; /* slot */ |
| 1051 | c->operand[5] = SFE_VENDOR_TAG_CA_PMT; /* ca tag */ | 1051 | c->operand[5] = SFE_VENDOR_TAG_CA_PMT; /* ca tag */ |
| 1052 | c->operand[6] = 0; /* more/last */ | 1052 | c->operand[6] = 0; /* more/last */ |
| 1053 | /* c->operand[7] = XXXprogram_info_length + 17; */ /* length */ | 1053 | /* Use three bytes for length field in case length > 127 */ |
| 1054 | c->operand[8] = list_management; | 1054 | c->operand[10] = list_management; |
| 1055 | c->operand[9] = 0x01; /* pmt_cmd=OK_descramble */ | 1055 | c->operand[11] = 0x01; /* pmt_cmd=OK_descramble */ |
| 1056 | 1056 | ||
| 1057 | /* TS program map table */ | 1057 | /* TS program map table */ |
| 1058 | 1058 | ||
| 1059 | c->operand[10] = 0x02; /* Table id=2 */ | 1059 | c->operand[12] = 0x02; /* Table id=2 */ |
| 1060 | c->operand[11] = 0x80; /* Section syntax + length */ | 1060 | c->operand[13] = 0x80; /* Section syntax + length */ |
| 1061 | /* c->operand[12] = XXXprogram_info_length + 12; */ | 1061 | /* c->operand[14] = XXXprogram_info_length + 12; */ |
| 1062 | c->operand[13] = msg[1]; /* Program number */ | 1062 | c->operand[15] = msg[1]; /* Program number */ |
| 1063 | c->operand[14] = msg[2]; | 1063 | c->operand[16] = msg[2]; |
| 1064 | c->operand[15] = 0x01; /* Version number=0 + current/next=1 */ | 1064 | c->operand[17] = 0x01; /* Version number=0 + current/next=1 */ |
| 1065 | c->operand[16] = 0x00; /* Section number=0 */ | 1065 | c->operand[18] = 0x00; /* Section number=0 */ |
| 1066 | c->operand[17] = 0x00; /* Last section number=0 */ | 1066 | c->operand[19] = 0x00; /* Last section number=0 */ |
| 1067 | c->operand[18] = 0x1f; /* PCR_PID=1FFF */ | 1067 | c->operand[20] = 0x1f; /* PCR_PID=1FFF */ |
| 1068 | c->operand[19] = 0xff; | 1068 | c->operand[21] = 0xff; |
| 1069 | c->operand[20] = (program_info_length >> 8); /* Program info length */ | 1069 | c->operand[22] = (program_info_length >> 8); /* Program info length */ |
| 1070 | c->operand[21] = (program_info_length & 0xff); | 1070 | c->operand[23] = (program_info_length & 0xff); |
| 1071 | 1071 | ||
| 1072 | /* CA descriptors at programme level */ | 1072 | /* CA descriptors at programme level */ |
| 1073 | read_pos = 6; | 1073 | read_pos = 6; |
| 1074 | write_pos = 22; | 1074 | write_pos = 24; |
| 1075 | if (program_info_length > 0) { | 1075 | if (program_info_length > 0) { |
| 1076 | pmt_cmd_id = msg[read_pos++]; | 1076 | pmt_cmd_id = msg[read_pos++]; |
| 1077 | if (pmt_cmd_id != 1 && pmt_cmd_id != 4) | 1077 | if (pmt_cmd_id != 1 && pmt_cmd_id != 4) |
| @@ -1113,8 +1113,10 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) | |||
| 1113 | c->operand[write_pos++] = 0x00; | 1113 | c->operand[write_pos++] = 0x00; |
| 1114 | c->operand[write_pos++] = 0x00; | 1114 | c->operand[write_pos++] = 0x00; |
| 1115 | 1115 | ||
| 1116 | c->operand[7] = write_pos - 8; | 1116 | c->operand[7] = 0x82; |
| 1117 | c->operand[12] = write_pos - 13; | 1117 | c->operand[8] = (write_pos - 10) >> 8; |
| 1118 | c->operand[9] = (write_pos - 10) & 0xff; | ||
| 1119 | c->operand[14] = write_pos - 15; | ||
| 1118 | 1120 | ||
| 1119 | crc32_csum = crc32_be(0, &c->operand[10], c->operand[12] - 1); | 1121 | crc32_csum = crc32_be(0, &c->operand[10], c->operand[12] - 1); |
| 1120 | c->operand[write_pos - 4] = (crc32_csum >> 24) & 0xff; | 1122 | c->operand[write_pos - 4] = (crc32_csum >> 24) & 0xff; |
diff --git a/drivers/media/dvb/firewire/firedtv-fe.c b/drivers/media/dvb/firewire/firedtv-fe.c index 7ba43630a25d..e49cdc88b0c7 100644 --- a/drivers/media/dvb/firewire/firedtv-fe.c +++ b/drivers/media/dvb/firewire/firedtv-fe.c | |||
| @@ -141,18 +141,12 @@ static int fdtv_read_uncorrected_blocks(struct dvb_frontend *fe, u32 *ucblocks) | |||
| 141 | return -EOPNOTSUPP; | 141 | return -EOPNOTSUPP; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | #define ACCEPTED 0x9 | ||
| 145 | |||
| 146 | static int fdtv_set_frontend(struct dvb_frontend *fe, | 144 | static int fdtv_set_frontend(struct dvb_frontend *fe, |
| 147 | struct dvb_frontend_parameters *params) | 145 | struct dvb_frontend_parameters *params) |
| 148 | { | 146 | { |
| 149 | struct firedtv *fdtv = fe->sec_priv; | 147 | struct firedtv *fdtv = fe->sec_priv; |
| 150 | 148 | ||
| 151 | /* FIXME: avc_tuner_dsd never returns ACCEPTED. Check status? */ | 149 | return avc_tuner_dsd(fdtv, params); |
| 152 | if (avc_tuner_dsd(fdtv, params) != ACCEPTED) | ||
| 153 | return -EINVAL; | ||
| 154 | else | ||
| 155 | return 0; /* not sure of this... */ | ||
| 156 | } | 150 | } |
| 157 | 151 | ||
| 158 | static int fdtv_get_frontend(struct dvb_frontend *fe, | 152 | static int fdtv_get_frontend(struct dvb_frontend *fe, |
diff --git a/drivers/media/dvb/frontends/dib0070.h b/drivers/media/dvb/frontends/dib0070.h index 8a2e1e710adb..eec9e52ffa75 100644 --- a/drivers/media/dvb/frontends/dib0070.h +++ b/drivers/media/dvb/frontends/dib0070.h | |||
| @@ -51,6 +51,7 @@ struct dib0070_config { | |||
| 51 | #if defined(CONFIG_DVB_TUNER_DIB0070) || (defined(CONFIG_DVB_TUNER_DIB0070_MODULE) && defined(MODULE)) | 51 | #if defined(CONFIG_DVB_TUNER_DIB0070) || (defined(CONFIG_DVB_TUNER_DIB0070_MODULE) && defined(MODULE)) |
| 52 | extern struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg); | 52 | extern struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg); |
| 53 | extern u16 dib0070_wbd_offset(struct dvb_frontend *); | 53 | extern u16 dib0070_wbd_offset(struct dvb_frontend *); |
| 54 | extern void dib0070_ctrl_agc_filter(struct dvb_frontend *, u8 open); | ||
| 54 | #else | 55 | #else |
| 55 | static inline struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg) | 56 | static inline struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg) |
| 56 | { | 57 | { |
| @@ -63,7 +64,11 @@ static inline u16 dib0070_wbd_offset(struct dvb_frontend *fe) | |||
| 63 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | 64 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
| 64 | return -ENODEV; | 65 | return -ENODEV; |
| 65 | } | 66 | } |
| 67 | |||
| 68 | static inline void dib0070_ctrl_agc_filter(struct dvb_frontend *fe, u8 open) | ||
| 69 | { | ||
| 70 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
| 71 | } | ||
| 66 | #endif | 72 | #endif |
| 67 | extern void dib0070_ctrl_agc_filter(struct dvb_frontend *, u8 open); | ||
| 68 | 73 | ||
| 69 | #endif | 74 | #endif |
diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c index 55ef6eeb0769..0781f94e05d2 100644 --- a/drivers/media/dvb/frontends/dib7000p.c +++ b/drivers/media/dvb/frontends/dib7000p.c | |||
| @@ -1375,6 +1375,11 @@ struct dvb_frontend * dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, | |||
| 1375 | if (dib7000p_identify(st) != 0) | 1375 | if (dib7000p_identify(st) != 0) |
| 1376 | goto error; | 1376 | goto error; |
| 1377 | 1377 | ||
| 1378 | /* FIXME: make sure the dev.parent field is initialized, or else | ||
| 1379 | request_firmware() will hit an OOPS (this should be moved somewhere | ||
| 1380 | more common) */ | ||
| 1381 | st->i2c_master.gated_tuner_i2c_adap.dev.parent = i2c_adap->dev.parent; | ||
| 1382 | |||
| 1378 | dibx000_init_i2c_master(&st->i2c_master, DIB7000P, st->i2c_adap, st->i2c_addr); | 1383 | dibx000_init_i2c_master(&st->i2c_master, DIB7000P, st->i2c_adap, st->i2c_addr); |
| 1379 | 1384 | ||
| 1380 | dib7000p_demod_reset(st); | 1385 | dib7000p_demod_reset(st); |
diff --git a/drivers/media/dvb/pt1/pt1.c b/drivers/media/dvb/pt1/pt1.c index 81e623a90f09..1fd8306371e2 100644 --- a/drivers/media/dvb/pt1/pt1.c +++ b/drivers/media/dvb/pt1/pt1.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
| 28 | #include <linux/kthread.h> | 28 | #include <linux/kthread.h> |
| 29 | #include <linux/freezer.h> | 29 | #include <linux/freezer.h> |
| 30 | #include <linux/vmalloc.h> | ||
| 30 | 31 | ||
| 31 | #include "dvbdev.h" | 32 | #include "dvbdev.h" |
| 32 | #include "dvb_demux.h" | 33 | #include "dvb_demux.h" |
diff --git a/drivers/media/dvb/siano/Kconfig b/drivers/media/dvb/siano/Kconfig index 8c1aed77ea30..85a222c4eaa0 100644 --- a/drivers/media/dvb/siano/Kconfig +++ b/drivers/media/dvb/siano/Kconfig | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | config SMS_SIANO_MDTV | 5 | config SMS_SIANO_MDTV |
| 6 | tristate "Siano SMS1xxx based MDTV receiver" | 6 | tristate "Siano SMS1xxx based MDTV receiver" |
| 7 | depends on DVB_CORE && INPUT | 7 | depends on DVB_CORE && INPUT && HAS_DMA |
| 8 | ---help--- | 8 | ---help--- |
| 9 | Choose Y or M here if you have MDTV receiver with a Siano chipset. | 9 | Choose Y or M here if you have MDTV receiver with a Siano chipset. |
| 10 | 10 | ||
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index cb8a358b7310..8f88a586b0dd 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c | |||
| @@ -529,6 +529,12 @@ struct usb_device_id smsusb_id_table[] = { | |||
| 529 | .driver_info = SMS1XXX_BOARD_SIANO_NICE }, | 529 | .driver_info = SMS1XXX_BOARD_SIANO_NICE }, |
| 530 | { USB_DEVICE(0x187f, 0x0301), | 530 | { USB_DEVICE(0x187f, 0x0301), |
| 531 | .driver_info = SMS1XXX_BOARD_SIANO_VENICE }, | 531 | .driver_info = SMS1XXX_BOARD_SIANO_VENICE }, |
| 532 | { USB_DEVICE(0x2040, 0xb900), | ||
| 533 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | ||
| 534 | { USB_DEVICE(0x2040, 0xb910), | ||
| 535 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | ||
| 536 | { USB_DEVICE(0x2040, 0xc000), | ||
| 537 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | ||
| 532 | { } /* Terminating entry */ | 538 | { } /* Terminating entry */ |
| 533 | }; | 539 | }; |
| 534 | 540 | ||
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c index c3f579de6e71..c6cf11661868 100644 --- a/drivers/media/radio/radio-gemtek-pci.c +++ b/drivers/media/radio/radio-gemtek-pci.c | |||
| @@ -181,12 +181,10 @@ static void gemtek_pci_mute(struct gemtek_pci *card) | |||
| 181 | 181 | ||
| 182 | static void gemtek_pci_unmute(struct gemtek_pci *card) | 182 | static void gemtek_pci_unmute(struct gemtek_pci *card) |
| 183 | { | 183 | { |
| 184 | mutex_lock(&card->lock); | ||
| 185 | if (card->mute) { | 184 | if (card->mute) { |
| 186 | gemtek_pci_setfrequency(card, card->current_frequency); | 185 | gemtek_pci_setfrequency(card, card->current_frequency); |
| 187 | card->mute = false; | 186 | card->mute = false; |
| 188 | } | 187 | } |
| 189 | mutex_unlock(&card->lock); | ||
| 190 | } | 188 | } |
| 191 | 189 | ||
| 192 | static int gemtek_pci_getsignal(struct gemtek_pci *card) | 190 | static int gemtek_pci_getsignal(struct gemtek_pci *card) |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 939d1e512974..a6724019c66f 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
| @@ -1299,7 +1299,7 @@ set_tvnorm(struct bttv *btv, unsigned int norm) | |||
| 1299 | 1299 | ||
| 1300 | tvnorm = &bttv_tvnorms[norm]; | 1300 | tvnorm = &bttv_tvnorms[norm]; |
| 1301 | 1301 | ||
| 1302 | if (!memcmp(&bttv_tvnorms[btv->tvnorm].cropcap, &tvnorm->cropcap, | 1302 | if (memcmp(&bttv_tvnorms[btv->tvnorm].cropcap, &tvnorm->cropcap, |
| 1303 | sizeof (tvnorm->cropcap))) { | 1303 | sizeof (tvnorm->cropcap))) { |
| 1304 | bttv_crop_reset(&btv->crop[0], norm); | 1304 | bttv_crop_reset(&btv->crop[0], norm); |
| 1305 | btv->crop[1] = btv->crop[0]; /* current = default */ | 1305 | btv->crop[1] = btv->crop[0]; /* current = default */ |
| @@ -3800,11 +3800,34 @@ bttv_irq_next_video(struct bttv *btv, struct bttv_buffer_set *set) | |||
| 3800 | if (!V4L2_FIELD_HAS_BOTH(item->vb.field) && | 3800 | if (!V4L2_FIELD_HAS_BOTH(item->vb.field) && |
| 3801 | (item->vb.queue.next != &btv->capture)) { | 3801 | (item->vb.queue.next != &btv->capture)) { |
| 3802 | item = list_entry(item->vb.queue.next, struct bttv_buffer, vb.queue); | 3802 | item = list_entry(item->vb.queue.next, struct bttv_buffer, vb.queue); |
| 3803 | /* Mike Isely <isely@pobox.com> - Only check | ||
| 3804 | * and set up the bottom field in the logic | ||
| 3805 | * below. Don't ever do the top field. This | ||
| 3806 | * of course means that if we set up the | ||
| 3807 | * bottom field in the above code that we'll | ||
| 3808 | * actually skip a field. But that's OK. | ||
| 3809 | * Having processed only a single buffer this | ||
| 3810 | * time, then the next time around the first | ||
| 3811 | * available buffer should be for a top field. | ||
| 3812 | * That will then cause us here to set up a | ||
| 3813 | * top then a bottom field in the normal way. | ||
| 3814 | * The alternative to this understanding is | ||
| 3815 | * that we set up the second available buffer | ||
| 3816 | * as a top field, but that's out of order | ||
| 3817 | * since this driver always processes the top | ||
| 3818 | * field first - the effect will be the two | ||
| 3819 | * buffers being returned in the wrong order, | ||
| 3820 | * with the second buffer also being delayed | ||
| 3821 | * by one field time (owing to the fifo nature | ||
| 3822 | * of videobuf). Worse still, we'll be stuck | ||
| 3823 | * doing fields out of order now every time | ||
| 3824 | * until something else causes a field to be | ||
| 3825 | * dropped. By effectively forcing a field to | ||
| 3826 | * drop this way then we always get back into | ||
| 3827 | * sync within a single frame time. (Out of | ||
| 3828 | * order fields can screw up deinterlacing | ||
| 3829 | * algorithms.) */ | ||
| 3803 | if (!V4L2_FIELD_HAS_BOTH(item->vb.field)) { | 3830 | if (!V4L2_FIELD_HAS_BOTH(item->vb.field)) { |
| 3804 | if (NULL == set->top && | ||
| 3805 | V4L2_FIELD_TOP == item->vb.field) { | ||
| 3806 | set->top = item; | ||
| 3807 | } | ||
| 3808 | if (NULL == set->bottom && | 3831 | if (NULL == set->bottom && |
| 3809 | V4L2_FIELD_BOTTOM == item->vb.field) { | 3832 | V4L2_FIELD_BOTTOM == item->vb.field) { |
| 3810 | set->bottom = item; | 3833 | set->bottom = item; |
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index c015da813dda..d14cfb200ed0 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c | |||
| @@ -1426,7 +1426,6 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
| 1426 | struct vpif_display_config *config; | 1426 | struct vpif_display_config *config; |
| 1427 | int i, j = 0, k, q, m, err = 0; | 1427 | int i, j = 0, k, q, m, err = 0; |
| 1428 | struct i2c_adapter *i2c_adap; | 1428 | struct i2c_adapter *i2c_adap; |
| 1429 | struct vpif_config *config; | ||
| 1430 | struct common_obj *common; | 1429 | struct common_obj *common; |
| 1431 | struct channel_obj *ch; | 1430 | struct channel_obj *ch; |
| 1432 | struct video_device *vfd; | 1431 | struct video_device *vfd; |
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index 7bd8a70f0a0b..ac947aecb9c3 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c | |||
| @@ -383,6 +383,11 @@ static int snd_em28xx_hw_capture_free(struct snd_pcm_substream *substream) | |||
| 383 | 383 | ||
| 384 | static int snd_em28xx_prepare(struct snd_pcm_substream *substream) | 384 | static int snd_em28xx_prepare(struct snd_pcm_substream *substream) |
| 385 | { | 385 | { |
| 386 | struct em28xx *dev = snd_pcm_substream_chip(substream); | ||
| 387 | |||
| 388 | dev->adev.hwptr_done_capture = 0; | ||
| 389 | dev->adev.capture_transfer_done = 0; | ||
| 390 | |||
| 386 | return 0; | 391 | return 0; |
| 387 | } | 392 | } |
| 388 | 393 | ||
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index bdb249bd9d5d..c0fd5c6feeac 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
| @@ -1584,8 +1584,8 @@ struct em28xx_board em28xx_boards[] = { | |||
| 1584 | [EM2870_BOARD_REDDO_DVB_C_USB_BOX] = { | 1584 | [EM2870_BOARD_REDDO_DVB_C_USB_BOX] = { |
| 1585 | .name = "Reddo DVB-C USB TV Box", | 1585 | .name = "Reddo DVB-C USB TV Box", |
| 1586 | .tuner_type = TUNER_ABSENT, | 1586 | .tuner_type = TUNER_ABSENT, |
| 1587 | .tuner_gpio = reddo_dvb_c_usb_box, | ||
| 1587 | .has_dvb = 1, | 1588 | .has_dvb = 1, |
| 1588 | .dvb_gpio = reddo_dvb_c_usb_box, | ||
| 1589 | }, | 1589 | }, |
| 1590 | }; | 1590 | }; |
| 1591 | const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards); | 1591 | const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards); |
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c index 59400e858965..a27afeb6f39b 100644 --- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c +++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c | |||
| @@ -35,12 +35,25 @@ static | |||
| 35 | const | 35 | const |
| 36 | struct dmi_system_id s5k4aa_vflip_dmi_table[] = { | 36 | struct dmi_system_id s5k4aa_vflip_dmi_table[] = { |
| 37 | { | 37 | { |
| 38 | .ident = "BRUNEINIT", | ||
| 39 | .matches = { | ||
| 40 | DMI_MATCH(DMI_SYS_VENDOR, "BRUNENIT"), | ||
| 41 | DMI_MATCH(DMI_PRODUCT_NAME, "BRUNENIT"), | ||
| 42 | DMI_MATCH(DMI_BOARD_VERSION, "00030D0000000001") | ||
| 43 | } | ||
| 44 | }, { | ||
| 38 | .ident = "Fujitsu-Siemens Amilo Xa 2528", | 45 | .ident = "Fujitsu-Siemens Amilo Xa 2528", |
| 39 | .matches = { | 46 | .matches = { |
| 40 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | 47 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 41 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xa 2528") | 48 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xa 2528") |
| 42 | } | 49 | } |
| 43 | }, { | 50 | }, { |
| 51 | .ident = "Fujitsu-Siemens Amilo Xi 2528", | ||
| 52 | .matches = { | ||
| 53 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
| 54 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xi 2528") | ||
| 55 | } | ||
| 56 | }, { | ||
| 44 | .ident = "Fujitsu-Siemens Amilo Xi 2550", | 57 | .ident = "Fujitsu-Siemens Amilo Xi 2550", |
| 45 | .matches = { | 58 | .matches = { |
| 46 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | 59 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| @@ -57,6 +70,13 @@ static | |||
| 57 | .matches = { | 70 | .matches = { |
| 58 | DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), | 71 | DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), |
| 59 | DMI_MATCH(DMI_PRODUCT_NAME, "GX700"), | 72 | DMI_MATCH(DMI_PRODUCT_NAME, "GX700"), |
| 73 | DMI_MATCH(DMI_BIOS_DATE, "12/02/2008") | ||
| 74 | } | ||
| 75 | }, { | ||
| 76 | .ident = "MSI GX700", | ||
| 77 | .matches = { | ||
| 78 | DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), | ||
| 79 | DMI_MATCH(DMI_PRODUCT_NAME, "GX700"), | ||
| 60 | DMI_MATCH(DMI_BIOS_DATE, "07/26/2007") | 80 | DMI_MATCH(DMI_BIOS_DATE, "07/26/2007") |
| 61 | } | 81 | } |
| 62 | }, { | 82 | }, { |
diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c index 140c8f320e47..f8328b9efae5 100644 --- a/drivers/media/video/gspca/mr97310a.c +++ b/drivers/media/video/gspca/mr97310a.c | |||
| @@ -483,7 +483,7 @@ static int start_cif_cam(struct gspca_dev *gspca_dev) | |||
| 483 | data[3] = 0x2c; /* reg 2, H size/8 */ | 483 | data[3] = 0x2c; /* reg 2, H size/8 */ |
| 484 | data[4] = 0x48; /* reg 3, V size/4 */ | 484 | data[4] = 0x48; /* reg 3, V size/4 */ |
| 485 | data[6] = 0x06; /* reg 5, H start */ | 485 | data[6] = 0x06; /* reg 5, H start */ |
| 486 | data[8] = 0x06 + sd->sensor_type; /* reg 7, V start */ | 486 | data[8] = 0x06 - sd->sensor_type; /* reg 7, V start */ |
| 487 | break; | 487 | break; |
| 488 | } | 488 | } |
| 489 | err_code = mr_write(gspca_dev, 11); | 489 | err_code = mr_write(gspca_dev, 11); |
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index 2f6e135d94bc..a5c190e93799 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c | |||
| @@ -2919,7 +2919,7 @@ static void ov518_pkt_scan(struct gspca_dev *gspca_dev, | |||
| 2919 | /* A false positive here is likely, until OVT gives me | 2919 | /* A false positive here is likely, until OVT gives me |
| 2920 | * the definitive SOF/EOF format */ | 2920 | * the definitive SOF/EOF format */ |
| 2921 | if ((!(data[0] | data[1] | data[2] | data[3] | data[5])) && data[6]) { | 2921 | if ((!(data[0] | data[1] | data[2] | data[3] | data[5])) && data[6]) { |
| 2922 | gspca_frame_add(gspca_dev, LAST_PACKET, frame, data, 0); | 2922 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, data, 0); |
| 2923 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, 0); | 2923 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, 0); |
| 2924 | sd->packet_nr = 0; | 2924 | sd->packet_nr = 0; |
| 2925 | } | 2925 | } |
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.c b/drivers/media/video/gspca/stv06xx/stv06xx.c index 65489d6b0d89..bfae63f5584c 100644 --- a/drivers/media/video/gspca/stv06xx/stv06xx.c +++ b/drivers/media/video/gspca/stv06xx/stv06xx.c | |||
| @@ -394,7 +394,8 @@ frame_data: | |||
| 394 | PDEBUG(D_PACK, "End of frame detected"); | 394 | PDEBUG(D_PACK, "End of frame detected"); |
| 395 | 395 | ||
| 396 | /* Complete the last frame (if any) */ | 396 | /* Complete the last frame (if any) */ |
| 397 | gspca_frame_add(gspca_dev, LAST_PACKET, frame, data, 0); | 397 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, |
| 398 | frame, data, 0); | ||
| 398 | 399 | ||
| 399 | if (chunk_len) | 400 | if (chunk_len) |
| 400 | PDEBUG(D_ERR, "Chunk length is " | 401 | PDEBUG(D_ERR, "Chunk length is " |
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 5f37952c75cf..72802291e812 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
| 29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
| 30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
| 31 | #include <linux/sched.h> | ||
| 31 | #include <linux/time.h> | 32 | #include <linux/time.h> |
| 32 | #include <linux/version.h> | 33 | #include <linux/version.h> |
| 33 | #include <linux/videodev2.h> | 34 | #include <linux/videodev2.h> |
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index dff2e5e2d8c6..7db82bdf6f31 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
| 18 | #include <linux/vmalloc.h> | 18 | #include <linux/vmalloc.h> |
| 19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
| 20 | #include <linux/sched.h> | ||
| 20 | 21 | ||
| 21 | #include <media/v4l2-common.h> | 22 | #include <media/v4l2-common.h> |
| 22 | #include <media/v4l2-dev.h> | 23 | #include <media/v4l2-dev.h> |
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 6952e9602d5d..51b683c63b70 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
| 27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
| 28 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
| 29 | #include <linux/sched.h> | ||
| 29 | 30 | ||
| 30 | #include <media/v4l2-common.h> | 31 | #include <media/v4l2-common.h> |
| 31 | #include <media/v4l2-dev.h> | 32 | #include <media/v4l2-dev.h> |
| @@ -1432,7 +1433,9 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, | |||
| 1432 | icd->sense = &sense; | 1433 | icd->sense = &sense; |
| 1433 | 1434 | ||
| 1434 | cam_f.fmt.pix.pixelformat = cam_fmt->fourcc; | 1435 | cam_f.fmt.pix.pixelformat = cam_fmt->fourcc; |
| 1435 | ret = v4l2_subdev_call(sd, video, s_fmt, f); | 1436 | ret = v4l2_subdev_call(sd, video, s_fmt, &cam_f); |
| 1437 | cam_f.fmt.pix.pixelformat = pix->pixelformat; | ||
| 1438 | *pix = cam_f.fmt.pix; | ||
| 1436 | 1439 | ||
| 1437 | icd->sense = NULL; | 1440 | icd->sense = NULL; |
| 1438 | 1441 | ||
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 9e3262c0ba37..2c0bb06cab3b 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
| @@ -598,11 +598,6 @@ static int s2255_got_frame(struct s2255_dev *dev, int chn, int jpgsize) | |||
| 598 | buf = list_entry(dma_q->active.next, | 598 | buf = list_entry(dma_q->active.next, |
| 599 | struct s2255_buffer, vb.queue); | 599 | struct s2255_buffer, vb.queue); |
| 600 | 600 | ||
| 601 | if (!waitqueue_active(&buf->vb.done)) { | ||
| 602 | /* no one active */ | ||
| 603 | rc = -1; | ||
| 604 | goto unlock; | ||
| 605 | } | ||
| 606 | list_del(&buf->vb.queue); | 601 | list_del(&buf->vb.queue); |
| 607 | do_gettimeofday(&buf->vb.ts); | 602 | do_gettimeofday(&buf->vb.ts); |
| 608 | dprintk(100, "[%p/%d] wakeup\n", buf, buf->vb.i); | 603 | dprintk(100, "[%p/%d] wakeup\n", buf, buf->vb.i); |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 71145bff94fa..09013229d4aa 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
| @@ -3428,6 +3428,7 @@ struct saa7134_board saa7134_boards[] = { | |||
| 3428 | .tuner_config = 3, | 3428 | .tuner_config = 3, |
| 3429 | .mpeg = SAA7134_MPEG_DVB, | 3429 | .mpeg = SAA7134_MPEG_DVB, |
| 3430 | .ts_type = SAA7134_MPEG_TS_SERIAL, | 3430 | .ts_type = SAA7134_MPEG_TS_SERIAL, |
| 3431 | .ts_force_val = 1, | ||
| 3431 | .gpiomask = 0x0800100, /* GPIO 21 is an INPUT */ | 3432 | .gpiomask = 0x0800100, /* GPIO 21 is an INPUT */ |
| 3432 | .inputs = {{ | 3433 | .inputs = {{ |
| 3433 | .name = name_tv, | 3434 | .name = name_tv, |
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index 3fa652279ac0..03488ba4c99c 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c | |||
| @@ -262,11 +262,13 @@ int saa7134_ts_start(struct saa7134_dev *dev) | |||
| 262 | switch (saa7134_boards[dev->board].ts_type) { | 262 | switch (saa7134_boards[dev->board].ts_type) { |
| 263 | case SAA7134_MPEG_TS_PARALLEL: | 263 | case SAA7134_MPEG_TS_PARALLEL: |
| 264 | saa_writeb(SAA7134_TS_SERIAL0, 0x40); | 264 | saa_writeb(SAA7134_TS_SERIAL0, 0x40); |
| 265 | saa_writeb(SAA7134_TS_PARALLEL, 0xec); | 265 | saa_writeb(SAA7134_TS_PARALLEL, 0xec | |
| 266 | (saa7134_boards[dev->board].ts_force_val << 4)); | ||
| 266 | break; | 267 | break; |
| 267 | case SAA7134_MPEG_TS_SERIAL: | 268 | case SAA7134_MPEG_TS_SERIAL: |
| 268 | saa_writeb(SAA7134_TS_SERIAL0, 0xd8); | 269 | saa_writeb(SAA7134_TS_SERIAL0, 0xd8); |
| 269 | saa_writeb(SAA7134_TS_PARALLEL, 0x6c); | 270 | saa_writeb(SAA7134_TS_PARALLEL, 0x6c | |
| 271 | (saa7134_boards[dev->board].ts_force_val << 4)); | ||
| 270 | saa_writeb(SAA7134_TS_PARALLEL_SERIAL, 0xbc); | 272 | saa_writeb(SAA7134_TS_PARALLEL_SERIAL, 0xbc); |
| 271 | saa_writeb(SAA7134_TS_SERIAL1, 0x02); | 273 | saa_writeb(SAA7134_TS_SERIAL1, 0x02); |
| 272 | break; | 274 | break; |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 6ee3e9b7769e..f8697d46ff5f 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
| @@ -360,6 +360,7 @@ struct saa7134_board { | |||
| 360 | enum saa7134_mpeg_type mpeg; | 360 | enum saa7134_mpeg_type mpeg; |
| 361 | enum saa7134_mpeg_ts_type ts_type; | 361 | enum saa7134_mpeg_ts_type ts_type; |
| 362 | unsigned int vid_port_opts; | 362 | unsigned int vid_port_opts; |
| 363 | unsigned int ts_force_val:1; | ||
| 363 | }; | 364 | }; |
| 364 | 365 | ||
| 365 | #define card_has_radio(dev) (NULL != saa7134_boards[dev->board].radio.name) | 366 | #define card_has_radio(dev) (NULL != saa7134_boards[dev->board].radio.name) |
diff --git a/drivers/media/video/saa7164/saa7164-cmd.c b/drivers/media/video/saa7164/saa7164-cmd.c index c45966edc0cf..9c1d3ac43869 100644 --- a/drivers/media/video/saa7164/saa7164-cmd.c +++ b/drivers/media/video/saa7164/saa7164-cmd.c | |||
| @@ -347,7 +347,7 @@ int saa7164_cmd_send(struct saa7164_dev *dev, u8 id, tmComResCmd_t command, | |||
| 347 | 347 | ||
| 348 | /* Prepare some basic command/response structures */ | 348 | /* Prepare some basic command/response structures */ |
| 349 | memset(&command_t, 0, sizeof(command_t)); | 349 | memset(&command_t, 0, sizeof(command_t)); |
| 350 | memset(&response_t, 0, sizeof(&response_t)); | 350 | memset(&response_t, 0, sizeof(response_t)); |
| 351 | pcommand_t = &command_t; | 351 | pcommand_t = &command_t; |
| 352 | presponse_t = &response_t; | 352 | presponse_t = &response_t; |
| 353 | command_t.id = id; | 353 | command_t.id = id; |
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 65ac474c517a..9c8b7c7b89ee 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
| 32 | #include <linux/videodev2.h> | 32 | #include <linux/videodev2.h> |
| 33 | #include <linux/pm_runtime.h> | 33 | #include <linux/pm_runtime.h> |
| 34 | #include <linux/sched.h> | ||
| 34 | 35 | ||
| 35 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
| 36 | #include <media/v4l2-dev.h> | 37 | #include <media/v4l2-dev.h> |
| @@ -1173,8 +1174,8 @@ static int get_scales(struct soc_camera_device *icd, | |||
| 1173 | width_in = scale_up(cam->ceu_rect.width, *scale_h); | 1174 | width_in = scale_up(cam->ceu_rect.width, *scale_h); |
| 1174 | height_in = scale_up(cam->ceu_rect.height, *scale_v); | 1175 | height_in = scale_up(cam->ceu_rect.height, *scale_v); |
| 1175 | 1176 | ||
| 1176 | *scale_h = calc_generic_scale(cam->ceu_rect.width, icd->user_width); | 1177 | *scale_h = calc_generic_scale(width_in, icd->user_width); |
| 1177 | *scale_v = calc_generic_scale(cam->ceu_rect.height, icd->user_height); | 1178 | *scale_v = calc_generic_scale(height_in, icd->user_height); |
| 1178 | 1179 | ||
| 1179 | return 0; | 1180 | return 0; |
| 1180 | } | 1181 | } |
| @@ -1723,11 +1724,12 @@ static int __devinit sh_mobile_ceu_probe(struct platform_device *pdev) | |||
| 1723 | 1724 | ||
| 1724 | err = soc_camera_host_register(&pcdev->ici); | 1725 | err = soc_camera_host_register(&pcdev->ici); |
| 1725 | if (err) | 1726 | if (err) |
| 1726 | goto exit_free_irq; | 1727 | goto exit_free_clk; |
| 1727 | 1728 | ||
| 1728 | return 0; | 1729 | return 0; |
| 1729 | 1730 | ||
| 1730 | exit_free_irq: | 1731 | exit_free_clk: |
| 1732 | pm_runtime_disable(&pdev->dev); | ||
| 1731 | free_irq(pcdev->irq, pcdev); | 1733 | free_irq(pcdev->irq, pcdev); |
| 1732 | exit_release_mem: | 1734 | exit_release_mem: |
| 1733 | if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) | 1735 | if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) |
| @@ -1747,6 +1749,7 @@ static int __devexit sh_mobile_ceu_remove(struct platform_device *pdev) | |||
| 1747 | struct sh_mobile_ceu_dev, ici); | 1749 | struct sh_mobile_ceu_dev, ici); |
| 1748 | 1750 | ||
| 1749 | soc_camera_host_unregister(soc_host); | 1751 | soc_camera_host_unregister(soc_host); |
| 1752 | pm_runtime_disable(&pdev->dev); | ||
| 1750 | free_irq(pcdev->irq, pcdev); | 1753 | free_irq(pcdev->irq, pcdev); |
| 1751 | if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) | 1754 | if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) |
| 1752 | dma_release_declared_memory(&pdev->dev); | 1755 | dma_release_declared_memory(&pdev->dev); |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 59aa7a3694c2..95fdeb23c2c1 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
| @@ -1097,6 +1097,13 @@ static int default_s_crop(struct soc_camera_device *icd, struct v4l2_crop *a) | |||
| 1097 | return v4l2_subdev_call(sd, video, s_crop, a); | 1097 | return v4l2_subdev_call(sd, video, s_crop, a); |
| 1098 | } | 1098 | } |
| 1099 | 1099 | ||
| 1100 | static void soc_camera_device_init(struct device *dev, void *pdata) | ||
| 1101 | { | ||
| 1102 | dev->platform_data = pdata; | ||
| 1103 | dev->bus = &soc_camera_bus_type; | ||
| 1104 | dev->release = dummy_release; | ||
| 1105 | } | ||
| 1106 | |||
| 1100 | int soc_camera_host_register(struct soc_camera_host *ici) | 1107 | int soc_camera_host_register(struct soc_camera_host *ici) |
| 1101 | { | 1108 | { |
| 1102 | struct soc_camera_host *ix; | 1109 | struct soc_camera_host *ix; |
| @@ -1158,15 +1165,19 @@ void soc_camera_host_unregister(struct soc_camera_host *ici) | |||
| 1158 | 1165 | ||
| 1159 | list_for_each_entry(icd, &devices, list) { | 1166 | list_for_each_entry(icd, &devices, list) { |
| 1160 | if (icd->iface == ici->nr) { | 1167 | if (icd->iface == ici->nr) { |
| 1168 | void *pdata = icd->dev.platform_data; | ||
| 1161 | /* The bus->remove will be called */ | 1169 | /* The bus->remove will be called */ |
| 1162 | device_unregister(&icd->dev); | 1170 | device_unregister(&icd->dev); |
| 1163 | /* Not before device_unregister(), .remove | 1171 | /* |
| 1164 | * needs parent to call ici->ops->remove() */ | 1172 | * Not before device_unregister(), .remove |
| 1165 | icd->dev.parent = NULL; | 1173 | * needs parent to call ici->ops->remove(). |
| 1166 | 1174 | * If the host module is loaded again, device_register() | |
| 1167 | /* If the host module is loaded again, device_register() | 1175 | * would complain "already initialised," since 2.6.32 |
| 1168 | * would complain "already initialised" */ | 1176 | * this is also needed to prevent use-after-free of the |
| 1169 | memset(&icd->dev.kobj, 0, sizeof(icd->dev.kobj)); | 1177 | * device private data. |
| 1178 | */ | ||
| 1179 | memset(&icd->dev, 0, sizeof(icd->dev)); | ||
| 1180 | soc_camera_device_init(&icd->dev, pdata); | ||
| 1170 | } | 1181 | } |
| 1171 | } | 1182 | } |
| 1172 | 1183 | ||
| @@ -1198,10 +1209,7 @@ static int soc_camera_device_register(struct soc_camera_device *icd) | |||
| 1198 | * man, stay reasonable... */ | 1209 | * man, stay reasonable... */ |
| 1199 | return -ENOMEM; | 1210 | return -ENOMEM; |
| 1200 | 1211 | ||
| 1201 | icd->devnum = num; | 1212 | icd->devnum = num; |
| 1202 | icd->dev.bus = &soc_camera_bus_type; | ||
| 1203 | |||
| 1204 | icd->dev.release = dummy_release; | ||
| 1205 | icd->use_count = 0; | 1213 | icd->use_count = 0; |
| 1206 | icd->host_priv = NULL; | 1214 | icd->host_priv = NULL; |
| 1207 | mutex_init(&icd->video_lock); | 1215 | mutex_init(&icd->video_lock); |
| @@ -1309,12 +1317,13 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev) | |||
| 1309 | icd->iface = icl->bus_id; | 1317 | icd->iface = icl->bus_id; |
| 1310 | icd->pdev = &pdev->dev; | 1318 | icd->pdev = &pdev->dev; |
| 1311 | platform_set_drvdata(pdev, icd); | 1319 | platform_set_drvdata(pdev, icd); |
| 1312 | icd->dev.platform_data = icl; | ||
| 1313 | 1320 | ||
| 1314 | ret = soc_camera_device_register(icd); | 1321 | ret = soc_camera_device_register(icd); |
| 1315 | if (ret < 0) | 1322 | if (ret < 0) |
| 1316 | goto escdevreg; | 1323 | goto escdevreg; |
| 1317 | 1324 | ||
| 1325 | soc_camera_device_init(&icd->dev, icl); | ||
| 1326 | |||
| 1318 | icd->user_width = DEFAULT_WIDTH; | 1327 | icd->user_width = DEFAULT_WIDTH; |
| 1319 | icd->user_height = DEFAULT_HEIGHT; | 1328 | icd->user_height = DEFAULT_HEIGHT; |
| 1320 | 1329 | ||
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c index c3225a561748..1b89735e62fd 100644 --- a/drivers/media/video/uvc/uvc_ctrl.c +++ b/drivers/media/video/uvc/uvc_ctrl.c | |||
| @@ -348,7 +348,7 @@ static void uvc_ctrl_set_zoom(struct uvc_control_mapping *mapping, | |||
| 348 | __s32 value, __u8 *data) | 348 | __s32 value, __u8 *data) |
| 349 | { | 349 | { |
| 350 | data[0] = value == 0 ? 0 : (value > 0) ? 1 : 0xff; | 350 | data[0] = value == 0 ? 0 : (value > 0) ? 1 : 0xff; |
| 351 | data[2] = min(abs(value), 0xff); | 351 | data[2] = min((int)abs(value), 0xff); |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | static struct uvc_control_mapping uvc_ctrl_mappings[] = { | 354 | static struct uvc_control_mapping uvc_ctrl_mappings[] = { |
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index f960e8ea4f17..a6e41d12b221 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c | |||
| @@ -90,7 +90,8 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream, | |||
| 90 | ctrl->dwMaxVideoFrameSize = | 90 | ctrl->dwMaxVideoFrameSize = |
| 91 | frame->dwMaxVideoFrameBufferSize; | 91 | frame->dwMaxVideoFrameBufferSize; |
| 92 | 92 | ||
| 93 | if (stream->dev->quirks & UVC_QUIRK_FIX_BANDWIDTH && | 93 | if (!(format->flags & UVC_FMT_FLAG_COMPRESSED) && |
| 94 | stream->dev->quirks & UVC_QUIRK_FIX_BANDWIDTH && | ||
| 94 | stream->intf->num_altsetting > 1) { | 95 | stream->intf->num_altsetting > 1) { |
| 95 | u32 interval; | 96 | u32 interval; |
| 96 | u32 bandwidth; | 97 | u32 bandwidth; |
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c index 635ffc7b0391..c3065c4bcba9 100644 --- a/drivers/media/video/videobuf-dma-contig.c +++ b/drivers/media/video/videobuf-dma-contig.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
| 20 | #include <linux/pagemap.h> | 20 | #include <linux/pagemap.h> |
| 21 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
| 22 | #include <linux/sched.h> | ||
| 22 | #include <media/videobuf-dma-contig.h> | 23 | #include <media/videobuf-dma-contig.h> |
| 23 | 24 | ||
| 24 | struct videobuf_dma_contig_memory { | 25 | struct videobuf_dma_contig_memory { |
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 49b7885c2702..7f27576ca046 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | /* Current settings - values are 2*2^(reg_val/4) microamps. These are | 29 | /* Current settings - values are 2*2^(reg_val/4) microamps. These are |
| 30 | * exported since they are used by multiple drivers. | 30 | * exported since they are used by multiple drivers. |
| 31 | */ | 31 | */ |
| 32 | int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL] = { | 32 | int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL + 1] = { |
| 33 | 2, | 33 | 2, |
| 34 | 2, | 34 | 2, |
| 35 | 3, | 35 | 3, |
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index db39f4a52f53..2cb2736d65aa 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c | |||
| @@ -158,6 +158,7 @@ static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, | |||
| 158 | struct i2c_msg msg[2]; | 158 | struct i2c_msg msg[2]; |
| 159 | u8 msgbuf[2]; | 159 | u8 msgbuf[2]; |
| 160 | struct i2c_client *client; | 160 | struct i2c_client *client; |
| 161 | unsigned long timeout, read_time; | ||
| 161 | int status, i; | 162 | int status, i; |
| 162 | 163 | ||
| 163 | memset(msg, 0, sizeof(msg)); | 164 | memset(msg, 0, sizeof(msg)); |
| @@ -183,47 +184,60 @@ static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, | |||
| 183 | if (count > io_limit) | 184 | if (count > io_limit) |
| 184 | count = io_limit; | 185 | count = io_limit; |
| 185 | 186 | ||
| 186 | /* Smaller eeproms can work given some SMBus extension calls */ | ||
| 187 | if (at24->use_smbus) { | 187 | if (at24->use_smbus) { |
| 188 | /* Smaller eeproms can work given some SMBus extension calls */ | ||
| 188 | if (count > I2C_SMBUS_BLOCK_MAX) | 189 | if (count > I2C_SMBUS_BLOCK_MAX) |
| 189 | count = I2C_SMBUS_BLOCK_MAX; | 190 | count = I2C_SMBUS_BLOCK_MAX; |
| 190 | status = i2c_smbus_read_i2c_block_data(client, offset, | 191 | } else { |
| 191 | count, buf); | 192 | /* |
| 192 | dev_dbg(&client->dev, "smbus read %zu@%d --> %d\n", | 193 | * When we have a better choice than SMBus calls, use a |
| 193 | count, offset, status); | 194 | * combined I2C message. Write address; then read up to |
| 194 | return (status < 0) ? -EIO : status; | 195 | * io_limit data bytes. Note that read page rollover helps us |
| 196 | * here (unlike writes). msgbuf is u8 and will cast to our | ||
| 197 | * needs. | ||
| 198 | */ | ||
| 199 | i = 0; | ||
| 200 | if (at24->chip.flags & AT24_FLAG_ADDR16) | ||
| 201 | msgbuf[i++] = offset >> 8; | ||
| 202 | msgbuf[i++] = offset; | ||
| 203 | |||
| 204 | msg[0].addr = client->addr; | ||
| 205 | msg[0].buf = msgbuf; | ||
| 206 | msg[0].len = i; | ||
| 207 | |||
| 208 | msg[1].addr = client->addr; | ||
| 209 | msg[1].flags = I2C_M_RD; | ||
| 210 | msg[1].buf = buf; | ||
| 211 | msg[1].len = count; | ||
| 195 | } | 212 | } |
| 196 | 213 | ||
| 197 | /* | 214 | /* |
| 198 | * When we have a better choice than SMBus calls, use a combined | 215 | * Reads fail if the previous write didn't complete yet. We may |
| 199 | * I2C message. Write address; then read up to io_limit data bytes. | 216 | * loop a few times until this one succeeds, waiting at least |
| 200 | * Note that read page rollover helps us here (unlike writes). | 217 | * long enough for one entire page write to work. |
| 201 | * msgbuf is u8 and will cast to our needs. | ||
| 202 | */ | 218 | */ |
| 203 | i = 0; | 219 | timeout = jiffies + msecs_to_jiffies(write_timeout); |
| 204 | if (at24->chip.flags & AT24_FLAG_ADDR16) | 220 | do { |
| 205 | msgbuf[i++] = offset >> 8; | 221 | read_time = jiffies; |
| 206 | msgbuf[i++] = offset; | 222 | if (at24->use_smbus) { |
| 207 | 223 | status = i2c_smbus_read_i2c_block_data(client, offset, | |
| 208 | msg[0].addr = client->addr; | 224 | count, buf); |
| 209 | msg[0].buf = msgbuf; | 225 | } else { |
| 210 | msg[0].len = i; | 226 | status = i2c_transfer(client->adapter, msg, 2); |
| 227 | if (status == 2) | ||
| 228 | status = count; | ||
| 229 | } | ||
| 230 | dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", | ||
| 231 | count, offset, status, jiffies); | ||
| 211 | 232 | ||
| 212 | msg[1].addr = client->addr; | 233 | if (status == count) |
| 213 | msg[1].flags = I2C_M_RD; | 234 | return count; |
| 214 | msg[1].buf = buf; | ||
| 215 | msg[1].len = count; | ||
| 216 | 235 | ||
| 217 | status = i2c_transfer(client->adapter, msg, 2); | 236 | /* REVISIT: at HZ=100, this is sloooow */ |
| 218 | dev_dbg(&client->dev, "i2c read %zu@%d --> %d\n", | 237 | msleep(1); |
| 219 | count, offset, status); | 238 | } while (time_before(read_time, timeout)); |
| 220 | 239 | ||
| 221 | if (status == 2) | 240 | return -ETIMEDOUT; |
| 222 | return count; | ||
| 223 | else if (status >= 0) | ||
| 224 | return -EIO; | ||
| 225 | else | ||
| 226 | return status; | ||
| 227 | } | 241 | } |
| 228 | 242 | ||
| 229 | static ssize_t at24_read(struct at24_data *at24, | 243 | static ssize_t at24_read(struct at24_data *at24, |
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c index ccd4408a26c7..3f2375c5ba5b 100644 --- a/drivers/misc/sgi-gru/gruprocfs.c +++ b/drivers/misc/sgi-gru/gruprocfs.c | |||
| @@ -161,14 +161,15 @@ static int options_show(struct seq_file *s, void *p) | |||
| 161 | static ssize_t options_write(struct file *file, const char __user *userbuf, | 161 | static ssize_t options_write(struct file *file, const char __user *userbuf, |
| 162 | size_t count, loff_t *data) | 162 | size_t count, loff_t *data) |
| 163 | { | 163 | { |
| 164 | unsigned long val; | 164 | char buf[20]; |
| 165 | char buf[80]; | ||
| 166 | 165 | ||
| 167 | if (strncpy_from_user(buf, userbuf, sizeof(buf) - 1) < 0) | 166 | if (count >= sizeof(buf)) |
| 167 | return -EINVAL; | ||
| 168 | if (copy_from_user(buf, userbuf, count)) | ||
| 168 | return -EFAULT; | 169 | return -EFAULT; |
| 169 | buf[count - 1] = '\0'; | 170 | buf[count] = '\0'; |
| 170 | if (!strict_strtoul(buf, 10, &val)) | 171 | if (strict_strtoul(buf, 0, &gru_options)) |
| 171 | gru_options = val; | 172 | return -EINVAL; |
| 172 | 173 | ||
| 173 | return count; | 174 | return count; |
| 174 | } | 175 | } |
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index e7a331de5733..b8fd7af1ceeb 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
| @@ -1529,6 +1529,7 @@ static int mmc_omap_remove(struct platform_device *pdev) | |||
| 1529 | host->pdata->cleanup(&pdev->dev); | 1529 | host->pdata->cleanup(&pdev->dev); |
| 1530 | 1530 | ||
| 1531 | mmc_omap_fclk_enable(host, 0); | 1531 | mmc_omap_fclk_enable(host, 0); |
| 1532 | free_irq(host->irq, host); | ||
| 1532 | clk_put(host->fclk); | 1533 | clk_put(host->fclk); |
| 1533 | clk_disable(host->iclk); | 1534 | clk_disable(host->iclk); |
| 1534 | clk_put(host->iclk); | 1535 | clk_put(host->iclk); |
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index b00d67319058..9fb480bb0e0a 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
| @@ -760,6 +760,8 @@ static int pxamci_remove(struct platform_device *pdev) | |||
| 760 | if (mmc) { | 760 | if (mmc) { |
| 761 | struct pxamci_host *host = mmc_priv(mmc); | 761 | struct pxamci_host *host = mmc_priv(mmc); |
| 762 | 762 | ||
| 763 | mmc_remove_host(mmc); | ||
| 764 | |||
| 763 | if (host->pdata) { | 765 | if (host->pdata) { |
| 764 | gpio_cd = host->pdata->gpio_card_detect; | 766 | gpio_cd = host->pdata->gpio_card_detect; |
| 765 | gpio_ro = host->pdata->gpio_card_ro; | 767 | gpio_ro = host->pdata->gpio_card_ro; |
| @@ -779,8 +781,6 @@ static int pxamci_remove(struct platform_device *pdev) | |||
| 779 | if (host->pdata && host->pdata->exit) | 781 | if (host->pdata && host->pdata->exit) |
| 780 | host->pdata->exit(&pdev->dev, mmc); | 782 | host->pdata->exit(&pdev->dev, mmc); |
| 781 | 783 | ||
| 782 | mmc_remove_host(mmc); | ||
| 783 | |||
| 784 | pxamci_stop_clock(host); | 784 | pxamci_stop_clock(host); |
| 785 | writel(TXFIFO_WR_REQ|RXFIFO_RD_REQ|CLK_IS_OFF|STOP_CMD| | 785 | writel(TXFIFO_WR_REQ|RXFIFO_RD_REQ|CLK_IS_OFF|STOP_CMD| |
| 786 | END_CMD_RES|PRG_DONE|DATA_TRAN_DONE, | 786 | END_CMD_RES|PRG_DONE|DATA_TRAN_DONE, |
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 841e085ab74a..14be0755d7cd 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
| @@ -486,6 +486,7 @@ config MTD_BFIN_ASYNC | |||
| 486 | 486 | ||
| 487 | config MTD_GPIO_ADDR | 487 | config MTD_GPIO_ADDR |
| 488 | tristate "GPIO-assisted Flash Chip Support" | 488 | tristate "GPIO-assisted Flash Chip Support" |
| 489 | depends on GENERIC_GPIO || GPIOLIB | ||
| 489 | depends on MTD_COMPLEX_MAPPINGS | 490 | depends on MTD_COMPLEX_MAPPINGS |
| 490 | select MTD_PARTITIONS | 491 | select MTD_PARTITIONS |
| 491 | help | 492 | help |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 1d5cf8636723..ae2f6dbe43c3 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
| @@ -58,4 +58,6 @@ obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o | |||
| 58 | obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o | 58 | obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o |
| 59 | obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o | 59 | obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o |
| 60 | obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o | 60 | obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o |
| 61 | obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o | ||
| 62 | obj-$(CONFIG_MTD_VMU) += vmu-flash.o | ||
| 61 | obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o | 63 | obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o |
diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c index 44ef9a49a860..1ad5caf9fe69 100644 --- a/drivers/mtd/maps/gpio-addr-flash.c +++ b/drivers/mtd/maps/gpio-addr-flash.c | |||
| @@ -13,7 +13,9 @@ | |||
| 13 | * Licensed under the GPL-2 or later. | 13 | * Licensed under the GPL-2 or later. |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/gpio.h> | ||
| 16 | #include <linux/init.h> | 17 | #include <linux/init.h> |
| 18 | #include <linux/io.h> | ||
| 17 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
| 18 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 19 | #include <linux/mtd/mtd.h> | 21 | #include <linux/mtd/mtd.h> |
| @@ -23,9 +25,6 @@ | |||
| 23 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
| 24 | #include <linux/types.h> | 26 | #include <linux/types.h> |
| 25 | 27 | ||
| 26 | #include <asm/gpio.h> | ||
| 27 | #include <asm/io.h> | ||
| 28 | |||
| 29 | #define pr_devinit(fmt, args...) ({ static const __devinitconst char __fmt[] = fmt; printk(__fmt, ## args); }) | 28 | #define pr_devinit(fmt, args...) ({ static const __devinitconst char __fmt[] = fmt; printk(__fmt, ## args); }) |
| 30 | 29 | ||
| 31 | #define DRIVER_NAME "gpio-addr-flash" | 30 | #define DRIVER_NAME "gpio-addr-flash" |
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index d600c2deff73..689d6a79ffc0 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
| @@ -118,11 +118,9 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) | |||
| 118 | DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", | 118 | DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", |
| 119 | dev->offset, mrq.CardOffset); | 119 | dev->offset, mrq.CardOffset); |
| 120 | mrq.Page = 0; | 120 | mrq.Page = 0; |
| 121 | ret = pcmcia_map_mem_page(win, &mrq); | 121 | ret = pcmcia_map_mem_page(dev->p_dev, win, &mrq); |
| 122 | if (ret != 0) { | 122 | if (ret != 0) |
| 123 | cs_error(dev->p_dev, MapMemPage, ret); | ||
| 124 | return NULL; | 123 | return NULL; |
| 125 | } | ||
| 126 | dev->offset = mrq.CardOffset; | 124 | dev->offset = mrq.CardOffset; |
| 127 | } | 125 | } |
| 128 | return dev->win_base + (to & (dev->win_size-1)); | 126 | return dev->win_base + (to & (dev->win_size-1)); |
| @@ -327,8 +325,6 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) | |||
| 327 | 325 | ||
| 328 | DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); | 326 | DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); |
| 329 | ret = pcmcia_modify_configuration(link, &mod); | 327 | ret = pcmcia_modify_configuration(link, &mod); |
| 330 | if (ret != 0) | ||
| 331 | cs_error(link, ModifyConfiguration, ret); | ||
| 332 | } | 328 | } |
| 333 | 329 | ||
| 334 | 330 | ||
| @@ -348,107 +344,116 @@ static void pcmciamtd_release(struct pcmcia_device *link) | |||
| 348 | iounmap(dev->win_base); | 344 | iounmap(dev->win_base); |
| 349 | dev->win_base = NULL; | 345 | dev->win_base = NULL; |
| 350 | } | 346 | } |
| 351 | pcmcia_release_window(link->win); | 347 | pcmcia_release_window(link, link->win); |
| 352 | } | 348 | } |
| 353 | pcmcia_disable_device(link); | 349 | pcmcia_disable_device(link); |
| 354 | } | 350 | } |
| 355 | 351 | ||
| 356 | 352 | ||
| 357 | static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, int *new_name) | 353 | #ifdef CONFIG_MTD_DEBUG |
| 354 | static int pcmciamtd_cistpl_format(struct pcmcia_device *p_dev, | ||
| 355 | tuple_t *tuple, | ||
| 356 | void *priv_data) | ||
| 358 | { | 357 | { |
| 359 | int rc; | ||
| 360 | tuple_t tuple; | ||
| 361 | cisparse_t parse; | 358 | cisparse_t parse; |
| 362 | u_char buf[64]; | ||
| 363 | |||
| 364 | tuple.Attributes = 0; | ||
| 365 | tuple.TupleData = (cisdata_t *)buf; | ||
| 366 | tuple.TupleDataMax = sizeof(buf); | ||
| 367 | tuple.TupleOffset = 0; | ||
| 368 | tuple.DesiredTuple = RETURN_FIRST_TUPLE; | ||
| 369 | |||
| 370 | rc = pcmcia_get_first_tuple(link, &tuple); | ||
| 371 | while (rc == 0) { | ||
| 372 | rc = pcmcia_get_tuple_data(link, &tuple); | ||
| 373 | if (rc != 0) { | ||
| 374 | cs_error(link, GetTupleData, rc); | ||
| 375 | break; | ||
| 376 | } | ||
| 377 | rc = pcmcia_parse_tuple(&tuple, &parse); | ||
| 378 | if (rc != 0) { | ||
| 379 | cs_error(link, ParseTuple, rc); | ||
| 380 | break; | ||
| 381 | } | ||
| 382 | 359 | ||
| 383 | switch(tuple.TupleCode) { | 360 | if (!pcmcia_parse_tuple(tuple, &parse)) { |
| 384 | case CISTPL_FORMAT: { | 361 | cistpl_format_t *t = &parse.format; |
| 385 | cistpl_format_t *t = &parse.format; | 362 | (void)t; /* Shut up, gcc */ |
| 386 | (void)t; /* Shut up, gcc */ | 363 | DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u", |
| 387 | DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u", | 364 | t->type, t->edc, t->offset, t->length); |
| 388 | t->type, t->edc, t->offset, t->length); | 365 | } |
| 389 | break; | 366 | return -ENOSPC; |
| 367 | } | ||
| 390 | 368 | ||
| 391 | } | 369 | static int pcmciamtd_cistpl_jedec(struct pcmcia_device *p_dev, |
| 370 | tuple_t *tuple, | ||
| 371 | void *priv_data) | ||
| 372 | { | ||
| 373 | cisparse_t parse; | ||
| 374 | int i; | ||
| 392 | 375 | ||
| 393 | case CISTPL_DEVICE: { | 376 | if (!pcmcia_parse_tuple(tuple, &parse)) { |
| 394 | cistpl_device_t *t = &parse.device; | 377 | cistpl_jedec_t *t = &parse.jedec; |
| 395 | int i; | 378 | for (i = 0; i < t->nid; i++) |
| 396 | DEBUG(2, "Common memory:"); | 379 | DEBUG(2, "JEDEC: 0x%02x 0x%02x", t->id[i].mfr, t->id[i].info); |
| 397 | dev->pcmcia_map.size = t->dev[0].size; | 380 | } |
| 398 | for(i = 0; i < t->ndev; i++) { | 381 | return -ENOSPC; |
| 399 | DEBUG(2, "Region %d, type = %u", i, t->dev[i].type); | 382 | } |
| 400 | DEBUG(2, "Region %d, wp = %u", i, t->dev[i].wp); | 383 | #endif |
| 401 | DEBUG(2, "Region %d, speed = %u ns", i, t->dev[i].speed); | ||
| 402 | DEBUG(2, "Region %d, size = %u bytes", i, t->dev[i].size); | ||
| 403 | } | ||
| 404 | break; | ||
| 405 | } | ||
| 406 | 384 | ||
| 407 | case CISTPL_VERS_1: { | 385 | static int pcmciamtd_cistpl_device(struct pcmcia_device *p_dev, |
| 408 | cistpl_vers_1_t *t = &parse.version_1; | 386 | tuple_t *tuple, |
| 409 | int i; | 387 | void *priv_data) |
| 410 | if(t->ns) { | 388 | { |
| 411 | dev->mtd_name[0] = '\0'; | 389 | struct pcmciamtd_dev *dev = priv_data; |
| 412 | for(i = 0; i < t->ns; i++) { | 390 | cisparse_t parse; |
| 413 | if(i) | 391 | cistpl_device_t *t = &parse.device; |
| 414 | strcat(dev->mtd_name, " "); | 392 | int i; |
| 415 | strcat(dev->mtd_name, t->str+t->ofs[i]); | ||
| 416 | } | ||
| 417 | } | ||
| 418 | DEBUG(2, "Found name: %s", dev->mtd_name); | ||
| 419 | break; | ||
| 420 | } | ||
| 421 | 393 | ||
| 422 | case CISTPL_JEDEC_C: { | 394 | if (pcmcia_parse_tuple(tuple, &parse)) |
| 423 | cistpl_jedec_t *t = &parse.jedec; | 395 | return -EINVAL; |
| 424 | int i; | 396 | |
| 425 | for(i = 0; i < t->nid; i++) { | 397 | DEBUG(2, "Common memory:"); |
| 426 | DEBUG(2, "JEDEC: 0x%02x 0x%02x", t->id[i].mfr, t->id[i].info); | 398 | dev->pcmcia_map.size = t->dev[0].size; |
| 427 | } | 399 | /* from here on: DEBUG only */ |
| 428 | break; | 400 | for (i = 0; i < t->ndev; i++) { |
| 429 | } | 401 | DEBUG(2, "Region %d, type = %u", i, t->dev[i].type); |
| 402 | DEBUG(2, "Region %d, wp = %u", i, t->dev[i].wp); | ||
| 403 | DEBUG(2, "Region %d, speed = %u ns", i, t->dev[i].speed); | ||
| 404 | DEBUG(2, "Region %d, size = %u bytes", i, t->dev[i].size); | ||
| 405 | } | ||
| 406 | return 0; | ||
| 407 | } | ||
| 430 | 408 | ||
| 431 | case CISTPL_DEVICE_GEO: { | 409 | static int pcmciamtd_cistpl_geo(struct pcmcia_device *p_dev, |
| 432 | cistpl_device_geo_t *t = &parse.device_geo; | 410 | tuple_t *tuple, |
| 433 | int i; | 411 | void *priv_data) |
| 434 | dev->pcmcia_map.bankwidth = t->geo[0].buswidth; | 412 | { |
| 435 | for(i = 0; i < t->ngeo; i++) { | 413 | struct pcmciamtd_dev *dev = priv_data; |
| 436 | DEBUG(2, "region: %d bankwidth = %u", i, t->geo[i].buswidth); | 414 | cisparse_t parse; |
| 437 | DEBUG(2, "region: %d erase_block = %u", i, t->geo[i].erase_block); | 415 | cistpl_device_geo_t *t = &parse.device_geo; |
| 438 | DEBUG(2, "region: %d read_block = %u", i, t->geo[i].read_block); | 416 | int i; |
| 439 | DEBUG(2, "region: %d write_block = %u", i, t->geo[i].write_block); | ||
| 440 | DEBUG(2, "region: %d partition = %u", i, t->geo[i].partition); | ||
| 441 | DEBUG(2, "region: %d interleave = %u", i, t->geo[i].interleave); | ||
| 442 | } | ||
| 443 | break; | ||
| 444 | } | ||
| 445 | 417 | ||
| 446 | default: | 418 | if (pcmcia_parse_tuple(tuple, &parse)) |
| 447 | DEBUG(2, "Unknown tuple code %d", tuple.TupleCode); | 419 | return -EINVAL; |
| 448 | } | 420 | |
| 421 | dev->pcmcia_map.bankwidth = t->geo[0].buswidth; | ||
| 422 | /* from here on: DEBUG only */ | ||
| 423 | for (i = 0; i < t->ngeo; i++) { | ||
| 424 | DEBUG(2, "region: %d bankwidth = %u", i, t->geo[i].buswidth); | ||
| 425 | DEBUG(2, "region: %d erase_block = %u", i, t->geo[i].erase_block); | ||
| 426 | DEBUG(2, "region: %d read_block = %u", i, t->geo[i].read_block); | ||
| 427 | DEBUG(2, "region: %d write_block = %u", i, t->geo[i].write_block); | ||
| 428 | DEBUG(2, "region: %d partition = %u", i, t->geo[i].partition); | ||
| 429 | DEBUG(2, "region: %d interleave = %u", i, t->geo[i].interleave); | ||
| 430 | } | ||
| 431 | return 0; | ||
| 432 | } | ||
| 433 | |||
| 434 | |||
| 435 | static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, int *new_name) | ||
| 436 | { | ||
| 437 | int i; | ||
| 449 | 438 | ||
| 450 | rc = pcmcia_get_next_tuple(link, &tuple); | 439 | if (p_dev->prod_id[0]) { |
| 440 | dev->mtd_name[0] = '\0'; | ||
| 441 | for (i = 0; i < 4; i++) { | ||
| 442 | if (i) | ||
| 443 | strcat(dev->mtd_name, " "); | ||
| 444 | if (p_dev->prod_id[i]) | ||
| 445 | strcat(dev->mtd_name, p_dev->prod_id[i]); | ||
| 446 | } | ||
| 447 | DEBUG(2, "Found name: %s", dev->mtd_name); | ||
| 451 | } | 448 | } |
| 449 | |||
| 450 | #ifdef CONFIG_MTD_DEBUG | ||
| 451 | pcmcia_loop_tuple(p_dev, CISTPL_FORMAT, pcmciamtd_cistpl_format, NULL); | ||
| 452 | pcmcia_loop_tuple(p_dev, CISTPL_JEDEC_C, pcmciamtd_cistpl_jedec, NULL); | ||
| 453 | #endif | ||
| 454 | pcmcia_loop_tuple(p_dev, CISTPL_DEVICE, pcmciamtd_cistpl_device, dev); | ||
| 455 | pcmcia_loop_tuple(p_dev, CISTPL_DEVICE_GEO, pcmciamtd_cistpl_geo, dev); | ||
| 456 | |||
| 452 | if(!dev->pcmcia_map.size) | 457 | if(!dev->pcmcia_map.size) |
| 453 | dev->pcmcia_map.size = MAX_PCMCIA_ADDR; | 458 | dev->pcmcia_map.size = MAX_PCMCIA_ADDR; |
| 454 | 459 | ||
| @@ -481,16 +486,12 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, | |||
| 481 | * MTD device available to the system. | 486 | * MTD device available to the system. |
| 482 | */ | 487 | */ |
| 483 | 488 | ||
| 484 | #define CS_CHECK(fn, ret) \ | ||
| 485 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 486 | |||
| 487 | static int pcmciamtd_config(struct pcmcia_device *link) | 489 | static int pcmciamtd_config(struct pcmcia_device *link) |
| 488 | { | 490 | { |
| 489 | struct pcmciamtd_dev *dev = link->priv; | 491 | struct pcmciamtd_dev *dev = link->priv; |
| 490 | struct mtd_info *mtd = NULL; | 492 | struct mtd_info *mtd = NULL; |
| 491 | cs_status_t status; | 493 | cs_status_t status; |
| 492 | win_req_t req; | 494 | win_req_t req; |
| 493 | int last_ret = 0, last_fn = 0; | ||
| 494 | int ret; | 495 | int ret; |
| 495 | int i; | 496 | int i; |
| 496 | static char *probes[] = { "jedec_probe", "cfi_probe" }; | 497 | static char *probes[] = { "jedec_probe", "cfi_probe" }; |
| @@ -529,7 +530,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
| 529 | int ret; | 530 | int ret; |
| 530 | DEBUG(2, "requesting window with size = %dKiB memspeed = %d", | 531 | DEBUG(2, "requesting window with size = %dKiB memspeed = %d", |
| 531 | req.Size >> 10, req.AccessSpeed); | 532 | req.Size >> 10, req.AccessSpeed); |
| 532 | ret = pcmcia_request_window(&link, &req, &link->win); | 533 | ret = pcmcia_request_window(link, &req, &link->win); |
| 533 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); | 534 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); |
| 534 | if(ret) { | 535 | if(ret) { |
| 535 | req.Size >>= 1; | 536 | req.Size >>= 1; |
| @@ -577,7 +578,6 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
| 577 | DEBUG(2, "Setting Configuration"); | 578 | DEBUG(2, "Setting Configuration"); |
| 578 | ret = pcmcia_request_configuration(link, &link->conf); | 579 | ret = pcmcia_request_configuration(link, &link->conf); |
| 579 | if (ret != 0) { | 580 | if (ret != 0) { |
| 580 | cs_error(link, RequestConfiguration, ret); | ||
| 581 | if (dev->win_base) { | 581 | if (dev->win_base) { |
| 582 | iounmap(dev->win_base); | 582 | iounmap(dev->win_base); |
| 583 | dev->win_base = NULL; | 583 | dev->win_base = NULL; |
| @@ -652,8 +652,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
| 652 | link->dev_node = &dev->node; | 652 | link->dev_node = &dev->node; |
| 653 | return 0; | 653 | return 0; |
| 654 | 654 | ||
| 655 | cs_failed: | 655 | failed: |
| 656 | cs_error(link, last_fn, last_ret); | ||
| 657 | err("CS Error, exiting"); | 656 | err("CS Error, exiting"); |
| 658 | pcmciamtd_release(link); | 657 | pcmciamtd_release(link); |
| 659 | return -ENODEV; | 658 | return -ENODEV; |
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index fdb97f3d30e9..d7a47574d21e 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c | |||
| @@ -209,8 +209,8 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r | |||
| 209 | } | 209 | } |
| 210 | subdev->mtd->owner = THIS_MODULE; | 210 | subdev->mtd->owner = THIS_MODULE; |
| 211 | 211 | ||
| 212 | printk(KERN_INFO "SA1100 flash: CFI device at 0x%08lx, %dMiB, " | 212 | printk(KERN_INFO "SA1100 flash: CFI device at 0x%08lx, %uMiB, %d-bit\n", |
| 213 | "%d-bit\n", phys, subdev->mtd->size >> 20, | 213 | phys, (unsigned)(subdev->mtd->size >> 20), |
| 214 | subdev->map.bankwidth * 8); | 214 | subdev->map.bankwidth * 8); |
| 215 | 215 | ||
| 216 | return 0; | 216 | return 0; |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 22113865438b..2957cc70da3d 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
| @@ -761,6 +761,7 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip) | |||
| 761 | * @mtd: mtd info structure | 761 | * @mtd: mtd info structure |
| 762 | * @chip: nand chip info structure | 762 | * @chip: nand chip info structure |
| 763 | * @buf: buffer to store read data | 763 | * @buf: buffer to store read data |
| 764 | * @page: page number to read | ||
| 764 | * | 765 | * |
| 765 | * Not for syndrome calculating ecc controllers, which use a special oob layout | 766 | * Not for syndrome calculating ecc controllers, which use a special oob layout |
| 766 | */ | 767 | */ |
| @@ -777,6 +778,7 @@ static int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, | |||
| 777 | * @mtd: mtd info structure | 778 | * @mtd: mtd info structure |
| 778 | * @chip: nand chip info structure | 779 | * @chip: nand chip info structure |
| 779 | * @buf: buffer to store read data | 780 | * @buf: buffer to store read data |
| 781 | * @page: page number to read | ||
| 780 | * | 782 | * |
| 781 | * We need a special oob layout and handling even when OOB isn't used. | 783 | * We need a special oob layout and handling even when OOB isn't used. |
| 782 | */ | 784 | */ |
| @@ -818,6 +820,7 @@ static int nand_read_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *c | |||
| 818 | * @mtd: mtd info structure | 820 | * @mtd: mtd info structure |
| 819 | * @chip: nand chip info structure | 821 | * @chip: nand chip info structure |
| 820 | * @buf: buffer to store read data | 822 | * @buf: buffer to store read data |
| 823 | * @page: page number to read | ||
| 821 | */ | 824 | */ |
| 822 | static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, | 825 | static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, |
| 823 | uint8_t *buf, int page) | 826 | uint8_t *buf, int page) |
| @@ -939,6 +942,7 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, uint3 | |||
| 939 | * @mtd: mtd info structure | 942 | * @mtd: mtd info structure |
| 940 | * @chip: nand chip info structure | 943 | * @chip: nand chip info structure |
| 941 | * @buf: buffer to store read data | 944 | * @buf: buffer to store read data |
| 945 | * @page: page number to read | ||
| 942 | * | 946 | * |
| 943 | * Not for syndrome calculating ecc controllers which need a special oob layout | 947 | * Not for syndrome calculating ecc controllers which need a special oob layout |
| 944 | */ | 948 | */ |
| @@ -983,6 +987,7 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, | |||
| 983 | * @mtd: mtd info structure | 987 | * @mtd: mtd info structure |
| 984 | * @chip: nand chip info structure | 988 | * @chip: nand chip info structure |
| 985 | * @buf: buffer to store read data | 989 | * @buf: buffer to store read data |
| 990 | * @page: page number to read | ||
| 986 | * | 991 | * |
| 987 | * Hardware ECC for large page chips, require OOB to be read first. | 992 | * Hardware ECC for large page chips, require OOB to be read first. |
| 988 | * For this ECC mode, the write_page method is re-used from ECC_HW. | 993 | * For this ECC mode, the write_page method is re-used from ECC_HW. |
| @@ -1031,6 +1036,7 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd, | |||
| 1031 | * @mtd: mtd info structure | 1036 | * @mtd: mtd info structure |
| 1032 | * @chip: nand chip info structure | 1037 | * @chip: nand chip info structure |
| 1033 | * @buf: buffer to store read data | 1038 | * @buf: buffer to store read data |
| 1039 | * @page: page number to read | ||
| 1034 | * | 1040 | * |
| 1035 | * The hw generator calculates the error syndrome automatically. Therefor | 1041 | * The hw generator calculates the error syndrome automatically. Therefor |
| 1036 | * we need a special oob layout and handling. | 1042 | * we need a special oob layout and handling. |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index e19ca4bb7510..b2f71f79baaf 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -975,7 +975,7 @@ config ENC28J60_WRITEVERIFY | |||
| 975 | 975 | ||
| 976 | config ETHOC | 976 | config ETHOC |
| 977 | tristate "OpenCores 10/100 Mbps Ethernet MAC support" | 977 | tristate "OpenCores 10/100 Mbps Ethernet MAC support" |
| 978 | depends on NET_ETHERNET && HAS_IOMEM | 978 | depends on NET_ETHERNET && HAS_IOMEM && HAS_DMA |
| 979 | select MII | 979 | select MII |
| 980 | select PHYLIB | 980 | select PHYLIB |
| 981 | select CRC32 | 981 | select CRC32 |
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c index 2be49c817995..b25467ac895c 100644 --- a/drivers/net/arm/ep93xx_eth.c +++ b/drivers/net/arm/ep93xx_eth.c | |||
| @@ -628,15 +628,6 @@ static int ep93xx_open(struct net_device *dev) | |||
| 628 | if (ep93xx_alloc_buffers(ep)) | 628 | if (ep93xx_alloc_buffers(ep)) |
| 629 | return -ENOMEM; | 629 | return -ENOMEM; |
| 630 | 630 | ||
| 631 | if (is_zero_ether_addr(dev->dev_addr)) { | ||
| 632 | random_ether_addr(dev->dev_addr); | ||
| 633 | printk(KERN_INFO "%s: generated random MAC address " | ||
| 634 | "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x.\n", dev->name, | ||
| 635 | dev->dev_addr[0], dev->dev_addr[1], | ||
| 636 | dev->dev_addr[2], dev->dev_addr[3], | ||
| 637 | dev->dev_addr[4], dev->dev_addr[5]); | ||
| 638 | } | ||
| 639 | |||
| 640 | napi_enable(&ep->napi); | 631 | napi_enable(&ep->napi); |
| 641 | 632 | ||
| 642 | if (ep93xx_start_hw(dev)) { | 633 | if (ep93xx_start_hw(dev)) { |
| @@ -877,6 +868,9 @@ static int ep93xx_eth_probe(struct platform_device *pdev) | |||
| 877 | ep->mii.mdio_write = ep93xx_mdio_write; | 868 | ep->mii.mdio_write = ep93xx_mdio_write; |
| 878 | ep->mdc_divisor = 40; /* Max HCLK 100 MHz, min MDIO clk 2.5 MHz. */ | 869 | ep->mdc_divisor = 40; /* Max HCLK 100 MHz, min MDIO clk 2.5 MHz. */ |
| 879 | 870 | ||
| 871 | if (is_zero_ether_addr(dev->dev_addr)) | ||
| 872 | random_ether_addr(dev->dev_addr); | ||
| 873 | |||
| 880 | err = register_netdev(dev); | 874 | err = register_netdev(dev); |
| 881 | if (err) { | 875 | if (err) { |
| 882 | dev_err(&pdev->dev, "Failed to register netdev\n"); | 876 | dev_err(&pdev->dev, "Failed to register netdev\n"); |
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index ce6f1ac25df8..3f4b4300f533 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
| @@ -1088,7 +1088,14 @@ static struct net_device * au1000_probe(int port_num) | |||
| 1088 | return NULL; | 1088 | return NULL; |
| 1089 | } | 1089 | } |
| 1090 | 1090 | ||
| 1091 | if ((err = register_netdev(dev)) != 0) { | 1091 | dev->base_addr = base; |
| 1092 | dev->irq = irq; | ||
| 1093 | dev->netdev_ops = &au1000_netdev_ops; | ||
| 1094 | SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops); | ||
| 1095 | dev->watchdog_timeo = ETH_TX_TIMEOUT; | ||
| 1096 | |||
| 1097 | err = register_netdev(dev); | ||
| 1098 | if (err != 0) { | ||
| 1092 | printk(KERN_ERR "%s: Cannot register net device, error %d\n", | 1099 | printk(KERN_ERR "%s: Cannot register net device, error %d\n", |
| 1093 | DRV_NAME, err); | 1100 | DRV_NAME, err); |
| 1094 | free_netdev(dev); | 1101 | free_netdev(dev); |
| @@ -1209,12 +1216,6 @@ static struct net_device * au1000_probe(int port_num) | |||
| 1209 | aup->tx_db_inuse[i] = pDB; | 1216 | aup->tx_db_inuse[i] = pDB; |
| 1210 | } | 1217 | } |
| 1211 | 1218 | ||
| 1212 | dev->base_addr = base; | ||
| 1213 | dev->irq = irq; | ||
| 1214 | dev->netdev_ops = &au1000_netdev_ops; | ||
| 1215 | SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops); | ||
| 1216 | dev->watchdog_timeo = ETH_TX_TIMEOUT; | ||
| 1217 | |||
| 1218 | /* | 1219 | /* |
| 1219 | * The boot code uses the ethernet controller, so reset it to start | 1220 | * The boot code uses the ethernet controller, so reset it to start |
| 1220 | * fresh. au1000_init() expects that the device is in reset state. | 1221 | * fresh. au1000_init() expects that the device is in reset state. |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index e046943ef29d..2a9132343b66 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
| @@ -912,9 +912,6 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id) | |||
| 912 | bp->istat = istat; | 912 | bp->istat = istat; |
| 913 | __b44_disable_ints(bp); | 913 | __b44_disable_ints(bp); |
| 914 | __napi_schedule(&bp->napi); | 914 | __napi_schedule(&bp->napi); |
| 915 | } else { | ||
| 916 | printk(KERN_ERR PFX "%s: Error, poll already scheduled\n", | ||
| 917 | dev->name); | ||
| 918 | } | 915 | } |
| 919 | 916 | ||
| 920 | irq_ack: | 917 | irq_ack: |
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index a80da0e14a52..3b79a225628a 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
| @@ -259,6 +259,8 @@ struct be_adapter { | |||
| 259 | u32 port_num; | 259 | u32 port_num; |
| 260 | bool promiscuous; | 260 | bool promiscuous; |
| 261 | u32 cap; | 261 | u32 cap; |
| 262 | u32 rx_fc; /* Rx flow control */ | ||
| 263 | u32 tx_fc; /* Tx flow control */ | ||
| 262 | }; | 264 | }; |
| 263 | 265 | ||
| 264 | extern const struct ethtool_ops be_ethtool_ops; | 266 | extern const struct ethtool_ops be_ethtool_ops; |
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h index 49953787e41c..e5f9676cf1bc 100644 --- a/drivers/net/benet/be_cmds.h +++ b/drivers/net/benet/be_cmds.h | |||
| @@ -68,7 +68,7 @@ enum { | |||
| 68 | #define CQE_STATUS_COMPL_MASK 0xFFFF | 68 | #define CQE_STATUS_COMPL_MASK 0xFFFF |
| 69 | #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */ | 69 | #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */ |
| 70 | #define CQE_STATUS_EXTD_MASK 0xFFFF | 70 | #define CQE_STATUS_EXTD_MASK 0xFFFF |
| 71 | #define CQE_STATUS_EXTD_SHIFT 0 /* bits 0 - 15 */ | 71 | #define CQE_STATUS_EXTD_SHIFT 16 /* bits 16 - 31 */ |
| 72 | 72 | ||
| 73 | struct be_mcc_compl { | 73 | struct be_mcc_compl { |
| 74 | u32 status; /* dword 0 */ | 74 | u32 status; /* dword 0 */ |
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index cda5bf2fc50a..f0fd95b43c07 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c | |||
| @@ -323,10 +323,12 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd) | |||
| 323 | 323 | ||
| 324 | if (ecmd->autoneg != 0) | 324 | if (ecmd->autoneg != 0) |
| 325 | return -EINVAL; | 325 | return -EINVAL; |
| 326 | adapter->tx_fc = ecmd->tx_pause; | ||
| 327 | adapter->rx_fc = ecmd->rx_pause; | ||
| 326 | 328 | ||
| 327 | status = be_cmd_set_flow_control(adapter, ecmd->tx_pause, | 329 | status = be_cmd_set_flow_control(adapter, |
| 328 | ecmd->rx_pause); | 330 | adapter->tx_fc, adapter->rx_fc); |
| 329 | if (!status) | 331 | if (status) |
| 330 | dev_warn(&adapter->pdev->dev, "Pause param set failed.\n"); | 332 | dev_warn(&adapter->pdev->dev, "Pause param set failed.\n"); |
| 331 | 333 | ||
| 332 | return status; | 334 | return status; |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 1f941f027718..876b357101fa 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
| @@ -1610,11 +1610,21 @@ static int be_open(struct net_device *netdev) | |||
| 1610 | 1610 | ||
| 1611 | status = be_cmd_link_status_query(adapter, &link_up); | 1611 | status = be_cmd_link_status_query(adapter, &link_up); |
| 1612 | if (status) | 1612 | if (status) |
| 1613 | return status; | 1613 | goto ret_sts; |
| 1614 | be_link_status_update(adapter, link_up); | 1614 | be_link_status_update(adapter, link_up); |
| 1615 | 1615 | ||
| 1616 | status = be_vid_config(adapter); | ||
| 1617 | if (status) | ||
| 1618 | goto ret_sts; | ||
| 1619 | |||
| 1620 | status = be_cmd_set_flow_control(adapter, | ||
| 1621 | adapter->tx_fc, adapter->rx_fc); | ||
| 1622 | if (status) | ||
| 1623 | goto ret_sts; | ||
| 1624 | |||
| 1616 | schedule_delayed_work(&adapter->work, msecs_to_jiffies(100)); | 1625 | schedule_delayed_work(&adapter->work, msecs_to_jiffies(100)); |
| 1617 | return 0; | 1626 | ret_sts: |
| 1627 | return status; | ||
| 1618 | } | 1628 | } |
| 1619 | 1629 | ||
| 1620 | static int be_setup(struct be_adapter *adapter) | 1630 | static int be_setup(struct be_adapter *adapter) |
| @@ -1648,17 +1658,8 @@ static int be_setup(struct be_adapter *adapter) | |||
| 1648 | if (status != 0) | 1658 | if (status != 0) |
| 1649 | goto rx_qs_destroy; | 1659 | goto rx_qs_destroy; |
| 1650 | 1660 | ||
| 1651 | status = be_vid_config(adapter); | ||
| 1652 | if (status != 0) | ||
| 1653 | goto mccqs_destroy; | ||
| 1654 | |||
| 1655 | status = be_cmd_set_flow_control(adapter, true, true); | ||
| 1656 | if (status != 0) | ||
| 1657 | goto mccqs_destroy; | ||
| 1658 | return 0; | 1661 | return 0; |
| 1659 | 1662 | ||
| 1660 | mccqs_destroy: | ||
| 1661 | be_mcc_queues_destroy(adapter); | ||
| 1662 | rx_qs_destroy: | 1663 | rx_qs_destroy: |
| 1663 | be_rx_queues_destroy(adapter); | 1664 | be_rx_queues_destroy(adapter); |
| 1664 | tx_qs_destroy: | 1665 | tx_qs_destroy: |
| @@ -1909,6 +1910,10 @@ static void be_netdev_init(struct net_device *netdev) | |||
| 1909 | 1910 | ||
| 1910 | adapter->rx_csum = true; | 1911 | adapter->rx_csum = true; |
| 1911 | 1912 | ||
| 1913 | /* Default settings for Rx and Tx flow control */ | ||
| 1914 | adapter->rx_fc = true; | ||
| 1915 | adapter->tx_fc = true; | ||
| 1916 | |||
| 1912 | netif_set_gso_max_size(netdev, 65535); | 1917 | netif_set_gso_max_size(netdev, 65535); |
| 1913 | 1918 | ||
| 1914 | BE_SET_NETDEV_OPS(netdev, &be_netdev_ops); | 1919 | BE_SET_NETDEV_OPS(netdev, &be_netdev_ops); |
| @@ -2171,6 +2176,7 @@ static int be_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 2171 | be_close(netdev); | 2176 | be_close(netdev); |
| 2172 | rtnl_unlock(); | 2177 | rtnl_unlock(); |
| 2173 | } | 2178 | } |
| 2179 | be_cmd_get_flow_control(adapter, &adapter->tx_fc, &adapter->rx_fc); | ||
| 2174 | be_clear(adapter); | 2180 | be_clear(adapter); |
| 2175 | 2181 | ||
| 2176 | pci_save_state(pdev); | 2182 | pci_save_state(pdev); |
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig index df32c109b7ac..772f6d2489ce 100644 --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig | |||
| @@ -35,66 +35,16 @@ config CAN_CALC_BITTIMING | |||
| 35 | arguments "tq", "prop_seg", "phase_seg1", "phase_seg2" and "sjw". | 35 | arguments "tq", "prop_seg", "phase_seg1", "phase_seg2" and "sjw". |
| 36 | If unsure, say Y. | 36 | If unsure, say Y. |
| 37 | 37 | ||
| 38 | config CAN_SJA1000 | ||
| 39 | depends on CAN_DEV && HAS_IOMEM | ||
| 40 | tristate "Philips SJA1000" | ||
| 41 | ---help--- | ||
| 42 | Driver for the SJA1000 CAN controllers from Philips or NXP | ||
| 43 | |||
| 44 | config CAN_SJA1000_ISA | ||
| 45 | depends on CAN_SJA1000 && ISA | ||
| 46 | tristate "ISA Bus based legacy SJA1000 driver" | ||
| 47 | ---help--- | ||
| 48 | This driver adds legacy support for SJA1000 chips connected to | ||
| 49 | the ISA bus using I/O port, memory mapped or indirect access. | ||
| 50 | |||
| 51 | config CAN_SJA1000_PLATFORM | ||
| 52 | depends on CAN_SJA1000 | ||
| 53 | tristate "Generic Platform Bus based SJA1000 driver" | ||
| 54 | ---help--- | ||
| 55 | This driver adds support for the SJA1000 chips connected to | ||
| 56 | the "platform bus" (Linux abstraction for directly to the | ||
| 57 | processor attached devices). Which can be found on various | ||
| 58 | boards from Phytec (http://www.phytec.de) like the PCM027, | ||
| 59 | PCM038. | ||
| 60 | |||
| 61 | config CAN_SJA1000_OF_PLATFORM | ||
| 62 | depends on CAN_SJA1000 && PPC_OF | ||
| 63 | tristate "Generic OF Platform Bus based SJA1000 driver" | ||
| 64 | ---help--- | ||
| 65 | This driver adds support for the SJA1000 chips connected to | ||
| 66 | the OpenFirmware "platform bus" found on embedded systems with | ||
| 67 | OpenFirmware bindings, e.g. if you have a PowerPC based system | ||
| 68 | you may want to enable this option. | ||
| 69 | |||
| 70 | config CAN_EMS_PCI | ||
| 71 | tristate "EMS CPC-PCI, CPC-PCIe and CPC-104P Card" | ||
| 72 | depends on PCI && CAN_SJA1000 | ||
| 73 | ---help--- | ||
| 74 | This driver is for the one, two or four channel CPC-PCI, | ||
| 75 | CPC-PCIe and CPC-104P cards from EMS Dr. Thomas Wuensche | ||
| 76 | (http://www.ems-wuensche.de). | ||
| 77 | |||
| 78 | config CAN_EMS_USB | ||
| 79 | tristate "EMS CPC-USB/ARM7 CAN/USB interface" | ||
| 80 | depends on USB && CAN_DEV | ||
| 81 | ---help--- | ||
| 82 | This driver is for the one channel CPC-USB/ARM7 CAN/USB interface | ||
| 83 | from from EMS Dr. Thomas Wuensche (http://www.ems-wuensche.de). | ||
| 84 | |||
| 85 | config CAN_KVASER_PCI | ||
| 86 | tristate "Kvaser PCIcanx and Kvaser PCIcan PCI Cards" | ||
| 87 | depends on PCI && CAN_SJA1000 | ||
| 88 | ---help--- | ||
| 89 | This driver is for the the PCIcanx and PCIcan cards (1, 2 or | ||
| 90 | 4 channel) from Kvaser (http://www.kvaser.com). | ||
| 91 | |||
| 92 | config CAN_AT91 | 38 | config CAN_AT91 |
| 93 | tristate "Atmel AT91 onchip CAN controller" | 39 | tristate "Atmel AT91 onchip CAN controller" |
| 94 | depends on CAN && CAN_DEV && ARCH_AT91SAM9263 | 40 | depends on CAN_DEV && ARCH_AT91SAM9263 |
| 95 | ---help--- | 41 | ---help--- |
| 96 | This is a driver for the SoC CAN controller in Atmel's AT91SAM9263. | 42 | This is a driver for the SoC CAN controller in Atmel's AT91SAM9263. |
| 97 | 43 | ||
| 44 | source "drivers/net/can/sja1000/Kconfig" | ||
| 45 | |||
| 46 | source "drivers/net/can/usb/Kconfig" | ||
| 47 | |||
| 98 | config CAN_DEBUG_DEVICES | 48 | config CAN_DEBUG_DEVICES |
| 99 | bool "CAN devices debugging messages" | 49 | bool "CAN devices debugging messages" |
| 100 | depends on CAN | 50 | depends on CAN |
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index f0b9a1e1db46..2868fe842a41 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
| @@ -589,6 +589,22 @@ static int can_changelink(struct net_device *dev, | |||
| 589 | return 0; | 589 | return 0; |
| 590 | } | 590 | } |
| 591 | 591 | ||
| 592 | static size_t can_get_size(const struct net_device *dev) | ||
| 593 | { | ||
| 594 | struct can_priv *priv = netdev_priv(dev); | ||
| 595 | size_t size; | ||
| 596 | |||
| 597 | size = nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */ | ||
| 598 | size += sizeof(struct can_ctrlmode); /* IFLA_CAN_CTRLMODE */ | ||
| 599 | size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ | ||
| 600 | size += sizeof(struct can_bittiming); /* IFLA_CAN_BITTIMING */ | ||
| 601 | size += sizeof(struct can_clock); /* IFLA_CAN_CLOCK */ | ||
| 602 | if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ | ||
| 603 | size += sizeof(struct can_bittiming_const); | ||
| 604 | |||
| 605 | return size; | ||
| 606 | } | ||
| 607 | |||
| 592 | static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) | 608 | static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) |
| 593 | { | 609 | { |
| 594 | struct can_priv *priv = netdev_priv(dev); | 610 | struct can_priv *priv = netdev_priv(dev); |
| @@ -613,6 +629,11 @@ nla_put_failure: | |||
| 613 | return -EMSGSIZE; | 629 | return -EMSGSIZE; |
| 614 | } | 630 | } |
| 615 | 631 | ||
| 632 | static size_t can_get_xstats_size(const struct net_device *dev) | ||
| 633 | { | ||
| 634 | return sizeof(struct can_device_stats); | ||
| 635 | } | ||
| 636 | |||
| 616 | static int can_fill_xstats(struct sk_buff *skb, const struct net_device *dev) | 637 | static int can_fill_xstats(struct sk_buff *skb, const struct net_device *dev) |
| 617 | { | 638 | { |
| 618 | struct can_priv *priv = netdev_priv(dev); | 639 | struct can_priv *priv = netdev_priv(dev); |
| @@ -639,7 +660,9 @@ static struct rtnl_link_ops can_link_ops __read_mostly = { | |||
| 639 | .setup = can_setup, | 660 | .setup = can_setup, |
| 640 | .newlink = can_newlink, | 661 | .newlink = can_newlink, |
| 641 | .changelink = can_changelink, | 662 | .changelink = can_changelink, |
| 663 | .get_size = can_get_size, | ||
| 642 | .fill_info = can_fill_info, | 664 | .fill_info = can_fill_info, |
| 665 | .get_xstats_size = can_get_xstats_size, | ||
| 643 | .fill_xstats = can_fill_xstats, | 666 | .fill_xstats = can_fill_xstats, |
| 644 | }; | 667 | }; |
| 645 | 668 | ||
diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig new file mode 100644 index 000000000000..4c674927f247 --- /dev/null +++ b/drivers/net/can/sja1000/Kconfig | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | menuconfig CAN_SJA1000 | ||
| 2 | tristate "Philips/NXP SJA1000 devices" | ||
| 3 | depends on CAN_DEV && HAS_IOMEM | ||
| 4 | |||
| 5 | if CAN_SJA1000 | ||
| 6 | |||
| 7 | config CAN_SJA1000_ISA | ||
| 8 | tristate "ISA Bus based legacy SJA1000 driver" | ||
| 9 | depends on ISA | ||
| 10 | ---help--- | ||
| 11 | This driver adds legacy support for SJA1000 chips connected to | ||
| 12 | the ISA bus using I/O port, memory mapped or indirect access. | ||
| 13 | |||
| 14 | config CAN_SJA1000_PLATFORM | ||
| 15 | tristate "Generic Platform Bus based SJA1000 driver" | ||
| 16 | ---help--- | ||
| 17 | This driver adds support for the SJA1000 chips connected to | ||
| 18 | the "platform bus" (Linux abstraction for directly to the | ||
| 19 | processor attached devices). Which can be found on various | ||
| 20 | boards from Phytec (http://www.phytec.de) like the PCM027, | ||
| 21 | PCM038. | ||
| 22 | |||
| 23 | config CAN_SJA1000_OF_PLATFORM | ||
| 24 | tristate "Generic OF Platform Bus based SJA1000 driver" | ||
| 25 | depends on PPC_OF | ||
| 26 | ---help--- | ||
| 27 | This driver adds support for the SJA1000 chips connected to | ||
| 28 | the OpenFirmware "platform bus" found on embedded systems with | ||
| 29 | OpenFirmware bindings, e.g. if you have a PowerPC based system | ||
| 30 | you may want to enable this option. | ||
| 31 | |||
| 32 | config CAN_EMS_PCI | ||
| 33 | tristate "EMS CPC-PCI, CPC-PCIe and CPC-104P Card" | ||
| 34 | depends on PCI | ||
| 35 | ---help--- | ||
| 36 | This driver is for the one, two or four channel CPC-PCI, | ||
| 37 | CPC-PCIe and CPC-104P cards from EMS Dr. Thomas Wuensche | ||
| 38 | (http://www.ems-wuensche.de). | ||
| 39 | |||
| 40 | config CAN_KVASER_PCI | ||
| 41 | tristate "Kvaser PCIcanx and Kvaser PCIcan PCI Cards" | ||
| 42 | depends on PCI | ||
| 43 | ---help--- | ||
| 44 | This driver is for the the PCIcanx and PCIcan cards (1, 2 or | ||
| 45 | 4 channel) from Kvaser (http://www.kvaser.com). | ||
| 46 | |||
| 47 | endif | ||
diff --git a/drivers/net/can/usb/Kconfig b/drivers/net/can/usb/Kconfig new file mode 100644 index 000000000000..bbc78e0b8a15 --- /dev/null +++ b/drivers/net/can/usb/Kconfig | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | menu "CAN USB interfaces" | ||
| 2 | depends on USB && CAN_DEV | ||
| 3 | |||
| 4 | config CAN_EMS_USB | ||
| 5 | tristate "EMS CPC-USB/ARM7 CAN/USB interface" | ||
| 6 | ---help--- | ||
| 7 | This driver is for the one channel CPC-USB/ARM7 CAN/USB interface | ||
| 8 | from from EMS Dr. Thomas Wuensche (http://www.ems-wuensche.de). | ||
| 9 | |||
| 10 | endmenu | ||
diff --git a/drivers/net/can/usb/Makefile b/drivers/net/can/usb/Makefile index c3f75ba701b1..0afd51d4c7a5 100644 --- a/drivers/net/can/usb/Makefile +++ b/drivers/net/can/usb/Makefile | |||
| @@ -3,3 +3,5 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | obj-$(CONFIG_CAN_EMS_USB) += ems_usb.o | 5 | obj-$(CONFIG_CAN_EMS_USB) += ems_usb.o |
| 6 | |||
| 7 | ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG | ||
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 9012e0abc626..abdbd9c2b788 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c | |||
| @@ -319,7 +319,7 @@ static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg) | |||
| 319 | 319 | ||
| 320 | cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame)); | 320 | cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame)); |
| 321 | 321 | ||
| 322 | cf->can_id = msg->msg.can_msg.id; | 322 | cf->can_id = le32_to_cpu(msg->msg.can_msg.id); |
| 323 | cf->can_dlc = min_t(u8, msg->msg.can_msg.length, 8); | 323 | cf->can_dlc = min_t(u8, msg->msg.can_msg.length, 8); |
| 324 | 324 | ||
| 325 | if (msg->type == CPC_MSG_TYPE_EXT_CAN_FRAME | 325 | if (msg->type == CPC_MSG_TYPE_EXT_CAN_FRAME |
| @@ -813,6 +813,9 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne | |||
| 813 | msg->length = CPC_CAN_MSG_MIN_SIZE + cf->can_dlc; | 813 | msg->length = CPC_CAN_MSG_MIN_SIZE + cf->can_dlc; |
| 814 | } | 814 | } |
| 815 | 815 | ||
| 816 | /* Respect byte order */ | ||
| 817 | msg->msg.can_msg.id = cpu_to_le32(msg->msg.can_msg.id); | ||
| 818 | |||
| 816 | for (i = 0; i < MAX_TX_URBS; i++) { | 819 | for (i = 0; i < MAX_TX_URBS; i++) { |
| 817 | if (dev->tx_contexts[i].echo_index == MAX_TX_URBS) { | 820 | if (dev->tx_contexts[i].echo_index == MAX_TX_URBS) { |
| 818 | context = &dev->tx_contexts[i]; | 821 | context = &dev->tx_contexts[i]; |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 05916aafa4f1..f857afe8e488 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
| @@ -4342,11 +4342,11 @@ static int cas_open(struct net_device *dev) | |||
| 4342 | cas_unlock_all_restore(cp, flags); | 4342 | cas_unlock_all_restore(cp, flags); |
| 4343 | } | 4343 | } |
| 4344 | 4344 | ||
| 4345 | err = -ENOMEM; | ||
| 4345 | if (cas_tx_tiny_alloc(cp) < 0) | 4346 | if (cas_tx_tiny_alloc(cp) < 0) |
| 4346 | return -ENOMEM; | 4347 | goto err_unlock; |
| 4347 | 4348 | ||
| 4348 | /* alloc rx descriptors */ | 4349 | /* alloc rx descriptors */ |
| 4349 | err = -ENOMEM; | ||
| 4350 | if (cas_alloc_rxds(cp) < 0) | 4350 | if (cas_alloc_rxds(cp) < 0) |
| 4351 | goto err_tx_tiny; | 4351 | goto err_tx_tiny; |
| 4352 | 4352 | ||
| @@ -4386,6 +4386,7 @@ err_spare: | |||
| 4386 | cas_free_rxds(cp); | 4386 | cas_free_rxds(cp); |
| 4387 | err_tx_tiny: | 4387 | err_tx_tiny: |
| 4388 | cas_tx_tiny_free(cp); | 4388 | cas_tx_tiny_free(cp); |
| 4389 | err_unlock: | ||
| 4389 | mutex_unlock(&cp->pm_mutex); | 4390 | mutex_unlock(&cp->pm_mutex); |
| 4390 | return err; | 4391 | return err; |
| 4391 | } | 4392 | } |
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index f86612857a73..6366061712f4 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
| @@ -879,7 +879,7 @@ recycle: | |||
| 879 | pci_dma_sync_single_for_cpu(adap->pdev, dma_addr, len, | 879 | pci_dma_sync_single_for_cpu(adap->pdev, dma_addr, len, |
| 880 | PCI_DMA_FROMDEVICE); | 880 | PCI_DMA_FROMDEVICE); |
| 881 | (*sd->pg_chunk.p_cnt)--; | 881 | (*sd->pg_chunk.p_cnt)--; |
| 882 | if (!*sd->pg_chunk.p_cnt) | 882 | if (!*sd->pg_chunk.p_cnt && sd->pg_chunk.page != fl->pg_chunk.page) |
| 883 | pci_unmap_page(adap->pdev, | 883 | pci_unmap_page(adap->pdev, |
| 884 | sd->pg_chunk.mapping, | 884 | sd->pg_chunk.mapping, |
| 885 | fl->alloc_size, | 885 | fl->alloc_size, |
| @@ -2088,7 +2088,7 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs, | |||
| 2088 | PCI_DMA_FROMDEVICE); | 2088 | PCI_DMA_FROMDEVICE); |
| 2089 | 2089 | ||
| 2090 | (*sd->pg_chunk.p_cnt)--; | 2090 | (*sd->pg_chunk.p_cnt)--; |
| 2091 | if (!*sd->pg_chunk.p_cnt) | 2091 | if (!*sd->pg_chunk.p_cnt && sd->pg_chunk.page != fl->pg_chunk.page) |
| 2092 | pci_unmap_page(adap->pdev, | 2092 | pci_unmap_page(adap->pdev, |
| 2093 | sd->pg_chunk.mapping, | 2093 | sd->pg_chunk.mapping, |
| 2094 | fl->alloc_size, | 2094 | fl->alloc_size, |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index f72c56dec33c..e3478314c002 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
| @@ -164,16 +164,14 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1"; | |||
| 164 | # define EMAC_MBP_MCASTCHAN(ch) ((ch) & 0x7) | 164 | # define EMAC_MBP_MCASTCHAN(ch) ((ch) & 0x7) |
| 165 | 165 | ||
| 166 | /* EMAC mac_control register */ | 166 | /* EMAC mac_control register */ |
| 167 | #define EMAC_MACCONTROL_TXPTYPE (0x200) | 167 | #define EMAC_MACCONTROL_TXPTYPE BIT(9) |
| 168 | #define EMAC_MACCONTROL_TXPACEEN (0x40) | 168 | #define EMAC_MACCONTROL_TXPACEEN BIT(6) |
| 169 | #define EMAC_MACCONTROL_MIIEN (0x20) | 169 | #define EMAC_MACCONTROL_GMIIEN BIT(5) |
| 170 | #define EMAC_MACCONTROL_GIGABITEN (0x80) | 170 | #define EMAC_MACCONTROL_GIGABITEN BIT(7) |
| 171 | #define EMAC_MACCONTROL_GIGABITEN_SHIFT (7) | 171 | #define EMAC_MACCONTROL_FULLDUPLEXEN BIT(0) |
| 172 | #define EMAC_MACCONTROL_FULLDUPLEXEN (0x1) | ||
| 173 | #define EMAC_MACCONTROL_RMIISPEED_MASK BIT(15) | 172 | #define EMAC_MACCONTROL_RMIISPEED_MASK BIT(15) |
| 174 | 173 | ||
| 175 | /* GIGABIT MODE related bits */ | 174 | /* GIGABIT MODE related bits */ |
| 176 | #define EMAC_DM646X_MACCONTORL_GMIIEN BIT(5) | ||
| 177 | #define EMAC_DM646X_MACCONTORL_GIG BIT(7) | 175 | #define EMAC_DM646X_MACCONTORL_GIG BIT(7) |
| 178 | #define EMAC_DM646X_MACCONTORL_GIGFORCE BIT(17) | 176 | #define EMAC_DM646X_MACCONTORL_GIGFORCE BIT(17) |
| 179 | 177 | ||
| @@ -192,10 +190,10 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1"; | |||
| 192 | #define EMAC_RX_BUFFER_OFFSET_MASK (0xFFFF) | 190 | #define EMAC_RX_BUFFER_OFFSET_MASK (0xFFFF) |
| 193 | 191 | ||
| 194 | /* MAC_IN_VECTOR (0x180) register bit fields */ | 192 | /* MAC_IN_VECTOR (0x180) register bit fields */ |
| 195 | #define EMAC_DM644X_MAC_IN_VECTOR_HOST_INT (0x20000) | 193 | #define EMAC_DM644X_MAC_IN_VECTOR_HOST_INT BIT(17) |
| 196 | #define EMAC_DM644X_MAC_IN_VECTOR_STATPEND_INT (0x10000) | 194 | #define EMAC_DM644X_MAC_IN_VECTOR_STATPEND_INT BIT(16) |
| 197 | #define EMAC_DM644X_MAC_IN_VECTOR_RX_INT_VEC (0x0100) | 195 | #define EMAC_DM644X_MAC_IN_VECTOR_RX_INT_VEC BIT(8) |
| 198 | #define EMAC_DM644X_MAC_IN_VECTOR_TX_INT_VEC (0x01) | 196 | #define EMAC_DM644X_MAC_IN_VECTOR_TX_INT_VEC BIT(0) |
| 199 | 197 | ||
| 200 | /** NOTE:: For DM646x the IN_VECTOR has changed */ | 198 | /** NOTE:: For DM646x the IN_VECTOR has changed */ |
| 201 | #define EMAC_DM646X_MAC_IN_VECTOR_RX_INT_VEC BIT(EMAC_DEF_RX_CH) | 199 | #define EMAC_DM646X_MAC_IN_VECTOR_RX_INT_VEC BIT(EMAC_DEF_RX_CH) |
| @@ -203,7 +201,6 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1"; | |||
| 203 | #define EMAC_DM646X_MAC_IN_VECTOR_HOST_INT BIT(26) | 201 | #define EMAC_DM646X_MAC_IN_VECTOR_HOST_INT BIT(26) |
| 204 | #define EMAC_DM646X_MAC_IN_VECTOR_STATPEND_INT BIT(27) | 202 | #define EMAC_DM646X_MAC_IN_VECTOR_STATPEND_INT BIT(27) |
| 205 | 203 | ||
| 206 | |||
| 207 | /* CPPI bit positions */ | 204 | /* CPPI bit positions */ |
| 208 | #define EMAC_CPPI_SOP_BIT BIT(31) | 205 | #define EMAC_CPPI_SOP_BIT BIT(31) |
| 209 | #define EMAC_CPPI_EOP_BIT BIT(30) | 206 | #define EMAC_CPPI_EOP_BIT BIT(30) |
| @@ -750,8 +747,7 @@ static void emac_update_phystatus(struct emac_priv *priv) | |||
| 750 | 747 | ||
| 751 | if (priv->speed == SPEED_1000 && (priv->version == EMAC_VERSION_2)) { | 748 | if (priv->speed == SPEED_1000 && (priv->version == EMAC_VERSION_2)) { |
| 752 | mac_control = emac_read(EMAC_MACCONTROL); | 749 | mac_control = emac_read(EMAC_MACCONTROL); |
| 753 | mac_control |= (EMAC_DM646X_MACCONTORL_GMIIEN | | 750 | mac_control |= (EMAC_DM646X_MACCONTORL_GIG | |
| 754 | EMAC_DM646X_MACCONTORL_GIG | | ||
| 755 | EMAC_DM646X_MACCONTORL_GIGFORCE); | 751 | EMAC_DM646X_MACCONTORL_GIGFORCE); |
| 756 | } else { | 752 | } else { |
| 757 | /* Clear the GIG bit and GIGFORCE bit */ | 753 | /* Clear the GIG bit and GIGFORCE bit */ |
| @@ -2108,7 +2104,7 @@ static int emac_hw_enable(struct emac_priv *priv) | |||
| 2108 | 2104 | ||
| 2109 | /* Enable MII */ | 2105 | /* Enable MII */ |
| 2110 | val = emac_read(EMAC_MACCONTROL); | 2106 | val = emac_read(EMAC_MACCONTROL); |
| 2111 | val |= (EMAC_MACCONTROL_MIIEN); | 2107 | val |= (EMAC_MACCONTROL_GMIIEN); |
| 2112 | emac_write(EMAC_MACCONTROL, val); | 2108 | emac_write(EMAC_MACCONTROL, val); |
| 2113 | 2109 | ||
| 2114 | /* Enable NAPI and interrupts */ | 2110 | /* Enable NAPI and interrupts */ |
| @@ -2140,9 +2136,6 @@ static int emac_poll(struct napi_struct *napi, int budget) | |||
| 2140 | u32 status = 0; | 2136 | u32 status = 0; |
| 2141 | u32 num_pkts = 0; | 2137 | u32 num_pkts = 0; |
| 2142 | 2138 | ||
| 2143 | if (!netif_running(ndev)) | ||
| 2144 | return 0; | ||
| 2145 | |||
| 2146 | /* Check interrupt vectors and call packet processing */ | 2139 | /* Check interrupt vectors and call packet processing */ |
| 2147 | status = emac_read(EMAC_MACINVECTOR); | 2140 | status = emac_read(EMAC_MACINVECTOR); |
| 2148 | 2141 | ||
| @@ -2221,7 +2214,7 @@ void emac_poll_controller(struct net_device *ndev) | |||
| 2221 | struct emac_priv *priv = netdev_priv(ndev); | 2214 | struct emac_priv *priv = netdev_priv(ndev); |
| 2222 | 2215 | ||
| 2223 | emac_int_disable(priv); | 2216 | emac_int_disable(priv); |
| 2224 | emac_irq(ndev->irq, priv); | 2217 | emac_irq(ndev->irq, ndev); |
| 2225 | emac_int_enable(priv); | 2218 | emac_int_enable(priv); |
| 2226 | } | 2219 | } |
| 2227 | #endif | 2220 | #endif |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 3c29a20b751e..d269a68ce354 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
| @@ -157,6 +157,7 @@ | |||
| 157 | #include <linux/init.h> | 157 | #include <linux/init.h> |
| 158 | #include <linux/pci.h> | 158 | #include <linux/pci.h> |
| 159 | #include <linux/dma-mapping.h> | 159 | #include <linux/dma-mapping.h> |
| 160 | #include <linux/dmapool.h> | ||
| 160 | #include <linux/netdevice.h> | 161 | #include <linux/netdevice.h> |
| 161 | #include <linux/etherdevice.h> | 162 | #include <linux/etherdevice.h> |
| 162 | #include <linux/mii.h> | 163 | #include <linux/mii.h> |
| @@ -602,6 +603,7 @@ struct nic { | |||
| 602 | struct mem *mem; | 603 | struct mem *mem; |
| 603 | dma_addr_t dma_addr; | 604 | dma_addr_t dma_addr; |
| 604 | 605 | ||
| 606 | struct pci_pool *cbs_pool; | ||
| 605 | dma_addr_t cbs_dma_addr; | 607 | dma_addr_t cbs_dma_addr; |
| 606 | u8 adaptive_ifs; | 608 | u8 adaptive_ifs; |
| 607 | u8 tx_threshold; | 609 | u8 tx_threshold; |
| @@ -1793,9 +1795,7 @@ static void e100_clean_cbs(struct nic *nic) | |||
| 1793 | nic->cb_to_clean = nic->cb_to_clean->next; | 1795 | nic->cb_to_clean = nic->cb_to_clean->next; |
| 1794 | nic->cbs_avail++; | 1796 | nic->cbs_avail++; |
| 1795 | } | 1797 | } |
| 1796 | pci_free_consistent(nic->pdev, | 1798 | pci_pool_free(nic->cbs_pool, nic->cbs, nic->cbs_dma_addr); |
| 1797 | sizeof(struct cb) * nic->params.cbs.count, | ||
| 1798 | nic->cbs, nic->cbs_dma_addr); | ||
| 1799 | nic->cbs = NULL; | 1799 | nic->cbs = NULL; |
| 1800 | nic->cbs_avail = 0; | 1800 | nic->cbs_avail = 0; |
| 1801 | } | 1801 | } |
| @@ -1813,8 +1813,8 @@ static int e100_alloc_cbs(struct nic *nic) | |||
| 1813 | nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = NULL; | 1813 | nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = NULL; |
| 1814 | nic->cbs_avail = 0; | 1814 | nic->cbs_avail = 0; |
| 1815 | 1815 | ||
| 1816 | nic->cbs = pci_alloc_consistent(nic->pdev, | 1816 | nic->cbs = pci_pool_alloc(nic->cbs_pool, GFP_KERNEL, |
| 1817 | sizeof(struct cb) * count, &nic->cbs_dma_addr); | 1817 | &nic->cbs_dma_addr); |
| 1818 | if (!nic->cbs) | 1818 | if (!nic->cbs) |
| 1819 | return -ENOMEM; | 1819 | return -ENOMEM; |
| 1820 | 1820 | ||
| @@ -2841,7 +2841,11 @@ static int __devinit e100_probe(struct pci_dev *pdev, | |||
| 2841 | DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n"); | 2841 | DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n"); |
| 2842 | goto err_out_free; | 2842 | goto err_out_free; |
| 2843 | } | 2843 | } |
| 2844 | 2844 | nic->cbs_pool = pci_pool_create(netdev->name, | |
| 2845 | nic->pdev, | ||
| 2846 | nic->params.cbs.count * sizeof(struct cb), | ||
| 2847 | sizeof(u32), | ||
| 2848 | 0); | ||
| 2845 | DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n", | 2849 | DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n", |
| 2846 | (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0), | 2850 | (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0), |
| 2847 | pdev->irq, netdev->dev_addr); | 2851 | pdev->irq, netdev->dev_addr); |
| @@ -2871,6 +2875,7 @@ static void __devexit e100_remove(struct pci_dev *pdev) | |||
| 2871 | unregister_netdev(netdev); | 2875 | unregister_netdev(netdev); |
| 2872 | e100_free(nic); | 2876 | e100_free(nic); |
| 2873 | pci_iounmap(pdev, nic->csr); | 2877 | pci_iounmap(pdev, nic->csr); |
| 2878 | pci_pool_destroy(nic->cbs_pool); | ||
| 2874 | free_netdev(netdev); | 2879 | free_netdev(netdev); |
| 2875 | pci_release_regions(pdev); | 2880 | pci_release_regions(pdev); |
| 2876 | pci_disable_device(pdev); | 2881 | pci_disable_device(pdev); |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 189dfa2d6c76..3e187b0e4203 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
| @@ -141,6 +141,8 @@ struct e1000_info; | |||
| 141 | #define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */ | 141 | #define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */ |
| 142 | #define HV_TNCRS_LOWER PHY_REG(778, 30) | 142 | #define HV_TNCRS_LOWER PHY_REG(778, 30) |
| 143 | 143 | ||
| 144 | #define E1000_FCRTV_PCH 0x05F40 /* PCH Flow Control Refresh Timer Value */ | ||
| 145 | |||
| 144 | /* BM PHY Copper Specific Status */ | 146 | /* BM PHY Copper Specific Status */ |
| 145 | #define BM_CS_STATUS 17 | 147 | #define BM_CS_STATUS 17 |
| 146 | #define BM_CS_STATUS_LINK_UP 0x0400 | 148 | #define BM_CS_STATUS_LINK_UP 0x0400 |
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 1bf4d2a5d34f..e82638ecae88 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
| @@ -327,10 +327,18 @@ static int e1000_set_pauseparam(struct net_device *netdev, | |||
| 327 | 327 | ||
| 328 | hw->fc.current_mode = hw->fc.requested_mode; | 328 | hw->fc.current_mode = hw->fc.requested_mode; |
| 329 | 329 | ||
| 330 | retval = ((hw->phy.media_type == e1000_media_type_fiber) ? | 330 | if (hw->phy.media_type == e1000_media_type_fiber) { |
| 331 | hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw)); | 331 | retval = hw->mac.ops.setup_link(hw); |
| 332 | /* implicit goto out */ | ||
| 333 | } else { | ||
| 334 | retval = e1000e_force_mac_fc(hw); | ||
| 335 | if (retval) | ||
| 336 | goto out; | ||
| 337 | e1000e_set_fc_watermarks(hw); | ||
| 338 | } | ||
| 332 | } | 339 | } |
| 333 | 340 | ||
| 341 | out: | ||
| 334 | clear_bit(__E1000_RESETTING, &adapter->state); | 342 | clear_bit(__E1000_RESETTING, &adapter->state); |
| 335 | return retval; | 343 | return retval; |
| 336 | } | 344 | } |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 51ddb04ab195..eff3f4783655 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
| @@ -1118,7 +1118,8 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) | |||
| 1118 | oem_reg |= HV_OEM_BITS_LPLU; | 1118 | oem_reg |= HV_OEM_BITS_LPLU; |
| 1119 | } | 1119 | } |
| 1120 | /* Restart auto-neg to activate the bits */ | 1120 | /* Restart auto-neg to activate the bits */ |
| 1121 | oem_reg |= HV_OEM_BITS_RESTART_AN; | 1121 | if (!e1000_check_reset_block(hw)) |
| 1122 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
| 1122 | ret_val = hw->phy.ops.write_phy_reg_locked(hw, HV_OEM_BITS, oem_reg); | 1123 | ret_val = hw->phy.ops.write_phy_reg_locked(hw, HV_OEM_BITS, oem_reg); |
| 1123 | 1124 | ||
| 1124 | out: | 1125 | out: |
| @@ -3558,6 +3559,7 @@ struct e1000_info e1000_pch_info = { | |||
| 3558 | | FLAG_HAS_AMT | 3559 | | FLAG_HAS_AMT |
| 3559 | | FLAG_HAS_FLASH | 3560 | | FLAG_HAS_FLASH |
| 3560 | | FLAG_HAS_JUMBO_FRAMES | 3561 | | FLAG_HAS_JUMBO_FRAMES |
| 3562 | | FLAG_DISABLE_FC_PAUSE_TIME /* errata */ | ||
| 3561 | | FLAG_APME_IN_WUC, | 3563 | | FLAG_APME_IN_WUC, |
| 3562 | .pba = 26, | 3564 | .pba = 26, |
| 3563 | .max_hw_frame_size = 4096, | 3565 | .max_hw_frame_size = 4096, |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 0687c6aa4e46..fad8f9ea0043 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
| @@ -2769,25 +2769,38 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
| 2769 | /* | 2769 | /* |
| 2770 | * flow control settings | 2770 | * flow control settings |
| 2771 | * | 2771 | * |
| 2772 | * The high water mark must be low enough to fit two full frame | 2772 | * The high water mark must be low enough to fit one full frame |
| 2773 | * (or the size used for early receive) above it in the Rx FIFO. | 2773 | * (or the size used for early receive) above it in the Rx FIFO. |
| 2774 | * Set it to the lower of: | 2774 | * Set it to the lower of: |
| 2775 | * - 90% of the Rx FIFO size, and | 2775 | * - 90% of the Rx FIFO size, and |
| 2776 | * - the full Rx FIFO size minus the early receive size (for parts | 2776 | * - the full Rx FIFO size minus the early receive size (for parts |
| 2777 | * with ERT support assuming ERT set to E1000_ERT_2048), or | 2777 | * with ERT support assuming ERT set to E1000_ERT_2048), or |
| 2778 | * - the full Rx FIFO size minus two full frames | 2778 | * - the full Rx FIFO size minus one full frame |
| 2779 | */ | 2779 | */ |
| 2780 | if ((adapter->flags & FLAG_HAS_ERT) && | 2780 | if (hw->mac.type == e1000_pchlan) { |
| 2781 | (adapter->netdev->mtu > ETH_DATA_LEN)) | 2781 | /* |
| 2782 | hwm = min(((pba << 10) * 9 / 10), | 2782 | * Workaround PCH LOM adapter hangs with certain network |
| 2783 | ((pba << 10) - (E1000_ERT_2048 << 3))); | 2783 | * loads. If hangs persist, try disabling Tx flow control. |
| 2784 | else | 2784 | */ |
| 2785 | hwm = min(((pba << 10) * 9 / 10), | 2785 | if (adapter->netdev->mtu > ETH_DATA_LEN) { |
| 2786 | ((pba << 10) - (2 * adapter->max_frame_size))); | 2786 | fc->high_water = 0x3500; |
| 2787 | fc->low_water = 0x1500; | ||
| 2788 | } else { | ||
| 2789 | fc->high_water = 0x5000; | ||
| 2790 | fc->low_water = 0x3000; | ||
| 2791 | } | ||
| 2792 | } else { | ||
| 2793 | if ((adapter->flags & FLAG_HAS_ERT) && | ||
| 2794 | (adapter->netdev->mtu > ETH_DATA_LEN)) | ||
| 2795 | hwm = min(((pba << 10) * 9 / 10), | ||
| 2796 | ((pba << 10) - (E1000_ERT_2048 << 3))); | ||
| 2797 | else | ||
| 2798 | hwm = min(((pba << 10) * 9 / 10), | ||
| 2799 | ((pba << 10) - adapter->max_frame_size)); | ||
| 2787 | 2800 | ||
| 2788 | fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */ | 2801 | fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */ |
| 2789 | fc->low_water = (fc->high_water - (2 * adapter->max_frame_size)); | 2802 | fc->low_water = fc->high_water - 8; |
| 2790 | fc->low_water &= E1000_FCRTL_RTL; /* 8-byte granularity */ | 2803 | } |
| 2791 | 2804 | ||
| 2792 | if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME) | 2805 | if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME) |
| 2793 | fc->pause_time = 0xFFFF; | 2806 | fc->pause_time = 0xFFFF; |
| @@ -2813,6 +2826,10 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
| 2813 | if (mac->ops.init_hw(hw)) | 2826 | if (mac->ops.init_hw(hw)) |
| 2814 | e_err("Hardware Error\n"); | 2827 | e_err("Hardware Error\n"); |
| 2815 | 2828 | ||
| 2829 | /* additional part of the flow-control workaround above */ | ||
| 2830 | if (hw->mac.type == e1000_pchlan) | ||
| 2831 | ew32(FCRTV_PCH, 0x1000); | ||
| 2832 | |||
| 2816 | e1000_update_mng_vlan(adapter); | 2833 | e1000_update_mng_vlan(adapter); |
| 2817 | 2834 | ||
| 2818 | /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ | 2835 | /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ |
| @@ -3610,7 +3627,7 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
| 3610 | case SPEED_100: | 3627 | case SPEED_100: |
| 3611 | txb2b = 0; | 3628 | txb2b = 0; |
| 3612 | netdev->tx_queue_len = 100; | 3629 | netdev->tx_queue_len = 100; |
| 3613 | /* maybe add some timeout factor ? */ | 3630 | adapter->tx_timeout_factor = 10; |
| 3614 | break; | 3631 | break; |
| 3615 | } | 3632 | } |
| 3616 | 3633 | ||
| @@ -4288,8 +4305,10 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
| 4288 | 4305 | ||
| 4289 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) | 4306 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
| 4290 | msleep(1); | 4307 | msleep(1); |
| 4291 | /* e1000e_down has a dependency on max_frame_size */ | 4308 | /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */ |
| 4292 | adapter->max_frame_size = max_frame; | 4309 | adapter->max_frame_size = max_frame; |
| 4310 | e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu); | ||
| 4311 | netdev->mtu = new_mtu; | ||
| 4293 | if (netif_running(netdev)) | 4312 | if (netif_running(netdev)) |
| 4294 | e1000e_down(adapter); | 4313 | e1000e_down(adapter); |
| 4295 | 4314 | ||
| @@ -4319,9 +4338,6 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
| 4319 | adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN | 4338 | adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN |
| 4320 | + ETH_FCS_LEN; | 4339 | + ETH_FCS_LEN; |
| 4321 | 4340 | ||
| 4322 | e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu); | ||
| 4323 | netdev->mtu = new_mtu; | ||
| 4324 | |||
| 4325 | if (netif_running(netdev)) | 4341 | if (netif_running(netdev)) |
| 4326 | e1000e_up(adapter); | 4342 | e1000e_up(adapter); |
| 4327 | else | 4343 | else |
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index 03175b3a2c9e..85f955f70417 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
| @@ -71,7 +71,6 @@ static const u16 e1000_igp_2_cable_length_table[] = | |||
| 71 | #define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15) | 71 | #define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15) |
| 72 | #define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */ | 72 | #define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */ |
| 73 | #define I82577_CTRL_REG 23 | 73 | #define I82577_CTRL_REG 23 |
| 74 | #define I82577_CTRL_DOWNSHIFT_MASK (7 << 10) | ||
| 75 | 74 | ||
| 76 | /* 82577 specific PHY registers */ | 75 | /* 82577 specific PHY registers */ |
| 77 | #define I82577_PHY_CTRL_2 18 | 76 | #define I82577_PHY_CTRL_2 18 |
| @@ -660,15 +659,6 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) | |||
| 660 | phy_data |= I82577_CFG_ENABLE_DOWNSHIFT; | 659 | phy_data |= I82577_CFG_ENABLE_DOWNSHIFT; |
| 661 | 660 | ||
| 662 | ret_val = phy->ops.write_phy_reg(hw, I82577_CFG_REG, phy_data); | 661 | ret_val = phy->ops.write_phy_reg(hw, I82577_CFG_REG, phy_data); |
| 663 | if (ret_val) | ||
| 664 | goto out; | ||
| 665 | |||
| 666 | /* Set number of link attempts before downshift */ | ||
| 667 | ret_val = phy->ops.read_phy_reg(hw, I82577_CTRL_REG, &phy_data); | ||
| 668 | if (ret_val) | ||
| 669 | goto out; | ||
| 670 | phy_data &= ~I82577_CTRL_DOWNSHIFT_MASK; | ||
| 671 | ret_val = phy->ops.write_phy_reg(hw, I82577_CTRL_REG, phy_data); | ||
| 672 | 662 | ||
| 673 | out: | 663 | out: |
| 674 | return ret_val; | 664 | return ret_val; |
| @@ -2658,19 +2648,18 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, | |||
| 2658 | page = 0; | 2648 | page = 0; |
| 2659 | 2649 | ||
| 2660 | if (reg > MAX_PHY_MULTI_PAGE_REG) { | 2650 | if (reg > MAX_PHY_MULTI_PAGE_REG) { |
| 2661 | if ((hw->phy.type != e1000_phy_82578) || | 2651 | u32 phy_addr = hw->phy.addr; |
| 2662 | ((reg != I82578_ADDR_REG) && | ||
| 2663 | (reg != I82578_ADDR_REG + 1))) { | ||
| 2664 | u32 phy_addr = hw->phy.addr; | ||
| 2665 | 2652 | ||
| 2666 | hw->phy.addr = 1; | 2653 | hw->phy.addr = 1; |
| 2667 | 2654 | ||
| 2668 | /* Page is shifted left, PHY expects (page x 32) */ | 2655 | /* Page is shifted left, PHY expects (page x 32) */ |
| 2669 | ret_val = e1000e_write_phy_reg_mdic(hw, | 2656 | ret_val = e1000e_write_phy_reg_mdic(hw, |
| 2670 | IGP01E1000_PHY_PAGE_SELECT, | 2657 | IGP01E1000_PHY_PAGE_SELECT, |
| 2671 | (page << IGP_PAGE_SHIFT)); | 2658 | (page << IGP_PAGE_SHIFT)); |
| 2672 | hw->phy.addr = phy_addr; | 2659 | hw->phy.addr = phy_addr; |
| 2673 | } | 2660 | |
| 2661 | if (ret_val) | ||
| 2662 | goto out; | ||
| 2674 | } | 2663 | } |
| 2675 | 2664 | ||
| 2676 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, | 2665 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, |
| @@ -2678,7 +2667,7 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, | |||
| 2678 | out: | 2667 | out: |
| 2679 | /* Revert to MDIO fast mode, if applicable */ | 2668 | /* Revert to MDIO fast mode, if applicable */ |
| 2680 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) | 2669 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) |
| 2681 | ret_val = e1000_set_mdio_slow_mode_hv(hw, false); | 2670 | ret_val |= e1000_set_mdio_slow_mode_hv(hw, false); |
| 2682 | 2671 | ||
| 2683 | if (!locked) | 2672 | if (!locked) |
| 2684 | hw->phy.ops.release_phy(hw); | 2673 | hw->phy.ops.release_phy(hw); |
| @@ -2784,19 +2773,18 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, | |||
| 2784 | } | 2773 | } |
| 2785 | 2774 | ||
| 2786 | if (reg > MAX_PHY_MULTI_PAGE_REG) { | 2775 | if (reg > MAX_PHY_MULTI_PAGE_REG) { |
| 2787 | if ((hw->phy.type != e1000_phy_82578) || | 2776 | u32 phy_addr = hw->phy.addr; |
| 2788 | ((reg != I82578_ADDR_REG) && | ||
| 2789 | (reg != I82578_ADDR_REG + 1))) { | ||
| 2790 | u32 phy_addr = hw->phy.addr; | ||
| 2791 | 2777 | ||
| 2792 | hw->phy.addr = 1; | 2778 | hw->phy.addr = 1; |
| 2793 | 2779 | ||
| 2794 | /* Page is shifted left, PHY expects (page x 32) */ | 2780 | /* Page is shifted left, PHY expects (page x 32) */ |
| 2795 | ret_val = e1000e_write_phy_reg_mdic(hw, | 2781 | ret_val = e1000e_write_phy_reg_mdic(hw, |
| 2796 | IGP01E1000_PHY_PAGE_SELECT, | 2782 | IGP01E1000_PHY_PAGE_SELECT, |
| 2797 | (page << IGP_PAGE_SHIFT)); | 2783 | (page << IGP_PAGE_SHIFT)); |
| 2798 | hw->phy.addr = phy_addr; | 2784 | hw->phy.addr = phy_addr; |
| 2799 | } | 2785 | |
| 2786 | if (ret_val) | ||
| 2787 | goto out; | ||
| 2800 | } | 2788 | } |
| 2801 | 2789 | ||
| 2802 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, | 2790 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, |
| @@ -2805,7 +2793,7 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, | |||
| 2805 | out: | 2793 | out: |
| 2806 | /* Revert to MDIO fast mode, if applicable */ | 2794 | /* Revert to MDIO fast mode, if applicable */ |
| 2807 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) | 2795 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) |
| 2808 | ret_val = e1000_set_mdio_slow_mode_hv(hw, false); | 2796 | ret_val |= e1000_set_mdio_slow_mode_hv(hw, false); |
| 2809 | 2797 | ||
| 2810 | if (!locked) | 2798 | if (!locked) |
| 2811 | hw->phy.ops.release_phy(hw); | 2799 | hw->phy.ops.release_phy(hw); |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index e1da4666f204..3116601dbfea 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
| @@ -5821,10 +5821,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
| 5821 | dev->dev_addr); | 5821 | dev->dev_addr); |
| 5822 | dev_printk(KERN_ERR, &pci_dev->dev, | 5822 | dev_printk(KERN_ERR, &pci_dev->dev, |
| 5823 | "Please complain to your hardware vendor. Switching to a random MAC.\n"); | 5823 | "Please complain to your hardware vendor. Switching to a random MAC.\n"); |
| 5824 | dev->dev_addr[0] = 0x00; | 5824 | random_ether_addr(dev->dev_addr); |
| 5825 | dev->dev_addr[1] = 0x00; | ||
| 5826 | dev->dev_addr[2] = 0x6c; | ||
| 5827 | get_random_bytes(&dev->dev_addr[3], 3); | ||
| 5828 | } | 5825 | } |
| 5829 | 5826 | ||
| 5830 | dprintk(KERN_DEBUG "%s: MAC Address %pM\n", | 5827 | dprintk(KERN_DEBUG "%s: MAC Address %pM\n", |
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c index 6ac464866972..efbf67689eca 100644 --- a/drivers/net/fsl_pq_mdio.c +++ b/drivers/net/fsl_pq_mdio.c | |||
| @@ -427,3 +427,4 @@ void fsl_pq_mdio_exit(void) | |||
| 427 | of_unregister_platform_driver(&fsl_pq_mdio_driver); | 427 | of_unregister_platform_driver(&fsl_pq_mdio_driver); |
| 428 | } | 428 | } |
| 429 | module_exit(fsl_pq_mdio_exit); | 429 | module_exit(fsl_pq_mdio_exit); |
| 430 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h index d34adf99fc6a..8a61b597a169 100644 --- a/drivers/net/ibm_newemac/emac.h +++ b/drivers/net/ibm_newemac/emac.h | |||
| @@ -263,8 +263,8 @@ struct emac_regs { | |||
| 263 | 263 | ||
| 264 | 264 | ||
| 265 | /* EMACx_TRTR */ | 265 | /* EMACx_TRTR */ |
| 266 | #define EMAC_TRTR_SHIFT_EMAC4 27 | 266 | #define EMAC_TRTR_SHIFT_EMAC4 24 |
| 267 | #define EMAC_TRTR_SHIFT 24 | 267 | #define EMAC_TRTR_SHIFT 27 |
| 268 | 268 | ||
| 269 | /* EMAC specific TX descriptor control fields (write access) */ | 269 | /* EMAC specific TX descriptor control fields (write access) */ |
| 270 | #define EMAC_TX_CTRL_GFCS 0x0200 | 270 | #define EMAC_TX_CTRL_GFCS 0x0200 |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index cbb143ca1eb8..a456578b8578 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | 44 | ||
| 45 | #include "ixgbe.h" | 45 | #include "ixgbe.h" |
| 46 | #include "ixgbe_common.h" | 46 | #include "ixgbe_common.h" |
| 47 | #include "ixgbe_dcb_82599.h" | ||
| 47 | 48 | ||
| 48 | char ixgbe_driver_name[] = "ixgbe"; | 49 | char ixgbe_driver_name[] = "ixgbe"; |
| 49 | static const char ixgbe_driver_string[] = | 50 | static const char ixgbe_driver_string[] = |
| @@ -226,6 +227,56 @@ static void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter, | |||
| 226 | /* tx_buffer_info must be completely set up in the transmit path */ | 227 | /* tx_buffer_info must be completely set up in the transmit path */ |
| 227 | } | 228 | } |
| 228 | 229 | ||
| 230 | /** | ||
| 231 | * ixgbe_tx_is_paused - check if the tx ring is paused | ||
| 232 | * @adapter: the ixgbe adapter | ||
| 233 | * @tx_ring: the corresponding tx_ring | ||
| 234 | * | ||
| 235 | * If not in DCB mode, checks TFCS.TXOFF, otherwise, find out the | ||
| 236 | * corresponding TC of this tx_ring when checking TFCS. | ||
| 237 | * | ||
| 238 | * Returns : true if paused | ||
| 239 | */ | ||
| 240 | static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter, | ||
| 241 | struct ixgbe_ring *tx_ring) | ||
| 242 | { | ||
| 243 | u32 txoff = IXGBE_TFCS_TXOFF; | ||
| 244 | |||
| 245 | #ifdef CONFIG_IXGBE_DCB | ||
| 246 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | ||
| 247 | int tc; | ||
| 248 | int reg_idx = tx_ring->reg_idx; | ||
| 249 | int dcb_i = adapter->ring_feature[RING_F_DCB].indices; | ||
| 250 | |||
| 251 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) { | ||
| 252 | tc = reg_idx >> 2; | ||
| 253 | txoff = IXGBE_TFCS_TXOFF0; | ||
| 254 | } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | ||
| 255 | tc = 0; | ||
| 256 | txoff = IXGBE_TFCS_TXOFF; | ||
| 257 | if (dcb_i == 8) { | ||
| 258 | /* TC0, TC1 */ | ||
| 259 | tc = reg_idx >> 5; | ||
| 260 | if (tc == 2) /* TC2, TC3 */ | ||
| 261 | tc += (reg_idx - 64) >> 4; | ||
| 262 | else if (tc == 3) /* TC4, TC5, TC6, TC7 */ | ||
| 263 | tc += 1 + ((reg_idx - 96) >> 3); | ||
| 264 | } else if (dcb_i == 4) { | ||
| 265 | /* TC0, TC1 */ | ||
| 266 | tc = reg_idx >> 6; | ||
| 267 | if (tc == 1) { | ||
| 268 | tc += (reg_idx - 64) >> 5; | ||
| 269 | if (tc == 2) /* TC2, TC3 */ | ||
| 270 | tc += (reg_idx - 96) >> 4; | ||
| 271 | } | ||
| 272 | } | ||
| 273 | } | ||
| 274 | txoff <<= tc; | ||
| 275 | } | ||
| 276 | #endif | ||
| 277 | return IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & txoff; | ||
| 278 | } | ||
| 279 | |||
| 229 | static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter, | 280 | static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter, |
| 230 | struct ixgbe_ring *tx_ring, | 281 | struct ixgbe_ring *tx_ring, |
| 231 | unsigned int eop) | 282 | unsigned int eop) |
| @@ -237,7 +288,7 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter, | |||
| 237 | adapter->detect_tx_hung = false; | 288 | adapter->detect_tx_hung = false; |
| 238 | if (tx_ring->tx_buffer_info[eop].time_stamp && | 289 | if (tx_ring->tx_buffer_info[eop].time_stamp && |
| 239 | time_after(jiffies, tx_ring->tx_buffer_info[eop].time_stamp + HZ) && | 290 | time_after(jiffies, tx_ring->tx_buffer_info[eop].time_stamp + HZ) && |
| 240 | !(IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & IXGBE_TFCS_TXOFF)) { | 291 | !ixgbe_tx_is_paused(adapter, tx_ring)) { |
| 241 | /* detected Tx unit hang */ | 292 | /* detected Tx unit hang */ |
| 242 | union ixgbe_adv_tx_desc *tx_desc; | 293 | union ixgbe_adv_tx_desc *tx_desc; |
| 243 | tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); | 294 | tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); |
| @@ -412,19 +463,23 @@ static void ixgbe_update_tx_dca(struct ixgbe_adapter *adapter, | |||
| 412 | u32 txctrl; | 463 | u32 txctrl; |
| 413 | int cpu = get_cpu(); | 464 | int cpu = get_cpu(); |
| 414 | int q = tx_ring - adapter->tx_ring; | 465 | int q = tx_ring - adapter->tx_ring; |
| 466 | struct ixgbe_hw *hw = &adapter->hw; | ||
| 415 | 467 | ||
| 416 | if (tx_ring->cpu != cpu) { | 468 | if (tx_ring->cpu != cpu) { |
| 417 | txctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q)); | ||
| 418 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) { | 469 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) { |
| 470 | txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(q)); | ||
| 419 | txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK; | 471 | txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK; |
| 420 | txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu); | 472 | txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu); |
| 473 | txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN; | ||
| 474 | IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(q), txctrl); | ||
| 421 | } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | 475 | } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { |
| 476 | txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(q)); | ||
| 422 | txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK_82599; | 477 | txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK_82599; |
| 423 | txctrl |= (dca3_get_tag(&adapter->pdev->dev, cpu) << | 478 | txctrl |= (dca3_get_tag(&adapter->pdev->dev, cpu) << |
| 424 | IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599); | 479 | IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599); |
| 480 | txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN; | ||
| 481 | IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(q), txctrl); | ||
| 425 | } | 482 | } |
| 426 | txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN; | ||
| 427 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q), txctrl); | ||
| 428 | tx_ring->cpu = cpu; | 483 | tx_ring->cpu = cpu; |
| 429 | } | 484 | } |
| 430 | put_cpu(); | 485 | put_cpu(); |
| @@ -1913,11 +1968,25 @@ static void ixgbe_configure_tx(struct ixgbe_adapter *adapter) | |||
| 1913 | break; | 1968 | break; |
| 1914 | } | 1969 | } |
| 1915 | } | 1970 | } |
| 1971 | |||
| 1916 | if (hw->mac.type == ixgbe_mac_82599EB) { | 1972 | if (hw->mac.type == ixgbe_mac_82599EB) { |
| 1973 | u32 rttdcs; | ||
| 1974 | |||
| 1975 | /* disable the arbiter while setting MTQC */ | ||
| 1976 | rttdcs = IXGBE_READ_REG(hw, IXGBE_RTTDCS); | ||
| 1977 | rttdcs |= IXGBE_RTTDCS_ARBDIS; | ||
| 1978 | IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs); | ||
| 1979 | |||
| 1917 | /* We enable 8 traffic classes, DCB only */ | 1980 | /* We enable 8 traffic classes, DCB only */ |
| 1918 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) | 1981 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) |
| 1919 | IXGBE_WRITE_REG(hw, IXGBE_MTQC, (IXGBE_MTQC_RT_ENA | | 1982 | IXGBE_WRITE_REG(hw, IXGBE_MTQC, (IXGBE_MTQC_RT_ENA | |
| 1920 | IXGBE_MTQC_8TC_8TQ)); | 1983 | IXGBE_MTQC_8TC_8TQ)); |
| 1984 | else | ||
| 1985 | IXGBE_WRITE_REG(hw, IXGBE_MTQC, IXGBE_MTQC_64Q_1PB); | ||
| 1986 | |||
| 1987 | /* re-eable the arbiter */ | ||
| 1988 | rttdcs &= ~IXGBE_RTTDCS_ARBDIS; | ||
| 1989 | IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs); | ||
| 1921 | } | 1990 | } |
| 1922 | } | 1991 | } |
| 1923 | 1992 | ||
| @@ -2471,7 +2540,10 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter) | |||
| 2471 | ixgbe_restore_vlan(adapter); | 2540 | ixgbe_restore_vlan(adapter); |
| 2472 | #ifdef CONFIG_IXGBE_DCB | 2541 | #ifdef CONFIG_IXGBE_DCB |
| 2473 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | 2542 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { |
| 2474 | netif_set_gso_max_size(netdev, 32768); | 2543 | if (hw->mac.type == ixgbe_mac_82598EB) |
| 2544 | netif_set_gso_max_size(netdev, 32768); | ||
| 2545 | else | ||
| 2546 | netif_set_gso_max_size(netdev, 65536); | ||
| 2475 | ixgbe_configure_dcb(adapter); | 2547 | ixgbe_configure_dcb(adapter); |
| 2476 | } else { | 2548 | } else { |
| 2477 | netif_set_gso_max_size(netdev, 65536); | 2549 | netif_set_gso_max_size(netdev, 65536); |
| @@ -5922,6 +5994,7 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev) | |||
| 5922 | } else { | 5994 | } else { |
| 5923 | pci_set_master(pdev); | 5995 | pci_set_master(pdev); |
| 5924 | pci_restore_state(pdev); | 5996 | pci_restore_state(pdev); |
| 5997 | pci_save_state(pdev); | ||
| 5925 | 5998 | ||
| 5926 | pci_wake_from_d3(pdev, false); | 5999 | pci_wake_from_d3(pdev, false); |
| 5927 | 6000 | ||
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c index 0be14d702beb..c146304d8d6c 100644 --- a/drivers/net/ks8851_mll.c +++ b/drivers/net/ks8851_mll.c | |||
| @@ -568,6 +568,16 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len) | |||
| 568 | iowrite16(*wptr++, ks->hw_addr); | 568 | iowrite16(*wptr++, ks->hw_addr); |
| 569 | } | 569 | } |
| 570 | 570 | ||
| 571 | static void ks_disable_int(struct ks_net *ks) | ||
| 572 | { | ||
| 573 | ks_wrreg16(ks, KS_IER, 0x0000); | ||
| 574 | } /* ks_disable_int */ | ||
| 575 | |||
| 576 | static void ks_enable_int(struct ks_net *ks) | ||
| 577 | { | ||
| 578 | ks_wrreg16(ks, KS_IER, ks->rc_ier); | ||
| 579 | } /* ks_enable_int */ | ||
| 580 | |||
| 571 | /** | 581 | /** |
| 572 | * ks_tx_fifo_space - return the available hardware buffer size. | 582 | * ks_tx_fifo_space - return the available hardware buffer size. |
| 573 | * @ks: The chip information | 583 | * @ks: The chip information |
| @@ -681,6 +691,47 @@ static void ks_soft_reset(struct ks_net *ks, unsigned op) | |||
| 681 | } | 691 | } |
| 682 | 692 | ||
| 683 | 693 | ||
| 694 | void ks_enable_qmu(struct ks_net *ks) | ||
| 695 | { | ||
| 696 | u16 w; | ||
| 697 | |||
| 698 | w = ks_rdreg16(ks, KS_TXCR); | ||
| 699 | /* Enables QMU Transmit (TXCR). */ | ||
| 700 | ks_wrreg16(ks, KS_TXCR, w | TXCR_TXE); | ||
| 701 | |||
| 702 | /* | ||
| 703 | * RX Frame Count Threshold Enable and Auto-Dequeue RXQ Frame | ||
| 704 | * Enable | ||
| 705 | */ | ||
| 706 | |||
| 707 | w = ks_rdreg16(ks, KS_RXQCR); | ||
| 708 | ks_wrreg16(ks, KS_RXQCR, w | RXQCR_RXFCTE); | ||
| 709 | |||
| 710 | /* Enables QMU Receive (RXCR1). */ | ||
| 711 | w = ks_rdreg16(ks, KS_RXCR1); | ||
| 712 | ks_wrreg16(ks, KS_RXCR1, w | RXCR1_RXE); | ||
| 713 | ks->enabled = true; | ||
| 714 | } /* ks_enable_qmu */ | ||
| 715 | |||
| 716 | static void ks_disable_qmu(struct ks_net *ks) | ||
| 717 | { | ||
| 718 | u16 w; | ||
| 719 | |||
| 720 | w = ks_rdreg16(ks, KS_TXCR); | ||
| 721 | |||
| 722 | /* Disables QMU Transmit (TXCR). */ | ||
| 723 | w &= ~TXCR_TXE; | ||
| 724 | ks_wrreg16(ks, KS_TXCR, w); | ||
| 725 | |||
| 726 | /* Disables QMU Receive (RXCR1). */ | ||
| 727 | w = ks_rdreg16(ks, KS_RXCR1); | ||
| 728 | w &= ~RXCR1_RXE ; | ||
| 729 | ks_wrreg16(ks, KS_RXCR1, w); | ||
| 730 | |||
| 731 | ks->enabled = false; | ||
| 732 | |||
| 733 | } /* ks_disable_qmu */ | ||
| 734 | |||
| 684 | /** | 735 | /** |
| 685 | * ks_read_qmu - read 1 pkt data from the QMU. | 736 | * ks_read_qmu - read 1 pkt data from the QMU. |
| 686 | * @ks: The chip information | 737 | * @ks: The chip information |
| @@ -752,7 +803,7 @@ static void ks_rcv(struct ks_net *ks, struct net_device *netdev) | |||
| 752 | (frame_hdr->len < RX_BUF_SIZE) && frame_hdr->len)) { | 803 | (frame_hdr->len < RX_BUF_SIZE) && frame_hdr->len)) { |
| 753 | skb_reserve(skb, 2); | 804 | skb_reserve(skb, 2); |
| 754 | /* read data block including CRC 4 bytes */ | 805 | /* read data block including CRC 4 bytes */ |
| 755 | ks_read_qmu(ks, (u16 *)skb->data, frame_hdr->len + 4); | 806 | ks_read_qmu(ks, (u16 *)skb->data, frame_hdr->len); |
| 756 | skb_put(skb, frame_hdr->len); | 807 | skb_put(skb, frame_hdr->len); |
| 757 | skb->dev = netdev; | 808 | skb->dev = netdev; |
| 758 | skb->protocol = eth_type_trans(skb, netdev); | 809 | skb->protocol = eth_type_trans(skb, netdev); |
| @@ -861,7 +912,7 @@ static int ks_net_open(struct net_device *netdev) | |||
| 861 | ks_dbg(ks, "%s - entry\n", __func__); | 912 | ks_dbg(ks, "%s - entry\n", __func__); |
| 862 | 913 | ||
| 863 | /* reset the HW */ | 914 | /* reset the HW */ |
| 864 | err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, ks); | 915 | err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, netdev); |
| 865 | 916 | ||
| 866 | if (err) { | 917 | if (err) { |
| 867 | printk(KERN_ERR "Failed to request IRQ: %d: %d\n", | 918 | printk(KERN_ERR "Failed to request IRQ: %d: %d\n", |
| @@ -869,6 +920,15 @@ static int ks_net_open(struct net_device *netdev) | |||
| 869 | return err; | 920 | return err; |
| 870 | } | 921 | } |
| 871 | 922 | ||
| 923 | /* wake up powermode to normal mode */ | ||
| 924 | ks_set_powermode(ks, PMECR_PM_NORMAL); | ||
| 925 | mdelay(1); /* wait for normal mode to take effect */ | ||
| 926 | |||
| 927 | ks_wrreg16(ks, KS_ISR, 0xffff); | ||
| 928 | ks_enable_int(ks); | ||
| 929 | ks_enable_qmu(ks); | ||
| 930 | netif_start_queue(ks->netdev); | ||
| 931 | |||
| 872 | if (netif_msg_ifup(ks)) | 932 | if (netif_msg_ifup(ks)) |
| 873 | ks_dbg(ks, "network device %s up\n", netdev->name); | 933 | ks_dbg(ks, "network device %s up\n", netdev->name); |
| 874 | 934 | ||
| @@ -892,19 +952,14 @@ static int ks_net_stop(struct net_device *netdev) | |||
| 892 | 952 | ||
| 893 | netif_stop_queue(netdev); | 953 | netif_stop_queue(netdev); |
| 894 | 954 | ||
| 895 | kfree(ks->frame_head_info); | ||
| 896 | |||
| 897 | mutex_lock(&ks->lock); | 955 | mutex_lock(&ks->lock); |
| 898 | 956 | ||
| 899 | /* turn off the IRQs and ack any outstanding */ | 957 | /* turn off the IRQs and ack any outstanding */ |
| 900 | ks_wrreg16(ks, KS_IER, 0x0000); | 958 | ks_wrreg16(ks, KS_IER, 0x0000); |
| 901 | ks_wrreg16(ks, KS_ISR, 0xffff); | 959 | ks_wrreg16(ks, KS_ISR, 0xffff); |
| 902 | 960 | ||
| 903 | /* shutdown RX process */ | 961 | /* shutdown RX/TX QMU */ |
| 904 | ks_wrreg16(ks, KS_RXCR1, 0x0000); | 962 | ks_disable_qmu(ks); |
| 905 | |||
| 906 | /* shutdown TX process */ | ||
| 907 | ks_wrreg16(ks, KS_TXCR, 0x0000); | ||
| 908 | 963 | ||
| 909 | /* set powermode to soft power down to save power */ | 964 | /* set powermode to soft power down to save power */ |
| 910 | ks_set_powermode(ks, PMECR_PM_SOFTDOWN); | 965 | ks_set_powermode(ks, PMECR_PM_SOFTDOWN); |
| @@ -929,17 +984,8 @@ static int ks_net_stop(struct net_device *netdev) | |||
| 929 | */ | 984 | */ |
| 930 | static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) | 985 | static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) |
| 931 | { | 986 | { |
| 932 | unsigned fid = ks->fid; | ||
| 933 | |||
| 934 | fid = ks->fid; | ||
| 935 | ks->fid = (ks->fid + 1) & TXFR_TXFID_MASK; | ||
| 936 | |||
| 937 | /* reduce the tx interrupt occurrances. */ | ||
| 938 | if (!fid) | ||
| 939 | fid |= TXFR_TXIC; /* irq on completion */ | ||
| 940 | |||
| 941 | /* start header at txb[0] to align txw entries */ | 987 | /* start header at txb[0] to align txw entries */ |
| 942 | ks->txh.txw[0] = cpu_to_le16(fid); | 988 | ks->txh.txw[0] = 0; |
| 943 | ks->txh.txw[1] = cpu_to_le16(len); | 989 | ks->txh.txw[1] = cpu_to_le16(len); |
| 944 | 990 | ||
| 945 | /* 1. set sudo-DMA mode */ | 991 | /* 1. set sudo-DMA mode */ |
| @@ -957,16 +1003,6 @@ static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) | |||
| 957 | ; | 1003 | ; |
| 958 | } | 1004 | } |
| 959 | 1005 | ||
| 960 | static void ks_disable_int(struct ks_net *ks) | ||
| 961 | { | ||
| 962 | ks_wrreg16(ks, KS_IER, 0x0000); | ||
| 963 | } /* ks_disable_int */ | ||
| 964 | |||
| 965 | static void ks_enable_int(struct ks_net *ks) | ||
| 966 | { | ||
| 967 | ks_wrreg16(ks, KS_IER, ks->rc_ier); | ||
| 968 | } /* ks_enable_int */ | ||
| 969 | |||
| 970 | /** | 1006 | /** |
| 971 | * ks_start_xmit - transmit packet | 1007 | * ks_start_xmit - transmit packet |
| 972 | * @skb : The buffer to transmit | 1008 | * @skb : The buffer to transmit |
| @@ -1410,25 +1446,6 @@ static int ks_read_selftest(struct ks_net *ks) | |||
| 1410 | return ret; | 1446 | return ret; |
| 1411 | } | 1447 | } |
| 1412 | 1448 | ||
| 1413 | static void ks_disable(struct ks_net *ks) | ||
| 1414 | { | ||
| 1415 | u16 w; | ||
| 1416 | |||
| 1417 | w = ks_rdreg16(ks, KS_TXCR); | ||
| 1418 | |||
| 1419 | /* Disables QMU Transmit (TXCR). */ | ||
| 1420 | w &= ~TXCR_TXE; | ||
| 1421 | ks_wrreg16(ks, KS_TXCR, w); | ||
| 1422 | |||
| 1423 | /* Disables QMU Receive (RXCR1). */ | ||
| 1424 | w = ks_rdreg16(ks, KS_RXCR1); | ||
| 1425 | w &= ~RXCR1_RXE ; | ||
| 1426 | ks_wrreg16(ks, KS_RXCR1, w); | ||
| 1427 | |||
| 1428 | ks->enabled = false; | ||
| 1429 | |||
| 1430 | } /* ks_disable */ | ||
| 1431 | |||
| 1432 | static void ks_setup(struct ks_net *ks) | 1449 | static void ks_setup(struct ks_net *ks) |
| 1433 | { | 1450 | { |
| 1434 | u16 w; | 1451 | u16 w; |
| @@ -1463,7 +1480,7 @@ static void ks_setup(struct ks_net *ks) | |||
| 1463 | w = TXCR_TXFCE | TXCR_TXPE | TXCR_TXCRC | TXCR_TCGIP; | 1480 | w = TXCR_TXFCE | TXCR_TXPE | TXCR_TXCRC | TXCR_TCGIP; |
| 1464 | ks_wrreg16(ks, KS_TXCR, w); | 1481 | ks_wrreg16(ks, KS_TXCR, w); |
| 1465 | 1482 | ||
| 1466 | w = RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE; | 1483 | w = RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE | RXCR1_RXME | RXCR1_RXIPFCC; |
| 1467 | 1484 | ||
| 1468 | if (ks->promiscuous) /* bPromiscuous */ | 1485 | if (ks->promiscuous) /* bPromiscuous */ |
| 1469 | w |= (RXCR1_RXAE | RXCR1_RXINVF); | 1486 | w |= (RXCR1_RXAE | RXCR1_RXINVF); |
| @@ -1486,28 +1503,6 @@ static void ks_setup_int(struct ks_net *ks) | |||
| 1486 | ks->rc_ier = (IRQ_LCI | IRQ_TXI | IRQ_RXI); | 1503 | ks->rc_ier = (IRQ_LCI | IRQ_TXI | IRQ_RXI); |
| 1487 | } /* ks_setup_int */ | 1504 | } /* ks_setup_int */ |
| 1488 | 1505 | ||
| 1489 | void ks_enable(struct ks_net *ks) | ||
| 1490 | { | ||
| 1491 | u16 w; | ||
| 1492 | |||
| 1493 | w = ks_rdreg16(ks, KS_TXCR); | ||
| 1494 | /* Enables QMU Transmit (TXCR). */ | ||
| 1495 | ks_wrreg16(ks, KS_TXCR, w | TXCR_TXE); | ||
| 1496 | |||
| 1497 | /* | ||
| 1498 | * RX Frame Count Threshold Enable and Auto-Dequeue RXQ Frame | ||
| 1499 | * Enable | ||
| 1500 | */ | ||
| 1501 | |||
| 1502 | w = ks_rdreg16(ks, KS_RXQCR); | ||
| 1503 | ks_wrreg16(ks, KS_RXQCR, w | RXQCR_RXFCTE); | ||
| 1504 | |||
| 1505 | /* Enables QMU Receive (RXCR1). */ | ||
| 1506 | w = ks_rdreg16(ks, KS_RXCR1); | ||
| 1507 | ks_wrreg16(ks, KS_RXCR1, w | RXCR1_RXE); | ||
| 1508 | ks->enabled = true; | ||
| 1509 | } /* ks_enable */ | ||
| 1510 | |||
| 1511 | static int ks_hw_init(struct ks_net *ks) | 1506 | static int ks_hw_init(struct ks_net *ks) |
| 1512 | { | 1507 | { |
| 1513 | #define MHEADER_SIZE (sizeof(struct type_frame_head) * MAX_RECV_FRAMES) | 1508 | #define MHEADER_SIZE (sizeof(struct type_frame_head) * MAX_RECV_FRAMES) |
| @@ -1612,11 +1607,9 @@ static int __devinit ks8851_probe(struct platform_device *pdev) | |||
| 1612 | 1607 | ||
| 1613 | ks_soft_reset(ks, GRR_GSR); | 1608 | ks_soft_reset(ks, GRR_GSR); |
| 1614 | ks_hw_init(ks); | 1609 | ks_hw_init(ks); |
| 1615 | ks_disable(ks); | 1610 | ks_disable_qmu(ks); |
| 1616 | ks_setup(ks); | 1611 | ks_setup(ks); |
| 1617 | ks_setup_int(ks); | 1612 | ks_setup_int(ks); |
| 1618 | ks_enable_int(ks); | ||
| 1619 | ks_enable(ks); | ||
| 1620 | memcpy(netdev->dev_addr, ks->mac_addr, 6); | 1613 | memcpy(netdev->dev_addr, ks->mac_addr, 6); |
| 1621 | 1614 | ||
| 1622 | data = ks_rdreg16(ks, KS_OBCR); | 1615 | data = ks_rdreg16(ks, KS_OBCR); |
| @@ -1658,6 +1651,7 @@ static int __devexit ks8851_remove(struct platform_device *pdev) | |||
| 1658 | struct ks_net *ks = netdev_priv(netdev); | 1651 | struct ks_net *ks = netdev_priv(netdev); |
| 1659 | struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1652 | struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 1660 | 1653 | ||
| 1654 | kfree(ks->frame_head_info); | ||
| 1661 | unregister_netdev(netdev); | 1655 | unregister_netdev(netdev); |
| 1662 | iounmap(ks->hw_addr); | 1656 | iounmap(ks->hw_addr); |
| 1663 | free_netdev(netdev); | 1657 | free_netdev(netdev); |
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c index 61eabcac734c..b3d7d8d77f46 100644 --- a/drivers/net/macsonic.c +++ b/drivers/net/macsonic.c | |||
| @@ -223,69 +223,73 @@ static int __devinit macsonic_init(struct net_device *dev) | |||
| 223 | return 0; | 223 | return 0; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | static int __devinit mac_onboard_sonic_ethernet_addr(struct net_device *dev) | 226 | #define INVALID_MAC(mac) (memcmp(mac, "\x08\x00\x07", 3) && \ |
| 227 | memcmp(mac, "\x00\xA0\x40", 3) && \ | ||
| 228 | memcmp(mac, "\x00\x80\x19", 3) && \ | ||
| 229 | memcmp(mac, "\x00\x05\x02", 3)) | ||
| 230 | |||
| 231 | static void __devinit mac_onboard_sonic_ethernet_addr(struct net_device *dev) | ||
| 227 | { | 232 | { |
| 228 | struct sonic_local *lp = netdev_priv(dev); | 233 | struct sonic_local *lp = netdev_priv(dev); |
| 229 | const int prom_addr = ONBOARD_SONIC_PROM_BASE; | 234 | const int prom_addr = ONBOARD_SONIC_PROM_BASE; |
| 230 | int i; | 235 | unsigned short val; |
| 231 | 236 | ||
| 232 | /* On NuBus boards we can sometimes look in the ROM resources. | 237 | /* |
| 233 | No such luck for comm-slot/onboard. */ | 238 | * On NuBus boards we can sometimes look in the ROM resources. |
| 234 | for(i = 0; i < 6; i++) | 239 | * No such luck for comm-slot/onboard. |
| 235 | dev->dev_addr[i] = SONIC_READ_PROM(i); | 240 | * On the PowerBook 520, the PROM base address is a mystery. |
| 241 | */ | ||
| 242 | if (hwreg_present((void *)prom_addr)) { | ||
| 243 | int i; | ||
| 244 | |||
| 245 | for (i = 0; i < 6; i++) | ||
| 246 | dev->dev_addr[i] = SONIC_READ_PROM(i); | ||
| 247 | if (!INVALID_MAC(dev->dev_addr)) | ||
| 248 | return; | ||
| 236 | 249 | ||
| 237 | /* Most of the time, the address is bit-reversed. The NetBSD | 250 | /* |
| 238 | source has a rather long and detailed historical account of | 251 | * Most of the time, the address is bit-reversed. The NetBSD |
| 239 | why this is so. */ | 252 | * source has a rather long and detailed historical account of |
| 240 | if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) && | 253 | * why this is so. |
| 241 | memcmp(dev->dev_addr, "\x00\xA0\x40", 3) && | 254 | */ |
| 242 | memcmp(dev->dev_addr, "\x00\x80\x19", 3) && | ||
| 243 | memcmp(dev->dev_addr, "\x00\x05\x02", 3)) | ||
| 244 | bit_reverse_addr(dev->dev_addr); | 255 | bit_reverse_addr(dev->dev_addr); |
| 245 | else | 256 | if (!INVALID_MAC(dev->dev_addr)) |
| 246 | return 0; | 257 | return; |
| 247 | 258 | ||
| 248 | /* If we still have what seems to be a bogus address, we'll | ||
| 249 | look in the CAM. The top entry should be ours. */ | ||
| 250 | /* Danger! This only works if MacOS has already initialized | ||
| 251 | the card... */ | ||
| 252 | if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) && | ||
| 253 | memcmp(dev->dev_addr, "\x00\xA0\x40", 3) && | ||
| 254 | memcmp(dev->dev_addr, "\x00\x80\x19", 3) && | ||
| 255 | memcmp(dev->dev_addr, "\x00\x05\x02", 3)) | ||
| 256 | { | ||
| 257 | unsigned short val; | ||
| 258 | |||
| 259 | printk(KERN_INFO "macsonic: PROM seems to be wrong, trying CAM entry 15\n"); | ||
| 260 | |||
| 261 | SONIC_WRITE(SONIC_CMD, SONIC_CR_RST); | ||
| 262 | SONIC_WRITE(SONIC_CEP, 15); | ||
| 263 | |||
| 264 | val = SONIC_READ(SONIC_CAP2); | ||
| 265 | dev->dev_addr[5] = val >> 8; | ||
| 266 | dev->dev_addr[4] = val & 0xff; | ||
| 267 | val = SONIC_READ(SONIC_CAP1); | ||
| 268 | dev->dev_addr[3] = val >> 8; | ||
| 269 | dev->dev_addr[2] = val & 0xff; | ||
| 270 | val = SONIC_READ(SONIC_CAP0); | ||
| 271 | dev->dev_addr[1] = val >> 8; | ||
| 272 | dev->dev_addr[0] = val & 0xff; | ||
| 273 | |||
| 274 | printk(KERN_INFO "HW Address from CAM 15: %pM\n", | ||
| 275 | dev->dev_addr); | ||
| 276 | } else return 0; | ||
| 277 | |||
| 278 | if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) && | ||
| 279 | memcmp(dev->dev_addr, "\x00\xA0\x40", 3) && | ||
| 280 | memcmp(dev->dev_addr, "\x00\x80\x19", 3) && | ||
| 281 | memcmp(dev->dev_addr, "\x00\x05\x02", 3)) | ||
| 282 | { | ||
| 283 | /* | 259 | /* |
| 284 | * Still nonsense ... messed up someplace! | 260 | * If we still have what seems to be a bogus address, we'll |
| 261 | * look in the CAM. The top entry should be ours. | ||
| 285 | */ | 262 | */ |
| 286 | printk(KERN_ERR "macsonic: ERROR (INVALID MAC)\n"); | 263 | printk(KERN_WARNING "macsonic: MAC address in PROM seems " |
| 287 | return -EIO; | 264 | "to be invalid, trying CAM\n"); |
| 288 | } else return 0; | 265 | } else { |
| 266 | printk(KERN_WARNING "macsonic: cannot read MAC address from " | ||
| 267 | "PROM, trying CAM\n"); | ||
| 268 | } | ||
| 269 | |||
| 270 | /* This only works if MacOS has already initialized the card. */ | ||
| 271 | |||
| 272 | SONIC_WRITE(SONIC_CMD, SONIC_CR_RST); | ||
| 273 | SONIC_WRITE(SONIC_CEP, 15); | ||
| 274 | |||
| 275 | val = SONIC_READ(SONIC_CAP2); | ||
| 276 | dev->dev_addr[5] = val >> 8; | ||
| 277 | dev->dev_addr[4] = val & 0xff; | ||
| 278 | val = SONIC_READ(SONIC_CAP1); | ||
| 279 | dev->dev_addr[3] = val >> 8; | ||
| 280 | dev->dev_addr[2] = val & 0xff; | ||
| 281 | val = SONIC_READ(SONIC_CAP0); | ||
| 282 | dev->dev_addr[1] = val >> 8; | ||
| 283 | dev->dev_addr[0] = val & 0xff; | ||
| 284 | |||
| 285 | if (!INVALID_MAC(dev->dev_addr)) | ||
| 286 | return; | ||
| 287 | |||
| 288 | /* Still nonsense ... messed up someplace! */ | ||
| 289 | |||
| 290 | printk(KERN_WARNING "macsonic: MAC address in CAM entry 15 " | ||
| 291 | "seems invalid, will use a random MAC\n"); | ||
| 292 | random_ether_addr(dev->dev_addr); | ||
| 289 | } | 293 | } |
| 290 | 294 | ||
| 291 | static int __devinit mac_onboard_sonic_probe(struct net_device *dev) | 295 | static int __devinit mac_onboard_sonic_probe(struct net_device *dev) |
| @@ -402,8 +406,7 @@ static int __devinit mac_onboard_sonic_probe(struct net_device *dev) | |||
| 402 | SONIC_WRITE(SONIC_ISR, 0x7fff); | 406 | SONIC_WRITE(SONIC_ISR, 0x7fff); |
| 403 | 407 | ||
| 404 | /* Now look for the MAC address. */ | 408 | /* Now look for the MAC address. */ |
| 405 | if (mac_onboard_sonic_ethernet_addr(dev) != 0) | 409 | mac_onboard_sonic_ethernet_addr(dev); |
| 406 | return -ENODEV; | ||
| 407 | 410 | ||
| 408 | /* Shared init code */ | 411 | /* Shared init code */ |
| 409 | return macsonic_init(dev); | 412 | return macsonic_init(dev); |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 3aabfd9dd212..2490aa39804c 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
| @@ -360,6 +360,7 @@ static int macvlan_init(struct net_device *dev) | |||
| 360 | dev->state = (dev->state & ~MACVLAN_STATE_MASK) | | 360 | dev->state = (dev->state & ~MACVLAN_STATE_MASK) | |
| 361 | (lowerdev->state & MACVLAN_STATE_MASK); | 361 | (lowerdev->state & MACVLAN_STATE_MASK); |
| 362 | dev->features = lowerdev->features & MACVLAN_FEATURES; | 362 | dev->features = lowerdev->features & MACVLAN_FEATURES; |
| 363 | dev->gso_max_size = lowerdev->gso_max_size; | ||
| 363 | dev->iflink = lowerdev->ifindex; | 364 | dev->iflink = lowerdev->ifindex; |
| 364 | dev->hard_header_len = lowerdev->hard_header_len; | 365 | dev->hard_header_len = lowerdev->hard_header_len; |
| 365 | 366 | ||
| @@ -596,6 +597,7 @@ static int macvlan_device_event(struct notifier_block *unused, | |||
| 596 | case NETDEV_FEAT_CHANGE: | 597 | case NETDEV_FEAT_CHANGE: |
| 597 | list_for_each_entry(vlan, &port->vlans, list) { | 598 | list_for_each_entry(vlan, &port->vlans, list) { |
| 598 | vlan->dev->features = dev->features & MACVLAN_FEATURES; | 599 | vlan->dev->features = dev->features & MACVLAN_FEATURES; |
| 600 | vlan->dev->gso_max_size = dev->gso_max_size; | ||
| 599 | netdev_features_change(vlan->dev); | 601 | netdev_features_change(vlan->dev); |
| 600 | } | 602 | } |
| 601 | break; | 603 | break; |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 7384f59df615..e1237b802872 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
| @@ -1163,6 +1163,8 @@ struct netxen_adapter { | |||
| 1163 | u32 int_vec_bit; | 1163 | u32 int_vec_bit; |
| 1164 | u32 heartbit; | 1164 | u32 heartbit; |
| 1165 | 1165 | ||
| 1166 | u8 mac_addr[ETH_ALEN]; | ||
| 1167 | |||
| 1166 | struct netxen_adapter_stats stats; | 1168 | struct netxen_adapter_stats stats; |
| 1167 | 1169 | ||
| 1168 | struct netxen_recv_context recv_ctx; | 1170 | struct netxen_recv_context recv_ctx; |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index 1c46da632125..17bb3818d84e 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
| @@ -545,6 +545,8 @@ enum { | |||
| 545 | #define NETXEN_NIU_TEST_MUX_CTL (NETXEN_CRB_NIU + 0x00094) | 545 | #define NETXEN_NIU_TEST_MUX_CTL (NETXEN_CRB_NIU + 0x00094) |
| 546 | #define NETXEN_NIU_XG_PAUSE_CTL (NETXEN_CRB_NIU + 0x00098) | 546 | #define NETXEN_NIU_XG_PAUSE_CTL (NETXEN_CRB_NIU + 0x00098) |
| 547 | #define NETXEN_NIU_XG_PAUSE_LEVEL (NETXEN_CRB_NIU + 0x000dc) | 547 | #define NETXEN_NIU_XG_PAUSE_LEVEL (NETXEN_CRB_NIU + 0x000dc) |
| 548 | #define NETXEN_NIU_FRAME_COUNT_SELECT (NETXEN_CRB_NIU + 0x000ac) | ||
| 549 | #define NETXEN_NIU_FRAME_COUNT (NETXEN_CRB_NIU + 0x000b0) | ||
| 548 | #define NETXEN_NIU_XG_SEL (NETXEN_CRB_NIU + 0x00128) | 550 | #define NETXEN_NIU_XG_SEL (NETXEN_CRB_NIU + 0x00128) |
| 549 | #define NETXEN_NIU_GB_PAUSE_CTL (NETXEN_CRB_NIU + 0x0030c) | 551 | #define NETXEN_NIU_GB_PAUSE_CTL (NETXEN_CRB_NIU + 0x0030c) |
| 550 | 552 | ||
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 3185a98b0917..52a3798d8d94 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
| @@ -383,24 +383,51 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) | |||
| 383 | 383 | ||
| 384 | int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | 384 | int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) |
| 385 | { | 385 | { |
| 386 | __u32 reg; | 386 | u32 mac_cfg; |
| 387 | u32 cnt = 0; | ||
| 388 | __u32 reg = 0x0200; | ||
| 387 | u32 port = adapter->physical_port; | 389 | u32 port = adapter->physical_port; |
| 390 | u16 board_type = adapter->ahw.board_type; | ||
| 388 | 391 | ||
| 389 | if (port > NETXEN_NIU_MAX_XG_PORTS) | 392 | if (port > NETXEN_NIU_MAX_XG_PORTS) |
| 390 | return -EINVAL; | 393 | return -EINVAL; |
| 391 | 394 | ||
| 392 | reg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port)); | 395 | mac_cfg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port)); |
| 393 | if (mode == NETXEN_NIU_PROMISC_MODE) | 396 | mac_cfg &= ~0x4; |
| 394 | reg = (reg | 0x2000UL); | 397 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg); |
| 395 | else | ||
| 396 | reg = (reg & ~0x2000UL); | ||
| 397 | 398 | ||
| 398 | if (mode == NETXEN_NIU_ALLMULTI_MODE) | 399 | if ((board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) || |
| 399 | reg = (reg | 0x1000UL); | 400 | (board_type == NETXEN_BRDTYPE_P2_SB31_10G_HMEZ)) |
| 400 | else | 401 | reg = (0x20 << port); |
| 401 | reg = (reg & ~0x1000UL); | 402 | |
| 403 | NXWR32(adapter, NETXEN_NIU_FRAME_COUNT_SELECT, reg); | ||
| 404 | |||
| 405 | mdelay(10); | ||
| 406 | |||
| 407 | while (NXRD32(adapter, NETXEN_NIU_FRAME_COUNT) && ++cnt < 20) | ||
| 408 | mdelay(10); | ||
| 409 | |||
| 410 | if (cnt < 20) { | ||
| 411 | |||
| 412 | reg = NXRD32(adapter, | ||
| 413 | NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port)); | ||
| 414 | |||
| 415 | if (mode == NETXEN_NIU_PROMISC_MODE) | ||
| 416 | reg = (reg | 0x2000UL); | ||
| 417 | else | ||
| 418 | reg = (reg & ~0x2000UL); | ||
| 419 | |||
| 420 | if (mode == NETXEN_NIU_ALLMULTI_MODE) | ||
| 421 | reg = (reg | 0x1000UL); | ||
| 422 | else | ||
| 423 | reg = (reg & ~0x1000UL); | ||
| 424 | |||
| 425 | NXWR32(adapter, | ||
| 426 | NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg); | ||
| 427 | } | ||
| 402 | 428 | ||
| 403 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg); | 429 | mac_cfg |= 0x4; |
| 430 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg); | ||
| 404 | 431 | ||
| 405 | return 0; | 432 | return 0; |
| 406 | } | 433 | } |
| @@ -436,7 +463,7 @@ netxen_nic_enable_mcast_filter(struct netxen_adapter *adapter) | |||
| 436 | { | 463 | { |
| 437 | u32 val = 0; | 464 | u32 val = 0; |
| 438 | u16 port = adapter->physical_port; | 465 | u16 port = adapter->physical_port; |
| 439 | u8 *addr = adapter->netdev->dev_addr; | 466 | u8 *addr = adapter->mac_addr; |
| 440 | 467 | ||
| 441 | if (adapter->mc_enabled) | 468 | if (adapter->mc_enabled) |
| 442 | return 0; | 469 | return 0; |
| @@ -465,7 +492,7 @@ netxen_nic_disable_mcast_filter(struct netxen_adapter *adapter) | |||
| 465 | { | 492 | { |
| 466 | u32 val = 0; | 493 | u32 val = 0; |
| 467 | u16 port = adapter->physical_port; | 494 | u16 port = adapter->physical_port; |
| 468 | u8 *addr = adapter->netdev->dev_addr; | 495 | u8 *addr = adapter->mac_addr; |
| 469 | 496 | ||
| 470 | if (!adapter->mc_enabled) | 497 | if (!adapter->mc_enabled) |
| 471 | return 0; | 498 | return 0; |
| @@ -660,7 +687,7 @@ void netxen_p3_nic_set_multi(struct net_device *netdev) | |||
| 660 | 687 | ||
| 661 | list_splice_tail_init(&adapter->mac_list, &del_list); | 688 | list_splice_tail_init(&adapter->mac_list, &del_list); |
| 662 | 689 | ||
| 663 | nx_p3_nic_add_mac(adapter, netdev->dev_addr, &del_list); | 690 | nx_p3_nic_add_mac(adapter, adapter->mac_addr, &del_list); |
| 664 | nx_p3_nic_add_mac(adapter, bcast_addr, &del_list); | 691 | nx_p3_nic_add_mac(adapter, bcast_addr, &del_list); |
| 665 | 692 | ||
| 666 | if (netdev->flags & IFF_PROMISC) { | 693 | if (netdev->flags & IFF_PROMISC) { |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index e40b914d6faf..8a0904368e08 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
| @@ -544,6 +544,8 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
| 544 | continue; | 544 | continue; |
| 545 | if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */ | 545 | if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */ |
| 546 | continue; | 546 | continue; |
| 547 | if ((off & 0x0ff00000) == NETXEN_CRB_DDR_NET) | ||
| 548 | continue; | ||
| 547 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) | 549 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) |
| 548 | buf[i].data = 0x1020; | 550 | buf[i].data = 0x1020; |
| 549 | /* skip the function enable register */ | 551 | /* skip the function enable register */ |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 0b4a56a8c8d5..3bf78dbfbf0f 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
| @@ -437,6 +437,7 @@ netxen_read_mac_addr(struct netxen_adapter *adapter) | |||
| 437 | netdev->dev_addr[i] = *(p + 5 - i); | 437 | netdev->dev_addr[i] = *(p + 5 - i); |
| 438 | 438 | ||
| 439 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); | 439 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); |
| 440 | memcpy(adapter->mac_addr, netdev->dev_addr, netdev->addr_len); | ||
| 440 | 441 | ||
| 441 | /* set station address */ | 442 | /* set station address */ |
| 442 | 443 | ||
| @@ -459,6 +460,7 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p) | |||
| 459 | netxen_napi_disable(adapter); | 460 | netxen_napi_disable(adapter); |
| 460 | } | 461 | } |
| 461 | 462 | ||
| 463 | memcpy(adapter->mac_addr, addr->sa_data, netdev->addr_len); | ||
| 462 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | 464 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); |
| 463 | adapter->macaddr_set(adapter, addr->sa_data); | 465 | adapter->macaddr_set(adapter, addr->sa_data); |
| 464 | 466 | ||
| @@ -956,7 +958,7 @@ netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev) | |||
| 956 | return err; | 958 | return err; |
| 957 | } | 959 | } |
| 958 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | 960 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) |
| 959 | adapter->macaddr_set(adapter, netdev->dev_addr); | 961 | adapter->macaddr_set(adapter, adapter->mac_addr); |
| 960 | 962 | ||
| 961 | adapter->set_multi(netdev); | 963 | adapter->set_multi(netdev); |
| 962 | adapter->set_mtu(adapter, netdev->mtu); | 964 | adapter->set_mtu(adapter, netdev->mtu); |
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index b58965a2b3ae..17a27225cc98 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
| @@ -118,14 +118,6 @@ INT_MODULE_PARM(full_duplex, 0); | |||
| 118 | /* Autodetect link polarity reversal? */ | 118 | /* Autodetect link polarity reversal? */ |
| 119 | INT_MODULE_PARM(auto_polarity, 1); | 119 | INT_MODULE_PARM(auto_polarity, 1); |
| 120 | 120 | ||
| 121 | #ifdef PCMCIA_DEBUG | ||
| 122 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
| 123 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 124 | static char *version = | ||
| 125 | "3c574_cs.c 1.65ac1 2003/04/07 Donald Becker/David Hinds, becker@scyld.com.\n"; | ||
| 126 | #else | ||
| 127 | #define DEBUG(n, args...) | ||
| 128 | #endif | ||
| 129 | 121 | ||
| 130 | /*====================================================================*/ | 122 | /*====================================================================*/ |
| 131 | 123 | ||
| @@ -278,7 +270,7 @@ static int tc574_probe(struct pcmcia_device *link) | |||
| 278 | struct el3_private *lp; | 270 | struct el3_private *lp; |
| 279 | struct net_device *dev; | 271 | struct net_device *dev; |
| 280 | 272 | ||
| 281 | DEBUG(0, "3c574_attach()\n"); | 273 | dev_dbg(&link->dev, "3c574_attach()\n"); |
| 282 | 274 | ||
| 283 | /* Create the PC card device object. */ | 275 | /* Create the PC card device object. */ |
| 284 | dev = alloc_etherdev(sizeof(struct el3_private)); | 276 | dev = alloc_etherdev(sizeof(struct el3_private)); |
| @@ -291,10 +283,8 @@ static int tc574_probe(struct pcmcia_device *link) | |||
| 291 | spin_lock_init(&lp->window_lock); | 283 | spin_lock_init(&lp->window_lock); |
| 292 | link->io.NumPorts1 = 32; | 284 | link->io.NumPorts1 = 32; |
| 293 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 285 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
| 294 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; | 286 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 295 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 296 | link->irq.Handler = &el3_interrupt; | 287 | link->irq.Handler = &el3_interrupt; |
| 297 | link->irq.Instance = dev; | ||
| 298 | link->conf.Attributes = CONF_ENABLE_IRQ; | 288 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 299 | link->conf.IntType = INT_MEMORY_AND_IO; | 289 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 300 | link->conf.ConfigIndex = 1; | 290 | link->conf.ConfigIndex = 1; |
| @@ -319,7 +309,7 @@ static void tc574_detach(struct pcmcia_device *link) | |||
| 319 | { | 309 | { |
| 320 | struct net_device *dev = link->priv; | 310 | struct net_device *dev = link->priv; |
| 321 | 311 | ||
| 322 | DEBUG(0, "3c574_detach(0x%p)\n", link); | 312 | dev_dbg(&link->dev, "3c574_detach()\n"); |
| 323 | 313 | ||
| 324 | if (link->dev_node) | 314 | if (link->dev_node) |
| 325 | unregister_netdev(dev); | 315 | unregister_netdev(dev); |
| @@ -335,26 +325,23 @@ static void tc574_detach(struct pcmcia_device *link) | |||
| 335 | ethernet device available to the system. | 325 | ethernet device available to the system. |
| 336 | */ | 326 | */ |
| 337 | 327 | ||
| 338 | #define CS_CHECK(fn, ret) \ | ||
| 339 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 340 | |||
| 341 | static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; | 328 | static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; |
| 342 | 329 | ||
| 343 | static int tc574_config(struct pcmcia_device *link) | 330 | static int tc574_config(struct pcmcia_device *link) |
| 344 | { | 331 | { |
| 345 | struct net_device *dev = link->priv; | 332 | struct net_device *dev = link->priv; |
| 346 | struct el3_private *lp = netdev_priv(dev); | 333 | struct el3_private *lp = netdev_priv(dev); |
| 347 | tuple_t tuple; | 334 | int ret, i, j; |
| 348 | __le16 buf[32]; | ||
| 349 | int last_fn, last_ret, i, j; | ||
| 350 | unsigned int ioaddr; | 335 | unsigned int ioaddr; |
| 351 | __be16 *phys_addr; | 336 | __be16 *phys_addr; |
| 352 | char *cardname; | 337 | char *cardname; |
| 353 | __u32 config; | 338 | __u32 config; |
| 339 | u8 *buf; | ||
| 340 | size_t len; | ||
| 354 | 341 | ||
| 355 | phys_addr = (__be16 *)dev->dev_addr; | 342 | phys_addr = (__be16 *)dev->dev_addr; |
| 356 | 343 | ||
| 357 | DEBUG(0, "3c574_config(0x%p)\n", link); | 344 | dev_dbg(&link->dev, "3c574_config()\n"); |
| 358 | 345 | ||
| 359 | link->io.IOAddrLines = 16; | 346 | link->io.IOAddrLines = 16; |
| 360 | for (i = j = 0; j < 0x400; j += 0x20) { | 347 | for (i = j = 0; j < 0x400; j += 0x20) { |
| @@ -363,12 +350,16 @@ static int tc574_config(struct pcmcia_device *link) | |||
| 363 | if (i == 0) | 350 | if (i == 0) |
| 364 | break; | 351 | break; |
| 365 | } | 352 | } |
| 366 | if (i != 0) { | 353 | if (i != 0) |
| 367 | cs_error(link, RequestIO, i); | 354 | goto failed; |
| 355 | |||
| 356 | ret = pcmcia_request_irq(link, &link->irq); | ||
| 357 | if (ret) | ||
| 358 | goto failed; | ||
| 359 | |||
| 360 | ret = pcmcia_request_configuration(link, &link->conf); | ||
| 361 | if (ret) | ||
| 368 | goto failed; | 362 | goto failed; |
| 369 | } | ||
| 370 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | ||
| 371 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | ||
| 372 | 363 | ||
| 373 | dev->irq = link->irq.AssignedIRQ; | 364 | dev->irq = link->irq.AssignedIRQ; |
| 374 | dev->base_addr = link->io.BasePort1; | 365 | dev->base_addr = link->io.BasePort1; |
| @@ -378,16 +369,14 @@ static int tc574_config(struct pcmcia_device *link) | |||
| 378 | /* The 3c574 normally uses an EEPROM for configuration info, including | 369 | /* The 3c574 normally uses an EEPROM for configuration info, including |
| 379 | the hardware address. The future products may include a modem chip | 370 | the hardware address. The future products may include a modem chip |
| 380 | and put the address in the CIS. */ | 371 | and put the address in the CIS. */ |
| 381 | tuple.Attributes = 0; | 372 | |
| 382 | tuple.TupleData = (cisdata_t *)buf; | 373 | len = pcmcia_get_tuple(link, 0x88, &buf); |
| 383 | tuple.TupleDataMax = 64; | 374 | if (buf && len >= 6) { |
| 384 | tuple.TupleOffset = 0; | ||
| 385 | tuple.DesiredTuple = 0x88; | ||
| 386 | if (pcmcia_get_first_tuple(link, &tuple) == 0) { | ||
| 387 | pcmcia_get_tuple_data(link, &tuple); | ||
| 388 | for (i = 0; i < 3; i++) | 375 | for (i = 0; i < 3; i++) |
| 389 | phys_addr[i] = htons(le16_to_cpu(buf[i])); | 376 | phys_addr[i] = htons(le16_to_cpu(buf[i * 2])); |
| 377 | kfree(buf); | ||
| 390 | } else { | 378 | } else { |
| 379 | kfree(buf); /* 0 < len < 6 */ | ||
| 391 | EL3WINDOW(0); | 380 | EL3WINDOW(0); |
| 392 | for (i = 0; i < 3; i++) | 381 | for (i = 0; i < 3; i++) |
| 393 | phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); | 382 | phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); |
| @@ -435,7 +424,8 @@ static int tc574_config(struct pcmcia_device *link) | |||
| 435 | mii_status = mdio_read(ioaddr, phy & 0x1f, 1); | 424 | mii_status = mdio_read(ioaddr, phy & 0x1f, 1); |
| 436 | if (mii_status != 0xffff) { | 425 | if (mii_status != 0xffff) { |
| 437 | lp->phys = phy & 0x1f; | 426 | lp->phys = phy & 0x1f; |
| 438 | DEBUG(0, " MII transceiver at index %d, status %x.\n", | 427 | dev_dbg(&link->dev, " MII transceiver at " |
| 428 | "index %d, status %x.\n", | ||
| 439 | phy, mii_status); | 429 | phy, mii_status); |
| 440 | if ((mii_status & 0x0040) == 0) | 430 | if ((mii_status & 0x0040) == 0) |
| 441 | mii_preamble_required = 1; | 431 | mii_preamble_required = 1; |
| @@ -457,7 +447,7 @@ static int tc574_config(struct pcmcia_device *link) | |||
| 457 | } | 447 | } |
| 458 | 448 | ||
| 459 | link->dev_node = &lp->node; | 449 | link->dev_node = &lp->node; |
| 460 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 450 | SET_NETDEV_DEV(dev, &link->dev); |
| 461 | 451 | ||
| 462 | if (register_netdev(dev) != 0) { | 452 | if (register_netdev(dev) != 0) { |
| 463 | printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); | 453 | printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); |
| @@ -478,8 +468,6 @@ static int tc574_config(struct pcmcia_device *link) | |||
| 478 | 468 | ||
| 479 | return 0; | 469 | return 0; |
| 480 | 470 | ||
| 481 | cs_failed: | ||
| 482 | cs_error(link, last_fn, last_ret); | ||
| 483 | failed: | 471 | failed: |
| 484 | tc574_release(link); | 472 | tc574_release(link); |
| 485 | return -ENODEV; | 473 | return -ENODEV; |
| @@ -738,7 +726,7 @@ static int el3_open(struct net_device *dev) | |||
| 738 | lp->media.expires = jiffies + HZ; | 726 | lp->media.expires = jiffies + HZ; |
| 739 | add_timer(&lp->media); | 727 | add_timer(&lp->media); |
| 740 | 728 | ||
| 741 | DEBUG(2, "%s: opened, status %4.4x.\n", | 729 | dev_dbg(&link->dev, "%s: opened, status %4.4x.\n", |
| 742 | dev->name, inw(dev->base_addr + EL3_STATUS)); | 730 | dev->name, inw(dev->base_addr + EL3_STATUS)); |
| 743 | 731 | ||
| 744 | return 0; | 732 | return 0; |
| @@ -772,7 +760,7 @@ static void pop_tx_status(struct net_device *dev) | |||
| 772 | if (tx_status & 0x30) | 760 | if (tx_status & 0x30) |
| 773 | tc574_wait_for_completion(dev, TxReset); | 761 | tc574_wait_for_completion(dev, TxReset); |
| 774 | if (tx_status & 0x38) { | 762 | if (tx_status & 0x38) { |
| 775 | DEBUG(1, "%s: transmit error: status 0x%02x\n", | 763 | pr_debug("%s: transmit error: status 0x%02x\n", |
| 776 | dev->name, tx_status); | 764 | dev->name, tx_status); |
| 777 | outw(TxEnable, ioaddr + EL3_CMD); | 765 | outw(TxEnable, ioaddr + EL3_CMD); |
| 778 | dev->stats.tx_aborted_errors++; | 766 | dev->stats.tx_aborted_errors++; |
| @@ -788,7 +776,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb, | |||
| 788 | struct el3_private *lp = netdev_priv(dev); | 776 | struct el3_private *lp = netdev_priv(dev); |
| 789 | unsigned long flags; | 777 | unsigned long flags; |
| 790 | 778 | ||
| 791 | DEBUG(3, "%s: el3_start_xmit(length = %ld) called, " | 779 | pr_debug("%s: el3_start_xmit(length = %ld) called, " |
| 792 | "status %4.4x.\n", dev->name, (long)skb->len, | 780 | "status %4.4x.\n", dev->name, (long)skb->len, |
| 793 | inw(ioaddr + EL3_STATUS)); | 781 | inw(ioaddr + EL3_STATUS)); |
| 794 | 782 | ||
| @@ -827,7 +815,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
| 827 | return IRQ_NONE; | 815 | return IRQ_NONE; |
| 828 | ioaddr = dev->base_addr; | 816 | ioaddr = dev->base_addr; |
| 829 | 817 | ||
| 830 | DEBUG(3, "%s: interrupt, status %4.4x.\n", | 818 | pr_debug("%s: interrupt, status %4.4x.\n", |
| 831 | dev->name, inw(ioaddr + EL3_STATUS)); | 819 | dev->name, inw(ioaddr + EL3_STATUS)); |
| 832 | 820 | ||
| 833 | spin_lock(&lp->window_lock); | 821 | spin_lock(&lp->window_lock); |
| @@ -836,7 +824,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
| 836 | (IntLatch | RxComplete | RxEarly | StatsFull)) { | 824 | (IntLatch | RxComplete | RxEarly | StatsFull)) { |
| 837 | if (!netif_device_present(dev) || | 825 | if (!netif_device_present(dev) || |
| 838 | ((status & 0xe000) != 0x2000)) { | 826 | ((status & 0xe000) != 0x2000)) { |
| 839 | DEBUG(1, "%s: Interrupt from dead card\n", dev->name); | 827 | pr_debug("%s: Interrupt from dead card\n", dev->name); |
| 840 | break; | 828 | break; |
| 841 | } | 829 | } |
| 842 | 830 | ||
| @@ -846,7 +834,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
| 846 | work_budget = el3_rx(dev, work_budget); | 834 | work_budget = el3_rx(dev, work_budget); |
| 847 | 835 | ||
| 848 | if (status & TxAvailable) { | 836 | if (status & TxAvailable) { |
| 849 | DEBUG(3, " TX room bit was handled.\n"); | 837 | pr_debug(" TX room bit was handled.\n"); |
| 850 | /* There's room in the FIFO for a full-sized packet. */ | 838 | /* There's room in the FIFO for a full-sized packet. */ |
| 851 | outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); | 839 | outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); |
| 852 | netif_wake_queue(dev); | 840 | netif_wake_queue(dev); |
| @@ -886,7 +874,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
| 886 | } | 874 | } |
| 887 | 875 | ||
| 888 | if (--work_budget < 0) { | 876 | if (--work_budget < 0) { |
| 889 | DEBUG(0, "%s: Too much work in interrupt, " | 877 | pr_debug("%s: Too much work in interrupt, " |
| 890 | "status %4.4x.\n", dev->name, status); | 878 | "status %4.4x.\n", dev->name, status); |
| 891 | /* Clear all interrupts */ | 879 | /* Clear all interrupts */ |
| 892 | outw(AckIntr | 0xFF, ioaddr + EL3_CMD); | 880 | outw(AckIntr | 0xFF, ioaddr + EL3_CMD); |
| @@ -896,7 +884,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
| 896 | outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD); | 884 | outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD); |
| 897 | } | 885 | } |
| 898 | 886 | ||
| 899 | DEBUG(3, "%s: exiting interrupt, status %4.4x.\n", | 887 | pr_debug("%s: exiting interrupt, status %4.4x.\n", |
| 900 | dev->name, inw(ioaddr + EL3_STATUS)); | 888 | dev->name, inw(ioaddr + EL3_STATUS)); |
| 901 | 889 | ||
| 902 | spin_unlock(&lp->window_lock); | 890 | spin_unlock(&lp->window_lock); |
| @@ -1003,7 +991,7 @@ static void update_stats(struct net_device *dev) | |||
| 1003 | unsigned int ioaddr = dev->base_addr; | 991 | unsigned int ioaddr = dev->base_addr; |
| 1004 | u8 rx, tx, up; | 992 | u8 rx, tx, up; |
| 1005 | 993 | ||
| 1006 | DEBUG(2, "%s: updating the statistics.\n", dev->name); | 994 | pr_debug("%s: updating the statistics.\n", dev->name); |
| 1007 | 995 | ||
| 1008 | if (inw(ioaddr+EL3_STATUS) == 0xffff) /* No card. */ | 996 | if (inw(ioaddr+EL3_STATUS) == 0xffff) /* No card. */ |
| 1009 | return; | 997 | return; |
| @@ -1039,7 +1027,7 @@ static int el3_rx(struct net_device *dev, int worklimit) | |||
| 1039 | unsigned int ioaddr = dev->base_addr; | 1027 | unsigned int ioaddr = dev->base_addr; |
| 1040 | short rx_status; | 1028 | short rx_status; |
| 1041 | 1029 | ||
| 1042 | DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", | 1030 | pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", |
| 1043 | dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus)); | 1031 | dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus)); |
| 1044 | while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) && | 1032 | while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) && |
| 1045 | worklimit > 0) { | 1033 | worklimit > 0) { |
| @@ -1061,7 +1049,7 @@ static int el3_rx(struct net_device *dev, int worklimit) | |||
| 1061 | 1049 | ||
| 1062 | skb = dev_alloc_skb(pkt_len+5); | 1050 | skb = dev_alloc_skb(pkt_len+5); |
| 1063 | 1051 | ||
| 1064 | DEBUG(3, " Receiving packet size %d status %4.4x.\n", | 1052 | pr_debug(" Receiving packet size %d status %4.4x.\n", |
| 1065 | pkt_len, rx_status); | 1053 | pkt_len, rx_status); |
| 1066 | if (skb != NULL) { | 1054 | if (skb != NULL) { |
| 1067 | skb_reserve(skb, 2); | 1055 | skb_reserve(skb, 2); |
| @@ -1072,7 +1060,7 @@ static int el3_rx(struct net_device *dev, int worklimit) | |||
| 1072 | dev->stats.rx_packets++; | 1060 | dev->stats.rx_packets++; |
| 1073 | dev->stats.rx_bytes += pkt_len; | 1061 | dev->stats.rx_bytes += pkt_len; |
| 1074 | } else { | 1062 | } else { |
| 1075 | DEBUG(1, "%s: couldn't allocate a sk_buff of" | 1063 | pr_debug("%s: couldn't allocate a sk_buff of" |
| 1076 | " size %d.\n", dev->name, pkt_len); | 1064 | " size %d.\n", dev->name, pkt_len); |
| 1077 | dev->stats.rx_dropped++; | 1065 | dev->stats.rx_dropped++; |
| 1078 | } | 1066 | } |
| @@ -1101,7 +1089,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
| 1101 | struct mii_ioctl_data *data = if_mii(rq); | 1089 | struct mii_ioctl_data *data = if_mii(rq); |
| 1102 | int phy = lp->phys & 0x1f; | 1090 | int phy = lp->phys & 0x1f; |
| 1103 | 1091 | ||
| 1104 | DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n", | 1092 | pr_debug("%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n", |
| 1105 | dev->name, rq->ifr_ifrn.ifrn_name, cmd, | 1093 | dev->name, rq->ifr_ifrn.ifrn_name, cmd, |
| 1106 | data->phy_id, data->reg_num, data->val_in, data->val_out); | 1094 | data->phy_id, data->reg_num, data->val_in, data->val_out); |
| 1107 | 1095 | ||
| @@ -1178,7 +1166,7 @@ static int el3_close(struct net_device *dev) | |||
| 1178 | struct el3_private *lp = netdev_priv(dev); | 1166 | struct el3_private *lp = netdev_priv(dev); |
| 1179 | struct pcmcia_device *link = lp->p_dev; | 1167 | struct pcmcia_device *link = lp->p_dev; |
| 1180 | 1168 | ||
| 1181 | DEBUG(2, "%s: shutting down ethercard.\n", dev->name); | 1169 | dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name); |
| 1182 | 1170 | ||
| 1183 | if (pcmcia_dev_present(link)) { | 1171 | if (pcmcia_dev_present(link)) { |
| 1184 | unsigned long flags; | 1172 | unsigned long flags; |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 569fb06793cf..6f8d7e2e5922 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
| @@ -130,14 +130,6 @@ MODULE_LICENSE("GPL"); | |||
| 130 | /* Special hook for setting if_port when module is loaded */ | 130 | /* Special hook for setting if_port when module is loaded */ |
| 131 | INT_MODULE_PARM(if_port, 0); | 131 | INT_MODULE_PARM(if_port, 0); |
| 132 | 132 | ||
| 133 | #ifdef PCMCIA_DEBUG | ||
| 134 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
| 135 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 136 | static char *version = | ||
| 137 | DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)"; | ||
| 138 | #else | ||
| 139 | #define DEBUG(n, args...) | ||
| 140 | #endif | ||
| 141 | 133 | ||
| 142 | /*====================================================================*/ | 134 | /*====================================================================*/ |
| 143 | 135 | ||
| @@ -189,7 +181,7 @@ static int tc589_probe(struct pcmcia_device *link) | |||
| 189 | struct el3_private *lp; | 181 | struct el3_private *lp; |
| 190 | struct net_device *dev; | 182 | struct net_device *dev; |
| 191 | 183 | ||
| 192 | DEBUG(0, "3c589_attach()\n"); | 184 | dev_dbg(&link->dev, "3c589_attach()\n"); |
| 193 | 185 | ||
| 194 | /* Create new ethernet device */ | 186 | /* Create new ethernet device */ |
| 195 | dev = alloc_etherdev(sizeof(struct el3_private)); | 187 | dev = alloc_etherdev(sizeof(struct el3_private)); |
| @@ -202,10 +194,8 @@ static int tc589_probe(struct pcmcia_device *link) | |||
| 202 | spin_lock_init(&lp->lock); | 194 | spin_lock_init(&lp->lock); |
| 203 | link->io.NumPorts1 = 16; | 195 | link->io.NumPorts1 = 16; |
| 204 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 196 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
| 205 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; | 197 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 206 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 207 | link->irq.Handler = &el3_interrupt; | 198 | link->irq.Handler = &el3_interrupt; |
| 208 | link->irq.Instance = dev; | ||
| 209 | link->conf.Attributes = CONF_ENABLE_IRQ; | 199 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 210 | link->conf.IntType = INT_MEMORY_AND_IO; | 200 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 211 | link->conf.ConfigIndex = 1; | 201 | link->conf.ConfigIndex = 1; |
| @@ -231,7 +221,7 @@ static void tc589_detach(struct pcmcia_device *link) | |||
| 231 | { | 221 | { |
| 232 | struct net_device *dev = link->priv; | 222 | struct net_device *dev = link->priv; |
| 233 | 223 | ||
| 234 | DEBUG(0, "3c589_detach(0x%p)\n", link); | 224 | dev_dbg(&link->dev, "3c589_detach\n"); |
| 235 | 225 | ||
| 236 | if (link->dev_node) | 226 | if (link->dev_node) |
| 237 | unregister_netdev(dev); | 227 | unregister_netdev(dev); |
| @@ -249,29 +239,20 @@ static void tc589_detach(struct pcmcia_device *link) | |||
| 249 | 239 | ||
| 250 | ======================================================================*/ | 240 | ======================================================================*/ |
| 251 | 241 | ||
| 252 | #define CS_CHECK(fn, ret) \ | ||
| 253 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 254 | |||
| 255 | static int tc589_config(struct pcmcia_device *link) | 242 | static int tc589_config(struct pcmcia_device *link) |
| 256 | { | 243 | { |
| 257 | struct net_device *dev = link->priv; | 244 | struct net_device *dev = link->priv; |
| 258 | struct el3_private *lp = netdev_priv(dev); | 245 | struct el3_private *lp = netdev_priv(dev); |
| 259 | tuple_t tuple; | ||
| 260 | __le16 buf[32]; | ||
| 261 | __be16 *phys_addr; | 246 | __be16 *phys_addr; |
| 262 | int last_fn, last_ret, i, j, multi = 0, fifo; | 247 | int ret, i, j, multi = 0, fifo; |
| 263 | unsigned int ioaddr; | 248 | unsigned int ioaddr; |
| 264 | char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; | 249 | char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; |
| 250 | u8 *buf; | ||
| 251 | size_t len; | ||
| 265 | 252 | ||
| 266 | DEBUG(0, "3c589_config(0x%p)\n", link); | 253 | dev_dbg(&link->dev, "3c589_config\n"); |
| 267 | 254 | ||
| 268 | phys_addr = (__be16 *)dev->dev_addr; | 255 | phys_addr = (__be16 *)dev->dev_addr; |
| 269 | tuple.Attributes = 0; | ||
| 270 | tuple.TupleData = (cisdata_t *)buf; | ||
| 271 | tuple.TupleDataMax = sizeof(buf); | ||
| 272 | tuple.TupleOffset = 0; | ||
| 273 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
| 274 | |||
| 275 | /* Is this a 3c562? */ | 256 | /* Is this a 3c562? */ |
| 276 | if (link->manf_id != MANFID_3COM) | 257 | if (link->manf_id != MANFID_3COM) |
| 277 | printk(KERN_INFO "3c589_cs: hmmm, is this really a " | 258 | printk(KERN_INFO "3c589_cs: hmmm, is this really a " |
| @@ -287,12 +268,16 @@ static int tc589_config(struct pcmcia_device *link) | |||
| 287 | if (i == 0) | 268 | if (i == 0) |
| 288 | break; | 269 | break; |
| 289 | } | 270 | } |
| 290 | if (i != 0) { | 271 | if (i != 0) |
| 291 | cs_error(link, RequestIO, i); | ||
| 292 | goto failed; | 272 | goto failed; |
| 293 | } | 273 | |
| 294 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 274 | ret = pcmcia_request_irq(link, &link->irq); |
| 295 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 275 | if (ret) |
| 276 | goto failed; | ||
| 277 | |||
| 278 | ret = pcmcia_request_configuration(link, &link->conf); | ||
| 279 | if (ret) | ||
| 280 | goto failed; | ||
| 296 | 281 | ||
| 297 | dev->irq = link->irq.AssignedIRQ; | 282 | dev->irq = link->irq.AssignedIRQ; |
| 298 | dev->base_addr = link->io.BasePort1; | 283 | dev->base_addr = link->io.BasePort1; |
| @@ -301,12 +286,13 @@ static int tc589_config(struct pcmcia_device *link) | |||
| 301 | 286 | ||
| 302 | /* The 3c589 has an extra EEPROM for configuration info, including | 287 | /* The 3c589 has an extra EEPROM for configuration info, including |
| 303 | the hardware address. The 3c562 puts the address in the CIS. */ | 288 | the hardware address. The 3c562 puts the address in the CIS. */ |
| 304 | tuple.DesiredTuple = 0x88; | 289 | len = pcmcia_get_tuple(link, 0x88, &buf); |
| 305 | if (pcmcia_get_first_tuple(link, &tuple) == 0) { | 290 | if (buf && len >= 6) { |
| 306 | pcmcia_get_tuple_data(link, &tuple); | 291 | for (i = 0; i < 3; i++) |
| 307 | for (i = 0; i < 3; i++) | 292 | phys_addr[i] = htons(le16_to_cpu(buf[i*2])); |
| 308 | phys_addr[i] = htons(le16_to_cpu(buf[i])); | 293 | kfree(buf); |
| 309 | } else { | 294 | } else { |
| 295 | kfree(buf); /* 0 < len < 6 */ | ||
| 310 | for (i = 0; i < 3; i++) | 296 | for (i = 0; i < 3; i++) |
| 311 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); | 297 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); |
| 312 | if (phys_addr[0] == htons(0x6060)) { | 298 | if (phys_addr[0] == htons(0x6060)) { |
| @@ -328,7 +314,7 @@ static int tc589_config(struct pcmcia_device *link) | |||
| 328 | printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); | 314 | printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); |
| 329 | 315 | ||
| 330 | link->dev_node = &lp->node; | 316 | link->dev_node = &lp->node; |
| 331 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 317 | SET_NETDEV_DEV(dev, &link->dev); |
| 332 | 318 | ||
| 333 | if (register_netdev(dev) != 0) { | 319 | if (register_netdev(dev) != 0) { |
| 334 | printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); | 320 | printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); |
| @@ -347,8 +333,6 @@ static int tc589_config(struct pcmcia_device *link) | |||
| 347 | if_names[dev->if_port]); | 333 | if_names[dev->if_port]); |
| 348 | return 0; | 334 | return 0; |
| 349 | 335 | ||
| 350 | cs_failed: | ||
| 351 | cs_error(link, last_fn, last_ret); | ||
| 352 | failed: | 336 | failed: |
| 353 | tc589_release(link); | 337 | tc589_release(link); |
| 354 | return -ENODEV; | 338 | return -ENODEV; |
| @@ -511,24 +495,8 @@ static void netdev_get_drvinfo(struct net_device *dev, | |||
| 511 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); | 495 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); |
| 512 | } | 496 | } |
| 513 | 497 | ||
| 514 | #ifdef PCMCIA_DEBUG | ||
| 515 | static u32 netdev_get_msglevel(struct net_device *dev) | ||
| 516 | { | ||
| 517 | return pc_debug; | ||
| 518 | } | ||
| 519 | |||
| 520 | static void netdev_set_msglevel(struct net_device *dev, u32 level) | ||
| 521 | { | ||
| 522 | pc_debug = level; | ||
| 523 | } | ||
| 524 | #endif /* PCMCIA_DEBUG */ | ||
| 525 | |||
| 526 | static const struct ethtool_ops netdev_ethtool_ops = { | 498 | static const struct ethtool_ops netdev_ethtool_ops = { |
| 527 | .get_drvinfo = netdev_get_drvinfo, | 499 | .get_drvinfo = netdev_get_drvinfo, |
| 528 | #ifdef PCMCIA_DEBUG | ||
| 529 | .get_msglevel = netdev_get_msglevel, | ||
| 530 | .set_msglevel = netdev_set_msglevel, | ||
| 531 | #endif /* PCMCIA_DEBUG */ | ||
| 532 | }; | 500 | }; |
| 533 | 501 | ||
| 534 | static int el3_config(struct net_device *dev, struct ifmap *map) | 502 | static int el3_config(struct net_device *dev, struct ifmap *map) |
| @@ -563,7 +531,7 @@ static int el3_open(struct net_device *dev) | |||
| 563 | lp->media.expires = jiffies + HZ; | 531 | lp->media.expires = jiffies + HZ; |
| 564 | add_timer(&lp->media); | 532 | add_timer(&lp->media); |
| 565 | 533 | ||
| 566 | DEBUG(1, "%s: opened, status %4.4x.\n", | 534 | dev_dbg(&link->dev, "%s: opened, status %4.4x.\n", |
| 567 | dev->name, inw(dev->base_addr + EL3_STATUS)); | 535 | dev->name, inw(dev->base_addr + EL3_STATUS)); |
| 568 | 536 | ||
| 569 | return 0; | 537 | return 0; |
| @@ -596,7 +564,7 @@ static void pop_tx_status(struct net_device *dev) | |||
| 596 | if (tx_status & 0x30) | 564 | if (tx_status & 0x30) |
| 597 | tc589_wait_for_completion(dev, TxReset); | 565 | tc589_wait_for_completion(dev, TxReset); |
| 598 | if (tx_status & 0x38) { | 566 | if (tx_status & 0x38) { |
| 599 | DEBUG(1, "%s: transmit error: status 0x%02x\n", | 567 | pr_debug("%s: transmit error: status 0x%02x\n", |
| 600 | dev->name, tx_status); | 568 | dev->name, tx_status); |
| 601 | outw(TxEnable, ioaddr + EL3_CMD); | 569 | outw(TxEnable, ioaddr + EL3_CMD); |
| 602 | dev->stats.tx_aborted_errors++; | 570 | dev->stats.tx_aborted_errors++; |
| @@ -612,7 +580,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb, | |||
| 612 | struct el3_private *priv = netdev_priv(dev); | 580 | struct el3_private *priv = netdev_priv(dev); |
| 613 | unsigned long flags; | 581 | unsigned long flags; |
| 614 | 582 | ||
| 615 | DEBUG(3, "%s: el3_start_xmit(length = %ld) called, " | 583 | pr_debug("%s: el3_start_xmit(length = %ld) called, " |
| 616 | "status %4.4x.\n", dev->name, (long)skb->len, | 584 | "status %4.4x.\n", dev->name, (long)skb->len, |
| 617 | inw(ioaddr + EL3_STATUS)); | 585 | inw(ioaddr + EL3_STATUS)); |
| 618 | 586 | ||
| @@ -654,14 +622,14 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
| 654 | 622 | ||
| 655 | ioaddr = dev->base_addr; | 623 | ioaddr = dev->base_addr; |
| 656 | 624 | ||
| 657 | DEBUG(3, "%s: interrupt, status %4.4x.\n", | 625 | pr_debug("%s: interrupt, status %4.4x.\n", |
| 658 | dev->name, inw(ioaddr + EL3_STATUS)); | 626 | dev->name, inw(ioaddr + EL3_STATUS)); |
| 659 | 627 | ||
| 660 | spin_lock(&lp->lock); | 628 | spin_lock(&lp->lock); |
| 661 | while ((status = inw(ioaddr + EL3_STATUS)) & | 629 | while ((status = inw(ioaddr + EL3_STATUS)) & |
| 662 | (IntLatch | RxComplete | StatsFull)) { | 630 | (IntLatch | RxComplete | StatsFull)) { |
| 663 | if ((status & 0xe000) != 0x2000) { | 631 | if ((status & 0xe000) != 0x2000) { |
| 664 | DEBUG(1, "%s: interrupt from dead card\n", dev->name); | 632 | pr_debug("%s: interrupt from dead card\n", dev->name); |
| 665 | handled = 0; | 633 | handled = 0; |
| 666 | break; | 634 | break; |
| 667 | } | 635 | } |
| @@ -670,7 +638,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
| 670 | el3_rx(dev); | 638 | el3_rx(dev); |
| 671 | 639 | ||
| 672 | if (status & TxAvailable) { | 640 | if (status & TxAvailable) { |
| 673 | DEBUG(3, " TX room bit was handled.\n"); | 641 | pr_debug(" TX room bit was handled.\n"); |
| 674 | /* There's room in the FIFO for a full-sized packet. */ | 642 | /* There's room in the FIFO for a full-sized packet. */ |
| 675 | outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); | 643 | outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); |
| 676 | netif_wake_queue(dev); | 644 | netif_wake_queue(dev); |
| @@ -722,7 +690,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
| 722 | 690 | ||
| 723 | lp->last_irq = jiffies; | 691 | lp->last_irq = jiffies; |
| 724 | spin_unlock(&lp->lock); | 692 | spin_unlock(&lp->lock); |
| 725 | DEBUG(3, "%s: exiting interrupt, status %4.4x.\n", | 693 | pr_debug("%s: exiting interrupt, status %4.4x.\n", |
| 726 | dev->name, inw(ioaddr + EL3_STATUS)); | 694 | dev->name, inw(ioaddr + EL3_STATUS)); |
| 727 | return IRQ_RETVAL(handled); | 695 | return IRQ_RETVAL(handled); |
| 728 | } | 696 | } |
| @@ -833,7 +801,7 @@ static void update_stats(struct net_device *dev) | |||
| 833 | { | 801 | { |
| 834 | unsigned int ioaddr = dev->base_addr; | 802 | unsigned int ioaddr = dev->base_addr; |
| 835 | 803 | ||
| 836 | DEBUG(2, "%s: updating the statistics.\n", dev->name); | 804 | pr_debug("%s: updating the statistics.\n", dev->name); |
| 837 | /* Turn off statistics updates while reading. */ | 805 | /* Turn off statistics updates while reading. */ |
| 838 | outw(StatsDisable, ioaddr + EL3_CMD); | 806 | outw(StatsDisable, ioaddr + EL3_CMD); |
| 839 | /* Switch to the stats window, and read everything. */ | 807 | /* Switch to the stats window, and read everything. */ |
| @@ -861,7 +829,7 @@ static int el3_rx(struct net_device *dev) | |||
| 861 | int worklimit = 32; | 829 | int worklimit = 32; |
| 862 | short rx_status; | 830 | short rx_status; |
| 863 | 831 | ||
| 864 | DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", | 832 | pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", |
| 865 | dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS)); | 833 | dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS)); |
| 866 | while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) && | 834 | while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) && |
| 867 | worklimit > 0) { | 835 | worklimit > 0) { |
| @@ -883,7 +851,7 @@ static int el3_rx(struct net_device *dev) | |||
| 883 | 851 | ||
| 884 | skb = dev_alloc_skb(pkt_len+5); | 852 | skb = dev_alloc_skb(pkt_len+5); |
| 885 | 853 | ||
| 886 | DEBUG(3, " Receiving packet size %d status %4.4x.\n", | 854 | pr_debug(" Receiving packet size %d status %4.4x.\n", |
| 887 | pkt_len, rx_status); | 855 | pkt_len, rx_status); |
| 888 | if (skb != NULL) { | 856 | if (skb != NULL) { |
| 889 | skb_reserve(skb, 2); | 857 | skb_reserve(skb, 2); |
| @@ -894,7 +862,7 @@ static int el3_rx(struct net_device *dev) | |||
| 894 | dev->stats.rx_packets++; | 862 | dev->stats.rx_packets++; |
| 895 | dev->stats.rx_bytes += pkt_len; | 863 | dev->stats.rx_bytes += pkt_len; |
| 896 | } else { | 864 | } else { |
| 897 | DEBUG(1, "%s: couldn't allocate a sk_buff of" | 865 | pr_debug("%s: couldn't allocate a sk_buff of" |
| 898 | " size %d.\n", dev->name, pkt_len); | 866 | " size %d.\n", dev->name, pkt_len); |
| 899 | dev->stats.rx_dropped++; | 867 | dev->stats.rx_dropped++; |
| 900 | } | 868 | } |
| @@ -935,7 +903,7 @@ static int el3_close(struct net_device *dev) | |||
| 935 | struct pcmcia_device *link = lp->p_dev; | 903 | struct pcmcia_device *link = lp->p_dev; |
| 936 | unsigned int ioaddr = dev->base_addr; | 904 | unsigned int ioaddr = dev->base_addr; |
| 937 | 905 | ||
| 938 | DEBUG(1, "%s: shutting down ethercard.\n", dev->name); | 906 | dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name); |
| 939 | 907 | ||
| 940 | if (pcmcia_dev_present(link)) { | 908 | if (pcmcia_dev_present(link)) { |
| 941 | /* Turn off statistics ASAP. We update dev->stats below. */ | 909 | /* Turn off statistics ASAP. We update dev->stats below. */ |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 3131a59a8d32..800597b82d18 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
| @@ -75,16 +75,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); | |||
| 75 | MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver"); | 75 | MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver"); |
| 76 | MODULE_LICENSE("GPL"); | 76 | MODULE_LICENSE("GPL"); |
| 77 | 77 | ||
| 78 | #ifdef PCMCIA_DEBUG | ||
| 79 | #define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0) | ||
| 80 | |||
| 81 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
| 82 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 83 | static char *version = | ||
| 84 | "axnet_cs.c 1.28 2002/06/29 06:27:37 (David Hinds)"; | ||
| 85 | #else | ||
| 86 | #define DEBUG(n, args...) | ||
| 87 | #endif | ||
| 88 | 78 | ||
| 89 | /*====================================================================*/ | 79 | /*====================================================================*/ |
| 90 | 80 | ||
| @@ -167,7 +157,7 @@ static int axnet_probe(struct pcmcia_device *link) | |||
| 167 | struct net_device *dev; | 157 | struct net_device *dev; |
| 168 | struct ei_device *ei_local; | 158 | struct ei_device *ei_local; |
| 169 | 159 | ||
| 170 | DEBUG(0, "axnet_attach()\n"); | 160 | dev_dbg(&link->dev, "axnet_attach()\n"); |
| 171 | 161 | ||
| 172 | dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t)); | 162 | dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t)); |
| 173 | if (!dev) | 163 | if (!dev) |
| @@ -180,7 +170,6 @@ static int axnet_probe(struct pcmcia_device *link) | |||
| 180 | info->p_dev = link; | 170 | info->p_dev = link; |
| 181 | link->priv = dev; | 171 | link->priv = dev; |
| 182 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 172 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 183 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 184 | link->conf.Attributes = CONF_ENABLE_IRQ; | 173 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 185 | link->conf.IntType = INT_MEMORY_AND_IO; | 174 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 186 | 175 | ||
| @@ -205,7 +194,7 @@ static void axnet_detach(struct pcmcia_device *link) | |||
| 205 | { | 194 | { |
| 206 | struct net_device *dev = link->priv; | 195 | struct net_device *dev = link->priv; |
| 207 | 196 | ||
| 208 | DEBUG(0, "axnet_detach(0x%p)\n", link); | 197 | dev_dbg(&link->dev, "axnet_detach(0x%p)\n", link); |
| 209 | 198 | ||
| 210 | if (link->dev_node) | 199 | if (link->dev_node) |
| 211 | unregister_netdev(dev); | 200 | unregister_netdev(dev); |
| @@ -272,9 +261,6 @@ static int get_prom(struct pcmcia_device *link) | |||
| 272 | 261 | ||
| 273 | ======================================================================*/ | 262 | ======================================================================*/ |
| 274 | 263 | ||
| 275 | #define CS_CHECK(fn, ret) \ | ||
| 276 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 277 | |||
| 278 | static int try_io_port(struct pcmcia_device *link) | 264 | static int try_io_port(struct pcmcia_device *link) |
| 279 | { | 265 | { |
| 280 | int j, ret; | 266 | int j, ret; |
| @@ -341,26 +327,29 @@ static int axnet_config(struct pcmcia_device *link) | |||
| 341 | { | 327 | { |
| 342 | struct net_device *dev = link->priv; | 328 | struct net_device *dev = link->priv; |
| 343 | axnet_dev_t *info = PRIV(dev); | 329 | axnet_dev_t *info = PRIV(dev); |
| 344 | int i, j, j2, last_ret, last_fn; | 330 | int i, j, j2, ret; |
| 345 | 331 | ||
| 346 | DEBUG(0, "axnet_config(0x%p)\n", link); | 332 | dev_dbg(&link->dev, "axnet_config(0x%p)\n", link); |
| 347 | 333 | ||
| 348 | /* don't trust the CIS on this; Linksys got it wrong */ | 334 | /* don't trust the CIS on this; Linksys got it wrong */ |
| 349 | link->conf.Present = 0x63; | 335 | link->conf.Present = 0x63; |
| 350 | last_ret = pcmcia_loop_config(link, axnet_configcheck, NULL); | 336 | ret = pcmcia_loop_config(link, axnet_configcheck, NULL); |
| 351 | if (last_ret != 0) { | 337 | if (ret != 0) |
| 352 | cs_error(link, RequestIO, last_ret); | ||
| 353 | goto failed; | 338 | goto failed; |
| 354 | } | ||
| 355 | 339 | ||
| 356 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 340 | ret = pcmcia_request_irq(link, &link->irq); |
| 341 | if (ret) | ||
| 342 | goto failed; | ||
| 357 | 343 | ||
| 358 | if (link->io.NumPorts2 == 8) { | 344 | if (link->io.NumPorts2 == 8) { |
| 359 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 345 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
| 360 | link->conf.Status = CCSR_AUDIO_ENA; | 346 | link->conf.Status = CCSR_AUDIO_ENA; |
| 361 | } | 347 | } |
| 362 | 348 | ||
| 363 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 349 | ret = pcmcia_request_configuration(link, &link->conf); |
| 350 | if (ret) | ||
| 351 | goto failed; | ||
| 352 | |||
| 364 | dev->irq = link->irq.AssignedIRQ; | 353 | dev->irq = link->irq.AssignedIRQ; |
| 365 | dev->base_addr = link->io.BasePort1; | 354 | dev->base_addr = link->io.BasePort1; |
| 366 | 355 | ||
| @@ -410,7 +399,7 @@ static int axnet_config(struct pcmcia_device *link) | |||
| 410 | 399 | ||
| 411 | info->phy_id = (i < 32) ? i : -1; | 400 | info->phy_id = (i < 32) ? i : -1; |
| 412 | link->dev_node = &info->node; | 401 | link->dev_node = &info->node; |
| 413 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 402 | SET_NETDEV_DEV(dev, &link->dev); |
| 414 | 403 | ||
| 415 | if (register_netdev(dev) != 0) { | 404 | if (register_netdev(dev) != 0) { |
| 416 | printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); | 405 | printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); |
| @@ -426,14 +415,12 @@ static int axnet_config(struct pcmcia_device *link) | |||
| 426 | dev->base_addr, dev->irq, | 415 | dev->base_addr, dev->irq, |
| 427 | dev->dev_addr); | 416 | dev->dev_addr); |
| 428 | if (info->phy_id != -1) { | 417 | if (info->phy_id != -1) { |
| 429 | DEBUG(0, " MII transceiver at index %d, status %x.\n", info->phy_id, j); | 418 | dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n", info->phy_id, j); |
| 430 | } else { | 419 | } else { |
| 431 | printk(KERN_NOTICE " No MII transceivers found!\n"); | 420 | printk(KERN_NOTICE " No MII transceivers found!\n"); |
| 432 | } | 421 | } |
| 433 | return 0; | 422 | return 0; |
| 434 | 423 | ||
| 435 | cs_failed: | ||
| 436 | cs_error(link, last_fn, last_ret); | ||
| 437 | failed: | 424 | failed: |
| 438 | axnet_release(link); | 425 | axnet_release(link); |
| 439 | return -ENODEV; | 426 | return -ENODEV; |
| @@ -543,7 +530,7 @@ static int axnet_open(struct net_device *dev) | |||
| 543 | struct pcmcia_device *link = info->p_dev; | 530 | struct pcmcia_device *link = info->p_dev; |
| 544 | unsigned int nic_base = dev->base_addr; | 531 | unsigned int nic_base = dev->base_addr; |
| 545 | 532 | ||
| 546 | DEBUG(2, "axnet_open('%s')\n", dev->name); | 533 | dev_dbg(&link->dev, "axnet_open('%s')\n", dev->name); |
| 547 | 534 | ||
| 548 | if (!pcmcia_dev_present(link)) | 535 | if (!pcmcia_dev_present(link)) |
| 549 | return -ENODEV; | 536 | return -ENODEV; |
| @@ -572,7 +559,7 @@ static int axnet_close(struct net_device *dev) | |||
| 572 | axnet_dev_t *info = PRIV(dev); | 559 | axnet_dev_t *info = PRIV(dev); |
| 573 | struct pcmcia_device *link = info->p_dev; | 560 | struct pcmcia_device *link = info->p_dev; |
| 574 | 561 | ||
| 575 | DEBUG(2, "axnet_close('%s')\n", dev->name); | 562 | dev_dbg(&link->dev, "axnet_close('%s')\n", dev->name); |
| 576 | 563 | ||
| 577 | ax_close(dev); | 564 | ax_close(dev); |
| 578 | free_irq(dev->irq, dev); | 565 | free_irq(dev->irq, dev); |
| @@ -741,10 +728,8 @@ static void block_input(struct net_device *dev, int count, | |||
| 741 | int xfer_count = count; | 728 | int xfer_count = count; |
| 742 | char *buf = skb->data; | 729 | char *buf = skb->data; |
| 743 | 730 | ||
| 744 | #ifdef PCMCIA_DEBUG | ||
| 745 | if ((ei_debug > 4) && (count != 4)) | 731 | if ((ei_debug > 4) && (count != 4)) |
| 746 | printk(KERN_DEBUG "%s: [bi=%d]\n", dev->name, count+4); | 732 | pr_debug("%s: [bi=%d]\n", dev->name, count+4); |
| 747 | #endif | ||
| 748 | outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); | 733 | outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); |
| 749 | outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); | 734 | outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); |
| 750 | outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD); | 735 | outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD); |
| @@ -762,10 +747,7 @@ static void block_output(struct net_device *dev, int count, | |||
| 762 | { | 747 | { |
| 763 | unsigned int nic_base = dev->base_addr; | 748 | unsigned int nic_base = dev->base_addr; |
| 764 | 749 | ||
| 765 | #ifdef PCMCIA_DEBUG | 750 | pr_debug("%s: [bo=%d]\n", dev->name, count); |
| 766 | if (ei_debug > 4) | ||
| 767 | printk(KERN_DEBUG "%s: [bo=%d]\n", dev->name, count); | ||
| 768 | #endif | ||
| 769 | 751 | ||
| 770 | /* Round the count up for word writes. Do we need to do this? | 752 | /* Round the count up for word writes. Do we need to do this? |
| 771 | What effect will an odd byte count have on the 8390? | 753 | What effect will an odd byte count have on the 8390? |
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 7b5c77b7bd27..21d9c9d815d1 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
| @@ -53,11 +53,7 @@ | |||
| 53 | 53 | ||
| 54 | #define VERSION "arcnet: COM20020 PCMCIA support loaded.\n" | 54 | #define VERSION "arcnet: COM20020 PCMCIA support loaded.\n" |
| 55 | 55 | ||
| 56 | #ifdef PCMCIA_DEBUG | 56 | #ifdef DEBUG |
| 57 | |||
| 58 | static int pc_debug = PCMCIA_DEBUG; | ||
| 59 | module_param(pc_debug, int, 0); | ||
| 60 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 61 | 57 | ||
| 62 | static void regdump(struct net_device *dev) | 58 | static void regdump(struct net_device *dev) |
| 63 | { | 59 | { |
| @@ -92,7 +88,6 @@ static void regdump(struct net_device *dev) | |||
| 92 | 88 | ||
| 93 | #else | 89 | #else |
| 94 | 90 | ||
| 95 | #define DEBUG(n, args...) do { } while (0) | ||
| 96 | static inline void regdump(struct net_device *dev) { } | 91 | static inline void regdump(struct net_device *dev) { } |
| 97 | 92 | ||
| 98 | #endif | 93 | #endif |
| @@ -144,7 +139,7 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
| 144 | struct net_device *dev; | 139 | struct net_device *dev; |
| 145 | struct arcnet_local *lp; | 140 | struct arcnet_local *lp; |
| 146 | 141 | ||
| 147 | DEBUG(0, "com20020_attach()\n"); | 142 | dev_dbg(&p_dev->dev, "com20020_attach()\n"); |
| 148 | 143 | ||
| 149 | /* Create new network device */ | 144 | /* Create new network device */ |
| 150 | info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); | 145 | info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); |
| @@ -169,11 +164,10 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
| 169 | p_dev->io.NumPorts1 = 16; | 164 | p_dev->io.NumPorts1 = 16; |
| 170 | p_dev->io.IOAddrLines = 16; | 165 | p_dev->io.IOAddrLines = 16; |
| 171 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 166 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
| 172 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 173 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 167 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
| 174 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 168 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
| 175 | 169 | ||
| 176 | p_dev->irq.Instance = info->dev = dev; | 170 | info->dev = dev; |
| 177 | p_dev->priv = info; | 171 | p_dev->priv = info; |
| 178 | 172 | ||
| 179 | return com20020_config(p_dev); | 173 | return com20020_config(p_dev); |
| @@ -198,12 +192,12 @@ static void com20020_detach(struct pcmcia_device *link) | |||
| 198 | struct com20020_dev_t *info = link->priv; | 192 | struct com20020_dev_t *info = link->priv; |
| 199 | struct net_device *dev = info->dev; | 193 | struct net_device *dev = info->dev; |
| 200 | 194 | ||
| 201 | DEBUG(1,"detach...\n"); | 195 | dev_dbg(&link->dev, "detach...\n"); |
| 202 | 196 | ||
| 203 | DEBUG(0, "com20020_detach(0x%p)\n", link); | 197 | dev_dbg(&link->dev, "com20020_detach\n"); |
| 204 | 198 | ||
| 205 | if (link->dev_node) { | 199 | if (link->dev_node) { |
| 206 | DEBUG(1,"unregister...\n"); | 200 | dev_dbg(&link->dev, "unregister...\n"); |
| 207 | 201 | ||
| 208 | unregister_netdev(dev); | 202 | unregister_netdev(dev); |
| 209 | 203 | ||
| @@ -218,16 +212,16 @@ static void com20020_detach(struct pcmcia_device *link) | |||
| 218 | com20020_release(link); | 212 | com20020_release(link); |
| 219 | 213 | ||
| 220 | /* Unlink device structure, free bits */ | 214 | /* Unlink device structure, free bits */ |
| 221 | DEBUG(1,"unlinking...\n"); | 215 | dev_dbg(&link->dev, "unlinking...\n"); |
| 222 | if (link->priv) | 216 | if (link->priv) |
| 223 | { | 217 | { |
| 224 | dev = info->dev; | 218 | dev = info->dev; |
| 225 | if (dev) | 219 | if (dev) |
| 226 | { | 220 | { |
| 227 | DEBUG(1,"kfree...\n"); | 221 | dev_dbg(&link->dev, "kfree...\n"); |
| 228 | free_netdev(dev); | 222 | free_netdev(dev); |
| 229 | } | 223 | } |
| 230 | DEBUG(1,"kfree2...\n"); | 224 | dev_dbg(&link->dev, "kfree2...\n"); |
| 231 | kfree(info); | 225 | kfree(info); |
| 232 | } | 226 | } |
| 233 | 227 | ||
| @@ -241,25 +235,22 @@ static void com20020_detach(struct pcmcia_device *link) | |||
| 241 | 235 | ||
| 242 | ======================================================================*/ | 236 | ======================================================================*/ |
| 243 | 237 | ||
| 244 | #define CS_CHECK(fn, ret) \ | ||
| 245 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 246 | |||
| 247 | static int com20020_config(struct pcmcia_device *link) | 238 | static int com20020_config(struct pcmcia_device *link) |
| 248 | { | 239 | { |
| 249 | struct arcnet_local *lp; | 240 | struct arcnet_local *lp; |
| 250 | com20020_dev_t *info; | 241 | com20020_dev_t *info; |
| 251 | struct net_device *dev; | 242 | struct net_device *dev; |
| 252 | int i, last_ret, last_fn; | 243 | int i, ret; |
| 253 | int ioaddr; | 244 | int ioaddr; |
| 254 | 245 | ||
| 255 | info = link->priv; | 246 | info = link->priv; |
| 256 | dev = info->dev; | 247 | dev = info->dev; |
| 257 | 248 | ||
| 258 | DEBUG(1,"config...\n"); | 249 | dev_dbg(&link->dev, "config...\n"); |
| 259 | 250 | ||
| 260 | DEBUG(0, "com20020_config(0x%p)\n", link); | 251 | dev_dbg(&link->dev, "com20020_config\n"); |
| 261 | 252 | ||
| 262 | DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); | 253 | dev_dbg(&link->dev, "baseport1 is %Xh\n", link->io.BasePort1); |
| 263 | i = -ENODEV; | 254 | i = -ENODEV; |
| 264 | if (!link->io.BasePort1) | 255 | if (!link->io.BasePort1) |
| 265 | { | 256 | { |
| @@ -276,26 +267,27 @@ static int com20020_config(struct pcmcia_device *link) | |||
| 276 | 267 | ||
| 277 | if (i != 0) | 268 | if (i != 0) |
| 278 | { | 269 | { |
| 279 | DEBUG(1,"arcnet: requestIO failed totally!\n"); | 270 | dev_dbg(&link->dev, "requestIO failed totally!\n"); |
| 280 | goto failed; | 271 | goto failed; |
| 281 | } | 272 | } |
| 282 | 273 | ||
| 283 | ioaddr = dev->base_addr = link->io.BasePort1; | 274 | ioaddr = dev->base_addr = link->io.BasePort1; |
| 284 | DEBUG(1,"arcnet: got ioaddr %Xh\n", ioaddr); | 275 | dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr); |
| 285 | 276 | ||
| 286 | DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n", | 277 | dev_dbg(&link->dev, "request IRQ %d\n", |
| 287 | link->irq.AssignedIRQ, | 278 | link->irq.AssignedIRQ); |
| 288 | link->irq.IRQInfo1, link->irq.IRQInfo2); | ||
| 289 | i = pcmcia_request_irq(link, &link->irq); | 279 | i = pcmcia_request_irq(link, &link->irq); |
| 290 | if (i != 0) | 280 | if (i != 0) |
| 291 | { | 281 | { |
| 292 | DEBUG(1,"arcnet: requestIRQ failed totally!\n"); | 282 | dev_dbg(&link->dev, "requestIRQ failed totally!\n"); |
| 293 | goto failed; | 283 | goto failed; |
| 294 | } | 284 | } |
| 295 | 285 | ||
| 296 | dev->irq = link->irq.AssignedIRQ; | 286 | dev->irq = link->irq.AssignedIRQ; |
| 297 | 287 | ||
| 298 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 288 | ret = pcmcia_request_configuration(link, &link->conf); |
| 289 | if (ret) | ||
| 290 | goto failed; | ||
| 299 | 291 | ||
| 300 | if (com20020_check(dev)) | 292 | if (com20020_check(dev)) |
| 301 | { | 293 | { |
| @@ -308,26 +300,25 @@ static int com20020_config(struct pcmcia_device *link) | |||
| 308 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ | 300 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ |
| 309 | 301 | ||
| 310 | link->dev_node = &info->node; | 302 | link->dev_node = &info->node; |
| 311 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 303 | SET_NETDEV_DEV(dev, &link->dev); |
| 312 | 304 | ||
| 313 | i = com20020_found(dev, 0); /* calls register_netdev */ | 305 | i = com20020_found(dev, 0); /* calls register_netdev */ |
| 314 | 306 | ||
| 315 | if (i != 0) { | 307 | if (i != 0) { |
| 316 | DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n"); | 308 | dev_printk(KERN_NOTICE, &link->dev, |
| 309 | "com20020_cs: com20020_found() failed\n"); | ||
| 317 | link->dev_node = NULL; | 310 | link->dev_node = NULL; |
| 318 | goto failed; | 311 | goto failed; |
| 319 | } | 312 | } |
| 320 | 313 | ||
| 321 | strcpy(info->node.dev_name, dev->name); | 314 | strcpy(info->node.dev_name, dev->name); |
| 322 | 315 | ||
| 323 | DEBUG(1,KERN_INFO "%s: port %#3lx, irq %d\n", | 316 | dev_dbg(&link->dev,KERN_INFO "%s: port %#3lx, irq %d\n", |
| 324 | dev->name, dev->base_addr, dev->irq); | 317 | dev->name, dev->base_addr, dev->irq); |
| 325 | return 0; | 318 | return 0; |
| 326 | 319 | ||
| 327 | cs_failed: | ||
| 328 | cs_error(link, last_fn, last_ret); | ||
| 329 | failed: | 320 | failed: |
| 330 | DEBUG(1,"com20020_config failed...\n"); | 321 | dev_dbg(&link->dev, "com20020_config failed...\n"); |
| 331 | com20020_release(link); | 322 | com20020_release(link); |
| 332 | return -ENODEV; | 323 | return -ENODEV; |
| 333 | } /* com20020_config */ | 324 | } /* com20020_config */ |
| @@ -342,7 +333,7 @@ failed: | |||
| 342 | 333 | ||
| 343 | static void com20020_release(struct pcmcia_device *link) | 334 | static void com20020_release(struct pcmcia_device *link) |
| 344 | { | 335 | { |
| 345 | DEBUG(0, "com20020_release(0x%p)\n", link); | 336 | dev_dbg(&link->dev, "com20020_release\n"); |
| 346 | pcmcia_disable_device(link); | 337 | pcmcia_disable_device(link); |
| 347 | } | 338 | } |
| 348 | 339 | ||
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 7e01fbdb87e0..6e3e1ced6db4 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
| @@ -72,13 +72,6 @@ MODULE_LICENSE("GPL"); | |||
| 72 | /* 0:4KB*2 TX buffer else:8KB*2 TX buffer */ | 72 | /* 0:4KB*2 TX buffer else:8KB*2 TX buffer */ |
| 73 | INT_MODULE_PARM(sram_config, 0); | 73 | INT_MODULE_PARM(sram_config, 0); |
| 74 | 74 | ||
| 75 | #ifdef PCMCIA_DEBUG | ||
| 76 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
| 77 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 78 | static char *version = DRV_NAME ".c " DRV_VERSION " 2002/03/23"; | ||
| 79 | #else | ||
| 80 | #define DEBUG(n, args...) | ||
| 81 | #endif | ||
| 82 | 75 | ||
| 83 | /*====================================================================*/ | 76 | /*====================================================================*/ |
| 84 | /* | 77 | /* |
| @@ -245,7 +238,7 @@ static int fmvj18x_probe(struct pcmcia_device *link) | |||
| 245 | local_info_t *lp; | 238 | local_info_t *lp; |
| 246 | struct net_device *dev; | 239 | struct net_device *dev; |
| 247 | 240 | ||
| 248 | DEBUG(0, "fmvj18x_attach()\n"); | 241 | dev_dbg(&link->dev, "fmvj18x_attach()\n"); |
| 249 | 242 | ||
| 250 | /* Make up a FMVJ18x specific data structure */ | 243 | /* Make up a FMVJ18x specific data structure */ |
| 251 | dev = alloc_etherdev(sizeof(local_info_t)); | 244 | dev = alloc_etherdev(sizeof(local_info_t)); |
| @@ -262,10 +255,8 @@ static int fmvj18x_probe(struct pcmcia_device *link) | |||
| 262 | link->io.IOAddrLines = 5; | 255 | link->io.IOAddrLines = 5; |
| 263 | 256 | ||
| 264 | /* Interrupt setup */ | 257 | /* Interrupt setup */ |
| 265 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; | 258 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 266 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 267 | link->irq.Handler = &fjn_interrupt; | 259 | link->irq.Handler = &fjn_interrupt; |
| 268 | link->irq.Instance = dev; | ||
| 269 | 260 | ||
| 270 | /* General socket configuration */ | 261 | /* General socket configuration */ |
| 271 | link->conf.Attributes = CONF_ENABLE_IRQ; | 262 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| @@ -285,7 +276,7 @@ static void fmvj18x_detach(struct pcmcia_device *link) | |||
| 285 | { | 276 | { |
| 286 | struct net_device *dev = link->priv; | 277 | struct net_device *dev = link->priv; |
| 287 | 278 | ||
| 288 | DEBUG(0, "fmvj18x_detach(0x%p)\n", link); | 279 | dev_dbg(&link->dev, "fmvj18x_detach\n"); |
| 289 | 280 | ||
| 290 | if (link->dev_node) | 281 | if (link->dev_node) |
| 291 | unregister_netdev(dev); | 282 | unregister_netdev(dev); |
| @@ -297,9 +288,6 @@ static void fmvj18x_detach(struct pcmcia_device *link) | |||
| 297 | 288 | ||
| 298 | /*====================================================================*/ | 289 | /*====================================================================*/ |
| 299 | 290 | ||
| 300 | #define CS_CHECK(fn, ret) \ | ||
| 301 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 302 | |||
| 303 | static int mfc_try_io_port(struct pcmcia_device *link) | 291 | static int mfc_try_io_port(struct pcmcia_device *link) |
| 304 | { | 292 | { |
| 305 | int i, ret; | 293 | int i, ret; |
| @@ -341,33 +329,38 @@ static int ungermann_try_io_port(struct pcmcia_device *link) | |||
| 341 | return ret; /* RequestIO failed */ | 329 | return ret; /* RequestIO failed */ |
| 342 | } | 330 | } |
| 343 | 331 | ||
| 332 | static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, | ||
| 333 | cistpl_cftable_entry_t *cfg, | ||
| 334 | cistpl_cftable_entry_t *dflt, | ||
| 335 | unsigned int vcc, | ||
| 336 | void *priv_data) | ||
| 337 | { | ||
| 338 | return 0; /* strange, but that's what the code did already before... */ | ||
| 339 | } | ||
| 340 | |||
| 344 | static int fmvj18x_config(struct pcmcia_device *link) | 341 | static int fmvj18x_config(struct pcmcia_device *link) |
| 345 | { | 342 | { |
| 346 | struct net_device *dev = link->priv; | 343 | struct net_device *dev = link->priv; |
| 347 | local_info_t *lp = netdev_priv(dev); | 344 | local_info_t *lp = netdev_priv(dev); |
| 348 | tuple_t tuple; | 345 | int i, ret; |
| 349 | cisparse_t parse; | ||
| 350 | u_short buf[32]; | ||
| 351 | int i, last_fn = 0, last_ret = 0, ret; | ||
| 352 | unsigned int ioaddr; | 346 | unsigned int ioaddr; |
| 353 | cardtype_t cardtype; | 347 | cardtype_t cardtype; |
| 354 | char *card_name = "unknown"; | 348 | char *card_name = "unknown"; |
| 355 | u_char *node_id; | 349 | u8 *buf; |
| 350 | size_t len; | ||
| 351 | u_char buggybuf[32]; | ||
| 352 | |||
| 353 | dev_dbg(&link->dev, "fmvj18x_config\n"); | ||
| 356 | 354 | ||
| 357 | DEBUG(0, "fmvj18x_config(0x%p)\n", link); | 355 | len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); |
| 356 | kfree(buf); | ||
| 358 | 357 | ||
| 359 | tuple.TupleData = (u_char *)buf; | 358 | if (len) { |
| 360 | tuple.TupleDataMax = 64; | ||
| 361 | tuple.TupleOffset = 0; | ||
| 362 | tuple.DesiredTuple = CISTPL_FUNCE; | ||
| 363 | tuple.TupleOffset = 0; | ||
| 364 | if (pcmcia_get_first_tuple(link, &tuple) == 0) { | ||
| 365 | /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ | 359 | /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ |
| 366 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 360 | ret = pcmcia_loop_config(link, fmvj18x_ioprobe, NULL); |
| 367 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 361 | if (ret != 0) |
| 368 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 362 | goto failed; |
| 369 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(&tuple, &parse)); | 363 | |
| 370 | link->conf.ConfigIndex = parse.cftable_entry.index; | ||
| 371 | switch (link->manf_id) { | 364 | switch (link->manf_id) { |
| 372 | case MANFID_TDK: | 365 | case MANFID_TDK: |
| 373 | cardtype = TDK; | 366 | cardtype = TDK; |
| @@ -433,17 +426,24 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
| 433 | 426 | ||
| 434 | if (link->io.NumPorts2 != 0) { | 427 | if (link->io.NumPorts2 != 0) { |
| 435 | link->irq.Attributes = | 428 | link->irq.Attributes = |
| 436 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED|IRQ_HANDLE_PRESENT; | 429 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
| 437 | ret = mfc_try_io_port(link); | 430 | ret = mfc_try_io_port(link); |
| 438 | if (ret != 0) goto cs_failed; | 431 | if (ret != 0) goto failed; |
| 439 | } else if (cardtype == UNGERMANN) { | 432 | } else if (cardtype == UNGERMANN) { |
| 440 | ret = ungermann_try_io_port(link); | 433 | ret = ungermann_try_io_port(link); |
| 441 | if (ret != 0) goto cs_failed; | 434 | if (ret != 0) goto failed; |
| 442 | } else { | 435 | } else { |
| 443 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | 436 | ret = pcmcia_request_io(link, &link->io); |
| 437 | if (ret) | ||
| 438 | goto failed; | ||
| 444 | } | 439 | } |
| 445 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 440 | ret = pcmcia_request_irq(link, &link->irq); |
| 446 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 441 | if (ret) |
| 442 | goto failed; | ||
| 443 | ret = pcmcia_request_configuration(link, &link->conf); | ||
| 444 | if (ret) | ||
| 445 | goto failed; | ||
| 446 | |||
| 447 | dev->irq = link->irq.AssignedIRQ; | 447 | dev->irq = link->irq.AssignedIRQ; |
| 448 | dev->base_addr = link->io.BasePort1; | 448 | dev->base_addr = link->io.BasePort1; |
| 449 | 449 | ||
| @@ -474,21 +474,21 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
| 474 | case CONTEC: | 474 | case CONTEC: |
| 475 | case NEC: | 475 | case NEC: |
| 476 | case KME: | 476 | case KME: |
| 477 | tuple.DesiredTuple = CISTPL_FUNCE; | ||
| 478 | tuple.TupleOffset = 0; | ||
| 479 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
| 480 | tuple.TupleOffset = 0; | ||
| 481 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
| 482 | if (cardtype == MBH10304) { | 477 | if (cardtype == MBH10304) { |
| 483 | /* MBH10304's CIS_FUNCE is corrupted */ | ||
| 484 | node_id = &(tuple.TupleData[5]); | ||
| 485 | card_name = "FMV-J182"; | 478 | card_name = "FMV-J182"; |
| 486 | } else { | 479 | |
| 487 | while (tuple.TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID ) { | 480 | len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); |
| 488 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); | 481 | if (len < 11) { |
| 489 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 482 | kfree(buf); |
| 483 | goto failed; | ||
| 490 | } | 484 | } |
| 491 | node_id = &(tuple.TupleData[2]); | 485 | /* Read MACID from CIS */ |
| 486 | for (i = 5; i < 11; i++) | ||
| 487 | dev->dev_addr[i] = buf[i]; | ||
| 488 | kfree(buf); | ||
| 489 | } else { | ||
| 490 | if (pcmcia_get_mac_from_cis(link, dev)) | ||
| 491 | goto failed; | ||
| 492 | if( cardtype == TDK ) { | 492 | if( cardtype == TDK ) { |
| 493 | card_name = "TDK LAK-CD021"; | 493 | card_name = "TDK LAK-CD021"; |
| 494 | } else if( cardtype == LA501 ) { | 494 | } else if( cardtype == LA501 ) { |
| @@ -501,9 +501,6 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
| 501 | card_name = "C-NET(PC)C"; | 501 | card_name = "C-NET(PC)C"; |
| 502 | } | 502 | } |
| 503 | } | 503 | } |
| 504 | /* Read MACID from CIS */ | ||
| 505 | for (i = 0; i < 6; i++) | ||
| 506 | dev->dev_addr[i] = node_id[i]; | ||
| 507 | break; | 504 | break; |
| 508 | case UNGERMANN: | 505 | case UNGERMANN: |
| 509 | /* Read MACID from register */ | 506 | /* Read MACID from register */ |
| @@ -513,12 +510,12 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
| 513 | break; | 510 | break; |
| 514 | case XXX10304: | 511 | case XXX10304: |
| 515 | /* Read MACID from Buggy CIS */ | 512 | /* Read MACID from Buggy CIS */ |
| 516 | if (fmvj18x_get_hwinfo(link, tuple.TupleData) == -1) { | 513 | if (fmvj18x_get_hwinfo(link, buggybuf) == -1) { |
| 517 | printk(KERN_NOTICE "fmvj18x_cs: unable to read hardware net address.\n"); | 514 | printk(KERN_NOTICE "fmvj18x_cs: unable to read hardware net address.\n"); |
| 518 | goto failed; | 515 | goto failed; |
| 519 | } | 516 | } |
| 520 | for (i = 0 ; i < 6; i++) { | 517 | for (i = 0 ; i < 6; i++) { |
| 521 | dev->dev_addr[i] = tuple.TupleData[i]; | 518 | dev->dev_addr[i] = buggybuf[i]; |
| 522 | } | 519 | } |
| 523 | card_name = "FMV-J182"; | 520 | card_name = "FMV-J182"; |
| 524 | break; | 521 | break; |
| @@ -533,7 +530,7 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
| 533 | 530 | ||
| 534 | lp->cardtype = cardtype; | 531 | lp->cardtype = cardtype; |
| 535 | link->dev_node = &lp->node; | 532 | link->dev_node = &lp->node; |
| 536 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 533 | SET_NETDEV_DEV(dev, &link->dev); |
| 537 | 534 | ||
| 538 | if (register_netdev(dev) != 0) { | 535 | if (register_netdev(dev) != 0) { |
| 539 | printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n"); | 536 | printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n"); |
| @@ -551,9 +548,6 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
| 551 | 548 | ||
| 552 | return 0; | 549 | return 0; |
| 553 | 550 | ||
| 554 | cs_failed: | ||
| 555 | /* All Card Services errors end up here */ | ||
| 556 | cs_error(link, last_fn, last_ret); | ||
| 557 | failed: | 551 | failed: |
| 558 | fmvj18x_release(link); | 552 | fmvj18x_release(link); |
| 559 | return -ENODEV; | 553 | return -ENODEV; |
| @@ -571,16 +565,14 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
| 571 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 565 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
| 572 | req.Base = 0; req.Size = 0; | 566 | req.Base = 0; req.Size = 0; |
| 573 | req.AccessSpeed = 0; | 567 | req.AccessSpeed = 0; |
| 574 | i = pcmcia_request_window(&link, &req, &link->win); | 568 | i = pcmcia_request_window(link, &req, &link->win); |
| 575 | if (i != 0) { | 569 | if (i != 0) |
| 576 | cs_error(link, RequestWindow, i); | ||
| 577 | return -1; | 570 | return -1; |
| 578 | } | ||
| 579 | 571 | ||
| 580 | base = ioremap(req.Base, req.Size); | 572 | base = ioremap(req.Base, req.Size); |
| 581 | mem.Page = 0; | 573 | mem.Page = 0; |
| 582 | mem.CardOffset = 0; | 574 | mem.CardOffset = 0; |
| 583 | pcmcia_map_mem_page(link->win, &mem); | 575 | pcmcia_map_mem_page(link, link->win, &mem); |
| 584 | 576 | ||
| 585 | /* | 577 | /* |
| 586 | * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format | 578 | * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format |
| @@ -605,9 +597,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
| 605 | } | 597 | } |
| 606 | 598 | ||
| 607 | iounmap(base); | 599 | iounmap(base); |
| 608 | j = pcmcia_release_window(link->win); | 600 | j = pcmcia_release_window(link, link->win); |
| 609 | if (j != 0) | ||
| 610 | cs_error(link, ReleaseWindow, j); | ||
| 611 | return (i != 0x200) ? 0 : -1; | 601 | return (i != 0x200) ? 0 : -1; |
| 612 | 602 | ||
| 613 | } /* fmvj18x_get_hwinfo */ | 603 | } /* fmvj18x_get_hwinfo */ |
| @@ -626,11 +616,9 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link) | |||
| 626 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 616 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
| 627 | req.Base = 0; req.Size = 0; | 617 | req.Base = 0; req.Size = 0; |
| 628 | req.AccessSpeed = 0; | 618 | req.AccessSpeed = 0; |
| 629 | i = pcmcia_request_window(&link, &req, &link->win); | 619 | i = pcmcia_request_window(link, &req, &link->win); |
| 630 | if (i != 0) { | 620 | if (i != 0) |
| 631 | cs_error(link, RequestWindow, i); | ||
| 632 | return -1; | 621 | return -1; |
| 633 | } | ||
| 634 | 622 | ||
| 635 | lp->base = ioremap(req.Base, req.Size); | 623 | lp->base = ioremap(req.Base, req.Size); |
| 636 | if (lp->base == NULL) { | 624 | if (lp->base == NULL) { |
| @@ -640,11 +628,10 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link) | |||
| 640 | 628 | ||
| 641 | mem.Page = 0; | 629 | mem.Page = 0; |
| 642 | mem.CardOffset = 0; | 630 | mem.CardOffset = 0; |
| 643 | i = pcmcia_map_mem_page(link->win, &mem); | 631 | i = pcmcia_map_mem_page(link, link->win, &mem); |
| 644 | if (i != 0) { | 632 | if (i != 0) { |
| 645 | iounmap(lp->base); | 633 | iounmap(lp->base); |
| 646 | lp->base = NULL; | 634 | lp->base = NULL; |
| 647 | cs_error(link, MapMemPage, i); | ||
| 648 | return -1; | 635 | return -1; |
| 649 | } | 636 | } |
| 650 | 637 | ||
| @@ -671,15 +658,13 @@ static void fmvj18x_release(struct pcmcia_device *link) | |||
| 671 | u_char __iomem *tmp; | 658 | u_char __iomem *tmp; |
| 672 | int j; | 659 | int j; |
| 673 | 660 | ||
| 674 | DEBUG(0, "fmvj18x_release(0x%p)\n", link); | 661 | dev_dbg(&link->dev, "fmvj18x_release\n"); |
| 675 | 662 | ||
| 676 | if (lp->base != NULL) { | 663 | if (lp->base != NULL) { |
| 677 | tmp = lp->base; | 664 | tmp = lp->base; |
| 678 | lp->base = NULL; /* set NULL before iounmap */ | 665 | lp->base = NULL; /* set NULL before iounmap */ |
| 679 | iounmap(tmp); | 666 | iounmap(tmp); |
| 680 | j = pcmcia_release_window(link->win); | 667 | j = pcmcia_release_window(link, link->win); |
| 681 | if (j != 0) | ||
| 682 | cs_error(link, ReleaseWindow, j); | ||
| 683 | } | 668 | } |
| 684 | 669 | ||
| 685 | pcmcia_disable_device(link); | 670 | pcmcia_disable_device(link); |
| @@ -788,8 +773,8 @@ static irqreturn_t fjn_interrupt(int dummy, void *dev_id) | |||
| 788 | outb(tx_stat, ioaddr + TX_STATUS); | 773 | outb(tx_stat, ioaddr + TX_STATUS); |
| 789 | outb(rx_stat, ioaddr + RX_STATUS); | 774 | outb(rx_stat, ioaddr + RX_STATUS); |
| 790 | 775 | ||
| 791 | DEBUG(4, "%s: interrupt, rx_status %02x.\n", dev->name, rx_stat); | 776 | pr_debug("%s: interrupt, rx_status %02x.\n", dev->name, rx_stat); |
| 792 | DEBUG(4, " tx_status %02x.\n", tx_stat); | 777 | pr_debug(" tx_status %02x.\n", tx_stat); |
| 793 | 778 | ||
| 794 | if (rx_stat || (inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) { | 779 | if (rx_stat || (inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) { |
| 795 | /* there is packet(s) in rx buffer */ | 780 | /* there is packet(s) in rx buffer */ |
| @@ -809,8 +794,8 @@ static irqreturn_t fjn_interrupt(int dummy, void *dev_id) | |||
| 809 | } | 794 | } |
| 810 | netif_wake_queue(dev); | 795 | netif_wake_queue(dev); |
| 811 | } | 796 | } |
| 812 | DEBUG(4, "%s: exiting interrupt,\n", dev->name); | 797 | pr_debug("%s: exiting interrupt,\n", dev->name); |
| 813 | DEBUG(4, " tx_status %02x, rx_status %02x.\n", tx_stat, rx_stat); | 798 | pr_debug(" tx_status %02x, rx_status %02x.\n", tx_stat, rx_stat); |
| 814 | 799 | ||
| 815 | outb(D_TX_INTR, ioaddr + TX_INTR); | 800 | outb(D_TX_INTR, ioaddr + TX_INTR); |
| 816 | outb(D_RX_INTR, ioaddr + RX_INTR); | 801 | outb(D_RX_INTR, ioaddr + RX_INTR); |
| @@ -882,7 +867,7 @@ static netdev_tx_t fjn_start_xmit(struct sk_buff *skb, | |||
| 882 | return NETDEV_TX_BUSY; | 867 | return NETDEV_TX_BUSY; |
| 883 | } | 868 | } |
| 884 | 869 | ||
| 885 | DEBUG(4, "%s: Transmitting a packet of length %lu.\n", | 870 | pr_debug("%s: Transmitting a packet of length %lu.\n", |
| 886 | dev->name, (unsigned long)skb->len); | 871 | dev->name, (unsigned long)skb->len); |
| 887 | dev->stats.tx_bytes += skb->len; | 872 | dev->stats.tx_bytes += skb->len; |
| 888 | 873 | ||
| @@ -937,7 +922,7 @@ static void fjn_reset(struct net_device *dev) | |||
| 937 | unsigned int ioaddr = dev->base_addr; | 922 | unsigned int ioaddr = dev->base_addr; |
| 938 | int i; | 923 | int i; |
| 939 | 924 | ||
| 940 | DEBUG(4, "fjn_reset(%s) called.\n",dev->name); | 925 | pr_debug("fjn_reset(%s) called.\n",dev->name); |
| 941 | 926 | ||
| 942 | /* Reset controller */ | 927 | /* Reset controller */ |
| 943 | if( sram_config == 0 ) | 928 | if( sram_config == 0 ) |
| @@ -1015,13 +1000,13 @@ static void fjn_rx(struct net_device *dev) | |||
| 1015 | unsigned int ioaddr = dev->base_addr; | 1000 | unsigned int ioaddr = dev->base_addr; |
| 1016 | int boguscount = 10; /* 5 -> 10: by agy 19940922 */ | 1001 | int boguscount = 10; /* 5 -> 10: by agy 19940922 */ |
| 1017 | 1002 | ||
| 1018 | DEBUG(4, "%s: in rx_packet(), rx_status %02x.\n", | 1003 | pr_debug("%s: in rx_packet(), rx_status %02x.\n", |
| 1019 | dev->name, inb(ioaddr + RX_STATUS)); | 1004 | dev->name, inb(ioaddr + RX_STATUS)); |
| 1020 | 1005 | ||
| 1021 | while ((inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) { | 1006 | while ((inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) { |
| 1022 | u_short status = inw(ioaddr + DATAPORT); | 1007 | u_short status = inw(ioaddr + DATAPORT); |
| 1023 | 1008 | ||
| 1024 | DEBUG(4, "%s: Rxing packet mode %02x status %04x.\n", | 1009 | pr_debug("%s: Rxing packet mode %02x status %04x.\n", |
| 1025 | dev->name, inb(ioaddr + RX_MODE), status); | 1010 | dev->name, inb(ioaddr + RX_MODE), status); |
| 1026 | #ifndef final_version | 1011 | #ifndef final_version |
| 1027 | if (status == 0) { | 1012 | if (status == 0) { |
| @@ -1061,16 +1046,14 @@ static void fjn_rx(struct net_device *dev) | |||
| 1061 | (pkt_len + 1) >> 1); | 1046 | (pkt_len + 1) >> 1); |
| 1062 | skb->protocol = eth_type_trans(skb, dev); | 1047 | skb->protocol = eth_type_trans(skb, dev); |
| 1063 | 1048 | ||
| 1064 | #ifdef PCMCIA_DEBUG | 1049 | { |
| 1065 | if (pc_debug > 5) { | ||
| 1066 | int i; | 1050 | int i; |
| 1067 | printk(KERN_DEBUG "%s: Rxed packet of length %d: ", | 1051 | pr_debug("%s: Rxed packet of length %d: ", |
| 1068 | dev->name, pkt_len); | 1052 | dev->name, pkt_len); |
| 1069 | for (i = 0; i < 14; i++) | 1053 | for (i = 0; i < 14; i++) |
| 1070 | printk(" %02x", skb->data[i]); | 1054 | pr_debug(" %02x", skb->data[i]); |
| 1071 | printk(".\n"); | 1055 | pr_debug(".\n"); |
| 1072 | } | 1056 | } |
| 1073 | #endif | ||
| 1074 | 1057 | ||
| 1075 | netif_rx(skb); | 1058 | netif_rx(skb); |
| 1076 | dev->stats.rx_packets++; | 1059 | dev->stats.rx_packets++; |
| @@ -1094,7 +1077,7 @@ static void fjn_rx(struct net_device *dev) | |||
| 1094 | } | 1077 | } |
| 1095 | 1078 | ||
| 1096 | if (i > 0) | 1079 | if (i > 0) |
| 1097 | DEBUG(5, "%s: Exint Rx packet with mode %02x after " | 1080 | pr_debug("%s: Exint Rx packet with mode %02x after " |
| 1098 | "%d ticks.\n", dev->name, inb(ioaddr + RX_MODE), i); | 1081 | "%d ticks.\n", dev->name, inb(ioaddr + RX_MODE), i); |
| 1099 | } | 1082 | } |
| 1100 | */ | 1083 | */ |
| @@ -1112,24 +1095,8 @@ static void netdev_get_drvinfo(struct net_device *dev, | |||
| 1112 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); | 1095 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); |
| 1113 | } | 1096 | } |
| 1114 | 1097 | ||
| 1115 | #ifdef PCMCIA_DEBUG | ||
| 1116 | static u32 netdev_get_msglevel(struct net_device *dev) | ||
| 1117 | { | ||
| 1118 | return pc_debug; | ||
| 1119 | } | ||
| 1120 | |||
| 1121 | static void netdev_set_msglevel(struct net_device *dev, u32 level) | ||
| 1122 | { | ||
| 1123 | pc_debug = level; | ||
| 1124 | } | ||
| 1125 | #endif /* PCMCIA_DEBUG */ | ||
| 1126 | |||
| 1127 | static const struct ethtool_ops netdev_ethtool_ops = { | 1098 | static const struct ethtool_ops netdev_ethtool_ops = { |
| 1128 | .get_drvinfo = netdev_get_drvinfo, | 1099 | .get_drvinfo = netdev_get_drvinfo, |
| 1129 | #ifdef PCMCIA_DEBUG | ||
| 1130 | .get_msglevel = netdev_get_msglevel, | ||
| 1131 | .set_msglevel = netdev_set_msglevel, | ||
| 1132 | #endif /* PCMCIA_DEBUG */ | ||
| 1133 | }; | 1100 | }; |
| 1134 | 1101 | ||
| 1135 | static int fjn_config(struct net_device *dev, struct ifmap *map){ | 1102 | static int fjn_config(struct net_device *dev, struct ifmap *map){ |
| @@ -1141,7 +1108,7 @@ static int fjn_open(struct net_device *dev) | |||
| 1141 | struct local_info_t *lp = netdev_priv(dev); | 1108 | struct local_info_t *lp = netdev_priv(dev); |
| 1142 | struct pcmcia_device *link = lp->p_dev; | 1109 | struct pcmcia_device *link = lp->p_dev; |
| 1143 | 1110 | ||
| 1144 | DEBUG(4, "fjn_open('%s').\n", dev->name); | 1111 | pr_debug("fjn_open('%s').\n", dev->name); |
| 1145 | 1112 | ||
| 1146 | if (!pcmcia_dev_present(link)) | 1113 | if (!pcmcia_dev_present(link)) |
| 1147 | return -ENODEV; | 1114 | return -ENODEV; |
| @@ -1167,7 +1134,7 @@ static int fjn_close(struct net_device *dev) | |||
| 1167 | struct pcmcia_device *link = lp->p_dev; | 1134 | struct pcmcia_device *link = lp->p_dev; |
| 1168 | unsigned int ioaddr = dev->base_addr; | 1135 | unsigned int ioaddr = dev->base_addr; |
| 1169 | 1136 | ||
| 1170 | DEBUG(4, "fjn_close('%s').\n", dev->name); | 1137 | pr_debug("fjn_close('%s').\n", dev->name); |
| 1171 | 1138 | ||
| 1172 | lp->open_time = 0; | 1139 | lp->open_time = 0; |
| 1173 | netif_stop_queue(dev); | 1140 | netif_stop_queue(dev); |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index 06618af1a468..37f4a6fdc3ef 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
| @@ -69,17 +69,6 @@ | |||
| 69 | #define PCMCIA | 69 | #define PCMCIA |
| 70 | #include "../tokenring/ibmtr.c" | 70 | #include "../tokenring/ibmtr.c" |
| 71 | 71 | ||
| 72 | #ifdef PCMCIA_DEBUG | ||
| 73 | static int pc_debug = PCMCIA_DEBUG; | ||
| 74 | module_param(pc_debug, int, 0); | ||
| 75 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 76 | static char *version = | ||
| 77 | "ibmtr_cs.c 1.10 1996/01/06 05:19:00 (Steve Kipisz)\n" | ||
| 78 | " 2.2.7 1999/05/03 12:00:00 (Mike Phillips)\n" | ||
| 79 | " 2.4.2 2001/30/28 Midnight (Burt Silverman)\n"; | ||
| 80 | #else | ||
| 81 | #define DEBUG(n, args...) | ||
| 82 | #endif | ||
| 83 | 72 | ||
| 84 | /*====================================================================*/ | 73 | /*====================================================================*/ |
| 85 | 74 | ||
| @@ -130,6 +119,12 @@ static const struct ethtool_ops netdev_ethtool_ops = { | |||
| 130 | .get_drvinfo = netdev_get_drvinfo, | 119 | .get_drvinfo = netdev_get_drvinfo, |
| 131 | }; | 120 | }; |
| 132 | 121 | ||
| 122 | static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) { | ||
| 123 | ibmtr_dev_t *info = dev_id; | ||
| 124 | struct net_device *dev = info->dev; | ||
| 125 | return tok_interrupt(irq, dev); | ||
| 126 | }; | ||
| 127 | |||
| 133 | /*====================================================================== | 128 | /*====================================================================== |
| 134 | 129 | ||
| 135 | ibmtr_attach() creates an "instance" of the driver, allocating | 130 | ibmtr_attach() creates an "instance" of the driver, allocating |
| @@ -143,7 +138,7 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) | |||
| 143 | ibmtr_dev_t *info; | 138 | ibmtr_dev_t *info; |
| 144 | struct net_device *dev; | 139 | struct net_device *dev; |
| 145 | 140 | ||
| 146 | DEBUG(0, "ibmtr_attach()\n"); | 141 | dev_dbg(&link->dev, "ibmtr_attach()\n"); |
| 147 | 142 | ||
| 148 | /* Create new token-ring device */ | 143 | /* Create new token-ring device */ |
| 149 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 144 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
| @@ -161,14 +156,13 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) | |||
| 161 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 156 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 162 | link->io.NumPorts1 = 4; | 157 | link->io.NumPorts1 = 4; |
| 163 | link->io.IOAddrLines = 16; | 158 | link->io.IOAddrLines = 16; |
| 164 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 159 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
| 165 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 160 | link->irq.Handler = ibmtr_interrupt; |
| 166 | link->irq.Handler = &tok_interrupt; | ||
| 167 | link->conf.Attributes = CONF_ENABLE_IRQ; | 161 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 168 | link->conf.IntType = INT_MEMORY_AND_IO; | 162 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 169 | link->conf.Present = PRESENT_OPTION; | 163 | link->conf.Present = PRESENT_OPTION; |
| 170 | 164 | ||
| 171 | link->irq.Instance = info->dev = dev; | 165 | info->dev = dev; |
| 172 | 166 | ||
| 173 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 167 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
| 174 | 168 | ||
| @@ -190,7 +184,7 @@ static void ibmtr_detach(struct pcmcia_device *link) | |||
| 190 | struct net_device *dev = info->dev; | 184 | struct net_device *dev = info->dev; |
| 191 | struct tok_info *ti = netdev_priv(dev); | 185 | struct tok_info *ti = netdev_priv(dev); |
| 192 | 186 | ||
| 193 | DEBUG(0, "ibmtr_detach(0x%p)\n", link); | 187 | dev_dbg(&link->dev, "ibmtr_detach\n"); |
| 194 | 188 | ||
| 195 | /* | 189 | /* |
| 196 | * When the card removal interrupt hits tok_interrupt(), | 190 | * When the card removal interrupt hits tok_interrupt(), |
| @@ -217,9 +211,6 @@ static void ibmtr_detach(struct pcmcia_device *link) | |||
| 217 | 211 | ||
| 218 | ======================================================================*/ | 212 | ======================================================================*/ |
| 219 | 213 | ||
| 220 | #define CS_CHECK(fn, ret) \ | ||
| 221 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 222 | |||
| 223 | static int __devinit ibmtr_config(struct pcmcia_device *link) | 214 | static int __devinit ibmtr_config(struct pcmcia_device *link) |
| 224 | { | 215 | { |
| 225 | ibmtr_dev_t *info = link->priv; | 216 | ibmtr_dev_t *info = link->priv; |
| @@ -227,9 +218,9 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
| 227 | struct tok_info *ti = netdev_priv(dev); | 218 | struct tok_info *ti = netdev_priv(dev); |
| 228 | win_req_t req; | 219 | win_req_t req; |
| 229 | memreq_t mem; | 220 | memreq_t mem; |
| 230 | int i, last_ret, last_fn; | 221 | int i, ret; |
| 231 | 222 | ||
| 232 | DEBUG(0, "ibmtr_config(0x%p)\n", link); | 223 | dev_dbg(&link->dev, "ibmtr_config\n"); |
| 233 | 224 | ||
| 234 | link->conf.ConfigIndex = 0x61; | 225 | link->conf.ConfigIndex = 0x61; |
| 235 | 226 | ||
| @@ -241,11 +232,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
| 241 | if (i != 0) { | 232 | if (i != 0) { |
| 242 | /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ | 233 | /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ |
| 243 | link->io.BasePort1 = 0xA24; | 234 | link->io.BasePort1 = 0xA24; |
| 244 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | 235 | ret = pcmcia_request_io(link, &link->io); |
| 236 | if (ret) | ||
| 237 | goto failed; | ||
| 245 | } | 238 | } |
| 246 | dev->base_addr = link->io.BasePort1; | 239 | dev->base_addr = link->io.BasePort1; |
| 247 | 240 | ||
| 248 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 241 | ret = pcmcia_request_irq(link, &link->irq); |
| 242 | if (ret) | ||
| 243 | goto failed; | ||
| 249 | dev->irq = link->irq.AssignedIRQ; | 244 | dev->irq = link->irq.AssignedIRQ; |
| 250 | ti->irq = link->irq.AssignedIRQ; | 245 | ti->irq = link->irq.AssignedIRQ; |
| 251 | ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); | 246 | ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); |
| @@ -256,11 +251,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
| 256 | req.Base = 0; | 251 | req.Base = 0; |
| 257 | req.Size = 0x2000; | 252 | req.Size = 0x2000; |
| 258 | req.AccessSpeed = 250; | 253 | req.AccessSpeed = 250; |
| 259 | CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); | 254 | ret = pcmcia_request_window(link, &req, &link->win); |
| 255 | if (ret) | ||
| 256 | goto failed; | ||
| 260 | 257 | ||
| 261 | mem.CardOffset = mmiobase; | 258 | mem.CardOffset = mmiobase; |
| 262 | mem.Page = 0; | 259 | mem.Page = 0; |
| 263 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); | 260 | ret = pcmcia_map_mem_page(link, link->win, &mem); |
| 261 | if (ret) | ||
| 262 | goto failed; | ||
| 264 | ti->mmio = ioremap(req.Base, req.Size); | 263 | ti->mmio = ioremap(req.Base, req.Size); |
| 265 | 264 | ||
| 266 | /* Allocate the SRAM memory window */ | 265 | /* Allocate the SRAM memory window */ |
| @@ -269,17 +268,23 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
| 269 | req.Base = 0; | 268 | req.Base = 0; |
| 270 | req.Size = sramsize * 1024; | 269 | req.Size = sramsize * 1024; |
| 271 | req.AccessSpeed = 250; | 270 | req.AccessSpeed = 250; |
| 272 | CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &info->sram_win_handle)); | 271 | ret = pcmcia_request_window(link, &req, &info->sram_win_handle); |
| 272 | if (ret) | ||
| 273 | goto failed; | ||
| 273 | 274 | ||
| 274 | mem.CardOffset = srambase; | 275 | mem.CardOffset = srambase; |
| 275 | mem.Page = 0; | 276 | mem.Page = 0; |
| 276 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(info->sram_win_handle, &mem)); | 277 | ret = pcmcia_map_mem_page(link, info->sram_win_handle, &mem); |
| 278 | if (ret) | ||
| 279 | goto failed; | ||
| 277 | 280 | ||
| 278 | ti->sram_base = mem.CardOffset >> 12; | 281 | ti->sram_base = mem.CardOffset >> 12; |
| 279 | ti->sram_virt = ioremap(req.Base, req.Size); | 282 | ti->sram_virt = ioremap(req.Base, req.Size); |
| 280 | ti->sram_phys = req.Base; | 283 | ti->sram_phys = req.Base; |
| 281 | 284 | ||
| 282 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 285 | ret = pcmcia_request_configuration(link, &link->conf); |
| 286 | if (ret) | ||
| 287 | goto failed; | ||
| 283 | 288 | ||
| 284 | /* Set up the Token-Ring Controller Configuration Register and | 289 | /* Set up the Token-Ring Controller Configuration Register and |
| 285 | turn on the card. Check the "Local Area Network Credit Card | 290 | turn on the card. Check the "Local Area Network Credit Card |
| @@ -287,7 +292,7 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
| 287 | ibmtr_hw_setup(dev, mmiobase); | 292 | ibmtr_hw_setup(dev, mmiobase); |
| 288 | 293 | ||
| 289 | link->dev_node = &info->node; | 294 | link->dev_node = &info->node; |
| 290 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 295 | SET_NETDEV_DEV(dev, &link->dev); |
| 291 | 296 | ||
| 292 | i = ibmtr_probe_card(dev); | 297 | i = ibmtr_probe_card(dev); |
| 293 | if (i != 0) { | 298 | if (i != 0) { |
| @@ -305,8 +310,6 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
| 305 | dev->dev_addr); | 310 | dev->dev_addr); |
| 306 | return 0; | 311 | return 0; |
| 307 | 312 | ||
| 308 | cs_failed: | ||
| 309 | cs_error(link, last_fn, last_ret); | ||
| 310 | failed: | 313 | failed: |
| 311 | ibmtr_release(link); | 314 | ibmtr_release(link); |
| 312 | return -ENODEV; | 315 | return -ENODEV; |
| @@ -325,12 +328,12 @@ static void ibmtr_release(struct pcmcia_device *link) | |||
| 325 | ibmtr_dev_t *info = link->priv; | 328 | ibmtr_dev_t *info = link->priv; |
| 326 | struct net_device *dev = info->dev; | 329 | struct net_device *dev = info->dev; |
| 327 | 330 | ||
| 328 | DEBUG(0, "ibmtr_release(0x%p)\n", link); | 331 | dev_dbg(&link->dev, "ibmtr_release\n"); |
| 329 | 332 | ||
| 330 | if (link->win) { | 333 | if (link->win) { |
| 331 | struct tok_info *ti = netdev_priv(dev); | 334 | struct tok_info *ti = netdev_priv(dev); |
| 332 | iounmap(ti->mmio); | 335 | iounmap(ti->mmio); |
| 333 | pcmcia_release_window(info->sram_win_handle); | 336 | pcmcia_release_window(link, info->sram_win_handle); |
| 334 | } | 337 | } |
| 335 | pcmcia_disable_device(link); | 338 | pcmcia_disable_device(link); |
| 336 | } | 339 | } |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 5ed6339c52bc..dae5ef6b2609 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
| @@ -381,13 +381,6 @@ typedef struct _mace_private { | |||
| 381 | Private Global Variables | 381 | Private Global Variables |
| 382 | ---------------------------------------------------------------------------- */ | 382 | ---------------------------------------------------------------------------- */ |
| 383 | 383 | ||
| 384 | #ifdef PCMCIA_DEBUG | ||
| 385 | static char rcsid[] = | ||
| 386 | "nmclan_cs.c,v 0.16 1995/07/01 06:42:17 rpao Exp rpao"; | ||
| 387 | static char *version = | ||
| 388 | DRV_NAME " " DRV_VERSION " (Roger C. Pao)"; | ||
| 389 | #endif | ||
| 390 | |||
| 391 | static const char *if_names[]={ | 384 | static const char *if_names[]={ |
| 392 | "Auto", "10baseT", "BNC", | 385 | "Auto", "10baseT", "BNC", |
| 393 | }; | 386 | }; |
| @@ -406,12 +399,6 @@ MODULE_LICENSE("GPL"); | |||
| 406 | /* 0=auto, 1=10baseT, 2 = 10base2, default=auto */ | 399 | /* 0=auto, 1=10baseT, 2 = 10base2, default=auto */ |
| 407 | INT_MODULE_PARM(if_port, 0); | 400 | INT_MODULE_PARM(if_port, 0); |
| 408 | 401 | ||
| 409 | #ifdef PCMCIA_DEBUG | ||
| 410 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
| 411 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 412 | #else | ||
| 413 | #define DEBUG(n, args...) | ||
| 414 | #endif | ||
| 415 | 402 | ||
| 416 | /* ---------------------------------------------------------------------------- | 403 | /* ---------------------------------------------------------------------------- |
| 417 | Function Prototypes | 404 | Function Prototypes |
| @@ -462,8 +449,7 @@ static int nmclan_probe(struct pcmcia_device *link) | |||
| 462 | mace_private *lp; | 449 | mace_private *lp; |
| 463 | struct net_device *dev; | 450 | struct net_device *dev; |
| 464 | 451 | ||
| 465 | DEBUG(0, "nmclan_attach()\n"); | 452 | dev_dbg(&link->dev, "nmclan_attach()\n"); |
| 466 | DEBUG(1, "%s\n", rcsid); | ||
| 467 | 453 | ||
| 468 | /* Create new ethernet device */ | 454 | /* Create new ethernet device */ |
| 469 | dev = alloc_etherdev(sizeof(mace_private)); | 455 | dev = alloc_etherdev(sizeof(mace_private)); |
| @@ -477,10 +463,8 @@ static int nmclan_probe(struct pcmcia_device *link) | |||
| 477 | link->io.NumPorts1 = 32; | 463 | link->io.NumPorts1 = 32; |
| 478 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 464 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
| 479 | link->io.IOAddrLines = 5; | 465 | link->io.IOAddrLines = 5; |
| 480 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 466 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
| 481 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 482 | link->irq.Handler = &mace_interrupt; | 467 | link->irq.Handler = &mace_interrupt; |
| 483 | link->irq.Instance = dev; | ||
| 484 | link->conf.Attributes = CONF_ENABLE_IRQ; | 468 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 485 | link->conf.IntType = INT_MEMORY_AND_IO; | 469 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 486 | link->conf.ConfigIndex = 1; | 470 | link->conf.ConfigIndex = 1; |
| @@ -507,7 +491,7 @@ static void nmclan_detach(struct pcmcia_device *link) | |||
| 507 | { | 491 | { |
| 508 | struct net_device *dev = link->priv; | 492 | struct net_device *dev = link->priv; |
| 509 | 493 | ||
| 510 | DEBUG(0, "nmclan_detach(0x%p)\n", link); | 494 | dev_dbg(&link->dev, "nmclan_detach\n"); |
| 511 | 495 | ||
| 512 | if (link->dev_node) | 496 | if (link->dev_node) |
| 513 | unregister_netdev(dev); | 497 | unregister_netdev(dev); |
| @@ -654,37 +638,40 @@ nmclan_config | |||
| 654 | ethernet device available to the system. | 638 | ethernet device available to the system. |
| 655 | ---------------------------------------------------------------------------- */ | 639 | ---------------------------------------------------------------------------- */ |
| 656 | 640 | ||
| 657 | #define CS_CHECK(fn, ret) \ | ||
| 658 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 659 | |||
| 660 | static int nmclan_config(struct pcmcia_device *link) | 641 | static int nmclan_config(struct pcmcia_device *link) |
| 661 | { | 642 | { |
| 662 | struct net_device *dev = link->priv; | 643 | struct net_device *dev = link->priv; |
| 663 | mace_private *lp = netdev_priv(dev); | 644 | mace_private *lp = netdev_priv(dev); |
| 664 | tuple_t tuple; | 645 | u8 *buf; |
| 665 | u_char buf[64]; | 646 | size_t len; |
| 666 | int i, last_ret, last_fn; | 647 | int i, ret; |
| 667 | unsigned int ioaddr; | 648 | unsigned int ioaddr; |
| 668 | 649 | ||
| 669 | DEBUG(0, "nmclan_config(0x%p)\n", link); | 650 | dev_dbg(&link->dev, "nmclan_config\n"); |
| 651 | |||
| 652 | ret = pcmcia_request_io(link, &link->io); | ||
| 653 | if (ret) | ||
| 654 | goto failed; | ||
| 655 | ret = pcmcia_request_irq(link, &link->irq); | ||
| 656 | if (ret) | ||
| 657 | goto failed; | ||
| 658 | ret = pcmcia_request_configuration(link, &link->conf); | ||
| 659 | if (ret) | ||
| 660 | goto failed; | ||
| 670 | 661 | ||
| 671 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | ||
| 672 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | ||
| 673 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | ||
| 674 | dev->irq = link->irq.AssignedIRQ; | 662 | dev->irq = link->irq.AssignedIRQ; |
| 675 | dev->base_addr = link->io.BasePort1; | 663 | dev->base_addr = link->io.BasePort1; |
| 676 | 664 | ||
| 677 | ioaddr = dev->base_addr; | 665 | ioaddr = dev->base_addr; |
| 678 | 666 | ||
| 679 | /* Read the ethernet address from the CIS. */ | 667 | /* Read the ethernet address from the CIS. */ |
| 680 | tuple.DesiredTuple = 0x80 /* CISTPL_CFTABLE_ENTRY_MISC */; | 668 | len = pcmcia_get_tuple(link, 0x80, &buf); |
| 681 | tuple.TupleData = buf; | 669 | if (!buf || len < ETHER_ADDR_LEN) { |
| 682 | tuple.TupleDataMax = 64; | 670 | kfree(buf); |
| 683 | tuple.TupleOffset = 0; | 671 | goto failed; |
| 684 | tuple.Attributes = 0; | 672 | } |
| 685 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 673 | memcpy(dev->dev_addr, buf, ETHER_ADDR_LEN); |
| 686 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 674 | kfree(buf); |
| 687 | memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN); | ||
| 688 | 675 | ||
| 689 | /* Verify configuration by reading the MACE ID. */ | 676 | /* Verify configuration by reading the MACE ID. */ |
| 690 | { | 677 | { |
| @@ -693,7 +680,7 @@ static int nmclan_config(struct pcmcia_device *link) | |||
| 693 | sig[0] = mace_read(lp, ioaddr, MACE_CHIPIDL); | 680 | sig[0] = mace_read(lp, ioaddr, MACE_CHIPIDL); |
| 694 | sig[1] = mace_read(lp, ioaddr, MACE_CHIPIDH); | 681 | sig[1] = mace_read(lp, ioaddr, MACE_CHIPIDH); |
| 695 | if ((sig[0] == 0x40) && ((sig[1] & 0x0F) == 0x09)) { | 682 | if ((sig[0] == 0x40) && ((sig[1] & 0x0F) == 0x09)) { |
| 696 | DEBUG(0, "nmclan_cs configured: mace id=%x %x\n", | 683 | dev_dbg(&link->dev, "nmclan_cs configured: mace id=%x %x\n", |
| 697 | sig[0], sig[1]); | 684 | sig[0], sig[1]); |
| 698 | } else { | 685 | } else { |
| 699 | printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should" | 686 | printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should" |
| @@ -712,7 +699,7 @@ static int nmclan_config(struct pcmcia_device *link) | |||
| 712 | printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); | 699 | printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); |
| 713 | 700 | ||
| 714 | link->dev_node = &lp->node; | 701 | link->dev_node = &lp->node; |
| 715 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 702 | SET_NETDEV_DEV(dev, &link->dev); |
| 716 | 703 | ||
| 717 | i = register_netdev(dev); | 704 | i = register_netdev(dev); |
| 718 | if (i != 0) { | 705 | if (i != 0) { |
| @@ -729,8 +716,6 @@ static int nmclan_config(struct pcmcia_device *link) | |||
| 729 | dev->dev_addr); | 716 | dev->dev_addr); |
| 730 | return 0; | 717 | return 0; |
| 731 | 718 | ||
| 732 | cs_failed: | ||
| 733 | cs_error(link, last_fn, last_ret); | ||
| 734 | failed: | 719 | failed: |
| 735 | nmclan_release(link); | 720 | nmclan_release(link); |
| 736 | return -ENODEV; | 721 | return -ENODEV; |
| @@ -744,7 +729,7 @@ nmclan_release | |||
| 744 | ---------------------------------------------------------------------------- */ | 729 | ---------------------------------------------------------------------------- */ |
| 745 | static void nmclan_release(struct pcmcia_device *link) | 730 | static void nmclan_release(struct pcmcia_device *link) |
| 746 | { | 731 | { |
| 747 | DEBUG(0, "nmclan_release(0x%p)\n", link); | 732 | dev_dbg(&link->dev, "nmclan_release\n"); |
| 748 | pcmcia_disable_device(link); | 733 | pcmcia_disable_device(link); |
| 749 | } | 734 | } |
| 750 | 735 | ||
| @@ -795,7 +780,7 @@ static void nmclan_reset(struct net_device *dev) | |||
| 795 | /* Reset Xilinx */ | 780 | /* Reset Xilinx */ |
| 796 | reg.Action = CS_WRITE; | 781 | reg.Action = CS_WRITE; |
| 797 | reg.Offset = CISREG_COR; | 782 | reg.Offset = CISREG_COR; |
| 798 | DEBUG(1, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n", | 783 | dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n", |
| 799 | OrigCorValue); | 784 | OrigCorValue); |
| 800 | reg.Value = COR_SOFT_RESET; | 785 | reg.Value = COR_SOFT_RESET; |
| 801 | pcmcia_access_configuration_register(link, ®); | 786 | pcmcia_access_configuration_register(link, ®); |
| @@ -872,7 +857,7 @@ static int mace_close(struct net_device *dev) | |||
| 872 | mace_private *lp = netdev_priv(dev); | 857 | mace_private *lp = netdev_priv(dev); |
| 873 | struct pcmcia_device *link = lp->p_dev; | 858 | struct pcmcia_device *link = lp->p_dev; |
| 874 | 859 | ||
| 875 | DEBUG(2, "%s: shutting down ethercard.\n", dev->name); | 860 | dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name); |
| 876 | 861 | ||
| 877 | /* Mask off all interrupts from the MACE chip. */ | 862 | /* Mask off all interrupts from the MACE chip. */ |
| 878 | outb(0xFF, ioaddr + AM2150_MACE_BASE + MACE_IMR); | 863 | outb(0xFF, ioaddr + AM2150_MACE_BASE + MACE_IMR); |
| @@ -891,24 +876,8 @@ static void netdev_get_drvinfo(struct net_device *dev, | |||
| 891 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); | 876 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); |
| 892 | } | 877 | } |
| 893 | 878 | ||
| 894 | #ifdef PCMCIA_DEBUG | ||
| 895 | static u32 netdev_get_msglevel(struct net_device *dev) | ||
| 896 | { | ||
| 897 | return pc_debug; | ||
| 898 | } | ||
| 899 | |||
| 900 | static void netdev_set_msglevel(struct net_device *dev, u32 level) | ||
| 901 | { | ||
| 902 | pc_debug = level; | ||
| 903 | } | ||
| 904 | #endif /* PCMCIA_DEBUG */ | ||
| 905 | |||
| 906 | static const struct ethtool_ops netdev_ethtool_ops = { | 879 | static const struct ethtool_ops netdev_ethtool_ops = { |
| 907 | .get_drvinfo = netdev_get_drvinfo, | 880 | .get_drvinfo = netdev_get_drvinfo, |
| 908 | #ifdef PCMCIA_DEBUG | ||
| 909 | .get_msglevel = netdev_get_msglevel, | ||
| 910 | .set_msglevel = netdev_set_msglevel, | ||
| 911 | #endif /* PCMCIA_DEBUG */ | ||
| 912 | }; | 881 | }; |
| 913 | 882 | ||
| 914 | /* ---------------------------------------------------------------------------- | 883 | /* ---------------------------------------------------------------------------- |
| @@ -946,7 +915,7 @@ static netdev_tx_t mace_start_xmit(struct sk_buff *skb, | |||
| 946 | 915 | ||
| 947 | netif_stop_queue(dev); | 916 | netif_stop_queue(dev); |
| 948 | 917 | ||
| 949 | DEBUG(3, "%s: mace_start_xmit(length = %ld) called.\n", | 918 | pr_debug("%s: mace_start_xmit(length = %ld) called.\n", |
| 950 | dev->name, (long)skb->len); | 919 | dev->name, (long)skb->len); |
| 951 | 920 | ||
| 952 | #if (!TX_INTERRUPTABLE) | 921 | #if (!TX_INTERRUPTABLE) |
| @@ -1008,7 +977,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) | |||
| 1008 | int IntrCnt = MACE_MAX_IR_ITERATIONS; | 977 | int IntrCnt = MACE_MAX_IR_ITERATIONS; |
| 1009 | 978 | ||
| 1010 | if (dev == NULL) { | 979 | if (dev == NULL) { |
| 1011 | DEBUG(2, "mace_interrupt(): irq 0x%X for unknown device.\n", | 980 | pr_debug("mace_interrupt(): irq 0x%X for unknown device.\n", |
| 1012 | irq); | 981 | irq); |
| 1013 | return IRQ_NONE; | 982 | return IRQ_NONE; |
| 1014 | } | 983 | } |
| @@ -1031,7 +1000,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) | |||
| 1031 | } | 1000 | } |
| 1032 | 1001 | ||
| 1033 | if (!netif_device_present(dev)) { | 1002 | if (!netif_device_present(dev)) { |
| 1034 | DEBUG(2, "%s: interrupt from dead card\n", dev->name); | 1003 | pr_debug("%s: interrupt from dead card\n", dev->name); |
| 1035 | return IRQ_NONE; | 1004 | return IRQ_NONE; |
| 1036 | } | 1005 | } |
| 1037 | 1006 | ||
| @@ -1039,7 +1008,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) | |||
| 1039 | /* WARNING: MACE_IR is a READ/CLEAR port! */ | 1008 | /* WARNING: MACE_IR is a READ/CLEAR port! */ |
| 1040 | status = inb(ioaddr + AM2150_MACE_BASE + MACE_IR); | 1009 | status = inb(ioaddr + AM2150_MACE_BASE + MACE_IR); |
| 1041 | 1010 | ||
| 1042 | DEBUG(3, "mace_interrupt: irq 0x%X status 0x%X.\n", irq, status); | 1011 | pr_debug("mace_interrupt: irq 0x%X status 0x%X.\n", irq, status); |
| 1043 | 1012 | ||
| 1044 | if (status & MACE_IR_RCVINT) { | 1013 | if (status & MACE_IR_RCVINT) { |
| 1045 | mace_rx(dev, MACE_MAX_RX_ITERATIONS); | 1014 | mace_rx(dev, MACE_MAX_RX_ITERATIONS); |
| @@ -1158,7 +1127,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | |||
| 1158 | ) { | 1127 | ) { |
| 1159 | rx_status = inw(ioaddr + AM2150_RCV); | 1128 | rx_status = inw(ioaddr + AM2150_RCV); |
| 1160 | 1129 | ||
| 1161 | DEBUG(3, "%s: in mace_rx(), framecnt 0x%X, rx_status" | 1130 | pr_debug("%s: in mace_rx(), framecnt 0x%X, rx_status" |
| 1162 | " 0x%X.\n", dev->name, rx_framecnt, rx_status); | 1131 | " 0x%X.\n", dev->name, rx_framecnt, rx_status); |
| 1163 | 1132 | ||
| 1164 | if (rx_status & MACE_RCVFS_RCVSTS) { /* Error, update stats. */ | 1133 | if (rx_status & MACE_RCVFS_RCVSTS) { /* Error, update stats. */ |
| @@ -1185,7 +1154,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | |||
| 1185 | lp->mace_stats.rfs_rcvcc += inb(ioaddr + AM2150_RCV); | 1154 | lp->mace_stats.rfs_rcvcc += inb(ioaddr + AM2150_RCV); |
| 1186 | /* rcv collision count */ | 1155 | /* rcv collision count */ |
| 1187 | 1156 | ||
| 1188 | DEBUG(3, " receiving packet size 0x%X rx_status" | 1157 | pr_debug(" receiving packet size 0x%X rx_status" |
| 1189 | " 0x%X.\n", pkt_len, rx_status); | 1158 | " 0x%X.\n", pkt_len, rx_status); |
| 1190 | 1159 | ||
| 1191 | skb = dev_alloc_skb(pkt_len+2); | 1160 | skb = dev_alloc_skb(pkt_len+2); |
| @@ -1204,7 +1173,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | |||
| 1204 | outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */ | 1173 | outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */ |
| 1205 | continue; | 1174 | continue; |
| 1206 | } else { | 1175 | } else { |
| 1207 | DEBUG(1, "%s: couldn't allocate a sk_buff of size" | 1176 | pr_debug("%s: couldn't allocate a sk_buff of size" |
| 1208 | " %d.\n", dev->name, pkt_len); | 1177 | " %d.\n", dev->name, pkt_len); |
| 1209 | lp->linux_stats.rx_dropped++; | 1178 | lp->linux_stats.rx_dropped++; |
| 1210 | } | 1179 | } |
| @@ -1220,28 +1189,28 @@ pr_linux_stats | |||
| 1220 | ---------------------------------------------------------------------------- */ | 1189 | ---------------------------------------------------------------------------- */ |
| 1221 | static void pr_linux_stats(struct net_device_stats *pstats) | 1190 | static void pr_linux_stats(struct net_device_stats *pstats) |
| 1222 | { | 1191 | { |
| 1223 | DEBUG(2, "pr_linux_stats\n"); | 1192 | pr_debug("pr_linux_stats\n"); |
| 1224 | DEBUG(2, " rx_packets=%-7ld tx_packets=%ld\n", | 1193 | pr_debug(" rx_packets=%-7ld tx_packets=%ld\n", |
| 1225 | (long)pstats->rx_packets, (long)pstats->tx_packets); | 1194 | (long)pstats->rx_packets, (long)pstats->tx_packets); |
| 1226 | DEBUG(2, " rx_errors=%-7ld tx_errors=%ld\n", | 1195 | pr_debug(" rx_errors=%-7ld tx_errors=%ld\n", |
| 1227 | (long)pstats->rx_errors, (long)pstats->tx_errors); | 1196 | (long)pstats->rx_errors, (long)pstats->tx_errors); |
| 1228 | DEBUG(2, " rx_dropped=%-7ld tx_dropped=%ld\n", | 1197 | pr_debug(" rx_dropped=%-7ld tx_dropped=%ld\n", |
| 1229 | (long)pstats->rx_dropped, (long)pstats->tx_dropped); | 1198 | (long)pstats->rx_dropped, (long)pstats->tx_dropped); |
| 1230 | DEBUG(2, " multicast=%-7ld collisions=%ld\n", | 1199 | pr_debug(" multicast=%-7ld collisions=%ld\n", |
| 1231 | (long)pstats->multicast, (long)pstats->collisions); | 1200 | (long)pstats->multicast, (long)pstats->collisions); |
| 1232 | 1201 | ||
| 1233 | DEBUG(2, " rx_length_errors=%-7ld rx_over_errors=%ld\n", | 1202 | pr_debug(" rx_length_errors=%-7ld rx_over_errors=%ld\n", |
| 1234 | (long)pstats->rx_length_errors, (long)pstats->rx_over_errors); | 1203 | (long)pstats->rx_length_errors, (long)pstats->rx_over_errors); |
| 1235 | DEBUG(2, " rx_crc_errors=%-7ld rx_frame_errors=%ld\n", | 1204 | pr_debug(" rx_crc_errors=%-7ld rx_frame_errors=%ld\n", |
| 1236 | (long)pstats->rx_crc_errors, (long)pstats->rx_frame_errors); | 1205 | (long)pstats->rx_crc_errors, (long)pstats->rx_frame_errors); |
| 1237 | DEBUG(2, " rx_fifo_errors=%-7ld rx_missed_errors=%ld\n", | 1206 | pr_debug(" rx_fifo_errors=%-7ld rx_missed_errors=%ld\n", |
| 1238 | (long)pstats->rx_fifo_errors, (long)pstats->rx_missed_errors); | 1207 | (long)pstats->rx_fifo_errors, (long)pstats->rx_missed_errors); |
| 1239 | 1208 | ||
| 1240 | DEBUG(2, " tx_aborted_errors=%-7ld tx_carrier_errors=%ld\n", | 1209 | pr_debug(" tx_aborted_errors=%-7ld tx_carrier_errors=%ld\n", |
| 1241 | (long)pstats->tx_aborted_errors, (long)pstats->tx_carrier_errors); | 1210 | (long)pstats->tx_aborted_errors, (long)pstats->tx_carrier_errors); |
| 1242 | DEBUG(2, " tx_fifo_errors=%-7ld tx_heartbeat_errors=%ld\n", | 1211 | pr_debug(" tx_fifo_errors=%-7ld tx_heartbeat_errors=%ld\n", |
| 1243 | (long)pstats->tx_fifo_errors, (long)pstats->tx_heartbeat_errors); | 1212 | (long)pstats->tx_fifo_errors, (long)pstats->tx_heartbeat_errors); |
| 1244 | DEBUG(2, " tx_window_errors=%ld\n", | 1213 | pr_debug(" tx_window_errors=%ld\n", |
| 1245 | (long)pstats->tx_window_errors); | 1214 | (long)pstats->tx_window_errors); |
| 1246 | } /* pr_linux_stats */ | 1215 | } /* pr_linux_stats */ |
| 1247 | 1216 | ||
| @@ -1250,48 +1219,48 @@ pr_mace_stats | |||
| 1250 | ---------------------------------------------------------------------------- */ | 1219 | ---------------------------------------------------------------------------- */ |
| 1251 | static void pr_mace_stats(mace_statistics *pstats) | 1220 | static void pr_mace_stats(mace_statistics *pstats) |
| 1252 | { | 1221 | { |
| 1253 | DEBUG(2, "pr_mace_stats\n"); | 1222 | pr_debug("pr_mace_stats\n"); |
| 1254 | 1223 | ||
| 1255 | DEBUG(2, " xmtsv=%-7d uflo=%d\n", | 1224 | pr_debug(" xmtsv=%-7d uflo=%d\n", |
| 1256 | pstats->xmtsv, pstats->uflo); | 1225 | pstats->xmtsv, pstats->uflo); |
| 1257 | DEBUG(2, " lcol=%-7d more=%d\n", | 1226 | pr_debug(" lcol=%-7d more=%d\n", |
| 1258 | pstats->lcol, pstats->more); | 1227 | pstats->lcol, pstats->more); |
| 1259 | DEBUG(2, " one=%-7d defer=%d\n", | 1228 | pr_debug(" one=%-7d defer=%d\n", |
| 1260 | pstats->one, pstats->defer); | 1229 | pstats->one, pstats->defer); |
| 1261 | DEBUG(2, " lcar=%-7d rtry=%d\n", | 1230 | pr_debug(" lcar=%-7d rtry=%d\n", |
| 1262 | pstats->lcar, pstats->rtry); | 1231 | pstats->lcar, pstats->rtry); |
| 1263 | 1232 | ||
| 1264 | /* MACE_XMTRC */ | 1233 | /* MACE_XMTRC */ |
| 1265 | DEBUG(2, " exdef=%-7d xmtrc=%d\n", | 1234 | pr_debug(" exdef=%-7d xmtrc=%d\n", |
| 1266 | pstats->exdef, pstats->xmtrc); | 1235 | pstats->exdef, pstats->xmtrc); |
| 1267 | 1236 | ||
| 1268 | /* RFS1--Receive Status (RCVSTS) */ | 1237 | /* RFS1--Receive Status (RCVSTS) */ |
| 1269 | DEBUG(2, " oflo=%-7d clsn=%d\n", | 1238 | pr_debug(" oflo=%-7d clsn=%d\n", |
| 1270 | pstats->oflo, pstats->clsn); | 1239 | pstats->oflo, pstats->clsn); |
| 1271 | DEBUG(2, " fram=%-7d fcs=%d\n", | 1240 | pr_debug(" fram=%-7d fcs=%d\n", |
| 1272 | pstats->fram, pstats->fcs); | 1241 | pstats->fram, pstats->fcs); |
| 1273 | 1242 | ||
| 1274 | /* RFS2--Runt Packet Count (RNTPC) */ | 1243 | /* RFS2--Runt Packet Count (RNTPC) */ |
| 1275 | /* RFS3--Receive Collision Count (RCVCC) */ | 1244 | /* RFS3--Receive Collision Count (RCVCC) */ |
| 1276 | DEBUG(2, " rfs_rntpc=%-7d rfs_rcvcc=%d\n", | 1245 | pr_debug(" rfs_rntpc=%-7d rfs_rcvcc=%d\n", |
| 1277 | pstats->rfs_rntpc, pstats->rfs_rcvcc); | 1246 | pstats->rfs_rntpc, pstats->rfs_rcvcc); |
| 1278 | 1247 | ||
| 1279 | /* MACE_IR */ | 1248 | /* MACE_IR */ |
| 1280 | DEBUG(2, " jab=%-7d babl=%d\n", | 1249 | pr_debug(" jab=%-7d babl=%d\n", |
| 1281 | pstats->jab, pstats->babl); | 1250 | pstats->jab, pstats->babl); |
| 1282 | DEBUG(2, " cerr=%-7d rcvcco=%d\n", | 1251 | pr_debug(" cerr=%-7d rcvcco=%d\n", |
| 1283 | pstats->cerr, pstats->rcvcco); | 1252 | pstats->cerr, pstats->rcvcco); |
| 1284 | DEBUG(2, " rntpco=%-7d mpco=%d\n", | 1253 | pr_debug(" rntpco=%-7d mpco=%d\n", |
| 1285 | pstats->rntpco, pstats->mpco); | 1254 | pstats->rntpco, pstats->mpco); |
| 1286 | 1255 | ||
| 1287 | /* MACE_MPC */ | 1256 | /* MACE_MPC */ |
| 1288 | DEBUG(2, " mpc=%d\n", pstats->mpc); | 1257 | pr_debug(" mpc=%d\n", pstats->mpc); |
| 1289 | 1258 | ||
| 1290 | /* MACE_RNTPC */ | 1259 | /* MACE_RNTPC */ |
| 1291 | DEBUG(2, " rntpc=%d\n", pstats->rntpc); | 1260 | pr_debug(" rntpc=%d\n", pstats->rntpc); |
| 1292 | 1261 | ||
| 1293 | /* MACE_RCVCC */ | 1262 | /* MACE_RCVCC */ |
| 1294 | DEBUG(2, " rcvcc=%d\n", pstats->rcvcc); | 1263 | pr_debug(" rcvcc=%d\n", pstats->rcvcc); |
| 1295 | 1264 | ||
| 1296 | } /* pr_mace_stats */ | 1265 | } /* pr_mace_stats */ |
| 1297 | 1266 | ||
| @@ -1360,7 +1329,7 @@ static struct net_device_stats *mace_get_stats(struct net_device *dev) | |||
| 1360 | 1329 | ||
| 1361 | update_stats(dev->base_addr, dev); | 1330 | update_stats(dev->base_addr, dev); |
| 1362 | 1331 | ||
| 1363 | DEBUG(1, "%s: updating the statistics.\n", dev->name); | 1332 | pr_debug("%s: updating the statistics.\n", dev->name); |
| 1364 | pr_linux_stats(&lp->linux_stats); | 1333 | pr_linux_stats(&lp->linux_stats); |
| 1365 | pr_mace_stats(&lp->mace_stats); | 1334 | pr_mace_stats(&lp->mace_stats); |
| 1366 | 1335 | ||
| @@ -1427,7 +1396,7 @@ static void BuildLAF(int *ladrf, int *adr) | |||
| 1427 | ladrf[byte] |= (1 << (hashcode & 7)); | 1396 | ladrf[byte] |= (1 << (hashcode & 7)); |
| 1428 | 1397 | ||
| 1429 | #ifdef PCMCIA_DEBUG | 1398 | #ifdef PCMCIA_DEBUG |
| 1430 | if (pc_debug > 2) | 1399 | if (0) |
| 1431 | printk(KERN_DEBUG " adr =%pM\n", adr); | 1400 | printk(KERN_DEBUG " adr =%pM\n", adr); |
| 1432 | printk(KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63] =", hashcode); | 1401 | printk(KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63] =", hashcode); |
| 1433 | for (i = 0; i < 8; i++) | 1402 | for (i = 0; i < 8; i++) |
| @@ -1454,12 +1423,12 @@ static void restore_multicast_list(struct net_device *dev) | |||
| 1454 | unsigned int ioaddr = dev->base_addr; | 1423 | unsigned int ioaddr = dev->base_addr; |
| 1455 | int i; | 1424 | int i; |
| 1456 | 1425 | ||
| 1457 | DEBUG(2, "%s: restoring Rx mode to %d addresses.\n", | 1426 | pr_debug("%s: restoring Rx mode to %d addresses.\n", |
| 1458 | dev->name, num_addrs); | 1427 | dev->name, num_addrs); |
| 1459 | 1428 | ||
| 1460 | if (num_addrs > 0) { | 1429 | if (num_addrs > 0) { |
| 1461 | 1430 | ||
| 1462 | DEBUG(1, "Attempt to restore multicast list detected.\n"); | 1431 | pr_debug("Attempt to restore multicast list detected.\n"); |
| 1463 | 1432 | ||
| 1464 | mace_write(lp, ioaddr, MACE_IAC, MACE_IAC_ADDRCHG | MACE_IAC_LOGADDR); | 1433 | mace_write(lp, ioaddr, MACE_IAC, MACE_IAC_ADDRCHG | MACE_IAC_LOGADDR); |
| 1465 | /* Poll ADDRCHG bit */ | 1434 | /* Poll ADDRCHG bit */ |
| @@ -1511,11 +1480,11 @@ static void set_multicast_list(struct net_device *dev) | |||
| 1511 | struct dev_mc_list *dmi = dev->mc_list; | 1480 | struct dev_mc_list *dmi = dev->mc_list; |
| 1512 | 1481 | ||
| 1513 | #ifdef PCMCIA_DEBUG | 1482 | #ifdef PCMCIA_DEBUG |
| 1514 | if (pc_debug > 1) { | 1483 | { |
| 1515 | static int old; | 1484 | static int old; |
| 1516 | if (dev->mc_count != old) { | 1485 | if (dev->mc_count != old) { |
| 1517 | old = dev->mc_count; | 1486 | old = dev->mc_count; |
| 1518 | DEBUG(0, "%s: setting Rx mode to %d addresses.\n", | 1487 | pr_debug("%s: setting Rx mode to %d addresses.\n", |
| 1519 | dev->name, old); | 1488 | dev->name, old); |
| 1520 | } | 1489 | } |
| 1521 | } | 1490 | } |
| @@ -1546,7 +1515,7 @@ static void restore_multicast_list(struct net_device *dev) | |||
| 1546 | unsigned int ioaddr = dev->base_addr; | 1515 | unsigned int ioaddr = dev->base_addr; |
| 1547 | mace_private *lp = netdev_priv(dev); | 1516 | mace_private *lp = netdev_priv(dev); |
| 1548 | 1517 | ||
| 1549 | DEBUG(2, "%s: restoring Rx mode to %d addresses.\n", dev->name, | 1518 | pr_debug("%s: restoring Rx mode to %d addresses.\n", dev->name, |
| 1550 | lp->multicast_num_addrs); | 1519 | lp->multicast_num_addrs); |
| 1551 | 1520 | ||
| 1552 | if (dev->flags & IFF_PROMISC) { | 1521 | if (dev->flags & IFF_PROMISC) { |
| @@ -1567,11 +1536,11 @@ static void set_multicast_list(struct net_device *dev) | |||
| 1567 | mace_private *lp = netdev_priv(dev); | 1536 | mace_private *lp = netdev_priv(dev); |
| 1568 | 1537 | ||
| 1569 | #ifdef PCMCIA_DEBUG | 1538 | #ifdef PCMCIA_DEBUG |
| 1570 | if (pc_debug > 1) { | 1539 | { |
| 1571 | static int old; | 1540 | static int old; |
| 1572 | if (dev->mc_count != old) { | 1541 | if (dev->mc_count != old) { |
| 1573 | old = dev->mc_count; | 1542 | old = dev->mc_count; |
| 1574 | DEBUG(0, "%s: setting Rx mode to %d addresses.\n", | 1543 | pr_debug("%s: setting Rx mode to %d addresses.\n", |
| 1575 | dev->name, old); | 1544 | dev->name, old); |
| 1576 | } | 1545 | } |
| 1577 | } | 1546 | } |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 94c9ad2746bc..cbe462ed221f 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
| @@ -71,15 +71,6 @@ | |||
| 71 | 71 | ||
| 72 | static const char *if_names[] = { "auto", "10baseT", "10base2"}; | 72 | static const char *if_names[] = { "auto", "10baseT", "10base2"}; |
| 73 | 73 | ||
| 74 | #ifdef PCMCIA_DEBUG | ||
| 75 | static int pc_debug = PCMCIA_DEBUG; | ||
| 76 | module_param(pc_debug, int, 0); | ||
| 77 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 78 | static char *version = | ||
| 79 | "pcnet_cs.c 1.153 2003/11/09 18:53:09 (David Hinds)"; | ||
| 80 | #else | ||
| 81 | #define DEBUG(n, args...) | ||
| 82 | #endif | ||
| 83 | 74 | ||
| 84 | /*====================================================================*/ | 75 | /*====================================================================*/ |
| 85 | 76 | ||
| @@ -265,7 +256,7 @@ static int pcnet_probe(struct pcmcia_device *link) | |||
| 265 | pcnet_dev_t *info; | 256 | pcnet_dev_t *info; |
| 266 | struct net_device *dev; | 257 | struct net_device *dev; |
| 267 | 258 | ||
| 268 | DEBUG(0, "pcnet_attach()\n"); | 259 | dev_dbg(&link->dev, "pcnet_attach()\n"); |
| 269 | 260 | ||
| 270 | /* Create new ethernet device */ | 261 | /* Create new ethernet device */ |
| 271 | dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); | 262 | dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); |
| @@ -275,7 +266,6 @@ static int pcnet_probe(struct pcmcia_device *link) | |||
| 275 | link->priv = dev; | 266 | link->priv = dev; |
| 276 | 267 | ||
| 277 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 268 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 278 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 279 | link->conf.Attributes = CONF_ENABLE_IRQ; | 269 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 280 | link->conf.IntType = INT_MEMORY_AND_IO; | 270 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 281 | 271 | ||
| @@ -297,7 +287,7 @@ static void pcnet_detach(struct pcmcia_device *link) | |||
| 297 | { | 287 | { |
| 298 | struct net_device *dev = link->priv; | 288 | struct net_device *dev = link->priv; |
| 299 | 289 | ||
| 300 | DEBUG(0, "pcnet_detach(0x%p)\n", link); | 290 | dev_dbg(&link->dev, "pcnet_detach\n"); |
| 301 | 291 | ||
| 302 | if (link->dev_node) | 292 | if (link->dev_node) |
| 303 | unregister_netdev(dev); | 293 | unregister_netdev(dev); |
| @@ -326,17 +316,15 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) | |||
| 326 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 316 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
| 327 | req.Base = 0; req.Size = 0; | 317 | req.Base = 0; req.Size = 0; |
| 328 | req.AccessSpeed = 0; | 318 | req.AccessSpeed = 0; |
| 329 | i = pcmcia_request_window(&link, &req, &link->win); | 319 | i = pcmcia_request_window(link, &req, &link->win); |
| 330 | if (i != 0) { | 320 | if (i != 0) |
| 331 | cs_error(link, RequestWindow, i); | ||
| 332 | return NULL; | 321 | return NULL; |
| 333 | } | ||
| 334 | 322 | ||
| 335 | virt = ioremap(req.Base, req.Size); | 323 | virt = ioremap(req.Base, req.Size); |
| 336 | mem.Page = 0; | 324 | mem.Page = 0; |
| 337 | for (i = 0; i < NR_INFO; i++) { | 325 | for (i = 0; i < NR_INFO; i++) { |
| 338 | mem.CardOffset = hw_info[i].offset & ~(req.Size-1); | 326 | mem.CardOffset = hw_info[i].offset & ~(req.Size-1); |
| 339 | pcmcia_map_mem_page(link->win, &mem); | 327 | pcmcia_map_mem_page(link, link->win, &mem); |
| 340 | base = &virt[hw_info[i].offset & (req.Size-1)]; | 328 | base = &virt[hw_info[i].offset & (req.Size-1)]; |
| 341 | if ((readb(base+0) == hw_info[i].a0) && | 329 | if ((readb(base+0) == hw_info[i].a0) && |
| 342 | (readb(base+2) == hw_info[i].a1) && | 330 | (readb(base+2) == hw_info[i].a1) && |
| @@ -348,9 +336,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) | |||
| 348 | } | 336 | } |
| 349 | 337 | ||
| 350 | iounmap(virt); | 338 | iounmap(virt); |
| 351 | j = pcmcia_release_window(link->win); | 339 | j = pcmcia_release_window(link, link->win); |
| 352 | if (j != 0) | ||
| 353 | cs_error(link, ReleaseWindow, j); | ||
| 354 | return (i < NR_INFO) ? hw_info+i : NULL; | 340 | return (i < NR_INFO) ? hw_info+i : NULL; |
| 355 | } /* get_hwinfo */ | 341 | } /* get_hwinfo */ |
| 356 | 342 | ||
| @@ -495,9 +481,6 @@ static hw_info_t *get_hwired(struct pcmcia_device *link) | |||
| 495 | 481 | ||
| 496 | ======================================================================*/ | 482 | ======================================================================*/ |
| 497 | 483 | ||
| 498 | #define CS_CHECK(fn, ret) \ | ||
| 499 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 500 | |||
| 501 | static int try_io_port(struct pcmcia_device *link) | 484 | static int try_io_port(struct pcmcia_device *link) |
| 502 | { | 485 | { |
| 503 | int j, ret; | 486 | int j, ret; |
| @@ -567,19 +550,19 @@ static int pcnet_config(struct pcmcia_device *link) | |||
| 567 | { | 550 | { |
| 568 | struct net_device *dev = link->priv; | 551 | struct net_device *dev = link->priv; |
| 569 | pcnet_dev_t *info = PRIV(dev); | 552 | pcnet_dev_t *info = PRIV(dev); |
| 570 | int last_ret, last_fn, start_pg, stop_pg, cm_offset; | 553 | int ret, start_pg, stop_pg, cm_offset; |
| 571 | int has_shmem = 0; | 554 | int has_shmem = 0; |
| 572 | hw_info_t *local_hw_info; | 555 | hw_info_t *local_hw_info; |
| 573 | 556 | ||
| 574 | DEBUG(0, "pcnet_config(0x%p)\n", link); | 557 | dev_dbg(&link->dev, "pcnet_config\n"); |
| 575 | 558 | ||
| 576 | last_ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem); | 559 | ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem); |
| 577 | if (last_ret) { | 560 | if (ret) |
| 578 | cs_error(link, RequestIO, last_ret); | ||
| 579 | goto failed; | 561 | goto failed; |
| 580 | } | ||
| 581 | 562 | ||
| 582 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 563 | ret = pcmcia_request_irq(link, &link->irq); |
| 564 | if (ret) | ||
| 565 | goto failed; | ||
| 583 | 566 | ||
| 584 | if (link->io.NumPorts2 == 8) { | 567 | if (link->io.NumPorts2 == 8) { |
| 585 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 568 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
| @@ -589,7 +572,9 @@ static int pcnet_config(struct pcmcia_device *link) | |||
| 589 | (link->card_id == PRODID_IBM_HOME_AND_AWAY)) | 572 | (link->card_id == PRODID_IBM_HOME_AND_AWAY)) |
| 590 | link->conf.ConfigIndex |= 0x10; | 573 | link->conf.ConfigIndex |= 0x10; |
| 591 | 574 | ||
| 592 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 575 | ret = pcmcia_request_configuration(link, &link->conf); |
| 576 | if (ret) | ||
| 577 | goto failed; | ||
| 593 | dev->irq = link->irq.AssignedIRQ; | 578 | dev->irq = link->irq.AssignedIRQ; |
| 594 | dev->base_addr = link->io.BasePort1; | 579 | dev->base_addr = link->io.BasePort1; |
| 595 | if (info->flags & HAS_MISC_REG) { | 580 | if (info->flags & HAS_MISC_REG) { |
| @@ -660,7 +645,7 @@ static int pcnet_config(struct pcmcia_device *link) | |||
| 660 | mii_phy_probe(dev); | 645 | mii_phy_probe(dev); |
| 661 | 646 | ||
| 662 | link->dev_node = &info->node; | 647 | link->dev_node = &info->node; |
| 663 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 648 | SET_NETDEV_DEV(dev, &link->dev); |
| 664 | 649 | ||
| 665 | if (register_netdev(dev) != 0) { | 650 | if (register_netdev(dev) != 0) { |
| 666 | printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); | 651 | printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); |
| @@ -687,8 +672,6 @@ static int pcnet_config(struct pcmcia_device *link) | |||
| 687 | printk(" hw_addr %pM\n", dev->dev_addr); | 672 | printk(" hw_addr %pM\n", dev->dev_addr); |
| 688 | return 0; | 673 | return 0; |
| 689 | 674 | ||
| 690 | cs_failed: | ||
| 691 | cs_error(link, last_fn, last_ret); | ||
| 692 | failed: | 675 | failed: |
| 693 | pcnet_release(link); | 676 | pcnet_release(link); |
| 694 | return -ENODEV; | 677 | return -ENODEV; |
| @@ -706,7 +689,7 @@ static void pcnet_release(struct pcmcia_device *link) | |||
| 706 | { | 689 | { |
| 707 | pcnet_dev_t *info = PRIV(link->priv); | 690 | pcnet_dev_t *info = PRIV(link->priv); |
| 708 | 691 | ||
| 709 | DEBUG(0, "pcnet_release(0x%p)\n", link); | 692 | dev_dbg(&link->dev, "pcnet_release\n"); |
| 710 | 693 | ||
| 711 | if (info->flags & USE_SHMEM) | 694 | if (info->flags & USE_SHMEM) |
| 712 | iounmap(info->base); | 695 | iounmap(info->base); |
| @@ -960,7 +943,7 @@ static void mii_phy_probe(struct net_device *dev) | |||
| 960 | phyid = tmp << 16; | 943 | phyid = tmp << 16; |
| 961 | phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2); | 944 | phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2); |
| 962 | phyid &= MII_PHYID_REV_MASK; | 945 | phyid &= MII_PHYID_REV_MASK; |
| 963 | DEBUG(0, "%s: MII at %d is 0x%08x\n", dev->name, i, phyid); | 946 | pr_debug("%s: MII at %d is 0x%08x\n", dev->name, i, phyid); |
| 964 | if (phyid == AM79C9XX_HOME_PHY) { | 947 | if (phyid == AM79C9XX_HOME_PHY) { |
| 965 | info->pna_phy = i; | 948 | info->pna_phy = i; |
| 966 | } else if (phyid != AM79C9XX_ETH_PHY) { | 949 | } else if (phyid != AM79C9XX_ETH_PHY) { |
| @@ -976,7 +959,7 @@ static int pcnet_open(struct net_device *dev) | |||
| 976 | struct pcmcia_device *link = info->p_dev; | 959 | struct pcmcia_device *link = info->p_dev; |
| 977 | unsigned int nic_base = dev->base_addr; | 960 | unsigned int nic_base = dev->base_addr; |
| 978 | 961 | ||
| 979 | DEBUG(2, "pcnet_open('%s')\n", dev->name); | 962 | dev_dbg(&link->dev, "pcnet_open('%s')\n", dev->name); |
| 980 | 963 | ||
| 981 | if (!pcmcia_dev_present(link)) | 964 | if (!pcmcia_dev_present(link)) |
| 982 | return -ENODEV; | 965 | return -ENODEV; |
| @@ -1008,7 +991,7 @@ static int pcnet_close(struct net_device *dev) | |||
| 1008 | pcnet_dev_t *info = PRIV(dev); | 991 | pcnet_dev_t *info = PRIV(dev); |
| 1009 | struct pcmcia_device *link = info->p_dev; | 992 | struct pcmcia_device *link = info->p_dev; |
| 1010 | 993 | ||
| 1011 | DEBUG(2, "pcnet_close('%s')\n", dev->name); | 994 | dev_dbg(&link->dev, "pcnet_close('%s')\n", dev->name); |
| 1012 | 995 | ||
| 1013 | ei_close(dev); | 996 | ei_close(dev); |
| 1014 | free_irq(dev->irq, dev); | 997 | free_irq(dev->irq, dev); |
| @@ -1251,10 +1234,8 @@ static void dma_block_input(struct net_device *dev, int count, | |||
| 1251 | int xfer_count = count; | 1234 | int xfer_count = count; |
| 1252 | char *buf = skb->data; | 1235 | char *buf = skb->data; |
| 1253 | 1236 | ||
| 1254 | #ifdef PCMCIA_DEBUG | ||
| 1255 | if ((ei_debug > 4) && (count != 4)) | 1237 | if ((ei_debug > 4) && (count != 4)) |
| 1256 | printk(KERN_DEBUG "%s: [bi=%d]\n", dev->name, count+4); | 1238 | pr_debug("%s: [bi=%d]\n", dev->name, count+4); |
| 1257 | #endif | ||
| 1258 | if (ei_status.dmaing) { | 1239 | if (ei_status.dmaing) { |
| 1259 | printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input." | 1240 | printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input." |
| 1260 | "[DMAstat:%1x][irqlock:%1x]\n", | 1241 | "[DMAstat:%1x][irqlock:%1x]\n", |
| @@ -1495,7 +1476,7 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
| 1495 | pcnet_dev_t *info = PRIV(dev); | 1476 | pcnet_dev_t *info = PRIV(dev); |
| 1496 | win_req_t req; | 1477 | win_req_t req; |
| 1497 | memreq_t mem; | 1478 | memreq_t mem; |
| 1498 | int i, window_size, offset, last_ret, last_fn; | 1479 | int i, window_size, offset, ret; |
| 1499 | 1480 | ||
| 1500 | window_size = (stop_pg - start_pg) << 8; | 1481 | window_size = (stop_pg - start_pg) << 8; |
| 1501 | if (window_size > 32 * 1024) | 1482 | if (window_size > 32 * 1024) |
| @@ -1509,13 +1490,17 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
| 1509 | req.Attributes |= WIN_USE_WAIT; | 1490 | req.Attributes |= WIN_USE_WAIT; |
| 1510 | req.Base = 0; req.Size = window_size; | 1491 | req.Base = 0; req.Size = window_size; |
| 1511 | req.AccessSpeed = mem_speed; | 1492 | req.AccessSpeed = mem_speed; |
| 1512 | CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); | 1493 | ret = pcmcia_request_window(link, &req, &link->win); |
| 1494 | if (ret) | ||
| 1495 | goto failed; | ||
| 1513 | 1496 | ||
| 1514 | mem.CardOffset = (start_pg << 8) + cm_offset; | 1497 | mem.CardOffset = (start_pg << 8) + cm_offset; |
| 1515 | offset = mem.CardOffset % window_size; | 1498 | offset = mem.CardOffset % window_size; |
| 1516 | mem.CardOffset -= offset; | 1499 | mem.CardOffset -= offset; |
| 1517 | mem.Page = 0; | 1500 | mem.Page = 0; |
| 1518 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); | 1501 | ret = pcmcia_map_mem_page(link, link->win, &mem); |
| 1502 | if (ret) | ||
| 1503 | goto failed; | ||
| 1519 | 1504 | ||
| 1520 | /* Try scribbling on the buffer */ | 1505 | /* Try scribbling on the buffer */ |
| 1521 | info->base = ioremap(req.Base, window_size); | 1506 | info->base = ioremap(req.Base, window_size); |
| @@ -1527,8 +1512,8 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
| 1527 | pcnet_reset_8390(dev); | 1512 | pcnet_reset_8390(dev); |
| 1528 | if (i != (TX_PAGES<<8)) { | 1513 | if (i != (TX_PAGES<<8)) { |
| 1529 | iounmap(info->base); | 1514 | iounmap(info->base); |
| 1530 | pcmcia_release_window(link->win); | 1515 | pcmcia_release_window(link, link->win); |
| 1531 | info->base = NULL; link->win = NULL; | 1516 | info->base = NULL; link->win = 0; |
| 1532 | goto failed; | 1517 | goto failed; |
| 1533 | } | 1518 | } |
| 1534 | 1519 | ||
| @@ -1549,8 +1534,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
| 1549 | info->flags |= USE_SHMEM; | 1534 | info->flags |= USE_SHMEM; |
| 1550 | return 0; | 1535 | return 0; |
| 1551 | 1536 | ||
| 1552 | cs_failed: | ||
| 1553 | cs_error(link, last_fn, last_ret); | ||
| 1554 | failed: | 1537 | failed: |
| 1555 | return 1; | 1538 | return 1; |
| 1556 | } | 1539 | } |
| @@ -1788,7 +1771,6 @@ static int __init init_pcnet_cs(void) | |||
| 1788 | 1771 | ||
| 1789 | static void __exit exit_pcnet_cs(void) | 1772 | static void __exit exit_pcnet_cs(void) |
| 1790 | { | 1773 | { |
| 1791 | DEBUG(0, "pcnet_cs: unloading\n"); | ||
| 1792 | pcmcia_unregister_driver(&pcnet_driver); | 1774 | pcmcia_unregister_driver(&pcnet_driver); |
| 1793 | } | 1775 | } |
| 1794 | 1776 | ||
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 7bde2cd34c7e..9e0da370912e 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
| @@ -79,14 +79,6 @@ MODULE_FIRMWARE(FIRMWARE_NAME); | |||
| 79 | */ | 79 | */ |
| 80 | INT_MODULE_PARM(if_port, 0); | 80 | INT_MODULE_PARM(if_port, 0); |
| 81 | 81 | ||
| 82 | #ifdef PCMCIA_DEBUG | ||
| 83 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
| 84 | static const char *version = | ||
| 85 | "smc91c92_cs.c 1.123 2006/11/09 Donald Becker, becker@scyld.com.\n"; | ||
| 86 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 87 | #else | ||
| 88 | #define DEBUG(n, args...) | ||
| 89 | #endif | ||
| 90 | 82 | ||
| 91 | #define DRV_NAME "smc91c92_cs" | 83 | #define DRV_NAME "smc91c92_cs" |
| 92 | #define DRV_VERSION "1.123" | 84 | #define DRV_VERSION "1.123" |
| @@ -126,12 +118,6 @@ struct smc_private { | |||
| 126 | int rx_ovrn; | 118 | int rx_ovrn; |
| 127 | }; | 119 | }; |
| 128 | 120 | ||
| 129 | struct smc_cfg_mem { | ||
| 130 | tuple_t tuple; | ||
| 131 | cisparse_t parse; | ||
| 132 | u_char buf[255]; | ||
| 133 | }; | ||
| 134 | |||
| 135 | /* Special definitions for Megahertz multifunction cards */ | 121 | /* Special definitions for Megahertz multifunction cards */ |
| 136 | #define MEGAHERTZ_ISR 0x0380 | 122 | #define MEGAHERTZ_ISR 0x0380 |
| 137 | 123 | ||
| @@ -329,7 +315,7 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
| 329 | struct smc_private *smc; | 315 | struct smc_private *smc; |
| 330 | struct net_device *dev; | 316 | struct net_device *dev; |
| 331 | 317 | ||
| 332 | DEBUG(0, "smc91c92_attach()\n"); | 318 | dev_dbg(&link->dev, "smc91c92_attach()\n"); |
| 333 | 319 | ||
| 334 | /* Create new ethernet device */ | 320 | /* Create new ethernet device */ |
| 335 | dev = alloc_etherdev(sizeof(struct smc_private)); | 321 | dev = alloc_etherdev(sizeof(struct smc_private)); |
| @@ -343,10 +329,8 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
| 343 | link->io.NumPorts1 = 16; | 329 | link->io.NumPorts1 = 16; |
| 344 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 330 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
| 345 | link->io.IOAddrLines = 4; | 331 | link->io.IOAddrLines = 4; |
| 346 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; | 332 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 347 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 348 | link->irq.Handler = &smc_interrupt; | 333 | link->irq.Handler = &smc_interrupt; |
| 349 | link->irq.Instance = dev; | ||
| 350 | link->conf.Attributes = CONF_ENABLE_IRQ; | 334 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 351 | link->conf.IntType = INT_MEMORY_AND_IO; | 335 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 352 | 336 | ||
| @@ -377,7 +361,7 @@ static void smc91c92_detach(struct pcmcia_device *link) | |||
| 377 | { | 361 | { |
| 378 | struct net_device *dev = link->priv; | 362 | struct net_device *dev = link->priv; |
| 379 | 363 | ||
| 380 | DEBUG(0, "smc91c92_detach(0x%p)\n", link); | 364 | dev_dbg(&link->dev, "smc91c92_detach\n"); |
| 381 | 365 | ||
| 382 | if (link->dev_node) | 366 | if (link->dev_node) |
| 383 | unregister_netdev(dev); | 367 | unregister_netdev(dev); |
| @@ -408,34 +392,7 @@ static int cvt_ascii_address(struct net_device *dev, char *s) | |||
| 408 | return 0; | 392 | return 0; |
| 409 | } | 393 | } |
| 410 | 394 | ||
| 411 | /*====================================================================*/ | 395 | /*==================================================================== |
| 412 | |||
| 413 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, | ||
| 414 | cisparse_t *parse) | ||
| 415 | { | ||
| 416 | int i; | ||
| 417 | |||
| 418 | i = pcmcia_get_first_tuple(handle, tuple); | ||
| 419 | if (i != 0) | ||
| 420 | return i; | ||
| 421 | i = pcmcia_get_tuple_data(handle, tuple); | ||
| 422 | if (i != 0) | ||
| 423 | return i; | ||
| 424 | return pcmcia_parse_tuple(tuple, parse); | ||
| 425 | } | ||
| 426 | |||
| 427 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, | ||
| 428 | cisparse_t *parse) | ||
| 429 | { | ||
| 430 | int i; | ||
| 431 | |||
| 432 | if ((i = pcmcia_get_next_tuple(handle, tuple)) != 0 || | ||
| 433 | (i = pcmcia_get_tuple_data(handle, tuple)) != 0) | ||
| 434 | return i; | ||
| 435 | return pcmcia_parse_tuple(tuple, parse); | ||
| 436 | } | ||
| 437 | |||
| 438 | /*====================================================================== | ||
| 439 | 396 | ||
| 440 | Configuration stuff for Megahertz cards | 397 | Configuration stuff for Megahertz cards |
| 441 | 398 | ||
| @@ -490,19 +447,14 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
| 490 | { | 447 | { |
| 491 | struct net_device *dev = link->priv; | 448 | struct net_device *dev = link->priv; |
| 492 | struct smc_private *smc = netdev_priv(dev); | 449 | struct smc_private *smc = netdev_priv(dev); |
| 493 | struct smc_cfg_mem *cfg_mem; | ||
| 494 | win_req_t req; | 450 | win_req_t req; |
| 495 | memreq_t mem; | 451 | memreq_t mem; |
| 496 | int i; | 452 | int i; |
| 497 | 453 | ||
| 498 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | ||
| 499 | if (!cfg_mem) | ||
| 500 | return -ENOMEM; | ||
| 501 | |||
| 502 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 454 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
| 503 | link->conf.Status = CCSR_AUDIO_ENA; | 455 | link->conf.Status = CCSR_AUDIO_ENA; |
| 504 | link->irq.Attributes = | 456 | link->irq.Attributes = |
| 505 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED|IRQ_HANDLE_PRESENT; | 457 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
| 506 | link->io.IOAddrLines = 16; | 458 | link->io.IOAddrLines = 16; |
| 507 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 459 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
| 508 | link->io.NumPorts2 = 8; | 460 | link->io.NumPorts2 = 8; |
| @@ -510,91 +462,80 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
| 510 | /* The Megahertz combo cards have modem-like CIS entries, so | 462 | /* The Megahertz combo cards have modem-like CIS entries, so |
| 511 | we have to explicitly try a bunch of port combinations. */ | 463 | we have to explicitly try a bunch of port combinations. */ |
| 512 | if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL)) | 464 | if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL)) |
| 513 | goto free_cfg_mem; | 465 | return -ENODEV; |
| 466 | |||
| 514 | dev->base_addr = link->io.BasePort1; | 467 | dev->base_addr = link->io.BasePort1; |
| 515 | 468 | ||
| 516 | /* Allocate a memory window, for accessing the ISR */ | 469 | /* Allocate a memory window, for accessing the ISR */ |
| 517 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 470 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
| 518 | req.Base = req.Size = 0; | 471 | req.Base = req.Size = 0; |
| 519 | req.AccessSpeed = 0; | 472 | req.AccessSpeed = 0; |
| 520 | i = pcmcia_request_window(&link, &req, &link->win); | 473 | i = pcmcia_request_window(link, &req, &link->win); |
| 521 | if (i != 0) | 474 | if (i != 0) |
| 522 | goto free_cfg_mem; | 475 | return -ENODEV; |
| 476 | |||
| 523 | smc->base = ioremap(req.Base, req.Size); | 477 | smc->base = ioremap(req.Base, req.Size); |
| 524 | mem.CardOffset = mem.Page = 0; | 478 | mem.CardOffset = mem.Page = 0; |
| 525 | if (smc->manfid == MANFID_MOTOROLA) | 479 | if (smc->manfid == MANFID_MOTOROLA) |
| 526 | mem.CardOffset = link->conf.ConfigBase; | 480 | mem.CardOffset = link->conf.ConfigBase; |
| 527 | i = pcmcia_map_mem_page(link->win, &mem); | 481 | i = pcmcia_map_mem_page(link, link->win, &mem); |
| 528 | 482 | ||
| 529 | if ((i == 0) | 483 | if ((i == 0) |
| 530 | && (smc->manfid == MANFID_MEGAHERTZ) | 484 | && (smc->manfid == MANFID_MEGAHERTZ) |
| 531 | && (smc->cardid == PRODID_MEGAHERTZ_EM3288)) | 485 | && (smc->cardid == PRODID_MEGAHERTZ_EM3288)) |
| 532 | mhz_3288_power(link); | 486 | mhz_3288_power(link); |
| 533 | 487 | ||
| 534 | free_cfg_mem: | 488 | return 0; |
| 535 | kfree(cfg_mem); | ||
| 536 | return -ENODEV; | ||
| 537 | } | 489 | } |
| 538 | 490 | ||
| 539 | static int mhz_setup(struct pcmcia_device *link) | 491 | static int pcmcia_get_versmac(struct pcmcia_device *p_dev, |
| 492 | tuple_t *tuple, | ||
| 493 | void *priv) | ||
| 540 | { | 494 | { |
| 541 | struct net_device *dev = link->priv; | 495 | struct net_device *dev = priv; |
| 542 | struct smc_cfg_mem *cfg_mem; | 496 | cisparse_t parse; |
| 543 | tuple_t *tuple; | ||
| 544 | cisparse_t *parse; | ||
| 545 | u_char *buf, *station_addr; | ||
| 546 | int rc; | ||
| 547 | 497 | ||
| 548 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | 498 | if (pcmcia_parse_tuple(tuple, &parse)) |
| 549 | if (!cfg_mem) | 499 | return -EINVAL; |
| 550 | return -1; | ||
| 551 | 500 | ||
| 552 | tuple = &cfg_mem->tuple; | 501 | if ((parse.version_1.ns > 3) && |
| 553 | parse = &cfg_mem->parse; | 502 | (cvt_ascii_address(dev, |
| 554 | buf = cfg_mem->buf; | 503 | (parse.version_1.str + parse.version_1.ofs[3])))) |
| 504 | return 0; | ||
| 555 | 505 | ||
| 556 | tuple->Attributes = tuple->TupleOffset = 0; | 506 | return -EINVAL; |
| 557 | tuple->TupleData = (cisdata_t *)buf; | 507 | }; |
| 558 | tuple->TupleDataMax = 255; | 508 | |
| 509 | static int mhz_setup(struct pcmcia_device *link) | ||
| 510 | { | ||
| 511 | struct net_device *dev = link->priv; | ||
| 512 | size_t len; | ||
| 513 | u8 *buf; | ||
| 514 | int rc; | ||
| 559 | 515 | ||
| 560 | /* Read the station address from the CIS. It is stored as the last | 516 | /* Read the station address from the CIS. It is stored as the last |
| 561 | (fourth) string in the Version 1 Version/ID tuple. */ | 517 | (fourth) string in the Version 1 Version/ID tuple. */ |
| 562 | tuple->DesiredTuple = CISTPL_VERS_1; | 518 | if ((link->prod_id[3]) && |
| 563 | if (first_tuple(link, tuple, parse) != 0) { | 519 | (cvt_ascii_address(dev, link->prod_id[3]) == 0)) |
| 564 | rc = -1; | 520 | return 0; |
| 565 | goto free_cfg_mem; | 521 | |
| 566 | } | 522 | /* Workarounds for broken cards start here. */ |
| 567 | /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ | 523 | /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ |
| 568 | if (next_tuple(link, tuple, parse) != 0) | 524 | if (!pcmcia_loop_tuple(link, CISTPL_VERS_1, pcmcia_get_versmac, dev)) |
| 569 | first_tuple(link, tuple, parse); | 525 | return 0; |
| 570 | if (parse->version_1.ns > 3) { | ||
| 571 | station_addr = parse->version_1.str + parse->version_1.ofs[3]; | ||
| 572 | if (cvt_ascii_address(dev, station_addr) == 0) { | ||
| 573 | rc = 0; | ||
| 574 | goto free_cfg_mem; | ||
| 575 | } | ||
| 576 | } | ||
| 577 | 526 | ||
| 578 | /* Another possibility: for the EM3288, in a special tuple */ | 527 | /* Another possibility: for the EM3288, in a special tuple */ |
| 579 | tuple->DesiredTuple = 0x81; | ||
| 580 | if (pcmcia_get_first_tuple(link, tuple) != 0) { | ||
| 581 | rc = -1; | ||
| 582 | goto free_cfg_mem; | ||
| 583 | } | ||
| 584 | if (pcmcia_get_tuple_data(link, tuple) != 0) { | ||
| 585 | rc = -1; | ||
| 586 | goto free_cfg_mem; | ||
| 587 | } | ||
| 588 | buf[12] = '\0'; | ||
| 589 | if (cvt_ascii_address(dev, buf) == 0) { | ||
| 590 | rc = 0; | ||
| 591 | goto free_cfg_mem; | ||
| 592 | } | ||
| 593 | rc = -1; | 528 | rc = -1; |
| 594 | free_cfg_mem: | 529 | len = pcmcia_get_tuple(link, 0x81, &buf); |
| 595 | kfree(cfg_mem); | 530 | if (buf && len >= 13) { |
| 596 | return rc; | 531 | buf[12] = '\0'; |
| 597 | } | 532 | if (cvt_ascii_address(dev, buf)) |
| 533 | rc = 0; | ||
| 534 | } | ||
| 535 | kfree(buf); | ||
| 536 | |||
| 537 | return rc; | ||
| 538 | }; | ||
| 598 | 539 | ||
| 599 | /*====================================================================== | 540 | /*====================================================================== |
| 600 | 541 | ||
| @@ -684,58 +625,21 @@ static int smc_config(struct pcmcia_device *link) | |||
| 684 | return i; | 625 | return i; |
| 685 | } | 626 | } |
| 686 | 627 | ||
| 628 | |||
| 687 | static int smc_setup(struct pcmcia_device *link) | 629 | static int smc_setup(struct pcmcia_device *link) |
| 688 | { | 630 | { |
| 689 | struct net_device *dev = link->priv; | 631 | struct net_device *dev = link->priv; |
| 690 | struct smc_cfg_mem *cfg_mem; | ||
| 691 | tuple_t *tuple; | ||
| 692 | cisparse_t *parse; | ||
| 693 | cistpl_lan_node_id_t *node_id; | ||
| 694 | u_char *buf, *station_addr; | ||
| 695 | int i, rc; | ||
| 696 | |||
| 697 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | ||
| 698 | if (!cfg_mem) | ||
| 699 | return -ENOMEM; | ||
| 700 | |||
| 701 | tuple = &cfg_mem->tuple; | ||
| 702 | parse = &cfg_mem->parse; | ||
| 703 | buf = cfg_mem->buf; | ||
| 704 | |||
| 705 | tuple->Attributes = tuple->TupleOffset = 0; | ||
| 706 | tuple->TupleData = (cisdata_t *)buf; | ||
| 707 | tuple->TupleDataMax = 255; | ||
| 708 | 632 | ||
| 709 | /* Check for a LAN function extension tuple */ | 633 | /* Check for a LAN function extension tuple */ |
| 710 | tuple->DesiredTuple = CISTPL_FUNCE; | 634 | if (!pcmcia_get_mac_from_cis(link, dev)) |
| 711 | i = first_tuple(link, tuple, parse); | 635 | return 0; |
| 712 | while (i == 0) { | 636 | |
| 713 | if (parse->funce.type == CISTPL_FUNCE_LAN_NODE_ID) | ||
| 714 | break; | ||
| 715 | i = next_tuple(link, tuple, parse); | ||
| 716 | } | ||
| 717 | if (i == 0) { | ||
| 718 | node_id = (cistpl_lan_node_id_t *)parse->funce.data; | ||
| 719 | if (node_id->nb == 6) { | ||
| 720 | for (i = 0; i < 6; i++) | ||
| 721 | dev->dev_addr[i] = node_id->id[i]; | ||
| 722 | rc = 0; | ||
| 723 | goto free_cfg_mem; | ||
| 724 | } | ||
| 725 | } | ||
| 726 | /* Try the third string in the Version 1 Version/ID tuple. */ | 637 | /* Try the third string in the Version 1 Version/ID tuple. */ |
| 727 | if (link->prod_id[2]) { | 638 | if (link->prod_id[2]) { |
| 728 | station_addr = link->prod_id[2]; | 639 | if (cvt_ascii_address(dev, link->prod_id[2]) == 0) |
| 729 | if (cvt_ascii_address(dev, station_addr) == 0) { | 640 | return 0; |
| 730 | rc = 0; | ||
| 731 | goto free_cfg_mem; | ||
| 732 | } | ||
| 733 | } | 641 | } |
| 734 | 642 | return -1; | |
| 735 | rc = -1; | ||
| 736 | free_cfg_mem: | ||
| 737 | kfree(cfg_mem); | ||
| 738 | return rc; | ||
| 739 | } | 643 | } |
| 740 | 644 | ||
| 741 | /*====================================================================*/ | 645 | /*====================================================================*/ |
| @@ -749,7 +653,7 @@ static int osi_config(struct pcmcia_device *link) | |||
| 749 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 653 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
| 750 | link->conf.Status = CCSR_AUDIO_ENA; | 654 | link->conf.Status = CCSR_AUDIO_ENA; |
| 751 | link->irq.Attributes = | 655 | link->irq.Attributes = |
| 752 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED|IRQ_HANDLE_PRESENT; | 656 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
| 753 | link->io.NumPorts1 = 64; | 657 | link->io.NumPorts1 = 64; |
| 754 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 658 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
| 755 | link->io.NumPorts2 = 8; | 659 | link->io.NumPorts2 = 8; |
| @@ -794,41 +698,31 @@ static int osi_load_firmware(struct pcmcia_device *link) | |||
| 794 | return err; | 698 | return err; |
| 795 | } | 699 | } |
| 796 | 700 | ||
| 797 | static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) | 701 | static int pcmcia_osi_mac(struct pcmcia_device *p_dev, |
| 702 | tuple_t *tuple, | ||
| 703 | void *priv) | ||
| 798 | { | 704 | { |
| 799 | struct net_device *dev = link->priv; | 705 | struct net_device *dev = priv; |
| 800 | struct smc_cfg_mem *cfg_mem; | 706 | int i; |
| 801 | tuple_t *tuple; | ||
| 802 | u_char *buf; | ||
| 803 | int i, rc; | ||
| 804 | 707 | ||
| 805 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | 708 | if (tuple->TupleDataLen < 8) |
| 806 | if (!cfg_mem) | 709 | return -EINVAL; |
| 807 | return -1; | 710 | if (tuple->TupleData[0] != 0x04) |
| 711 | return -EINVAL; | ||
| 712 | for (i = 0; i < 6; i++) | ||
| 713 | dev->dev_addr[i] = tuple->TupleData[i+2]; | ||
| 714 | return 0; | ||
| 715 | }; | ||
| 808 | 716 | ||
| 809 | tuple = &cfg_mem->tuple; | ||
| 810 | buf = cfg_mem->buf; | ||
| 811 | 717 | ||
| 812 | tuple->Attributes = TUPLE_RETURN_COMMON; | 718 | static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) |
| 813 | tuple->TupleData = (cisdata_t *)buf; | 719 | { |
| 814 | tuple->TupleDataMax = 255; | 720 | struct net_device *dev = link->priv; |
| 815 | tuple->TupleOffset = 0; | 721 | int rc; |
| 816 | 722 | ||
| 817 | /* Read the station address from tuple 0x90, subtuple 0x04 */ | 723 | /* Read the station address from tuple 0x90, subtuple 0x04 */ |
| 818 | tuple->DesiredTuple = 0x90; | 724 | if (pcmcia_loop_tuple(link, 0x90, pcmcia_osi_mac, dev)) |
| 819 | i = pcmcia_get_first_tuple(link, tuple); | 725 | return -1; |
| 820 | while (i == 0) { | ||
| 821 | i = pcmcia_get_tuple_data(link, tuple); | ||
| 822 | if ((i != 0) || (buf[0] == 0x04)) | ||
| 823 | break; | ||
| 824 | i = pcmcia_get_next_tuple(link, tuple); | ||
| 825 | } | ||
| 826 | if (i != 0) { | ||
| 827 | rc = -1; | ||
| 828 | goto free_cfg_mem; | ||
| 829 | } | ||
| 830 | for (i = 0; i < 6; i++) | ||
| 831 | dev->dev_addr[i] = buf[i+2]; | ||
| 832 | 726 | ||
| 833 | if (((manfid == MANFID_OSITECH) && | 727 | if (((manfid == MANFID_OSITECH) && |
| 834 | (cardid == PRODID_OSITECH_SEVEN)) || | 728 | (cardid == PRODID_OSITECH_SEVEN)) || |
| @@ -836,20 +730,17 @@ static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) | |||
| 836 | (cardid == PRODID_PSION_NET100))) { | 730 | (cardid == PRODID_PSION_NET100))) { |
| 837 | rc = osi_load_firmware(link); | 731 | rc = osi_load_firmware(link); |
| 838 | if (rc) | 732 | if (rc) |
| 839 | goto free_cfg_mem; | 733 | return rc; |
| 840 | } else if (manfid == MANFID_OSITECH) { | 734 | } else if (manfid == MANFID_OSITECH) { |
| 841 | /* Make sure both functions are powered up */ | 735 | /* Make sure both functions are powered up */ |
| 842 | set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); | 736 | set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); |
| 843 | /* Now, turn on the interrupt for both card functions */ | 737 | /* Now, turn on the interrupt for both card functions */ |
| 844 | set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); | 738 | set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); |
| 845 | DEBUG(2, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", | 739 | dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", |
| 846 | inw(link->io.BasePort1 + OSITECH_AUI_PWR), | 740 | inw(link->io.BasePort1 + OSITECH_AUI_PWR), |
| 847 | inw(link->io.BasePort1 + OSITECH_RESET_ISR)); | 741 | inw(link->io.BasePort1 + OSITECH_RESET_ISR)); |
| 848 | } | 742 | } |
| 849 | rc = 0; | 743 | return 0; |
| 850 | free_cfg_mem: | ||
| 851 | kfree(cfg_mem); | ||
| 852 | return rc; | ||
| 853 | } | 744 | } |
| 854 | 745 | ||
| 855 | static int smc91c92_suspend(struct pcmcia_device *link) | 746 | static int smc91c92_suspend(struct pcmcia_device *link) |
| @@ -959,12 +850,6 @@ static int check_sig(struct pcmcia_device *link) | |||
| 959 | 850 | ||
| 960 | ======================================================================*/ | 851 | ======================================================================*/ |
| 961 | 852 | ||
| 962 | #define CS_EXIT_TEST(ret, svc, label) \ | ||
| 963 | if (ret != 0) { \ | ||
| 964 | cs_error(link, svc, ret); \ | ||
| 965 | goto label; \ | ||
| 966 | } | ||
| 967 | |||
| 968 | static int smc91c92_config(struct pcmcia_device *link) | 853 | static int smc91c92_config(struct pcmcia_device *link) |
| 969 | { | 854 | { |
| 970 | struct net_device *dev = link->priv; | 855 | struct net_device *dev = link->priv; |
| @@ -974,7 +859,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
| 974 | unsigned int ioaddr; | 859 | unsigned int ioaddr; |
| 975 | u_long mir; | 860 | u_long mir; |
| 976 | 861 | ||
| 977 | DEBUG(0, "smc91c92_config(0x%p)\n", link); | 862 | dev_dbg(&link->dev, "smc91c92_config\n"); |
| 978 | 863 | ||
| 979 | smc->manfid = link->manf_id; | 864 | smc->manfid = link->manf_id; |
| 980 | smc->cardid = link->card_id; | 865 | smc->cardid = link->card_id; |
| @@ -990,12 +875,15 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
| 990 | } else { | 875 | } else { |
| 991 | i = smc_config(link); | 876 | i = smc_config(link); |
| 992 | } | 877 | } |
| 993 | CS_EXIT_TEST(i, RequestIO, config_failed); | 878 | if (i) |
| 879 | goto config_failed; | ||
| 994 | 880 | ||
| 995 | i = pcmcia_request_irq(link, &link->irq); | 881 | i = pcmcia_request_irq(link, &link->irq); |
| 996 | CS_EXIT_TEST(i, RequestIRQ, config_failed); | 882 | if (i) |
| 883 | goto config_failed; | ||
| 997 | i = pcmcia_request_configuration(link, &link->conf); | 884 | i = pcmcia_request_configuration(link, &link->conf); |
| 998 | CS_EXIT_TEST(i, RequestConfiguration, config_failed); | 885 | if (i) |
| 886 | goto config_failed; | ||
| 999 | 887 | ||
| 1000 | if (smc->manfid == MANFID_MOTOROLA) | 888 | if (smc->manfid == MANFID_MOTOROLA) |
| 1001 | mot_config(link); | 889 | mot_config(link); |
| @@ -1074,7 +962,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
| 1074 | } | 962 | } |
| 1075 | 963 | ||
| 1076 | link->dev_node = &smc->node; | 964 | link->dev_node = &smc->node; |
| 1077 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 965 | SET_NETDEV_DEV(dev, &link->dev); |
| 1078 | 966 | ||
| 1079 | if (register_netdev(dev) != 0) { | 967 | if (register_netdev(dev) != 0) { |
| 1080 | printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n"); | 968 | printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n"); |
| @@ -1100,7 +988,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
| 1100 | 988 | ||
| 1101 | if (smc->cfg & CFG_MII_SELECT) { | 989 | if (smc->cfg & CFG_MII_SELECT) { |
| 1102 | if (smc->mii_if.phy_id != -1) { | 990 | if (smc->mii_if.phy_id != -1) { |
| 1103 | DEBUG(0, " MII transceiver at index %d, status %x.\n", | 991 | dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n", |
| 1104 | smc->mii_if.phy_id, j); | 992 | smc->mii_if.phy_id, j); |
| 1105 | } else { | 993 | } else { |
| 1106 | printk(KERN_NOTICE " No MII transceivers found!\n"); | 994 | printk(KERN_NOTICE " No MII transceivers found!\n"); |
| @@ -1110,7 +998,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
| 1110 | 998 | ||
| 1111 | config_undo: | 999 | config_undo: |
| 1112 | unregister_netdev(dev); | 1000 | unregister_netdev(dev); |
| 1113 | config_failed: /* CS_EXIT_TEST() calls jump to here... */ | 1001 | config_failed: |
| 1114 | smc91c92_release(link); | 1002 | smc91c92_release(link); |
| 1115 | return -ENODEV; | 1003 | return -ENODEV; |
| 1116 | } /* smc91c92_config */ | 1004 | } /* smc91c92_config */ |
| @@ -1125,7 +1013,7 @@ config_failed: /* CS_EXIT_TEST() calls jump to here... */ | |||
| 1125 | 1013 | ||
| 1126 | static void smc91c92_release(struct pcmcia_device *link) | 1014 | static void smc91c92_release(struct pcmcia_device *link) |
| 1127 | { | 1015 | { |
| 1128 | DEBUG(0, "smc91c92_release(0x%p)\n", link); | 1016 | dev_dbg(&link->dev, "smc91c92_release\n"); |
| 1129 | if (link->win) { | 1017 | if (link->win) { |
| 1130 | struct net_device *dev = link->priv; | 1018 | struct net_device *dev = link->priv; |
| 1131 | struct smc_private *smc = netdev_priv(dev); | 1019 | struct smc_private *smc = netdev_priv(dev); |
| @@ -1222,10 +1110,10 @@ static int smc_open(struct net_device *dev) | |||
| 1222 | struct smc_private *smc = netdev_priv(dev); | 1110 | struct smc_private *smc = netdev_priv(dev); |
| 1223 | struct pcmcia_device *link = smc->p_dev; | 1111 | struct pcmcia_device *link = smc->p_dev; |
| 1224 | 1112 | ||
| 1225 | #ifdef PCMCIA_DEBUG | 1113 | dev_dbg(&link->dev, "%s: smc_open(%p), ID/Window %4.4x.\n", |
| 1226 | DEBUG(0, "%s: smc_open(%p), ID/Window %4.4x.\n", | ||
| 1227 | dev->name, dev, inw(dev->base_addr + BANK_SELECT)); | 1114 | dev->name, dev, inw(dev->base_addr + BANK_SELECT)); |
| 1228 | if (pc_debug > 1) smc_dump(dev); | 1115 | #ifdef PCMCIA_DEBUG |
| 1116 | smc_dump(dev); | ||
| 1229 | #endif | 1117 | #endif |
| 1230 | 1118 | ||
| 1231 | /* Check that the PCMCIA card is still here. */ | 1119 | /* Check that the PCMCIA card is still here. */ |
| @@ -1260,7 +1148,7 @@ static int smc_close(struct net_device *dev) | |||
| 1260 | struct pcmcia_device *link = smc->p_dev; | 1148 | struct pcmcia_device *link = smc->p_dev; |
| 1261 | unsigned int ioaddr = dev->base_addr; | 1149 | unsigned int ioaddr = dev->base_addr; |
| 1262 | 1150 | ||
| 1263 | DEBUG(0, "%s: smc_close(), status %4.4x.\n", | 1151 | dev_dbg(&link->dev, "%s: smc_close(), status %4.4x.\n", |
| 1264 | dev->name, inw(ioaddr + BANK_SELECT)); | 1152 | dev->name, inw(ioaddr + BANK_SELECT)); |
| 1265 | 1153 | ||
| 1266 | netif_stop_queue(dev); | 1154 | netif_stop_queue(dev); |
| @@ -1327,7 +1215,7 @@ static void smc_hardware_send_packet(struct net_device * dev) | |||
| 1327 | u_char *buf = skb->data; | 1215 | u_char *buf = skb->data; |
| 1328 | u_int length = skb->len; /* The chip will pad to ethernet min. */ | 1216 | u_int length = skb->len; /* The chip will pad to ethernet min. */ |
| 1329 | 1217 | ||
| 1330 | DEBUG(2, "%s: Trying to xmit packet of length %d.\n", | 1218 | pr_debug("%s: Trying to xmit packet of length %d.\n", |
| 1331 | dev->name, length); | 1219 | dev->name, length); |
| 1332 | 1220 | ||
| 1333 | /* send the packet length: +6 for status word, length, and ctl */ | 1221 | /* send the packet length: +6 for status word, length, and ctl */ |
| @@ -1382,7 +1270,7 @@ static netdev_tx_t smc_start_xmit(struct sk_buff *skb, | |||
| 1382 | 1270 | ||
| 1383 | netif_stop_queue(dev); | 1271 | netif_stop_queue(dev); |
| 1384 | 1272 | ||
| 1385 | DEBUG(2, "%s: smc_start_xmit(length = %d) called," | 1273 | pr_debug("%s: smc_start_xmit(length = %d) called," |
| 1386 | " status %4.4x.\n", dev->name, skb->len, inw(ioaddr + 2)); | 1274 | " status %4.4x.\n", dev->name, skb->len, inw(ioaddr + 2)); |
| 1387 | 1275 | ||
| 1388 | if (smc->saved_skb) { | 1276 | if (smc->saved_skb) { |
| @@ -1429,7 +1317,7 @@ static netdev_tx_t smc_start_xmit(struct sk_buff *skb, | |||
| 1429 | } | 1317 | } |
| 1430 | 1318 | ||
| 1431 | /* Otherwise defer until the Tx-space-allocated interrupt. */ | 1319 | /* Otherwise defer until the Tx-space-allocated interrupt. */ |
| 1432 | DEBUG(2, "%s: memory allocation deferred.\n", dev->name); | 1320 | pr_debug("%s: memory allocation deferred.\n", dev->name); |
| 1433 | outw((IM_ALLOC_INT << 8) | (ir & 0xff00), ioaddr + INTERRUPT); | 1321 | outw((IM_ALLOC_INT << 8) | (ir & 0xff00), ioaddr + INTERRUPT); |
| 1434 | spin_unlock_irqrestore(&smc->lock, flags); | 1322 | spin_unlock_irqrestore(&smc->lock, flags); |
| 1435 | 1323 | ||
| @@ -1494,7 +1382,7 @@ static void smc_eph_irq(struct net_device *dev) | |||
| 1494 | 1382 | ||
| 1495 | SMC_SELECT_BANK(0); | 1383 | SMC_SELECT_BANK(0); |
| 1496 | ephs = inw(ioaddr + EPH); | 1384 | ephs = inw(ioaddr + EPH); |
| 1497 | DEBUG(2, "%s: Ethernet protocol handler interrupt, status" | 1385 | pr_debug("%s: Ethernet protocol handler interrupt, status" |
| 1498 | " %4.4x.\n", dev->name, ephs); | 1386 | " %4.4x.\n", dev->name, ephs); |
| 1499 | /* Could be a counter roll-over warning: update stats. */ | 1387 | /* Could be a counter roll-over warning: update stats. */ |
| 1500 | card_stats = inw(ioaddr + COUNTER); | 1388 | card_stats = inw(ioaddr + COUNTER); |
| @@ -1534,7 +1422,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
| 1534 | 1422 | ||
| 1535 | ioaddr = dev->base_addr; | 1423 | ioaddr = dev->base_addr; |
| 1536 | 1424 | ||
| 1537 | DEBUG(3, "%s: SMC91c92 interrupt %d at %#x.\n", dev->name, | 1425 | pr_debug("%s: SMC91c92 interrupt %d at %#x.\n", dev->name, |
| 1538 | irq, ioaddr); | 1426 | irq, ioaddr); |
| 1539 | 1427 | ||
| 1540 | spin_lock(&smc->lock); | 1428 | spin_lock(&smc->lock); |
| @@ -1543,7 +1431,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
| 1543 | if ((saved_bank & 0xff00) != 0x3300) { | 1431 | if ((saved_bank & 0xff00) != 0x3300) { |
| 1544 | /* The device does not exist -- the card could be off-line, or | 1432 | /* The device does not exist -- the card could be off-line, or |
| 1545 | maybe it has been ejected. */ | 1433 | maybe it has been ejected. */ |
| 1546 | DEBUG(1, "%s: SMC91c92 interrupt %d for non-existent" | 1434 | pr_debug("%s: SMC91c92 interrupt %d for non-existent" |
| 1547 | "/ejected device.\n", dev->name, irq); | 1435 | "/ejected device.\n", dev->name, irq); |
| 1548 | handled = 0; | 1436 | handled = 0; |
| 1549 | goto irq_done; | 1437 | goto irq_done; |
| @@ -1557,7 +1445,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
| 1557 | 1445 | ||
| 1558 | do { /* read the status flag, and mask it */ | 1446 | do { /* read the status flag, and mask it */ |
| 1559 | status = inw(ioaddr + INTERRUPT) & 0xff; | 1447 | status = inw(ioaddr + INTERRUPT) & 0xff; |
| 1560 | DEBUG(3, "%s: Status is %#2.2x (mask %#2.2x).\n", dev->name, | 1448 | pr_debug("%s: Status is %#2.2x (mask %#2.2x).\n", dev->name, |
| 1561 | status, mask); | 1449 | status, mask); |
| 1562 | if ((status & mask) == 0) { | 1450 | if ((status & mask) == 0) { |
| 1563 | if (bogus_cnt == INTR_WORK) | 1451 | if (bogus_cnt == INTR_WORK) |
| @@ -1602,7 +1490,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
| 1602 | smc_eph_irq(dev); | 1490 | smc_eph_irq(dev); |
| 1603 | } while (--bogus_cnt); | 1491 | } while (--bogus_cnt); |
| 1604 | 1492 | ||
| 1605 | DEBUG(3, " Restoring saved registers mask %2.2x bank %4.4x" | 1493 | pr_debug(" Restoring saved registers mask %2.2x bank %4.4x" |
| 1606 | " pointer %4.4x.\n", mask, saved_bank, saved_pointer); | 1494 | " pointer %4.4x.\n", mask, saved_bank, saved_pointer); |
| 1607 | 1495 | ||
| 1608 | /* restore state register */ | 1496 | /* restore state register */ |
| @@ -1610,7 +1498,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
| 1610 | outw(saved_pointer, ioaddr + POINTER); | 1498 | outw(saved_pointer, ioaddr + POINTER); |
| 1611 | SMC_SELECT_BANK(saved_bank); | 1499 | SMC_SELECT_BANK(saved_bank); |
| 1612 | 1500 | ||
| 1613 | DEBUG(3, "%s: Exiting interrupt IRQ%d.\n", dev->name, irq); | 1501 | pr_debug("%s: Exiting interrupt IRQ%d.\n", dev->name, irq); |
| 1614 | 1502 | ||
| 1615 | irq_done: | 1503 | irq_done: |
| 1616 | 1504 | ||
| @@ -1661,7 +1549,7 @@ static void smc_rx(struct net_device *dev) | |||
| 1661 | rx_status = inw(ioaddr + DATA_1); | 1549 | rx_status = inw(ioaddr + DATA_1); |
| 1662 | packet_length = inw(ioaddr + DATA_1) & 0x07ff; | 1550 | packet_length = inw(ioaddr + DATA_1) & 0x07ff; |
| 1663 | 1551 | ||
| 1664 | DEBUG(2, "%s: Receive status %4.4x length %d.\n", | 1552 | pr_debug("%s: Receive status %4.4x length %d.\n", |
| 1665 | dev->name, rx_status, packet_length); | 1553 | dev->name, rx_status, packet_length); |
| 1666 | 1554 | ||
| 1667 | if (!(rx_status & RS_ERRORS)) { | 1555 | if (!(rx_status & RS_ERRORS)) { |
| @@ -1672,7 +1560,7 @@ static void smc_rx(struct net_device *dev) | |||
| 1672 | skb = dev_alloc_skb(packet_length+2); | 1560 | skb = dev_alloc_skb(packet_length+2); |
| 1673 | 1561 | ||
| 1674 | if (skb == NULL) { | 1562 | if (skb == NULL) { |
| 1675 | DEBUG(1, "%s: Low memory, packet dropped.\n", dev->name); | 1563 | pr_debug("%s: Low memory, packet dropped.\n", dev->name); |
| 1676 | dev->stats.rx_dropped++; | 1564 | dev->stats.rx_dropped++; |
| 1677 | outw(MC_RELEASE, ioaddr + MMU_CMD); | 1565 | outw(MC_RELEASE, ioaddr + MMU_CMD); |
| 1678 | return; | 1566 | return; |
| @@ -1832,7 +1720,7 @@ static void smc_reset(struct net_device *dev) | |||
| 1832 | struct smc_private *smc = netdev_priv(dev); | 1720 | struct smc_private *smc = netdev_priv(dev); |
| 1833 | int i; | 1721 | int i; |
| 1834 | 1722 | ||
| 1835 | DEBUG(0, "%s: smc91c92 reset called.\n", dev->name); | 1723 | pr_debug("%s: smc91c92 reset called.\n", dev->name); |
| 1836 | 1724 | ||
| 1837 | /* The first interaction must be a write to bring the chip out | 1725 | /* The first interaction must be a write to bring the chip out |
| 1838 | of sleep mode. */ | 1726 | of sleep mode. */ |
| @@ -2149,18 +2037,6 @@ static u32 smc_get_link(struct net_device *dev) | |||
| 2149 | return ret; | 2037 | return ret; |
| 2150 | } | 2038 | } |
| 2151 | 2039 | ||
| 2152 | #ifdef PCMCIA_DEBUG | ||
| 2153 | static u32 smc_get_msglevel(struct net_device *dev) | ||
| 2154 | { | ||
| 2155 | return pc_debug; | ||
| 2156 | } | ||
| 2157 | |||
| 2158 | static void smc_set_msglevel(struct net_device *dev, u32 val) | ||
| 2159 | { | ||
| 2160 | pc_debug = val; | ||
| 2161 | } | ||
| 2162 | #endif | ||
| 2163 | |||
| 2164 | static int smc_nway_reset(struct net_device *dev) | 2040 | static int smc_nway_reset(struct net_device *dev) |
| 2165 | { | 2041 | { |
| 2166 | struct smc_private *smc = netdev_priv(dev); | 2042 | struct smc_private *smc = netdev_priv(dev); |
| @@ -2184,10 +2060,6 @@ static const struct ethtool_ops ethtool_ops = { | |||
| 2184 | .get_settings = smc_get_settings, | 2060 | .get_settings = smc_get_settings, |
| 2185 | .set_settings = smc_set_settings, | 2061 | .set_settings = smc_set_settings, |
| 2186 | .get_link = smc_get_link, | 2062 | .get_link = smc_get_link, |
| 2187 | #ifdef PCMCIA_DEBUG | ||
| 2188 | .get_msglevel = smc_get_msglevel, | ||
| 2189 | .set_msglevel = smc_set_msglevel, | ||
| 2190 | #endif | ||
| 2191 | .nway_reset = smc_nway_reset, | 2063 | .nway_reset = smc_nway_reset, |
| 2192 | }; | 2064 | }; |
| 2193 | 2065 | ||
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index cf8423102538..fe504b7f369f 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
| @@ -211,20 +211,6 @@ enum xirc_cmd { /* Commands */ | |||
| 211 | 211 | ||
| 212 | static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" }; | 212 | static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" }; |
| 213 | 213 | ||
| 214 | /**************** | ||
| 215 | * All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 216 | * you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 217 | * left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 218 | * be present but disabled -- but it can then be enabled for specific | ||
| 219 | * modules at load time with a 'pc_debug=#' option to insmod. | ||
| 220 | */ | ||
| 221 | #ifdef PCMCIA_DEBUG | ||
| 222 | static int pc_debug = PCMCIA_DEBUG; | ||
| 223 | module_param(pc_debug, int, 0); | ||
| 224 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KDBG_XIRC args) | ||
| 225 | #else | ||
| 226 | #define DEBUG(n, args...) | ||
| 227 | #endif | ||
| 228 | 214 | ||
| 229 | #define KDBG_XIRC KERN_DEBUG "xirc2ps_cs: " | 215 | #define KDBG_XIRC KERN_DEBUG "xirc2ps_cs: " |
| 230 | #define KERR_XIRC KERN_ERR "xirc2ps_cs: " | 216 | #define KERR_XIRC KERN_ERR "xirc2ps_cs: " |
| @@ -359,7 +345,7 @@ static void xirc_tx_timeout(struct net_device *dev); | |||
| 359 | static void xirc2ps_tx_timeout_task(struct work_struct *work); | 345 | static void xirc2ps_tx_timeout_task(struct work_struct *work); |
| 360 | static void set_addresses(struct net_device *dev); | 346 | static void set_addresses(struct net_device *dev); |
| 361 | static void set_multicast_list(struct net_device *dev); | 347 | static void set_multicast_list(struct net_device *dev); |
| 362 | static int set_card_type(struct pcmcia_device *link, const void *s); | 348 | static int set_card_type(struct pcmcia_device *link); |
| 363 | static int do_config(struct net_device *dev, struct ifmap *map); | 349 | static int do_config(struct net_device *dev, struct ifmap *map); |
| 364 | static int do_open(struct net_device *dev); | 350 | static int do_open(struct net_device *dev); |
| 365 | static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 351 | static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
| @@ -371,28 +357,6 @@ static void do_powerdown(struct net_device *dev); | |||
| 371 | static int do_stop(struct net_device *dev); | 357 | static int do_stop(struct net_device *dev); |
| 372 | 358 | ||
| 373 | /*=============== Helper functions =========================*/ | 359 | /*=============== Helper functions =========================*/ |
| 374 | static int | ||
| 375 | first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | ||
| 376 | { | ||
| 377 | int err; | ||
| 378 | |||
| 379 | if ((err = pcmcia_get_first_tuple(handle, tuple)) == 0 && | ||
| 380 | (err = pcmcia_get_tuple_data(handle, tuple)) == 0) | ||
| 381 | err = pcmcia_parse_tuple(tuple, parse); | ||
| 382 | return err; | ||
| 383 | } | ||
| 384 | |||
| 385 | static int | ||
| 386 | next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | ||
| 387 | { | ||
| 388 | int err; | ||
| 389 | |||
| 390 | if ((err = pcmcia_get_next_tuple(handle, tuple)) == 0 && | ||
| 391 | (err = pcmcia_get_tuple_data(handle, tuple)) == 0) | ||
| 392 | err = pcmcia_parse_tuple(tuple, parse); | ||
| 393 | return err; | ||
| 394 | } | ||
| 395 | |||
| 396 | #define SelectPage(pgnr) outb((pgnr), ioaddr + XIRCREG_PR) | 360 | #define SelectPage(pgnr) outb((pgnr), ioaddr + XIRCREG_PR) |
| 397 | #define GetByte(reg) ((unsigned)inb(ioaddr + (reg))) | 361 | #define GetByte(reg) ((unsigned)inb(ioaddr + (reg))) |
| 398 | #define GetWord(reg) ((unsigned)inw(ioaddr + (reg))) | 362 | #define GetWord(reg) ((unsigned)inw(ioaddr + (reg))) |
| @@ -400,7 +364,7 @@ next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | |||
| 400 | #define PutWord(reg,value) outw((value), ioaddr+(reg)) | 364 | #define PutWord(reg,value) outw((value), ioaddr+(reg)) |
| 401 | 365 | ||
| 402 | /*====== Functions used for debugging =================================*/ | 366 | /*====== Functions used for debugging =================================*/ |
| 403 | #if defined(PCMCIA_DEBUG) && 0 /* reading regs may change system status */ | 367 | #if 0 /* reading regs may change system status */ |
| 404 | static void | 368 | static void |
| 405 | PrintRegisters(struct net_device *dev) | 369 | PrintRegisters(struct net_device *dev) |
| 406 | { | 370 | { |
| @@ -432,7 +396,7 @@ PrintRegisters(struct net_device *dev) | |||
| 432 | } | 396 | } |
| 433 | } | 397 | } |
| 434 | } | 398 | } |
| 435 | #endif /* PCMCIA_DEBUG */ | 399 | #endif /* 0 */ |
| 436 | 400 | ||
| 437 | /*============== MII Management functions ===============*/ | 401 | /*============== MII Management functions ===============*/ |
| 438 | 402 | ||
| @@ -576,7 +540,7 @@ xirc2ps_probe(struct pcmcia_device *link) | |||
| 576 | struct net_device *dev; | 540 | struct net_device *dev; |
| 577 | local_info_t *local; | 541 | local_info_t *local; |
| 578 | 542 | ||
| 579 | DEBUG(0, "attach()\n"); | 543 | dev_dbg(&link->dev, "attach()\n"); |
| 580 | 544 | ||
| 581 | /* Allocate the device structure */ | 545 | /* Allocate the device structure */ |
| 582 | dev = alloc_etherdev(sizeof(local_info_t)); | 546 | dev = alloc_etherdev(sizeof(local_info_t)); |
| @@ -592,7 +556,6 @@ xirc2ps_probe(struct pcmcia_device *link) | |||
| 592 | link->conf.IntType = INT_MEMORY_AND_IO; | 556 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 593 | link->conf.ConfigIndex = 1; | 557 | link->conf.ConfigIndex = 1; |
| 594 | link->irq.Handler = xirc2ps_interrupt; | 558 | link->irq.Handler = xirc2ps_interrupt; |
| 595 | link->irq.Instance = dev; | ||
| 596 | 559 | ||
| 597 | /* Fill in card specific entries */ | 560 | /* Fill in card specific entries */ |
| 598 | dev->netdev_ops = &netdev_ops; | 561 | dev->netdev_ops = &netdev_ops; |
| @@ -615,7 +578,7 @@ xirc2ps_detach(struct pcmcia_device *link) | |||
| 615 | { | 578 | { |
| 616 | struct net_device *dev = link->priv; | 579 | struct net_device *dev = link->priv; |
| 617 | 580 | ||
| 618 | DEBUG(0, "detach(0x%p)\n", link); | 581 | dev_dbg(&link->dev, "detach\n"); |
| 619 | 582 | ||
| 620 | if (link->dev_node) | 583 | if (link->dev_node) |
| 621 | unregister_netdev(dev); | 584 | unregister_netdev(dev); |
| @@ -644,17 +607,25 @@ xirc2ps_detach(struct pcmcia_device *link) | |||
| 644 | * | 607 | * |
| 645 | */ | 608 | */ |
| 646 | static int | 609 | static int |
| 647 | set_card_type(struct pcmcia_device *link, const void *s) | 610 | set_card_type(struct pcmcia_device *link) |
| 648 | { | 611 | { |
| 649 | struct net_device *dev = link->priv; | 612 | struct net_device *dev = link->priv; |
| 650 | local_info_t *local = netdev_priv(dev); | 613 | local_info_t *local = netdev_priv(dev); |
| 651 | #ifdef PCMCIA_DEBUG | 614 | u8 *buf; |
| 652 | unsigned cisrev = ((const unsigned char *)s)[2]; | 615 | unsigned int cisrev, mediaid, prodid; |
| 653 | #endif | 616 | size_t len; |
| 654 | unsigned mediaid= ((const unsigned char *)s)[3]; | 617 | |
| 655 | unsigned prodid = ((const unsigned char *)s)[4]; | 618 | len = pcmcia_get_tuple(link, CISTPL_MANFID, &buf); |
| 619 | if (len < 5) { | ||
| 620 | dev_err(&link->dev, "invalid CIS -- sorry\n"); | ||
| 621 | return 0; | ||
| 622 | } | ||
| 656 | 623 | ||
| 657 | DEBUG(0, "cisrev=%02x mediaid=%02x prodid=%02x\n", | 624 | cisrev = buf[2]; |
| 625 | mediaid = buf[3]; | ||
| 626 | prodid = buf[4]; | ||
| 627 | |||
| 628 | dev_dbg(&link->dev, "cisrev=%02x mediaid=%02x prodid=%02x\n", | ||
| 658 | cisrev, mediaid, prodid); | 629 | cisrev, mediaid, prodid); |
| 659 | 630 | ||
| 660 | local->mohawk = 0; | 631 | local->mohawk = 0; |
| @@ -761,6 +732,26 @@ xirc2ps_config_check(struct pcmcia_device *p_dev, | |||
| 761 | 732 | ||
| 762 | } | 733 | } |
| 763 | 734 | ||
| 735 | |||
| 736 | static int pcmcia_get_mac_ce(struct pcmcia_device *p_dev, | ||
| 737 | tuple_t *tuple, | ||
| 738 | void *priv) | ||
| 739 | { | ||
| 740 | struct net_device *dev = priv; | ||
| 741 | int i; | ||
| 742 | |||
| 743 | if (tuple->TupleDataLen != 13) | ||
| 744 | return -EINVAL; | ||
| 745 | if ((tuple->TupleData[0] != 2) || (tuple->TupleData[1] != 1) || | ||
| 746 | (tuple->TupleData[2] != 6)) | ||
| 747 | return -EINVAL; | ||
| 748 | /* another try (James Lehmer's CE2 version 4.1)*/ | ||
| 749 | for (i = 2; i < 6; i++) | ||
| 750 | dev->dev_addr[i] = tuple->TupleData[i+2]; | ||
| 751 | return 0; | ||
| 752 | }; | ||
| 753 | |||
| 754 | |||
| 764 | /**************** | 755 | /**************** |
| 765 | * xirc2ps_config() is scheduled to run after a CARD_INSERTION event | 756 | * xirc2ps_config() is scheduled to run after a CARD_INSERTION event |
| 766 | * is received, to configure the PCMCIA socket, and to make the | 757 | * is received, to configure the PCMCIA socket, and to make the |
| @@ -772,33 +763,21 @@ xirc2ps_config(struct pcmcia_device * link) | |||
| 772 | struct net_device *dev = link->priv; | 763 | struct net_device *dev = link->priv; |
| 773 | local_info_t *local = netdev_priv(dev); | 764 | local_info_t *local = netdev_priv(dev); |
| 774 | unsigned int ioaddr; | 765 | unsigned int ioaddr; |
| 775 | tuple_t tuple; | 766 | int err; |
| 776 | cisparse_t parse; | 767 | u8 *buf; |
| 777 | int err, i; | 768 | size_t len; |
| 778 | u_char buf[64]; | ||
| 779 | cistpl_lan_node_id_t *node_id = (cistpl_lan_node_id_t*)parse.funce.data; | ||
| 780 | 769 | ||
| 781 | local->dingo_ccr = NULL; | 770 | local->dingo_ccr = NULL; |
| 782 | 771 | ||
| 783 | DEBUG(0, "config(0x%p)\n", link); | 772 | dev_dbg(&link->dev, "config\n"); |
| 784 | |||
| 785 | /* | ||
| 786 | * This reads the card's CONFIG tuple to find its configuration | ||
| 787 | * registers. | ||
| 788 | */ | ||
| 789 | tuple.Attributes = 0; | ||
| 790 | tuple.TupleData = buf; | ||
| 791 | tuple.TupleDataMax = 64; | ||
| 792 | tuple.TupleOffset = 0; | ||
| 793 | 773 | ||
| 794 | /* Is this a valid card */ | 774 | /* Is this a valid card */ |
| 795 | tuple.DesiredTuple = CISTPL_MANFID; | 775 | if (link->has_manf_id == 0) { |
| 796 | if ((err=first_tuple(link, &tuple, &parse))) { | ||
| 797 | printk(KNOT_XIRC "manfid not found in CIS\n"); | 776 | printk(KNOT_XIRC "manfid not found in CIS\n"); |
| 798 | goto failure; | 777 | goto failure; |
| 799 | } | 778 | } |
| 800 | 779 | ||
| 801 | switch(parse.manfid.manf) { | 780 | switch (link->manf_id) { |
| 802 | case MANFID_XIRCOM: | 781 | case MANFID_XIRCOM: |
| 803 | local->manf_str = "Xircom"; | 782 | local->manf_str = "Xircom"; |
| 804 | break; | 783 | break; |
| @@ -817,65 +796,44 @@ xirc2ps_config(struct pcmcia_device * link) | |||
| 817 | break; | 796 | break; |
| 818 | default: | 797 | default: |
| 819 | printk(KNOT_XIRC "Unknown Card Manufacturer ID: 0x%04x\n", | 798 | printk(KNOT_XIRC "Unknown Card Manufacturer ID: 0x%04x\n", |
| 820 | (unsigned)parse.manfid.manf); | 799 | (unsigned)link->manf_id); |
| 821 | goto failure; | 800 | goto failure; |
| 822 | } | 801 | } |
| 823 | DEBUG(0, "found %s card\n", local->manf_str); | 802 | dev_dbg(&link->dev, "found %s card\n", local->manf_str); |
| 824 | 803 | ||
| 825 | if (!set_card_type(link, buf)) { | 804 | if (!set_card_type(link)) { |
| 826 | printk(KNOT_XIRC "this card is not supported\n"); | 805 | printk(KNOT_XIRC "this card is not supported\n"); |
| 827 | goto failure; | 806 | goto failure; |
| 828 | } | 807 | } |
| 829 | 808 | ||
| 830 | /* get the ethernet address from the CIS */ | 809 | /* get the ethernet address from the CIS */ |
| 831 | tuple.DesiredTuple = CISTPL_FUNCE; | 810 | err = pcmcia_get_mac_from_cis(link, dev); |
| 832 | for (err = first_tuple(link, &tuple, &parse); !err; | 811 | |
| 833 | err = next_tuple(link, &tuple, &parse)) { | 812 | /* not found: try to get the node-id from tuple 0x89 */ |
| 834 | /* Once I saw two CISTPL_FUNCE_LAN_NODE_ID entries: | 813 | if (err) { |
| 835 | * the first one with a length of zero the second correct - | 814 | len = pcmcia_get_tuple(link, 0x89, &buf); |
| 836 | * so I skip all entries with length 0 */ | 815 | /* data layout looks like tuple 0x22 */ |
| 837 | if (parse.funce.type == CISTPL_FUNCE_LAN_NODE_ID | 816 | if (buf && len == 8) { |
| 838 | && ((cistpl_lan_node_id_t *)parse.funce.data)->nb) | 817 | if (*buf == CISTPL_FUNCE_LAN_NODE_ID) { |
| 839 | break; | 818 | int i; |
| 840 | } | 819 | for (i = 2; i < 6; i++) |
| 841 | if (err) { /* not found: try to get the node-id from tuple 0x89 */ | 820 | dev->dev_addr[i] = buf[i+2]; |
| 842 | tuple.DesiredTuple = 0x89; /* data layout looks like tuple 0x22 */ | 821 | } else |
| 843 | if ((err = pcmcia_get_first_tuple(link, &tuple)) == 0 && | 822 | err = -1; |
| 844 | (err = pcmcia_get_tuple_data(link, &tuple)) == 0) { | ||
| 845 | if (tuple.TupleDataLen == 8 && *buf == CISTPL_FUNCE_LAN_NODE_ID) | ||
| 846 | memcpy(&parse, buf, 8); | ||
| 847 | else | ||
| 848 | err = -1; | ||
| 849 | } | ||
| 850 | } | ||
| 851 | if (err) { /* another try (James Lehmer's CE2 version 4.1)*/ | ||
| 852 | tuple.DesiredTuple = CISTPL_FUNCE; | ||
| 853 | for (err = first_tuple(link, &tuple, &parse); !err; | ||
| 854 | err = next_tuple(link, &tuple, &parse)) { | ||
| 855 | if (parse.funce.type == 0x02 && parse.funce.data[0] == 1 | ||
| 856 | && parse.funce.data[1] == 6 && tuple.TupleDataLen == 13) { | ||
| 857 | buf[1] = 4; | ||
| 858 | memcpy(&parse, buf+1, 8); | ||
| 859 | break; | ||
| 860 | } | 823 | } |
| 861 | } | 824 | kfree(buf); |
| 862 | } | 825 | } |
| 826 | |||
| 827 | if (err) | ||
| 828 | err = pcmcia_loop_tuple(link, CISTPL_FUNCE, pcmcia_get_mac_ce, dev); | ||
| 829 | |||
| 863 | if (err) { | 830 | if (err) { |
| 864 | printk(KNOT_XIRC "node-id not found in CIS\n"); | 831 | printk(KNOT_XIRC "node-id not found in CIS\n"); |
| 865 | goto failure; | 832 | goto failure; |
| 866 | } | 833 | } |
| 867 | node_id = (cistpl_lan_node_id_t *)parse.funce.data; | ||
| 868 | if (node_id->nb != 6) { | ||
| 869 | printk(KNOT_XIRC "malformed node-id in CIS\n"); | ||
| 870 | goto failure; | ||
| 871 | } | ||
| 872 | for (i=0; i < 6; i++) | ||
| 873 | dev->dev_addr[i] = node_id->id[i]; | ||
| 874 | 834 | ||
| 875 | link->io.IOAddrLines =10; | 835 | link->io.IOAddrLines =10; |
| 876 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 836 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
| 877 | link->irq.Attributes = IRQ_HANDLE_PRESENT; | ||
| 878 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 879 | if (local->modem) { | 837 | if (local->modem) { |
| 880 | int pass; | 838 | int pass; |
| 881 | 839 | ||
| @@ -916,10 +874,8 @@ xirc2ps_config(struct pcmcia_device * link) | |||
| 916 | goto port_found; | 874 | goto port_found; |
| 917 | } | 875 | } |
| 918 | link->io.BasePort1 = 0; /* let CS decide */ | 876 | link->io.BasePort1 = 0; /* let CS decide */ |
| 919 | if ((err=pcmcia_request_io(link, &link->io))) { | 877 | if ((err=pcmcia_request_io(link, &link->io))) |
| 920 | cs_error(link, RequestIO, err); | ||
| 921 | goto config_error; | 878 | goto config_error; |
| 922 | } | ||
| 923 | } | 879 | } |
| 924 | port_found: | 880 | port_found: |
| 925 | if (err) | 881 | if (err) |
| @@ -929,19 +885,15 @@ xirc2ps_config(struct pcmcia_device * link) | |||
| 929 | * Now allocate an interrupt line. Note that this does not | 885 | * Now allocate an interrupt line. Note that this does not |
| 930 | * actually assign a handler to the interrupt. | 886 | * actually assign a handler to the interrupt. |
| 931 | */ | 887 | */ |
| 932 | if ((err=pcmcia_request_irq(link, &link->irq))) { | 888 | if ((err=pcmcia_request_irq(link, &link->irq))) |
| 933 | cs_error(link, RequestIRQ, err); | ||
| 934 | goto config_error; | 889 | goto config_error; |
| 935 | } | ||
| 936 | 890 | ||
| 937 | /**************** | 891 | /**************** |
| 938 | * This actually configures the PCMCIA socket -- setting up | 892 | * This actually configures the PCMCIA socket -- setting up |
| 939 | * the I/O windows and the interrupt mapping. | 893 | * the I/O windows and the interrupt mapping. |
| 940 | */ | 894 | */ |
| 941 | if ((err=pcmcia_request_configuration(link, &link->conf))) { | 895 | if ((err=pcmcia_request_configuration(link, &link->conf))) |
| 942 | cs_error(link, RequestConfiguration, err); | ||
| 943 | goto config_error; | 896 | goto config_error; |
| 944 | } | ||
| 945 | 897 | ||
| 946 | if (local->dingo) { | 898 | if (local->dingo) { |
| 947 | conf_reg_t reg; | 899 | conf_reg_t reg; |
| @@ -956,17 +908,13 @@ xirc2ps_config(struct pcmcia_device * link) | |||
| 956 | reg.Action = CS_WRITE; | 908 | reg.Action = CS_WRITE; |
| 957 | reg.Offset = CISREG_IOBASE_0; | 909 | reg.Offset = CISREG_IOBASE_0; |
| 958 | reg.Value = link->io.BasePort2 & 0xff; | 910 | reg.Value = link->io.BasePort2 & 0xff; |
| 959 | if ((err = pcmcia_access_configuration_register(link, ®))) { | 911 | if ((err = pcmcia_access_configuration_register(link, ®))) |
| 960 | cs_error(link, AccessConfigurationRegister, err); | ||
| 961 | goto config_error; | 912 | goto config_error; |
| 962 | } | ||
| 963 | reg.Action = CS_WRITE; | 913 | reg.Action = CS_WRITE; |
| 964 | reg.Offset = CISREG_IOBASE_1; | 914 | reg.Offset = CISREG_IOBASE_1; |
| 965 | reg.Value = (link->io.BasePort2 >> 8) & 0xff; | 915 | reg.Value = (link->io.BasePort2 >> 8) & 0xff; |
| 966 | if ((err = pcmcia_access_configuration_register(link, ®))) { | 916 | if ((err = pcmcia_access_configuration_register(link, ®))) |
| 967 | cs_error(link, AccessConfigurationRegister, err); | ||
| 968 | goto config_error; | 917 | goto config_error; |
| 969 | } | ||
| 970 | 918 | ||
| 971 | /* There is no config entry for the Ethernet part which | 919 | /* There is no config entry for the Ethernet part which |
| 972 | * is at 0x0800. So we allocate a window into the attribute | 920 | * is at 0x0800. So we allocate a window into the attribute |
| @@ -975,17 +923,14 @@ xirc2ps_config(struct pcmcia_device * link) | |||
| 975 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 923 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
| 976 | req.Base = req.Size = 0; | 924 | req.Base = req.Size = 0; |
| 977 | req.AccessSpeed = 0; | 925 | req.AccessSpeed = 0; |
| 978 | if ((err = pcmcia_request_window(&link, &req, &link->win))) { | 926 | if ((err = pcmcia_request_window(link, &req, &link->win))) |
| 979 | cs_error(link, RequestWindow, err); | ||
| 980 | goto config_error; | 927 | goto config_error; |
| 981 | } | 928 | |
| 982 | local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; | 929 | local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; |
| 983 | mem.CardOffset = 0x0; | 930 | mem.CardOffset = 0x0; |
| 984 | mem.Page = 0; | 931 | mem.Page = 0; |
| 985 | if ((err = pcmcia_map_mem_page(link->win, &mem))) { | 932 | if ((err = pcmcia_map_mem_page(link, link->win, &mem))) |
| 986 | cs_error(link, MapMemPage, err); | ||
| 987 | goto config_error; | 933 | goto config_error; |
| 988 | } | ||
| 989 | 934 | ||
| 990 | /* Setup the CCRs; there are no infos in the CIS about the Ethernet | 935 | /* Setup the CCRs; there are no infos in the CIS about the Ethernet |
| 991 | * part. | 936 | * part. |
| @@ -1044,7 +989,7 @@ xirc2ps_config(struct pcmcia_device * link) | |||
| 1044 | do_reset(dev, 1); /* a kludge to make the cem56 work */ | 989 | do_reset(dev, 1); /* a kludge to make the cem56 work */ |
| 1045 | 990 | ||
| 1046 | link->dev_node = &local->node; | 991 | link->dev_node = &local->node; |
| 1047 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 992 | SET_NETDEV_DEV(dev, &link->dev); |
| 1048 | 993 | ||
| 1049 | if ((err=register_netdev(dev))) { | 994 | if ((err=register_netdev(dev))) { |
| 1050 | printk(KNOT_XIRC "register_netdev() failed\n"); | 995 | printk(KNOT_XIRC "register_netdev() failed\n"); |
| @@ -1077,7 +1022,7 @@ xirc2ps_config(struct pcmcia_device * link) | |||
| 1077 | static void | 1022 | static void |
| 1078 | xirc2ps_release(struct pcmcia_device *link) | 1023 | xirc2ps_release(struct pcmcia_device *link) |
| 1079 | { | 1024 | { |
| 1080 | DEBUG(0, "release(0x%p)\n", link); | 1025 | dev_dbg(&link->dev, "release\n"); |
| 1081 | 1026 | ||
| 1082 | if (link->win) { | 1027 | if (link->win) { |
| 1083 | struct net_device *dev = link->priv; | 1028 | struct net_device *dev = link->priv; |
| @@ -1144,7 +1089,7 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
| 1144 | PutByte(XIRCREG_CR, 0); | 1089 | PutByte(XIRCREG_CR, 0); |
| 1145 | } | 1090 | } |
| 1146 | 1091 | ||
| 1147 | DEBUG(6, "%s: interrupt %d at %#x.\n", dev->name, irq, ioaddr); | 1092 | pr_debug("%s: interrupt %d at %#x.\n", dev->name, irq, ioaddr); |
| 1148 | 1093 | ||
| 1149 | saved_page = GetByte(XIRCREG_PR); | 1094 | saved_page = GetByte(XIRCREG_PR); |
| 1150 | /* Read the ISR to see whats the cause for the interrupt. | 1095 | /* Read the ISR to see whats the cause for the interrupt. |
| @@ -1154,7 +1099,7 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
| 1154 | bytes_rcvd = 0; | 1099 | bytes_rcvd = 0; |
| 1155 | loop_entry: | 1100 | loop_entry: |
| 1156 | if (int_status == 0xff) { /* card may be ejected */ | 1101 | if (int_status == 0xff) { /* card may be ejected */ |
| 1157 | DEBUG(3, "%s: interrupt %d for dead card\n", dev->name, irq); | 1102 | pr_debug("%s: interrupt %d for dead card\n", dev->name, irq); |
| 1158 | goto leave; | 1103 | goto leave; |
| 1159 | } | 1104 | } |
| 1160 | eth_status = GetByte(XIRCREG_ESR); | 1105 | eth_status = GetByte(XIRCREG_ESR); |
| @@ -1167,7 +1112,7 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
| 1167 | PutByte(XIRCREG40_TXST0, 0); | 1112 | PutByte(XIRCREG40_TXST0, 0); |
| 1168 | PutByte(XIRCREG40_TXST1, 0); | 1113 | PutByte(XIRCREG40_TXST1, 0); |
| 1169 | 1114 | ||
| 1170 | DEBUG(3, "%s: ISR=%#2.2x ESR=%#2.2x RSR=%#2.2x TSR=%#4.4x\n", | 1115 | pr_debug("%s: ISR=%#2.2x ESR=%#2.2x RSR=%#2.2x TSR=%#4.4x\n", |
| 1171 | dev->name, int_status, eth_status, rx_status, tx_status); | 1116 | dev->name, int_status, eth_status, rx_status, tx_status); |
| 1172 | 1117 | ||
| 1173 | /***** receive section ******/ | 1118 | /***** receive section ******/ |
| @@ -1178,14 +1123,14 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
| 1178 | /* too many bytes received during this int, drop the rest of the | 1123 | /* too many bytes received during this int, drop the rest of the |
| 1179 | * packets */ | 1124 | * packets */ |
| 1180 | dev->stats.rx_dropped++; | 1125 | dev->stats.rx_dropped++; |
| 1181 | DEBUG(2, "%s: RX drop, too much done\n", dev->name); | 1126 | pr_debug("%s: RX drop, too much done\n", dev->name); |
| 1182 | } else if (rsr & PktRxOk) { | 1127 | } else if (rsr & PktRxOk) { |
| 1183 | struct sk_buff *skb; | 1128 | struct sk_buff *skb; |
| 1184 | 1129 | ||
| 1185 | pktlen = GetWord(XIRCREG0_RBC); | 1130 | pktlen = GetWord(XIRCREG0_RBC); |
| 1186 | bytes_rcvd += pktlen; | 1131 | bytes_rcvd += pktlen; |
| 1187 | 1132 | ||
| 1188 | DEBUG(5, "rsr=%#02x packet_length=%u\n", rsr, pktlen); | 1133 | pr_debug("rsr=%#02x packet_length=%u\n", rsr, pktlen); |
| 1189 | 1134 | ||
| 1190 | skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */ | 1135 | skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */ |
| 1191 | if (!skb) { | 1136 | if (!skb) { |
| @@ -1253,19 +1198,19 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
| 1253 | dev->stats.multicast++; | 1198 | dev->stats.multicast++; |
| 1254 | } | 1199 | } |
| 1255 | } else { /* bad packet */ | 1200 | } else { /* bad packet */ |
| 1256 | DEBUG(5, "rsr=%#02x\n", rsr); | 1201 | pr_debug("rsr=%#02x\n", rsr); |
| 1257 | } | 1202 | } |
| 1258 | if (rsr & PktTooLong) { | 1203 | if (rsr & PktTooLong) { |
| 1259 | dev->stats.rx_frame_errors++; | 1204 | dev->stats.rx_frame_errors++; |
| 1260 | DEBUG(3, "%s: Packet too long\n", dev->name); | 1205 | pr_debug("%s: Packet too long\n", dev->name); |
| 1261 | } | 1206 | } |
| 1262 | if (rsr & CRCErr) { | 1207 | if (rsr & CRCErr) { |
| 1263 | dev->stats.rx_crc_errors++; | 1208 | dev->stats.rx_crc_errors++; |
| 1264 | DEBUG(3, "%s: CRC error\n", dev->name); | 1209 | pr_debug("%s: CRC error\n", dev->name); |
| 1265 | } | 1210 | } |
| 1266 | if (rsr & AlignErr) { | 1211 | if (rsr & AlignErr) { |
| 1267 | dev->stats.rx_fifo_errors++; /* okay ? */ | 1212 | dev->stats.rx_fifo_errors++; /* okay ? */ |
| 1268 | DEBUG(3, "%s: Alignment error\n", dev->name); | 1213 | pr_debug("%s: Alignment error\n", dev->name); |
| 1269 | } | 1214 | } |
| 1270 | 1215 | ||
| 1271 | /* clear the received/dropped/error packet */ | 1216 | /* clear the received/dropped/error packet */ |
| @@ -1277,7 +1222,7 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
| 1277 | if (rx_status & 0x10) { /* Receive overrun */ | 1222 | if (rx_status & 0x10) { /* Receive overrun */ |
| 1278 | dev->stats.rx_over_errors++; | 1223 | dev->stats.rx_over_errors++; |
| 1279 | PutByte(XIRCREG_CR, ClearRxOvrun); | 1224 | PutByte(XIRCREG_CR, ClearRxOvrun); |
| 1280 | DEBUG(3, "receive overrun cleared\n"); | 1225 | pr_debug("receive overrun cleared\n"); |
| 1281 | } | 1226 | } |
| 1282 | 1227 | ||
| 1283 | /***** transmit section ******/ | 1228 | /***** transmit section ******/ |
| @@ -1290,13 +1235,13 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
| 1290 | if (nn < n) /* rollover */ | 1235 | if (nn < n) /* rollover */ |
| 1291 | dev->stats.tx_packets += 256 - n; | 1236 | dev->stats.tx_packets += 256 - n; |
| 1292 | else if (n == nn) { /* happens sometimes - don't know why */ | 1237 | else if (n == nn) { /* happens sometimes - don't know why */ |
| 1293 | DEBUG(0, "PTR not changed?\n"); | 1238 | pr_debug("PTR not changed?\n"); |
| 1294 | } else | 1239 | } else |
| 1295 | dev->stats.tx_packets += lp->last_ptr_value - n; | 1240 | dev->stats.tx_packets += lp->last_ptr_value - n; |
| 1296 | netif_wake_queue(dev); | 1241 | netif_wake_queue(dev); |
| 1297 | } | 1242 | } |
| 1298 | if (tx_status & 0x0002) { /* Execessive collissions */ | 1243 | if (tx_status & 0x0002) { /* Execessive collissions */ |
| 1299 | DEBUG(0, "tx restarted due to execssive collissions\n"); | 1244 | pr_debug("tx restarted due to execssive collissions\n"); |
| 1300 | PutByte(XIRCREG_CR, RestartTx); /* restart transmitter process */ | 1245 | PutByte(XIRCREG_CR, RestartTx); /* restart transmitter process */ |
| 1301 | } | 1246 | } |
| 1302 | if (tx_status & 0x0040) | 1247 | if (tx_status & 0x0040) |
| @@ -1315,14 +1260,14 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
| 1315 | maxrx_bytes = 2000; | 1260 | maxrx_bytes = 2000; |
| 1316 | else if (maxrx_bytes > 22000) | 1261 | else if (maxrx_bytes > 22000) |
| 1317 | maxrx_bytes = 22000; | 1262 | maxrx_bytes = 22000; |
| 1318 | DEBUG(1, "set maxrx=%u (rcvd=%u ticks=%lu)\n", | 1263 | pr_debug("set maxrx=%u (rcvd=%u ticks=%lu)\n", |
| 1319 | maxrx_bytes, bytes_rcvd, duration); | 1264 | maxrx_bytes, bytes_rcvd, duration); |
| 1320 | } else if (!duration && maxrx_bytes < 22000) { | 1265 | } else if (!duration && maxrx_bytes < 22000) { |
| 1321 | /* now much faster */ | 1266 | /* now much faster */ |
| 1322 | maxrx_bytes += 2000; | 1267 | maxrx_bytes += 2000; |
| 1323 | if (maxrx_bytes > 22000) | 1268 | if (maxrx_bytes > 22000) |
| 1324 | maxrx_bytes = 22000; | 1269 | maxrx_bytes = 22000; |
| 1325 | DEBUG(1, "set maxrx=%u\n", maxrx_bytes); | 1270 | pr_debug("set maxrx=%u\n", maxrx_bytes); |
| 1326 | } | 1271 | } |
| 1327 | } | 1272 | } |
| 1328 | 1273 | ||
| @@ -1372,7 +1317,7 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1372 | unsigned freespace; | 1317 | unsigned freespace; |
| 1373 | unsigned pktlen = skb->len; | 1318 | unsigned pktlen = skb->len; |
| 1374 | 1319 | ||
| 1375 | DEBUG(1, "do_start_xmit(skb=%p, dev=%p) len=%u\n", | 1320 | pr_debug("do_start_xmit(skb=%p, dev=%p) len=%u\n", |
| 1376 | skb, dev, pktlen); | 1321 | skb, dev, pktlen); |
| 1377 | 1322 | ||
| 1378 | 1323 | ||
| @@ -1398,7 +1343,7 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1398 | freespace &= 0x7fff; | 1343 | freespace &= 0x7fff; |
| 1399 | /* TRS doesn't work - (indeed it is eliminated with sil-rev 1) */ | 1344 | /* TRS doesn't work - (indeed it is eliminated with sil-rev 1) */ |
| 1400 | okay = pktlen +2 < freespace; | 1345 | okay = pktlen +2 < freespace; |
| 1401 | DEBUG(2 + (okay ? 2 : 0), "%s: avail. tx space=%u%s\n", | 1346 | pr_debug("%s: avail. tx space=%u%s\n", |
| 1402 | dev->name, freespace, okay ? " (okay)":" (not enough)"); | 1347 | dev->name, freespace, okay ? " (okay)":" (not enough)"); |
| 1403 | if (!okay) { /* not enough space */ | 1348 | if (!okay) { /* not enough space */ |
| 1404 | return NETDEV_TX_BUSY; /* upper layer may decide to requeue this packet */ | 1349 | return NETDEV_TX_BUSY; /* upper layer may decide to requeue this packet */ |
| @@ -1500,7 +1445,7 @@ do_config(struct net_device *dev, struct ifmap *map) | |||
| 1500 | { | 1445 | { |
| 1501 | local_info_t *local = netdev_priv(dev); | 1446 | local_info_t *local = netdev_priv(dev); |
| 1502 | 1447 | ||
| 1503 | DEBUG(0, "do_config(%p)\n", dev); | 1448 | pr_debug("do_config(%p)\n", dev); |
| 1504 | if (map->port != 255 && map->port != dev->if_port) { | 1449 | if (map->port != 255 && map->port != dev->if_port) { |
| 1505 | if (map->port > 4) | 1450 | if (map->port > 4) |
| 1506 | return -EINVAL; | 1451 | return -EINVAL; |
| @@ -1527,7 +1472,7 @@ do_open(struct net_device *dev) | |||
| 1527 | local_info_t *lp = netdev_priv(dev); | 1472 | local_info_t *lp = netdev_priv(dev); |
| 1528 | struct pcmcia_device *link = lp->p_dev; | 1473 | struct pcmcia_device *link = lp->p_dev; |
| 1529 | 1474 | ||
| 1530 | DEBUG(0, "do_open(%p)\n", dev); | 1475 | dev_dbg(&link->dev, "do_open(%p)\n", dev); |
| 1531 | 1476 | ||
| 1532 | /* Check that the PCMCIA card is still here. */ | 1477 | /* Check that the PCMCIA card is still here. */ |
| 1533 | /* Physical device present signature. */ | 1478 | /* Physical device present signature. */ |
| @@ -1561,7 +1506,7 @@ do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
| 1561 | unsigned int ioaddr = dev->base_addr; | 1506 | unsigned int ioaddr = dev->base_addr; |
| 1562 | struct mii_ioctl_data *data = if_mii(rq); | 1507 | struct mii_ioctl_data *data = if_mii(rq); |
| 1563 | 1508 | ||
| 1564 | DEBUG(1, "%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n", | 1509 | pr_debug("%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n", |
| 1565 | dev->name, rq->ifr_ifrn.ifrn_name, cmd, | 1510 | dev->name, rq->ifr_ifrn.ifrn_name, cmd, |
| 1566 | data->phy_id, data->reg_num, data->val_in, data->val_out); | 1511 | data->phy_id, data->reg_num, data->val_in, data->val_out); |
| 1567 | 1512 | ||
| @@ -1610,7 +1555,7 @@ do_reset(struct net_device *dev, int full) | |||
| 1610 | unsigned int ioaddr = dev->base_addr; | 1555 | unsigned int ioaddr = dev->base_addr; |
| 1611 | unsigned value; | 1556 | unsigned value; |
| 1612 | 1557 | ||
| 1613 | DEBUG(0, "%s: do_reset(%p,%d)\n", dev? dev->name:"eth?", dev, full); | 1558 | pr_debug("%s: do_reset(%p,%d)\n", dev? dev->name:"eth?", dev, full); |
| 1614 | 1559 | ||
| 1615 | hardreset(dev); | 1560 | hardreset(dev); |
| 1616 | PutByte(XIRCREG_CR, SoftReset); /* set */ | 1561 | PutByte(XIRCREG_CR, SoftReset); /* set */ |
| @@ -1648,8 +1593,8 @@ do_reset(struct net_device *dev, int full) | |||
| 1648 | } | 1593 | } |
| 1649 | msleep(40); /* wait 40 msec to let it complete */ | 1594 | msleep(40); /* wait 40 msec to let it complete */ |
| 1650 | 1595 | ||
| 1651 | #ifdef PCMCIA_DEBUG | 1596 | #if 0 |
| 1652 | if (pc_debug) { | 1597 | { |
| 1653 | SelectPage(0); | 1598 | SelectPage(0); |
| 1654 | value = GetByte(XIRCREG_ESR); /* read the ESR */ | 1599 | value = GetByte(XIRCREG_ESR); /* read the ESR */ |
| 1655 | printk(KERN_DEBUG "%s: ESR is: %#02x\n", dev->name, value); | 1600 | printk(KERN_DEBUG "%s: ESR is: %#02x\n", dev->name, value); |
| @@ -1666,7 +1611,7 @@ do_reset(struct net_device *dev, int full) | |||
| 1666 | value |= DisableLinkPulse; | 1611 | value |= DisableLinkPulse; |
| 1667 | PutByte(XIRCREG1_ECR, value); | 1612 | PutByte(XIRCREG1_ECR, value); |
| 1668 | #endif | 1613 | #endif |
| 1669 | DEBUG(0, "%s: ECR is: %#02x\n", dev->name, value); | 1614 | pr_debug("%s: ECR is: %#02x\n", dev->name, value); |
| 1670 | 1615 | ||
| 1671 | SelectPage(0x42); | 1616 | SelectPage(0x42); |
| 1672 | PutByte(XIRCREG42_SWC0, 0x20); /* disable source insertion */ | 1617 | PutByte(XIRCREG42_SWC0, 0x20); /* disable source insertion */ |
| @@ -1844,7 +1789,7 @@ do_powerdown(struct net_device *dev) | |||
| 1844 | 1789 | ||
| 1845 | unsigned int ioaddr = dev->base_addr; | 1790 | unsigned int ioaddr = dev->base_addr; |
| 1846 | 1791 | ||
| 1847 | DEBUG(0, "do_powerdown(%p)\n", dev); | 1792 | pr_debug("do_powerdown(%p)\n", dev); |
| 1848 | 1793 | ||
| 1849 | SelectPage(4); | 1794 | SelectPage(4); |
| 1850 | PutByte(XIRCREG4_GPR1, 0); /* clear bit 0: power down */ | 1795 | PutByte(XIRCREG4_GPR1, 0); /* clear bit 0: power down */ |
| @@ -1858,7 +1803,7 @@ do_stop(struct net_device *dev) | |||
| 1858 | local_info_t *lp = netdev_priv(dev); | 1803 | local_info_t *lp = netdev_priv(dev); |
| 1859 | struct pcmcia_device *link = lp->p_dev; | 1804 | struct pcmcia_device *link = lp->p_dev; |
| 1860 | 1805 | ||
| 1861 | DEBUG(0, "do_stop(%p)\n", dev); | 1806 | dev_dbg(&link->dev, "do_stop(%p)\n", dev); |
| 1862 | 1807 | ||
| 1863 | if (!link) | 1808 | if (!link) |
| 1864 | return -ENODEV; | 1809 | return -ENODEV; |
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c index 8659d341e769..35897134a5dd 100644 --- a/drivers/net/phy/mdio-gpio.c +++ b/drivers/net/phy/mdio-gpio.c | |||
| @@ -139,7 +139,7 @@ out: | |||
| 139 | return NULL; | 139 | return NULL; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | static void __devinit mdio_gpio_bus_deinit(struct device *dev) | 142 | static void mdio_gpio_bus_deinit(struct device *dev) |
| 143 | { | 143 | { |
| 144 | struct mii_bus *bus = dev_get_drvdata(dev); | 144 | struct mii_bus *bus = dev_get_drvdata(dev); |
| 145 | struct mdio_gpio_info *bitbang = bus->priv; | 145 | struct mdio_gpio_info *bitbang = bus->priv; |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 9bf2a6be9031..965adb6174c3 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
| @@ -1944,8 +1944,15 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | |||
| 1944 | } | 1944 | } |
| 1945 | 1945 | ||
| 1946 | /* Pull completed packets off the queue and receive them. */ | 1946 | /* Pull completed packets off the queue and receive them. */ |
| 1947 | while ((skb = ppp_mp_reconstruct(ppp))) | 1947 | while ((skb = ppp_mp_reconstruct(ppp))) { |
| 1948 | ppp_receive_nonmp_frame(ppp, skb); | 1948 | if (pskb_may_pull(skb, 2)) |
| 1949 | ppp_receive_nonmp_frame(ppp, skb); | ||
| 1950 | else { | ||
| 1951 | ++ppp->dev->stats.rx_length_errors; | ||
| 1952 | kfree_skb(skb); | ||
| 1953 | ppp_receive_error(ppp); | ||
| 1954 | } | ||
| 1955 | } | ||
| 1949 | 1956 | ||
| 1950 | return; | 1957 | return; |
| 1951 | 1958 | ||
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index cea7531f4f40..a2fc70a0d0cc 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
| @@ -3916,6 +3916,8 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
| 3916 | goto err_out; | 3916 | goto err_out; |
| 3917 | } | 3917 | } |
| 3918 | 3918 | ||
| 3919 | /* Set PCIe reset type for EEH to fundamental. */ | ||
| 3920 | pdev->needs_freset = 1; | ||
| 3919 | pci_save_state(pdev); | 3921 | pci_save_state(pdev); |
| 3920 | qdev->reg_base = | 3922 | qdev->reg_base = |
| 3921 | ioremap_nocache(pci_resource_start(pdev, 1), | 3923 | ioremap_nocache(pci_resource_start(pdev, 1), |
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index bcf13c96f73f..aec05f266107 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
| @@ -499,7 +499,7 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
| 499 | /* Wait for the interrupt to come in. */ | 499 | /* Wait for the interrupt to come in. */ |
| 500 | status = ql_wait_mbx_cmd_cmplt(qdev); | 500 | status = ql_wait_mbx_cmd_cmplt(qdev); |
| 501 | if (status) | 501 | if (status) |
| 502 | goto end; | 502 | continue; |
| 503 | 503 | ||
| 504 | /* Process the event. If it's an AEN, it | 504 | /* Process the event. If it's an AEN, it |
| 505 | * will be handled in-line or a worker | 505 | * will be handled in-line or a worker |
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index 7dfcb58b0eb4..8b14c6eda7c3 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
| @@ -1085,7 +1085,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, | |||
| 1085 | int bar = 0; | 1085 | int bar = 0; |
| 1086 | u16 *adrp; | 1086 | u16 *adrp; |
| 1087 | 1087 | ||
| 1088 | printk(KERN_INFO "%s\n", version); | 1088 | printk("%s\n", version); |
| 1089 | 1089 | ||
| 1090 | err = pci_enable_device(pdev); | 1090 | err = pci_enable_device(pdev); |
| 1091 | if (err) | 1091 | if (err) |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index fa4935678488..0fe2fc90f207 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
| @@ -3235,6 +3235,10 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev) | |||
| 3235 | flush_scheduled_work(); | 3235 | flush_scheduled_work(); |
| 3236 | 3236 | ||
| 3237 | unregister_netdev(dev); | 3237 | unregister_netdev(dev); |
| 3238 | |||
| 3239 | /* restore original MAC address */ | ||
| 3240 | rtl_rar_set(tp, dev->perm_addr); | ||
| 3241 | |||
| 3238 | rtl_disable_msi(pdev, tp); | 3242 | rtl_disable_msi(pdev, tp); |
| 3239 | rtl8169_release_board(pdev, dev, tp->mmio_addr); | 3243 | rtl8169_release_board(pdev, dev, tp->mmio_addr); |
| 3240 | pci_set_drvdata(pdev, NULL); | 3244 | pci_set_drvdata(pdev, NULL); |
| @@ -3243,9 +3247,9 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev) | |||
| 3243 | static void rtl8169_set_rxbufsize(struct rtl8169_private *tp, | 3247 | static void rtl8169_set_rxbufsize(struct rtl8169_private *tp, |
| 3244 | struct net_device *dev) | 3248 | struct net_device *dev) |
| 3245 | { | 3249 | { |
| 3246 | unsigned int mtu = dev->mtu; | 3250 | unsigned int max_frame = dev->mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; |
| 3247 | 3251 | ||
| 3248 | tp->rx_buf_sz = (mtu > RX_BUF_SIZE) ? mtu + ETH_HLEN + 8 : RX_BUF_SIZE; | 3252 | tp->rx_buf_sz = (max_frame > RX_BUF_SIZE) ? max_frame : RX_BUF_SIZE; |
| 3249 | } | 3253 | } |
| 3250 | 3254 | ||
| 3251 | static int rtl8169_open(struct net_device *dev) | 3255 | static int rtl8169_open(struct net_device *dev) |
| @@ -4881,6 +4885,9 @@ static void rtl_shutdown(struct pci_dev *pdev) | |||
| 4881 | 4885 | ||
| 4882 | rtl8169_net_suspend(dev); | 4886 | rtl8169_net_suspend(dev); |
| 4883 | 4887 | ||
| 4888 | /* restore original MAC address */ | ||
| 4889 | rtl_rar_set(tp, dev->perm_addr); | ||
| 4890 | |||
| 4884 | spin_lock_irq(&tp->lock); | 4891 | spin_lock_irq(&tp->lock); |
| 4885 | 4892 | ||
| 4886 | rtl8169_asic_down(ioaddr); | 4893 | rtl8169_asic_down(ioaddr); |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index ddccf5fa56b6..0dd7839322bc 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
| @@ -3494,6 +3494,7 @@ static void s2io_reset(struct s2io_nic *sp) | |||
| 3494 | 3494 | ||
| 3495 | /* Restore the PCI state saved during initialization. */ | 3495 | /* Restore the PCI state saved during initialization. */ |
| 3496 | pci_restore_state(sp->pdev); | 3496 | pci_restore_state(sp->pdev); |
| 3497 | pci_save_state(sp->pdev); | ||
| 3497 | pci_read_config_word(sp->pdev, 0x2, &val16); | 3498 | pci_read_config_word(sp->pdev, 0x2, &val16); |
| 3498 | if (check_pci_device_id(val16) != (u16)PCI_ANY_ID) | 3499 | if (check_pci_device_id(val16) != (u16)PCI_ANY_ID) |
| 3499 | break; | 3500 | break; |
diff --git a/drivers/net/sfc/sfe4001.c b/drivers/net/sfc/sfe4001.c index cee00ad49b57..49eb91b5f50c 100644 --- a/drivers/net/sfc/sfe4001.c +++ b/drivers/net/sfc/sfe4001.c | |||
| @@ -188,7 +188,7 @@ static int sfn4111t_reset(struct efx_nic *efx) | |||
| 188 | efx_oword_t reg; | 188 | efx_oword_t reg; |
| 189 | 189 | ||
| 190 | /* GPIO 3 and the GPIO register are shared with I2C, so block that */ | 190 | /* GPIO 3 and the GPIO register are shared with I2C, so block that */ |
| 191 | mutex_lock(&efx->i2c_adap.bus_lock); | 191 | i2c_lock_adapter(&efx->i2c_adap); |
| 192 | 192 | ||
| 193 | /* Pull RST_N (GPIO 2) low then let it up again, setting the | 193 | /* Pull RST_N (GPIO 2) low then let it up again, setting the |
| 194 | * FLASH_CFG_1 strap (GPIO 3) appropriately. Only change the | 194 | * FLASH_CFG_1 strap (GPIO 3) appropriately. Only change the |
| @@ -204,7 +204,7 @@ static int sfn4111t_reset(struct efx_nic *efx) | |||
| 204 | falcon_write(efx, ®, GPIO_CTL_REG_KER); | 204 | falcon_write(efx, ®, GPIO_CTL_REG_KER); |
| 205 | msleep(1); | 205 | msleep(1); |
| 206 | 206 | ||
| 207 | mutex_unlock(&efx->i2c_adap.bus_lock); | 207 | i2c_unlock_adapter(&efx->i2c_adap); |
| 208 | 208 | ||
| 209 | ssleep(1); | 209 | ssleep(1); |
| 210 | return 0; | 210 | return 0; |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 05c91ee6921e..f12206bdbb75 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
| @@ -2283,7 +2283,7 @@ static int __devinit smc_drv_probe(struct platform_device *pdev) | |||
| 2283 | 2283 | ||
| 2284 | ndev->irq = ires->start; | 2284 | ndev->irq = ires->start; |
| 2285 | 2285 | ||
| 2286 | if (ires->flags & IRQF_TRIGGER_MASK) | 2286 | if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK) |
| 2287 | irq_flags = ires->flags & IRQF_TRIGGER_MASK; | 2287 | irq_flags = ires->flags & IRQF_TRIGGER_MASK; |
| 2288 | 2288 | ||
| 2289 | ret = smc_request_attrib(pdev, ndev); | 2289 | ret = smc_request_attrib(pdev, ndev); |
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index ccdd196f5297..f9cdcbcb77d4 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
| @@ -986,7 +986,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget) | |||
| 986 | struct net_device *dev = pdata->dev; | 986 | struct net_device *dev = pdata->dev; |
| 987 | int npackets = 0; | 987 | int npackets = 0; |
| 988 | 988 | ||
| 989 | while (likely(netif_running(dev)) && (npackets < budget)) { | 989 | while (npackets < budget) { |
| 990 | unsigned int pktlength; | 990 | unsigned int pktlength; |
| 991 | unsigned int pktwords; | 991 | unsigned int pktwords; |
| 992 | struct sk_buff *skb; | 992 | struct sk_buff *skb; |
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c index b4909a2dec66..0f7909276237 100644 --- a/drivers/net/smsc9420.c +++ b/drivers/net/smsc9420.c | |||
| @@ -252,6 +252,9 @@ static int smsc9420_ethtool_get_settings(struct net_device *dev, | |||
| 252 | { | 252 | { |
| 253 | struct smsc9420_pdata *pd = netdev_priv(dev); | 253 | struct smsc9420_pdata *pd = netdev_priv(dev); |
| 254 | 254 | ||
| 255 | if (!pd->phy_dev) | ||
| 256 | return -ENODEV; | ||
| 257 | |||
| 255 | cmd->maxtxpkt = 1; | 258 | cmd->maxtxpkt = 1; |
| 256 | cmd->maxrxpkt = 1; | 259 | cmd->maxrxpkt = 1; |
| 257 | return phy_ethtool_gset(pd->phy_dev, cmd); | 260 | return phy_ethtool_gset(pd->phy_dev, cmd); |
| @@ -262,6 +265,9 @@ static int smsc9420_ethtool_set_settings(struct net_device *dev, | |||
| 262 | { | 265 | { |
| 263 | struct smsc9420_pdata *pd = netdev_priv(dev); | 266 | struct smsc9420_pdata *pd = netdev_priv(dev); |
| 264 | 267 | ||
| 268 | if (!pd->phy_dev) | ||
| 269 | return -ENODEV; | ||
| 270 | |||
| 265 | return phy_ethtool_sset(pd->phy_dev, cmd); | 271 | return phy_ethtool_sset(pd->phy_dev, cmd); |
| 266 | } | 272 | } |
| 267 | 273 | ||
| @@ -290,6 +296,10 @@ static void smsc9420_ethtool_set_msglevel(struct net_device *netdev, u32 data) | |||
| 290 | static int smsc9420_ethtool_nway_reset(struct net_device *netdev) | 296 | static int smsc9420_ethtool_nway_reset(struct net_device *netdev) |
| 291 | { | 297 | { |
| 292 | struct smsc9420_pdata *pd = netdev_priv(netdev); | 298 | struct smsc9420_pdata *pd = netdev_priv(netdev); |
| 299 | |||
| 300 | if (!pd->phy_dev) | ||
| 301 | return -ENODEV; | ||
| 302 | |||
| 293 | return phy_start_aneg(pd->phy_dev); | 303 | return phy_start_aneg(pd->phy_dev); |
| 294 | } | 304 | } |
| 295 | 305 | ||
| @@ -312,6 +322,10 @@ smsc9420_ethtool_getregs(struct net_device *dev, struct ethtool_regs *regs, | |||
| 312 | for (i = 0; i < 0x100; i += (sizeof(u32))) | 322 | for (i = 0; i < 0x100; i += (sizeof(u32))) |
| 313 | data[j++] = smsc9420_reg_read(pd, i); | 323 | data[j++] = smsc9420_reg_read(pd, i); |
| 314 | 324 | ||
| 325 | // cannot read phy registers if the net device is down | ||
| 326 | if (!phy_dev) | ||
| 327 | return; | ||
| 328 | |||
| 315 | for (i = 0; i <= 31; i++) | 329 | for (i = 0; i <= 31; i++) |
| 316 | data[j++] = smsc9420_mii_read(phy_dev->bus, phy_dev->addr, i); | 330 | data[j++] = smsc9420_mii_read(phy_dev->bus, phy_dev->addr, i); |
| 317 | } | 331 | } |
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c index c2f14dc9ba28..9542995ba667 100644 --- a/drivers/net/stmmac/stmmac_main.c +++ b/drivers/net/stmmac/stmmac_main.c | |||
| @@ -416,13 +416,8 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
| 416 | unsigned int txsize = priv->dma_tx_size; | 416 | unsigned int txsize = priv->dma_tx_size; |
| 417 | unsigned int rxsize = priv->dma_rx_size; | 417 | unsigned int rxsize = priv->dma_rx_size; |
| 418 | unsigned int bfsize = priv->dma_buf_sz; | 418 | unsigned int bfsize = priv->dma_buf_sz; |
| 419 | int buff2_needed = 0; | 419 | int buff2_needed = 0, dis_ic = 0; |
| 420 | int dis_ic = 0; | ||
| 421 | 420 | ||
| 422 | #ifdef CONFIG_STMMAC_TIMER | ||
| 423 | /* Using Timers disable interrupts on completion for the reception */ | ||
| 424 | dis_ic = 1; | ||
| 425 | #endif | ||
| 426 | /* Set the Buffer size according to the MTU; | 421 | /* Set the Buffer size according to the MTU; |
| 427 | * indeed, in case of jumbo we need to bump-up the buffer sizes. | 422 | * indeed, in case of jumbo we need to bump-up the buffer sizes. |
| 428 | */ | 423 | */ |
| @@ -437,6 +432,11 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
| 437 | else | 432 | else |
| 438 | bfsize = DMA_BUFFER_SIZE; | 433 | bfsize = DMA_BUFFER_SIZE; |
| 439 | 434 | ||
| 435 | #ifdef CONFIG_STMMAC_TIMER | ||
| 436 | /* Disable interrupts on completion for the reception if timer is on */ | ||
| 437 | if (likely(priv->tm->enable)) | ||
| 438 | dis_ic = 1; | ||
| 439 | #endif | ||
| 440 | /* If the MTU exceeds 8k so use the second buffer in the chain */ | 440 | /* If the MTU exceeds 8k so use the second buffer in the chain */ |
| 441 | if (bfsize >= BUF_SIZE_8KiB) | 441 | if (bfsize >= BUF_SIZE_8KiB) |
| 442 | buff2_needed = 1; | 442 | buff2_needed = 1; |
| @@ -809,20 +809,22 @@ static void stmmac_tx(struct stmmac_priv *priv) | |||
| 809 | 809 | ||
| 810 | static inline void stmmac_enable_irq(struct stmmac_priv *priv) | 810 | static inline void stmmac_enable_irq(struct stmmac_priv *priv) |
| 811 | { | 811 | { |
| 812 | #ifndef CONFIG_STMMAC_TIMER | 812 | #ifdef CONFIG_STMMAC_TIMER |
| 813 | writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA); | 813 | if (likely(priv->tm->enable)) |
| 814 | #else | 814 | priv->tm->timer_start(tmrate); |
| 815 | priv->tm->timer_start(tmrate); | 815 | else |
| 816 | #endif | 816 | #endif |
| 817 | writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA); | ||
| 817 | } | 818 | } |
| 818 | 819 | ||
| 819 | static inline void stmmac_disable_irq(struct stmmac_priv *priv) | 820 | static inline void stmmac_disable_irq(struct stmmac_priv *priv) |
| 820 | { | 821 | { |
| 821 | #ifndef CONFIG_STMMAC_TIMER | 822 | #ifdef CONFIG_STMMAC_TIMER |
| 822 | writel(0, priv->dev->base_addr + DMA_INTR_ENA); | 823 | if (likely(priv->tm->enable)) |
| 823 | #else | 824 | priv->tm->timer_stop(); |
| 824 | priv->tm->timer_stop(); | 825 | else |
| 825 | #endif | 826 | #endif |
| 827 | writel(0, priv->dev->base_addr + DMA_INTR_ENA); | ||
| 826 | } | 828 | } |
| 827 | 829 | ||
| 828 | static int stmmac_has_work(struct stmmac_priv *priv) | 830 | static int stmmac_has_work(struct stmmac_priv *priv) |
| @@ -1031,22 +1033,23 @@ static int stmmac_open(struct net_device *dev) | |||
| 1031 | } | 1033 | } |
| 1032 | 1034 | ||
| 1033 | #ifdef CONFIG_STMMAC_TIMER | 1035 | #ifdef CONFIG_STMMAC_TIMER |
| 1034 | priv->tm = kmalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); | 1036 | priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); |
| 1035 | if (unlikely(priv->tm == NULL)) { | 1037 | if (unlikely(priv->tm == NULL)) { |
| 1036 | pr_err("%s: ERROR: timer memory alloc failed \n", __func__); | 1038 | pr_err("%s: ERROR: timer memory alloc failed \n", __func__); |
| 1037 | return -ENOMEM; | 1039 | return -ENOMEM; |
| 1038 | } | 1040 | } |
| 1039 | priv->tm->freq = tmrate; | 1041 | priv->tm->freq = tmrate; |
| 1040 | 1042 | ||
| 1041 | /* Test if the HW timer can be actually used. | 1043 | /* Test if the external timer can be actually used. |
| 1042 | * In case of failure continue with no timer. */ | 1044 | * In case of failure continue without timer. */ |
| 1043 | if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) { | 1045 | if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) { |
| 1044 | pr_warning("stmmaceth: cannot attach the HW timer\n"); | 1046 | pr_warning("stmmaceth: cannot attach the external timer.\n"); |
| 1045 | tmrate = 0; | 1047 | tmrate = 0; |
| 1046 | priv->tm->freq = 0; | 1048 | priv->tm->freq = 0; |
| 1047 | priv->tm->timer_start = stmmac_no_timer_started; | 1049 | priv->tm->timer_start = stmmac_no_timer_started; |
| 1048 | priv->tm->timer_stop = stmmac_no_timer_stopped; | 1050 | priv->tm->timer_stop = stmmac_no_timer_stopped; |
| 1049 | } | 1051 | } else |
| 1052 | priv->tm->enable = 1; | ||
| 1050 | #endif | 1053 | #endif |
| 1051 | 1054 | ||
| 1052 | /* Create and initialize the TX/RX descriptors chains. */ | 1055 | /* Create and initialize the TX/RX descriptors chains. */ |
| @@ -1322,9 +1325,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1322 | 1325 | ||
| 1323 | /* Interrupt on completition only for the latest segment */ | 1326 | /* Interrupt on completition only for the latest segment */ |
| 1324 | priv->mac_type->ops->close_tx_desc(desc); | 1327 | priv->mac_type->ops->close_tx_desc(desc); |
| 1328 | |||
| 1325 | #ifdef CONFIG_STMMAC_TIMER | 1329 | #ifdef CONFIG_STMMAC_TIMER |
| 1326 | /* Clean IC while using timers */ | 1330 | /* Clean IC while using timer */ |
| 1327 | priv->mac_type->ops->clear_tx_ic(desc); | 1331 | if (likely(priv->tm->enable)) |
| 1332 | priv->mac_type->ops->clear_tx_ic(desc); | ||
| 1328 | #endif | 1333 | #endif |
| 1329 | /* To avoid raise condition */ | 1334 | /* To avoid raise condition */ |
| 1330 | priv->mac_type->ops->set_tx_owner(first); | 1335 | priv->mac_type->ops->set_tx_owner(first); |
| @@ -2028,7 +2033,8 @@ static int stmmac_suspend(struct platform_device *pdev, pm_message_t state) | |||
| 2028 | 2033 | ||
| 2029 | #ifdef CONFIG_STMMAC_TIMER | 2034 | #ifdef CONFIG_STMMAC_TIMER |
| 2030 | priv->tm->timer_stop(); | 2035 | priv->tm->timer_stop(); |
| 2031 | dis_ic = 1; | 2036 | if (likely(priv->tm->enable)) |
| 2037 | dis_ic = 1; | ||
| 2032 | #endif | 2038 | #endif |
| 2033 | napi_disable(&priv->napi); | 2039 | napi_disable(&priv->napi); |
| 2034 | 2040 | ||
diff --git a/drivers/net/stmmac/stmmac_timer.c b/drivers/net/stmmac/stmmac_timer.c index b838c6582077..679f61ffb1f8 100644 --- a/drivers/net/stmmac/stmmac_timer.c +++ b/drivers/net/stmmac/stmmac_timer.c | |||
| @@ -63,7 +63,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | |||
| 63 | 63 | ||
| 64 | stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); | 64 | stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); |
| 65 | if (stmmac_rtc == NULL) { | 65 | if (stmmac_rtc == NULL) { |
| 66 | pr_error("open rtc device failed\n"); | 66 | pr_err("open rtc device failed\n"); |
| 67 | return -ENODEV; | 67 | return -ENODEV; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| @@ -71,7 +71,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | |||
| 71 | 71 | ||
| 72 | /* Periodic mode is not supported */ | 72 | /* Periodic mode is not supported */ |
| 73 | if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) { | 73 | if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) { |
| 74 | pr_error("set periodic failed\n"); | 74 | pr_err("set periodic failed\n"); |
| 75 | rtc_irq_unregister(stmmac_rtc, &stmmac_task); | 75 | rtc_irq_unregister(stmmac_rtc, &stmmac_task); |
| 76 | rtc_class_close(stmmac_rtc); | 76 | rtc_class_close(stmmac_rtc); |
| 77 | return -1; | 77 | return -1; |
diff --git a/drivers/net/stmmac/stmmac_timer.h b/drivers/net/stmmac/stmmac_timer.h index f795cae33725..6863590d184b 100644 --- a/drivers/net/stmmac/stmmac_timer.h +++ b/drivers/net/stmmac/stmmac_timer.h | |||
| @@ -26,6 +26,7 @@ struct stmmac_timer { | |||
| 26 | void (*timer_start) (unsigned int new_freq); | 26 | void (*timer_start) (unsigned int new_freq); |
| 27 | void (*timer_stop) (void); | 27 | void (*timer_stop) (void); |
| 28 | unsigned int freq; | 28 | unsigned int freq; |
| 29 | unsigned int enable; | ||
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | /* Open the HW timer device and return 0 in case of success */ | 32 | /* Open the HW timer device and return 0 in case of success */ |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 7019a0d1a82b..61640b99b705 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
| @@ -2063,7 +2063,15 @@ static int gem_check_invariants(struct gem *gp) | |||
| 2063 | mif_cfg &= ~MIF_CFG_PSELECT; | 2063 | mif_cfg &= ~MIF_CFG_PSELECT; |
| 2064 | writel(mif_cfg, gp->regs + MIF_CFG); | 2064 | writel(mif_cfg, gp->regs + MIF_CFG); |
| 2065 | } else { | 2065 | } else { |
| 2066 | gp->phy_type = phy_serialink; | 2066 | #ifdef CONFIG_SPARC |
| 2067 | const char *p; | ||
| 2068 | |||
| 2069 | p = of_get_property(gp->of_node, "shared-pins", NULL); | ||
| 2070 | if (p && !strcmp(p, "serdes")) | ||
| 2071 | gp->phy_type = phy_serdes; | ||
| 2072 | else | ||
| 2073 | #endif | ||
| 2074 | gp->phy_type = phy_serialink; | ||
| 2067 | } | 2075 | } |
| 2068 | if (gp->phy_type == phy_mii_mdio1 || | 2076 | if (gp->phy_type == phy_mii_mdio1 || |
| 2069 | gp->phy_type == phy_mii_mdio0) { | 2077 | gp->phy_type == phy_mii_mdio0) { |
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index c47237c2d638..32d93564a74d 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
| @@ -174,7 +174,7 @@ config USB_NET_CDCETHER | |||
| 174 | * Ericsson Mobile Broadband Module (all variants) | 174 | * Ericsson Mobile Broadband Module (all variants) |
| 175 | * Motorola (DM100 and SB4100) | 175 | * Motorola (DM100 and SB4100) |
| 176 | * Broadcom Cable Modem (reference design) | 176 | * Broadcom Cable Modem (reference design) |
| 177 | * Toshiba (PCX1100U and F3507g) | 177 | * Toshiba (PCX1100U and F3507g/F3607gw) |
| 178 | * ... | 178 | * ... |
| 179 | 179 | ||
| 180 | This driver creates an interface named "ethX", where X depends on | 180 | This driver creates an interface named "ethX", where X depends on |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 4a6aff579403..21e1ba160008 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
| @@ -544,20 +544,60 @@ static const struct usb_device_id products [] = { | |||
| 544 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | 544 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), |
| 545 | .driver_info = (unsigned long) &cdc_info, | 545 | .driver_info = (unsigned long) &cdc_info, |
| 546 | }, { | 546 | }, { |
| 547 | /* Ericsson F3307 */ | 547 | /* Ericsson F3607gw ver 2 */ |
| 548 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1905, USB_CLASS_COMM, | ||
| 549 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
| 550 | .driver_info = (unsigned long) &cdc_info, | ||
| 551 | }, { | ||
| 552 | /* Ericsson F3607gw ver 3 */ | ||
| 548 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM, | 553 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM, |
| 549 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | 554 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), |
| 550 | .driver_info = (unsigned long) &cdc_info, | 555 | .driver_info = (unsigned long) &cdc_info, |
| 551 | }, { | 556 | }, { |
| 557 | /* Ericsson F3307 */ | ||
| 558 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190a, USB_CLASS_COMM, | ||
| 559 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
| 560 | .driver_info = (unsigned long) &cdc_info, | ||
| 561 | }, { | ||
| 562 | /* Ericsson F3307 ver 2 */ | ||
| 563 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1909, USB_CLASS_COMM, | ||
| 564 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
| 565 | .driver_info = (unsigned long) &cdc_info, | ||
| 566 | }, { | ||
| 567 | /* Ericsson C3607w */ | ||
| 568 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1049, USB_CLASS_COMM, | ||
| 569 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
| 570 | .driver_info = (unsigned long) &cdc_info, | ||
| 571 | }, { | ||
| 552 | /* Toshiba F3507g */ | 572 | /* Toshiba F3507g */ |
| 553 | USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM, | 573 | USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM, |
| 554 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | 574 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), |
| 555 | .driver_info = (unsigned long) &cdc_info, | 575 | .driver_info = (unsigned long) &cdc_info, |
| 556 | }, { | 576 | }, { |
| 577 | /* Toshiba F3607gw */ | ||
| 578 | USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130c, USB_CLASS_COMM, | ||
| 579 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
| 580 | .driver_info = (unsigned long) &cdc_info, | ||
| 581 | }, { | ||
| 582 | /* Toshiba F3607gw ver 2 */ | ||
| 583 | USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x1311, USB_CLASS_COMM, | ||
| 584 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
| 585 | .driver_info = (unsigned long) &cdc_info, | ||
| 586 | }, { | ||
| 557 | /* Dell F3507g */ | 587 | /* Dell F3507g */ |
| 558 | USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8147, USB_CLASS_COMM, | 588 | USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8147, USB_CLASS_COMM, |
| 559 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | 589 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), |
| 560 | .driver_info = (unsigned long) &cdc_info, | 590 | .driver_info = (unsigned long) &cdc_info, |
| 591 | }, { | ||
| 592 | /* Dell F3607gw */ | ||
| 593 | USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8183, USB_CLASS_COMM, | ||
| 594 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
| 595 | .driver_info = (unsigned long) &cdc_info, | ||
| 596 | }, { | ||
| 597 | /* Dell F3607gw ver 2 */ | ||
| 598 | USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8184, USB_CLASS_COMM, | ||
| 599 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
| 600 | .driver_info = (unsigned long) &cdc_info, | ||
| 561 | }, | 601 | }, |
| 562 | { }, // END | 602 | { }, // END |
| 563 | }; | 603 | }; |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index fa4e58196c21..43bc3fcc0d85 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
| @@ -378,7 +378,7 @@ static void dbg_dump(int line_count, const char *func_name, unsigned char *buf, | |||
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | #define DUMP(buf_, len_) \ | 380 | #define DUMP(buf_, len_) \ |
| 381 | dbg_dump(__LINE__, __func__, buf_, len_) | 381 | dbg_dump(__LINE__, __func__, (unsigned char *)buf_, len_) |
| 382 | 382 | ||
| 383 | #define DUMP1(buf_, len_) \ | 383 | #define DUMP1(buf_, len_) \ |
| 384 | do { \ | 384 | do { \ |
| @@ -1363,7 +1363,7 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) | |||
| 1363 | /* reset the rts and dtr */ | 1363 | /* reset the rts and dtr */ |
| 1364 | /* do the actual close */ | 1364 | /* do the actual close */ |
| 1365 | serial->open_count--; | 1365 | serial->open_count--; |
| 1366 | kref_put(&serial->parent->ref, hso_serial_ref_free); | 1366 | |
| 1367 | if (serial->open_count <= 0) { | 1367 | if (serial->open_count <= 0) { |
| 1368 | serial->open_count = 0; | 1368 | serial->open_count = 0; |
| 1369 | spin_lock_irq(&serial->serial_lock); | 1369 | spin_lock_irq(&serial->serial_lock); |
| @@ -1383,6 +1383,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) | |||
| 1383 | usb_autopm_put_interface(serial->parent->interface); | 1383 | usb_autopm_put_interface(serial->parent->interface); |
| 1384 | 1384 | ||
| 1385 | mutex_unlock(&serial->parent->mutex); | 1385 | mutex_unlock(&serial->parent->mutex); |
| 1386 | |||
| 1387 | kref_put(&serial->parent->ref, hso_serial_ref_free); | ||
| 1386 | } | 1388 | } |
| 1387 | 1389 | ||
| 1388 | /* close the requested serial port */ | 1390 | /* close the requested serial port */ |
| @@ -1527,7 +1529,7 @@ static void tiocmget_intr_callback(struct urb *urb) | |||
| 1527 | dev_warn(&usb->dev, | 1529 | dev_warn(&usb->dev, |
| 1528 | "hso received invalid serial state notification\n"); | 1530 | "hso received invalid serial state notification\n"); |
| 1529 | DUMP(serial_state_notification, | 1531 | DUMP(serial_state_notification, |
| 1530 | sizeof(hso_serial_state_notifation)) | 1532 | sizeof(struct hso_serial_state_notification)); |
| 1531 | } else { | 1533 | } else { |
| 1532 | 1534 | ||
| 1533 | UART_state_bitmap = le16_to_cpu(serial_state_notification-> | 1535 | UART_state_bitmap = le16_to_cpu(serial_state_notification-> |
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index ade5b344f75d..52af5017c46b 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
| @@ -210,32 +210,29 @@ rx_drop: | |||
| 210 | static struct net_device_stats *veth_get_stats(struct net_device *dev) | 210 | static struct net_device_stats *veth_get_stats(struct net_device *dev) |
| 211 | { | 211 | { |
| 212 | struct veth_priv *priv; | 212 | struct veth_priv *priv; |
| 213 | struct net_device_stats *dev_stats; | ||
| 214 | int cpu; | 213 | int cpu; |
| 215 | struct veth_net_stats *stats; | 214 | struct veth_net_stats *stats, total = {0}; |
| 216 | 215 | ||
| 217 | priv = netdev_priv(dev); | 216 | priv = netdev_priv(dev); |
| 218 | dev_stats = &dev->stats; | ||
| 219 | |||
| 220 | dev_stats->rx_packets = 0; | ||
| 221 | dev_stats->tx_packets = 0; | ||
| 222 | dev_stats->rx_bytes = 0; | ||
| 223 | dev_stats->tx_bytes = 0; | ||
| 224 | dev_stats->tx_dropped = 0; | ||
| 225 | dev_stats->rx_dropped = 0; | ||
| 226 | 217 | ||
| 227 | for_each_online_cpu(cpu) { | 218 | for_each_possible_cpu(cpu) { |
| 228 | stats = per_cpu_ptr(priv->stats, cpu); | 219 | stats = per_cpu_ptr(priv->stats, cpu); |
| 229 | 220 | ||
| 230 | dev_stats->rx_packets += stats->rx_packets; | 221 | total.rx_packets += stats->rx_packets; |
| 231 | dev_stats->tx_packets += stats->tx_packets; | 222 | total.tx_packets += stats->tx_packets; |
| 232 | dev_stats->rx_bytes += stats->rx_bytes; | 223 | total.rx_bytes += stats->rx_bytes; |
| 233 | dev_stats->tx_bytes += stats->tx_bytes; | 224 | total.tx_bytes += stats->tx_bytes; |
| 234 | dev_stats->tx_dropped += stats->tx_dropped; | 225 | total.tx_dropped += stats->tx_dropped; |
| 235 | dev_stats->rx_dropped += stats->rx_dropped; | 226 | total.rx_dropped += stats->rx_dropped; |
| 236 | } | 227 | } |
| 237 | 228 | dev->stats.rx_packets = total.rx_packets; | |
| 238 | return dev_stats; | 229 | dev->stats.tx_packets = total.tx_packets; |
| 230 | dev->stats.rx_bytes = total.rx_bytes; | ||
| 231 | dev->stats.tx_bytes = total.tx_bytes; | ||
| 232 | dev->stats.tx_dropped = total.tx_dropped; | ||
| 233 | dev->stats.rx_dropped = total.rx_dropped; | ||
| 234 | |||
| 235 | return &dev->stats; | ||
| 239 | } | 236 | } |
| 240 | 237 | ||
| 241 | static int veth_open(struct net_device *dev) | 238 | static int veth_open(struct net_device *dev) |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 05630f2f6930..b9e002fccbca 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -998,7 +998,7 @@ static unsigned int features[] = { | |||
| 998 | VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, | 998 | VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, |
| 999 | }; | 999 | }; |
| 1000 | 1000 | ||
| 1001 | static struct virtio_driver virtio_net = { | 1001 | static struct virtio_driver virtio_net_driver = { |
| 1002 | .feature_table = features, | 1002 | .feature_table = features, |
| 1003 | .feature_table_size = ARRAY_SIZE(features), | 1003 | .feature_table_size = ARRAY_SIZE(features), |
| 1004 | .driver.name = KBUILD_MODNAME, | 1004 | .driver.name = KBUILD_MODNAME, |
| @@ -1011,12 +1011,12 @@ static struct virtio_driver virtio_net = { | |||
| 1011 | 1011 | ||
| 1012 | static int __init init(void) | 1012 | static int __init init(void) |
| 1013 | { | 1013 | { |
| 1014 | return register_virtio_driver(&virtio_net); | 1014 | return register_virtio_driver(&virtio_net_driver); |
| 1015 | } | 1015 | } |
| 1016 | 1016 | ||
| 1017 | static void __exit fini(void) | 1017 | static void __exit fini(void) |
| 1018 | { | 1018 | { |
| 1019 | unregister_virtio_driver(&virtio_net); | 1019 | unregister_virtio_driver(&virtio_net_driver); |
| 1020 | } | 1020 | } |
| 1021 | module_init(init); | 1021 | module_init(init); |
| 1022 | module_exit(fini); | 1022 | module_exit(fini); |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index e2c33c06190b..8e25ca7080c7 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
| @@ -907,6 +907,7 @@ static ssize_t cosa_write(struct file *file, | |||
| 907 | current->state = TASK_RUNNING; | 907 | current->state = TASK_RUNNING; |
| 908 | chan->tx_status = 1; | 908 | chan->tx_status = 1; |
| 909 | spin_unlock_irqrestore(&cosa->lock, flags); | 909 | spin_unlock_irqrestore(&cosa->lock, flags); |
| 910 | up(&chan->wsem); | ||
| 910 | return -ERESTARTSYS; | 911 | return -ERESTARTSYS; |
| 911 | } | 912 | } |
| 912 | } | 913 | } |
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index d0593ed9170e..f6036fb42319 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
| @@ -43,21 +43,6 @@ | |||
| 43 | 43 | ||
| 44 | #include "airo.h" | 44 | #include "airo.h" |
| 45 | 45 | ||
| 46 | /* | ||
| 47 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 48 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 49 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 50 | be present but disabled -- but it can then be enabled for specific | ||
| 51 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 52 | */ | ||
| 53 | #ifdef PCMCIA_DEBUG | ||
| 54 | static int pc_debug = PCMCIA_DEBUG; | ||
| 55 | module_param(pc_debug, int, 0); | ||
| 56 | static char *version = "$Revision: 1.2 $"; | ||
| 57 | #define DEBUG(n, args...) if (pc_debug > (n)) printk(KERN_DEBUG args); | ||
| 58 | #else | ||
| 59 | #define DEBUG(n, args...) | ||
| 60 | #endif | ||
| 61 | 46 | ||
| 62 | /*====================================================================*/ | 47 | /*====================================================================*/ |
| 63 | 48 | ||
| @@ -145,11 +130,10 @@ static int airo_probe(struct pcmcia_device *p_dev) | |||
| 145 | { | 130 | { |
| 146 | local_info_t *local; | 131 | local_info_t *local; |
| 147 | 132 | ||
| 148 | DEBUG(0, "airo_attach()\n"); | 133 | dev_dbg(&p_dev->dev, "airo_attach()\n"); |
| 149 | 134 | ||
| 150 | /* Interrupt setup */ | 135 | /* Interrupt setup */ |
| 151 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 136 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 152 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 153 | p_dev->irq.Handler = NULL; | 137 | p_dev->irq.Handler = NULL; |
| 154 | 138 | ||
| 155 | /* | 139 | /* |
| @@ -184,7 +168,7 @@ static int airo_probe(struct pcmcia_device *p_dev) | |||
| 184 | 168 | ||
| 185 | static void airo_detach(struct pcmcia_device *link) | 169 | static void airo_detach(struct pcmcia_device *link) |
| 186 | { | 170 | { |
| 187 | DEBUG(0, "airo_detach(0x%p)\n", link); | 171 | dev_dbg(&link->dev, "airo_detach\n"); |
| 188 | 172 | ||
| 189 | airo_release(link); | 173 | airo_release(link); |
| 190 | 174 | ||
| @@ -204,9 +188,6 @@ static void airo_detach(struct pcmcia_device *link) | |||
| 204 | 188 | ||
| 205 | ======================================================================*/ | 189 | ======================================================================*/ |
| 206 | 190 | ||
| 207 | #define CS_CHECK(fn, ret) \ | ||
| 208 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 209 | |||
| 210 | static int airo_cs_config_check(struct pcmcia_device *p_dev, | 191 | static int airo_cs_config_check(struct pcmcia_device *p_dev, |
| 211 | cistpl_cftable_entry_t *cfg, | 192 | cistpl_cftable_entry_t *cfg, |
| 212 | cistpl_cftable_entry_t *dflt, | 193 | cistpl_cftable_entry_t *dflt, |
| @@ -275,11 +256,11 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, | |||
| 275 | req->Base = mem->win[0].host_addr; | 256 | req->Base = mem->win[0].host_addr; |
| 276 | req->Size = mem->win[0].len; | 257 | req->Size = mem->win[0].len; |
| 277 | req->AccessSpeed = 0; | 258 | req->AccessSpeed = 0; |
| 278 | if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0) | 259 | if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) |
| 279 | return -ENODEV; | 260 | return -ENODEV; |
| 280 | map.Page = 0; | 261 | map.Page = 0; |
| 281 | map.CardOffset = mem->win[0].card_addr; | 262 | map.CardOffset = mem->win[0].card_addr; |
| 282 | if (pcmcia_map_mem_page(p_dev->win, &map) != 0) | 263 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) |
| 283 | return -ENODEV; | 264 | return -ENODEV; |
| 284 | } | 265 | } |
| 285 | /* If we got this far, we're cool! */ | 266 | /* If we got this far, we're cool! */ |
| @@ -291,11 +272,11 @@ static int airo_config(struct pcmcia_device *link) | |||
| 291 | { | 272 | { |
| 292 | local_info_t *dev; | 273 | local_info_t *dev; |
| 293 | win_req_t *req; | 274 | win_req_t *req; |
| 294 | int last_fn, last_ret; | 275 | int ret; |
| 295 | 276 | ||
| 296 | dev = link->priv; | 277 | dev = link->priv; |
| 297 | 278 | ||
| 298 | DEBUG(0, "airo_config(0x%p)\n", link); | 279 | dev_dbg(&link->dev, "airo_config\n"); |
| 299 | 280 | ||
| 300 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); | 281 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); |
| 301 | if (!req) | 282 | if (!req) |
| @@ -315,8 +296,8 @@ static int airo_config(struct pcmcia_device *link) | |||
| 315 | * and most client drivers will only use the CIS to fill in | 296 | * and most client drivers will only use the CIS to fill in |
| 316 | * implementation-defined details. | 297 | * implementation-defined details. |
| 317 | */ | 298 | */ |
| 318 | last_ret = pcmcia_loop_config(link, airo_cs_config_check, req); | 299 | ret = pcmcia_loop_config(link, airo_cs_config_check, req); |
| 319 | if (last_ret) | 300 | if (ret) |
| 320 | goto failed; | 301 | goto failed; |
| 321 | 302 | ||
| 322 | /* | 303 | /* |
| @@ -324,21 +305,25 @@ static int airo_config(struct pcmcia_device *link) | |||
| 324 | handler to the interrupt, unless the 'Handler' member of the | 305 | handler to the interrupt, unless the 'Handler' member of the |
| 325 | irq structure is initialized. | 306 | irq structure is initialized. |
| 326 | */ | 307 | */ |
| 327 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 308 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 328 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 309 | ret = pcmcia_request_irq(link, &link->irq); |
| 310 | if (ret) | ||
| 311 | goto failed; | ||
| 312 | } | ||
| 329 | 313 | ||
| 330 | /* | 314 | /* |
| 331 | This actually configures the PCMCIA socket -- setting up | 315 | This actually configures the PCMCIA socket -- setting up |
| 332 | the I/O windows and the interrupt mapping, and putting the | 316 | the I/O windows and the interrupt mapping, and putting the |
| 333 | card and host interface into "Memory and IO" mode. | 317 | card and host interface into "Memory and IO" mode. |
| 334 | */ | 318 | */ |
| 335 | CS_CHECK(RequestConfiguration, | 319 | ret = pcmcia_request_configuration(link, &link->conf); |
| 336 | pcmcia_request_configuration(link, &link->conf)); | 320 | if (ret) |
| 321 | goto failed; | ||
| 337 | ((local_info_t *)link->priv)->eth_dev = | 322 | ((local_info_t *)link->priv)->eth_dev = |
| 338 | init_airo_card(link->irq.AssignedIRQ, | 323 | init_airo_card(link->irq.AssignedIRQ, |
| 339 | link->io.BasePort1, 1, &handle_to_dev(link)); | 324 | link->io.BasePort1, 1, &link->dev); |
| 340 | if (!((local_info_t *)link->priv)->eth_dev) | 325 | if (!((local_info_t *)link->priv)->eth_dev) |
| 341 | goto cs_failed; | 326 | goto failed; |
| 342 | 327 | ||
| 343 | /* | 328 | /* |
| 344 | At this point, the dev_node_t structure(s) need to be | 329 | At this point, the dev_node_t structure(s) need to be |
| @@ -368,8 +353,6 @@ static int airo_config(struct pcmcia_device *link) | |||
| 368 | kfree(req); | 353 | kfree(req); |
| 369 | return 0; | 354 | return 0; |
| 370 | 355 | ||
| 371 | cs_failed: | ||
| 372 | cs_error(link, last_fn, last_ret); | ||
| 373 | failed: | 356 | failed: |
| 374 | airo_release(link); | 357 | airo_release(link); |
| 375 | kfree(req); | 358 | kfree(req); |
| @@ -386,7 +369,7 @@ static int airo_config(struct pcmcia_device *link) | |||
| 386 | 369 | ||
| 387 | static void airo_release(struct pcmcia_device *link) | 370 | static void airo_release(struct pcmcia_device *link) |
| 388 | { | 371 | { |
| 389 | DEBUG(0, "airo_release(0x%p)\n", link); | 372 | dev_dbg(&link->dev, "airo_release\n"); |
| 390 | pcmcia_disable_device(link); | 373 | pcmcia_disable_device(link); |
| 391 | } | 374 | } |
| 392 | 375 | ||
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 9c6ab5378f6e..95a8e232b58f 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
| @@ -1125,7 +1125,6 @@ ath5k_mode_setup(struct ath5k_softc *sc) | |||
| 1125 | /* configure operational mode */ | 1125 | /* configure operational mode */ |
| 1126 | ath5k_hw_set_opmode(ah); | 1126 | ath5k_hw_set_opmode(ah); |
| 1127 | 1127 | ||
| 1128 | ath5k_hw_set_mcast_filter(ah, 0, 0); | ||
| 1129 | ATH5K_DBG(sc, ATH5K_DEBUG_MODE, "RX filter 0x%x\n", rfilt); | 1128 | ATH5K_DBG(sc, ATH5K_DEBUG_MODE, "RX filter 0x%x\n", rfilt); |
| 1130 | } | 1129 | } |
| 1131 | 1130 | ||
diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c index b767c3b67b24..b548c8eaaae1 100644 --- a/drivers/net/wireless/ath/ath5k/led.c +++ b/drivers/net/wireless/ath/ath5k/led.c | |||
| @@ -63,12 +63,16 @@ static const struct pci_device_id ath5k_led_devices[] = { | |||
| 63 | { ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, 0x0422), ATH_LED(1, 1) }, | 63 | { ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, 0x0422), ATH_LED(1, 1) }, |
| 64 | /* E-machines E510 (tuliom@gmail.com) */ | 64 | /* E-machines E510 (tuliom@gmail.com) */ |
| 65 | { ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, 0x0428), ATH_LED(3, 0) }, | 65 | { ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, 0x0428), ATH_LED(3, 0) }, |
| 66 | /* BenQ Joybook R55v (nowymarluk@wp.pl) */ | ||
| 67 | { ATH_SDEVICE(PCI_VENDOR_ID_QMI, 0x0100), ATH_LED(1, 0) }, | ||
| 66 | /* Acer Extensa 5620z (nekoreeve@gmail.com) */ | 68 | /* Acer Extensa 5620z (nekoreeve@gmail.com) */ |
| 67 | { ATH_SDEVICE(PCI_VENDOR_ID_QMI, 0x0105), ATH_LED(3, 0) }, | 69 | { ATH_SDEVICE(PCI_VENDOR_ID_QMI, 0x0105), ATH_LED(3, 0) }, |
| 68 | /* Fukato Datacask Jupiter 1014a (mrb74@gmx.at) */ | 70 | /* Fukato Datacask Jupiter 1014a (mrb74@gmx.at) */ |
| 69 | { ATH_SDEVICE(PCI_VENDOR_ID_AZWAVE, 0x1026), ATH_LED(3, 0) }, | 71 | { ATH_SDEVICE(PCI_VENDOR_ID_AZWAVE, 0x1026), ATH_LED(3, 0) }, |
| 70 | /* IBM ThinkPad AR5BXB6 (legovini@spiro.fisica.unipd.it) */ | 72 | /* IBM ThinkPad AR5BXB6 (legovini@spiro.fisica.unipd.it) */ |
| 71 | { ATH_SDEVICE(PCI_VENDOR_ID_IBM, 0x058a), ATH_LED(1, 0) }, | 73 | { ATH_SDEVICE(PCI_VENDOR_ID_IBM, 0x058a), ATH_LED(1, 0) }, |
| 74 | /* HP Compaq CQ60-206US (ddreggors@jumptv.com) */ | ||
| 75 | { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137a), ATH_LED(3, 1) }, | ||
| 72 | /* HP Compaq C700 (nitrousnrg@gmail.com) */ | 76 | /* HP Compaq C700 (nitrousnrg@gmail.com) */ |
| 73 | { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 1) }, | 77 | { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 1) }, |
| 74 | /* IBM-specific AR5212 (all others) */ | 78 | /* IBM-specific AR5212 (all others) */ |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 52bed89063d4..43d2be9867fc 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
| @@ -1555,6 +1555,8 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
| 1555 | BIT(NL80211_IFTYPE_ADHOC) | | 1555 | BIT(NL80211_IFTYPE_ADHOC) | |
| 1556 | BIT(NL80211_IFTYPE_MESH_POINT); | 1556 | BIT(NL80211_IFTYPE_MESH_POINT); |
| 1557 | 1557 | ||
| 1558 | hw->wiphy->ps_default = false; | ||
| 1559 | |||
| 1558 | hw->queues = 4; | 1560 | hw->queues = 4; |
| 1559 | hw->max_rates = 4; | 1561 | hw->max_rates = 4; |
| 1560 | hw->channel_change_time = 5000; | 1562 | hw->channel_change_time = 5000; |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index ddaa859c3491..32407911842f 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
| @@ -55,22 +55,6 @@ | |||
| 55 | 55 | ||
| 56 | #include "atmel.h" | 56 | #include "atmel.h" |
| 57 | 57 | ||
| 58 | /* | ||
| 59 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 60 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 61 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 62 | be present but disabled -- but it can then be enabled for specific | ||
| 63 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 64 | */ | ||
| 65 | |||
| 66 | #ifdef PCMCIA_DEBUG | ||
| 67 | static int pc_debug = PCMCIA_DEBUG; | ||
| 68 | module_param(pc_debug, int, 0); | ||
| 69 | static char *version = "$Revision: 1.2 $"; | ||
| 70 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); | ||
| 71 | #else | ||
| 72 | #define DEBUG(n, args...) | ||
| 73 | #endif | ||
| 74 | 58 | ||
| 75 | /*====================================================================*/ | 59 | /*====================================================================*/ |
| 76 | 60 | ||
| @@ -155,11 +139,10 @@ static int atmel_probe(struct pcmcia_device *p_dev) | |||
| 155 | { | 139 | { |
| 156 | local_info_t *local; | 140 | local_info_t *local; |
| 157 | 141 | ||
| 158 | DEBUG(0, "atmel_attach()\n"); | 142 | dev_dbg(&p_dev->dev, "atmel_attach()\n"); |
| 159 | 143 | ||
| 160 | /* Interrupt setup */ | 144 | /* Interrupt setup */ |
| 161 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 145 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 162 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 163 | p_dev->irq.Handler = NULL; | 146 | p_dev->irq.Handler = NULL; |
| 164 | 147 | ||
| 165 | /* | 148 | /* |
| @@ -194,7 +177,7 @@ static int atmel_probe(struct pcmcia_device *p_dev) | |||
| 194 | 177 | ||
| 195 | static void atmel_detach(struct pcmcia_device *link) | 178 | static void atmel_detach(struct pcmcia_device *link) |
| 196 | { | 179 | { |
| 197 | DEBUG(0, "atmel_detach(0x%p)\n", link); | 180 | dev_dbg(&link->dev, "atmel_detach\n"); |
| 198 | 181 | ||
| 199 | atmel_release(link); | 182 | atmel_release(link); |
| 200 | 183 | ||
| @@ -209,9 +192,6 @@ static void atmel_detach(struct pcmcia_device *link) | |||
| 209 | 192 | ||
| 210 | ======================================================================*/ | 193 | ======================================================================*/ |
| 211 | 194 | ||
| 212 | #define CS_CHECK(fn, ret) \ | ||
| 213 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 214 | |||
| 215 | /* Call-back function to interrogate PCMCIA-specific information | 195 | /* Call-back function to interrogate PCMCIA-specific information |
| 216 | about the current existance of the card */ | 196 | about the current existance of the card */ |
| 217 | static int card_present(void *arg) | 197 | static int card_present(void *arg) |
| @@ -275,13 +255,13 @@ static int atmel_config_check(struct pcmcia_device *p_dev, | |||
| 275 | static int atmel_config(struct pcmcia_device *link) | 255 | static int atmel_config(struct pcmcia_device *link) |
| 276 | { | 256 | { |
| 277 | local_info_t *dev; | 257 | local_info_t *dev; |
| 278 | int last_fn, last_ret; | 258 | int ret; |
| 279 | struct pcmcia_device_id *did; | 259 | struct pcmcia_device_id *did; |
| 280 | 260 | ||
| 281 | dev = link->priv; | 261 | dev = link->priv; |
| 282 | did = dev_get_drvdata(&handle_to_dev(link)); | 262 | did = dev_get_drvdata(&link->dev); |
| 283 | 263 | ||
| 284 | DEBUG(0, "atmel_config(0x%p)\n", link); | 264 | dev_dbg(&link->dev, "atmel_config\n"); |
| 285 | 265 | ||
| 286 | /* | 266 | /* |
| 287 | In this loop, we scan the CIS for configuration table entries, | 267 | In this loop, we scan the CIS for configuration table entries, |
| @@ -303,31 +283,36 @@ static int atmel_config(struct pcmcia_device *link) | |||
| 303 | handler to the interrupt, unless the 'Handler' member of the | 283 | handler to the interrupt, unless the 'Handler' member of the |
| 304 | irq structure is initialized. | 284 | irq structure is initialized. |
| 305 | */ | 285 | */ |
| 306 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 286 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 307 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 287 | ret = pcmcia_request_irq(link, &link->irq); |
| 288 | if (ret) | ||
| 289 | goto failed; | ||
| 290 | } | ||
| 308 | 291 | ||
| 309 | /* | 292 | /* |
| 310 | This actually configures the PCMCIA socket -- setting up | 293 | This actually configures the PCMCIA socket -- setting up |
| 311 | the I/O windows and the interrupt mapping, and putting the | 294 | the I/O windows and the interrupt mapping, and putting the |
| 312 | card and host interface into "Memory and IO" mode. | 295 | card and host interface into "Memory and IO" mode. |
| 313 | */ | 296 | */ |
| 314 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 297 | ret = pcmcia_request_configuration(link, &link->conf); |
| 298 | if (ret) | ||
| 299 | goto failed; | ||
| 315 | 300 | ||
| 316 | if (link->irq.AssignedIRQ == 0) { | 301 | if (link->irq.AssignedIRQ == 0) { |
| 317 | printk(KERN_ALERT | 302 | printk(KERN_ALERT |
| 318 | "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config."); | 303 | "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config."); |
| 319 | goto cs_failed; | 304 | goto failed; |
| 320 | } | 305 | } |
| 321 | 306 | ||
| 322 | ((local_info_t*)link->priv)->eth_dev = | 307 | ((local_info_t*)link->priv)->eth_dev = |
| 323 | init_atmel_card(link->irq.AssignedIRQ, | 308 | init_atmel_card(link->irq.AssignedIRQ, |
| 324 | link->io.BasePort1, | 309 | link->io.BasePort1, |
| 325 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, | 310 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, |
| 326 | &handle_to_dev(link), | 311 | &link->dev, |
| 327 | card_present, | 312 | card_present, |
| 328 | link); | 313 | link); |
| 329 | if (!((local_info_t*)link->priv)->eth_dev) | 314 | if (!((local_info_t*)link->priv)->eth_dev) |
| 330 | goto cs_failed; | 315 | goto failed; |
| 331 | 316 | ||
| 332 | 317 | ||
| 333 | /* | 318 | /* |
| @@ -340,8 +325,6 @@ static int atmel_config(struct pcmcia_device *link) | |||
| 340 | 325 | ||
| 341 | return 0; | 326 | return 0; |
| 342 | 327 | ||
| 343 | cs_failed: | ||
| 344 | cs_error(link, last_fn, last_ret); | ||
| 345 | failed: | 328 | failed: |
| 346 | atmel_release(link); | 329 | atmel_release(link); |
| 347 | return -ENODEV; | 330 | return -ENODEV; |
| @@ -359,7 +342,7 @@ static void atmel_release(struct pcmcia_device *link) | |||
| 359 | { | 342 | { |
| 360 | struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; | 343 | struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; |
| 361 | 344 | ||
| 362 | DEBUG(0, "atmel_release(0x%p)\n", link); | 345 | dev_dbg(&link->dev, "atmel_release\n"); |
| 363 | 346 | ||
| 364 | if (dev) | 347 | if (dev) |
| 365 | stop_atmel_card(dev); | 348 | stop_atmel_card(dev); |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 86f35827f008..098dda1a67c1 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
| @@ -4521,9 +4521,8 @@ static int b43_op_beacon_set_tim(struct ieee80211_hw *hw, | |||
| 4521 | { | 4521 | { |
| 4522 | struct b43_wl *wl = hw_to_b43_wl(hw); | 4522 | struct b43_wl *wl = hw_to_b43_wl(hw); |
| 4523 | 4523 | ||
| 4524 | mutex_lock(&wl->mutex); | 4524 | /* FIXME: add locking */ |
| 4525 | b43_update_templates(wl); | 4525 | b43_update_templates(wl); |
| 4526 | mutex_unlock(&wl->mutex); | ||
| 4527 | 4526 | ||
| 4528 | return 0; | 4527 | return 0; |
| 4529 | } | 4528 | } |
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 6c3a74964ab8..984174bc7b0f 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
| @@ -65,35 +65,15 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
| 65 | struct ssb_bus *ssb; | 65 | struct ssb_bus *ssb; |
| 66 | win_req_t win; | 66 | win_req_t win; |
| 67 | memreq_t mem; | 67 | memreq_t mem; |
| 68 | tuple_t tuple; | ||
| 69 | cisparse_t parse; | ||
| 70 | int err = -ENOMEM; | 68 | int err = -ENOMEM; |
| 71 | int res = 0; | 69 | int res = 0; |
| 72 | unsigned char buf[64]; | ||
| 73 | 70 | ||
| 74 | ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); | 71 | ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); |
| 75 | if (!ssb) | 72 | if (!ssb) |
| 76 | goto out_error; | 73 | goto out_error; |
| 77 | 74 | ||
| 78 | err = -ENODEV; | 75 | err = -ENODEV; |
| 79 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
| 80 | tuple.Attributes = 0; | ||
| 81 | tuple.TupleData = buf; | ||
| 82 | tuple.TupleDataMax = sizeof(buf); | ||
| 83 | tuple.TupleOffset = 0; | ||
| 84 | 76 | ||
| 85 | res = pcmcia_get_first_tuple(dev, &tuple); | ||
| 86 | if (res != 0) | ||
| 87 | goto err_kfree_ssb; | ||
| 88 | res = pcmcia_get_tuple_data(dev, &tuple); | ||
| 89 | if (res != 0) | ||
| 90 | goto err_kfree_ssb; | ||
| 91 | res = pcmcia_parse_tuple(&tuple, &parse); | ||
| 92 | if (res != 0) | ||
| 93 | goto err_kfree_ssb; | ||
| 94 | |||
| 95 | dev->conf.ConfigBase = parse.config.base; | ||
| 96 | dev->conf.Present = parse.config.rmask[0]; | ||
| 97 | dev->conf.Attributes = CONF_ENABLE_IRQ; | 77 | dev->conf.Attributes = CONF_ENABLE_IRQ; |
| 98 | dev->conf.IntType = INT_MEMORY_AND_IO; | 78 | dev->conf.IntType = INT_MEMORY_AND_IO; |
| 99 | 79 | ||
| @@ -107,20 +87,18 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
| 107 | win.Base = 0; | 87 | win.Base = 0; |
| 108 | win.Size = SSB_CORE_SIZE; | 88 | win.Size = SSB_CORE_SIZE; |
| 109 | win.AccessSpeed = 250; | 89 | win.AccessSpeed = 250; |
| 110 | res = pcmcia_request_window(&dev, &win, &dev->win); | 90 | res = pcmcia_request_window(dev, &win, &dev->win); |
| 111 | if (res != 0) | 91 | if (res != 0) |
| 112 | goto err_kfree_ssb; | 92 | goto err_kfree_ssb; |
| 113 | 93 | ||
| 114 | mem.CardOffset = 0; | 94 | mem.CardOffset = 0; |
| 115 | mem.Page = 0; | 95 | mem.Page = 0; |
| 116 | res = pcmcia_map_mem_page(dev->win, &mem); | 96 | res = pcmcia_map_mem_page(dev, dev->win, &mem); |
| 117 | if (res != 0) | 97 | if (res != 0) |
| 118 | goto err_disable; | 98 | goto err_disable; |
| 119 | 99 | ||
| 120 | dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 100 | dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 121 | dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 122 | dev->irq.Handler = NULL; /* The handler is registered later. */ | 101 | dev->irq.Handler = NULL; /* The handler is registered later. */ |
| 123 | dev->irq.Instance = NULL; | ||
| 124 | res = pcmcia_request_irq(dev, &dev->irq); | 102 | res = pcmcia_request_irq(dev, &dev->irq); |
| 125 | if (res != 0) | 103 | if (res != 0) |
| 126 | goto err_disable; | 104 | goto err_disable; |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index ad8eab4a639b..c9640a3e02c9 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
| @@ -274,9 +274,6 @@ static int sandisk_enable_wireless(struct net_device *dev) | |||
| 274 | conf_reg_t reg; | 274 | conf_reg_t reg; |
| 275 | struct hostap_interface *iface = netdev_priv(dev); | 275 | struct hostap_interface *iface = netdev_priv(dev); |
| 276 | local_info_t *local = iface->local; | 276 | local_info_t *local = iface->local; |
| 277 | tuple_t tuple; | ||
| 278 | cisparse_t *parse = NULL; | ||
| 279 | u_char buf[64]; | ||
| 280 | struct hostap_cs_priv *hw_priv = local->hw_priv; | 277 | struct hostap_cs_priv *hw_priv = local->hw_priv; |
| 281 | 278 | ||
| 282 | if (hw_priv->link->io.NumPorts1 < 0x42) { | 279 | if (hw_priv->link->io.NumPorts1 < 0x42) { |
| @@ -285,28 +282,13 @@ static int sandisk_enable_wireless(struct net_device *dev) | |||
| 285 | goto done; | 282 | goto done; |
| 286 | } | 283 | } |
| 287 | 284 | ||
| 288 | parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL); | ||
| 289 | if (parse == NULL) { | ||
| 290 | ret = -ENOMEM; | ||
| 291 | goto done; | ||
| 292 | } | ||
| 293 | |||
| 294 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
| 295 | tuple.TupleData = buf; | ||
| 296 | tuple.TupleDataMax = sizeof(buf); | ||
| 297 | tuple.TupleOffset = 0; | ||
| 298 | |||
| 299 | if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) { | 285 | if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) { |
| 300 | /* No SanDisk manfid found */ | 286 | /* No SanDisk manfid found */ |
| 301 | ret = -ENODEV; | 287 | ret = -ENODEV; |
| 302 | goto done; | 288 | goto done; |
| 303 | } | 289 | } |
| 304 | 290 | ||
| 305 | tuple.DesiredTuple = CISTPL_LONGLINK_MFC; | 291 | if (hw_priv->link->socket->functions < 2) { |
| 306 | if (pcmcia_get_first_tuple(hw_priv->link, &tuple) || | ||
| 307 | pcmcia_get_tuple_data(hw_priv->link, &tuple) || | ||
| 308 | pcmcia_parse_tuple(&tuple, parse) || | ||
| 309 | parse->longlink_mfc.nfn < 2) { | ||
| 310 | /* No multi-function links found */ | 292 | /* No multi-function links found */ |
| 311 | ret = -ENODEV; | 293 | ret = -ENODEV; |
| 312 | goto done; | 294 | goto done; |
| @@ -354,7 +336,6 @@ static int sandisk_enable_wireless(struct net_device *dev) | |||
| 354 | udelay(10); | 336 | udelay(10); |
| 355 | 337 | ||
| 356 | done: | 338 | done: |
| 357 | kfree(parse); | ||
| 358 | return ret; | 339 | return ret; |
| 359 | } | 340 | } |
| 360 | 341 | ||
| @@ -529,10 +510,6 @@ static void prism2_detach(struct pcmcia_device *link) | |||
| 529 | } | 510 | } |
| 530 | 511 | ||
| 531 | 512 | ||
| 532 | #define CS_CHECK(fn, ret) \ | ||
| 533 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 534 | |||
| 535 | |||
| 536 | /* run after a CARD_INSERTION event is received to configure the PCMCIA | 513 | /* run after a CARD_INSERTION event is received to configure the PCMCIA |
| 537 | * socket and make the device available to the system */ | 514 | * socket and make the device available to the system */ |
| 538 | 515 | ||
| @@ -624,7 +601,6 @@ static int prism2_config(struct pcmcia_device *link) | |||
| 624 | struct hostap_interface *iface; | 601 | struct hostap_interface *iface; |
| 625 | local_info_t *local; | 602 | local_info_t *local; |
| 626 | int ret = 1; | 603 | int ret = 1; |
| 627 | int last_fn, last_ret; | ||
| 628 | struct hostap_cs_priv *hw_priv; | 604 | struct hostap_cs_priv *hw_priv; |
| 629 | 605 | ||
| 630 | PDEBUG(DEBUG_FLOW, "prism2_config()\n"); | 606 | PDEBUG(DEBUG_FLOW, "prism2_config()\n"); |
| @@ -636,19 +612,18 @@ static int prism2_config(struct pcmcia_device *link) | |||
| 636 | } | 612 | } |
| 637 | 613 | ||
| 638 | /* Look for an appropriate configuration table entry in the CIS */ | 614 | /* Look for an appropriate configuration table entry in the CIS */ |
| 639 | last_ret = pcmcia_loop_config(link, prism2_config_check, NULL); | 615 | ret = pcmcia_loop_config(link, prism2_config_check, NULL); |
| 640 | if (last_ret) { | 616 | if (ret) { |
| 641 | if (!ignore_cis_vcc) | 617 | if (!ignore_cis_vcc) |
| 642 | printk(KERN_ERR "GetNextTuple(): No matching " | 618 | printk(KERN_ERR "GetNextTuple(): No matching " |
| 643 | "CIS configuration. Maybe you need the " | 619 | "CIS configuration. Maybe you need the " |
| 644 | "ignore_cis_vcc=1 parameter.\n"); | 620 | "ignore_cis_vcc=1 parameter.\n"); |
| 645 | cs_error(link, RequestIO, last_ret); | ||
| 646 | goto failed; | 621 | goto failed; |
| 647 | } | 622 | } |
| 648 | 623 | ||
| 649 | /* Need to allocate net_device before requesting IRQ handler */ | 624 | /* Need to allocate net_device before requesting IRQ handler */ |
| 650 | dev = prism2_init_local_data(&prism2_pccard_funcs, 0, | 625 | dev = prism2_init_local_data(&prism2_pccard_funcs, 0, |
| 651 | &handle_to_dev(link)); | 626 | &link->dev); |
| 652 | if (dev == NULL) | 627 | if (dev == NULL) |
| 653 | goto failed; | 628 | goto failed; |
| 654 | link->priv = dev; | 629 | link->priv = dev; |
| @@ -666,13 +641,11 @@ static int prism2_config(struct pcmcia_device *link) | |||
| 666 | * irq structure is initialized. | 641 | * irq structure is initialized. |
| 667 | */ | 642 | */ |
| 668 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 643 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 669 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | | 644 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 670 | IRQ_HANDLE_PRESENT; | ||
| 671 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 672 | link->irq.Handler = prism2_interrupt; | 645 | link->irq.Handler = prism2_interrupt; |
| 673 | link->irq.Instance = dev; | 646 | ret = pcmcia_request_irq(link, &link->irq); |
| 674 | CS_CHECK(RequestIRQ, | 647 | if (ret) |
| 675 | pcmcia_request_irq(link, &link->irq)); | 648 | goto failed; |
| 676 | } | 649 | } |
| 677 | 650 | ||
| 678 | /* | 651 | /* |
| @@ -680,8 +653,9 @@ static int prism2_config(struct pcmcia_device *link) | |||
| 680 | * the I/O windows and the interrupt mapping, and putting the | 653 | * the I/O windows and the interrupt mapping, and putting the |
| 681 | * card and host interface into "Memory and IO" mode. | 654 | * card and host interface into "Memory and IO" mode. |
| 682 | */ | 655 | */ |
| 683 | CS_CHECK(RequestConfiguration, | 656 | ret = pcmcia_request_configuration(link, &link->conf); |
| 684 | pcmcia_request_configuration(link, &link->conf)); | 657 | if (ret) |
| 658 | goto failed; | ||
| 685 | 659 | ||
| 686 | dev->irq = link->irq.AssignedIRQ; | 660 | dev->irq = link->irq.AssignedIRQ; |
| 687 | dev->base_addr = link->io.BasePort1; | 661 | dev->base_addr = link->io.BasePort1; |
| @@ -714,9 +688,6 @@ static int prism2_config(struct pcmcia_device *link) | |||
| 714 | } | 688 | } |
| 715 | return ret; | 689 | return ret; |
| 716 | 690 | ||
| 717 | cs_failed: | ||
| 718 | cs_error(link, last_fn, last_ret); | ||
| 719 | |||
| 720 | failed: | 691 | failed: |
| 721 | kfree(hw_priv); | 692 | kfree(hw_priv); |
| 722 | prism2_release((u_long)link); | 693 | prism2_release((u_long)link); |
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c index a741d37fd96f..6e2fc0cb6f8a 100644 --- a/drivers/net/wireless/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/ipw2x00/ipw2100.c | |||
| @@ -6029,7 +6029,7 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, | |||
| 6029 | struct ipw2100_priv *priv; | 6029 | struct ipw2100_priv *priv; |
| 6030 | struct net_device *dev; | 6030 | struct net_device *dev; |
| 6031 | 6031 | ||
| 6032 | dev = alloc_ieee80211(sizeof(struct ipw2100_priv), 0); | 6032 | dev = alloc_ieee80211(sizeof(struct ipw2100_priv)); |
| 6033 | if (!dev) | 6033 | if (!dev) |
| 6034 | return NULL; | 6034 | return NULL; |
| 6035 | priv = libipw_priv(dev); | 6035 | priv = libipw_priv(dev); |
| @@ -6325,10 +6325,8 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
| 6325 | 6325 | ||
| 6326 | fail: | 6326 | fail: |
| 6327 | if (dev) { | 6327 | if (dev) { |
| 6328 | if (registered) { | 6328 | if (registered) |
| 6329 | unregister_ieee80211(priv->ieee); | ||
| 6330 | unregister_netdev(dev); | 6329 | unregister_netdev(dev); |
| 6331 | } | ||
| 6332 | 6330 | ||
| 6333 | ipw2100_hw_stop_adapter(priv); | 6331 | ipw2100_hw_stop_adapter(priv); |
| 6334 | 6332 | ||
| @@ -6344,7 +6342,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
| 6344 | sysfs_remove_group(&pci_dev->dev.kobj, | 6342 | sysfs_remove_group(&pci_dev->dev.kobj, |
| 6345 | &ipw2100_attribute_group); | 6343 | &ipw2100_attribute_group); |
| 6346 | 6344 | ||
| 6347 | free_ieee80211(dev, 0); | 6345 | free_ieee80211(dev); |
| 6348 | pci_set_drvdata(pci_dev, NULL); | 6346 | pci_set_drvdata(pci_dev, NULL); |
| 6349 | } | 6347 | } |
| 6350 | 6348 | ||
| @@ -6385,7 +6383,6 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) | |||
| 6385 | /* Unregister the device first - this results in close() | 6383 | /* Unregister the device first - this results in close() |
| 6386 | * being called if the device is open. If we free storage | 6384 | * being called if the device is open. If we free storage |
| 6387 | * first, then close() will crash. */ | 6385 | * first, then close() will crash. */ |
| 6388 | unregister_ieee80211(priv->ieee); | ||
| 6389 | unregister_netdev(dev); | 6386 | unregister_netdev(dev); |
| 6390 | 6387 | ||
| 6391 | /* ipw2100_down will ensure that there is no more pending work | 6388 | /* ipw2100_down will ensure that there is no more pending work |
| @@ -6403,7 +6400,7 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) | |||
| 6403 | if (dev->base_addr) | 6400 | if (dev->base_addr) |
| 6404 | iounmap((void __iomem *)dev->base_addr); | 6401 | iounmap((void __iomem *)dev->base_addr); |
| 6405 | 6402 | ||
| 6406 | free_ieee80211(dev, 0); | 6403 | free_ieee80211(dev); |
| 6407 | } | 6404 | } |
| 6408 | 6405 | ||
| 6409 | pci_release_regions(pci_dev); | 6406 | pci_release_regions(pci_dev); |
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 9b0f2c0646e0..a6ca536e44f8 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
| @@ -104,25 +104,6 @@ static int antenna = CFG_SYS_ANTENNA_BOTH; | |||
| 104 | static int rtap_iface = 0; /* def: 0 -- do not create rtap interface */ | 104 | static int rtap_iface = 0; /* def: 0 -- do not create rtap interface */ |
| 105 | #endif | 105 | #endif |
| 106 | 106 | ||
| 107 | static struct ieee80211_rate ipw2200_rates[] = { | ||
| 108 | { .bitrate = 10 }, | ||
| 109 | { .bitrate = 20, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, | ||
| 110 | { .bitrate = 55, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, | ||
| 111 | { .bitrate = 110, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, | ||
| 112 | { .bitrate = 60 }, | ||
| 113 | { .bitrate = 90 }, | ||
| 114 | { .bitrate = 120 }, | ||
| 115 | { .bitrate = 180 }, | ||
| 116 | { .bitrate = 240 }, | ||
| 117 | { .bitrate = 360 }, | ||
| 118 | { .bitrate = 480 }, | ||
| 119 | { .bitrate = 540 } | ||
| 120 | }; | ||
| 121 | |||
| 122 | #define ipw2200_a_rates (ipw2200_rates + 4) | ||
| 123 | #define ipw2200_num_a_rates 8 | ||
| 124 | #define ipw2200_bg_rates (ipw2200_rates + 0) | ||
| 125 | #define ipw2200_num_bg_rates 12 | ||
| 126 | 107 | ||
| 127 | #ifdef CONFIG_IPW2200_QOS | 108 | #ifdef CONFIG_IPW2200_QOS |
| 128 | static int qos_enable = 0; | 109 | static int qos_enable = 0; |
| @@ -8674,6 +8655,24 @@ static int ipw_sw_reset(struct ipw_priv *priv, int option) | |||
| 8674 | * | 8655 | * |
| 8675 | */ | 8656 | */ |
| 8676 | 8657 | ||
| 8658 | static int ipw_wx_get_name(struct net_device *dev, | ||
| 8659 | struct iw_request_info *info, | ||
| 8660 | union iwreq_data *wrqu, char *extra) | ||
| 8661 | { | ||
| 8662 | struct ipw_priv *priv = libipw_priv(dev); | ||
| 8663 | mutex_lock(&priv->mutex); | ||
| 8664 | if (priv->status & STATUS_RF_KILL_MASK) | ||
| 8665 | strcpy(wrqu->name, "radio off"); | ||
| 8666 | else if (!(priv->status & STATUS_ASSOCIATED)) | ||
| 8667 | strcpy(wrqu->name, "unassociated"); | ||
| 8668 | else | ||
| 8669 | snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", | ||
| 8670 | ipw_modes[priv->assoc_request.ieee_mode]); | ||
| 8671 | IPW_DEBUG_WX("Name: %s\n", wrqu->name); | ||
| 8672 | mutex_unlock(&priv->mutex); | ||
| 8673 | return 0; | ||
| 8674 | } | ||
| 8675 | |||
| 8677 | static int ipw_set_channel(struct ipw_priv *priv, u8 channel) | 8676 | static int ipw_set_channel(struct ipw_priv *priv, u8 channel) |
| 8678 | { | 8677 | { |
| 8679 | if (channel == 0) { | 8678 | if (channel == 0) { |
| @@ -9973,7 +9972,7 @@ static int ipw_wx_sw_reset(struct net_device *dev, | |||
| 9973 | /* Rebase the WE IOCTLs to zero for the handler array */ | 9972 | /* Rebase the WE IOCTLs to zero for the handler array */ |
| 9974 | #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] | 9973 | #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] |
| 9975 | static iw_handler ipw_wx_handlers[] = { | 9974 | static iw_handler ipw_wx_handlers[] = { |
| 9976 | IW_IOCTL(SIOCGIWNAME) = (iw_handler) cfg80211_wext_giwname, | 9975 | IW_IOCTL(SIOCGIWNAME) = ipw_wx_get_name, |
| 9977 | IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, | 9976 | IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, |
| 9978 | IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, | 9977 | IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, |
| 9979 | IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, | 9978 | IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, |
| @@ -11417,100 +11416,16 @@ static void ipw_bg_down(struct work_struct *work) | |||
| 11417 | /* Called by register_netdev() */ | 11416 | /* Called by register_netdev() */ |
| 11418 | static int ipw_net_init(struct net_device *dev) | 11417 | static int ipw_net_init(struct net_device *dev) |
| 11419 | { | 11418 | { |
| 11420 | int i, rc = 0; | ||
| 11421 | struct ipw_priv *priv = libipw_priv(dev); | 11419 | struct ipw_priv *priv = libipw_priv(dev); |
| 11422 | const struct libipw_geo *geo = libipw_get_geo(priv->ieee); | ||
| 11423 | struct wireless_dev *wdev = &priv->ieee->wdev; | ||
| 11424 | mutex_lock(&priv->mutex); | 11420 | mutex_lock(&priv->mutex); |
| 11425 | 11421 | ||
| 11426 | if (ipw_up(priv)) { | 11422 | if (ipw_up(priv)) { |
| 11427 | rc = -EIO; | 11423 | mutex_unlock(&priv->mutex); |
| 11428 | goto out; | 11424 | return -EIO; |
| 11429 | } | ||
| 11430 | |||
| 11431 | memcpy(wdev->wiphy->perm_addr, priv->mac_addr, ETH_ALEN); | ||
| 11432 | |||
| 11433 | /* fill-out priv->ieee->bg_band */ | ||
| 11434 | if (geo->bg_channels) { | ||
| 11435 | struct ieee80211_supported_band *bg_band = &priv->ieee->bg_band; | ||
| 11436 | |||
| 11437 | bg_band->band = IEEE80211_BAND_2GHZ; | ||
| 11438 | bg_band->n_channels = geo->bg_channels; | ||
| 11439 | bg_band->channels = | ||
| 11440 | kzalloc(geo->bg_channels * | ||
| 11441 | sizeof(struct ieee80211_channel), GFP_KERNEL); | ||
| 11442 | /* translate geo->bg to bg_band.channels */ | ||
| 11443 | for (i = 0; i < geo->bg_channels; i++) { | ||
| 11444 | bg_band->channels[i].band = IEEE80211_BAND_2GHZ; | ||
| 11445 | bg_band->channels[i].center_freq = geo->bg[i].freq; | ||
| 11446 | bg_band->channels[i].hw_value = geo->bg[i].channel; | ||
| 11447 | bg_band->channels[i].max_power = geo->bg[i].max_power; | ||
| 11448 | if (geo->bg[i].flags & LIBIPW_CH_PASSIVE_ONLY) | ||
| 11449 | bg_band->channels[i].flags |= | ||
| 11450 | IEEE80211_CHAN_PASSIVE_SCAN; | ||
| 11451 | if (geo->bg[i].flags & LIBIPW_CH_NO_IBSS) | ||
| 11452 | bg_band->channels[i].flags |= | ||
| 11453 | IEEE80211_CHAN_NO_IBSS; | ||
| 11454 | if (geo->bg[i].flags & LIBIPW_CH_RADAR_DETECT) | ||
| 11455 | bg_band->channels[i].flags |= | ||
| 11456 | IEEE80211_CHAN_RADAR; | ||
| 11457 | /* No equivalent for LIBIPW_CH_80211H_RULES, | ||
| 11458 | LIBIPW_CH_UNIFORM_SPREADING, or | ||
| 11459 | LIBIPW_CH_B_ONLY... */ | ||
| 11460 | } | ||
| 11461 | /* point at bitrate info */ | ||
| 11462 | bg_band->bitrates = ipw2200_bg_rates; | ||
| 11463 | bg_band->n_bitrates = ipw2200_num_bg_rates; | ||
| 11464 | |||
| 11465 | wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = bg_band; | ||
| 11466 | } | ||
| 11467 | |||
| 11468 | /* fill-out priv->ieee->a_band */ | ||
| 11469 | if (geo->a_channels) { | ||
| 11470 | struct ieee80211_supported_band *a_band = &priv->ieee->a_band; | ||
| 11471 | |||
| 11472 | a_band->band = IEEE80211_BAND_5GHZ; | ||
| 11473 | a_band->n_channels = geo->a_channels; | ||
| 11474 | a_band->channels = | ||
| 11475 | kzalloc(geo->a_channels * | ||
| 11476 | sizeof(struct ieee80211_channel), GFP_KERNEL); | ||
| 11477 | /* translate geo->bg to a_band.channels */ | ||
| 11478 | for (i = 0; i < geo->a_channels; i++) { | ||
| 11479 | a_band->channels[i].band = IEEE80211_BAND_2GHZ; | ||
| 11480 | a_band->channels[i].center_freq = geo->a[i].freq; | ||
| 11481 | a_band->channels[i].hw_value = geo->a[i].channel; | ||
| 11482 | a_band->channels[i].max_power = geo->a[i].max_power; | ||
| 11483 | if (geo->a[i].flags & LIBIPW_CH_PASSIVE_ONLY) | ||
| 11484 | a_band->channels[i].flags |= | ||
| 11485 | IEEE80211_CHAN_PASSIVE_SCAN; | ||
| 11486 | if (geo->a[i].flags & LIBIPW_CH_NO_IBSS) | ||
| 11487 | a_band->channels[i].flags |= | ||
| 11488 | IEEE80211_CHAN_NO_IBSS; | ||
| 11489 | if (geo->a[i].flags & LIBIPW_CH_RADAR_DETECT) | ||
| 11490 | a_band->channels[i].flags |= | ||
| 11491 | IEEE80211_CHAN_RADAR; | ||
| 11492 | /* No equivalent for LIBIPW_CH_80211H_RULES, | ||
| 11493 | LIBIPW_CH_UNIFORM_SPREADING, or | ||
| 11494 | LIBIPW_CH_B_ONLY... */ | ||
| 11495 | } | ||
| 11496 | /* point at bitrate info */ | ||
| 11497 | a_band->bitrates = ipw2200_a_rates; | ||
| 11498 | a_band->n_bitrates = ipw2200_num_a_rates; | ||
| 11499 | |||
| 11500 | wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = a_band; | ||
| 11501 | } | ||
| 11502 | |||
| 11503 | set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev); | ||
| 11504 | |||
| 11505 | /* With that information in place, we can now register the wiphy... */ | ||
| 11506 | if (wiphy_register(wdev->wiphy)) { | ||
| 11507 | rc = -EIO; | ||
| 11508 | goto out; | ||
| 11509 | } | 11425 | } |
| 11510 | 11426 | ||
| 11511 | out: | ||
| 11512 | mutex_unlock(&priv->mutex); | 11427 | mutex_unlock(&priv->mutex); |
| 11513 | return rc; | 11428 | return 0; |
| 11514 | } | 11429 | } |
| 11515 | 11430 | ||
| 11516 | /* PCI driver stuff */ | 11431 | /* PCI driver stuff */ |
| @@ -11641,7 +11556,7 @@ static int ipw_prom_alloc(struct ipw_priv *priv) | |||
| 11641 | if (priv->prom_net_dev) | 11556 | if (priv->prom_net_dev) |
| 11642 | return -EPERM; | 11557 | return -EPERM; |
| 11643 | 11558 | ||
| 11644 | priv->prom_net_dev = alloc_ieee80211(sizeof(struct ipw_prom_priv), 1); | 11559 | priv->prom_net_dev = alloc_ieee80211(sizeof(struct ipw_prom_priv)); |
| 11645 | if (priv->prom_net_dev == NULL) | 11560 | if (priv->prom_net_dev == NULL) |
| 11646 | return -ENOMEM; | 11561 | return -ENOMEM; |
| 11647 | 11562 | ||
| @@ -11660,7 +11575,7 @@ static int ipw_prom_alloc(struct ipw_priv *priv) | |||
| 11660 | 11575 | ||
| 11661 | rc = register_netdev(priv->prom_net_dev); | 11576 | rc = register_netdev(priv->prom_net_dev); |
| 11662 | if (rc) { | 11577 | if (rc) { |
| 11663 | free_ieee80211(priv->prom_net_dev, 1); | 11578 | free_ieee80211(priv->prom_net_dev); |
| 11664 | priv->prom_net_dev = NULL; | 11579 | priv->prom_net_dev = NULL; |
| 11665 | return rc; | 11580 | return rc; |
| 11666 | } | 11581 | } |
| @@ -11674,7 +11589,7 @@ static void ipw_prom_free(struct ipw_priv *priv) | |||
| 11674 | return; | 11589 | return; |
| 11675 | 11590 | ||
| 11676 | unregister_netdev(priv->prom_net_dev); | 11591 | unregister_netdev(priv->prom_net_dev); |
| 11677 | free_ieee80211(priv->prom_net_dev, 1); | 11592 | free_ieee80211(priv->prom_net_dev); |
| 11678 | 11593 | ||
| 11679 | priv->prom_net_dev = NULL; | 11594 | priv->prom_net_dev = NULL; |
| 11680 | } | 11595 | } |
| @@ -11702,7 +11617,7 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev, | |||
| 11702 | struct ipw_priv *priv; | 11617 | struct ipw_priv *priv; |
| 11703 | int i; | 11618 | int i; |
| 11704 | 11619 | ||
| 11705 | net_dev = alloc_ieee80211(sizeof(struct ipw_priv), 0); | 11620 | net_dev = alloc_ieee80211(sizeof(struct ipw_priv)); |
| 11706 | if (net_dev == NULL) { | 11621 | if (net_dev == NULL) { |
| 11707 | err = -ENOMEM; | 11622 | err = -ENOMEM; |
| 11708 | goto out; | 11623 | goto out; |
| @@ -11822,7 +11737,6 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev, | |||
| 11822 | if (err) { | 11737 | if (err) { |
| 11823 | IPW_ERROR("Failed to register promiscuous network " | 11738 | IPW_ERROR("Failed to register promiscuous network " |
| 11824 | "device (error %d).\n", err); | 11739 | "device (error %d).\n", err); |
| 11825 | unregister_ieee80211(priv->ieee); | ||
| 11826 | unregister_netdev(priv->net_dev); | 11740 | unregister_netdev(priv->net_dev); |
| 11827 | goto out_remove_sysfs; | 11741 | goto out_remove_sysfs; |
| 11828 | } | 11742 | } |
| @@ -11851,7 +11765,7 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev, | |||
| 11851 | pci_disable_device(pdev); | 11765 | pci_disable_device(pdev); |
| 11852 | pci_set_drvdata(pdev, NULL); | 11766 | pci_set_drvdata(pdev, NULL); |
| 11853 | out_free_ieee80211: | 11767 | out_free_ieee80211: |
| 11854 | free_ieee80211(priv->net_dev, 0); | 11768 | free_ieee80211(priv->net_dev); |
| 11855 | out: | 11769 | out: |
| 11856 | return err; | 11770 | return err; |
| 11857 | } | 11771 | } |
| @@ -11873,7 +11787,6 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev) | |||
| 11873 | 11787 | ||
| 11874 | mutex_unlock(&priv->mutex); | 11788 | mutex_unlock(&priv->mutex); |
| 11875 | 11789 | ||
| 11876 | unregister_ieee80211(priv->ieee); | ||
| 11877 | unregister_netdev(priv->net_dev); | 11790 | unregister_netdev(priv->net_dev); |
| 11878 | 11791 | ||
| 11879 | if (priv->rxq) { | 11792 | if (priv->rxq) { |
| @@ -11919,7 +11832,7 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev) | |||
| 11919 | pci_release_regions(pdev); | 11832 | pci_release_regions(pdev); |
| 11920 | pci_disable_device(pdev); | 11833 | pci_disable_device(pdev); |
| 11921 | pci_set_drvdata(pdev, NULL); | 11834 | pci_set_drvdata(pdev, NULL); |
| 11922 | free_ieee80211(priv->net_dev, 0); | 11835 | free_ieee80211(priv->net_dev); |
| 11923 | free_firmware(); | 11836 | free_firmware(); |
| 11924 | } | 11837 | } |
| 11925 | 11838 | ||
diff --git a/drivers/net/wireless/ipw2x00/libipw.h b/drivers/net/wireless/ipw2x00/libipw.h index f42ade6c2d3e..1e334ff6bd52 100644 --- a/drivers/net/wireless/ipw2x00/libipw.h +++ b/drivers/net/wireless/ipw2x00/libipw.h | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | #include <linux/ieee80211.h> | 31 | #include <linux/ieee80211.h> |
| 32 | 32 | ||
| 33 | #include <net/lib80211.h> | 33 | #include <net/lib80211.h> |
| 34 | #include <net/cfg80211.h> | ||
| 35 | 34 | ||
| 36 | #define LIBIPW_VERSION "git-1.1.13" | 35 | #define LIBIPW_VERSION "git-1.1.13" |
| 37 | 36 | ||
| @@ -784,15 +783,12 @@ struct libipw_geo { | |||
| 784 | 783 | ||
| 785 | struct libipw_device { | 784 | struct libipw_device { |
| 786 | struct net_device *dev; | 785 | struct net_device *dev; |
| 787 | struct wireless_dev wdev; | ||
| 788 | struct libipw_security sec; | 786 | struct libipw_security sec; |
| 789 | 787 | ||
| 790 | /* Bookkeeping structures */ | 788 | /* Bookkeeping structures */ |
| 791 | struct libipw_stats ieee_stats; | 789 | struct libipw_stats ieee_stats; |
| 792 | 790 | ||
| 793 | struct libipw_geo geo; | 791 | struct libipw_geo geo; |
| 794 | struct ieee80211_supported_band bg_band; | ||
| 795 | struct ieee80211_supported_band a_band; | ||
| 796 | 792 | ||
| 797 | /* Probe / Beacon management */ | 793 | /* Probe / Beacon management */ |
| 798 | struct list_head network_free_list; | 794 | struct list_head network_free_list; |
| @@ -1018,9 +1014,8 @@ static inline int libipw_is_cck_rate(u8 rate) | |||
| 1018 | } | 1014 | } |
| 1019 | 1015 | ||
| 1020 | /* ieee80211.c */ | 1016 | /* ieee80211.c */ |
| 1021 | extern void free_ieee80211(struct net_device *dev, int monitor); | 1017 | extern void free_ieee80211(struct net_device *dev); |
| 1022 | extern struct net_device *alloc_ieee80211(int sizeof_priv, int monitor); | 1018 | extern struct net_device *alloc_ieee80211(int sizeof_priv); |
| 1023 | extern void unregister_ieee80211(struct libipw_device *ieee); | ||
| 1024 | extern int libipw_change_mtu(struct net_device *dev, int new_mtu); | 1019 | extern int libipw_change_mtu(struct net_device *dev, int new_mtu); |
| 1025 | 1020 | ||
| 1026 | extern void libipw_networks_age(struct libipw_device *ieee, | 1021 | extern void libipw_networks_age(struct libipw_device *ieee, |
diff --git a/drivers/net/wireless/ipw2x00/libipw_module.c b/drivers/net/wireless/ipw2x00/libipw_module.c index be5b809ec97a..eb2b60834c17 100644 --- a/drivers/net/wireless/ipw2x00/libipw_module.c +++ b/drivers/net/wireless/ipw2x00/libipw_module.c | |||
| @@ -62,9 +62,6 @@ MODULE_DESCRIPTION(DRV_DESCRIPTION); | |||
| 62 | MODULE_AUTHOR(DRV_COPYRIGHT); | 62 | MODULE_AUTHOR(DRV_COPYRIGHT); |
| 63 | MODULE_LICENSE("GPL"); | 63 | MODULE_LICENSE("GPL"); |
| 64 | 64 | ||
| 65 | struct cfg80211_ops libipw_config_ops = { }; | ||
| 66 | void *libipw_wiphy_privid = &libipw_wiphy_privid; | ||
| 67 | |||
| 68 | static int libipw_networks_allocate(struct libipw_device *ieee) | 65 | static int libipw_networks_allocate(struct libipw_device *ieee) |
| 69 | { | 66 | { |
| 70 | if (ieee->networks) | 67 | if (ieee->networks) |
| @@ -143,7 +140,7 @@ int libipw_change_mtu(struct net_device *dev, int new_mtu) | |||
| 143 | } | 140 | } |
| 144 | EXPORT_SYMBOL(libipw_change_mtu); | 141 | EXPORT_SYMBOL(libipw_change_mtu); |
| 145 | 142 | ||
| 146 | struct net_device *alloc_ieee80211(int sizeof_priv, int monitor) | 143 | struct net_device *alloc_ieee80211(int sizeof_priv) |
| 147 | { | 144 | { |
| 148 | struct libipw_device *ieee; | 145 | struct libipw_device *ieee; |
| 149 | struct net_device *dev; | 146 | struct net_device *dev; |
| @@ -160,31 +157,10 @@ struct net_device *alloc_ieee80211(int sizeof_priv, int monitor) | |||
| 160 | 157 | ||
| 161 | ieee->dev = dev; | 158 | ieee->dev = dev; |
| 162 | 159 | ||
| 163 | if (!monitor) { | ||
| 164 | ieee->wdev.wiphy = wiphy_new(&libipw_config_ops, 0); | ||
| 165 | if (!ieee->wdev.wiphy) { | ||
| 166 | LIBIPW_ERROR("Unable to allocate wiphy.\n"); | ||
| 167 | goto failed_free_netdev; | ||
| 168 | } | ||
| 169 | |||
| 170 | ieee->dev->ieee80211_ptr = &ieee->wdev; | ||
| 171 | ieee->wdev.iftype = NL80211_IFTYPE_STATION; | ||
| 172 | |||
| 173 | /* Fill-out wiphy structure bits we know... Not enough info | ||
| 174 | here to call set_wiphy_dev or set MAC address or channel info | ||
| 175 | -- have to do that in ->ndo_init... */ | ||
| 176 | ieee->wdev.wiphy->privid = libipw_wiphy_privid; | ||
| 177 | |||
| 178 | ieee->wdev.wiphy->max_scan_ssids = 1; | ||
| 179 | ieee->wdev.wiphy->max_scan_ie_len = 0; | ||
| 180 | ieee->wdev.wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | ||
| 181 | | BIT(NL80211_IFTYPE_ADHOC); | ||
| 182 | } | ||
| 183 | |||
| 184 | err = libipw_networks_allocate(ieee); | 160 | err = libipw_networks_allocate(ieee); |
| 185 | if (err) { | 161 | if (err) { |
| 186 | LIBIPW_ERROR("Unable to allocate beacon storage: %d\n", err); | 162 | LIBIPW_ERROR("Unable to allocate beacon storage: %d\n", err); |
| 187 | goto failed_free_wiphy; | 163 | goto failed_free_netdev; |
| 188 | } | 164 | } |
| 189 | libipw_networks_initialize(ieee); | 165 | libipw_networks_initialize(ieee); |
| 190 | 166 | ||
| @@ -217,37 +193,22 @@ struct net_device *alloc_ieee80211(int sizeof_priv, int monitor) | |||
| 217 | 193 | ||
| 218 | return dev; | 194 | return dev; |
| 219 | 195 | ||
| 220 | failed_free_wiphy: | ||
| 221 | if (!monitor) | ||
| 222 | wiphy_free(ieee->wdev.wiphy); | ||
| 223 | failed_free_netdev: | 196 | failed_free_netdev: |
| 224 | free_netdev(dev); | 197 | free_netdev(dev); |
| 225 | failed: | 198 | failed: |
| 226 | return NULL; | 199 | return NULL; |
| 227 | } | 200 | } |
| 228 | 201 | ||
| 229 | void free_ieee80211(struct net_device *dev, int monitor) | 202 | void free_ieee80211(struct net_device *dev) |
| 230 | { | 203 | { |
| 231 | struct libipw_device *ieee = netdev_priv(dev); | 204 | struct libipw_device *ieee = netdev_priv(dev); |
| 232 | 205 | ||
| 233 | lib80211_crypt_info_free(&ieee->crypt_info); | 206 | lib80211_crypt_info_free(&ieee->crypt_info); |
| 234 | 207 | ||
| 235 | libipw_networks_free(ieee); | 208 | libipw_networks_free(ieee); |
| 236 | |||
| 237 | /* free cfg80211 resources */ | ||
| 238 | if (!monitor) | ||
| 239 | wiphy_free(ieee->wdev.wiphy); | ||
| 240 | |||
| 241 | free_netdev(dev); | 209 | free_netdev(dev); |
| 242 | } | 210 | } |
| 243 | 211 | ||
| 244 | void unregister_ieee80211(struct libipw_device *ieee) | ||
| 245 | { | ||
| 246 | wiphy_unregister(ieee->wdev.wiphy); | ||
| 247 | kfree(ieee->a_band.channels); | ||
| 248 | kfree(ieee->bg_band.channels); | ||
| 249 | } | ||
| 250 | |||
| 251 | #ifdef CONFIG_LIBIPW_DEBUG | 212 | #ifdef CONFIG_LIBIPW_DEBUG |
| 252 | 213 | ||
| 253 | static int debug = 0; | 214 | static int debug = 0; |
| @@ -333,4 +294,3 @@ module_init(libipw_init); | |||
| 333 | 294 | ||
| 334 | EXPORT_SYMBOL(alloc_ieee80211); | 295 | EXPORT_SYMBOL(alloc_ieee80211); |
| 335 | EXPORT_SYMBOL(free_ieee80211); | 296 | EXPORT_SYMBOL(free_ieee80211); |
| 336 | EXPORT_SYMBOL(unregister_ieee80211); | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index 2716b91ba9fa..950267ab556a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
| @@ -161,5 +161,6 @@ struct iwl_cfg iwl1000_bgn_cfg = { | |||
| 161 | .max_ll_items = OTP_MAX_LL_ITEMS_1000, | 161 | .max_ll_items = OTP_MAX_LL_ITEMS_1000, |
| 162 | .shadow_ram_support = false, | 162 | .shadow_ram_support = false, |
| 163 | .ht_greenfield_support = true, | 163 | .ht_greenfield_support = true, |
| 164 | .use_rts_for_ht = true, /* use rts/cts protection */ | ||
| 164 | }; | 165 | }; |
| 165 | 166 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index c295b8ee9228..1473452ba22f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
| @@ -175,6 +175,7 @@ struct iwl_cfg iwl6000h_2agn_cfg = { | |||
| 175 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, | 175 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, |
| 176 | .shadow_ram_support = true, | 176 | .shadow_ram_support = true, |
| 177 | .ht_greenfield_support = true, | 177 | .ht_greenfield_support = true, |
| 178 | .use_rts_for_ht = true, /* use rts/cts protection */ | ||
| 178 | }; | 179 | }; |
| 179 | 180 | ||
| 180 | /* | 181 | /* |
| @@ -198,6 +199,7 @@ struct iwl_cfg iwl6000i_2agn_cfg = { | |||
| 198 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, | 199 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, |
| 199 | .shadow_ram_support = true, | 200 | .shadow_ram_support = true, |
| 200 | .ht_greenfield_support = true, | 201 | .ht_greenfield_support = true, |
| 202 | .use_rts_for_ht = true, /* use rts/cts protection */ | ||
| 201 | }; | 203 | }; |
| 202 | 204 | ||
| 203 | struct iwl_cfg iwl6050_2agn_cfg = { | 205 | struct iwl_cfg iwl6050_2agn_cfg = { |
| @@ -218,6 +220,7 @@ struct iwl_cfg iwl6050_2agn_cfg = { | |||
| 218 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, | 220 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, |
| 219 | .shadow_ram_support = true, | 221 | .shadow_ram_support = true, |
| 220 | .ht_greenfield_support = true, | 222 | .ht_greenfield_support = true, |
| 223 | .use_rts_for_ht = true, /* use rts/cts protection */ | ||
| 221 | }; | 224 | }; |
| 222 | 225 | ||
| 223 | struct iwl_cfg iwl6000_3agn_cfg = { | 226 | struct iwl_cfg iwl6000_3agn_cfg = { |
| @@ -238,6 +241,7 @@ struct iwl_cfg iwl6000_3agn_cfg = { | |||
| 238 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, | 241 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, |
| 239 | .shadow_ram_support = true, | 242 | .shadow_ram_support = true, |
| 240 | .ht_greenfield_support = true, | 243 | .ht_greenfield_support = true, |
| 244 | .use_rts_for_ht = true, /* use rts/cts protection */ | ||
| 241 | }; | 245 | }; |
| 242 | 246 | ||
| 243 | struct iwl_cfg iwl6050_3agn_cfg = { | 247 | struct iwl_cfg iwl6050_3agn_cfg = { |
| @@ -258,6 +262,7 @@ struct iwl_cfg iwl6050_3agn_cfg = { | |||
| 258 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, | 262 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, |
| 259 | .shadow_ram_support = true, | 263 | .shadow_ram_support = true, |
| 260 | .ht_greenfield_support = true, | 264 | .ht_greenfield_support = true, |
| 265 | .use_rts_for_ht = true, /* use rts/cts protection */ | ||
| 261 | }; | 266 | }; |
| 262 | 267 | ||
| 263 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); | 268 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 346dc06fa7b7..81726ee32858 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
| @@ -418,6 +418,15 @@ static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, | |||
| 418 | else if (tid == IWL_AGG_ALL_TID) | 418 | else if (tid == IWL_AGG_ALL_TID) |
| 419 | for (tid = 0; tid < TID_MAX_LOAD_COUNT; tid++) | 419 | for (tid = 0; tid < TID_MAX_LOAD_COUNT; tid++) |
| 420 | rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); | 420 | rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); |
| 421 | if (priv->cfg->use_rts_for_ht) { | ||
| 422 | /* | ||
| 423 | * switch to RTS/CTS if it is the prefer protection method | ||
| 424 | * for HT traffic | ||
| 425 | */ | ||
| 426 | IWL_DEBUG_HT(priv, "use RTS/CTS protection for HT\n"); | ||
| 427 | priv->staging_rxon.flags &= ~RXON_FLG_SELF_CTS_EN; | ||
| 428 | iwlcore_commit_rxon(priv); | ||
| 429 | } | ||
| 421 | } | 430 | } |
| 422 | 431 | ||
| 423 | static inline int get_num_of_ant_from_rate(u32 rate_n_flags) | 432 | static inline int get_num_of_ant_from_rate(u32 rate_n_flags) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index eaafae091f5b..921dc4a26fe2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
| @@ -116,9 +116,6 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
| 116 | 116 | ||
| 117 | /* always get timestamp with Rx frame */ | 117 | /* always get timestamp with Rx frame */ |
| 118 | priv->staging_rxon.flags |= RXON_FLG_TSF2HOST_MSK; | 118 | priv->staging_rxon.flags |= RXON_FLG_TSF2HOST_MSK; |
| 119 | /* allow CTS-to-self if possible. this is relevant only for | ||
| 120 | * 5000, but will not damage 4965 */ | ||
| 121 | priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN; | ||
| 122 | 119 | ||
| 123 | ret = iwl_check_rxon_cmd(priv); | 120 | ret = iwl_check_rxon_cmd(priv); |
| 124 | if (ret) { | 121 | if (ret) { |
| @@ -218,6 +215,13 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
| 218 | "Could not send WEP static key.\n"); | 215 | "Could not send WEP static key.\n"); |
| 219 | } | 216 | } |
| 220 | 217 | ||
| 218 | /* | ||
| 219 | * allow CTS-to-self if possible for new association. | ||
| 220 | * this is relevant only for 5000 series and up, | ||
| 221 | * but will not damage 4965 | ||
| 222 | */ | ||
| 223 | priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN; | ||
| 224 | |||
| 221 | /* Apply the new configuration | 225 | /* Apply the new configuration |
| 222 | * RXON assoc doesn't clear the station table in uCode, | 226 | * RXON assoc doesn't clear the station table in uCode, |
| 223 | */ | 227 | */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index e50103a956b1..7754538c2194 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
| @@ -213,6 +213,7 @@ struct iwl_mod_params { | |||
| 213 | * @pa_type: used by 6000 series only to identify the type of Power Amplifier | 213 | * @pa_type: used by 6000 series only to identify the type of Power Amplifier |
| 214 | * @max_ll_items: max number of OTP blocks | 214 | * @max_ll_items: max number of OTP blocks |
| 215 | * @shadow_ram_support: shadow support for OTP memory | 215 | * @shadow_ram_support: shadow support for OTP memory |
| 216 | * @use_rts_for_ht: use rts/cts protection for HT traffic | ||
| 216 | * | 217 | * |
| 217 | * We enable the driver to be backward compatible wrt API version. The | 218 | * We enable the driver to be backward compatible wrt API version. The |
| 218 | * driver specifies which APIs it supports (with @ucode_api_max being the | 219 | * driver specifies which APIs it supports (with @ucode_api_max being the |
| @@ -255,6 +256,7 @@ struct iwl_cfg { | |||
| 255 | const bool shadow_ram_support; | 256 | const bool shadow_ram_support; |
| 256 | const bool ht_greenfield_support; | 257 | const bool ht_greenfield_support; |
| 257 | const bool broken_powersave; | 258 | const bool broken_powersave; |
| 259 | bool use_rts_for_ht; | ||
| 258 | }; | 260 | }; |
| 259 | 261 | ||
| 260 | /*************************** | 262 | /*************************** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index fb9bcfa6d947..b7e196e3c8d3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
| @@ -1277,8 +1277,16 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid) | |||
| 1277 | return -ENXIO; | 1277 | return -ENXIO; |
| 1278 | } | 1278 | } |
| 1279 | 1279 | ||
| 1280 | if (priv->stations[sta_id].tid[tid].agg.state == | ||
| 1281 | IWL_EMPTYING_HW_QUEUE_ADDBA) { | ||
| 1282 | IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); | ||
| 1283 | ieee80211_stop_tx_ba_cb_irqsafe(priv->hw, ra, tid); | ||
| 1284 | priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; | ||
| 1285 | return 0; | ||
| 1286 | } | ||
| 1287 | |||
| 1280 | if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_ON) | 1288 | if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_ON) |
| 1281 | IWL_WARN(priv, "Stopping AGG while state not IWL_AGG_ON\n"); | 1289 | IWL_WARN(priv, "Stopping AGG while state not ON or starting\n"); |
| 1282 | 1290 | ||
| 1283 | tid_data = &priv->stations[sta_id].tid[tid]; | 1291 | tid_data = &priv->stations[sta_id].tid[tid]; |
| 1284 | ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4; | 1292 | ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4; |
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c index 039b555e4d76..53d56ab83c03 100644 --- a/drivers/net/wireless/libertas/ethtool.c +++ b/drivers/net/wireless/libertas/ethtool.c | |||
| @@ -169,16 +169,19 @@ static int lbs_ethtool_set_wol(struct net_device *dev, | |||
| 169 | struct lbs_private *priv = dev->ml_priv; | 169 | struct lbs_private *priv = dev->ml_priv; |
| 170 | uint32_t criteria = 0; | 170 | uint32_t criteria = 0; |
| 171 | 171 | ||
| 172 | if (priv->wol_criteria == 0xffffffff && wol->wolopts) | ||
| 173 | return -EOPNOTSUPP; | ||
| 174 | |||
| 175 | if (wol->wolopts & ~(WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY)) | 172 | if (wol->wolopts & ~(WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY)) |
| 176 | return -EOPNOTSUPP; | 173 | return -EOPNOTSUPP; |
| 177 | 174 | ||
| 178 | if (wol->wolopts & WAKE_UCAST) criteria |= EHS_WAKE_ON_UNICAST_DATA; | 175 | if (wol->wolopts & WAKE_UCAST) |
| 179 | if (wol->wolopts & WAKE_MCAST) criteria |= EHS_WAKE_ON_MULTICAST_DATA; | 176 | criteria |= EHS_WAKE_ON_UNICAST_DATA; |
| 180 | if (wol->wolopts & WAKE_BCAST) criteria |= EHS_WAKE_ON_BROADCAST_DATA; | 177 | if (wol->wolopts & WAKE_MCAST) |
| 181 | if (wol->wolopts & WAKE_PHY) criteria |= EHS_WAKE_ON_MAC_EVENT; | 178 | criteria |= EHS_WAKE_ON_MULTICAST_DATA; |
| 179 | if (wol->wolopts & WAKE_BCAST) | ||
| 180 | criteria |= EHS_WAKE_ON_BROADCAST_DATA; | ||
| 181 | if (wol->wolopts & WAKE_PHY) | ||
| 182 | criteria |= EHS_WAKE_ON_MAC_EVENT; | ||
| 183 | if (wol->wolopts == 0) | ||
| 184 | criteria |= EHS_REMOVE_WAKEUP; | ||
| 182 | 185 | ||
| 183 | return lbs_host_sleep_cfg(priv, criteria, (struct wol_config *)NULL); | 186 | return lbs_host_sleep_cfg(priv, criteria, (struct wol_config *)NULL); |
| 184 | } | 187 | } |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 62381768f2d5..b1d84592b959 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
| @@ -590,7 +590,7 @@ static int if_cs_prog_helper(struct if_cs_card *card) | |||
| 590 | 590 | ||
| 591 | /* TODO: make firmware file configurable */ | 591 | /* TODO: make firmware file configurable */ |
| 592 | ret = request_firmware(&fw, "libertas_cs_helper.fw", | 592 | ret = request_firmware(&fw, "libertas_cs_helper.fw", |
| 593 | &handle_to_dev(card->p_dev)); | 593 | &card->p_dev->dev); |
| 594 | if (ret) { | 594 | if (ret) { |
| 595 | lbs_pr_err("can't load helper firmware\n"); | 595 | lbs_pr_err("can't load helper firmware\n"); |
| 596 | ret = -ENODEV; | 596 | ret = -ENODEV; |
| @@ -663,7 +663,7 @@ static int if_cs_prog_real(struct if_cs_card *card) | |||
| 663 | 663 | ||
| 664 | /* TODO: make firmware file configurable */ | 664 | /* TODO: make firmware file configurable */ |
| 665 | ret = request_firmware(&fw, "libertas_cs.fw", | 665 | ret = request_firmware(&fw, "libertas_cs.fw", |
| 666 | &handle_to_dev(card->p_dev)); | 666 | &card->p_dev->dev); |
| 667 | if (ret) { | 667 | if (ret) { |
| 668 | lbs_pr_err("can't load firmware\n"); | 668 | lbs_pr_err("can't load firmware\n"); |
| 669 | ret = -ENODEV; | 669 | ret = -ENODEV; |
| @@ -793,18 +793,37 @@ static void if_cs_release(struct pcmcia_device *p_dev) | |||
| 793 | * configure the card at this point -- we wait until we receive a card | 793 | * configure the card at this point -- we wait until we receive a card |
| 794 | * insertion event. | 794 | * insertion event. |
| 795 | */ | 795 | */ |
| 796 | |||
| 797 | static int if_cs_ioprobe(struct pcmcia_device *p_dev, | ||
| 798 | cistpl_cftable_entry_t *cfg, | ||
| 799 | cistpl_cftable_entry_t *dflt, | ||
| 800 | unsigned int vcc, | ||
| 801 | void *priv_data) | ||
| 802 | { | ||
| 803 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 804 | p_dev->io.BasePort1 = cfg->io.win[0].base; | ||
| 805 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | ||
| 806 | |||
| 807 | /* Do we need to allocate an interrupt? */ | ||
| 808 | if (cfg->irq.IRQInfo1) | ||
| 809 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
| 810 | |||
| 811 | /* IO window settings */ | ||
| 812 | if (cfg->io.nwin != 1) { | ||
| 813 | lbs_pr_err("wrong CIS (check number of IO windows)\n"); | ||
| 814 | return -ENODEV; | ||
| 815 | } | ||
| 816 | |||
| 817 | /* This reserves IO space but doesn't actually enable it */ | ||
| 818 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
| 819 | } | ||
| 820 | |||
| 796 | static int if_cs_probe(struct pcmcia_device *p_dev) | 821 | static int if_cs_probe(struct pcmcia_device *p_dev) |
| 797 | { | 822 | { |
| 798 | int ret = -ENOMEM; | 823 | int ret = -ENOMEM; |
| 799 | unsigned int prod_id; | 824 | unsigned int prod_id; |
| 800 | struct lbs_private *priv; | 825 | struct lbs_private *priv; |
| 801 | struct if_cs_card *card; | 826 | struct if_cs_card *card; |
| 802 | /* CIS parsing */ | ||
| 803 | tuple_t tuple; | ||
| 804 | cisparse_t parse; | ||
| 805 | cistpl_cftable_entry_t *cfg = &parse.cftable_entry; | ||
| 806 | cistpl_io_t *io = &cfg->io; | ||
| 807 | u_char buf[64]; | ||
| 808 | 827 | ||
| 809 | lbs_deb_enter(LBS_DEB_CS); | 828 | lbs_deb_enter(LBS_DEB_CS); |
| 810 | 829 | ||
| @@ -818,48 +837,15 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
| 818 | 837 | ||
| 819 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 838 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 820 | p_dev->irq.Handler = NULL; | 839 | p_dev->irq.Handler = NULL; |
| 821 | p_dev->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID; | ||
| 822 | 840 | ||
| 823 | p_dev->conf.Attributes = 0; | 841 | p_dev->conf.Attributes = 0; |
| 824 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 842 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
| 825 | 843 | ||
| 826 | tuple.Attributes = 0; | 844 | if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { |
| 827 | tuple.TupleData = buf; | 845 | lbs_pr_err("error in pcmcia_loop_config\n"); |
| 828 | tuple.TupleDataMax = sizeof(buf); | ||
| 829 | tuple.TupleOffset = 0; | ||
| 830 | |||
| 831 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 832 | if ((ret = pcmcia_get_first_tuple(p_dev, &tuple)) != 0 || | ||
| 833 | (ret = pcmcia_get_tuple_data(p_dev, &tuple)) != 0 || | ||
| 834 | (ret = pcmcia_parse_tuple(&tuple, &parse)) != 0) | ||
| 835 | { | ||
| 836 | lbs_pr_err("error in pcmcia_get_first_tuple etc\n"); | ||
| 837 | goto out1; | ||
| 838 | } | ||
| 839 | |||
| 840 | p_dev->conf.ConfigIndex = cfg->index; | ||
| 841 | |||
| 842 | /* Do we need to allocate an interrupt? */ | ||
| 843 | if (cfg->irq.IRQInfo1) { | ||
| 844 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
| 845 | } | ||
| 846 | |||
| 847 | /* IO window settings */ | ||
| 848 | if (cfg->io.nwin != 1) { | ||
| 849 | lbs_pr_err("wrong CIS (check number of IO windows)\n"); | ||
| 850 | ret = -ENODEV; | ||
| 851 | goto out1; | 846 | goto out1; |
| 852 | } | 847 | } |
| 853 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 854 | p_dev->io.BasePort1 = io->win[0].base; | ||
| 855 | p_dev->io.NumPorts1 = io->win[0].len; | ||
| 856 | 848 | ||
| 857 | /* This reserves IO space but doesn't actually enable it */ | ||
| 858 | ret = pcmcia_request_io(p_dev, &p_dev->io); | ||
| 859 | if (ret) { | ||
| 860 | lbs_pr_err("error in pcmcia_request_io\n"); | ||
| 861 | goto out1; | ||
| 862 | } | ||
| 863 | 849 | ||
| 864 | /* | 850 | /* |
| 865 | * Allocate an interrupt line. Note that this does not assign | 851 | * Allocate an interrupt line. Note that this does not assign |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 9498b46c99a4..e61e6b9440ab 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
| @@ -145,23 +145,6 @@ static const unsigned int txConfEUD = 0x10; /* Enable Uni-Data packets */ | |||
| 145 | static const unsigned int txConfKey = 0x02; /* Scramble data packets */ | 145 | static const unsigned int txConfKey = 0x02; /* Scramble data packets */ |
| 146 | static const unsigned int txConfLoop = 0x01; /* Loopback mode */ | 146 | static const unsigned int txConfLoop = 0x01; /* Loopback mode */ |
| 147 | 147 | ||
| 148 | /* | ||
| 149 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 150 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 151 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 152 | be present but disabled -- but it can then be enabled for specific | ||
| 153 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 154 | */ | ||
| 155 | |||
| 156 | #ifdef PCMCIA_DEBUG | ||
| 157 | static int pc_debug = PCMCIA_DEBUG; | ||
| 158 | module_param(pc_debug, int, 0); | ||
| 159 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 160 | static char *version = | ||
| 161 | "netwave_cs.c 0.3.0 Thu Jul 17 14:36:02 1997 (John Markus Bjørndalen)\n"; | ||
| 162 | #else | ||
| 163 | #define DEBUG(n, args...) | ||
| 164 | #endif | ||
| 165 | 148 | ||
| 166 | /*====================================================================*/ | 149 | /*====================================================================*/ |
| 167 | 150 | ||
| @@ -383,7 +366,7 @@ static int netwave_probe(struct pcmcia_device *link) | |||
| 383 | struct net_device *dev; | 366 | struct net_device *dev; |
| 384 | netwave_private *priv; | 367 | netwave_private *priv; |
| 385 | 368 | ||
| 386 | DEBUG(0, "netwave_attach()\n"); | 369 | dev_dbg(&link->dev, "netwave_attach()\n"); |
| 387 | 370 | ||
| 388 | /* Initialize the struct pcmcia_device structure */ | 371 | /* Initialize the struct pcmcia_device structure */ |
| 389 | dev = alloc_etherdev(sizeof(netwave_private)); | 372 | dev = alloc_etherdev(sizeof(netwave_private)); |
| @@ -401,8 +384,7 @@ static int netwave_probe(struct pcmcia_device *link) | |||
| 401 | link->io.IOAddrLines = 5; | 384 | link->io.IOAddrLines = 5; |
| 402 | 385 | ||
| 403 | /* Interrupt setup */ | 386 | /* Interrupt setup */ |
| 404 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 387 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 405 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 406 | link->irq.Handler = &netwave_interrupt; | 388 | link->irq.Handler = &netwave_interrupt; |
| 407 | 389 | ||
| 408 | /* General socket configuration */ | 390 | /* General socket configuration */ |
| @@ -421,8 +403,6 @@ static int netwave_probe(struct pcmcia_device *link) | |||
| 421 | 403 | ||
| 422 | dev->watchdog_timeo = TX_TIMEOUT; | 404 | dev->watchdog_timeo = TX_TIMEOUT; |
| 423 | 405 | ||
| 424 | link->irq.Instance = dev; | ||
| 425 | |||
| 426 | return netwave_pcmcia_config( link); | 406 | return netwave_pcmcia_config( link); |
| 427 | } /* netwave_attach */ | 407 | } /* netwave_attach */ |
| 428 | 408 | ||
| @@ -438,7 +418,7 @@ static void netwave_detach(struct pcmcia_device *link) | |||
| 438 | { | 418 | { |
| 439 | struct net_device *dev = link->priv; | 419 | struct net_device *dev = link->priv; |
| 440 | 420 | ||
| 441 | DEBUG(0, "netwave_detach(0x%p)\n", link); | 421 | dev_dbg(&link->dev, "netwave_detach\n"); |
| 442 | 422 | ||
| 443 | netwave_release(link); | 423 | netwave_release(link); |
| 444 | 424 | ||
| @@ -725,18 +705,15 @@ static const struct iw_handler_def netwave_handler_def = | |||
| 725 | * | 705 | * |
| 726 | */ | 706 | */ |
| 727 | 707 | ||
| 728 | #define CS_CHECK(fn, ret) \ | ||
| 729 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 730 | |||
| 731 | static int netwave_pcmcia_config(struct pcmcia_device *link) { | 708 | static int netwave_pcmcia_config(struct pcmcia_device *link) { |
| 732 | struct net_device *dev = link->priv; | 709 | struct net_device *dev = link->priv; |
| 733 | netwave_private *priv = netdev_priv(dev); | 710 | netwave_private *priv = netdev_priv(dev); |
| 734 | int i, j, last_ret, last_fn; | 711 | int i, j, ret; |
| 735 | win_req_t req; | 712 | win_req_t req; |
| 736 | memreq_t mem; | 713 | memreq_t mem; |
| 737 | u_char __iomem *ramBase = NULL; | 714 | u_char __iomem *ramBase = NULL; |
| 738 | 715 | ||
| 739 | DEBUG(0, "netwave_pcmcia_config(0x%p)\n", link); | 716 | dev_dbg(&link->dev, "netwave_pcmcia_config\n"); |
| 740 | 717 | ||
| 741 | /* | 718 | /* |
| 742 | * Try allocating IO ports. This tries a few fixed addresses. | 719 | * Try allocating IO ports. This tries a few fixed addresses. |
| @@ -749,22 +726,24 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
| 749 | if (i == 0) | 726 | if (i == 0) |
| 750 | break; | 727 | break; |
| 751 | } | 728 | } |
| 752 | if (i != 0) { | 729 | if (i != 0) |
| 753 | cs_error(link, RequestIO, i); | ||
| 754 | goto failed; | 730 | goto failed; |
| 755 | } | ||
| 756 | 731 | ||
| 757 | /* | 732 | /* |
| 758 | * Now allocate an interrupt line. Note that this does not | 733 | * Now allocate an interrupt line. Note that this does not |
| 759 | * actually assign a handler to the interrupt. | 734 | * actually assign a handler to the interrupt. |
| 760 | */ | 735 | */ |
| 761 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 736 | ret = pcmcia_request_irq(link, &link->irq); |
| 737 | if (ret) | ||
| 738 | goto failed; | ||
| 762 | 739 | ||
| 763 | /* | 740 | /* |
| 764 | * This actually configures the PCMCIA socket -- setting up | 741 | * This actually configures the PCMCIA socket -- setting up |
| 765 | * the I/O windows and the interrupt mapping. | 742 | * the I/O windows and the interrupt mapping. |
| 766 | */ | 743 | */ |
| 767 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 744 | ret = pcmcia_request_configuration(link, &link->conf); |
| 745 | if (ret) | ||
| 746 | goto failed; | ||
| 768 | 747 | ||
| 769 | /* | 748 | /* |
| 770 | * Allocate a 32K memory window. Note that the struct pcmcia_device | 749 | * Allocate a 32K memory window. Note that the struct pcmcia_device |
| @@ -772,14 +751,18 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
| 772 | * device needs several windows, you'll need to keep track of | 751 | * device needs several windows, you'll need to keep track of |
| 773 | * the handles in your private data structure, dev->priv. | 752 | * the handles in your private data structure, dev->priv. |
| 774 | */ | 753 | */ |
| 775 | DEBUG(1, "Setting mem speed of %d\n", mem_speed); | 754 | dev_dbg(&link->dev, "Setting mem speed of %d\n", mem_speed); |
| 776 | 755 | ||
| 777 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE; | 756 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE; |
| 778 | req.Base = 0; req.Size = 0x8000; | 757 | req.Base = 0; req.Size = 0x8000; |
| 779 | req.AccessSpeed = mem_speed; | 758 | req.AccessSpeed = mem_speed; |
| 780 | CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); | 759 | ret = pcmcia_request_window(link, &req, &link->win); |
| 760 | if (ret) | ||
| 761 | goto failed; | ||
| 781 | mem.CardOffset = 0x20000; mem.Page = 0; | 762 | mem.CardOffset = 0x20000; mem.Page = 0; |
| 782 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); | 763 | ret = pcmcia_map_mem_page(link, link->win, &mem); |
| 764 | if (ret) | ||
| 765 | goto failed; | ||
| 783 | 766 | ||
| 784 | /* Store base address of the common window frame */ | 767 | /* Store base address of the common window frame */ |
| 785 | ramBase = ioremap(req.Base, 0x8000); | 768 | ramBase = ioremap(req.Base, 0x8000); |
| @@ -787,7 +770,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
| 787 | 770 | ||
| 788 | dev->irq = link->irq.AssignedIRQ; | 771 | dev->irq = link->irq.AssignedIRQ; |
| 789 | dev->base_addr = link->io.BasePort1; | 772 | dev->base_addr = link->io.BasePort1; |
| 790 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 773 | SET_NETDEV_DEV(dev, &link->dev); |
| 791 | 774 | ||
| 792 | if (register_netdev(dev) != 0) { | 775 | if (register_netdev(dev) != 0) { |
| 793 | printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n"); | 776 | printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n"); |
| @@ -818,8 +801,6 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
| 818 | get_uint16(ramBase + NETWAVE_EREG_ARW+2)); | 801 | get_uint16(ramBase + NETWAVE_EREG_ARW+2)); |
| 819 | return 0; | 802 | return 0; |
| 820 | 803 | ||
| 821 | cs_failed: | ||
| 822 | cs_error(link, last_fn, last_ret); | ||
| 823 | failed: | 804 | failed: |
| 824 | netwave_release(link); | 805 | netwave_release(link); |
| 825 | return -ENODEV; | 806 | return -ENODEV; |
| @@ -837,7 +818,7 @@ static void netwave_release(struct pcmcia_device *link) | |||
| 837 | struct net_device *dev = link->priv; | 818 | struct net_device *dev = link->priv; |
| 838 | netwave_private *priv = netdev_priv(dev); | 819 | netwave_private *priv = netdev_priv(dev); |
| 839 | 820 | ||
| 840 | DEBUG(0, "netwave_release(0x%p)\n", link); | 821 | dev_dbg(&link->dev, "netwave_release\n"); |
| 841 | 822 | ||
| 842 | pcmcia_disable_device(link); | 823 | pcmcia_disable_device(link); |
| 843 | if (link->win) | 824 | if (link->win) |
| @@ -892,7 +873,7 @@ static void netwave_reset(struct net_device *dev) { | |||
| 892 | u_char __iomem *ramBase = priv->ramBase; | 873 | u_char __iomem *ramBase = priv->ramBase; |
| 893 | unsigned int iobase = dev->base_addr; | 874 | unsigned int iobase = dev->base_addr; |
| 894 | 875 | ||
| 895 | DEBUG(0, "netwave_reset: Done with hardware reset\n"); | 876 | pr_debug("netwave_reset: Done with hardware reset\n"); |
| 896 | 877 | ||
| 897 | priv->timeoutCounter = 0; | 878 | priv->timeoutCounter = 0; |
| 898 | 879 | ||
| @@ -988,7 +969,7 @@ static int netwave_hw_xmit(unsigned char* data, int len, | |||
| 988 | 969 | ||
| 989 | dev->stats.tx_bytes += len; | 970 | dev->stats.tx_bytes += len; |
| 990 | 971 | ||
| 991 | DEBUG(3, "Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n", | 972 | pr_debug("Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n", |
| 992 | readb(ramBase + NETWAVE_EREG_SPCQ), | 973 | readb(ramBase + NETWAVE_EREG_SPCQ), |
| 993 | readb(ramBase + NETWAVE_EREG_SPU), | 974 | readb(ramBase + NETWAVE_EREG_SPU), |
| 994 | readb(ramBase + NETWAVE_EREG_LIF), | 975 | readb(ramBase + NETWAVE_EREG_LIF), |
| @@ -1000,7 +981,7 @@ static int netwave_hw_xmit(unsigned char* data, int len, | |||
| 1000 | MaxData = get_uint16(ramBase + NETWAVE_EREG_TDP+2); | 981 | MaxData = get_uint16(ramBase + NETWAVE_EREG_TDP+2); |
| 1001 | DataOffset = get_uint16(ramBase + NETWAVE_EREG_TDP+4); | 982 | DataOffset = get_uint16(ramBase + NETWAVE_EREG_TDP+4); |
| 1002 | 983 | ||
| 1003 | DEBUG(3, "TxFreeList %x, MaxData %x, DataOffset %x\n", | 984 | pr_debug("TxFreeList %x, MaxData %x, DataOffset %x\n", |
| 1004 | TxFreeList, MaxData, DataOffset); | 985 | TxFreeList, MaxData, DataOffset); |
| 1005 | 986 | ||
| 1006 | /* Copy packet to the adapter fragment buffers */ | 987 | /* Copy packet to the adapter fragment buffers */ |
| @@ -1088,7 +1069,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
| 1088 | status = inb(iobase + NETWAVE_REG_ASR); | 1069 | status = inb(iobase + NETWAVE_REG_ASR); |
| 1089 | 1070 | ||
| 1090 | if (!pcmcia_dev_present(link)) { | 1071 | if (!pcmcia_dev_present(link)) { |
| 1091 | DEBUG(1, "netwave_interrupt: Interrupt with status 0x%x " | 1072 | pr_debug("netwave_interrupt: Interrupt with status 0x%x " |
| 1092 | "from removed or suspended card!\n", status); | 1073 | "from removed or suspended card!\n", status); |
| 1093 | break; | 1074 | break; |
| 1094 | } | 1075 | } |
| @@ -1132,7 +1113,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
| 1132 | int txStatus; | 1113 | int txStatus; |
| 1133 | 1114 | ||
| 1134 | txStatus = readb(ramBase + NETWAVE_EREG_TSER); | 1115 | txStatus = readb(ramBase + NETWAVE_EREG_TSER); |
| 1135 | DEBUG(3, "Transmit done. TSER = %x id %x\n", | 1116 | pr_debug("Transmit done. TSER = %x id %x\n", |
| 1136 | txStatus, readb(ramBase + NETWAVE_EREG_TSER + 1)); | 1117 | txStatus, readb(ramBase + NETWAVE_EREG_TSER + 1)); |
| 1137 | 1118 | ||
| 1138 | if (txStatus & 0x20) { | 1119 | if (txStatus & 0x20) { |
| @@ -1156,7 +1137,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
| 1156 | * TxGU and TxNOAP is set. (Those are the only ones | 1137 | * TxGU and TxNOAP is set. (Those are the only ones |
| 1157 | * to set TxErr). | 1138 | * to set TxErr). |
| 1158 | */ | 1139 | */ |
| 1159 | DEBUG(3, "netwave_interrupt: TxDN with error status %x\n", | 1140 | pr_debug("netwave_interrupt: TxDN with error status %x\n", |
| 1160 | txStatus); | 1141 | txStatus); |
| 1161 | 1142 | ||
| 1162 | /* Clear out TxGU, TxNOAP, TxErr and TxTrys */ | 1143 | /* Clear out TxGU, TxNOAP, TxErr and TxTrys */ |
| @@ -1164,7 +1145,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
| 1164 | writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4); | 1145 | writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4); |
| 1165 | ++dev->stats.tx_errors; | 1146 | ++dev->stats.tx_errors; |
| 1166 | } | 1147 | } |
| 1167 | DEBUG(3, "New status is TSER %x ASR %x\n", | 1148 | pr_debug("New status is TSER %x ASR %x\n", |
| 1168 | readb(ramBase + NETWAVE_EREG_TSER), | 1149 | readb(ramBase + NETWAVE_EREG_TSER), |
| 1169 | inb(iobase + NETWAVE_REG_ASR)); | 1150 | inb(iobase + NETWAVE_REG_ASR)); |
| 1170 | 1151 | ||
| @@ -1172,7 +1153,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
| 1172 | } | 1153 | } |
| 1173 | /* TxBA, this would trigger on all error packets received */ | 1154 | /* TxBA, this would trigger on all error packets received */ |
| 1174 | /* if (status & 0x01) { | 1155 | /* if (status & 0x01) { |
| 1175 | DEBUG(4, "Transmit buffers available, %x\n", status); | 1156 | pr_debug("Transmit buffers available, %x\n", status); |
| 1176 | } | 1157 | } |
| 1177 | */ | 1158 | */ |
| 1178 | } | 1159 | } |
| @@ -1190,7 +1171,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
| 1190 | */ | 1171 | */ |
| 1191 | static void netwave_watchdog(struct net_device *dev) { | 1172 | static void netwave_watchdog(struct net_device *dev) { |
| 1192 | 1173 | ||
| 1193 | DEBUG(1, "%s: netwave_watchdog: watchdog timer expired\n", dev->name); | 1174 | pr_debug("%s: netwave_watchdog: watchdog timer expired\n", dev->name); |
| 1194 | netwave_reset(dev); | 1175 | netwave_reset(dev); |
| 1195 | dev->trans_start = jiffies; | 1176 | dev->trans_start = jiffies; |
| 1196 | netif_wake_queue(dev); | 1177 | netif_wake_queue(dev); |
| @@ -1211,7 +1192,7 @@ static int netwave_rx(struct net_device *dev) | |||
| 1211 | int i; | 1192 | int i; |
| 1212 | u_char *ptr; | 1193 | u_char *ptr; |
| 1213 | 1194 | ||
| 1214 | DEBUG(3, "xinw_rx: Receiving ... \n"); | 1195 | pr_debug("xinw_rx: Receiving ... \n"); |
| 1215 | 1196 | ||
| 1216 | /* Receive max 10 packets for now. */ | 1197 | /* Receive max 10 packets for now. */ |
| 1217 | for (i = 0; i < 10; i++) { | 1198 | for (i = 0; i < 10; i++) { |
| @@ -1237,7 +1218,7 @@ static int netwave_rx(struct net_device *dev) | |||
| 1237 | 1218 | ||
| 1238 | skb = dev_alloc_skb(rcvLen+5); | 1219 | skb = dev_alloc_skb(rcvLen+5); |
| 1239 | if (skb == NULL) { | 1220 | if (skb == NULL) { |
| 1240 | DEBUG(1, "netwave_rx: Could not allocate an sk_buff of " | 1221 | pr_debug("netwave_rx: Could not allocate an sk_buff of " |
| 1241 | "length %d\n", rcvLen); | 1222 | "length %d\n", rcvLen); |
| 1242 | ++dev->stats.rx_dropped; | 1223 | ++dev->stats.rx_dropped; |
| 1243 | /* Tell the adapter to skip the packet */ | 1224 | /* Tell the adapter to skip the packet */ |
| @@ -1279,7 +1260,7 @@ static int netwave_rx(struct net_device *dev) | |||
| 1279 | wait_WOC(iobase); | 1260 | wait_WOC(iobase); |
| 1280 | writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0); | 1261 | writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0); |
| 1281 | writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1); | 1262 | writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1); |
| 1282 | DEBUG(3, "Packet reception ok\n"); | 1263 | pr_debug("Packet reception ok\n"); |
| 1283 | } | 1264 | } |
| 1284 | return 0; | 1265 | return 0; |
| 1285 | } | 1266 | } |
| @@ -1288,7 +1269,7 @@ static int netwave_open(struct net_device *dev) { | |||
| 1288 | netwave_private *priv = netdev_priv(dev); | 1269 | netwave_private *priv = netdev_priv(dev); |
| 1289 | struct pcmcia_device *link = priv->p_dev; | 1270 | struct pcmcia_device *link = priv->p_dev; |
| 1290 | 1271 | ||
| 1291 | DEBUG(1, "netwave_open: starting.\n"); | 1272 | dev_dbg(&link->dev, "netwave_open: starting.\n"); |
| 1292 | 1273 | ||
| 1293 | if (!pcmcia_dev_present(link)) | 1274 | if (!pcmcia_dev_present(link)) |
| 1294 | return -ENODEV; | 1275 | return -ENODEV; |
| @@ -1305,7 +1286,7 @@ static int netwave_close(struct net_device *dev) { | |||
| 1305 | netwave_private *priv = netdev_priv(dev); | 1286 | netwave_private *priv = netdev_priv(dev); |
| 1306 | struct pcmcia_device *link = priv->p_dev; | 1287 | struct pcmcia_device *link = priv->p_dev; |
| 1307 | 1288 | ||
| 1308 | DEBUG(1, "netwave_close: finishing.\n"); | 1289 | dev_dbg(&link->dev, "netwave_close: finishing.\n"); |
| 1309 | 1290 | ||
| 1310 | link->open--; | 1291 | link->open--; |
| 1311 | netif_stop_queue(dev); | 1292 | netif_stop_queue(dev); |
| @@ -1358,11 +1339,11 @@ static void set_multicast_list(struct net_device *dev) | |||
| 1358 | u_char rcvMode = 0; | 1339 | u_char rcvMode = 0; |
| 1359 | 1340 | ||
| 1360 | #ifdef PCMCIA_DEBUG | 1341 | #ifdef PCMCIA_DEBUG |
| 1361 | if (pc_debug > 2) { | 1342 | { |
| 1362 | static int old; | 1343 | xstatic int old; |
| 1363 | if (old != dev->mc_count) { | 1344 | if (old != dev->mc_count) { |
| 1364 | old = dev->mc_count; | 1345 | old = dev->mc_count; |
| 1365 | DEBUG(0, "%s: setting Rx mode to %d addresses.\n", | 1346 | pr_debug("%s: setting Rx mode to %d addresses.\n", |
| 1366 | dev->name, dev->mc_count); | 1347 | dev->name, dev->mc_count); |
| 1367 | } | 1348 | } |
| 1368 | } | 1349 | } |
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index 38c1c9d2abb8..f27bb8367c98 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c | |||
| @@ -109,7 +109,7 @@ orinoco_cs_probe(struct pcmcia_device *link) | |||
| 109 | struct orinoco_private *priv; | 109 | struct orinoco_private *priv; |
| 110 | struct orinoco_pccard *card; | 110 | struct orinoco_pccard *card; |
| 111 | 111 | ||
| 112 | priv = alloc_orinocodev(sizeof(*card), &handle_to_dev(link), | 112 | priv = alloc_orinocodev(sizeof(*card), &link->dev, |
| 113 | orinoco_cs_hard_reset, NULL); | 113 | orinoco_cs_hard_reset, NULL); |
| 114 | if (!priv) | 114 | if (!priv) |
| 115 | return -ENOMEM; | 115 | return -ENOMEM; |
| @@ -120,10 +120,8 @@ orinoco_cs_probe(struct pcmcia_device *link) | |||
| 120 | link->priv = priv; | 120 | link->priv = priv; |
| 121 | 121 | ||
| 122 | /* Interrupt setup */ | 122 | /* Interrupt setup */ |
| 123 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 123 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 124 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 125 | link->irq.Handler = orinoco_interrupt; | 124 | link->irq.Handler = orinoco_interrupt; |
| 126 | link->irq.Instance = priv; | ||
| 127 | 125 | ||
| 128 | /* General socket configuration defaults can go here. In this | 126 | /* General socket configuration defaults can go here. In this |
| 129 | * client, we assume very little, and rely on the CIS for | 127 | * client, we assume very little, and rely on the CIS for |
| @@ -160,12 +158,6 @@ static void orinoco_cs_detach(struct pcmcia_device *link) | |||
| 160 | * device available to the system. | 158 | * device available to the system. |
| 161 | */ | 159 | */ |
| 162 | 160 | ||
| 163 | #define CS_CHECK(fn, ret) do { \ | ||
| 164 | last_fn = (fn); \ | ||
| 165 | if ((last_ret = (ret)) != 0) \ | ||
| 166 | goto cs_failed; \ | ||
| 167 | } while (0) | ||
| 168 | |||
| 169 | static int orinoco_cs_config_check(struct pcmcia_device *p_dev, | 161 | static int orinoco_cs_config_check(struct pcmcia_device *p_dev, |
| 170 | cistpl_cftable_entry_t *cfg, | 162 | cistpl_cftable_entry_t *cfg, |
| 171 | cistpl_cftable_entry_t *dflt, | 163 | cistpl_cftable_entry_t *dflt, |
| @@ -240,7 +232,7 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
| 240 | struct orinoco_private *priv = link->priv; | 232 | struct orinoco_private *priv = link->priv; |
| 241 | struct orinoco_pccard *card = priv->card; | 233 | struct orinoco_pccard *card = priv->card; |
| 242 | hermes_t *hw = &priv->hw; | 234 | hermes_t *hw = &priv->hw; |
| 243 | int last_fn, last_ret; | 235 | int ret; |
| 244 | void __iomem *mem; | 236 | void __iomem *mem; |
| 245 | 237 | ||
| 246 | /* | 238 | /* |
| @@ -257,13 +249,12 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
| 257 | * and most client drivers will only use the CIS to fill in | 249 | * and most client drivers will only use the CIS to fill in |
| 258 | * implementation-defined details. | 250 | * implementation-defined details. |
| 259 | */ | 251 | */ |
| 260 | last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); | 252 | ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); |
| 261 | if (last_ret) { | 253 | if (ret) { |
| 262 | if (!ignore_cis_vcc) | 254 | if (!ignore_cis_vcc) |
| 263 | printk(KERN_ERR PFX "GetNextTuple(): No matching " | 255 | printk(KERN_ERR PFX "GetNextTuple(): No matching " |
| 264 | "CIS configuration. Maybe you need the " | 256 | "CIS configuration. Maybe you need the " |
| 265 | "ignore_cis_vcc=1 parameter.\n"); | 257 | "ignore_cis_vcc=1 parameter.\n"); |
| 266 | cs_error(link, RequestIO, last_ret); | ||
| 267 | goto failed; | 258 | goto failed; |
| 268 | } | 259 | } |
| 269 | 260 | ||
| @@ -272,14 +263,16 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
| 272 | * a handler to the interrupt, unless the 'Handler' member of | 263 | * a handler to the interrupt, unless the 'Handler' member of |
| 273 | * the irq structure is initialized. | 264 | * the irq structure is initialized. |
| 274 | */ | 265 | */ |
| 275 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 266 | ret = pcmcia_request_irq(link, &link->irq); |
| 267 | if (ret) | ||
| 268 | goto failed; | ||
| 276 | 269 | ||
| 277 | /* We initialize the hermes structure before completing PCMCIA | 270 | /* We initialize the hermes structure before completing PCMCIA |
| 278 | * configuration just in case the interrupt handler gets | 271 | * configuration just in case the interrupt handler gets |
| 279 | * called. */ | 272 | * called. */ |
| 280 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); | 273 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); |
| 281 | if (!mem) | 274 | if (!mem) |
| 282 | goto cs_failed; | 275 | goto failed; |
| 283 | 276 | ||
| 284 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); | 277 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); |
| 285 | 278 | ||
| @@ -288,8 +281,9 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
| 288 | * the I/O windows and the interrupt mapping, and putting the | 281 | * the I/O windows and the interrupt mapping, and putting the |
| 289 | * card and host interface into "Memory and IO" mode. | 282 | * card and host interface into "Memory and IO" mode. |
| 290 | */ | 283 | */ |
| 291 | CS_CHECK(RequestConfiguration, | 284 | ret = pcmcia_request_configuration(link, &link->conf); |
| 292 | pcmcia_request_configuration(link, &link->conf)); | 285 | if (ret) |
| 286 | goto failed; | ||
| 293 | 287 | ||
| 294 | /* Ok, we have the configuration, prepare to register the netdev */ | 288 | /* Ok, we have the configuration, prepare to register the netdev */ |
| 295 | card->node.major = card->node.minor = 0; | 289 | card->node.major = card->node.minor = 0; |
| @@ -315,9 +309,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
| 315 | * net_device has been registered */ | 309 | * net_device has been registered */ |
| 316 | return 0; | 310 | return 0; |
| 317 | 311 | ||
| 318 | cs_failed: | ||
| 319 | cs_error(link, last_fn, last_ret); | ||
| 320 | |||
| 321 | failed: | 312 | failed: |
| 322 | orinoco_cs_release(link); | 313 | orinoco_cs_release(link); |
| 323 | return -ENODEV; | 314 | return -ENODEV; |
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index c361310b885d..59bda240fdc2 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c | |||
| @@ -73,9 +73,6 @@ static void spectrum_cs_release(struct pcmcia_device *link); | |||
| 73 | #define HCR_MEM16 0x10 /* memory width bit, should be preserved */ | 73 | #define HCR_MEM16 0x10 /* memory width bit, should be preserved */ |
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | #define CS_CHECK(fn, ret) \ | ||
| 77 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 78 | |||
| 79 | /* | 76 | /* |
| 80 | * Reset the card using configuration registers COR and CCSR. | 77 | * Reset the card using configuration registers COR and CCSR. |
| 81 | * If IDLE is 1, stop the firmware, so that it can be safely rewritten. | 78 | * If IDLE is 1, stop the firmware, so that it can be safely rewritten. |
| @@ -83,7 +80,7 @@ static void spectrum_cs_release(struct pcmcia_device *link); | |||
| 83 | static int | 80 | static int |
| 84 | spectrum_reset(struct pcmcia_device *link, int idle) | 81 | spectrum_reset(struct pcmcia_device *link, int idle) |
| 85 | { | 82 | { |
| 86 | int last_ret, last_fn; | 83 | int ret; |
| 87 | conf_reg_t reg; | 84 | conf_reg_t reg; |
| 88 | u_int save_cor; | 85 | u_int save_cor; |
| 89 | 86 | ||
| @@ -95,23 +92,26 @@ spectrum_reset(struct pcmcia_device *link, int idle) | |||
| 95 | reg.Function = 0; | 92 | reg.Function = 0; |
| 96 | reg.Action = CS_READ; | 93 | reg.Action = CS_READ; |
| 97 | reg.Offset = CISREG_COR; | 94 | reg.Offset = CISREG_COR; |
| 98 | CS_CHECK(AccessConfigurationRegister, | 95 | ret = pcmcia_access_configuration_register(link, ®); |
| 99 | pcmcia_access_configuration_register(link, ®)); | 96 | if (ret) |
| 97 | goto failed; | ||
| 100 | save_cor = reg.Value; | 98 | save_cor = reg.Value; |
| 101 | 99 | ||
| 102 | /* Soft-Reset card */ | 100 | /* Soft-Reset card */ |
| 103 | reg.Action = CS_WRITE; | 101 | reg.Action = CS_WRITE; |
| 104 | reg.Offset = CISREG_COR; | 102 | reg.Offset = CISREG_COR; |
| 105 | reg.Value = (save_cor | COR_SOFT_RESET); | 103 | reg.Value = (save_cor | COR_SOFT_RESET); |
| 106 | CS_CHECK(AccessConfigurationRegister, | 104 | ret = pcmcia_access_configuration_register(link, ®); |
| 107 | pcmcia_access_configuration_register(link, ®)); | 105 | if (ret) |
| 106 | goto failed; | ||
| 108 | udelay(1000); | 107 | udelay(1000); |
| 109 | 108 | ||
| 110 | /* Read CCSR */ | 109 | /* Read CCSR */ |
| 111 | reg.Action = CS_READ; | 110 | reg.Action = CS_READ; |
| 112 | reg.Offset = CISREG_CCSR; | 111 | reg.Offset = CISREG_CCSR; |
| 113 | CS_CHECK(AccessConfigurationRegister, | 112 | ret = pcmcia_access_configuration_register(link, ®); |
| 114 | pcmcia_access_configuration_register(link, ®)); | 113 | if (ret) |
| 114 | goto failed; | ||
| 115 | 115 | ||
| 116 | /* | 116 | /* |
| 117 | * Start or stop the firmware. Memory width bit should be | 117 | * Start or stop the firmware. Memory width bit should be |
| @@ -120,21 +120,22 @@ spectrum_reset(struct pcmcia_device *link, int idle) | |||
| 120 | reg.Action = CS_WRITE; | 120 | reg.Action = CS_WRITE; |
| 121 | reg.Offset = CISREG_CCSR; | 121 | reg.Offset = CISREG_CCSR; |
| 122 | reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); | 122 | reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); |
| 123 | CS_CHECK(AccessConfigurationRegister, | 123 | ret = pcmcia_access_configuration_register(link, ®); |
| 124 | pcmcia_access_configuration_register(link, ®)); | 124 | if (ret) |
| 125 | goto failed; | ||
| 125 | udelay(1000); | 126 | udelay(1000); |
| 126 | 127 | ||
| 127 | /* Restore original COR configuration index */ | 128 | /* Restore original COR configuration index */ |
| 128 | reg.Action = CS_WRITE; | 129 | reg.Action = CS_WRITE; |
| 129 | reg.Offset = CISREG_COR; | 130 | reg.Offset = CISREG_COR; |
| 130 | reg.Value = (save_cor & ~COR_SOFT_RESET); | 131 | reg.Value = (save_cor & ~COR_SOFT_RESET); |
| 131 | CS_CHECK(AccessConfigurationRegister, | 132 | ret = pcmcia_access_configuration_register(link, ®); |
| 132 | pcmcia_access_configuration_register(link, ®)); | 133 | if (ret) |
| 134 | goto failed; | ||
| 133 | udelay(1000); | 135 | udelay(1000); |
| 134 | return 0; | 136 | return 0; |
| 135 | 137 | ||
| 136 | cs_failed: | 138 | failed: |
| 137 | cs_error(link, last_fn, last_ret); | ||
| 138 | return -ENODEV; | 139 | return -ENODEV; |
| 139 | } | 140 | } |
| 140 | 141 | ||
| @@ -181,7 +182,7 @@ spectrum_cs_probe(struct pcmcia_device *link) | |||
| 181 | struct orinoco_private *priv; | 182 | struct orinoco_private *priv; |
| 182 | struct orinoco_pccard *card; | 183 | struct orinoco_pccard *card; |
| 183 | 184 | ||
| 184 | priv = alloc_orinocodev(sizeof(*card), &handle_to_dev(link), | 185 | priv = alloc_orinocodev(sizeof(*card), &link->dev, |
| 185 | spectrum_cs_hard_reset, | 186 | spectrum_cs_hard_reset, |
| 186 | spectrum_cs_stop_firmware); | 187 | spectrum_cs_stop_firmware); |
| 187 | if (!priv) | 188 | if (!priv) |
| @@ -193,10 +194,8 @@ spectrum_cs_probe(struct pcmcia_device *link) | |||
| 193 | link->priv = priv; | 194 | link->priv = priv; |
| 194 | 195 | ||
| 195 | /* Interrupt setup */ | 196 | /* Interrupt setup */ |
| 196 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 197 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 197 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 198 | link->irq.Handler = orinoco_interrupt; | 198 | link->irq.Handler = orinoco_interrupt; |
| 199 | link->irq.Instance = priv; | ||
| 200 | 199 | ||
| 201 | /* General socket configuration defaults can go here. In this | 200 | /* General socket configuration defaults can go here. In this |
| 202 | * client, we assume very little, and rely on the CIS for | 201 | * client, we assume very little, and rely on the CIS for |
| @@ -307,7 +306,7 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
| 307 | struct orinoco_private *priv = link->priv; | 306 | struct orinoco_private *priv = link->priv; |
| 308 | struct orinoco_pccard *card = priv->card; | 307 | struct orinoco_pccard *card = priv->card; |
| 309 | hermes_t *hw = &priv->hw; | 308 | hermes_t *hw = &priv->hw; |
| 310 | int last_fn, last_ret; | 309 | int ret; |
| 311 | void __iomem *mem; | 310 | void __iomem *mem; |
| 312 | 311 | ||
| 313 | /* | 312 | /* |
| @@ -324,13 +323,12 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
| 324 | * and most client drivers will only use the CIS to fill in | 323 | * and most client drivers will only use the CIS to fill in |
| 325 | * implementation-defined details. | 324 | * implementation-defined details. |
| 326 | */ | 325 | */ |
| 327 | last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); | 326 | ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); |
| 328 | if (last_ret) { | 327 | if (ret) { |
| 329 | if (!ignore_cis_vcc) | 328 | if (!ignore_cis_vcc) |
| 330 | printk(KERN_ERR PFX "GetNextTuple(): No matching " | 329 | printk(KERN_ERR PFX "GetNextTuple(): No matching " |
| 331 | "CIS configuration. Maybe you need the " | 330 | "CIS configuration. Maybe you need the " |
| 332 | "ignore_cis_vcc=1 parameter.\n"); | 331 | "ignore_cis_vcc=1 parameter.\n"); |
| 333 | cs_error(link, RequestIO, last_ret); | ||
| 334 | goto failed; | 332 | goto failed; |
| 335 | } | 333 | } |
| 336 | 334 | ||
| @@ -339,14 +337,16 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
| 339 | * a handler to the interrupt, unless the 'Handler' member of | 337 | * a handler to the interrupt, unless the 'Handler' member of |
| 340 | * the irq structure is initialized. | 338 | * the irq structure is initialized. |
| 341 | */ | 339 | */ |
| 342 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 340 | ret = pcmcia_request_irq(link, &link->irq); |
| 341 | if (ret) | ||
| 342 | goto failed; | ||
| 343 | 343 | ||
| 344 | /* We initialize the hermes structure before completing PCMCIA | 344 | /* We initialize the hermes structure before completing PCMCIA |
| 345 | * configuration just in case the interrupt handler gets | 345 | * configuration just in case the interrupt handler gets |
| 346 | * called. */ | 346 | * called. */ |
| 347 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); | 347 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); |
| 348 | if (!mem) | 348 | if (!mem) |
| 349 | goto cs_failed; | 349 | goto failed; |
| 350 | 350 | ||
| 351 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); | 351 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); |
| 352 | 352 | ||
| @@ -355,8 +355,9 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
| 355 | * the I/O windows and the interrupt mapping, and putting the | 355 | * the I/O windows and the interrupt mapping, and putting the |
| 356 | * card and host interface into "Memory and IO" mode. | 356 | * card and host interface into "Memory and IO" mode. |
| 357 | */ | 357 | */ |
| 358 | CS_CHECK(RequestConfiguration, | 358 | ret = pcmcia_request_configuration(link, &link->conf); |
| 359 | pcmcia_request_configuration(link, &link->conf)); | 359 | if (ret) |
| 360 | goto failed; | ||
| 360 | 361 | ||
| 361 | /* Ok, we have the configuration, prepare to register the netdev */ | 362 | /* Ok, we have the configuration, prepare to register the netdev */ |
| 362 | card->node.major = card->node.minor = 0; | 363 | card->node.major = card->node.minor = 0; |
| @@ -386,9 +387,6 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
| 386 | * net_device has been registered */ | 387 | * net_device has been registered */ |
| 387 | return 0; | 388 | return 0; |
| 388 | 389 | ||
| 389 | cs_failed: | ||
| 390 | cs_error(link, last_fn, last_ret); | ||
| 391 | |||
| 392 | failed: | 390 | failed: |
| 393 | spectrum_cs_release(link); | 391 | spectrum_cs_release(link); |
| 394 | return -ENODEV; | 392 | return -ENODEV; |
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index 17e199546eeb..92af9b96bb7a 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
| @@ -426,12 +426,16 @@ static const char p54u_romboot_3887[] = "~~~~"; | |||
| 426 | static int p54u_firmware_reset_3887(struct ieee80211_hw *dev) | 426 | static int p54u_firmware_reset_3887(struct ieee80211_hw *dev) |
| 427 | { | 427 | { |
| 428 | struct p54u_priv *priv = dev->priv; | 428 | struct p54u_priv *priv = dev->priv; |
| 429 | u8 buf[4]; | 429 | u8 *buf; |
| 430 | int ret; | 430 | int ret; |
| 431 | 431 | ||
| 432 | memcpy(&buf, p54u_romboot_3887, sizeof(buf)); | 432 | buf = kmalloc(4, GFP_KERNEL); |
| 433 | if (!buf) | ||
| 434 | return -ENOMEM; | ||
| 435 | memcpy(buf, p54u_romboot_3887, 4); | ||
| 433 | ret = p54u_bulk_msg(priv, P54U_PIPE_DATA, | 436 | ret = p54u_bulk_msg(priv, P54U_PIPE_DATA, |
| 434 | buf, sizeof(buf)); | 437 | buf, 4); |
| 438 | kfree(buf); | ||
| 435 | if (ret) | 439 | if (ret) |
| 436 | dev_err(&priv->udev->dev, "(p54usb) unable to jump to " | 440 | dev_err(&priv->udev->dev, "(p54usb) unable to jump to " |
| 437 | "boot ROM (%d)!\n", ret); | 441 | "boot ROM (%d)!\n", ret); |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 1c88c2ea59aa..5b8e3e4cdd9f 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
| @@ -71,25 +71,7 @@ typedef u_char mac_addr[ETH_ALEN]; /* Hardware address */ | |||
| 71 | #include "rayctl.h" | 71 | #include "rayctl.h" |
| 72 | #include "ray_cs.h" | 72 | #include "ray_cs.h" |
| 73 | 73 | ||
| 74 | /* All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 75 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 76 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 77 | be present but disabled -- but it can then be enabled for specific | ||
| 78 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 79 | */ | ||
| 80 | 74 | ||
| 81 | #ifdef RAYLINK_DEBUG | ||
| 82 | #define PCMCIA_DEBUG RAYLINK_DEBUG | ||
| 83 | #endif | ||
| 84 | #ifdef PCMCIA_DEBUG | ||
| 85 | static int ray_debug; | ||
| 86 | static int pc_debug = PCMCIA_DEBUG; | ||
| 87 | module_param(pc_debug, int, 0); | ||
| 88 | /* #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); */ | ||
| 89 | #define DEBUG(n, args...) if (pc_debug > (n)) printk(args); | ||
| 90 | #else | ||
| 91 | #define DEBUG(n, args...) | ||
| 92 | #endif | ||
| 93 | /** Prototypes based on PCMCIA skeleton driver *******************************/ | 75 | /** Prototypes based on PCMCIA skeleton driver *******************************/ |
| 94 | static int ray_config(struct pcmcia_device *link); | 76 | static int ray_config(struct pcmcia_device *link); |
| 95 | static void ray_release(struct pcmcia_device *link); | 77 | static void ray_release(struct pcmcia_device *link); |
| @@ -325,7 +307,7 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
| 325 | ray_dev_t *local; | 307 | ray_dev_t *local; |
| 326 | struct net_device *dev; | 308 | struct net_device *dev; |
| 327 | 309 | ||
| 328 | DEBUG(1, "ray_attach()\n"); | 310 | dev_dbg(&p_dev->dev, "ray_attach()\n"); |
| 329 | 311 | ||
| 330 | /* Allocate space for private device-specific data */ | 312 | /* Allocate space for private device-specific data */ |
| 331 | dev = alloc_etherdev(sizeof(ray_dev_t)); | 313 | dev = alloc_etherdev(sizeof(ray_dev_t)); |
| @@ -341,8 +323,7 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
| 341 | p_dev->io.IOAddrLines = 5; | 323 | p_dev->io.IOAddrLines = 5; |
| 342 | 324 | ||
| 343 | /* Interrupt setup. For PCMCIA, driver takes what's given */ | 325 | /* Interrupt setup. For PCMCIA, driver takes what's given */ |
| 344 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 326 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 345 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 346 | p_dev->irq.Handler = &ray_interrupt; | 327 | p_dev->irq.Handler = &ray_interrupt; |
| 347 | 328 | ||
| 348 | /* General socket configuration */ | 329 | /* General socket configuration */ |
| @@ -351,13 +332,12 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
| 351 | p_dev->conf.ConfigIndex = 1; | 332 | p_dev->conf.ConfigIndex = 1; |
| 352 | 333 | ||
| 353 | p_dev->priv = dev; | 334 | p_dev->priv = dev; |
| 354 | p_dev->irq.Instance = dev; | ||
| 355 | 335 | ||
| 356 | local->finder = p_dev; | 336 | local->finder = p_dev; |
| 357 | local->card_status = CARD_INSERTED; | 337 | local->card_status = CARD_INSERTED; |
| 358 | local->authentication_state = UNAUTHENTICATED; | 338 | local->authentication_state = UNAUTHENTICATED; |
| 359 | local->num_multi = 0; | 339 | local->num_multi = 0; |
| 360 | DEBUG(2, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", | 340 | dev_dbg(&p_dev->dev, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", |
| 361 | p_dev, dev, local, &ray_interrupt); | 341 | p_dev, dev, local, &ray_interrupt); |
| 362 | 342 | ||
| 363 | /* Raylink entries in the device structure */ | 343 | /* Raylink entries in the device structure */ |
| @@ -370,7 +350,7 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
| 370 | #endif /* WIRELESS_SPY */ | 350 | #endif /* WIRELESS_SPY */ |
| 371 | 351 | ||
| 372 | 352 | ||
| 373 | DEBUG(2, "ray_cs ray_attach calling ether_setup.)\n"); | 353 | dev_dbg(&p_dev->dev, "ray_cs ray_attach calling ether_setup.)\n"); |
| 374 | netif_stop_queue(dev); | 354 | netif_stop_queue(dev); |
| 375 | 355 | ||
| 376 | init_timer(&local->timer); | 356 | init_timer(&local->timer); |
| @@ -393,7 +373,7 @@ static void ray_detach(struct pcmcia_device *link) | |||
| 393 | struct net_device *dev; | 373 | struct net_device *dev; |
| 394 | ray_dev_t *local; | 374 | ray_dev_t *local; |
| 395 | 375 | ||
| 396 | DEBUG(1, "ray_detach(0x%p)\n", link); | 376 | dev_dbg(&link->dev, "ray_detach\n"); |
| 397 | 377 | ||
| 398 | this_device = NULL; | 378 | this_device = NULL; |
| 399 | dev = link->priv; | 379 | dev = link->priv; |
| @@ -408,7 +388,7 @@ static void ray_detach(struct pcmcia_device *link) | |||
| 408 | unregister_netdev(dev); | 388 | unregister_netdev(dev); |
| 409 | free_netdev(dev); | 389 | free_netdev(dev); |
| 410 | } | 390 | } |
| 411 | DEBUG(2, "ray_cs ray_detach ending\n"); | 391 | dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); |
| 412 | } /* ray_detach */ | 392 | } /* ray_detach */ |
| 413 | 393 | ||
| 414 | /*============================================================================= | 394 | /*============================================================================= |
| @@ -416,19 +396,17 @@ static void ray_detach(struct pcmcia_device *link) | |||
| 416 | is received, to configure the PCMCIA socket, and to make the | 396 | is received, to configure the PCMCIA socket, and to make the |
| 417 | ethernet device available to the system. | 397 | ethernet device available to the system. |
| 418 | =============================================================================*/ | 398 | =============================================================================*/ |
| 419 | #define CS_CHECK(fn, ret) \ | ||
| 420 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 421 | #define MAX_TUPLE_SIZE 128 | 399 | #define MAX_TUPLE_SIZE 128 |
| 422 | static int ray_config(struct pcmcia_device *link) | 400 | static int ray_config(struct pcmcia_device *link) |
| 423 | { | 401 | { |
| 424 | int last_fn = 0, last_ret = 0; | 402 | int ret = 0; |
| 425 | int i; | 403 | int i; |
| 426 | win_req_t req; | 404 | win_req_t req; |
| 427 | memreq_t mem; | 405 | memreq_t mem; |
| 428 | struct net_device *dev = (struct net_device *)link->priv; | 406 | struct net_device *dev = (struct net_device *)link->priv; |
| 429 | ray_dev_t *local = netdev_priv(dev); | 407 | ray_dev_t *local = netdev_priv(dev); |
| 430 | 408 | ||
| 431 | DEBUG(1, "ray_config(0x%p)\n", link); | 409 | dev_dbg(&link->dev, "ray_config\n"); |
| 432 | 410 | ||
| 433 | /* Determine card type and firmware version */ | 411 | /* Determine card type and firmware version */ |
| 434 | printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n", | 412 | printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n", |
| @@ -440,14 +418,17 @@ static int ray_config(struct pcmcia_device *link) | |||
| 440 | /* Now allocate an interrupt line. Note that this does not | 418 | /* Now allocate an interrupt line. Note that this does not |
| 441 | actually assign a handler to the interrupt. | 419 | actually assign a handler to the interrupt. |
| 442 | */ | 420 | */ |
| 443 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 421 | ret = pcmcia_request_irq(link, &link->irq); |
| 422 | if (ret) | ||
| 423 | goto failed; | ||
| 444 | dev->irq = link->irq.AssignedIRQ; | 424 | dev->irq = link->irq.AssignedIRQ; |
| 445 | 425 | ||
| 446 | /* This actually configures the PCMCIA socket -- setting up | 426 | /* This actually configures the PCMCIA socket -- setting up |
| 447 | the I/O windows and the interrupt mapping. | 427 | the I/O windows and the interrupt mapping. |
| 448 | */ | 428 | */ |
| 449 | CS_CHECK(RequestConfiguration, | 429 | ret = pcmcia_request_configuration(link, &link->conf); |
| 450 | pcmcia_request_configuration(link, &link->conf)); | 430 | if (ret) |
| 431 | goto failed; | ||
| 451 | 432 | ||
| 452 | /*** Set up 32k window for shared memory (transmit and control) ************/ | 433 | /*** Set up 32k window for shared memory (transmit and control) ************/ |
| 453 | req.Attributes = | 434 | req.Attributes = |
| @@ -455,10 +436,14 @@ static int ray_config(struct pcmcia_device *link) | |||
| 455 | req.Base = 0; | 436 | req.Base = 0; |
| 456 | req.Size = 0x8000; | 437 | req.Size = 0x8000; |
| 457 | req.AccessSpeed = ray_mem_speed; | 438 | req.AccessSpeed = ray_mem_speed; |
| 458 | CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); | 439 | ret = pcmcia_request_window(link, &req, &link->win); |
| 440 | if (ret) | ||
| 441 | goto failed; | ||
| 459 | mem.CardOffset = 0x0000; | 442 | mem.CardOffset = 0x0000; |
| 460 | mem.Page = 0; | 443 | mem.Page = 0; |
| 461 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); | 444 | ret = pcmcia_map_mem_page(link, link->win, &mem); |
| 445 | if (ret) | ||
| 446 | goto failed; | ||
| 462 | local->sram = ioremap(req.Base, req.Size); | 447 | local->sram = ioremap(req.Base, req.Size); |
| 463 | 448 | ||
| 464 | /*** Set up 16k window for shared memory (receive buffer) ***************/ | 449 | /*** Set up 16k window for shared memory (receive buffer) ***************/ |
| @@ -467,11 +452,14 @@ static int ray_config(struct pcmcia_device *link) | |||
| 467 | req.Base = 0; | 452 | req.Base = 0; |
| 468 | req.Size = 0x4000; | 453 | req.Size = 0x4000; |
| 469 | req.AccessSpeed = ray_mem_speed; | 454 | req.AccessSpeed = ray_mem_speed; |
| 470 | CS_CHECK(RequestWindow, | 455 | ret = pcmcia_request_window(link, &req, &local->rmem_handle); |
| 471 | pcmcia_request_window(&link, &req, &local->rmem_handle)); | 456 | if (ret) |
| 457 | goto failed; | ||
| 472 | mem.CardOffset = 0x8000; | 458 | mem.CardOffset = 0x8000; |
| 473 | mem.Page = 0; | 459 | mem.Page = 0; |
| 474 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->rmem_handle, &mem)); | 460 | ret = pcmcia_map_mem_page(link, local->rmem_handle, &mem); |
| 461 | if (ret) | ||
| 462 | goto failed; | ||
| 475 | local->rmem = ioremap(req.Base, req.Size); | 463 | local->rmem = ioremap(req.Base, req.Size); |
| 476 | 464 | ||
| 477 | /*** Set up window for attribute memory ***********************************/ | 465 | /*** Set up window for attribute memory ***********************************/ |
| @@ -480,22 +468,25 @@ static int ray_config(struct pcmcia_device *link) | |||
| 480 | req.Base = 0; | 468 | req.Base = 0; |
| 481 | req.Size = 0x1000; | 469 | req.Size = 0x1000; |
| 482 | req.AccessSpeed = ray_mem_speed; | 470 | req.AccessSpeed = ray_mem_speed; |
| 483 | CS_CHECK(RequestWindow, | 471 | ret = pcmcia_request_window(link, &req, &local->amem_handle); |
| 484 | pcmcia_request_window(&link, &req, &local->amem_handle)); | 472 | if (ret) |
| 473 | goto failed; | ||
| 485 | mem.CardOffset = 0x0000; | 474 | mem.CardOffset = 0x0000; |
| 486 | mem.Page = 0; | 475 | mem.Page = 0; |
| 487 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->amem_handle, &mem)); | 476 | ret = pcmcia_map_mem_page(link, local->amem_handle, &mem); |
| 477 | if (ret) | ||
| 478 | goto failed; | ||
| 488 | local->amem = ioremap(req.Base, req.Size); | 479 | local->amem = ioremap(req.Base, req.Size); |
| 489 | 480 | ||
| 490 | DEBUG(3, "ray_config sram=%p\n", local->sram); | 481 | dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); |
| 491 | DEBUG(3, "ray_config rmem=%p\n", local->rmem); | 482 | dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); |
| 492 | DEBUG(3, "ray_config amem=%p\n", local->amem); | 483 | dev_dbg(&link->dev, "ray_config amem=%p\n", local->amem); |
| 493 | if (ray_init(dev) < 0) { | 484 | if (ray_init(dev) < 0) { |
| 494 | ray_release(link); | 485 | ray_release(link); |
| 495 | return -ENODEV; | 486 | return -ENODEV; |
| 496 | } | 487 | } |
| 497 | 488 | ||
| 498 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 489 | SET_NETDEV_DEV(dev, &link->dev); |
| 499 | i = register_netdev(dev); | 490 | i = register_netdev(dev); |
| 500 | if (i != 0) { | 491 | if (i != 0) { |
| 501 | printk("ray_config register_netdev() failed\n"); | 492 | printk("ray_config register_netdev() failed\n"); |
| @@ -511,9 +502,7 @@ static int ray_config(struct pcmcia_device *link) | |||
| 511 | 502 | ||
| 512 | return 0; | 503 | return 0; |
| 513 | 504 | ||
| 514 | cs_failed: | 505 | failed: |
| 515 | cs_error(link, last_fn, last_ret); | ||
| 516 | |||
| 517 | ray_release(link); | 506 | ray_release(link); |
| 518 | return -ENODEV; | 507 | return -ENODEV; |
| 519 | } /* ray_config */ | 508 | } /* ray_config */ |
| @@ -543,9 +532,9 @@ static int ray_init(struct net_device *dev) | |||
| 543 | struct ccs __iomem *pccs; | 532 | struct ccs __iomem *pccs; |
| 544 | ray_dev_t *local = netdev_priv(dev); | 533 | ray_dev_t *local = netdev_priv(dev); |
| 545 | struct pcmcia_device *link = local->finder; | 534 | struct pcmcia_device *link = local->finder; |
| 546 | DEBUG(1, "ray_init(0x%p)\n", dev); | 535 | dev_dbg(&link->dev, "ray_init(0x%p)\n", dev); |
| 547 | if (!(pcmcia_dev_present(link))) { | 536 | if (!(pcmcia_dev_present(link))) { |
| 548 | DEBUG(0, "ray_init - device not present\n"); | 537 | dev_dbg(&link->dev, "ray_init - device not present\n"); |
| 549 | return -1; | 538 | return -1; |
| 550 | } | 539 | } |
| 551 | 540 | ||
| @@ -567,13 +556,13 @@ static int ray_init(struct net_device *dev) | |||
| 567 | local->fw_ver = local->startup_res.firmware_version[0]; | 556 | local->fw_ver = local->startup_res.firmware_version[0]; |
| 568 | local->fw_bld = local->startup_res.firmware_version[1]; | 557 | local->fw_bld = local->startup_res.firmware_version[1]; |
| 569 | local->fw_var = local->startup_res.firmware_version[2]; | 558 | local->fw_var = local->startup_res.firmware_version[2]; |
| 570 | DEBUG(1, "ray_init firmware version %d.%d \n", local->fw_ver, | 559 | dev_dbg(&link->dev, "ray_init firmware version %d.%d \n", local->fw_ver, |
| 571 | local->fw_bld); | 560 | local->fw_bld); |
| 572 | 561 | ||
| 573 | local->tib_length = 0x20; | 562 | local->tib_length = 0x20; |
| 574 | if ((local->fw_ver == 5) && (local->fw_bld >= 30)) | 563 | if ((local->fw_ver == 5) && (local->fw_bld >= 30)) |
| 575 | local->tib_length = local->startup_res.tib_length; | 564 | local->tib_length = local->startup_res.tib_length; |
| 576 | DEBUG(2, "ray_init tib_length = 0x%02x\n", local->tib_length); | 565 | dev_dbg(&link->dev, "ray_init tib_length = 0x%02x\n", local->tib_length); |
| 577 | /* Initialize CCS's to buffer free state */ | 566 | /* Initialize CCS's to buffer free state */ |
| 578 | pccs = ccs_base(local); | 567 | pccs = ccs_base(local); |
| 579 | for (i = 0; i < NUMBER_OF_CCS; i++) { | 568 | for (i = 0; i < NUMBER_OF_CCS; i++) { |
| @@ -592,7 +581,7 @@ static int ray_init(struct net_device *dev) | |||
| 592 | 581 | ||
| 593 | clear_interrupt(local); /* Clear any interrupt from the card */ | 582 | clear_interrupt(local); /* Clear any interrupt from the card */ |
| 594 | local->card_status = CARD_AWAITING_PARAM; | 583 | local->card_status = CARD_AWAITING_PARAM; |
| 595 | DEBUG(2, "ray_init ending\n"); | 584 | dev_dbg(&link->dev, "ray_init ending\n"); |
| 596 | return 0; | 585 | return 0; |
| 597 | } /* ray_init */ | 586 | } /* ray_init */ |
| 598 | 587 | ||
| @@ -605,9 +594,9 @@ static int dl_startup_params(struct net_device *dev) | |||
| 605 | struct ccs __iomem *pccs; | 594 | struct ccs __iomem *pccs; |
| 606 | struct pcmcia_device *link = local->finder; | 595 | struct pcmcia_device *link = local->finder; |
| 607 | 596 | ||
| 608 | DEBUG(1, "dl_startup_params entered\n"); | 597 | dev_dbg(&link->dev, "dl_startup_params entered\n"); |
| 609 | if (!(pcmcia_dev_present(link))) { | 598 | if (!(pcmcia_dev_present(link))) { |
| 610 | DEBUG(2, "ray_cs dl_startup_params - device not present\n"); | 599 | dev_dbg(&link->dev, "ray_cs dl_startup_params - device not present\n"); |
| 611 | return -1; | 600 | return -1; |
| 612 | } | 601 | } |
| 613 | 602 | ||
| @@ -625,7 +614,7 @@ static int dl_startup_params(struct net_device *dev) | |||
| 625 | local->dl_param_ccs = ccsindex; | 614 | local->dl_param_ccs = ccsindex; |
| 626 | pccs = ccs_base(local) + ccsindex; | 615 | pccs = ccs_base(local) + ccsindex; |
| 627 | writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd); | 616 | writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd); |
| 628 | DEBUG(2, "dl_startup_params start ccsindex = %d\n", | 617 | dev_dbg(&link->dev, "dl_startup_params start ccsindex = %d\n", |
| 629 | local->dl_param_ccs); | 618 | local->dl_param_ccs); |
| 630 | /* Interrupt the firmware to process the command */ | 619 | /* Interrupt the firmware to process the command */ |
| 631 | if (interrupt_ecf(local, ccsindex)) { | 620 | if (interrupt_ecf(local, ccsindex)) { |
| @@ -641,7 +630,7 @@ static int dl_startup_params(struct net_device *dev) | |||
| 641 | local->timer.data = (long)local; | 630 | local->timer.data = (long)local; |
| 642 | local->timer.function = &verify_dl_startup; | 631 | local->timer.function = &verify_dl_startup; |
| 643 | add_timer(&local->timer); | 632 | add_timer(&local->timer); |
| 644 | DEBUG(2, | 633 | dev_dbg(&link->dev, |
| 645 | "ray_cs dl_startup_params started timer for verify_dl_startup\n"); | 634 | "ray_cs dl_startup_params started timer for verify_dl_startup\n"); |
| 646 | return 0; | 635 | return 0; |
| 647 | } /* dl_startup_params */ | 636 | } /* dl_startup_params */ |
| @@ -717,11 +706,11 @@ static void verify_dl_startup(u_long data) | |||
| 717 | struct pcmcia_device *link = local->finder; | 706 | struct pcmcia_device *link = local->finder; |
| 718 | 707 | ||
| 719 | if (!(pcmcia_dev_present(link))) { | 708 | if (!(pcmcia_dev_present(link))) { |
| 720 | DEBUG(2, "ray_cs verify_dl_startup - device not present\n"); | 709 | dev_dbg(&link->dev, "ray_cs verify_dl_startup - device not present\n"); |
| 721 | return; | 710 | return; |
| 722 | } | 711 | } |
| 723 | #ifdef PCMCIA_DEBUG | 712 | #if 0 |
| 724 | if (pc_debug > 2) { | 713 | { |
| 725 | int i; | 714 | int i; |
| 726 | printk(KERN_DEBUG | 715 | printk(KERN_DEBUG |
| 727 | "verify_dl_startup parameters sent via ccs %d:\n", | 716 | "verify_dl_startup parameters sent via ccs %d:\n", |
| @@ -760,7 +749,7 @@ static void start_net(u_long data) | |||
| 760 | int ccsindex; | 749 | int ccsindex; |
| 761 | struct pcmcia_device *link = local->finder; | 750 | struct pcmcia_device *link = local->finder; |
| 762 | if (!(pcmcia_dev_present(link))) { | 751 | if (!(pcmcia_dev_present(link))) { |
| 763 | DEBUG(2, "ray_cs start_net - device not present\n"); | 752 | dev_dbg(&link->dev, "ray_cs start_net - device not present\n"); |
| 764 | return; | 753 | return; |
| 765 | } | 754 | } |
| 766 | /* Fill in the CCS fields for the ECF */ | 755 | /* Fill in the CCS fields for the ECF */ |
| @@ -771,7 +760,7 @@ static void start_net(u_long data) | |||
| 771 | writeb(0, &pccs->var.start_network.update_param); | 760 | writeb(0, &pccs->var.start_network.update_param); |
| 772 | /* Interrupt the firmware to process the command */ | 761 | /* Interrupt the firmware to process the command */ |
| 773 | if (interrupt_ecf(local, ccsindex)) { | 762 | if (interrupt_ecf(local, ccsindex)) { |
| 774 | DEBUG(1, "ray start net failed - card not ready for intr\n"); | 763 | dev_dbg(&link->dev, "ray start net failed - card not ready for intr\n"); |
| 775 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 764 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
| 776 | return; | 765 | return; |
| 777 | } | 766 | } |
| @@ -790,7 +779,7 @@ static void join_net(u_long data) | |||
| 790 | struct pcmcia_device *link = local->finder; | 779 | struct pcmcia_device *link = local->finder; |
| 791 | 780 | ||
| 792 | if (!(pcmcia_dev_present(link))) { | 781 | if (!(pcmcia_dev_present(link))) { |
| 793 | DEBUG(2, "ray_cs join_net - device not present\n"); | 782 | dev_dbg(&link->dev, "ray_cs join_net - device not present\n"); |
| 794 | return; | 783 | return; |
| 795 | } | 784 | } |
| 796 | /* Fill in the CCS fields for the ECF */ | 785 | /* Fill in the CCS fields for the ECF */ |
| @@ -802,7 +791,7 @@ static void join_net(u_long data) | |||
| 802 | writeb(0, &pccs->var.join_network.net_initiated); | 791 | writeb(0, &pccs->var.join_network.net_initiated); |
| 803 | /* Interrupt the firmware to process the command */ | 792 | /* Interrupt the firmware to process the command */ |
| 804 | if (interrupt_ecf(local, ccsindex)) { | 793 | if (interrupt_ecf(local, ccsindex)) { |
| 805 | DEBUG(1, "ray join net failed - card not ready for intr\n"); | 794 | dev_dbg(&link->dev, "ray join net failed - card not ready for intr\n"); |
| 806 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 795 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
| 807 | return; | 796 | return; |
| 808 | } | 797 | } |
| @@ -821,7 +810,7 @@ static void ray_release(struct pcmcia_device *link) | |||
| 821 | ray_dev_t *local = netdev_priv(dev); | 810 | ray_dev_t *local = netdev_priv(dev); |
| 822 | int i; | 811 | int i; |
| 823 | 812 | ||
| 824 | DEBUG(1, "ray_release(0x%p)\n", link); | 813 | dev_dbg(&link->dev, "ray_release\n"); |
| 825 | 814 | ||
| 826 | del_timer(&local->timer); | 815 | del_timer(&local->timer); |
| 827 | 816 | ||
| @@ -829,15 +818,15 @@ static void ray_release(struct pcmcia_device *link) | |||
| 829 | iounmap(local->rmem); | 818 | iounmap(local->rmem); |
| 830 | iounmap(local->amem); | 819 | iounmap(local->amem); |
| 831 | /* Do bother checking to see if these succeed or not */ | 820 | /* Do bother checking to see if these succeed or not */ |
| 832 | i = pcmcia_release_window(local->amem_handle); | 821 | i = pcmcia_release_window(link, local->amem_handle); |
| 833 | if (i != 0) | 822 | if (i != 0) |
| 834 | DEBUG(0, "ReleaseWindow(local->amem) ret = %x\n", i); | 823 | dev_dbg(&link->dev, "ReleaseWindow(local->amem) ret = %x\n", i); |
| 835 | i = pcmcia_release_window(local->rmem_handle); | 824 | i = pcmcia_release_window(link, local->rmem_handle); |
| 836 | if (i != 0) | 825 | if (i != 0) |
| 837 | DEBUG(0, "ReleaseWindow(local->rmem) ret = %x\n", i); | 826 | dev_dbg(&link->dev, "ReleaseWindow(local->rmem) ret = %x\n", i); |
| 838 | pcmcia_disable_device(link); | 827 | pcmcia_disable_device(link); |
| 839 | 828 | ||
| 840 | DEBUG(2, "ray_release ending\n"); | 829 | dev_dbg(&link->dev, "ray_release ending\n"); |
| 841 | } | 830 | } |
| 842 | 831 | ||
| 843 | static int ray_suspend(struct pcmcia_device *link) | 832 | static int ray_suspend(struct pcmcia_device *link) |
| @@ -871,9 +860,9 @@ static int ray_dev_init(struct net_device *dev) | |||
| 871 | ray_dev_t *local = netdev_priv(dev); | 860 | ray_dev_t *local = netdev_priv(dev); |
| 872 | struct pcmcia_device *link = local->finder; | 861 | struct pcmcia_device *link = local->finder; |
| 873 | 862 | ||
| 874 | DEBUG(1, "ray_dev_init(dev=%p)\n", dev); | 863 | dev_dbg(&link->dev, "ray_dev_init(dev=%p)\n", dev); |
| 875 | if (!(pcmcia_dev_present(link))) { | 864 | if (!(pcmcia_dev_present(link))) { |
| 876 | DEBUG(2, "ray_dev_init - device not present\n"); | 865 | dev_dbg(&link->dev, "ray_dev_init - device not present\n"); |
| 877 | return -1; | 866 | return -1; |
| 878 | } | 867 | } |
| 879 | #ifdef RAY_IMMEDIATE_INIT | 868 | #ifdef RAY_IMMEDIATE_INIT |
| @@ -887,7 +876,7 @@ static int ray_dev_init(struct net_device *dev) | |||
| 887 | /* Postpone the card init so that we can still configure the card, | 876 | /* Postpone the card init so that we can still configure the card, |
| 888 | * for example using the Wireless Extensions. The init will happen | 877 | * for example using the Wireless Extensions. The init will happen |
| 889 | * in ray_open() - Jean II */ | 878 | * in ray_open() - Jean II */ |
| 890 | DEBUG(1, | 879 | dev_dbg(&link->dev, |
| 891 | "ray_dev_init: postponing card init to ray_open() ; Status = %d\n", | 880 | "ray_dev_init: postponing card init to ray_open() ; Status = %d\n", |
| 892 | local->card_status); | 881 | local->card_status); |
| 893 | #endif /* RAY_IMMEDIATE_INIT */ | 882 | #endif /* RAY_IMMEDIATE_INIT */ |
| @@ -896,7 +885,7 @@ static int ray_dev_init(struct net_device *dev) | |||
| 896 | memcpy(dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN); | 885 | memcpy(dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN); |
| 897 | memset(dev->broadcast, 0xff, ETH_ALEN); | 886 | memset(dev->broadcast, 0xff, ETH_ALEN); |
| 898 | 887 | ||
| 899 | DEBUG(2, "ray_dev_init ending\n"); | 888 | dev_dbg(&link->dev, "ray_dev_init ending\n"); |
| 900 | return 0; | 889 | return 0; |
| 901 | } | 890 | } |
| 902 | 891 | ||
| @@ -906,9 +895,9 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map) | |||
| 906 | ray_dev_t *local = netdev_priv(dev); | 895 | ray_dev_t *local = netdev_priv(dev); |
| 907 | struct pcmcia_device *link = local->finder; | 896 | struct pcmcia_device *link = local->finder; |
| 908 | /* Dummy routine to satisfy device structure */ | 897 | /* Dummy routine to satisfy device structure */ |
| 909 | DEBUG(1, "ray_dev_config(dev=%p,ifmap=%p)\n", dev, map); | 898 | dev_dbg(&link->dev, "ray_dev_config(dev=%p,ifmap=%p)\n", dev, map); |
| 910 | if (!(pcmcia_dev_present(link))) { | 899 | if (!(pcmcia_dev_present(link))) { |
| 911 | DEBUG(2, "ray_dev_config - device not present\n"); | 900 | dev_dbg(&link->dev, "ray_dev_config - device not present\n"); |
| 912 | return -1; | 901 | return -1; |
| 913 | } | 902 | } |
| 914 | 903 | ||
| @@ -924,14 +913,14 @@ static netdev_tx_t ray_dev_start_xmit(struct sk_buff *skb, | |||
| 924 | short length = skb->len; | 913 | short length = skb->len; |
| 925 | 914 | ||
| 926 | if (!pcmcia_dev_present(link)) { | 915 | if (!pcmcia_dev_present(link)) { |
| 927 | DEBUG(2, "ray_dev_start_xmit - device not present\n"); | 916 | dev_dbg(&link->dev, "ray_dev_start_xmit - device not present\n"); |
| 928 | dev_kfree_skb(skb); | 917 | dev_kfree_skb(skb); |
| 929 | return NETDEV_TX_OK; | 918 | return NETDEV_TX_OK; |
| 930 | } | 919 | } |
| 931 | 920 | ||
| 932 | DEBUG(3, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev); | 921 | dev_dbg(&link->dev, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev); |
| 933 | if (local->authentication_state == NEED_TO_AUTH) { | 922 | if (local->authentication_state == NEED_TO_AUTH) { |
| 934 | DEBUG(0, "ray_cs Sending authentication request.\n"); | 923 | dev_dbg(&link->dev, "ray_cs Sending authentication request.\n"); |
| 935 | if (!build_auth_frame(local, local->auth_id, OPEN_AUTH_REQUEST)) { | 924 | if (!build_auth_frame(local, local->auth_id, OPEN_AUTH_REQUEST)) { |
| 936 | local->authentication_state = AUTHENTICATED; | 925 | local->authentication_state = AUTHENTICATED; |
| 937 | netif_stop_queue(dev); | 926 | netif_stop_queue(dev); |
| @@ -971,7 +960,7 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev, | |||
| 971 | struct tx_msg __iomem *ptx; /* Address of xmit buffer in PC space */ | 960 | struct tx_msg __iomem *ptx; /* Address of xmit buffer in PC space */ |
| 972 | short int addr; /* Address of xmit buffer in card space */ | 961 | short int addr; /* Address of xmit buffer in card space */ |
| 973 | 962 | ||
| 974 | DEBUG(3, "ray_hw_xmit(data=%p, len=%d, dev=%p)\n", data, len, dev); | 963 | pr_debug("ray_hw_xmit(data=%p, len=%d, dev=%p)\n", data, len, dev); |
| 975 | if (len + TX_HEADER_LENGTH > TX_BUF_SIZE) { | 964 | if (len + TX_HEADER_LENGTH > TX_BUF_SIZE) { |
| 976 | printk(KERN_INFO "ray_hw_xmit packet too large: %d bytes\n", | 965 | printk(KERN_INFO "ray_hw_xmit packet too large: %d bytes\n", |
| 977 | len); | 966 | len); |
| @@ -979,9 +968,9 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev, | |||
| 979 | } | 968 | } |
| 980 | switch (ccsindex = get_free_tx_ccs(local)) { | 969 | switch (ccsindex = get_free_tx_ccs(local)) { |
| 981 | case ECCSBUSY: | 970 | case ECCSBUSY: |
| 982 | DEBUG(2, "ray_hw_xmit tx_ccs table busy\n"); | 971 | pr_debug("ray_hw_xmit tx_ccs table busy\n"); |
| 983 | case ECCSFULL: | 972 | case ECCSFULL: |
| 984 | DEBUG(2, "ray_hw_xmit No free tx ccs\n"); | 973 | pr_debug("ray_hw_xmit No free tx ccs\n"); |
| 985 | case ECARDGONE: | 974 | case ECARDGONE: |
| 986 | netif_stop_queue(dev); | 975 | netif_stop_queue(dev); |
| 987 | return XMIT_NO_CCS; | 976 | return XMIT_NO_CCS; |
| @@ -1018,12 +1007,12 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev, | |||
| 1018 | writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode); | 1007 | writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode); |
| 1019 | writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate); | 1008 | writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate); |
| 1020 | writeb(0, &pccs->var.tx_request.antenna); | 1009 | writeb(0, &pccs->var.tx_request.antenna); |
| 1021 | DEBUG(3, "ray_hw_xmit default_tx_rate = 0x%x\n", | 1010 | pr_debug("ray_hw_xmit default_tx_rate = 0x%x\n", |
| 1022 | local->net_default_tx_rate); | 1011 | local->net_default_tx_rate); |
| 1023 | 1012 | ||
| 1024 | /* Interrupt the firmware to process the command */ | 1013 | /* Interrupt the firmware to process the command */ |
| 1025 | if (interrupt_ecf(local, ccsindex)) { | 1014 | if (interrupt_ecf(local, ccsindex)) { |
| 1026 | DEBUG(2, "ray_hw_xmit failed - ECF not ready for intr\n"); | 1015 | pr_debug("ray_hw_xmit failed - ECF not ready for intr\n"); |
| 1027 | /* TBD very inefficient to copy packet to buffer, and then not | 1016 | /* TBD very inefficient to copy packet to buffer, and then not |
| 1028 | send it, but the alternative is to queue the messages and that | 1017 | send it, but the alternative is to queue the messages and that |
| 1029 | won't be done for a while. Maybe set tbusy until a CCS is free? | 1018 | won't be done for a while. Maybe set tbusy until a CCS is free? |
| @@ -1040,7 +1029,7 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx, | |||
| 1040 | { | 1029 | { |
| 1041 | __be16 proto = ((struct ethhdr *)data)->h_proto; | 1030 | __be16 proto = ((struct ethhdr *)data)->h_proto; |
| 1042 | if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */ | 1031 | if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */ |
| 1043 | DEBUG(3, "ray_cs translate_frame DIX II\n"); | 1032 | pr_debug("ray_cs translate_frame DIX II\n"); |
| 1044 | /* Copy LLC header to card buffer */ | 1033 | /* Copy LLC header to card buffer */ |
| 1045 | memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc)); | 1034 | memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc)); |
| 1046 | memcpy_toio(((void __iomem *)&ptx->var) + sizeof(eth2_llc), | 1035 | memcpy_toio(((void __iomem *)&ptx->var) + sizeof(eth2_llc), |
| @@ -1056,9 +1045,9 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx, | |||
| 1056 | len - ETH_HLEN); | 1045 | len - ETH_HLEN); |
| 1057 | return (int)sizeof(struct snaphdr_t) - ETH_HLEN; | 1046 | return (int)sizeof(struct snaphdr_t) - ETH_HLEN; |
| 1058 | } else { /* already 802 type, and proto is length */ | 1047 | } else { /* already 802 type, and proto is length */ |
| 1059 | DEBUG(3, "ray_cs translate_frame 802\n"); | 1048 | pr_debug("ray_cs translate_frame 802\n"); |
| 1060 | if (proto == htons(0xffff)) { /* evil netware IPX 802.3 without LLC */ | 1049 | if (proto == htons(0xffff)) { /* evil netware IPX 802.3 without LLC */ |
| 1061 | DEBUG(3, "ray_cs translate_frame evil IPX\n"); | 1050 | pr_debug("ray_cs translate_frame evil IPX\n"); |
| 1062 | memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN); | 1051 | memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN); |
| 1063 | return 0 - ETH_HLEN; | 1052 | return 0 - ETH_HLEN; |
| 1064 | } | 1053 | } |
| @@ -1603,7 +1592,7 @@ static int ray_open(struct net_device *dev) | |||
| 1603 | struct pcmcia_device *link; | 1592 | struct pcmcia_device *link; |
| 1604 | link = local->finder; | 1593 | link = local->finder; |
| 1605 | 1594 | ||
| 1606 | DEBUG(1, "ray_open('%s')\n", dev->name); | 1595 | dev_dbg(&link->dev, "ray_open('%s')\n", dev->name); |
| 1607 | 1596 | ||
| 1608 | if (link->open == 0) | 1597 | if (link->open == 0) |
| 1609 | local->num_multi = 0; | 1598 | local->num_multi = 0; |
| @@ -1613,7 +1602,7 @@ static int ray_open(struct net_device *dev) | |||
| 1613 | if (local->card_status == CARD_AWAITING_PARAM) { | 1602 | if (local->card_status == CARD_AWAITING_PARAM) { |
| 1614 | int i; | 1603 | int i; |
| 1615 | 1604 | ||
| 1616 | DEBUG(1, "ray_open: doing init now !\n"); | 1605 | dev_dbg(&link->dev, "ray_open: doing init now !\n"); |
| 1617 | 1606 | ||
| 1618 | /* Download startup parameters */ | 1607 | /* Download startup parameters */ |
| 1619 | if ((i = dl_startup_params(dev)) < 0) { | 1608 | if ((i = dl_startup_params(dev)) < 0) { |
| @@ -1629,7 +1618,7 @@ static int ray_open(struct net_device *dev) | |||
| 1629 | else | 1618 | else |
| 1630 | netif_start_queue(dev); | 1619 | netif_start_queue(dev); |
| 1631 | 1620 | ||
| 1632 | DEBUG(2, "ray_open ending\n"); | 1621 | dev_dbg(&link->dev, "ray_open ending\n"); |
| 1633 | return 0; | 1622 | return 0; |
| 1634 | } /* end ray_open */ | 1623 | } /* end ray_open */ |
| 1635 | 1624 | ||
| @@ -1640,7 +1629,7 @@ static int ray_dev_close(struct net_device *dev) | |||
| 1640 | struct pcmcia_device *link; | 1629 | struct pcmcia_device *link; |
| 1641 | link = local->finder; | 1630 | link = local->finder; |
| 1642 | 1631 | ||
| 1643 | DEBUG(1, "ray_dev_close('%s')\n", dev->name); | 1632 | dev_dbg(&link->dev, "ray_dev_close('%s')\n", dev->name); |
| 1644 | 1633 | ||
| 1645 | link->open--; | 1634 | link->open--; |
| 1646 | netif_stop_queue(dev); | 1635 | netif_stop_queue(dev); |
| @@ -1656,7 +1645,7 @@ static int ray_dev_close(struct net_device *dev) | |||
| 1656 | /*===========================================================================*/ | 1645 | /*===========================================================================*/ |
| 1657 | static void ray_reset(struct net_device *dev) | 1646 | static void ray_reset(struct net_device *dev) |
| 1658 | { | 1647 | { |
| 1659 | DEBUG(1, "ray_reset entered\n"); | 1648 | pr_debug("ray_reset entered\n"); |
| 1660 | return; | 1649 | return; |
| 1661 | } | 1650 | } |
| 1662 | 1651 | ||
| @@ -1669,17 +1658,17 @@ static int interrupt_ecf(ray_dev_t *local, int ccs) | |||
| 1669 | struct pcmcia_device *link = local->finder; | 1658 | struct pcmcia_device *link = local->finder; |
| 1670 | 1659 | ||
| 1671 | if (!(pcmcia_dev_present(link))) { | 1660 | if (!(pcmcia_dev_present(link))) { |
| 1672 | DEBUG(2, "ray_cs interrupt_ecf - device not present\n"); | 1661 | dev_dbg(&link->dev, "ray_cs interrupt_ecf - device not present\n"); |
| 1673 | return -1; | 1662 | return -1; |
| 1674 | } | 1663 | } |
| 1675 | DEBUG(2, "interrupt_ecf(local=%p, ccs = 0x%x\n", local, ccs); | 1664 | dev_dbg(&link->dev, "interrupt_ecf(local=%p, ccs = 0x%x\n", local, ccs); |
| 1676 | 1665 | ||
| 1677 | while (i && | 1666 | while (i && |
| 1678 | (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) & | 1667 | (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) & |
| 1679 | ECF_INTR_SET)) | 1668 | ECF_INTR_SET)) |
| 1680 | i--; | 1669 | i--; |
| 1681 | if (i == 0) { | 1670 | if (i == 0) { |
| 1682 | DEBUG(2, "ray_cs interrupt_ecf card not ready for interrupt\n"); | 1671 | dev_dbg(&link->dev, "ray_cs interrupt_ecf card not ready for interrupt\n"); |
| 1683 | return -1; | 1672 | return -1; |
| 1684 | } | 1673 | } |
| 1685 | /* Fill the mailbox, then kick the card */ | 1674 | /* Fill the mailbox, then kick the card */ |
| @@ -1698,12 +1687,12 @@ static int get_free_tx_ccs(ray_dev_t *local) | |||
| 1698 | struct pcmcia_device *link = local->finder; | 1687 | struct pcmcia_device *link = local->finder; |
| 1699 | 1688 | ||
| 1700 | if (!(pcmcia_dev_present(link))) { | 1689 | if (!(pcmcia_dev_present(link))) { |
| 1701 | DEBUG(2, "ray_cs get_free_tx_ccs - device not present\n"); | 1690 | dev_dbg(&link->dev, "ray_cs get_free_tx_ccs - device not present\n"); |
| 1702 | return ECARDGONE; | 1691 | return ECARDGONE; |
| 1703 | } | 1692 | } |
| 1704 | 1693 | ||
| 1705 | if (test_and_set_bit(0, &local->tx_ccs_lock)) { | 1694 | if (test_and_set_bit(0, &local->tx_ccs_lock)) { |
| 1706 | DEBUG(1, "ray_cs tx_ccs_lock busy\n"); | 1695 | dev_dbg(&link->dev, "ray_cs tx_ccs_lock busy\n"); |
| 1707 | return ECCSBUSY; | 1696 | return ECCSBUSY; |
| 1708 | } | 1697 | } |
| 1709 | 1698 | ||
| @@ -1716,7 +1705,7 @@ static int get_free_tx_ccs(ray_dev_t *local) | |||
| 1716 | } | 1705 | } |
| 1717 | } | 1706 | } |
| 1718 | local->tx_ccs_lock = 0; | 1707 | local->tx_ccs_lock = 0; |
| 1719 | DEBUG(2, "ray_cs ERROR no free tx CCS for raylink card\n"); | 1708 | dev_dbg(&link->dev, "ray_cs ERROR no free tx CCS for raylink card\n"); |
| 1720 | return ECCSFULL; | 1709 | return ECCSFULL; |
| 1721 | } /* get_free_tx_ccs */ | 1710 | } /* get_free_tx_ccs */ |
| 1722 | 1711 | ||
| @@ -1730,11 +1719,11 @@ static int get_free_ccs(ray_dev_t *local) | |||
| 1730 | struct pcmcia_device *link = local->finder; | 1719 | struct pcmcia_device *link = local->finder; |
| 1731 | 1720 | ||
| 1732 | if (!(pcmcia_dev_present(link))) { | 1721 | if (!(pcmcia_dev_present(link))) { |
| 1733 | DEBUG(2, "ray_cs get_free_ccs - device not present\n"); | 1722 | dev_dbg(&link->dev, "ray_cs get_free_ccs - device not present\n"); |
| 1734 | return ECARDGONE; | 1723 | return ECARDGONE; |
| 1735 | } | 1724 | } |
| 1736 | if (test_and_set_bit(0, &local->ccs_lock)) { | 1725 | if (test_and_set_bit(0, &local->ccs_lock)) { |
| 1737 | DEBUG(1, "ray_cs ccs_lock busy\n"); | 1726 | dev_dbg(&link->dev, "ray_cs ccs_lock busy\n"); |
| 1738 | return ECCSBUSY; | 1727 | return ECCSBUSY; |
| 1739 | } | 1728 | } |
| 1740 | 1729 | ||
| @@ -1747,7 +1736,7 @@ static int get_free_ccs(ray_dev_t *local) | |||
| 1747 | } | 1736 | } |
| 1748 | } | 1737 | } |
| 1749 | local->ccs_lock = 0; | 1738 | local->ccs_lock = 0; |
| 1750 | DEBUG(1, "ray_cs ERROR no free CCS for raylink card\n"); | 1739 | dev_dbg(&link->dev, "ray_cs ERROR no free CCS for raylink card\n"); |
| 1751 | return ECCSFULL; | 1740 | return ECCSFULL; |
| 1752 | } /* get_free_ccs */ | 1741 | } /* get_free_ccs */ |
| 1753 | 1742 | ||
| @@ -1823,7 +1812,7 @@ static struct net_device_stats *ray_get_stats(struct net_device *dev) | |||
| 1823 | struct pcmcia_device *link = local->finder; | 1812 | struct pcmcia_device *link = local->finder; |
| 1824 | struct status __iomem *p = local->sram + STATUS_BASE; | 1813 | struct status __iomem *p = local->sram + STATUS_BASE; |
| 1825 | if (!(pcmcia_dev_present(link))) { | 1814 | if (!(pcmcia_dev_present(link))) { |
| 1826 | DEBUG(2, "ray_cs net_device_stats - device not present\n"); | 1815 | dev_dbg(&link->dev, "ray_cs net_device_stats - device not present\n"); |
| 1827 | return &local->stats; | 1816 | return &local->stats; |
| 1828 | } | 1817 | } |
| 1829 | if (readb(&p->mrx_overflow_for_host)) { | 1818 | if (readb(&p->mrx_overflow_for_host)) { |
| @@ -1856,12 +1845,12 @@ static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, | |||
| 1856 | struct ccs __iomem *pccs; | 1845 | struct ccs __iomem *pccs; |
| 1857 | 1846 | ||
| 1858 | if (!(pcmcia_dev_present(link))) { | 1847 | if (!(pcmcia_dev_present(link))) { |
| 1859 | DEBUG(2, "ray_update_parm - device not present\n"); | 1848 | dev_dbg(&link->dev, "ray_update_parm - device not present\n"); |
| 1860 | return; | 1849 | return; |
| 1861 | } | 1850 | } |
| 1862 | 1851 | ||
| 1863 | if ((ccsindex = get_free_ccs(local)) < 0) { | 1852 | if ((ccsindex = get_free_ccs(local)) < 0) { |
| 1864 | DEBUG(0, "ray_update_parm - No free ccs\n"); | 1853 | dev_dbg(&link->dev, "ray_update_parm - No free ccs\n"); |
| 1865 | return; | 1854 | return; |
| 1866 | } | 1855 | } |
| 1867 | pccs = ccs_base(local) + ccsindex; | 1856 | pccs = ccs_base(local) + ccsindex; |
| @@ -1874,7 +1863,7 @@ static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, | |||
| 1874 | } | 1863 | } |
| 1875 | /* Interrupt the firmware to process the command */ | 1864 | /* Interrupt the firmware to process the command */ |
| 1876 | if (interrupt_ecf(local, ccsindex)) { | 1865 | if (interrupt_ecf(local, ccsindex)) { |
| 1877 | DEBUG(0, "ray_cs associate failed - ECF not ready for intr\n"); | 1866 | dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n"); |
| 1878 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 1867 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
| 1879 | } | 1868 | } |
| 1880 | } | 1869 | } |
| @@ -1891,12 +1880,12 @@ static void ray_update_multi_list(struct net_device *dev, int all) | |||
| 1891 | void __iomem *p = local->sram + HOST_TO_ECF_BASE; | 1880 | void __iomem *p = local->sram + HOST_TO_ECF_BASE; |
| 1892 | 1881 | ||
| 1893 | if (!(pcmcia_dev_present(link))) { | 1882 | if (!(pcmcia_dev_present(link))) { |
| 1894 | DEBUG(2, "ray_update_multi_list - device not present\n"); | 1883 | dev_dbg(&link->dev, "ray_update_multi_list - device not present\n"); |
| 1895 | return; | 1884 | return; |
| 1896 | } else | 1885 | } else |
| 1897 | DEBUG(2, "ray_update_multi_list(%p)\n", dev); | 1886 | dev_dbg(&link->dev, "ray_update_multi_list(%p)\n", dev); |
| 1898 | if ((ccsindex = get_free_ccs(local)) < 0) { | 1887 | if ((ccsindex = get_free_ccs(local)) < 0) { |
| 1899 | DEBUG(1, "ray_update_multi - No free ccs\n"); | 1888 | dev_dbg(&link->dev, "ray_update_multi - No free ccs\n"); |
| 1900 | return; | 1889 | return; |
| 1901 | } | 1890 | } |
| 1902 | pccs = ccs_base(local) + ccsindex; | 1891 | pccs = ccs_base(local) + ccsindex; |
| @@ -1910,7 +1899,7 @@ static void ray_update_multi_list(struct net_device *dev, int all) | |||
| 1910 | for (dmip = &dev->mc_list; (dmi = *dmip) != NULL; | 1899 | for (dmip = &dev->mc_list; (dmi = *dmip) != NULL; |
| 1911 | dmip = &dmi->next) { | 1900 | dmip = &dmi->next) { |
| 1912 | memcpy_toio(p, dmi->dmi_addr, ETH_ALEN); | 1901 | memcpy_toio(p, dmi->dmi_addr, ETH_ALEN); |
| 1913 | DEBUG(1, | 1902 | dev_dbg(&link->dev, |
| 1914 | "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n", | 1903 | "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n", |
| 1915 | dmi->dmi_addr[0], dmi->dmi_addr[1], | 1904 | dmi->dmi_addr[0], dmi->dmi_addr[1], |
| 1916 | dmi->dmi_addr[2], dmi->dmi_addr[3], | 1905 | dmi->dmi_addr[2], dmi->dmi_addr[3], |
| @@ -1921,12 +1910,12 @@ static void ray_update_multi_list(struct net_device *dev, int all) | |||
| 1921 | if (i > 256 / ADDRLEN) | 1910 | if (i > 256 / ADDRLEN) |
| 1922 | i = 256 / ADDRLEN; | 1911 | i = 256 / ADDRLEN; |
| 1923 | writeb((UCHAR) i, &pccs->var); | 1912 | writeb((UCHAR) i, &pccs->var); |
| 1924 | DEBUG(1, "ray_cs update_multi %d addresses in list\n", i); | 1913 | dev_dbg(&link->dev, "ray_cs update_multi %d addresses in list\n", i); |
| 1925 | /* Interrupt the firmware to process the command */ | 1914 | /* Interrupt the firmware to process the command */ |
| 1926 | local->num_multi = i; | 1915 | local->num_multi = i; |
| 1927 | } | 1916 | } |
| 1928 | if (interrupt_ecf(local, ccsindex)) { | 1917 | if (interrupt_ecf(local, ccsindex)) { |
| 1929 | DEBUG(1, | 1918 | dev_dbg(&link->dev, |
| 1930 | "ray_cs update_multi failed - ECF not ready for intr\n"); | 1919 | "ray_cs update_multi failed - ECF not ready for intr\n"); |
| 1931 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 1920 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
| 1932 | } | 1921 | } |
| @@ -1938,11 +1927,11 @@ static void set_multicast_list(struct net_device *dev) | |||
| 1938 | ray_dev_t *local = netdev_priv(dev); | 1927 | ray_dev_t *local = netdev_priv(dev); |
| 1939 | UCHAR promisc; | 1928 | UCHAR promisc; |
| 1940 | 1929 | ||
| 1941 | DEBUG(2, "ray_cs set_multicast_list(%p)\n", dev); | 1930 | pr_debug("ray_cs set_multicast_list(%p)\n", dev); |
| 1942 | 1931 | ||
| 1943 | if (dev->flags & IFF_PROMISC) { | 1932 | if (dev->flags & IFF_PROMISC) { |
| 1944 | if (local->sparm.b5.a_promiscuous_mode == 0) { | 1933 | if (local->sparm.b5.a_promiscuous_mode == 0) { |
| 1945 | DEBUG(1, "ray_cs set_multicast_list promisc on\n"); | 1934 | pr_debug("ray_cs set_multicast_list promisc on\n"); |
| 1946 | local->sparm.b5.a_promiscuous_mode = 1; | 1935 | local->sparm.b5.a_promiscuous_mode = 1; |
| 1947 | promisc = 1; | 1936 | promisc = 1; |
| 1948 | ray_update_parm(dev, OBJID_promiscuous_mode, | 1937 | ray_update_parm(dev, OBJID_promiscuous_mode, |
| @@ -1950,7 +1939,7 @@ static void set_multicast_list(struct net_device *dev) | |||
| 1950 | } | 1939 | } |
| 1951 | } else { | 1940 | } else { |
| 1952 | if (local->sparm.b5.a_promiscuous_mode == 1) { | 1941 | if (local->sparm.b5.a_promiscuous_mode == 1) { |
| 1953 | DEBUG(1, "ray_cs set_multicast_list promisc off\n"); | 1942 | pr_debug("ray_cs set_multicast_list promisc off\n"); |
| 1954 | local->sparm.b5.a_promiscuous_mode = 0; | 1943 | local->sparm.b5.a_promiscuous_mode = 0; |
| 1955 | promisc = 0; | 1944 | promisc = 0; |
| 1956 | ray_update_parm(dev, OBJID_promiscuous_mode, | 1945 | ray_update_parm(dev, OBJID_promiscuous_mode, |
| @@ -1984,19 +1973,19 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
| 1984 | if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */ | 1973 | if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */ |
| 1985 | return IRQ_NONE; | 1974 | return IRQ_NONE; |
| 1986 | 1975 | ||
| 1987 | DEBUG(4, "ray_cs: interrupt for *dev=%p\n", dev); | 1976 | pr_debug("ray_cs: interrupt for *dev=%p\n", dev); |
| 1988 | 1977 | ||
| 1989 | local = netdev_priv(dev); | 1978 | local = netdev_priv(dev); |
| 1990 | link = (struct pcmcia_device *)local->finder; | 1979 | link = (struct pcmcia_device *)local->finder; |
| 1991 | if (!pcmcia_dev_present(link)) { | 1980 | if (!pcmcia_dev_present(link)) { |
| 1992 | DEBUG(2, | 1981 | pr_debug( |
| 1993 | "ray_cs interrupt from device not present or suspended.\n"); | 1982 | "ray_cs interrupt from device not present or suspended.\n"); |
| 1994 | return IRQ_NONE; | 1983 | return IRQ_NONE; |
| 1995 | } | 1984 | } |
| 1996 | rcsindex = readb(&((struct scb __iomem *)(local->sram))->rcs_index); | 1985 | rcsindex = readb(&((struct scb __iomem *)(local->sram))->rcs_index); |
| 1997 | 1986 | ||
| 1998 | if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { | 1987 | if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { |
| 1999 | DEBUG(1, "ray_cs interrupt bad rcsindex = 0x%x\n", rcsindex); | 1988 | dev_dbg(&link->dev, "ray_cs interrupt bad rcsindex = 0x%x\n", rcsindex); |
| 2000 | clear_interrupt(local); | 1989 | clear_interrupt(local); |
| 2001 | return IRQ_HANDLED; | 1990 | return IRQ_HANDLED; |
| 2002 | } | 1991 | } |
| @@ -2008,33 +1997,33 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
| 2008 | case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */ | 1997 | case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */ |
| 2009 | del_timer(&local->timer); | 1998 | del_timer(&local->timer); |
| 2010 | if (status == CCS_COMMAND_COMPLETE) { | 1999 | if (status == CCS_COMMAND_COMPLETE) { |
| 2011 | DEBUG(1, | 2000 | dev_dbg(&link->dev, |
| 2012 | "ray_cs interrupt download_startup_parameters OK\n"); | 2001 | "ray_cs interrupt download_startup_parameters OK\n"); |
| 2013 | } else { | 2002 | } else { |
| 2014 | DEBUG(1, | 2003 | dev_dbg(&link->dev, |
| 2015 | "ray_cs interrupt download_startup_parameters fail\n"); | 2004 | "ray_cs interrupt download_startup_parameters fail\n"); |
| 2016 | } | 2005 | } |
| 2017 | break; | 2006 | break; |
| 2018 | case CCS_UPDATE_PARAMS: | 2007 | case CCS_UPDATE_PARAMS: |
| 2019 | DEBUG(1, "ray_cs interrupt update params done\n"); | 2008 | dev_dbg(&link->dev, "ray_cs interrupt update params done\n"); |
| 2020 | if (status != CCS_COMMAND_COMPLETE) { | 2009 | if (status != CCS_COMMAND_COMPLETE) { |
| 2021 | tmp = | 2010 | tmp = |
| 2022 | readb(&pccs->var.update_param. | 2011 | readb(&pccs->var.update_param. |
| 2023 | failure_cause); | 2012 | failure_cause); |
| 2024 | DEBUG(0, | 2013 | dev_dbg(&link->dev, |
| 2025 | "ray_cs interrupt update params failed - reason %d\n", | 2014 | "ray_cs interrupt update params failed - reason %d\n", |
| 2026 | tmp); | 2015 | tmp); |
| 2027 | } | 2016 | } |
| 2028 | break; | 2017 | break; |
| 2029 | case CCS_REPORT_PARAMS: | 2018 | case CCS_REPORT_PARAMS: |
| 2030 | DEBUG(1, "ray_cs interrupt report params done\n"); | 2019 | dev_dbg(&link->dev, "ray_cs interrupt report params done\n"); |
| 2031 | break; | 2020 | break; |
| 2032 | case CCS_UPDATE_MULTICAST_LIST: /* Note that this CCS isn't returned */ | 2021 | case CCS_UPDATE_MULTICAST_LIST: /* Note that this CCS isn't returned */ |
| 2033 | DEBUG(1, | 2022 | dev_dbg(&link->dev, |
| 2034 | "ray_cs interrupt CCS Update Multicast List done\n"); | 2023 | "ray_cs interrupt CCS Update Multicast List done\n"); |
| 2035 | break; | 2024 | break; |
| 2036 | case CCS_UPDATE_POWER_SAVINGS_MODE: | 2025 | case CCS_UPDATE_POWER_SAVINGS_MODE: |
| 2037 | DEBUG(1, | 2026 | dev_dbg(&link->dev, |
| 2038 | "ray_cs interrupt update power save mode done\n"); | 2027 | "ray_cs interrupt update power save mode done\n"); |
| 2039 | break; | 2028 | break; |
| 2040 | case CCS_START_NETWORK: | 2029 | case CCS_START_NETWORK: |
| @@ -2043,11 +2032,11 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
| 2043 | if (readb | 2032 | if (readb |
| 2044 | (&pccs->var.start_network.net_initiated) == | 2033 | (&pccs->var.start_network.net_initiated) == |
| 2045 | 1) { | 2034 | 1) { |
| 2046 | DEBUG(0, | 2035 | dev_dbg(&link->dev, |
| 2047 | "ray_cs interrupt network \"%s\" started\n", | 2036 | "ray_cs interrupt network \"%s\" started\n", |
| 2048 | local->sparm.b4.a_current_ess_id); | 2037 | local->sparm.b4.a_current_ess_id); |
| 2049 | } else { | 2038 | } else { |
| 2050 | DEBUG(0, | 2039 | dev_dbg(&link->dev, |
| 2051 | "ray_cs interrupt network \"%s\" joined\n", | 2040 | "ray_cs interrupt network \"%s\" joined\n", |
| 2052 | local->sparm.b4.a_current_ess_id); | 2041 | local->sparm.b4.a_current_ess_id); |
| 2053 | } | 2042 | } |
| @@ -2075,12 +2064,12 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
| 2075 | local->timer.expires = jiffies + HZ * 5; | 2064 | local->timer.expires = jiffies + HZ * 5; |
| 2076 | local->timer.data = (long)local; | 2065 | local->timer.data = (long)local; |
| 2077 | if (status == CCS_START_NETWORK) { | 2066 | if (status == CCS_START_NETWORK) { |
| 2078 | DEBUG(0, | 2067 | dev_dbg(&link->dev, |
| 2079 | "ray_cs interrupt network \"%s\" start failed\n", | 2068 | "ray_cs interrupt network \"%s\" start failed\n", |
| 2080 | local->sparm.b4.a_current_ess_id); | 2069 | local->sparm.b4.a_current_ess_id); |
| 2081 | local->timer.function = &start_net; | 2070 | local->timer.function = &start_net; |
| 2082 | } else { | 2071 | } else { |
| 2083 | DEBUG(0, | 2072 | dev_dbg(&link->dev, |
| 2084 | "ray_cs interrupt network \"%s\" join failed\n", | 2073 | "ray_cs interrupt network \"%s\" join failed\n", |
| 2085 | local->sparm.b4.a_current_ess_id); | 2074 | local->sparm.b4.a_current_ess_id); |
| 2086 | local->timer.function = &join_net; | 2075 | local->timer.function = &join_net; |
| @@ -2091,19 +2080,19 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
| 2091 | case CCS_START_ASSOCIATION: | 2080 | case CCS_START_ASSOCIATION: |
| 2092 | if (status == CCS_COMMAND_COMPLETE) { | 2081 | if (status == CCS_COMMAND_COMPLETE) { |
| 2093 | local->card_status = CARD_ASSOC_COMPLETE; | 2082 | local->card_status = CARD_ASSOC_COMPLETE; |
| 2094 | DEBUG(0, "ray_cs association successful\n"); | 2083 | dev_dbg(&link->dev, "ray_cs association successful\n"); |
| 2095 | } else { | 2084 | } else { |
| 2096 | DEBUG(0, "ray_cs association failed,\n"); | 2085 | dev_dbg(&link->dev, "ray_cs association failed,\n"); |
| 2097 | local->card_status = CARD_ASSOC_FAILED; | 2086 | local->card_status = CARD_ASSOC_FAILED; |
| 2098 | join_net((u_long) local); | 2087 | join_net((u_long) local); |
| 2099 | } | 2088 | } |
| 2100 | break; | 2089 | break; |
| 2101 | case CCS_TX_REQUEST: | 2090 | case CCS_TX_REQUEST: |
| 2102 | if (status == CCS_COMMAND_COMPLETE) { | 2091 | if (status == CCS_COMMAND_COMPLETE) { |
| 2103 | DEBUG(3, | 2092 | dev_dbg(&link->dev, |
| 2104 | "ray_cs interrupt tx request complete\n"); | 2093 | "ray_cs interrupt tx request complete\n"); |
| 2105 | } else { | 2094 | } else { |
| 2106 | DEBUG(1, | 2095 | dev_dbg(&link->dev, |
| 2107 | "ray_cs interrupt tx request failed\n"); | 2096 | "ray_cs interrupt tx request failed\n"); |
| 2108 | } | 2097 | } |
| 2109 | if (!sniffer) | 2098 | if (!sniffer) |
| @@ -2111,21 +2100,21 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
| 2111 | netif_wake_queue(dev); | 2100 | netif_wake_queue(dev); |
| 2112 | break; | 2101 | break; |
| 2113 | case CCS_TEST_MEMORY: | 2102 | case CCS_TEST_MEMORY: |
| 2114 | DEBUG(1, "ray_cs interrupt mem test done\n"); | 2103 | dev_dbg(&link->dev, "ray_cs interrupt mem test done\n"); |
| 2115 | break; | 2104 | break; |
| 2116 | case CCS_SHUTDOWN: | 2105 | case CCS_SHUTDOWN: |
| 2117 | DEBUG(1, | 2106 | dev_dbg(&link->dev, |
| 2118 | "ray_cs interrupt Unexpected CCS returned - Shutdown\n"); | 2107 | "ray_cs interrupt Unexpected CCS returned - Shutdown\n"); |
| 2119 | break; | 2108 | break; |
| 2120 | case CCS_DUMP_MEMORY: | 2109 | case CCS_DUMP_MEMORY: |
| 2121 | DEBUG(1, "ray_cs interrupt dump memory done\n"); | 2110 | dev_dbg(&link->dev, "ray_cs interrupt dump memory done\n"); |
| 2122 | break; | 2111 | break; |
| 2123 | case CCS_START_TIMER: | 2112 | case CCS_START_TIMER: |
| 2124 | DEBUG(2, | 2113 | dev_dbg(&link->dev, |
| 2125 | "ray_cs interrupt DING - raylink timer expired\n"); | 2114 | "ray_cs interrupt DING - raylink timer expired\n"); |
| 2126 | break; | 2115 | break; |
| 2127 | default: | 2116 | default: |
| 2128 | DEBUG(1, | 2117 | dev_dbg(&link->dev, |
| 2129 | "ray_cs interrupt Unexpected CCS 0x%x returned 0x%x\n", | 2118 | "ray_cs interrupt Unexpected CCS 0x%x returned 0x%x\n", |
| 2130 | rcsindex, cmd); | 2119 | rcsindex, cmd); |
| 2131 | } | 2120 | } |
| @@ -2139,7 +2128,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
| 2139 | ray_rx(dev, local, prcs); | 2128 | ray_rx(dev, local, prcs); |
| 2140 | break; | 2129 | break; |
| 2141 | case REJOIN_NET_COMPLETE: | 2130 | case REJOIN_NET_COMPLETE: |
| 2142 | DEBUG(1, "ray_cs interrupt rejoin net complete\n"); | 2131 | dev_dbg(&link->dev, "ray_cs interrupt rejoin net complete\n"); |
| 2143 | local->card_status = CARD_ACQ_COMPLETE; | 2132 | local->card_status = CARD_ACQ_COMPLETE; |
| 2144 | /* do we need to clear tx buffers CCS's? */ | 2133 | /* do we need to clear tx buffers CCS's? */ |
| 2145 | if (local->sparm.b4.a_network_type == ADHOC) { | 2134 | if (local->sparm.b4.a_network_type == ADHOC) { |
| @@ -2149,7 +2138,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
| 2149 | memcpy_fromio(&local->bss_id, | 2138 | memcpy_fromio(&local->bss_id, |
| 2150 | prcs->var.rejoin_net_complete. | 2139 | prcs->var.rejoin_net_complete. |
| 2151 | bssid, ADDRLEN); | 2140 | bssid, ADDRLEN); |
| 2152 | DEBUG(1, | 2141 | dev_dbg(&link->dev, |
| 2153 | "ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n", | 2142 | "ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n", |
| 2154 | local->bss_id[0], local->bss_id[1], | 2143 | local->bss_id[0], local->bss_id[1], |
| 2155 | local->bss_id[2], local->bss_id[3], | 2144 | local->bss_id[2], local->bss_id[3], |
| @@ -2159,15 +2148,15 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
| 2159 | } | 2148 | } |
| 2160 | break; | 2149 | break; |
| 2161 | case ROAMING_INITIATED: | 2150 | case ROAMING_INITIATED: |
| 2162 | DEBUG(1, "ray_cs interrupt roaming initiated\n"); | 2151 | dev_dbg(&link->dev, "ray_cs interrupt roaming initiated\n"); |
| 2163 | netif_stop_queue(dev); | 2152 | netif_stop_queue(dev); |
| 2164 | local->card_status = CARD_DOING_ACQ; | 2153 | local->card_status = CARD_DOING_ACQ; |
| 2165 | break; | 2154 | break; |
| 2166 | case JAPAN_CALL_SIGN_RXD: | 2155 | case JAPAN_CALL_SIGN_RXD: |
| 2167 | DEBUG(1, "ray_cs interrupt japan call sign rx\n"); | 2156 | dev_dbg(&link->dev, "ray_cs interrupt japan call sign rx\n"); |
| 2168 | break; | 2157 | break; |
| 2169 | default: | 2158 | default: |
| 2170 | DEBUG(1, | 2159 | dev_dbg(&link->dev, |
| 2171 | "ray_cs Unexpected interrupt for RCS 0x%x cmd = 0x%x\n", | 2160 | "ray_cs Unexpected interrupt for RCS 0x%x cmd = 0x%x\n", |
| 2172 | rcsindex, | 2161 | rcsindex, |
| 2173 | (unsigned int)readb(&prcs->interrupt_id)); | 2162 | (unsigned int)readb(&prcs->interrupt_id)); |
| @@ -2186,7 +2175,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local, | |||
| 2186 | int rx_len; | 2175 | int rx_len; |
| 2187 | unsigned int pkt_addr; | 2176 | unsigned int pkt_addr; |
| 2188 | void __iomem *pmsg; | 2177 | void __iomem *pmsg; |
| 2189 | DEBUG(4, "ray_rx process rx packet\n"); | 2178 | pr_debug("ray_rx process rx packet\n"); |
| 2190 | 2179 | ||
| 2191 | /* Calculate address of packet within Rx buffer */ | 2180 | /* Calculate address of packet within Rx buffer */ |
| 2192 | pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8) | 2181 | pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8) |
| @@ -2199,28 +2188,28 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local, | |||
| 2199 | pmsg = local->rmem + pkt_addr; | 2188 | pmsg = local->rmem + pkt_addr; |
| 2200 | switch (readb(pmsg)) { | 2189 | switch (readb(pmsg)) { |
| 2201 | case DATA_TYPE: | 2190 | case DATA_TYPE: |
| 2202 | DEBUG(4, "ray_rx data type\n"); | 2191 | pr_debug("ray_rx data type\n"); |
| 2203 | rx_data(dev, prcs, pkt_addr, rx_len); | 2192 | rx_data(dev, prcs, pkt_addr, rx_len); |
| 2204 | break; | 2193 | break; |
| 2205 | case AUTHENTIC_TYPE: | 2194 | case AUTHENTIC_TYPE: |
| 2206 | DEBUG(4, "ray_rx authentic type\n"); | 2195 | pr_debug("ray_rx authentic type\n"); |
| 2207 | if (sniffer) | 2196 | if (sniffer) |
| 2208 | rx_data(dev, prcs, pkt_addr, rx_len); | 2197 | rx_data(dev, prcs, pkt_addr, rx_len); |
| 2209 | else | 2198 | else |
| 2210 | rx_authenticate(local, prcs, pkt_addr, rx_len); | 2199 | rx_authenticate(local, prcs, pkt_addr, rx_len); |
| 2211 | break; | 2200 | break; |
| 2212 | case DEAUTHENTIC_TYPE: | 2201 | case DEAUTHENTIC_TYPE: |
| 2213 | DEBUG(4, "ray_rx deauth type\n"); | 2202 | pr_debug("ray_rx deauth type\n"); |
| 2214 | if (sniffer) | 2203 | if (sniffer) |
| 2215 | rx_data(dev, prcs, pkt_addr, rx_len); | 2204 | rx_data(dev, prcs, pkt_addr, rx_len); |
| 2216 | else | 2205 | else |
| 2217 | rx_deauthenticate(local, prcs, pkt_addr, rx_len); | 2206 | rx_deauthenticate(local, prcs, pkt_addr, rx_len); |
| 2218 | break; | 2207 | break; |
| 2219 | case NULL_MSG_TYPE: | 2208 | case NULL_MSG_TYPE: |
| 2220 | DEBUG(3, "ray_cs rx NULL msg\n"); | 2209 | pr_debug("ray_cs rx NULL msg\n"); |
| 2221 | break; | 2210 | break; |
| 2222 | case BEACON_TYPE: | 2211 | case BEACON_TYPE: |
| 2223 | DEBUG(4, "ray_rx beacon type\n"); | 2212 | pr_debug("ray_rx beacon type\n"); |
| 2224 | if (sniffer) | 2213 | if (sniffer) |
| 2225 | rx_data(dev, prcs, pkt_addr, rx_len); | 2214 | rx_data(dev, prcs, pkt_addr, rx_len); |
| 2226 | 2215 | ||
| @@ -2233,7 +2222,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local, | |||
| 2233 | ray_get_stats(dev); | 2222 | ray_get_stats(dev); |
| 2234 | break; | 2223 | break; |
| 2235 | default: | 2224 | default: |
| 2236 | DEBUG(0, "ray_cs unknown pkt type %2x\n", | 2225 | pr_debug("ray_cs unknown pkt type %2x\n", |
| 2237 | (unsigned int)readb(pmsg)); | 2226 | (unsigned int)readb(pmsg)); |
| 2238 | break; | 2227 | break; |
| 2239 | } | 2228 | } |
| @@ -2262,7 +2251,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
| 2262 | rx_len > | 2251 | rx_len > |
| 2263 | (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + | 2252 | (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + |
| 2264 | FCS_LEN)) { | 2253 | FCS_LEN)) { |
| 2265 | DEBUG(0, | 2254 | pr_debug( |
| 2266 | "ray_cs invalid packet length %d received \n", | 2255 | "ray_cs invalid packet length %d received \n", |
| 2267 | rx_len); | 2256 | rx_len); |
| 2268 | return; | 2257 | return; |
| @@ -2273,17 +2262,17 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
| 2273 | rx_len > | 2262 | rx_len > |
| 2274 | (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + | 2263 | (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + |
| 2275 | FCS_LEN)) { | 2264 | FCS_LEN)) { |
| 2276 | DEBUG(0, | 2265 | pr_debug( |
| 2277 | "ray_cs invalid packet length %d received \n", | 2266 | "ray_cs invalid packet length %d received \n", |
| 2278 | rx_len); | 2267 | rx_len); |
| 2279 | return; | 2268 | return; |
| 2280 | } | 2269 | } |
| 2281 | } | 2270 | } |
| 2282 | } | 2271 | } |
| 2283 | DEBUG(4, "ray_cs rx_data packet\n"); | 2272 | pr_debug("ray_cs rx_data packet\n"); |
| 2284 | /* If fragmented packet, verify sizes of fragments add up */ | 2273 | /* If fragmented packet, verify sizes of fragments add up */ |
| 2285 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { | 2274 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { |
| 2286 | DEBUG(1, "ray_cs rx'ed fragment\n"); | 2275 | pr_debug("ray_cs rx'ed fragment\n"); |
| 2287 | tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8) | 2276 | tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8) |
| 2288 | + readb(&prcs->var.rx_packet.totalpacketlength[1]); | 2277 | + readb(&prcs->var.rx_packet.totalpacketlength[1]); |
| 2289 | total_len = tmp; | 2278 | total_len = tmp; |
| @@ -2301,7 +2290,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
| 2301 | } while (1); | 2290 | } while (1); |
| 2302 | 2291 | ||
| 2303 | if (tmp < 0) { | 2292 | if (tmp < 0) { |
| 2304 | DEBUG(0, | 2293 | pr_debug( |
| 2305 | "ray_cs rx_data fragment lengths don't add up\n"); | 2294 | "ray_cs rx_data fragment lengths don't add up\n"); |
| 2306 | local->stats.rx_dropped++; | 2295 | local->stats.rx_dropped++; |
| 2307 | release_frag_chain(local, prcs); | 2296 | release_frag_chain(local, prcs); |
| @@ -2313,7 +2302,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
| 2313 | 2302 | ||
| 2314 | skb = dev_alloc_skb(total_len + 5); | 2303 | skb = dev_alloc_skb(total_len + 5); |
| 2315 | if (skb == NULL) { | 2304 | if (skb == NULL) { |
| 2316 | DEBUG(0, "ray_cs rx_data could not allocate skb\n"); | 2305 | pr_debug("ray_cs rx_data could not allocate skb\n"); |
| 2317 | local->stats.rx_dropped++; | 2306 | local->stats.rx_dropped++; |
| 2318 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) | 2307 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) |
| 2319 | release_frag_chain(local, prcs); | 2308 | release_frag_chain(local, prcs); |
| @@ -2321,7 +2310,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
| 2321 | } | 2310 | } |
| 2322 | skb_reserve(skb, 2); /* Align IP on 16 byte (TBD check this) */ | 2311 | skb_reserve(skb, 2); /* Align IP on 16 byte (TBD check this) */ |
| 2323 | 2312 | ||
| 2324 | DEBUG(4, "ray_cs rx_data total_len = %x, rx_len = %x\n", total_len, | 2313 | pr_debug("ray_cs rx_data total_len = %x, rx_len = %x\n", total_len, |
| 2325 | rx_len); | 2314 | rx_len); |
| 2326 | 2315 | ||
| 2327 | /************************/ | 2316 | /************************/ |
| @@ -2354,7 +2343,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
| 2354 | tmp = 17; | 2343 | tmp = 17; |
| 2355 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { | 2344 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { |
| 2356 | prcslink = prcs; | 2345 | prcslink = prcs; |
| 2357 | DEBUG(1, "ray_cs rx_data in fragment loop\n"); | 2346 | pr_debug("ray_cs rx_data in fragment loop\n"); |
| 2358 | do { | 2347 | do { |
| 2359 | prcslink = rcs_base(local) | 2348 | prcslink = rcs_base(local) |
| 2360 | + | 2349 | + |
| @@ -2426,8 +2415,8 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
| 2426 | memcpy(destaddr, ieee80211_get_DA(pmac), ADDRLEN); | 2415 | memcpy(destaddr, ieee80211_get_DA(pmac), ADDRLEN); |
| 2427 | memcpy(srcaddr, ieee80211_get_SA(pmac), ADDRLEN); | 2416 | memcpy(srcaddr, ieee80211_get_SA(pmac), ADDRLEN); |
| 2428 | 2417 | ||
| 2429 | #ifdef PCMCIA_DEBUG | 2418 | #if 0 |
| 2430 | if (pc_debug > 3) { | 2419 | if { |
| 2431 | print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ", | 2420 | print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ", |
| 2432 | DUMP_PREFIX_NONE, 16, 1, | 2421 | DUMP_PREFIX_NONE, 16, 1, |
| 2433 | skb->data, 64, true); | 2422 | skb->data, 64, true); |
| @@ -2441,7 +2430,7 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
| 2441 | 2430 | ||
| 2442 | if (psnap->dsap != 0xaa || psnap->ssap != 0xaa || psnap->ctrl != 3) { | 2431 | if (psnap->dsap != 0xaa || psnap->ssap != 0xaa || psnap->ctrl != 3) { |
| 2443 | /* not a snap type so leave it alone */ | 2432 | /* not a snap type so leave it alone */ |
| 2444 | DEBUG(3, "ray_cs untranslate NOT SNAP %02x %02x %02x\n", | 2433 | pr_debug("ray_cs untranslate NOT SNAP %02x %02x %02x\n", |
| 2445 | psnap->dsap, psnap->ssap, psnap->ctrl); | 2434 | psnap->dsap, psnap->ssap, psnap->ctrl); |
| 2446 | 2435 | ||
| 2447 | delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; | 2436 | delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; |
| @@ -2450,7 +2439,7 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
| 2450 | } else { /* Its a SNAP */ | 2439 | } else { /* Its a SNAP */ |
| 2451 | if (memcmp(psnap->org, org_bridge, 3) == 0) { | 2440 | if (memcmp(psnap->org, org_bridge, 3) == 0) { |
| 2452 | /* EtherII and nuke the LLC */ | 2441 | /* EtherII and nuke the LLC */ |
| 2453 | DEBUG(3, "ray_cs untranslate Bridge encap\n"); | 2442 | pr_debug("ray_cs untranslate Bridge encap\n"); |
| 2454 | delta = RX_MAC_HEADER_LENGTH | 2443 | delta = RX_MAC_HEADER_LENGTH |
| 2455 | + sizeof(struct snaphdr_t) - ETH_HLEN; | 2444 | + sizeof(struct snaphdr_t) - ETH_HLEN; |
| 2456 | peth = (struct ethhdr *)(skb->data + delta); | 2445 | peth = (struct ethhdr *)(skb->data + delta); |
| @@ -2459,14 +2448,14 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
| 2459 | switch (ntohs(type)) { | 2448 | switch (ntohs(type)) { |
| 2460 | case ETH_P_IPX: | 2449 | case ETH_P_IPX: |
| 2461 | case ETH_P_AARP: | 2450 | case ETH_P_AARP: |
| 2462 | DEBUG(3, "ray_cs untranslate RFC IPX/AARP\n"); | 2451 | pr_debug("ray_cs untranslate RFC IPX/AARP\n"); |
| 2463 | delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; | 2452 | delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; |
| 2464 | peth = (struct ethhdr *)(skb->data + delta); | 2453 | peth = (struct ethhdr *)(skb->data + delta); |
| 2465 | peth->h_proto = | 2454 | peth->h_proto = |
| 2466 | htons(len - RX_MAC_HEADER_LENGTH); | 2455 | htons(len - RX_MAC_HEADER_LENGTH); |
| 2467 | break; | 2456 | break; |
| 2468 | default: | 2457 | default: |
| 2469 | DEBUG(3, "ray_cs untranslate RFC default\n"); | 2458 | pr_debug("ray_cs untranslate RFC default\n"); |
| 2470 | delta = RX_MAC_HEADER_LENGTH + | 2459 | delta = RX_MAC_HEADER_LENGTH + |
| 2471 | sizeof(struct snaphdr_t) - ETH_HLEN; | 2460 | sizeof(struct snaphdr_t) - ETH_HLEN; |
| 2472 | peth = (struct ethhdr *)(skb->data + delta); | 2461 | peth = (struct ethhdr *)(skb->data + delta); |
| @@ -2482,12 +2471,12 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
| 2482 | } | 2471 | } |
| 2483 | /* TBD reserve skb_reserve(skb, delta); */ | 2472 | /* TBD reserve skb_reserve(skb, delta); */ |
| 2484 | skb_pull(skb, delta); | 2473 | skb_pull(skb, delta); |
| 2485 | DEBUG(3, "untranslate after skb_pull(%d), skb->data = %p\n", delta, | 2474 | pr_debug("untranslate after skb_pull(%d), skb->data = %p\n", delta, |
| 2486 | skb->data); | 2475 | skb->data); |
| 2487 | memcpy(peth->h_dest, destaddr, ADDRLEN); | 2476 | memcpy(peth->h_dest, destaddr, ADDRLEN); |
| 2488 | memcpy(peth->h_source, srcaddr, ADDRLEN); | 2477 | memcpy(peth->h_source, srcaddr, ADDRLEN); |
| 2489 | #ifdef PCMCIA_DEBUG | 2478 | #if 0 |
| 2490 | if (pc_debug > 3) { | 2479 | { |
| 2491 | int i; | 2480 | int i; |
| 2492 | printk(KERN_DEBUG "skb->data after untranslate:"); | 2481 | printk(KERN_DEBUG "skb->data after untranslate:"); |
| 2493 | for (i = 0; i < 64; i++) | 2482 | for (i = 0; i < 64; i++) |
| @@ -2529,7 +2518,7 @@ static void release_frag_chain(ray_dev_t *local, struct rcs __iomem *prcs) | |||
| 2529 | while (tmp--) { | 2518 | while (tmp--) { |
| 2530 | writeb(CCS_BUFFER_FREE, &prcslink->buffer_status); | 2519 | writeb(CCS_BUFFER_FREE, &prcslink->buffer_status); |
| 2531 | if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { | 2520 | if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { |
| 2532 | DEBUG(1, "ray_cs interrupt bad rcsindex = 0x%x\n", | 2521 | pr_debug("ray_cs interrupt bad rcsindex = 0x%x\n", |
| 2533 | rcsindex); | 2522 | rcsindex); |
| 2534 | break; | 2523 | break; |
| 2535 | } | 2524 | } |
| @@ -2543,9 +2532,9 @@ static void release_frag_chain(ray_dev_t *local, struct rcs __iomem *prcs) | |||
| 2543 | static void authenticate(ray_dev_t *local) | 2532 | static void authenticate(ray_dev_t *local) |
| 2544 | { | 2533 | { |
| 2545 | struct pcmcia_device *link = local->finder; | 2534 | struct pcmcia_device *link = local->finder; |
| 2546 | DEBUG(0, "ray_cs Starting authentication.\n"); | 2535 | dev_dbg(&link->dev, "ray_cs Starting authentication.\n"); |
| 2547 | if (!(pcmcia_dev_present(link))) { | 2536 | if (!(pcmcia_dev_present(link))) { |
| 2548 | DEBUG(2, "ray_cs authenticate - device not present\n"); | 2537 | dev_dbg(&link->dev, "ray_cs authenticate - device not present\n"); |
| 2549 | return; | 2538 | return; |
| 2550 | } | 2539 | } |
| 2551 | 2540 | ||
| @@ -2573,11 +2562,11 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs, | |||
| 2573 | copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); | 2562 | copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); |
| 2574 | /* if we are trying to get authenticated */ | 2563 | /* if we are trying to get authenticated */ |
| 2575 | if (local->sparm.b4.a_network_type == ADHOC) { | 2564 | if (local->sparm.b4.a_network_type == ADHOC) { |
| 2576 | DEBUG(1, "ray_cs rx_auth var= %02x %02x %02x %02x %02x %02x\n", | 2565 | pr_debug("ray_cs rx_auth var= %02x %02x %02x %02x %02x %02x\n", |
| 2577 | msg->var[0], msg->var[1], msg->var[2], msg->var[3], | 2566 | msg->var[0], msg->var[1], msg->var[2], msg->var[3], |
| 2578 | msg->var[4], msg->var[5]); | 2567 | msg->var[4], msg->var[5]); |
| 2579 | if (msg->var[2] == 1) { | 2568 | if (msg->var[2] == 1) { |
| 2580 | DEBUG(0, "ray_cs Sending authentication response.\n"); | 2569 | pr_debug("ray_cs Sending authentication response.\n"); |
| 2581 | if (!build_auth_frame | 2570 | if (!build_auth_frame |
| 2582 | (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) { | 2571 | (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) { |
| 2583 | local->authentication_state = NEED_TO_AUTH; | 2572 | local->authentication_state = NEED_TO_AUTH; |
| @@ -2591,13 +2580,13 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs, | |||
| 2591 | /* Verify authentication sequence #2 and success */ | 2580 | /* Verify authentication sequence #2 and success */ |
| 2592 | if (msg->var[2] == 2) { | 2581 | if (msg->var[2] == 2) { |
| 2593 | if ((msg->var[3] | msg->var[4]) == 0) { | 2582 | if ((msg->var[3] | msg->var[4]) == 0) { |
| 2594 | DEBUG(1, "Authentication successful\n"); | 2583 | pr_debug("Authentication successful\n"); |
| 2595 | local->card_status = CARD_AUTH_COMPLETE; | 2584 | local->card_status = CARD_AUTH_COMPLETE; |
| 2596 | associate(local); | 2585 | associate(local); |
| 2597 | local->authentication_state = | 2586 | local->authentication_state = |
| 2598 | AUTHENTICATED; | 2587 | AUTHENTICATED; |
| 2599 | } else { | 2588 | } else { |
| 2600 | DEBUG(0, "Authentication refused\n"); | 2589 | pr_debug("Authentication refused\n"); |
| 2601 | local->card_status = CARD_AUTH_REFUSED; | 2590 | local->card_status = CARD_AUTH_REFUSED; |
| 2602 | join_net((u_long) local); | 2591 | join_net((u_long) local); |
| 2603 | local->authentication_state = | 2592 | local->authentication_state = |
| @@ -2617,22 +2606,22 @@ static void associate(ray_dev_t *local) | |||
| 2617 | struct net_device *dev = link->priv; | 2606 | struct net_device *dev = link->priv; |
| 2618 | int ccsindex; | 2607 | int ccsindex; |
| 2619 | if (!(pcmcia_dev_present(link))) { | 2608 | if (!(pcmcia_dev_present(link))) { |
| 2620 | DEBUG(2, "ray_cs associate - device not present\n"); | 2609 | dev_dbg(&link->dev, "ray_cs associate - device not present\n"); |
| 2621 | return; | 2610 | return; |
| 2622 | } | 2611 | } |
| 2623 | /* If no tx buffers available, return */ | 2612 | /* If no tx buffers available, return */ |
| 2624 | if ((ccsindex = get_free_ccs(local)) < 0) { | 2613 | if ((ccsindex = get_free_ccs(local)) < 0) { |
| 2625 | /* TBD should never be here but... what if we are? */ | 2614 | /* TBD should never be here but... what if we are? */ |
| 2626 | DEBUG(1, "ray_cs associate - No free ccs\n"); | 2615 | dev_dbg(&link->dev, "ray_cs associate - No free ccs\n"); |
| 2627 | return; | 2616 | return; |
| 2628 | } | 2617 | } |
| 2629 | DEBUG(1, "ray_cs Starting association with access point\n"); | 2618 | dev_dbg(&link->dev, "ray_cs Starting association with access point\n"); |
| 2630 | pccs = ccs_base(local) + ccsindex; | 2619 | pccs = ccs_base(local) + ccsindex; |
| 2631 | /* fill in the CCS */ | 2620 | /* fill in the CCS */ |
| 2632 | writeb(CCS_START_ASSOCIATION, &pccs->cmd); | 2621 | writeb(CCS_START_ASSOCIATION, &pccs->cmd); |
| 2633 | /* Interrupt the firmware to process the command */ | 2622 | /* Interrupt the firmware to process the command */ |
| 2634 | if (interrupt_ecf(local, ccsindex)) { | 2623 | if (interrupt_ecf(local, ccsindex)) { |
| 2635 | DEBUG(1, "ray_cs associate failed - ECF not ready for intr\n"); | 2624 | dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n"); |
| 2636 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 2625 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
| 2637 | 2626 | ||
| 2638 | del_timer(&local->timer); | 2627 | del_timer(&local->timer); |
| @@ -2655,7 +2644,7 @@ static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs, | |||
| 2655 | /* UCHAR buff[256]; | 2644 | /* UCHAR buff[256]; |
| 2656 | struct rx_msg *msg = (struct rx_msg *)buff; | 2645 | struct rx_msg *msg = (struct rx_msg *)buff; |
| 2657 | */ | 2646 | */ |
| 2658 | DEBUG(0, "Deauthentication frame received\n"); | 2647 | pr_debug("Deauthentication frame received\n"); |
| 2659 | local->authentication_state = UNAUTHENTICATED; | 2648 | local->authentication_state = UNAUTHENTICATED; |
| 2660 | /* Need to reauthenticate or rejoin depending on reason code */ | 2649 | /* Need to reauthenticate or rejoin depending on reason code */ |
| 2661 | /* copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); | 2650 | /* copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); |
| @@ -2823,7 +2812,7 @@ static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type) | |||
| 2823 | 2812 | ||
| 2824 | /* If no tx buffers available, return */ | 2813 | /* If no tx buffers available, return */ |
| 2825 | if ((ccsindex = get_free_tx_ccs(local)) < 0) { | 2814 | if ((ccsindex = get_free_tx_ccs(local)) < 0) { |
| 2826 | DEBUG(1, "ray_cs send authenticate - No free tx ccs\n"); | 2815 | pr_debug("ray_cs send authenticate - No free tx ccs\n"); |
| 2827 | return -1; | 2816 | return -1; |
| 2828 | } | 2817 | } |
| 2829 | 2818 | ||
| @@ -2855,7 +2844,7 @@ static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type) | |||
| 2855 | 2844 | ||
| 2856 | /* Interrupt the firmware to process the command */ | 2845 | /* Interrupt the firmware to process the command */ |
| 2857 | if (interrupt_ecf(local, ccsindex)) { | 2846 | if (interrupt_ecf(local, ccsindex)) { |
| 2858 | DEBUG(1, | 2847 | pr_debug( |
| 2859 | "ray_cs send authentication request failed - ECF not ready for intr\n"); | 2848 | "ray_cs send authentication request failed - ECF not ready for intr\n"); |
| 2860 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 2849 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
| 2861 | return -1; | 2850 | return -1; |
| @@ -2942,9 +2931,9 @@ static int __init init_ray_cs(void) | |||
| 2942 | { | 2931 | { |
| 2943 | int rc; | 2932 | int rc; |
| 2944 | 2933 | ||
| 2945 | DEBUG(1, "%s\n", rcsid); | 2934 | pr_debug("%s\n", rcsid); |
| 2946 | rc = pcmcia_register_driver(&ray_driver); | 2935 | rc = pcmcia_register_driver(&ray_driver); |
| 2947 | DEBUG(1, "raylink init_module register_pcmcia_driver returns 0x%x\n", | 2936 | pr_debug("raylink init_module register_pcmcia_driver returns 0x%x\n", |
| 2948 | rc); | 2937 | rc); |
| 2949 | 2938 | ||
| 2950 | #ifdef CONFIG_PROC_FS | 2939 | #ifdef CONFIG_PROC_FS |
| @@ -2964,7 +2953,7 @@ static int __init init_ray_cs(void) | |||
| 2964 | 2953 | ||
| 2965 | static void __exit exit_ray_cs(void) | 2954 | static void __exit exit_ray_cs(void) |
| 2966 | { | 2955 | { |
| 2967 | DEBUG(0, "ray_cs: cleanup_module\n"); | 2956 | pr_debug("ray_cs: cleanup_module\n"); |
| 2968 | 2957 | ||
| 2969 | #ifdef CONFIG_PROC_FS | 2958 | #ifdef CONFIG_PROC_FS |
| 2970 | remove_proc_entry("driver/ray_cs/ray_cs", NULL); | 2959 | remove_proc_entry("driver/ray_cs/ray_cs", NULL); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 71761b343839..73bbec58341e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
| @@ -815,6 +815,8 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
| 815 | 815 | ||
| 816 | mutex_init(&rt2x00dev->csr_mutex); | 816 | mutex_init(&rt2x00dev->csr_mutex); |
| 817 | 817 | ||
| 818 | set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | ||
| 819 | |||
| 818 | /* | 820 | /* |
| 819 | * Make room for rt2x00_intf inside the per-interface | 821 | * Make room for rt2x00_intf inside the per-interface |
| 820 | * structure ieee80211_vif. | 822 | * structure ieee80211_vif. |
| @@ -871,8 +873,6 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
| 871 | rt2x00leds_register(rt2x00dev); | 873 | rt2x00leds_register(rt2x00dev); |
| 872 | rt2x00debug_register(rt2x00dev); | 874 | rt2x00debug_register(rt2x00dev); |
| 873 | 875 | ||
| 874 | set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | ||
| 875 | |||
| 876 | return 0; | 876 | return 0; |
| 877 | 877 | ||
| 878 | exit: | 878 | exit: |
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c index c64db0ba7f40..c708d0be9155 100644 --- a/drivers/net/wireless/rt2x00/rt2x00link.c +++ b/drivers/net/wireless/rt2x00/rt2x00link.c | |||
| @@ -362,8 +362,9 @@ void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev) | |||
| 362 | 362 | ||
| 363 | rt2x00link_reset_tuner(rt2x00dev, false); | 363 | rt2x00link_reset_tuner(rt2x00dev, false); |
| 364 | 364 | ||
| 365 | ieee80211_queue_delayed_work(rt2x00dev->hw, | 365 | if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) |
| 366 | &link->work, LINK_TUNE_INTERVAL); | 366 | ieee80211_queue_delayed_work(rt2x00dev->hw, |
| 367 | &link->work, LINK_TUNE_INTERVAL); | ||
| 367 | } | 368 | } |
| 368 | 369 | ||
| 369 | void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev) | 370 | void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev) |
| @@ -469,8 +470,10 @@ static void rt2x00link_tuner(struct work_struct *work) | |||
| 469 | * Increase tuner counter, and reschedule the next link tuner run. | 470 | * Increase tuner counter, and reschedule the next link tuner run. |
| 470 | */ | 471 | */ |
| 471 | link->count++; | 472 | link->count++; |
| 472 | ieee80211_queue_delayed_work(rt2x00dev->hw, | 473 | |
| 473 | &link->work, LINK_TUNE_INTERVAL); | 474 | if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) |
| 475 | ieee80211_queue_delayed_work(rt2x00dev->hw, | ||
| 476 | &link->work, LINK_TUNE_INTERVAL); | ||
| 474 | } | 477 | } |
| 475 | 478 | ||
| 476 | void rt2x00link_register(struct rt2x00_dev *rt2x00dev) | 479 | void rt2x00link_register(struct rt2x00_dev *rt2x00dev) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 501544882c2c..f02b48a90593 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
| @@ -47,6 +47,8 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev, | |||
| 47 | (requesttype == USB_VENDOR_REQUEST_IN) ? | 47 | (requesttype == USB_VENDOR_REQUEST_IN) ? |
| 48 | usb_rcvctrlpipe(usb_dev, 0) : usb_sndctrlpipe(usb_dev, 0); | 48 | usb_rcvctrlpipe(usb_dev, 0) : usb_sndctrlpipe(usb_dev, 0); |
| 49 | 49 | ||
| 50 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | ||
| 51 | return -ENODEV; | ||
| 50 | 52 | ||
| 51 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | 53 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { |
| 52 | status = usb_control_msg(usb_dev, pipe, request, requesttype, | 54 | status = usb_control_msg(usb_dev, pipe, request, requesttype, |
| @@ -60,8 +62,10 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev, | |||
| 60 | * -ENODEV: Device has disappeared, no point continuing. | 62 | * -ENODEV: Device has disappeared, no point continuing. |
| 61 | * All other errors: Try again. | 63 | * All other errors: Try again. |
| 62 | */ | 64 | */ |
| 63 | else if (status == -ENODEV) | 65 | else if (status == -ENODEV) { |
| 66 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | ||
| 64 | break; | 67 | break; |
| 68 | } | ||
| 65 | } | 69 | } |
| 66 | 70 | ||
| 67 | ERROR(rt2x00dev, | 71 | ERROR(rt2x00dev, |
| @@ -161,6 +165,9 @@ int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev, | |||
| 161 | { | 165 | { |
| 162 | unsigned int i; | 166 | unsigned int i; |
| 163 | 167 | ||
| 168 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | ||
| 169 | return -ENODEV; | ||
| 170 | |||
| 164 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | 171 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { |
| 165 | rt2x00usb_register_read_lock(rt2x00dev, offset, reg); | 172 | rt2x00usb_register_read_lock(rt2x00dev, offset, reg); |
| 166 | if (!rt2x00_get_field32(*reg, field)) | 173 | if (!rt2x00_get_field32(*reg, field)) |
diff --git a/drivers/net/wireless/rtl818x/rtl8187_leds.c b/drivers/net/wireless/rtl818x/rtl8187_leds.c index a1c670fc1552..cf8a4a40fdf6 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_leds.c +++ b/drivers/net/wireless/rtl818x/rtl8187_leds.c | |||
| @@ -210,10 +210,10 @@ void rtl8187_leds_exit(struct ieee80211_hw *dev) | |||
| 210 | 210 | ||
| 211 | /* turn the LED off before exiting */ | 211 | /* turn the LED off before exiting */ |
| 212 | ieee80211_queue_delayed_work(dev, &priv->led_off, 0); | 212 | ieee80211_queue_delayed_work(dev, &priv->led_off, 0); |
| 213 | cancel_delayed_work_sync(&priv->led_off); | ||
| 214 | cancel_delayed_work_sync(&priv->led_on); | ||
| 215 | rtl8187_unregister_led(&priv->led_rx); | 213 | rtl8187_unregister_led(&priv->led_rx); |
| 216 | rtl8187_unregister_led(&priv->led_tx); | 214 | rtl8187_unregister_led(&priv->led_tx); |
| 215 | cancel_delayed_work_sync(&priv->led_off); | ||
| 216 | cancel_delayed_work_sync(&priv->led_on); | ||
| 217 | } | 217 | } |
| 218 | #endif /* def CONFIG_RTL8187_LED */ | 218 | #endif /* def CONFIG_RTL8187_LED */ |
| 219 | 219 | ||
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rfkill.c b/drivers/net/wireless/rtl818x/rtl8187_rfkill.c index 9fab13e4004e..cad8037ab2af 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_rfkill.c +++ b/drivers/net/wireless/rtl818x/rtl8187_rfkill.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <net/mac80211.h> | 18 | #include <net/mac80211.h> |
| 19 | 19 | ||
| 20 | #include "rtl8187.h" | 20 | #include "rtl8187.h" |
| 21 | #include "rtl8187_rfkill.h" | ||
| 21 | 22 | ||
| 22 | static bool rtl8187_is_radio_enabled(struct rtl8187_priv *priv) | 23 | static bool rtl8187_is_radio_enabled(struct rtl8187_priv *priv) |
| 23 | { | 24 | { |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 431a20ec6db6..33918fd5b231 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
| @@ -3656,10 +3656,7 @@ wv_pcmcia_reset(struct net_device * dev) | |||
| 3656 | 3656 | ||
| 3657 | i = pcmcia_access_configuration_register(link, ®); | 3657 | i = pcmcia_access_configuration_register(link, ®); |
| 3658 | if (i != 0) | 3658 | if (i != 0) |
| 3659 | { | ||
| 3660 | cs_error(link, AccessConfigurationRegister, i); | ||
| 3661 | return FALSE; | 3659 | return FALSE; |
| 3662 | } | ||
| 3663 | 3660 | ||
| 3664 | #ifdef DEBUG_CONFIG_INFO | 3661 | #ifdef DEBUG_CONFIG_INFO |
| 3665 | printk(KERN_DEBUG "%s: wavelan_pcmcia_reset(): Config reg is 0x%x\n", | 3662 | printk(KERN_DEBUG "%s: wavelan_pcmcia_reset(): Config reg is 0x%x\n", |
| @@ -3670,19 +3667,13 @@ wv_pcmcia_reset(struct net_device * dev) | |||
| 3670 | reg.Value = reg.Value | COR_SW_RESET; | 3667 | reg.Value = reg.Value | COR_SW_RESET; |
| 3671 | i = pcmcia_access_configuration_register(link, ®); | 3668 | i = pcmcia_access_configuration_register(link, ®); |
| 3672 | if (i != 0) | 3669 | if (i != 0) |
| 3673 | { | ||
| 3674 | cs_error(link, AccessConfigurationRegister, i); | ||
| 3675 | return FALSE; | 3670 | return FALSE; |
| 3676 | } | ||
| 3677 | 3671 | ||
| 3678 | reg.Action = CS_WRITE; | 3672 | reg.Action = CS_WRITE; |
| 3679 | reg.Value = COR_LEVEL_IRQ | COR_CONFIG; | 3673 | reg.Value = COR_LEVEL_IRQ | COR_CONFIG; |
| 3680 | i = pcmcia_access_configuration_register(link, ®); | 3674 | i = pcmcia_access_configuration_register(link, ®); |
| 3681 | if (i != 0) | 3675 | if (i != 0) |
| 3682 | { | ||
| 3683 | cs_error(link, AccessConfigurationRegister, i); | ||
| 3684 | return FALSE; | 3676 | return FALSE; |
| 3685 | } | ||
| 3686 | 3677 | ||
| 3687 | #ifdef DEBUG_CONFIG_TRACE | 3678 | #ifdef DEBUG_CONFIG_TRACE |
| 3688 | printk(KERN_DEBUG "%s: <-wv_pcmcia_reset()\n", dev->name); | 3679 | printk(KERN_DEBUG "%s: <-wv_pcmcia_reset()\n", dev->name); |
| @@ -3857,10 +3848,7 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
| 3857 | { | 3848 | { |
| 3858 | i = pcmcia_request_io(link, &link->io); | 3849 | i = pcmcia_request_io(link, &link->io); |
| 3859 | if (i != 0) | 3850 | if (i != 0) |
| 3860 | { | ||
| 3861 | cs_error(link, RequestIO, i); | ||
| 3862 | break; | 3851 | break; |
| 3863 | } | ||
| 3864 | 3852 | ||
| 3865 | /* | 3853 | /* |
| 3866 | * Now allocate an interrupt line. Note that this does not | 3854 | * Now allocate an interrupt line. Note that this does not |
| @@ -3868,10 +3856,7 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
| 3868 | */ | 3856 | */ |
| 3869 | i = pcmcia_request_irq(link, &link->irq); | 3857 | i = pcmcia_request_irq(link, &link->irq); |
| 3870 | if (i != 0) | 3858 | if (i != 0) |
| 3871 | { | ||
| 3872 | cs_error(link, RequestIRQ, i); | ||
| 3873 | break; | 3859 | break; |
| 3874 | } | ||
| 3875 | 3860 | ||
| 3876 | /* | 3861 | /* |
| 3877 | * This actually configures the PCMCIA socket -- setting up | 3862 | * This actually configures the PCMCIA socket -- setting up |
| @@ -3880,10 +3865,7 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
| 3880 | link->conf.ConfigIndex = 1; | 3865 | link->conf.ConfigIndex = 1; |
| 3881 | i = pcmcia_request_configuration(link, &link->conf); | 3866 | i = pcmcia_request_configuration(link, &link->conf); |
| 3882 | if (i != 0) | 3867 | if (i != 0) |
| 3883 | { | ||
| 3884 | cs_error(link, RequestConfiguration, i); | ||
| 3885 | break; | 3868 | break; |
| 3886 | } | ||
| 3887 | 3869 | ||
| 3888 | /* | 3870 | /* |
| 3889 | * Allocate a small memory window. Note that the struct pcmcia_device | 3871 | * Allocate a small memory window. Note that the struct pcmcia_device |
| @@ -3894,24 +3876,18 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
| 3894 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 3876 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
| 3895 | req.Base = req.Size = 0; | 3877 | req.Base = req.Size = 0; |
| 3896 | req.AccessSpeed = mem_speed; | 3878 | req.AccessSpeed = mem_speed; |
| 3897 | i = pcmcia_request_window(&link, &req, &link->win); | 3879 | i = pcmcia_request_window(link, &req, &link->win); |
| 3898 | if (i != 0) | 3880 | if (i != 0) |
| 3899 | { | ||
| 3900 | cs_error(link, RequestWindow, i); | ||
| 3901 | break; | 3881 | break; |
| 3902 | } | ||
| 3903 | 3882 | ||
| 3904 | lp->mem = ioremap(req.Base, req.Size); | 3883 | lp->mem = ioremap(req.Base, req.Size); |
| 3905 | dev->mem_start = (u_long)lp->mem; | 3884 | dev->mem_start = (u_long)lp->mem; |
| 3906 | dev->mem_end = dev->mem_start + req.Size; | 3885 | dev->mem_end = dev->mem_start + req.Size; |
| 3907 | 3886 | ||
| 3908 | mem.CardOffset = 0; mem.Page = 0; | 3887 | mem.CardOffset = 0; mem.Page = 0; |
| 3909 | i = pcmcia_map_mem_page(link->win, &mem); | 3888 | i = pcmcia_map_mem_page(link, link->win, &mem); |
| 3910 | if (i != 0) | 3889 | if (i != 0) |
| 3911 | { | ||
| 3912 | cs_error(link, MapMemPage, i); | ||
| 3913 | break; | 3890 | break; |
| 3914 | } | ||
| 3915 | 3891 | ||
| 3916 | /* Feed device with this info... */ | 3892 | /* Feed device with this info... */ |
| 3917 | dev->irq = link->irq.AssignedIRQ; | 3893 | dev->irq = link->irq.AssignedIRQ; |
| @@ -3923,7 +3899,7 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
| 3923 | lp->mem, dev->irq, (u_int) dev->base_addr); | 3899 | lp->mem, dev->irq, (u_int) dev->base_addr); |
| 3924 | #endif | 3900 | #endif |
| 3925 | 3901 | ||
| 3926 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 3902 | SET_NETDEV_DEV(dev, &link->dev); |
| 3927 | i = register_netdev(dev); | 3903 | i = register_netdev(dev); |
| 3928 | if(i != 0) | 3904 | if(i != 0) |
| 3929 | { | 3905 | { |
| @@ -4462,8 +4438,7 @@ wavelan_probe(struct pcmcia_device *p_dev) | |||
| 4462 | p_dev->io.IOAddrLines = 3; | 4438 | p_dev->io.IOAddrLines = 3; |
| 4463 | 4439 | ||
| 4464 | /* Interrupt setup */ | 4440 | /* Interrupt setup */ |
| 4465 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 4441 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 4466 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 4467 | p_dev->irq.Handler = wavelan_interrupt; | 4442 | p_dev->irq.Handler = wavelan_interrupt; |
| 4468 | 4443 | ||
| 4469 | /* General socket configuration */ | 4444 | /* General socket configuration */ |
| @@ -4475,7 +4450,7 @@ wavelan_probe(struct pcmcia_device *p_dev) | |||
| 4475 | if (!dev) | 4450 | if (!dev) |
| 4476 | return -ENOMEM; | 4451 | return -ENOMEM; |
| 4477 | 4452 | ||
| 4478 | p_dev->priv = p_dev->irq.Instance = dev; | 4453 | p_dev->priv = dev; |
| 4479 | 4454 | ||
| 4480 | lp = netdev_priv(dev); | 4455 | lp = netdev_priv(dev); |
| 4481 | 4456 | ||
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 4f1e0cfe609b..5f0401a52cff 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
| @@ -67,23 +67,7 @@ | |||
| 67 | /* For rough constant delay */ | 67 | /* For rough constant delay */ |
| 68 | #define WL3501_NOPLOOP(n) { int x = 0; while (x++ < n) slow_down_io(); } | 68 | #define WL3501_NOPLOOP(n) { int x = 0; while (x++ < n) slow_down_io(); } |
| 69 | 69 | ||
| 70 | /* | 70 | |
| 71 | * All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If you do not | ||
| 72 | * define PCMCIA_DEBUG at all, all the debug code will be left out. If you | ||
| 73 | * compile with PCMCIA_DEBUG=0, the debug code will be present but disabled -- | ||
| 74 | * but it can then be enabled for specific modules at load time with a | ||
| 75 | * 'pc_debug=#' option to insmod. | ||
| 76 | */ | ||
| 77 | #define PCMCIA_DEBUG 0 | ||
| 78 | #ifdef PCMCIA_DEBUG | ||
| 79 | static int pc_debug = PCMCIA_DEBUG; | ||
| 80 | module_param(pc_debug, int, 0); | ||
| 81 | #define dprintk(n, format, args...) \ | ||
| 82 | { if (pc_debug > (n)) \ | ||
| 83 | printk(KERN_INFO "%s: " format "\n", __func__ , ##args); } | ||
| 84 | #else | ||
| 85 | #define dprintk(n, format, args...) | ||
| 86 | #endif | ||
| 87 | 71 | ||
| 88 | #define wl3501_outb(a, b) { outb(a, b); slow_down_io(); } | 72 | #define wl3501_outb(a, b) { outb(a, b); slow_down_io(); } |
| 89 | #define wl3501_outb_p(a, b) { outb_p(a, b); slow_down_io(); } | 73 | #define wl3501_outb_p(a, b) { outb_p(a, b); slow_down_io(); } |
| @@ -684,10 +668,10 @@ static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr) | |||
| 684 | int matchflag = 0; | 668 | int matchflag = 0; |
| 685 | struct wl3501_scan_confirm sig; | 669 | struct wl3501_scan_confirm sig; |
| 686 | 670 | ||
| 687 | dprintk(3, "entry"); | 671 | pr_debug("entry"); |
| 688 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 672 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 689 | if (sig.status == WL3501_STATUS_SUCCESS) { | 673 | if (sig.status == WL3501_STATUS_SUCCESS) { |
| 690 | dprintk(3, "success"); | 674 | pr_debug("success"); |
| 691 | if ((this->net_type == IW_MODE_INFRA && | 675 | if ((this->net_type == IW_MODE_INFRA && |
| 692 | (sig.cap_info & WL3501_MGMT_CAPABILITY_ESS)) || | 676 | (sig.cap_info & WL3501_MGMT_CAPABILITY_ESS)) || |
| 693 | (this->net_type == IW_MODE_ADHOC && | 677 | (this->net_type == IW_MODE_ADHOC && |
| @@ -722,7 +706,7 @@ static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr) | |||
| 722 | } | 706 | } |
| 723 | } | 707 | } |
| 724 | } else if (sig.status == WL3501_STATUS_TIMEOUT) { | 708 | } else if (sig.status == WL3501_STATUS_TIMEOUT) { |
| 725 | dprintk(3, "timeout"); | 709 | pr_debug("timeout"); |
| 726 | this->join_sta_bss = 0; | 710 | this->join_sta_bss = 0; |
| 727 | for (i = this->join_sta_bss; i < this->bss_cnt; i++) | 711 | for (i = this->join_sta_bss; i < this->bss_cnt; i++) |
| 728 | if (!wl3501_mgmt_join(this, i)) | 712 | if (!wl3501_mgmt_join(this, i)) |
| @@ -879,7 +863,7 @@ static int wl3501_mgmt_auth(struct wl3501_card *this) | |||
| 879 | .timeout = 1000, | 863 | .timeout = 1000, |
| 880 | }; | 864 | }; |
| 881 | 865 | ||
| 882 | dprintk(3, "entry"); | 866 | pr_debug("entry"); |
| 883 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); | 867 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); |
| 884 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); | 868 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); |
| 885 | } | 869 | } |
| @@ -893,7 +877,7 @@ static int wl3501_mgmt_association(struct wl3501_card *this) | |||
| 893 | .cap_info = this->cap_info, | 877 | .cap_info = this->cap_info, |
| 894 | }; | 878 | }; |
| 895 | 879 | ||
| 896 | dprintk(3, "entry"); | 880 | pr_debug("entry"); |
| 897 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); | 881 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); |
| 898 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); | 882 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); |
| 899 | } | 883 | } |
| @@ -903,7 +887,7 @@ static void wl3501_mgmt_join_confirm(struct net_device *dev, u16 addr) | |||
| 903 | struct wl3501_card *this = netdev_priv(dev); | 887 | struct wl3501_card *this = netdev_priv(dev); |
| 904 | struct wl3501_join_confirm sig; | 888 | struct wl3501_join_confirm sig; |
| 905 | 889 | ||
| 906 | dprintk(3, "entry"); | 890 | pr_debug("entry"); |
| 907 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 891 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 908 | if (sig.status == WL3501_STATUS_SUCCESS) { | 892 | if (sig.status == WL3501_STATUS_SUCCESS) { |
| 909 | if (this->net_type == IW_MODE_INFRA) { | 893 | if (this->net_type == IW_MODE_INFRA) { |
| @@ -962,7 +946,7 @@ static inline void wl3501_md_confirm_interrupt(struct net_device *dev, | |||
| 962 | { | 946 | { |
| 963 | struct wl3501_md_confirm sig; | 947 | struct wl3501_md_confirm sig; |
| 964 | 948 | ||
| 965 | dprintk(3, "entry"); | 949 | pr_debug("entry"); |
| 966 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 950 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 967 | wl3501_free_tx_buffer(this, sig.data); | 951 | wl3501_free_tx_buffer(this, sig.data); |
| 968 | if (netif_queue_stopped(dev)) | 952 | if (netif_queue_stopped(dev)) |
| @@ -1017,7 +1001,7 @@ static inline void wl3501_md_ind_interrupt(struct net_device *dev, | |||
| 1017 | static inline void wl3501_get_confirm_interrupt(struct wl3501_card *this, | 1001 | static inline void wl3501_get_confirm_interrupt(struct wl3501_card *this, |
| 1018 | u16 addr, void *sig, int size) | 1002 | u16 addr, void *sig, int size) |
| 1019 | { | 1003 | { |
| 1020 | dprintk(3, "entry"); | 1004 | pr_debug("entry"); |
| 1021 | wl3501_get_from_wla(this, addr, &this->sig_get_confirm, | 1005 | wl3501_get_from_wla(this, addr, &this->sig_get_confirm, |
| 1022 | sizeof(this->sig_get_confirm)); | 1006 | sizeof(this->sig_get_confirm)); |
| 1023 | wake_up(&this->wait); | 1007 | wake_up(&this->wait); |
| @@ -1029,7 +1013,7 @@ static inline void wl3501_start_confirm_interrupt(struct net_device *dev, | |||
| 1029 | { | 1013 | { |
| 1030 | struct wl3501_start_confirm sig; | 1014 | struct wl3501_start_confirm sig; |
| 1031 | 1015 | ||
| 1032 | dprintk(3, "entry"); | 1016 | pr_debug("entry"); |
| 1033 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 1017 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 1034 | if (sig.status == WL3501_STATUS_SUCCESS) | 1018 | if (sig.status == WL3501_STATUS_SUCCESS) |
| 1035 | netif_wake_queue(dev); | 1019 | netif_wake_queue(dev); |
| @@ -1041,7 +1025,7 @@ static inline void wl3501_assoc_confirm_interrupt(struct net_device *dev, | |||
| 1041 | struct wl3501_card *this = netdev_priv(dev); | 1025 | struct wl3501_card *this = netdev_priv(dev); |
| 1042 | struct wl3501_assoc_confirm sig; | 1026 | struct wl3501_assoc_confirm sig; |
| 1043 | 1027 | ||
| 1044 | dprintk(3, "entry"); | 1028 | pr_debug("entry"); |
| 1045 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 1029 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 1046 | 1030 | ||
| 1047 | if (sig.status == WL3501_STATUS_SUCCESS) | 1031 | if (sig.status == WL3501_STATUS_SUCCESS) |
| @@ -1053,7 +1037,7 @@ static inline void wl3501_auth_confirm_interrupt(struct wl3501_card *this, | |||
| 1053 | { | 1037 | { |
| 1054 | struct wl3501_auth_confirm sig; | 1038 | struct wl3501_auth_confirm sig; |
| 1055 | 1039 | ||
| 1056 | dprintk(3, "entry"); | 1040 | pr_debug("entry"); |
| 1057 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 1041 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
| 1058 | 1042 | ||
| 1059 | if (sig.status == WL3501_STATUS_SUCCESS) | 1043 | if (sig.status == WL3501_STATUS_SUCCESS) |
| @@ -1069,7 +1053,7 @@ static inline void wl3501_rx_interrupt(struct net_device *dev) | |||
| 1069 | u8 sig_id; | 1053 | u8 sig_id; |
| 1070 | struct wl3501_card *this = netdev_priv(dev); | 1054 | struct wl3501_card *this = netdev_priv(dev); |
| 1071 | 1055 | ||
| 1072 | dprintk(3, "entry"); | 1056 | pr_debug("entry"); |
| 1073 | loop: | 1057 | loop: |
| 1074 | morepkts = 0; | 1058 | morepkts = 0; |
| 1075 | if (!wl3501_esbq_confirm(this)) | 1059 | if (!wl3501_esbq_confirm(this)) |
| @@ -1302,7 +1286,7 @@ static int wl3501_reset(struct net_device *dev) | |||
| 1302 | wl3501_ack_interrupt(this); | 1286 | wl3501_ack_interrupt(this); |
| 1303 | wl3501_unblock_interrupt(this); | 1287 | wl3501_unblock_interrupt(this); |
| 1304 | wl3501_mgmt_scan(this, 100); | 1288 | wl3501_mgmt_scan(this, 100); |
| 1305 | dprintk(1, "%s: device reset", dev->name); | 1289 | pr_debug("%s: device reset", dev->name); |
| 1306 | rc = 0; | 1290 | rc = 0; |
| 1307 | out: | 1291 | out: |
| 1308 | return rc; | 1292 | return rc; |
| @@ -1376,7 +1360,7 @@ static int wl3501_open(struct net_device *dev) | |||
| 1376 | link->open++; | 1360 | link->open++; |
| 1377 | 1361 | ||
| 1378 | /* Initial WL3501 firmware */ | 1362 | /* Initial WL3501 firmware */ |
| 1379 | dprintk(1, "%s: Initialize WL3501 firmware...", dev->name); | 1363 | pr_debug("%s: Initialize WL3501 firmware...", dev->name); |
| 1380 | if (wl3501_init_firmware(this)) | 1364 | if (wl3501_init_firmware(this)) |
| 1381 | goto fail; | 1365 | goto fail; |
| 1382 | /* Initial device variables */ | 1366 | /* Initial device variables */ |
| @@ -1388,7 +1372,7 @@ static int wl3501_open(struct net_device *dev) | |||
| 1388 | wl3501_unblock_interrupt(this); | 1372 | wl3501_unblock_interrupt(this); |
| 1389 | wl3501_mgmt_scan(this, 100); | 1373 | wl3501_mgmt_scan(this, 100); |
| 1390 | rc = 0; | 1374 | rc = 0; |
| 1391 | dprintk(1, "%s: WL3501 opened", dev->name); | 1375 | pr_debug("%s: WL3501 opened", dev->name); |
| 1392 | printk(KERN_INFO "%s: Card Name: %s\n" | 1376 | printk(KERN_INFO "%s: Card Name: %s\n" |
| 1393 | "%s: Firmware Date: %s\n", | 1377 | "%s: Firmware Date: %s\n", |
| 1394 | dev->name, this->card_name, | 1378 | dev->name, this->card_name, |
| @@ -1914,8 +1898,7 @@ static int wl3501_probe(struct pcmcia_device *p_dev) | |||
| 1914 | p_dev->io.IOAddrLines = 5; | 1898 | p_dev->io.IOAddrLines = 5; |
| 1915 | 1899 | ||
| 1916 | /* Interrupt setup */ | 1900 | /* Interrupt setup */ |
| 1917 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 1901 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 1918 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 1919 | p_dev->irq.Handler = wl3501_interrupt; | 1902 | p_dev->irq.Handler = wl3501_interrupt; |
| 1920 | 1903 | ||
| 1921 | /* General socket configuration */ | 1904 | /* General socket configuration */ |
| @@ -1938,16 +1921,13 @@ static int wl3501_probe(struct pcmcia_device *p_dev) | |||
| 1938 | dev->wireless_handlers = &wl3501_handler_def; | 1921 | dev->wireless_handlers = &wl3501_handler_def; |
| 1939 | SET_ETHTOOL_OPS(dev, &ops); | 1922 | SET_ETHTOOL_OPS(dev, &ops); |
| 1940 | netif_stop_queue(dev); | 1923 | netif_stop_queue(dev); |
| 1941 | p_dev->priv = p_dev->irq.Instance = dev; | 1924 | p_dev->priv = dev; |
| 1942 | 1925 | ||
| 1943 | return wl3501_config(p_dev); | 1926 | return wl3501_config(p_dev); |
| 1944 | out_link: | 1927 | out_link: |
| 1945 | return -ENOMEM; | 1928 | return -ENOMEM; |
| 1946 | } | 1929 | } |
| 1947 | 1930 | ||
| 1948 | #define CS_CHECK(fn, ret) \ | ||
| 1949 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 1950 | |||
| 1951 | /** | 1931 | /** |
| 1952 | * wl3501_config - configure the PCMCIA socket and make eth device available | 1932 | * wl3501_config - configure the PCMCIA socket and make eth device available |
| 1953 | * @link - FILL_IN | 1933 | * @link - FILL_IN |
| @@ -1959,7 +1939,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
| 1959 | static int wl3501_config(struct pcmcia_device *link) | 1939 | static int wl3501_config(struct pcmcia_device *link) |
| 1960 | { | 1940 | { |
| 1961 | struct net_device *dev = link->priv; | 1941 | struct net_device *dev = link->priv; |
| 1962 | int i = 0, j, last_fn, last_ret; | 1942 | int i = 0, j, ret; |
| 1963 | struct wl3501_card *this; | 1943 | struct wl3501_card *this; |
| 1964 | 1944 | ||
| 1965 | /* Try allocating IO ports. This tries a few fixed addresses. If you | 1945 | /* Try allocating IO ports. This tries a few fixed addresses. If you |
| @@ -1975,24 +1955,26 @@ static int wl3501_config(struct pcmcia_device *link) | |||
| 1975 | if (i == 0) | 1955 | if (i == 0) |
| 1976 | break; | 1956 | break; |
| 1977 | } | 1957 | } |
| 1978 | if (i != 0) { | 1958 | if (i != 0) |
| 1979 | cs_error(link, RequestIO, i); | ||
| 1980 | goto failed; | 1959 | goto failed; |
| 1981 | } | ||
| 1982 | 1960 | ||
| 1983 | /* Now allocate an interrupt line. Note that this does not actually | 1961 | /* Now allocate an interrupt line. Note that this does not actually |
| 1984 | * assign a handler to the interrupt. */ | 1962 | * assign a handler to the interrupt. */ |
| 1985 | 1963 | ||
| 1986 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 1964 | ret = pcmcia_request_irq(link, &link->irq); |
| 1965 | if (ret) | ||
| 1966 | goto failed; | ||
| 1987 | 1967 | ||
| 1988 | /* This actually configures the PCMCIA socket -- setting up the I/O | 1968 | /* This actually configures the PCMCIA socket -- setting up the I/O |
| 1989 | * windows and the interrupt mapping. */ | 1969 | * windows and the interrupt mapping. */ |
| 1990 | 1970 | ||
| 1991 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 1971 | ret = pcmcia_request_configuration(link, &link->conf); |
| 1972 | if (ret) | ||
| 1973 | goto failed; | ||
| 1992 | 1974 | ||
| 1993 | dev->irq = link->irq.AssignedIRQ; | 1975 | dev->irq = link->irq.AssignedIRQ; |
| 1994 | dev->base_addr = link->io.BasePort1; | 1976 | dev->base_addr = link->io.BasePort1; |
| 1995 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 1977 | SET_NETDEV_DEV(dev, &link->dev); |
| 1996 | if (register_netdev(dev)) { | 1978 | if (register_netdev(dev)) { |
| 1997 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); | 1979 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); |
| 1998 | goto failed; | 1980 | goto failed; |
| @@ -2041,8 +2023,6 @@ static int wl3501_config(struct pcmcia_device *link) | |||
| 2041 | netif_start_queue(dev); | 2023 | netif_start_queue(dev); |
| 2042 | return 0; | 2024 | return 0; |
| 2043 | 2025 | ||
| 2044 | cs_failed: | ||
| 2045 | cs_error(link, last_fn, last_ret); | ||
| 2046 | failed: | 2026 | failed: |
| 2047 | wl3501_release(link); | 2027 | wl3501_release(link); |
| 2048 | return -ENODEV; | 2028 | return -ENODEV; |
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 8fdfa4f537a6..7dd370fa3439 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c | |||
| @@ -67,14 +67,6 @@ MODULE_LICENSE("Dual MPL/GPL"); | |||
| 67 | 67 | ||
| 68 | INT_MODULE_PARM(epp_mode, 1); | 68 | INT_MODULE_PARM(epp_mode, 1); |
| 69 | 69 | ||
| 70 | #ifdef PCMCIA_DEBUG | ||
| 71 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
| 72 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 73 | static char *version = | ||
| 74 | "parport_cs.c 1.29 2002/10/11 06:57:41 (David Hinds)"; | ||
| 75 | #else | ||
| 76 | #define DEBUG(n, args...) | ||
| 77 | #endif | ||
| 78 | 70 | ||
| 79 | /*====================================================================*/ | 71 | /*====================================================================*/ |
| 80 | 72 | ||
| @@ -103,7 +95,7 @@ static int parport_probe(struct pcmcia_device *link) | |||
| 103 | { | 95 | { |
| 104 | parport_info_t *info; | 96 | parport_info_t *info; |
| 105 | 97 | ||
| 106 | DEBUG(0, "parport_attach()\n"); | 98 | dev_dbg(&link->dev, "parport_attach()\n"); |
| 107 | 99 | ||
| 108 | /* Create new parport device */ | 100 | /* Create new parport device */ |
| 109 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 101 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
| @@ -114,7 +106,6 @@ static int parport_probe(struct pcmcia_device *link) | |||
| 114 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 106 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 115 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 107 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
| 116 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 108 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 117 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 118 | link->conf.Attributes = CONF_ENABLE_IRQ; | 109 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 119 | link->conf.IntType = INT_MEMORY_AND_IO; | 110 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 120 | 111 | ||
| @@ -132,7 +123,7 @@ static int parport_probe(struct pcmcia_device *link) | |||
| 132 | 123 | ||
| 133 | static void parport_detach(struct pcmcia_device *link) | 124 | static void parport_detach(struct pcmcia_device *link) |
| 134 | { | 125 | { |
| 135 | DEBUG(0, "parport_detach(0x%p)\n", link); | 126 | dev_dbg(&link->dev, "parport_detach\n"); |
| 136 | 127 | ||
| 137 | parport_cs_release(link); | 128 | parport_cs_release(link); |
| 138 | 129 | ||
| @@ -147,9 +138,6 @@ static void parport_detach(struct pcmcia_device *link) | |||
| 147 | 138 | ||
| 148 | ======================================================================*/ | 139 | ======================================================================*/ |
| 149 | 140 | ||
| 150 | #define CS_CHECK(fn, ret) \ | ||
| 151 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 152 | |||
| 153 | static int parport_config_check(struct pcmcia_device *p_dev, | 141 | static int parport_config_check(struct pcmcia_device *p_dev, |
| 154 | cistpl_cftable_entry_t *cfg, | 142 | cistpl_cftable_entry_t *cfg, |
| 155 | cistpl_cftable_entry_t *dflt, | 143 | cistpl_cftable_entry_t *dflt, |
| @@ -178,18 +166,20 @@ static int parport_config(struct pcmcia_device *link) | |||
| 178 | { | 166 | { |
| 179 | parport_info_t *info = link->priv; | 167 | parport_info_t *info = link->priv; |
| 180 | struct parport *p; | 168 | struct parport *p; |
| 181 | int last_ret, last_fn; | 169 | int ret; |
| 182 | 170 | ||
| 183 | DEBUG(0, "parport_config(0x%p)\n", link); | 171 | dev_dbg(&link->dev, "parport_config\n"); |
| 184 | 172 | ||
| 185 | last_ret = pcmcia_loop_config(link, parport_config_check, NULL); | 173 | ret = pcmcia_loop_config(link, parport_config_check, NULL); |
| 186 | if (last_ret) { | 174 | if (ret) |
| 187 | cs_error(link, RequestIO, last_ret); | ||
| 188 | goto failed; | 175 | goto failed; |
| 189 | } | ||
| 190 | 176 | ||
| 191 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 177 | ret = pcmcia_request_irq(link, &link->irq); |
| 192 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 178 | if (ret) |
| 179 | goto failed; | ||
| 180 | ret = pcmcia_request_configuration(link, &link->conf); | ||
| 181 | if (ret) | ||
| 182 | goto failed; | ||
| 193 | 183 | ||
| 194 | p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, | 184 | p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, |
| 195 | link->irq.AssignedIRQ, PARPORT_DMA_NONE, | 185 | link->irq.AssignedIRQ, PARPORT_DMA_NONE, |
| @@ -213,8 +203,6 @@ static int parport_config(struct pcmcia_device *link) | |||
| 213 | 203 | ||
| 214 | return 0; | 204 | return 0; |
| 215 | 205 | ||
| 216 | cs_failed: | ||
| 217 | cs_error(link, last_fn, last_ret); | ||
| 218 | failed: | 206 | failed: |
| 219 | parport_cs_release(link); | 207 | parport_cs_release(link); |
| 220 | return -ENODEV; | 208 | return -ENODEV; |
| @@ -232,7 +220,7 @@ static void parport_cs_release(struct pcmcia_device *link) | |||
| 232 | { | 220 | { |
| 233 | parport_info_t *info = link->priv; | 221 | parport_info_t *info = link->priv; |
| 234 | 222 | ||
| 235 | DEBUG(0, "parport_release(0x%p)\n", link); | 223 | dev_dbg(&link->dev, "parport_release\n"); |
| 236 | 224 | ||
| 237 | if (info->ndev) { | 225 | if (info->ndev) { |
| 238 | struct parport *p = info->port; | 226 | struct parport *p = info->port; |
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c index 22b02c6df854..416f6ac65b76 100644 --- a/drivers/pci/dmar.c +++ b/drivers/pci/dmar.c | |||
| @@ -175,15 +175,6 @@ dmar_parse_one_drhd(struct acpi_dmar_header *header) | |||
| 175 | int ret = 0; | 175 | int ret = 0; |
| 176 | 176 | ||
| 177 | drhd = (struct acpi_dmar_hardware_unit *)header; | 177 | drhd = (struct acpi_dmar_hardware_unit *)header; |
| 178 | if (!drhd->address) { | ||
| 179 | /* Promote an attitude of violence to a BIOS engineer today */ | ||
| 180 | WARN(1, "Your BIOS is broken; DMAR reported at address zero!\n" | ||
| 181 | "BIOS vendor: %s; Ver: %s; Product Version: %s\n", | ||
| 182 | dmi_get_system_info(DMI_BIOS_VENDOR), | ||
| 183 | dmi_get_system_info(DMI_BIOS_VERSION), | ||
| 184 | dmi_get_system_info(DMI_PRODUCT_VERSION)); | ||
| 185 | return -ENODEV; | ||
| 186 | } | ||
| 187 | dmaru = kzalloc(sizeof(*dmaru), GFP_KERNEL); | 178 | dmaru = kzalloc(sizeof(*dmaru), GFP_KERNEL); |
| 188 | if (!dmaru) | 179 | if (!dmaru) |
| 189 | return -ENOMEM; | 180 | return -ENOMEM; |
| @@ -591,12 +582,53 @@ int __init dmar_table_init(void) | |||
| 591 | return 0; | 582 | return 0; |
| 592 | } | 583 | } |
| 593 | 584 | ||
| 585 | int __init check_zero_address(void) | ||
| 586 | { | ||
| 587 | struct acpi_table_dmar *dmar; | ||
| 588 | struct acpi_dmar_header *entry_header; | ||
| 589 | struct acpi_dmar_hardware_unit *drhd; | ||
| 590 | |||
| 591 | dmar = (struct acpi_table_dmar *)dmar_tbl; | ||
| 592 | entry_header = (struct acpi_dmar_header *)(dmar + 1); | ||
| 593 | |||
| 594 | while (((unsigned long)entry_header) < | ||
| 595 | (((unsigned long)dmar) + dmar_tbl->length)) { | ||
| 596 | /* Avoid looping forever on bad ACPI tables */ | ||
| 597 | if (entry_header->length == 0) { | ||
| 598 | printk(KERN_WARNING PREFIX | ||
| 599 | "Invalid 0-length structure\n"); | ||
| 600 | return 0; | ||
| 601 | } | ||
| 602 | |||
| 603 | if (entry_header->type == ACPI_DMAR_TYPE_HARDWARE_UNIT) { | ||
| 604 | drhd = (void *)entry_header; | ||
| 605 | if (!drhd->address) { | ||
| 606 | /* Promote an attitude of violence to a BIOS engineer today */ | ||
| 607 | WARN(1, "Your BIOS is broken; DMAR reported at address zero!\n" | ||
| 608 | "BIOS vendor: %s; Ver: %s; Product Version: %s\n", | ||
| 609 | dmi_get_system_info(DMI_BIOS_VENDOR), | ||
| 610 | dmi_get_system_info(DMI_BIOS_VERSION), | ||
| 611 | dmi_get_system_info(DMI_PRODUCT_VERSION)); | ||
| 612 | #ifdef CONFIG_DMAR | ||
| 613 | dmar_disabled = 1; | ||
| 614 | #endif | ||
| 615 | return 0; | ||
| 616 | } | ||
| 617 | break; | ||
| 618 | } | ||
| 619 | |||
| 620 | entry_header = ((void *)entry_header + entry_header->length); | ||
| 621 | } | ||
| 622 | return 1; | ||
| 623 | } | ||
| 624 | |||
| 594 | void __init detect_intel_iommu(void) | 625 | void __init detect_intel_iommu(void) |
| 595 | { | 626 | { |
| 596 | int ret; | 627 | int ret; |
| 597 | 628 | ||
| 598 | ret = dmar_table_detect(); | 629 | ret = dmar_table_detect(); |
| 599 | 630 | if (ret) | |
| 631 | ret = check_zero_address(); | ||
| 600 | { | 632 | { |
| 601 | #ifdef CONFIG_INTR_REMAP | 633 | #ifdef CONFIG_INTR_REMAP |
| 602 | struct acpi_table_dmar *dmar; | 634 | struct acpi_table_dmar *dmar; |
| @@ -613,10 +645,13 @@ void __init detect_intel_iommu(void) | |||
| 613 | "x2apic and Intr-remapping.\n"); | 645 | "x2apic and Intr-remapping.\n"); |
| 614 | #endif | 646 | #endif |
| 615 | #ifdef CONFIG_DMAR | 647 | #ifdef CONFIG_DMAR |
| 616 | if (ret && !no_iommu && !iommu_detected && !swiotlb && | 648 | if (ret && !no_iommu && !iommu_detected && !dmar_disabled) |
| 617 | !dmar_disabled) | ||
| 618 | iommu_detected = 1; | 649 | iommu_detected = 1; |
| 619 | #endif | 650 | #endif |
| 651 | #ifdef CONFIG_X86 | ||
| 652 | if (ret) | ||
| 653 | x86_init.iommu.iommu_init = intel_iommu_init; | ||
| 654 | #endif | ||
| 620 | } | 655 | } |
| 621 | early_acpi_os_unmap_memory(dmar_tbl, dmar_tbl_size); | 656 | early_acpi_os_unmap_memory(dmar_tbl, dmar_tbl_size); |
| 622 | dmar_tbl = NULL; | 657 | dmar_tbl = NULL; |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index b1e97e682500..9261327b49f3 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
| @@ -2767,7 +2767,15 @@ static void *intel_alloc_coherent(struct device *hwdev, size_t size, | |||
| 2767 | 2767 | ||
| 2768 | size = PAGE_ALIGN(size); | 2768 | size = PAGE_ALIGN(size); |
| 2769 | order = get_order(size); | 2769 | order = get_order(size); |
| 2770 | flags &= ~(GFP_DMA | GFP_DMA32); | 2770 | |
| 2771 | if (!iommu_no_mapping(hwdev)) | ||
| 2772 | flags &= ~(GFP_DMA | GFP_DMA32); | ||
| 2773 | else if (hwdev->coherent_dma_mask < dma_get_required_mask(hwdev)) { | ||
| 2774 | if (hwdev->coherent_dma_mask < DMA_BIT_MASK(32)) | ||
| 2775 | flags |= GFP_DMA; | ||
| 2776 | else | ||
| 2777 | flags |= GFP_DMA32; | ||
| 2778 | } | ||
| 2771 | 2779 | ||
| 2772 | vaddr = (void *)__get_free_pages(flags, order); | 2780 | vaddr = (void *)__get_free_pages(flags, order); |
| 2773 | if (!vaddr) | 2781 | if (!vaddr) |
| @@ -3207,6 +3215,33 @@ static int __init init_iommu_sysfs(void) | |||
| 3207 | } | 3215 | } |
| 3208 | #endif /* CONFIG_PM */ | 3216 | #endif /* CONFIG_PM */ |
| 3209 | 3217 | ||
| 3218 | /* | ||
| 3219 | * Here we only respond to action of unbound device from driver. | ||
| 3220 | * | ||
| 3221 | * Added device is not attached to its DMAR domain here yet. That will happen | ||
| 3222 | * when mapping the device to iova. | ||
| 3223 | */ | ||
| 3224 | static int device_notifier(struct notifier_block *nb, | ||
| 3225 | unsigned long action, void *data) | ||
| 3226 | { | ||
| 3227 | struct device *dev = data; | ||
| 3228 | struct pci_dev *pdev = to_pci_dev(dev); | ||
| 3229 | struct dmar_domain *domain; | ||
| 3230 | |||
| 3231 | domain = find_domain(pdev); | ||
| 3232 | if (!domain) | ||
| 3233 | return 0; | ||
| 3234 | |||
| 3235 | if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) | ||
| 3236 | domain_remove_one_dev_info(domain, pdev); | ||
| 3237 | |||
| 3238 | return 0; | ||
| 3239 | } | ||
| 3240 | |||
| 3241 | static struct notifier_block device_nb = { | ||
| 3242 | .notifier_call = device_notifier, | ||
| 3243 | }; | ||
| 3244 | |||
| 3210 | int __init intel_iommu_init(void) | 3245 | int __init intel_iommu_init(void) |
| 3211 | { | 3246 | { |
| 3212 | int ret = 0; | 3247 | int ret = 0; |
| @@ -3231,7 +3266,7 @@ int __init intel_iommu_init(void) | |||
| 3231 | * Check the need for DMA-remapping initialization now. | 3266 | * Check the need for DMA-remapping initialization now. |
| 3232 | * Above initialization will also be used by Interrupt-remapping. | 3267 | * Above initialization will also be used by Interrupt-remapping. |
| 3233 | */ | 3268 | */ |
| 3234 | if (no_iommu || swiotlb || dmar_disabled) | 3269 | if (no_iommu || dmar_disabled) |
| 3235 | return -ENODEV; | 3270 | return -ENODEV; |
| 3236 | 3271 | ||
| 3237 | iommu_init_mempool(); | 3272 | iommu_init_mempool(); |
| @@ -3252,13 +3287,17 @@ int __init intel_iommu_init(void) | |||
| 3252 | "PCI-DMA: Intel(R) Virtualization Technology for Directed I/O\n"); | 3287 | "PCI-DMA: Intel(R) Virtualization Technology for Directed I/O\n"); |
| 3253 | 3288 | ||
| 3254 | init_timer(&unmap_timer); | 3289 | init_timer(&unmap_timer); |
| 3255 | force_iommu = 1; | 3290 | #ifdef CONFIG_SWIOTLB |
| 3291 | swiotlb = 0; | ||
| 3292 | #endif | ||
| 3256 | dma_ops = &intel_dma_ops; | 3293 | dma_ops = &intel_dma_ops; |
| 3257 | 3294 | ||
| 3258 | init_iommu_sysfs(); | 3295 | init_iommu_sysfs(); |
| 3259 | 3296 | ||
| 3260 | register_iommu(&intel_iommu_ops); | 3297 | register_iommu(&intel_iommu_ops); |
| 3261 | 3298 | ||
| 3299 | bus_register_notifier(&pci_bus_type, &device_nb); | ||
| 3300 | |||
| 3262 | return 0; | 3301 | return 0; |
| 3263 | } | 3302 | } |
| 3264 | 3303 | ||
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 745402e8e498..5b7056cec00c 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c | |||
| @@ -656,8 +656,10 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev) | |||
| 656 | free_link_state(link); | 656 | free_link_state(link); |
| 657 | 657 | ||
| 658 | /* Recheck latencies and configure upstream links */ | 658 | /* Recheck latencies and configure upstream links */ |
| 659 | pcie_update_aspm_capable(root); | 659 | if (parent_link) { |
| 660 | pcie_config_aspm_path(parent_link); | 660 | pcie_update_aspm_capable(root); |
| 661 | pcie_config_aspm_path(parent_link); | ||
| 662 | } | ||
| 661 | out: | 663 | out: |
| 662 | mutex_unlock(&aspm_lock); | 664 | mutex_unlock(&aspm_lock); |
| 663 | up_read(&pci_bus_sem); | 665 | up_read(&pci_bus_sem); |
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index 17f38a781d47..f3ccbccf5f21 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
| @@ -17,24 +17,6 @@ menuconfig PCCARD | |||
| 17 | 17 | ||
| 18 | if PCCARD | 18 | if PCCARD |
| 19 | 19 | ||
| 20 | config PCMCIA_DEBUG | ||
| 21 | bool "Enable PCCARD debugging" | ||
| 22 | help | ||
| 23 | Say Y here to enable PCMCIA subsystem debugging. You | ||
| 24 | will need to choose the debugging level either via the | ||
| 25 | kernel command line, or module options depending whether | ||
| 26 | you build the PCMCIA as modules. | ||
| 27 | |||
| 28 | The kernel command line options are: | ||
| 29 | pcmcia_core.pc_debug=N | ||
| 30 | pcmcia.pc_debug=N | ||
| 31 | sa11xx_core.pc_debug=N | ||
| 32 | |||
| 33 | The module option is called pc_debug=N | ||
| 34 | |||
| 35 | In all the above examples, N is the debugging verbosity | ||
| 36 | level. | ||
| 37 | |||
| 38 | config PCMCIA | 20 | config PCMCIA |
| 39 | tristate "16-bit PCMCIA support" | 21 | tristate "16-bit PCMCIA support" |
| 40 | select CRC32 | 22 | select CRC32 |
| @@ -196,9 +178,13 @@ config PCMCIA_BCM63XX | |||
| 196 | tristate "bcm63xx pcmcia support" | 178 | tristate "bcm63xx pcmcia support" |
| 197 | depends on BCM63XX && PCMCIA | 179 | depends on BCM63XX && PCMCIA |
| 198 | 180 | ||
| 181 | config PCMCIA_SOC_COMMON | ||
| 182 | bool | ||
| 183 | |||
| 199 | config PCMCIA_SA1100 | 184 | config PCMCIA_SA1100 |
| 200 | tristate "SA1100 support" | 185 | tristate "SA1100 support" |
| 201 | depends on ARM && ARCH_SA1100 && PCMCIA | 186 | depends on ARM && ARCH_SA1100 && PCMCIA |
| 187 | select PCMCIA_SOC_COMMON | ||
| 202 | help | 188 | help |
| 203 | Say Y here to include support for SA11x0-based PCMCIA or CF | 189 | Say Y here to include support for SA11x0-based PCMCIA or CF |
| 204 | sockets, found on HP iPAQs, Yopy, and other StrongARM(R)/ | 190 | sockets, found on HP iPAQs, Yopy, and other StrongARM(R)/ |
| @@ -209,6 +195,7 @@ config PCMCIA_SA1100 | |||
| 209 | config PCMCIA_SA1111 | 195 | config PCMCIA_SA1111 |
| 210 | tristate "SA1111 support" | 196 | tristate "SA1111 support" |
| 211 | depends on ARM && ARCH_SA1100 && SA1111 && PCMCIA | 197 | depends on ARM && ARCH_SA1100 && SA1111 && PCMCIA |
| 198 | select PCMCIA_SOC_COMMON | ||
| 212 | help | 199 | help |
| 213 | Say Y here to include support for SA1111-based PCMCIA or CF | 200 | Say Y here to include support for SA1111-based PCMCIA or CF |
| 214 | sockets, found on the Jornada 720, Graphicsmaster and other | 201 | sockets, found on the Jornada 720, Graphicsmaster and other |
| @@ -222,9 +209,28 @@ config PCMCIA_PXA2XX | |||
| 222 | depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \ | 209 | depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \ |
| 223 | || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \ | 210 | || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \ |
| 224 | || ARCH_VIPER || ARCH_PXA_ESERIES || MACH_STARGATE2) | 211 | || ARCH_VIPER || ARCH_PXA_ESERIES || MACH_STARGATE2) |
| 212 | select PCMCIA_SOC_COMMON | ||
| 225 | help | 213 | help |
| 226 | Say Y here to include support for the PXA2xx PCMCIA controller | 214 | Say Y here to include support for the PXA2xx PCMCIA controller |
| 227 | 215 | ||
| 216 | config PCMCIA_DEBUG | ||
| 217 | bool "Enable debugging" | ||
| 218 | depends on (PCMCIA_SA1111 || PCMCIA_SA1100 || PCMCIA_PXA2XX) | ||
| 219 | help | ||
| 220 | Say Y here to enable debugging for the SoC PCMCIA layer. | ||
| 221 | You will need to choose the debugging level either via the | ||
| 222 | kernel command line, or module options depending whether | ||
| 223 | you build the drivers as modules. | ||
| 224 | |||
| 225 | The kernel command line options are: | ||
| 226 | sa11xx_core.pc_debug=N | ||
| 227 | pxa2xx_core.pc_debug=N | ||
| 228 | |||
| 229 | The module option is called pc_debug=N | ||
| 230 | |||
| 231 | In all the above examples, N is the debugging verbosity | ||
| 232 | level. | ||
| 233 | |||
| 228 | config PCMCIA_PROBE | 234 | config PCMCIA_PROBE |
| 229 | bool | 235 | bool |
| 230 | default y if ISA && !ARCH_SA1100 && !ARCH_CLPS711X && !PARISC | 236 | default y if ISA && !ARCH_SA1100 && !ARCH_CLPS711X && !PARISC |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index a03a38acd77d..382938313991 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
| @@ -22,8 +22,9 @@ obj-$(CONFIG_I82365) += i82365.o | |||
| 22 | obj-$(CONFIG_I82092) += i82092.o | 22 | obj-$(CONFIG_I82092) += i82092.o |
| 23 | obj-$(CONFIG_TCIC) += tcic.o | 23 | obj-$(CONFIG_TCIC) += tcic.o |
| 24 | obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o | 24 | obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o |
| 25 | obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_core.o sa1100_cs.o | 25 | obj-$(CONFIG_PCMCIA_SOC_COMMON) += soc_common.o |
| 26 | obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o | 26 | obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_base.o sa1100_cs.o |
| 27 | obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_base.o sa1111_cs.o | ||
| 27 | obj-$(CONFIG_M32R_PCC) += m32r_pcc.o | 28 | obj-$(CONFIG_M32R_PCC) += m32r_pcc.o |
| 28 | obj-$(CONFIG_M32R_CFC) += m32r_cfc.o | 29 | obj-$(CONFIG_M32R_CFC) += m32r_cfc.o |
| 29 | obj-$(CONFIG_PCMCIA_AU1X00) += au1x00_ss.o | 30 | obj-$(CONFIG_PCMCIA_AU1X00) += au1x00_ss.o |
| @@ -35,9 +36,6 @@ obj-$(CONFIG_BFIN_CFPCMCIA) += bfin_cf_pcmcia.o | |||
| 35 | obj-$(CONFIG_AT91_CF) += at91_cf.o | 36 | obj-$(CONFIG_AT91_CF) += at91_cf.o |
| 36 | obj-$(CONFIG_ELECTRA_CF) += electra_cf.o | 37 | obj-$(CONFIG_ELECTRA_CF) += electra_cf.o |
| 37 | 38 | ||
| 38 | sa11xx_core-y += soc_common.o sa11xx_base.o | ||
| 39 | pxa2xx_core-y += soc_common.o pxa2xx_base.o | ||
| 40 | |||
| 41 | au1x00_ss-y += au1000_generic.o | 39 | au1x00_ss-y += au1000_generic.o |
| 42 | au1x00_ss-$(CONFIG_MIPS_PB1000) += au1000_pb1x00.o | 40 | au1x00_ss-$(CONFIG_MIPS_PB1000) += au1000_pb1x00.o |
| 43 | au1x00_ss-$(CONFIG_MIPS_PB1100) += au1000_pb1x00.o | 41 | au1x00_ss-$(CONFIG_MIPS_PB1100) += au1000_pb1x00.o |
| @@ -77,4 +75,4 @@ pxa2xx-obj-$(CONFIG_MACH_PALMLD) += pxa2xx_palmld.o | |||
| 77 | pxa2xx-obj-$(CONFIG_MACH_E740) += pxa2xx_e740.o | 75 | pxa2xx-obj-$(CONFIG_MACH_E740) += pxa2xx_e740.o |
| 78 | pxa2xx-obj-$(CONFIG_MACH_STARGATE2) += pxa2xx_stargate2.o | 76 | pxa2xx-obj-$(CONFIG_MACH_STARGATE2) += pxa2xx_stargate2.o |
| 79 | 77 | ||
| 80 | obj-$(CONFIG_PCMCIA_PXA2XX) += pxa2xx_core.o $(pxa2xx-obj-y) | 78 | obj-$(CONFIG_PCMCIA_PXA2XX) += pxa2xx_base.o $(pxa2xx-obj-y) |
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index db77e1f3309a..4cd70d056810 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c | |||
| @@ -91,7 +91,7 @@ static u_int xlate_rom_addr(void __iomem *b, u_int addr) | |||
| 91 | static void cb_release_cis_mem(struct pcmcia_socket * s) | 91 | static void cb_release_cis_mem(struct pcmcia_socket * s) |
| 92 | { | 92 | { |
| 93 | if (s->cb_cis_virt) { | 93 | if (s->cb_cis_virt) { |
| 94 | cs_dbg(s, 1, "cb_release_cis_mem()\n"); | 94 | dev_dbg(&s->dev, "cb_release_cis_mem()\n"); |
| 95 | iounmap(s->cb_cis_virt); | 95 | iounmap(s->cb_cis_virt); |
| 96 | s->cb_cis_virt = NULL; | 96 | s->cb_cis_virt = NULL; |
| 97 | s->cb_cis_res = NULL; | 97 | s->cb_cis_res = NULL; |
| @@ -132,7 +132,7 @@ int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void | |||
| 132 | struct pci_dev *dev; | 132 | struct pci_dev *dev; |
| 133 | struct resource *res; | 133 | struct resource *res; |
| 134 | 134 | ||
| 135 | cs_dbg(s, 3, "read_cb_mem(%d, %#x, %u)\n", space, addr, len); | 135 | dev_dbg(&s->dev, "read_cb_mem(%d, %#x, %u)\n", space, addr, len); |
| 136 | 136 | ||
| 137 | dev = pci_get_slot(s->cb_dev->subordinate, 0); | 137 | dev = pci_get_slot(s->cb_dev->subordinate, 0); |
| 138 | if (!dev) | 138 | if (!dev) |
diff --git a/drivers/pcmcia/cirrus.h b/drivers/pcmcia/cirrus.h index ecd4fc7f666f..446a4576e73e 100644 --- a/drivers/pcmcia/cirrus.h +++ b/drivers/pcmcia/cirrus.h | |||
| @@ -30,16 +30,6 @@ | |||
| 30 | #ifndef _LINUX_CIRRUS_H | 30 | #ifndef _LINUX_CIRRUS_H |
| 31 | #define _LINUX_CIRRUS_H | 31 | #define _LINUX_CIRRUS_H |
| 32 | 32 | ||
| 33 | #ifndef PCI_VENDOR_ID_CIRRUS | ||
| 34 | #define PCI_VENDOR_ID_CIRRUS 0x1013 | ||
| 35 | #endif | ||
| 36 | #ifndef PCI_DEVICE_ID_CIRRUS_6729 | ||
| 37 | #define PCI_DEVICE_ID_CIRRUS_6729 0x1100 | ||
| 38 | #endif | ||
| 39 | #ifndef PCI_DEVICE_ID_CIRRUS_6832 | ||
| 40 | #define PCI_DEVICE_ID_CIRRUS_6832 0x1110 | ||
| 41 | #endif | ||
| 42 | |||
| 43 | #define PD67_MISC_CTL_1 0x16 /* Misc control 1 */ | 33 | #define PD67_MISC_CTL_1 0x16 /* Misc control 1 */ |
| 44 | #define PD67_FIFO_CTL 0x17 /* FIFO control */ | 34 | #define PD67_FIFO_CTL 0x17 /* FIFO control */ |
| 45 | #define PD67_MISC_CTL_2 0x1E /* Misc control 2 */ | 35 | #define PD67_MISC_CTL_2 0x1E /* Misc control 2 */ |
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 6c4a4fc83630..8c1b73cf021b 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c | |||
| @@ -138,7 +138,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
| 138 | void __iomem *sys, *end; | 138 | void __iomem *sys, *end; |
| 139 | unsigned char *buf = ptr; | 139 | unsigned char *buf = ptr; |
| 140 | 140 | ||
| 141 | cs_dbg(s, 3, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len); | 141 | dev_dbg(&s->dev, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len); |
| 142 | 142 | ||
| 143 | if (attr & IS_INDIRECT) { | 143 | if (attr & IS_INDIRECT) { |
| 144 | /* Indirect accesses use a bunch of special registers at fixed | 144 | /* Indirect accesses use a bunch of special registers at fixed |
| @@ -190,7 +190,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
| 190 | addr = 0; | 190 | addr = 0; |
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| 193 | cs_dbg(s, 3, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n", | 193 | dev_dbg(&s->dev, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n", |
| 194 | *(u_char *)(ptr+0), *(u_char *)(ptr+1), | 194 | *(u_char *)(ptr+0), *(u_char *)(ptr+1), |
| 195 | *(u_char *)(ptr+2), *(u_char *)(ptr+3)); | 195 | *(u_char *)(ptr+2), *(u_char *)(ptr+3)); |
| 196 | return 0; | 196 | return 0; |
| @@ -204,7 +204,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
| 204 | void __iomem *sys, *end; | 204 | void __iomem *sys, *end; |
| 205 | unsigned char *buf = ptr; | 205 | unsigned char *buf = ptr; |
| 206 | 206 | ||
| 207 | cs_dbg(s, 3, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len); | 207 | dev_dbg(&s->dev, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len); |
| 208 | 208 | ||
| 209 | if (attr & IS_INDIRECT) { | 209 | if (attr & IS_INDIRECT) { |
| 210 | /* Indirect accesses use a bunch of special registers at fixed | 210 | /* Indirect accesses use a bunch of special registers at fixed |
| @@ -584,7 +584,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_ | |||
| 584 | ofs += link[1] + 2; | 584 | ofs += link[1] + 2; |
| 585 | } | 585 | } |
| 586 | if (i == MAX_TUPLES) { | 586 | if (i == MAX_TUPLES) { |
| 587 | cs_dbg(s, 1, "cs: overrun in pcmcia_get_next_tuple\n"); | 587 | dev_dbg(&s->dev, "cs: overrun in pcmcia_get_next_tuple\n"); |
| 588 | return -ENOSPC; | 588 | return -ENOSPC; |
| 589 | } | 589 | } |
| 590 | 590 | ||
| @@ -1440,7 +1440,7 @@ int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse) | |||
| 1440 | break; | 1440 | break; |
| 1441 | } | 1441 | } |
| 1442 | if (ret) | 1442 | if (ret) |
| 1443 | __cs_dbg(0, "parse_tuple failed %d\n", ret); | 1443 | pr_debug("parse_tuple failed %d\n", ret); |
| 1444 | return ret; | 1444 | return ret; |
| 1445 | } | 1445 | } |
| 1446 | EXPORT_SYMBOL(pcmcia_parse_tuple); | 1446 | EXPORT_SYMBOL(pcmcia_parse_tuple); |
| @@ -1482,6 +1482,67 @@ done: | |||
| 1482 | } | 1482 | } |
| 1483 | EXPORT_SYMBOL(pccard_read_tuple); | 1483 | EXPORT_SYMBOL(pccard_read_tuple); |
| 1484 | 1484 | ||
| 1485 | |||
| 1486 | /** | ||
| 1487 | * pccard_loop_tuple() - loop over tuples in the CIS | ||
| 1488 | * @s: the struct pcmcia_socket where the card is inserted | ||
| 1489 | * @function: the device function we loop for | ||
| 1490 | * @code: which CIS code shall we look for? | ||
| 1491 | * @parse: buffer where the tuple shall be parsed (or NULL, if no parse) | ||
| 1492 | * @priv_data: private data to be passed to the loop_tuple function. | ||
| 1493 | * @loop_tuple: function to call for each CIS entry of type @function. IT | ||
| 1494 | * gets passed the raw tuple, the paresed tuple (if @parse is | ||
| 1495 | * set) and @priv_data. | ||
| 1496 | * | ||
| 1497 | * pccard_loop_tuple() loops over all CIS entries of type @function, and | ||
| 1498 | * calls the @loop_tuple function for each entry. If the call to @loop_tuple | ||
| 1499 | * returns 0, the loop exits. Returns 0 on success or errorcode otherwise. | ||
| 1500 | */ | ||
| 1501 | int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, | ||
| 1502 | cisdata_t code, cisparse_t *parse, void *priv_data, | ||
| 1503 | int (*loop_tuple) (tuple_t *tuple, | ||
| 1504 | cisparse_t *parse, | ||
| 1505 | void *priv_data)) | ||
| 1506 | { | ||
| 1507 | tuple_t tuple; | ||
| 1508 | cisdata_t *buf; | ||
| 1509 | int ret; | ||
| 1510 | |||
| 1511 | buf = kzalloc(256, GFP_KERNEL); | ||
| 1512 | if (buf == NULL) { | ||
| 1513 | dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n"); | ||
| 1514 | return -ENOMEM; | ||
| 1515 | } | ||
| 1516 | |||
| 1517 | tuple.TupleData = buf; | ||
| 1518 | tuple.TupleDataMax = 255; | ||
| 1519 | tuple.TupleOffset = 0; | ||
| 1520 | tuple.DesiredTuple = code; | ||
| 1521 | tuple.Attributes = 0; | ||
| 1522 | |||
| 1523 | ret = pccard_get_first_tuple(s, function, &tuple); | ||
| 1524 | while (!ret) { | ||
| 1525 | if (pccard_get_tuple_data(s, &tuple)) | ||
| 1526 | goto next_entry; | ||
| 1527 | |||
| 1528 | if (parse) | ||
| 1529 | if (pcmcia_parse_tuple(&tuple, parse)) | ||
| 1530 | goto next_entry; | ||
| 1531 | |||
| 1532 | ret = loop_tuple(&tuple, parse, priv_data); | ||
| 1533 | if (!ret) | ||
| 1534 | break; | ||
| 1535 | |||
| 1536 | next_entry: | ||
| 1537 | ret = pccard_get_next_tuple(s, function, &tuple); | ||
| 1538 | } | ||
| 1539 | |||
| 1540 | kfree(buf); | ||
| 1541 | return ret; | ||
| 1542 | } | ||
| 1543 | EXPORT_SYMBOL(pccard_loop_tuple); | ||
| 1544 | |||
| 1545 | |||
| 1485 | /*====================================================================== | 1546 | /*====================================================================== |
| 1486 | 1547 | ||
| 1487 | This tries to determine if a card has a sensible CIS. It returns | 1548 | This tries to determine if a card has a sensible CIS. It returns |
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 698d75cda084..790af87a922f 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c | |||
| @@ -61,17 +61,6 @@ INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */ | |||
| 61 | /* Access speed for attribute memory windows */ | 61 | /* Access speed for attribute memory windows */ |
| 62 | INT_MODULE_PARM(cis_speed, 300); /* ns */ | 62 | INT_MODULE_PARM(cis_speed, 300); /* ns */ |
| 63 | 63 | ||
| 64 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 65 | static int pc_debug; | ||
| 66 | |||
| 67 | module_param(pc_debug, int, 0644); | ||
| 68 | |||
| 69 | int cs_debug_level(int level) | ||
| 70 | { | ||
| 71 | return pc_debug > level; | ||
| 72 | } | ||
| 73 | #endif | ||
| 74 | |||
| 75 | 64 | ||
| 76 | socket_state_t dead_socket = { | 65 | socket_state_t dead_socket = { |
| 77 | .csc_mask = SS_DETECT, | 66 | .csc_mask = SS_DETECT, |
| @@ -190,7 +179,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) | |||
| 190 | if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops) | 179 | if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops) |
| 191 | return -EINVAL; | 180 | return -EINVAL; |
| 192 | 181 | ||
| 193 | cs_dbg(socket, 0, "pcmcia_register_socket(0x%p)\n", socket->ops); | 182 | dev_dbg(&socket->dev, "pcmcia_register_socket(0x%p)\n", socket->ops); |
| 194 | 183 | ||
| 195 | spin_lock_init(&socket->lock); | 184 | spin_lock_init(&socket->lock); |
| 196 | 185 | ||
| @@ -262,6 +251,13 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) | |||
| 262 | 251 | ||
| 263 | pcmcia_parse_events(socket, SS_DETECT); | 252 | pcmcia_parse_events(socket, SS_DETECT); |
| 264 | 253 | ||
| 254 | /* | ||
| 255 | * Let's try to get the PCMCIA module for 16-bit PCMCIA support. | ||
| 256 | * If it fails, it doesn't matter -- we still have 32-bit CardBus | ||
| 257 | * support to offer, so this is not a failure mode. | ||
| 258 | */ | ||
| 259 | request_module_nowait("pcmcia"); | ||
| 260 | |||
| 265 | return 0; | 261 | return 0; |
| 266 | 262 | ||
| 267 | err: | 263 | err: |
| @@ -282,7 +278,7 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket) | |||
| 282 | if (!socket) | 278 | if (!socket) |
| 283 | return; | 279 | return; |
| 284 | 280 | ||
| 285 | cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops); | 281 | dev_dbg(&socket->dev, "pcmcia_unregister_socket(0x%p)\n", socket->ops); |
| 286 | 282 | ||
| 287 | if (socket->thread) | 283 | if (socket->thread) |
| 288 | kthread_stop(socket->thread); | 284 | kthread_stop(socket->thread); |
| @@ -335,7 +331,7 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority) | |||
| 335 | if (s->state & SOCKET_CARDBUS) | 331 | if (s->state & SOCKET_CARDBUS) |
| 336 | return 0; | 332 | return 0; |
| 337 | 333 | ||
| 338 | cs_dbg(s, 1, "send_event(event %d, pri %d, callback 0x%p)\n", | 334 | dev_dbg(&s->dev, "send_event(event %d, pri %d, callback 0x%p)\n", |
| 339 | event, priority, s->callback); | 335 | event, priority, s->callback); |
| 340 | 336 | ||
| 341 | if (!s->callback) | 337 | if (!s->callback) |
| @@ -352,7 +348,7 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority) | |||
| 352 | 348 | ||
| 353 | static void socket_remove_drivers(struct pcmcia_socket *skt) | 349 | static void socket_remove_drivers(struct pcmcia_socket *skt) |
| 354 | { | 350 | { |
| 355 | cs_dbg(skt, 4, "remove_drivers\n"); | 351 | dev_dbg(&skt->dev, "remove_drivers\n"); |
| 356 | 352 | ||
| 357 | send_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH); | 353 | send_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH); |
| 358 | } | 354 | } |
| @@ -361,7 +357,7 @@ static int socket_reset(struct pcmcia_socket *skt) | |||
| 361 | { | 357 | { |
| 362 | int status, i; | 358 | int status, i; |
| 363 | 359 | ||
| 364 | cs_dbg(skt, 4, "reset\n"); | 360 | dev_dbg(&skt->dev, "reset\n"); |
| 365 | 361 | ||
| 366 | skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET; | 362 | skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET; |
| 367 | skt->ops->set_socket(skt, &skt->socket); | 363 | skt->ops->set_socket(skt, &skt->socket); |
| @@ -383,7 +379,7 @@ static int socket_reset(struct pcmcia_socket *skt) | |||
| 383 | msleep(unreset_check * 10); | 379 | msleep(unreset_check * 10); |
| 384 | } | 380 | } |
| 385 | 381 | ||
| 386 | cs_err(skt, "time out after reset.\n"); | 382 | dev_printk(KERN_ERR, &skt->dev, "time out after reset.\n"); |
| 387 | return -ETIMEDOUT; | 383 | return -ETIMEDOUT; |
| 388 | } | 384 | } |
| 389 | 385 | ||
| @@ -397,7 +393,7 @@ static void socket_shutdown(struct pcmcia_socket *s) | |||
| 397 | { | 393 | { |
| 398 | int status; | 394 | int status; |
| 399 | 395 | ||
| 400 | cs_dbg(s, 4, "shutdown\n"); | 396 | dev_dbg(&s->dev, "shutdown\n"); |
| 401 | 397 | ||
| 402 | socket_remove_drivers(s); | 398 | socket_remove_drivers(s); |
| 403 | s->state &= SOCKET_INUSE | SOCKET_PRESENT; | 399 | s->state &= SOCKET_INUSE | SOCKET_PRESENT; |
| @@ -432,7 +428,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) | |||
| 432 | { | 428 | { |
| 433 | int status, i; | 429 | int status, i; |
| 434 | 430 | ||
| 435 | cs_dbg(skt, 4, "setup\n"); | 431 | dev_dbg(&skt->dev, "setup\n"); |
| 436 | 432 | ||
| 437 | skt->ops->get_status(skt, &status); | 433 | skt->ops->get_status(skt, &status); |
| 438 | if (!(status & SS_DETECT)) | 434 | if (!(status & SS_DETECT)) |
| @@ -452,13 +448,15 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) | |||
| 452 | } | 448 | } |
| 453 | 449 | ||
| 454 | if (status & SS_PENDING) { | 450 | if (status & SS_PENDING) { |
| 455 | cs_err(skt, "voltage interrogation timed out.\n"); | 451 | dev_printk(KERN_ERR, &skt->dev, |
| 452 | "voltage interrogation timed out.\n"); | ||
| 456 | return -ETIMEDOUT; | 453 | return -ETIMEDOUT; |
| 457 | } | 454 | } |
| 458 | 455 | ||
| 459 | if (status & SS_CARDBUS) { | 456 | if (status & SS_CARDBUS) { |
| 460 | if (!(skt->features & SS_CAP_CARDBUS)) { | 457 | if (!(skt->features & SS_CAP_CARDBUS)) { |
| 461 | cs_err(skt, "cardbus cards are not supported.\n"); | 458 | dev_printk(KERN_ERR, &skt->dev, |
| 459 | "cardbus cards are not supported.\n"); | ||
| 462 | return -EINVAL; | 460 | return -EINVAL; |
| 463 | } | 461 | } |
| 464 | skt->state |= SOCKET_CARDBUS; | 462 | skt->state |= SOCKET_CARDBUS; |
| @@ -472,7 +470,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) | |||
| 472 | else if (!(status & SS_XVCARD)) | 470 | else if (!(status & SS_XVCARD)) |
| 473 | skt->socket.Vcc = skt->socket.Vpp = 50; | 471 | skt->socket.Vcc = skt->socket.Vpp = 50; |
| 474 | else { | 472 | else { |
| 475 | cs_err(skt, "unsupported voltage key.\n"); | 473 | dev_printk(KERN_ERR, &skt->dev, "unsupported voltage key.\n"); |
| 476 | return -EIO; | 474 | return -EIO; |
| 477 | } | 475 | } |
| 478 | 476 | ||
| @@ -489,7 +487,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) | |||
| 489 | 487 | ||
| 490 | skt->ops->get_status(skt, &status); | 488 | skt->ops->get_status(skt, &status); |
| 491 | if (!(status & SS_POWERON)) { | 489 | if (!(status & SS_POWERON)) { |
| 492 | cs_err(skt, "unable to apply power.\n"); | 490 | dev_printk(KERN_ERR, &skt->dev, "unable to apply power.\n"); |
| 493 | return -EIO; | 491 | return -EIO; |
| 494 | } | 492 | } |
| 495 | 493 | ||
| @@ -509,7 +507,7 @@ static int socket_insert(struct pcmcia_socket *skt) | |||
| 509 | { | 507 | { |
| 510 | int ret; | 508 | int ret; |
| 511 | 509 | ||
| 512 | cs_dbg(skt, 4, "insert\n"); | 510 | dev_dbg(&skt->dev, "insert\n"); |
| 513 | 511 | ||
| 514 | if (!cs_socket_get(skt)) | 512 | if (!cs_socket_get(skt)) |
| 515 | return -ENODEV; | 513 | return -ENODEV; |
| @@ -529,7 +527,7 @@ static int socket_insert(struct pcmcia_socket *skt) | |||
| 529 | skt->state |= SOCKET_CARDBUS_CONFIG; | 527 | skt->state |= SOCKET_CARDBUS_CONFIG; |
| 530 | } | 528 | } |
| 531 | #endif | 529 | #endif |
| 532 | cs_dbg(skt, 4, "insert done\n"); | 530 | dev_dbg(&skt->dev, "insert done\n"); |
| 533 | 531 | ||
| 534 | send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); | 532 | send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); |
| 535 | } else { | 533 | } else { |
| @@ -576,7 +574,7 @@ static int socket_late_resume(struct pcmcia_socket *skt) | |||
| 576 | * FIXME: need a better check here for cardbus cards. | 574 | * FIXME: need a better check here for cardbus cards. |
| 577 | */ | 575 | */ |
| 578 | if (verify_cis_cache(skt) != 0) { | 576 | if (verify_cis_cache(skt) != 0) { |
| 579 | cs_dbg(skt, 4, "cis mismatch - different card\n"); | 577 | dev_dbg(&skt->dev, "cis mismatch - different card\n"); |
| 580 | socket_remove_drivers(skt); | 578 | socket_remove_drivers(skt); |
| 581 | destroy_cis_cache(skt); | 579 | destroy_cis_cache(skt); |
| 582 | /* | 580 | /* |
| @@ -587,7 +585,7 @@ static int socket_late_resume(struct pcmcia_socket *skt) | |||
| 587 | msleep(200); | 585 | msleep(200); |
| 588 | send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); | 586 | send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); |
| 589 | } else { | 587 | } else { |
| 590 | cs_dbg(skt, 4, "cis matches cache\n"); | 588 | dev_dbg(&skt->dev, "cis matches cache\n"); |
| 591 | send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW); | 589 | send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW); |
| 592 | } | 590 | } |
| 593 | } else { | 591 | } else { |
| @@ -723,7 +721,7 @@ static int pccardd(void *__skt) | |||
| 723 | void pcmcia_parse_events(struct pcmcia_socket *s, u_int events) | 721 | void pcmcia_parse_events(struct pcmcia_socket *s, u_int events) |
| 724 | { | 722 | { |
| 725 | unsigned long flags; | 723 | unsigned long flags; |
| 726 | cs_dbg(s, 4, "parse_events: events %08x\n", events); | 724 | dev_dbg(&s->dev, "parse_events: events %08x\n", events); |
| 727 | if (s->thread) { | 725 | if (s->thread) { |
| 728 | spin_lock_irqsave(&s->thread_lock, flags); | 726 | spin_lock_irqsave(&s->thread_lock, flags); |
| 729 | s->thread_events |= events; | 727 | s->thread_events |= events; |
| @@ -773,19 +771,22 @@ int pcmcia_reset_card(struct pcmcia_socket *skt) | |||
| 773 | { | 771 | { |
| 774 | int ret; | 772 | int ret; |
| 775 | 773 | ||
| 776 | cs_dbg(skt, 1, "resetting socket\n"); | 774 | dev_dbg(&skt->dev, "resetting socket\n"); |
| 777 | 775 | ||
| 778 | mutex_lock(&skt->skt_mutex); | 776 | mutex_lock(&skt->skt_mutex); |
| 779 | do { | 777 | do { |
| 780 | if (!(skt->state & SOCKET_PRESENT)) { | 778 | if (!(skt->state & SOCKET_PRESENT)) { |
| 779 | dev_dbg(&skt->dev, "can't reset, not present\n"); | ||
| 781 | ret = -ENODEV; | 780 | ret = -ENODEV; |
| 782 | break; | 781 | break; |
| 783 | } | 782 | } |
| 784 | if (skt->state & SOCKET_SUSPEND) { | 783 | if (skt->state & SOCKET_SUSPEND) { |
| 784 | dev_dbg(&skt->dev, "can't reset, suspended\n"); | ||
| 785 | ret = -EBUSY; | 785 | ret = -EBUSY; |
| 786 | break; | 786 | break; |
| 787 | } | 787 | } |
| 788 | if (skt->state & SOCKET_CARDBUS) { | 788 | if (skt->state & SOCKET_CARDBUS) { |
| 789 | dev_dbg(&skt->dev, "can't reset, is cardbus\n"); | ||
| 789 | ret = -EPERM; | 790 | ret = -EPERM; |
| 790 | break; | 791 | break; |
| 791 | } | 792 | } |
| @@ -818,7 +819,7 @@ int pcmcia_suspend_card(struct pcmcia_socket *skt) | |||
| 818 | { | 819 | { |
| 819 | int ret; | 820 | int ret; |
| 820 | 821 | ||
| 821 | cs_dbg(skt, 1, "suspending socket\n"); | 822 | dev_dbg(&skt->dev, "suspending socket\n"); |
| 822 | 823 | ||
| 823 | mutex_lock(&skt->skt_mutex); | 824 | mutex_lock(&skt->skt_mutex); |
| 824 | do { | 825 | do { |
| @@ -848,7 +849,7 @@ int pcmcia_resume_card(struct pcmcia_socket *skt) | |||
| 848 | { | 849 | { |
| 849 | int ret; | 850 | int ret; |
| 850 | 851 | ||
| 851 | cs_dbg(skt, 1, "waking up socket\n"); | 852 | dev_dbg(&skt->dev, "waking up socket\n"); |
| 852 | 853 | ||
| 853 | mutex_lock(&skt->skt_mutex); | 854 | mutex_lock(&skt->skt_mutex); |
| 854 | do { | 855 | do { |
| @@ -876,7 +877,7 @@ int pcmcia_eject_card(struct pcmcia_socket *skt) | |||
| 876 | { | 877 | { |
| 877 | int ret; | 878 | int ret; |
| 878 | 879 | ||
| 879 | cs_dbg(skt, 1, "user eject request\n"); | 880 | dev_dbg(&skt->dev, "user eject request\n"); |
| 880 | 881 | ||
| 881 | mutex_lock(&skt->skt_mutex); | 882 | mutex_lock(&skt->skt_mutex); |
| 882 | do { | 883 | do { |
| @@ -905,7 +906,7 @@ int pcmcia_insert_card(struct pcmcia_socket *skt) | |||
| 905 | { | 906 | { |
| 906 | int ret; | 907 | int ret; |
| 907 | 908 | ||
| 908 | cs_dbg(skt, 1, "user insert request\n"); | 909 | dev_dbg(&skt->dev, "user insert request\n"); |
| 909 | 910 | ||
| 910 | mutex_lock(&skt->skt_mutex); | 911 | mutex_lock(&skt->skt_mutex); |
| 911 | do { | 912 | do { |
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 1f4098f1354d..3bc02d53a3a3 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
| @@ -107,28 +107,6 @@ static inline void cs_socket_put(struct pcmcia_socket *skt) | |||
| 107 | } | 107 | } |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 111 | extern int cs_debug_level(int); | ||
| 112 | |||
| 113 | #define cs_dbg(skt, lvl, fmt, arg...) do { \ | ||
| 114 | if (cs_debug_level(lvl)) \ | ||
| 115 | dev_printk(KERN_DEBUG, &skt->dev, \ | ||
| 116 | "cs: " fmt, ## arg); \ | ||
| 117 | } while (0) | ||
| 118 | #define __cs_dbg(lvl, fmt, arg...) do { \ | ||
| 119 | if (cs_debug_level(lvl)) \ | ||
| 120 | printk(KERN_DEBUG \ | ||
| 121 | "cs: " fmt, ## arg); \ | ||
| 122 | } while (0) | ||
| 123 | |||
| 124 | #else | ||
| 125 | #define cs_dbg(skt, lvl, fmt, arg...) do { } while (0) | ||
| 126 | #define __cs_dbg(lvl, fmt, arg...) do { } while (0) | ||
| 127 | #endif | ||
| 128 | |||
| 129 | #define cs_err(skt, fmt, arg...) \ | ||
| 130 | dev_printk(KERN_ERR, &skt->dev, "cs: " fmt, ## arg) | ||
| 131 | |||
| 132 | 110 | ||
| 133 | /* | 111 | /* |
| 134 | * Stuff internal to module "pcmcia_core": | 112 | * Stuff internal to module "pcmcia_core": |
| @@ -170,10 +148,6 @@ extern struct rw_semaphore pcmcia_socket_list_rwsem; | |||
| 170 | extern struct list_head pcmcia_socket_list; | 148 | extern struct list_head pcmcia_socket_list; |
| 171 | extern struct class pcmcia_socket_class; | 149 | extern struct class pcmcia_socket_class; |
| 172 | 150 | ||
| 173 | int pcmcia_get_window(struct pcmcia_socket *s, | ||
| 174 | window_handle_t *handle, | ||
| 175 | int idx, | ||
| 176 | win_req_t *req); | ||
| 177 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); | 151 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); |
| 178 | struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); | 152 | struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); |
| 179 | 153 | ||
| @@ -199,6 +173,22 @@ int pcmcia_replace_cis(struct pcmcia_socket *s, | |||
| 199 | const u8 *data, const size_t len); | 173 | const u8 *data, const size_t len); |
| 200 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count); | 174 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count); |
| 201 | 175 | ||
| 176 | /* loop over CIS entries */ | ||
| 177 | int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, | ||
| 178 | cisdata_t code, cisparse_t *parse, void *priv_data, | ||
| 179 | int (*loop_tuple) (tuple_t *tuple, | ||
| 180 | cisparse_t *parse, | ||
| 181 | void *priv_data)); | ||
| 182 | |||
| 183 | int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, | ||
| 184 | tuple_t *tuple); | ||
| 185 | |||
| 186 | int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, | ||
| 187 | tuple_t *tuple); | ||
| 188 | |||
| 189 | int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); | ||
| 190 | |||
| 191 | |||
| 202 | /* rsrc_mgr.c */ | 192 | /* rsrc_mgr.c */ |
| 203 | int pcmcia_validate_mem(struct pcmcia_socket *s); | 193 | int pcmcia_validate_mem(struct pcmcia_socket *s); |
| 204 | struct resource *pcmcia_find_io_region(unsigned long base, | 194 | struct resource *pcmcia_find_io_region(unsigned long base, |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index f5b7079f13d3..05893d41dd41 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
| @@ -41,129 +41,11 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); | |||
| 41 | MODULE_DESCRIPTION("PCMCIA Driver Services"); | 41 | MODULE_DESCRIPTION("PCMCIA Driver Services"); |
| 42 | MODULE_LICENSE("GPL"); | 42 | MODULE_LICENSE("GPL"); |
| 43 | 43 | ||
| 44 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 45 | int ds_pc_debug; | ||
| 46 | |||
| 47 | module_param_named(pc_debug, ds_pc_debug, int, 0644); | ||
| 48 | |||
| 49 | #define ds_dbg(lvl, fmt, arg...) do { \ | ||
| 50 | if (ds_pc_debug > (lvl)) \ | ||
| 51 | printk(KERN_DEBUG "ds: " fmt , ## arg); \ | ||
| 52 | } while (0) | ||
| 53 | #define ds_dev_dbg(lvl, dev, fmt, arg...) do { \ | ||
| 54 | if (ds_pc_debug > (lvl)) \ | ||
| 55 | dev_printk(KERN_DEBUG, dev, "ds: " fmt , ## arg); \ | ||
| 56 | } while (0) | ||
| 57 | #else | ||
| 58 | #define ds_dbg(lvl, fmt, arg...) do { } while (0) | ||
| 59 | #define ds_dev_dbg(lvl, dev, fmt, arg...) do { } while (0) | ||
| 60 | #endif | ||
| 61 | 44 | ||
| 62 | spinlock_t pcmcia_dev_list_lock; | 45 | spinlock_t pcmcia_dev_list_lock; |
| 63 | 46 | ||
| 64 | /*====================================================================*/ | 47 | /*====================================================================*/ |
| 65 | 48 | ||
| 66 | /* code which was in cs.c before */ | ||
| 67 | |||
| 68 | /* String tables for error messages */ | ||
| 69 | |||
| 70 | typedef struct lookup_t { | ||
| 71 | const int key; | ||
| 72 | const char *msg; | ||
| 73 | } lookup_t; | ||
| 74 | |||
| 75 | static const lookup_t error_table[] = { | ||
| 76 | { 0, "Operation succeeded" }, | ||
| 77 | { -EIO, "Input/Output error" }, | ||
| 78 | { -ENODEV, "No card present" }, | ||
| 79 | { -EINVAL, "Bad parameter" }, | ||
| 80 | { -EACCES, "Configuration locked" }, | ||
| 81 | { -EBUSY, "Resource in use" }, | ||
| 82 | { -ENOSPC, "No more items" }, | ||
| 83 | { -ENOMEM, "Out of resource" }, | ||
| 84 | }; | ||
| 85 | |||
| 86 | |||
| 87 | static const lookup_t service_table[] = { | ||
| 88 | { AccessConfigurationRegister, "AccessConfigurationRegister" }, | ||
| 89 | { AddSocketServices, "AddSocketServices" }, | ||
| 90 | { AdjustResourceInfo, "AdjustResourceInfo" }, | ||
| 91 | { CheckEraseQueue, "CheckEraseQueue" }, | ||
| 92 | { CloseMemory, "CloseMemory" }, | ||
| 93 | { DeregisterClient, "DeregisterClient" }, | ||
| 94 | { DeregisterEraseQueue, "DeregisterEraseQueue" }, | ||
| 95 | { GetCardServicesInfo, "GetCardServicesInfo" }, | ||
| 96 | { GetClientInfo, "GetClientInfo" }, | ||
| 97 | { GetConfigurationInfo, "GetConfigurationInfo" }, | ||
| 98 | { GetEventMask, "GetEventMask" }, | ||
| 99 | { GetFirstClient, "GetFirstClient" }, | ||
| 100 | { GetFirstRegion, "GetFirstRegion" }, | ||
| 101 | { GetFirstTuple, "GetFirstTuple" }, | ||
| 102 | { GetNextClient, "GetNextClient" }, | ||
| 103 | { GetNextRegion, "GetNextRegion" }, | ||
| 104 | { GetNextTuple, "GetNextTuple" }, | ||
| 105 | { GetStatus, "GetStatus" }, | ||
| 106 | { GetTupleData, "GetTupleData" }, | ||
| 107 | { MapMemPage, "MapMemPage" }, | ||
| 108 | { ModifyConfiguration, "ModifyConfiguration" }, | ||
| 109 | { ModifyWindow, "ModifyWindow" }, | ||
| 110 | { OpenMemory, "OpenMemory" }, | ||
| 111 | { ParseTuple, "ParseTuple" }, | ||
| 112 | { ReadMemory, "ReadMemory" }, | ||
| 113 | { RegisterClient, "RegisterClient" }, | ||
| 114 | { RegisterEraseQueue, "RegisterEraseQueue" }, | ||
| 115 | { RegisterMTD, "RegisterMTD" }, | ||
| 116 | { ReleaseConfiguration, "ReleaseConfiguration" }, | ||
| 117 | { ReleaseIO, "ReleaseIO" }, | ||
| 118 | { ReleaseIRQ, "ReleaseIRQ" }, | ||
| 119 | { ReleaseWindow, "ReleaseWindow" }, | ||
| 120 | { RequestConfiguration, "RequestConfiguration" }, | ||
| 121 | { RequestIO, "RequestIO" }, | ||
| 122 | { RequestIRQ, "RequestIRQ" }, | ||
| 123 | { RequestSocketMask, "RequestSocketMask" }, | ||
| 124 | { RequestWindow, "RequestWindow" }, | ||
| 125 | { ResetCard, "ResetCard" }, | ||
| 126 | { SetEventMask, "SetEventMask" }, | ||
| 127 | { ValidateCIS, "ValidateCIS" }, | ||
| 128 | { WriteMemory, "WriteMemory" }, | ||
| 129 | { BindDevice, "BindDevice" }, | ||
| 130 | { BindMTD, "BindMTD" }, | ||
| 131 | { ReportError, "ReportError" }, | ||
| 132 | { SuspendCard, "SuspendCard" }, | ||
| 133 | { ResumeCard, "ResumeCard" }, | ||
| 134 | { EjectCard, "EjectCard" }, | ||
| 135 | { InsertCard, "InsertCard" }, | ||
| 136 | { ReplaceCIS, "ReplaceCIS" } | ||
| 137 | }; | ||
| 138 | |||
| 139 | const char *pcmcia_error_func(int func) | ||
| 140 | { | ||
| 141 | int i; | ||
| 142 | |||
| 143 | for (i = 0; i < ARRAY_SIZE(service_table); i++) | ||
| 144 | if (service_table[i].key == func) | ||
| 145 | return service_table[i].msg; | ||
| 146 | |||
| 147 | return "Unknown service number"; | ||
| 148 | } | ||
| 149 | EXPORT_SYMBOL(pcmcia_error_func); | ||
| 150 | |||
| 151 | const char *pcmcia_error_ret(int ret) | ||
| 152 | { | ||
| 153 | int i; | ||
| 154 | |||
| 155 | for (i = 0; i < ARRAY_SIZE(error_table); i++) | ||
| 156 | if (error_table[i].key == ret) | ||
| 157 | return error_table[i].msg; | ||
| 158 | |||
| 159 | return "unknown"; | ||
| 160 | } | ||
| 161 | EXPORT_SYMBOL(pcmcia_error_ret); | ||
| 162 | |||
| 163 | /*======================================================================*/ | ||
| 164 | |||
| 165 | |||
| 166 | |||
| 167 | static void pcmcia_check_driver(struct pcmcia_driver *p_drv) | 49 | static void pcmcia_check_driver(struct pcmcia_driver *p_drv) |
| 168 | { | 50 | { |
| 169 | struct pcmcia_device_id *did = p_drv->id_table; | 51 | struct pcmcia_device_id *did = p_drv->id_table; |
| @@ -303,7 +185,7 @@ int pcmcia_register_driver(struct pcmcia_driver *driver) | |||
| 303 | spin_lock_init(&driver->dynids.lock); | 185 | spin_lock_init(&driver->dynids.lock); |
| 304 | INIT_LIST_HEAD(&driver->dynids.list); | 186 | INIT_LIST_HEAD(&driver->dynids.list); |
| 305 | 187 | ||
| 306 | ds_dbg(3, "registering driver %s\n", driver->drv.name); | 188 | pr_debug("registering driver %s\n", driver->drv.name); |
| 307 | 189 | ||
| 308 | error = driver_register(&driver->drv); | 190 | error = driver_register(&driver->drv); |
| 309 | if (error < 0) | 191 | if (error < 0) |
| @@ -323,7 +205,7 @@ EXPORT_SYMBOL(pcmcia_register_driver); | |||
| 323 | */ | 205 | */ |
| 324 | void pcmcia_unregister_driver(struct pcmcia_driver *driver) | 206 | void pcmcia_unregister_driver(struct pcmcia_driver *driver) |
| 325 | { | 207 | { |
| 326 | ds_dbg(3, "unregistering driver %s\n", driver->drv.name); | 208 | pr_debug("unregistering driver %s\n", driver->drv.name); |
| 327 | driver_unregister(&driver->drv); | 209 | driver_unregister(&driver->drv); |
| 328 | pcmcia_free_dynids(driver); | 210 | pcmcia_free_dynids(driver); |
| 329 | } | 211 | } |
| @@ -350,14 +232,14 @@ void pcmcia_put_dev(struct pcmcia_device *p_dev) | |||
| 350 | static void pcmcia_release_function(struct kref *ref) | 232 | static void pcmcia_release_function(struct kref *ref) |
| 351 | { | 233 | { |
| 352 | struct config_t *c = container_of(ref, struct config_t, ref); | 234 | struct config_t *c = container_of(ref, struct config_t, ref); |
| 353 | ds_dbg(1, "releasing config_t\n"); | 235 | pr_debug("releasing config_t\n"); |
| 354 | kfree(c); | 236 | kfree(c); |
| 355 | } | 237 | } |
| 356 | 238 | ||
| 357 | static void pcmcia_release_dev(struct device *dev) | 239 | static void pcmcia_release_dev(struct device *dev) |
| 358 | { | 240 | { |
| 359 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 241 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
| 360 | ds_dev_dbg(1, dev, "releasing device\n"); | 242 | dev_dbg(dev, "releasing device\n"); |
| 361 | pcmcia_put_socket(p_dev->socket); | 243 | pcmcia_put_socket(p_dev->socket); |
| 362 | kfree(p_dev->devname); | 244 | kfree(p_dev->devname); |
| 363 | kref_put(&p_dev->function_config->ref, pcmcia_release_function); | 245 | kref_put(&p_dev->function_config->ref, pcmcia_release_function); |
| @@ -367,7 +249,7 @@ static void pcmcia_release_dev(struct device *dev) | |||
| 367 | static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) | 249 | static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) |
| 368 | { | 250 | { |
| 369 | if (!s->pcmcia_state.device_add_pending) { | 251 | if (!s->pcmcia_state.device_add_pending) { |
| 370 | ds_dev_dbg(1, &s->dev, "scheduling to add %s secondary" | 252 | dev_dbg(&s->dev, "scheduling to add %s secondary" |
| 371 | " device to %d\n", mfc ? "mfc" : "pfc", s->sock); | 253 | " device to %d\n", mfc ? "mfc" : "pfc", s->sock); |
| 372 | s->pcmcia_state.device_add_pending = 1; | 254 | s->pcmcia_state.device_add_pending = 1; |
| 373 | s->pcmcia_state.mfc_pfc = mfc; | 255 | s->pcmcia_state.mfc_pfc = mfc; |
| @@ -405,7 +287,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
| 405 | */ | 287 | */ |
| 406 | did = dev_get_drvdata(&p_dev->dev); | 288 | did = dev_get_drvdata(&p_dev->dev); |
| 407 | 289 | ||
| 408 | ds_dev_dbg(1, dev, "trying to bind to %s\n", p_drv->drv.name); | 290 | dev_dbg(dev, "trying to bind to %s\n", p_drv->drv.name); |
| 409 | 291 | ||
| 410 | if ((!p_drv->probe) || (!p_dev->function_config) || | 292 | if ((!p_drv->probe) || (!p_dev->function_config) || |
| 411 | (!try_module_get(p_drv->owner))) { | 293 | (!try_module_get(p_drv->owner))) { |
| @@ -428,7 +310,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
| 428 | 310 | ||
| 429 | ret = p_drv->probe(p_dev); | 311 | ret = p_drv->probe(p_dev); |
| 430 | if (ret) { | 312 | if (ret) { |
| 431 | ds_dev_dbg(1, dev, "binding to %s failed with %d\n", | 313 | dev_dbg(dev, "binding to %s failed with %d\n", |
| 432 | p_drv->drv.name, ret); | 314 | p_drv->drv.name, ret); |
| 433 | goto put_module; | 315 | goto put_module; |
| 434 | } | 316 | } |
| @@ -456,7 +338,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
| 456 | struct pcmcia_device *tmp; | 338 | struct pcmcia_device *tmp; |
| 457 | unsigned long flags; | 339 | unsigned long flags; |
| 458 | 340 | ||
| 459 | ds_dev_dbg(2, leftover ? &leftover->dev : &s->dev, | 341 | dev_dbg(leftover ? &leftover->dev : &s->dev, |
| 460 | "pcmcia_card_remove(%d) %s\n", s->sock, | 342 | "pcmcia_card_remove(%d) %s\n", s->sock, |
| 461 | leftover ? leftover->devname : ""); | 343 | leftover ? leftover->devname : ""); |
| 462 | 344 | ||
| @@ -475,7 +357,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
| 475 | p_dev->_removed=1; | 357 | p_dev->_removed=1; |
| 476 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 358 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
| 477 | 359 | ||
| 478 | ds_dev_dbg(2, &p_dev->dev, "unregistering device\n"); | 360 | dev_dbg(&p_dev->dev, "unregistering device\n"); |
| 479 | device_unregister(&p_dev->dev); | 361 | device_unregister(&p_dev->dev); |
| 480 | } | 362 | } |
| 481 | 363 | ||
| @@ -492,7 +374,7 @@ static int pcmcia_device_remove(struct device * dev) | |||
| 492 | p_dev = to_pcmcia_dev(dev); | 374 | p_dev = to_pcmcia_dev(dev); |
| 493 | p_drv = to_pcmcia_drv(dev->driver); | 375 | p_drv = to_pcmcia_drv(dev->driver); |
| 494 | 376 | ||
| 495 | ds_dev_dbg(1, dev, "removing device\n"); | 377 | dev_dbg(dev, "removing device\n"); |
| 496 | 378 | ||
| 497 | /* If we're removing the primary module driving a | 379 | /* If we're removing the primary module driving a |
| 498 | * pseudo multi-function card, we need to unbind | 380 | * pseudo multi-function card, we need to unbind |
| @@ -572,7 +454,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) | |||
| 572 | } | 454 | } |
| 573 | if (!pccard_read_tuple(p_dev->socket, p_dev->func, | 455 | if (!pccard_read_tuple(p_dev->socket, p_dev->func, |
| 574 | CISTPL_DEVICE_GEO, devgeo)) { | 456 | CISTPL_DEVICE_GEO, devgeo)) { |
| 575 | ds_dev_dbg(0, &p_dev->dev, | 457 | dev_dbg(&p_dev->dev, |
| 576 | "mem device geometry probably means " | 458 | "mem device geometry probably means " |
| 577 | "FUNCID_MEMORY\n"); | 459 | "FUNCID_MEMORY\n"); |
| 578 | p_dev->func_id = CISTPL_FUNCID_MEMORY; | 460 | p_dev->func_id = CISTPL_FUNCID_MEMORY; |
| @@ -628,7 +510,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
| 628 | 510 | ||
| 629 | mutex_lock(&device_add_lock); | 511 | mutex_lock(&device_add_lock); |
| 630 | 512 | ||
| 631 | ds_dbg(3, "adding device to %d, function %d\n", s->sock, function); | 513 | pr_debug("adding device to %d, function %d\n", s->sock, function); |
| 632 | 514 | ||
| 633 | /* max of 4 devices per card */ | 515 | /* max of 4 devices per card */ |
| 634 | if (s->device_count == 4) | 516 | if (s->device_count == 4) |
| @@ -654,7 +536,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
| 654 | p_dev->devname = kasprintf(GFP_KERNEL, "pcmcia%s", dev_name(&p_dev->dev)); | 536 | p_dev->devname = kasprintf(GFP_KERNEL, "pcmcia%s", dev_name(&p_dev->dev)); |
| 655 | if (!p_dev->devname) | 537 | if (!p_dev->devname) |
| 656 | goto err_free; | 538 | goto err_free; |
| 657 | ds_dev_dbg(3, &p_dev->dev, "devname is %s\n", p_dev->devname); | 539 | dev_dbg(&p_dev->dev, "devname is %s\n", p_dev->devname); |
| 658 | 540 | ||
| 659 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 541 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
| 660 | 542 | ||
| @@ -677,7 +559,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
| 677 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 559 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
| 678 | 560 | ||
| 679 | if (!p_dev->function_config) { | 561 | if (!p_dev->function_config) { |
| 680 | ds_dev_dbg(3, &p_dev->dev, "creating config_t\n"); | 562 | dev_dbg(&p_dev->dev, "creating config_t\n"); |
| 681 | p_dev->function_config = kzalloc(sizeof(struct config_t), | 563 | p_dev->function_config = kzalloc(sizeof(struct config_t), |
| 682 | GFP_KERNEL); | 564 | GFP_KERNEL); |
| 683 | if (!p_dev->function_config) | 565 | if (!p_dev->function_config) |
| @@ -722,20 +604,20 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
| 722 | int ret = 0; | 604 | int ret = 0; |
| 723 | 605 | ||
| 724 | if (!(s->resource_setup_done)) { | 606 | if (!(s->resource_setup_done)) { |
| 725 | ds_dev_dbg(3, &s->dev, | 607 | dev_dbg(&s->dev, |
| 726 | "no resources available, delaying card_add\n"); | 608 | "no resources available, delaying card_add\n"); |
| 727 | return -EAGAIN; /* try again, but later... */ | 609 | return -EAGAIN; /* try again, but later... */ |
| 728 | } | 610 | } |
| 729 | 611 | ||
| 730 | if (pcmcia_validate_mem(s)) { | 612 | if (pcmcia_validate_mem(s)) { |
| 731 | ds_dev_dbg(3, &s->dev, "validating mem resources failed, " | 613 | dev_dbg(&s->dev, "validating mem resources failed, " |
| 732 | "delaying card_add\n"); | 614 | "delaying card_add\n"); |
| 733 | return -EAGAIN; /* try again, but later... */ | 615 | return -EAGAIN; /* try again, but later... */ |
| 734 | } | 616 | } |
| 735 | 617 | ||
| 736 | ret = pccard_validate_cis(s, &no_chains); | 618 | ret = pccard_validate_cis(s, &no_chains); |
| 737 | if (ret || !no_chains) { | 619 | if (ret || !no_chains) { |
| 738 | ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n"); | 620 | dev_dbg(&s->dev, "invalid CIS or invalid resources\n"); |
| 739 | return -ENODEV; | 621 | return -ENODEV; |
| 740 | } | 622 | } |
| 741 | 623 | ||
| @@ -756,7 +638,7 @@ static void pcmcia_delayed_add_device(struct work_struct *work) | |||
| 756 | { | 638 | { |
| 757 | struct pcmcia_socket *s = | 639 | struct pcmcia_socket *s = |
| 758 | container_of(work, struct pcmcia_socket, device_add); | 640 | container_of(work, struct pcmcia_socket, device_add); |
| 759 | ds_dev_dbg(1, &s->dev, "adding additional device to %d\n", s->sock); | 641 | dev_dbg(&s->dev, "adding additional device to %d\n", s->sock); |
| 760 | pcmcia_device_add(s, s->pcmcia_state.mfc_pfc); | 642 | pcmcia_device_add(s, s->pcmcia_state.mfc_pfc); |
| 761 | s->pcmcia_state.device_add_pending = 0; | 643 | s->pcmcia_state.device_add_pending = 0; |
| 762 | s->pcmcia_state.mfc_pfc = 0; | 644 | s->pcmcia_state.mfc_pfc = 0; |
| @@ -766,7 +648,7 @@ static int pcmcia_requery(struct device *dev, void * _data) | |||
| 766 | { | 648 | { |
| 767 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 649 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
| 768 | if (!p_dev->dev.driver) { | 650 | if (!p_dev->dev.driver) { |
| 769 | ds_dev_dbg(1, dev, "update device information\n"); | 651 | dev_dbg(dev, "update device information\n"); |
| 770 | pcmcia_device_query(p_dev); | 652 | pcmcia_device_query(p_dev); |
| 771 | } | 653 | } |
| 772 | 654 | ||
| @@ -780,7 +662,7 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis) | |||
| 780 | unsigned long flags; | 662 | unsigned long flags; |
| 781 | 663 | ||
| 782 | /* must be called with skt_mutex held */ | 664 | /* must be called with skt_mutex held */ |
| 783 | ds_dev_dbg(0, &skt->dev, "re-scanning socket %d\n", skt->sock); | 665 | dev_dbg(&skt->dev, "re-scanning socket %d\n", skt->sock); |
| 784 | 666 | ||
| 785 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 667 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
| 786 | if (list_empty(&skt->devices_list)) | 668 | if (list_empty(&skt->devices_list)) |
| @@ -835,7 +717,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | |||
| 835 | if (!filename) | 717 | if (!filename) |
| 836 | return -EINVAL; | 718 | return -EINVAL; |
| 837 | 719 | ||
| 838 | ds_dev_dbg(1, &dev->dev, "trying to load CIS file %s\n", filename); | 720 | dev_dbg(&dev->dev, "trying to load CIS file %s\n", filename); |
| 839 | 721 | ||
| 840 | if (request_firmware(&fw, filename, &dev->dev) == 0) { | 722 | if (request_firmware(&fw, filename, &dev->dev) == 0) { |
| 841 | if (fw->size >= CISTPL_MAX_CIS_SIZE) { | 723 | if (fw->size >= CISTPL_MAX_CIS_SIZE) { |
| @@ -953,14 +835,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, | |||
| 953 | * after it has re-checked that there is no possible module | 835 | * after it has re-checked that there is no possible module |
| 954 | * with a prod_id/manf_id/card_id match. | 836 | * with a prod_id/manf_id/card_id match. |
| 955 | */ | 837 | */ |
| 956 | ds_dev_dbg(0, &dev->dev, | 838 | dev_dbg(&dev->dev, |
| 957 | "skipping FUNC_ID match until userspace interaction\n"); | 839 | "skipping FUNC_ID match until userspace interaction\n"); |
| 958 | if (!dev->allow_func_id_match) | 840 | if (!dev->allow_func_id_match) |
| 959 | return 0; | 841 | return 0; |
| 960 | } | 842 | } |
| 961 | 843 | ||
| 962 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { | 844 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { |
| 963 | ds_dev_dbg(0, &dev->dev, "device needs a fake CIS\n"); | 845 | dev_dbg(&dev->dev, "device needs a fake CIS\n"); |
| 964 | if (!dev->socket->fake_cis) | 846 | if (!dev->socket->fake_cis) |
| 965 | pcmcia_load_firmware(dev, did->cisfile); | 847 | pcmcia_load_firmware(dev, did->cisfile); |
| 966 | 848 | ||
| @@ -992,9 +874,9 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { | |||
| 992 | /* match dynamic devices first */ | 874 | /* match dynamic devices first */ |
| 993 | spin_lock(&p_drv->dynids.lock); | 875 | spin_lock(&p_drv->dynids.lock); |
| 994 | list_for_each_entry(dynid, &p_drv->dynids.list, node) { | 876 | list_for_each_entry(dynid, &p_drv->dynids.list, node) { |
| 995 | ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name); | 877 | dev_dbg(dev, "trying to match to %s\n", drv->name); |
| 996 | if (pcmcia_devmatch(p_dev, &dynid->id)) { | 878 | if (pcmcia_devmatch(p_dev, &dynid->id)) { |
| 997 | ds_dev_dbg(0, dev, "matched to %s\n", drv->name); | 879 | dev_dbg(dev, "matched to %s\n", drv->name); |
| 998 | spin_unlock(&p_drv->dynids.lock); | 880 | spin_unlock(&p_drv->dynids.lock); |
| 999 | return 1; | 881 | return 1; |
| 1000 | } | 882 | } |
| @@ -1004,15 +886,15 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { | |||
| 1004 | #ifdef CONFIG_PCMCIA_IOCTL | 886 | #ifdef CONFIG_PCMCIA_IOCTL |
| 1005 | /* matching by cardmgr */ | 887 | /* matching by cardmgr */ |
| 1006 | if (p_dev->cardmgr == p_drv) { | 888 | if (p_dev->cardmgr == p_drv) { |
| 1007 | ds_dev_dbg(0, dev, "cardmgr matched to %s\n", drv->name); | 889 | dev_dbg(dev, "cardmgr matched to %s\n", drv->name); |
| 1008 | return 1; | 890 | return 1; |
| 1009 | } | 891 | } |
| 1010 | #endif | 892 | #endif |
| 1011 | 893 | ||
| 1012 | while (did && did->match_flags) { | 894 | while (did && did->match_flags) { |
| 1013 | ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name); | 895 | dev_dbg(dev, "trying to match to %s\n", drv->name); |
| 1014 | if (pcmcia_devmatch(p_dev, did)) { | 896 | if (pcmcia_devmatch(p_dev, did)) { |
| 1015 | ds_dev_dbg(0, dev, "matched to %s\n", drv->name); | 897 | dev_dbg(dev, "matched to %s\n", drv->name); |
| 1016 | return 1; | 898 | return 1; |
| 1017 | } | 899 | } |
| 1018 | did++; | 900 | did++; |
| @@ -1218,7 +1100,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
| 1218 | if (p_dev->suspended) | 1100 | if (p_dev->suspended) |
| 1219 | return 0; | 1101 | return 0; |
| 1220 | 1102 | ||
| 1221 | ds_dev_dbg(2, dev, "suspending\n"); | 1103 | dev_dbg(dev, "suspending\n"); |
| 1222 | 1104 | ||
| 1223 | if (dev->driver) | 1105 | if (dev->driver) |
| 1224 | p_drv = to_pcmcia_drv(dev->driver); | 1106 | p_drv = to_pcmcia_drv(dev->driver); |
| @@ -1238,7 +1120,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
| 1238 | } | 1120 | } |
| 1239 | 1121 | ||
| 1240 | if (p_dev->device_no == p_dev->func) { | 1122 | if (p_dev->device_no == p_dev->func) { |
| 1241 | ds_dev_dbg(2, dev, "releasing configuration\n"); | 1123 | dev_dbg(dev, "releasing configuration\n"); |
| 1242 | pcmcia_release_configuration(p_dev); | 1124 | pcmcia_release_configuration(p_dev); |
| 1243 | } | 1125 | } |
| 1244 | 1126 | ||
| @@ -1258,7 +1140,7 @@ static int pcmcia_dev_resume(struct device * dev) | |||
| 1258 | if (!p_dev->suspended) | 1140 | if (!p_dev->suspended) |
| 1259 | return 0; | 1141 | return 0; |
| 1260 | 1142 | ||
| 1261 | ds_dev_dbg(2, dev, "resuming\n"); | 1143 | dev_dbg(dev, "resuming\n"); |
| 1262 | 1144 | ||
| 1263 | if (dev->driver) | 1145 | if (dev->driver) |
| 1264 | p_drv = to_pcmcia_drv(dev->driver); | 1146 | p_drv = to_pcmcia_drv(dev->driver); |
| @@ -1267,7 +1149,7 @@ static int pcmcia_dev_resume(struct device * dev) | |||
| 1267 | goto out; | 1149 | goto out; |
| 1268 | 1150 | ||
| 1269 | if (p_dev->device_no == p_dev->func) { | 1151 | if (p_dev->device_no == p_dev->func) { |
| 1270 | ds_dev_dbg(2, dev, "requesting configuration\n"); | 1152 | dev_dbg(dev, "requesting configuration\n"); |
| 1271 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); | 1153 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); |
| 1272 | if (ret) | 1154 | if (ret) |
| 1273 | goto out; | 1155 | goto out; |
| @@ -1309,14 +1191,14 @@ static int pcmcia_bus_resume_callback(struct device *dev, void * _data) | |||
| 1309 | 1191 | ||
| 1310 | static int pcmcia_bus_resume(struct pcmcia_socket *skt) | 1192 | static int pcmcia_bus_resume(struct pcmcia_socket *skt) |
| 1311 | { | 1193 | { |
| 1312 | ds_dev_dbg(2, &skt->dev, "resuming socket %d\n", skt->sock); | 1194 | dev_dbg(&skt->dev, "resuming socket %d\n", skt->sock); |
| 1313 | bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); | 1195 | bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); |
| 1314 | return 0; | 1196 | return 0; |
| 1315 | } | 1197 | } |
| 1316 | 1198 | ||
| 1317 | static int pcmcia_bus_suspend(struct pcmcia_socket *skt) | 1199 | static int pcmcia_bus_suspend(struct pcmcia_socket *skt) |
| 1318 | { | 1200 | { |
| 1319 | ds_dev_dbg(2, &skt->dev, "suspending socket %d\n", skt->sock); | 1201 | dev_dbg(&skt->dev, "suspending socket %d\n", skt->sock); |
| 1320 | if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, | 1202 | if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, |
| 1321 | pcmcia_bus_suspend_callback)) { | 1203 | pcmcia_bus_suspend_callback)) { |
| 1322 | pcmcia_bus_resume(skt); | 1204 | pcmcia_bus_resume(skt); |
| @@ -1348,7 +1230,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
| 1348 | return -ENODEV; | 1230 | return -ENODEV; |
| 1349 | } | 1231 | } |
| 1350 | 1232 | ||
| 1351 | ds_dev_dbg(1, &skt->dev, "ds_event(0x%06x, %d, 0x%p)\n", | 1233 | dev_dbg(&skt->dev, "ds_event(0x%06x, %d, 0x%p)\n", |
| 1352 | event, priority, skt); | 1234 | event, priority, skt); |
| 1353 | 1235 | ||
| 1354 | switch (event) { | 1236 | switch (event) { |
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index a4aacb830b80..c13fd9360511 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c | |||
| @@ -63,21 +63,6 @@ | |||
| 63 | #include "vg468.h" | 63 | #include "vg468.h" |
| 64 | #include "ricoh.h" | 64 | #include "ricoh.h" |
| 65 | 65 | ||
| 66 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 67 | static const char version[] = | ||
| 68 | "i82365.c 1.265 1999/11/10 18:36:21 (David Hinds)"; | ||
| 69 | |||
| 70 | static int pc_debug; | ||
| 71 | |||
| 72 | module_param(pc_debug, int, 0644); | ||
| 73 | |||
| 74 | #define debug(lvl, fmt, arg...) do { \ | ||
| 75 | if (pc_debug > (lvl)) \ | ||
| 76 | printk(KERN_DEBUG "i82365: " fmt , ## arg); \ | ||
| 77 | } while (0) | ||
| 78 | #else | ||
| 79 | #define debug(lvl, fmt, arg...) do { } while (0) | ||
| 80 | #endif | ||
| 81 | 66 | ||
| 82 | static irqreturn_t i365_count_irq(int, void *); | 67 | static irqreturn_t i365_count_irq(int, void *); |
| 83 | static inline int _check_irq(int irq, int flags) | 68 | static inline int _check_irq(int irq, int flags) |
| @@ -501,13 +486,13 @@ static irqreturn_t i365_count_irq(int irq, void *dev) | |||
| 501 | { | 486 | { |
| 502 | i365_get(irq_sock, I365_CSC); | 487 | i365_get(irq_sock, I365_CSC); |
| 503 | irq_hits++; | 488 | irq_hits++; |
| 504 | debug(2, "-> hit on irq %d\n", irq); | 489 | pr_debug("i82365: -> hit on irq %d\n", irq); |
| 505 | return IRQ_HANDLED; | 490 | return IRQ_HANDLED; |
| 506 | } | 491 | } |
| 507 | 492 | ||
| 508 | static u_int __init test_irq(u_short sock, int irq) | 493 | static u_int __init test_irq(u_short sock, int irq) |
| 509 | { | 494 | { |
| 510 | debug(2, " testing ISA irq %d\n", irq); | 495 | pr_debug("i82365: testing ISA irq %d\n", irq); |
| 511 | if (request_irq(irq, i365_count_irq, IRQF_PROBE_SHARED, "scan", | 496 | if (request_irq(irq, i365_count_irq, IRQF_PROBE_SHARED, "scan", |
| 512 | i365_count_irq) != 0) | 497 | i365_count_irq) != 0) |
| 513 | return 1; | 498 | return 1; |
| @@ -515,7 +500,7 @@ static u_int __init test_irq(u_short sock, int irq) | |||
| 515 | msleep(10); | 500 | msleep(10); |
| 516 | if (irq_hits) { | 501 | if (irq_hits) { |
| 517 | free_irq(irq, i365_count_irq); | 502 | free_irq(irq, i365_count_irq); |
| 518 | debug(2, " spurious hit!\n"); | 503 | pr_debug("i82365: spurious hit!\n"); |
| 519 | return 1; | 504 | return 1; |
| 520 | } | 505 | } |
| 521 | 506 | ||
| @@ -528,7 +513,7 @@ static u_int __init test_irq(u_short sock, int irq) | |||
| 528 | 513 | ||
| 529 | /* mask all interrupts */ | 514 | /* mask all interrupts */ |
| 530 | i365_set(sock, I365_CSCINT, 0); | 515 | i365_set(sock, I365_CSCINT, 0); |
| 531 | debug(2, " hits = %d\n", irq_hits); | 516 | pr_debug("i82365: hits = %d\n", irq_hits); |
| 532 | 517 | ||
| 533 | return (irq_hits != 1); | 518 | return (irq_hits != 1); |
| 534 | } | 519 | } |
| @@ -854,7 +839,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev) | |||
| 854 | u_long flags = 0; | 839 | u_long flags = 0; |
| 855 | int handled = 0; | 840 | int handled = 0; |
| 856 | 841 | ||
| 857 | debug(4, "pcic_interrupt(%d)\n", irq); | 842 | pr_debug("pcic_interrupt(%d)\n", irq); |
| 858 | 843 | ||
| 859 | for (j = 0; j < 20; j++) { | 844 | for (j = 0; j < 20; j++) { |
| 860 | active = 0; | 845 | active = 0; |
| @@ -878,7 +863,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev) | |||
| 878 | events |= (csc & I365_CSC_READY) ? SS_READY : 0; | 863 | events |= (csc & I365_CSC_READY) ? SS_READY : 0; |
| 879 | } | 864 | } |
| 880 | ISA_UNLOCK(i, flags); | 865 | ISA_UNLOCK(i, flags); |
| 881 | debug(2, "socket %d event 0x%02x\n", i, events); | 866 | pr_debug("socket %d event 0x%02x\n", i, events); |
| 882 | 867 | ||
| 883 | if (events) | 868 | if (events) |
| 884 | pcmcia_parse_events(&socket[i].socket, events); | 869 | pcmcia_parse_events(&socket[i].socket, events); |
| @@ -890,7 +875,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev) | |||
| 890 | if (j == 20) | 875 | if (j == 20) |
| 891 | printk(KERN_NOTICE "i82365: infinite loop in interrupt handler\n"); | 876 | printk(KERN_NOTICE "i82365: infinite loop in interrupt handler\n"); |
| 892 | 877 | ||
| 893 | debug(4, "interrupt done\n"); | 878 | pr_debug("pcic_interrupt done\n"); |
| 894 | return IRQ_RETVAL(handled); | 879 | return IRQ_RETVAL(handled); |
| 895 | } /* pcic_interrupt */ | 880 | } /* pcic_interrupt */ |
| 896 | 881 | ||
| @@ -932,7 +917,7 @@ static int i365_get_status(u_short sock, u_int *value) | |||
| 932 | } | 917 | } |
| 933 | } | 918 | } |
| 934 | 919 | ||
| 935 | debug(1, "GetStatus(%d) = %#4.4x\n", sock, *value); | 920 | pr_debug("GetStatus(%d) = %#4.4x\n", sock, *value); |
| 936 | return 0; | 921 | return 0; |
| 937 | } /* i365_get_status */ | 922 | } /* i365_get_status */ |
| 938 | 923 | ||
| @@ -943,7 +928,7 @@ static int i365_set_socket(u_short sock, socket_state_t *state) | |||
| 943 | struct i82365_socket *t = &socket[sock]; | 928 | struct i82365_socket *t = &socket[sock]; |
| 944 | u_char reg; | 929 | u_char reg; |
| 945 | 930 | ||
| 946 | debug(1, "SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " | 931 | pr_debug("SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " |
| 947 | "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, | 932 | "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, |
| 948 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | 933 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); |
| 949 | 934 | ||
| @@ -1052,7 +1037,7 @@ static int i365_set_io_map(u_short sock, struct pccard_io_map *io) | |||
| 1052 | { | 1037 | { |
| 1053 | u_char map, ioctl; | 1038 | u_char map, ioctl; |
| 1054 | 1039 | ||
| 1055 | debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " | 1040 | pr_debug("SetIOMap(%d, %d, %#2.2x, %d ns, " |
| 1056 | "%#llx-%#llx)\n", sock, io->map, io->flags, io->speed, | 1041 | "%#llx-%#llx)\n", sock, io->map, io->flags, io->speed, |
| 1057 | (unsigned long long)io->start, (unsigned long long)io->stop); | 1042 | (unsigned long long)io->start, (unsigned long long)io->stop); |
| 1058 | map = io->map; | 1043 | map = io->map; |
| @@ -1082,7 +1067,7 @@ static int i365_set_mem_map(u_short sock, struct pccard_mem_map *mem) | |||
| 1082 | u_short base, i; | 1067 | u_short base, i; |
| 1083 | u_char map; | 1068 | u_char map; |
| 1084 | 1069 | ||
| 1085 | debug(1, "SetMemMap(%d, %d, %#2.2x, %d ns, %#llx-%#llx, " | 1070 | pr_debug("SetMemMap(%d, %d, %#2.2x, %d ns, %#llx-%#llx, " |
| 1086 | "%#x)\n", sock, mem->map, mem->flags, mem->speed, | 1071 | "%#x)\n", sock, mem->map, mem->flags, mem->speed, |
| 1087 | (unsigned long long)mem->res->start, | 1072 | (unsigned long long)mem->res->start, |
| 1088 | (unsigned long long)mem->res->end, mem->card_start); | 1073 | (unsigned long long)mem->res->end, mem->card_start); |
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 7dfbee1dcd76..26a621c9e2fc 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c | |||
| @@ -38,17 +38,6 @@ | |||
| 38 | 38 | ||
| 39 | #include "m32r_cfc.h" | 39 | #include "m32r_cfc.h" |
| 40 | 40 | ||
| 41 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 42 | static int m32r_cfc_debug; | ||
| 43 | module_param(m32r_cfc_debug, int, 0644); | ||
| 44 | #define debug(lvl, fmt, arg...) do { \ | ||
| 45 | if (m32r_cfc_debug > (lvl)) \ | ||
| 46 | printk(KERN_DEBUG "m32r_cfc: " fmt , ## arg); \ | ||
| 47 | } while (0) | ||
| 48 | #else | ||
| 49 | #define debug(n, args...) do { } while (0) | ||
| 50 | #endif | ||
| 51 | |||
| 52 | /* Poll status interval -- 0 means default to interrupt */ | 41 | /* Poll status interval -- 0 means default to interrupt */ |
| 53 | static int poll_interval = 0; | 42 | static int poll_interval = 0; |
| 54 | 43 | ||
| @@ -123,7 +112,7 @@ void pcc_ioread_byte(int sock, unsigned long port, void *buf, size_t size, | |||
| 123 | unsigned char *bp = (unsigned char *)buf; | 112 | unsigned char *bp = (unsigned char *)buf; |
| 124 | unsigned long flags; | 113 | unsigned long flags; |
| 125 | 114 | ||
| 126 | debug(3, "m32r_cfc: pcc_ioread_byte: sock=%d, port=%#lx, buf=%p, " | 115 | pr_debug("m32r_cfc: pcc_ioread_byte: sock=%d, port=%#lx, buf=%p, " |
| 127 | "size=%u, nmemb=%d, flag=%d\n", | 116 | "size=%u, nmemb=%d, flag=%d\n", |
| 128 | sock, port, buf, size, nmemb, flag); | 117 | sock, port, buf, size, nmemb, flag); |
| 129 | 118 | ||
| @@ -132,7 +121,7 @@ void pcc_ioread_byte(int sock, unsigned long port, void *buf, size_t size, | |||
| 132 | printk("m32r_cfc:ioread_byte null port :%#lx\n",port); | 121 | printk("m32r_cfc:ioread_byte null port :%#lx\n",port); |
| 133 | return; | 122 | return; |
| 134 | } | 123 | } |
| 135 | debug(3, "m32r_cfc: pcc_ioread_byte: addr=%#lx\n", addr); | 124 | pr_debug("m32r_cfc: pcc_ioread_byte: addr=%#lx\n", addr); |
| 136 | 125 | ||
| 137 | spin_lock_irqsave(&pcc_lock, flags); | 126 | spin_lock_irqsave(&pcc_lock, flags); |
| 138 | /* read Byte */ | 127 | /* read Byte */ |
| @@ -148,7 +137,7 @@ void pcc_ioread_word(int sock, unsigned long port, void *buf, size_t size, | |||
| 148 | unsigned short *bp = (unsigned short *)buf; | 137 | unsigned short *bp = (unsigned short *)buf; |
| 149 | unsigned long flags; | 138 | unsigned long flags; |
| 150 | 139 | ||
| 151 | debug(3, "m32r_cfc: pcc_ioread_word: sock=%d, port=%#lx, " | 140 | pr_debug("m32r_cfc: pcc_ioread_word: sock=%d, port=%#lx, " |
| 152 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", | 141 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", |
| 153 | sock, port, buf, size, nmemb, flag); | 142 | sock, port, buf, size, nmemb, flag); |
| 154 | 143 | ||
| @@ -163,7 +152,7 @@ void pcc_ioread_word(int sock, unsigned long port, void *buf, size_t size, | |||
| 163 | printk("m32r_cfc:ioread_word null port :%#lx\n",port); | 152 | printk("m32r_cfc:ioread_word null port :%#lx\n",port); |
| 164 | return; | 153 | return; |
| 165 | } | 154 | } |
| 166 | debug(3, "m32r_cfc: pcc_ioread_word: addr=%#lx\n", addr); | 155 | pr_debug("m32r_cfc: pcc_ioread_word: addr=%#lx\n", addr); |
| 167 | 156 | ||
| 168 | spin_lock_irqsave(&pcc_lock, flags); | 157 | spin_lock_irqsave(&pcc_lock, flags); |
| 169 | /* read Word */ | 158 | /* read Word */ |
| @@ -179,7 +168,7 @@ void pcc_iowrite_byte(int sock, unsigned long port, void *buf, size_t size, | |||
| 179 | unsigned char *bp = (unsigned char *)buf; | 168 | unsigned char *bp = (unsigned char *)buf; |
| 180 | unsigned long flags; | 169 | unsigned long flags; |
| 181 | 170 | ||
| 182 | debug(3, "m32r_cfc: pcc_iowrite_byte: sock=%d, port=%#lx, " | 171 | pr_debug("m32r_cfc: pcc_iowrite_byte: sock=%d, port=%#lx, " |
| 183 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", | 172 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", |
| 184 | sock, port, buf, size, nmemb, flag); | 173 | sock, port, buf, size, nmemb, flag); |
| 185 | 174 | ||
| @@ -189,7 +178,7 @@ void pcc_iowrite_byte(int sock, unsigned long port, void *buf, size_t size, | |||
| 189 | printk("m32r_cfc:iowrite_byte null port:%#lx\n",port); | 178 | printk("m32r_cfc:iowrite_byte null port:%#lx\n",port); |
| 190 | return; | 179 | return; |
| 191 | } | 180 | } |
| 192 | debug(3, "m32r_cfc: pcc_iowrite_byte: addr=%#lx\n", addr); | 181 | pr_debug("m32r_cfc: pcc_iowrite_byte: addr=%#lx\n", addr); |
| 193 | 182 | ||
| 194 | spin_lock_irqsave(&pcc_lock, flags); | 183 | spin_lock_irqsave(&pcc_lock, flags); |
| 195 | while (nmemb--) | 184 | while (nmemb--) |
| @@ -204,7 +193,7 @@ void pcc_iowrite_word(int sock, unsigned long port, void *buf, size_t size, | |||
| 204 | unsigned short *bp = (unsigned short *)buf; | 193 | unsigned short *bp = (unsigned short *)buf; |
| 205 | unsigned long flags; | 194 | unsigned long flags; |
| 206 | 195 | ||
| 207 | debug(3, "m32r_cfc: pcc_iowrite_word: sock=%d, port=%#lx, " | 196 | pr_debug("m32r_cfc: pcc_iowrite_word: sock=%d, port=%#lx, " |
| 208 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", | 197 | "buf=%p, size=%u, nmemb=%d, flag=%d\n", |
| 209 | sock, port, buf, size, nmemb, flag); | 198 | sock, port, buf, size, nmemb, flag); |
| 210 | 199 | ||
| @@ -226,7 +215,7 @@ void pcc_iowrite_word(int sock, unsigned long port, void *buf, size_t size, | |||
| 226 | return; | 215 | return; |
| 227 | } | 216 | } |
| 228 | #endif | 217 | #endif |
| 229 | debug(3, "m32r_cfc: pcc_iowrite_word: addr=%#lx\n", addr); | 218 | pr_debug("m32r_cfc: pcc_iowrite_word: addr=%#lx\n", addr); |
| 230 | 219 | ||
| 231 | spin_lock_irqsave(&pcc_lock, flags); | 220 | spin_lock_irqsave(&pcc_lock, flags); |
| 232 | while (nmemb--) | 221 | while (nmemb--) |
| @@ -262,7 +251,7 @@ static struct timer_list poll_timer; | |||
| 262 | static unsigned int pcc_get(u_short sock, unsigned int reg) | 251 | static unsigned int pcc_get(u_short sock, unsigned int reg) |
| 263 | { | 252 | { |
| 264 | unsigned int val = inw(reg); | 253 | unsigned int val = inw(reg); |
| 265 | debug(3, "m32r_cfc: pcc_get: reg(0x%08x)=0x%04x\n", reg, val); | 254 | pr_debug("m32r_cfc: pcc_get: reg(0x%08x)=0x%04x\n", reg, val); |
| 266 | return val; | 255 | return val; |
| 267 | } | 256 | } |
| 268 | 257 | ||
| @@ -270,7 +259,7 @@ static unsigned int pcc_get(u_short sock, unsigned int reg) | |||
| 270 | static void pcc_set(u_short sock, unsigned int reg, unsigned int data) | 259 | static void pcc_set(u_short sock, unsigned int reg, unsigned int data) |
| 271 | { | 260 | { |
| 272 | outw(data, reg); | 261 | outw(data, reg); |
| 273 | debug(3, "m32r_cfc: pcc_set: reg(0x%08x)=0x%04x\n", reg, data); | 262 | pr_debug("m32r_cfc: pcc_set: reg(0x%08x)=0x%04x\n", reg, data); |
| 274 | } | 263 | } |
| 275 | 264 | ||
| 276 | /*====================================================================== | 265 | /*====================================================================== |
| @@ -286,14 +275,14 @@ static int __init is_alive(u_short sock) | |||
| 286 | { | 275 | { |
| 287 | unsigned int stat; | 276 | unsigned int stat; |
| 288 | 277 | ||
| 289 | debug(3, "m32r_cfc: is_alive:\n"); | 278 | pr_debug("m32r_cfc: is_alive:\n"); |
| 290 | 279 | ||
| 291 | printk("CF: "); | 280 | printk("CF: "); |
| 292 | stat = pcc_get(sock, (unsigned int)PLD_CFSTS); | 281 | stat = pcc_get(sock, (unsigned int)PLD_CFSTS); |
| 293 | if (!stat) | 282 | if (!stat) |
| 294 | printk("No "); | 283 | printk("No "); |
| 295 | printk("Card is detected at socket %d : stat = 0x%08x\n", sock, stat); | 284 | printk("Card is detected at socket %d : stat = 0x%08x\n", sock, stat); |
| 296 | debug(3, "m32r_cfc: is_alive: sock stat is 0x%04x\n", stat); | 285 | pr_debug("m32r_cfc: is_alive: sock stat is 0x%04x\n", stat); |
| 297 | 286 | ||
| 298 | return 0; | 287 | return 0; |
| 299 | } | 288 | } |
| @@ -303,7 +292,7 @@ static void add_pcc_socket(ulong base, int irq, ulong mapaddr, | |||
| 303 | { | 292 | { |
| 304 | pcc_socket_t *t = &socket[pcc_sockets]; | 293 | pcc_socket_t *t = &socket[pcc_sockets]; |
| 305 | 294 | ||
| 306 | debug(3, "m32r_cfc: add_pcc_socket: base=%#lx, irq=%d, " | 295 | pr_debug("m32r_cfc: add_pcc_socket: base=%#lx, irq=%d, " |
| 307 | "mapaddr=%#lx, ioaddr=%08x\n", | 296 | "mapaddr=%#lx, ioaddr=%08x\n", |
| 308 | base, irq, mapaddr, ioaddr); | 297 | base, irq, mapaddr, ioaddr); |
| 309 | 298 | ||
| @@ -358,7 +347,7 @@ static void add_pcc_socket(ulong base, int irq, ulong mapaddr, | |||
| 358 | /* eject interrupt */ | 347 | /* eject interrupt */ |
| 359 | request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); | 348 | request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); |
| 360 | #endif | 349 | #endif |
| 361 | debug(3, "m32r_cfc: enable CFMSK, RDYSEL\n"); | 350 | pr_debug("m32r_cfc: enable CFMSK, RDYSEL\n"); |
| 362 | pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01); | 351 | pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01); |
| 363 | #endif /* CONFIG_PLAT_USRV */ | 352 | #endif /* CONFIG_PLAT_USRV */ |
| 364 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) | 353 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) |
| @@ -378,26 +367,26 @@ static irqreturn_t pcc_interrupt(int irq, void *dev) | |||
| 378 | u_int events = 0; | 367 | u_int events = 0; |
| 379 | int handled = 0; | 368 | int handled = 0; |
| 380 | 369 | ||
| 381 | debug(3, "m32r_cfc: pcc_interrupt: irq=%d, dev=%p\n", irq, dev); | 370 | pr_debug("m32r_cfc: pcc_interrupt: irq=%d, dev=%p\n", irq, dev); |
| 382 | for (i = 0; i < pcc_sockets; i++) { | 371 | for (i = 0; i < pcc_sockets; i++) { |
| 383 | if (socket[i].cs_irq1 != irq && socket[i].cs_irq2 != irq) | 372 | if (socket[i].cs_irq1 != irq && socket[i].cs_irq2 != irq) |
| 384 | continue; | 373 | continue; |
| 385 | 374 | ||
| 386 | handled = 1; | 375 | handled = 1; |
| 387 | debug(3, "m32r_cfc: pcc_interrupt: socket %d irq 0x%02x ", | 376 | pr_debug("m32r_cfc: pcc_interrupt: socket %d irq 0x%02x ", |
| 388 | i, irq); | 377 | i, irq); |
| 389 | events |= SS_DETECT; /* insert or eject */ | 378 | events |= SS_DETECT; /* insert or eject */ |
| 390 | if (events) | 379 | if (events) |
| 391 | pcmcia_parse_events(&socket[i].socket, events); | 380 | pcmcia_parse_events(&socket[i].socket, events); |
| 392 | } | 381 | } |
| 393 | debug(3, "m32r_cfc: pcc_interrupt: done\n"); | 382 | pr_debug("m32r_cfc: pcc_interrupt: done\n"); |
| 394 | 383 | ||
| 395 | return IRQ_RETVAL(handled); | 384 | return IRQ_RETVAL(handled); |
| 396 | } /* pcc_interrupt */ | 385 | } /* pcc_interrupt */ |
| 397 | 386 | ||
| 398 | static void pcc_interrupt_wrapper(u_long data) | 387 | static void pcc_interrupt_wrapper(u_long data) |
| 399 | { | 388 | { |
| 400 | debug(3, "m32r_cfc: pcc_interrupt_wrapper:\n"); | 389 | pr_debug("m32r_cfc: pcc_interrupt_wrapper:\n"); |
| 401 | pcc_interrupt(0, NULL); | 390 | pcc_interrupt(0, NULL); |
| 402 | init_timer(&poll_timer); | 391 | init_timer(&poll_timer); |
| 403 | poll_timer.expires = jiffies + poll_interval; | 392 | poll_timer.expires = jiffies + poll_interval; |
| @@ -410,17 +399,17 @@ static int _pcc_get_status(u_short sock, u_int *value) | |||
| 410 | { | 399 | { |
| 411 | u_int status; | 400 | u_int status; |
| 412 | 401 | ||
| 413 | debug(3, "m32r_cfc: _pcc_get_status:\n"); | 402 | pr_debug("m32r_cfc: _pcc_get_status:\n"); |
| 414 | status = pcc_get(sock, (unsigned int)PLD_CFSTS); | 403 | status = pcc_get(sock, (unsigned int)PLD_CFSTS); |
| 415 | *value = (status) ? SS_DETECT : 0; | 404 | *value = (status) ? SS_DETECT : 0; |
| 416 | debug(3, "m32r_cfc: _pcc_get_status: status=0x%08x\n", status); | 405 | pr_debug("m32r_cfc: _pcc_get_status: status=0x%08x\n", status); |
| 417 | 406 | ||
| 418 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) | 407 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) |
| 419 | if ( status ) { | 408 | if ( status ) { |
| 420 | /* enable CF power */ | 409 | /* enable CF power */ |
| 421 | status = inw((unsigned int)PLD_CPCR); | 410 | status = inw((unsigned int)PLD_CPCR); |
| 422 | if (!(status & PLD_CPCR_CF)) { | 411 | if (!(status & PLD_CPCR_CF)) { |
| 423 | debug(3, "m32r_cfc: _pcc_get_status: " | 412 | pr_debug("m32r_cfc: _pcc_get_status: " |
| 424 | "power on (CPCR=0x%08x)\n", status); | 413 | "power on (CPCR=0x%08x)\n", status); |
| 425 | status |= PLD_CPCR_CF; | 414 | status |= PLD_CPCR_CF; |
| 426 | outw(status, (unsigned int)PLD_CPCR); | 415 | outw(status, (unsigned int)PLD_CPCR); |
| @@ -439,7 +428,7 @@ static int _pcc_get_status(u_short sock, u_int *value) | |||
| 439 | status &= ~PLD_CPCR_CF; | 428 | status &= ~PLD_CPCR_CF; |
| 440 | outw(status, (unsigned int)PLD_CPCR); | 429 | outw(status, (unsigned int)PLD_CPCR); |
| 441 | udelay(100); | 430 | udelay(100); |
| 442 | debug(3, "m32r_cfc: _pcc_get_status: " | 431 | pr_debug("m32r_cfc: _pcc_get_status: " |
| 443 | "power off (CPCR=0x%08x)\n", status); | 432 | "power off (CPCR=0x%08x)\n", status); |
| 444 | } | 433 | } |
| 445 | #elif defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3) | 434 | #elif defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3) |
| @@ -465,13 +454,13 @@ static int _pcc_get_status(u_short sock, u_int *value) | |||
| 465 | /* disable CF power */ | 454 | /* disable CF power */ |
| 466 | pcc_set(sock, (unsigned int)PLD_CPCR, 0); | 455 | pcc_set(sock, (unsigned int)PLD_CPCR, 0); |
| 467 | udelay(100); | 456 | udelay(100); |
| 468 | debug(3, "m32r_cfc: _pcc_get_status: " | 457 | pr_debug("m32r_cfc: _pcc_get_status: " |
| 469 | "power off (CPCR=0x%08x)\n", status); | 458 | "power off (CPCR=0x%08x)\n", status); |
| 470 | } | 459 | } |
| 471 | #else | 460 | #else |
| 472 | #error no platform configuration | 461 | #error no platform configuration |
| 473 | #endif | 462 | #endif |
| 474 | debug(3, "m32r_cfc: _pcc_get_status: GetStatus(%d) = %#4.4x\n", | 463 | pr_debug("m32r_cfc: _pcc_get_status: GetStatus(%d) = %#4.4x\n", |
| 475 | sock, *value); | 464 | sock, *value); |
| 476 | return 0; | 465 | return 0; |
| 477 | } /* _get_status */ | 466 | } /* _get_status */ |
| @@ -480,7 +469,7 @@ static int _pcc_get_status(u_short sock, u_int *value) | |||
| 480 | 469 | ||
| 481 | static int _pcc_set_socket(u_short sock, socket_state_t *state) | 470 | static int _pcc_set_socket(u_short sock, socket_state_t *state) |
| 482 | { | 471 | { |
| 483 | debug(3, "m32r_cfc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " | 472 | pr_debug("m32r_cfc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " |
| 484 | "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, | 473 | "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, |
| 485 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | 474 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); |
| 486 | 475 | ||
| @@ -492,41 +481,39 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state) | |||
| 492 | } | 481 | } |
| 493 | #endif | 482 | #endif |
| 494 | if (state->flags & SS_RESET) { | 483 | if (state->flags & SS_RESET) { |
| 495 | debug(3, ":RESET\n"); | 484 | pr_debug(":RESET\n"); |
| 496 | pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x101); | 485 | pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x101); |
| 497 | }else{ | 486 | }else{ |
| 498 | pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x100); | 487 | pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x100); |
| 499 | } | 488 | } |
| 500 | if (state->flags & SS_OUTPUT_ENA){ | 489 | if (state->flags & SS_OUTPUT_ENA){ |
| 501 | debug(3, ":OUTPUT_ENA\n"); | 490 | pr_debug(":OUTPUT_ENA\n"); |
| 502 | /* bit clear */ | 491 | /* bit clear */ |
| 503 | pcc_set(sock,(unsigned int)PLD_CFBUFCR,0); | 492 | pcc_set(sock,(unsigned int)PLD_CFBUFCR,0); |
| 504 | } else { | 493 | } else { |
| 505 | pcc_set(sock,(unsigned int)PLD_CFBUFCR,1); | 494 | pcc_set(sock,(unsigned int)PLD_CFBUFCR,1); |
| 506 | } | 495 | } |
| 507 | 496 | ||
| 508 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 509 | if(state->flags & SS_IOCARD){ | 497 | if(state->flags & SS_IOCARD){ |
| 510 | debug(3, ":IOCARD"); | 498 | pr_debug(":IOCARD"); |
| 511 | } | 499 | } |
| 512 | if (state->flags & SS_PWR_AUTO) { | 500 | if (state->flags & SS_PWR_AUTO) { |
| 513 | debug(3, ":PWR_AUTO"); | 501 | pr_debug(":PWR_AUTO"); |
| 514 | } | 502 | } |
| 515 | if (state->csc_mask & SS_DETECT) | 503 | if (state->csc_mask & SS_DETECT) |
| 516 | debug(3, ":csc-SS_DETECT"); | 504 | pr_debug(":csc-SS_DETECT"); |
| 517 | if (state->flags & SS_IOCARD) { | 505 | if (state->flags & SS_IOCARD) { |
| 518 | if (state->csc_mask & SS_STSCHG) | 506 | if (state->csc_mask & SS_STSCHG) |
| 519 | debug(3, ":STSCHG"); | 507 | pr_debug(":STSCHG"); |
| 520 | } else { | 508 | } else { |
| 521 | if (state->csc_mask & SS_BATDEAD) | 509 | if (state->csc_mask & SS_BATDEAD) |
| 522 | debug(3, ":BATDEAD"); | 510 | pr_debug(":BATDEAD"); |
| 523 | if (state->csc_mask & SS_BATWARN) | 511 | if (state->csc_mask & SS_BATWARN) |
| 524 | debug(3, ":BATWARN"); | 512 | pr_debug(":BATWARN"); |
| 525 | if (state->csc_mask & SS_READY) | 513 | if (state->csc_mask & SS_READY) |
| 526 | debug(3, ":READY"); | 514 | pr_debug(":READY"); |
| 527 | } | 515 | } |
| 528 | debug(3, "\n"); | 516 | pr_debug("\n"); |
| 529 | #endif | ||
| 530 | return 0; | 517 | return 0; |
| 531 | } /* _set_socket */ | 518 | } /* _set_socket */ |
| 532 | 519 | ||
| @@ -536,7 +523,7 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) | |||
| 536 | { | 523 | { |
| 537 | u_char map; | 524 | u_char map; |
| 538 | 525 | ||
| 539 | debug(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, " | 526 | pr_debug("m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, " |
| 540 | "%#llx-%#llx)\n", sock, io->map, io->flags, | 527 | "%#llx-%#llx)\n", sock, io->map, io->flags, |
| 541 | io->speed, (unsigned long long)io->start, | 528 | io->speed, (unsigned long long)io->start, |
| 542 | (unsigned long long)io->stop); | 529 | (unsigned long long)io->stop); |
| @@ -554,7 +541,7 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) | |||
| 554 | u_long addr; | 541 | u_long addr; |
| 555 | pcc_socket_t *t = &socket[sock]; | 542 | pcc_socket_t *t = &socket[sock]; |
| 556 | 543 | ||
| 557 | debug(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, " | 544 | pr_debug("m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, " |
| 558 | "%#llx, %#x)\n", sock, map, mem->flags, | 545 | "%#llx, %#x)\n", sock, map, mem->flags, |
| 559 | mem->speed, (unsigned long long)mem->static_start, | 546 | mem->speed, (unsigned long long)mem->static_start, |
| 560 | mem->card_start); | 547 | mem->card_start); |
| @@ -640,11 +627,11 @@ static int pcc_get_status(struct pcmcia_socket *s, u_int *value) | |||
| 640 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; | 627 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; |
| 641 | 628 | ||
| 642 | if (socket[sock].flags & IS_ALIVE) { | 629 | if (socket[sock].flags & IS_ALIVE) { |
| 643 | debug(3, "m32r_cfc: pcc_get_status: sock(%d) -EINVAL\n", sock); | 630 | dev_dbg(&s->dev, "pcc_get_status: sock(%d) -EINVAL\n", sock); |
| 644 | *value = 0; | 631 | *value = 0; |
| 645 | return -EINVAL; | 632 | return -EINVAL; |
| 646 | } | 633 | } |
| 647 | debug(3, "m32r_cfc: pcc_get_status: sock(%d)\n", sock); | 634 | dev_dbg(&s->dev, "pcc_get_status: sock(%d)\n", sock); |
| 648 | LOCKED(_pcc_get_status(sock, value)); | 635 | LOCKED(_pcc_get_status(sock, value)); |
| 649 | } | 636 | } |
| 650 | 637 | ||
| @@ -653,10 +640,10 @@ static int pcc_set_socket(struct pcmcia_socket *s, socket_state_t *state) | |||
| 653 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; | 640 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; |
| 654 | 641 | ||
| 655 | if (socket[sock].flags & IS_ALIVE) { | 642 | if (socket[sock].flags & IS_ALIVE) { |
| 656 | debug(3, "m32r_cfc: pcc_set_socket: sock(%d) -EINVAL\n", sock); | 643 | dev_dbg(&s->dev, "pcc_set_socket: sock(%d) -EINVAL\n", sock); |
| 657 | return -EINVAL; | 644 | return -EINVAL; |
| 658 | } | 645 | } |
| 659 | debug(3, "m32r_cfc: pcc_set_socket: sock(%d)\n", sock); | 646 | dev_dbg(&s->dev, "pcc_set_socket: sock(%d)\n", sock); |
| 660 | LOCKED(_pcc_set_socket(sock, state)); | 647 | LOCKED(_pcc_set_socket(sock, state)); |
| 661 | } | 648 | } |
| 662 | 649 | ||
| @@ -665,10 +652,10 @@ static int pcc_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) | |||
| 665 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; | 652 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; |
| 666 | 653 | ||
| 667 | if (socket[sock].flags & IS_ALIVE) { | 654 | if (socket[sock].flags & IS_ALIVE) { |
| 668 | debug(3, "m32r_cfc: pcc_set_io_map: sock(%d) -EINVAL\n", sock); | 655 | dev_dbg(&s->dev, "pcc_set_io_map: sock(%d) -EINVAL\n", sock); |
| 669 | return -EINVAL; | 656 | return -EINVAL; |
| 670 | } | 657 | } |
| 671 | debug(3, "m32r_cfc: pcc_set_io_map: sock(%d)\n", sock); | 658 | dev_dbg(&s->dev, "pcc_set_io_map: sock(%d)\n", sock); |
| 672 | LOCKED(_pcc_set_io_map(sock, io)); | 659 | LOCKED(_pcc_set_io_map(sock, io)); |
| 673 | } | 660 | } |
| 674 | 661 | ||
| @@ -677,16 +664,16 @@ static int pcc_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem) | |||
| 677 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; | 664 | unsigned int sock = container_of(s, struct pcc_socket, socket)->number; |
| 678 | 665 | ||
| 679 | if (socket[sock].flags & IS_ALIVE) { | 666 | if (socket[sock].flags & IS_ALIVE) { |
| 680 | debug(3, "m32r_cfc: pcc_set_mem_map: sock(%d) -EINVAL\n", sock); | 667 | dev_dbg(&s->dev, "pcc_set_mem_map: sock(%d) -EINVAL\n", sock); |
| 681 | return -EINVAL; | 668 | return -EINVAL; |
| 682 | } | 669 | } |
| 683 | debug(3, "m32r_cfc: pcc_set_mem_map: sock(%d)\n", sock); | 670 | dev_dbg(&s->dev, "pcc_set_mem_map: sock(%d)\n", sock); |
| 684 | LOCKED(_pcc_set_mem_map(sock, mem)); | 671 | LOCKED(_pcc_set_mem_map(sock, mem)); |
| 685 | } | 672 | } |
| 686 | 673 | ||
| 687 | static int pcc_init(struct pcmcia_socket *s) | 674 | static int pcc_init(struct pcmcia_socket *s) |
| 688 | { | 675 | { |
| 689 | debug(3, "m32r_cfc: pcc_init()\n"); | 676 | dev_dbg(&s->dev, "pcc_init()\n"); |
| 690 | return 0; | 677 | return 0; |
| 691 | } | 678 | } |
| 692 | 679 | ||
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index c6524f99ccc3..72844c5a6d05 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c | |||
| @@ -45,16 +45,6 @@ | |||
| 45 | 45 | ||
| 46 | #define PCC_DEBUG_DBEX | 46 | #define PCC_DEBUG_DBEX |
| 47 | 47 | ||
| 48 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 49 | static int m32r_pcc_debug; | ||
| 50 | module_param(m32r_pcc_debug, int, 0644); | ||
| 51 | #define debug(lvl, fmt, arg...) do { \ | ||
| 52 | if (m32r_pcc_debug > (lvl)) \ | ||
| 53 | printk(KERN_DEBUG "m32r_pcc: " fmt , ## arg); \ | ||
| 54 | } while (0) | ||
| 55 | #else | ||
| 56 | #define debug(n, args...) do { } while (0) | ||
| 57 | #endif | ||
| 58 | 48 | ||
| 59 | /* Poll status interval -- 0 means default to interrupt */ | 49 | /* Poll status interval -- 0 means default to interrupt */ |
| 60 | static int poll_interval = 0; | 50 | static int poll_interval = 0; |
| @@ -358,7 +348,7 @@ static irqreturn_t pcc_interrupt(int irq, void *dev) | |||
| 358 | u_int events, active; | 348 | u_int events, active; |
| 359 | int handled = 0; | 349 | int handled = 0; |
| 360 | 350 | ||
| 361 | debug(4, "m32r: pcc_interrupt(%d)\n", irq); | 351 | pr_debug("m32r_pcc: pcc_interrupt(%d)\n", irq); |
| 362 | 352 | ||
| 363 | for (j = 0; j < 20; j++) { | 353 | for (j = 0; j < 20; j++) { |
| 364 | active = 0; | 354 | active = 0; |
| @@ -369,13 +359,14 @@ static irqreturn_t pcc_interrupt(int irq, void *dev) | |||
| 369 | handled = 1; | 359 | handled = 1; |
| 370 | irc = pcc_get(i, PCIRC); | 360 | irc = pcc_get(i, PCIRC); |
| 371 | irc >>=16; | 361 | irc >>=16; |
| 372 | debug(2, "m32r-pcc:interrupt: socket %d pcirc 0x%02x ", i, irc); | 362 | pr_debug("m32r_pcc: interrupt: socket %d pcirc 0x%02x ", |
| 363 | i, irc); | ||
| 373 | if (!irc) | 364 | if (!irc) |
| 374 | continue; | 365 | continue; |
| 375 | 366 | ||
| 376 | events = (irc) ? SS_DETECT : 0; | 367 | events = (irc) ? SS_DETECT : 0; |
| 377 | events |= (pcc_get(i,PCCR) & PCCR_PCEN) ? SS_READY : 0; | 368 | events |= (pcc_get(i,PCCR) & PCCR_PCEN) ? SS_READY : 0; |
| 378 | debug(2, " event 0x%02x\n", events); | 369 | pr_debug("m32r_pcc: event 0x%02x\n", events); |
| 379 | 370 | ||
| 380 | if (events) | 371 | if (events) |
| 381 | pcmcia_parse_events(&socket[i].socket, events); | 372 | pcmcia_parse_events(&socket[i].socket, events); |
| @@ -388,7 +379,7 @@ static irqreturn_t pcc_interrupt(int irq, void *dev) | |||
| 388 | if (j == 20) | 379 | if (j == 20) |
| 389 | printk(KERN_NOTICE "m32r-pcc: infinite loop in interrupt handler\n"); | 380 | printk(KERN_NOTICE "m32r-pcc: infinite loop in interrupt handler\n"); |
| 390 | 381 | ||
| 391 | debug(4, "m32r-pcc: interrupt done\n"); | 382 | pr_debug("m32r_pcc: interrupt done\n"); |
| 392 | 383 | ||
| 393 | return IRQ_RETVAL(handled); | 384 | return IRQ_RETVAL(handled); |
| 394 | } /* pcc_interrupt */ | 385 | } /* pcc_interrupt */ |
| @@ -422,7 +413,7 @@ static int _pcc_get_status(u_short sock, u_int *value) | |||
| 422 | status = pcc_get(sock,PCCSIGCR); | 413 | status = pcc_get(sock,PCCSIGCR); |
| 423 | *value |= (status & PCCSIGCR_VEN) ? SS_POWERON : 0; | 414 | *value |= (status & PCCSIGCR_VEN) ? SS_POWERON : 0; |
| 424 | 415 | ||
| 425 | debug(3, "m32r-pcc: GetStatus(%d) = %#4.4x\n", sock, *value); | 416 | pr_debug("m32r_pcc: GetStatus(%d) = %#4.4x\n", sock, *value); |
| 426 | return 0; | 417 | return 0; |
| 427 | } /* _get_status */ | 418 | } /* _get_status */ |
| 428 | 419 | ||
| @@ -432,7 +423,7 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state) | |||
| 432 | { | 423 | { |
| 433 | u_long reg = 0; | 424 | u_long reg = 0; |
| 434 | 425 | ||
| 435 | debug(3, "m32r-pcc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " | 426 | pr_debug("m32r_pcc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " |
| 436 | "io_irq %d, csc_mask %#2.2x)", sock, state->flags, | 427 | "io_irq %d, csc_mask %#2.2x)", sock, state->flags, |
| 437 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | 428 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); |
| 438 | 429 | ||
| @@ -448,11 +439,11 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state) | |||
| 448 | } | 439 | } |
| 449 | 440 | ||
| 450 | if (state->flags & SS_RESET) { | 441 | if (state->flags & SS_RESET) { |
| 451 | debug(3, ":RESET\n"); | 442 | pr_debug("m32r_pcc: :RESET\n"); |
| 452 | reg |= PCCSIGCR_CRST; | 443 | reg |= PCCSIGCR_CRST; |
| 453 | } | 444 | } |
| 454 | if (state->flags & SS_OUTPUT_ENA){ | 445 | if (state->flags & SS_OUTPUT_ENA){ |
| 455 | debug(3, ":OUTPUT_ENA\n"); | 446 | pr_debug("m32r_pcc: :OUTPUT_ENA\n"); |
| 456 | /* bit clear */ | 447 | /* bit clear */ |
| 457 | } else { | 448 | } else { |
| 458 | reg |= PCCSIGCR_SEN; | 449 | reg |= PCCSIGCR_SEN; |
| @@ -460,28 +451,26 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state) | |||
| 460 | 451 | ||
| 461 | pcc_set(sock,PCCSIGCR,reg); | 452 | pcc_set(sock,PCCSIGCR,reg); |
| 462 | 453 | ||
| 463 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 464 | if(state->flags & SS_IOCARD){ | 454 | if(state->flags & SS_IOCARD){ |
| 465 | debug(3, ":IOCARD"); | 455 | pr_debug("m32r_pcc: :IOCARD"); |
| 466 | } | 456 | } |
| 467 | if (state->flags & SS_PWR_AUTO) { | 457 | if (state->flags & SS_PWR_AUTO) { |
| 468 | debug(3, ":PWR_AUTO"); | 458 | pr_debug("m32r_pcc: :PWR_AUTO"); |
| 469 | } | 459 | } |
| 470 | if (state->csc_mask & SS_DETECT) | 460 | if (state->csc_mask & SS_DETECT) |
| 471 | debug(3, ":csc-SS_DETECT"); | 461 | pr_debug("m32r_pcc: :csc-SS_DETECT"); |
| 472 | if (state->flags & SS_IOCARD) { | 462 | if (state->flags & SS_IOCARD) { |
| 473 | if (state->csc_mask & SS_STSCHG) | 463 | if (state->csc_mask & SS_STSCHG) |
| 474 | debug(3, ":STSCHG"); | 464 | pr_debug("m32r_pcc: :STSCHG"); |
| 475 | } else { | 465 | } else { |
| 476 | if (state->csc_mask & SS_BATDEAD) | 466 | if (state->csc_mask & SS_BATDEAD) |
| 477 | debug(3, ":BATDEAD"); | 467 | pr_debug("m32r_pcc: :BATDEAD"); |
| 478 | if (state->csc_mask & SS_BATWARN) | 468 | if (state->csc_mask & SS_BATWARN) |
| 479 | debug(3, ":BATWARN"); | 469 | pr_debug("m32r_pcc: :BATWARN"); |
| 480 | if (state->csc_mask & SS_READY) | 470 | if (state->csc_mask & SS_READY) |
| 481 | debug(3, ":READY"); | 471 | pr_debug("m32r_pcc: :READY"); |
| 482 | } | 472 | } |
| 483 | debug(3, "\n"); | 473 | pr_debug("m32r_pcc: \n"); |
| 484 | #endif | ||
| 485 | return 0; | 474 | return 0; |
| 486 | } /* _set_socket */ | 475 | } /* _set_socket */ |
| 487 | 476 | ||
| @@ -491,7 +480,7 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) | |||
| 491 | { | 480 | { |
| 492 | u_char map; | 481 | u_char map; |
| 493 | 482 | ||
| 494 | debug(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, " | 483 | pr_debug("m32r_pcc: SetIOMap(%d, %d, %#2.2x, %d ns, " |
| 495 | "%#llx-%#llx)\n", sock, io->map, io->flags, | 484 | "%#llx-%#llx)\n", sock, io->map, io->flags, |
| 496 | io->speed, (unsigned long long)io->start, | 485 | io->speed, (unsigned long long)io->start, |
| 497 | (unsigned long long)io->stop); | 486 | (unsigned long long)io->stop); |
| @@ -515,7 +504,7 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) | |||
| 515 | #endif | 504 | #endif |
| 516 | #endif | 505 | #endif |
| 517 | 506 | ||
| 518 | debug(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, " | 507 | pr_debug("m32r_pcc: SetMemMap(%d, %d, %#2.2x, %d ns, " |
| 519 | "%#llx, %#x)\n", sock, map, mem->flags, | 508 | "%#llx, %#x)\n", sock, map, mem->flags, |
| 520 | mem->speed, (unsigned long long)mem->static_start, | 509 | mem->speed, (unsigned long long)mem->static_start, |
| 521 | mem->card_start); | 510 | mem->card_start); |
| @@ -662,7 +651,7 @@ static int pcc_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem) | |||
| 662 | 651 | ||
| 663 | static int pcc_init(struct pcmcia_socket *s) | 652 | static int pcc_init(struct pcmcia_socket *s) |
| 664 | { | 653 | { |
| 665 | debug(4, "m32r-pcc: init call\n"); | 654 | pr_debug("m32r_pcc: init call\n"); |
| 666 | return 0; | 655 | return 0; |
| 667 | } | 656 | } |
| 668 | 657 | ||
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index 403559ba49dd..7f79c4e169ae 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c | |||
| @@ -64,14 +64,6 @@ | |||
| 64 | #include <pcmcia/cs.h> | 64 | #include <pcmcia/cs.h> |
| 65 | #include <pcmcia/ss.h> | 65 | #include <pcmcia/ss.h> |
| 66 | 66 | ||
| 67 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 68 | static int pc_debug; | ||
| 69 | module_param(pc_debug, int, 0); | ||
| 70 | #define dprintk(args...) printk(KERN_DEBUG "m8xx_pcmcia: " args); | ||
| 71 | #else | ||
| 72 | #define dprintk(args...) | ||
| 73 | #endif | ||
| 74 | |||
| 75 | #define pcmcia_info(args...) printk(KERN_INFO "m8xx_pcmcia: "args) | 67 | #define pcmcia_info(args...) printk(KERN_INFO "m8xx_pcmcia: "args) |
| 76 | #define pcmcia_error(args...) printk(KERN_ERR "m8xx_pcmcia: "args) | 68 | #define pcmcia_error(args...) printk(KERN_ERR "m8xx_pcmcia: "args) |
| 77 | 69 | ||
| @@ -565,7 +557,7 @@ static irqreturn_t m8xx_interrupt(int irq, void *dev) | |||
| 565 | unsigned int i, events, pscr, pipr, per; | 557 | unsigned int i, events, pscr, pipr, per; |
| 566 | pcmconf8xx_t *pcmcia = socket[0].pcmcia; | 558 | pcmconf8xx_t *pcmcia = socket[0].pcmcia; |
| 567 | 559 | ||
| 568 | dprintk("Interrupt!\n"); | 560 | pr_debug("m8xx_pcmcia: Interrupt!\n"); |
| 569 | /* get interrupt sources */ | 561 | /* get interrupt sources */ |
| 570 | 562 | ||
| 571 | pscr = in_be32(&pcmcia->pcmc_pscr); | 563 | pscr = in_be32(&pcmcia->pcmc_pscr); |
| @@ -614,7 +606,7 @@ static irqreturn_t m8xx_interrupt(int irq, void *dev) | |||
| 614 | 606 | ||
| 615 | /* call the handler */ | 607 | /* call the handler */ |
| 616 | 608 | ||
| 617 | dprintk("slot %u: events = 0x%02x, pscr = 0x%08x, " | 609 | pr_debug("m8xx_pcmcia: slot %u: events = 0x%02x, pscr = 0x%08x, " |
| 618 | "pipr = 0x%08x\n", i, events, pscr, pipr); | 610 | "pipr = 0x%08x\n", i, events, pscr, pipr); |
| 619 | 611 | ||
| 620 | if (events) { | 612 | if (events) { |
| @@ -641,7 +633,7 @@ static irqreturn_t m8xx_interrupt(int irq, void *dev) | |||
| 641 | /* clear the interrupt sources */ | 633 | /* clear the interrupt sources */ |
| 642 | out_be32(&pcmcia->pcmc_pscr, pscr); | 634 | out_be32(&pcmcia->pcmc_pscr, pscr); |
| 643 | 635 | ||
| 644 | dprintk("Interrupt done.\n"); | 636 | pr_debug("m8xx_pcmcia: Interrupt done.\n"); |
| 645 | 637 | ||
| 646 | return IRQ_HANDLED; | 638 | return IRQ_HANDLED; |
| 647 | } | 639 | } |
| @@ -815,7 +807,7 @@ static int m8xx_get_status(struct pcmcia_socket *sock, unsigned int *value) | |||
| 815 | }; | 807 | }; |
| 816 | } | 808 | } |
| 817 | 809 | ||
| 818 | dprintk("GetStatus(%d) = %#2.2x\n", lsock, *value); | 810 | pr_debug("m8xx_pcmcia: GetStatus(%d) = %#2.2x\n", lsock, *value); |
| 819 | return 0; | 811 | return 0; |
| 820 | } | 812 | } |
| 821 | 813 | ||
| @@ -828,7 +820,7 @@ static int m8xx_set_socket(struct pcmcia_socket *sock, socket_state_t * state) | |||
| 828 | unsigned long flags; | 820 | unsigned long flags; |
| 829 | pcmconf8xx_t *pcmcia = socket[0].pcmcia; | 821 | pcmconf8xx_t *pcmcia = socket[0].pcmcia; |
| 830 | 822 | ||
| 831 | dprintk("SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " | 823 | pr_debug("m8xx_pcmcia: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " |
| 832 | "io_irq %d, csc_mask %#2.2x)\n", lsock, state->flags, | 824 | "io_irq %d, csc_mask %#2.2x)\n", lsock, state->flags, |
| 833 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | 825 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); |
| 834 | 826 | ||
| @@ -974,7 +966,7 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
| 974 | #define M8XX_SIZE (io->stop - io->start + 1) | 966 | #define M8XX_SIZE (io->stop - io->start + 1) |
| 975 | #define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start) | 967 | #define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start) |
| 976 | 968 | ||
| 977 | dprintk("SetIOMap(%d, %d, %#2.2x, %d ns, " | 969 | pr_debug("m8xx_pcmcia: SetIOMap(%d, %d, %#2.2x, %d ns, " |
| 978 | "%#4.4llx-%#4.4llx)\n", lsock, io->map, io->flags, | 970 | "%#4.4llx-%#4.4llx)\n", lsock, io->map, io->flags, |
| 979 | io->speed, (unsigned long long)io->start, | 971 | io->speed, (unsigned long long)io->start, |
| 980 | (unsigned long long)io->stop); | 972 | (unsigned long long)io->stop); |
| @@ -988,7 +980,7 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
| 988 | 980 | ||
| 989 | if (io->flags & MAP_ACTIVE) { | 981 | if (io->flags & MAP_ACTIVE) { |
| 990 | 982 | ||
| 991 | dprintk("io->flags & MAP_ACTIVE\n"); | 983 | pr_debug("m8xx_pcmcia: io->flags & MAP_ACTIVE\n"); |
| 992 | 984 | ||
| 993 | winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO) | 985 | winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO) |
| 994 | + (lsock * PCMCIA_IO_WIN_NO) + io->map; | 986 | + (lsock * PCMCIA_IO_WIN_NO) + io->map; |
| @@ -1018,8 +1010,8 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
| 1018 | 1010 | ||
| 1019 | out_be32(&w->or, reg); | 1011 | out_be32(&w->or, reg); |
| 1020 | 1012 | ||
| 1021 | dprintk("Socket %u: Mapped io window %u at %#8.8x, " | 1013 | pr_debug("m8xx_pcmcia: Socket %u: Mapped io window %u at " |
| 1022 | "OR = %#8.8x.\n", lsock, io->map, w->br, w->or); | 1014 | "%#8.8x, OR = %#8.8x.\n", lsock, io->map, w->br, w->or); |
| 1023 | } else { | 1015 | } else { |
| 1024 | /* shutdown IO window */ | 1016 | /* shutdown IO window */ |
| 1025 | winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO) | 1017 | winnr = (PCMCIA_MEM_WIN_NO * PCMCIA_SOCKETS_NO) |
| @@ -1033,14 +1025,14 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
| 1033 | out_be32(&w->or, 0); /* turn off window */ | 1025 | out_be32(&w->or, 0); /* turn off window */ |
| 1034 | out_be32(&w->br, 0); /* turn off base address */ | 1026 | out_be32(&w->br, 0); /* turn off base address */ |
| 1035 | 1027 | ||
| 1036 | dprintk("Socket %u: Unmapped io window %u at %#8.8x, " | 1028 | pr_debug("m8xx_pcmcia: Socket %u: Unmapped io window %u at " |
| 1037 | "OR = %#8.8x.\n", lsock, io->map, w->br, w->or); | 1029 | "%#8.8x, OR = %#8.8x.\n", lsock, io->map, w->br, w->or); |
| 1038 | } | 1030 | } |
| 1039 | 1031 | ||
| 1040 | /* copy the struct and modify the copy */ | 1032 | /* copy the struct and modify the copy */ |
| 1041 | s->io_win[io->map] = *io; | 1033 | s->io_win[io->map] = *io; |
| 1042 | s->io_win[io->map].flags &= (MAP_WRPROT | MAP_16BIT | MAP_ACTIVE); | 1034 | s->io_win[io->map].flags &= (MAP_WRPROT | MAP_16BIT | MAP_ACTIVE); |
| 1043 | dprintk("SetIOMap exit\n"); | 1035 | pr_debug("m8xx_pcmcia: SetIOMap exit\n"); |
| 1044 | 1036 | ||
| 1045 | return 0; | 1037 | return 0; |
| 1046 | } | 1038 | } |
| @@ -1055,7 +1047,7 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, | |||
| 1055 | unsigned int reg, winnr; | 1047 | unsigned int reg, winnr; |
| 1056 | pcmconf8xx_t *pcmcia = s->pcmcia; | 1048 | pcmconf8xx_t *pcmcia = s->pcmcia; |
| 1057 | 1049 | ||
| 1058 | dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " | 1050 | pr_debug("m8xx_pcmcia: SetMemMap(%d, %d, %#2.2x, %d ns, " |
| 1059 | "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, | 1051 | "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, |
| 1060 | mem->speed, (unsigned long long)mem->static_start, | 1052 | mem->speed, (unsigned long long)mem->static_start, |
| 1061 | mem->card_start); | 1053 | mem->card_start); |
| @@ -1098,7 +1090,7 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, | |||
| 1098 | 1090 | ||
| 1099 | out_be32(&w->or, reg); | 1091 | out_be32(&w->or, reg); |
| 1100 | 1092 | ||
| 1101 | dprintk("Socket %u: Mapped memory window %u at %#8.8x, " | 1093 | pr_debug("m8xx_pcmcia: Socket %u: Mapped memory window %u at %#8.8x, " |
| 1102 | "OR = %#8.8x.\n", lsock, mem->map, w->br, w->or); | 1094 | "OR = %#8.8x.\n", lsock, mem->map, w->br, w->or); |
| 1103 | 1095 | ||
| 1104 | if (mem->flags & MAP_ACTIVE) { | 1096 | if (mem->flags & MAP_ACTIVE) { |
| @@ -1108,7 +1100,7 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, | |||
| 1108 | + mem->card_start; | 1100 | + mem->card_start; |
| 1109 | } | 1101 | } |
| 1110 | 1102 | ||
| 1111 | dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " | 1103 | pr_debug("m8xx_pcmcia: SetMemMap(%d, %d, %#2.2x, %d ns, " |
| 1112 | "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, | 1104 | "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, |
| 1113 | mem->speed, (unsigned long long)mem->static_start, | 1105 | mem->speed, (unsigned long long)mem->static_start, |
| 1114 | mem->card_start); | 1106 | mem->card_start); |
| @@ -1129,7 +1121,7 @@ static int m8xx_sock_init(struct pcmcia_socket *sock) | |||
| 1129 | pccard_io_map io = { 0, 0, 0, 0, 1 }; | 1121 | pccard_io_map io = { 0, 0, 0, 0, 1 }; |
| 1130 | pccard_mem_map mem = { 0, 0, 0, 0, 0, 0 }; | 1122 | pccard_mem_map mem = { 0, 0, 0, 0, 0, 0 }; |
| 1131 | 1123 | ||
| 1132 | dprintk("sock_init(%d)\n", s); | 1124 | pr_debug("m8xx_pcmcia: sock_init(%d)\n", s); |
| 1133 | 1125 | ||
| 1134 | m8xx_set_socket(sock, &dead_socket); | 1126 | m8xx_set_socket(sock, &dead_socket); |
| 1135 | for (i = 0; i < PCMCIA_IO_WIN_NO; i++) { | 1127 | for (i = 0; i < PCMCIA_IO_WIN_NO; i++) { |
diff --git a/drivers/pcmcia/o2micro.h b/drivers/pcmcia/o2micro.h index 72188c462c9c..624442fc0d35 100644 --- a/drivers/pcmcia/o2micro.h +++ b/drivers/pcmcia/o2micro.h | |||
| @@ -30,28 +30,6 @@ | |||
| 30 | #ifndef _LINUX_O2MICRO_H | 30 | #ifndef _LINUX_O2MICRO_H |
| 31 | #define _LINUX_O2MICRO_H | 31 | #define _LINUX_O2MICRO_H |
| 32 | 32 | ||
| 33 | #ifndef PCI_VENDOR_ID_O2 | ||
| 34 | #define PCI_VENDOR_ID_O2 0x1217 | ||
| 35 | #endif | ||
| 36 | #ifndef PCI_DEVICE_ID_O2_6729 | ||
| 37 | #define PCI_DEVICE_ID_O2_6729 0x6729 | ||
| 38 | #endif | ||
| 39 | #ifndef PCI_DEVICE_ID_O2_6730 | ||
| 40 | #define PCI_DEVICE_ID_O2_6730 0x673a | ||
| 41 | #endif | ||
| 42 | #ifndef PCI_DEVICE_ID_O2_6832 | ||
| 43 | #define PCI_DEVICE_ID_O2_6832 0x6832 | ||
| 44 | #endif | ||
| 45 | #ifndef PCI_DEVICE_ID_O2_6836 | ||
| 46 | #define PCI_DEVICE_ID_O2_6836 0x6836 | ||
| 47 | #endif | ||
| 48 | #ifndef PCI_DEVICE_ID_O2_6812 | ||
| 49 | #define PCI_DEVICE_ID_O2_6812 0x6872 | ||
| 50 | #endif | ||
| 51 | #ifndef PCI_DEVICE_ID_O2_6933 | ||
| 52 | #define PCI_DEVICE_ID_O2_6933 0x6933 | ||
| 53 | #endif | ||
| 54 | |||
| 55 | /* Additional PCI configuration registers */ | 33 | /* Additional PCI configuration registers */ |
| 56 | 34 | ||
| 57 | #define O2_MUX_CONTROL 0x90 /* 32 bit */ | 35 | #define O2_MUX_CONTROL 0x90 /* 32 bit */ |
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 30cf71d2ee23..c4d7908fa37f 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
| @@ -58,17 +58,6 @@ typedef struct user_info_t { | |||
| 58 | } user_info_t; | 58 | } user_info_t; |
| 59 | 59 | ||
| 60 | 60 | ||
| 61 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 62 | extern int ds_pc_debug; | ||
| 63 | |||
| 64 | #define ds_dbg(lvl, fmt, arg...) do { \ | ||
| 65 | if (ds_pc_debug >= lvl) \ | ||
| 66 | printk(KERN_DEBUG "ds: " fmt , ## arg); \ | ||
| 67 | } while (0) | ||
| 68 | #else | ||
| 69 | #define ds_dbg(lvl, fmt, arg...) do { } while (0) | ||
| 70 | #endif | ||
| 71 | |||
| 72 | static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s, | 61 | static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s, |
| 73 | unsigned int function) | 62 | unsigned int function) |
| 74 | { | 63 | { |
| @@ -229,6 +218,61 @@ static int pcmcia_adjust_resource_info(adjust_t *adj) | |||
| 229 | return (ret); | 218 | return (ret); |
| 230 | } | 219 | } |
| 231 | 220 | ||
| 221 | |||
| 222 | /** pcmcia_get_window | ||
| 223 | */ | ||
| 224 | static int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *wh_out, | ||
| 225 | window_handle_t wh, win_req_t *req) | ||
| 226 | { | ||
| 227 | pccard_mem_map *win; | ||
| 228 | window_handle_t w; | ||
| 229 | |||
| 230 | wh--; | ||
| 231 | if (!s || !(s->state & SOCKET_PRESENT)) | ||
| 232 | return -ENODEV; | ||
| 233 | if (wh >= MAX_WIN) | ||
| 234 | return -EINVAL; | ||
| 235 | for (w = wh; w < MAX_WIN; w++) | ||
| 236 | if (s->state & SOCKET_WIN_REQ(w)) | ||
| 237 | break; | ||
| 238 | if (w == MAX_WIN) | ||
| 239 | return -EINVAL; | ||
| 240 | win = &s->win[w]; | ||
| 241 | req->Base = win->res->start; | ||
| 242 | req->Size = win->res->end - win->res->start + 1; | ||
| 243 | req->AccessSpeed = win->speed; | ||
| 244 | req->Attributes = 0; | ||
| 245 | if (win->flags & MAP_ATTRIB) | ||
| 246 | req->Attributes |= WIN_MEMORY_TYPE_AM; | ||
| 247 | if (win->flags & MAP_ACTIVE) | ||
| 248 | req->Attributes |= WIN_ENABLE; | ||
| 249 | if (win->flags & MAP_16BIT) | ||
| 250 | req->Attributes |= WIN_DATA_WIDTH_16; | ||
| 251 | if (win->flags & MAP_USE_WAIT) | ||
| 252 | req->Attributes |= WIN_USE_WAIT; | ||
| 253 | |||
| 254 | *wh_out = w + 1; | ||
| 255 | return 0; | ||
| 256 | } /* pcmcia_get_window */ | ||
| 257 | |||
| 258 | |||
| 259 | /** pcmcia_get_mem_page | ||
| 260 | * | ||
| 261 | * Change the card address of an already open memory window. | ||
| 262 | */ | ||
| 263 | static int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t wh, | ||
| 264 | memreq_t *req) | ||
| 265 | { | ||
| 266 | wh--; | ||
| 267 | if (wh >= MAX_WIN) | ||
| 268 | return -EINVAL; | ||
| 269 | |||
| 270 | req->Page = 0; | ||
| 271 | req->CardOffset = skt->win[wh].card_start; | ||
| 272 | return 0; | ||
| 273 | } /* pcmcia_get_mem_page */ | ||
| 274 | |||
| 275 | |||
| 232 | /** pccard_get_status | 276 | /** pccard_get_status |
| 233 | * | 277 | * |
| 234 | * Get the current socket state bits. We don't support the latched | 278 | * Get the current socket state bits. We don't support the latched |
| @@ -431,7 +475,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info) | |||
| 431 | if (!s) | 475 | if (!s) |
| 432 | return -EINVAL; | 476 | return -EINVAL; |
| 433 | 477 | ||
| 434 | ds_dbg(2, "bind_request(%d, '%s')\n", s->sock, | 478 | pr_debug("bind_request(%d, '%s')\n", s->sock, |
| 435 | (char *)bind_info->dev_info); | 479 | (char *)bind_info->dev_info); |
| 436 | 480 | ||
| 437 | p_drv = get_pcmcia_driver(&bind_info->dev_info); | 481 | p_drv = get_pcmcia_driver(&bind_info->dev_info); |
| @@ -623,7 +667,7 @@ static int ds_open(struct inode *inode, struct file *file) | |||
| 623 | static int warning_printed = 0; | 667 | static int warning_printed = 0; |
| 624 | int ret = 0; | 668 | int ret = 0; |
| 625 | 669 | ||
| 626 | ds_dbg(0, "ds_open(socket %d)\n", i); | 670 | pr_debug("ds_open(socket %d)\n", i); |
| 627 | 671 | ||
| 628 | lock_kernel(); | 672 | lock_kernel(); |
| 629 | s = pcmcia_get_socket_by_nr(i); | 673 | s = pcmcia_get_socket_by_nr(i); |
| @@ -685,7 +729,7 @@ static int ds_release(struct inode *inode, struct file *file) | |||
| 685 | struct pcmcia_socket *s; | 729 | struct pcmcia_socket *s; |
| 686 | user_info_t *user, **link; | 730 | user_info_t *user, **link; |
| 687 | 731 | ||
| 688 | ds_dbg(0, "ds_release(socket %d)\n", iminor(inode)); | 732 | pr_debug("ds_release(socket %d)\n", iminor(inode)); |
| 689 | 733 | ||
| 690 | user = file->private_data; | 734 | user = file->private_data; |
| 691 | if (CHECK_USER(user)) | 735 | if (CHECK_USER(user)) |
| @@ -719,7 +763,7 @@ static ssize_t ds_read(struct file *file, char __user *buf, | |||
| 719 | user_info_t *user; | 763 | user_info_t *user; |
| 720 | int ret; | 764 | int ret; |
| 721 | 765 | ||
| 722 | ds_dbg(2, "ds_read(socket %d)\n", iminor(file->f_path.dentry->d_inode)); | 766 | pr_debug("ds_read(socket %d)\n", iminor(file->f_path.dentry->d_inode)); |
| 723 | 767 | ||
| 724 | if (count < 4) | 768 | if (count < 4) |
| 725 | return -EINVAL; | 769 | return -EINVAL; |
| @@ -744,7 +788,7 @@ static ssize_t ds_read(struct file *file, char __user *buf, | |||
| 744 | static ssize_t ds_write(struct file *file, const char __user *buf, | 788 | static ssize_t ds_write(struct file *file, const char __user *buf, |
| 745 | size_t count, loff_t *ppos) | 789 | size_t count, loff_t *ppos) |
| 746 | { | 790 | { |
| 747 | ds_dbg(2, "ds_write(socket %d)\n", iminor(file->f_path.dentry->d_inode)); | 791 | pr_debug("ds_write(socket %d)\n", iminor(file->f_path.dentry->d_inode)); |
| 748 | 792 | ||
| 749 | if (count != 4) | 793 | if (count != 4) |
| 750 | return -EINVAL; | 794 | return -EINVAL; |
| @@ -762,7 +806,7 @@ static u_int ds_poll(struct file *file, poll_table *wait) | |||
| 762 | struct pcmcia_socket *s; | 806 | struct pcmcia_socket *s; |
| 763 | user_info_t *user; | 807 | user_info_t *user; |
| 764 | 808 | ||
| 765 | ds_dbg(2, "ds_poll(socket %d)\n", iminor(file->f_path.dentry->d_inode)); | 809 | pr_debug("ds_poll(socket %d)\n", iminor(file->f_path.dentry->d_inode)); |
| 766 | 810 | ||
| 767 | user = file->private_data; | 811 | user = file->private_data; |
| 768 | if (CHECK_USER(user)) | 812 | if (CHECK_USER(user)) |
| @@ -790,7 +834,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
| 790 | ds_ioctl_arg_t *buf; | 834 | ds_ioctl_arg_t *buf; |
| 791 | user_info_t *user; | 835 | user_info_t *user; |
| 792 | 836 | ||
| 793 | ds_dbg(2, "ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg); | 837 | pr_debug("ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg); |
| 794 | 838 | ||
| 795 | user = file->private_data; | 839 | user = file->private_data; |
| 796 | if (CHECK_USER(user)) | 840 | if (CHECK_USER(user)) |
| @@ -809,13 +853,13 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
| 809 | 853 | ||
| 810 | if (cmd & IOC_IN) { | 854 | if (cmd & IOC_IN) { |
| 811 | if (!access_ok(VERIFY_READ, uarg, size)) { | 855 | if (!access_ok(VERIFY_READ, uarg, size)) { |
| 812 | ds_dbg(3, "ds_ioctl(): verify_read = %d\n", -EFAULT); | 856 | pr_debug("ds_ioctl(): verify_read = %d\n", -EFAULT); |
| 813 | return -EFAULT; | 857 | return -EFAULT; |
| 814 | } | 858 | } |
| 815 | } | 859 | } |
| 816 | if (cmd & IOC_OUT) { | 860 | if (cmd & IOC_OUT) { |
| 817 | if (!access_ok(VERIFY_WRITE, uarg, size)) { | 861 | if (!access_ok(VERIFY_WRITE, uarg, size)) { |
| 818 | ds_dbg(3, "ds_ioctl(): verify_write = %d\n", -EFAULT); | 862 | pr_debug("ds_ioctl(): verify_write = %d\n", -EFAULT); |
| 819 | return -EFAULT; | 863 | return -EFAULT; |
| 820 | } | 864 | } |
| 821 | } | 865 | } |
| @@ -927,15 +971,15 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
| 927 | goto free_out; | 971 | goto free_out; |
| 928 | break; | 972 | break; |
| 929 | case DS_GET_FIRST_WINDOW: | 973 | case DS_GET_FIRST_WINDOW: |
| 930 | ret = pcmcia_get_window(s, &buf->win_info.handle, 0, | 974 | ret = pcmcia_get_window(s, &buf->win_info.handle, 1, |
| 931 | &buf->win_info.window); | 975 | &buf->win_info.window); |
| 932 | break; | 976 | break; |
| 933 | case DS_GET_NEXT_WINDOW: | 977 | case DS_GET_NEXT_WINDOW: |
| 934 | ret = pcmcia_get_window(s, &buf->win_info.handle, | 978 | ret = pcmcia_get_window(s, &buf->win_info.handle, |
| 935 | buf->win_info.handle->index + 1, &buf->win_info.window); | 979 | buf->win_info.handle + 1, &buf->win_info.window); |
| 936 | break; | 980 | break; |
| 937 | case DS_GET_MEM_PAGE: | 981 | case DS_GET_MEM_PAGE: |
| 938 | ret = pcmcia_get_mem_page(buf->win_info.handle, | 982 | ret = pcmcia_get_mem_page(s, buf->win_info.handle, |
| 939 | &buf->win_info.map); | 983 | &buf->win_info.map); |
| 940 | break; | 984 | break; |
| 941 | case DS_REPLACE_CIS: | 985 | case DS_REPLACE_CIS: |
| @@ -962,7 +1006,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
| 962 | } | 1006 | } |
| 963 | 1007 | ||
| 964 | if ((err == 0) && (ret != 0)) { | 1008 | if ((err == 0) && (ret != 0)) { |
| 965 | ds_dbg(2, "ds_ioctl: ret = %d\n", ret); | 1009 | pr_debug("ds_ioctl: ret = %d\n", ret); |
| 966 | switch (ret) { | 1010 | switch (ret) { |
| 967 | case -ENODEV: | 1011 | case -ENODEV: |
| 968 | case -EINVAL: | 1012 | case -EINVAL: |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index d919e96c0afd..a8bf8c1b45ed 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
| 21 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
| 22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
| 23 | #include <linux/netdevice.h> | ||
| 23 | 24 | ||
| 24 | #include <pcmcia/cs_types.h> | 25 | #include <pcmcia/cs_types.h> |
| 25 | #include <pcmcia/ss.h> | 26 | #include <pcmcia/ss.h> |
| @@ -43,21 +44,6 @@ static u8 pcmcia_used_irq[NR_IRQS]; | |||
| 43 | #endif | 44 | #endif |
| 44 | 45 | ||
| 45 | 46 | ||
| 46 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 47 | extern int ds_pc_debug; | ||
| 48 | |||
| 49 | #define ds_dbg(skt, lvl, fmt, arg...) do { \ | ||
| 50 | if (ds_pc_debug >= lvl) \ | ||
| 51 | dev_printk(KERN_DEBUG, &skt->dev, \ | ||
| 52 | "pcmcia_resource: " fmt, \ | ||
| 53 | ## arg); \ | ||
| 54 | } while (0) | ||
| 55 | #else | ||
| 56 | #define ds_dbg(skt, lvl, fmt, arg...) do { } while (0) | ||
| 57 | #endif | ||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | /** alloc_io_space | 47 | /** alloc_io_space |
| 62 | * | 48 | * |
| 63 | * Special stuff for managing IO windows, because they are scarce | 49 | * Special stuff for managing IO windows, because they are scarce |
| @@ -72,14 +58,14 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, | |||
| 72 | align = (*base) ? (lines ? 1<<lines : 0) : 1; | 58 | align = (*base) ? (lines ? 1<<lines : 0) : 1; |
| 73 | if (align && (align < num)) { | 59 | if (align && (align < num)) { |
| 74 | if (*base) { | 60 | if (*base) { |
| 75 | ds_dbg(s, 0, "odd IO request: num %#x align %#x\n", | 61 | dev_dbg(&s->dev, "odd IO request: num %#x align %#x\n", |
| 76 | num, align); | 62 | num, align); |
| 77 | align = 0; | 63 | align = 0; |
| 78 | } else | 64 | } else |
| 79 | while (align && (align < num)) align <<= 1; | 65 | while (align && (align < num)) align <<= 1; |
| 80 | } | 66 | } |
| 81 | if (*base & ~(align-1)) { | 67 | if (*base & ~(align-1)) { |
| 82 | ds_dbg(s, 0, "odd IO request: base %#x align %#x\n", | 68 | dev_dbg(&s->dev, "odd IO request: base %#x align %#x\n", |
| 83 | *base, align); | 69 | *base, align); |
| 84 | align = 0; | 70 | align = 0; |
| 85 | } | 71 | } |
| @@ -173,8 +159,10 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | |||
| 173 | s = p_dev->socket; | 159 | s = p_dev->socket; |
| 174 | c = p_dev->function_config; | 160 | c = p_dev->function_config; |
| 175 | 161 | ||
| 176 | if (!(c->state & CONFIG_LOCKED)) | 162 | if (!(c->state & CONFIG_LOCKED)) { |
| 163 | dev_dbg(&s->dev, "Configuration isnt't locked\n"); | ||
| 177 | return -EACCES; | 164 | return -EACCES; |
| 165 | } | ||
| 178 | 166 | ||
| 179 | addr = (c->ConfigBase + reg->Offset) >> 1; | 167 | addr = (c->ConfigBase + reg->Offset) >> 1; |
| 180 | 168 | ||
| @@ -188,6 +176,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | |||
| 188 | pcmcia_write_cis_mem(s, 1, addr, 1, &val); | 176 | pcmcia_write_cis_mem(s, 1, addr, 1, &val); |
| 189 | break; | 177 | break; |
| 190 | default: | 178 | default: |
| 179 | dev_dbg(&s->dev, "Invalid conf register request\n"); | ||
| 191 | return -EINVAL; | 180 | return -EINVAL; |
| 192 | break; | 181 | break; |
| 193 | } | 182 | } |
| @@ -196,68 +185,21 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | |||
| 196 | EXPORT_SYMBOL(pcmcia_access_configuration_register); | 185 | EXPORT_SYMBOL(pcmcia_access_configuration_register); |
| 197 | 186 | ||
| 198 | 187 | ||
| 199 | /** pcmcia_get_window | 188 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, |
| 200 | */ | 189 | memreq_t *req) |
| 201 | int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, | ||
| 202 | int idx, win_req_t *req) | ||
| 203 | { | ||
| 204 | window_t *win; | ||
| 205 | int w; | ||
| 206 | |||
| 207 | if (!s || !(s->state & SOCKET_PRESENT)) | ||
| 208 | return -ENODEV; | ||
| 209 | for (w = idx; w < MAX_WIN; w++) | ||
| 210 | if (s->state & SOCKET_WIN_REQ(w)) | ||
| 211 | break; | ||
| 212 | if (w == MAX_WIN) | ||
| 213 | return -EINVAL; | ||
| 214 | win = &s->win[w]; | ||
| 215 | req->Base = win->ctl.res->start; | ||
| 216 | req->Size = win->ctl.res->end - win->ctl.res->start + 1; | ||
| 217 | req->AccessSpeed = win->ctl.speed; | ||
| 218 | req->Attributes = 0; | ||
| 219 | if (win->ctl.flags & MAP_ATTRIB) | ||
| 220 | req->Attributes |= WIN_MEMORY_TYPE_AM; | ||
| 221 | if (win->ctl.flags & MAP_ACTIVE) | ||
| 222 | req->Attributes |= WIN_ENABLE; | ||
| 223 | if (win->ctl.flags & MAP_16BIT) | ||
| 224 | req->Attributes |= WIN_DATA_WIDTH_16; | ||
| 225 | if (win->ctl.flags & MAP_USE_WAIT) | ||
| 226 | req->Attributes |= WIN_USE_WAIT; | ||
| 227 | *handle = win; | ||
| 228 | return 0; | ||
| 229 | } /* pcmcia_get_window */ | ||
| 230 | EXPORT_SYMBOL(pcmcia_get_window); | ||
| 231 | |||
| 232 | |||
| 233 | /** pcmcia_get_mem_page | ||
| 234 | * | ||
| 235 | * Change the card address of an already open memory window. | ||
| 236 | */ | ||
| 237 | int pcmcia_get_mem_page(window_handle_t win, memreq_t *req) | ||
| 238 | { | 190 | { |
| 239 | if ((win == NULL) || (win->magic != WINDOW_MAGIC)) | 191 | struct pcmcia_socket *s = p_dev->socket; |
| 240 | return -EINVAL; | ||
| 241 | req->Page = 0; | ||
| 242 | req->CardOffset = win->ctl.card_start; | ||
| 243 | return 0; | ||
| 244 | } /* pcmcia_get_mem_page */ | ||
| 245 | EXPORT_SYMBOL(pcmcia_get_mem_page); | ||
| 246 | |||
| 247 | 192 | ||
| 248 | int pcmcia_map_mem_page(window_handle_t win, memreq_t *req) | 193 | wh--; |
| 249 | { | 194 | if (wh >= MAX_WIN) |
| 250 | struct pcmcia_socket *s; | ||
| 251 | if ((win == NULL) || (win->magic != WINDOW_MAGIC)) | ||
| 252 | return -EINVAL; | 195 | return -EINVAL; |
| 253 | s = win->sock; | ||
| 254 | if (req->Page != 0) { | 196 | if (req->Page != 0) { |
| 255 | ds_dbg(s, 0, "failure: requested page is zero\n"); | 197 | dev_dbg(&s->dev, "failure: requested page is zero\n"); |
| 256 | return -EINVAL; | 198 | return -EINVAL; |
| 257 | } | 199 | } |
| 258 | win->ctl.card_start = req->CardOffset; | 200 | s->win[wh].card_start = req->CardOffset; |
| 259 | if (s->ops->set_mem_map(s, &win->ctl) != 0) { | 201 | if (s->ops->set_mem_map(s, &s->win[wh]) != 0) { |
| 260 | ds_dbg(s, 0, "failed to set_mem_map\n"); | 202 | dev_dbg(&s->dev, "failed to set_mem_map\n"); |
| 261 | return -EIO; | 203 | return -EIO; |
| 262 | } | 204 | } |
| 263 | return 0; | 205 | return 0; |
| @@ -278,10 +220,14 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, | |||
| 278 | s = p_dev->socket; | 220 | s = p_dev->socket; |
| 279 | c = p_dev->function_config; | 221 | c = p_dev->function_config; |
| 280 | 222 | ||
| 281 | if (!(s->state & SOCKET_PRESENT)) | 223 | if (!(s->state & SOCKET_PRESENT)) { |
| 224 | dev_dbg(&s->dev, "No card present\n"); | ||
| 282 | return -ENODEV; | 225 | return -ENODEV; |
| 283 | if (!(c->state & CONFIG_LOCKED)) | 226 | } |
| 227 | if (!(c->state & CONFIG_LOCKED)) { | ||
| 228 | dev_dbg(&s->dev, "Configuration isnt't locked\n"); | ||
| 284 | return -EACCES; | 229 | return -EACCES; |
| 230 | } | ||
| 285 | 231 | ||
| 286 | if (mod->Attributes & CONF_IRQ_CHANGE_VALID) { | 232 | if (mod->Attributes & CONF_IRQ_CHANGE_VALID) { |
| 287 | if (mod->Attributes & CONF_ENABLE_IRQ) { | 233 | if (mod->Attributes & CONF_ENABLE_IRQ) { |
| @@ -295,7 +241,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, | |||
| 295 | } | 241 | } |
| 296 | 242 | ||
| 297 | if (mod->Attributes & CONF_VCC_CHANGE_VALID) { | 243 | if (mod->Attributes & CONF_VCC_CHANGE_VALID) { |
| 298 | ds_dbg(s, 0, "changing Vcc is not allowed at this time\n"); | 244 | dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n"); |
| 299 | return -EINVAL; | 245 | return -EINVAL; |
| 300 | } | 246 | } |
| 301 | 247 | ||
| @@ -303,7 +249,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, | |||
| 303 | if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && | 249 | if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && |
| 304 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { | 250 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { |
| 305 | if (mod->Vpp1 != mod->Vpp2) { | 251 | if (mod->Vpp1 != mod->Vpp2) { |
| 306 | ds_dbg(s, 0, "Vpp1 and Vpp2 must be the same\n"); | 252 | dev_dbg(&s->dev, "Vpp1 and Vpp2 must be the same\n"); |
| 307 | return -EINVAL; | 253 | return -EINVAL; |
| 308 | } | 254 | } |
| 309 | s->socket.Vpp = mod->Vpp1; | 255 | s->socket.Vpp = mod->Vpp1; |
| @@ -314,7 +260,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, | |||
| 314 | } | 260 | } |
| 315 | } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || | 261 | } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || |
| 316 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { | 262 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { |
| 317 | ds_dbg(s, 0, "changing Vcc is not allowed at this time\n"); | 263 | dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n"); |
| 318 | return -EINVAL; | 264 | return -EINVAL; |
| 319 | } | 265 | } |
| 320 | 266 | ||
| @@ -425,11 +371,11 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
| 425 | if (c->state & CONFIG_LOCKED) | 371 | if (c->state & CONFIG_LOCKED) |
| 426 | return -EACCES; | 372 | return -EACCES; |
| 427 | if (c->irq.Attributes != req->Attributes) { | 373 | if (c->irq.Attributes != req->Attributes) { |
| 428 | ds_dbg(s, 0, "IRQ attributes must match assigned ones\n"); | 374 | dev_dbg(&s->dev, "IRQ attributes must match assigned ones\n"); |
| 429 | return -EINVAL; | 375 | return -EINVAL; |
| 430 | } | 376 | } |
| 431 | if (s->irq.AssignedIRQ != req->AssignedIRQ) { | 377 | if (s->irq.AssignedIRQ != req->AssignedIRQ) { |
| 432 | ds_dbg(s, 0, "IRQ must match assigned one\n"); | 378 | dev_dbg(&s->dev, "IRQ must match assigned one\n"); |
| 433 | return -EINVAL; | 379 | return -EINVAL; |
| 434 | } | 380 | } |
| 435 | if (--s->irq.Config == 0) { | 381 | if (--s->irq.Config == 0) { |
| @@ -437,8 +383,8 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
| 437 | s->irq.AssignedIRQ = 0; | 383 | s->irq.AssignedIRQ = 0; |
| 438 | } | 384 | } |
| 439 | 385 | ||
| 440 | if (req->Attributes & IRQ_HANDLE_PRESENT) { | 386 | if (req->Handler) { |
| 441 | free_irq(req->AssignedIRQ, req->Instance); | 387 | free_irq(req->AssignedIRQ, p_dev->priv); |
| 442 | } | 388 | } |
| 443 | 389 | ||
| 444 | #ifdef CONFIG_PCMCIA_PROBE | 390 | #ifdef CONFIG_PCMCIA_PROBE |
| @@ -449,30 +395,34 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
| 449 | } /* pcmcia_release_irq */ | 395 | } /* pcmcia_release_irq */ |
| 450 | 396 | ||
| 451 | 397 | ||
| 452 | int pcmcia_release_window(window_handle_t win) | 398 | int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t wh) |
| 453 | { | 399 | { |
| 454 | struct pcmcia_socket *s; | 400 | struct pcmcia_socket *s = p_dev->socket; |
| 401 | pccard_mem_map *win; | ||
| 455 | 402 | ||
| 456 | if ((win == NULL) || (win->magic != WINDOW_MAGIC)) | 403 | wh--; |
| 404 | if (wh >= MAX_WIN) | ||
| 457 | return -EINVAL; | 405 | return -EINVAL; |
| 458 | s = win->sock; | 406 | |
| 459 | if (!(win->handle->_win & CLIENT_WIN_REQ(win->index))) | 407 | win = &s->win[wh]; |
| 408 | |||
| 409 | if (!(p_dev->_win & CLIENT_WIN_REQ(wh))) { | ||
| 410 | dev_dbg(&s->dev, "not releasing unknown window\n"); | ||
| 460 | return -EINVAL; | 411 | return -EINVAL; |
| 412 | } | ||
| 461 | 413 | ||
| 462 | /* Shut down memory window */ | 414 | /* Shut down memory window */ |
| 463 | win->ctl.flags &= ~MAP_ACTIVE; | 415 | win->flags &= ~MAP_ACTIVE; |
| 464 | s->ops->set_mem_map(s, &win->ctl); | 416 | s->ops->set_mem_map(s, win); |
| 465 | s->state &= ~SOCKET_WIN_REQ(win->index); | 417 | s->state &= ~SOCKET_WIN_REQ(wh); |
| 466 | 418 | ||
| 467 | /* Release system memory */ | 419 | /* Release system memory */ |
| 468 | if (win->ctl.res) { | 420 | if (win->res) { |
| 469 | release_resource(win->ctl.res); | 421 | release_resource(win->res); |
| 470 | kfree(win->ctl.res); | 422 | kfree(win->res); |
| 471 | win->ctl.res = NULL; | 423 | win->res = NULL; |
| 472 | } | 424 | } |
| 473 | win->handle->_win &= ~CLIENT_WIN_REQ(win->index); | 425 | p_dev->_win &= ~CLIENT_WIN_REQ(wh); |
| 474 | |||
| 475 | win->magic = 0; | ||
| 476 | 426 | ||
| 477 | return 0; | 427 | return 0; |
| 478 | } /* pcmcia_release_window */ | 428 | } /* pcmcia_release_window */ |
| @@ -492,12 +442,14 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
| 492 | return -ENODEV; | 442 | return -ENODEV; |
| 493 | 443 | ||
| 494 | if (req->IntType & INT_CARDBUS) { | 444 | if (req->IntType & INT_CARDBUS) { |
| 495 | ds_dbg(p_dev->socket, 0, "IntType may not be INT_CARDBUS\n"); | 445 | dev_dbg(&s->dev, "IntType may not be INT_CARDBUS\n"); |
| 496 | return -EINVAL; | 446 | return -EINVAL; |
| 497 | } | 447 | } |
| 498 | c = p_dev->function_config; | 448 | c = p_dev->function_config; |
| 499 | if (c->state & CONFIG_LOCKED) | 449 | if (c->state & CONFIG_LOCKED) { |
| 450 | dev_dbg(&s->dev, "Configuration is locked\n"); | ||
| 500 | return -EACCES; | 451 | return -EACCES; |
| 452 | } | ||
| 501 | 453 | ||
| 502 | /* Do power control. We don't allow changes in Vcc. */ | 454 | /* Do power control. We don't allow changes in Vcc. */ |
| 503 | s->socket.Vpp = req->Vpp; | 455 | s->socket.Vpp = req->Vpp; |
| @@ -609,40 +561,44 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) | |||
| 609 | struct pcmcia_socket *s = p_dev->socket; | 561 | struct pcmcia_socket *s = p_dev->socket; |
| 610 | config_t *c; | 562 | config_t *c; |
| 611 | 563 | ||
| 612 | if (!(s->state & SOCKET_PRESENT)) | 564 | if (!(s->state & SOCKET_PRESENT)) { |
| 565 | dev_dbg(&s->dev, "No card present\n"); | ||
| 613 | return -ENODEV; | 566 | return -ENODEV; |
| 567 | } | ||
| 614 | 568 | ||
| 615 | if (!req) | 569 | if (!req) |
| 616 | return -EINVAL; | 570 | return -EINVAL; |
| 617 | c = p_dev->function_config; | 571 | c = p_dev->function_config; |
| 618 | if (c->state & CONFIG_LOCKED) | 572 | if (c->state & CONFIG_LOCKED) { |
| 573 | dev_dbg(&s->dev, "Configuration is locked\n"); | ||
| 619 | return -EACCES; | 574 | return -EACCES; |
| 575 | } | ||
| 620 | if (c->state & CONFIG_IO_REQ) { | 576 | if (c->state & CONFIG_IO_REQ) { |
| 621 | ds_dbg(s, 0, "IO already configured\n"); | 577 | dev_dbg(&s->dev, "IO already configured\n"); |
| 622 | return -EBUSY; | 578 | return -EBUSY; |
| 623 | } | 579 | } |
| 624 | if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) { | 580 | if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) { |
| 625 | ds_dbg(s, 0, "bad attribute setting for IO region 1\n"); | 581 | dev_dbg(&s->dev, "bad attribute setting for IO region 1\n"); |
| 626 | return -EINVAL; | 582 | return -EINVAL; |
| 627 | } | 583 | } |
| 628 | if ((req->NumPorts2 > 0) && | 584 | if ((req->NumPorts2 > 0) && |
| 629 | (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) { | 585 | (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) { |
| 630 | ds_dbg(s, 0, "bad attribute setting for IO region 2\n"); | 586 | dev_dbg(&s->dev, "bad attribute setting for IO region 2\n"); |
| 631 | return -EINVAL; | 587 | return -EINVAL; |
| 632 | } | 588 | } |
| 633 | 589 | ||
| 634 | ds_dbg(s, 1, "trying to allocate resource 1\n"); | 590 | dev_dbg(&s->dev, "trying to allocate resource 1\n"); |
| 635 | if (alloc_io_space(s, req->Attributes1, &req->BasePort1, | 591 | if (alloc_io_space(s, req->Attributes1, &req->BasePort1, |
| 636 | req->NumPorts1, req->IOAddrLines)) { | 592 | req->NumPorts1, req->IOAddrLines)) { |
| 637 | ds_dbg(s, 0, "allocation of resource 1 failed\n"); | 593 | dev_dbg(&s->dev, "allocation of resource 1 failed\n"); |
| 638 | return -EBUSY; | 594 | return -EBUSY; |
| 639 | } | 595 | } |
| 640 | 596 | ||
| 641 | if (req->NumPorts2) { | 597 | if (req->NumPorts2) { |
| 642 | ds_dbg(s, 1, "trying to allocate resource 2\n"); | 598 | dev_dbg(&s->dev, "trying to allocate resource 2\n"); |
| 643 | if (alloc_io_space(s, req->Attributes2, &req->BasePort2, | 599 | if (alloc_io_space(s, req->Attributes2, &req->BasePort2, |
| 644 | req->NumPorts2, req->IOAddrLines)) { | 600 | req->NumPorts2, req->IOAddrLines)) { |
| 645 | ds_dbg(s, 0, "allocation of resource 2 failed\n"); | 601 | dev_dbg(&s->dev, "allocation of resource 2 failed\n"); |
| 646 | release_io_space(s, req->BasePort1, req->NumPorts1); | 602 | release_io_space(s, req->BasePort1, req->NumPorts1); |
| 647 | return -EBUSY; | 603 | return -EBUSY; |
| 648 | } | 604 | } |
| @@ -680,13 +636,17 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
| 680 | int ret = -EINVAL, irq = 0; | 636 | int ret = -EINVAL, irq = 0; |
| 681 | int type; | 637 | int type; |
| 682 | 638 | ||
| 683 | if (!(s->state & SOCKET_PRESENT)) | 639 | if (!(s->state & SOCKET_PRESENT)) { |
| 640 | dev_dbg(&s->dev, "No card present\n"); | ||
| 684 | return -ENODEV; | 641 | return -ENODEV; |
| 642 | } | ||
| 685 | c = p_dev->function_config; | 643 | c = p_dev->function_config; |
| 686 | if (c->state & CONFIG_LOCKED) | 644 | if (c->state & CONFIG_LOCKED) { |
| 645 | dev_dbg(&s->dev, "Configuration is locked\n"); | ||
| 687 | return -EACCES; | 646 | return -EACCES; |
| 647 | } | ||
| 688 | if (c->state & CONFIG_IRQ_REQ) { | 648 | if (c->state & CONFIG_IRQ_REQ) { |
| 689 | ds_dbg(s, 0, "IRQ already configured\n"); | 649 | dev_dbg(&s->dev, "IRQ already configured\n"); |
| 690 | return -EBUSY; | 650 | return -EBUSY; |
| 691 | } | 651 | } |
| 692 | 652 | ||
| @@ -704,7 +664,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
| 704 | /* if the underlying IRQ infrastructure allows for it, only allocate | 664 | /* if the underlying IRQ infrastructure allows for it, only allocate |
| 705 | * the IRQ, but do not enable it | 665 | * the IRQ, but do not enable it |
| 706 | */ | 666 | */ |
| 707 | if (!(req->Attributes & IRQ_HANDLE_PRESENT)) | 667 | if (!(req->Handler)) |
| 708 | type |= IRQ_NOAUTOEN; | 668 | type |= IRQ_NOAUTOEN; |
| 709 | #endif /* IRQ_NOAUTOEN */ | 669 | #endif /* IRQ_NOAUTOEN */ |
| 710 | 670 | ||
| @@ -714,7 +674,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
| 714 | } else { | 674 | } else { |
| 715 | int try; | 675 | int try; |
| 716 | u32 mask = s->irq_mask; | 676 | u32 mask = s->irq_mask; |
| 717 | void *data = &p_dev->dev.driver; /* something unique to this device */ | 677 | void *data = p_dev; /* something unique to this device */ |
| 718 | 678 | ||
| 719 | for (try = 0; try < 64; try++) { | 679 | for (try = 0; try < 64; try++) { |
| 720 | irq = try % 32; | 680 | irq = try % 32; |
| @@ -731,12 +691,12 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
| 731 | * registering a dummy handle works, i.e. if the IRQ isn't | 691 | * registering a dummy handle works, i.e. if the IRQ isn't |
| 732 | * marked as used by the kernel resource management core */ | 692 | * marked as used by the kernel resource management core */ |
| 733 | ret = request_irq(irq, | 693 | ret = request_irq(irq, |
| 734 | (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Handler : test_action, | 694 | (req->Handler) ? req->Handler : test_action, |
| 735 | type, | 695 | type, |
| 736 | p_dev->devname, | 696 | p_dev->devname, |
| 737 | (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Instance : data); | 697 | (req->Handler) ? p_dev->priv : data); |
| 738 | if (!ret) { | 698 | if (!ret) { |
| 739 | if (!(req->Attributes & IRQ_HANDLE_PRESENT)) | 699 | if (!req->Handler) |
| 740 | free_irq(irq, data); | 700 | free_irq(irq, data); |
| 741 | break; | 701 | break; |
| 742 | } | 702 | } |
| @@ -745,17 +705,22 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
| 745 | #endif | 705 | #endif |
| 746 | /* only assign PCI irq if no IRQ already assigned */ | 706 | /* only assign PCI irq if no IRQ already assigned */ |
| 747 | if (ret && !s->irq.AssignedIRQ) { | 707 | if (ret && !s->irq.AssignedIRQ) { |
| 748 | if (!s->pci_irq) | 708 | if (!s->pci_irq) { |
| 709 | dev_printk(KERN_INFO, &s->dev, "no IRQ found\n"); | ||
| 749 | return ret; | 710 | return ret; |
| 711 | } | ||
| 750 | type = IRQF_SHARED; | 712 | type = IRQF_SHARED; |
| 751 | irq = s->pci_irq; | 713 | irq = s->pci_irq; |
| 752 | } | 714 | } |
| 753 | 715 | ||
| 754 | if (ret && (req->Attributes & IRQ_HANDLE_PRESENT)) { | 716 | if (ret && req->Handler) { |
| 755 | ret = request_irq(irq, req->Handler, type, | 717 | ret = request_irq(irq, req->Handler, type, |
| 756 | p_dev->devname, req->Instance); | 718 | p_dev->devname, p_dev->priv); |
| 757 | if (ret) | 719 | if (ret) { |
| 720 | dev_printk(KERN_INFO, &s->dev, | ||
| 721 | "request_irq() failed\n"); | ||
| 758 | return ret; | 722 | return ret; |
| 723 | } | ||
| 759 | } | 724 | } |
| 760 | 725 | ||
| 761 | /* Make sure the fact the request type was overridden is passed back */ | 726 | /* Make sure the fact the request type was overridden is passed back */ |
| @@ -787,17 +752,19 @@ EXPORT_SYMBOL(pcmcia_request_irq); | |||
| 787 | * Request_window() establishes a mapping between card memory space | 752 | * Request_window() establishes a mapping between card memory space |
| 788 | * and system memory space. | 753 | * and system memory space. |
| 789 | */ | 754 | */ |
| 790 | int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh) | 755 | int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_handle_t *wh) |
| 791 | { | 756 | { |
| 792 | struct pcmcia_socket *s = (*p_dev)->socket; | 757 | struct pcmcia_socket *s = p_dev->socket; |
| 793 | window_t *win; | 758 | pccard_mem_map *win; |
| 794 | u_long align; | 759 | u_long align; |
| 795 | int w; | 760 | int w; |
| 796 | 761 | ||
| 797 | if (!(s->state & SOCKET_PRESENT)) | 762 | if (!(s->state & SOCKET_PRESENT)) { |
| 763 | dev_dbg(&s->dev, "No card present\n"); | ||
| 798 | return -ENODEV; | 764 | return -ENODEV; |
| 765 | } | ||
| 799 | if (req->Attributes & (WIN_PAGED | WIN_SHARED)) { | 766 | if (req->Attributes & (WIN_PAGED | WIN_SHARED)) { |
| 800 | ds_dbg(s, 0, "bad attribute setting for iomem region\n"); | 767 | dev_dbg(&s->dev, "bad attribute setting for iomem region\n"); |
| 801 | return -EINVAL; | 768 | return -EINVAL; |
| 802 | } | 769 | } |
| 803 | 770 | ||
| @@ -808,12 +775,12 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h | |||
| 808 | (req->Attributes & WIN_STRICT_ALIGN)) ? | 775 | (req->Attributes & WIN_STRICT_ALIGN)) ? |
| 809 | req->Size : s->map_size); | 776 | req->Size : s->map_size); |
| 810 | if (req->Size & (s->map_size-1)) { | 777 | if (req->Size & (s->map_size-1)) { |
| 811 | ds_dbg(s, 0, "invalid map size\n"); | 778 | dev_dbg(&s->dev, "invalid map size\n"); |
| 812 | return -EINVAL; | 779 | return -EINVAL; |
| 813 | } | 780 | } |
| 814 | if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || | 781 | if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || |
| 815 | (req->Base & (align-1))) { | 782 | (req->Base & (align-1))) { |
| 816 | ds_dbg(s, 0, "invalid base address\n"); | 783 | dev_dbg(&s->dev, "invalid base address\n"); |
| 817 | return -EINVAL; | 784 | return -EINVAL; |
| 818 | } | 785 | } |
| 819 | if (req->Base) | 786 | if (req->Base) |
| @@ -823,52 +790,48 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h | |||
| 823 | for (w = 0; w < MAX_WIN; w++) | 790 | for (w = 0; w < MAX_WIN; w++) |
| 824 | if (!(s->state & SOCKET_WIN_REQ(w))) break; | 791 | if (!(s->state & SOCKET_WIN_REQ(w))) break; |
| 825 | if (w == MAX_WIN) { | 792 | if (w == MAX_WIN) { |
| 826 | ds_dbg(s, 0, "all windows are used already\n"); | 793 | dev_dbg(&s->dev, "all windows are used already\n"); |
| 827 | return -EINVAL; | 794 | return -EINVAL; |
| 828 | } | 795 | } |
| 829 | 796 | ||
| 830 | win = &s->win[w]; | 797 | win = &s->win[w]; |
| 831 | win->magic = WINDOW_MAGIC; | ||
| 832 | win->index = w; | ||
| 833 | win->handle = *p_dev; | ||
| 834 | win->sock = s; | ||
| 835 | 798 | ||
| 836 | if (!(s->features & SS_CAP_STATIC_MAP)) { | 799 | if (!(s->features & SS_CAP_STATIC_MAP)) { |
| 837 | win->ctl.res = pcmcia_find_mem_region(req->Base, req->Size, align, | 800 | win->res = pcmcia_find_mem_region(req->Base, req->Size, align, |
| 838 | (req->Attributes & WIN_MAP_BELOW_1MB), s); | 801 | (req->Attributes & WIN_MAP_BELOW_1MB), s); |
| 839 | if (!win->ctl.res) { | 802 | if (!win->res) { |
| 840 | ds_dbg(s, 0, "allocating mem region failed\n"); | 803 | dev_dbg(&s->dev, "allocating mem region failed\n"); |
| 841 | return -EINVAL; | 804 | return -EINVAL; |
| 842 | } | 805 | } |
| 843 | } | 806 | } |
| 844 | (*p_dev)->_win |= CLIENT_WIN_REQ(w); | 807 | p_dev->_win |= CLIENT_WIN_REQ(w); |
| 845 | 808 | ||
| 846 | /* Configure the socket controller */ | 809 | /* Configure the socket controller */ |
| 847 | win->ctl.map = w+1; | 810 | win->map = w+1; |
| 848 | win->ctl.flags = 0; | 811 | win->flags = 0; |
| 849 | win->ctl.speed = req->AccessSpeed; | 812 | win->speed = req->AccessSpeed; |
| 850 | if (req->Attributes & WIN_MEMORY_TYPE) | 813 | if (req->Attributes & WIN_MEMORY_TYPE) |
| 851 | win->ctl.flags |= MAP_ATTRIB; | 814 | win->flags |= MAP_ATTRIB; |
| 852 | if (req->Attributes & WIN_ENABLE) | 815 | if (req->Attributes & WIN_ENABLE) |
| 853 | win->ctl.flags |= MAP_ACTIVE; | 816 | win->flags |= MAP_ACTIVE; |
| 854 | if (req->Attributes & WIN_DATA_WIDTH_16) | 817 | if (req->Attributes & WIN_DATA_WIDTH_16) |
| 855 | win->ctl.flags |= MAP_16BIT; | 818 | win->flags |= MAP_16BIT; |
| 856 | if (req->Attributes & WIN_USE_WAIT) | 819 | if (req->Attributes & WIN_USE_WAIT) |
| 857 | win->ctl.flags |= MAP_USE_WAIT; | 820 | win->flags |= MAP_USE_WAIT; |
| 858 | win->ctl.card_start = 0; | 821 | win->card_start = 0; |
| 859 | if (s->ops->set_mem_map(s, &win->ctl) != 0) { | 822 | if (s->ops->set_mem_map(s, win) != 0) { |
| 860 | ds_dbg(s, 0, "failed to set memory mapping\n"); | 823 | dev_dbg(&s->dev, "failed to set memory mapping\n"); |
| 861 | return -EIO; | 824 | return -EIO; |
| 862 | } | 825 | } |
| 863 | s->state |= SOCKET_WIN_REQ(w); | 826 | s->state |= SOCKET_WIN_REQ(w); |
| 864 | 827 | ||
| 865 | /* Return window handle */ | 828 | /* Return window handle */ |
| 866 | if (s->features & SS_CAP_STATIC_MAP) { | 829 | if (s->features & SS_CAP_STATIC_MAP) { |
| 867 | req->Base = win->ctl.static_start; | 830 | req->Base = win->static_start; |
| 868 | } else { | 831 | } else { |
| 869 | req->Base = win->ctl.res->start; | 832 | req->Base = win->res->start; |
| 870 | } | 833 | } |
| 871 | *wh = win; | 834 | *wh = w + 1; |
| 872 | 835 | ||
| 873 | return 0; | 836 | return 0; |
| 874 | } /* pcmcia_request_window */ | 837 | } /* pcmcia_request_window */ |
| @@ -879,19 +842,46 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev) { | |||
| 879 | pcmcia_release_io(p_dev, &p_dev->io); | 842 | pcmcia_release_io(p_dev, &p_dev->io); |
| 880 | pcmcia_release_irq(p_dev, &p_dev->irq); | 843 | pcmcia_release_irq(p_dev, &p_dev->irq); |
| 881 | if (p_dev->win) | 844 | if (p_dev->win) |
| 882 | pcmcia_release_window(p_dev->win); | 845 | pcmcia_release_window(p_dev, p_dev->win); |
| 883 | } | 846 | } |
| 884 | EXPORT_SYMBOL(pcmcia_disable_device); | 847 | EXPORT_SYMBOL(pcmcia_disable_device); |
| 885 | 848 | ||
| 886 | 849 | ||
| 887 | struct pcmcia_cfg_mem { | 850 | struct pcmcia_cfg_mem { |
| 888 | tuple_t tuple; | 851 | struct pcmcia_device *p_dev; |
| 852 | void *priv_data; | ||
| 853 | int (*conf_check) (struct pcmcia_device *p_dev, | ||
| 854 | cistpl_cftable_entry_t *cfg, | ||
| 855 | cistpl_cftable_entry_t *dflt, | ||
| 856 | unsigned int vcc, | ||
| 857 | void *priv_data); | ||
| 889 | cisparse_t parse; | 858 | cisparse_t parse; |
| 890 | u8 buf[256]; | ||
| 891 | cistpl_cftable_entry_t dflt; | 859 | cistpl_cftable_entry_t dflt; |
| 892 | }; | 860 | }; |
| 893 | 861 | ||
| 894 | /** | 862 | /** |
| 863 | * pcmcia_do_loop_config() - internal helper for pcmcia_loop_config() | ||
| 864 | * | ||
| 865 | * pcmcia_do_loop_config() is the internal callback for the call from | ||
| 866 | * pcmcia_loop_config() to pccard_loop_tuple(). Data is transferred | ||
| 867 | * by a struct pcmcia_cfg_mem. | ||
| 868 | */ | ||
| 869 | static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv) | ||
| 870 | { | ||
| 871 | cistpl_cftable_entry_t *cfg = &parse->cftable_entry; | ||
| 872 | struct pcmcia_cfg_mem *cfg_mem = priv; | ||
| 873 | |||
| 874 | /* default values */ | ||
| 875 | cfg_mem->p_dev->conf.ConfigIndex = cfg->index; | ||
| 876 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 877 | cfg_mem->dflt = *cfg; | ||
| 878 | |||
| 879 | return cfg_mem->conf_check(cfg_mem->p_dev, cfg, &cfg_mem->dflt, | ||
| 880 | cfg_mem->p_dev->socket->socket.Vcc, | ||
| 881 | cfg_mem->priv_data); | ||
| 882 | } | ||
| 883 | |||
| 884 | /** | ||
| 895 | * pcmcia_loop_config() - loop over configuration options | 885 | * pcmcia_loop_config() - loop over configuration options |
| 896 | * @p_dev: the struct pcmcia_device which we need to loop for. | 886 | * @p_dev: the struct pcmcia_device which we need to loop for. |
| 897 | * @conf_check: function to call for each configuration option. | 887 | * @conf_check: function to call for each configuration option. |
| @@ -913,48 +903,174 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, | |||
| 913 | void *priv_data) | 903 | void *priv_data) |
| 914 | { | 904 | { |
| 915 | struct pcmcia_cfg_mem *cfg_mem; | 905 | struct pcmcia_cfg_mem *cfg_mem; |
| 916 | |||
| 917 | tuple_t *tuple; | ||
| 918 | int ret; | 906 | int ret; |
| 919 | unsigned int vcc; | ||
| 920 | 907 | ||
| 921 | cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL); | 908 | cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL); |
| 922 | if (cfg_mem == NULL) | 909 | if (cfg_mem == NULL) |
| 923 | return -ENOMEM; | 910 | return -ENOMEM; |
| 924 | 911 | ||
| 925 | /* get the current Vcc setting */ | 912 | cfg_mem->p_dev = p_dev; |
| 926 | vcc = p_dev->socket->socket.Vcc; | 913 | cfg_mem->conf_check = conf_check; |
| 914 | cfg_mem->priv_data = priv_data; | ||
| 927 | 915 | ||
| 928 | tuple = &cfg_mem->tuple; | 916 | ret = pccard_loop_tuple(p_dev->socket, p_dev->func, |
| 929 | tuple->TupleData = cfg_mem->buf; | 917 | CISTPL_CFTABLE_ENTRY, &cfg_mem->parse, |
| 930 | tuple->TupleDataMax = 255; | 918 | cfg_mem, pcmcia_do_loop_config); |
| 931 | tuple->TupleOffset = 0; | ||
| 932 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 933 | tuple->Attributes = 0; | ||
| 934 | 919 | ||
| 935 | ret = pcmcia_get_first_tuple(p_dev, tuple); | 920 | kfree(cfg_mem); |
| 936 | while (!ret) { | 921 | return ret; |
| 937 | cistpl_cftable_entry_t *cfg = &cfg_mem->parse.cftable_entry; | 922 | } |
| 923 | EXPORT_SYMBOL(pcmcia_loop_config); | ||
| 924 | |||
| 925 | |||
| 926 | struct pcmcia_loop_mem { | ||
| 927 | struct pcmcia_device *p_dev; | ||
| 928 | void *priv_data; | ||
| 929 | int (*loop_tuple) (struct pcmcia_device *p_dev, | ||
| 930 | tuple_t *tuple, | ||
| 931 | void *priv_data); | ||
| 932 | }; | ||
| 933 | |||
| 934 | /** | ||
| 935 | * pcmcia_do_loop_tuple() - internal helper for pcmcia_loop_config() | ||
| 936 | * | ||
| 937 | * pcmcia_do_loop_tuple() is the internal callback for the call from | ||
| 938 | * pcmcia_loop_tuple() to pccard_loop_tuple(). Data is transferred | ||
| 939 | * by a struct pcmcia_cfg_mem. | ||
| 940 | */ | ||
| 941 | static int pcmcia_do_loop_tuple(tuple_t *tuple, cisparse_t *parse, void *priv) | ||
| 942 | { | ||
| 943 | struct pcmcia_loop_mem *loop = priv; | ||
| 944 | |||
| 945 | return loop->loop_tuple(loop->p_dev, tuple, loop->priv_data); | ||
| 946 | }; | ||
| 947 | |||
| 948 | /** | ||
| 949 | * pcmcia_loop_tuple() - loop over tuples in the CIS | ||
| 950 | * @p_dev: the struct pcmcia_device which we need to loop for. | ||
| 951 | * @code: which CIS code shall we look for? | ||
| 952 | * @priv_data: private data to be passed to the loop_tuple function. | ||
| 953 | * @loop_tuple: function to call for each CIS entry of type @function. IT | ||
| 954 | * gets passed the raw tuple and @priv_data. | ||
| 955 | * | ||
| 956 | * pcmcia_loop_tuple() loops over all CIS entries of type @function, and | ||
| 957 | * calls the @loop_tuple function for each entry. If the call to @loop_tuple | ||
| 958 | * returns 0, the loop exits. Returns 0 on success or errorcode otherwise. | ||
| 959 | */ | ||
| 960 | int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code, | ||
| 961 | int (*loop_tuple) (struct pcmcia_device *p_dev, | ||
| 962 | tuple_t *tuple, | ||
| 963 | void *priv_data), | ||
| 964 | void *priv_data) | ||
| 965 | { | ||
| 966 | struct pcmcia_loop_mem loop = { | ||
| 967 | .p_dev = p_dev, | ||
| 968 | .loop_tuple = loop_tuple, | ||
| 969 | .priv_data = priv_data}; | ||
| 938 | 970 | ||
| 939 | if (pcmcia_get_tuple_data(p_dev, tuple)) | 971 | return pccard_loop_tuple(p_dev->socket, p_dev->func, code, NULL, |
| 940 | goto next_entry; | 972 | &loop, pcmcia_do_loop_tuple); |
| 973 | }; | ||
| 974 | EXPORT_SYMBOL(pcmcia_loop_tuple); | ||
| 941 | 975 | ||
| 942 | if (pcmcia_parse_tuple(tuple, &cfg_mem->parse)) | ||
| 943 | goto next_entry; | ||
| 944 | 976 | ||
| 945 | /* default values */ | 977 | struct pcmcia_loop_get { |
| 946 | p_dev->conf.ConfigIndex = cfg->index; | 978 | size_t len; |
| 947 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | 979 | cisdata_t **buf; |
| 948 | cfg_mem->dflt = *cfg; | 980 | }; |
| 949 | 981 | ||
| 950 | ret = conf_check(p_dev, cfg, &cfg_mem->dflt, vcc, priv_data); | 982 | /** |
| 951 | if (!ret) | 983 | * pcmcia_do_get_tuple() - internal helper for pcmcia_get_tuple() |
| 952 | break; | 984 | * |
| 985 | * pcmcia_do_get_tuple() is the internal callback for the call from | ||
| 986 | * pcmcia_get_tuple() to pcmcia_loop_tuple(). As we're only interested in | ||
| 987 | * the first tuple, return 0 unconditionally. Create a memory buffer large | ||
| 988 | * enough to hold the content of the tuple, and fill it with the tuple data. | ||
| 989 | * The caller is responsible to free the buffer. | ||
| 990 | */ | ||
| 991 | static int pcmcia_do_get_tuple(struct pcmcia_device *p_dev, tuple_t *tuple, | ||
| 992 | void *priv) | ||
| 993 | { | ||
| 994 | struct pcmcia_loop_get *get = priv; | ||
| 995 | |||
| 996 | *get->buf = kzalloc(tuple->TupleDataLen, GFP_KERNEL); | ||
| 997 | if (*get->buf) { | ||
| 998 | get->len = tuple->TupleDataLen; | ||
| 999 | memcpy(*get->buf, tuple->TupleData, tuple->TupleDataLen); | ||
| 1000 | } else | ||
| 1001 | dev_dbg(&p_dev->dev, "do_get_tuple: out of memory\n"); | ||
| 1002 | return 0; | ||
| 1003 | }; | ||
| 953 | 1004 | ||
| 954 | next_entry: | 1005 | /** |
| 955 | ret = pcmcia_get_next_tuple(p_dev, tuple); | 1006 | * pcmcia_get_tuple() - get first tuple from CIS |
| 1007 | * @p_dev: the struct pcmcia_device which we need to loop for. | ||
| 1008 | * @code: which CIS code shall we look for? | ||
| 1009 | * @buf: pointer to store the buffer to. | ||
| 1010 | * | ||
| 1011 | * pcmcia_get_tuple() gets the content of the first CIS entry of type @code. | ||
| 1012 | * It returns the buffer length (or zero). The caller is responsible to free | ||
| 1013 | * the buffer passed in @buf. | ||
| 1014 | */ | ||
| 1015 | size_t pcmcia_get_tuple(struct pcmcia_device *p_dev, cisdata_t code, | ||
| 1016 | unsigned char **buf) | ||
| 1017 | { | ||
| 1018 | struct pcmcia_loop_get get = { | ||
| 1019 | .len = 0, | ||
| 1020 | .buf = buf, | ||
| 1021 | }; | ||
| 1022 | |||
| 1023 | *get.buf = NULL; | ||
| 1024 | pcmcia_loop_tuple(p_dev, code, pcmcia_do_get_tuple, &get); | ||
| 1025 | |||
| 1026 | return get.len; | ||
| 1027 | }; | ||
| 1028 | EXPORT_SYMBOL(pcmcia_get_tuple); | ||
| 1029 | |||
| 1030 | |||
| 1031 | /** | ||
| 1032 | * pcmcia_do_get_mac() - internal helper for pcmcia_get_mac_from_cis() | ||
| 1033 | * | ||
| 1034 | * pcmcia_do_get_mac() is the internal callback for the call from | ||
| 1035 | * pcmcia_get_mac_from_cis() to pcmcia_loop_tuple(). We check whether the | ||
| 1036 | * tuple contains a proper LAN_NODE_ID of length 6, and copy the data | ||
| 1037 | * to struct net_device->dev_addr[i]. | ||
| 1038 | */ | ||
| 1039 | static int pcmcia_do_get_mac(struct pcmcia_device *p_dev, tuple_t *tuple, | ||
| 1040 | void *priv) | ||
| 1041 | { | ||
| 1042 | struct net_device *dev = priv; | ||
| 1043 | int i; | ||
| 1044 | |||
| 1045 | if (tuple->TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID) | ||
| 1046 | return -EINVAL; | ||
| 1047 | if (tuple->TupleDataLen < ETH_ALEN + 2) { | ||
| 1048 | dev_warn(&p_dev->dev, "Invalid CIS tuple length for " | ||
| 1049 | "LAN_NODE_ID\n"); | ||
| 1050 | return -EINVAL; | ||
| 956 | } | 1051 | } |
| 957 | 1052 | ||
| 958 | return ret; | 1053 | if (tuple->TupleData[1] != ETH_ALEN) { |
| 959 | } | 1054 | dev_warn(&p_dev->dev, "Invalid header for LAN_NODE_ID\n"); |
| 960 | EXPORT_SYMBOL(pcmcia_loop_config); | 1055 | return -EINVAL; |
| 1056 | } | ||
| 1057 | for (i = 0; i < 6; i++) | ||
| 1058 | dev->dev_addr[i] = tuple->TupleData[i+2]; | ||
| 1059 | return 0; | ||
| 1060 | }; | ||
| 1061 | |||
| 1062 | /** | ||
| 1063 | * pcmcia_get_mac_from_cis() - read out MAC address from CISTPL_FUNCE | ||
| 1064 | * @p_dev: the struct pcmcia_device for which we want the address. | ||
| 1065 | * @dev: a properly prepared struct net_device to store the info to. | ||
| 1066 | * | ||
| 1067 | * pcmcia_get_mac_from_cis() reads out the hardware MAC address from | ||
| 1068 | * CISTPL_FUNCE and stores it into struct net_device *dev->dev_addr which | ||
| 1069 | * must be set up properly by the driver (see examples!). | ||
| 1070 | */ | ||
| 1071 | int pcmcia_get_mac_from_cis(struct pcmcia_device *p_dev, struct net_device *dev) | ||
| 1072 | { | ||
| 1073 | return pcmcia_loop_tuple(p_dev, CISTPL_FUNCE, pcmcia_do_get_mac, dev); | ||
| 1074 | }; | ||
| 1075 | EXPORT_SYMBOL(pcmcia_get_mac_from_cis); | ||
| 1076 | |||
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 70a33468bcd0..e1741cd875aa 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
| @@ -213,7 +213,8 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev) | |||
| 213 | 213 | ||
| 214 | if (csc & I365_CSC_DETECT) { | 214 | if (csc & I365_CSC_DETECT) { |
| 215 | events |= SS_DETECT; | 215 | events |= SS_DETECT; |
| 216 | dprintk("Card detected in socket %i!\n", i); | 216 | dev_vdbg(&socket[i].socket.dev, |
| 217 | "Card detected in socket %i!\n", i); | ||
| 217 | } | 218 | } |
| 218 | 219 | ||
| 219 | if (indirect_read(&socket[i], I365_INTCTL) | 220 | if (indirect_read(&socket[i], I365_INTCTL) |
| @@ -331,11 +332,11 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
| 331 | reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */ | 332 | reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */ |
| 332 | 333 | ||
| 333 | if (state->flags & SS_PWR_AUTO) { | 334 | if (state->flags & SS_PWR_AUTO) { |
| 334 | dprintk("Auto power\n"); | 335 | dev_dbg(&sock->dev, "Auto power\n"); |
| 335 | reg |= I365_PWR_AUTO; /* automatic power mngmnt */ | 336 | reg |= I365_PWR_AUTO; /* automatic power mngmnt */ |
| 336 | } | 337 | } |
| 337 | if (state->flags & SS_OUTPUT_ENA) { | 338 | if (state->flags & SS_OUTPUT_ENA) { |
| 338 | dprintk("Power Enabled\n"); | 339 | dev_dbg(&sock->dev, "Power Enabled\n"); |
| 339 | reg |= I365_PWR_OUT; /* enable power */ | 340 | reg |= I365_PWR_OUT; /* enable power */ |
| 340 | } | 341 | } |
| 341 | 342 | ||
| @@ -343,40 +344,44 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
| 343 | case 0: | 344 | case 0: |
| 344 | break; | 345 | break; |
| 345 | case 33: | 346 | case 33: |
| 346 | dprintk("setting voltage to Vcc to 3.3V on socket %i\n", | 347 | dev_dbg(&sock->dev, |
| 348 | "setting voltage to Vcc to 3.3V on socket %i\n", | ||
| 347 | socket->number); | 349 | socket->number); |
| 348 | reg |= I365_VCC_5V; | 350 | reg |= I365_VCC_5V; |
| 349 | indirect_setbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); | 351 | indirect_setbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); |
| 350 | break; | 352 | break; |
| 351 | case 50: | 353 | case 50: |
| 352 | dprintk("setting voltage to Vcc to 5V on socket %i\n", | 354 | dev_dbg(&sock->dev, |
| 355 | "setting voltage to Vcc to 5V on socket %i\n", | ||
| 353 | socket->number); | 356 | socket->number); |
| 354 | reg |= I365_VCC_5V; | 357 | reg |= I365_VCC_5V; |
| 355 | indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); | 358 | indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); |
| 356 | break; | 359 | break; |
| 357 | default: | 360 | default: |
| 358 | dprintk("pd6729: pd6729_set_socket called with " | 361 | dev_dbg(&sock->dev, |
| 359 | "invalid VCC power value: %i\n", | 362 | "pd6729_set_socket called with invalid VCC power " |
| 360 | state->Vcc); | 363 | "value: %i\n", state->Vcc); |
| 361 | return -EINVAL; | 364 | return -EINVAL; |
| 362 | } | 365 | } |
| 363 | 366 | ||
| 364 | switch (state->Vpp) { | 367 | switch (state->Vpp) { |
| 365 | case 0: | 368 | case 0: |
| 366 | dprintk("not setting Vpp on socket %i\n", socket->number); | 369 | dev_dbg(&sock->dev, "not setting Vpp on socket %i\n", |
| 370 | socket->number); | ||
| 367 | break; | 371 | break; |
| 368 | case 33: | 372 | case 33: |
| 369 | case 50: | 373 | case 50: |
| 370 | dprintk("setting Vpp to Vcc for socket %i\n", socket->number); | 374 | dev_dbg(&sock->dev, "setting Vpp to Vcc for socket %i\n", |
| 375 | socket->number); | ||
| 371 | reg |= I365_VPP1_5V; | 376 | reg |= I365_VPP1_5V; |
| 372 | break; | 377 | break; |
| 373 | case 120: | 378 | case 120: |
| 374 | dprintk("setting Vpp to 12.0\n"); | 379 | dev_dbg(&sock->dev, "setting Vpp to 12.0\n"); |
| 375 | reg |= I365_VPP1_12V; | 380 | reg |= I365_VPP1_12V; |
| 376 | break; | 381 | break; |
| 377 | default: | 382 | default: |
| 378 | dprintk("pd6729: pd6729_set_socket called with invalid VPP power value: %i\n", | 383 | dev_dbg(&sock->dev, "pd6729: pd6729_set_socket called with " |
| 379 | state->Vpp); | 384 | "invalid VPP power value: %i\n", state->Vpp); |
| 380 | return -EINVAL; | 385 | return -EINVAL; |
| 381 | } | 386 | } |
| 382 | 387 | ||
| @@ -438,7 +443,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, | |||
| 438 | 443 | ||
| 439 | /* Check error conditions */ | 444 | /* Check error conditions */ |
| 440 | if (map > 1) { | 445 | if (map > 1) { |
| 441 | dprintk("pd6729_set_io_map with invalid map"); | 446 | dev_dbg(&sock->dev, "pd6729_set_io_map with invalid map\n"); |
| 442 | return -EINVAL; | 447 | return -EINVAL; |
| 443 | } | 448 | } |
| 444 | 449 | ||
| @@ -446,7 +451,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, | |||
| 446 | if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map)) | 451 | if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map)) |
| 447 | indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map)); | 452 | indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map)); |
| 448 | 453 | ||
| 449 | /* dprintk("set_io_map: Setting range to %x - %x\n", | 454 | /* dev_dbg(&sock->dev, "set_io_map: Setting range to %x - %x\n", |
| 450 | io->start, io->stop);*/ | 455 | io->start, io->stop);*/ |
| 451 | 456 | ||
| 452 | /* write the new values */ | 457 | /* write the new values */ |
| @@ -478,12 +483,12 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, | |||
| 478 | 483 | ||
| 479 | map = mem->map; | 484 | map = mem->map; |
| 480 | if (map > 4) { | 485 | if (map > 4) { |
| 481 | printk("pd6729_set_mem_map: invalid map"); | 486 | dev_warn(&sock->dev, "invalid map requested\n"); |
| 482 | return -EINVAL; | 487 | return -EINVAL; |
| 483 | } | 488 | } |
| 484 | 489 | ||
| 485 | if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) { | 490 | if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) { |
| 486 | printk("pd6729_set_mem_map: invalid address / speed"); | 491 | dev_warn(&sock->dev, "invalid invalid address / speed\n"); |
| 487 | return -EINVAL; | 492 | return -EINVAL; |
| 488 | } | 493 | } |
| 489 | 494 | ||
| @@ -529,12 +534,12 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, | |||
| 529 | if (mem->flags & MAP_WRPROT) | 534 | if (mem->flags & MAP_WRPROT) |
| 530 | i |= I365_MEM_WRPROT; | 535 | i |= I365_MEM_WRPROT; |
| 531 | if (mem->flags & MAP_ATTRIB) { | 536 | if (mem->flags & MAP_ATTRIB) { |
| 532 | /* dprintk("requesting attribute memory for socket %i\n", | 537 | /* dev_dbg(&sock->dev, "requesting attribute memory for " |
| 533 | socket->number);*/ | 538 | "socket %i\n", socket->number);*/ |
| 534 | i |= I365_MEM_REG; | 539 | i |= I365_MEM_REG; |
| 535 | } else { | 540 | } else { |
| 536 | /* dprintk("requesting normal memory for socket %i\n", | 541 | /* dev_dbg(&sock->dev, "requesting normal memory for " |
| 537 | socket->number);*/ | 542 | "socket %i\n", socket->number);*/ |
| 538 | } | 543 | } |
| 539 | indirect_write16(socket, base + I365_W_OFF, i); | 544 | indirect_write16(socket, base + I365_W_OFF, i); |
| 540 | 545 | ||
| @@ -577,7 +582,7 @@ static struct pccard_operations pd6729_operations = { | |||
| 577 | 582 | ||
| 578 | static irqreturn_t pd6729_test(int irq, void *dev) | 583 | static irqreturn_t pd6729_test(int irq, void *dev) |
| 579 | { | 584 | { |
| 580 | dprintk("-> hit on irq %d\n", irq); | 585 | pr_devel("-> hit on irq %d\n", irq); |
| 581 | return IRQ_HANDLED; | 586 | return IRQ_HANDLED; |
| 582 | } | 587 | } |
| 583 | 588 | ||
| @@ -642,13 +647,13 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
| 642 | goto err_out_free_mem; | 647 | goto err_out_free_mem; |
| 643 | 648 | ||
| 644 | if (!pci_resource_start(dev, 0)) { | 649 | if (!pci_resource_start(dev, 0)) { |
| 645 | printk(KERN_INFO "pd6729: refusing to load the driver " | 650 | dev_warn(&dev->dev, "refusing to load the driver as the " |
| 646 | "as the io_base is 0.\n"); | 651 | "io_base is NULL.\n"); |
| 647 | goto err_out_free_mem; | 652 | goto err_out_free_mem; |
| 648 | } | 653 | } |
| 649 | 654 | ||
| 650 | printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " | 655 | dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx " |
| 651 | "at 0x%llx on irq %d\n", | 656 | "on irq %d\n", |
| 652 | (unsigned long long)pci_resource_start(dev, 0), dev->irq); | 657 | (unsigned long long)pci_resource_start(dev, 0), dev->irq); |
| 653 | /* | 658 | /* |
| 654 | * Since we have no memory BARs some firmware may not | 659 | * Since we have no memory BARs some firmware may not |
| @@ -656,14 +661,14 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
| 656 | */ | 661 | */ |
| 657 | pci_read_config_byte(dev, PCI_COMMAND, &configbyte); | 662 | pci_read_config_byte(dev, PCI_COMMAND, &configbyte); |
| 658 | if (!(configbyte & PCI_COMMAND_MEMORY)) { | 663 | if (!(configbyte & PCI_COMMAND_MEMORY)) { |
| 659 | printk(KERN_DEBUG "pd6729: Enabling PCI_COMMAND_MEMORY.\n"); | 664 | dev_dbg(&dev->dev, "pd6729: Enabling PCI_COMMAND_MEMORY.\n"); |
| 660 | configbyte |= PCI_COMMAND_MEMORY; | 665 | configbyte |= PCI_COMMAND_MEMORY; |
| 661 | pci_write_config_byte(dev, PCI_COMMAND, configbyte); | 666 | pci_write_config_byte(dev, PCI_COMMAND, configbyte); |
| 662 | } | 667 | } |
| 663 | 668 | ||
| 664 | ret = pci_request_regions(dev, "pd6729"); | 669 | ret = pci_request_regions(dev, "pd6729"); |
| 665 | if (ret) { | 670 | if (ret) { |
| 666 | printk(KERN_INFO "pd6729: pci request region failed.\n"); | 671 | dev_warn(&dev->dev, "pci request region failed.\n"); |
| 667 | goto err_out_disable; | 672 | goto err_out_disable; |
| 668 | } | 673 | } |
| 669 | 674 | ||
| @@ -672,7 +677,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
| 672 | 677 | ||
| 673 | mask = pd6729_isa_scan(); | 678 | mask = pd6729_isa_scan(); |
| 674 | if (irq_mode == 0 && mask == 0) { | 679 | if (irq_mode == 0 && mask == 0) { |
| 675 | printk(KERN_INFO "pd6729: no ISA interrupt is available.\n"); | 680 | dev_warn(&dev->dev, "no ISA interrupt is available.\n"); |
| 676 | goto err_out_free_res; | 681 | goto err_out_free_res; |
| 677 | } | 682 | } |
| 678 | 683 | ||
| @@ -697,8 +702,8 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
| 697 | /* Register the interrupt handler */ | 702 | /* Register the interrupt handler */ |
| 698 | if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, | 703 | if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, |
| 699 | "pd6729", socket))) { | 704 | "pd6729", socket))) { |
| 700 | printk(KERN_ERR "pd6729: Failed to register irq %d, " | 705 | dev_err(&dev->dev, "Failed to register irq %d\n", |
| 701 | "aborting\n", dev->irq); | 706 | dev->irq); |
| 702 | goto err_out_free_res; | 707 | goto err_out_free_res; |
| 703 | } | 708 | } |
| 704 | } else { | 709 | } else { |
| @@ -713,8 +718,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
| 713 | for (i = 0; i < MAX_SOCKETS; i++) { | 718 | for (i = 0; i < MAX_SOCKETS; i++) { |
| 714 | ret = pcmcia_register_socket(&socket[i].socket); | 719 | ret = pcmcia_register_socket(&socket[i].socket); |
| 715 | if (ret) { | 720 | if (ret) { |
| 716 | printk(KERN_INFO "pd6729: pcmcia_register_socket " | 721 | dev_warn(&dev->dev, "pcmcia_register_socket failed.\n"); |
| 717 | "failed.\n"); | ||
| 718 | for (j = 0; j < i ; j++) | 722 | for (j = 0; j < i ; j++) |
| 719 | pcmcia_unregister_socket(&socket[j].socket); | 723 | pcmcia_unregister_socket(&socket[j].socket); |
| 720 | goto err_out_free_res2; | 724 | goto err_out_free_res2; |
diff --git a/drivers/pcmcia/pd6729.h b/drivers/pcmcia/pd6729.h index f392e458cdfd..41418d394c55 100644 --- a/drivers/pcmcia/pd6729.h +++ b/drivers/pcmcia/pd6729.h | |||
| @@ -1,13 +1,6 @@ | |||
| 1 | #ifndef _INCLUDE_GUARD_PD6729_H_ | 1 | #ifndef _INCLUDE_GUARD_PD6729_H_ |
| 2 | #define _INCLUDE_GUARD_PD6729_H_ | 2 | #define _INCLUDE_GUARD_PD6729_H_ |
| 3 | 3 | ||
| 4 | /* Debuging defines */ | ||
| 5 | #ifdef NOTRACE | ||
| 6 | #define dprintk(fmt, args...) printk(fmt , ## args) | ||
| 7 | #else | ||
| 8 | #define dprintk(fmt, args...) do {} while (0) | ||
| 9 | #endif | ||
| 10 | |||
| 11 | /* Flags for I365_GENCTL */ | 4 | /* Flags for I365_GENCTL */ |
| 12 | #define I365_DF_VS1 0x40 /* DF-step Voltage Sense */ | 5 | #define I365_DF_VS1 0x40 /* DF-step Voltage Sense */ |
| 13 | #define I365_DF_VS2 0x80 | 6 | #define I365_DF_VS2 0x80 |
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 0e35acb1366b..84dde7768ad5 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
| @@ -228,9 +228,43 @@ static const char *skt_names[] = { | |||
| 228 | #define SKT_DEV_INFO_SIZE(n) \ | 228 | #define SKT_DEV_INFO_SIZE(n) \ |
| 229 | (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) | 229 | (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) |
| 230 | 230 | ||
| 231 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt) | ||
| 232 | { | ||
| 233 | skt->res_skt.start = _PCMCIA(skt->nr); | ||
| 234 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | ||
| 235 | skt->res_skt.name = skt_names[skt->nr]; | ||
| 236 | skt->res_skt.flags = IORESOURCE_MEM; | ||
| 237 | |||
| 238 | skt->res_io.start = _PCMCIAIO(skt->nr); | ||
| 239 | skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; | ||
| 240 | skt->res_io.name = "io"; | ||
| 241 | skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
| 242 | |||
| 243 | skt->res_mem.start = _PCMCIAMem(skt->nr); | ||
| 244 | skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1; | ||
| 245 | skt->res_mem.name = "memory"; | ||
| 246 | skt->res_mem.flags = IORESOURCE_MEM; | ||
| 247 | |||
| 248 | skt->res_attr.start = _PCMCIAAttr(skt->nr); | ||
| 249 | skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1; | ||
| 250 | skt->res_attr.name = "attribute"; | ||
| 251 | skt->res_attr.flags = IORESOURCE_MEM; | ||
| 252 | |||
| 253 | return soc_pcmcia_add_one(skt); | ||
| 254 | } | ||
| 255 | |||
| 256 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops) | ||
| 257 | { | ||
| 258 | /* Provide our PXA2xx specific timing routines. */ | ||
| 259 | ops->set_timing = pxa2xx_pcmcia_set_timing; | ||
| 260 | #ifdef CONFIG_CPU_FREQ | ||
| 261 | ops->frequency_change = pxa2xx_pcmcia_frequency_change; | ||
| 262 | #endif | ||
| 263 | } | ||
| 264 | |||
| 231 | int __pxa2xx_drv_pcmcia_probe(struct device *dev) | 265 | int __pxa2xx_drv_pcmcia_probe(struct device *dev) |
| 232 | { | 266 | { |
| 233 | int i, ret; | 267 | int i, ret = 0; |
| 234 | struct pcmcia_low_level *ops; | 268 | struct pcmcia_low_level *ops; |
| 235 | struct skt_dev_info *sinfo; | 269 | struct skt_dev_info *sinfo; |
| 236 | struct soc_pcmcia_socket *skt; | 270 | struct soc_pcmcia_socket *skt; |
| @@ -240,6 +274,8 @@ int __pxa2xx_drv_pcmcia_probe(struct device *dev) | |||
| 240 | 274 | ||
| 241 | ops = (struct pcmcia_low_level *)dev->platform_data; | 275 | ops = (struct pcmcia_low_level *)dev->platform_data; |
| 242 | 276 | ||
| 277 | pxa2xx_drv_pcmcia_ops(ops); | ||
| 278 | |||
| 243 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL); | 279 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL); |
| 244 | if (!sinfo) | 280 | if (!sinfo) |
| 245 | return -ENOMEM; | 281 | return -ENOMEM; |
| @@ -250,40 +286,25 @@ int __pxa2xx_drv_pcmcia_probe(struct device *dev) | |||
| 250 | for (i = 0; i < ops->nr; i++) { | 286 | for (i = 0; i < ops->nr; i++) { |
| 251 | skt = &sinfo->skt[i]; | 287 | skt = &sinfo->skt[i]; |
| 252 | 288 | ||
| 253 | skt->nr = ops->first + i; | 289 | skt->nr = ops->first + i; |
| 254 | skt->irq = NO_IRQ; | 290 | skt->ops = ops; |
| 255 | 291 | skt->socket.owner = ops->owner; | |
| 256 | skt->res_skt.start = _PCMCIA(skt->nr); | 292 | skt->socket.dev.parent = dev; |
| 257 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | 293 | skt->socket.pci_irq = NO_IRQ; |
| 258 | skt->res_skt.name = skt_names[skt->nr]; | ||
| 259 | skt->res_skt.flags = IORESOURCE_MEM; | ||
| 260 | |||
| 261 | skt->res_io.start = _PCMCIAIO(skt->nr); | ||
| 262 | skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; | ||
| 263 | skt->res_io.name = "io"; | ||
| 264 | skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
| 265 | 294 | ||
| 266 | skt->res_mem.start = _PCMCIAMem(skt->nr); | 295 | ret = pxa2xx_drv_pcmcia_add_one(skt); |
| 267 | skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1; | 296 | if (ret) |
| 268 | skt->res_mem.name = "memory"; | 297 | break; |
| 269 | skt->res_mem.flags = IORESOURCE_MEM; | ||
| 270 | |||
| 271 | skt->res_attr.start = _PCMCIAAttr(skt->nr); | ||
| 272 | skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1; | ||
| 273 | skt->res_attr.name = "attribute"; | ||
| 274 | skt->res_attr.flags = IORESOURCE_MEM; | ||
| 275 | } | 298 | } |
| 276 | 299 | ||
| 277 | /* Provide our PXA2xx specific timing routines. */ | 300 | if (ret) { |
| 278 | ops->set_timing = pxa2xx_pcmcia_set_timing; | 301 | while (--i >= 0) |
| 279 | #ifdef CONFIG_CPU_FREQ | 302 | soc_pcmcia_remove_one(&sinfo->skt[i]); |
| 280 | ops->frequency_change = pxa2xx_pcmcia_frequency_change; | 303 | kfree(sinfo); |
| 281 | #endif | 304 | } else { |
| 282 | |||
| 283 | ret = soc_common_drv_pcmcia_probe(dev, ops, sinfo); | ||
| 284 | |||
| 285 | if (!ret) | ||
| 286 | pxa2xx_configure_sockets(dev); | 305 | pxa2xx_configure_sockets(dev); |
| 306 | dev_set_drvdata(dev, sinfo); | ||
| 307 | } | ||
| 287 | 308 | ||
| 288 | return ret; | 309 | return ret; |
| 289 | } | 310 | } |
| @@ -297,7 +318,16 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) | |||
| 297 | 318 | ||
| 298 | static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev) | 319 | static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev) |
| 299 | { | 320 | { |
| 300 | return soc_common_drv_pcmcia_remove(&dev->dev); | 321 | struct skt_dev_info *sinfo = platform_get_drvdata(dev); |
| 322 | int i; | ||
| 323 | |||
| 324 | platform_set_drvdata(dev, NULL); | ||
| 325 | |||
| 326 | for (i = 0; i < sinfo->nskt; i++) | ||
| 327 | soc_pcmcia_remove_one(&sinfo->skt[i]); | ||
| 328 | |||
| 329 | kfree(sinfo); | ||
| 330 | return 0; | ||
| 301 | } | 331 | } |
| 302 | 332 | ||
| 303 | static int pxa2xx_drv_pcmcia_suspend(struct device *dev) | 333 | static int pxa2xx_drv_pcmcia_suspend(struct device *dev) |
diff --git a/drivers/pcmcia/pxa2xx_base.h b/drivers/pcmcia/pxa2xx_base.h index 235d681652c3..cb5efaec886f 100644 --- a/drivers/pcmcia/pxa2xx_base.h +++ b/drivers/pcmcia/pxa2xx_base.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | /* temporary measure */ | 1 | /* temporary measure */ |
| 2 | extern int __pxa2xx_drv_pcmcia_probe(struct device *); | 2 | extern int __pxa2xx_drv_pcmcia_probe(struct device *); |
| 3 | 3 | ||
| 4 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); | ||
| 5 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); | ||
| 6 | |||
diff --git a/drivers/pcmcia/pxa2xx_cm_x255.c b/drivers/pcmcia/pxa2xx_cm_x255.c index 5143a760153b..05913d0bbdbe 100644 --- a/drivers/pcmcia/pxa2xx_cm_x255.c +++ b/drivers/pcmcia/pxa2xx_cm_x255.c | |||
| @@ -44,7 +44,7 @@ static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 44 | return ret; | 44 | return ret; |
| 45 | gpio_direction_output(GPIO_PCMCIA_RESET, 0); | 45 | gpio_direction_output(GPIO_PCMCIA_RESET, 0); |
| 46 | 46 | ||
| 47 | skt->irq = skt->nr == 0 ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT; | 47 | skt->socket.pci_irq = skt->nr == 0 ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT; |
| 48 | ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 48 | ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
| 49 | if (!ret) | 49 | if (!ret) |
| 50 | gpio_free(GPIO_PCMCIA_RESET); | 50 | gpio_free(GPIO_PCMCIA_RESET); |
diff --git a/drivers/pcmcia/pxa2xx_cm_x270.c b/drivers/pcmcia/pxa2xx_cm_x270.c index a7b943d01e34..5662646b84da 100644 --- a/drivers/pcmcia/pxa2xx_cm_x270.c +++ b/drivers/pcmcia/pxa2xx_cm_x270.c | |||
| @@ -38,7 +38,7 @@ static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 38 | return ret; | 38 | return ret; |
| 39 | gpio_direction_output(GPIO_PCMCIA_RESET, 0); | 39 | gpio_direction_output(GPIO_PCMCIA_RESET, 0); |
| 40 | 40 | ||
| 41 | skt->irq = PCMCIA_S0_RDYINT; | 41 | skt->socket.pci_irq = PCMCIA_S0_RDYINT; |
| 42 | ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 42 | ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
| 43 | if (!ret) | 43 | if (!ret) |
| 44 | gpio_free(GPIO_PCMCIA_RESET); | 44 | gpio_free(GPIO_PCMCIA_RESET); |
diff --git a/drivers/pcmcia/pxa2xx_e740.c b/drivers/pcmcia/pxa2xx_e740.c index d09c0dc4a31a..8bfbd4dca131 100644 --- a/drivers/pcmcia/pxa2xx_e740.c +++ b/drivers/pcmcia/pxa2xx_e740.c | |||
| @@ -38,7 +38,7 @@ static struct pcmcia_irqs cd_irqs[] = { | |||
| 38 | 38 | ||
| 39 | static int e740_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 39 | static int e740_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
| 40 | { | 40 | { |
| 41 | skt->irq = skt->nr == 0 ? IRQ_GPIO(GPIO_E740_PCMCIA_RDY0) : | 41 | skt->socket.pci_irq = skt->nr == 0 ? IRQ_GPIO(GPIO_E740_PCMCIA_RDY0) : |
| 42 | IRQ_GPIO(GPIO_E740_PCMCIA_RDY1); | 42 | IRQ_GPIO(GPIO_E740_PCMCIA_RDY1); |
| 43 | 43 | ||
| 44 | return soc_pcmcia_request_irqs(skt, &cd_irqs[skt->nr], 1); | 44 | return soc_pcmcia_request_irqs(skt, &cd_irqs[skt->nr], 1); |
diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c index 6cbb1b1f7cfd..b9f8c8fb42bd 100644 --- a/drivers/pcmcia/pxa2xx_lubbock.c +++ b/drivers/pcmcia/pxa2xx_lubbock.c | |||
| @@ -32,6 +32,7 @@ static int | |||
| 32 | lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | 32 | lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, |
| 33 | const socket_state_t *state) | 33 | const socket_state_t *state) |
| 34 | { | 34 | { |
| 35 | struct sa1111_pcmcia_socket *s = to_skt(skt); | ||
| 35 | unsigned int pa_dwr_mask, pa_dwr_set, misc_mask, misc_set; | 36 | unsigned int pa_dwr_mask, pa_dwr_set, misc_mask, misc_set; |
| 36 | int ret = 0; | 37 | int ret = 0; |
| 37 | 38 | ||
| @@ -149,7 +150,7 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
| 149 | 150 | ||
| 150 | if (ret == 0) { | 151 | if (ret == 0) { |
| 151 | lubbock_set_misc_wr(misc_mask, misc_set); | 152 | lubbock_set_misc_wr(misc_mask, misc_set); |
| 152 | sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set); | 153 | sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); |
| 153 | } | 154 | } |
| 154 | 155 | ||
| 155 | #if 1 | 156 | #if 1 |
| @@ -175,7 +176,7 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
| 175 | * Switch to 5V, Configure socket with 5V voltage | 176 | * Switch to 5V, Configure socket with 5V voltage |
| 176 | */ | 177 | */ |
| 177 | lubbock_set_misc_wr(misc_mask, 0); | 178 | lubbock_set_misc_wr(misc_mask, 0); |
| 178 | sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, 0); | 179 | sa1111_set_io(s->dev, pa_dwr_mask, 0); |
| 179 | 180 | ||
| 180 | /* | 181 | /* |
| 181 | * It takes about 100ms to turn off Vcc. | 182 | * It takes about 100ms to turn off Vcc. |
| @@ -200,12 +201,8 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
| 200 | 201 | ||
| 201 | static struct pcmcia_low_level lubbock_pcmcia_ops = { | 202 | static struct pcmcia_low_level lubbock_pcmcia_ops = { |
| 202 | .owner = THIS_MODULE, | 203 | .owner = THIS_MODULE, |
| 203 | .hw_init = sa1111_pcmcia_hw_init, | ||
| 204 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, | ||
| 205 | .socket_state = sa1111_pcmcia_socket_state, | ||
| 206 | .configure_socket = lubbock_pcmcia_configure_socket, | 204 | .configure_socket = lubbock_pcmcia_configure_socket, |
| 207 | .socket_init = sa1111_pcmcia_socket_init, | 205 | .socket_init = sa1111_pcmcia_socket_init, |
| 208 | .socket_suspend = sa1111_pcmcia_socket_suspend, | ||
| 209 | .first = 0, | 206 | .first = 0, |
| 210 | .nr = 2, | 207 | .nr = 2, |
| 211 | }; | 208 | }; |
| @@ -228,8 +225,9 @@ int pcmcia_lubbock_init(struct sa1111_dev *sadev) | |||
| 228 | /* Set CF Socket 1 power to standby mode. */ | 225 | /* Set CF Socket 1 power to standby mode. */ |
| 229 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); | 226 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); |
| 230 | 227 | ||
| 231 | sadev->dev.platform_data = &lubbock_pcmcia_ops; | 228 | pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); |
| 232 | ret = __pxa2xx_drv_pcmcia_probe(&sadev->dev); | 229 | ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, |
| 230 | pxa2xx_drv_pcmcia_add_one); | ||
| 233 | } | 231 | } |
| 234 | 232 | ||
| 235 | return ret; | 233 | return ret; |
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c index 1138551ba8f6..92016fe932b4 100644 --- a/drivers/pcmcia/pxa2xx_mainstone.c +++ b/drivers/pcmcia/pxa2xx_mainstone.c | |||
| @@ -44,7 +44,7 @@ static int mst_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 44 | * before we enable them as outputs. | 44 | * before we enable them as outputs. |
| 45 | */ | 45 | */ |
| 46 | 46 | ||
| 47 | skt->irq = (skt->nr == 0) ? MAINSTONE_S0_IRQ : MAINSTONE_S1_IRQ; | 47 | skt->socket.pci_irq = (skt->nr == 0) ? MAINSTONE_S0_IRQ : MAINSTONE_S1_IRQ; |
| 48 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 48 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
| 49 | } | 49 | } |
| 50 | 50 | ||
diff --git a/drivers/pcmcia/pxa2xx_palmld.c b/drivers/pcmcia/pxa2xx_palmld.c index 5ba9b3664a00..6fb6f7f0672e 100644 --- a/drivers/pcmcia/pxa2xx_palmld.c +++ b/drivers/pcmcia/pxa2xx_palmld.c | |||
| @@ -45,7 +45,7 @@ static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 45 | if (ret) | 45 | if (ret) |
| 46 | goto err4; | 46 | goto err4; |
| 47 | 47 | ||
| 48 | skt->irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY); | 48 | skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY); |
| 49 | return 0; | 49 | return 0; |
| 50 | 50 | ||
| 51 | err4: | 51 | err4: |
diff --git a/drivers/pcmcia/pxa2xx_palmtx.c b/drivers/pcmcia/pxa2xx_palmtx.c index e07b5c51ec5b..b07b247a399f 100644 --- a/drivers/pcmcia/pxa2xx_palmtx.c +++ b/drivers/pcmcia/pxa2xx_palmtx.c | |||
| @@ -53,7 +53,7 @@ static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 53 | if (ret) | 53 | if (ret) |
| 54 | goto err5; | 54 | goto err5; |
| 55 | 55 | ||
| 56 | skt->irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY); | 56 | skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY); |
| 57 | return 0; | 57 | return 0; |
| 58 | 58 | ||
| 59 | err5: | 59 | err5: |
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c index bc43f78f6f0b..0ea3b29440e6 100644 --- a/drivers/pcmcia/pxa2xx_sharpsl.c +++ b/drivers/pcmcia/pxa2xx_sharpsl.c | |||
| @@ -66,7 +66,7 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 66 | } | 66 | } |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | skt->irq = SCOOP_DEV[skt->nr].irq; | 69 | skt->socket.pci_irq = SCOOP_DEV[skt->nr].irq; |
| 70 | 70 | ||
| 71 | return 0; | 71 | return 0; |
| 72 | } | 72 | } |
diff --git a/drivers/pcmcia/pxa2xx_trizeps4.c b/drivers/pcmcia/pxa2xx_trizeps4.c index e0e5cb339b4a..b7e596620db1 100644 --- a/drivers/pcmcia/pxa2xx_trizeps4.c +++ b/drivers/pcmcia/pxa2xx_trizeps4.c | |||
| @@ -53,7 +53,7 @@ static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 53 | gpio_free(GPIO_PRDY); | 53 | gpio_free(GPIO_PRDY); |
| 54 | return -EINVAL; | 54 | return -EINVAL; |
| 55 | } | 55 | } |
| 56 | skt->irq = IRQ_GPIO(GPIO_PRDY); | 56 | skt->socket.pci_irq = IRQ_GPIO(GPIO_PRDY); |
| 57 | break; | 57 | break; |
| 58 | 58 | ||
| 59 | #ifndef CONFIG_MACH_TRIZEPS_CONXS | 59 | #ifndef CONFIG_MACH_TRIZEPS_CONXS |
| @@ -63,7 +63,7 @@ static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 63 | break; | 63 | break; |
| 64 | } | 64 | } |
| 65 | /* release the reset of this card */ | 65 | /* release the reset of this card */ |
| 66 | pr_debug("%s: sock %d irq %d\n", __func__, skt->nr, skt->irq); | 66 | pr_debug("%s: sock %d irq %d\n", __func__, skt->nr, skt->socket.pci_irq); |
| 67 | 67 | ||
| 68 | /* supplementory irqs for the socket */ | 68 | /* supplementory irqs for the socket */ |
| 69 | for (i = 0; i < ARRAY_SIZE(irqs); i++) { | 69 | for (i = 0; i < ARRAY_SIZE(irqs); i++) { |
diff --git a/drivers/pcmcia/pxa2xx_viper.c b/drivers/pcmcia/pxa2xx_viper.c index 17871360fe99..27be2e154df2 100644 --- a/drivers/pcmcia/pxa2xx_viper.c +++ b/drivers/pcmcia/pxa2xx_viper.c | |||
| @@ -40,7 +40,7 @@ static int viper_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 40 | { | 40 | { |
| 41 | unsigned long flags; | 41 | unsigned long flags; |
| 42 | 42 | ||
| 43 | skt->irq = gpio_to_irq(VIPER_CF_RDY_GPIO); | 43 | skt->socket.pci_irq = gpio_to_irq(VIPER_CF_RDY_GPIO); |
| 44 | 44 | ||
| 45 | if (gpio_request(VIPER_CF_CD_GPIO, "CF detect")) | 45 | if (gpio_request(VIPER_CF_CD_GPIO, "CF detect")) |
| 46 | goto err_request_cd; | 46 | goto err_request_cd; |
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c index e592e0e0d7ed..de0e770ce6a3 100644 --- a/drivers/pcmcia/rsrc_mgr.c +++ b/drivers/pcmcia/rsrc_mgr.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <pcmcia/cs_types.h> | 18 | #include <pcmcia/cs_types.h> |
| 19 | #include <pcmcia/ss.h> | 19 | #include <pcmcia/ss.h> |
| 20 | #include <pcmcia/cs.h> | 20 | #include <pcmcia/cs.h> |
| 21 | #include <pcmcia/cistpl.h> | ||
| 21 | #include "cs_internal.h" | 22 | #include "cs_internal.h" |
| 22 | 23 | ||
| 23 | 24 | ||
diff --git a/drivers/pcmcia/sa1100_assabet.c b/drivers/pcmcia/sa1100_assabet.c index ac8aa09ba0da..fd013a1ef47a 100644 --- a/drivers/pcmcia/sa1100_assabet.c +++ b/drivers/pcmcia/sa1100_assabet.c | |||
| @@ -27,7 +27,7 @@ static struct pcmcia_irqs irqs[] = { | |||
| 27 | 27 | ||
| 28 | static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 28 | static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
| 29 | { | 29 | { |
| 30 | skt->irq = ASSABET_IRQ_GPIO_CF_IRQ; | 30 | skt->socket.pci_irq = ASSABET_IRQ_GPIO_CF_IRQ; |
| 31 | 31 | ||
| 32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
| 33 | } | 33 | } |
diff --git a/drivers/pcmcia/sa1100_badge4.c b/drivers/pcmcia/sa1100_badge4.c index 1ca9737ea79e..1ce53f493bef 100644 --- a/drivers/pcmcia/sa1100_badge4.c +++ b/drivers/pcmcia/sa1100_badge4.c | |||
| @@ -127,13 +127,10 @@ badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state | |||
| 127 | 127 | ||
| 128 | static struct pcmcia_low_level badge4_pcmcia_ops = { | 128 | static struct pcmcia_low_level badge4_pcmcia_ops = { |
| 129 | .owner = THIS_MODULE, | 129 | .owner = THIS_MODULE, |
| 130 | .hw_init = sa1111_pcmcia_hw_init, | ||
| 131 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, | ||
| 132 | .socket_state = sa1111_pcmcia_socket_state, | ||
| 133 | .configure_socket = badge4_pcmcia_configure_socket, | 130 | .configure_socket = badge4_pcmcia_configure_socket, |
| 134 | |||
| 135 | .socket_init = sa1111_pcmcia_socket_init, | 131 | .socket_init = sa1111_pcmcia_socket_init, |
| 136 | .socket_suspend = sa1111_pcmcia_socket_suspend, | 132 | .first = 0, |
| 133 | .nr = 2, | ||
| 137 | }; | 134 | }; |
| 138 | 135 | ||
| 139 | int pcmcia_badge4_init(struct device *dev) | 136 | int pcmcia_badge4_init(struct device *dev) |
| @@ -146,7 +143,9 @@ int pcmcia_badge4_init(struct device *dev) | |||
| 146 | __func__, | 143 | __func__, |
| 147 | badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); | 144 | badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); |
| 148 | 145 | ||
| 149 | ret = sa11xx_drv_pcmcia_probe(dev, &badge4_pcmcia_ops, 0, 2); | 146 | sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops); |
| 147 | ret = sa1111_pcmcia_add(dev, &badge4_pcmcia_ops, | ||
| 148 | sa11xx_drv_pcmcia_add_one); | ||
| 150 | } | 149 | } |
| 151 | 150 | ||
| 152 | return ret; | 151 | return ret; |
diff --git a/drivers/pcmcia/sa1100_cerf.c b/drivers/pcmcia/sa1100_cerf.c index 63e6bc431a0d..9bf088b17275 100644 --- a/drivers/pcmcia/sa1100_cerf.c +++ b/drivers/pcmcia/sa1100_cerf.c | |||
| @@ -27,7 +27,7 @@ static struct pcmcia_irqs irqs[] = { | |||
| 27 | 27 | ||
| 28 | static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 28 | static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
| 29 | { | 29 | { |
| 30 | skt->irq = CERF_IRQ_GPIO_CF_IRQ; | 30 | skt->socket.pci_irq = CERF_IRQ_GPIO_CF_IRQ; |
| 31 | 31 | ||
| 32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
| 33 | } | 33 | } |
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index 2d0e99751530..11cc3ba1260a 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c | |||
| @@ -83,7 +83,16 @@ static int sa11x0_drv_pcmcia_probe(struct platform_device *dev) | |||
| 83 | 83 | ||
| 84 | static int sa11x0_drv_pcmcia_remove(struct platform_device *dev) | 84 | static int sa11x0_drv_pcmcia_remove(struct platform_device *dev) |
| 85 | { | 85 | { |
| 86 | return soc_common_drv_pcmcia_remove(&dev->dev); | 86 | struct skt_dev_info *sinfo = platform_get_drvdata(dev); |
| 87 | int i; | ||
| 88 | |||
| 89 | platform_set_drvdata(dev, NULL); | ||
| 90 | |||
| 91 | for (i = 0; i < sinfo->nskt; i++) | ||
| 92 | soc_pcmcia_remove_one(&sinfo->skt[i]); | ||
| 93 | |||
| 94 | kfree(sinfo); | ||
| 95 | return 0; | ||
| 87 | } | 96 | } |
| 88 | 97 | ||
| 89 | static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev, | 98 | static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev, |
diff --git a/drivers/pcmcia/sa1100_h3600.c b/drivers/pcmcia/sa1100_h3600.c index 0cc3748f3758..3a121ac697d6 100644 --- a/drivers/pcmcia/sa1100_h3600.c +++ b/drivers/pcmcia/sa1100_h3600.c | |||
| @@ -25,8 +25,8 @@ static struct pcmcia_irqs irqs[] = { | |||
| 25 | 25 | ||
| 26 | static int h3600_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 26 | static int h3600_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
| 27 | { | 27 | { |
| 28 | skt->irq = skt->nr ? IRQ_GPIO_H3600_PCMCIA_IRQ1 | 28 | skt->socket.pci_irq = skt->nr ? IRQ_GPIO_H3600_PCMCIA_IRQ1 |
| 29 | : IRQ_GPIO_H3600_PCMCIA_IRQ0; | 29 | : IRQ_GPIO_H3600_PCMCIA_IRQ0; |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 32 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
diff --git a/drivers/pcmcia/sa1100_jornada720.c b/drivers/pcmcia/sa1100_jornada720.c index 7eedb42f800c..6bcabee6bde4 100644 --- a/drivers/pcmcia/sa1100_jornada720.c +++ b/drivers/pcmcia/sa1100_jornada720.c | |||
| @@ -22,25 +22,10 @@ | |||
| 22 | #define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3) | 22 | #define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3) |
| 23 | #define SOCKET1_3V GPIO_GPIO3 | 23 | #define SOCKET1_3V GPIO_GPIO3 |
| 24 | 24 | ||
| 25 | static int jornada720_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
| 26 | { | ||
| 27 | unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; | ||
| 28 | |||
| 29 | /* | ||
| 30 | * What is all this crap for? | ||
| 31 | */ | ||
| 32 | GRER |= 0x00000002; | ||
| 33 | /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ | ||
| 34 | sa1111_set_io_dir(SA1111_DEV(skt->dev), pin, 0, 0); | ||
| 35 | sa1111_set_io(SA1111_DEV(skt->dev), pin, 0); | ||
| 36 | sa1111_set_sleep_io(SA1111_DEV(skt->dev), pin, 0); | ||
| 37 | |||
| 38 | return sa1111_pcmcia_hw_init(skt); | ||
| 39 | } | ||
| 40 | |||
| 41 | static int | 25 | static int |
| 42 | jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | 26 | jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) |
| 43 | { | 27 | { |
| 28 | struct sa1111_pcmcia_socket *s = to_skt(skt); | ||
| 44 | unsigned int pa_dwr_mask, pa_dwr_set; | 29 | unsigned int pa_dwr_mask, pa_dwr_set; |
| 45 | int ret; | 30 | int ret; |
| 46 | 31 | ||
| @@ -97,7 +82,7 @@ jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s | |||
| 97 | unsigned long flags; | 82 | unsigned long flags; |
| 98 | 83 | ||
| 99 | local_irq_save(flags); | 84 | local_irq_save(flags); |
| 100 | sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set); | 85 | sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); |
| 101 | local_irq_restore(flags); | 86 | local_irq_restore(flags); |
| 102 | } | 87 | } |
| 103 | 88 | ||
| @@ -106,21 +91,30 @@ jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s | |||
| 106 | 91 | ||
| 107 | static struct pcmcia_low_level jornada720_pcmcia_ops = { | 92 | static struct pcmcia_low_level jornada720_pcmcia_ops = { |
| 108 | .owner = THIS_MODULE, | 93 | .owner = THIS_MODULE, |
| 109 | .hw_init = jornada720_pcmcia_hw_init, | ||
| 110 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, | ||
| 111 | .socket_state = sa1111_pcmcia_socket_state, | ||
| 112 | .configure_socket = jornada720_pcmcia_configure_socket, | 94 | .configure_socket = jornada720_pcmcia_configure_socket, |
| 113 | |||
| 114 | .socket_init = sa1111_pcmcia_socket_init, | 95 | .socket_init = sa1111_pcmcia_socket_init, |
| 115 | .socket_suspend = sa1111_pcmcia_socket_suspend, | 96 | .first = 0, |
| 97 | .nr = 2, | ||
| 116 | }; | 98 | }; |
| 117 | 99 | ||
| 118 | int __devinit pcmcia_jornada720_init(struct device *dev) | 100 | int __devinit pcmcia_jornada720_init(struct device *dev) |
| 119 | { | 101 | { |
| 120 | int ret = -ENODEV; | 102 | int ret = -ENODEV; |
| 121 | 103 | ||
| 122 | if (machine_is_jornada720()) | 104 | if (machine_is_jornada720()) { |
| 123 | ret = sa11xx_drv_pcmcia_probe(dev, &jornada720_pcmcia_ops, 0, 2); | 105 | unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; |
| 106 | |||
| 107 | GRER |= 0x00000002; | ||
| 108 | |||
| 109 | /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ | ||
| 110 | sa1111_set_io_dir(dev, pin, 0, 0); | ||
| 111 | sa1111_set_io(dev, pin, 0); | ||
| 112 | sa1111_set_sleep_io(dev, pin, 0); | ||
| 113 | |||
| 114 | sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops); | ||
| 115 | ret = sa1111_pcmcia_add(dev, &jornada720_pcmcia_ops, | ||
| 116 | sa11xx_drv_pcmcia_add_one); | ||
| 117 | } | ||
| 124 | 118 | ||
| 125 | return ret; | 119 | return ret; |
| 126 | } | 120 | } |
diff --git a/drivers/pcmcia/sa1100_neponset.c b/drivers/pcmcia/sa1100_neponset.c index 0c76d337815b..c95639b5f2a0 100644 --- a/drivers/pcmcia/sa1100_neponset.c +++ b/drivers/pcmcia/sa1100_neponset.c | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | static int | 43 | static int |
| 44 | neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | 44 | neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) |
| 45 | { | 45 | { |
| 46 | struct sa1111_pcmcia_socket *s = to_skt(skt); | ||
| 46 | unsigned int ncr_mask, ncr_set, pa_dwr_mask, pa_dwr_set; | 47 | unsigned int ncr_mask, ncr_set, pa_dwr_mask, pa_dwr_set; |
| 47 | int ret; | 48 | int ret; |
| 48 | 49 | ||
| @@ -99,7 +100,7 @@ neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_sta | |||
| 99 | NCR_0 = (NCR_0 & ~ncr_mask) | ncr_set; | 100 | NCR_0 = (NCR_0 & ~ncr_mask) | ncr_set; |
| 100 | 101 | ||
| 101 | local_irq_restore(flags); | 102 | local_irq_restore(flags); |
| 102 | sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set); | 103 | sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); |
| 103 | } | 104 | } |
| 104 | 105 | ||
| 105 | return 0; | 106 | return 0; |
| @@ -115,12 +116,10 @@ static void neponset_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | |||
| 115 | 116 | ||
| 116 | static struct pcmcia_low_level neponset_pcmcia_ops = { | 117 | static struct pcmcia_low_level neponset_pcmcia_ops = { |
| 117 | .owner = THIS_MODULE, | 118 | .owner = THIS_MODULE, |
| 118 | .hw_init = sa1111_pcmcia_hw_init, | ||
| 119 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, | ||
| 120 | .socket_state = sa1111_pcmcia_socket_state, | ||
| 121 | .configure_socket = neponset_pcmcia_configure_socket, | 119 | .configure_socket = neponset_pcmcia_configure_socket, |
| 122 | .socket_init = neponset_pcmcia_socket_init, | 120 | .socket_init = neponset_pcmcia_socket_init, |
| 123 | .socket_suspend = sa1111_pcmcia_socket_suspend, | 121 | .first = 0, |
| 122 | .nr = 2, | ||
| 124 | }; | 123 | }; |
| 125 | 124 | ||
| 126 | int pcmcia_neponset_init(struct sa1111_dev *sadev) | 125 | int pcmcia_neponset_init(struct sa1111_dev *sadev) |
| @@ -135,7 +134,9 @@ int pcmcia_neponset_init(struct sa1111_dev *sadev) | |||
| 135 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); | 134 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); |
| 136 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | 135 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
| 137 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | 136 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
| 138 | ret = sa11xx_drv_pcmcia_probe(&sadev->dev, &neponset_pcmcia_ops, 0, 2); | 137 | sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops); |
| 138 | ret = sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops, | ||
| 139 | sa11xx_drv_pcmcia_add_one); | ||
| 139 | } | 140 | } |
| 140 | 141 | ||
| 141 | return ret; | 142 | return ret; |
diff --git a/drivers/pcmcia/sa1100_shannon.c b/drivers/pcmcia/sa1100_shannon.c index 46d8c1977c2a..c4d51867a050 100644 --- a/drivers/pcmcia/sa1100_shannon.c +++ b/drivers/pcmcia/sa1100_shannon.c | |||
| @@ -28,7 +28,7 @@ static int shannon_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 28 | GAFR &= ~(SHANNON_GPIO_EJECT_0 | SHANNON_GPIO_EJECT_1 | | 28 | GAFR &= ~(SHANNON_GPIO_EJECT_0 | SHANNON_GPIO_EJECT_1 | |
| 29 | SHANNON_GPIO_RDY_0 | SHANNON_GPIO_RDY_1); | 29 | SHANNON_GPIO_RDY_0 | SHANNON_GPIO_RDY_1); |
| 30 | 30 | ||
| 31 | skt->irq = skt->nr ? SHANNON_IRQ_GPIO_RDY_1 : SHANNON_IRQ_GPIO_RDY_0; | 31 | skt->socket.pci_irq = skt->nr ? SHANNON_IRQ_GPIO_RDY_1 : SHANNON_IRQ_GPIO_RDY_0; |
| 32 | 32 | ||
| 33 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 33 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
| 34 | } | 34 | } |
diff --git a/drivers/pcmcia/sa1100_simpad.c b/drivers/pcmcia/sa1100_simpad.c index 33a08ae09fdf..05bd504e6f18 100644 --- a/drivers/pcmcia/sa1100_simpad.c +++ b/drivers/pcmcia/sa1100_simpad.c | |||
| @@ -28,7 +28,7 @@ static int simpad_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 28 | 28 | ||
| 29 | clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); | 29 | clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); |
| 30 | 30 | ||
| 31 | skt->irq = IRQ_GPIO_CF_IRQ; | 31 | skt->socket.pci_irq = IRQ_GPIO_CF_IRQ; |
| 32 | 32 | ||
| 33 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 33 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
| 34 | } | 34 | } |
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c index 4be4e172ffa1..de6bc333d299 100644 --- a/drivers/pcmcia/sa1111_generic.c +++ b/drivers/pcmcia/sa1111_generic.c | |||
| @@ -28,23 +28,20 @@ static struct pcmcia_irqs irqs[] = { | |||
| 28 | { 1, IRQ_S1_BVD1_STSCHG, "SA1111 CF BVD1" }, | 28 | { 1, IRQ_S1_BVD1_STSCHG, "SA1111 CF BVD1" }, |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 31 | static int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
| 32 | { | 32 | { |
| 33 | if (skt->irq == NO_IRQ) | ||
| 34 | skt->irq = skt->nr ? IRQ_S1_READY_NINT : IRQ_S0_READY_NINT; | ||
| 35 | |||
| 36 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 33 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
| 37 | } | 34 | } |
| 38 | 35 | ||
| 39 | void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 36 | static void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) |
| 40 | { | 37 | { |
| 41 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 38 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
| 42 | } | 39 | } |
| 43 | 40 | ||
| 44 | void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) | 41 | void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) |
| 45 | { | 42 | { |
| 46 | struct sa1111_dev *sadev = SA1111_DEV(skt->dev); | 43 | struct sa1111_pcmcia_socket *s = to_skt(skt); |
| 47 | unsigned long status = sa1111_readl(sadev->mapbase + SA1111_PCSR); | 44 | unsigned long status = sa1111_readl(s->dev->mapbase + SA1111_PCSR); |
| 48 | 45 | ||
| 49 | switch (skt->nr) { | 46 | switch (skt->nr) { |
| 50 | case 0: | 47 | case 0: |
| @@ -71,7 +68,7 @@ void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_sta | |||
| 71 | 68 | ||
| 72 | int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) | 69 | int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) |
| 73 | { | 70 | { |
| 74 | struct sa1111_dev *sadev = SA1111_DEV(skt->dev); | 71 | struct sa1111_pcmcia_socket *s = to_skt(skt); |
| 75 | unsigned int pccr_skt_mask, pccr_set_mask, val; | 72 | unsigned int pccr_skt_mask, pccr_set_mask, val; |
| 76 | unsigned long flags; | 73 | unsigned long flags; |
| 77 | 74 | ||
| @@ -100,10 +97,10 @@ int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s | |||
| 100 | pccr_set_mask |= PCCR_S0_FLT|PCCR_S1_FLT; | 97 | pccr_set_mask |= PCCR_S0_FLT|PCCR_S1_FLT; |
| 101 | 98 | ||
| 102 | local_irq_save(flags); | 99 | local_irq_save(flags); |
| 103 | val = sa1111_readl(sadev->mapbase + SA1111_PCCR); | 100 | val = sa1111_readl(s->dev->mapbase + SA1111_PCCR); |
| 104 | val &= ~pccr_skt_mask; | 101 | val &= ~pccr_skt_mask; |
| 105 | val |= pccr_set_mask & pccr_skt_mask; | 102 | val |= pccr_set_mask & pccr_skt_mask; |
| 106 | sa1111_writel(val, sadev->mapbase + SA1111_PCCR); | 103 | sa1111_writel(val, s->dev->mapbase + SA1111_PCCR); |
| 107 | local_irq_restore(flags); | 104 | local_irq_restore(flags); |
| 108 | 105 | ||
| 109 | return 0; | 106 | return 0; |
| @@ -114,15 +111,51 @@ void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | |||
| 114 | soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 111 | soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
| 115 | } | 112 | } |
| 116 | 113 | ||
| 117 | void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | 114 | static void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) |
| 118 | { | 115 | { |
| 119 | soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 116 | soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
| 120 | } | 117 | } |
| 121 | 118 | ||
| 119 | int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops, | ||
| 120 | int (*add)(struct soc_pcmcia_socket *)) | ||
| 121 | { | ||
| 122 | struct sa1111_pcmcia_socket *s; | ||
| 123 | int i, ret = 0; | ||
| 124 | |||
| 125 | ops->hw_init = sa1111_pcmcia_hw_init; | ||
| 126 | ops->hw_shutdown = sa1111_pcmcia_hw_shutdown; | ||
| 127 | ops->socket_state = sa1111_pcmcia_socket_state; | ||
| 128 | ops->socket_suspend = sa1111_pcmcia_socket_suspend; | ||
| 129 | |||
| 130 | for (i = 0; i < ops->nr; i++) { | ||
| 131 | s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
| 132 | if (!s) | ||
| 133 | return -ENOMEM; | ||
| 134 | |||
| 135 | s->soc.nr = ops->first + i; | ||
| 136 | s->soc.ops = ops; | ||
| 137 | s->soc.socket.owner = ops->owner; | ||
| 138 | s->soc.socket.dev.parent = &dev->dev; | ||
| 139 | s->soc.socket.pci_irq = s->soc.nr ? IRQ_S1_READY_NINT : IRQ_S0_READY_NINT; | ||
| 140 | s->dev = dev; | ||
| 141 | |||
| 142 | ret = add(&s->soc); | ||
| 143 | if (ret == 0) { | ||
| 144 | s->next = dev_get_drvdata(&dev->dev); | ||
| 145 | dev_set_drvdata(&dev->dev, s); | ||
| 146 | } else | ||
| 147 | kfree(s); | ||
| 148 | } | ||
| 149 | |||
| 150 | return ret; | ||
| 151 | } | ||
| 152 | |||
| 122 | static int pcmcia_probe(struct sa1111_dev *dev) | 153 | static int pcmcia_probe(struct sa1111_dev *dev) |
| 123 | { | 154 | { |
| 124 | void __iomem *base; | 155 | void __iomem *base; |
| 125 | 156 | ||
| 157 | dev_set_drvdata(&dev->dev, NULL); | ||
| 158 | |||
| 126 | if (!request_mem_region(dev->res.start, 512, | 159 | if (!request_mem_region(dev->res.start, 512, |
| 127 | SA1111_DRIVER_NAME(dev))) | 160 | SA1111_DRIVER_NAME(dev))) |
| 128 | return -EBUSY; | 161 | return -EBUSY; |
| @@ -152,7 +185,15 @@ static int pcmcia_probe(struct sa1111_dev *dev) | |||
| 152 | 185 | ||
| 153 | static int __devexit pcmcia_remove(struct sa1111_dev *dev) | 186 | static int __devexit pcmcia_remove(struct sa1111_dev *dev) |
| 154 | { | 187 | { |
| 155 | soc_common_drv_pcmcia_remove(&dev->dev); | 188 | struct sa1111_pcmcia_socket *next, *s = dev_get_drvdata(&dev->dev); |
| 189 | |||
| 190 | dev_set_drvdata(&dev->dev, NULL); | ||
| 191 | |||
| 192 | for (; next = s->next, s; s = next) { | ||
| 193 | soc_pcmcia_remove_one(&s->soc); | ||
| 194 | kfree(s); | ||
| 195 | } | ||
| 196 | |||
| 156 | release_mem_region(dev->res.start, 512); | 197 | release_mem_region(dev->res.start, 512); |
| 157 | return 0; | 198 | return 0; |
| 158 | } | 199 | } |
diff --git a/drivers/pcmcia/sa1111_generic.h b/drivers/pcmcia/sa1111_generic.h index 10ced4a210d7..02dc8577cdaf 100644 --- a/drivers/pcmcia/sa1111_generic.h +++ b/drivers/pcmcia/sa1111_generic.h | |||
| @@ -1,12 +1,23 @@ | |||
| 1 | #include "soc_common.h" | 1 | #include "soc_common.h" |
| 2 | #include "sa11xx_base.h" | 2 | #include "sa11xx_base.h" |
| 3 | 3 | ||
| 4 | extern int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *); | 4 | struct sa1111_pcmcia_socket { |
| 5 | extern void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *); | 5 | struct soc_pcmcia_socket soc; |
| 6 | struct sa1111_dev *dev; | ||
| 7 | struct sa1111_pcmcia_socket *next; | ||
| 8 | }; | ||
| 9 | |||
| 10 | static inline struct sa1111_pcmcia_socket *to_skt(struct soc_pcmcia_socket *s) | ||
| 11 | { | ||
| 12 | return container_of(s, struct sa1111_pcmcia_socket, soc); | ||
| 13 | } | ||
| 14 | |||
| 15 | int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops, | ||
| 16 | int (*add)(struct soc_pcmcia_socket *)); | ||
| 17 | |||
| 6 | extern void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *, struct pcmcia_state *); | 18 | extern void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *, struct pcmcia_state *); |
| 7 | extern int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *, const socket_state_t *); | 19 | extern int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *, const socket_state_t *); |
| 8 | extern void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *); | 20 | extern void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *); |
| 9 | extern void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *); | ||
| 10 | 21 | ||
| 11 | extern int pcmcia_badge4_init(struct device *); | 22 | extern int pcmcia_badge4_init(struct device *); |
| 12 | extern int pcmcia_jornada720_init(struct device *); | 23 | extern int pcmcia_jornada720_init(struct device *); |
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index e15d59f2d8a9..fc9a6527019b 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c | |||
| @@ -171,12 +171,58 @@ static const char *skt_names[] = { | |||
| 171 | #define SKT_DEV_INFO_SIZE(n) \ | 171 | #define SKT_DEV_INFO_SIZE(n) \ |
| 172 | (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) | 172 | (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) |
| 173 | 173 | ||
| 174 | int sa11xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt) | ||
| 175 | { | ||
| 176 | skt->res_skt.start = _PCMCIA(skt->nr); | ||
| 177 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | ||
| 178 | skt->res_skt.name = skt_names[skt->nr]; | ||
| 179 | skt->res_skt.flags = IORESOURCE_MEM; | ||
| 180 | |||
| 181 | skt->res_io.start = _PCMCIAIO(skt->nr); | ||
| 182 | skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; | ||
| 183 | skt->res_io.name = "io"; | ||
| 184 | skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
| 185 | |||
| 186 | skt->res_mem.start = _PCMCIAMem(skt->nr); | ||
| 187 | skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1; | ||
| 188 | skt->res_mem.name = "memory"; | ||
| 189 | skt->res_mem.flags = IORESOURCE_MEM; | ||
| 190 | |||
| 191 | skt->res_attr.start = _PCMCIAAttr(skt->nr); | ||
| 192 | skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1; | ||
| 193 | skt->res_attr.name = "attribute"; | ||
| 194 | skt->res_attr.flags = IORESOURCE_MEM; | ||
| 195 | |||
| 196 | return soc_pcmcia_add_one(skt); | ||
| 197 | } | ||
| 198 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_add_one); | ||
| 199 | |||
| 200 | void sa11xx_drv_pcmcia_ops(struct pcmcia_low_level *ops) | ||
| 201 | { | ||
| 202 | /* | ||
| 203 | * set default MECR calculation if the board specific | ||
| 204 | * code did not specify one... | ||
| 205 | */ | ||
| 206 | if (!ops->get_timing) | ||
| 207 | ops->get_timing = sa1100_pcmcia_default_mecr_timing; | ||
| 208 | |||
| 209 | /* Provide our SA11x0 specific timing routines. */ | ||
| 210 | ops->set_timing = sa1100_pcmcia_set_timing; | ||
| 211 | ops->show_timing = sa1100_pcmcia_show_timing; | ||
| 212 | #ifdef CONFIG_CPU_FREQ | ||
| 213 | ops->frequency_change = sa1100_pcmcia_frequency_change; | ||
| 214 | #endif | ||
| 215 | } | ||
| 216 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_ops); | ||
| 217 | |||
| 174 | int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, | 218 | int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, |
| 175 | int first, int nr) | 219 | int first, int nr) |
| 176 | { | 220 | { |
| 177 | struct skt_dev_info *sinfo; | 221 | struct skt_dev_info *sinfo; |
| 178 | struct soc_pcmcia_socket *skt; | 222 | struct soc_pcmcia_socket *skt; |
| 179 | int i; | 223 | int i, ret = 0; |
| 224 | |||
| 225 | sa11xx_drv_pcmcia_ops(ops); | ||
| 180 | 226 | ||
| 181 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); | 227 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); |
| 182 | if (!sinfo) | 228 | if (!sinfo) |
| @@ -188,45 +234,26 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, | |||
| 188 | for (i = 0; i < nr; i++) { | 234 | for (i = 0; i < nr; i++) { |
| 189 | skt = &sinfo->skt[i]; | 235 | skt = &sinfo->skt[i]; |
| 190 | 236 | ||
| 191 | skt->nr = first + i; | 237 | skt->nr = first + i; |
| 192 | skt->irq = NO_IRQ; | 238 | skt->ops = ops; |
| 193 | 239 | skt->socket.owner = ops->owner; | |
| 194 | skt->res_skt.start = _PCMCIA(skt->nr); | 240 | skt->socket.dev.parent = dev; |
| 195 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | 241 | skt->socket.pci_irq = NO_IRQ; |
| 196 | skt->res_skt.name = skt_names[skt->nr]; | ||
| 197 | skt->res_skt.flags = IORESOURCE_MEM; | ||
| 198 | |||
| 199 | skt->res_io.start = _PCMCIAIO(skt->nr); | ||
| 200 | skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; | ||
| 201 | skt->res_io.name = "io"; | ||
| 202 | skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
| 203 | 242 | ||
| 204 | skt->res_mem.start = _PCMCIAMem(skt->nr); | 243 | ret = sa11xx_drv_pcmcia_add_one(skt); |
| 205 | skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1; | 244 | if (ret) |
| 206 | skt->res_mem.name = "memory"; | 245 | break; |
| 207 | skt->res_mem.flags = IORESOURCE_MEM; | ||
| 208 | |||
| 209 | skt->res_attr.start = _PCMCIAAttr(skt->nr); | ||
| 210 | skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1; | ||
| 211 | skt->res_attr.name = "attribute"; | ||
| 212 | skt->res_attr.flags = IORESOURCE_MEM; | ||
| 213 | } | 246 | } |
| 214 | 247 | ||
| 215 | /* | 248 | if (ret) { |
| 216 | * set default MECR calculation if the board specific | 249 | while (--i >= 0) |
| 217 | * code did not specify one... | 250 | soc_pcmcia_remove_one(&sinfo->skt[i]); |
| 218 | */ | 251 | kfree(sinfo); |
| 219 | if (!ops->get_timing) | 252 | } else { |
| 220 | ops->get_timing = sa1100_pcmcia_default_mecr_timing; | 253 | dev_set_drvdata(dev, sinfo); |
| 221 | 254 | } | |
| 222 | /* Provide our SA11x0 specific timing routines. */ | ||
| 223 | ops->set_timing = sa1100_pcmcia_set_timing; | ||
| 224 | ops->show_timing = sa1100_pcmcia_show_timing; | ||
| 225 | #ifdef CONFIG_CPU_FREQ | ||
| 226 | ops->frequency_change = sa1100_pcmcia_frequency_change; | ||
| 227 | #endif | ||
| 228 | 255 | ||
| 229 | return soc_common_drv_pcmcia_probe(dev, ops, sinfo); | 256 | return ret; |
| 230 | } | 257 | } |
| 231 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); | 258 | EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); |
| 232 | 259 | ||
diff --git a/drivers/pcmcia/sa11xx_base.h b/drivers/pcmcia/sa11xx_base.h index 7bc208280527..3d76d720f463 100644 --- a/drivers/pcmcia/sa11xx_base.h +++ b/drivers/pcmcia/sa11xx_base.h | |||
| @@ -118,6 +118,8 @@ static inline unsigned int sa1100_pcmcia_cmd_time(unsigned int cpu_clock_khz, | |||
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | 120 | ||
| 121 | int sa11xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); | ||
| 122 | void sa11xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); | ||
| 121 | extern int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr); | 123 | extern int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr); |
| 122 | 124 | ||
| 123 | #endif /* !defined(_PCMCIA_SA1100_H) */ | 125 | #endif /* !defined(_PCMCIA_SA1100_H) */ |
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index ef7e9e58782b..6f1a86b43c60 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
| @@ -144,10 +144,10 @@ soc_common_pcmcia_config_skt(struct soc_pcmcia_socket *skt, socket_state_t *stat | |||
| 144 | */ | 144 | */ |
| 145 | if (skt->irq_state != 1 && state->io_irq) { | 145 | if (skt->irq_state != 1 && state->io_irq) { |
| 146 | skt->irq_state = 1; | 146 | skt->irq_state = 1; |
| 147 | set_irq_type(skt->irq, IRQ_TYPE_EDGE_FALLING); | 147 | set_irq_type(skt->socket.pci_irq, IRQ_TYPE_EDGE_FALLING); |
| 148 | } else if (skt->irq_state == 1 && state->io_irq == 0) { | 148 | } else if (skt->irq_state == 1 && state->io_irq == 0) { |
| 149 | skt->irq_state = 0; | 149 | skt->irq_state = 0; |
| 150 | set_irq_type(skt->irq, IRQ_TYPE_NONE); | 150 | set_irq_type(skt->socket.pci_irq, IRQ_TYPE_NONE); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | skt->cs_state = *state; | 153 | skt->cs_state = *state; |
| @@ -492,7 +492,8 @@ static ssize_t show_status(struct device *dev, struct device_attribute *attr, ch | |||
| 492 | 492 | ||
| 493 | p+=sprintf(p, "Vcc : %d\n", skt->cs_state.Vcc); | 493 | p+=sprintf(p, "Vcc : %d\n", skt->cs_state.Vcc); |
| 494 | p+=sprintf(p, "Vpp : %d\n", skt->cs_state.Vpp); | 494 | p+=sprintf(p, "Vpp : %d\n", skt->cs_state.Vpp); |
| 495 | p+=sprintf(p, "IRQ : %d (%d)\n", skt->cs_state.io_irq, skt->irq); | 495 | p+=sprintf(p, "IRQ : %d (%d)\n", skt->cs_state.io_irq, |
| 496 | skt->socket.pci_irq); | ||
| 496 | if (skt->ops->show_timing) | 497 | if (skt->ops->show_timing) |
| 497 | p+=skt->ops->show_timing(skt, p); | 498 | p+=skt->ops->show_timing(skt, p); |
| 498 | 499 | ||
| @@ -574,7 +575,7 @@ void soc_pcmcia_enable_irqs(struct soc_pcmcia_socket *skt, | |||
| 574 | EXPORT_SYMBOL(soc_pcmcia_enable_irqs); | 575 | EXPORT_SYMBOL(soc_pcmcia_enable_irqs); |
| 575 | 576 | ||
| 576 | 577 | ||
| 577 | LIST_HEAD(soc_pcmcia_sockets); | 578 | static LIST_HEAD(soc_pcmcia_sockets); |
| 578 | static DEFINE_MUTEX(soc_pcmcia_sockets_lock); | 579 | static DEFINE_MUTEX(soc_pcmcia_sockets_lock); |
| 579 | 580 | ||
| 580 | #ifdef CONFIG_CPU_FREQ | 581 | #ifdef CONFIG_CPU_FREQ |
| @@ -609,177 +610,137 @@ static int soc_pcmcia_cpufreq_register(void) | |||
| 609 | "notifier for PCMCIA (%d)\n", ret); | 610 | "notifier for PCMCIA (%d)\n", ret); |
| 610 | return ret; | 611 | return ret; |
| 611 | } | 612 | } |
| 613 | fs_initcall(soc_pcmcia_cpufreq_register); | ||
| 612 | 614 | ||
| 613 | static void soc_pcmcia_cpufreq_unregister(void) | 615 | static void soc_pcmcia_cpufreq_unregister(void) |
| 614 | { | 616 | { |
| 615 | cpufreq_unregister_notifier(&soc_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); | 617 | cpufreq_unregister_notifier(&soc_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); |
| 616 | } | 618 | } |
| 619 | module_exit(soc_pcmcia_cpufreq_unregister); | ||
| 617 | 620 | ||
| 618 | #else | ||
| 619 | static int soc_pcmcia_cpufreq_register(void) { return 0; } | ||
| 620 | static void soc_pcmcia_cpufreq_unregister(void) {} | ||
| 621 | #endif | 621 | #endif |
| 622 | 622 | ||
| 623 | int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, | 623 | void soc_pcmcia_remove_one(struct soc_pcmcia_socket *skt) |
| 624 | struct skt_dev_info *sinfo) | ||
| 625 | { | 624 | { |
| 626 | struct soc_pcmcia_socket *skt; | ||
| 627 | int ret, i; | ||
| 628 | |||
| 629 | mutex_lock(&soc_pcmcia_sockets_lock); | 625 | mutex_lock(&soc_pcmcia_sockets_lock); |
| 626 | del_timer_sync(&skt->poll_timer); | ||
| 630 | 627 | ||
| 631 | /* | 628 | pcmcia_unregister_socket(&skt->socket); |
| 632 | * Initialise the per-socket structure. | ||
| 633 | */ | ||
| 634 | for (i = 0; i < sinfo->nskt; i++) { | ||
| 635 | skt = &sinfo->skt[i]; | ||
| 636 | 629 | ||
| 637 | skt->socket.ops = &soc_common_pcmcia_operations; | 630 | flush_scheduled_work(); |
| 638 | skt->socket.owner = ops->owner; | ||
| 639 | skt->socket.dev.parent = dev; | ||
| 640 | 631 | ||
| 641 | init_timer(&skt->poll_timer); | 632 | skt->ops->hw_shutdown(skt); |
| 642 | skt->poll_timer.function = soc_common_pcmcia_poll_event; | ||
| 643 | skt->poll_timer.data = (unsigned long)skt; | ||
| 644 | skt->poll_timer.expires = jiffies + SOC_PCMCIA_POLL_PERIOD; | ||
| 645 | 633 | ||
| 646 | skt->dev = dev; | 634 | soc_common_pcmcia_config_skt(skt, &dead_socket); |
| 647 | skt->ops = ops; | ||
| 648 | 635 | ||
| 649 | ret = request_resource(&iomem_resource, &skt->res_skt); | 636 | list_del(&skt->node); |
| 650 | if (ret) | 637 | mutex_unlock(&soc_pcmcia_sockets_lock); |
| 651 | goto out_err_1; | ||
| 652 | 638 | ||
| 653 | ret = request_resource(&skt->res_skt, &skt->res_io); | 639 | iounmap(skt->virt_io); |
| 654 | if (ret) | 640 | skt->virt_io = NULL; |
| 655 | goto out_err_2; | 641 | release_resource(&skt->res_attr); |
| 642 | release_resource(&skt->res_mem); | ||
| 643 | release_resource(&skt->res_io); | ||
| 644 | release_resource(&skt->res_skt); | ||
| 645 | } | ||
| 646 | EXPORT_SYMBOL(soc_pcmcia_remove_one); | ||
| 656 | 647 | ||
| 657 | ret = request_resource(&skt->res_skt, &skt->res_mem); | 648 | int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt) |
| 658 | if (ret) | 649 | { |
| 659 | goto out_err_3; | 650 | int ret; |
| 660 | 651 | ||
| 661 | ret = request_resource(&skt->res_skt, &skt->res_attr); | 652 | init_timer(&skt->poll_timer); |
| 662 | if (ret) | 653 | skt->poll_timer.function = soc_common_pcmcia_poll_event; |
| 663 | goto out_err_4; | 654 | skt->poll_timer.data = (unsigned long)skt; |
| 655 | skt->poll_timer.expires = jiffies + SOC_PCMCIA_POLL_PERIOD; | ||
| 664 | 656 | ||
| 665 | skt->virt_io = ioremap(skt->res_io.start, 0x10000); | 657 | ret = request_resource(&iomem_resource, &skt->res_skt); |
| 666 | if (skt->virt_io == NULL) { | 658 | if (ret) |
| 667 | ret = -ENOMEM; | 659 | goto out_err_1; |
| 668 | goto out_err_5; | ||
| 669 | } | ||
| 670 | 660 | ||
| 671 | if (list_empty(&soc_pcmcia_sockets)) | 661 | ret = request_resource(&skt->res_skt, &skt->res_io); |
| 672 | soc_pcmcia_cpufreq_register(); | 662 | if (ret) |
| 663 | goto out_err_2; | ||
| 673 | 664 | ||
| 674 | list_add(&skt->node, &soc_pcmcia_sockets); | 665 | ret = request_resource(&skt->res_skt, &skt->res_mem); |
| 666 | if (ret) | ||
| 667 | goto out_err_3; | ||
| 675 | 668 | ||
| 676 | /* | 669 | ret = request_resource(&skt->res_skt, &skt->res_attr); |
| 677 | * We initialize default socket timing here, because | 670 | if (ret) |
| 678 | * we are not guaranteed to see a SetIOMap operation at | 671 | goto out_err_4; |
| 679 | * runtime. | ||
| 680 | */ | ||
| 681 | ops->set_timing(skt); | ||
| 682 | 672 | ||
| 683 | ret = ops->hw_init(skt); | 673 | skt->virt_io = ioremap(skt->res_io.start, 0x10000); |
| 684 | if (ret) | 674 | if (skt->virt_io == NULL) { |
| 685 | goto out_err_6; | 675 | ret = -ENOMEM; |
| 676 | goto out_err_5; | ||
| 677 | } | ||
| 686 | 678 | ||
| 687 | skt->socket.features = SS_CAP_STATIC_MAP|SS_CAP_PCCARD; | 679 | mutex_lock(&soc_pcmcia_sockets_lock); |
| 688 | skt->socket.resource_ops = &pccard_static_ops; | ||
| 689 | skt->socket.irq_mask = 0; | ||
| 690 | skt->socket.map_size = PAGE_SIZE; | ||
| 691 | skt->socket.pci_irq = skt->irq; | ||
| 692 | skt->socket.io_offset = (unsigned long)skt->virt_io; | ||
| 693 | 680 | ||
| 694 | skt->status = soc_common_pcmcia_skt_state(skt); | 681 | list_add(&skt->node, &soc_pcmcia_sockets); |
| 695 | 682 | ||
| 696 | ret = pcmcia_register_socket(&skt->socket); | 683 | /* |
| 697 | if (ret) | 684 | * We initialize default socket timing here, because |
| 698 | goto out_err_7; | 685 | * we are not guaranteed to see a SetIOMap operation at |
| 686 | * runtime. | ||
| 687 | */ | ||
| 688 | skt->ops->set_timing(skt); | ||
| 699 | 689 | ||
| 700 | WARN_ON(skt->socket.sock != i); | 690 | ret = skt->ops->hw_init(skt); |
| 691 | if (ret) | ||
| 692 | goto out_err_6; | ||
| 701 | 693 | ||
| 702 | add_timer(&skt->poll_timer); | 694 | skt->socket.ops = &soc_common_pcmcia_operations; |
| 695 | skt->socket.features = SS_CAP_STATIC_MAP|SS_CAP_PCCARD; | ||
| 696 | skt->socket.resource_ops = &pccard_static_ops; | ||
| 697 | skt->socket.irq_mask = 0; | ||
| 698 | skt->socket.map_size = PAGE_SIZE; | ||
| 699 | skt->socket.io_offset = (unsigned long)skt->virt_io; | ||
| 703 | 700 | ||
| 704 | ret = device_create_file(&skt->socket.dev, &dev_attr_status); | 701 | skt->status = soc_common_pcmcia_skt_state(skt); |
| 705 | if (ret) | ||
| 706 | goto out_err_8; | ||
| 707 | } | ||
| 708 | 702 | ||
| 709 | dev_set_drvdata(dev, sinfo); | 703 | ret = pcmcia_register_socket(&skt->socket); |
| 710 | ret = 0; | 704 | if (ret) |
| 711 | goto out; | 705 | goto out_err_7; |
| 712 | 706 | ||
| 713 | do { | 707 | add_timer(&skt->poll_timer); |
| 714 | skt = &sinfo->skt[i]; | 708 | |
| 709 | mutex_unlock(&soc_pcmcia_sockets_lock); | ||
| 710 | |||
| 711 | ret = device_create_file(&skt->socket.dev, &dev_attr_status); | ||
| 712 | if (ret) | ||
| 713 | goto out_err_8; | ||
| 714 | |||
| 715 | return ret; | ||
| 715 | 716 | ||
| 716 | device_remove_file(&skt->socket.dev, &dev_attr_status); | ||
| 717 | out_err_8: | 717 | out_err_8: |
| 718 | del_timer_sync(&skt->poll_timer); | 718 | mutex_lock(&soc_pcmcia_sockets_lock); |
| 719 | pcmcia_unregister_socket(&skt->socket); | 719 | del_timer_sync(&skt->poll_timer); |
| 720 | pcmcia_unregister_socket(&skt->socket); | ||
| 720 | 721 | ||
| 721 | out_err_7: | 722 | out_err_7: |
| 722 | flush_scheduled_work(); | 723 | flush_scheduled_work(); |
| 723 | 724 | ||
| 724 | ops->hw_shutdown(skt); | 725 | skt->ops->hw_shutdown(skt); |
| 725 | out_err_6: | 726 | out_err_6: |
| 726 | list_del(&skt->node); | 727 | list_del(&skt->node); |
| 727 | iounmap(skt->virt_io); | 728 | mutex_unlock(&soc_pcmcia_sockets_lock); |
| 729 | iounmap(skt->virt_io); | ||
| 728 | out_err_5: | 730 | out_err_5: |
| 729 | release_resource(&skt->res_attr); | 731 | release_resource(&skt->res_attr); |
| 730 | out_err_4: | 732 | out_err_4: |
| 731 | release_resource(&skt->res_mem); | 733 | release_resource(&skt->res_mem); |
| 732 | out_err_3: | 734 | out_err_3: |
| 733 | release_resource(&skt->res_io); | 735 | release_resource(&skt->res_io); |
| 734 | out_err_2: | 736 | out_err_2: |
| 735 | release_resource(&skt->res_skt); | 737 | release_resource(&skt->res_skt); |
| 736 | out_err_1: | 738 | out_err_1: |
| 737 | i--; | ||
| 738 | } while (i > 0); | ||
| 739 | 739 | ||
| 740 | kfree(sinfo); | ||
| 741 | |||
| 742 | out: | ||
| 743 | mutex_unlock(&soc_pcmcia_sockets_lock); | ||
| 744 | return ret; | 740 | return ret; |
| 745 | } | 741 | } |
| 742 | EXPORT_SYMBOL(soc_pcmcia_add_one); | ||
| 746 | 743 | ||
| 747 | int soc_common_drv_pcmcia_remove(struct device *dev) | 744 | MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>"); |
| 748 | { | 745 | MODULE_DESCRIPTION("Linux PCMCIA Card Services: Common SoC support"); |
| 749 | struct skt_dev_info *sinfo = dev_get_drvdata(dev); | 746 | MODULE_LICENSE("Dual MPL/GPL"); |
| 750 | int i; | ||
| 751 | |||
| 752 | dev_set_drvdata(dev, NULL); | ||
| 753 | |||
| 754 | mutex_lock(&soc_pcmcia_sockets_lock); | ||
| 755 | for (i = 0; i < sinfo->nskt; i++) { | ||
| 756 | struct soc_pcmcia_socket *skt = &sinfo->skt[i]; | ||
| 757 | |||
| 758 | del_timer_sync(&skt->poll_timer); | ||
| 759 | |||
| 760 | pcmcia_unregister_socket(&skt->socket); | ||
| 761 | |||
| 762 | flush_scheduled_work(); | ||
| 763 | |||
| 764 | skt->ops->hw_shutdown(skt); | ||
| 765 | |||
| 766 | soc_common_pcmcia_config_skt(skt, &dead_socket); | ||
| 767 | |||
| 768 | list_del(&skt->node); | ||
| 769 | iounmap(skt->virt_io); | ||
| 770 | skt->virt_io = NULL; | ||
| 771 | release_resource(&skt->res_attr); | ||
| 772 | release_resource(&skt->res_mem); | ||
| 773 | release_resource(&skt->res_io); | ||
| 774 | release_resource(&skt->res_skt); | ||
| 775 | } | ||
| 776 | if (list_empty(&soc_pcmcia_sockets)) | ||
| 777 | soc_pcmcia_cpufreq_unregister(); | ||
| 778 | |||
| 779 | mutex_unlock(&soc_pcmcia_sockets_lock); | ||
| 780 | |||
| 781 | kfree(sinfo); | ||
| 782 | |||
| 783 | return 0; | ||
| 784 | } | ||
| 785 | EXPORT_SYMBOL(soc_common_drv_pcmcia_remove); | ||
diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h index 290e143839ee..e40824ce6b0b 100644 --- a/drivers/pcmcia/soc_common.h +++ b/drivers/pcmcia/soc_common.h | |||
| @@ -30,14 +30,12 @@ struct soc_pcmcia_socket { | |||
| 30 | /* | 30 | /* |
| 31 | * Info from low level handler | 31 | * Info from low level handler |
| 32 | */ | 32 | */ |
| 33 | struct device *dev; | ||
| 34 | unsigned int nr; | 33 | unsigned int nr; |
| 35 | unsigned int irq; | ||
| 36 | 34 | ||
| 37 | /* | 35 | /* |
| 38 | * Core PCMCIA state | 36 | * Core PCMCIA state |
| 39 | */ | 37 | */ |
| 40 | struct pcmcia_low_level *ops; | 38 | const struct pcmcia_low_level *ops; |
| 41 | 39 | ||
| 42 | unsigned int status; | 40 | unsigned int status; |
| 43 | socket_state_t cs_state; | 41 | socket_state_t cs_state; |
| @@ -135,10 +133,8 @@ extern void soc_pcmcia_enable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_ | |||
| 135 | extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_pcmcia_timing *); | 133 | extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_pcmcia_timing *); |
| 136 | 134 | ||
| 137 | 135 | ||
| 138 | extern struct list_head soc_pcmcia_sockets; | 136 | void soc_pcmcia_remove_one(struct soc_pcmcia_socket *skt); |
| 139 | 137 | int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt); | |
| 140 | extern int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, struct skt_dev_info *sinfo); | ||
| 141 | extern int soc_common_drv_pcmcia_remove(struct device *dev); | ||
| 142 | 138 | ||
| 143 | 139 | ||
| 144 | #ifdef CONFIG_PCMCIA_DEBUG | 140 | #ifdef CONFIG_PCMCIA_DEBUG |
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 6918849d511e..12c49ee135e1 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c | |||
| @@ -55,21 +55,6 @@ | |||
| 55 | #include <pcmcia/ss.h> | 55 | #include <pcmcia/ss.h> |
| 56 | #include "tcic.h" | 56 | #include "tcic.h" |
| 57 | 57 | ||
| 58 | #ifdef CONFIG_PCMCIA_DEBUG | ||
| 59 | static int pc_debug; | ||
| 60 | |||
| 61 | module_param(pc_debug, int, 0644); | ||
| 62 | static const char version[] = | ||
| 63 | "tcic.c 1.111 2000/02/15 04:13:12 (David Hinds)"; | ||
| 64 | |||
| 65 | #define debug(lvl, fmt, arg...) do { \ | ||
| 66 | if (pc_debug > (lvl)) \ | ||
| 67 | printk(KERN_DEBUG "tcic: " fmt , ## arg); \ | ||
| 68 | } while (0) | ||
| 69 | #else | ||
| 70 | #define debug(lvl, fmt, arg...) do { } while (0) | ||
| 71 | #endif | ||
| 72 | |||
| 73 | MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); | 58 | MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); |
| 74 | MODULE_DESCRIPTION("Databook TCIC-2 PCMCIA socket driver"); | 59 | MODULE_DESCRIPTION("Databook TCIC-2 PCMCIA socket driver"); |
| 75 | MODULE_LICENSE("Dual MPL/GPL"); | 60 | MODULE_LICENSE("Dual MPL/GPL"); |
| @@ -574,7 +559,7 @@ static irqreturn_t tcic_interrupt(int irq, void *dev) | |||
| 574 | } else | 559 | } else |
| 575 | active = 1; | 560 | active = 1; |
| 576 | 561 | ||
| 577 | debug(2, "tcic_interrupt()\n"); | 562 | pr_debug("tcic_interrupt()\n"); |
| 578 | 563 | ||
| 579 | for (i = 0; i < sockets; i++) { | 564 | for (i = 0; i < sockets; i++) { |
| 580 | psock = socket_table[i].psock; | 565 | psock = socket_table[i].psock; |
| @@ -611,13 +596,13 @@ static irqreturn_t tcic_interrupt(int irq, void *dev) | |||
| 611 | } | 596 | } |
| 612 | active = 0; | 597 | active = 0; |
| 613 | 598 | ||
| 614 | debug(2, "interrupt done\n"); | 599 | pr_debug("interrupt done\n"); |
| 615 | return IRQ_HANDLED; | 600 | return IRQ_HANDLED; |
| 616 | } /* tcic_interrupt */ | 601 | } /* tcic_interrupt */ |
| 617 | 602 | ||
| 618 | static void tcic_timer(u_long data) | 603 | static void tcic_timer(u_long data) |
| 619 | { | 604 | { |
| 620 | debug(2, "tcic_timer()\n"); | 605 | pr_debug("tcic_timer()\n"); |
| 621 | tcic_timer_pending = 0; | 606 | tcic_timer_pending = 0; |
| 622 | tcic_interrupt(0, NULL); | 607 | tcic_interrupt(0, NULL); |
| 623 | } /* tcic_timer */ | 608 | } /* tcic_timer */ |
| @@ -644,7 +629,7 @@ static int tcic_get_status(struct pcmcia_socket *sock, u_int *value) | |||
| 644 | reg = tcic_getb(TCIC_PWR); | 629 | reg = tcic_getb(TCIC_PWR); |
| 645 | if (reg & (TCIC_PWR_VCC(psock)|TCIC_PWR_VPP(psock))) | 630 | if (reg & (TCIC_PWR_VCC(psock)|TCIC_PWR_VPP(psock))) |
| 646 | *value |= SS_POWERON; | 631 | *value |= SS_POWERON; |
| 647 | debug(1, "GetStatus(%d) = %#2.2x\n", psock, *value); | 632 | dev_dbg(&sock->dev, "GetStatus(%d) = %#2.2x\n", psock, *value); |
| 648 | return 0; | 633 | return 0; |
| 649 | } /* tcic_get_status */ | 634 | } /* tcic_get_status */ |
| 650 | 635 | ||
| @@ -656,7 +641,7 @@ static int tcic_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
| 656 | u_char reg; | 641 | u_char reg; |
| 657 | u_short scf1, scf2; | 642 | u_short scf1, scf2; |
| 658 | 643 | ||
| 659 | debug(1, "SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " | 644 | dev_dbg(&sock->dev, "SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " |
| 660 | "io_irq %d, csc_mask %#2.2x)\n", psock, state->flags, | 645 | "io_irq %d, csc_mask %#2.2x)\n", psock, state->flags, |
| 661 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); | 646 | state->Vcc, state->Vpp, state->io_irq, state->csc_mask); |
| 662 | tcic_setw(TCIC_ADDR+2, (psock << TCIC_SS_SHFT) | TCIC_ADR2_INDREG); | 647 | tcic_setw(TCIC_ADDR+2, (psock << TCIC_SS_SHFT) | TCIC_ADR2_INDREG); |
| @@ -731,7 +716,7 @@ static int tcic_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) | |||
| 731 | u_int addr; | 716 | u_int addr; |
| 732 | u_short base, len, ioctl; | 717 | u_short base, len, ioctl; |
| 733 | 718 | ||
| 734 | debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " | 719 | dev_dbg(&sock->dev, "SetIOMap(%d, %d, %#2.2x, %d ns, " |
| 735 | "%#llx-%#llx)\n", psock, io->map, io->flags, io->speed, | 720 | "%#llx-%#llx)\n", psock, io->map, io->flags, io->speed, |
| 736 | (unsigned long long)io->start, (unsigned long long)io->stop); | 721 | (unsigned long long)io->start, (unsigned long long)io->stop); |
| 737 | if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || | 722 | if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || |
| @@ -768,7 +753,7 @@ static int tcic_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *m | |||
| 768 | u_short addr, ctl; | 753 | u_short addr, ctl; |
| 769 | u_long base, len, mmap; | 754 | u_long base, len, mmap; |
| 770 | 755 | ||
| 771 | debug(1, "SetMemMap(%d, %d, %#2.2x, %d ns, " | 756 | dev_dbg(&sock->dev, "SetMemMap(%d, %d, %#2.2x, %d ns, " |
| 772 | "%#llx-%#llx, %#x)\n", psock, mem->map, mem->flags, | 757 | "%#llx-%#llx, %#x)\n", psock, mem->map, mem->flags, |
| 773 | mem->speed, (unsigned long long)mem->res->start, | 758 | mem->speed, (unsigned long long)mem->res->start, |
| 774 | (unsigned long long)mem->res->end, mem->card_start); | 759 | (unsigned long long)mem->res->end, mem->card_start); |
diff --git a/drivers/pcmcia/topic.h b/drivers/pcmcia/topic.h index edccfa5bb400..615a45a8fe86 100644 --- a/drivers/pcmcia/topic.h +++ b/drivers/pcmcia/topic.h | |||
| @@ -114,22 +114,17 @@ static void topic97_zoom_video(struct pcmcia_socket *sock, int onoff) | |||
| 114 | reg_zv |= TOPIC97_ZV_CONTROL_ENABLE; | 114 | reg_zv |= TOPIC97_ZV_CONTROL_ENABLE; |
| 115 | config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv); | 115 | config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv); |
| 116 | 116 | ||
| 117 | reg = config_readb(socket, TOPIC97_MISC2); | ||
| 118 | reg |= TOPIC97_MISC2_ZV_ENABLE; | ||
| 119 | config_writeb(socket, TOPIC97_MISC2, reg); | ||
| 120 | |||
| 121 | /* not sure this is needed, doc is unclear */ | ||
| 122 | #if 0 | ||
| 123 | reg = config_readb(socket, TOPIC97_AUDIO_VIDEO_SWITCH); | 117 | reg = config_readb(socket, TOPIC97_AUDIO_VIDEO_SWITCH); |
| 124 | reg |= TOPIC97_AVS_AUDIO_CONTROL | TOPIC97_AVS_VIDEO_CONTROL; | 118 | reg |= TOPIC97_AVS_AUDIO_CONTROL | TOPIC97_AVS_VIDEO_CONTROL; |
| 125 | config_writeb(socket, TOPIC97_AUDIO_VIDEO_SWITCH, reg); | 119 | config_writeb(socket, TOPIC97_AUDIO_VIDEO_SWITCH, reg); |
| 126 | #endif | 120 | } else { |
| 127 | } | ||
| 128 | else { | ||
| 129 | reg_zv &= ~TOPIC97_ZV_CONTROL_ENABLE; | 121 | reg_zv &= ~TOPIC97_ZV_CONTROL_ENABLE; |
| 130 | config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv); | 122 | config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv); |
| 131 | } | ||
| 132 | 123 | ||
| 124 | reg = config_readb(socket, TOPIC97_AUDIO_VIDEO_SWITCH); | ||
| 125 | reg &= ~(TOPIC97_AVS_AUDIO_CONTROL | TOPIC97_AVS_VIDEO_CONTROL); | ||
| 126 | config_writeb(socket, TOPIC97_AUDIO_VIDEO_SWITCH, reg); | ||
| 127 | } | ||
| 133 | } | 128 | } |
| 134 | 129 | ||
| 135 | static int topic97_override(struct yenta_socket *socket) | 130 | static int topic97_override(struct yenta_socket *socket) |
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 0a8f735f6c4a..ab64522aaa64 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c | |||
| @@ -52,7 +52,7 @@ | |||
| 52 | */ | 52 | */ |
| 53 | #undef START_IN_KERNEL_MODE | 53 | #undef START_IN_KERNEL_MODE |
| 54 | 54 | ||
| 55 | #define DRV_VER "0.5.17" | 55 | #define DRV_VER "0.5.18" |
| 56 | 56 | ||
| 57 | /* | 57 | /* |
| 58 | * According to the Atom N270 datasheet, | 58 | * According to the Atom N270 datasheet, |
| @@ -61,7 +61,7 @@ | |||
| 61 | * measured by the on-die thermal monitor are within 0 <= Tj <= 90. So, | 61 | * measured by the on-die thermal monitor are within 0 <= Tj <= 90. So, |
| 62 | * assume 89°C is critical temperature. | 62 | * assume 89°C is critical temperature. |
| 63 | */ | 63 | */ |
| 64 | #define ACERHDF_TEMP_CRIT 89 | 64 | #define ACERHDF_TEMP_CRIT 89000 |
| 65 | #define ACERHDF_FAN_OFF 0 | 65 | #define ACERHDF_FAN_OFF 0 |
| 66 | #define ACERHDF_FAN_AUTO 1 | 66 | #define ACERHDF_FAN_AUTO 1 |
| 67 | 67 | ||
| @@ -69,7 +69,7 @@ | |||
| 69 | * No matter what value the user puts into the fanon variable, turn on the fan | 69 | * No matter what value the user puts into the fanon variable, turn on the fan |
| 70 | * at 80 degree Celsius to prevent hardware damage | 70 | * at 80 degree Celsius to prevent hardware damage |
| 71 | */ | 71 | */ |
| 72 | #define ACERHDF_MAX_FANON 80 | 72 | #define ACERHDF_MAX_FANON 80000 |
| 73 | 73 | ||
| 74 | /* | 74 | /* |
| 75 | * Maximum interval between two temperature checks is 15 seconds, as the die | 75 | * Maximum interval between two temperature checks is 15 seconds, as the die |
| @@ -85,8 +85,8 @@ static int kernelmode; | |||
| 85 | #endif | 85 | #endif |
| 86 | 86 | ||
| 87 | static unsigned int interval = 10; | 87 | static unsigned int interval = 10; |
| 88 | static unsigned int fanon = 63; | 88 | static unsigned int fanon = 63000; |
| 89 | static unsigned int fanoff = 58; | 89 | static unsigned int fanoff = 58000; |
| 90 | static unsigned int verbose; | 90 | static unsigned int verbose; |
| 91 | static unsigned int fanstate = ACERHDF_FAN_AUTO; | 91 | static unsigned int fanstate = ACERHDF_FAN_AUTO; |
| 92 | static char force_bios[16]; | 92 | static char force_bios[16]; |
| @@ -171,7 +171,7 @@ static int acerhdf_get_temp(int *temp) | |||
| 171 | if (ec_read(bios_cfg->tempreg, &read_temp)) | 171 | if (ec_read(bios_cfg->tempreg, &read_temp)) |
| 172 | return -EINVAL; | 172 | return -EINVAL; |
| 173 | 173 | ||
| 174 | *temp = read_temp; | 174 | *temp = read_temp * 1000; |
| 175 | 175 | ||
| 176 | return 0; | 176 | return 0; |
| 177 | } | 177 | } |
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index d379e74a05d0..4226e5352738 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
| @@ -150,8 +150,6 @@ struct eeepc_hotk { | |||
| 150 | /* The actual device the driver binds to */ | 150 | /* The actual device the driver binds to */ |
| 151 | static struct eeepc_hotk *ehotk; | 151 | static struct eeepc_hotk *ehotk; |
| 152 | 152 | ||
| 153 | static void eeepc_rfkill_hotplug(bool real); | ||
| 154 | |||
| 155 | /* Platform device/driver */ | 153 | /* Platform device/driver */ |
| 156 | static int eeepc_hotk_thaw(struct device *device); | 154 | static int eeepc_hotk_thaw(struct device *device); |
| 157 | static int eeepc_hotk_restore(struct device *device); | 155 | static int eeepc_hotk_restore(struct device *device); |
| @@ -345,16 +343,7 @@ static bool eeepc_wlan_rfkill_blocked(void) | |||
| 345 | static int eeepc_rfkill_set(void *data, bool blocked) | 343 | static int eeepc_rfkill_set(void *data, bool blocked) |
| 346 | { | 344 | { |
| 347 | unsigned long asl = (unsigned long)data; | 345 | unsigned long asl = (unsigned long)data; |
| 348 | int ret; | 346 | return set_acpi(asl, !blocked); |
| 349 | |||
| 350 | if (asl != CM_ASL_WLAN) | ||
| 351 | return set_acpi(asl, !blocked); | ||
| 352 | |||
| 353 | /* hack to avoid panic with rt2860sta */ | ||
| 354 | if (blocked) | ||
| 355 | eeepc_rfkill_hotplug(false); | ||
| 356 | ret = set_acpi(asl, !blocked); | ||
| 357 | return ret; | ||
| 358 | } | 347 | } |
| 359 | 348 | ||
| 360 | static const struct rfkill_ops eeepc_rfkill_ops = { | 349 | static const struct rfkill_ops eeepc_rfkill_ops = { |
| @@ -367,7 +356,8 @@ static void __devinit eeepc_enable_camera(void) | |||
| 367 | * If the following call to set_acpi() fails, it's because there's no | 356 | * If the following call to set_acpi() fails, it's because there's no |
| 368 | * camera so we can ignore the error. | 357 | * camera so we can ignore the error. |
| 369 | */ | 358 | */ |
| 370 | set_acpi(CM_ASL_CAMERA, 1); | 359 | if (get_acpi(CM_ASL_CAMERA) == 0) |
| 360 | set_acpi(CM_ASL_CAMERA, 1); | ||
| 371 | } | 361 | } |
| 372 | 362 | ||
| 373 | /* | 363 | /* |
| @@ -654,13 +644,13 @@ static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot, | |||
| 654 | return 0; | 644 | return 0; |
| 655 | } | 645 | } |
| 656 | 646 | ||
| 657 | static void eeepc_rfkill_hotplug(bool real) | 647 | static void eeepc_rfkill_hotplug(void) |
| 658 | { | 648 | { |
| 659 | struct pci_dev *dev; | 649 | struct pci_dev *dev; |
| 660 | struct pci_bus *bus; | 650 | struct pci_bus *bus; |
| 661 | bool blocked = real ? eeepc_wlan_rfkill_blocked() : true; | 651 | bool blocked = eeepc_wlan_rfkill_blocked(); |
| 662 | 652 | ||
| 663 | if (real && ehotk->wlan_rfkill) | 653 | if (ehotk->wlan_rfkill) |
| 664 | rfkill_set_sw_state(ehotk->wlan_rfkill, blocked); | 654 | rfkill_set_sw_state(ehotk->wlan_rfkill, blocked); |
| 665 | 655 | ||
| 666 | mutex_lock(&ehotk->hotplug_lock); | 656 | mutex_lock(&ehotk->hotplug_lock); |
| @@ -703,7 +693,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) | |||
| 703 | if (event != ACPI_NOTIFY_BUS_CHECK) | 693 | if (event != ACPI_NOTIFY_BUS_CHECK) |
| 704 | return; | 694 | return; |
| 705 | 695 | ||
| 706 | eeepc_rfkill_hotplug(true); | 696 | eeepc_rfkill_hotplug(); |
| 707 | } | 697 | } |
| 708 | 698 | ||
| 709 | static void eeepc_hotk_notify(struct acpi_device *device, u32 event) | 699 | static void eeepc_hotk_notify(struct acpi_device *device, u32 event) |
| @@ -861,7 +851,7 @@ static int eeepc_hotk_restore(struct device *device) | |||
| 861 | { | 851 | { |
| 862 | /* Refresh both wlan rfkill state and pci hotplug */ | 852 | /* Refresh both wlan rfkill state and pci hotplug */ |
| 863 | if (ehotk->wlan_rfkill) | 853 | if (ehotk->wlan_rfkill) |
| 864 | eeepc_rfkill_hotplug(true); | 854 | eeepc_rfkill_hotplug(); |
| 865 | 855 | ||
| 866 | if (ehotk->bluetooth_rfkill) | 856 | if (ehotk->bluetooth_rfkill) |
| 867 | rfkill_set_sw_state(ehotk->bluetooth_rfkill, | 857 | rfkill_set_sw_state(ehotk->bluetooth_rfkill, |
| @@ -1004,7 +994,7 @@ static void eeepc_rfkill_exit(void) | |||
| 1004 | * Refresh pci hotplug in case the rfkill state was changed after | 994 | * Refresh pci hotplug in case the rfkill state was changed after |
| 1005 | * eeepc_unregister_rfkill_notifier() | 995 | * eeepc_unregister_rfkill_notifier() |
| 1006 | */ | 996 | */ |
| 1007 | eeepc_rfkill_hotplug(true); | 997 | eeepc_rfkill_hotplug(); |
| 1008 | if (ehotk->hotplug_slot) | 998 | if (ehotk->hotplug_slot) |
| 1009 | pci_hp_deregister(ehotk->hotplug_slot); | 999 | pci_hp_deregister(ehotk->hotplug_slot); |
| 1010 | 1000 | ||
| @@ -1120,7 +1110,7 @@ static int eeepc_rfkill_init(struct device *dev) | |||
| 1120 | * Refresh pci hotplug in case the rfkill state was changed during | 1110 | * Refresh pci hotplug in case the rfkill state was changed during |
| 1121 | * setup. | 1111 | * setup. |
| 1122 | */ | 1112 | */ |
| 1123 | eeepc_rfkill_hotplug(true); | 1113 | eeepc_rfkill_hotplug(); |
| 1124 | 1114 | ||
| 1125 | exit: | 1115 | exit: |
| 1126 | if (result && result != -ENODEV) | 1116 | if (result && result != -ENODEV) |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index d93108d148fc..a848c7e20aeb 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
| @@ -1680,36 +1680,48 @@ static void tpacpi_remove_driver_attributes(struct device_driver *drv) | |||
| 1680 | | (__bv1) << 8 | (__bv2) } | 1680 | | (__bv1) << 8 | (__bv2) } |
| 1681 | 1681 | ||
| 1682 | #define TPV_Q_X(__v, __bid1, __bid2, __bv1, __bv2, \ | 1682 | #define TPV_Q_X(__v, __bid1, __bid2, __bv1, __bv2, \ |
| 1683 | __eid1, __eid2, __ev1, __ev2) \ | 1683 | __eid, __ev1, __ev2) \ |
| 1684 | { .vendor = (__v), \ | 1684 | { .vendor = (__v), \ |
| 1685 | .bios = TPID(__bid1, __bid2), \ | 1685 | .bios = TPID(__bid1, __bid2), \ |
| 1686 | .ec = TPID(__eid1, __eid2), \ | 1686 | .ec = __eid, \ |
| 1687 | .quirks = (__ev1) << 24 | (__ev2) << 16 \ | 1687 | .quirks = (__ev1) << 24 | (__ev2) << 16 \ |
| 1688 | | (__bv1) << 8 | (__bv2) } | 1688 | | (__bv1) << 8 | (__bv2) } |
| 1689 | 1689 | ||
| 1690 | #define TPV_QI0(__id1, __id2, __bv1, __bv2) \ | 1690 | #define TPV_QI0(__id1, __id2, __bv1, __bv2) \ |
| 1691 | TPV_Q(PCI_VENDOR_ID_IBM, __id1, __id2, __bv1, __bv2) | 1691 | TPV_Q(PCI_VENDOR_ID_IBM, __id1, __id2, __bv1, __bv2) |
| 1692 | 1692 | ||
| 1693 | /* Outdated IBM BIOSes often lack the EC id string */ | ||
| 1693 | #define TPV_QI1(__id1, __id2, __bv1, __bv2, __ev1, __ev2) \ | 1694 | #define TPV_QI1(__id1, __id2, __bv1, __bv2, __ev1, __ev2) \ |
| 1694 | TPV_Q_X(PCI_VENDOR_ID_IBM, __id1, __id2, \ | 1695 | TPV_Q_X(PCI_VENDOR_ID_IBM, __id1, __id2, \ |
| 1695 | __bv1, __bv2, __id1, __id2, __ev1, __ev2) | 1696 | __bv1, __bv2, TPID(__id1, __id2), \ |
| 1697 | __ev1, __ev2), \ | ||
| 1698 | TPV_Q_X(PCI_VENDOR_ID_IBM, __id1, __id2, \ | ||
| 1699 | __bv1, __bv2, TPACPI_MATCH_UNKNOWN, \ | ||
| 1700 | __ev1, __ev2) | ||
| 1696 | 1701 | ||
| 1702 | /* Outdated IBM BIOSes often lack the EC id string */ | ||
| 1697 | #define TPV_QI2(__bid1, __bid2, __bv1, __bv2, \ | 1703 | #define TPV_QI2(__bid1, __bid2, __bv1, __bv2, \ |
| 1698 | __eid1, __eid2, __ev1, __ev2) \ | 1704 | __eid1, __eid2, __ev1, __ev2) \ |
| 1699 | TPV_Q_X(PCI_VENDOR_ID_IBM, __bid1, __bid2, \ | 1705 | TPV_Q_X(PCI_VENDOR_ID_IBM, __bid1, __bid2, \ |
| 1700 | __bv1, __bv2, __eid1, __eid2, __ev1, __ev2) | 1706 | __bv1, __bv2, TPID(__eid1, __eid2), \ |
| 1707 | __ev1, __ev2), \ | ||
| 1708 | TPV_Q_X(PCI_VENDOR_ID_IBM, __bid1, __bid2, \ | ||
| 1709 | __bv1, __bv2, TPACPI_MATCH_UNKNOWN, \ | ||
| 1710 | __ev1, __ev2) | ||
| 1701 | 1711 | ||
| 1702 | #define TPV_QL0(__id1, __id2, __bv1, __bv2) \ | 1712 | #define TPV_QL0(__id1, __id2, __bv1, __bv2) \ |
| 1703 | TPV_Q(PCI_VENDOR_ID_LENOVO, __id1, __id2, __bv1, __bv2) | 1713 | TPV_Q(PCI_VENDOR_ID_LENOVO, __id1, __id2, __bv1, __bv2) |
| 1704 | 1714 | ||
| 1705 | #define TPV_QL1(__id1, __id2, __bv1, __bv2, __ev1, __ev2) \ | 1715 | #define TPV_QL1(__id1, __id2, __bv1, __bv2, __ev1, __ev2) \ |
| 1706 | TPV_Q_X(PCI_VENDOR_ID_LENOVO, __id1, __id2, \ | 1716 | TPV_Q_X(PCI_VENDOR_ID_LENOVO, __id1, __id2, \ |
| 1707 | __bv1, __bv2, __id1, __id2, __ev1, __ev2) | 1717 | __bv1, __bv2, TPID(__id1, __id2), \ |
| 1718 | __ev1, __ev2) | ||
| 1708 | 1719 | ||
| 1709 | #define TPV_QL2(__bid1, __bid2, __bv1, __bv2, \ | 1720 | #define TPV_QL2(__bid1, __bid2, __bv1, __bv2, \ |
| 1710 | __eid1, __eid2, __ev1, __ev2) \ | 1721 | __eid1, __eid2, __ev1, __ev2) \ |
| 1711 | TPV_Q_X(PCI_VENDOR_ID_LENOVO, __bid1, __bid2, \ | 1722 | TPV_Q_X(PCI_VENDOR_ID_LENOVO, __bid1, __bid2, \ |
| 1712 | __bv1, __bv2, __eid1, __eid2, __ev1, __ev2) | 1723 | __bv1, __bv2, TPID(__eid1, __eid2), \ |
| 1724 | __ev1, __ev2) | ||
| 1713 | 1725 | ||
| 1714 | static const struct tpacpi_quirk tpacpi_bios_version_qtable[] __initconst = { | 1726 | static const struct tpacpi_quirk tpacpi_bios_version_qtable[] __initconst = { |
| 1715 | /* Numeric models ------------------ */ | 1727 | /* Numeric models ------------------ */ |
| @@ -6313,7 +6325,7 @@ static int brightness_write(char *buf) | |||
| 6313 | * Doing it this way makes the syscall restartable in case of EINTR | 6325 | * Doing it this way makes the syscall restartable in case of EINTR |
| 6314 | */ | 6326 | */ |
| 6315 | rc = brightness_set(level); | 6327 | rc = brightness_set(level); |
| 6316 | return (rc == -EINTR)? ERESTARTSYS : rc; | 6328 | return (rc == -EINTR)? -ERESTARTSYS : rc; |
| 6317 | } | 6329 | } |
| 6318 | 6330 | ||
| 6319 | static struct ibm_struct brightness_driver_data = { | 6331 | static struct ibm_struct brightness_driver_data = { |
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c index 35a0b192d768..2d414e23d390 100644 --- a/drivers/pps/kapi.c +++ b/drivers/pps/kapi.c | |||
| @@ -271,6 +271,7 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
| 271 | { | 271 | { |
| 272 | struct pps_device *pps; | 272 | struct pps_device *pps; |
| 273 | unsigned long flags; | 273 | unsigned long flags; |
| 274 | int captured = 0; | ||
| 274 | 275 | ||
| 275 | if ((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0) { | 276 | if ((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0) { |
| 276 | printk(KERN_ERR "pps: unknown event (%x) for source %d\n", | 277 | printk(KERN_ERR "pps: unknown event (%x) for source %d\n", |
| @@ -293,7 +294,8 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
| 293 | 294 | ||
| 294 | /* Check the event */ | 295 | /* Check the event */ |
| 295 | pps->current_mode = pps->params.mode; | 296 | pps->current_mode = pps->params.mode; |
| 296 | if (event & PPS_CAPTUREASSERT) { | 297 | if ((event & PPS_CAPTUREASSERT) & |
| 298 | (pps->params.mode & PPS_CAPTUREASSERT)) { | ||
| 297 | /* We have to add an offset? */ | 299 | /* We have to add an offset? */ |
| 298 | if (pps->params.mode & PPS_OFFSETASSERT) | 300 | if (pps->params.mode & PPS_OFFSETASSERT) |
| 299 | pps_add_offset(ts, &pps->params.assert_off_tu); | 301 | pps_add_offset(ts, &pps->params.assert_off_tu); |
| @@ -303,8 +305,11 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
| 303 | pps->assert_sequence++; | 305 | pps->assert_sequence++; |
| 304 | pr_debug("capture assert seq #%u for source %d\n", | 306 | pr_debug("capture assert seq #%u for source %d\n", |
| 305 | pps->assert_sequence, source); | 307 | pps->assert_sequence, source); |
| 308 | |||
| 309 | captured = ~0; | ||
| 306 | } | 310 | } |
| 307 | if (event & PPS_CAPTURECLEAR) { | 311 | if ((event & PPS_CAPTURECLEAR) & |
| 312 | (pps->params.mode & PPS_CAPTURECLEAR)) { | ||
| 308 | /* We have to add an offset? */ | 313 | /* We have to add an offset? */ |
| 309 | if (pps->params.mode & PPS_OFFSETCLEAR) | 314 | if (pps->params.mode & PPS_OFFSETCLEAR) |
| 310 | pps_add_offset(ts, &pps->params.clear_off_tu); | 315 | pps_add_offset(ts, &pps->params.clear_off_tu); |
| @@ -314,12 +319,17 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data) | |||
| 314 | pps->clear_sequence++; | 319 | pps->clear_sequence++; |
| 315 | pr_debug("capture clear seq #%u for source %d\n", | 320 | pr_debug("capture clear seq #%u for source %d\n", |
| 316 | pps->clear_sequence, source); | 321 | pps->clear_sequence, source); |
| 322 | |||
| 323 | captured = ~0; | ||
| 317 | } | 324 | } |
| 318 | 325 | ||
| 319 | pps->go = ~0; | 326 | /* Wake up iif captured somthing */ |
| 320 | wake_up_interruptible(&pps->queue); | 327 | if (captured) { |
| 328 | pps->go = ~0; | ||
| 329 | wake_up_interruptible(&pps->queue); | ||
| 321 | 330 | ||
| 322 | kill_fasync(&pps->async_queue, SIGIO, POLL_IN); | 331 | kill_fasync(&pps->async_queue, SIGIO, POLL_IN); |
| 332 | } | ||
| 323 | 333 | ||
| 324 | spin_unlock_irqrestore(&pps->lock, flags); | 334 | spin_unlock_irqrestore(&pps->lock, flags); |
| 325 | 335 | ||
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c index fea17e7805e9..ca5183bdad85 100644 --- a/drivers/pps/pps.c +++ b/drivers/pps/pps.c | |||
| @@ -71,9 +71,14 @@ static long pps_cdev_ioctl(struct file *file, | |||
| 71 | case PPS_GETPARAMS: | 71 | case PPS_GETPARAMS: |
| 72 | pr_debug("PPS_GETPARAMS: source %d\n", pps->id); | 72 | pr_debug("PPS_GETPARAMS: source %d\n", pps->id); |
| 73 | 73 | ||
| 74 | /* Return current parameters */ | 74 | spin_lock_irq(&pps->lock); |
| 75 | err = copy_to_user(uarg, &pps->params, | 75 | |
| 76 | sizeof(struct pps_kparams)); | 76 | /* Get the current parameters */ |
| 77 | params = pps->params; | ||
| 78 | |||
| 79 | spin_unlock_irq(&pps->lock); | ||
| 80 | |||
| 81 | err = copy_to_user(uarg, ¶ms, sizeof(struct pps_kparams)); | ||
| 77 | if (err) | 82 | if (err) |
| 78 | return -EFAULT; | 83 | return -EFAULT; |
| 79 | 84 | ||
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 744ea1d0b59b..efe568deda12 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
| @@ -1283,7 +1283,8 @@ static int _regulator_disable(struct regulator_dev *rdev) | |||
| 1283 | return -EIO; | 1283 | return -EIO; |
| 1284 | 1284 | ||
| 1285 | /* are we the last user and permitted to disable ? */ | 1285 | /* are we the last user and permitted to disable ? */ |
| 1286 | if (rdev->use_count == 1 && !rdev->constraints->always_on) { | 1286 | if (rdev->use_count == 1 && |
| 1287 | (rdev->constraints && !rdev->constraints->always_on)) { | ||
| 1287 | 1288 | ||
| 1288 | /* we are last user */ | 1289 | /* we are last user */ |
| 1289 | if (_regulator_can_change_status(rdev) && | 1290 | if (_regulator_can_change_status(rdev) && |
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index f8b295700d7d..f9f516a3028a 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c | |||
| @@ -196,11 +196,10 @@ static int regulator_fixed_voltage_remove(struct platform_device *pdev) | |||
| 196 | struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev); | 196 | struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev); |
| 197 | 197 | ||
| 198 | regulator_unregister(drvdata->dev); | 198 | regulator_unregister(drvdata->dev); |
| 199 | kfree(drvdata->desc.name); | ||
| 200 | kfree(drvdata); | ||
| 201 | |||
| 202 | if (gpio_is_valid(drvdata->gpio)) | 199 | if (gpio_is_valid(drvdata->gpio)) |
| 203 | gpio_free(drvdata->gpio); | 200 | gpio_free(drvdata->gpio); |
| 201 | kfree(drvdata->desc.name); | ||
| 202 | kfree(drvdata); | ||
| 204 | 203 | ||
| 205 | return 0; | 204 | return 0; |
| 206 | } | 205 | } |
diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c index 1d8d9879d3a1..48857008758c 100644 --- a/drivers/regulator/wm831x-isink.c +++ b/drivers/regulator/wm831x-isink.c | |||
| @@ -167,6 +167,8 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev) | |||
| 167 | return -ENOMEM; | 167 | return -ENOMEM; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | isink->wm831x = wm831x; | ||
| 171 | |||
| 170 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 172 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
| 171 | if (res == NULL) { | 173 | if (res == NULL) { |
| 172 | dev_err(&pdev->dev, "No I/O resource\n"); | 174 | dev_err(&pdev->dev, "No I/O resource\n"); |
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index bb61aede4801..902db56ce099 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c | |||
| @@ -175,18 +175,18 @@ static unsigned int wm831x_gp_ldo_get_mode(struct regulator_dev *rdev) | |||
| 175 | struct wm831x *wm831x = ldo->wm831x; | 175 | struct wm831x *wm831x = ldo->wm831x; |
| 176 | int ctrl_reg = ldo->base + WM831X_LDO_CONTROL; | 176 | int ctrl_reg = ldo->base + WM831X_LDO_CONTROL; |
| 177 | int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; | 177 | int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; |
| 178 | unsigned int ret; | 178 | int ret; |
| 179 | 179 | ||
| 180 | ret = wm831x_reg_read(wm831x, on_reg); | 180 | ret = wm831x_reg_read(wm831x, on_reg); |
| 181 | if (ret < 0) | 181 | if (ret < 0) |
| 182 | return 0; | 182 | return ret; |
| 183 | 183 | ||
| 184 | if (!(ret & WM831X_LDO1_ON_MODE)) | 184 | if (!(ret & WM831X_LDO1_ON_MODE)) |
| 185 | return REGULATOR_MODE_NORMAL; | 185 | return REGULATOR_MODE_NORMAL; |
| 186 | 186 | ||
| 187 | ret = wm831x_reg_read(wm831x, ctrl_reg); | 187 | ret = wm831x_reg_read(wm831x, ctrl_reg); |
| 188 | if (ret < 0) | 188 | if (ret < 0) |
| 189 | return 0; | 189 | return ret; |
| 190 | 190 | ||
| 191 | if (ret & WM831X_LDO1_LP_MODE) | 191 | if (ret & WM831X_LDO1_LP_MODE) |
| 192 | return REGULATOR_MODE_STANDBY; | 192 | return REGULATOR_MODE_STANDBY; |
diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c index 7fe1fa26c52c..03ea530981d1 100644 --- a/drivers/rtc/rtc-coh901331.c +++ b/drivers/rtc/rtc-coh901331.c | |||
| @@ -58,7 +58,16 @@ static irqreturn_t coh901331_interrupt(int irq, void *data) | |||
| 58 | clk_enable(rtap->clk); | 58 | clk_enable(rtap->clk); |
| 59 | /* Ack IRQ */ | 59 | /* Ack IRQ */ |
| 60 | writel(1, rtap->virtbase + COH901331_IRQ_EVENT); | 60 | writel(1, rtap->virtbase + COH901331_IRQ_EVENT); |
| 61 | /* | ||
| 62 | * Disable the interrupt. This is necessary because | ||
| 63 | * the RTC lives on a lower-clocked line and will | ||
| 64 | * not release the IRQ line until after a few (slower) | ||
| 65 | * clock cycles. The interrupt will be re-enabled when | ||
| 66 | * a new alarm is set anyway. | ||
| 67 | */ | ||
| 68 | writel(0, rtap->virtbase + COH901331_IRQ_MASK); | ||
| 61 | clk_disable(rtap->clk); | 69 | clk_disable(rtap->clk); |
| 70 | |||
| 62 | /* Set alarm flag */ | 71 | /* Set alarm flag */ |
| 63 | rtc_update_irq(rtap->rtc, 1, RTC_AF); | 72 | rtc_update_irq(rtap->rtc, 1, RTC_AF); |
| 64 | 73 | ||
| @@ -128,6 +137,8 @@ static int coh901331_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
| 128 | else | 137 | else |
| 129 | writel(0, rtap->virtbase + COH901331_IRQ_MASK); | 138 | writel(0, rtap->virtbase + COH901331_IRQ_MASK); |
| 130 | clk_disable(rtap->clk); | 139 | clk_disable(rtap->clk); |
| 140 | |||
| 141 | return 0; | ||
| 131 | } | 142 | } |
| 132 | 143 | ||
| 133 | static struct rtc_class_ops coh901331_ops = { | 144 | static struct rtc_class_ops coh901331_ops = { |
diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c index f4dd87e29075..4c5d5d0c4cfc 100644 --- a/drivers/rtc/rtc-pcf50633.c +++ b/drivers/rtc/rtc-pcf50633.c | |||
| @@ -70,7 +70,7 @@ static void pcf2rtc_time(struct rtc_time *rtc, struct pcf50633_time *pcf) | |||
| 70 | rtc->tm_hour = bcd2bin(pcf->time[PCF50633_TI_HOUR]); | 70 | rtc->tm_hour = bcd2bin(pcf->time[PCF50633_TI_HOUR]); |
| 71 | rtc->tm_wday = bcd2bin(pcf->time[PCF50633_TI_WKDAY]); | 71 | rtc->tm_wday = bcd2bin(pcf->time[PCF50633_TI_WKDAY]); |
| 72 | rtc->tm_mday = bcd2bin(pcf->time[PCF50633_TI_DAY]); | 72 | rtc->tm_mday = bcd2bin(pcf->time[PCF50633_TI_DAY]); |
| 73 | rtc->tm_mon = bcd2bin(pcf->time[PCF50633_TI_MONTH]); | 73 | rtc->tm_mon = bcd2bin(pcf->time[PCF50633_TI_MONTH]) - 1; |
| 74 | rtc->tm_year = bcd2bin(pcf->time[PCF50633_TI_YEAR]) + 100; | 74 | rtc->tm_year = bcd2bin(pcf->time[PCF50633_TI_YEAR]) + 100; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| @@ -81,7 +81,7 @@ static void rtc2pcf_time(struct pcf50633_time *pcf, struct rtc_time *rtc) | |||
| 81 | pcf->time[PCF50633_TI_HOUR] = bin2bcd(rtc->tm_hour); | 81 | pcf->time[PCF50633_TI_HOUR] = bin2bcd(rtc->tm_hour); |
| 82 | pcf->time[PCF50633_TI_WKDAY] = bin2bcd(rtc->tm_wday); | 82 | pcf->time[PCF50633_TI_WKDAY] = bin2bcd(rtc->tm_wday); |
| 83 | pcf->time[PCF50633_TI_DAY] = bin2bcd(rtc->tm_mday); | 83 | pcf->time[PCF50633_TI_DAY] = bin2bcd(rtc->tm_mday); |
| 84 | pcf->time[PCF50633_TI_MONTH] = bin2bcd(rtc->tm_mon); | 84 | pcf->time[PCF50633_TI_MONTH] = bin2bcd(rtc->tm_mon + 1); |
| 85 | pcf->time[PCF50633_TI_YEAR] = bin2bcd(rtc->tm_year % 100); | 85 | pcf->time[PCF50633_TI_YEAR] = bin2bcd(rtc->tm_year % 100); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| @@ -245,8 +245,9 @@ static int pcf50633_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
| 245 | ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA, | 245 | ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA, |
| 246 | PCF50633_TI_EXTENT, &pcf_tm.time[0]); | 246 | PCF50633_TI_EXTENT, &pcf_tm.time[0]); |
| 247 | 247 | ||
| 248 | if (!alarm_masked) | 248 | if (!alarm_masked || alrm->enabled) |
| 249 | pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM); | 249 | pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM); |
| 250 | rtc->alarm_enabled = alrm->enabled; | ||
| 250 | 251 | ||
| 251 | return ret; | 252 | return ret; |
| 252 | } | 253 | } |
| @@ -291,8 +292,9 @@ static int __devinit pcf50633_rtc_probe(struct platform_device *pdev) | |||
| 291 | &pcf50633_rtc_ops, THIS_MODULE); | 292 | &pcf50633_rtc_ops, THIS_MODULE); |
| 292 | 293 | ||
| 293 | if (IS_ERR(rtc->rtc_dev)) { | 294 | if (IS_ERR(rtc->rtc_dev)) { |
| 295 | int ret = PTR_ERR(rtc->rtc_dev); | ||
| 294 | kfree(rtc); | 296 | kfree(rtc); |
| 295 | return PTR_ERR(rtc->rtc_dev); | 297 | return ret; |
| 296 | } | 298 | } |
| 297 | 299 | ||
| 298 | pcf50633_register_irq(rtc->pcf, PCF50633_IRQ_ALARM, | 300 | pcf50633_register_irq(rtc->pcf, PCF50633_IRQ_ALARM, |
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c index ad164056feb6..423cd5a30b10 100644 --- a/drivers/rtc/rtc-v3020.c +++ b/drivers/rtc/rtc-v3020.c | |||
| @@ -96,7 +96,7 @@ static void v3020_mmio_write_bit(struct v3020 *chip, unsigned char bit) | |||
| 96 | 96 | ||
| 97 | static unsigned char v3020_mmio_read_bit(struct v3020 *chip) | 97 | static unsigned char v3020_mmio_read_bit(struct v3020 *chip) |
| 98 | { | 98 | { |
| 99 | return readl(chip->ioaddress) & (1 << chip->leftshift); | 99 | return !!(readl(chip->ioaddress) & (1 << chip->leftshift)); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | static struct v3020_chip_ops v3020_mmio_ops = { | 102 | static struct v3020_chip_ops v3020_mmio_ops = { |
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index 2c839d0d21bd..fadddac1e5a4 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c | |||
| @@ -209,19 +209,18 @@ static int vr41xx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | |||
| 209 | 209 | ||
| 210 | static int vr41xx_rtc_irq_set_freq(struct device *dev, int freq) | 210 | static int vr41xx_rtc_irq_set_freq(struct device *dev, int freq) |
| 211 | { | 211 | { |
| 212 | unsigned long count; | 212 | u64 count; |
| 213 | 213 | ||
| 214 | if (!is_power_of_2(freq)) | 214 | if (!is_power_of_2(freq)) |
| 215 | return -EINVAL; | 215 | return -EINVAL; |
| 216 | count = RTC_FREQUENCY; | 216 | count = RTC_FREQUENCY; |
| 217 | do_div(count, freq); | 217 | do_div(count, freq); |
| 218 | 218 | ||
| 219 | periodic_count = count; | ||
| 220 | |||
| 221 | spin_lock_irq(&rtc_lock); | 219 | spin_lock_irq(&rtc_lock); |
| 222 | 220 | ||
| 223 | rtc1_write(RTCL1LREG, count); | 221 | periodic_count = count; |
| 224 | rtc1_write(RTCL1HREG, count >> 16); | 222 | rtc1_write(RTCL1LREG, periodic_count); |
| 223 | rtc1_write(RTCL1HREG, periodic_count >> 16); | ||
| 225 | 224 | ||
| 226 | spin_unlock_irq(&rtc_lock); | 225 | spin_unlock_irq(&rtc_lock); |
| 227 | 226 | ||
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c index 310c10795e9a..6583c1a8b070 100644 --- a/drivers/rtc/rtc-x1205.c +++ b/drivers/rtc/rtc-x1205.c | |||
| @@ -195,7 +195,7 @@ static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm, | |||
| 195 | /* year, since the rtc epoch*/ | 195 | /* year, since the rtc epoch*/ |
| 196 | buf[CCR_YEAR] = bin2bcd(tm->tm_year % 100); | 196 | buf[CCR_YEAR] = bin2bcd(tm->tm_year % 100); |
| 197 | buf[CCR_WDAY] = tm->tm_wday & 0x07; | 197 | buf[CCR_WDAY] = tm->tm_wday & 0x07; |
| 198 | buf[CCR_Y2K] = bin2bcd(tm->tm_year / 100); | 198 | buf[CCR_Y2K] = bin2bcd((tm->tm_year + 1900) / 100); |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | /* If writing alarm registers, set compare bits on registers 0-4 */ | 201 | /* If writing alarm registers, set compare bits on registers 0-4 */ |
| @@ -280,9 +280,9 @@ static int x1205_fix_osc(struct i2c_client *client) | |||
| 280 | int err; | 280 | int err; |
| 281 | struct rtc_time tm; | 281 | struct rtc_time tm; |
| 282 | 282 | ||
| 283 | tm.tm_hour = tm.tm_min = tm.tm_sec = 0; | 283 | memset(&tm, 0, sizeof(tm)); |
| 284 | 284 | ||
| 285 | err = x1205_set_datetime(client, &tm, 0, X1205_CCR_BASE, 0); | 285 | err = x1205_set_datetime(client, &tm, 1, X1205_CCR_BASE, 0); |
| 286 | if (err < 0) | 286 | if (err < 0) |
| 287 | dev_err(&client->dev, "unable to restart the oscillator\n"); | 287 | dev_err(&client->dev, "unable to restart the oscillator\n"); |
| 288 | 288 | ||
diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c index 89ece1c235aa..66e21dd23154 100644 --- a/drivers/s390/char/monreader.c +++ b/drivers/s390/char/monreader.c | |||
| @@ -357,6 +357,7 @@ static int mon_close(struct inode *inode, struct file *filp) | |||
| 357 | atomic_set(&monpriv->msglim_count, 0); | 357 | atomic_set(&monpriv->msglim_count, 0); |
| 358 | monpriv->write_index = 0; | 358 | monpriv->write_index = 0; |
| 359 | monpriv->read_index = 0; | 359 | monpriv->read_index = 0; |
| 360 | dev_set_drvdata(monreader_device, NULL); | ||
| 360 | 361 | ||
| 361 | for (i = 0; i < MON_MSGLIM; i++) | 362 | for (i = 0; i < MON_MSGLIM; i++) |
| 362 | kfree(monpriv->msg_array[i]); | 363 | kfree(monpriv->msg_array[i]); |
diff --git a/drivers/s390/char/sclp_quiesce.c b/drivers/s390/char/sclp_quiesce.c index 84c191c1cd62..05909a7df8b3 100644 --- a/drivers/s390/char/sclp_quiesce.c +++ b/drivers/s390/char/sclp_quiesce.c | |||
| @@ -20,9 +20,12 @@ | |||
| 20 | 20 | ||
| 21 | #include "sclp.h" | 21 | #include "sclp.h" |
| 22 | 22 | ||
| 23 | static void (*old_machine_restart)(char *); | ||
| 24 | static void (*old_machine_halt)(void); | ||
| 25 | static void (*old_machine_power_off)(void); | ||
| 26 | |||
| 23 | /* Shutdown handler. Signal completion of shutdown by loading special PSW. */ | 27 | /* Shutdown handler. Signal completion of shutdown by loading special PSW. */ |
| 24 | static void | 28 | static void do_machine_quiesce(void) |
| 25 | do_machine_quiesce(void) | ||
| 26 | { | 29 | { |
| 27 | psw_t quiesce_psw; | 30 | psw_t quiesce_psw; |
| 28 | 31 | ||
| @@ -33,23 +36,48 @@ do_machine_quiesce(void) | |||
| 33 | } | 36 | } |
| 34 | 37 | ||
| 35 | /* Handler for quiesce event. Start shutdown procedure. */ | 38 | /* Handler for quiesce event. Start shutdown procedure. */ |
| 36 | static void | 39 | static void sclp_quiesce_handler(struct evbuf_header *evbuf) |
| 37 | sclp_quiesce_handler(struct evbuf_header *evbuf) | ||
| 38 | { | 40 | { |
| 39 | _machine_restart = (void *) do_machine_quiesce; | 41 | if (_machine_restart != (void *) do_machine_quiesce) { |
| 40 | _machine_halt = do_machine_quiesce; | 42 | old_machine_restart = _machine_restart; |
| 41 | _machine_power_off = do_machine_quiesce; | 43 | old_machine_halt = _machine_halt; |
| 44 | old_machine_power_off = _machine_power_off; | ||
| 45 | _machine_restart = (void *) do_machine_quiesce; | ||
| 46 | _machine_halt = do_machine_quiesce; | ||
| 47 | _machine_power_off = do_machine_quiesce; | ||
| 48 | } | ||
| 42 | ctrl_alt_del(); | 49 | ctrl_alt_del(); |
| 43 | } | 50 | } |
| 44 | 51 | ||
| 52 | /* Undo machine restart/halt/power_off modification on resume */ | ||
| 53 | static void sclp_quiesce_pm_event(struct sclp_register *reg, | ||
| 54 | enum sclp_pm_event sclp_pm_event) | ||
| 55 | { | ||
| 56 | switch (sclp_pm_event) { | ||
| 57 | case SCLP_PM_EVENT_RESTORE: | ||
| 58 | if (old_machine_restart) { | ||
| 59 | _machine_restart = old_machine_restart; | ||
| 60 | _machine_halt = old_machine_halt; | ||
| 61 | _machine_power_off = old_machine_power_off; | ||
| 62 | old_machine_restart = NULL; | ||
| 63 | old_machine_halt = NULL; | ||
| 64 | old_machine_power_off = NULL; | ||
| 65 | } | ||
| 66 | break; | ||
| 67 | case SCLP_PM_EVENT_FREEZE: | ||
| 68 | case SCLP_PM_EVENT_THAW: | ||
| 69 | break; | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 45 | static struct sclp_register sclp_quiesce_event = { | 73 | static struct sclp_register sclp_quiesce_event = { |
| 46 | .receive_mask = EVTYP_SIGQUIESCE_MASK, | 74 | .receive_mask = EVTYP_SIGQUIESCE_MASK, |
| 47 | .receiver_fn = sclp_quiesce_handler | 75 | .receiver_fn = sclp_quiesce_handler, |
| 76 | .pm_event_fn = sclp_quiesce_pm_event | ||
| 48 | }; | 77 | }; |
| 49 | 78 | ||
| 50 | /* Initialize quiesce driver. */ | 79 | /* Initialize quiesce driver. */ |
| 51 | static int __init | 80 | static int __init sclp_quiesce_init(void) |
| 52 | sclp_quiesce_init(void) | ||
| 53 | { | 81 | { |
| 54 | return sclp_register(&sclp_quiesce_event); | 82 | return sclp_register(&sclp_quiesce_event); |
| 55 | } | 83 | } |
diff --git a/drivers/scsi/bfa/bfad_fwimg.c b/drivers/scsi/bfa/bfad_fwimg.c index b2f6949bc8d3..bd34b0db2d6b 100644 --- a/drivers/scsi/bfa/bfad_fwimg.c +++ b/drivers/scsi/bfa/bfad_fwimg.c | |||
| @@ -41,6 +41,8 @@ u32 *bfi_image_cb; | |||
| 41 | 41 | ||
| 42 | #define BFAD_FW_FILE_CT "ctfw.bin" | 42 | #define BFAD_FW_FILE_CT "ctfw.bin" |
| 43 | #define BFAD_FW_FILE_CB "cbfw.bin" | 43 | #define BFAD_FW_FILE_CB "cbfw.bin" |
| 44 | MODULE_FIRMWARE(BFAD_FW_FILE_CT); | ||
| 45 | MODULE_FIRMWARE(BFAD_FW_FILE_CB); | ||
| 44 | 46 | ||
| 45 | u32 * | 47 | u32 * |
| 46 | bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image, | 48 | bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image, |
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 158c99243c08..55d012a9a668 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c | |||
| @@ -948,7 +948,7 @@ bfad_os_fc_host_init(struct bfad_im_port_s *im_port) | |||
| 948 | if (bfad_supported_fc4s & (BFA_PORT_ROLE_FCP_IM | BFA_PORT_ROLE_FCP_TM)) | 948 | if (bfad_supported_fc4s & (BFA_PORT_ROLE_FCP_IM | BFA_PORT_ROLE_FCP_TM)) |
| 949 | /* For FCP type 0x08 */ | 949 | /* For FCP type 0x08 */ |
| 950 | fc_host_supported_fc4s(host)[2] = 1; | 950 | fc_host_supported_fc4s(host)[2] = 1; |
| 951 | if (bfad_supported_fc4s | BFA_PORT_ROLE_FCP_IPFC) | 951 | if (bfad_supported_fc4s & BFA_PORT_ROLE_FCP_IPFC) |
| 952 | /* For LLC/SNAP type 0x05 */ | 952 | /* For LLC/SNAP type 0x05 */ |
| 953 | fc_host_supported_fc4s(host)[3] = 0x20; | 953 | fc_host_supported_fc4s(host)[3] = 0x20; |
| 954 | /* For fibre channel services type 0x20 */ | 954 | /* For fibre channel services type 0x20 */ |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 185e6bc4dd40..9e8fce0f0c1b 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
| @@ -2900,7 +2900,7 @@ static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr) | |||
| 2900 | eindex = handle; | 2900 | eindex = handle; |
| 2901 | estr->event_source = 0; | 2901 | estr->event_source = 0; |
| 2902 | 2902 | ||
| 2903 | if (eindex >= MAX_EVENTS) { | 2903 | if (eindex < 0 || eindex >= MAX_EVENTS) { |
| 2904 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 2904 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
| 2905 | return eindex; | 2905 | return eindex; |
| 2906 | } | 2906 | } |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 5fd2da494d08..c968cc31cd86 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
| @@ -164,8 +164,8 @@ void scsi_remove_host(struct Scsi_Host *shost) | |||
| 164 | return; | 164 | return; |
| 165 | } | 165 | } |
| 166 | spin_unlock_irqrestore(shost->host_lock, flags); | 166 | spin_unlock_irqrestore(shost->host_lock, flags); |
| 167 | mutex_unlock(&shost->scan_mutex); | ||
| 168 | scsi_forget_host(shost); | 167 | scsi_forget_host(shost); |
| 168 | mutex_unlock(&shost->scan_mutex); | ||
| 169 | scsi_proc_host_rm(shost); | 169 | scsi_proc_host_rm(shost); |
| 170 | 170 | ||
| 171 | spin_lock_irqsave(shost->host_lock, flags); | 171 | spin_lock_irqsave(shost->host_lock, flags); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 5f045505a1f4..76d294fc7846 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
| @@ -4189,6 +4189,25 @@ static irqreturn_t ipr_handle_other_interrupt(struct ipr_ioa_cfg *ioa_cfg, | |||
| 4189 | } | 4189 | } |
| 4190 | 4190 | ||
| 4191 | /** | 4191 | /** |
| 4192 | * ipr_isr_eh - Interrupt service routine error handler | ||
| 4193 | * @ioa_cfg: ioa config struct | ||
| 4194 | * @msg: message to log | ||
| 4195 | * | ||
| 4196 | * Return value: | ||
| 4197 | * none | ||
| 4198 | **/ | ||
| 4199 | static void ipr_isr_eh(struct ipr_ioa_cfg *ioa_cfg, char *msg) | ||
| 4200 | { | ||
| 4201 | ioa_cfg->errors_logged++; | ||
| 4202 | dev_err(&ioa_cfg->pdev->dev, "%s\n", msg); | ||
| 4203 | |||
| 4204 | if (WAIT_FOR_DUMP == ioa_cfg->sdt_state) | ||
| 4205 | ioa_cfg->sdt_state = GET_DUMP; | ||
| 4206 | |||
| 4207 | ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE); | ||
| 4208 | } | ||
| 4209 | |||
| 4210 | /** | ||
| 4192 | * ipr_isr - Interrupt service routine | 4211 | * ipr_isr - Interrupt service routine |
| 4193 | * @irq: irq number | 4212 | * @irq: irq number |
| 4194 | * @devp: pointer to ioa config struct | 4213 | * @devp: pointer to ioa config struct |
| @@ -4203,6 +4222,7 @@ static irqreturn_t ipr_isr(int irq, void *devp) | |||
| 4203 | volatile u32 int_reg, int_mask_reg; | 4222 | volatile u32 int_reg, int_mask_reg; |
| 4204 | u32 ioasc; | 4223 | u32 ioasc; |
| 4205 | u16 cmd_index; | 4224 | u16 cmd_index; |
| 4225 | int num_hrrq = 0; | ||
| 4206 | struct ipr_cmnd *ipr_cmd; | 4226 | struct ipr_cmnd *ipr_cmd; |
| 4207 | irqreturn_t rc = IRQ_NONE; | 4227 | irqreturn_t rc = IRQ_NONE; |
| 4208 | 4228 | ||
| @@ -4233,13 +4253,7 @@ static irqreturn_t ipr_isr(int irq, void *devp) | |||
| 4233 | IPR_HRRQ_REQ_RESP_HANDLE_MASK) >> IPR_HRRQ_REQ_RESP_HANDLE_SHIFT; | 4253 | IPR_HRRQ_REQ_RESP_HANDLE_MASK) >> IPR_HRRQ_REQ_RESP_HANDLE_SHIFT; |
| 4234 | 4254 | ||
| 4235 | if (unlikely(cmd_index >= IPR_NUM_CMD_BLKS)) { | 4255 | if (unlikely(cmd_index >= IPR_NUM_CMD_BLKS)) { |
| 4236 | ioa_cfg->errors_logged++; | 4256 | ipr_isr_eh(ioa_cfg, "Invalid response handle from IOA"); |
| 4237 | dev_err(&ioa_cfg->pdev->dev, "Invalid response handle from IOA\n"); | ||
| 4238 | |||
| 4239 | if (WAIT_FOR_DUMP == ioa_cfg->sdt_state) | ||
| 4240 | ioa_cfg->sdt_state = GET_DUMP; | ||
| 4241 | |||
| 4242 | ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE); | ||
| 4243 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | 4257 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
| 4244 | return IRQ_HANDLED; | 4258 | return IRQ_HANDLED; |
| 4245 | } | 4259 | } |
| @@ -4266,8 +4280,18 @@ static irqreturn_t ipr_isr(int irq, void *devp) | |||
| 4266 | 4280 | ||
| 4267 | if (ipr_cmd != NULL) { | 4281 | if (ipr_cmd != NULL) { |
| 4268 | /* Clear the PCI interrupt */ | 4282 | /* Clear the PCI interrupt */ |
| 4269 | writel(IPR_PCII_HRRQ_UPDATED, ioa_cfg->regs.clr_interrupt_reg); | 4283 | do { |
| 4270 | int_reg = readl(ioa_cfg->regs.sense_interrupt_reg) & ~int_mask_reg; | 4284 | writel(IPR_PCII_HRRQ_UPDATED, ioa_cfg->regs.clr_interrupt_reg); |
| 4285 | int_reg = readl(ioa_cfg->regs.sense_interrupt_reg) & ~int_mask_reg; | ||
| 4286 | } while (int_reg & IPR_PCII_HRRQ_UPDATED && | ||
| 4287 | num_hrrq++ < IPR_MAX_HRRQ_RETRIES); | ||
| 4288 | |||
| 4289 | if (int_reg & IPR_PCII_HRRQ_UPDATED) { | ||
| 4290 | ipr_isr_eh(ioa_cfg, "Error clearing HRRQ"); | ||
| 4291 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | ||
| 4292 | return IRQ_HANDLED; | ||
| 4293 | } | ||
| 4294 | |||
| 4271 | } else | 4295 | } else |
| 4272 | break; | 4296 | break; |
| 4273 | } | 4297 | } |
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h index 163245a1c3e5..19bbcf39f0c9 100644 --- a/drivers/scsi/ipr.h +++ b/drivers/scsi/ipr.h | |||
| @@ -144,6 +144,7 @@ | |||
| 144 | #define IPR_IOA_MAX_SECTORS 32767 | 144 | #define IPR_IOA_MAX_SECTORS 32767 |
| 145 | #define IPR_VSET_MAX_SECTORS 512 | 145 | #define IPR_VSET_MAX_SECTORS 512 |
| 146 | #define IPR_MAX_CDB_LEN 16 | 146 | #define IPR_MAX_CDB_LEN 16 |
| 147 | #define IPR_MAX_HRRQ_RETRIES 3 | ||
| 147 | 148 | ||
| 148 | #define IPR_DEFAULT_BUS_WIDTH 16 | 149 | #define IPR_DEFAULT_BUS_WIDTH 16 |
| 149 | #define IPR_80MBs_SCSI_RATE ((80 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8)) | 150 | #define IPR_80MBs_SCSI_RATE ((80 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8)) |
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index b3381959acce..33cf988c8c8a 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
| @@ -960,7 +960,6 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id) | |||
| 960 | 960 | ||
| 961 | } | 961 | } |
| 962 | } | 962 | } |
| 963 | res = 0; | ||
| 964 | } | 963 | } |
| 965 | 964 | ||
| 966 | return res; | 965 | return res; |
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 67cde0138061..528733b4a392 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c | |||
| @@ -54,15 +54,6 @@ | |||
| 54 | #include <pcmcia/cistpl.h> | 54 | #include <pcmcia/cistpl.h> |
| 55 | #include <pcmcia/ds.h> | 55 | #include <pcmcia/ds.h> |
| 56 | 56 | ||
| 57 | #ifdef PCMCIA_DEBUG | ||
| 58 | static int pc_debug = PCMCIA_DEBUG; | ||
| 59 | module_param(pc_debug, int, 0644); | ||
| 60 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 61 | static char *version = | ||
| 62 | "aha152x_cs.c 1.54 2000/06/12 21:27:25 (David Hinds)"; | ||
| 63 | #else | ||
| 64 | #define DEBUG(n, args...) | ||
| 65 | #endif | ||
| 66 | 57 | ||
| 67 | /*====================================================================*/ | 58 | /*====================================================================*/ |
| 68 | 59 | ||
| @@ -103,7 +94,7 @@ static int aha152x_probe(struct pcmcia_device *link) | |||
| 103 | { | 94 | { |
| 104 | scsi_info_t *info; | 95 | scsi_info_t *info; |
| 105 | 96 | ||
| 106 | DEBUG(0, "aha152x_attach()\n"); | 97 | dev_dbg(&link->dev, "aha152x_attach()\n"); |
| 107 | 98 | ||
| 108 | /* Create new SCSI device */ | 99 | /* Create new SCSI device */ |
| 109 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 100 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
| @@ -115,7 +106,6 @@ static int aha152x_probe(struct pcmcia_device *link) | |||
| 115 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 106 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
| 116 | link->io.IOAddrLines = 10; | 107 | link->io.IOAddrLines = 10; |
| 117 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 108 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 118 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 119 | link->conf.Attributes = CONF_ENABLE_IRQ; | 109 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 120 | link->conf.IntType = INT_MEMORY_AND_IO; | 110 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 121 | link->conf.Present = PRESENT_OPTION; | 111 | link->conf.Present = PRESENT_OPTION; |
| @@ -127,7 +117,7 @@ static int aha152x_probe(struct pcmcia_device *link) | |||
| 127 | 117 | ||
| 128 | static void aha152x_detach(struct pcmcia_device *link) | 118 | static void aha152x_detach(struct pcmcia_device *link) |
| 129 | { | 119 | { |
| 130 | DEBUG(0, "aha152x_detach(0x%p)\n", link); | 120 | dev_dbg(&link->dev, "aha152x_detach\n"); |
| 131 | 121 | ||
| 132 | aha152x_release_cs(link); | 122 | aha152x_release_cs(link); |
| 133 | 123 | ||
| @@ -137,9 +127,6 @@ static void aha152x_detach(struct pcmcia_device *link) | |||
| 137 | 127 | ||
| 138 | /*====================================================================*/ | 128 | /*====================================================================*/ |
| 139 | 129 | ||
| 140 | #define CS_CHECK(fn, ret) \ | ||
| 141 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 142 | |||
| 143 | static int aha152x_config_check(struct pcmcia_device *p_dev, | 130 | static int aha152x_config_check(struct pcmcia_device *p_dev, |
| 144 | cistpl_cftable_entry_t *cfg, | 131 | cistpl_cftable_entry_t *cfg, |
| 145 | cistpl_cftable_entry_t *dflt, | 132 | cistpl_cftable_entry_t *dflt, |
| @@ -164,19 +151,22 @@ static int aha152x_config_cs(struct pcmcia_device *link) | |||
| 164 | { | 151 | { |
| 165 | scsi_info_t *info = link->priv; | 152 | scsi_info_t *info = link->priv; |
| 166 | struct aha152x_setup s; | 153 | struct aha152x_setup s; |
| 167 | int last_ret, last_fn; | 154 | int ret; |
| 168 | struct Scsi_Host *host; | 155 | struct Scsi_Host *host; |
| 169 | 156 | ||
| 170 | DEBUG(0, "aha152x_config(0x%p)\n", link); | 157 | dev_dbg(&link->dev, "aha152x_config\n"); |
| 171 | 158 | ||
| 172 | last_ret = pcmcia_loop_config(link, aha152x_config_check, NULL); | 159 | ret = pcmcia_loop_config(link, aha152x_config_check, NULL); |
| 173 | if (last_ret) { | 160 | if (ret) |
| 174 | cs_error(link, RequestIO, last_ret); | 161 | goto failed; |
| 175 | goto failed; | ||
| 176 | } | ||
| 177 | 162 | ||
| 178 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 163 | ret = pcmcia_request_irq(link, &link->irq); |
| 179 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 164 | if (ret) |
| 165 | goto failed; | ||
| 166 | |||
| 167 | ret = pcmcia_request_configuration(link, &link->conf); | ||
| 168 | if (ret) | ||
| 169 | goto failed; | ||
| 180 | 170 | ||
| 181 | /* Set configuration options for the aha152x driver */ | 171 | /* Set configuration options for the aha152x driver */ |
| 182 | memset(&s, 0, sizeof(s)); | 172 | memset(&s, 0, sizeof(s)); |
| @@ -194,7 +184,7 @@ static int aha152x_config_cs(struct pcmcia_device *link) | |||
| 194 | host = aha152x_probe_one(&s); | 184 | host = aha152x_probe_one(&s); |
| 195 | if (host == NULL) { | 185 | if (host == NULL) { |
| 196 | printk(KERN_INFO "aha152x_cs: no SCSI devices found\n"); | 186 | printk(KERN_INFO "aha152x_cs: no SCSI devices found\n"); |
| 197 | goto cs_failed; | 187 | goto failed; |
| 198 | } | 188 | } |
| 199 | 189 | ||
| 200 | sprintf(info->node.dev_name, "scsi%d", host->host_no); | 190 | sprintf(info->node.dev_name, "scsi%d", host->host_no); |
| @@ -203,8 +193,6 @@ static int aha152x_config_cs(struct pcmcia_device *link) | |||
| 203 | 193 | ||
| 204 | return 0; | 194 | return 0; |
| 205 | 195 | ||
| 206 | cs_failed: | ||
| 207 | cs_error(link, last_fn, last_ret); | ||
| 208 | failed: | 196 | failed: |
| 209 | aha152x_release_cs(link); | 197 | aha152x_release_cs(link); |
| 210 | return -ENODEV; | 198 | return -ENODEV; |
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 06254f46a0dd..914040684079 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c | |||
| @@ -59,16 +59,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); | |||
| 59 | MODULE_DESCRIPTION("Future Domain PCMCIA SCSI driver"); | 59 | MODULE_DESCRIPTION("Future Domain PCMCIA SCSI driver"); |
| 60 | MODULE_LICENSE("Dual MPL/GPL"); | 60 | MODULE_LICENSE("Dual MPL/GPL"); |
| 61 | 61 | ||
| 62 | #ifdef PCMCIA_DEBUG | ||
| 63 | static int pc_debug = PCMCIA_DEBUG; | ||
| 64 | module_param(pc_debug, int, 0); | ||
| 65 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 66 | static char *version = | ||
| 67 | "fdomain_cs.c 1.47 2001/10/13 00:08:52 (David Hinds)"; | ||
| 68 | #else | ||
| 69 | #define DEBUG(n, args...) | ||
| 70 | #endif | ||
| 71 | |||
| 72 | /*====================================================================*/ | 62 | /*====================================================================*/ |
| 73 | 63 | ||
| 74 | typedef struct scsi_info_t { | 64 | typedef struct scsi_info_t { |
| @@ -86,7 +76,7 @@ static int fdomain_probe(struct pcmcia_device *link) | |||
| 86 | { | 76 | { |
| 87 | scsi_info_t *info; | 77 | scsi_info_t *info; |
| 88 | 78 | ||
| 89 | DEBUG(0, "fdomain_attach()\n"); | 79 | dev_dbg(&link->dev, "fdomain_attach()\n"); |
| 90 | 80 | ||
| 91 | /* Create new SCSI device */ | 81 | /* Create new SCSI device */ |
| 92 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 82 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
| @@ -99,7 +89,6 @@ static int fdomain_probe(struct pcmcia_device *link) | |||
| 99 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 89 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
| 100 | link->io.IOAddrLines = 10; | 90 | link->io.IOAddrLines = 10; |
| 101 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 91 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
| 102 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 103 | link->conf.Attributes = CONF_ENABLE_IRQ; | 92 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 104 | link->conf.IntType = INT_MEMORY_AND_IO; | 93 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 105 | link->conf.Present = PRESENT_OPTION; | 94 | link->conf.Present = PRESENT_OPTION; |
| @@ -111,7 +100,7 @@ static int fdomain_probe(struct pcmcia_device *link) | |||
| 111 | 100 | ||
| 112 | static void fdomain_detach(struct pcmcia_device *link) | 101 | static void fdomain_detach(struct pcmcia_device *link) |
| 113 | { | 102 | { |
| 114 | DEBUG(0, "fdomain_detach(0x%p)\n", link); | 103 | dev_dbg(&link->dev, "fdomain_detach\n"); |
| 115 | 104 | ||
| 116 | fdomain_release(link); | 105 | fdomain_release(link); |
| 117 | 106 | ||
| @@ -120,9 +109,6 @@ static void fdomain_detach(struct pcmcia_device *link) | |||
| 120 | 109 | ||
| 121 | /*====================================================================*/ | 110 | /*====================================================================*/ |
| 122 | 111 | ||
| 123 | #define CS_CHECK(fn, ret) \ | ||
| 124 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 125 | |||
| 126 | static int fdomain_config_check(struct pcmcia_device *p_dev, | 112 | static int fdomain_config_check(struct pcmcia_device *p_dev, |
| 127 | cistpl_cftable_entry_t *cfg, | 113 | cistpl_cftable_entry_t *cfg, |
| 128 | cistpl_cftable_entry_t *dflt, | 114 | cistpl_cftable_entry_t *dflt, |
| @@ -137,20 +123,22 @@ static int fdomain_config_check(struct pcmcia_device *p_dev, | |||
| 137 | static int fdomain_config(struct pcmcia_device *link) | 123 | static int fdomain_config(struct pcmcia_device *link) |
| 138 | { | 124 | { |
| 139 | scsi_info_t *info = link->priv; | 125 | scsi_info_t *info = link->priv; |
| 140 | int last_ret, last_fn; | 126 | int ret; |
| 141 | char str[22]; | 127 | char str[22]; |
| 142 | struct Scsi_Host *host; | 128 | struct Scsi_Host *host; |
| 143 | 129 | ||
| 144 | DEBUG(0, "fdomain_config(0x%p)\n", link); | 130 | dev_dbg(&link->dev, "fdomain_config\n"); |
| 145 | 131 | ||
| 146 | last_ret = pcmcia_loop_config(link, fdomain_config_check, NULL); | 132 | ret = pcmcia_loop_config(link, fdomain_config_check, NULL); |
| 147 | if (last_ret) { | 133 | if (ret) |
| 148 | cs_error(link, RequestIO, last_ret); | ||
| 149 | goto failed; | 134 | goto failed; |
| 150 | } | ||
| 151 | 135 | ||
| 152 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 136 | ret = pcmcia_request_irq(link, &link->irq); |
| 153 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 137 | if (ret) |
| 138 | goto failed; | ||
| 139 | ret = pcmcia_request_configuration(link, &link->conf); | ||
| 140 | if (ret) | ||
| 141 | goto failed; | ||
| 154 | 142 | ||
| 155 | /* A bad hack... */ | 143 | /* A bad hack... */ |
| 156 | release_region(link->io.BasePort1, link->io.NumPorts1); | 144 | release_region(link->io.BasePort1, link->io.NumPorts1); |
| @@ -162,11 +150,11 @@ static int fdomain_config(struct pcmcia_device *link) | |||
| 162 | host = __fdomain_16x0_detect(&fdomain_driver_template); | 150 | host = __fdomain_16x0_detect(&fdomain_driver_template); |
| 163 | if (!host) { | 151 | if (!host) { |
| 164 | printk(KERN_INFO "fdomain_cs: no SCSI devices found\n"); | 152 | printk(KERN_INFO "fdomain_cs: no SCSI devices found\n"); |
| 165 | goto cs_failed; | 153 | goto failed; |
| 166 | } | 154 | } |
| 167 | 155 | ||
| 168 | if (scsi_add_host(host, NULL)) | 156 | if (scsi_add_host(host, NULL)) |
| 169 | goto cs_failed; | 157 | goto failed; |
| 170 | scsi_scan_host(host); | 158 | scsi_scan_host(host); |
| 171 | 159 | ||
| 172 | sprintf(info->node.dev_name, "scsi%d", host->host_no); | 160 | sprintf(info->node.dev_name, "scsi%d", host->host_no); |
| @@ -175,8 +163,6 @@ static int fdomain_config(struct pcmcia_device *link) | |||
| 175 | 163 | ||
| 176 | return 0; | 164 | return 0; |
| 177 | 165 | ||
| 178 | cs_failed: | ||
| 179 | cs_error(link, last_fn, last_ret); | ||
| 180 | failed: | 166 | failed: |
| 181 | fdomain_release(link); | 167 | fdomain_release(link); |
| 182 | return -ENODEV; | 168 | return -ENODEV; |
| @@ -188,7 +174,7 @@ static void fdomain_release(struct pcmcia_device *link) | |||
| 188 | { | 174 | { |
| 189 | scsi_info_t *info = link->priv; | 175 | scsi_info_t *info = link->priv; |
| 190 | 176 | ||
| 191 | DEBUG(0, "fdomain_release(0x%p)\n", link); | 177 | dev_dbg(&link->dev, "fdomain_release\n"); |
| 192 | 178 | ||
| 193 | scsi_remove_host(info->host); | 179 | scsi_remove_host(info->host); |
| 194 | pcmcia_disable_device(link); | 180 | pcmcia_disable_device(link); |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index e32c344d7ad8..c2341af587a3 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
| @@ -1564,12 +1564,10 @@ static int nsp_cs_probe(struct pcmcia_device *link) | |||
| 1564 | link->io.IOAddrLines = 10; /* not used */ | 1564 | link->io.IOAddrLines = 10; /* not used */ |
| 1565 | 1565 | ||
| 1566 | /* Interrupt setup */ | 1566 | /* Interrupt setup */ |
| 1567 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 1567 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
| 1568 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 1569 | 1568 | ||
| 1570 | /* Interrupt handler */ | 1569 | /* Interrupt handler */ |
| 1571 | link->irq.Handler = &nspintr; | 1570 | link->irq.Handler = &nspintr; |
| 1572 | link->irq.Instance = info; | ||
| 1573 | link->irq.Attributes |= IRQF_SHARED; | 1571 | link->irq.Attributes |= IRQF_SHARED; |
| 1574 | 1572 | ||
| 1575 | /* General socket configuration */ | 1573 | /* General socket configuration */ |
| @@ -1684,10 +1682,10 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, | |||
| 1684 | if (cfg_mem->req.Size < 0x1000) | 1682 | if (cfg_mem->req.Size < 0x1000) |
| 1685 | cfg_mem->req.Size = 0x1000; | 1683 | cfg_mem->req.Size = 0x1000; |
| 1686 | cfg_mem->req.AccessSpeed = 0; | 1684 | cfg_mem->req.AccessSpeed = 0; |
| 1687 | if (pcmcia_request_window(&p_dev, &cfg_mem->req, &p_dev->win) != 0) | 1685 | if (pcmcia_request_window(p_dev, &cfg_mem->req, &p_dev->win) != 0) |
| 1688 | goto next_entry; | 1686 | goto next_entry; |
| 1689 | map.Page = 0; map.CardOffset = mem->win[0].card_addr; | 1687 | map.Page = 0; map.CardOffset = mem->win[0].card_addr; |
| 1690 | if (pcmcia_map_mem_page(p_dev->win, &map) != 0) | 1688 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) |
| 1691 | goto next_entry; | 1689 | goto next_entry; |
| 1692 | 1690 | ||
| 1693 | cfg_mem->data->MmioAddress = (unsigned long) ioremap_nocache(cfg_mem->req.Base, cfg_mem->req.Size); | 1691 | cfg_mem->data->MmioAddress = (unsigned long) ioremap_nocache(cfg_mem->req.Base, cfg_mem->req.Size); |
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index 20c3e5e6d88a..f85f094870b4 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c | |||
| @@ -62,15 +62,6 @@ | |||
| 62 | 62 | ||
| 63 | static char qlogic_name[] = "qlogic_cs"; | 63 | static char qlogic_name[] = "qlogic_cs"; |
| 64 | 64 | ||
| 65 | #ifdef PCMCIA_DEBUG | ||
| 66 | static int pc_debug = PCMCIA_DEBUG; | ||
| 67 | module_param(pc_debug, int, 0644); | ||
| 68 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 69 | static char *version = "qlogic_cs.c 1.79-ac 2002/10/26 (David Hinds)"; | ||
| 70 | #else | ||
| 71 | #define DEBUG(n, args...) | ||
| 72 | #endif | ||
| 73 | |||
| 74 | static struct scsi_host_template qlogicfas_driver_template = { | 65 | static struct scsi_host_template qlogicfas_driver_template = { |
| 75 | .module = THIS_MODULE, | 66 | .module = THIS_MODULE, |
| 76 | .name = qlogic_name, | 67 | .name = qlogic_name, |
| @@ -159,7 +150,7 @@ static int qlogic_probe(struct pcmcia_device *link) | |||
| 159 | { | 150 | { |
| 160 | scsi_info_t *info; | 151 | scsi_info_t *info; |
| 161 | 152 | ||
| 162 | DEBUG(0, "qlogic_attach()\n"); | 153 | dev_dbg(&link->dev, "qlogic_attach()\n"); |
| 163 | 154 | ||
| 164 | /* Create new SCSI device */ | 155 | /* Create new SCSI device */ |
| 165 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 156 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
| @@ -171,7 +162,6 @@ static int qlogic_probe(struct pcmcia_device *link) | |||
| 171 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 162 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
| 172 | link->io.IOAddrLines = 10; | 163 | link->io.IOAddrLines = 10; |
| 173 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 164 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
| 174 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 175 | link->conf.Attributes = CONF_ENABLE_IRQ; | 165 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 176 | link->conf.IntType = INT_MEMORY_AND_IO; | 166 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 177 | link->conf.Present = PRESENT_OPTION; | 167 | link->conf.Present = PRESENT_OPTION; |
| @@ -183,7 +173,7 @@ static int qlogic_probe(struct pcmcia_device *link) | |||
| 183 | 173 | ||
| 184 | static void qlogic_detach(struct pcmcia_device *link) | 174 | static void qlogic_detach(struct pcmcia_device *link) |
| 185 | { | 175 | { |
| 186 | DEBUG(0, "qlogic_detach(0x%p)\n", link); | 176 | dev_dbg(&link->dev, "qlogic_detach\n"); |
| 187 | 177 | ||
| 188 | qlogic_release(link); | 178 | qlogic_release(link); |
| 189 | kfree(link->priv); | 179 | kfree(link->priv); |
| @@ -192,9 +182,6 @@ static void qlogic_detach(struct pcmcia_device *link) | |||
| 192 | 182 | ||
| 193 | /*====================================================================*/ | 183 | /*====================================================================*/ |
| 194 | 184 | ||
| 195 | #define CS_CHECK(fn, ret) \ | ||
| 196 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 197 | |||
| 198 | static int qlogic_config_check(struct pcmcia_device *p_dev, | 185 | static int qlogic_config_check(struct pcmcia_device *p_dev, |
| 199 | cistpl_cftable_entry_t *cfg, | 186 | cistpl_cftable_entry_t *cfg, |
| 200 | cistpl_cftable_entry_t *dflt, | 187 | cistpl_cftable_entry_t *dflt, |
| @@ -213,19 +200,22 @@ static int qlogic_config_check(struct pcmcia_device *p_dev, | |||
| 213 | static int qlogic_config(struct pcmcia_device * link) | 200 | static int qlogic_config(struct pcmcia_device * link) |
| 214 | { | 201 | { |
| 215 | scsi_info_t *info = link->priv; | 202 | scsi_info_t *info = link->priv; |
| 216 | int last_ret, last_fn; | 203 | int ret; |
| 217 | struct Scsi_Host *host; | 204 | struct Scsi_Host *host; |
| 218 | 205 | ||
| 219 | DEBUG(0, "qlogic_config(0x%p)\n", link); | 206 | dev_dbg(&link->dev, "qlogic_config\n"); |
| 220 | 207 | ||
| 221 | last_ret = pcmcia_loop_config(link, qlogic_config_check, NULL); | 208 | ret = pcmcia_loop_config(link, qlogic_config_check, NULL); |
| 222 | if (last_ret) { | 209 | if (ret) |
| 223 | cs_error(link, RequestIO, last_ret); | 210 | goto failed; |
| 211 | |||
| 212 | ret = pcmcia_request_irq(link, &link->irq); | ||
| 213 | if (ret) | ||
| 224 | goto failed; | 214 | goto failed; |
| 225 | } | ||
| 226 | 215 | ||
| 227 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 216 | ret = pcmcia_request_configuration(link, &link->conf); |
| 228 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 217 | if (ret) |
| 218 | goto failed; | ||
| 229 | 219 | ||
| 230 | if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { | 220 | if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { |
| 231 | /* set ATAcmd */ | 221 | /* set ATAcmd */ |
| @@ -244,7 +234,7 @@ static int qlogic_config(struct pcmcia_device * link) | |||
| 244 | 234 | ||
| 245 | if (!host) { | 235 | if (!host) { |
| 246 | printk(KERN_INFO "%s: no SCSI devices found\n", qlogic_name); | 236 | printk(KERN_INFO "%s: no SCSI devices found\n", qlogic_name); |
| 247 | goto cs_failed; | 237 | goto failed; |
| 248 | } | 238 | } |
| 249 | 239 | ||
| 250 | sprintf(info->node.dev_name, "scsi%d", host->host_no); | 240 | sprintf(info->node.dev_name, "scsi%d", host->host_no); |
| @@ -253,12 +243,9 @@ static int qlogic_config(struct pcmcia_device * link) | |||
| 253 | 243 | ||
| 254 | return 0; | 244 | return 0; |
| 255 | 245 | ||
| 256 | cs_failed: | ||
| 257 | cs_error(link, last_fn, last_ret); | ||
| 258 | pcmcia_disable_device(link); | ||
| 259 | failed: | 246 | failed: |
| 247 | pcmcia_disable_device(link); | ||
| 260 | return -ENODEV; | 248 | return -ENODEV; |
| 261 | |||
| 262 | } /* qlogic_config */ | 249 | } /* qlogic_config */ |
| 263 | 250 | ||
| 264 | /*====================================================================*/ | 251 | /*====================================================================*/ |
| @@ -267,7 +254,7 @@ static void qlogic_release(struct pcmcia_device *link) | |||
| 267 | { | 254 | { |
| 268 | scsi_info_t *info = link->priv; | 255 | scsi_info_t *info = link->priv; |
| 269 | 256 | ||
| 270 | DEBUG(0, "qlogic_release(0x%p)\n", link); | 257 | dev_dbg(&link->dev, "qlogic_release\n"); |
| 271 | 258 | ||
| 272 | scsi_remove_host(info->host); | 259 | scsi_remove_host(info->host); |
| 273 | 260 | ||
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index b330c11a1752..e7564d8f0cbf 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
| @@ -77,17 +77,6 @@ | |||
| 77 | #include <pcmcia/ds.h> | 77 | #include <pcmcia/ds.h> |
| 78 | #include <pcmcia/ciscode.h> | 78 | #include <pcmcia/ciscode.h> |
| 79 | 79 | ||
| 80 | /* ================================================================== */ | ||
| 81 | |||
| 82 | #ifdef PCMCIA_DEBUG | ||
| 83 | static int pc_debug = PCMCIA_DEBUG; | ||
| 84 | module_param(pc_debug, int, 0); | ||
| 85 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 86 | static char *version = | ||
| 87 | "sym53c500_cs.c 0.9c 2004/10/27 (Bob Tracy)"; | ||
| 88 | #else | ||
| 89 | #define DEBUG(n, args...) | ||
| 90 | #endif | ||
| 91 | 80 | ||
| 92 | /* ================================================================== */ | 81 | /* ================================================================== */ |
| 93 | 82 | ||
| @@ -525,7 +514,7 @@ SYM53C500_release(struct pcmcia_device *link) | |||
| 525 | struct scsi_info_t *info = link->priv; | 514 | struct scsi_info_t *info = link->priv; |
| 526 | struct Scsi_Host *shost = info->host; | 515 | struct Scsi_Host *shost = info->host; |
| 527 | 516 | ||
| 528 | DEBUG(0, "SYM53C500_release(0x%p)\n", link); | 517 | dev_dbg(&link->dev, "SYM53C500_release\n"); |
| 529 | 518 | ||
| 530 | /* | 519 | /* |
| 531 | * Do this before releasing/freeing resources. | 520 | * Do this before releasing/freeing resources. |
| @@ -697,9 +686,6 @@ static struct scsi_host_template sym53c500_driver_template = { | |||
| 697 | .shost_attrs = SYM53C500_shost_attrs | 686 | .shost_attrs = SYM53C500_shost_attrs |
| 698 | }; | 687 | }; |
| 699 | 688 | ||
| 700 | #define CS_CHECK(fn, ret) \ | ||
| 701 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 702 | |||
| 703 | static int SYM53C500_config_check(struct pcmcia_device *p_dev, | 689 | static int SYM53C500_config_check(struct pcmcia_device *p_dev, |
| 704 | cistpl_cftable_entry_t *cfg, | 690 | cistpl_cftable_entry_t *cfg, |
| 705 | cistpl_cftable_entry_t *dflt, | 691 | cistpl_cftable_entry_t *dflt, |
| @@ -719,24 +705,27 @@ static int | |||
| 719 | SYM53C500_config(struct pcmcia_device *link) | 705 | SYM53C500_config(struct pcmcia_device *link) |
| 720 | { | 706 | { |
| 721 | struct scsi_info_t *info = link->priv; | 707 | struct scsi_info_t *info = link->priv; |
| 722 | int last_ret, last_fn; | 708 | int ret; |
| 723 | int irq_level, port_base; | 709 | int irq_level, port_base; |
| 724 | struct Scsi_Host *host; | 710 | struct Scsi_Host *host; |
| 725 | struct scsi_host_template *tpnt = &sym53c500_driver_template; | 711 | struct scsi_host_template *tpnt = &sym53c500_driver_template; |
| 726 | struct sym53c500_data *data; | 712 | struct sym53c500_data *data; |
| 727 | 713 | ||
| 728 | DEBUG(0, "SYM53C500_config(0x%p)\n", link); | 714 | dev_dbg(&link->dev, "SYM53C500_config\n"); |
| 729 | 715 | ||
| 730 | info->manf_id = link->manf_id; | 716 | info->manf_id = link->manf_id; |
| 731 | 717 | ||
| 732 | last_ret = pcmcia_loop_config(link, SYM53C500_config_check, NULL); | 718 | ret = pcmcia_loop_config(link, SYM53C500_config_check, NULL); |
| 733 | if (last_ret) { | 719 | if (ret) |
| 734 | cs_error(link, RequestIO, last_ret); | 720 | goto failed; |
| 721 | |||
| 722 | ret = pcmcia_request_irq(link, &link->irq); | ||
| 723 | if (ret) | ||
| 735 | goto failed; | 724 | goto failed; |
| 736 | } | ||
| 737 | 725 | ||
| 738 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 726 | ret = pcmcia_request_configuration(link, &link->conf); |
| 739 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 727 | if (ret) |
| 728 | goto failed; | ||
| 740 | 729 | ||
| 741 | /* | 730 | /* |
| 742 | * That's the trouble with copying liberally from another driver. | 731 | * That's the trouble with copying liberally from another driver. |
| @@ -824,8 +813,6 @@ err_release: | |||
| 824 | printk(KERN_INFO "sym53c500_cs: no SCSI devices found\n"); | 813 | printk(KERN_INFO "sym53c500_cs: no SCSI devices found\n"); |
| 825 | return -ENODEV; | 814 | return -ENODEV; |
| 826 | 815 | ||
| 827 | cs_failed: | ||
| 828 | cs_error(link, last_fn, last_ret); | ||
| 829 | failed: | 816 | failed: |
| 830 | SYM53C500_release(link); | 817 | SYM53C500_release(link); |
| 831 | return -ENODEV; | 818 | return -ENODEV; |
| @@ -855,7 +842,7 @@ static int sym53c500_resume(struct pcmcia_device *link) | |||
| 855 | static void | 842 | static void |
| 856 | SYM53C500_detach(struct pcmcia_device *link) | 843 | SYM53C500_detach(struct pcmcia_device *link) |
| 857 | { | 844 | { |
| 858 | DEBUG(0, "SYM53C500_detach(0x%p)\n", link); | 845 | dev_dbg(&link->dev, "SYM53C500_detach\n"); |
| 859 | 846 | ||
| 860 | SYM53C500_release(link); | 847 | SYM53C500_release(link); |
| 861 | 848 | ||
| @@ -868,7 +855,7 @@ SYM53C500_probe(struct pcmcia_device *link) | |||
| 868 | { | 855 | { |
| 869 | struct scsi_info_t *info; | 856 | struct scsi_info_t *info; |
| 870 | 857 | ||
| 871 | DEBUG(0, "SYM53C500_attach()\n"); | 858 | dev_dbg(&link->dev, "SYM53C500_attach()\n"); |
| 872 | 859 | ||
| 873 | /* Create new SCSI device */ | 860 | /* Create new SCSI device */ |
| 874 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 861 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
| @@ -880,7 +867,6 @@ SYM53C500_probe(struct pcmcia_device *link) | |||
| 880 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 867 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
| 881 | link->io.IOAddrLines = 10; | 868 | link->io.IOAddrLines = 10; |
| 882 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 869 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
| 883 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 884 | link->conf.Attributes = CONF_ENABLE_IRQ; | 870 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 885 | link->conf.IntType = INT_MEMORY_AND_IO; | 871 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 886 | 872 | ||
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index f7c70e2a8224..0a97bc9074bb 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
| @@ -1071,7 +1071,7 @@ static struct pmcraid_cmd *pmcraid_init_hcam | |||
| 1071 | 1071 | ||
| 1072 | ioarcb->data_transfer_length = cpu_to_le32(rcb_size); | 1072 | ioarcb->data_transfer_length = cpu_to_le32(rcb_size); |
| 1073 | 1073 | ||
| 1074 | ioadl[0].flags |= cpu_to_le32(IOADL_FLAGS_READ_LAST); | 1074 | ioadl[0].flags |= IOADL_FLAGS_READ_LAST; |
| 1075 | ioadl[0].data_len = cpu_to_le32(rcb_size); | 1075 | ioadl[0].data_len = cpu_to_le32(rcb_size); |
| 1076 | ioadl[0].address = cpu_to_le32(dma); | 1076 | ioadl[0].address = cpu_to_le32(dma); |
| 1077 | 1077 | ||
| @@ -2251,7 +2251,7 @@ static void pmcraid_request_sense(struct pmcraid_cmd *cmd) | |||
| 2251 | 2251 | ||
| 2252 | ioadl->address = cpu_to_le64(cmd->sense_buffer_dma); | 2252 | ioadl->address = cpu_to_le64(cmd->sense_buffer_dma); |
| 2253 | ioadl->data_len = cpu_to_le32(SCSI_SENSE_BUFFERSIZE); | 2253 | ioadl->data_len = cpu_to_le32(SCSI_SENSE_BUFFERSIZE); |
| 2254 | ioadl->flags = cpu_to_le32(IOADL_FLAGS_LAST_DESC); | 2254 | ioadl->flags = IOADL_FLAGS_LAST_DESC; |
| 2255 | 2255 | ||
| 2256 | /* request sense might be called as part of error response processing | 2256 | /* request sense might be called as part of error response processing |
| 2257 | * which runs in tasklets context. It is possible that mid-layer might | 2257 | * which runs in tasklets context. It is possible that mid-layer might |
| @@ -3017,7 +3017,7 @@ static int pmcraid_build_ioadl( | |||
| 3017 | ioadl[i].flags = 0; | 3017 | ioadl[i].flags = 0; |
| 3018 | } | 3018 | } |
| 3019 | /* setup last descriptor */ | 3019 | /* setup last descriptor */ |
| 3020 | ioadl[i - 1].flags = cpu_to_le32(IOADL_FLAGS_LAST_DESC); | 3020 | ioadl[i - 1].flags = IOADL_FLAGS_LAST_DESC; |
| 3021 | 3021 | ||
| 3022 | return 0; | 3022 | return 0; |
| 3023 | } | 3023 | } |
| @@ -3387,7 +3387,7 @@ static int pmcraid_build_passthrough_ioadls( | |||
| 3387 | } | 3387 | } |
| 3388 | 3388 | ||
| 3389 | /* setup the last descriptor */ | 3389 | /* setup the last descriptor */ |
| 3390 | ioadl[i - 1].flags = cpu_to_le32(IOADL_FLAGS_LAST_DESC); | 3390 | ioadl[i - 1].flags = IOADL_FLAGS_LAST_DESC; |
| 3391 | 3391 | ||
| 3392 | return 0; | 3392 | return 0; |
| 3393 | } | 3393 | } |
| @@ -5314,7 +5314,7 @@ static void pmcraid_querycfg(struct pmcraid_cmd *cmd) | |||
| 5314 | cpu_to_le32(sizeof(struct pmcraid_config_table)); | 5314 | cpu_to_le32(sizeof(struct pmcraid_config_table)); |
| 5315 | 5315 | ||
| 5316 | ioadl = &(ioarcb->add_data.u.ioadl[0]); | 5316 | ioadl = &(ioarcb->add_data.u.ioadl[0]); |
| 5317 | ioadl->flags = cpu_to_le32(IOADL_FLAGS_LAST_DESC); | 5317 | ioadl->flags = IOADL_FLAGS_LAST_DESC; |
| 5318 | ioadl->address = cpu_to_le64(pinstance->cfg_table_bus_addr); | 5318 | ioadl->address = cpu_to_le64(pinstance->cfg_table_bus_addr); |
| 5319 | ioadl->data_len = cpu_to_le32(sizeof(struct pmcraid_config_table)); | 5319 | ioadl->data_len = cpu_to_le32(sizeof(struct pmcraid_config_table)); |
| 5320 | 5320 | ||
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 0547a7f44d42..47291bcff0d5 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
| @@ -952,16 +952,6 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, | |||
| 952 | return SCSI_SCAN_LUN_PRESENT; | 952 | return SCSI_SCAN_LUN_PRESENT; |
| 953 | } | 953 | } |
| 954 | 954 | ||
| 955 | static inline void scsi_destroy_sdev(struct scsi_device *sdev) | ||
| 956 | { | ||
| 957 | scsi_device_set_state(sdev, SDEV_DEL); | ||
| 958 | if (sdev->host->hostt->slave_destroy) | ||
| 959 | sdev->host->hostt->slave_destroy(sdev); | ||
| 960 | transport_destroy_device(&sdev->sdev_gendev); | ||
| 961 | put_device(&sdev->sdev_dev); | ||
| 962 | put_device(&sdev->sdev_gendev); | ||
| 963 | } | ||
| 964 | |||
| 965 | #ifdef CONFIG_SCSI_LOGGING | 955 | #ifdef CONFIG_SCSI_LOGGING |
| 966 | /** | 956 | /** |
| 967 | * scsi_inq_str - print INQUIRY data from min to max index, strip trailing whitespace | 957 | * scsi_inq_str - print INQUIRY data from min to max index, strip trailing whitespace |
| @@ -1139,7 +1129,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, | |||
| 1139 | } | 1129 | } |
| 1140 | } | 1130 | } |
| 1141 | } else | 1131 | } else |
| 1142 | scsi_destroy_sdev(sdev); | 1132 | __scsi_remove_device(sdev); |
| 1143 | out: | 1133 | out: |
| 1144 | return res; | 1134 | return res; |
| 1145 | } | 1135 | } |
| @@ -1500,7 +1490,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, | |||
| 1500 | /* | 1490 | /* |
| 1501 | * the sdev we used didn't appear in the report luns scan | 1491 | * the sdev we used didn't appear in the report luns scan |
| 1502 | */ | 1492 | */ |
| 1503 | scsi_destroy_sdev(sdev); | 1493 | __scsi_remove_device(sdev); |
| 1504 | return ret; | 1494 | return ret; |
| 1505 | } | 1495 | } |
| 1506 | 1496 | ||
| @@ -1710,7 +1700,7 @@ static void scsi_sysfs_add_devices(struct Scsi_Host *shost) | |||
| 1710 | shost_for_each_device(sdev, shost) { | 1700 | shost_for_each_device(sdev, shost) { |
| 1711 | if (!scsi_host_scan_allowed(shost) || | 1701 | if (!scsi_host_scan_allowed(shost) || |
| 1712 | scsi_sysfs_add_sdev(sdev) != 0) | 1702 | scsi_sysfs_add_sdev(sdev) != 0) |
| 1713 | scsi_destroy_sdev(sdev); | 1703 | __scsi_remove_device(sdev); |
| 1714 | } | 1704 | } |
| 1715 | } | 1705 | } |
| 1716 | 1706 | ||
| @@ -1943,7 +1933,7 @@ void scsi_free_host_dev(struct scsi_device *sdev) | |||
| 1943 | { | 1933 | { |
| 1944 | BUG_ON(sdev->id != sdev->host->this_id); | 1934 | BUG_ON(sdev->id != sdev->host->this_id); |
| 1945 | 1935 | ||
| 1946 | scsi_destroy_sdev(sdev); | 1936 | __scsi_remove_device(sdev); |
| 1947 | } | 1937 | } |
| 1948 | EXPORT_SYMBOL(scsi_free_host_dev); | 1938 | EXPORT_SYMBOL(scsi_free_host_dev); |
| 1949 | 1939 | ||
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 5c7eb63a19d1..392d8db33905 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
| @@ -854,82 +854,73 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
| 854 | transport_configure_device(&starget->dev); | 854 | transport_configure_device(&starget->dev); |
| 855 | error = device_add(&sdev->sdev_gendev); | 855 | error = device_add(&sdev->sdev_gendev); |
| 856 | if (error) { | 856 | if (error) { |
| 857 | put_device(sdev->sdev_gendev.parent); | ||
| 858 | printk(KERN_INFO "error 1\n"); | 857 | printk(KERN_INFO "error 1\n"); |
| 859 | return error; | 858 | goto out_remove; |
| 860 | } | 859 | } |
| 861 | error = device_add(&sdev->sdev_dev); | 860 | error = device_add(&sdev->sdev_dev); |
| 862 | if (error) { | 861 | if (error) { |
| 863 | printk(KERN_INFO "error 2\n"); | 862 | printk(KERN_INFO "error 2\n"); |
| 864 | goto clean_device; | 863 | device_del(&sdev->sdev_gendev); |
| 864 | goto out_remove; | ||
| 865 | } | 865 | } |
| 866 | transport_add_device(&sdev->sdev_gendev); | ||
| 867 | sdev->is_visible = 1; | ||
| 866 | 868 | ||
| 867 | /* create queue files, which may be writable, depending on the host */ | 869 | /* create queue files, which may be writable, depending on the host */ |
| 868 | if (sdev->host->hostt->change_queue_depth) | 870 | if (sdev->host->hostt->change_queue_depth) |
| 869 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_depth_rw); | 871 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_depth_rw); |
| 870 | else | 872 | else |
| 871 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_depth); | 873 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_depth); |
| 872 | if (error) { | 874 | if (error) |
| 873 | __scsi_remove_device(sdev); | 875 | goto out_remove; |
| 874 | goto out; | 876 | |
| 875 | } | ||
| 876 | if (sdev->host->hostt->change_queue_type) | 877 | if (sdev->host->hostt->change_queue_type) |
| 877 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_type_rw); | 878 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_type_rw); |
| 878 | else | 879 | else |
| 879 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_type); | 880 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_type); |
| 880 | if (error) { | 881 | if (error) |
| 881 | __scsi_remove_device(sdev); | 882 | goto out_remove; |
| 882 | goto out; | ||
| 883 | } | ||
| 884 | 883 | ||
| 885 | error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL, NULL); | 884 | error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL, NULL); |
| 886 | 885 | ||
| 887 | if (error) | 886 | if (error) |
| 887 | /* we're treating error on bsg register as non-fatal, | ||
| 888 | * so pretend nothing went wrong */ | ||
| 888 | sdev_printk(KERN_INFO, sdev, | 889 | sdev_printk(KERN_INFO, sdev, |
| 889 | "Failed to register bsg queue, errno=%d\n", error); | 890 | "Failed to register bsg queue, errno=%d\n", error); |
| 890 | 891 | ||
| 891 | /* we're treating error on bsg register as non-fatal, so pretend | ||
| 892 | * nothing went wrong */ | ||
| 893 | error = 0; | ||
| 894 | |||
| 895 | /* add additional host specific attributes */ | 892 | /* add additional host specific attributes */ |
| 896 | if (sdev->host->hostt->sdev_attrs) { | 893 | if (sdev->host->hostt->sdev_attrs) { |
| 897 | for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) { | 894 | for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) { |
| 898 | error = device_create_file(&sdev->sdev_gendev, | 895 | error = device_create_file(&sdev->sdev_gendev, |
| 899 | sdev->host->hostt->sdev_attrs[i]); | 896 | sdev->host->hostt->sdev_attrs[i]); |
| 900 | if (error) { | 897 | if (error) |
| 901 | __scsi_remove_device(sdev); | 898 | goto out_remove; |
| 902 | goto out; | ||
| 903 | } | ||
| 904 | } | 899 | } |
| 905 | } | 900 | } |
| 906 | 901 | ||
| 907 | transport_add_device(&sdev->sdev_gendev); | 902 | return 0; |
| 908 | out: | ||
| 909 | return error; | ||
| 910 | |||
| 911 | clean_device: | ||
| 912 | scsi_device_set_state(sdev, SDEV_CANCEL); | ||
| 913 | |||
| 914 | device_del(&sdev->sdev_gendev); | ||
| 915 | transport_destroy_device(&sdev->sdev_gendev); | ||
| 916 | put_device(&sdev->sdev_dev); | ||
| 917 | put_device(&sdev->sdev_gendev); | ||
| 918 | 903 | ||
| 904 | out_remove: | ||
| 905 | __scsi_remove_device(sdev); | ||
| 919 | return error; | 906 | return error; |
| 907 | |||
| 920 | } | 908 | } |
| 921 | 909 | ||
| 922 | void __scsi_remove_device(struct scsi_device *sdev) | 910 | void __scsi_remove_device(struct scsi_device *sdev) |
| 923 | { | 911 | { |
| 924 | struct device *dev = &sdev->sdev_gendev; | 912 | struct device *dev = &sdev->sdev_gendev; |
| 925 | 913 | ||
| 926 | if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) | 914 | if (sdev->is_visible) { |
| 927 | return; | 915 | if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) |
| 916 | return; | ||
| 928 | 917 | ||
| 929 | bsg_unregister_queue(sdev->request_queue); | 918 | bsg_unregister_queue(sdev->request_queue); |
| 930 | device_unregister(&sdev->sdev_dev); | 919 | device_unregister(&sdev->sdev_dev); |
| 931 | transport_remove_device(dev); | 920 | transport_remove_device(dev); |
| 932 | device_del(dev); | 921 | device_del(dev); |
| 922 | } else | ||
| 923 | put_device(&sdev->sdev_dev); | ||
| 933 | scsi_device_set_state(sdev, SDEV_DEL); | 924 | scsi_device_set_state(sdev, SDEV_DEL); |
| 934 | if (sdev->host->hostt->slave_destroy) | 925 | if (sdev->host->hostt->slave_destroy) |
| 935 | sdev->host->hostt->slave_destroy(sdev); | 926 | sdev->host->hostt->slave_destroy(sdev); |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index a67fed10598a..c6f70dae9b2e 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
| @@ -3656,6 +3656,7 @@ fc_bsg_host_dispatch(struct request_queue *q, struct Scsi_Host *shost, | |||
| 3656 | fail_host_msg: | 3656 | fail_host_msg: |
| 3657 | /* return the errno failure code as the only status */ | 3657 | /* return the errno failure code as the only status */ |
| 3658 | BUG_ON(job->reply_len < sizeof(uint32_t)); | 3658 | BUG_ON(job->reply_len < sizeof(uint32_t)); |
| 3659 | job->reply->reply_payload_rcv_len = 0; | ||
| 3659 | job->reply->result = ret; | 3660 | job->reply->result = ret; |
| 3660 | job->reply_len = sizeof(uint32_t); | 3661 | job->reply_len = sizeof(uint32_t); |
| 3661 | fc_bsg_jobdone(job); | 3662 | fc_bsg_jobdone(job); |
| @@ -3741,6 +3742,7 @@ check_bidi: | |||
| 3741 | fail_rport_msg: | 3742 | fail_rport_msg: |
| 3742 | /* return the errno failure code as the only status */ | 3743 | /* return the errno failure code as the only status */ |
| 3743 | BUG_ON(job->reply_len < sizeof(uint32_t)); | 3744 | BUG_ON(job->reply_len < sizeof(uint32_t)); |
| 3745 | job->reply->reply_payload_rcv_len = 0; | ||
| 3744 | job->reply->result = ret; | 3746 | job->reply->result = ret; |
| 3745 | job->reply_len = sizeof(uint32_t); | 3747 | job->reply_len = sizeof(uint32_t); |
| 3746 | fc_bsg_jobdone(job); | 3748 | fc_bsg_jobdone(job); |
| @@ -3797,6 +3799,7 @@ fc_bsg_request_handler(struct request_queue *q, struct Scsi_Host *shost, | |||
| 3797 | /* check if we have the msgcode value at least */ | 3799 | /* check if we have the msgcode value at least */ |
| 3798 | if (job->request_len < sizeof(uint32_t)) { | 3800 | if (job->request_len < sizeof(uint32_t)) { |
| 3799 | BUG_ON(job->reply_len < sizeof(uint32_t)); | 3801 | BUG_ON(job->reply_len < sizeof(uint32_t)); |
| 3802 | job->reply->reply_payload_rcv_len = 0; | ||
| 3800 | job->reply->result = -ENOMSG; | 3803 | job->reply->result = -ENOMSG; |
| 3801 | job->reply_len = sizeof(uint32_t); | 3804 | job->reply_len = sizeof(uint32_t); |
| 3802 | fc_bsg_jobdone(job); | 3805 | fc_bsg_jobdone(job); |
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c index 88da97745710..84be62149c6c 100644 --- a/drivers/scsi/sd_dif.c +++ b/drivers/scsi/sd_dif.c | |||
| @@ -418,7 +418,7 @@ error: | |||
| 418 | __func__, virt, phys, be32_to_cpu(sdt->ref_tag), | 418 | __func__, virt, phys, be32_to_cpu(sdt->ref_tag), |
| 419 | be16_to_cpu(sdt->app_tag)); | 419 | be16_to_cpu(sdt->app_tag)); |
| 420 | 420 | ||
| 421 | return -EIO; | 421 | return -EILSEQ; |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | /* | 424 | /* |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index b1ae774016f1..737b4c960971 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
| @@ -1089,7 +1089,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags) | |||
| 1089 | if (!up->port.iobase && !up->port.mapbase && !up->port.membase) | 1089 | if (!up->port.iobase && !up->port.mapbase && !up->port.membase) |
| 1090 | return; | 1090 | return; |
| 1091 | 1091 | ||
| 1092 | DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04x, 0x%p): ", | 1092 | DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04lx, 0x%p): ", |
| 1093 | serial_index(&up->port), up->port.iobase, up->port.membase); | 1093 | serial_index(&up->port), up->port.iobase, up->port.membase); |
| 1094 | 1094 | ||
| 1095 | /* | 1095 | /* |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 42e8550cd2b6..b28af13c45a1 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
| @@ -2383,7 +2383,7 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board) | |||
| 2383 | break; | 2383 | break; |
| 2384 | 2384 | ||
| 2385 | #ifdef SERIAL_DEBUG_PCI | 2385 | #ifdef SERIAL_DEBUG_PCI |
| 2386 | printk(KERN_DEBUG "Setup PCI port: port %x, irq %d, type %d\n", | 2386 | printk(KERN_DEBUG "Setup PCI port: port %lx, irq %d, type %d\n", |
| 2387 | serial_port.iobase, serial_port.irq, serial_port.iotype); | 2387 | serial_port.iobase, serial_port.irq, serial_port.iotype); |
| 2388 | #endif | 2388 | #endif |
| 2389 | 2389 | ||
| @@ -3139,6 +3139,12 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
| 3139 | { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_B, | 3139 | { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_B, |
| 3140 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 3140 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
| 3141 | pbn_b0_bt_2_115200 }, | 3141 | pbn_b0_bt_2_115200 }, |
| 3142 | { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_A, | ||
| 3143 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
| 3144 | pbn_b0_bt_2_115200 }, | ||
| 3145 | { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_B, | ||
| 3146 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
| 3147 | pbn_b0_bt_2_115200 }, | ||
| 3142 | { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_A, | 3148 | { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_A, |
| 3143 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 3149 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
| 3144 | pbn_b0_bt_4_460800 }, | 3150 | pbn_b0_bt_4_460800 }, |
diff --git a/drivers/serial/bcm63xx_uart.c b/drivers/serial/bcm63xx_uart.c index beddaa6e9069..37ad0c449937 100644 --- a/drivers/serial/bcm63xx_uart.c +++ b/drivers/serial/bcm63xx_uart.c | |||
| @@ -242,7 +242,7 @@ static void bcm_uart_do_rx(struct uart_port *port) | |||
| 242 | * higher than fifo size anyway since we're much faster than | 242 | * higher than fifo size anyway since we're much faster than |
| 243 | * serial port */ | 243 | * serial port */ |
| 244 | max_count = 32; | 244 | max_count = 32; |
| 245 | tty = port->info->port.tty; | 245 | tty = port->state->port.tty; |
| 246 | do { | 246 | do { |
| 247 | unsigned int iestat, c, cstat; | 247 | unsigned int iestat, c, cstat; |
| 248 | char flag; | 248 | char flag; |
| @@ -318,7 +318,7 @@ static void bcm_uart_do_tx(struct uart_port *port) | |||
| 318 | return; | 318 | return; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | xmit = &port->info->xmit; | 321 | xmit = &port->state->xmit; |
| 322 | if (uart_circ_empty(xmit)) | 322 | if (uart_circ_empty(xmit)) |
| 323 | goto txq_empty; | 323 | goto txq_empty; |
| 324 | 324 | ||
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c index 02406ba6da1c..cdf172eda2e3 100644 --- a/drivers/serial/of_serial.c +++ b/drivers/serial/of_serial.c | |||
| @@ -161,6 +161,7 @@ static int of_platform_serial_remove(struct of_device *ofdev) | |||
| 161 | static struct of_device_id __devinitdata of_platform_serial_table[] = { | 161 | static struct of_device_id __devinitdata of_platform_serial_table[] = { |
| 162 | { .type = "serial", .compatible = "ns8250", .data = (void *)PORT_8250, }, | 162 | { .type = "serial", .compatible = "ns8250", .data = (void *)PORT_8250, }, |
| 163 | { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, }, | 163 | { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, }, |
| 164 | { .type = "serial", .compatible = "ns16550a", .data = (void *)PORT_16550A, }, | ||
| 164 | { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, }, | 165 | { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, }, |
| 165 | { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, }, | 166 | { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, }, |
| 166 | { .type = "serial", .compatible = "ns16850", .data = (void *)PORT_16850, }, | 167 | { .type = "serial", .compatible = "ns16850", .data = (void *)PORT_16850, }, |
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 7c7914f5fa02..fc413f0f8dd2 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
| @@ -54,14 +54,6 @@ | |||
| 54 | 54 | ||
| 55 | #include "8250.h" | 55 | #include "8250.h" |
| 56 | 56 | ||
| 57 | #ifdef PCMCIA_DEBUG | ||
| 58 | static int pc_debug = PCMCIA_DEBUG; | ||
| 59 | module_param(pc_debug, int, 0644); | ||
| 60 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 61 | static char *version = "serial_cs.c 1.134 2002/05/04 05:48:53 (David Hinds)"; | ||
| 62 | #else | ||
| 63 | #define DEBUG(n, args...) | ||
| 64 | #endif | ||
| 65 | 57 | ||
| 66 | /*====================================================================*/ | 58 | /*====================================================================*/ |
| 67 | 59 | ||
| @@ -121,24 +113,20 @@ static void quirk_setup_brainboxes_0104(struct pcmcia_device *link, struct uart_ | |||
| 121 | static int quirk_post_ibm(struct pcmcia_device *link) | 113 | static int quirk_post_ibm(struct pcmcia_device *link) |
| 122 | { | 114 | { |
| 123 | conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; | 115 | conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; |
| 124 | int last_ret, last_fn; | 116 | int ret; |
| 117 | |||
| 118 | ret = pcmcia_access_configuration_register(link, ®); | ||
| 119 | if (ret) | ||
| 120 | goto failed; | ||
| 125 | 121 | ||
| 126 | last_ret = pcmcia_access_configuration_register(link, ®); | ||
| 127 | if (last_ret) { | ||
| 128 | last_fn = AccessConfigurationRegister; | ||
| 129 | goto cs_failed; | ||
| 130 | } | ||
| 131 | reg.Action = CS_WRITE; | 122 | reg.Action = CS_WRITE; |
| 132 | reg.Value = reg.Value | 1; | 123 | reg.Value = reg.Value | 1; |
| 133 | last_ret = pcmcia_access_configuration_register(link, ®); | 124 | ret = pcmcia_access_configuration_register(link, ®); |
| 134 | if (last_ret) { | 125 | if (ret) |
| 135 | last_fn = AccessConfigurationRegister; | 126 | goto failed; |
| 136 | goto cs_failed; | ||
| 137 | } | ||
| 138 | return 0; | 127 | return 0; |
| 139 | 128 | ||
| 140 | cs_failed: | 129 | failed: |
| 141 | cs_error(link, last_fn, last_ret); | ||
| 142 | return -ENODEV; | 130 | return -ENODEV; |
| 143 | } | 131 | } |
| 144 | 132 | ||
| @@ -283,7 +271,7 @@ static void serial_remove(struct pcmcia_device *link) | |||
| 283 | struct serial_info *info = link->priv; | 271 | struct serial_info *info = link->priv; |
| 284 | int i; | 272 | int i; |
| 285 | 273 | ||
| 286 | DEBUG(0, "serial_release(0x%p)\n", link); | 274 | dev_dbg(&link->dev, "serial_release\n"); |
| 287 | 275 | ||
| 288 | /* | 276 | /* |
| 289 | * Recheck to see if the device is still configured. | 277 | * Recheck to see if the device is still configured. |
| @@ -334,7 +322,7 @@ static int serial_probe(struct pcmcia_device *link) | |||
| 334 | { | 322 | { |
| 335 | struct serial_info *info; | 323 | struct serial_info *info; |
| 336 | 324 | ||
| 337 | DEBUG(0, "serial_attach()\n"); | 325 | dev_dbg(&link->dev, "serial_attach()\n"); |
| 338 | 326 | ||
| 339 | /* Create new serial device */ | 327 | /* Create new serial device */ |
| 340 | info = kzalloc(sizeof (*info), GFP_KERNEL); | 328 | info = kzalloc(sizeof (*info), GFP_KERNEL); |
| @@ -346,7 +334,6 @@ static int serial_probe(struct pcmcia_device *link) | |||
| 346 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 334 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 347 | link->io.NumPorts1 = 8; | 335 | link->io.NumPorts1 = 8; |
| 348 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 336 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 349 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 350 | link->conf.Attributes = CONF_ENABLE_IRQ; | 337 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 351 | if (do_sound) { | 338 | if (do_sound) { |
| 352 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 339 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
| @@ -370,7 +357,7 @@ static void serial_detach(struct pcmcia_device *link) | |||
| 370 | { | 357 | { |
| 371 | struct serial_info *info = link->priv; | 358 | struct serial_info *info = link->priv; |
| 372 | 359 | ||
| 373 | DEBUG(0, "serial_detach(0x%p)\n", link); | 360 | dev_dbg(&link->dev, "serial_detach\n"); |
| 374 | 361 | ||
| 375 | /* | 362 | /* |
| 376 | * Ensure any outstanding scheduled tasks are completed. | 363 | * Ensure any outstanding scheduled tasks are completed. |
| @@ -399,7 +386,7 @@ static int setup_serial(struct pcmcia_device *handle, struct serial_info * info, | |||
| 399 | port.irq = irq; | 386 | port.irq = irq; |
| 400 | port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; | 387 | port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; |
| 401 | port.uartclk = 1843200; | 388 | port.uartclk = 1843200; |
| 402 | port.dev = &handle_to_dev(handle); | 389 | port.dev = &handle->dev; |
| 403 | if (buggy_uart) | 390 | if (buggy_uart) |
| 404 | port.flags |= UPF_BUGGY_UART; | 391 | port.flags |= UPF_BUGGY_UART; |
| 405 | 392 | ||
| @@ -426,21 +413,6 @@ static int setup_serial(struct pcmcia_device *handle, struct serial_info * info, | |||
| 426 | 413 | ||
| 427 | /*====================================================================*/ | 414 | /*====================================================================*/ |
| 428 | 415 | ||
| 429 | static int | ||
| 430 | first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) | ||
| 431 | { | ||
| 432 | int i; | ||
| 433 | i = pcmcia_get_first_tuple(handle, tuple); | ||
| 434 | if (i != 0) | ||
| 435 | return i; | ||
| 436 | i = pcmcia_get_tuple_data(handle, tuple); | ||
| 437 | if (i != 0) | ||
| 438 | return i; | ||
| 439 | return pcmcia_parse_tuple(tuple, parse); | ||
| 440 | } | ||
| 441 | |||
| 442 | /*====================================================================*/ | ||
| 443 | |||
| 444 | static int simple_config_check(struct pcmcia_device *p_dev, | 416 | static int simple_config_check(struct pcmcia_device *p_dev, |
| 445 | cistpl_cftable_entry_t *cf, | 417 | cistpl_cftable_entry_t *cf, |
| 446 | cistpl_cftable_entry_t *dflt, | 418 | cistpl_cftable_entry_t *dflt, |
| @@ -522,15 +494,13 @@ static int simple_config(struct pcmcia_device *link) | |||
| 522 | 494 | ||
| 523 | printk(KERN_NOTICE | 495 | printk(KERN_NOTICE |
| 524 | "serial_cs: no usable port range found, giving up\n"); | 496 | "serial_cs: no usable port range found, giving up\n"); |
| 525 | cs_error(link, RequestIO, i); | ||
| 526 | return -1; | 497 | return -1; |
| 527 | 498 | ||
| 528 | found_port: | 499 | found_port: |
| 529 | i = pcmcia_request_irq(link, &link->irq); | 500 | i = pcmcia_request_irq(link, &link->irq); |
| 530 | if (i != 0) { | 501 | if (i != 0) |
| 531 | cs_error(link, RequestIRQ, i); | ||
| 532 | link->irq.AssignedIRQ = 0; | 502 | link->irq.AssignedIRQ = 0; |
| 533 | } | 503 | |
| 534 | if (info->multi && (info->manfid == MANFID_3COM)) | 504 | if (info->multi && (info->manfid == MANFID_3COM)) |
| 535 | link->conf.ConfigIndex &= ~(0x08); | 505 | link->conf.ConfigIndex &= ~(0x08); |
| 536 | 506 | ||
| @@ -541,10 +511,8 @@ found_port: | |||
| 541 | info->quirk->config(link); | 511 | info->quirk->config(link); |
| 542 | 512 | ||
| 543 | i = pcmcia_request_configuration(link, &link->conf); | 513 | i = pcmcia_request_configuration(link, &link->conf); |
| 544 | if (i != 0) { | 514 | if (i != 0) |
| 545 | cs_error(link, RequestConfiguration, i); | ||
| 546 | return -1; | 515 | return -1; |
| 547 | } | ||
| 548 | return setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); | 516 | return setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); |
| 549 | } | 517 | } |
| 550 | 518 | ||
| @@ -613,7 +581,6 @@ static int multi_config(struct pcmcia_device *link) | |||
| 613 | /* FIXME: comment does not fit, error handling does not fit */ | 581 | /* FIXME: comment does not fit, error handling does not fit */ |
| 614 | printk(KERN_NOTICE | 582 | printk(KERN_NOTICE |
| 615 | "serial_cs: no usable port range found, giving up\n"); | 583 | "serial_cs: no usable port range found, giving up\n"); |
| 616 | cs_error(link, RequestIRQ, i); | ||
| 617 | link->irq.AssignedIRQ = 0; | 584 | link->irq.AssignedIRQ = 0; |
| 618 | } | 585 | } |
| 619 | 586 | ||
| @@ -624,10 +591,8 @@ static int multi_config(struct pcmcia_device *link) | |||
| 624 | info->quirk->config(link); | 591 | info->quirk->config(link); |
| 625 | 592 | ||
| 626 | i = pcmcia_request_configuration(link, &link->conf); | 593 | i = pcmcia_request_configuration(link, &link->conf); |
| 627 | if (i != 0) { | 594 | if (i != 0) |
| 628 | cs_error(link, RequestConfiguration, i); | ||
| 629 | return -ENODEV; | 595 | return -ENODEV; |
| 630 | } | ||
| 631 | 596 | ||
| 632 | /* The Oxford Semiconductor OXCF950 cards are in fact single-port: | 597 | /* The Oxford Semiconductor OXCF950 cards are in fact single-port: |
| 633 | * 8 registers are for the UART, the others are extra registers. | 598 | * 8 registers are for the UART, the others are extra registers. |
| @@ -665,6 +630,25 @@ static int multi_config(struct pcmcia_device *link) | |||
| 665 | return 0; | 630 | return 0; |
| 666 | } | 631 | } |
| 667 | 632 | ||
| 633 | static int serial_check_for_multi(struct pcmcia_device *p_dev, | ||
| 634 | cistpl_cftable_entry_t *cf, | ||
| 635 | cistpl_cftable_entry_t *dflt, | ||
| 636 | unsigned int vcc, | ||
| 637 | void *priv_data) | ||
| 638 | { | ||
| 639 | struct serial_info *info = p_dev->priv; | ||
| 640 | |||
| 641 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) | ||
| 642 | info->multi = cf->io.win[0].len >> 3; | ||
| 643 | |||
| 644 | if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && | ||
| 645 | (cf->io.win[1].len == 8)) | ||
| 646 | info->multi = 2; | ||
| 647 | |||
| 648 | return 0; /* break */ | ||
| 649 | } | ||
| 650 | |||
| 651 | |||
| 668 | /*====================================================================== | 652 | /*====================================================================== |
| 669 | 653 | ||
| 670 | serial_config() is scheduled to run after a CARD_INSERTION event | 654 | serial_config() is scheduled to run after a CARD_INSERTION event |
| @@ -676,46 +660,14 @@ static int multi_config(struct pcmcia_device *link) | |||
| 676 | static int serial_config(struct pcmcia_device * link) | 660 | static int serial_config(struct pcmcia_device * link) |
| 677 | { | 661 | { |
| 678 | struct serial_info *info = link->priv; | 662 | struct serial_info *info = link->priv; |
| 679 | struct serial_cfg_mem *cfg_mem; | 663 | int i; |
| 680 | tuple_t *tuple; | ||
| 681 | u_char *buf; | ||
| 682 | cisparse_t *parse; | ||
| 683 | cistpl_cftable_entry_t *cf; | ||
| 684 | int i, last_ret, last_fn; | ||
| 685 | |||
| 686 | DEBUG(0, "serial_config(0x%p)\n", link); | ||
| 687 | |||
| 688 | cfg_mem = kmalloc(sizeof(struct serial_cfg_mem), GFP_KERNEL); | ||
| 689 | if (!cfg_mem) | ||
| 690 | goto failed; | ||
| 691 | 664 | ||
| 692 | tuple = &cfg_mem->tuple; | 665 | dev_dbg(&link->dev, "serial_config\n"); |
| 693 | parse = &cfg_mem->parse; | ||
| 694 | cf = &parse->cftable_entry; | ||
| 695 | buf = cfg_mem->buf; | ||
| 696 | |||
| 697 | tuple->TupleData = (cisdata_t *) buf; | ||
| 698 | tuple->TupleOffset = 0; | ||
| 699 | tuple->TupleDataMax = 255; | ||
| 700 | tuple->Attributes = 0; | ||
| 701 | |||
| 702 | /* Get configuration register information */ | ||
| 703 | tuple->DesiredTuple = CISTPL_CONFIG; | ||
| 704 | last_ret = first_tuple(link, tuple, parse); | ||
| 705 | if (last_ret != 0) { | ||
| 706 | last_fn = ParseTuple; | ||
| 707 | goto cs_failed; | ||
| 708 | } | ||
| 709 | link->conf.ConfigBase = parse->config.base; | ||
| 710 | link->conf.Present = parse->config.rmask[0]; | ||
| 711 | 666 | ||
| 712 | /* Is this a compliant multifunction card? */ | 667 | /* Is this a compliant multifunction card? */ |
| 713 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; | 668 | info->multi = (link->socket->functions > 1); |
| 714 | tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; | ||
| 715 | info->multi = (first_tuple(link, tuple, parse) == 0); | ||
| 716 | 669 | ||
| 717 | /* Is this a multiport card? */ | 670 | /* Is this a multiport card? */ |
| 718 | tuple->DesiredTuple = CISTPL_MANFID; | ||
| 719 | info->manfid = link->manf_id; | 671 | info->manfid = link->manf_id; |
| 720 | info->prodid = link->card_id; | 672 | info->prodid = link->card_id; |
| 721 | 673 | ||
| @@ -730,20 +682,11 @@ static int serial_config(struct pcmcia_device * link) | |||
| 730 | 682 | ||
| 731 | /* Another check for dual-serial cards: look for either serial or | 683 | /* Another check for dual-serial cards: look for either serial or |
| 732 | multifunction cards that ask for appropriate IO port ranges */ | 684 | multifunction cards that ask for appropriate IO port ranges */ |
| 733 | tuple->DesiredTuple = CISTPL_FUNCID; | ||
| 734 | if ((info->multi == 0) && | 685 | if ((info->multi == 0) && |
| 735 | (link->has_func_id) && | 686 | (link->has_func_id) && |
| 736 | ((link->func_id == CISTPL_FUNCID_MULTI) || | 687 | ((link->func_id == CISTPL_FUNCID_MULTI) || |
| 737 | (link->func_id == CISTPL_FUNCID_SERIAL))) { | 688 | (link->func_id == CISTPL_FUNCID_SERIAL))) |
| 738 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | 689 | pcmcia_loop_config(link, serial_check_for_multi, info); |
| 739 | if (first_tuple(link, tuple, parse) == 0) { | ||
| 740 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) | ||
| 741 | info->multi = cf->io.win[0].len >> 3; | ||
| 742 | if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && | ||
| 743 | (cf->io.win[1].len == 8)) | ||
| 744 | info->multi = 2; | ||
| 745 | } | ||
| 746 | } | ||
| 747 | 690 | ||
| 748 | /* | 691 | /* |
| 749 | * Apply any multi-port quirk. | 692 | * Apply any multi-port quirk. |
| @@ -768,14 +711,10 @@ static int serial_config(struct pcmcia_device * link) | |||
| 768 | goto failed; | 711 | goto failed; |
| 769 | 712 | ||
| 770 | link->dev_node = &info->node[0]; | 713 | link->dev_node = &info->node[0]; |
| 771 | kfree(cfg_mem); | ||
| 772 | return 0; | 714 | return 0; |
| 773 | 715 | ||
| 774 | cs_failed: | ||
| 775 | cs_error(link, last_fn, last_ret); | ||
| 776 | failed: | 716 | failed: |
| 777 | serial_remove(link); | 717 | serial_remove(link); |
| 778 | kfree(cfg_mem); | ||
| 779 | return -ENODEV; | 718 | return -ENODEV; |
| 780 | } | 719 | } |
| 781 | 720 | ||
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 85119fb7cb50..6498bd1fb6dd 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
| @@ -1143,7 +1143,7 @@ static void serial_console_write(struct console *co, const char *s, | |||
| 1143 | while ((sci_in(port, SCxSR) & bits) != bits) | 1143 | while ((sci_in(port, SCxSR) & bits) != bits) |
| 1144 | cpu_relax(); | 1144 | cpu_relax(); |
| 1145 | 1145 | ||
| 1146 | if (sci_port->disable); | 1146 | if (sci_port->disable) |
| 1147 | sci_port->disable(port); | 1147 | sci_port->disable(port); |
| 1148 | } | 1148 | } |
| 1149 | 1149 | ||
diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c index a2d4a19550ab..ed7d958b0a01 100644 --- a/drivers/serial/suncore.c +++ b/drivers/serial/suncore.c | |||
| @@ -53,20 +53,21 @@ void sunserial_unregister_minors(struct uart_driver *drv, int count) | |||
| 53 | EXPORT_SYMBOL(sunserial_unregister_minors); | 53 | EXPORT_SYMBOL(sunserial_unregister_minors); |
| 54 | 54 | ||
| 55 | int sunserial_console_match(struct console *con, struct device_node *dp, | 55 | int sunserial_console_match(struct console *con, struct device_node *dp, |
| 56 | struct uart_driver *drv, int line) | 56 | struct uart_driver *drv, int line, bool ignore_line) |
| 57 | { | 57 | { |
| 58 | int off; | ||
| 59 | |||
| 60 | if (!con || of_console_device != dp) | 58 | if (!con || of_console_device != dp) |
| 61 | return 0; | 59 | return 0; |
| 62 | 60 | ||
| 63 | off = 0; | 61 | if (!ignore_line) { |
| 64 | if (of_console_options && | 62 | int off = 0; |
| 65 | *of_console_options == 'b') | ||
| 66 | off = 1; | ||
| 67 | 63 | ||
| 68 | if ((line & 1) != off) | 64 | if (of_console_options && |
| 69 | return 0; | 65 | *of_console_options == 'b') |
| 66 | off = 1; | ||
| 67 | |||
| 68 | if ((line & 1) != off) | ||
| 69 | return 0; | ||
| 70 | } | ||
| 70 | 71 | ||
| 71 | con->index = line; | 72 | con->index = line; |
| 72 | drv->cons = con; | 73 | drv->cons = con; |
| @@ -76,23 +77,24 @@ int sunserial_console_match(struct console *con, struct device_node *dp, | |||
| 76 | } | 77 | } |
| 77 | EXPORT_SYMBOL(sunserial_console_match); | 78 | EXPORT_SYMBOL(sunserial_console_match); |
| 78 | 79 | ||
| 79 | void | 80 | void sunserial_console_termios(struct console *con, struct device_node *uart_dp) |
| 80 | sunserial_console_termios(struct console *con) | ||
| 81 | { | 81 | { |
| 82 | struct device_node *dp; | 82 | const char *mode, *s; |
| 83 | const char *od, *mode, *s; | ||
| 84 | char mode_prop[] = "ttyX-mode"; | 83 | char mode_prop[] = "ttyX-mode"; |
| 85 | int baud, bits, stop, cflag; | 84 | int baud, bits, stop, cflag; |
| 86 | char parity; | 85 | char parity; |
| 87 | 86 | ||
| 88 | dp = of_find_node_by_path("/options"); | 87 | if (!strcmp(uart_dp->name, "rsc") || |
| 89 | od = of_get_property(dp, "output-device", NULL); | 88 | !strcmp(uart_dp->name, "rsc-console") || |
| 90 | if (!strcmp(od, "rsc")) { | 89 | !strcmp(uart_dp->name, "rsc-control")) { |
| 91 | mode = of_get_property(of_console_device, | 90 | mode = of_get_property(uart_dp, |
| 92 | "ssp-console-modes", NULL); | 91 | "ssp-console-modes", NULL); |
| 93 | if (!mode) | 92 | if (!mode) |
| 94 | mode = "115200,8,n,1,-"; | 93 | mode = "115200,8,n,1,-"; |
| 94 | } else if (!strcmp(uart_dp->name, "lom-console")) { | ||
| 95 | mode = "9600,8,n,1,-"; | ||
| 95 | } else { | 96 | } else { |
| 97 | struct device_node *dp; | ||
| 96 | char c; | 98 | char c; |
| 97 | 99 | ||
| 98 | c = 'a'; | 100 | c = 'a'; |
| @@ -101,6 +103,7 @@ sunserial_console_termios(struct console *con) | |||
| 101 | 103 | ||
| 102 | mode_prop[3] = c; | 104 | mode_prop[3] = c; |
| 103 | 105 | ||
| 106 | dp = of_find_node_by_path("/options"); | ||
| 104 | mode = of_get_property(dp, mode_prop, NULL); | 107 | mode = of_get_property(dp, mode_prop, NULL); |
| 105 | if (!mode) | 108 | if (!mode) |
| 106 | mode = "9600,8,n,1,-"; | 109 | mode = "9600,8,n,1,-"; |
diff --git a/drivers/serial/suncore.h b/drivers/serial/suncore.h index 042668aa602e..db2057936c31 100644 --- a/drivers/serial/suncore.h +++ b/drivers/serial/suncore.h | |||
| @@ -26,7 +26,8 @@ extern int sunserial_register_minors(struct uart_driver *, int); | |||
| 26 | extern void sunserial_unregister_minors(struct uart_driver *, int); | 26 | extern void sunserial_unregister_minors(struct uart_driver *, int); |
| 27 | 27 | ||
| 28 | extern int sunserial_console_match(struct console *, struct device_node *, | 28 | extern int sunserial_console_match(struct console *, struct device_node *, |
| 29 | struct uart_driver *, int); | 29 | struct uart_driver *, int, bool); |
| 30 | extern void sunserial_console_termios(struct console *); | 30 | extern void sunserial_console_termios(struct console *, |
| 31 | struct device_node *); | ||
| 31 | 32 | ||
| 32 | #endif /* !(_SERIAL_SUN_H) */ | 33 | #endif /* !(_SERIAL_SUN_H) */ |
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c index d548652dee50..d14cca7fb88d 100644 --- a/drivers/serial/sunhv.c +++ b/drivers/serial/sunhv.c | |||
| @@ -566,7 +566,7 @@ static int __devinit hv_probe(struct of_device *op, const struct of_device_id *m | |||
| 566 | goto out_free_con_read_page; | 566 | goto out_free_con_read_page; |
| 567 | 567 | ||
| 568 | sunserial_console_match(&sunhv_console, op->node, | 568 | sunserial_console_match(&sunhv_console, op->node, |
| 569 | &sunhv_reg, port->line); | 569 | &sunhv_reg, port->line, false); |
| 570 | 570 | ||
| 571 | err = uart_add_one_port(&sunhv_reg, port); | 571 | err = uart_add_one_port(&sunhv_reg, port); |
| 572 | if (err) | 572 | if (err) |
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index d1ad34128635..d514e28d0755 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
| @@ -883,7 +883,7 @@ static int sunsab_console_setup(struct console *con, char *options) | |||
| 883 | printk("Console: ttyS%d (SAB82532)\n", | 883 | printk("Console: ttyS%d (SAB82532)\n", |
| 884 | (sunsab_reg.minor - 64) + con->index); | 884 | (sunsab_reg.minor - 64) + con->index); |
| 885 | 885 | ||
| 886 | sunserial_console_termios(con); | 886 | sunserial_console_termios(con, to_of_device(up->port.dev)->node); |
| 887 | 887 | ||
| 888 | switch (con->cflag & CBAUD) { | 888 | switch (con->cflag & CBAUD) { |
| 889 | case B150: baud = 150; break; | 889 | case B150: baud = 150; break; |
| @@ -1027,10 +1027,12 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id * | |||
| 1027 | goto out1; | 1027 | goto out1; |
| 1028 | 1028 | ||
| 1029 | sunserial_console_match(SUNSAB_CONSOLE(), op->node, | 1029 | sunserial_console_match(SUNSAB_CONSOLE(), op->node, |
| 1030 | &sunsab_reg, up[0].port.line); | 1030 | &sunsab_reg, up[0].port.line, |
| 1031 | false); | ||
| 1031 | 1032 | ||
| 1032 | sunserial_console_match(SUNSAB_CONSOLE(), op->node, | 1033 | sunserial_console_match(SUNSAB_CONSOLE(), op->node, |
| 1033 | &sunsab_reg, up[1].port.line); | 1034 | &sunsab_reg, up[1].port.line, |
| 1035 | false); | ||
| 1034 | 1036 | ||
| 1035 | err = uart_add_one_port(&sunsab_reg, &up[0].port); | 1037 | err = uart_add_one_port(&sunsab_reg, &up[0].port); |
| 1036 | if (err) | 1038 | if (err) |
| @@ -1116,7 +1118,6 @@ static int __init sunsab_init(void) | |||
| 1116 | if (!sunsab_ports) | 1118 | if (!sunsab_ports) |
| 1117 | return -ENOMEM; | 1119 | return -ENOMEM; |
| 1118 | 1120 | ||
| 1119 | sunsab_reg.cons = SUNSAB_CONSOLE(); | ||
| 1120 | err = sunserial_register_minors(&sunsab_reg, num_channels); | 1121 | err = sunserial_register_minors(&sunsab_reg, num_channels); |
| 1121 | if (err) { | 1122 | if (err) { |
| 1122 | kfree(sunsab_ports); | 1123 | kfree(sunsab_ports); |
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 68d262b15749..170d3d68c8f0 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
| @@ -1329,11 +1329,9 @@ static void sunsu_console_write(struct console *co, const char *s, | |||
| 1329 | */ | 1329 | */ |
| 1330 | static int __init sunsu_console_setup(struct console *co, char *options) | 1330 | static int __init sunsu_console_setup(struct console *co, char *options) |
| 1331 | { | 1331 | { |
| 1332 | static struct ktermios dummy; | ||
| 1333 | struct ktermios termios; | ||
| 1332 | struct uart_port *port; | 1334 | struct uart_port *port; |
| 1333 | int baud = 9600; | ||
| 1334 | int bits = 8; | ||
| 1335 | int parity = 'n'; | ||
| 1336 | int flow = 'n'; | ||
| 1337 | 1335 | ||
| 1338 | printk("Console: ttyS%d (SU)\n", | 1336 | printk("Console: ttyS%d (SU)\n", |
| 1339 | (sunsu_reg.minor - 64) + co->index); | 1337 | (sunsu_reg.minor - 64) + co->index); |
| @@ -1352,10 +1350,15 @@ static int __init sunsu_console_setup(struct console *co, char *options) | |||
| 1352 | */ | 1350 | */ |
| 1353 | spin_lock_init(&port->lock); | 1351 | spin_lock_init(&port->lock); |
| 1354 | 1352 | ||
| 1355 | if (options) | 1353 | /* Get firmware console settings. */ |
| 1356 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 1354 | sunserial_console_termios(co, to_of_device(port->dev)->node); |
| 1357 | 1355 | ||
| 1358 | return uart_set_options(port, co, baud, parity, bits, flow); | 1356 | memset(&termios, 0, sizeof(struct ktermios)); |
| 1357 | termios.c_cflag = co->cflag; | ||
| 1358 | port->mctrl |= TIOCM_DTR; | ||
| 1359 | port->ops->set_termios(port, &termios, &dummy); | ||
| 1360 | |||
| 1361 | return 0; | ||
| 1359 | } | 1362 | } |
| 1360 | 1363 | ||
| 1361 | static struct console sunsu_console = { | 1364 | static struct console sunsu_console = { |
| @@ -1409,6 +1412,7 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m | |||
| 1409 | struct uart_sunsu_port *up; | 1412 | struct uart_sunsu_port *up; |
| 1410 | struct resource *rp; | 1413 | struct resource *rp; |
| 1411 | enum su_type type; | 1414 | enum su_type type; |
| 1415 | bool ignore_line; | ||
| 1412 | int err; | 1416 | int err; |
| 1413 | 1417 | ||
| 1414 | type = su_get_type(dp); | 1418 | type = su_get_type(dp); |
| @@ -1467,8 +1471,14 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m | |||
| 1467 | 1471 | ||
| 1468 | up->port.ops = &sunsu_pops; | 1472 | up->port.ops = &sunsu_pops; |
| 1469 | 1473 | ||
| 1474 | ignore_line = false; | ||
| 1475 | if (!strcmp(dp->name, "rsc-console") || | ||
| 1476 | !strcmp(dp->name, "lom-console")) | ||
| 1477 | ignore_line = true; | ||
| 1478 | |||
| 1470 | sunserial_console_match(SUNSU_CONSOLE(), dp, | 1479 | sunserial_console_match(SUNSU_CONSOLE(), dp, |
| 1471 | &sunsu_reg, up->port.line); | 1480 | &sunsu_reg, up->port.line, |
| 1481 | ignore_line); | ||
| 1472 | err = uart_add_one_port(&sunsu_reg, &up->port); | 1482 | err = uart_add_one_port(&sunsu_reg, &up->port); |
| 1473 | if (err) | 1483 | if (err) |
| 1474 | goto out_unmap; | 1484 | goto out_unmap; |
| @@ -1517,6 +1527,10 @@ static const struct of_device_id su_match[] = { | |||
| 1517 | .name = "serial", | 1527 | .name = "serial", |
| 1518 | .compatible = "su", | 1528 | .compatible = "su", |
| 1519 | }, | 1529 | }, |
| 1530 | { | ||
| 1531 | .type = "serial", | ||
| 1532 | .compatible = "su", | ||
| 1533 | }, | ||
| 1520 | {}, | 1534 | {}, |
| 1521 | }; | 1535 | }; |
| 1522 | MODULE_DEVICE_TABLE(of, su_match); | 1536 | MODULE_DEVICE_TABLE(of, su_match); |
| @@ -1548,6 +1562,12 @@ static int __init sunsu_init(void) | |||
| 1548 | num_uart++; | 1562 | num_uart++; |
| 1549 | } | 1563 | } |
| 1550 | } | 1564 | } |
| 1565 | for_each_node_by_type(dp, "serial") { | ||
| 1566 | if (of_device_is_compatible(dp, "su")) { | ||
| 1567 | if (su_get_type(dp) == SU_PORT_PORT) | ||
| 1568 | num_uart++; | ||
| 1569 | } | ||
| 1570 | } | ||
| 1551 | 1571 | ||
| 1552 | if (num_uart) { | 1572 | if (num_uart) { |
| 1553 | err = sunserial_register_minors(&sunsu_reg, num_uart); | 1573 | err = sunserial_register_minors(&sunsu_reg, num_uart); |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index ef693ae22e7f..2c7a66af4f52 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
| @@ -1180,7 +1180,7 @@ static int __init sunzilog_console_setup(struct console *con, char *options) | |||
| 1180 | (sunzilog_reg.minor - 64) + con->index, con->index); | 1180 | (sunzilog_reg.minor - 64) + con->index, con->index); |
| 1181 | 1181 | ||
| 1182 | /* Get firmware console settings. */ | 1182 | /* Get firmware console settings. */ |
| 1183 | sunserial_console_termios(con); | 1183 | sunserial_console_termios(con, to_of_device(up->port.dev)->node); |
| 1184 | 1184 | ||
| 1185 | /* Firmware console speed is limited to 150-->38400 baud so | 1185 | /* Firmware console speed is limited to 150-->38400 baud so |
| 1186 | * this hackish cflag thing is OK. | 1186 | * this hackish cflag thing is OK. |
| @@ -1416,7 +1416,8 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m | |||
| 1416 | 1416 | ||
| 1417 | if (!keyboard_mouse) { | 1417 | if (!keyboard_mouse) { |
| 1418 | if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, | 1418 | if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, |
| 1419 | &sunzilog_reg, up[0].port.line)) | 1419 | &sunzilog_reg, up[0].port.line, |
| 1420 | false)) | ||
| 1420 | up->flags |= SUNZILOG_FLAG_IS_CONS; | 1421 | up->flags |= SUNZILOG_FLAG_IS_CONS; |
| 1421 | err = uart_add_one_port(&sunzilog_reg, &up[0].port); | 1422 | err = uart_add_one_port(&sunzilog_reg, &up[0].port); |
| 1422 | if (err) { | 1423 | if (err) { |
| @@ -1425,7 +1426,8 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m | |||
| 1425 | return err; | 1426 | return err; |
| 1426 | } | 1427 | } |
| 1427 | if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, | 1428 | if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, |
| 1428 | &sunzilog_reg, up[1].port.line)) | 1429 | &sunzilog_reg, up[1].port.line, |
| 1430 | false)) | ||
| 1429 | up->flags |= SUNZILOG_FLAG_IS_CONS; | 1431 | up->flags |= SUNZILOG_FLAG_IS_CONS; |
| 1430 | err = uart_add_one_port(&sunzilog_reg, &up[1].port); | 1432 | err = uart_add_one_port(&sunzilog_reg, &up[1].port); |
| 1431 | if (err) { | 1433 | if (err) { |
diff --git a/drivers/spi/spi_stmp.c b/drivers/spi/spi_stmp.c index d871dc23909c..2552bb364005 100644 --- a/drivers/spi/spi_stmp.c +++ b/drivers/spi/spi_stmp.c | |||
| @@ -242,7 +242,7 @@ static int stmp_spi_txrx_dma(struct stmp_spi *ss, int cs, | |||
| 242 | wait_for_completion(&ss->done); | 242 | wait_for_completion(&ss->done); |
| 243 | 243 | ||
| 244 | if (!busy_wait(readl(ss->regs + HW_SSP_CTRL0) & BM_SSP_CTRL0_RUN)) | 244 | if (!busy_wait(readl(ss->regs + HW_SSP_CTRL0) & BM_SSP_CTRL0_RUN)) |
| 245 | status = ETIMEDOUT; | 245 | status = -ETIMEDOUT; |
| 246 | 246 | ||
| 247 | if (!dma_buf) | 247 | if (!dma_buf) |
| 248 | dma_unmap_single(ss->master_dev, spi_buf_dma, len, dir); | 248 | dma_unmap_single(ss->master_dev, spi_buf_dma, len, dir); |
diff --git a/drivers/spi/spi_txx9.c b/drivers/spi/spi_txx9.c index 96057de133ad..19f75627c3de 100644 --- a/drivers/spi/spi_txx9.c +++ b/drivers/spi/spi_txx9.c | |||
| @@ -29,6 +29,8 @@ | |||
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | #define SPI_FIFO_SIZE 4 | 31 | #define SPI_FIFO_SIZE 4 |
| 32 | #define SPI_MAX_DIVIDER 0xff /* Max. value for SPCR1.SER */ | ||
| 33 | #define SPI_MIN_DIVIDER 1 /* Min. value for SPCR1.SER */ | ||
| 32 | 34 | ||
| 33 | #define TXx9_SPMCR 0x00 | 35 | #define TXx9_SPMCR 0x00 |
| 34 | #define TXx9_SPCR0 0x04 | 36 | #define TXx9_SPCR0 0x04 |
| @@ -193,11 +195,8 @@ static void txx9spi_work_one(struct txx9spi *c, struct spi_message *m) | |||
| 193 | 195 | ||
| 194 | if (prev_speed_hz != speed_hz | 196 | if (prev_speed_hz != speed_hz |
| 195 | || prev_bits_per_word != bits_per_word) { | 197 | || prev_bits_per_word != bits_per_word) { |
| 196 | u32 n = (c->baseclk + speed_hz - 1) / speed_hz; | 198 | int n = DIV_ROUND_UP(c->baseclk, speed_hz) - 1; |
| 197 | if (n < 1) | 199 | n = clamp(n, SPI_MIN_DIVIDER, SPI_MAX_DIVIDER); |
| 198 | n = 1; | ||
| 199 | else if (n > 0xff) | ||
| 200 | n = 0xff; | ||
| 201 | /* enter config mode */ | 200 | /* enter config mode */ |
| 202 | txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, | 201 | txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, |
| 203 | TXx9_SPMCR); | 202 | TXx9_SPMCR); |
| @@ -370,8 +369,8 @@ static int __init txx9spi_probe(struct platform_device *dev) | |||
| 370 | goto exit; | 369 | goto exit; |
| 371 | } | 370 | } |
| 372 | c->baseclk = clk_get_rate(c->clk); | 371 | c->baseclk = clk_get_rate(c->clk); |
| 373 | c->min_speed_hz = (c->baseclk + 0xff - 1) / 0xff; | 372 | c->min_speed_hz = DIV_ROUND_UP(c->baseclk, SPI_MAX_DIVIDER + 1); |
| 374 | c->max_speed_hz = c->baseclk; | 373 | c->max_speed_hz = c->baseclk / (SPI_MIN_DIVIDER + 1); |
| 375 | 374 | ||
| 376 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | 375 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
| 377 | if (!res) | 376 | if (!res) |
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index 100e7a5c5ea1..e72f4046a5e0 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c | |||
| @@ -617,136 +617,140 @@ static int ssb_pcmcia_sprom_check_crc(const u16 *sprom, size_t size) | |||
| 617 | } \ | 617 | } \ |
| 618 | } while (0) | 618 | } while (0) |
| 619 | 619 | ||
| 620 | int ssb_pcmcia_get_invariants(struct ssb_bus *bus, | 620 | static int ssb_pcmcia_get_mac(struct pcmcia_device *p_dev, |
| 621 | struct ssb_init_invariants *iv) | 621 | tuple_t *tuple, |
| 622 | void *priv) | ||
| 622 | { | 623 | { |
| 623 | tuple_t tuple; | 624 | struct ssb_sprom *sprom = priv; |
| 624 | int res; | 625 | |
| 625 | unsigned char buf[32]; | 626 | if (tuple->TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID) |
| 627 | return -EINVAL; | ||
| 628 | if (tuple->TupleDataLen != ETH_ALEN + 2) | ||
| 629 | return -EINVAL; | ||
| 630 | if (tuple->TupleData[1] != ETH_ALEN) | ||
| 631 | return -EINVAL; | ||
| 632 | memcpy(sprom->il0mac, &tuple->TupleData[2], ETH_ALEN); | ||
| 633 | return 0; | ||
| 634 | }; | ||
| 635 | |||
| 636 | static int ssb_pcmcia_do_get_invariants(struct pcmcia_device *p_dev, | ||
| 637 | tuple_t *tuple, | ||
| 638 | void *priv) | ||
| 639 | { | ||
| 640 | struct ssb_init_invariants *iv = priv; | ||
| 626 | struct ssb_sprom *sprom = &iv->sprom; | 641 | struct ssb_sprom *sprom = &iv->sprom; |
| 627 | struct ssb_boardinfo *bi = &iv->boardinfo; | 642 | struct ssb_boardinfo *bi = &iv->boardinfo; |
| 628 | const char *error_description; | 643 | const char *error_description; |
| 629 | 644 | ||
| 645 | GOTO_ERROR_ON(tuple->TupleDataLen < 1, "VEN tpl < 1"); | ||
| 646 | switch (tuple->TupleData[0]) { | ||
| 647 | case SSB_PCMCIA_CIS_ID: | ||
| 648 | GOTO_ERROR_ON((tuple->TupleDataLen != 5) && | ||
| 649 | (tuple->TupleDataLen != 7), | ||
| 650 | "id tpl size"); | ||
| 651 | bi->vendor = tuple->TupleData[1] | | ||
| 652 | ((u16)tuple->TupleData[2] << 8); | ||
| 653 | break; | ||
| 654 | case SSB_PCMCIA_CIS_BOARDREV: | ||
| 655 | GOTO_ERROR_ON(tuple->TupleDataLen != 2, | ||
| 656 | "boardrev tpl size"); | ||
| 657 | sprom->board_rev = tuple->TupleData[1]; | ||
| 658 | break; | ||
| 659 | case SSB_PCMCIA_CIS_PA: | ||
| 660 | GOTO_ERROR_ON((tuple->TupleDataLen != 9) && | ||
| 661 | (tuple->TupleDataLen != 10), | ||
| 662 | "pa tpl size"); | ||
| 663 | sprom->pa0b0 = tuple->TupleData[1] | | ||
| 664 | ((u16)tuple->TupleData[2] << 8); | ||
| 665 | sprom->pa0b1 = tuple->TupleData[3] | | ||
| 666 | ((u16)tuple->TupleData[4] << 8); | ||
| 667 | sprom->pa0b2 = tuple->TupleData[5] | | ||
| 668 | ((u16)tuple->TupleData[6] << 8); | ||
| 669 | sprom->itssi_a = tuple->TupleData[7]; | ||
| 670 | sprom->itssi_bg = tuple->TupleData[7]; | ||
| 671 | sprom->maxpwr_a = tuple->TupleData[8]; | ||
| 672 | sprom->maxpwr_bg = tuple->TupleData[8]; | ||
| 673 | break; | ||
| 674 | case SSB_PCMCIA_CIS_OEMNAME: | ||
| 675 | /* We ignore this. */ | ||
| 676 | break; | ||
| 677 | case SSB_PCMCIA_CIS_CCODE: | ||
| 678 | GOTO_ERROR_ON(tuple->TupleDataLen != 2, | ||
| 679 | "ccode tpl size"); | ||
| 680 | sprom->country_code = tuple->TupleData[1]; | ||
| 681 | break; | ||
| 682 | case SSB_PCMCIA_CIS_ANTENNA: | ||
| 683 | GOTO_ERROR_ON(tuple->TupleDataLen != 2, | ||
| 684 | "ant tpl size"); | ||
| 685 | sprom->ant_available_a = tuple->TupleData[1]; | ||
| 686 | sprom->ant_available_bg = tuple->TupleData[1]; | ||
| 687 | break; | ||
| 688 | case SSB_PCMCIA_CIS_ANTGAIN: | ||
| 689 | GOTO_ERROR_ON(tuple->TupleDataLen != 2, | ||
| 690 | "antg tpl size"); | ||
| 691 | sprom->antenna_gain.ghz24.a0 = tuple->TupleData[1]; | ||
| 692 | sprom->antenna_gain.ghz24.a1 = tuple->TupleData[1]; | ||
| 693 | sprom->antenna_gain.ghz24.a2 = tuple->TupleData[1]; | ||
| 694 | sprom->antenna_gain.ghz24.a3 = tuple->TupleData[1]; | ||
| 695 | sprom->antenna_gain.ghz5.a0 = tuple->TupleData[1]; | ||
| 696 | sprom->antenna_gain.ghz5.a1 = tuple->TupleData[1]; | ||
| 697 | sprom->antenna_gain.ghz5.a2 = tuple->TupleData[1]; | ||
| 698 | sprom->antenna_gain.ghz5.a3 = tuple->TupleData[1]; | ||
| 699 | break; | ||
| 700 | case SSB_PCMCIA_CIS_BFLAGS: | ||
| 701 | GOTO_ERROR_ON((tuple->TupleDataLen != 3) && | ||
| 702 | (tuple->TupleDataLen != 5), | ||
| 703 | "bfl tpl size"); | ||
| 704 | sprom->boardflags_lo = tuple->TupleData[1] | | ||
| 705 | ((u16)tuple->TupleData[2] << 8); | ||
| 706 | break; | ||
| 707 | case SSB_PCMCIA_CIS_LEDS: | ||
| 708 | GOTO_ERROR_ON(tuple->TupleDataLen != 5, | ||
| 709 | "leds tpl size"); | ||
| 710 | sprom->gpio0 = tuple->TupleData[1]; | ||
| 711 | sprom->gpio1 = tuple->TupleData[2]; | ||
| 712 | sprom->gpio2 = tuple->TupleData[3]; | ||
| 713 | sprom->gpio3 = tuple->TupleData[4]; | ||
| 714 | break; | ||
| 715 | } | ||
| 716 | return -ENOSPC; /* continue with next entry */ | ||
| 717 | |||
| 718 | error: | ||
| 719 | ssb_printk(KERN_ERR PFX | ||
| 720 | "PCMCIA: Failed to fetch device invariants: %s\n", | ||
| 721 | error_description); | ||
| 722 | return -ENODEV; | ||
| 723 | } | ||
| 724 | |||
| 725 | |||
| 726 | int ssb_pcmcia_get_invariants(struct ssb_bus *bus, | ||
| 727 | struct ssb_init_invariants *iv) | ||
| 728 | { | ||
| 729 | struct ssb_sprom *sprom = &iv->sprom; | ||
| 730 | int res; | ||
| 731 | |||
| 630 | memset(sprom, 0xFF, sizeof(*sprom)); | 732 | memset(sprom, 0xFF, sizeof(*sprom)); |
| 631 | sprom->revision = 1; | 733 | sprom->revision = 1; |
| 632 | sprom->boardflags_lo = 0; | 734 | sprom->boardflags_lo = 0; |
| 633 | sprom->boardflags_hi = 0; | 735 | sprom->boardflags_hi = 0; |
| 634 | 736 | ||
| 635 | /* First fetch the MAC address. */ | 737 | /* First fetch the MAC address. */ |
| 636 | memset(&tuple, 0, sizeof(tuple)); | 738 | res = pcmcia_loop_tuple(bus->host_pcmcia, CISTPL_FUNCE, |
| 637 | tuple.DesiredTuple = CISTPL_FUNCE; | 739 | ssb_pcmcia_get_mac, sprom); |
| 638 | tuple.TupleData = buf; | 740 | if (res != 0) { |
| 639 | tuple.TupleDataMax = sizeof(buf); | 741 | ssb_printk(KERN_ERR PFX |
| 640 | res = pcmcia_get_first_tuple(bus->host_pcmcia, &tuple); | 742 | "PCMCIA: Failed to fetch MAC address\n"); |
| 641 | GOTO_ERROR_ON(res != 0, "MAC first tpl"); | 743 | return -ENODEV; |
| 642 | res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); | ||
| 643 | GOTO_ERROR_ON(res != 0, "MAC first tpl data"); | ||
| 644 | while (1) { | ||
| 645 | GOTO_ERROR_ON(tuple.TupleDataLen < 1, "MAC tpl < 1"); | ||
| 646 | if (tuple.TupleData[0] == CISTPL_FUNCE_LAN_NODE_ID) | ||
| 647 | break; | ||
| 648 | res = pcmcia_get_next_tuple(bus->host_pcmcia, &tuple); | ||
| 649 | GOTO_ERROR_ON(res != 0, "MAC next tpl"); | ||
| 650 | res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); | ||
| 651 | GOTO_ERROR_ON(res != 0, "MAC next tpl data"); | ||
| 652 | } | 744 | } |
| 653 | GOTO_ERROR_ON(tuple.TupleDataLen != ETH_ALEN + 2, "MAC tpl size"); | ||
| 654 | memcpy(sprom->il0mac, &tuple.TupleData[2], ETH_ALEN); | ||
| 655 | 745 | ||
| 656 | /* Fetch the vendor specific tuples. */ | 746 | /* Fetch the vendor specific tuples. */ |
| 657 | memset(&tuple, 0, sizeof(tuple)); | 747 | res = pcmcia_loop_tuple(bus->host_pcmcia, SSB_PCMCIA_CIS, |
| 658 | tuple.DesiredTuple = SSB_PCMCIA_CIS; | 748 | ssb_pcmcia_do_get_invariants, sprom); |
| 659 | tuple.TupleData = buf; | 749 | if ((res == 0) || (res == -ENOSPC)) |
| 660 | tuple.TupleDataMax = sizeof(buf); | 750 | return 0; |
| 661 | res = pcmcia_get_first_tuple(bus->host_pcmcia, &tuple); | ||
| 662 | GOTO_ERROR_ON(res != 0, "VEN first tpl"); | ||
| 663 | res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); | ||
| 664 | GOTO_ERROR_ON(res != 0, "VEN first tpl data"); | ||
| 665 | while (1) { | ||
| 666 | GOTO_ERROR_ON(tuple.TupleDataLen < 1, "VEN tpl < 1"); | ||
| 667 | switch (tuple.TupleData[0]) { | ||
| 668 | case SSB_PCMCIA_CIS_ID: | ||
| 669 | GOTO_ERROR_ON((tuple.TupleDataLen != 5) && | ||
| 670 | (tuple.TupleDataLen != 7), | ||
| 671 | "id tpl size"); | ||
| 672 | bi->vendor = tuple.TupleData[1] | | ||
| 673 | ((u16)tuple.TupleData[2] << 8); | ||
| 674 | break; | ||
| 675 | case SSB_PCMCIA_CIS_BOARDREV: | ||
| 676 | GOTO_ERROR_ON(tuple.TupleDataLen != 2, | ||
| 677 | "boardrev tpl size"); | ||
| 678 | sprom->board_rev = tuple.TupleData[1]; | ||
| 679 | break; | ||
| 680 | case SSB_PCMCIA_CIS_PA: | ||
| 681 | GOTO_ERROR_ON((tuple.TupleDataLen != 9) && | ||
| 682 | (tuple.TupleDataLen != 10), | ||
| 683 | "pa tpl size"); | ||
| 684 | sprom->pa0b0 = tuple.TupleData[1] | | ||
| 685 | ((u16)tuple.TupleData[2] << 8); | ||
| 686 | sprom->pa0b1 = tuple.TupleData[3] | | ||
| 687 | ((u16)tuple.TupleData[4] << 8); | ||
| 688 | sprom->pa0b2 = tuple.TupleData[5] | | ||
| 689 | ((u16)tuple.TupleData[6] << 8); | ||
| 690 | sprom->itssi_a = tuple.TupleData[7]; | ||
| 691 | sprom->itssi_bg = tuple.TupleData[7]; | ||
| 692 | sprom->maxpwr_a = tuple.TupleData[8]; | ||
| 693 | sprom->maxpwr_bg = tuple.TupleData[8]; | ||
| 694 | break; | ||
| 695 | case SSB_PCMCIA_CIS_OEMNAME: | ||
| 696 | /* We ignore this. */ | ||
| 697 | break; | ||
| 698 | case SSB_PCMCIA_CIS_CCODE: | ||
| 699 | GOTO_ERROR_ON(tuple.TupleDataLen != 2, | ||
| 700 | "ccode tpl size"); | ||
| 701 | sprom->country_code = tuple.TupleData[1]; | ||
| 702 | break; | ||
| 703 | case SSB_PCMCIA_CIS_ANTENNA: | ||
| 704 | GOTO_ERROR_ON(tuple.TupleDataLen != 2, | ||
| 705 | "ant tpl size"); | ||
| 706 | sprom->ant_available_a = tuple.TupleData[1]; | ||
| 707 | sprom->ant_available_bg = tuple.TupleData[1]; | ||
| 708 | break; | ||
| 709 | case SSB_PCMCIA_CIS_ANTGAIN: | ||
| 710 | GOTO_ERROR_ON(tuple.TupleDataLen != 2, | ||
| 711 | "antg tpl size"); | ||
| 712 | sprom->antenna_gain.ghz24.a0 = tuple.TupleData[1]; | ||
| 713 | sprom->antenna_gain.ghz24.a1 = tuple.TupleData[1]; | ||
| 714 | sprom->antenna_gain.ghz24.a2 = tuple.TupleData[1]; | ||
| 715 | sprom->antenna_gain.ghz24.a3 = tuple.TupleData[1]; | ||
| 716 | sprom->antenna_gain.ghz5.a0 = tuple.TupleData[1]; | ||
| 717 | sprom->antenna_gain.ghz5.a1 = tuple.TupleData[1]; | ||
| 718 | sprom->antenna_gain.ghz5.a2 = tuple.TupleData[1]; | ||
| 719 | sprom->antenna_gain.ghz5.a3 = tuple.TupleData[1]; | ||
| 720 | break; | ||
| 721 | case SSB_PCMCIA_CIS_BFLAGS: | ||
| 722 | GOTO_ERROR_ON((tuple.TupleDataLen != 3) && | ||
| 723 | (tuple.TupleDataLen != 5), | ||
| 724 | "bfl tpl size"); | ||
| 725 | sprom->boardflags_lo = tuple.TupleData[1] | | ||
| 726 | ((u16)tuple.TupleData[2] << 8); | ||
| 727 | break; | ||
| 728 | case SSB_PCMCIA_CIS_LEDS: | ||
| 729 | GOTO_ERROR_ON(tuple.TupleDataLen != 5, | ||
| 730 | "leds tpl size"); | ||
| 731 | sprom->gpio0 = tuple.TupleData[1]; | ||
| 732 | sprom->gpio1 = tuple.TupleData[2]; | ||
| 733 | sprom->gpio2 = tuple.TupleData[3]; | ||
| 734 | sprom->gpio3 = tuple.TupleData[4]; | ||
| 735 | break; | ||
| 736 | } | ||
| 737 | res = pcmcia_get_next_tuple(bus->host_pcmcia, &tuple); | ||
| 738 | if (res == -ENOSPC) | ||
| 739 | break; | ||
| 740 | GOTO_ERROR_ON(res != 0, "VEN next tpl"); | ||
| 741 | res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); | ||
| 742 | GOTO_ERROR_ON(res != 0, "VEN next tpl data"); | ||
| 743 | } | ||
| 744 | 751 | ||
| 745 | return 0; | ||
| 746 | error: | ||
| 747 | ssb_printk(KERN_ERR PFX | 752 | ssb_printk(KERN_ERR PFX |
| 748 | "PCMCIA: Failed to fetch device invariants: %s\n", | 753 | "PCMCIA: Failed to fetch device invariants\n"); |
| 749 | error_description); | ||
| 750 | return -ENODEV; | 754 | return -ENODEV; |
| 751 | } | 755 | } |
| 752 | 756 | ||
diff --git a/drivers/ssb/scan.c b/drivers/ssb/scan.c index b74212d698c7..e8b89e8ac9bd 100644 --- a/drivers/ssb/scan.c +++ b/drivers/ssb/scan.c | |||
| @@ -162,6 +162,8 @@ static u8 chipid_to_nrcores(u16 chipid) | |||
| 162 | static u32 scan_read32(struct ssb_bus *bus, u8 current_coreidx, | 162 | static u32 scan_read32(struct ssb_bus *bus, u8 current_coreidx, |
| 163 | u16 offset) | 163 | u16 offset) |
| 164 | { | 164 | { |
| 165 | u32 lo, hi; | ||
| 166 | |||
| 165 | switch (bus->bustype) { | 167 | switch (bus->bustype) { |
| 166 | case SSB_BUSTYPE_SSB: | 168 | case SSB_BUSTYPE_SSB: |
| 167 | offset += current_coreidx * SSB_CORE_SIZE; | 169 | offset += current_coreidx * SSB_CORE_SIZE; |
| @@ -174,7 +176,9 @@ static u32 scan_read32(struct ssb_bus *bus, u8 current_coreidx, | |||
| 174 | offset -= 0x800; | 176 | offset -= 0x800; |
| 175 | } else | 177 | } else |
| 176 | ssb_pcmcia_switch_segment(bus, 0); | 178 | ssb_pcmcia_switch_segment(bus, 0); |
| 177 | break; | 179 | lo = readw(bus->mmio + offset); |
| 180 | hi = readw(bus->mmio + offset + 2); | ||
| 181 | return lo | (hi << 16); | ||
| 178 | case SSB_BUSTYPE_SDIO: | 182 | case SSB_BUSTYPE_SDIO: |
| 179 | offset += current_coreidx * SSB_CORE_SIZE; | 183 | offset += current_coreidx * SSB_CORE_SIZE; |
| 180 | return ssb_sdio_scan_read32(bus, offset); | 184 | return ssb_sdio_scan_read32(bus, offset); |
diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 80c0df8656f3..39923cb388be 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c | |||
| @@ -141,37 +141,14 @@ static int das16cs_timer_insn_config(struct comedi_device *dev, | |||
| 141 | struct comedi_insn *insn, | 141 | struct comedi_insn *insn, |
| 142 | unsigned int *data); | 142 | unsigned int *data); |
| 143 | 143 | ||
| 144 | static int get_prodid(struct comedi_device *dev, struct pcmcia_device *link) | ||
| 145 | { | ||
| 146 | tuple_t tuple; | ||
| 147 | u_short buf[128]; | ||
| 148 | int prodid = 0; | ||
| 149 | |||
| 150 | tuple.TupleData = (cisdata_t *) buf; | ||
| 151 | tuple.TupleOffset = 0; | ||
| 152 | tuple.TupleDataMax = 255; | ||
| 153 | tuple.DesiredTuple = CISTPL_MANFID; | ||
| 154 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
| 155 | if ((pcmcia_get_first_tuple(link, &tuple) == 0) && | ||
| 156 | (pcmcia_get_tuple_data(link, &tuple) == 0)) { | ||
| 157 | prodid = le16_to_cpu(buf[1]); | ||
| 158 | } | ||
| 159 | |||
| 160 | return prodid; | ||
| 161 | } | ||
| 162 | |||
| 163 | static const struct das16cs_board *das16cs_probe(struct comedi_device *dev, | 144 | static const struct das16cs_board *das16cs_probe(struct comedi_device *dev, |
| 164 | struct pcmcia_device *link) | 145 | struct pcmcia_device *link) |
| 165 | { | 146 | { |
| 166 | int id; | ||
| 167 | int i; | 147 | int i; |
| 168 | 148 | ||
| 169 | id = get_prodid(dev, link); | ||
| 170 | |||
| 171 | for (i = 0; i < n_boards; i++) { | 149 | for (i = 0; i < n_boards; i++) { |
| 172 | if (das16cs_boards[i].device_id == id) { | 150 | if (das16cs_boards[i].device_id == link->card_id) |
| 173 | return das16cs_boards + i; | 151 | return das16cs_boards + i; |
| 174 | } | ||
| 175 | } | 152 | } |
| 176 | 153 | ||
| 177 | printk("unknown board!\n"); | 154 | printk("unknown board!\n"); |
| @@ -660,27 +637,8 @@ static int das16cs_timer_insn_config(struct comedi_device *dev, | |||
| 660 | 637 | ||
| 661 | ======================================================================*/ | 638 | ======================================================================*/ |
| 662 | 639 | ||
| 663 | /* | ||
| 664 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 665 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 666 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 667 | be present but disabled -- but it can then be enabled for specific | ||
| 668 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 669 | */ | ||
| 670 | #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) | 640 | #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) |
| 671 | 641 | ||
| 672 | #ifdef PCMCIA_DEBUG | ||
| 673 | static int pc_debug = PCMCIA_DEBUG; | ||
| 674 | module_param(pc_debug, int, 0644); | ||
| 675 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 676 | static char *version = | ||
| 677 | "cb_das16_cs.c pcmcia code (David Schleef), modified from dummy_cs.c 1.31 2001/08/24 12:13:13 (David Hinds)"; | ||
| 678 | #else | ||
| 679 | #define DEBUG(n, args...) | ||
| 680 | #endif | ||
| 681 | |||
| 682 | /*====================================================================*/ | ||
| 683 | |||
| 684 | static void das16cs_pcmcia_config(struct pcmcia_device *link); | 642 | static void das16cs_pcmcia_config(struct pcmcia_device *link); |
| 685 | static void das16cs_pcmcia_release(struct pcmcia_device *link); | 643 | static void das16cs_pcmcia_release(struct pcmcia_device *link); |
| 686 | static int das16cs_pcmcia_suspend(struct pcmcia_device *p_dev); | 644 | static int das16cs_pcmcia_suspend(struct pcmcia_device *p_dev); |
| @@ -733,7 +691,7 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link) | |||
| 733 | { | 691 | { |
| 734 | struct local_info_t *local; | 692 | struct local_info_t *local; |
| 735 | 693 | ||
| 736 | DEBUG(0, "das16cs_pcmcia_attach()\n"); | 694 | dev_dbg(&link->dev, "das16cs_pcmcia_attach()\n"); |
| 737 | 695 | ||
| 738 | /* Allocate space for private device-specific data */ | 696 | /* Allocate space for private device-specific data */ |
| 739 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); | 697 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); |
| @@ -745,7 +703,6 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link) | |||
| 745 | /* Initialize the pcmcia_device structure */ | 703 | /* Initialize the pcmcia_device structure */ |
| 746 | /* Interrupt setup */ | 704 | /* Interrupt setup */ |
| 747 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 705 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 748 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 749 | link->irq.Handler = NULL; | 706 | link->irq.Handler = NULL; |
| 750 | 707 | ||
| 751 | link->conf.Attributes = 0; | 708 | link->conf.Attributes = 0; |
| @@ -760,7 +717,7 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link) | |||
| 760 | 717 | ||
| 761 | static void das16cs_pcmcia_detach(struct pcmcia_device *link) | 718 | static void das16cs_pcmcia_detach(struct pcmcia_device *link) |
| 762 | { | 719 | { |
| 763 | DEBUG(0, "das16cs_pcmcia_detach(0x%p)\n", link); | 720 | dev_dbg(&link->dev, "das16cs_pcmcia_detach\n"); |
| 764 | 721 | ||
| 765 | if (link->dev_node) { | 722 | if (link->dev_node) { |
| 766 | ((struct local_info_t *)link->priv)->stop = 1; | 723 | ((struct local_info_t *)link->priv)->stop = 1; |
| @@ -771,118 +728,55 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) | |||
| 771 | kfree(link->priv); | 728 | kfree(link->priv); |
| 772 | } /* das16cs_pcmcia_detach */ | 729 | } /* das16cs_pcmcia_detach */ |
| 773 | 730 | ||
| 774 | static void das16cs_pcmcia_config(struct pcmcia_device *link) | ||
| 775 | { | ||
| 776 | struct local_info_t *dev = link->priv; | ||
| 777 | tuple_t tuple; | ||
| 778 | cisparse_t parse; | ||
| 779 | int last_fn, last_ret; | ||
| 780 | u_char buf[64]; | ||
| 781 | cistpl_cftable_entry_t dflt = { 0 }; | ||
| 782 | 731 | ||
| 783 | DEBUG(0, "das16cs_pcmcia_config(0x%p)\n", link); | 732 | static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 784 | 733 | cistpl_cftable_entry_t *cfg, | |
| 785 | /* | 734 | cistpl_cftable_entry_t *dflt, |
| 786 | This reads the card's CONFIG tuple to find its configuration | 735 | unsigned int vcc, |
| 787 | registers. | 736 | void *priv_data) |
| 788 | */ | 737 | { |
| 789 | tuple.DesiredTuple = CISTPL_CONFIG; | 738 | if (cfg->index == 0) |
| 790 | tuple.Attributes = 0; | 739 | return -EINVAL; |
| 791 | tuple.TupleData = buf; | ||
| 792 | tuple.TupleDataMax = sizeof(buf); | ||
| 793 | tuple.TupleOffset = 0; | ||
| 794 | |||
| 795 | last_fn = GetFirstTuple; | ||
| 796 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 797 | if (last_ret != 0) | ||
| 798 | goto cs_failed; | ||
| 799 | |||
| 800 | last_fn = GetTupleData; | ||
| 801 | last_ret = pcmcia_get_tuple_data(link, &tuple); | ||
| 802 | if (last_ret != 0) | ||
| 803 | goto cs_failed; | ||
| 804 | |||
| 805 | last_fn = ParseTuple; | ||
| 806 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 807 | if (last_ret != 0) | ||
| 808 | goto cs_failed; | ||
| 809 | |||
| 810 | link->conf.ConfigBase = parse.config.base; | ||
| 811 | link->conf.Present = parse.config.rmask[0]; | ||
| 812 | 740 | ||
| 813 | /* | 741 | /* Do we need to allocate an interrupt? */ |
| 814 | In this loop, we scan the CIS for configuration table entries, | 742 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) |
| 815 | each of which describes a valid card configuration, including | 743 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
| 816 | voltage, IO window, memory window, and interrupt settings. | 744 | |
| 817 | 745 | /* IO window settings */ | |
| 818 | We make no assumptions about the card to be configured: we use | 746 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; |
| 819 | just the information available in the CIS. In an ideal world, | 747 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
| 820 | this would work for any PCMCIA card, but it requires a complete | 748 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
| 821 | and accurate CIS. In practice, a driver usually "knows" most of | 749 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
| 822 | these things without consulting the CIS, and most client drivers | 750 | if (!(io->flags & CISTPL_IO_8BIT)) |
| 823 | will only use the CIS to fill in implementation-defined details. | 751 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
| 824 | */ | 752 | if (!(io->flags & CISTPL_IO_16BIT)) |
| 825 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 753 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 826 | last_fn = GetFirstTuple; | 754 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; |
| 827 | 755 | p_dev->io.BasePort1 = io->win[0].base; | |
| 828 | last_ret = pcmcia_get_first_tuple(link, &tuple); | 756 | p_dev->io.NumPorts1 = io->win[0].len; |
| 829 | if (last_ret) | 757 | if (io->nwin > 1) { |
| 830 | goto cs_failed; | 758 | p_dev->io.Attributes2 = p_dev->io.Attributes1; |
| 831 | 759 | p_dev->io.BasePort2 = io->win[1].base; | |
| 832 | while (1) { | 760 | p_dev->io.NumPorts2 = io->win[1].len; |
| 833 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
| 834 | if (pcmcia_get_tuple_data(link, &tuple)) | ||
| 835 | goto next_entry; | ||
| 836 | if (pcmcia_parse_tuple(&tuple, &parse)) | ||
| 837 | goto next_entry; | ||
| 838 | |||
| 839 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 840 | dflt = *cfg; | ||
| 841 | if (cfg->index == 0) | ||
| 842 | goto next_entry; | ||
| 843 | link->conf.ConfigIndex = cfg->index; | ||
| 844 | |||
| 845 | /* Does this card need audio output? */ | ||
| 846 | /* if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
| 847 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
| 848 | link->conf.Status = CCSR_AUDIO_ENA; | ||
| 849 | } | ||
| 850 | */ | ||
| 851 | /* Do we need to allocate an interrupt? */ | ||
| 852 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | ||
| 853 | link->conf.Attributes |= CONF_ENABLE_IRQ; | ||
| 854 | |||
| 855 | /* IO window settings */ | ||
| 856 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 857 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 858 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 859 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 860 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 861 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 862 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 863 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 864 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 865 | link->io.BasePort1 = io->win[0].base; | ||
| 866 | link->io.NumPorts1 = io->win[0].len; | ||
| 867 | if (io->nwin > 1) { | ||
| 868 | link->io.Attributes2 = link->io.Attributes1; | ||
| 869 | link->io.BasePort2 = io->win[1].base; | ||
| 870 | link->io.NumPorts2 = io->win[1].len; | ||
| 871 | } | ||
| 872 | /* This reserves IO space but doesn't actually enable it */ | ||
| 873 | if (pcmcia_request_io(link, &link->io)) | ||
| 874 | goto next_entry; | ||
| 875 | } | 761 | } |
| 762 | /* This reserves IO space but doesn't actually enable it */ | ||
| 763 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
| 764 | } | ||
| 876 | 765 | ||
| 877 | /* If we got this far, we're cool! */ | 766 | return 0; |
| 878 | break; | 767 | } |
| 768 | |||
| 769 | static void das16cs_pcmcia_config(struct pcmcia_device *link) | ||
| 770 | { | ||
| 771 | struct local_info_t *dev = link->priv; | ||
| 772 | int ret; | ||
| 879 | 773 | ||
| 880 | next_entry: | 774 | dev_dbg(&link->dev, "das16cs_pcmcia_config\n"); |
| 881 | last_fn = GetNextTuple; | ||
| 882 | 775 | ||
| 883 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 776 | ret = pcmcia_loop_config(link, das16cs_pcmcia_config_loop, NULL); |
| 884 | if (last_ret) | 777 | if (ret) { |
| 885 | goto cs_failed; | 778 | dev_warn(&link->dev, "no configuration found\n"); |
| 779 | goto failed; | ||
| 886 | } | 780 | } |
| 887 | 781 | ||
| 888 | /* | 782 | /* |
| @@ -891,21 +785,18 @@ next_entry: | |||
| 891 | irq structure is initialized. | 785 | irq structure is initialized. |
| 892 | */ | 786 | */ |
| 893 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 787 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 894 | last_fn = RequestIRQ; | 788 | ret = pcmcia_request_irq(link, &link->irq); |
| 895 | 789 | if (ret) | |
| 896 | last_ret = pcmcia_request_irq(link, &link->irq); | 790 | goto failed; |
| 897 | if (last_ret) | ||
| 898 | goto cs_failed; | ||
| 899 | } | 791 | } |
| 900 | /* | 792 | /* |
| 901 | This actually configures the PCMCIA socket -- setting up | 793 | This actually configures the PCMCIA socket -- setting up |
| 902 | the I/O windows and the interrupt mapping, and putting the | 794 | the I/O windows and the interrupt mapping, and putting the |
| 903 | card and host interface into "Memory and IO" mode. | 795 | card and host interface into "Memory and IO" mode. |
| 904 | */ | 796 | */ |
| 905 | last_fn = RequestConfiguration; | 797 | ret = pcmcia_request_configuration(link, &link->conf); |
| 906 | last_ret = pcmcia_request_configuration(link, &link->conf); | 798 | if (ret) |
| 907 | if (last_ret) | 799 | goto failed; |
| 908 | goto cs_failed; | ||
| 909 | 800 | ||
| 910 | /* | 801 | /* |
| 911 | At this point, the dev_node_t structure(s) need to be | 802 | At this point, the dev_node_t structure(s) need to be |
| @@ -930,14 +821,13 @@ next_entry: | |||
| 930 | 821 | ||
| 931 | return; | 822 | return; |
| 932 | 823 | ||
| 933 | cs_failed: | 824 | failed: |
| 934 | cs_error(link, last_fn, last_ret); | ||
| 935 | das16cs_pcmcia_release(link); | 825 | das16cs_pcmcia_release(link); |
| 936 | } /* das16cs_pcmcia_config */ | 826 | } /* das16cs_pcmcia_config */ |
| 937 | 827 | ||
| 938 | static void das16cs_pcmcia_release(struct pcmcia_device *link) | 828 | static void das16cs_pcmcia_release(struct pcmcia_device *link) |
| 939 | { | 829 | { |
| 940 | DEBUG(0, "das16cs_pcmcia_release(0x%p)\n", link); | 830 | dev_dbg(&link->dev, "das16cs_pcmcia_release\n"); |
| 941 | pcmcia_disable_device(link); | 831 | pcmcia_disable_device(link); |
| 942 | } /* das16cs_pcmcia_release */ | 832 | } /* das16cs_pcmcia_release */ |
| 943 | 833 | ||
| @@ -983,14 +873,13 @@ struct pcmcia_driver das16cs_driver = { | |||
| 983 | 873 | ||
| 984 | static int __init init_das16cs_pcmcia_cs(void) | 874 | static int __init init_das16cs_pcmcia_cs(void) |
| 985 | { | 875 | { |
| 986 | DEBUG(0, "%s\n", version); | ||
| 987 | pcmcia_register_driver(&das16cs_driver); | 876 | pcmcia_register_driver(&das16cs_driver); |
| 988 | return 0; | 877 | return 0; |
| 989 | } | 878 | } |
| 990 | 879 | ||
| 991 | static void __exit exit_das16cs_pcmcia_cs(void) | 880 | static void __exit exit_das16cs_pcmcia_cs(void) |
| 992 | { | 881 | { |
| 993 | DEBUG(0, "das16cs_pcmcia_cs: unloading\n"); | 882 | pr_debug("das16cs_pcmcia_cs: unloading\n"); |
| 994 | pcmcia_unregister_driver(&das16cs_driver); | 883 | pcmcia_unregister_driver(&das16cs_driver); |
| 995 | } | 884 | } |
| 996 | 885 | ||
diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 9cab21eaaa18..9b945e5fdd32 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c | |||
| @@ -110,25 +110,6 @@ static int das08_cs_attach(struct comedi_device *dev, | |||
| 110 | 110 | ||
| 111 | ======================================================================*/ | 111 | ======================================================================*/ |
| 112 | 112 | ||
| 113 | /* | ||
| 114 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 115 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 116 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 117 | be present but disabled -- but it can then be enabled for specific | ||
| 118 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 119 | */ | ||
| 120 | |||
| 121 | #ifdef PCMCIA_DEBUG | ||
| 122 | static int pc_debug = PCMCIA_DEBUG; | ||
| 123 | module_param(pc_debug, int, 0644); | ||
| 124 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 125 | static const char *version = | ||
| 126 | "das08.c pcmcia code (Frank Hess), modified from dummy_cs.c 1.31 2001/08/24 12:13:13 (David Hinds)"; | ||
| 127 | #else | ||
| 128 | #define DEBUG(n, args...) | ||
| 129 | #endif | ||
| 130 | |||
| 131 | /*====================================================================*/ | ||
| 132 | static void das08_pcmcia_config(struct pcmcia_device *link); | 113 | static void das08_pcmcia_config(struct pcmcia_device *link); |
| 133 | static void das08_pcmcia_release(struct pcmcia_device *link); | 114 | static void das08_pcmcia_release(struct pcmcia_device *link); |
| 134 | static int das08_pcmcia_suspend(struct pcmcia_device *p_dev); | 115 | static int das08_pcmcia_suspend(struct pcmcia_device *p_dev); |
| @@ -181,7 +162,7 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) | |||
| 181 | { | 162 | { |
| 182 | struct local_info_t *local; | 163 | struct local_info_t *local; |
| 183 | 164 | ||
| 184 | DEBUG(0, "das08_pcmcia_attach()\n"); | 165 | dev_dbg(&link->dev, "das08_pcmcia_attach()\n"); |
| 185 | 166 | ||
| 186 | /* Allocate space for private device-specific data */ | 167 | /* Allocate space for private device-specific data */ |
| 187 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); | 168 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); |
| @@ -192,7 +173,6 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) | |||
| 192 | 173 | ||
| 193 | /* Interrupt setup */ | 174 | /* Interrupt setup */ |
| 194 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 175 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
| 195 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 196 | link->irq.Handler = NULL; | 176 | link->irq.Handler = NULL; |
| 197 | 177 | ||
| 198 | /* | 178 | /* |
| @@ -224,7 +204,7 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) | |||
| 224 | static void das08_pcmcia_detach(struct pcmcia_device *link) | 204 | static void das08_pcmcia_detach(struct pcmcia_device *link) |
| 225 | { | 205 | { |
| 226 | 206 | ||
| 227 | DEBUG(0, "das08_pcmcia_detach(0x%p)\n", link); | 207 | dev_dbg(&link->dev, "das08_pcmcia_detach\n"); |
| 228 | 208 | ||
| 229 | if (link->dev_node) { | 209 | if (link->dev_node) { |
| 230 | ((struct local_info_t *)link->priv)->stop = 1; | 210 | ((struct local_info_t *)link->priv)->stop = 1; |
| @@ -237,6 +217,44 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) | |||
| 237 | 217 | ||
| 238 | } /* das08_pcmcia_detach */ | 218 | } /* das08_pcmcia_detach */ |
| 239 | 219 | ||
| 220 | |||
| 221 | static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, | ||
| 222 | cistpl_cftable_entry_t *cfg, | ||
| 223 | cistpl_cftable_entry_t *dflt, | ||
| 224 | unsigned int vcc, | ||
| 225 | void *priv_data) | ||
| 226 | { | ||
| 227 | if (cfg->index == 0) | ||
| 228 | return -ENODEV; | ||
| 229 | |||
| 230 | /* Do we need to allocate an interrupt? */ | ||
| 231 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) | ||
| 232 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
| 233 | |||
| 234 | /* IO window settings */ | ||
| 235 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | ||
| 236 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
| 237 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
| 238 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 239 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 240 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 241 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 242 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 243 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 244 | p_dev->io.BasePort1 = io->win[0].base; | ||
| 245 | p_dev->io.NumPorts1 = io->win[0].len; | ||
| 246 | if (io->nwin > 1) { | ||
| 247 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | ||
| 248 | p_dev->io.BasePort2 = io->win[1].base; | ||
| 249 | p_dev->io.NumPorts2 = io->win[1].len; | ||
| 250 | } | ||
| 251 | /* This reserves IO space but doesn't actually enable it */ | ||
| 252 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
| 253 | } | ||
| 254 | return 0; | ||
| 255 | } | ||
| 256 | |||
| 257 | |||
| 240 | /*====================================================================== | 258 | /*====================================================================== |
| 241 | 259 | ||
| 242 | das08_pcmcia_config() is scheduled to run after a CARD_INSERTION event | 260 | das08_pcmcia_config() is scheduled to run after a CARD_INSERTION event |
| @@ -248,128 +266,20 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) | |||
| 248 | static void das08_pcmcia_config(struct pcmcia_device *link) | 266 | static void das08_pcmcia_config(struct pcmcia_device *link) |
| 249 | { | 267 | { |
| 250 | struct local_info_t *dev = link->priv; | 268 | struct local_info_t *dev = link->priv; |
| 251 | tuple_t tuple; | 269 | int ret; |
| 252 | cisparse_t parse; | ||
| 253 | int last_fn, last_ret; | ||
| 254 | u_char buf[64]; | ||
| 255 | cistpl_cftable_entry_t dflt = { 0 }; | ||
| 256 | |||
| 257 | DEBUG(0, "das08_pcmcia_config(0x%p)\n", link); | ||
| 258 | |||
| 259 | /* | ||
| 260 | This reads the card's CONFIG tuple to find its configuration | ||
| 261 | registers. | ||
| 262 | */ | ||
| 263 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
| 264 | tuple.Attributes = 0; | ||
| 265 | tuple.TupleData = buf; | ||
| 266 | tuple.TupleDataMax = sizeof(buf); | ||
| 267 | tuple.TupleOffset = 0; | ||
| 268 | last_fn = GetFirstTuple; | ||
| 269 | |||
| 270 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 271 | if (last_ret) | ||
| 272 | goto cs_failed; | ||
| 273 | |||
| 274 | last_fn = GetTupleData; | ||
| 275 | |||
| 276 | last_ret = pcmcia_get_tuple_data(link, &tuple); | ||
| 277 | if (last_ret) | ||
| 278 | goto cs_failed; | ||
| 279 | |||
| 280 | last_fn = ParseTuple; | ||
| 281 | |||
| 282 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 283 | if (last_ret) | ||
| 284 | goto cs_failed; | ||
| 285 | |||
| 286 | link->conf.ConfigBase = parse.config.base; | ||
| 287 | link->conf.Present = parse.config.rmask[0]; | ||
| 288 | |||
| 289 | /* | ||
| 290 | In this loop, we scan the CIS for configuration table entries, | ||
| 291 | each of which describes a valid card configuration, including | ||
| 292 | voltage, IO window, memory window, and interrupt settings. | ||
| 293 | |||
| 294 | We make no assumptions about the card to be configured: we use | ||
| 295 | just the information available in the CIS. In an ideal world, | ||
| 296 | this would work for any PCMCIA card, but it requires a complete | ||
| 297 | and accurate CIS. In practice, a driver usually "knows" most of | ||
| 298 | these things without consulting the CIS, and most client drivers | ||
| 299 | will only use the CIS to fill in implementation-defined details. | ||
| 300 | */ | ||
| 301 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 302 | last_fn = GetFirstTuple; | ||
| 303 | |||
| 304 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 305 | if (last_ret) | ||
| 306 | goto cs_failed; | ||
| 307 | |||
| 308 | while (1) { | ||
| 309 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
| 310 | |||
| 311 | last_ret = pcmcia_get_tuple_data(link, &tuple); | ||
| 312 | if (last_ret) | ||
| 313 | goto next_entry; | ||
| 314 | |||
| 315 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 316 | if (last_ret) | ||
| 317 | goto next_entry; | ||
| 318 | |||
| 319 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 320 | dflt = *cfg; | ||
| 321 | if (cfg->index == 0) | ||
| 322 | goto next_entry; | ||
| 323 | link->conf.ConfigIndex = cfg->index; | ||
| 324 | |||
| 325 | /* Does this card need audio output? */ | ||
| 326 | /* if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
| 327 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
| 328 | link->conf.Status = CCSR_AUDIO_ENA; | ||
| 329 | } | ||
| 330 | */ | ||
| 331 | /* Do we need to allocate an interrupt? */ | ||
| 332 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | ||
| 333 | link->conf.Attributes |= CONF_ENABLE_IRQ; | ||
| 334 | |||
| 335 | /* IO window settings */ | ||
| 336 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 337 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 338 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 339 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 340 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 341 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 342 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 343 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 344 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 345 | link->io.BasePort1 = io->win[0].base; | ||
| 346 | link->io.NumPorts1 = io->win[0].len; | ||
| 347 | if (io->nwin > 1) { | ||
| 348 | link->io.Attributes2 = link->io.Attributes1; | ||
| 349 | link->io.BasePort2 = io->win[1].base; | ||
| 350 | link->io.NumPorts2 = io->win[1].len; | ||
| 351 | } | ||
| 352 | /* This reserves IO space but doesn't actually enable it */ | ||
| 353 | if (pcmcia_request_io(link, &link->io) != 0) | ||
| 354 | goto next_entry; | ||
| 355 | } | ||
| 356 | |||
| 357 | /* If we got this far, we're cool! */ | ||
| 358 | break; | ||
| 359 | 270 | ||
| 360 | next_entry: | 271 | dev_dbg(&link->dev, "das08_pcmcia_config\n"); |
| 361 | last_fn = GetNextTuple; | ||
| 362 | 272 | ||
| 363 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 273 | ret = pcmcia_loop_config(link, das08_pcmcia_config_loop, NULL); |
| 364 | if (last_ret) | 274 | if (ret) { |
| 365 | goto cs_failed; | 275 | dev_warn(&link->dev, "no configuration found\n"); |
| 276 | goto failed; | ||
| 366 | } | 277 | } |
| 367 | 278 | ||
| 368 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 279 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 369 | last_fn = RequestIRQ; | 280 | ret = pcmcia_request_irq(link, &link->irq); |
| 370 | last_ret = pcmcia_request_irq(link, &link->irq); | 281 | if (ret) |
| 371 | if (last_ret) | 282 | goto failed; |
| 372 | goto cs_failed; | ||
| 373 | } | 283 | } |
| 374 | 284 | ||
| 375 | /* | 285 | /* |
| @@ -377,10 +287,9 @@ next_entry: | |||
| 377 | the I/O windows and the interrupt mapping, and putting the | 287 | the I/O windows and the interrupt mapping, and putting the |
| 378 | card and host interface into "Memory and IO" mode. | 288 | card and host interface into "Memory and IO" mode. |
| 379 | */ | 289 | */ |
| 380 | last_fn = RequestConfiguration; | 290 | ret = pcmcia_request_configuration(link, &link->conf); |
| 381 | last_ret = pcmcia_request_configuration(link, &link->conf); | 291 | if (ret) |
| 382 | if (last_ret) | 292 | goto failed; |
| 383 | goto cs_failed; | ||
| 384 | 293 | ||
| 385 | /* | 294 | /* |
| 386 | At this point, the dev_node_t structure(s) need to be | 295 | At this point, the dev_node_t structure(s) need to be |
| @@ -405,8 +314,7 @@ next_entry: | |||
| 405 | 314 | ||
| 406 | return; | 315 | return; |
| 407 | 316 | ||
| 408 | cs_failed: | 317 | failed: |
| 409 | cs_error(link, last_fn, last_ret); | ||
| 410 | das08_pcmcia_release(link); | 318 | das08_pcmcia_release(link); |
| 411 | 319 | ||
| 412 | } /* das08_pcmcia_config */ | 320 | } /* das08_pcmcia_config */ |
| @@ -421,7 +329,7 @@ cs_failed: | |||
| 421 | 329 | ||
| 422 | static void das08_pcmcia_release(struct pcmcia_device *link) | 330 | static void das08_pcmcia_release(struct pcmcia_device *link) |
| 423 | { | 331 | { |
| 424 | DEBUG(0, "das08_pcmcia_release(0x%p)\n", link); | 332 | dev_dbg(&link->dev, "das08_pcmcia_release\n"); |
| 425 | pcmcia_disable_device(link); | 333 | pcmcia_disable_device(link); |
| 426 | } /* das08_pcmcia_release */ | 334 | } /* das08_pcmcia_release */ |
| 427 | 335 | ||
| @@ -477,14 +385,13 @@ struct pcmcia_driver das08_cs_driver = { | |||
| 477 | 385 | ||
| 478 | static int __init init_das08_pcmcia_cs(void) | 386 | static int __init init_das08_pcmcia_cs(void) |
| 479 | { | 387 | { |
| 480 | DEBUG(0, "%s\n", version); | ||
| 481 | pcmcia_register_driver(&das08_cs_driver); | 388 | pcmcia_register_driver(&das08_cs_driver); |
| 482 | return 0; | 389 | return 0; |
| 483 | } | 390 | } |
| 484 | 391 | ||
| 485 | static void __exit exit_das08_pcmcia_cs(void) | 392 | static void __exit exit_das08_pcmcia_cs(void) |
| 486 | { | 393 | { |
| 487 | DEBUG(0, "das08_pcmcia_cs: unloading\n"); | 394 | pr_debug("das08_pcmcia_cs: unloading\n"); |
| 488 | pcmcia_unregister_driver(&das08_cs_driver); | 395 | pcmcia_unregister_driver(&das08_cs_driver); |
| 489 | } | 396 | } |
| 490 | 397 | ||
diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index ec31a3970664..ef5e1183d47d 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c | |||
| @@ -436,25 +436,7 @@ static int dio700_detach(struct comedi_device *dev) | |||
| 436 | return 0; | 436 | return 0; |
| 437 | }; | 437 | }; |
| 438 | 438 | ||
| 439 | /* PCMCIA crap */ | 439 | /* PCMCIA crap -- watch your words, please! */ |
| 440 | |||
| 441 | /* | ||
| 442 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 443 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 444 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 445 | be present but disabled -- but it can then be enabled for specific | ||
| 446 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 447 | */ | ||
| 448 | #ifdef PCMCIA_DEBUG | ||
| 449 | static int pc_debug = PCMCIA_DEBUG; | ||
| 450 | module_param(pc_debug, int, 0644); | ||
| 451 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 452 | static char *version = "ni_daq_700.c, based on dummy_cs.c"; | ||
| 453 | #else | ||
| 454 | #define DEBUG(n, args...) | ||
| 455 | #endif | ||
| 456 | |||
| 457 | /*====================================================================*/ | ||
| 458 | 440 | ||
| 459 | static void dio700_config(struct pcmcia_device *link); | 441 | static void dio700_config(struct pcmcia_device *link); |
| 460 | static void dio700_release(struct pcmcia_device *link); | 442 | static void dio700_release(struct pcmcia_device *link); |
| @@ -510,7 +492,7 @@ static int dio700_cs_attach(struct pcmcia_device *link) | |||
| 510 | 492 | ||
| 511 | printk(KERN_INFO "ni_daq_700: cs-attach\n"); | 493 | printk(KERN_INFO "ni_daq_700: cs-attach\n"); |
| 512 | 494 | ||
| 513 | DEBUG(0, "dio700_cs_attach()\n"); | 495 | dev_dbg(&link->dev, "dio700_cs_attach()\n"); |
| 514 | 496 | ||
| 515 | /* Allocate space for private device-specific data */ | 497 | /* Allocate space for private device-specific data */ |
| 516 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); | 498 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); |
| @@ -521,7 +503,6 @@ static int dio700_cs_attach(struct pcmcia_device *link) | |||
| 521 | 503 | ||
| 522 | /* Interrupt setup */ | 504 | /* Interrupt setup */ |
| 523 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 505 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 524 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 525 | link->irq.Handler = NULL; | 506 | link->irq.Handler = NULL; |
| 526 | 507 | ||
| 527 | /* | 508 | /* |
| @@ -555,7 +536,7 @@ static void dio700_cs_detach(struct pcmcia_device *link) | |||
| 555 | 536 | ||
| 556 | printk(KERN_INFO "ni_daq_700: cs-detach!\n"); | 537 | printk(KERN_INFO "ni_daq_700: cs-detach!\n"); |
| 557 | 538 | ||
| 558 | DEBUG(0, "dio700_cs_detach(0x%p)\n", link); | 539 | dev_dbg(&link->dev, "dio700_cs_detach\n"); |
| 559 | 540 | ||
| 560 | if (link->dev_node) { | 541 | if (link->dev_node) { |
| 561 | ((struct local_info_t *)link->priv)->stop = 1; | 542 | ((struct local_info_t *)link->priv)->stop = 1; |
| @@ -576,141 +557,85 @@ static void dio700_cs_detach(struct pcmcia_device *link) | |||
| 576 | 557 | ||
| 577 | ======================================================================*/ | 558 | ======================================================================*/ |
| 578 | 559 | ||
| 579 | static void dio700_config(struct pcmcia_device *link) | 560 | static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 561 | cistpl_cftable_entry_t *cfg, | ||
| 562 | cistpl_cftable_entry_t *dflt, | ||
| 563 | unsigned int vcc, | ||
| 564 | void *priv_data) | ||
| 580 | { | 565 | { |
| 581 | struct local_info_t *dev = link->priv; | 566 | win_req_t *req = priv_data; |
| 582 | tuple_t tuple; | ||
| 583 | cisparse_t parse; | ||
| 584 | int last_ret; | ||
| 585 | u_char buf[64]; | ||
| 586 | win_req_t req; | ||
| 587 | memreq_t map; | 567 | memreq_t map; |
| 588 | cistpl_cftable_entry_t dflt = { 0 }; | ||
| 589 | 568 | ||
| 590 | printk(KERN_INFO "ni_daq_700: cs-config\n"); | 569 | if (cfg->index == 0) |
| 591 | 570 | return -ENODEV; | |
| 592 | DEBUG(0, "dio700_config(0x%p)\n", link); | ||
| 593 | 571 | ||
| 594 | /* | 572 | /* Does this card need audio output? */ |
| 595 | This reads the card's CONFIG tuple to find its configuration | 573 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { |
| 596 | registers. | 574 | p_dev->conf.Attributes |= CONF_ENABLE_SPKR; |
| 597 | */ | 575 | p_dev->conf.Status = CCSR_AUDIO_ENA; |
| 598 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
| 599 | tuple.Attributes = 0; | ||
| 600 | tuple.TupleData = buf; | ||
| 601 | tuple.TupleDataMax = sizeof(buf); | ||
| 602 | tuple.TupleOffset = 0; | ||
| 603 | |||
| 604 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 605 | if (last_ret) { | ||
| 606 | cs_error(link, GetFirstTuple, last_ret); | ||
| 607 | goto cs_failed; | ||
| 608 | } | 576 | } |
| 609 | 577 | ||
| 610 | last_ret = pcmcia_get_tuple_data(link, &tuple); | 578 | /* Do we need to allocate an interrupt? */ |
| 611 | if (last_ret) { | 579 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) |
| 612 | cs_error(link, GetTupleData, last_ret); | 580 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
| 613 | goto cs_failed; | 581 | |
| 582 | /* IO window settings */ | ||
| 583 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | ||
| 584 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
| 585 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
| 586 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 587 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 588 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 589 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 590 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 591 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 592 | p_dev->io.BasePort1 = io->win[0].base; | ||
| 593 | p_dev->io.NumPorts1 = io->win[0].len; | ||
| 594 | if (io->nwin > 1) { | ||
| 595 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | ||
| 596 | p_dev->io.BasePort2 = io->win[1].base; | ||
| 597 | p_dev->io.NumPorts2 = io->win[1].len; | ||
| 598 | } | ||
| 599 | /* This reserves IO space but doesn't actually enable it */ | ||
| 600 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | ||
| 601 | return -ENODEV; | ||
| 614 | } | 602 | } |
| 615 | 603 | ||
| 616 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | 604 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { |
| 617 | if (last_ret) { | 605 | cistpl_mem_t *mem = |
| 618 | cs_error(link, ParseTuple, last_ret); | 606 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; |
| 619 | goto cs_failed; | 607 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; |
| 608 | req->Attributes |= WIN_ENABLE; | ||
| 609 | req->Base = mem->win[0].host_addr; | ||
| 610 | req->Size = mem->win[0].len; | ||
| 611 | if (req->Size < 0x1000) | ||
| 612 | req->Size = 0x1000; | ||
| 613 | req->AccessSpeed = 0; | ||
| 614 | if (pcmcia_request_window(p_dev, req, &p_dev->win)) | ||
| 615 | return -ENODEV; | ||
| 616 | map.Page = 0; | ||
| 617 | map.CardOffset = mem->win[0].card_addr; | ||
| 618 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map)) | ||
| 619 | return -ENODEV; | ||
| 620 | } | 620 | } |
| 621 | link->conf.ConfigBase = parse.config.base; | 621 | /* If we got this far, we're cool! */ |
| 622 | link->conf.Present = parse.config.rmask[0]; | 622 | return 0; |
| 623 | 623 | } | |
| 624 | /* | ||
| 625 | In this loop, we scan the CIS for configuration table entries, | ||
| 626 | each of which describes a valid card configuration, including | ||
| 627 | voltage, IO window, memory window, and interrupt settings. | ||
| 628 | |||
| 629 | We make no assumptions about the card to be configured: we use | ||
| 630 | just the information available in the CIS. In an ideal world, | ||
| 631 | this would work for any PCMCIA card, but it requires a complete | ||
| 632 | and accurate CIS. In practice, a driver usually "knows" most of | ||
| 633 | these things without consulting the CIS, and most client drivers | ||
| 634 | will only use the CIS to fill in implementation-defined details. | ||
| 635 | */ | ||
| 636 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 637 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 638 | if (last_ret != 0) { | ||
| 639 | cs_error(link, GetFirstTuple, last_ret); | ||
| 640 | goto cs_failed; | ||
| 641 | } | ||
| 642 | while (1) { | ||
| 643 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
| 644 | if (pcmcia_get_tuple_data(link, &tuple) != 0) | ||
| 645 | goto next_entry; | ||
| 646 | if (pcmcia_parse_tuple(&tuple, &parse) != 0) | ||
| 647 | goto next_entry; | ||
| 648 | |||
| 649 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 650 | dflt = *cfg; | ||
| 651 | if (cfg->index == 0) | ||
| 652 | goto next_entry; | ||
| 653 | link->conf.ConfigIndex = cfg->index; | ||
| 654 | |||
| 655 | /* Does this card need audio output? */ | ||
| 656 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
| 657 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
| 658 | link->conf.Status = CCSR_AUDIO_ENA; | ||
| 659 | } | ||
| 660 | 624 | ||
| 661 | /* Do we need to allocate an interrupt? */ | 625 | static void dio700_config(struct pcmcia_device *link) |
| 662 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | 626 | { |
| 663 | link->conf.Attributes |= CONF_ENABLE_IRQ; | 627 | struct local_info_t *dev = link->priv; |
| 664 | 628 | win_req_t req; | |
| 665 | /* IO window settings */ | 629 | int ret; |
| 666 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 667 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 668 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 669 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 670 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 671 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 672 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 673 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 674 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 675 | link->io.BasePort1 = io->win[0].base; | ||
| 676 | link->io.NumPorts1 = io->win[0].len; | ||
| 677 | if (io->nwin > 1) { | ||
| 678 | link->io.Attributes2 = link->io.Attributes1; | ||
| 679 | link->io.BasePort2 = io->win[1].base; | ||
| 680 | link->io.NumPorts2 = io->win[1].len; | ||
| 681 | } | ||
| 682 | /* This reserves IO space but doesn't actually enable it */ | ||
| 683 | if (pcmcia_request_io(link, &link->io) != 0) | ||
| 684 | goto next_entry; | ||
| 685 | } | ||
| 686 | 630 | ||
| 687 | if ((cfg->mem.nwin > 0) || (dflt.mem.nwin > 0)) { | 631 | printk(KERN_INFO "ni_daq_700: cs-config\n"); |
| 688 | cistpl_mem_t *mem = | ||
| 689 | (cfg->mem.nwin) ? &cfg->mem : &dflt.mem; | ||
| 690 | req.Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
| 691 | req.Attributes |= WIN_ENABLE; | ||
| 692 | req.Base = mem->win[0].host_addr; | ||
| 693 | req.Size = mem->win[0].len; | ||
| 694 | if (req.Size < 0x1000) | ||
| 695 | req.Size = 0x1000; | ||
| 696 | req.AccessSpeed = 0; | ||
| 697 | if (pcmcia_request_window(&link, &req, &link->win)) | ||
| 698 | goto next_entry; | ||
| 699 | map.Page = 0; | ||
| 700 | map.CardOffset = mem->win[0].card_addr; | ||
| 701 | if (pcmcia_map_mem_page(link->win, &map)) | ||
| 702 | goto next_entry; | ||
| 703 | } | ||
| 704 | /* If we got this far, we're cool! */ | ||
| 705 | break; | ||
| 706 | 632 | ||
| 707 | next_entry: | 633 | dev_dbg(&link->dev, "dio700_config\n"); |
| 708 | 634 | ||
| 709 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 635 | ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, &req); |
| 710 | if (last_ret) { | 636 | if (ret) { |
| 711 | cs_error(link, GetNextTuple, last_ret); | 637 | dev_warn(&link->dev, "no configuration found\n"); |
| 712 | goto cs_failed; | 638 | goto failed; |
| 713 | } | ||
| 714 | } | 639 | } |
| 715 | 640 | ||
| 716 | /* | 641 | /* |
| @@ -719,11 +644,9 @@ next_entry: | |||
| 719 | irq structure is initialized. | 644 | irq structure is initialized. |
| 720 | */ | 645 | */ |
| 721 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 646 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 722 | last_ret = pcmcia_request_irq(link, &link->irq); | 647 | ret = pcmcia_request_irq(link, &link->irq); |
| 723 | if (last_ret) { | 648 | if (ret) |
| 724 | cs_error(link, RequestIRQ, last_ret); | 649 | goto failed; |
| 725 | goto cs_failed; | ||
| 726 | } | ||
| 727 | } | 650 | } |
| 728 | 651 | ||
| 729 | /* | 652 | /* |
| @@ -731,11 +654,9 @@ next_entry: | |||
| 731 | the I/O windows and the interrupt mapping, and putting the | 654 | the I/O windows and the interrupt mapping, and putting the |
| 732 | card and host interface into "Memory and IO" mode. | 655 | card and host interface into "Memory and IO" mode. |
| 733 | */ | 656 | */ |
| 734 | last_ret = pcmcia_request_configuration(link, &link->conf); | 657 | ret = pcmcia_request_configuration(link, &link->conf); |
| 735 | if (last_ret != 0) { | 658 | if (ret != 0) |
| 736 | cs_error(link, RequestConfiguration, last_ret); | 659 | goto failed; |
| 737 | goto cs_failed; | ||
| 738 | } | ||
| 739 | 660 | ||
| 740 | /* | 661 | /* |
| 741 | At this point, the dev_node_t structure(s) need to be | 662 | At this point, the dev_node_t structure(s) need to be |
| @@ -763,7 +684,7 @@ next_entry: | |||
| 763 | 684 | ||
| 764 | return; | 685 | return; |
| 765 | 686 | ||
| 766 | cs_failed: | 687 | failed: |
| 767 | printk(KERN_INFO "ni_daq_700 cs failed"); | 688 | printk(KERN_INFO "ni_daq_700 cs failed"); |
| 768 | dio700_release(link); | 689 | dio700_release(link); |
| 769 | 690 | ||
| @@ -771,7 +692,7 @@ cs_failed: | |||
| 771 | 692 | ||
| 772 | static void dio700_release(struct pcmcia_device *link) | 693 | static void dio700_release(struct pcmcia_device *link) |
| 773 | { | 694 | { |
| 774 | DEBUG(0, "dio700_release(0x%p)\n", link); | 695 | dev_dbg(&link->dev, "dio700_release\n"); |
| 775 | 696 | ||
| 776 | pcmcia_disable_device(link); | 697 | pcmcia_disable_device(link); |
| 777 | } /* dio700_release */ | 698 | } /* dio700_release */ |
| @@ -830,15 +751,13 @@ struct pcmcia_driver dio700_cs_driver = { | |||
| 830 | 751 | ||
| 831 | static int __init init_dio700_cs(void) | 752 | static int __init init_dio700_cs(void) |
| 832 | { | 753 | { |
| 833 | printk("ni_daq_700: cs-init \n"); | ||
| 834 | DEBUG(0, "%s\n", version); | ||
| 835 | pcmcia_register_driver(&dio700_cs_driver); | 754 | pcmcia_register_driver(&dio700_cs_driver); |
| 836 | return 0; | 755 | return 0; |
| 837 | } | 756 | } |
| 838 | 757 | ||
| 839 | static void __exit exit_dio700_cs(void) | 758 | static void __exit exit_dio700_cs(void) |
| 840 | { | 759 | { |
| 841 | DEBUG(0, "ni_daq_700: unloading\n"); | 760 | pr_debug("ni_daq_700: unloading\n"); |
| 842 | pcmcia_unregister_driver(&dio700_cs_driver); | 761 | pcmcia_unregister_driver(&dio700_cs_driver); |
| 843 | } | 762 | } |
| 844 | 763 | ||
diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 0700a8bddd1e..9017be3a92f1 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c | |||
| @@ -187,25 +187,7 @@ static int dio24_detach(struct comedi_device *dev) | |||
| 187 | return 0; | 187 | return 0; |
| 188 | }; | 188 | }; |
| 189 | 189 | ||
| 190 | /* PCMCIA crap */ | 190 | /* PCMCIA crap -- watch your words! */ |
| 191 | |||
| 192 | /* | ||
| 193 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 194 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 195 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 196 | be present but disabled -- but it can then be enabled for specific | ||
| 197 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 198 | */ | ||
| 199 | #ifdef PCMCIA_DEBUG | ||
| 200 | static int pc_debug = PCMCIA_DEBUG; | ||
| 201 | module_param(pc_debug, int, 0644); | ||
| 202 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 203 | static char *version = "ni_daq_dio24.c, based on dummy_cs.c"; | ||
| 204 | #else | ||
| 205 | #define DEBUG(n, args...) | ||
| 206 | #endif | ||
| 207 | |||
| 208 | /*====================================================================*/ | ||
| 209 | 191 | ||
| 210 | static void dio24_config(struct pcmcia_device *link); | 192 | static void dio24_config(struct pcmcia_device *link); |
| 211 | static void dio24_release(struct pcmcia_device *link); | 193 | static void dio24_release(struct pcmcia_device *link); |
| @@ -261,7 +243,7 @@ static int dio24_cs_attach(struct pcmcia_device *link) | |||
| 261 | 243 | ||
| 262 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - CS-attach!\n"); | 244 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - CS-attach!\n"); |
| 263 | 245 | ||
| 264 | DEBUG(0, "dio24_cs_attach()\n"); | 246 | dev_dbg(&link->dev, "dio24_cs_attach()\n"); |
| 265 | 247 | ||
| 266 | /* Allocate space for private device-specific data */ | 248 | /* Allocate space for private device-specific data */ |
| 267 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); | 249 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); |
| @@ -272,7 +254,6 @@ static int dio24_cs_attach(struct pcmcia_device *link) | |||
| 272 | 254 | ||
| 273 | /* Interrupt setup */ | 255 | /* Interrupt setup */ |
| 274 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 256 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 275 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 276 | link->irq.Handler = NULL; | 257 | link->irq.Handler = NULL; |
| 277 | 258 | ||
| 278 | /* | 259 | /* |
| @@ -306,7 +287,7 @@ static void dio24_cs_detach(struct pcmcia_device *link) | |||
| 306 | 287 | ||
| 307 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - cs-detach!\n"); | 288 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - cs-detach!\n"); |
| 308 | 289 | ||
| 309 | DEBUG(0, "dio24_cs_detach(0x%p)\n", link); | 290 | dev_dbg(&link->dev, "dio24_cs_detach\n"); |
| 310 | 291 | ||
| 311 | if (link->dev_node) { | 292 | if (link->dev_node) { |
| 312 | ((struct local_info_t *)link->priv)->stop = 1; | 293 | ((struct local_info_t *)link->priv)->stop = 1; |
| @@ -327,142 +308,85 @@ static void dio24_cs_detach(struct pcmcia_device *link) | |||
| 327 | 308 | ||
| 328 | ======================================================================*/ | 309 | ======================================================================*/ |
| 329 | 310 | ||
| 330 | static void dio24_config(struct pcmcia_device *link) | 311 | static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 312 | cistpl_cftable_entry_t *cfg, | ||
| 313 | cistpl_cftable_entry_t *dflt, | ||
| 314 | unsigned int vcc, | ||
| 315 | void *priv_data) | ||
| 331 | { | 316 | { |
| 332 | struct local_info_t *dev = link->priv; | 317 | win_req_t *req = priv_data; |
| 333 | tuple_t tuple; | ||
| 334 | cisparse_t parse; | ||
| 335 | int last_ret; | ||
| 336 | u_char buf[64]; | ||
| 337 | win_req_t req; | ||
| 338 | memreq_t map; | 318 | memreq_t map; |
| 339 | cistpl_cftable_entry_t dflt = { 0 }; | ||
| 340 | 319 | ||
| 341 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO! - config\n"); | 320 | if (cfg->index == 0) |
| 342 | 321 | return -ENODEV; | |
| 343 | DEBUG(0, "dio24_config(0x%p)\n", link); | ||
| 344 | |||
| 345 | /* | ||
| 346 | This reads the card's CONFIG tuple to find its configuration | ||
| 347 | registers. | ||
| 348 | */ | ||
| 349 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
| 350 | tuple.Attributes = 0; | ||
| 351 | tuple.TupleData = buf; | ||
| 352 | tuple.TupleDataMax = sizeof(buf); | ||
| 353 | tuple.TupleOffset = 0; | ||
| 354 | |||
| 355 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 356 | if (last_ret) { | ||
| 357 | cs_error(link, GetFirstTuple, last_ret); | ||
| 358 | goto cs_failed; | ||
| 359 | } | ||
| 360 | 322 | ||
| 361 | last_ret = pcmcia_get_tuple_data(link, &tuple); | 323 | /* Does this card need audio output? */ |
| 362 | if (last_ret) { | 324 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { |
| 363 | cs_error(link, GetTupleData, last_ret); | 325 | p_dev->conf.Attributes |= CONF_ENABLE_SPKR; |
| 364 | goto cs_failed; | 326 | p_dev->conf.Status = CCSR_AUDIO_ENA; |
| 365 | } | 327 | } |
| 366 | 328 | ||
| 367 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | 329 | /* Do we need to allocate an interrupt? */ |
| 368 | if (last_ret) { | 330 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) |
| 369 | cs_error(link, ParseTuple, last_ret); | 331 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
| 370 | goto cs_failed; | 332 | |
| 333 | /* IO window settings */ | ||
| 334 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | ||
| 335 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
| 336 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
| 337 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 338 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 339 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 340 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 341 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 342 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 343 | p_dev->io.BasePort1 = io->win[0].base; | ||
| 344 | p_dev->io.NumPorts1 = io->win[0].len; | ||
| 345 | if (io->nwin > 1) { | ||
| 346 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | ||
| 347 | p_dev->io.BasePort2 = io->win[1].base; | ||
| 348 | p_dev->io.NumPorts2 = io->win[1].len; | ||
| 349 | } | ||
| 350 | /* This reserves IO space but doesn't actually enable it */ | ||
| 351 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | ||
| 352 | return -ENODEV; | ||
| 371 | } | 353 | } |
| 372 | link->conf.ConfigBase = parse.config.base; | ||
| 373 | link->conf.Present = parse.config.rmask[0]; | ||
| 374 | |||
| 375 | /* | ||
| 376 | In this loop, we scan the CIS for configuration table entries, | ||
| 377 | each of which describes a valid card configuration, including | ||
| 378 | voltage, IO window, memory window, and interrupt settings. | ||
| 379 | |||
| 380 | We make no assumptions about the card to be configured: we use | ||
| 381 | just the information available in the CIS. In an ideal world, | ||
| 382 | this would work for any PCMCIA card, but it requires a complete | ||
| 383 | and accurate CIS. In practice, a driver usually "knows" most of | ||
| 384 | these things without consulting the CIS, and most client drivers | ||
| 385 | will only use the CIS to fill in implementation-defined details. | ||
| 386 | */ | ||
| 387 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 388 | 354 | ||
| 389 | last_ret = pcmcia_get_first_tuple(link, &tuple); | 355 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { |
| 390 | if (last_ret) { | 356 | cistpl_mem_t *mem = |
| 391 | cs_error(link, GetFirstTuple, last_ret); | 357 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; |
| 392 | goto cs_failed; | 358 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; |
| 359 | req->Attributes |= WIN_ENABLE; | ||
| 360 | req->Base = mem->win[0].host_addr; | ||
| 361 | req->Size = mem->win[0].len; | ||
| 362 | if (req->Size < 0x1000) | ||
| 363 | req->Size = 0x1000; | ||
| 364 | req->AccessSpeed = 0; | ||
| 365 | if (pcmcia_request_window(p_dev, req, &p_dev->win)) | ||
| 366 | return -ENODEV; | ||
| 367 | map.Page = 0; | ||
| 368 | map.CardOffset = mem->win[0].card_addr; | ||
| 369 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map)) | ||
| 370 | return -ENODEV; | ||
| 393 | } | 371 | } |
| 394 | while (1) { | 372 | /* If we got this far, we're cool! */ |
| 395 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | 373 | return 0; |
| 396 | if (pcmcia_get_tuple_data(link, &tuple) != 0) | 374 | } |
| 397 | goto next_entry; | ||
| 398 | if (pcmcia_parse_tuple(&tuple, &parse) != 0) | ||
| 399 | goto next_entry; | ||
| 400 | |||
| 401 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 402 | dflt = *cfg; | ||
| 403 | if (cfg->index == 0) | ||
| 404 | goto next_entry; | ||
| 405 | link->conf.ConfigIndex = cfg->index; | ||
| 406 | |||
| 407 | /* Does this card need audio output? */ | ||
| 408 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
| 409 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
| 410 | link->conf.Status = CCSR_AUDIO_ENA; | ||
| 411 | } | ||
| 412 | 375 | ||
| 413 | /* Do we need to allocate an interrupt? */ | 376 | static void dio24_config(struct pcmcia_device *link) |
| 414 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | 377 | { |
| 415 | link->conf.Attributes |= CONF_ENABLE_IRQ; | 378 | struct local_info_t *dev = link->priv; |
| 416 | 379 | int ret; | |
| 417 | /* IO window settings */ | 380 | win_req_t req; |
| 418 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 419 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 420 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 421 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 422 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 423 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 424 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 425 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 426 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 427 | link->io.BasePort1 = io->win[0].base; | ||
| 428 | link->io.NumPorts1 = io->win[0].len; | ||
| 429 | if (io->nwin > 1) { | ||
| 430 | link->io.Attributes2 = link->io.Attributes1; | ||
| 431 | link->io.BasePort2 = io->win[1].base; | ||
| 432 | link->io.NumPorts2 = io->win[1].len; | ||
| 433 | } | ||
| 434 | /* This reserves IO space but doesn't actually enable it */ | ||
| 435 | if (pcmcia_request_io(link, &link->io) != 0) | ||
| 436 | goto next_entry; | ||
| 437 | } | ||
| 438 | 381 | ||
| 439 | if ((cfg->mem.nwin > 0) || (dflt.mem.nwin > 0)) { | 382 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO! - config\n"); |
| 440 | cistpl_mem_t *mem = | ||
| 441 | (cfg->mem.nwin) ? &cfg->mem : &dflt.mem; | ||
| 442 | req.Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
| 443 | req.Attributes |= WIN_ENABLE; | ||
| 444 | req.Base = mem->win[0].host_addr; | ||
| 445 | req.Size = mem->win[0].len; | ||
| 446 | if (req.Size < 0x1000) | ||
| 447 | req.Size = 0x1000; | ||
| 448 | req.AccessSpeed = 0; | ||
| 449 | if (pcmcia_request_window(&link, &req, &link->win)) | ||
| 450 | goto next_entry; | ||
| 451 | map.Page = 0; | ||
| 452 | map.CardOffset = mem->win[0].card_addr; | ||
| 453 | if (pcmcia_map_mem_page(link->win, &map)) | ||
| 454 | goto next_entry; | ||
| 455 | } | ||
| 456 | /* If we got this far, we're cool! */ | ||
| 457 | break; | ||
| 458 | 383 | ||
| 459 | next_entry: | 384 | dev_dbg(&link->dev, "dio24_config\n"); |
| 460 | 385 | ||
| 461 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 386 | ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, &req); |
| 462 | if (last_ret) { | 387 | if (ret) { |
| 463 | cs_error(link, GetNextTuple, last_ret); | 388 | dev_warn(&link->dev, "no configuration found\n"); |
| 464 | goto cs_failed; | 389 | goto failed; |
| 465 | } | ||
| 466 | } | 390 | } |
| 467 | 391 | ||
| 468 | /* | 392 | /* |
| @@ -471,11 +395,9 @@ next_entry: | |||
| 471 | irq structure is initialized. | 395 | irq structure is initialized. |
| 472 | */ | 396 | */ |
| 473 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 397 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 474 | last_ret = pcmcia_request_irq(link, &link->irq); | 398 | ret = pcmcia_request_irq(link, &link->irq); |
| 475 | if (last_ret) { | 399 | if (ret) |
| 476 | cs_error(link, RequestIRQ, last_ret); | 400 | goto failed; |
| 477 | goto cs_failed; | ||
| 478 | } | ||
| 479 | } | 401 | } |
| 480 | 402 | ||
| 481 | /* | 403 | /* |
| @@ -483,11 +405,9 @@ next_entry: | |||
| 483 | the I/O windows and the interrupt mapping, and putting the | 405 | the I/O windows and the interrupt mapping, and putting the |
| 484 | card and host interface into "Memory and IO" mode. | 406 | card and host interface into "Memory and IO" mode. |
| 485 | */ | 407 | */ |
| 486 | last_ret = pcmcia_request_configuration(link, &link->conf); | 408 | ret = pcmcia_request_configuration(link, &link->conf); |
| 487 | if (last_ret) { | 409 | if (ret) |
| 488 | cs_error(link, RequestConfiguration, last_ret); | 410 | goto failed; |
| 489 | goto cs_failed; | ||
| 490 | } | ||
| 491 | 411 | ||
| 492 | /* | 412 | /* |
| 493 | At this point, the dev_node_t structure(s) need to be | 413 | At this point, the dev_node_t structure(s) need to be |
| @@ -515,7 +435,7 @@ next_entry: | |||
| 515 | 435 | ||
| 516 | return; | 436 | return; |
| 517 | 437 | ||
| 518 | cs_failed: | 438 | failed: |
| 519 | printk(KERN_INFO "Fallo"); | 439 | printk(KERN_INFO "Fallo"); |
| 520 | dio24_release(link); | 440 | dio24_release(link); |
| 521 | 441 | ||
| @@ -523,7 +443,7 @@ cs_failed: | |||
| 523 | 443 | ||
| 524 | static void dio24_release(struct pcmcia_device *link) | 444 | static void dio24_release(struct pcmcia_device *link) |
| 525 | { | 445 | { |
| 526 | DEBUG(0, "dio24_release(0x%p)\n", link); | 446 | dev_dbg(&link->dev, "dio24_release\n"); |
| 527 | 447 | ||
| 528 | pcmcia_disable_device(link); | 448 | pcmcia_disable_device(link); |
| 529 | } /* dio24_release */ | 449 | } /* dio24_release */ |
| @@ -582,14 +502,12 @@ struct pcmcia_driver dio24_cs_driver = { | |||
| 582 | static int __init init_dio24_cs(void) | 502 | static int __init init_dio24_cs(void) |
| 583 | { | 503 | { |
| 584 | printk("ni_daq_dio24: HOLA SOY YO!\n"); | 504 | printk("ni_daq_dio24: HOLA SOY YO!\n"); |
| 585 | DEBUG(0, "%s\n", version); | ||
| 586 | pcmcia_register_driver(&dio24_cs_driver); | 505 | pcmcia_register_driver(&dio24_cs_driver); |
| 587 | return 0; | 506 | return 0; |
| 588 | } | 507 | } |
| 589 | 508 | ||
| 590 | static void __exit exit_dio24_cs(void) | 509 | static void __exit exit_dio24_cs(void) |
| 591 | { | 510 | { |
| 592 | DEBUG(0, "ni_dio24: unloading\n"); | ||
| 593 | pcmcia_unregister_driver(&dio24_cs_driver); | 511 | pcmcia_unregister_driver(&dio24_cs_driver); |
| 594 | } | 512 | } |
| 595 | 513 | ||
diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index a3053b8da1c6..7d514b3ee754 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c | |||
| @@ -153,23 +153,6 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
| 153 | return labpc_common_attach(dev, iobase, irq, 0); | 153 | return labpc_common_attach(dev, iobase, irq, 0); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | /* | ||
| 157 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 158 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 159 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 160 | be present but disabled -- but it can then be enabled for specific | ||
| 161 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 162 | */ | ||
| 163 | #ifdef PCMCIA_DEBUG | ||
| 164 | static int pc_debug = PCMCIA_DEBUG; | ||
| 165 | module_param(pc_debug, int, 0644); | ||
| 166 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 167 | static const char *version = | ||
| 168 | "ni_labpc.c, based on dummy_cs.c 1.31 2001/08/24 12:13:13"; | ||
| 169 | #else | ||
| 170 | #define DEBUG(n, args...) | ||
| 171 | #endif | ||
| 172 | |||
| 173 | /*====================================================================*/ | 156 | /*====================================================================*/ |
| 174 | 157 | ||
| 175 | /* | 158 | /* |
| @@ -236,7 +219,7 @@ static int labpc_cs_attach(struct pcmcia_device *link) | |||
| 236 | { | 219 | { |
| 237 | struct local_info_t *local; | 220 | struct local_info_t *local; |
| 238 | 221 | ||
| 239 | DEBUG(0, "labpc_cs_attach()\n"); | 222 | dev_dbg(&link->dev, "labpc_cs_attach()\n"); |
| 240 | 223 | ||
| 241 | /* Allocate space for private device-specific data */ | 224 | /* Allocate space for private device-specific data */ |
| 242 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); | 225 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); |
| @@ -247,7 +230,6 @@ static int labpc_cs_attach(struct pcmcia_device *link) | |||
| 247 | 230 | ||
| 248 | /* Interrupt setup */ | 231 | /* Interrupt setup */ |
| 249 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_FORCED_PULSE; | 232 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_FORCED_PULSE; |
| 250 | link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_PULSE_ID; | ||
| 251 | link->irq.Handler = NULL; | 233 | link->irq.Handler = NULL; |
| 252 | 234 | ||
| 253 | /* | 235 | /* |
| @@ -278,7 +260,7 @@ static int labpc_cs_attach(struct pcmcia_device *link) | |||
| 278 | 260 | ||
| 279 | static void labpc_cs_detach(struct pcmcia_device *link) | 261 | static void labpc_cs_detach(struct pcmcia_device *link) |
| 280 | { | 262 | { |
| 281 | DEBUG(0, "labpc_cs_detach(0x%p)\n", link); | 263 | dev_dbg(&link->dev, "labpc_cs_detach\n"); |
| 282 | 264 | ||
| 283 | /* | 265 | /* |
| 284 | If the device is currently configured and active, we won't | 266 | If the device is currently configured and active, we won't |
| @@ -305,135 +287,84 @@ static void labpc_cs_detach(struct pcmcia_device *link) | |||
| 305 | 287 | ||
| 306 | ======================================================================*/ | 288 | ======================================================================*/ |
| 307 | 289 | ||
| 308 | static void labpc_config(struct pcmcia_device *link) | 290 | static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 291 | cistpl_cftable_entry_t *cfg, | ||
| 292 | cistpl_cftable_entry_t *dflt, | ||
| 293 | unsigned int vcc, | ||
| 294 | void *priv_data) | ||
| 309 | { | 295 | { |
| 310 | struct local_info_t *dev = link->priv; | 296 | win_req_t *req = priv_data; |
| 311 | tuple_t tuple; | ||
| 312 | cisparse_t parse; | ||
| 313 | int last_ret; | ||
| 314 | u_char buf[64]; | ||
| 315 | win_req_t req; | ||
| 316 | memreq_t map; | 297 | memreq_t map; |
| 317 | cistpl_cftable_entry_t dflt = { 0 }; | ||
| 318 | 298 | ||
| 319 | DEBUG(0, "labpc_config(0x%p)\n", link); | 299 | if (cfg->index == 0) |
| 300 | return -ENODEV; | ||
| 320 | 301 | ||
| 321 | /* | 302 | /* Does this card need audio output? */ |
| 322 | This reads the card's CONFIG tuple to find its configuration | 303 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { |
| 323 | registers. | 304 | p_dev->conf.Attributes |= CONF_ENABLE_SPKR; |
| 324 | */ | 305 | p_dev->conf.Status = CCSR_AUDIO_ENA; |
| 325 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
| 326 | tuple.Attributes = 0; | ||
| 327 | tuple.TupleData = buf; | ||
| 328 | tuple.TupleDataMax = sizeof(buf); | ||
| 329 | tuple.TupleOffset = 0; | ||
| 330 | |||
| 331 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 332 | if (last_ret) { | ||
| 333 | cs_error(link, GetFirstTuple, last_ret); | ||
| 334 | goto cs_failed; | ||
| 335 | } | 306 | } |
| 336 | 307 | ||
| 337 | last_ret = pcmcia_get_tuple_data(link, &tuple); | 308 | /* Do we need to allocate an interrupt? */ |
| 338 | if (last_ret) { | 309 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) |
| 339 | cs_error(link, GetTupleData, last_ret); | 310 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
| 340 | goto cs_failed; | 311 | |
| 312 | /* IO window settings */ | ||
| 313 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | ||
| 314 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
| 315 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
| 316 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 317 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 318 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 319 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 320 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 321 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 322 | p_dev->io.BasePort1 = io->win[0].base; | ||
| 323 | p_dev->io.NumPorts1 = io->win[0].len; | ||
| 324 | if (io->nwin > 1) { | ||
| 325 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | ||
| 326 | p_dev->io.BasePort2 = io->win[1].base; | ||
| 327 | p_dev->io.NumPorts2 = io->win[1].len; | ||
| 328 | } | ||
| 329 | /* This reserves IO space but doesn't actually enable it */ | ||
| 330 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | ||
| 331 | return -ENODEV; | ||
| 341 | } | 332 | } |
| 342 | 333 | ||
| 343 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | 334 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { |
| 344 | if (last_ret) { | 335 | cistpl_mem_t *mem = |
| 345 | cs_error(link, ParseTuple, last_ret); | 336 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; |
| 346 | goto cs_failed; | 337 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; |
| 338 | req->Attributes |= WIN_ENABLE; | ||
| 339 | req->Base = mem->win[0].host_addr; | ||
| 340 | req->Size = mem->win[0].len; | ||
| 341 | if (req->Size < 0x1000) | ||
| 342 | req->Size = 0x1000; | ||
| 343 | req->AccessSpeed = 0; | ||
| 344 | if (pcmcia_request_window(p_dev, req, &p_dev->win)) | ||
| 345 | return -ENODEV; | ||
| 346 | map.Page = 0; | ||
| 347 | map.CardOffset = mem->win[0].card_addr; | ||
| 348 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map)) | ||
| 349 | return -ENODEV; | ||
| 347 | } | 350 | } |
| 348 | link->conf.ConfigBase = parse.config.base; | 351 | /* If we got this far, we're cool! */ |
| 349 | link->conf.Present = parse.config.rmask[0]; | 352 | return 0; |
| 353 | } | ||
| 350 | 354 | ||
| 351 | /* | ||
| 352 | In this loop, we scan the CIS for configuration table entries, | ||
| 353 | each of which describes a valid card configuration, including | ||
| 354 | voltage, IO window, memory window, and interrupt settings. | ||
| 355 | |||
| 356 | We make no assumptions about the card to be configured: we use | ||
| 357 | just the information available in the CIS. In an ideal world, | ||
| 358 | this would work for any PCMCIA card, but it requires a complete | ||
| 359 | and accurate CIS. In practice, a driver usually "knows" most of | ||
| 360 | these things without consulting the CIS, and most client drivers | ||
| 361 | will only use the CIS to fill in implementation-defined details. | ||
| 362 | */ | ||
| 363 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 364 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 365 | if (last_ret) { | ||
| 366 | cs_error(link, GetFirstTuple, last_ret); | ||
| 367 | goto cs_failed; | ||
| 368 | } | ||
| 369 | while (1) { | ||
| 370 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
| 371 | if (pcmcia_get_tuple_data(link, &tuple)) | ||
| 372 | goto next_entry; | ||
| 373 | if (pcmcia_parse_tuple(&tuple, &parse)) | ||
| 374 | goto next_entry; | ||
| 375 | |||
| 376 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 377 | dflt = *cfg; | ||
| 378 | if (cfg->index == 0) | ||
| 379 | goto next_entry; | ||
| 380 | link->conf.ConfigIndex = cfg->index; | ||
| 381 | |||
| 382 | /* Does this card need audio output? */ | ||
| 383 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
| 384 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
| 385 | link->conf.Status = CCSR_AUDIO_ENA; | ||
| 386 | } | ||
| 387 | 355 | ||
| 388 | /* Do we need to allocate an interrupt? */ | 356 | static void labpc_config(struct pcmcia_device *link) |
| 389 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | 357 | { |
| 390 | link->conf.Attributes |= CONF_ENABLE_IRQ; | 358 | struct local_info_t *dev = link->priv; |
| 391 | 359 | int ret; | |
| 392 | /* IO window settings */ | 360 | win_req_t req; |
| 393 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 394 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 395 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 396 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 397 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 398 | link->io.BasePort1 = io->win[0].base; | ||
| 399 | link->io.NumPorts1 = io->win[0].len; | ||
| 400 | if (io->nwin > 1) { | ||
| 401 | link->io.Attributes2 = link->io.Attributes1; | ||
| 402 | link->io.BasePort2 = io->win[1].base; | ||
| 403 | link->io.NumPorts2 = io->win[1].len; | ||
| 404 | } | ||
| 405 | /* This reserves IO space but doesn't actually enable it */ | ||
| 406 | if (pcmcia_request_io(link, &link->io)) | ||
| 407 | goto next_entry; | ||
| 408 | } | ||
| 409 | 361 | ||
| 410 | if ((cfg->mem.nwin > 0) || (dflt.mem.nwin > 0)) { | 362 | dev_dbg(&link->dev, "labpc_config\n"); |
| 411 | cistpl_mem_t *mem = | ||
| 412 | (cfg->mem.nwin) ? &cfg->mem : &dflt.mem; | ||
| 413 | req.Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
| 414 | req.Attributes |= WIN_ENABLE; | ||
| 415 | req.Base = mem->win[0].host_addr; | ||
| 416 | req.Size = mem->win[0].len; | ||
| 417 | if (req.Size < 0x1000) | ||
| 418 | req.Size = 0x1000; | ||
| 419 | req.AccessSpeed = 0; | ||
| 420 | link->win = (window_handle_t) link; | ||
| 421 | if (pcmcia_request_window(&link, &req, &link->win)) | ||
| 422 | goto next_entry; | ||
| 423 | map.Page = 0; | ||
| 424 | map.CardOffset = mem->win[0].card_addr; | ||
| 425 | if (pcmcia_map_mem_page(link->win, &map)) | ||
| 426 | goto next_entry; | ||
| 427 | } | ||
| 428 | /* If we got this far, we're cool! */ | ||
| 429 | break; | ||
| 430 | 363 | ||
| 431 | next_entry: | 364 | ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, &req); |
| 432 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 365 | if (ret) { |
| 433 | if (last_ret) { | 366 | dev_warn(&link->dev, "no configuration found\n"); |
| 434 | cs_error(link, GetNextTuple, last_ret); | 367 | goto failed; |
| 435 | goto cs_failed; | ||
| 436 | } | ||
| 437 | } | 368 | } |
| 438 | 369 | ||
| 439 | /* | 370 | /* |
| @@ -442,11 +373,9 @@ next_entry: | |||
| 442 | irq structure is initialized. | 373 | irq structure is initialized. |
| 443 | */ | 374 | */ |
| 444 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 375 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 445 | last_ret = pcmcia_request_irq(link, &link->irq); | 376 | ret = pcmcia_request_irq(link, &link->irq); |
| 446 | if (last_ret) { | 377 | if (ret) |
| 447 | cs_error(link, RequestIRQ, last_ret); | 378 | goto failed; |
| 448 | goto cs_failed; | ||
| 449 | } | ||
| 450 | } | 379 | } |
| 451 | 380 | ||
| 452 | /* | 381 | /* |
| @@ -454,11 +383,9 @@ next_entry: | |||
| 454 | the I/O windows and the interrupt mapping, and putting the | 383 | the I/O windows and the interrupt mapping, and putting the |
| 455 | card and host interface into "Memory and IO" mode. | 384 | card and host interface into "Memory and IO" mode. |
| 456 | */ | 385 | */ |
| 457 | last_ret = pcmcia_request_configuration(link, &link->conf); | 386 | ret = pcmcia_request_configuration(link, &link->conf); |
| 458 | if (last_ret) { | 387 | if (ret) |
| 459 | cs_error(link, RequestConfiguration, last_ret); | 388 | goto failed; |
| 460 | goto cs_failed; | ||
| 461 | } | ||
| 462 | 389 | ||
| 463 | /* | 390 | /* |
| 464 | At this point, the dev_node_t structure(s) need to be | 391 | At this point, the dev_node_t structure(s) need to be |
| @@ -486,14 +413,14 @@ next_entry: | |||
| 486 | 413 | ||
| 487 | return; | 414 | return; |
| 488 | 415 | ||
| 489 | cs_failed: | 416 | failed: |
| 490 | labpc_release(link); | 417 | labpc_release(link); |
| 491 | 418 | ||
| 492 | } /* labpc_config */ | 419 | } /* labpc_config */ |
| 493 | 420 | ||
| 494 | static void labpc_release(struct pcmcia_device *link) | 421 | static void labpc_release(struct pcmcia_device *link) |
| 495 | { | 422 | { |
| 496 | DEBUG(0, "labpc_release(0x%p)\n", link); | 423 | dev_dbg(&link->dev, "labpc_release\n"); |
| 497 | 424 | ||
| 498 | pcmcia_disable_device(link); | 425 | pcmcia_disable_device(link); |
| 499 | } /* labpc_release */ | 426 | } /* labpc_release */ |
| @@ -551,14 +478,12 @@ struct pcmcia_driver labpc_cs_driver = { | |||
| 551 | 478 | ||
| 552 | static int __init init_labpc_cs(void) | 479 | static int __init init_labpc_cs(void) |
| 553 | { | 480 | { |
| 554 | DEBUG(0, "%s\n", version); | ||
| 555 | pcmcia_register_driver(&labpc_cs_driver); | 481 | pcmcia_register_driver(&labpc_cs_driver); |
| 556 | return 0; | 482 | return 0; |
| 557 | } | 483 | } |
| 558 | 484 | ||
| 559 | static void __exit exit_labpc_cs(void) | 485 | static void __exit exit_labpc_cs(void) |
| 560 | { | 486 | { |
| 561 | DEBUG(0, "ni_labpc: unloading\n"); | ||
| 562 | pcmcia_unregister_driver(&labpc_cs_driver); | 487 | pcmcia_unregister_driver(&labpc_cs_driver); |
| 563 | } | 488 | } |
| 564 | 489 | ||
diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index 9aef87fc81dc..d692f4bb47ea 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c | |||
| @@ -274,7 +274,6 @@ static int cs_attach(struct pcmcia_device *link) | |||
| 274 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 274 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
| 275 | link->io.NumPorts1 = 16; | 275 | link->io.NumPorts1 = 16; |
| 276 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 276 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 277 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 278 | link->conf.Attributes = CONF_ENABLE_IRQ; | 277 | link->conf.Attributes = CONF_ENABLE_IRQ; |
| 279 | link->conf.IntType = INT_MEMORY_AND_IO; | 278 | link->conf.IntType = INT_MEMORY_AND_IO; |
| 280 | 279 | ||
| @@ -312,96 +311,47 @@ static int mio_cs_resume(struct pcmcia_device *link) | |||
| 312 | return 0; | 311 | return 0; |
| 313 | } | 312 | } |
| 314 | 313 | ||
| 315 | static void mio_cs_config(struct pcmcia_device *link) | ||
| 316 | { | ||
| 317 | tuple_t tuple; | ||
| 318 | u_short buf[128]; | ||
| 319 | cisparse_t parse; | ||
| 320 | int manfid = 0, prodid = 0; | ||
| 321 | int ret; | ||
| 322 | |||
| 323 | DPRINTK("mio_cs_config(link=%p)\n", link); | ||
| 324 | 314 | ||
| 325 | tuple.TupleData = (cisdata_t *) buf; | 315 | static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 326 | tuple.TupleOffset = 0; | 316 | cistpl_cftable_entry_t *cfg, |
| 327 | tuple.TupleDataMax = 255; | 317 | cistpl_cftable_entry_t *dflt, |
| 328 | tuple.Attributes = 0; | 318 | unsigned int vcc, |
| 319 | void *priv_data) | ||
| 320 | { | ||
| 321 | int base, ret; | ||
| 329 | 322 | ||
| 330 | tuple.DesiredTuple = CISTPL_CONFIG; | 323 | p_dev->io.NumPorts1 = cfg->io.win[0].len; |
| 331 | ret = pcmcia_get_first_tuple(link, &tuple); | 324 | p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; |
| 332 | ret = pcmcia_get_tuple_data(link, &tuple); | 325 | p_dev->io.NumPorts2 = 0; |
| 333 | ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 334 | link->conf.ConfigBase = parse.config.base; | ||
| 335 | link->conf.Present = parse.config.rmask[0]; | ||
| 336 | 326 | ||
| 337 | #if 0 | 327 | for (base = 0x000; base < 0x400; base += 0x20) { |
| 338 | tuple.DesiredTuple = CISTPL_LONGLINK_MFC; | 328 | p_dev->io.BasePort1 = base; |
| 339 | tuple.Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; | 329 | ret = pcmcia_request_io(p_dev, &p_dev->io); |
| 340 | info->multi(first_tuple(link, &tuple, &parse) == 0); | 330 | if (!ret) |
| 341 | #endif | 331 | return 0; |
| 342 | |||
| 343 | tuple.DesiredTuple = CISTPL_MANFID; | ||
| 344 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
| 345 | if ((pcmcia_get_first_tuple(link, &tuple) == 0) && | ||
| 346 | (pcmcia_get_tuple_data(link, &tuple) == 0)) { | ||
| 347 | manfid = le16_to_cpu(buf[0]); | ||
| 348 | prodid = le16_to_cpu(buf[1]); | ||
| 349 | } | 332 | } |
| 350 | /* printk("manfid = 0x%04x, 0x%04x\n",manfid,prodid); */ | 333 | return -ENODEV; |
| 334 | } | ||
| 351 | 335 | ||
| 352 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 353 | tuple.Attributes = 0; | ||
| 354 | ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 355 | ret = pcmcia_get_tuple_data(link, &tuple); | ||
| 356 | ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 357 | 336 | ||
| 358 | #if 0 | 337 | static void mio_cs_config(struct pcmcia_device *link) |
| 359 | printk(" index: 0x%x\n", parse.cftable_entry.index); | 338 | { |
| 360 | printk(" flags: 0x%x\n", parse.cftable_entry.flags); | 339 | int ret; |
| 361 | printk(" io flags: 0x%x\n", parse.cftable_entry.io.flags); | ||
| 362 | printk(" io nwin: 0x%x\n", parse.cftable_entry.io.nwin); | ||
| 363 | printk(" io base: 0x%x\n", parse.cftable_entry.io.win[0].base); | ||
| 364 | printk(" io len: 0x%x\n", parse.cftable_entry.io.win[0].len); | ||
| 365 | printk(" irq1: 0x%x\n", parse.cftable_entry.irq.IRQInfo1); | ||
| 366 | printk(" irq2: 0x%x\n", parse.cftable_entry.irq.IRQInfo2); | ||
| 367 | printk(" mem flags: 0x%x\n", parse.cftable_entry.mem.flags); | ||
| 368 | printk(" mem nwin: 0x%x\n", parse.cftable_entry.mem.nwin); | ||
| 369 | printk(" subtuples: 0x%x\n", parse.cftable_entry.subtuples); | ||
| 370 | #endif | ||
| 371 | 340 | ||
| 372 | #if 0 | 341 | DPRINTK("mio_cs_config(link=%p)\n", link); |
| 373 | link->io.NumPorts1 = 0x20; | ||
| 374 | link->io.IOAddrLines = 5; | ||
| 375 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 376 | #endif | ||
| 377 | link->io.NumPorts1 = parse.cftable_entry.io.win[0].len; | ||
| 378 | link->io.IOAddrLines = | ||
| 379 | parse.cftable_entry.io.flags & CISTPL_IO_LINES_MASK; | ||
| 380 | link->io.NumPorts2 = 0; | ||
| 381 | 342 | ||
| 382 | { | 343 | ret = pcmcia_loop_config(link, mio_pcmcia_config_loop, NULL); |
| 383 | int base; | 344 | if (ret) { |
| 384 | for (base = 0x000; base < 0x400; base += 0x20) { | 345 | dev_warn(&link->dev, "no configuration found\n"); |
| 385 | link->io.BasePort1 = base; | 346 | return; |
| 386 | ret = pcmcia_request_io(link, &link->io); | ||
| 387 | /* printk("RequestIO 0x%02x\n",ret); */ | ||
| 388 | if (!ret) | ||
| 389 | break; | ||
| 390 | } | ||
| 391 | } | 347 | } |
| 392 | 348 | ||
| 393 | link->irq.IRQInfo1 = parse.cftable_entry.irq.IRQInfo1; | ||
| 394 | link->irq.IRQInfo2 = parse.cftable_entry.irq.IRQInfo2; | ||
| 395 | ret = pcmcia_request_irq(link, &link->irq); | 349 | ret = pcmcia_request_irq(link, &link->irq); |
| 396 | if (ret) { | 350 | if (ret) { |
| 397 | printk("pcmcia_request_irq() returned error: %i\n", ret); | 351 | printk("pcmcia_request_irq() returned error: %i\n", ret); |
| 398 | } | 352 | } |
| 399 | /* printk("RequestIRQ 0x%02x\n",ret); */ | ||
| 400 | |||
| 401 | link->conf.ConfigIndex = 1; | ||
| 402 | 353 | ||
| 403 | ret = pcmcia_request_configuration(link, &link->conf); | 354 | ret = pcmcia_request_configuration(link, &link->conf); |
| 404 | /* printk("RequestConfiguration %d\n",ret); */ | ||
| 405 | 355 | ||
| 406 | link->dev_node = &dev_node; | 356 | link->dev_node = &dev_node; |
| 407 | } | 357 | } |
| @@ -475,40 +425,17 @@ static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
| 475 | return 0; | 425 | return 0; |
| 476 | } | 426 | } |
| 477 | 427 | ||
| 478 | static int get_prodid(struct comedi_device *dev, struct pcmcia_device *link) | ||
| 479 | { | ||
| 480 | tuple_t tuple; | ||
| 481 | u_short buf[128]; | ||
| 482 | int prodid = 0; | ||
| 483 | |||
| 484 | tuple.TupleData = (cisdata_t *) buf; | ||
| 485 | tuple.TupleOffset = 0; | ||
| 486 | tuple.TupleDataMax = 255; | ||
| 487 | tuple.DesiredTuple = CISTPL_MANFID; | ||
| 488 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
| 489 | if ((pcmcia_get_first_tuple(link, &tuple) == 0) && | ||
| 490 | (pcmcia_get_tuple_data(link, &tuple) == 0)) { | ||
| 491 | prodid = le16_to_cpu(buf[1]); | ||
| 492 | } | ||
| 493 | |||
| 494 | return prodid; | ||
| 495 | } | ||
| 496 | |||
| 497 | static int ni_getboardtype(struct comedi_device *dev, | 428 | static int ni_getboardtype(struct comedi_device *dev, |
| 498 | struct pcmcia_device *link) | 429 | struct pcmcia_device *link) |
| 499 | { | 430 | { |
| 500 | int id; | ||
| 501 | int i; | 431 | int i; |
| 502 | 432 | ||
| 503 | id = get_prodid(dev, link); | ||
| 504 | |||
| 505 | for (i = 0; i < n_ni_boards; i++) { | 433 | for (i = 0; i < n_ni_boards; i++) { |
| 506 | if (ni_boards[i].device_id == id) { | 434 | if (ni_boards[i].device_id == link->card_id) |
| 507 | return i; | 435 | return i; |
| 508 | } | ||
| 509 | } | 436 | } |
| 510 | 437 | ||
| 511 | printk("unknown board 0x%04x -- pretend it is a ", id); | 438 | printk("unknown board 0x%04x -- pretend it is a ", link->card_id); |
| 512 | 439 | ||
| 513 | return 0; | 440 | return 0; |
| 514 | } | 441 | } |
diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 344b82353e08..5256fd933162 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c | |||
| @@ -55,23 +55,6 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 | |||
| 55 | #include <pcmcia/cisreg.h> | 55 | #include <pcmcia/cisreg.h> |
| 56 | #include <pcmcia/ds.h> | 56 | #include <pcmcia/ds.h> |
| 57 | 57 | ||
| 58 | /* | ||
| 59 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 60 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 61 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 62 | be present but disabled -- but it can then be enabled for specific | ||
| 63 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 64 | */ | ||
| 65 | |||
| 66 | #ifdef PCMCIA_DEBUG | ||
| 67 | static int pc_debug = PCMCIA_DEBUG; | ||
| 68 | module_param(pc_debug, int, 0644); | ||
| 69 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 70 | static char *version = "quatech_daqp_cs.c 1.10 2003/04/21 (Brent Baccala)"; | ||
| 71 | #else | ||
| 72 | #define DEBUG(n, args...) | ||
| 73 | #endif | ||
| 74 | |||
| 75 | /* Maximum number of separate DAQP devices we'll allow */ | 58 | /* Maximum number of separate DAQP devices we'll allow */ |
| 76 | #define MAX_DEV 4 | 59 | #define MAX_DEV 4 |
| 77 | 60 | ||
| @@ -863,8 +846,6 @@ static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
| 863 | { | 846 | { |
| 864 | int ret; | 847 | int ret; |
| 865 | struct local_info_t *local = dev_table[it->options[0]]; | 848 | struct local_info_t *local = dev_table[it->options[0]]; |
| 866 | tuple_t tuple; | ||
| 867 | int i; | ||
| 868 | struct comedi_subdevice *s; | 849 | struct comedi_subdevice *s; |
| 869 | 850 | ||
| 870 | if (it->options[0] < 0 || it->options[0] >= MAX_DEV || !local) { | 851 | if (it->options[0] < 0 || it->options[0] >= MAX_DEV || !local) { |
| @@ -883,29 +864,10 @@ static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
| 883 | 864 | ||
| 884 | strcpy(local->board_name, "DAQP"); | 865 | strcpy(local->board_name, "DAQP"); |
| 885 | dev->board_name = local->board_name; | 866 | dev->board_name = local->board_name; |
| 886 | 867 | if (local->link->prod_id[2]) { | |
| 887 | tuple.DesiredTuple = CISTPL_VERS_1; | 868 | if (strncmp(local->link->prod_id[2], "DAQP", 4) == 0) { |
| 888 | if (pcmcia_get_first_tuple(local->link, &tuple) == 0) { | 869 | strncpy(local->board_name, local->link->prod_id[2], |
| 889 | u_char buf[128]; | 870 | sizeof(local->board_name)); |
| 890 | |||
| 891 | buf[0] = buf[sizeof(buf) - 1] = 0; | ||
| 892 | tuple.TupleData = buf; | ||
| 893 | tuple.TupleDataMax = sizeof(buf); | ||
| 894 | tuple.TupleOffset = 2; | ||
| 895 | if (pcmcia_get_tuple_data(local->link, &tuple) == 0) { | ||
| 896 | |||
| 897 | for (i = 0; i < tuple.TupleDataLen - 4; i++) | ||
| 898 | if (buf[i] == 0) | ||
| 899 | break; | ||
| 900 | for (i++; i < tuple.TupleDataLen - 4; i++) | ||
| 901 | if (buf[i] == 0) | ||
| 902 | break; | ||
| 903 | i++; | ||
| 904 | if ((i < tuple.TupleDataLen - 4) | ||
| 905 | && (strncmp(buf + i, "DAQP", 4) == 0)) { | ||
| 906 | strncpy(local->board_name, buf + i, | ||
| 907 | sizeof(local->board_name)); | ||
| 908 | } | ||
| 909 | } | 871 | } |
| 910 | } | 872 | } |
| 911 | 873 | ||
| @@ -1058,7 +1020,7 @@ static int daqp_cs_attach(struct pcmcia_device *link) | |||
| 1058 | struct local_info_t *local; | 1020 | struct local_info_t *local; |
| 1059 | int i; | 1021 | int i; |
| 1060 | 1022 | ||
| 1061 | DEBUG(0, "daqp_cs_attach()\n"); | 1023 | dev_dbg(&link->dev, "daqp_cs_attach()\n"); |
| 1062 | 1024 | ||
| 1063 | for (i = 0; i < MAX_DEV; i++) | 1025 | for (i = 0; i < MAX_DEV; i++) |
| 1064 | if (dev_table[i] == NULL) | 1026 | if (dev_table[i] == NULL) |
| @@ -1079,10 +1041,8 @@ static int daqp_cs_attach(struct pcmcia_device *link) | |||
| 1079 | link->priv = local; | 1041 | link->priv = local; |
| 1080 | 1042 | ||
| 1081 | /* Interrupt setup */ | 1043 | /* Interrupt setup */ |
| 1082 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 1044 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
| 1083 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
| 1084 | link->irq.Handler = daqp_interrupt; | 1045 | link->irq.Handler = daqp_interrupt; |
| 1085 | link->irq.Instance = local; | ||
| 1086 | 1046 | ||
| 1087 | /* | 1047 | /* |
| 1088 | General socket configuration defaults can go here. In this | 1048 | General socket configuration defaults can go here. In this |
| @@ -1112,7 +1072,7 @@ static void daqp_cs_detach(struct pcmcia_device *link) | |||
| 1112 | { | 1072 | { |
| 1113 | struct local_info_t *dev = link->priv; | 1073 | struct local_info_t *dev = link->priv; |
| 1114 | 1074 | ||
| 1115 | DEBUG(0, "daqp_cs_detach(0x%p)\n", link); | 1075 | dev_dbg(&link->dev, "daqp_cs_detach\n"); |
| 1116 | 1076 | ||
| 1117 | if (link->dev_node) { | 1077 | if (link->dev_node) { |
| 1118 | dev->stop = 1; | 1078 | dev->stop = 1; |
| @@ -1134,115 +1094,54 @@ static void daqp_cs_detach(struct pcmcia_device *link) | |||
| 1134 | 1094 | ||
| 1135 | ======================================================================*/ | 1095 | ======================================================================*/ |
| 1136 | 1096 | ||
| 1137 | static void daqp_cs_config(struct pcmcia_device *link) | ||
| 1138 | { | ||
| 1139 | struct local_info_t *dev = link->priv; | ||
| 1140 | tuple_t tuple; | ||
| 1141 | cisparse_t parse; | ||
| 1142 | int last_ret; | ||
| 1143 | u_char buf[64]; | ||
| 1144 | |||
| 1145 | DEBUG(0, "daqp_cs_config(0x%p)\n", link); | ||
| 1146 | |||
| 1147 | /* | ||
| 1148 | This reads the card's CONFIG tuple to find its configuration | ||
| 1149 | registers. | ||
| 1150 | */ | ||
| 1151 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
| 1152 | tuple.Attributes = 0; | ||
| 1153 | tuple.TupleData = buf; | ||
| 1154 | tuple.TupleDataMax = sizeof(buf); | ||
| 1155 | tuple.TupleOffset = 0; | ||
| 1156 | |||
| 1157 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 1158 | if (last_ret) { | ||
| 1159 | cs_error(link, GetFirstTuple, last_ret); | ||
| 1160 | goto cs_failed; | ||
| 1161 | } | ||
| 1162 | 1097 | ||
| 1163 | last_ret = pcmcia_get_tuple_data(link, &tuple); | 1098 | static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 1164 | if (last_ret) { | 1099 | cistpl_cftable_entry_t *cfg, |
| 1165 | cs_error(link, GetTupleData, last_ret); | 1100 | cistpl_cftable_entry_t *dflt, |
| 1166 | goto cs_failed; | 1101 | unsigned int vcc, |
| 1167 | } | 1102 | void *priv_data) |
| 1168 | 1103 | { | |
| 1169 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | 1104 | if (cfg->index == 0) |
| 1170 | if (last_ret) { | 1105 | return -ENODEV; |
| 1171 | cs_error(link, ParseTuple, last_ret); | ||
| 1172 | goto cs_failed; | ||
| 1173 | } | ||
| 1174 | link->conf.ConfigBase = parse.config.base; | ||
| 1175 | link->conf.Present = parse.config.rmask[0]; | ||
| 1176 | 1106 | ||
| 1177 | /* | 1107 | /* Do we need to allocate an interrupt? */ |
| 1178 | In this loop, we scan the CIS for configuration table entries, | 1108 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) |
| 1179 | each of which describes a valid card configuration, including | 1109 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
| 1180 | voltage, IO window, memory window, and interrupt settings. | 1110 | |
| 1181 | 1111 | /* IO window settings */ | |
| 1182 | We make no assumptions about the card to be configured: we use | 1112 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; |
| 1183 | just the information available in the CIS. In an ideal world, | 1113 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
| 1184 | this would work for any PCMCIA card, but it requires a complete | 1114 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
| 1185 | and accurate CIS. In practice, a driver usually "knows" most of | 1115 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
| 1186 | these things without consulting the CIS, and most client drivers | 1116 | if (!(io->flags & CISTPL_IO_8BIT)) |
| 1187 | will only use the CIS to fill in implementation-defined details. | 1117 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
| 1188 | */ | 1118 | if (!(io->flags & CISTPL_IO_16BIT)) |
| 1189 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 1119 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 1190 | last_ret = pcmcia_get_first_tuple(link, &tuple); | 1120 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; |
| 1191 | if (last_ret) { | 1121 | p_dev->io.BasePort1 = io->win[0].base; |
| 1192 | cs_error(link, GetFirstTuple, last_ret); | 1122 | p_dev->io.NumPorts1 = io->win[0].len; |
| 1193 | goto cs_failed; | 1123 | if (io->nwin > 1) { |
| 1124 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | ||
| 1125 | p_dev->io.BasePort2 = io->win[1].base; | ||
| 1126 | p_dev->io.NumPorts2 = io->win[1].len; | ||
| 1127 | } | ||
| 1194 | } | 1128 | } |
| 1195 | 1129 | ||
| 1196 | while (1) { | 1130 | /* This reserves IO space but doesn't actually enable it */ |
| 1197 | cistpl_cftable_entry_t dflt = { 0 }; | 1131 | return pcmcia_request_io(p_dev, &p_dev->io); |
| 1198 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | 1132 | } |
| 1199 | if (pcmcia_get_tuple_data(link, &tuple)) | ||
| 1200 | goto next_entry; | ||
| 1201 | if (pcmcia_parse_tuple(&tuple, &parse)) | ||
| 1202 | goto next_entry; | ||
| 1203 | |||
| 1204 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 1205 | dflt = *cfg; | ||
| 1206 | if (cfg->index == 0) | ||
| 1207 | goto next_entry; | ||
| 1208 | link->conf.ConfigIndex = cfg->index; | ||
| 1209 | |||
| 1210 | /* Do we need to allocate an interrupt? */ | ||
| 1211 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | ||
| 1212 | link->conf.Attributes |= CONF_ENABLE_IRQ; | ||
| 1213 | |||
| 1214 | /* IO window settings */ | ||
| 1215 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 1216 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 1217 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 1218 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 1219 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 1220 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 1221 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 1222 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 1223 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 1224 | link->io.BasePort1 = io->win[0].base; | ||
| 1225 | link->io.NumPorts1 = io->win[0].len; | ||
| 1226 | if (io->nwin > 1) { | ||
| 1227 | link->io.Attributes2 = link->io.Attributes1; | ||
| 1228 | link->io.BasePort2 = io->win[1].base; | ||
| 1229 | link->io.NumPorts2 = io->win[1].len; | ||
| 1230 | } | ||
| 1231 | } | ||
| 1232 | 1133 | ||
| 1233 | /* This reserves IO space but doesn't actually enable it */ | 1134 | static void daqp_cs_config(struct pcmcia_device *link) |
| 1234 | if (pcmcia_request_io(link, &link->io)) | 1135 | { |
| 1235 | goto next_entry; | 1136 | struct local_info_t *dev = link->priv; |
| 1137 | int ret; | ||
| 1236 | 1138 | ||
| 1237 | /* If we got this far, we're cool! */ | 1139 | dev_dbg(&link->dev, "daqp_cs_config\n"); |
| 1238 | break; | ||
| 1239 | 1140 | ||
| 1240 | next_entry: | 1141 | ret = pcmcia_loop_config(link, daqp_pcmcia_config_loop, NULL); |
| 1241 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 1142 | if (ret) { |
| 1242 | if (last_ret) { | 1143 | dev_warn(&link->dev, "no configuration found\n"); |
| 1243 | cs_error(link, GetNextTuple, last_ret); | 1144 | goto failed; |
| 1244 | goto cs_failed; | ||
| 1245 | } | ||
| 1246 | } | 1145 | } |
| 1247 | 1146 | ||
| 1248 | /* | 1147 | /* |
| @@ -1251,11 +1150,9 @@ next_entry: | |||
| 1251 | irq structure is initialized. | 1150 | irq structure is initialized. |
| 1252 | */ | 1151 | */ |
| 1253 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 1152 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 1254 | last_ret = pcmcia_request_irq(link, &link->irq); | 1153 | ret = pcmcia_request_irq(link, &link->irq); |
| 1255 | if (last_ret) { | 1154 | if (ret) |
| 1256 | cs_error(link, RequestIRQ, last_ret); | 1155 | goto failed; |
| 1257 | goto cs_failed; | ||
| 1258 | } | ||
| 1259 | } | 1156 | } |
| 1260 | 1157 | ||
| 1261 | /* | 1158 | /* |
| @@ -1263,11 +1160,9 @@ next_entry: | |||
| 1263 | the I/O windows and the interrupt mapping, and putting the | 1160 | the I/O windows and the interrupt mapping, and putting the |
| 1264 | card and host interface into "Memory and IO" mode. | 1161 | card and host interface into "Memory and IO" mode. |
| 1265 | */ | 1162 | */ |
| 1266 | last_ret = pcmcia_request_configuration(link, &link->conf); | 1163 | ret = pcmcia_request_configuration(link, &link->conf); |
| 1267 | if (last_ret) { | 1164 | if (ret) |
| 1268 | cs_error(link, RequestConfiguration, last_ret); | 1165 | goto failed; |
| 1269 | goto cs_failed; | ||
| 1270 | } | ||
| 1271 | 1166 | ||
| 1272 | /* | 1167 | /* |
| 1273 | At this point, the dev_node_t structure(s) need to be | 1168 | At this point, the dev_node_t structure(s) need to be |
| @@ -1296,14 +1191,14 @@ next_entry: | |||
| 1296 | 1191 | ||
| 1297 | return; | 1192 | return; |
| 1298 | 1193 | ||
| 1299 | cs_failed: | 1194 | failed: |
| 1300 | daqp_cs_release(link); | 1195 | daqp_cs_release(link); |
| 1301 | 1196 | ||
| 1302 | } /* daqp_cs_config */ | 1197 | } /* daqp_cs_config */ |
| 1303 | 1198 | ||
| 1304 | static void daqp_cs_release(struct pcmcia_device *link) | 1199 | static void daqp_cs_release(struct pcmcia_device *link) |
| 1305 | { | 1200 | { |
| 1306 | DEBUG(0, "daqp_cs_release(0x%p)\n", link); | 1201 | dev_dbg(&link->dev, "daqp_cs_release\n"); |
| 1307 | 1202 | ||
| 1308 | pcmcia_disable_device(link); | 1203 | pcmcia_disable_device(link); |
| 1309 | } /* daqp_cs_release */ | 1204 | } /* daqp_cs_release */ |
| @@ -1363,7 +1258,6 @@ struct pcmcia_driver daqp_cs_driver = { | |||
| 1363 | 1258 | ||
| 1364 | int __init init_module(void) | 1259 | int __init init_module(void) |
| 1365 | { | 1260 | { |
| 1366 | DEBUG(0, "%s\n", version); | ||
| 1367 | pcmcia_register_driver(&daqp_cs_driver); | 1261 | pcmcia_register_driver(&daqp_cs_driver); |
| 1368 | comedi_driver_register(&driver_daqp); | 1262 | comedi_driver_register(&driver_daqp); |
| 1369 | return 0; | 1263 | return 0; |
| @@ -1371,7 +1265,6 @@ int __init init_module(void) | |||
| 1371 | 1265 | ||
| 1372 | void __exit cleanup_module(void) | 1266 | void __exit cleanup_module(void) |
| 1373 | { | 1267 | { |
| 1374 | DEBUG(0, "daqp_cs: unloading\n"); | ||
| 1375 | comedi_driver_unregister(&driver_daqp); | 1268 | comedi_driver_unregister(&driver_daqp); |
| 1376 | pcmcia_unregister_driver(&daqp_cs_driver); | 1269 | pcmcia_unregister_driver(&daqp_cs_driver); |
| 1377 | } | 1270 | } |
diff --git a/drivers/staging/go7007/s2250-board.c b/drivers/staging/go7007/s2250-board.c index 8c85a9c3665a..f4a6541c3e60 100644 --- a/drivers/staging/go7007/s2250-board.c +++ b/drivers/staging/go7007/s2250-board.c | |||
| @@ -261,7 +261,7 @@ static int read_reg_fp(struct i2c_client *client, u16 addr, u16 *val) | |||
| 261 | 261 | ||
| 262 | memset(buf, 0xcd, 6); | 262 | memset(buf, 0xcd, 6); |
| 263 | usb = go->hpi_context; | 263 | usb = go->hpi_context; |
| 264 | if (down_interruptible(&usb->i2c_lock) != 0) { | 264 | if (mutex_lock_interruptible(&usb->i2c_lock) != 0) { |
| 265 | printk(KERN_INFO "i2c lock failed\n"); | 265 | printk(KERN_INFO "i2c lock failed\n"); |
| 266 | kfree(buf); | 266 | kfree(buf); |
| 267 | return -EINTR; | 267 | return -EINTR; |
| @@ -270,7 +270,7 @@ static int read_reg_fp(struct i2c_client *client, u16 addr, u16 *val) | |||
| 270 | kfree(buf); | 270 | kfree(buf); |
| 271 | return -EFAULT; | 271 | return -EFAULT; |
| 272 | } | 272 | } |
| 273 | up(&usb->i2c_lock); | 273 | mutex_unlock(&usb->i2c_lock); |
| 274 | 274 | ||
| 275 | *val = (buf[0] << 8) | buf[1]; | 275 | *val = (buf[0] << 8) | buf[1]; |
| 276 | kfree(buf); | 276 | kfree(buf); |
diff --git a/drivers/staging/go7007/s2250-loader.h b/drivers/staging/go7007/s2250-loader.h new file mode 100644 index 000000000000..b7c301af16cc --- /dev/null +++ b/drivers/staging/go7007/s2250-loader.h | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2006 Micronas USA Inc. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License (Version 2) as | ||
| 6 | * published by the Free Software Foundation. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program; if not, write to the Free Software Foundation, | ||
| 15 | * Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef _S2250_LOADER_H_ | ||
| 19 | #define _S2250_LOADER_H_ | ||
| 20 | |||
| 21 | extern int s2250loader_init(void); | ||
| 22 | extern void s2250loader_cleanup(void); | ||
| 23 | |||
| 24 | #endif | ||
diff --git a/drivers/staging/hv/BlkVsc.c b/drivers/staging/hv/BlkVsc.c index 51aa861292fc..a48ee3a12646 100644 --- a/drivers/staging/hv/BlkVsc.c +++ b/drivers/staging/hv/BlkVsc.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | * Place - Suite 330, Boston, MA 02111-1307 USA. | 16 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
| 17 | * | 17 | * |
| 18 | * Authors: | 18 | * Authors: |
| 19 | * Haiyang Zhang <haiyangz@microsoft.com> | ||
| 19 | * Hank Janssen <hjanssen@microsoft.com> | 20 | * Hank Janssen <hjanssen@microsoft.com> |
| 20 | * | 21 | * |
| 21 | */ | 22 | */ |
diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index d649ee169d95..746370e82115 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c | |||
| @@ -611,7 +611,7 @@ void VmbusChannelClose(struct vmbus_channel *Channel) | |||
| 611 | 611 | ||
| 612 | /* Stop callback and cancel the timer asap */ | 612 | /* Stop callback and cancel the timer asap */ |
| 613 | Channel->OnChannelCallback = NULL; | 613 | Channel->OnChannelCallback = NULL; |
| 614 | del_timer(&Channel->poll_timer); | 614 | del_timer_sync(&Channel->poll_timer); |
| 615 | 615 | ||
| 616 | /* Send a closing message */ | 616 | /* Send a closing message */ |
| 617 | info = kmalloc(sizeof(*info) + | 617 | info = kmalloc(sizeof(*info) + |
| @@ -978,14 +978,10 @@ void VmbusChannelOnChannelEvent(struct vmbus_channel *Channel) | |||
| 978 | { | 978 | { |
| 979 | DumpVmbusChannel(Channel); | 979 | DumpVmbusChannel(Channel); |
| 980 | ASSERT(Channel->OnChannelCallback); | 980 | ASSERT(Channel->OnChannelCallback); |
| 981 | #ifdef ENABLE_POLLING | 981 | |
| 982 | del_timer(&Channel->poll_timer); | ||
| 983 | Channel->OnChannelCallback(Channel->ChannelCallbackContext); | ||
| 984 | channel->poll_timer.expires(jiffies + usecs_to_jiffies(100); | ||
| 985 | add_timer(&channel->poll_timer); | ||
| 986 | #else | ||
| 987 | Channel->OnChannelCallback(Channel->ChannelCallbackContext); | 982 | Channel->OnChannelCallback(Channel->ChannelCallbackContext); |
| 988 | #endif | 983 | |
| 984 | mod_timer(&Channel->poll_timer, jiffies + usecs_to_jiffies(100)); | ||
| 989 | } | 985 | } |
| 990 | 986 | ||
| 991 | /** | 987 | /** |
| @@ -997,10 +993,6 @@ void VmbusChannelOnTimer(unsigned long data) | |||
| 997 | 993 | ||
| 998 | if (channel->OnChannelCallback) { | 994 | if (channel->OnChannelCallback) { |
| 999 | channel->OnChannelCallback(channel->ChannelCallbackContext); | 995 | channel->OnChannelCallback(channel->ChannelCallbackContext); |
| 1000 | #ifdef ENABLE_POLLING | ||
| 1001 | channel->poll_timer.expires(jiffies + usecs_to_jiffies(100); | ||
| 1002 | add_timer(&channel->poll_timer); | ||
| 1003 | #endif | ||
| 1004 | } | 996 | } |
| 1005 | } | 997 | } |
| 1006 | 998 | ||
diff --git a/drivers/staging/hv/ChannelMgmt.c b/drivers/staging/hv/ChannelMgmt.c index 3db62caedcff..ef38467ed4e2 100644 --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c | |||
| @@ -119,7 +119,7 @@ static inline void ReleaseVmbusChannel(void *context) | |||
| 119 | */ | 119 | */ |
| 120 | void FreeVmbusChannel(struct vmbus_channel *Channel) | 120 | void FreeVmbusChannel(struct vmbus_channel *Channel) |
| 121 | { | 121 | { |
| 122 | del_timer(&Channel->poll_timer); | 122 | del_timer_sync(&Channel->poll_timer); |
| 123 | 123 | ||
| 124 | /* | 124 | /* |
| 125 | * We have to release the channel's workqueue/thread in the vmbus's | 125 | * We have to release the channel's workqueue/thread in the vmbus's |
diff --git a/drivers/staging/hv/NetVsc.c b/drivers/staging/hv/NetVsc.c index d384c0ddf069..1c717f9a554e 100644 --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | * Place - Suite 330, Boston, MA 02111-1307 USA. | 15 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
| 16 | * | 16 | * |
| 17 | * Authors: | 17 | * Authors: |
| 18 | * Haiyang Zhang <haiyangz@microsoft.com> | ||
| 18 | * Hank Janssen <hjanssen@microsoft.com> | 19 | * Hank Janssen <hjanssen@microsoft.com> |
| 19 | */ | 20 | */ |
| 20 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
diff --git a/drivers/staging/hv/NetVsc.h b/drivers/staging/hv/NetVsc.h index 3e7112f7c755..6e0e03494126 100644 --- a/drivers/staging/hv/NetVsc.h +++ b/drivers/staging/hv/NetVsc.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | * Place - Suite 330, Boston, MA 02111-1307 USA. | 16 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
| 17 | * | 17 | * |
| 18 | * Authors: | 18 | * Authors: |
| 19 | * Haiyang Zhang <haiyangz@microsoft.com> | ||
| 19 | * Hank Janssen <hjanssen@microsoft.com> | 20 | * Hank Janssen <hjanssen@microsoft.com> |
| 20 | * | 21 | * |
| 21 | */ | 22 | */ |
diff --git a/drivers/staging/hv/StorVsc.c b/drivers/staging/hv/StorVsc.c index 14015c927940..2f7c425896f7 100644 --- a/drivers/staging/hv/StorVsc.c +++ b/drivers/staging/hv/StorVsc.c | |||
| @@ -196,7 +196,7 @@ static int StorVscChannelInit(struct hv_device *Device) | |||
| 196 | * Now, initiate the vsc/vsp initialization protocol on the open | 196 | * Now, initiate the vsc/vsp initialization protocol on the open |
| 197 | * channel | 197 | * channel |
| 198 | */ | 198 | */ |
| 199 | memset(request, sizeof(struct storvsc_request_extension), 0); | 199 | memset(request, 0, sizeof(struct storvsc_request_extension)); |
| 200 | request->WaitEvent = osd_WaitEventCreate(); | 200 | request->WaitEvent = osd_WaitEventCreate(); |
| 201 | 201 | ||
| 202 | vstorPacket->Operation = VStorOperationBeginInitialization; | 202 | vstorPacket->Operation = VStorOperationBeginInitialization; |
| @@ -233,7 +233,7 @@ static int StorVscChannelInit(struct hv_device *Device) | |||
| 233 | DPRINT_INFO(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION..."); | 233 | DPRINT_INFO(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION..."); |
| 234 | 234 | ||
| 235 | /* reuse the packet for version range supported */ | 235 | /* reuse the packet for version range supported */ |
| 236 | memset(vstorPacket, sizeof(struct vstor_packet), 0); | 236 | memset(vstorPacket, 0, sizeof(struct vstor_packet)); |
| 237 | vstorPacket->Operation = VStorOperationQueryProtocolVersion; | 237 | vstorPacket->Operation = VStorOperationQueryProtocolVersion; |
| 238 | vstorPacket->Flags = REQUEST_COMPLETION_FLAG; | 238 | vstorPacket->Flags = REQUEST_COMPLETION_FLAG; |
| 239 | 239 | ||
| @@ -266,7 +266,7 @@ static int StorVscChannelInit(struct hv_device *Device) | |||
| 266 | /* Query channel properties */ | 266 | /* Query channel properties */ |
| 267 | DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION..."); | 267 | DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION..."); |
| 268 | 268 | ||
| 269 | memset(vstorPacket, sizeof(struct vstor_packet), 0); | 269 | memset(vstorPacket, 0, sizeof(struct vstor_packet)); |
| 270 | vstorPacket->Operation = VStorOperationQueryProperties; | 270 | vstorPacket->Operation = VStorOperationQueryProperties; |
| 271 | vstorPacket->Flags = REQUEST_COMPLETION_FLAG; | 271 | vstorPacket->Flags = REQUEST_COMPLETION_FLAG; |
| 272 | vstorPacket->StorageChannelProperties.PortNumber = | 272 | vstorPacket->StorageChannelProperties.PortNumber = |
| @@ -305,7 +305,7 @@ static int StorVscChannelInit(struct hv_device *Device) | |||
| 305 | 305 | ||
| 306 | DPRINT_INFO(STORVSC, "END_INITIALIZATION_OPERATION..."); | 306 | DPRINT_INFO(STORVSC, "END_INITIALIZATION_OPERATION..."); |
| 307 | 307 | ||
| 308 | memset(vstorPacket, sizeof(struct vstor_packet), 0); | 308 | memset(vstorPacket, 0, sizeof(struct vstor_packet)); |
| 309 | vstorPacket->Operation = VStorOperationEndInitialization; | 309 | vstorPacket->Operation = VStorOperationEndInitialization; |
| 310 | vstorPacket->Flags = REQUEST_COMPLETION_FLAG; | 310 | vstorPacket->Flags = REQUEST_COMPLETION_FLAG; |
| 311 | 311 | ||
| @@ -508,7 +508,7 @@ static int StorVscConnectToVsp(struct hv_device *Device) | |||
| 508 | int ret; | 508 | int ret; |
| 509 | 509 | ||
| 510 | storDriver = (struct storvsc_driver_object *)Device->Driver; | 510 | storDriver = (struct storvsc_driver_object *)Device->Driver; |
| 511 | memset(&props, sizeof(struct vmstorage_channel_properties), 0); | 511 | memset(&props, 0, sizeof(struct vmstorage_channel_properties)); |
| 512 | 512 | ||
| 513 | /* Open the channel */ | 513 | /* Open the channel */ |
| 514 | ret = Device->Driver->VmbusChannelInterface.Open(Device, | 514 | ret = Device->Driver->VmbusChannelInterface.Open(Device, |
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index 99c49261a8b4..62b282844a53 100644 --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | * Place - Suite 330, Boston, MA 02111-1307 USA. | 15 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
| 16 | * | 16 | * |
| 17 | * Authors: | 17 | * Authors: |
| 18 | * Haiyang Zhang <haiyangz@microsoft.com> | ||
| 18 | * Hank Janssen <hjanssen@microsoft.com> | 19 | * Hank Janssen <hjanssen@microsoft.com> |
| 19 | */ | 20 | */ |
| 20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c index 3192d50f7251..0d7459e2d036 100644 --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | * Place - Suite 330, Boston, MA 02111-1307 USA. | 15 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
| 16 | * | 16 | * |
| 17 | * Authors: | 17 | * Authors: |
| 18 | * Haiyang Zhang <haiyangz@microsoft.com> | ||
| 18 | * Hank Janssen <hjanssen@microsoft.com> | 19 | * Hank Janssen <hjanssen@microsoft.com> |
| 19 | */ | 20 | */ |
| 20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index 42230e62a222..31a58e508924 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c | |||
| @@ -170,7 +170,7 @@ static u32 cvm_oct_get_link(struct net_device *dev) | |||
| 170 | return ret; | 170 | return ret; |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | struct const ethtool_ops cvm_oct_ethtool_ops = { | 173 | const struct ethtool_ops cvm_oct_ethtool_ops = { |
| 174 | .get_drvinfo = cvm_oct_get_drvinfo, | 174 | .get_drvinfo = cvm_oct_get_drvinfo, |
| 175 | .get_settings = cvm_oct_get_settings, | 175 | .get_settings = cvm_oct_get_settings, |
| 176 | .set_settings = cvm_oct_set_settings, | 176 | .set_settings = cvm_oct_set_settings, |
diff --git a/drivers/staging/octeon/ethernet-spi.c b/drivers/staging/octeon/ethernet-spi.c index 66190b0cb68f..00dc0f4bad19 100644 --- a/drivers/staging/octeon/ethernet-spi.c +++ b/drivers/staging/octeon/ethernet-spi.c | |||
| @@ -317,6 +317,6 @@ void cvm_oct_spi_uninit(struct net_device *dev) | |||
| 317 | cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), 0); | 317 | cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), 0); |
| 318 | cvmx_write_csr(CVMX_STXX_INT_MSK(interface), 0); | 318 | cvmx_write_csr(CVMX_STXX_INT_MSK(interface), 0); |
| 319 | } | 319 | } |
| 320 | free_irq(8 + 46, &number_spi_ports); | 320 | free_irq(OCTEON_IRQ_RML, &number_spi_ports); |
| 321 | } | 321 | } |
| 322 | } | 322 | } |
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index b8479517dce2..492c5029992d 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c | |||
| @@ -111,6 +111,16 @@ MODULE_PARM_DESC(disable_core_queueing, "\n" | |||
| 111 | "\tallows packets to be sent without lock contention in the packet\n" | 111 | "\tallows packets to be sent without lock contention in the packet\n" |
| 112 | "\tscheduler resulting in some cases in improved throughput.\n"); | 112 | "\tscheduler resulting in some cases in improved throughput.\n"); |
| 113 | 113 | ||
| 114 | |||
| 115 | /* | ||
| 116 | * The offset from mac_addr_base that should be used for the next port | ||
| 117 | * that is configured. By convention, if any mgmt ports exist on the | ||
| 118 | * chip, they get the first mac addresses, The ports controlled by | ||
| 119 | * this driver are numbered sequencially following any mgmt addresses | ||
| 120 | * that may exist. | ||
| 121 | */ | ||
| 122 | static unsigned int cvm_oct_mac_addr_offset; | ||
| 123 | |||
| 114 | /** | 124 | /** |
| 115 | * Periodic timer to check auto negotiation | 125 | * Periodic timer to check auto negotiation |
| 116 | */ | 126 | */ |
| @@ -474,16 +484,30 @@ static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr) | |||
| 474 | */ | 484 | */ |
| 475 | int cvm_oct_common_init(struct net_device *dev) | 485 | int cvm_oct_common_init(struct net_device *dev) |
| 476 | { | 486 | { |
| 477 | static int count; | ||
| 478 | char mac[8] = { 0x00, 0x00, | ||
| 479 | octeon_bootinfo->mac_addr_base[0], | ||
| 480 | octeon_bootinfo->mac_addr_base[1], | ||
| 481 | octeon_bootinfo->mac_addr_base[2], | ||
| 482 | octeon_bootinfo->mac_addr_base[3], | ||
| 483 | octeon_bootinfo->mac_addr_base[4], | ||
| 484 | octeon_bootinfo->mac_addr_base[5] + count | ||
| 485 | }; | ||
| 486 | struct octeon_ethernet *priv = netdev_priv(dev); | 487 | struct octeon_ethernet *priv = netdev_priv(dev); |
| 488 | struct sockaddr sa; | ||
| 489 | u64 mac = ((u64)(octeon_bootinfo->mac_addr_base[0] & 0xff) << 40) | | ||
| 490 | ((u64)(octeon_bootinfo->mac_addr_base[1] & 0xff) << 32) | | ||
| 491 | ((u64)(octeon_bootinfo->mac_addr_base[2] & 0xff) << 24) | | ||
| 492 | ((u64)(octeon_bootinfo->mac_addr_base[3] & 0xff) << 16) | | ||
| 493 | ((u64)(octeon_bootinfo->mac_addr_base[4] & 0xff) << 8) | | ||
| 494 | (u64)(octeon_bootinfo->mac_addr_base[5] & 0xff); | ||
| 495 | |||
| 496 | mac += cvm_oct_mac_addr_offset; | ||
| 497 | sa.sa_data[0] = (mac >> 40) & 0xff; | ||
| 498 | sa.sa_data[1] = (mac >> 32) & 0xff; | ||
| 499 | sa.sa_data[2] = (mac >> 24) & 0xff; | ||
| 500 | sa.sa_data[3] = (mac >> 16) & 0xff; | ||
| 501 | sa.sa_data[4] = (mac >> 8) & 0xff; | ||
| 502 | sa.sa_data[5] = mac & 0xff; | ||
| 503 | |||
| 504 | if (cvm_oct_mac_addr_offset >= octeon_bootinfo->mac_addr_count) | ||
| 505 | printk(KERN_DEBUG "%s: Using MAC outside of the assigned range:" | ||
| 506 | " %02x:%02x:%02x:%02x:%02x:%02x\n", dev->name, | ||
| 507 | sa.sa_data[0] & 0xff, sa.sa_data[1] & 0xff, | ||
| 508 | sa.sa_data[2] & 0xff, sa.sa_data[3] & 0xff, | ||
| 509 | sa.sa_data[4] & 0xff, sa.sa_data[5] & 0xff); | ||
| 510 | cvm_oct_mac_addr_offset++; | ||
| 487 | 511 | ||
| 488 | /* | 512 | /* |
| 489 | * Force the interface to use the POW send if always_use_pow | 513 | * Force the interface to use the POW send if always_use_pow |
| @@ -496,14 +520,12 @@ int cvm_oct_common_init(struct net_device *dev) | |||
| 496 | if (priv->queue != -1 && USE_HW_TCPUDP_CHECKSUM) | 520 | if (priv->queue != -1 && USE_HW_TCPUDP_CHECKSUM) |
| 497 | dev->features |= NETIF_F_IP_CSUM; | 521 | dev->features |= NETIF_F_IP_CSUM; |
| 498 | 522 | ||
| 499 | count++; | ||
| 500 | |||
| 501 | /* We do our own locking, Linux doesn't need to */ | 523 | /* We do our own locking, Linux doesn't need to */ |
| 502 | dev->features |= NETIF_F_LLTX; | 524 | dev->features |= NETIF_F_LLTX; |
| 503 | SET_ETHTOOL_OPS(dev, &cvm_oct_ethtool_ops); | 525 | SET_ETHTOOL_OPS(dev, &cvm_oct_ethtool_ops); |
| 504 | 526 | ||
| 505 | cvm_oct_mdio_setup_device(dev); | 527 | cvm_oct_mdio_setup_device(dev); |
| 506 | dev->netdev_ops->ndo_set_mac_address(dev, mac); | 528 | dev->netdev_ops->ndo_set_mac_address(dev, &sa); |
| 507 | dev->netdev_ops->ndo_change_mtu(dev, dev->mtu); | 529 | dev->netdev_ops->ndo_change_mtu(dev, dev->mtu); |
| 508 | 530 | ||
| 509 | /* | 531 | /* |
| @@ -620,6 +642,13 @@ static int __init cvm_oct_init_module(void) | |||
| 620 | 642 | ||
| 621 | pr_notice("cavium-ethernet %s\n", OCTEON_ETHERNET_VERSION); | 643 | pr_notice("cavium-ethernet %s\n", OCTEON_ETHERNET_VERSION); |
| 622 | 644 | ||
| 645 | if (OCTEON_IS_MODEL(OCTEON_CN52XX)) | ||
| 646 | cvm_oct_mac_addr_offset = 2; /* First two are the mgmt ports. */ | ||
| 647 | else if (OCTEON_IS_MODEL(OCTEON_CN56XX)) | ||
| 648 | cvm_oct_mac_addr_offset = 1; /* First one is the mgmt port. */ | ||
| 649 | else | ||
| 650 | cvm_oct_mac_addr_offset = 0; | ||
| 651 | |||
| 623 | cvm_oct_proc_initialize(); | 652 | cvm_oct_proc_initialize(); |
| 624 | cvm_oct_rx_initialize(); | 653 | cvm_oct_rx_initialize(); |
| 625 | cvm_oct_configure_common_hw(); | 654 | cvm_oct_configure_common_hw(); |
diff --git a/drivers/staging/rtl8187se/TODO b/drivers/staging/rtl8187se/TODO index c09a9160739d..a762e79873e9 100644 --- a/drivers/staging/rtl8187se/TODO +++ b/drivers/staging/rtl8187se/TODO | |||
| @@ -11,5 +11,4 @@ TODO: | |||
| 11 | - sparse fixes | 11 | - sparse fixes |
| 12 | - integrate with drivers/net/wireless/rtl818x | 12 | - integrate with drivers/net/wireless/rtl818x |
| 13 | 13 | ||
| 14 | Please send any patches to Greg Kroah-Hartman <greg@kroah.com> and | 14 | Please send any patches to Greg Kroah-Hartman <greg@kroah.com>. |
| 15 | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>. | ||
diff --git a/drivers/staging/rtl8192su/TODO b/drivers/staging/rtl8192su/TODO index b13be9edb278..f11eec700030 100644 --- a/drivers/staging/rtl8192su/TODO +++ b/drivers/staging/rtl8192su/TODO | |||
| @@ -14,5 +14,4 @@ TODO: | |||
| 14 | - sparse fixes | 14 | - sparse fixes |
| 15 | - integrate with drivers/net/wireless/rtl818x | 15 | - integrate with drivers/net/wireless/rtl818x |
| 16 | 16 | ||
| 17 | Please send any patches to Greg Kroah-Hartman <greg@kroah.com> and | 17 | Please send any patches to Greg Kroah-Hartman <greg@kroah.com>. |
| 18 | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>. | ||
diff --git a/drivers/staging/vt6655/TODO b/drivers/staging/vt6655/TODO index 8462cd17eb61..cb04aaafc46f 100644 --- a/drivers/staging/vt6655/TODO +++ b/drivers/staging/vt6655/TODO | |||
| @@ -16,6 +16,5 @@ TODO: | |||
| 16 | - sparse fixes | 16 | - sparse fixes |
| 17 | - integrate with drivers/net/wireless | 17 | - integrate with drivers/net/wireless |
| 18 | 18 | ||
| 19 | Please send any patches to Greg Kroah-Hartman <greg@kroah.com>, | 19 | Please send any patches to Greg Kroah-Hartman <greg@kroah.com> |
| 20 | Forest Bond <forest@alittletooquiet.net> and Bartlomiej Zolnierkiewicz | 20 | and Forest Bond <forest@alittletooquiet.net>. |
| 21 | <bzolnier@gmail.com>. | ||
diff --git a/drivers/staging/vt6656/TODO b/drivers/staging/vt6656/TODO index 17cf50c6735e..a318995ba07f 100644 --- a/drivers/staging/vt6656/TODO +++ b/drivers/staging/vt6656/TODO | |||
| @@ -15,6 +15,5 @@ TODO: | |||
| 15 | - sparse fixes | 15 | - sparse fixes |
| 16 | - integrate with drivers/net/wireless | 16 | - integrate with drivers/net/wireless |
| 17 | 17 | ||
| 18 | Please send any patches to Greg Kroah-Hartman <greg@kroah.com>, | 18 | Please send any patches to Greg Kroah-Hartman <greg@kroah.com> |
| 19 | Forest Bond <forest@alittletooquiet.net> and Bartlomiej Zolnierkiewicz | 19 | and Forest Bond <forest@alittletooquiet.net>. |
| 20 | <bzolnier@gmail.com>. | ||
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 347c3ed1d9f1..d442fd35620a 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c | |||
| @@ -19,13 +19,6 @@ | |||
| 19 | * PCMCIA service support for Quicknet cards | 19 | * PCMCIA service support for Quicknet cards |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #ifdef PCMCIA_DEBUG | ||
| 23 | static int pc_debug = PCMCIA_DEBUG; | ||
| 24 | module_param(pc_debug, int, 0644); | ||
| 25 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 26 | #else | ||
| 27 | #define DEBUG(n, args...) | ||
| 28 | #endif | ||
| 29 | 22 | ||
| 30 | typedef struct ixj_info_t { | 23 | typedef struct ixj_info_t { |
| 31 | int ndev; | 24 | int ndev; |
| @@ -39,7 +32,7 @@ static void ixj_cs_release(struct pcmcia_device * link); | |||
| 39 | 32 | ||
| 40 | static int ixj_probe(struct pcmcia_device *p_dev) | 33 | static int ixj_probe(struct pcmcia_device *p_dev) |
| 41 | { | 34 | { |
| 42 | DEBUG(0, "ixj_attach()\n"); | 35 | dev_dbg(&p_dev->dev, "ixj_attach()\n"); |
| 43 | /* Create new ixj device */ | 36 | /* Create new ixj device */ |
| 44 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 37 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 45 | p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 38 | p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
| @@ -55,33 +48,30 @@ static int ixj_probe(struct pcmcia_device *p_dev) | |||
| 55 | 48 | ||
| 56 | static void ixj_detach(struct pcmcia_device *link) | 49 | static void ixj_detach(struct pcmcia_device *link) |
| 57 | { | 50 | { |
| 58 | DEBUG(0, "ixj_detach(0x%p)\n", link); | 51 | dev_dbg(&link->dev, "ixj_detach\n"); |
| 59 | 52 | ||
| 60 | ixj_cs_release(link); | 53 | ixj_cs_release(link); |
| 61 | 54 | ||
| 62 | kfree(link->priv); | 55 | kfree(link->priv); |
| 63 | } | 56 | } |
| 64 | 57 | ||
| 65 | #define CS_CHECK(fn, ret) \ | ||
| 66 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
| 67 | |||
| 68 | static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) | 58 | static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) |
| 69 | { | 59 | { |
| 70 | char *str; | 60 | char *str; |
| 71 | int i, place; | 61 | int i, place; |
| 72 | DEBUG(0, "ixj_get_serial(0x%p)\n", link); | 62 | dev_dbg(&link->dev, "ixj_get_serial\n"); |
| 73 | 63 | ||
| 74 | str = link->prod_id[0]; | 64 | str = link->prod_id[0]; |
| 75 | if (!str) | 65 | if (!str) |
| 76 | goto cs_failed; | 66 | goto failed; |
| 77 | printk("%s", str); | 67 | printk("%s", str); |
| 78 | str = link->prod_id[1]; | 68 | str = link->prod_id[1]; |
| 79 | if (!str) | 69 | if (!str) |
| 80 | goto cs_failed; | 70 | goto failed; |
| 81 | printk(" %s", str); | 71 | printk(" %s", str); |
| 82 | str = link->prod_id[2]; | 72 | str = link->prod_id[2]; |
| 83 | if (!str) | 73 | if (!str) |
| 84 | goto cs_failed; | 74 | goto failed; |
| 85 | place = 1; | 75 | place = 1; |
| 86 | for (i = strlen(str) - 1; i >= 0; i--) { | 76 | for (i = strlen(str) - 1; i >= 0; i--) { |
| 87 | switch (str[i]) { | 77 | switch (str[i]) { |
| @@ -118,9 +108,9 @@ static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) | |||
| 118 | } | 108 | } |
| 119 | str = link->prod_id[3]; | 109 | str = link->prod_id[3]; |
| 120 | if (!str) | 110 | if (!str) |
| 121 | goto cs_failed; | 111 | goto failed; |
| 122 | printk(" version %s\n", str); | 112 | printk(" version %s\n", str); |
| 123 | cs_failed: | 113 | failed: |
| 124 | return; | 114 | return; |
| 125 | } | 115 | } |
| 126 | 116 | ||
| @@ -151,13 +141,13 @@ static int ixj_config(struct pcmcia_device * link) | |||
| 151 | cistpl_cftable_entry_t dflt = { 0 }; | 141 | cistpl_cftable_entry_t dflt = { 0 }; |
| 152 | 142 | ||
| 153 | info = link->priv; | 143 | info = link->priv; |
| 154 | DEBUG(0, "ixj_config(0x%p)\n", link); | 144 | dev_dbg(&link->dev, "ixj_config\n"); |
| 155 | 145 | ||
| 156 | if (pcmcia_loop_config(link, ixj_config_check, &dflt)) | 146 | if (pcmcia_loop_config(link, ixj_config_check, &dflt)) |
| 157 | goto cs_failed; | 147 | goto failed; |
| 158 | 148 | ||
| 159 | if (pcmcia_request_configuration(link, &link->conf)) | 149 | if (pcmcia_request_configuration(link, &link->conf)) |
| 160 | goto cs_failed; | 150 | goto failed; |
| 161 | 151 | ||
| 162 | /* | 152 | /* |
| 163 | * Register the card with the core. | 153 | * Register the card with the core. |
| @@ -170,7 +160,7 @@ static int ixj_config(struct pcmcia_device * link) | |||
| 170 | ixj_get_serial(link, j); | 160 | ixj_get_serial(link, j); |
| 171 | return 0; | 161 | return 0; |
| 172 | 162 | ||
| 173 | cs_failed: | 163 | failed: |
| 174 | ixj_cs_release(link); | 164 | ixj_cs_release(link); |
| 175 | return -ENODEV; | 165 | return -ENODEV; |
| 176 | } | 166 | } |
| @@ -178,7 +168,7 @@ static int ixj_config(struct pcmcia_device * link) | |||
| 178 | static void ixj_cs_release(struct pcmcia_device *link) | 168 | static void ixj_cs_release(struct pcmcia_device *link) |
| 179 | { | 169 | { |
| 180 | ixj_info_t *info = link->priv; | 170 | ixj_info_t *info = link->priv; |
| 181 | DEBUG(0, "ixj_cs_release(0x%p)\n", link); | 171 | dev_dbg(&link->dev, "ixj_cs_release\n"); |
| 182 | info->ndev = 0; | 172 | info->ndev = 0; |
| 183 | pcmcia_disable_device(link); | 173 | pcmcia_disable_device(link); |
| 184 | } | 174 | } |
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 4e83c297ec9e..6f8d8f971212 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c | |||
| @@ -180,15 +180,15 @@ trip_point_type_show(struct device *dev, struct device_attribute *attr, | |||
| 180 | 180 | ||
| 181 | switch (type) { | 181 | switch (type) { |
| 182 | case THERMAL_TRIP_CRITICAL: | 182 | case THERMAL_TRIP_CRITICAL: |
| 183 | return sprintf(buf, "critical"); | 183 | return sprintf(buf, "critical\n"); |
| 184 | case THERMAL_TRIP_HOT: | 184 | case THERMAL_TRIP_HOT: |
| 185 | return sprintf(buf, "hot"); | 185 | return sprintf(buf, "hot\n"); |
| 186 | case THERMAL_TRIP_PASSIVE: | 186 | case THERMAL_TRIP_PASSIVE: |
| 187 | return sprintf(buf, "passive"); | 187 | return sprintf(buf, "passive\n"); |
| 188 | case THERMAL_TRIP_ACTIVE: | 188 | case THERMAL_TRIP_ACTIVE: |
| 189 | return sprintf(buf, "active"); | 189 | return sprintf(buf, "active\n"); |
| 190 | default: | 190 | default: |
| 191 | return sprintf(buf, "unknown"); | 191 | return sprintf(buf, "unknown\n"); |
| 192 | } | 192 | } |
| 193 | } | 193 | } |
| 194 | 194 | ||
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c index 02347c57357d..aa53db9f2e88 100644 --- a/drivers/uio/uio_pdrv_genirq.c +++ b/drivers/uio/uio_pdrv_genirq.c | |||
| @@ -178,6 +178,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) | |||
| 178 | return 0; | 178 | return 0; |
| 179 | bad1: | 179 | bad1: |
| 180 | kfree(priv); | 180 | kfree(priv); |
| 181 | pm_runtime_disable(&pdev->dev); | ||
| 181 | bad0: | 182 | bad0: |
| 182 | return ret; | 183 | return ret; |
| 183 | } | 184 | } |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e3861b21e776..e4eca7810bcf 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -609,9 +609,9 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) | |||
| 609 | 609 | ||
| 610 | acm->throttle = 0; | 610 | acm->throttle = 0; |
| 611 | 611 | ||
| 612 | tasklet_schedule(&acm->urb_task); | ||
| 613 | set_bit(ASYNCB_INITIALIZED, &acm->port.flags); | 612 | set_bit(ASYNCB_INITIALIZED, &acm->port.flags); |
| 614 | rv = tty_port_block_til_ready(&acm->port, tty, filp); | 613 | rv = tty_port_block_til_ready(&acm->port, tty, filp); |
| 614 | tasklet_schedule(&acm->urb_task); | ||
| 615 | done: | 615 | done: |
| 616 | mutex_unlock(&acm->mutex); | 616 | mutex_unlock(&acm->mutex); |
| 617 | err_out: | 617 | err_out: |
| @@ -686,15 +686,21 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) | |||
| 686 | 686 | ||
| 687 | /* Perform the closing process and see if we need to do the hardware | 687 | /* Perform the closing process and see if we need to do the hardware |
| 688 | shutdown */ | 688 | shutdown */ |
| 689 | if (!acm || tty_port_close_start(&acm->port, tty, filp) == 0) | 689 | if (!acm) |
| 690 | return; | ||
| 691 | if (tty_port_close_start(&acm->port, tty, filp) == 0) { | ||
| 692 | mutex_lock(&open_mutex); | ||
| 693 | if (!acm->dev) { | ||
| 694 | tty_port_tty_set(&acm->port, NULL); | ||
| 695 | acm_tty_unregister(acm); | ||
| 696 | tty->driver_data = NULL; | ||
| 697 | } | ||
| 698 | mutex_unlock(&open_mutex); | ||
| 690 | return; | 699 | return; |
| 700 | } | ||
| 691 | acm_port_down(acm, 0); | 701 | acm_port_down(acm, 0); |
| 692 | tty_port_close_end(&acm->port, tty); | 702 | tty_port_close_end(&acm->port, tty); |
| 693 | mutex_lock(&open_mutex); | ||
| 694 | tty_port_tty_set(&acm->port, NULL); | 703 | tty_port_tty_set(&acm->port, NULL); |
| 695 | if (!acm->dev) | ||
| 696 | acm_tty_unregister(acm); | ||
| 697 | mutex_unlock(&open_mutex); | ||
| 698 | } | 704 | } |
| 699 | 705 | ||
| 700 | static int acm_tty_write(struct tty_struct *tty, | 706 | static int acm_tty_write(struct tty_struct *tty, |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 5ce839137ad6..0f857e645058 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -444,7 +444,7 @@ resubmit: | |||
| 444 | static inline int | 444 | static inline int |
| 445 | hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt) | 445 | hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt) |
| 446 | { | 446 | { |
| 447 | return usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), | 447 | return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), |
| 448 | HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo, | 448 | HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo, |
| 449 | tt, NULL, 0, 1000); | 449 | tt, NULL, 0, 1000); |
| 450 | } | 450 | } |
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index d5b65962dd36..731150d4b1d9 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c | |||
| @@ -1213,7 +1213,12 @@ udc_queue(struct usb_ep *usbep, struct usb_request *usbreq, gfp_t gfp) | |||
| 1213 | tmp &= AMD_UNMASK_BIT(ep->num); | 1213 | tmp &= AMD_UNMASK_BIT(ep->num); |
| 1214 | writel(tmp, &dev->regs->ep_irqmsk); | 1214 | writel(tmp, &dev->regs->ep_irqmsk); |
| 1215 | } | 1215 | } |
| 1216 | } | 1216 | } else if (ep->in) { |
| 1217 | /* enable ep irq */ | ||
| 1218 | tmp = readl(&dev->regs->ep_irqmsk); | ||
| 1219 | tmp &= AMD_UNMASK_BIT(ep->num); | ||
| 1220 | writel(tmp, &dev->regs->ep_irqmsk); | ||
| 1221 | } | ||
| 1217 | 1222 | ||
| 1218 | } else if (ep->dma) { | 1223 | } else if (ep->dma) { |
| 1219 | 1224 | ||
| @@ -2005,18 +2010,17 @@ __acquires(dev->lock) | |||
| 2005 | { | 2010 | { |
| 2006 | int tmp; | 2011 | int tmp; |
| 2007 | 2012 | ||
| 2008 | /* empty queues and init hardware */ | ||
| 2009 | udc_basic_init(dev); | ||
| 2010 | for (tmp = 0; tmp < UDC_EP_NUM; tmp++) { | ||
| 2011 | empty_req_queue(&dev->ep[tmp]); | ||
| 2012 | } | ||
| 2013 | |||
| 2014 | if (dev->gadget.speed != USB_SPEED_UNKNOWN) { | 2013 | if (dev->gadget.speed != USB_SPEED_UNKNOWN) { |
| 2015 | spin_unlock(&dev->lock); | 2014 | spin_unlock(&dev->lock); |
| 2016 | driver->disconnect(&dev->gadget); | 2015 | driver->disconnect(&dev->gadget); |
| 2017 | spin_lock(&dev->lock); | 2016 | spin_lock(&dev->lock); |
| 2018 | } | 2017 | } |
| 2019 | /* init */ | 2018 | |
| 2019 | /* empty queues and init hardware */ | ||
| 2020 | udc_basic_init(dev); | ||
| 2021 | for (tmp = 0; tmp < UDC_EP_NUM; tmp++) | ||
| 2022 | empty_req_queue(&dev->ep[tmp]); | ||
| 2023 | |||
| 2020 | udc_setup_endpoints(dev); | 2024 | udc_setup_endpoints(dev); |
| 2021 | } | 2025 | } |
| 2022 | 2026 | ||
| @@ -2472,6 +2476,13 @@ static irqreturn_t udc_data_in_isr(struct udc *dev, int ep_ix) | |||
| 2472 | } | 2476 | } |
| 2473 | } | 2477 | } |
| 2474 | 2478 | ||
| 2479 | } else if (!use_dma && ep->in) { | ||
| 2480 | /* disable interrupt */ | ||
| 2481 | tmp = readl( | ||
| 2482 | &dev->regs->ep_irqmsk); | ||
| 2483 | tmp |= AMD_BIT(ep->num); | ||
| 2484 | writel(tmp, | ||
| 2485 | &dev->regs->ep_irqmsk); | ||
| 2475 | } | 2486 | } |
| 2476 | } | 2487 | } |
| 2477 | /* clear status bits */ | 2488 | /* clear status bits */ |
| @@ -3279,6 +3290,17 @@ static int udc_pci_probe( | |||
| 3279 | goto finished; | 3290 | goto finished; |
| 3280 | } | 3291 | } |
| 3281 | 3292 | ||
| 3293 | spin_lock_init(&dev->lock); | ||
| 3294 | /* udc csr registers base */ | ||
| 3295 | dev->csr = dev->virt_addr + UDC_CSR_ADDR; | ||
| 3296 | /* dev registers base */ | ||
| 3297 | dev->regs = dev->virt_addr + UDC_DEVCFG_ADDR; | ||
| 3298 | /* ep registers base */ | ||
| 3299 | dev->ep_regs = dev->virt_addr + UDC_EPREGS_ADDR; | ||
| 3300 | /* fifo's base */ | ||
| 3301 | dev->rxfifo = (u32 __iomem *)(dev->virt_addr + UDC_RXFIFO_ADDR); | ||
| 3302 | dev->txfifo = (u32 __iomem *)(dev->virt_addr + UDC_TXFIFO_ADDR); | ||
| 3303 | |||
| 3282 | if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) { | 3304 | if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) { |
| 3283 | dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq); | 3305 | dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq); |
| 3284 | kfree(dev); | 3306 | kfree(dev); |
| @@ -3331,7 +3353,6 @@ static int udc_probe(struct udc *dev) | |||
| 3331 | udc_pollstall_timer.data = 0; | 3353 | udc_pollstall_timer.data = 0; |
| 3332 | 3354 | ||
| 3333 | /* device struct setup */ | 3355 | /* device struct setup */ |
| 3334 | spin_lock_init(&dev->lock); | ||
| 3335 | dev->gadget.ops = &udc_ops; | 3356 | dev->gadget.ops = &udc_ops; |
| 3336 | 3357 | ||
| 3337 | dev_set_name(&dev->gadget.dev, "gadget"); | 3358 | dev_set_name(&dev->gadget.dev, "gadget"); |
| @@ -3340,16 +3361,6 @@ static int udc_probe(struct udc *dev) | |||
| 3340 | dev->gadget.name = name; | 3361 | dev->gadget.name = name; |
| 3341 | dev->gadget.is_dualspeed = 1; | 3362 | dev->gadget.is_dualspeed = 1; |
| 3342 | 3363 | ||
| 3343 | /* udc csr registers base */ | ||
| 3344 | dev->csr = dev->virt_addr + UDC_CSR_ADDR; | ||
| 3345 | /* dev registers base */ | ||
| 3346 | dev->regs = dev->virt_addr + UDC_DEVCFG_ADDR; | ||
| 3347 | /* ep registers base */ | ||
| 3348 | dev->ep_regs = dev->virt_addr + UDC_EPREGS_ADDR; | ||
| 3349 | /* fifo's base */ | ||
| 3350 | dev->rxfifo = (u32 __iomem *)(dev->virt_addr + UDC_RXFIFO_ADDR); | ||
| 3351 | dev->txfifo = (u32 __iomem *)(dev->virt_addr + UDC_TXFIFO_ADDR); | ||
| 3352 | |||
| 3353 | /* init registers, interrupts, ... */ | 3364 | /* init registers, interrupts, ... */ |
| 3354 | startup_registers(dev); | 3365 | startup_registers(dev); |
| 3355 | 3366 | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 9835e0713943..f5f5601701c9 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
| 29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
| 30 | #include <linux/timer.h> | 30 | #include <linux/timer.h> |
| 31 | #include <linux/ktime.h> | ||
| 31 | #include <linux/list.h> | 32 | #include <linux/list.h> |
| 32 | #include <linux/interrupt.h> | 33 | #include <linux/interrupt.h> |
| 33 | #include <linux/usb.h> | 34 | #include <linux/usb.h> |
| @@ -676,6 +677,7 @@ static int ehci_run (struct usb_hcd *hcd) | |||
| 676 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ | 677 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ |
| 677 | msleep(5); | 678 | msleep(5); |
| 678 | up_write(&ehci_cf_port_reset_rwsem); | 679 | up_write(&ehci_cf_port_reset_rwsem); |
| 680 | ehci->last_periodic_enable = ktime_get_real(); | ||
| 679 | 681 | ||
| 680 | temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 682 | temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); |
| 681 | ehci_info (ehci, | 683 | ehci_info (ehci, |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 378861b9d79a..ead5f4f2aa5a 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
| @@ -111,6 +111,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
| 111 | switch (pdev->vendor) { | 111 | switch (pdev->vendor) { |
| 112 | case PCI_VENDOR_ID_INTEL: | 112 | case PCI_VENDOR_ID_INTEL: |
| 113 | ehci->need_io_watchdog = 0; | 113 | ehci->need_io_watchdog = 0; |
| 114 | if (pdev->device == 0x27cc) { | ||
| 115 | ehci->broken_periodic = 1; | ||
| 116 | ehci_info(ehci, "using broken periodic workaround\n"); | ||
| 117 | } | ||
| 114 | break; | 118 | break; |
| 115 | case PCI_VENDOR_ID_TDI: | 119 | case PCI_VENDOR_ID_TDI: |
| 116 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | 120 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 00ad9ce392ed..139a2cc3f641 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
| @@ -487,8 +487,20 @@ halt: | |||
| 487 | * we must clear the TT buffer (11.17.5). | 487 | * we must clear the TT buffer (11.17.5). |
| 488 | */ | 488 | */ |
| 489 | if (unlikely(last_status != -EINPROGRESS && | 489 | if (unlikely(last_status != -EINPROGRESS && |
| 490 | last_status != -EREMOTEIO)) | 490 | last_status != -EREMOTEIO)) { |
| 491 | ehci_clear_tt_buffer(ehci, qh, urb, token); | 491 | /* The TT's in some hubs malfunction when they |
| 492 | * receive this request following a STALL (they | ||
| 493 | * stop sending isochronous packets). Since a | ||
| 494 | * STALL can't leave the TT buffer in a busy | ||
| 495 | * state (if you believe Figures 11-48 - 11-51 | ||
| 496 | * in the USB 2.0 spec), we won't clear the TT | ||
| 497 | * buffer in this case. Strictly speaking this | ||
| 498 | * is a violation of the spec. | ||
| 499 | */ | ||
| 500 | if (last_status != -EPIPE) | ||
| 501 | ehci_clear_tt_buffer(ehci, qh, urb, | ||
| 502 | token); | ||
| 503 | } | ||
| 492 | } | 504 | } |
| 493 | 505 | ||
| 494 | /* if we're removing something not at the queue head, | 506 | /* if we're removing something not at the queue head, |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index b25cdea93a1f..a5535b5e3fe2 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
| @@ -475,6 +475,8 @@ static int enable_periodic (struct ehci_hcd *ehci) | |||
| 475 | /* make sure ehci_work scans these */ | 475 | /* make sure ehci_work scans these */ |
| 476 | ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index) | 476 | ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index) |
| 477 | % (ehci->periodic_size << 3); | 477 | % (ehci->periodic_size << 3); |
| 478 | if (unlikely(ehci->broken_periodic)) | ||
| 479 | ehci->last_periodic_enable = ktime_get_real(); | ||
| 478 | return 0; | 480 | return 0; |
| 479 | } | 481 | } |
| 480 | 482 | ||
| @@ -486,6 +488,16 @@ static int disable_periodic (struct ehci_hcd *ehci) | |||
| 486 | if (--ehci->periodic_sched) | 488 | if (--ehci->periodic_sched) |
| 487 | return 0; | 489 | return 0; |
| 488 | 490 | ||
| 491 | if (unlikely(ehci->broken_periodic)) { | ||
| 492 | /* delay experimentally determined */ | ||
| 493 | ktime_t safe = ktime_add_us(ehci->last_periodic_enable, 1000); | ||
| 494 | ktime_t now = ktime_get_real(); | ||
| 495 | s64 delay = ktime_us_delta(safe, now); | ||
| 496 | |||
| 497 | if (unlikely(delay > 0)) | ||
| 498 | udelay(delay); | ||
| 499 | } | ||
| 500 | |||
| 489 | /* did setting PSE not take effect yet? | 501 | /* did setting PSE not take effect yet? |
| 490 | * takes effect only at frame boundaries... | 502 | * takes effect only at frame boundaries... |
| 491 | */ | 503 | */ |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 064e76821ff5..2d85e21ff282 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
| @@ -118,6 +118,7 @@ struct ehci_hcd { /* one per controller */ | |||
| 118 | unsigned stamp; | 118 | unsigned stamp; |
| 119 | unsigned random_frame; | 119 | unsigned random_frame; |
| 120 | unsigned long next_statechange; | 120 | unsigned long next_statechange; |
| 121 | ktime_t last_periodic_enable; | ||
| 121 | u32 command; | 122 | u32 command; |
| 122 | 123 | ||
| 123 | /* SILICON QUIRKS */ | 124 | /* SILICON QUIRKS */ |
| @@ -127,6 +128,7 @@ struct ehci_hcd { /* one per controller */ | |||
| 127 | unsigned big_endian_desc:1; | 128 | unsigned big_endian_desc:1; |
| 128 | unsigned has_amcc_usb23:1; | 129 | unsigned has_amcc_usb23:1; |
| 129 | unsigned need_io_watchdog:1; | 130 | unsigned need_io_watchdog:1; |
| 131 | unsigned broken_periodic:1; | ||
| 130 | 132 | ||
| 131 | /* required for usb32 quirk */ | 133 | /* required for usb32 quirk */ |
| 132 | #define OHCI_CTRL_HCFS (3 << 6) | 134 | #define OHCI_CTRL_HCFS (3 << 6) |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 78bb7710f36d..24eb74781919 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
| @@ -87,6 +87,7 @@ static int ohci_restart (struct ohci_hcd *ohci); | |||
| 87 | #ifdef CONFIG_PCI | 87 | #ifdef CONFIG_PCI |
| 88 | static void quirk_amd_pll(int state); | 88 | static void quirk_amd_pll(int state); |
| 89 | static void amd_iso_dev_put(void); | 89 | static void amd_iso_dev_put(void); |
| 90 | static void sb800_prefetch(struct ohci_hcd *ohci, int on); | ||
| 90 | #else | 91 | #else |
| 91 | static inline void quirk_amd_pll(int state) | 92 | static inline void quirk_amd_pll(int state) |
| 92 | { | 93 | { |
| @@ -96,6 +97,10 @@ static inline void amd_iso_dev_put(void) | |||
| 96 | { | 97 | { |
| 97 | return; | 98 | return; |
| 98 | } | 99 | } |
| 100 | static inline void sb800_prefetch(struct ohci_hcd *ohci, int on) | ||
| 101 | { | ||
| 102 | return; | ||
| 103 | } | ||
| 99 | #endif | 104 | #endif |
| 100 | 105 | ||
| 101 | 106 | ||
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index d2ba04dd785e..b8a1148f248e 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
| @@ -177,6 +177,13 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd) | |||
| 177 | return 0; | 177 | return 0; |
| 178 | 178 | ||
| 179 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); | 179 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); |
| 180 | |||
| 181 | /* SB800 needs pre-fetch fix */ | ||
| 182 | if ((rev >= 0x40) && (rev <= 0x4f)) { | ||
| 183 | ohci->flags |= OHCI_QUIRK_AMD_PREFETCH; | ||
| 184 | ohci_dbg(ohci, "enabled AMD prefetch quirk\n"); | ||
| 185 | } | ||
| 186 | |||
| 180 | if ((rev > 0x3b) || (rev < 0x30)) { | 187 | if ((rev > 0x3b) || (rev < 0x30)) { |
| 181 | pci_dev_put(amd_smbus_dev); | 188 | pci_dev_put(amd_smbus_dev); |
| 182 | amd_smbus_dev = NULL; | 189 | amd_smbus_dev = NULL; |
| @@ -262,6 +269,19 @@ static void amd_iso_dev_put(void) | |||
| 262 | 269 | ||
| 263 | } | 270 | } |
| 264 | 271 | ||
| 272 | static void sb800_prefetch(struct ohci_hcd *ohci, int on) | ||
| 273 | { | ||
| 274 | struct pci_dev *pdev; | ||
| 275 | u16 misc; | ||
| 276 | |||
| 277 | pdev = to_pci_dev(ohci_to_hcd(ohci)->self.controller); | ||
| 278 | pci_read_config_word(pdev, 0x50, &misc); | ||
| 279 | if (on == 0) | ||
| 280 | pci_write_config_word(pdev, 0x50, misc & 0xfcff); | ||
| 281 | else | ||
| 282 | pci_write_config_word(pdev, 0x50, misc | 0x0300); | ||
| 283 | } | ||
| 284 | |||
| 265 | /* List of quirks for OHCI */ | 285 | /* List of quirks for OHCI */ |
| 266 | static const struct pci_device_id ohci_pci_quirks[] = { | 286 | static const struct pci_device_id ohci_pci_quirks[] = { |
| 267 | { | 287 | { |
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index 16fecb8ecc39..35288bcae0db 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c | |||
| @@ -49,9 +49,12 @@ __acquires(ohci->lock) | |||
| 49 | switch (usb_pipetype (urb->pipe)) { | 49 | switch (usb_pipetype (urb->pipe)) { |
| 50 | case PIPE_ISOCHRONOUS: | 50 | case PIPE_ISOCHRONOUS: |
| 51 | ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs--; | 51 | ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs--; |
| 52 | if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0 | 52 | if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0) { |
| 53 | && quirk_amdiso(ohci)) | 53 | if (quirk_amdiso(ohci)) |
| 54 | quirk_amd_pll(1); | 54 | quirk_amd_pll(1); |
| 55 | if (quirk_amdprefetch(ohci)) | ||
| 56 | sb800_prefetch(ohci, 0); | ||
| 57 | } | ||
| 55 | break; | 58 | break; |
| 56 | case PIPE_INTERRUPT: | 59 | case PIPE_INTERRUPT: |
| 57 | ohci_to_hcd(ohci)->self.bandwidth_int_reqs--; | 60 | ohci_to_hcd(ohci)->self.bandwidth_int_reqs--; |
| @@ -680,9 +683,12 @@ static void td_submit_urb ( | |||
| 680 | data + urb->iso_frame_desc [cnt].offset, | 683 | data + urb->iso_frame_desc [cnt].offset, |
| 681 | urb->iso_frame_desc [cnt].length, urb, cnt); | 684 | urb->iso_frame_desc [cnt].length, urb, cnt); |
| 682 | } | 685 | } |
| 683 | if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0 | 686 | if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0) { |
| 684 | && quirk_amdiso(ohci)) | 687 | if (quirk_amdiso(ohci)) |
| 685 | quirk_amd_pll(0); | 688 | quirk_amd_pll(0); |
| 689 | if (quirk_amdprefetch(ohci)) | ||
| 690 | sb800_prefetch(ohci, 1); | ||
| 691 | } | ||
| 686 | periodic = ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs++ == 0 | 692 | periodic = ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs++ == 0 |
| 687 | && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0; | 693 | && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0; |
| 688 | break; | 694 | break; |
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 222011f6172c..5bf15fed0d9f 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h | |||
| @@ -402,6 +402,7 @@ struct ohci_hcd { | |||
| 402 | #define OHCI_QUIRK_FRAME_NO 0x80 /* no big endian frame_no shift */ | 402 | #define OHCI_QUIRK_FRAME_NO 0x80 /* no big endian frame_no shift */ |
| 403 | #define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */ | 403 | #define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */ |
| 404 | #define OHCI_QUIRK_AMD_ISO 0x200 /* ISO transfers*/ | 404 | #define OHCI_QUIRK_AMD_ISO 0x200 /* ISO transfers*/ |
| 405 | #define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */ | ||
| 405 | // there are also chip quirks/bugs in init logic | 406 | // there are also chip quirks/bugs in init logic |
| 406 | 407 | ||
| 407 | struct work_struct nec_work; /* Worker for NEC quirk */ | 408 | struct work_struct nec_work; /* Worker for NEC quirk */ |
| @@ -433,6 +434,10 @@ static inline int quirk_amdiso(struct ohci_hcd *ohci) | |||
| 433 | { | 434 | { |
| 434 | return ohci->flags & OHCI_QUIRK_AMD_ISO; | 435 | return ohci->flags & OHCI_QUIRK_AMD_ISO; |
| 435 | } | 436 | } |
| 437 | static inline int quirk_amdprefetch(struct ohci_hcd *ohci) | ||
| 438 | { | ||
| 439 | return ohci->flags & OHCI_QUIRK_AMD_PREFETCH; | ||
| 440 | } | ||
| 436 | #else | 441 | #else |
| 437 | static inline int quirk_nec(struct ohci_hcd *ohci) | 442 | static inline int quirk_nec(struct ohci_hcd *ohci) |
| 438 | { | 443 | { |
| @@ -446,6 +451,10 @@ static inline int quirk_amdiso(struct ohci_hcd *ohci) | |||
| 446 | { | 451 | { |
| 447 | return 0; | 452 | return 0; |
| 448 | } | 453 | } |
| 454 | static inline int quirk_amdprefetch(struct ohci_hcd *ohci) | ||
| 455 | { | ||
| 456 | return 0; | ||
| 457 | } | ||
| 449 | #endif | 458 | #endif |
| 450 | 459 | ||
| 451 | /* convert between an hcd pointer and the corresponding ohci_hcd */ | 460 | /* convert between an hcd pointer and the corresponding ohci_hcd */ |
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 516848dd9b48..39d253e841f6 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c | |||
| @@ -37,28 +37,8 @@ MODULE_LICENSE("GPL"); | |||
| 37 | /* MACROS */ | 37 | /* MACROS */ |
| 38 | /*====================================================================*/ | 38 | /*====================================================================*/ |
| 39 | 39 | ||
| 40 | #if defined(DEBUG) || defined(PCMCIA_DEBUG) | ||
| 41 | |||
| 42 | static int pc_debug = 0; | ||
| 43 | module_param(pc_debug, int, 0644); | ||
| 44 | |||
| 45 | #define DBG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG "sl811_cs: " args) | ||
| 46 | |||
| 47 | #else | ||
| 48 | #define DBG(n, args...) do{}while(0) | ||
| 49 | #endif /* no debugging */ | ||
| 50 | |||
| 51 | #define INFO(args...) printk(KERN_INFO "sl811_cs: " args) | 40 | #define INFO(args...) printk(KERN_INFO "sl811_cs: " args) |
| 52 | 41 | ||
| 53 | #define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0444) | ||
| 54 | |||
| 55 | #define CS_CHECK(fn, ret) \ | ||
| 56 | do { \ | ||
| 57 | last_fn = (fn); \ | ||
| 58 | if ((last_ret = (ret)) != 0) \ | ||
| 59 | goto cs_failed; \ | ||
| 60 | } while (0) | ||
| 61 | |||
| 62 | /*====================================================================*/ | 42 | /*====================================================================*/ |
| 63 | /* VARIABLES */ | 43 | /* VARIABLES */ |
| 64 | /*====================================================================*/ | 44 | /*====================================================================*/ |
| @@ -76,7 +56,7 @@ static void sl811_cs_release(struct pcmcia_device * link); | |||
| 76 | 56 | ||
| 77 | static void release_platform_dev(struct device * dev) | 57 | static void release_platform_dev(struct device * dev) |
| 78 | { | 58 | { |
| 79 | DBG(0, "sl811_cs platform_dev release\n"); | 59 | dev_dbg(dev, "sl811_cs platform_dev release\n"); |
| 80 | dev->parent = NULL; | 60 | dev->parent = NULL; |
| 81 | } | 61 | } |
| 82 | 62 | ||
| @@ -140,7 +120,7 @@ static int sl811_hc_init(struct device *parent, resource_size_t base_addr, | |||
| 140 | 120 | ||
| 141 | static void sl811_cs_detach(struct pcmcia_device *link) | 121 | static void sl811_cs_detach(struct pcmcia_device *link) |
| 142 | { | 122 | { |
| 143 | DBG(0, "sl811_cs_detach(0x%p)\n", link); | 123 | dev_dbg(&link->dev, "sl811_cs_detach\n"); |
| 144 | 124 | ||
| 145 | sl811_cs_release(link); | 125 | sl811_cs_release(link); |
| 146 | 126 | ||
| @@ -150,7 +130,7 @@ static void sl811_cs_detach(struct pcmcia_device *link) | |||
| 150 | 130 | ||
| 151 | static void sl811_cs_release(struct pcmcia_device * link) | 131 | static void sl811_cs_release(struct pcmcia_device * link) |
| 152 | { | 132 | { |
| 153 | DBG(0, "sl811_cs_release(0x%p)\n", link); | 133 | dev_dbg(&link->dev, "sl811_cs_release\n"); |
| 154 | 134 | ||
| 155 | pcmcia_disable_device(link); | 135 | pcmcia_disable_device(link); |
| 156 | platform_device_unregister(&platform_dev); | 136 | platform_device_unregister(&platform_dev); |
| @@ -205,11 +185,11 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev, | |||
| 205 | 185 | ||
| 206 | static int sl811_cs_config(struct pcmcia_device *link) | 186 | static int sl811_cs_config(struct pcmcia_device *link) |
| 207 | { | 187 | { |
| 208 | struct device *parent = &handle_to_dev(link); | 188 | struct device *parent = &link->dev; |
| 209 | local_info_t *dev = link->priv; | 189 | local_info_t *dev = link->priv; |
| 210 | int last_fn, last_ret; | 190 | int ret; |
| 211 | 191 | ||
| 212 | DBG(0, "sl811_cs_config(0x%p)\n", link); | 192 | dev_dbg(&link->dev, "sl811_cs_config\n"); |
| 213 | 193 | ||
| 214 | if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) | 194 | if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) |
| 215 | goto failed; | 195 | goto failed; |
| @@ -217,14 +197,16 @@ static int sl811_cs_config(struct pcmcia_device *link) | |||
| 217 | /* require an IRQ and two registers */ | 197 | /* require an IRQ and two registers */ |
| 218 | if (!link->io.NumPorts1 || link->io.NumPorts1 < 2) | 198 | if (!link->io.NumPorts1 || link->io.NumPorts1 < 2) |
| 219 | goto failed; | 199 | goto failed; |
| 220 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 200 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 221 | CS_CHECK(RequestIRQ, | 201 | ret = pcmcia_request_irq(link, &link->irq); |
| 222 | pcmcia_request_irq(link, &link->irq)); | 202 | if (ret) |
| 223 | else | 203 | goto failed; |
| 204 | } else | ||
| 224 | goto failed; | 205 | goto failed; |
| 225 | 206 | ||
| 226 | CS_CHECK(RequestConfiguration, | 207 | ret = pcmcia_request_configuration(link, &link->conf); |
| 227 | pcmcia_request_configuration(link, &link->conf)); | 208 | if (ret) |
| 209 | goto failed; | ||
| 228 | 210 | ||
| 229 | sprintf(dev->node.dev_name, driver_name); | 211 | sprintf(dev->node.dev_name, driver_name); |
| 230 | dev->node.major = dev->node.minor = 0; | 212 | dev->node.major = dev->node.minor = 0; |
| @@ -241,8 +223,6 @@ static int sl811_cs_config(struct pcmcia_device *link) | |||
| 241 | 223 | ||
| 242 | if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ) | 224 | if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ) |
| 243 | < 0) { | 225 | < 0) { |
| 244 | cs_failed: | ||
| 245 | cs_error(link, last_fn, last_ret); | ||
| 246 | failed: | 226 | failed: |
| 247 | printk(KERN_WARNING "sl811_cs_config failed\n"); | 227 | printk(KERN_WARNING "sl811_cs_config failed\n"); |
| 248 | sl811_cs_release(link); | 228 | sl811_cs_release(link); |
| @@ -263,7 +243,6 @@ static int sl811_cs_probe(struct pcmcia_device *link) | |||
| 263 | 243 | ||
| 264 | /* Initialize */ | 244 | /* Initialize */ |
| 265 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 245 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
| 266 | link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; | ||
| 267 | link->irq.Handler = NULL; | 246 | link->irq.Handler = NULL; |
| 268 | 247 | ||
| 269 | link->conf.Attributes = 0; | 248 | link->conf.Attributes = 0; |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 1db4fea8c170..b8fd270a8b0d 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
| @@ -802,9 +802,11 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
| 802 | int i; | 802 | int i; |
| 803 | 803 | ||
| 804 | /* Free the Event Ring Segment Table and the actual Event Ring */ | 804 | /* Free the Event Ring Segment Table and the actual Event Ring */ |
| 805 | xhci_writel(xhci, 0, &xhci->ir_set->erst_size); | 805 | if (xhci->ir_set) { |
| 806 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_base); | 806 | xhci_writel(xhci, 0, &xhci->ir_set->erst_size); |
| 807 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue); | 807 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_base); |
| 808 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue); | ||
| 809 | } | ||
| 808 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); | 810 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); |
| 809 | if (xhci->erst.entries) | 811 | if (xhci->erst.entries) |
| 810 | pci_free_consistent(pdev, size, | 812 | pci_free_consistent(pdev, size, |
| @@ -841,9 +843,9 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
| 841 | xhci->dcbaa, xhci->dcbaa->dma); | 843 | xhci->dcbaa, xhci->dcbaa->dma); |
| 842 | xhci->dcbaa = NULL; | 844 | xhci->dcbaa = NULL; |
| 843 | 845 | ||
| 846 | scratchpad_free(xhci); | ||
| 844 | xhci->page_size = 0; | 847 | xhci->page_size = 0; |
| 845 | xhci->page_shift = 0; | 848 | xhci->page_shift = 0; |
| 846 | scratchpad_free(xhci); | ||
| 847 | } | 849 | } |
| 848 | 850 | ||
| 849 | int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | 851 | int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 173c39c76489..821b7b4709de 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -864,9 +864,11 @@ static struct xhci_segment *trb_in_td( | |||
| 864 | cur_seg = start_seg; | 864 | cur_seg = start_seg; |
| 865 | 865 | ||
| 866 | do { | 866 | do { |
| 867 | if (start_dma == 0) | ||
| 868 | return 0; | ||
| 867 | /* We may get an event for a Link TRB in the middle of a TD */ | 869 | /* We may get an event for a Link TRB in the middle of a TD */ |
| 868 | end_seg_dma = xhci_trb_virt_to_dma(cur_seg, | 870 | end_seg_dma = xhci_trb_virt_to_dma(cur_seg, |
| 869 | &start_seg->trbs[TRBS_PER_SEGMENT - 1]); | 871 | &cur_seg->trbs[TRBS_PER_SEGMENT - 1]); |
| 870 | /* If the end TRB isn't in this segment, this is set to 0 */ | 872 | /* If the end TRB isn't in this segment, this is set to 0 */ |
| 871 | end_trb_dma = xhci_trb_virt_to_dma(cur_seg, end_trb); | 873 | end_trb_dma = xhci_trb_virt_to_dma(cur_seg, end_trb); |
| 872 | 874 | ||
| @@ -893,8 +895,9 @@ static struct xhci_segment *trb_in_td( | |||
| 893 | } | 895 | } |
| 894 | cur_seg = cur_seg->next; | 896 | cur_seg = cur_seg->next; |
| 895 | start_dma = xhci_trb_virt_to_dma(cur_seg, &cur_seg->trbs[0]); | 897 | start_dma = xhci_trb_virt_to_dma(cur_seg, &cur_seg->trbs[0]); |
| 896 | } while (1); | 898 | } while (cur_seg != start_seg); |
| 897 | 899 | ||
| 900 | return 0; | ||
| 898 | } | 901 | } |
| 899 | 902 | ||
| 900 | /* | 903 | /* |
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c index 9ed3e741bee1..10f3205798e8 100644 --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c | |||
| @@ -348,12 +348,12 @@ static unsigned int mon_buff_area_alloc_contiguous(struct mon_reader_bin *rp, | |||
| 348 | 348 | ||
| 349 | /* | 349 | /* |
| 350 | * Return a few (kilo-)bytes to the head of the buffer. | 350 | * Return a few (kilo-)bytes to the head of the buffer. |
| 351 | * This is used if a DMA fetch fails. | 351 | * This is used if a data fetch fails. |
| 352 | */ | 352 | */ |
| 353 | static void mon_buff_area_shrink(struct mon_reader_bin *rp, unsigned int size) | 353 | static void mon_buff_area_shrink(struct mon_reader_bin *rp, unsigned int size) |
| 354 | { | 354 | { |
| 355 | 355 | ||
| 356 | size = (size + PKT_ALIGN-1) & ~(PKT_ALIGN-1); | 356 | /* size &= ~(PKT_ALIGN-1); -- we're called with aligned size */ |
| 357 | rp->b_cnt -= size; | 357 | rp->b_cnt -= size; |
| 358 | if (rp->b_in < size) | 358 | if (rp->b_in < size) |
| 359 | rp->b_in += rp->b_size; | 359 | rp->b_in += rp->b_size; |
| @@ -433,6 +433,7 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb, | |||
| 433 | unsigned int urb_length; | 433 | unsigned int urb_length; |
| 434 | unsigned int offset; | 434 | unsigned int offset; |
| 435 | unsigned int length; | 435 | unsigned int length; |
| 436 | unsigned int delta; | ||
| 436 | unsigned int ndesc, lendesc; | 437 | unsigned int ndesc, lendesc; |
| 437 | unsigned char dir; | 438 | unsigned char dir; |
| 438 | struct mon_bin_hdr *ep; | 439 | struct mon_bin_hdr *ep; |
| @@ -537,8 +538,10 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb, | |||
| 537 | if (length != 0) { | 538 | if (length != 0) { |
| 538 | ep->flag_data = mon_bin_get_data(rp, offset, urb, length); | 539 | ep->flag_data = mon_bin_get_data(rp, offset, urb, length); |
| 539 | if (ep->flag_data != 0) { /* Yes, it's 0x00, not '0' */ | 540 | if (ep->flag_data != 0) { /* Yes, it's 0x00, not '0' */ |
| 540 | ep->len_cap = 0; | 541 | delta = (ep->len_cap + PKT_ALIGN-1) & ~(PKT_ALIGN-1); |
| 541 | mon_buff_area_shrink(rp, length); | 542 | ep->len_cap -= length; |
| 543 | delta -= (ep->len_cap + PKT_ALIGN-1) & ~(PKT_ALIGN-1); | ||
| 544 | mon_buff_area_shrink(rp, delta); | ||
| 542 | } | 545 | } |
| 543 | } else { | 546 | } else { |
| 544 | ep->flag_data = data_tag; | 547 | ep->flag_data = data_tag; |
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c index c3577bbbae6c..ef2332a9941d 100644 --- a/drivers/usb/musb/cppi_dma.c +++ b/drivers/usb/musb/cppi_dma.c | |||
| @@ -1442,11 +1442,6 @@ static int cppi_channel_abort(struct dma_channel *channel) | |||
| 1442 | musb_writew(regs, MUSB_TXCSR, value); | 1442 | musb_writew(regs, MUSB_TXCSR, value); |
| 1443 | musb_writew(regs, MUSB_TXCSR, value); | 1443 | musb_writew(regs, MUSB_TXCSR, value); |
| 1444 | 1444 | ||
| 1445 | /* re-enable interrupt */ | ||
| 1446 | if (enabled) | ||
| 1447 | musb_writel(tibase, DAVINCI_TXCPPI_INTENAB_REG, | ||
| 1448 | (1 << cppi_ch->index)); | ||
| 1449 | |||
| 1450 | /* While we scrub the TX state RAM, ensure that we clean | 1445 | /* While we scrub the TX state RAM, ensure that we clean |
| 1451 | * up any interrupt that's currently asserted: | 1446 | * up any interrupt that's currently asserted: |
| 1452 | * 1. Write to completion Ptr value 0x1(bit 0 set) | 1447 | * 1. Write to completion Ptr value 0x1(bit 0 set) |
| @@ -1459,6 +1454,11 @@ static int cppi_channel_abort(struct dma_channel *channel) | |||
| 1459 | cppi_reset_tx(tx_ram, 1); | 1454 | cppi_reset_tx(tx_ram, 1); |
| 1460 | musb_writel(&tx_ram->tx_complete, 0, 0); | 1455 | musb_writel(&tx_ram->tx_complete, 0, 0); |
| 1461 | 1456 | ||
| 1457 | /* re-enable interrupt */ | ||
| 1458 | if (enabled) | ||
| 1459 | musb_writel(tibase, DAVINCI_TXCPPI_INTENAB_REG, | ||
| 1460 | (1 << cppi_ch->index)); | ||
| 1461 | |||
| 1462 | cppi_dump_tx(5, cppi_ch, " (done teardown)"); | 1462 | cppi_dump_tx(5, cppi_ch, " (done teardown)"); |
| 1463 | 1463 | ||
| 1464 | /* REVISIT tx side _should_ clean up the same way | 1464 | /* REVISIT tx side _should_ clean up the same way |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 3a61ddb62bd2..547e0e390726 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
| @@ -1450,7 +1450,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) | |||
| 1450 | #endif | 1450 | #endif |
| 1451 | 1451 | ||
| 1452 | if (hw_ep->max_packet_sz_tx) { | 1452 | if (hw_ep->max_packet_sz_tx) { |
| 1453 | printk(KERN_DEBUG | 1453 | DBG(1, |
| 1454 | "%s: hw_ep %d%s, %smax %d\n", | 1454 | "%s: hw_ep %d%s, %smax %d\n", |
| 1455 | musb_driver_name, i, | 1455 | musb_driver_name, i, |
| 1456 | hw_ep->is_shared_fifo ? "shared" : "tx", | 1456 | hw_ep->is_shared_fifo ? "shared" : "tx", |
| @@ -1459,7 +1459,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) | |||
| 1459 | hw_ep->max_packet_sz_tx); | 1459 | hw_ep->max_packet_sz_tx); |
| 1460 | } | 1460 | } |
| 1461 | if (hw_ep->max_packet_sz_rx && !hw_ep->is_shared_fifo) { | 1461 | if (hw_ep->max_packet_sz_rx && !hw_ep->is_shared_fifo) { |
| 1462 | printk(KERN_DEBUG | 1462 | DBG(1, |
| 1463 | "%s: hw_ep %d%s, %smax %d\n", | 1463 | "%s: hw_ep %d%s, %smax %d\n", |
| 1464 | musb_driver_name, i, | 1464 | musb_driver_name, i, |
| 1465 | "rx", | 1465 | "rx", |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 8b3c4e2ed7b8..74073f9a43f0 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | * Copyright 2005 Mentor Graphics Corporation | 4 | * Copyright 2005 Mentor Graphics Corporation |
| 5 | * Copyright (C) 2005-2006 by Texas Instruments | 5 | * Copyright (C) 2005-2006 by Texas Instruments |
| 6 | * Copyright (C) 2006-2007 Nokia Corporation | 6 | * Copyright (C) 2006-2007 Nokia Corporation |
| 7 | * Copyright (C) 2009 MontaVista Software, Inc. <source@mvista.com> | ||
| 7 | * | 8 | * |
| 8 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
| @@ -436,14 +437,6 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
| 436 | csr |= MUSB_TXCSR_P_WZC_BITS; | 437 | csr |= MUSB_TXCSR_P_WZC_BITS; |
| 437 | csr &= ~MUSB_TXCSR_P_SENTSTALL; | 438 | csr &= ~MUSB_TXCSR_P_SENTSTALL; |
| 438 | musb_writew(epio, MUSB_TXCSR, csr); | 439 | musb_writew(epio, MUSB_TXCSR, csr); |
| 439 | if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) { | ||
| 440 | dma->status = MUSB_DMA_STATUS_CORE_ABORT; | ||
| 441 | musb->dma_controller->channel_abort(dma); | ||
| 442 | } | ||
| 443 | |||
| 444 | if (request) | ||
| 445 | musb_g_giveback(musb_ep, request, -EPIPE); | ||
| 446 | |||
| 447 | break; | 440 | break; |
| 448 | } | 441 | } |
| 449 | 442 | ||
| @@ -582,15 +575,25 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
| 582 | */ | 575 | */ |
| 583 | static void rxstate(struct musb *musb, struct musb_request *req) | 576 | static void rxstate(struct musb *musb, struct musb_request *req) |
| 584 | { | 577 | { |
| 585 | u16 csr = 0; | ||
| 586 | const u8 epnum = req->epnum; | 578 | const u8 epnum = req->epnum; |
| 587 | struct usb_request *request = &req->request; | 579 | struct usb_request *request = &req->request; |
| 588 | struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; | 580 | struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; |
| 589 | void __iomem *epio = musb->endpoints[epnum].regs; | 581 | void __iomem *epio = musb->endpoints[epnum].regs; |
| 590 | unsigned fifo_count = 0; | 582 | unsigned fifo_count = 0; |
| 591 | u16 len = musb_ep->packet_sz; | 583 | u16 len = musb_ep->packet_sz; |
| 584 | u16 csr = musb_readw(epio, MUSB_RXCSR); | ||
| 592 | 585 | ||
| 593 | csr = musb_readw(epio, MUSB_RXCSR); | 586 | /* We shouldn't get here while DMA is active, but we do... */ |
| 587 | if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) { | ||
| 588 | DBG(4, "DMA pending...\n"); | ||
| 589 | return; | ||
| 590 | } | ||
| 591 | |||
| 592 | if (csr & MUSB_RXCSR_P_SENDSTALL) { | ||
| 593 | DBG(5, "%s stalling, RXCSR %04x\n", | ||
| 594 | musb_ep->end_point.name, csr); | ||
| 595 | return; | ||
| 596 | } | ||
| 594 | 597 | ||
| 595 | if (is_cppi_enabled() && musb_ep->dma) { | 598 | if (is_cppi_enabled() && musb_ep->dma) { |
| 596 | struct dma_controller *c = musb->dma_controller; | 599 | struct dma_controller *c = musb->dma_controller; |
| @@ -761,19 +764,10 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
| 761 | csr, dma ? " (dma)" : "", request); | 764 | csr, dma ? " (dma)" : "", request); |
| 762 | 765 | ||
| 763 | if (csr & MUSB_RXCSR_P_SENTSTALL) { | 766 | if (csr & MUSB_RXCSR_P_SENTSTALL) { |
| 764 | if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) { | ||
| 765 | dma->status = MUSB_DMA_STATUS_CORE_ABORT; | ||
| 766 | (void) musb->dma_controller->channel_abort(dma); | ||
| 767 | request->actual += musb_ep->dma->actual_len; | ||
| 768 | } | ||
| 769 | |||
| 770 | csr |= MUSB_RXCSR_P_WZC_BITS; | 767 | csr |= MUSB_RXCSR_P_WZC_BITS; |
| 771 | csr &= ~MUSB_RXCSR_P_SENTSTALL; | 768 | csr &= ~MUSB_RXCSR_P_SENTSTALL; |
| 772 | musb_writew(epio, MUSB_RXCSR, csr); | 769 | musb_writew(epio, MUSB_RXCSR, csr); |
| 773 | 770 | return; | |
| 774 | if (request) | ||
| 775 | musb_g_giveback(musb_ep, request, -EPIPE); | ||
| 776 | goto done; | ||
| 777 | } | 771 | } |
| 778 | 772 | ||
| 779 | if (csr & MUSB_RXCSR_P_OVERRUN) { | 773 | if (csr & MUSB_RXCSR_P_OVERRUN) { |
| @@ -795,7 +789,7 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
| 795 | DBG((csr & MUSB_RXCSR_DMAENAB) ? 4 : 1, | 789 | DBG((csr & MUSB_RXCSR_DMAENAB) ? 4 : 1, |
| 796 | "%s busy, csr %04x\n", | 790 | "%s busy, csr %04x\n", |
| 797 | musb_ep->end_point.name, csr); | 791 | musb_ep->end_point.name, csr); |
| 798 | goto done; | 792 | return; |
| 799 | } | 793 | } |
| 800 | 794 | ||
| 801 | if (dma && (csr & MUSB_RXCSR_DMAENAB)) { | 795 | if (dma && (csr & MUSB_RXCSR_DMAENAB)) { |
| @@ -826,22 +820,15 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
| 826 | if ((request->actual < request->length) | 820 | if ((request->actual < request->length) |
| 827 | && (musb_ep->dma->actual_len | 821 | && (musb_ep->dma->actual_len |
| 828 | == musb_ep->packet_sz)) | 822 | == musb_ep->packet_sz)) |
| 829 | goto done; | 823 | return; |
| 830 | #endif | 824 | #endif |
| 831 | musb_g_giveback(musb_ep, request, 0); | 825 | musb_g_giveback(musb_ep, request, 0); |
| 832 | 826 | ||
| 833 | request = next_request(musb_ep); | 827 | request = next_request(musb_ep); |
| 834 | if (!request) | 828 | if (!request) |
| 835 | goto done; | 829 | return; |
| 836 | |||
| 837 | /* don't start more i/o till the stall clears */ | ||
| 838 | musb_ep_select(mbase, epnum); | ||
| 839 | csr = musb_readw(epio, MUSB_RXCSR); | ||
| 840 | if (csr & MUSB_RXCSR_P_SENDSTALL) | ||
| 841 | goto done; | ||
| 842 | } | 830 | } |
| 843 | 831 | ||
| 844 | |||
| 845 | /* analyze request if the ep is hot */ | 832 | /* analyze request if the ep is hot */ |
| 846 | if (request) | 833 | if (request) |
| 847 | rxstate(musb, to_musb_request(request)); | 834 | rxstate(musb, to_musb_request(request)); |
| @@ -849,8 +836,6 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
| 849 | DBG(3, "packet waiting for %s%s request\n", | 836 | DBG(3, "packet waiting for %s%s request\n", |
| 850 | musb_ep->desc ? "" : "inactive ", | 837 | musb_ep->desc ? "" : "inactive ", |
| 851 | musb_ep->end_point.name); | 838 | musb_ep->end_point.name); |
| 852 | |||
| 853 | done: | ||
| 854 | return; | 839 | return; |
| 855 | } | 840 | } |
| 856 | 841 | ||
| @@ -1244,7 +1229,7 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value) | |||
| 1244 | void __iomem *mbase; | 1229 | void __iomem *mbase; |
| 1245 | unsigned long flags; | 1230 | unsigned long flags; |
| 1246 | u16 csr; | 1231 | u16 csr; |
| 1247 | struct musb_request *request = NULL; | 1232 | struct musb_request *request; |
| 1248 | int status = 0; | 1233 | int status = 0; |
| 1249 | 1234 | ||
| 1250 | if (!ep) | 1235 | if (!ep) |
| @@ -1260,24 +1245,29 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value) | |||
| 1260 | 1245 | ||
| 1261 | musb_ep_select(mbase, epnum); | 1246 | musb_ep_select(mbase, epnum); |
| 1262 | 1247 | ||
| 1263 | /* cannot portably stall with non-empty FIFO */ | ||
| 1264 | request = to_musb_request(next_request(musb_ep)); | 1248 | request = to_musb_request(next_request(musb_ep)); |
| 1265 | if (value && musb_ep->is_in) { | 1249 | if (value) { |
| 1266 | csr = musb_readw(epio, MUSB_TXCSR); | 1250 | if (request) { |
| 1267 | if (csr & MUSB_TXCSR_FIFONOTEMPTY) { | 1251 | DBG(3, "request in progress, cannot halt %s\n", |
| 1268 | DBG(3, "%s fifo busy, cannot halt\n", ep->name); | 1252 | ep->name); |
| 1269 | spin_unlock_irqrestore(&musb->lock, flags); | 1253 | status = -EAGAIN; |
| 1270 | return -EAGAIN; | 1254 | goto done; |
| 1255 | } | ||
| 1256 | /* Cannot portably stall with non-empty FIFO */ | ||
| 1257 | if (musb_ep->is_in) { | ||
| 1258 | csr = musb_readw(epio, MUSB_TXCSR); | ||
| 1259 | if (csr & MUSB_TXCSR_FIFONOTEMPTY) { | ||
| 1260 | DBG(3, "FIFO busy, cannot halt %s\n", ep->name); | ||
| 1261 | status = -EAGAIN; | ||
| 1262 | goto done; | ||
| 1263 | } | ||
| 1271 | } | 1264 | } |
| 1272 | |||
| 1273 | } | 1265 | } |
| 1274 | 1266 | ||
| 1275 | /* set/clear the stall and toggle bits */ | 1267 | /* set/clear the stall and toggle bits */ |
| 1276 | DBG(2, "%s: %s stall\n", ep->name, value ? "set" : "clear"); | 1268 | DBG(2, "%s: %s stall\n", ep->name, value ? "set" : "clear"); |
| 1277 | if (musb_ep->is_in) { | 1269 | if (musb_ep->is_in) { |
| 1278 | csr = musb_readw(epio, MUSB_TXCSR); | 1270 | csr = musb_readw(epio, MUSB_TXCSR); |
| 1279 | if (csr & MUSB_TXCSR_FIFONOTEMPTY) | ||
| 1280 | csr |= MUSB_TXCSR_FLUSHFIFO; | ||
| 1281 | csr |= MUSB_TXCSR_P_WZC_BITS | 1271 | csr |= MUSB_TXCSR_P_WZC_BITS |
| 1282 | | MUSB_TXCSR_CLRDATATOG; | 1272 | | MUSB_TXCSR_CLRDATATOG; |
| 1283 | if (value) | 1273 | if (value) |
| @@ -1300,14 +1290,13 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value) | |||
| 1300 | musb_writew(epio, MUSB_RXCSR, csr); | 1290 | musb_writew(epio, MUSB_RXCSR, csr); |
| 1301 | } | 1291 | } |
| 1302 | 1292 | ||
| 1303 | done: | ||
| 1304 | |||
| 1305 | /* maybe start the first request in the queue */ | 1293 | /* maybe start the first request in the queue */ |
| 1306 | if (!musb_ep->busy && !value && request) { | 1294 | if (!musb_ep->busy && !value && request) { |
| 1307 | DBG(3, "restarting the request\n"); | 1295 | DBG(3, "restarting the request\n"); |
| 1308 | musb_ep_restart(musb, request); | 1296 | musb_ep_restart(musb, request); |
| 1309 | } | 1297 | } |
| 1310 | 1298 | ||
| 1299 | done: | ||
| 1311 | spin_unlock_irqrestore(&musb->lock, flags); | 1300 | spin_unlock_irqrestore(&musb->lock, flags); |
| 1312 | return status; | 1301 | return status; |
| 1313 | } | 1302 | } |
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c index 7a6778675ad3..522efb31b56b 100644 --- a/drivers/usb/musb/musb_gadget_ep0.c +++ b/drivers/usb/musb/musb_gadget_ep0.c | |||
| @@ -511,7 +511,8 @@ static void ep0_txstate(struct musb *musb) | |||
| 511 | 511 | ||
| 512 | /* update the flags */ | 512 | /* update the flags */ |
| 513 | if (fifo_count < MUSB_MAX_END0_PACKET | 513 | if (fifo_count < MUSB_MAX_END0_PACKET |
| 514 | || request->actual == request->length) { | 514 | || (request->actual == request->length |
| 515 | && !request->zero)) { | ||
| 515 | musb->ep0_state = MUSB_EP0_STAGE_STATUSOUT; | 516 | musb->ep0_state = MUSB_EP0_STAGE_STATUSOUT; |
| 516 | csr |= MUSB_CSR0_P_DATAEND; | 517 | csr |= MUSB_CSR0_P_DATAEND; |
| 517 | } else | 518 | } else |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index cf94511485f2..e3ab40a966eb 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
| @@ -1301,8 +1301,11 @@ void musb_host_tx(struct musb *musb, u8 epnum) | |||
| 1301 | return; | 1301 | return; |
| 1302 | } else if (usb_pipeisoc(pipe) && dma) { | 1302 | } else if (usb_pipeisoc(pipe) && dma) { |
| 1303 | if (musb_tx_dma_program(musb->dma_controller, hw_ep, qh, urb, | 1303 | if (musb_tx_dma_program(musb->dma_controller, hw_ep, qh, urb, |
| 1304 | offset, length)) | 1304 | offset, length)) { |
| 1305 | if (is_cppi_enabled() || tusb_dma_omap()) | ||
| 1306 | musb_h_tx_dma_start(hw_ep); | ||
| 1305 | return; | 1307 | return; |
| 1308 | } | ||
| 1306 | } else if (tx_csr & MUSB_TXCSR_DMAENAB) { | 1309 | } else if (tx_csr & MUSB_TXCSR_DMAENAB) { |
| 1307 | DBG(1, "not complete, but DMA enabled?\n"); | 1310 | DBG(1, "not complete, but DMA enabled?\n"); |
| 1308 | return; | 1311 | return; |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 698252a4dc5d..bd254ec97d14 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
| @@ -50,6 +50,8 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *, | |||
| 50 | static void cp210x_break_ctl(struct tty_struct *, int); | 50 | static void cp210x_break_ctl(struct tty_struct *, int); |
| 51 | static int cp210x_startup(struct usb_serial *); | 51 | static int cp210x_startup(struct usb_serial *); |
| 52 | static void cp210x_disconnect(struct usb_serial *); | 52 | static void cp210x_disconnect(struct usb_serial *); |
| 53 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on); | ||
| 54 | static int cp210x_carrier_raised(struct usb_serial_port *p); | ||
| 53 | 55 | ||
| 54 | static int debug; | 56 | static int debug; |
| 55 | 57 | ||
| @@ -143,6 +145,8 @@ static struct usb_serial_driver cp210x_device = { | |||
| 143 | .tiocmset = cp210x_tiocmset, | 145 | .tiocmset = cp210x_tiocmset, |
| 144 | .attach = cp210x_startup, | 146 | .attach = cp210x_startup, |
| 145 | .disconnect = cp210x_disconnect, | 147 | .disconnect = cp210x_disconnect, |
| 148 | .dtr_rts = cp210x_dtr_rts, | ||
| 149 | .carrier_raised = cp210x_carrier_raised | ||
| 146 | }; | 150 | }; |
| 147 | 151 | ||
| 148 | /* Config request types */ | 152 | /* Config request types */ |
| @@ -746,6 +750,14 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *file, | |||
| 746 | return cp210x_set_config(port, CP210X_SET_MHS, &control, 2); | 750 | return cp210x_set_config(port, CP210X_SET_MHS, &control, 2); |
| 747 | } | 751 | } |
| 748 | 752 | ||
| 753 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on) | ||
| 754 | { | ||
| 755 | if (on) | ||
| 756 | cp210x_tiocmset_port(p, NULL, TIOCM_DTR|TIOCM_RTS, 0); | ||
| 757 | else | ||
| 758 | cp210x_tiocmset_port(p, NULL, 0, TIOCM_DTR|TIOCM_RTS); | ||
| 759 | } | ||
| 760 | |||
| 749 | static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) | 761 | static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) |
| 750 | { | 762 | { |
| 751 | struct usb_serial_port *port = tty->driver_data; | 763 | struct usb_serial_port *port = tty->driver_data; |
| @@ -768,6 +780,15 @@ static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) | |||
| 768 | return result; | 780 | return result; |
| 769 | } | 781 | } |
| 770 | 782 | ||
| 783 | static int cp210x_carrier_raised(struct usb_serial_port *p) | ||
| 784 | { | ||
| 785 | unsigned int control; | ||
| 786 | cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1); | ||
| 787 | if (control & CONTROL_DCD) | ||
| 788 | return 1; | ||
| 789 | return 0; | ||
| 790 | } | ||
| 791 | |||
| 771 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) | 792 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) |
| 772 | { | 793 | { |
| 773 | struct usb_serial_port *port = tty->driver_data; | 794 | struct usb_serial_port *port = tty->driver_data; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 9c60d6d4908a..ebcc6d0e2e91 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -1937,7 +1937,7 @@ static void ftdi_write_bulk_callback(struct urb *urb) | |||
| 1937 | return; | 1937 | return; |
| 1938 | } | 1938 | } |
| 1939 | /* account for transferred data */ | 1939 | /* account for transferred data */ |
| 1940 | countback = urb->actual_length; | 1940 | countback = urb->transfer_buffer_length; |
| 1941 | data_offset = priv->write_offset; | 1941 | data_offset = priv->write_offset; |
| 1942 | if (data_offset > 0) { | 1942 | if (data_offset > 0) { |
| 1943 | /* Subtract the control bytes */ | 1943 | /* Subtract the control bytes */ |
| @@ -1950,7 +1950,6 @@ static void ftdi_write_bulk_callback(struct urb *urb) | |||
| 1950 | 1950 | ||
| 1951 | if (status) { | 1951 | if (status) { |
| 1952 | dbg("nonzero write bulk status received: %d", status); | 1952 | dbg("nonzero write bulk status received: %d", status); |
| 1953 | return; | ||
| 1954 | } | 1953 | } |
| 1955 | 1954 | ||
| 1956 | usb_serial_port_softint(port); | 1955 | usb_serial_port_softint(port); |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index cd44c68954df..0577e4b61114 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -308,6 +308,7 @@ static int option_resume(struct usb_serial *serial); | |||
| 308 | 308 | ||
| 309 | #define DLINK_VENDOR_ID 0x1186 | 309 | #define DLINK_VENDOR_ID 0x1186 |
| 310 | #define DLINK_PRODUCT_DWM_652 0x3e04 | 310 | #define DLINK_PRODUCT_DWM_652 0x3e04 |
| 311 | #define DLINK_PRODUCT_DWM_652_U5 0xce16 | ||
| 311 | 312 | ||
| 312 | #define QISDA_VENDOR_ID 0x1da5 | 313 | #define QISDA_VENDOR_ID 0x1da5 |
| 313 | #define QISDA_PRODUCT_H21_4512 0x4512 | 314 | #define QISDA_PRODUCT_H21_4512 0x4512 |
| @@ -335,6 +336,10 @@ static int option_resume(struct usb_serial *serial); | |||
| 335 | #define AIRPLUS_VENDOR_ID 0x1011 | 336 | #define AIRPLUS_VENDOR_ID 0x1011 |
| 336 | #define AIRPLUS_PRODUCT_MCD650 0x3198 | 337 | #define AIRPLUS_PRODUCT_MCD650 0x3198 |
| 337 | 338 | ||
| 339 | /* 4G Systems products */ | ||
| 340 | #define FOUR_G_SYSTEMS_VENDOR_ID 0x1c9e | ||
| 341 | #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603 | ||
| 342 | |||
| 338 | static struct usb_device_id option_ids[] = { | 343 | static struct usb_device_id option_ids[] = { |
| 339 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 344 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
| 340 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, | 345 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
| @@ -586,6 +591,7 @@ static struct usb_device_id option_ids[] = { | |||
| 586 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, | 591 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, |
| 587 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, | 592 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, |
| 588 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, | 593 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, |
| 594 | { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */ | ||
| 589 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) }, | 595 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) }, |
| 590 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) }, | 596 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) }, |
| 591 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) }, | 597 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) }, |
| @@ -597,6 +603,7 @@ static struct usb_device_id option_ids[] = { | |||
| 597 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) }, | 603 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) }, |
| 598 | { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, | 604 | { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, |
| 599 | { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, | 605 | { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, |
| 606 | { USB_DEVICE(FOUR_G_SYSTEMS_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14) }, | ||
| 600 | { } /* Terminating entry */ | 607 | { } /* Terminating entry */ |
| 601 | }; | 608 | }; |
| 602 | MODULE_DEVICE_TABLE(usb, option_ids); | 609 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 9bbb2855ea91..188e1ba3b69f 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
| @@ -2121,7 +2121,7 @@ config FB_EP93XX | |||
| 2121 | 2121 | ||
| 2122 | config FB_PRE_INIT_FB | 2122 | config FB_PRE_INIT_FB |
| 2123 | bool "Don't reinitialize, use bootloader's GDC/Display configuration" | 2123 | bool "Don't reinitialize, use bootloader's GDC/Display configuration" |
| 2124 | depends on FB_MB862XX_LIME | 2124 | depends on FB && FB_MB862XX_LIME |
| 2125 | ---help--- | 2125 | ---help--- |
| 2126 | Select this option if display contents should be inherited as set by | 2126 | Select this option if display contents should be inherited as set by |
| 2127 | the bootloader. | 2127 | the bootloader. |
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c index 8cd279be74e5..37624f74e88b 100644 --- a/drivers/video/atafb.c +++ b/drivers/video/atafb.c | |||
| @@ -329,12 +329,6 @@ extern unsigned char fontdata_8x16[]; | |||
| 329 | * | 329 | * |
| 330 | * * perform fb specific mmap * | 330 | * * perform fb specific mmap * |
| 331 | * int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma); | 331 | * int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma); |
| 332 | * | ||
| 333 | * * save current hardware state * | ||
| 334 | * void (*fb_save_state)(struct fb_info *info); | ||
| 335 | * | ||
| 336 | * * restore saved state * | ||
| 337 | * void (*fb_restore_state)(struct fb_info *info); | ||
| 338 | * } ; | 332 | * } ; |
| 339 | */ | 333 | */ |
| 340 | 334 | ||
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 2830ffd72976..d5e801076d33 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
| @@ -484,6 +484,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
| 484 | unsigned long value; | 484 | unsigned long value; |
| 485 | unsigned long clk_value_khz; | 485 | unsigned long clk_value_khz; |
| 486 | unsigned long bits_per_line; | 486 | unsigned long bits_per_line; |
| 487 | unsigned long pix_factor = 2; | ||
| 487 | 488 | ||
| 488 | might_sleep(); | 489 | might_sleep(); |
| 489 | 490 | ||
| @@ -516,20 +517,24 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
| 516 | /* Now, the LCDC core... */ | 517 | /* Now, the LCDC core... */ |
| 517 | 518 | ||
| 518 | /* Set pixel clock */ | 519 | /* Set pixel clock */ |
| 520 | if (cpu_is_at91sam9g45() && !cpu_is_at91sam9g45es()) | ||
| 521 | pix_factor = 1; | ||
| 522 | |||
| 519 | clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000; | 523 | clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000; |
| 520 | 524 | ||
| 521 | value = DIV_ROUND_UP(clk_value_khz, PICOS2KHZ(info->var.pixclock)); | 525 | value = DIV_ROUND_UP(clk_value_khz, PICOS2KHZ(info->var.pixclock)); |
| 522 | 526 | ||
| 523 | if (value < 2) { | 527 | if (value < pix_factor) { |
| 524 | dev_notice(info->device, "Bypassing pixel clock divider\n"); | 528 | dev_notice(info->device, "Bypassing pixel clock divider\n"); |
| 525 | lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS); | 529 | lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS); |
| 526 | } else { | 530 | } else { |
| 527 | value = (value / 2) - 1; | 531 | value = (value / pix_factor) - 1; |
| 528 | dev_dbg(info->device, " * programming CLKVAL = 0x%08lx\n", | 532 | dev_dbg(info->device, " * programming CLKVAL = 0x%08lx\n", |
| 529 | value); | 533 | value); |
| 530 | lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, | 534 | lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, |
| 531 | value << ATMEL_LCDC_CLKVAL_OFFSET); | 535 | value << ATMEL_LCDC_CLKVAL_OFFSET); |
| 532 | info->var.pixclock = KHZ2PICOS(clk_value_khz / (2 * (value + 1))); | 536 | info->var.pixclock = |
| 537 | KHZ2PICOS(clk_value_khz / (pix_factor * (value + 1))); | ||
| 533 | dev_dbg(info->device, " updated pixclk: %lu KHz\n", | 538 | dev_dbg(info->device, " updated pixclk: %lu KHz\n", |
| 534 | PICOS2KHZ(info->var.pixclock)); | 539 | PICOS2KHZ(info->var.pixclock)); |
| 535 | } | 540 | } |
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index 2211a852af9c..96774949cd30 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c | |||
| @@ -433,8 +433,9 @@ static int corgi_bl_update_status(struct backlight_device *bd) | |||
| 433 | 433 | ||
| 434 | if (corgibl_flags & CORGIBL_SUSPENDED) | 434 | if (corgibl_flags & CORGIBL_SUSPENDED) |
| 435 | intensity = 0; | 435 | intensity = 0; |
| 436 | if (corgibl_flags & CORGIBL_BATTLOW) | 436 | |
| 437 | intensity &= lcd->limit_mask; | 437 | if ((corgibl_flags & CORGIBL_BATTLOW) && intensity > lcd->limit_mask) |
| 438 | intensity = lcd->limit_mask; | ||
| 438 | 439 | ||
| 439 | return corgi_bl_set_intensity(lcd, intensity); | 440 | return corgi_bl_set_intensity(lcd, intensity); |
| 440 | } | 441 | } |
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index b6449470106c..a482dd7b0311 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c | |||
| @@ -56,7 +56,7 @@ static int fb_notifier_callback(struct notifier_block *self, | |||
| 56 | 56 | ||
| 57 | static int lcd_register_fb(struct lcd_device *ld) | 57 | static int lcd_register_fb(struct lcd_device *ld) |
| 58 | { | 58 | { |
| 59 | memset(&ld->fb_notif, 0, sizeof(&ld->fb_notif)); | 59 | memset(&ld->fb_notif, 0, sizeof(ld->fb_notif)); |
| 60 | ld->fb_notif.notifier_call = fb_notifier_callback; | 60 | ld->fb_notif.notifier_call = fb_notifier_callback; |
| 61 | return fb_register_client(&ld->fb_notif); | 61 | return fb_register_client(&ld->fb_notif); |
| 62 | } | 62 | } |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 5a686cea23f4..3681c6a88212 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
| @@ -2311,14 +2311,11 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) | |||
| 2311 | ops->graphics = 1; | 2311 | ops->graphics = 1; |
| 2312 | 2312 | ||
| 2313 | if (!blank) { | 2313 | if (!blank) { |
| 2314 | if (info->fbops->fb_save_state) | ||
| 2315 | info->fbops->fb_save_state(info); | ||
| 2316 | var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE; | 2314 | var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE; |
| 2317 | fb_set_var(info, &var); | 2315 | fb_set_var(info, &var); |
| 2318 | ops->graphics = 0; | 2316 | ops->graphics = 0; |
| 2319 | ops->var = info->var; | 2317 | ops->var = info->var; |
| 2320 | } else if (info->fbops->fb_restore_state) | 2318 | } |
| 2321 | info->fbops->fb_restore_state(info); | ||
| 2322 | } | 2319 | } |
| 2323 | 2320 | ||
| 2324 | if (!fbcon_is_inactive(vc, info)) { | 2321 | if (!fbcon_is_inactive(vc, info)) { |
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index d065894ce38f..ea1fd3f47511 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
| @@ -554,11 +554,11 @@ static int fb_check_var(struct fb_var_screeninfo *var, | |||
| 554 | var->transp.length = 0; | 554 | var->transp.length = 0; |
| 555 | break; | 555 | break; |
| 556 | case 16: /* RGB 565 */ | 556 | case 16: /* RGB 565 */ |
| 557 | var->red.offset = 0; | 557 | var->red.offset = 11; |
| 558 | var->red.length = 5; | 558 | var->red.length = 5; |
| 559 | var->green.offset = 5; | 559 | var->green.offset = 5; |
| 560 | var->green.length = 6; | 560 | var->green.length = 6; |
| 561 | var->blue.offset = 11; | 561 | var->blue.offset = 0; |
| 562 | var->blue.length = 5; | 562 | var->blue.length = 5; |
| 563 | var->transp.offset = 0; | 563 | var->transp.offset = 0; |
| 564 | var->transp.length = 0; | 564 | var->transp.length = 0; |
| @@ -591,7 +591,7 @@ static int __devexit fb_remove(struct platform_device *dev) | |||
| 591 | unregister_framebuffer(info); | 591 | unregister_framebuffer(info); |
| 592 | fb_dealloc_cmap(&info->cmap); | 592 | fb_dealloc_cmap(&info->cmap); |
| 593 | dma_free_coherent(NULL, par->databuf_sz + PAGE_SIZE, | 593 | dma_free_coherent(NULL, par->databuf_sz + PAGE_SIZE, |
| 594 | info->screen_base, | 594 | info->screen_base - PAGE_SIZE, |
| 595 | info->fix.smem_start); | 595 | info->fix.smem_start); |
| 596 | free_irq(par->irq, par); | 596 | free_irq(par->irq, par); |
| 597 | clk_disable(par->lcdc_clk); | 597 | clk_disable(par->lcdc_clk); |
| @@ -704,7 +704,7 @@ static int __init fb_probe(struct platform_device *device) | |||
| 704 | 704 | ||
| 705 | if (i == ARRAY_SIZE(known_lcd_panels)) { | 705 | if (i == ARRAY_SIZE(known_lcd_panels)) { |
| 706 | dev_err(&device->dev, "GLCD: No valid panel found\n"); | 706 | dev_err(&device->dev, "GLCD: No valid panel found\n"); |
| 707 | ret = ENODEV; | 707 | ret = -ENODEV; |
| 708 | goto err_clk_disable; | 708 | goto err_clk_disable; |
| 709 | } else | 709 | } else |
| 710 | dev_info(&device->dev, "GLCD: Found %s panel\n", | 710 | dev_info(&device->dev, "GLCD: Found %s panel\n", |
| @@ -749,6 +749,7 @@ static int __init fb_probe(struct platform_device *device) | |||
| 749 | (PAGE_SIZE - par->palette_sz); | 749 | (PAGE_SIZE - par->palette_sz); |
| 750 | 750 | ||
| 751 | /* the rest of the frame buffer is pixel data */ | 751 | /* the rest of the frame buffer is pixel data */ |
| 752 | da8xx_fb_info->screen_base = par->v_palette_base + par->palette_sz; | ||
| 752 | da8xx_fb_fix.smem_start = par->p_palette_base + par->palette_sz; | 753 | da8xx_fb_fix.smem_start = par->p_palette_base + par->palette_sz; |
| 753 | da8xx_fb_fix.smem_len = par->databuf_sz - par->palette_sz; | 754 | da8xx_fb_fix.smem_len = par->databuf_sz - par->palette_sz; |
| 754 | da8xx_fb_fix.line_length = (lcdc_info->width * lcd_cfg->bpp) / 8; | 755 | da8xx_fb_fix.line_length = (lcdc_info->width * lcd_cfg->bpp) / 8; |
| @@ -787,6 +788,8 @@ static int __init fb_probe(struct platform_device *device) | |||
| 787 | da8xx_fb_info->var = da8xx_fb_var; | 788 | da8xx_fb_info->var = da8xx_fb_var; |
| 788 | da8xx_fb_info->fbops = &da8xx_fb_ops; | 789 | da8xx_fb_info->fbops = &da8xx_fb_ops; |
| 789 | da8xx_fb_info->pseudo_palette = par->pseudo_palette; | 790 | da8xx_fb_info->pseudo_palette = par->pseudo_palette; |
| 791 | da8xx_fb_info->fix.visual = (da8xx_fb_info->var.bits_per_pixel <= 8) ? | ||
| 792 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; | ||
| 790 | 793 | ||
| 791 | ret = fb_alloc_cmap(&da8xx_fb_info->cmap, PALETTE_SIZE, 0); | 794 | ret = fb_alloc_cmap(&da8xx_fb_info->cmap, PALETTE_SIZE, 0); |
| 792 | if (ret) | 795 | if (ret) |
| @@ -825,7 +828,7 @@ err_free_irq: | |||
| 825 | 828 | ||
| 826 | err_release_fb_mem: | 829 | err_release_fb_mem: |
| 827 | dma_free_coherent(NULL, par->databuf_sz + PAGE_SIZE, | 830 | dma_free_coherent(NULL, par->databuf_sz + PAGE_SIZE, |
| 828 | da8xx_fb_info->screen_base, | 831 | da8xx_fb_info->screen_base - PAGE_SIZE, |
| 829 | da8xx_fb_info->fix.smem_start); | 832 | da8xx_fb_info->fix.smem_start); |
| 830 | 833 | ||
| 831 | err_release_fb: | 834 | err_release_fb: |
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index 1a83709f9611..f67db4268374 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
| @@ -1147,7 +1147,7 @@ static int __init gbefb_probe(struct platform_device *p_dev) | |||
| 1147 | gbefb_setup(options); | 1147 | gbefb_setup(options); |
| 1148 | #endif | 1148 | #endif |
| 1149 | 1149 | ||
| 1150 | if (!request_region(GBE_BASE, sizeof(struct sgi_gbe), "GBE")) { | 1150 | if (!request_mem_region(GBE_BASE, sizeof(struct sgi_gbe), "GBE")) { |
| 1151 | printk(KERN_ERR "gbefb: couldn't reserve mmio region\n"); | 1151 | printk(KERN_ERR "gbefb: couldn't reserve mmio region\n"); |
| 1152 | ret = -EBUSY; | 1152 | ret = -EBUSY; |
| 1153 | goto out_release_framebuffer; | 1153 | goto out_release_framebuffer; |
diff --git a/drivers/video/msm/mddi.c b/drivers/video/msm/mddi.c index 5c5a1ad1d397..474421fe79a6 100644 --- a/drivers/video/msm/mddi.c +++ b/drivers/video/msm/mddi.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
| 25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
| 26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
| 27 | #include <linux/sched.h> | ||
| 27 | #include <mach/msm_iomap.h> | 28 | #include <mach/msm_iomap.h> |
| 28 | #include <mach/irqs.h> | 29 | #include <mach/irqs.h> |
| 29 | #include <mach/board.h> | 30 | #include <mach/board.h> |
diff --git a/drivers/video/msm/mddi_client_nt35399.c b/drivers/video/msm/mddi_client_nt35399.c index 9c78050ac799..c9e9349451cb 100644 --- a/drivers/video/msm/mddi_client_nt35399.c +++ b/drivers/video/msm/mddi_client_nt35399.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
| 20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
| 22 | #include <linux/sched.h> | ||
| 22 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
| 23 | #include <mach/msm_fb.h> | 24 | #include <mach/msm_fb.h> |
| 24 | 25 | ||
diff --git a/drivers/video/msm/mddi_client_toshiba.c b/drivers/video/msm/mddi_client_toshiba.c index 80d0f5fdf0b1..71048e78f7f0 100644 --- a/drivers/video/msm/mddi_client_toshiba.c +++ b/drivers/video/msm/mddi_client_toshiba.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
| 22 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
| 23 | #include <linux/sched.h> | ||
| 23 | #include <mach/msm_fb.h> | 24 | #include <mach/msm_fb.h> |
| 24 | 25 | ||
| 25 | 26 | ||
diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c index 99636a2b20f2..6c519e2fa2b7 100644 --- a/drivers/video/msm/mdp.c +++ b/drivers/video/msm/mdp.c | |||
| @@ -22,9 +22,6 @@ | |||
| 22 | #include <linux/wait.h> | 22 | #include <linux/wait.h> |
| 23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
| 24 | #include <linux/file.h> | 24 | #include <linux/file.h> |
| 25 | #ifdef CONFIG_ANDROID_PMEM | ||
| 26 | #include <linux/android_pmem.h> | ||
| 27 | #endif | ||
| 28 | #include <linux/major.h> | 25 | #include <linux/major.h> |
| 29 | 26 | ||
| 30 | #include <mach/msm_iomap.h> | 27 | #include <mach/msm_iomap.h> |
| @@ -262,11 +259,6 @@ int get_img(struct mdp_img *img, struct fb_info *info, | |||
| 262 | struct file *file; | 259 | struct file *file; |
| 263 | unsigned long vstart; | 260 | unsigned long vstart; |
| 264 | 261 | ||
| 265 | #ifdef CONFIG_ANDROID_PMEM | ||
| 266 | if (!get_pmem_file(img->memory_id, start, &vstart, len, filep)) | ||
| 267 | return 0; | ||
| 268 | #endif | ||
| 269 | |||
| 270 | file = fget_light(img->memory_id, &put_needed); | 262 | file = fget_light(img->memory_id, &put_needed); |
| 271 | if (file == NULL) | 263 | if (file == NULL) |
| 272 | return -1; | 264 | return -1; |
| @@ -283,12 +275,6 @@ int get_img(struct mdp_img *img, struct fb_info *info, | |||
| 283 | 275 | ||
| 284 | void put_img(struct file *src_file, struct file *dst_file) | 276 | void put_img(struct file *src_file, struct file *dst_file) |
| 285 | { | 277 | { |
| 286 | #ifdef CONFIG_ANDROID_PMEM | ||
| 287 | if (src_file) | ||
| 288 | put_pmem_file(src_file); | ||
| 289 | if (dst_file) | ||
| 290 | put_pmem_file(dst_file); | ||
| 291 | #endif | ||
| 292 | } | 278 | } |
| 293 | 279 | ||
| 294 | int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb, | 280 | int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb, |
| @@ -320,9 +306,6 @@ int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb, | |||
| 320 | if (unlikely(get_img(&req->dst, fb, &dst_start, &dst_len, &dst_file))) { | 306 | if (unlikely(get_img(&req->dst, fb, &dst_start, &dst_len, &dst_file))) { |
| 321 | printk(KERN_ERR "mpd_ppp: could not retrieve dst image from " | 307 | printk(KERN_ERR "mpd_ppp: could not retrieve dst image from " |
| 322 | "memory\n"); | 308 | "memory\n"); |
| 323 | #ifdef CONFIG_ANDROID_PMEM | ||
| 324 | put_pmem_file(src_file); | ||
| 325 | #endif | ||
| 326 | return -EINVAL; | 309 | return -EINVAL; |
| 327 | } | 310 | } |
| 328 | mutex_lock(&mdp_mutex); | 311 | mutex_lock(&mdp_mutex); |
| @@ -499,7 +482,6 @@ int mdp_probe(struct platform_device *pdev) | |||
| 499 | /* register mdp device */ | 482 | /* register mdp device */ |
| 500 | mdp->mdp_dev.dev.parent = &pdev->dev; | 483 | mdp->mdp_dev.dev.parent = &pdev->dev; |
| 501 | mdp->mdp_dev.dev.class = mdp_class; | 484 | mdp->mdp_dev.dev.class = mdp_class; |
| 502 | snprintf(mdp->mdp_dev.dev.bus_id, BUS_ID_SIZE, "mdp%d", pdev->id); | ||
| 503 | 485 | ||
| 504 | /* if you can remove the platform device you'd have to implement | 486 | /* if you can remove the platform device you'd have to implement |
| 505 | * this: | 487 | * this: |
diff --git a/drivers/video/msm/mdp_ppp.c b/drivers/video/msm/mdp_ppp.c index ba2c4673b648..4ff001f4cbbd 100644 --- a/drivers/video/msm/mdp_ppp.c +++ b/drivers/video/msm/mdp_ppp.c | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #include <linux/file.h> | 16 | #include <linux/file.h> |
| 17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
| 18 | #include <linux/msm_mdp.h> | 18 | #include <linux/msm_mdp.h> |
| 19 | #include <linux/android_pmem.h> | ||
| 20 | #include <mach/msm_fb.h> | 19 | #include <mach/msm_fb.h> |
| 21 | 20 | ||
| 22 | #include "mdp_hw.h" | 21 | #include "mdp_hw.h" |
| @@ -579,25 +578,6 @@ static int valid_src_dst(unsigned long src_start, unsigned long src_len, | |||
| 579 | static void flush_imgs(struct mdp_blit_req *req, struct mdp_regs *regs, | 578 | static void flush_imgs(struct mdp_blit_req *req, struct mdp_regs *regs, |
| 580 | struct file *src_file, struct file *dst_file) | 579 | struct file *src_file, struct file *dst_file) |
| 581 | { | 580 | { |
| 582 | #ifdef CONFIG_ANDROID_PMEM | ||
| 583 | uint32_t src0_len, src1_len, dst0_len, dst1_len; | ||
| 584 | |||
| 585 | /* flush src images to memory before dma to mdp */ | ||
| 586 | get_len(&req->src, &req->src_rect, regs->src_bpp, &src0_len, | ||
| 587 | &src1_len); | ||
| 588 | flush_pmem_file(src_file, req->src.offset, src0_len); | ||
| 589 | if (IS_PSEUDOPLNR(req->src.format)) | ||
| 590 | flush_pmem_file(src_file, req->src.offset + src0_len, | ||
| 591 | src1_len); | ||
| 592 | |||
| 593 | /* flush dst images */ | ||
| 594 | get_len(&req->dst, &req->dst_rect, regs->dst_bpp, &dst0_len, | ||
| 595 | &dst1_len); | ||
| 596 | flush_pmem_file(dst_file, req->dst.offset, dst0_len); | ||
| 597 | if (IS_PSEUDOPLNR(req->dst.format)) | ||
| 598 | flush_pmem_file(dst_file, req->dst.offset + dst0_len, | ||
| 599 | dst1_len); | ||
| 600 | #endif | ||
| 601 | } | 581 | } |
| 602 | 582 | ||
| 603 | static void get_chroma_addr(struct mdp_img *img, struct mdp_rect *rect, | 583 | static void get_chroma_addr(struct mdp_img *img, struct mdp_rect *rect, |
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 37b135d5d12e..842d157e1025 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
| @@ -1565,7 +1565,7 @@ static int savagefb_blank(int blank, struct fb_info *info) | |||
| 1565 | vga_out8(0x3c5, sr8, par); | 1565 | vga_out8(0x3c5, sr8, par); |
| 1566 | vga_out8(0x3c4, 0x0d, par); | 1566 | vga_out8(0x3c4, 0x0d, par); |
| 1567 | srd = vga_in8(0x3c5, par); | 1567 | srd = vga_in8(0x3c5, par); |
| 1568 | srd &= 0x03; | 1568 | srd &= 0x50; |
| 1569 | 1569 | ||
| 1570 | switch (blank) { | 1570 | switch (blank) { |
| 1571 | case FB_BLANK_UNBLANK: | 1571 | case FB_BLANK_UNBLANK: |
| @@ -1606,22 +1606,6 @@ static int savagefb_blank(int blank, struct fb_info *info) | |||
| 1606 | return (blank == FB_BLANK_NORMAL) ? 1 : 0; | 1606 | return (blank == FB_BLANK_NORMAL) ? 1 : 0; |
| 1607 | } | 1607 | } |
| 1608 | 1608 | ||
| 1609 | static void savagefb_save_state(struct fb_info *info) | ||
| 1610 | { | ||
| 1611 | struct savagefb_par *par = info->par; | ||
| 1612 | |||
| 1613 | savage_get_default_par(par, &par->save); | ||
| 1614 | } | ||
| 1615 | |||
| 1616 | static void savagefb_restore_state(struct fb_info *info) | ||
| 1617 | { | ||
| 1618 | struct savagefb_par *par = info->par; | ||
| 1619 | |||
| 1620 | savagefb_blank(FB_BLANK_POWERDOWN, info); | ||
| 1621 | savage_set_default_par(par, &par->save); | ||
| 1622 | savagefb_blank(FB_BLANK_UNBLANK, info); | ||
| 1623 | } | ||
| 1624 | |||
| 1625 | static int savagefb_open(struct fb_info *info, int user) | 1609 | static int savagefb_open(struct fb_info *info, int user) |
| 1626 | { | 1610 | { |
| 1627 | struct savagefb_par *par = info->par; | 1611 | struct savagefb_par *par = info->par; |
| @@ -1667,8 +1651,6 @@ static struct fb_ops savagefb_ops = { | |||
| 1667 | .fb_setcolreg = savagefb_setcolreg, | 1651 | .fb_setcolreg = savagefb_setcolreg, |
| 1668 | .fb_pan_display = savagefb_pan_display, | 1652 | .fb_pan_display = savagefb_pan_display, |
| 1669 | .fb_blank = savagefb_blank, | 1653 | .fb_blank = savagefb_blank, |
| 1670 | .fb_save_state = savagefb_save_state, | ||
| 1671 | .fb_restore_state = savagefb_restore_state, | ||
| 1672 | #if defined(CONFIG_FB_SAVAGE_ACCEL) | 1654 | #if defined(CONFIG_FB_SAVAGE_ACCEL) |
| 1673 | .fb_fillrect = savagefb_fillrect, | 1655 | .fb_fillrect = savagefb_fillrect, |
| 1674 | .fb_copyarea = savagefb_copyarea, | 1656 | .fb_copyarea = savagefb_copyarea, |
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index e35232a18571..54fbb2995a5f 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
| @@ -1411,23 +1411,6 @@ static int uvesafb_check_var(struct fb_var_screeninfo *var, | |||
| 1411 | return 0; | 1411 | return 0; |
| 1412 | } | 1412 | } |
| 1413 | 1413 | ||
| 1414 | static void uvesafb_save_state(struct fb_info *info) | ||
| 1415 | { | ||
| 1416 | struct uvesafb_par *par = info->par; | ||
| 1417 | |||
| 1418 | if (par->vbe_state_saved) | ||
| 1419 | kfree(par->vbe_state_saved); | ||
| 1420 | |||
| 1421 | par->vbe_state_saved = uvesafb_vbe_state_save(par); | ||
| 1422 | } | ||
| 1423 | |||
| 1424 | static void uvesafb_restore_state(struct fb_info *info) | ||
| 1425 | { | ||
| 1426 | struct uvesafb_par *par = info->par; | ||
| 1427 | |||
| 1428 | uvesafb_vbe_state_restore(par, par->vbe_state_saved); | ||
| 1429 | } | ||
| 1430 | |||
| 1431 | static struct fb_ops uvesafb_ops = { | 1414 | static struct fb_ops uvesafb_ops = { |
| 1432 | .owner = THIS_MODULE, | 1415 | .owner = THIS_MODULE, |
| 1433 | .fb_open = uvesafb_open, | 1416 | .fb_open = uvesafb_open, |
| @@ -1441,8 +1424,6 @@ static struct fb_ops uvesafb_ops = { | |||
| 1441 | .fb_imageblit = cfb_imageblit, | 1424 | .fb_imageblit = cfb_imageblit, |
| 1442 | .fb_check_var = uvesafb_check_var, | 1425 | .fb_check_var = uvesafb_check_var, |
| 1443 | .fb_set_par = uvesafb_set_par, | 1426 | .fb_set_par = uvesafb_set_par, |
| 1444 | .fb_save_state = uvesafb_save_state, | ||
| 1445 | .fb_restore_state = uvesafb_restore_state, | ||
| 1446 | }; | 1427 | }; |
| 1447 | 1428 | ||
| 1448 | static void __devinit uvesafb_init_info(struct fb_info *info, | 1429 | static void __devinit uvesafb_init_info(struct fb_info *info, |
| @@ -1459,15 +1440,6 @@ static void __devinit uvesafb_init_info(struct fb_info *info, | |||
| 1459 | info->fix.ypanstep = par->ypan ? 1 : 0; | 1440 | info->fix.ypanstep = par->ypan ? 1 : 0; |
| 1460 | info->fix.ywrapstep = (par->ypan > 1) ? 1 : 0; | 1441 | info->fix.ywrapstep = (par->ypan > 1) ? 1 : 0; |
| 1461 | 1442 | ||
| 1462 | /* | ||
| 1463 | * If we were unable to get the state buffer size, disable | ||
| 1464 | * functions for saving and restoring the hardware state. | ||
| 1465 | */ | ||
| 1466 | if (par->vbe_state_size == 0) { | ||
| 1467 | info->fbops->fb_save_state = NULL; | ||
| 1468 | info->fbops->fb_restore_state = NULL; | ||
| 1469 | } | ||
| 1470 | |||
| 1471 | /* Disable blanking if the user requested so. */ | 1443 | /* Disable blanking if the user requested so. */ |
| 1472 | if (!blank) | 1444 | if (!blank) |
| 1473 | info->fbops->fb_blank = NULL; | 1445 | info->fbops->fb_blank = NULL; |
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index f24d04132eda..4d227b152001 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c | |||
| @@ -317,7 +317,7 @@ static int __devexit pnx4008_wdt_remove(struct platform_device *pdev) | |||
| 317 | 317 | ||
| 318 | static struct platform_driver platform_wdt_driver = { | 318 | static struct platform_driver platform_wdt_driver = { |
| 319 | .driver = { | 319 | .driver = { |
| 320 | .name = "watchdog", | 320 | .name = "pnx4008-watchdog", |
| 321 | .owner = THIS_MODULE, | 321 | .owner = THIS_MODULE, |
| 322 | }, | 322 | }, |
| 323 | .probe = pnx4008_wdt_probe, | 323 | .probe = pnx4008_wdt_probe, |
| @@ -352,4 +352,4 @@ MODULE_PARM_DESC(nowayout, | |||
| 352 | 352 | ||
| 353 | MODULE_LICENSE("GPL"); | 353 | MODULE_LICENSE("GPL"); |
| 354 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 354 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
| 355 | MODULE_ALIAS("platform:watchdog"); | 355 | MODULE_ALIAS("platform:pnx4008-watchdog"); |
diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c index f6cccc9df022..bf12d06b5877 100644 --- a/drivers/watchdog/rc32434_wdt.c +++ b/drivers/watchdog/rc32434_wdt.c | |||
| @@ -62,7 +62,7 @@ extern unsigned int idt_cpu_freq; | |||
| 62 | static int timeout = WATCHDOG_TIMEOUT; | 62 | static int timeout = WATCHDOG_TIMEOUT; |
| 63 | module_param(timeout, int, 0); | 63 | module_param(timeout, int, 0); |
| 64 | MODULE_PARM_DESC(timeout, "Watchdog timeout value, in seconds (default=" | 64 | MODULE_PARM_DESC(timeout, "Watchdog timeout value, in seconds (default=" |
| 65 | WATCHDOG_TIMEOUT ")"); | 65 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
| 66 | 66 | ||
| 67 | static int nowayout = WATCHDOG_NOWAYOUT; | 67 | static int nowayout = WATCHDOG_NOWAYOUT; |
| 68 | module_param(nowayout, int, 0); | 68 | module_param(nowayout, int, 0); |
| @@ -276,7 +276,7 @@ static int __devinit rc32434_wdt_probe(struct platform_device *pdev) | |||
| 276 | return -ENODEV; | 276 | return -ENODEV; |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | wdt_reg = ioremap_nocache(r->start, r->end - r->start); | 279 | wdt_reg = ioremap_nocache(r->start, resource_size(r)); |
| 280 | if (!wdt_reg) { | 280 | if (!wdt_reg) { |
| 281 | printk(KERN_ERR PFX "failed to remap I/O resources\n"); | 281 | printk(KERN_ERR PFX "failed to remap I/O resources\n"); |
| 282 | return -ENXIO; | 282 | return -ENXIO; |
diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c index 852ca1977917..91430a89107c 100644 --- a/drivers/watchdog/sbc_fitpc2_wdt.c +++ b/drivers/watchdog/sbc_fitpc2_wdt.c | |||
| @@ -227,7 +227,7 @@ static int __init fitpc2_wdt_init(void) | |||
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | err = misc_register(&fitpc2_wdt_miscdev); | 229 | err = misc_register(&fitpc2_wdt_miscdev); |
| 230 | if (!err) { | 230 | if (err) { |
| 231 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", | 231 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
| 232 | WATCHDOG_MINOR, err); | 232 | WATCHDOG_MINOR, err); |
| 233 | goto err_margin; | 233 | goto err_margin; |
