mpc52xx: Add SPI driver.
PATCH v3 1/4 mpc52xx: Add SPI driver.
---
v2:
- use accessor macros
v3:
- use proper accessor macros
drivers/spi/Makefile | 1 + drivers/spi/mpc52xx_spi.c | 109 +++++++++++++++++++++++++++++++++++++++++++++ include/mpc5xxx.h | 18 +++++++ 3 files changed, 128 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/mpc52xx_spi.c
drivers/spi/Makefile +1 -0
@@ -28,6 +28,7 @@ LIB := $(obj)libspi.a COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o +COBJS-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
drivers/spi/mpc52xx_spi.c new file +109 -0
109 lines not on this page · raw message
include/mpc5xxx.h +18 -0
@@ -392,6 +392,24 @@#define I2C_IF 0x02#define I2C_RXAK 0x01 +/* SPI control register 1 bits */ +#define SPI_CR_LSBFE 0x01 +#define SPI_CR_SSOE 0x02 +#define SPI_CR_CPHA 0x04 +#define SPI_CR_CPOL 0x08 +#define SPI_CR_MSTR 0x10 +#define SPI_CR_SWOM 0x20 +#define SPI_CR_SPE 0x40 +#define SPI_CR_SPIE 0x80 + +/* SPI status register bits */ +#define SPI_SR_MODF 0x10 +#define SPI_SR_WCOL 0x40 +#define SPI_SR_SPIF 0x80 + +/* SPI port data register bits */ +#define SPI_PDR_SS 0x08 +/* Programmable Serial Controller (PSC) status register bits */ #define PSC_SR_CDE 0x0080#define PSC_SR_RXRDY 0x0100
Signature · 1 line
1.6.0.6
PATCH v3 2/4 digsy MTC: Add SPI support.
---
v2:
- use accessor macros
v3:
- remove unnecessary GPIO initialization
board/digsy_mtc/digsy_mtc.c | 10 ++++++++++ include/configs/digsy_mtc.h | 7 +++++++ 2 files changed, 17 insertions(+), 0 deletions(-)
board/digsy_mtc/digsy_mtc.c +10 -0
@@ -186,6 +186,9 @@ int checkboard(void)int board_early_init_r (void ) { +#ifdef CONFIG_MPC52XX_SPI +struct mpc5xxx_gpt *gpt = (struct mpc5xxx_gpt *)MPC5XXX_GPT ; +#endif /* * Now, when we are in RAM, enable flash write access for detection * process. Note that CS_BOOT cannot be cleared when executing in
@@ -202,6 +205,13 @@ int board_early_init_r(void)/* Low level USB init, required for proper kernel operation */ usb_cpu_init ();#endif +#ifdef CONFIG_MPC52XX_SPI +/* GPT 6 Output Enable */ +out_be32 (&gpt[6 ].emsr,0x00000034 ); +/* GPT 7 Output Enable */ +out_be32 (&gpt[7 ].emsr,0x00000034 ); +#endif +return (0 ); }
include/configs/digsy_mtc.h +7 -0
@@ -100,6 +100,7 @@#define CONFIG_CMD_PING #define CONFIG_CMD_REGINFO #define CONFIG_CMD_SAVES +#define CONFIG_CMD_SPI #define CONFIG_CMD_USB #if (TEXT_BASE ==0xFF000000 )
@@ -137,6 +138,12 @@ ""/* +* SPI configuration +*/ +#define CONFIG_HARD_SPI 1 +#define CONFIG_MPC52XX_SPI 1 + +/* * I2C configuration */ #define CONFIG_HARD_I2C 1
Signature · 1 line
1.6.0.6
PATCH v3 2/4 digsy MTC: Add SPI support.
Dear Grzegorz Bernacki,
Quoted 11 lines · In message <[email protected]> you wrote:
Signed-off-by Grzegorz Bernacki <[email protected]>---
v2:
- use accessor macros
v3:
- remove unnecessary GPIO initializationboard/digsy_mtc/digsy_mtc.c | 10 ++++++++++ include/configs/digsy_mtc.h | 7 +++++++ 2 files changed, 17 insertions(+), 0 deletions(-)
Applied to u-boot-mpc5xxx, thanks.
Best regards,
Wolfgang Denk
Signature · 5 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 "The X11 source code style is ATROCIOUS and should not be used as a model." - Doug Gwyn
PATCH v3 3/4 digsy MTC: Add 'mtc' command.
In reply to Grzegorz Bernacki New command allows to:
o check FW version
o set LED status
o set digital output status
o get digital input status
---
v2:
- implement sub-commands via U_BOOT_CMD_MKENT macro
board/digsy_mtc/Makefile | 2 +- board/digsy_mtc/cmd_mtc.c | 350 +++++++++++++++++++++++++++++++++++++++++++ board/digsy_mtc/cmd_mtc.h | 60 ++++++++ board/digsy_mtc/digsy_mtc.c | 2 + 4 files changed, 413 insertions(+), 1 deletions(-) create mode 100644 board/digsy_mtc/cmd_mtc.c create mode 100644 board/digsy_mtc/cmd_mtc.h
board/digsy_mtc/Makefile +1 -1
@@ -7,7 +7,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o +COBJS := $(BOARD).o cmd_mtc.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
board/digsy_mtc/cmd_mtc.c new file +350 -0
350 lines not on this page · raw message
board/digsy_mtc/cmd_mtc.h new file +60 -0
60 lines not on this page · raw message
board/digsy_mtc/digsy_mtc.c +2 -0
@@ -240,6 +240,7 @@ void board_get_enetaddr (uchar * enet)int misc_init_r (void ) { +extern int mtc_cmd_init_r (void );uchar enetaddr[6 ];if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) {
@@ -247,6 +248,7 @@ int misc_init_r(void)eth_setenv_enetaddr ("ethaddr" , enetaddr); } +mtc_cmd_init_r ();return 0 ; }
Signature · 1 line
1.6.0.6
PATCH v3 3/4 digsy MTC: Add 'mtc' command.
Dear Grzegorz Bernacki,
Quoted 11 lines · In message <[email protected]> you wrote:
New command allows to:
o check FW version
o set LED status
o set digital output status
o get digital input statusSigned-off-by Grzegorz Bernacki <[email protected]>---
v2:
- implement sub-commands viaU_BOOT_CMD_MKENTmacro
Quoted 7 lines
board/digsy_mtc/Makefile | 2 +- board/digsy_mtc/cmd_mtc.c | 350 +++++++++++++++++++++++++++++++++++++++++++ board/digsy_mtc/cmd_mtc.h | 60 ++++++++ board/digsy_mtc/digsy_mtc.c | 2 + 4 files changed, 413 insertions(+), 1 deletions(-) create mode 100644 board/digsy_mtc/cmd_mtc.c create mode 100644 board/digsy_mtc/cmd_mtc.h
Applied to u-boot-mpc5xxx, thanks.
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 Brain fried - Core dumped
PATCH v3 4/4 digsy mtc: Add description to GPIO initial configuration.
In reply to Grzegorz Bernacki--- include/configs/digsy_mtc.h | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
include/configs/digsy_mtc.h +16 -0
@@ -248,6 +248,22 @@/* * GPIO configuration +* use pin gpio_wkup_6 as second SDRAM chip select (mem_cs1) +* Bit 0 (mask 0x80000000) : 0x1 +* SPI on Tmr2/3/4/5 pins +* Bit 2:3 (mask 0x30000000) : 0x2 +* ATA cs0/1 on csb_4/5 +* Bit 6:7 (mask 0x03000000) : 0x2 +* Ethernet 100Mbit with MD +* Bits 12:15 (mask 0x000f0000): 0x5 +* USB - Two UARTs +* Bits 18:19 (mask 0x00003000) : 0x2 +* PSC3 - USB2 on PSC3 +* Bits 20:23 (mask 0x00000f00) : 0x1 +* PSC2 - CAN1&2 on PSC2 pins +* Bits 25:27 (mask 0x00000070) : 0x1 +* PSC1 - AC97 functionality +* Bits 29:31 (mask 0x00000007) : 0x2 */ #define CONFIG_SYS_GPS_PORT_CONFIG 0xA2552112
Signature · 1 line
1.6.0.6
PATCH v3 4/4 digsy mtc: Add description to GPIO initial configuration.
Dear Grzegorz Bernacki,
Quoted 5 lines · In message <[email protected]> you wrote:
Signed-off-by Grzegorz Bernacki <[email protected]>--- include/configs/digsy_mtc.h | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
Applied to u-boot-mpc5xxx, thanks.
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 Be kind to unkind people - they need it the most.
PATCH v3 1/4 mpc52xx: Add SPI driver.
In reply to Grzegorz BernackiDear Grzegorz Bernacki,
Quoted 8 lines · In message <[email protected]> you wrote:
Signed-off-by Grzegorz Bernacki <[email protected]>---
v2:
- use accessor macros
v3:
- use proper accessor macros
Quoted 5 lines
drivers/spi/Makefile | 1 + drivers/spi/mpc52xx_spi.c | 109 +++++++++++++++++++++++++++++++++++++++++++++ include/mpc5xxx.h | 18 +++++++ 3 files changed, 128 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/mpc52xx_spi.c
Applied to u-boot-mpc5xxx, thanks.
Best regards,
Wolfgang Denk
Signature · 6 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
Unix is like a toll road on which you have to stop every 50 feet to
pay another nickel. But hey! You only feel 5 cents poorer each time.
- Larry Wall in <[email protected]>