dm: ahci: Add a generic PCI-based AHCI driver
PATCH 1/3 dm: ahci: Add a generic PCI-based AHCI driver
This adds support for PCI-based AHCI controller and enables it on x86 by default.
---
drivers/ata/Kconfig | 7 +++++++ drivers/ata/Makefile | 1 + drivers/ata/ahci-pci.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 drivers/ata/ahci-pci.c
drivers/ata/Kconfig +7 -0
@@ -40,6 +40,13 @@ config DM_SCSI menu "SATA/SCSI device support" +config AHCI_PCI + bool "Support for PCI-based AHCI controller" + default y if X86 + select DM_SCSI + help + Enables support for the PCI-based AHCI controller. + config SATA_CEVA bool "Ceva Sata controller" depends on AHCI
drivers/ata/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_DWC_AHCI) += dwc_ahci.o obj-$(CONFIG_AHCI) += ahci-uclass.o +obj-$(CONFIG_AHCI_PCI) += ahci-pci.o obj-$(CONFIG_SCSI_AHCI) += ahci.o obj-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o obj-$(CONFIG_FSL_SATA) += fsl_sata.o
drivers/ata/ahci-pci.c new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.9.2
PATCH 2/3 dm: ahci: Avoid scsi_scan_dev() in ahci_probe_scsi()
Running 'scsi scan' command causes scsi_scan_dev() to be called, from which device_probe() is called and consequently AHCI driver probe routine will be called as SCSI driver's parent, and finally ahci_probe_scsi() calls scsi_scan_dev() again.
Remove the call to scsi_scan_dev() in ahci_probe_scsi().
---
drivers/ata/ahci.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/ata/ahci.c +0 -5
@@ -1183,11 +1183,6 @@ int ahci_probe_scsi(struct udevice *ahci_dev) ret =ahci_start_ports (uc_priv);if (ret)return ret; - -debug ("Scanning %s\n" , dev->name); - ret =scsi_scan_dev (dev, true); -if (ret) -return ret;#endif return 0 ;
Signature · 1 line
2.9.2
PATCH 3/3 cmd: scsi: Fix null pointer dereference in 'scsi reset'
In reply to Bin MengDuring 'scsi reset', scsi_bus_reset() is called with udevice pointed to NULL, which causes exception. As a temporary fix, disable the call for DM SCSI for now.
---
cmd/scsi.c | 2 ++ 1 file changed, 2 insertions(+)
cmd/scsi.c +2 -0
@@ -36,7 +36,9 @@ static int do_scsi(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])case 2 :if (strncmp (argv[1 ],"res" ,3 ) ==0 ) {printf ("\nReset SCSI\n" ); +#ifndef CONFIG_DM_SCSI scsi_bus_reset (NULL ); +#endif ret =scsi_scan (true);if (ret)return CMD_RET_FAILURE ;
Signature · 1 line
2.9.2
PATCH 2/3 dm: ahci: Avoid scsi_scan_dev() in ahci_probe_scsi()
In reply to Bin MengQuoted 5 lines · Bin Meng
Running 'scsi scan' command causes
scsi_scan_dev()to be called, from whichdevice_probe()is called and consequently AHCI driver probe routine will be called as SCSI driver's parent, and finallyahci_probe_scsi()callsscsi_scan_dev()again.
Quoted 7 lines
Remove the call to
scsi_scan_dev()inahci_probe_scsi().Signed-off-by Bin Meng <[email protected]>---
drivers/ata/ahci.c| 5 -----1 file changed, 5 deletions(-)
I just sent a similar patch but anyway I agree this is a good idea.
PATCH 3/3 cmd: scsi: Fix null pointer dereference in 'scsi reset'
In reply to Bin MengQuoted 9 lines · Bin Meng
During 'scsi reset',
scsi_bus_reset()is called with udevice pointed to NULL, which causes exception. As a temporary fix, disable the call for DM SCSI for now.Signed-off-by Bin Meng <[email protected]>---
cmd/scsi.c| 2 ++1 file changed, 2 insertions(+)
PATCH 1/3 dm: ahci: Add a generic PCI-based AHCI driver
In reply to Bin MengHi Bin,
Quoted 11 lines · Bin Meng
This adds support for PCI-based AHCI controller and enables it on x86 by default.
Signed-off-by Bin Meng <[email protected]>---
drivers/ata/Kconfig | 7 +++++++ drivers/ata/Makefile | 1 + drivers/ata/ahci-pci.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 drivers/ata/ahci-pci.c
I believe that if the device tree specifies this driver then it will override the generic PCI probing done here. Is that right?
- Simon
Quoted 82 lines
drivers/ata/Kconfig +7
-0@@ -40,6 +40,13 @@ config DM_SCSI menu "SATA/SCSI device support" +config AHCI_PCI + bool "Support for PCI-based AHCI controller" + default y if X86 + select DM_SCSI + help + Enables support for the PCI-based AHCI controller. + config SATA_CEVA bool "Ceva Sata controller" depends on AHCIdrivers/ata/Makefile +1
-0@@ -7,6 +7,7 @@ obj-$(CONFIG_DWC_AHCI) += dwc_ahci.o obj-$(CONFIG_AHCI) += ahci-uclass.o +obj-$(CONFIG_AHCI_PCI) += ahci-pci.o obj-$(CONFIG_SCSI_AHCI) += ahci.o obj-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o obj-$(CONFIG_FSL_SATA) += fsl_sata.odrivers/ata/ahci-pci.c new file +42
-1@@ -0,0 +1,42 @@ +/* +* Copyright (C) 2017, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <ahci.h> +#include <dm.h> +#include <pci.h> + +static int ahci_pci_bind (struct udevice *dev) +{ +struct udevice *scsi_dev; + +return ahci_bind_scsi (dev, &scsi_dev); +} + +static int ahci_pci_probe (struct udevice *dev) +{ +return ahci_probe_scsi (dev); +} + +static const struct udevice_id ahci_pci_ids[] = { + { .compatible ="ahci-pci" }, + { } +}; + +U_BOOT_DRIVER (ahci_pci) = { + .name ="ahci_pci" , + .id =UCLASS_AHCI , + .of_match = ahci_pci_ids, + .bind = ahci_pci_bind, + .probe = ahci_pci_probe, +}; + +static struct pci_device_id ahci_pci_supported[] = { + {PCI_DEVICE_CLASS (PCI_CLASS_STORAGE_SATA_AHCI , ~0 ) }, + {}, +}; + +U_BOOT_PCI_DEVICE (ahci_pci, ahci_pci_supported); --2.9.2
PATCH 1/3 dm: ahci: Add a generic PCI-based AHCI driver
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Bin,
Quoted 6 lines · Bin Meng
This adds support for PCI-based AHCI controller and enables it on x86 by default.
Signed-off-by Bin Meng <[email protected]>---
Quoted 9 lines
Quoted 5 lines
drivers/ata/Kconfig | 7 +++++++ drivers/ata/Makefile | 1 + drivers/ata/ahci-pci.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 drivers/ata/ahci-pci.cI believe that if the device tree specifies this driver then it will override the generic PCI probing done here. Is that right?
That's my understanding as well but I have no target to test. Can you test that on Chromebook Link?
Regards,
Bin
PATCH 1/3 dm: ahci: Add a generic PCI-based AHCI driver
Hi Simon,
Quoted 18 lines · Bin Meng
Hi Simon,
Quoted 15 lines · Simon Glass
Hi Bin,
Quoted 11 lines · Bin Meng
This adds support for PCI-based AHCI controller and enables it on x86 by default.
Signed-off-by Bin Meng <[email protected]>---
drivers/ata/Kconfig | 7 +++++++ drivers/ata/Makefile | 1 + drivers/ata/ahci-pci.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 drivers/ata/ahci-pci.c
Quoted 6 lines
Quoted 3 lines
I believe that if the device tree specifies this driver then it will override the generic PCI probing done here. Is that right?
That's my understanding as well but I have no target to test. Can you test that on Chromebook Link?
Will this series be applied to u-boot-dm?
Regards,
Bin
PATCH 1/3 dm: ahci: Add a generic PCI-based AHCI driver
Hi Bin,
Quoted 21 lines · Bin Meng
Hi Simon,
Quoted 18 lines · Bin Meng
Hi Simon,
Quoted 15 lines · Simon Glass
Hi Bin,
Quoted 11 lines · Bin Meng
This adds support for PCI-based AHCI controller and enables it on x86 by default.
Signed-off-by Bin Meng <[email protected]>---
drivers/ata/Kconfig | 7 +++++++ drivers/ata/Makefile | 1 + drivers/ata/ahci-pci.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 drivers/ata/ahci-pci.c
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I believe that if the device tree specifies this driver then it will override the generic PCI probing done here. Is that right?
That's my understanding as well but I have no target to test. Can you test that on Chromebook Link?
Will this series be applied to u-boot-dm?
Yes, just got to testing this. Had some problems booting the device.
Tested-on: chromebook_link
Quoted 3 lines
Regards,
Bin
PATCH 3/3 cmd: scsi: Fix null pointer dereference in 'scsi reset'
In reply to Simon GlassQuoted 9 lines · Bin Meng
During 'scsi reset',
scsi_bus_reset()is called with udevice pointed to NULL, which causes exception. As a temporary fix, disable the call for DM SCSI for now.Signed-off-by Bin Meng <[email protected]>---
cmd/scsi.c| 2 ++1 file changed, 2 insertions(+)
Applied to u-boot-dm, thanks!
PATCH 2/3 dm: ahci: Avoid scsi_scan_dev() in ahci_probe_scsi()
In reply to Simon GlassQuoted 5 lines · Bin Meng
Running 'scsi scan' command causes
scsi_scan_dev()to be called, from whichdevice_probe()is called and consequently AHCI driver probe routine will be called as SCSI driver's parent, and finallyahci_probe_scsi()callsscsi_scan_dev()again.
Quoted 7 lines
Remove the call to
scsi_scan_dev()inahci_probe_scsi().Signed-off-by Bin Meng <[email protected]>---
drivers/ata/ahci.c| 5 -----1 file changed, 5 deletions(-)
I just sent a similar patch but anyway I agree this is a good idea.
Applied to u-boot-dm, thanks!
PATCH 1/3 dm: ahci: Add a generic PCI-based AHCI driver
In reply to Simon GlassHi Bin,
Quoted 31 lines · Simon Glass
Hi Bin,
Quoted 28 lines · Bin Meng
Hi Simon,
Quoted 24 lines · Bin Meng
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Bin,
Quoted 6 lines · Bin Meng
This adds support for PCI-based AHCI controller and enables it on x86 by default.
Signed-off-by Bin Meng <[email protected]>---
Quoted 9 lines
Quoted 5 lines
drivers/ata/Kconfig | 7 +++++++ drivers/ata/Makefile | 1 + drivers/ata/ahci-pci.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 drivers/ata/ahci-pci.cI believe that if the device tree specifies this driver then it will override the generic PCI probing done here. Is that right?
That's my understanding as well but I have no target to test. Can you test that on Chromebook Link?
Quoted 7 lines
Quoted 1 line
Will this series be applied to u-boot-dm?
Yes, just got to testing this. Had some problems booting the device.
Reviewed-by Simon Glass <[email protected]>Tested-on:
chromebook_linkTested-by Simon Glass <[email protected]>
Unfortunately this produces a build warning when applied to u-boot-dm/master:
+warning: (AHCI_PCI) selects DM_SCSI which has unmet direct dependencies (BLK || BLK)
Can you please take a look? I'm sorry I did not get to it earlier.
Regards,
Simon
PATCH 1/3 dm: ahci: Add a generic PCI-based AHCI driver
Hi Simon,
Quoted 42 lines · Simon Glass
Hi Bin,
Quoted 31 lines · Simon Glass
Hi Bin,
Quoted 28 lines · Bin Meng
Hi Simon,
Quoted 24 lines · Bin Meng
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Bin,
Quoted 6 lines · Bin Meng
This adds support for PCI-based AHCI controller and enables it on x86 by default.
Signed-off-by Bin Meng <[email protected]>---
Quoted 9 lines
Quoted 5 lines
drivers/ata/Kconfig | 7 +++++++ drivers/ata/Makefile | 1 + drivers/ata/ahci-pci.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 drivers/ata/ahci-pci.cI believe that if the device tree specifies this driver then it will override the generic PCI probing done here. Is that right?
That's my understanding as well but I have no target to test. Can you test that on Chromebook Link?
Quoted 7 lines
Quoted 1 line
Will this series be applied to u-boot-dm?
Yes, just got to testing this. Had some problems booting the device.
Reviewed-by Simon Glass <[email protected]>Tested-on:
chromebook_linkTested-by Simon Glass <[email protected]>
Quoted 6 lines
Unfortunately this produces a build warning when applied to u-boot-dm/master:
+warning: (
AHCI_PCI) selectsDM_SCSIwhich has unmet direct dependencies (BLK || BLK)Can you please take a look? I'm sorry I did not get to it earlier.
Sure I will take a look.
Regards,
Bin