treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / mips / lasat / setup.c
blob0743243fd86d3cb4f7370b66cad5db3859b1690e
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Carsten Langgaard, carstenl@mips.com
4 * Copyright (C) 1999 MIPS Technologies, Inc. All rights reserved.
6 * Thomas Horsten <thh@lasat.com>
7 * Copyright (C) 2000 LASAT Networks A/S.
9 * Brian Murphy <brian@murphy.dk>
11 * Lasat specific setup.
13 #include <linux/init.h>
14 #include <linux/sched.h>
15 #include <linux/pci.h>
16 #include <linux/interrupt.h>
17 #include <linux/tty.h>
19 #include <asm/time.h>
20 #include <asm/cpu.h>
21 #include <asm/bootinfo.h>
22 #include <asm/irq.h>
23 #include <asm/lasat/lasat.h>
24 #include <asm/lasat/serial.h>
26 #ifdef CONFIG_PICVUE
27 #include <linux/notifier.h>
28 #endif
30 #include "ds1603.h"
31 #include <asm/lasat/ds1603.h>
32 #include <asm/lasat/picvue.h>
33 #include <asm/lasat/eeprom.h>
35 #include "prom.h"
37 int lasat_command_line;
38 void lasatint_init(void);
40 extern void lasat_reboot_setup(void);
41 extern void pcisetup(void);
42 extern void edhac_init(void *, void *, void *);
43 extern void addrflt_init(void);
45 struct lasat_misc lasat_misc_info[N_MACHTYPES] = {
47 .reset_reg = (void *)KSEG1ADDR(0x1c840000),
48 .flash_wp_reg = (void *)KSEG1ADDR(0x1c800000), 2
49 }, {
50 .reset_reg = (void *)KSEG1ADDR(0x11080000),
51 .flash_wp_reg = (void *)KSEG1ADDR(0x11000000), 6
55 struct lasat_misc *lasat_misc;
57 #ifdef CONFIG_DS1603
58 static struct ds_defs ds_defs[N_MACHTYPES] = {
59 { (void *)DS1603_REG_100, (void *)DS1603_REG_100,
60 DS1603_RST_100, DS1603_CLK_100, DS1603_DATA_100,
61 DS1603_DATA_SHIFT_100, 0, 0 },
62 { (void *)DS1603_REG_200, (void *)DS1603_DATA_REG_200,
63 DS1603_RST_200, DS1603_CLK_200, DS1603_DATA_200,
64 DS1603_DATA_READ_SHIFT_200, 1, 2000 }
66 #endif
68 #ifdef CONFIG_PICVUE
69 #include "picvue.h"
70 static struct pvc_defs pvc_defs[N_MACHTYPES] = {
71 { (void *)PVC_REG_100, PVC_DATA_SHIFT_100, PVC_DATA_M_100,
72 PVC_E_100, PVC_RW_100, PVC_RS_100 },
73 { (void *)PVC_REG_200, PVC_DATA_SHIFT_200, PVC_DATA_M_200,
74 PVC_E_200, PVC_RW_200, PVC_RS_200 }
76 #endif
78 static int lasat_panic_display(struct notifier_block *this,
79 unsigned long event, void *ptr)
81 #ifdef CONFIG_PICVUE
82 unsigned char *string = ptr;
83 if (string == NULL)
84 string = "Kernel Panic";
85 pvc_dump_string(string);
86 #endif
87 return NOTIFY_DONE;
90 static int lasat_panic_prom_monitor(struct notifier_block *this,
91 unsigned long event, void *ptr)
93 prom_monitor();
94 return NOTIFY_DONE;
97 static struct notifier_block lasat_panic_block[] =
100 .notifier_call = lasat_panic_display,
101 .priority = INT_MAX
102 }, {
103 .notifier_call = lasat_panic_prom_monitor,
104 .priority = INT_MIN
108 void __init plat_time_init(void)
110 mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2;
112 change_c0_status(ST0_IM, IE_IRQ0);
115 void __init plat_mem_setup(void)
117 int i;
118 int lasat_type = IS_LASAT_200() ? 1 : 0;
120 lasat_misc = &lasat_misc_info[lasat_type];
121 #ifdef CONFIG_PICVUE
122 picvue = &pvc_defs[lasat_type];
123 #endif
125 /* Set up panic notifier */
126 for (i = 0; i < ARRAY_SIZE(lasat_panic_block); i++)
127 atomic_notifier_chain_register(&panic_notifier_list,
128 &lasat_panic_block[i]);
130 lasat_reboot_setup();
132 #ifdef CONFIG_DS1603
133 ds1603 = &ds_defs[lasat_type];
134 #endif
136 #ifdef DYNAMIC_SERIAL_INIT
137 serial_init();
138 #endif
140 pr_info("Lasat specific initialization complete\n");