From 98f172b257725de516a792b810b08639d6293d4d Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Mon, 28 Jul 2008 16:21:19 -0400 Subject: parisc: parisc-agp - fix -> --- drivers/char/agp/parisc-agp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index 8c42dcc5958c..f4bbcb273208 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -20,8 +20,8 @@ #include #include -#include -#include +#include +#include #include "agp.h" -- cgit v1.2.3 From 1e22166c40a99fb25fa6ff4f711a3217d848dd85 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Mon, 28 Jul 2008 21:17:23 -0400 Subject: parisc: unify CCIO_COLLECT_STATS implementation Make it behave in the same manner as SBA_COLLECT_STATS, further clean ups pending. --- drivers/parisc/ccio-dma.c | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) (limited to 'drivers') 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 @@ #undef DEBUG_CCIO_RUN_SG #ifdef CONFIG_PROC_FS -/* - * CCIO_SEARCH_TIME can help measure how fast the bitmap search is. - * impacts performance though - ditch it if you don't use it. - */ -#define CCIO_SEARCH_TIME -#undef CCIO_MAP_STATS -#else -#undef CCIO_SEARCH_TIME -#undef CCIO_MAP_STATS +/* depends on proc fs support. But costs CPU performance. */ +#undef CCIO_COLLECT_STATS #endif #include @@ -239,12 +232,10 @@ struct ioc { u32 res_size; /* size of resource map in bytes */ spinlock_t res_lock; -#ifdef CCIO_SEARCH_TIME +#ifdef CCIO_COLLECT_STATS #define CCIO_SEARCH_SAMPLE 0x100 unsigned long avg_search[CCIO_SEARCH_SAMPLE]; unsigned long avg_idx; /* current index into avg_search */ -#endif -#ifdef CCIO_MAP_STATS unsigned long used_pages; unsigned long msingle_calls; unsigned long msingle_pages; @@ -351,7 +342,7 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size) unsigned int pages_needed = size >> IOVP_SHIFT; unsigned int res_idx; unsigned long boundary_size; -#ifdef CCIO_SEARCH_TIME +#ifdef CCIO_COLLECT_STATS unsigned long cr_start = mfctl(16); #endif @@ -406,7 +397,7 @@ resource_found: DBG_RES("%s() res_idx %d res_hint: %d\n", __func__, res_idx, ioc->res_hint); -#ifdef CCIO_SEARCH_TIME +#ifdef CCIO_COLLECT_STATS { unsigned long cr_end = mfctl(16); unsigned long tmp = cr_end - cr_start; @@ -416,7 +407,7 @@ resource_found: ioc->avg_search[ioc->avg_idx++] = cr_start; ioc->avg_idx &= CCIO_SEARCH_SAMPLE - 1; #endif -#ifdef CCIO_MAP_STATS +#ifdef CCIO_COLLECT_STATS ioc->used_pages += pages_needed; #endif /* @@ -452,7 +443,7 @@ ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped) DBG_RES("%s(): res_idx: %d pages_mapped %d\n", __func__, res_idx, pages_mapped); -#ifdef CCIO_MAP_STATS +#ifdef CCIO_COLLECT_STATS ioc->used_pages -= pages_mapped; #endif @@ -764,7 +755,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size, size = ALIGN(size + offset, IOVP_SIZE); spin_lock_irqsave(&ioc->res_lock, flags); -#ifdef CCIO_MAP_STATS +#ifdef CCIO_COLLECT_STATS ioc->msingle_calls++; ioc->msingle_pages += size >> IOVP_SHIFT; #endif @@ -828,7 +819,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, size_t size, spin_lock_irqsave(&ioc->res_lock, flags); -#ifdef CCIO_MAP_STATS +#ifdef CCIO_COLLECT_STATS ioc->usingle_calls++; ioc->usingle_pages += size >> IOVP_SHIFT; #endif @@ -894,7 +885,7 @@ ccio_free_consistent(struct device *dev, size_t size, void *cpu_addr, */ #define PIDE_FLAG 0x80000000UL -#ifdef CCIO_MAP_STATS +#ifdef CCIO_COLLECT_STATS #define IOMMU_MAP_STATS #endif #include "iommu-helpers.h" @@ -938,7 +929,7 @@ ccio_map_sg(struct device *dev, struct scatterlist *sglist, int nents, spin_lock_irqsave(&ioc->res_lock, flags); -#ifdef CCIO_MAP_STATS +#ifdef CCIO_COLLECT_STATS ioc->msg_calls++; #endif @@ -997,13 +988,13 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, DBG_RUN_SG("%s() START %d entries, %08lx,%x\n", __func__, nents, sg_virt_addr(sglist), sglist->length); -#ifdef CCIO_MAP_STATS +#ifdef CCIO_COLLECT_STATS ioc->usg_calls++; #endif while(sg_dma_len(sglist) && nents--) { -#ifdef CCIO_MAP_STATS +#ifdef CCIO_COLLECT_STATS ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT; #endif ccio_unmap_single(dev, sg_dma_address(sglist), @@ -1048,7 +1039,7 @@ static int ccio_proc_info(struct seq_file *m, void *p) len += seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n", total_pages * 8, total_pages); -#ifdef CCIO_MAP_STATS +#ifdef CCIO_COLLECT_STATS len += seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n", total_pages - ioc->used_pages, ioc->used_pages, (int)(ioc->used_pages * 100 / total_pages)); @@ -1057,7 +1048,7 @@ static int ccio_proc_info(struct seq_file *m, void *p) len += seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n", ioc->res_size, total_pages); -#ifdef CCIO_SEARCH_TIME +#ifdef CCIO_COLLECT_STATS min = max = ioc->avg_search[0]; for(j = 0; j < CCIO_SEARCH_SAMPLE; ++j) { avg += ioc->avg_search[j]; @@ -1070,7 +1061,7 @@ static int ccio_proc_info(struct seq_file *m, void *p) len += seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n", min, avg, max); #endif -#ifdef CCIO_MAP_STATS +#ifdef CCIO_COLLECT_STATS len += seq_printf(m, "pci_map_single(): %8ld calls %8ld pages (avg %d/1000)\n", ioc->msingle_calls, ioc->msingle_pages, (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls)); @@ -1088,7 +1079,7 @@ static int ccio_proc_info(struct seq_file *m, void *p) len += seq_printf(m, "pci_unmap_sg() : %8ld calls %8ld pages (avg %d/1000)\n\n\n", ioc->usg_calls, ioc->usg_pages, (int)((ioc->usg_pages * 1000)/ioc->usg_calls)); -#endif /* CCIO_MAP_STATS */ +#endif /* CCIO_COLLECT_STATS */ ioc = ioc->next; } -- cgit v1.2.3 From 9eb1686423756f4dfb0ad8bfb02bb8bf1b89e50a Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Wed, 10 Sep 2008 14:24:07 +0000 Subject: parisc: add rtc platform driver Signed-off-by: Kyle McMartin --- arch/parisc/Kconfig | 2 + arch/parisc/kernel/time.c | 20 ++++++++- drivers/rtc/Kconfig | 8 ++++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-parisc.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 drivers/rtc/rtc-parisc.c (limited to 'drivers') diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index a7d4fd353c2b..0a8ac703dbec 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -9,6 +9,8 @@ config PARISC def_bool y select HAVE_IDE select HAVE_OPROFILE + select RTC_CLASS + select RTC_DRV_PARISC help The PA-RISC microprocessor is designed by Hewlett-Packard and used in many of their workstations & servers (HP9000 700 and 800 series, diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c index 24be86bba94d..4d09203bc693 100644 --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -215,6 +216,24 @@ void __init start_cpu_itimer(void) cpu_data[cpu].it_value = next_tick; } +struct platform_device rtc_parisc_dev = { + .name = "rtc-parisc", + .id = -1, +}; + +static int __init rtc_init(void) +{ + int ret; + + ret = platform_device_register(&rtc_parisc_dev); + if (ret < 0) + printk(KERN_ERR "unable to register rtc device...\n"); + + /* not necessarily an error */ + return 0; +} +module_init(rtc_init); + void __init time_init(void) { static struct pdc_tod tod_data; @@ -245,4 +264,3 @@ void __init time_init(void) xtime.tv_nsec = 0; } } - diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 9a9755c92fad..30d40fe194a8 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -575,6 +575,14 @@ config RTC_DRV_RS5C313 help If you say yes here you get support for the Ricoh RS5C313 RTC chips. +config RTC_DRV_PARISC + tristate "PA-RISC firmware RTC support" + depends on PARISC + help + Say Y or M here to enable RTC support on PA-RISC systems using + firmware calls. If you do not know what you are doing, you should + just say Y. + config RTC_DRV_PPC tristate "PowerPC machine dependent RTC support" depends on PPC_MERGE diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 18622ef84cab..180ddacde730 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -45,6 +45,7 @@ obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o +obj-$(CONFIG_RTC_DRV_PARISC) += rtc-parisc.o obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o 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 @@ +/* rtc-parisc: RTC for HP PA-RISC firmware + * + * Copyright (C) 2008 Kyle McMartin + */ + +#include +#include +#include +#include + +#include + +/* as simple as can be, and no simpler. */ +struct parisc_rtc { + struct rtc_device *rtc; + spinlock_t lock; +}; + +static int parisc_get_time(struct device *dev, struct rtc_time *tm) +{ + struct parisc_rtc *p = dev_get_drvdata(dev); + unsigned long flags, ret; + + spin_lock_irqsave(&p->lock, flags); + ret = get_rtc_time(tm); + spin_unlock_irqrestore(&p->lock, flags); + + if (ret & RTC_BATT_BAD) + return -EOPNOTSUPP; + + return 0; +} + +static int parisc_set_time(struct device *dev, struct rtc_time *tm) +{ + struct parisc_rtc *p = dev_get_drvdata(dev); + unsigned long flags, ret; + + spin_lock_irqsave(&p->lock, flags); + ret = set_rtc_time(tm); + spin_unlock_irqrestore(&p->lock, flags); + + if (ret < 0) + return -EOPNOTSUPP; + + return 0; +} + +static const struct rtc_class_ops parisc_rtc_ops = { + .read_time = parisc_get_time, + .set_time = parisc_set_time, +}; + +static int __devinit parisc_rtc_probe(struct platform_device *dev) +{ + struct parisc_rtc *p; + + p = kzalloc(sizeof (*p), GFP_KERNEL); + if (!p) + return -ENOMEM; + + spin_lock_init(&p->lock); + + p->rtc = rtc_device_register("rtc-parisc", &dev->dev, &parisc_rtc_ops, + THIS_MODULE); + if (IS_ERR(p->rtc)) { + int err = PTR_ERR(p->rtc); + kfree(p); + return err; + } + + platform_set_drvdata(dev, p); + + return 0; +} + +static int __devexit parisc_rtc_remove(struct platform_device *dev) +{ + struct parisc_rtc *p = platform_get_drvdata(dev); + + rtc_device_unregister(p->rtc); + kfree(p); + + return 0; +} + +static struct platform_driver parisc_rtc_driver = { + .driver = { + .name = "rtc-parisc", + .owner = THIS_MODULE, + }, + .probe = parisc_rtc_probe, + .remove = __devexit_p(parisc_rtc_remove), +}; + +static int __init parisc_rtc_init(void) +{ + return platform_driver_register(&parisc_rtc_driver); +} + +static void __exit parisc_rtc_fini(void) +{ + platform_driver_unregister(&parisc_rtc_driver); +} + +module_init(parisc_rtc_init); +module_exit(parisc_rtc_fini); + +MODULE_AUTHOR("Kyle McMartin "); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("HP PA-RISC RTC driver"); -- cgit v1.2.3