mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] usb/gadget: add special treatment for PXA cpus
@ 2011-12-19  9:17 Robert Jarzmik
  2011-12-19  9:17 ` [PATCH] drivers/mci: pxa writedata timeout Robert Jarzmik
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Robert Jarzmik @ 2011-12-19  9:17 UTC (permalink / raw)
  To: barebox

As PXA cpus suffer from a silicon bug which prevents them
from being compound devices, forbid use_acm=1 for PXAs.
---
 drivers/usb/gadget/serial.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index f6a712b..8ba9ab5 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -179,6 +179,14 @@ static int __init gserial_init(void)
 	/* We *could* export two configs; that'd be much cleaner...
 	 * but neither of these product IDs was defined that way.
 	 */
+
+	/*
+	 * PXA CPU suffer a silicon bug which prevents them from being a
+	 * compound device, forbiding the ACM configurations.
+	 */
+#ifdef CONFIG_ARCH_PXA2XX
+	use_acm = 0;
+#endif
 	if (use_acm) {
 		serial_config_driver.label = "CDC ACM config";
 		serial_config_driver.bConfigurationValue = 2;
@@ -204,4 +212,3 @@ static int __init gserial_init(void)
 }
 
 late_initcall(gserial_init);
-
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] drivers/mci: pxa writedata timeout
  2011-12-19  9:17 [PATCH] usb/gadget: add special treatment for PXA cpus Robert Jarzmik
@ 2011-12-19  9:17 ` Robert Jarzmik
  2011-12-19  9:17 ` [PATCH] drivers/mci: pxa read data performance boost Robert Jarzmik
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Robert Jarzmik @ 2011-12-19  9:17 UTC (permalink / raw)
  To: barebox

The write data timeout is too small for old cards,
especially the Transcend 256MBytes SD card. Increase it from
10ms to 100ms.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/mci/pxamci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mci/pxamci.c b/drivers/mci/pxamci.c
index 558116f..a3f8f22 100644
--- a/drivers/mci/pxamci.c
+++ b/drivers/mci/pxamci.c
@@ -123,7 +123,7 @@ static int pxamci_write_data(struct pxamci_host *host, const unsigned char *src,
 
 	if (!ret)
 		for (start = get_time_ns(), ret = -ETIMEDOUT;
-		     ret && !is_timeout(start, 10 * MSECOND);)  {
+		     ret && !is_timeout(start, 100 * MSECOND);)  {
 			stat = mmc_readl(MMC_STAT);
 			stat &= STAT_DATA_TRAN_DONE | STAT_PRG_DONE;
 			if (stat == (STAT_DATA_TRAN_DONE | STAT_PRG_DONE))
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] drivers/mci: pxa read data performance boost
  2011-12-19  9:17 [PATCH] usb/gadget: add special treatment for PXA cpus Robert Jarzmik
  2011-12-19  9:17 ` [PATCH] drivers/mci: pxa writedata timeout Robert Jarzmik
@ 2011-12-19  9:17 ` Robert Jarzmik
  2011-12-19  9:17 ` [PATCH] commands: add hexdump command Robert Jarzmik
  2011-12-19  9:17 ` [PATCH] arch/arm: mmu: add map_io_range() Robert Jarzmik
  3 siblings, 0 replies; 7+ messages in thread
From: Robert Jarzmik @ 2011-12-19  9:17 UTC (permalink / raw)
  To: barebox

Increase pxa reading performance by reading 4 bytes at a
time instead of 4 reads of 1 byte.
As the mci controller FIFO accepts reads on bytes, halfwords
or words, use words whenether possible.

The boost is for a 250KBytes file read and display (bmp):
 - before: 6900ms
 - after: 6000ms

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/mci/pxamci.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/pxamci.c b/drivers/mci/pxamci.c
index a3f8f22..1634a1d 100644
--- a/drivers/mci/pxamci.c
+++ b/drivers/mci/pxamci.c
@@ -74,8 +74,9 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mci_data *data)
 static int pxamci_read_data(struct pxamci_host *host, unsigned char *dst,
 			    unsigned len)
 {
-	int trf_len, ret = 0;
+	int trf_len, trf_len1, trf_len4, ret = 0;
 	uint64_t start;
+	u32 *dst4;
 
 	mci_dbg("dst=%p, len=%u\n", dst, len);
 	while (!ret && len > 0) {
@@ -85,8 +86,13 @@ static int pxamci_read_data(struct pxamci_host *host, unsigned char *dst,
 		     ret && !is_timeout(start, 10 * MSECOND);)
 			if (mmc_readl(MMC_I_REG) & RXFIFO_RD_REQ)
 				ret = 0;
-		for (; !ret && trf_len > 0; trf_len--, len--)
+		trf_len1 = trf_len % 4;
+		trf_len4 = trf_len / 4;
+		for (dst4 = (u32 *)dst; !ret && trf_len4 > 0; trf_len4--)
+			*dst4++ = mmc_readl(MMC_RXFIFO);
+		for (dst = (u8 *)dst4; !ret && trf_len1 > 0; trf_len1--)
 			*dst++ = mmc_readb(MMC_RXFIFO);
+		len -= trf_len;
 	}
 
 	if (!ret)
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] commands: add hexdump command
  2011-12-19  9:17 [PATCH] usb/gadget: add special treatment for PXA cpus Robert Jarzmik
  2011-12-19  9:17 ` [PATCH] drivers/mci: pxa writedata timeout Robert Jarzmik
  2011-12-19  9:17 ` [PATCH] drivers/mci: pxa read data performance boost Robert Jarzmik
@ 2011-12-19  9:17 ` Robert Jarzmik
  2011-12-19 11:29   ` Antony Pavlov
  2011-12-19  9:17 ` [PATCH] arch/arm: mmu: add map_io_range() Robert Jarzmik
  3 siblings, 1 reply; 7+ messages in thread
From: Robert Jarzmik @ 2011-12-19  9:17 UTC (permalink / raw)
  To: barebox

Add a hexdump command to copycat the "hexdump -C <file>"
unix standard command.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 commands/Kconfig   |    5 ++
 commands/Makefile  |    1 +
 commands/hexdump.c |  126 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 132 insertions(+), 0 deletions(-)
 create mode 100644 commands/hexdump.c

diff --git a/commands/Kconfig b/commands/Kconfig
index d9e182f..9a9dfb9 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -173,6 +173,11 @@ config CMD_NAND
 	depends on NAND
 	prompt "nand"
 
+config CMD_HEXDUMP
+	tristate
+	default n
+	prompt "hexdump"
+
 endmenu
 
 menu "console                       "
diff --git a/commands/Makefile b/commands/Makefile
index 24753be..5725cc3 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -62,3 +62,4 @@ obj-$(CONFIG_CMD_OFTREE)	+= oftree.o
 obj-$(CONFIG_CMD_MAGICVAR)	+= magicvar.o
 obj-$(CONFIG_CMD_IOMEM)		+= iomem.o
 obj-$(CONFIG_CMD_LINUX_EXEC)	+= linux_exec.o
+obj-$(CONFIG_CMD_HEXDUMP)	+= hexdump.o
\ No newline at end of file
diff --git a/commands/hexdump.c b/commands/hexdump.c
new file mode 100644
index 0000000..a7e8e4f
--- /dev/null
+++ b/commands/hexdump.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2011 Robert Jarzmik <robert.jarzmik@free.fr>
+ *
+ * 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 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.
+ */
+
+/**
+ * @file
+ * @brief Cat a file on the console as standard "hexdump -C" would
+ */
+
+#include <common.h>
+#include <command.h>
+#include <fs.h>
+#include <fcntl.h>
+#include <linux/ctype.h>
+#include <errno.h>
+#include <xfuncs.h>
+#include <malloc.h>
+
+#define LINESZ  16
+#define BUFSIZE 1024
+
+static void printline(const u8 *src, int linesz, uint ofs, int len)
+{
+	static const int groupsz = 8;
+	int i, j;
+
+	printf("%08x  ", ofs);
+	for (j = 0; j * groupsz < linesz; j++) {
+		for (i = 0; i < groupsz; i++)
+			if (j * groupsz + i < len)
+				printf("%s%02x", i ? " " : "",
+				       src[j * groupsz + i]);
+			else
+				printf("%s  ", i ? " " : "");
+		printf("  ");
+	}
+	printf("\t|");
+	for (i = 0; i < linesz; i++) {
+		if (i && i % groupsz == 0)
+			printf(" ");
+		if (i < len)
+			printf("%c", isprint(src[i]) ? src[i] : '.');
+		else
+			printf(" ");
+	}
+	printf("|\n");
+}
+
+/**
+ * @param[in] cmdtp FIXME
+ * @param[in] argc Argument count from command line
+ * @param[in] argv List of input arguments
+ */
+static int do_hexdump(struct command *cmdtp, int argc, char *argv[])
+{
+	int ret, fd = -1, i, err = 1, samelastline = 0, nbsame = 0;
+	uint ofs = 0;
+	char *buf = NULL;
+
+	if (argc != 2) {
+		perror("hexdump require one argument");
+		goto out;
+	}
+
+	buf = xzalloc(BUFSIZE + LINESZ);
+	fd = open(argv[1], O_RDONLY);
+	if (fd < 0) {
+		err = 1;
+		printf("could not open %s: %s\n", argv[1], errno_str());
+		goto out;
+	}
+
+	while ((ret = read(fd, buf, BUFSIZE)) > 0) {
+		for (i = 0; i < ret; i += LINESZ) {
+			samelastline = !memcmp(buf + i, buf + BUFSIZE, LINESZ);
+			if (samelastline) {
+				nbsame++;
+			} else {
+				if (nbsame)
+					printf("*\n");
+				nbsame = 0;
+				printline(buf + i, LINESZ, ofs + i,
+					  min(ret - i, LINESZ));
+				memcpy(buf + BUFSIZE, buf + i, LINESZ);
+			}
+			if (ctrlc())
+				goto out;
+		}
+		ofs += BUFSIZE;
+	}
+	if (nbsame)
+		printf("*\n");
+	err = 0;
+
+out:
+	if (fd >= 0)
+		close(fd);
+	free(buf);
+
+	return err;
+}
+
+BAREBOX_CMD_HELP_START(hexdump)
+BAREBOX_CMD_HELP_USAGE("hexdump [FILE]\n")
+BAREBOX_CMD_HELP_SHORT("Dump in a pretty print a file on stdout.\n")
+BAREBOX_CMD_HELP_TEXT("Currently only printable characters are printed,\n")
+BAREBOX_CMD_HELP_TEXT("but this should be optional.\n")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(hexdump)
+	.cmd		= do_hexdump,
+	.usage		= "heximal dump of a file",
+	BAREBOX_CMD_HELP(cmd_hexdump_help)
+BAREBOX_CMD_END
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] arch/arm: mmu: add map_io_range()
  2011-12-19  9:17 [PATCH] usb/gadget: add special treatment for PXA cpus Robert Jarzmik
                   ` (2 preceding siblings ...)
  2011-12-19  9:17 ` [PATCH] commands: add hexdump command Robert Jarzmik
@ 2011-12-19  9:17 ` Robert Jarzmik
  3 siblings, 0 replies; 7+ messages in thread
From: Robert Jarzmik @ 2011-12-19  9:17 UTC (permalink / raw)
  To: barebox

Add a function to remap an IO range into a virtual addresses
range. This is particulary usefull for the few devices
mapped at physical address 0, as the MTD boot devices.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 arch/arm/cpu/mmu.c         |   12 ++++++++++++
 arch/arm/include/asm/mmu.h |    6 ++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
index 8e4e81a..c6c91df 100644
--- a/arch/arm/cpu/mmu.c
+++ b/arch/arm/cpu/mmu.c
@@ -111,6 +111,18 @@ static void remap_range(void *_start, size_t size, uint32_t flags)
 	tlb_invalidate();
 }
 
+void *map_io_sections(unsigned long phys, void *_start, size_t size)
+{
+	unsigned long start = (unsigned long)_start, sec;
+
+	phys >>= 20;
+	for (sec = start; sec < start + size; sec += (1 << 20))
+		ttb[sec >> 20] = (phys++ << 20) | PMD_SECT_DEF_UNCACHED;
+
+	tlb_invalidate();
+	return _start;
+}
+
 /*
  * remap the memory bank described by mem cachable and
  * bufferable
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index 9ca5e2a..f5ae7a8 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -32,6 +32,7 @@ void dma_flush_range(unsigned long, unsigned long);
 void dma_inv_range(unsigned long, unsigned long);
 unsigned long virt_to_phys(void *virt);
 void *phys_to_virt(unsigned long phys);
+void *map_io_sections(unsigned long physaddr, void *start, size_t size);
 
 #else
 static inline void *dma_alloc_coherent(size_t size)
@@ -66,6 +67,11 @@ static inline void dma_inv_range(unsigned long s, unsigned long e)
 {
 }
 
+static inline void *map_io_sections(unsigned long phys, void *start, size_t size)
+{
+	return (void *)phys;
+}
+
 #endif
 
 #ifdef CONFIG_CACHE_L2X0
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] commands: add hexdump command
  2011-12-19  9:17 ` [PATCH] commands: add hexdump command Robert Jarzmik
@ 2011-12-19 11:29   ` Antony Pavlov
  2011-12-19 12:15     ` Robert Jarzmik
  0 siblings, 1 reply; 7+ messages in thread
From: Antony Pavlov @ 2011-12-19 11:29 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: barebox

On 19 December 2011 13:17, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> Add a hexdump command to copycat the "hexdump -C <file>"
> unix standard command.

md -b -s <file> ?

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] commands: add hexdump command
  2011-12-19 11:29   ` Antony Pavlov
@ 2011-12-19 12:15     ` Robert Jarzmik
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Jarzmik @ 2011-12-19 12:15 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

Antony Pavlov <antonynpavlov@gmail.com> writes:

> On 19 December 2011 13:17, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
>> Add a hexdump command to copycat the "hexdump -C <file>"
>> unix standard command.
>
> md -b -s <file> ?
Ah yes, I haven't seen that one.
Well, that kills that patch, doesn't it ? :)

Cheers.

-- 
Robert

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-12-19 12:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-19  9:17 [PATCH] usb/gadget: add special treatment for PXA cpus Robert Jarzmik
2011-12-19  9:17 ` [PATCH] drivers/mci: pxa writedata timeout Robert Jarzmik
2011-12-19  9:17 ` [PATCH] drivers/mci: pxa read data performance boost Robert Jarzmik
2011-12-19  9:17 ` [PATCH] commands: add hexdump command Robert Jarzmik
2011-12-19 11:29   ` Antony Pavlov
2011-12-19 12:15     ` Robert Jarzmik
2011-12-19  9:17 ` [PATCH] arch/arm: mmu: add map_io_range() Robert Jarzmik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox