diff mbox

[U-Boot,03/11] powerpc/ppc4xx: Add fpgad command for dumping gdsys fpga registers

Message ID 1366629372-32022-4-git-send-email-eibach@gdsys.de
State Superseded
Delegated to: Stefan Roese
Headers show

Commit Message

Dirk Eibach April 22, 2013, 11:16 a.m. UTC
Signed-off-by: Dirk Eibach <eibach@gdsys.de>
---
 board/gdsys/common/Makefile   |    2 +-
 board/gdsys/common/cmd_fpga.c |   94 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+), 1 deletion(-)
 create mode 100644 board/gdsys/common/cmd_fpga.c

Comments

Tom Rini April 22, 2013, 5:14 p.m. UTC | #1
On Mon, Apr 22, 2013 at 01:16:04PM +0200, Dirk Eibach wrote:

> Signed-off-by: Dirk Eibach <eibach@gdsys.de>
> ---
>  board/gdsys/common/Makefile   |    2 +-
>  board/gdsys/common/cmd_fpga.c |   94 +++++++++++++++++++++++++++++++++++++++++

There's checkpatch warning I'm guessing since I can spot some spacing
issues.  Also, this is a generic command, lets move it into top-level
common, call it cmd_fpad.c, modify top-level README.  Oh, and
/*
 * Multiline comments go like this.
 */

Thanks!
Dirk Eibach April 23, 2013, 9:53 a.m. UTC | #2
Hi Tom, 

> ...
> There's checkpatch warning I'm guessing since I can spot some 
> spacing issues.
> ...

Hmm, interesting, it's checkpatch clean. Maybe this tool can still get
even more annoying :)
Will fix issues asap.

Cheers
Dirk
------------------------------------------------------------------------------------------------
Besuchen Sie unseren Blog auf
http://blog.gdsys.de

oder folgen Sie uns auf:
twitter: http://twitter.com/#!/gdsys
facebook: http://www.facebook.com/pages/Guntermann-Drunck-GmbH/318396891518396
Google+ : https://plus.google.com/100228872787564309232/ 
YouTube: http://www.youtube.com/user/GuntermannDrunck
------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------
Guntermann & Drunck GmbH Systementwicklung 
Dortmunder Str. 4a 
D-57234 Wilnsdorf - Germany 
Tel: +49 (0) 27 39 / 89 01 - 100  Fax: +49 (0) 27 39 / 89 01 - 120 
E-Mail: mailto:sales@gdsys.de Web: http://www.gdsys.de
--------------------------------------------------------------------------
Geschaeftsfuehrer: 
Udo Guntermann - Martin Drunck - Reiner Ruelmann
HRB 2884, Amtsgericht Siegen - WEEE-Reg.-Nr. DE30763240
USt.-Id.-Nr. DE 126575222 - Steuer-Nr. 342 / 5835 / 1041
--------------------------------------------------------------------------
DQS-zertifiziert nach ISO 9001:2008
--------------------------------------------------------------------------
Tom Rini April 23, 2013, 11:40 a.m. UTC | #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/23/2013 05:53 AM, Eibach, Dirk wrote:
> Hi Tom,
> 
>> ... There's checkpatch warning I'm guessing since I can spot some
>>  spacing issues. ...
> 
> Hmm, interesting, it's checkpatch clean. Maybe this tool can still
> get even more annoying :) Will fix issues asap.

Maybe checkpatch missed 'em, but I swear I saw space-not-tab
indentation (since it was just one or two lines that looked wrong).

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRdnNDAAoJENk4IS6UOR1WkAwP/2TBtLzaPUXnlQOrurYkaowt
o3aQTtZZqSdFEngWOrgi3n/y5G1j3HQrJXZfnS3tCbWp+T6vSey2Kue+JJ9X9V0F
jzdWrNFqyLGe7xUNUGeSAMQtd5aKObqQ0FMZLt1sQ4VBA4WjQuKnx0GNcLNifsCh
dp3ymIS5TbjQNt96uHwqUlfU7FXt8po0P42JREwFozvHpqvyVZaFVjC20JcRi4H5
mrPovYa8781zOP0mqEsgFeCIkZhS/kRMoHE5CLZaldpntySJbdh4Ymtk1pQTB23t
S3aUSdorAE5Yci7DgJlVS+B83AXStVqtVL4I8+jYhBkVTiF98xaNgdS1kMUb8Pxn
Liz6atco0j1MoBHEANy+8ZRgMxVmZWRVOzDl8B6T+k14G+U4WZs4VSGtNgvRe/yQ
X369CzWTrRJ4w8ifPBl+UYB05oQmGBPxzrz45QdMURlhHirS3aAup2YLpSBAgjjc
R0X3+FoaNwcZ30AlUuKLKLA84fFUsyEJyCSw2cCiD/YXOoGqO8EWEDkRLJ6p8Ouc
tM6VOMs1Scjr0w+J/LNfwQndeae3/broS3jjXEFIAHM/eKd0NqHby4X8IRQsEpK5
K4DaZD2WAGSrBBwRx8Vzl/Kud59V2GwFvL9ZqKaWsT/LdXk5xQD8tIH3lDe4r5+u
4oeVuyXLTZZvCjO8xgJZ
=MAdJ
-----END PGP SIGNATURE-----
diff mbox

Patch

diff --git a/board/gdsys/common/Makefile b/board/gdsys/common/Makefile
index 6f09550..aa15c15 100644
--- a/board/gdsys/common/Makefile
+++ b/board/gdsys/common/Makefile
@@ -31,7 +31,7 @@  LIB	= $(obj)lib$(VENDOR).o
 
 COBJS-$(CONFIG_IO) += miiphybb.o
 COBJS-$(CONFIG_IO64) += miiphybb.o
-COBJS-$(CONFIG_IOCON) += osd.o mclink.o
+COBJS-$(CONFIG_IOCON) += osd.o mclink.o cmd_fpga.o
 COBJS-$(CONFIG_DLVISION_10G) += osd.o
 
 COBJS   := $(COBJS-y)
diff --git a/board/gdsys/common/cmd_fpga.c b/board/gdsys/common/cmd_fpga.c
new file mode 100644
index 0000000..b73e599
--- /dev/null
+++ b/board/gdsys/common/cmd_fpga.c
@@ -0,0 +1,94 @@ 
+/*
+ * (C) Copyright 2012
+ * Dirk Eibach,  Guntermann & Drunck GmbH, eibach@gdsys.de
+ *
+ * based on cmd_mem.c
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <command.h>
+
+#include <gdsys_fpga.h>
+
+static uint	dp_last_fpga;
+static uint	dp_last_addr;
+static uint	dp_last_length = 0x40;
+
+/* Memory Display
+ *
+ * Syntax:
+ *	fpgad {fpga} {addr} {len}
+ */
+#define DISP_LINE_LEN	16
+int do_fpga_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	unsigned int k;
+	unsigned int fpga;
+	ulong	addr, length;
+	int rc = 0;
+	u16	linebuf[DISP_LINE_LEN/sizeof(u16)];
+
+	/* We use the last specified parameters, unless new ones are
+	 * entered.
+	 */
+	 fpga = dp_last_fpga;
+	addr = dp_last_addr;
+	length = dp_last_length;
+
+	if (argc < 3)
+		return CMD_RET_USAGE;
+
+	if ((flag & CMD_FLAG_REPEAT) == 0) {
+		/* FPGA is specified since argc > 2
+		*/
+		fpga = simple_strtoul(argv[1], NULL, 16);
+
+		/* Address is specified since argc > 2
+		*/
+		addr = simple_strtoul(argv[2], NULL, 16);
+
+		/* If another parameter, it is the length to display.
+		 * Length is the number of objects, not number of bytes.
+		 */
+		if (argc > 3)
+			length = simple_strtoul(argv[3], NULL, 16);
+	}
+
+	/* Print the lines. */
+	for (k = 0; k < DISP_LINE_LEN / sizeof(u16); ++k)
+		linebuf[k] = fpga_get_reg(fpga, addr + k * sizeof(u16));
+	print_buffer(addr, (void *)linebuf, sizeof(u16),
+		     length, DISP_LINE_LEN / sizeof(u16));
+	addr += sizeof(u16)*length;
+
+	dp_last_fpga = fpga;
+	dp_last_addr = addr;
+	dp_last_length = length;
+	return rc;
+}
+
+U_BOOT_CMD(
+	fpgad,	4,	1,	do_fpga_md,
+	"fpga register display",
+	"fpga address [# of objects]"
+);