diff mbox

beagledaq: Hack in cs_gpios

Message ID 1314712343-27367-1-git-send-email-bgamari.foss@gmail.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Ben Gamari Aug. 30, 2011, 1:52 p.m. UTC
---
 arch/arm/mach-omap2/board-omap3beagle.c |    4 ++--
 arch/arm/mach-omap2/devices.c           |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

Comments

Raju Sana Sept. 5, 2011, 12:42 p.m. UTC | #1
Hi Ben,

The McSPI1 has got  "num_cs"  as 4.
I would like to use McSPI1 to select my 3 chips based on the two GPIO pins.

Could you please give me some pointers on this.

Thanks,
Venkat Raju.





On Tue, Aug 30, 2011 at 7:22 PM, Ben Gamari <bgamari.foss@gmail.com> wrote:

> ---
>  arch/arm/mach-omap2/board-omap3beagle.c |    4 ++--
>  arch/arm/mach-omap2/devices.c           |   15 +++++++++++++++
>  2 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c
> b/arch/arm/mach-omap2/board-omap3beagle.c
> index 67999da..481c1a9 100644
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -661,8 +661,8 @@ static struct spi_board_info
> beagledaq_mcspi_board_info[] = {
>        },
>  };
>
> -static int mcspi3_cs_gpios[4];
> -static int mcspi4_cs_gpios[4];
> +int mcspi3_cs_gpios[4];
> +int mcspi4_cs_gpios[4];
>
>  static void __init beagledaq_init(void)
>  {
> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
> index 5b8ca68..6808251 100644
> --- a/arch/arm/mach-omap2/devices.c
> +++ b/arch/arm/mach-omap2/devices.c
> @@ -341,6 +341,9 @@ struct omap_device_pm_latency omap_mcspi_latency[] = {
>        },
>  };
>
> +extern int mcspi3_cs_gpios[4];
> +extern int mcspi4_cs_gpios[4];
> +
>  static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
>  {
>        struct omap_device *od;
> @@ -369,6 +372,18 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void
> *unused)
>                        return -EINVAL;
>        }
>
> +       /* HACK: Not enough time to figure out how to export cs_gpios from
> +        * board file to driver correctly */
> +       if (spi_num == 2) {
> +               // Setup McSPI3 cs_gpios
> +               pdata->num_cs = 4;
> +               pdata->cs_gpios = mcspi3_cs_gpios;
> +       } else if (spi_num == 3) {
> +               // Setup McSPI4 cs_gpios
> +               pdata->num_cs = 4;
> +               pdata->cs_gpios = mcspi4_cs_gpios;
> +       }
> +
>        spi_num++;
>        od = omap_device_build(name, spi_num, oh, pdata,
>                                sizeof(*pdata), omap_mcspi_latency,
> --
> 1.7.4.1
>
>
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 67999da..481c1a9 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -661,8 +661,8 @@  static struct spi_board_info beagledaq_mcspi_board_info[] = {
 	},
 };
 
-static int mcspi3_cs_gpios[4];
-static int mcspi4_cs_gpios[4];
+int mcspi3_cs_gpios[4];
+int mcspi4_cs_gpios[4];
 
 static void __init beagledaq_init(void)
 {
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 5b8ca68..6808251 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -341,6 +341,9 @@  struct omap_device_pm_latency omap_mcspi_latency[] = {
 	},
 };
 
+extern int mcspi3_cs_gpios[4];
+extern int mcspi4_cs_gpios[4];
+
 static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
 {
 	struct omap_device *od;
@@ -369,6 +372,18 @@  static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
 			return -EINVAL;
 	}
 
+	/* HACK: Not enough time to figure out how to export cs_gpios from
+	 * board file to driver correctly */
+	if (spi_num == 2) {
+		// Setup McSPI3 cs_gpios
+		pdata->num_cs = 4;
+		pdata->cs_gpios = mcspi3_cs_gpios;
+	} else if (spi_num == 3) {
+		// Setup McSPI4 cs_gpios
+		pdata->num_cs = 4;
+		pdata->cs_gpios = mcspi4_cs_gpios;
+	}
+
 	spi_num++;
 	od = omap_device_build(name, spi_num, oh, pdata,
 				sizeof(*pdata),	omap_mcspi_latency,