Skip to content

Commit 1f2463d

Browse files
Andre Schwarzwdenx
Andre Schwarz
authored andcommitted
Add initial support for Matrix Vision mvSMR board based on MPC5200B.
Signed-off-by: Andre Schwarz <andre.schwarz@matrix-vision.de>
1 parent 9acd4f0 commit 1f2463d

File tree

14 files changed

+1088
-1
lines changed

14 files changed

+1088
-1
lines changed

CREDITS

+1-1
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ D: FADS823 configuration, MPC823 video support, I2C, wireless keyboard, lots mor
437437

438438
N: Andre Schwarz
439439
E: andre.schwarz@matrix-vision.de
440-
D: Support for Matrix Vision boards (MVBLM7/MVBC_P)
440+
D: Support for Matrix Vision boards (MVBLM7/MVBC_P/MVSMR)
441441

442442
N: Robert Schwebel
443443
E: r.schwebel@pengutronix.de

MAINTAINERS

+1
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ Andre Schwarz <andre.schwarz@matrix-vision.de>
422422

423423
mvbc_p MPC5200
424424
mvblm7 MPC8343
425+
mvsmr MPC5200
425426

426427
Jon Smirl <jonsmirl@gmail.com>
427428

MAKEALL

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ LIST_5xxx=" \
7070
motionpro \
7171
munices \
7272
MVBC_P \
73+
MVSMR \
7374
o2dnt \
7475
pcm030 \
7576
pf5200 \

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,11 @@ MVBC_P_config: unconfig
664664
{ echo "#define CONFIG_MVBC_P" >>$(obj)include/config.h; }
665665
@$(MKCONFIG) -n $@ -a MVBC_P ppc mpc5xxx mvbc_p matrix_vision
666666

667+
MVSMR_config: unconfig
668+
@mkdir -p $(obj)include
669+
@mkdir -p $(obj)board/matrix_vision/mvsmr
670+
@$(MKCONFIG) $(@:_config=) ppc mpc5xxx mvsmr matrix_vision
671+
667672
o2dnt_config: unconfig
668673
@$(MKCONFIG) o2dnt ppc mpc5xxx o2dnt
669674

board/matrix_vision/mvsmr/Makefile

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#
2+
# (C) Copyright 2003
3+
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4+
#
5+
# (C) Copyright 2004-2008
6+
# Matrix-Vision GmbH, info@matrix-vision.de
7+
#
8+
# See file CREDITS for list of people who contributed to this
9+
# project.
10+
#
11+
# This program is free software; you can redistribute it and/or
12+
# modify it under the terms of the GNU General Public License as
13+
# published by the Free Software Foundation; either version 2 of
14+
# the License, or (at your option) any later version.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program; if not, write to the Free Software
23+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24+
# MA 02111-1307 USA
25+
#
26+
27+
include $(TOPDIR)/config.mk
28+
29+
LIB = $(obj)lib$(BOARD).a
30+
31+
COBJS := $(BOARD).o fpga.o
32+
33+
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
34+
OBJS := $(addprefix $(obj),$(COBJS))
35+
SOBJS := $(addprefix $(obj),$(SOBJS))
36+
37+
$(LIB): $(obj).depend $(OBJS)
38+
$(AR) $(ARFLAGS) $@ $(OBJS)
39+
@mkimage -T script -C none -n mvSMR_Script -d bootscript bootscript.img
40+
41+
clean:
42+
rm -f $(SOBJS) $(OBJS)
43+
44+
distclean: clean
45+
rm -f $(LIB) core *.bak $(obj).depend
46+
47+
#########################################################################
48+
49+
include $(SRCTREE)/rules.mk
50+
51+
sinclude $(obj).depend

board/matrix_vision/mvsmr/bootscript

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
echo
2+
echo "==== running autoscript ===="
3+
echo
4+
setenv boot24 'bootm ${kernel_boot} ${mv_initrd_addr_ram}'
5+
setenv ramkernel 'setenv kernel_boot ${loadaddr}'
6+
setenv flashkernel 'setenv kernel_boot ${mv_kernel_addr}'
7+
setenv cpird 'cp ${mv_initrd_addr} ${mv_initrd_addr_ram} ${mv_initrd_length}'
8+
setenv bootfromflash run flashkernel cpird addcons boot24
9+
setenv bootfromnet 'tftp ${mv_initrd_addr_ram} ${initrd_name};run ramkernel'
10+
if test ${console} = yes;
11+
then
12+
setenv addcons 'setenv bootargs ${bootargs} console=ttyS${console_nr},${baudrate}N8'
13+
else
14+
setenv addcons 'setenv bootargs ${bootargs} console=tty0'
15+
fi
16+
setenv set_static_ip 'setenv ipaddr ${static_ipaddr}'
17+
setenv set_static_nm 'setenv netmask ${static_netmask}'
18+
setenv set_static_gw 'setenv gatewayip ${static_gateway}'
19+
setenv set_ip 'setenv ip ${ipaddr}::${gatewayip}:${netmask}'
20+
if test ${servicemode} != yes;
21+
then
22+
echo "=== forced flash mode ==="
23+
run set_static_ip set_static_nm set_static_gw set_ip bootfromflash
24+
fi
25+
if test ${autoscript_boot} != no;
26+
then
27+
if test ${netboot} = yes;
28+
then
29+
bootp
30+
if test $? = 0;
31+
then
32+
echo "=== bootp succeeded -> netboot ==="
33+
run set_ip bootfromnet addcons boot24
34+
else
35+
echo "=== netboot failed ==="
36+
fi
37+
fi
38+
echo "=== bootfromflash ==="
39+
run set_static_ip set_static_nm set_static_gw set_ip bootfromflash
40+
else
41+
echo "=== boot stopped with autoscript_boot no ==="
42+
fi

board/matrix_vision/mvsmr/config.mk

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#
2+
# (C) Copyright 2003
3+
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4+
#
5+
# See file CREDITS for list of people who contributed to this
6+
# project.
7+
#
8+
# This program is free software; you can redistribute it and/or
9+
# modify it under the terms of the GNU General Public License as
10+
# published by the Free Software Foundation; either version 2 of
11+
# the License, or (at your option) any later version.
12+
#
13+
# This program is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU General Public License
19+
# along with this program; if not, write to the Free Software
20+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21+
# MA 02111-1307 USA
22+
#
23+
24+
sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
25+
26+
ifndef TEXT_BASE
27+
TEXT_BASE = 0xFF800000
28+
endif
29+
30+
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board
31+
LDSCRIPT := $(SRCTREE)/board/matrix_vision/mvsmr/u-boot.lds

board/matrix_vision/mvsmr/fpga.c

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
/*
2+
* (C) Copyright 2002
3+
* Rich Ireland, Enterasys Networks, rireland@enterasys.com.
4+
* Keith Outwater, keith_outwater@mvis.com.
5+
*
6+
* (C) Copyright 2010
7+
* Andre Schwarz, Matrix Vision GmbH, andre.schwarz@matrix-vision.de
8+
*
9+
* See file CREDITS for list of people who contributed to this
10+
* project.
11+
*
12+
* This program is free software; you can redistribute it and/or
13+
* modify it under the terms of the GNU General Public License as
14+
* published by the Free Software Foundation; either version 2 of
15+
* the License, or (at your option) any later version.
16+
*
17+
* This program is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License
23+
* along with this program; if not, write to the Free Software
24+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25+
* MA 02111-1307 USA
26+
*
27+
*/
28+
29+
#include <common.h>
30+
#include <spartan3.h>
31+
#include <command.h>
32+
#include <asm/io.h>
33+
#include "fpga.h"
34+
#include "mvsmr.h"
35+
36+
Xilinx_Spartan3_Slave_Serial_fns fpga_fns = {
37+
fpga_pre_config_fn,
38+
fpga_pgm_fn,
39+
fpga_clk_fn,
40+
fpga_init_fn,
41+
fpga_done_fn,
42+
fpga_wr_fn,
43+
0
44+
};
45+
46+
Xilinx_desc spartan3 = {
47+
Xilinx_Spartan2,
48+
slave_serial,
49+
XILINX_XC3S200_SIZE,
50+
(void *) &fpga_fns,
51+
0,
52+
};
53+
54+
DECLARE_GLOBAL_DATA_PTR;
55+
56+
int mvsmr_init_fpga(void)
57+
{
58+
fpga_init();
59+
fpga_add(fpga_xilinx, &spartan3);
60+
61+
return 1;
62+
}
63+
64+
int fpga_init_fn(int cookie)
65+
{
66+
struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
67+
68+
if (in_be32(&gpio->simple_ival) & FPGA_CONFIG)
69+
return 0;
70+
71+
return 1;
72+
}
73+
74+
int fpga_done_fn(int cookie)
75+
{
76+
struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
77+
int result = 0;
78+
79+
udelay(10);
80+
if (in_be32(&gpio->simple_ival) & FPGA_DONE)
81+
result = 1;
82+
83+
return result;
84+
}
85+
86+
int fpga_pgm_fn(int assert, int flush, int cookie)
87+
{
88+
struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
89+
90+
if (!assert)
91+
setbits_8(&gpio->sint_dvo, FPGA_STATUS);
92+
else
93+
clrbits_8(&gpio->sint_dvo, FPGA_STATUS);
94+
95+
return assert;
96+
}
97+
98+
int fpga_clk_fn(int assert_clk, int flush, int cookie)
99+
{
100+
struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
101+
102+
if (assert_clk)
103+
setbits_be32(&gpio->simple_dvo, FPGA_CCLK);
104+
else
105+
clrbits_be32(&gpio->simple_dvo, FPGA_CCLK);
106+
107+
return assert_clk;
108+
}
109+
110+
int fpga_wr_fn(int assert_write, int flush, int cookie)
111+
{
112+
struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
113+
114+
if (assert_write)
115+
setbits_be32(&gpio->simple_dvo, FPGA_DIN);
116+
else
117+
clrbits_be32(&gpio->simple_dvo, FPGA_DIN);
118+
119+
return assert_write;
120+
}
121+
122+
int fpga_pre_config_fn(int cookie)
123+
{
124+
struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
125+
126+
setbits_8(&gpio->sint_dvo, FPGA_STATUS);
127+
128+
return 0;
129+
}

board/matrix_vision/mvsmr/fpga.h

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* (C) Copyright 2008
3+
* Andre Schwarz, Matrix Vision GmbH, andre.schwarz@matrix-vision.de
4+
*
5+
* See file CREDITS for list of people who contributed to this
6+
* project.
7+
*
8+
* This program is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU General Public License as
10+
* published by the Free Software Foundation; either version 2 of
11+
* the License, or (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program; if not, write to the Free Software
20+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21+
* MA 02111-1307 USA
22+
*
23+
*/
24+
25+
extern int mvsmr_init_fpga(void);
26+
27+
extern int fpga_pgm_fn(int assert_pgm, int flush, int cookie);
28+
extern int fpga_init_fn(int cookie);
29+
extern int fpga_clk_fn(int assert_clk, int flush, int cookie);
30+
extern int fpga_wr_fn(int assert_write, int flush, int cookie);
31+
extern int fpga_done_fn(int cookie);
32+
extern int fpga_pre_config_fn(int cookie);

0 commit comments

Comments
 (0)