@@ -72,6 +72,11 @@ unsigned int omap_rev(void);
#define OMAP_REVBITS_40 0x40
/*
+ * Get the CPU Id for OMAP devices
+ */
+#define GET_OMAP_ID() ((omap_rev() >> 16) & 0xffff)
+
+/*
* Get the CPU revision for OMAP devices
*/
#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
@@ -458,4 +463,149 @@ OMAP3_HAS_FEATURE(neon, NEON)
OMAP3_HAS_FEATURE(isp, ISP)
OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
+
+/*
+ * Mapping revision to silicon classes
+ */
+#define OMAP34XX_ES_1_0 OMAP_REVBITS_00
+#define OMAP34XX_ES_2_0 OMAP_REVBITS_10
+#define OMAP34XX_ES_2_1 OMAP_REVBITS_20
+#define OMAP34XX_ES_3_0 OMAP_REVBITS_30
+#define OMAP34XX_ES_3_1 OMAP_REVBITS_40
+
+/*
+ * Mapping revision to individual silicons
+ */
+#define OMAP3430_ES_1_0 OMAP_REVBITS_00
+#define OMAP3430_ES_2_0 OMAP_REVBITS_10
+#define OMAP3430_ES_2_1 OMAP_REVBITS_20
+#define OMAP3430_ES_3_0 OMAP_REVBITS_30
+#define OMAP3430_ES_3_1 OMAP_REVBITS_40
+
+
+/*
+ * Inline functions to compare revision for specific silicons
+ */
+static inline bool is_omap_rev_lt (u16 id, u16 rev)
+{
+ if (((GET_OMAP_ID()) == id) &&
+ ((GET_OMAP_REVISION()) < rev))
+ return true;
+ else
+ return false;
+}
+
+static inline bool is_omap_rev_le (u16 id, u16 rev)
+{
+ if (((GET_OMAP_ID()) == id) &&
+ ((GET_OMAP_REVISION()) <= rev))
+ return true;
+ else
+ return false;
+}
+
+static inline bool is_omap_rev_eq (u16 id, u16 rev)
+{
+ if (((GET_OMAP_ID()) == id) &&
+ ((GET_OMAP_REVISION()) == rev))
+ return true;
+ else
+ return false;
+}
+
+static inline bool is_omap_rev_ne (u16 id, u16 rev)
+{
+ if (((GET_OMAP_ID()) == id) &&
+ ((GET_OMAP_REVISION()) != rev))
+ return true;
+ else
+ return false;
+}
+
+static inline bool is_omap_rev_gt (u16 id, u16 rev)
+{
+ if (((GET_OMAP_ID()) == id) &&
+ ((GET_OMAP_REVISION()) > rev))
+ return true;
+ else
+ return false;
+}
+
+static inline bool is_omap_rev_ge (u16 id, u16 rev)
+{
+ if (((GET_OMAP_ID()) == id) &&
+ ((GET_OMAP_REVISION()) >= rev))
+ return true;
+ else
+ return false;
+}
+
+#define cpu_rev_lt(id, rev) is_omap_rev_lt(0x##id, OMAP##id##_##rev)
+#define cpu_rev_le(id, rev) is_omap_rev_le(0x##id, OMAP##id##_##rev)
+#define cpu_rev_eq(id, rev) is_omap_rev_eq(0x##id, OMAP##id##_##rev)
+#define cpu_rev_ne(id, rev) is_omap_rev_ne(0x##id, OMAP##id##_##rev)
+#define cpu_rev_gt(id, rev) is_omap_rev_gt(0x##id, OMAP##id##_##rev)
+#define cpu_rev_ge(id, rev) is_omap_rev_ge(0x##id, OMAP##id##_##rev)
+
+
+/*
+ * Inline functions to compare revision for class of silicons
+ */
+static inline bool is_class_rev_lt (u16 c, u16 rev)
+{
+ if (((GET_OMAP_CLASS) == c) && ((GET_OMAP_REVISION()) < rev))
+ return true;
+ else
+ return false;
+
+ return true;
+}
+
+static inline bool is_class_rev_le (u16 c, u16 rev)
+{
+ if (((GET_OMAP_CLASS) == c) && ((GET_OMAP_REVISION()) <= rev))
+ return true;
+ else
+ return false;
+
+ return true;
+}
+
+static inline bool is_class_rev_eq (u16 c, u16 rev)
+{
+ if (((GET_OMAP_CLASS) == c) && ((GET_OMAP_REVISION()) == rev))
+ return true;
+ else
+ return false;
+
+ return true;
+}
+
+static inline bool is_class_rev_gt (u16 c, u16 rev)
+{
+ if (((GET_OMAP_CLASS) == c) && ((GET_OMAP_REVISION()) > rev))
+ return true;
+ else
+ return false;
+
+ return true;
+}
+
+static inline bool is_class_rev_ge (u16 c, u16 rev)
+{
+ if (((GET_OMAP_CLASS) == c) && ((GET_OMAP_REVISION()) >= rev))
+ return true;
+ else
+ return false;
+
+ return true;
+}
+
+#define class_rev_lt(c, rev) is_class_rev_lt(0x##c, OMAP##c##XX_##rev)
+#define class_rev_le(c, rev) is_class_rev_le(0x##c, OMAP##c##XX_##rev)
+#define class_rev_eq(c, rev) is_class_rev_eq(0x##c, OMAP##c##XX_##rev)
+#define class_rev_ne(c, rev) is_class_rev_ne(0x##c, OMAP##c##XX_##rev)
+#define class_rev_gt(c, rev) is_class_rev_gt(0x##c, OMAP##c##XX_##rev)
+#define class_rev_ge(c, rev) is_class_rev_ge(0x##c, OMAP##c##XX_##rev)
+
#endif