diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/agp/parisc-agp.c | 4 | ||||
-rw-r--r-- | drivers/parisc/ccio-dma.c | 43 | ||||
-rw-r--r-- | drivers/rtc/Kconfig | 8 | ||||
-rw-r--r-- | drivers/rtc/Makefile | 1 | ||||
-rw-r--r-- | drivers/rtc/rtc-parisc.c | 111 |
5 files changed, 139 insertions, 28 deletions
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index f2492ecf0824..db60539bf67a 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c | |||
@@ -20,8 +20,8 @@ | |||
20 | #include <linux/agp_backend.h> | 20 | #include <linux/agp_backend.h> |
21 | #include <linux/log2.h> | 21 | #include <linux/log2.h> |
22 | 22 | ||
23 | #include <asm-parisc/parisc-device.h> | 23 | #include <asm/parisc-device.h> |
24 | #include <asm-parisc/ropes.h> | 24 | #include <asm/ropes.h> |
25 | 25 | ||
26 | #include "agp.h" | 26 | #include "agp.h" |
27 | 27 | ||
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index b30e38f3a50d..dcc1e9958d2f 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c | |||
@@ -66,15 +66,8 @@ | |||
66 | #undef DEBUG_CCIO_RUN_SG | 66 | #undef DEBUG_CCIO_RUN_SG |
67 | 67 | ||
68 | #ifdef CONFIG_PROC_FS | 68 | #ifdef CONFIG_PROC_FS |
69 | /* | 69 | /* depends on proc fs support. But costs CPU performance. */ |
70 | * CCIO_SEARCH_TIME can help measure how fast the bitmap search is. | 70 | #undef CCIO_COLLECT_STATS |
71 | * impacts performance though - ditch it if you don't use it. | ||
72 | */ | ||
73 | #define CCIO_SEARCH_TIME | ||
74 | #undef CCIO_MAP_STATS | ||
75 | #else | ||
76 | #undef CCIO_SEARCH_TIME | ||
77 | #undef CCIO_MAP_STATS | ||
78 | #endif | 71 | #endif |
79 | 72 | ||
80 | #include <linux/proc_fs.h> | 73 | #include <linux/proc_fs.h> |
@@ -239,12 +232,10 @@ struct ioc { | |||
239 | u32 res_size; /* size of resource map in bytes */ | 232 | u32 res_size; /* size of resource map in bytes */ |
240 | spinlock_t res_lock; | 233 | spinlock_t res_lock; |
241 | 234 | ||
242 | #ifdef CCIO_SEARCH_TIME | 235 | #ifdef CCIO_COLLECT_STATS |
243 | #define CCIO_SEARCH_SAMPLE 0x100 | 236 | #define CCIO_SEARCH_SAMPLE 0x100 |
244 | unsigned long avg_search[CCIO_SEARCH_SAMPLE]; | 237 | unsigned long avg_search[CCIO_SEARCH_SAMPLE]; |
245 | unsigned long avg_idx; /* current index into avg_search */ | 238 | unsigned long avg_idx; /* current index into avg_search */ |
246 | #endif | ||
247 | #ifdef CCIO_MAP_STATS | ||
248 | unsigned long used_pages; | 239 | unsigned long used_pages; |
249 | unsigned long msingle_calls; | 240 | unsigned long msingle_calls; |
250 | unsigned long msingle_pages; | 241 | unsigned long msingle_pages; |
@@ -351,7 +342,7 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size) | |||
351 | unsigned int pages_needed = size >> IOVP_SHIFT; | 342 | unsigned int pages_needed = size >> IOVP_SHIFT; |
352 | unsigned int res_idx; | 343 | unsigned int res_idx; |
353 | unsigned long boundary_size; | 344 | unsigned long boundary_size; |
354 | #ifdef CCIO_SEARCH_TIME | 345 | #ifdef CCIO_COLLECT_STATS |
355 | unsigned long cr_start = mfctl(16); | 346 | unsigned long cr_start = mfctl(16); |
356 | #endif | 347 | #endif |
357 | 348 | ||
@@ -406,7 +397,7 @@ resource_found: | |||
406 | DBG_RES("%s() res_idx %d res_hint: %d\n", | 397 | DBG_RES("%s() res_idx %d res_hint: %d\n", |
407 | __func__, res_idx, ioc->res_hint); | 398 | __func__, res_idx, ioc->res_hint); |
408 | 399 | ||
409 | #ifdef CCIO_SEARCH_TIME | 400 | #ifdef CCIO_COLLECT_STATS |
410 | { | 401 | { |
411 | unsigned long cr_end = mfctl(16); | 402 | unsigned long cr_end = mfctl(16); |
412 | unsigned long tmp = cr_end - cr_start; | 403 | unsigned long tmp = cr_end - cr_start; |
@@ -416,7 +407,7 @@ resource_found: | |||
416 | ioc->avg_search[ioc->avg_idx++] = cr_start; | 407 | ioc->avg_search[ioc->avg_idx++] = cr_start; |
417 | ioc->avg_idx &= CCIO_SEARCH_SAMPLE - 1; | 408 | ioc->avg_idx &= CCIO_SEARCH_SAMPLE - 1; |
418 | #endif | 409 | #endif |
419 | #ifdef CCIO_MAP_STATS | 410 | #ifdef CCIO_COLLECT_STATS |
420 | ioc->used_pages += pages_needed; | 411 | ioc->used_pages += pages_needed; |
421 | #endif | 412 | #endif |
422 | /* | 413 | /* |
@@ -452,7 +443,7 @@ ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped) | |||
452 | DBG_RES("%s(): res_idx: %d pages_mapped %d\n", | 443 | DBG_RES("%s(): res_idx: %d pages_mapped %d\n", |
453 | __func__, res_idx, pages_mapped); | 444 | __func__, res_idx, pages_mapped); |
454 | 445 | ||
455 | #ifdef CCIO_MAP_STATS | 446 | #ifdef CCIO_COLLECT_STATS |
456 | ioc->used_pages -= pages_mapped; | 447 | ioc->used_pages -= pages_mapped; |
457 | #endif | 448 | #endif |
458 | 449 | ||
@@ -764,7 +755,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size, | |||
764 | size = ALIGN(size + offset, IOVP_SIZE); | 755 | size = ALIGN(size + offset, IOVP_SIZE); |
765 | spin_lock_irqsave(&ioc->res_lock, flags); | 756 | spin_lock_irqsave(&ioc->res_lock, flags); |
766 | 757 | ||
767 | #ifdef CCIO_MAP_STATS | 758 | #ifdef CCIO_COLLECT_STATS |
768 | ioc->msingle_calls++; | 759 | ioc->msingle_calls++; |
769 | ioc->msingle_pages += size >> IOVP_SHIFT; | 760 | ioc->msingle_pages += size >> IOVP_SHIFT; |
770 | #endif | 761 | #endif |
@@ -828,7 +819,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, size_t size, | |||
828 | 819 | ||
829 | spin_lock_irqsave(&ioc->res_lock, flags); | 820 | spin_lock_irqsave(&ioc->res_lock, flags); |
830 | 821 | ||
831 | #ifdef CCIO_MAP_STATS | 822 | #ifdef CCIO_COLLECT_STATS |
832 | ioc->usingle_calls++; | 823 | ioc->usingle_calls++; |
833 | ioc->usingle_pages += size >> IOVP_SHIFT; | 824 | ioc->usingle_pages += size >> IOVP_SHIFT; |
834 | #endif | 825 | #endif |
@@ -894,7 +885,7 @@ ccio_free_consistent(struct device *dev, size_t size, void *cpu_addr, | |||
894 | */ | 885 | */ |
895 | #define PIDE_FLAG 0x80000000UL | 886 | #define PIDE_FLAG 0x80000000UL |
896 | 887 | ||
897 | #ifdef CCIO_MAP_STATS | 888 | #ifdef CCIO_COLLECT_STATS |
898 | #define IOMMU_MAP_STATS | 889 | #define IOMMU_MAP_STATS |
899 | #endif | 890 | #endif |
900 | #include "iommu-helpers.h" | 891 | #include "iommu-helpers.h" |
@@ -938,7 +929,7 @@ ccio_map_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
938 | 929 | ||
939 | spin_lock_irqsave(&ioc->res_lock, flags); | 930 | spin_lock_irqsave(&ioc->res_lock, flags); |
940 | 931 | ||
941 | #ifdef CCIO_MAP_STATS | 932 | #ifdef CCIO_COLLECT_STATS |
942 | ioc->msg_calls++; | 933 | ioc->msg_calls++; |
943 | #endif | 934 | #endif |
944 | 935 | ||
@@ -997,13 +988,13 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
997 | DBG_RUN_SG("%s() START %d entries, %08lx,%x\n", | 988 | DBG_RUN_SG("%s() START %d entries, %08lx,%x\n", |
998 | __func__, nents, sg_virt_addr(sglist), sglist->length); | 989 | __func__, nents, sg_virt_addr(sglist), sglist->length); |
999 | 990 | ||
1000 | #ifdef CCIO_MAP_STATS | 991 | #ifdef CCIO_COLLECT_STATS |
1001 | ioc->usg_calls++; | 992 | ioc->usg_calls++; |
1002 | #endif | 993 | #endif |
1003 | 994 | ||
1004 | while(sg_dma_len(sglist) && nents--) { | 995 | while(sg_dma_len(sglist) && nents--) { |
1005 | 996 | ||
1006 | #ifdef CCIO_MAP_STATS | 997 | #ifdef CCIO_COLLECT_STATS |
1007 | ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT; | 998 | ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT; |
1008 | #endif | 999 | #endif |
1009 | ccio_unmap_single(dev, sg_dma_address(sglist), | 1000 | ccio_unmap_single(dev, sg_dma_address(sglist), |
@@ -1048,7 +1039,7 @@ static int ccio_proc_info(struct seq_file *m, void *p) | |||
1048 | len += seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n", | 1039 | len += seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n", |
1049 | total_pages * 8, total_pages); | 1040 | total_pages * 8, total_pages); |
1050 | 1041 | ||
1051 | #ifdef CCIO_MAP_STATS | 1042 | #ifdef CCIO_COLLECT_STATS |
1052 | len += seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n", | 1043 | len += seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n", |
1053 | total_pages - ioc->used_pages, ioc->used_pages, | 1044 | total_pages - ioc->used_pages, ioc->used_pages, |
1054 | (int)(ioc->used_pages * 100 / total_pages)); | 1045 | (int)(ioc->used_pages * 100 / total_pages)); |
@@ -1057,7 +1048,7 @@ static int ccio_proc_info(struct seq_file *m, void *p) | |||
1057 | len += seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n", | 1048 | len += seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n", |
1058 | ioc->res_size, total_pages); | 1049 | ioc->res_size, total_pages); |
1059 | 1050 | ||
1060 | #ifdef CCIO_SEARCH_TIME | 1051 | #ifdef CCIO_COLLECT_STATS |
1061 | min = max = ioc->avg_search[0]; | 1052 | min = max = ioc->avg_search[0]; |
1062 | for(j = 0; j < CCIO_SEARCH_SAMPLE; ++j) { | 1053 | for(j = 0; j < CCIO_SEARCH_SAMPLE; ++j) { |
1063 | avg += ioc->avg_search[j]; | 1054 | avg += ioc->avg_search[j]; |
@@ -1070,7 +1061,7 @@ static int ccio_proc_info(struct seq_file *m, void *p) | |||
1070 | len += seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n", | 1061 | len += seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n", |
1071 | min, avg, max); | 1062 | min, avg, max); |
1072 | #endif | 1063 | #endif |
1073 | #ifdef CCIO_MAP_STATS | 1064 | #ifdef CCIO_COLLECT_STATS |
1074 | len += seq_printf(m, "pci_map_single(): %8ld calls %8ld pages (avg %d/1000)\n", | 1065 | len += seq_printf(m, "pci_map_single(): %8ld calls %8ld pages (avg %d/1000)\n", |
1075 | ioc->msingle_calls, ioc->msingle_pages, | 1066 | ioc->msingle_calls, ioc->msingle_pages, |
1076 | (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls)); | 1067 | (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls)); |
@@ -1088,7 +1079,7 @@ static int ccio_proc_info(struct seq_file *m, void *p) | |||
1088 | len += seq_printf(m, "pci_unmap_sg() : %8ld calls %8ld pages (avg %d/1000)\n\n\n", | 1079 | len += seq_printf(m, "pci_unmap_sg() : %8ld calls %8ld pages (avg %d/1000)\n\n\n", |
1089 | ioc->usg_calls, ioc->usg_pages, | 1080 | ioc->usg_calls, ioc->usg_pages, |
1090 | (int)((ioc->usg_pages * 1000)/ioc->usg_calls)); | 1081 | (int)((ioc->usg_pages * 1000)/ioc->usg_calls)); |
1091 | #endif /* CCIO_MAP_STATS */ | 1082 | #endif /* CCIO_COLLECT_STATS */ |
1092 | 1083 | ||
1093 | ioc = ioc->next; | 1084 | ioc = ioc->next; |
1094 | } | 1085 | } |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index f660ef3e5b29..814f49fde530 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -610,6 +610,14 @@ config RTC_DRV_RS5C313 | |||
610 | help | 610 | help |
611 | If you say yes here you get support for the Ricoh RS5C313 RTC chips. | 611 | If you say yes here you get support for the Ricoh RS5C313 RTC chips. |
612 | 612 | ||
613 | config RTC_DRV_PARISC | ||
614 | tristate "PA-RISC firmware RTC support" | ||
615 | depends on PARISC | ||
616 | help | ||
617 | Say Y or M here to enable RTC support on PA-RISC systems using | ||
618 | firmware calls. If you do not know what you are doing, you should | ||
619 | just say Y. | ||
620 | |||
613 | config RTC_DRV_PPC | 621 | config RTC_DRV_PPC |
614 | tristate "PowerPC machine dependent RTC support" | 622 | tristate "PowerPC machine dependent RTC support" |
615 | depends on PPC | 623 | depends on PPC |
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index d05928b3ca94..d6a9ac7176ea 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile | |||
@@ -51,6 +51,7 @@ obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o | |||
51 | obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o | 51 | obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o |
52 | obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o | 52 | obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o |
53 | obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o | 53 | obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o |
54 | obj-$(CONFIG_RTC_DRV_PARISC) += rtc-parisc.o | ||
54 | obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o | 55 | obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o |
55 | obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o | 56 | obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o |
56 | obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o | 57 | obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o |
diff --git a/drivers/rtc/rtc-parisc.c b/drivers/rtc/rtc-parisc.c new file mode 100644 index 000000000000..346d633655e7 --- /dev/null +++ b/drivers/rtc/rtc-parisc.c | |||
@@ -0,0 +1,111 @@ | |||
1 | /* rtc-parisc: RTC for HP PA-RISC firmware | ||
2 | * | ||
3 | * Copyright (C) 2008 Kyle McMartin <kyle@mcmartin.ca> | ||
4 | */ | ||
5 | |||
6 | #include <linux/kernel.h> | ||
7 | #include <linux/module.h> | ||
8 | #include <linux/time.h> | ||
9 | #include <linux/platform_device.h> | ||
10 | |||
11 | #include <asm/rtc.h> | ||
12 | |||
13 | /* as simple as can be, and no simpler. */ | ||
14 | struct parisc_rtc { | ||
15 | struct rtc_device *rtc; | ||
16 | spinlock_t lock; | ||
17 | }; | ||
18 | |||
19 | static int parisc_get_time(struct device *dev, struct rtc_time *tm) | ||
20 | { | ||
21 | struct parisc_rtc *p = dev_get_drvdata(dev); | ||
22 | unsigned long flags, ret; | ||
23 | |||
24 | spin_lock_irqsave(&p->lock, flags); | ||
25 | ret = get_rtc_time(tm); | ||
26 | spin_unlock_irqrestore(&p->lock, flags); | ||
27 | |||
28 | if (ret & RTC_BATT_BAD) | ||
29 | return -EOPNOTSUPP; | ||
30 | |||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | static int parisc_set_time(struct device *dev, struct rtc_time *tm) | ||
35 | { | ||
36 | struct parisc_rtc *p = dev_get_drvdata(dev); | ||
37 | unsigned long flags, ret; | ||
38 | |||
39 | spin_lock_irqsave(&p->lock, flags); | ||
40 | ret = set_rtc_time(tm); | ||
41 | spin_unlock_irqrestore(&p->lock, flags); | ||
42 | |||
43 | if (ret < 0) | ||
44 | return -EOPNOTSUPP; | ||
45 | |||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | static const struct rtc_class_ops parisc_rtc_ops = { | ||
50 | .read_time = parisc_get_time, | ||
51 | .set_time = parisc_set_time, | ||
52 | }; | ||
53 | |||
54 | static int __devinit parisc_rtc_probe(struct platform_device *dev) | ||
55 | { | ||
56 | struct parisc_rtc *p; | ||
57 | |||
58 | p = kzalloc(sizeof (*p), GFP_KERNEL); | ||
59 | if (!p) | ||
60 | return -ENOMEM; | ||
61 | |||
62 | spin_lock_init(&p->lock); | ||
63 | |||
64 | p->rtc = rtc_device_register("rtc-parisc", &dev->dev, &parisc_rtc_ops, | ||
65 | THIS_MODULE); | ||
66 | if (IS_ERR(p->rtc)) { | ||
67 | int err = PTR_ERR(p->rtc); | ||
68 | kfree(p); | ||
69 | return err; | ||
70 | } | ||
71 | |||
72 | platform_set_drvdata(dev, p); | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static int __devexit parisc_rtc_remove(struct platform_device *dev) | ||
78 | { | ||
79 | struct parisc_rtc *p = platform_get_drvdata(dev); | ||
80 | |||
81 | rtc_device_unregister(p->rtc); | ||
82 | kfree(p); | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static struct platform_driver parisc_rtc_driver = { | ||
88 | .driver = { | ||
89 | .name = "rtc-parisc", | ||
90 | .owner = THIS_MODULE, | ||
91 | }, | ||
92 | .probe = parisc_rtc_probe, | ||
93 | .remove = __devexit_p(parisc_rtc_remove), | ||
94 | }; | ||
95 | |||
96 | static int __init parisc_rtc_init(void) | ||
97 | { | ||
98 | return platform_driver_register(&parisc_rtc_driver); | ||
99 | } | ||
100 | |||
101 | static void __exit parisc_rtc_fini(void) | ||
102 | { | ||
103 | platform_driver_unregister(&parisc_rtc_driver); | ||
104 | } | ||
105 | |||
106 | module_init(parisc_rtc_init); | ||
107 | module_exit(parisc_rtc_fini); | ||
108 | |||
109 | MODULE_AUTHOR("Kyle McMartin <kyle@mcmartin.ca>"); | ||
110 | MODULE_LICENSE("GPL"); | ||
111 | MODULE_DESCRIPTION("HP PA-RISC RTC driver"); | ||