linux/arch/xtensa/platforms/iss/setup.c
<<
>>
Prefs
   1/*
   2 *
   3 * arch/xtensa/platform-iss/setup.c
   4 *
   5 * Platform specific initialization.
   6 *
   7 * Authors: Chris Zankel <chris@zankel.net>
   8 *          Joe Taylor <joe@tensilica.com>
   9 *
  10 * Copyright 2001 - 2005 Tensilica Inc.
  11 *
  12 * This program is free software; you can redistribute  it and/or modify it
  13 * under  the terms of  the GNU General  Public License as published by the
  14 * Free Software Foundation;  either version 2 of the  License, or (at your
  15 * option) any later version.
  16 *
  17 */
  18#include <linux/stddef.h>
  19#include <linux/kernel.h>
  20#include <linux/init.h>
  21#include <linux/errno.h>
  22#include <linux/reboot.h>
  23#include <linux/kdev_t.h>
  24#include <linux/types.h>
  25#include <linux/major.h>
  26#include <linux/blkdev.h>
  27#include <linux/console.h>
  28#include <linux/delay.h>
  29#include <linux/stringify.h>
  30#include <linux/notifier.h>
  31
  32#include <asm/platform.h>
  33#include <asm/bootparam.h>
  34
  35
  36void __init platform_init(bp_tag_t* bootparam)
  37{
  38
  39}
  40
  41void platform_halt(void)
  42{
  43        printk (" ** Called platform_halt(), looping forever! **\n");
  44        while (1);
  45}
  46
  47void platform_power_off(void)
  48{
  49        printk (" ** Called platform_power_off(), looping forever! **\n");
  50        while (1);
  51}
  52void platform_restart(void)
  53{
  54        /* Flush and reset the mmu, simulate a processor reset, and
  55         * jump to the reset vector. */
  56
  57        __asm__ __volatile__("movi      a2, 15\n\t"
  58                             "wsr       a2, " __stringify(ICOUNTLEVEL) "\n\t"
  59                             "movi      a2, 0\n\t"
  60                             "wsr       a2, " __stringify(ICOUNT) "\n\t"
  61                             "wsr       a2, " __stringify(IBREAKENABLE) "\n\t"
  62                             "wsr       a2, " __stringify(LCOUNT) "\n\t"
  63                             "movi      a2, 0x1f\n\t"
  64                             "wsr       a2, " __stringify(PS) "\n\t"
  65                             "isync\n\t"
  66                             "jx        %0\n\t"
  67                             :
  68                             : "a" (XCHAL_RESET_VECTOR_VADDR)
  69                             : "a2");
  70
  71        /* control never gets here */
  72}
  73
  74extern void iss_net_poll(void);
  75
  76const char twirl[]="|/-\\|/-\\";
  77
  78void platform_heartbeat(void)
  79{
  80#if 0
  81        static int i = 0, j = 0;
  82
  83        if (--i < 0) {
  84                i = 99;
  85                printk("\r%c\r", twirl[j++]);
  86                if (j == 8)
  87                        j = 0;
  88        }
  89#endif
  90}
  91
  92
  93
  94static int
  95iss_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
  96{
  97        __asm__ __volatile__("movi a2, -1; simcall\n");
  98        return NOTIFY_DONE;
  99}
 100
 101static struct notifier_block iss_panic_block = {
 102        iss_panic_event,
 103        NULL,
 104        0
 105};
 106
 107void __init platform_setup(char **p_cmdline)
 108{
 109        atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
 110}
 111