Path: blob/master/arch/powerpc/platforms/8xx/mpc86xads_setup.c
26481 views
/*arch/powerpc/platforms/8xx/mpc86xads_setup.c1*2* Platform setup for the Freescale mpc86xads board3*4* Vitaly Bordug <[email protected]>5*6* Copyright 2005 MontaVista Software Inc.7*8* Heavily modified by Scott Wood <[email protected]>9* Copyright 2007 Freescale Semiconductor, Inc.10*11* This file is licensed under the terms of the GNU General Public License12* version 2. This program is licensed "as is" without any warranty of any13* kind, whether express or implied.14*/1516#include <linux/init.h>17#include <linux/of_address.h>18#include <linux/of_fdt.h>19#include <linux/of_platform.h>2021#include <asm/io.h>22#include <asm/machdep.h>23#include <asm/time.h>24#include <asm/8xx_immap.h>25#include <asm/cpm1.h>26#include <asm/udbg.h>2728#include "mpc86xads.h"29#include "mpc8xx.h"30#include "pic.h"3132struct cpm_pin {33int port, pin, flags;34};3536static struct cpm_pin mpc866ads_pins[] = {37/* SMC1 */38{CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */39{CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */4041/* SMC2 */42{CPM_PORTB, 21, CPM_PIN_INPUT}, /* RX */43{CPM_PORTB, 20, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */4445/* SCC1 */46{CPM_PORTA, 6, CPM_PIN_INPUT}, /* CLK1 */47{CPM_PORTA, 7, CPM_PIN_INPUT}, /* CLK2 */48{CPM_PORTA, 14, CPM_PIN_INPUT}, /* TX */49{CPM_PORTA, 15, CPM_PIN_INPUT}, /* RX */50{CPM_PORTB, 19, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TENA */51{CPM_PORTC, 10, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO}, /* RENA */52{CPM_PORTC, 11, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO}, /* CLSN */5354/* MII */55{CPM_PORTD, 3, CPM_PIN_OUTPUT},56{CPM_PORTD, 4, CPM_PIN_OUTPUT},57{CPM_PORTD, 5, CPM_PIN_OUTPUT},58{CPM_PORTD, 6, CPM_PIN_OUTPUT},59{CPM_PORTD, 7, CPM_PIN_OUTPUT},60{CPM_PORTD, 8, CPM_PIN_OUTPUT},61{CPM_PORTD, 9, CPM_PIN_OUTPUT},62{CPM_PORTD, 10, CPM_PIN_OUTPUT},63{CPM_PORTD, 11, CPM_PIN_OUTPUT},64{CPM_PORTD, 12, CPM_PIN_OUTPUT},65{CPM_PORTD, 13, CPM_PIN_OUTPUT},66{CPM_PORTD, 14, CPM_PIN_OUTPUT},67{CPM_PORTD, 15, CPM_PIN_OUTPUT},6869/* I2C */70{CPM_PORTB, 26, CPM_PIN_INPUT | CPM_PIN_OPENDRAIN},71{CPM_PORTB, 27, CPM_PIN_INPUT | CPM_PIN_OPENDRAIN},72};7374static void __init init_ioports(void)75{76int i;7778for (i = 0; i < ARRAY_SIZE(mpc866ads_pins); i++) {79struct cpm_pin *pin = &mpc866ads_pins[i];80cpm1_set_pin(pin->port, pin->pin, pin->flags);81}8283cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);84cpm1_clk_setup(CPM_CLK_SMC2, CPM_BRG2, CPM_CLK_RTX);85cpm1_clk_setup(CPM_CLK_SCC1, CPM_CLK1, CPM_CLK_TX);86cpm1_clk_setup(CPM_CLK_SCC1, CPM_CLK2, CPM_CLK_RX);8788/* Set FEC1 and FEC2 to MII mode */89clrbits32(&mpc8xx_immr->im_cpm.cp_cptr, 0x00000180);90}9192static void __init mpc86xads_setup_arch(void)93{94struct device_node *np;95u32 __iomem *bcsr_io;9697cpm_reset();98init_ioports();99100np = of_find_compatible_node(NULL, NULL, "fsl,mpc866ads-bcsr");101if (!np) {102printk(KERN_CRIT "Could not find fsl,mpc866ads-bcsr node\n");103return;104}105106bcsr_io = of_iomap(np, 0);107of_node_put(np);108109if (bcsr_io == NULL) {110printk(KERN_CRIT "Could not remap BCSR\n");111return;112}113114clrbits32(bcsr_io, BCSR1_RS232EN_1 | BCSR1_RS232EN_2 | BCSR1_ETHEN);115iounmap(bcsr_io);116}117118static const struct of_device_id of_bus_ids[] __initconst = {119{ .name = "soc", },120{ .name = "cpm", },121{ .name = "localbus", },122{},123};124125static int __init declare_of_platform_devices(void)126{127of_platform_bus_probe(NULL, of_bus_ids, NULL);128129return 0;130}131machine_device_initcall(mpc86x_ads, declare_of_platform_devices);132133define_machine(mpc86x_ads) {134.name = "MPC86x ADS",135.compatible = "fsl,mpc866ads",136.setup_arch = mpc86xads_setup_arch,137.init_IRQ = mpc8xx_pic_init,138.get_irq = mpc8xx_get_irq,139.restart = mpc8xx_restart,140.calibrate_decr = mpc8xx_calibrate_decr,141.set_rtc_time = mpc8xx_set_rtc_time,142.get_rtc_time = mpc8xx_get_rtc_time,143.progress = udbg_progress,144};145146147