/* taltab.c David Rowe 20 Sep 2006 Linux device driver for Blackfin that implements unit tests for the Blackfin-SPI-SiLabs interface. talab = test alternate nCSA ad nCSB. This test writes SPI bytes to nCSA and nCSB alternatively to check the logic in the CPLD, for example there should be no overlap in the nCSB and nCS1 or nCSB and nCS2 signals. */ /* Copyright (C) 2006 David Rowe This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include /* Need to do include bfsi module this way due to kbuild restrictions. I would rather have it as seperately compiled module but I couldn't work out how to specify the path I wanted */ #include "../../src/bfsi.c" #define BIT_RESET 4 /* GPIO bit tied to nRESET on Si chips */ #define SPI_NCSA 3 #define SPI_NCSB 2 #define TESTS 100 /*----------------------- TEST PARAMETERS -----------------------------*/ static int baud = 4; /* gives max for sys clock = 100 MHz for Si3050 */ static int verbose = 0; static int tests = 100; /*------------------------MODULE INIT FUNCTION --------------------------*/ static int __init tspi_init_module (void) { int i; printk("initializing module\n"); /* init SPI here to ensure that the SPI nCS pin on the SiLabs chip is H when the chip is RESET. This is required to configure the chip for SPI/PCM mode. */ bfsi_spi_init(baud, (1<