mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/6] update mx35_3ds suppoprt
@ 2012-01-24 10:51 Marc Kleine-Budde
  2012-01-24 10:51 ` [PATCH 1/6] net/nfs: increase timeout to 15 seconds Marc Kleine-Budde
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-01-24 10:51 UTC (permalink / raw)
  To: barebox

Hey,

this patch series updates mx35_3ds support in barebox. In my current project
the rootfs is bigger than 32 MiB, so that it cannot be flashed with tftp with
the current blocksize of 512 bytes. So flash via nfs is added to the update
script.

Marc


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

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

* [PATCH 1/6] net/nfs: increase timeout to 15 seconds
  2012-01-24 10:51 [PATCH 0/6] update mx35_3ds suppoprt Marc Kleine-Budde
@ 2012-01-24 10:51 ` Marc Kleine-Budde
  2012-01-24 10:51 ` [PATCH 2/6] show_progress: fix progress bar for files > 32 MiB Marc Kleine-Budde
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-01-24 10:51 UTC (permalink / raw)
  To: barebox

On my laptop with avahi enabled (linux mdns implementation), the unmount
take quite long, because the avahi daemon tries to resolve the client's
host name. This leads to a delay of about 8 seconds of the unmount reply
messages, so that barebox runs into a timeout. This patch increases the
NFS timeout to 15 to work around the problem.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/nfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/nfs.c b/net/nfs.c
index 0a4b787..f6cbc7c 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -124,7 +124,7 @@ struct rpc_t {
 	} u;
 };
 
-#define NFS_TIMEOUT 1
+#define NFS_TIMEOUT 15
 
 static unsigned long rpc_id = 0;
 static int nfs_offset = -1;
-- 
1.7.4.1


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

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

* [PATCH 2/6] show_progress: fix progress bar for files > 32 MiB
  2012-01-24 10:51 [PATCH 0/6] update mx35_3ds suppoprt Marc Kleine-Budde
  2012-01-24 10:51 ` [PATCH 1/6] net/nfs: increase timeout to 15 seconds Marc Kleine-Budde
@ 2012-01-24 10:51 ` Marc Kleine-Budde
  2012-01-24 10:51 ` [PATCH 3/6] defaultenv: update: add nfs support Marc Kleine-Budde
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-01-24 10:51 UTC (permalink / raw)
  To: barebox

The next limit with the current code will probably 2GiB.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 lib/show_progress.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/show_progress.c b/lib/show_progress.c
index 333f498..39808d2 100644
--- a/lib/show_progress.c
+++ b/lib/show_progress.c
@@ -22,6 +22,7 @@
 
 #include <common.h>
 #include <progress.h>
+#include <asm-generic/div64.h>
 
 #define HASHES_PER_LINE	65
 
@@ -38,8 +39,11 @@ void show_progress(int now)
 		return;
 	}
 
-	if (progress_max)
-		now = now * HASHES_PER_LINE / progress_max;
+	if (progress_max) {
+		uint64_t tmp = (int64_t)now * HASHES_PER_LINE;
+		do_div(tmp, progress_max);
+		now = tmp;
+	}
 
 	while (printed < now) {
 		if (!(printed % HASHES_PER_LINE) && printed)
-- 
1.7.4.1


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

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

* [PATCH 3/6] defaultenv: update: add nfs support
  2012-01-24 10:51 [PATCH 0/6] update mx35_3ds suppoprt Marc Kleine-Budde
  2012-01-24 10:51 ` [PATCH 1/6] net/nfs: increase timeout to 15 seconds Marc Kleine-Budde
  2012-01-24 10:51 ` [PATCH 2/6] show_progress: fix progress bar for files > 32 MiB Marc Kleine-Budde
@ 2012-01-24 10:51 ` Marc Kleine-Budde
  2012-01-24 10:51 ` [PATCH 4/6] ARM: mx3/mx35_3ds: add missing nand device Marc Kleine-Budde
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-01-24 10:51 UTC (permalink / raw)
  To: barebox

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 defaultenv/bin/_update      |   11 ++++-------
 defaultenv/bin/_update_help |   10 +++++-----
 defaultenv/bin/update       |    2 +-
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/defaultenv/bin/_update b/defaultenv/bin/_update
index 9e88dea..e7cf149 100644
--- a/defaultenv/bin/_update
+++ b/defaultenv/bin/_update
@@ -10,7 +10,7 @@ if [ ! -e "$part" ]; then
 	exit 1
 fi
 
-if [ x$mode = xtftp ]; then
+if [ x$mode = xtftp -o x$mode = xnfs ]; then
 	if [ x$ip = xdhcp ]; then
 		dhcp
 	fi
@@ -20,6 +20,7 @@ if [ x$mode = xtftp ]; then
 		echo "Server did not reply! Update aborted."
 		exit 1
 	fi
+	load=$mode
 fi
 
 if [ x$mode = xxmodem ]; then
@@ -28,6 +29,7 @@ if [ x$mode = xxmodem ]; then
 		echo "loadb failed or cancelled! Update aborted."
 		exit 1
 	fi
+	load="cp -v"
 fi
 
 unprotect $part
@@ -40,11 +42,6 @@ erase $part || exit 1
 echo
 echo "flashing $image to $part"
 echo
-
-if [ x$mode = xtftp ]; then
-	tftp $image $part || exit 1
-else
-	cp -v $image $part || exit 1
-fi
+$load $image $part || exit 1
 
 protect $part
diff --git a/defaultenv/bin/_update_help b/defaultenv/bin/_update_help
index 92d6772..3b7ad23 100644
--- a/defaultenv/bin/_update_help
+++ b/defaultenv/bin/_update_help
@@ -7,8 +7,8 @@ echo "options"
 echo " -c     to check the crc32 for the image and flashed one"
 echo ""
 echo "default mode is tftp"
-echo "type update -t kernel -d <nor|nand|disk> [-m tftp|xmodem] [-f imagename] to update kernel into flash"
-echo "type update -t rootfs -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update rootfs into flash"
-echo "type update -t barebox -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update barebox into flash"
-echo "type update -t bareboxenv -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update bareboxenv into flash"
-echo "type update -t xload -d <nor|nand> [-m tftp|xmodem] [-f imagename] to update xload into flash"
+echo "type update -t kernel -d <nor|nand|disk> [-m tftp|xmodem|nfs] [-f imagename] to update kernel into flash"
+echo "type update -t rootfs -d <nor|nand> [-m tftp|xmodem|nfs] [-f imagename] to update rootfs into flash"
+echo "type update -t barebox -d <nor|nand> [-m tftp|xmodem|nfs] [-f imagename] to update barebox into flash"
+echo "type update -t bareboxenv -d <nor|nand> [-m tftp|xmodem|nfs] [-f imagename] to update bareboxenv into flash"
+echo "type update -t xload -d <nor|nand> [-m tftp|xmodem|nfs] [-f imagename] to update xload into flash"
diff --git a/defaultenv/bin/update b/defaultenv/bin/update
index 39e7591..96442b1 100644
--- a/defaultenv/bin/update
+++ b/defaultenv/bin/update
@@ -63,7 +63,7 @@ else
 	exit 1
 fi
 
-if [ x${mode} != xtftp -a x${mode} != xxmodem ] ; then
+if [ x${mode} != xtftp -a x${mode} != xxmodem -a x${mode} != xnfs ]; then
 	echo "unsupported mode ${mode}."
 	. /env/bin/_update_help
 	exit 1
-- 
1.7.4.1


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

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

* [PATCH 4/6] ARM: mx3/mx35_3ds: add missing nand device
  2012-01-24 10:51 [PATCH 0/6] update mx35_3ds suppoprt Marc Kleine-Budde
                   ` (2 preceding siblings ...)
  2012-01-24 10:51 ` [PATCH 3/6] defaultenv: update: add nfs support Marc Kleine-Budde
@ 2012-01-24 10:51 ` Marc Kleine-Budde
  2012-01-24 10:51 ` [PATCH 5/6] ARM: mx3/mx35_3ds: increase kernel partition size to 4 MiB Marc Kleine-Budde
  2012-01-24 10:51 ` [PATCH 6/6] ARM: mx3/mx35_3ds: add (optinal) support for flexcan0 Marc Kleine-Budde
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-01-24 10:51 UTC (permalink / raw)
  To: barebox

Otherwise the kernel would not register the nand partitions.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 arch/arm/boards/freescale-mx35-3-stack/env/config |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boards/freescale-mx35-3-stack/env/config b/arch/arm/boards/freescale-mx35-3-stack/env/config
index 17b1e31..fa45812 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/env/config
+++ b/arch/arm/boards/freescale-mx35-3-stack/env/config
@@ -45,6 +45,7 @@ rootfs_mtdblock_nor=3
 
 nand_parts="256k(barebox)ro,512k(bareboxenv),2M(kernel),-(root)"
 rootfs_mtdblock_nand=7
+nand_device=mxc_nand
 
 # set a fancy prompt (if support is compiled in)
 PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m "
-- 
1.7.4.1


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

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

* [PATCH 5/6] ARM: mx3/mx35_3ds: increase kernel partition size to 4 MiB
  2012-01-24 10:51 [PATCH 0/6] update mx35_3ds suppoprt Marc Kleine-Budde
                   ` (3 preceding siblings ...)
  2012-01-24 10:51 ` [PATCH 4/6] ARM: mx3/mx35_3ds: add missing nand device Marc Kleine-Budde
@ 2012-01-24 10:51 ` Marc Kleine-Budde
  2012-01-24 10:51 ` [PATCH 6/6] ARM: mx3/mx35_3ds: add (optinal) support for flexcan0 Marc Kleine-Budde
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-01-24 10:51 UTC (permalink / raw)
  To: barebox

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 arch/arm/boards/freescale-mx35-3-stack/env/config |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/freescale-mx35-3-stack/env/config b/arch/arm/boards/freescale-mx35-3-stack/env/config
index fa45812..9f37348 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/env/config
+++ b/arch/arm/boards/freescale-mx35-3-stack/env/config
@@ -40,10 +40,10 @@ autoboot_timeout=3
 
 bootargs="console=ttymxc0,115200"
 
-nor_parts="256k(barebox)ro,512k(bareboxenv),2M(kernel),-(root)"
+nor_parts="256k(barebox)ro,512k(bareboxenv),4M(kernel),-(root)"
 rootfs_mtdblock_nor=3
 
-nand_parts="256k(barebox)ro,512k(bareboxenv),2M(kernel),-(root)"
+nand_parts="256k(barebox)ro,512k(bareboxenv),4M(kernel),-(root)"
 rootfs_mtdblock_nand=7
 nand_device=mxc_nand
 
-- 
1.7.4.1


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

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

* [PATCH 6/6] ARM: mx3/mx35_3ds: add (optinal) support for flexcan0
  2012-01-24 10:51 [PATCH 0/6] update mx35_3ds suppoprt Marc Kleine-Budde
                   ` (4 preceding siblings ...)
  2012-01-24 10:51 ` [PATCH 5/6] ARM: mx3/mx35_3ds: increase kernel partition size to 4 MiB Marc Kleine-Budde
@ 2012-01-24 10:51 ` Marc Kleine-Budde
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-01-24 10:51 UTC (permalink / raw)
  To: barebox

The i.MX35 processor consists of numerous subsystems, there are
several possibilities to route the internal signals to external BGA
pins and most pins can select several functions. The layout of the
MX35 3 Stack development kit requires the that the RX and TX signals
of the first CAN controller use the I2C2_DAT and I2C2_CLK pin. (The
pins are named after their primary functions.)

On the 3 Stack board these pin can be used for the first USB Host
controller (USBH2), too. This means activating the first CAN, the USB
Host controller needs to be disabled. Several steps are needed:

1) Disable the driver for the USB Controller, just to be sure.

2) Change the pin mux setup, so that the CAN signals are routed CPU
   internally to the pin.

3) Activate the driver for the CAN Controller.

4) Control muxer U85 on the base board, so that the CAN signals reach
   the CAN transceiver.

5) Turn on the CAN transceiver (U77).

---

The signal routing of the first CAN controller (CAN1 according to the
datasheet) consists of two signals: "CAN TX" and "CAN RX".

 +-----------------------------------------+
 | i.MX35                                  |
 |                                         |
 | I2C2_CLK/CAN_TX1/USBH2_PWR/GPIO2_26  L3 |----<CAN_TX1>--------.
 |                                         |                     |
 |  I2C2_DAT/CAN_RX1/USBH2_OC/GPIO2_27  M1 |----<CAN_RX1>----.   |
 |                                         |                 |   |
 |                                         |                 |   |
 +-----------------------------------------+                 |   |
                                     |                       |   |
                                     | <I2C>                 |   |
                                     |                       |   |
                           +-------------------+             |   |
                           | MC9S08DZ60        |             |   |
                           |                   |             |   |
                           |                   |             |   |
                           | PTD0/PID0/TPM2CH0 |             |   |
                           |                   |             |   |
                           |        31         |             |   |
                           +-------------------+             |   |
                                     |                       |   |
                                     | <CAN_PWDN>            |   |
                                     |                       |   |
                                     |                       |   |
                                     | <J28>           <K24> |   | <K23>
                                     |                       |   |
    ^^^^ CPU Board ^^^^              V                       V   V

    VVVV Base Board VVVV             ^                       ^   ^
                                     |                       |   |
                                     | <J28>           <K24> |   | <K23>
                                     |                       |   |
  .----------------------------------+                       |   |
  |                                  |                       |   |
  |                                  | <CAN_PWDN>            |   |
  |                                  |                       |   |
  |                          +-------------+                 |   |
  |                          |PI3USB10 U85 |                 |   |
  |                          |             |                 |   |
  |     ... --<USBH2_PWR>----| 10          |                 |   |
  |                          |             |                 |   |
  |     ... ---<USBH2_OC>----| 9         4 |----<CAN_RX1>----'   |
  |                          |   Muxer     |                     |
  |   .--------<CAN_RX_1>----| 11        3 |----<CAN_TX1>--------'
  |   |                      |             |
  |   |   .----<CAN_TX_1>----| 12          |
  |   |   |                  +-------------+
  |   |   |
  |   |   |
  |   |   |                  +-------------+
  |   |   |                  |TLE6250  U77 |
  |   |   |                  |             |
  |   |   '------------------| 1         7 |----<CANH>---- ...
  |   |                      |   CAN       |
  |   '----------------------| 4         6 |----<CANL>---- ...
  |                          | Transceiver |
  '--------------------------| 8           |
                             |             |
                             +-------------+

The "can tx" signal takes the following route:

CPU Board:  i.MX35 pin L3 - CAN_TX1 - K23
Base Board: K23 - CAN_TX1 - Muxer - CAN_TX_1 - Transceiver

The "can rx" travels accordingly:

CPU Board:  i.MX35 pin M1 - CAN_RX1 - K24
Base Board: K24 - CAN_RX1 - Muxer - CAN_RX_1 - Transceiver

The muxer and the CAN transceiver are enabled by the low active signal
CAN_PWDN, which is in default configuration pulled up by a
resistor. The signal is generated on the CPU Board by a companion chip
MC9S08DZ60 which itself is connected to the CPU via I2C. The routing
of CAN_PWDN follows:

CPU Board:  MC9S08DZ60 Pin 31 - CAN_PWDN - J28
Base Board: J28 - Muxer
            J28 - Transceiver

In order to activate the CAN_PWDN signal the CPU has to modify a
register in the MC9S08DZ60 chip, but the Linux kernel is lacking
support for this chip. However the bootloader "barebox" which is used,
already has a driver.

Pin 31 of the MC9S08DZ60 is controlled via the 2nd bit (bit mask 0x2)
of the GPIO_2 reg.

---

This patch adds Kconfig option to choose between USB and CAN at
compile time. When activating CAN the CAN_PWDN is driven low by pin 31
of MC9S08DZ60, so that the muxer routes the CAN signals to the CAN
transceiver. The CAN transceiver itself is activated by the CAN_PWDN
signal, too.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 arch/arm/boards/freescale-mx35-3-stack/3stack.c |    7 +++++++
 arch/arm/mach-imx/Kconfig                       |    4 ++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boards/freescale-mx35-3-stack/3stack.c b/arch/arm/boards/freescale-mx35-3-stack/3stack.c
index fe17899..5b7f76a 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/3stack.c
+++ b/arch/arm/boards/freescale-mx35-3-stack/3stack.c
@@ -383,11 +383,18 @@ static int f3s_pmic_init_v2(struct mc13892 *mc13892)
 	return err;
 }
 
+#ifdef CONFIG_MACH_FREESCALE_MX35_3STACK_CAN
+#define MX35PDK_GPIO2_CAN_VAL	(0x0)
+#else
+#define MX35PDK_GPIO2_CAN_VAL	(0x2)
+#endif
+
 static int f3s_pmic_init_all(struct mc9sdz60 *mc9sdz60)
 {
 	int err = 0;
 
 	err |= mc9sdz60_set_bits(mc9sdz60, MC9SDZ60_REG_GPIO_1, 0x04, 0x04);
+	err |= mc9sdz60_set_bits(mc9sdz60, MC9SDZ60_REG_GPIO_2, 0x02, MX35PDK_GPIO2_CAN_VAL);
 
 	err |= mc9sdz60_set_bits(mc9sdz60, MC9SDZ60_REG_RESET_1, 0x80, 0x00);
 	mdelay(200);
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index a4b603b..59f8def 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -462,6 +462,10 @@ config FREESCALE_MX25_3STACK_SDRAM_128MB_MDDR
 	bool "128 MB (mDDR)"
 endchoice
 endif
+if MACH_FREESCALE_MX35_3STACK
+config MACH_FREESCALE_MX35_3STACK_CAN
+	bool "activate CAN instead of USB"
+endif
 endmenu
 
 menu "i.MX specific settings        "
-- 
1.7.4.1


_______________________________________________
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:[~2012-01-24 10:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-24 10:51 [PATCH 0/6] update mx35_3ds suppoprt Marc Kleine-Budde
2012-01-24 10:51 ` [PATCH 1/6] net/nfs: increase timeout to 15 seconds Marc Kleine-Budde
2012-01-24 10:51 ` [PATCH 2/6] show_progress: fix progress bar for files > 32 MiB Marc Kleine-Budde
2012-01-24 10:51 ` [PATCH 3/6] defaultenv: update: add nfs support Marc Kleine-Budde
2012-01-24 10:51 ` [PATCH 4/6] ARM: mx3/mx35_3ds: add missing nand device Marc Kleine-Budde
2012-01-24 10:51 ` [PATCH 5/6] ARM: mx3/mx35_3ds: increase kernel partition size to 4 MiB Marc Kleine-Budde
2012-01-24 10:51 ` [PATCH 6/6] ARM: mx3/mx35_3ds: add (optinal) support for flexcan0 Marc Kleine-Budde

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