Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
debug-mmrs.c File Reference
#include <linux/debugfs.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <asm/blackfin.h>
#include <asm/gpio.h>
#include <asm/gptimers.h>
#include <asm/bfin_can.h>
#include <asm/bfin_dma.h>
#include <asm/bfin_ppi.h>
#include <asm/bfin_serial.h>
#include <asm/bfin5xx_spi.h>
#include <asm/bfin_twi.h>

Go to the source code of this file.

Macros

#define _d(name, bits, addr, perms)   debugfs_create_x##bits(name, perms, parent, (u##bits *)(addr))
 
#define d(name, bits, addr)   _d(name, bits, addr, S_IRUSR|S_IWUSR)
 
#define d_RO(name, bits, addr)   _d(name, bits, addr, S_IRUSR)
 
#define d_WO(name, bits, addr)   _d(name, bits, addr, S_IWUSR)
 
#define D_RO(name, bits)   d_RO(#name, bits, name)
 
#define D_WO(name, bits)   d_WO(#name, bits, name)
 
#define D32(name)   d(#name, 32, name)
 
#define D16(name)   d(#name, 16, name)
 
#define REGS_OFF(peri, mmr)   offsetof(struct bfin_##peri##_regs, mmr)
 
#define __REGS(peri, sname, rname)
 
#define REGS_STR_PFX(buf, pfx, num)
 
#define REGS_STR_PFX_C(buf, pfx, num)
 
#define DEFINE_SYSREG(sr, pre, post)
 
#define D_SYSREG(sr)   debugfs_create_file(#sr, S_IRUSR|S_IWUSR, parent, NULL, &fops_sysreg_##sr)
 
#define CAN_OFF(mmr)   REGS_OFF(can, mmr)
 
#define __CAN(uname, lname)   __REGS(can, #uname, lname)
 
#define CAN(num)   bfin_debug_mmrs_can(parent, CAN##num##_MC1, num)
 
#define __DMA(uname, lname)   __REGS(dma, #uname, lname)
 
#define _DMA(num, base, mdma, pfx)   bfin_debug_mmrs_dma(parent, base, num, mdma, pfx "DMA")
 
#define DMA(num)   _DMA(num, DMA##num##_NEXT_DESC_PTR, 0, "")
 
#define _MDMA(num, x)
 
#define MDMA(num)   _MDMA(num, M)
 
#define IMDMA(num)   _MDMA(num, IM)
 
#define __EPPI(uname, lname)   __REGS(eppi, #uname, lname)
 
#define EPPI(num)   bfin_debug_mmrs_eppi(parent, EPPI##num##_STATUS, num)
 
#define __GPTIMER(uname, lname)   __REGS(gptimer, #uname, lname)
 
#define GPTIMER(num)   bfin_debug_mmrs_gptimer(parent, TIMER##num##_CONFIG, num)
 
#define GPTIMER_GROUP_OFF(mmr)   REGS_OFF(gptimer_group, mmr)
 
#define __GPTIMER_GROUP(uname, lname)   __REGS(gptimer_group, #uname, lname)
 
#define GPTIMER_GROUP(mmr, num)   bfin_debug_mmrs_gptimer_group(parent, mmr, num)
 
#define __HMDMA(uname, lname)   __REGS(hmdma, #uname, lname)
 
#define HMDMA(num)   bfin_debug_mmrs_hmdma(parent, HMDMA##num##_CONTROL, num)
 
#define bfin_gpio_regs   gpio_port_t
 
#define __PORT(uname, lname)   __REGS(gpio, #uname, lname)
 
#define PORT(base, num)   bfin_debug_mmrs_port(parent, base, num)
 
#define __PPI(uname, lname)   __REGS(ppi, #uname, lname)
 
#define PPI(num)   bfin_debug_mmrs_ppi(parent, PPI##num##_CONTROL, num)
 
#define __SPI(uname, lname)   __REGS(spi, #uname, lname)
 
#define SPI(num)   bfin_debug_mmrs_spi(parent, SPI##num##_REGBASE, num)
 
#define SPORT_OFF(mmr)   (SPORT0_##mmr - SPORT0_TCR1)
 
#define _D_SPORT(name, perms, fops)
 
#define __SPORT_RW(name)   _D_SPORT(name, S_IRUSR|S_IWUSR, &fops_sport)
 
#define __SPORT_RO(name)   _D_SPORT(name, S_IRUSR, &fops_sport_ro)
 
#define __SPORT_WO(name)   _D_SPORT(name, S_IWUSR, &fops_sport_wo)
 
#define __SPORT(name, bits)
 
#define SPORT(num)   bfin_debug_mmrs_sport(parent, SPORT##num##_TCR1, num)
 
#define __TWI(uname, lname)   __REGS(twi, #uname, lname)
 
#define TWI(num)   bfin_debug_mmrs_twi(parent, TWI##num##_CLKDIV, num)
 
#define __UART(uname, lname)   __REGS(uart, #uname, lname)
 
#define UART(num)   bfin_debug_mmrs_uart(parent, UART##num##_DLL, num)
 

Functions

 DEFINE_SIMPLE_ATTRIBUTE (fops_debug_cclk, debug_cclk_get, NULL,"0x%08llx\n")
 
 DEFINE_SIMPLE_ATTRIBUTE (fops_debug_sclk, debug_sclk_get, NULL,"0x%08llx\n")
 
 DEFINE_SYSREG (cycles,,)
 
 DEFINE_SYSREG (cycles2, __asm__ __volatile__("%0 = cycles;":"=d"(tmp)),)
 
 DEFINE_SYSREG (emudat,,)
 
 DEFINE_SYSREG (seqstat,,)
 
 DEFINE_SYSREG (syscfg,, CSYNC())
 
 DEFINE_SIMPLE_ATTRIBUTE (fops_sport, sport_get, sport_set,"0x%08llx\n")
 
 DEFINE_SIMPLE_ATTRIBUTE (fops_sport_wo, NULL, sport_set,"0x%08llx\n")
 
 module_init (bfin_debug_mmrs_init)
 
 module_exit (bfin_debug_mmrs_exit)
 
 MODULE_LICENSE ("GPL")
 

Variables

u32 last_seqstat
 

Macro Definition Documentation

#define __CAN (   uname,
  lname 
)    __REGS(can, #uname, lname)

Definition at line 113 of file debug-mmrs.c.

#define __DMA (   uname,
  lname 
)    __REGS(dma, #uname, lname)

Definition at line 206 of file debug-mmrs.c.

#define __EPPI (   uname,
  lname 
)    __REGS(eppi, #uname, lname)

Definition at line 247 of file debug-mmrs.c.

#define __GPTIMER (   uname,
  lname 
)    __REGS(gptimer, #uname, lname)

Definition at line 272 of file debug-mmrs.c.

#define __GPTIMER_GROUP (   uname,
  lname 
)    __REGS(gptimer_group, #uname, lname)

Definition at line 285 of file debug-mmrs.c.

#define __HMDMA (   uname,
  lname 
)    __REGS(hmdma, #uname, lname)

Definition at line 313 of file debug-mmrs.c.

#define __PORT (   uname,
  lname 
)    __REGS(gpio, #uname, lname)

Definition at line 355 of file debug-mmrs.c.

#define __PPI (   uname,
  lname 
)    __REGS(ppi, #uname, lname)

Definition at line 396 of file debug-mmrs.c.

#define __REGS (   peri,
  sname,
  rname 
)
Value:
do { \
struct bfin_##peri##_regs r; \
void *addr = (void *)(base + REGS_OFF(peri, rname)); \
strcpy(_buf, sname); \
if (sizeof(r.rname) == 2) \
debugfs_create_x16(buf, S_IRUSR|S_IWUSR, parent, addr); \
} while (0)

Definition at line 41 of file debug-mmrs.c.

#define __SPI (   uname,
  lname 
)    __REGS(spi, #uname, lname)

Definition at line 412 of file debug-mmrs.c.

#define __SPORT (   name,
  bits 
)
Value:
do { \
strcpy(_buf, #name); \
debugfs_create_x##bits(buf, S_IRUSR|S_IWUSR, parent, (u##bits *)(base + SPORT_OFF(name))); \
} while (0)

Definition at line 476 of file debug-mmrs.c.

#define __SPORT_RO (   name)    _D_SPORT(name, S_IRUSR, &fops_sport_ro)

Definition at line 474 of file debug-mmrs.c.

#define __SPORT_RW (   name)    _D_SPORT(name, S_IRUSR|S_IWUSR, &fops_sport)

Definition at line 473 of file debug-mmrs.c.

#define __SPORT_WO (   name)    _D_SPORT(name, S_IWUSR, &fops_sport_wo)

Definition at line 475 of file debug-mmrs.c.

#define __TWI (   uname,
  lname 
)    __REGS(twi, #uname, lname)

Definition at line 513 of file debug-mmrs.c.

#define __UART (   uname,
  lname 
)    __REGS(uart, #uname, lname)

Definition at line 540 of file debug-mmrs.c.

#define _d (   name,
  bits,
  addr,
  perms 
)    debugfs_create_x##bits(name, perms, parent, (u##bits *)(addr))

Definition at line 30 of file debug-mmrs.c.

#define _D_SPORT (   name,
  perms,
  fops 
)
Value:
do { \
strcpy(_buf, #name); \
debugfs_create_file(buf, perms, parent, (void *)(base + SPORT_OFF(name)), fops); \
} while (0)

Definition at line 468 of file debug-mmrs.c.

#define _DMA (   num,
  base,
  mdma,
  pfx 
)    bfin_debug_mmrs_dma(parent, base, num, mdma, pfx "DMA")

Definition at line 234 of file debug-mmrs.c.

#define _MDMA (   num,
  x 
)
Value:
do { \
_DMA(num, x##DMA_D##num##_NEXT_DESC_PTR, 'D', #x); \
_DMA(num, x##DMA_S##num##_NEXT_DESC_PTR, 'S', #x); \
} while (0)

Definition at line 236 of file debug-mmrs.c.

#define bfin_gpio_regs   gpio_port_t

Definition at line 354 of file debug-mmrs.c.

#define CAN (   num)    bfin_debug_mmrs_can(parent, CAN##num##_MC1, num)

Definition at line 201 of file debug-mmrs.c.

#define CAN_OFF (   mmr)    REGS_OFF(can, mmr)

Definition at line 112 of file debug-mmrs.c.

#define d (   name,
  bits,
  addr 
)    _d(name, bits, addr, S_IRUSR|S_IWUSR)

Definition at line 31 of file debug-mmrs.c.

#define D16 (   name)    d(#name, 16, name)

Definition at line 38 of file debug-mmrs.c.

#define D32 (   name)    d(#name, 32, name)

Definition at line 37 of file debug-mmrs.c.

#define d_RO (   name,
  bits,
  addr 
)    _d(name, bits, addr, S_IRUSR)

Definition at line 32 of file debug-mmrs.c.

#define D_RO (   name,
  bits 
)    d_RO(#name, bits, name)

Definition at line 35 of file debug-mmrs.c.

#define D_SYSREG (   sr)    debugfs_create_file(#sr, S_IRUSR|S_IWUSR, parent, NULL, &fops_sysreg_##sr)

Definition at line 106 of file debug-mmrs.c.

#define d_WO (   name,
  bits,
  addr 
)    _d(name, bits, addr, S_IWUSR)

Definition at line 33 of file debug-mmrs.c.

#define D_WO (   name,
  bits 
)    d_WO(#name, bits, name)

Definition at line 36 of file debug-mmrs.c.

#define DEFINE_SYSREG (   sr,
  pre,
  post 
)
Value:
static int sysreg_##sr##_get(void *data, u64 *val) \
{ \
unsigned long tmp; \
pre; \
__asm__ __volatile__("%0 = " #sr ";" : "=d"(tmp)); \
*val = tmp; \
return 0; \
} \
static int sysreg_##sr##_set(void *data, u64 val) \
{ \
unsigned long tmp = val; \
__asm__ __volatile__(#sr " = %0;" : : "d"(tmp)); \
post; \
return 0; \
} \
DEFINE_SIMPLE_ATTRIBUTE(fops_sysreg_##sr, sysreg_##sr##_get, sysreg_##sr##_set, "0x%08llx\n")

Definition at line 83 of file debug-mmrs.c.

#define DMA (   num)    _DMA(num, DMA##num##_NEXT_DESC_PTR, 0, "")

Definition at line 235 of file debug-mmrs.c.

#define EPPI (   num)    bfin_debug_mmrs_eppi(parent, EPPI##num##_STATUS, num)

Definition at line 267 of file debug-mmrs.c.

#define GPTIMER (   num)    bfin_debug_mmrs_gptimer(parent, TIMER##num##_CONFIG, num)

Definition at line 282 of file debug-mmrs.c.

#define GPTIMER_GROUP (   mmr,
  num 
)    bfin_debug_mmrs_gptimer_group(parent, mmr, num)

Definition at line 308 of file debug-mmrs.c.

#define GPTIMER_GROUP_OFF (   mmr)    REGS_OFF(gptimer_group, mmr)

Definition at line 284 of file debug-mmrs.c.

#define HMDMA (   num)    bfin_debug_mmrs_hmdma(parent, HMDMA##num##_CONTROL, num)

Definition at line 326 of file debug-mmrs.c.

#define IMDMA (   num)    _MDMA(num, IM)

Definition at line 242 of file debug-mmrs.c.

#define MDMA (   num)    _MDMA(num, M)

Definition at line 241 of file debug-mmrs.c.

#define PORT (   base,
  num 
)    bfin_debug_mmrs_port(parent, base, num)

Definition at line 391 of file debug-mmrs.c.

#define PPI (   num)    bfin_debug_mmrs_ppi(parent, PPI##num##_CONTROL, num)

Definition at line 407 of file debug-mmrs.c.

#define REGS_OFF (   peri,
  mmr 
)    offsetof(struct bfin_##peri##_regs, mmr)

Definition at line 40 of file debug-mmrs.c.

#define REGS_STR_PFX (   buf,
  pfx,
  num 
)
Value:
({ \
buf + (num >= 0 ? \
sprintf(buf, #pfx "%i_", num) : \
sprintf(buf, #pfx "_")); \
})

Definition at line 51 of file debug-mmrs.c.

#define REGS_STR_PFX_C (   buf,
  pfx,
  num 
)
Value:
({ \
buf + (num >= 0 ? \
sprintf(buf, #pfx "%c_", 'A' + num) : \
sprintf(buf, #pfx "_")); \
})

Definition at line 57 of file debug-mmrs.c.

#define SPI (   num)    bfin_debug_mmrs_spi(parent, SPI##num##_REGBASE, num)

Definition at line 425 of file debug-mmrs.c.

#define SPORT (   num)    bfin_debug_mmrs_sport(parent, SPORT##num##_TCR1, num)

Definition at line 508 of file debug-mmrs.c.

#define SPORT_OFF (   mmr)    (SPORT0_##mmr - SPORT0_TCR1)

Definition at line 467 of file debug-mmrs.c.

#define TWI (   num)    bfin_debug_mmrs_twi(parent, TWI##num##_CLKDIV, num)

Definition at line 535 of file debug-mmrs.c.

#define UART (   num)    bfin_debug_mmrs_uart(parent, UART##num##_DLL, num)

Definition at line 573 of file debug-mmrs.c.

Function Documentation

DEFINE_SIMPLE_ATTRIBUTE ( fops_debug_cclk  ,
debug_cclk_get  ,
NULL  ,
"0x%08llx\n"   
)
DEFINE_SIMPLE_ATTRIBUTE ( fops_debug_sclk  ,
debug_sclk_get  ,
NULL  ,
"0x%08llx\n"   
)
DEFINE_SIMPLE_ATTRIBUTE ( fops_sport  ,
sport_get  ,
sport_set  ,
"0x%08llx\n"   
)
DEFINE_SIMPLE_ATTRIBUTE ( fops_sport_wo  ,
NULL  ,
sport_set  ,
"0x%08llx\n"   
)
DEFINE_SYSREG ( cycles  )
DEFINE_SYSREG ( cycles2  ,
__asm__   __volatile__"%0 = cycles;":"=d"(tmp) 
)
DEFINE_SYSREG ( emudat  )
DEFINE_SYSREG ( seqstat  )
DEFINE_SYSREG ( syscfg  ,
CSYNC()   
)
module_exit ( bfin_debug_mmrs_exit  )
module_init ( bfin_debug_mmrs_init  )
MODULE_LICENSE ( "GPL"  )

Variable Documentation

u32 last_seqstat