diff options
author | Petter Mabäcker <petter@technux.se> | 2016-03-30 16:35:49 +0200 |
---|---|---|
committer | Andrei Gherzan <andrei@gherzan.ro> | 2016-04-13 03:18:41 +0200 |
commit | e9e4b1bbd23cce97cf8f9d22a9d331e9b4829260 (patch) | |
tree | 7e6c2fa0900f2ab65af3cb16f532fc6e7f091767 | |
parent | e447357ec4a4ecb864e1e7f417185222df258b02 (diff) | |
download | meta-raspberrypi-e9e4b1bbd23cce97cf8f9d22a9d331e9b4829260.tar.gz |
linux-raspberrypi: Drop support for 3.14
General policy is to support three kernel versions; latest stable + two
longterm versions. These are currently 4.4, 4.1, and 3.18.
Signed-off-by: Petter Mabäcker <petter@technux.se>
3 files changed, 0 insertions, 509 deletions
diff --git a/recipes-kernel/linux/linux-raspberrypi-3.14/0001-ASoC-Add-BCM2708-fixes.patch b/recipes-kernel/linux/linux-raspberrypi-3.14/0001-ASoC-Add-BCM2708-fixes.patch deleted file mode 100644 index 26c71b8..0000000 --- a/recipes-kernel/linux/linux-raspberrypi-3.14/0001-ASoC-Add-BCM2708-fixes.patch +++ /dev/null | |||
@@ -1,263 +0,0 @@ | |||
1 | From e73a69601c65103b0e032e6093af0f00a1e1af3a Mon Sep 17 00:00:00 2001 | ||
2 | From: Florian Meier <florian.meier@koalo.de> | ||
3 | Date: Fri, 22 Nov 2013 14:33:38 +0100 | ||
4 | Subject: [PATCH 1/2] ASoC: Add BCM2708 fixes | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | (cherry-pick remaining parts of | ||
10 | 730cb8a1216f9da3d097072cd9bb06e0db348172) | ||
11 | |||
12 | bcm2708-i2s: Update bclk_ratio to more correct values | ||
13 | |||
14 | Move GPIO setup to hw_params. | ||
15 | |||
16 | This is used to stop the I2S driver from breaking | ||
17 | the GPIO setup for other uses of the PCM interface | ||
18 | |||
19 | Configure GPIOs for I2S based on revision/card settings | ||
20 | |||
21 | With RPi model B+, assignment of the I2S GPIO pins has changed. | ||
22 | This patch uses the board revision to auto-detect the GPIOs used | ||
23 | for I2S. It also allows sound card drivers to set the GPIOs that | ||
24 | should be used. This is especially important with the Compute | ||
25 | Module. | ||
26 | |||
27 | bcm2708-i2s: Avoid leak from iomap when accessing gpio | ||
28 | |||
29 | bcm2708: Eliminate i2s debugfs directory error | ||
30 | |||
31 | Qualify the two regmap ranges uses by bcm2708-i2s ('-i2s' and '-clk') | ||
32 | to avoid the name clash when registering debugfs entries. | ||
33 | |||
34 | Upstream-Status: Pending | ||
35 | |||
36 | Signed-off-by: Petter Mabäcker <petter@technux.se> | ||
37 | |||
38 | Conflicts: | ||
39 | sound/soc/bcm/Kconfig | ||
40 | sound/soc/bcm/Makefile | ||
41 | sound/soc/bcm/bcm2708-i2s.c | ||
42 | --- | ||
43 | sound/soc/bcm/bcm2708-i2s.c | 82 ++++++++++++++++++++++++++++++++++++--------- | ||
44 | sound/soc/bcm/bcm2708-i2s.h | 35 +++++++++++++++++++ | ||
45 | 2 files changed, 102 insertions(+), 15 deletions(-) | ||
46 | create mode 100644 sound/soc/bcm/bcm2708-i2s.h | ||
47 | |||
48 | diff --git a/sound/soc/bcm/bcm2708-i2s.c b/sound/soc/bcm/bcm2708-i2s.c | ||
49 | index 9976571..3fcb740 100644 | ||
50 | --- a/sound/soc/bcm/bcm2708-i2s.c | ||
51 | +++ b/sound/soc/bcm/bcm2708-i2s.c | ||
52 | @@ -31,6 +31,8 @@ | ||
53 | * General Public License for more details. | ||
54 | */ | ||
55 | |||
56 | +#include "bcm2708-i2s.h" | ||
57 | + | ||
58 | #include <linux/init.h> | ||
59 | #include <linux/module.h> | ||
60 | #include <linux/device.h> | ||
61 | @@ -38,6 +40,7 @@ | ||
62 | #include <linux/delay.h> | ||
63 | #include <linux/io.h> | ||
64 | #include <linux/clk.h> | ||
65 | +#include <mach/gpio.h> | ||
66 | |||
67 | #include <sound/core.h> | ||
68 | #include <sound/pcm.h> | ||
69 | @@ -46,6 +49,8 @@ | ||
70 | #include <sound/soc.h> | ||
71 | #include <sound/dmaengine_pcm.h> | ||
72 | |||
73 | +#include <asm/system_info.h> | ||
74 | + | ||
75 | /* Clock registers */ | ||
76 | #define BCM2708_CLK_PCMCTL_REG 0x00 | ||
77 | #define BCM2708_CLK_PCMDIV_REG 0x04 | ||
78 | @@ -163,6 +168,9 @@ static const unsigned int bcm2708_clk_freq[BCM2708_CLK_SRC_HDMI+1] = { | ||
79 | #define BCM2708_DMA_DREQ_PCM_TX 2 | ||
80 | #define BCM2708_DMA_DREQ_PCM_RX 3 | ||
81 | |||
82 | +/* I2S pin configuration */ | ||
83 | +static int bcm2708_i2s_gpio=BCM2708_I2S_GPIO_AUTO; | ||
84 | + | ||
85 | /* General device struct */ | ||
86 | struct bcm2708_i2s_dev { | ||
87 | struct device *dev; | ||
88 | @@ -174,6 +182,12 @@ struct bcm2708_i2s_dev { | ||
89 | struct regmap *clk_regmap; | ||
90 | }; | ||
91 | |||
92 | +void bcm2708_i2s_set_gpio(int gpio) { | ||
93 | + bcm2708_i2s_gpio=gpio; | ||
94 | +} | ||
95 | +EXPORT_SYMBOL(bcm2708_i2s_set_gpio); | ||
96 | + | ||
97 | + | ||
98 | static void bcm2708_i2s_start_clock(struct bcm2708_i2s_dev *dev) | ||
99 | { | ||
100 | /* Start the clock if in master mode */ | ||
101 | @@ -306,6 +320,25 @@ static int bcm2708_i2s_set_dai_bclk_ratio(struct snd_soc_dai *dai, | ||
102 | } | ||
103 | |||
104 | |||
105 | +static int bcm2708_i2s_set_function(unsigned offset, int function) | ||
106 | +{ | ||
107 | + #define GPIOFSEL(x) (0x00+(x)*4) | ||
108 | + void __iomem *gpio = __io_address(GPIO_BASE); | ||
109 | + unsigned alt = function <= 3 ? function + 4: function == 4 ? 3 : 2; | ||
110 | + unsigned gpiodir; | ||
111 | + unsigned gpio_bank = offset / 10; | ||
112 | + unsigned gpio_field_offset = (offset - 10 * gpio_bank) * 3; | ||
113 | + | ||
114 | + if (offset >= BCM2708_NR_GPIOS) | ||
115 | + return -EINVAL; | ||
116 | + | ||
117 | + gpiodir = readl(gpio + GPIOFSEL(gpio_bank)); | ||
118 | + gpiodir &= ~(7 << gpio_field_offset); | ||
119 | + gpiodir |= alt << gpio_field_offset; | ||
120 | + writel(gpiodir, gpio + GPIOFSEL(gpio_bank)); | ||
121 | + return 0; | ||
122 | +} | ||
123 | + | ||
124 | static void bcm2708_i2s_setup_gpio(void) | ||
125 | { | ||
126 | /* | ||
127 | @@ -314,20 +347,37 @@ static void bcm2708_i2s_setup_gpio(void) | ||
128 | * TODO Better way would be to handle | ||
129 | * this in the device tree! | ||
130 | */ | ||
131 | -#define INP_GPIO(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3)) | ||
132 | -#define SET_GPIO_ALT(g,a) *(gpio+(((g)/10))) |= (((a)<=3?(a)+4:(a)==4?3:2)<<(((g)%10)*3)) | ||
133 | + int pin,pinconfig,startpin,alt; | ||
134 | + | ||
135 | + /* SPI is on different GPIOs on different boards */ | ||
136 | + /* for Raspberry Pi B+, this is pin GPIO18-21, for original on 28-31 */ | ||
137 | + if (bcm2708_i2s_gpio==BCM2708_I2S_GPIO_AUTO) { | ||
138 | + if ((system_rev & 0xffffff) >= 0x10) { | ||
139 | + /* Model B+ */ | ||
140 | + pinconfig=BCM2708_I2S_GPIO_PIN18; | ||
141 | + } else { | ||
142 | + /* original */ | ||
143 | + pinconfig=BCM2708_I2S_GPIO_PIN28; | ||
144 | + } | ||
145 | + } else { | ||
146 | + pinconfig=bcm2708_i2s_gpio; | ||
147 | + } | ||
148 | |||
149 | - unsigned int *gpio; | ||
150 | - int pin; | ||
151 | - gpio = ioremap(GPIO_BASE, SZ_16K); | ||
152 | + if (pinconfig==BCM2708_I2S_GPIO_PIN18) { | ||
153 | + startpin=18; | ||
154 | + alt=BCM2708_I2S_GPIO_PIN18_ALT; | ||
155 | + } else if (pinconfig==BCM2708_I2S_GPIO_PIN28) { | ||
156 | + startpin=28; | ||
157 | + alt=BCM2708_I2S_GPIO_PIN28_ALT; | ||
158 | + } else { | ||
159 | + printk(KERN_INFO "Can't configure I2S GPIOs, unknown pin mode for I2S: %i\n",pinconfig); | ||
160 | + return; | ||
161 | + } | ||
162 | |||
163 | - /* SPI is on GPIO 7..11 */ | ||
164 | - for (pin = 28; pin <= 31; pin++) { | ||
165 | - INP_GPIO(pin); /* set mode to GPIO input first */ | ||
166 | - SET_GPIO_ALT(pin, 2); /* set mode to ALT 0 */ | ||
167 | + /* configure I2S pins to correct ALT mode */ | ||
168 | + for (pin = startpin; pin <= startpin+3; pin++) { | ||
169 | + bcm2708_i2s_set_function(pin, alt); | ||
170 | } | ||
171 | -#undef INP_GPIO | ||
172 | -#undef SET_GPIO_ALT | ||
173 | } | ||
174 | |||
175 | static int bcm2708_i2s_hw_params(struct snd_pcm_substream *substream, | ||
176 | @@ -372,15 +422,15 @@ static int bcm2708_i2s_hw_params(struct snd_pcm_substream *substream, | ||
177 | switch (params_format(params)) { | ||
178 | case SNDRV_PCM_FORMAT_S16_LE: | ||
179 | data_length = 16; | ||
180 | - bclk_ratio = 40; | ||
181 | + bclk_ratio = 50; | ||
182 | break; | ||
183 | case SNDRV_PCM_FORMAT_S24_LE: | ||
184 | data_length = 24; | ||
185 | - bclk_ratio = 40; | ||
186 | + bclk_ratio = 50; | ||
187 | break; | ||
188 | case SNDRV_PCM_FORMAT_S32_LE: | ||
189 | data_length = 32; | ||
190 | - bclk_ratio = 80; | ||
191 | + bclk_ratio = 100; | ||
192 | break; | ||
193 | default: | ||
194 | return -EINVAL; | ||
195 | @@ -746,7 +796,7 @@ static struct snd_soc_dai_driver bcm2708_i2s_dai = { | ||
196 | .channels_max = 2, | ||
197 | .rates = SNDRV_PCM_RATE_8000_192000, | ||
198 | .formats = SNDRV_PCM_FMTBIT_S16_LE | ||
199 | - // | SNDRV_PCM_FMTBIT_S24_LE : disable for now, it causes white noise with xbmc | ||
200 | + | SNDRV_PCM_FMTBIT_S24_LE | ||
201 | | SNDRV_PCM_FMTBIT_S32_LE | ||
202 | }, | ||
203 | .capture = { | ||
204 | @@ -803,6 +853,7 @@ static const struct regmap_config bcm2708_regmap_config[] = { | ||
205 | .precious_reg = bcm2708_i2s_precious_reg, | ||
206 | .volatile_reg = bcm2708_i2s_volatile_reg, | ||
207 | .cache_type = REGCACHE_RBTREE, | ||
208 | + .name = "i2s", | ||
209 | }, | ||
210 | { | ||
211 | .reg_bits = 32, | ||
212 | @@ -811,6 +862,7 @@ static const struct regmap_config bcm2708_regmap_config[] = { | ||
213 | .max_register = BCM2708_CLK_PCMDIV_REG, | ||
214 | .volatile_reg = bcm2708_clk_volatile_reg, | ||
215 | .cache_type = REGCACHE_RBTREE, | ||
216 | + .name = "clk", | ||
217 | }, | ||
218 | }; | ||
219 | |||
220 | diff --git a/sound/soc/bcm/bcm2708-i2s.h b/sound/soc/bcm/bcm2708-i2s.h | ||
221 | new file mode 100644 | ||
222 | index 0000000..94fed6a | ||
223 | --- /dev/null | ||
224 | +++ b/sound/soc/bcm/bcm2708-i2s.h | ||
225 | @@ -0,0 +1,35 @@ | ||
226 | +/* | ||
227 | + * I2S configuration for sound cards. | ||
228 | + * | ||
229 | + * Copyright (c) 2014 Daniel Matuschek <daniel@hifiberry.com> | ||
230 | + * | ||
231 | + * This program is free software; you can redistribute it and/or modify | ||
232 | + * it under the terms of the GNU General Public License as published by | ||
233 | + * the Free Software Foundation; either version 2 of the License, or | ||
234 | + * (at your option) any later version. | ||
235 | + * | ||
236 | + * This program is distributed in the hope that it will be useful, | ||
237 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
238 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
239 | + * GNU General Public License for more details. | ||
240 | + * | ||
241 | + * You should have received a copy of the GNU General Public License | ||
242 | + * along with this program; if not, write to the Free Software | ||
243 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
244 | + */ | ||
245 | + | ||
246 | +#ifndef BCM2708_I2S_H | ||
247 | +#define BCM2708_I2S_H | ||
248 | + | ||
249 | +/* I2S pin assignment */ | ||
250 | +#define BCM2708_I2S_GPIO_AUTO 0 | ||
251 | +#define BCM2708_I2S_GPIO_PIN18 1 | ||
252 | +#define BCM2708_I2S_GPIO_PIN28 2 | ||
253 | + | ||
254 | +/* Alt mode to enable I2S */ | ||
255 | +#define BCM2708_I2S_GPIO_PIN18_ALT 0 | ||
256 | +#define BCM2708_I2S_GPIO_PIN28_ALT 2 | ||
257 | + | ||
258 | +extern void bcm2708_i2s_set_gpio(int gpio); | ||
259 | + | ||
260 | +#endif | ||
261 | -- | ||
262 | 1.9.1 | ||
263 | |||
diff --git a/recipes-kernel/linux/linux-raspberrypi-3.14/0002-Fix-grabbing-lock-from-atomic-context-in-i2c-driver.patch b/recipes-kernel/linux/linux-raspberrypi-3.14/0002-Fix-grabbing-lock-from-atomic-context-in-i2c-driver.patch deleted file mode 100644 index 907ed7b..0000000 --- a/recipes-kernel/linux/linux-raspberrypi-3.14/0002-Fix-grabbing-lock-from-atomic-context-in-i2c-driver.patch +++ /dev/null | |||
@@ -1,235 +0,0 @@ | |||
1 | From 2c84355bf200f4d19d7078dee2c63011ad715395 Mon Sep 17 00:00:00 2001 | ||
2 | From: jeanleflambeur <catalin.vasile@gmail.com> | ||
3 | Date: Sun, 1 Feb 2015 12:35:38 +0100 | ||
4 | Subject: [PATCH 2/2] Fix grabbing lock from atomic context in i2c driver | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | (cherry-pick from 558d0bfc8fe80ccdccee7f03e881a80965ec987c) | ||
10 | |||
11 | 2 main changes: | ||
12 | - check for timeouts in the bcm2708_bsc_setup function as indicated by this comment: | ||
13 | /* poll for transfer start bit (should only take 1-20 polls) */ | ||
14 | This implies that the setup function can now fail so account for this everywhere it's called | ||
15 | - Removed the clk_get_rate call from inside the setup function as it locks a mutex and that's not ok since we call it from under a spin lock. | ||
16 | |||
17 | removed dead code and update comment | ||
18 | |||
19 | fixed typo in comment | ||
20 | |||
21 | Upstream-Status: Pending | ||
22 | |||
23 | Signed-off-by: Petter Mabäcker <petter@technux.se> | ||
24 | |||
25 | Conflicts: | ||
26 | drivers/i2c/busses/i2c-bcm2708.c | ||
27 | --- | ||
28 | drivers/i2c/busses/i2c-bcm2708.c | 88 +++++++++++++++++++++++++++++----------- | ||
29 | 1 file changed, 65 insertions(+), 23 deletions(-) | ||
30 | |||
31 | diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c | ||
32 | index 05531db..886672c 100644 | ||
33 | --- a/drivers/i2c/busses/i2c-bcm2708.c | ||
34 | +++ b/drivers/i2c/busses/i2c-bcm2708.c | ||
35 | @@ -67,6 +67,7 @@ | ||
36 | #define BSC_S_TA 0x00000001 | ||
37 | |||
38 | #define I2C_TIMEOUT_MS 150 | ||
39 | +#define I2C_WAIT_LOOP_COUNT 40 | ||
40 | |||
41 | #define DRV_NAME "bcm2708_i2c" | ||
42 | |||
43 | @@ -85,6 +86,7 @@ struct bcm2708_i2c { | ||
44 | void __iomem *base; | ||
45 | int irq; | ||
46 | struct clk *clk; | ||
47 | + u32 cdiv; | ||
48 | |||
49 | struct completion done; | ||
50 | |||
51 | @@ -108,10 +110,10 @@ static void bcm2708_i2c_init_pinmode(int id) | ||
52 | int pin; | ||
53 | u32 *gpio = ioremap(0x20200000, SZ_16K); | ||
54 | |||
55 | - BUG_ON(id != 0 && id != 1); | ||
56 | + BUG_ON(id != 0 && id != 1); | ||
57 | /* BSC0 is on GPIO 0 & 1, BSC1 is on GPIO 2 & 3 */ | ||
58 | for (pin = id*2+0; pin <= id*2+1; pin++) { | ||
59 | -printk("bcm2708_i2c_init_pinmode(%d,%d)\n", id, pin); | ||
60 | + printk("bcm2708_i2c_init_pinmode(%d,%d)\n", id, pin); | ||
61 | INP_GPIO(pin); /* set mode to GPIO input first */ | ||
62 | SET_GPIO_ALT(pin, 0); /* set mode to ALT 0 */ | ||
63 | } | ||
64 | @@ -150,16 +152,16 @@ static inline void bcm2708_bsc_fifo_fill(struct bcm2708_i2c *bi) | ||
65 | bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]); | ||
66 | } | ||
67 | |||
68 | -static inline void bcm2708_bsc_setup(struct bcm2708_i2c *bi) | ||
69 | +static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) | ||
70 | { | ||
71 | - unsigned long bus_hz; | ||
72 | u32 cdiv, s; | ||
73 | u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; | ||
74 | + int wait_loops = I2C_WAIT_LOOP_COUNT; | ||
75 | |||
76 | - bus_hz = clk_get_rate(bi->clk); | ||
77 | - cdiv = bus_hz / baudrate; | ||
78 | - if (cdiv > 0xffff) | ||
79 | - cdiv = 0xffff; | ||
80 | + /* Can't call clk_get_rate as it locks a mutex and here we are spinlocked. | ||
81 | + * Use the value that we cached in the probe. | ||
82 | + */ | ||
83 | + cdiv = bi->cdiv; | ||
84 | |||
85 | if (bi->msg->flags & I2C_M_RD) | ||
86 | c |= BSC_C_INTR | BSC_C_READ; | ||
87 | @@ -176,17 +178,25 @@ static inline void bcm2708_bsc_setup(struct bcm2708_i2c *bi) | ||
88 | - Both messages to same slave address | ||
89 | - Write message can fit inside FIFO (16 bytes or less) */ | ||
90 | if ( (bi->nmsgs > 1) && | ||
91 | - !(bi->msg[0].flags & I2C_M_RD) && (bi->msg[1].flags & I2C_M_RD) && | ||
92 | - (bi->msg[0].addr == bi->msg[1].addr) && (bi->msg[0].len <= 16)) { | ||
93 | + !(bi->msg[0].flags & I2C_M_RD) && (bi->msg[1].flags & I2C_M_RD) && | ||
94 | + (bi->msg[0].addr == bi->msg[1].addr) && (bi->msg[0].len <= 16)) { | ||
95 | /* Fill FIFO with entire write message (16 byte FIFO) */ | ||
96 | - while (bi->pos < bi->msg->len) | ||
97 | + while (bi->pos < bi->msg->len) { | ||
98 | bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]); | ||
99 | + } | ||
100 | /* Start write transfer (no interrupts, don't clear FIFO) */ | ||
101 | bcm2708_wr(bi, BSC_C, BSC_C_I2CEN | BSC_C_ST); | ||
102 | + | ||
103 | /* poll for transfer start bit (should only take 1-20 polls) */ | ||
104 | do { | ||
105 | s = bcm2708_rd(bi, BSC_S); | ||
106 | - } while (!(s & (BSC_S_TA | BSC_S_ERR | BSC_S_CLKT | BSC_S_DONE))); | ||
107 | + } while (!(s & (BSC_S_TA | BSC_S_ERR | BSC_S_CLKT | BSC_S_DONE)) && --wait_loops >= 0); | ||
108 | + | ||
109 | + /* did we time out or some error occured? */ | ||
110 | + if (wait_loops < 0 || (s & (BSC_S_ERR | BSC_S_CLKT))) { | ||
111 | + return -1; | ||
112 | + } | ||
113 | + | ||
114 | /* Send next read message before the write transfer finishes. */ | ||
115 | bi->nmsgs--; | ||
116 | bi->msg++; | ||
117 | @@ -196,6 +206,8 @@ static inline void bcm2708_bsc_setup(struct bcm2708_i2c *bi) | ||
118 | } | ||
119 | } | ||
120 | bcm2708_wr(bi, BSC_C, c); | ||
121 | + | ||
122 | + return 0; | ||
123 | } | ||
124 | |||
125 | static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id) | ||
126 | @@ -203,13 +215,15 @@ static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id) | ||
127 | struct bcm2708_i2c *bi = dev_id; | ||
128 | bool handled = true; | ||
129 | u32 s; | ||
130 | + int ret; | ||
131 | |||
132 | spin_lock(&bi->lock); | ||
133 | |||
134 | /* we may see camera interrupts on the "other" I2C channel | ||
135 | - Just return if we've not sent anything */ | ||
136 | - if (!bi->nmsgs || !bi->msg ) | ||
137 | + Just return if we've not sent anything */ | ||
138 | + if (!bi->nmsgs || !bi->msg) { | ||
139 | goto early_exit; | ||
140 | + } | ||
141 | |||
142 | s = bcm2708_rd(bi, BSC_S); | ||
143 | |||
144 | @@ -217,13 +231,16 @@ static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id) | ||
145 | bcm2708_bsc_reset(bi); | ||
146 | bi->error = true; | ||
147 | |||
148 | + bi->msg = 0; /* to inform the that all work is done */ | ||
149 | + bi->nmsgs = 0; | ||
150 | /* wake up our bh */ | ||
151 | complete(&bi->done); | ||
152 | } else if (s & BSC_S_DONE) { | ||
153 | bi->nmsgs--; | ||
154 | |||
155 | - if (bi->msg->flags & I2C_M_RD) | ||
156 | + if (bi->msg->flags & I2C_M_RD) { | ||
157 | bcm2708_bsc_fifo_drain(bi); | ||
158 | + } | ||
159 | |||
160 | bcm2708_bsc_reset(bi); | ||
161 | |||
162 | @@ -231,8 +248,19 @@ static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id) | ||
163 | /* advance to next message */ | ||
164 | bi->msg++; | ||
165 | bi->pos = 0; | ||
166 | - bcm2708_bsc_setup(bi); | ||
167 | + ret = bcm2708_bsc_setup(bi); | ||
168 | + if (ret < 0) { | ||
169 | + bcm2708_bsc_reset(bi); | ||
170 | + bi->error = true; | ||
171 | + bi->msg = 0; /* to inform the that all work is done */ | ||
172 | + bi->nmsgs = 0; | ||
173 | + /* wake up our bh */ | ||
174 | + complete(&bi->done); | ||
175 | + goto early_exit; | ||
176 | + } | ||
177 | } else { | ||
178 | + bi->msg = 0; /* to inform the that all work is done */ | ||
179 | + bi->nmsgs = 0; | ||
180 | /* wake up our bh */ | ||
181 | complete(&bi->done); | ||
182 | } | ||
183 | @@ -265,21 +293,34 @@ static int bcm2708_i2c_master_xfer(struct i2c_adapter *adap, | ||
184 | bi->nmsgs = num; | ||
185 | bi->error = false; | ||
186 | |||
187 | + ret = bcm2708_bsc_setup(bi); | ||
188 | spin_unlock_irqrestore(&bi->lock, flags); | ||
189 | |||
190 | bcm2708_bsc_setup(bi); | ||
191 | |||
192 | - ret = wait_for_completion_timeout(&bi->done, | ||
193 | - msecs_to_jiffies(I2C_TIMEOUT_MS)); | ||
194 | + /* check the result of the setup */ | ||
195 | + if (ret < 0) | ||
196 | + { | ||
197 | + dev_err(&adap->dev, "transfer setup timed out\n"); | ||
198 | + goto error_timeout; | ||
199 | + } | ||
200 | + | ||
201 | + ret = wait_for_completion_timeout(&bi->done, msecs_to_jiffies(I2C_TIMEOUT_MS)); | ||
202 | if (ret == 0) { | ||
203 | dev_err(&adap->dev, "transfer timed out\n"); | ||
204 | - spin_lock_irqsave(&bi->lock, flags); | ||
205 | - bcm2708_bsc_reset(bi); | ||
206 | - spin_unlock_irqrestore(&bi->lock, flags); | ||
207 | - return -ETIMEDOUT; | ||
208 | + goto error_timeout; | ||
209 | } | ||
210 | |||
211 | - return bi->error ? -EIO : num; | ||
212 | + ret = bi->error ? -EIO : num; | ||
213 | + return ret; | ||
214 | + | ||
215 | +error_timeout: | ||
216 | + spin_lock_irqsave(&bi->lock, flags); | ||
217 | + bcm2708_bsc_reset(bi); | ||
218 | + bi->msg = 0; /* to inform the interrupt handler that there's nothing else to be done */ | ||
219 | + bi->nmsgs = 0; | ||
220 | + spin_unlock_irqrestore(&bi->lock, flags); | ||
221 | + return -ETIMEDOUT; | ||
222 | } | ||
223 | |||
224 | static u32 bcm2708_i2c_functionality(struct i2c_adapter *adap) | ||
225 | @@ -382,6 +423,7 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) | ||
226 | cdiv = 0xffff; | ||
227 | baudrate = bus_hz / cdiv; | ||
228 | } | ||
229 | + bi->cdiv = cdiv; | ||
230 | |||
231 | dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", | ||
232 | pdev->id, (unsigned long)regs->start, irq, baudrate); | ||
233 | -- | ||
234 | 1.9.1 | ||
235 | |||
diff --git a/recipes-kernel/linux/linux-raspberrypi_3.14.bb b/recipes-kernel/linux/linux-raspberrypi_3.14.bb deleted file mode 100644 index f6e6291..0000000 --- a/recipes-kernel/linux/linux-raspberrypi_3.14.bb +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:" | ||
2 | |||
3 | LINUX_VERSION ?= "3.14.28" | ||
4 | |||
5 | SRCREV = "e294028d7733a30f3befacc41d473c251096a515" | ||
6 | SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.14.y \ | ||
7 | file://0001-ASoC-Add-BCM2708-fixes.patch \ | ||
8 | file://0002-Fix-grabbing-lock-from-atomic-context-in-i2c-driver.patch \ | ||
9 | " | ||
10 | |||
11 | require linux-raspberrypi.inc | ||