003 File Manager
Current Path:
/usr/src/sys/contrib/octeon-sdk
usr
/
src
/
sys
/
contrib
/
octeon-sdk
/
📁
..
📄
cvmip.h
(5.88 KB)
📄
cvmx-abi.h
(3.67 KB)
📄
cvmx-access-native.h
(26.79 KB)
📄
cvmx-access.h
(7.82 KB)
📄
cvmx-address.h
(10.26 KB)
📄
cvmx-agl-defs.h
(213.66 KB)
📄
cvmx-app-hotplug.c
(27.64 KB)
📄
cvmx-app-hotplug.h
(5.77 KB)
📄
cvmx-app-init-linux.c
(14.29 KB)
📄
cvmx-app-init.c
(22.54 KB)
📄
cvmx-app-init.h
(19.32 KB)
📄
cvmx-asm.h
(39.3 KB)
📄
cvmx-asx0-defs.h
(5.19 KB)
📄
cvmx-asxx-defs.h
(50.57 KB)
📄
cvmx-atomic.h
(21.71 KB)
📄
cvmx-bootloader.h
(5.64 KB)
📄
cvmx-bootmem.c
(40.91 KB)
📄
cvmx-bootmem.h
(18.88 KB)
📄
cvmx-ciu-defs.h
(702.5 KB)
📄
cvmx-ciu2-defs.h
(487.31 KB)
📄
cvmx-clock.c
(4.48 KB)
📄
cvmx-clock.h
(4.43 KB)
📄
cvmx-cmd-queue.c
(11.84 KB)
📄
cvmx-cmd-queue.h
(22 KB)
📄
cvmx-cn3010-evb-hs5.c
(6.05 KB)
📄
cvmx-cn3010-evb-hs5.h
(2.3 KB)
📄
cvmx-compactflash.c
(12.8 KB)
📄
cvmx-compactflash.h
(3.05 KB)
📄
cvmx-core.c
(5.3 KB)
📄
cvmx-core.h
(9.46 KB)
📄
cvmx-coremask.c
(4.12 KB)
📄
cvmx-coremask.h
(8.11 KB)
📄
cvmx-crypto.c
(2.6 KB)
📄
cvmx-crypto.h
(2.54 KB)
📄
cvmx-csr-enums.h
(8.45 KB)
📄
cvmx-csr-typedefs.h
(3.92 KB)
📄
cvmx-csr.h
(11.46 KB)
📄
cvmx-dbg-defs.h
(6.28 KB)
📄
cvmx-debug-handler.S
(7.44 KB)
📄
cvmx-debug-remote.c
(3.24 KB)
📄
cvmx-debug-uart.c
(7.88 KB)
📄
cvmx-debug.c
(55.98 KB)
📄
cvmx-debug.h
(22.2 KB)
📄
cvmx-dfa-defs.h
(383.08 KB)
📄
cvmx-dfa.c
(3.7 KB)
📄
cvmx-dfa.h
(34.87 KB)
📄
cvmx-dfm-defs.h
(205.93 KB)
📄
cvmx-dma-engine.c
(20.25 KB)
📄
cvmx-dma-engine.h
(24.06 KB)
📄
cvmx-dpi-defs.h
(107.61 KB)
📄
cvmx-ebt3000.c
(3.82 KB)
📄
cvmx-ebt3000.h
(2.25 KB)
📄
cvmx-endor-defs.h
(311.42 KB)
📄
cvmx-eoi-defs.h
(26.27 KB)
📄
cvmx-fau.h
(20.31 KB)
📄
cvmx-flash.c
(22.46 KB)
📄
cvmx-flash.h
(3.8 KB)
📄
cvmx-fpa-defs.h
(157.78 KB)
📄
cvmx-fpa.c
(6.63 KB)
📄
cvmx-fpa.h
(10.39 KB)
📄
cvmx-gmx.h
(3.07 KB)
📄
cvmx-gmxx-defs.h
(505.27 KB)
📄
cvmx-gpio-defs.h
(36.89 KB)
📄
cvmx-gpio.h
(5.48 KB)
📄
cvmx-helper-board.c
(58 KB)
📄
cvmx-helper-board.h
(7.82 KB)
📄
cvmx-helper-cfg.c
(18.68 KB)
📄
cvmx-helper-cfg.h
(8.1 KB)
📄
cvmx-helper-check-defines.h
(4.1 KB)
📄
cvmx-helper-errata.c
(11.91 KB)
📄
cvmx-helper-errata.h
(3.24 KB)
📄
cvmx-helper-fpa.c
(8.81 KB)
📄
cvmx-helper-fpa.h
(3.21 KB)
📄
cvmx-helper-ilk.c
(12.74 KB)
📄
cvmx-helper-ilk.h
(3.58 KB)
📄
cvmx-helper-jtag.c
(7.05 KB)
📄
cvmx-helper-jtag.h
(3.91 KB)
📄
cvmx-helper-loop.c
(4.35 KB)
📄
cvmx-helper-loop.h
(2.78 KB)
📄
cvmx-helper-npi.c
(5.72 KB)
📄
cvmx-helper-npi.h
(2.82 KB)
📄
cvmx-helper-rgmii.c
(19.12 KB)
📄
cvmx-helper-rgmii.h
(4.5 KB)
📄
cvmx-helper-sgmii.c
(27.09 KB)
📄
cvmx-helper-sgmii.h
(4.3 KB)
📄
cvmx-helper-spi.c
(8.4 KB)
📄
cvmx-helper-spi.h
(3.68 KB)
📄
cvmx-helper-srio.c
(11.58 KB)
📄
cvmx-helper-srio.h
(3.6 KB)
📄
cvmx-helper-util.c
(25.77 KB)
📄
cvmx-helper-util.h
(9.88 KB)
📄
cvmx-helper-xaui.c
(16.54 KB)
📄
cvmx-helper-xaui.h
(4.29 KB)
📄
cvmx-helper.c
(69.71 KB)
📄
cvmx-helper.h
(12.7 KB)
📄
cvmx-hfa.c
(5.04 KB)
📄
cvmx-hfa.h
(10.3 KB)
📄
cvmx-higig.h
(23.21 KB)
📄
cvmx-ilk-defs.h
(170.31 KB)
📄
cvmx-ilk.c
(45.16 KB)
📄
cvmx-ilk.h
(5.89 KB)
📄
cvmx-interrupt-handler.S
(5.87 KB)
📄
cvmx-interrupt.c
(47.42 KB)
📄
cvmx-interrupt.h
(8.07 KB)
📄
cvmx-iob-defs.h
(89.11 KB)
📄
cvmx-iob1-defs.h
(6.8 KB)
📄
cvmx-ipd-defs.h
(186.51 KB)
📄
cvmx-ipd.c
(12.88 KB)
📄
cvmx-ipd.h
(6.3 KB)
📄
cvmx-ixf18201.c
(12.8 KB)
📄
cvmx-ixf18201.h
(3.54 KB)
📄
cvmx-key-defs.h
(11 KB)
📄
cvmx-key.h
(3.29 KB)
📄
cvmx-l2c-defs.h
(353.27 KB)
📄
cvmx-l2c.c
(52.95 KB)
📄
cvmx-l2c.h
(19.72 KB)
📄
cvmx-l2d-defs.h
(60.71 KB)
📄
cvmx-l2t-defs.h
(50.68 KB)
📄
cvmx-led-defs.h
(22.68 KB)
📄
cvmx-llm.c
(36.51 KB)
📄
cvmx-llm.h
(11.72 KB)
📄
cvmx-lmcx-defs.h
(532.21 KB)
📄
cvmx-log-arc.S
(5.67 KB)
📄
cvmx-log.c
(18.26 KB)
📄
cvmx-log.h
(4.95 KB)
📁
cvmx-malloc
📄
cvmx-malloc.h
(7.2 KB)
📄
cvmx-mdio.h
(15.99 KB)
📄
cvmx-mgmt-port.c
(36.2 KB)
📄
cvmx-mgmt-port.h
(7.23 KB)
📄
cvmx-mio-defs.h
(454.14 KB)
📄
cvmx-mixx-defs.h
(94.59 KB)
📄
cvmx-mpi-defs.h
(33.42 KB)
📄
cvmx-nand.c
(76.64 KB)
📄
cvmx-nand.h
(26.85 KB)
📄
cvmx-ndf-defs.h
(25.53 KB)
📄
cvmx-npei-defs.h
(378.19 KB)
📄
cvmx-npi-defs.h
(252.36 KB)
📄
cvmx-npi.h
(4.69 KB)
📄
cvmx-packet.h
(2.94 KB)
📄
cvmx-pci-defs.h
(250.53 KB)
📄
cvmx-pci.h
(2.37 KB)
📄
cvmx-pcie.c
(63 KB)
📄
cvmx-pcie.h
(10.08 KB)
📄
cvmx-pcieepx-defs.h
(304.49 KB)
📄
cvmx-pciercx-defs.h
(284.89 KB)
📄
cvmx-pcm-defs.h
(12.34 KB)
📄
cvmx-pcmx-defs.h
(46.12 KB)
📄
cvmx-pcsx-defs.h
(71.23 KB)
📄
cvmx-pcsxx-defs.h
(45.79 KB)
📄
cvmx-pemx-defs.h
(68.97 KB)
📄
cvmx-pescx-defs.h
(49.92 KB)
📄
cvmx-pexp-defs.h
(97.89 KB)
📄
cvmx-pip-defs.h
(315.91 KB)
📄
cvmx-pip.h
(33.65 KB)
📄
cvmx-pko-defs.h
(181.41 KB)
📄
cvmx-pko.c
(32 KB)
📄
cvmx-pko.h
(31.29 KB)
📄
cvmx-platform.h
(7.45 KB)
📄
cvmx-pow-defs.h
(93.02 KB)
📄
cvmx-pow.c
(32.26 KB)
📄
cvmx-pow.h
(100.93 KB)
📄
cvmx-power-throttle.c
(7.25 KB)
📄
cvmx-power-throttle.h
(3.85 KB)
📄
cvmx-profiler.c
(7.81 KB)
📄
cvmx-profiler.h
(3.15 KB)
📄
cvmx-qlm-tables.c
(35.37 KB)
📄
cvmx-qlm.c
(23.41 KB)
📄
cvmx-qlm.h
(4.76 KB)
📄
cvmx-rad-defs.h
(43.58 KB)
📄
cvmx-raid.c
(4.71 KB)
📄
cvmx-raid.h
(13.02 KB)
📄
cvmx-resources.config
(7.66 KB)
📄
cvmx-rng.h
(5.02 KB)
📄
cvmx-rnm-defs.h
(13.03 KB)
📄
cvmx-rtc.h
(4.21 KB)
📄
cvmx-rwlock.h
(5.25 KB)
📄
cvmx-scratch.h
(4.76 KB)
📄
cvmx-shared-linux-n32.ld
(11.8 KB)
📄
cvmx-shared-linux-o32.ld
(10.67 KB)
📄
cvmx-shared-linux.ld
(11.77 KB)
📄
cvmx-shmem.c
(18.89 KB)
📄
cvmx-shmem.h
(4.11 KB)
📄
cvmx-sim-magic.h
(5.59 KB)
📄
cvmx-sli-defs.h
(312.94 KB)
📄
cvmx-smi-defs.h
(4.09 KB)
📄
cvmx-smix-defs.h
(21.71 KB)
📄
cvmx-spi.c
(24.99 KB)
📄
cvmx-spi.h
(10.22 KB)
📄
cvmx-spi4000.c
(19.23 KB)
📄
cvmx-spinlock.h
(11.73 KB)
📄
cvmx-spx0-defs.h
(3.94 KB)
📄
cvmx-spxx-defs.h
(62.44 KB)
📄
cvmx-srio.c
(63.05 KB)
📄
cvmx-srio.h
(26.68 KB)
📄
cvmx-sriomaintx-defs.h
(222.52 KB)
📄
cvmx-sriox-defs.h
(211.56 KB)
📄
cvmx-srxx-defs.h
(14.41 KB)
📄
cvmx-sso-defs.h
(87.33 KB)
📄
cvmx-stxx-defs.h
(34.02 KB)
📄
cvmx-swap.h
(4.11 KB)
📄
cvmx-sysinfo.c
(8.78 KB)
📄
cvmx-sysinfo.h
(6.45 KB)
📄
cvmx-thunder.c
(9.22 KB)
📄
cvmx-thunder.h
(4.54 KB)
📄
cvmx-tim-defs.h
(58.36 KB)
📄
cvmx-tim.c
(10.92 KB)
📄
cvmx-tim.h
(12.1 KB)
📄
cvmx-tlb.c
(10.12 KB)
📄
cvmx-tlb.h
(5.07 KB)
📄
cvmx-tra-defs.h
(4.59 KB)
📄
cvmx-tra.c
(31.16 KB)
📄
cvmx-tra.h
(34.28 KB)
📄
cvmx-trax-defs.h
(197.09 KB)
📄
cvmx-twsi.c
(16.25 KB)
📄
cvmx-twsi.h
(10.22 KB)
📄
cvmx-uahcx-defs.h
(181.38 KB)
📄
cvmx-uart.c
(5.69 KB)
📄
cvmx-uart.h
(4.58 KB)
📄
cvmx-uctlx-defs.h
(50.26 KB)
📄
cvmx-usb.c
(138.53 KB)
📄
cvmx-usb.h
(46.67 KB)
📄
cvmx-usbcx-defs.h
(259.23 KB)
📄
cvmx-usbd.c
(36.09 KB)
📄
cvmx-usbd.h
(9.82 KB)
📄
cvmx-usbnx-defs.h
(136.12 KB)
📄
cvmx-utils.h
(7.54 KB)
📄
cvmx-version.h
(2.23 KB)
📄
cvmx-warn.c
(2.75 KB)
📄
cvmx-warn.h
(2.43 KB)
📄
cvmx-wqe.h
(38.61 KB)
📄
cvmx-zip-defs.h
(43.18 KB)
📄
cvmx-zip.c
(7.37 KB)
📄
cvmx-zip.h
(8.5 KB)
📄
cvmx-zone.c
(4.7 KB)
📄
cvmx.h
(3.5 KB)
📄
octeon-boot-info.h
(8.08 KB)
📄
octeon-feature.c
(4.71 KB)
📄
octeon-feature.h
(11.94 KB)
📄
octeon-model.c
(15.79 KB)
📄
octeon-model.h
(16.53 KB)
📄
octeon-pci-console.c
(19.73 KB)
📄
octeon-pci-console.h
(5.18 KB)
Editing: cvmx-nand.h
/***********************license start*************** * Copyright (c) 2003-2010 Cavium Inc. (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 Inc. 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 INC. 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**************************************/ /** * @file * * This header defines the CVMX interface to the NAND flash controller. The * basic operations common to all NAND devices are supported by this API, but * many more advanced functions are not support. The low level hardware supports * all types of transactions, but this API only implements the must commonly * used operations. This API performs no locking, so it is the responsibility of * the caller to make sure only one thread of execution is accessing the NAND * controller at a time. Most applications should not use this API directly but * instead use a flash logical layer supplied through a secondary system. For * example, the Linux MTD layer provides a driver for running JFFS2 on top of * NAND flash. * * <h2>Selecting the NAND Chip</h2> * * Octeon's NAND controller assumes a single NAND chip is connected to a boot * bus chip select. Throughout this API, NAND chips are referred to by the chip * select they are connected to (0-7). Chip select 0 will only be a NAND chip * when you are booting from NAND flash. * * <h2>NAND Addressing</h2> * * Various functions in cvmx-nand use addresses to index into NAND flash. All * functions us a uniform address translation scheme to map the passed address * into a NAND block, page, and column. In NAND flash a page represents the * basic unit of reads and writes. Each page contains a power of two number of * bytes and some number of extra out of band (OOB) bytes. A fixed number of * pages fit into each NAND block. Here is the mapping of bits in the cvmx-nand * address to the NAND hardware: * <pre> * 63 56 48 40 32 24 16 8 0 * +-------+-------+-------+-------+-------+-------+-------+------+ * | 64 bit cvmx-nand nand_address| * +------------------------------------------------+----+--------+ * | block |page| column | * +-------+-------+-------+-------+-------+--------+----+--------+ * 63 56 48 40 32 24 16 8 0 * </pre> * Basically the block, page, and column addresses are packet together. Before * being sent out the NAND pins for addressing the column is padded out to an * even number of bytes. This means that column address are 2 bytes, or 2 * address cycles, for page sizes between 512 and 65536 bytes. Page sizes * between 128KB and 16MB would use 3 column address cycles. NAND device * normally either have 32 or 64 pages per block, needing either 5 or 6 address * bits respectively. This means you have 10 bits for block address using 4 * address cycles, or 18 for 5 address cycles. Using the cvmx-nand addressing * scheme, it is not possible to directly index the OOB data. Instead you can * access it by reading or writing more data than the normal page size would * allow. Logically the OOB data is appended onto the the page data. For * example, this means that a read of 65 bytes from a column address of 0x7ff * would yield byte 2047 of the page and then 64 bytes of OOB data. * * <hr>$Revision: 35726 $<hr> */ #ifndef __CVMX_NAND_H__ #define __CVMX_NAND_H__ #ifdef __cplusplus 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) /* ECC bytes for each block */ #define CVMX_NAND_BOOT_ECC_ECC_SIZE (8) /** * Flags to be passed to the initialize function */ typedef enum { CVMX_NAND_INITIALIZE_FLAGS_16BIT = 1<<0, CVMX_NAND_INITIALIZE_FLAGS_DONT_PROBE = 1<<1, CVMX_NAND_INITIALIZE_FLAGS_DEBUG = 1<<15, } cvmx_nand_initialize_flags_t; /** * Return codes from NAND functions */ typedef enum { CVMX_NAND_SUCCESS = 0, CVMX_NAND_NO_MEMORY = -1, CVMX_NAND_BUSY = -2, CVMX_NAND_INVALID_PARAM = -3, CVMX_NAND_TIMEOUT = -4, CVMX_NAND_ERROR = -5, CVMX_NAND_NO_DEVICE = -6, } cvmx_nand_status_t; /** * NAND NOP command definition */ typedef struct { uint64_t reserved_64_127 : 64; uint64_t reserved_4_63 : 60; uint64_t zero : 4; } cvmx_nand_cmd_nop_t; /** * NAND SET_TM_PAR command definition */ typedef struct { uint64_t reserved_64_127 : 64; uint64_t tim_par7 : 8; uint64_t tim_par6 : 8; uint64_t tim_par5 : 8; uint64_t tim_par4 : 8; uint64_t tim_par3 : 8; uint64_t tim_par2 : 8; uint64_t tim_par1 : 8; uint64_t tim_mult : 4; uint64_t one : 4; } cvmx_nand_cmd_set_tm_par_t; /** * NAND WAIT command definition */ typedef struct { uint64_t reserved_64_127 : 64; uint64_t reserved_11_63 : 53; uint64_t n : 3; uint64_t reserved_5_7 : 3; uint64_t r_b : 1; uint64_t two : 4; } cvmx_nand_cmd_wait_t; /** * NAND CHIP_EN command definition */ typedef struct { uint64_t reserved_64_127 : 64; uint64_t reserved_10_63 : 54; uint64_t width : 2; uint64_t one : 1; uint64_t chip : 3; uint64_t three : 4; } cvmx_nand_cmd_chip_en_t; /** * NAND CHIP_DIS command definition */ typedef struct { uint64_t reserved_64_127 : 64; uint64_t reserved_4_63 : 60; uint64_t three : 4; } cvmx_nand_cmd_chip_dis_t; /** * NAND CLE command definition */ typedef struct { uint64_t reserved_64_127 : 64; uint64_t reserved_25_63 : 39; uint64_t clen3 : 3; uint64_t clen2 : 3; uint64_t clen1 : 3; uint64_t cmd_data : 8; uint64_t reserved_4_7 : 4; uint64_t four : 4; } cvmx_nand_cmd_cle_t; /** * NAND ALE command definition */ typedef struct { uint64_t reserved_96_127 : 32; uint64_t adr_bytes_h : 32; uint64_t adr_bytes_l : 32; uint64_t reserved_28_31 : 4; uint64_t alen4 : 3; uint64_t alen3 : 3; uint64_t alen2 : 3; uint64_t alen1 : 3; uint64_t reserved_12_15 : 4; uint64_t adr_byte_num : 4; uint64_t reserved_4_7 : 4; uint64_t five : 4; } cvmx_nand_cmd_ale_t; /** * NAND WR command definition */ typedef struct { uint64_t reserved_64_127 : 64; uint64_t reserved_31_63 : 34; uint64_t wrn2 : 3; uint64_t wrn1 : 3; uint64_t reserved_20_24 : 4; uint64_t data_bytes : 16; uint64_t eight : 4; } cvmx_nand_cmd_wr_t; /** * NAND RD command definition */ typedef struct { uint64_t reserved_64_127 : 64; uint64_t reserved_32_63 : 32; uint64_t rdn4 : 3; uint64_t rdn3 : 3; uint64_t rdn2 : 3; uint64_t rdn1 : 3; uint64_t data_bytes : 16; uint64_t nine : 4; } cvmx_nand_cmd_rd_t; /** * NAND RD_EDO command definition */ typedef struct { uint64_t reserved_64_127 : 64; uint64_t reserved_32_63 : 32; uint64_t rdn4 : 3; uint64_t rdn3 : 3; uint64_t rdn2 : 3; uint64_t rdn1 : 3; uint64_t data_bytes : 16; uint64_t ten : 4; } cvmx_nand_cmd_rd_edo_t; /** * NAND WAIT_STATUS command definition */ typedef struct { uint64_t rdn4 : 3; uint64_t rdn3 : 3; uint64_t rdn2 : 3; uint64_t rdn1 : 3; uint64_t comp_byte : 8; uint64_t and_mask : 8; uint64_t nine : 4; uint64_t reserved_28_95 : 64; uint64_t clen4 : 3; uint64_t clen3 : 3; uint64_t clen2 : 3; uint64_t clen1 : 3; uint64_t data : 8; uint64_t reserved_4_7 : 4; uint64_t eleven : 4; } cvmx_nand_cmd_wait_status_t; /** * NAND WAIT_STATUS_ALE command definition */ typedef struct { uint64_t rdn4 : 3; uint64_t rdn3 : 3; uint64_t rdn2 : 3; uint64_t rdn1 : 3; uint64_t comp_byte : 8; uint64_t and_mask : 8; uint64_t nine : 4; uint64_t adr_bytes : 32; uint64_t reserved_60_63 : 4; uint64_t alen4 : 3; uint64_t alen3 : 3; uint64_t alen2 : 3; uint64_t alen1 : 3; uint64_t reserved_44_47 : 4; uint64_t adr_byte_num : 4; uint64_t five : 4; uint64_t reserved_25_31 : 7; uint64_t clen3 : 3; uint64_t clen2 : 3; uint64_t clen1 : 3; uint64_t data : 8; uint64_t reserved_4_7 : 4; uint64_t eleven : 4; } cvmx_nand_cmd_wait_status_ale_t; /** * NAND BUS_ACQ command definition */ typedef struct { uint64_t reserved_64_127 : 64; uint64_t reserved_8_63 : 56; uint64_t one : 4; uint64_t fifteen : 4; } cvmx_nand_cmd_bus_acq_t; /** * NAND BUS_REL command definition */ typedef struct { uint64_t reserved_64_127 : 64; uint64_t reserved_8_63 : 56; uint64_t zero : 4; uint64_t fifteen : 4; } cvmx_nand_cmd_bus_rel_t; /** * NAND command union of all possible commands */ typedef union { uint64_t u64[2]; cvmx_nand_cmd_nop_t nop; cvmx_nand_cmd_set_tm_par_t set_tm_par; cvmx_nand_cmd_wait_t wait; cvmx_nand_cmd_chip_en_t chip_en; cvmx_nand_cmd_chip_dis_t chip_dis; cvmx_nand_cmd_cle_t cle; cvmx_nand_cmd_ale_t ale; cvmx_nand_cmd_rd_t rd; cvmx_nand_cmd_rd_edo_t rd_edo; cvmx_nand_cmd_wr_t wr; cvmx_nand_cmd_wait_status_t wait_status; cvmx_nand_cmd_wait_status_ale_t wait_status_ale; cvmx_nand_cmd_bus_acq_t bus_acq; cvmx_nand_cmd_bus_rel_t bus_rel; struct { uint64_t reserved_64_127: 64; uint64_t reserved_4_63 : 60; uint64_t op_code : 4; } s; } cvmx_nand_cmd_t; typedef struct __attribute__ ((packed)) { char onfi[4]; /**< Bytes 0-3: The ASCII characters 'O', 'N', 'F', 'I' */ uint16_t revision_number; /**< Bytes 4-5: ONFI revision number - 2-15 Reserved (0) - 1 1 = supports ONFI version 1.0 - 0 Reserved (0) */ uint16_t features; /**< Bytes 6-7: Features supported - 5-15 Reserved (0) - 4 1 = supports odd to even page Copyback - 3 1 = supports interleaved operations - 2 1 = supports non-sequential page programming - 1 1 = supports multiple LUN operations - 0 1 = supports 16-bit data bus width */ uint16_t optional_commands; /**< Bytes 8-9: Optional commands supported - 6-15 Reserved (0) - 5 1 = supports Read Unique ID - 4 1 = supports Copyback - 3 1 = supports Read Status Enhanced - 2 1 = supports Get Features and Set Features - 1 1 = supports Read Cache commands - 0 1 = supports Page Cache Program command */ uint8_t reserved_10_31[22]; /**< Bytes 10-31: Reserved */ char manufacturer[12]; /**< Bytes 32-43: Device manufacturer (12 ASCII characters) */ char model[20]; /**< Bytes 40-63: Device model (20 ASCII characters) */ uint8_t jedec_id; /**< Byte 64: JEDEC manufacturer ID */ uint16_t date_code; /**< Byte 65-66: Date code */ uint8_t reserved_67_79[13]; /**< Bytes 67-79: Reserved */ uint32_t page_data_bytes; /**< Bytes 80-83: Number of data bytes per page */ uint16_t page_spare_bytes; /**< Bytes 84-85: Number of spare bytes per page */ uint32_t partial_page_data_bytes; /**< Bytes 86-89: Number of data bytes per partial page */ uint16_t partial_page_spare_bytes; /**< Bytes 90-91: Number of spare bytes per partial page */ uint32_t pages_per_block; /**< Bytes 92-95: Number of pages per block */ uint32_t blocks_per_lun; /**< Bytes 96-99: Number of blocks per logical unit (LUN) */ uint8_t number_lun; /**< Byte 100: Number of logical units (LUNs) */ uint8_t address_cycles; /**< Byte 101: Number of address cycles - 4-7 Column address cycles - 0-3 Row address cycles */ uint8_t bits_per_cell; /**< Byte 102: Number of bits per cell */ uint16_t bad_block_per_lun; /**< Bytes 103-104: Bad blocks maximum per LUN */ uint16_t block_endurance; /**< Bytes 105-106: Block endurance */ uint8_t good_blocks; /**< Byte 107: Guaranteed valid blocks at beginning of target */ uint16_t good_block_endurance; /**< Bytes 108-109: Block endurance for guaranteed valid blocks */ uint8_t programs_per_page; /**< Byte 110: Number of programs per page */ uint8_t partial_program_attrib; /**< Byte 111: Partial programming attributes - 5-7 Reserved - 4 1 = partial page layout is partial page data followed by partial page spare - 1-3 Reserved - 0 1 = partial page programming has constraints */ uint8_t bits_ecc; /**< Byte 112: Number of bits ECC correctability */ uint8_t interleaved_address_bits; /**< Byte 113: Number of interleaved address bits - 4-7 Reserved (0) - 0-3 Number of interleaved address bits */ uint8_t interleaved_attrib; /**< Byte 114: Interleaved operation attributes - 4-7 Reserved (0) - 3 Address restrictions for program cache - 2 1 = program cache supported - 1 1 = no block address restrictions - 0 Overlapped / concurrent interleaving support */ uint8_t reserved_115_127[13]; /**< Bytes 115-127: Reserved (0) */ uint8_t pin_capacitance; /**< Byte 128: I/O pin capacitance */ uint16_t timing_mode; /**< Byte 129-130: Timing mode support - 6-15 Reserved (0) - 5 1 = supports timing mode 5 - 4 1 = supports timing mode 4 - 3 1 = supports timing mode 3 - 2 1 = supports timing mode 2 - 1 1 = supports timing mode 1 - 0 1 = supports timing mode 0, shall be 1 */ uint16_t cache_timing_mode; /**< Byte 131-132: Program cache timing mode support - 6-15 Reserved (0) - 5 1 = supports timing mode 5 - 4 1 = supports timing mode 4 - 3 1 = supports timing mode 3 - 2 1 = supports timing mode 2 - 1 1 = supports timing mode 1 - 0 1 = supports timing mode 0 */ uint16_t t_prog; /**< Byte 133-134: Maximum page program time (us) */ uint16_t t_bers; /**< Byte 135-136: Maximum block erase time (us) */ uint16_t t_r; /**< Byte 137-148: Maximum page read time (us) */ uint16_t t_ccs; /**< Byte 139-140: Minimum change column setup time (ns) */ uint8_t reserved_141_163[23]; /**< Byte 141-163: Reserved (0) */ uint16_t vendor_revision; /**< Byte 164-165: Vendor specific Revision number */ uint8_t vendor_specific[88]; /**< Byte 166-253: Vendor specific */ uint16_t crc; /**< Byte 254-255: Integrity CRC */ } cvmx_nand_onfi_param_page_t; /** * 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 * be connected to NAND. It is normally safe to pass 0xff here and * let the API probe all 8 chip selects. * * @return Zero on success, a negative cvmx_nand_status_t error code on failure */ 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. * * @return Zero on success, a negative cvmx_nand_status_t error code on failure */ extern cvmx_nand_status_t cvmx_nand_shutdown(void); /** * Returns a bitmask representing the chip selects that are * connected to NAND chips. This can be called after the * initialize to determine the actual number of NAND chips * found. Each bit in the response coresponds to a chip select. * * @return Zero if no NAND chips were found. Otherwise a bit is set for * each chip select (1<<chip). */ extern int cvmx_nand_get_active_chips(void); /** * Override the timing parameters for a NAND chip * * @param chip Chip select to override * @param tim_mult * @param tim_par * @param clen * @param alen * @param rdn * @param wrn * * @return Zero on success, a negative cvmx_nand_status_t error code on failure */ extern cvmx_nand_status_t cvmx_nand_set_timing(int chip, int tim_mult, int tim_par[7], int clen[4], int alen[4], int rdn[4], int wrn[2]); /** * Submit a command to the NAND command queue. Generally this * will not be used directly. Instead most programs will use the other * higher level NAND functions. * * @param cmd Command to submit * * @return Zero on success, a negative cvmx_nand_status_t error code on failure */ extern cvmx_nand_status_t cvmx_nand_submit(cvmx_nand_cmd_t cmd); /** * Read a page from NAND. If the buffer has room, the out of band * data will be included. * * @param chip Chip select for NAND flash * @param nand_address * Location in NAND to read. See description in file comment * @param buffer_address * Physical address to store the result at * @param buffer_length * Number of bytes to read * * @return Bytes read on success, a negative cvmx_nand_status_t error code on failure */ extern int cvmx_nand_page_read(int chip, uint64_t nand_address, uint64_t buffer_address, int buffer_length); /** * Write a page to NAND. The buffer must contain the entire page * including the out of band data. * * @param chip Chip select for NAND flash * @param nand_address * Location in NAND to write. See description in file comment * @param buffer_address * Physical address to read the data from * * @return Zero on success, a negative cvmx_nand_status_t error code on failure */ extern cvmx_nand_status_t cvmx_nand_page_write(int chip, uint64_t nand_address, uint64_t buffer_address); /** * Erase a NAND block. A single block contains multiple pages. * * @param chip Chip select for NAND flash * @param nand_address * Location in NAND to erase. See description in file comment * * @return Zero on success, a negative cvmx_nand_status_t error code on failure */ extern cvmx_nand_status_t cvmx_nand_block_erase(int chip, uint64_t nand_address); /** * Read the NAND ID information * * @param chip Chip select for NAND flash * @param nand_address * NAND address to read ID from. Usually this is either 0x0 or 0x20. * @param buffer_address * Physical address to store data in * @param buffer_length * Length of the buffer. Usually this is 4 bytes * * @return Bytes read on success, a negative cvmx_nand_status_t error code on failure */ extern int cvmx_nand_read_id(int chip, uint64_t nand_address, uint64_t buffer_address, int buffer_length); /** * Read the NAND parameter page * * @param chip Chip select for NAND flash * @param buffer_address * Physical address to store data in * @param buffer_length * Length of the buffer. Usually this is 4 bytes * * @return Bytes read on success, a negative cvmx_nand_status_t error code on failure */ extern int cvmx_nand_read_param_page(int chip, uint64_t buffer_address, int buffer_length); /** * Get the status of the NAND flash * * @param chip Chip select for NAND flash * * @return NAND status or a negative cvmx_nand_status_t error code on failure */ extern int cvmx_nand_get_status(int chip); /** * Get the page size, excluding out of band data. This function * will return zero for chip selects not connected to NAND. * * @param chip Chip select for NAND flash * * @return Page size in bytes or a negative cvmx_nand_status_t error code on failure */ extern int cvmx_nand_get_page_size(int chip); /** * Get the OOB size. * * @param chip Chip select for NAND flash * * @return OOB in bytes or a negative cvmx_nand_status_t error code on failure */ extern int cvmx_nand_get_oob_size(int chip); /** * Get the number of pages per NAND block * * @param chip Chip select for NAND flash * * @return Numboer of pages in each block or a negative cvmx_nand_status_t error code on failure */ extern int cvmx_nand_get_pages_per_block(int chip); /** * Get the number of blocks in the NAND flash * * @param chip Chip select for NAND flash * * @return Number of blocks or a negative cvmx_nand_status_t error code on failure */ extern int cvmx_nand_get_blocks(int chip); /** * Reset the NAND flash * * @param chip Chip select for NAND flash * * @return Zero on success, a negative cvmx_nand_status_t error code on failure */ 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 */ extern void cvmx_nand_compute_boot_ecc(unsigned char *block, unsigned char *eccp); extern int cvmx_nand_correct_boot_ecc(uint8_t *block); #ifdef __cplusplus } #endif #endif /* __CVMX_NAND_H__ */
Upload File
Create Folder