David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Carsten Langgaard, carstenl@mips.com |
| 4 | * Copyright (C) 1999 MIPS Technologies, Inc. All rights reserved. |
| 5 | * |
| 6 | * Thomas Horsten <thh@lasat.com> |
| 7 | * Copyright (C) 2000 LASAT Networks A/S. |
| 8 | * |
| 9 | * Brian Murphy <brian@murphy.dk> |
| 10 | * |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 11 | * Lasat specific setup. |
| 12 | */ |
| 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> |
| 18 | |
| 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> |
| 25 | |
| 26 | #ifdef CONFIG_PICVUE |
| 27 | #include <linux/notifier.h> |
| 28 | #endif |
| 29 | |
| 30 | #include "ds1603.h" |
| 31 | #include <asm/lasat/ds1603.h> |
| 32 | #include <asm/lasat/picvue.h> |
| 33 | #include <asm/lasat/eeprom.h> |
| 34 | |
| 35 | #include "prom.h" |
| 36 | |
| 37 | int lasat_command_line; |
| 38 | void lasatint_init(void); |
| 39 | |
| 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); |
| 44 | |
| 45 | struct lasat_misc lasat_misc_info[N_MACHTYPES] = { |
| 46 | { |
| 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 |
| 52 | } |
| 53 | }; |
| 54 | |
| 55 | struct lasat_misc *lasat_misc; |
| 56 | |
| 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 } |
| 65 | }; |
| 66 | #endif |
| 67 | |
| 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 } |
| 75 | }; |
| 76 | #endif |
| 77 | |
| 78 | static int lasat_panic_display(struct notifier_block *this, |
| 79 | unsigned long event, void *ptr) |
| 80 | { |
| 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; |
| 88 | } |
| 89 | |
| 90 | static int lasat_panic_prom_monitor(struct notifier_block *this, |
| 91 | unsigned long event, void *ptr) |
| 92 | { |
| 93 | prom_monitor(); |
| 94 | return NOTIFY_DONE; |
| 95 | } |
| 96 | |
| 97 | static struct notifier_block lasat_panic_block[] = |
| 98 | { |
| 99 | { |
| 100 | .notifier_call = lasat_panic_display, |
| 101 | .priority = INT_MAX |
| 102 | }, { |
| 103 | .notifier_call = lasat_panic_prom_monitor, |
| 104 | .priority = INT_MIN |
| 105 | } |
| 106 | }; |
| 107 | |
| 108 | void __init plat_time_init(void) |
| 109 | { |
| 110 | mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2; |
| 111 | |
| 112 | change_c0_status(ST0_IM, IE_IRQ0); |
| 113 | } |
| 114 | |
| 115 | void __init plat_mem_setup(void) |
| 116 | { |
| 117 | int i; |
| 118 | int lasat_type = IS_LASAT_200() ? 1 : 0; |
| 119 | |
| 120 | lasat_misc = &lasat_misc_info[lasat_type]; |
| 121 | #ifdef CONFIG_PICVUE |
| 122 | picvue = &pvc_defs[lasat_type]; |
| 123 | #endif |
| 124 | |
| 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]); |
| 129 | |
| 130 | lasat_reboot_setup(); |
| 131 | |
| 132 | #ifdef CONFIG_DS1603 |
| 133 | ds1603 = &ds_defs[lasat_type]; |
| 134 | #endif |
| 135 | |
| 136 | #ifdef DYNAMIC_SERIAL_INIT |
| 137 | serial_init(); |
| 138 | #endif |
| 139 | |
| 140 | pr_info("Lasat specific initialization complete\n"); |
| 141 | } |