summaryrefslogtreecommitdiffstats
path: root/sys/contrib/octeon-sdk/cvmx-nand.h
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2010-11-28 08:18:16 +0000
committerjmallett <jmallett@FreeBSD.org>2010-11-28 08:18:16 +0000
commitcdfefa0ba06939d897cb0d1f5987a4d0996ea3ef (patch)
tree0a50a5816f02b42087de787ad200f1eb12f29144 /sys/contrib/octeon-sdk/cvmx-nand.h
parent4b7c147940d7db81a4434262cf5cb2f5cd0102f2 (diff)
parent76ef03b9cb287a0817808454c8b27cbcce5243d3 (diff)
downloadFreeBSD-src-cdfefa0ba06939d897cb0d1f5987a4d0996ea3ef.zip
FreeBSD-src-cdfefa0ba06939d897cb0d1f5987a4d0996ea3ef.tar.gz
Merge Cavium Octeon SDK 2.0 Simple Executive; this brings some fixes and new
facilities as well as support for the Octeon 2 family of SoCs. XXX Note that with our antediluvian assembler, we can't support some Octeon 2 instructions and fall back to using the old ones instead.
Diffstat (limited to 'sys/contrib/octeon-sdk/cvmx-nand.h')
-rw-r--r--sys/contrib/octeon-sdk/cvmx-nand.h112
1 files changed, 76 insertions, 36 deletions
diff --git a/sys/contrib/octeon-sdk/cvmx-nand.h b/sys/contrib/octeon-sdk/cvmx-nand.h
index 8ca4f9a..580dbb3 100644
--- a/sys/contrib/octeon-sdk/cvmx-nand.h
+++ b/sys/contrib/octeon-sdk/cvmx-nand.h
@@ -1,39 +1,40 @@
/***********************license start***************
- * Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
- * reserved.
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- *
- * * Neither the name of Cavium Networks nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
- * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
- * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
- * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
- * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
- * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
- * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
- * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
- * POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT
- * OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
- *
- *
- * For any questions regarding licensing please contact marketing@caviumnetworks.com
- *
+ * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
+ * reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+
+ * * Neither the name of Cavium Networks nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+
+ * This Software, including technical data, may be subject to U.S. export control
+ * laws, including the U.S. Export Administration Act and its associated
+ * regulations, and may be subject to export or import regulations in other
+ * countries.
+
+ * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+ * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
+ * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
+ * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
+ * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
+ * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
+ * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
+ * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
+ * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
+ * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
***********************license end**************************************/
@@ -41,6 +42,7 @@
+
/**
* @file
*
@@ -104,6 +106,10 @@
extern "C" {
#endif
+/* Maxium PAGE + OOB size supported. This is used to size
+** buffers, some that must be statically allocated. */
+#define CVMX_NAND_MAX_PAGE_AND_OOB_SIZE (4096 + 256)
+
/* Block size for boot ECC */
#define CVMX_NAND_BOOT_ECC_BLOCK_SIZE (256)
@@ -130,6 +136,7 @@ typedef enum
CVMX_NAND_BUSY = -2,
CVMX_NAND_INVALID_PARAM = -3,
CVMX_NAND_TIMEOUT = -4,
+ CVMX_NAND_ERROR = -5,
} cvmx_nand_status_t;
/**
@@ -472,8 +479,17 @@ typedef struct __attribute__ ((packed))
* Called to initialize the NAND controller for use. Note that
* you must be running out of L2 or memory and not NAND before
* calling this function.
+ * When probing for NAND chips, this function attempts to autoconfigure based on the NAND parts detected.
+ * It currently supports autodetection for ONFI parts (with valid parameter pages), and some Samsung NAND
+ * parts (decoding ID bits.) If autoconfiguration fails, the defaults set with __set_chip_defaults()
+ * prior to calling cvmx_nand_initialize() are used.
+ * If defaults are set and the CVMX_NAND_INITIALIZE_FLAGS_DONT_PROBE flag is provided, the defaults are used
+ * for all chips in the active_chips mask.
*
* @param flags Optional initialization flags
+ * If the CVMX_NAND_INITIALIZE_FLAGS_DONT_PROBE flag is passed, chips are not probed,
+ * and the default parameters (if set with cvmx_nand_set_defaults) are used for all chips
+ * in the active_chips mask.
* @param active_chips
* Each bit in this parameter represents a chip select that might
* contain NAND flash. Any chip select present in this bitmask may
@@ -485,6 +501,30 @@ typedef struct __attribute__ ((packed))
extern cvmx_nand_status_t cvmx_nand_initialize(cvmx_nand_initialize_flags_t flags, int active_chips);
+
+/**
+ * This function may be called before cvmx_nand_initialize to set default values that will be used
+ * for NAND chips that do not identify themselves in a way that allows autoconfiguration. (ONFI chip with
+ * missing parameter page, for example.)
+ * The parameters set by this function will be used by _all_ non-autoconfigured NAND chips.
+ *
+ *
+ * NOTE: This function signature is _NOT_ stable, and will change in the future as required to support
+ * various NAND chips.
+ *
+ * @param page_size page size in bytes
+ * @param oob_size Out of band size in bytes (per page)
+ * @param pages_per_block
+ * number of pages per block
+ * @param blocks Total number of blocks in device
+ * @param onfi_timing_mode
+ * ONFI timing mode
+ *
+ * @return Zero on success, a negative cvmx_nand_status_t error code on failure
+ */
+extern cvmx_nand_status_t cvmx_nand_set_defaults(int page_size, int oob_size, int pages_per_block, int blocks, int onfi_timing_mode);
+
+
/**
* Call to shutdown the NAND controller after all transactions
* are done. In most setups this will never be called.
@@ -660,7 +700,7 @@ extern cvmx_nand_status_t cvmx_nand_reset(int chip);
/**
* This function computes the Octeon specific ECC data used by the NAND boot
* feature.
- *
+ *
* @param block pointer to 256 bytes of data
* @param eccp pointer to where 8 bytes of ECC data will be stored
*/
OpenPOWER on IntegriCloud