public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexandru Gagniuc <alex.g@adaptrum.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/6] am33xx: board: Refactor USB initialization into separate function
Date: Mon, 6 Feb 2017 19:17:33 -0800	[thread overview]
Message-ID: <20170207031737.2680-3-alex.g@adaptrum.com> (raw)
In-Reply-To: <20170203234220.28589-1-alex.g@adaptrum.com>

The declaration of otg*_plat and otg*_board_data is guarded by
CONFIG_USB_MUSB_*, but their use in arch_misc_init is not. The
ifdef flow goes something like:

if (CONFIG_USB_MUSB_* && other_conditions)
	declare usb_data
if (other_conditions)
	use usb_data

Thus when CONFIG_USB_MUSB_* is not declared, we try to use the
data structures, but these structures aren't defined.

To fix this, move the USB initialization code into the same #ifdef
which guards the declaration of the data structures. Since the DM_USB
vs legacy cases are completely different, use two versions of
arch_misc_init(), for readability.

Signed-off-by: Alexandru Gagniuc <alex.g@adaptrum.com>
---
 arch/arm/mach-omap2/am33xx/board.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/am33xx/board.c b/arch/arm/mach-omap2/am33xx/board.c
index 190310f..422b1a5 100644
--- a/arch/arm/mach-omap2/am33xx/board.c
+++ b/arch/arm/mach-omap2/am33xx/board.c
@@ -190,11 +190,9 @@ static struct musb_hdrc_platform_data otg1_plat = {
 	.board_data	= &otg1_board_data,
 };
 #endif
-#endif
 
 int arch_misc_init(void)
 {
-#ifndef CONFIG_DM_USB
 #ifdef CONFIG_AM335X_USB0
 	musb_register(&otg0_plat, &otg0_board_data,
 		(void *)USB0_OTG_BASE);
@@ -203,7 +201,13 @@ int arch_misc_init(void)
 	musb_register(&otg1_plat, &otg1_board_data,
 		(void *)USB1_OTG_BASE);
 #endif
-#else
+	return 0;
+}
+
+#else	/* CONFIG_USB_MUSB_* && CONFIG_AM335X_USB* && !CONFIG_DM_USB */
+
+int arch_misc_init(void)
+{
 	struct udevice *dev;
 	int ret;
 
@@ -218,10 +222,12 @@ int arch_misc_init(void)
 		return ret;
 	}
 #endif
-#endif
+
 	return 0;
 }
 
+#endif /* CONFIG_USB_MUSB_* && CONFIG_AM335X_USB* && !CONFIG_DM_USB */
+
 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
 /*
  * In the case of non-SPL based booting we'll want to call these
-- 
2.9.3

  parent reply	other threads:[~2017-02-07  3:17 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-03 23:42 [U-Boot] [PATCH 0/5] Add support for Adaptrum ACRS2 mainboard Alexandru Gagniuc
2017-02-03 23:42 ` [U-Boot] [PATCH 1/5] configs: am335x_evm: Enable FASTBOOT based on kconfig Alexandru Gagniuc
2017-02-06 15:15   ` Andrew F. Davis
2017-02-06 18:32     ` Alex
2017-02-03 23:42 ` [U-Boot] [PATCH 2/5] Revert "configs: am335x: usb: do not define CONFIG_DM_USB for spl" Alexandru Gagniuc
2017-02-06 15:52   ` Andrew F. Davis
2017-02-06 18:47     ` Alex
2017-02-06 19:43       ` Andrew F. Davis
2017-02-06 21:30         ` Grygorii Strashko
2017-02-06 22:02           ` Alexandru Gagniuc
2017-02-06 22:30           ` [U-Boot] [PATCH] am33xx: board: Refactor USB initialization into separate function Alexandru Gagniuc
2017-02-12 13:55             ` Andreas Färber
2017-02-13 17:18               ` Alex
2017-02-03 23:42 ` [U-Boot] [PATCH 3/5] ARM: DTS: Add devicetree for Adaptrum ACRS2 mainboard Alexandru Gagniuc
2017-02-03 23:42 ` [U-Boot] [PATCH 4/5] configs: am335x: Enable PHY_VITESSE Alexandru Gagniuc
2017-02-06 15:56   ` Andrew F. Davis
2017-02-06 19:02     ` Alex G.
2017-02-06 19:47       ` Andrew F. Davis
2017-02-06 20:30         ` Alex G.
2017-02-06 20:38           ` Andrew F. Davis
2017-02-06 20:54             ` Alex G.
2017-02-06 21:03               ` Andrew F. Davis
2017-02-06 21:05                 ` [U-Boot] [PATCH] drivers: net: Provide Kconfig menu for PHYLIB Alexandru Gagniuc
2017-02-06 21:45                   ` [U-Boot] [PATCH] drivers: net: Move PHYLIB to Kconfig Andrew F. Davis
2017-02-07 16:28                     ` Joe Hershberger
2017-02-03 23:42 ` [U-Boot] [PATCH 5/5] configs: Add defconfig for Adaptrum ACRS2 Alexandru Gagniuc
2017-02-07  3:17 ` [U-Boot] [PATCH v2 0/6] Add support for Adaptrum ACRS2 board Alexandru Gagniuc
2017-02-07  3:17 ` [U-Boot] [PATCH v2 1/6] configs: am335x_evm: Enable FASTBOOT based on kconfig Alexandru Gagniuc
2017-02-07 18:23   ` Tom Rini
2017-07-12 12:14   ` [U-Boot] [U-Boot, v2, " Tom Rini
2017-02-07  3:17 ` Alexandru Gagniuc [this message]
2017-02-07 18:23   ` [U-Boot] [PATCH v2 2/6] am33xx: board: Refactor USB initialization into separate function Tom Rini
2017-07-12 12:14   ` [U-Boot] [U-Boot, v2, " Tom Rini
2017-02-07  3:17 ` [U-Boot] [PATCH v2 3/6] drivers: net: Provide Kconfig menu for PHYLIB Alexandru Gagniuc
2017-02-07 16:28   ` Joe Hershberger
2017-02-07 18:23   ` Tom Rini
2017-02-09 16:28   ` [U-Boot] " Joe Hershberger
2017-02-09 18:18     ` Alexandru Gagniuc
2017-02-09 22:19       ` Joe Hershberger
2017-02-09 22:45       ` Tom Rini
2017-02-07  3:17 ` [U-Boot] [PATCH v2 4/6] drivers: net: Move PHYLIB to Kconfig Alexandru Gagniuc
2017-02-07 16:55   ` Andrew F. Davis
2017-02-07 17:15     ` Joe Hershberger
2017-02-07 17:49       ` Tom Rini
2017-02-07 17:52   ` Tom Rini
2017-02-08 22:45     ` Joe Hershberger
2017-02-07  3:17 ` [U-Boot] [PATCH v2 5/6] ARM: DTS: Add devicetree for Adaptrum ACRS2 mainboard Alexandru Gagniuc
2017-02-07  3:17 ` [U-Boot] [PATCH v2 6/6] configs: Add defconfig for Adaptrum ACRS2 Alexandru Gagniuc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170207031737.2680-3-alex.g@adaptrum.com \
    --to=alex.g@adaptrum.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox