mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* imx6ul (phytec Segin board) USB/DFU
@ 2018-11-28 14:53 Erwin Rol
  2018-11-28 15:59 ` Ladislav Michl
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Erwin Rol @ 2018-11-28 14:53 UTC (permalink / raw)
  To: Barebox List

Hallo All,

I am trying to get USB device (DFU) to work on my Phytec Segin board
(imx6ul SOC). 

I can upload barebox with imx-usb-loader and it starts fine (so USB
hardware is working)

Than when barebox runs I want to put that same USB port in DFU mode and
update the nand flash (barebox, env, kernel, rootfs) via DFU.

But I can't get it to work, I assume USB device mode setup is missing
from the board setup, but I can't really find info on how to add it.

Any hints are very welcome.

- Erwin


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

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

* Re: imx6ul (phytec Segin board) USB/DFU
  2018-11-28 14:53 imx6ul (phytec Segin board) USB/DFU Erwin Rol
@ 2018-11-28 15:59 ` Ladislav Michl
  2018-11-29 10:59 ` Sascha Hauer
  2018-11-29 11:28 ` Jan Lübbe
  2 siblings, 0 replies; 4+ messages in thread
From: Ladislav Michl @ 2018-11-28 15:59 UTC (permalink / raw)
  To: Erwin Rol; +Cc: Barebox List

On Wed, Nov 28, 2018 at 03:53:45PM +0100, Erwin Rol wrote:
> Hallo All,
> 
> I am trying to get USB device (DFU) to work on my Phytec Segin board
> (imx6ul SOC). 
> 
> I can upload barebox with imx-usb-loader and it starts fine (so USB
> hardware is working)
> 
> Than when barebox runs I want to put that same USB port in DFU mode and
> update the nand flash (barebox, env, kernel, rootfs) via DFU.
> 
> But I can't get it to work, I assume USB device mode setup is missing
> from the board setup, but I can't really find info on how to add it.
> 
> Any hints are very welcome.

For custom AT91 based board I did:

$ cat arch/arm/boards/simear4/env/nv/usbgadget.dfu_function 
/dev/dataflash0.at91bootstrap(bootstrap)sr,/dev/dataflash0.barebox(bootloader)sr,/dev/nand0.bb(system)ru
EOF

$ cat arch/arm/boards/simear4/env/init/usbgadget 
#!/bin/sh

if [ ${fffa4000.gadget@fffa4000.vbus} != 1 ]
then
	echo "No USB Device cable plugged, normal boot"
	exit 0
fi

echo "USB Device cable plugged, waiting for DFU button"

global.autoboot_timeout=60

dfu_button=79
dfu=0

if gpio_get_value ${dfu_button}
then
	dfu=1
else
	timeout -s -a 1
	if gpio_get_value ${dfu_button}
	then
		dfu=1
	fi
fi

if [ ${dfu} -eq 1 ]
then
	led green 1
	led red 1
	echo "Activating DFU"
	usbgadget -a -D
else
	led green 1
	echo "Activating USB console"
	usbgadget -a
fi
EOF

Note that current DFU implemetation does not follow DFU 1.1 specification,
that's something courious reader should fix ;-)

	ladis

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

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

* Re: imx6ul (phytec Segin board) USB/DFU
  2018-11-28 14:53 imx6ul (phytec Segin board) USB/DFU Erwin Rol
  2018-11-28 15:59 ` Ladislav Michl
@ 2018-11-29 10:59 ` Sascha Hauer
  2018-11-29 11:28 ` Jan Lübbe
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2018-11-29 10:59 UTC (permalink / raw)
  To: Erwin Rol; +Cc: Barebox List

Hi Erwin,

On Wed, Nov 28, 2018 at 03:53:45PM +0100, Erwin Rol wrote:
> Hallo All,
> 
> I am trying to get USB device (DFU) to work on my Phytec Segin board
> (imx6ul SOC). 
> 
> I can upload barebox with imx-usb-loader and it starts fine (so USB
> hardware is working)
> 
> Than when barebox runs I want to put that same USB port in DFU mode and
> update the nand flash (barebox, env, kernel, rootfs) via DFU.
> 
> But I can't get it to work, I assume USB device mode setup is missing
> from the board setup, but I can't really find info on how to add it.

First check the dr_mode property in you OTG device tree node. It should
be either "peripheral" or "otg". If it's "otg" then you have to do a
otg.mode=peripheral on the command line for your device to show up.

Note that newer versions of dfu-util do not work with barebox. I never
tracked this down unfortunately. More specifically this one is the
evil commit:

commit 377f6f136d3369529f44578acaeee82d7c7d7af9 (breaks-barebox,
refs/bisect/bad)
Author: Paul Fertser <fercerpav@gmail.com>
Date:   Sun Aug 10 14:26:05 2014 +0400

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: imx6ul (phytec Segin board) USB/DFU
  2018-11-28 14:53 imx6ul (phytec Segin board) USB/DFU Erwin Rol
  2018-11-28 15:59 ` Ladislav Michl
  2018-11-29 10:59 ` Sascha Hauer
@ 2018-11-29 11:28 ` Jan Lübbe
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Lübbe @ 2018-11-29 11:28 UTC (permalink / raw)
  To: Erwin Rol, Barebox List

On Wed, 2018-11-28 at 15:53 +0100, Erwin Rol wrote:
> Than when barebox runs I want to put that same USB port in DFU mode
> and update the nand flash (barebox, env, kernel, rootfs) via DFU.

If using DFU isn't a strict requirement, fastboot might be a better
alternative (support for barebox-update, ubiformat, command execution,
widely available host tool).

Regards,
Jan
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

end of thread, other threads:[~2018-11-29 11:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28 14:53 imx6ul (phytec Segin board) USB/DFU Erwin Rol
2018-11-28 15:59 ` Ladislav Michl
2018-11-29 10:59 ` Sascha Hauer
2018-11-29 11:28 ` Jan Lübbe

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