Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114649
b: refs/heads/master
c: c0da99d
h: refs/heads/master
i:
  114647: d2fe768
v: v3
  • Loading branch information
Anton Vorontsov authored and Kumar Gala committed Oct 13, 2008
1 parent 3ab224c commit 58f9d48
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 49 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1fb25be1e74498d389e4de819a6d1b174d6ccb7c
refs/heads/master: c0da99d5f7b0349cb11f970b3283c0d57beb5ec9
48 changes: 4 additions & 44 deletions trunk/arch/powerpc/include/asm/fsl_lbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#ifndef __ASM_FSL_LBC_H
#define __ASM_FSL_LBC_H

#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/spinlock.h>
#include <asm/io.h>
#include <linux/io.h>

struct fsl_lbc_bank {
__be32 br; /**< Base Register */
Expand Down Expand Up @@ -227,9 +227,6 @@ struct fsl_lbc_regs {
u8 res8[0xF00];
};

extern struct fsl_lbc_regs __iomem *fsl_lbc_regs;
extern spinlock_t fsl_lbc_lock;

/*
* FSL UPM routines
*/
Expand Down Expand Up @@ -268,44 +265,7 @@ static inline void fsl_upm_end_pattern(struct fsl_upm *upm)
cpu_relax();
}

/**
* fsl_upm_run_pattern - actually run an UPM pattern
* @upm: pointer to the fsl_upm structure obtained via fsl_upm_find
* @io_base: remapped pointer to where memory access should happen
* @mar: MAR register content during pattern execution
*
* This function triggers dummy write to the memory specified by the io_base,
* thus UPM pattern actually executed. Note that mar usage depends on the
* pre-programmed AMX bits in the UPM RAM.
*/
static inline int fsl_upm_run_pattern(struct fsl_upm *upm,
void __iomem *io_base, u32 mar)
{
int ret = 0;
unsigned long flags;

spin_lock_irqsave(&fsl_lbc_lock, flags);

out_be32(&fsl_lbc_regs->mar, mar << (32 - upm->width));

switch (upm->width) {
case 8:
out_8(io_base, 0x0);
break;
case 16:
out_be16(io_base, 0x0);
break;
case 32:
out_be32(io_base, 0x0);
break;
default:
ret = -EINVAL;
break;
}

spin_unlock_irqrestore(&fsl_lbc_lock, flags);

return ret;
}
extern int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base,
u32 mar);

#endif /* __ASM_FSL_LBC_H */
53 changes: 49 additions & 4 deletions trunk/arch/powerpc/sysdev/fsl_lbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
* (at your option) any later version.
*/

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/compiler.h>
#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/io.h>
#include <linux/of.h>
#include <asm/prom.h>
#include <asm/fsl_lbc.h>

spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock);

struct fsl_lbc_regs __iomem *fsl_lbc_regs;
EXPORT_SYMBOL(fsl_lbc_regs);
static spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock);
static struct fsl_lbc_regs __iomem *fsl_lbc_regs;

static char __initdata *compat_lbc[] = {
"fsl,pq2-localbus",
Expand Down Expand Up @@ -127,3 +132,43 @@ int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm *upm)
return 0;
}
EXPORT_SYMBOL(fsl_upm_find);

/**
* fsl_upm_run_pattern - actually run an UPM pattern
* @upm: pointer to the fsl_upm structure obtained via fsl_upm_find
* @io_base: remapped pointer to where memory access should happen
* @mar: MAR register content during pattern execution
*
* This function triggers dummy write to the memory specified by the io_base,
* thus UPM pattern actually executed. Note that mar usage depends on the
* pre-programmed AMX bits in the UPM RAM.
*/
int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar)
{
int ret = 0;
unsigned long flags;

spin_lock_irqsave(&fsl_lbc_lock, flags);

out_be32(&fsl_lbc_regs->mar, mar << (32 - upm->width));

switch (upm->width) {
case 8:
out_8(io_base, 0x0);
break;
case 16:
out_be16(io_base, 0x0);
break;
case 32:
out_be32(io_base, 0x0);
break;
default:
ret = -EINVAL;
break;
}

spin_unlock_irqrestore(&fsl_lbc_lock, flags);

return ret;
}
EXPORT_SYMBOL(fsl_upm_run_pattern);

0 comments on commit 58f9d48

Please sign in to comment.