diff options
author | Felix Fietkau <nbd@openwrt.org> | 2007-09-06 16:27:37 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2007-09-06 16:27:37 +0000 |
commit | 56231056ea784f1cec6450f649b1adaed1f56366 (patch) | |
tree | 7b130d72d854cde2bcd3af8b11bd0f7be3dbff6a /target/linux/rb532/files/arch/mips/rb500/misc.c | |
parent | e1184aaa1a7a5e5eeef8e072bf0ea98c291be22a (diff) | |
download | master-31e0f0ae-56231056ea784f1cec6450f649b1adaed1f56366.tar.gz master-31e0f0ae-56231056ea784f1cec6450f649b1adaed1f56366.tar.bz2 master-31e0f0ae-56231056ea784f1cec6450f649b1adaed1f56366.zip |
strip the kernel version suffix from target directories, except for brcm-2.4 (the -2.4 will be included in the board name here). CONFIG_LINUX_<ver>_<board> becomes CONFIG_TARGET_<board>, same for profiles.
SVN-Revision: 8653
Diffstat (limited to 'target/linux/rb532/files/arch/mips/rb500/misc.c')
-rw-r--r-- | target/linux/rb532/files/arch/mips/rb500/misc.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/target/linux/rb532/files/arch/mips/rb500/misc.c b/target/linux/rb532/files/arch/mips/rb500/misc.c new file mode 100644 index 0000000000..42039b7aae --- /dev/null +++ b/target/linux/rb532/files/arch/mips/rb500/misc.c @@ -0,0 +1,56 @@ +#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); |