2005-04-16 15:20:36 -07:00
/*
* Carsten Langgaard , carstenl @ mips . com
* Copyright ( C ) 2000 MIPS Technologies , Inc . All rights reserved .
*
* This program is free software ; you can distribute it and / or modify it
* under the terms of the GNU General Public License ( Version 2 ) as
* published by the Free Software Foundation .
*
* This program is distributed in the hope it will be useful , but WITHOUT
* ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE . See the GNU General Public License
* for more details .
*
* 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 . ,
* 59 Temple Place - Suite 330 , Boston MA 02111 - 1307 , USA .
*/
# include <linux/init.h>
# include <linux/sched.h>
# include <linux/ioport.h>
# include <linux/pci.h>
2006-07-10 04:44:13 -07:00
# include <linux/screen_info.h>
2005-04-16 15:20:36 -07:00
# include <asm/cpu.h>
# include <asm/bootinfo.h>
# include <asm/irq.h>
# include <asm/mips-boards/generic.h>
# include <asm/mips-boards/prom.h>
# include <asm/mips-boards/malta.h>
# include <asm/mips-boards/maltaint.h>
# include <asm/dma.h>
# include <asm/time.h>
# include <asm/traps.h>
# ifdef CONFIG_VT
# include <linux/console.h>
# endif
extern void mips_reboot_setup ( void ) ;
extern void mips_time_init ( void ) ;
extern unsigned long mips_rtc_get_time ( void ) ;
# ifdef CONFIG_KGDB
extern void kgdb_config ( void ) ;
# endif
struct resource standard_io_resources [ ] = {
2006-06-04 15:14:05 -07:00
{ . name = " dma1 " , . start = 0x00 , . end = 0x1f , . flags = IORESOURCE_BUSY } ,
{ . name = " timer " , . start = 0x40 , . end = 0x5f , . flags = IORESOURCE_BUSY } ,
{ . name = " keyboard " , . start = 0x60 , . end = 0x6f , . flags = IORESOURCE_BUSY } ,
{ . name = " dma page reg " , . start = 0x80 , . end = 0x8f , . flags = IORESOURCE_BUSY } ,
{ . name = " dma2 " , . start = 0xc0 , . end = 0xdf , . flags = IORESOURCE_BUSY } ,
2005-04-16 15:20:36 -07:00
} ;
const char * get_system_type ( void )
{
return " MIPS Malta " ;
}
2007-05-16 17:54:08 +02:00
# if defined(CONFIG_MIPS_MT_SMTC)
const char display_string [ ] = " SMTC LINUX ON MALTA " ;
# else
const char display_string [ ] = " LINUX ON MALTA " ;
# endif /* CONFIG_MIPS_MT_SMTC */
2005-04-16 15:20:36 -07:00
# ifdef CONFIG_BLK_DEV_FD
void __init fd_activate ( void )
{
/*
* Activate Floppy Controller in the SMSC FDC37M817 Super I / O
* Controller .
* Done by YAMON 2.00 onwards
*/
/* Entering config state. */
SMSC_WRITE ( SMSC_CONFIG_ENTER , SMSC_CONFIG_REG ) ;
/* Activate floppy controller. */
SMSC_WRITE ( SMSC_CONFIG_DEVNUM , SMSC_CONFIG_REG ) ;
SMSC_WRITE ( SMSC_CONFIG_DEVNUM_FLOPPY , SMSC_DATA_REG ) ;
SMSC_WRITE ( SMSC_CONFIG_ACTIVATE , SMSC_CONFIG_REG ) ;
SMSC_WRITE ( SMSC_CONFIG_ACTIVATE_ENABLE , SMSC_DATA_REG ) ;
/* Exit config state. */
SMSC_WRITE ( SMSC_CONFIG_EXIT , SMSC_CONFIG_REG ) ;
}
# endif
2006-06-18 01:32:22 +01:00
void __init plat_mem_setup ( void )
2005-04-16 15:20:36 -07:00
{
unsigned int i ;
2005-06-21 13:56:30 +00:00
mips_pcibios_init ( ) ;
2005-04-16 15:20:36 -07:00
/* Request I/O space for devices used on the Malta board. */
for ( i = 0 ; i < ARRAY_SIZE ( standard_io_resources ) ; i + + )
request_resource ( & ioport_resource , standard_io_resources + i ) ;
/*
* Enable DMA channel 4 ( cascade channel ) in the PIIX4 south bridge .
*/
enable_dma ( 4 ) ;
# ifdef CONFIG_KGDB
kgdb_config ( ) ;
# endif
2007-04-27 15:58:41 +01:00
if ( mips_revision_sconid = = MIPS_REVISION_SCON_BONITO ) {
2005-04-16 15:20:36 -07:00
char * argptr ;
argptr = prom_getcmdline ( ) ;
if ( strstr ( argptr , " debug " ) ) {
BONITO_BONGENCFG | = BONITO_BONGENCFG_DEBUGMODE ;
printk ( " Enabled Bonito debug mode \n " ) ;
}
else
BONITO_BONGENCFG & = ~ BONITO_BONGENCFG_DEBUGMODE ;
# ifdef CONFIG_DMA_COHERENT
if ( BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES ) {
BONITO_PCICACHECTRL | = BONITO_PCICACHECTRL_CPUCOH_EN ;
printk ( " Enabled Bonito CPU coherency \n " ) ;
argptr = prom_getcmdline ( ) ;
if ( strstr ( argptr , " iobcuncached " ) ) {
BONITO_PCICACHECTRL & = ~ BONITO_PCICACHECTRL_IOBCCOH_EN ;
2005-09-03 15:56:17 -07:00
BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG &
2005-04-16 15:20:36 -07:00
~ ( BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
BONITO_PCIMEMBASECFG_MEMBASE1_CACHED ) ;
printk ( " Disabled Bonito IOBC coherency \n " ) ;
}
else {
BONITO_PCICACHECTRL | = BONITO_PCICACHECTRL_IOBCCOH_EN ;
2005-09-03 15:56:17 -07:00
BONITO_PCIMEMBASECFG | =
( BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
2005-04-16 15:20:36 -07:00
BONITO_PCIMEMBASECFG_MEMBASE1_CACHED ) ;
2006-11-24 12:17:51 +00:00
printk ( " Enabled Bonito IOBC coherency \n " ) ;
2005-04-16 15:20:36 -07:00
}
}
else
panic ( " Hardware DMA cache coherency not supported " ) ;
# endif
}
# ifdef CONFIG_DMA_COHERENT
else {
panic ( " Hardware DMA cache coherency not supported " ) ;
}
# endif
# ifdef CONFIG_BLK_DEV_IDE
/* Check PCI clock */
{
2007-04-26 15:46:24 +01:00
unsigned int __iomem * jmpr_p = ( unsigned int * ) ioremap ( MALTA_JMPRS_REG , sizeof ( unsigned int ) ) ;
int jmpr = ( readw ( jmpr_p ) > > 2 ) & 0x07 ;
2005-04-16 15:20:36 -07:00
static const int pciclocks [ ] __initdata = {
33 , 20 , 25 , 30 , 12 , 16 , 37 , 10
} ;
int pciclock = pciclocks [ jmpr ] ;
char * argptr = prom_getcmdline ( ) ;
if ( pciclock ! = 33 & & ! strstr ( argptr , " idebus= " ) ) {
printk ( " WARNING: PCI clock is %dMHz, setting idebus \n " , pciclock ) ;
argptr + = strlen ( argptr ) ;
sprintf ( argptr , " idebus=%d " , pciclock ) ;
if ( pciclock < 20 | | pciclock > 66 )
printk ( " WARNING: IDE timing calculations will be incorrect \n " ) ;
}
}
# endif
# ifdef CONFIG_BLK_DEV_FD
fd_activate ( ) ;
# endif
# ifdef CONFIG_VT
# if defined(CONFIG_VGA_CONSOLE)
screen_info = ( struct screen_info ) {
0 , 25 , /* orig-x, orig-y */
0 , /* unused */
0 , /* orig-video-page */
0 , /* orig-video-mode */
80 , /* orig-video-cols */
0 , 0 , 0 , /* ega_ax, ega_bx, ega_cx */
25 , /* orig-video-lines */
VIDEO_TYPE_VGAC , /* orig-video-isVGA */
16 /* orig-video-points */
} ;
# endif
# endif
mips_reboot_setup ( ) ;
board_time_init = mips_time_init ;
2006-03-27 01:16:33 -08:00
rtc_mips_get_time = mips_rtc_get_time ;
2005-04-16 15:20:36 -07:00
}