linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH v5 2/2] [POWERPC] MPC832x_RDB: update dts to use SPI1 in QE, register mmc_spi stub
Date: Tue, 21 Aug 2007 19:29:47 +0400	[thread overview]
Message-ID: <20070821152947.GB633@localhost.localdomain> (raw)
In-Reply-To: <20070821152745.GA28986@localhost.localdomain>

mmc_spi already tested to work. When it will hit mainline
the only change that will be needed is replacing "spidev"
with "mmc_spi".

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 arch/powerpc/boot/dts/mpc832x_rdb.dts     |    2 +-
 arch/powerpc/platforms/83xx/mpc832x_rdb.c |   50 +++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index e9c332f..1ac0025 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -211,7 +211,7 @@
 			reg = <4c0 40>;
 			interrupts = <2>;
 			interrupt-parent = <&qeic>;
-			mode = "cpu";
+			mode = "cpu-qe";
 		};
 
 		spi@500 {
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index e021b08..cf58d06 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -15,6 +15,7 @@
  */
 
 #include <linux/pci.h>
+#include <linux/spi/spi.h>
 
 #include <asm/of_platform.h>
 #include <asm/time.h>
@@ -24,6 +25,7 @@
 #include <asm/qe_ic.h>
 
 #include "mpc83xx.h"
+#include "../../sysdev/fsl_soc.h"
 
 #undef DEBUG
 #ifdef DEBUG
@@ -32,6 +34,54 @@
 #define DBG(fmt...)
 #endif
 
+extern int par_io_data_set(u8 port, u8 pin, u8 val);
+extern int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,
+			     int assignment, int has_irq);
+
+static void mpc83xx_spi_activate_cs(u8 cs, u8 polarity)
+{
+	pr_debug("%s %d %d\n", __func__, cs, polarity);
+	par_io_data_set(3, 13, polarity);
+}
+
+static void mpc83xx_spi_deactivate_cs(u8 cs, u8 polarity)
+{
+	pr_debug("%s %d %d\n", __func__, cs, polarity);
+	par_io_data_set(3, 13, !polarity);
+}
+
+static struct spi_board_info mpc832x_spi_boardinfo = {
+	.bus_num = 0x4c0,
+	.chip_select = 0,
+	.max_speed_hz = 50000000,
+	/*
+	 * XXX: This is spidev (spi in userspace) stub, should
+	 * be replaced by "mmc_spi" when mmc_spi will hit mainline.
+	 */
+	.modalias = "spidev",
+};
+
+static int __init mpc832x_spi_init(void)
+{
+	if (!machine_is(mpc832x_rdb))
+		return 0;
+
+	par_io_config_pin(3,  0, 3, 0, 1, 0); /* SPI1 MOSI, I/O */
+	par_io_config_pin(3,  1, 3, 0, 1, 0); /* SPI1 MISO, I/O */
+	par_io_config_pin(3,  2, 3, 0, 1, 0); /* SPI1 CLK,  I/O */
+	par_io_config_pin(3,  3, 2, 0, 1, 0); /* SPI1 SEL,  I   */
+
+	par_io_config_pin(3, 13, 1, 0, 0, 0); /* !SD_CS,    O */
+	par_io_config_pin(3, 14, 2, 0, 0, 0); /* SD_INSERT, I */
+	par_io_config_pin(3, 15, 2, 0, 0, 0); /* SD_PROTECT,I */
+
+	return fsl_spi_init(&mpc832x_spi_boardinfo, 1,
+			    mpc83xx_spi_activate_cs,
+			    mpc83xx_spi_deactivate_cs);
+}
+
+device_initcall(mpc832x_spi_init);
+
 /* ************************************************************************
  *
  * Setup the architecture
-- 
1.5.0.6

  parent reply	other threads:[~2007-08-21 15:29 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-21 13:45 [PATCH v4 0/2] SPI support for fsl_soc and mpc832x_rdb Anton Vorontsov
2007-08-21 13:47 ` [PATCH v4 1/2] [POWERPC] fsl_soc: add support for fsl_spi Anton Vorontsov
2007-08-21 13:47 ` [PATCH v4 2/2] [POWERPC] MPC832x_RDB: update dts to use SPI1 in QE, register mmc_spi stub Anton Vorontsov
2007-08-21 15:27 ` [PATCH v5 0/2] SPI support for fsl_soc and mpc832x_rdb Anton Vorontsov
2007-08-21 15:29   ` [PATCH v5 1/2] [POWERPC] fsl_soc: add support for fsl_spi Anton Vorontsov
2007-08-22 14:24     ` Kumar Gala
2007-08-21 15:29   ` Anton Vorontsov [this message]
2007-08-22 14:25     ` [PATCH v5 2/2] [POWERPC] MPC832x_RDB: update dts to use SPI1 in QE, register mmc_spi stub Kumar Gala
2007-08-22 14:22   ` [PATCH v5 0/2] SPI support for fsl_soc and mpc832x_rdb Kumar Gala
2007-08-22 14:54     ` [PATCH v6 " Anton Vorontsov
2007-08-22 14:57       ` [PATCH v6 1/2] [POWERPC] fsl_soc: add support for fsl_spi Anton Vorontsov
2007-08-23  3:24         ` Stephen Rothwell
2007-08-23 11:33           ` [PATCH v7 0/3] " Anton Vorontsov
2007-08-23 11:35             ` [PATCH v7 1/3] [POWERPC] QE lib: extern par_io_config_pin and par_io_data_set funcs Anton Vorontsov
2007-08-23 11:35             ` [PATCH v7 2/3] [POWERPC] fsl_soc: add support for fsl_spi Anton Vorontsov
2007-08-23 11:36             ` [PATCH v7 3/3] [POWERPC] MPC832x_RDB: update dts to use SPI1 in QE, register mmc_spi stub Anton Vorontsov
2007-08-30 21:06               ` Timur Tabi
2007-08-31 13:50                 ` [PATCH v7 3/3] [POWERPC] MPC832x_RDB: update dts to use SPI1in " Li Yang-r58472
2007-09-01 23:59                   ` Segher Boessenkool
2007-09-03 13:55                     ` Timur Tabi
2007-09-03 15:13                       ` Anton Vorontsov
2007-09-03 23:17                         ` Segher Boessenkool
2007-09-04 10:47                           ` Anton Vorontsov
2007-09-04 18:20                             ` Scott Wood
2007-09-04 20:15                               ` Vitaly Bordug
2007-09-05 11:40                               ` Anton Vorontsov
2007-09-05 13:21                                 ` Scott Wood
2007-09-07  1:15                                   ` David Gibson
2007-09-07  1:28                                     ` Timur Tabi
2007-09-06 14:25                                 ` Segher Boessenkool
2007-09-06 14:19                             ` Segher Boessenkool
2007-09-06 14:35                               ` Timur Tabi
2007-09-03 23:12                       ` Segher Boessenkool
2007-09-04  3:16                         ` Timur Tabi
2007-09-06 14:13                           ` Segher Boessenkool
2007-09-06 14:19                             ` Scott Wood
2007-09-06 14:29                               ` Segher Boessenkool
2007-09-07  3:37                             ` David Gibson
2007-08-22 14:57       ` [PATCH v6 2/2] [POWERPC] MPC832x_RDB: update dts to use SPI1 in " Anton Vorontsov
2007-08-22 15:01       ` [PATCH v6 0/2] SPI support for fsl_soc and mpc832x_rdb Kumar Gala
2007-08-22 15:13         ` Anton Vorontsov

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=20070821152947.GB633@localhost.localdomain \
    --to=avorontsov@ru.mvista.com \
    --cc=linuxppc-dev@ozlabs.org \
    /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;
as well as URLs for NNTP newsgroup(s).