Path: blob/master/arch/powerpc/platforms/embedded6xx/prpmc2800.c
10819 views
/*1* Board setup routines for the Motorola PrPMC28002*3* Author: Dale Farnsworth <[email protected]>4*5* 2007 (c) MontaVista, Software, Inc. This file is licensed under6* the terms of the GNU General Public License version 2. This program7* is licensed "as is" without any warranty of any kind, whether express8* or implied.9*/1011#include <linux/stddef.h>12#include <linux/kernel.h>13#include <linux/delay.h>14#include <linux/interrupt.h>15#include <linux/seq_file.h>1617#include <asm/machdep.h>18#include <asm/prom.h>19#include <asm/system.h>20#include <asm/time.h>2122#include <mm/mmu_decl.h>2324#include <sysdev/mv64x60.h>2526#define MV64x60_MPP_CNTL_0 0x000027#define MV64x60_MPP_CNTL_2 0x00082829#define MV64x60_GPP_IO_CNTL 0x000030#define MV64x60_GPP_LEVEL_CNTL 0x001031#define MV64x60_GPP_VALUE_SET 0x00183233#define PLATFORM_NAME_MAX 323435static char prpmc2800_platform_name[PLATFORM_NAME_MAX];3637static void __iomem *mv64x60_mpp_reg_base;38static void __iomem *mv64x60_gpp_reg_base;3940static void __init prpmc2800_setup_arch(void)41{42struct device_node *np;43phys_addr_t paddr;44const unsigned int *reg;4546/*47* ioremap mpp and gpp registers in case they are later48* needed by prpmc2800_reset_board().49*/50np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-mpp");51reg = of_get_property(np, "reg", NULL);52paddr = of_translate_address(np, reg);53of_node_put(np);54mv64x60_mpp_reg_base = ioremap(paddr, reg[1]);5556np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-gpp");57reg = of_get_property(np, "reg", NULL);58paddr = of_translate_address(np, reg);59of_node_put(np);60mv64x60_gpp_reg_base = ioremap(paddr, reg[1]);6162#ifdef CONFIG_PCI63mv64x60_pci_init();64#endif6566printk("Motorola %s\n", prpmc2800_platform_name);67}6869static void prpmc2800_reset_board(void)70{71u32 temp;7273local_irq_disable();7475temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0);76temp &= 0xFFFF0FFF;77out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_0, temp);7879temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);80temp |= 0x00000004;81out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);8283temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);84temp |= 0x00000004;85out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);8687temp = in_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2);88temp &= 0xFFFF0FFF;89out_le32(mv64x60_mpp_reg_base + MV64x60_MPP_CNTL_2, temp);9091temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL);92temp |= 0x00080000;93out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_LEVEL_CNTL, temp);9495temp = in_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL);96temp |= 0x00080000;97out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_IO_CNTL, temp);9899out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_VALUE_SET, 0x00080004);100}101102static void prpmc2800_restart(char *cmd)103{104volatile ulong i = 10000000;105106prpmc2800_reset_board();107108while (i-- > 0);109panic("restart failed\n");110}111112#ifdef CONFIG_NOT_COHERENT_CACHE113#define PPRPM2800_COHERENCY_SETTING "off"114#else115#define PPRPM2800_COHERENCY_SETTING "on"116#endif117118void prpmc2800_show_cpuinfo(struct seq_file *m)119{120seq_printf(m, "Vendor\t\t: Motorola\n");121seq_printf(m, "coherency\t: %s\n", PPRPM2800_COHERENCY_SETTING);122}123124/*125* Called very early, device-tree isn't unflattened126*/127static int __init prpmc2800_probe(void)128{129unsigned long root = of_get_flat_dt_root();130unsigned long len = PLATFORM_NAME_MAX;131void *m;132133if (!of_flat_dt_is_compatible(root, "motorola,PrPMC2800"))134return 0;135136/* Update ppc_md.name with name from dt */137m = of_get_flat_dt_prop(root, "model", &len);138if (m)139strncpy(prpmc2800_platform_name, m,140min((int)len, PLATFORM_NAME_MAX - 1));141142_set_L2CR(_get_L2CR() | L2CR_L2E);143return 1;144}145146define_machine(prpmc2800){147.name = prpmc2800_platform_name,148.probe = prpmc2800_probe,149.setup_arch = prpmc2800_setup_arch,150.init_early = mv64x60_init_early,151.show_cpuinfo = prpmc2800_show_cpuinfo,152.init_IRQ = mv64x60_init_irq,153.get_irq = mv64x60_get_irq,154.restart = prpmc2800_restart,155.calibrate_decr = generic_calibrate_decr,156};157158159