Path: blob/master/arch/powerpc/platforms/cell/celleb_setup.c
10818 views
/*1* Celleb setup code2*3* (C) Copyright 2006-2007 TOSHIBA CORPORATION4*5* This code is based on arch/powerpc/platforms/cell/setup.c:6* Copyright (C) 1995 Linus Torvalds7* Adapted from 'alpha' version by Gary Thomas8* Modified by Cort Dougan ([email protected])9* Modified by PPC64 Team, IBM Corp10* Modified by Cell Team, IBM Deutschland Entwicklung GmbH11*12* This program is free software; you can redistribute it and/or modify13* it under the terms of the GNU General Public License as published by14* the Free Software Foundation; either version 2 of the License, or15* (at your option) any later version.16*17* This program is distributed in the hope that it will be useful,18* but WITHOUT ANY WARRANTY; without even the implied warranty of19* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20* GNU General Public License for more details.21*22* You should have received a copy of the GNU General Public License along23* with this program; if not, write to the Free Software Foundation, Inc.,24* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.25*/2627#undef DEBUG2829#include <linux/cpu.h>30#include <linux/sched.h>31#include <linux/kernel.h>32#include <linux/mm.h>33#include <linux/stddef.h>34#include <linux/unistd.h>35#include <linux/reboot.h>36#include <linux/init.h>37#include <linux/delay.h>38#include <linux/irq.h>39#include <linux/seq_file.h>40#include <linux/root_dev.h>41#include <linux/console.h>42#include <linux/of_platform.h>4344#include <asm/mmu.h>45#include <asm/processor.h>46#include <asm/io.h>47#include <asm/prom.h>48#include <asm/machdep.h>49#include <asm/cputable.h>50#include <asm/irq.h>51#include <asm/time.h>52#include <asm/spu_priv1.h>53#include <asm/firmware.h>54#include <asm/rtas.h>55#include <asm/cell-regs.h>5657#include "beat_interrupt.h"58#include "beat_wrapper.h"59#include "beat.h"60#include "celleb_pci.h"61#include "interrupt.h"62#include "pervasive.h"63#include "ras.h"6465static char celleb_machine_type[128] = "Celleb";6667static void celleb_show_cpuinfo(struct seq_file *m)68{69struct device_node *root;70const char *model = "";7172root = of_find_node_by_path("/");73if (root)74model = of_get_property(root, "model", NULL);75/* using "CHRP" is to trick anaconda into installing FCx into Celleb */76seq_printf(m, "machine\t\t: %s %s\n", celleb_machine_type, model);77of_node_put(root);78}7980static int __init celleb_machine_type_hack(char *ptr)81{82strlcpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));83return 0;84}8586__setup("celleb_machine_type_hack=", celleb_machine_type_hack);8788static void celleb_progress(char *s, unsigned short hex)89{90printk("*** %04x : %s\n", hex, s ? s : "");91}9293static void __init celleb_setup_arch_common(void)94{95/* init to some ~sane value until calibrate_delay() runs */96loops_per_jiffy = 50000000;9798#ifdef CONFIG_DUMMY_CONSOLE99conswitchp = &dummy_con;100#endif101}102103static struct of_device_id celleb_bus_ids[] __initdata = {104{ .type = "scc", },105{ .type = "ioif", }, /* old style */106{},107};108109static int __init celleb_publish_devices(void)110{111/* Publish OF platform devices for southbridge IOs */112of_platform_bus_probe(NULL, celleb_bus_ids, NULL);113114return 0;115}116machine_device_initcall(celleb_beat, celleb_publish_devices);117machine_device_initcall(celleb_native, celleb_publish_devices);118119120/*121* functions for Celleb-Beat122*/123static void __init celleb_setup_arch_beat(void)124{125#ifdef CONFIG_SPU_BASE126spu_priv1_ops = &spu_priv1_beat_ops;127spu_management_ops = &spu_management_of_ops;128#endif129130celleb_setup_arch_common();131}132133static int __init celleb_probe_beat(void)134{135unsigned long root = of_get_flat_dt_root();136137if (!of_flat_dt_is_compatible(root, "Beat"))138return 0;139140powerpc_firmware_features |= FW_FEATURE_CELLEB_ALWAYS141| FW_FEATURE_BEAT | FW_FEATURE_LPAR;142hpte_init_beat_v3();143144return 1;145}146147148/*149* functions for Celleb-native150*/151static void __init celleb_init_IRQ_native(void)152{153iic_init_IRQ();154spider_init_IRQ();155}156157static void __init celleb_setup_arch_native(void)158{159#ifdef CONFIG_SPU_BASE160spu_priv1_ops = &spu_priv1_mmio_ops;161spu_management_ops = &spu_management_of_ops;162#endif163164cbe_regs_init();165166#ifdef CONFIG_CBE_RAS167cbe_ras_init();168#endif169170#ifdef CONFIG_SMP171smp_init_cell();172#endif173174cbe_pervasive_init();175176/* XXX: nvram initialization should be added */177178celleb_setup_arch_common();179}180181static int __init celleb_probe_native(void)182{183unsigned long root = of_get_flat_dt_root();184185if (of_flat_dt_is_compatible(root, "Beat") ||186!of_flat_dt_is_compatible(root, "TOSHIBA,Celleb"))187return 0;188189powerpc_firmware_features |= FW_FEATURE_CELLEB_ALWAYS;190hpte_init_native();191192return 1;193}194195196/*197* machine definitions198*/199define_machine(celleb_beat) {200.name = "Cell Reference Set (Beat)",201.probe = celleb_probe_beat,202.setup_arch = celleb_setup_arch_beat,203.show_cpuinfo = celleb_show_cpuinfo,204.restart = beat_restart,205.power_off = beat_power_off,206.halt = beat_halt,207.get_rtc_time = beat_get_rtc_time,208.set_rtc_time = beat_set_rtc_time,209.calibrate_decr = generic_calibrate_decr,210.progress = celleb_progress,211.power_save = beat_power_save,212.nvram_size = beat_nvram_get_size,213.nvram_read = beat_nvram_read,214.nvram_write = beat_nvram_write,215.set_dabr = beat_set_xdabr,216.init_IRQ = beatic_init_IRQ,217.get_irq = beatic_get_irq,218.pci_probe_mode = celleb_pci_probe_mode,219.pci_setup_phb = celleb_setup_phb,220#ifdef CONFIG_KEXEC221.kexec_cpu_down = beat_kexec_cpu_down,222#endif223};224225define_machine(celleb_native) {226.name = "Cell Reference Set (native)",227.probe = celleb_probe_native,228.setup_arch = celleb_setup_arch_native,229.show_cpuinfo = celleb_show_cpuinfo,230.restart = rtas_restart,231.power_off = rtas_power_off,232.halt = rtas_halt,233.get_boot_time = rtas_get_boot_time,234.get_rtc_time = rtas_get_rtc_time,235.set_rtc_time = rtas_set_rtc_time,236.calibrate_decr = generic_calibrate_decr,237.progress = celleb_progress,238.pci_probe_mode = celleb_pci_probe_mode,239.pci_setup_phb = celleb_setup_phb,240.init_IRQ = celleb_init_IRQ_native,241};242243244