All of lore.kernel.org
 help / color / mirror / Atom feed
From: Uri Mashiach <uri.mashiach@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 3/7] usb: host: xhci-omap: fix double weak board_usb_init functions
Date: Thu, 23 Feb 2017 15:39:37 +0200	[thread overview]
Message-ID: <1487857181-8938-4-git-send-email-uri.mashiach@compulab.co.il> (raw)
In-Reply-To: <1487857181-8938-1-git-send-email-uri.mashiach@compulab.co.il>

A weak version of the function board_usb_init is implemented in:
common/usb.c
drivers/usb/host/xhci-omap.c

To fix the double implementations:
* Convert the board_usb_init function in drivers/usb/host/xhci-omap.c
  normal (not weak).
* The function board_usb_init in drivers/usb/host/xhci-omap.c calls to
  the weak function omap_xhci_board_usb_init.
* Rename board version of the function board_usb_init to
  omap_xhci_board_usb_init.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

To achieve the same flexibility with the function board_usb_cleanup:
* Add a normal (not weak) implementation of the function
  board_usb_cleanup in drivers/usb/host/xhci-omap.c
* The function board_usb_cleanup in drivers/usb/host/xhci-omap.c calls
  to the weak function omap_xhci_board_usb_cleanup.
* Rename board version of the function board_usb_cleanup to
  omap_xhci_board_usb_cleanup.
  Done only for boards that defines CONFIG_USB_XHCI_OMAP.

Cc: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
V1 -> V2: Use __weak instead of attribute block
V2 -> V4: none

 board/compulab/cl-som-am57x/cl-som-am57x.c |  2 +-
 board/ti/am43xx/board.c                    |  4 ++--
 board/ti/am57xx/board.c                    |  4 ++--
 board/ti/dra7xx/evm.c                      |  4 ++--
 drivers/usb/host/xhci-omap.c               | 17 +++++++++++++++--
 5 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c b/board/compulab/cl-som-am57x/cl-som-am57x.c
index bdd0a2b..fe1468f 100644
--- a/board/compulab/cl-som-am57x/cl-som-am57x.c
+++ b/board/compulab/cl-som-am57x/cl-som-am57x.c
@@ -54,7 +54,7 @@ int board_mmc_init(bd_t *bis)
 #endif /* CONFIG_GENERIC_MMC */
 
 #ifdef CONFIG_USB_XHCI_OMAP
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
 	setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
 		     OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M);
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 390cc16..2572029 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -694,7 +694,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
 	enable_usb_clocks(index);
 #ifdef CONFIG_USB_DWC3
@@ -725,7 +725,7 @@ int board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
 	switch (index) {
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 1611514..4afa914 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -618,7 +618,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
 	enable_usb_clocks(index);
 	switch (index) {
@@ -652,7 +652,7 @@ int board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
 	switch (index) {
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index bd1c809..65bce93 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -727,7 +727,7 @@ static struct ti_usb_phy_device usb_phy2_device = {
 	.index = 1,
 };
 
-int board_usb_init(int index, enum usb_init_type init)
+int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
 	enable_usb_clocks(index);
 	switch (index) {
@@ -764,7 +764,7 @@ int board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
-int board_usb_cleanup(int index, enum usb_init_type init)
+int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
 	switch (index) {
 	case 0:
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index b881b19..a1b4f2f 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -27,12 +27,25 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct omap_xhci omap;
 
-__weak int __board_usb_init(int index, enum usb_init_type init)
+__weak int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
 	return 0;
 }
+
 int board_usb_init(int index, enum usb_init_type init)
-	__attribute__((weak, alias("__board_usb_init")));
+{
+	return omap_xhci_board_usb_init(index, init);
+}
+
+__weak int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
+{
+	return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+	return omap_xhci_board_usb_cleanup(index, init);
+}
 
 static int omap_xhci_core_init(struct omap_xhci *omap)
 {
-- 
2.7.4

  parent reply	other threads:[~2017-02-23 13:39 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23 13:39 [U-Boot] [PATCH v4 0/7] am57xx: cl-som-am57x: fix usb Uri Mashiach
2017-02-23 13:39 ` [U-Boot] [PATCH v4 1/7] arm: dra7xx: move CONFIG_DRA7XX to Kconfig Uri Mashiach
2017-02-26 15:16   ` Tom Rini
2017-05-08 19:38   ` [U-Boot] [U-Boot, v4, " Tom Rini
2017-02-23 13:39 ` [U-Boot] [PATCH v4 2/7] arm: usb: dra7xx: xHCI registers based on USB port index Uri Mashiach
2017-02-26 12:26   ` Marek Vasut
2017-02-26 15:16   ` Tom Rini
2017-02-27 16:14   ` Roger Quadros
2017-02-27 20:39     ` Marek Vasut
2017-02-27 20:38   ` Marek Vasut
2017-05-08 19:38   ` [U-Boot] [U-Boot, v4, " Tom Rini
2017-02-23 13:39 ` Uri Mashiach [this message]
2017-02-26 12:25   ` [U-Boot] [PATCH v4 3/7] usb: host: xhci-omap: fix double weak board_usb_init functions Igor Grinberg
2017-02-26 12:29     ` Marek Vasut
2017-02-27 16:22   ` Roger Quadros
2017-02-28  8:00     ` Uri Mashiach
2017-02-28 13:13       ` Roger Quadros
2017-03-01  9:12         ` Uri Mashiach
2017-03-01 15:13           ` Roger Quadros
2017-03-01 15:13   ` Roger Quadros
2017-05-08 19:39   ` [U-Boot] [U-Boot, v4, " Tom Rini
2017-02-23 13:39 ` [U-Boot] [PATCH v4 4/7] arm: am57xx: cl-som-am57x: invoke clock API to enable/disable clocks Uri Mashiach
2017-02-26 12:27   ` Marek Vasut
2017-02-27 16:24     ` Roger Quadros
2017-02-27 18:14       ` Marek Vasut
2017-05-08 19:39   ` [U-Boot] [U-Boot, v4, " Tom Rini
2017-02-23 13:39 ` [U-Boot] [PATCH v4 5/7] arm: am57xx: cl-som-am57x: fix USB scan Uri Mashiach
2017-05-08 19:39   ` [U-Boot] [U-Boot, v4, " Tom Rini
2017-02-23 13:39 ` [U-Boot] [PATCH v4 6/7] arm: am57xx: cl-som-am57x: enable USB storage Uri Mashiach
2017-05-08 19:39   ` [U-Boot] [U-Boot, v4, " Tom Rini
2017-02-23 13:39 ` [U-Boot] [PATCH v4 7/7] arm: am57xx: cl-som-am57x: enable USB commands Uri Mashiach
2017-05-08 19:39   ` [U-Boot] [U-Boot, v4, " Tom Rini
2017-04-23  8:18 ` [U-Boot] [PATCH v4 0/7] am57xx: cl-som-am57x: fix usb Uri Mashiach
2017-04-25  1:09   ` Tom Rini
2017-04-25 19:27     ` Marek Vasut
2017-05-04  7:05       ` Igor Grinberg
2017-05-04 10:08         ` Marek Vasut
2017-05-05 14:17         ` Tom Rini
2017-05-08 12:45           ` Igor Grinberg

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=1487857181-8938-4-git-send-email-uri.mashiach@compulab.co.il \
    --to=uri.mashiach@compulab.co.il \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.