Skip to content

Commit

Permalink
ARM: 6368/1: move the PrimeCell IDs to use macros
Browse files Browse the repository at this point in the history
This make four macros for the PrimeCell ID register available to
drivers that use them witout using the PrimeCell/AMBA bus
abstraction and struct amba_device. It also moves the magic
PrimeCell CID "B105F00D" to the bus.h header file.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Linus Walleij authored and Russell King committed Oct 8, 2010
1 parent 2da6d64 commit 01723a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/amba/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ int amba_device_register(struct amba_device *dev, struct resource *parent)

amba_put_disable_pclk(dev);

if (cid == 0xb105f00d)
if (cid == AMBA_CID)
dev->periphid = pid;

if (!dev->periphid)
Expand Down
15 changes: 11 additions & 4 deletions include/linux/amba/bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/resource.h>

#define AMBA_NR_IRQS 2
#define AMBA_CID 0xb105f00d

struct clk;

Expand Down Expand Up @@ -70,9 +71,15 @@ void amba_release_regions(struct amba_device *);
#define amba_pclk_disable(d) \
do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0)

#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)
/* Some drivers don't use the struct amba_device */
#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)

#endif

0 comments on commit 01723a9

Please sign in to comment.