Skip to contentSkip to conversation

Update for inka4x0 plus some new features

PATCH Superseded Detlev Zundel 5 participants 23 messages Mar 25, 2009 – Mar 27, 2009

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Update for inka4x0 plus some new features

This patchset contains updates for the ink4x0 platform. Namely it adds hardware diagnostic funtions and an RTC driver.

For a nice integration by using private command tables, do_help is extended to support this scenario also.

To successfully convert all the pointer access to accessor macros, a bunch of new defines is also needed for the 5200 cpu.

Changes from v1:

Addresses comments from ML. Specifically:
- Moved ns16650 defines to proper include file.
- Used structures from this header file to access UARTs - this nicely eliminates serial_{in,out}.
- Convert inka_diag.c pointer accesses to accessor macros.
- Move variable declarations to start of functions.

A diff of the "before" and "after" branches will be posted seperately for easier inspection.

Detlev Zundel (7):
command.c: Expose the core of do_help as _do_help to the rest of

    u-boot.

mpc5xxx: Add structure definition for several more register blocks. drivers/twserial: Add protocol driver for "three wire serial"
interface.
rtc: add support for 4543 RTC (manufactured by e.g. EPSON)
inka4x0: Add hardware diagnosis functions for inka4x0
inka4x0: Add hardware diagnosis and RTC in configuration.
inka4x0: Use proper accessor macros for memory mapped registers.

 Makefile                    |    3 +-
 board/inka4x0/Makefile      |    4 +-
 board/inka4x0/inka4x0.c     |  171 +++++++++-----
 board/inka4x0/inkadiag.c    |  514 +++++++++++++++++++++++++++++++++++++++++++
 common/command.c            |   20 +-
 drivers/rtc/Makefile        |    1 +
 drivers/rtc/rtc4543.c       |  118 ++++++++++
 drivers/twserial/Makefile   |   46 ++++
 drivers/twserial/soft_tws.c |  110 +++++++++
 include/command.h           |    4 +-
 include/configs/inka4x0.h   |   91 +++++++-
 include/mpc5xxx.h           |  124 +++++++++++
 include/ns16550.h           |   11 +
 include/rtc.h               |    4 +
 include/tws.h               |   47 ++++
 15 files changed, 1190 insertions(+), 78 deletions(-)
 create mode 100644 board/inka4x0/inkadiag.c
 create mode 100644 drivers/rtc/rtc4543.c
 create mode 100644 drivers/twserial/Makefile
 create mode 100644 drivers/twserial/soft_tws.c
 create mode 100644 include/tws.h
#1 lore raw

PATCH v2 1/7 command.c: Expose the core of do_help as _do_help to the rest of u-boot.

Other commands implementing subcommands can reuse this code nicely.

---
 common/command.c  |   20 +++++++++++++-------
 include/command.h |    4 +++-
 2 files changed, 16 insertions(+), 8 deletions(-)
common/command.c +13 -7
index 3b9ccc9..c9a3f5b 100644
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2000-2003
+ * (C) Copyright 2000-2009
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -233,20 +233,19 @@ U_BOOT_CMD(
  * Use puts() instead of printf() to avoid printf buffer overflow
  * for long help messages
  */
-int do_help (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+
+int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int
+	      flag, int argc, char *argv[])
 {
 	int i;
 	int rcode = 0;
 
 	if (argc == 1) {	/*show list of commands */
-
-		int cmd_items = &__u_boot_cmd_end -
-				&__u_boot_cmd_start;	/* pointer arith! */
 		cmd_tbl_t *cmd_array[cmd_items];
 		int i, j, swaps;
 
 		/* Make array of commands from .uboot_cmd section */
-		cmdtp = &__u_boot_cmd_start;
+		cmdtp = cmd_start;
 		for (i = 0; i < cmd_items; i++) {
 			cmd_array[i] = cmdtp++;
 		}
@@ -286,7 +285,7 @@ int do_help (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 	 * command help (long version)
 	 */
 	for (i = 1; i < argc; ++i) {
-		if ((cmdtp = find_cmd (argv[i])) != NULL) {
+		if ((cmdtp = find_cmd_tbl (argv[i], cmd_start, cmd_items )) != NULL) {
 #ifdef	CONFIG_SYS_LONGHELP
 			/* found - print (long) help info */
 			puts (cmdtp->name);
@@ -313,6 +312,13 @@ int do_help (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 	return rcode;
 }
 
+int do_help (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+{
+	return _do_help(&__u_boot_cmd_start,
+			&__u_boot_cmd_end - &__u_boot_cmd_start,
+			cmdtp, flag, argc, argv);
+}
+
 
 U_BOOT_CMD(
 	help,	CONFIG_SYS_MAXARGS,	1,	do_help,
include/command.h +3 -1
index d7321af..bd47853 100644
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2000
+ * (C) Copyright 2000-2009
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -66,6 +66,8 @@ extern cmd_tbl_t  __u_boot_cmd_end;
 
 
 /* common/command.c */
+int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int
+	      flag, int argc, char *argv[]);
 cmd_tbl_t *find_cmd(const char *cmd);
 cmd_tbl_t *find_cmd_tbl (const char *cmd, cmd_tbl_t *table, int table_len);
 
Signature · 1 line
1.6.0.6
#2 lore raw

PATCH v2 2/7 mpc5xxx: Add structure definition for several more register blocks.

---
 include/mpc5xxx.h |  124 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 124 insertions(+), 0 deletions(-)
include/mpc5xxx.h +124 -0
index 6138d45..463d5ae 100644
@@ -30,6 +30,8 @@
 #ifndef __ASMPPC_MPC5XXX_H
 #define __ASMPPC_MPC5XXX_H
 
+#include <asm/types.h>
+
 /* Processor name */
 #if defined(CONFIG_MPC5200)
 #define CPU_ID_STR	"MPC5200"
@@ -217,6 +219,12 @@
 #define MPC5XXX_GPIO_SIMPLE_PSC1_1   0x00000002UL
 #define MPC5XXX_GPIO_SIMPLE_PSC1_0   0x00000001UL
 
+#define MPC5XXX_GPIO_SINT_ETH_16     0x80
+#define MPC5XXX_GPIO_SINT_ETH_15     0x40
+#define MPC5XXX_GPIO_SINT_ETH_14     0x20
+#define MPC5XXX_GPIO_SINT_ETH_13     0x10
+#define MPC5XXX_GPIO_SINT_USB1_9     0x08
+#define MPC5XXX_GPIO_SINT_PSC3_8     0x04
 #define MPC5XXX_GPIO_SINT_PSC3_5     0x02
 #define MPC5XXX_GPIO_SINT_PSC3_4     0x01
 
@@ -454,6 +462,99 @@
 							   IORDY protocol */
 
 #ifndef __ASSEMBLY__
+/* Memory map registers */
+struct mpc5xxx_mmap_ctl {
+	volatile u32	mbar;
+	volatile u32	cs0_start;	/* 0x0004 */
+	volatile u32	cs0_stop;
+	volatile u32	cs1_start;	/* 0x000c */
+	volatile u32	cs1_stop;
+	volatile u32	cs2_start;	/* 0x0014 */
+	volatile u32	cs2_stop;
+	volatile u32	cs3_start;	/* 0x001c */
+	volatile u32	cs3_stop;
+	volatile u32	cs4_start;	/* 0x0024 */
+	volatile u32	cs4_stop;
+	volatile u32	cs5_start;	/* 0x002c */
+	volatile u32	cs5_stop;
+#if defined(CONFIG_MGT5100)
+	volatile u32	sdram_start;	/* 0x0034 */
+	volatile u32	sdram_stop;	/* 0x0038 */
+	volatile u32	pci1_start;	/* 0x003c */
+	volatile u32	pci1_stop;	/* 0x0040 */
+	volatile u32	pci2_start;	/* 0x0044 */
+	volatile u32	pci2_stop;	/* 0x0048 */
+#elif defined(CONFIG_MPC5200)
+	volatile u32	sdram0;		/* 0x0034 */
+	volatile u32	sdram1;		/* 0x0038 */
+	volatile u32	dummy1[4];	/* 0x003c */
+#endif
+	volatile u32	boot_start;	/* 0x004c */
+	volatile u32	boot_stop;
+#if defined(CONFIG_MGT5100)
+	volatile u32	addecr;		/* 0x0054 */
+#elif defined(CONFIG_MPC5200)
+	volatile u32	ipbi_ws_ctrl;	/* 0x0054 */
+#endif
+#if defined(CONFIG_MPC5200)
+	volatile u32	cs6_start;	/* 0x0058 */
+	volatile u32	cs6_stop;
+	volatile u32	cs7_start;	/* 0x0060 */
+	volatile u32	cs7_stop;
+#endif
+};
+
+/* Clock distribution module */
+struct mpc5xxx_cdm {
+	volatile u32	jtagid;		/* 0x0000 */
+	volatile u32	porcfg;
+	volatile u32	brdcrmb;	/* 0x0008 */
+	volatile u32	cfg;
+	volatile u32	fourtyeight_fdc;/* 0x0010 */
+	volatile u32	clock_enable;
+	volatile u32	system_osc;	/* 0x0018 */
+	volatile u32	ccscr;
+	volatile u32	sreset;		/* 0x0020 */
+	volatile u32	pll_status;
+	volatile u32	psc1_mccr;	/* 0x0028 */
+	volatile u32	psc2_mccr;
+	volatile u32	psc3_mccr;	/* 0x0030 */
+	volatile u32	psc6_mccr;
+};
+
+/* SDRAM controller */
+struct mpc5xxx_sdram {
+	volatile u32	mode;
+	volatile u32	ctrl;
+	volatile u32	config1;
+	volatile u32	config2;
+#if defined(CONFIG_MGT5100)
+	volatile u32	xlbsel;
+	volatile u32    dummy[31];
+#else
+	volatile u32	dummy[32];
+#endif
+	volatile u32	sdelay;
+};
+
+struct mpc5xxx_lpb {
+	volatile u32	cs0_cfg;
+	volatile u32	cs1_cfg;
+	volatile u32	cs2_cfg;
+	volatile u32	cs3_cfg;
+	volatile u32	cs4_cfg;
+	volatile u32	cs5_cfg;
+	volatile u32	cs_ctrl;
+	volatile u32	cs_status;
+#if defined(CONFIG_MPC5200)
+	volatile u32	cs6_cfg;
+	volatile u32	cs7_cfg;
+	volatile u32	cs_burst;
+	volatile u32	cs_deadcycle;
+#endif
+};
+
+
 struct mpc5xxx_psc {
 	volatile u8	mode;		/* PSC + 0x00 */
 	volatile u8	reserved0[3];
@@ -596,6 +697,29 @@ struct mpc5xxx_gpio {
 	volatile u8 reserved10;		/* GPIO + 0x3f */
 };
 
+struct mpc5xxx_wu_gpio {
+	volatile u8 enable;		/* WU_GPIO + 0x00 */
+	volatile u8 reserved1[3];	/* WU_GPIO + 0x01 */
+	volatile u8 ode;		/* WU_GPIO + 0x04 */
+	volatile u8 reserved2[3];	/* WU_GPIO + 0x05 */
+	volatile u8 ddr;		/* WU_GPIO + 0x08 */
+	volatile u8 reserved3[3];	/* WU_GPIO + 0x09 */
+	volatile u8 dvo;		/* WU_GPIO + 0x0c */
+	volatile u8 reserved4[3];	/* WU_GPIO + 0x0d */
+	volatile u8 inten;		/* WU_GPIO + 0x10 */
+	volatile u8 reserved5[3];	/* WU_GPIO + 0x11 */
+	volatile u8 iinten;		/* WU_GPIO + 0x14 */
+	volatile u8 reserved6[3];	/* WU_GPIO + 0x15 */
+	volatile u16 itype;		/* WU_GPIO + 0x18 */
+	volatile u8 reserved7[2];	/* WU_GPIO + 0x1a */
+	volatile u8 master_enable;	/* WU_GPIO + 0x1c */
+	volatile u8 reserved8[3];	/* WU_GPIO + 0x1d */
+	volatile u8 ival;		/* WU_GPIO + 0x20 */
+	volatile u8 reserved9[3];	/* WU_GPIO + 0x21 */
+	volatile u8 status;		/* WU_GPIO + 0x24 */
+	volatile u8 reserved10[3];	/* WU_GPIO + 0x25 */
+};
+
 struct mpc5xxx_sdma {
 	volatile u32 taskBar;		/* SDMA + 0x00 */
 	volatile u32 currentPointer;	/* SDMA + 0x04 */
Signature · 1 line
1.6.0.6
#3 lore raw

PATCH v2 3/7 drivers/twserial: Add protocol driver for "three wire serial" interface.

This pretty unintelligent interface is used on some RTC chips.

---
 Makefile                    |    3 +-
 drivers/twserial/Makefile   |   46 ++++++++++++++++++
 drivers/twserial/soft_tws.c |  110 +++++++++++++++++++++++++++++++++++++++++++
 include/tws.h               |   47 ++++++++++++++++++
 4 files changed, 205 insertions(+), 1 deletions(-)
 create mode 100644 drivers/twserial/Makefile
 create mode 100644 drivers/twserial/soft_tws.c
 create mode 100644 include/tws.h
Makefile +2 -1
index 63b9909..7c37845 100644
@@ -1,5 +1,5 @@
 #
-# (C) Copyright 2000-2008
+# (C) Copyright 2000-2009
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 #
 # See file CREDITS for list of people who contributed to this
@@ -262,6 +262,7 @@ TAG_SUBDIRS += cpu/mpc8xxx
 endif
 LIBS += drivers/rtc/librtc.a
 LIBS += drivers/serial/libserial.a
+LIBS += drivers/twserial/libtws.a
 LIBS += drivers/usb/libusb.a
 LIBS += drivers/video/libvideo.a
 LIBS += common/libcommon.a
drivers/twserial/Makefile new file +46 -0

46 lines not on this page · raw message

drivers/twserial/soft_tws.c new file +110 -0

110 lines not on this page · raw message

include/tws.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#4 lore raw

PATCH v2 4/7 rtc: add support for 4543 RTC (manufactured by e.g. EPSON)

---
 drivers/rtc/Makefile  |    1 +
 drivers/rtc/rtc4543.c |  118 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/rtc.h         |    4 ++
 3 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/rtc4543.c
drivers/rtc/Makefile +1 -0
index 94bc518..6adece2 100644
@@ -55,6 +55,7 @@ COBJS-$(CONFIG_RTC_MPC8xx) += mpc8xx.o
 COBJS-$(CONFIG_RTC_PCF8563) += pcf8563.o
 COBJS-$(CONFIG_RTC_PL031) += pl031.o
 COBJS-$(CONFIG_RTC_RS5C372A) += rs5c372.o
+COBJS-$(CONFIG_RTC_RTC4543) += rtc4543.o
 COBJS-$(CONFIG_RTC_RX8025) += rx8025.o
 COBJS-$(CONFIG_RTC_S3C24X0) += s3c24x0_rtc.o
 COBJS-$(CONFIG_RTC_X1205) += x1205.o
drivers/rtc/rtc4543.c new file +118 -0

118 lines not on this page · raw message

include/rtc.h +4 -0
index 785fbe3..019c2eb 100644
@@ -61,4 +61,8 @@ void to_tm (int, struct rtc_time *);
 unsigned long mktime (unsigned int, unsigned int, unsigned int,
 		      unsigned int, unsigned int, unsigned int);
 
+uchar rtc_read(uchar reg) __attribute__((weak));
+void  rtc_write(uchar reg, uchar val) __attribute__((weak));
+
+
 #endif	/* _RTC_H_ */
Signature · 1 line
1.6.0.6
#5 lore raw

PATCH v2 5/7 inka4x0: Add hardware diagnosis functions for inka4x0

This patch adds advanced diagnosis functions for the inka4x0 board.

---
 board/inka4x0/Makefile    |    4 +-
 board/inka4x0/inka4x0.c   |   20 ++-
 board/inka4x0/inkadiag.c  |  514 +++++++++++++++++++++++++++++++++++++++++++++
 include/configs/inka4x0.h |    1 +
 include/ns16550.h         |   11 +
 5 files changed, 546 insertions(+), 4 deletions(-)
 create mode 100644 board/inka4x0/inkadiag.c
board/inka4x0/Makefile +2 -2
index 442e2d0..82aa950 100644
@@ -1,5 +1,5 @@
 #
-# (C) Copyright 2003-2006
+# (C) Copyright 2003-2009
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 #
 # See file CREDITS for list of people who contributed to this
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	:= $(BOARD).o
+COBJS	:= $(BOARD).o inkadiag.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/inka4x0/inka4x0.c +18 -2
index 507196b..bb5c25d 100644
@@ -1,6 +1,9 @@
 /*
- * (C) Copyright 2003-2004
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ * (C) Copyright 2008-2009
+ * Andreas Pfefferle, DENX Software Engineering, ap at denx.de.
+ *
+ * (C) Copyright 2009
+ * Detlev Zundel, DENX Software Engineering, dzu at denx.de.
  *
  * (C) Copyright 2004
  * Mark Jonas, Freescale Semiconductor, mark.jonas at motorola.com.
@@ -8,6 +11,9 @@
  * (C) Copyright 2004
  * Martin Krause, TQ-Systems GmbH, martin.krause at tqs.de
  *
+ * (C) Copyright 2003-2004
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -171,6 +177,16 @@ void flash_preinit(void)
 	*(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
 }
 
+int misc_init_r (void) {
+	extern int inkadiag_init_r (void);
+
+	/*
+	 * The command table used for the subcommands of inkadiag
+	 * needs to be relocated manually.
+	 */
+	return inkadiag_init_r();
+}
+
 int misc_init_f (void)
 {
 	char tmp[10];
board/inka4x0/inkadiag.c new file +514 -0

514 lines not on this page · raw message

include/configs/inka4x0.h +1 -0
index e42fa6d..b80796d 100644
@@ -39,6 +39,7 @@
 #define BOOTFLAG_WARM		0x02	/* Software reboot			*/
 
 #define CONFIG_MISC_INIT_F	1	/* Use misc_init_f()			*/
+#define CONFIG_MISC_INIT_R	1	/* Use misc_init_r()			*/
 
 #define CONFIG_HIGH_BATS	1	/* High BATs supported			*/
 
include/ns16550.h +11 -0
index e6ade61..edfbc53 100644
@@ -123,6 +123,7 @@ typedef volatile struct NS16550 *NS16550_t;
 #define MCR_RTS         0x02
 #define MCR_DMA_EN      0x04
 #define MCR_TX_DFR      0x08
+#define MCR_LOOP	0x10		/* Enable loopback test mode */
 
 #define LCR_WLS_MSK	0x03		/* character length select mask */
 #define LCR_WLS_5	0x00		/* 5 bit character length */
@@ -135,6 +136,7 @@ typedef volatile struct NS16550 *NS16550_t;
 #define LCR_STKP	0x20		/* Stick Parity */
 #define LCR_SBRK	0x40		/* Set Break */
 #define LCR_BKSE	0x80		/* Bank select enable */
+#define LCR_DLAB	0x80		/* Divisor latch access bit */
 
 #define LSR_DR		0x01		/* Data ready */
 #define LSR_OE		0x02		/* Overrun */
@@ -145,6 +147,15 @@ typedef volatile struct NS16550 *NS16550_t;
 #define LSR_TEMT	0x40		/* Xmitter empty */
 #define LSR_ERR		0x80		/* Error */
 
+#define MSR_DCD		0x80		/* Data Carrier Detect */
+#define MSR_RI		0x40		/* Ring Indicator */
+#define MSR_DSR		0x20		/* Data Set Ready */
+#define MSR_CTS		0x10		/* Clear to Send */
+#define MSR_DDCD	0x08		/* Delta DCD */
+#define MSR_TERI	0x04		/* Trailing edge ring indicator */
+#define MSR_DDSR	0x02		/* Delta DSR */
+#define MSR_DCTS	0x01		/* Delta CTS */
+
 #ifdef CONFIG_OMAP1510
 #define OSC_12M_SEL	0x01		/* selects 6.5 * current clk div */
 #endif
Signature · 1 line
1.6.0.6
#6 lore raw

PATCH v2 6/7 inka4x0: Add hardware diagnosis and RTC in configuration.

This patch adds the board specific communication routines needed by the external 4543 RTC.

---
 board/inka4x0/inka4x0.c   |   20 ++++++++++
 include/configs/inka4x0.h |   90 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 105 insertions(+), 5 deletions(-)
board/inka4x0/inka4x0.c +20 -0
index bb5c25d..a8bc3b3 100644
@@ -33,6 +33,7 @@
  * MA 02111-1307 USA
  */
 
+#include <asm/io.h>
 #include <common.h>
 #include <mpc5xxx.h>
 #include <pci.h>
@@ -189,6 +190,8 @@ int misc_init_r (void) {
 
 int misc_init_f (void)
 {
+	struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
+	struct mpc5xxx_wu_gpio *wu_gpio = (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
 	char tmp[10];
 	int i, br;
 
@@ -236,6 +239,23 @@ int misc_init_f (void)
 	*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC3_9;
 	*(vu_long *) MPC5XXX_WU_GPIO_DIR    |= GPIO_PSC3_9;
 	*(vu_long *) MPC5XXX_WU_GPIO_DATA_O   |= GPIO_PSC3_9;
+
+	/*
+	 * Configure three wire serial interface to RTC (PSC1_4,
+	 * PSC2_4, PSC3_4, PSC3_5)
+	 */
+	setbits_8(&wu_gpio->enable,  MPC5XXX_GPIO_WKUP_PSC1_4 |
+				     MPC5XXX_GPIO_WKUP_PSC2_4);
+	setbits_8(&wu_gpio->ddr,     MPC5XXX_GPIO_WKUP_PSC1_4 |
+				     MPC5XXX_GPIO_WKUP_PSC2_4);
+	clrbits_8(&wu_gpio->dvo,     MPC5XXX_GPIO_WKUP_PSC1_4);
+	clrbits_8(&gpio->sint_inten, MPC5XXX_GPIO_SINT_PSC3_4 |
+				     MPC5XXX_GPIO_SINT_PSC3_5);
+	setbits_8(&gpio->sint_gpioe, MPC5XXX_GPIO_SINT_PSC3_4 |
+				     MPC5XXX_GPIO_SINT_PSC3_5);
+	setbits_8(&gpio->sint_ddr,   MPC5XXX_GPIO_SINT_PSC3_5);
+	clrbits_8(&gpio->sint_dvo,   MPC5XXX_GPIO_SINT_PSC3_5);
+
 	return 0;
 }
 
include/configs/inka4x0.h +85 -5

120 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#7 lore raw

PATCH v2 7/7 inka4x0: Use proper accessor macros for memory mapped registers.

---
 board/inka4x0/inka4x0.c |  139 +++++++++++++++++++++++++----------------------
 1 files changed, 75 insertions(+), 64 deletions(-)
board/inka4x0/inka4x0.c +75 -64
index a8bc3b3..7428b92 100644
@@ -55,41 +55,35 @@
 #ifndef CONFIG_SYS_RAMBOOT
 static void sdram_start (int hi_addr)
 {
+	volatile struct mpc5xxx_sdram *sdram =
+		(struct mpc5xxx_sdram *)MPC5XXX_SDRAM;
 	long hi_addr_bit = hi_addr ? 0x01000000 : 0;
 
 	/* unlock mode register */
-	*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | hi_addr_bit;
-	__asm__ volatile ("sync");
+	out_be32(&sdram->ctrl, SDRAM_CONTROL | 0x80000000 | hi_addr_bit);
 
 	/* precharge all banks */
-	*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit;
-	__asm__ volatile ("sync");
+	out_be32(&sdram->ctrl, SDRAM_CONTROL | 0x80000002 | hi_addr_bit);
 
 #if SDRAM_DDR
 	/* set mode register: extended mode */
-	*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE;
-	__asm__ volatile ("sync");
+	out_be32(&sdram->mode, SDRAM_EMODE);
 
 	/* set mode register: reset DLL */
-	*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000;
-	__asm__ volatile ("sync");
+	out_be32(&sdram->mode, SDRAM_MODE | 0x04000000);
 #endif
 
 	/* precharge all banks */
-	*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit;
-	__asm__ volatile ("sync");
+	out_be32(&sdram->ctrl, SDRAM_CONTROL | 0x80000002 | hi_addr_bit);
 
 	/* auto refresh */
-	*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | hi_addr_bit;
-	__asm__ volatile ("sync");
+	out_be32(&sdram->ctrl, SDRAM_CONTROL | 0x80000004 | hi_addr_bit);
 
 	/* set mode register */
-	*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
-	__asm__ volatile ("sync");
+	out_be32(&sdram->mode, SDRAM_MODE);
 
 	/* normal operation */
-	*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
-	__asm__ volatile ("sync");
+	out_be32(&sdram->ctrl, SDRAM_CONTROL | hi_addr_bit);
 }
 #endif
 
@@ -101,24 +95,27 @@ static void sdram_start (int hi_addr)
 
 phys_size_t initdram (int board_type)
 {
+	volatile struct mpc5xxx_mmap_ctl *mm =
+		(struct mpc5xxx_mmap_ctl *) CONFIG_SYS_MBAR;
+	volatile struct mpc5xxx_cdm     *cdm =
+		(struct mpc5xxx_cdm *)      MPC5XXX_CDM;
+	volatile struct mpc5xxx_sdram *sdram =
+		(struct mpc5xxx_sdram *)    MPC5XXX_SDRAM;
 	ulong dramsize = 0;
 #ifndef CONFIG_SYS_RAMBOOT
 	long test1, test2;
 
 	/* setup SDRAM chip selects */
-	*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001c; /* 512MB at 0x0 */
-	*(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x40000000; /* disabled */
-	__asm__ volatile ("sync");
+	out_be32(&mm->sdram0, 0x0000001c);	/* 512MB at 0x0 */
+	out_be32(&mm->sdram1, 0x40000000);	/* disabled */
 
 	/* setup config registers */
-	*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
-	*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
-	__asm__ volatile ("sync");
+	out_be32(&sdram->config1, SDRAM_CONFIG1);
+	out_be32(&sdram->config2, SDRAM_CONFIG2);
 
 #if SDRAM_DDR
 	/* set tap delay */
-	*(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY;
-	__asm__ volatile ("sync");
+	out_be32(&cdm->porcfg, SDRAM_TAPDELAY);
 #endif
 
 	/* find RAM size using SDRAM CS0 only */
@@ -140,17 +137,17 @@ phys_size_t initdram (int board_type)
 
 	/* set SDRAM CS0 size according to the amount of RAM found */
 	if (dramsize > 0) {
-		*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 +
-			__builtin_ffs(dramsize >> 20) - 1;
+		out_be32(&mm->sdram0, 0x13 +
+			 __builtin_ffs(dramsize >> 20) - 1);
 	} else {
-		*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
+		out_be32(&mm->sdram0, 0); /* disabled */
 	}
 
-	*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
+	out_be32(&mm->sdram1, dramsize); /* disabled */
 #else /* CONFIG_SYS_RAMBOOT */
 
 	/* retrieve size of memory connected to SDRAM CS0 */
-	dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
+	dramsize = in_be32(&mm->sdram0) & 0xFF;
 	if (dramsize >= 0x13) {
 		dramsize = (1 << (dramsize - 0x13)) << 20;
 	} else {
@@ -169,13 +166,15 @@ int checkboard (void)
 
 void flash_preinit(void)
 {
+	volatile struct mpc5xxx_lpb *lpb = (struct mpc5xxx_lpb *)MPC5XXX_LPB;
+
 	/*
 	 * Now, when we are in RAM, enable flash write
 	 * access for detection process.
-	 * Note that CS_BOOT cannot be cleared when
+	 * Note that CS_BOOT (CS0) cannot be cleared when
 	 * executing in flash.
 	 */
-	*(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
+	clrbits_be32(&lpb->cs0_cfg, 0x1); /* clear RO */
 }
 
 int misc_init_r (void) {
@@ -190,8 +189,11 @@ int misc_init_r (void) {
 
 int misc_init_f (void)
 {
-	struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
-	struct mpc5xxx_wu_gpio *wu_gpio = (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
+	volatile struct mpc5xxx_gpio	*gpio    =
+		(struct mpc5xxx_gpio *)   MPC5XXX_GPIO;
+	volatile struct mpc5xxx_wu_gpio	*wu_gpio =
+		(struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
+	volatile struct mpc5xxx_gpt	*gpt;
 	char tmp[10];
 	int i, br;
 
@@ -205,40 +207,43 @@ int misc_init_f (void)
 	/* Initialize GPIO output pins.
 	 */
 	/* Configure GPT as GPIO output (and set them as they control low-active LEDs */
-	*(vu_long *)MPC5XXX_GPT0_ENABLE =
-	*(vu_long *)MPC5XXX_GPT1_ENABLE =
-	*(vu_long *)MPC5XXX_GPT2_ENABLE =
-	*(vu_long *)MPC5XXX_GPT3_ENABLE =
-	*(vu_long *)MPC5XXX_GPT4_ENABLE =
-	*(vu_long *)MPC5XXX_GPT5_ENABLE = 0x34;
+	for (i = 0; i <= 5; i++) {
+		gpt = (struct mpc5xxx_gpt *)(MPC5XXX_GPT + (i * 0x10));
+		out_be32(&gpt->emsr, 0x34);
+	}
 
 	/* Configure GPT7 as PWM timer, 1kHz, no ints. */
-	*(vu_long *)MPC5XXX_GPT7_ENABLE = 0;/* Disable */
-	*(vu_long *)MPC5XXX_GPT7_COUNTER = 0x020000fe;
-	*(vu_long *)MPC5XXX_GPT7_PWMCFG = (br << 16);
-	*(vu_long *)MPC5XXX_GPT7_ENABLE = 0x3;/* Enable PWM mode and start */
+	gpt = (struct mpc5xxx_gpt *)(MPC5XXX_GPT + (7 * 0x10));
+	out_be32(&gpt->emsr,  0);		/* Disable */
+	out_be32(&gpt->cir,   0x020000fe);
+	out_be32(&gpt->pwmcr, (br << 16));
+	out_be32(&gpt->emsr,  0x3);		/* Enable PWM mode and start */
 
 	/* Configure PSC3_6,7 as GPIO output */
-	*(vu_long *)MPC5XXX_GPIO_ENABLE |= 0x00003000;
-	*(vu_long *)MPC5XXX_GPIO_DIR |= 0x00003000;
-
-	/* Configure PSC3_8 as GPIO output, no interrupt */
-	*(vu_long *)MPC5XXX_GPIO_SI_ENABLE |= 0x04000000;
-	*(vu_long *)MPC5XXX_GPIO_SI_DIR |= 0x04000000;
-	*(vu_long *)MPC5XXX_GPIO_SI_IEN &= ~0x04000000;
+	setbits_be32(&gpio->simple_gpioe, MPC5XXX_GPIO_SIMPLE_PSC3_6 |
+					  MPC5XXX_GPIO_SIMPLE_PSC3_7);
+	setbits_be32(&gpio->simple_ddr,   MPC5XXX_GPIO_SIMPLE_PSC3_6 |
+					  MPC5XXX_GPIO_SIMPLE_PSC3_7);
 
 	/* Configure PSC3_9 and GPIO_WKUP6,7 as GPIO output */
-	*(vu_long *)MPC5XXX_WU_GPIO_ENABLE |= 0xc4000000;
-	*(vu_long *)MPC5XXX_WU_GPIO_DIR |= 0xc4000000;
+	setbits_8(&wu_gpio->enable,  MPC5XXX_GPIO_WKUP_6 |
+				     MPC5XXX_GPIO_WKUP_7 |
+				     MPC5XXX_GPIO_WKUP_PSC3_9);
+	setbits_8(&wu_gpio->ddr,     MPC5XXX_GPIO_WKUP_6 |
+				     MPC5XXX_GPIO_WKUP_7 |
+				     MPC5XXX_GPIO_WKUP_PSC3_9);
 
 	/* Set LR mirror bit because it is low-active */
-	*(vu_long *) MPC5XXX_WU_GPIO_DATA_O    |= GPIO_WKUP_7;
-	/*
-	 * Reset Coral-P graphics controller
-	 */
-	*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC3_9;
-	*(vu_long *) MPC5XXX_WU_GPIO_DIR    |= GPIO_PSC3_9;
-	*(vu_long *) MPC5XXX_WU_GPIO_DATA_O   |= GPIO_PSC3_9;
+	setbits_8(&wu_gpio->dvo,     MPC5XXX_GPIO_WKUP_7);
+
+	/* Reset Coral-P graphics controller */
+	setbits_8(&wu_gpio->dvo,     MPC5XXX_GPIO_WKUP_PSC3_9);
+
+	/* Enable display backlight */
+	clrbits_8(&gpio->sint_inten, MPC5XXX_GPIO_SINT_PSC3_8);
+	setbits_8(&gpio->sint_gpioe, MPC5XXX_GPIO_SINT_PSC3_8);
+	setbits_8(&gpio->sint_ddr,   MPC5XXX_GPIO_SINT_PSC3_8);
+	setbits_8(&gpio->sint_dvo,   MPC5XXX_GPIO_SINT_PSC3_8);
 
 	/*
 	 * Configure three wire serial interface to RTC (PSC1_4,
@@ -274,25 +279,31 @@ void pci_init_board(void)
 
 void init_ide_reset (void)
 {
+	volatile struct mpc5xxx_wu_gpio	*wu_gpio =
+		(struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
+
 	debug ("init_ide_reset\n");
 
 	/* Configure PSC1_4 as GPIO output for ATA reset */
-	*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
-	*(vu_long *) MPC5XXX_WU_GPIO_DIR    |= GPIO_PSC1_4;
+	setbits_8(&wu_gpio->enable, MPC5XXX_GPIO_WKUP_PSC1_4);
+	setbits_8(&wu_gpio->ddr,    MPC5XXX_GPIO_WKUP_PSC1_4);
 	/* Deassert reset */
-	*(vu_long *) MPC5XXX_WU_GPIO_DATA_O   |= GPIO_PSC1_4;
+	setbits_8(&wu_gpio->dvo,    MPC5XXX_GPIO_WKUP_PSC1_4);
 }
 
 void ide_set_reset (int idereset)
 {
+	volatile struct mpc5xxx_wu_gpio	*wu_gpio =
+		(struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
+
 	debug ("ide_reset(%d)\n", idereset);
 
 	if (idereset) {
-		*(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4;
+		clrbits_8(&wu_gpio->dvo, MPC5XXX_GPIO_WKUP_PSC1_4);
 		/* Make a delay. MPC5200 spec says 25 usec min */
 		udelay(500000);
 	} else {
-		*(vu_long *) MPC5XXX_WU_GPIO_DATA_O |=  GPIO_PSC1_4;
+		setbits_8(&wu_gpio->dvo, MPC5XXX_GPIO_WKUP_PSC1_4);
 	}
 }
 #endif
Signature · 1 line
1.6.0.6
#15 lore raw

PATCH v2 3/7 drivers/twserial: Add protocol driver for "three wire serial" interface.

In reply to Detlev Zundel

Dear Detlev Zundel,

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

This pretty unintelligent interface is used on some RTC chips.

...

Quoted 6 lines
include/tws.h new file +0 -0
new file mode 100644
index 0000000..bfa8d58
@@ -0,0 +1,47 @@

...

include/tws.h line 35

Quoted 11 lines
include/tws.h new file +11 -0
+#ifndef _TWS_H_
+#define _TWS_H_
+
+#ifndef TWS_SOFT_DECLARATIONS
+# if defined(CONFIG_MPC5xxx)
+#  define TWS_SOFT_DECLARATIONS \
+ volatile ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, I2C_PORT);
+# else
+#  define TWS_SOFT_DECLARATIONS
+# endif
+#endif

Indentation not by TAB.

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
The typical page layout program is nothing more  than  an  electronic
light table for cutting and pasting documents.
#16 lore raw

PATCH v2 3/7 drivers/twserial: Add protocol driver for "three wire serial" interface.

Hi Wolfgang,

Quoted 14 lines

Dear Detlev Zundel,

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

This pretty unintelligent interface is used on some RTC chips.

...

Quoted 6 lines
include/tws.h new file +0 -0
new file mode 100644
index 0000000..bfa8d58
@@ -0,0 +1,47 @@

...

Quoted 13 lines

include/tws.h line 35

Quoted 11 lines
include/tws.h new file +11 -0
+#ifndef _TWS_H_
+#define _TWS_H_
+
+#ifndef TWS_SOFT_DECLARATIONS
+# if defined(CONFIG_MPC5xxx)
+#  define TWS_SOFT_DECLARATIONS \
+ volatile ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, I2C_PORT);
+# else
+#  define TWS_SOFT_DECLARATIONS
+# endif
+#endif

Indentation not by TAB.

Yes, intentionally so. Indenting by TAB exceeds the available line length. Judging by this single line I felt non-breaking the line was more important.

Can you please point me to the section in the CodingStyle regarding indentation for macros? I'd be much obliged.

Thanks
Detlev

Signature · 8 lines
"It's amazing I won. I was running against peace, prosperity, and
incumbency."
  --  George H.W. Bush, 06/14/2001, talking to Swedish prime
      minister Goran Perrson, unaware that a live tv camera was still on
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#17 lore raw

PATCH v2 3/7 drivers/twserial: Add protocol driver for "three wire serial" interface.

Hi Wolfgang,

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

This pretty unintelligent interface is used on some RTC chips.

...

Quoted 6 lines
include/tws.h new file +0 -0
new file mode 100644
index 0000000..bfa8d58
@@ -0,0 +1,47 @@

...

Quoted 13 lines

include/tws.h line 35

Quoted 11 lines
include/tws.h new file +11 -0
+#ifndef _TWS_H_
+#define _TWS_H_
+
+#ifndef TWS_SOFT_DECLARATIONS
+# if defined(CONFIG_MPC5xxx)
+#  define TWS_SOFT_DECLARATIONS \
+ volatile ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, I2C_PORT);
+# else
+#  define TWS_SOFT_DECLARATIONS
+# endif
+#endif

Indentation not by TAB.

Quoted 6 lines

Yes, intentionally so. Indenting by TAB exceeds the available line length. Judging by this single line I felt non-breaking the line was more important.

Can you please point me to the section in the CodingStyle regarding indentation for macros? I'd be much obliged.

The point is moot. Pondering over this piece of code it suddenly occured to me that the best solution is simply to remove it entirely ;)

This really is a leftover from an in-between broken implementation of the interface, so the removal in this case bears no consequences.

If no further feedback on the patch series arrive, I'll repost the whole stack tomorrow again.

Thanks again
Detlev

Signature · 7 lines
If you currently have a 32-bit UNIX system, you are advised to
trade it in for a 64-bit one sometime before the year 2106.
 -- Andrew S. Tanenbaum: Modern Operating Systems, 2nd Edition
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#19 lore raw

PATCH v2 3/7 drivers/twserial: Add protocol driver for "three wire serial" interface.

In reply to Detlev Zundel

Hi Detlev,

Quoted 5 lines · Detlev Zundel
drivers/twserial/soft_tws.c new file +0 -0
new file mode 100644
index 0000000..f63fc3f

<snip>

drivers/twserial/soft_tws.c line 80

Quoted 8 lines
drivers/twserial/soft_tws.c new file +8 -0
+/*-----------------------------------------------------------------------
+ * Write bits
+ */
+int tws_write(uchar *buffer, int len)
+{
+	int rem = len;
+	uchar accu, shift;
+	debug("tws_write: buffer %p len %d\n", buffer, len);

please, add blank line here.

Best regards,
Anatolij

#20 lore raw

PATCH v2 3/7 drivers/twserial: Add protocol driver for "three wire serial" interface.

Hi Anatolij,

Quoted 12 lines

Hi Detlev,

Quoted 5 lines · Detlev Zundel
drivers/twserial/soft_tws.c new file +0 -0
new file mode 100644
index 0000000..f63fc3f

<snip>

Quoted 10 lines

drivers/twserial/soft_tws.c line 80

Quoted 8 lines
drivers/twserial/soft_tws.c new file +8 -0
+/*-----------------------------------------------------------------------
+ * Write bits
+ */
+int tws_write(uchar *buffer, int len)
+{
+	int rem = len;
+	uchar accu, shift;
+	debug("tws_write: buffer %p len %d\n", buffer, len);

please, add blank line here.

Fixed, thanks.

Cheers
Detlev

Signature · 7 lines
The belief in a supernatural source of evil is not necessary;
men alone are quite capable of every wickedness.
                                           --  Joseph Conrad
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#8 lore raw

PATCH v2 4/7 rtc: add support for 4543 RTC (manufactured by e.g. EPSON)

In reply to Detlev Zundel

Hi Detlev,

some more small style issues, see comments below.

Quoted 6 lines · Detlev Zundel
drivers/rtc/rtc4543.c new file +0 -0
new file mode 100644
index 0000000..242d9bc
@@ -0,0 +1,118 @@

...

Quoted 3 lines

+ * 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

----------------------------------------------------------^ please, remove space here.

<snip>

Quoted 3 lines

+/*
+ * Note: The acrobatics below is due to the hideously ingenius idea of
+ * the chip designers. As the chip does not allow register

-------------------------^
please, remove space here.

Quoted 1 line

+ * addressing, all values need to be read and written in one go. Sure

-------------------------------------------------------------------^ please, remove space here.

<snip>

Quoted 4 lines
drivers/rtc/rtc4543.c new file +4 -0
+int rtc_get(struct rtc_time *tm)
+{
+	int rel = 0;
+	uchar buffer[7];

drivers/rtc/rtc4543.c line 55

Quoted 10 lines
drivers/rtc/rtc4543.c new file +10 -0
+
+	memset(buffer, 0, 7);
+
+	/* Read 52 bits into our buffer */
+	tws_read(buffer, 52);
+
+	tm->tm_sec  = BCD2BIN( buffer[0] & 0x7F);
+	tm->tm_min  = BCD2BIN( buffer[1] & 0x7F);
+	tm->tm_hour = BCD2BIN( buffer[2] & 0x3F);
+	tm->tm_wday = BCD2BIN( buffer[3] & 0x07);

------------------------------^
please, remove space here.

drivers/rtc/rtc4543.c line 58

Quoted 3 lines
drivers/rtc/rtc4543.c new file +3 -0
+	tm->tm_mday = BCD2BIN((buffer[3] & 0xF0) >> 4 | (buffer[4] & 0x0F) << 4);
+	tm->tm_mon  = BCD2BIN((buffer[4] & 0x30) >> 4 | (buffer[5] & 0x0F) << 4);
+	tm->tm_year = BCD2BIN((buffer[5] & 0xF0) >> 4 | (buffer[6] & 0x0F) << 4) + 2000;

these tree lines above are too long.

...

include/rtc.h void to_tm (int, struct rtc_time *); · line 67

Quoted 12 lines
include/rtc.h +4 -0
index 785fbe3..019c2eb 100644
@@ -61,4 +61,8 @@ void to_tm (int, struct rtc_time *);
 unsigned long mktime (unsigned int, unsigned int, unsigned int,
 		      unsigned int, unsigned int, unsigned int);
 
+uchar rtc_read(uchar reg) __attribute__((weak));
+void  rtc_write(uchar reg, uchar val) __attribute__((weak));
+
+

remove one blank line here, please.

Best regards,
Anatolij

#9 lore raw

PATCH v2 4/7 rtc: add support for 4543 RTC (manufactured by e.g. EPSON)

Dear Anatolij,

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

+ * 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

----------------------------------------------------------^ please, remove space here.

<snip>

Quoted 3 lines

+/*
+ * Note: The acrobatics below is due to the hideously ingenius idea of
+ * the chip designers. As the chip does not allow register

Quoted 6 lines

-------------------------^
please, remove space here.

Quoted 1 line

+ * addressing, all values need to be read and written in one go. Sure

-------------------------------------------------------------------^ please, remove space here.

Nope. These are actually intentional. Good type setting systems add wider horizontal space after a full stop than between words. The double space after a full stop is the ASSCII representation of this.

It may be a matter of taste, and since many editors don't support this (at least not out of the box), so it is not a required style element, but in any case there is no reason to remove this.

Best regards,

Wolfgang Denk

Signature · 6 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
Lispers are among  the  best  grads  of  the  Sweep-It-Under-Someone-
Else's-Carpet  School of Simulated Simplicity. [Was that sufficiently
incendiary? :-)]  - Larry Wall in <[email protected]
#10 lore raw

PATCH v2 4/7 rtc: add support for 4543 RTC (manufactured by e.g. EPSON)

In reply to Anatolij Gustschin

Hi Anatolij,

Quoted 11 lines

some more small style issues, see comments below.

Quoted 6 lines · Detlev Zundel
drivers/rtc/rtc4543.c new file +0 -0
new file mode 100644
index 0000000..242d9bc
@@ -0,0 +1,118 @@

...

Quoted 5 lines
Quoted 3 lines

+ * 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

----------------------------------------------------------^ please, remove space here.

Wow, you want me to change the default GPL boiler plate? You've got guts ;)

Quoted 10 lines

<snip>

Quoted 3 lines

+/*
+ * Note: The acrobatics below is due to the hideously ingenius idea of
+ * the chip designers. As the chip does not allow register

-------------------------^
please, remove space here.

Quoted 1 line

+ * addressing, all values need to be read and written in one go. Sure

-------------------------------------------------------------------^ please, remove space here.

As said by Wolfgang, you may infer that I use Emacs as my preferred text editor, which knows about the double space. Citing from the info file:

The sentence commands assume that you follow the American typist's
convention of putting two spaces at the end of a sentence; they consider a sentence to end wherever there is a .', ?' or !' followed by the end of a line or two spaces, with any number of )', ]', '', or `"' characters allowed in between. A sentence also begins or ends wherever a paragraph begins or ends. It is useful to follow this convention, because it makes a distinction between periods that end a sentence and periods that indicate abbreviations; that enables the Emacs sentence commands to distinguish, too. These commands do not stop for periods that indicate abbreviations.

So I really ask you to reconsider your critique.

Quoted 8 lines
Quoted 8 lines
drivers/rtc/rtc4543.c new file +8 -0
+int rtc_get(struct rtc_time *tm)
+{
+	int rel = 0;
+	uchar buffer[7];
+
+	memset(buffer, 0, 7);
+
+	/* Read 52 bits into our buffer */
Quoted 8 lines

drivers/rtc/rtc4543.c line 55

Quoted 6 lines
drivers/rtc/rtc4543.c new file +6 -0
+	tws_read(buffer, 52);
+
+	tm->tm_sec  = BCD2BIN( buffer[0] & 0x7F);
+	tm->tm_min  = BCD2BIN( buffer[1] & 0x7F);
+	tm->tm_hour = BCD2BIN( buffer[2] & 0x3F);
+	tm->tm_wday = BCD2BIN( buffer[3] & 0x07);

------------------------------^
please, remove space here.

Are you sure? You may notice that the spaces are intentional and *actually improve* the readability.

Quoted 5 lines

drivers/rtc/rtc4543.c line 58

Quoted 3 lines
drivers/rtc/rtc4543.c new file +3 -0
+	tm->tm_mday = BCD2BIN((buffer[3] & 0xF0) >> 4 | (buffer[4] & 0x0F) << 4);
+	tm->tm_mon  = BCD2BIN((buffer[4] & 0x30) >> 4 | (buffer[5] & 0x0F) << 4);
+	tm->tm_year = BCD2BIN((buffer[5] & 0xF0) >> 4 | (buffer[6] & 0x0F) << 4) + 2000;

these tree lines above are too long.

Oh well. I really checked CodingStyle in the Linux kernel and it has this to say:

The only exception to this is where exceeding 80 columns significantly increases readability and does not hide information.

So please reconsider your critique with this sentence in mind. What do you think?

Quoted 9 lines

...

Quoted 8 lines
include/rtc.h +0 -0
index 785fbe3..019c2eb 100644
@@ -61,4 +61,8 @@ void to_tm (int, struct rtc_time *);
 unsigned long mktime (unsigned int, unsigned int, unsigned int,
 		      unsigned int, unsigned int, unsigned int);
 
Quoted 6 lines

include/rtc.h void to_tm (int, struct rtc_time *); · line 67

Quoted 4 lines
include/rtc.h +4 -0
+uchar rtc_read(uchar reg) __attribute__((weak));
+void  rtc_write(uchar reg, uchar val) __attribute__((weak));
+
+

remove one blank line here, please.

Ok, I don't have a problem with that. I will not fix however, because I actually realize that this is another leftover of the previous implementation which did not use the tws protocol driver, so I remove the lines entirely.

Cheers
Detlev

Signature · 7 lines
Those who would give up essential liberty to purchase a little
temporary safety, deserve neither liberty nor safety.
                                     -- Benjamin Franklin
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#11 lore raw

PATCH v2 4/7 rtc: add support for 4543 RTC (manufactured by e.g. EPSON)

Quoted 8 lines · Detlev Zundel
Quoted 5 lines
Quoted 3 lines

+ * 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

----------------------------------------------------------^ please, remove space here.

Wow, you want me to change the default GPL boiler plate? You've got guts ;)

I checked some other files before suggesting to fix, and accidentally caught the files with one space character here. Now running

[ag at wker u-boot]$ fgrep -r "PURPOSE. See" * | wc -l 151
[ag at wker u-boot]$ fgrep -r "PURPOSE. See" * | wc -l 3530

shows, that these are outnumbered. So, forget it. Sorry for the noise.

Quoted 25 lines
Quoted 10 lines

<snip>

Quoted 3 lines

+/*
+ * Note: The acrobatics below is due to the hideously ingenius idea of
+ * the chip designers. As the chip does not allow register

-------------------------^
please, remove space here.

Quoted 1 line

+ * addressing, all values need to be read and written in one go. Sure

-------------------------------------------------------------------^ please, remove space here.

As said by Wolfgang, you may infer that I use Emacs as my preferred text editor, which knows about the double space. Citing from the info file:

The sentence commands assume that you follow the American typist's
convention of putting two spaces at the end of a sentence; they consider a sentence to end wherever there is a .', ?' or !' followed by the end of a line or two spaces, with any number of )', ]', '', or `"' characters allowed in between. A sentence also begins or ends wherever a paragraph begins or ends. It is useful to follow this convention, because it makes a distinction between periods that end a sentence and periods that indicate abbreviations; that enables the Emacs sentence commands to distinguish, too. These commands do not stop for periods that indicate abbreviations.

Quoted 1 line

So I really ask you to reconsider your critique.

Ok, your and Wolfgang's arguments show me, that being consistent with something is often brain-damaged. Sorry for the noise.

Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
drivers/rtc/rtc4543.c new file +8 -0
+int rtc_get(struct rtc_time *tm)
+{
+	int rel = 0;
+	uchar buffer[7];
+
+	memset(buffer, 0, 7);
+
+	/* Read 52 bits into our buffer */
Quoted 8 lines

drivers/rtc/rtc4543.c line 55

Quoted 6 lines
drivers/rtc/rtc4543.c new file +6 -0
+	tws_read(buffer, 52);
+
+	tm->tm_sec  = BCD2BIN( buffer[0] & 0x7F);
+	tm->tm_min  = BCD2BIN( buffer[1] & 0x7F);
+	tm->tm_hour = BCD2BIN( buffer[2] & 0x3F);
+	tm->tm_wday = BCD2BIN( buffer[3] & 0x07);

------------------------------^
please, remove space here.

Quoted 2 lines

Are you sure? You may notice that the spaces are intentional and *actually improve* the readability.

OK.

Quoted 6 lines
Quoted 5 lines

drivers/rtc/rtc4543.c line 58

Quoted 4 lines
drivers/rtc/rtc4543.c new file +3 -0
+	tm->tm_mday = BCD2BIN((buffer[3] & 0xF0) >> 4 | (buffer[4] & 0x0F) << 4);
+	tm->tm_mon  = BCD2BIN((buffer[4] & 0x30) >> 4 | (buffer[5] & 0x0F) << 4);
+	tm->tm_year = BCD2BIN((buffer[5] & 0xF0) >> 4 | (buffer[6] & 0x0F) << 4) + 2000;

these tree lines above are too long.

Quoted 8 lines

Oh well. I really checked CodingStyle in the Linux kernel and it has this to say:

The only exception to this is where exceeding 80 columns significantly increases readability and does not hide information.

So please reconsider your critique with this sentence in mind. What do you think?

OK. Something like

	tm->tm_mday = BCD2BIN((buffer[3] & 0xF0) >> 4 |
			      (buffer[4] & 0x0F) << 4);
        tm->tm_mon  = BCD2BIN((buffer[4] & 0x30) >> 4 |
			      (buffer[5] & 0x0F) << 4);
	tm->tm_year = BCD2BIN((buffer[5] & 0xF0) >> 4 |
			      (buffer[6] & 0x0F) << 4) + 2000;

isn't more readable than your version. Sorry for the noise, again.

Best regards,
Anatolij

#12 lore raw

PATCH v2 4/7 rtc: add support for 4543 RTC (manufactured by e.g. EPSON)

Quoted 1 line · Anatolij Gustschin

Detlev Zundel wrote:

[snip]

Quoted 4 lines
Quoted 1 line

So I really ask you to reconsider your critique.

Ok, your and Wolfgang's arguments show me, that being consistent with something is often brain-damaged. Sorry for the noise.

A foolish consistency is the hobgoblin of little minds.

-- Ralph Waldo Emerson

I change my mind periodically just because of that quote. :-D

[snip]

Best regards,
gvb

#13 lore raw

PATCH v2 4/7 rtc: add support for 4543 RTC (manufactured by e.g. EPSON)

Hi Jerry,

Quoted 5 lines

A foolish consistency is the hobgoblin of little minds.

-- Ralph Waldo Emerson

I change my mind periodically just because of that quote. :-D

Thanks Jerry. I was about to write a few sentences but I am sure I could not have driven the point home any better ;)

I also found a new addition to my signature data base which contained only the cite below being almost but not entirely off-topic...

Cheers
Detlev

Signature · 7 lines
By all means let's be open-minded, but not so open-minded that our
brains drop out.
                                                -- Richard Dawkins
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#14 lore raw

PATCH v2 4/7 rtc: add support for 4543 RTC (manufactured by e.g. EPSON)

In reply to Jerry Van Baren
Quoted 7 lines · Jerry Van Baren
Quoted 1 line · Anatolij Gustschin

Detlev Zundel wrote:

[snip]

Quoted 2 lines
Quoted 1 line

So I really ask you to reconsider your critique.

Quoted 8 lines
Quoted 2 lines

Ok, your and Wolfgang's arguments show me, that being consistent with something is often brain-damaged. Sorry for the noise.

A foolish consistency is the hobgoblin of little minds.

-- Ralph Waldo Emerson

I change my mind periodically just because of that quote. :-D

But hopefully you don't do so *consistently*. :-)

-Scott

#21 lore raw

PATCH v2 1/7 command.c: Expose the core of do_help as _do_help to the rest of u-boot.

In reply to Detlev Zundel

Dear Detlev Zundel,

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

Other commands implementing subcommands can reuse this code nicely.

---
 common/command.c  |   20 +++++++++++++-------
 include/command.h |    4 +++-
 2 files changed, 16 insertions(+), 8 deletions(-)

Applied, thanks.

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
As far as we know, our computer has never had an undetected error.
		                                           -- Weisert
#18 lore raw

PATCH v2 3/7 drivers/twserial: Add protocol driver for "three wire serial" interface.

In reply to Detlev Zundel

Dear Detlev,

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

If no further feedback on the patch series arrive, I'll repost the whole stack tomorrow again.

I applied some of the patches that were OK, so please make sure to rebase against master first.

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
365 Days of drinking Lo-Cal beer.                       = 1 Lite-year