linux/drivers/rtc/rtc-ds1302.c
<<
ptio v2/spa v2/form v2a ptio v href="../linux+v3e="10/drivers/rtc/rtc-ds1302.c">ptio v2img src="../.static/gfx/right.png" alt=">>">pt2/spa pt2spa class="lxr_search">ptioptio v2input typptihidden" namptinavtarget" 2ptio v2input typptitext" namptisearch" idtisearch">ptio v2butt4.1typptisubmit">Searchptio vPrefs v2/a>pt2/spa io v v2/div io v v2form ac2" ="ajax+*" method="post" onsubmit="return false;">pt2input typptihidden" namptiajax_lookup" idtiajax_lookup" 2pio v v2/form pio v v2div class="headingbott4m">
2div idtifile_contents"
v v12/a>2spa	 class="comment">/*2/spa	  v v22/a>2spa	 class="comment"> * Dallas DS1302 RTC Support2/spa	  v v32/a>2spa	 class="comment"> *2/spa	  v v42/a>2spa	 class="comment"> *  Copyright (C) 2002 David McCullough2/spa	  v v52/a>2spa	 class="comment"> *  Copyright (C) 2003 - 2007 Paul Mundt2/spa	  v v62/a>2spa	 class="comment"> *2/spa	  v v72/a>2spa	 class="comment"> * This file is subject to the terms and condi2"
	s of the GNU General Public2/spa	  v v82/a>2spa	 class="comment"> * License vers34.12. See the file "COPYING" in the main directory of2/spa	  v v92/a>2spa	 class="comment"> * this archive for more details.2/spa	  v e="va>2spa	 class="comment"> */2/spa	  v 112/a> v 122/a>#include <linux/init.h2/a>> v 132/a>#include <linux/module.h2/a>> v 142/a>#include <linux/kernel.h2/a>> v 152/a>#include <linux/platform_device.h2/a>> v 162/a>#include <linux/rtc.h2/a>> v 172/a>#include <linux/io.h2/a>> v 182/a>#include <linux/bcd.h2/a>> v 192/a> v 2="va>#definev2a href="+code=DRV_NAME" class="sref">DRV_NAME"va>        2spa	 class="string">"rtc-ds1302"2/spa	  v 21"va>#definev2a href="+code=DRV_VERSION" class="sref">DRV_VERSION"va>     2spa	 class="string">"0.1.1"2/spa	  v 222/a> v 23"va>#definev2a href="+code=RTC_CMD_READ" class="sref">RTC_CMD_READ"va>    0x81            2spa	 class="comment">/* Read command */2/spa	  v 24"va>#definev2a href="+code=RTC_CMD_WRITE" class="sref">RTC_CMD_WRITE"va>   0x80            2spa	 class="comment">/* Write command */2/spa	  v 252/a> v 26"va>#definev2a href="+code=RTC_ADDR_RAM0" class="sref">RTC_ADDR_RAM0"va>   0x20            2spa	 class="comment">/* Address of RAM0 */2/spa	  v 27"va>#definev2a href="+code=RTC_ADDR_TCR" class="sref">RTC_ADDR_TCR"va>    0x08            2spa	 class="comment">/* Address of trickle charge register */2/spa	  v 28"va>#definev2a href="+code=RTC_ADDR_YEAR" class="sref">RTC_ADDR_YEAR"va>   0x06            2spa	 class="comment">/* Address of year register */2/spa	  v 29"va>#definev2a href="+code=RTC_ADDR_DAY" class="sref">RTC_ADDR_DAY"va>    0x05            2spa	 class="comment">/* Address of day of week register */2/spa	  v 3="va>#definev2a href="+code=RTC_ADDR_MON" class="sref">RTC_ADDR_MON"va>    0x04            2spa	 class="comment">/* Address of month register */2/spa	  v 31"va>#definev2a href="+code=RTC_ADDR_DATE" class="sref">RTC_ADDR_DATE"va>   0x03            2spa	 class="comment">/* Address of day of month register */2/spa	  v 32"va>#definev2a href="+code=RTC_ADDR_HOUR" class="sref">RTC_ADDR_HOUR"va>   0x02            2spa	 class="comment">/* Address of hour register */2/spa	  v 33"va>#definev2a href="+code=RTC_ADDR_MIN" class="sref">RTC_ADDR_MIN"va>    0x01            2spa	 class="comment">/* Address of minute register */2/spa	  v 34"va>#definev2a href="+code=RTC_ADDR_SEC" class="sref">RTC_ADDR_SEC"va>    0x00            2spa	 class="comment">/* Address of second register */2/spa	  v 352/a> v 362/a>#ifdefv2a href="+code=CONFIG_SH_SECUREEDGE5410" class="sref">CONFIG_SH_SECUREEDGE54102/a> v 372/a>#include <asm/rtc.h2/a>> v 382/a>#include <mach/secureedge5410.h2/a>> v 392/a> v 4="va>#definev2a href="+code=RTC_RESET" class="sref">RTC_RESET"va>       0x1000 v 41"va>#definev2a href="+code=RTC_IODATA" class="sref">RTC_IODATA"va>      0x0800 v 42"va>#definev2a href="+code=RTC_SCLK" class="sref">RTC_SCLK"va>        0x0400 v 432/a> v 44"va>#definev2a href="+code=set_dp" class="sref">set_dp"va>(2a href="+code=x" class="sref">x"va>)       2a href="+code=SECUREEDGE_WRITE_IOPORT" class="sref">SECUREEDGE_WRITE_IOPORT"va>(2a href="+code=x" class="sref">x"va>, 0x1c00) v 45"va>#definev2a href="+code=get_dp" class="sref">get_dp"va>()        2a href="+code=SECUREEDGE_READ_IOPORT" class="sref">SECUREEDGE_READ_IOPORT"va>() v 46"va>#definev2a href="+code=ds1302_set_tx" class="sref">ds1302_set_tx"va>() v 47"va>#definev2a href="+code=ds1302_set_rx" class="sref">ds1302_set_rx"va>() v 482/a> v 492/a>staticv2a href="+code=inline" class="sref">inline"va> intv2a href="+code=ds1302_hw_init" class="sref">ds1302_hw_init"va>(void) v 5="va>{ v 51"va>        return 0; v 52"va>} v 532/a> v 542/a>staticv2a href="+code=inline" class="sref">inline"va> voidv2a href="+code=ds1302_reset" class="sref">ds1302_reset"va>(void) v 55"va>{ v 56"va>        2a href="+code=set_dp" class="sref">set_dp"va>(2a href="+code=get_dp" class="sref">get_dp"va>() & ~(2a href="+code=RTC_RESET" class="sref">RTC_RESET"va> |v2a href="+code=RTC_IODATA" class="sref">RTC_IODATA"va> |v2a href="+code=RTC_SCLK" class="sref">RTC_SCLK"va>)); v 57"va>} v 582/a> v 592/a>staticv2a href="+code=inline" class="sref">inline"va> voidv2a href="+code=ds1302_clock" class="sref">ds1302_clock"va>(void) v 6="va>{ v 61"va>        2a href="+code=set_dp" class="sref">set_dp"va>(2a href="+code=get_dp" class="sref">get_dp"va>() |v2a href="+code=RTC_SCLK" class="sref">RTC_SCLK"va>);    2spa	 class="comment">/* clock high */2/spa	  v 62"va>        2a href="+code=set_dp" class="sref">set_dp"va>(2a href="+code=get_dp" class="sref">get_dp"va>() & ~2a href="+code=RTC_SCLK" class="sref">RTC_SCLK"va>);   2spa	 class="comment">/* clock low */2/spa	  v 63"va>} v 642/a> v 652/a>staticv2a href="+code=inline" class="sref">inline"va> voidv2a href="+code=ds1302_start" class="sref">ds1302_start"va>(void) v 66"va>{ v 67"va>        2a href="+code=set_dp" class="sref">set_dp"va>(2a href="+code=get_dp" class="sref">get_dp"va>() |v2a href="+code=RTC_RESET" class="sref">RTC_RESET"va>); v 68"va>} v 692/a> v 702/a>staticv2a href="+code=inline" class="sref">inline"va> voidv2a href="+code=ds1302_stop" class="sref">ds1302_stop"va>(void) v 71"va>{ v 72"va>        2a href="+code=set_dp" class="sref">set_dp"va>(2a href="+code=get_dp" class="sref">get_dp"va>() & ~2a href="+code=RTC_RESET" class="sref">RTC_RESET"va>); v 73"va>} v 742/a> v 752/a>staticv2a href="+code=inline" class="sref">inline"va> voidv2a href="+code=ds1302_txbit" class="sref">ds1302_txbit"va>(intv2a href="+code=bit" class="sref">bit"va>) v 76"va>{ v 77"va>        2a href="+code=set_dp" class="sref">set_dp"va>((2a href="+code=get_dp" class="sref">get_dp"va>() & ~2a href="+code=RTC_IODATA" class="sref">RTC_IODATA"va>) |v(2a href="+code=bit" class="sref">bit"va> ?v2a href="+code=RTC_IODATA" class="sref">RTC_IODATA"va> : 0)); v 78"va>} v 792/a> v 802/a>staticv2a href="+code=inline" class="sref">inline"va> intv2a href="+code=ds1302_rxbit" class="sref">ds1302_rxbit"va>(void) v 81"va>{ v 82"va>        return !!(2a href="+code=get_dp" class="sref">get_dp"va>() & 2a href="+code=RTC_IODATA" class="sref">RTC_IODATA"va>); v 83"va>} v 842/a> v 85"va>#else v 86"va>#error 2spa	 class="string">"Add support for your platform"2/spa	  v 87"va>#endif v 882/a> v 892/a>staticvvoidv2a href="+code=ds1302_sendbits" class="sref">ds1302_sendbits"va>(unsigned intv2a href="+code=val" class="sref">val"va>) v 9="va>{ v 91"va>        intv2a href="+code=i" class="sref">i"va>; v 922/a> v 93"va>        2a href="+code=ds1302_set_tx" class="sref">ds1302_set_tx"va>(); v 942/a> v 95"va>        for (2a href="+code=i" class="sref">i"va> = 8; (2a href="+code=i" class="sref">i"va>); 2a href="+code=i" class="sref">i"va>--,v2a href="+code=val" class="sref">val"va> >>= 1) { v 96"va>                2a href="+code=ds1302_txbit" class="sref">ds1302_txbit"va>(2a href="+code=val" class="sref">val"va> & 0x1); v 97"va>                2a href="+code=ds1302_clock" class="sref">ds1302_clock"va>(); v 98"va>        } v 99"va>} v1002/a> v1012/a>staticvunsigned intv2a href="+code=ds1302_recvbits" class="sref">ds1302_recvbits"va>(void) v102"va>{ v103"va>        unsigned intv2a href="+code=val" class="sref">val"va>; v104"va>        intv2a href="+code=i" class="sref">i"va>; v1052/a> v106"va>        2a href="+code=ds1302_set_rx" class="sref">ds1302_set_rx"va>(); v1072/a> v108"va>        for (2a href="+code=i" class="sref">i"va> = 0,v2a href="+code=val" class="sref">val"va> = 0; (2a href="+code=i" class="sref">i"va> < 8); 2a href="+code=i" class="sref">i"va>++) { v109"va>                2a href="+code=val" class="sref">val"va> |= (2a href="+code=ds1302_rxbit" class="sref">ds1302_rxbit"va>() << 2a href="+code=i" class="sref">i"va>); v110"va>                2a href="+code=ds1302_clock" class="sref">ds1302_clock"va>(); v111"va>        } v1122/a> v113"va>        return 2a href="+code=val" class="sref">val"va>; v1142/a>} v1152/a> v1162/a>staticvunsigned intv2a href="+code=ds1302_readbyte" class="sref">ds1302_readbyte"va>(unsigned intv2a href="+code=addr" class="sref">addr"va>) v1172/a>{ v118"va>        unsigned intv2a href="+code=val" class="sref">val"va>; v1192/a> v120"va>        2a href="+code=ds1302_reset" class="sref">ds1302_reset"va>(); v1212/a> v122"va>        2a href="+code=ds1302_start" class="sref">ds1302_start"va>(); v123"va>        2a href="+code=ds1302_sendbits" class="sref">ds1302_sendbits"va>(((2a href="+code=addr" class="sref">addr"va> & 0x3f) << 1) |v2a href="+code=RTC_CMD_READ" class="sref">RTC_CMD_READ"va>); v124"va>        2a href="+code=val" class="sref">val"va> = 2a href="+code=ds1302_recvbits" class="sref">ds1302_recvbits"va>(); v125"va>        2a href="+code=ds1302_stop" class="sref">ds1302_stop"va>(); v126"va> v127"va>        return 2a href="+code=val" class="sref">val"va>; v128"va>} v1292/a> v1302/a>staticvvoidv2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(unsigned intv2a href="+code=addr" class="sref">addr"va>, unsigned intv2a href="+code=val" class="sref">val"va>) v131"va>{ v132"va>        2a href="+code=ds1302_reset" class="sref">ds1302_reset"va>(); v1332/a> v134"va>        2a href="+code=ds1302_start" class="sref">ds1302_start"va>(); v135"va>        2a href="+code=ds1302_sendbits" class="sref">ds1302_sendbits"va>(((2a href="+code=addr" class="sref">addr"va> & 0x3f) << 1) |v2a href="+code=RTC_CMD_WRITE" class="sref">RTC_CMD_WRITE"va>); v136"va>        2a href="+code=ds1302_sendbits" class="sref">ds1302_sendbits"va>(2a href="+code=val" class="sref">val"va>); v137"va>        2a href="+code=ds1302_stop" class="sref">ds1302_stop"va>(); v138"va>} v1392/a> v1402/a>staticvintv2a href="+code=ds1302_rtc_read_time" class="sref">ds1302_rtc_read_time"va>(structv2a href="+code=device" class="sref">device"va> *2a href="+code=dev" class="sref">dev"va>, structv2a href="+code=rtc_time" class="sref">rtc_time"va> *2a href="+code=tm" class="sref">tm"va>) v141"va>{ v142"va>        2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_sec" class="sref">tm_sec"va>      = 2a href="+code=bcd2bin" class="sref">bcd2bin"va>(2a href="+code=ds1302_readbyte" class="sref">ds1302_readbyte"va>(2a href="+code=RTC_ADDR_SEC" class="sref">RTC_ADDR_SEC"va>)); v143"va>        2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_min" class="sref">tm_min"va>      = 2a href="+code=bcd2bin" class="sref">bcd2bin"va>(2a href="+code=ds1302_readbyte" class="sref">ds1302_readbyte"va>(2a href="+code=RTC_ADDR_MIN" class="sref">RTC_ADDR_MIN"va>)); v144"va>        2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_hour" class="sref">tm_hour"va>     = 2a href="+code=bcd2bin" class="sref">bcd2bin"va>(2a href="+code=ds1302_readbyte" class="sref">ds1302_readbyte"va>(2a href="+code=RTC_ADDR_HOUR" class="sref">RTC_ADDR_HOUR"va>)); v145"va>        2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_wday" class="sref">tm_wday"va>     = 2a href="+code=bcd2bin" class="sref">bcd2bin"va>(2a href="+code=ds1302_readbyte" class="sref">ds1302_readbyte"va>(2a href="+code=RTC_ADDR_DAY" class="sref">RTC_ADDR_DAY"va>)); v146"va>        2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_mday" class="sref">tm_mday"va>     = 2a href="+code=bcd2bin" class="sref">bcd2bin"va>(2a href="+code=ds1302_readbyte" class="sref">ds1302_readbyte"va>(2a href="+code=RTC_ADDR_DATE" class="sref">RTC_ADDR_DATE"va>)); v147"va>        2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_mon" class="sref">tm_mon"va>      = 2a href="+code=bcd2bin" class="sref">bcd2bin"va>(2a href="+code=ds1302_readbyte" class="sref">ds1302_readbyte"va>(2a href="+code=RTC_ADDR_MON" class="sref">RTC_ADDR_MON"va>)) - 1; v148"va>        2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_year" class="sref">tm_year"va>     = 2a href="+code=bcd2bin" class="sref">bcd2bin"va>(2a href="+code=ds1302_readbyte" class="sref">ds1302_readbyte"va>(2a href="+code=RTC_ADDR_YEAR" class="sref">RTC_ADDR_YEAR"va>)); v1492/a> v150"va>        if (2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_year" class="sref">tm_year"va> < 70) v151"va>                2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_year" class="sref">tm_year"va> +=v100; v1522/a> v153"va>        2a href="+code=dev_dbg" class="sref">dev_dbg"va>(2a href="+code=dev" class="sref">dev"va>, 2spa	 class="string">"%s: tm is secs=%d, mins=%d, hours=%d, "2/spa	  v154"va>                2spa	 class="string">"mday=%d, mon=%d, year=%d, wday=%d\n"2/spa	 , v155"va>                2a href="+code=__func__" class="sref">__func__"va>, v156"va>                2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_sec" class="sref">tm_sec"va>,v2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_min" class="sref">tm_min"va>,v2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_hour" class="sref">tm_hour"va>, v157"va>                2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_mday" class="sref">tm_mday"va>,v2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_mon" class="sref">tm_mon"va> + 1,v2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_year" class="sref">tm_year"va>,v2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_wday" class="sref">tm_wday"va>); v1582/a> v159"va>        return 2a href="+code=rtc_valid_tm" class="sref">rtc_valid_tm"va>(2a href="+code=tm" class="sref">tm"va>); v16="va>} v1612/a> v162"va>staticvintv2a href="+code=ds1302_rtc_set_time" class="sref">ds1302_rtc_set_time"va>(structv2a href="+code=device" class="sref">device"va> *2a href="+code=dev" class="sref">dev"va>, structv2a href="+code=rtc_time" class="sref">rtc_time"va> *2a href="+code=tm" class="sref">tm"va>) v163"va>{ v164"va>        2spa	 class="comment">/* Stop RTC */2/spa	  v165"va>        2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(2a href="+code=RTC_ADDR_SEC" class="sref">RTC_ADDR_SEC"va>,v2a href="+code=ds1302_readbyte" class="sref">ds1302_readbyte"va>(2a href="+code=RTC_ADDR_SEC" class="sref">RTC_ADDR_SEC"va>) | 0x80); v166"va> v167"va>        2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(2a href="+code=RTC_ADDR_SEC" class="sref">RTC_ADDR_SEC"va>,v2a href="+code=bin2bcd" class="sref">bin2bcd"va>(2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_sec" class="sref">tm_sec"va>)); v168"va>        2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(2a href="+code=RTC_ADDR_MIN" class="sref">RTC_ADDR_MIN"va>,v2a href="+code=bin2bcd" class="sref">bin2bcd"va>(2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_min" class="sref">tm_min"va>)); v169"va>        2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(2a href="+code=RTC_ADDR_HOUR" class="sref">RTC_ADDR_HOUR"va>,v2a href="+code=bin2bcd" class="sref">bin2bcd"va>(2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_hour" class="sref">tm_hour"va>)); v170"va>        2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(2a href="+code=RTC_ADDR_DAY" class="sref">RTC_ADDR_DAY"va>,v2a href="+code=bin2bcd" class="sref">bin2bcd"va>(2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_wday" class="sref">tm_wday"va>)); v171"va>        2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(2a href="+code=RTC_ADDR_DATE" class="sref">RTC_ADDR_DATE"va>,v2a href="+code=bin2bcd" class="sref">bin2bcd"va>(2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_mday" class="sref">tm_mday"va>)); v172"va>        2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(2a href="+code=RTC_ADDR_MON" class="sref">RTC_ADDR_MON"va>,v2a href="+code=bin2bcd" class="sref">bin2bcd"va>(2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_mon" class="sref">tm_mon"va> + 1)); v173"va>        2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(2a href="+code=RTC_ADDR_YEAR" class="sref">RTC_ADDR_YEAR"va>,v2a href="+code=bin2bcd" class="sref">bin2bcd"va>(2a href="+code=tm" class="sref">tm"va>->2a href="+code=tm_year" class="sref">tm_year"va> %v100)); v1742/a> v175"va>        2spa	 class="comment">/* Start RTC */2/spa	  v176"va>        2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(2a href="+code=RTC_ADDR_SEC" class="sref">RTC_ADDR_SEC"va>,v2a href="+code=ds1302_readbyte" class="sref">ds1302_readbyte"va>(2a href="+code=RTC_ADDR_SEC" class="sref">RTC_ADDR_SEC"va>) & ~0x80); v1772/a> v178"va>        return 0; v179"va>} v1802/a> v1812/a>staticvintv2a href="+code=ds1302_rtc_ioctl" class="sref">ds1302_rtc_ioctl"va>(structv2a href="+code=device" class="sref">device"va> *2a href="+code=dev" class="sref">dev"va>, unsigned intv2a href="+code=cmd" class="sref">cmd"va>, v182"va>                            unsigned longv2a href="+code=arg" class="sref">arg"va>) v183"va>{ v184"va>        switch (2a href="+code=cmd" class="sref">cmd"va>) { v185"va>#ifdefv2a href="+code=RTC_SET_CHARGE" class="sref">RTC_SET_CHARGE2/a> v186"va>        casev2a href="+code=RTC_SET_CHARGE" class="sref">RTC_SET_CHARGE2/a>: v187"va>        { v188"va>                intv2a href="+code=tcs_val" class="sref">tcs_val"va>; v1892/a> v190"va>                if (2a href="+code=copy_from_user" class="sref">copy_from_user"va>(&2a href="+code=tcs_val" class="sref">tcs_val"va>, (intv2a href="+code=__user" class="sref">__user"va> *)2a href="+code=arg" class="sref">arg"va>, sizeof(int))) v191"va>                        return -2a href="+code=EFAULT" class="sref">EFAULT"va>; v1922/a> v193"va>                2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(2a href="+code=RTC_ADDR_TCR" class="sref">RTC_ADDR_TCR"va>, (0xa0 |v2a href="+code=tcs_val" class="sref">tcs_val"va> * 0xf)); v194"va>                return 0; v195"va>        } v196"va>#endif v197"va>        } v1982/a> v199"va>        return -2a href="+code=ENOIOCTLCMD" class="sref">ENOIOCTLCMD"va>; v20="va>} v2012/a> v202"va>staticvstructv2a href="+code=rtc_class_ops" class="sref">rtc_class_ops"va> 2a href="+code=ds1302_rtc_ops" class="sref">ds1302_rtc_ops"va> = { v203"va>        .2a href="+code=read_time" class="sref">read_time"va>      = 2a href="+code=ds1302_rtc_read_time" class="sref">ds1302_rtc_read_time"va>, v204"va>        .2a href="+code=set_time" class="sref">set_time"va>       = 2a href="+code=ds1302_rtc_set_time" class="sref">ds1302_rtc_set_time"va>, v205"va>        .2a href="+code=ioctl" class="sref">ioctl"va>          = 2a href="+code=ds1302_rtc_ioctl" class="sref">ds1302_rtc_ioctl"va>, v206"va>}; v2072/a> v208"va>staticvintv2a href="+code=__init" class="sref">__init"va> 2a href="+code=ds1302_rtc_probe" class="sref">ds1302_rtc_probe"va>(structv2a href="+code=platform_device" class="sref">platform_device"va> *2a href="+code=pdev" class="sref">pdev"va>) v209"va>{ v210"va>        structv2a href="+code=rtc_device" class="sref">rtc_device"va> *2a href="+code=rtc" class="sref">rtc"va>; v2112/a> v212"va>        if (2a href="+code=ds1302_hw_init" class="sref">ds1302_hw_init"va>()) { v213"va>                2a href="+code=dev_err" class="sref">dev_err"va>(&2a href="+code=pdev" class="sref">pdev"va>->2a href="+code=dev" class="sref">dev"va>, 2spa	 class="string">"Failed to init communication channel"2/spa	 ); v214"va>                return -2a href="+code=EINVAL" class="sref">EINVAL"va>; v215"va>        } v216"va> v217"va>        2spa	 class="comment">/* Reset */2/spa	  v218"va>        2a href="+code=ds1302_reset" class="sref">ds1302_reset"va>(); v2192/a> v220"va>        2spa	 class="comment">/* Write a magicvvalue to the DS1302 RAM, and see if it sticks. */2/spa	  v221"va>        2a href="+code=ds1302_writebyte" class="sref">ds1302_writebyte"va>(2a href="+code=RTC_ADDR_RAM0" class="sref">RTC_ADDR_RAM0"va>, 0x42); v222"va>        if (2a href="+code=ds1302_readbyte" class="sref">ds1302_readbyte"va>(2a href="+code=RTC_ADDR_RAM0" class="sref">RTC_ADDR_RAM0"va>) != 0x42) { v223"va>                2a href="+code=dev_err" class="sref">dev_err"va>(&2a href="+code=pdev" class="sref">pdev"va>->2a href="+code=dev" class="sref">dev"va>, 2spa	 class="string">"Failed to probe"2/spa	 ); v224"va>                return -2a href="+code=ENODEV" class="sref">ENODEV"va>; v225"va>        } v226"va> v227"va>        2a href="+code=rtc" class="sref">rtc"va> = 2a href="+code=rtc_device_register" class="sref">rtc_device_register"va>(2spa	 class="string">"ds1302"2/spa	 , &2a href="+code=pdev" class="sref">pdev"va>->2a href="+code=dev" class="sref">dev"va>, v228"va>                                           &2a href="+code=ds1302_rtc_ops" class="sref">ds1302_rtc_ops"va>,v2a href="+code=THIS_MODULE" class="sref">THIS_MODULE"va>); v229"va>        if (2a href="+code=IS_ERR" class="sref">IS_ERR"va>(2a href="+code=rtc" class="sref">rtc"va>)) v230"va>                return 2a href="+code=PTR_ERR" class="sref">PTR_ERR"va>(2a href="+code=rtc" class="sref">rtc"va>); v2312/a> v232"va>        2a href="+code=platform_set_drvdata" class="sref">platform_set_drvdata"va>(2a href="+code=pdev" class="sref">pdev"va>,v2a href="+code=rtc" class="sref">rtc"va>); v2332/a> v234"va>        return 0; v235"va>} v236"va> v237"va>staticvintv2a href="+code=__devexit" class="sref">__devexit"va> 2a href="+code=ds1302_rtc_remove" class="sref">ds1302_rtc_remove"va>(structv2a href="+code=platform_device" class="sref">platform_device"va> *2a href="+code=pdev" class="sref">pdev"va>) v238"va>{ v239"va>        structv2a href="+code=rtc_device" class="sref">rtc_device"va> *2a href="+code=rtc" class="sref">rtc"va> = 2a href="+code=platform_get_drvdata" class="sref">platform_get_drvdata"va>(2a href="+code=pdev" class="sref">pdev"va>); v2402/a> v241"va>        2a href="+code=rtc_device_unregister" class="sref">rtc_device_unregister"va>(2a href="+code=rtc" class="sref">rtc"va>); v242"va>        2a href="+code=platform_set_drvdata" class="sref">platform_set_drvdata"va>(2a href="+code=pdev" class="sref">pdev"va>,v2a href="+code=NULL" class="sref">NULL"va>); v2432/a> v244"va>        return 0; v245"va>} v246"va> v247"va>staticvstructv2a href="+code=platform_driver" class="sref">platform_driver"va> 2a href="+code=ds1302_platform_driver" class="sref">ds1302_platform_driver"va> = { v248"va>        .2a href="+code=driver" class="sref">driver"va>         = { v249"va>                .2a href="+code=namp" class="sref">namp"va>   = 2a href="+code=DRV_NAME" class="sref">DRV_NAME"va>, v250"va>                .2a href="+code=owner" class="sref">owner"va>  = 2a href="+code=THIS_MODULE" class="sref">THIS_MODULE"va>, v251"va>        }, v252"va>        .2a href="+code=remove" class="sref">remove"va>         = 2a href="+code=__devexit_p" class="sref">__devexit_p"va>(2a href="+code=ds1302_rtc_remove" class="sref">ds1302_rtc_remove"va>), v253"va>}; v2542/a> v2552/a>staticvintv2a href="+code=__init" class="sref">__init"va> 2a href="+code=ds1302_rtc_init" class="sref">ds1302_rtc_init"va>(void) v256"va>{ v257"va>        return 2a href="+code=platform_driver_probe" class="sref">platform_driver_probe"va>(&2a href="+code=ds1302_platform_driver" class="sref">ds1302_platform_driver"va>,v2a href="+code=ds1302_rtc_probe" class="sref">ds1302_rtc_probe"va>); v258"va>} v2592/a> v2602/a>staticvvoidv2a href="+code=__exit" class="sref">__exit"va> 2a href="+code=ds1302_rtc_exit" class="sref">ds1302_rtc_exit"va>(void) v261"va>{ v262"va>        2a href="+code=platform_driver_unregister" class="sref">platform_driver_unregister"va>(&2a href="+code=ds1302_platform_driver" class="sref">ds1302_platform_driver"va>); v263"va>} v2642/a> v265"va>2a href="+code=module_init" class="sref">module_init"va>(2a href="+code=ds1302_rtc_init" class="sref">ds1302_rtc_init"va>); v266"va>2a href="+code=module_exit" class="sref">module_exit"va>(2a href="+code=ds1302_rtc_exit" class="sref">ds1302_rtc_exit"va>); v2672/a> v268"va>2a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION"va>(2spa	 class="string">"Dallas DS1302 RTC driver"2/spa	 ); v269"va>2a href="+code=MODULE_VERSION" class="sref">MODULE_VERSION"va>(2a href="+code=DRV_VERSION" class="sref">DRV_VERSION"va>); v270"va>2a href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHOR"va>(2spa	 class="string">"Paul Mundt, DavidvMcCullough"2/spa	 ); v271"va>2a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE"va>(2spa	 class="string">"GPL v2"2/spa	 ); v272"va>
lxr.linux.no kindly hosted by Redpill Linpro AS"va>,vprovider of Linux consulting and operations services sincev1995.