summaryrefslogtreecommitdiff
path: root/board/esd/vom405
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-12-05 02:11:59 +0100
committerWolfgang Denk <wd@denx.de>2009-12-05 02:11:59 +0100
commit2a49bf3149e34e6f910e70bbc0a26e81cfdbdf70 (patch)
treee19b3def6c8f41f56cdb5e8b71aa53d8f72f5812 /board/esd/vom405
parentcd514aeb996e2f7aefbe1f78481965d9d074aed4 (diff)
parentf68ab43de67f59925542efb6bcec30f4a84fe695 (diff)
downloadu-boot-imx-2a49bf3149e34e6f910e70bbc0a26e81cfdbdf70.zip
u-boot-imx-2a49bf3149e34e6f910e70bbc0a26e81cfdbdf70.tar.gz
u-boot-imx-2a49bf3149e34e6f910e70bbc0a26e81cfdbdf70.tar.bz2
Merge branch 'master' into next
Conflicts: board/esd/plu405/plu405.c drivers/rtc/ftrtc010.c Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'board/esd/vom405')
-rw-r--r--board/esd/vom405/vom405.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/board/esd/vom405/vom405.c b/board/esd/vom405/vom405.c
index fb48022..de35036 100644
--- a/board/esd/vom405/vom405.c
+++ b/board/esd/vom405/vom405.c
@@ -26,11 +26,40 @@
#include <asm/io.h>
#include <command.h>
#include <malloc.h>
+#include <sja1000.h>
DECLARE_GLOBAL_DATA_PTR;
extern void lxt971_no_sleep(void);
+/*
+ * generate a short spike on the CAN tx line
+ * to bring the couplers in sync
+ */
+void init_coupler(u32 addr)
+{
+ struct sja1000_basic_s *ctrl = (struct sja1000_basic_s *)addr;
+
+ /* reset */
+ out_8(&ctrl->cr, CR_RR);
+
+ /* dominant */
+ out_8(&ctrl->btr0, 0x00); /* btr setup is required */
+ out_8(&ctrl->btr1, 0x14); /* we use 1Mbit/s */
+ out_8(&ctrl->oc, OC_TP1 | OC_TN1 | OC_POL1 |
+ OC_TP0 | OC_TN0 | OC_POL0 | OC_MODE1);
+ out_8(&ctrl->cr, 0x00);
+
+ /* delay */
+ in_8(&ctrl->cr);
+ in_8(&ctrl->cr);
+ in_8(&ctrl->cr);
+ in_8(&ctrl->cr);
+
+ /* reset */
+ out_8(&ctrl->cr, CR_RR);
+}
+
int board_early_init_f (void)
{
/*
@@ -77,6 +106,12 @@ int misc_init_r (void)
gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
gd->bd->bi_flashoffset = 0;
+ /*
+ * Init magnetic coupler
+ */
+ if (!getenv("noinitcoupler"))
+ init_coupler(CAN_BA);
+
return (0);
}