Skip to contentSkip to conversation

odroid: Update README with USB host usage

PATCH New Suriyan Ramasami 4 participants 6 messages Nov 21, 2014 – Nov 24, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 odroid: Update README with USB host usage

Add information wrt using the USB host interface for loading kernel over ethernet and/or usb mass storage.

---

Changes in v2:
- Make updates to be of use from a user's perspective
Series-changes: 1
- Add USB host notes for the Odroid

 doc/README.odroid | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 169 insertions(+)
doc/README.odroid +169 -0
index 528bb95..25b962b 100644
@@ -141,3 +141,172 @@ And the boot sequence is:
 - boot_fit - if "Image.itb" exists
 - boot_zimg - if "zImage" exists
 - boot_uimg - if "uImage" exists
+
+11. USB host support
+====================
+
+The ethernet can be accessed after starting the USB subsystem in U-Boot.
+The adapter does not come with a preconfigured MAC address, and hence it needs
+to be set before starting USB.
+setenv usbethaddr 02:DE:AD:BE:EF:FF
+
+Note that in this example a locally managed MAC address is chosen. Care should
+be taken to make these MAC addresses unique within the same subnet.
+
+Start the USB subsystem:
+Odroid # setenv usbethaddr 02:DE:AD:BE:EF:FF
+Odroid # usb start
+(Re)start USB...
+USB0:   USB EHCI 1.00
+scanning bus 0 for devices... 4 USB Device(s) found
+       scanning usb for storage devices... 1 Storage Device(s) found
+       scanning usb for ethernet devices... 1 Ethernet Device(s) found
+Odroid #
+
+Automatic IP assignment:
+------------------------
+If the ethernet is connected to a DHCP server (router maybe with DHCP enabled),
+then the below will automatically assign an ip address through DHCP.
+setenv autoload no
+dhcp
+
+Odroid # setenv autoload no
+Odroid # dhcp
+Waiting for Ethernet connection... done.
+BOOTP broadcast 1
+DHCP client bound to address 192.168.1.10 (524 ms)
+Odroid #
+
+Note that this automatically sets the many IP address related variables in
+U-Boot that is obtained from the DHCP server.
+
+Odroid # printenv ipaddr netmask gatewayip dnsip
+ipaddr=192.168.1.10
+netmask=255.255.255.0
+gatewayip=192.168.1.1
+dnsip=192.168.1.1
+
+Ping example:
+The ping command can be used a test to check connectivity. In this example,
+192.168.1.27 is a pingable server in the network.
+Odroid # ping 192.168.1.27
+Waiting for Ethernet connection... done.
+Using sms0 device
+host 192.168.1.27 is alive
+Odroid #
+
+Static IP assignment:
+---------------------
+In the case where there are no DHCP servers in the network, or you want to
+set the IP address statically, it can be done by:
+Odroid # setenv ipaddr 192.168.1.10
+Odroid # ping 192.168.1.27
+Waiting for Ethernet connection... done.
+Using sms0 device
+host 192.168.1.27 is alive
+
+TFTP booting:
+-------------
+Say there exists a tftp server in the network with address 192.168.1.27 and
+it serves a kernel image (zImage.3.17) and a DTB blob (exynos4412-odroidu3.dtb)
+that needs to be loaded and booted. It can be accomplished as below:
+(Assumes that you have setenv usbethaddr, and have not set autoload to no)
+
+Odroid # setenv serverip 192.168.1.27
+Odroid # tftpboot 0x40080000 zImage.3.17
+Waiting for Ethernet connection... done.
+Using sms0 device
+TFTP from server 192.168.1.27; our IP address is 192.168.1.10
+Filename 'zImage.3.17'.
+Load address: 0x40080000
+Loading: #################################################################
+	 #################################################################
+	 #################################################################
+	 #######################
+	 52.7 KiB/s
+done
+Bytes transferred = 3194200 (30bd58 hex)
+Odroid # tftpboot 0x42000000 exynos4412-odroidu3.dtb
+Waiting for Ethernet connection... done.
+Using sms0 device
+TFTP from server 192.168.1.27; our IP address is 192.168.1.10
+Filename 'exynos4412-odroidu3.dtb'.
+Load address: 0x42000000
+Loading: ####
+	 40 KiB/s
+done
+Bytes transferred = 46935 (b757 hex)
+Odroid # printenv bootargs
+bootargs=Please use defined boot
+Odroid # setenv bootargs console=ttySAC1,115200n8 root=/dev/mmcblk0p2 rootwait
+Odroid # bootz 40080000 - 42000000
+Kernel image @ 0x40080000 [ 0x000000 - 0x30bd58 ]
+## Flattened Device Tree blob at 42000000
+   Booting using the fdt blob at 0x42000000
+   Loading Device Tree to 4fff1000, end 4ffff756 ... OK
+
+Starting kernel ...
+
+[    0.000000] Booting Linux on physical CPU 0xa00
+... etc ...
+
+In the above example you can substitute 'dhcp' for 'tftpboot' as well.
+
+USB Storage booting:
+--------------------
+Similarly we can use the USB storage to load the kernel image/initrd/fdt etc
+and boot. For this example, there is a USB drive plugged in. It has a FAT
+1st partition and an EXT 2nd partition. Using the generic FS (ls/load) makes
+it even easier to work with FAT/EXT file systems.
+For this example the second EXT partition is used for booting and as rootfs.
+The boot files - kernel and the dtb are present in the /boot directory of the
+second partition.
+
+Odroid # usb start
+(Re)start USB...
+USB0:   USB EHCI 1.00
+scanning bus 0 for devices... 4 USB Device(s) found
+       scanning usb for storage devices... 1 Storage Device(s) found
+       scanning usb for ethernet devices...
+Error: sms0 address not set.		<----- Note the error as usbethaddr
+Warning: failed to set MAC address	<----- is not set.
+1 Ethernet Device(s) found
+Odroid # usb part 0
+
+Partition Map for USB device 0  --   Partition Type: DOS
+
+Part	Start Sector	Num Sectors	UUID		Type
+  1	3072      	263168    	000c4046-01	06
+  2	266240    	13457408  	000c4046-02	83
+
+Odroid # ls usb 0:2 /boot
+<DIR>       4096 .
+<DIR>       4096 ..
+             353 boot.scr
+             281 boot.txt
+          101420 config-3.8.13.23
+         2127254 initrd.img-3.8.13.23
+         2194825 uInitrd
+         2194825 uInitrd-3.8.13.23
+         2453112 zImage
+          101448 config-3.8.13.26
+         2127670 uInitrd-3.8.13.26
+         2127606 initrd.img-3.8.13.26
+         3194200 zImage.3.17                    <--- Kernel
+           46935 exynos4412-odroidu3.dtb        <--- DTB
+Odroid # load usb 0:2 40080000 /boot/zImage.3.17
+3194200 bytes read in 471 ms (6.5 MiB/s)
+Odroid # load usb 0:2 42000000 /boot/exynos4412-odroidu3.dtb
+46935 bytes read in 233 ms (196.3 KiB/s)
+Odroid # setenv bootargs console=ttySAC1,115200n8 root=/dev/sda2 rootwait
+Odroid # bootz 40080000 - 42000000
+Kernel image @ 0x40080000 [ 0x000000 - 0x30bd58 ]
+## Flattened Device Tree blob at 42000000
+   Booting using the fdt blob@0x42000000
+   Loading Device Tree to 4fff1000, end 4ffff756 ... OK
+
+Starting kernel ...
+
+[    0.000000] Booting Linux on physical CPU 0xa00
+
+Please refer to README.usb for additional information.
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 2/2 odroid: usbhost - Add missing gpio_request call

The USB host code was missing gpio_request() calls before using the gpio functions, causing errors to be printed out.

As a side note calls to max77686_set_buck_mode(OPMODE_OFF/OPMODE_ON) have been removed, as they did not have any effect. This is as per Przemyslaw:
I looked into the documentation and there is a "ENB8" pin in PMIC package. This pin allows steering BUCK8 ON/OFF by the hardware. If ENB8 is set to low then you can do on/off. If high, then you cannot change its state by I2C write, which seems to be the case with the Odroids.

---

Changes in v2:
- Add comment why max77686_set_buck_mode() has been removed
Series-changes: 1
- Added gpio_request() call in board_gpio_init()

 board/samsung/odroid/odroid.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
board/samsung/odroid/odroid.c +11 -2
index f7396ab..a2c008e 100644
@@ -382,6 +382,17 @@ static void board_gpio_init(void)
 	gpio_set_pull(EXYNOS4X12_GPIO_X31, S5P_GPIO_PULL_UP);
 	gpio_set_drv(EXYNOS4X12_GPIO_X31, S5P_GPIO_DRV_4X);
 	gpio_direction_input(EXYNOS4X12_GPIO_X31);
+
+#ifdef CONFIG_CMD_USB
+	/* USB3503A Reference frequency */
+	gpio_request(EXYNOS4X12_GPIO_X30, "USB3503A RefFreq");
+
+	/* USB3503A Connect */
+	gpio_request(EXYNOS4X12_GPIO_X34, "USB3503A Connect");
+
+	/* USB3503A Reset */
+	gpio_request(EXYNOS4X12_GPIO_X35, "USB3503A Reset");
+#endif
 }
 
 static int pmic_init_max77686(void)
@@ -489,10 +500,8 @@ int board_usb_init(int index, enum usb_init_type init)
 
 	p_pmic = pmic_get("MAX77686_PMIC");
 	if (p_pmic && !pmic_probe(p_pmic)) {
-		max77686_set_buck_mode(p_pmic, 8, OPMODE_OFF);
 		max77686_set_buck_voltage(p_pmic, 8, 750000);
 		max77686_set_buck_voltage(p_pmic, 8, 3300000);
-		max77686_set_buck_mode(p_pmic, 8, OPMODE_ON);
 	}
 
 #endif
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v2 2/2 odroid: usbhost - Add missing gpio_request call

Quoted 10 lines · Suriyan Ramasami

The USB host code was missing gpio_request() calls before using the gpio functions, causing errors to be printed out.

As a side note calls to max77686_set_buck_mode(OPMODE_OFF/OPMODE_ON) have been removed, as they did not have any effect. This is as per Przemyslaw:
I looked into the documentation and there is a "ENB8" pin in PMIC package. This pin allows steering BUCK8 ON/OFF by the hardware. If ENB8 is set to low then you can do on/off. If high, then you cannot change its state by I2C write, which seems to be the case with the Odroids.

Quoted 2 lines

Tested on top of u-boot-samsung head (6a23c6533c880d557e786df81fa21b62168db6d9), with this patch ethernet support work on my Odroid X2 (emmc boot). Free free to add,

Quoted 33 lines

---

Changes in v2:
- Add comment why max77686_set_buck_mode() has been removed
Series-changes: 1
- Added gpio_request() call in board_gpio_init()

 board/samsung/odroid/odroid.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
board/samsung/odroid/odroid.c +11 -0
index f7396ab..a2c008e 100644
@@ -382,6 +382,17 @@ static void board_gpio_init(void)
 	gpio_set_pull(EXYNOS4X12_GPIO_X31, S5P_GPIO_PULL_UP);
 	gpio_set_drv(EXYNOS4X12_GPIO_X31, S5P_GPIO_DRV_4X);
 	gpio_direction_input(EXYNOS4X12_GPIO_X31);
+
+#ifdef CONFIG_CMD_USB
+	/* USB3503A Reference frequency */
+	gpio_request(EXYNOS4X12_GPIO_X30, "USB3503A RefFreq");
+
+	/* USB3503A Connect */
+	gpio_request(EXYNOS4X12_GPIO_X34, "USB3503A Connect");
+
+	/* USB3503A Reset */
+	gpio_request(EXYNOS4X12_GPIO_X35, "USB3503A Reset");
+#endif
 }
 
 static int pmic_init_max77686(void)

board/samsung/odroid/odroid.c int board_usb_init(int index, enum usb_init_type init) · line 507

Quoted 10 lines
board/samsung/odroid/odroid.c +0 -2
@@ -489,10 +500,8 @@ int board_usb_init(int index, enum usb_init_type init)
 
 	p_pmic = pmic_get("MAX77686_PMIC");
 	if (p_pmic && !pmic_probe(p_pmic)) {
-		max77686_set_buck_mode(p_pmic, 8, OPMODE_OFF);
 		max77686_set_buck_voltage(p_pmic, 8, 750000);
 		max77686_set_buck_voltage(p_pmic, 8, 3300000);
-		max77686_set_buck_mode(p_pmic, 8, OPMODE_ON);
 	}
 
 #endif

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6170 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141121/0f3846d6/attachment.bin>

#3 lore raw

PATCH v2 2/2 odroid: usbhost - Add missing gpio_request call

In reply to Suriyan Ramasami
Quoted 14 lines · Suriyan Ramasami

The USB host code was missing gpio_request() calls before using the gpio functions, causing errors to be printed out.

As a side note calls to max77686_set_buck_mode(OPMODE_OFF/OPMODE_ON) have been removed, as they did not have any effect. This is as per Przemyslaw:
I looked into the documentation and there is a "ENB8" pin in PMIC package. This pin allows steering BUCK8 ON/OFF by the vhardware. If ENB8 is set to low then you can do on/off. If high, then you cannot change its state by I2C write, which seems to be the case with the Odroids.

---

Quoted 8 lines

Changes in v2:
- Add comment why max77686_set_buck_mode() has been removed
Series-changes: 1
- Added gpio_request() call in board_gpio_init()

 board/samsung/odroid/odroid.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

#4 lore raw

PATCH v2 1/2 odroid: Update README with USB host usage

In reply to Suriyan Ramasami

Hello Suriyan,

Quoted 182 lines · Suriyan Ramasami

Add information wrt using the USB host interface for loading kernel over ethernet and/or usb mass storage.

---

Changes in v2:
- Make updates to be of use from a user's perspective
Series-changes: 1
- Add USB host notes for the Odroid

  doc/README.odroid | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 169 insertions(+)
doc/README.odroid +159 -0
index 528bb95..25b962b 100644
@@ -141,3 +141,172 @@ And the boot sequence is:
  - boot_fit - if "Image.itb" exists
  - boot_zimg - if "zImage" exists
  - boot_uimg - if "uImage" exists
+
+11. USB host support
+====================
+
+The ethernet can be accessed after starting the USB subsystem in U-Boot.
+The adapter does not come with a preconfigured MAC address, and hence it needs
+to be set before starting USB.
+setenv usbethaddr 02:DE:AD:BE:EF:FF
+
+Note that in this example a locally managed MAC address is chosen. Care should
+be taken to make these MAC addresses unique within the same subnet.
+
+Start the USB subsystem:
+Odroid # setenv usbethaddr 02:DE:AD:BE:EF:FF
+Odroid # usb start
+(Re)start USB...
+USB0:   USB EHCI 1.00
+scanning bus 0 for devices... 4 USB Device(s) found
+       scanning usb for storage devices... 1 Storage Device(s) found
+       scanning usb for ethernet devices... 1 Ethernet Device(s) found
+Odroid #
+
+Automatic IP assignment:
+------------------------
+If the ethernet is connected to a DHCP server (router maybe with DHCP enabled),
+then the below will automatically assign an ip address through DHCP.
+setenv autoload no
+dhcp
+
+Odroid # setenv autoload no
+Odroid # dhcp
+Waiting for Ethernet connection... done.
+BOOTP broadcast 1
+DHCP client bound to address 192.168.1.10 (524 ms)
+Odroid #
+
+Note that this automatically sets the many IP address related variables in
+U-Boot that is obtained from the DHCP server.
+
+Odroid # printenv ipaddr netmask gatewayip dnsip
+ipaddr=192.168.1.10
+netmask=255.255.255.0
+gatewayip=192.168.1.1
+dnsip=192.168.1.1
+
+Ping example:
+The ping command can be used a test to check connectivity. In this example,
+192.168.1.27 is a pingable server in the network.
+Odroid # ping 192.168.1.27
+Waiting for Ethernet connection... done.
+Using sms0 device
+host 192.168.1.27 is alive
+Odroid #
+
+Static IP assignment:
+---------------------
+In the case where there are no DHCP servers in the network, or you want to
+set the IP address statically, it can be done by:
+Odroid # setenv ipaddr 192.168.1.10
+Odroid # ping 192.168.1.27
+Waiting for Ethernet connection... done.
+Using sms0 device
+host 192.168.1.27 is alive
+
+TFTP booting:
+-------------
+Say there exists a tftp server in the network with address 192.168.1.27 and
+it serves a kernel image (zImage.3.17) and a DTB blob (exynos4412-odroidu3.dtb)
+that needs to be loaded and booted. It can be accomplished as below:
+(Assumes that you have setenv usbethaddr, and have not set autoload to no)
+
+Odroid # setenv serverip 192.168.1.27
+Odroid # tftpboot 0x40080000 zImage.3.17
+Waiting for Ethernet connection... done.
+Using sms0 device
+TFTP from server 192.168.1.27; our IP address is 192.168.1.10
+Filename 'zImage.3.17'.
+Load address: 0x40080000
+Loading: #################################################################
+	 #################################################################
+	 #################################################################
+	 #######################
+	 52.7 KiB/s
+done
+Bytes transferred = 3194200 (30bd58 hex)
+Odroid # tftpboot 0x42000000 exynos4412-odroidu3.dtb
+Waiting for Ethernet connection... done.
+Using sms0 device
+TFTP from server 192.168.1.27; our IP address is 192.168.1.10
+Filename 'exynos4412-odroidu3.dtb'.
+Load address: 0x42000000
+Loading: ####
+	 40 KiB/s
+done
+Bytes transferred = 46935 (b757 hex)
+Odroid # printenv bootargs
+bootargs=Please use defined boot
+Odroid # setenv bootargs console=ttySAC1,115200n8 root=/dev/mmcblk0p2 rootwait
+Odroid # bootz 40080000 - 42000000
+Kernel image @ 0x40080000 [ 0x000000 - 0x30bd58 ]
+## Flattened Device Tree blob at 42000000
+   Booting using the fdt blob at 0x42000000
+   Loading Device Tree to 4fff1000, end 4ffff756 ... OK
+
+Starting kernel ...
+
+[    0.000000] Booting Linux on physical CPU 0xa00
+... etc ...
+
+In the above example you can substitute 'dhcp' for 'tftpboot' as well.
+
+USB Storage booting:
+--------------------
+Similarly we can use the USB storage to load the kernel image/initrd/fdt etc
+and boot. For this example, there is a USB drive plugged in. It has a FAT
+1st partition and an EXT 2nd partition. Using the generic FS (ls/load) makes
+it even easier to work with FAT/EXT file systems.
+For this example the second EXT partition is used for booting and as rootfs.
+The boot files - kernel and the dtb are present in the /boot directory of the
+second partition.
+
+Odroid # usb start
+(Re)start USB...
+USB0:   USB EHCI 1.00
+scanning bus 0 for devices... 4 USB Device(s) found
+       scanning usb for storage devices... 1 Storage Device(s) found
+       scanning usb for ethernet devices...
+Error: sms0 address not set.		<----- Note the error as usbethaddr
+Warning: failed to set MAC address	<----- is not set.
+1 Ethernet Device(s) found
+Odroid # usb part 0
+
+Partition Map for USB device 0  --   Partition Type: DOS
+
+Part	Start Sector	Num Sectors	UUID		Type
+  1	3072      	263168    	000c4046-01	06
+  2	266240    	13457408  	000c4046-02	83
+
+Odroid # ls usb 0:2 /boot
+<DIR>       4096 .
+<DIR>       4096 ..
+             353 boot.scr
+             281 boot.txt
+          101420 config-3.8.13.23
+         2127254 initrd.img-3.8.13.23
+         2194825 uInitrd
+         2194825 uInitrd-3.8.13.23
+         2453112 zImage
+          101448 config-3.8.13.26
+         2127670 uInitrd-3.8.13.26
+         2127606 initrd.img-3.8.13.26
+         3194200 zImage.3.17                    <--- Kernel
+           46935 exynos4412-odroidu3.dtb        <--- DTB
+Odroid # load usb 0:2 40080000 /boot/zImage.3.17
+3194200 bytes read in 471 ms (6.5 MiB/s)
+Odroid # load usb 0:2 42000000 /boot/exynos4412-odroidu3.dtb
+46935 bytes read in 233 ms (196.3 KiB/s)
+Odroid # setenv bootargs console=ttySAC1,115200n8 root=/dev/sda2 rootwait
+Odroid # bootz 40080000 - 42000000

doc/README.odroid And the boot sequence is: · line 312

Quoted 10 lines
doc/README.odroid +10 -0
+Kernel image @ 0x40080000 [ 0x000000 - 0x30bd58 ]
+## Flattened Device Tree blob at 42000000
+   Booting using the fdt blob at 0x42000000
+   Loading Device Tree to 4fff1000, end 4ffff756 ... OK
+
+Starting kernel ...
+
+[    0.000000] Booting Linux on physical CPU 0xa00
+
+Please refer to README.usb for additional information.

This is a very complete instruction. Thank you for a great job!

Best regards,

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#5 lore raw

PATCH v2 1/2 odroid: Update README with USB host usage

In reply to Suriyan Ramasami
Quoted 6 lines · Suriyan Ramasami

Add information wrt using the USB host interface for loading kernel over ethernet and/or usb mass storage.

---

Quoted 8 lines

Changes in v2:
- Make updates to be of use from a user's perspective
Series-changes: 1
- Add USB host notes for the Odroid

 doc/README.odroid | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 169 insertions(+)

applied to u-boot-samsung.

Thanks,
Minkyu Kang.