public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] Fixes for Turris Omnia
@ 2019-04-25 13:30 Marek Behún
  2019-04-25 13:30 ` [U-Boot] [PATCH 1/4] i2c: mvtwsi: fix disabling i2c slave on Armada 38x Marek Behún
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Marek Behún @ 2019-04-25 13:30 UTC (permalink / raw)
  To: u-boot

Hi Stefan, could you please review and apply these patches for Turris Omnia?

Marek

Marek Behún (3):
  i2c: mvtwsi: fix disabling i2c slave on Armada 38x
  mvebu: turris_omnia: remove redundant code
  arm: mvebu: turris_omnia: add XHCI to defconfig

Pierre Bourdon (1):
  mvebu: turris_omnia: fix eeprom/mcu device names

 board/CZ.NIC/turris_omnia/turris_omnia.c | 15 ++-------------
 configs/turris_omnia_defconfig           |  2 ++
 drivers/i2c/mvtwsi.c                     | 16 ++++------------
 3 files changed, 8 insertions(+), 25 deletions(-)

-- 
2.21.0

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

* [U-Boot] [PATCH 1/4] i2c: mvtwsi: fix disabling i2c slave on Armada 38x
  2019-04-25 13:30 [U-Boot] [PATCH 0/4] Fixes for Turris Omnia Marek Behún
@ 2019-04-25 13:30 ` Marek Behún
  2019-04-25 13:35   ` Pierre Bourdon
  2019-04-25 13:30 ` [U-Boot] [PATCH 2/4] mvebu: turris_omnia: remove redundant code Marek Behún
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Marek Behún @ 2019-04-25 13:30 UTC (permalink / raw)
  To: u-boot

Commit 173ec351 ("i2c: mvtwsi: disable i2c slave on Armada 38x") adds
slave disabling code on port 0 into bind method. This does not work
on Turris Omnia in SPL, because at the time the bind method is called in
SPL, arch/arm/mach-mvebu/spl.c has not yet set DM translation offset,
so the bind function reads from bad memory place, which causes a fault.

Move the i2c slave disabling code into the probe method of mvtwsi, by
that time dm_set_translation_offset is already called.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heiko Schocher <hs@denx.de>
Cc: Chris Packham <judge.packham@gmail.com>
Cc: Stefan Roese <sr@denx.de>
---
 drivers/i2c/mvtwsi.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
index 74ac0a4aa7..b0f7c3e057 100644
--- a/drivers/i2c/mvtwsi.c
+++ b/drivers/i2c/mvtwsi.c
@@ -804,22 +804,15 @@ static void twsi_disable_i2c_slave(struct mvtwsi_registers *twsi)
 	clrbits_le32(&twsi->debug, BIT(18));
 }
 
-static int mvtwsi_i2c_bind(struct udevice *bus)
+static int mvtwsi_i2c_probe(struct udevice *bus)
 {
-	struct mvtwsi_registers *twsi = devfdt_get_addr_ptr(bus);
+	struct mvtwsi_i2c_dev *dev = dev_get_priv(bus);
+	uint actual_speed;
 
 	/* Disable the hidden slave in i2c0 of these platforms */
 	if ((IS_ENABLED(CONFIG_ARMADA_38X) || IS_ENABLED(CONFIG_KIRKWOOD))
 			&& bus->req_seq == 0)
-		twsi_disable_i2c_slave(twsi);
-
-	return 0;
-}
-
-static int mvtwsi_i2c_probe(struct udevice *bus)
-{
-	struct mvtwsi_i2c_dev *dev = dev_get_priv(bus);
-	uint actual_speed;
+		twsi_disable_i2c_slave(dev->base);
 
 	__twsi_i2c_init(dev->base, dev->speed, dev->slaveadd, &actual_speed);
 	dev->speed = actual_speed;
@@ -871,7 +864,6 @@ U_BOOT_DRIVER(i2c_mvtwsi) = {
 	.name = "i2c_mvtwsi",
 	.id = UCLASS_I2C,
 	.of_match = mvtwsi_i2c_ids,
-	.bind = mvtwsi_i2c_bind,
 	.probe = mvtwsi_i2c_probe,
 	.ofdata_to_platdata = mvtwsi_i2c_ofdata_to_platdata,
 	.priv_auto_alloc_size = sizeof(struct mvtwsi_i2c_dev),
-- 
2.21.0

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

* [U-Boot] [PATCH 2/4] mvebu: turris_omnia: remove redundant code
  2019-04-25 13:30 [U-Boot] [PATCH 0/4] Fixes for Turris Omnia Marek Behún
  2019-04-25 13:30 ` [U-Boot] [PATCH 1/4] i2c: mvtwsi: fix disabling i2c slave on Armada 38x Marek Behún
@ 2019-04-25 13:30 ` Marek Behún
  2019-04-28 11:59   ` Baruch Siach
  2019-04-25 13:30 ` [U-Boot] [PATCH 3/4] mvebu: turris_omnia: fix eeprom/mcu device names Marek Behún
  2019-04-25 13:30 ` [U-Boot] [PATCH 4/4] arm: mvebu: turris_omnia: add XHCI to defconfig Marek Behún
  3 siblings, 1 reply; 9+ messages in thread
From: Marek Behún @ 2019-04-25 13:30 UTC (permalink / raw)
  To: u-boot

The i2c slave disabling is done by mvtwsi driver and is not needed here.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Baruch Siach <baruch@tkos.co.il>
---
 board/CZ.NIC/turris_omnia/turris_omnia.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index c21d2f3ffa..c446f471a6 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -297,8 +297,6 @@ static int set_regdomain(void)
 
 int board_early_init_f(void)
 {
-	u32 i2c_debug_reg;
-
 	/* Configure MPP */
 	writel(0x11111111, MVEBU_MPP_BASE + 0x00);
 	writel(0x11111111, MVEBU_MPP_BASE + 0x04);
@@ -321,15 +319,6 @@ int board_early_init_f(void)
 	writel(OMNIA_GPP_OUT_ENA_LOW, MVEBU_GPIO0_BASE + 0x04);
 	writel(OMNIA_GPP_OUT_ENA_MID, MVEBU_GPIO1_BASE + 0x04);
 
-	/*
-	 * Disable I2C debug mode blocking 0x64 I2C address.
-	 * Note: that would be redundant once Turris Omnia migrates to DM_I2C,
-	 * because the mvtwsi driver includes equivalent code.
-	 */
-	i2c_debug_reg = readl(MVEBU_TWSI_BASE + MVTWSI_ARMADA_DEBUG_REG);
-	i2c_debug_reg &= ~(1<<18);
-	writel(i2c_debug_reg, MVEBU_TWSI_BASE + MVTWSI_ARMADA_DEBUG_REG);
-
 	return 0;
 }
 
-- 
2.21.0

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

* [U-Boot] [PATCH 3/4] mvebu: turris_omnia: fix eeprom/mcu device names
  2019-04-25 13:30 [U-Boot] [PATCH 0/4] Fixes for Turris Omnia Marek Behún
  2019-04-25 13:30 ` [U-Boot] [PATCH 1/4] i2c: mvtwsi: fix disabling i2c slave on Armada 38x Marek Behún
  2019-04-25 13:30 ` [U-Boot] [PATCH 2/4] mvebu: turris_omnia: remove redundant code Marek Behún
@ 2019-04-25 13:30 ` Marek Behún
  2019-04-25 13:30 ` [U-Boot] [PATCH 4/4] arm: mvebu: turris_omnia: add XHCI to defconfig Marek Behún
  3 siblings, 0 replies; 9+ messages in thread
From: Marek Behún @ 2019-04-25 13:30 UTC (permalink / raw)
  To: u-boot

From: Pierre Bourdon <delroth@gmail.com>

Commit c4bd12a7dad4 ("i2c: mux: Generate longer i2c mux name") changed
the naming scheme of i2c devices within a mux. This broke references to
i2c at 0 in the Turris Omnia board initialization code.

Signed-off-by: Pierre Bourdon <delroth@gmail.com>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
---
 board/CZ.NIC/turris_omnia/turris_omnia.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index c446f471a6..3bfd6fe4e4 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -32,13 +32,13 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define OMNIA_I2C_EEPROM_DM_NAME	"i2c at 0"
+#define OMNIA_I2C_EEPROM_DM_NAME	"i2c at 11000->i2cmux at 70->i2c at 0"
 #define OMNIA_I2C_EEPROM		0x54
 #define OMNIA_I2C_EEPROM_CONFIG_ADDR	0x0
 #define OMNIA_I2C_EEPROM_ADDRLEN	2
 #define OMNIA_I2C_EEPROM_MAGIC		0x0341a034
 
-#define OMNIA_I2C_MCU_DM_NAME		"i2c at 0"
+#define OMNIA_I2C_MCU_DM_NAME		"i2c at 11000->i2cmux at 70->i2c at 0"
 #define OMNIA_I2C_MCU_ADDR_STATUS	0x1
 #define OMNIA_I2C_MCU_SATA		0x20
 #define OMNIA_I2C_MCU_CARDDET		0x10
-- 
2.21.0

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

* [U-Boot] [PATCH 4/4] arm: mvebu: turris_omnia: add XHCI to defconfig
  2019-04-25 13:30 [U-Boot] [PATCH 0/4] Fixes for Turris Omnia Marek Behún
                   ` (2 preceding siblings ...)
  2019-04-25 13:30 ` [U-Boot] [PATCH 3/4] mvebu: turris_omnia: fix eeprom/mcu device names Marek Behún
@ 2019-04-25 13:30 ` Marek Behún
  3 siblings, 0 replies; 9+ messages in thread
From: Marek Behún @ 2019-04-25 13:30 UTC (permalink / raw)
  To: u-boot

Add XHCI_HOST and XHCI_MVEBU to defconfig, so that user's can by default
boot from USB on Turris Omnia.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
 configs/turris_omnia_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig
index 85f214148a..4b792d9a5a 100644
--- a/configs/turris_omnia_defconfig
+++ b/configs/turris_omnia_defconfig
@@ -56,5 +56,7 @@ CONFIG_KIRKWOOD_SPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_MVEBU=y
 CONFIG_WDT=y
 CONFIG_WDT_ORION=y
-- 
2.21.0

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

* [U-Boot] [PATCH 1/4] i2c: mvtwsi: fix disabling i2c slave on Armada 38x
  2019-04-25 13:30 ` [U-Boot] [PATCH 1/4] i2c: mvtwsi: fix disabling i2c slave on Armada 38x Marek Behún
@ 2019-04-25 13:35   ` Pierre Bourdon
  2019-04-25 13:38     ` Marek Behún
  0 siblings, 1 reply; 9+ messages in thread
From: Pierre Bourdon @ 2019-04-25 13:35 UTC (permalink / raw)
  To: u-boot

On Thu, Apr 25, 2019 at 3:30 PM Marek Behún <marek.behun@nic.cz> wrote:
>
> Commit 173ec351 ("i2c: mvtwsi: disable i2c slave on Armada 38x") adds
> slave disabling code on port 0 into bind method. This does not work
> on Turris Omnia in SPL, because at the time the bind method is called in
> SPL, arch/arm/mach-mvebu/spl.c has not yet set DM translation offset,
> so the bind function reads from bad memory place, which causes a fault.
>
> Move the i2c slave disabling code into the probe method of mvtwsi, by
> that time dm_set_translation_offset is already called.

https://patchwork.ozlabs.org/patch/1084776/ implements a better fix
for this issue and has been merged in master with the latest DM pull
2h ago.

--
Pierre Bourdon <delroth@gmail.com>
Software Engineer @ Zürich, Switzerland
https://delroth.net/

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

* [U-Boot] [PATCH 1/4] i2c: mvtwsi: fix disabling i2c slave on Armada 38x
  2019-04-25 13:35   ` Pierre Bourdon
@ 2019-04-25 13:38     ` Marek Behún
  0 siblings, 0 replies; 9+ messages in thread
From: Marek Behún @ 2019-04-25 13:38 UTC (permalink / raw)
  To: u-boot

:) I did not know about that, thanks.

On Thu, 25 Apr 2019 15:35:10 +0200
Pierre Bourdon <delroth@gmail.com> wrote:

> On Thu, Apr 25, 2019 at 3:30 PM Marek Behún <marek.behun@nic.cz>
> wrote:
> >
> > Commit 173ec351 ("i2c: mvtwsi: disable i2c slave on Armada 38x")
> > adds slave disabling code on port 0 into bind method. This does not
> > work on Turris Omnia in SPL, because at the time the bind method is
> > called in SPL, arch/arm/mach-mvebu/spl.c has not yet set DM
> > translation offset, so the bind function reads from bad memory
> > place, which causes a fault.
> >
> > Move the i2c slave disabling code into the probe method of mvtwsi,
> > by that time dm_set_translation_offset is already called.  
> 
> https://patchwork.ozlabs.org/patch/1084776/ implements a better fix
> for this issue and has been merged in master with the latest DM pull
> 2h ago.
> 
> --
> Pierre Bourdon <delroth@gmail.com>
> Software Engineer @ Zürich, Switzerland
> https://delroth.net/

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

* [U-Boot] [PATCH 2/4] mvebu: turris_omnia: remove redundant code
  2019-04-25 13:30 ` [U-Boot] [PATCH 2/4] mvebu: turris_omnia: remove redundant code Marek Behún
@ 2019-04-28 11:59   ` Baruch Siach
  2019-04-29 20:54     ` Marek Behun
  0 siblings, 1 reply; 9+ messages in thread
From: Baruch Siach @ 2019-04-28 11:59 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On Thu, Apr 25 2019, Marek Behún wrote:
> The i2c slave disabling is done by mvtwsi driver and is not needed here.
>
> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> Cc: Baruch Siach <baruch@tkos.co.il>
> ---
>  board/CZ.NIC/turris_omnia/turris_omnia.c | 11 -----------
>  1 file changed, 11 deletions(-)
>
> diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
> index c21d2f3ffa..c446f471a6 100644
> --- a/board/CZ.NIC/turris_omnia/turris_omnia.c
> +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
> @@ -297,8 +297,6 @@ static int set_regdomain(void)
>  
>  int board_early_init_f(void)
>  {
> -	u32 i2c_debug_reg;
> -
>  	/* Configure MPP */
>  	writel(0x11111111, MVEBU_MPP_BASE + 0x00);
>  	writel(0x11111111, MVEBU_MPP_BASE + 0x04);
> @@ -321,15 +319,6 @@ int board_early_init_f(void)
>  	writel(OMNIA_GPP_OUT_ENA_LOW, MVEBU_GPIO0_BASE + 0x04);
>  	writel(OMNIA_GPP_OUT_ENA_MID, MVEBU_GPIO1_BASE + 0x04);
>  
> -	/*
> -	 * Disable I2C debug mode blocking 0x64 I2C address.
> -	 * Note: that would be redundant once Turris Omnia migrates to DM_I2C,
> -	 * because the mvtwsi driver includes equivalent code.
> -	 */

As this comment notes, Turris Omnia needs to migrate to DM_I2C before
removing this code. The non DM code path in the mvtwsi driver does not
disable the debug I2C client.

Is there a pending patch that enables DM_I2C for Turris Omnia?

> -	i2c_debug_reg = readl(MVEBU_TWSI_BASE + MVTWSI_ARMADA_DEBUG_REG);
> -	i2c_debug_reg &= ~(1<<18);
> -	writel(i2c_debug_reg, MVEBU_TWSI_BASE + MVTWSI_ARMADA_DEBUG_REG);
> -
>  	return 0;
>  }

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

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

* [U-Boot] [PATCH 2/4] mvebu: turris_omnia: remove redundant code
  2019-04-28 11:59   ` Baruch Siach
@ 2019-04-29 20:54     ` Marek Behun
  0 siblings, 0 replies; 9+ messages in thread
From: Marek Behun @ 2019-04-29 20:54 UTC (permalink / raw)
  To: u-boot

The next version of this patchseries will include patch with name
"arm: mvebu: turris_omnia: move I2C dependencies to Kconfig",
which adds
        select DM_I2C
to
config TARGET_TURRIS_OMNIA

Marek


On Sun, 28 Apr 2019 14:59:10 +0300
Baruch Siach <baruch@tkos.co.il> wrote:

> Hi Marek,
> 
> On Thu, Apr 25 2019, Marek Behún wrote:
> > The i2c slave disabling is done by mvtwsi driver and is not needed here.
> >
> > Signed-off-by: Marek Behún <marek.behun@nic.cz>
> > Cc: Baruch Siach <baruch@tkos.co.il>
> > ---
> >  board/CZ.NIC/turris_omnia/turris_omnia.c | 11 -----------
> >  1 file changed, 11 deletions(-)
> >
> > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
> > index c21d2f3ffa..c446f471a6 100644
> > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c
> > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
> > @@ -297,8 +297,6 @@ static int set_regdomain(void)
> >  
> >  int board_early_init_f(void)
> >  {
> > -	u32 i2c_debug_reg;
> > -
> >  	/* Configure MPP */
> >  	writel(0x11111111, MVEBU_MPP_BASE + 0x00);
> >  	writel(0x11111111, MVEBU_MPP_BASE + 0x04);
> > @@ -321,15 +319,6 @@ int board_early_init_f(void)
> >  	writel(OMNIA_GPP_OUT_ENA_LOW, MVEBU_GPIO0_BASE + 0x04);
> >  	writel(OMNIA_GPP_OUT_ENA_MID, MVEBU_GPIO1_BASE + 0x04);
> >  
> > -	/*
> > -	 * Disable I2C debug mode blocking 0x64 I2C address.
> > -	 * Note: that would be redundant once Turris Omnia migrates to DM_I2C,
> > -	 * because the mvtwsi driver includes equivalent code.
> > -	 */  
> 
> As this comment notes, Turris Omnia needs to migrate to DM_I2C before
> removing this code. The non DM code path in the mvtwsi driver does not
> disable the debug I2C client.
> 
> Is there a pending patch that enables DM_I2C for Turris Omnia?
> 
> > -	i2c_debug_reg = readl(MVEBU_TWSI_BASE + MVTWSI_ARMADA_DEBUG_REG);
> > -	i2c_debug_reg &= ~(1<<18);
> > -	writel(i2c_debug_reg, MVEBU_TWSI_BASE + MVTWSI_ARMADA_DEBUG_REG);
> > -
> >  	return 0;
> >  }  
> 
> baruch
> 

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

end of thread, other threads:[~2019-04-29 20:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-25 13:30 [U-Boot] [PATCH 0/4] Fixes for Turris Omnia Marek Behún
2019-04-25 13:30 ` [U-Boot] [PATCH 1/4] i2c: mvtwsi: fix disabling i2c slave on Armada 38x Marek Behún
2019-04-25 13:35   ` Pierre Bourdon
2019-04-25 13:38     ` Marek Behún
2019-04-25 13:30 ` [U-Boot] [PATCH 2/4] mvebu: turris_omnia: remove redundant code Marek Behún
2019-04-28 11:59   ` Baruch Siach
2019-04-29 20:54     ` Marek Behun
2019-04-25 13:30 ` [U-Boot] [PATCH 3/4] mvebu: turris_omnia: fix eeprom/mcu device names Marek Behún
2019-04-25 13:30 ` [U-Boot] [PATCH 4/4] arm: mvebu: turris_omnia: add XHCI to defconfig Marek Behún

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox