Upgrade rb532 to .23, provide generic GPIO API to this board

SVN-Revision: 10171
This commit is contained in:
Florian Fainelli 2008-01-11 10:42:06 +00:00
parent 3d7e6cc290
commit 918e830718
15 changed files with 555 additions and 210 deletions

View file

@ -11,7 +11,7 @@ BOARD:=rb532
BOARDNAME:=Mikrotik RouterBoard 532
FEATURES:=jffs2 pci tgz
LINUX_VERSION:=2.6.22.4
LINUX_VERSION:=2.6.23.12
include $(INCLUDE_DIR)/target.mk

View file

@ -0,0 +1,200 @@
CONFIG_32BIT=y
# CONFIG_64BIT is not set
# CONFIG_8139TOO is not set
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
# CONFIG_ARCH_SUPPORTS_MSI is not set
# CONFIG_ATM is not set
# CONFIG_AX25 is not set
CONFIG_BASE_SMALL=0
CONFIG_BITREVERSE=y
# CONFIG_BLK_DEV_CF_MIPS is not set
# CONFIG_BT is not set
# CONFIG_CPU_BIG_ENDIAN is not set
CONFIG_CPU_HAS_LLSC=y
CONFIG_CPU_HAS_PREFETCH=y
CONFIG_CPU_HAS_SYNC=y
CONFIG_CPU_LITTLE_ENDIAN=y
# CONFIG_CPU_LOONGSON2 is not set
CONFIG_CPU_MIPS32=y
CONFIG_CPU_MIPS32_R1=y
# CONFIG_CPU_MIPS32_R2 is not set
# CONFIG_CPU_MIPS64_R1 is not set
# CONFIG_CPU_MIPS64_R2 is not set
CONFIG_CPU_MIPSR1=y
# CONFIG_CPU_NEVADA is not set
# CONFIG_CPU_R10000 is not set
# CONFIG_CPU_R3000 is not set
# CONFIG_CPU_R4300 is not set
# CONFIG_CPU_R4X00 is not set
# CONFIG_CPU_R5000 is not set
# CONFIG_CPU_R5432 is not set
# CONFIG_CPU_R6000 is not set
# CONFIG_CPU_R8000 is not set
# CONFIG_CPU_RM7000 is not set
# CONFIG_CPU_RM9000 is not set
# CONFIG_CPU_SB1 is not set
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
CONFIG_CPU_SUPPORTS_HIGHMEM=y
# CONFIG_CPU_TX39XX is not set
# CONFIG_CPU_TX49XX is not set
# CONFIG_CPU_VR41XX is not set
# CONFIG_CRYPTO_HW is not set
CONFIG_DEVPORT=y
# CONFIG_DM9000 is not set
CONFIG_DMA_NEED_PCI_MAP_STATE=y
CONFIG_DMA_NONCOHERENT=y
CONFIG_EXT2_FS=y
CONFIG_FS_POSIX_ACL=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
CONFIG_GENERIC_GPIO=y
# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
CONFIG_HAS_DMA=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HID_SUPPORT=y
CONFIG_HW_HAS_PCI=y
CONFIG_HW_RANDOM=y
# CONFIG_I2C is not set
# CONFIG_IDE is not set
CONFIG_INITRAMFS_SOURCE=""
CONFIG_INPUT=y
CONFIG_INPUT_KEYBOARD=y
CONFIG_IRQ_CPU=y
# CONFIG_KEYBOARD_ATKBD is not set
CONFIG_KEYBOARD_GPIO=y
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_STOWAWAY is not set
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_XTKBD is not set
CONFIG_KORINA=y
# CONFIG_LEDS_ALIX is not set
# CONFIG_LEDS_GPIO is not set
CONFIG_LEDS_RB500=y
# CONFIG_LEMOTE_FULONG is not set
# CONFIG_MACH_ALCHEMY is not set
# CONFIG_MACH_DECSTATION is not set
# CONFIG_MACH_JAZZ is not set
# CONFIG_MACH_VR41XX is not set
CONFIG_MIKROTIK_RB500=y
CONFIG_MINI_FO=m
CONFIG_MIPS=y
# CONFIG_MIPS_ATLAS is not set
# CONFIG_MIPS_COBALT is not set
CONFIG_MIPS_L1_CACHE_SHIFT=4
# CONFIG_MIPS_MALTA is not set
CONFIG_MIPS_MT_DISABLED=y
# CONFIG_MIPS_MT_SMP is not set
# CONFIG_MIPS_MT_SMTC is not set
# CONFIG_MIPS_SEAD is not set
# CONFIG_MIPS_SIM is not set
CONFIG_MTD=y
# CONFIG_MTD_ABSENT is not set
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_BLOCK2MTD=y
# CONFIG_MTD_CFI is not set
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_CFI_I4 is not set
# CONFIG_MTD_CFI_I8 is not set
CONFIG_MTD_CHAR=y
# CONFIG_MTD_CMDLINE_PARTS is not set
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
# CONFIG_MTD_CONCAT is not set
# CONFIG_MTD_DEBUG is not set
# CONFIG_MTD_DOC2000 is not set
# CONFIG_MTD_DOC2001 is not set
# CONFIG_MTD_DOC2001PLUS is not set
# CONFIG_MTD_JEDECPROBE is not set
CONFIG_MTD_MAP_BANK_WIDTH_1=y
# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
CONFIG_MTD_MAP_BANK_WIDTH_2=y
# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
CONFIG_MTD_MAP_BANK_WIDTH_4=y
# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
# CONFIG_MTD_MTDRAM is not set
CONFIG_MTD_NAND=y
# CONFIG_MTD_NAND_CAFE is not set
# CONFIG_MTD_NAND_DISKONCHIP is not set
# CONFIG_MTD_NAND_ECC_SMC is not set
CONFIG_MTD_NAND_IDS=y
# CONFIG_MTD_NAND_MUSEUM_IDS is not set
# CONFIG_MTD_NAND_NANDSIM is not set
CONFIG_MTD_NAND_PLATFORM=y
CONFIG_MTD_NAND_VERIFY_WRITE=y
# CONFIG_MTD_ONENAND is not set
CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_PHRAM is not set
# CONFIG_MTD_PLATRAM is not set
# CONFIG_MTD_PMC551 is not set
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_SLRAM is not set
# CONFIG_NATSEMI is not set
# CONFIG_NE2K_PCI is not set
# CONFIG_NET_SCH_ESFQ_NFCT is not set
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_NO_IOPORT is not set
# CONFIG_PAGE_SIZE_16KB is not set
CONFIG_PAGE_SIZE_4KB=y
# CONFIG_PAGE_SIZE_64KB is not set
# CONFIG_PAGE_SIZE_8KB is not set
# CONFIG_PCIPCWATCHDOG is not set
# CONFIG_PMC_MSP is not set
# CONFIG_PMC_YOSEMITE is not set
# CONFIG_PNX8550_JBS is not set
# CONFIG_PNX8550_STB810 is not set
CONFIG_RC32434_WDT=y
# CONFIG_RTC is not set
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
CONFIG_SCSI_WAIT_SCAN=m
# CONFIG_SERIAL_8250_EXTENDED is not set
# CONFIG_SGI_IP22 is not set
# CONFIG_SGI_IP27 is not set
# CONFIG_SGI_IP32 is not set
# CONFIG_SIBYTE_BIGSUR is not set
# CONFIG_SIBYTE_CARMEL is not set
# CONFIG_SIBYTE_CRHINE is not set
# CONFIG_SIBYTE_CRHONE is not set
# CONFIG_SIBYTE_LITTLESUR is not set
# CONFIG_SIBYTE_PTSWARM is not set
# CONFIG_SIBYTE_RHONE is not set
# CONFIG_SIBYTE_SENTOSA is not set
# CONFIG_SIBYTE_SWARM is not set
# CONFIG_SOFT_WATCHDOG is not set
# CONFIG_SOUND is not set
# CONFIG_SPARSEMEM_STATIC is not set
CONFIG_SWAP_IO_SPACE=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
# CONFIG_TC35815 is not set
# CONFIG_TOSHIBA_JMR3927 is not set
# CONFIG_TOSHIBA_RBTX4927 is not set
# CONFIG_TOSHIBA_RBTX4938 is not set
CONFIG_TRAD_SIGNALS=y
# CONFIG_USB is not set
# CONFIG_USER_NS is not set
# CONFIG_VGASTATE is not set
CONFIG_VIA_RHINE=y
# CONFIG_VIA_RHINE_MMIO is not set
CONFIG_VIA_RHINE_NAPI=y
# CONFIG_YAFFS_9BYTE_TAGS is not set
CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED=y
CONFIG_YAFFS_AUTO_YAFFS2=y
CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=0
# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
CONFIG_YAFFS_DOES_ECC=y
CONFIG_YAFFS_ECC_WRONG_ORDER=y
CONFIG_YAFFS_FS=y
CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
CONFIG_YAFFS_YAFFS1=y
CONFIG_YAFFS_YAFFS2=y
CONFIG_ZONE_DMA_FLAG=0

View file

@ -24,12 +24,14 @@
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/autoconf.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/pci.h>
#include <asm/io.h>
#include <asm/rc32434/rc32434.h>
static int __devinitdata irq_map[2][12] = {
@ -37,7 +39,7 @@ static int __devinitdata irq_map[2][12] = {
{ 0, 0, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3 }
};
int __devinit pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
{
int irq = 0;

View file

@ -2,4 +2,4 @@
# Makefile for the RB500 board specific parts of the kernel
#
obj-y += irq.o time.o setup.o serial.o prom.o misc.o devices.o
obj-y += irq.o time.o setup.o serial.o prom.o gpio.o devices.o

View file

@ -0,0 +1,159 @@
/*
* Miscellaneous functions for IDT EB434 board
*
* Copyright 2004 IDT Inc. (rischelp@idt.com)
* Copyright 2006 Phil Sutter <n0-1@freewrt.org>
* Copyright 2007 Florian Fainelli <florian@openwrt.org>
*
* 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/kernel.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <asm/addrspace.h>
#include <asm/gpio.h>
#include <asm/rc32434/rb.h>
#define GPIO_BADDR 0xb8050000
static volatile unsigned char *devCtl3Base;
static unsigned char latchU5State;
static spinlock_t clu5Lock = SPIN_LOCK_UNLOCKED;
struct rb500_gpio_reg __iomem *rb500_gpio_reg0;
EXPORT_SYMBOL(rb500_gpio_reg0);
static struct resource rb500_gpio_reg0_res[] = {
{
.name = "gpio_reg0",
.start = GPIO_BADDR,
.end = GPIO_BADDR + sizeof(struct rb500_gpio_reg),
.flags = IORESOURCE_MEM,
}
};
void set434Reg(unsigned regOffs, unsigned bit, unsigned len, unsigned val)
{
unsigned flags, data;
unsigned i = 0;
spin_lock_irqsave(&clu5Lock, flags);
data = *(volatile unsigned *) (IDT434_REG_BASE + regOffs);
for (i = 0; i != len; ++i) {
if (val & (1 << i))
data |= (1 << (i + bit));
else
data &= ~(1 << (i + bit));
}
*(volatile unsigned *) (IDT434_REG_BASE + regOffs) = data;
spin_unlock_irqrestore(&clu5Lock, flags);
}
EXPORT_SYMBOL(set434Reg);
void changeLatchU5(unsigned char orMask, unsigned char nandMask)
{
unsigned flags;
spin_lock_irqsave(&clu5Lock, flags);
latchU5State = (latchU5State | orMask) & ~nandMask;
if (!devCtl3Base)
devCtl3Base = (volatile unsigned char *)
KSEG1ADDR(*(volatile unsigned *)
KSEG1ADDR(0x18010030));
*devCtl3Base = latchU5State;
spin_unlock_irqrestore(&clu5Lock, flags);
}
EXPORT_SYMBOL(changeLatchU5);
unsigned char getLatchU5State(void)
{
return latchU5State;
}
EXPORT_SYMBOL(getLatchU5State);
int rb500_gpio_get_value(unsigned gpio)
{
u32 reg;
reg = readl(&rb500_gpio_reg0->gpiod);
return (reg & (1 << gpio));
}
EXPORT_SYMBOL(rb500_gpio_get_value);
void rb500_gpio_set_value(unsigned gpio, int value)
{
u32 reg;
reg = (u32)&rb500_gpio_reg0->gpiod;
writel(value, (void *)(reg & (1 << gpio)));
}
EXPORT_SYMBOL(rb500_gpio_set_value);
int rb500_gpio_direction_input(unsigned gpio)
{
u32 reg;
reg = (u32)&rb500_gpio_reg0->gpiocfg;
writel(0, (void *)(reg & (1 << gpio)));
return 0;
}
EXPORT_SYMBOL(rb500_gpio_direction_input);
int rb500_gpio_direction_output(unsigned gpio, int value)
{
u32 reg;
reg = (u32)&rb500_gpio_reg0->gpiocfg;
if (value)
writel(1, (void *)(reg & (1 << gpio)));
return 0;
}
EXPORT_SYMBOL(rb500_gpio_direction_output);
int __init rb500_gpio_init(void)
{
rb500_gpio_reg0 = ioremap_nocache(rb500_gpio_reg0_res[0].start,
rb500_gpio_reg0_res[0].end - rb500_gpio_reg0_res[0].start);
if (!rb500_gpio_reg0) {
printk(KERN_ERR "rb500: cannot remap GPIO register 0\n");
return -ENXIO;
}
return 0;
}

View file

@ -63,6 +63,7 @@ static void rb500_enable_irq(unsigned int irq_nr);
static void rb500_disable_irq(unsigned int irq_nr);
extern void __init init_generic_irq(void);
extern struct rb500_gpio_reg __iomem *rb500_gpio_reg0;
typedef struct {
u32 mask; /* mask of valid bits in pending/mask registers */
@ -205,7 +206,7 @@ static void rb500_end_irq(unsigned int irq_nr)
intr_bit = 1 << ip;
if (irq_nr >= GROUP4_IRQ_BASE && irq_nr <= (GROUP4_IRQ_BASE + 13)) {
gpio->gpioistat = gpio->gpioistat & ~intr_bit;
rb500_gpio_reg0->gpioistat = rb500_gpio_reg0->gpioistat & ~intr_bit;
}
enable_local_irq(group_to_ip(group));

View file

@ -1,56 +0,0 @@
#include <linux/module.h>
#include <linux/kernel.h> /* printk() */
#include <linux/types.h> /* size_t */
#include <linux/pci.h>
#include <linux/spinlock.h>
#include <asm/rc32434/rb.h>
#define GPIO_BADDR 0xb8050000
static volatile unsigned char *devCtl3Base = 0;
static unsigned char latchU5State = 0;
static spinlock_t clu5Lock = SPIN_LOCK_UNLOCKED;
void set434Reg(unsigned regOffs, unsigned bit, unsigned len, unsigned val) {
unsigned flags, data;
unsigned i = 0;
spin_lock_irqsave(&clu5Lock, flags);
data = *(volatile unsigned *) (IDT434_REG_BASE + regOffs);
for (i = 0; i != len; ++i) {
if (val & (1 << i)) data |= (1 << (i + bit));
else data &= ~(1 << (i + bit));
}
*(volatile unsigned *) (IDT434_REG_BASE + regOffs) = data;
spin_unlock_irqrestore(&clu5Lock, flags);
}
void changeLatchU5(unsigned char orMask, unsigned char nandMask) {
unsigned flags;
spin_lock_irqsave(&clu5Lock, flags);
latchU5State = (latchU5State | orMask) & ~nandMask;
if( !devCtl3Base) devCtl3Base = (volatile unsigned char *)
KSEG1ADDR(*(volatile unsigned *) KSEG1ADDR(0x18010030));
*devCtl3Base = latchU5State;
spin_unlock_irqrestore(&clu5Lock, flags);
}
u32 gpio_get(gpio_func func)
{
return readl((void *) GPIO_BADDR + func);
}
void gpio_set(gpio_func func, u32 mask, u32 value)
{
u32 val = readl((void *) GPIO_BADDR + func);
val &= ~mask;
val |= value & mask;
writel(val, (void *) GPIO_BADDR + func);
}
EXPORT_SYMBOL(gpio_set);
EXPORT_SYMBOL(gpio_get);
EXPORT_SYMBOL(set434Reg);
EXPORT_SYMBOL(changeLatchU5);

View file

@ -45,6 +45,7 @@
#include <linux/tty.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/serial_8250.h>
#include <asm/time.h>
#include <asm/cpu.h>
@ -59,7 +60,7 @@ static struct uart_port serial_req = {
.type = PORT_16550A,
.line = 0,
.irq = RC32434_UART0_IRQ,
.flags = STD_COM_FLAGS,
//.flags = STD_COM_FLAGS,
.iotype = UPIO_MEM,
.membase = (char *) KSEG1ADDR(RC32434_UART0_BASE),
// .fifosize = 14

View file

@ -1,39 +1,21 @@
#ifndef __IDT_GPIO_H__
#define __IDT_GPIO_H__
/*******************************************************************************
*
/*
* Copyright 2002 Integrated Device Technology, Inc.
* All rights reserved.
* All rights reserved.
*
* GPIO register definition.
*
* File : $Id: gpio.h,v 1.2 2002/06/06 18:34:04 astichte Exp $
*
* Author : ryan.holmQVist@idt.com
* Date : 20011005
* Update :
* $Log: gpio.h,v $
* Revision 1.2 2002/06/06 18:34:04 astichte
* Added XXX_PhysicalAddress and XXX_VirtualAddress
*
* Revision 1.1 2002/05/29 17:33:22 sysarch
* jba File moved from vcode/include/idt/acacia
*
*
******************************************************************************/
* Copyright (C) 2001, 2002 Ryan Holm <ryan.holmQVist@idt.com>
* Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
*/
enum
{
GPIO0_PhysicalAddress = 0x18050000,
GPIO_PhysicalAddress = GPIO0_PhysicalAddress, // Default
#ifndef _RC32434_GPIO_H_
#define _RC32434_GPIO_H_
GPIO0_VirtualAddress = 0xb8050000,
GPIO_VirtualAddress = GPIO0_VirtualAddress, // Default
} ;
#include <linux/types.h>
typedef struct
{
struct rb500_gpio_reg {
u32 gpiofunc; /* GPIO Function Register
* gpiofunc[x]==0 bit = gpio
* func[x]==1 bit = altfunc
@ -53,9 +35,9 @@ typedef struct
* cleared in ISR (STICKY bits)
*/
u32 gpionmien; /* GPIO Non-maskable Interrupt Enable Register */
} volatile * GPIO_t ;
};
typedef enum
enum gpio_regs
{
GPIO_gpio_v = 0, // gpiofunc use pin as GPIO.
GPIO_alt_v = 1, // gpiofunc use pin as alt.
@ -175,7 +157,58 @@ typedef enum
GPIO_pcimuintn_m = GPIO_pin13_m,
GPIO_pcimuintn_cfg_v = GPIO_output_v,
} GPIO_DEFS_t;
};
#endif // __IDT_GPIO_H__
extern int rb500_gpio_get_value(unsigned gpio);
extern void rb500_gpio_set_value(unsigned gpio, int value);
extern int rb500_gpio_direction_input(unsigned gpio);
extern int rb500_gpio_direction_output(unsigned gpio, int value);
/* Wrappers for the arch-neutral GPIO API */
static inline int gpio_request(unsigned gpio, const char *label)
{
/* Not yet implemented */
return 0;
}
static inline void gpio_free(unsigned gpio)
{
/* Not yet implemented */
}
static inline int gpio_direction_input(unsigned gpio)
{
return rb500_gpio_direction_input(gpio);
}
static inline int gpio_direction_output(unsigned gpio, int value)
{
return rb500_gpio_direction_output(gpio, value);
}
static inline int gpio_get_value(unsigned gpio)
{
return rb500_gpio_get_value(gpio);
}
static inline void gpio_set_value(unsigned gpio, int value)
{
rb500_gpio_set_value(gpio, value);
}
static inline int gpio_to_irq(unsigned gpio)
{
return gpio;
}
static inline int irq_to_gpio(unsigned irq)
{
return irq;
}
/* For cansleep */
#include <asm-generic/gpio.h>
#endif /* _RC32434_GPIO_H_ */

View file

@ -32,7 +32,6 @@
#define RC32434_REG_BASE 0x18000000
#define interrupt ((volatile INT_t ) INT0_VirtualAddress)
#define gpio ((volatile GPIO_t) GPIO0_VirtualAddress)
#define IDT_CLOCK_MULT 2

View file

@ -1,9 +1,9 @@
diff -urN linux.old/arch/mips/Kconfig linux.dev/arch/mips/Kconfig
--- linux.old/arch/mips/Kconfig 2006-11-29 22:57:37.000000000 +0100
+++ linux.dev/arch/mips/Kconfig 2006-12-14 04:09:50.000000000 +0100
@@ -780,6 +780,19 @@
select SYS_SUPPORTS_BIG_ENDIAN
select TOSHIBA_BOARDS
diff -urN linux-2.6.23.12/arch/mips/Kconfig linux-2.6.23.12.new/arch/mips/Kconfig
--- linux-2.6.23.12/arch/mips/Kconfig 2007-12-18 22:55:57.000000000 +0100
+++ linux-2.6.23.12.new/arch/mips/Kconfig 2008-01-11 08:46:20.000000000 +0100
@@ -595,6 +595,20 @@
This enables support for the Wind River MIPS32 4KC PPMC evaluation
board, which is based on GT64120 bridge chip.
+config MIKROTIK_RB500
+ bool "Support for RB5xx boards"
@ -14,83 +14,84 @@ diff -urN linux.old/arch/mips/Kconfig linux.dev/arch/mips/Kconfig
+ select SYS_SUPPORTS_32BIT_KERNEL
+ select SWAP_IO_SPACE
+ select DMA_NONCOHERENT
+ select GENERIC_GPIO
+ help
+ Support the Mikrotik(tm) Routerboard 500 series,
+ such as the RB532.
+ Support the Mikrotik(tm) Routerboard 500 series,
+ such as the RB532.
+
config TOSHIBA_RBTX4927
bool "Toshiba TBTX49[23]7 board"
select DMA_NONCOHERENT
@@ -1106,7 +1119,7 @@
endchoice
config MIPS_L1_CACHE_SHIFT
int
- default "4" if MACH_DECSTATION || SNI_RM
+ default "4" if MACH_DECSTATION || SNI_RM || MIKROTIK_RB500
default "7" if SGI_IP27
source "arch/mips/au1000/Kconfig"
@@ -829,6 +843,7 @@
default "4" if MACH_DECSTATION
default "7" if SGI_IP27 || SNI_RM
default "4" if PMC_MSP4200_EVAL
+ default "4" if MIKROTIK_RB500
default "5"
diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
--- linux.old/arch/mips/Makefile 2006-12-14 03:13:55.000000000 +0100
+++ linux.dev/arch/mips/Makefile 2006-12-14 04:09:50.000000000 +0100
@@ -586,6 +586,13 @@
load-$(CONFIG_TOSHIBA_JMR3927) += 0xffffffff80050000
config HAVE_STD_PC_SERIAL_PORT
diff -urN linux-2.6.23.12/arch/mips/Makefile linux-2.6.23.12.new/arch/mips/Makefile
--- linux-2.6.23.12/arch/mips/Makefile 2007-12-18 22:55:57.000000000 +0100
+++ linux-2.6.23.12.new/arch/mips/Makefile 2008-01-11 08:47:04.000000000 +0100
@@ -300,6 +300,13 @@
cflags-$(CONFIG_LEMOTE_FULONG) += -Iinclude/asm-mips/mach-lemote
#
+# Routerboard 532 board
+#
+core-$(CONFIG_MIKROTIK_RB500) += arch/mips/rb500/
+cflags-$(CONFIG_MIKROTIK_RB500) += -Iinclude/asm-mips/rc32434
+cflags-$(CONFIG_MIKROTIK_RB500) += -Iinclude/asm-mips/rc32434
+load-$(CONFIG_MIKROTIK_RB500) += 0xffffffff80101000
+
+#
# Toshiba RBTX4927 board or
# Toshiba RBTX4937 board
# For all MIPS, Inc. eval boards
#
diff -urN linux.old/arch/mips/pci/Makefile linux.dev/arch/mips/pci/Makefile
--- linux.old/arch/mips/pci/Makefile 2006-11-29 22:57:37.000000000 +0100
+++ linux.dev/arch/mips/pci/Makefile 2006-12-14 04:09:50.000000000 +0100
@@ -53,3 +53,4 @@
core-$(CONFIG_MIPS_BOARDS_GEN) += arch/mips/mips-boards/generic/
diff -urN linux-2.6.23.12/arch/mips/pci/Makefile linux-2.6.23.12.new/arch/mips/pci/Makefile
--- linux-2.6.23.12/arch/mips/pci/Makefile 2007-12-18 22:55:57.000000000 +0100
+++ linux-2.6.23.12.new/arch/mips/pci/Makefile 2008-01-11 08:47:30.000000000 +0100
@@ -46,3 +46,4 @@
obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o
obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o
obj-$(CONFIG_WR_PPMC) += fixup-wrppmc.o
+obj-$(CONFIG_MIKROTIK_RB500) += pci-rc32434.o ops-rc32434.o fixup-rb500.o
diff -urN linux.old/drivers/pci/Makefile linux.dev/drivers/pci/Makefile
--- linux.old/drivers/pci/Makefile 2006-11-29 22:57:37.000000000 +0100
+++ linux.dev/drivers/pci/Makefile 2006-12-14 04:09:50.000000000 +0100
@@ -16,6 +16,7 @@
# Build the PCI MSI interrupt support
obj-$(CONFIG_PCI_MSI) += msi.o
diff -urN linux-2.6.23.12/drivers/pci/Makefile linux-2.6.23.12.new/drivers/pci/Makefile
--- linux-2.6.23.12/drivers/pci/Makefile 2007-12-18 22:55:57.000000000 +0100
+++ linux-2.6.23.12.new/drivers/pci/Makefile 2008-01-11 08:48:10.000000000 +0100
@@ -32,6 +32,7 @@
obj-$(CONFIG_PPC64) += setup-bus.o
obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o
obj-$(CONFIG_X86_VISWS) += setup-irq.o
+obj-$(CONFIG_MIKROTIK_RB500) += setup-irq.o
# Build the Hypertransport interrupt support
obj-$(CONFIG_HT_IRQ) += htirq.o
diff -urN linux.old/include/asm-mips/bootinfo.h linux.dev/include/asm-mips/bootinfo.h
--- linux.old/include/asm-mips/bootinfo.h 2006-11-29 22:57:37.000000000 +0100
+++ linux.dev/include/asm-mips/bootinfo.h 2006-12-14 04:09:50.000000000 +0100
@@ -212,6 +212,10 @@
#define MACH_GROUP_NEC_EMMA2RH 25 /* NEC EMMA2RH (was 23) */
#define MACH_NEC_MARKEINS 0 /* NEC EMMA2RH Mark-eins */
#
# ACPI Related PCI FW Functions
diff -urN linux-2.6.23.12/include/asm-mips/bootinfo.h linux-2.6.23.12.new/include/asm-mips/bootinfo.h
--- linux-2.6.23.12/include/asm-mips/bootinfo.h 2007-12-18 22:55:57.000000000 +0100
+++ linux-2.6.23.12.new/include/asm-mips/bootinfo.h 2008-01-11 08:48:48.000000000 +0100
@@ -208,6 +208,11 @@
#define MACH_GROUP_WINDRIVER 28 /* Windriver boards */
#define MACH_WRPPMC 1
+#define MACH_GROUP_MIKROTIK 26 /* Mikrotik Boards */
+
+#define MACH_GROUP_MIKROTIK 29 /* Mikrotik Boards */
+#define MACH_MIKROTIK_RB532 0 /* Mikrotik RouterBoard 532 */
+#define MACH_MIKROTIK_RB532A 1 /* Mikrotik RouterBoard 532A */
+
#define CL_SIZE COMMAND_LINE_SIZE
const char *get_system_type(void);
diff -urN linux.old/include/asm-mips/cpu.h linux.dev/include/asm-mips/cpu.h
--- linux.old/include/asm-mips/cpu.h 2006-11-29 22:57:37.000000000 +0100
+++ linux.dev/include/asm-mips/cpu.h 2006-12-14 04:09:50.000000000 +0100
@@ -200,7 +200,8 @@
#define CPU_SB1A 62
#define CPU_74K 63
diff -urN linux-2.6.23.12/include/asm-mips/cpu.h linux-2.6.23.12.new/include/asm-mips/cpu.h
--- linux-2.6.23.12/include/asm-mips/cpu.h 2007-12-18 22:55:57.000000000 +0100
+++ linux-2.6.23.12.new/include/asm-mips/cpu.h 2008-01-11 08:49:34.000000000 +0100
@@ -217,8 +217,9 @@
#define CPU_R14000 64
-#define CPU_LAST 64
+#define CPU_RC32300 65
+#define CPU_LAST 65
#define CPU_LOONGSON1 65
#define CPU_LOONGSON2 66
+#define CPU_RC32300 67
-#define CPU_LAST 66
+#define CPU_LAST 67
/*
* ISA Level encodings

View file

@ -1,26 +1,29 @@
diff -urN linux.old/drivers/block/Kconfig linux.dev/drivers/block/Kconfig
--- linux.old/drivers/block/Kconfig 2006-10-26 02:43:39.000000000 +0200
+++ linux.dev/drivers/block/Kconfig 2006-10-26 00:11:14.000000000 +0200
@@ -456,4 +456,12 @@
This driver provides Support for ATA over Ethernet block
devices like the Coraid EtherDrive (R) Storage Blade.
diff -urN linux-2.6.23.12/drivers/block/Kconfig linux-2.6.23.12.new/drivers/block/Kconfig
--- linux-2.6.23.12/drivers/block/Kconfig 2007-12-18 22:55:57.000000000 +0100
+++ linux-2.6.23.12.new/drivers/block/Kconfig 2008-01-11 08:53:32.000000000 +0100
@@ -426,6 +426,14 @@
Support for virtual disk devices as a client under Sun
Logical Domains.
+config BLK_DEV_CF_MIPS
+ bool "CF slot of RB532 board"
+ depends on MIKROTIK_RB500
+ default y
+ help
+ The Routerboard 532 has a CF slot on it. Enable the special block
+ device driver for it.
+ The Routerboard 532 has a CF slot on it. Enable the special block
+ device driver for it.
+
endmenu
diff -urN linux.old/drivers/block/Makefile linux.dev/drivers/block/Makefile
--- linux.old/drivers/block/Makefile 2006-06-18 03:49:35.000000000 +0200
+++ linux.dev/drivers/block/Makefile 2006-10-26 02:44:10.000000000 +0200
@@ -29,4 +29,5 @@
obj-$(CONFIG_VIODASD) += viodasd.o
obj-$(CONFIG_BLK_DEV_SX8) += sx8.o
obj-$(CONFIG_BLK_DEV_UB) += ub.o
source "drivers/s390/block/Kconfig"
config XILINX_SYSACE
diff -urN linux-2.6.23.12/drivers/block/Makefile linux-2.6.23.12.new/drivers/block/Makefile
--- linux-2.6.23.12/drivers/block/Makefile 2007-12-18 22:55:57.000000000 +0100
+++ linux-2.6.23.12.new/drivers/block/Makefile 2008-01-11 08:54:04.000000000 +0100
@@ -21,6 +21,7 @@
obj-$(CONFIG_XILINX_SYSACE) += xsysace.o
obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o
obj-$(CONFIG_SUNVDC) += sunvdc.o
+obj-$(CONFIG_BLK_DEV_CF_MIPS) += rb500/
obj-$(CONFIG_BLK_DEV_UMEM) += umem.o
obj-$(CONFIG_BLK_DEV_NBD) += nbd.o

View file

@ -1,14 +1,14 @@
Index: linux-2.6.21.1/arch/mips/kernel/head.S
===================================================================
--- linux-2.6.21.1.orig/arch/mips/kernel/head.S 2007-06-07 01:26:11.862575128 +0200
+++ linux-2.6.21.1/arch/mips/kernel/head.S 2007-06-07 01:31:06.499783464 +0200
@@ -133,6 +133,9 @@
diff -urN linux-2.6.23.12/arch/mips/kernel/head.S linux-2.6.23.12.new/arch/mips/kernel/head.S
--- linux-2.6.23.12/arch/mips/kernel/head.S 2008-01-11 11:27:08.000000000 +0100
+++ linux-2.6.23.12.new/arch/mips/kernel/head.S 2008-01-11 11:27:35.000000000 +0100
@@ -132,6 +132,10 @@
j kernel_entry
nop
+EXPORT(_image_cmdline)
+ .ascii "CMDLINE:"
+
+EXPORT(_image_cmdline)
+ .ascii "CMDLINE:"
+
#ifndef CONFIG_NO_EXCEPT_FILL
/*
* Reserved space for exception handlers.
* Necessary for machines which link their kernels at KSEG0.

View file

@ -1,27 +1,31 @@
diff -ur linux.old/drivers/net/via-rhine.c linux.dev/drivers/net/via-rhine.c
--- linux.old/drivers/net/via-rhine.c 2006-11-29 22:57:37.000000000 +0100
+++ linux.dev/drivers/net/via-rhine.c 2006-12-14 03:39:01.000000000 +0100
@@ -33,6 +33,7 @@
--- linux-2.6.23.12/drivers/net/via-rhine.c 2007-12-18 22:55:57.000000000 +0100
+++ linux-2.6.23.12.new/drivers/net/via-rhine.c 2008-01-11 08:58:58.000000000 +0100
@@ -33,6 +33,8 @@
#define DRV_VERSION "1.4.3"
#define DRV_RELDATE "2007-03-06"
+#define PKT_ALIGN 1
+
/* A few user-configurable values.
These may be modified when a driver module is loaded. */
@@ -40,9 +41,11 @@
@@ -40,6 +42,7 @@
static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */
static int max_interrupt_work = 20;
+#ifndef PKT_ALIGN
/* Set the copy breakpoint for the copy-only-tiny-frames scheme.
Setting to > 1518 effectively disables this feature. */
#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \
@@ -49,6 +52,7 @@
#else
static int rx_copybreak;
+#endif
#endif
+#endif /* PKT_ALIGN */
/* Work-around for broken BIOSes: they are unable to get the chip back out of
power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */
@@ -105,6 +108,7 @@
@@ -111,6 +115,7 @@
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
@ -29,7 +33,7 @@ diff -ur linux.old/drivers/net/via-rhine.c linux.dev/drivers/net/via-rhine.c
#include <linux/dmi.h>
/* These identify the driver base version and may not be removed. */
@@ -124,12 +128,14 @@
@@ -130,12 +135,14 @@
module_param(max_interrupt_work, int, 0);
module_param(debug, int, 0);
@ -46,7 +50,7 @@ diff -ur linux.old/drivers/net/via-rhine.c linux.dev/drivers/net/via-rhine.c
/*
Theory of Operation
@@ -924,7 +930,7 @@
@@ -927,7 +934,7 @@
/* Fill in the Rx buffers. Handle allocation failure gracefully. */
for (i = 0; i < RX_RING_SIZE; i++) {
@ -55,17 +59,18 @@ diff -ur linux.old/drivers/net/via-rhine.c linux.dev/drivers/net/via-rhine.c
rp->rx_skbuff[i] = skb;
if (skb == NULL)
break;
@@ -1482,6 +1488,9 @@
@@ -1484,7 +1491,9 @@
struct sk_buff *skb;
/* Length should omit the CRC */
int pkt_len = data_size - 4;
-
+#ifdef PKT_ALIGN
+ int i;
+#else
/* Check if the packet is long enough to accept without
copying to a minimally-sized skbuff. */
if (pkt_len < rx_copybreak &&
@@ -1501,7 +1510,9 @@
@@ -1503,7 +1512,9 @@
rp->rx_skbuff_dma[entry],
rp->rx_buf_sz,
PCI_DMA_FROMDEVICE);
@ -76,19 +81,18 @@ diff -ur linux.old/drivers/net/via-rhine.c linux.dev/drivers/net/via-rhine.c
skb = rp->rx_skbuff[entry];
if (skb == NULL) {
printk(KERN_ERR "%s: Inconsistent Rx "
@@ -1515,6 +1526,14 @@
@@ -1517,6 +1528,14 @@
rp->rx_skbuff_dma[entry],
rp->rx_buf_sz,
PCI_DMA_FROMDEVICE);
+#ifdef PKT_ALIGN
+#ifdef PKT_ALIGN
+ /* align the data to the ip header - should be faster than copying the entire packet */
+ for (i = pkt_len - (pkt_len % 4); i >= 0; i -= 4) {
+ put_unaligned(*((u32 *) (skb->data + i)), (u32 *) (skb->data + i + 2));
+ }
+ skb->data += 2;
+ skb->tail += 2;
+#endif
+#endif
}
skb->protocol = eth_type_trans(skb, dev);
#ifdef CONFIG_VIA_RHINE_NAPI

View file

@ -1,22 +1,9 @@
Index: linux-2.6.21.1/drivers/leds/Makefile
===================================================================
--- linux-2.6.21.1.orig/drivers/leds/Makefile 2007-07-10 20:56:30.000000000 +0200
+++ linux-2.6.21.1/drivers/leds/Makefile 2007-07-19 16:43:07.000000000 +0200
@@ -16,6 +16,7 @@
obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o
obj-$(CONFIG_LEDS_H1940) += leds-h1940.o
obj-$(CONFIG_LEDS_COBALT) += leds-cobalt.o
+obj-$(CONFIG_LEDS_RB500) += leds-rb500.o
# LED Triggers
obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
Index: linux-2.6.21.1/drivers/leds/Kconfig
===================================================================
--- linux-2.6.21.1.orig/drivers/leds/Kconfig 2007-07-10 20:56:30.000000000 +0200
+++ linux-2.6.21.1/drivers/leds/Kconfig 2007-07-19 16:42:55.000000000 +0200
@@ -95,6 +95,12 @@
help
This option enables support for the front LED on Cobalt Server
diff -urN linux-2.6.23.12/drivers/leds/Kconfig linux-2.6.23.12.new/drivers/leds/Kconfig
--- linux-2.6.23.12/drivers/leds/Kconfig 2007-12-18 22:55:57.000000000 +0100
+++ linux-2.6.23.12.new/drivers/leds/Kconfig 2008-01-11 09:01:19.000000000 +0100
@@ -101,6 +101,12 @@
outputs. To be useful the particular board must have LEDs
and they must be connected to the GPIO lines.
+config LEDS_RB500
+ tristate "LED Support for RB5xx boards"
@ -27,3 +14,14 @@ Index: linux-2.6.21.1/drivers/leds/Kconfig
comment "LED Triggers"
config LEDS_TRIGGERS
diff -urN linux-2.6.23.12/drivers/leds/Makefile linux-2.6.23.12.new/drivers/leds/Makefile
--- linux-2.6.23.12/drivers/leds/Makefile 2007-12-18 22:55:57.000000000 +0100
+++ linux-2.6.23.12.new/drivers/leds/Makefile 2008-01-11 09:00:49.000000000 +0100
@@ -17,6 +17,7 @@
obj-$(CONFIG_LEDS_H1940) += leds-h1940.o
obj-$(CONFIG_LEDS_COBALT) += leds-cobalt.o
obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o
+obj-$(CONFIG_LEDS_RB500) += leds-rb500.o
# LED Triggers
obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o