Path: blob/master/arch/powerpc/platforms/8xx/tqm8xx_setup.c
26481 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/param.h>21#include <linux/string.h>22#include <linux/ioport.h>23#include <linux/device.h>24#include <linux/delay.h>2526#include <linux/fsl_devices.h>27#include <linux/mii.h>28#include <linux/of_fdt.h>29#include <linux/of_platform.h>3031#include <asm/delay.h>32#include <asm/io.h>33#include <asm/machdep.h>34#include <asm/page.h>35#include <asm/processor.h>36#include <asm/time.h>37#include <asm/8xx_immap.h>38#include <asm/cpm1.h>39#include <asm/udbg.h>4041#include "mpc8xx.h"42#include "pic.h"4344struct cpm_pin {45int port, pin, flags;46};4748static struct cpm_pin tqm8xx_pins[] __initdata = {49/* SMC1 */50{CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */51{CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */5253/* SCC1 */54{CPM_PORTA, 5, CPM_PIN_INPUT}, /* CLK1 */55{CPM_PORTA, 7, CPM_PIN_INPUT}, /* CLK2 */56{CPM_PORTA, 14, CPM_PIN_INPUT}, /* TX */57{CPM_PORTA, 15, CPM_PIN_INPUT}, /* RX */58{CPM_PORTC, 15, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TENA */59{CPM_PORTC, 10, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},60{CPM_PORTC, 11, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},61};6263static struct cpm_pin tqm8xx_fec_pins[] __initdata = {64/* MII */65{CPM_PORTD, 3, CPM_PIN_OUTPUT},66{CPM_PORTD, 4, CPM_PIN_OUTPUT},67{CPM_PORTD, 5, CPM_PIN_OUTPUT},68{CPM_PORTD, 6, CPM_PIN_OUTPUT},69{CPM_PORTD, 7, CPM_PIN_OUTPUT},70{CPM_PORTD, 8, CPM_PIN_OUTPUT},71{CPM_PORTD, 9, CPM_PIN_OUTPUT},72{CPM_PORTD, 10, CPM_PIN_OUTPUT},73{CPM_PORTD, 11, CPM_PIN_OUTPUT},74{CPM_PORTD, 12, CPM_PIN_OUTPUT},75{CPM_PORTD, 13, CPM_PIN_OUTPUT},76{CPM_PORTD, 14, CPM_PIN_OUTPUT},77{CPM_PORTD, 15, CPM_PIN_OUTPUT},78};7980static void __init init_pins(int n, struct cpm_pin *pin)81{82int i;8384for (i = 0; i < n; i++) {85cpm1_set_pin(pin->port, pin->pin, pin->flags);86pin++;87}88}8990static void __init init_ioports(void)91{92struct device_node *dnode;93struct property *prop;94int len;9596init_pins(ARRAY_SIZE(tqm8xx_pins), &tqm8xx_pins[0]);9798cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);99100dnode = of_find_node_by_name(NULL, "aliases");101if (dnode == NULL)102return;103prop = of_find_property(dnode, "ethernet1", &len);104105of_node_put(dnode);106107if (prop == NULL)108return;109110/* init FEC pins */111init_pins(ARRAY_SIZE(tqm8xx_fec_pins), &tqm8xx_fec_pins[0]);112}113114static void __init tqm8xx_setup_arch(void)115{116cpm_reset();117init_ioports();118}119120static const struct of_device_id of_bus_ids[] __initconst = {121{ .name = "soc", },122{ .name = "cpm", },123{ .name = "localbus", },124{ .compatible = "simple-bus" },125{},126};127128static int __init declare_of_platform_devices(void)129{130of_platform_bus_probe(NULL, of_bus_ids, NULL);131132return 0;133}134machine_device_initcall(tqm8xx, declare_of_platform_devices);135136define_machine(tqm8xx) {137.name = "TQM8xx",138.compatible = "tqc,tqm8xx",139.setup_arch = tqm8xx_setup_arch,140.init_IRQ = mpc8xx_pic_init,141.get_irq = mpc8xx_get_irq,142.restart = mpc8xx_restart,143.calibrate_decr = mpc8xx_calibrate_decr,144.set_rtc_time = mpc8xx_set_rtc_time,145.get_rtc_time = mpc8xx_get_rtc_time,146.progress = udbg_progress,147};148149150