linux-cvs-patches
[Top] [All Lists]

CVS Update@linux-mips.org: linux

To: linux-cvs-patches@linux-mips.org
Subject: CVS Update@linux-mips.org: linux
From: ppopov@linux-mips.org
Date: Sun, 30 Jan 2005 08:10:35 +0000
Reply-to: linux-mips@linux-mips.org
Sender: linux-cvs-patches-bounce@linux-mips.org
CVSROOT:        /home/cvs
Module name:    linux
Changes by:     ppopov@ftp.linux-mips.org       05/01/30 08:10:29

Modified files:
        arch/mips/au1000/pb1100: Tag: linux_2_4 Makefile 
        include/asm-mips: Tag: linux_2_4 pb1100.h 
Added files:
        arch/mips/au1000/pb1100: Tag: linux_2_4 mmc_support.c 

Log message:
        Pb1100 .h file updates and mmc support functions.

diff -urN linux/arch/mips/au1000/pb1100/mmc_support.c 
linux/arch/mips/au1000/pb1100/mmc_support.c
--- linux/arch/mips/au1000/pb1100/Attic/mmc_support.c   1970/01/01 00:00:00
+++ linux/arch/mips/au1000/pb1100/Attic/mmc_support.c   Sun Jan 30 08:10:29 
2005        1.1.2.1
@@ -0,0 +1,126 @@
+/*
+ * BRIEF MODULE DESCRIPTION
+ *
+ *     MMC support routines for PB1100.
+ *
+ *
+ * Copyright (c) 2003-2004 Embedded Edge, LLC.
+ * Author: Embedded Edge, LLC.
+ * Contact: dan@embeddededge.com
+ *
+ *  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.
+ *
+ */
+
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+
+#include <asm/irq.h>
+#include <asm/au1000.h>
+#include <asm/au1100_mmc.h>
+#include <asm/pb1100.h>
+
+
+/* SD/MMC controller support functions */
+
+/*
+ * Detect card.
+ */
+void mmc_card_inserted(int _n_, int *_res_)
+{
+       u32 gpios = au_readl(SYS_PINSTATERD);
+       u32 emptybit = (_n_) ? (1<<15) : (1<<14);
+       *_res_ = ((gpios & emptybit) == 0);
+}
+
+/*
+ * Check card write protection.
+ */
+void mmc_card_writable(int _n_, int *_res_)
+{
+       BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
+       unsigned long mmc_wp, board_specific;
+
+       if (_n_) {
+               mmc_wp = BCSR_PCMCIA_SD1_WP;
+       } else {
+               mmc_wp = BCSR_PCMCIA_SD0_WP;
+       }
+
+       board_specific = au_readl((unsigned long)(&bcsr->pcmcia));
+
+       if (!(board_specific & mmc_wp)) {/* low means card writable */
+               *_res_ = 1;
+       } else {
+               *_res_ = 0;
+       }
+}
+
+/*
+ * Apply power to card slot.
+ */
+void mmc_power_on(int _n_)
+{
+       BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
+       unsigned long mmc_pwr, board_specific;
+
+       if (_n_) {
+               mmc_pwr = BCSR_PCMCIA_SD1_PWR;
+       } else {
+               mmc_pwr = BCSR_PCMCIA_SD0_PWR;
+       }
+
+       board_specific = au_readl((unsigned long)(&bcsr->pcmcia));
+       board_specific |= mmc_pwr;
+
+       au_writel(board_specific, (int)(&bcsr->pcmcia));
+       au_sync_delay(1);
+}
+
+/*
+ * Remove power from card slot.
+ */
+void mmc_power_off(int _n_)
+{
+       BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
+       unsigned long mmc_pwr, board_specific;
+
+       if (_n_) {
+               mmc_pwr = BCSR_PCMCIA_SD1_PWR;
+       } else {
+               mmc_pwr = BCSR_PCMCIA_SD0_PWR;
+       }
+
+       board_specific = au_readl((unsigned long)(&bcsr->pcmcia));
+       board_specific &= ~mmc_pwr;
+
+       au_writel(board_specific, (int)(&bcsr->pcmcia));
+       au_sync_delay(1);
+}
+
+EXPORT_SYMBOL(mmc_card_inserted);
+EXPORT_SYMBOL(mmc_card_writable);
+EXPORT_SYMBOL(mmc_power_on);
+EXPORT_SYMBOL(mmc_power_off);
+
diff -urN linux/arch/mips/au1000/pb1100/Makefile 
linux/arch/mips/au1000/pb1100/Makefile
--- linux/arch/mips/au1000/pb1100/Makefile      2003/07/09 20:05:55     1.1.2.5
+++ linux/arch/mips/au1000/pb1100/Makefile      2005/01/30 08:10:29     1.1.2.6
@@ -16,4 +16,10 @@
 
 obj-y := init.o board_setup.o irqmap.o
 
+
+ifdef CONFIG_MMC
+obj-y += mmc_support.o
+export-objs += mmc_support.o
+endif
+
 include $(TOPDIR)/Rules.make
diff -urN linux/include/asm-mips/pb1100.h linux/include/asm-mips/pb1100.h
--- linux/include/asm-mips/Attic/pb1100.h       2003/03/13 00:04:48     1.1.2.3
+++ linux/include/asm-mips/Attic/pb1100.h       2005/01/30 08:10:29     1.1.2.4
@@ -1,5 +1,5 @@
 /*
- * Alchemy Semi PB1100 Referrence Board
+ * AMD Alchemy PB1100 Reference Boards
  *
  * Copyright 2001 MontaVista Software Inc.
  * Author: MontaVista Software, Inc.
@@ -27,55 +27,108 @@
 #ifndef __ASM_PB1100_H
 #define __ASM_PB1100_H
 
-#define PB1100_IDENT          0xAE000000
-#define BOARD_STATUS_REG      0xAE000004
-  #define PB1100_ROM_SEL         (1<<15)
-  #define PB1100_ROM_SIZ         (1<<14)
-  #define PB1100_SWAP_BOOT       (1<<13)
-  #define PB1100_FLASH_WP        (1<<12)
-  #define PB1100_ROM_H_STS       (1<<11)
-  #define PB1100_ROM_L_STS       (1<<10)
-  #define PB1100_FLASH_H_STS      (1<<9)
-  #define PB1100_FLASH_L_STS      (1<<8)
-  #define PB1100_SRAM_SIZ         (1<<7)
-  #define PB1100_TSC_BUSY         (1<<6)
-  #define PB1100_PCMCIA_VS_MASK   (3<<4)
-  #define PB1100_RS232_CD         (1<<3)
-  #define PB1100_RS232_CTS        (1<<2)
-  #define PB1100_RS232_DSR        (1<<1)
-  #define PB1100_RS232_RI         (1<<0)
-
-#define PB1100_IRDA_RS232     0xAE00000C
-  #define PB1100_IRDA_FULL       (0<<14) /* full power */
-  #define PB1100_IRDA_SHUTDOWN   (1<<14)
-  #define PB1100_IRDA_TT         (2<<14) /* 2/3 power */
-  #define PB1100_IRDA_OT         (3<<14) /* 1/3 power */
-  #define PB1100_IRDA_FIR        (1<<13)
-
-#define PCMCIA_BOARD_REG     0xAE000010
-  #define PB1100_SD_WP1_RO       (1<<15) /* read only */
-  #define PB1100_SD_WP0_RO       (1<<14) /* read only */
-  #define PB1100_SD_PWR1         (1<<11) /* applies power to SD1 */
-  #define PB1100_SD_PWR0         (1<<10) /* applies power to SD0 */
-  #define PB1100_SEL_SD_CONN1     (1<<9)
-  #define PB1100_SEL_SD_CONN0     (1<<8)
-  #define PC_DEASSERT_RST         (1<<7)
-  #define PC_DRV_EN               (1<<4)
-
-#define PB1100_G_CONTROL      0xAE000014 /* graphics control */
-
-#define PB1100_RST_VDDI       0xAE00001C
-  #define PB1100_SOFT_RESET      (1<<15) /* clear to reset the board */
-  #define PB1100_VDDI_MASK        (0x1F)
+#define BCSR_KSEG1_ADDR 0xAE000000
+
+/*
+ * Overlay data structure of the Pb1100 board registers.
+ * Registers located at physical 0E0000xx, KSEG1 0xAE0000xx
+ */
+typedef volatile struct
+{
+       /*00*/  unsigned short whoami;
+                       unsigned short reserved0;
+       /*04*/  unsigned short status;
+                       unsigned short reserved1;
+       /*08*/  unsigned short switches;
+                       unsigned short reserved2;
+       /*0C*/  unsigned short resets;
+                       unsigned short reserved3;
+       /*10*/  unsigned short pcmcia;
+                       unsigned short reserved4;
+       /*14*/  unsigned short graphics; 
+                       unsigned short reserved5;
+       /*18*/  unsigned short leds;
+                       unsigned short reserved6;
+       /*1C*/  unsigned short swreset;
+                       unsigned short reserved7;
+
+} BCSR;
 
-#define PB1100_LEDS           0xAE000018
 
-/* 11:8 is 4 discreet LEDs. Clearing a bit illuminates the LED.
- * 7:0 is the LED Display's decimal points.
+/*
+ * Register/mask bit definitions for the BCSRs
  */
-#define PB1100_HEX_LED        0xAE000018
+#define BCSR_WHOAMI_DCID               0x000F  
+#define BCSR_WHOAMI_CPLD               0x00F0
+#define BCSR_WHOAMI_BOARD              0x0F00 
+
+#define BCSR_STATUS_RS232_RI           0x0001 
+#define BCSR_STATUS_RS232_DSR          0x0002 
+#define BCSR_STATUS_RS232_CTS          0x0004  
+#define BCSR_STATUS_RS232_CD           0x0008   
+#define BCSR_STATUS_PCMCIA_VS_MASK     0x0030 
+#define BCSR_STATUS_TSC_BUSY           0x0040 
+#define BCSR_STATUS_SRAM_SIZ           0x0080 
+#define BCSR_STATUS_FLASH_L_STS        0x0100 
+#define BCSR_STATUS_FLASH_H_STS        0x0200  
+#define BCSR_STATUS_ROM_H_STS          0x0400 
+#define BCSR_STATUS_ROM_L_STS          0x0800  
+#define BCSR_STATUS_FLASH_WP           0x1000 
+#define BCSR_STATUS_SWAP_BOOT          0x2000
+#define BCSR_STATUS_ROM_SIZ                    0x4000 
+#define BCSR_STATUS_ROM_SEL            0x8000  
+
+#define BCSR_SWITCHES_DIP              0x00FF
+#define BCSR_SWITCHES_DIP_1            0x0080
+#define BCSR_SWITCHES_DIP_2            0x0040
+#define BCSR_SWITCHES_DIP_3            0x0020
+#define BCSR_SWITCHES_DIP_4            0x0010
+#define BCSR_SWITCHES_DIP_5            0x0008
+#define BCSR_SWITCHES_DIP_6            0x0004
+#define BCSR_SWITCHES_DIP_7            0x0002
+#define BCSR_SWITCHES_DIP_8            0x0001
+#define BCSR_SWITCHES_ROTARY           0x0F00
+#define BCSR_SWITCHES_SDO_CL           0x8000
+
+#define BCSR_RESETS_PHY0               0x0001
+#define BCSR_RESETS_PHY1               0x0002
+#define BCSR_RESETS_DC                 0x0004
+#define BCSR_RESETS_RS232_RTS          0x0100
+#define BCSR_RESETS_RS232_DTR          0x0200
+#define BCSR_RESETS_FIR_SEL            0x2000
+#define BCSR_RESETS_IRDA_MODE_MASK     0xC000
+#define BCSR_RESETS_IRDA_MODE_FULL     0x0000
+#define BCSR_RESETS_IRDA_MODE_OFF      0x4000
+#define BCSR_RESETS_IRDA_MODE_2_3      0x8000
+#define BCSR_RESETS_IRDA_MODE_1_3      0xC000
+
+#define BCSR_PCMCIA_PC0VPP             0x0003
+#define BCSR_PCMCIA_PC0VCC             0x000C
+#define BCSR_PCMCIA_PC0_DR_VEN         0x0010
+#define BCSR_PCMCIA_PC0RST             0x0080
+#define BCSR_PCMCIA_SEL_SD_CON0        0x0100
+#define BCSR_PCMCIA_SEL_SD_CON1        0x0200
+#define BCSR_PCMCIA_SD0_PWR            0x0400
+#define BCSR_PCMCIA_SD1_PWR            0x0800
+#define BCSR_PCMCIA_SD0_WP             0x4000
+#define BCSR_PCMCIA_SD1_WP             0x8000
+
+#define PB1100_G_CONTROL               0xAE000014
+#define BCSR_GRAPHICS_GPX_SMPASS       0x0010
+#define BCSR_GRAPHICS_GPX_BIG_ENDIAN   0x0020
+#define BCSR_GRAPHICS_GPX_RST          0x0040
+
+#define BCSR_LEDS_DECIMALS             0x00FF
+#define BCSR_LEDS_LED0                 0x0100
+#define BCSR_LEDS_LED1                 0x0200
+#define BCSR_LEDS_LED2                 0x0400
+#define BCSR_LEDS_LED3                 0x0800
+
+#define BCSR_SWRESET_RESET             0x0080
+#define BCSR_VDDI_VDI                  0x001F
 
-/* PCMCIA PB1100 specific defines */
+
+ /* PCMCIA Pb1x00 specific defines */
 #define PCMCIA_MAX_SOCK 0
 #define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
 
@@ -83,3 +136,4 @@
 #define SET_VCC_VPP(VCC, VPP) (((VCC)<<2) | ((VPP)<<0))
 
 #endif /* __ASM_PB1100_H */
+

<Prev in Thread] Current Thread [Next in Thread>