~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/m68k/hp300/config.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/m68k/hp300/config.c (Version linux-6.12-rc7) and /arch/m68k/hp300/config.c (Version linux-4.14.336)


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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php