Compare commits

..

165 Commits
tag1 ... tag2

Author SHA1 Message Date
Phil Elwell
41a5ce7cdf Merge pull request #960 from pranith/rpi-4.0.y
vchiq: Fix wrong condition check
2015-05-08 17:12:42 +01:00
Pranith Kumar
c7f63111ea vchiq: Fix wrong condition check
The log level is checked from within the log call. Remove the check in the call.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
2015-05-07 17:48:27 -04:00
popcornmix
fe2ea3e054 bcm2835-mmc: Add locks when accessing sdhost registers 2015-05-05 23:06:57 +01:00
popcornmix
b8a19a3a52 Revert "bcm2835-mmc: Add range of debug options for slowing things down"
This reverts commit f36bd72cd2.
2015-05-05 23:03:28 +01:00
popcornmix
4c0553ea01 Revert "bcm2835-mmc: Add option to disable MMC_QUIRK_BLK_NO_CMD23"
This reverts commit 497dbba490.
2015-05-05 23:01:44 +01:00
popcornmix
3fefacdc8e Revert "bcm2835-mmc: Default to disabling MMC_QUIRK_BLK_NO_CMD23"
This reverts commit 488911bc7c.
2015-05-05 23:01:39 +01:00
popcornmix
a52246c79a Revert "bcm2835-mmc: Add option to disable some delays"
This reverts commit d2a4b3ddb4.
2015-05-05 23:00:28 +01:00
popcornmix
95ae72d689 Revert "bcm2835-mmc: Add option to disable delays on some writeb calls"
This reverts commit aa6b3e63fa.
2015-05-05 23:00:19 +01:00
popcornmix
73f24007e9 Revert "bcm2835-mmc: warn on accesses without spinlock"
This reverts commit 39315a8ea7.
2015-05-05 23:00:10 +01:00
popcornmix
a7865cec51 Revert "bcm2835-mmc: Add locks when accessing sdhost registers"
This reverts commit 547b7363c0.
2015-05-05 23:00:01 +01:00
Peter Kümmel
cb97407b94 8192cu: CONFIG_AP_MODE hardcoded in autoconf.h 2015-05-05 15:37:27 +01:00
Christopher Freeman
cb9d41ece0 dmaengine: increment privatecnt when using dma_get_any_slave_channel
Channels allocated via dma_get_any_slave_channel were not increasing
the counter tracking private allocations.  When these channels were
released, privatecnt may erroneously fall to zero.  The DMA device
would then lose its DMA_PRIVATE cap and fail to allocate future private
channels (via private_candidate) as any allocations still outstanding
would incorrectly be seen as public allocations.

Signed-off-by: Christopher Freeman <cfreeman@nvidia.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-05-05 15:23:49 +01:00
popcornmix
121d87c832 squash: bcm2709: Fix build with SYSTEM_TIMER defined 2015-05-05 15:19:58 +01:00
popcornmix
ef2659470b squash: dwc_otg: Allow to build without SMP 2015-05-05 15:19:57 +01:00
popcornmix
12149d45fa squash: entry_macro: Allow to build without SMP 2015-05-05 15:19:57 +01:00
popcornmix
a80e690cd5 squash: bcm2709: Allow to build without SMP 2015-05-05 15:19:56 +01:00
popcornmix
75c5da712b Merge pull request #954 from pelwell/rpi-4.0.y
bcm2835-mmc/sdhost: of_dma_request_slave_channel isn't exported
2015-05-05 15:19:23 +01:00
Phil Elwell
503ce7c5d4 bcm2835-mmc/sdhost: of_dma_request_slave_channel isn't exported...
of_dma_request_slave_channel isn't an exported function, so can't be
used from within a module. Replace with dma_request_slave_channel,
which calls the of_ variant but IS exported.

See: https://github.com/raspberrypi/linux/issues/952

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2015-05-05 15:03:59 +01:00
Phil Elwell
fdc5e42967 squash: sdhost support for faster core clocks, and force-pio mode 2015-05-01 18:38:04 +01:00
popcornmix
547b7363c0 bcm2835-mmc: Add locks when accessing sdhost registers 2015-05-01 18:35:38 +01:00
popcornmix
39315a8ea7 bcm2835-mmc: warn on accesses without spinlock 2015-05-01 17:46:56 +01:00
popcornmix
aa6b3e63fa bcm2835-mmc: Add option to disable delays on some writeb calls 2015-05-01 17:46:16 +01:00
popcornmix
67fd2c5af2 vchiq: Allocation does not need to be atomic 2015-05-01 15:32:32 +01:00
Noralf Trønnes
2e7d6a25e8 bcm2835: Change to use bcm2835-mmc in Device Tree
Use downstream bcm2835-mmc driver to get increased throughput
and DMA support.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:32:31 +01:00
Noralf Trønnes
5f6edf81df bcm2835: bcm2835_defconfig enable MMC_BCM2835
Enable the downstream bcm2835-mmc driver and DMA support.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:32:30 +01:00
Noralf Trønnes
a7be6fff3d mmc: bcm2835-mmc: Make available on ARCH_BCM2835
Make the bcm2835-mmc driver available for use on ARCH_BCM2835.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:32:29 +01:00
Noralf Trønnes
4e2b210eeb bcm2835: bcm2835_defconfig
Some options in bcm2835_defconfig are now the default and
some have changed. Update to keep functionality.

No longer available: SCSI_MULTI_LUN and RESOURCE_COUNTERS.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:32:29 +01:00
Noralf Trønnes
757e5f795c BCM270x: Remove dmaman device
Remove the dmaman device since the dmaengine now handles
the legacy API manager.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:32:28 +01:00
Noralf Trønnes
0e5fbba02c BCM270x: dma: Remove driver
Remove dma.c driver which is now merged with bcm2708-dmaengine.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:32:27 +01:00
Noralf Trønnes
c738deeab4 dmaengine: bcm2708: Merge with arch dma.c driver and disable dma.c
Merge the legacy DMA API driver with bcm2708-dmaengine.
This is done so we can use bcm2708_fb on ARCH_BCM2835 (mailbox
driver is also needed).

Changes to the dma.c code:
- Use BIT() macro.
- Cutdown some comments to one line.
- Add mutex to vc_dmaman and use this, since the dev lock is locked
  during probing of the engine part.
- Add global g_dmaman variable since drvdata is used by the engine part.
- Restructure for readability:
  vc_dmaman_chan_alloc()
  vc_dmaman_chan_free()
  bcm_dma_chan_free()
- Restructure bcm_dma_chan_alloc() to simplify error handling.
- Use device irq resources instead of hardcoded bcm_dma_irqs table.
- Remove dev_dmaman_register() and code it directly.
- Remove dev_dmaman_deregister() and code it directly.
- Simplify bcm_dmaman_probe() using devm_* functions.
- Get dmachans from DT if available.
- Keep 'dma.dmachans' module argument name for backwards compatibility.

Make it available on ARCH_BCM2835 as well.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:32:26 +01:00
Noralf Trønnes
d0ad183e75 BCM270x: Add memory and irq resources to dmaengine device and DT
Prepare for merging of the legacy DMA API arch driver dma.c
with bcm2708-dmaengine by adding memory and irq resources both
to platform file device and Device Tree node.
Don't use BCM_DMAMAN_DRIVER_NAME so we don't have to include mach/dma.h

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:32:25 +01:00
Phil Elwell
da9969b245 Adding bcm2835-sdhost driver, and an overlay to enable it
BCM2835 has two SD card interfaces. This driver uses the other one.
2015-05-01 15:17:59 +01:00
Phil Elwell
ff0caccc60 Add blk_pos parameter to mmc multi_io_quirk callback 2015-05-01 15:17:55 +01:00
popcornmix
488911bc7c bcm2835-mmc: Default to disabling MMC_QUIRK_BLK_NO_CMD23 2015-05-01 15:17:54 +01:00
popcornmix
d2a4b3ddb4 bcm2835-mmc: Add option to disable some delays 2015-05-01 15:17:53 +01:00
Peter Kümmel
4c864893b1 8192cu needs old wireless extensions
The obsolete WIRELESS_EXT configuration is used
by the old Realtek code and is needed for AP support.
2015-05-01 15:17:53 +01:00
popcornmix
497dbba490 bcm2835-mmc: Add option to disable MMC_QUIRK_BLK_NO_CMD23 2015-05-01 15:17:52 +01:00
popcornmix
5aac453ca2 bcm2708-dmaengine: Add debug options 2015-05-01 15:17:51 +01:00
Daniel Matuschek
5e29e90fd3 HiFiBerry Digi: set SPDIF status bits for sample rate
The HiFiBerry Digi driver did not signal the sample rate in the SPDIF status bits.
While this is optional, some DACs and receivers do not accept this signal. This patch
adds the sample rate bits in the SPDIF status block.
2015-05-01 15:17:50 +01:00
popcornmix
e2a06a85f9 smsc95xx: Disable turbo mode by default 2015-05-01 15:17:49 +01:00
Steve Glendinning
6b23b3c1fd smsx95xx: fix crimes against truesize
smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings.

This patch stops smsc95xx from changing truesize.

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
2015-05-01 15:17:48 +01:00
Martin Sperl
49bbfbdf10 spi: bcm2835: change timeout of polling driver to 1s
The way that the timeout code is written in the polling function
the timeout does also trigger when interrupted or rescheduled while
in the polling loop.

This patch changes the timeout from effectively 20ms (=2 jiffies) to
1 second and removes the time that the transfer really takes out of
the computation, as - per design - this is <30us and the jiffie resolution
is 10ms so that does not make any difference what so ever.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
2015-05-01 15:17:47 +01:00
Martin Sperl
e45ccf9253 spi: bcm2835: enabling polling mode for transfers shorter than 30us
In cases of short transfer times the CPU is spending lots of time
in the interrupt handler and scheduler to reschedule the worker thread.

Measurements show that we have times where it takes 29.32us to between
the last clock change and the time that the worker-thread is running again
returning from wait_for_completion_timeout().

During this time the interrupt-handler is running calling complete()
and then also the scheduler is rescheduling the worker thread.

This time can vary depending on how much of the code is still in
CPU-caches, when there is a burst of spi transfers the subsequent delays
are in the order of 25us, so the value of 30us seems reasonable.

With polling the whole transfer of 4 bytes at 10MHz finishes after 6.16us
(CS down to up) with the real transfer (clock running) taking 3.56us.
So the efficiency has much improved and is also freeing CPU cycles,
reducing interrupts and context switches.

Because of the above 30us seems to be a reasonable limit for polling.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01 15:17:46 +01:00
Martin Sperl
53bdf60401 spi: bcm2835: transform native-cs to gpio-cs on first spi_setup
Transforms the bcm-2835 native SPI-chip select to their gpio-cs equivalent.

This allows for some support of some optimizations that are not
possible due to HW-gliches on the CS line - especially filling
the FIFO before enabling SPI interrupts (by writing to CS register)
while the transfer is already in progress (See commit: e3a2be3030)

This patch also works arround some issues in bcm2835-pinctrl which does not
set the value when setting the GPIO as output - it just sets up output and
(typically) leaves the GPIO as low.  When a fix for this is merged then this
gpio_set_value can get removed from bcm2835_spi_setup.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01 15:17:45 +01:00
Martin Sperl
37f9415e2b spi: bcm2835: fill FIFO before enabling interrupts to reduce interrupts/message
To reduce the number of interrupts/message we fill the FIFO before
enabling interrupts - for short messages this reduces the interrupt count
from 2 to 1 interrupt.

There have been rare cases where short (<200ns) chip-select switches with
native CS have been observed during such operation, this is why this
optimization is only enabled for GPIO-CS.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Tested-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01 15:17:44 +01:00
Martin Sperl
a6eb700e27 spi: bcm2835: fix code formatting issue
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Tested-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01 15:17:43 +01:00
Martin Sperl
941e9c41fb spi: bcm2835: move to the transfer_one driver model
This also allows for GPIO-CS to get used removing the limitation of
2/3 SPI devises on the SPI bus.

Fixes: spi-cs-high with native CS with multiple devices on the spi-bus
resetting the chip selects to "normal" polarity after a finished
transfer.

No other functionality/improvements added.

Tested with the following 4 devices on the spi-bus:
* mcp2515 with native CS
* mcp2515 with gpio CS
* fb_st7735r with native CS
    (plus spi-cs-high via transistor inverting polarity)
* enc28j60 with gpio-CS
Tested-by: Martin Sperl <kernel@martin.sperl.org>

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01 15:17:42 +01:00
Martin Sperl
dfc9858b6b spi: bcm2835: enable support of 3-wire mode
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01 15:17:41 +01:00
Martin Sperl
ef109c1aa5 spi: bcm2835: clock divider can be a multiple of 2
The official documentation is wrong in this respect.
Has been tested empirically for dividers 2-1024

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01 15:17:40 +01:00
Martin Sperl
9520a8428a spi: bcm2835: fill/drain SPI-fifo as much as possible during interrupt
Implement the recommendation from the BCM2835 data-sheet
with regards to polling drivers to fill/drain the FIFO as much data as possible
also for the interrupt-driven case (which this driver is making use of).

This means that for long transfers (>64bytes) we need one interrupt
every 64 bytes instead of every 12 bytes, as the FIFO is 16 words (not bytes) wide.

Tested with mcp251x (can bus), fb_st7735 (TFT framebuffer device)
and enc28j60 (ethernet) drivers.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01 15:17:40 +01:00
Martin Sperl
c81f2f73fe spi: bcm2835: fix all checkpath --strict messages
The following errors/warnings issued by checkpatch.pl --strict have been fixed:
drivers/spi/spi-bcm2835.c:182: CHECK: Alignment should match open parenthesis
drivers/spi/spi-bcm2835.c:191: CHECK: braces {} should be used on all arms of this statement
drivers/spi/spi-bcm2835.c:234: CHECK: Alignment should match open parenthesis
drivers/spi/spi-bcm2835.c:256: CHECK: Alignment should match open parenthesis
drivers/spi/spi-bcm2835.c:271: CHECK: Alignment should match open parenthesis
drivers/spi/spi-bcm2835.c:346: CHECK: Alignment should match open parenthesis
total: 0 errors, 0 warnings, 6 checks, 403 lines checked

In 2 locations the arguments had to get split/moved to the next line so that the
line width stays below 80 chars.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01 15:17:39 +01:00
popcornmix
f36bd72cd2 bcm2835-mmc: Add range of debug options for slowing things down 2015-05-01 15:17:38 +01:00
Jakub Kicinski
9d99e3183e bcm2708: fix uart1 parameters
System clock is 250MHz, but the device uses a non-standard
oversampling rate (8 instead of 16) hence the clock rate
has to be multiplied by 16/8 = 2.  Currently the clock
rate seems to be divided by 2.

Also correct the .type and .flags.

Signed-off-by: Jakub Kicinski <kubakici@wp.pl>
2015-05-01 15:17:37 +01:00
popcornmix
b623558975 config: Add default configs 2015-05-01 15:17:36 +01:00
Clive Messer
c4d32dd8e8 Add Device Tree support for RPi-DAC. 2015-05-01 15:17:35 +01:00
Waldemar Brodkorb
cfb7979048 Add driver for rpi-proto
Forward port of 3.10.x driver from https://github.com/koalo
We are using a custom board and would like to use rpi 3.18.x
kernel. Patch works fine for our embedded system.

URL to the audio chip:
http://www.mikroe.com/add-on-boards/audio-voice/audio-codec-proto/

Playback tested with devicetree enabled.

Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de>
2015-05-01 15:17:34 +01:00
Phil Elwell
c4e46a88eb BCM270x_DT: Refactor bcm2708.dtsi and bcm2709.dtsi
Extract the common elements, creating bcm2708_common.dtsi
2015-05-01 15:17:33 +01:00
Noralf Trønnes
5bd50eacb5 BCM270x_DT: add bcm2835-mmc entry
Add Device Tree entry for bcm2835-mmc.
In non-DT mode, don't add the device in the board file.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:17:32 +01:00
Noralf Trønnes
8bf4bde8c8 bcm270x: add mmc-bcm2835 clock
Add clock for the mmc-bcm2835.0 device.
Will be used in non-DT mode.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:17:31 +01:00
Noralf Trønnes
f65dc605f7 BCM270x_DT: add bcm2835-dma entry
Add Device Tree entry for bcm2835-dma.
The entry doesn't contain any resources since they are handled
by the arch/arm/mach-bcm270x/dma.c driver.
In non-DT mode, don't add the device in the board file.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:17:31 +01:00
Noralf Trønnes
3cd0c5268c dts: overlay: rpi-display: pullup irq gpio
An early version of rpi-display needs the touch controller irq
to be pulled up. This is the version with 9-bit SPI as default.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:17:30 +01:00
Noralf Trønnes
e242a6168a dts: overlay: piscreen: set speed to 24MHz
Some of the displays can't handle the 32MHz speed.
Lower the default speed to 24MHz.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:17:29 +01:00
Noralf Trønnes
962f055d35 dts: overlay: add support for MZ61581 display
Add Device Tree overlay for MZ61581 display by Tontec.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:17:28 +01:00
Martin Sperl
db632c4852 enable compiling spi-bcm2835 and add overlay to allow us to load the driver 2015-05-01 15:17:27 +01:00
Noralf Trønnes
1f2eb975fb dts: overlay: add support for Adafruit PiTFT
Add DT overlay for the Adafruit PiTFT 2.8" resistive touch screen

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:17:26 +01:00
Phil Elwell
7d5e61de5f enc28j60: Add device tree compatible string and an overlay 2015-05-01 15:17:25 +01:00
Noralf Trønnes
712e74ab35 dts: overlay: add support for PiScreen display
Add Device Tree overlay for PiScreen display by OzzMaker.com

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:17:24 +01:00
Noralf Trønnes
3319258136 dts: overlay: add support for HY28B display
Add Device Tree overlay for HY28B display by HAOYU Electronics.
Default values are set to match Texy's display shield.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:17:24 +01:00
Noralf Trønnes
85f41ebf84 dts: overlay: add support for HY28A display
Add Device Tree overlay for HY28A display by HAOYU Electronics.
Default values are set to match Texy's display shield.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:17:23 +01:00
Noralf Trønnes
c667acb84f dts: overlay: add support for rpi-display
Add Device Tree overlay for rpi-display by Watterott.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:17:22 +01:00
Jon Burgess
04fa1b67cc Create generic i2c-rtc overlay for supporting ds1307, ds3231, pcf2127 and pcf8523.
Signed-off-by: Jon Burgess <jburgess777@gmail.com>
2015-05-01 15:17:21 +01:00
Dave Martin
103c9b4d22 serial/amba-pl011: Refactor and simplify TX FIFO handling
Commit 734745c serial/amba-pl011: Activate TX IRQ passively
adds some complexity and overhead in the form of a softirq
mechanism for transmitting in the absence of interrupts.

This patch simplifies the code flow to reduce the reliance on
subtle behaviour and avoid fragility under future maintenance.

To this end, the TX softirq mechanism is removed and instead
pl011_start_tx() will now simply stuff the FIFO until full
(guaranteeing future TX IRQs), or until there are no more chars
to write (in which case we don't care whether an IRQ happens).

Signed-off-by: Dave Martin <Dave.Martin@xxxxxxx>
Signed-off-by: Jakub Kicinski <kubakici@xxxxx>
2015-05-01 15:17:20 +01:00
Dave Martin
97ee564535 serial/amba-pl011: Activate TX IRQ passively
The current PL011 driver transmits a dummy character when the UART
is opened, to assert the TX IRQ for the first time
(see pl011_startup()).  The UART is put in loopback mode temporarily,
so the receiver presumably shouldn't see anything.

However...

At least some platforms containing a PL011 send characters down the
wire even when loopback mode is enabled.  This means that a
spurious NUL character may be seen at the receiver when the PL011 is
opened through the TTY layer.

The current code also temporarily sets the baud rate to maximum and
the character width to the minimum, to that the dummy TX completes
as quickly as possible.  If this is seen by the receiver it will
result in a framing error and can knock the receiver out of sync --
turning subsequent output into garbage until synchronisation
is reestablished.  (Particularly problematic during boot with systemd.)

To avoid spurious transmissions, this patch removes assumptions about
whether the TX IRQ will fire until at least one TX IRQ has been seen.

Instead, the UART will unmask the TX IRQ and then slow-start via
polling and timer-based soft IRQs initially.  If the TTY layer writes
enough data to fill the FIFO to the interrupt threshold in one go,
the TX IRQ should assert, at which point the driver changes to
fully interrupt-driven TX.

In this way, the TX IRQ is activated as a side-effect instead of
being done deliberately.

This should also mean that the driver works on the SBSA Generic
UART[1] (a cut-down PL011) without invasive changes.  The Generic
UART lacks some features needed for the dummy TX approach to work
(FIFO disabling and loopback).

[1] Server Base System Architecture (ARM-DEN-0029-v2.3)
    http://infocenter.arm.com/
    (click-thru required :/)

Signed-off-by: Dave Martin <Dave.Martin@xxxxxxx>
2015-05-01 15:17:19 +01:00
Phil Elwell
f84f3792f8 pinctrl-bcm2835: Only request the interrupts listed in the DTB
Although the GPIO controller can generate three interrupts (four counting
the common one), the device tree files currently only specify two. In the
absence of the third, simply don't register that interrupt (as opposed to
registering 0), which has the effect of making it impossible to generate
interrupts for GPIOs 46-53 which, since they share pins with the SD card
interface, is unlikely to be a problem.
2015-05-01 15:17:18 +01:00
Phil Elwell
6f6691ec5a pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53
Contrary to the documentation, the BCM2835 GPIO controller actually has
four interrupt lines - one each for the three IRQ groups and one common. Rather
confusingly, the GPIO interrupt groups don't correspond directly with the GPIO
control banks. Instead, GPIOs 0-27 generate IRQ GPIO0, 28-45 GPIO1 and
46-53 GPIO2.

Awkwardly, the GPIOS for IRQ GPIO1 straddle two 32-entry GPIO banks, so it is
cleaner to split out a function to process the interrupts for a single GPIO
bank.

This bug has only just been observed because GPIOs above 27 can only be
accessed on an old Raspberry Pi with the optional P5 header fitted, where
the pins are often used for I2S instead.
2015-05-01 15:17:17 +01:00
Rainer Herbers
1054dcb8e6 Create bmp085_i2c-sensor-overlay.dts and update Makefile 2015-05-01 15:17:16 +01:00
Phil Elwell
1d773d31a5 Fix LED "input" trigger implementation for 3.19 2015-05-01 15:17:16 +01:00
jeanleflambeur
e42746b1c9 Fix grabbing lock from atomic context in i2c driver
2 main changes:
- check for timeouts in the bcm2708_bsc_setup function as indicated by this comment:
      /* poll for transfer start bit (should only take 1-20 polls) */
  This implies that the setup function can now fail so account for this everywhere it's called
- 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.

removed dead code and update comment

fixed typo in comment
2015-05-01 15:17:15 +01:00
android
604eef02f1 BCM2708_VCIO : Add automatic creation of device node 2015-05-01 15:17:14 +01:00
Byron Bradley
6c1a859165 Add device-tree overlay for pcf2127
Signed-off-by: Byron Bradley <byronb@afterthoughtsoftware.com>
2015-05-01 15:17:13 +01:00
Phil Elwell
0ef85a9dc0 i2c_bcm2708: Fix clock reference counting 2015-05-01 15:17:12 +01:00
Phil Elwell
7ea41787ab w1-gpio: Sort out the pullup/parasitic power tangle 2015-05-01 15:17:11 +01:00
Phil Elwell
9ca7fc789a pinctrl-bcm2835: bcm2835_gpio_direction_output must set the value 2015-05-01 15:17:10 +01:00
Phil Elwell
913d3a3c76 BCM270x_DT: Add i2c0_baudrate and i2c1_baudrate parameters 2015-05-01 15:17:09 +01:00
Daniel Matuschek
5bb524a3e3 HiFiBerry Amp: fix device-tree problems
Some code to load the driver based on device-tree-overlays was missing. This is added by this patch.
2015-05-01 15:17:08 +01:00
popcornmix
ec616ff69f bcm2709: Simplify and strip down IRQ handler 2015-05-01 15:17:07 +01:00
Phil Elwell
21a00874bd BCM270x_DT: Add pwr_led, and the required "input" trigger
The "input" trigger makes the associated GPIO an input.  This is to support
the Raspberry Pi PWR LED, which is driven by external hardware in normal use.

N.B. pwr_led is not available on Model A or B boards.
2015-05-01 15:17:07 +01:00
Ryan Coe
c29e2b5781 Add device-tree overlay for ds1307
Signed-off-by: Ryan Coe <bluemrp9@gmail.com>
2015-05-01 15:17:06 +01:00
Ryan Coe
79e41e4a63 Update ds1307 driver for device-tree support
Signed-off-by: Ryan Coe <bluemrp9@gmail.com>
2015-05-01 15:17:05 +01:00
Joerg Hohensohn
d1b18954b2 bugfix for 32kHz sample rate, was missing 2015-05-01 15:17:04 +01:00
Daniel Matuschek
8b09a2b295 Add a parameter to turn off SPDIF output if no audio is playing
This patch adds the paramater auto_shutdown_output to the kernel module.
Default behaviour of the module is the same, but when auto_shutdown_output
is set to 1, the SPDIF oputput will shutdown if no stream is playing.
2015-05-01 15:17:03 +01:00
Phil Elwell
67b07b343f BCM2708_DT: Add pcf8523-rtc overlay 2015-05-01 15:17:02 +01:00
Serge Schneider
b85ff8bd83 I2C: Only register the I2C device for the current board revision 2015-05-01 15:17:01 +01:00
Timo Kokkonen
fc55e032dd Added support to reserve/enable a GPIO pin to be used from pps-gpio module (LinuxPPS). Enable PPS modules in default config for RPi. 2015-05-01 15:17:00 +01:00
Phil Elwell
231e60fed4 Add pps-gpio DT overlay
Parameters:
    gpiopin=<input pin>    // Default 18
2015-05-01 15:16:59 +01:00
Daniel Matuschek
04543b4caa Add device tree overlay for HiFiBerry Amp/Amp+
This patch add the missing device tree file for the HiFiBerry Amp and Amp+ boards.
2015-05-01 15:16:58 +01:00
Phil Elwell
0b07678de5 BCM2708_DT: Build the overlays as well 2015-05-01 15:16:57 +01:00
Phil Elwell
c70c2040d0 scripts/dtc: Update to upstream version with overlay patches 2015-05-01 15:16:56 +01:00
Daniel Matuschek
f24e351f43 TAS5713: return error if initialisation fails
Existing TAS5713 driver logs errors during initialisation, but does not return
an error code. Therefore even if initialisation fails, the driver will still be
loaded, but won't work. This patch fixes this. I2C communication error will now
reported correctly by a non-zero return code.
2015-05-01 15:16:55 +01:00
Phil Elwell
f12459c4b2 Adding w1-gpio device tree overlays
N.B. Requires firmware supporting multi-target overrides

w1-gpio-overlay:
  Use if a pullup pin is not required.
  Parameters:
    gpiopin=<i/o pin>     // default 4

w1-gpio-pullup-overlay:
  Use if a pullup pin is required.
  Parameters:
    gpiopin=<i/o pin>     // default 4
    pullup=<pullup pin>   // default 5
2015-05-01 15:16:54 +01:00
Phil Elwell
d93c40a747 Fix the activity LED in DT mode
Add a "leds" node to the base DTBs, and a subnode for the activity
LED. You can change the LED function like this:

  dtparam=act_led_trigger=heartbeat

Add aliases for the other main nodes (soc, intc).

Issue: linux #757
2015-05-01 15:16:54 +01:00
Phil Elwell
c4afc4f595 lirc-rpi: Add device tree support, and a suitable overlay
The overlay supports DT parameters that match the old module
parameters, except that gpio_in_pull should be set using the
strings "up", "down" or "off".

lirc-rpi: Also support pinctrl-bcm2835 in non-DT mode
2015-05-01 15:16:53 +01:00
Phil Elwell
66958bd53e DT: Add overrides to enable i2c0, i2c1, spi and i2s 2015-05-01 15:16:52 +01:00
Phil Elwell
fa54f49c23 fdt: Add support for the CONFIG_CMDLINE_EXTEND option 2015-05-01 15:16:51 +01:00
popcornmix
1af7b4b793 Adding Device Tree support for some RPi audio cards 2015-05-01 15:16:50 +01:00
Phil Elwell
9030436787 bcm2708: Allow option card devices to be configured via DT
If the kernel is built with Device Tree support, and if a DT blob
is provided for the kernel at boot time, then the platform devices
for option cards are not created. This avoids both the need to
blacklist unwanted devices, and the need to update the board
support code with each new device.
2015-05-01 15:16:49 +01:00
Daniel Matuschek
a7e71af109 Added driver for HiFiBerry Amp amplifier add-on board
The driver contains a low-level hardware driver for the TAS5713 and the
drivers for the Raspberry Pi I2S subsystem.
2015-05-01 15:16:48 +01:00
Daniel Matuschek
2b376efb3a Added support for HiFiBerry DAC+
The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses
a different codec chip (PCM5122), therefore a new driver is necessary.
2015-05-01 15:16:47 +01:00
popcornmix
d2a00394bb Revert "ARM: dma: Use dma_pfn_offset for dma address translation"
This reverts commit 6ce0d20016.
2015-05-01 15:16:46 +01:00
P33M
9d7ac0e308 usb: core: make overcurrent messages more prominent
Hub overcurrent messages are more serious than "debug". Increase loglevel.
2015-05-01 15:16:45 +01:00
popcornmix
7708377b70 hid: Reduce default mouse polling interval to 60Hz
Reduces overhead when using X
2015-05-01 15:16:44 +01:00
notro
c04316c256 i2c: bcm2708: add device tree support
Add DT support to driver and add to .dtsi file.
Setup pins in .dts file.
i2c is disabled by default.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>

bcm2708: don't register i2c controllers when using DT

The devices for the i2c controllers are in the Device Tree.
Only register devices when not using DT.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>

i2c: bcm2835: make driver available on ARCH_BCM2708

Make this driver available on ARCH_BCM2708

Signed-off-by: Noralf Tronnes <notro@tronnes.org>
2015-05-01 15:16:43 +01:00
notro
16b8124e21 spi: bcm2708: add device tree support
Add DT support to driver and add to .dtsi file.
Setup pins and spidev in .dts file.
SPI is disabled by default.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>

BCM2708: don't register SPI controller when using DT

The device for the SPI controller is in the Device Tree.
Only register the device when not using DT.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>

spi: bcm2835: make driver available on ARCH_BCM2708

Make this driver available on ARCH_BCM2708

Signed-off-by: Noralf Tronnes <notro@tronnes.org>

bcm2708: Remove the prohibition on mixing SPIDEV and DT
2015-05-01 15:16:42 +01:00
notro
d41a10ba93 BCM2708: use pinctrl-bcm2835
Use pinctrl-bcm2835 instead of the pinctrl-bcm2708 and bcm2708_gpio
combination.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>
2015-05-01 15:16:41 +01:00
popcornmix
6c9eeae1a0 BCM2708: armctrl: Add IRQ Device Tree support
Add Device Tree IRQ support for BCM2708.
Usage is the same as for irq-bcm2835.
See binding document: brcm,bcm2835-armctrl-ic.txt

A bank 3 is added to handle GPIO interrupts. This is done because
armctrl also handles GPIO interrupts.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>

BCM2708: armctrl: remove irq bank 3

irq bank 3 was needed by the pinctrl-bcm2708 and bcm2708_gpio
combination. It is no longer required.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>
2015-05-01 15:16:41 +01:00
popcornmix
918b734bf6 vmstat: Workaround for issue where dirty page count goes negative
See:
https://github.com/raspberrypi/linux/issues/617
http://www.spinics.net/lists/linux-mm/msg72236.html
2015-05-01 15:16:40 +01:00
Howard Mitchell
809f7a7f45 Set a limit of 0dB on Digital Volume Control
The main volume control in the PCM512x DAC has a range up to
+24dB. This is dangerously loud and can potentially cause massive
clipping in the output stages. Therefore this sets a sensible
limit of 0dB for this control.
2015-05-01 15:16:39 +01:00
Gordon Garrity
2624db9402 Add IQaudIO Sound Card support for Raspberry Pi 2015-05-01 15:16:38 +01:00
Daniel Matuschek
fcd7621107 ASoC: wm8804: Set idle_bias_off to false Idle bias has been change to remove warning on driver startup
Signed-off-by: Daniel Matuschek <daniel@matuschek.net>
2015-05-01 15:16:37 +01:00
Daniel Matuschek
407d23d8a4 BCM2708: Added support for HiFiBerry Digi board Board initalization by I2C
Signed-off-by: Daniel Matuschek <daniel@matuschek.net>
2015-05-01 15:16:36 +01:00
Daniel Matuschek
aa032227a1 ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver.
Signed-off-by: Daniel Matuschek <daniel@matuschek.net>
2015-05-01 15:16:35 +01:00
Daniel Matuschek
76bd7ab96d ASoC: wm8804: Implement MCLK configuration options, add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs for most sample rates. At 192kHz only 128xfs is supported. The existing driver selects 128xfs automatically for some lower samples rates. By using an additional mclk_div divider, it is now possible to control the behaviour. This allows using 256xfs PLL frequency on all sample rates up to 96kHz. It should allow lower jitter and better signal quality. The behavior has to be controlled by the sound card driver, because some sample frequency share the same setting. e.g. 192kHz and 96kHz use 24.576MHz master clock. The only difference is the MCLK divider.
This also added support for 32bit data.

Signed-off-by: Daniel Matuschek <daniel@matuschek.net>
2015-05-01 15:16:34 +01:00
Florian Meier
5ec50b24ac ASoC: BCM2708: Add support for RPi-DAC
This adds a machine driver for the RPi-DAC.

Signed-off-by: Florian Meier <florian.meier@koalo.de>
2015-05-01 15:16:33 +01:00
Florian Meier
1685814fc1 BCM2708: Add HifiBerry DAC to board file
This adds the initalization of the HifiBerry DAC
to the mach-bcm2708 board file.

Signed-off-by: Florian Meier <florian.meier@koalo.de>
2015-05-01 15:16:32 +01:00
Florian Meier
1054e906f3 ASoC: Add support for HifiBerry DAC
This adds a machine driver for the HifiBerry DAC.
It is a sound card that can
be stacked onto the Raspberry Pi.

Signed-off-by: Florian Meier <florian.meier@koalo.de>
2015-05-01 15:16:31 +01:00
Florian Meier
4102a7dbd7 BCM2708: Add I2S support to board file
Adds the required initializations for I2S
to the board file of mach-bcm2708.

Signed-off-by: Florian Meier <florian.meier@koalo.de>
2015-05-01 15:16:30 +01:00
Florian Meier
c0c4345041 ASoC: Add support for PCM5102A codec
Some definitions to support the PCM5102A codec
by Texas Instruments.

Signed-off-by: Florian Meier <florian.meier@koalo.de>
2015-05-01 15:16:29 +01:00
Florian Meier
dbb28fde0c ASoC: Add support for BCM2708
This driver adds support for digital audio (I2S)
for the BCM2708 SoC that is used by the
Raspberry Pi. External audio codecs can be
connected to the Raspberry Pi via P5 header.

It relies on cyclic DMA engine support for BCM2708.

Signed-off-by: Florian Meier <florian.meier@koalo.de>

ASoC: BCM2708: Add 24 bit support

This adds 24 bit support to the I2S driver of the BCM2708.
Besides enabling the 24 bit flags, it includes two bug fixes:

MMAP is not supported. Claiming this leads to strange issues
when the format of driver and file do not match.

The datasheet states that the width extension bit should be set
for widths greater than 24, but greater or equal would be correct.
This follows from the definition of the width field.

Signed-off-by: Florian Meier <florian.meier@koalo.de>

bcm2708-i2s: Update bclk_ratio to more correct values

Move GPIO setup to hw_params.

This is used to stop the I2S driver from breaking
the GPIO setup for other uses of the PCM interface

Configure GPIOs for I2S based on revision/card settings

With RPi model B+, assignment of the I2S GPIO pins has changed.
This patch uses the board revision to auto-detect the GPIOs used
for I2S. It also allows sound card drivers to set the GPIOs that
should be used. This is especially important with the Compute
Module.

bcm2708-i2s: Avoid leak from iomap when accessing gpio

bcm2708: Eliminate i2s debugfs directory error

Qualify the two regmap ranges uses by bcm2708-i2s ('-i2s' and '-clk')
to avoid the name clash when registering debugfs entries.
2015-05-01 15:16:28 +01:00
popcornmix
511d5ff03d config: Enable CONFIG_MEMCG, but leave it disabled (due to memory cost). Enable with cgroup_enable=memory. 2015-05-01 15:16:27 +01:00
popcornmix
e6178196f0 Added Device IDs for August DVB-T 205 2015-05-01 15:16:26 +01:00
popcornmix
b74131aa0a enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (as a module)
1-wire: Add support for configuring pin for w1-gpio kernel module
See: https://github.com/raspberrypi/linux/pull/457

Add bitbanging pullups, use them for w1-gpio

Allows parasite power to work, uses module option pullup=1

bcm2708: Ensure 1-wire pullup is disabled by default, and expose as module parameter

Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>

w1-gpio: Add gpiopin module parameter and correctly free up gpio pull-up pin, if set

Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>
2015-05-01 15:16:25 +01:00
popcornmix
3fc0414796 Allow mac address to be set in smsc95xx
Signed-off-by: popcornmix <popcornmix@gmail.com>
2015-05-01 15:16:24 +01:00
Harm Hanemaaijer
a064f31e6b Speed up console framebuffer imageblit function
Especially on platforms with a slower CPU but a relatively high
framebuffer fill bandwidth, like current ARM devices, the existing
console monochrome imageblit function used to draw console text is
suboptimal for common pixel depths such as 16bpp and 32bpp. The existing
code is quite general and can deal with several pixel depths. By creating
special case functions for 16bpp and 32bpp, by far the most common pixel
formats used on modern systems, a significant speed-up is attained
which can be readily felt on ARM-based devices like the Raspberry Pi
and the Allwinner platform, but should help any platform using the
fb layer.

The special case functions allow constant folding, eliminating a number
of instructions including divide operations, and allow the use of an
unrolled loop, eliminating instructions with a variable shift size,
reducing source memory access instructions, and eliminating excessive
branching. These unrolled loops also allow much better code optimization
by the C compiler. The code that selects which optimized variant is used
is also simplified, eliminating integer divide instructions.

The speed-up, measured by timing 'cat file.txt' in the console, varies
between 40% and 70%, when testing on the Raspberry Pi and Allwinner
ARM-based platforms, depending on font size and the pixel depth, with
the greater benefit for 32bpp.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
2015-05-01 15:16:23 +01:00
popcornmix
2dae2fddbc rtl8192cu: Add PID for D-Link DWA 131 2015-05-01 15:16:22 +01:00
popcornmix
0cd405afec Add non-mainline source for rtl8192cu wireless driver version v4.0.2_9000 as this is widely used. Disabled older rtlwifi driver 2015-05-01 15:16:21 +01:00
Siarhei Siamashka
dbecd2f191 fbdev: add FBIOCOPYAREA ioctl
Based on the patch authored by Ali Gholami Rudi at
    https://lkml.org/lkml/2009/7/13/153

Provide an ioctl for userspace applications, but only if this operation
is hardware accelerated (otherwide it does not make any sense).

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
2015-05-01 15:16:20 +01:00
notro
671554aed0 BCM2708: Add core Device Tree support
Add the bare minimum needed to boot BCM2708 from a Device Tree.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>

BCM2708: DT: change 'axi' nodename to 'soc'

Change DT node named 'axi' to 'soc' so it matches ARCH_BCM2835.
The VC4 bootloader fills in certain properties in the 'axi' subtree,
but since this is part of an upstreaming effort, the name is changed.

Signed-off-by: Noralf Tronnes notro@tronnes.org

BCM2708_DT: Correct length of the peripheral space
2015-05-01 15:16:19 +01:00
notro
191bc5b30c BCM2708: Migrate to the Common Clock Framework
As part of moving towards using Device Tree, the Common Clock Framework
has to be used instead of the BCM2708 clock implementation.

Selecting COMMON_CLK removes the need to set CLKDEV_LOOKUP and HAVE_CLK explicitly.

CONFIG_ARCH_BCM2708_CHIPIT #ifdef's are removed. They are no longer in use.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>
2015-05-01 15:16:18 +01:00
notro
c0d39b50f5 spi-bcm2708: Prepare for Common Clock Framework migration
As part of migrating to use the Common Clock Framework, replace clk_enable()
with clk_prepare_enable() and clk_disable() with clk_disable_unprepare().
This does not affect behaviour under the current clock implementation.

Also add a missing clk_disable_unprepare() in the probe error path.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>
2015-05-01 15:16:17 +01:00
Vincent Sanders
b04b9accf5 bcm2835: add v4l2 camera device
- Supports raw YUV capture, preview, JPEG and H264.
- Uses videobuf2 for data transfer, using dma_buf.
- Uses 3.6.10 timestamping
- Camera power based on use
- Uses immutable input mode on video encoder

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Luke Diamand <luked@broadcom.com>

V4L2: Fixes from 6by9

V4L2: Fix EV values. Add manual shutter speed control

V4L2 EV values should be in units of 1/1000. Corrected.
Add support for V4L2_CID_EXPOSURE_ABSOLUTE which should
give manual shutter control. Requires manual exposure mode
to be selected first.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Correct JPEG Q-factor range

Should be 1-100, not 0-100

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Fix issue of driver jamming if STREAMON failed.

Fix issue where the driver was left in a partially enabled
state if STREAMON failed, and would then reject many IOCTLs
as it thought it was streaming.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Fix ISO controls.

Driver was passing the index to the GPU, and not the desired
ISO value.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Add flicker avoidance controls

Add support for V4L2_CID_POWER_LINE_FREQUENCY to set flicker
avoidance frequencies.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Add support for frame rate control.

Add support for frame rate (or time per frame as V4L2
inverts it) control via s_parm.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Improve G_FBUF handling so we pass conformance

Return some sane numbers for get framebuffer so that
we pass conformance.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Fix information advertised through g_vidfmt

Width and height were being stored based on incorrect
values.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Add support for inline H264 headers

Add support for V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER
to control H264 inline headers.
Requires firmware fix to work correctly, otherwise format
has to be set to H264 before this parameter is set.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Fix JPEG timestamp issue

JPEG images were coming through from the GPU with timestamp
of 0. Detect this and give current system time instead
of some invalid value.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Fix issue when switching down JPEG resolution.

JPEG buffer size calculation is based on input resolution.
Input resolution was being configured after output port
format. Caused failures if switching from one JPEG resolution
to a smaller one.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Enable MJPEG encoding

Requires GPU firmware update to support MJPEG encoder.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Correct flag settings for compressed formats

Set flags field correctly on enum_fmt_vid_cap for compressed
image formats.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: H264 profile & level ctrls, FPS control and auto exp pri

Several control handling updates.
H264 profile and level controls.
Timeperframe/FPS reworked to add V4L2_CID_EXPOSURE_AUTO_PRIORITY to
select whether AE is allowed to override the framerate specified.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Correct BGR24 to RGB24 in format table

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Add additional pixel formats. Correct colourspace

Adds the other flavours of YUYV, and NV12.
Corrects the overlay advertised colourspace.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Drop logging msg from info to debug

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Initial pass at scene modes.

Only supports exposure mode and metering modes.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Add manual white balance control.

Adds support for V4L2_CID_RED_BALANCE and
V4L2_CID_BLUE_BALANCE. Only has an effect if
V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE has
V4L2_WHITE_BALANCE_MANUAL selected.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

config: Enable V4L / MMAL driver

V4L2: Increase the MMAL timeout to 3sec

MJPEG codec flush is now taking longer and results
in a kernel panic if the driver has stopped waiting for
the result when it finally completes.
Increase the timeout value from 1 to 3secs.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Add support for setting H264_I_PERIOD

Adds support for the parameter V4L2_CID_MPEG_VIDEO_H264_I_PERIOD
to set the frequency with which I frames are produced.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Enable GPU function for removing padding from images.

GPU can now support arbitrary strides, although may require
additional processing to achieve it. Enable this feature
so that the images delivered are the size requested.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Add support for V4L2_PIX_FMT_BGR32

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Set the colourspace to avoid odd YUV-RGB conversions

Removes the amiguity from the conversion routines and stops
them dropping back to the SD vs HD choice of coeffs.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Make video/still threshold a run-time param

Move the define for at what resolution the driver
switches from a video mode capture to a stills mode
capture to module parameters.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Fix incorrect pool sizing

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Add option to disable enum_framesizes.

Gstreamer's handling of a driver that advertises
V4L2_FRMSIZE_TYPE_STEPWISE to define the supported
resolutions is broken. See bug
https://bugzilla.gnome.org/show_bug.cgi?id=726521

Optional parameter of gst_v4l2src_is_broken added.
If non-zero, the driver claims not to support that
ioctl, and gstreamer should be happy again (it
guesses a set of defaults for itself).

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Add support for more image formats

Adds YVU420 (YV12), YVU420SP (NV21), and BGR888.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

V4L2: Extend range for V4L2_CID_MPEG_VIDEO_H264_I_PERIOD

Request to extend the range from the fairly arbitrary
1000 frames (33 seconds at 30fps). Extend out to the
max range supported (int32 value).
Also allow 0, which is handled by the codec as only
send an I-frame on the first frame and never again.
There may be an exception if it detects a significant
scene change, but there's no easy way around that.

Signed-off-by: Dave Stevenson <dsteve@broadcom.com>

bcm2835-camera: stop_streaming now has a void return

BCM2835-V4L2: Fix compliance test failures

VIDIOC_TRY_FMT and VIDIOC_S_FMT tests were faling due
to reporting V4L2_COLORSPACE_JPEG when the colour
format wasn't V4L2_PIX_FMT_JPEG.
Now reports V4L2_COLORSPACE_SMPTE170M for YUV formats.
2015-05-01 15:16:16 +01:00
popcornmix
0d075f7303 Add Chris Boot's i2c and spi drivers.
i2c-bcm2708: fixed baudrate

Fixed issue where the wrong CDIV value was set for baudrates below 3815 Hz (for 250MHz bus clock).
In that case the computed CDIV value was more than 0xffff. However the CDIV register width is only 16 bits.
This resulted in incorrect setting of CDIV and higher baudrate than intended.
Example: 3500Hz -> CDIV=0x11704 -> CDIV(16bit)=0x1704 -> 42430Hz
After correction: 3500Hz -> CDIV=0x11704 -> CDIV(16bit)=0xffff -> 3815Hz
The correct baudrate is shown in the log after the cdiv > 0xffff correction.

Perform I2C combined transactions when possible

Perform I2C combined transactions whenever possible, within the
restrictions of the Broadcomm Serial Controller.

Disable DONE interrupt during TA poll

Prevent interrupt from being triggered if poll is missed and transfer
starts and finishes.

i2c: Make combined transactions optional and disabled by default
2015-05-01 15:16:15 +01:00
popcornmix
d926a40edc Added hwmon/thermal driver for reporting core temperature. Thanks Dorian 2015-05-01 15:16:14 +01:00
popcornmix
32d6e3231f Add cpufreq driver 2015-05-01 15:16:13 +01:00
Aron Szabo
904a182ff0 lirc: added support for RaspberryPi GPIO
lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others
See: https://github.com/raspberrypi/linux/issues/525

lirc: Remove restriction on gpio pins that can be used with lirc

Compute Module, for example could use different pins

lirc_rpi: Add parameter to specify input pin pull

Depending on the connected IR circuitry it might be desirable to change the
gpios internal pull from it pull-down default behaviour. Add a module
parameter to allow the user to set it explicitly.

Signed-off-by: Julian Scheel <julian@jusst.de>

lirc-rpi: Use the higher-level irq control functions

This module used to access the irq_chip methods of the
gpio controller directly, rather than going through the
standard enable_irq/irq_set_irq_type functions. This
caused problems on pinctrl-bcm2835 which only implements
the irq_enable/disable methods and not irq_unmask/mask.

lirc-rpi: Correct the interrupt usage

1) Correct the use of enable_irq (i.e. don't call it so often)
2) Correct the shutdown sequence.
3) Avoid a bcm2708_gpio driver quirk by setting the irq flags earlier

lirc-rpi: use getnstimeofday instead of read_current_timer

read_current_timer isn't guaranteed to return values in
microseconds, and indeed it doesn't on a Pi2.

Issue: linux#827
2015-05-01 15:16:12 +01:00
popcornmix
773c64424d Add hwrng (hardware random number generator) driver 2015-05-01 15:16:11 +01:00
Tim Gover
f4a8d547b2 vcsm: VideoCore shared memory service for BCM2835
Add experimental support for the VideoCore shared memory service.
This allows user processes to allocate memory from VideoCore's
GPU relocatable heap and mmap the buffers. Additionally, the memory
handles can passed to other VideoCore services such as MMAL, OpenMax
and DispmanX

TODO
* This driver was originally released for BCM28155 which has a different
  cache architecture to BCM2835. Consequently, in this release only
  uncached mappings are supported. However, there's no fundamental
  reason which cached mappings cannot be support or BCM2835
* More refactoring is required to remove the typedefs.
* Re-enable the some of the commented out debug-fs statistics which were
  disabled when migrating code from proc-fs.
* There's a lot of code to support sharing of VCSM in order to support
  Android. This could probably done more cleanly or perhaps just
  removed.

Signed-off-by: Tim Gover <timgover@gmail.com>

config: Disable VC_SM for now to fix hang with cutdown kernel

vcsm: Use boolean as it cannot be built as module

On building the bcm_vc_sm as a module we get the following error:

v7_dma_flush_range and do_munmap are undefined in vc-sm.ko.

Fix by making it not an option to build as module
2015-05-01 15:15:41 +01:00
popcornmix
97dda9a97d bcm2708 vchiq driver
Signed-off-by: popcornmix <popcornmix@gmail.com>

vchiq: create_pagelist copes with vmalloc memory

Signed-off-by: Daniel Stone <daniels@collabora.com>

vchiq: fix the shim message release

Signed-off-by: Daniel Stone <daniels@collabora.com>

vchiq: export additional symbols

Signed-off-by: Daniel Stone <daniels@collabora.com>

VCHIQ: Make service closure fully synchronous (drv)

This is one half of a two-part patch, the other half of which is to
the vchiq_lib user library. With these patches, calls to
vchiq_close_service and vchiq_remove_service won't return until any
associated callbacks have been delivered to the callback thread.

VCHIQ: Add per-service tracing

The new service option VCHIQ_SERVICE_OPTION_TRACE is a boolean that
toggles tracing for the specified service.

This commit also introduces vchi_service_set_option and the associated
option VCHI_SERVICE_OPTION_TRACE.

vchiq: Make the synchronous-CLOSE logic more tolerant

vchiq: Move logging control into debugfs

vchiq: Take care of a corner case tickled by VCSM

Closing a connection that isn't fully open requires care, since one
side does not know the other side's port number. Code was present to
handle the case where a CLOSE is sent immediately after an OPEN, i.e.
before the OPENACK has been received, but this was incorrectly being
used when an OPEN from a client using port 0 was rejected.

(In the observed failure, the host was attempting to use the VCSM
service, which isn't present in the 'cutdown' firmware. The failure
was intermittent because sometimes the keepalive service would
grab port 0.)

This case can be distinguished because the client's remoteport will
still be VCHIQ_PORT_FREE, and the srvstate will be OPENING. Either
condition is sufficient to differentiate it from the special case
described above.

vchiq: Avoid high load when blocked and unkillable

vchiq: Include SIGSTOP and SIGCONT in list of signals not-masked by vchiq to allow gdb to work

vchiq_arm: Complete support for SYNCHRONOUS mode

vchiq: Remove inline from suspend/resume
2015-05-01 15:15:39 +01:00
popcornmix
fccbda977c bcm2708: alsa sound driver
Signed-off-by: popcornmix <popcornmix@gmail.com>

alsa: add mmap support and some cleanups to bcm2835 ALSA driver

snd-bcm2835: Add support for spdif/hdmi passthrough

This adds a dedicated subdevice which can be used for passthrough of non-audio
formats (ie encoded a52) through the hdmi audio link. In addition to this
driver extension an appropriate card config is required to make alsa-lib
support the AES parameters for this device.

snd-bcm2708: Add mutex, improve logging

Fix for ALSA driver crash

Avoids an issue when closing and opening vchiq where a message can arrive before service handle has been written

alsa: reduce severity of expected warning message

snd-bcm2708: Fix dmesg spam for non-error case

alsa: Ensure mutexes are released through error paths

alsa: Make interrupted close paths quieter
2015-05-01 15:15:25 +01:00
popcornmix
594665ed12 cma: Add vc_cma driver to enable use of CMA
Signed-off-by: popcornmix <popcornmix@gmail.com>

vc_cma: Make the vc_cma area the default contiguous DMA area
2015-05-01 15:10:35 +01:00
gellert
086397f74b MMC: added alternative MMC driver
mmc: Disable CMD23 transfers on all cards

Pending wire-level investigation of these types of transfers
and associated errors on bcm2835-mmc, disable for now. Fallback of
CMD18/CMD25 transfers will be used automatically by the MMC layer.

Reported/Tested-by: Gellert Weisz <gellert@raspberrypi.org>

mmc: bcm2835-mmc: enable DT support for all architectures

Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now.
Enable Device Tree support for all architectures.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

mmc: bcm2835-mmc: fix probe error handling

Probe error handling is broken in several places.
Simplify error handling by using device managed functions.
Replace pr_{err,info} with dev_{err,info}.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:10:34 +01:00
Florian Meier
040ebd148d dmaengine: Add support for BCM2708
Add support for DMA controller of BCM2708 as used in the Raspberry Pi.
Currently it only supports cyclic DMA.

Signed-off-by: Florian Meier <florian.meier@koalo.de>

dmaengine: expand functionality by supporting scatter/gather transfers sdhci-bcm2708 and dma.c: fix for LITE channels

DMA: fix cyclic LITE length overflow bug

dmaengine: bcm2708: Remove chancnt affectations

Mirror bcm2835-dma.c commit 9eba5536a7:
chancnt is already filled by dma_async_device_register, which uses the channel
list to know how much channels there is.

Since it's already filled, we can safely remove it from the drivers' probe
function.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

dmaengine: bcm2708: overwrite dreq only if it is not set

dreq is set when the DMA channel is fetched from Device Tree.
slave_id is set using dmaengine_slave_config().
Only overwrite dreq with slave_id if it is not set.

dreq/slave_id in the cyclic DMA case is not touched, because I don't
have hardware to test with.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

dmaengine: bcm2708: do device registration in the board file

Don't register the device in the driver. Do it in the board file.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

dmaengine: bcm2708: don't restrict DT support to ARCH_BCM2835

Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now.
Add Device Tree support to the non ARCH_BCM2835 case.
Use the same driver name regardless of architecture.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
2015-05-01 15:10:31 +01:00
popcornmix
0f320c21ab bcm2708 framebuffer driver
Signed-off-by: popcornmix <popcornmix@gmail.com>

bcm2708_fb : Implement blanking support using the mailbox property interface

bcm2708_fb: Add pan and vsync controls

bcm2708_fb: DMA acceleration for fb_copyarea

Based on http://www.raspberrypi.org/phpBB3/viewtopic.php?p=62425#p62425
Also used Simon's dmaer_master module as a reference for tweaking DMA
settings for better performance.

For now busylooping only. IRQ support might be added later.
With non-overclocked Raspberry Pi, the performance is ~360 MB/s
for simple copy or ~260 MB/s for two-pass copy (used when dragging
windows to the right).

In the case of using DMA channel 0, the performance improves
to ~440 MB/s.

For comparison, VFP optimized CPU copy can only do ~114 MB/s in
the same conditions (hindered by reading uncached source buffer).

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>

bcm2708_fb: report number of dma copies

Add a counter (exported via debugfs) reporting the
number of dma copies that the framebuffer driver
has done, in order to help evaluate different
optimization strategies.

Signed-off-by: Luke Diamand <luked@broadcom.com>

bcm2708_fb: use IRQ for DMA copies

The copyarea ioctl() uses DMA to speed things along. This
was busy-waiting for completion. This change supports using
an interrupt instead for larger transfers. For small
transfers, busy-waiting is still likely to be faster.

Signed-off-by: Luke Diamand <luke@diamand.org>

bcm2708: Make ioctl logging quieter
2015-05-01 15:10:30 +01:00
popcornmix
c3a4819b87 bcm2708 watchdog driver
Signed-off-by: popcornmix <popcornmix@gmail.com>
2015-05-01 15:10:28 +01:00
popcornmix
775b3e09b7 Add dwc_otg driver
Signed-off-by: popcornmix <popcornmix@gmail.com>

usb: dwc: fix lockdep false positive

Signed-off-by: Kari Suvanto <karis79@gmail.com>

usb: dwc: fix inconsistent lock state

Signed-off-by: Kari Suvanto <karis79@gmail.com>

Add FIQ patch to dwc_otg driver. Enable with dwc_otg.fiq_fix_enable=1. Should give about 10% more ARM performance.
Thanks to Gordon and Costas

Avoid dynamic memory allocation for channel lock in USB driver. Thanks ddv2005.

Add NAK holdoff scheme. Enabled by default, disable with dwc_otg.nak_holdoff_enable=0. Thanks gsh

Make sure we wait for the reset to finish

dwc_otg: fix bug in dwc_otg_hcd.c resulting in silent kernel
	 memory corruption, escalating to OOPS under high USB load.

dwc_otg: Fix unsafe access of QTD during URB enqueue

In dwc_otg_hcd_urb_enqueue during qtd creation, it was possible that the
transaction could complete almost immediately after the qtd was assigned
to a host channel during URB enqueue, which meant the qtd pointer was no
longer valid having been completed and removed. Usually, this resulted in
an OOPS during URB submission. By predetermining whether transactions
need to be queued or not, this unsafe pointer access is avoided.

This bug was only evident on the Pi model A where a device was attached
that had no periodic endpoints (e.g. USB pendrive or some wlan devices).

dwc_otg: Fix incorrect URB allocation error handling

If the memory allocation for a dwc_otg_urb failed, the kernel would OOPS
because for some reason a member of the *unallocated* struct was set to
zero. Error handling changed to fail correctly.

dwc_otg: fix potential use-after-free case in interrupt handler

If a transaction had previously aborted, certain interrupts are
enabled to track error counts and reset where necessary. On IN
endpoints the host generates an ACK interrupt near-simultaneously
with completion of transfer. In the case where this transfer had
previously had an error, this results in a use-after-free on
the QTD memory space with a 1-byte length being overwritten to
0x00.

dwc_otg: add handling of SPLIT transaction data toggle errors

Previously a data toggle error on packets from a USB1.1 device behind
a TT would result in the Pi locking up as the driver never handled
the associated interrupt. Patch adds basic retry mechanism and
interrupt acknowledgement to cater for either a chance toggle error or
for devices that have a broken initial toggle state (FT8U232/FT232BM).

dwc_otg: implement tasklet for returning URBs to usbcore hcd layer

The dwc_otg driver interrupt handler for transfer completion will spend
a very long time with interrupts disabled when a URB is completed -
this is because usb_hcd_giveback_urb is called from within the handler
which for a USB device driver with complicated processing (e.g. webcam)
will take an exorbitant amount of time to complete. This results in
missed completion interrupts for other USB packets which lead to them
being dropped due to microframe overruns.

This patch splits returning the URB to the usb hcd layer into a
high-priority tasklet. This will have most benefit for isochronous IN
transfers but will also have incidental benefit where multiple periodic
devices are active at once.

dwc_otg: fix NAK holdoff and allow on split transactions only

This corrects a bug where if a single active non-periodic endpoint
had at least one transaction in its qh, on frnum == MAX_FRNUM the qh
would get skipped and never get queued again. This would result in
a silent device until error detection (automatic or otherwise) would
either reset the device or flush and requeue the URBs.

Additionally the NAK holdoff was enabled for all transactions - this
would potentially stall a HS endpoint for 1ms if a previous error state
enabled this interrupt and the next response was a NAK. Fix so that
only split transactions get held off.

dwc_otg: Call usb_hcd_unlink_urb_from_ep with lock held in completion handler

usb_hcd_unlink_urb_from_ep must be called with the HCD lock held.  Calling it
asynchronously in the tasklet was not safe (regression in
c4564d4a1a).

This change unlinks it from the endpoint prior to queueing it for handling in
the tasklet, and also adds a check to ensure the urb is OK to be unlinked
before doing so.

NULL pointer dereference kernel oopses had been observed in usb_hcd_giveback_urb
when a USB device was unplugged/replugged during data transfer.  This effect
was reproduced using automated USB port power control, hundreds of replug
events were performed during active transfers to confirm that the problem was
eliminated.

USB fix using a FIQ to implement split transactions

This commit adds a FIQ implementaion that schedules
the split transactions using a FIQ so we don't get
held off by the interrupt latency of Linux

dwc_otg: fix device attributes and avoid kernel warnings on boot

dcw_otg: avoid logging function that can cause panics

See: https://github.com/raspberrypi/firmware/issues/21
Thanks to cleverca22 for fix

dwc_otg: mask correct interrupts after transaction error recovery

The dwc_otg driver will unmask certain interrupts on a transaction
that previously halted in the error state in order to reset the
QTD error count. The various fine-grained interrupt handlers do not
consider that other interrupts besides themselves were unmasked.

By disabling the two other interrupts only ever enabled in DMA mode
for this purpose, we can avoid unnecessary function calls in the
IRQ handler. This will also prevent an unneccesary FIQ interrupt
from being generated if the FIQ is enabled.

dwc_otg: fiq: prevent FIQ thrash and incorrect state passing to IRQ

In the case of a transaction to a device that had previously aborted
due to an error, several interrupts are enabled to reset the error
count when a device responds. This has the side-effect of making the
FIQ thrash because the hardware will generate multiple instances of
a NAK on an IN bulk/interrupt endpoint and multiple instances of ACK
on an OUT bulk/interrupt endpoint. Make the FIQ mask and clear the
associated interrupts.

Additionally, on non-split transactions make sure that only unmasked
interrupts are cleared. This caused a hard-to-trigger but serious
race condition when you had the combination of an endpoint awaiting
error recovery and a transaction completed on an endpoint - due to
the sequencing and timing of interrupts generated by the dwc_otg core,
it was possible to confuse the IRQ handler.

Fix function tracing

dwc_otg: whitespace cleanup in dwc_otg_urb_enqueue

dwc_otg: prevent OOPSes during device disconnects

The dwc_otg_urb_enqueue function is thread-unsafe. In particular the
access of urb->hcpriv, usb_hcd_link_urb_to_ep, dwc_otg_urb->qtd and
friends does not occur within a critical section and so if a device
was unplugged during activity there was a high chance that the
usbcore hub_thread would try to disable the endpoint with partially-
formed entries in the URB queue. This would result in BUG() or null
pointer dereferences.

Fix so that access of urb->hcpriv, enqueuing to the hardware and
adding to usbcore endpoint URB lists is contained within a single
critical section.

dwc_otg: prevent BUG() in TT allocation if hub address is > 16

A fixed-size array is used to track TT allocation. This was
previously set to 16 which caused a crash because
dwc_otg_hcd_allocate_port would read past the end of the array.

This was hit if a hub was plugged in which enumerated as addr > 16,
due to previous device resets or unplugs.

Also add #ifdef FIQ_DEBUG around hcd->hub_port_alloc[], which grows
to a large size if 128 hub addresses are supported. This field is
for debug only for tracking which frame an allocate happened in.

dwc_otg: make channel halts with unknown state less damaging

If the IRQ received a channel halt interrupt through the FIQ
with no other bits set, the IRQ would not release the host
channel and never complete the URB.

Add catchall handling to treat as a transaction error and retry.

dwc_otg: fiq_split: use TTs with more granularity

This fixes certain issues with split transaction scheduling.

- Isochronous multi-packet OUT transactions now hog the TT until
  they are completed - this prevents hubs aborting transactions
  if they get a periodic start-split out-of-order
- Don't perform TT allocation on non-periodic endpoints - this
  allows simultaneous use of the TT's bulk/control and periodic
  transaction buffers

This commit will mainly affect USB audio playback.

dwc_otg: fix potential sleep while atomic during urb enqueue

Fixes a regression introduced with eb1b482a. Kmalloc called from
dwc_otg_hcd_qtd_add / dwc_otg_hcd_qtd_create did not always have
the GPF_ATOMIC flag set. Force this flag when inside the larger
critical section.

dwc_otg: make fiq_split_enable imply fiq_fix_enable

Failing to set up the FIQ correctly would result in
"IRQ 32: nobody cared" errors in dmesg.

dwc_otg: prevent crashes on host port disconnects

Fix several issues resulting in crashes or inconsistent state
if a Model A root port was disconnected.

- Clean up queue heads properly in kill_urbs_in_qh_list by
  removing the empty QHs from the schedule lists
- Set the halt status properly to prevent IRQ handlers from
  using freed memory
- Add fiq_split related cleanup for saved registers
- Make microframe scheduling reclaim host channels if
  active during a disconnect
- Abort URBs with -ESHUTDOWN status response, informing
  device drivers so they respond in a more correct fashion
  and don't try to resubmit URBs
- Prevent IRQ handlers from attempting to handle channel
  interrupts if the associated URB was dequeued (and the
  driver state was cleared)

dwc_otg: prevent leaking URBs during enqueue

A dwc_otg_urb would get leaked if the HCD enqueue function
failed for any reason. Free the URB at the appropriate points.

dwc_otg: Enable NAK holdoff for control split transactions

Certain low-speed devices take a very long time to complete a
data or status stage of a control transaction, producing NAK
responses until they complete internal processing - the USB2.0
spec limit is up to 500mS. This causes the same type of interrupt
storm as seen with USB-serial dongles prior to c8edb238.

In certain circumstances, usually while booting, this interrupt
storm could cause SD card timeouts.

dwc_otg: Fix for occasional lockup on boot when doing a USB reset

dwc_otg: Don't issue traffic to LS devices in FS mode

Issuing low-speed packets when the root port is in full-speed mode
causes the root port to stop responding. Explicitly fail when
enqueuing URBs to a LS endpoint on a FS bus.

Fix ARM architecture issue with local_irq_restore()

If local_fiq_enable() is called before a local_irq_restore(flags) where
the flags variable has the F bit set, the FIQ will be erroneously disabled.

Fixup arch_local_irq_restore to avoid trampling the F bit in CPSR.

Also fix some of the hacks previously implemented for previous dwc_otg
incarnations.

dwc_otg: fiq_fsm: Base commit for driver rewrite

This commit removes the previous FIQ fixes entirely and adds fiq_fsm.

This rewrite features much more complete support for split transactions
and takes into account several OTG hardware bugs. High-speed
isochronous transactions are also capable of being performed by fiq_fsm.

All driver options have been removed and replaced with:
  - dwc_otg.fiq_enable (bool)
  - dwc_otg.fiq_fsm_enable (bool)
  - dwc_otg.fiq_fsm_mask (bitmask)
  - dwc_otg.nak_holdoff (unsigned int)

Defaults are specified such that fiq_fsm behaves similarly to the
previously implemented FIQ fixes.

fiq_fsm: Push error recovery into the FIQ when fiq_fsm is used

If the transfer associated with a QTD failed due to a bus error, the HCD
would retry the transfer up to 3 times (implementing the USB2.0
three-strikes retry in software).

Due to the masking mechanism used by fiq_fsm, it is only possible to pass
a single interrupt through to the HCD per-transfer.

In this instance host channels would fall off the radar because the error
reset would function, but the subsequent channel halt would be lost.

Push the error count reset into the FIQ handler.

fiq_fsm: Implement timeout mechanism

For full-speed endpoints with a large packet size, interrupt latency
runs the risk of the FIQ starting a transaction too late in a full-speed
frame. If the device is still transmitting data when EOF2 for the
downstream frame occurs, the hub will disable the port. This change is
not reflected in the hub status endpoint and the device becomes
unresponsive.

Prevent high-bandwidth transactions from being started too late in a
frame. The mechanism is not guaranteed: a combination of bit stuffing
and hub latency may still result in a device overrunning.

fiq_fsm: fix bounce buffer utilisation for Isochronous OUT

Multi-packet isochronous OUT transactions were subject to a few bounday
bugs. Fix them.

Audio playback is now much more robust: however, an issue stands with
devices that have adaptive sinks - ALSA plays samples too fast.

dwc_otg: Return full-speed frame numbers in HS mode

The frame counter increments on every *microframe* in high-speed mode.
Most device drivers expect this number to be in full-speed frames - this
caused considerable confusion to e.g. snd_usb_audio which uses the
frame counter to estimate the number of samples played.

fiq_fsm: save PID on completion of interrupt OUT transfers

Also add edge case handling for interrupt transports.

Note that for periodic split IN, data toggles are unimplemented in the
OTG host hardware - it unconditionally accepts any PID.

fiq_fsm: add missing case for fiq_fsm_tt_in_use()

Certain combinations of bitrate and endpoint activity could
result in a periodic transaction erroneously getting started
while the previous Isochronous OUT was still active.

fiq_fsm: clear hcintmsk for aborted transactions

Prevents the FIQ from erroneously handling interrupts
on a timed out channel.

fiq_fsm: enable by default

fiq_fsm: fix dequeues for non-periodic split transactions

If a dequeue happened between the SSPLIT and CSPLIT phases of the
transaction, the HCD would never receive an interrupt.

fiq_fsm: Disable by default

fiq_fsm: Handle HC babble errors

The HCTSIZ transfer size field raises a babble interrupt if
the counter wraps. Handle the resulting interrupt in this case.

dwc_otg: fix interrupt registration for fiq_enable=0

Additionally make the module parameter conditional for wherever
hcd->fiq_state is touched.

fiq_fsm: Enable by default

dwc_otg: Fix various issues with root port and transaction errors

Process the host port interrupts correctly (and don't trample them).
Root port hotplug now functional again.

Fix a few thinkos with the transaction error passthrough for fiq_fsm.

fiq_fsm: Implement hack for Split Interrupt transactions

Hubs aren't too picky about which endpoint we send Control type split
transactions to. By treating Interrupt transfers as Control, it is
possible to use the non-periodic queue in the OTG core as well as the
non-periodic FIFOs in the hub itself. This massively reduces the
microframe exclusivity/contention that periodic split transactions
otherwise have to enforce.

It goes without saying that this is a fairly egregious USB specification
violation, but it works.

Original idea by Hans Petter Selasky @ FreeBSD.org.

dwc_otg: FIQ support on SMP. Set up FIQ stack and handler on Core 0 only.

dwc_otg: introduce fiq_fsm_spin(un|)lock()

SMP safety for the FIQ relies on register read-modify write cycles being
completed in the correct order. Several places in the DWC code modify
registers also touched by the FIQ. Protect these by a bare-bones lock
mechanism.

This also makes it possible to run the FIQ and IRQ handlers on different
cores.

fiq_fsm: fix build on bcm2708 and bcm2709 platforms

dwc_otg: put some barriers back where they should be for UP

bcm2709/dwc_otg: Setup FIQ on core 1 if >1 core active

dwc_otg: fixup read-modify-write in critical paths

Be more careful about read-modify-write on registers that the FIQ
also touches.

Guard fiq_fsm_spin_lock with fiq_enable check

fiq_fsm: Falling out of the state machine isn't fatal

This edge case can be hit if the port is disabled while the FIQ is
in the middle of a transaction. Make the effects less severe.

Also get rid of the useless return value.
2015-05-01 15:10:27 +01:00
popcornmix
0c400d1938 Add bcm2708_gpio driver
Signed-off-by: popcornmix <popcornmix@gmail.com>

bcm2708: Add extension to configure internal pulls

The bcm2708 gpio controller supports internal pulls to be used as pull-up,
pull-down or being entirely disabled. As it can be useful for a driver to
change the pull configuration from it's default pull-down state, add an
extension which allows configuring the pull per gpio.

Signed-off-by: Julian Scheel <julian@jusst.de>

bcm2708-gpio: Revert the use of pinctrl_request_gpio

In non-DT systems, pinctrl_request_gpio always fails causing
"requests probe deferral" messages. In DT systems, it isn't useful
because the reference counting is independent of the normal pinctrl
pin reservations.

gpio: Only clear the currently occurring interrupt. Avoids losing interrupts

See: linux #760

bcm2708_gpio: Avoid calling irq_unmask for all interrupts

When setting up the interrupts, specify that the handle_simple_irq
handler should be used. This leaves interrupt acknowledgement to
the caller, and prevents irq_unmask from being called for all
interrupts.

Issue: linux #760
2015-05-01 15:10:26 +01:00
popcornmix
cf0e6b17a6 Add 2709 platform for Raspberry Pi 2 2015-05-01 15:10:25 +01:00
popcornmix
a041b743ae Main bcm2708 linux port
Signed-off-by: popcornmix <popcornmix@gmail.com>
2015-05-01 15:07:14 +01:00
Greg Kroah-Hartman
1b0ebf2964 Linux 4.0.1 2015-04-29 10:22:30 +02:00
Jann Horn
bdb29adaff fs: take i_mutex during prepare_binprm for set[ug]id executables
commit 8b01fc86b9 upstream.

This prevents a race between chown() and execve(), where chowning a
setuid-user binary to root would momentarily make the binary setuid
root.

This patch was mostly written by Linus Torvalds.

Signed-off-by: Jann Horn <jann@thejh.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-29 10:22:18 +02:00
Herbert Xu
d968c92507 skbuff: Do not scrub skb mark within the same name space
[ Upstream commit 213dd74aee ]

On Wed, Apr 15, 2015 at 05:41:26PM +0200, Nicolas Dichtel wrote:
> Le 15/04/2015 15:57, Herbert Xu a écrit :
> >On Wed, Apr 15, 2015 at 06:22:29PM +0800, Herbert Xu wrote:
> [snip]
> >Subject: skbuff: Do not scrub skb mark within the same name space
> >
> >The commit ea23192e8e ("tunnels:
> Maybe add a Fixes tag?
> Fixes: ea23192e8e ("tunnels: harmonize cleanup done on skb on rx path")
>
> >harmonize cleanup done on skb on rx path") broke anyone trying to
> >use netfilter marking across IPv4 tunnels.  While most of the
> >fields that are cleared by skb_scrub_packet don't matter, the
> >netfilter mark must be preserved.
> >
> >This patch rearranges skb_scurb_packet to preserve the mark field.
> nit: s/scurb/scrub
>
> Else it's fine for me.

Sure.

PS I used the wrong email for James the first time around.  So
let me repeat the question here.  Should secmark be preserved
or cleared across tunnels within the same name space? In fact,
do our security models even support name spaces?

---8<---
The commit ea23192e8e ("tunnels:
harmonize cleanup done on skb on rx path") broke anyone trying to
use netfilter marking across IPv4 tunnels.  While most of the
fields that are cleared by skb_scrub_packet don't matter, the
netfilter mark must be preserved.

This patch rearranges skb_scrub_packet to preserve the mark field.

Fixes: ea23192e8e ("tunnels: harmonize cleanup done on skb on rx path")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-29 10:22:18 +02:00
Herbert Xu
d44d126382 Revert "net: Reset secmark when scrubbing packet"
[ Upstream commit 4c0ee414e8 ]

This patch reverts commit b8fb4e0648
because the secmark must be preserved even when a packet crosses
namespace boundaries.  The reason is that security labels apply to
the system as a whole and is not per-namespace.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-29 10:22:18 +02:00
Alexei Starovoitov
32a08be658 bpf: fix verifier memory corruption
[ Upstream commit c3de6317d7 ]

Due to missing bounds check the DAG pass of the BPF verifier can corrupt
the memory which can cause random crashes during program loading:

[8.449451] BUG: unable to handle kernel paging request at ffffffffffffffff
[8.451293] IP: [<ffffffff811de33d>] kmem_cache_alloc_trace+0x8d/0x2f0
[8.452329] Oops: 0000 [#1] SMP
[8.452329] Call Trace:
[8.452329]  [<ffffffff8116cc82>] bpf_check+0x852/0x2000
[8.452329]  [<ffffffff8116b7e4>] bpf_prog_load+0x1e4/0x310
[8.452329]  [<ffffffff811b190f>] ? might_fault+0x5f/0xb0
[8.452329]  [<ffffffff8116c206>] SyS_bpf+0x806/0xa30

Fixes: f1bca824da ("bpf: add search pruning optimization to verifier")
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-29 10:22:18 +02:00
Eric Dumazet
db35b1ca6a bnx2x: Fix busy_poll vs netpoll
[ Upstream commit 074975d037 ]

Commit 9a2620c877 ("bnx2x: prevent WARN during driver unload")
switched the napi/busy_lock locking mechanism from spin_lock() into
spin_lock_bh(), breaking inter-operability with netconsole, as netpoll
disables interrupts prior to calling our napi mechanism.

This switches the driver into using atomic assignments instead of the
spinlock mechanisms previously employed.

Based on initial patch from Yuval Mintz & Ariel Elior

I basically added softirq starvation avoidance, and mixture
of atomic operations, plain writes and barriers.

Note this slightly reduces the overhead for this driver when no
busy_poll sockets are in use.

Fixes: 9a2620c877 ("bnx2x: prevent WARN during driver unload")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-29 10:22:17 +02:00
Eric Dumazet
8e7e388769 tcp: tcp_make_synack() should clear skb->tstamp
[ Upstream commit b50edd7812 ]

I noticed tcpdump was giving funky timestamps for locally
generated SYNACK messages on loopback interface.

11:42:46.938990 IP 127.0.0.1.48245 > 127.0.0.2.23850: S
945476042:945476042(0) win 43690 <mss 65495,nop,nop,sackOK,nop,wscale 7>

20:28:58.502209 IP 127.0.0.2.23850 > 127.0.0.1.48245: S
3160535375:3160535375(0) ack 945476043 win 43690 <mss
65495,nop,nop,sackOK,nop,wscale 7>

This is because we need to clear skb->tstamp before
entering lower stack, otherwise net_timestamp_check()
does not set skb->tstamp.

Fixes: 7faee5c0d5 ("tcp: remove TCP_SKB_CB(skb)->when")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-29 10:22:17 +02:00
Jesse Gross
6906cf7373 udptunnels: Call handle_offloads after inserting vlan tag.
[ Upstream commit b736a623bd ]

handle_offloads() calls skb_reset_inner_headers() to store
the layer pointers to the encapsulated packet. However, we
currently push the vlag tag (if there is one) onto the packet
afterwards. This changes the MAC header for the encapsulated
packet but it is not reflected in skb->inner_mac_header, which
breaks GSO and drivers which attempt to use this for encapsulation
offloads.

Fixes: 1eaa8178 ("vxlan: Add tx-vlan offload support.")
Signed-off-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-29 10:22:17 +02:00
19 changed files with 247 additions and 321 deletions

View File

@@ -1,6 +1,6 @@
VERSION = 4
PATCHLEVEL = 0
SUBLEVEL = 0
SUBLEVEL = 1
EXTRAVERSION =
NAME = Hurr durr I'ma sheep

View File

@@ -18,7 +18,7 @@
dmas = <&dma 13>,
<&dma 13>;
dma-names = "tx", "rx";
brcm,delay_after_stop = <0>;
brcm,delay-after-stop = <0>;
pinctrl-names = "default";
pinctrl-0 = <&sdhost_pins>;
status = "okay";
@@ -58,7 +58,16 @@
};
};
fragment@3 {
target-path = "/__overrides__";
__overlay__ {
sdhost_freq = <&clk_sdhost>,"clock-frequency:0";
};
};
__overrides__ {
delay_after_stop = <&sdhost>,"brcm,delay_after_stop:0";
delay_after_stop = <&sdhost>,"brcm,delay-after-stop:0";
force_pio = <&sdhost>,"brcm,force-pio?";
sdhost_freq = <&clk_sdhost>,"clock-frequency:0";
};
};

View File

@@ -1103,7 +1103,7 @@ static void __init bcm2709_timer_init(void)
/*
* Make irqs happen for the system timer
*/
setup_irq(IRQ_TIMER3, &bcm2708_timer_irq);
setup_irq(IRQ_TIMER3, &bcm2709_timer_irq);
sched_clock_register(bcm2709_read_sched_clock, 32, STC_FREQ_HZ);
@@ -1117,7 +1117,7 @@ static void __init bcm2709_timer_init(void)
timer0_clockevent.cpumask = cpumask_of(0);
clockevents_register_device(&timer0_clockevent);
register_current_timer_delay(&bcm2708_delay_timer);
register_current_timer_delay(&bcm2709_delay_timer);
}
#else
@@ -1197,6 +1197,7 @@ static void __init board_reserve(void)
}
#ifdef CONFIG_SMP
#include <linux/smp.h>
#include <mach/hardware.h>
@@ -1299,6 +1300,7 @@ struct smp_operations bcm2709_smp_ops __initdata = {
.smp_secondary_init = bcm2709_secondary_init,
.smp_boot_secondary = bcm2709_boot_secondary,
};
#endif
static const char * const bcm2709_compat[] = {
"brcm,bcm2709",
@@ -1308,7 +1310,9 @@ static const char * const bcm2709_compat[] = {
MACHINE_START(BCM2709, "BCM2709")
/* Maintainer: Broadcom Europe Ltd. */
#ifdef CONFIG_SMP
.smp = smp_ops(bcm2709_smp_ops),
#endif
.map_io = bcm2709_map_io,
.init_irq = bcm2709_init_irq,
.init_time = bcm2709_timer_init,
@@ -1321,7 +1325,9 @@ MACHINE_END
MACHINE_START(BCM2708, "BCM2709")
/* Maintainer: Broadcom Europe Ltd. */
#ifdef CONFIG_SMP
.smp = smp_ops(bcm2709_smp_ops),
#endif
.map_io = bcm2709_map_io,
.init_irq = bcm2709_init_irq,
.init_time = bcm2709_timer_init,

View File

@@ -35,7 +35,7 @@
ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source
add \irqstat, \irqstat, \base, lsl #2
ldr \tmp, [\irqstat]
#ifdef CONFIG_SMP
/* test for mailbox0 (IPI) interrupt */
tst \tmp, #0x10
beq 1030f
@@ -53,7 +53,7 @@
mov r1, sp
adr lr, BSYM(1b)
b do_IPI
#endif
1030:
/* check gpu interrupt */
tst \tmp, #0x100

View File

@@ -589,11 +589,15 @@ struct dma_chan *dma_get_any_slave_channel(struct dma_device *device)
chan = private_candidate(&mask, device, NULL, NULL);
if (chan) {
dma_cap_set(DMA_PRIVATE, device->cap_mask);
device->privatecnt++;
err = dma_chan_get(chan);
if (err) {
pr_debug("%s: failed to get %s: (%d)\n",
__func__, dma_chan_name(chan), err);
chan = NULL;
if (--device->privatecnt == 0)
dma_cap_clear(DMA_PRIVATE, device->cap_mask);
}
}

View File

@@ -322,7 +322,7 @@ vchiq_platform_use_suspend_timer(void)
void
vchiq_dump_platform_use_state(VCHIQ_STATE_T *state)
{
vchiq_log_info((vchiq_arm_log_level>=VCHIQ_LOG_INFO),"Suspend timer not in use");
vchiq_log_info(vchiq_arm_log_level, "Suspend timer not in use");
}
void
vchiq_platform_handle_timeout(VCHIQ_STATE_T *state)

View File

@@ -71,7 +71,6 @@ static const struct mmc_fixup mmc_fixup_methods[] = {
void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
{
extern unsigned mmc_debug;
const struct mmc_fixup *f;
u64 rev = cid_rev_card(card);
@@ -99,7 +98,6 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
/* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail.
* Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers).
*/
if (mmc_debug & (1<<13))
card->quirks |= MMC_QUIRK_BLK_NO_CMD23;
}
EXPORT_SYMBOL(mmc_fixup_device);

View File

@@ -71,9 +71,6 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x)
#define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE)
/*static */unsigned mmc_debug;
/*static */unsigned mmc_debug2;
struct bcm2835_host {
spinlock_t lock;
@@ -134,94 +131,23 @@ struct bcm2835_host {
};
static inline u32 bcm2835_mmc_axi_outstanding_reads(void)
static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg)
{
#ifdef CONFIG_ARCH_BCM2709
u32 r = readl(__io_address(ARM_LOCAL_AXI_COUNT));
#else
u32 r = 0;
#endif
return (r >> 0) & 0x3ff;
}
static inline u32 bcm2835_mmc_axi_outstanding_writes(void)
{
#ifdef CONFIG_ARCH_BCM2709
u32 r = readl(__io_address(ARM_LOCAL_AXI_COUNT));
#else
u32 r = 0;
#endif
return (r >> 16) & 0x3ff;
}
static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg, int from)
{
u32 delay;
if (mmc_debug & (1<<0))
while (bcm2835_mmc_axi_outstanding_reads() > 1)
cpu_relax();
if (mmc_debug & (1<<1))
while (bcm2835_mmc_axi_outstanding_writes() > 0)
cpu_relax();
lockdep_assert_held_once(&host->lock);
writel(val, host->ioaddr + reg);
udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ)));
delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf);
if (delay && !((1<<from) & mmc_debug2))
udelay(delay);
if (mmc_debug & (1<<2))
while (bcm2835_mmc_axi_outstanding_reads() > 1)
cpu_relax();
if (mmc_debug & (1<<3))
while (bcm2835_mmc_axi_outstanding_writes() > 0)
cpu_relax();
}
static inline void mmc_raw_writel(struct bcm2835_host *host, u32 val, int reg)
{
u32 delay;
if (mmc_debug & (1<<4))
while (bcm2835_mmc_axi_outstanding_reads() > 1)
cpu_relax();
if (mmc_debug & (1<<5))
while (bcm2835_mmc_axi_outstanding_writes() > 0)
cpu_relax();
lockdep_assert_held_once(&host->lock);
writel(val, host->ioaddr + reg);
delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf);
if (delay)
udelay(delay);
if (mmc_debug & (1<<6))
while (bcm2835_mmc_axi_outstanding_reads() > 1)
cpu_relax();
if (mmc_debug & (1<<7))
while (bcm2835_mmc_axi_outstanding_writes() > 0)
cpu_relax();
}
static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg)
{
u32 ret;
if (mmc_debug & (1<<8))
while (bcm2835_mmc_axi_outstanding_reads() > 1)
cpu_relax();
if (mmc_debug & (1<<9))
while (bcm2835_mmc_axi_outstanding_writes() > 0)
cpu_relax();
ret = readl(host->ioaddr + reg);
if (mmc_debug & (1<<10))
while (bcm2835_mmc_axi_outstanding_reads() > 1)
cpu_relax();
if (mmc_debug & (1<<11))
while (bcm2835_mmc_axi_outstanding_writes() > 0)
cpu_relax();
return ret;
lockdep_assert_held_once(&host->lock);
return readl(host->ioaddr + reg);
}
static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int reg)
@@ -236,7 +162,7 @@ static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int re
if (reg == SDHCI_TRANSFER_MODE)
host->shadow = newval;
else
bcm2835_mmc_writel(host, newval, reg & ~3, 0);
bcm2835_mmc_writel(host, newval, reg & ~3);
}
@@ -248,7 +174,7 @@ static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg
u32 mask = 0xff << byte_shift;
u32 newval = (oldval & ~mask) | (val << byte_shift);
bcm2835_mmc_writel(host, newval, reg & ~3, 1);
bcm2835_mmc_writel(host, newval, reg & ~3);
}
@@ -280,7 +206,7 @@ static void bcm2835_mmc_unsignal_irqs(struct bcm2835_host *host, u32 clear)
ier &= ~clear;
/* change which requests generate IRQs - makes no difference to
the content of SDHCI_INT_STATUS, or the need to acknowledge IRQs */
bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE, 2);
bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE);
}
@@ -332,7 +258,9 @@ static void bcm2835_mmc_dumpregs(struct bcm2835_host *host)
static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask)
{
unsigned long timeout;
unsigned long flags;
spin_lock_irqsave(&host->lock, flags);
bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET);
if (mask & SDHCI_RESET_ALL)
@@ -350,19 +278,23 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask)
return;
}
timeout--;
spin_unlock_irqrestore(&host->lock, flags);
mdelay(1);
spin_lock_irqsave(&host->lock, flags);
}
if (100-timeout > 10 && 100-timeout > host->max_delay) {
host->max_delay = 100-timeout;
pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay);
}
spin_unlock_irqrestore(&host->lock, flags);
}
static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios);
static void bcm2835_mmc_init(struct bcm2835_host *host, int soft)
{
unsigned long flags;
if (soft)
bcm2835_mmc_reset(host, SDHCI_RESET_CMD|SDHCI_RESET_DATA);
else
@@ -374,8 +306,10 @@ static void bcm2835_mmc_init(struct bcm2835_host *host, int soft)
SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END |
SDHCI_INT_RESPONSE;
bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3);
bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3);
spin_lock_irqsave(&host->lock, flags);
bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE);
bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
spin_unlock_irqrestore(&host->lock, flags);
if (soft) {
/* force clock reconfiguration */
@@ -574,11 +508,14 @@ static void bcm2835_mmc_transfer_dma(struct bcm2835_host *host)
dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n");
}
if (desc) {
unsigned long flags;
spin_lock_irqsave(&host->lock, flags);
bcm2835_mmc_unsignal_irqs(host, SDHCI_INT_DATA_AVAIL |
SDHCI_INT_SPACE_AVAIL);
host->tx_desc = desc;
desc->callback = bcm2835_mmc_dma_complete;
desc->callback_param = host;
spin_unlock_irqrestore(&host->lock, flags);
dmaengine_submit(desc);
dma_async_issue_pending(dma_chan);
}
@@ -597,8 +534,8 @@ static void bcm2835_mmc_set_transfer_irqs(struct bcm2835_host *host)
else
host->ier = (host->ier & ~dma_irqs) | pio_irqs;
bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 4);
bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 4);
bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE);
bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
}
@@ -680,7 +617,7 @@ static void bcm2835_mmc_set_transfer_mode(struct bcm2835_host *host,
mode |= SDHCI_TRNS_AUTO_CMD12;
else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) {
mode |= SDHCI_TRNS_AUTO_CMD23;
bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2, 5);
bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2);
}
}
@@ -743,7 +680,7 @@ void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd
bcm2835_mmc_prepare_data(host, cmd);
bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT, 6);
bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT);
bcm2835_mmc_set_transfer_mode(host, cmd);
@@ -900,8 +837,8 @@ static void bcm2835_mmc_enable_sdio_irq_nolock(struct bcm2835_host *host, int en
else
host->ier &= ~SDHCI_INT_CARD_INT;
bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 7);
bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 7);
bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE);
bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
mmiowb();
}
}
@@ -1048,7 +985,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id)
/* Clear selected interrupts. */
mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK |
SDHCI_INT_BUS_POWER);
bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS, 8);
bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS);
if (intmask & SDHCI_INT_CMD_MASK)
@@ -1078,7 +1015,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id)
if (intmask) {
unexpected |= intmask;
bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS, 9);
bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS);
}
if (result == IRQ_NONE)
@@ -1320,8 +1257,10 @@ static void bcm2835_mmc_tasklet_finish(unsigned long param)
(mrq->data && (mrq->data->error ||
(mrq->data->stop && mrq->data->stop->error))))) {
spin_unlock_irqrestore(&host->lock, flags);
bcm2835_mmc_reset(host, SDHCI_RESET_CMD);
bcm2835_mmc_reset(host, SDHCI_RESET_DATA);
spin_lock_irqsave(&host->lock, flags);
}
host->mrq = NULL;
@@ -1336,11 +1275,13 @@ static void bcm2835_mmc_tasklet_finish(unsigned long param)
int bcm2835_mmc_add_host(struct bcm2835_host *host)
static int bcm2835_mmc_add_host(struct bcm2835_host *host)
{
struct mmc_host *mmc = host->mmc;
struct device *dev = mmc->parent;
#ifndef FORCE_PIO
struct dma_slave_config cfg;
#endif
int ret;
bcm2835_mmc_reset(host, SDHCI_RESET_ALL);
@@ -1362,13 +1303,10 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host)
host->flags = SDHCI_AUTO_CMD23;
spin_lock_init(&host->lock);
dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2);
if (mmc_debug & (1<<12)) {
#ifdef FORCE_PIO
dev_info(dev, "Forcing PIO mode\n");
host->have_dma = false;
} else {
#else
if (IS_ERR_OR_NULL(host->dma_chan_tx) ||
IS_ERR_OR_NULL(host->dma_chan_rx)) {
dev_err(dev, "%s: Unable to initialise DMA channels. Falling back to PIO\n",
@@ -1392,7 +1330,7 @@ if (mmc_debug & (1<<12)) {
cfg.dst_addr = 0;
ret = dmaengine_slave_config(host->dma_chan_rx, &cfg);
}
}
#endif
mmc->max_segs = 128;
mmc->max_req_size = 524288;
mmc->max_seg_size = mmc->max_req_size;
@@ -1462,10 +1400,10 @@ static int bcm2835_mmc_probe(struct platform_device *pdev)
host->phys_addr = iomem->start + BCM2835_VCMMU_SHIFT;
if (!(mmc_debug & (1<<12))) {
#ifndef FORCE_PIO
if (node) {
host->dma_chan_tx = of_dma_request_slave_channel(node, "tx");
host->dma_chan_rx = of_dma_request_slave_channel(node, "rx");
host->dma_chan_tx = dma_request_slave_channel(dev, "tx");
host->dma_chan_rx = dma_request_slave_channel(dev, "rx");
} else {
dma_cap_mask_t mask;
@@ -1475,7 +1413,7 @@ if (!(mmc_debug & (1<<12))) {
host->dma_chan_tx = dma_request_channel(mask, NULL, NULL);
host->dma_chan_rx = dma_request_channel(mask, NULL, NULL);
}
}
#endif
clk = devm_clk_get(dev, NULL);
if (IS_ERR(clk)) {
dev_err(dev, "could not get clk\n");
@@ -1576,8 +1514,6 @@ static struct platform_driver bcm2835_mmc_driver = {
};
module_platform_driver(bcm2835_mmc_driver);
module_param(mmc_debug, uint, 0644);
module_param(mmc_debug2, uint, 0644);
MODULE_ALIAS("platform:mmc-bcm2835");
MODULE_DESCRIPTION("BCM2835 SDHCI driver");
MODULE_LICENSE("GPL v2");

View File

@@ -115,7 +115,7 @@
#ifdef CONFIG_MMC_BCM2835_SDHOST_PIO_DMA_BARRIER
#define PIO_DMA_BARRIER CONFIG_MMC_BCM2835_SDHOST_PIO_DMA_BARRIER
#else
#define PIO_DMA_BARRIER 00
#define PIO_DMA_BARRIER 0
#endif
#define MIN_FREQ 400000
@@ -176,6 +176,7 @@ struct bcm2835_host {
struct dma_chan *dma_chan_rx; /* DMA channel for reads */
struct dma_chan *dma_chan_tx; /* DMA channel for writes */
bool allow_dma;
bool have_dma;
bool use_dma;
/*end of DMA part*/
@@ -621,7 +622,8 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co
bcm2835_sdhost_set_transfer_irqs(host);
bcm2835_sdhost_write(host, data->blksz, SDHBCT);
bcm2835_sdhost_write(host, data->blocks, SDHBLC);
if (host->use_dma)
bcm2835_sdhost_write(host, data->blocks, SDHBLC);
BUG_ON(!host->data);
}
@@ -1235,53 +1237,41 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock)
623->400KHz/27.8MHz
reset value (507)->491159/50MHz
BUT, the 3-bit clock divisor in data mode is too small if the
core clock is higher than 250MHz, so instead use the SLOW_CARD
configuration bit to force the use of the ident clock divisor
at all times.
*/
host->mmc->actual_clock = 0;
if (clock <= 400000) {
/* It's an ident clock - don't worry about the lower bits */
host->slow_card = true;
if (clock < 100000) {
/* Can't stop the clock, but make it as slow as possible
* to show willing
*/
host->cdiv = SDCDIV_MAX_CDIV;
bcm2835_sdhost_write(host, host->cdiv, SDCDIV);
return;
}
div = host->max_clk / clock;
if ((host->max_clk / div) > 400000)
div++;
div -= 2;
if (div > SDCDIV_MAX_CDIV)
div = SDCDIV_MAX_CDIV;
host->mmc->actual_clock = host->max_clk / (div + 2);
} else {
/* It's a data clock - choose the lower bits, and make
the upper bits vaguely sensible */
host->slow_card = false;
for (div = 0x0; div < 0x7; div++) {
if ((host->max_clk / (div + 2)) <= clock)
break;
}
host->mmc->actual_clock = host->max_clk / (div + 2);
div |= (((host->max_clk / 400000) - 2) & ~0x7);
if ((host->max_clk / (div + 2)) > 400000)
div += 0x8;
if (clock < 100000) {
/* Can't stop the clock, but make it as slow as possible
* to show willing
*/
host->cdiv = SDCDIV_MAX_CDIV;
bcm2835_sdhost_write(host, host->cdiv, SDCDIV);
return;
}
div = host->max_clk / clock;
if (div < 2)
div = 2;
if ((host->max_clk / div) > clock)
div++;
div -= 2;
if (div > SDCDIV_MAX_CDIV)
div = SDCDIV_MAX_CDIV;
host->mmc->actual_clock = host->max_clk / (div + 2);
host->cdiv = div;
bcm2835_sdhost_write(host, host->cdiv, SDCDIV);
pr_debug(DRIVER_NAME ": cdiv=%x (actual clock %d, data clock %d)\n",
host->cdiv, host->mmc->actual_clock,
host->max_clk / ((div & 0x7) + 2));
pr_debug(DRIVER_NAME ": clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n",
clock, host->max_clk, host->cdiv, host->mmc->actual_clock);
}
static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq)
@@ -1347,7 +1337,6 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
spin_lock_irqsave(&host->lock, flags);
pr_debug("host->clock = %d\n", host->clock);
if (!ios->clock || ios->clock != host->clock) {
bcm2835_sdhost_set_clock(host, ios->clock);
host->clock = ios->clock;
@@ -1360,9 +1349,8 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
host->hcfg |= SDHCFG_WIDE_INT_BUS;
host->hcfg &= ~SDHCFG_SLOW_CARD;
if (host->slow_card || !ALLOW_FAST)
host->hcfg |= SDHCFG_SLOW_CARD;
/* Disable clever clock switching, to cope with fast core clocks */
host->hcfg |= SDHCFG_SLOW_CARD;
bcm2835_sdhost_write(host, host->hcfg, SDHCFG);
@@ -1390,7 +1378,7 @@ static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card,
}
static struct mmc_host_ops bcm2835_ops = {
static struct mmc_host_ops bcm2835_sdhost_ops = {
.request = bcm2835_sdhost_request,
.set_ios = bcm2835_sdhost_set_ios,
.enable_sdio_irq = bcm2835_sdhost_enable_sdio_irq,
@@ -1454,8 +1442,6 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host)
bcm2835_sdhost_reset(host);
mmc->ops = &bcm2835_ops;
mmc->f_max = host->max_clk;
mmc->f_max = host->max_clk;
mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV;
@@ -1465,14 +1451,14 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host)
mmc->max_busy_timeout = (1 << 27) / host->timeout_clk;
#endif
/* host controller capabilities */
mmc->caps = /*XXX MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA |
mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA |
MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED |
MMC_CAP_NEEDS_POLL |
(ALLOW_CMD23 * MMC_CAP_CMD23);
spin_lock_init(&host->lock);
if (ALLOW_DMA) {
if (host->allow_dma) {
if (!host->dma_chan_tx || !host->dma_chan_rx ||
IS_ERR(host->dma_chan_tx) || IS_ERR(host->dma_chan_rx)) {
pr_err("%s: Unable to initialise DMA channels. Falling back to PIO\n", DRIVER_NAME);
@@ -1559,7 +1545,7 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev)
if (!mmc)
return -ENOMEM;
mmc->ops = &bcm2835_ops;
mmc->ops = &bcm2835_sdhost_ops;
host = mmc_priv(mmc);
host->mmc = mmc;
host->timeout = msecs_to_jiffies(1000);
@@ -1578,12 +1564,23 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev)
(unsigned long)iomem->start,
(unsigned long)host->phys_addr);
if (ALLOW_DMA) {
host->allow_dma = ALLOW_DMA;
if (node) {
/* Read any custom properties */
of_property_read_u32(node,
"brcm,delay-after-stop",
&host->delay_after_stop);
host->allow_dma = ALLOW_DMA &&
!of_property_read_bool(node, "brcm,force-pio");
}
if (host->allow_dma) {
if (node) {
host->dma_chan_tx =
of_dma_request_slave_channel(node, "tx");
dma_request_slave_channel(dev, "tx");
host->dma_chan_rx =
of_dma_request_slave_channel(node, "rx");
dma_request_slave_channel(dev, "rx");
} else {
dma_cap_mask_t mask;
@@ -1597,12 +1594,6 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev)
}
}
if (node) {
/* Read any custom properties */
of_property_read_u32(node,
"brcm,delay_after_stop",
&host->delay_after_stop);
}
clk = devm_clk_get(dev, NULL);
if (IS_ERR(clk)) {
dev_err(dev, "could not get clk\n");

View File

@@ -531,20 +531,8 @@ struct bnx2x_fastpath {
struct napi_struct napi;
#ifdef CONFIG_NET_RX_BUSY_POLL
unsigned int state;
#define BNX2X_FP_STATE_IDLE 0
#define BNX2X_FP_STATE_NAPI (1 << 0) /* NAPI owns this FP */
#define BNX2X_FP_STATE_POLL (1 << 1) /* poll owns this FP */
#define BNX2X_FP_STATE_DISABLED (1 << 2)
#define BNX2X_FP_STATE_NAPI_YIELD (1 << 3) /* NAPI yielded this FP */
#define BNX2X_FP_STATE_POLL_YIELD (1 << 4) /* poll yielded this FP */
#define BNX2X_FP_OWNED (BNX2X_FP_STATE_NAPI | BNX2X_FP_STATE_POLL)
#define BNX2X_FP_YIELD (BNX2X_FP_STATE_NAPI_YIELD | BNX2X_FP_STATE_POLL_YIELD)
#define BNX2X_FP_LOCKED (BNX2X_FP_OWNED | BNX2X_FP_STATE_DISABLED)
#define BNX2X_FP_USER_PEND (BNX2X_FP_STATE_POLL | BNX2X_FP_STATE_POLL_YIELD)
/* protect state */
spinlock_t lock;
#endif /* CONFIG_NET_RX_BUSY_POLL */
unsigned long busy_poll_state;
#endif
union host_hc_status_block status_blk;
/* chip independent shortcuts into sb structure */
@@ -619,104 +607,83 @@ struct bnx2x_fastpath {
#define bnx2x_fp_qstats(bp, fp) (&((bp)->fp_stats[(fp)->index].eth_q_stats))
#ifdef CONFIG_NET_RX_BUSY_POLL
static inline void bnx2x_fp_init_lock(struct bnx2x_fastpath *fp)
enum bnx2x_fp_state {
BNX2X_STATE_FP_NAPI = BIT(0), /* NAPI handler owns the queue */
BNX2X_STATE_FP_NAPI_REQ_BIT = 1, /* NAPI would like to own the queue */
BNX2X_STATE_FP_NAPI_REQ = BIT(1),
BNX2X_STATE_FP_POLL_BIT = 2,
BNX2X_STATE_FP_POLL = BIT(2), /* busy_poll owns the queue */
BNX2X_STATE_FP_DISABLE_BIT = 3, /* queue is dismantled */
};
static inline void bnx2x_fp_busy_poll_init(struct bnx2x_fastpath *fp)
{
spin_lock_init(&fp->lock);
fp->state = BNX2X_FP_STATE_IDLE;
WRITE_ONCE(fp->busy_poll_state, 0);
}
/* called from the device poll routine to get ownership of a FP */
static inline bool bnx2x_fp_lock_napi(struct bnx2x_fastpath *fp)
{
bool rc = true;
unsigned long prev, old = READ_ONCE(fp->busy_poll_state);
spin_lock_bh(&fp->lock);
if (fp->state & BNX2X_FP_LOCKED) {
WARN_ON(fp->state & BNX2X_FP_STATE_NAPI);
fp->state |= BNX2X_FP_STATE_NAPI_YIELD;
rc = false;
} else {
/* we don't care if someone yielded */
fp->state = BNX2X_FP_STATE_NAPI;
while (1) {
switch (old) {
case BNX2X_STATE_FP_POLL:
/* make sure bnx2x_fp_lock_poll() wont starve us */
set_bit(BNX2X_STATE_FP_NAPI_REQ_BIT,
&fp->busy_poll_state);
/* fallthrough */
case BNX2X_STATE_FP_POLL | BNX2X_STATE_FP_NAPI_REQ:
return false;
default:
break;
}
prev = cmpxchg(&fp->busy_poll_state, old, BNX2X_STATE_FP_NAPI);
if (unlikely(prev != old)) {
old = prev;
continue;
}
return true;
}
spin_unlock_bh(&fp->lock);
return rc;
}
/* returns true is someone tried to get the FP while napi had it */
static inline bool bnx2x_fp_unlock_napi(struct bnx2x_fastpath *fp)
static inline void bnx2x_fp_unlock_napi(struct bnx2x_fastpath *fp)
{
bool rc = false;
spin_lock_bh(&fp->lock);
WARN_ON(fp->state &
(BNX2X_FP_STATE_POLL | BNX2X_FP_STATE_NAPI_YIELD));
if (fp->state & BNX2X_FP_STATE_POLL_YIELD)
rc = true;
/* state ==> idle, unless currently disabled */
fp->state &= BNX2X_FP_STATE_DISABLED;
spin_unlock_bh(&fp->lock);
return rc;
smp_wmb();
fp->busy_poll_state = 0;
}
/* called from bnx2x_low_latency_poll() */
static inline bool bnx2x_fp_lock_poll(struct bnx2x_fastpath *fp)
{
bool rc = true;
spin_lock_bh(&fp->lock);
if ((fp->state & BNX2X_FP_LOCKED)) {
fp->state |= BNX2X_FP_STATE_POLL_YIELD;
rc = false;
} else {
/* preserve yield marks */
fp->state |= BNX2X_FP_STATE_POLL;
}
spin_unlock_bh(&fp->lock);
return rc;
return cmpxchg(&fp->busy_poll_state, 0, BNX2X_STATE_FP_POLL) == 0;
}
/* returns true if someone tried to get the FP while it was locked */
static inline bool bnx2x_fp_unlock_poll(struct bnx2x_fastpath *fp)
static inline void bnx2x_fp_unlock_poll(struct bnx2x_fastpath *fp)
{
bool rc = false;
spin_lock_bh(&fp->lock);
WARN_ON(fp->state & BNX2X_FP_STATE_NAPI);
if (fp->state & BNX2X_FP_STATE_POLL_YIELD)
rc = true;
/* state ==> idle, unless currently disabled */
fp->state &= BNX2X_FP_STATE_DISABLED;
spin_unlock_bh(&fp->lock);
return rc;
smp_mb__before_atomic();
clear_bit(BNX2X_STATE_FP_POLL_BIT, &fp->busy_poll_state);
}
/* true if a socket is polling, even if it did not get the lock */
/* true if a socket is polling */
static inline bool bnx2x_fp_ll_polling(struct bnx2x_fastpath *fp)
{
WARN_ON(!(fp->state & BNX2X_FP_OWNED));
return fp->state & BNX2X_FP_USER_PEND;
return READ_ONCE(fp->busy_poll_state) & BNX2X_STATE_FP_POLL;
}
/* false if fp is currently owned */
static inline bool bnx2x_fp_ll_disable(struct bnx2x_fastpath *fp)
{
int rc = true;
set_bit(BNX2X_STATE_FP_DISABLE_BIT, &fp->busy_poll_state);
return !bnx2x_fp_ll_polling(fp);
spin_lock_bh(&fp->lock);
if (fp->state & BNX2X_FP_OWNED)
rc = false;
fp->state |= BNX2X_FP_STATE_DISABLED;
spin_unlock_bh(&fp->lock);
return rc;
}
#else
static inline void bnx2x_fp_init_lock(struct bnx2x_fastpath *fp)
static inline void bnx2x_fp_busy_poll_init(struct bnx2x_fastpath *fp)
{
}
@@ -725,9 +692,8 @@ static inline bool bnx2x_fp_lock_napi(struct bnx2x_fastpath *fp)
return true;
}
static inline bool bnx2x_fp_unlock_napi(struct bnx2x_fastpath *fp)
static inline void bnx2x_fp_unlock_napi(struct bnx2x_fastpath *fp)
{
return false;
}
static inline bool bnx2x_fp_lock_poll(struct bnx2x_fastpath *fp)
@@ -735,9 +701,8 @@ static inline bool bnx2x_fp_lock_poll(struct bnx2x_fastpath *fp)
return false;
}
static inline bool bnx2x_fp_unlock_poll(struct bnx2x_fastpath *fp)
static inline void bnx2x_fp_unlock_poll(struct bnx2x_fastpath *fp)
{
return false;
}
static inline bool bnx2x_fp_ll_polling(struct bnx2x_fastpath *fp)

View File

@@ -1849,7 +1849,7 @@ static void bnx2x_napi_enable_cnic(struct bnx2x *bp)
int i;
for_each_rx_queue_cnic(bp, i) {
bnx2x_fp_init_lock(&bp->fp[i]);
bnx2x_fp_busy_poll_init(&bp->fp[i]);
napi_enable(&bnx2x_fp(bp, i, napi));
}
}
@@ -1859,7 +1859,7 @@ static void bnx2x_napi_enable(struct bnx2x *bp)
int i;
for_each_eth_queue(bp, i) {
bnx2x_fp_init_lock(&bp->fp[i]);
bnx2x_fp_busy_poll_init(&bp->fp[i]);
napi_enable(&bnx2x_fp(bp, i, napi));
}
}
@@ -3191,9 +3191,10 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
}
}
bnx2x_fp_unlock_napi(fp);
/* Fall out from the NAPI loop if needed */
if (!bnx2x_fp_unlock_napi(fp) &&
!(bnx2x_has_rx_work(fp) || bnx2x_has_tx_work(fp))) {
if (!(bnx2x_has_rx_work(fp) || bnx2x_has_tx_work(fp))) {
/* No need to update SB for FCoE L2 ring as long as
* it's connected to the default SB and the SB

View File

@@ -1713,12 +1713,6 @@ static int vxlan6_xmit_skb(struct dst_entry *dst, struct sk_buff *skb,
}
}
skb = iptunnel_handle_offloads(skb, udp_sum, type);
if (IS_ERR(skb)) {
err = -EINVAL;
goto err;
}
skb_scrub_packet(skb, xnet);
min_headroom = LL_RESERVED_SPACE(dst->dev) + dst->header_len
@@ -1738,6 +1732,12 @@ static int vxlan6_xmit_skb(struct dst_entry *dst, struct sk_buff *skb,
goto err;
}
skb = iptunnel_handle_offloads(skb, udp_sum, type);
if (IS_ERR(skb)) {
err = -EINVAL;
goto err;
}
vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
vxh->vx_flags = htonl(VXLAN_HF_VNI);
vxh->vx_vni = md->vni;
@@ -1798,10 +1798,6 @@ int vxlan_xmit_skb(struct rtable *rt, struct sk_buff *skb,
}
}
skb = iptunnel_handle_offloads(skb, udp_sum, type);
if (IS_ERR(skb))
return PTR_ERR(skb);
min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len
+ VXLAN_HLEN + sizeof(struct iphdr)
+ (skb_vlan_tag_present(skb) ? VLAN_HLEN : 0);
@@ -1817,6 +1813,10 @@ int vxlan_xmit_skb(struct rtable *rt, struct sk_buff *skb,
if (WARN_ON(!skb))
return -ENOMEM;
skb = iptunnel_handle_offloads(skb, udp_sum, type);
if (IS_ERR(skb))
return PTR_ERR(skb);
vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
vxh->vx_flags = htonl(VXLAN_HF_VNI);
vxh->vx_vni = md->vni;

View File

@@ -7,12 +7,3 @@ config RTL8192CU
---help---
This option adds the Realtek RTL8192CU USB device such as Edimax EW-7811Un.
if RTL8192CU
config AP_MODE
bool "Realtek RTL8192CU AP mode"
default y
---help---
This option enables Access Point mode.
endif

View File

@@ -78,7 +78,7 @@ void notrace _fiq_print(enum fiq_debug_level dbg_lvl, volatile struct fiq_state
* fiq_fsm_spin_lock() - ARMv6+ bare bones spinlock
* Must be called with local interrupts and FIQ disabled.
*/
#ifdef CONFIG_ARCH_BCM2709
#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP)
inline void fiq_fsm_spin_lock(fiq_lock_t *lock)
{
unsigned long tmp;
@@ -111,7 +111,7 @@ inline void fiq_fsm_spin_lock(fiq_lock_t *lock) { }
/**
* fiq_fsm_spin_unlock() - ARMv6+ bare bones spinunlock
*/
#ifdef CONFIG_ARCH_BCM2709
#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP)
inline void fiq_fsm_spin_unlock(fiq_lock_t *lock)
{
smp_mb();

View File

@@ -1265,6 +1265,53 @@ static void check_unsafe_exec(struct linux_binprm *bprm)
spin_unlock(&p->fs->lock);
}
static void bprm_fill_uid(struct linux_binprm *bprm)
{
struct inode *inode;
unsigned int mode;
kuid_t uid;
kgid_t gid;
/* clear any previous set[ug]id data from a previous binary */
bprm->cred->euid = current_euid();
bprm->cred->egid = current_egid();
if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
return;
if (task_no_new_privs(current))
return;
inode = file_inode(bprm->file);
mode = READ_ONCE(inode->i_mode);
if (!(mode & (S_ISUID|S_ISGID)))
return;
/* Be careful if suid/sgid is set */
mutex_lock(&inode->i_mutex);
/* reload atomically mode/uid/gid now that lock held */
mode = inode->i_mode;
uid = inode->i_uid;
gid = inode->i_gid;
mutex_unlock(&inode->i_mutex);
/* We ignore suid/sgid if there are no mappings for them in the ns */
if (!kuid_has_mapping(bprm->cred->user_ns, uid) ||
!kgid_has_mapping(bprm->cred->user_ns, gid))
return;
if (mode & S_ISUID) {
bprm->per_clear |= PER_CLEAR_ON_SETID;
bprm->cred->euid = uid;
}
if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
bprm->per_clear |= PER_CLEAR_ON_SETID;
bprm->cred->egid = gid;
}
}
/*
* Fill the binprm structure from the inode.
* Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes
@@ -1273,36 +1320,9 @@ static void check_unsafe_exec(struct linux_binprm *bprm)
*/
int prepare_binprm(struct linux_binprm *bprm)
{
struct inode *inode = file_inode(bprm->file);
umode_t mode = inode->i_mode;
int retval;
/* clear any previous set[ug]id data from a previous binary */
bprm->cred->euid = current_euid();
bprm->cred->egid = current_egid();
if (!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) &&
!task_no_new_privs(current) &&
kuid_has_mapping(bprm->cred->user_ns, inode->i_uid) &&
kgid_has_mapping(bprm->cred->user_ns, inode->i_gid)) {
/* Set-uid? */
if (mode & S_ISUID) {
bprm->per_clear |= PER_CLEAR_ON_SETID;
bprm->cred->euid = inode->i_uid;
}
/* Set-gid? */
/*
* If setgid is set but no group execute bit then this
* is a candidate for mandatory locking, not a setgid
* executable.
*/
if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
bprm->per_clear |= PER_CLEAR_ON_SETID;
bprm->cred->egid = inode->i_gid;
}
}
bprm_fill_uid(bprm);
/* fill in binprm security blob */
retval = security_bprm_set_creds(bprm);

View File

@@ -1380,7 +1380,8 @@ peek_stack:
/* tell verifier to check for equivalent states
* after every call and jump
*/
env->explored_states[t + 1] = STATE_LIST_MARK;
if (t + 1 < insn_cnt)
env->explored_states[t + 1] = STATE_LIST_MARK;
} else {
/* conditional jump with two edges */
ret = push_insn(t, t + 1, FALLTHROUGH, env);

View File

@@ -4169,19 +4169,21 @@ EXPORT_SYMBOL(skb_try_coalesce);
*/
void skb_scrub_packet(struct sk_buff *skb, bool xnet)
{
if (xnet)
skb_orphan(skb);
skb->tstamp.tv64 = 0;
skb->pkt_type = PACKET_HOST;
skb->skb_iif = 0;
skb->ignore_df = 0;
skb_dst_drop(skb);
skb->mark = 0;
skb_sender_cpu_clear(skb);
skb_init_secmark(skb);
secpath_reset(skb);
nf_reset(skb);
nf_reset_trace(skb);
if (!xnet)
return;
skb_orphan(skb);
skb->mark = 0;
}
EXPORT_SYMBOL_GPL(skb_scrub_packet);

View File

@@ -113,10 +113,6 @@ int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt,
int min_headroom;
int err;
skb = udp_tunnel_handle_offloads(skb, csum);
if (IS_ERR(skb))
return PTR_ERR(skb);
min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len
+ GENEVE_BASE_HLEN + opt_len + sizeof(struct iphdr)
+ (skb_vlan_tag_present(skb) ? VLAN_HLEN : 0);
@@ -131,6 +127,10 @@ int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt,
if (unlikely(!skb))
return -ENOMEM;
skb = udp_tunnel_handle_offloads(skb, csum);
if (IS_ERR(skb))
return PTR_ERR(skb);
gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) + opt_len);
geneve_build_header(gnvh, tun_flags, vni, opt_len, opt);

View File

@@ -2929,6 +2929,8 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
}
#endif
/* Do not fool tcpdump (if any), clean our debris */
skb->tstamp.tv64 = 0;
return skb;
}
EXPORT_SYMBOL(tcp_make_synack);