Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4b6a776 authored by Heiko Schocher's avatar Heiko Schocher Committed by Kumar Gala
Browse files

powerpc/8xx: Add support for the MPC8xx based boards from TQC



Supported SMC1 (serial console), SCC1 Ethernet (10Mbps HD).
FEC Ethernet, 8MB NOR CFI Flash.

Tested on STK8xx with TQM860L (with FEC) and with TQM855M (without FEC).

Signed-off-by: default avatarHeiko Schocher <hs@denx.de>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 30be4c96
Loading
Loading
Loading
Loading
+172 −0
Original line number Diff line number Diff line
/*
 * TQM8XX Device Tree Source
 *
 * Heiko Schocher <hs@denx.de>
 * 2010 DENX Software Engineering GmbH
 *
 * This program is free software; you can redistribute  it and/or modify it
 * under  the terms of  the GNU General  Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */

/dts-v1/;

/ {
	model = "TQM8xx";
	compatible = "tqc,tqm8xx";
	#address-cells = <1>;
	#size-cells = <1>;

	aliases {
		ethernet0 = &eth0;
		ethernet1 = &eth1;
		mdio1 = &phy1;
		serial0 = &smc1;
	};

	cpus {
		#address-cells = <1>;
		#size-cells = <0>;

		PowerPC,860@0 {
			device_type = "cpu";
			reg = <0x0>;
			d-cache-line-size = <16>;	// 16 bytes
			i-cache-line-size = <16>;	// 16 bytes
			d-cache-size = <0x1000>;		// L1, 4K
			i-cache-size = <0x1000>;		// L1, 4K
			timebase-frequency = <0>;
			bus-frequency = <0>;
			clock-frequency = <0>;
			interrupts = <15 2>;	// decrementer interrupt
			interrupt-parent = <&PIC>;
		};
	};

	memory {
		device_type = "memory";
		reg = <0x0 0x2000000>;
	};

	localbus@fff00100 {
		compatible = "fsl,mpc860-localbus", "fsl,pq1-localbus";
		#address-cells = <2>;
		#size-cells = <1>;
		reg = <0xfff00100 0x40>;

		ranges = <
			0x0 0x0 0x40000000 0x800000
		>;

		flash@0,0 {
			compatible = "cfi-flash";
			reg = <0 0 0x800000>;
			#address-cells = <1>;
			#size-cells = <1>;
			bank-width = <4>;
			device-width = <2>;
		};
	};

	soc@fff00000 {
		#address-cells = <1>;
		#size-cells = <1>;
		device_type = "soc";
		ranges = <0x0 0xfff00000 0x00004000>;

		phy1: mdio@e00 {
			compatible = "fsl,mpc866-fec-mdio", "fsl,pq1-fec-mdio";
			reg = <0xe00 0x188>;
			#address-cells = <1>;
			#size-cells = <0>;
			PHY: ethernet-phy@f {
				reg = <0xf>;
				device_type = "ethernet-phy";
			};
		};

		eth1: ethernet@e00 {
			device_type = "network";
			compatible = "fsl,mpc866-fec-enet",
			             "fsl,pq1-fec-enet";
			reg = <0xe00 0x188>;
			interrupts = <3 1>;
			interrupt-parent = <&PIC>;
			phy-handle = <&PHY>;
			linux,network-index = <1>;
		};

		PIC: pic@0 {
			interrupt-controller;
			#interrupt-cells = <2>;
			reg = <0x0 0x24>;
			compatible = "fsl,mpc860-pic", "fsl,pq1-pic";
		};

		cpm@9c0 {
			#address-cells = <1>;
			#size-cells = <1>;
			compatible = "fsl,mpc860-cpm", "fsl,cpm1";
			ranges;
			reg = <0x9c0 0x40>;
			brg-frequency = <0>;
			interrupts = <0 2>;	// cpm error interrupt
			interrupt-parent = <&CPM_PIC>;

			muram@2000 {
				#address-cells = <1>;
				#size-cells = <1>;
				ranges = <0x0 0x2000 0x2000>;

				data@0 {
					compatible = "fsl,cpm-muram-data";
					reg = <0x0 0x2000>;
				};
			};

			brg@9f0 {
				compatible = "fsl,mpc860-brg",
					     "fsl,cpm1-brg",
					     "fsl,cpm-brg";
				reg = <0x9f0 0x10>;
				clock-frequency = <0>;
			};

			CPM_PIC: pic@930 {
				interrupt-controller;
				#address-cells = <0>;
				#interrupt-cells = <1>;
				interrupts = <5 2 0 2>;
				interrupt-parent = <&PIC>;
				reg = <0x930 0x20>;
				compatible = "fsl,mpc860-cpm-pic",
				             "fsl,cpm1-pic";
			};


			smc1: serial@a80 {
				device_type = "serial";
				compatible = "fsl,mpc860-smc-uart",
				             "fsl,cpm1-smc-uart";
				reg = <0xa80 0x10 0x3e80 0x40>;
				interrupts = <4>;
				interrupt-parent = <&CPM_PIC>;
				fsl,cpm-brg = <1>;
				fsl,cpm-command = <0x90>;
			};

			eth0: ethernet@a00 {
				device_type = "network";
				compatible = "fsl,mpc860-scc-enet",
				             "fsl,cpm1-scc-enet";
				reg = <0xa00 0x18 0x3c00 0x100>;
				interrupts = <30>;
				interrupt-parent = <&CPM_PIC>;
				fsl,cpm-command = <0000>;
				linux,network-index = <0>;
				fixed-link = <0 0 10 0 0>;
			};
		};
	};
};
+934 −0

File added.

Preview size limit exceeded, changes collapsed.

+6 −0
Original line number Diff line number Diff line
@@ -55,6 +55,12 @@ config PPC_MGSUVD
	help
	  This enables support for the Keymile MGSUVD board.

config TQM8XX
	bool "TQM8XX"
	select CPM1
	help
	  support for the mpc8xx based boards from TQM.

endchoice

menu "Freescale Ethernet driver platform-specific options"
+1 −0
Original line number Diff line number Diff line
@@ -7,3 +7,4 @@ obj-$(CONFIG_MPC86XADS) += mpc86xads_setup.o
obj-$(CONFIG_PPC_EP88XC)  += ep88xc.o
obj-$(CONFIG_PPC_ADDER875) += adder875.o
obj-$(CONFIG_PPC_MGSUVD) += mgsuvd.o
obj-$(CONFIG_TQM8XX)      += tqm8xx_setup.o
+156 −0
Original line number Diff line number Diff line
/*
 * Platform setup for the MPC8xx based boards from TQM.
 *
 * Heiko Schocher <hs@denx.de>
 * Copyright 2010 DENX Software Engineering GmbH
 *
 * based on:
 * Vitaly Bordug <vbordug@ru.mvista.com>
 *
 * Copyright 2005 MontaVista Software Inc.
 *
 * Heavily modified by Scott Wood <scottwood@freescale.com>
 * Copyright 2007 Freescale Semiconductor, Inc.
 *
 * This file is licensed under the terms of the GNU General Public License
 * version 2. This program is licensed "as is" without any warranty of any
 * kind, whether express or implied.
 */

#include <linux/init.h>
#include <linux/module.h>
#include <linux/param.h>
#include <linux/string.h>
#include <linux/ioport.h>
#include <linux/device.h>
#include <linux/delay.h>

#include <linux/fs_enet_pd.h>
#include <linux/fs_uart_pd.h>
#include <linux/fsl_devices.h>
#include <linux/mii.h>
#include <linux/of_platform.h>

#include <asm/delay.h>
#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/page.h>
#include <asm/processor.h>
#include <asm/system.h>
#include <asm/time.h>
#include <asm/mpc8xx.h>
#include <asm/8xx_immap.h>
#include <asm/cpm1.h>
#include <asm/fs_pd.h>
#include <asm/udbg.h>

#include "mpc8xx.h"

struct cpm_pin {
	int port, pin, flags;
};

static struct __initdata cpm_pin tqm8xx_pins[] = {
	/* SMC1 */
	{CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
	{CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */

	/* SCC1 */
	{CPM_PORTA, 5, CPM_PIN_INPUT}, /* CLK1 */
	{CPM_PORTA, 7, CPM_PIN_INPUT}, /* CLK2 */
	{CPM_PORTA, 14, CPM_PIN_INPUT}, /* TX */
	{CPM_PORTA, 15, CPM_PIN_INPUT}, /* RX */
	{CPM_PORTC, 15, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TENA */
	{CPM_PORTC, 10, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},
	{CPM_PORTC, 11, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},
};

static struct __initdata cpm_pin tqm8xx_fec_pins[] = {
	/* MII */
	{CPM_PORTD, 3, CPM_PIN_OUTPUT},
	{CPM_PORTD, 4, CPM_PIN_OUTPUT},
	{CPM_PORTD, 5, CPM_PIN_OUTPUT},
	{CPM_PORTD, 6, CPM_PIN_OUTPUT},
	{CPM_PORTD, 7, CPM_PIN_OUTPUT},
	{CPM_PORTD, 8, CPM_PIN_OUTPUT},
	{CPM_PORTD, 9, CPM_PIN_OUTPUT},
	{CPM_PORTD, 10, CPM_PIN_OUTPUT},
	{CPM_PORTD, 11, CPM_PIN_OUTPUT},
	{CPM_PORTD, 12, CPM_PIN_OUTPUT},
	{CPM_PORTD, 13, CPM_PIN_OUTPUT},
	{CPM_PORTD, 14, CPM_PIN_OUTPUT},
	{CPM_PORTD, 15, CPM_PIN_OUTPUT},
};

static void __init init_pins(int n, struct cpm_pin *pin)
{
	int i;

	for (i = 0; i < n; i++) {
		cpm1_set_pin(pin->port, pin->pin, pin->flags);
		pin++;
	}
}

static void __init init_ioports(void)
{
	struct device_node *dnode;
	struct property *prop;
	int	len;

	init_pins(ARRAY_SIZE(tqm8xx_pins), &tqm8xx_pins[0]);

	cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);

	dnode = of_find_node_by_name(NULL, "aliases");
	if (dnode == NULL)
		return;
	prop = of_find_property(dnode, "ethernet1", &len);
	if (prop == NULL)
		return;

	/* init FEC pins */
	init_pins(ARRAY_SIZE(tqm8xx_fec_pins), &tqm8xx_fec_pins[0]);
}

static void __init tqm8xx_setup_arch(void)
{
	cpm_reset();
	init_ioports();
}

static int __init tqm8xx_probe(void)
{
	unsigned long node = of_get_flat_dt_root();

	return of_flat_dt_is_compatible(node, "tqc,tqm8xx");
}

static struct of_device_id __initdata of_bus_ids[] = {
	{ .name = "soc", },
	{ .name = "cpm", },
	{ .name = "localbus", },
	{ .compatible = "simple-bus" },
	{},
};

static int __init declare_of_platform_devices(void)
{
	of_platform_bus_probe(NULL, of_bus_ids, NULL);

	return 0;
}
machine_device_initcall(tqm8xx, declare_of_platform_devices);

define_machine(tqm8xx) {
	.name			= "TQM8xx",
	.probe			= tqm8xx_probe,
	.setup_arch		= tqm8xx_setup_arch,
	.init_IRQ		= mpc8xx_pics_init,
	.get_irq		= mpc8xx_get_irq,
	.restart		= mpc8xx_restart,
	.calibrate_decr		= mpc8xx_calibrate_decr,
	.set_rtc_time		= mpc8xx_set_rtc_time,
	.get_rtc_time		= mpc8xx_get_rtc_time,
	.progress		= udbg_progress,
};