AnsweredAssumed Answered

SPI userspace driver and SPORT0

Question asked by berndK on Feb 13, 2012
Latest reply on Feb 13, 2012 by sonic

Hi,

 

I'm currently using the SPI userspacedriver for the BF537 SPI-Port. That works fine. But now I need to setup the driver for the SPI over SPORT0 too.

 

I'm using the following setup in stamp.c:

 

#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)

    {

        .modalias = "spidev",

        .max_speed_hz = 1000000,     /* max spi clock (SCK) speed in HZ */

        .bus_num = 0,

        .chip_select = GPIO_PF14 + MAX_CTRL_CS,

        .mode = SPI_MODE_1,

    },

    {

        .modalias = "spidev",

        .max_speed_hz = 1000000,     /* max spi clock (SCK) speed in HZ */

        .bus_num = 1,

        .chip_select = 0,

        .mode = SPI_MODE_1,

    },

 

#endif

 

...

 

 

#if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)

 

/* SPORT SPI controller data */

static struct bfin5xx_spi_master bfin_sport_spi0_info = {

    .num_chipselect = 1, /* master only supports one device */

    .enable_dma = 0,  /* master don't support DMA */

    .pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,

        P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},

};

 

static struct resource bfin_sport_spi0_resource[] = {

    [0] = {

        .start = SPORT0_TCR1,

        .end   = SPORT0_TCR1 + 0xFF,

        .flags = IORESOURCE_MEM,

        },

    [1] = {

        .start = IRQ_SPORT0_ERROR,

        .end   = IRQ_SPORT0_ERROR,

        .flags = IORESOURCE_IRQ,

        },

};

 

static struct platform_device bfin_sport_spi0_device = {

    .name = "bfin-sport-spi",

    .id = 1, /* Bus number */

    .num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),

    .resource = bfin_sport_spi0_resource,

    .dev = {

        .platform_data = &bfin_sport_spi0_info, /* Passed to driver */

    },

};

 

static struct bfin5xx_spi_master bfin_sport_spi1_info = {

    .num_chipselect = 1, /* master only supports one device */

    .enable_dma = 0,  /* master don't support DMA */

    .pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,

        P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},

};

 

static struct resource bfin_sport_spi1_resource[] = {

    [0] = {

        .start = SPORT1_TCR1,

        .end   = SPORT1_TCR1 + 0xFF,

        .flags = IORESOURCE_MEM,

        },

    [1] = {

        .start = IRQ_SPORT1_ERROR,

        .end   = IRQ_SPORT1_ERROR,

        .flags = IORESOURCE_IRQ,

        },

};

 

static struct platform_device bfin_sport_spi1_device = {

    .name = "bfin-sport-spi",

    .id = 2, /* Bus number */

    .num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),

    .resource = bfin_sport_spi1_resource,

    .dev = {

        .platform_data = &bfin_sport_spi1_info, /* Passed to driver */

    },

};

 

#endif  /* sport spi master and devices */

 

 

But it doesn't work:

 

Stack info:

SP: [0x0201bdbc]

Memory from 0x0201bdb0 to 0201c000

0201bdb0: 00168435  0201bdbc  ffffffff [00198598] 000057e8  0204b088  02030708  001a1948

0201bdd0: 0009b9c6  001977a0  00193430  001a1948  00000000  0000ffff  00000000  00000000

0201bdf0: 000abfa4  00000021  00000000  000c8d9e  0269d200  0204b080  00000000  0269d200

0201be10: 00000000  001985a0  00000000  000c6b46  0204b080  02030708  00000000  001985a0

0201be30: 001985a0  000aac34  0269d320  00000000  000c6c18  0204b080  00000000  001985a0

0201be50: 00000000  00000007  00198598  000c6c5a  02691400  02030708  ffa026f4  02691400

0201be70: 00000000  000c6d20  02030700  02691400  026914e8  02691510  00000001  0012c188

0201be90: 026914e8  02691510  02691400  001946e8  00000000  0201bec0  00000000  001689bc

0201beb0: 026914e8  00000000  000ac5b4  001985a0  001a19e4  001946e8  001985d4  0201bf20

0201bed0: 001a19e4  00000000  00000000  00000000  ffa026f4  000ac6f8  001985a0  001a19e4

0201bef0: 0251b2c0  001985d4  0008ed36  001a07c0  00000000  000abf58  000ac694  001a19e4

0201bf10: 00000000  00000000  0269d3a0  0008ef06  02030bf8  02043f30  000ac466  001a07c0

0201bf30: 00000000  00000000  00000000  000ab94e  0201bf60  000ab988  000ac694  000aba78

0201bf50: 0008c0c6  00000000  001bcdf0  00159594  0015b998  000acc00  001bce08  001b3dc4

0201bf70: 001a19e4  00000000  00000000  00000000  000b674e  00000000  00000000  0000110a

0201bf90: 001bce08  001b3dc4  00187008  00000000  00000000  00000000  001a0000  00034798

0201bfb0: 0019ab9c  001bcc34  001a815e  001bce08  001bcc34  001bce50  00000000  00000000

0201bfd0: 00000000  00000000  00000000  00000000  00000000  00001556  00000000  00000000

0201bff0: 00000000  00000000  ffffffff  00000006

Return addresses in stack:

bfin-gpio: GPIO 0 is already reserved as Peripheral by bfin-uart !

bfin-sport-spi bfin-sport-spi.1: can't setup spi1.0, status -16

bfin-sport-spi bfin-sport-spi.1: can't create new device for spidev

bfin-sport-spi bfin-sport-spi.1: SPI bus via the Blackfin SPORT, regs_base@ffc00800

 

Can anybody give me the right configuration.

 

thx.

Outcomes