int __init ds1302_init(void) { #ifdef CONFIG_ETRAX_I2C i2c_init(); #endif if (!ds1302_probe()) { #ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT #if CONFIG_ETRAX_DS1302_RSTBIT == 27 /* * The only way to set g27 to output is to enable ATA. * * Make sure that R_GEN_CONFIG is setup correct. */ /* Allocating the ATA interface will grab almost all * pins in I/O groups a, b, c and d. A consequence of * allocating the ATA interface is that the fixed * interfaces shared RAM, parallel port 0, parallel * port 1, parallel port W, SCSI-8 port 0, SCSI-8 port * 1, SCSI-W, serial port 2, serial port 3, * synchronous serial port 3 and USB port 2 and almost * all GPIO pins on port g cannot be used. */ if (cris_request_io_interface(if_ata, "ds1302/ATA")) { printk(KERN_WARNING "ds1302: Failed to get IO interface\n"); return -1; } #elif CONFIG_ETRAX_DS1302_RSTBIT == 0 if (cris_io_interface_allocate_pins(if_gpio_grp_a, 'g', CONFIG_ETRAX_DS1302_RSTBIT, CONFIG_ETRAX_DS1302_RSTBIT)) { printk(KERN_WARNING "ds1302: Failed to get IO interface\n"); return -1; } /* Set the direction of this bit to out. */ genconfig_shadow = ((genconfig_shadow & ~IO_MASK(R_GEN_CONFIG, g0dir)) | (IO_STATE(R_GEN_CONFIG, g0dir, out))); *R_GEN_CONFIG = genconfig_shadow; #endif if (!ds1302_probe()) { printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name); return -1; } #else printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name); return -1; #endif } /* Initialise trickle charger */ ds1302_writereg(RTC_TRICKLECHARGER, RTC_TCR_PATTERN |(CONFIG_ETRAX_DS1302_TRICKLE_CHARGE & 0x0F)); /* Start clock by resetting CLOCK_HALT */ ds1302_writereg(RTC_SECONDS, (ds1302_readreg(RTC_SECONDS) & 0x7F)); return 0; }
int __init ds1302_init(void) { if (!ds1302_probe()) { #ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT /* * The only way to set g27 to output is to enable ATA. * * Make sure that R_GEN_CONFIG is setup correct. */ genconfig_shadow = ((genconfig_shadow & ~IO_MASK(R_GEN_CONFIG, ata)) | (IO_STATE(R_GEN_CONFIG, ata, select))); *R_GEN_CONFIG = genconfig_shadow; if (!ds1302_probe()) return -1; #else return -1; #endif } if (register_chrdev(RTC_MAJOR_NR, ds1302_name, &rtc_fops)) { printk(KERN_INFO "%s: unable to get major %d for rtc\n", ds1302_name, RTC_MAJOR_NR); return -1; } return 0; }
int __init ds1302_init(void) { if (!ds1302_probe()) { #ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT #if CONFIG_ETRAX_DS1302_RSTBIT == 27 /* * The only way to set g27 to output is to enable ATA. * * Make sure that R_GEN_CONFIG is setup correct. */ genconfig_shadow = ((genconfig_shadow & ~IO_MASK(R_GEN_CONFIG, ata)) | (IO_STATE(R_GEN_CONFIG, ata, select))); *R_GEN_CONFIG = genconfig_shadow; #elif CONFIG_ETRAX_DS1302_RSTBIT == 0 /* Set the direction of this bit to out. */ genconfig_shadow = ((genconfig_shadow & ~IO_MASK(R_GEN_CONFIG, g0dir)) | (IO_STATE(R_GEN_CONFIG, g0dir, out))); *R_GEN_CONFIG = genconfig_shadow; #endif if (!ds1302_probe()) return -1; #else return -1; #endif } /* Initialise trickle charger */ ds1302_writereg(RTC_TRICKLECHARGER, RTC_TCR_PATTERN |(CONFIG_ETRAX_DS1302_TRICKLE_CHARGE & 0x0F)); return 0; }
int __init ds1302_init(void) { if (!ds1302_probe()) { return -1; } return 0; }
int __init ds1302_init(void) { i2c_init(); if (!ds1302_probe()) { #ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT #if CONFIG_ETRAX_DS1302_RSTBIT == 27 /* * The only way to set g27 to output is to enable ATA. * * Make sure that R_GEN_CONFIG is setup correct. */ genconfig_shadow = ((genconfig_shadow & ~IO_MASK(R_GEN_CONFIG, ata)) | (IO_STATE(R_GEN_CONFIG, ata, select))); *R_GEN_CONFIG = genconfig_shadow; #elif CONFIG_ETRAX_DS1302_RSTBIT == 0 /* Set the direction of this bit to out. */ genconfig_shadow = ((genconfig_shadow & ~IO_MASK(R_GEN_CONFIG, g0dir)) | (IO_STATE(R_GEN_CONFIG, g0dir, out))); *R_GEN_CONFIG = genconfig_shadow; #endif if (!ds1302_probe()) { printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name); return -1; } #else printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name); return -1; #endif } /* Initialise trickle charger */ ds1302_writereg(RTC_TRICKLECHARGER, RTC_TCR_PATTERN |(CONFIG_ETRAX_DS1302_TRICKLE_CHARGE & 0x0F)); /* Start clock by resetting CLOCK_HALT */ ds1302_writereg(RTC_SECONDS, (ds1302_readreg(RTC_SECONDS) & 0x7F)); return 0; }