Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 641
b: refs/heads/master
c: a497aa2
h: refs/heads/master
i:
  639: 013b7b9
v: v3
  • Loading branch information
Chris Elston authored and Linus Torvalds committed May 1, 2005
1 parent db62f67 commit 9f89fc3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 630710e3f72b6a324a525f6e5db3f7985d0fc4a2
refs/heads/master: a497aa20e5ea54fdee474192d6dc138b4832fc9e
42 changes: 42 additions & 0 deletions trunk/arch/ppc/platforms/radstone_ppc7d.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,19 @@
#define PPC7D_RST_PIN 17 /* GPP17 */

extern u32 mv64360_irq_base;
extern spinlock_t rtc_lock;

static struct mv64x60_handle bh;
static int ppc7d_has_alma;

extern void gen550_progress(char *, unsigned short);
extern void gen550_init(int, struct uart_port *);

/* FIXME - move to h file */
extern int ds1337_do_command(int id, int cmd, void *arg);
#define DS1337_GET_DATE 0
#define DS1337_SET_DATE 1

/* residual data */
unsigned char __res[sizeof(bd_t)];

Expand Down Expand Up @@ -1242,6 +1248,38 @@ static void __init ppc7d_setup_arch(void)
printk(KERN_INFO "Radstone Technology PPC7D\n");
if (ppc_md.progress)
ppc_md.progress("ppc7d_setup_arch: exit", 0);

}

/* Real Time Clock support.
* PPC7D has a DS1337 accessed by I2C.
*/
static ulong ppc7d_get_rtc_time(void)
{
struct rtc_time tm;
int result;

spin_lock(&rtc_lock);
result = ds1337_do_command(0, DS1337_GET_DATE, &tm);
spin_unlock(&rtc_lock);

if (result == 0)
result = mktime(tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);

return result;
}

static int ppc7d_set_rtc_time(unsigned long nowtime)
{
struct rtc_time tm;
int result;

spin_lock(&rtc_lock);
to_tm(nowtime, &tm);
result = ds1337_do_command(0, DS1337_SET_DATE, &tm);
spin_unlock(&rtc_lock);

return result;
}

/* This kernel command line parameter can be used to have the target
Expand Down Expand Up @@ -1299,6 +1337,10 @@ static void ppc7d_init2(void)
data8 |= 0x07;
outb(data8, PPC7D_CPLD_LEDS);

/* Hook up RTC. We couldn't do this earlier because we need the I2C subsystem */
ppc_md.set_rtc_time = ppc7d_set_rtc_time;
ppc_md.get_rtc_time = ppc7d_get_rtc_time;

pr_debug("%s: exit\n", __FUNCTION__);
}

Expand Down

0 comments on commit 9f89fc3

Please sign in to comment.