[LV] [RFC] RTC/TOY cleanup: move to new RTC API
Hi! Some month ago, the new RTC lib went into the upstream kernel. I've "converted" KA43 to use this (using a standard DS1287A as RTC). This is still a draft; the Kconfig stuff needs to be cleaned out, and another RTC driver for the TOY-based VAXen needs to be written. On the other side, we no longer need to mv->clock_base and mv->clock_init stuff. This also substitutes arch/vax/kernel/clock.c . Comments? MfG, JBG diff --git a/arch/vax/Kconfig b/arch/vax/Kconfig index d62323f..45cf6a6 100644 --- a/arch/vax/Kconfig +++ b/arch/vax/Kconfig @@ -70,6 +70,14 @@ config CMDLINE help This is the command line the booting kernel will get. +config VAX_RTC + bool "VAX RTC support" + default y + help + This enables RTC support. You'll probably want to have this. + +source "drivers/rtc/Kconfig" + config EARLY_PRINTK bool default y diff --git a/arch/vax/kernel/Makefile b/arch/vax/kernel/Makefile index 671aab3..aa15883 100644 --- a/arch/vax/kernel/Makefile +++ b/arch/vax/kernel/Makefile @@ -29,7 +29,7 @@ obj-$(CONFIG_CPU_KA660) += cpu_ka660.o obj-$(CONFIG_CPU_VXT) += cpu_vxt.o obj-$(CONFIG_MODULES) += module.o +obj-$(CONFIG_VAX_RTC) += rtc-generic.o obj-$(CONFIG_VAX_DIAG_LED) += diag_led.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o diff --git a/arch/vax/kernel/cpu_ka43.c b/arch/vax/kernel/cpu_ka43.c index e06d5de..fb7fbbb 100644 --- a/arch/vax/kernel/cpu_ka43.c +++ b/arch/vax/kernel/cpu_ka43.c @@ -26,6 +26,11 @@ #include <asm/clock.h> /* For clock_init routines */ #include <asm/bus/vsbus.h> + + +extern int vax_ds1287_register (unsigned long phys_addr); + + /* Internal CPU register space */ static volatile struct ka43_cpu_regs __iomem *cpu_regs; @@ -223,7 +228,8 @@ struct vax_mv mv_ka43 = { .post_vm_getchar = dz11_getchar, .mcheck = ka43_mcheck, .cpu_type_str = ka43_cpu_type_str, - .clock_init = ka4x_clock_init, + //.clock_init = ka4x_clock_init, + .clock_init = NULL, }; static struct cpu_match __CPU_MATCH cpumatch_ka43 = { @@ -251,6 +257,7 @@ static int __init ka43_platform_device_i return -ENODEV; platform_device_register(&ka43_diag_led_device); + vax_ds1287_register (VSA_CLOCK_BASE); retval = platform_device_register(&ka43_vsbus_device); if (!retval) { diff --git a/arch/vax/kernel/time.c b/arch/vax/kernel/time.c diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c --- /dev/null 2006-03-21 19:51:06.723350640 +0100 +++ linux-2.6/arch/vax/kernel/rtc-generic.c 2006-04-09 11:18:52.000000000 +0200 @@ -0,0 +1,67 @@ +/* + * Support functions for VAX RTC access. Used by all cpu_xxx.c files. + */ + +#include <linux/m48t86.h> +#include <linux/platform_device.h> +#include <linux/io.h> + +/********************************************************************/ +/* Internal memory access helpers */ +/********************************************************************/ +/* + * Normal bus I/O. One byte (in the low byte) per longword. All data starts + * at bit #2, so we need to shift out the lower two bits. + */ +static volatile uint32_t __iomem *vax_rtc_io_base = NULL; + +static unsigned char +vax_rtc_bus_io_readb (unsigned long addr) +{ + unsigned char ret = 0; + + if (vax_rtc_io_base) + ret = (vax_rtc_io_base[addr] >> 2) & 0xff; + + printk (KERN_INFO "rtc_read: 0x%08lx --> %02x\n", (unsigned long) &vax_rtc_io_base[addr], ret); + + return ret; +} + +static void +vax_rtc_bus_io_writeb (unsigned char value, unsigned long addr) +{ + printk (KERN_INFO "rtc_write: 0x%02x --> 0x%08lx\n", value, (unsigned long) &vax_rtc_io_base[addr]); + + if (vax_rtc_io_base) + vax_rtc_io_base[addr] = value << 2; +} + +static struct m48t86_ops vax_rtc_bus_io_ops = { + .readb = vax_rtc_bus_io_readb, + .writeb = vax_rtc_bus_io_writeb, +}; + + +/********************************************************************/ +/* RTC-specific registration data */ +/********************************************************************/ +static struct platform_device vax_ds1287_rtc_platform_device = { + .name = "rtc-m48t86", + .id = -1, + .dev = { + .platform_data = &vax_rtc_bus_io_ops, + }, + .num_resources = 0, +}; + +/********************************************************************/ +/* External interface for use in cpu_xxx.c files */ +/********************************************************************/ +int +vax_ds1287_register (unsigned long phys_addr) +{ + vax_rtc_io_base = ioremap (phys_addr, 60 * 4); /* 60 I/O bytes of RTC, one per longword. */ + return platform_device_register (&vax_ds1287_rtc_platform_device); +} + -- Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _ "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O für einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA)); _______________________________________________ Linux-Vax mailing list Linux-Vax@pergamentum.com http://www.pergamentum.com/mailman/listinfo/linux-vax
Teilnehmer (2)
-
Jan-Benedict Glaw
-
Kenn Humborg