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