Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
leon_pci_grpci2.c File Reference
#include <linux/of_device.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/export.h>
#include <asm/io.h>
#include <asm/leon.h>
#include <asm/vaddrs.h>
#include <asm/sections.h>
#include <asm/leon_pci.h>
#include "irq.h"

Go to the source code of this file.

Data Structures

struct  grpci2_barcfg
 
struct  grpci2_regs
 
struct  grpci2_bd_chan
 
struct  grpci2_bd_data
 
struct  grpci2_cap_first
 
struct  grpci2_priv
 

Macros

#define REGLOAD(a)   (be32_to_cpu(__raw_readl(&(a))))
 
#define REGSTORE(a, v)   (__raw_writel(cpu_to_be32(v), &(a)))
 
#define CTRL_BUS_BIT   16
 
#define CTRL_RESET   (1<<31)
 
#define CTRL_SI   (1<<27)
 
#define CTRL_PE   (1<<26)
 
#define CTRL_EI   (1<<25)
 
#define CTRL_ER   (1<<24)
 
#define CTRL_BUS   (0xff<<CTRL_BUS_BIT)
 
#define CTRL_HOSTINT   0xf
 
#define STS_HOST_BIT   31
 
#define STS_MST_BIT   30
 
#define STS_TAR_BIT   29
 
#define STS_DMA_BIT   28
 
#define STS_DI_BIT   27
 
#define STS_HI_BIT   26
 
#define STS_IRQMODE_BIT   24
 
#define STS_TRACE_BIT   23
 
#define STS_CFGERRVALID_BIT   20
 
#define STS_CFGERR_BIT   19
 
#define STS_INTTYPE_BIT   12
 
#define STS_INTSTS_BIT   8
 
#define STS_FDEPTH_BIT   2
 
#define STS_FNUM_BIT   0
 
#define STS_HOST   (1<<STS_HOST_BIT)
 
#define STS_MST   (1<<STS_MST_BIT)
 
#define STS_TAR   (1<<STS_TAR_BIT)
 
#define STS_DMA   (1<<STS_DMA_BIT)
 
#define STS_DI   (1<<STS_DI_BIT)
 
#define STS_HI   (1<<STS_HI_BIT)
 
#define STS_IRQMODE   (0x3<<STS_IRQMODE_BIT)
 
#define STS_TRACE   (1<<STS_TRACE_BIT)
 
#define STS_CFGERRVALID   (1<<STS_CFGERRVALID_BIT)
 
#define STS_CFGERR   (1<<STS_CFGERR_BIT)
 
#define STS_INTTYPE   (0x3f<<STS_INTTYPE_BIT)
 
#define STS_INTSTS   (0xf<<STS_INTSTS_BIT)
 
#define STS_FDEPTH   (0x7<<STS_FDEPTH_BIT)
 
#define STS_FNUM   (0x3<<STS_FNUM_BIT)
 
#define STS_ISYSERR   (1<<17)
 
#define STS_IDMA   (1<<16)
 
#define STS_IDMAERR   (1<<15)
 
#define STS_IMSTABRT   (1<<14)
 
#define STS_ITGTABRT   (1<<13)
 
#define STS_IPARERR   (1<<12)
 
#define STS_ERR_IRQ   (STS_ISYSERR | STS_IMSTABRT | STS_ITGTABRT | STS_IPARERR)
 
#define BD_CHAN_EN   0x80000000
 
#define BD_CHAN_TYPE   0x00300000
 
#define BD_CHAN_BDCNT   0x0000ffff
 
#define BD_CHAN_EN_BIT   31
 
#define BD_CHAN_TYPE_BIT   20
 
#define BD_CHAN_BDCNT_BIT   0
 
#define BD_DATA_EN   0x80000000
 
#define BD_DATA_IE   0x40000000
 
#define BD_DATA_DR   0x20000000
 
#define BD_DATA_TYPE   0x00300000
 
#define BD_DATA_ER   0x00080000
 
#define BD_DATA_LEN   0x0000ffff
 
#define BD_DATA_EN_BIT   31
 
#define BD_DATA_IE_BIT   30
 
#define BD_DATA_DR_BIT   29
 
#define BD_DATA_TYPE_BIT   20
 
#define BD_DATA_ER_BIT   19
 
#define BD_DATA_LEN_BIT   0
 
#define CAP9_CTRL_OFS   0
 
#define CAP9_BAR_OFS   0x4
 
#define CAP9_IOMAP_OFS   0x20
 
#define CAP9_BARSIZE_OFS   0x24
 

Functions

 DEFINE_SPINLOCK (grpci2_dev_lock)
 
int grpci2_map_irq (const struct pci_dev *dev, u8 slot, u8 pin)
 
void grpci2_hw_init (struct grpci2_priv *priv)
 
 subsys_initcall (grpci2_init)
 

Variables

struct grpci2_privgrpci2priv
 

Macro Definition Documentation

#define BD_CHAN_BDCNT   0x0000ffff

Definition at line 151 of file leon_pci_grpci2.c.

#define BD_CHAN_BDCNT_BIT   0

Definition at line 154 of file leon_pci_grpci2.c.

#define BD_CHAN_EN   0x80000000

Definition at line 149 of file leon_pci_grpci2.c.

#define BD_CHAN_EN_BIT   31

Definition at line 152 of file leon_pci_grpci2.c.

#define BD_CHAN_TYPE   0x00300000

Definition at line 150 of file leon_pci_grpci2.c.

#define BD_CHAN_TYPE_BIT   20

Definition at line 153 of file leon_pci_grpci2.c.

#define BD_DATA_DR   0x20000000

Definition at line 165 of file leon_pci_grpci2.c.

#define BD_DATA_DR_BIT   29

Definition at line 171 of file leon_pci_grpci2.c.

#define BD_DATA_EN   0x80000000

Definition at line 163 of file leon_pci_grpci2.c.

#define BD_DATA_EN_BIT   31

Definition at line 169 of file leon_pci_grpci2.c.

#define BD_DATA_ER   0x00080000

Definition at line 167 of file leon_pci_grpci2.c.

#define BD_DATA_ER_BIT   19

Definition at line 173 of file leon_pci_grpci2.c.

#define BD_DATA_IE   0x40000000

Definition at line 164 of file leon_pci_grpci2.c.

#define BD_DATA_IE_BIT   30

Definition at line 170 of file leon_pci_grpci2.c.

#define BD_DATA_LEN   0x0000ffff

Definition at line 168 of file leon_pci_grpci2.c.

#define BD_DATA_LEN_BIT   0

Definition at line 174 of file leon_pci_grpci2.c.

#define BD_DATA_TYPE   0x00300000

Definition at line 166 of file leon_pci_grpci2.c.

#define BD_DATA_TYPE_BIT   20

Definition at line 172 of file leon_pci_grpci2.c.

#define CAP9_BAR_OFS   0x4

Definition at line 185 of file leon_pci_grpci2.c.

#define CAP9_BARSIZE_OFS   0x24

Definition at line 187 of file leon_pci_grpci2.c.

#define CAP9_CTRL_OFS   0

Definition at line 184 of file leon_pci_grpci2.c.

#define CAP9_IOMAP_OFS   0x20

Definition at line 186 of file leon_pci_grpci2.c.

#define CTRL_BUS   (0xff<<CTRL_BUS_BIT)

Definition at line 100 of file leon_pci_grpci2.c.

#define CTRL_BUS_BIT   16

Definition at line 93 of file leon_pci_grpci2.c.

#define CTRL_EI   (1<<25)

Definition at line 98 of file leon_pci_grpci2.c.

#define CTRL_ER   (1<<24)

Definition at line 99 of file leon_pci_grpci2.c.

#define CTRL_HOSTINT   0xf

Definition at line 101 of file leon_pci_grpci2.c.

#define CTRL_PE   (1<<26)

Definition at line 97 of file leon_pci_grpci2.c.

#define CTRL_RESET   (1<<31)

Definition at line 95 of file leon_pci_grpci2.c.

#define CTRL_SI   (1<<27)

Definition at line 96 of file leon_pci_grpci2.c.

#define REGLOAD (   a)    (be32_to_cpu(__raw_readl(&(a))))

Definition at line 90 of file leon_pci_grpci2.c.

#define REGSTORE (   a,
  v 
)    (__raw_writel(cpu_to_be32(v), &(a)))

Definition at line 91 of file leon_pci_grpci2.c.

#define STS_CFGERR   (1<<STS_CFGERR_BIT)

Definition at line 127 of file leon_pci_grpci2.c.

#define STS_CFGERR_BIT   19

Definition at line 112 of file leon_pci_grpci2.c.

#define STS_CFGERRVALID   (1<<STS_CFGERRVALID_BIT)

Definition at line 126 of file leon_pci_grpci2.c.

#define STS_CFGERRVALID_BIT   20

Definition at line 111 of file leon_pci_grpci2.c.

#define STS_DI   (1<<STS_DI_BIT)

Definition at line 122 of file leon_pci_grpci2.c.

#define STS_DI_BIT   27

Definition at line 107 of file leon_pci_grpci2.c.

#define STS_DMA   (1<<STS_DMA_BIT)

Definition at line 121 of file leon_pci_grpci2.c.

#define STS_DMA_BIT   28

Definition at line 106 of file leon_pci_grpci2.c.

#define STS_ERR_IRQ   (STS_ISYSERR | STS_IMSTABRT | STS_ITGTABRT | STS_IPARERR)

Definition at line 140 of file leon_pci_grpci2.c.

#define STS_FDEPTH   (0x7<<STS_FDEPTH_BIT)

Definition at line 130 of file leon_pci_grpci2.c.

#define STS_FDEPTH_BIT   2

Definition at line 115 of file leon_pci_grpci2.c.

#define STS_FNUM   (0x3<<STS_FNUM_BIT)

Definition at line 131 of file leon_pci_grpci2.c.

#define STS_FNUM_BIT   0

Definition at line 116 of file leon_pci_grpci2.c.

#define STS_HI   (1<<STS_HI_BIT)

Definition at line 123 of file leon_pci_grpci2.c.

#define STS_HI_BIT   26

Definition at line 108 of file leon_pci_grpci2.c.

#define STS_HOST   (1<<STS_HOST_BIT)

Definition at line 118 of file leon_pci_grpci2.c.

#define STS_HOST_BIT   31

Definition at line 103 of file leon_pci_grpci2.c.

#define STS_IDMA   (1<<16)

Definition at line 134 of file leon_pci_grpci2.c.

#define STS_IDMAERR   (1<<15)

Definition at line 135 of file leon_pci_grpci2.c.

#define STS_IMSTABRT   (1<<14)

Definition at line 136 of file leon_pci_grpci2.c.

#define STS_INTSTS   (0xf<<STS_INTSTS_BIT)

Definition at line 129 of file leon_pci_grpci2.c.

#define STS_INTSTS_BIT   8

Definition at line 114 of file leon_pci_grpci2.c.

#define STS_INTTYPE   (0x3f<<STS_INTTYPE_BIT)

Definition at line 128 of file leon_pci_grpci2.c.

#define STS_INTTYPE_BIT   12

Definition at line 113 of file leon_pci_grpci2.c.

#define STS_IPARERR   (1<<12)

Definition at line 138 of file leon_pci_grpci2.c.

#define STS_IRQMODE   (0x3<<STS_IRQMODE_BIT)

Definition at line 124 of file leon_pci_grpci2.c.

#define STS_IRQMODE_BIT   24

Definition at line 109 of file leon_pci_grpci2.c.

#define STS_ISYSERR   (1<<17)

Definition at line 133 of file leon_pci_grpci2.c.

#define STS_ITGTABRT   (1<<13)

Definition at line 137 of file leon_pci_grpci2.c.

#define STS_MST   (1<<STS_MST_BIT)

Definition at line 119 of file leon_pci_grpci2.c.

#define STS_MST_BIT   30

Definition at line 104 of file leon_pci_grpci2.c.

#define STS_TAR   (1<<STS_TAR_BIT)

Definition at line 120 of file leon_pci_grpci2.c.

#define STS_TAR_BIT   29

Definition at line 105 of file leon_pci_grpci2.c.

#define STS_TRACE   (1<<STS_TRACE_BIT)

Definition at line 125 of file leon_pci_grpci2.c.

#define STS_TRACE_BIT   23

Definition at line 110 of file leon_pci_grpci2.c.

Function Documentation

DEFINE_SPINLOCK ( grpci2_dev_lock  )
void grpci2_hw_init ( struct grpci2_priv priv)

Definition at line 553 of file leon_pci_grpci2.c.

int grpci2_map_irq ( const struct pci_dev dev,
u8  slot,
u8  pin 
)

Definition at line 218 of file leon_pci_grpci2.c.

subsys_initcall ( grpci2_init  )

Variable Documentation

struct grpci2_priv* grpci2priv

Definition at line 216 of file leon_pci_grpci2.c.