2007-05-09 09:51:49 +04:00
|
|
|
/*arch/powerpc/platforms/8xx/mpc86xads_setup.c
|
2007-01-24 22:42:10 +03:00
|
|
|
*
|
|
|
|
* Platform setup for the Freescale mpc86xads board
|
|
|
|
*
|
|
|
|
* Vitaly Bordug <vbordug@ru.mvista.com>
|
|
|
|
*
|
|
|
|
* Copyright 2005 MontaVista Software Inc.
|
|
|
|
*
|
2007-11-25 13:09:31 +03:00
|
|
|
* Heavily modified by Scott Wood <scottwood@freescale.com>
|
|
|
|
* Copyright 2007 Freescale Semiconductor, Inc.
|
|
|
|
*
|
2007-01-24 22:42:10 +03:00
|
|
|
* 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>
|
2007-11-25 13:09:31 +03:00
|
|
|
#include <linux/of_platform.h>
|
2007-01-24 22:42:10 +03:00
|
|
|
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/machdep.h>
|
|
|
|
#include <asm/system.h>
|
|
|
|
#include <asm/time.h>
|
|
|
|
#include <asm/8xx_immap.h>
|
2008-01-25 17:31:42 +03:00
|
|
|
#include <asm/cpm1.h>
|
2007-01-24 22:42:10 +03:00
|
|
|
#include <asm/fs_pd.h>
|
2007-11-25 13:09:31 +03:00
|
|
|
#include <asm/udbg.h>
|
2007-01-24 22:42:10 +03:00
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
#include "mpc86xads.h"
|
2008-01-24 18:18:32 +03:00
|
|
|
#include "mpc8xx.h"
|
2007-01-24 22:42:10 +03:00
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
struct cpm_pin {
|
|
|
|
int port, pin, flags;
|
|
|
|
};
|
2007-01-24 22:42:10 +03:00
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
static struct cpm_pin mpc866ads_pins[] = {
|
|
|
|
/* SMC1 */
|
|
|
|
{CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
|
|
|
|
{CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
|
|
|
|
|
|
|
|
/* SMC2 */
|
|
|
|
{CPM_PORTB, 21, CPM_PIN_INPUT}, /* RX */
|
|
|
|
{CPM_PORTB, 20, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
|
|
|
|
|
|
|
|
/* SCC1 */
|
|
|
|
{CPM_PORTA, 6, 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_PORTB, 19, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TENA */
|
|
|
|
{CPM_PORTC, 10, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO}, /* RENA */
|
|
|
|
{CPM_PORTC, 11, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO}, /* CLSN */
|
|
|
|
|
|
|
|
/* 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},
|
2008-07-02 20:06:13 +04:00
|
|
|
|
|
|
|
/* I2C */
|
|
|
|
{CPM_PORTB, 26, CPM_PIN_INPUT | CPM_PIN_OPENDRAIN},
|
|
|
|
{CPM_PORTB, 27, CPM_PIN_INPUT | CPM_PIN_OPENDRAIN},
|
2007-11-25 13:09:31 +03:00
|
|
|
};
|
2007-01-24 22:42:10 +03:00
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
static void __init init_ioports(void)
|
2007-01-24 22:42:10 +03:00
|
|
|
{
|
2007-11-25 13:09:31 +03:00
|
|
|
int i;
|
2007-01-24 22:42:10 +03:00
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
for (i = 0; i < ARRAY_SIZE(mpc866ads_pins); i++) {
|
|
|
|
struct cpm_pin *pin = &mpc866ads_pins[i];
|
|
|
|
cpm1_set_pin(pin->port, pin->pin, pin->flags);
|
|
|
|
}
|
2007-01-24 22:42:10 +03:00
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);
|
|
|
|
cpm1_clk_setup(CPM_CLK_SMC2, CPM_BRG2, CPM_CLK_RTX);
|
|
|
|
cpm1_clk_setup(CPM_CLK_SCC1, CPM_CLK1, CPM_CLK_TX);
|
|
|
|
cpm1_clk_setup(CPM_CLK_SCC1, CPM_CLK2, CPM_CLK_RX);
|
2007-01-24 22:42:10 +03:00
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
/* Set FEC1 and FEC2 to MII mode */
|
|
|
|
clrbits32(&mpc8xx_immr->im_cpm.cp_cptr, 0x00000180);
|
2007-01-24 22:42:10 +03:00
|
|
|
}
|
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
static void __init mpc86xads_setup_arch(void)
|
2007-01-24 22:42:10 +03:00
|
|
|
{
|
2007-11-25 13:09:31 +03:00
|
|
|
struct device_node *np;
|
|
|
|
u32 __iomem *bcsr_io;
|
|
|
|
|
|
|
|
cpm_reset();
|
|
|
|
init_ioports();
|
2007-01-24 22:42:10 +03:00
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
np = of_find_compatible_node(NULL, NULL, "fsl,mpc866ads-bcsr");
|
|
|
|
if (!np) {
|
|
|
|
printk(KERN_CRIT "Could not find fsl,mpc866ads-bcsr node\n");
|
2007-01-24 22:42:10 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
bcsr_io = of_iomap(np, 0);
|
|
|
|
of_node_put(np);
|
2007-01-24 22:42:10 +03:00
|
|
|
|
|
|
|
if (bcsr_io == NULL) {
|
|
|
|
printk(KERN_CRIT "Could not remap BCSR\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
clrbits32(bcsr_io, BCSR1_RS232EN_1 | BCSR1_RS232EN_2 | BCSR1_ETHEN);
|
2007-01-24 22:42:10 +03:00
|
|
|
iounmap(bcsr_io);
|
|
|
|
}
|
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
static int __init mpc86xads_probe(void)
|
2007-01-24 22:42:10 +03:00
|
|
|
{
|
2007-11-25 13:09:31 +03:00
|
|
|
unsigned long root = of_get_flat_dt_root();
|
|
|
|
return of_flat_dt_is_compatible(root, "fsl,mpc866ads");
|
2007-01-24 22:42:10 +03:00
|
|
|
}
|
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
static struct of_device_id __initdata of_bus_ids[] = {
|
|
|
|
{ .name = "soc", },
|
|
|
|
{ .name = "cpm", },
|
|
|
|
{ .name = "localbus", },
|
|
|
|
{},
|
|
|
|
};
|
2007-01-24 22:42:10 +03:00
|
|
|
|
2007-11-25 13:09:31 +03:00
|
|
|
static int __init declare_of_platform_devices(void)
|
2007-01-24 22:42:10 +03:00
|
|
|
{
|
2008-01-21 21:58:06 +03:00
|
|
|
of_platform_bus_probe(NULL, of_bus_ids, NULL);
|
2007-01-24 22:42:10 +03:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2008-01-21 21:58:06 +03:00
|
|
|
machine_device_initcall(mpc86x_ads, declare_of_platform_devices);
|
2007-01-24 22:42:10 +03:00
|
|
|
|
|
|
|
define_machine(mpc86x_ads) {
|
|
|
|
.name = "MPC86x ADS",
|
|
|
|
.probe = mpc86xads_probe,
|
|
|
|
.setup_arch = mpc86xads_setup_arch,
|
2008-01-24 18:17:32 +03:00
|
|
|
.init_IRQ = mpc8xx_pics_init,
|
2007-01-24 22:42:10 +03:00
|
|
|
.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,
|
2007-11-25 13:09:31 +03:00
|
|
|
.progress = udbg_progress,
|
2007-01-24 22:42:10 +03:00
|
|
|
};
|