diff options
Diffstat (limited to 'drivers')
71 files changed, 2179 insertions, 378 deletions
diff --git a/drivers/Makefile b/drivers/Makefile index a9e4c5f922a0..f0878b2ec55e 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -66,6 +66,7 @@ obj-y += i2c/ | |||
66 | obj-$(CONFIG_W1) += w1/ | 66 | obj-$(CONFIG_W1) += w1/ |
67 | obj-$(CONFIG_POWER_SUPPLY) += power/ | 67 | obj-$(CONFIG_POWER_SUPPLY) += power/ |
68 | obj-$(CONFIG_HWMON) += hwmon/ | 68 | obj-$(CONFIG_HWMON) += hwmon/ |
69 | obj-$(CONFIG_WATCHDOG) += char/watchdog/ | ||
69 | obj-$(CONFIG_PHONE) += telephony/ | 70 | obj-$(CONFIG_PHONE) += telephony/ |
70 | obj-$(CONFIG_MD) += md/ | 71 | obj-$(CONFIG_MD) += md/ |
71 | obj-$(CONFIG_BT) += bluetooth/ | 72 | obj-$(CONFIG_BT) += bluetooth/ |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 934d639b3684..f1372de4ce79 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -68,14 +68,6 @@ config ACPI_PROCFS | |||
68 | 68 | ||
69 | Say N to delete /proc/acpi/ files that have moved to /sys/ | 69 | Say N to delete /proc/acpi/ files that have moved to /sys/ |
70 | 70 | ||
71 | config ACPI_PROCFS_SLEEP | ||
72 | bool "/proc/acpi/sleep (deprecated)" | ||
73 | depends on PM_SLEEP && ACPI_PROCFS | ||
74 | default n | ||
75 | ---help--- | ||
76 | Create /proc/acpi/sleep | ||
77 | Deprecated by /sys/power/state | ||
78 | |||
79 | config ACPI_AC | 71 | config ACPI_AC |
80 | tristate "AC Adapter" | 72 | tristate "AC Adapter" |
81 | depends on X86 | 73 | depends on X86 |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index ad070861bb53..a78832ea81fa 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -890,37 +890,46 @@ static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
890 | } | 890 | } |
891 | 891 | ||
892 | #ifdef CONFIG_PM | 892 | #ifdef CONFIG_PM |
893 | static struct dmi_system_id piix_broken_suspend_dmi_table[] = { | 893 | static int piix_broken_suspend(void) |
894 | { | 894 | { |
895 | .ident = "TECRA M5", | 895 | static struct dmi_system_id sysids[] = { |
896 | .matches = { | 896 | { |
897 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 897 | .ident = "TECRA M5", |
898 | DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M5"), | 898 | .matches = { |
899 | }, | 899 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
900 | }, | 900 | DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M5"), |
901 | { | 901 | }, |
902 | .ident = "Satellite U200", | ||
903 | .matches = { | ||
904 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
905 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U200"), | ||
906 | }, | 902 | }, |
907 | }, | 903 | { |
908 | { | 904 | .ident = "Satellite U205", |
909 | .ident = "Satellite U205", | 905 | .matches = { |
910 | .matches = { | 906 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
911 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 907 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U205"), |
912 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U205"), | 908 | }, |
913 | }, | 909 | }, |
914 | }, | 910 | { |
915 | { | 911 | .ident = "Portege M500", |
916 | .ident = "Portege M500", | 912 | .matches = { |
917 | .matches = { | 913 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
918 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 914 | DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M500"), |
919 | DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M500"), | 915 | }, |
920 | }, | 916 | }, |
921 | }, | 917 | { } |
922 | { } | 918 | }; |
923 | }; | 919 | static const char *oemstrs[] = { |
920 | "Tecra M3,", | ||
921 | }; | ||
922 | int i; | ||
923 | |||
924 | if (dmi_check_system(sysids)) | ||
925 | return 1; | ||
926 | |||
927 | for (i = 0; i < ARRAY_SIZE(oemstrs); i++) | ||
928 | if (dmi_find_device(DMI_DEV_TYPE_OEM_STRING, oemstrs[i], NULL)) | ||
929 | return 1; | ||
930 | |||
931 | return 0; | ||
932 | } | ||
924 | 933 | ||
925 | static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) | 934 | static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) |
926 | { | 935 | { |
@@ -937,8 +946,7 @@ static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) | |||
937 | * cycles and power trying to do something to the sleeping | 946 | * cycles and power trying to do something to the sleeping |
938 | * beauty. | 947 | * beauty. |
939 | */ | 948 | */ |
940 | if (dmi_check_system(piix_broken_suspend_dmi_table) && | 949 | if (piix_broken_suspend() && mesg.event == PM_EVENT_SUSPEND) { |
941 | mesg.event == PM_EVENT_SUSPEND) { | ||
942 | pci_save_state(pdev); | 950 | pci_save_state(pdev); |
943 | 951 | ||
944 | /* mark its power state as "unknown", since we don't | 952 | /* mark its power state as "unknown", since we don't |
@@ -973,10 +981,10 @@ static int piix_pci_device_resume(struct pci_dev *pdev) | |||
973 | pci_restore_state(pdev); | 981 | pci_restore_state(pdev); |
974 | 982 | ||
975 | /* PCI device wasn't disabled during suspend. Use | 983 | /* PCI device wasn't disabled during suspend. Use |
976 | * __pci_reenable_device() to avoid affecting the | 984 | * pci_reenable_device() to avoid affecting the enable |
977 | * enable count. | 985 | * count. |
978 | */ | 986 | */ |
979 | rc = __pci_reenable_device(pdev); | 987 | rc = pci_reenable_device(pdev); |
980 | if (rc) | 988 | if (rc) |
981 | dev_printk(KERN_ERR, &pdev->dev, "failed to enable " | 989 | dev_printk(KERN_ERR, &pdev->dev, "failed to enable " |
982 | "device after resume (%d)\n", rc); | 990 | "device after resume (%d)\n", rc); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 6001aae0b884..60e78bef469f 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3788,6 +3788,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
3788 | { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, }, | 3788 | { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, }, |
3789 | { "FUJITSU MHV2080BH", "00840028", ATA_HORKAGE_NONCQ, }, | 3789 | { "FUJITSU MHV2080BH", "00840028", ATA_HORKAGE_NONCQ, }, |
3790 | { "ST9160821AS", "3.CLF", ATA_HORKAGE_NONCQ, }, | 3790 | { "ST9160821AS", "3.CLF", ATA_HORKAGE_NONCQ, }, |
3791 | { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, }, | ||
3791 | 3792 | ||
3792 | /* Devices with NCQ limits */ | 3793 | /* Devices with NCQ limits */ |
3793 | 3794 | ||
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 6c289c7b1322..1cce2198baaf 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -573,6 +573,10 @@ int ata_pci_init_bmdma(struct ata_host *host) | |||
573 | struct pci_dev *pdev = to_pci_dev(gdev); | 573 | struct pci_dev *pdev = to_pci_dev(gdev); |
574 | int i, rc; | 574 | int i, rc; |
575 | 575 | ||
576 | /* No BAR4 allocation: No DMA */ | ||
577 | if (pci_resource_start(pdev, 4) == 0) | ||
578 | return 0; | ||
579 | |||
576 | /* TODO: If we get no DMA mask we should fall back to PIO */ | 580 | /* TODO: If we get no DMA mask we should fall back to PIO */ |
577 | rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); | 581 | rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); |
578 | if (rc) | 582 | if (rc) |
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index dc443e7dc37c..e34b632487d7 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/libata.h> | 31 | #include <linux/libata.h> |
32 | 32 | ||
33 | #define DRV_NAME "pata_cmd64x" | 33 | #define DRV_NAME "pata_cmd64x" |
34 | #define DRV_VERSION "0.2.3" | 34 | #define DRV_VERSION "0.2.4" |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * CMD64x specific registers definition. | 37 | * CMD64x specific registers definition. |
@@ -397,7 +397,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
397 | .flags = ATA_FLAG_SLAVE_POSS, | 397 | .flags = ATA_FLAG_SLAVE_POSS, |
398 | .pio_mask = 0x1f, | 398 | .pio_mask = 0x1f, |
399 | .mwdma_mask = 0x07, | 399 | .mwdma_mask = 0x07, |
400 | .udma_mask = ATA_UDMA1, | 400 | .udma_mask = ATA_UDMA2, |
401 | .port_ops = &cmd64x_port_ops | 401 | .port_ops = &cmd64x_port_ops |
402 | }, | 402 | }, |
403 | { /* CMD 646 rev 1 */ | 403 | { /* CMD 646 rev 1 */ |
@@ -412,7 +412,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
412 | .flags = ATA_FLAG_SLAVE_POSS, | 412 | .flags = ATA_FLAG_SLAVE_POSS, |
413 | .pio_mask = 0x1f, | 413 | .pio_mask = 0x1f, |
414 | .mwdma_mask = 0x07, | 414 | .mwdma_mask = 0x07, |
415 | .udma_mask = ATA_UDMA2, | 415 | .udma_mask = ATA_UDMA4, |
416 | .port_ops = &cmd648_port_ops | 416 | .port_ops = &cmd648_port_ops |
417 | }, | 417 | }, |
418 | { /* CMD 649 */ | 418 | { /* CMD 649 */ |
@@ -420,7 +420,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
420 | .flags = ATA_FLAG_SLAVE_POSS, | 420 | .flags = ATA_FLAG_SLAVE_POSS, |
421 | .pio_mask = 0x1f, | 421 | .pio_mask = 0x1f, |
422 | .mwdma_mask = 0x07, | 422 | .mwdma_mask = 0x07, |
423 | .udma_mask = ATA_UDMA3, | 423 | .udma_mask = ATA_UDMA5, |
424 | .port_ops = &cmd648_port_ops | 424 | .port_ops = &cmd648_port_ops |
425 | } | 425 | } |
426 | }; | 426 | }; |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index 9a829a7cbc60..66bd0e83ac07 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * pata_sis.c - SiS ATA driver | 2 | * pata_sis.c - SiS ATA driver |
3 | * | 3 | * |
4 | * (C) 2005 Red Hat <alan@redhat.com> | 4 | * (C) 2005 Red Hat <alan@redhat.com> |
5 | * (C) 2007 Bartlomiej Zolnierkiewicz | ||
5 | * | 6 | * |
6 | * Based upon linux/drivers/ide/pci/sis5513.c | 7 | * Based upon linux/drivers/ide/pci/sis5513.c |
7 | * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org> | 8 | * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org> |
@@ -35,7 +36,7 @@ | |||
35 | #include "sis.h" | 36 | #include "sis.h" |
36 | 37 | ||
37 | #define DRV_NAME "pata_sis" | 38 | #define DRV_NAME "pata_sis" |
38 | #define DRV_VERSION "0.5.1" | 39 | #define DRV_VERSION "0.5.2" |
39 | 40 | ||
40 | struct sis_chipset { | 41 | struct sis_chipset { |
41 | u16 device; /* PCI host ID */ | 42 | u16 device; /* PCI host ID */ |
@@ -237,7 +238,7 @@ static void sis_old_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
237 | } | 238 | } |
238 | 239 | ||
239 | /** | 240 | /** |
240 | * sis_100_set_pioode - Initialize host controller PATA PIO timings | 241 | * sis_100_set_piomode - Initialize host controller PATA PIO timings |
241 | * @ap: Port whose timings we are configuring | 242 | * @ap: Port whose timings we are configuring |
242 | * @adev: Device we are configuring for. | 243 | * @adev: Device we are configuring for. |
243 | * | 244 | * |
@@ -262,7 +263,7 @@ static void sis_100_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
262 | } | 263 | } |
263 | 264 | ||
264 | /** | 265 | /** |
265 | * sis_133_set_pioode - Initialize host controller PATA PIO timings | 266 | * sis_133_set_piomode - Initialize host controller PATA PIO timings |
266 | * @ap: Port whose timings we are configuring | 267 | * @ap: Port whose timings we are configuring |
267 | * @adev: Device we are configuring for. | 268 | * @adev: Device we are configuring for. |
268 | * | 269 | * |
@@ -334,7 +335,7 @@ static void sis_old_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
334 | int drive_pci = sis_old_port_base(adev); | 335 | int drive_pci = sis_old_port_base(adev); |
335 | u16 timing; | 336 | u16 timing; |
336 | 337 | ||
337 | const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; | 338 | const u16 mwdma_bits[] = { 0x008, 0x302, 0x301 }; |
338 | const u16 udma_bits[] = { 0xE000, 0xC000, 0xA000 }; | 339 | const u16 udma_bits[] = { 0xE000, 0xC000, 0xA000 }; |
339 | 340 | ||
340 | pci_read_config_word(pdev, drive_pci, &timing); | 341 | pci_read_config_word(pdev, drive_pci, &timing); |
@@ -342,15 +343,15 @@ static void sis_old_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
342 | if (adev->dma_mode < XFER_UDMA_0) { | 343 | if (adev->dma_mode < XFER_UDMA_0) { |
343 | /* bits 3-0 hold recovery timing bits 8-10 active timing and | 344 | /* bits 3-0 hold recovery timing bits 8-10 active timing and |
344 | the higer bits are dependant on the device */ | 345 | the higer bits are dependant on the device */ |
345 | timing &= ~ 0x870F; | 346 | timing &= ~0x870F; |
346 | timing |= mwdma_bits[speed]; | 347 | timing |= mwdma_bits[speed]; |
347 | pci_write_config_word(pdev, drive_pci, timing); | ||
348 | } else { | 348 | } else { |
349 | /* Bit 15 is UDMA on/off, bit 13-14 are cycle time */ | 349 | /* Bit 15 is UDMA on/off, bit 13-14 are cycle time */ |
350 | speed = adev->dma_mode - XFER_UDMA_0; | 350 | speed = adev->dma_mode - XFER_UDMA_0; |
351 | timing &= ~0x6000; | 351 | timing &= ~0x6000; |
352 | timing |= udma_bits[speed]; | 352 | timing |= udma_bits[speed]; |
353 | } | 353 | } |
354 | pci_write_config_word(pdev, drive_pci, timing); | ||
354 | } | 355 | } |
355 | 356 | ||
356 | /** | 357 | /** |
@@ -373,7 +374,7 @@ static void sis_66_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
373 | int drive_pci = sis_old_port_base(adev); | 374 | int drive_pci = sis_old_port_base(adev); |
374 | u16 timing; | 375 | u16 timing; |
375 | 376 | ||
376 | const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; | 377 | const u16 mwdma_bits[] = { 0x008, 0x302, 0x301 }; |
377 | const u16 udma_bits[] = { 0xF000, 0xD000, 0xB000, 0xA000, 0x9000}; | 378 | const u16 udma_bits[] = { 0xF000, 0xD000, 0xB000, 0xA000, 0x9000}; |
378 | 379 | ||
379 | pci_read_config_word(pdev, drive_pci, &timing); | 380 | pci_read_config_word(pdev, drive_pci, &timing); |
@@ -432,8 +433,7 @@ static void sis_100_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
432 | * @adev: Device to program | 433 | * @adev: Device to program |
433 | * | 434 | * |
434 | * Set UDMA/MWDMA mode for device, in host controller PCI config space. | 435 | * Set UDMA/MWDMA mode for device, in host controller PCI config space. |
435 | * Handles early SiS 961 bridges. Supports MWDMA as well unlike | 436 | * Handles early SiS 961 bridges. |
436 | * the old ide/pci driver. | ||
437 | * | 437 | * |
438 | * LOCKING: | 438 | * LOCKING: |
439 | * None (inherited from caller). | 439 | * None (inherited from caller). |
@@ -467,8 +467,6 @@ static void sis_133_early_set_dmamode (struct ata_port *ap, struct ata_device *a | |||
467 | * @adev: Device to program | 467 | * @adev: Device to program |
468 | * | 468 | * |
469 | * Set UDMA/MWDMA mode for device, in host controller PCI config space. | 469 | * Set UDMA/MWDMA mode for device, in host controller PCI config space. |
470 | * Handles early SiS 961 bridges. Supports MWDMA as well unlike | ||
471 | * the old ide/pci driver. | ||
472 | * | 470 | * |
473 | * LOCKING: | 471 | * LOCKING: |
474 | * None (inherited from caller). | 472 | * None (inherited from caller). |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 23b26b87cc32..d68ddbe70f73 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -97,7 +97,6 @@ obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o | |||
97 | obj-$(CONFIG_GPIO_TB0219) += tb0219.o | 97 | obj-$(CONFIG_GPIO_TB0219) += tb0219.o |
98 | obj-$(CONFIG_TELCLOCK) += tlclk.o | 98 | obj-$(CONFIG_TELCLOCK) += tlclk.o |
99 | 99 | ||
100 | obj-$(CONFIG_WATCHDOG) += watchdog/ | ||
101 | obj-$(CONFIG_MWAVE) += mwave/ | 100 | obj-$(CONFIG_MWAVE) += mwave/ |
102 | obj-$(CONFIG_AGP) += agp/ | 101 | obj-$(CONFIG_AGP) += agp/ |
103 | obj-$(CONFIG_DRM) += drm/ | 102 | obj-$(CONFIG_DRM) += drm/ |
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index 16fb23125e96..37bddc1802de 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig | |||
@@ -55,6 +55,8 @@ config SOFT_WATCHDOG | |||
55 | To compile this driver as a module, choose M here: the | 55 | To compile this driver as a module, choose M here: the |
56 | module will be called softdog. | 56 | module will be called softdog. |
57 | 57 | ||
58 | # ALPHA Architecture | ||
59 | |||
58 | # ARM Architecture | 60 | # ARM Architecture |
59 | 61 | ||
60 | config AT91RM9200_WATCHDOG | 62 | config AT91RM9200_WATCHDOG |
@@ -189,7 +191,7 @@ config PNX4008_WATCHDOG | |||
189 | 191 | ||
190 | config IOP_WATCHDOG | 192 | config IOP_WATCHDOG |
191 | tristate "IOP Watchdog" | 193 | tristate "IOP Watchdog" |
192 | depends on WATCHDOG && PLAT_IOP | 194 | depends on PLAT_IOP |
193 | select WATCHDOG_NOWAYOUT if (ARCH_IOP32X || ARCH_IOP33X) | 195 | select WATCHDOG_NOWAYOUT if (ARCH_IOP32X || ARCH_IOP33X) |
194 | help | 196 | help |
195 | Say Y here if to include support for the watchdog timer | 197 | Say Y here if to include support for the watchdog timer |
@@ -203,15 +205,48 @@ config IOP_WATCHDOG | |||
203 | operating as an Root Complex and/or Central Resource, the PCI-X | 205 | operating as an Root Complex and/or Central Resource, the PCI-X |
204 | and/or PCIe busses will also be reset. THIS IS A VERY BIG HAMMER. | 206 | and/or PCIe busses will also be reset. THIS IS A VERY BIG HAMMER. |
205 | 207 | ||
208 | config DAVINCI_WATCHDOG | ||
209 | tristate "DaVinci watchdog" | ||
210 | depends on ARCH_DAVINCI | ||
211 | help | ||
212 | Say Y here if to include support for the watchdog timer | ||
213 | in the DaVinci DM644x/DM646x processors. | ||
214 | To compile this driver as a module, choose M here: the | ||
215 | module will be called davinci_wdt. | ||
216 | |||
217 | NOTE: once enabled, this timer cannot be disabled. | ||
218 | Say N if you are unsure. | ||
219 | |||
220 | # ARM26 Architecture | ||
221 | |||
206 | # AVR32 Architecture | 222 | # AVR32 Architecture |
207 | 223 | ||
208 | config AT32AP700X_WDT | 224 | config AT32AP700X_WDT |
209 | tristate "AT32AP700x watchdog" | 225 | tristate "AT32AP700x watchdog" |
210 | depends on WATCHDOG && CPU_AT32AP7000 | 226 | depends on CPU_AT32AP7000 |
211 | help | 227 | help |
212 | Watchdog timer embedded into AT32AP700x devices. This will reboot | 228 | Watchdog timer embedded into AT32AP700x devices. This will reboot |
213 | your system when the timeout is reached. | 229 | your system when the timeout is reached. |
214 | 230 | ||
231 | # BLACKFIN Architecture | ||
232 | |||
233 | config BFIN_WDT | ||
234 | tristate "Blackfin On-Chip Watchdog Timer" | ||
235 | depends on BLACKFIN | ||
236 | ---help--- | ||
237 | If you say yes here you will get support for the Blackfin On-Chip | ||
238 | Watchdog Timer. If you have one of these processors and wish to | ||
239 | have watchdog support enabled, say Y, otherwise say N. | ||
240 | |||
241 | To compile this driver as a module, choose M here: the | ||
242 | module will be called bfin_wdt. | ||
243 | |||
244 | # CRIS Architecture | ||
245 | |||
246 | # FRV Architecture | ||
247 | |||
248 | # H8300 Architecture | ||
249 | |||
215 | # X86 (i386 + ia64 + x86_64) Architecture | 250 | # X86 (i386 + ia64 + x86_64) Architecture |
216 | 251 | ||
217 | config ACQUIRE_WDT | 252 | config ACQUIRE_WDT |
@@ -540,37 +575,11 @@ config SBC_EPX_C3_WATCHDOG | |||
540 | To compile this driver as a module, choose M here: the | 575 | To compile this driver as a module, choose M here: the |
541 | module will be called sbc_epx_c3. | 576 | module will be called sbc_epx_c3. |
542 | 577 | ||
543 | # PowerPC Architecture | 578 | # M32R Architecture |
544 | 579 | ||
545 | config 8xx_WDT | 580 | # M68K Architecture |
546 | tristate "MPC8xx Watchdog Timer" | ||
547 | depends on 8xx | ||
548 | 581 | ||
549 | config 83xx_WDT | 582 | # M68KNOMMU Architecture |
550 | tristate "MPC83xx Watchdog Timer" | ||
551 | depends on PPC_83xx | ||
552 | |||
553 | config MV64X60_WDT | ||
554 | tristate "MV64X60 (Marvell Discovery) Watchdog Timer" | ||
555 | depends on MV64X60 | ||
556 | |||
557 | config BOOKE_WDT | ||
558 | bool "PowerPC Book-E Watchdog Timer" | ||
559 | depends on BOOKE || 4xx | ||
560 | ---help--- | ||
561 | Please see Documentation/watchdog/watchdog-api.txt for | ||
562 | more information. | ||
563 | |||
564 | # PPC64 Architecture | ||
565 | |||
566 | config WATCHDOG_RTAS | ||
567 | tristate "RTAS watchdog" | ||
568 | depends on PPC_RTAS | ||
569 | help | ||
570 | This driver adds watchdog support for the RTAS watchdog. | ||
571 | |||
572 | To compile this driver as a module, choose M here. The module | ||
573 | will be called wdrtas. | ||
574 | 583 | ||
575 | # MIPS Architecture | 584 | # MIPS Architecture |
576 | 585 | ||
@@ -600,6 +609,44 @@ config WDT_RM9K_GPI | |||
600 | To compile this driver as a module, choose M here: the | 609 | To compile this driver as a module, choose M here: the |
601 | module will be called rm9k_wdt. | 610 | module will be called rm9k_wdt. |
602 | 611 | ||
612 | # PARISC Architecture | ||
613 | |||
614 | # POWERPC Architecture | ||
615 | |||
616 | config MPC5200_WDT | ||
617 | tristate "MPC5200 Watchdog Timer" | ||
618 | depends on PPC_MPC52xx | ||
619 | |||
620 | config 8xx_WDT | ||
621 | tristate "MPC8xx Watchdog Timer" | ||
622 | depends on 8xx | ||
623 | |||
624 | config 83xx_WDT | ||
625 | tristate "MPC83xx Watchdog Timer" | ||
626 | depends on PPC_83xx | ||
627 | |||
628 | config MV64X60_WDT | ||
629 | tristate "MV64X60 (Marvell Discovery) Watchdog Timer" | ||
630 | depends on MV64X60 | ||
631 | |||
632 | config BOOKE_WDT | ||
633 | bool "PowerPC Book-E Watchdog Timer" | ||
634 | depends on BOOKE || 4xx | ||
635 | ---help--- | ||
636 | Please see Documentation/watchdog/watchdog-api.txt for | ||
637 | more information. | ||
638 | |||
639 | # PPC64 Architecture | ||
640 | |||
641 | config WATCHDOG_RTAS | ||
642 | tristate "RTAS watchdog" | ||
643 | depends on PPC_RTAS | ||
644 | help | ||
645 | This driver adds watchdog support for the RTAS watchdog. | ||
646 | |||
647 | To compile this driver as a module, choose M here. The module | ||
648 | will be called wdrtas. | ||
649 | |||
603 | # S390 Architecture | 650 | # S390 Architecture |
604 | 651 | ||
605 | config ZVM_WATCHDOG | 652 | config ZVM_WATCHDOG |
@@ -614,7 +661,7 @@ config ZVM_WATCHDOG | |||
614 | To compile this driver as a module, choose M here. The module | 661 | To compile this driver as a module, choose M here. The module |
615 | will be called vmwatchdog. | 662 | will be called vmwatchdog. |
616 | 663 | ||
617 | # SUPERH Architecture | 664 | # SUPERH (sh + sh64) Architecture |
618 | 665 | ||
619 | config SH_WDT | 666 | config SH_WDT |
620 | tristate "SuperH Watchdog" | 667 | tristate "SuperH Watchdog" |
@@ -641,6 +688,8 @@ config SH_WDT_MMAP | |||
641 | If you say Y here, user applications will be able to mmap the | 688 | If you say Y here, user applications will be able to mmap the |
642 | WDT/CPG registers. | 689 | WDT/CPG registers. |
643 | 690 | ||
691 | # SPARC Architecture | ||
692 | |||
644 | # SPARC64 Architecture | 693 | # SPARC64 Architecture |
645 | 694 | ||
646 | config WATCHDOG_CP1XXX | 695 | config WATCHDOG_CP1XXX |
@@ -665,6 +714,10 @@ config WATCHDOG_RIO | |||
665 | machines. The watchdog timeout period is normally one minute but | 714 | machines. The watchdog timeout period is normally one minute but |
666 | can be changed with a boot-time parameter. | 715 | can be changed with a boot-time parameter. |
667 | 716 | ||
717 | # V850 Architecture | ||
718 | |||
719 | # XTENSA Architecture | ||
720 | |||
668 | # | 721 | # |
669 | # ISA-based Watchdog Cards | 722 | # ISA-based Watchdog Cards |
670 | # | 723 | # |
diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile index bdb9d5e3bb41..389f8b14ccc4 100644 --- a/drivers/char/watchdog/Makefile +++ b/drivers/char/watchdog/Makefile | |||
@@ -22,6 +22,8 @@ obj-$(CONFIG_WDTPCI) += wdt_pci.o | |||
22 | # USB-based Watchdog Cards | 22 | # USB-based Watchdog Cards |
23 | obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o | 23 | obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o |
24 | 24 | ||
25 | # ALPHA Architecture | ||
26 | |||
25 | # ARM Architecture | 27 | # ARM Architecture |
26 | obj-$(CONFIG_AT91RM9200_WATCHDOG) += at91rm9200_wdt.o | 28 | obj-$(CONFIG_AT91RM9200_WATCHDOG) += at91rm9200_wdt.o |
27 | obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o | 29 | obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o |
@@ -36,10 +38,22 @@ obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o | |||
36 | obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o | 38 | obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o |
37 | obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o | 39 | obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o |
38 | obj-$(CONFIG_IOP_WATCHDOG) += iop_wdt.o | 40 | obj-$(CONFIG_IOP_WATCHDOG) += iop_wdt.o |
41 | obj-$(CONFIG_DAVINCI_WATCHDOG) += davinci_wdt.o | ||
42 | |||
43 | # ARM26 Architecture | ||
39 | 44 | ||
40 | # AVR32 Architecture | 45 | # AVR32 Architecture |
41 | obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o | 46 | obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o |
42 | 47 | ||
48 | # BLACKFIN Architecture | ||
49 | obj-$(CONFIG_BFIN_WDT) += bfin_wdt.o | ||
50 | |||
51 | # CRIS Architecture | ||
52 | |||
53 | # FRV Architecture | ||
54 | |||
55 | # H8300 Architecture | ||
56 | |||
43 | # X86 (i386 + ia64 + x86_64) Architecture | 57 | # X86 (i386 + ia64 + x86_64) Architecture |
44 | obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o | 58 | obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o |
45 | obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o | 59 | obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o |
@@ -66,8 +80,22 @@ obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o | |||
66 | obj-$(CONFIG_MACHZ_WDT) += machzwd.o | 80 | obj-$(CONFIG_MACHZ_WDT) += machzwd.o |
67 | obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o | 81 | obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o |
68 | 82 | ||
69 | # PowerPC Architecture | 83 | # M32R Architecture |
84 | |||
85 | # M68K Architecture | ||
86 | |||
87 | # M68KNOMMU Architecture | ||
88 | |||
89 | # MIPS Architecture | ||
90 | obj-$(CONFIG_INDYDOG) += indydog.o | ||
91 | obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o | ||
92 | obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o | ||
93 | |||
94 | # PARISC Architecture | ||
95 | |||
96 | # POWERPC Architecture | ||
70 | obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o | 97 | obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o |
98 | obj-$(CONFIG_MPC5200_WDT) += mpc5200_wdt.o | ||
71 | obj-$(CONFIG_83xx_WDT) += mpc83xx_wdt.o | 99 | obj-$(CONFIG_83xx_WDT) += mpc83xx_wdt.o |
72 | obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o | 100 | obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o |
73 | obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o | 101 | obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o |
@@ -75,17 +103,18 @@ obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o | |||
75 | # PPC64 Architecture | 103 | # PPC64 Architecture |
76 | obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o | 104 | obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o |
77 | 105 | ||
78 | # MIPS Architecture | ||
79 | obj-$(CONFIG_INDYDOG) += indydog.o | ||
80 | obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o | ||
81 | obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o | ||
82 | |||
83 | # S390 Architecture | 106 | # S390 Architecture |
84 | 107 | ||
85 | # SUPERH Architecture | 108 | # SUPERH (sh + sh64) Architecture |
86 | obj-$(CONFIG_SH_WDT) += shwdt.o | 109 | obj-$(CONFIG_SH_WDT) += shwdt.o |
87 | 110 | ||
111 | # SPARC Architecture | ||
112 | |||
88 | # SPARC64 Architecture | 113 | # SPARC64 Architecture |
89 | 114 | ||
115 | # V850 Architecture | ||
116 | |||
117 | # XTENSA Architecture | ||
118 | |||
90 | # Architecture Independant | 119 | # Architecture Independant |
91 | obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o | 120 | obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o |
diff --git a/drivers/char/watchdog/bfin_wdt.c b/drivers/char/watchdog/bfin_wdt.c new file mode 100644 index 000000000000..309d27913fc1 --- /dev/null +++ b/drivers/char/watchdog/bfin_wdt.c | |||
@@ -0,0 +1,490 @@ | |||
1 | /* | ||
2 | * Blackfin On-Chip Watchdog Driver | ||
3 | * Supports BF53[123]/BF53[467]/BF54[2489]/BF561 | ||
4 | * | ||
5 | * Originally based on softdog.c | ||
6 | * Copyright 2006-2007 Analog Devices Inc. | ||
7 | * Copyright 2006-2007 Michele d'Amico | ||
8 | * Copyright 1996 Alan Cox <alan@redhat.com> | ||
9 | * | ||
10 | * Enter bugs at http://blackfin.uclinux.org/ | ||
11 | * | ||
12 | * Licensed under the GPL-2 or later. | ||
13 | */ | ||
14 | |||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/moduleparam.h> | ||
18 | #include <linux/types.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/miscdevice.h> | ||
21 | #include <linux/watchdog.h> | ||
22 | #include <linux/fs.h> | ||
23 | #include <linux/notifier.h> | ||
24 | #include <linux/reboot.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <asm/blackfin.h> | ||
28 | #include <asm/uaccess.h> | ||
29 | |||
30 | #define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) | ||
31 | #define stampit() stamp("here i am") | ||
32 | |||
33 | #define WATCHDOG_NAME "bfin-wdt" | ||
34 | #define PFX WATCHDOG_NAME ": " | ||
35 | |||
36 | /* The BF561 has two watchdogs (one per core), but since Linux | ||
37 | * only runs on core A, we'll just work with that one. | ||
38 | */ | ||
39 | #ifdef BF561_FAMILY | ||
40 | # define bfin_read_WDOG_CTL() bfin_read_WDOGA_CTL() | ||
41 | # define bfin_read_WDOG_CNT() bfin_read_WDOGA_CNT() | ||
42 | # define bfin_read_WDOG_STAT() bfin_read_WDOGA_STAT() | ||
43 | # define bfin_write_WDOG_CTL(x) bfin_write_WDOGA_CTL(x) | ||
44 | # define bfin_write_WDOG_CNT(x) bfin_write_WDOGA_CNT(x) | ||
45 | # define bfin_write_WDOG_STAT(x) bfin_write_WDOGA_STAT(x) | ||
46 | #endif | ||
47 | |||
48 | /* Bit in SWRST that indicates boot caused by watchdog */ | ||
49 | #define SWRST_RESET_WDOG 0x4000 | ||
50 | |||
51 | /* Bit in WDOG_CTL that indicates watchdog has expired (WDR0) */ | ||
52 | #define WDOG_EXPIRED 0x8000 | ||
53 | |||
54 | /* Masks for WDEV field in WDOG_CTL register */ | ||
55 | #define ICTL_RESET 0x0 | ||
56 | #define ICTL_NMI 0x2 | ||
57 | #define ICTL_GPI 0x4 | ||
58 | #define ICTL_NONE 0x6 | ||
59 | #define ICTL_MASK 0x6 | ||
60 | |||
61 | /* Masks for WDEN field in WDOG_CTL register */ | ||
62 | #define WDEN_MASK 0x0FF0 | ||
63 | #define WDEN_ENABLE 0x0000 | ||
64 | #define WDEN_DISABLE 0x0AD0 | ||
65 | |||
66 | /* some defaults */ | ||
67 | #define WATCHDOG_TIMEOUT 20 | ||
68 | |||
69 | static unsigned int timeout = WATCHDOG_TIMEOUT; | ||
70 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
71 | static struct watchdog_info bfin_wdt_info; | ||
72 | static unsigned long open_check; | ||
73 | static char expect_close; | ||
74 | static spinlock_t bfin_wdt_spinlock = SPIN_LOCK_UNLOCKED; | ||
75 | |||
76 | /** | ||
77 | * bfin_wdt_keepalive - Keep the Userspace Watchdog Alive | ||
78 | * | ||
79 | * The Userspace watchdog got a KeepAlive: schedule the next timeout. | ||
80 | */ | ||
81 | static int bfin_wdt_keepalive(void) | ||
82 | { | ||
83 | stampit(); | ||
84 | bfin_write_WDOG_STAT(0); | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | /** | ||
89 | * bfin_wdt_stop - Stop the Watchdog | ||
90 | * | ||
91 | * Stops the on-chip watchdog. | ||
92 | */ | ||
93 | static int bfin_wdt_stop(void) | ||
94 | { | ||
95 | stampit(); | ||
96 | bfin_write_WDOG_CTL(WDEN_DISABLE); | ||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | /** | ||
101 | * bfin_wdt_start - Start the Watchdog | ||
102 | * | ||
103 | * Starts the on-chip watchdog. Automatically loads WDOG_CNT | ||
104 | * into WDOG_STAT for us. | ||
105 | */ | ||
106 | static int bfin_wdt_start(void) | ||
107 | { | ||
108 | stampit(); | ||
109 | bfin_write_WDOG_CTL(WDEN_ENABLE | ICTL_RESET); | ||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | /** | ||
114 | * bfin_wdt_running - Check Watchdog status | ||
115 | * | ||
116 | * See if the watchdog is running. | ||
117 | */ | ||
118 | static int bfin_wdt_running(void) | ||
119 | { | ||
120 | stampit(); | ||
121 | return ((bfin_read_WDOG_CTL() & WDEN_MASK) != WDEN_DISABLE); | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * bfin_wdt_set_timeout - Set the Userspace Watchdog timeout | ||
126 | * @t: new timeout value (in seconds) | ||
127 | * | ||
128 | * Translate the specified timeout in seconds into System Clock | ||
129 | * terms which is what the on-chip Watchdog requires. | ||
130 | */ | ||
131 | static int bfin_wdt_set_timeout(unsigned long t) | ||
132 | { | ||
133 | u32 cnt; | ||
134 | unsigned long flags; | ||
135 | |||
136 | stampit(); | ||
137 | |||
138 | cnt = t * get_sclk(); | ||
139 | if (cnt < get_sclk()) { | ||
140 | printk(KERN_WARNING PFX "timeout value is too large\n"); | ||
141 | return -EINVAL; | ||
142 | } | ||
143 | |||
144 | spin_lock_irqsave(&bfin_wdt_spinlock, flags); | ||
145 | { | ||
146 | int run = bfin_wdt_running(); | ||
147 | bfin_wdt_stop(); | ||
148 | bfin_write_WDOG_CNT(cnt); | ||
149 | if (run) bfin_wdt_start(); | ||
150 | } | ||
151 | spin_unlock_irqrestore(&bfin_wdt_spinlock, flags); | ||
152 | |||
153 | timeout = t; | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | /** | ||
159 | * bfin_wdt_open - Open the Device | ||
160 | * @inode: inode of device | ||
161 | * @file: file handle of device | ||
162 | * | ||
163 | * Watchdog device is opened and started. | ||
164 | */ | ||
165 | static int bfin_wdt_open(struct inode *inode, struct file *file) | ||
166 | { | ||
167 | stampit(); | ||
168 | |||
169 | if (test_and_set_bit(0, &open_check)) | ||
170 | return -EBUSY; | ||
171 | |||
172 | if (nowayout) | ||
173 | __module_get(THIS_MODULE); | ||
174 | |||
175 | bfin_wdt_keepalive(); | ||
176 | bfin_wdt_start(); | ||
177 | |||
178 | return nonseekable_open(inode, file); | ||
179 | } | ||
180 | |||
181 | /** | ||
182 | * bfin_wdt_close - Close the Device | ||
183 | * @inode: inode of device | ||
184 | * @file: file handle of device | ||
185 | * | ||
186 | * Watchdog device is closed and stopped. | ||
187 | */ | ||
188 | static int bfin_wdt_release(struct inode *inode, struct file *file) | ||
189 | { | ||
190 | stampit(); | ||
191 | |||
192 | if (expect_close == 42) { | ||
193 | bfin_wdt_stop(); | ||
194 | } else { | ||
195 | printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); | ||
196 | bfin_wdt_keepalive(); | ||
197 | } | ||
198 | |||
199 | expect_close = 0; | ||
200 | clear_bit(0, &open_check); | ||
201 | |||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | /** | ||
206 | * bfin_wdt_write - Write to Device | ||
207 | * @file: file handle of device | ||
208 | * @buf: buffer to write | ||
209 | * @count: length of buffer | ||
210 | * @ppos: offset | ||
211 | * | ||
212 | * Pings the watchdog on write. | ||
213 | */ | ||
214 | static ssize_t bfin_wdt_write(struct file *file, const char __user *data, | ||
215 | size_t len, loff_t *ppos) | ||
216 | { | ||
217 | stampit(); | ||
218 | |||
219 | if (len) { | ||
220 | if (!nowayout) { | ||
221 | size_t i; | ||
222 | |||
223 | /* In case it was set long ago */ | ||
224 | expect_close = 0; | ||
225 | |||
226 | for (i = 0; i != len; i++) { | ||
227 | char c; | ||
228 | if (get_user(c, data + i)) | ||
229 | return -EFAULT; | ||
230 | if (c == 'V') | ||
231 | expect_close = 42; | ||
232 | } | ||
233 | } | ||
234 | bfin_wdt_keepalive(); | ||
235 | } | ||
236 | |||
237 | return len; | ||
238 | } | ||
239 | |||
240 | /** | ||
241 | * bfin_wdt_ioctl - Query Device | ||
242 | * @inode: inode of device | ||
243 | * @file: file handle of device | ||
244 | * @cmd: watchdog command | ||
245 | * @arg: argument | ||
246 | * | ||
247 | * Query basic information from the device or ping it, as outlined by the | ||
248 | * watchdog API. | ||
249 | */ | ||
250 | static int bfin_wdt_ioctl(struct inode *inode, struct file *file, | ||
251 | unsigned int cmd, unsigned long arg) | ||
252 | { | ||
253 | void __user *argp = (void __user *)arg; | ||
254 | int __user *p = argp; | ||
255 | |||
256 | stampit(); | ||
257 | |||
258 | switch (cmd) { | ||
259 | default: | ||
260 | return -ENOTTY; | ||
261 | |||
262 | case WDIOC_GETSUPPORT: | ||
263 | if (copy_to_user(argp, &bfin_wdt_info, sizeof(bfin_wdt_info))) | ||
264 | return -EFAULT; | ||
265 | else | ||
266 | return 0; | ||
267 | |||
268 | case WDIOC_GETSTATUS: | ||
269 | case WDIOC_GETBOOTSTATUS: | ||
270 | return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p); | ||
271 | |||
272 | case WDIOC_KEEPALIVE: | ||
273 | bfin_wdt_keepalive(); | ||
274 | return 0; | ||
275 | |||
276 | case WDIOC_SETTIMEOUT: { | ||
277 | int new_timeout; | ||
278 | |||
279 | if (get_user(new_timeout, p)) | ||
280 | return -EFAULT; | ||
281 | |||
282 | if (bfin_wdt_set_timeout(new_timeout)) | ||
283 | return -EINVAL; | ||
284 | } | ||
285 | /* Fall */ | ||
286 | case WDIOC_GETTIMEOUT: | ||
287 | return put_user(timeout, p); | ||
288 | |||
289 | case WDIOC_SETOPTIONS: { | ||
290 | unsigned long flags; | ||
291 | int options, ret = -EINVAL; | ||
292 | |||
293 | if (get_user(options, p)) | ||
294 | return -EFAULT; | ||
295 | |||
296 | spin_lock_irqsave(&bfin_wdt_spinlock, flags); | ||
297 | |||
298 | if (options & WDIOS_DISABLECARD) { | ||
299 | bfin_wdt_stop(); | ||
300 | ret = 0; | ||
301 | } | ||
302 | |||
303 | if (options & WDIOS_ENABLECARD) { | ||
304 | bfin_wdt_start(); | ||
305 | ret = 0; | ||
306 | } | ||
307 | |||
308 | spin_unlock_irqrestore(&bfin_wdt_spinlock, flags); | ||
309 | |||
310 | return ret; | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * bfin_wdt_notify_sys - Notifier Handler | ||
317 | * @this: notifier block | ||
318 | * @code: notifier event | ||
319 | * @unused: unused | ||
320 | * | ||
321 | * Handles specific events, such as turning off the watchdog during a | ||
322 | * shutdown event. | ||
323 | */ | ||
324 | static int bfin_wdt_notify_sys(struct notifier_block *this, unsigned long code, | ||
325 | void *unused) | ||
326 | { | ||
327 | stampit(); | ||
328 | |||
329 | if (code == SYS_DOWN || code == SYS_HALT) | ||
330 | bfin_wdt_stop(); | ||
331 | |||
332 | return NOTIFY_DONE; | ||
333 | } | ||
334 | |||
335 | #ifdef CONFIG_PM | ||
336 | static int state_before_suspend; | ||
337 | |||
338 | /** | ||
339 | * bfin_wdt_suspend - suspend the watchdog | ||
340 | * @pdev: device being suspended | ||
341 | * @state: requested suspend state | ||
342 | * | ||
343 | * Remember if the watchdog was running and stop it. | ||
344 | * TODO: is this even right? Doesn't seem to be any | ||
345 | * standard in the watchdog world ... | ||
346 | */ | ||
347 | static int bfin_wdt_suspend(struct platform_device *pdev, pm_message_t state) | ||
348 | { | ||
349 | stampit(); | ||
350 | |||
351 | state_before_suspend = bfin_wdt_running(); | ||
352 | bfin_wdt_stop(); | ||
353 | |||
354 | return 0; | ||
355 | } | ||
356 | |||
357 | /** | ||
358 | * bfin_wdt_resume - resume the watchdog | ||
359 | * @pdev: device being resumed | ||
360 | * | ||
361 | * If the watchdog was running, turn it back on. | ||
362 | */ | ||
363 | static int bfin_wdt_resume(struct platform_device *pdev) | ||
364 | { | ||
365 | stampit(); | ||
366 | |||
367 | if (state_before_suspend) { | ||
368 | bfin_wdt_set_timeout(timeout); | ||
369 | bfin_wdt_start(); | ||
370 | } | ||
371 | |||
372 | return 0; | ||
373 | } | ||
374 | #else | ||
375 | # define bfin_wdt_suspend NULL | ||
376 | # define bfin_wdt_resume NULL | ||
377 | #endif | ||
378 | |||
379 | static struct platform_device bfin_wdt_device = { | ||
380 | .name = WATCHDOG_NAME, | ||
381 | .id = -1, | ||
382 | }; | ||
383 | |||
384 | static struct platform_driver bfin_wdt_driver = { | ||
385 | .driver = { | ||
386 | .name = WATCHDOG_NAME, | ||
387 | .owner = THIS_MODULE, | ||
388 | }, | ||
389 | .suspend = bfin_wdt_suspend, | ||
390 | .resume = bfin_wdt_resume, | ||
391 | }; | ||
392 | |||
393 | static struct file_operations bfin_wdt_fops = { | ||
394 | .owner = THIS_MODULE, | ||
395 | .llseek = no_llseek, | ||
396 | .write = bfin_wdt_write, | ||
397 | .ioctl = bfin_wdt_ioctl, | ||
398 | .open = bfin_wdt_open, | ||
399 | .release = bfin_wdt_release, | ||
400 | }; | ||
401 | |||
402 | static struct miscdevice bfin_wdt_miscdev = { | ||
403 | .minor = WATCHDOG_MINOR, | ||
404 | .name = "watchdog", | ||
405 | .fops = &bfin_wdt_fops, | ||
406 | }; | ||
407 | |||
408 | static struct watchdog_info bfin_wdt_info = { | ||
409 | .identity = "Blackfin Watchdog", | ||
410 | .options = WDIOF_SETTIMEOUT | | ||
411 | WDIOF_KEEPALIVEPING | | ||
412 | WDIOF_MAGICCLOSE, | ||
413 | }; | ||
414 | |||
415 | static struct notifier_block bfin_wdt_notifier = { | ||
416 | .notifier_call = bfin_wdt_notify_sys, | ||
417 | }; | ||
418 | |||
419 | /** | ||
420 | * bfin_wdt_init - Initialize module | ||
421 | * | ||
422 | * Registers the device and notifier handler. Actual device | ||
423 | * initialization is handled by bfin_wdt_open(). | ||
424 | */ | ||
425 | static int __init bfin_wdt_init(void) | ||
426 | { | ||
427 | int ret; | ||
428 | |||
429 | stampit(); | ||
430 | |||
431 | /* Check that the timeout value is within range */ | ||
432 | if (bfin_wdt_set_timeout(timeout)) | ||
433 | return -EINVAL; | ||
434 | |||
435 | /* Since this is an on-chip device and needs no board-specific | ||
436 | * resources, we'll handle all the platform device stuff here. | ||
437 | */ | ||
438 | ret = platform_device_register(&bfin_wdt_device); | ||
439 | if (ret) | ||
440 | return ret; | ||
441 | |||
442 | ret = platform_driver_probe(&bfin_wdt_driver, NULL); | ||
443 | if (ret) | ||
444 | return ret; | ||
445 | |||
446 | ret = register_reboot_notifier(&bfin_wdt_notifier); | ||
447 | if (ret) { | ||
448 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret); | ||
449 | return ret; | ||
450 | } | ||
451 | |||
452 | ret = misc_register(&bfin_wdt_miscdev); | ||
453 | if (ret) { | ||
454 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | ||
455 | WATCHDOG_MINOR, ret); | ||
456 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
457 | return ret; | ||
458 | } | ||
459 | |||
460 | printk(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n", | ||
461 | timeout, nowayout); | ||
462 | |||
463 | return 0; | ||
464 | } | ||
465 | |||
466 | /** | ||
467 | * bfin_wdt_exit - Deinitialize module | ||
468 | * | ||
469 | * Unregisters the device and notifier handler. Actual device | ||
470 | * deinitialization is handled by bfin_wdt_close(). | ||
471 | */ | ||
472 | static void __exit bfin_wdt_exit(void) | ||
473 | { | ||
474 | misc_deregister(&bfin_wdt_miscdev); | ||
475 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
476 | } | ||
477 | |||
478 | module_init(bfin_wdt_init); | ||
479 | module_exit(bfin_wdt_exit); | ||
480 | |||
481 | MODULE_AUTHOR("Michele d'Amico, Mike Frysinger <vapier@gentoo.org>"); | ||
482 | MODULE_DESCRIPTION("Blackfin Watchdog Device Driver"); | ||
483 | MODULE_LICENSE("GPL"); | ||
484 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
485 | |||
486 | module_param(timeout, uint, 0); | ||
487 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=((2^32)/SCLK), default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | ||
488 | |||
489 | module_param(nowayout, int, 0); | ||
490 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c index 0f5c77ddd39d..d362f5bf658a 100644 --- a/drivers/char/watchdog/booke_wdt.c +++ b/drivers/char/watchdog/booke_wdt.c | |||
@@ -144,7 +144,7 @@ static int booke_wdt_open (struct inode *inode, struct file *file) | |||
144 | booke_wdt_period); | 144 | booke_wdt_period); |
145 | } | 145 | } |
146 | 146 | ||
147 | return 0; | 147 | return nonseekable_open(inode, file); |
148 | } | 148 | } |
149 | 149 | ||
150 | static const struct file_operations booke_wdt_fops = { | 150 | static const struct file_operations booke_wdt_fops = { |
diff --git a/drivers/char/watchdog/cpu5wdt.c b/drivers/char/watchdog/cpu5wdt.c index d0d45a8b09f0..5941ca601a3a 100644 --- a/drivers/char/watchdog/cpu5wdt.c +++ b/drivers/char/watchdog/cpu5wdt.c | |||
@@ -162,6 +162,10 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm | |||
162 | if ( copy_to_user(argp, &value, sizeof(int)) ) | 162 | if ( copy_to_user(argp, &value, sizeof(int)) ) |
163 | return -EFAULT; | 163 | return -EFAULT; |
164 | break; | 164 | break; |
165 | case WDIOC_GETBOOTSTATUS: | ||
166 | if ( copy_to_user(argp, &value, sizeof(int)) ) | ||
167 | return -EFAULT; | ||
168 | break; | ||
165 | case WDIOC_GETSUPPORT: | 169 | case WDIOC_GETSUPPORT: |
166 | if ( copy_to_user(argp, &ident, sizeof(ident)) ) | 170 | if ( copy_to_user(argp, &ident, sizeof(ident)) ) |
167 | return -EFAULT; | 171 | return -EFAULT; |
diff --git a/drivers/char/watchdog/davinci_wdt.c b/drivers/char/watchdog/davinci_wdt.c new file mode 100644 index 000000000000..19db5302ba6e --- /dev/null +++ b/drivers/char/watchdog/davinci_wdt.c | |||
@@ -0,0 +1,281 @@ | |||
1 | /* | ||
2 | * drivers/char/watchdog/davinci_wdt.c | ||
3 | * | ||
4 | * Watchdog driver for DaVinci DM644x/DM646x processors | ||
5 | * | ||
6 | * Copyright (C) 2006 Texas Instruments. | ||
7 | * | ||
8 | * 2007 (c) MontaVista Software, Inc. This file is licensed under | ||
9 | * the terms of the GNU General Public License version 2. This program | ||
10 | * is licensed "as is" without any warranty of any kind, whether express | ||
11 | * or implied. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/moduleparam.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/fs.h> | ||
19 | #include <linux/miscdevice.h> | ||
20 | #include <linux/watchdog.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/bitops.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/spinlock.h> | ||
25 | |||
26 | #include <asm/hardware.h> | ||
27 | #include <asm/uaccess.h> | ||
28 | #include <asm/io.h> | ||
29 | |||
30 | #define MODULE_NAME "DAVINCI-WDT: " | ||
31 | |||
32 | #define DEFAULT_HEARTBEAT 60 | ||
33 | #define MAX_HEARTBEAT 600 /* really the max margin is 264/27MHz*/ | ||
34 | |||
35 | /* Timer register set definition */ | ||
36 | #define PID12 (0x0) | ||
37 | #define EMUMGT (0x4) | ||
38 | #define TIM12 (0x10) | ||
39 | #define TIM34 (0x14) | ||
40 | #define PRD12 (0x18) | ||
41 | #define PRD34 (0x1C) | ||
42 | #define TCR (0x20) | ||
43 | #define TGCR (0x24) | ||
44 | #define WDTCR (0x28) | ||
45 | |||
46 | /* TCR bit definitions */ | ||
47 | #define ENAMODE12_DISABLED (0 << 6) | ||
48 | #define ENAMODE12_ONESHOT (1 << 6) | ||
49 | #define ENAMODE12_PERIODIC (2 << 6) | ||
50 | |||
51 | /* TGCR bit definitions */ | ||
52 | #define TIM12RS_UNRESET (1 << 0) | ||
53 | #define TIM34RS_UNRESET (1 << 1) | ||
54 | #define TIMMODE_64BIT_WDOG (2 << 2) | ||
55 | |||
56 | /* WDTCR bit definitions */ | ||
57 | #define WDEN (1 << 14) | ||
58 | #define WDFLAG (1 << 15) | ||
59 | #define WDKEY_SEQ0 (0xa5c6 << 16) | ||
60 | #define WDKEY_SEQ1 (0xda7e << 16) | ||
61 | |||
62 | static int heartbeat = DEFAULT_HEARTBEAT; | ||
63 | |||
64 | static spinlock_t io_lock; | ||
65 | static unsigned long wdt_status; | ||
66 | #define WDT_IN_USE 0 | ||
67 | #define WDT_OK_TO_CLOSE 1 | ||
68 | #define WDT_REGION_INITED 2 | ||
69 | #define WDT_DEVICE_INITED 3 | ||
70 | |||
71 | static struct resource *wdt_mem; | ||
72 | static void __iomem *wdt_base; | ||
73 | |||
74 | static void wdt_service(void) | ||
75 | { | ||
76 | spin_lock(&io_lock); | ||
77 | |||
78 | /* put watchdog in service state */ | ||
79 | davinci_writel(WDKEY_SEQ0, wdt_base + WDTCR); | ||
80 | /* put watchdog in active state */ | ||
81 | davinci_writel(WDKEY_SEQ1, wdt_base + WDTCR); | ||
82 | |||
83 | spin_unlock(&io_lock); | ||
84 | } | ||
85 | |||
86 | static void wdt_enable(void) | ||
87 | { | ||
88 | u32 tgcr; | ||
89 | u32 timer_margin; | ||
90 | |||
91 | spin_lock(&io_lock); | ||
92 | |||
93 | /* disable, internal clock source */ | ||
94 | davinci_writel(0, wdt_base + TCR); | ||
95 | /* reset timer, set mode to 64-bit watchdog, and unreset */ | ||
96 | davinci_writel(0, wdt_base + TGCR); | ||
97 | tgcr = TIMMODE_64BIT_WDOG | TIM12RS_UNRESET | TIM34RS_UNRESET; | ||
98 | davinci_writel(tgcr, wdt_base + TGCR); | ||
99 | /* clear counter regs */ | ||
100 | davinci_writel(0, wdt_base + TIM12); | ||
101 | davinci_writel(0, wdt_base + TIM34); | ||
102 | /* set timeout period */ | ||
103 | timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) & 0xffffffff); | ||
104 | davinci_writel(timer_margin, wdt_base + PRD12); | ||
105 | timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) >> 32); | ||
106 | davinci_writel(timer_margin, wdt_base + PRD34); | ||
107 | /* enable run continuously */ | ||
108 | davinci_writel(ENAMODE12_PERIODIC, wdt_base + TCR); | ||
109 | /* Once the WDT is in pre-active state write to | ||
110 | * TIM12, TIM34, PRD12, PRD34, TCR, TGCR, WDTCR are | ||
111 | * write protected (except for the WDKEY field) | ||
112 | */ | ||
113 | /* put watchdog in pre-active state */ | ||
114 | davinci_writel(WDKEY_SEQ0 | WDEN, wdt_base + WDTCR); | ||
115 | /* put watchdog in active state */ | ||
116 | davinci_writel(WDKEY_SEQ1 | WDEN, wdt_base + WDTCR); | ||
117 | |||
118 | spin_unlock(&io_lock); | ||
119 | } | ||
120 | |||
121 | static int davinci_wdt_open(struct inode *inode, struct file *file) | ||
122 | { | ||
123 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | ||
124 | return -EBUSY; | ||
125 | |||
126 | wdt_enable(); | ||
127 | |||
128 | return nonseekable_open(inode, file); | ||
129 | } | ||
130 | |||
131 | static ssize_t | ||
132 | davinci_wdt_write(struct file *file, const char *data, size_t len, | ||
133 | loff_t *ppos) | ||
134 | { | ||
135 | if (len) | ||
136 | wdt_service(); | ||
137 | |||
138 | return len; | ||
139 | } | ||
140 | |||
141 | static struct watchdog_info ident = { | ||
142 | .options = WDIOF_KEEPALIVEPING, | ||
143 | .identity = "DaVinci Watchdog", | ||
144 | }; | ||
145 | |||
146 | static int | ||
147 | davinci_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | ||
148 | unsigned long arg) | ||
149 | { | ||
150 | int ret = -ENOTTY; | ||
151 | |||
152 | switch (cmd) { | ||
153 | case WDIOC_GETSUPPORT: | ||
154 | ret = copy_to_user((struct watchdog_info *)arg, &ident, | ||
155 | sizeof(ident)) ? -EFAULT : 0; | ||
156 | break; | ||
157 | |||
158 | case WDIOC_GETSTATUS: | ||
159 | case WDIOC_GETBOOTSTATUS: | ||
160 | ret = put_user(0, (int *)arg); | ||
161 | break; | ||
162 | |||
163 | case WDIOC_GETTIMEOUT: | ||
164 | ret = put_user(heartbeat, (int *)arg); | ||
165 | break; | ||
166 | |||
167 | case WDIOC_KEEPALIVE: | ||
168 | wdt_service(); | ||
169 | ret = 0; | ||
170 | break; | ||
171 | } | ||
172 | return ret; | ||
173 | } | ||
174 | |||
175 | static int davinci_wdt_release(struct inode *inode, struct file *file) | ||
176 | { | ||
177 | wdt_service(); | ||
178 | clear_bit(WDT_IN_USE, &wdt_status); | ||
179 | |||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | static const struct file_operations davinci_wdt_fops = { | ||
184 | .owner = THIS_MODULE, | ||
185 | .llseek = no_llseek, | ||
186 | .write = davinci_wdt_write, | ||
187 | .ioctl = davinci_wdt_ioctl, | ||
188 | .open = davinci_wdt_open, | ||
189 | .release = davinci_wdt_release, | ||
190 | }; | ||
191 | |||
192 | static struct miscdevice davinci_wdt_miscdev = { | ||
193 | .minor = WATCHDOG_MINOR, | ||
194 | .name = "watchdog", | ||
195 | .fops = &davinci_wdt_fops, | ||
196 | }; | ||
197 | |||
198 | static int davinci_wdt_probe(struct platform_device *pdev) | ||
199 | { | ||
200 | int ret = 0, size; | ||
201 | struct resource *res; | ||
202 | |||
203 | spin_lock_init(&io_lock); | ||
204 | |||
205 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) | ||
206 | heartbeat = DEFAULT_HEARTBEAT; | ||
207 | |||
208 | printk(KERN_INFO MODULE_NAME | ||
209 | "DaVinci Watchdog Timer: heartbeat %d sec\n", heartbeat); | ||
210 | |||
211 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
212 | if (res == NULL) { | ||
213 | printk(KERN_INFO MODULE_NAME | ||
214 | "failed to get memory region resource\n"); | ||
215 | return -ENOENT; | ||
216 | } | ||
217 | |||
218 | size = res->end - res->start + 1; | ||
219 | wdt_mem = request_mem_region(res->start, size, pdev->name); | ||
220 | |||
221 | if (wdt_mem == NULL) { | ||
222 | printk(KERN_INFO MODULE_NAME "failed to get memory region\n"); | ||
223 | return -ENOENT; | ||
224 | } | ||
225 | wdt_base = (void __iomem *)(res->start); | ||
226 | |||
227 | ret = misc_register(&davinci_wdt_miscdev); | ||
228 | if (ret < 0) { | ||
229 | printk(KERN_ERR MODULE_NAME "cannot register misc device\n"); | ||
230 | release_resource(wdt_mem); | ||
231 | kfree(wdt_mem); | ||
232 | } else { | ||
233 | set_bit(WDT_DEVICE_INITED, &wdt_status); | ||
234 | } | ||
235 | |||
236 | return ret; | ||
237 | } | ||
238 | |||
239 | static int davinci_wdt_remove(struct platform_device *pdev) | ||
240 | { | ||
241 | misc_deregister(&davinci_wdt_miscdev); | ||
242 | if (wdt_mem) { | ||
243 | release_resource(wdt_mem); | ||
244 | kfree(wdt_mem); | ||
245 | wdt_mem = NULL; | ||
246 | } | ||
247 | return 0; | ||
248 | } | ||
249 | |||
250 | static struct platform_driver platform_wdt_driver = { | ||
251 | .driver = { | ||
252 | .name = "watchdog", | ||
253 | }, | ||
254 | .probe = davinci_wdt_probe, | ||
255 | .remove = davinci_wdt_remove, | ||
256 | }; | ||
257 | |||
258 | static int __init davinci_wdt_init(void) | ||
259 | { | ||
260 | return platform_driver_register(&platform_wdt_driver); | ||
261 | } | ||
262 | |||
263 | static void __exit davinci_wdt_exit(void) | ||
264 | { | ||
265 | return platform_driver_unregister(&platform_wdt_driver); | ||
266 | } | ||
267 | |||
268 | module_init(davinci_wdt_init); | ||
269 | module_exit(davinci_wdt_exit); | ||
270 | |||
271 | MODULE_AUTHOR("Texas Instruments"); | ||
272 | MODULE_DESCRIPTION("DaVinci Watchdog Driver"); | ||
273 | |||
274 | module_param(heartbeat, int, 0); | ||
275 | MODULE_PARM_DESC(heartbeat, | ||
276 | "Watchdog heartbeat period in seconds from 1 to " | ||
277 | __MODULE_STRING(MAX_HEARTBEAT) ", default " | ||
278 | __MODULE_STRING(DEFAULT_HEARTBEAT)); | ||
279 | |||
280 | MODULE_LICENSE("GPL"); | ||
281 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/char/watchdog/iTCO_wdt.c b/drivers/char/watchdog/iTCO_wdt.c index eac4f9b9f007..cd5a565bc3a0 100644 --- a/drivers/char/watchdog/iTCO_wdt.c +++ b/drivers/char/watchdog/iTCO_wdt.c | |||
@@ -39,7 +39,12 @@ | |||
39 | * 82801HR (ICH8R) : document number 313056-002, 313057-004, | 39 | * 82801HR (ICH8R) : document number 313056-002, 313057-004, |
40 | * 82801HH (ICH8DH) : document number 313056-002, 313057-004, | 40 | * 82801HH (ICH8DH) : document number 313056-002, 313057-004, |
41 | * 82801HO (ICH8DO) : document number 313056-002, 313057-004, | 41 | * 82801HO (ICH8DO) : document number 313056-002, 313057-004, |
42 | * 6300ESB (6300ESB) : document number 300641-003 | 42 | * 82801IB (ICH9) : document number 316972-001, 316973-001, |
43 | * 82801IR (ICH9R) : document number 316972-001, 316973-001, | ||
44 | * 82801IH (ICH9DH) : document number 316972-001, 316973-001, | ||
45 | * 6300ESB (6300ESB) : document number 300641-003, 300884-010, | ||
46 | * 631xESB (631xESB) : document number 313082-001, 313075-005, | ||
47 | * 632xESB (632xESB) : document number 313082-001, 313075-005 | ||
43 | */ | 48 | */ |
44 | 49 | ||
45 | /* | 50 | /* |
@@ -48,8 +53,8 @@ | |||
48 | 53 | ||
49 | /* Module and version information */ | 54 | /* Module and version information */ |
50 | #define DRV_NAME "iTCO_wdt" | 55 | #define DRV_NAME "iTCO_wdt" |
51 | #define DRV_VERSION "1.01" | 56 | #define DRV_VERSION "1.02" |
52 | #define DRV_RELDATE "21-Jan-2007" | 57 | #define DRV_RELDATE "26-Jul-2007" |
53 | #define PFX DRV_NAME ": " | 58 | #define PFX DRV_NAME ": " |
54 | 59 | ||
55 | /* Includes */ | 60 | /* Includes */ |
@@ -92,6 +97,10 @@ enum iTCO_chipsets { | |||
92 | TCO_ICH8, /* ICH8 & ICH8R */ | 97 | TCO_ICH8, /* ICH8 & ICH8R */ |
93 | TCO_ICH8DH, /* ICH8DH */ | 98 | TCO_ICH8DH, /* ICH8DH */ |
94 | TCO_ICH8DO, /* ICH8DO */ | 99 | TCO_ICH8DO, /* ICH8DO */ |
100 | TCO_ICH9, /* ICH9 */ | ||
101 | TCO_ICH9R, /* ICH9R */ | ||
102 | TCO_ICH9DH, /* ICH9DH */ | ||
103 | TCO_631XESB, /* 631xESB/632xESB */ | ||
95 | }; | 104 | }; |
96 | 105 | ||
97 | static struct { | 106 | static struct { |
@@ -118,6 +127,10 @@ static struct { | |||
118 | {"ICH8 or ICH8R", 2}, | 127 | {"ICH8 or ICH8R", 2}, |
119 | {"ICH8DH", 2}, | 128 | {"ICH8DH", 2}, |
120 | {"ICH8DO", 2}, | 129 | {"ICH8DO", 2}, |
130 | {"ICH9", 2}, | ||
131 | {"ICH9R", 2}, | ||
132 | {"ICH9DH", 2}, | ||
133 | {"631xESB/632xESB", 2}, | ||
121 | {NULL,0} | 134 | {NULL,0} |
122 | }; | 135 | }; |
123 | 136 | ||
@@ -148,6 +161,25 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = { | |||
148 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8 }, | 161 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8 }, |
149 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DH }, | 162 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DH }, |
150 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DO }, | 163 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DO }, |
164 | { PCI_VENDOR_ID_INTEL, 0x2918, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9 }, | ||
165 | { PCI_VENDOR_ID_INTEL, 0x2916, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9R }, | ||
166 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9DH }, | ||
167 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
168 | { PCI_VENDOR_ID_INTEL, 0x2671, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
169 | { PCI_VENDOR_ID_INTEL, 0x2672, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
170 | { PCI_VENDOR_ID_INTEL, 0x2673, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
171 | { PCI_VENDOR_ID_INTEL, 0x2674, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
172 | { PCI_VENDOR_ID_INTEL, 0x2675, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
173 | { PCI_VENDOR_ID_INTEL, 0x2676, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
174 | { PCI_VENDOR_ID_INTEL, 0x2677, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
175 | { PCI_VENDOR_ID_INTEL, 0x2678, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
176 | { PCI_VENDOR_ID_INTEL, 0x2679, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
177 | { PCI_VENDOR_ID_INTEL, 0x267a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
178 | { PCI_VENDOR_ID_INTEL, 0x267b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
179 | { PCI_VENDOR_ID_INTEL, 0x267c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
180 | { PCI_VENDOR_ID_INTEL, 0x267d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
181 | { PCI_VENDOR_ID_INTEL, 0x267e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
182 | { PCI_VENDOR_ID_INTEL, 0x267f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, | ||
151 | { 0, }, /* End of list */ | 183 | { 0, }, /* End of list */ |
152 | }; | 184 | }; |
153 | MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl); | 185 | MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl); |
diff --git a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c index a0d27160c80e..6d35bb112a5f 100644 --- a/drivers/char/watchdog/machzwd.c +++ b/drivers/char/watchdog/machzwd.c | |||
@@ -321,6 +321,7 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
321 | break; | 321 | break; |
322 | 322 | ||
323 | case WDIOC_GETSTATUS: | 323 | case WDIOC_GETSTATUS: |
324 | case WDIOC_GETBOOTSTATUS: | ||
324 | return put_user(0, p); | 325 | return put_user(0, p); |
325 | 326 | ||
326 | case WDIOC_KEEPALIVE: | 327 | case WDIOC_KEEPALIVE: |
diff --git a/drivers/char/watchdog/mixcomwd.c b/drivers/char/watchdog/mixcomwd.c index db2ccb864412..1adf1d56027d 100644 --- a/drivers/char/watchdog/mixcomwd.c +++ b/drivers/char/watchdog/mixcomwd.c | |||
@@ -215,6 +215,11 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file, | |||
215 | return -EFAULT; | 215 | return -EFAULT; |
216 | } | 216 | } |
217 | break; | 217 | break; |
218 | case WDIOC_GETBOOTSTATUS: | ||
219 | if (copy_to_user(p, &status, sizeof(int))) { | ||
220 | return -EFAULT; | ||
221 | } | ||
222 | break; | ||
218 | case WDIOC_GETSUPPORT: | 223 | case WDIOC_GETSUPPORT: |
219 | if (copy_to_user(argp, &ident, sizeof(ident))) { | 224 | if (copy_to_user(argp, &ident, sizeof(ident))) { |
220 | return -EFAULT; | 225 | return -EFAULT; |
diff --git a/drivers/char/watchdog/mpc5200_wdt.c b/drivers/char/watchdog/mpc5200_wdt.c new file mode 100644 index 000000000000..564143d40610 --- /dev/null +++ b/drivers/char/watchdog/mpc5200_wdt.c | |||
@@ -0,0 +1,286 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <linux/module.h> | ||
3 | #include <linux/miscdevice.h> | ||
4 | #include <linux/watchdog.h> | ||
5 | #include <linux/io.h> | ||
6 | #include <linux/spinlock.h> | ||
7 | #include <asm/of_platform.h> | ||
8 | #include <asm/uaccess.h> | ||
9 | #include <asm/mpc52xx.h> | ||
10 | |||
11 | |||
12 | #define GPT_MODE_WDT (1<<15) | ||
13 | #define GPT_MODE_CE (1<<12) | ||
14 | #define GPT_MODE_MS_TIMER (0x4) | ||
15 | |||
16 | |||
17 | struct mpc5200_wdt { | ||
18 | unsigned count; /* timer ticks before watchdog kicks in */ | ||
19 | long ipb_freq; | ||
20 | struct miscdevice miscdev; | ||
21 | struct resource mem; | ||
22 | struct mpc52xx_gpt __iomem *regs; | ||
23 | spinlock_t io_lock; | ||
24 | }; | ||
25 | |||
26 | /* is_active stores wether or not the /dev/watchdog device is opened */ | ||
27 | static unsigned long is_active; | ||
28 | |||
29 | /* misc devices don't provide a way, to get back to 'dev' or 'miscdev' from | ||
30 | * file operations, which sucks. But there can be max 1 watchdog anyway, so... | ||
31 | */ | ||
32 | static struct mpc5200_wdt *wdt_global; | ||
33 | |||
34 | |||
35 | /* helper to calculate timeout in timer counts */ | ||
36 | static void mpc5200_wdt_set_timeout(struct mpc5200_wdt *wdt, int timeout) | ||
37 | { | ||
38 | /* use biggest prescaler of 64k */ | ||
39 | wdt->count = (wdt->ipb_freq + 0xffff) / 0x10000 * timeout; | ||
40 | |||
41 | if (wdt->count > 0xffff) | ||
42 | wdt->count = 0xffff; | ||
43 | } | ||
44 | /* return timeout in seconds (calculated from timer count) */ | ||
45 | static int mpc5200_wdt_get_timeout(struct mpc5200_wdt *wdt) | ||
46 | { | ||
47 | return wdt->count * 0x10000 / wdt->ipb_freq; | ||
48 | } | ||
49 | |||
50 | |||
51 | /* watchdog operations */ | ||
52 | static int mpc5200_wdt_start(struct mpc5200_wdt *wdt) | ||
53 | { | ||
54 | spin_lock(&wdt->io_lock); | ||
55 | /* disable */ | ||
56 | out_be32(&wdt->regs->mode, 0); | ||
57 | /* set timeout, with maximum prescaler */ | ||
58 | out_be32(&wdt->regs->count, 0x0 | wdt->count); | ||
59 | /* enable watchdog */ | ||
60 | out_be32(&wdt->regs->mode, GPT_MODE_CE | GPT_MODE_WDT | GPT_MODE_MS_TIMER); | ||
61 | spin_unlock(&wdt->io_lock); | ||
62 | |||
63 | return 0; | ||
64 | } | ||
65 | static int mpc5200_wdt_ping(struct mpc5200_wdt *wdt) | ||
66 | { | ||
67 | spin_lock(&wdt->io_lock); | ||
68 | /* writing A5 to OCPW resets the watchdog */ | ||
69 | out_be32(&wdt->regs->mode, 0xA5000000 | (0xffffff & in_be32(&wdt->regs->mode))); | ||
70 | spin_unlock(&wdt->io_lock); | ||
71 | return 0; | ||
72 | } | ||
73 | static int mpc5200_wdt_stop(struct mpc5200_wdt *wdt) | ||
74 | { | ||
75 | spin_lock(&wdt->io_lock); | ||
76 | /* disable */ | ||
77 | out_be32(&wdt->regs->mode, 0); | ||
78 | spin_unlock(&wdt->io_lock); | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | |||
83 | /* file operations */ | ||
84 | static ssize_t mpc5200_wdt_write(struct file *file, const char *data, | ||
85 | size_t len, loff_t *ppos) | ||
86 | { | ||
87 | struct mpc5200_wdt *wdt = file->private_data; | ||
88 | mpc5200_wdt_ping(wdt); | ||
89 | return 0; | ||
90 | } | ||
91 | static struct watchdog_info mpc5200_wdt_info = { | ||
92 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | ||
93 | .identity = "mpc5200 watchdog on GPT0", | ||
94 | }; | ||
95 | static int mpc5200_wdt_ioctl(struct inode *inode, struct file *file, | ||
96 | unsigned int cmd, unsigned long arg) | ||
97 | { | ||
98 | struct mpc5200_wdt *wdt = file->private_data; | ||
99 | int __user *data = (int __user *)arg; | ||
100 | int timeout; | ||
101 | int ret = 0; | ||
102 | |||
103 | switch (cmd) { | ||
104 | case WDIOC_GETSUPPORT: | ||
105 | ret = copy_to_user(data, &mpc5200_wdt_info, | ||
106 | sizeof(mpc5200_wdt_info)); | ||
107 | if (ret) | ||
108 | ret = -EFAULT; | ||
109 | break; | ||
110 | |||
111 | case WDIOC_GETSTATUS: | ||
112 | case WDIOC_GETBOOTSTATUS: | ||
113 | ret = put_user(0, data); | ||
114 | break; | ||
115 | |||
116 | case WDIOC_KEEPALIVE: | ||
117 | mpc5200_wdt_ping(wdt); | ||
118 | break; | ||
119 | |||
120 | case WDIOC_SETTIMEOUT: | ||
121 | ret = get_user(timeout, data); | ||
122 | if (ret) | ||
123 | break; | ||
124 | mpc5200_wdt_set_timeout(wdt, timeout); | ||
125 | mpc5200_wdt_start(wdt); | ||
126 | /* fall through and return the timeout */ | ||
127 | |||
128 | case WDIOC_GETTIMEOUT: | ||
129 | timeout = mpc5200_wdt_get_timeout(wdt); | ||
130 | ret = put_user(timeout, data); | ||
131 | break; | ||
132 | |||
133 | default: | ||
134 | ret = -ENOTTY; | ||
135 | } | ||
136 | return ret; | ||
137 | } | ||
138 | static int mpc5200_wdt_open(struct inode *inode, struct file *file) | ||
139 | { | ||
140 | /* /dev/watchdog can only be opened once */ | ||
141 | if (test_and_set_bit(0, &is_active)) | ||
142 | return -EBUSY; | ||
143 | |||
144 | /* Set and activate the watchdog */ | ||
145 | mpc5200_wdt_set_timeout(wdt_global, 30); | ||
146 | mpc5200_wdt_start(wdt_global); | ||
147 | file->private_data = wdt_global; | ||
148 | return nonseekable_open(inode, file); | ||
149 | } | ||
150 | static int mpc5200_wdt_release(struct inode *inode, struct file *file) | ||
151 | { | ||
152 | #if WATCHDOG_NOWAYOUT == 0 | ||
153 | struct mpc5200_wdt *wdt = file->private_data; | ||
154 | mpc5200_wdt_stop(wdt); | ||
155 | wdt->count = 0; /* == disabled */ | ||
156 | #endif | ||
157 | clear_bit(0, &is_active); | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static struct file_operations mpc5200_wdt_fops = { | ||
162 | .owner = THIS_MODULE, | ||
163 | .write = mpc5200_wdt_write, | ||
164 | .ioctl = mpc5200_wdt_ioctl, | ||
165 | .open = mpc5200_wdt_open, | ||
166 | .release = mpc5200_wdt_release, | ||
167 | }; | ||
168 | |||
169 | /* module operations */ | ||
170 | static int mpc5200_wdt_probe(struct of_device *op, const struct of_device_id *match) | ||
171 | { | ||
172 | struct mpc5200_wdt *wdt; | ||
173 | int err; | ||
174 | const void *has_wdt; | ||
175 | int size; | ||
176 | |||
177 | has_wdt = of_get_property(op->node, "has-wdt", NULL); | ||
178 | if (!has_wdt) | ||
179 | return -ENODEV; | ||
180 | |||
181 | wdt = kzalloc(sizeof(*wdt), GFP_KERNEL); | ||
182 | if (!wdt) | ||
183 | return -ENOMEM; | ||
184 | |||
185 | wdt->ipb_freq = mpc52xx_find_ipb_freq(op->node); | ||
186 | |||
187 | err = of_address_to_resource(op->node, 0, &wdt->mem); | ||
188 | if (err) | ||
189 | goto out_free; | ||
190 | size = wdt->mem.end - wdt->mem.start + 1; | ||
191 | if (!request_mem_region(wdt->mem.start, size, "mpc5200_wdt")) { | ||
192 | err = -ENODEV; | ||
193 | goto out_free; | ||
194 | } | ||
195 | wdt->regs = ioremap(wdt->mem.start, size); | ||
196 | if (!wdt->regs) { | ||
197 | err = -ENODEV; | ||
198 | goto out_release; | ||
199 | } | ||
200 | |||
201 | dev_set_drvdata(&op->dev, wdt); | ||
202 | spin_lock_init(&wdt->io_lock); | ||
203 | |||
204 | wdt->miscdev = (struct miscdevice) { | ||
205 | .minor = WATCHDOG_MINOR, | ||
206 | .name = "watchdog", | ||
207 | .fops = &mpc5200_wdt_fops, | ||
208 | .parent = &op->dev, | ||
209 | }; | ||
210 | wdt_global = wdt; | ||
211 | err = misc_register(&wdt->miscdev); | ||
212 | if (!err) | ||
213 | return 0; | ||
214 | |||
215 | iounmap(wdt->regs); | ||
216 | out_release: | ||
217 | release_mem_region(wdt->mem.start, size); | ||
218 | out_free: | ||
219 | kfree(wdt); | ||
220 | return err; | ||
221 | } | ||
222 | |||
223 | static int mpc5200_wdt_remove(struct of_device *op) | ||
224 | { | ||
225 | struct mpc5200_wdt *wdt = dev_get_drvdata(&op->dev); | ||
226 | |||
227 | mpc5200_wdt_stop(wdt); | ||
228 | misc_deregister(&wdt->miscdev); | ||
229 | iounmap(wdt->regs); | ||
230 | release_mem_region(wdt->mem.start, wdt->mem.end - wdt->mem.start + 1); | ||
231 | kfree(wdt); | ||
232 | |||
233 | return 0; | ||
234 | } | ||
235 | static int mpc5200_wdt_suspend(struct of_device *op, pm_message_t state) | ||
236 | { | ||
237 | struct mpc5200_wdt *wdt = dev_get_drvdata(&op->dev); | ||
238 | mpc5200_wdt_stop(wdt); | ||
239 | return 0; | ||
240 | } | ||
241 | static int mpc5200_wdt_resume(struct of_device *op) | ||
242 | { | ||
243 | struct mpc5200_wdt *wdt = dev_get_drvdata(&op->dev); | ||
244 | if (wdt->count) | ||
245 | mpc5200_wdt_start(wdt); | ||
246 | return 0; | ||
247 | } | ||
248 | static int mpc5200_wdt_shutdown(struct of_device *op) | ||
249 | { | ||
250 | struct mpc5200_wdt *wdt = dev_get_drvdata(&op->dev); | ||
251 | mpc5200_wdt_stop(wdt); | ||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | static struct of_device_id mpc5200_wdt_match[] = { | ||
256 | { .compatible = "mpc5200-gpt", }, | ||
257 | {}, | ||
258 | }; | ||
259 | static struct of_platform_driver mpc5200_wdt_driver = { | ||
260 | .owner = THIS_MODULE, | ||
261 | .name = "mpc5200-gpt-wdt", | ||
262 | .match_table = mpc5200_wdt_match, | ||
263 | .probe = mpc5200_wdt_probe, | ||
264 | .remove = mpc5200_wdt_remove, | ||
265 | .suspend = mpc5200_wdt_suspend, | ||
266 | .resume = mpc5200_wdt_resume, | ||
267 | .shutdown = mpc5200_wdt_shutdown, | ||
268 | }; | ||
269 | |||
270 | |||
271 | static int __init mpc5200_wdt_init(void) | ||
272 | { | ||
273 | return of_register_platform_driver(&mpc5200_wdt_driver); | ||
274 | } | ||
275 | |||
276 | static void __exit mpc5200_wdt_exit(void) | ||
277 | { | ||
278 | of_unregister_platform_driver(&mpc5200_wdt_driver); | ||
279 | } | ||
280 | |||
281 | module_init(mpc5200_wdt_init); | ||
282 | module_exit(mpc5200_wdt_exit); | ||
283 | |||
284 | MODULE_AUTHOR("Domen Puncer <domen.puncer@telargo.com>"); | ||
285 | MODULE_LICENSE("Dual BSD/GPL"); | ||
286 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/char/watchdog/mpc83xx_wdt.c b/drivers/char/watchdog/mpc83xx_wdt.c index 18ca752e2f90..a0bf95fb9763 100644 --- a/drivers/char/watchdog/mpc83xx_wdt.c +++ b/drivers/char/watchdog/mpc83xx_wdt.c | |||
@@ -119,6 +119,9 @@ static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file, | |||
119 | switch (cmd) { | 119 | switch (cmd) { |
120 | case WDIOC_GETSUPPORT: | 120 | case WDIOC_GETSUPPORT: |
121 | return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; | 121 | return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; |
122 | case WDIOC_GETSTATUS: | ||
123 | case WDIOC_GETBOOTSTATUS: | ||
124 | return put_user(0, p); | ||
122 | case WDIOC_KEEPALIVE: | 125 | case WDIOC_KEEPALIVE: |
123 | mpc83xx_wdt_keepalive(); | 126 | mpc83xx_wdt_keepalive(); |
124 | return 0; | 127 | return 0; |
diff --git a/drivers/char/watchdog/mpc8xx_wdt.c b/drivers/char/watchdog/mpc8xx_wdt.c index 8aaed10dd499..85b5734403a5 100644 --- a/drivers/char/watchdog/mpc8xx_wdt.c +++ b/drivers/char/watchdog/mpc8xx_wdt.c | |||
@@ -57,7 +57,7 @@ static int mpc8xx_wdt_open(struct inode *inode, struct file *file) | |||
57 | m8xx_wdt_reset(); | 57 | m8xx_wdt_reset(); |
58 | mpc8xx_wdt_handler_disable(); | 58 | mpc8xx_wdt_handler_disable(); |
59 | 59 | ||
60 | return 0; | 60 | return nonseekable_open(inode, file); |
61 | } | 61 | } |
62 | 62 | ||
63 | static int mpc8xx_wdt_release(struct inode *inode, struct file *file) | 63 | static int mpc8xx_wdt_release(struct inode *inode, struct file *file) |
diff --git a/drivers/char/watchdog/mtx-1_wdt.c b/drivers/char/watchdog/mtx-1_wdt.c index 419ab445c944..dcfd401a7ad7 100644 --- a/drivers/char/watchdog/mtx-1_wdt.c +++ b/drivers/char/watchdog/mtx-1_wdt.c | |||
@@ -143,6 +143,7 @@ static int mtx1_wdt_ioctl(struct inode *inode, struct file *file, unsigned int c | |||
143 | mtx1_wdt_reset(); | 143 | mtx1_wdt_reset(); |
144 | break; | 144 | break; |
145 | case WDIOC_GETSTATUS: | 145 | case WDIOC_GETSTATUS: |
146 | case WDIOC_GETBOOTSTATUS: | ||
146 | if ( copy_to_user(argp, &value, sizeof(int)) ) | 147 | if ( copy_to_user(argp, &value, sizeof(int)) ) |
147 | return -EFAULT; | 148 | return -EFAULT; |
148 | break; | 149 | break; |
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c index b887cdb01334..0365c317f7e1 100644 --- a/drivers/char/watchdog/mv64x60_wdt.c +++ b/drivers/char/watchdog/mv64x60_wdt.c | |||
@@ -23,61 +23,101 @@ | |||
23 | #include <linux/watchdog.h> | 23 | #include <linux/watchdog.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | 25 | ||
26 | #include <asm/mv64x60.h> | 26 | #include <linux/mv643xx.h> |
27 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
28 | #include <asm/io.h> | 28 | #include <asm/io.h> |
29 | 29 | ||
30 | /* MV64x60 WDC (config) register access definitions */ | 30 | #define MV64x60_WDT_WDC_OFFSET 0 |
31 | #define MV64x60_WDC_CTL1_MASK (3 << 24) | 31 | |
32 | #define MV64x60_WDC_CTL1(val) ((val & 3) << 24) | 32 | /* |
33 | #define MV64x60_WDC_CTL2_MASK (3 << 26) | 33 | * The watchdog configuration register contains a pair of 2-bit fields, |
34 | #define MV64x60_WDC_CTL2(val) ((val & 3) << 26) | 34 | * 1. a reload field, bits 27-26, which triggers a reload of |
35 | * the countdown register, and | ||
36 | * 2. an enable field, bits 25-24, which toggles between | ||
37 | * enabling and disabling the watchdog timer. | ||
38 | * Bit 31 is a read-only field which indicates whether the | ||
39 | * watchdog timer is currently enabled. | ||
40 | * | ||
41 | * The low 24 bits contain the timer reload value. | ||
42 | */ | ||
43 | #define MV64x60_WDC_ENABLE_SHIFT 24 | ||
44 | #define MV64x60_WDC_SERVICE_SHIFT 26 | ||
45 | #define MV64x60_WDC_ENABLED_SHIFT 31 | ||
46 | |||
47 | #define MV64x60_WDC_ENABLED_TRUE 1 | ||
48 | #define MV64x60_WDC_ENABLED_FALSE 0 | ||
35 | 49 | ||
36 | /* Flags bits */ | 50 | /* Flags bits */ |
37 | #define MV64x60_WDOG_FLAG_OPENED 0 | 51 | #define MV64x60_WDOG_FLAG_OPENED 0 |
38 | #define MV64x60_WDOG_FLAG_ENABLED 1 | ||
39 | 52 | ||
40 | static unsigned long wdt_flags; | 53 | static unsigned long wdt_flags; |
41 | static int wdt_status; | 54 | static int wdt_status; |
42 | static void __iomem *mv64x60_regs; | 55 | static void __iomem *mv64x60_wdt_regs; |
43 | static int mv64x60_wdt_timeout; | 56 | static int mv64x60_wdt_timeout; |
57 | static int mv64x60_wdt_count; | ||
58 | static unsigned int bus_clk; | ||
59 | static char expect_close; | ||
60 | static DEFINE_SPINLOCK(mv64x60_wdt_spinlock); | ||
61 | |||
62 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
63 | module_param(nowayout, int, 0); | ||
64 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
44 | 65 | ||
45 | static void mv64x60_wdt_reg_write(u32 val) | 66 | static int mv64x60_wdt_toggle_wdc(int enabled_predicate, int field_shift) |
46 | { | 67 | { |
47 | /* Allow write only to CTL1 / CTL2 fields, retaining values in | 68 | u32 data; |
48 | * other fields. | 69 | u32 enabled; |
49 | */ | 70 | int ret = 0; |
50 | u32 data = readl(mv64x60_regs + MV64x60_WDT_WDC); | 71 | |
51 | data &= ~(MV64x60_WDC_CTL1_MASK | MV64x60_WDC_CTL2_MASK); | 72 | spin_lock(&mv64x60_wdt_spinlock); |
52 | data |= val; | 73 | data = readl(mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET); |
53 | writel(data, mv64x60_regs + MV64x60_WDT_WDC); | 74 | enabled = (data >> MV64x60_WDC_ENABLED_SHIFT) & 1; |
75 | |||
76 | /* only toggle the requested field if enabled state matches predicate */ | ||
77 | if ((enabled ^ enabled_predicate) == 0) { | ||
78 | /* We write a 1, then a 2 -- to the appropriate field */ | ||
79 | data = (1 << field_shift) | mv64x60_wdt_count; | ||
80 | writel(data, mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET); | ||
81 | |||
82 | data = (2 << field_shift) | mv64x60_wdt_count; | ||
83 | writel(data, mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET); | ||
84 | ret = 1; | ||
85 | } | ||
86 | spin_unlock(&mv64x60_wdt_spinlock); | ||
87 | |||
88 | return ret; | ||
54 | } | 89 | } |
55 | 90 | ||
56 | static void mv64x60_wdt_service(void) | 91 | static void mv64x60_wdt_service(void) |
57 | { | 92 | { |
58 | /* Write 01 followed by 10 to CTL2 */ | 93 | mv64x60_wdt_toggle_wdc(MV64x60_WDC_ENABLED_TRUE, |
59 | mv64x60_wdt_reg_write(MV64x60_WDC_CTL2(0x01)); | 94 | MV64x60_WDC_SERVICE_SHIFT); |
60 | mv64x60_wdt_reg_write(MV64x60_WDC_CTL2(0x02)); | 95 | } |
96 | |||
97 | static void mv64x60_wdt_handler_enable(void) | ||
98 | { | ||
99 | if (mv64x60_wdt_toggle_wdc(MV64x60_WDC_ENABLED_FALSE, | ||
100 | MV64x60_WDC_ENABLE_SHIFT)) { | ||
101 | mv64x60_wdt_service(); | ||
102 | printk(KERN_NOTICE "mv64x60_wdt: watchdog activated\n"); | ||
103 | } | ||
61 | } | 104 | } |
62 | 105 | ||
63 | static void mv64x60_wdt_handler_disable(void) | 106 | static void mv64x60_wdt_handler_disable(void) |
64 | { | 107 | { |
65 | if (test_and_clear_bit(MV64x60_WDOG_FLAG_ENABLED, &wdt_flags)) { | 108 | if (mv64x60_wdt_toggle_wdc(MV64x60_WDC_ENABLED_TRUE, |
66 | /* Write 01 followed by 10 to CTL1 */ | 109 | MV64x60_WDC_ENABLE_SHIFT)) |
67 | mv64x60_wdt_reg_write(MV64x60_WDC_CTL1(0x01)); | ||
68 | mv64x60_wdt_reg_write(MV64x60_WDC_CTL1(0x02)); | ||
69 | printk(KERN_NOTICE "mv64x60_wdt: watchdog deactivated\n"); | 110 | printk(KERN_NOTICE "mv64x60_wdt: watchdog deactivated\n"); |
70 | } | ||
71 | } | 111 | } |
72 | 112 | ||
73 | static void mv64x60_wdt_handler_enable(void) | 113 | static void mv64x60_wdt_set_timeout(unsigned int timeout) |
74 | { | 114 | { |
75 | if (!test_and_set_bit(MV64x60_WDOG_FLAG_ENABLED, &wdt_flags)) { | 115 | /* maximum bus cycle count is 0xFFFFFFFF */ |
76 | /* Write 01 followed by 10 to CTL1 */ | 116 | if (timeout > 0xFFFFFFFF / bus_clk) |
77 | mv64x60_wdt_reg_write(MV64x60_WDC_CTL1(0x01)); | 117 | timeout = 0xFFFFFFFF / bus_clk; |
78 | mv64x60_wdt_reg_write(MV64x60_WDC_CTL1(0x02)); | 118 | |
79 | printk(KERN_NOTICE "mv64x60_wdt: watchdog activated\n"); | 119 | mv64x60_wdt_count = timeout * bus_clk >> 8; |
80 | } | 120 | mv64x60_wdt_timeout = timeout; |
81 | } | 121 | } |
82 | 122 | ||
83 | static int mv64x60_wdt_open(struct inode *inode, struct file *file) | 123 | static int mv64x60_wdt_open(struct inode *inode, struct file *file) |
@@ -85,21 +125,24 @@ static int mv64x60_wdt_open(struct inode *inode, struct file *file) | |||
85 | if (test_and_set_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags)) | 125 | if (test_and_set_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags)) |
86 | return -EBUSY; | 126 | return -EBUSY; |
87 | 127 | ||
88 | mv64x60_wdt_service(); | 128 | if (nowayout) |
89 | mv64x60_wdt_handler_enable(); | 129 | __module_get(THIS_MODULE); |
90 | 130 | ||
91 | nonseekable_open(inode, file); | 131 | mv64x60_wdt_handler_enable(); |
92 | 132 | ||
93 | return 0; | 133 | return nonseekable_open(inode, file); |
94 | } | 134 | } |
95 | 135 | ||
96 | static int mv64x60_wdt_release(struct inode *inode, struct file *file) | 136 | static int mv64x60_wdt_release(struct inode *inode, struct file *file) |
97 | { | 137 | { |
98 | mv64x60_wdt_service(); | 138 | if (expect_close == 42) |
99 | 139 | mv64x60_wdt_handler_disable(); | |
100 | #if !defined(CONFIG_WATCHDOG_NOWAYOUT) | 140 | else { |
101 | mv64x60_wdt_handler_disable(); | 141 | printk(KERN_CRIT |
102 | #endif | 142 | "mv64x60_wdt: unexpected close, not stopping timer!\n"); |
143 | mv64x60_wdt_service(); | ||
144 | } | ||
145 | expect_close = 0; | ||
103 | 146 | ||
104 | clear_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags); | 147 | clear_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags); |
105 | 148 | ||
@@ -109,8 +152,22 @@ static int mv64x60_wdt_release(struct inode *inode, struct file *file) | |||
109 | static ssize_t mv64x60_wdt_write(struct file *file, const char __user *data, | 152 | static ssize_t mv64x60_wdt_write(struct file *file, const char __user *data, |
110 | size_t len, loff_t * ppos) | 153 | size_t len, loff_t * ppos) |
111 | { | 154 | { |
112 | if (len) | 155 | if (len) { |
156 | if (!nowayout) { | ||
157 | size_t i; | ||
158 | |||
159 | expect_close = 0; | ||
160 | |||
161 | for (i = 0; i != len; i++) { | ||
162 | char c; | ||
163 | if(get_user(c, data + i)) | ||
164 | return -EFAULT; | ||
165 | if (c == 'V') | ||
166 | expect_close = 42; | ||
167 | } | ||
168 | } | ||
113 | mv64x60_wdt_service(); | 169 | mv64x60_wdt_service(); |
170 | } | ||
114 | 171 | ||
115 | return len; | 172 | return len; |
116 | } | 173 | } |
@@ -119,9 +176,12 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file, | |||
119 | unsigned int cmd, unsigned long arg) | 176 | unsigned int cmd, unsigned long arg) |
120 | { | 177 | { |
121 | int timeout; | 178 | int timeout; |
179 | int options; | ||
122 | void __user *argp = (void __user *)arg; | 180 | void __user *argp = (void __user *)arg; |
123 | static struct watchdog_info info = { | 181 | static struct watchdog_info info = { |
124 | .options = WDIOF_KEEPALIVEPING, | 182 | .options = WDIOF_SETTIMEOUT | |
183 | WDIOF_MAGICCLOSE | | ||
184 | WDIOF_KEEPALIVEPING, | ||
125 | .firmware_version = 0, | 185 | .firmware_version = 0, |
126 | .identity = "MV64x60 watchdog", | 186 | .identity = "MV64x60 watchdog", |
127 | }; | 187 | }; |
@@ -143,7 +203,15 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file, | |||
143 | return -EOPNOTSUPP; | 203 | return -EOPNOTSUPP; |
144 | 204 | ||
145 | case WDIOC_SETOPTIONS: | 205 | case WDIOC_SETOPTIONS: |
146 | return -EOPNOTSUPP; | 206 | if (get_user(options, (int __user *)argp)) |
207 | return -EFAULT; | ||
208 | |||
209 | if (options & WDIOS_DISABLECARD) | ||
210 | mv64x60_wdt_handler_disable(); | ||
211 | |||
212 | if (options & WDIOS_ENABLECARD) | ||
213 | mv64x60_wdt_handler_enable(); | ||
214 | break; | ||
147 | 215 | ||
148 | case WDIOC_KEEPALIVE: | 216 | case WDIOC_KEEPALIVE: |
149 | mv64x60_wdt_service(); | 217 | mv64x60_wdt_service(); |
@@ -151,11 +219,13 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file, | |||
151 | break; | 219 | break; |
152 | 220 | ||
153 | case WDIOC_SETTIMEOUT: | 221 | case WDIOC_SETTIMEOUT: |
154 | return -EOPNOTSUPP; | 222 | if (get_user(timeout, (int __user *)argp)) |
223 | return -EFAULT; | ||
224 | mv64x60_wdt_set_timeout(timeout); | ||
225 | /* Fall through */ | ||
155 | 226 | ||
156 | case WDIOC_GETTIMEOUT: | 227 | case WDIOC_GETTIMEOUT: |
157 | timeout = mv64x60_wdt_timeout * HZ; | 228 | if (put_user(mv64x60_wdt_timeout, (int __user *)argp)) |
158 | if (put_user(timeout, (int __user *)argp)) | ||
159 | return -EFAULT; | 229 | return -EFAULT; |
160 | break; | 230 | break; |
161 | 231 | ||
@@ -184,18 +254,33 @@ static struct miscdevice mv64x60_wdt_miscdev = { | |||
184 | static int __devinit mv64x60_wdt_probe(struct platform_device *dev) | 254 | static int __devinit mv64x60_wdt_probe(struct platform_device *dev) |
185 | { | 255 | { |
186 | struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data; | 256 | struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data; |
187 | int bus_clk = 133; | 257 | struct resource *r; |
258 | int timeout = 10; | ||
188 | 259 | ||
189 | mv64x60_wdt_timeout = 10; | 260 | bus_clk = 133; /* in MHz */ |
190 | if (pdata) { | 261 | if (pdata) { |
191 | mv64x60_wdt_timeout = pdata->timeout; | 262 | timeout = pdata->timeout; |
192 | bus_clk = pdata->bus_clk; | 263 | bus_clk = pdata->bus_clk; |
193 | } | 264 | } |
194 | 265 | ||
195 | mv64x60_regs = mv64x60_get_bridge_vbase(); | 266 | /* Since bus_clk is truncated MHz, actual frequency could be |
267 | * up to 1MHz higher. Round up, since it's better to time out | ||
268 | * too late than too soon. | ||
269 | */ | ||
270 | bus_clk++; | ||
271 | bus_clk *= 1000000; /* convert to Hz */ | ||
272 | |||
273 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
274 | if (!r) | ||
275 | return -ENODEV; | ||
196 | 276 | ||
197 | writel((mv64x60_wdt_timeout * (bus_clk * 1000000)) >> 8, | 277 | mv64x60_wdt_regs = ioremap(r->start, r->end - r->start + 1); |
198 | mv64x60_regs + MV64x60_WDT_WDC); | 278 | if (mv64x60_wdt_regs == NULL) |
279 | return -ENOMEM; | ||
280 | |||
281 | mv64x60_wdt_set_timeout(timeout); | ||
282 | |||
283 | mv64x60_wdt_handler_disable(); /* in case timer was already running */ | ||
199 | 284 | ||
200 | return misc_register(&mv64x60_wdt_miscdev); | 285 | return misc_register(&mv64x60_wdt_miscdev); |
201 | } | 286 | } |
@@ -204,9 +289,10 @@ static int __devexit mv64x60_wdt_remove(struct platform_device *dev) | |||
204 | { | 289 | { |
205 | misc_deregister(&mv64x60_wdt_miscdev); | 290 | misc_deregister(&mv64x60_wdt_miscdev); |
206 | 291 | ||
207 | mv64x60_wdt_service(); | ||
208 | mv64x60_wdt_handler_disable(); | 292 | mv64x60_wdt_handler_disable(); |
209 | 293 | ||
294 | iounmap(mv64x60_wdt_regs); | ||
295 | |||
210 | return 0; | 296 | return 0; |
211 | } | 297 | } |
212 | 298 | ||
@@ -219,40 +305,16 @@ static struct platform_driver mv64x60_wdt_driver = { | |||
219 | }, | 305 | }, |
220 | }; | 306 | }; |
221 | 307 | ||
222 | static struct platform_device *mv64x60_wdt_dev; | ||
223 | |||
224 | static int __init mv64x60_wdt_init(void) | 308 | static int __init mv64x60_wdt_init(void) |
225 | { | 309 | { |
226 | int ret; | ||
227 | |||
228 | printk(KERN_INFO "MV64x60 watchdog driver\n"); | 310 | printk(KERN_INFO "MV64x60 watchdog driver\n"); |
229 | 311 | ||
230 | mv64x60_wdt_dev = platform_device_alloc(MV64x60_WDT_NAME, -1); | 312 | return platform_driver_register(&mv64x60_wdt_driver); |
231 | if (!mv64x60_wdt_dev) { | ||
232 | ret = -ENOMEM; | ||
233 | goto out; | ||
234 | } | ||
235 | |||
236 | ret = platform_device_add(mv64x60_wdt_dev); | ||
237 | if (ret) { | ||
238 | platform_device_put(mv64x60_wdt_dev); | ||
239 | goto out; | ||
240 | } | ||
241 | |||
242 | ret = platform_driver_register(&mv64x60_wdt_driver); | ||
243 | if (ret) { | ||
244 | platform_device_unregister(mv64x60_wdt_dev); | ||
245 | goto out; | ||
246 | } | ||
247 | |||
248 | out: | ||
249 | return ret; | ||
250 | } | 313 | } |
251 | 314 | ||
252 | static void __exit mv64x60_wdt_exit(void) | 315 | static void __exit mv64x60_wdt_exit(void) |
253 | { | 316 | { |
254 | platform_driver_unregister(&mv64x60_wdt_driver); | 317 | platform_driver_unregister(&mv64x60_wdt_driver); |
255 | platform_device_unregister(mv64x60_wdt_dev); | ||
256 | } | 318 | } |
257 | 319 | ||
258 | module_init(mv64x60_wdt_init); | 320 | module_init(mv64x60_wdt_init); |
diff --git a/drivers/char/watchdog/omap_wdt.c b/drivers/char/watchdog/omap_wdt.c index b36fa8de2131..719b066f73c4 100644 --- a/drivers/char/watchdog/omap_wdt.c +++ b/drivers/char/watchdog/omap_wdt.c | |||
@@ -142,7 +142,7 @@ static int omap_wdt_open(struct inode *inode, struct file *file) | |||
142 | 142 | ||
143 | omap_wdt_set_timeout(); | 143 | omap_wdt_set_timeout(); |
144 | omap_wdt_enable(); | 144 | omap_wdt_enable(); |
145 | return 0; | 145 | return nonseekable_open(inode, file); |
146 | } | 146 | } |
147 | 147 | ||
148 | static int omap_wdt_release(struct inode *inode, struct file *file) | 148 | static int omap_wdt_release(struct inode *inode, struct file *file) |
@@ -197,7 +197,7 @@ omap_wdt_ioctl(struct inode *inode, struct file *file, | |||
197 | 197 | ||
198 | switch (cmd) { | 198 | switch (cmd) { |
199 | default: | 199 | default: |
200 | return -ENOIOCTLCMD; | 200 | return -ENOTTY; |
201 | case WDIOC_GETSUPPORT: | 201 | case WDIOC_GETSUPPORT: |
202 | return copy_to_user((struct watchdog_info __user *)arg, &ident, | 202 | return copy_to_user((struct watchdog_info __user *)arg, &ident, |
203 | sizeof(ident)); | 203 | sizeof(ident)); |
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c index 50430bced2f2..5d1c15f83d23 100644 --- a/drivers/char/watchdog/s3c2410_wdt.c +++ b/drivers/char/watchdog/s3c2410_wdt.c | |||
@@ -52,10 +52,10 @@ | |||
52 | 52 | ||
53 | #include <asm/arch/map.h> | 53 | #include <asm/arch/map.h> |
54 | 54 | ||
55 | #undef S3C24XX_VA_WATCHDOG | 55 | #undef S3C_VA_WATCHDOG |
56 | #define S3C24XX_VA_WATCHDOG (0) | 56 | #define S3C_VA_WATCHDOG (0) |
57 | 57 | ||
58 | #include <asm/arch/regs-watchdog.h> | 58 | #include <asm/plat-s3c/regs-watchdog.h> |
59 | 59 | ||
60 | #define PFX "s3c2410-wdt: " | 60 | #define PFX "s3c2410-wdt: " |
61 | 61 | ||
diff --git a/drivers/char/watchdog/sa1100_wdt.c b/drivers/char/watchdog/sa1100_wdt.c index 33c1137f17d6..3475f47aaa45 100644 --- a/drivers/char/watchdog/sa1100_wdt.c +++ b/drivers/char/watchdog/sa1100_wdt.c | |||
@@ -45,7 +45,6 @@ static int boot_status; | |||
45 | */ | 45 | */ |
46 | static int sa1100dog_open(struct inode *inode, struct file *file) | 46 | static int sa1100dog_open(struct inode *inode, struct file *file) |
47 | { | 47 | { |
48 | nonseekable_open(inode, file); | ||
49 | if (test_and_set_bit(1,&sa1100wdt_users)) | 48 | if (test_and_set_bit(1,&sa1100wdt_users)) |
50 | return -EBUSY; | 49 | return -EBUSY; |
51 | 50 | ||
@@ -54,7 +53,7 @@ static int sa1100dog_open(struct inode *inode, struct file *file) | |||
54 | OSSR = OSSR_M3; | 53 | OSSR = OSSR_M3; |
55 | OWER = OWER_WME; | 54 | OWER = OWER_WME; |
56 | OIER |= OIER_E3; | 55 | OIER |= OIER_E3; |
57 | return 0; | 56 | return nonseekable_open(inode, file); |
58 | } | 57 | } |
59 | 58 | ||
60 | /* | 59 | /* |
diff --git a/drivers/char/watchdog/sbc60xxwdt.c b/drivers/char/watchdog/sbc60xxwdt.c index b6282039198c..e4f3cb6090bc 100644 --- a/drivers/char/watchdog/sbc60xxwdt.c +++ b/drivers/char/watchdog/sbc60xxwdt.c | |||
@@ -191,8 +191,6 @@ static ssize_t fop_write(struct file * file, const char __user * buf, size_t cou | |||
191 | 191 | ||
192 | static int fop_open(struct inode * inode, struct file * file) | 192 | static int fop_open(struct inode * inode, struct file * file) |
193 | { | 193 | { |
194 | nonseekable_open(inode, file); | ||
195 | |||
196 | /* Just in case we're already talking to someone... */ | 194 | /* Just in case we're already talking to someone... */ |
197 | if(test_and_set_bit(0, &wdt_is_open)) | 195 | if(test_and_set_bit(0, &wdt_is_open)) |
198 | return -EBUSY; | 196 | return -EBUSY; |
@@ -202,7 +200,7 @@ static int fop_open(struct inode * inode, struct file * file) | |||
202 | 200 | ||
203 | /* Good, fire up the show */ | 201 | /* Good, fire up the show */ |
204 | wdt_startup(); | 202 | wdt_startup(); |
205 | return 0; | 203 | return nonseekable_open(inode, file); |
206 | } | 204 | } |
207 | 205 | ||
208 | static int fop_close(struct inode * inode, struct file * file) | 206 | static int fop_close(struct inode * inode, struct file * file) |
diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c index 2f7ba7a514fe..9670d47190d0 100644 --- a/drivers/char/watchdog/sc1200wdt.c +++ b/drivers/char/watchdog/sc1200wdt.c | |||
@@ -150,8 +150,6 @@ static inline int sc1200wdt_status(void) | |||
150 | 150 | ||
151 | static int sc1200wdt_open(struct inode *inode, struct file *file) | 151 | static int sc1200wdt_open(struct inode *inode, struct file *file) |
152 | { | 152 | { |
153 | nonseekable_open(inode, file); | ||
154 | |||
155 | /* allow one at a time */ | 153 | /* allow one at a time */ |
156 | if (down_trylock(&open_sem)) | 154 | if (down_trylock(&open_sem)) |
157 | return -EBUSY; | 155 | return -EBUSY; |
@@ -162,7 +160,7 @@ static int sc1200wdt_open(struct inode *inode, struct file *file) | |||
162 | sc1200wdt_start(); | 160 | sc1200wdt_start(); |
163 | printk(KERN_INFO PFX "Watchdog enabled, timeout = %d min(s)", timeout); | 161 | printk(KERN_INFO PFX "Watchdog enabled, timeout = %d min(s)", timeout); |
164 | 162 | ||
165 | return 0; | 163 | return nonseekable_open(inode, file); |
166 | } | 164 | } |
167 | 165 | ||
168 | 166 | ||
diff --git a/drivers/char/watchdog/sc520_wdt.c b/drivers/char/watchdog/sc520_wdt.c index 2676a43895a7..e8594c64d1e6 100644 --- a/drivers/char/watchdog/sc520_wdt.c +++ b/drivers/char/watchdog/sc520_wdt.c | |||
@@ -248,8 +248,6 @@ static ssize_t fop_write(struct file * file, const char __user * buf, size_t cou | |||
248 | 248 | ||
249 | static int fop_open(struct inode * inode, struct file * file) | 249 | static int fop_open(struct inode * inode, struct file * file) |
250 | { | 250 | { |
251 | nonseekable_open(inode, file); | ||
252 | |||
253 | /* Just in case we're already talking to someone... */ | 251 | /* Just in case we're already talking to someone... */ |
254 | if(test_and_set_bit(0, &wdt_is_open)) | 252 | if(test_and_set_bit(0, &wdt_is_open)) |
255 | return -EBUSY; | 253 | return -EBUSY; |
@@ -258,7 +256,7 @@ static int fop_open(struct inode * inode, struct file * file) | |||
258 | 256 | ||
259 | /* Good, fire up the show */ | 257 | /* Good, fire up the show */ |
260 | wdt_startup(); | 258 | wdt_startup(); |
261 | return 0; | 259 | return nonseekable_open(inode, file); |
262 | } | 260 | } |
263 | 261 | ||
264 | static int fop_close(struct inode * inode, struct file * file) | 262 | static int fop_close(struct inode * inode, struct file * file) |
diff --git a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/char/watchdog/w83627hf_wdt.c index b46e7f47d705..df33b3b5a53c 100644 --- a/drivers/char/watchdog/w83627hf_wdt.c +++ b/drivers/char/watchdog/w83627hf_wdt.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * (c) Copyright 2007 Vlad Drukker <vlad@storewiz.com> | 4 | * (c) Copyright 2007 Vlad Drukker <vlad@storewiz.com> |
5 | * added support for W83627THF. | 5 | * added support for W83627THF. |
6 | * | 6 | * |
7 | * (c) Copyright 2003 Pádraig Brady <P@draigBrady.com> | 7 | * (c) Copyright 2003,2007 Pádraig Brady <P@draigBrady.com> |
8 | * | 8 | * |
9 | * Based on advantechwdt.c which is based on wdt.c. | 9 | * Based on advantechwdt.c which is based on wdt.c. |
10 | * Original copyright messages: | 10 | * Original copyright messages: |
@@ -42,7 +42,7 @@ | |||
42 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
43 | #include <asm/system.h> | 43 | #include <asm/system.h> |
44 | 44 | ||
45 | #define WATCHDOG_NAME "w83627hf/thf WDT" | 45 | #define WATCHDOG_NAME "w83627hf/thf/hg WDT" |
46 | #define PFX WATCHDOG_NAME ": " | 46 | #define PFX WATCHDOG_NAME ": " |
47 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ | 47 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ |
48 | 48 | ||
@@ -57,7 +57,7 @@ MODULE_PARM_DESC(wdt_io, "w83627hf/thf WDT io port (default 0x2E)"); | |||
57 | 57 | ||
58 | static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ | 58 | static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ |
59 | module_param(timeout, int, 0); | 59 | module_param(timeout, int, 0); |
60 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | 60 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); |
61 | 61 | ||
62 | static int nowayout = WATCHDOG_NOWAYOUT; | 62 | static int nowayout = WATCHDOG_NOWAYOUT; |
63 | module_param(nowayout, int, 0); | 63 | module_param(nowayout, int, 0); |
@@ -78,9 +78,9 @@ w83627hf_select_wd_register(void) | |||
78 | outb_p(0x87, WDT_EFER); /* Enter extended function mode */ | 78 | outb_p(0x87, WDT_EFER); /* Enter extended function mode */ |
79 | outb_p(0x87, WDT_EFER); /* Again according to manual */ | 79 | outb_p(0x87, WDT_EFER); /* Again according to manual */ |
80 | 80 | ||
81 | outb(0x20, WDT_EFER); /* check chip version */ | 81 | outb(0x20, WDT_EFER); /* check chip version */ |
82 | c = inb(WDT_EFDR); | 82 | c = inb(WDT_EFDR); |
83 | if (c == 0x82) { /* W83627THF */ | 83 | if (c == 0x82) { /* W83627THF */ |
84 | outb_p(0x2b, WDT_EFER); /* select GPIO3 */ | 84 | outb_p(0x2b, WDT_EFER); /* select GPIO3 */ |
85 | c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */ | 85 | c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */ |
86 | outb_p(0x2b, WDT_EFER); | 86 | outb_p(0x2b, WDT_EFER); |
@@ -114,11 +114,17 @@ w83627hf_init(void) | |||
114 | printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout); | 114 | printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout); |
115 | outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */ | 115 | outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */ |
116 | } | 116 | } |
117 | |||
117 | outb_p(0xF5, WDT_EFER); /* Select CRF5 */ | 118 | outb_p(0xF5, WDT_EFER); /* Select CRF5 */ |
118 | t=inb_p(WDT_EFDR); /* read CRF5 */ | 119 | t=inb_p(WDT_EFDR); /* read CRF5 */ |
119 | t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */ | 120 | t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */ |
120 | outb_p(t, WDT_EFDR); /* Write back to CRF5 */ | 121 | outb_p(t, WDT_EFDR); /* Write back to CRF5 */ |
121 | 122 | ||
123 | outb_p(0xF7, WDT_EFER); /* Select CRF7 */ | ||
124 | t=inb_p(WDT_EFDR); /* read CRF7 */ | ||
125 | t&=~0xC0; /* disable keyboard & mouse turning off watchdog */ | ||
126 | outb_p(t, WDT_EFDR); /* Write back to CRF7 */ | ||
127 | |||
122 | w83627hf_unselect_wd_register(); | 128 | w83627hf_unselect_wd_register(); |
123 | } | 129 | } |
124 | 130 | ||
@@ -126,7 +132,7 @@ static void | |||
126 | wdt_ctrl(int timeout) | 132 | wdt_ctrl(int timeout) |
127 | { | 133 | { |
128 | spin_lock(&io_lock); | 134 | spin_lock(&io_lock); |
129 | 135 | ||
130 | w83627hf_select_wd_register(); | 136 | w83627hf_select_wd_register(); |
131 | 137 | ||
132 | outb_p(0xF6, WDT_EFER); /* Select CRF6 */ | 138 | outb_p(0xF6, WDT_EFER); /* Select CRF6 */ |
@@ -154,7 +160,7 @@ wdt_disable(void) | |||
154 | static int | 160 | static int |
155 | wdt_set_heartbeat(int t) | 161 | wdt_set_heartbeat(int t) |
156 | { | 162 | { |
157 | if ((t < 1) || (t > 63)) | 163 | if ((t < 1) || (t > 255)) |
158 | return -EINVAL; | 164 | return -EINVAL; |
159 | 165 | ||
160 | timeout = t; | 166 | timeout = t; |
@@ -324,11 +330,11 @@ wdt_init(void) | |||
324 | 330 | ||
325 | spin_lock_init(&io_lock); | 331 | spin_lock_init(&io_lock); |
326 | 332 | ||
327 | printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF Super I/O chip initialising.\n"); | 333 | printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.\n"); |
328 | 334 | ||
329 | if (wdt_set_heartbeat(timeout)) { | 335 | if (wdt_set_heartbeat(timeout)) { |
330 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | 336 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); |
331 | printk (KERN_INFO PFX "timeout value must be 1<=timeout<=63, using %d\n", | 337 | printk (KERN_INFO PFX "timeout value must be 1<=timeout<=255, using %d\n", |
332 | WATCHDOG_TIMEOUT); | 338 | WATCHDOG_TIMEOUT); |
333 | } | 339 | } |
334 | 340 | ||
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index b2baeaeba9be..0a1f2b52a12f 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -743,7 +743,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
743 | hid->quirks = quirks; | 743 | hid->quirks = quirks; |
744 | 744 | ||
745 | if (!(usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL))) | 745 | if (!(usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL))) |
746 | goto fail; | 746 | goto fail_no_usbhid; |
747 | 747 | ||
748 | hid->driver_data = usbhid; | 748 | hid->driver_data = usbhid; |
749 | usbhid->hid = hid; | 749 | usbhid->hid = hid; |
@@ -878,6 +878,8 @@ fail: | |||
878 | usb_free_urb(usbhid->urbout); | 878 | usb_free_urb(usbhid->urbout); |
879 | usb_free_urb(usbhid->urbctrl); | 879 | usb_free_urb(usbhid->urbctrl); |
880 | hid_free_buffers(dev, hid); | 880 | hid_free_buffers(dev, hid); |
881 | kfree(usbhid); | ||
882 | fail_no_usbhid: | ||
881 | hid_free_device(hid); | 883 | hid_free_device(hid); |
882 | 884 | ||
883 | return NULL; | 885 | return NULL; |
@@ -913,6 +915,7 @@ static void hid_disconnect(struct usb_interface *intf) | |||
913 | usb_free_urb(usbhid->urbout); | 915 | usb_free_urb(usbhid->urbout); |
914 | 916 | ||
915 | hid_free_buffers(hid_to_usb_dev(hid), hid); | 917 | hid_free_buffers(hid_to_usb_dev(hid), hid); |
918 | kfree(usbhid); | ||
916 | hid_free_device(hid); | 919 | hid_free_device(hid); |
917 | } | 920 | } |
918 | 921 | ||
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 775b9f3b8ce3..6b21a214f419 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -61,7 +61,9 @@ | |||
61 | #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c | 61 | #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c |
62 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a | 62 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a |
63 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b | 63 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b |
64 | #define USB_DEVICE_ID_APPLE_IR 0x8240 | 64 | |
65 | #define USB_VENDOR_ID_ASUS 0x0b05 | ||
66 | #define USB_DEVICE_ID_ASUS_LCM 0x1726 | ||
65 | 67 | ||
66 | #define USB_VENDOR_ID_ATEN 0x0557 | 68 | #define USB_VENDOR_ID_ATEN 0x0557 |
67 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 | 69 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 |
@@ -198,6 +200,70 @@ | |||
198 | 200 | ||
199 | #define USB_VENDOR_ID_LOGITECH 0x046d | 201 | #define USB_VENDOR_ID_LOGITECH 0x046d |
200 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 | 202 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 |
203 | #define USB_DEVICE_ID_LOGITECH_HARMONY 0xc110 | ||
204 | #define USB_DEVICE_ID_LOGITECH_HARMONY_2 0xc111 | ||
205 | #define USB_DEVICE_ID_LOGITECH_HARMONY_3 0xc112 | ||
206 | #define USB_DEVICE_ID_LOGITECH_HARMONY_4 0xc113 | ||
207 | #define USB_DEVICE_ID_LOGITECH_HARMONY_5 0xc114 | ||
208 | #define USB_DEVICE_ID_LOGITECH_HARMONY_6 0xc115 | ||
209 | #define USB_DEVICE_ID_LOGITECH_HARMONY_7 0xc116 | ||
210 | #define USB_DEVICE_ID_LOGITECH_HARMONY_8 0xc117 | ||
211 | #define USB_DEVICE_ID_LOGITECH_HARMONY_9 0xc118 | ||
212 | #define USB_DEVICE_ID_LOGITECH_HARMONY_10 0xc119 | ||
213 | #define USB_DEVICE_ID_LOGITECH_HARMONY_11 0xc11a | ||
214 | #define USB_DEVICE_ID_LOGITECH_HARMONY_12 0xc11b | ||
215 | #define USB_DEVICE_ID_LOGITECH_HARMONY_13 0xc11c | ||
216 | #define USB_DEVICE_ID_LOGITECH_HARMONY_14 0xc11d | ||
217 | #define USB_DEVICE_ID_LOGITECH_HARMONY_15 0xc11e | ||
218 | #define USB_DEVICE_ID_LOGITECH_HARMONY_16 0xc11f | ||
219 | #define USB_DEVICE_ID_LOGITECH_HARMONY_17 0xc120 | ||
220 | #define USB_DEVICE_ID_LOGITECH_HARMONY_18 0xc121 | ||
221 | #define USB_DEVICE_ID_LOGITECH_HARMONY_19 0xc122 | ||
222 | #define USB_DEVICE_ID_LOGITECH_HARMONY_20 0xc123 | ||
223 | #define USB_DEVICE_ID_LOGITECH_HARMONY_21 0xc124 | ||
224 | #define USB_DEVICE_ID_LOGITECH_HARMONY_22 0xc125 | ||
225 | #define USB_DEVICE_ID_LOGITECH_HARMONY_23 0xc126 | ||
226 | #define USB_DEVICE_ID_LOGITECH_HARMONY_24 0xc127 | ||
227 | #define USB_DEVICE_ID_LOGITECH_HARMONY_25 0xc128 | ||
228 | #define USB_DEVICE_ID_LOGITECH_HARMONY_26 0xc129 | ||
229 | #define USB_DEVICE_ID_LOGITECH_HARMONY_27 0xc12a | ||
230 | #define USB_DEVICE_ID_LOGITECH_HARMONY_28 0xc12b | ||
231 | #define USB_DEVICE_ID_LOGITECH_HARMONY_29 0xc12c | ||
232 | #define USB_DEVICE_ID_LOGITECH_HARMONY_30 0xc12d | ||
233 | #define USB_DEVICE_ID_LOGITECH_HARMONY_31 0xc12e | ||
234 | #define USB_DEVICE_ID_LOGITECH_HARMONY_32 0xc12f | ||
235 | #define USB_DEVICE_ID_LOGITECH_HARMONY_33 0xc130 | ||
236 | #define USB_DEVICE_ID_LOGITECH_HARMONY_34 0xc131 | ||
237 | #define USB_DEVICE_ID_LOGITECH_HARMONY_35 0xc132 | ||
238 | #define USB_DEVICE_ID_LOGITECH_HARMONY_36 0xc133 | ||
239 | #define USB_DEVICE_ID_LOGITECH_HARMONY_37 0xc134 | ||
240 | #define USB_DEVICE_ID_LOGITECH_HARMONY_38 0xc135 | ||
241 | #define USB_DEVICE_ID_LOGITECH_HARMONY_39 0xc136 | ||
242 | #define USB_DEVICE_ID_LOGITECH_HARMONY_40 0xc137 | ||
243 | #define USB_DEVICE_ID_LOGITECH_HARMONY_41 0xc138 | ||
244 | #define USB_DEVICE_ID_LOGITECH_HARMONY_42 0xc139 | ||
245 | #define USB_DEVICE_ID_LOGITECH_HARMONY_43 0xc13a | ||
246 | #define USB_DEVICE_ID_LOGITECH_HARMONY_44 0xc13b | ||
247 | #define USB_DEVICE_ID_LOGITECH_HARMONY_45 0xc13c | ||
248 | #define USB_DEVICE_ID_LOGITECH_HARMONY_46 0xc13d | ||
249 | #define USB_DEVICE_ID_LOGITECH_HARMONY_47 0xc13e | ||
250 | #define USB_DEVICE_ID_LOGITECH_HARMONY_48 0xc13f | ||
251 | #define USB_DEVICE_ID_LOGITECH_HARMONY_49 0xc140 | ||
252 | #define USB_DEVICE_ID_LOGITECH_HARMONY_50 0xc141 | ||
253 | #define USB_DEVICE_ID_LOGITECH_HARMONY_51 0xc142 | ||
254 | #define USB_DEVICE_ID_LOGITECH_HARMONY_52 0xc143 | ||
255 | #define USB_DEVICE_ID_LOGITECH_HARMONY_53 0xc144 | ||
256 | #define USB_DEVICE_ID_LOGITECH_HARMONY_54 0xc145 | ||
257 | #define USB_DEVICE_ID_LOGITECH_HARMONY_55 0xc146 | ||
258 | #define USB_DEVICE_ID_LOGITECH_HARMONY_56 0xc147 | ||
259 | #define USB_DEVICE_ID_LOGITECH_HARMONY_57 0xc148 | ||
260 | #define USB_DEVICE_ID_LOGITECH_HARMONY_58 0xc149 | ||
261 | #define USB_DEVICE_ID_LOGITECH_HARMONY_59 0xc14a | ||
262 | #define USB_DEVICE_ID_LOGITECH_HARMONY_60 0xc14b | ||
263 | #define USB_DEVICE_ID_LOGITECH_HARMONY_61 0xc14c | ||
264 | #define USB_DEVICE_ID_LOGITECH_HARMONY_62 0xc14d | ||
265 | #define USB_DEVICE_ID_LOGITECH_HARMONY_63 0xc14e | ||
266 | #define USB_DEVICE_ID_LOGITECH_HARMONY_64 0xc14f | ||
201 | #define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 | 267 | #define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 |
202 | #define USB_DEVICE_ID_LOGITECH_KBD 0xc311 | 268 | #define USB_DEVICE_ID_LOGITECH_KBD 0xc311 |
203 | #define USB_DEVICE_ID_S510_RECEIVER 0xc50c | 269 | #define USB_DEVICE_ID_S510_RECEIVER 0xc50c |
@@ -221,6 +287,9 @@ | |||
221 | #define USB_DEVICE_ID_NCR_FIRST 0x0300 | 287 | #define USB_DEVICE_ID_NCR_FIRST 0x0300 |
222 | #define USB_DEVICE_ID_NCR_LAST 0x03ff | 288 | #define USB_DEVICE_ID_NCR_LAST 0x03ff |
223 | 289 | ||
290 | #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 | ||
291 | #define USB_DEVICE_ID_N_S_HARMONY 0xc359 | ||
292 | |||
224 | #define USB_VENDOR_ID_NEC 0x073e | 293 | #define USB_VENDOR_ID_NEC 0x073e |
225 | #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 | 294 | #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 |
226 | 295 | ||
@@ -315,7 +384,7 @@ static const struct hid_blacklist { | |||
315 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, | 384 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, |
316 | { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE }, | 385 | { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE }, |
317 | { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE }, | 386 | { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE }, |
318 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IR, HID_QUIRK_IGNORE }, | 387 | { USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM, HID_QUIRK_IGNORE}, |
319 | { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE }, | 388 | { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE }, |
320 | { USB_VENDOR_ID_CIDC, 0x0103, HID_QUIRK_IGNORE }, | 389 | { USB_VENDOR_ID_CIDC, 0x0103, HID_QUIRK_IGNORE }, |
321 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE }, | 390 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE }, |
@@ -463,6 +532,71 @@ static const struct hid_blacklist { | |||
463 | 532 | ||
464 | { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS }, | 533 | { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS }, |
465 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS }, | 534 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS }, |
535 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY, HID_QUIRK_IGNORE }, | ||
536 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_2, HID_QUIRK_IGNORE }, | ||
537 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_3, HID_QUIRK_IGNORE }, | ||
538 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_4, HID_QUIRK_IGNORE }, | ||
539 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_5, HID_QUIRK_IGNORE }, | ||
540 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_6, HID_QUIRK_IGNORE }, | ||
541 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_7, HID_QUIRK_IGNORE }, | ||
542 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_8, HID_QUIRK_IGNORE }, | ||
543 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_9, HID_QUIRK_IGNORE }, | ||
544 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_10, HID_QUIRK_IGNORE }, | ||
545 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_11, HID_QUIRK_IGNORE }, | ||
546 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_12, HID_QUIRK_IGNORE }, | ||
547 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_13, HID_QUIRK_IGNORE }, | ||
548 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_14, HID_QUIRK_IGNORE }, | ||
549 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_15, HID_QUIRK_IGNORE }, | ||
550 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_16, HID_QUIRK_IGNORE }, | ||
551 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_17, HID_QUIRK_IGNORE }, | ||
552 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_18, HID_QUIRK_IGNORE }, | ||
553 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_19, HID_QUIRK_IGNORE }, | ||
554 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_20, HID_QUIRK_IGNORE }, | ||
555 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_21, HID_QUIRK_IGNORE }, | ||
556 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_22, HID_QUIRK_IGNORE }, | ||
557 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_23, HID_QUIRK_IGNORE }, | ||
558 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_24, HID_QUIRK_IGNORE }, | ||
559 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_25, HID_QUIRK_IGNORE }, | ||
560 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_26, HID_QUIRK_IGNORE }, | ||
561 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_27, HID_QUIRK_IGNORE }, | ||
562 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_28, HID_QUIRK_IGNORE }, | ||
563 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_29, HID_QUIRK_IGNORE }, | ||
564 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_30, HID_QUIRK_IGNORE }, | ||
565 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_31, HID_QUIRK_IGNORE }, | ||
566 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_32, HID_QUIRK_IGNORE }, | ||
567 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_33, HID_QUIRK_IGNORE }, | ||
568 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_34, HID_QUIRK_IGNORE }, | ||
569 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_35, HID_QUIRK_IGNORE }, | ||
570 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_36, HID_QUIRK_IGNORE }, | ||
571 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_37, HID_QUIRK_IGNORE }, | ||
572 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_38, HID_QUIRK_IGNORE }, | ||
573 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_39, HID_QUIRK_IGNORE }, | ||
574 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_40, HID_QUIRK_IGNORE }, | ||
575 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_41, HID_QUIRK_IGNORE }, | ||
576 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_42, HID_QUIRK_IGNORE }, | ||
577 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_43, HID_QUIRK_IGNORE }, | ||
578 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_44, HID_QUIRK_IGNORE }, | ||
579 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_45, HID_QUIRK_IGNORE }, | ||
580 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_46, HID_QUIRK_IGNORE }, | ||
581 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_47, HID_QUIRK_IGNORE }, | ||
582 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_48, HID_QUIRK_IGNORE }, | ||
583 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_49, HID_QUIRK_IGNORE }, | ||
584 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_50, HID_QUIRK_IGNORE }, | ||
585 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_51, HID_QUIRK_IGNORE }, | ||
586 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_52, HID_QUIRK_IGNORE }, | ||
587 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_53, HID_QUIRK_IGNORE }, | ||
588 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_54, HID_QUIRK_IGNORE }, | ||
589 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_55, HID_QUIRK_IGNORE }, | ||
590 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_56, HID_QUIRK_IGNORE }, | ||
591 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_57, HID_QUIRK_IGNORE }, | ||
592 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_58, HID_QUIRK_IGNORE }, | ||
593 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_59, HID_QUIRK_IGNORE }, | ||
594 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_60, HID_QUIRK_IGNORE }, | ||
595 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_61, HID_QUIRK_IGNORE }, | ||
596 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_62, HID_QUIRK_IGNORE }, | ||
597 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_63, HID_QUIRK_IGNORE }, | ||
598 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_64, HID_QUIRK_IGNORE }, | ||
599 | { USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY, HID_QUIRK_IGNORE }, | ||
466 | 600 | ||
467 | { 0, 0 } | 601 | { 0, 0 } |
468 | }; | 602 | }; |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index dbdca6f10e46..192953b29b28 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -520,6 +520,16 @@ config SENSORS_SMSC47B397 | |||
520 | This driver can also be built as a module. If so, the module | 520 | This driver can also be built as a module. If so, the module |
521 | will be called smsc47b397. | 521 | will be called smsc47b397. |
522 | 522 | ||
523 | config SENSORS_THMC50 | ||
524 | tristate "Texas Instruments THMC50 / Analog Devices ADM1022" | ||
525 | depends on I2C && EXPERIMENTAL | ||
526 | help | ||
527 | If you say yes here you get support for Texas Instruments THMC50 | ||
528 | sensor chips and clones: the Analog Devices ADM1022. | ||
529 | |||
530 | This driver can also be built as a module. If so, the module | ||
531 | will be called thmc50. | ||
532 | |||
523 | config SENSORS_VIA686A | 533 | config SENSORS_VIA686A |
524 | tristate "VIA686A" | 534 | tristate "VIA686A" |
525 | depends on PCI | 535 | depends on PCI |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 59f81fae40a0..d04f90031ebf 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -56,6 +56,7 @@ obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o | |||
56 | obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o | 56 | obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o |
57 | obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o | 57 | obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o |
58 | obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o | 58 | obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o |
59 | obj-$(CONFIG_SENSORS_THMC50) += thmc50.o | ||
59 | obj-$(CONFIG_SENSORS_VIA686A) += via686a.o | 60 | obj-$(CONFIG_SENSORS_VIA686A) += via686a.o |
60 | obj-$(CONFIG_SENSORS_VT1211) += vt1211.o | 61 | obj-$(CONFIG_SENSORS_VT1211) += vt1211.o |
61 | obj-$(CONFIG_SENSORS_VT8231) += vt8231.o | 62 | obj-$(CONFIG_SENSORS_VT8231) += vt8231.o |
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index a003d104ca45..cdd8b6dea16d 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
@@ -691,8 +691,9 @@ static int abituguru3_read(struct abituguru3_data *data, u8 bank, u8 offset, | |||
691 | 691 | ||
692 | /* Sensor settings are stored 1 byte per offset with the bytes | 692 | /* Sensor settings are stored 1 byte per offset with the bytes |
693 | placed add consecutive offsets. */ | 693 | placed add consecutive offsets. */ |
694 | int abituguru3_read_increment_offset(struct abituguru3_data *data, u8 bank, | 694 | static int abituguru3_read_increment_offset(struct abituguru3_data *data, |
695 | u8 offset, u8 count, u8 *buf, int offset_count) | 695 | u8 bank, u8 offset, u8 count, |
696 | u8 *buf, int offset_count) | ||
696 | { | 697 | { |
697 | int i, x; | 698 | int i, x; |
698 | 699 | ||
diff --git a/drivers/hwmon/ams/ams-core.c b/drivers/hwmon/ams/ams-core.c index 6db973739725..a112a03e8f29 100644 --- a/drivers/hwmon/ams/ams-core.c +++ b/drivers/hwmon/ams/ams-core.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/types.h> | 23 | #include <linux/types.h> |
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/module.h> | ||
27 | #include <asm/pmac_pfunc.h> | 26 | #include <asm/pmac_pfunc.h> |
28 | #include <asm/of_platform.h> | 27 | #include <asm/of_platform.h> |
29 | 28 | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index fd1281f42209..941729a131f5 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -79,11 +79,15 @@ | |||
79 | 79 | ||
80 | /* | 80 | /* |
81 | * Temperature sensors keys (sp78 - 2 bytes). | 81 | * Temperature sensors keys (sp78 - 2 bytes). |
82 | * First set for Macbook(Pro), second for Macmini. | ||
83 | */ | 82 | */ |
84 | static const char* temperature_sensors_sets[][13] = { | 83 | static const char* temperature_sensors_sets[][13] = { |
84 | /* Set 0: Macbook Pro */ | ||
85 | { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", | 85 | { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", |
86 | "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, | 86 | "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, |
87 | /* Set 1: Macbook set */ | ||
88 | { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", | ||
89 | "Th1H", "Ts0P", NULL }, | ||
90 | /* Set 2: Macmini set */ | ||
87 | { "TC0D", "TC0P", NULL } | 91 | { "TC0D", "TC0P", NULL } |
88 | }; | 92 | }; |
89 | 93 | ||
@@ -1150,10 +1154,10 @@ static void applesmc_release_accelerometer(void) | |||
1150 | static __initdata struct dmi_match_data applesmc_dmi_data[] = { | 1154 | static __initdata struct dmi_match_data applesmc_dmi_data[] = { |
1151 | /* MacBook Pro: accelerometer, backlight and temperature set 0 */ | 1155 | /* MacBook Pro: accelerometer, backlight and temperature set 0 */ |
1152 | { .accelerometer = 1, .light = 1, .temperature_set = 0 }, | 1156 | { .accelerometer = 1, .light = 1, .temperature_set = 0 }, |
1153 | /* MacBook: accelerometer and temperature set 0 */ | 1157 | /* MacBook: accelerometer and temperature set 1 */ |
1154 | { .accelerometer = 1, .light = 0, .temperature_set = 0 }, | 1158 | { .accelerometer = 1, .light = 0, .temperature_set = 1 }, |
1155 | /* MacBook: temperature set 1 */ | 1159 | /* MacMini: temperature set 2 */ |
1156 | { .accelerometer = 0, .light = 0, .temperature_set = 1 } | 1160 | { .accelerometer = 0, .light = 0, .temperature_set = 2 }, |
1157 | }; | 1161 | }; |
1158 | 1162 | ||
1159 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". | 1163 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". |
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index be3aaa5d0b91..e9cbc727664d 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c | |||
@@ -750,7 +750,7 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr, | |||
750 | res = (data->alarms >> DME1737_BIT_ALARM_TEMP[ix]) & 0x01; | 750 | res = (data->alarms >> DME1737_BIT_ALARM_TEMP[ix]) & 0x01; |
751 | break; | 751 | break; |
752 | case SYS_TEMP_FAULT: | 752 | case SYS_TEMP_FAULT: |
753 | res = (data->temp[ix] == 0x0800); | 753 | res = (((u16)data->temp[ix] & 0xff00) == 0x8000); |
754 | break; | 754 | break; |
755 | default: | 755 | default: |
756 | res = 0; | 756 | res = 0; |
diff --git a/drivers/hwmon/fscher.c b/drivers/hwmon/fscher.c index 19717752cfca..b34b546c68b8 100644 --- a/drivers/hwmon/fscher.c +++ b/drivers/hwmon/fscher.c | |||
@@ -441,6 +441,8 @@ static struct fscher_data *fscher_update_device(struct device *dev) | |||
441 | data->watchdog[2] = fscher_read_value(client, FSCHER_REG_WDOG_CONTROL); | 441 | data->watchdog[2] = fscher_read_value(client, FSCHER_REG_WDOG_CONTROL); |
442 | 442 | ||
443 | data->global_event = fscher_read_value(client, FSCHER_REG_EVENT_STATE); | 443 | data->global_event = fscher_read_value(client, FSCHER_REG_EVENT_STATE); |
444 | data->global_control = fscher_read_value(client, | ||
445 | FSCHER_REG_CONTROL); | ||
444 | 446 | ||
445 | data->last_updated = jiffies; | 447 | data->last_updated = jiffies; |
446 | data->valid = 1; | 448 | data->valid = 1; |
@@ -599,7 +601,7 @@ static ssize_t set_control(struct i2c_client *client, struct fscher_data *data, | |||
599 | unsigned long v = simple_strtoul(buf, NULL, 10) & 0x01; | 601 | unsigned long v = simple_strtoul(buf, NULL, 10) & 0x01; |
600 | 602 | ||
601 | mutex_lock(&data->update_lock); | 603 | mutex_lock(&data->update_lock); |
602 | data->global_control &= ~v; | 604 | data->global_control = v; |
603 | fscher_write_value(client, reg, v); | 605 | fscher_write_value(client, reg, v); |
604 | mutex_unlock(&data->update_lock); | 606 | mutex_unlock(&data->update_lock); |
605 | return count; | 607 | return count; |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index eff6036e15c0..d75dba9b810b 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -252,7 +252,7 @@ struct it87_data { | |||
252 | 252 | ||
253 | 253 | ||
254 | static int it87_probe(struct platform_device *pdev); | 254 | static int it87_probe(struct platform_device *pdev); |
255 | static int it87_remove(struct platform_device *pdev); | 255 | static int __devexit it87_remove(struct platform_device *pdev); |
256 | 256 | ||
257 | static int it87_read_value(struct it87_data *data, u8 reg); | 257 | static int it87_read_value(struct it87_data *data, u8 reg); |
258 | static void it87_write_value(struct it87_data *data, u8 reg, u8 value); | 258 | static void it87_write_value(struct it87_data *data, u8 reg, u8 value); |
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index 9fb572f03ba5..565c4e679b8d 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
@@ -864,7 +864,7 @@ static int __init lm78_isa_found(unsigned short address) | |||
864 | /* Determine the chip type */ | 864 | /* Determine the chip type */ |
865 | outb_p(LM78_REG_CHIPID, address + LM78_ADDR_REG_OFFSET); | 865 | outb_p(LM78_REG_CHIPID, address + LM78_ADDR_REG_OFFSET); |
866 | val = inb_p(address + LM78_DATA_REG_OFFSET); | 866 | val = inb_p(address + LM78_DATA_REG_OFFSET); |
867 | if (val == 0x00 /* LM78 */ | 867 | if (val == 0x00 || val == 0x20 /* LM78 */ |
868 | || val == 0x40 /* LM78-J */ | 868 | || val == 0x40 /* LM78-J */ |
869 | || (val & 0xfe) == 0xc0) /* LM79 */ | 869 | || (val & 0xfe) == 0xc0) /* LM79 */ |
870 | found = 1; | 870 | found = 1; |
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 48833fff4920..af541d67245d 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -585,7 +585,7 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind) | |||
585 | * those of the man_id register. | 585 | * those of the man_id register. |
586 | */ | 586 | */ |
587 | if (chip_id == man_id | 587 | if (chip_id == man_id |
588 | && (address == 0x4F || address == 0x4D) | 588 | && (address == 0x4C || address == 0x4D) |
589 | && (reg_config1 & 0x1F) == (man_id & 0x0F) | 589 | && (reg_config1 & 0x1F) == (man_id & 0x0F) |
590 | && reg_convrate <= 0x09) { | 590 | && reg_convrate <= 0x09) { |
591 | kind = max6657; | 591 | kind = max6657; |
diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c index 23edf4fe4221..d84f8bf6f284 100644 --- a/drivers/hwmon/lm93.c +++ b/drivers/hwmon/lm93.c | |||
@@ -234,7 +234,7 @@ struct lm93_data { | |||
234 | struct { | 234 | struct { |
235 | u8 min; | 235 | u8 min; |
236 | u8 max; | 236 | u8 max; |
237 | } temp_lim[3]; | 237 | } temp_lim[4]; |
238 | 238 | ||
239 | /* vin1 - vin16: low and high limits */ | 239 | /* vin1 - vin16: low and high limits */ |
240 | struct { | 240 | struct { |
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index cb72526c346a..f57c75d59a5b 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c | |||
@@ -220,7 +220,7 @@ struct pc87360_data { | |||
220 | */ | 220 | */ |
221 | 221 | ||
222 | static int pc87360_probe(struct platform_device *pdev); | 222 | static int pc87360_probe(struct platform_device *pdev); |
223 | static int pc87360_remove(struct platform_device *pdev); | 223 | static int __devexit pc87360_remove(struct platform_device *pdev); |
224 | 224 | ||
225 | static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank, | 225 | static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank, |
226 | u8 reg); | 226 | u8 reg); |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 83321b28cf0e..92956eb3f3c1 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -187,7 +187,7 @@ struct sis5595_data { | |||
187 | static struct pci_dev *s_bridge; /* pointer to the (only) sis5595 */ | 187 | static struct pci_dev *s_bridge; /* pointer to the (only) sis5595 */ |
188 | 188 | ||
189 | static int sis5595_probe(struct platform_device *pdev); | 189 | static int sis5595_probe(struct platform_device *pdev); |
190 | static int sis5595_remove(struct platform_device *pdev); | 190 | static int __devexit sis5595_remove(struct platform_device *pdev); |
191 | 191 | ||
192 | static int sis5595_read_value(struct sis5595_data *data, u8 reg); | 192 | static int sis5595_read_value(struct sis5595_data *data, u8 reg); |
193 | static void sis5595_write_value(struct sis5595_data *data, u8 reg, u8 value); | 193 | static void sis5595_write_value(struct sis5595_data *data, u8 reg, u8 value); |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 1de2f2be8708..338ee4f54614 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -134,7 +134,7 @@ struct smsc47m1_sio_data { | |||
134 | 134 | ||
135 | 135 | ||
136 | static int smsc47m1_probe(struct platform_device *pdev); | 136 | static int smsc47m1_probe(struct platform_device *pdev); |
137 | static int smsc47m1_remove(struct platform_device *pdev); | 137 | static int __devexit smsc47m1_remove(struct platform_device *pdev); |
138 | static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, | 138 | static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, |
139 | int init); | 139 | int init); |
140 | 140 | ||
diff --git a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c new file mode 100644 index 000000000000..9395b52d9b99 --- /dev/null +++ b/drivers/hwmon/thmc50.c | |||
@@ -0,0 +1,440 @@ | |||
1 | /* | ||
2 | thmc50.c - Part of lm_sensors, Linux kernel modules for hardware | ||
3 | monitoring | ||
4 | Copyright (C) 2007 Krzysztof Helt <krzysztof.h1@wp.pl> | ||
5 | Based on 2.4 driver by Frodo Looijaard <frodol@dds.nl> and | ||
6 | Philip Edelbrock <phil@netroedge.com> | ||
7 | |||
8 | This program is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation; either version 2 of the License, or | ||
11 | (at your option) any later version. | ||
12 | |||
13 | This program is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program; if not, write to the Free Software | ||
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/i2c.h> | ||
27 | #include <linux/hwmon.h> | ||
28 | #include <linux/hwmon-sysfs.h> | ||
29 | #include <linux/err.h> | ||
30 | #include <linux/mutex.h> | ||
31 | |||
32 | MODULE_LICENSE("GPL"); | ||
33 | |||
34 | /* Addresses to scan */ | ||
35 | static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | ||
36 | |||
37 | /* Insmod parameters */ | ||
38 | I2C_CLIENT_INSMOD_2(thmc50, adm1022); | ||
39 | I2C_CLIENT_MODULE_PARM(adm1022_temp3, "List of adapter,address pairs " | ||
40 | "to enable 3rd temperature (ADM1022 only)"); | ||
41 | |||
42 | /* Many THMC50 constants specified below */ | ||
43 | |||
44 | /* The THMC50 registers */ | ||
45 | #define THMC50_REG_CONF 0x40 | ||
46 | #define THMC50_REG_COMPANY_ID 0x3E | ||
47 | #define THMC50_REG_DIE_CODE 0x3F | ||
48 | #define THMC50_REG_ANALOG_OUT 0x19 | ||
49 | |||
50 | const static u8 THMC50_REG_TEMP[] = { 0x27, 0x26, 0x20 }; | ||
51 | const static u8 THMC50_REG_TEMP_MIN[] = { 0x3A, 0x38, 0x2C }; | ||
52 | const static u8 THMC50_REG_TEMP_MAX[] = { 0x39, 0x37, 0x2B }; | ||
53 | |||
54 | #define THMC50_REG_CONF_nFANOFF 0x20 | ||
55 | |||
56 | /* Each client has this additional data */ | ||
57 | struct thmc50_data { | ||
58 | struct i2c_client client; | ||
59 | struct class_device *class_dev; | ||
60 | |||
61 | struct mutex update_lock; | ||
62 | enum chips type; | ||
63 | unsigned long last_updated; /* In jiffies */ | ||
64 | char has_temp3; /* !=0 if it is ADM1022 in temp3 mode */ | ||
65 | char valid; /* !=0 if following fields are valid */ | ||
66 | |||
67 | /* Register values */ | ||
68 | s8 temp_input[3]; | ||
69 | s8 temp_max[3]; | ||
70 | s8 temp_min[3]; | ||
71 | u8 analog_out; | ||
72 | }; | ||
73 | |||
74 | static int thmc50_attach_adapter(struct i2c_adapter *adapter); | ||
75 | static int thmc50_detach_client(struct i2c_client *client); | ||
76 | static void thmc50_init_client(struct i2c_client *client); | ||
77 | static struct thmc50_data *thmc50_update_device(struct device *dev); | ||
78 | |||
79 | static struct i2c_driver thmc50_driver = { | ||
80 | .driver = { | ||
81 | .name = "thmc50", | ||
82 | }, | ||
83 | .attach_adapter = thmc50_attach_adapter, | ||
84 | .detach_client = thmc50_detach_client, | ||
85 | }; | ||
86 | |||
87 | static ssize_t show_analog_out(struct device *dev, | ||
88 | struct device_attribute *attr, char *buf) | ||
89 | { | ||
90 | struct thmc50_data *data = thmc50_update_device(dev); | ||
91 | return sprintf(buf, "%d\n", data->analog_out); | ||
92 | } | ||
93 | |||
94 | static ssize_t set_analog_out(struct device *dev, | ||
95 | struct device_attribute *attr, | ||
96 | const char *buf, size_t count) | ||
97 | { | ||
98 | struct i2c_client *client = to_i2c_client(dev); | ||
99 | struct thmc50_data *data = i2c_get_clientdata(client); | ||
100 | int tmp = simple_strtoul(buf, NULL, 10); | ||
101 | int config; | ||
102 | |||
103 | mutex_lock(&data->update_lock); | ||
104 | data->analog_out = SENSORS_LIMIT(tmp, 0, 255); | ||
105 | i2c_smbus_write_byte_data(client, THMC50_REG_ANALOG_OUT, | ||
106 | data->analog_out); | ||
107 | |||
108 | config = i2c_smbus_read_byte_data(client, THMC50_REG_CONF); | ||
109 | if (data->analog_out == 0) | ||
110 | config &= ~THMC50_REG_CONF_nFANOFF; | ||
111 | else | ||
112 | config |= THMC50_REG_CONF_nFANOFF; | ||
113 | i2c_smbus_write_byte_data(client, THMC50_REG_CONF, config); | ||
114 | |||
115 | mutex_unlock(&data->update_lock); | ||
116 | return count; | ||
117 | } | ||
118 | |||
119 | /* There is only one PWM mode = DC */ | ||
120 | static ssize_t show_pwm_mode(struct device *dev, struct device_attribute *attr, | ||
121 | char *buf) | ||
122 | { | ||
123 | return sprintf(buf, "0\n"); | ||
124 | } | ||
125 | |||
126 | /* Temperatures */ | ||
127 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, | ||
128 | char *buf) | ||
129 | { | ||
130 | int nr = to_sensor_dev_attr(attr)->index; | ||
131 | struct thmc50_data *data = thmc50_update_device(dev); | ||
132 | return sprintf(buf, "%d\n", data->temp_input[nr] * 1000); | ||
133 | } | ||
134 | |||
135 | static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr, | ||
136 | char *buf) | ||
137 | { | ||
138 | int nr = to_sensor_dev_attr(attr)->index; | ||
139 | struct thmc50_data *data = thmc50_update_device(dev); | ||
140 | return sprintf(buf, "%d\n", data->temp_min[nr] * 1000); | ||
141 | } | ||
142 | |||
143 | static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, | ||
144 | const char *buf, size_t count) | ||
145 | { | ||
146 | int nr = to_sensor_dev_attr(attr)->index; | ||
147 | struct i2c_client *client = to_i2c_client(dev); | ||
148 | struct thmc50_data *data = i2c_get_clientdata(client); | ||
149 | int val = simple_strtol(buf, NULL, 10); | ||
150 | |||
151 | mutex_lock(&data->update_lock); | ||
152 | data->temp_min[nr] = SENSORS_LIMIT(val / 1000, -128, 127); | ||
153 | i2c_smbus_write_byte_data(client, THMC50_REG_TEMP_MIN[nr], | ||
154 | data->temp_min[nr]); | ||
155 | mutex_unlock(&data->update_lock); | ||
156 | return count; | ||
157 | } | ||
158 | |||
159 | static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr, | ||
160 | char *buf) | ||
161 | { | ||
162 | int nr = to_sensor_dev_attr(attr)->index; | ||
163 | struct thmc50_data *data = thmc50_update_device(dev); | ||
164 | return sprintf(buf, "%d\n", data->temp_max[nr] * 1000); | ||
165 | } | ||
166 | |||
167 | static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, | ||
168 | const char *buf, size_t count) | ||
169 | { | ||
170 | int nr = to_sensor_dev_attr(attr)->index; | ||
171 | struct i2c_client *client = to_i2c_client(dev); | ||
172 | struct thmc50_data *data = i2c_get_clientdata(client); | ||
173 | int val = simple_strtol(buf, NULL, 10); | ||
174 | |||
175 | mutex_lock(&data->update_lock); | ||
176 | data->temp_max[nr] = SENSORS_LIMIT(val / 1000, -128, 127); | ||
177 | i2c_smbus_write_byte_data(client, THMC50_REG_TEMP_MAX[nr], | ||
178 | data->temp_max[nr]); | ||
179 | mutex_unlock(&data->update_lock); | ||
180 | return count; | ||
181 | } | ||
182 | |||
183 | #define temp_reg(offset) \ | ||
184 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp, \ | ||
185 | NULL, offset - 1); \ | ||
186 | static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ | ||
187 | show_temp_min, set_temp_min, offset - 1); \ | ||
188 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ | ||
189 | show_temp_max, set_temp_max, offset - 1); | ||
190 | |||
191 | temp_reg(1); | ||
192 | temp_reg(2); | ||
193 | temp_reg(3); | ||
194 | |||
195 | static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_analog_out, | ||
196 | set_analog_out, 0); | ||
197 | static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO, show_pwm_mode, NULL, 0); | ||
198 | |||
199 | static struct attribute *thmc50_attributes[] = { | ||
200 | &sensor_dev_attr_temp1_max.dev_attr.attr, | ||
201 | &sensor_dev_attr_temp1_min.dev_attr.attr, | ||
202 | &sensor_dev_attr_temp1_input.dev_attr.attr, | ||
203 | &sensor_dev_attr_temp2_max.dev_attr.attr, | ||
204 | &sensor_dev_attr_temp2_min.dev_attr.attr, | ||
205 | &sensor_dev_attr_temp2_input.dev_attr.attr, | ||
206 | &sensor_dev_attr_pwm1.dev_attr.attr, | ||
207 | &sensor_dev_attr_pwm1_mode.dev_attr.attr, | ||
208 | NULL | ||
209 | }; | ||
210 | |||
211 | static const struct attribute_group thmc50_group = { | ||
212 | .attrs = thmc50_attributes, | ||
213 | }; | ||
214 | |||
215 | /* for ADM1022 3rd temperature mode */ | ||
216 | static struct attribute *adm1022_attributes[] = { | ||
217 | &sensor_dev_attr_temp3_max.dev_attr.attr, | ||
218 | &sensor_dev_attr_temp3_min.dev_attr.attr, | ||
219 | &sensor_dev_attr_temp3_input.dev_attr.attr, | ||
220 | NULL | ||
221 | }; | ||
222 | |||
223 | static const struct attribute_group adm1022_group = { | ||
224 | .attrs = adm1022_attributes, | ||
225 | }; | ||
226 | |||
227 | static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind) | ||
228 | { | ||
229 | unsigned company; | ||
230 | unsigned revision; | ||
231 | unsigned config; | ||
232 | struct i2c_client *client; | ||
233 | struct thmc50_data *data; | ||
234 | struct device *dev; | ||
235 | int err = 0; | ||
236 | const char *type_name = ""; | ||
237 | |||
238 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { | ||
239 | pr_debug("thmc50: detect failed, " | ||
240 | "smbus byte data not supported!\n"); | ||
241 | goto exit; | ||
242 | } | ||
243 | |||
244 | /* OK. For now, we presume we have a valid client. We now create the | ||
245 | client structure, even though we cannot fill it completely yet. | ||
246 | But it allows us to access thmc50 registers. */ | ||
247 | if (!(data = kzalloc(sizeof(struct thmc50_data), GFP_KERNEL))) { | ||
248 | pr_debug("thmc50: detect failed, kzalloc failed!\n"); | ||
249 | err = -ENOMEM; | ||
250 | goto exit; | ||
251 | } | ||
252 | |||
253 | client = &data->client; | ||
254 | i2c_set_clientdata(client, data); | ||
255 | client->addr = address; | ||
256 | client->adapter = adapter; | ||
257 | client->driver = &thmc50_driver; | ||
258 | dev = &client->dev; | ||
259 | |||
260 | pr_debug("thmc50: Probing for THMC50 at 0x%2X on bus %d\n", | ||
261 | client->addr, i2c_adapter_id(client->adapter)); | ||
262 | |||
263 | /* Now, we do the remaining detection. */ | ||
264 | company = i2c_smbus_read_byte_data(client, THMC50_REG_COMPANY_ID); | ||
265 | revision = i2c_smbus_read_byte_data(client, THMC50_REG_DIE_CODE); | ||
266 | config = i2c_smbus_read_byte_data(client, THMC50_REG_CONF); | ||
267 | |||
268 | if (kind == 0) | ||
269 | kind = thmc50; | ||
270 | else if (kind < 0) { | ||
271 | err = -ENODEV; | ||
272 | if (revision >= 0xc0 && ((config & 0x10) == 0)) { | ||
273 | if (company == 0x49) { | ||
274 | kind = thmc50; | ||
275 | err = 0; | ||
276 | } else if (company == 0x41) { | ||
277 | kind = adm1022; | ||
278 | err = 0; | ||
279 | } | ||
280 | } | ||
281 | } | ||
282 | if (err == -ENODEV) { | ||
283 | pr_debug("thmc50: Detection of THMC50/ADM1022 failed\n"); | ||
284 | goto exit_free; | ||
285 | } | ||
286 | pr_debug("thmc50: Detected %s (version %x, revision %x)\n", | ||
287 | type_name, (revision >> 4) - 0xc, revision & 0xf); | ||
288 | data->type = kind; | ||
289 | |||
290 | if (kind == thmc50) | ||
291 | type_name = "thmc50"; | ||
292 | else if (kind == adm1022) { | ||
293 | int id = i2c_adapter_id(client->adapter); | ||
294 | int i; | ||
295 | |||
296 | type_name = "adm1022"; | ||
297 | data->has_temp3 = (config >> 7) & 1; /* config MSB */ | ||
298 | for (i = 0; i + 1 < adm1022_temp3_num; i += 2) | ||
299 | if (adm1022_temp3[i] == id && | ||
300 | adm1022_temp3[i + 1] == address) { | ||
301 | /* enable 2nd remote temp */ | ||
302 | data->has_temp3 = 1; | ||
303 | break; | ||
304 | } | ||
305 | } | ||
306 | |||
307 | /* Fill in the remaining client fields & put it into the global list */ | ||
308 | strlcpy(client->name, type_name, I2C_NAME_SIZE); | ||
309 | mutex_init(&data->update_lock); | ||
310 | |||
311 | /* Tell the I2C layer a new client has arrived */ | ||
312 | if ((err = i2c_attach_client(client))) | ||
313 | goto exit_free; | ||
314 | |||
315 | thmc50_init_client(client); | ||
316 | |||
317 | /* Register sysfs hooks */ | ||
318 | if ((err = sysfs_create_group(&client->dev.kobj, &thmc50_group))) | ||
319 | goto exit_detach; | ||
320 | |||
321 | /* Register ADM1022 sysfs hooks */ | ||
322 | if (data->type == adm1022) | ||
323 | if ((err = sysfs_create_group(&client->dev.kobj, | ||
324 | &adm1022_group))) | ||
325 | goto exit_remove_sysfs_thmc50; | ||
326 | |||
327 | /* Register a new directory entry with module sensors */ | ||
328 | data->class_dev = hwmon_device_register(&client->dev); | ||
329 | if (IS_ERR(data->class_dev)) { | ||
330 | err = PTR_ERR(data->class_dev); | ||
331 | goto exit_remove_sysfs; | ||
332 | } | ||
333 | |||
334 | return 0; | ||
335 | |||
336 | exit_remove_sysfs: | ||
337 | if (data->type == adm1022) | ||
338 | sysfs_remove_group(&client->dev.kobj, &adm1022_group); | ||
339 | exit_remove_sysfs_thmc50: | ||
340 | sysfs_remove_group(&client->dev.kobj, &thmc50_group); | ||
341 | exit_detach: | ||
342 | i2c_detach_client(client); | ||
343 | exit_free: | ||
344 | kfree(data); | ||
345 | exit: | ||
346 | return err; | ||
347 | } | ||
348 | |||
349 | static int thmc50_attach_adapter(struct i2c_adapter *adapter) | ||
350 | { | ||
351 | if (!(adapter->class & I2C_CLASS_HWMON)) | ||
352 | return 0; | ||
353 | return i2c_probe(adapter, &addr_data, thmc50_detect); | ||
354 | } | ||
355 | |||
356 | static int thmc50_detach_client(struct i2c_client *client) | ||
357 | { | ||
358 | struct thmc50_data *data = i2c_get_clientdata(client); | ||
359 | int err; | ||
360 | |||
361 | hwmon_device_unregister(data->class_dev); | ||
362 | sysfs_remove_group(&client->dev.kobj, &thmc50_group); | ||
363 | if (data->type == adm1022) | ||
364 | sysfs_remove_group(&client->dev.kobj, &adm1022_group); | ||
365 | |||
366 | if ((err = i2c_detach_client(client))) | ||
367 | return err; | ||
368 | |||
369 | kfree(data); | ||
370 | |||
371 | return 0; | ||
372 | } | ||
373 | |||
374 | static void thmc50_init_client(struct i2c_client *client) | ||
375 | { | ||
376 | struct thmc50_data *data = i2c_get_clientdata(client); | ||
377 | int config; | ||
378 | |||
379 | data->analog_out = i2c_smbus_read_byte_data(client, | ||
380 | THMC50_REG_ANALOG_OUT); | ||
381 | /* set up to at least 1 */ | ||
382 | if (data->analog_out == 0) { | ||
383 | data->analog_out = 1; | ||
384 | i2c_smbus_write_byte_data(client, THMC50_REG_ANALOG_OUT, | ||
385 | data->analog_out); | ||
386 | } | ||
387 | config = i2c_smbus_read_byte_data(client, THMC50_REG_CONF); | ||
388 | config |= 0x1; /* start the chip if it is in standby mode */ | ||
389 | if (data->has_temp3) | ||
390 | config |= 0x80; /* enable 2nd remote temp */ | ||
391 | i2c_smbus_write_byte_data(client, THMC50_REG_CONF, config); | ||
392 | } | ||
393 | |||
394 | static struct thmc50_data *thmc50_update_device(struct device *dev) | ||
395 | { | ||
396 | struct i2c_client *client = to_i2c_client(dev); | ||
397 | struct thmc50_data *data = i2c_get_clientdata(client); | ||
398 | int timeout = HZ / 5 + (data->type == thmc50 ? HZ : 0); | ||
399 | |||
400 | mutex_lock(&data->update_lock); | ||
401 | |||
402 | if (time_after(jiffies, data->last_updated + timeout) | ||
403 | || !data->valid) { | ||
404 | |||
405 | int temps = data->has_temp3 ? 3 : 2; | ||
406 | int i; | ||
407 | for (i = 0; i < temps; i++) { | ||
408 | data->temp_input[i] = i2c_smbus_read_byte_data(client, | ||
409 | THMC50_REG_TEMP[i]); | ||
410 | data->temp_max[i] = i2c_smbus_read_byte_data(client, | ||
411 | THMC50_REG_TEMP_MAX[i]); | ||
412 | data->temp_min[i] = i2c_smbus_read_byte_data(client, | ||
413 | THMC50_REG_TEMP_MIN[i]); | ||
414 | } | ||
415 | data->analog_out = | ||
416 | i2c_smbus_read_byte_data(client, THMC50_REG_ANALOG_OUT); | ||
417 | data->last_updated = jiffies; | ||
418 | data->valid = 1; | ||
419 | } | ||
420 | |||
421 | mutex_unlock(&data->update_lock); | ||
422 | |||
423 | return data; | ||
424 | } | ||
425 | |||
426 | static int __init sm_thmc50_init(void) | ||
427 | { | ||
428 | return i2c_add_driver(&thmc50_driver); | ||
429 | } | ||
430 | |||
431 | static void __exit sm_thmc50_exit(void) | ||
432 | { | ||
433 | i2c_del_driver(&thmc50_driver); | ||
434 | } | ||
435 | |||
436 | MODULE_AUTHOR("Krzysztof Helt <krzysztof.h1@wp.pl>"); | ||
437 | MODULE_DESCRIPTION("THMC50 driver"); | ||
438 | |||
439 | module_init(sm_thmc50_init); | ||
440 | module_exit(sm_thmc50_exit); | ||
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index 24a6851491d0..696c8a2e5374 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -314,7 +314,7 @@ struct via686a_data { | |||
314 | static struct pci_dev *s_bridge; /* pointer to the (only) via686a */ | 314 | static struct pci_dev *s_bridge; /* pointer to the (only) via686a */ |
315 | 315 | ||
316 | static int via686a_probe(struct platform_device *pdev); | 316 | static int via686a_probe(struct platform_device *pdev); |
317 | static int via686a_remove(struct platform_device *pdev); | 317 | static int __devexit via686a_remove(struct platform_device *pdev); |
318 | 318 | ||
319 | static inline int via686a_read_value(struct via686a_data *data, u8 reg) | 319 | static inline int via686a_read_value(struct via686a_data *data, u8 reg) |
320 | { | 320 | { |
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index c604972f0186..3e63eaf19041 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c | |||
@@ -167,7 +167,7 @@ struct vt8231_data { | |||
167 | 167 | ||
168 | static struct pci_dev *s_bridge; | 168 | static struct pci_dev *s_bridge; |
169 | static int vt8231_probe(struct platform_device *pdev); | 169 | static int vt8231_probe(struct platform_device *pdev); |
170 | static int vt8231_remove(struct platform_device *pdev); | 170 | static int __devexit vt8231_remove(struct platform_device *pdev); |
171 | static struct vt8231_data *vt8231_update_device(struct device *dev); | 171 | static struct vt8231_data *vt8231_update_device(struct device *dev); |
172 | static void vt8231_init_device(struct vt8231_data *data); | 172 | static void vt8231_init_device(struct vt8231_data *data); |
173 | 173 | ||
@@ -751,7 +751,7 @@ exit_release: | |||
751 | return err; | 751 | return err; |
752 | } | 752 | } |
753 | 753 | ||
754 | static int vt8231_remove(struct platform_device *pdev) | 754 | static int __devexit vt8231_remove(struct platform_device *pdev) |
755 | { | 755 | { |
756 | struct vt8231_data *data = platform_get_drvdata(pdev); | 756 | struct vt8231_data *data = platform_get_drvdata(pdev); |
757 | int i; | 757 | int i; |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 1ce78179b005..7a4a15f4bf8b 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -387,7 +387,7 @@ struct w83627hf_sio_data { | |||
387 | 387 | ||
388 | 388 | ||
389 | static int w83627hf_probe(struct platform_device *pdev); | 389 | static int w83627hf_probe(struct platform_device *pdev); |
390 | static int w83627hf_remove(struct platform_device *pdev); | 390 | static int __devexit w83627hf_remove(struct platform_device *pdev); |
391 | 391 | ||
392 | static int w83627hf_read_value(struct w83627hf_data *data, u16 reg); | 392 | static int w83627hf_read_value(struct w83627hf_data *data, u16 reg); |
393 | static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 value); | 393 | static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 value); |
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index c89b5f4b2d04..8a9b98fcb66d 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -693,13 +693,12 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
693 | if (ret) | 693 | if (ret) |
694 | goto out; | 694 | goto out; |
695 | 695 | ||
696 | state = kmalloc(sizeof(struct icside_state), GFP_KERNEL); | 696 | state = kzalloc(sizeof(struct icside_state), GFP_KERNEL); |
697 | if (!state) { | 697 | if (!state) { |
698 | ret = -ENOMEM; | 698 | ret = -ENOMEM; |
699 | goto release; | 699 | goto release; |
700 | } | 700 | } |
701 | 701 | ||
702 | memset(state, 0, sizeof(state)); | ||
703 | state->type = ICS_TYPE_NOTYPE; | 702 | state->type = ICS_TYPE_NOTYPE; |
704 | state->dev = &ec->dev; | 703 | state->dev = &ec->dev; |
705 | 704 | ||
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index e82bfa5e0ab8..1fa57947bca0 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -640,7 +640,7 @@ typedef enum { | |||
640 | } idetape_chrdev_direction_t; | 640 | } idetape_chrdev_direction_t; |
641 | 641 | ||
642 | struct idetape_bh { | 642 | struct idetape_bh { |
643 | unsigned short b_size; | 643 | u32 b_size; |
644 | atomic_t b_count; | 644 | atomic_t b_count; |
645 | struct idetape_bh *b_reqnext; | 645 | struct idetape_bh *b_reqnext; |
646 | char *b_data; | 646 | char *b_data; |
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 5511c86733dc..025689de50e9 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -593,7 +593,7 @@ static struct dmi_system_id cable_dmi_table[] = { | |||
593 | .ident = "HP Pavilion N5430", | 593 | .ident = "HP Pavilion N5430", |
594 | .matches = { | 594 | .matches = { |
595 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 595 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
596 | DMI_MATCH(DMI_BOARD_NAME, "OmniBook N32N-736"), | 596 | DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"), |
597 | }, | 597 | }, |
598 | }, | 598 | }, |
599 | { } | 599 | { } |
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 19633c5aba15..0e3b5de26e69 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
@@ -475,11 +475,11 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha | |||
475 | switch (rev) { | 475 | switch (rev) { |
476 | case 0x07: | 476 | case 0x07: |
477 | case 0x05: | 477 | case 0x05: |
478 | printk("%s: UltraDMA capable", name); | 478 | printk("%s: UltraDMA capable\n", name); |
479 | break; | 479 | break; |
480 | case 0x03: | 480 | case 0x03: |
481 | default: | 481 | default: |
482 | printk("%s: MultiWord DMA force limited", name); | 482 | printk("%s: MultiWord DMA force limited\n", name); |
483 | break; | 483 | break; |
484 | case 0x01: | 484 | case 0x01: |
485 | printk("%s: MultiWord DMA limited, " | 485 | printk("%s: MultiWord DMA limited, " |
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index bccedf9b8b28..b89e81656875 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c | |||
@@ -133,7 +133,7 @@ static void cs5520_tune_drive(ide_drive_t *drive, u8 pio) | |||
133 | static int cs5520_config_drive_xfer_rate(ide_drive_t *drive) | 133 | static int cs5520_config_drive_xfer_rate(ide_drive_t *drive) |
134 | { | 134 | { |
135 | /* Tune the drive for PIO modes up to PIO 4 */ | 135 | /* Tune the drive for PIO modes up to PIO 4 */ |
136 | cs5520_tune_drive(drive, 4); | 136 | cs5520_tune_drive(drive, 255); |
137 | 137 | ||
138 | /* Then tell the core to use DMA operations */ | 138 | /* Then tell the core to use DMA operations */ |
139 | return 0; | 139 | return 0; |
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index ce44e38390aa..082ca7da2cbc 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * linux/drivers/ide/pci/cs5535.c | 2 | * linux/drivers/ide/pci/cs5535.c |
3 | * | 3 | * |
4 | * Copyright (C) 2004-2005 Advanced Micro Devices, Inc. | 4 | * Copyright (C) 2004-2005 Advanced Micro Devices, Inc. |
5 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz | ||
5 | * | 6 | * |
6 | * History: | 7 | * History: |
7 | * 09/20/2005 - Jaya Kumar <jayakumar.ide@gmail.com> | 8 | * 09/20/2005 - Jaya Kumar <jayakumar.ide@gmail.com> |
@@ -83,14 +84,17 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed) | |||
83 | 84 | ||
84 | /* Set the PIO timings */ | 85 | /* Set the PIO timings */ |
85 | if ((speed & XFER_MODE) == XFER_PIO) { | 86 | if ((speed & XFER_MODE) == XFER_PIO) { |
86 | u8 pioa; | 87 | ide_drive_t *pair = &drive->hwif->drives[drive->dn ^ 1]; |
87 | u8 piob; | 88 | u8 cmd, pioa; |
88 | u8 cmd; | ||
89 | 89 | ||
90 | pioa = speed - XFER_PIO_0; | 90 | cmd = pioa = speed - XFER_PIO_0; |
91 | piob = ide_get_best_pio_mode(&(drive->hwif->drives[!unit]), | 91 | |
92 | 255, 4); | 92 | if (pair->present) { |
93 | cmd = pioa < piob ? pioa : piob; | 93 | u8 piob = ide_get_best_pio_mode(pair, 255, 4); |
94 | |||
95 | if (piob < cmd) | ||
96 | cmd = piob; | ||
97 | } | ||
94 | 98 | ||
95 | /* Write the speed of the current drive */ | 99 | /* Write the speed of the current drive */ |
96 | reg = (cs5535_pio_cmd_timings[cmd] << 16) | | 100 | reg = (cs5535_pio_cmd_timings[cmd] << 16) | |
@@ -116,7 +120,7 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed) | |||
116 | 120 | ||
117 | reg &= 0x80000000UL; /* Preserve the PIO format bit */ | 121 | reg &= 0x80000000UL; /* Preserve the PIO format bit */ |
118 | 122 | ||
119 | if (speed >= XFER_UDMA_0 && speed <= XFER_UDMA_7) | 123 | if (speed >= XFER_UDMA_0 && speed <= XFER_UDMA_4) |
120 | reg |= cs5535_udma_timings[speed - XFER_UDMA_0]; | 124 | reg |= cs5535_udma_timings[speed - XFER_UDMA_0]; |
121 | else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) | 125 | else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) |
122 | reg |= cs5535_mwdma_timings[speed - XFER_MW_DMA_0]; | 126 | reg |= cs5535_mwdma_timings[speed - XFER_MW_DMA_0]; |
@@ -151,32 +155,22 @@ static int cs5535_set_drive(ide_drive_t *drive, u8 speed) | |||
151 | * | 155 | * |
152 | * A callback from the upper layers for PIO-only tuning. | 156 | * A callback from the upper layers for PIO-only tuning. |
153 | */ | 157 | */ |
154 | static void cs5535_tuneproc(ide_drive_t *drive, u8 xferspeed) | 158 | static void cs5535_tuneproc(ide_drive_t *drive, u8 pio) |
155 | { | 159 | { |
156 | u8 modes[] = { XFER_PIO_0, XFER_PIO_1, XFER_PIO_2, XFER_PIO_3, | 160 | pio = ide_get_best_pio_mode(drive, pio, 4); |
157 | XFER_PIO_4 }; | 161 | ide_config_drive_speed(drive, XFER_PIO_0 + pio); |
158 | 162 | cs5535_set_speed(drive, XFER_PIO_0 + pio); | |
159 | /* cs5535 max pio is pio 4, best_pio will check the blacklist. | ||
160 | i think we don't need to rate_filter the incoming xferspeed | ||
161 | since we know we're only going to choose pio */ | ||
162 | xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4); | ||
163 | ide_config_drive_speed(drive, modes[xferspeed]); | ||
164 | cs5535_set_speed(drive, xferspeed); | ||
165 | } | 163 | } |
166 | 164 | ||
167 | static int cs5535_dma_check(ide_drive_t *drive) | 165 | static int cs5535_dma_check(ide_drive_t *drive) |
168 | { | 166 | { |
169 | u8 speed; | ||
170 | |||
171 | drive->init_speed = 0; | 167 | drive->init_speed = 0; |
172 | 168 | ||
173 | if (ide_tune_dma(drive)) | 169 | if (ide_tune_dma(drive)) |
174 | return 0; | 170 | return 0; |
175 | 171 | ||
176 | if (ide_use_fast_pio(drive)) { | 172 | if (ide_use_fast_pio(drive)) |
177 | speed = ide_get_best_pio_mode(drive, 255, 4); | 173 | cs5535_tuneproc(drive, 255); |
178 | cs5535_set_drive(drive, speed); | ||
179 | } | ||
180 | 174 | ||
181 | return -1; | 175 | return -1; |
182 | } | 176 | } |
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index 95dbed7e6022..70b3245dbf62 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * it8213_dma_2_pio - return the PIO mode matching DMA | 21 | * it8213_dma_2_pio - return the PIO mode matching DMA |
22 | * @xfer_rate: transfer speed | 22 | * @xfer_rate: transfer speed |
23 | * | 23 | * |
24 | * Returns the nearest equivalent PIO timing for the PIO or DMA | 24 | * Returns the nearest equivalent PIO timing for the DMA |
25 | * mode requested by the controller. | 25 | * mode requested by the controller. |
26 | */ | 26 | */ |
27 | 27 | ||
@@ -35,34 +35,28 @@ static u8 it8213_dma_2_pio (u8 xfer_rate) { | |||
35 | case XFER_UDMA_1: | 35 | case XFER_UDMA_1: |
36 | case XFER_UDMA_0: | 36 | case XFER_UDMA_0: |
37 | case XFER_MW_DMA_2: | 37 | case XFER_MW_DMA_2: |
38 | case XFER_PIO_4: | ||
39 | return 4; | 38 | return 4; |
40 | case XFER_MW_DMA_1: | 39 | case XFER_MW_DMA_1: |
41 | case XFER_PIO_3: | ||
42 | return 3; | 40 | return 3; |
43 | case XFER_SW_DMA_2: | 41 | case XFER_SW_DMA_2: |
44 | case XFER_PIO_2: | ||
45 | return 2; | 42 | return 2; |
46 | case XFER_MW_DMA_0: | 43 | case XFER_MW_DMA_0: |
47 | case XFER_SW_DMA_1: | 44 | case XFER_SW_DMA_1: |
48 | case XFER_SW_DMA_0: | 45 | case XFER_SW_DMA_0: |
49 | case XFER_PIO_1: | ||
50 | case XFER_PIO_0: | ||
51 | case XFER_PIO_SLOW: | ||
52 | default: | 46 | default: |
53 | return 0; | 47 | return 0; |
54 | } | 48 | } |
55 | } | 49 | } |
56 | 50 | ||
57 | /* | 51 | /* |
58 | * it8213_tuneproc - tune a drive | 52 | * it8213_tune_pio - tune a drive |
59 | * @drive: drive to tune | 53 | * @drive: drive to tune |
60 | * @pio: desired PIO mode | 54 | * @pio: desired PIO mode |
61 | * | 55 | * |
62 | * Set the interface PIO mode. | 56 | * Set the interface PIO mode. |
63 | */ | 57 | */ |
64 | 58 | ||
65 | static void it8213_tuneproc (ide_drive_t *drive, u8 pio) | 59 | static void it8213_tune_pio(ide_drive_t *drive, const u8 pio) |
66 | { | 60 | { |
67 | ide_hwif_t *hwif = HWIF(drive); | 61 | ide_hwif_t *hwif = HWIF(drive); |
68 | struct pci_dev *dev = hwif->pci_dev; | 62 | struct pci_dev *dev = hwif->pci_dev; |
@@ -82,8 +76,6 @@ static void it8213_tuneproc (ide_drive_t *drive, u8 pio) | |||
82 | { 2, 1 }, | 76 | { 2, 1 }, |
83 | { 2, 3 }, }; | 77 | { 2, 3 }, }; |
84 | 78 | ||
85 | pio = ide_get_best_pio_mode(drive, pio, 4); | ||
86 | |||
87 | spin_lock_irqsave(&tune_lock, flags); | 79 | spin_lock_irqsave(&tune_lock, flags); |
88 | pci_read_config_word(dev, master_port, &master_data); | 80 | pci_read_config_word(dev, master_port, &master_data); |
89 | 81 | ||
@@ -113,6 +105,13 @@ static void it8213_tuneproc (ide_drive_t *drive, u8 pio) | |||
113 | spin_unlock_irqrestore(&tune_lock, flags); | 105 | spin_unlock_irqrestore(&tune_lock, flags); |
114 | } | 106 | } |
115 | 107 | ||
108 | static void it8213_tuneproc(ide_drive_t *drive, u8 pio) | ||
109 | { | ||
110 | pio = ide_get_best_pio_mode(drive, pio, 4); | ||
111 | it8213_tune_pio(drive, pio); | ||
112 | ide_config_drive_speed(drive, XFER_PIO_0 + pio); | ||
113 | } | ||
114 | |||
116 | /** | 115 | /** |
117 | * it8213_tune_chipset - set controller timings | 116 | * it8213_tune_chipset - set controller timings |
118 | * @drive: Drive to set up | 117 | * @drive: Drive to set up |
@@ -193,7 +192,12 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
193 | if (reg55 & w_flag) | 192 | if (reg55 & w_flag) |
194 | pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); | 193 | pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); |
195 | } | 194 | } |
196 | it8213_tuneproc(drive, it8213_dma_2_pio(speed)); | 195 | |
196 | if (speed > XFER_PIO_4) | ||
197 | it8213_tune_pio(drive, it8213_dma_2_pio(speed)); | ||
198 | else | ||
199 | it8213_tune_pio(drive, speed - XFER_PIO_0); | ||
200 | |||
197 | return ide_config_drive_speed(drive, speed); | 201 | return ide_config_drive_speed(drive, speed); |
198 | } | 202 | } |
199 | 203 | ||
@@ -209,13 +213,10 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
209 | 213 | ||
210 | static int it8213_config_drive_for_dma (ide_drive_t *drive) | 214 | static int it8213_config_drive_for_dma (ide_drive_t *drive) |
211 | { | 215 | { |
212 | u8 pio; | ||
213 | |||
214 | if (ide_tune_dma(drive)) | 216 | if (ide_tune_dma(drive)) |
215 | return 0; | 217 | return 0; |
216 | 218 | ||
217 | pio = ide_get_best_pio_mode(drive, 255, 4); | 219 | it8213_tuneproc(drive, 255); |
218 | it8213_tune_chipset(drive, XFER_PIO_0 + pio); | ||
219 | 220 | ||
220 | return -1; | 221 | return -1; |
221 | } | 222 | } |
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index d7ce9dd8de16..65a0ff352b98 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c | |||
@@ -83,23 +83,10 @@ static u8 __devinit ata66_jmicron(ide_hwif_t *hwif) | |||
83 | return ATA_CBL_PATA80; | 83 | return ATA_CBL_PATA80; |
84 | } | 84 | } |
85 | 85 | ||
86 | static void jmicron_tuneproc (ide_drive_t *drive, byte mode_wanted) | 86 | static void jmicron_tuneproc(ide_drive_t *drive, u8 pio) |
87 | { | 87 | { |
88 | return; | 88 | pio = ide_get_best_pio_mode(drive, pio, 5); |
89 | } | 89 | ide_config_drive_speed(drive, XFER_PIO_0 + pio); |
90 | |||
91 | /** | ||
92 | * config_jmicron_chipset_for_pio - set drive timings | ||
93 | * @drive: drive to tune | ||
94 | * @speed we want | ||
95 | * | ||
96 | */ | ||
97 | |||
98 | static void config_jmicron_chipset_for_pio (ide_drive_t *drive, byte set_speed) | ||
99 | { | ||
100 | u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5); | ||
101 | if (set_speed) | ||
102 | (void) ide_config_drive_speed(drive, speed); | ||
103 | } | 90 | } |
104 | 91 | ||
105 | /** | 92 | /** |
@@ -132,7 +119,7 @@ static int jmicron_config_drive_for_dma (ide_drive_t *drive) | |||
132 | if (ide_tune_dma(drive)) | 119 | if (ide_tune_dma(drive)) |
133 | return 0; | 120 | return 0; |
134 | 121 | ||
135 | config_jmicron_chipset_for_pio(drive, 1); | 122 | jmicron_tuneproc(drive, 255); |
136 | 123 | ||
137 | return -1; | 124 | return -1; |
138 | } | 125 | } |
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 4f69cd067e5e..5cfa9378bbb8 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/piix.c Version 0.50 Jun 10, 2007 | 2 | * linux/drivers/ide/pci/piix.c Version 0.51 Jul 6, 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer | 4 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer |
5 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> | 5 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> |
@@ -109,7 +109,7 @@ static int no_piix_dma; | |||
109 | * piix_dma_2_pio - return the PIO mode matching DMA | 109 | * piix_dma_2_pio - return the PIO mode matching DMA |
110 | * @xfer_rate: transfer speed | 110 | * @xfer_rate: transfer speed |
111 | * | 111 | * |
112 | * Returns the nearest equivalent PIO timing for the PIO or DMA | 112 | * Returns the nearest equivalent PIO timing for the DMA |
113 | * mode requested by the controller. | 113 | * mode requested by the controller. |
114 | */ | 114 | */ |
115 | 115 | ||
@@ -123,20 +123,14 @@ static u8 piix_dma_2_pio (u8 xfer_rate) { | |||
123 | case XFER_UDMA_1: | 123 | case XFER_UDMA_1: |
124 | case XFER_UDMA_0: | 124 | case XFER_UDMA_0: |
125 | case XFER_MW_DMA_2: | 125 | case XFER_MW_DMA_2: |
126 | case XFER_PIO_4: | ||
127 | return 4; | 126 | return 4; |
128 | case XFER_MW_DMA_1: | 127 | case XFER_MW_DMA_1: |
129 | case XFER_PIO_3: | ||
130 | return 3; | 128 | return 3; |
131 | case XFER_SW_DMA_2: | 129 | case XFER_SW_DMA_2: |
132 | case XFER_PIO_2: | ||
133 | return 2; | 130 | return 2; |
134 | case XFER_MW_DMA_0: | 131 | case XFER_MW_DMA_0: |
135 | case XFER_SW_DMA_1: | 132 | case XFER_SW_DMA_1: |
136 | case XFER_SW_DMA_0: | 133 | case XFER_SW_DMA_0: |
137 | case XFER_PIO_1: | ||
138 | case XFER_PIO_0: | ||
139 | case XFER_PIO_SLOW: | ||
140 | default: | 134 | default: |
141 | return 0; | 135 | return 0; |
142 | } | 136 | } |
@@ -269,6 +263,7 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
269 | case XFER_PIO_4: | 263 | case XFER_PIO_4: |
270 | case XFER_PIO_3: | 264 | case XFER_PIO_3: |
271 | case XFER_PIO_2: | 265 | case XFER_PIO_2: |
266 | case XFER_PIO_1: | ||
272 | case XFER_PIO_0: break; | 267 | case XFER_PIO_0: break; |
273 | default: return -1; | 268 | default: return -1; |
274 | } | 269 | } |
@@ -299,7 +294,11 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
299 | pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); | 294 | pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); |
300 | } | 295 | } |
301 | 296 | ||
302 | piix_tune_pio(drive, piix_dma_2_pio(speed)); | 297 | if (speed > XFER_PIO_4) |
298 | piix_tune_pio(drive, piix_dma_2_pio(speed)); | ||
299 | else | ||
300 | piix_tune_pio(drive, speed - XFER_PIO_0); | ||
301 | |||
303 | return ide_config_drive_speed(drive, speed); | 302 | return ide_config_drive_speed(drive, speed); |
304 | } | 303 | } |
305 | 304 | ||
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index bf19ddfa6cda..eeb0a6d434aa 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -190,7 +190,7 @@ scc_ide_outsl(unsigned long port, void *addr, u32 count) | |||
190 | } | 190 | } |
191 | 191 | ||
192 | /** | 192 | /** |
193 | * scc_tuneproc - tune a drive PIO mode | 193 | * scc_tune_pio - tune a drive PIO mode |
194 | * @drive: drive to tune | 194 | * @drive: drive to tune |
195 | * @mode_wanted: the target operating mode | 195 | * @mode_wanted: the target operating mode |
196 | * | 196 | * |
@@ -198,7 +198,7 @@ scc_ide_outsl(unsigned long port, void *addr, u32 count) | |||
198 | * controller. | 198 | * controller. |
199 | */ | 199 | */ |
200 | 200 | ||
201 | static void scc_tuneproc(ide_drive_t *drive, byte mode_wanted) | 201 | static void scc_tune_pio(ide_drive_t *drive, const u8 pio) |
202 | { | 202 | { |
203 | ide_hwif_t *hwif = HWIF(drive); | 203 | ide_hwif_t *hwif = HWIF(drive); |
204 | struct scc_ports *ports = ide_get_hwifdata(hwif); | 204 | struct scc_ports *ports = ide_get_hwifdata(hwif); |
@@ -207,41 +207,25 @@ static void scc_tuneproc(ide_drive_t *drive, byte mode_wanted) | |||
207 | unsigned long piosht_port = ctl_base + 0x000; | 207 | unsigned long piosht_port = ctl_base + 0x000; |
208 | unsigned long pioct_port = ctl_base + 0x004; | 208 | unsigned long pioct_port = ctl_base + 0x004; |
209 | unsigned long reg; | 209 | unsigned long reg; |
210 | unsigned char speed = XFER_PIO_0; | ||
211 | int offset; | 210 | int offset; |
212 | 211 | ||
213 | mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 4); | ||
214 | switch (mode_wanted) { | ||
215 | case 4: | ||
216 | speed = XFER_PIO_4; | ||
217 | break; | ||
218 | case 3: | ||
219 | speed = XFER_PIO_3; | ||
220 | break; | ||
221 | case 2: | ||
222 | speed = XFER_PIO_2; | ||
223 | break; | ||
224 | case 1: | ||
225 | speed = XFER_PIO_1; | ||
226 | break; | ||
227 | case 0: | ||
228 | default: | ||
229 | speed = XFER_PIO_0; | ||
230 | break; | ||
231 | } | ||
232 | |||
233 | reg = in_be32((void __iomem *)cckctrl_port); | 212 | reg = in_be32((void __iomem *)cckctrl_port); |
234 | if (reg & CCKCTRL_ATACLKOEN) { | 213 | if (reg & CCKCTRL_ATACLKOEN) { |
235 | offset = 1; /* 133MHz */ | 214 | offset = 1; /* 133MHz */ |
236 | } else { | 215 | } else { |
237 | offset = 0; /* 100MHz */ | 216 | offset = 0; /* 100MHz */ |
238 | } | 217 | } |
239 | reg = JCHSTtbl[offset][mode_wanted] << 16 | JCHHTtbl[offset][mode_wanted]; | 218 | reg = JCHSTtbl[offset][pio] << 16 | JCHHTtbl[offset][pio]; |
240 | out_be32((void __iomem *)piosht_port, reg); | 219 | out_be32((void __iomem *)piosht_port, reg); |
241 | reg = JCHCTtbl[offset][mode_wanted]; | 220 | reg = JCHCTtbl[offset][pio]; |
242 | out_be32((void __iomem *)pioct_port, reg); | 221 | out_be32((void __iomem *)pioct_port, reg); |
222 | } | ||
243 | 223 | ||
244 | ide_config_drive_speed(drive, speed); | 224 | static void scc_tuneproc(ide_drive_t *drive, u8 pio) |
225 | { | ||
226 | pio = ide_get_best_pio_mode(drive, pio, 4); | ||
227 | scc_tune_pio(drive, pio); | ||
228 | ide_config_drive_speed(drive, XFER_PIO_0 + pio); | ||
245 | } | 229 | } |
246 | 230 | ||
247 | /** | 231 | /** |
@@ -280,26 +264,21 @@ static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed) | |||
280 | 264 | ||
281 | switch (speed) { | 265 | switch (speed) { |
282 | case XFER_UDMA_6: | 266 | case XFER_UDMA_6: |
283 | idx = 6; | ||
284 | break; | ||
285 | case XFER_UDMA_5: | 267 | case XFER_UDMA_5: |
286 | idx = 5; | ||
287 | break; | ||
288 | case XFER_UDMA_4: | 268 | case XFER_UDMA_4: |
289 | idx = 4; | ||
290 | break; | ||
291 | case XFER_UDMA_3: | 269 | case XFER_UDMA_3: |
292 | idx = 3; | ||
293 | break; | ||
294 | case XFER_UDMA_2: | 270 | case XFER_UDMA_2: |
295 | idx = 2; | ||
296 | break; | ||
297 | case XFER_UDMA_1: | 271 | case XFER_UDMA_1: |
298 | idx = 1; | ||
299 | break; | ||
300 | case XFER_UDMA_0: | 272 | case XFER_UDMA_0: |
301 | idx = 0; | 273 | idx = speed - XFER_UDMA_0; |
302 | break; | 274 | break; |
275 | case XFER_PIO_4: | ||
276 | case XFER_PIO_3: | ||
277 | case XFER_PIO_2: | ||
278 | case XFER_PIO_1: | ||
279 | case XFER_PIO_0: | ||
280 | scc_tune_pio(drive, speed - XFER_PIO_0); | ||
281 | return ide_config_drive_speed(drive, speed); | ||
303 | default: | 282 | default: |
304 | return 1; | 283 | return 1; |
305 | } | 284 | } |
@@ -329,7 +308,7 @@ static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed) | |||
329 | * required. | 308 | * required. |
330 | * If the drive isn't suitable for DMA or we hit other problems | 309 | * If the drive isn't suitable for DMA or we hit other problems |
331 | * then we will drop down to PIO and set up PIO appropriately. | 310 | * then we will drop down to PIO and set up PIO appropriately. |
332 | * (return 1) | 311 | * (return -1) |
333 | */ | 312 | */ |
334 | 313 | ||
335 | static int scc_config_drive_for_dma(ide_drive_t *drive) | 314 | static int scc_config_drive_for_dma(ide_drive_t *drive) |
@@ -338,7 +317,7 @@ static int scc_config_drive_for_dma(ide_drive_t *drive) | |||
338 | return 0; | 317 | return 0; |
339 | 318 | ||
340 | if (ide_use_fast_pio(drive)) | 319 | if (ide_use_fast_pio(drive)) |
341 | scc_tuneproc(drive, 4); | 320 | scc_tuneproc(drive, 255); |
342 | 321 | ||
343 | return -1; | 322 | return -1; |
344 | } | 323 | } |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 63fbb79e8178..26f24802d3e8 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -801,6 +801,7 @@ struct sis_laptop { | |||
801 | static const struct sis_laptop sis_laptop[] = { | 801 | static const struct sis_laptop sis_laptop[] = { |
802 | /* devid, subvendor, subdev */ | 802 | /* devid, subvendor, subdev */ |
803 | { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ | 803 | { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ |
804 | { 0x5513, 0x1734, 0x105f }, /* FSC Amilo A1630 */ | ||
804 | /* end marker */ | 805 | /* end marker */ |
805 | { 0, } | 806 | { 0, } |
806 | }; | 807 | }; |
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index 8e655f2db5cb..628b0664f576 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/slc90e66.c Version 0.14 February 8, 2007 | 2 | * linux/drivers/ide/pci/slc90e66.c Version 0.15 Jul 6, 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> | 5 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> |
@@ -29,20 +29,14 @@ static u8 slc90e66_dma_2_pio (u8 xfer_rate) { | |||
29 | case XFER_UDMA_1: | 29 | case XFER_UDMA_1: |
30 | case XFER_UDMA_0: | 30 | case XFER_UDMA_0: |
31 | case XFER_MW_DMA_2: | 31 | case XFER_MW_DMA_2: |
32 | case XFER_PIO_4: | ||
33 | return 4; | 32 | return 4; |
34 | case XFER_MW_DMA_1: | 33 | case XFER_MW_DMA_1: |
35 | case XFER_PIO_3: | ||
36 | return 3; | 34 | return 3; |
37 | case XFER_SW_DMA_2: | 35 | case XFER_SW_DMA_2: |
38 | case XFER_PIO_2: | ||
39 | return 2; | 36 | return 2; |
40 | case XFER_MW_DMA_0: | 37 | case XFER_MW_DMA_0: |
41 | case XFER_SW_DMA_1: | 38 | case XFER_SW_DMA_1: |
42 | case XFER_SW_DMA_0: | 39 | case XFER_SW_DMA_0: |
43 | case XFER_PIO_1: | ||
44 | case XFER_PIO_0: | ||
45 | case XFER_PIO_SLOW: | ||
46 | default: | 40 | default: |
47 | return 0; | 41 | return 0; |
48 | } | 42 | } |
@@ -136,6 +130,7 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
136 | case XFER_PIO_4: | 130 | case XFER_PIO_4: |
137 | case XFER_PIO_3: | 131 | case XFER_PIO_3: |
138 | case XFER_PIO_2: | 132 | case XFER_PIO_2: |
133 | case XFER_PIO_1: | ||
139 | case XFER_PIO_0: break; | 134 | case XFER_PIO_0: break; |
140 | default: return -1; | 135 | default: return -1; |
141 | } | 136 | } |
@@ -156,7 +151,11 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
156 | pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); | 151 | pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); |
157 | } | 152 | } |
158 | 153 | ||
159 | slc90e66_tune_pio(drive, slc90e66_dma_2_pio(speed)); | 154 | if (speed > XFER_PIO_4) |
155 | slc90e66_tune_pio(drive, slc90e66_dma_2_pio(speed)); | ||
156 | else | ||
157 | slc90e66_tune_pio(drive, speed - XFER_PIO_0); | ||
158 | |||
160 | return ide_config_drive_speed(drive, speed); | 159 | return ide_config_drive_speed(drive, speed); |
161 | } | 160 | } |
162 | 161 | ||
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index ab4b2d9b5327..f1c3d6cebd58 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -186,7 +186,7 @@ struct input_event_compat { | |||
186 | #elif defined(CONFIG_S390) | 186 | #elif defined(CONFIG_S390) |
187 | # define COMPAT_TEST test_thread_flag(TIF_31BIT) | 187 | # define COMPAT_TEST test_thread_flag(TIF_31BIT) |
188 | #elif defined(CONFIG_MIPS) | 188 | #elif defined(CONFIG_MIPS) |
189 | # define COMPAT_TEST (current->thread.mflags & MF_32BIT_ADDR) | 189 | # define COMPAT_TEST test_thread_flag(TIF_32BIT_ADDR) |
190 | #else | 190 | #else |
191 | # define COMPAT_TEST test_thread_flag(TIF_32BIT) | 191 | # define COMPAT_TEST test_thread_flag(TIF_32BIT) |
192 | #endif | 192 | #endif |
diff --git a/drivers/mtd/devices/docprobe.c b/drivers/mtd/devices/docprobe.c index b96ac8e119dc..54aa75907640 100644 --- a/drivers/mtd/devices/docprobe.c +++ b/drivers/mtd/devices/docprobe.c | |||
@@ -81,9 +81,6 @@ static unsigned long __initdata doc_locations[] = { | |||
81 | #endif /* CONFIG_MTD_DOCPROBE_HIGH */ | 81 | #endif /* CONFIG_MTD_DOCPROBE_HIGH */ |
82 | #elif defined(__PPC__) | 82 | #elif defined(__PPC__) |
83 | 0xe4000000, | 83 | 0xe4000000, |
84 | #elif defined(CONFIG_MOMENCO_OCELOT) | ||
85 | 0x2f000000, | ||
86 | 0xff000000, | ||
87 | #elif defined(CONFIG_MOMENCO_OCELOT_G) | 84 | #elif defined(CONFIG_MOMENCO_OCELOT_G) |
88 | 0xff000000, | 85 | 0xff000000, |
89 | ##else | 86 | ##else |
diff --git a/drivers/mtd/nand/at91_nand.c b/drivers/mtd/nand/at91_nand.c index 512e999177f7..b2a5672df6e0 100644 --- a/drivers/mtd/nand/at91_nand.c +++ b/drivers/mtd/nand/at91_nand.c | |||
@@ -128,7 +128,10 @@ static int __init at91_nand_probe(struct platform_device *pdev) | |||
128 | nand_chip->IO_ADDR_R = host->io_base; | 128 | nand_chip->IO_ADDR_R = host->io_base; |
129 | nand_chip->IO_ADDR_W = host->io_base; | 129 | nand_chip->IO_ADDR_W = host->io_base; |
130 | nand_chip->cmd_ctrl = at91_nand_cmd_ctrl; | 130 | nand_chip->cmd_ctrl = at91_nand_cmd_ctrl; |
131 | nand_chip->dev_ready = at91_nand_device_ready; | 131 | |
132 | if (host->board->rdy_pin) | ||
133 | nand_chip->dev_ready = at91_nand_device_ready; | ||
134 | |||
132 | nand_chip->ecc.mode = NAND_ECC_SOFT; /* enable ECC */ | 135 | nand_chip->ecc.mode = NAND_ECC_SOFT; /* enable ECC */ |
133 | nand_chip->chip_delay = 20; /* 20us command delay time */ | 136 | nand_chip->chip_delay = 20; /* 20us command delay time */ |
134 | 137 | ||
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c index 17c868034aad..e96259f22cca 100644 --- a/drivers/mtd/nand/diskonchip.c +++ b/drivers/mtd/nand/diskonchip.c | |||
@@ -56,9 +56,6 @@ static unsigned long __initdata doc_locations[] = { | |||
56 | #endif /* CONFIG_MTD_DOCPROBE_HIGH */ | 56 | #endif /* CONFIG_MTD_DOCPROBE_HIGH */ |
57 | #elif defined(__PPC__) | 57 | #elif defined(__PPC__) |
58 | 0xe4000000, | 58 | 0xe4000000, |
59 | #elif defined(CONFIG_MOMENCO_OCELOT) | ||
60 | 0x2f000000, | ||
61 | 0xff000000, | ||
62 | #elif defined(CONFIG_MOMENCO_OCELOT_G) | 59 | #elif defined(CONFIG_MOMENCO_OCELOT_G) |
63 | 0xff000000, | 60 | 0xff000000, |
64 | #else | 61 | #else |
diff --git a/drivers/mtd/nand/edb7312.c b/drivers/mtd/nand/edb7312.c index 1daf8231aaef..0146cdc48039 100644 --- a/drivers/mtd/nand/edb7312.c +++ b/drivers/mtd/nand/edb7312.c | |||
@@ -74,7 +74,7 @@ static struct mtd_partition partition_info[] = { | |||
74 | /* | 74 | /* |
75 | * hardware specific access to control-lines | 75 | * hardware specific access to control-lines |
76 | * | 76 | * |
77 | * NAND_NCE: bit 0 -> bit 7 | 77 | * NAND_NCE: bit 0 -> bit 6 (bit 7 = 1) |
78 | * NAND_CLE: bit 1 -> bit 4 | 78 | * NAND_CLE: bit 1 -> bit 4 |
79 | * NAND_ALE: bit 2 -> bit 5 | 79 | * NAND_ALE: bit 2 -> bit 5 |
80 | */ | 80 | */ |
@@ -83,12 +83,12 @@ static void ep7312_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) | |||
83 | struct nand_chip *chip = mtd->priv; | 83 | struct nand_chip *chip = mtd->priv; |
84 | 84 | ||
85 | if (ctrl & NAND_CTRL_CHANGE) { | 85 | if (ctrl & NAND_CTRL_CHANGE) { |
86 | unsigned char bits; | 86 | unsigned char bits = 0x80; |
87 | 87 | ||
88 | bits = (ctrl & (NAND_CLE | NAND_ALE)) << 3; | 88 | bits |= (ctrl & (NAND_CLE | NAND_ALE)) << 3; |
89 | bits = (ctrl & NAND_NCE) << 7; | 89 | bits |= (ctrl & NAND_NCE) ? 0x00 : 0x40; |
90 | 90 | ||
91 | clps_writeb((clps_readb(ep7312_pxdr) & 0xB0) | 0x10, | 91 | clps_writeb((clps_readb(ep7312_pxdr) & 0xF0) | bits, |
92 | ep7312_pxdr); | 92 | ep7312_pxdr); |
93 | } | 93 | } |
94 | if (cmd != NAND_CMD_NONE) | 94 | if (cmd != NAND_CMD_NONE) |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 7e68203fe1ba..24ac6778b1a8 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -24,6 +24,7 @@ | |||
24 | * if we have HW ecc support. | 24 | * if we have HW ecc support. |
25 | * The AG-AND chips have nice features for speed improvement, | 25 | * The AG-AND chips have nice features for speed improvement, |
26 | * which are not supported yet. Read / program 4 pages in one go. | 26 | * which are not supported yet. Read / program 4 pages in one go. |
27 | * BBT table is not serialized, has to be fixed | ||
27 | * | 28 | * |
28 | * This program is free software; you can redistribute it and/or modify | 29 | * This program is free software; you can redistribute it and/or modify |
29 | * it under the terms of the GNU General Public License version 2 as | 30 | * it under the terms of the GNU General Public License version 2 as |
@@ -360,6 +361,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) | |||
360 | /* We write two bytes, so we dont have to mess with 16 bit | 361 | /* We write two bytes, so we dont have to mess with 16 bit |
361 | * access | 362 | * access |
362 | */ | 363 | */ |
364 | nand_get_device(chip, mtd, FL_WRITING); | ||
363 | ofs += mtd->oobsize; | 365 | ofs += mtd->oobsize; |
364 | chip->ops.len = chip->ops.ooblen = 2; | 366 | chip->ops.len = chip->ops.ooblen = 2; |
365 | chip->ops.datbuf = NULL; | 367 | chip->ops.datbuf = NULL; |
@@ -367,9 +369,11 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) | |||
367 | chip->ops.ooboffs = chip->badblockpos & ~0x01; | 369 | chip->ops.ooboffs = chip->badblockpos & ~0x01; |
368 | 370 | ||
369 | ret = nand_do_write_oob(mtd, ofs, &chip->ops); | 371 | ret = nand_do_write_oob(mtd, ofs, &chip->ops); |
372 | nand_release_device(mtd); | ||
370 | } | 373 | } |
371 | if (!ret) | 374 | if (!ret) |
372 | mtd->ecc_stats.badblocks++; | 375 | mtd->ecc_stats.badblocks++; |
376 | |||
373 | return ret; | 377 | return ret; |
374 | } | 378 | } |
375 | 379 | ||
@@ -768,7 +772,7 @@ static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, | |||
768 | uint8_t *p = buf; | 772 | uint8_t *p = buf; |
769 | uint8_t *ecc_calc = chip->buffers->ecccalc; | 773 | uint8_t *ecc_calc = chip->buffers->ecccalc; |
770 | uint8_t *ecc_code = chip->buffers->ecccode; | 774 | uint8_t *ecc_code = chip->buffers->ecccode; |
771 | int *eccpos = chip->ecc.layout->eccpos; | 775 | uint32_t *eccpos = chip->ecc.layout->eccpos; |
772 | 776 | ||
773 | chip->ecc.read_page_raw(mtd, chip, buf); | 777 | chip->ecc.read_page_raw(mtd, chip, buf); |
774 | 778 | ||
@@ -810,7 +814,7 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, | |||
810 | uint8_t *p = buf; | 814 | uint8_t *p = buf; |
811 | uint8_t *ecc_calc = chip->buffers->ecccalc; | 815 | uint8_t *ecc_calc = chip->buffers->ecccalc; |
812 | uint8_t *ecc_code = chip->buffers->ecccode; | 816 | uint8_t *ecc_code = chip->buffers->ecccode; |
813 | int *eccpos = chip->ecc.layout->eccpos; | 817 | uint32_t *eccpos = chip->ecc.layout->eccpos; |
814 | 818 | ||
815 | for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { | 819 | for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { |
816 | chip->ecc.hwctl(mtd, NAND_ECC_READ); | 820 | chip->ecc.hwctl(mtd, NAND_ECC_READ); |
@@ -1416,7 +1420,7 @@ static void nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, | |||
1416 | int eccsteps = chip->ecc.steps; | 1420 | int eccsteps = chip->ecc.steps; |
1417 | uint8_t *ecc_calc = chip->buffers->ecccalc; | 1421 | uint8_t *ecc_calc = chip->buffers->ecccalc; |
1418 | const uint8_t *p = buf; | 1422 | const uint8_t *p = buf; |
1419 | int *eccpos = chip->ecc.layout->eccpos; | 1423 | uint32_t *eccpos = chip->ecc.layout->eccpos; |
1420 | 1424 | ||
1421 | /* Software ecc calculation */ | 1425 | /* Software ecc calculation */ |
1422 | for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) | 1426 | for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) |
@@ -1442,7 +1446,7 @@ static void nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, | |||
1442 | int eccsteps = chip->ecc.steps; | 1446 | int eccsteps = chip->ecc.steps; |
1443 | uint8_t *ecc_calc = chip->buffers->ecccalc; | 1447 | uint8_t *ecc_calc = chip->buffers->ecccalc; |
1444 | const uint8_t *p = buf; | 1448 | const uint8_t *p = buf; |
1445 | int *eccpos = chip->ecc.layout->eccpos; | 1449 | uint32_t *eccpos = chip->ecc.layout->eccpos; |
1446 | 1450 | ||
1447 | for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { | 1451 | for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { |
1448 | chip->ecc.hwctl(mtd, NAND_ECC_WRITE); | 1452 | chip->ecc.hwctl(mtd, NAND_ECC_WRITE); |
diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c index d4b1ba8f23ef..006c03aacb55 100644 --- a/drivers/mtd/rfd_ftl.c +++ b/drivers/mtd/rfd_ftl.c | |||
@@ -779,6 +779,7 @@ static void rfd_ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
779 | else { | 779 | else { |
780 | if (!mtd->erasesize) { | 780 | if (!mtd->erasesize) { |
781 | printk(KERN_WARNING PREFIX "please provide block_size"); | 781 | printk(KERN_WARNING PREFIX "please provide block_size"); |
782 | kfree(part); | ||
782 | return; | 783 | return; |
783 | } | 784 | } |
784 | else | 785 | else |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 8e58ea3d95c0..004bc2487270 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -310,7 +310,7 @@ static int pci_default_resume(struct pci_dev *pci_dev) | |||
310 | /* restore the PCI config space */ | 310 | /* restore the PCI config space */ |
311 | pci_restore_state(pci_dev); | 311 | pci_restore_state(pci_dev); |
312 | /* if the device was enabled before suspend, reenable */ | 312 | /* if the device was enabled before suspend, reenable */ |
313 | retval = __pci_reenable_device(pci_dev); | 313 | retval = pci_reenable_device(pci_dev); |
314 | /* if the device was busmaster before the suspend, make it busmaster again */ | 314 | /* if the device was busmaster before the suspend, make it busmaster again */ |
315 | if (pci_dev->is_busmaster) | 315 | if (pci_dev->is_busmaster) |
316 | pci_set_master(pci_dev); | 316 | pci_set_master(pci_dev); |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 1ee9cd9c86e2..37c00f6fd801 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -695,14 +695,13 @@ static int do_pci_enable_device(struct pci_dev *dev, int bars) | |||
695 | } | 695 | } |
696 | 696 | ||
697 | /** | 697 | /** |
698 | * __pci_reenable_device - Resume abandoned device | 698 | * pci_reenable_device - Resume abandoned device |
699 | * @dev: PCI device to be resumed | 699 | * @dev: PCI device to be resumed |
700 | * | 700 | * |
701 | * Note this function is a backend of pci_default_resume and is not supposed | 701 | * Note this function is a backend of pci_default_resume and is not supposed |
702 | * to be called by normal code, write proper resume handler and use it instead. | 702 | * to be called by normal code, write proper resume handler and use it instead. |
703 | */ | 703 | */ |
704 | int | 704 | int pci_reenable_device(struct pci_dev *dev) |
705 | __pci_reenable_device(struct pci_dev *dev) | ||
706 | { | 705 | { |
707 | if (atomic_read(&dev->enable_cnt)) | 706 | if (atomic_read(&dev->enable_cnt)) |
708 | return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1); | 707 | return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1); |
@@ -1604,7 +1603,7 @@ early_param("pci", pci_setup); | |||
1604 | device_initcall(pci_init); | 1603 | device_initcall(pci_init); |
1605 | 1604 | ||
1606 | EXPORT_SYMBOL_GPL(pci_restore_bars); | 1605 | EXPORT_SYMBOL_GPL(pci_restore_bars); |
1607 | EXPORT_SYMBOL(__pci_reenable_device); | 1606 | EXPORT_SYMBOL(pci_reenable_device); |
1608 | EXPORT_SYMBOL(pci_enable_device_bars); | 1607 | EXPORT_SYMBOL(pci_enable_device_bars); |
1609 | EXPORT_SYMBOL(pci_enable_device); | 1608 | EXPORT_SYMBOL(pci_enable_device); |
1610 | EXPORT_SYMBOL(pcim_enable_device); | 1609 | EXPORT_SYMBOL(pcim_enable_device); |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index bb90df8bdce4..1cc01acc2808 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -328,17 +328,15 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co | |||
328 | u8 *buf; | 328 | u8 *buf; |
329 | 329 | ||
330 | /* stuff a sense request in front of our current request */ | 330 | /* stuff a sense request in front of our current request */ |
331 | pc = kmalloc (sizeof (idescsi_pc_t), GFP_ATOMIC); | 331 | pc = kzalloc(sizeof(idescsi_pc_t), GFP_ATOMIC); |
332 | rq = kmalloc (sizeof (struct request), GFP_ATOMIC); | 332 | rq = kmalloc(sizeof(struct request), GFP_ATOMIC); |
333 | buf = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC); | 333 | buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC); |
334 | if (pc == NULL || rq == NULL || buf == NULL) { | 334 | if (!pc || !rq || !buf) { |
335 | kfree(buf); | 335 | kfree(buf); |
336 | kfree(rq); | 336 | kfree(rq); |
337 | kfree(pc); | 337 | kfree(pc); |
338 | return -ENOMEM; | 338 | return -ENOMEM; |
339 | } | 339 | } |
340 | memset (pc, 0, sizeof (idescsi_pc_t)); | ||
341 | memset (buf, 0, SCSI_SENSE_BUFFERSIZE); | ||
342 | ide_init_drive_cmd(rq); | 340 | ide_init_drive_cmd(rq); |
343 | rq->special = (char *) pc; | 341 | rq->special = (char *) pc; |
344 | pc->rq = rq; | 342 | pc->rq = rq; |