All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] imx: mx6: add is_boot_from_usb define
@ 2018-04-24 12:05 Sean Nyekjaer
  2018-04-24 12:13 ` Fabio Estevam
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Nyekjaer @ 2018-04-24 12:05 UTC (permalink / raw)
  To: u-boot

This enables us to detect if the i.MX6 SoC
is booting from USB.

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
---
 arch/arm/include/asm/arch-mx6/imx-regs.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 095eb74195..10da611968 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -998,4 +998,11 @@ struct pwm_regs {
 	u32	cnr;
 };
 #endif /* __ASSEMBLER__*/
+
+/*
+ * If ROM fail back to USB recover mode, USBPH0_PWD will be clear to use USB
+ * If boot from the other mode, USB0_PWD will keep reset value
+ */
+#define is_boot_from_usb(void)	(!(readl(USB_PHY0_BASE_ADDR) & (1 << 20)))
+
 #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
-- 
2.17.0

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

* [U-Boot] [PATCH] imx: mx6: add is_boot_from_usb define
  2018-04-24 12:05 [U-Boot] [PATCH] imx: mx6: add is_boot_from_usb define Sean Nyekjaer
@ 2018-04-24 12:13 ` Fabio Estevam
  2018-04-24 12:36   ` Sean Nyekjær
  0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2018-04-24 12:13 UTC (permalink / raw)
  To: u-boot

Hi Sean,

On Tue, Apr 24, 2018 at 9:05 AM, Sean Nyekjaer <sean.nyekjaer@prevas.dk> wrote:
> This enables us to detect if the i.MX6 SoC
> is booting from USB.
>
> Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>

Could you use is_usbotg_phy_active() for this purpose?

Please see:

commit 7d289d6239b29171bf9503869f1a92c084cf1c35
Author: Stefan Agner <stefan.agner@toradex.com>
Date:   Wed Sep 13 14:29:44 2017 -0700

    imx: add macro to detect whether USB PHY is active

    This macro allows to detect whether the USB PHY is active. This
    is helpful to detect if the boot ROM has previously started the
    USB serial downloader.

    The idea is taken from the mfgtool support in the NXP U-Boot:
    http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/commit/?h=imx_v2016.03_4.1.15_2.0.0_ga&id=a352ed3c5184b95c4c9f7468f5fbb5f43de5e412

    Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
    Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
    Tested-by: Fabio Estevam <fabio.estevam@nxp.com>
    Reviewed-by: Eric Nelson <eric@nelint.com>

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

* [U-Boot] [PATCH] imx: mx6: add is_boot_from_usb define
  2018-04-24 12:13 ` Fabio Estevam
@ 2018-04-24 12:36   ` Sean Nyekjær
  0 siblings, 0 replies; 3+ messages in thread
From: Sean Nyekjær @ 2018-04-24 12:36 UTC (permalink / raw)
  To: u-boot



Hi Fabio
On 24 April 2018 14:13:51 CEST, Fabio Estevam <festevam@gmail.com> wrote:
>Hi Sean,
>
>On Tue, Apr 24, 2018 at 9:05 AM, Sean Nyekjaer
><sean.nyekjaer@prevas.dk> wrote:
>> This enables us to detect if the i.MX6 SoC
>> is booting from USB.
>>
>> Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
>
>Could you use is_usbotg_phy_active() for this purpose?
>
>Please see:
>
>commit 7d289d6239b29171bf9503869f1a92c084cf1c35
>Author: Stefan Agner <stefan.agner@toradex.com>
>Date:   Wed Sep 13 14:29:44 2017 -0700
>
>    imx: add macro to detect whether USB PHY is active
>
>    This macro allows to detect whether the USB PHY is active. This
>    is helpful to detect if the boot ROM has previously started the
>    USB serial downloader.
>
>    The idea is taken from the mfgtool support in the NXP U-Boot:
>http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/commit/?h=imx_v2016.03_4.1.15_2.0.0_ga&id=a352ed3c5184b95c4c9f7468f5fbb5f43de5e412
Mine was also taken from that commit.
Yes I could use this instead :-) the mx7 is using the same naming as the NXP uboot for the mx6 that why I missed that...

/Sean
>
>    Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
>    Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
>    Tested-by: Fabio Estevam <fabio.estevam@nxp.com>
>    Reviewed-by: Eric Nelson <eric@nelint.com>

-- 
Sent from my mobile device. Please excuse my brevity.

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

end of thread, other threads:[~2018-04-24 12:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24 12:05 [U-Boot] [PATCH] imx: mx6: add is_boot_from_usb define Sean Nyekjaer
2018-04-24 12:13 ` Fabio Estevam
2018-04-24 12:36   ` Sean Nyekjær

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.