summaryrefslogtreecommitdiffstats
path: root/sys/arm/at91/at91_twireg.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arm/at91/at91_twireg.h')
-rw-r--r--sys/arm/at91/at91_twireg.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/arm/at91/at91_twireg.h b/sys/arm/at91/at91_twireg.h
index 6cca101..7d61a4a 100644
--- a/sys/arm/at91/at91_twireg.h
+++ b/sys/arm/at91/at91_twireg.h
@@ -63,7 +63,10 @@
#define TWI_CWGR_CKDIV(x) ((x) << 16) /* Clock Divider */
#define TWI_CWGR_CHDIV(x) ((x) << 8) /* Clock High Divider */
#define TWI_CWGR_CLDIV(x) ((x) << 0) /* Clock Low Divider */
-#define TWI_CWGR_DIV(rate) ((at91_master_clock /(4*(rate))) - 2)
+#define TWI_CWGR_DIV(rate) \
+ (at91_is_sam9() ? \
+ ((at91_master_clock /(4*(rate))) - 3) : \
+ ((at91_master_clock /(4*(rate))) - 2))
/* TWI_SR */
/* TWI_IER */
OpenPOWER on IntegriCloud