Version:  2.0.40 2.2.26 2.4.37 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17

Linux/arch/powerpc/platforms/embedded6xx/linkstation.c

  1 /*
  2  * Board setup routines for the Buffalo Linkstation / Kurobox Platform.
  3  *
  4  * Copyright (C) 2006 G. Liakhovetski (g.liakhovetski@gmx.de)
  5  *
  6  * Based on sandpoint.c by Mark A. Greer
  7  *
  8  * This file is licensed under the terms of the GNU General Public License
  9  * version 2.  This program is licensed "as is" without any warranty of
 10  * any kind, whether express or implied.
 11  */
 12 
 13 #include <linux/kernel.h>
 14 #include <linux/initrd.h>
 15 #include <linux/of_platform.h>
 16 
 17 #include <asm/time.h>
 18 #include <asm/prom.h>
 19 #include <asm/mpic.h>
 20 #include <asm/pci-bridge.h>
 21 
 22 #include "mpc10x.h"
 23 
 24 static __initdata struct of_device_id of_bus_ids[] = {
 25         { .type = "soc", },
 26         { .compatible = "simple-bus", },
 27         {},
 28 };
 29 
 30 static int __init declare_of_platform_devices(void)
 31 {
 32         of_platform_bus_probe(NULL, of_bus_ids, NULL);
 33         return 0;
 34 }
 35 machine_device_initcall(linkstation, declare_of_platform_devices);
 36 
 37 static int __init linkstation_add_bridge(struct device_node *dev)
 38 {
 39 #ifdef CONFIG_PCI
 40         int len;
 41         struct pci_controller *hose;
 42         const int *bus_range;
 43 
 44         printk("Adding PCI host bridge %s\n", dev->full_name);
 45 
 46         bus_range = of_get_property(dev, "bus-range", &len);
 47         if (bus_range == NULL || len < 2 * sizeof(int))
 48                 printk(KERN_WARNING "Can't get bus-range for %s, assume"
 49                                 " bus 0\n", dev->full_name);
 50 
 51         hose = pcibios_alloc_controller(dev);
 52         if (hose == NULL)
 53                 return -ENOMEM;
 54         hose->first_busno = bus_range ? bus_range[0] : 0;
 55         hose->last_busno = bus_range ? bus_range[1] : 0xff;
 56         setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0);
 57 
 58         /* Interpret the "ranges" property */
 59         /* This also maps the I/O region and sets isa_io/mem_base */
 60         pci_process_bridge_OF_ranges(hose, dev, 1);
 61 #endif
 62         return 0;
 63 }
 64 
 65 static void __init linkstation_setup_arch(void)
 66 {
 67         struct device_node *np;
 68 
 69         /* Lookup PCI host bridges */
 70         for_each_compatible_node(np, "pci", "mpc10x-pci")
 71                 linkstation_add_bridge(np);
 72 
 73         printk(KERN_INFO "BUFFALO Network Attached Storage Series\n");
 74         printk(KERN_INFO "(C) 2002-2005 BUFFALO INC.\n");
 75 }
 76 
 77 /*
 78  * Interrupt setup and service.  Interrupts on the linkstation come
 79  * from the four PCI slots plus onboard 8241 devices: I2C, DUART.
 80  */
 81 static void __init linkstation_init_IRQ(void)
 82 {
 83         struct mpic *mpic;
 84 
 85         mpic = mpic_alloc(NULL, 0, 0, 4, 0, " EPIC     ");
 86         BUG_ON(mpic == NULL);
 87 
 88         /* PCI IRQs */
 89         mpic_assign_isu(mpic, 0, mpic->paddr + 0x10200);
 90 
 91         /* I2C */
 92         mpic_assign_isu(mpic, 1, mpic->paddr + 0x11000);
 93 
 94         /* ttyS0, ttyS1 */
 95         mpic_assign_isu(mpic, 2, mpic->paddr + 0x11100);
 96 
 97         mpic_init(mpic);
 98 }
 99 
100 extern void avr_uart_configure(void);
101 extern void avr_uart_send(const char);
102 
103 static void linkstation_restart(char *cmd)
104 {
105         local_irq_disable();
106 
107         /* Reset system via AVR */
108         avr_uart_configure();
109         /* Send reboot command */
110         avr_uart_send('C');
111 
112         for(;;)  /* Spin until reset happens */
113                 avr_uart_send('G');     /* "kick" */
114 }
115 
116 static void linkstation_power_off(void)
117 {
118         local_irq_disable();
119 
120         /* Power down system via AVR */
121         avr_uart_configure();
122         /* send shutdown command */
123         avr_uart_send('E');
124 
125         for(;;)  /* Spin until power-off happens */
126                 avr_uart_send('G');     /* "kick" */
127         /* NOTREACHED */
128 }
129 
130 static void linkstation_halt(void)
131 {
132         linkstation_power_off();
133         /* NOTREACHED */
134 }
135 
136 static void linkstation_show_cpuinfo(struct seq_file *m)
137 {
138         seq_printf(m, "vendor\t\t: Buffalo Technology\n");
139         seq_printf(m, "machine\t\t: Linkstation I/Kurobox(HG)\n");
140 }
141 
142 static int __init linkstation_probe(void)
143 {
144         unsigned long root;
145 
146         root = of_get_flat_dt_root();
147 
148         if (!of_flat_dt_is_compatible(root, "linkstation"))
149                 return 0;
150         return 1;
151 }
152 
153 define_machine(linkstation){
154         .name                   = "Buffalo Linkstation",
155         .probe                  = linkstation_probe,
156         .setup_arch             = linkstation_setup_arch,
157         .init_IRQ               = linkstation_init_IRQ,
158         .show_cpuinfo           = linkstation_show_cpuinfo,
159         .get_irq                = mpic_get_irq,
160         .restart                = linkstation_restart,
161         .power_off              = linkstation_power_off,
162         .halt                   = linkstation_halt,
163         .calibrate_decr         = generic_calibrate_decr,
164 };
165 

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds  •  Contact us