diff mbox series

[3/3] cmd: sata: Add block unbind device function

Message ID 20191204103558.24251-3-peng.ma@nxp.com
State Accepted
Commit 2d7818d04ff29581f497b70c8bd903516a179e9d
Delegated to: Tom Rini
Headers show
Series [1/3] ata: sata_sil: Continue probing other sata port when failed current port. | expand

Commit Message

Peng Ma Dec. 4, 2019, 10:36 a.m. UTC
If we didn't unbind the sata from block device, the same devices would
be added after sata remove,
This patch is to resolve this issue as below:

=> sata info
SATA#0:
	(3.0 Gbps)
SATA#1:
	(3.0 Gbps)
Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY30
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX30
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
=> sata stop
=> sata info
SATA#0:
	(3.0 Gbps)
SATA#1:
	(3.0 Gbps)
Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
Device 2: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
Device 3: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)

Signed-off-by: Peng Ma <peng.ma@nxp.com>
---
 cmd/sata.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Simon Glass Dec. 28, 2019, 2:26 a.m. UTC | #1
On Wed, 4 Dec 2019 at 03:36, Peng Ma <peng.ma@nxp.com> wrote:
>
> If we didn't unbind the sata from block device, the same devices would
> be added after sata remove,
> This patch is to resolve this issue as below:
>
> => sata info
> SATA#0:
>         (3.0 Gbps)
> SATA#1:
>         (3.0 Gbps)
> Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY30
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX30
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> => sata stop
> => sata info
> SATA#0:
>         (3.0 Gbps)
> SATA#1:
>         (3.0 Gbps)
> Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 2: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 3: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
>
> Signed-off-by: Peng Ma <peng.ma@nxp.com>
> ---
>  cmd/sata.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Peng Ma Dec. 30, 2019, 7:19 a.m. UTC | #2
Hi Simon,

>-----Original Message-----
>From: Simon Glass <sjg@chromium.org>
>Sent: 2019年12月28日 10:27
>To: Peng Ma <peng.ma@nxp.com>
>Cc: Priyanka Jain <priyanka.jain@nxp.com>; Marcel Ziswiler
><marcel.ziswiler@toradex.com>; Andy Tang <andy.tang@nxp.com>;
>u-boot@lists.denx.de
>Subject: [EXT] Re: [PATCH 3/3] cmd: sata: Add block unbind device function
>
>Caution: EXT Email
>
>On Wed, 4 Dec 2019 at 03:36, Peng Ma <peng.ma@nxp.com> wrote:
>>
>> If we didn't unbind the sata from block device, the same devices would
>> be added after sata remove, This patch is to resolve this issue as
>> below:
>>
>> => sata info
>> SATA#0:
>>         (3.0 Gbps)
>> SATA#1:
>>         (3.0 Gbps)
>> Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#:
>BTPR247005PY30
>>             Type: Hard Disk
>>             Supports 48-bit addressing
>>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512) Device
>> 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX30
>>             Type: Hard Disk
>>             Supports 48-bit addressing
>>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512) =>
>sata
>> stop => sata info
>> SATA#0:
>>         (3.0 Gbps)
>> SATA#1:
>>         (3.0 Gbps)
>> Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#:
>BTPR247005PY300
>>             Type: Hard Disk
>>             Supports 48-bit addressing
>>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512) Device
>> 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#:
>BTPR247005VX300
>>             Type: Hard Disk
>>             Supports 48-bit addressing
>>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512) Device
>> 2: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#:
>BTPR247005PY300
>>             Type: Hard Disk
>>             Supports 48-bit addressing
>>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512) Device
>> 3: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#:
>BTPR247005VX300
>>             Type: Hard Disk
>>             Supports 48-bit addressing
>>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
>>
>> Signed-off-by: Peng Ma <peng.ma@nxp.com>
>> ---
>>  cmd/sata.c | 2 ++
>>  1 file changed, 2 insertions(+)
>
>Reviewed-by: Simon Glass <sjg@chromium.org>
[Peng Ma] thanks very much.

Best Regards,
Peng
Tom Rini Jan. 8, 2020, 8:12 p.m. UTC | #3
On Wed, Dec 04, 2019 at 10:36:47AM +0000, Peng Ma wrote:

> If we didn't unbind the sata from block device, the same devices would
> be added after sata remove,
> This patch is to resolve this issue as below:
> 
> => sata info
> SATA#0:
> 	(3.0 Gbps)
> SATA#1:
> 	(3.0 Gbps)
> Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY30
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX30
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> => sata stop
> => sata info
> SATA#0:
> 	(3.0 Gbps)
> SATA#1:
> 	(3.0 Gbps)
> Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 2: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 3: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> 
> Signed-off-by: Peng Ma <peng.ma@nxp.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

This is a correct bug fix, yes.  It also causes size growth on tbs2910
that is in turn fatal on CI.  For the moment I'm setting this patch
aside so that I can take the rest of the series and figure out what to
do with tbs2910 again afterwards.
Anatolij Gustschin Jan. 8, 2020, 9:49 p.m. UTC | #4
On Wed, 8 Jan 2020 15:12:44 -0500
Tom Rini trini@konsulko.com wrote:
...
> This is a correct bug fix, yes.  It also causes size growth on tbs2910
> that is in turn fatal on CI.  For the moment I'm setting this patch
> aside so that I can take the rest of the series and figure out what to
> do with tbs2910 again afterwards.

Maybe we can apply patch [1] for tbs2910? But it hasn't been tested on
real hardware yet, it seems.

[1] http://patchwork.ozlabs.org/patch/1205244

--
Anatolij
Tom Rini Jan. 8, 2020, 9:57 p.m. UTC | #5
On Wed, Jan 08, 2020 at 10:49:44PM +0100, Anatolij Gustschin wrote:
> On Wed, 8 Jan 2020 15:12:44 -0500
> Tom Rini trini@konsulko.com wrote:
> ...
> > This is a correct bug fix, yes.  It also causes size growth on tbs2910
> > that is in turn fatal on CI.  For the moment I'm setting this patch
> > aside so that I can take the rest of the series and figure out what to
> > do with tbs2910 again afterwards.
> 
> Maybe we can apply patch [1] for tbs2910? But it hasn't been tested on
> real hardware yet, it seems.
> 
> [1] http://patchwork.ozlabs.org/patch/1205244

Yes, that seems like the best path forward.  Thanks!
Tom Rini Jan. 28, 2020, 12:56 a.m. UTC | #6
On Wed, Dec 04, 2019 at 10:36:47AM +0000, Peng Ma wrote:

> If we didn't unbind the sata from block device, the same devices would
> be added after sata remove,
> This patch is to resolve this issue as below:
> 
> => sata info
> SATA#0:
> 	(3.0 Gbps)
> SATA#1:
> 	(3.0 Gbps)
> Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY30
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX30
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> => sata stop
> => sata info
> SATA#0:
> 	(3.0 Gbps)
> SATA#1:
> 	(3.0 Gbps)
> Device 0: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 1: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 2: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005PY300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> Device 3: Model: INTEL SSDSA2BW300G3D Firm: 4PC10362 Ser#: BTPR247005VX300
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 286168.1 MB = 279.4 GB (586072368 x 512)
> 
> Signed-off-by: Peng Ma <peng.ma@nxp.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/cmd/sata.c b/cmd/sata.c
index a73cc54bd3..6bdb516cb5 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -26,6 +26,8 @@  int sata_remove(int devnum)
 	struct udevice *dev;
 	int rc;
 
+	blk_unbind_all(IF_TYPE_SATA);
+
 	rc = uclass_find_device(UCLASS_AHCI, devnum, &dev);
 	if (!rc && !dev)
 		rc = uclass_find_first_device(UCLASS_AHCI, &dev);