summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLee Leahy <leroy.p.leahy@intel.com>2017-05-08 16:56:03 -0700
committerLee Leahy <leroy.p.leahy@intel.com>2017-05-12 18:20:33 +0200
commit48dbc663d75e6b7e45e50cd099acb88b35e65a0a (patch)
treef60c19148b8be447c5350f939ac9d832e379579c /src
parentf542aca0908ead68314a6d9603dde8849abcff19 (diff)
downloadcoreboot-48dbc663d75e6b7e45e50cd099acb88b35e65a0a.tar.xz
commonlib: Move drivers/storage into commonlib/storage
Move drivers/storage into commonlib/storage to enable access by libpayload and indirectly by payloads. * Remove SD/MMC specific include files from include/device * Remove files from drivers/storage * Add SD/MMC specific include files to commonlib/include * Add files to commonlib/storage * Fix header file references * Add subdir entry in commonlib/Makefile.inc to build the SD/MMC driver * Add Kconfig source for commonlib/storage * Rename *DEVICE* to *COMMONLIB* * Rename *DRIVERS_STORAGE* to *COMMONLIB_STORAGE* TEST=Build and run on Galileo Gen2 Change-Id: I4339e4378491db9a0da1f2dc34e1906a5ba31ad6 Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com> Reviewed-on: https://review.coreboot.org/19672 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/Kconfig1
-rw-r--r--src/arch/x86/car.ld2
-rw-r--r--src/commonlib/Makefile.inc2
-rw-r--r--src/commonlib/include/commonlib/sd_mmc_ctrlr.h (renamed from src/include/device/sd_mmc_ctrlr.h)6
-rw-r--r--src/commonlib/include/commonlib/sdhci.h (renamed from src/include/device/sdhci.h)8
-rw-r--r--src/commonlib/include/commonlib/storage.h (renamed from src/include/device/storage.h)8
-rw-r--r--src/commonlib/storage/Kconfig (renamed from src/drivers/storage/Kconfig)10
-rw-r--r--src/commonlib/storage/Makefile.inc (renamed from src/drivers/storage/Makefile.inc)12
-rw-r--r--src/commonlib/storage/bouncebuf.c (renamed from src/drivers/storage/bouncebuf.c)0
-rw-r--r--src/commonlib/storage/bouncebuf.h (renamed from src/drivers/storage/bouncebuf.h)6
-rw-r--r--src/commonlib/storage/mmc.c (renamed from src/drivers/storage/mmc.c)2
-rw-r--r--src/commonlib/storage/mmc.h (renamed from src/drivers/storage/mmc.h)8
-rw-r--r--src/commonlib/storage/pci_sdhci.c (renamed from src/drivers/storage/pci_sdhci.c)2
-rw-r--r--src/commonlib/storage/sd.c (renamed from src/drivers/storage/sd.c)4
-rw-r--r--src/commonlib/storage/sd_mmc.c (renamed from src/drivers/storage/sd_mmc.c)6
-rw-r--r--src/commonlib/storage/sd_mmc.h (renamed from src/drivers/storage/sd_mmc.h)18
-rw-r--r--src/commonlib/storage/sdhci.c (renamed from src/drivers/storage/sdhci.c)6
-rw-r--r--src/commonlib/storage/sdhci.h (renamed from src/drivers/storage/sdhci.h)8
-rw-r--r--src/commonlib/storage/sdhci_adma.c (renamed from src/drivers/storage/sdhci_adma.c)4
-rw-r--r--src/commonlib/storage/sdhci_display.c (renamed from src/drivers/storage/sdhci_display.c)6
-rw-r--r--src/commonlib/storage/storage.c (renamed from src/drivers/storage/storage.c)20
-rw-r--r--src/commonlib/storage/storage.h (renamed from src/drivers/storage/storage.h)8
-rw-r--r--src/commonlib/storage/storage_erase.c (renamed from src/drivers/storage/storage_erase.c)0
-rw-r--r--src/commonlib/storage/storage_write.c (renamed from src/drivers/storage/storage_write.c)0
-rw-r--r--src/mainboard/intel/galileo/Kconfig2
-rw-r--r--src/mainboard/intel/galileo/Makefile.inc4
-rw-r--r--src/mainboard/intel/galileo/sd.c4
-rw-r--r--src/soc/intel/quark/Kconfig7
-rw-r--r--src/soc/intel/quark/include/soc/storage_test.h2
-rw-r--r--src/soc/intel/quark/sd.c4
-rw-r--r--src/soc/intel/quark/storage_test.c4
31 files changed, 88 insertions, 86 deletions
diff --git a/src/Kconfig b/src/Kconfig
index ffaf7eb25e..2ab9861baf 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -353,6 +353,7 @@ source "src/device/Kconfig"
menu "Generic Drivers"
source "src/drivers/*/Kconfig"
source "src/drivers/*/*/Kconfig"
+source "src/commonlib/storage/Kconfig"
endmenu
source "src/acpi/Kconfig"
diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld
index a9a281e3b1..bfc1b03bd3 100644
--- a/src/arch/x86/car.ld
+++ b/src/arch/x86/car.ld
@@ -44,7 +44,7 @@
* to reside in the migrated area (between _car_relocatable_data_start
* and _car_relocatable_data_end). */
TIMESTAMP(., 0x100)
-#if IS_ENABLED(CONFIG_DRIVERS_STORAGE)
+#if IS_ENABLED(CONFIG_COMMONLIB_STORAGE)
_car_drivers_storage_start = .;
. += 256;
_car_drivers_storage_end = .;
diff --git a/src/commonlib/Makefile.inc b/src/commonlib/Makefile.inc
index 255a241cba..edd17c36bf 100644
--- a/src/commonlib/Makefile.inc
+++ b/src/commonlib/Makefile.inc
@@ -1,3 +1,5 @@
+subdirs-y += storage
+
bootblock-y += mem_pool.c
verstage-y += mem_pool.c
romstage-y += mem_pool.c
diff --git a/src/include/device/sd_mmc_ctrlr.h b/src/commonlib/include/commonlib/sd_mmc_ctrlr.h
index 2ca2d0f19a..247c0a513a 100644
--- a/src/include/device/sd_mmc_ctrlr.h
+++ b/src/commonlib/include/commonlib/sd_mmc_ctrlr.h
@@ -16,8 +16,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
-#ifndef __DEVICE_SD_MMC_CTRLR_H__
-#define __DEVICE_SD_MMC_CTRLR_H__
+#ifndef __COMMONLIB_SD_MMC_CTRLR_H__
+#define __COMMONLIB_SD_MMC_CTRLR_H__
#include <stdint.h>
@@ -225,4 +225,4 @@ void sdhc_log_command_issued(void);
void sdhc_log_response(uint32_t entries, uint32_t *response);
void sdhc_log_ret(int ret);
-#endif /* __DEVICE_SD_MMC_CTRLR_H__ */
+#endif /* __COMMONLIB_SD_MMC_CTRLR_H__ */
diff --git a/src/include/device/sdhci.h b/src/commonlib/include/commonlib/sdhci.h
index a86582d767..ffeb6625d9 100644
--- a/src/include/device/sdhci.h
+++ b/src/commonlib/include/commonlib/sdhci.h
@@ -16,10 +16,10 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
-#ifndef __DEVICE_SDHCI_H__
-#define __DEVICE_SDHCI_H__
+#ifndef __COMMONLIB_SDHCI_H__
+#define __COMMONLIB_SDHCI_H__
-#include <device/sd_mmc_ctrlr.h>
+#include <commonlib/sd_mmc_ctrlr.h>
/* Driver specific capabilities */
#define DRVR_CAP_1V8_VDD 0x00010000
@@ -73,4 +73,4 @@ struct sd_mmc_ctrlr *new_pci_sdhci_controller(uint32_t dev);
/* Add SDHCI controller with memory address */
struct sd_mmc_ctrlr *new_mem_sdhci_controller(void *ioaddr);
-#endif /* __DEVICE_SDHCI_H__ */
+#endif /* __COMMONLIB_SDHCI_H__ */
diff --git a/src/include/device/storage.h b/src/commonlib/include/commonlib/storage.h
index ef7e0ff6e0..6ad53dcf8e 100644
--- a/src/include/device/storage.h
+++ b/src/commonlib/include/commonlib/storage.h
@@ -16,10 +16,10 @@
* GNU General Public License for more details.
*/
-#ifndef __DEVICE_STORAGE_H__
-#define __DEVICE_STORAGE_H__
+#ifndef __COMMONLIB_STORAGE_H__
+#define __COMMONLIB_STORAGE_H__
-#include <device/sd_mmc_ctrlr.h>
+#include <commonlib/sd_mmc_ctrlr.h>
/*
* EXT_CSD fields
@@ -148,4 +148,4 @@ int storage_set_partition(struct storage_media *media,
void storage_display_setup(struct storage_media *media);
-#endif /* __DEVICE_STORAGE_H__ */
+#endif /* __COMMONLIB_STORAGE_H__ */
diff --git a/src/drivers/storage/Kconfig b/src/commonlib/storage/Kconfig
index 497c0acc04..c7bb70d399 100644
--- a/src/drivers/storage/Kconfig
+++ b/src/commonlib/storage/Kconfig
@@ -13,17 +13,17 @@
## GNU General Public License for more details.
##
-config DRIVERS_STORAGE
+config COMMONLIB_STORAGE
bool
default n
-if DRIVERS_STORAGE
+if COMMONLIB_STORAGE
-config DRIVERS_STORAGE_MMC
+config COMMONLIB_STORAGE_MMC
bool "Enable MultiMediaCard (MMC) and eMMC device support"
default n
-config DRIVERS_STORAGE_SD
+config COMMONLIB_STORAGE_SD
bool "Enable Secure Digital (SD) memory card support"
default n
@@ -102,4 +102,4 @@ config SDHCI_BOUNCE_BUFFER
default n
endif # SDHCI_CONTROLLER
-endif # DRIVERS_STORAGE
+endif # COMMONLIB_STORAGE
diff --git a/src/drivers/storage/Makefile.inc b/src/commonlib/storage/Makefile.inc
index c4f75c70e2..af5137e287 100644
--- a/src/drivers/storage/Makefile.inc
+++ b/src/commonlib/storage/Makefile.inc
@@ -13,7 +13,7 @@
# GNU General Public License for more details.
#
-ifeq ($(CONFIG_DRIVERS_STORAGE),y)
+ifeq ($(CONFIG_COMMONLIB_STORAGE),y)
bootblock-y += sd_mmc.c
bootblock-y += storage.c
@@ -69,22 +69,22 @@ endif # CONFIG_SDHCI_BOUNCE_BUFFER
endif # CONFIG_SDHCI_CONTROLLER
# Determine if MultiMediaCards or embedded MMC devices are supported
-ifeq ($(CONFIG_DRIVERS_STORAGE_MMC),y)
+ifeq ($(CONFIG_COMMONLIB_STORAGE_MMC),y)
bootblock-y += mmc.c
verstage-y += mmc.c
romstage-y += mmc.c
postcar-y += mmc.c
ramstage-y += mmc.c
-endif # CONFIG_DRIVERS_STORAGE_MMC
+endif # CONFIG_COMMONLIB_STORAGE_MMC
# Determine if Secure Digital cards are supported
-ifeq ($(CONFIG_DRIVERS_STORAGE_SD),y)
+ifeq ($(CONFIG_COMMONLIB_STORAGE_SD),y)
bootblock-y += sd.c
verstage-y += sd.c
romstage-y += sd.c
postcar-y += sd.c
ramstage-y += sd.c
-endif # CONFIG_DRIVERS_STORAGE_SD
+endif # CONFIG_COMMONLIB_STORAGE_SD
# Determine if erase operations are supported
ifeq ($(CONFIG_STORAGE_ERASE),y)
@@ -104,4 +104,4 @@ postcar-y += storage_write.c
ramstage-y += storage_write.c
endif # CONFIG_STORAGE_WRITE
-endif # CONFIG_DRIVERS_STORAGE
+endif # CONFIG_COMMONLIB_STORAGE
diff --git a/src/drivers/storage/bouncebuf.c b/src/commonlib/storage/bouncebuf.c
index c8125aaa42..c8125aaa42 100644
--- a/src/drivers/storage/bouncebuf.c
+++ b/src/commonlib/storage/bouncebuf.c
diff --git a/src/drivers/storage/bouncebuf.h b/src/commonlib/storage/bouncebuf.h
index deea4f8636..27d92e826b 100644
--- a/src/drivers/storage/bouncebuf.h
+++ b/src/commonlib/storage/bouncebuf.h
@@ -15,8 +15,8 @@
* GNU General Public License for more details.
*/
-#ifndef __DRIVERS_STORAGE_BOUNCEBUF_H__
-#define __DRIVERS_STORAGE_BOUNCEBUF_H__
+#ifndef __COMMONLIB_STORAGE_BOUNCEBUF_H__
+#define __COMMONLIB_STORAGE_BOUNCEBUF_H__
#include <stddef.h>
#include <stdint.h>
@@ -93,4 +93,4 @@ int bounce_buffer_stop(struct bounce_buffer *state);
#define ARCH_DMA_MINALIGN (DMA_MINALIGN)
#endif
-#endif // __DRIVERS_STORAGE_BOUNCEBUF_H__
+#endif // __COMMONLIB_STORAGE_BOUNCEBUF_H__
diff --git a/src/drivers/storage/mmc.c b/src/commonlib/storage/mmc.c
index 973672368a..4289b01f33 100644
--- a/src/drivers/storage/mmc.c
+++ b/src/commonlib/storage/mmc.c
@@ -19,8 +19,8 @@
* GNU General Public License for more details.
*/
+#include <commonlib/storage.h>
#include <console/console.h>
-#include <device/storage.h>
#include "sd_mmc.h"
#include "mmc.h"
#include "sd_mmc.h"
diff --git a/src/drivers/storage/mmc.h b/src/commonlib/storage/mmc.h
index 42d7a4a5de..87d16353c8 100644
--- a/src/drivers/storage/mmc.h
+++ b/src/commonlib/storage/mmc.h
@@ -16,10 +16,10 @@
* GNU General Public License for more details.
*/
-#ifndef __DRIVER_STORAGE_MMC_H__
-#define __DRIVER_STORAGE_MMC_H__
+#ifndef __COMMONLIB_STORAGE_MMC_H__
+#define __COMMONLIB_STORAGE_MMC_H__
-#include <device/sd_mmc_ctrlr.h>
+#include <commonlib/sd_mmc_ctrlr.h>
#define MMC_HS_TIMING 0x00000100
#define MMC_HS_52MHZ 0x2
@@ -51,4 +51,4 @@
int storage_block_setup_media(struct storage_media *media,
struct sd_mmc_ctrlr *ctrlr);
-#endif /* __DRIVER_STORAGE_MMC_H__ */
+#endif /* __COMMONLIB_STORAGE_MMC_H__ */
diff --git a/src/drivers/storage/pci_sdhci.c b/src/commonlib/storage/pci_sdhci.c
index 1d3974eaea..c53ab001a9 100644
--- a/src/drivers/storage/pci_sdhci.c
+++ b/src/commonlib/storage/pci_sdhci.c
@@ -19,9 +19,9 @@
#endif
#include <assert.h>
+#include <commonlib/sdhci.h>
#include <console/console.h>
#include <device/pci.h>
-#include <device/sdhci.h>
#include "sd_mmc.h"
#include "storage.h"
#include <string.h>
diff --git a/src/drivers/storage/sd.c b/src/commonlib/storage/sd.c
index 6f4887a1a1..bd23b7f70c 100644
--- a/src/drivers/storage/sd.c
+++ b/src/commonlib/storage/sd.c
@@ -20,9 +20,9 @@
*/
#include <assert.h>
+#include <commonlib/sd_mmc_ctrlr.h>
+#include <commonlib/storage.h>
#include <delay.h>
-#include <device/sd_mmc_ctrlr.h>
-#include <device/storage.h>
#include <endian.h>
#include "sd_mmc.h"
#include "storage.h"
diff --git a/src/drivers/storage/sd_mmc.c b/src/commonlib/storage/sd_mmc.c
index e018c968af..0ca53b7d20 100644
--- a/src/drivers/storage/sd_mmc.c
+++ b/src/commonlib/storage/sd_mmc.c
@@ -21,8 +21,8 @@
*/
#include <assert.h>
+#include <commonlib/storage.h>
#include <delay.h>
-#include <device/storage.h>
#include <endian.h>
#include "mmc.h"
#include "sd_mmc.h"
@@ -168,7 +168,7 @@ int sd_mmc_enter_standby(struct storage_media *media)
/* Test for SD version 2 */
err = CARD_TIMEOUT;
- if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_SD)) {
+ if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_SD)) {
err = sd_send_if_cond(media);
/* Get SD card operating condition */
@@ -177,7 +177,7 @@ int sd_mmc_enter_standby(struct storage_media *media)
}
/* If the command timed out, we check for an MMC card */
- if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC) && (err == CARD_TIMEOUT)) {
+ if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC) && (err == CARD_TIMEOUT)) {
/* Some cards seem to need this */
sd_mmc_go_idle(media);
diff --git a/src/drivers/storage/sd_mmc.h b/src/commonlib/storage/sd_mmc.h
index 57f78acaa6..d54bbc7537 100644
--- a/src/drivers/storage/sd_mmc.h
+++ b/src/commonlib/storage/sd_mmc.h
@@ -12,11 +12,11 @@
* GNU General Public License for more details.
*/
-#ifndef __DRIVERS_STORAGE_SD_MMC_H__
-#define __DRIVERS_STORAGE_SD_MMC_H__
+#ifndef __COMMONLIB_STORAGE_SD_MMC_H__
+#define __COMMONLIB_STORAGE_SD_MMC_H__
-#include <device/sd_mmc_ctrlr.h>
-#include <device/storage.h>
+#include <commonlib/sd_mmc_ctrlr.h>
+#include <commonlib/storage.h>
#include <stddef.h>
#define SD_MMC_IO_RETRIES 1000
@@ -49,11 +49,13 @@ int sd_mmc_send_status(struct storage_media *media, ssize_t tries);
int sd_mmc_set_blocklen(struct sd_mmc_ctrlr *ctrlr, int len);
/* MMC support routines */
+int mmc_change_freq(struct storage_media *media);
int mmc_complete_op_cond(struct storage_media *media);
const char *mmc_partition_name(struct storage_media *media,
unsigned int partition_number);
int mmc_send_ext_csd(struct sd_mmc_ctrlr *ctrlr, unsigned char *ext_csd);
int mmc_send_op_cond(struct storage_media *media);
+int mmc_set_bus_width(struct storage_media *media);
int mmc_set_partition(struct storage_media *media,
unsigned int partition_number);
int mmc_update_capacity(struct storage_media *media);
@@ -64,13 +66,9 @@ const char *sd_partition_name(struct storage_media *media,
unsigned int partition_number);
int sd_send_if_cond(struct storage_media *media);
int sd_send_op_cond(struct storage_media *media);
+int sd_set_bus_width(struct storage_media *media);
int sd_set_partition(struct storage_media *media,
unsigned int partition_number);
-int sd_set_bus_width(struct storage_media *media);
-
-int mmc_change_freq(struct storage_media *media);
-int mmc_send_status(struct storage_media *media, ssize_t tries);
-int mmc_set_bus_width(struct storage_media *media);
/* Controller debug functions */
#define sdhc_debug(format...) \
@@ -98,4 +96,4 @@ int mmc_set_bus_width(struct storage_media *media);
} while (0)
#define sd_mmc_error(format...) printk(BIOS_ERR, "ERROR: " format)
-#endif /* __DRIVERS_STORAGE_SD_MMC_H__ */
+#endif /* __COMMONLIB_STORAGE_SD_MMC_H__ */
diff --git a/src/drivers/storage/sdhci.c b/src/commonlib/storage/sdhci.c
index c17aa27b9f..bac510e12a 100644
--- a/src/drivers/storage/sdhci.c
+++ b/src/commonlib/storage/sdhci.c
@@ -20,10 +20,10 @@
#include <assert.h>
#include "bouncebuf.h"
#include <console/console.h>
+#include <commonlib/sd_mmc_ctrlr.h>
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
#include <delay.h>
-#include <device/sd_mmc_ctrlr.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
#include <endian.h>
#include <halt.h>
#include "sdhci.h"
diff --git a/src/drivers/storage/sdhci.h b/src/commonlib/storage/sdhci.h
index 34a2972085..5dd5391f38 100644
--- a/src/drivers/storage/sdhci.h
+++ b/src/commonlib/storage/sdhci.h
@@ -14,11 +14,11 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
-#ifndef __DRIVERS_STORAGE_SDHCI_H__
-#define __DRIVERS_STORAGE_SDHCI_H__
+#ifndef __COMMONLIB_STORAGE_SDHCI_H__
+#define __COMMONLIB_STORAGE_SDHCI_H__
#include <arch/io.h>
-#include <device/sd_mmc_ctrlr.h>
+#include <commonlib/sd_mmc_ctrlr.h>
/*
* Controller registers
@@ -278,4 +278,4 @@ int sdhci_setup_adma(struct sdhci_ctrlr *sdhci_ctrlr, struct mmc_data *data);
int sdhci_complete_adma(struct sdhci_ctrlr *sdhci_ctrlr,
struct mmc_command *cmd);
-#endif /* __DRIVERS_STORAGE_SDHCI_H__ */
+#endif /* __COMMONLIB_STORAGE_SDHCI_H__ */
diff --git a/src/drivers/storage/sdhci_adma.c b/src/commonlib/storage/sdhci_adma.c
index 9a945c6384..e95742b35b 100644
--- a/src/drivers/storage/sdhci_adma.c
+++ b/src/commonlib/storage/sdhci_adma.c
@@ -18,9 +18,9 @@
*/
#include <assert.h>
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
#include <delay.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
#include <endian.h>
#include "sdhci.h"
#include "sd_mmc.h"
diff --git a/src/drivers/storage/sdhci_display.c b/src/commonlib/storage/sdhci_display.c
index a1c1828873..d05e35a8d7 100644
--- a/src/drivers/storage/sdhci_display.c
+++ b/src/commonlib/storage/sdhci_display.c
@@ -17,10 +17,10 @@
* GNU General Public License for more details.
*/
+#include <commonlib/sd_mmc_ctrlr.h>
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
#include <console/console.h>
-#include <device/sd_mmc_ctrlr.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
#include "sdhci.h"
#include "sd_mmc.h"
#include "storage.h"
diff --git a/src/drivers/storage/storage.c b/src/commonlib/storage/storage.c
index 8d7692c69b..d2b566f71e 100644
--- a/src/drivers/storage/storage.c
+++ b/src/commonlib/storage/storage.c
@@ -22,7 +22,7 @@
*/
#include <assert.h>
-#include <device/storage.h>
+#include <commonlib/storage.h>
#include "sd_mmc.h"
#include "storage.h"
#include <string.h>
@@ -70,7 +70,7 @@ static void display_capacity(struct storage_media *media, int partition_number)
capacity = media->capacity[partition_number];
name = storage_partition_name(media, partition_number);
separator = "";
- if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC) && !IS_SD(media))
+ if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC) && !IS_SD(media))
separator = ": ";
/* Determine the decimal divisor for the capacity */
@@ -175,9 +175,9 @@ int storage_startup(struct storage_media *media)
return err;
/* Increase the bus frequency */
- if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_SD) && IS_SD(media))
+ if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_SD) && IS_SD(media))
err = sd_change_freq(media);
- else if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC)) {
+ else if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC)) {
err = mmc_change_freq(media);
if (!err)
mmc_update_capacity(media);
@@ -189,9 +189,9 @@ int storage_startup(struct storage_media *media)
media->caps &= ctrlr->caps;
/* Increase the bus width if possible */
- if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_SD) && IS_SD(media))
+ if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_SD) && IS_SD(media))
err = sd_set_bus_width(media);
- else if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC))
+ else if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC))
err = mmc_set_bus_width(media);
if (err)
return err;
@@ -329,9 +329,9 @@ int storage_set_partition(struct storage_media *media,
/* Select the partition */
err = -1;
- if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_SD) && IS_SD(media))
+ if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_SD) && IS_SD(media))
err = sd_set_partition(media, partition_number);
- else if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC))
+ else if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC))
err = mmc_set_partition(media, partition_number);
if (err)
sd_mmc_error("Invalid partition number!\n");
@@ -345,9 +345,9 @@ const char *storage_partition_name(struct storage_media *media,
/* Get the partition name */
name = NULL;
- if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_SD) && IS_SD(media))
+ if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_SD) && IS_SD(media))
name = sd_partition_name(media, partition_number);
- else if (IS_ENABLED(CONFIG_DRIVERS_STORAGE_MMC))
+ else if (IS_ENABLED(CONFIG_COMMONLIB_STORAGE_MMC))
name = mmc_partition_name(media, partition_number);
return name;
}
diff --git a/src/drivers/storage/storage.h b/src/commonlib/storage/storage.h
index b24b12d81f..645b6c1abd 100644
--- a/src/drivers/storage/storage.h
+++ b/src/commonlib/storage/storage.h
@@ -12,11 +12,11 @@
* GNU General Public License for more details.
*/
-#ifndef __DRIVERS_STORAGE_STORAGE_H__
-#define __DRIVERS_STORAGE_STORAGE_H__
+#ifndef __COMMONLIB_STORAGE_STORAGE_H__
+#define __COMMONLIB_STORAGE_STORAGE_H__
#include <stdint.h>
-#include <device/storage.h>
+#include <commonlib/storage.h>
#define DMA_MINALIGN (64)
#define ROUND(a, b) (((a) + (b) - 1) & ~((b) - 1))
@@ -34,4 +34,4 @@ int storage_startup(struct storage_media *media);
int storage_block_setup(struct storage_media *media, uint64_t start,
uint64_t count, int is_read);
-#endif /* __DRIVERS_STORAGE_STORAGE_H__ */
+#endif /* __COMMONLIB_STORAGE_STORAGE_H__ */
diff --git a/src/drivers/storage/storage_erase.c b/src/commonlib/storage/storage_erase.c
index 004a200154..004a200154 100644
--- a/src/drivers/storage/storage_erase.c
+++ b/src/commonlib/storage/storage_erase.c
diff --git a/src/drivers/storage/storage_write.c b/src/commonlib/storage/storage_write.c
index ae9fbc2c5e..ae9fbc2c5e 100644
--- a/src/drivers/storage/storage_write.c
+++ b/src/commonlib/storage/storage_write.c
diff --git a/src/mainboard/intel/galileo/Kconfig b/src/mainboard/intel/galileo/Kconfig
index 4ae412f5d6..12cbb6c849 100644
--- a/src/mainboard/intel/galileo/Kconfig
+++ b/src/mainboard/intel/galileo/Kconfig
@@ -182,7 +182,7 @@ config FMDFILE
config ENABLE_SD_TESTING
bool "Enable SD card testing"
default y
- select DRIVERS_STORAGE_SD
+ select COMMONLIB_STORAGE_SD
select SDHC_DEBUG
select STORAGE_LOG
select STORAGE_TEST
diff --git a/src/mainboard/intel/galileo/Makefile.inc b/src/mainboard/intel/galileo/Makefile.inc
index 25f672e5f7..60c0ee0cd8 100644
--- a/src/mainboard/intel/galileo/Makefile.inc
+++ b/src/mainboard/intel/galileo/Makefile.inc
@@ -26,7 +26,7 @@ verstage-$(CONFIG_VBOOT) += vboot.c
romstage-y += gpio.c
romstage-y += reg_access.c
-romstage-$(CONFIG_DRIVERS_STORAGE_SD) += sd.c
+romstage-$(CONFIG_COMMONLIB_STORAGE_SD) += sd.c
romstage-$(CONFIG_VBOOT) += vboot.c
postcar-y += gpio.c
@@ -34,4 +34,4 @@ postcar-y += reg_access.c
ramstage-y += gpio.c
ramstage-y += reg_access.c
-ramstage-$(CONFIG_DRIVERS_STORAGE_SD) += sd.c
+ramstage-$(CONFIG_COMMONLIB_STORAGE_SD) += sd.c
diff --git a/src/mainboard/intel/galileo/sd.c b/src/mainboard/intel/galileo/sd.c
index d13b318679..0c0e58b7c6 100644
--- a/src/mainboard/intel/galileo/sd.c
+++ b/src/mainboard/intel/galileo/sd.c
@@ -13,9 +13,9 @@
* GNU General Public License for more details.
*/
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
#include <console/console.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
void soc_sd_mmc_controller_quirks(struct sd_mmc_ctrlr *ctrlr)
{
diff --git a/src/soc/intel/quark/Kconfig b/src/soc/intel/quark/Kconfig
index 7f95b7193a..cb0a1bcec9 100644
--- a/src/soc/intel/quark/Kconfig
+++ b/src/soc/intel/quark/Kconfig
@@ -311,11 +311,12 @@ config C_ENV_BOOTBLOCK_SIZE
config STORAGE_TEST
bool "Test SD/MMC/eMMC card or device access"
default n
- select DRIVERS_STORAGE
+ select COMMONLIB_STORAGE
select SDHCI_CONTROLLER
help
- Read block 0 from each parition of the storage device. User must
- also enable one or both of DRIVERS_STORAGE_SD or DRIVERS_STORAGE_MMC.
+ Read block 0 from each parition of the storage device. User
+ must also enable one or both of COMMONLIB_STORAGE_SD or
+ COMMONLIB_STORAGE_MMC.
config STORAGE_LOG
bool "Log and display SD/MMC commands"
diff --git a/src/soc/intel/quark/include/soc/storage_test.h b/src/soc/intel/quark/include/soc/storage_test.h
index 6e970ccf3d..cae296fe59 100644
--- a/src/soc/intel/quark/include/soc/storage_test.h
+++ b/src/soc/intel/quark/include/soc/storage_test.h
@@ -16,9 +16,9 @@
#ifndef __STORAGE_TEST_H__
#define __STORAGE_TEST_H__
+#include <commonlib/sd_mmc_ctrlr.h>
#include <device/device.h>
#include <device/pci.h>
-#include <device/sd_mmc_ctrlr.h>
#include <timer.h>
#ifdef __SIMPLE_DEVICE__
diff --git a/src/soc/intel/quark/sd.c b/src/soc/intel/quark/sd.c
index 7b9600193c..e41afa4acd 100644
--- a/src/soc/intel/quark/sd.c
+++ b/src/soc/intel/quark/sd.c
@@ -14,12 +14,12 @@
*/
#include <arch/io.h>
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
#include <soc/storage_test.h>
static void init(struct device *dev)
diff --git a/src/soc/intel/quark/storage_test.c b/src/soc/intel/quark/storage_test.c
index 4c83dbed4a..507fa9260c 100644
--- a/src/soc/intel/quark/storage_test.c
+++ b/src/soc/intel/quark/storage_test.c
@@ -18,9 +18,9 @@
#include <assert.h>
#include <cbmem.h>
#include <commonlib/cbmem_id.h>
+#include <commonlib/sdhci.h>
+#include <commonlib/storage.h>
#include <console/console.h>
-#include <device/sdhci.h>
-#include <device/storage.h>
#include <lib.h>
#include <soc/iomap.h>
#include <soc/pci_devs.h>