2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2010-02-20 16:41:30 +08:00
|
|
|
* linux/include/amba/bus.h
|
|
|
|
*
|
|
|
|
* This device type deals with ARM PrimeCells and anything else that
|
|
|
|
* presents a proper CID (0xB105F00D) at the end of the I/O register
|
|
|
|
* region or that is derived from a PrimeCell.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
#ifndef ASMARM_AMBA_H
|
|
|
|
#define ASMARM_AMBA_H
|
|
|
|
|
2010-07-15 17:47:14 +08:00
|
|
|
#include <linux/clk.h>
|
2010-03-29 12:28:32 +08:00
|
|
|
#include <linux/device.h>
|
2010-07-15 17:47:14 +08:00
|
|
|
#include <linux/err.h>
|
2010-03-29 12:28:32 +08:00
|
|
|
#include <linux/resource.h>
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#define AMBA_NR_IRQS 2
|
|
|
|
|
2010-07-15 17:47:14 +08:00
|
|
|
struct clk;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct amba_device {
|
|
|
|
struct device dev;
|
|
|
|
struct resource res;
|
2010-07-15 17:47:14 +08:00
|
|
|
struct clk *pclk;
|
2005-04-17 06:20:36 +08:00
|
|
|
u64 dma_mask;
|
|
|
|
unsigned int periphid;
|
|
|
|
unsigned int irq[AMBA_NR_IRQS];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct amba_id {
|
|
|
|
unsigned int id;
|
|
|
|
unsigned int mask;
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct amba_driver {
|
|
|
|
struct device_driver drv;
|
2009-05-21 05:39:08 +08:00
|
|
|
int (*probe)(struct amba_device *, struct amba_id *);
|
2005-04-17 06:20:36 +08:00
|
|
|
int (*remove)(struct amba_device *);
|
|
|
|
void (*shutdown)(struct amba_device *);
|
|
|
|
int (*suspend)(struct amba_device *, pm_message_t);
|
|
|
|
int (*resume)(struct amba_device *);
|
|
|
|
struct amba_id *id_table;
|
|
|
|
};
|
|
|
|
|
2009-08-04 08:01:02 +08:00
|
|
|
enum amba_vendor {
|
|
|
|
AMBA_VENDOR_ARM = 0x41,
|
|
|
|
AMBA_VENDOR_ST = 0x80,
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#define amba_get_drvdata(d) dev_get_drvdata(&d->dev)
|
|
|
|
#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p)
|
|
|
|
|
|
|
|
int amba_driver_register(struct amba_driver *);
|
|
|
|
void amba_driver_unregister(struct amba_driver *);
|
|
|
|
int amba_device_register(struct amba_device *, struct resource *);
|
|
|
|
void amba_device_unregister(struct amba_device *);
|
|
|
|
struct amba_device *amba_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 *);
|
|
|
|
|
2010-07-15 17:47:14 +08:00
|
|
|
#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)
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#define amba_config(d) (((d)->periphid >> 24) & 0xff)
|
|
|
|
#define amba_rev(d) (((d)->periphid >> 20) & 0x0f)
|
|
|
|
#define amba_manf(d) (((d)->periphid >> 12) & 0xff)
|
|
|
|
#define amba_part(d) ((d)->periphid & 0xfff)
|
|
|
|
|
|
|
|
#endif
|