| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 NVIDIA Corporation | 2 * Copyright (c) 2010 NVIDIA Corporation |
| 3 * With help from the mpc8xxx SPI driver | 3 * With help from the mpc8xxx SPI driver |
| 4 * | 4 * |
| 5 * See file CREDITS for list of people who contributed to this | 5 * See file CREDITS for list of people who contributed to this |
| 6 * project. | 6 * project. |
| 7 * | 7 * |
| 8 * This program is free software; you can redistribute it and/or | 8 * This program is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU General Public License as | 9 * modify it under the terms of the GNU General Public License as |
| 10 * published by the Free Software Foundation; either version 2 of | 10 * published by the Free Software Foundation; either version 2 of |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 * SPI reset/clocks init - reset SPI, set clocks, release from reset | 84 * SPI reset/clocks init - reset SPI, set clocks, release from reset |
| 85 */ | 85 */ |
| 86 NV_CLK_RST_READ(0x08, val); | 86 NV_CLK_RST_READ(0x08, val); |
| 87 NV_CLK_RST_WRITE(0x08, (val | 0x800)); | 87 NV_CLK_RST_WRITE(0x08, (val | 0x800)); |
| 88 debug("spi_init: ClkRst = %08x\n", val); | 88 debug("spi_init: ClkRst = %08x\n", val); |
| 89 | 89 |
| 90 NV_CLK_RST_READ(0x14, val); | 90 NV_CLK_RST_READ(0x14, val); |
| 91 NV_CLK_RST_WRITE(0x14, (val | 0x800)); | 91 NV_CLK_RST_WRITE(0x14, (val | 0x800)); |
| 92 debug("spi_init: ClkEnable = %08x\n", val); | 92 debug("spi_init: ClkEnable = %08x\n", val); |
| 93 | 93 |
| 94 » /* Change default SPI clock from 12MHz to 6MHz, same as BootROM */ | 94 » /* Change SPI clock to 24MHz */ |
| 95 NV_CLK_RST_READ(0x114, val); | 95 NV_CLK_RST_READ(0x114, val); |
| 96 » NV_CLK_RST_WRITE(0x114, (val | 0x2)); | 96 » val &= 0x3FFFFF00;» » /* src = PLLP_OUT0 */ |
| 97 » val |= ((9-1) << 1);» » /* div = 9 in 7.1 format */ |
| 98 » NV_CLK_RST_WRITE(0x114, val); |
| 97 debug("spi_init: ClkSrc = %08x\n", val); | 99 debug("spi_init: ClkSrc = %08x\n", val); |
| 98 | 100 |
| 99 NV_CLK_RST_READ(0x08, val); | 101 NV_CLK_RST_READ(0x08, val); |
| 100 NV_CLK_RST_WRITE(0x08, (val & 0xFFFFF7FF)); | 102 NV_CLK_RST_WRITE(0x08, (val & 0xFFFFF7FF)); |
| 101 debug("spi_init: ClkRst final = %08x\n", val); | 103 debug("spi_init: ClkRst final = %08x\n", val); |
| 102 | 104 |
| 103 /* Clear stale status here */ | 105 /* Clear stale status here */ |
| 104 | 106 |
| 105 spi->status = SPI_STAT_RDY | SPI_STAT_RXF_FLUSH | SPI_STAT_TXF_FLUSH | \ | 107 spi->status = SPI_STAT_RDY | SPI_STAT_RXF_FLUSH | SPI_STAT_TXF_FLUSH | \ |
| 106 SPI_STAT_RXF_UNR | SPI_STAT_TXF_OVF; | 108 SPI_STAT_RXF_UNR | SPI_STAT_TXF_OVF; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 spi->status = status; /* ACK RDY, etc. bits */ | 333 spi->status = status; /* ACK RDY, etc. bits */ |
| 332 } | 334 } |
| 333 | 335 |
| 334 if (flags & SPI_XFER_END) | 336 if (flags & SPI_XFER_END) |
| 335 spi_cs_deactivate(slave); | 337 spi_cs_deactivate(slave); |
| 336 | 338 |
| 337 debug("spi_xfer: transfer ended. Value=%08x, status = %08x\n", | 339 debug("spi_xfer: transfer ended. Value=%08x, status = %08x\n", |
| 338 tmpdin, status); | 340 tmpdin, status); |
| 339 return ret; | 341 return ret; |
| 340 } | 342 } |
| OLD | NEW |