summaryrefslogtreecommitdiff
path: root/board/esd/plu405/plu405.c
diff options
context:
space:
mode:
authorMatthias Fuchs <matthias.fuchs@esd.eu>2010-02-01 13:53:59 +0100
committerStefan Roese <sr@denx.de>2010-02-03 09:17:44 +0100
commit976c21ad8e136df0ec361aca0c4bc287c5637c01 (patch)
treeccb576d1498f93f5facdf6c3d8ec914dcda28b47 /board/esd/plu405/plu405.c
parent59c1db6dab52b981e6ea25a203d0a919ede61ed2 (diff)
downloadu-boot-imx-976c21ad8e136df0ec361aca0c4bc287c5637c01.zip
u-boot-imx-976c21ad8e136df0ec361aca0c4bc287c5637c01.tar.gz
u-boot-imx-976c21ad8e136df0ec361aca0c4bc287c5637c01.tar.bz2
ppc4xx: Fix building for PLU405 boards
The init_coupler() function from board/esd/plu405/plu405.c got lost somehow! This patch readds it. Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'board/esd/plu405/plu405.c')
-rw-r--r--board/esd/plu405/plu405.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/board/esd/plu405/plu405.c b/board/esd/plu405/plu405.c
index e385a78..0f7fa69 100644
--- a/board/esd/plu405/plu405.c
+++ b/board/esd/plu405/plu405.c
@@ -46,6 +46,34 @@ const unsigned char fpgadata[] =
*/
#include "../common/fpga.c"
+/*
+ * 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)
{
/*