Add v3020 RTC support
PATCH 1/1 Add v3020 RTC support
This patch adds support for the v3020 RTC from EM Microelectronic.
The v3020 RTC is designed to be connected on a bus using only one data bit. Since any data bit may be used, it is necessary to specify this to the driver by passing a struct v3020_platform_data pointer (see include/linux/rtc-v3020.h) to the driver.
Part of the following code comes from the kernel patchs produced by Compulab for their products. The original file (available here:
http://raph.people.8d.com/misc/emv3020.c) was released under the terms of the GPL license.
Signed-off-by Raphael Assenat <[email protected]>
---
drivers/rtc/Kconfig +10 -0
@@ -182,4 +182,14 @@ This driver can also be built as a module. If so, the module will be called rtc-max6902. +config RTC_DRV_V3020 + tristate "EM Microelectronic V3020" + depends on RTC_CLASS + help + If you say yes here you will get support for the + EM Microelectronic v3020 RTC chip. + + This driver can also be built as a module. If so, the module + will be called rtc-v3020. + endmenu
drivers/rtc/Makefile +1 -0
@@ -21,3 +21,4 @@ obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o obj-$(CONFIG_RTC_DRV_MAX6902) += rtc-max6902.o +obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o
drivers/rtc/rtc-v3020.c +266 -0
266 lines not on this page · raw message
include/linux/rtc-v3020.h +35 -0
@@ -0,0 +1,35 @@ +/* +* v3020.h - Registers definition and platform data structure for the v3020 RTC. +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006, 8D Technologies inc. +*/ +#ifndef __LINUX_V3020_H +#define __LINUX_V3020_H + +/* The v3020 has only one data pin but which one +* is used depends on the board. */ +struct v3020_platform_data { +int leftshift;/* (1<<(leftshift)) & readl() */ +}; + +#define V3020_STATUS_0 0x00 +#define V3020_STATUS_1 0x01 +#define V3020_SECONDS 0x02 +#define V3020_MINUTES 0x03 +#define V3020_HOURS 0x04 +#define V3020_MONTH_DAY 0x05 +#define V3020_MONTH 0x06 +#define V3020_YEAR 0x07 +#define V3020_WEEK_DAY 0x08 +#define V3020_WEEK 0x09 + +#define V3020_IS_COMMAND (val) ((val)>=0x0E) + +#define V3020_CMD_RAM2CLOCK 0x0E +#define V3020_CMD_CLOCK2RAM 0x0F + +#endif /* __LINUX_V3020_H */