2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2008-04-30 19:18:41 +00:00
|
|
|
* Copyright 2000, 2007-2008 MontaVista Software Inc.
|
|
|
|
* Author: MontaVista Software, Inc. <source@mvista.com
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* Updates to 2.6, Pete Popov, Embedded Alley Solutions, Inc.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
|
|
|
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
|
|
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
|
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
2008-04-23 18:43:55 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/ioport.h>
|
2009-08-27 17:21:18 +00:00
|
|
|
#include <linux/jiffies.h>
|
2005-09-15 23:42:27 +00:00
|
|
|
#include <linux/module.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#include <asm/mipsregs.h>
|
|
|
|
#include <asm/time.h>
|
|
|
|
|
2007-10-15 10:11:24 +00:00
|
|
|
#include <au1000.h>
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
extern void __init board_setup(void);
|
|
|
|
extern void set_cpuspec(void);
|
|
|
|
|
2006-06-18 00:32:22 +00:00
|
|
|
void __init plat_mem_setup(void)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2008-12-21 08:26:24 +00:00
|
|
|
unsigned long est_freq;
|
|
|
|
|
|
|
|
/* determine core clock */
|
|
|
|
est_freq = au1xxx_calc_clock();
|
|
|
|
est_freq += 5000; /* round */
|
|
|
|
est_freq -= est_freq % 10000;
|
|
|
|
printk(KERN_INFO "(PRId %08x) @ %lu.%02lu MHz\n", read_c0_prid(),
|
|
|
|
est_freq / 1000000, ((est_freq % 1000000) * 100) / 1000000);
|
|
|
|
|
2009-08-27 17:21:18 +00:00
|
|
|
/* this is faster than wasting cycles trying to approximate it */
|
|
|
|
preset_lpj = (est_freq >> 1) / HZ;
|
|
|
|
|
2008-12-21 08:26:21 +00:00
|
|
|
if (au1xxx_cpu_needs_config_od())
|
2008-04-30 19:18:41 +00:00
|
|
|
/* Various early Au1xx0 errata corrected by this */
|
|
|
|
set_c0_config(1 << 19); /* Set Config[OD] */
|
|
|
|
else
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Clear to obtain best system bus performance */
|
2008-04-30 19:18:41 +00:00
|
|
|
clear_c0_config(1 << 19); /* Clear Config[OD] */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2011-05-08 08:42:12 +00:00
|
|
|
board_setup(); /* board specific setup */
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* IO/MEM resources. */
|
|
|
|
set_io_port_base(0);
|
|
|
|
ioport_resource.start = IOPORT_RESOURCE_START;
|
|
|
|
ioport_resource.end = IOPORT_RESOURCE_END;
|
|
|
|
iomem_resource.start = IOMEM_RESOURCE_START;
|
|
|
|
iomem_resource.end = IOMEM_RESOURCE_END;
|
|
|
|
}
|
|
|
|
|
2010-02-24 16:40:21 +00:00
|
|
|
#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_PCI)
|
2005-04-16 22:20:36 +00:00
|
|
|
/* This routine should be valid for all Au1x based boards */
|
2005-06-30 10:48:40 +00:00
|
|
|
phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2011-08-12 09:39:44 +00:00
|
|
|
unsigned long start = ALCHEMY_PCI_MEMWIN_START;
|
|
|
|
unsigned long end = ALCHEMY_PCI_MEMWIN_END;
|
2010-02-24 16:40:21 +00:00
|
|
|
|
2008-04-30 19:18:41 +00:00
|
|
|
/* Don't fixup 36-bit addresses */
|
2006-11-07 10:22:31 +00:00
|
|
|
if ((phys_addr >> 32) != 0)
|
|
|
|
return phys_addr;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-02-24 16:40:21 +00:00
|
|
|
/* Check for PCI memory window */
|
|
|
|
if (phys_addr >= start && (phys_addr + size - 1) <= end)
|
2011-08-12 09:39:44 +00:00
|
|
|
return (phys_t)(AU1500_PCI_MEM_PHYS_ADDR + phys_addr);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* default nop */
|
|
|
|
return phys_addr;
|
|
|
|
}
|
2005-09-15 23:42:27 +00:00
|
|
|
EXPORT_SYMBOL(__fixup_bigphys_addr);
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|