From patchwork Fri Jan 8 15:26:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/1] omap3: Add macros for comparing si revision Date: Fri, 08 Jan 2010 15:26:15 -0000 From: Sanjeev Premi X-Patchwork-Id: 71802 Message-Id: <1262964375-21873-1-git-send-email-premi@ti.com> To: linux-omap@vger.kernel.org Cc: Sanjeev Premi This patch adds verbose macros for comparing silicon revision bits. Current mechanism of comparing complete 'omap_revision' does not work/ represent the multiple processors, and their revisions. Signed-off-by: Sanjeev Premi --- arch/arm/plat-omap/include/plat/cpu.h | 55 +++++++++++++++++++++++++++++++++ 6 files changed, 97 insertions(+), 21 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h index 9a028bd..534171a 100644 --- a/arch/arm/plat-omap/include/plat/cpu.h +++ b/arch/arm/plat-omap/include/plat/cpu.h @@ -449,6 +449,61 @@ IS_OMAP_TYPE(3517, 0x3517) #define OMAP4430_REV_ES1_0 0x44300044 /* + * Silicon revisions + */ +#define OMAP_ES_1_0 0x00 +#define OMAP_ES_2_0 0x10 +#define OMAP_ES_2_1 0x20 +#define OMAP_ES_3_0 0x30 +#define OMAP_ES_3_1 0x40 + +#define OMAP_REV_MASK 0x0000ff00 +#define OMAP_REV_BITS ((omap_rev() & OMAP_REV_MASK) >> 8) + +#define OMAP_REV_IS(revid) \ +static inline u8 omap_rev_is_ ##revid (void) \ +{ \ + return (OMAP_REV_BITS == OMAP_ES_ ##revid) ? 1 : 0; \ +} + +#define OMAP_REV_LT(revid) \ +static inline u8 omap_rev_lt_ ##revid (void) \ +{ \ + return (OMAP_REV_BITS < OMAP_ES_ ##revid) ? 1 : 0; \ +} + +#define OMAP_REV_LE(revid) \ +static inline u8 omap_rev_le_ ##revid (void) \ +{ \ + return (OMAP_REV_BITS <= OMAP_ES_ ##revid) ? 1 : 0; \ +} + +#define OMAP_REV_GT(revid) \ +static inline u8 omap_rev_gt_ ##revid (void) \ +{ \ + return (OMAP_REV_BITS > OMAP_ES_ ##revid) ? 1 : 0; \ +} + +#define OMAP_REV_GE(revid) \ +static inline u8 omap_rev_ge_ ##revid (void) \ +{ \ + return (OMAP_REV_BITS >= OMAP_ES_ ##revid) ? 1 : 0; \ +} + +#define OMAP_REV_FUNCTIONS(revid) \ + OMAP_REV_IS(revid) \ + OMAP_REV_LT(revid) \ + OMAP_REV_LE(revid) \ + OMAP_REV_GT(revid) \ + OMAP_REV_GE(revid) + +OMAP_REV_FUNCTIONS(1_0) +OMAP_REV_FUNCTIONS(2_0) +OMAP_REV_FUNCTIONS(2_1) +OMAP_REV_FUNCTIONS(3_0) +OMAP_REV_FUNCTIONS(3_1) + +/* * omap_chip bits * * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is