On Wed, Nov 18, 2009 at 00:46, <[email protected]> wrote:
> Revision 7841 Author bhsong Date 2009-11-18 00:46:26 -0500 (Wed, 18 Nov
> 2009)
>
> Log Message
>
> bug [#5689], don't set select num as 0 while using gpio cs
>
> fix problems pointed out by Michael and Mike
>
> Modified: trunk/arch/blackfin/include/asm/bfin5xx_spi.h (7840 => 7841)
>
> -#define USE_GPIO_CS 0x8000
> +#define MAX_CTRL_CS 8 /* cs in spi controller */
> +#define MAX_GPIO_CS MAX_BLACKFIN_GPIOS /* gpio can be cs */
this prevents using GPIOs that are integrated via gpiolib, and i dont
think there's a problem with those. how about the bus driver simply
uses return value from gpio_request() to figure out whether the gpio
in question is valid ?
> Modified: trunk/drivers/spi/spi_bfin5xx.c (7840 => 7841)
>
> /* Chip select operation functions for cs_change flag */
> static void bfin_spi_cs_active(struct master_data *drv_data, struct
> slave_data *chip)
> {
> - if (likely(!(chip->chip_select_num & USE_GPIO_CS))) {
> + if (likely(chip->chip_select_num < MAX_CTRL_CS)) {
> u16 flag = read_FLAG(drv_data);
>
> flag &= ~chip->flag;
> @@ -198,7 +198,7 @@
>
> static void bfin_spi_cs_deactive(struct master_data *drv_data, struct
> slave_data *chip)
> {
> - if (likely(!(chip->chip_select_num & USE_GPIO_CS))) {
> + if (likely(chip->chip_select_num < MAX_CTRL_CS)) {
> u16 flag = read_FLAG(drv_data);
>
> flag |= chip->flag;
> @@ -216,7 +216,7 @@
> /* enable or disable the pin muxed by GPIO and SPI CS to work as SPI CS */
> static inline void bfin_spi_cs_enable(struct master_data *drv_data, struct
> slave_data *chip)
> {
> - if (!(chip->chip_select_num & USE_GPIO_CS)) {
> + if (chip->chip_select_num < MAX_CTRL_CS) {
> u16 flag = read_FLAG(drv_data);
>
> flag |= (chip->flag >> 8);
i wonder what's better for these cs functions. create two sets of
function pointers (enable/disable/activate/deactivate) and split the
hardware cs from the gpio cs, or stick with these inline checks.
-mike
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits