implement software SPI
PATCH 1/1 implement software SPI
This patch implements software SPI for the universal C210 board. SPI is used to configure video driver.
Piotr Wilczek (1):
arm:exynos4:universal_c210: implement software SPI
board/samsung/universal_c210/universal.c | 36 ++++++++++++++++++++++++++++++ drivers/spi/soft_spi.c | 7 +++++- include/configs/s5pc210_universal.h | 19 +++++++++++++++ 3 files changed, 61 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/1 arm:exynos4:universal_c210: implement software SPI
This patch implements software SPI for the universal C210 board.
--- board/samsung/universal_c210/universal.c | 36 ++++++++++++++++++++++++++++++ drivers/spi/soft_spi.c | 7 +++++- include/configs/s5pc210_universal.h | 19 +++++++++++++++ 3 files changed, 61 insertions(+), 1 deletions(-)
board/samsung/universal_c210/universal.c +36 -0
@@ -24,6 +24,7 @@#include <common.h> #include <asm/io.h> +#include <spi.h> #include <asm/arch/adc.h> #include <asm/arch/gpio.h> #include <asm/arch/mmc.h>
@@ -34,6 +35,10 @@#include <max8998_pmic.h> #include <asm/arch/watchdog.h> +#if defined(CONFIG_SOFT_SPI ) +# include <asm/gpio.h> +#endif +DECLARE_GLOBAL_DATA_PTR ;struct exynos4_gpio_part1 *gpio1;
@@ -288,3 +293,34 @@ int board_early_init_f(void)return 0 ; } + +void soft_spi_init () +{ +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_SCLK , +CONFIG_SOFT_SPI_MODE &SPI_CPOL ); +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_MOSI ,1 ); +gpio_direction_input (CONFIG_SOFT_SPI_GPIO_MISO ); +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +} + +void spi_cs_activate (struct spi_slave *slave) +{ +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +SPI_SCL (1 ); +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , +CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH ); +} + +void spi_cs_deactivate (struct spi_slave *slave) +{ +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +} + +int spi_cs_is_valid (unsigned int bus,unsigned int cs) +{ +return 1 ; +} +
drivers/spi/soft_spi.c +6 -1
@@ -29,6 +29,10 @@#include <malloc.h> +#if defined(CONFIG_SOFT_SPI ) +# include <asm/gpio.h> +#endif +/*----------------------------------------------------------------------- * Definitions */
@@ -59,8 +63,9 @@ static inline struct soft_spi_slave *to_soft_spi(struct spi_slave *slave)void spi_init (void ) {#ifdef SPI_INIT +#ifdef CONFIG_SYS_IMMR volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ; - +#endif SPI_INIT ;#endif }
include/configs/s5pc210_universal.h +19 -0
@@ -266,4 +266,23 @@#define CONFIG_USB_GADGET_S3C_UDC_OTG #define CONFIG_USB_GADGET_DUALSPEED +/* +* SPI Settings +*/ +#define CONFIG_SOFT_SPI +#define CONFIG_SOFT_SPI_MODE SPI_MODE_3 +#define CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_part2_get_nr(y3, 1) +#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_part2_get_nr(y3, 3) +#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_part2_get_nr(y3, 0) +#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_part2_get_nr(y4, 3) + +#define SPI_DELAY udelay(1) +#define SPI_INIT soft_spi_init() +#define SPI_SCL (bit) gpio_set_value(CONFIG_SOFT_SPI_GPIO_SCLK, bit) +#define SPI_SDA (bit) gpio_set_value(CONFIG_SOFT_SPI_GPIO_MOSI, bit) +#define SPI_READ gpio_get_value(CONFIG_SOFT_SPI_GPIO_MISO) +#ifndef __ASSEMBLY__ +void soft_spi_init (void ); +#endif +#endif /* __CONFIG_H */
Signature · 1 line
1.7.5.4
PATCH 1/1 arm:exynos4:universal_c210: implement software SPI
Dear Piotr,
Quoted 26 lines · Piotr Wilczek
This patch implements software SPI for the universal C210 board.
Signed-off-by Piotr Wilczek <[email protected]>Signed-off-by Kyungmin Park <[email protected]>CC Minkyu Kang <[email protected]>CC Wolfgang Denk <[email protected]>CC Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- board/samsung/universal_c210/universal.c | 36 ++++++++++++++++++++++++++++++ drivers/spi/soft_spi.c | 7 +++++- include/configs/s5pc210_universal.h | 19 +++++++++++++++ 3 files changed, 61 insertions(+), 1 deletions(-)board/samsung/universal_c210/universal.c +1
-0@@ -24,6 +24,7 @@#include <common.h> #include <asm/io.h> +#include <spi.h> #include <asm/arch/adc.h> #include <asm/arch/gpio.h> #include <asm/arch/mmc.h>
board/samsung/universal_c210/universal.c line 39
Quoted 5 lines
board/samsung/universal_c210/universal.c +2
-0@@ -34,6 +35,10 @@#include <max8998_pmic.h> #include <asm/arch/watchdog.h> +#if defined(CONFIG_SOFT_SPI ) +# include <asm/gpio.h>
remove space between # and include.
Quoted 28 lines
board/samsung/universal_c210/universal.c +21
-0+#endif +DECLARE_GLOBAL_DATA_PTR ;struct exynos4_gpio_part1 *gpio1;@@ -288,3 +293,34 @@ int board_early_init_f(void)return 0 ; } + +void soft_spi_init () +{ +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_SCLK , +CONFIG_SOFT_SPI_MODE &SPI_CPOL ); +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_MOSI ,1 ); +gpio_direction_input (CONFIG_SOFT_SPI_GPIO_MISO ); +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +} + +void spi_cs_activate (struct spi_slave *slave) +{ +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +SPI_SCL (1 ); +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , +CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH ); +}
board/samsung/universal_c210/universal.c int board_early_init_f(void) · line 324
Quoted 10 lines
board/samsung/universal_c210/universal.c +10
-0+ +void spi_cs_deactivate (struct spi_slave *slave) +{ +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +} + +int spi_cs_is_valid (unsigned int bus,unsigned int cs) +{ +return 1 ;
always return 1?
Quoted 18 lines
board/samsung/universal_c210/universal.c +2
-0+} +drivers/spi/soft_spi.c +4
-0@@ -29,6 +29,10 @@#include <malloc.h> +#if defined(CONFIG_SOFT_SPI ) +# include <asm/gpio.h> +#endif +/*----------------------------------------------------------------------- * Definitions */
drivers/spi/soft_spi.c static inline struct soft_spi_slave *to_soft_spi(struct spi_slave *slave) · line 68
Quoted 7 lines
drivers/spi/soft_spi.c +2
-1@@ -59,8 +63,9 @@ static inline struct soft_spi_slave *to_soft_spi(struct spi_slave *slave)void spi_init (void ) {#ifdef SPI_INIT +#ifdef CONFIG_SYS_IMMR volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ; - +#endif
Is it related change with this patch?
Quoted 32 lines
drivers/spi/soft_spi.c +0
-0SPI_INIT ;#endif }include/configs/s5pc210_universal.h +19
-1@@ -266,4 +266,23 @@#define CONFIG_USB_GADGET_S3C_UDC_OTG #define CONFIG_USB_GADGET_DUALSPEED +/* +* SPI Settings +*/ +#define CONFIG_SOFT_SPI +#define CONFIG_SOFT_SPI_MODE SPI_MODE_3 +#define CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_part2_get_nr(y3, 1) +#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_part2_get_nr(y3, 3) +#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_part2_get_nr(y3, 0) +#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_part2_get_nr(y4, 3) + +#define SPI_DELAY udelay(1) +#define SPI_INIT soft_spi_init() +#define SPI_SCL (bit) gpio_set_value(CONFIG_SOFT_SPI_GPIO_SCLK, bit) +#define SPI_SDA (bit) gpio_set_value(CONFIG_SOFT_SPI_GPIO_MOSI, bit) +#define SPI_READ gpio_get_value(CONFIG_SOFT_SPI_GPIO_MISO) +#ifndef __ASSEMBLY__ +void soft_spi_init (void ); +#endif +#endif /* __CONFIG_H */ --
Quoted 1 line
1.7.5.4
Thanks.
Minkyu Kang.
Signature · 2 lines
from. prom. www.promsoft.net
PATCH 1/1 arm:exynos4:universal_c210: implement software SPI
Dear Minkyu,
Quoted 42 lines
-----Original Message-----
From: Minkyu Kang [mailto:promsoft at gmail.com]
Sent: Saturday, September 15, 2012 11:06 AM
To: Piotr Wilczek
Cc: u-boot at lists.denx.de; Kyungmin Park
Subject: Re: [U-Boot] [PATCH] arm:exynos4:universal_c210: implement software SPIDear Piotr,
Quoted 9 lines · Piotr Wilczek
This patch implements software SPI for the universal C210 board.
Signed-off-by Piotr Wilczek <[email protected]>Signed-off-by Kyungmin Park <[email protected]>CC Minkyu Kang <[email protected]>CC Wolfgang Denk <[email protected]>CC Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- board/samsung/universal_c210/universal.c | 36++++++++++++++++++++++++++++++
Quoted 21 lines
drivers/spi/soft_spi.c | 7 +++++- include/configs/s5pc210_universal.h | 19 +++++++++++++++ 3 files changed, 61 insertions(+), 1 deletions(-)board/samsung/universal_c210/universal.c +1
-0@@ -24,6 +24,7 @@#include <common.h> #include <asm/io.h> +#include <spi.h> #include <asm/arch/adc.h> #include <asm/arch/gpio.h> #include <asm/arch/mmc.h> @@ -34,6 +35,10 @@#include <max8998_pmic.h> #include <asm/arch/watchdog.h>
Quoted 4 lines
board/samsung/universal_c210/universal.c line 39
Quoted 2 lines
board/samsung/universal_c210/universal.c +2
-0+#if defined(CONFIG_SOFT_SPI ) +# include <asm/gpio.h> remove space between # and include.
Ok.
Quoted 27 lines
Quoted 27 lines
board/samsung/universal_c210/universal.c +19
-0+#endif +DECLARE_GLOBAL_DATA_PTR ;struct exynos4_gpio_part1 *gpio1;@@ -288,3 +293,34 @@ int board_early_init_f(void)return 0 ; } + +void soft_spi_init () +{ +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_SCLK , +CONFIG_SOFT_SPI_MODE &SPI_CPOL ); +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_MOSI ,1 ); +gpio_direction_input (CONFIG_SOFT_SPI_GPIO_MISO ); +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); } + +void spi_cs_activate (struct spi_slave *slave) { +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +SPI_SCL (1 ); +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , +CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH ); } +
Quoted 8 lines
board/samsung/universal_c210/universal.c int board_early_init_f(void) · line 324
Quoted 6 lines
board/samsung/universal_c210/universal.c +6
-0+void spi_cs_deactivate (struct spi_slave *slave) { +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); } + +int spi_cs_is_valid (unsigned int bus,unsigned int cs) { +return 1 ;always return 1?
I can change that it would return 1 only if bus==0 and cs==0.
Quoted 22 lines
Quoted 8 lines
board/samsung/universal_c210/universal.c +2
-0+} +drivers/spi/soft_spi.c index renamed from drivers/spi/soft_spi.c +0
-013df8cb..a0a3012 100644
drivers/spi/soft_spi.c line 36
Quoted 8 lines
drivers/spi/soft_spi.c +4
-0@@ -29,6 +29,10 @@#include <malloc.h> +#if defined(CONFIG_SOFT_SPI ) +# include <asm/gpio.h> +#endif +/*------------------------------------------------------------------ -----
drivers/spi/soft_spi.c static inline struct soft_spi_slave · line 63
Quoted 4 lines
drivers/spi/soft_spi.c +0
-0* Definitions */ @@ -59,8 +63,9 @@ static inline struct soft_spi_slave *to_soft_spi(struct spi_slave *slave) void spi_init (void) {#ifdef
Quoted 7 lines
drivers/spi/soft_spi.c static inline struct soft_spi_slave *to_soft_spi(struct spi_slave *slave) · line 68
Quoted 5 lines
SPI_INITdrivers/spi/soft_spi.c +2
-1+#ifdef CONFIG_SYS_IMMR volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ; - +#endif Is it related change with this patch?
Yes, it is necessary to successfully compile.
Quoted 33 lines
Quoted 33 lines
SPI_INIT;#endif
}include/configs/s5pc210_universal.h +0
-0@@ -266,4 +266,23 @@#define CONFIG_USB_GADGET_S3C_UDC_OTG #define
CONFIG_USB_GADGET_DUALSPEEDinclude/configs/s5pc210_universal.h +19
-0+/* +* SPI Settings +*/ +#define CONFIG_SOFT_SPI +#define CONFIG_SOFT_SPI_MODE SPI_MODE_3 #define +CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_part2_get_nr(y3, 1) #define +CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_part2_get_nr(y3, 3) #define +CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_part2_get_nr(y3, 0) #define +CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_part2_get_nr(y4, 3) + +#define SPI_DELAY udelay(1) +#define SPI_INIT soft_spi_init() +#define SPI_SCL(bit) gpio_set_value(CONFIG_SOFT_SPI_GPIO_SCLK, bit) +#define SPI_SDA(bit) gpio_set_value(CONFIG_SOFT_SPI_GPIO_MOSI, bit) +#define SPI_READ gpio_get_value(CONFIG_SOFT_SPI_GPIO_MISO) +#ifndef __ASSEMBLY__ +void soft_spi_init(void); +#endif +#endif /* __CONFIG_H */
Quoted 8 lines
Quoted 2 lines
--
1.7.5.4Thanks.
Minkyu Kang.
--
from. prom.
www.promsoft.net
Best regards,
Piotr Wilczek
PATCH v2 1/1 implement software SPI
In reply to Piotr WilczekThis patch implements software SPI for the universal C210 board. SPI is used to configure video driver.
Changes in v2:
- removed space between # and include;
- changed return in spi_cs_is_valid function;
Piotr Wilczek (1):
arm:exynos4:universal_c210: implement software SPI
board/samsung/universal_c210/universal.c | 35 ++++++++++++++++++++++++++++++ drivers/spi/soft_spi.c | 7 +++++- include/configs/s5pc210_universal.h | 19 ++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.5.4
PATCH v2 1/1 arm:exynos4:universal_c210: implement software SPI
This patch implements software SPI for the universal C210 board.
---
Changes in v2:
- removed space between # and include;
- changed return in spi_cs_is_valid function;
board/samsung/universal_c210/universal.c | 35 ++++++++++++++++++++++++++++++ drivers/spi/soft_spi.c | 7 +++++- include/configs/s5pc210_universal.h | 19 ++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletions(-)
board/samsung/universal_c210/universal.c +35 -0
@@ -24,6 +24,7 @@#include <common.h> #include <asm/io.h> +#include <spi.h> #include <asm/arch/adc.h> #include <asm/arch/gpio.h> #include <asm/arch/mmc.h>
@@ -33,6 +34,9 @@#include <asm/arch/cpu.h> #include <max8998_pmic.h> #include <asm/arch/watchdog.h> +#if defined(CONFIG_SOFT_SPI ) +# include <asm/gpio.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -284,3 +288,34 @@ int board_early_init_f(void)return 0 ; } + +void soft_spi_init () +{ +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_SCLK , +CONFIG_SOFT_SPI_MODE &SPI_CPOL ); +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_MOSI ,1 ); +gpio_direction_input (CONFIG_SOFT_SPI_GPIO_MISO ); +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +} + +void spi_cs_activate (struct spi_slave *slave) +{ +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +SPI_SCL (1 ); +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , +CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH ); +} + +void spi_cs_deactivate (struct spi_slave *slave) +{ +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +} + +int spi_cs_is_valid (unsigned int bus,unsigned int cs) +{ +return bus ==0 && cs ==0 ; +} +
drivers/spi/soft_spi.c +6 -1
@@ -29,6 +29,10 @@#include <malloc.h> +#if defined(CONFIG_SOFT_SPI ) +# include <asm/gpio.h> +#endif +/*----------------------------------------------------------------------- * Definitions */
@@ -59,8 +63,9 @@ static inline struct soft_spi_slave *to_soft_spi(struct spi_slave *slave)void spi_init (void ) {#ifdef SPI_INIT +#ifdef CONFIG_SYS_IMMR volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ; - +#endif SPI_INIT ;#endif }
include/configs/s5pc210_universal.h +19 -0
@@ -264,4 +264,23 @@#define CONFIG_USB_GADGET_S3C_UDC_OTG #define CONFIG_USB_GADGET_DUALSPEED +/* +* SPI Settings +*/ +#define CONFIG_SOFT_SPI +#define CONFIG_SOFT_SPI_MODE SPI_MODE_3 +#define CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_part2_get_nr(y3, 1) +#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_part2_get_nr(y3, 3) +#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_part2_get_nr(y3, 0) +#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_part2_get_nr(y4, 3) + +#define SPI_DELAY udelay(1) +#define SPI_INIT soft_spi_init() +#define SPI_SCL (bit) gpio_set_value(CONFIG_SOFT_SPI_GPIO_SCLK, bit) +#define SPI_SDA (bit) gpio_set_value(CONFIG_SOFT_SPI_GPIO_MOSI, bit) +#define SPI_READ gpio_get_value(CONFIG_SOFT_SPI_GPIO_MISO) +#ifndef __ASSEMBLY__ +void soft_spi_init (void ); +#endif +#endif /* __CONFIG_H */
Signature · 1 line
1.7.5.4
v3 cover Exynos4: add software SPI support on Universal C210 board
This patchset add software SPI support on Samsung Universal C210 board. In SPI software driver #ifdef CONFIG_SYS_IMMR in spi_init function is added.
Changes in v2:
- removed space between # and include;
- changed return in spi_cs_is_valid function;
Changes in v3:
- Patch is split in two patches:
- the first modifies software SPI driver;
- the second patch add support for SPI on Universal C210 board
Piotr Wilczek (2):
drivers: spi: modify soft spi driver
exynos4: universal_C210: use software SPI
board/samsung/universal_c210/universal.c | 34 ++++++++++++++++++++++++++++++ drivers/spi/soft_spi.c | 3 ++ include/configs/s5pc210_universal.h | 19 ++++++++++++++++ 3 files changed, 56 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.5.4
PATCH v3 1/2 drivers: spi: modify soft spi driver
This patch add #ifdef CONFIG_SYS_IMMR in spi_init function
---
Changes in v2:
- removed space between # and include;
- changed return in spi_cs_is_valid function;
Changes in v3:
- New patch from splited v2:
drivers/spi/soft_spi.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/spi/soft_spi.c +3 -0
@@ -26,6 +26,7 @@#include <common.h> #include <spi.h> +#include <asm/gpio.h> #include <malloc.h>
@@ -59,7 +60,9 @@ static inline struct soft_spi_slave *to_soft_spi(struct spi_slave *slave)void spi_init (void ) {#ifdef SPI_INIT +#ifdef CONFIG_SYS_IMMR volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ; +#endif SPI_INIT ;#endif
Signature · 1 line
1.7.5.4
PATCH v3 2/2 exynos4: universal_C210: use software SPI
In reply to Piotr WilczekThis patch use software spi on Samsung Universal C210 board.
---
Changes in v2:
- removed space between # and include;
- changed return in spi_cs_is_valid function;
Changes in v3:
- New patch from splited v2:
board/samsung/universal_c210/universal.c | 34 ++++++++++++++++++++++++++++++ include/configs/s5pc210_universal.h | 19 ++++++++++++++++ 2 files changed, 53 insertions(+), 0 deletions(-)
board/samsung/universal_c210/universal.c +34 -0
@@ -23,7 +23,9 @@*/ #include <common.h> +#include <spi.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/arch/adc.h> #include <asm/arch/gpio.h> #include <asm/arch/mmc.h>
@@ -284,3 +286,35 @@ int board_early_init_f(void)return 0 ; } + +#ifdef CONFIG_SOFT_SPI +void soft_spi_init () +{ +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_SCLK , +CONFIG_SOFT_SPI_MODE &SPI_CPOL ); +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_MOSI ,1 ); +gpio_direction_input (CONFIG_SOFT_SPI_GPIO_MISO ); +gpio_direction_output (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +} + +void spi_cs_activate (struct spi_slave *slave) +{ +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +SPI_SCL (1 ); +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , +CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH ); +} + +void spi_cs_deactivate (struct spi_slave *slave) +{ +gpio_set_value (CONFIG_SOFT_SPI_GPIO_CS , + !(CONFIG_SOFT_SPI_MODE &SPI_CS_HIGH )); +} + +int spi_cs_is_valid (unsigned int bus,unsigned int cs) +{ +return bus ==0 && cs ==0 ; +} +#endif
include/configs/s5pc210_universal.h +19 -0
@@ -264,4 +264,23 @@#define CONFIG_USB_GADGET_S3C_UDC_OTG #define CONFIG_USB_GADGET_DUALSPEED +/* +* SPI Settings +*/ +#define CONFIG_SOFT_SPI +#define CONFIG_SOFT_SPI_MODE SPI_MODE_3 +#define CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_part2_get_nr(y3, 1) +#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_part2_get_nr(y3, 3) +#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_part2_get_nr(y3, 0) +#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_part2_get_nr(y4, 3) + +#define SPI_DELAY udelay(1) +#define SPI_INIT soft_spi_init() +#define SPI_SCL (bit) gpio_set_value(CONFIG_SOFT_SPI_GPIO_SCLK, bit) +#define SPI_SDA (bit) gpio_set_value(CONFIG_SOFT_SPI_GPIO_MOSI, bit) +#define SPI_READ gpio_get_value(CONFIG_SOFT_SPI_GPIO_MISO) +#ifndef __ASSEMBLY__ +void soft_spi_init (void ); +#endif +#endif /* __CONFIG_H */
Signature · 1 line
1.7.5.4
v3 cover Exynos4: add software SPI support on Universal C210 board
In reply to Piotr WilczekDear Piotr Wilczek,
Quoted 11 lines · Piotr Wilczek
This patchset add software SPI support on Samsung Universal C210 board. In SPI software driver #ifdef
CONFIG_SYS_IMMRinspi_initfunction is added.Changes in v2:
- removed space between # and include;
- changed return inspi_cs_is_validfunction;
Changes in v3:
- Patch is split in two patches:
- the first modifies software SPI driver;
- the second patch add support for SPI on Universal C210 board
Quoted 9 lines
Piotr Wilczek (2):
drivers: spi: modify soft spi driver
exynos4:universal_C210: use software SPIboard/samsung/universal_c210/universal.c | 34 ++++++++++++++++++++++++++++++ drivers/spi/soft_spi.c | 3 ++ include/configs/s5pc210_universal.h | 19 ++++++++++++++++ 3 files changed, 56 insertions(+), 0 deletions(-)
applied to u-boot-samsung.
Thanks.
Minkyu Kang.
Signature · 2 lines
from. prom. www.promsoft.net
v3 cover Exynos4: add software SPI support on Universal C210 board
Quoted 18 lines · Minkyu Kang
Dear Piotr Wilczek,
Quoted 15 lines · Piotr Wilczek
This patchset add software SPI support on Samsung Universal C210 board. In SPI software driver #ifdef
CONFIG_SYS_IMMRinspi_initfunction is added.Changes in v2:
- removed space between # and include;
- changed return inspi_cs_is_validfunction;
Changes in v3:
- Patch is split in two patches:
- the first modifies software SPI driver;
- the second patch add support for SPI on Universal C210 boardPiotr Wilczek (2):
drivers: spi: modify soft spi driver
exynos4:universal_C210: use software SPI
Quoted 8 lines
Quoted 5 lines
board/samsung/universal_c210/universal.c | 34 ++++++++++++++++++++++++++++++ drivers/spi/soft_spi.c | 3 ++ include/configs/s5pc210_universal.h | 19 ++++++++++++++++ 3 files changed, 56 insertions(+), 0 deletions(-)applied to u-boot-samsung.
This patchset was reverted.
Thanks.
Minkyu Kang.
Signature · 2 lines
from. prom. www.promsoft.net
PATCH v2 1/1 implement software SPI
In reply to Piotr WilczekDear Piotr Wilczek,
Quoted 2 lines · In message <[email protected]> you wrote:
This patch implements software SPI for the universal C210 board. SPI is used to configure video driver.
Can you please adjust the Subject: to make clear that this is some C210 board specific code? Because we do have software SPI support already ...
Say something like: "ARM: C210 board: add software SPI support"
Thanks.
Wolfgang Denk
Signature · 7 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 "No one talks peace unless he's ready to back it up with war." "He talks of peace if it is the only way to live." -- Colonel Green and Surak of Vulcan, "The Savage Curtain", stardate 5906.5.
PATCH v2 1/1 implement software SPI
Dear Wolfgang Denk,
Thank you for your comment. The title is indeed misleading and I change it. Also the patch should be split in two patches. Actually I'm using your software SPI in our board and I need to add two modifications in the soft_spi.c file.
Best regards,
Piotr Wilczek
Quoted 33 lines
-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Thursday, September 20, 2012 5:18 PM
To: Piotr Wilczek
Cc: u-boot at lists.denx.de; Minkyu Kang; Kyungmin Park; Jean-Christophe PLAGNIOL-VILLARD; Lukasz Majewski
Subject: Re: [PATCH v2] implement software SPIDear Piotr Wilczek,
In message <[email protected]> you
Quoted 2 lines · wrote:
This patch implements software SPI for the universal C210 board. SPI is used to configure video driver.
Can you please adjust the Subject: to make clear that this is some C210 board specific code? Because we do have software SPI support already ...
Say something like: "ARM: C210 board: add software SPI support"
Thanks.
Wolfgang Denk
--
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 "No one talks peace unless he's ready to back it up with war." "He talks of peace if it is the only way to live."-- Colonel Green and Surak of Vulcan, "The Savage Curtain", stardate 5906.5.