Commit 32e9ec1f8812ffe5874a2e3a0a1b8fe85c489ab8

Authored by Simon Glass
1 parent 7337fcd8c0

x86: Move link to use driver model for SCSI

As a demonstration of how to use SCSI with driver model, move link over
to use this. This patch needs more work, but illustrates the concept.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Showing 4 changed files with 27 additions and 1 deletions Side-by-side Diff

arch/x86/cpu/ivybridge/sata.c
... ... @@ -6,6 +6,7 @@
6 6 */
7 7  
8 8 #include <common.h>
  9 +#include <ahci.h>
9 10 #include <dm.h>
10 11 #include <fdtdec.h>
11 12 #include <asm/io.h>
... ... @@ -208,6 +209,20 @@
208 209 dm_pci_write_config16(dev, 0x90, map);
209 210 }
210 211  
  212 +static int bd82x6x_sata_bind(struct udevice *dev)
  213 +{
  214 + struct udevice *scsi_dev;
  215 + int ret;
  216 +
  217 + if (gd->flags & GD_FLG_RELOC) {
  218 + ret = ahci_bind_scsi(dev, &scsi_dev);
  219 + if (ret)
  220 + return ret;
  221 + }
  222 +
  223 + return 0;
  224 +}
  225 +
211 226 static int bd82x6x_sata_probe(struct udevice *dev)
212 227 {
213 228 struct udevice *pch;
214 229  
... ... @@ -219,8 +234,12 @@
219 234  
220 235 if (!(gd->flags & GD_FLG_RELOC))
221 236 bd82x6x_sata_enable(dev);
222   - else
  237 + else {
223 238 bd82x6x_sata_init(dev, pch);
  239 + ret = ahci_probe_scsi(dev);
  240 + if (ret)
  241 + return ret;
  242 + }
224 243  
225 244 return 0;
226 245 }
... ... @@ -234,6 +253,7 @@
234 253 .name = "ahci_ivybridge",
235 254 .id = UCLASS_AHCI,
236 255 .of_match = bd82x6x_ahci_ids,
  256 + .bind = bd82x6x_sata_bind,
237 257 .probe = bd82x6x_sata_probe,
238 258 };
configs/chromebook_link64_defconfig
... ... @@ -58,6 +58,8 @@
58 58 CONFIG_SYSCON=y
59 59 CONFIG_SPL_SYSCON=y
60 60 CONFIG_SCSI=y
  61 +CONFIG_DM_SCSI=y
  62 +CONFIG_BLK=y
61 63 CONFIG_CPU=y
62 64 CONFIG_DM_I2C=y
63 65 CONFIG_SYS_I2C_INTEL=y
configs/chromebook_link_defconfig
... ... @@ -41,6 +41,8 @@
41 41 CONFIG_REGMAP=y
42 42 CONFIG_SYSCON=y
43 43 CONFIG_SCSI=y
  44 +CONFIG_DM_SCSI=y
  45 +CONFIG_BLK=y
44 46 CONFIG_CPU=y
45 47 CONFIG_DM_I2C=y
46 48 CONFIG_SYS_I2C_INTEL=y
configs/chromebox_panther_defconfig
... ... @@ -37,6 +37,8 @@
37 37 CONFIG_REGMAP=y
38 38 CONFIG_SYSCON=y
39 39 CONFIG_SCSI=y
  40 +CONFIG_DM_SCSI=y
  41 +CONFIG_BLK=y
40 42 CONFIG_CROS_EC=y
41 43 CONFIG_CROS_EC_LPC=y
42 44 CONFIG_SPI_FLASH=y