summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-03-25 18:18:01 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-03-25 18:18:01 +0000
commitebe5abc87c2d56bfa8d3d6b671090c7edc062ebb (patch)
treeee15d40fad7c010ed7d54c8ecb163cc33eb2e06c /c/src/lib/libbsp/powerpc
parent2003-03-25 Thomas Doerfler <Thomas.Doerfler@imd-systems.de> (diff)
downloadrtems-ebe5abc87c2d56bfa8d3d6b671090c7edc062ebb.tar.bz2
2003-03-25 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
PR 368/filesystem * ide/*: added BSP support for libchip standard ide driver
Diffstat (limited to 'c/src/lib/libbsp/powerpc')
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog5
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/Makefile.am4
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/configure.ac1
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/ide/Makefile.am32
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/ide/idecfg.c51
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/ide/pcmcia_ide.c385
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h5
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/include/mbx.h2
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/startup/imbx8xx.c82
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/startup/mmutlbtab.c24
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/wrapup/Makefile.am2
11 files changed, 572 insertions, 21 deletions
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog b/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog
index d714cd1cf8..43f7b03567 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-25 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
+
+ PR 368/filesystem
+ * ide/*: added BSP support for libchip standard ide driver
+
2003-03-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove AC_CONFIG_AUX_DIR.
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/Makefile.am b/c/src/lib/libbsp/powerpc/mbx8xx/Makefile.am
index 07c908e8d0..d8315ce814 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/Makefile.am
@@ -6,8 +6,8 @@ ACLOCAL_AMFLAGS = -I ../../../../../../aclocal
# wrapup is the one that actually builds and installs the library
# from the individual .rel files built in other directories
-SUBDIRS = include clock console irq network startup vectors \
- @exceptions@ wrapup
+SUBDIRS = include clock console irq network ide startup vectors \
+ @exceptions@ wrapup
include $(top_srcdir)/../../bsp.am
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/configure.ac b/c/src/lib/libbsp/powerpc/mbx8xx/configure.ac
index 7478342c0e..d0496282d0 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/configure.ac
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/configure.ac
@@ -122,6 +122,7 @@ clock/Makefile
console/Makefile
include/Makefile
irq/Makefile
+ide/Makefile
network/Makefile
startup/Makefile
vectors/Makefile
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/ide/Makefile.am b/c/src/lib/libbsp/powerpc/mbx8xx/ide/Makefile.am
new file mode 100644
index 0000000000..ef3157533e
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/ide/Makefile.am
@@ -0,0 +1,32 @@
+##
+## Makefile.am,v 1.5 2002/08/11 06:59:03 ralf Exp
+##
+
+
+PGM = # $(ARCH)/console.rel
+
+C_FILES = idecfg.c pcmcia_ide.c
+C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.$(OBJEXT))
+
+OBJS = $(C_O_FILES)
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../../../../../../automake/compile.am
+include $(top_srcdir)/../../../../../../automake/lib.am
+
+#
+# (OPTIONAL) Add local stuff here using +=
+#
+
+$(PGM): $(OBJS)
+ $(make-rel)
+
+# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
+
+all-local: $(ARCH) $(OBJS) $(PGM)
+
+.PRECIOUS: $(PGM)
+
+EXTRA_DIST = idecfg.c
+
+include $(top_srcdir)/../../../../../../automake/local.am
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/ide/idecfg.c b/c/src/lib/libbsp/powerpc/mbx8xx/ide/idecfg.c
new file mode 100644
index 0000000000..4741c0f304
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/ide/idecfg.c
@@ -0,0 +1,51 @@
+/*===============================================================*\
+| Project: RTEMS MBX8xx IDE harddisc driver tables |
++-----------------------------------------------------------------+
+| File: idecfg.c |
++-----------------------------------------------------------------+
+| Copyright (c) 2003 IMD |
+| Ingenieurbuero fuer Microcomputertechnik Th. Doerfler |
+| <Thomas.Doerfler@imd-systems.de> |
+| all rights reserved |
++-----------------------------------------------------------------+
+| this file contains the table of functions for the BSP layer |
+| for IDE access below the libchip IDE harddisc driver |
+| |
++-----------------------------------------------------------------+
+| date history ID |
+| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
+| 01.14.03 creation doe |
+\*===============================================================*/
+
+#include <rtems.h>
+#include <bsp.h>
+#include <bsp/mbx.h>
+#include <mpc8xx.h>
+#include <libchip/ide_ctrl.h>
+#include <libchip/ide_ctrl_cfg.h>
+#include <libchip/ide_ctrl_io.h>
+
+
+/*
+ * The following table configures the IDE driver used in this BSP.
+ */
+extern ide_ctrl_fns_t mbx8xx_pcmciaide_ctrl_fns;
+
+/* IDE controllers Table */
+ide_controller_bsp_table_t IDE_Controller_Table[] = {
+ {"/dev/idepcmcia",
+ IDE_STD, /* PCMCIA Flash cards emulate standard IDE controller */
+ &mbx8xx_pcmciaide_ctrl_fns,
+ NULL, /* no BSP dependent probe needed */
+ FALSE, /* not (yet) initialized */
+ PCMCIA_MEM_ADDR, /* access address for register set */
+ FALSE,0, /* not (yet) interrupt driven */
+ NULL
+ }
+};
+
+/* Number of rows in IDE_Controller_Table */
+unsigned long IDE_Controller_Count =
+ sizeof(IDE_Controller_Table)/sizeof(IDE_Controller_Table[0]);
+
+
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/ide/pcmcia_ide.c b/c/src/lib/libbsp/powerpc/mbx8xx/ide/pcmcia_ide.c
new file mode 100644
index 0000000000..e747f40317
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/ide/pcmcia_ide.c
@@ -0,0 +1,385 @@
+/*===============================================================*\
+| Project: RTEMS MBX8xx PCMCIA IDE harddisc driver |
++-----------------------------------------------------------------+
+| File: pcmcia_ide.c |
++-----------------------------------------------------------------+
+| Copyright (c) 2003 IMD |
+| Ingenieurbuero fuer Microcomputertechnik Th. Doerfler |
+| <Thomas.Doerfler@imd-systems.de> |
+| all rights reserved |
++-----------------------------------------------------------------+
+| this file contains the BSP layer for PCMCIA IDE access below the|
+| libchip IDE harddisc driver |
+| based on a board specific driver from |
+| Eugeny S. Mints, Oktet |
+| |
+| The license and distribution terms for this file may be |
+| found in the file LICENSE in this distribution or at |
+| http://www.OARcorp.com/rtems/license.html. |
+| |
++-----------------------------------------------------------------+
+| date history ID |
+| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
+| 01.14.03 creation doe |
+\*===============================================================*/
+
+#include <rtems.h>
+#include <bsp.h>
+#include <bsp/mbx.h>
+#include <mpc8xx.h>
+#include <libchip/ide_ctrl.h>
+#include <libchip/ide_ctrl_cfg.h>
+#include <libchip/ide_ctrl_io.h>
+
+/* #define DATAREG_16BIT */ /* 16 bit mode not yet working */
+/* #define DEBUG_OUT */
+/*
+ * support functions for PCMCIA IDE IF
+ */
+/*=========================================================================*\
+| Function: |
+\*-------------------------------------------------------------------------*/
+boolean mbx8xx_pcmciaide_probe
+(
+/*-------------------------------------------------------------------------*\
+| Purpose: |
+| This function should probe, whether a PCMCIA flash disk is available |
++---------------------------------------------------------------------------+
+| Input Parameters: |
+\*-------------------------------------------------------------------------*/
+ int minor
+ )
+/*-------------------------------------------------------------------------*\
+| Return Value: |
+| TRUE, when flash disk available |
+\*=========================================================================*/
+{
+ boolean ide_card_plugged = TRUE; /* assume: we have a card plugged in */
+
+ /*
+ * check, that the CD# pins are low -> a PCMCIA card is plugged in
+ */
+ if ((m8xx.pipr
+ & (M8xx_PCMCIA_PIPR_CACD1 | M8xx_PCMCIA_PIPR_CACD2)) != 0x00) {
+ ide_card_plugged = FALSE;
+ }
+ /*
+ * set supply voltage to 3.3V
+ * FIXME: this should be depending on state of VS1/2 pins
+ * FIXME: there should be a shadow variable for the BSP for CSR2 access
+ */
+ *((volatile unsigned8 *)MBX_CSR2) = 0xb0;
+ /*
+ * check card information service whether card is a ATA like disk
+ * -> scan for tuple of type 0x21 with content 0x04 0xXX (fixed disk)
+ * -> scan for tuple of type 0x22 with content 0x01 0x01
+ */
+ if (ide_card_plugged) {
+#define CIS_BYTE(pos) (((unsigned8 *)PCMCIA_ATTRB_ADDR)[(pos)*2])
+ int cis_pos = 0;
+ boolean fixed_disk_tuple_found = FALSE;
+ boolean ata_disk_tuple_found = FALSE;
+
+ while ((cis_pos < 256) &&
+ (CIS_BYTE(cis_pos) != 0xff) &&
+ (!fixed_disk_tuple_found || !ata_disk_tuple_found)) {
+ /*
+ * check for neede tuples
+ */
+ if ((CIS_BYTE(cis_pos ) == 0x21) &&
+ (CIS_BYTE(cis_pos+2) == 0x04)) {
+ fixed_disk_tuple_found = TRUE;
+ }
+ else if ((CIS_BYTE(cis_pos ) == 0x22) &&
+ (CIS_BYTE(cis_pos+2) == 0x01) &&
+ (CIS_BYTE(cis_pos+3) == 0x01)) {
+ ata_disk_tuple_found = TRUE;
+ }
+ /*
+ * advance using the length field
+ */
+ cis_pos += CIS_BYTE(cis_pos+1)+2;
+ }
+ ide_card_plugged = fixed_disk_tuple_found && ata_disk_tuple_found;
+ }
+ return ide_card_plugged;
+}
+
+/*=========================================================================*\
+| Function: |
+\*-------------------------------------------------------------------------*/
+void mbx8xx_pcmciaide_initialize
+(
+/*-------------------------------------------------------------------------*\
+| Purpose: |
+| initialize PCMCIA IDE flash card access |
++---------------------------------------------------------------------------+
+| Input Parameters: |
+\*-------------------------------------------------------------------------*/
+ int minor /* controller minor number */
+ )
+/*-------------------------------------------------------------------------*\
+| Return Value: |
+| <none> |
+\*=========================================================================*/
+{
+ /*
+ * FIXME: enable interrupts, if needed
+ */
+ /*
+ * FIXME: set programming voltage as requested
+ */
+}
+
+/*=========================================================================*\
+| Function: |
+\*-------------------------------------------------------------------------*/
+void mbx8xx_pcmciaide_read_reg
+(
+/*-------------------------------------------------------------------------*\
+| Purpose: |
+| read a PCMCIA IDE controller register |
++---------------------------------------------------------------------------+
+| Input Parameters: |
+\*-------------------------------------------------------------------------*/
+ int minor, /* controller minor number */
+ int reg, /* register index to access */
+ unsigned16 *value /* ptr to return value location */
+ )
+/*-------------------------------------------------------------------------*\
+| Return Value: |
+| <none> |
+\*=========================================================================*/
+{
+ unsigned32 port = IDE_Controller_Table[minor].port1;
+
+ if (reg == IDE_REGISTER_DATA_WORD) {
+#ifdef DATAREG_16BIT
+ *value = *(volatile unsigned16 *)(port+reg);
+#else
+ *value = ((*(volatile unsigned8 *)(port+reg) << 8) +
+ (*(volatile unsigned8 *)(port+reg+1) ));
+#endif
+ }
+ else {
+ *value = *(volatile unsigned8 *)(port+reg);
+ }
+#ifdef DEBUG_OUT
+ printk("mbx8xx_pcmciaide_read_reg(0x%x)=0x%x\r\n",reg,*value & 0xff);
+#endif
+}
+
+/*=========================================================================*\
+| Function: |
+\*-------------------------------------------------------------------------*/
+void mbx8xx_pcmciaide_write_reg
+(
+/*-------------------------------------------------------------------------*\
+| Purpose: |
+| write a PCMCIA IDE controller register |
++---------------------------------------------------------------------------+
+| Input Parameters: |
+\*-------------------------------------------------------------------------*/
+ int minor, /* controller minor number */
+ int reg, /* register index to access */
+ unsigned16 value /* value to write */
+ )
+/*-------------------------------------------------------------------------*\
+| Return Value: |
+| <none> |
+\*=========================================================================*/
+{
+ unsigned32 port = IDE_Controller_Table[minor].port1;
+
+#ifdef DEBUG_OUT
+ printk("mbx8xx_pcmciaide_write_reg(0x%x,0x%x)\r\n",reg,value & 0xff);
+#endif
+ if (reg == IDE_REGISTER_DATA_WORD) {
+#ifdef DATAREG_16BIT
+ *(volatile unsigned16 *)(port+reg) = value;
+#else
+ *(volatile unsigned8 *)(port+reg) = value >> 8;
+ *(volatile unsigned8 *)(port+reg+1) = value;
+#endif
+ }
+ else {
+ *(volatile unsigned8 *)(port+reg)= value;
+ }
+}
+
+/*=========================================================================*\
+| Function: |
+\*-------------------------------------------------------------------------*/
+void mbx8xx_pcmciaide_read_block
+(
+/*-------------------------------------------------------------------------*\
+| Purpose: |
+| read a PCMCIA IDE controller register |
++---------------------------------------------------------------------------+
+| Input Parameters: |
+\*-------------------------------------------------------------------------*/
+ int minor,
+ unsigned16 block_size,
+ blkdev_sg_buffer *bufs,
+ rtems_unsigned32 *cbuf,
+ rtems_unsigned32 *pos
+ )
+/*-------------------------------------------------------------------------*\
+| Return Value: |
+| <none> |
+\*=========================================================================*/
+{
+ unsigned32 port = IDE_Controller_Table[minor].port1;
+ unsigned16 cnt = 0;
+#ifdef DEBUG_OUT
+ printk("mbx8xx_pcmciaide_read_block()\r\n");
+#endif
+#ifdef DATAREG_16BIT
+ unsigned16 *lbuf = (unsigned16 *)
+ ((unsigned8 *)(bufs[(*cbuf)].buffer) + (*pos));
+#else
+ unsigned8 *lbuf = (unsigned8 *)
+ ((unsigned8 *)(bufs[(*cbuf)].buffer) + (*pos));
+#endif
+ unsigned32 llength = bufs[(*cbuf)].length;
+
+ while (((*(volatile unsigned8 *)(port+IDE_REGISTER_STATUS))
+ & IDE_REGISTER_STATUS_DRQ) &&
+ (cnt < block_size)) {
+#ifdef DATAREG_16BIT
+ *lbuf++ = *(volatile unsigned16 *)(port+8); /* 16 bit data port */
+ cnt += 2;
+ (*pos) += 2;
+#else
+ *lbuf++ = *(volatile unsigned8 *)(port+IDE_REGISTER_DATA);
+ cnt += 1;
+ (*pos) += 1;
+#endif
+ if ((*pos) == llength) {
+ (*pos) = 0;
+ (*cbuf)++;
+ lbuf = bufs[(*cbuf)].buffer;
+ llength = bufs[(*cbuf)].length;
+ }
+ }
+}
+
+/*=========================================================================*\
+| Function: |
+\*-------------------------------------------------------------------------*/
+void mbx8xx_pcmciaide_write_block
+(
+/*-------------------------------------------------------------------------*\
+| Purpose: |
+| write a PCMCIA IDE controller register |
++---------------------------------------------------------------------------+
+| Input Parameters: |
+\*-------------------------------------------------------------------------*/
+ int minor,
+ unsigned16 block_size,
+ blkdev_sg_buffer *bufs,
+ rtems_unsigned32 *cbuf,
+ rtems_unsigned32 *pos
+ )
+/*-------------------------------------------------------------------------*\
+| Return Value: |
+| <none> |
+\*=========================================================================*/
+{
+ unsigned32 port = IDE_Controller_Table[minor].port1;
+ unsigned16 cnt = 0;
+
+#ifdef DEBUG_OUT
+ printk("mbx8xx_pcmciaide_write_block()\r\n");
+#endif
+#ifdef DATA_REG_16BIT
+ unsigned16 *lbuf = (unsigned16 *)
+ ((unsigned8 *)(bufs[(*cbuf)].buffer) + (*pos));
+#else
+ unsigned8 *lbuf = (unsigned8 *)
+ ((unsigned8 *)(bufs[(*cbuf)].buffer) + (*pos));
+#endif
+ unsigned32 llength = bufs[(*cbuf)].length;
+
+ while (((*(volatile unsigned8 *)(port+IDE_REGISTER_STATUS))
+ & IDE_REGISTER_STATUS_DRQ) &&
+ (cnt < block_size)) {
+#ifdef DATAREG_16BIT
+ *(volatile unsigned16 *)(port+8) = *lbuf++; /* 16 bit data port */
+ cnt += 2;
+ (*pos) += 2;
+#else
+ *(volatile unsigned8 *)(port+IDE_REGISTER_DATA) = *lbuf++;
+ cnt += 1;
+ (*pos) += 1;
+#endif
+ if ((*pos) == llength) {
+ (*pos) = 0;
+ (*cbuf)++;
+ lbuf = bufs[(*cbuf)].buffer;
+ llength = bufs[(*cbuf)].length;
+ }
+ }
+}
+
+/*=========================================================================*\
+| Function: |
+\*-------------------------------------------------------------------------*/
+int mbx8xx_pcmciaide_control
+(
+/*-------------------------------------------------------------------------*\
+| Purpose: |
+| control interface for controller |
++---------------------------------------------------------------------------+
+| Input Parameters: |
+\*-------------------------------------------------------------------------*/
+ int minor, /* controller minor number */
+ unsigned32 cmd, /* command to send */
+ void * arg /* optional argument */
+ )
+/*-------------------------------------------------------------------------*\
+| Return Value: |
+| <none> |
+\*=========================================================================*/
+{
+ return 0;
+}
+
+/*=========================================================================*\
+| Function: |
+\*-------------------------------------------------------------------------*/
+rtems_status_code mbx8xx_pcmciaide_config_io_speed
+(
+/*-------------------------------------------------------------------------*\
+| Purpose: |
+| set up transfer speed, if possible |
++---------------------------------------------------------------------------+
+| Input Parameters: |
+\*-------------------------------------------------------------------------*/
+ int minor, /* controller minor number */
+ unsigned8 modes_avail /* optional argument */
+ )
+/*-------------------------------------------------------------------------*\
+| Return Value: |
+| rtems_status_code |
+\*=========================================================================*/
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * The following table configures the functions used for IDE drivers
+ * in this BSP.
+ */
+
+ide_ctrl_fns_t mbx8xx_pcmciaide_ctrl_fns = {
+ mbx8xx_pcmciaide_probe,
+ mbx8xx_pcmciaide_initialize,
+ mbx8xx_pcmciaide_control,
+ mbx8xx_pcmciaide_read_reg,
+ mbx8xx_pcmciaide_write_reg,
+ mbx8xx_pcmciaide_read_block,
+ mbx8xx_pcmciaide_write_block,
+ mbx8xx_pcmciaide_config_io_speed
+};
+
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h b/c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h
index b5acccc36e..c2d4a4dffd 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h
@@ -113,6 +113,11 @@ extern rtems_configuration_table BSP_Configuration;
*/
/*
+ * indicate, that BSP has IDE driver
+ */
+#define RTEMS_BSP_HAS_IDE_DRIVER
+
+/*
* How many libio files we want
*/
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/include/mbx.h b/c/src/lib/libbsp/powerpc/mbx8xx/include/mbx.h
index 0c72b4a9a9..97df2fb954 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/include/mbx.h
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/include/mbx.h
@@ -59,4 +59,6 @@ typedef struct bd_info {
#define IMAP_SIZE ((unsigned int)(64 * 1024))
#define PCI_CSR_ADDR ((unsigned int)0xfa210000)
#define PCI_CSR_SIZE ((unsigned int)(64 * 1024))
+
+#define MBX_CSR2 (MBX_CSR_ADDR+1)
#endif
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/startup/imbx8xx.c b/c/src/lib/libbsp/powerpc/mbx8xx/startup/imbx8xx.c
index 716e86ab61..996c29f454 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/startup/imbx8xx.c
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/startup/imbx8xx.c
@@ -11,6 +11,7 @@
*/
#include <bsp.h>
+#include <bsp/mbx.h>
/*
* EPPCBug rev 1.1 is stupid. It clears the interrupt mask register
@@ -156,11 +157,6 @@ void _InitMBX8xx (void)
register unsigned32 r1, i;
extern unsigned32 simask_copy;
- /*
- * Get the SIU interrupt mask.
- */
- simask_copy = m8xx.simask;
-
/*
* Initialize the Debug Enable Register (DER) to an appropriate
* value for EPPCBug debugging.
@@ -213,6 +209,12 @@ void _InitMBX8xx (void)
r1 = 0xFA200000;
_mtspr( M8xx_IMMR, r1 );
+ /*
+ * Get the SIU interrupt mask.
+ * imd: accessing m8xx.* should not occure before setting up the immr !
+ */
+ simask_copy = m8xx.simask;
+
/*
* Initialize the SIU Module Configuration Register (SIUMCR)
* m8xx.siumcr = 0x00602900, the default MBX and firmware value.
@@ -274,7 +276,16 @@ void _InitMBX8xx (void)
m8xx.plprck = M8xx_UNLOCK_KEY; /* unlock PLPRCR */
#if ( defined(mbx821_001) || defined(mbx821_001b) || defined(mbx860_001b) )
m8xx.plprcr = 0x5F500000;
-#elif ( defined(mbx860_005b) )
+#elif ( defined(mbx860_005b) || \
+ defined(mbx860_002b) || \
+ defined(mbx860_003b) || \
+ defined(mbx860_004b) || \
+ defined(mbx860_006b) || \
+ defined(mbx821_002b) || \
+ defined(mbx821_003b) || \
+ defined(mbx821_004b) || \
+ defined(mbx821_005b) || \
+ defined(mbx821_006b) )
/* Set the multiplication factor to 0 and clear the timer interrupt status*/
m8xx.plprcr = 0x00005000;
#elif ( defined(mbx860_001) || \
@@ -282,19 +293,10 @@ void _InitMBX8xx (void)
defined(mbx860_003) || \
defined(mbx860_004) || \
defined(mbx860_005) || \
- defined(mbx860_002b) || \
- defined(mbx860_003b) || \
- defined(mbx860_004b) || \
- defined(mbx860_006b) || \
defined(mbx821_002) || \
defined(mbx821_003) || \
defined(mbx821_004) || \
- defined(mbx821_005) || \
- defined(mbx821_002b) || \
- defined(mbx821_003b) || \
- defined(mbx821_004b) || \
- defined(mbx821_005b) || \
- defined(mbx821_006b) )
+ defined(mbx821_005))
m8xx.plprcr = 0x4C400000;
#else
#error "MBX board not defined"
@@ -582,4 +584,52 @@ void _InitMBX8xx (void)
#endif
m8xx.memc[7]._br = M8xx_BR_BA(0xFC000000) | M8xx_BR_AT(0) | M8xx_BR_PS8 |
M8xx_BR_MS_GPCM | M8xx_MEMC_BR_V;
+ /*
+ * PCMCIA initialization
+ */
+ /*
+ * PCMCIA region 0: common memory
+ */
+ m8xx.pbr0 = PCMCIA_MEM_ADDR;
+ m8xx.por0 = (M8xx_PCMCIA_POR_BSIZE_64MB
+ | M8xx_PCMCIA_POR_PSHT(15) | M8xx_PCMCIA_POR_PSST(15)
+ | M8xx_PCMCIA_POR_PSL(32)
+ | M8xx_PCMCIA_POR_PPS_16 | M8xx_PCMCIA_POR_PRS_MEM
+ |M8xx_PCMCIA_POR_PSLOT_A | M8xx_PCMCIA_POR_VALID);
+ /*
+ * PCMCIA region 1: dma memory
+ */
+ m8xx.pbr1 = PCMCIA_DMA_ADDR;
+ m8xx.por1 = (M8xx_PCMCIA_POR_BSIZE_64MB
+ | M8xx_PCMCIA_POR_PSHT(15) | M8xx_PCMCIA_POR_PSST(15)
+ | M8xx_PCMCIA_POR_PSL(32)
+ | M8xx_PCMCIA_POR_PPS_16 | M8xx_PCMCIA_POR_PRS_DMA
+ |M8xx_PCMCIA_POR_PSLOT_A | M8xx_PCMCIA_POR_VALID);
+ /*
+ * PCMCIA region 2: attribute memory
+ */
+ m8xx.pbr2 = PCMCIA_ATTRB_ADDR;
+ m8xx.por2 = (M8xx_PCMCIA_POR_BSIZE_64MB
+ | M8xx_PCMCIA_POR_PSHT(15) | M8xx_PCMCIA_POR_PSST(15)
+ | M8xx_PCMCIA_POR_PSL(32)
+ | M8xx_PCMCIA_POR_PPS_16 | M8xx_PCMCIA_POR_PRS_ATT
+ |M8xx_PCMCIA_POR_PSLOT_A | M8xx_PCMCIA_POR_VALID);
+ /*
+ * PCMCIA region 3: I/O access
+ */
+ m8xx.pbr3 = PCMCIA_IO_ADDR;
+ m8xx.por3 = (M8xx_PCMCIA_POR_BSIZE_64MB
+ | M8xx_PCMCIA_POR_PSHT(15) | M8xx_PCMCIA_POR_PSST(15)
+ | M8xx_PCMCIA_POR_PSL(32)
+ | M8xx_PCMCIA_POR_PPS_16 | M8xx_PCMCIA_POR_PRS_IO
+ |M8xx_PCMCIA_POR_PSLOT_A | M8xx_PCMCIA_POR_VALID);
+
+ /*
+ * PCMCIA interface general control reg
+ */
+ m8xx.pgcra = 0; /* no special options set */
+ /*
+ * PCMCIA interface enable reg
+ */
+ m8xx.per =0; /* no interrupts enabled now */
}
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/startup/mmutlbtab.c b/c/src/lib/libbsp/powerpc/mbx8xx/startup/mmutlbtab.c
index 6330bc1741..a1be4cd761 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/startup/mmutlbtab.c
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/startup/mmutlbtab.c
@@ -12,7 +12,7 @@
#include <bsp.h>
#include <mpc8xx/mmu.h>
-
+#include <bsp/mbx.h>
/*
* This MMU_TLB_table is used to statically initialize the Table Lookaside
* Buffers in the MMU of the MBX8xx board.
@@ -166,7 +166,27 @@ MMU_TLB_table_t MMU_TLB_table[] = {
* R/W,X for all, no ASID comparison, cache-inhibited.
* EPN TWC RPN
*/
- { 0xFA210200, 0x11, 0xFA2109F7 } /* QSPAN - PS=4K */
+ { 0xFA210200, 0x11, 0xFA2109F7 }, /* QSPAN - PS=4K */
+ /*
+ *
+ * PCMCIA Spaces: Start address 0xE0000000, 256M?
+ * For each space (MEM/DMA/ATTRIB/IO) only the first 8MB are mapped
+ * ASID=0x0, APG=0x0, guarded memory,
+ * R/W,X for all, no ASID comparison, cache-inhibited.
+ * EPN TWC
+ * RPN
+ */
+ { (PCMCIA_MEM_ADDR & 0xfffff000) | 0x200, 0x1D,
+ (PCMCIA_MEM_ADDR & 0xfffff000) | 0x9F7 },/* PCMCIA Memory - PS=8M */
+
+ { (PCMCIA_DMA_ADDR & 0xfffff000) | 0x200, 0x1D,
+ (PCMCIA_DMA_ADDR & 0xfffff000) | 0x9F7 },/* PCMCIA DMA - PS=8M */
+
+ { (PCMCIA_ATTRB_ADDR & 0xfffff000) | 0x200, 0x1D,
+ (PCMCIA_ATTRB_ADDR & 0xfffff000) | 0x9F7 },/* PCMCIA ATTRIB-PS=8M*/
+
+ { (PCMCIA_IO_ADDR & 0xfffff000) | 0x200, 0x1D,
+ (PCMCIA_IO_ADDR & 0xfffff000) | 0x9F7 } /* PCMCIA I/O - PS=8M */
};
/*
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/wrapup/Makefile.am b/c/src/lib/libbsp/powerpc/mbx8xx/wrapup/Makefile.am
index 8ea960887e..b01c23c9c4 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/wrapup/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/wrapup/Makefile.am
@@ -7,7 +7,7 @@ if HAS_NETWORKING
NETWORKING = network
endif
-BSP_PIECES = clock irq startup console vectors $(NETWORKING)
+BSP_PIECES = clock irq ide startup console vectors $(NETWORKING)
# pieces to pick up out of libcpu/ppc
# CPU_PIECES = mpc8xx/clock mpc8xx/console-generic mpc8xx/cpm \
# mpc8xx/mmu mpc8xx/timer mpc8xx/vectors