Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
bus.h File Reference
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/err.h>
#include <linux/resource.h>
#include <linux/regulator/consumer.h>

Go to the source code of this file.

Data Structures

struct  amba_device
 
struct  amba_driver
 

Macros

#define AMBA_NR_IRQS   2
 
#define AMBA_CID   0xb105f00d
 
#define to_amba_device(d)   container_of(d, struct amba_device, dev)
 
#define amba_get_drvdata(d)   dev_get_drvdata(&d->dev)
 
#define amba_set_drvdata(d, p)   dev_set_drvdata(&d->dev, p)
 
#define amba_pclk_enable(d)   (IS_ERR((d)->pclk) ? 0 : clk_enable((d)->pclk))
 
#define amba_pclk_disable(d)   do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0)
 
#define AMBA_CONFIG_BITS(a)   (((a) >> 24) & 0xff)
 
#define AMBA_REV_BITS(a)   (((a) >> 20) & 0x0f)
 
#define AMBA_MANF_BITS(a)   (((a) >> 12) & 0xff)
 
#define AMBA_PART_BITS(a)   ((a) & 0xfff)
 
#define amba_config(d)   AMBA_CONFIG_BITS((d)->periphid)
 
#define amba_rev(d)   AMBA_REV_BITS((d)->periphid)
 
#define amba_manf(d)   AMBA_MANF_BITS((d)->periphid)
 
#define amba_part(d)   AMBA_PART_BITS((d)->periphid)
 
#define __AMBA_DEV(busid, data, mask)
 
#define AMBA_APB_DEVICE(name, busid, id, base, irqs, data)
 
#define AMBA_AHB_DEVICE(name, busid, id, base, irqs, data)
 
#define module_amba_driver(__amba_drv)   module_driver(__amba_drv, amba_driver_register, amba_driver_unregister)
 

Enumerations

enum  amba_vendor { AMBA_VENDOR_ARM = 0x41, AMBA_VENDOR_ST = 0x80 }
 

Functions

int amba_driver_register (struct amba_driver *)
 
void amba_driver_unregister (struct amba_driver *)
 
struct amba_deviceamba_device_alloc (const char *, resource_size_t, size_t)
 
void amba_device_put (struct amba_device *)
 
int amba_device_add (struct amba_device *, struct resource *)
 
int amba_device_register (struct amba_device *, struct resource *)
 
struct amba_deviceamba_apb_device_add (struct device *parent, const char *name, resource_size_t base, size_t size, int irq1, int irq2, void *pdata, unsigned int periphid)
 
struct amba_deviceamba_ahb_device_add (struct device *parent, const char *name, resource_size_t base, size_t size, int irq1, int irq2, void *pdata, unsigned int periphid)
 
void amba_device_unregister (struct amba_device *)
 
struct amba_deviceamba_find_device (const char *, struct device *, unsigned int, unsigned int)
 
int amba_request_regions (struct amba_device *, const char *)
 
void amba_release_regions (struct amba_device *)
 

Variables

struct bus_type amba_bustype
 

Macro Definition Documentation

#define __AMBA_DEV (   busid,
  data,
  mask 
)
Value:
{ \
.coherent_dma_mask = mask, \
.init_name = busid, \
.platform_data = data, \
}

Definition at line 96 of file bus.h.

#define AMBA_AHB_DEVICE (   name,
  busid,
  id,
  base,
  irqs,
  data 
)
Value:
struct amba_device name##_device = { \
.dev = __AMBA_DEV(busid, data, ~0ULL), \
.res = DEFINE_RES_MEM(base, SZ_4K), \
.dma_mask = ~0ULL, \
.irq = irqs, \
.periphid = id, \
}

Definition at line 120 of file bus.h.

#define AMBA_APB_DEVICE (   name,
  busid,
  id,
  base,
  irqs,
  data 
)
Value:
struct amba_device name##_device = { \
.dev = __AMBA_DEV(busid, data, 0), \
.res = DEFINE_RES_MEM(base, SZ_4K), \
.irq = irqs, \
.periphid = id, \
}

Definition at line 109 of file bus.h.

#define AMBA_CID   0xb105f00d

Definition at line 25 of file bus.h.

#define amba_config (   d)    AMBA_CONFIG_BITS((d)->periphid)

Definition at line 91 of file bus.h.

#define AMBA_CONFIG_BITS (   a)    (((a) >> 24) & 0xff)

Definition at line 86 of file bus.h.

#define amba_get_drvdata (   d)    dev_get_drvdata(&d->dev)

Definition at line 57 of file bus.h.

#define amba_manf (   d)    AMBA_MANF_BITS((d)->periphid)

Definition at line 93 of file bus.h.

#define AMBA_MANF_BITS (   a)    (((a) >> 12) & 0xff)

Definition at line 88 of file bus.h.

#define AMBA_NR_IRQS   2

Definition at line 24 of file bus.h.

#define amba_part (   d)    AMBA_PART_BITS((d)->periphid)

Definition at line 94 of file bus.h.

#define AMBA_PART_BITS (   a)    ((a) & 0xfff)

Definition at line 89 of file bus.h.

#define amba_pclk_disable (   d)    do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0)

Definition at line 82 of file bus.h.

#define amba_pclk_enable (   d)    (IS_ERR((d)->pclk) ? 0 : clk_enable((d)->pclk))

Definition at line 79 of file bus.h.

#define amba_rev (   d)    AMBA_REV_BITS((d)->periphid)

Definition at line 92 of file bus.h.

#define AMBA_REV_BITS (   a)    (((a) >> 20) & 0x0f)

Definition at line 87 of file bus.h.

#define amba_set_drvdata (   d,
  p 
)    dev_set_drvdata(&d->dev, p)

Definition at line 58 of file bus.h.

#define module_amba_driver (   __amba_drv)    module_driver(__amba_drv, amba_driver_register, amba_driver_unregister)

Definition at line 135 of file bus.h.

#define to_amba_device (   d)    container_of(d, struct amba_device, dev)

Definition at line 55 of file bus.h.

Enumeration Type Documentation

Enumerator:
AMBA_VENDOR_ARM 
AMBA_VENDOR_ST 

Definition at line 48 of file bus.h.

Function Documentation

struct amba_device* amba_ahb_device_add ( struct device parent,
const char name,
resource_size_t  base,
size_t  size,
int  irq1,
int  irq2,
void pdata,
unsigned int  periphid 
)
read

Definition at line 586 of file bus.c.

struct amba_device* amba_apb_device_add ( struct device parent,
const char name,
resource_size_t  base,
size_t  size,
int  irq1,
int  irq2,
void pdata,
unsigned int  periphid 
)
read

Definition at line 576 of file bus.c.

int amba_device_add ( struct amba_device dev,
struct resource parent 
)

amba_device_add - add a previously allocated AMBA device structure : AMBA device allocated by amba_device_alloc : resource parent for this devices resources

Claim the resource, and read the device cell ID if not already initialized. Register the AMBA device with the Linux device manager.

Definition at line 468 of file bus.c.

struct amba_device* amba_device_alloc ( const char ,
resource_size_t  ,
size_t   
)
read

Definition at line 615 of file bus.c.

void amba_device_put ( struct amba_device dev)

amba_device_put - put an AMBA device : AMBA device to put

Definition at line 656 of file bus.c.

int amba_device_register ( struct amba_device dev,
struct resource parent 
)

amba_device_register - register an AMBA device : AMBA device to register : parent memory resource

Setup the AMBA device, reading the cell ID if present. Claim the resource, and register the AMBA device with the Linux device manager.

Definition at line 641 of file bus.c.

void amba_device_unregister ( struct amba_device dev)

amba_device_unregister - unregister an AMBA device : AMBA device to remove

Remove the specified AMBA device from the Linux device manager. All files associated with this object will be destroyed, and device drivers notified that the device has been removed. The AMBA device's resources including the amba_device structure will be freed once all references to it have been dropped.

Definition at line 673 of file bus.c.

int amba_driver_register ( struct amba_driver drv)

amba_driver_register - register an AMBA device driver : amba device driver structure

Register an AMBA device driver with the Linux device model core. If devices pre-exist, the drivers probe function will be called.

Definition at line 424 of file bus.c.

void amba_driver_unregister ( struct amba_driver drv)

amba_driver_unregister - remove an AMBA device driver : AMBA device driver structure to remove

Unregister an AMBA device driver from the Linux device model. The device model will call the drivers remove function for each device the device driver is currently handling.

Definition at line 444 of file bus.c.

struct amba_device* amba_find_device ( const char busid,
struct device parent,
unsigned int  id,
unsigned int  mask 
)
read

amba_find_device - locate an AMBA device given a bus id : bus id for device (or NULL) : parent device (or NULL) : peripheral ID (or 0) : peripheral ID mask (or 0)

Return the AMBA device corresponding to the supplied parameters. If no device matches, returns NULL.

NOTE: When a valid device is found, its refcount is incremented, and must be decremented before the returned reference.

Definition at line 722 of file bus.c.

void amba_release_regions ( struct amba_device dev)

amba_release_regions - release mem regions associated with device : amba_device structure for device

Release regions claimed by a successful call to amba_request_regions.

Definition at line 765 of file bus.c.

int amba_request_regions ( struct amba_device ,
const char  
)

Definition at line 743 of file bus.c.

Variable Documentation

struct bus_type amba_bustype

Definition at line 307 of file bus.c.