spi: controller driver for Designware SPI core
PATCH v3 1/3 spi: controller driver for Designware SPI core
Quoted 1 line
From
2945f4eab344742d878ea10a774285fe770e6b10Mon Sep 17 00:00:00 2001
From: Feng Tang <[email protected]>
Date: Sat, 10 Oct 2009 14:55:48 +0800
Subject: [PATCH 1/3] spi: controller driver for Designware SPI core
Driver for the Designware SPI core, it supports multipul interfaces like PCI/APB etc. User can use "dw_apb_ssi_db.pdf" from Synopsys as HW datasheet.
--- drivers/spi/Kconfig | 6 + drivers/spi/Makefile | 1 + drivers/spi/dw_spi.c | 941 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/spi/dw_spi.h | 212 ++++++++++ 4 files changed, 1160 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/dw_spi.c create mode 100644 include/linux/spi/dw_spi.h
drivers/spi/Kconfig +6 -0
@@ -244,6 +244,12 @@ config SPI_XILINX See the "OPB Serial Peripheral Interface (SPI) (v1.00e)" Product Specification document (DS464) for hardware details. +config SPI_DESIGNWARE + bool "DesignWare SPI controller core support" + depends on SPI_MASTER + help + general driver for SPI controller core from DesignWare + # # Add new SPI master controllers in alphabetical order above this line #
drivers/spi/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_SPI_TXX9) += spi_txx9.o obj-$(CONFIG_SPI_XILINX) += xilinx_spi.o obj-$(CONFIG_SPI_SH_SCI) += spi_sh_sci.o obj-$(CONFIG_SPI_STMP3XXX) += spi_stmp.o +obj-$(CONFIG_SPI_DESIGNWARE) += dw_spi.o # ... add above this line ... # SPI protocol drivers (device/link on bus)
drivers/spi/dw_spi.c new file +941 -0
941 lines not on this page · raw message
include/linux/spi/dw_spi.h new file +212 -0
212 lines not on this page · raw message
Signature · 8 lines
1.6.0.4 ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference
Quoted 11 lines · On Mon, 12 Oct 2009 14:19:15 +0800 Feng Tang…
Quoted 1 line
From
2945f4eab344742d878ea10a774285fe770e6b10Mon Sep 17 00:00:00 2001From: Feng Tang <[email protected]>
Date: Sat, 10 Oct 2009 14:55:48 +0800
Subject: [PATCH 1/3] spi: controller driver for Designware SPI coreDriver for the Designware SPI core, it supports multipul interfaces like PCI/APB etc. User can use "dw_apb_ssi_db.pdf" from Synopsys as HW datasheet.
...
drivers/spi/dw_spi.c line 35
Quoted 4 lines
drivers/spi/dw_spi.c new file +4
-0+#define START_STATE ((void *)0) +#define RUNNING_STATE ((void *)1) +#define DONE_STATE ((void *)2) +#define ERROR_STATE ((void *)-1)
What's going on here?
Quoted 8 lines
...
drivers/spi/dw_spi.c new file +5
-0+static void *next_transfer (struct dw_spi *dws) +{ +struct spi_message *msg = dws->cur_msg; +struct spi_transfer *trans = dws->cur_transfer; +
drivers/spi/dw_spi.c line 280
Quoted 10 lines
drivers/spi/dw_spi.c new file +10
-0+/* Move to next transfer */ +if (trans->transfer_list.next != &msg->transfers) { + dws->cur_transfer = +list_entry (trans->transfer_list.next, + struct spi_transfer, + transfer_list); +return RUNNING_STATE ; + }else +return DONE_STATE ; +}
Seems that you only need a single word of device-private storage in struct spi_message'. So instead of kmallocing enough memory to store the state' value, you've stuffed that value directly into the spi_message, pretending to be a kernel address.
Correct?
If so, it's a bit nasty but probabyl a worthwhile thing to do. It'd be nice to add a code comment somewhere explaining this. Plasing it at the definition site of the *_STATE values would be appropriate.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference