reef: Add SD card as bootable device
authorFreddy Paul <freddy.paul@intel.com>
Wed, 29 Jun 2016 22:02:24 +0000 (15:02 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Thu, 30 Jun 2016 04:32:05 +0000 (21:32 -0700)
This patch adds the SD card bootable device entry in the
board.c for reef.

BRANCH=None
BUG=chrome-os-partner:54917
TEST=Boot via SD card

Change-Id: Ib114b33a9bdc7e60ffc58ffa1c7d7f5646309f70
Signed-off-by: Freddy Paul <freddy.paul@intel.com>
Signed-off-by: Bora Guvendik <bora.guvendik@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/357360
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
src/board/reef/board.c

index 6ce0524..1457e25 100644 (file)
@@ -31,8 +31,9 @@
 #include "drivers/power/pch.h"
 #include "drivers/storage/sdhci.h"
 
-#define EMMC_SD_CLOCK_MIN       400000
-#define EMMC_CLOCK_MAX          200000000
+#define EMMC_SD_CLOCK_MIN      400000
+#define EMMC_CLOCK_MAX         200000000
+#define SD_CLOCK_MAX           52000000
 
 #define SPIBAR_BIOS_BFPREG     (0x0)
 #define  BFPREG_BASE_MASK       (0x7fff)
@@ -90,6 +91,16 @@ static int board_setup(void)
        list_insert_after(&emmc->mmc_ctrlr.ctrlr.list_node,
                        &fixed_block_dev_controllers);
 
+       /* SD Card (if present) */
+       pcidev_t sd_pci_dev = PCI_DEV(0, 0x1b, 0);
+       uint16_t sd_vendor_id = pci_read_config32(sd_pci_dev, REG_VENDOR_ID);
+       if (sd_vendor_id == PCI_VENDOR_ID_INTEL) {
+               SdhciHost *sd = new_pci_sdhci_host(sd_pci_dev, 1,
+                                       EMMC_SD_CLOCK_MIN, SD_CLOCK_MAX);
+               list_insert_after(&sd->mmc_ctrlr.ctrlr.list_node,
+                                       &removable_block_dev_controllers);
+       }
+
        /* PCH Power */
        power_set_ops(&apollolake_power_ops);