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

TOMOYO Linux Cross Reference
Linux/arch/xtensa/platforms/xt2000/setup.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*
  3  * arch/xtensa/platforms/xt2000/setup.c
  4  *
  5  * Platform specific functions for the XT2000 board.
  6  *
  7  * Authors:     Chris Zankel <chris@zankel.net>
  8  *              Joe Taylor <joe@tensilica.com>
  9  *
 10  * Copyright 2001 - 2004 Tensilica Inc.
 11  */
 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>
 26 #include <linux/timer.h>
 27 
 28 #include <asm/processor.h>
 29 #include <asm/platform.h>
 30 #include <asm/bootparam.h>
 31 #include <platform/hardware.h>
 32 #include <platform/serial.h>
 33 
 34 /* Assumes s points to an 8-chr string.  No checking for NULL. */
 35 
 36 static void led_print (int f, char *s)
 37 {
 38         unsigned long* led_addr = (unsigned long*) (XT2000_LED_ADDR + 0xE0) + f;
 39         int i;
 40         for (i = f; i < 8; i++)
 41                 if ((*led_addr++ = *s++) == 0)
 42                     break;
 43 }
 44 
 45 static int xt2000_power_off(struct sys_off_data *unused)
 46 {
 47         led_print (0, "POWEROFF");
 48         local_irq_disable();
 49         while (1);
 50         return NOTIFY_DONE;
 51 }
 52 
 53 static int xt2000_restart(struct notifier_block *this,
 54                           unsigned long event, void *ptr)
 55 {
 56         /* Flush and reset the mmu, simulate a processor reset, and
 57          * jump to the reset vector. */
 58         cpu_reset();
 59 
 60         return NOTIFY_DONE;
 61 }
 62 
 63 static struct notifier_block xt2000_restart_block = {
 64         .notifier_call = xt2000_restart,
 65 };
 66 
 67 void __init platform_setup(char** cmdline)
 68 {
 69         led_print (0, "LINUX   ");
 70 }
 71 
 72 /* Heartbeat. Let the LED blink. */
 73 
 74 static void xt2000_heartbeat(struct timer_list *unused);
 75 
 76 static DEFINE_TIMER(heartbeat_timer, xt2000_heartbeat);
 77 
 78 static void xt2000_heartbeat(struct timer_list *unused)
 79 {
 80         static int i;
 81 
 82         led_print(7, i ? "." : " ");
 83         i ^= 1;
 84         mod_timer(&heartbeat_timer, jiffies + HZ / 2);
 85 }
 86 
 87 //#define RS_TABLE_SIZE 2
 88 
 89 #define _SERIAL_PORT(_base,_irq)                                        \
 90 {                                                                       \
 91         .mapbase        = (_base),                                      \
 92         .membase        = (void*)(_base),                               \
 93         .irq            = (_irq),                                       \
 94         .uartclk        = DUART16552_XTAL_FREQ,                         \
 95         .iotype         = UPIO_MEM,                                     \
 96         .flags          = UPF_BOOT_AUTOCONF,                            \
 97         .regshift       = 2,                                            \
 98 }
 99 
100 static struct plat_serial8250_port xt2000_serial_data[] = {
101 #if XCHAL_HAVE_BE
102         _SERIAL_PORT(DUART16552_1_ADDR + 3, DUART16552_1_INTNUM),
103         _SERIAL_PORT(DUART16552_2_ADDR + 3, DUART16552_2_INTNUM),
104 #else
105         _SERIAL_PORT(DUART16552_1_ADDR, DUART16552_1_INTNUM),
106         _SERIAL_PORT(DUART16552_2_ADDR, DUART16552_2_INTNUM),
107 #endif
108         { }
109 };
110 
111 static struct platform_device xt2000_serial8250_device = {
112         .name           = "serial8250",
113         .id             = PLAT8250_DEV_PLATFORM,
114         .dev            = {
115             .platform_data = xt2000_serial_data,
116         },
117 };
118 
119 static struct resource xt2000_sonic_res[] = {
120         {
121                 .start = SONIC83934_ADDR,
122                 .end   = SONIC83934_ADDR + 0xff,
123                 .flags = IORESOURCE_MEM,
124         },
125         {
126                 .start = SONIC83934_INTNUM,
127                 .end = SONIC83934_INTNUM,
128                 .flags = IORESOURCE_IRQ,
129         },
130 };
131 
132 static struct platform_device xt2000_sonic_device = {
133         .name           = "xtsonic",
134         .num_resources  = ARRAY_SIZE(xt2000_sonic_res),
135         .resource               = xt2000_sonic_res,
136 };
137 
138 static int __init xt2000_setup_devinit(void)
139 {
140         platform_device_register(&xt2000_serial8250_device);
141         platform_device_register(&xt2000_sonic_device);
142         mod_timer(&heartbeat_timer, jiffies + HZ / 2);
143         register_restart_handler(&xt2000_restart_block);
144         register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
145                                  SYS_OFF_PRIO_DEFAULT,
146                                  xt2000_power_off, NULL);
147         return 0;
148 }
149 
150 device_initcall(xt2000_setup_devinit);
151 

~ [ 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