1*dec61c78STsiChung Liew /* 2*dec61c78STsiChung Liew * 3*dec61c78STsiChung Liew * (C) Copyright 2000-2003 4*dec61c78STsiChung Liew * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 5*dec61c78STsiChung Liew * 6*dec61c78STsiChung Liew * Copyright (C) 2004-2009 Freescale Semiconductor, Inc. 7*dec61c78STsiChung Liew * TsiChung Liew (Tsi-Chung.Liew@freescale.com) 8*dec61c78STsiChung Liew * 9*dec61c78STsiChung Liew * See file CREDITS for list of people who contributed to this 10*dec61c78STsiChung Liew * project. 11*dec61c78STsiChung Liew * 12*dec61c78STsiChung Liew * This program is free software; you can redistribute it and/or 13*dec61c78STsiChung Liew * modify it under the terms of the GNU General Public License as 14*dec61c78STsiChung Liew * published by the Free Software Foundation; either version 2 of 15*dec61c78STsiChung Liew * the License, or (at your option) any later version. 16*dec61c78STsiChung Liew * 17*dec61c78STsiChung Liew * This program is distributed in the hope that it will be useful, 18*dec61c78STsiChung Liew * but WITHOUT ANY WARRANTY; without even the implied warranty of 19*dec61c78STsiChung Liew * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20*dec61c78STsiChung Liew * GNU General Public License for more details. 21*dec61c78STsiChung Liew * 22*dec61c78STsiChung Liew * You should have received a copy of the GNU General Public License 23*dec61c78STsiChung Liew * along with this program; if not, write to the Free Software 24*dec61c78STsiChung Liew * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 25*dec61c78STsiChung Liew * MA 02111-1307 USA 26*dec61c78STsiChung Liew */ 27*dec61c78STsiChung Liew 28*dec61c78STsiChung Liew #include <common.h> 29*dec61c78STsiChung Liew #include <spi.h> 30*dec61c78STsiChung Liew #include <malloc.h> 31*dec61c78STsiChung Liew #include <asm/immap.h> 32*dec61c78STsiChung Liew 33*dec61c78STsiChung Liew struct cf_spi_slave { 34*dec61c78STsiChung Liew struct spi_slave slave; 35*dec61c78STsiChung Liew uint baudrate; 36*dec61c78STsiChung Liew int charbit; 37*dec61c78STsiChung Liew }; 38*dec61c78STsiChung Liew 39*dec61c78STsiChung Liew int cfspi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, 40*dec61c78STsiChung Liew void *din, ulong flags); 41*dec61c78STsiChung Liew struct spi_slave *cfspi_setup_slave(struct cf_spi_slave *cfslave, uint mode); 42*dec61c78STsiChung Liew void cfspi_init(void); 43*dec61c78STsiChung Liew void cfspi_tx(u32 ctrl, u16 data); 44*dec61c78STsiChung Liew u16 cfspi_rx(void); 45*dec61c78STsiChung Liew 46*dec61c78STsiChung Liew extern void cfspi_port_conf(void); 47*dec61c78STsiChung Liew extern int cfspi_claim_bus(uint bus, uint cs); 48*dec61c78STsiChung Liew extern void cfspi_release_bus(uint bus, uint cs); 49*dec61c78STsiChung Liew 50*dec61c78STsiChung Liew DECLARE_GLOBAL_DATA_PTR; 51*dec61c78STsiChung Liew 52*dec61c78STsiChung Liew #if defined(CONFIG_CF_DSPI) 53*dec61c78STsiChung Liew /* DSPI specific mode */ 54*dec61c78STsiChung Liew #define SPI_MODE_MOD 0x00200000 55*dec61c78STsiChung Liew #define SPI_DBLRATE 0x00100000 56*dec61c78STsiChung Liew 57*dec61c78STsiChung Liew void cfspi_init(void) 58*dec61c78STsiChung Liew { 59*dec61c78STsiChung Liew volatile dspi_t *dspi = (dspi_t *) MMAP_DSPI; 60*dec61c78STsiChung Liew 61*dec61c78STsiChung Liew cfspi_port_conf(); /* port configuration */ 62*dec61c78STsiChung Liew 63*dec61c78STsiChung Liew dspi->mcr = DSPI_MCR_MSTR | DSPI_MCR_CSIS7 | DSPI_MCR_CSIS6 | 64*dec61c78STsiChung Liew DSPI_MCR_CSIS5 | DSPI_MCR_CSIS4 | DSPI_MCR_CSIS3 | 65*dec61c78STsiChung Liew DSPI_MCR_CSIS2 | DSPI_MCR_CSIS1 | DSPI_MCR_CSIS0 | 66*dec61c78STsiChung Liew DSPI_MCR_CRXF | DSPI_MCR_CTXF; 67*dec61c78STsiChung Liew 68*dec61c78STsiChung Liew /* Default setting in platform configuration */ 69*dec61c78STsiChung Liew #ifdef CONFIG_SYS_DSPI_CTAR0 70*dec61c78STsiChung Liew dspi->ctar[0] = CONFIG_SYS_DSPI_CTAR0; 71*dec61c78STsiChung Liew #endif 72*dec61c78STsiChung Liew #ifdef CONFIG_SYS_DSPI_CTAR1 73*dec61c78STsiChung Liew dspi->ctar[1] = CONFIG_SYS_DSPI_CTAR1; 74*dec61c78STsiChung Liew #endif 75*dec61c78STsiChung Liew #ifdef CONFIG_SYS_DSPI_CTAR2 76*dec61c78STsiChung Liew dspi->ctar[2] = CONFIG_SYS_DSPI_CTAR2; 77*dec61c78STsiChung Liew #endif 78*dec61c78STsiChung Liew #ifdef CONFIG_SYS_DSPI_CTAR3 79*dec61c78STsiChung Liew dspi->ctar[3] = CONFIG_SYS_DSPI_CTAR3; 80*dec61c78STsiChung Liew #endif 81*dec61c78STsiChung Liew #ifdef CONFIG_SYS_DSPI_CTAR4 82*dec61c78STsiChung Liew dspi->ctar[4] = CONFIG_SYS_DSPI_CTAR4; 83*dec61c78STsiChung Liew #endif 84*dec61c78STsiChung Liew #ifdef CONFIG_SYS_DSPI_CTAR5 85*dec61c78STsiChung Liew dspi->ctar[5] = CONFIG_SYS_DSPI_CTAR5; 86*dec61c78STsiChung Liew #endif 87*dec61c78STsiChung Liew #ifdef CONFIG_SYS_DSPI_CTAR6 88*dec61c78STsiChung Liew dspi->ctar[6] = CONFIG_SYS_DSPI_CTAR6; 89*dec61c78STsiChung Liew #endif 90*dec61c78STsiChung Liew #ifdef CONFIG_SYS_DSPI_CTAR7 91*dec61c78STsiChung Liew dspi->ctar[7] = CONFIG_SYS_DSPI_CTAR7; 92*dec61c78STsiChung Liew #endif 93*dec61c78STsiChung Liew } 94*dec61c78STsiChung Liew 95*dec61c78STsiChung Liew void cfspi_tx(u32 ctrl, u16 data) 96*dec61c78STsiChung Liew { 97*dec61c78STsiChung Liew volatile dspi_t *dspi = (dspi_t *) MMAP_DSPI; 98*dec61c78STsiChung Liew 99*dec61c78STsiChung Liew while ((dspi->sr & 0x0000F000) >= 4) ; 100*dec61c78STsiChung Liew 101*dec61c78STsiChung Liew dspi->tfr = (ctrl | data); 102*dec61c78STsiChung Liew } 103*dec61c78STsiChung Liew 104*dec61c78STsiChung Liew u16 cfspi_rx(void) 105*dec61c78STsiChung Liew { 106*dec61c78STsiChung Liew volatile dspi_t *dspi = (dspi_t *) MMAP_DSPI; 107*dec61c78STsiChung Liew 108*dec61c78STsiChung Liew while ((dspi->sr & 0x000000F0) == 0) ; 109*dec61c78STsiChung Liew 110*dec61c78STsiChung Liew return (dspi->rfr & 0xFFFF); 111*dec61c78STsiChung Liew } 112*dec61c78STsiChung Liew 113*dec61c78STsiChung Liew int cfspi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, 114*dec61c78STsiChung Liew void *din, ulong flags) 115*dec61c78STsiChung Liew { 116*dec61c78STsiChung Liew struct cf_spi_slave *cfslave = (struct cf_spi_slave *)slave; 117*dec61c78STsiChung Liew u16 *spi_rd16 = NULL, *spi_wr16 = NULL; 118*dec61c78STsiChung Liew u8 *spi_rd = NULL, *spi_wr = NULL; 119*dec61c78STsiChung Liew static u32 ctrl = 0; 120*dec61c78STsiChung Liew uint len = bitlen >> 3; 121*dec61c78STsiChung Liew 122*dec61c78STsiChung Liew if (cfslave->charbit == 16) { 123*dec61c78STsiChung Liew bitlen >>= 1; 124*dec61c78STsiChung Liew spi_wr16 = (u16 *) dout; 125*dec61c78STsiChung Liew spi_rd16 = (u16 *) din; 126*dec61c78STsiChung Liew } else { 127*dec61c78STsiChung Liew spi_wr = (u8 *) dout; 128*dec61c78STsiChung Liew spi_rd = (u8 *) din; 129*dec61c78STsiChung Liew } 130*dec61c78STsiChung Liew 131*dec61c78STsiChung Liew if ((flags & SPI_XFER_BEGIN) == SPI_XFER_BEGIN) 132*dec61c78STsiChung Liew ctrl |= DSPI_TFR_CONT; 133*dec61c78STsiChung Liew 134*dec61c78STsiChung Liew ctrl = (ctrl & 0xFF000000) | ((1 << slave->cs) << 16); 135*dec61c78STsiChung Liew 136*dec61c78STsiChung Liew if (len > 1) { 137*dec61c78STsiChung Liew int tmp_len = len - 1; 138*dec61c78STsiChung Liew while (tmp_len--) { 139*dec61c78STsiChung Liew if (dout != NULL) { 140*dec61c78STsiChung Liew if (cfslave->charbit == 16) 141*dec61c78STsiChung Liew cfspi_tx(ctrl, *spi_wr16++); 142*dec61c78STsiChung Liew else 143*dec61c78STsiChung Liew cfspi_tx(ctrl, *spi_wr++); 144*dec61c78STsiChung Liew cfspi_rx(); 145*dec61c78STsiChung Liew } 146*dec61c78STsiChung Liew 147*dec61c78STsiChung Liew if (din != NULL) { 148*dec61c78STsiChung Liew cfspi_tx(ctrl, 0); 149*dec61c78STsiChung Liew if (cfslave->charbit == 16) 150*dec61c78STsiChung Liew *spi_rd16++ = cfspi_rx(); 151*dec61c78STsiChung Liew else 152*dec61c78STsiChung Liew *spi_rd++ = cfspi_rx(); 153*dec61c78STsiChung Liew } 154*dec61c78STsiChung Liew } 155*dec61c78STsiChung Liew 156*dec61c78STsiChung Liew len = 1; /* remaining byte */ 157*dec61c78STsiChung Liew } 158*dec61c78STsiChung Liew 159*dec61c78STsiChung Liew if ((flags & SPI_XFER_END) == SPI_XFER_END) 160*dec61c78STsiChung Liew ctrl &= ~DSPI_TFR_CONT; 161*dec61c78STsiChung Liew 162*dec61c78STsiChung Liew if (len) { 163*dec61c78STsiChung Liew if (dout != NULL) { 164*dec61c78STsiChung Liew if (cfslave->charbit == 16) 165*dec61c78STsiChung Liew cfspi_tx(ctrl, *spi_wr16); 166*dec61c78STsiChung Liew else 167*dec61c78STsiChung Liew cfspi_tx(ctrl, *spi_wr); 168*dec61c78STsiChung Liew cfspi_rx(); 169*dec61c78STsiChung Liew } 170*dec61c78STsiChung Liew 171*dec61c78STsiChung Liew if (din != NULL) { 172*dec61c78STsiChung Liew cfspi_tx(ctrl, 0); 173*dec61c78STsiChung Liew if (cfslave->charbit == 16) 174*dec61c78STsiChung Liew *spi_rd16 = cfspi_rx(); 175*dec61c78STsiChung Liew else 176*dec61c78STsiChung Liew *spi_rd = cfspi_rx(); 177*dec61c78STsiChung Liew } 178*dec61c78STsiChung Liew } else { 179*dec61c78STsiChung Liew /* dummy read */ 180*dec61c78STsiChung Liew cfspi_tx(ctrl, 0); 181*dec61c78STsiChung Liew cfspi_rx(); 182*dec61c78STsiChung Liew } 183*dec61c78STsiChung Liew 184*dec61c78STsiChung Liew return 0; 185*dec61c78STsiChung Liew } 186*dec61c78STsiChung Liew 187*dec61c78STsiChung Liew struct spi_slave *cfspi_setup_slave(struct cf_spi_slave *cfslave, uint mode) 188*dec61c78STsiChung Liew { 189*dec61c78STsiChung Liew /* 190*dec61c78STsiChung Liew * bit definition for mode: 191*dec61c78STsiChung Liew * bit 31 - 28: Transfer size 3 to 16 bits 192*dec61c78STsiChung Liew * 27 - 26: PCS to SCK delay prescaler 193*dec61c78STsiChung Liew * 25 - 24: After SCK delay prescaler 194*dec61c78STsiChung Liew * 23 - 22: Delay after transfer prescaler 195*dec61c78STsiChung Liew * 21 : Allow overwrite for bit 31-22 and bit 20-8 196*dec61c78STsiChung Liew * 20 : Double baud rate 197*dec61c78STsiChung Liew * 19 - 16: PCS to SCK delay scaler 198*dec61c78STsiChung Liew * 15 - 12: After SCK delay scaler 199*dec61c78STsiChung Liew * 11 - 8: Delay after transfer scaler 200*dec61c78STsiChung Liew * 7 - 0: SPI_CPHA, SPI_CPOL, SPI_LSB_FIRST 201*dec61c78STsiChung Liew */ 202*dec61c78STsiChung Liew volatile dspi_t *dspi = (dspi_t *) MMAP_DSPI; 203*dec61c78STsiChung Liew int prescaler[] = { 2, 3, 5, 7 }; 204*dec61c78STsiChung Liew int scaler[] = { 205*dec61c78STsiChung Liew 2, 4, 6, 8, 206*dec61c78STsiChung Liew 16, 32, 64, 128, 207*dec61c78STsiChung Liew 256, 512, 1024, 2048, 208*dec61c78STsiChung Liew 4096, 8192, 16384, 32768 209*dec61c78STsiChung Liew }; 210*dec61c78STsiChung Liew int i, j, pbrcnt, brcnt, diff, tmp, dbr = 0; 211*dec61c78STsiChung Liew int best_i, best_j, bestmatch = 0x7FFFFFFF, baud_speed; 212*dec61c78STsiChung Liew u32 bus_setup = 0; 213*dec61c78STsiChung Liew 214*dec61c78STsiChung Liew tmp = (prescaler[3] * scaler[15]); 215*dec61c78STsiChung Liew /* Maximum and minimum baudrate it can handle */ 216*dec61c78STsiChung Liew if ((cfslave->baudrate > (gd->bus_clk >> 1)) || 217*dec61c78STsiChung Liew (cfslave->baudrate < (gd->bus_clk / tmp))) { 218*dec61c78STsiChung Liew printf("Exceed baudrate limitation: Max %d - Min %d\n", 219*dec61c78STsiChung Liew (int)(gd->bus_clk >> 1), (int)(gd->bus_clk / tmp)); 220*dec61c78STsiChung Liew return NULL; 221*dec61c78STsiChung Liew } 222*dec61c78STsiChung Liew 223*dec61c78STsiChung Liew /* Activate Double Baud when it exceed 1/4 the bus clk */ 224*dec61c78STsiChung Liew if ((CONFIG_SYS_DSPI_CTAR0 & DSPI_CTAR_DBR) || 225*dec61c78STsiChung Liew (cfslave->baudrate > (gd->bus_clk / (prescaler[0] * scaler[0])))) { 226*dec61c78STsiChung Liew bus_setup |= DSPI_CTAR_DBR; 227*dec61c78STsiChung Liew dbr = 1; 228*dec61c78STsiChung Liew } 229*dec61c78STsiChung Liew 230*dec61c78STsiChung Liew if (mode & SPI_CPOL) 231*dec61c78STsiChung Liew bus_setup |= DSPI_CTAR_CPOL; 232*dec61c78STsiChung Liew if (mode & SPI_CPHA) 233*dec61c78STsiChung Liew bus_setup |= DSPI_CTAR_CPHA; 234*dec61c78STsiChung Liew if (mode & SPI_LSB_FIRST) 235*dec61c78STsiChung Liew bus_setup |= DSPI_CTAR_LSBFE; 236*dec61c78STsiChung Liew 237*dec61c78STsiChung Liew /* Overwrite default value set in platform configuration file */ 238*dec61c78STsiChung Liew if (mode & SPI_MODE_MOD) { 239*dec61c78STsiChung Liew 240*dec61c78STsiChung Liew if ((mode & 0xF0000000) == 0) 241*dec61c78STsiChung Liew bus_setup |= 242*dec61c78STsiChung Liew dspi->ctar[cfslave->slave.bus] & 0x78000000; 243*dec61c78STsiChung Liew else 244*dec61c78STsiChung Liew bus_setup |= ((mode & 0xF0000000) >> 1); 245*dec61c78STsiChung Liew 246*dec61c78STsiChung Liew /* 247*dec61c78STsiChung Liew * Check to see if it is enabled by default in platform 248*dec61c78STsiChung Liew * config, or manual setting passed by mode parameter 249*dec61c78STsiChung Liew */ 250*dec61c78STsiChung Liew if (mode & SPI_DBLRATE) { 251*dec61c78STsiChung Liew bus_setup |= DSPI_CTAR_DBR; 252*dec61c78STsiChung Liew dbr = 1; 253*dec61c78STsiChung Liew } 254*dec61c78STsiChung Liew bus_setup |= (mode & 0x0FC00000) >> 4; /* PSCSCK, PASC, PDT */ 255*dec61c78STsiChung Liew bus_setup |= (mode & 0x000FFF00) >> 4; /* CSSCK, ASC, DT */ 256*dec61c78STsiChung Liew } else 257*dec61c78STsiChung Liew bus_setup |= (dspi->ctar[cfslave->slave.bus] & 0x78FCFFF0); 258*dec61c78STsiChung Liew 259*dec61c78STsiChung Liew cfslave->charbit = 260*dec61c78STsiChung Liew ((dspi->ctar[cfslave->slave.bus] & 0x78000000) == 261*dec61c78STsiChung Liew 0x78000000) ? 16 : 8; 262*dec61c78STsiChung Liew 263*dec61c78STsiChung Liew pbrcnt = sizeof(prescaler) / sizeof(int); 264*dec61c78STsiChung Liew brcnt = sizeof(scaler) / sizeof(int); 265*dec61c78STsiChung Liew 266*dec61c78STsiChung Liew /* baudrate calculation - to closer value, may not be exact match */ 267*dec61c78STsiChung Liew for (best_i = 0, best_j = 0, i = 0; i < pbrcnt; i++) { 268*dec61c78STsiChung Liew baud_speed = gd->bus_clk / prescaler[i]; 269*dec61c78STsiChung Liew for (j = 0; j < brcnt; j++) { 270*dec61c78STsiChung Liew tmp = (baud_speed / scaler[j]) * (1 + dbr); 271*dec61c78STsiChung Liew 272*dec61c78STsiChung Liew if (tmp > cfslave->baudrate) 273*dec61c78STsiChung Liew diff = tmp - cfslave->baudrate; 274*dec61c78STsiChung Liew else 275*dec61c78STsiChung Liew diff = cfslave->baudrate - tmp; 276*dec61c78STsiChung Liew 277*dec61c78STsiChung Liew if (diff < bestmatch) { 278*dec61c78STsiChung Liew bestmatch = diff; 279*dec61c78STsiChung Liew best_i = i; 280*dec61c78STsiChung Liew best_j = j; 281*dec61c78STsiChung Liew } 282*dec61c78STsiChung Liew } 283*dec61c78STsiChung Liew } 284*dec61c78STsiChung Liew bus_setup |= (DSPI_CTAR_PBR(best_i) | DSPI_CTAR_BR(best_j)); 285*dec61c78STsiChung Liew dspi->ctar[cfslave->slave.bus] = bus_setup; 286*dec61c78STsiChung Liew 287*dec61c78STsiChung Liew return &cfslave->slave; 288*dec61c78STsiChung Liew } 289*dec61c78STsiChung Liew #endif /* CONFIG_CF_DSPI */ 290*dec61c78STsiChung Liew 291*dec61c78STsiChung Liew #ifdef CONFIG_CF_QSPI 292*dec61c78STsiChung Liew /* 52xx, 53xx */ 293*dec61c78STsiChung Liew #endif /* CONFIG_CF_QSPI */ 294*dec61c78STsiChung Liew 295*dec61c78STsiChung Liew #ifdef CONFIG_CMD_SPI 296*dec61c78STsiChung Liew int spi_cs_is_valid(unsigned int bus, unsigned int cs) 297*dec61c78STsiChung Liew { 298*dec61c78STsiChung Liew if (((cs >= 0) && (cs < 8)) && ((bus >= 0) && (bus < 8))) 299*dec61c78STsiChung Liew return 1; 300*dec61c78STsiChung Liew else 301*dec61c78STsiChung Liew return 0; 302*dec61c78STsiChung Liew } 303*dec61c78STsiChung Liew 304*dec61c78STsiChung Liew void spi_init_f(void) 305*dec61c78STsiChung Liew { 306*dec61c78STsiChung Liew } 307*dec61c78STsiChung Liew 308*dec61c78STsiChung Liew void spi_init_r(void) 309*dec61c78STsiChung Liew { 310*dec61c78STsiChung Liew } 311*dec61c78STsiChung Liew 312*dec61c78STsiChung Liew void spi_init(void) 313*dec61c78STsiChung Liew { 314*dec61c78STsiChung Liew cfspi_init(); 315*dec61c78STsiChung Liew } 316*dec61c78STsiChung Liew 317*dec61c78STsiChung Liew struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, 318*dec61c78STsiChung Liew unsigned int max_hz, unsigned int mode) 319*dec61c78STsiChung Liew { 320*dec61c78STsiChung Liew struct cf_spi_slave *cfslave; 321*dec61c78STsiChung Liew 322*dec61c78STsiChung Liew if (!spi_cs_is_valid(bus, cs)) 323*dec61c78STsiChung Liew return NULL; 324*dec61c78STsiChung Liew 325*dec61c78STsiChung Liew cfslave = malloc(sizeof(struct cf_spi_slave)); 326*dec61c78STsiChung Liew if (!cfslave) 327*dec61c78STsiChung Liew return NULL; 328*dec61c78STsiChung Liew 329*dec61c78STsiChung Liew cfslave->slave.bus = bus; 330*dec61c78STsiChung Liew cfslave->slave.cs = cs; 331*dec61c78STsiChung Liew cfslave->baudrate = max_hz; 332*dec61c78STsiChung Liew 333*dec61c78STsiChung Liew /* specific setup */ 334*dec61c78STsiChung Liew return cfspi_setup_slave(cfslave, mode); 335*dec61c78STsiChung Liew } 336*dec61c78STsiChung Liew 337*dec61c78STsiChung Liew void spi_free_slave(struct spi_slave *slave) 338*dec61c78STsiChung Liew { 339*dec61c78STsiChung Liew free(slave); 340*dec61c78STsiChung Liew } 341*dec61c78STsiChung Liew 342*dec61c78STsiChung Liew int spi_claim_bus(struct spi_slave *slave) 343*dec61c78STsiChung Liew { 344*dec61c78STsiChung Liew return cfspi_claim_bus(slave->bus, slave->cs); 345*dec61c78STsiChung Liew } 346*dec61c78STsiChung Liew 347*dec61c78STsiChung Liew void spi_release_bus(struct spi_slave *slave) 348*dec61c78STsiChung Liew { 349*dec61c78STsiChung Liew cfspi_release_bus(slave->bus, slave->cs); 350*dec61c78STsiChung Liew } 351*dec61c78STsiChung Liew 352*dec61c78STsiChung Liew int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, 353*dec61c78STsiChung Liew void *din, unsigned long flags) 354*dec61c78STsiChung Liew { 355*dec61c78STsiChung Liew return cfspi_xfer(slave, bitlen, dout, din, flags); 356*dec61c78STsiChung Liew } 357*dec61c78STsiChung Liew #endif /* CONFIG_CMD_SPI */ 358