Freescale 85xx/P1/P2 eSPI controller driver
PATCH v2 1/1 Freescale 85xx/P1/P2 eSPI controller driver
Driver for the Freescale eSPI controller found in 85xx, P1/P2 and P4xx SoCs.
---
Changes for v2:
- Coding style cleanup
- Removed modifications to common code
drivers/spi/Makefile | 1 + drivers/spi/fsl_espi.c | 256 +++++++++++++++++++++++++++++++++++++++++++ include/configs/P1_P2_RDB.h | 7 + include/fsl_espi.h | 50 +++++++++ 4 files changed, 314 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/fsl_espi.c create mode 100644 include/fsl_espi.h
drivers/spi/Makefile +1 -0
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o COBJS-$(CONFIG_CF_SPI) += cf_spi.o COBJS-$(CONFIG_DAVINCI_SPI) += davinci_spi.o +COBJS-$(CONFIG_FSL_ESPI) += fsl_espi.o COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o COBJS-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
drivers/spi/fsl_espi.c new file +256 -0
256 lines not on this page · raw message
include/configs/P1_P2_RDB.h +7 -0
@@ -172,6 +172,13 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);*/ /* +* eSPI - Enhanced SPI +*/ +#define CONFIG_FSL_ESPI +#define CONFIG_HARD_SPI +#define CONFIG_CMD_SPI + +/* * Local Bus Definitions */ #define CONFIG_SYS_FLASH_BASE 0xef000000/* start of FLASH 16M */
include/fsl_espi.h new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v2 1/1 Freescale 85xx/P1/P2 eSPI controller driver
Dear Can Aydin,
Quoted 1 line · In message <[email protected]> you…
Driver for the Freescale eSPI controller found in 85xx, P1/P2 and P4xx SoCs.
...
drivers/spi/fsl_espi.c line 112
Quoted 10 lines
drivers/spi/fsl_espi.c new file +10
-0+static inline void write_u32_part (u32 * in,u32 * out,u8 size) +{ +int i; +u8 *ibyte = (u8 *) in; +u8 *obyte = (u8 *) out; + +for (i =0 ; i < size; i++) { + obyte[i] = ibyte[i]; + } +}
What is this cunction needed for? Can you not use a plain memcpy() instead?
If not, is it really sufficient you use plain memory read/write operations here, without any MBs or similar (i. e. are you sure that no I/O accessors are needed here) ?
+
drivers/spi/fsl_espi.c line 137
Quoted 4 lines
drivers/spi/fsl_espi.c new file +4
-0+if (len >ESPI_MAX_TRANLEN ) { +debug + ("spi_xfer: Transfer length (%u) too long, max is %u(0x%X)\n" , + len,ESPI_MAX_TRANLEN ,ESPI_MAX_TRANLEN );
Indentation by TAB, please. And join the "debug" and "(..." lines splitting the string, if it cannot be made shorter).
drivers/spi/fsl_espi.c line 145
Quoted 3 lines
drivers/spi/fsl_espi.c new file +3
-0+debug ("spi_xfer: slave %u:%u dout %08X(%08x) din %08X(%08x) len %u\n" , + slave->bus, slave->cs, + *(uint *) dout, (uint ) dout, *(uint *) din, (uint ) din, len);
Please globally fix your paren style. There is no space between function (or macro) name and paren.
drivers/spi/fsl_espi.c line 177
Quoted 7 lines
drivers/spi/fsl_espi.c new file +7
-0+ }else if (ESPI_EV_GET_TXCNT (event) >= txcount) { +/* Less than a word left and room to put it */ + tmpdout =0 ; +/* Avoid dout buffer read overflow */ +write_u32_part ((u32 *) dout, &tmpdout, + txcount); +//tmpdout = *(u32 *)dout;
Please do not add dead code. C++ comments ar4 not allowed either. Fix globally, please.
include/configs/P1_P2_RDB.h extern unsigned long get_board_sys_clk(unsigned long dummy); · line 179
Quoted 13 lines
include/configs/P1_P2_RDB.h +5
-0@@ -172,6 +172,13 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);*/ /* +* eSPI - Enhanced SPI +*/ +#define CONFIG_FSL_ESPI +#define CONFIG_HARD_SPI +#define CONFIG_CMD_SPI
Please split into several commits: first adding the driver, the next one(s) changing board configuration(s) to use that driver.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Boykottiert Microsoft - Kauft Eure Fenster bei OBI!
PATCH v2 1/1 Freescale 85xx/P1/P2 eSPI controller driver
Dear Wolfgang Denk,
Quoted 18 lines · Wolfgang Denk
Dear Can Aydin,
Quoted 1 line · In message<[email protected]> you…
Driver for the Freescale eSPI controller found in 85xx, P1/P2 and P4xx SoCs.
...
drivers/spi/fsl_espi.c line 112
Quoted 10 lines
drivers/spi/fsl_espi.c new file +10
-0+static inline void write_u32_part (u32 * in,u32 * out,u8 size) +{ +int i; +u8 *ibyte = (u8 *) in; +u8 *obyte = (u8 *) out; + +for (i =0 ; i< size; i++) { + obyte[i] = ibyte[i]; + } +}What is this cunction needed for? Can you not use a plain
memcpy()instead?
Quoted 3 lines
If not, is it really sufficient you use plain memory read/write operations here, without any MBs or similar (i. e. are you sure that no I/O accessors are needed here) ?
Yes a plain memcpy would suffice there, that function was actually a leftover of some test code. I'll fix that and incorporate the other comments.
Regards,
Can Aydin