Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
bus.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/amba/bus.h>
#include <linux/sizes.h>
#include <asm/irq.h>

Go to the source code of this file.

Data Structures

struct  find_data
 

Macros

#define to_amba_driver(d)   container_of(d, struct amba_driver, drv)
 
#define amba_uevent   NULL
 
#define amba_attr_func(name, fmt, arg...)
 
#define amba_attr(name, fmt, arg...)
 
#define amba_pm_suspend   NULL
 
#define amba_pm_resume   NULL
 
#define amba_pm_freeze   NULL
 
#define amba_pm_thaw   NULL
 
#define amba_pm_poweroff   NULL
 
#define amba_pm_restore   NULL
 
#define AMBA_PM   NULL
 
#define SETFN(fn)   if (drv->fn) drv->drv.fn = amba_##fn
 

Functions

 amba_attr_func (id,"%08x\n", dev->periphid)
 
 amba_attr (irq0,"%u\n", dev->irq[0])
 
 amba_attr (irq1,"%u\n", dev->irq[1])
 
 amba_attr_func (resource,"\t%016llx\t%016llx\t%016lx\n",(unsigned long long) dev->res.start,(unsigned long long) dev->res.end, dev->res.flags)
 
 postcore_initcall (amba_init)
 
int amba_driver_register (struct amba_driver *drv)
 
void amba_driver_unregister (struct amba_driver *drv)
 
int amba_device_add (struct amba_device *dev, struct resource *parent)
 
 EXPORT_SYMBOL_GPL (amba_device_add)
 
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)
 
 EXPORT_SYMBOL_GPL (amba_apb_device_add)
 
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)
 
 EXPORT_SYMBOL_GPL (amba_ahb_device_add)
 
: sysfs name of the AMBA device

amba_device_alloc - allocate an AMBA device

: base of AMBA device : size of AMBA device

Allocate and initialize an AMBA device structure. Returns NULL on failure.

struct amba_deviceamba_device_alloc (const char *name, resource_size_t base, size_t size)
 
 EXPORT_SYMBOL_GPL (amba_device_alloc)
 
int amba_device_register (struct amba_device *dev, struct resource *parent)
 
void amba_device_put (struct amba_device *dev)
 
 EXPORT_SYMBOL_GPL (amba_device_put)
 
void amba_device_unregister (struct amba_device *dev)
 
struct amba_deviceamba_find_device (const char *busid, struct device *parent, unsigned int id, unsigned int mask)
 
: name, or NULL to use driver name

amba_request_regions - request all mem regions associated with device : amba_device structure for device

int amba_request_regions (struct amba_device *dev, const char *name)
 
void amba_release_regions (struct amba_device *dev)
 
 EXPORT_SYMBOL (amba_driver_register)
 
 EXPORT_SYMBOL (amba_driver_unregister)
 
 EXPORT_SYMBOL (amba_device_register)
 
 EXPORT_SYMBOL (amba_device_unregister)
 
 EXPORT_SYMBOL (amba_find_device)
 
 EXPORT_SYMBOL (amba_request_regions)
 
 EXPORT_SYMBOL (amba_release_regions)
 

Variables

struct bus_type amba_bustype
 

Macro Definition Documentation

#define amba_attr (   name,
  fmt,
  arg... 
)
Value:

Definition at line 73 of file bus.c.

#define amba_attr_func (   name,
  fmt,
  arg... 
)
Value:
static ssize_t name##_show(struct device *_dev, \
struct device_attribute *attr, char *buf) \
{ \
return sprintf(buf, fmt, arg); \
}

Definition at line 65 of file bus.c.

#define AMBA_PM   NULL

Definition at line 299 of file bus.c.

#define amba_pm_freeze   NULL

Definition at line 239 of file bus.c.

#define amba_pm_poweroff   NULL

Definition at line 241 of file bus.c.

#define amba_pm_restore   NULL

Definition at line 242 of file bus.c.

#define amba_pm_resume   NULL

Definition at line 159 of file bus.c.

#define amba_pm_suspend   NULL

Definition at line 158 of file bus.c.

#define amba_pm_thaw   NULL

Definition at line 240 of file bus.c.

#define amba_uevent   NULL

Definition at line 62 of file bus.c.

#define SETFN (   fn)    if (drv->fn) drv->drv.fn = amba_##fn
#define to_amba_driver (   d)    container_of(d, struct amba_driver, drv)

Definition at line 23 of file bus.c.

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.

amba_attr ( irq0  ,
"%u\n"  ,
dev->  irq[0] 
)
amba_attr ( irq1  ,
"%u\n"  ,
dev->  irq[1] 
)
amba_attr_func ( id  ,
"%08x\n"  ,
dev->  periphid 
)
amba_attr_func ( resource  ,
"\t%016llx\t%016llx\t%016lx\n"  ,
(unsigned long long) dev->res.  start,
(unsigned long long) dev->res.  end,
dev->res.  flags 
)
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 name,
resource_size_t  base,
size_t  size 
)
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 dev,
const char name 
)

Definition at line 743 of file bus.c.

EXPORT_SYMBOL ( amba_driver_register  )
EXPORT_SYMBOL ( amba_driver_unregister  )
EXPORT_SYMBOL ( amba_device_register  )
EXPORT_SYMBOL ( amba_device_unregister  )
EXPORT_SYMBOL ( amba_find_device  )
EXPORT_SYMBOL ( amba_request_regions  )
EXPORT_SYMBOL ( amba_release_regions  )
EXPORT_SYMBOL_GPL ( amba_device_add  )
EXPORT_SYMBOL_GPL ( amba_apb_device_add  )
EXPORT_SYMBOL_GPL ( amba_ahb_device_add  )
EXPORT_SYMBOL_GPL ( amba_device_alloc  )
EXPORT_SYMBOL_GPL ( amba_device_put  )
postcore_initcall ( amba_init  )

Variable Documentation

struct bus_type amba_bustype
Initial value:
= {
.name = "amba",
.dev_attrs = amba_dev_attrs,
.match = amba_match,
.uevent = amba_uevent,
.pm = AMBA_PM,
}

Definition at line 307 of file bus.c.