public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: linux-kernel@vger.kernel.org, stephen@streetfiresound.com
Cc: dvrabel@arcom.com, Nicolas Pitre <nico@cam.org>
Subject: [PATCH] pxa2xx_spi, board support for Lubbock
Date: Mon, 6 Feb 2006 20:22:51 -0800	[thread overview]
Message-ID: <200602062022.51845.david-b@pacbell.net> (raw)
In-Reply-To: <43e80ec3.oEr+gtyMVtunRTyE%stephen@streetfiresound.com>

[-- Attachment #1: Type: text/plain, Size: 296 bytes --]

Building on Stephen's patch, here is board support for
one of the reference pxa25x development platforms.  To
use this you will want some ads7846 patches ... I think
they're now in Dmitry's input queue (or ask me).

This is against 2.6.16-rc2 ... now I get some tabletop
space back!  :)

- Dave


[-- Attachment #2: lubbock-spi.patch --]
[-- Type: text/x-diff, Size: 3505 bytes --]

Lubbock update for SPI support: declare the SSP controller and ADS7846 device.
This is only lightly tested, since my board doesn't populate J5 ... this seems
to behave for access to the temperature sensors, but there's no way to hook up
the touchscreen and use that.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>


--- lubbock.orig/arch/arm/mach-pxa/lubbock.c	2006-02-05 21:49:53.000000000 -0800
+++ lubbock/arch/arm/mach-pxa/lubbock.c	2006-02-05 22:29:05.000000000 -0800
@@ -22,6 +22,10 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 
+#include <linux/spi/spi.h>
+#include <linux/spi/ads7846.h>
+#include <asm/arch/pxa2xx_spi.h>
+
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
@@ -196,6 +200,71 @@ static struct resource smc91x_resources[
 	},
 };
 
+/* ADS7846 is connected through SSP ... and if your board has J5 populated,
+ * you can select it to replace the ucb1400 by switching the touchscreen cable
+ * (to J5) and poking board registers (as done below).  Else it's only usable
+ * for the temperature sensors.
+ */
+static struct resource pxa_ssp_resources[] = {
+	[0] = {
+		.start	= __PREG(SSCR0_P(1)),
+		.end	= __PREG(SSCR0_P(1)) + 0x14,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= IRQ_SSP,
+		.end	= IRQ_SSP,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct pxa2xx_spi_master pxa_ssp_master_info = {
+	.ssp_type	= PXA25x_SSP,
+	.clock_enable	= CKEN3_SSP,
+	.num_chipselect	= 0,
+};
+
+static struct platform_device pxa_ssp = {
+	.name		= "pxa2xx-spi",
+	.id		= 1,
+	.resource	= pxa_ssp_resources,
+	.num_resources	= ARRAY_SIZE(pxa_ssp_resources),
+	.dev = {
+		.platform_data	= &pxa_ssp_master_info,
+	},
+}; 
+
+static struct ads7846_platform_data ads_info = {
+	.model			= 7846,
+	.vref_delay_usecs	= 100,		/* internal, no cap */
+
+	.x_plate_ohms		= 500,	/* GUESS! */
+	.y_plate_ohms		= 500,	/* GUESS! */
+};
+
+static void ads7846_cs(u32 command)
+{
+	static const unsigned	TS_nCS = 1 << 11;
+	lubbock_set_misc_wr(TS_nCS, (command == PXA2XX_CS_ASSERT) ? 0 : TS_nCS);
+}
+
+static struct pxa2xx_spi_chip ads_hw = {
+	.tx_threshold		= 1,
+	.rx_threshold		= 2,
+	.cs_control		= ads7846_cs,
+};
+
+static struct spi_board_info spi_board_info[] __initdata = { {
+	.modalias	= "ads7846",
+	.platform_data	= &ads_info,
+	.controller_data = &ads_hw,
+	.irq		= LUBBOCK_BB_IRQ,
+	.max_speed_hz	= 120000 /* max sample rate at 3V */ * 16,
+	.bus_num	= 1,
+	.chip_select	= 0,
+},
+};
+
 static struct platform_device smc91x_device = {
 	.name		= "smc91x",
 	.id		= -1,
@@ -272,6 +341,7 @@ static struct platform_device *devices[]
 	&smc91x_device,
 	&lubbock_flash_device[0],
 	&lubbock_flash_device[1],
+	&pxa_ssp,
 };
 
 static struct pxafb_mach_info sharp_lm8v31 __initdata = {
@@ -400,6 +470,8 @@ static void __init lubbock_init(void)
 	lubbock_flash_data[flashboot^1].name = "application-flash";
 	lubbock_flash_data[flashboot].name = "boot-rom";
 	(void) platform_add_devices(devices, ARRAY_SIZE(devices));
+
+	spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
 }
 
 static struct map_desc lubbock_io_desc[] __initdata = {
@@ -416,6 +488,11 @@ static void __init lubbock_map_io(void)
 	pxa_map_io();
 	iotable_init(lubbock_io_desc, ARRAY_SIZE(lubbock_io_desc));
 
+	/* SSP data pins */
+	pxa_gpio_mode(GPIO23_SCLK_MD);
+	pxa_gpio_mode(GPIO25_STXD_MD);
+	pxa_gpio_mode(GPIO26_SRXD_MD);
+
 	/* This enables the BTUART */
 	pxa_gpio_mode(GPIO42_BTRXD_MD);
 	pxa_gpio_mode(GPIO43_BTTXD_MD);

  reply	other threads:[~2006-02-07  4:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-07  3:06 [PATCH] spi: Add PXA2xx SSP SPI Driver stephen
2006-02-07  4:22 ` David Brownell [this message]
2006-02-07 11:50 ` David Vrabel
2006-02-07 15:05   ` David Vrabel
2006-02-07 21:27     ` Stephen Street
2006-02-07 21:17   ` Stephen Street
2006-02-10  1:38 ` [PATCH] spi: Updated " Stephen Street
2006-02-10  2:18   ` Andrew Morton
2006-02-10 23:07     ` Stephen Street
2006-02-10 23:49       ` Andrew Morton
2006-02-10 17:40   ` Nicolas Pitre
2006-02-10 22:19     ` Stephen Street
2006-02-10 22:45       ` Nicolas Pitre
2006-02-10 23:22         ` Stephen Street
2006-02-14  1:35   ` [PATCH] spi: Code Review " Stephen Street

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200602062022.51845.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=dvrabel@arcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nico@cam.org \
    --cc=stephen@streetfiresound.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox