-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 182014 b: refs/heads/master c: 9bdcf33 h: refs/heads/master v: v3
- Loading branch information
Manuel Lauss
authored and
Ralf Baechle
committed
Feb 27, 2010
1 parent
2b258e0
commit d8181ef
Showing
20 changed files
with
476 additions
and
597 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: ebc89718a4b3fa0e440151fb4484541700828a5d | ||
refs/heads/master: 9bdcf336d0c061e77f4c45c7b2bc32e3ed6b57e3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* bcsr.h -- Db1xxx/Pb1xxx Devboard CPLD registers ("BCSR") abstraction. | ||
* | ||
* All Alchemy development boards (except, of course, the weird PB1000) | ||
* have a few registers in a CPLD with standardised layout; they mostly | ||
* only differ in base address. | ||
* All registers are 16bits wide with 32bit spacing. | ||
*/ | ||
|
||
#include <linux/module.h> | ||
#include <linux/spinlock.h> | ||
#include <asm/addrspace.h> | ||
#include <asm/io.h> | ||
#include <asm/mach-db1x00/bcsr.h> | ||
|
||
static struct bcsr_reg { | ||
void __iomem *raddr; | ||
spinlock_t lock; | ||
} bcsr_regs[BCSR_CNT]; | ||
|
||
void __init bcsr_init(unsigned long bcsr1_phys, unsigned long bcsr2_phys) | ||
{ | ||
int i; | ||
|
||
bcsr1_phys = KSEG1ADDR(CPHYSADDR(bcsr1_phys)); | ||
bcsr2_phys = KSEG1ADDR(CPHYSADDR(bcsr2_phys)); | ||
|
||
for (i = 0; i < BCSR_CNT; i++) { | ||
if (i >= BCSR_HEXLEDS) | ||
bcsr_regs[i].raddr = (void __iomem *)bcsr2_phys + | ||
(0x04 * (i - BCSR_HEXLEDS)); | ||
else | ||
bcsr_regs[i].raddr = (void __iomem *)bcsr1_phys + | ||
(0x04 * i); | ||
|
||
spin_lock_init(&bcsr_regs[i].lock); | ||
} | ||
} | ||
|
||
unsigned short bcsr_read(enum bcsr_id reg) | ||
{ | ||
unsigned short r; | ||
unsigned long flags; | ||
|
||
spin_lock_irqsave(&bcsr_regs[reg].lock, flags); | ||
r = __raw_readw(bcsr_regs[reg].raddr); | ||
spin_unlock_irqrestore(&bcsr_regs[reg].lock, flags); | ||
return r; | ||
} | ||
EXPORT_SYMBOL_GPL(bcsr_read); | ||
|
||
void bcsr_write(enum bcsr_id reg, unsigned short val) | ||
{ | ||
unsigned long flags; | ||
|
||
spin_lock_irqsave(&bcsr_regs[reg].lock, flags); | ||
__raw_writew(val, bcsr_regs[reg].raddr); | ||
wmb(); | ||
spin_unlock_irqrestore(&bcsr_regs[reg].lock, flags); | ||
} | ||
EXPORT_SYMBOL_GPL(bcsr_write); | ||
|
||
void bcsr_mod(enum bcsr_id reg, unsigned short clr, unsigned short set) | ||
{ | ||
unsigned short r; | ||
unsigned long flags; | ||
|
||
spin_lock_irqsave(&bcsr_regs[reg].lock, flags); | ||
r = __raw_readw(bcsr_regs[reg].raddr); | ||
r &= ~clr; | ||
r |= set; | ||
__raw_writew(r, bcsr_regs[reg].raddr); | ||
wmb(); | ||
spin_unlock_irqrestore(&bcsr_regs[reg].lock, flags); | ||
} | ||
EXPORT_SYMBOL_GPL(bcsr_mod); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.