diff options
author | Juli Mallett <jmallett@FreeBSD.org> | 2012-03-11 04:14:00 +0000 |
---|---|---|
committer | Juli Mallett <jmallett@FreeBSD.org> | 2012-03-11 04:14:00 +0000 |
commit | f8b73ad2e16934621a86fd1fd67b46aa21521d0b (patch) | |
tree | cd40bd62c08fa360ceced004ce74decd1b26ca3c /cvmx-helper-spi.c | |
parent | 7a1e830cbcd5d33aa7fcdd8732e6ea26510508fd (diff) | |
download | src-f8b73ad2e16934621a86fd1fd67b46aa21521d0b.tar.gz src-f8b73ad2e16934621a86fd1fd67b46aa21521d0b.zip |
Import Cavium Octeon SDK 2.3.0 Simple Executive from cnusers.org.vendor/octeon-sdk/2.3.0vendor/octeon-sdk
Notes
Notes:
svn path=/vendor-sys/octeon-sdk/dist/; revision=232809
svn path=/vendor-sys/octeon-sdk/2.3.0/; revision=232810; tag=vendor/octeon-sdk/2.3.0
Diffstat (limited to 'cvmx-helper-spi.c')
-rw-r--r-- | cvmx-helper-spi.c | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/cvmx-helper-spi.c b/cvmx-helper-spi.c index e181dc430ab1..d9715c31ba58 100644 --- a/cvmx-helper-spi.c +++ b/cvmx-helper-spi.c @@ -1,5 +1,5 @@ /***********************license start*************** - * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights + * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights * reserved. * * @@ -15,7 +15,7 @@ * disclaimer in the documentation and/or other materials provided * with the distribution. - * * Neither the name of Cavium Networks nor the names of + * * 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. @@ -26,7 +26,7 @@ * 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 + * 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 @@ -47,7 +47,7 @@ * Functions for SPI initialization, configuration, * and monitoring. * - * <hr>$Revision: 49448 $<hr> + * <hr>$Revision: 70030 $<hr> */ #ifdef CVMX_BUILD_FOR_LINUX_KERNEL #include <asm/octeon/cvmx.h> @@ -79,6 +79,14 @@ #define CVMX_HELPER_SPI_TIMEOUT 10 #endif +int __cvmx_helper_spi_enumerate(int interface) +{ + if ((cvmx_sysinfo_get()->board_type != CVMX_BOARD_TYPE_SIM) && + cvmx_spi4000_is_present(interface)) + return 10; + else + return 16; +} /** * @INTERNAL @@ -92,26 +100,22 @@ */ int __cvmx_helper_spi_probe(int interface) { - int num_ports = 0; - - if ((cvmx_sysinfo_get()->board_type != CVMX_BOARD_TYPE_SIM) && - cvmx_spi4000_is_present(interface)) - { - num_ports = 10; - } - else - { - cvmx_pko_reg_crc_enable_t enable; - num_ports = 16; - /* Unlike the SPI4000, most SPI devices don't automatically - put on the L2 CRC. For everything except for the SPI4000 - have PKO append the L2 CRC to the packet */ - enable.u64 = cvmx_read_csr(CVMX_PKO_REG_CRC_ENABLE); - enable.s.enable |= 0xffff << (interface*16); - cvmx_write_csr(CVMX_PKO_REG_CRC_ENABLE, enable.u64); - } - __cvmx_helper_setup_gmx(interface, num_ports); - return num_ports; + int num_ports = __cvmx_helper_spi_enumerate(interface); + + if (num_ports == 16) { + cvmx_pko_reg_crc_enable_t enable; + /* + * Unlike the SPI4000, most SPI devices don't + * automatically put on the L2 CRC. For everything + * except for the SPI4000 have PKO append the L2 CRC + * to the packet + */ + enable.u64 = cvmx_read_csr(CVMX_PKO_REG_CRC_ENABLE); + enable.s.enable |= 0xffff << (interface*16); + cvmx_write_csr(CVMX_PKO_REG_CRC_ENABLE, enable.u64); + } + __cvmx_helper_setup_gmx(interface, num_ports); + return num_ports; } |