Path: blob/master/arch/powerpc/platforms/8xx/tqm8xx_setup.c
10819 views
/*1* Platform setup for the MPC8xx based boards from TQM.2*3* Heiko Schocher <[email protected]>4* Copyright 2010 DENX Software Engineering GmbH5*6* based on:7* Vitaly Bordug <[email protected]>8*9* Copyright 2005 MontaVista Software Inc.10*11* Heavily modified by Scott Wood <[email protected]>12* Copyright 2007 Freescale Semiconductor, Inc.13*14* This file is licensed under the terms of the GNU General Public License15* version 2. This program is licensed "as is" without any warranty of any16* kind, whether express or implied.17*/1819#include <linux/init.h>20#include <linux/module.h>21#include <linux/param.h>22#include <linux/string.h>23#include <linux/ioport.h>24#include <linux/device.h>25#include <linux/delay.h>2627#include <linux/fs_enet_pd.h>28#include <linux/fs_uart_pd.h>29#include <linux/fsl_devices.h>30#include <linux/mii.h>31#include <linux/of_platform.h>3233#include <asm/delay.h>34#include <asm/io.h>35#include <asm/machdep.h>36#include <asm/page.h>37#include <asm/processor.h>38#include <asm/system.h>39#include <asm/time.h>40#include <asm/mpc8xx.h>41#include <asm/8xx_immap.h>42#include <asm/cpm1.h>43#include <asm/fs_pd.h>44#include <asm/udbg.h>4546#include "mpc8xx.h"4748struct cpm_pin {49int port, pin, flags;50};5152static struct __initdata cpm_pin tqm8xx_pins[] = {53/* SMC1 */54{CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */55{CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */5657/* SCC1 */58{CPM_PORTA, 5, CPM_PIN_INPUT}, /* CLK1 */59{CPM_PORTA, 7, CPM_PIN_INPUT}, /* CLK2 */60{CPM_PORTA, 14, CPM_PIN_INPUT}, /* TX */61{CPM_PORTA, 15, CPM_PIN_INPUT}, /* RX */62{CPM_PORTC, 15, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TENA */63{CPM_PORTC, 10, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},64{CPM_PORTC, 11, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},65};6667static struct __initdata cpm_pin tqm8xx_fec_pins[] = {68/* MII */69{CPM_PORTD, 3, CPM_PIN_OUTPUT},70{CPM_PORTD, 4, CPM_PIN_OUTPUT},71{CPM_PORTD, 5, CPM_PIN_OUTPUT},72{CPM_PORTD, 6, CPM_PIN_OUTPUT},73{CPM_PORTD, 7, CPM_PIN_OUTPUT},74{CPM_PORTD, 8, CPM_PIN_OUTPUT},75{CPM_PORTD, 9, CPM_PIN_OUTPUT},76{CPM_PORTD, 10, CPM_PIN_OUTPUT},77{CPM_PORTD, 11, CPM_PIN_OUTPUT},78{CPM_PORTD, 12, CPM_PIN_OUTPUT},79{CPM_PORTD, 13, CPM_PIN_OUTPUT},80{CPM_PORTD, 14, CPM_PIN_OUTPUT},81{CPM_PORTD, 15, CPM_PIN_OUTPUT},82};8384static void __init init_pins(int n, struct cpm_pin *pin)85{86int i;8788for (i = 0; i < n; i++) {89cpm1_set_pin(pin->port, pin->pin, pin->flags);90pin++;91}92}9394static void __init init_ioports(void)95{96struct device_node *dnode;97struct property *prop;98int len;99100init_pins(ARRAY_SIZE(tqm8xx_pins), &tqm8xx_pins[0]);101102cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);103104dnode = of_find_node_by_name(NULL, "aliases");105if (dnode == NULL)106return;107prop = of_find_property(dnode, "ethernet1", &len);108if (prop == NULL)109return;110111/* init FEC pins */112init_pins(ARRAY_SIZE(tqm8xx_fec_pins), &tqm8xx_fec_pins[0]);113}114115static void __init tqm8xx_setup_arch(void)116{117cpm_reset();118init_ioports();119}120121static int __init tqm8xx_probe(void)122{123unsigned long node = of_get_flat_dt_root();124125return of_flat_dt_is_compatible(node, "tqc,tqm8xx");126}127128static struct of_device_id __initdata of_bus_ids[] = {129{ .name = "soc", },130{ .name = "cpm", },131{ .name = "localbus", },132{ .compatible = "simple-bus" },133{},134};135136static int __init declare_of_platform_devices(void)137{138of_platform_bus_probe(NULL, of_bus_ids, NULL);139140return 0;141}142machine_device_initcall(tqm8xx, declare_of_platform_devices);143144define_machine(tqm8xx) {145.name = "TQM8xx",146.probe = tqm8xx_probe,147.setup_arch = tqm8xx_setup_arch,148.init_IRQ = mpc8xx_pics_init,149.get_irq = mpc8xx_get_irq,150.restart = mpc8xx_restart,151.calibrate_decr = mpc8xx_calibrate_decr,152.set_rtc_time = mpc8xx_set_rtc_time,153.get_rtc_time = mpc8xx_get_rtc_time,154.progress = udbg_progress,155};156157158