Skip to contentSkip to conversation

Support for A4M072 board

PATCH New Ilya Yanok 2 participants 11 messages Sep 9, 2010 – Oct 12, 2010 Char and misc drivers

lore
Share & tools
lore

Ilya Yanok

author
#0 lore raw

cover Support for A4M072 board

These patches add support for A4M072 MPC5200-based board. The first patch adds new board with support for all devices except for 7-segment LED display.
We've decided to use 'display' command to manipulate the LED display so the second patch adds very simple generic interface to use such devices and moves hw-specific realization to drivers/misc/pdsp188x.c The third patch adds 7-segment LED display support.
And the fourth file adds support for showing boot progress codes on LED display (we can't display them directly so we use a mapping).

Regards, Ilya.

author
#1 lore raw

PATCH 1/4 A4M072: Added support for the board.

From: Sergei Poselenov <[email protected]>

This patch provides support for the A4M072 board with the following features:
UART
NOR flash
FEC Ethernet
External SRAM
I2C EEPROM
CompactFlash cards on IDE/ATA port
USB Host
PCI initialization

The 7-segment LED indicator is not yet supported.

---
 MAINTAINERS               |    3 +
 MAKEALL                   |    1 +
 board/a4m072/Makefile     |   50 ++++++
 board/a4m072/a4m072.c     |  263 +++++++++++++++++++++++++++++++
 board/a4m072/config.mk    |   39 +++++
 board/a4m072/mt46v32m16.h |   37 +++++
 boards.cfg                |    1 +
 include/configs/a4m072.h  |  377 +++++++++++++++++++++++++++++++++++++++++++++
 include/mpc5xxx.h         |    3 +-
 9 files changed, 773 insertions(+), 1 deletions(-)
 create mode 100644 board/a4m072/Makefile
 create mode 100644 board/a4m072/a4m072.c
 create mode 100644 board/a4m072/config.mk
 create mode 100644 board/a4m072/mt46v32m16.h
 create mode 100644 include/configs/a4m072.h
MAINTAINERS +3 -0
index 4b91b0f..1b25b61 100644
@@ -504,6 +504,9 @@ Detlev Zundel <[email protected]>
 
 	inka4x0		MPC5200
 
+Sergei Poselenov <[email protected]>
+
+	a4m072		MPC5200
 -------------------------------------------------------------------------
 
 Unknown / orphaned boards:
MAKEALL +1 -0
index b34ae33..764462a 100755
@@ -54,6 +54,7 @@ LIST_5xx="		\
 #########################################################################
 
 LIST_5xxx="		\
+	a4m072		\
 	BC3450		\
 	cm5200		\
 	cpci5200	\
board/a4m072/Makefile new file +50 -0

50 lines not on this page · raw message

board/a4m072/a4m072.c new file +263 -0

263 lines not on this page · raw message

board/a4m072/config.mk new file +39 -0
new file mode 100644
index 0000000..c6ba51d
@@ -0,0 +1,39 @@
+#
+# (C) Copyright 2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+#
+# a4m072 board:
+#
+#	Valid values for TEXT_BASE is:
+#
+#	0xFE000000   boot low
+#
+
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+
+ifndef TEXT_BASE
+## Standard: boot low
+TEXT_BASE = 0xFE000000
+endif
+
+PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board
board/a4m072/mt46v32m16.h new file +37 -0
new file mode 100644
index 0000000..d7561fb
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2004
+ * Mark Jonas, Freescale Semiconductor, mark.jonas at motorola.com.
+ *
+ * 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
+ */
+
+#define SDRAM_DDR	1		/* is DDR */
+
+#if defined(CONFIG_MPC5200)
+/* Settings for XLB = 132 MHz */
+#define SDRAM_MODE	0x018D0000
+#define SDRAM_EMODE	0x40010000
+#define SDRAM_CONTROL	0x704f0f00
+#define SDRAM_CONFIG1	0x73722930
+#define SDRAM_CONFIG2	0x47770000
+#define SDRAM_TAPDELAY	0x10000000
+
+#else
+#error CONFIG_MPC5200 not defined
+#endif
boards.cfg +1 -0
index 69c6897..9d0ced2 100644
@@ -89,6 +89,7 @@ DB64360		powerpc	74xx_7xx 	db64360		Marvell
 DB64460		powerpc	74xx_7xx 	db64460		Marvell
 aria		powerpc	mpc512x		-		davedenx
 PATI		powerpc	mpc5xx		pati		mpl
+a4m072		powerpc	mpc5xxx		a4m072
 BC3450		powerpc	mpc5xxx		bc3450
 canmb		powerpc	mpc5xxx
 cm5200		powerpc	mpc5xxx
include/configs/a4m072.h new file +377 -0

377 lines not on this page · raw message

include/mpc5xxx.h +2 -1
index 2d343c7..859d696 100644
@@ -160,11 +160,12 @@
 #define MPC5XXX_WU_GPIO_DATA_O  (MPC5XXX_WU_GPIO + 0x000c)
 #define MPC5XXX_WU_GPIO_DATA_I  (MPC5XXX_WU_GPIO + 0x0020)
 
-/* GPIO pins */
+/* GPIO pins, for Rev.B chip */
 #define GPIO_WKUP_7		0x80000000UL
 #define GPIO_PSC6_0		0x10000000UL
 #define GPIO_PSC3_9		0x04000000UL
 #define GPIO_PSC1_4		0x01000000UL
+#define GPIO_PSC2_4		0x02000000UL
 
 #define MPC5XXX_GPIO_SIMPLE_PSC6_3   0x20000000UL
 #define MPC5XXX_GPIO_SIMPLE_PSC6_2   0x10000000UL
Signature · 1 line
1.6.2.5
author
#2 lore raw

PATCH 2/4 led_display: split led display support into generic and hw-dependent parts

Split the display command into generic interface and hardware-specific realization for PDSP188x LED display found on hmi1001 and manroland boards. Simple interface for LED displays is defined in include/led-display.h and described in doc/README.LED_display. Driver-specific implementation was moved into drivers/misc/pdsp188x.c file (enabled with CONFIG_PDSP188x set).

---
 common/cmd_display.c               |   26 ++++++-----------
 doc/README.LED_display             |   28 +++++++++++++++++
 drivers/misc/Makefile              |    1 +
 drivers/misc/pdsp188x.c            |   57 ++++++++++++++++++++++++++++++++++++
 include/configs/hmi1001.h          |    1 +
 include/configs/manroland/common.h |    5 +++
 include/led-display.h              |   36 ++++++++++++++++++++++
 7 files changed, 137 insertions(+), 17 deletions(-)
 create mode 100644 doc/README.LED_display
 create mode 100644 drivers/misc/pdsp188x.c
 create mode 100644 include/led-display.h
common/cmd_display.c +9 -17
index 6c11aa6..d5d5d8c 100644
@@ -23,40 +23,32 @@
 
 #include <common.h>
 #include <command.h>
+#include <led-display.h>
 
 #undef DEBUG_DISP
 
-#define DISP_SIZE	8
-#define CWORD_CLEAR	0x80
-#define CLEAR_DELAY	(110 * 2)
-
 int do_display (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int i;
-	int pos;
 
 	/* Clear display */
-	*((volatile char*)(CONFIG_SYS_DISP_CWORD)) = CWORD_CLEAR;
-	udelay(1000 * CLEAR_DELAY);
+	display_set(DISPLAY_CLEAR | DISPLAY_HOME);
 
 	if (argc < 2)
 		return (0);
 
-	for (pos = 0, i = 1; i < argc && pos < DISP_SIZE; i++) {
-		char *p = argv[i], c;
+	for (i = 1; i < argc; i++) {
+		char *p = argv[i];
 
-		if (i > 1) {
-			*((volatile uchar *) (CONFIG_SYS_DISP_CHR_RAM + pos++)) = ' ';
-#ifdef DEBUG_DISP
-			putc(' ');
-#endif
+		if (i > 1) { /* Insert a space between strings */
+			display_putc(' ');
 		}
 
-		while ((c = *p++) != '\0' && pos < DISP_SIZE) {
-			*((volatile uchar *) (CONFIG_SYS_DISP_CHR_RAM + pos++)) = c;
+		while ((*p)) {
 #ifdef DEBUG_DISP
-			putc(c);
+			putc(*p);
 #endif
+			display_putc(*p++);
 		}
 	}
 
doc/README.LED_display new file +28 -0
new file mode 100644
index 0000000..c79aca6
@@ -0,0 +1,28 @@
+LED display internal API
+=======================================
+
+This README describes the LED display API.
+
+The API is defined by the include file include/led-display.h
+
+The first step in to define CONFIG_CMD_DISPLAY in the board config file.
+Then you need to provide the following functions to access LED display:
+
+void display_set(int cmd);
+
+This function should control the state of the LED display. Argument is
+an ORed combination of the following values:
+ DISPLAY_CLEAR	-- clear the display
+ DISPLAY_HOME	-- set the position to the beginning of display
+ DISPLAY_MARK	-- enable mark (decimal point), if implemented
+
+int display_putc(char c);
+
+This function should display it's parameter on the LED display in the
+current position. Returns the displayed character on success or -1 in
+case of failure.
+
+With this functions defined 'display' command will display it's
+arguments on the LED display (or clear the display if called without
+arguments).
+
drivers/misc/Makefile +1 -0
index 4f15db9..5d668f8 100644
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_NS87308) += ns87308.o
 COBJS-$(CONFIG_STATUS_LED) += status_led.o
 COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
 COBJS-$(CONFIG_FSL_PMIC) += fsl_pmic.o
+COBJS-$(CONFIG_PDSP188x) += pdsp188x.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/misc/pdsp188x.c new file +57 -0

57 lines not on this page · raw message

include/configs/hmi1001.h +1 -0
index f9cdcbc..e5eb966 100644
@@ -350,6 +350,7 @@
 /* Display addresses						       */
 /*---------------------------------------------------------------------*/
 
+#define CONFIG_PDSP188x
 #define CONFIG_SYS_DISP_CHR_RAM	(CONFIG_SYS_DISPLAY_BASE + 0x38)
 #define CONFIG_SYS_DISP_CWORD		(CONFIG_SYS_DISPLAY_BASE + 0x30)
 
include/configs/manroland/common.h +5 -0
index 0224608..291b669 100644
@@ -55,6 +55,11 @@
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_SNTP
 
+/*
+ * 8-symbol LED display (can be accessed with 'display' command)
+ */
+#define CONFIG_PDSP188x
+
 #define	CONFIG_TIMESTAMP	1	/* Print image info with timestamp */
 
 /*
include/led-display.h new file +36 -0
new file mode 100644
index 0000000..41c3744
@@ -0,0 +1,36 @@
+/*
+ * (C) Copyright 2005-2010
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * (C) Copyright 2010
+ * Sergei Poselenov, Emcraft Systems, sposelenov at emcraft.com.
+ *
+ * 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
+ */
+#ifndef _led_display_h_
+#define _led_display_h_
+
+/* Display Commands */
+#define DISPLAY_CLEAR	0x1 /* Clear the display */
+#define DISPLAY_HOME	0x2 /* Set cursor at home position */
+#define DISPLAY_MARK	0x4 /* Enable the decimal point led, if implemented */
+
+void display_set(int cmd);
+int display_putc(char c);
+#endif
Signature · 1 line
1.6.2.5
author
#3 lore raw

PATCH 3/4 a4m072: led display support

This patch adds support for LED display on a4m072 board. Hardware is capable of displaying only one symbol at any time. We support displaying two symbols in software (via blinking).

---
 board/a4m072/a4m072.c    |  174 ++++++++++++++++++++++++++++++++++++++++++++++
 include/configs/a4m072.h |   12 +++-
 2 files changed, 184 insertions(+), 2 deletions(-)
board/a4m072/a4m072.c +174 -0
index 3756975..9c272a0 100644
@@ -34,6 +34,7 @@
 #include <asm/io.h>
 #include <libfdt.h>
 #include <netdev.h>
+#include <led-display.h>
 
 #include "mt46v32m16.h"
 
@@ -261,3 +262,176 @@ int eeprom_write_enable (unsigned dev_addr, int state)
 	return state;
 }
 #endif
+
+#ifdef CONFIG_CMD_DISPLAY
+#define DISPLAY_BUF_SIZE	2
+static u8 display_buf[DISPLAY_BUF_SIZE];
+static u8 display_putc_pos;
+static u8 display_out_pos;
+
+static u8 display_dot_enable;
+
+void display_set(int cmd) {
+
+	if (cmd & DISPLAY_CLEAR) {
+		display_buf[0] = display_buf[1] = 0;
+	}
+
+	if (cmd & DISPLAY_HOME) {
+		display_putc_pos = 0;
+	}
+
+	if (cmd & DISPLAY_MARK) {
+		display_dot_enable = 1;
+	} else {
+		display_dot_enable = 0;
+	}
+}
+
+#define SEG_A    (1<<0)
+#define SEG_B    (1<<1)
+#define SEG_C    (1<<2)
+#define SEG_D    (1<<3)
+#define SEG_E    (1<<4)
+#define SEG_F    (1<<5)
+#define SEG_G    (1<<6)
+#define SEG_P    (1<<7)
+#define SEG__    0
+
+/*
+ * +- A -+
+ * |     |
+ * F     B
+ * |     |
+ * +- G -+
+ * |     |
+ * E     C
+ * |     |
+ * +- D -+  P
+ *
+ * 0..9		index 0..9
+ * A..Z		index 10..35
+ * -		index 36
+ * _		index 37
+ */
+
+#define SYMBOL_DASH		(36)
+#define SYMBOL_UNDERLINE	(37)
+
+static u8 display_char2seg7_tbl[]=
+{
+	SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F,		/* 0 */
+	SEG_B | SEG_C,						/* 1 */
+	SEG_A | SEG_B | SEG_D | SEG_E | SEG_G,			/* 2 */
+	SEG_A | SEG_B | SEG_C | SEG_D | SEG_G,			/* 3 */
+	SEG_B | SEG_C | SEG_F | SEG_G,				/* 4 */
+	SEG_A | SEG_C | SEG_D | SEG_F | SEG_G,			/* 5 */
+	SEG_A | SEG_C | SEG_D | SEG_E | SEG_F | SEG_G,		/* 6 */
+	SEG_A | SEG_B | SEG_C,					/* 7 */
+	SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F | SEG_G,	/* 8 */
+	SEG_A | SEG_B | SEG_C | SEG_D | SEG_F | SEG_G,		/* 9 */
+	SEG_A | SEG_B | SEG_C | SEG_E | SEG_F | SEG_G,		/* A */
+	SEG_C | SEG_D | SEG_E | SEG_F | SEG_G,			/* b */
+	SEG_A | SEG_D | SEG_E | SEG_F,				/* C */
+	SEG_B | SEG_C | SEG_D | SEG_E | SEG_G,			/* d */
+	SEG_A | SEG_D | SEG_E | SEG_F | SEG_G,			/* E */
+	SEG_A | SEG_E | SEG_F | SEG_G,				/* F */
+	SEG_A | SEG_B | SEG_C | SEG_D | SEG_F | SEG_G,		/* g */
+	SEG_B | SEG_C | SEG_E | SEG_F | SEG_G,			/* H */
+	SEG_E | SEG_F,						/* I */
+	SEG_B | SEG_C | SEG_D | SEG_E,				/* J */
+	SEG_A,						/* K - special 1 */
+	SEG_D | SEG_E | SEG_F,					/* L */
+	SEG_B,						/* m - special 2 */
+	SEG_C | SEG_E | SEG_G,					/* n */
+	SEG_C | SEG_D | SEG_E | SEG_G,				/* o */
+	SEG_A | SEG_B | SEG_E | SEG_F | SEG_G,			/* P */
+	SEG_A | SEG_B | SEG_C | SEG_F | SEG_G,			/* q */
+	SEG_E | SEG_G,						/* r */
+	SEG_A | SEG_C | SEG_D | SEG_F | SEG_G,			/* S */
+	SEG_D | SEG_E | SEG_F | SEG_G,				/* t */
+	SEG_B | SEG_C | SEG_D | SEG_E | SEG_F,			/* U */
+	SEG_C | SEG_D | SEG_E | SEG_F,				/* V */
+	SEG_C,						/* w - special 3 */
+	SEG_B | SEG_C | SEG_E | SEG_F | SEG_G,			/* X */
+	SEG_B | SEG_C | SEG_D | SEG_F | SEG_G,			/* Y */
+	SEG_A | SEG_B | SEG_D | SEG_E | SEG_G,			/* Z */
+	SEG_G,							/* - */
+	SEG_D							/* _ */
+};
+
+/* Convert char to the LED segments representation */
+static u8 display_char2seg7(char c)
+{
+	u8 val = 0;
+
+	if (c >= '0' && c <= '9')
+		c -= '0';
+	else if (c >= 'a' && c <= 'z')
+		c -= 'a' - 10;
+	else if (c >= 'A' && c <= 'Z')
+		c -= 'A' - 10;
+	else if (c == '-')
+		c = SYMBOL_DASH;
+	else if ((c == '_') || (c == '.'))
+		c = SYMBOL_UNDERLINE;
+	else
+		c = ' ';	/* display unsupported symbols as space */
+
+	if (c != ' ')
+		val = display_char2seg7_tbl[(int)c];
+
+	/* Handle DP LED here */
+	if (display_dot_enable) {
+		val |= SEG_P;
+	}
+
+	return val;
+}
+
+static inline int display_putc_nomark(char c)
+{
+	if (display_putc_pos >= DISPLAY_BUF_SIZE)
+		return -1;
+
+	display_buf[display_putc_pos++] = display_char2seg7(c);
+	/* one-symbol message should be steady */
+	if (display_putc_pos == 1)
+		display_buf[display_putc_pos] = display_char2seg7(c);
+
+	return c;
+}
+
+int display_putc(char c)
+{
+	/* Mark the codes from the "display" command with the DP LED */
+	display_set(DISPLAY_MARK);
+	return display_putc_nomark(c);
+}
+
+/*
+ * Output content of the software display buffer to the LED display every 0.5s
+ */
+void board_show_activity(ulong timestamp)
+{
+	static ulong last;
+	static u8 once;
+	u32 val;
+
+	if (!once || (timestamp - last >= (CONFIG_SYS_HZ / 2))) {
+		val = display_buf[display_out_pos];
+		val |= (val << 8) | (val << 16) | (val << 24);
+		out_be32((void *)CONFIG_SYS_DISP_CHR_RAM, val);
+		display_out_pos ^= 1;
+		last = timestamp;
+		once = 1;
+	}
+}
+
+/*
+ * Empty fake function
+ */
+void show_activity(int arg)
+{
+}
+#endif
include/configs/a4m072.h +10 -2
index ffa5621..ce931d7 100644
@@ -122,6 +122,7 @@
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_PING
+#define CONFIG_CMD_DISPLAY
 
 #if defined(CONFIG_PCI)
 #define CONFIG_CMD_PCI
@@ -264,7 +265,7 @@
 /*
  * GPIO configuration
  */
-#define CONFIG_SYS_GPS_PORT_CONFIG	0x10000004
+#define CONFIG_SYS_GPS_PORT_CONFIG	0x18000004
 
 /*
  * Miscellaneous configurable options
@@ -315,7 +316,10 @@
 #define CONFIG_SYS_CS1_CFG		0x00009930
 #define CONFIG_SYS_SRAM_BASE		CONFIG_SYS_CS1_START
 #define CONFIG_SYS_SRAM_SIZE		CONFIG_SYS_CS1_SIZE
-
+/* LED display@CS7 */
+#define CONFIG_SYS_CS7_START		0x6a000000
+#define CONFIG_SYS_CS7_SIZE		(64*1024)
+#define CONFIG_SYS_CS7_CFG		0x0000bf30
 
 #define CONFIG_SYS_CS_BURST		0x00000000
 #define CONFIG_SYS_CS_DEADCYCLE		0x33333003
@@ -374,4 +378,8 @@
 #define OF_TBCLK		(bd->bi_busfreq / 4)
 #define OF_STDOUT_PATH		"/soc5200 at f0000000/serial at 2000"
 
+/* Support for the 7-segment display */
+#define CONFIG_SYS_DISP_CHR_RAM	     CONFIG_SYS_CS7_START
+#define CONFIG_SHOW_ACTIVITY		/* used for display realization */
+
 #endif /* __CONFIG_H */
Signature · 1 line
1.6.2.5
author
#4 lore raw

PATCH 4/4 a4m072: support for SHOW_BOOT_PROGRESS feature using LED display

This patch adds support for displaying boot progress codes on a4m072 board using LED display. As we can display only one symbol at any time on the hardware (two symbols with blinking) we can't display progress codes directly and have to map them to 2-symbol codes.
We use the following mapping on the a4m972 board:
[1, 8] U [100, 108] -> 5
[-9, -1] U [-101, -100] U [-113, -103] -> -5
[9, 14] U [120, 123] U [125, 129] -> 8
[-13, -10] U [-122, -120] U [-127, -124] U {-129} -> -8
{15} -> 9
[-32, -30] -> -A
[-40, -35] U [-51, -42] U [-58, -53] U

		[-83, -80] U {-64, -130, -140, -150}	-> -B

Other progress code are ignored. One symbol codes are displayed steady while two-symbol codes are displayed using blinking. Boot progress codes are displayed with decimal got unset (as opposed to 'display' command output).

---
 board/a4m072/a4m072.c    |   79 +++++++++++++++++++++++++++++++++++++++++++---
 include/configs/a4m072.h |    2 +
 2 files changed, 76 insertions(+), 5 deletions(-)
board/a4m072/a4m072.c +74 -5
index 9c272a0..ae7ccbb 100644
@@ -35,6 +35,7 @@
 #include <libfdt.h>
 #include <netdev.h>
 #include <led-display.h>
+#include <linux/err.h>
 
 #include "mt46v32m16.h"
 
@@ -410,18 +411,26 @@ int display_putc(char c)
 }
 
 /*
- * Output content of the software display buffer to the LED display every 0.5s
+ * Flush current symbol to the LED display hardware
+ */
+static inline void display_flush(void)
+{
+	u32 val = display_buf[display_out_pos];
+
+	val |= (val << 8) | (val << 16) | (val << 24);
+	out_be32((void *)CONFIG_SYS_DISP_CHR_RAM, val);
+}
+
+/*
+ * Output contents of the software display buffer to the LED display every 0.5s
  */
 void board_show_activity(ulong timestamp)
 {
 	static ulong last;
 	static u8 once;
-	u32 val;
 
 	if (!once || (timestamp - last >= (CONFIG_SYS_HZ / 2))) {
-		val = display_buf[display_out_pos];
-		val |= (val << 8) | (val << 16) | (val << 24);
-		out_be32((void *)CONFIG_SYS_DISP_CHR_RAM, val);
+		display_flush();
 		display_out_pos ^= 1;
 		last = timestamp;
 		once = 1;
@@ -435,3 +444,63 @@ void show_activity(int arg)
 {
 }
 #endif
+#if defined (CONFIG_SHOW_BOOT_PROGRESS)
+static int a4m072_status2code(int status, char *buf)
+{
+	char c = 0;
+
+	if (((status > 0) && (status <= 8)) ||
+				((status >= 100) && (status <= 108)) ||
+				((status < 0) && (status >= -9)) ||
+				(status == -100) || (status == -101) ||
+				((status <= -103) && (status >= -113))) {
+		c = '5';
+	} else if (((status >= 9) && (status <= 14)) ||
+			((status >= 120) && (status <= 123)) ||
+			((status >= 125) && (status <= 129)) ||
+			((status >= -13) && (status <= -10)) ||
+			(status == -120) || (status == -122) ||
+			((status <= -124) && (status >= -127)) ||
+			(status == -129)) {
+		c = '8';
+	} else if (status == 15) {
+		c = '9';
+	} else if ((status <= -30) && (status >= -32)) {
+		c = 'A';
+	} else if (((status <= -35) && (status >= -40)) ||
+			((status <= -42) && (status >= -51)) ||
+			((status <= -53) && (status >= -58)) ||
+			(status == -64) ||
+			((status <= -80) && (status >= -83)) ||
+			(status == -130) || (status == -140) ||
+			(status == -150)) {
+		c = 'B';
+	}
+
+	if (c == 0)
+		return -EINVAL;
+
+	buf[0] = (status < 0) ? '-' : c;
+	buf[1] = c;
+
+	return 0;
+}
+
+void show_boot_progress(int status)
+{
+	char buf[2];
+
+	if (a4m072_status2code(status, buf) < 0)
+		return;
+
+	display_set(0);	/* Clear DP Led */
+	display_putc_nomark(buf[0]);
+	display_putc_nomark(buf[1]);
+	display_set(DISPLAY_HOME);
+	display_out_pos = 0;	/* reset output position */
+
+	/* we want to flush status 15 now */
+	if (status == 15)
+		display_flush();
+}
+#endif
include/configs/a4m072.h +2 -0
index ce931d7..a54ab1d 100644
@@ -382,4 +382,6 @@
 #define CONFIG_SYS_DISP_CHR_RAM	     CONFIG_SYS_CS7_START
 #define CONFIG_SHOW_ACTIVITY		/* used for display realization */
 
+#define CONFIG_SHOW_BOOT_PROGRESS
+
 #endif /* __CONFIG_H */
Signature · 1 line
1.6.2.5
#5 lore raw

PATCH 4/4 a4m072: support for SHOW_BOOT_PROGRESS feature using LED display

Dear Ilya Yanok,

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

This patch adds support for displaying boot progress codes on a4m072 board using LED display. As we can display only one symbol at any time on the hardware (two symbols with blinking) we can't display progress codes directly and have to map them to 2-symbol codes.
We use the following mapping on the a4m972 board:
[1, 8] U [100, 108] -> 5
[-9, -1] U [-101, -100] U [-113, -103] -> -5
[9, 14] U [120, 123] U [125, 129] -> 8
[-13, -10] U [-122, -120] U [-127, -124] U {-129} -> -8
{15} -> 9
[-32, -30] -> -A
[-40, -35] U [-51, -42] U [-58, -53] U

		[-83, -80] U {-64, -130, -140, -150}	-> -B

Other progress code are ignored. One symbol codes are displayed steady while two-symbol codes are displayed using blinking. Boot progress codes are displayed with decimal got unset (as opposed to 'display' command output).

Quoted 5 lines
---
 board/a4m072/a4m072.c    |   79 +++++++++++++++++++++++++++++++++++++++++++---
 include/configs/a4m072.h |    2 +
 2 files changed, 76 insertions(+), 5 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
The human race is a race of cowards; and I am not  only  marching  in
that procession but carrying a banner.                   - Mark Twain
#6 lore raw

PATCH 3/4 a4m072: led display support

In reply to Ilya Yanok

Dear Ilya Yanok,

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

This patch adds support for LED display on a4m072 board. Hardware is capable of displaying only one symbol at any time. We support displaying two symbols in software (via blinking).

---
 board/a4m072/a4m072.c    |  174 ++++++++++++++++++++++++++++++++++++++++++++++
 include/configs/a4m072.h |   12 +++-
 2 files changed, 184 insertions(+), 2 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
One does not thank logic.
	-- Sarek, "Journey to Babel", stardate 3842.4
#7 lore raw

PATCH 2/4 led_display: split led display support into generic and hw-dependent parts

In reply to Ilya Yanok

Dear Ilya Yanok,

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

Split the display command into generic interface and hardware-specific realization for PDSP188x LED display found on hmi1001 and manroland boards. Simple interface for LED displays is defined in include/led-display.h and described in doc/README.LED_display. Driver-specific implementation was moved into drivers/misc/pdsp188x.c file (enabled with CONFIG_PDSP188x set).

Quoted 12 lines
---
 common/cmd_display.c               |   26 ++++++-----------
 doc/README.LED_display             |   28 +++++++++++++++++
 drivers/misc/Makefile              |    1 +
 drivers/misc/pdsp188x.c            |   57 ++++++++++++++++++++++++++++++++++++
 include/configs/hmi1001.h          |    1 +
 include/configs/manroland/common.h |    5 +++
 include/led-display.h              |   36 ++++++++++++++++++++++
 7 files changed, 137 insertions(+), 17 deletions(-)
 create mode 100644 doc/README.LED_display
 create mode 100644 drivers/misc/pdsp188x.c
 create mode 100644 include/led-display.h

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
Where there's no emotion, there's no motive for violence.
	-- Spock, "Dagger of the Mind", stardate 2715.1
#8 lore raw

PATCH 1/4 A4M072: Added support for the board.

In reply to Ilya Yanok

Dear Ilya Yanok,

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

From: Sergei Poselenov <[email protected]>

This patch provides support for the A4M072 board with the following features:
UART
NOR flash
FEC Ethernet
External SRAM
I2C EEPROM
CompactFlash cards on IDE/ATA port
USB Host
PCI initialization

The 7-segment LED indicator is not yet supported.

Quoted 16 lines
---
 MAINTAINERS               |    3 +
 MAKEALL                   |    1 +
 board/a4m072/Makefile     |   50 ++++++
 board/a4m072/a4m072.c     |  263 +++++++++++++++++++++++++++++++
 board/a4m072/config.mk    |   39 +++++
 board/a4m072/mt46v32m16.h |   37 +++++
 boards.cfg                |    1 +
 include/configs/a4m072.h  |  377 +++++++++++++++++++++++++++++++++++++++++++++
 include/mpc5xxx.h         |    3 +-
 9 files changed, 773 insertions(+), 1 deletions(-)
 create mode 100644 board/a4m072/Makefile
 create mode 100644 board/a4m072/a4m072.c
 create mode 100644 board/a4m072/config.mk
 create mode 100644 board/a4m072/mt46v32m16.h
 create mode 100644 include/configs/a4m072.h

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
"It may be that our role on this planet is not to worship God but  to
create him."                                       - Arthur C. Clarke
author
#9 lore raw

PATCH 1/4 A4M072: Added support for the board.

Quoted 1 line · Wolfgang Denk

Applied, thanks.

Ouch... I'm going to clear these patches as you requested (big NOR flash, changed default environment, changed character mapping, added dot character) and repost updated patches in a few days...

Could you please rollback the whole series? Or should I post the incremental patches?

Regards, Ilya.

#10 lore raw

PATCH 1/4 A4M072: Added support for the board.

Dear Ilya Yanok,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 1 line · Wolfgang Denk

Applied, thanks.

Ouch... I'm going to clear these patches as you requested (big NOR flash, changed default environment, changed character mapping, added dot character) and repost updated patches in a few days...

Yes, I know. I could not wait that long. Sorry.

Quoted 2 lines

Could you please rollback the whole series? Or should I post the incremental patches?

Yes, please post incremental patches now.

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
You've no idea of what a poor opinion  I  have  of  myself,  and  how
little I deserve it.                                  - W. S. Gilbert