Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *  linux/arch/m68k/hp300/config.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *  This file contains the HP300-specific initialisation code.  It gets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *  called by setup.c.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/console.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/rtc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <asm/bootinfo.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <asm/bootinfo-hp300.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <asm/byteorder.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <asm/machdep.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <asm/blinken.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <asm/io.h>                               /* readb() and writeb() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <asm/hp300hw.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include "time.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) unsigned long hp300_model;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) unsigned long hp300_uart_scode = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) unsigned char hp300_ledstate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) EXPORT_SYMBOL(hp300_ledstate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) static char s_hp330[] __initdata = "330";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) static char s_hp340[] __initdata = "340";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) static char s_hp345[] __initdata = "345";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) static char s_hp360[] __initdata = "360";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) static char s_hp370[] __initdata = "370";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) static char s_hp375[] __initdata = "375";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) static char s_hp380[] __initdata = "380";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) static char s_hp385[] __initdata = "385";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) static char s_hp400[] __initdata = "400";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) static char s_hp425t[] __initdata = "425t";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) static char s_hp425s[] __initdata = "425s";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) static char s_hp425e[] __initdata = "425e";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) static char s_hp433t[] __initdata = "433t";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) static char s_hp433s[] __initdata = "433s";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) static char *hp300_models[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	[HP_320]	= NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	[HP_330]	= s_hp330,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	[HP_340]	= s_hp340,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	[HP_345]	= s_hp345,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	[HP_350]	= NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	[HP_360]	= s_hp360,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	[HP_370]	= s_hp370,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	[HP_375]	= s_hp375,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	[HP_380]	= s_hp380,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	[HP_385]	= s_hp385,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	[HP_400]	= s_hp400,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	[HP_425T]	= s_hp425t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	[HP_425S]	= s_hp425s,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	[HP_425E]	= s_hp425e,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	[HP_433T]	= s_hp433t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	[HP_433S]	= s_hp433s,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) static char hp300_model_name[13] = "HP9000/";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) extern void hp300_reset(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #ifdef CONFIG_SERIAL_8250_CONSOLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) extern int hp300_setup_serial_console(void) __init;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) int __init hp300_parse_bootinfo(const struct bi_record *record)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	int unknown = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	const void *data = record->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	switch (be16_to_cpu(record->tag)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	case BI_HP300_MODEL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		hp300_model = be32_to_cpup(data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	case BI_HP300_UART_SCODE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		hp300_uart_scode = be32_to_cpup(data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	case BI_HP300_UART_ADDR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		/* serial port address: ignored here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		unknown = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	return unknown;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) #ifdef CONFIG_HEARTBEAT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) static void hp300_pulse(int x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	if (x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		blinken_leds(0x10, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		blinken_leds(0, 0x10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) static void hp300_get_model(char *model)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	strcpy(model, hp300_model_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define RTCBASE			0xf0420000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #define RTC_DATA		0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #define RTC_CMD			0x3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #define	RTC_BUSY		0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) #define	RTC_DATA_RDY		0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #define rtc_busy()		(in_8(RTCBASE + RTC_CMD) & RTC_BUSY)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #define rtc_data_available()	(in_8(RTCBASE + RTC_CMD) & RTC_DATA_RDY)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #define rtc_status()		(in_8(RTCBASE + RTC_CMD))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #define rtc_command(x)		out_8(RTCBASE + RTC_CMD, (x))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define rtc_read_data()		(in_8(RTCBASE + RTC_DATA))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #define rtc_write_data(x)	out_8(RTCBASE + RTC_DATA, (x))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define RTC_SETREG	0xe0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #define RTC_WRITEREG	0xc2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #define RTC_READREG	0xc3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #define RTC_REG_SEC2	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #define RTC_REG_SEC1	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #define RTC_REG_MIN2	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) #define RTC_REG_MIN1	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #define RTC_REG_HOUR2	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #define RTC_REG_HOUR1	5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #define RTC_REG_WDAY	6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #define RTC_REG_DAY2	7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #define RTC_REG_DAY1	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #define RTC_REG_MON2	9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #define RTC_REG_MON1	10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #define RTC_REG_YEAR2	11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #define RTC_REG_YEAR1	12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #define RTC_HOUR1_24HMODE 0x8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #define RTC_STAT_MASK	0xf0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #define RTC_STAT_RDY	0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) static inline unsigned char hp300_rtc_read(unsigned char reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	unsigned char s, ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	while (rtc_busy());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	rtc_command(RTC_SETREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	while (rtc_busy());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	rtc_write_data(reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	while (rtc_busy());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	rtc_command(RTC_READREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 		while (!rtc_data_available());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 		s = rtc_status();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		ret = rtc_read_data();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	} while ((s & RTC_STAT_MASK) != RTC_STAT_RDY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) static inline unsigned char hp300_rtc_write(unsigned char reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 					    unsigned char val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	unsigned char s, ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	while (rtc_busy());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	rtc_command(RTC_SETREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	while (rtc_busy());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	rtc_write_data((val << 4) | reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	while (rtc_busy());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	rtc_command(RTC_WRITEREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	while (rtc_busy());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	rtc_command(RTC_READREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		while (!rtc_data_available());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		s = rtc_status();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		ret = rtc_read_data();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	} while ((s & RTC_STAT_MASK) != RTC_STAT_RDY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) static int hp300_hwclk(int op, struct rtc_time *t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	if (!op) { /* read */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		t->tm_sec  = hp300_rtc_read(RTC_REG_SEC1) * 10 +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 			hp300_rtc_read(RTC_REG_SEC2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		t->tm_min  = hp300_rtc_read(RTC_REG_MIN1) * 10 +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 			hp300_rtc_read(RTC_REG_MIN2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		t->tm_hour = (hp300_rtc_read(RTC_REG_HOUR1) & 3) * 10 +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 			hp300_rtc_read(RTC_REG_HOUR2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		t->tm_wday = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 		t->tm_mday = hp300_rtc_read(RTC_REG_DAY1) * 10 +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 			hp300_rtc_read(RTC_REG_DAY2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		t->tm_mon  = hp300_rtc_read(RTC_REG_MON1) * 10 +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 			hp300_rtc_read(RTC_REG_MON2) - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		t->tm_year = hp300_rtc_read(RTC_REG_YEAR1) * 10 +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 			hp300_rtc_read(RTC_REG_YEAR2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		if (t->tm_year <= 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 			t->tm_year += 100;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		hp300_rtc_write(RTC_REG_SEC1, t->tm_sec / 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		hp300_rtc_write(RTC_REG_SEC2, t->tm_sec % 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		hp300_rtc_write(RTC_REG_MIN1, t->tm_min / 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		hp300_rtc_write(RTC_REG_MIN2, t->tm_min % 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		hp300_rtc_write(RTC_REG_HOUR1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 				((t->tm_hour / 10) & 3) | RTC_HOUR1_24HMODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 		hp300_rtc_write(RTC_REG_HOUR2, t->tm_hour % 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 		hp300_rtc_write(RTC_REG_DAY1, t->tm_mday / 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		hp300_rtc_write(RTC_REG_DAY2, t->tm_mday % 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		hp300_rtc_write(RTC_REG_MON1, (t->tm_mon + 1) / 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		hp300_rtc_write(RTC_REG_MON2, (t->tm_mon + 1) % 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		if (t->tm_year >= 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			t->tm_year -= 100;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 		hp300_rtc_write(RTC_REG_YEAR1, t->tm_year / 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		hp300_rtc_write(RTC_REG_YEAR2, t->tm_year % 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) static unsigned int hp300_get_ss(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	return hp300_rtc_read(RTC_REG_SEC1) * 10 +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 		hp300_rtc_read(RTC_REG_SEC2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) static void __init hp300_init_IRQ(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) void __init config_hp300(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	mach_sched_init      = hp300_sched_init;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	mach_init_IRQ        = hp300_init_IRQ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	mach_get_model       = hp300_get_model;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	mach_hwclk	     = hp300_hwclk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	mach_get_ss	     = hp300_get_ss;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	mach_reset           = hp300_reset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) #ifdef CONFIG_HEARTBEAT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	mach_heartbeat       = hp300_pulse;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	mach_max_dma_address = 0xffffffff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	if (hp300_model >= HP_330 && hp300_model <= HP_433S &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	    hp300_model != HP_350) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 		pr_info("Detected HP9000 model %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 			hp300_models[hp300_model-HP_320]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 		strcat(hp300_model_name, hp300_models[hp300_model-HP_320]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 		panic("Unknown HP9000 Model");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) #ifdef CONFIG_SERIAL_8250_CONSOLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	hp300_setup_serial_console();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) }