linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* SPI trouble on Colibri 270 (PXA)...
@ 2010-04-20 11:58 Jakob Viketoft
  2010-04-20 13:14 ` Eric Miao
  0 siblings, 1 reply; 15+ messages in thread
From: Jakob Viketoft @ 2010-04-20 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hello!

I've come to a dead end in finding out what's wrong with my SPI setup so 
I was hoping that someone here has some pointers to help me along. I'm 
trying to use an m25p80 SPI flash through the pxa2xx SPI controller 
(through SSP1), but read accesses go wrong (I haven't even tried writing 
yet). What happens is that after the pxa2xx writes the read command on 
the SPI bus, the chip is deselected - effectively terminating the read 
operation. Some 100 us afterwards the cs go low again and it seems as 
the read operation is continued (clock runs, no output data), but by 
then the chip has already terminated. Forcing the cs_change bit on each 
transfer doesn't seem to do any difference, there is still a pause 
between two transfers in the same message.

I haven't seen any other board using the same combination (the m25p80 
and the pxa2xx), but I'm still opting for an error on my part somewhere. 
I've attached my SPI configuration (board setup) in the end of the mail.

I'm ready for any suggestions at this point. Please CC me as I'm not on 
the list.

Regards,

	/Jakob

------------

/*
  *  linux/arch/arm/mach-pxa/colibri-pxa270-spi.c
  *
  *  Separate file for the Toradex Colibri 270 SPI definitions to avoid
  *  conflicts with the "regular" flash includes.
  *  Jakob Viketoft <info@bitsim.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */

#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
#include <mach/pxa2xx_spi.h>
#include <mach/mfp-pxa27x.h>
#include <mach/pxa2xx-regs.h>
#include <mach/gpio.h>

#include "generic.h"
#include "devices.h"

/* SPI interface on SSP1 */
static unsigned long colibri_spi_pin_config[] __initdata = {
	GPIO23_SSP1_SCLK,
	GPIO24_SSP1_SFRM,
	GPIO25_SSP1_TXD,
	GPIO26_SSP1_RXD,
};

static struct pxa2xx_spi_master colibri_spi_ssp1_info = {
	.clock_enable = CKEN_SSP1,
	.num_chipselect	= 1,
	.enable_dma = 0,
};

struct mtd_partition fpga_flash_partitions[] = {
	{
		.name		= "FPGA code",
		.size		= 0x00100000,
		.offset		= 0,
		.mask_flags	= 0,
//		.mask_flags	= MTD_WRITEABLE,
	},
};

static struct flash_platform_data colibri_spi_m25p80_info = {
	.type		= "m25p80",
	.name		= "fpga_flash",
	.parts		= fpga_flash_partitions,
	.nr_parts	= ARRAY_SIZE(fpga_flash_partitions),
};

static struct pxa2xx_spi_chip colibri_spi_m25p80_chip = {
	.rx_threshold = 1,
	.tx_threshold = 1,
	.gpio_cs = GPIO24_SSP1_SFRM,
};

static struct spi_board_info __initdata colibri_spi_devices[] = {
	{
		.modalias	= "m25p80",
		.max_speed_hz	= 1200000,
		.bus_num	= 1,
		.chip_select	= 0,
		.platform_data	= &colibri_spi_m25p80_info,
		.controller_data= &colibri_spi_m25p80_chip,
	},
  };

static int __init colibri_init_spi(void)
{
	printk(KERN_ERR "Init Colibri SPI\n");
	pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_spi_pin_config));
	pxa2xx_set_spi_info(1, &colibri_spi_ssp1_info);
	return spi_register_board_info(ARRAY_AND_SIZE(colibri_spi_devices));
}

subsys_initcall(colibri_init_spi);

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-04-23 23:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-20 11:58 SPI trouble on Colibri 270 (PXA) Jakob Viketoft
2010-04-20 13:14 ` Eric Miao
2010-04-20 15:20   ` Jakob Viketoft
2010-04-21  9:44     ` Marek Vasut
2010-04-21 10:47       ` Eric Miao
2010-04-21 11:11         ` Martin Guy
2010-04-21 11:42           ` Eric Miao
2010-04-21 11:49             ` Martin Guy
2010-04-21 12:47           ` Jakob Viketoft
2010-04-21 14:53             ` Martin Guy
     [not found]             ` <g2xf17812d71004210607n4f3d82f2m4712d3bb97ef4924@mail.gmail.com>
2010-04-22 14:36               ` Jakob Viketoft
2010-04-23 16:55                 ` Vernon Sauder
2010-04-23 19:57                   ` Jakob Viketoft
2010-04-23 23:40                     ` Eric Miao
2010-04-21 12:12         ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).