-
Notifications
You must be signed in to change notification settings - Fork 63
/
0007-Beagle-expansion-add-beaglefpga.patch
115 lines (108 loc) · 3.58 KB
/
0007-Beagle-expansion-add-beaglefpga.patch
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
From 2666f79dd5a957a05ef5fc424770839d023ec5ec Mon Sep 17 00:00:00 2001
From: Bas van der Doorn <bas@doornvd.com>
Date: Tue, 11 Dec 2012 06:52:22 -0600
Subject: [PATCH 07/10] Beagle: expansion: add beaglefpga
Added SPI dev and McBSP 3 mux when FPGA is detected
Signed-off-by: Bas van der Doorn <bas@doornvd.com>
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
arch/arm/mach-omap2/board-omap3beagle.c | 74 +++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index f126531..3b939eb 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -40,6 +40,7 @@
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/flash.h>
+#include <linux/spi/spi.h>
#include <video/omapdss.h>
#include <video/omap-panel-generic-dpi.h>
@@ -885,6 +886,68 @@ static int __init beagle_opp_init(void)
}
device_initcall(beagle_opp_init);
+static void __init omap3_beagle_config_mcspi3_mux(void)
+{
+ /* NOTE: Clock pins need to be in input mode */
+ omap_mux_init_signal("sdmmc2_clk.mcspi3_clk", OMAP_PIN_INPUT);
+ omap_mux_init_signal("sdmmc2_cmd.mcspi3_simo", OMAP_PIN_OUTPUT);
+ omap_mux_init_signal("sdmmc2_dat0.mcspi3_somi", OMAP_PIN_INPUT_PULLUP);
+ omap_mux_init_signal("sdmmc2_dat2.mcspi3_cs1", OMAP_PIN_OUTPUT);
+ omap_mux_init_signal("sdmmc2_dat3.mcspi3_cs0", OMAP_PIN_OUTPUT);
+}
+
+static void __init omap3_beagle_config_mcspi4_mux(void)
+{
+ /* NOTE: Clock pins need to be in input mode */
+ omap_mux_init_signal("mcbsp1_clkr.mcspi4_clk", OMAP_PIN_INPUT);
+ omap_mux_init_signal("mcbsp1_dx.mcspi4_simo", OMAP_PIN_OUTPUT);
+ omap_mux_init_signal("mcbsp1_dr.mcspi4_somi", OMAP_PIN_INPUT_PULLUP);
+ omap_mux_init_signal("mcbsp1_fsx.mcspi4_cs0", OMAP_PIN_OUTPUT);
+}
+
+static void __init omap3_beagle_config_mcbsp3_mux(void)
+{
+ omap_mux_init_signal("mcbsp3_fsx.uart2_rx", OMAP_PIN_INPUT);
+ omap_mux_init_signal("uart2_cts.mcbsp3_dx", OMAP_PIN_OUTPUT);
+ omap_mux_init_signal("uart2_rts.mcbsp3_dr", OMAP_PIN_INPUT);
+ /* NOTE: Clock pins need to be in input mode */
+ omap_mux_init_signal("uart2_tx.mcbsp3_clkx", OMAP_PIN_INPUT);
+}
+
+static void __init omap3_beagle_config_fpga_mux(void)
+{
+ omap3_beagle_config_mcbsp3_mux();
+ omap3_beagle_config_mcspi3_mux();
+ omap3_beagle_config_mcspi4_mux();
+}
+
+static struct spi_board_info beagle_mcspi_board_info[] = {
+ /* spi 3.0 */
+ {
+ .modalias = "spidev",
+ .max_speed_hz = 48000000, //48 Mbps
+ .bus_num = 3,
+ .chip_select = 0,
+ .mode = SPI_MODE_1,
+ },
+ /* spi 3.1 */
+ {
+ .modalias = "spidev",
+ .max_speed_hz = 48000000, //48 Mbps
+ .bus_num = 3,
+ .chip_select = 1,
+ .mode = SPI_MODE_1,
+ },
+ /* spi 4.0 */
+ {
+ .modalias = "spidev",
+ .max_speed_hz = 48000000, //48 Mbps
+ .bus_num = 4,
+ .chip_select = 0,
+ .mode = SPI_MODE_1,
+ },
+};
+
static void __init omap3_beagle_init(void)
{
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
@@ -1010,6 +1073,17 @@ static void __init omap3_beagle_init(void)
#endif
}
+ if (!strcmp(expansionboard_name, "beaglefpga"))
+ {
+ pr_info("Beagle expansionboard: enabling SPIdev for McSPI3/4 and pin muxing for McBSP3 slave mode\n");
+
+ /* FPGA pin settings configure McSPI 3, McSPI 4 and McBSP 3 */
+ omap3_beagle_config_fpga_mux();
+
+ /* register McSPI 3 and McSPI 4 for FPGA programming and control */
+ spi_register_board_info(beagle_mcspi_board_info, ARRAY_SIZE(beagle_mcspi_board_info));
+ }
+
if (!strcmp(expansionboard2_name, "bbtoys-ulcd"))
{
#if defined(CONFIG_TOUCHSCREEN_TSC2007) || defined(CONFIG_TOUCHSCREEN_TSC2007_MODULE)
--
1.8.2.1