Skip to contentSkip to conversation

Odroid U3 usb initialization

RFC New Anand Moon 5 participants 30 messages Apr 1, 2019 – Apr 4, 2019

Subsystems (3)
lore
Share & tools
lore

Anand Moon

author
#0 lore raw

cover Odroid U3 usb initialization

Odroid u3 had the issue like ethernet would not get initialize from the u-boot with "usb start" command.

These changes are based on following work done by Tobias Jakobi

[0] https://github.com/tobiasjakobi/u-boot/commit/77a1142eb0aac08464398ef053d66dbf42b42486

These changes tried to address the issue of initialization of usb devices.

Below is the command I have used for testing.

Tested on Odroid U3+
Other board need to tested as I dnot have them.

----------------------------------------------
U-Boot 2019.04-rc4-00089-ga5515f5f60 (Apr 01 2019 - 11:11:59 +0000)

CPU:   Exynos4412 @ 1 GHz
Model: Odroid based on Exynos4412
Type:  u3
DRAM:  2 GiB
LDO20 at VDDQ_EMMC_1.8V: set 1800000 uV; enabling
LDO22 at VDDQ_EMMC_2.8V: set 2800000 uV; enabling
LDO21 at TFLASH_2.8V: set 2800000 uV; enabling
MMC:   SAMSUNG SDHCI: 1, EXYNOS DWMMC: 0

Loading Environment from MMC... Card did not respond to voltage select! *** Warning - No block device, using default environment

Net:   No ethernet found.
Hit any key to stop autoboot:  0

Odroid #
Odroid # usb start
starting 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 # usb reset
resetting 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 # usb info
1: Hub, USB Revision 2.0
- u-boot EHCI Host Controller
- Class: Hub
- PacketSize: 64 Configurations: 1
- Vendor: 0x0000 Product 0x0000 Version 1.0
Configuration: 1
- Interfaces: 1 Self Powered 0mA
Interface: 0
- Alternate Setting 0, Endpoints: 1
- Class Hub
- Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms

2: Vendor specific, USB Revision 2.0
- Class: Vendor specific
- PacketSize: 64 Configurations: 1
- Vendor: 0x0424 Product 0x9730 Version 1.0
Configuration: 1
- Interfaces: 1 Bus Powered 500mA
Interface: 0
- Alternate Setting 0, Endpoints: 3
- Class Vendor specific
- Endpoint 1 In Bulk MaxPacket 512
- Endpoint 2 Out Bulk MaxPacket 512
- Endpoint 3 In Interrupt MaxPacket 16 Interval 4ms

3: Hub, USB Revision 2.0
- Class: Hub
- PacketSize: 64 Configurations: 1
- Vendor: 0x0424 Product 0x3503 Version 161.160
Configuration: 1
- Interfaces: 1 Self Powered Remote Wakeup 2mA
Interface: 0
- Alternate Setting 0, Endpoints: 1
- Class Hub
- Endpoint 1 In Interrupt MaxPacket 1 Interval 12ms
- Endpoint 1 In Interrupt MaxPacket 1 Interval 12ms

4: Mass Storage, USB Revision 2.10
- JMicron JMS567 DB12345678A3
- Class: (from Interface) Mass Storage
- PacketSize: 64 Configurations: 1
- Vendor: 0x152d Product 0x0578 Version 99.1
Configuration: 1
- Interfaces: 1 Self Powered 30mA
Interface: 0
- Alternate Setting 0, Endpoints: 2
- Class Mass Storage, Transp. SCSI, Bulk only
- Endpoint 1 In Bulk MaxPacket 512
- Endpoint 2 Out Bulk MaxPacket 512
- Endpoint 1 Out Bulk MaxPacket 512
- Endpoint 2 In Bulk MaxPacket 512
- Endpoint 3 In Bulk MaxPacket 512
- Endpoint 4 Out Bulk MaxPacket 512

Odroid # reset
resetting ...

U-Boot 2019.04-rc4-00089-ga5515f5f60 (Apr 01 2019 - 11:11:59 +0000)

----------------------

Anand Moon (6):
odroid: exynos: USB initialization on the U3/X2
odroid: exynos: usb clean up for U3/X2
usb: exynos: add init_after_reset for usb reset
configs: exynos: Add new CONFIG_SYS_ODROID_USB config option
arm: exynos: odroid: fix the confict scripaddr extra env setting
arm: exynos: add usbnet_devaddr setting to env

 board/samsung/common/board.c   |  4 ++--
 board/samsung/odroid/Kconfig   |  3 +++
 board/samsung/odroid/odroid.c  | 19 ++++++++++++++-----
 drivers/usb/host/ehci-exynos.c | 33 ++++++++++++++++++++++++++++++++-
 include/configs/odroid.h       |  6 +++++-
 5 files changed, 56 insertions(+), 9 deletions(-)
Signature · 1 line
2.21.0
author
#1 lore raw

RFC 1/6 odroid: exynos: USB initialization on the U3/X2

From: Tobias Jakobi <[email protected]>

Rename board_usb_init() to exynos_usb_init() and call it early in the Exynos EHCI driver when probing.

This kind of works. After a 'usb start; usb stop; usb start' cycle the attached devices are recognized.

Add small delay between gpio_direction_output to stable initialization of usb gpio pins.

---
Reoder the exynos_usb_init so that "usb start" command initialization correcly.
---

---
 board/samsung/odroid/odroid.c  | 14 +++++++++-----
 drivers/usb/host/ehci-exynos.c |  7 +++++++
 2 files changed, 16 insertions(+), 5 deletions(-)
board/samsung/odroid/odroid.c +9 -5
index 3e594fd850..79d14ead01 100644
@@ -468,8 +468,6 @@ struct dwc2_plat_otg_data s5pc210_otg_data = {
 };
 #endif
 
-#if defined(CONFIG_USB_GADGET) || defined(CONFIG_CMD_USB)
-
 static void set_usb3503_ref_clk(void)
 {
 #ifdef CONFIG_BOARD_TYPES
@@ -490,9 +488,8 @@ static void set_usb3503_ref_clk(void)
 #endif /* CONFIG_BOARD_TYPES */
 }
 
-int board_usb_init(int index, enum usb_init_type init)
+int exynos_usb_init(void)
 {
-#ifdef CONFIG_CMD_USB
 	struct udevice *dev;
 	int ret;
 
@@ -501,6 +498,7 @@ int board_usb_init(int index, enum usb_init_type init)
 	/* Disconnect, Reset, Connect */
 	gpio_direction_output(EXYNOS4X12_GPIO_X34, 0);
 	gpio_direction_output(EXYNOS4X12_GPIO_X35, 0);
+	sdelay(200000);
 	gpio_direction_output(EXYNOS4X12_GPIO_X35, 1);
 	gpio_direction_output(EXYNOS4X12_GPIO_X34, 1);
 
@@ -530,7 +528,13 @@ int board_usb_init(int index, enum usb_init_type init)
 		pr_err("Regulator %s value setting error: %d\n", dev->name, ret);
 		return ret;
 	}
-#endif
+
+	return 0;
+}
+
+#ifdef CONFIG_USB_GADGET
+int board_usb_init(int index, enum usb_init_type init)
+{
 	debug("USB_udc_probe\n");
 	return dwc2_udc_probe(&s5pc210_otg_data);
 }
drivers/usb/host/ehci-exynos.c +7 -0
index fabc662eb6..b0f7bd4936 100644
@@ -31,6 +31,8 @@ struct exynos_ehci_platdata {
 	struct gpio_desc vbus_gpio;
 };
 
+extern int exynos_usb_init(void);
+
 /**
  * Contains pointers to register base addresses
  * for the usb controller.
@@ -152,6 +154,11 @@ static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb)
 	setbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
 	udelay(10);
 	clrbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
+
+	/*
+	 * "usb start" initialize the usb driver
+	 */
+	exynos_usb_init();
 }
 
 static void setup_usb_phy(struct exynos_usb_phy *usb)
Signature · 1 line
2.21.0
#2 lore raw

RFC 1/6 odroid: exynos: USB initialization on the U3/X2

Quoted 48 lines · Anand Moon

From: Tobias Jakobi <[email protected]>

Rename board_usb_init() to exynos_usb_init() and call it early in the Exynos EHCI driver when probing.

This kind of works. After a 'usb start; usb stop; usb start' cycle the attached devices are recognized.

Add small delay between gpio_direction_output to stable initialization of usb gpio pins.

---
Reoder the exynos_usb_init so that "usb start" command initialization correcly.
---

---
 board/samsung/odroid/odroid.c  | 14 +++++++++-----
 drivers/usb/host/ehci-exynos.c |  7 +++++++
 2 files changed, 16 insertions(+), 5 deletions(-)
board/samsung/odroid/odroid.c +1 -4
index 3e594fd850..79d14ead01 100644
@@ -468,8 +468,6 @@ struct dwc2_plat_otg_data s5pc210_otg_data = {
 };
 #endif
 
-#if defined(CONFIG_USB_GADGET) || defined(CONFIG_CMD_USB)
-
 static void set_usb3503_ref_clk(void)
 {
 #ifdef CONFIG_BOARD_TYPES
@@ -490,9 +488,8 @@ static void set_usb3503_ref_clk(void)
 #endif /* CONFIG_BOARD_TYPES */
 }
 
-int board_usb_init(int index, enum usb_init_type init)
+int exynos_usb_init(void)
 {
-#ifdef CONFIG_CMD_USB
        struct udevice *dev;
        int ret;
 

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

Quoted 4 lines
board/samsung/odroid/odroid.c +1 -0
@@ -501,6 +498,7 @@ int board_usb_init(int index, enum usb_init_type init)
        /* Disconnect, Reset, Connect */
        gpio_direction_output(EXYNOS4X12_GPIO_X34, 0);
        gpio_direction_output(EXYNOS4X12_GPIO_X35, 0);
+       sdelay(200000);

This should be a separate patch with its own explanation.

Quoted 32 lines
board/samsung/odroid/odroid.c +7 -1
        gpio_direction_output(EXYNOS4X12_GPIO_X35, 1);
        gpio_direction_output(EXYNOS4X12_GPIO_X34, 1);
 
@@ -530,7 +528,13 @@ int board_usb_init(int index, enum usb_init_type init)
                pr_err("Regulator %s value setting error: %d\n", dev->name, ret);
                return ret;
        }
-#endif
+
+       return 0;
+}
+
+#ifdef CONFIG_USB_GADGET
+int board_usb_init(int index, enum usb_init_type init)
+{
        debug("USB_udc_probe\n");
        return dwc2_udc_probe(&s5pc210_otg_data);
 }
drivers/usb/host/ehci-exynos.c +2 -0
index fabc662eb6..b0f7bd4936 100644
@@ -31,6 +31,8 @@ struct exynos_ehci_platdata {
        struct gpio_desc vbus_gpio;
 };
 
+extern int exynos_usb_init(void);
+
 /**
  * Contains pointers to register base addresses
  * for the usb controller.

drivers/usb/host/ehci-exynos.c static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb) · line 161

Quoted 8 lines
drivers/usb/host/ehci-exynos.c +5 -0
@@ -152,6 +154,11 @@ static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb)
        setbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
        udelay(10);
        clrbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
+
+       /*
+        * "usb start" initialize the usb driver
+        */
+       exynos_usb_init();

It should be something more generic like CONFIG_SYS_USB_OHCI_BOARD_INIT which calls board_usb_init()... but it still will be calling board code from the driver. Why do you need this in the first place?

Best regards,
Krzysztof

author
#3 lore raw

RFC 1/6 odroid: exynos: USB initialization on the U3/X2

Hi Krzysztof,

Quoted 94 lines · Krzysztof Kozlowski
Quoted 48 lines · Anand Moon

From: Tobias Jakobi <[email protected]>

Rename board_usb_init() to exynos_usb_init() and call it early in the Exynos EHCI driver when probing.

This kind of works. After a 'usb start; usb stop; usb start' cycle the attached devices are recognized.

Add small delay between gpio_direction_output to stable initialization of usb gpio pins.

---
Reoder the exynos_usb_init so that "usb start" command initialization correcly.
---

---
 board/samsung/odroid/odroid.c  | 14 +++++++++-----
 drivers/usb/host/ehci-exynos.c |  7 +++++++
 2 files changed, 16 insertions(+), 5 deletions(-)
board/samsung/odroid/odroid.c +1 -4
index 3e594fd850..79d14ead01 100644
@@ -468,8 +468,6 @@ struct dwc2_plat_otg_data s5pc210_otg_data = {
 };
 #endif
 
-#if defined(CONFIG_USB_GADGET) || defined(CONFIG_CMD_USB)
-
 static void set_usb3503_ref_clk(void)
 {
 #ifdef CONFIG_BOARD_TYPES
@@ -490,9 +488,8 @@ static void set_usb3503_ref_clk(void)
 #endif /* CONFIG_BOARD_TYPES */
 }
 
-int board_usb_init(int index, enum usb_init_type init)
+int exynos_usb_init(void)
 {
-#ifdef CONFIG_CMD_USB
        struct udevice *dev;
        int ret;
 

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

Quoted 4 lines
board/samsung/odroid/odroid.c +1 -0
@@ -501,6 +498,7 @@ int board_usb_init(int index, enum usb_init_type init)
        /* Disconnect, Reset, Connect */
        gpio_direction_output(EXYNOS4X12_GPIO_X34, 0);
        gpio_direction_output(EXYNOS4X12_GPIO_X35, 0);
+       sdelay(200000);

This should be a separate patch with its own explanation.

Quoted 37 lines
board/samsung/odroid/odroid.c +7 -1
        gpio_direction_output(EXYNOS4X12_GPIO_X35, 1);
        gpio_direction_output(EXYNOS4X12_GPIO_X34, 1);
 
@@ -530,7 +528,13 @@ int board_usb_init(int index, enum usb_init_type init)
                pr_err("Regulator %s value setting error: %d\n", dev->name, ret);
                return ret;
        }
-#endif
+
+       return 0;
+}
+
+#ifdef CONFIG_USB_GADGET
+int board_usb_init(int index, enum usb_init_type init)
+{
        debug("USB_udc_probe\n");
        return dwc2_udc_probe(&s5pc210_otg_data);
 }
drivers/usb/host/ehci-exynos.c +4 -0
index fabc662eb6..b0f7bd4936 100644
@@ -31,6 +31,8 @@ struct exynos_ehci_platdata {
        struct gpio_desc vbus_gpio;
 };
 
+extern int exynos_usb_init(void);
+
 /**
  * Contains pointers to register base addresses
  * for the usb controller.
@@ -152,6 +154,11 @@ static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb)
        setbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
        udelay(10);
        clrbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
+
+       /*
Quoted 8 lines

drivers/usb/host/ehci-exynos.c static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb) · line 161

Quoted 3 lines
drivers/usb/host/ehci-exynos.c +3 -0
+        * "usb start" initialize the usb driver
+        */
+       exynos_usb_init();

It should be something more generic like CONFIG_SYS_USB_OHCI_BOARD_INIT which calls board_usb_init()... but it still will be calling board code from the driver. Why do you need this in the first place?

Ideally usb start should be invoked while loading of the u-boot. but some how this is missing I could not figure out this.

I have tried following in odroid.c but still no sign of usb to get initialize usb,

int board_eth_init(bd_t *bis)

{
        printf("Registered USB_ETHER\n");
        exynos_usb_init();
        return 0;
}

Here is the debugging I tried to under stand before I tried to modify the code. Before usb start is called.

Odroid # dm help
dm - Driver model low level access
...

 gpio        44  [   ]   gpio_exynos           |   |-- gpv3
 gpio        45  [   ]   gpio_exynos           |   `-- gpv4
 usb          0  [   ]   ehci_exynos           `-- ehci at 12580000

After usb start
Odroid # usb start
starting 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 # dm tree

 gpio        45  [   ]   gpio_exynos           |   `-- gpv4
 usb          0  [ + ]   ehci_exynos           `-- ehci at 12580000
 usb_hub      0  [ + ]   usb_hub                   `-- usb_hub
 usb_dev_ge   0  [ + ]   usb_dev_generic_drv           |-- generic_bus_0_dev_2
 usb_hub      1  [ + ]   usb_hub                       `-- usb_hub
 usb_mass_s   0  [ + ]   usb_mass_storage                  `-- usb_mass_storage
 blk          2  [   ]   usb_storage_blk                       `--

usb_mass_storage.lun0

After the dm node register we can perform usb and ethernet operation on u-boot.

Any other input's I can try this out.

Best Regards
-Anand

#4 lore raw

RFC 1/6 odroid: exynos: USB initialization on the U3/X2

In reply to Anand Moon

Hi Anand,

Quoted 55 lines

From: Tobias Jakobi <[email protected]>

Rename board_usb_init() to exynos_usb_init() and call it early in the Exynos EHCI driver when probing.

This kind of works. After a 'usb start; usb stop; usb start' cycle the attached devices are recognized.

Add small delay between gpio_direction_output to stable initialization of usb gpio pins.

---
Reoder the exynos_usb_init so that "usb start" command initialization correcly.
---

---
 board/samsung/odroid/odroid.c  | 14 +++++++++-----
 drivers/usb/host/ehci-exynos.c |  7 +++++++
 2 files changed, 16 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/board/samsung/odroid/odroid.c index 3e594fd850..79d14ead01 100644

board/samsung/odroid/odroid.c +1 -4
@@ -468,8 +468,6 @@ struct dwc2_plat_otg_data s5pc210_otg_data = {
 };
 #endif
 
-#if defined(CONFIG_USB_GADGET) || defined(CONFIG_CMD_USB)
-
 static void set_usb3503_ref_clk(void)
 {
 #ifdef CONFIG_BOARD_TYPES
@@ -490,9 +488,8 @@ static void set_usb3503_ref_clk(void)
 #endif /* CONFIG_BOARD_TYPES */
 }
 
-int board_usb_init(int index, enum usb_init_type init)
+int exynos_usb_init(void)
 {
-#ifdef CONFIG_CMD_USB
 	struct udevice *dev;
 	int ret;
 
@@ -501,6 +498,7 @@ int board_usb_init(int index, enum usb_init_type

init) /* Disconnect, Reset, Connect */

board/samsung/odroid/odroid.c +1 -0
 	gpio_direction_output(EXYNOS4X12_GPIO_X34, 0);
 	gpio_direction_output(EXYNOS4X12_GPIO_X35, 0);
+	sdelay(200000);
 	gpio_direction_output(EXYNOS4X12_GPIO_X35, 1);
 	gpio_direction_output(EXYNOS4X12_GPIO_X34, 1);

board/samsung/odroid/odroid.c int board_usb_init(int index, enum usb_init_type · line 536

Quoted 10 lines
board/samsung/odroid/odroid.c +6 -1
@@ -530,7 +528,13 @@ int board_usb_init(int index, enum usb_init_type
 init) pr_err("Regulator %s value setting error: %d\n", dev->name,
 ret); return ret;
 	}
-#endif
+
+	return 0;
+}
+
+#ifdef CONFIG_USB_GADGET
+int board_usb_init(int index, enum usb_init_type init)

We are not allowed to add board_usb_* code anymore. The _only_ way to update/fix the USB gadget code is to convert it to driver model [DM] and describe it via DTS.

Please consider converting this code to DM/DTS.

Quoted 22 lines
board/samsung/odroid/odroid.c +1 -0
+{
 	debug("USB_udc_probe\n");
 	return dwc2_udc_probe(&s5pc210_otg_data);
 }
(quoted diff) +0 -0

b/drivers/usb/host/ehci-exynos.c index fabc662eb6..b0f7bd4936 100644

drivers/usb/host/ehci-exynos.c +2 -0
@@ -31,6 +31,8 @@ struct exynos_ehci_platdata {
 	struct gpio_desc vbus_gpio;
 };
 
+extern int exynos_usb_init(void);
+
 /**
  * Contains pointers to register base addresses
  * for the usb controller.
@@ -152,6 +154,11 @@ static void exynos4412_setup_usb_phy(struct
 exynos4412_usb_phy *usb) setbits_le32(&usb->usbphyrstcon,
 (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST)); udelay(10);
 	clrbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST |

RSTCON_SWRST)); +

drivers/usb/host/ehci-exynos.c static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb) · line 164

Quoted 7 lines
drivers/usb/host/ehci-exynos.c +4 -0
+	/*
+	 * "usb start" initialize the usb driver
+	 */
+	exynos_usb_init();
 }
 
 static void setup_usb_phy(struct exynos_usb_phy *usb)

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190401/9935a596/attachment.sig>

#5 lore raw

RFC 1/6 odroid: exynos: USB initialization on the U3/X2

Quoted 72 lines · Lukasz Majewski

Hi Anand,

Quoted 55 lines

From: Tobias Jakobi <[email protected]>

Rename board_usb_init() to exynos_usb_init() and call it early in the Exynos EHCI driver when probing.

This kind of works. After a 'usb start; usb stop; usb start' cycle the attached devices are recognized.

Add small delay between gpio_direction_output to stable initialization of usb gpio pins.

---
Reoder the exynos_usb_init so that "usb start" command initialization correcly.
---

---
 board/samsung/odroid/odroid.c  | 14 +++++++++-----
 drivers/usb/host/ehci-exynos.c |  7 +++++++
 2 files changed, 16 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/board/samsung/odroid/odroid.c index 3e594fd850..79d14ead01 100644

board/samsung/odroid/odroid.c +1 -4
@@ -468,8 +468,6 @@ struct dwc2_plat_otg_data s5pc210_otg_data = {
 };
 #endif
 
-#if defined(CONFIG_USB_GADGET) || defined(CONFIG_CMD_USB)
-
 static void set_usb3503_ref_clk(void)
 {
 #ifdef CONFIG_BOARD_TYPES
@@ -490,9 +488,8 @@ static void set_usb3503_ref_clk(void)
 #endif /* CONFIG_BOARD_TYPES */
 }
 
-int board_usb_init(int index, enum usb_init_type init)
+int exynos_usb_init(void)
 {
-#ifdef CONFIG_CMD_USB
 	struct udevice *dev;
 	int ret;
 
@@ -501,6 +498,7 @@ int board_usb_init(int index, enum usb_init_type

init) /* Disconnect, Reset, Connect */

board/samsung/odroid/odroid.c +1 -0
 	gpio_direction_output(EXYNOS4X12_GPIO_X34, 0);
 	gpio_direction_output(EXYNOS4X12_GPIO_X35, 0);
+	sdelay(200000);
 	gpio_direction_output(EXYNOS4X12_GPIO_X35, 1);
 	gpio_direction_output(EXYNOS4X12_GPIO_X34, 1);

board/samsung/odroid/odroid.c int board_usb_init(int index, enum usb_init_type · line 536

Quoted 10 lines
board/samsung/odroid/odroid.c +6 -1
@@ -530,7 +528,13 @@ int board_usb_init(int index, enum usb_init_type
 init) pr_err("Regulator %s value setting error: %d\n", dev->name,
 ret); return ret;
 	}
-#endif
+
+	return 0;
+}
+
+#ifdef CONFIG_USB_GADGET
+int board_usb_init(int index, enum usb_init_type init)

We are not allowed to add board_usb_* code anymore. The _only_ way to update/fix the USB gadget code is to convert it to driver model [DM] and describe it via DTS.

Quoted 1 line

Please consider converting this code to DM/DTS.

Patrick currently has a series enabling DWC2 OTG DM support which I'm attempting to switch the rk3288 over too. A branch can be found at
https://github.com/patrickdelaunay/u-boot/tree/v2019.04-stm32mp for testing.

Quoted 50 lines
Quoted 23 lines
board/samsung/odroid/odroid.c +1 -0
+{
 	debug("USB_udc_probe\n");
 	return dwc2_udc_probe(&s5pc210_otg_data);
 }
(quoted diff) +0 -0

b/drivers/usb/host/ehci-exynos.c index fabc662eb6..b0f7bd4936 100644

drivers/usb/host/ehci-exynos.c +2 -0
@@ -31,6 +31,8 @@ struct exynos_ehci_platdata {
 	struct gpio_desc vbus_gpio;
 };
 
+extern int exynos_usb_init(void);
+
 /**
  * Contains pointers to register base addresses
  * for the usb controller.
@@ -152,6 +154,11 @@ static void exynos4412_setup_usb_phy(struct
 exynos4412_usb_phy *usb) setbits_le32(&usb->usbphyrstcon,
 (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST)); udelay(10);
 	clrbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST |

RSTCON_SWRST)); +

drivers/usb/host/ehci-exynos.c static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb) · line 164

Quoted 7 lines
drivers/usb/host/ehci-exynos.c +4 -0
+	/*
+	 * "usb start" initialize the usb driver
+	 */
+	exynos_usb_init();
 }
 
 static void setup_usb_phy(struct exynos_usb_phy *usb)

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#6 lore raw

RFC 1/6 odroid: exynos: USB initialization on the U3/X2

In reply to Anand Moon

Hello,

in case this isn't totally obvious, I want to state it here again: THIS IS A HACK!

This patch of mine was never meant for upstream submission. Note that the original commit has a TODO included, which again makes clear: This is not the proper way to do it. It's a quick&dirty solution because I needed booting via tftp. Nothing more.

I have seen this plently of times now. Anand Moon takes some code, tinkers around with it and then presents it for review. The problem is that he doesn't even bother to understand what he's doing and when he arrives at something semi-working, it is more by chance than anything else. I feel sorry for Krzysztof (and others), who, with the patience of a monk to say the least, has to deal with this time and time again.

- Tobias

Quoted 95 lines · Anand Moon

From: Tobias Jakobi <[email protected]>

Rename board_usb_init() to exynos_usb_init() and call it early in the Exynos EHCI driver when probing.

This kind of works. After a 'usb start; usb stop; usb start' cycle the attached devices are recognized.

Add small delay between gpio_direction_output to stable initialization of usb gpio pins.

---
Reoder the exynos_usb_init so that "usb start" command initialization correcly.
---

---
 board/samsung/odroid/odroid.c  | 14 +++++++++-----
 drivers/usb/host/ehci-exynos.c |  7 +++++++
 2 files changed, 16 insertions(+), 5 deletions(-)
board/samsung/odroid/odroid.c +9 -5
index 3e594fd850..79d14ead01 100644
@@ -468,8 +468,6 @@ struct dwc2_plat_otg_data s5pc210_otg_data = {
 };
 #endif
 
-#if defined(CONFIG_USB_GADGET) || defined(CONFIG_CMD_USB)
-
 static void set_usb3503_ref_clk(void)
 {
 #ifdef CONFIG_BOARD_TYPES
@@ -490,9 +488,8 @@ static void set_usb3503_ref_clk(void)
 #endif /* CONFIG_BOARD_TYPES */
 }
 
-int board_usb_init(int index, enum usb_init_type init)
+int exynos_usb_init(void)
 {
-#ifdef CONFIG_CMD_USB
 	struct udevice *dev;
 	int ret;
 
@@ -501,6 +498,7 @@ int board_usb_init(int index, enum usb_init_type init)
 	/* Disconnect, Reset, Connect */
 	gpio_direction_output(EXYNOS4X12_GPIO_X34, 0);
 	gpio_direction_output(EXYNOS4X12_GPIO_X35, 0);
+	sdelay(200000);
 	gpio_direction_output(EXYNOS4X12_GPIO_X35, 1);
 	gpio_direction_output(EXYNOS4X12_GPIO_X34, 1);
 
@@ -530,7 +528,13 @@ int board_usb_init(int index, enum usb_init_type init)
 		pr_err("Regulator %s value setting error: %d\n", dev->name, ret);
 		return ret;
 	}
-#endif
+
+	return 0;
+}
+
+#ifdef CONFIG_USB_GADGET
+int board_usb_init(int index, enum usb_init_type init)
+{
 	debug("USB_udc_probe\n");
 	return dwc2_udc_probe(&s5pc210_otg_data);
 }
drivers/usb/host/ehci-exynos.c +7 -0
index fabc662eb6..b0f7bd4936 100644
@@ -31,6 +31,8 @@ struct exynos_ehci_platdata {
 	struct gpio_desc vbus_gpio;
 };
 
+extern int exynos_usb_init(void);
+
 /**
  * Contains pointers to register base addresses
  * for the usb controller.
@@ -152,6 +154,11 @@ static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb)
 	setbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
 	udelay(10);
 	clrbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
+
+	/*
+	 * "usb start" initialize the usb driver
+	 */
+	exynos_usb_init();
 }
 
 static void setup_usb_phy(struct exynos_usb_phy *usb)
author
#7 lore raw

RFC 1/6 odroid: exynos: USB initialization on the U3/X2

Hi Tobias,

Quoted 10 lines · Tobias Jakobi

Hello,

in case this isn't totally obvious, I want to state it here again: THIS IS A HACK!

This patch of mine was never meant for upstream submission. Note that the original commit has a TODO included, which again makes clear: This is not the proper way to do it. It's a quick&dirty solution because I needed booting via tftp. Nothing more.

Quoted 9 lines

I have seen this plently of times now. Anand Moon takes some code, tinkers around with it and then presents it for review. The problem is that he doesn't even bother to understand what he's doing and when he arrives at something semi-working, it is more by chance than anything else. I feel sorry for Krzysztof (and others), who, with the patience of a monk to say the least, has to deal with this time and time again.

- Tobias

Yes I completely understand you point, their could be other way to fix this issue
which I over looked, sorry for the trouble. Let discard this for now.

Best Regards
-Anand

author
#8 lore raw

RFC 2/6 odroid: exynos: usb clean up for U3/X2

In reply to Anand Moon

Add board_usb_cleanup routine to cleanup after
de-registering it usb devices. Also fixed the
compilation error for other board.

---
 board/samsung/common/board.c  | 4 ++--
 board/samsung/odroid/odroid.c | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
board/samsung/common/board.c +2 -2
index 9adbd1e2cf..c74aca9b0a 100644
@@ -351,10 +351,10 @@ void reset_misc(void)
 	}
 }
 
+#ifdef CONFIG_USB_DWC3
 int board_usb_cleanup(int index, enum usb_init_type init)
 {
-#ifdef CONFIG_USB_DWC3
 	dwc3_uboot_exit(index);
-#endif
 	return 0;
 }
+#endif
board/samsung/odroid/odroid.c +5 -0
index 79d14ead01..547ae698cf 100644
@@ -538,4 +538,9 @@ int board_usb_init(int index, enum usb_init_type init)
 	debug("USB_udc_probe\n");
 	return dwc2_udc_probe(&s5pc210_otg_data);
 }
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+	return s5pc210_phy_control(index);
+}
 #endif
Signature · 1 line
2.21.0
#9 lore raw

RFC 2/6 odroid: exynos: usb clean up for U3/X2

Quoted 4 lines · Anand Moon

Add board_usb_cleanup routine to cleanup after
de-registering it usb devices. Also fixed the
compilation error for other board.

Fix for build error should be in separate commit. Please also quote the error you are fixing... because the code compiles fine in my case.

Quoted 28 lines
---
 board/samsung/common/board.c  | 4 ++--
 board/samsung/odroid/odroid.c | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
board/samsung/common/board.c +2 -2
index 9adbd1e2cf..c74aca9b0a 100644
@@ -351,10 +351,10 @@ void reset_misc(void)
        }
 }
 
+#ifdef CONFIG_USB_DWC3
 int board_usb_cleanup(int index, enum usb_init_type init)
 {
-#ifdef CONFIG_USB_DWC3
        dwc3_uboot_exit(index);
-#endif
        return 0;
 }
+#endif
board/samsung/odroid/odroid.c +0 -0
index 79d14ead01..547ae698cf 100644

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

Quoted 7 lines
board/samsung/odroid/odroid.c +4 -0
@@ -538,4 +538,9 @@ int board_usb_init(int index, enum usb_init_type init)
        debug("USB_udc_probe\n");
        return dwc2_udc_probe(&s5pc210_otg_data);
 }
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+       return s5pc210_phy_control(index);

Why you pass index of USB controller as argument "int on"? Index != on...

Best regards,
Krzysztof

author
#10 lore raw

RFC 2/6 odroid: exynos: usb clean up for U3/X2

Hi Krzysztof,

Quoted 10 lines · Krzysztof Kozlowski
Quoted 4 lines · Anand Moon

Add board_usb_cleanup routine to cleanup after
de-registering it usb devices. Also fixed the
compilation error for other board.

Fix for build error should be in separate commit. Please also quote the error you are fixing... because the code compiles fine in my case.

Compilation error happens on other target boards. like Odroid-XU3

Quoted 29 lines
Quoted 29 lines
---
 board/samsung/common/board.c  | 4 ++--
 board/samsung/odroid/odroid.c | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
board/samsung/common/board.c +2 -2
index 9adbd1e2cf..c74aca9b0a 100644
@@ -351,10 +351,10 @@ void reset_misc(void)
        }
 }
 
+#ifdef CONFIG_USB_DWC3
 int board_usb_cleanup(int index, enum usb_init_type init)
 {
-#ifdef CONFIG_USB_DWC3
        dwc3_uboot_exit(index);
-#endif
        return 0;
 }
+#endif
board/samsung/odroid/odroid.c +0 -0
index 79d14ead01..547ae698cf 100644
@@ -538,4 +538,9 @@ int board_usb_init(int index, enum usb_init_type init)
        debug("USB_udc_probe\n");
Quoted 9 lines

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

Quoted 6 lines
board/samsung/odroid/odroid.c +4 -0
        return dwc2_udc_probe(&s5pc210_otg_data);
 }
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+       return s5pc210_phy_control(index);

Why you pass index of USB controller as argument "int on"? Index != on...

Generally board_usb_cleanup do cleanup the index of the board_usb_init, so I use this naturally. I will check and update this if needed.

Quoted 2 lines

Best regards,
Krzysztof

Best Regards
-Anand

#11 lore raw

RFC 2/6 odroid: exynos: usb clean up for U3/X2

Quoted 11 lines · Anand Moon

Hi Krzysztof,

Quoted 7 lines · Krzysztof Kozlowski
Quoted 4 lines · Anand Moon

Add board_usb_cleanup routine to cleanup after
de-registering it usb devices. Also fixed the
compilation error for other board.

Quoted 5 lines
Quoted 3 lines

Fix for build error should be in separate commit. Please also quote the error you are fixing... because the code compiles fine in my case.

Compilation error happens on other target boards. like Odroid-XU3

OK, please quote it and fix the error in separate commit.

Quoted 40 lines
Quoted 30 lines
Quoted 30 lines
---
 board/samsung/common/board.c  | 4 ++--
 board/samsung/odroid/odroid.c | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
board/samsung/common/board.c +2 -2
index 9adbd1e2cf..c74aca9b0a 100644
@@ -351,10 +351,10 @@ void reset_misc(void)
        }
 }
 
+#ifdef CONFIG_USB_DWC3
 int board_usb_cleanup(int index, enum usb_init_type init)
 {
-#ifdef CONFIG_USB_DWC3
        dwc3_uboot_exit(index);
-#endif
        return 0;
 }
+#endif
board/samsung/odroid/odroid.c +0 -0
index 79d14ead01..547ae698cf 100644
@@ -538,4 +538,9 @@ int board_usb_init(int index, enum usb_init_type init)
        debug("USB_udc_probe\n");
Quoted 9 lines

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

Quoted 6 lines
board/samsung/odroid/odroid.c +4 -0
        return dwc2_udc_probe(&s5pc210_otg_data);
 }
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+       return s5pc210_phy_control(index);

Why you pass index of USB controller as argument "int on"? Index != on...

Quoted 2 lines

Generally board_usb_cleanup do cleanup the index of the board_usb_init, so I use this naturally. I will check and update this if needed.

But s5pc210_phy_control not. Your comment does not really address my concerns...

Best regards,
Krzysztof

author
#12 lore raw

RFC 3/6 usb: exynos: add init_after_reset for usb reset

In reply to Anand Moon

Some host controllers need addidional re-initialization after ehci_reset() so we add .init_after_reset callback which is requires to reinit the phy after controller reset.

---
 drivers/usb/host/ehci-exynos.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-exynos.c +19 -1
index b0f7bd4936..e6a542e092 100644
@@ -143,6 +143,23 @@ static void exynos5_setup_usb_phy(struct exynos_usb_phy *usb)
 			EHCICTRL_ENAINCR16);
 }
 
+static int ehci_exynos_init_after_reset(struct ehci_ctrl *ehcntl)
+{
+	if (cpu_is_exynos4()) {
+		if (proid_is_exynos4412()) {
+			/*
+			 * "usb reset" cmd: restart re-initialize the usb driver
+			 */
+			exynos_usb_init();
+		}
+	}
+	return 0;
+}
+
+static const struct ehci_ops exynos_ehci_ops = {
+	.init_after_reset = ehci_exynos_init_after_reset,
+};
+
 static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb)
 {
 	writel(CLK_24MHZ, &usb->usbphyclk);
@@ -234,7 +251,8 @@ static int ehci_usb_probe(struct udevice *dev)
 	hcor = (struct ehci_hcor *)((uint32_t)ctx->hcd +
 			HC_LENGTH(ehci_readl(&ctx->hcd->cr_capbase)));
 
-	return ehci_register(dev, ctx->hcd, hcor, NULL, 0, USB_INIT_HOST);
+	return ehci_register(dev, ctx->hcd, hcor, &exynos_ehci_ops,
+			0, USB_INIT_HOST);
 }
 
 static int ehci_usb_remove(struct udevice *dev)
Signature · 1 line
2.21.0
#13 lore raw

RFC 3/6 usb: exynos: add init_after_reset for usb reset

Quoted 2 lines · Anand Moon

Some host controllers need addidional re-initialization

Please run spell-check.

Quoted 2 lines

after ehci_reset() so we add .init_after_reset callback which is requires to reinit the phy after controller reset.

s/requires/required/
.... but you do not re-init the phy. The exynos_usb_init() performs the reset of usb3503 USB hub!

Quoted 11 lines
---
 drivers/usb/host/ehci-exynos.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-exynos.c +0 -0
index b0f7bd4936..e6a542e092 100644

drivers/usb/host/ehci-exynos.c static void exynos5_setup_usb_phy(struct exynos_usb_phy *usb) · line 149

Quoted 7 lines
drivers/usb/host/ehci-exynos.c +4 -0
@@ -143,6 +143,23 @@ static void exynos5_setup_usb_phy(struct exynos_usb_phy *usb)
                        EHCICTRL_ENAINCR16);
 }
 
+static int ehci_exynos_init_after_reset(struct ehci_ctrl *ehcntl)
+{
+       if (cpu_is_exynos4()) {
+               if (proid_is_exynos4412()) {

No need for double indentation.

drivers/usb/host/ehci-exynos.c static void exynos5_setup_usb_phy(struct exynos_usb_phy *usb) · line 151

Quoted 2 lines
drivers/usb/host/ehci-exynos.c +2 -0
+                       /*
+                        * "usb reset" cmd: restart re-initialize the usb driver

Just "reinitialize", not restart reinitialize.

Best regards,
Krzysztof

Quoted 27 lines
drivers/usb/host/ehci-exynos.c +13 -2
+                        */
+                       exynos_usb_init();
+               }
+       }
+       return 0;
+}
+
+static const struct ehci_ops exynos_ehci_ops = {
+       .init_after_reset = ehci_exynos_init_after_reset,
+};
+
 static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb)
 {
        writel(CLK_24MHZ, &usb->usbphyclk);
@@ -234,7 +251,8 @@ static int ehci_usb_probe(struct udevice *dev)
        hcor = (struct ehci_hcor *)((uint32_t)ctx->hcd +
                        HC_LENGTH(ehci_readl(&ctx->hcd->cr_capbase)));
 
-       return ehci_register(dev, ctx->hcd, hcor, NULL, 0, USB_INIT_HOST);
+       return ehci_register(dev, ctx->hcd, hcor, &exynos_ehci_ops,
+                       0, USB_INIT_HOST);
 }
 
 static int ehci_usb_remove(struct udevice *dev)
--

2.21.0

author
#14 lore raw

RFC 3/6 usb: exynos: add init_after_reset for usb reset

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski
Quoted 2 lines · Anand Moon

Some host controllers need addidional re-initialization

Please run spell-check.

Quoted 2 lines

after ehci_reset() so we add .init_after_reset callback which is requires to reinit the phy after controller reset.

s/requires/required/

I did run checkpatch before on this, It did not spotted and error or warning.

Quoted 3 lines

.... but you do not re-init the phy. The exynos_usb_init() performs the reset of usb3503 USB hub!

Yes that is needed as we do not get the usb back after "usb reset" command.

Quoted 21 lines
Quoted 11 lines
---
 drivers/usb/host/ehci-exynos.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-exynos.c +0 -0
index b0f7bd4936..e6a542e092 100644

drivers/usb/host/ehci-exynos.c static void exynos5_setup_usb_phy(struct exynos_usb_phy *usb) · line 149

Quoted 7 lines
drivers/usb/host/ehci-exynos.c +4 -0
@@ -143,6 +143,23 @@ static void exynos5_setup_usb_phy(struct exynos_usb_phy *usb)
                        EHCICTRL_ENAINCR16);
 }
 
+static int ehci_exynos_init_after_reset(struct ehci_ctrl *ehcntl)
+{
+       if (cpu_is_exynos4()) {
+               if (proid_is_exynos4412()) {

No need for double indentation.

Quoted 5 lines

drivers/usb/host/ehci-exynos.c static void exynos5_setup_usb_phy(struct exynos_usb_phy *usb) · line 151

Quoted 2 lines
drivers/usb/host/ehci-exynos.c +2 -0
+                       /*
+                        * "usb reset" cmd: restart re-initialize the usb driver

Just "reinitialize", not restart reinitialize.

Ok.

Quoted 26 lines

Best regards,
Krzysztof

Quoted 23 lines
drivers/usb/host/ehci-exynos.c +13 -1
+                        */
+                       exynos_usb_init();
+               }
+       }
+       return 0;
+}
+
+static const struct ehci_ops exynos_ehci_ops = {
+       .init_after_reset = ehci_exynos_init_after_reset,
+};
+
 static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb)
 {
        writel(CLK_24MHZ, &usb->usbphyclk);
@@ -234,7 +251,8 @@ static int ehci_usb_probe(struct udevice *dev)
        hcor = (struct ehci_hcor *)((uint32_t)ctx->hcd +
                        HC_LENGTH(ehci_readl(&ctx->hcd->cr_capbase)));
 
-       return ehci_register(dev, ctx->hcd, hcor, NULL, 0, USB_INIT_HOST);
+       return ehci_register(dev, ctx->hcd, hcor, &exynos_ehci_ops,
+                       0, USB_INIT_HOST);
 }
 
Quoted 4 lines
Quoted 4 lines
drivers/usb/host/ehci-exynos.c +0 -1
 static int ehci_usb_remove(struct udevice *dev)
--

2.21.0

Best Regards
-Anand

#15 lore raw

RFC 3/6 usb: exynos: add init_after_reset for usb reset

Quoted 16 lines · Anand Moon

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski
Quoted 2 lines · Anand Moon

Some host controllers need addidional re-initialization

Please run spell-check.

Quoted 2 lines

after ehci_reset() so we add .init_after_reset callback which is requires to reinit the phy after controller reset.

s/requires/required/

Quoted 7 lines

I did run checkpatch before on this, It did not spotted and error or warning.

Quoted 3 lines

.... but you do not re-init the phy. The exynos_usb_init() performs the reset of usb3503 USB hub!

Yes that is needed as we do not get the usb back after "usb reset" command.

Then please update the commit message to describe what exactly you are doing and what you want to achieve. Someone might think that you are doing initialization in init-after-reset... but you want to perform different reset after reset of ehci... and while writing it maybe you will notice that it is a hack and probably not the best way to do it.

Best regards,
Krzysztof

author
#16 lore raw

RFC 4/6 configs: exynos: Add new CONFIG_SYS_ODROID_USB config option

In reply to Anand Moon

Add new CONFIG_SYS_ODROID_USB flag to avoid compliation error on other development boards.

Fix below compilation error:
Error: You must add new CONFIG options using Kconfig The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_ODROID_USB

---
 board/samsung/odroid/Kconfig   | 3 +++
 drivers/usb/host/ehci-exynos.c | 6 ++++++
 include/configs/odroid.h       | 1 +
 3 files changed, 10 insertions(+)
board/samsung/odroid/Kconfig +3 -0
index 8b52a0d589..c5fbffabad 100644
@@ -9,4 +9,7 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "odroid"
 
+config SYS_ODROID_USB
+	bool "Exynos4412 Odroid USB"
+
 endif
drivers/usb/host/ehci-exynos.c +6 -0
index e6a542e092..3f62eba486 100644
@@ -31,7 +31,9 @@ struct exynos_ehci_platdata {
 	struct gpio_desc vbus_gpio;
 };
 
+#ifdef CONFIG_SYS_ODROID_USB
 extern int exynos_usb_init(void);
+#endif
 
 /**
  * Contains pointers to register base addresses
@@ -145,6 +147,7 @@ static void exynos5_setup_usb_phy(struct exynos_usb_phy *usb)
 
 static int ehci_exynos_init_after_reset(struct ehci_ctrl *ehcntl)
 {
+#ifdef CONFIG_SYS_ODROID_USB
 	if (cpu_is_exynos4()) {
 		if (proid_is_exynos4412()) {
 			/*
@@ -153,6 +156,7 @@ static int ehci_exynos_init_after_reset(struct ehci_ctrl *ehcntl)
 			exynos_usb_init();
 		}
 	}
+#endif
 	return 0;
 }
 
@@ -172,10 +176,12 @@ static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb)
 	udelay(10);
 	clrbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
 
+#ifdef CONFIG_SYS_ODROID_USB
 	/*
 	 * "usb start" initialize the usb driver
 	 */
 	exynos_usb_init();
+#endif
 }
 
 static void setup_usb_phy(struct exynos_usb_phy *usb)
include/configs/odroid.h +1 -0
index 9f2d43e3fa..d8d30c0f62 100644
@@ -32,6 +32,7 @@
 #define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_SDRAM_BASE + 0x5E00000)
 #define CONFIG_SYS_LOAD_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x3E00000)
+#define CONFIG_SYS_ODROID_USB
 
 #include <linux/sizes.h>
 
Signature · 1 line
2.21.0
#17 lore raw

RFC 4/6 configs: exynos: Add new CONFIG_SYS_ODROID_USB config option

Quoted 8 lines · Anand Moon

Add new CONFIG_SYS_ODROID_USB flag to avoid compliation error on other development boards.

Fix below compilation error:
Error: You must add new CONFIG options using Kconfig The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_ODROID_USB

There is no ad-hoc option "SYS_ODROID_USB" so it cannot cause build error.

This is something wrong... Are you sure that you are compiling master branch?

Best regards,
Krzysztof

Quoted 78 lines
---
 board/samsung/odroid/Kconfig   | 3 +++
 drivers/usb/host/ehci-exynos.c | 6 ++++++
 include/configs/odroid.h       | 1 +
 3 files changed, 10 insertions(+)
board/samsung/odroid/Kconfig +3 -0
index 8b52a0d589..c5fbffabad 100644
@@ -9,4 +9,7 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
        default "odroid"
 
+config SYS_ODROID_USB
+       bool "Exynos4412 Odroid USB"
+
 endif
drivers/usb/host/ehci-exynos.c +6 -0
index e6a542e092..3f62eba486 100644
@@ -31,7 +31,9 @@ struct exynos_ehci_platdata {
        struct gpio_desc vbus_gpio;
 };
 
+#ifdef CONFIG_SYS_ODROID_USB
 extern int exynos_usb_init(void);
+#endif
 
 /**
  * Contains pointers to register base addresses
@@ -145,6 +147,7 @@ static void exynos5_setup_usb_phy(struct exynos_usb_phy *usb)
 
 static int ehci_exynos_init_after_reset(struct ehci_ctrl *ehcntl)
 {
+#ifdef CONFIG_SYS_ODROID_USB
        if (cpu_is_exynos4()) {
                if (proid_is_exynos4412()) {
                        /*
@@ -153,6 +156,7 @@ static int ehci_exynos_init_after_reset(struct ehci_ctrl *ehcntl)
                        exynos_usb_init();
                }
        }
+#endif
        return 0;
 }
 
@@ -172,10 +176,12 @@ static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb)
        udelay(10);
        clrbits_le32(&usb->usbphyrstcon, (RSTCON_HOSTPHY_SWRST | RSTCON_SWRST));
 
+#ifdef CONFIG_SYS_ODROID_USB
        /*
         * "usb start" initialize the usb driver
         */
        exynos_usb_init();
+#endif
 }
 
 static void setup_usb_phy(struct exynos_usb_phy *usb)
include/configs/odroid.h +1 -1
index 9f2d43e3fa..d8d30c0f62 100644
@@ -32,6 +32,7 @@
 #define CONFIG_SYS_MEMTEST_START       CONFIG_SYS_SDRAM_BASE
 #define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_SDRAM_BASE + 0x5E00000)
 #define CONFIG_SYS_LOAD_ADDR           (CONFIG_SYS_SDRAM_BASE + 0x3E00000)
+#define CONFIG_SYS_ODROID_USB
 
 #include <linux/sizes.h>
 
--

2.21.0

author
#18 lore raw

RFC 4/6 configs: exynos: Add new CONFIG_SYS_ODROID_USB config option

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski
Quoted 8 lines · Anand Moon

Add new CONFIG_SYS_ODROID_USB flag to avoid compliation error on other development boards.

Fix below compilation error:
Error: You must add new CONFIG options using Kconfig The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_ODROID_USB

Quoted 7 lines

There is no ad-hoc option "SYS_ODROID_USB" so it cannot cause build error.

This is something wrong... Are you sure that you are compiling master branch?

Best regards,
Krzysztof

[snip]

CONFIG_SYS_ODROID_USB is adder to fix compilation error other development board. so this code is specific to the Odroid U3 and Odroid X2 boards.

I have compiled both XU3 and U3 build with no problem.

Best Regards
-Anand

#19 lore raw

RFC 4/6 configs: exynos: Add new CONFIG_SYS_ODROID_USB config option

Quoted 23 lines · Anand Moon

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski
Quoted 8 lines · Anand Moon

Add new CONFIG_SYS_ODROID_USB flag to avoid compliation error on other development boards.

Fix below compilation error:
Error: You must add new CONFIG options using Kconfig The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_ODROID_USB

Quoted 7 lines

There is no ad-hoc option "SYS_ODROID_USB" so it cannot cause build error.

This is something wrong... Are you sure that you are compiling master branch?

Best regards,
Krzysztof

Quoted 6 lines

[snip]

CONFIG_SYS_ODROID_USB is adder to fix compilation error other development board. so this code is specific to the Odroid U3 and Odroid X2 boards.

I have compiled both XU3 and U3 build with no problem.

You quoted the error message saying that ad-hoc option CONFIG_SYS_ODROID_USB was added. But such ad-hoc option does not exist. Now you say that you add this to fix build problem... I really do not understand. So let's simplify it - please tell me how I can reproduce the problem and what is expected.

Best regards,
Krzysztof

author
#20 lore raw

RFC 4/6 configs: exynos: Add new CONFIG_SYS_ODROID_USB config option

Hi Krzysztof,

Quoted 32 lines · Krzysztof Kozlowski
Quoted 23 lines · Anand Moon

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski
Quoted 8 lines · Anand Moon

Add new CONFIG_SYS_ODROID_USB flag to avoid compliation error on other development boards.

Fix below compilation error:
Error: You must add new CONFIG options using Kconfig The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_ODROID_USB

Quoted 7 lines

There is no ad-hoc option "SYS_ODROID_USB" so it cannot cause build error.

This is something wrong... Are you sure that you are compiling master branch?

Best regards,
Krzysztof

Quoted 6 lines

[snip]

CONFIG_SYS_ODROID_USB is adder to fix compilation error other development board. so this code is specific to the Odroid U3 and Odroid X2 boards.

I have compiled both XU3 and U3 build with no problem.

Quoted 8 lines

You quoted the error message saying that ad-hoc option CONFIG_SYS_ODROID_USB was added. But such ad-hoc option does not exist. Now you say that you add this to fix build problem... I really do not understand. So let's simplify it - please tell me how I can reproduce the problem and what is expected.

Best regards,
Krzysztof

This CONFIG_SYS_ODROID_USB options is more like and compile time flag defined in odroid.h and not on any other boards, so this flags add guard to the code.

At the end of u-boot compilation it would prompt that new config option is added
please add this to some Kconfig so that it could be selected via make menuconfig

See the link below, why I chose this options.

[0] https://github.com/Xilinx/u-boot-xlnx/blob/master/doc/README.kconfig

Best Regards
-Anand

#21 lore raw

RFC 4/6 configs: exynos: Add new CONFIG_SYS_ODROID_USB config option

Quoted 49 lines · Anand Moon

Hi Krzysztof,

Quoted 32 lines · Krzysztof Kozlowski
Quoted 23 lines · Anand Moon

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski
Quoted 8 lines · Anand Moon

Add new CONFIG_SYS_ODROID_USB flag to avoid compliation error on other development boards.

Fix below compilation error:
Error: You must add new CONFIG options using Kconfig The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_ODROID_USB

Quoted 7 lines

There is no ad-hoc option "SYS_ODROID_USB" so it cannot cause build error.

This is something wrong... Are you sure that you are compiling master branch?

Best regards,
Krzysztof

Quoted 6 lines

[snip]

CONFIG_SYS_ODROID_USB is adder to fix compilation error other development board. so this code is specific to the Odroid U3 and Odroid X2 boards.

I have compiled both XU3 and U3 build with no problem.

Quoted 8 lines

You quoted the error message saying that ad-hoc option CONFIG_SYS_ODROID_USB was added. But such ad-hoc option does not exist. Now you say that you add this to fix build problem... I really do not understand. So let's simplify it - please tell me how I can reproduce the problem and what is expected.

Best regards,
Krzysztof

This CONFIG_SYS_ODROID_USB options is more like and compile time flag defined in odroid.h and not on any other boards, so this flags add guard to the code.

Quoted 7 lines

At the end of u-boot compilation it would prompt that new config option is added
please add this to some Kconfig so that it could be selected via make menuconfig

See the link below, why I chose this options.

[0] https://github.com/Xilinx/u-boot-xlnx/blob/master/doc/README.kconfig

Can you provide answer to this:
"So let's simplify it - please tell me how I can reproduce the problem and what is expected."
?

Best regards,
Krzysztof

author
#22 lore raw

RFC 4/6 configs: exynos: Add new CONFIG_SYS_ODROID_USB config option

Hi Krzysztof,

Quoted 55 lines · Krzysztof Kozlowski
Quoted 53 lines · Anand Moon

Hi Krzysztof,

Quoted 32 lines · Krzysztof Kozlowski
Quoted 23 lines · Anand Moon

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski
Quoted 8 lines · Anand Moon

Add new CONFIG_SYS_ODROID_USB flag to avoid compliation error on other development boards.

Fix below compilation error:
Error: You must add new CONFIG options using Kconfig The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_ODROID_USB

Quoted 7 lines

There is no ad-hoc option "SYS_ODROID_USB" so it cannot cause build error.

This is something wrong... Are you sure that you are compiling master branch?

Best regards,
Krzysztof

Quoted 6 lines

[snip]

CONFIG_SYS_ODROID_USB is adder to fix compilation error other development board. so this code is specific to the Odroid U3 and Odroid X2 boards.

I have compiled both XU3 and U3 build with no problem.

Quoted 8 lines

You quoted the error message saying that ad-hoc option CONFIG_SYS_ODROID_USB was added. But such ad-hoc option does not exist. Now you say that you add this to fix build problem... I really do not understand. So let's simplify it - please tell me how I can reproduce the problem and what is expected.

Best regards,
Krzysztof

This CONFIG_SYS_ODROID_USB options is more like and compile time flag defined in odroid.h and not on any other boards, so this flags add guard to the code.

At the end of u-boot compilation it would prompt that new config option is added
please add this to some Kconfig so that it could be selected via make menuconfig

Quoted 9 lines
Quoted 3 lines

See the link below, why I chose this options.

[0] https://github.com/Xilinx/u-boot-xlnx/blob/master/doc/README.kconfig

Can you provide answer to this:
"So let's simplify it - please tell me how I can reproduce the problem and what is expected."
?

Since I would like to keep the code specific to Odroid U3 and Odroid X2. I have introduce CONFIG_SYS_ODROID_USB this flag in "include/configs/odroid.h"

If your remove the entry from board/samsung/odroid/Kconfig you will hit above error
at the end of the build process.

At the end of the compilation it suggest to add this entry into Kconfig option so that this flag could be select and build flag in boards/config file.

OBJCOPY u-boot.srec
OBJCOPY u-boot-nodtb.bin

  CAT     u-boot-dtb.bin
  COPY    u-boot.bin
  SYM     u-boot.sym
  CFGCHK  u-boot.cfg

Error: You must add new CONFIG options using Kconfig The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_ODROID_USB

Please add these via Kconfig instead. Find a suitable Kconfig file and add a 'config' or 'menuconfig' option.
make: *** [Makefile:1003: all] Error 1

This flag is mostly used as a guard to avoid compilation error on other boards.

I could not find any other option to fix this issue. If possible plz let me know.

Best Regards
-Anand

#23 lore raw

RFC 4/6 configs: exynos: Add new CONFIG_SYS_ODROID_USB config option

Quoted 63 lines · Anand Moon

Hi Krzysztof,

Quoted 59 lines · Krzysztof Kozlowski
Quoted 56 lines · Anand Moon

Hi Krzysztof,

Quoted 32 lines · Krzysztof Kozlowski
Quoted 23 lines · Anand Moon

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski
Quoted 8 lines · Anand Moon

Add new CONFIG_SYS_ODROID_USB flag to avoid compliation error on other development boards.

Fix below compilation error:
Error: You must add new CONFIG options using Kconfig The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_ODROID_USB

Quoted 7 lines

There is no ad-hoc option "SYS_ODROID_USB" so it cannot cause build error.

This is something wrong... Are you sure that you are compiling master branch?

Best regards,
Krzysztof

Quoted 6 lines

[snip]

CONFIG_SYS_ODROID_USB is adder to fix compilation error other development board. so this code is specific to the Odroid U3 and Odroid X2 boards.

I have compiled both XU3 and U3 build with no problem.

Quoted 8 lines

You quoted the error message saying that ad-hoc option CONFIG_SYS_ODROID_USB was added. But such ad-hoc option does not exist. Now you say that you add this to fix build problem... I really do not understand. So let's simplify it - please tell me how I can reproduce the problem and what is expected.

Best regards,
Krzysztof

This CONFIG_SYS_ODROID_USB options is more like and compile time flag defined in odroid.h and not on any other boards, so this flags add guard to the code.

At the end of u-boot compilation it would prompt that new config option is added
please add this to some Kconfig so that it could be selected via make menuconfig

See the link below, why I chose this options.

[0] https://github.com/Xilinx/u-boot-xlnx/blob/master/doc/README.kconfig

Quoted 8 lines
Quoted 5 lines

Can you provide answer to this:
"So let's simplify it - please tell me how I can reproduce the problem and what is expected."
?

Since I would like to keep the code specific to Odroid U3 and Odroid X2. I have introduce CONFIG_SYS_ODROID_USB this flag in "include/configs/odroid.h"

So you added it? And broke build? And then add new commit to fix it?

Quoted 3 lines

If your remove the entry from board/samsung/odroid/Kconfig you will hit above error
at the end of the build process.

In board/samsung/odroid/Kconfig there is no such option like CONFIG_SYS_ODROID_USB.

It looks like this commit is not fixing anything in existing U-Boot sources, which you claim in commit message. If you break the building in one commit, do not fix it in second commit. Just do not break it at first place.

Best regards,
Krzysztof

Quoted 21 lines

At the end of the compilation it suggest to add this entry into Kconfig option so that this flag could be select and build flag in boards/config file.

OBJCOPY u-boot.srec
OBJCOPY u-boot-nodtb.bin

  CAT     u-boot-dtb.bin
  COPY    u-boot.bin
  SYM     u-boot.sym
  CFGCHK  u-boot.cfg

Error: You must add new CONFIG options using Kconfig The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_ODROID_USB

Please add these via Kconfig instead. Find a suitable Kconfig file and add a 'config' or 'menuconfig' option.
make: *** [Makefile:1003: all] Error 1

This flag is mostly used as a guard to avoid compilation error on other boards.

I could not find any other option to fix this issue. If possible plz let me know.

author
#24 lore raw

RFC 5/6 arm: exynos: odroid: fix the confict scripaddr extra env setting

In reply to Anand Moon

fix the confict of scriptaddr address with ramdisk_addr_r also add missing pxefile_addr_r u-boot extras env setting.

---
 include/configs/odroid.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/configs/odroid.h +2 -1
index d8d30c0f62..64819cf81c 100644
@@ -169,9 +169,10 @@
 	"consoleoff=set console console=ram; save; reset\0" \
 	"initrdname=uInitrd\0" \
 	"ramdisk_addr_r=0x42000000\0" \
-	"scriptaddr=0x42000000\0" \
 	"fdt_addr_r=0x40800000\0" \
 	"kernel_addr_r=0x41000000\0" \
+	"scriptaddr=0x50000000\0" \
+	"pxefile_addr_r=0x51000000\0" \
 	BOOTENV
 
 /* GPT */
Signature · 1 line
2.21.0
#25 lore raw

RFC 5/6 arm: exynos: odroid: fix the confict scripaddr extra env setting

Quoted 2 lines · Anand Moon

fix the confict of scriptaddr address with ramdisk_addr_r

Start with capital letter, so s/fix/Fix. End with a full-stop.

Quoted 1 line

also add missing pxefile_addr_r u-boot extras env setting.

s/also/Also/

... but there is no conflict in the first place. These addresses are not used in the same time.

Best regards,
Krzysztof

Quoted 25 lines
---
 include/configs/odroid.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/configs/odroid.h +2 -2
index d8d30c0f62..64819cf81c 100644
@@ -169,9 +169,10 @@
        "consoleoff=set console console=ram; save; reset\0" \
        "initrdname=uInitrd\0" \
        "ramdisk_addr_r=0x42000000\0" \
-       "scriptaddr=0x42000000\0" \
        "fdt_addr_r=0x40800000\0" \
        "kernel_addr_r=0x41000000\0" \
+       "scriptaddr=0x50000000\0" \
+       "pxefile_addr_r=0x51000000\0" \
        BOOTENV
 
 /* GPT */
--

2.21.0

author
#26 lore raw

RFC 5/6 arm: exynos: odroid: fix the confict scripaddr extra env setting

Hi Krzysztof,

Quoted 9 lines · Krzysztof Kozlowski
Quoted 2 lines · Anand Moon

fix the confict of scriptaddr address with ramdisk_addr_r

Start with capital letter, so s/fix/Fix. End with a full-stop.

Quoted 1 line

also add missing pxefile_addr_r u-boot extras env setting.

Quoted 8 lines

s/also/Also/

... but there is no conflict in the first place. These addresses are not used in the same time.

Best regards,
Krzysztof

Thanks for your review comments. I will try to improve on this. While investigating my earlier failure to load kernel some time ago. I discover this inputs after study Arch linux u-boot changes.

Below is loot log on ArchLinux and the boot.scr script is loaded 50000000 address
which do not conflict with rest of the settings.

U-Boot 2019.04-rc4-00089-ga5515f5f60 (Apr 01 2019 - 11:11:59 +0000)

CPU:   Exynos4412 @ 1 GHz
Model: Odroid based on Exynos4412
Type:  u3
DRAM:  2 GiB
LDO20 at VDDQ_EMMC_1.8V: set 1800000 uV; enabling
LDO22 at VDDQ_EMMC_2.8V: set 2800000 uV; enabling
LDO21 at TFLASH_2.8V: set 2800000 uV; enabling
MMC:   SAMSUNG SDHCI: 1, EXYNOS DWMMC: 0

Loading Environment from MMC... Card did not respond to voltage select! *** Warning - No block device, using default environment

Net:   No ethernet found.
Hit any key to stop autoboot:  0

switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Found U-Boot script /boot/boot.scr
932 bytes read in 6 ms (151.4 KiB/s)
## Executing script at 50000000
6625664 bytes read in 243 ms (26 MiB/s)
72657 bytes read in 20 ms (3.5 MiB/s)
6593459 bytes read in 241 ms (26.1 MiB/s) Kernel image @ 0x41000000 [ 0x000000 - 0x651980 ] ## Flattened Device Tree blob at 40800000
Booting using the fdt blob at 0x40800000 Loading Ramdisk to 4f9b6000, end 4ffffbb3 ... OK Loading Device Tree to 4f9a1000, end 4f9b5bd0 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0xa00
[    0.000000] Linux version 5.0.5-1-ARCH (builduser at leming) (gcc
version 8.2.1 20181127 (GCC)) #1 SMP PREEMPT Sat Mar 30 00:25:25 UTC
2019
[    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing
instruction cache
[    0.000000] OF: fdt: Machine model: Hardkernel ODROID-U3 board

based on Exynos4412

Best Regards
-Anand

author
#27 lore raw

RFC 6/6 arm: exynos: add usbnet_devaddr setting to env

In reply to Anand Moon

Add usbnet_devaddr mac address to extra env setting to avoid failure of ethernet driver while usb start.

Odroid # usb start
starting USB...
USB0: USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found scanning usb for ethernet devices...
Error: sms0 address not set.
Warning: failed to set MAC address
1 Ethernet Device(s) found

---
 include/configs/odroid.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/odroid.h +2 -0
index 64819cf81c..b0402e8d49 100644
@@ -33,6 +33,7 @@
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_SDRAM_BASE + 0x5E00000)
 #define CONFIG_SYS_LOAD_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x3E00000)
 #define CONFIG_SYS_ODROID_USB
+#define CONFIG_USBNET_DEV_ADDR          "02:DE:AD:BE:EF:FF"
 
 #include <linux/sizes.h>
 
@@ -173,6 +174,7 @@
 	"kernel_addr_r=0x41000000\0" \
 	"scriptaddr=0x50000000\0" \
 	"pxefile_addr_r=0x51000000\0" \
+	"usbethaddr=" __stringify(CONFIG_USBNET_DEV_ADDR) "\0" \
 	BOOTENV
 
 /* GPT */
Signature · 1 line
2.21.0
#28 lore raw

RFC 6/6 arm: exynos: add usbnet_devaddr setting to env

Quoted 32 lines · Anand Moon

Add usbnet_devaddr mac address to extra env setting to avoid failure of ethernet driver while usb start.

Odroid # usb start
starting USB...
USB0: USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found scanning usb for ethernet devices...
Error: sms0 address not set.
Warning: failed to set MAC address
1 Ethernet Device(s) found

---
 include/configs/odroid.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/odroid.h +1 -0
index 64819cf81c..b0402e8d49 100644
@@ -33,6 +33,7 @@
 #define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_SDRAM_BASE + 0x5E00000)
 #define CONFIG_SYS_LOAD_ADDR           (CONFIG_SYS_SDRAM_BASE + 0x3E00000)
 #define CONFIG_SYS_ODROID_USB
+#define CONFIG_USBNET_DEV_ADDR          "02:DE:AD:BE:EF:FF"
 
 #include <linux/sizes.h>
 

include/configs/odroid.h line 177

Quoted 4 lines
include/configs/odroid.h +1 -0
@@ -173,6 +174,7 @@
        "kernel_addr_r=0x41000000\0" \
        "scriptaddr=0x50000000\0" \
        "pxefile_addr_r=0x51000000\0" \
+       "usbethaddr=" __stringify(CONFIG_USBNET_DEV_ADDR) "\0" \

No. Either the user should set it or manufacturer (e.g. in EEPROM).

Best regards,
Krzysztof

author
#29 lore raw

RFC 6/6 arm: exynos: add usbnet_devaddr setting to env

Hi Krzysztof,

Quoted 33 lines · Krzysztof Kozlowski
Quoted 31 lines · Anand Moon

Add usbnet_devaddr mac address to extra env setting to avoid failure of ethernet driver while usb start.

Odroid # usb start
starting USB...
USB0: USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found scanning usb for ethernet devices...
Error: sms0 address not set.
Warning: failed to set MAC address
1 Ethernet Device(s) found

---
 include/configs/odroid.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/odroid.h +1 -0
index 64819cf81c..b0402e8d49 100644
@@ -33,6 +33,7 @@
 #define CONFIG_SYS_MEMTEST_END         (CONFIG_SYS_SDRAM_BASE + 0x5E00000)
 #define CONFIG_SYS_LOAD_ADDR           (CONFIG_SYS_SDRAM_BASE + 0x3E00000)
 #define CONFIG_SYS_ODROID_USB
+#define CONFIG_USBNET_DEV_ADDR          "02:DE:AD:BE:EF:FF"
 
 #include <linux/sizes.h>
 
Quoted 8 lines

include/configs/odroid.h line 177

Quoted 5 lines
include/configs/odroid.h +1 -0
@@ -173,6 +174,7 @@
        "kernel_addr_r=0x41000000\0" \
        "scriptaddr=0x50000000\0" \
        "pxefile_addr_r=0x51000000\0" \
+       "usbethaddr=" __stringify(CONFIG_USBNET_DEV_ADDR) "\0" \

No. Either the user should set it or manufacturer (e.g. in EEPROM).

Ok,

This usb Ethernet do not support reading mac addressed from EEPROM. some user need to pass this mac address via boot command can used is approach.

But I could not perform "saveenv" after setting the mac address. see below.

Odroid #
Odroid # setenv usbethaddr C2:22:09:F2:5F:E8
Odroid #
Odroid # saveenv
Saving Environment to MMC... Card did not respond to voltage select! No block device
Failed (1)
Odroid #

Best Regards
-Anand