1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * arch/xtensa/platforms/xt2000/setup.c
5 * Platform specific functions for the XT2000 board.
7 * Authors: Chris Zankel <chris@zankel.net>
8 * Joe Taylor <joe@tensilica.com>
10 * Copyright 2001 - 2004 Tensilica Inc.
12 #include <linux/stddef.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/errno.h>
16 #include <linux/reboot.h>
17 #include <linux/kdev_t.h>
18 #include <linux/types.h>
19 #include <linux/major.h>
20 #include <linux/console.h>
21 #include <linux/delay.h>
22 #include <linux/stringify.h>
23 #include <linux/platform_device.h>
24 #include <linux/serial.h>
25 #include <linux/serial_8250.h>
27 #include <asm/processor.h>
28 #include <asm/platform.h>
29 #include <asm/bootparam.h>
30 #include <platform/hardware.h>
31 #include <platform/serial.h>
33 /* Assumes s points to an 8-chr string. No checking for NULL. */
35 static void led_print (int f
, char *s
)
37 unsigned long* led_addr
= (unsigned long*) (XT2000_LED_ADDR
+ 0xE0) + f
;
39 for (i
= f
; i
< 8; i
++)
40 if ((*led_addr
++ = *s
++) == 0)
44 void platform_halt(void)
46 led_print (0, " HALT ");
51 void platform_power_off(void)
53 led_print (0, "POWEROFF");
58 void platform_restart(void)
60 /* Flush and reset the mmu, simulate a processor reset, and
61 * jump to the reset vector. */
63 /* control never gets here */
66 void __init
platform_setup(char** cmdline
)
68 led_print (0, "LINUX ");
71 /* early initialization */
73 void __init
platform_init(bp_tag_t
*first
)
77 /* Heartbeat. Let the LED blink. */
79 void platform_heartbeat(void)
81 static int i
=0, t
= 0;
86 led_print(7, i
? ".": " ");
91 //#define RS_TABLE_SIZE 2
93 #define _SERIAL_PORT(_base,_irq) \
96 .membase = (void*)(_base), \
98 .uartclk = DUART16552_XTAL_FREQ, \
100 .flags = UPF_BOOT_AUTOCONF, \
104 static struct plat_serial8250_port xt2000_serial_data
[] = {
106 _SERIAL_PORT(DUART16552_1_ADDR
+ 3, DUART16552_1_INTNUM
),
107 _SERIAL_PORT(DUART16552_2_ADDR
+ 3, DUART16552_2_INTNUM
),
109 _SERIAL_PORT(DUART16552_1_ADDR
, DUART16552_1_INTNUM
),
110 _SERIAL_PORT(DUART16552_2_ADDR
, DUART16552_2_INTNUM
),
115 static struct platform_device xt2000_serial8250_device
= {
116 .name
= "serial8250",
117 .id
= PLAT8250_DEV_PLATFORM
,
119 .platform_data
= xt2000_serial_data
,
123 static struct resource xt2000_sonic_res
[] = {
125 .start
= SONIC83934_ADDR
,
126 .end
= SONIC83934_ADDR
+ 0xff,
127 .flags
= IORESOURCE_MEM
,
130 .start
= SONIC83934_INTNUM
,
131 .end
= SONIC83934_INTNUM
,
132 .flags
= IORESOURCE_IRQ
,
136 static struct platform_device xt2000_sonic_device
= {
138 .num_resources
= ARRAY_SIZE(xt2000_sonic_res
),
139 .resource
= xt2000_sonic_res
,
142 static int __init
xt2000_setup_devinit(void)
144 platform_device_register(&xt2000_serial8250_device
);
145 platform_device_register(&xt2000_sonic_device
);
150 device_initcall(xt2000_setup_devinit
);