Skip to content

Commit

Permalink
bbb: add spi pio mode
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
  • Loading branch information
RobertCNelson committed Nov 11, 2015
1 parent 3596145 commit cef1661
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 20 deletions.
3 changes: 2 additions & 1 deletion patch.sh
Expand Up @@ -455,9 +455,10 @@ beaglebone () {
${git} "${DIR}/patches/beaglebone/dts/0004-add-am335x-bonegreen.patch"
${git} "${DIR}/patches/beaglebone/dts/0005-add-overlay-dtb.patch"
${git} "${DIR}/patches/beaglebone/dts/0006-tps65217-Enable-KEY_POWER-press-on-AC-loss-PWR_BUT.patch"
${git} "${DIR}/patches/beaglebone/dts/0007-spi-omap2-mcspi-ti-pio-mode.patch"

if [ "x${regenerate}" = "xenable" ] ; then
number=6
number=7
cleanup
fi

Expand Down
@@ -1,7 +1,7 @@
From e34a5809a40f2b23601000521c41cf95895bd9cd Mon Sep 17 00:00:00 2001
From 8167813691dcf88abafe9346e870b2d4754bc336 Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Thu, 4 Sep 2014 16:10:49 -0500
Subject: [PATCH 1/6] hack: bbb enable 1ghz operation
Subject: [PATCH 1/7] hack: bbb enable 1ghz operation

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
Expand All @@ -22,5 +22,5 @@ index 0e07186..c4f5e1e 100644

/* From AM335x TRM, SPRUH73H, Section 9.3.50 */
--
2.6.1
2.6.2

@@ -1,7 +1,7 @@
From 304eafaf5e058ddba9363b0970245711d8b45502 Mon Sep 17 00:00:00 2001
From 1feade3c3bbca6fe0ca517895d6bc16a719a812e Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Wed, 27 Aug 2014 13:56:37 -0500
Subject: [PATCH 2/6] dts: am335x-bone-common: fixup leds to match 3.8
Subject: [PATCH 2/7] dts: am335x-bone-common: fixup leds to match 3.8

https://groups.google.com/d/msg/beagleboard/634Xm1m3XA8/B028x1FzAyAJ

Expand Down Expand Up @@ -33,5 +33,5 @@ index 07ee535..d6cc270 100644
linux,default-trigger = "mmc0";
default-state = "off";
--
2.6.1
2.6.2

@@ -1,7 +1,7 @@
From 04530b407535bb804f7514d22dd2a78a9e56788c Mon Sep 17 00:00:00 2001
From 14a58082b7c4e9fd59935fb36f2c3e87a0fdf545 Mon Sep 17 00:00:00 2001
From: Schuyler Patton <spatton@ti.com>
Date: Mon, 5 Jan 2015 15:44:14 -0600
Subject: [PATCH 3/6] arm: dts: am335x-bone-common: add collision and carrier
Subject: [PATCH 3/7] arm: dts: am335x-bone-common: add collision and carrier
sense pinmux

Added pin mux definitions for collision and carrier sense errors coming
Expand Down Expand Up @@ -43,5 +43,5 @@ index d6cc270..24505cb 100644
0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
--
2.6.1
2.6.2

6 changes: 3 additions & 3 deletions patches/beaglebone/dts/0004-add-am335x-bonegreen.patch
@@ -1,7 +1,7 @@
From 17c56ecff840dc4c057a9498cca4b676f10df7ee Mon Sep 17 00:00:00 2001
From b5f48c253f9154d97b17067a196b12e6b7a0bb67 Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Fri, 26 Jun 2015 20:01:09 -0500
Subject: [PATCH 4/6] add: am335x-bonegreen
Subject: [PATCH 4/7] add: am335x-bonegreen

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
Expand Down Expand Up @@ -54,5 +54,5 @@ index 0000000..5de96f1
+ status = "okay";
+};
--
2.6.1
2.6.2

6 changes: 3 additions & 3 deletions patches/beaglebone/dts/0005-add-overlay-dtb.patch
@@ -1,7 +1,7 @@
From 79f0f15781b5d8967d605c282855881d9346ac35 Mon Sep 17 00:00:00 2001
From ea0ec999d36c89db25bcc1704f1a2b1c201e9859 Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Thu, 21 May 2015 10:37:56 -0500
Subject: [PATCH 5/6] add overlay dtb
Subject: [PATCH 5/7] add overlay dtb

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
Expand Down Expand Up @@ -46,5 +46,5 @@ index 0000000..8206843
+ vmmc-supply = <&vmmcsd_fixed>;
+};
--
2.6.1
2.6.2

@@ -1,7 +1,7 @@
From 17299a9356f0fcf8978fe2ba36e8a193b2c231d4 Mon Sep 17 00:00:00 2001
From 46a58c40a82d9a27c3673df046a7062f9611fa38 Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Mon, 26 Oct 2015 11:42:13 -0500
Subject: [PATCH 6/6] tps65217: Enable KEY_POWER press on AC loss / PWR_BUT
Subject: [PATCH 6/7] tps65217: Enable KEY_POWER press on AC loss / PWR_BUT

This is an adaption to v3.14.x of the original patch by Andrew Bradford <andrew.bradford@omni-id.com>
Some minor devm_* changes and DT support done by Pantelis Antoniou <panto@antoniou-consulting.com> for 3.8.x
Expand Down Expand Up @@ -211,5 +211,5 @@ index ac7fba4..05d24a6 100644

static inline struct tps65217 *dev_to_tps65217(struct device *dev)
--
2.6.1
2.6.2

85 changes: 85 additions & 0 deletions patches/beaglebone/dts/0007-spi-omap2-mcspi-ti-pio-mode.patch
@@ -0,0 +1,85 @@
From a31d64985220133547cfe124441dc995954b16df Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Thu, 5 Nov 2015 09:30:35 -0600
Subject: [PATCH 7/7] spi-omap2-mcspi: ti,pio-mode

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
Documentation/devicetree/bindings/spi/omap-spi.txt | 1 +
drivers/spi/spi-omap2-mcspi.c | 8 ++++++++
include/linux/platform_data/spi-omap2-mcspi.h | 2 ++
3 files changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/spi/omap-spi.txt b/Documentation/devicetree/bindings/spi/omap-spi.txt
index 2ba5f9c..5bec29a 100644
--- a/Documentation/devicetree/bindings/spi/omap-spi.txt
+++ b/Documentation/devicetree/bindings/spi/omap-spi.txt
@@ -18,6 +18,7 @@ Optional properties:
1:1 with the DMA specifiers listed in dmas. The string naming
is to be "rxN" and "txN" for RX and TX requests,
respectively, where N equals the chip select number.
+- ti,pio-mode: disable dma

Examples:

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 3d09e0b..10018a5 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -139,6 +139,7 @@ struct omap2_mcspi {
struct omap2_mcspi_regs ctx;
int fifo_depth;
unsigned int pin_dir:1;
+ unsigned int pio_mode:1;
};

struct omap2_mcspi_cs {
@@ -976,6 +977,9 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
dma_cap_set(DMA_SLAVE, mask);
sig = mcspi_dma->dma_rx_sync_dev;

+ if (mcspi->pio_mode == MCSPI_PIO_MODE)
+ goto no_dma;
+
mcspi_dma->dma_rx =
dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
&sig, &master->dev,
@@ -1356,6 +1360,8 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
mcspi = spi_master_get_devdata(master);
mcspi->master = master;

+ mcspi->pio_mode = 0;
+
match = of_match_device(omap_mcspi_of_match, &pdev->dev);
if (match) {
u32 num_cs = 1; /* default number of chipselect */
@@ -1366,6 +1372,8 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
master->bus_num = bus_num++;
if (of_get_property(node, "ti,pindir-d0-out-d1-in", NULL))
mcspi->pin_dir = MCSPI_PINDIR_D0_OUT_D1_IN;
+ if (of_get_property(node, "ti,pio-mode", NULL))
+ mcspi->pio_mode = MCSPI_PIO_MODE;
} else {
pdata = dev_get_platdata(&pdev->dev);
master->num_chipselect = pdata->num_cs;
diff --git a/include/linux/platform_data/spi-omap2-mcspi.h b/include/linux/platform_data/spi-omap2-mcspi.h
index c100456..898db7e 100644
--- a/include/linux/platform_data/spi-omap2-mcspi.h
+++ b/include/linux/platform_data/spi-omap2-mcspi.h
@@ -9,11 +9,13 @@

#define MCSPI_PINDIR_D0_IN_D1_OUT 0
#define MCSPI_PINDIR_D0_OUT_D1_IN 1
+#define MCSPI_PIO_MODE 1

struct omap2_mcspi_platform_config {
unsigned short num_cs;
unsigned int regs_offset;
unsigned int pin_dir:1;
+ unsigned int pio_mode:1;
};

struct omap2_mcspi_dev_attr {
--
2.6.2

2 changes: 1 addition & 1 deletion version.sh
Expand Up @@ -16,7 +16,7 @@ toolchain="gcc_linaro_gnueabihf_5"
#Kernel/Build
KERNEL_REL=4.3
KERNEL_TAG=${KERNEL_REL}
BUILD=bone1.4
BUILD=bone1.5
kernel_rt=".X-rtY"

#v4.X-rcX + upto SHA
Expand Down

0 comments on commit cef1661

Please sign in to comment.