Path: blob/master/arch/mips/alchemy/common/setup.c
10819 views
/*1* Copyright 2000, 2007-2008 MontaVista Software Inc.2* Author: MontaVista Software, Inc. <[email protected]3*4* Updates to 2.6, Pete Popov, Embedded Alley Solutions, Inc.5*6* This program is free software; you can redistribute it and/or modify it7* under the terms of the GNU General Public License as published by the8* Free Software Foundation; either version 2 of the License, or (at your9* option) any later version.10*11* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED12* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF13* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN14* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,15* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT16* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF17* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON18* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT19* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF20* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.21*22* You should have received a copy of the GNU General Public License along23* with this program; if not, write to the Free Software Foundation, Inc.,24* 675 Mass Ave, Cambridge, MA 02139, USA.25*/2627#include <linux/init.h>28#include <linux/ioport.h>29#include <linux/jiffies.h>30#include <linux/module.h>3132#include <asm/mipsregs.h>33#include <asm/time.h>3435#include <au1000.h>3637extern void __init board_setup(void);38extern void set_cpuspec(void);3940void __init plat_mem_setup(void)41{42unsigned long est_freq;4344/* determine core clock */45est_freq = au1xxx_calc_clock();46est_freq += 5000; /* round */47est_freq -= est_freq % 10000;48printk(KERN_INFO "(PRId %08x) @ %lu.%02lu MHz\n", read_c0_prid(),49est_freq / 1000000, ((est_freq % 1000000) * 100) / 1000000);5051/* this is faster than wasting cycles trying to approximate it */52preset_lpj = (est_freq >> 1) / HZ;5354if (au1xxx_cpu_needs_config_od())55/* Various early Au1xx0 errata corrected by this */56set_c0_config(1 << 19); /* Set Config[OD] */57else58/* Clear to obtain best system bus performance */59clear_c0_config(1 << 19); /* Clear Config[OD] */6061board_setup(); /* board specific setup */6263/* IO/MEM resources. */64set_io_port_base(0);65ioport_resource.start = IOPORT_RESOURCE_START;66ioport_resource.end = IOPORT_RESOURCE_END;67iomem_resource.start = IOMEM_RESOURCE_START;68iomem_resource.end = IOMEM_RESOURCE_END;69}7071#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_PCI)72/* This routine should be valid for all Au1x based boards */73phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)74{75u32 start = (u32)Au1500_PCI_MEM_START;76u32 end = (u32)Au1500_PCI_MEM_END;7778/* Don't fixup 36-bit addresses */79if ((phys_addr >> 32) != 0)80return phys_addr;8182/* Check for PCI memory window */83if (phys_addr >= start && (phys_addr + size - 1) <= end)84return (phys_t)((phys_addr - start) + Au1500_PCI_MEM_START);8586/* default nop */87return phys_addr;88}89EXPORT_SYMBOL(__fixup_bigphys_addr);90#endif919293