summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0040-beaglebone-export-SPI2-as-spidev-when-no-capes-are-u.patch
blob: 3fe08e4033be67642d52bbb33ca7922292edaeed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
From b42299b9cd05cb162cd2364fa41e7307515b8a55 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Mon, 14 May 2012 14:23:45 +0200
Subject: [PATCH 40/56] beaglebone: export SPI2 as spidev when no capes are
 using SPI

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
 arch/arm/mach-omap2/board-am335xevm.c |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index c9ee0a2..a0fa53a 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -497,6 +497,7 @@ static bool beaglebone_cape_detected;
 static int capecount = 0;
 static bool beaglebone_tsadcpins_free = 1;
 static bool beaglebone_leds_free = 1;
+static bool beaglebone_spi1_free = 1;
 
 
 #define GP_EVM_REV_IS_1_0		0x1
@@ -1897,6 +1898,16 @@ static struct spi_board_info am335x_spi1_slave_info[] = {
 	},
 };
 
+static struct spi_board_info bone_spidev2_info[] = {
+	{
+		.modalias      = "spidev",
+		.irq           = -1,
+		.max_speed_hz  = 12000000,
+		.bus_num       = 2,
+		.chip_select   = 0,
+	},
+};
+
 static struct gpmc_timings am335x_nand_timings = {
 	.sync_clk = 0,
 
@@ -2199,8 +2210,9 @@ static struct spi_board_info tt3201_spi_info[] = {
 
 static void tt3201_init(int evm_id, int profile)
 {
-	pr_info("TowerTech TT3201 CAN Cape\n");
-
+	pr_info("TowerTech TT3201 CAN cape\n");
+	
+	beaglebone_spi1_free = 0;
 	setup_pin_mux(spi1_pin_mux);
 	setup_pin_mux(tt3201_pin_mux);
 
@@ -2234,12 +2246,18 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context
 			if (beaglebone_leds_free == 1) {
 				boneleds_init(0,0);
 			}
+			if(beaglebone_spi1_free == 1) {
+				beaglebone_spi1_free = 0;
+				pr_info("BeagleBone cape: exporting SPI pins as spidev\n");
+				setup_pin_mux(spi1_pin_mux);
+				spi_register_board_info(bone_spidev2_info, ARRAY_SIZE(bone_spidev2_info));
+			}
 		}
 		return;
 	}
 
 	if (cape_config.header != AM335X_EEPROM_HEADER) {
-		pr_warning("BeagleBone Cape EEPROM: wrong header 0x%x, expected 0x%x\n",
+		pr_warning("BeagleBone cape EEPROM: wrong header 0x%x, expected 0x%x\n",
 			cape_config.header, AM335X_EEPROM_HEADER);
 		goto out;
 	}
@@ -2630,7 +2648,6 @@ static void spi1_init(int evm_id, int profile)
 	return;
 }
 
-
 static int beaglebone_phy_fixup(struct phy_device *phydev)
 {
 	phydev->supported &= ~(SUPPORTED_100baseT_Half |
-- 
1.7.7.6