[U-Boot] [PATCH] S5P: new spi gpio bitbang driver

Donghwa Lee dh09.lee at samsung.com
Wed Sep 15 07:15:08 CEST 2010


 On Tuesday, September 14, 2010 20:48:11 Mike Frysinger wrote:
> On Tuesday, September 14, 2010 03:38:11 Donghwa Lee wrote:
>> This patch adds basic support for spi mode 0~3 by control gpio bitbang in
>> S5P. Original name of this patch was "support spi gpio driver by control
>> gpio bitbang". But, it had arch-specific features, S5P, so changed to this
>> name.
> so why arent you implementing this with the common spi API ?  then any of the 
> code in the tree would be able to use this spi driver without having to change 
> to your arch-specific API.
>

I think common spi API is not appropriate for S5P arch. For example, arch-S5P
gpio framework consists of many gpio bank structure, and gpio number. From here,
gpio bank structures are groups of many gpio pin and gpio number indicates specific
gpio pin of gpio bank group. To control any gpio pin in arch S5P, must know about
gpio bank and its specific number.
But, existing spi API is different from avobe.
For example, spi_setup_slave() function, consists of 4 function parameter, bus, cs,
max_hz and mode. bus and cs is specific gpio number that not gpio bank group.
so I think it is hard to control gpio without modifying API format.

This is reason that I had implemented new s5p-spi.c code. Implemented code can operating
whole SPI_MODE and maybe easily use it. If you use gpio framework that similar with
S5P gpio framework, you can use this spi driver easily.

>> +++ b/arch/arm/include/asm/arch-s5pc1xx/spi.h
>> @@ -0,0 +1,53 @@
>> +
>> +#ifndef __ASM_ARCH_SPI_H_
>> +#define __ASM_ARCH_SPI_H_
>> +
>> +#ifndef __ASSEMBLY__
>> +
>> +
>> +#define COMMAND_ONLY		0xFE
>> +#define DATA_ONLY		0xFF
> i dont see the point in the __ASSEMBLY__ protection.  this header isnt 
> included by any header, and you dont actually define anything outside of the 
> __ASSEMBLY__ which means including it from an assembly file doesnt make sense.
>

yes, I agree your opinion. It should be removed.

>> +#define ACTIVE_LOW		0
>> +#define ACTIVE_HIGH		1
> considering you're already including spi.h, you might as well  re-use 
> SPI_CS_HIGH instead of defining your own.
>

yes, I agree your opinion. SPI_CS_HIGH can be re-used

>> +struct s5p_spi_platdata {
>> +	struct s5p_gpio_bank *cs_bank;
>> +	struct s5p_gpio_bank *clk_bank;
>> +	struct s5p_gpio_bank *si_bank;
>> +	struct s5p_gpio_bank *so_bank;
> you need to include the header in this header which defines these structs.
> -mike

yes,  it need to include the header file "<asm/arch/gpio.h>".

thank you for your opinion.



More information about the U-Boot mailing list