root/arch/mips/emma/markeins/setup.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. markeins_machine_restart
  2. markeins_machine_halt
  3. markeins_machine_power_off
  4. detect_bus_frequency
  5. plat_time_init
  6. markeins_sio_setup
  7. plat_mem_setup
  8. markeins_board_init

   1 // SPDX-License-Identifier: GPL-2.0-or-later
   2 /*
   3  *  Copyright (C) NEC Electronics Corporation 2004-2006
   4  *
   5  *  This file is based on the arch/mips/ddb5xxx/ddb5477/setup.c.
   6  *
   7  *      Copyright 2001 MontaVista Software Inc.
   8  */
   9 #include <linux/init.h>
  10 #include <linux/kernel.h>
  11 #include <linux/types.h>
  12 
  13 #include <asm/time.h>
  14 #include <asm/reboot.h>
  15 
  16 #include <asm/emma/emma2rh.h>
  17 
  18 #define USE_CPU_COUNTER_TIMER   /* whether we use cpu counter */
  19 
  20 extern void markeins_led(const char *);
  21 
  22 static int bus_frequency;
  23 
  24 static void markeins_machine_restart(char *command)
  25 {
  26         static void (*back_to_prom) (void) = (void (*)(void))0xbfc00000;
  27 
  28         printk("cannot EMMA2RH Mark-eins restart.\n");
  29         markeins_led("restart.");
  30         back_to_prom();
  31 }
  32 
  33 static void markeins_machine_halt(void)
  34 {
  35         printk("EMMA2RH Mark-eins halted.\n");
  36         markeins_led("halted.");
  37         while (1) ;
  38 }
  39 
  40 static void markeins_machine_power_off(void)
  41 {
  42         markeins_led("poweroff.");
  43         while (1) ;
  44 }
  45 
  46 static unsigned long __initdata emma2rh_clock[4] = {
  47         166500000, 187312500, 199800000, 210600000
  48 };
  49 
  50 static unsigned int __init detect_bus_frequency(unsigned long rtc_base)
  51 {
  52         u32 reg;
  53 
  54         /* detect from boot strap */
  55         reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0);
  56         reg = (reg >> 4) & 0x3;
  57 
  58         return emma2rh_clock[reg];
  59 }
  60 
  61 void __init plat_time_init(void)
  62 {
  63         u32 reg;
  64         if (bus_frequency == 0)
  65                 bus_frequency = detect_bus_frequency(0);
  66 
  67         reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0);
  68         if ((reg & 0x3) == 0)
  69                 reg = (reg >> 6) & 0x3;
  70         else {
  71                 reg = emma2rh_in32(EMMA2RH_BHIF_MAIN_CTRL);
  72                 reg = (reg >> 4) & 0x3;
  73         }
  74         mips_hpt_frequency = (bus_frequency * (4 + reg)) / 4 / 2;
  75 }
  76 
  77 static void markeins_board_init(void);
  78 extern void markeins_irq_setup(void);
  79 
  80 static inline void __init markeins_sio_setup(void)
  81 {
  82 }
  83 
  84 void __init plat_mem_setup(void)
  85 {
  86         /* initialize board - we don't trust the loader */
  87         markeins_board_init();
  88 
  89         set_io_port_base(KSEG1ADDR(EMMA2RH_PCI_IO_BASE));
  90 
  91         _machine_restart = markeins_machine_restart;
  92         _machine_halt = markeins_machine_halt;
  93         pm_power_off = markeins_machine_power_off;
  94 
  95         /* setup resource limits */
  96         ioport_resource.start = EMMA2RH_PCI_IO_BASE;
  97         ioport_resource.end = EMMA2RH_PCI_IO_BASE + EMMA2RH_PCI_IO_SIZE - 1;
  98         iomem_resource.start = EMMA2RH_IO_BASE;
  99         iomem_resource.end = EMMA2RH_ROM_BASE - 1;
 100 
 101         markeins_sio_setup();
 102 }
 103 
 104 static void __init markeins_board_init(void)
 105 {
 106         u32 val;
 107 
 108         val = emma2rh_in32(EMMA2RH_PBRD_INT_EN);        /* open serial interrupts. */
 109         emma2rh_out32(EMMA2RH_PBRD_INT_EN, val | 0xaa);
 110         val = emma2rh_in32(EMMA2RH_PBRD_CLKSEL);        /* set serial clocks. */
 111         emma2rh_out32(EMMA2RH_PBRD_CLKSEL, val | 0x5);  /* 18MHz */
 112         emma2rh_out32(EMMA2RH_PCI_CONTROL, 0);
 113 
 114         markeins_led("MVL E2RH");
 115 }

/* [<][>][^][v][top][bottom][index][help] */