Skip to contentSkip to conversation

Support for XPedite5370 and misc GPIO

PATCH Superseded Peter Tyser 4 participants 20 messages Oct 23, 2008 – Nov 19, 2008

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover Support for XPedite5370 and misc GPIO

Hello,
This patch series adds support for the XPedite5370 SBC. Its an MPC8572-based VPX card with a PMC/XMC site. The XPedite5370 includes a significant number of I2C GPIO devices (5) which are used for board configuration. I added support for 2 new I2C gpio devices in a new drivers/gpio directory. I'm not sure if this is the preferred location/method, so let me know if others have have different preferences. It'd be nice to have a more generic GPIO framework (like Linux's) at some point, but figured this was a step in the right direction by providing a place for generic GPIO devices in drivers/gpio.

Thanks,
Peter

Peter Tyser (3):
pca953x: Add support for PCA953x I2C gpio devices
ds4510: Add support for Maxim's DS4510 I2C device XPedite5370 board support

 MAINTAINERS                         |    3 +
 MAKEALL                             |    1 +
 Makefile                            |    5 +
 README                              |    9 +
 board/xes/common/Makefile           |   56 ++++
 board/xes/common/fsl_8572_clk.c     |   51 +++
 board/xes/common/fsl_85xx_ddr.c     |   93 ++++++
 board/xes/common/fsl_85xx_pci.c     |  287 +++++++++++++++++
 board/xes/xpedite5370/Makefile      |   45 +++
 board/xes/xpedite5370/config.mk     |   35 ++
 board/xes/xpedite5370/ddr.c         |  270 ++++++++++++++++
 board/xes/xpedite5370/law.c         |   54 ++++
 board/xes/xpedite5370/tlb.c         |   91 ++++++
 board/xes/xpedite5370/u-boot.lds    |  145 +++++++++
 board/xes/xpedite5370/xpedite5370.c |  125 ++++++++
 drivers/gpio/Makefile               |   48 +++
 drivers/gpio/ds4510.c               |  344 ++++++++++++++++++++
 drivers/gpio/pca953x.c              |  186 +++++++++++
 include/configs/XPEDITE5370.h       |  590 +++++++++++++++++++++++++++++++++++
 include/gpio/ds4510.h               |   75 +++++
 include/gpio/pca953x.h              |   39 +++
 21 files changed, 2552 insertions(+), 0 deletions(-)
 create mode 100644 board/xes/common/Makefile
 create mode 100644 board/xes/common/fsl_8572_clk.c
 create mode 100644 board/xes/common/fsl_85xx_ddr.c
 create mode 100644 board/xes/common/fsl_85xx_pci.c
 create mode 100644 board/xes/xpedite5370/Makefile
 create mode 100644 board/xes/xpedite5370/config.mk
 create mode 100644 board/xes/xpedite5370/ddr.c
 create mode 100644 board/xes/xpedite5370/law.c
 create mode 100644 board/xes/xpedite5370/tlb.c
 create mode 100644 board/xes/xpedite5370/u-boot.lds
 create mode 100644 board/xes/xpedite5370/xpedite5370.c
 create mode 100644 drivers/gpio/Makefile
 create mode 100644 drivers/gpio/ds4510.c
 create mode 100644 drivers/gpio/pca953x.c
 create mode 100644 include/configs/XPEDITE5370.h
 create mode 100644 include/gpio/ds4510.h
 create mode 100644 include/gpio/pca953x.h
#1 lore raw

PATCH 1/3 Add support for PCA953x I2C gpio devices

Initial support for NXP's 4 and 8 bit I2C gpio expanders (eg pca9537, pca9557, etc). The CONFIG_PCA953X define enables support for the devices while the CONFIG_CMD_PCA953X define enables the pca953x command.

---
 Makefile               |    2 +
 README                 |    7 ++
 drivers/gpio/Makefile  |   47 ++++++++++++
 drivers/gpio/pca953x.c |  186 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/gpio/pca953x.h |   39 ++++++++++
 5 files changed, 281 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/Makefile
 create mode 100644 drivers/gpio/pca953x.c
 create mode 100644 include/gpio/pca953x.h
Makefile +2 -0
index fceb8a2..40c08a7 100644
@@ -221,6 +221,7 @@ LIBS += disk/libdisk.a
 LIBS += drivers/bios_emulator/libatibiosemu.a
 LIBS += drivers/block/libblock.a
 LIBS += drivers/dma/libdma.a
+LIBS += drivers/gpio/libgpio.a
 LIBS += drivers/hwmon/libhwmon.a
 LIBS += drivers/i2c/libi2c.a
 LIBS += drivers/input/libinput.a
@@ -396,6 +397,7 @@ TAG_SUBDIRS += disk
 TAG_SUBDIRS += common
 TAG_SUBDIRS += drivers/bios_emulator
 TAG_SUBDIRS += drivers/block
+TAG_SUBDIRS += drivers/gpio
 TAG_SUBDIRS += drivers/hwmon
 TAG_SUBDIRS += drivers/i2c
 TAG_SUBDIRS += drivers/input
README +7 -0
index ebee20f..73bed41 100644
@@ -601,6 +601,7 @@ The following options need to be configured:
 		CONFIG_CMD_MII		* MII utility commands
 		CONFIG_CMD_NAND		* NAND support
 		CONFIG_CMD_NET		  bootp, tftpboot, rarpboot
+		CONFIG_CMD_PCA953X	* PCA953x I2C gpio commands
 		CONFIG_CMD_PCI		* pciinfo
 		CONFIG_CMD_PCMCIA		* PCMCIA support
 		CONFIG_CMD_PING		* send ICMP ECHO_REQUEST to network
@@ -678,6 +679,12 @@ The following options need to be configured:
 		Note that if the RTC uses I2C, then the I2C interface
 		must also be configured. See I2C Support, below.
 
+- GPIO Support:
+		CONFIG_PCA953X		- use NXP's PCA953X series I2C GPIO
+
+		Note that if the GPIO device uses I2C, then the I2C interface
+		must also be configured. See I2C Support, below.
+
 - Timestamp Support:
 
 		When CONFIG_TIMESTAMP is selected, the timestamp
drivers/gpio/Makefile new file +47 -0

47 lines not on this page · raw message

drivers/gpio/pca953x.c new file +186 -0

186 lines not on this page · raw message

include/gpio/pca953x.h new file +39 -0
new file mode 100644
index 0000000..6c2b58c
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 Extreme Engineering Solutions, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * Version 2 as published by the Free Software Foundation.
+ *
+ * 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
+ */
+
+#ifndef __PCA953X_H_
+#define __PCA953X_H_
+
+#define PCA953X_IN		0x00
+#define PCA953X_OUT		0x01
+#define PCA953X_POL		0x02
+#define PCA953X_CONF		0x03
+
+#define PCA953X_OUT_LOW		0
+#define PCA953X_OUT_HIGH	1
+#define PCA953X_POL_NORMAL	0
+#define PCA953X_POL_INVERT	1
+#define PCA953X_DIR_OUT		0
+#define PCA953X_DIR_IN		1
+
+int pca953x_set_val(u8 chip, uint mask, uint data);
+int pca953x_set_pol(u8 chip, uint mask, uint data);
+int pca953x_set_dir(u8 chip, uint mask, uint data);
+int pca953x_get_val(u8 chip);
+
+#endif /* __PCA953X_H_ */
Signature · 1 line
1.6.0.2.GIT
#2 lore raw

PATCH 2/3 Add support for Maxim's DS4510 I2C device

Initial support for the DS4510, a CPU supervisor with integrated EEPROM, SRAM, and 4 programmable non-volatile GPIO pins. The CONFIG_DS4510 define enables support for the device while the CONFIG_CMD_DS4510 define enables the ds4510 command.

---
 README                |    2 +
 drivers/gpio/Makefile |    1 +
 drivers/gpio/ds4510.c |  344 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/gpio/ds4510.h |   75 +++++++++++
 4 files changed, 422 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/ds4510.c
 create mode 100644 include/gpio/ds4510.h
README +2 -0
index 73bed41..2c0a19f 100644
@@ -572,6 +572,7 @@ The following options need to be configured:
 		CONFIG_CMD_DHCP		* DHCP support
 		CONFIG_CMD_DIAG		* Diagnostics
 		CONFIG_CMD_DOC		* Disk-On-Chip Support
+		CONFIG_CMD_DS4510	* ds4510 I2C gpio/memory commands
 		CONFIG_CMD_DTT		* Digital Therm and Thermostat
 		CONFIG_CMD_ECHO		  echo arguments
 		CONFIG_CMD_EEPROM	* EEPROM read/write support
@@ -681,6 +682,7 @@ The following options need to be configured:
 
 - GPIO Support:
 		CONFIG_PCA953X		- use NXP's PCA953X series I2C GPIO
+		CONFIG_DS4510		- use Maxim's DS4510 I2C GPIO/eeprom
 
 		Note that if the GPIO device uses I2C, then the I2C interface
 		must also be configured. See I2C Support, below.
drivers/gpio/Makefile +1 -0
index dd618ed..11f0903 100644
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB 	:= $(obj)libgpio.a
 
 COBJS-$(CONFIG_PCA953X)	+= pca953x.o
+COBJS-$(CONFIG_DS4510)	+= ds4510.o
 
 COBJS	:= $(COBJS-y)
 SRCS 	:= $(COBJS:.o=.c)
drivers/gpio/ds4510.c new file +344 -0

344 lines not on this page · raw message

include/gpio/ds4510.h new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
1.6.0.2.GIT
#3 lore raw

PATCH 3/3 XPedite5370 board support

Initial support for Extreme Engineering Solutions XPedite5370 - a MPC8572-based 3U VPX single board computer with a PMC/XMC site.

---
 MAINTAINERS                         |    3 +
 MAKEALL                             |    1 +
 Makefile                            |    3 +
 board/xes/common/Makefile           |   56 ++++
 board/xes/common/fsl_8572_clk.c     |   51 +++
 board/xes/common/fsl_85xx_ddr.c     |   93 ++++++
 board/xes/common/fsl_85xx_pci.c     |  287 +++++++++++++++++
 board/xes/xpedite5370/Makefile      |   45 +++
 board/xes/xpedite5370/config.mk     |   35 ++
 board/xes/xpedite5370/ddr.c         |  270 ++++++++++++++++
 board/xes/xpedite5370/law.c         |   54 ++++
 board/xes/xpedite5370/tlb.c         |   91 ++++++
 board/xes/xpedite5370/u-boot.lds    |  145 +++++++++
 board/xes/xpedite5370/xpedite5370.c |  125 ++++++++
 include/configs/XPEDITE5370.h       |  590 +++++++++++++++++++++++++++++++++++
 15 files changed, 1849 insertions(+), 0 deletions(-)
 create mode 100644 board/xes/common/Makefile
 create mode 100644 board/xes/common/fsl_8572_clk.c
 create mode 100644 board/xes/common/fsl_85xx_ddr.c
 create mode 100644 board/xes/common/fsl_85xx_pci.c
 create mode 100644 board/xes/xpedite5370/Makefile
 create mode 100644 board/xes/xpedite5370/config.mk
 create mode 100644 board/xes/xpedite5370/ddr.c
 create mode 100644 board/xes/xpedite5370/law.c
 create mode 100644 board/xes/xpedite5370/tlb.c
 create mode 100644 board/xes/xpedite5370/u-boot.lds
 create mode 100644 board/xes/xpedite5370/xpedite5370.c
 create mode 100644 include/configs/XPEDITE5370.h
MAINTAINERS +3 -0
index 60cb6a6..bd6cb57 100644
@@ -406,6 +406,9 @@ Rune Torgersen <[email protected]>
 
 	MPC8266ADS	MPC8266
 
+Peter Tyser <[email protected]>
+
+	XPEDITE5370	MPC8572
 
 David Updegraff <[email protected]>
 
MAKEALL +1 -0
index aa602b7..5044347 100755
@@ -375,6 +375,7 @@ LIST_85xx="		\
 	TQM8548		\
 	TQM8555		\
 	TQM8560		\
+	XPEDITE5370	\
 "
 
 #########################################################################
Makefile +3 -0
index 40c08a7..066552c 100644
@@ -2397,6 +2397,9 @@ TQM8560_config:		unconfig
 	echo "#define CONFIG_BOARDNAME \"TQM$${CTYPE}\"">>$(obj)include/config.h;
 	@$(MKCONFIG) -a TQM85xx ppc mpc85xx tqm85xx tqc
 
+XPEDITE5370_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) ppc mpc85xx xpedite5370 xes
+
 #########################################################################
 ## MPC86xx Systems
 #########################################################################
board/xes/common/Makefile new file +56 -0

56 lines not on this page · raw message

board/xes/common/fsl_8572_clk.c new file +51 -0

51 lines not on this page · raw message

board/xes/common/fsl_85xx_ddr.c new file +93 -0

93 lines not on this page · raw message

board/xes/common/fsl_85xx_pci.c new file +287 -0

287 lines not on this page · raw message

board/xes/xpedite5370/Makefile new file +45 -0

45 lines not on this page · raw message

board/xes/xpedite5370/config.mk new file +35 -0
new file mode 100644
index 0000000..39469b2
@@ -0,0 +1,35 @@
+#
+# Copyright 2008 Extreme Engineering Solutions, Inc.
+# Copyright 2007-2008 Freescale Semiconductor, Inc.
+#
+# 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
+#
+
+#
+# xpedite5370 board
+#
+ifndef TEXT_BASE
+TEXT_BASE = 0xfff80000
+endif
+
+PLATFORM_RELFLAGS += -mrelocatable
+
+PLATFORM_CPPFLAGS += -DCONFIG_E500=1
+PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx=1
+PLATFORM_CPPFLAGS += -DCONFIG_MPC8572=1
board/xes/xpedite5370/ddr.c new file +270 -0

270 lines not on this page · raw message

board/xes/xpedite5370/law.c new file +54 -0

54 lines not on this page · raw message

board/xes/xpedite5370/tlb.c new file +91 -0

91 lines not on this page · raw message

board/xes/xpedite5370/u-boot.lds new file +145 -0

145 lines not on this page · raw message

board/xes/xpedite5370/xpedite5370.c new file +125 -0

125 lines not on this page · raw message

include/configs/XPEDITE5370.h new file +590 -0

590 lines not on this page · raw message

Signature · 1 line
1.6.0.2.GIT
#4 lore raw

PATCH 3/3 XPedite5370 board support

Quoted 5 lines · Peter Tyser

Initial support for Extreme Engineering Solutions XPedite5370 - a MPC8572-based 3U VPX single board computer with a PMC/XMC site.

Quoted 8 lines
---
 MAINTAINERS                         |    3 +
 MAKEALL                             |    1 +
 Makefile                            |    3 +
 board/xes/common/Makefile           |   56 ++++
 board/xes/common/fsl_8572_clk.c     |   51 +++
 board/xes/common/fsl_85xx_ddr.c     |   93 ++++++
 board/xes/common/fsl_85xx_pci.c     |  287 +++++++++++++++++

Could you take a look at the new PCI code Kumar submitted (which I just applied), and rework the board code to imitate that code (it should be a trivial change, but one that makes things cleaner)

Quoted 6 lines
board/xes/xpedite5370/xpedite5370.c new file +6 -0
+int board_early_init_r(void)
+{
+       const unsigned int flashbase = CONFIG_SYS_FLASH_BASE2;
+       int i;
+
+       /* Initialize PCA9557 devices */

board/xes/xpedite5370/xpedite5370.c line 95

Quoted 10 lines
board/xes/xpedite5370/xpedite5370.c new file +10 -0
+       pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
+       pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR1, 0xff, 0);
+       pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
+       pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
+
+       /* Invalidate flash region */
+       for (i = 0; i < 256 * 1024 * 1024; i += 32) {
+               asm volatile ("dcbi %0,%1": : "b" (flashbase), "r" (i));
+               asm volatile ("icbi %0,%1": : "b" (flashbase), "r" (i));
+       }

Take a look at the current 8572DS code for doing this. By mapping things correctly, you can use dcbf, and not have to go through the entire memory space of your flash.

Otherwise, it looks good to me.

Andy

#5 lore raw

PATCH 3/3 XPedite5370 board support

Quoted 18 lines
Quoted 4 lines
 board/xes/common/fsl_8572_clk.c     |   51 +++
 board/xes/common/fsl_85xx_ddr.c     |   93 ++++++
 board/xes/common/fsl_85xx_pci.c     |  287 +++++++++++++++++

Could you take a look at the new PCI code Kumar submitted (which I just applied), and rework the board code to imitate that code (it should be a trivial change, but one that makes things cleaner)

board/xes/xpedite5370/xpedite5370.c line 95

Quoted 5 lines
board/xes/xpedite5370/xpedite5370.c new file +5 -0
+       /* Invalidate flash region */
+       for (i = 0; i < 256 * 1024 * 1024; i += 32) {
+               asm volatile ("dcbi %0,%1": : "b" (flashbase), "r" (i));
+               asm volatile ("icbi %0,%1": : "b" (flashbase), "r" (i));
+       }
Quoted 4 lines

Take a look at the current 8572DS code for doing this. By mapping things correctly, you can use dcbf, and not have to go through the entire memory space of your flash.

Thanks for the comments Andy. I'll make the changes you referenced as well as a tiny bit of aesthetic cleanup to XPEDITE5370.h and resubmit on Monday.

Peter

#6 lore raw

PATCH 3/3 XPedite5370 board support

In reply to Peter Tyser

Dear Peter Tyser,

Quoted 4 lines · In message <[email protected]> you wrote:

Initial support for Extreme Engineering Solutions XPedite5370 - a MPC8572-based 3U VPX single board computer with a PMC/XMC site.

...

Quoted 5 lines
board/xes/common/fsl_85xx_ddr.c new file +0 -0
new file mode 100644
index 0000000..30b4767

...

Quoted 28 lines
board/xes/common/fsl_85xx_ddr.c new file +28 -0
+	puts(" (");
+
+#if (CONFIG_NUM_DDR_CONTROLLERS > 1)
+	/* Print interleaving information */
+	if (ddr1->cs0_config & 0x20000000) {
+		switch ((ddr1->cs0_config >> 24) & 0xf) {
+		case 0:
+			puts("cache line");
+			break;
+		case 1:
+			puts("page");
+			break;
+		case 2:
+			puts("bank");
+			break;
+		case 3:
+			puts("super-bank");
+			break;
+		default:
+			puts("invalid");
+			break;
+		}
+	} else {
+		puts("no");
+	}
+
+	puts(" interleaving");
+#endif

board/xes/common/fsl_85xx_ddr.c line 91

Quoted 10 lines
board/xes/common/fsl_85xx_ddr.c new file +10 -0
+
+#if (CONFIG_NUM_DDR_CONTROLLERS > 1) && defined(CONFIG_DDR_ECC)
+	puts(", ");
+#endif
+
+#if defined(CONFIG_DDR_ECC)
+	puts("ECC enabled");
+#endif
+
+	puts(")");

Please don't be too noisy. Turn this into debug() calls.

Quoted 5 lines
board/xes/common/fsl_85xx_pci.c new file +0 -0
new file mode 100644
index 0000000..12437be

...

board/xes/common/fsl_85xx_pci.c line 105

Quoted 3 lines
board/xes/common/fsl_85xx_pci.c new file +3 -0
+	if (width && !(devdisr & MPC85xx_DEVDISR_PCIE)) {
+		printf("\n    PCIE1 connected as %s (x%d)",
+		       host ? "Root Complex" : "End Point", width);

Alignment not by TAB.

board/xes/common/fsl_85xx_pci.c line 109

Quoted 4 lines
board/xes/common/fsl_85xx_pci.c new file +4 -0
+		if (pci->pme_msg_det) {
+			pci->pme_msg_det = 0xffffffff;
+			debug(" with errors.  Clearing.  Now 0x%08x",
+			      pci->pme_msg_det);

Alignment not by TAB.

board/xes/common/fsl_85xx_pci.c line 118

Quoted 9 lines
board/xes/common/fsl_85xx_pci.c new file +9 -0
+		}
+		printf("\n");
+
+		/* inbound */
+		pci_set_region(hose->regions + 0,
+			       CONFIG_SYS_PCI_MEMORY_BUS,
+			       CONFIG_SYS_PCI_MEMORY_PHYS,
+			       CONFIG_SYS_PCI_MEMORY_SIZE,
+			       PCI_REGION_MEM | PCI_REGION_MEMORY);

Alignment not by TAB.

And so on.

Quoted 5 lines
board/xes/xpedite5370/xpedite5370.c new file +0 -0
new file mode 100644
index 0000000..3526172

...

board/xes/xpedite5370/xpedite5370.c line 66

Quoted 3 lines
board/xes/xpedite5370/xpedite5370.c new file +3 -0
+	/* Print boot dev and swap flash flash chip selects if booted from 2nd
+	 * flash.  Swapping chip selects presents user with a common memory
+	 * map regardless of which flash was booted from. */

Multiline comment style.

board/xes/xpedite5370/xpedite5370.c line 69

Quoted 3 lines
board/xes/xpedite5370/xpedite5370.c new file +3 -0
+	flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
+			  CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS));
+	printf("FLASH: Executed from FLASH%d\n", flash_sel ? 2 : 1);

Please be less noisy! s/printf/debug/

Quoted 15 lines
board/xes/xpedite5370/xpedite5370.c new file +15 -0
+#define	CONFIG_EXTRA_ENV_SETTINGS				\
+ "autoload=yes\0"						\
+ "download_cmd=tftp\0"						\
+ "console_args=console=ttyS0,115200\0"				\
+ "root_args=root=/dev/nfs rw\0"					\
+ "misc_args=ip=on\0"						\
+ "set_bootargs=setenv bootargs ${console_args} ${root_args} ${misc_args}\0" \
+ "bootfile=/home/user/file\0"					\
+ "osfile=/home/user/uImage-XPedite5370\0"			\
+ "fdtfile=/home/user/xpedite5370.dtb\0"				\
+ "ubootfile=/home/user/u-boot.bin\0"				\
+ "fdtaddr=c00000\0"						\
+ "osaddr=0x1000000\0"						\
+ "loadaddr=0x1000000\0"						\
+ "prog_uboot1="CONFIG_PROG_UBOOT1"\0"				\

board/xes/xpedite5370/xpedite5370.c

Quoted 10 lines
board/xes/xpedite5370/xpedite5370.c new file +10 -0
+ "prog_uboot2="CONFIG_PROG_UBOOT2"\0"				\
+ "prog_os1="CONFIG_PROG_OS1"\0"					\
+ "prog_os2="CONFIG_PROG_OS2"\0"					\
+ "prog_fdt1="CONFIG_PROG_FDT1"\0"				\
+ "prog_fdt2="CONFIG_PROG_FDT2"\0"				\
+ "bootcmd_net=run set_bootargs; "CONFIG_BOOT_OS_NET"\0"		\
+ "bootcmd_flash1=run set_bootargs; bootm "CONFIG_OS1_FLASH_ADDR_STR" - "CONFIG_FDT1_FLASH_ADDR_STR"\0" \
+ "bootcmd_flash2=run set_bootargs; bootm "CONFIG_OS2_FLASH_ADDR_STR" - "CONFIG_FDT2_FLASH_ADDR_STR"\0" \
+ "bootcmd=run bootcmd_flash1\0"
+#endif	/* __CONFIG_H */

Alignment not by TAB, lines way too long.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Nothing ever becomes real until it is experienced.       - John Keats
#7 lore raw

PATCH 3/3 XPedite5370 board support

Quoted 47 lines · Wolfgang Denk

Dear Peter Tyser,

Quoted 4 lines · In message <[email protected]> you wrote:

Initial support for Extreme Engineering Solutions XPedite5370 - a MPC8572-based 3U VPX single board computer with a PMC/XMC site.

...

Quoted 5 lines
board/xes/common/fsl_85xx_ddr.c new file +0 -0
new file mode 100644
index 0000000..30b4767

...

Quoted 32 lines
board/xes/common/fsl_85xx_ddr.c new file +32 -0
+	puts(" (");
+
+#if (CONFIG_NUM_DDR_CONTROLLERS > 1)
+	/* Print interleaving information */
+	if (ddr1->cs0_config & 0x20000000) {
+		switch ((ddr1->cs0_config >> 24) & 0xf) {
+		case 0:
+			puts("cache line");
+			break;
+		case 1:
+			puts("page");
+			break;
+		case 2:
+			puts("bank");
+			break;
+		case 3:
+			puts("super-bank");
+			break;
+		default:
+			puts("invalid");
+			break;
+		}
+	} else {
+		puts("no");
+	}
+
+	puts(" interleaving");
+#endif
+
+#if (CONFIG_NUM_DDR_CONTROLLERS > 1) && defined(CONFIG_DDR_ECC)
+	puts(", ");
+#endif
Quoted 8 lines

board/xes/common/fsl_85xx_ddr.c line 91

Quoted 6 lines
board/xes/common/fsl_85xx_ddr.c new file +6 -0
+
+#if defined(CONFIG_DDR_ECC)
+	puts("ECC enabled");
+#endif
+
+	puts(")");

Please don't be too noisy. Turn this into debug() calls.

This information is very useful to a customer and doesn't add much as far as output. No newlines at least. The output also prints information which is configurable. I think giving the user feedback about how they have the board configured is useful.

We have the standard Freescale DDR printf's turned into debug as that is much, much more verbose than the output above.

Quoted 11 lines
Quoted 5 lines
board/xes/common/fsl_85xx_pci.c new file +0 -0
new file mode 100644
index 0000000..12437be

...

board/xes/common/fsl_85xx_pci.c line 105

Quoted 3 lines
board/xes/common/fsl_85xx_pci.c new file +3 -0
+	if (width && !(devdisr & MPC85xx_DEVDISR_PCIE)) {
+		printf("\n    PCIE1 connected as %s (x%d)",
+		       host ? "Root Complex" : "End Point", width);

Alignment not by TAB.

Ok.

Quoted 27 lines

board/xes/common/fsl_85xx_pci.c line 109

Quoted 4 lines
board/xes/common/fsl_85xx_pci.c new file +4 -0
+		if (pci->pme_msg_det) {
+			pci->pme_msg_det = 0xffffffff;
+			debug(" with errors.  Clearing.  Now 0x%08x",
+			      pci->pme_msg_det);

Alignment not by TAB.

board/xes/common/fsl_85xx_pci.c line 118

Quoted 9 lines
board/xes/common/fsl_85xx_pci.c new file +9 -0
+		}
+		printf("\n");
+
+		/* inbound */
+		pci_set_region(hose->regions + 0,
+			       CONFIG_SYS_PCI_MEMORY_BUS,
+			       CONFIG_SYS_PCI_MEMORY_PHYS,
+			       CONFIG_SYS_PCI_MEMORY_SIZE,
+			       PCI_REGION_MEM | PCI_REGION_MEMORY);

Alignment not by TAB.

And so on.

Quoted 5 lines
board/xes/xpedite5370/xpedite5370.c new file +0 -0
new file mode 100644
index 0000000..3526172

...

Quoted 5 lines

board/xes/xpedite5370/xpedite5370.c line 66

Quoted 3 lines
board/xes/xpedite5370/xpedite5370.c new file +3 -0
+	/* Print boot dev and swap flash flash chip selects if booted from 2nd
+	 * flash.  Swapping chip selects presents user with a common memory
+	 * map regardless of which flash was booted from. */

Multiline comment style.

Will fix.

Quoted 5 lines

board/xes/xpedite5370/xpedite5370.c line 69

Quoted 3 lines
board/xes/xpedite5370/xpedite5370.c new file +3 -0
+	flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
+			  CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS));
+	printf("FLASH: Executed from FLASH%d\n", flash_sel ? 2 : 1);

Please be less noisy! s/printf/debug/

This information is also very useful to a customer.

Quoted 19 lines
Quoted 19 lines

+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "autoload=yes\0" \
+ "download_cmd=tftp\0" \
+ "console_args=console=ttyS0,115200\0" \
+ "root_args=root=/dev/nfs rw\0" \
+ "misc_args=ip=on\0" \
+ "set_bootargs=setenv bootargs ${console_args} ${root_args} ${misc_args}\0" \
+ "bootfile=/home/user/file\0" \
+ "osfile=/home/user/uImage-XPedite5370\0" \
+ "fdtfile=/home/user/xpedite5370.dtb\0" \
+ "ubootfile=/home/user/u-boot.bin\0" \
+ "fdtaddr=c00000\0" \
+ "osaddr=0x1000000\0" \
+ "loadaddr=0x1000000\0" \
+ "prog_uboot1="CONFIG_PROG_UBOOT1"\0" \
+ "prog_uboot2="CONFIG_PROG_UBOOT2"\0" \
+ "prog_os1="CONFIG_PROG_OS1"\0" \
+ "prog_os2="CONFIG_PROG_OS2"\0" \
+ "prog_fdt1="CONFIG_PROG_FDT1"\0" \

Quoted 8 lines
Quoted 6 lines

+ "prog_fdt2="CONFIG_PROG_FDT2"\0" \
+ "bootcmd_net=run set_bootargs; "CONFIG_BOOT_OS_NET"\0" \
+ "bootcmd_flash1=run set_bootargs; bootm "CONFIG_OS1_FLASH_ADDR_STR" - "CONFIG_FDT1_FLASH_ADDR_STR"\0" \
+ "bootcmd_flash2=run set_bootargs; bootm "CONFIG_OS2_FLASH_ADDR_STR" - "CONFIG_FDT2_FLASH_ADDR_STR"\0" \
+ "bootcmd=run bootcmd_flash1\0"
+#endif /* __CONFIG_H */

Alignment not by TAB, lines way too long.

What are you referring to as far as "Alignment not by TAB"?

Everyone's config file breaks the 80 column rule, is this really necessary to change? I think splitting it up makes an already confusing define even more confusing.

Thanks,
Peter

#8 lore raw

PATCH 3/3 XPedite5370 board support

Dear Peter Tyser,

Quoted 5 lines · In message <[email protected]> you wrote:

This information is very useful to a customer and doesn't add much as far as output. No newlines at least. The output also prints information which is configurable. I think giving the user feedback about how they have the board configured is useful.

You really need this level of detail only for board bring up and debugging. After that, this is a constand and never changes, right? Si it is normally enough to print the RAM size (and eventually some speed characteristics).

Quoted 2 lines

We have the standard Freescale DDR printf's turned into debug as that is much, much more verbose than the output above.

Indeed :-(

Quoted 7 lines
Quoted 5 lines

board/xes/xpedite5370/xpedite5370.c line 69

Quoted 3 lines
board/xes/xpedite5370/xpedite5370.c new file +3 -0
+	flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
+			  CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS));
+	printf("FLASH: Executed from FLASH%d\n", flash_sel ? 2 : 1);

Please be less noisy! s/printf/debug/

This information is also very useful to a customer.

Is it, really? well...

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "autoload=yes\0" \

...

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines

+ "prog_fdt2="CONFIG_PROG_FDT2"\0" \
+ "bootcmd_net=run set_bootargs; "CONFIG_BOOT_OS_NET"\0" \
+ "bootcmd_flash1=run set_bootargs; bootm "CONFIG_OS1_FLASH_ADDR_STR" - "CONFIG_FDT1_FLASH_ADDR_STR"\0" \
+ "bootcmd_flash2=run set_bootargs; bootm "CONFIG_OS2_FLASH_ADDR_STR" - "CONFIG_FDT2_FLASH_ADDR_STR"\0" \
+ "bootcmd=run bootcmd_flash1\0"
+#endif /* __CONFIG_H */

Alignment not by TAB, lines way too long.

What are you referring to as far as "Alignment not by TAB"?

You indent the lines by a single space, but they should be indented by a TAB.

Quoted 3 lines

Everyone's config file breaks the 80 column rule, is this really necessary to change? I think splitting it up makes an already confusing define even more confusing.

At least the ';' is a good place to split. And you might check if it really makes sense to use variable names with 25 characters like "CONFIG_OS2_FLASH_ADDR_STR" (no, it doesn't).

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"In Christianity neither morality nor religion come into contact with
reality at any point."                          - Friedrich Nietzsche
#9 lore raw

PATCH 3/3 XPedite5370 board support

Quoted 9 lines · Wolfgang Denk

Dear Peter Tyser,

Quoted 5 lines · In message <[email protected]> you wrote:

This information is very useful to a customer and doesn't add much as far as output. No newlines at least. The output also prints information which is configurable. I think giving the user feedback about how they have the board configured is useful.

Quoted 4 lines

You really need this level of detail only for board bring up and debugging. After that, this is a constand and never changes, right? Si it is normally enough to print the RAM size (and eventually some speed characteristics).

User's can change the DDR configuration with the "memctl_intlv_ctl" and "ba_intlv_ctl". I don't imagine they'll fuss with those variable much, but they should certainly be aware if they do, or change one by accident, etc. Different board configs do/don't have ECC (same product, different build options), so I think the ECC info is also useful to a customer as they may have multiple boards with different configs.

Quoted 25 lines
Quoted 2 lines

We have the standard Freescale DDR printf's turned into debug as that is much, much more verbose than the output above.

Indeed :-(

Quoted 7 lines
Quoted 5 lines

board/xes/xpedite5370/xpedite5370.c line 69

Quoted 3 lines
board/xes/xpedite5370/xpedite5370.c new file +3 -0
+	flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
+			  CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS));
+	printf("FLASH: Executed from FLASH%d\n", flash_sel ? 2 : 1);

Please be less noisy! s/printf/debug/

This information is also very useful to a customer.

Is it, really? well...

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "autoload=yes\0" \

...

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

+ "prog_fdt2="CONFIG_PROG_FDT2"\0" \
+ "bootcmd_net=run set_bootargs; "CONFIG_BOOT_OS_NET"\0" \
+ "bootcmd_flash1=run set_bootargs; bootm "CONFIG_OS1_FLASH_ADDR_STR" - "CONFIG_FDT1_FLASH_ADDR_STR"\0" \
+ "bootcmd_flash2=run set_bootargs; bootm "CONFIG_OS2_FLASH_ADDR_STR" - "CONFIG_FDT2_FLASH_ADDR_STR"\0" \
+ "bootcmd=run bootcmd_flash1\0"
+#endif /* __CONFIG_H */

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Alignment not by TAB, lines way too long.

What are you referring to as far as "Alignment not by TAB"?

You indent the lines by a single space, but they should be indented by a TAB.

Many boards I look at don't use TABS. In particular Freescale reference platforms. Many boards even have different amounts of spaces:) I don't see the value of indentation in this case as it doesn't increase readability and just makes already long lines even longer.

Quoted 7 lines
Quoted 3 lines

Everyone's config file breaks the 80 column rule, is this really necessary to change? I think splitting it up makes an already confusing define even more confusing.

At least the ';' is a good place to split. And you might check if it really makes sense to use variable names with 25 characters like "CONFIG_OS2_FLASH_ADDR_STR" (no, it doesn't).

That define is no longer than the standard CONFIG_EXTRA_ENV_SETTINGS define that its used in, or any number of other standard defines. And they aren't used anywhere other than this 40 line section of code in 1 file. I thought the increase in clarity of long defines made up for their ugliness. I'll go ahead and split the lines on the ';' as you suggested.

You have the final say, so if any of the above are sticking points to getting the code accepted let me know and I'll change them as requested.

Thanks,
Peter

#10 lore raw

PATCH 3/3 XPedite5370 board support

Dear Peter Tyser,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines

You indent the lines by a single space, but they should be indented by a TAB.

Many boards I look at don't use TABS. In particular Freescale reference platforms. Many boards even have different amounts of spaces:) I don't

The fact that earlier submissions pased less strict revierws is nop excuse or reason to accept code that violated the Coding Style requirements.

On contrary - if you are aware of such Coding Style problems, then patches to fix these are highly appreciated.

Quoted 6 lines

That define is no longer than the standard CONFIG_EXTRA_ENV_SETTINGS define that its used in, or any number of other standard defines. And they aren't used anywhere other than this 40 line section of code in 1 file. I thought the increase in clarity of long defines made up for their ugliness. I'll go ahead and split the lines on the ';' as you suggested.

PLease re-read the Coding Style requirements, especially "Chapter 4:
Naming".

Quoted 2 lines

You have the final say, so if any of the above are sticking points to getting the code accepted let me know and I'll change them as requested.

I wouldn't have mentioned it here if I didn't care about it.

Thanks.

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A little suffering is good for the soul.
	-- Kirk, "The Corbomite Maneuver", stardate 1514.0
#11 lore raw

PATCH 3/3 XPedite5370 board support

In reply to Peter Tyser
Quoted 3 lines · Peter Tyser
Quoted 3 lines
Quoted 2 lines

We have the standard Freescale DDR printf's turned into debug as that is much, much more verbose than the output above.

Indeed :-(

Hrm. Out of curiosity, which printf()s do you find noisy?

Quoted 4 lines

Many boards I look at don't use TABS. In particular Freescale reference platforms. Many boards even have different amounts of spaces:) I don't see the value of indentation in this case as it doesn't increase readability and just makes already long lines even longer.

Really? Which ones? We should clean those up!

Thanks,
jdl

#12 lore raw

PATCH 3/3 XPedite5370 board support

Hi Jon,

Quoted 7 lines · Jon Loeliger
Quoted 3 lines · Peter Tyser
Quoted 3 lines
Quoted 2 lines

We have the standard Freescale DDR printf's turned into debug as that is much, much more verbose than the output above.

Indeed :-(

Hrm. Out of curiosity, which printf()s do you find noisy?

There are some printf()s related to chip/bank interleaving in cpu/mpc8xxx/main.c:

	printf("\nMemory controller interleaving enabled: ");
	printf("Cache-line interleaving!\n");
	printf("Bank(chip-select) interleaving enabled: ");
	printf("CS0+CS1 and CS2+CS3\n");

I do think the info is useful, just a bit wordy (and are the !'s necessary:). With those printfs in main.c enabled, there could be 4 printf lines on bootup related to DDR - clocking, size, and 2 for interleaving.

Quoted 6 lines
Quoted 4 lines

Many boards I look at don't use TABS. In particular Freescale reference platforms. Many boards even have different amounts of spaces:) I don't see the value of indentation in this case as it doesn't increase readability and just makes already long lines even longer.

Really? Which ones? We should clean those up!

The MPC8548CDS and MPC8349EMDS headers were the 2 I looked at that had inconsistent spacing, but I didn't look all that thoroughly. An 'ls include/configs/MPC* | xargs grep -i "^\ \+\""' should show the boards which don't use proper indentation for the environment variables in general.

So much cleanup, so little time:)

Best,
Peter

#13 lore raw

PATCH 2/3 Add support for Maxim's DS4510 I2C device

In reply to Peter Tyser

Dear Peter Tyser,

Quoted 7 lines · In message <[email protected]> you wrote:

Initial support for the DS4510, a CPU supervisor with integrated EEPROM, SRAM, and 4 programmable non-volatile GPIO pins. The CONFIG_DS4510 define enables support for the device while the CONFIG_CMD_DS4510 define enables the ds4510 command.

Quoted 8 lines
---
 README                |    2 +
 drivers/gpio/Makefile |    1 +
 drivers/gpio/ds4510.c |  344 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/gpio/ds4510.h |   75 +++++++++++
 4 files changed, 422 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/ds4510.c
 create mode 100644 include/gpio/ds4510.h

This should go to devices/i2c/

drivers/gpio/ds4510.c line 45

Quoted 2 lines
drivers/gpio/ds4510.c new file +2 -0
+		/* This delay isn't needed for SRAM writes but shouldn't delay
+		 * things too much, so do it unconditionally for simplicity */

Please fix multiline comment style.

Quoted 2 lines
drivers/gpio/ds4510.c new file +2 -0
+int do_ds4510(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{

...

drivers/gpio/ds4510.c line 256

Quoted 10 lines
drivers/gpio/ds4510.c new file +10 -0
+	case 4:
+		val = simple_strtoul(argv[3], NULL, 16);
+
+		if (strcmp(argv[2], "nv") == 0)
+			return ds4510_see_write(chip, val);
+		else if (strcmp(argv[2], "rstdelay") == 0)
+			return ds4510_rstdelay_write(chip, val);
+		else if (strcmp(argv[2], "input") == 0)
+			return (ds4510_gpio_read_val(chip) & (1 << val)) != 0;
+		break;

We have generic code for processing multiple command selections. Please use that.

Quoted 1 line
drivers/gpio/ds4510.c new file +1 -0
+	case 5:

...

drivers/gpio/ds4510.c line 271

Quoted 8 lines
drivers/gpio/ds4510.c new file +8 -0
+		if (strcmp(argv[2], "output") == 0) {
+			tmp = ds4510_gpio_read(chip);
+			if (val)
+				tmp |= (1 << pin);
+			else
+				tmp &= ~(1 << pin);
+			return ds4510_gpio_write(chip, tmp);
+		} else if (strcmp(argv[2], "pullup") == 0) {

Ditto.

Quoted 1 line
drivers/gpio/ds4510.c new file +1 -0
+	case 7:

...

Quoted 9 lines
drivers/gpio/ds4510.c new file +9 -0
+		if (strcmp(argv[3], "read") == 0)
+			rw_func = ds4510_mem_read;
+		else if (strcmp(argv[3], "write") == 0)
+			rw_func = ds4510_mem_write;
+		else
+			break;
+
+		if (strcmp(argv[2], "eeprom") == 0) {
+			end = DS4510_EEPROM + DS4510_EEPROM_SIZE;

drivers/gpio/ds4510.c line 303

Quoted 10 lines
drivers/gpio/ds4510.c new file +10 -0
+			off += DS4510_EEPROM;
+		} else if (strcmp(argv[2], "seeprom") == 0) {
+			end = DS4510_SEEPROM + DS4510_SEEPROM_SIZE;
+			off += DS4510_SEEPROM;
+		} else if (strcmp(argv[2], "sram") == 0) {
+			end = DS4510_SRAM + DS4510_SRAM_SIZE;
+			off += DS4510_SRAM;
+		} else {
+			break;
+		}

Ditto.

Quoted 14 lines
drivers/gpio/ds4510.c new file +14 -0
+U_BOOT_CMD(
+	ds4510,	7,	2,	do_ds4510,
+	"ds4510	- ds4510 eeprom/seeprom/sram/gpio access\n",
+	"chip info\n"
+	"	- display ds4510 info\n"
+	"ds4510 chip nv 0|1\n"
+	"	- make gpio and seeprom writes volatile/non-volatile\n"
+	"ds4510 chip rstdelay 0-3\n"
+	"	- set reset output delay\n"
+	"ds4510 chip output pin 0|1\n"
+	"	- set pin low or high-Z\n"
+	"ds4510 chip input pin\n"
+	"	- read value of pin\n"
+	"ds4510 chip pullup pin 0|1\n"

drivers/gpio/ds4510.c line 342

Quoted 10 lines
drivers/gpio/ds4510.c new file +10 -0
+	"	- disable/enable pullup on specified pin\n"
+	"ds4510 chip eeprom read addr off cnt\n"
+	"ds4510 chip eeprom write addr off cnt\n"
+	"	- read/write 'cnt' bytes at EEPROM offset 'off'\n"
+	"ds4510 chip seeprom read addr off cnt\n"
+	"ds4510 chip seeprom write addr off cnt\n"
+	"	- read/write 'cnt' bytes at SRAM-shadowed EEPROM offset 'off'\n"
+	"ds4510 chip sram read addr off cnt\n"
+	"ds4510 chip sram write addr off cnt\n"
+	"	- read/write 'cnt' bytes at SRAM offset 'off'\n"

Why do we need the "chip" argument? It just adds typing...

Best regards,

Wolfgang Denk

Signature · 8 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You speak of courage. Obviously you do not know the  difference  bet-
ween  courage and foolhardiness. Always it is the brave ones who die,
the soldiers.
	-- Kor, the Klingon Commander, "Errand of Mercy",
	   stardate 3201.7
#14 lore raw

PATCH 2/3 Add support for Maxim's DS4510 I2C device

Quoted 19 lines · Wolfgang Denk

Dear Peter Tyser,

Quoted 7 lines · In message <[email protected]> you wrote:

Initial support for the DS4510, a CPU supervisor with integrated EEPROM, SRAM, and 4 programmable non-volatile GPIO pins. The CONFIG_DS4510 define enables support for the device while the CONFIG_CMD_DS4510 define enables the ds4510 command.

Quoted 8 lines
---
 README                |    2 +
 drivers/gpio/Makefile |    1 +
 drivers/gpio/ds4510.c |  344 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/gpio/ds4510.h |   75 +++++++++++
 4 files changed, 422 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/ds4510.c
 create mode 100644 include/gpio/ds4510.h
Quoted 1 line

This should go to devices/i2c/

I'm assuming you're referring to drivers/i2c. I was under the impression the driver/i2c directory was only for drivers which controller I2C buses (similar to drivers/i2c/busses in Linux), not actual I2C chip device drivers. I don't currently see any other I2C chip drivers in there and didn't want to be the first to add one:)

I agree that the ds4510 doesn't fit in the GPIO category well. How about drivers/misc? If I'm mistaken about what is supposed to go in drivers/i2c let me know and I'll move it in there.

Quoted 4 lines

drivers/gpio/ds4510.c line 45

Quoted 2 lines
drivers/gpio/ds4510.c new file +2 -0
+		/* This delay isn't needed for SRAM writes but shouldn't delay
+		 * things too much, so do it unconditionally for simplicity */

Please fix multiline comment style.

Will do.

Quoted 4 lines
Quoted 3 lines
drivers/gpio/ds4510.c new file +2 -0
+int do_ds4510(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{

...

Quoted 13 lines

drivers/gpio/ds4510.c line 256

Quoted 10 lines
drivers/gpio/ds4510.c new file +10 -0
+	case 4:
+		val = simple_strtoul(argv[3], NULL, 16);
+
+		if (strcmp(argv[2], "nv") == 0)
+			return ds4510_see_write(chip, val);
+		else if (strcmp(argv[2], "rstdelay") == 0)
+			return ds4510_rstdelay_write(chip, val);
+		else if (strcmp(argv[2], "input") == 0)
+			return (ds4510_gpio_read_val(chip) & (1 << val)) != 0;
+		break;

We have generic code for processing multiple command selections. Please use that.

Will do.

Quoted 55 lines
Quoted 1 line
drivers/gpio/ds4510.c new file +1 -0
+	case 5:

...

drivers/gpio/ds4510.c line 271

Quoted 8 lines
drivers/gpio/ds4510.c new file +8 -0
+		if (strcmp(argv[2], "output") == 0) {
+			tmp = ds4510_gpio_read(chip);
+			if (val)
+				tmp |= (1 << pin);
+			else
+				tmp &= ~(1 << pin);
+			return ds4510_gpio_write(chip, tmp);
+		} else if (strcmp(argv[2], "pullup") == 0) {

Ditto.

Quoted 1 line
drivers/gpio/ds4510.c new file +1 -0
+	case 7:

...

Quoted 9 lines
drivers/gpio/ds4510.c new file +9 -0
+		if (strcmp(argv[3], "read") == 0)
+			rw_func = ds4510_mem_read;
+		else if (strcmp(argv[3], "write") == 0)
+			rw_func = ds4510_mem_write;
+		else
+			break;
+
+		if (strcmp(argv[2], "eeprom") == 0) {
+			end = DS4510_EEPROM + DS4510_EEPROM_SIZE;

drivers/gpio/ds4510.c line 303

Quoted 10 lines
drivers/gpio/ds4510.c new file +10 -0
+			off += DS4510_EEPROM;
+		} else if (strcmp(argv[2], "seeprom") == 0) {
+			end = DS4510_SEEPROM + DS4510_SEEPROM_SIZE;
+			off += DS4510_SEEPROM;
+		} else if (strcmp(argv[2], "sram") == 0) {
+			end = DS4510_SRAM + DS4510_SRAM_SIZE;
+			off += DS4510_SRAM;
+		} else {
+			break;
+		}

Ditto.

Quoted 18 lines
drivers/gpio/ds4510.c new file +18 -0
+U_BOOT_CMD(
+	ds4510,	7,	2,	do_ds4510,
+	"ds4510	- ds4510 eeprom/seeprom/sram/gpio access\n",
+	"chip info\n"
+	"	- display ds4510 info\n"
+	"ds4510 chip nv 0|1\n"
+	"	- make gpio and seeprom writes volatile/non-volatile\n"
+	"ds4510 chip rstdelay 0-3\n"
+	"	- set reset output delay\n"
+	"ds4510 chip output pin 0|1\n"
+	"	- set pin low or high-Z\n"
+	"ds4510 chip input pin\n"
+	"	- read value of pin\n"
+	"ds4510 chip pullup pin 0|1\n"
+	"	- disable/enable pullup on specified pin\n"
+	"ds4510 chip eeprom read addr off cnt\n"
+	"ds4510 chip eeprom write addr off cnt\n"
+	"	- read/write 'cnt' bytes at EEPROM offset 'off'\n"
Quoted 8 lines

drivers/gpio/ds4510.c line 342

Quoted 6 lines
drivers/gpio/ds4510.c new file +6 -0
+	"ds4510 chip seeprom read addr off cnt\n"
+	"ds4510 chip seeprom write addr off cnt\n"
+	"	- read/write 'cnt' bytes at SRAM-shadowed EEPROM offset 'off'\n"
+	"ds4510 chip sram read addr off cnt\n"
+	"ds4510 chip sram write addr off cnt\n"
+	"	- read/write 'cnt' bytes at SRAM offset 'off'\n"

Why do we need the "chip" argument? It just adds typing...

In theory more than 1 chip could be on a board. The chip uses an address pin pull up/down to determine the device's i2c address.

Thanks,
Peter

#15 lore raw

PATCH 2/3 Add support for Maxim's DS4510 I2C device

Dear Peter Tyser,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 5 lines
Quoted 3 lines
 create mode 100644 drivers/gpio/ds4510.c
 create mode 100644 include/gpio/ds4510.h

This should go to devices/i2c/

I'm assuming you're referring to drivers/i2c. I was under the

Right.

Quoted 4 lines

impression the driver/i2c directory was only for drivers which controller I2C buses (similar to drivers/i2c/busses in Linux), not actual I2C chip device drivers. I don't currently see any other I2C chip drivers in there and didn't want to be the first to add one:)

Ah yes, you are right again. Hm...

Quoted 3 lines

I agree that the ds4510 doesn't fit in the GPIO category well. How about drivers/misc? If I'm mistaken about what is supposed to go in drivers/i2c let me know and I'll move it in there.

I think drivers/misc/ is probably the best place we have at the moment, indeed.

Quoted 25 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpio/ds4510.c new file +16 -0
+	"ds4510	- ds4510 eeprom/seeprom/sram/gpio access\n",
+	"chip info\n"
+	"	- display ds4510 info\n"
+	"ds4510 chip nv 0|1\n"
+	"	- make gpio and seeprom writes volatile/non-volatile\n"
+	"ds4510 chip rstdelay 0-3\n"
+	"	- set reset output delay\n"
+	"ds4510 chip output pin 0|1\n"
+	"	- set pin low or high-Z\n"
+	"ds4510 chip input pin\n"
+	"	- read value of pin\n"
+	"ds4510 chip pullup pin 0|1\n"
+	"	- disable/enable pullup on specified pin\n"
+	"ds4510 chip eeprom read addr off cnt\n"
+	"ds4510 chip eeprom write addr off cnt\n"
+	"	- read/write 'cnt' bytes at EEPROM offset 'off'\n"
Quoted 8 lines

drivers/gpio/ds4510.c line 342

Quoted 6 lines
drivers/gpio/ds4510.c new file +6 -0
+	"ds4510 chip seeprom read addr off cnt\n"
+	"ds4510 chip seeprom write addr off cnt\n"
+	"	- read/write 'cnt' bytes at SRAM-shadowed EEPROM offset 'off'\n"
+	"ds4510 chip sram read addr off cnt\n"
+	"ds4510 chip sram write addr off cnt\n"
+	"	- read/write 'cnt' bytes at SRAM offset 'off'\n"

Why do we need the "chip" argument? It just adds typing...

Quoted 2 lines

In theory more than 1 chip could be on a board. The chip uses an address pin pull up/down to determine the device's i2c address.

We should follow the model used elsewhere, then, i. e. add a "ds4510 dev" command which can display and select a "current" device that then gets used in all commands unless you explicitely switch to a new device (or bus - please keep in mind that we can have multiple I2C busses as well).

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
EMACS belongs in <sys/errno.h>: Editor too big!
#16 lore raw

PATCH 1/3 Add support for PCA953x I2C gpio devices

In reply to Peter Tyser

Dear Peter Tyser,

Quoted 4 lines · In message <[email protected]> you wrote:

Initial support for NXP's 4 and 8 bit I2C gpio expanders (eg pca9537, pca9557, etc). The CONFIG_PCA953X define enables support for the devices while the CONFIG_CMD_PCA953X define enables the pca953x command.

I'm not sure if we need such a detailed level of access to these chips. We already have a couple of similar I/O expanders in some boards, for example implemente in some PICs. See for example the "pic read" / "pic write" conde in board/lwmon/lwmon.c etc.

I think we should generalize this - and more than read / write isn't really needed, or is it?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Virtue is a relative term.
	-- Spock, "Friday's Child", stardate 3499.1
#17 lore raw

PATCH 1/3 Add support for PCA953x I2C gpio devices

Hi Wolfgang,

Quoted 8 lines · Wolfgang Denk

Dear Peter Tyser,

Quoted 4 lines · In message <[email protected]> you wrote:

Initial support for NXP's 4 and 8 bit I2C gpio expanders (eg pca9537, pca9557, etc). The CONFIG_PCA953X define enables support for the devices while the CONFIG_CMD_PCA953X define enables the pca953x command.

Quoted 7 lines

I'm not sure if we need such a detailed level of access to these chips. We already have a couple of similar I/O expanders in some boards, for example implemente in some PICs. See for example the "pic read" / "pic write" conde in board/lwmon/lwmon.c etc.

I think we should generalize this - and more than read / write isn't really needed, or is it?

What do you mean by "we should generalize this"?

I view the read/write/invert commands as necessary to easily configure/read/write the GPIO pins, and the info command is nice, but not necessary.

The info command is nice to get an idea of what's going on at a high level - eg is the input on pin 2 being inverted? What pins are currently being driven low? etc. I've found the iopinfo command useful for the 82xx boards and tried to replicate similar functionality in this driver. I like the info command but understand if others want it removed.

Let me know if you'd like me to change it.

Thanks,
Peter

#18 lore raw

PATCH 1/3 Add support for PCA953x I2C gpio devices

Dear Peter Tyser,

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 8 lines

I'm not sure if we need such a detailed level of access to these chips. We already have a couple of similar I/O expanders in some boards, for example implemente in some PICs. See for example the "pic read" / "pic write" conde in board/lwmon/lwmon.c etc.

I think we should generalize this - and more than read / write isn't really needed, or is it?

What do you mean by "we should generalize this"?

Cre4ate a common version of the code that can be used in all of these boards.

Quoted 3 lines

I view the read/write/invert commands as necessary to easily configure/read/write the GPIO pins, and the info command is nice, but not necessary.

I never needed an invert command yet, but it probably doesn't hurt either, and so does info.

Quoted 6 lines

The info command is nice to get an idea of what's going on at a high level - eg is the input on pin 2 being inverted? What pins are currently being driven low? etc. I've found the iopinfo command useful for the 82xx boards and tried to replicate similar functionality in this driver. I like the info command but understand if others want it removed.

Don't remove it, but maybe make it a selectable option so those who like it can include it while others that are tryting to minimize the memory footprint don't suffer from it.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Bradley's Bromide: If computers get too  powerful,  we  can  organize
them into a committee - that will do them in.
#19 lore raw

cover Support for XPedite5370 and misc GPIO

In reply to Peter Tyser

Dear Peter Tyser,

Quoted 7 lines · In message <[email protected]> you wrote:

This patch series adds support for the XPedite5370 SBC. Its an MPC8572-based VPX card with a PMC/XMC site. The XPedite5370 includes a significant number of I2C GPIO devices (5) which are used for board configuration. I added support for 2 new I2C gpio devices in a new drivers/gpio directory. I'm not sure if this is the preferred location/method, so let me know

I think it would be better to add these to drivers/i2c instead.

Quoted 2 lines

if others have have different preferences. It'd be nice to have a more generic GPIO framework (like Linux's) at some point, but

Agreed, but U-Boot is a bootloader, and small is beatiful :-)

And this is not just a few GPIO pins, but I2C devices, right?

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The management question ... is not _whether_ to build a pilot  system
and  throw  it away. You _will_ do that. The only question is whether
to plan in advance to build a throwaway, or to promise to deliver the
throwaway to customers.       - Fred Brooks, "The Mythical Man Month"