9
0
Fork 0

sp804: introduce amba_is_arm_sp804 to detect if the sp804 is present at the address

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2013-02-12 14:03:26 +01:00 committed by Sascha Hauer
parent a59a5acf68
commit ed4da3f2de
2 changed files with 33 additions and 3 deletions

View File

@ -9,7 +9,7 @@
#include <io.h>
#include <driver.h>
#include <errno.h>
#include <linux/amba/bus.h>
#include <linux/amba/sp804.h>
#include <linux/clk.h>
#include <linux/err.h>
@ -73,8 +73,8 @@ static int sp804_probe(struct amba_device *dev, const struct amba_id *id)
static struct amba_id sp804_ids[] = {
{
.id = 0x00141804,
.mask = 0x00ffffff,
.id = AMBA_ARM_SP804_ID,
.mask = AMBA_ARM_SP804_ID_MASK,
},
{ 0, 0 },
};

View File

@ -0,0 +1,30 @@
/*
* Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
*
* GPLv2 only
*/
#ifndef __AMBA_SP804_H__
#define __AMBA_SP804_H__
#include <linux/amba/bus.h>
#include <sizes.h>
#define AMBA_ARM_SP804_ID 0x00141804
#define AMBA_ARM_SP804_ID_MASK 0x00ffffff
static inline bool amba_is_arm_sp804(void __iomem *base)
{
u32 pid, cid;
u32 size = SZ_4K;
cid = amba_device_get_cid(base, size);
if (cid != AMBA_CID)
return false;
pid = amba_device_get_pid(base, size);
return (pid & AMBA_ARM_SP804_ID_MASK) == AMBA_ARM_SP804_ID;
}
#endif /* __AMBA_SP804_H__ */