summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-10-24 16:51:48 +0300
committerTom Rini <trini@konsulko.com>2019-10-24 16:51:48 +0300
commit17fd9915a4c639381804ed28274fa136ae3b0bee (patch)
treeb4a8d53128b5d8c5a99cad01471f60729a664e20 /include
parentc9e40996f916671d6c0b87207fdcd6aa85424c04 (diff)
parentc6ffc0d62faf1199a664fb17a8604fa9747ea29c (diff)
downloadu-boot-17fd9915a4c639381804ed28274fa136ae3b0bee.tar.xz
Merge branch '2019-10-24-UFS-support'
- Add Universal Flash Storage (UFS) support
Diffstat (limited to 'include')
-rw-r--r--include/configs/j721e_evm.h4
-rw-r--r--include/dm/uclass-id.h1
-rw-r--r--include/environment/ti/ufs.h33
-rw-r--r--include/scsi.h5
-rw-r--r--include/ufs.h29
5 files changed, 71 insertions, 1 deletions
diff --git a/include/configs/j721e_evm.h b/include/configs/j721e_evm.h
index 8d4040df9b..639d87a4e5 100644
--- a/include/configs/j721e_evm.h
+++ b/include/configs/j721e_evm.h
@@ -13,6 +13,7 @@
#include <config_distro_bootcmd.h>
#include <environment/ti/mmc.h>
#include <environment/ti/k3_rproc.h>
+#include <environment/ti/ufs.h>
#define CONFIG_ENV_SIZE (128 << 10)
@@ -106,7 +107,8 @@
DEFAULT_MMC_TI_ARGS \
EXTRA_ENV_J721E_BOARD_SETTINGS \
EXTRA_ENV_J721E_BOARD_SETTINGS_MMC \
- EXTRA_ENV_RPROC_SETTINGS
+ EXTRA_ENV_RPROC_SETTINGS \
+ DEFAULT_UFS_TI_ARGS
/* Now for the remaining common defines */
#include <configs/ti_armv7_common.h>
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index f7f323752c..0c563d898b 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -102,6 +102,7 @@ enum uclass_id {
UCLASS_THERMAL, /* Thermal sensor */
UCLASS_TIMER, /* Timer device */
UCLASS_TPM, /* Trusted Platform Module TIS interface */
+ UCLASS_UFS, /* Universal Flash Storage */
UCLASS_USB, /* USB bus */
UCLASS_USB_DEV_GENERIC, /* USB generic device */
UCLASS_USB_HUB, /* USB hub */
diff --git a/include/environment/ti/ufs.h b/include/environment/ti/ufs.h
new file mode 100644
index 0000000000..d457e20308
--- /dev/null
+++ b/include/environment/ti/ufs.h
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Environment variable definitions for UFS on TI boards.
+ */
+
+#ifndef __TI_UFS_H
+#define __TI_UFS_H
+
+#define DEFAULT_UFS_TI_ARGS \
+ "scsirootfstype=ext4 rootwait\0" \
+ "ufs_finduuid=part uuid scsi ${bootpart} uuid\0" \
+ "args_ufs=setenv devtype scsi;setenv bootpart 1:1;" \
+ "run ufs_finduuid;setenv bootargs console = ${console} " \
+ "${optargs}" \
+ "root=PARTUUID=${uuid} rw " \
+ "rootfstype=${scsirootfstype};" \
+ "setenv devtype scsi;" \
+ "setenv bootpart 1:1\0" \
+ "init_ufs=ufs init; scsi scan; run args_ufs\0" \
+ "get_kern_ufs=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${name_kern}\0" \
+ "get_fdt_ufs=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+ "get_overlay_ufs=" \
+ "fdt address ${fdtaddr};" \
+ "fdt resize 0x100000;" \
+ "for overlay in $name_overlays;" \
+ "do;" \
+ "load scsi ${bootpart} ${overlayaddr} ${bootdir}/${overlay} && " \
+ "fdt apply ${overlayaddr};" \
+ "done;\0"
+
+#endif
diff --git a/include/scsi.h b/include/scsi.h
index 81ab43c842..61da958bf6 100644
--- a/include/scsi.h
+++ b/include/scsi.h
@@ -6,6 +6,8 @@
#ifndef _SCSI_H
#define _SCSI_H
+#include <linux/dma-direction.h>
+
struct scsi_cmd {
unsigned char cmd[16]; /* command */
/* for request sense */
@@ -26,6 +28,7 @@ struct scsi_cmd {
unsigned long trans_bytes; /* tranfered bytes */
unsigned int priv;
+ enum dma_data_direction dma_dir;
};
/*-----------------------------------------------------------
@@ -163,11 +166,13 @@ struct scsi_cmd {
* @base: Controller base address
* @max_lun: Maximum number of logical units
* @max_id: Maximum number of target ids
+ * @max_bytes_per_req: Maximum number of bytes per read/write request
*/
struct scsi_platdata {
unsigned long base;
unsigned long max_lun;
unsigned long max_id;
+ unsigned long max_bytes_per_req;
};
/* Operations for SCSI */
diff --git a/include/ufs.h b/include/ufs.h
new file mode 100644
index 0000000000..0592a763dd
--- /dev/null
+++ b/include/ufs.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+#ifndef _UFS_H
+#define _UFS_H
+/**
+ * ufs_probe() - initialize all devices in the UFS uclass
+ *
+ * @return 0 if Ok, -ve on error
+ */
+int ufs_probe(void);
+
+/**
+ * ufs_probe_dev() - initialize a particular device in the UFS uclass
+ *
+ * @index: index in the uclass sequence
+ *
+ * @return 0 if successfully probed, -ve on error
+ */
+int ufs_probe_dev(int index);
+
+/*
+ * ufs_scsi_bind() - Create a new scsi device as a child of the UFS device and
+ * bind it to the ufs_scsi driver
+ * @ufs_dev: UFS device
+ * @scsi_devp: Pointer to scsi device
+ *
+ * @return 0 if Ok, -ve on error
+ */
+int ufs_scsi_bind(struct udevice *ufs_dev, struct udevice **scsi_devp);
+#endif