···11+/*22+ * platform/hardware.h33+ *44+ * This file is subject to the terms and conditions of the GNU General Public55+ * License. See the file "COPYING" in the main directory of this archive66+ * for more details.77+ *88+ * Copyright (C) 2001 Tensilica Inc.99+ */1010+1111+/*1212+ * This file contains the hardware configuration of the XT2000 board.1313+ */1414+1515+#ifndef _XTENSA_XT2000_HARDWARE_H1616+#define _XTENSA_XT2000_HARDWARE_H1717+1818+#include <variant/core.h>1919+#include <asm/io.h>2020+2121+/* 2222+ * Memory configuration.2323+ */2424+2525+#define PLATFORM_DEFAULT_MEM_START 0x000000002626+#define PLATFORM_DEFAULT_MEM_SIZE 0x080000002727+2828+/*2929+ * Number of platform IRQs3030+ */3131+#define PLATFORM_NR_IRQS 33232+/*3333+ * On-board components.3434+ */3535+3636+#define SONIC83934_INTNUM XCHAL_EXTINT3_NUM3737+#define SONIC83934_ADDR IOADDR(0x0d030000)3838+3939+/*4040+ * V3-PCI4141+ */4242+4343+/* The XT2000 uses the V3 as a cascaded interrupt controller for the PCI bus */4444+4545+#define IRQ_PCI_A (XCHAL_NUM_INTERRUPTS + 0)4646+#define IRQ_PCI_B (XCHAL_NUM_INTERRUPTS + 1)4747+#define IRQ_PCI_C (XCHAL_NUM_INTERRUPTS + 2)4848+4949+/*5050+ * Various other components.5151+ */5252+5353+#define XT2000_LED_ADDR IOADDR(0x0d040000)5454+5555+#endif /* _XTENSA_XT2000_HARDWARE_H */
···11+/*22+ * platform/serial.h33+ *44+ * This file is subject to the terms and conditions of the GNU General Public55+ * License. See the file "COPYING" in the main directory of this archive66+ * for more details.77+ *88+ * Copyright (C) 2001 Tensilica Inc.99+ */1010+1111+#ifndef _XTENSA_XT2000_SERIAL_H1212+#define _XTENSA_XT2000_SERIAL_H1313+1414+#include <variant/core.h>1515+#include <asm/io.h>1616+1717+/* National-Semi PC16552D DUART: */1818+1919+#define DUART16552_1_INTNUM XCHAL_EXTINT4_NUM2020+#define DUART16552_2_INTNUM XCHAL_EXTINT5_NUM2121+2222+#define DUART16552_1_ADDR IOADDR(0x0d050020) /* channel 1 */2323+#define DUART16552_2_ADDR IOADDR(0x0d050000) /* channel 2 */2424+2525+#define DUART16552_XTAL_FREQ 18432000 /* crystal frequency in Hz */2626+#define BASE_BAUD ( DUART16552_XTAL_FREQ / 16 )2727+2828+#endif /* _XTENSA_XT2000_SERIAL_H */
+181
arch/xtensa/platforms/xt2000/setup.c
···11+/*22+ * arch/xtensa/platforms/xt2000/setup.c33+ *44+ * Platform specific functions for the XT2000 board.55+ *66+ * Authors: Chris Zankel <chris@zankel.net>77+ * Joe Taylor <joe@tensilica.com>88+ *99+ * Copyright 2001 - 2004 Tensilica Inc.1010+ *1111+ * This program is free software; you can redistribute it and/or modify it1212+ * under the terms of the GNU General Public License as published by the1313+ * Free Software Foundation; either version 2 of the License, or (at your1414+ * option) any later version.1515+ *1616+ */1717+#include <linux/stddef.h>1818+#include <linux/kernel.h>1919+#include <linux/init.h>2020+#include <linux/errno.h>2121+#include <linux/reboot.h>2222+#include <linux/kdev_t.h>2323+#include <linux/types.h>2424+#include <linux/major.h>2525+#include <linux/console.h>2626+#include <linux/delay.h>2727+#include <linux/stringify.h>2828+#include <linux/platform_device.h>2929+#include <linux/serial.h>3030+#include <linux/serial_8250.h>3131+3232+#include <asm/processor.h>3333+#include <asm/platform.h>3434+#include <asm/bootparam.h>3535+#include <platform/hardware.h>3636+#include <platform/serial.h>3737+3838+/* Assumes s points to an 8-chr string. No checking for NULL. */3939+4040+static void led_print (int f, char *s)4141+{4242+ unsigned long* led_addr = (unsigned long*) (XT2000_LED_ADDR + 0xE0) + f;4343+ int i;4444+ for (i = f; i < 8; i++)4545+ if ((*led_addr++ = *s++) == 0)4646+ break;4747+}4848+4949+void platform_halt(void)5050+{5151+ led_print (0, " HALT ");5252+ local_irq_disable();5353+ while (1);5454+}5555+5656+void platform_power_off(void)5757+{5858+ led_print (0, "POWEROFF");5959+ local_irq_disable();6060+ while (1);6161+}6262+6363+void platform_restart(void)6464+{6565+ /* Flush and reset the mmu, simulate a processor reset, and6666+ * jump to the reset vector. */6767+6868+ __asm__ __volatile__ ("movi a2, 15\n\t"6969+ "wsr a2, " __stringify(ICOUNTLEVEL) "\n\t"7070+ "movi a2, 0\n\t"7171+ "wsr a2, " __stringify(ICOUNT) "\n\t"7272+ "wsr a2, " __stringify(IBREAKENABLE) "\n\t"7373+ "wsr a2, " __stringify(LCOUNT) "\n\t"7474+ "movi a2, 0x1f\n\t"7575+ "wsr a2, " __stringify(PS) "\n\t"7676+ "isync\n\t"7777+ "jx %0\n\t"7878+ :7979+ : "a" (XCHAL_RESET_VECTOR_VADDR)8080+ : "a2"8181+ );8282+8383+ /* control never gets here */8484+}8585+8686+void __init platform_setup(char** cmdline)8787+{8888+ led_print (0, "LINUX ");8989+}9090+9191+/* early initialization */9292+9393+extern sysmem_info_t __initdata sysmem;9494+9595+void platform_init(bp_tag_t* first)9696+{9797+ /* Set default memory block if not provided by the bootloader. */9898+9999+ if (sysmem.nr_banks == 0) {100100+ sysmem.nr_banks = 1;101101+ sysmem.bank[0].start = PLATFORM_DEFAULT_MEM_START;102102+ sysmem.bank[0].end = PLATFORM_DEFAULT_MEM_START103103+ + PLATFORM_DEFAULT_MEM_SIZE;104104+ }105105+}106106+107107+/* Heartbeat. Let the LED blink. */108108+109109+void platform_heartbeat(void)110110+{111111+ static int i=0, t = 0;112112+113113+ if (--t < 0)114114+ {115115+ t = 59;116116+ led_print(7, i ? ".": " ");117117+ i ^= 1;118118+ }119119+}120120+121121+//#define RS_TABLE_SIZE 2122122+//#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)123123+124124+#define _SERIAL_PORT(_base,_irq) \125125+{ \126126+ .mapbase = (_base), \127127+ .membase = (void*)(_base), \128128+ .irq = (_irq), \129129+ .uartclk = DUART16552_XTAL_FREQ, \130130+ .iotype = UPIO_MEM, \131131+ .flags = UPF_BOOT_AUTOCONF, \132132+ .regshift = 2, \133133+}134134+135135+static struct plat_serial8250_port xt2000_serial_data[] = {136136+#if XCHAL_HAVE_BE137137+ _SERIAL_PORT(DUART16552_1_ADDR + 3, DUART16552_1_INTNUM),138138+ _SERIAL_PORT(DUART16552_2_ADDR + 3, DUART16552_2_INTNUM),139139+#else140140+ _SERIAL_PORT(DUART16552_1_ADDR, DUART16552_1_INTNUM),141141+ _SERIAL_PORT(DUART16552_2_ADDR, DUART16552_2_INTNUM),142142+#endif143143+ { }144144+};145145+146146+static struct platform_device xt2000_serial8250_device = {147147+ .name = "serial8250",148148+ .id = PLAT8250_DEV_PLATFORM,149149+ .dev = {150150+ .platform_data = xt2000_serial_data,151151+ },152152+};153153+154154+static struct resource xt2000_sonic_res[] = {155155+ {156156+ .start = SONIC83934_ADDR,157157+ .end = SONIC83934_ADDR + 0xff,158158+ .flags = IORESOURCE_MEM,159159+ },160160+ {161161+ .start = SONIC83934_INTNUM,162162+ .end = SONIC83934_INTNUM,163163+ .flags = IORESOURCE_IRQ,164164+ },165165+};166166+167167+static struct platform_device xt2000_sonic_device = {168168+ .name = "xtsonic",169169+ .num_resources = ARRAY_SIZE(xt2000_sonic_res),170170+ .resource = xt2000_sonic_res,171171+};172172+173173+static int __init xt2000_setup_devinit(void)174174+{175175+ platform_device_register(&xt2000_serial8250_device);176176+ platform_device_register(&xt2000_sonic_device);177177+178178+ return 0;179179+}180180+181181+device_initcall(xt2000_setup_devinit);