Commit dfdc1de6 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'staging-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver updates from Greg KH:
 "Here is the big set of staging driver updates for 5.18-rc1.

  Loads of tiny cleanups for almost all staging drivers in here, nothing
  major at all. Highlights include:

   - remove the ashmem Android driver. It is long-dead and if there are
     any legacy userspace applications still using it, the Android
     kernel images will maintain it, the community shouldn't care about
     it anymore

   - wfx wifi driver major cleanups. Should be ready to merge out of
     staging soon, and will coordinate with the wifi maintainers after
     -rc1 is out

   - major cleanups and unwinding of the layers of the r8188eu driver.
     It's amazing just how many unneeded layers of abstraction is in
     there, just when we think it's done, another is found...

   - lots of tiny coding style cleanups in many other staging drivers.

  All have been in linux-next for a while with no reported problems"

* tag 'staging-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (455 commits)
  staging: r8188eu: remove unnecessary memset in r8188eu
  staging: greybus: introduce pwm_ops::apply
  staging: rts5208: Resolve checkpatch.pl issues.
  staging: sm750fb: fix naming style
  staging: fbtft: Consider type of init sequence values in fbtft_init_display()
  staging: fbtft: Constify buf parameter in fbtft_dbg_hex()
  staging: mmal-vchiq: clear redundant item named bulk_scratch
  mips: dts: ralink: add MT7621 SoC
  staging: r8188eu: remove some unused local ieee80211 macros
  staging: r8188eu: make rtl8188e_process_phy_info static
  staging: r8188eu: remove unused function prototype
  staging: r8188eu: remove three unused receive defines
  staging: r8188eu: remove unnecessary initializations
  staging: rtl8192e: Fix spelling mistake "RESQUEST" -> "REQUEST"
  MAINTAINERS: remove the obsolete file entry for staging in ANDROID DRIVERS
  staging: r8188eu: proper error handling in rtw_init_drv_sw
  staging: r8188eu: call _cancel_timer_ex from _rtw_free_recv_priv
  staging: vt6656: Removed unused variable vt3342_vnt_threshold
  staging: vt6656: Removed unused variable bb_vga_0
  staging: remove ashmem
  ...
parents 266d17a8 41197a5f
...@@ -22,6 +22,11 @@ description: | ...@@ -22,6 +22,11 @@ description: |
The clocks are provided inside a system controller node. The clocks are provided inside a system controller node.
This node is also a reset provider for all the peripherals.
Reset related bits are defined in:
[2]: <include/dt-bindings/reset/mt7621-reset.h>.
properties: properties:
compatible: compatible:
items: items:
...@@ -37,6 +42,12 @@ properties: ...@@ -37,6 +42,12 @@ properties:
clocks. clocks.
const: 1 const: 1
"#reset-cells":
description:
The first cell indicates the reset bit within the register, see
[2] for available resets.
const: 1
ralink,memctl: ralink,memctl:
$ref: /schemas/types.yaml#/definitions/phandle $ref: /schemas/types.yaml#/definitions/phandle
description: description:
...@@ -61,6 +72,7 @@ examples: ...@@ -61,6 +72,7 @@ examples:
compatible = "mediatek,mt7621-sysc", "syscon"; compatible = "mediatek,mt7621-sysc", "syscon";
reg = <0x0 0x100>; reg = <0x0 0x100>;
#clock-cells = <1>; #clock-cells = <1>;
#reset-cells = <1>;
ralink,memctl = <&memc>; ralink,memctl = <&memc>;
clock-output-names = "xtal", "cpu", "bus", clock-output-names = "xtal", "cpu", "bus",
"50m", "125m", "150m", "50m", "125m", "150m",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
%YAML 1.2 %YAML 1.2
--- ---
$id: http://devicetree.org/schemas/net/wireless/silabs,wfx.yaml# $id: http://devicetree.org/schemas/staging/net/wireless/silabs,wfx.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Silicon Labs WFxxx devicetree bindings title: Silicon Labs WFxxx devicetree bindings
...@@ -11,67 +11,79 @@ title: Silicon Labs WFxxx devicetree bindings ...@@ -11,67 +11,79 @@ title: Silicon Labs WFxxx devicetree bindings
maintainers: maintainers:
- Jérôme Pouiller <jerome.pouiller@silabs.com> - Jérôme Pouiller <jerome.pouiller@silabs.com>
description: description: >
The WFxxx chip series can be connected via SPI or via SDIO. Support for the Wifi chip WFxxx from Silicon Labs. Currently, the only device
from the WFxxx series is the WF200 described here:
https://www.silabs.com/documents/public/data-sheets/wf200-datasheet.pdf
For SDIO':' The WF200 can be connected via SPI or via SDIO.
The driver is able to detect a WFxxx chip on SDIO bus by matching its Vendor For SDIO:
ID and Product ID. However, driver will only provide limited features in
this case. Thus declaring WFxxx chip in device tree is recommended (and may
become mandatory in the future).
In addition, it is recommended to declare a mmc-pwrseq on SDIO host above Declaring the WFxxx chip in device tree is mandatory (usually, the VID/PID is
WFx. Without it, you may encounter issues with warm boot. The mmc-pwrseq sufficient for the SDIO devices).
should be compatible with mmc-pwrseq-simple. Please consult
It is recommended to declare a mmc-pwrseq on SDIO host above WFx. Without
it, you may encounter issues during reboot. The mmc-pwrseq should be
compatible with mmc-pwrseq-simple. Please consult
Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml for more Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml for more
information. information.
For SPI':' For SPI:
In add of the properties below, please consult In add of the properties below, please consult
Documentation/devicetree/bindings/spi/spi-controller.yaml for optional SPI Documentation/devicetree/bindings/spi/spi-controller.yaml for optional SPI
related properties. related properties.
Note that in add of the properties below, the WFx driver also supports
`mac-address` and `local-mac-address` as described in
Documentation/devicetree/bindings/net/ethernet.txt
properties: properties:
compatible: compatible:
const: silabs,wf200 items:
- enum:
- silabs,brd4001a # WGM160P Evaluation Board
- silabs,brd8022a # WF200 Evaluation Board
- silabs,brd8023a # WFM200 Evaluation Board
- const: silabs,wf200 # Chip alone without antenna
reg: reg:
description: description:
When used on SDIO bus, <reg> must be set to 1. When used on SPI bus, it is When used on SDIO bus, <reg> must be set to 1. When used on SPI bus, it is
the chip select address of the device as defined in the SPI devices the chip select address of the device as defined in the SPI devices
bindings. bindings.
maxItems: 1 maxItems: 1
spi-max-frequency:
description: (SPI only) Maximum SPI clocking speed of device in Hz. spi-max-frequency: true
maxItems: 1
interrupts: interrupts:
description: The interrupt line. Triggers IRQ_TYPE_LEVEL_HIGH and description: The interrupt line. Should be IRQ_TYPE_EDGE_RISING. When SPI is
IRQ_TYPE_EDGE_RISING are both supported by the chip and the driver. When used, this property is required. When SDIO is used, the "in-band"
SPI is used, this property is required. When SDIO is used, the "in-band"
interrupt provided by the SDIO bus is used unless an interrupt is defined interrupt provided by the SDIO bus is used unless an interrupt is defined
in the Device Tree. in the Device Tree.
maxItems: 1 maxItems: 1
reset-gpios: reset-gpios:
description: (SPI only) Phandle of gpio that will be used to reset chip description: (SPI only) Phandle of gpio that will be used to reset chip
during probe. Without this property, you may encounter issues with warm during probe. Without this property, you may encounter issues with warm
boot. (For legacy purpose, the gpio in inverted when compatible == boot.
"silabs,wfx-spi")
For SDIO, the reset gpio should declared using a mmc-pwrseq. For SDIO, the reset gpio should declared using a mmc-pwrseq.
maxItems: 1 maxItems: 1
wakeup-gpios: wakeup-gpios:
description: Phandle of gpio that will be used to wake-up chip. Without this description: Phandle of gpio that will be used to wake-up chip. Without this
property, driver will disable most of power saving features. property, driver will disable most of power saving features.
maxItems: 1 maxItems: 1
config-file:
description: Use an alternative file as PDS. Default is `wf200.pds`. Only silabs,antenna-config-file:
necessary for development/debug purpose. $ref: /schemas/types.yaml#/definitions/string
maxItems: 1 description: Use an alternative file for antenna configuration (aka
"Platform Data Set" in Silabs jargon). Default depends of "compatible"
string. For "silabs,wf200", the default is 'wf200.pds'.
local-mac-address: true
mac-address: true
additionalProperties: false
required: required:
- compatible - compatible
...@@ -82,12 +94,12 @@ examples: ...@@ -82,12 +94,12 @@ examples:
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/irq.h>
spi0 { spi {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
wfx@0 { wifi@0 {
compatible = "silabs,wf200"; compatible = "silabs,brd8022a", "silabs,wf200";
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&wfx_irq &wfx_gpios>; pinctrl-0 = <&wfx_irq &wfx_gpios>;
reg = <0>; reg = <0>;
...@@ -109,13 +121,13 @@ examples: ...@@ -109,13 +121,13 @@ examples:
reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
}; };
mmc0 { mmc {
mmc-pwrseq = <&wfx_pwrseq>; mmc-pwrseq = <&wfx_pwrseq>;
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
mmc@1 { wifi@1 {
compatible = "silabs,wf200"; compatible = "silabs,brd8022a", "silabs,wf200";
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&wfx_wakeup>; pinctrl-0 = <&wfx_wakeup>;
reg = <1>; reg = <1>;
......
...@@ -1325,7 +1325,6 @@ L: linux-kernel@vger.kernel.org ...@@ -1325,7 +1325,6 @@ L: linux-kernel@vger.kernel.org
S: Supported S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
F: drivers/android/ F: drivers/android/
F: drivers/staging/android/
ANDROID GOLDFISH PIC DRIVER ANDROID GOLDFISH PIC DRIVER
M: Miodrag Dinic <miodrag.dinic@mips.com> M: Miodrag Dinic <miodrag.dinic@mips.com>
...@@ -16460,6 +16459,13 @@ L: linux-mips@vger.kernel.org ...@@ -16460,6 +16459,13 @@ L: linux-mips@vger.kernel.org
S: Maintained S: Maintained
F: arch/mips/ralink F: arch/mips/ralink
RALINK MT7621 MIPS ARCHITECTURE
M: Arınç ÜNAL <arinc.unal@arinc9.com>
M: Sergio Paracuellos <sergio.paracuellos@gmail.com>
L: linux-mips@vger.kernel.org
S: Maintained
F: arch/mips/boot/dts/ralink/mt7621*
RALINK RT2X00 WIRELESS LAN DRIVER RALINK RT2X00 WIRELESS LAN DRIVER
M: Stanislaw Gruszka <stf_xl@wp.pl> M: Stanislaw Gruszka <stf_xl@wp.pl>
M: Helmut Schaa <helmut.schaa@googlemail.com> M: Helmut Schaa <helmut.schaa@googlemail.com>
...@@ -17940,6 +17946,7 @@ F: drivers/platform/x86/touchscreen_dmi.c ...@@ -17940,6 +17946,7 @@ F: drivers/platform/x86/touchscreen_dmi.c
SILICON LABS WIRELESS DRIVERS (for WFxxx series) SILICON LABS WIRELESS DRIVERS (for WFxxx series)
M: Jérôme Pouiller <jerome.pouiller@silabs.com> M: Jérôme Pouiller <jerome.pouiller@silabs.com>
S: Supported S: Supported
F: Documentation/devicetree/bindings/staging/net/wireless/silabs,wfx.yaml
F: drivers/staging/wfx/ F: drivers/staging/wfx/
SILICON MOTION SM712 FRAME BUFFER DRIVER SILICON MOTION SM712 FRAME BUFFER DRIVER
......
...@@ -6,4 +6,8 @@ dtb-$(CONFIG_DTB_MT7620A_EVAL) += mt7620a_eval.dtb ...@@ -6,4 +6,8 @@ dtb-$(CONFIG_DTB_MT7620A_EVAL) += mt7620a_eval.dtb
dtb-$(CONFIG_DTB_OMEGA2P) += omega2p.dtb dtb-$(CONFIG_DTB_OMEGA2P) += omega2p.dtb
dtb-$(CONFIG_DTB_VOCORE2) += vocore2.dtb dtb-$(CONFIG_DTB_VOCORE2) += vocore2.dtb
dtb-$(CONFIG_SOC_MT7621) += \
mt7621-gnubee-gb-pc1.dtb \
mt7621-gnubee-gb-pc2.dtb
obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y)) obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
...@@ -12,7 +12,8 @@ / { ...@@ -12,7 +12,8 @@ / {
memory@0 { memory@0 {
device_type = "memory"; device_type = "memory";
reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; reg = <0x00000000 0x1c000000>,
<0x20000000 0x04000000>;
}; };
chosen { chosen {
...@@ -38,24 +39,16 @@ reset { ...@@ -38,24 +39,16 @@ reset {
gpio-leds { gpio-leds {
compatible = "gpio-leds"; compatible = "gpio-leds";
system { power {
label = "gb-pc1:green:system"; label = "green:power";
gpios = <&gpio 6 GPIO_ACTIVE_LOW>; gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
linux,default-trigger = "default-on";
}; };
status { system {
label = "gb-pc1:green:status"; label = "green:system";
gpios = <&gpio 8 GPIO_ACTIVE_LOW>; gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
}; linux,default-trigger = "disk-activity";
lan1 {
label = "gb-pc1:green:lan1";
gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
};
lan2 {
label = "gb-pc1:green:lan2";
gpios = <&gpio 25 GPIO_ACTIVE_LOW>;
}; };
}; };
}; };
...@@ -95,9 +88,8 @@ factory: partition@40000 { ...@@ -95,9 +88,8 @@ factory: partition@40000 {
partition@50000 { partition@50000 {
label = "firmware"; label = "firmware";
reg = <0x50000 0x1FB0000>; reg = <0x50000 0x1fb0000>;
}; };
}; };
}; };
...@@ -106,23 +98,31 @@ &pcie { ...@@ -106,23 +98,31 @@ &pcie {
}; };
&pinctrl { &pinctrl {
state_default: pinctrl0 { pinctrl-names = "default";
default_gpio: gpio { pinctrl-0 = <&state_default>;
groups = "wdt", "rgmii2", "uart3";
state_default: state-default {
gpio-pinmux {
groups = "rgmii2", "uart3", "wdt";
function = "gpio"; function = "gpio";
}; };
}; };
}; };
&ethernet {
pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>;
};
&switch0 { &switch0 {
ports { ports {
port@0 { port@0 {
status = "okay";
label = "ethblack"; label = "ethblack";
status = "ok";
}; };
port@4 { port@4 {
status = "okay";
label = "ethblue"; label = "ethblue";
status = "ok";
}; };
}; };
}; };
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/dts-v1/;
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "gnubee,gb-pc2", "mediatek,mt7621-soc";
model = "GB-PC2";
memory@0 {
device_type = "memory";
reg = <0x00000000 0x1c000000>,
<0x20000000 0x04000000>;
};
chosen {
bootargs = "console=ttyS0,57600";
};
palmbus: palmbus@1e000000 {
i2c@900 {
status = "okay";
};
};
gpio-keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
linux,code = <KEY_RESTART>;
};
};
};
&sdhci {
status = "okay";
};
&spi0 {
status = "okay";
m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
broken-flash-reset;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
label = "firmware";
reg = <0x50000 0x1fb0000>;
};
};
};
&pcie {
status = "okay";
};
&pinctrl {
pinctrl-names = "default";
pinctrl-0 = <&state_default>;
state_default: state-default {
gpio-pinmux {
groups = "wdt";
function = "gpio";
};
};
};
&ethernet {
gmac1: mac@1 {
status = "okay";
phy-handle = <&ethphy7>;
};
mdio-bus {
ethphy7: ethernet-phy@7 {
reg = <7>;
phy-mode = "rgmii-rxid";
};
};
};
&switch0 {
ports {
port@0 {
status = "okay";
label = "ethblack";
};
port@4 {
status = "okay";
label = "ethblue";
};
};
};
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <dt-bindings/interrupt-controller/mips-gic.h> #include <dt-bindings/interrupt-controller/mips-gic.h>
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/clock/mt7621-clk.h> #include <dt-bindings/clock/mt7621-clk.h>
#include <dt-bindings/reset/mt7621-reset.h>
/ { / {
#address-cells = <1>; #address-cells = <1>;
...@@ -25,7 +26,7 @@ cpu@1 { ...@@ -25,7 +26,7 @@ cpu@1 {
}; };
}; };
cpuintc: cpuintc@0 { cpuintc: cpuintc {
#address-cells = <0>; #address-cells = <0>;
#interrupt-cells = <1>; #interrupt-cells = <1>;
interrupt-controller; interrupt-controller;
...@@ -37,16 +38,16 @@ aliases { ...@@ -37,16 +38,16 @@ aliases {
}; };
mmc_fixed_3v3: fixedregulator@0 { mmc_fixed_3v3: regulator-3v3 {
compatible = "regulator-fixed"; compatible = "regulator-fixed";
regulator-name = "mmc_power"; regulator-name = "mmc_power";
regulator-min-microvolt = <3300000>; regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>; regulator-max-microvolt = <3300000>;
enable-active-high; enable-active-high;
regulator-always-on; regulator-always-on;
}; };
mmc_fixed_1v8_io: fixedregulator@1 { mmc_fixed_1v8_io: regulator-1v8 {
compatible = "regulator-fixed"; compatible = "regulator-fixed";
regulator-name = "mmc_io"; regulator-name = "mmc_io";
regulator-min-microvolt = <1800000>; regulator-min-microvolt = <1800000>;
...@@ -67,6 +68,7 @@ sysc: syscon@0 { ...@@ -67,6 +68,7 @@ sysc: syscon@0 {
compatible = "mediatek,mt7621-sysc", "syscon"; compatible = "mediatek,mt7621-sysc", "syscon";
reg = <0x0 0x100>; reg = <0x0 0x100>;
#clock-cells = <1>; #clock-cells = <1>;
#reset-cells = <1>;
ralink,memctl = <&memc>; ralink,memctl = <&memc>;
clock-output-names = "xtal", "cpu", "bus", clock-output-names = "xtal", "cpu", "bus",
"50m", "125m", "150m", "50m", "125m", "150m",
...@@ -96,7 +98,7 @@ i2c: i2c@900 { ...@@ -96,7 +98,7 @@ i2c: i2c@900 {
clocks = <&sysc MT7621_CLK_I2C>; clocks = <&sysc MT7621_CLK_I2C>;
clock-names = "i2c"; clock-names = "i2c";
resets = <&rstctrl 16>; resets = <&sysc MT7621_RST_I2C>;
reset-names = "i2c"; reset-names = "i2c";
#address-cells = <1>; #address-cells = <1>;
...@@ -137,7 +139,7 @@ spi0: spi@b00 { ...@@ -137,7 +139,7 @@ spi0: spi@b00 {
clocks = <&sysc MT7621_CLK_SPI>; clocks = <&sysc MT7621_CLK_SPI>;
clock-names = "spi"; clock-names = "spi";
resets = <&rstctrl 18>; resets = <&sysc MT7621_RST_SPI>;
reset-names = "spi"; reset-names = "spi";
#address-cells = <1>; #address-cells = <1>;
...@@ -234,11 +236,6 @@ pinmux { ...@@ -234,11 +236,6 @@ pinmux {
}; };
}; };
rstctrl: rstctrl {
compatible = "ralink,rt2880-reset";
#reset-cells = <1>;
};
sdhci: sdhci@1e130000 { sdhci: sdhci@1e130000 {
status = "disabled"; status = "disabled";
...@@ -266,8 +263,6 @@ sdhci: sdhci@1e130000 { ...@@ -266,8 +263,6 @@ sdhci: sdhci@1e130000 {
}; };
xhci: xhci@1e1c0000 { xhci: xhci@1e1c0000 {
status = "okay";
compatible = "mediatek,mt8173-xhci"; compatible = "mediatek,mt8173-xhci";
reg = <0x1e1c0000 0x1000 reg = <0x1e1c0000 0x1000
0x1e1d0700 0x0100>; 0x1e1d0700 0x0100>;
...@@ -317,7 +312,7 @@ ethernet: ethernet@1e100000 { ...@@ -317,7 +312,7 @@ ethernet: ethernet@1e100000 {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
resets = <&rstctrl 6 &rstctrl 23>; resets = <&sysc MT7621_RST_FE &sysc MT7621_RST_ETH>;
reset-names = "fe", "eth"; reset-names = "fe", "eth";
interrupt-parent = <&gic>; interrupt-parent = <&gic>;
...@@ -325,44 +320,37 @@ ethernet: ethernet@1e100000 { ...@@ -325,44 +320,37 @@ ethernet: ethernet@1e100000 {
mediatek,ethsys = <&sysc>; mediatek,ethsys = <&sysc>;
pinctrl-names = "default";
pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>, <&rgmii2_pins>;
gmac0: mac@0 { gmac0: mac@0 {
compatible = "mediatek,eth-mac"; compatible = "mediatek,eth-mac";
reg = <0>; reg = <0>;
phy-mode = "rgmii"; phy-mode = "trgmii";
fixed-link { fixed-link {
speed = <1000>; speed = <1000>;
full-duplex; full-duplex;
pause; pause;
}; };
}; };
gmac1: mac@1 { gmac1: mac@1 {
compatible = "mediatek,eth-mac"; compatible = "mediatek,eth-mac";
reg = <1>; reg = <1>;
status = "off"; status = "off";
phy-mode = "rgmii-rxid"; phy-mode = "rgmii-rxid";
phy-handle = <&phy_external>;
}; };
mdio-bus { mdio-bus {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
phy_external: ethernet-phy@5 {
status = "off";
reg = <5>;
phy-mode = "rgmii-rxid";
pinctrl-names = "default";
pinctrl-0 = <&rgmii2_pins>;
};
switch0: switch0@0 { switch0: switch0@0 {
compatible = "mediatek,mt7621"; compatible = "mediatek,mt7621";
#address-cells = <1>;
#size-cells = <0>;
reg = <0>; reg = <0>;
mediatek,mcm; mediatek,mcm;
resets = <&rstctrl 2>; resets = <&sysc MT7621_RST_MCM>;
reset-names = "mcm"; reset-names = "mcm";
interrupt-controller; interrupt-controller;
#interrupt-cells = <1>; #interrupt-cells = <1>;
...@@ -372,40 +360,47 @@ switch0: switch0@0 { ...@@ -372,40 +360,47 @@ switch0: switch0@0 {
ports { ports {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
reg = <0>;
port@0 { port@0 {
status = "off"; status = "off";
reg = <0>; reg = <0>;
label = "lan0"; label = "lan0";
}; };
port@1 { port@1 {
status = "off"; status = "off";
reg = <1>; reg = <1>;
label = "lan1"; label = "lan1";
}; };
port@2 { port@2 {
status = "off"; status = "off";
reg = <2>; reg = <2>;
label = "lan2"; label = "lan2";
}; };
port@3 { port@3 {
status = "off"; status = "off";
reg = <3>; reg = <3>;
label = "lan3"; label = "lan3";
}; };
port@4 { port@4 {
status = "off"; status = "off";
reg = <4>; reg = <4>;
label = "lan4"; label = "lan4";
}; };
port@6 { port@6 {
reg = <6>; reg = <6>;
label = "cpu"; label = "cpu";
ethernet = <&gmac0>; ethernet = <&gmac0>;
phy-mode = "trgmii"; phy-mode = "trgmii";
fixed-link { fixed-link {
speed = <1000>; speed = <1000>;
full-duplex; full-duplex;
pause;
}; };
}; };
}; };
...@@ -448,7 +443,7 @@ pcie@0,0 { ...@@ -448,7 +443,7 @@ pcie@0,0 {
#interrupt-cells = <1>; #interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 0>; interrupt-map-mask = <0 0 0 0>;
interrupt-map = <0 0 0 0 &gic GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH>; interrupt-map = <0 0 0 0 &gic GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH>;
resets = <&rstctrl 24>; resets = <&sysc MT7621_RST_PCIE0>;
clocks = <&sysc MT7621_CLK_PCIE0>; clocks = <&sysc MT7621_CLK_PCIE0>;
phys = <&pcie0_phy 1>; phys = <&pcie0_phy 1>;
phy-names = "pcie-phy0"; phy-names = "pcie-phy0";
...@@ -463,7 +458,7 @@ pcie@1,0 { ...@@ -463,7 +458,7 @@ pcie@1,0 {
#interrupt-cells = <1>; #interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 0>; interrupt-map-mask = <0 0 0 0>;
interrupt-map = <0 0 0 0 &gic GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>; interrupt-map = <0 0 0 0 &gic GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>;
resets = <&rstctrl 25>; resets = <&sysc MT7621_RST_PCIE1>;
clocks = <&sysc MT7621_CLK_PCIE1>; clocks = <&sysc MT7621_CLK_PCIE1>;
phys = <&pcie0_phy 1>; phys = <&pcie0_phy 1>;
phy-names = "pcie-phy1"; phy-names = "pcie-phy1";
...@@ -478,7 +473,7 @@ pcie@2,0 { ...@@ -478,7 +473,7 @@ pcie@2,0 {
#interrupt-cells = <1>; #interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 0>; interrupt-map-mask = <0 0 0 0>;
interrupt-map = <0 0 0 0 &gic GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; interrupt-map = <0 0 0 0 &gic GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>;
resets = <&rstctrl 26>; resets = <&sysc MT7621_RST_PCIE2>;
clocks = <&sysc MT7621_CLK_PCIE2>; clocks = <&sysc MT7621_CLK_PCIE2>;
phys = <&pcie2_phy 0>; phys = <&pcie2_phy 0>;
phy-names = "pcie-phy2"; phy-names = "pcie-phy2";
......
...@@ -54,10 +54,15 @@ choice ...@@ -54,10 +54,15 @@ choice
select HAVE_PCI select HAVE_PCI
select PCI_DRIVERS_GENERIC select PCI_DRIVERS_GENERIC
select SOC_BUS select SOC_BUS
help
The MT7621 system-on-a-chip includes an 880 MHz MIPS1004Kc dual-core CPU,
a 5-port 10/100/1000 switch/PHY and one RGMII.
endchoice endchoice
choice choice
prompt "Devicetree selection" prompt "Devicetree selection"
depends on !SOC_MT7621
default DTB_RT_NONE default DTB_RT_NONE
help help
Select the devicetree. Select the devicetree.
......
...@@ -11,14 +11,17 @@ ...@@ -11,14 +11,17 @@
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/reset-controller.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <dt-bindings/clock/mt7621-clk.h> #include <dt-bindings/clock/mt7621-clk.h>
#include <dt-bindings/reset/mt7621-reset.h>
/* Configuration registers */ /* Configuration registers */
#define SYSC_REG_SYSTEM_CONFIG0 0x10 #define SYSC_REG_SYSTEM_CONFIG0 0x10
#define SYSC_REG_SYSTEM_CONFIG1 0x14 #define SYSC_REG_SYSTEM_CONFIG1 0x14
#define SYSC_REG_CLKCFG0 0x2c #define SYSC_REG_CLKCFG0 0x2c
#define SYSC_REG_CLKCFG1 0x30 #define SYSC_REG_CLKCFG1 0x30
#define SYSC_REG_RESET_CTRL 0x34
#define SYSC_REG_CUR_CLK_STS 0x44 #define SYSC_REG_CUR_CLK_STS 0x44
#define MEMC_REG_CPU_PLL 0x648 #define MEMC_REG_CPU_PLL 0x648
...@@ -398,6 +401,82 @@ static void __init mt7621_clk_init(struct device_node *node) ...@@ -398,6 +401,82 @@ static void __init mt7621_clk_init(struct device_node *node)
} }
CLK_OF_DECLARE_DRIVER(mt7621_clk, "mediatek,mt7621-sysc", mt7621_clk_init); CLK_OF_DECLARE_DRIVER(mt7621_clk, "mediatek,mt7621-sysc", mt7621_clk_init);
struct mt7621_rst {
struct reset_controller_dev rcdev;
struct regmap *sysc;
};
static struct mt7621_rst *to_mt7621_rst(struct reset_controller_dev *dev)
{
return container_of(dev, struct mt7621_rst, rcdev);
}
static int mt7621_assert_device(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct mt7621_rst *data = to_mt7621_rst(rcdev);
struct regmap *sysc = data->sysc;
return regmap_update_bits(sysc, SYSC_REG_RESET_CTRL, BIT(id), BIT(id));
}
static int mt7621_deassert_device(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct mt7621_rst *data = to_mt7621_rst(rcdev);
struct regmap *sysc = data->sysc;
return regmap_update_bits(sysc, SYSC_REG_RESET_CTRL, BIT(id), 0);
}
static int mt7621_reset_device(struct reset_controller_dev *rcdev,
unsigned long id)
{
int ret;
ret = mt7621_assert_device(rcdev, id);
if (ret < 0)
return ret;
return mt7621_deassert_device(rcdev, id);
}
static int mt7621_rst_xlate(struct reset_controller_dev *rcdev,
const struct of_phandle_args *reset_spec)
{
unsigned long id = reset_spec->args[0];
if (id == MT7621_RST_SYS || id >= rcdev->nr_resets)
return -EINVAL;
return id;
}
static const struct reset_control_ops reset_ops = {
.reset = mt7621_reset_device,
.assert = mt7621_assert_device,
.deassert = mt7621_deassert_device
};
static int mt7621_reset_init(struct device *dev, struct regmap *sysc)
{
struct mt7621_rst *rst_data;
rst_data = devm_kzalloc(dev, sizeof(*rst_data), GFP_KERNEL);
if (!rst_data)
return -ENOMEM;
rst_data->sysc = sysc;
rst_data->rcdev.ops = &reset_ops;
rst_data->rcdev.owner = THIS_MODULE;
rst_data->rcdev.nr_resets = 32;
rst_data->rcdev.of_reset_n_cells = 1;
rst_data->rcdev.of_xlate = mt7621_rst_xlate;
rst_data->rcdev.of_node = dev_of_node(dev);
return devm_reset_controller_register(dev, &rst_data->rcdev);
}
static int mt7621_clk_probe(struct platform_device *pdev) static int mt7621_clk_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
...@@ -424,6 +503,12 @@ static int mt7621_clk_probe(struct platform_device *pdev) ...@@ -424,6 +503,12 @@ static int mt7621_clk_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = mt7621_reset_init(dev, priv->sysc);
if (ret) {
dev_err(dev, "Could not init reset controller\n");
return ret;
}
count = ARRAY_SIZE(mt7621_clks_base) + count = ARRAY_SIZE(mt7621_clks_base) +
ARRAY_SIZE(mt7621_fixed_clks) + ARRAY_SIZE(mt7621_gates); ARRAY_SIZE(mt7621_fixed_clks) + ARRAY_SIZE(mt7621_gates);
clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, count), clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, count),
...@@ -485,4 +570,9 @@ static struct platform_driver mt7621_clk_driver = { ...@@ -485,4 +570,9 @@ static struct platform_driver mt7621_clk_driver = {
.of_match_table = mt7621_clk_of_match, .of_match_table = mt7621_clk_of_match,
}, },
}; };
builtin_platform_driver(mt7621_clk_driver);
static int __init mt7621_clk_reset_init(void)
{
return platform_driver_register(&mt7621_clk_driver);
}
arch_initcall(mt7621_clk_reset_init);
...@@ -149,6 +149,11 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = { ...@@ -149,6 +149,11 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = {
static const struct mmc_fixup __maybe_unused sdio_card_init_methods[] = { static const struct mmc_fixup __maybe_unused sdio_card_init_methods[] = {
SDIO_FIXUP_COMPATIBLE("ti,wl1251", wl1251_quirk, 0), SDIO_FIXUP_COMPATIBLE("ti,wl1251", wl1251_quirk, 0),
SDIO_FIXUP_COMPATIBLE("silabs,wf200", add_quirk,
MMC_QUIRK_BROKEN_BYTE_MODE_512 |
MMC_QUIRK_LENIENT_FN0 |
MMC_QUIRK_BLKSZ_FOR_BYTE_MODE),
END_FIXUP END_FIXUP
}; };
......
...@@ -58,16 +58,12 @@ source "drivers/staging/nvec/Kconfig" ...@@ -58,16 +58,12 @@ source "drivers/staging/nvec/Kconfig"
source "drivers/staging/media/Kconfig" source "drivers/staging/media/Kconfig"
source "drivers/staging/android/Kconfig"
source "drivers/staging/board/Kconfig" source "drivers/staging/board/Kconfig"
source "drivers/staging/gdm724x/Kconfig" source "drivers/staging/gdm724x/Kconfig"
source "drivers/staging/fwserial/Kconfig" source "drivers/staging/fwserial/Kconfig"
source "drivers/staging/gs_fpgaboot/Kconfig"
source "drivers/staging/unisys/Kconfig" source "drivers/staging/unisys/Kconfig"
source "drivers/staging/clocking-wizard/Kconfig" source "drivers/staging/clocking-wizard/Kconfig"
...@@ -84,8 +80,6 @@ source "drivers/staging/vc04_services/Kconfig" ...@@ -84,8 +80,6 @@ source "drivers/staging/vc04_services/Kconfig"
source "drivers/staging/pi433/Kconfig" source "drivers/staging/pi433/Kconfig"
source "drivers/staging/mt7621-dts/Kconfig"
source "drivers/staging/axis-fifo/Kconfig" source "drivers/staging/axis-fifo/Kconfig"
source "drivers/staging/fieldbus/Kconfig" source "drivers/staging/fieldbus/Kconfig"
......
...@@ -19,11 +19,9 @@ obj-$(CONFIG_IIO) += iio/ ...@@ -19,11 +19,9 @@ obj-$(CONFIG_IIO) += iio/
obj-$(CONFIG_FB_SM750) += sm750fb/ obj-$(CONFIG_FB_SM750) += sm750fb/
obj-$(CONFIG_USB_EMXX) += emxx_udc/ obj-$(CONFIG_USB_EMXX) += emxx_udc/
obj-$(CONFIG_MFD_NVEC) += nvec/ obj-$(CONFIG_MFD_NVEC) += nvec/
obj-$(CONFIG_ANDROID) += android/
obj-$(CONFIG_STAGING_BOARD) += board/ obj-$(CONFIG_STAGING_BOARD) += board/
obj-$(CONFIG_LTE_GDM724X) += gdm724x/ obj-$(CONFIG_LTE_GDM724X) += gdm724x/
obj-$(CONFIG_FIREWIRE_SERIAL) += fwserial/ obj-$(CONFIG_FIREWIRE_SERIAL) += fwserial/
obj-$(CONFIG_GS_FPGABOOT) += gs_fpgaboot/
obj-$(CONFIG_UNISYSSPAR) += unisys/ obj-$(CONFIG_UNISYSSPAR) += unisys/
obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/ obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/
obj-$(CONFIG_FB_TFT) += fbtft/ obj-$(CONFIG_FB_TFT) += fbtft/
...@@ -32,7 +30,6 @@ obj-$(CONFIG_KS7010) += ks7010/ ...@@ -32,7 +30,6 @@ obj-$(CONFIG_KS7010) += ks7010/
obj-$(CONFIG_GREYBUS) += greybus/ obj-$(CONFIG_GREYBUS) += greybus/
obj-$(CONFIG_BCM2835_VCHIQ) += vc04_services/ obj-$(CONFIG_BCM2835_VCHIQ) += vc04_services/
obj-$(CONFIG_PI433) += pi433/ obj-$(CONFIG_PI433) += pi433/
obj-$(CONFIG_SOC_MT7621) += mt7621-dts/
obj-$(CONFIG_XIL_AXIS_FIFO) += axis-fifo/ obj-$(CONFIG_XIL_AXIS_FIFO) += axis-fifo/
obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/ obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/
obj-$(CONFIG_QLGE) += qlge/ obj-$(CONFIG_QLGE) += qlge/
......
# SPDX-License-Identifier: GPL-2.0
menu "Android"
if ANDROID
config ASHMEM
bool "Enable the Anonymous Shared Memory Subsystem"
depends on SHMEM
help
The ashmem subsystem is a new shared memory allocator, similar to
POSIX SHM but with different behavior and sporting a simpler
file-based API.
It is, in theory, a good memory allocator for low-memory devices,
because it can discard shared memory units when under memory pressure.
endif # if ANDROID
endmenu
# SPDX-License-Identifier: GPL-2.0
ccflags-y += -I$(src) # needed for trace events
obj-$(CONFIG_ASHMEM) += ashmem.o
TODO:
- sparse fixes
- rename files to be not so "generic"
- add proper arch dependencies as needed
- audit userspace interfaces to make sure they are sane
Please send patches to Greg Kroah-Hartman <greg@kroah.com> and Cc:
Arve Hjønnevåg <arve@android.com> and Riley Andrews <riandrews@android.com>
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 */
/*
* include/linux/ashmem.h
*
* Copyright 2008 Google Inc.
* Author: Robert Love
*/
#ifndef _LINUX_ASHMEM_H
#define _LINUX_ASHMEM_H
#include <linux/limits.h>
#include <linux/ioctl.h>
#include <linux/compat.h>
#include "uapi/ashmem.h"
/* support of 32bit userspace on 64bit platforms */
#ifdef CONFIG_COMPAT
#define COMPAT_ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, compat_size_t)
#define COMPAT_ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned int)
#endif
#endif /* _LINUX_ASHMEM_H */
/* SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 */
/*
* Copyright 2008 Google Inc.
* Author: Robert Love
*/
#ifndef _UAPI_LINUX_ASHMEM_H
#define _UAPI_LINUX_ASHMEM_H
#include <linux/ioctl.h>
#include <linux/types.h>
#define ASHMEM_NAME_LEN 256
#define ASHMEM_NAME_DEF "dev/ashmem"
/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */
#define ASHMEM_NOT_PURGED 0
#define ASHMEM_WAS_PURGED 1
/* Return values from ASHMEM_GET_PIN_STATUS: Is the mapping pinned? */
#define ASHMEM_IS_UNPINNED 0
#define ASHMEM_IS_PINNED 1
struct ashmem_pin {
__u32 offset; /* offset into region, in bytes, page-aligned */
__u32 len; /* length forward from offset, in bytes, page-aligned */
};
#define __ASHMEMIOC 0x77
#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN])
#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4)
#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long)
#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6)
#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin)
#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
#endif /* _UAPI_LINUX_ASHMEM_H */
...@@ -49,7 +49,7 @@ int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc) ...@@ -49,7 +49,7 @@ int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc)
EXPORT_SYMBOL(fbtft_write_buf_dc); EXPORT_SYMBOL(fbtft_write_buf_dc);
void fbtft_dbg_hex(const struct device *dev, int groupsize, void fbtft_dbg_hex(const struct device *dev, int groupsize,
void *buf, size_t len, const char *fmt, ...) const void *buf, size_t len, const char *fmt, ...)
{ {
va_list args; va_list args;
static char textbuf[512]; static char textbuf[512];
...@@ -1035,10 +1035,9 @@ int fbtft_init_display(struct fbtft_par *par) ...@@ -1035,10 +1035,9 @@ int fbtft_init_display(struct fbtft_par *par)
for (j = 0; par->init_sequence[i + 1 + j] >= 0; j++) for (j = 0; par->init_sequence[i + 1 + j] >= 0; j++)
; ;
fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, fbtft_par_dbg_hex(DEBUG_INIT_DISPLAY, par, par->info->device,
"init: write(0x%02X) %*ph\n", s16, &par->init_sequence[i + 1], j,
par->init_sequence[i], j, "init: write(0x%02X)", par->init_sequence[i]);
&par->init_sequence[i + 1]);
/* Write */ /* Write */
j = 0; j = 0;
......
...@@ -240,7 +240,7 @@ struct fbtft_par { ...@@ -240,7 +240,7 @@ struct fbtft_par {
int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc); int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc);
__printf(5, 6) __printf(5, 6)
void fbtft_dbg_hex(const struct device *dev, int groupsize, void fbtft_dbg_hex(const struct device *dev, int groupsize,
void *buf, size_t len, const char *fmt, ...); const void *buf, size_t len, const char *fmt, ...);
struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
struct device *dev, struct device *dev,
struct fbtft_platform_data *pdata); struct fbtft_platform_data *pdata);
......
...@@ -195,7 +195,6 @@ static __sum16 icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, int len) ...@@ -195,7 +195,6 @@ static __sum16 icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, int len)
pseudo_header.ph.ph_len = be16_to_cpu(ipv6->payload_len); pseudo_header.ph.ph_len = be16_to_cpu(ipv6->payload_len);
pseudo_header.ph.ph_nxt = ipv6->nexthdr; pseudo_header.ph.ph_nxt = ipv6->nexthdr;
w = (u16 *)&pseudo_header;
for (i = 0; i < ARRAY_SIZE(pseudo_header.pa); i++) { for (i = 0; i < ARRAY_SIZE(pseudo_header.pa); i++) {
pa = pseudo_header.pa[i]; pa = pseudo_header.pa[i];
sum = csum_add(sum, csum_unfold((__force __sum16)pa)); sum = csum_add(sum, csum_unfold((__force __sum16)pa));
......
...@@ -34,7 +34,7 @@ struct hci_packet { ...@@ -34,7 +34,7 @@ struct hci_packet {
struct tlv { struct tlv {
u8 type; u8 type;
u8 len; u8 len;
u8 *data[1]; u8 *data[];
} __packed; } __packed;
struct sdu_header { struct sdu_header {
......
...@@ -204,43 +204,59 @@ static void gb_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) ...@@ -204,43 +204,59 @@ static void gb_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
gb_pwm_deactivate_operation(pwmc, pwm->hwpwm); gb_pwm_deactivate_operation(pwmc, pwm->hwpwm);
} }
static int gb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, static int gb_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
int duty_ns, int period_ns) const struct pwm_state *state)
{ {
int err;
bool enabled = pwm->state.enabled;
u64 period = state->period;
u64 duty_cycle = state->duty_cycle;
struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip); struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip);
return gb_pwm_config_operation(pwmc, pwm->hwpwm, duty_ns, period_ns); /* Set polarity */
}; if (state->polarity != pwm->state.polarity) {
if (enabled) {
gb_pwm_disable_operation(pwmc, pwm->hwpwm);
enabled = false;
}
err = gb_pwm_set_polarity_operation(pwmc, pwm->hwpwm, state->polarity);
if (err)
return err;
}
static int gb_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, if (!state->enabled) {
enum pwm_polarity polarity) if (enabled)
{ gb_pwm_disable_operation(pwmc, pwm->hwpwm);
struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip); return 0;
}
return gb_pwm_set_polarity_operation(pwmc, pwm->hwpwm, polarity); /*
}; * Set period and duty cycle
*
* PWM privodes 64-bit period and duty_cycle, but greybus only accepts
* 32-bit, so their values have to be limited to U32_MAX.
*/
if (period > U32_MAX)
period = U32_MAX;
static int gb_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) if (duty_cycle > period)
{ duty_cycle = period;
struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip);
return gb_pwm_enable_operation(pwmc, pwm->hwpwm); err = gb_pwm_config_operation(pwmc, pwm->hwpwm, duty_cycle, period);
}; if (err)
return err;
static void gb_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) /* enable/disable */
{ if (!enabled)
struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip); return gb_pwm_enable_operation(pwmc, pwm->hwpwm);
gb_pwm_disable_operation(pwmc, pwm->hwpwm); return 0;
}; }
static const struct pwm_ops gb_pwm_ops = { static const struct pwm_ops gb_pwm_ops = {
.request = gb_pwm_request, .request = gb_pwm_request,
.free = gb_pwm_free, .free = gb_pwm_free,
.config = gb_pwm_config, .apply = gb_pwm_apply,
.set_polarity = gb_pwm_set_polarity,
.enable = gb_pwm_enable,
.disable = gb_pwm_disable,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
......
...@@ -858,7 +858,6 @@ static void gb_sdio_remove(struct gbphy_device *gbphy_dev) ...@@ -858,7 +858,6 @@ static void gb_sdio_remove(struct gbphy_device *gbphy_dev)
gb_connection_set_data(connection, NULL); gb_connection_set_data(connection, NULL);
mutex_unlock(&host->lock); mutex_unlock(&host->lock);
flush_workqueue(host->mrq_workqueue);
destroy_workqueue(host->mrq_workqueue); destroy_workqueue(host->mrq_workqueue);
gb_connection_disable_rx(connection); gb_connection_disable_rx(connection);
mmc_remove_host(mmc); mmc_remove_host(mmc);
......
# SPDX-License-Identifier: GPL-2.0
#
# "xilinx FPGA firmware download, fpgaboot"
#
config GS_FPGABOOT
tristate "Xilinx FPGA firmware download module"
help
Xilinx FPGA firmware download module
# SPDX-License-Identifier: GPL-2.0
gs_fpga-y += gs_fpgaboot.o io.o
obj-$(CONFIG_GS_FPGABOOT) += gs_fpga.o
==============================================================================
Linux Driver Source for Xilinx FPGA firmware download
==============================================================================
TABLE OF CONTENTS.
1. SUMMARY
2. BACKGROUND
3. DESIGN
4. HOW TO USE
5. REFERENCE
1. SUMMARY
- Download Xilinx FPGA firmware
- This module downloads Xilinx FPGA firmware using gpio pins.
2. BACKGROUND
An FPGA (Field Programmable Gate Array) is a programmable hardware that is
used in various applications. Hardware design needs to programmed through
a dedicated device or CPU assisted way (serial or parallel).
This driver provides a way to download FPGA firmware.
3. DESIGN
- load Xilinx FPGA bitstream format[1] firmware image file using
kernel firmware framework, request_firmware()
- program the Xilinx FPGA using SelectMAP (parallel) mode [2]
- FPGA prgram is done by gpio based bit-banging, as an example
- platform independent file: gs_fpgaboot.c
- platform dependent file: io.c
4. HOW TO USE
$ insmod gs_fpga.ko file="xlinx_fpga_top_bitstream.bit"
$ rmmod gs_fpga
5. USE CASE (from a mailing list discussion with Greg)
a. As an FPGA development support tool,
During FPGA firmware development, you need to download a new FPGA
image frequently.
You would do that with a dedicated JTAG, which usually a limited
resource in the lab.
However, if you use my driver, you don't have to have a dedicated JTAG.
This is a real gain :)
b. For the FPGA that runs without config after the download, which
doesn't talk to any of Linux interfaces (such as PCIE).
We download FPGA firmware from user triggered or some other way, and that's it.
Since that FPGA runs on its own, it doesn't require a linux driver
after the download.
c. For the FPGA that requires config after the download, which talk to
any of linux interfaces (such as PCIE)
Then, this type of FPGA config can be put into device tree and have a
separate driver (pcie or others), then THAT driver calls my driver to
download FPGA firmware during the Linux boot, the take over the device
through the interface.
6. REFERENCE
1. Xilinx APP NOTE XAPP583:
https://www.xilinx.com/support/documentation/application_notes/xapp583-fpga-configuration.pdf
2. bitstream file info:
http://home.earthlink.net/~davesullins/software/bitinfo.html
TODO:
- get bus width input instead of hardcoded bus width
- get it reviewed
Please send any patches for this driver to Insop Song<insop.song@gainspeed.com>
and Greg Kroah-Hartman <gregkh@linuxfoundation.org>.
And please CC to "Staging subsystem" mail list <devel@driverdev.osuosl.org> too.
// SPDX-License-Identifier: GPL-2.0+
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/device.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/firmware.h>
#include <asm/unaligned.h>
#include "gs_fpgaboot.h"
#include "io.h"
#define DEVICE_NAME "device"
#define CLASS_NAME "fpgaboot"
static u8 bits_magic[] = {
0x0, 0x9, 0xf, 0xf0, 0xf, 0xf0,
0xf, 0xf0, 0xf, 0xf0, 0x0, 0x0, 0x1};
/* fake device for request_firmware */
static struct platform_device *firmware_pdev;
static char *file = "xlinx_fpga_firmware.bit";
module_param(file, charp, 0444);
MODULE_PARM_DESC(file, "Xilinx FPGA firmware file.");
static void read_bitstream(u8 *bitdata, u8 *buf, int *offset, int rdsize)
{
memcpy(buf, bitdata + *offset, rdsize);
*offset += rdsize;
}
static int readinfo_bitstream(u8 *bitdata, u8 *buf, int size, int *offset)
{
u8 tbuf[2];
u16 len;
/* read section char */
read_bitstream(bitdata, tbuf, offset, 1);
/* read length */
read_bitstream(bitdata, tbuf, offset, 2);
len = get_unaligned_be16(tbuf);
if (len >= size) {
pr_err("error: readinfo buffer too small\n");
return -EINVAL;
}
read_bitstream(bitdata, buf, offset, len);
buf[len] = '\0';
return 0;
}
/*
* read bitdata length
*/
static int readlength_bitstream(u8 *bitdata, int *lendata, int *offset)
{
u8 tbuf[4];
/* read section char */
read_bitstream(bitdata, tbuf, offset, 1);
/* make sure it is section 'e' */
if (tbuf[0] != 'e') {
pr_err("error: length section is not 'e', but %c\n", tbuf[0]);
return -EINVAL;
}
/* read 4bytes length */
read_bitstream(bitdata, tbuf, offset, 4);
*lendata = get_unaligned_be32(tbuf);
return 0;
}
/*
* read first 13 bytes to check bitstream magic number
*/
static int readmagic_bitstream(u8 *bitdata, int *offset)
{
u8 buf[13];
int r;
read_bitstream(bitdata, buf, offset, 13);
r = memcmp(buf, bits_magic, 13);
if (r) {
pr_err("error: corrupted header\n");
return -EINVAL;
}
pr_info("bitstream file magic number Ok\n");
*offset = 13; /* magic length */
return 0;
}
/*
* NOTE: supports only bitstream format
*/
static enum fmt_image get_imageformat(void)
{
return f_bit;
}
static void gs_print_header(struct fpgaimage *fimage)
{
pr_info("file: %s\n", fimage->filename);
pr_info("part: %s\n", fimage->part);
pr_info("date: %s\n", fimage->date);
pr_info("time: %s\n", fimage->time);
pr_info("lendata: %d\n", fimage->lendata);
}
static int gs_read_bitstream(struct fpgaimage *fimage)
{
u8 *bitdata;
int offset;
int err;
offset = 0;
bitdata = (u8 *)fimage->fw_entry->data;
err = readmagic_bitstream(bitdata, &offset);
if (err)
return err;
err = readinfo_bitstream(bitdata, fimage->filename, MAX_STR, &offset);
if (err)
return err;
err = readinfo_bitstream(bitdata, fimage->part, MAX_STR, &offset);
if (err)
return err;
err = readinfo_bitstream(bitdata, fimage->date, MAX_STR, &offset);
if (err)
return err;
err = readinfo_bitstream(bitdata, fimage->time, MAX_STR, &offset);
if (err)
return err;
err = readlength_bitstream(bitdata, &fimage->lendata, &offset);
if (err)
return err;
fimage->fpgadata = bitdata + offset;
return 0;
}
static int gs_read_image(struct fpgaimage *fimage)
{
int img_fmt;
int err;
img_fmt = get_imageformat();
switch (img_fmt) {
case f_bit:
pr_info("image is bitstream format\n");
err = gs_read_bitstream(fimage);
if (err)
return err;
break;
default:
pr_err("unsupported fpga image format\n");
return -EINVAL;
}
gs_print_header(fimage);
return 0;
}
static int gs_load_image(struct fpgaimage *fimage, char *fw_file)
{
int err;
pr_info("load fpgaimage %s\n", fw_file);
err = request_firmware(&fimage->fw_entry, fw_file, &firmware_pdev->dev);
if (err != 0) {
pr_err("firmware %s is missing, cannot continue.\n", fw_file);
return err;
}
return 0;
}
static int gs_download_image(struct fpgaimage *fimage, enum wbus bus_bytes)
{
u8 *bitdata;
int size, i, cnt;
cnt = 0;
bitdata = (u8 *)fimage->fpgadata;
size = fimage->lendata;
#ifdef DEBUG_FPGA
print_hex_dump_bytes("bitfile sample: ", DUMP_PREFIX_OFFSET,
bitdata, 0x100);
#endif /* DEBUG_FPGA */
if (!xl_supported_prog_bus_width(bus_bytes)) {
pr_err("unsupported program bus width %d\n",
bus_bytes);
return -EINVAL;
}
/* Bring csi_b, rdwr_b Low and program_b High */
xl_program_b(1);
xl_rdwr_b(0);
xl_csi_b(0);
/* Configuration reset */
xl_program_b(0);
msleep(20);
xl_program_b(1);
/* Wait for Device Initialization */
while (xl_get_init_b() == 0)
;
pr_info("device init done\n");
for (i = 0; i < size; i += bus_bytes)
xl_shift_bytes_out(bus_bytes, bitdata + i);
pr_info("program done\n");
/* Check INIT_B */
if (xl_get_init_b() == 0) {
pr_err("init_b 0\n");
return -EIO;
}
while (xl_get_done_b() == 0) {
if (cnt++ > MAX_WAIT_DONE) {
pr_err("init_B %d\n", xl_get_init_b());
break;
}
}
if (cnt > MAX_WAIT_DONE) {
pr_err("fpga download fail\n");
return -EIO;
}
pr_info("download fpgaimage\n");
/* Compensate for Special Startup Conditions */
xl_shift_cclk(8);
return 0;
}
static int gs_release_image(struct fpgaimage *fimage)
{
release_firmware(fimage->fw_entry);
pr_info("release fpgaimage\n");
return 0;
}
/*
* NOTE: supports systemmap parallel programming
*/
static int gs_set_download_method(struct fpgaimage *fimage)
{
pr_info("set program method\n");
fimage->dmethod = m_systemmap;
pr_info("systemmap program method\n");
return 0;
}
static int init_driver(void)
{
firmware_pdev = platform_device_register_simple("fpgaboot", -1,
NULL, 0);
return PTR_ERR_OR_ZERO(firmware_pdev);
}
static int gs_fpgaboot(void)
{
int err;
struct fpgaimage *fimage;
fimage = kmalloc(sizeof(*fimage), GFP_KERNEL);
if (!fimage)
return -ENOMEM;
err = gs_load_image(fimage, file);
if (err) {
pr_err("gs_load_image error\n");
goto err_out1;
}
err = gs_read_image(fimage);
if (err) {
pr_err("gs_read_image error\n");
goto err_out2;
}
err = gs_set_download_method(fimage);
if (err) {
pr_err("gs_set_download_method error\n");
goto err_out2;
}
err = gs_download_image(fimage, bus_2byte);
if (err) {
pr_err("gs_download_image error\n");
goto err_out2;
}
err = gs_release_image(fimage);
if (err) {
pr_err("gs_release_image error\n");
goto err_out1;
}
kfree(fimage);
return 0;
err_out2:
err = gs_release_image(fimage);
if (err)
pr_err("gs_release_image error\n");
err_out1:
kfree(fimage);
return err;
}
static int __init gs_fpgaboot_init(void)
{
int err;
pr_info("FPGA DOWNLOAD --->\n");
pr_info("FPGA image file name: %s\n", file);
err = init_driver();
if (err) {
pr_err("FPGA DRIVER INIT FAIL!!\n");
return err;
}
err = xl_init_io();
if (err) {
pr_err("GPIO INIT FAIL!!\n");
goto errout;
}
err = gs_fpgaboot();
if (err) {
pr_err("FPGA DOWNLOAD FAIL!!\n");
goto errout;
}
pr_info("FPGA DOWNLOAD DONE <---\n");
return 0;
errout:
platform_device_unregister(firmware_pdev);
return err;
}
static void __exit gs_fpgaboot_exit(void)
{
platform_device_unregister(firmware_pdev);
pr_info("FPGA image download module removed\n");
}
module_init(gs_fpgaboot_init);
module_exit(gs_fpgaboot_exit);
MODULE_AUTHOR("Insop Song");
MODULE_DESCRIPTION("Xlinix FPGA firmware download");
MODULE_LICENSE("GPL");
/* SPDX-License-Identifier: GPL-2.0+ */
#include <linux/firmware.h>
#define MAX_STR 256
enum fmt_image {
f_bit, /* only bitstream is supported */
f_rbt,
f_bin,
f_mcs,
f_hex,
};
enum mdownload {
m_systemmap, /* only system map is supported */
m_serial,
m_jtag,
};
/*
* xilinx fpgaimage information
* NOTE: use MAX_STR instead of dynamic alloc for simplicity
*/
struct fpgaimage {
enum fmt_image fmt_img;
enum mdownload dmethod;
const struct firmware *fw_entry;
/*
* the following can be read from bitstream,
* but other image format should have as well
*/
char filename[MAX_STR];
char part[MAX_STR];
char date[MAX_STR];
char time[MAX_STR];
int lendata;
u8 *fpgadata;
};
// SPDX-License-Identifier: GPL-2.0+
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/device.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/firmware.h>
#include <linux/io.h>
#include "io.h"
static inline void byte0_out(unsigned char data);
static inline void byte1_out(unsigned char data);
static inline void xl_cclk_b(int32_t i);
/* Assert and Deassert CCLK */
void xl_shift_cclk(int count)
{
int i;
for (i = 0; i < count; i++) {
xl_cclk_b(1);
xl_cclk_b(0);
}
}
int xl_supported_prog_bus_width(enum wbus bus_bytes)
{
switch (bus_bytes) {
case bus_1byte:
break;
case bus_2byte:
break;
default:
pr_err("unsupported program bus width %d\n", bus_bytes);
return 0;
}
return 1;
}
/* Serialize byte and clock each bit on target's DIN and CCLK pins */
void xl_shift_bytes_out(enum wbus bus_byte, unsigned char *pdata)
{
/*
* supports 1 and 2 bytes programming mode
*/
if (likely(bus_byte == bus_2byte))
byte0_out(pdata[0]);
byte1_out(pdata[1]);
xl_shift_cclk(1);
}
/*
* generic bit swap for xilinx SYSTEMMAP FPGA programming
*/
void xl_program_b(int32_t i)
{
}
void xl_rdwr_b(int32_t i)
{
}
void xl_csi_b(int32_t i)
{
}
int xl_get_init_b(void)
{
return -1;
}
int xl_get_done_b(void)
{
return -1;
}
static inline void byte0_out(unsigned char data)
{
}
static inline void byte1_out(unsigned char data)
{
}
static inline void xl_cclk_b(int32_t i)
{
}
/*
* configurable per device type for different I/O config
*/
int xl_init_io(void)
{
return -1;
}
/* SPDX-License-Identifier: GPL-2.0+ */
#define GPDIR 0
#define GPCFG 4 /* open drain or not */
#define GPDAT 8
/*
* gpio port and pin definitions
* NOTE: port number starts from 0
*/
#define XL_INITN_PORT 1
#define XL_INITN_PIN 14
#define XL_RDWRN_PORT 1
#define XL_RDWRN_PIN 13
#define XL_CCLK_PORT 1
#define XL_CCLK_PIN 10
#define XL_PROGN_PORT 1
#define XL_PROGN_PIN 25
#define XL_CSIN_PORT 1
#define XL_CSIN_PIN 26
#define XL_DONE_PORT 1
#define XL_DONE_PIN 27
/*
* gpio mapping
*
XL_config_D0 – gpio1_31
Xl_config_d1 – gpio1_30
Xl_config_d2 – gpio1_29
Xl_config_d3 – gpio1_28
Xl_config_d4 – gpio1_27
Xl_config_d5 – gpio1_26
Xl_config_d6 – gpio1_25
Xl_config_d7 – gpio1_24
Xl_config_d8 – gpio1_23
Xl_config_d9 – gpio1_22
Xl_config_d10 – gpio1_21
Xl_config_d11 – gpio1_20
Xl_config_d12 – gpio1_19
Xl_config_d13 – gpio1_18
Xl_config_d14 – gpio1_16
Xl_config_d15 – gpio1_14
*
*/
/*
* program bus width in bytes
*/
enum wbus {
bus_1byte = 1,
bus_2byte = 2,
};
#define MAX_WAIT_DONE 10000
struct gpiobus {
int ngpio;
void __iomem *r[4];
};
int xl_supported_prog_bus_width(enum wbus bus_bytes);
void xl_program_b(int32_t i);
void xl_rdwr_b(int32_t i);
void xl_csi_b(int32_t i);
int xl_get_init_b(void);
int xl_get_done_b(void);
void xl_shift_cclk(int count);
void xl_shift_bytes_out(enum wbus bus_byte, unsigned char *pdata);
int xl_init_io(void);
...@@ -1102,10 +1102,8 @@ static void ks7010_sdio_remove(struct sdio_func *func) ...@@ -1102,10 +1102,8 @@ static void ks7010_sdio_remove(struct sdio_func *func)
if (ret) /* memory allocation failure */ if (ret) /* memory allocation failure */
goto err_free_card; goto err_free_card;
if (priv->wq) { if (priv->wq)
flush_workqueue(priv->wq);
destroy_workqueue(priv->wq); destroy_workqueue(priv->wq);
}
hostif_exit(priv); hostif_exit(priv);
......
...@@ -67,7 +67,7 @@ struct net_dev_context { ...@@ -67,7 +67,7 @@ struct net_dev_context {
struct list_head list; struct list_head list;
}; };
static struct list_head net_devices = LIST_HEAD_INIT(net_devices); static LIST_HEAD(net_devices);
static DEFINE_MUTEX(probe_disc_mt); /* ch->linked = true, most_nd_open */ static DEFINE_MUTEX(probe_disc_mt); /* ch->linked = true, most_nd_open */
static DEFINE_SPINLOCK(list_lock); /* list_head, ch->linked = false, dev_hold */ static DEFINE_SPINLOCK(list_lock); /* list_head, ch->linked = false, dev_hold */
static struct most_component comp; static struct most_component comp;
......
...@@ -52,7 +52,7 @@ struct comp_fh { ...@@ -52,7 +52,7 @@ struct comp_fh {
u32 offs; u32 offs;
}; };
static struct list_head video_devices = LIST_HEAD_INIT(video_devices); static LIST_HEAD(video_devices);
static DEFINE_SPINLOCK(list_lock); static DEFINE_SPINLOCK(list_lock);
static inline bool data_ready(struct most_video_dev *mdev) static inline bool data_ready(struct most_video_dev *mdev)
......
# SPDX-License-Identifier: GPL-2.0
config DTB_GNUBEE1
bool "GnuBee1 2.5inch NAS"
depends on SOC_MT7621 && DTB_RT_NONE
select BUILTIN_DTB
config DTB_GNUBEE2
bool "GnuBee2 3.5inch NAS"
depends on SOC_MT7621 && DTB_RT_NONE
select BUILTIN_DTB
# SPDX-License-Identifier: GPL-2.0
dtb-$(CONFIG_DTB_GNUBEE1) += gbpc1.dtb
dtb-$(CONFIG_DTB_GNUBEE2) += gbpc2.dtb
obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y))
- ensure all usage matches code
- ensure all features used are documented
Cc: NeilBrown <neil@brown.name>
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/dts-v1/;
#include "gbpc1.dts"
/ {
compatible = "gnubee,gb-pc2", "mediatek,mt7621-soc";
model = "GB-PC2";
};
&default_gpio {
groups = "wdt", "uart3";
function = "gpio";
};
&gmac1 {
status = "ok";
};
&phy_external {
status = "ok";
};
...@@ -383,8 +383,8 @@ static void nvec_request_master(struct work_struct *work) ...@@ -383,8 +383,8 @@ static void nvec_request_master(struct work_struct *work)
msg = list_first_entry(&nvec->tx_data, struct nvec_msg, node); msg = list_first_entry(&nvec->tx_data, struct nvec_msg, node);
spin_unlock_irqrestore(&nvec->tx_lock, flags); spin_unlock_irqrestore(&nvec->tx_lock, flags);
nvec_gpio_set_value(nvec, 0); nvec_gpio_set_value(nvec, 0);
err = wait_for_completion_interruptible_timeout( err = wait_for_completion_interruptible_timeout(&nvec->ec_transfer,
&nvec->ec_transfer, msecs_to_jiffies(5000)); msecs_to_jiffies(5000));
if (err == 0) { if (err == 0) {
dev_warn(nvec->dev, "timeout waiting for ec transfer\n"); dev_warn(nvec->dev, "timeout waiting for ec transfer\n");
......
* coding style does not fully comply with the kernel style guide.
* still TODOs, annotated in the code
* currently the code introduces new IOCTLs. I'm afraid this is a bad idea. * currently the code introduces new IOCTLs. I'm afraid this is a bad idea.
-> Replace this with another interface, hints are welcome! -> Replace this with another interface, hints are welcome!
* Some missing data (marked with ###) needs to be added in the documentation * Some missing data (marked with ###) needs to be added in the documentation
* Change (struct pi433_tx_cfg)->bit_rate to be a u32 so that we can support
bit rates up to 300kbps per the spec.
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0+ */ /* SPDX-License-Identifier: GPL-2.0+ */
/* /*
* include/linux/TODO
*
* userspace interface for pi433 radio module * userspace interface for pi433 radio module
* *
* Pi433 is a 433MHz radio module for the Raspberry Pi. * Pi433 is a 433MHz radio module for the Raspberry Pi.
......
This diff is collapsed.
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#define FIFO_SIZE 66 /* bytes */ #define FIFO_SIZE 66 /* bytes */
#define FIFO_THRESHOLD 15 /* bytes */ #define FIFO_THRESHOLD 15 /* bytes */
u8 rf69_read_reg(struct spi_device *spi, u8 addr);
int rf69_get_version(struct spi_device *spi);
int rf69_set_mode(struct spi_device *spi, enum mode mode); int rf69_set_mode(struct spi_device *spi, enum mode mode);
int rf69_set_data_mode(struct spi_device *spi, u8 data_mode); int rf69_set_data_mode(struct spi_device *spi, u8 data_mode);
int rf69_set_modulation(struct spi_device *spi, enum modulation modulation); int rf69_set_modulation(struct spi_device *spi, enum modulation modulation);
...@@ -40,7 +42,6 @@ int rf69_set_bandwidth_during_afc(struct spi_device *spi, ...@@ -40,7 +42,6 @@ int rf69_set_bandwidth_during_afc(struct spi_device *spi,
int rf69_set_ook_threshold_dec(struct spi_device *spi, int rf69_set_ook_threshold_dec(struct spi_device *spi,
enum threshold_decrement threshold_decrement); enum threshold_decrement threshold_decrement);
int rf69_set_dio_mapping(struct spi_device *spi, u8 dio_number, u8 value); int rf69_set_dio_mapping(struct spi_device *spi, u8 dio_number, u8 value);
bool rf69_get_flag(struct spi_device *spi, enum flag flag);
int rf69_set_rssi_threshold(struct spi_device *spi, u8 threshold); int rf69_set_rssi_threshold(struct spi_device *spi, u8 threshold);
int rf69_set_preamble_length(struct spi_device *spi, u16 preamble_length); int rf69_set_preamble_length(struct spi_device *spi, u16 preamble_length);
int rf69_enable_sync(struct spi_device *spi); int rf69_enable_sync(struct spi_device *spi);
......
...@@ -84,26 +84,6 @@ enum threshold_decrement { ...@@ -84,26 +84,6 @@ enum threshold_decrement {
dec_16times dec_16times
}; };
enum flag {
mode_switch_completed,
ready_to_receive,
ready_to_send,
pll_locked,
rssi_exceeded_threshold,
timeout,
automode,
sync_address_match,
fifo_full,
// fifo_not_empty, collision with next enum; replaced by following enum...
fifo_empty,
fifo_level_below_threshold,
fifo_overrun,
packet_sent,
payload_ready,
crc_ok,
battery_low
};
enum fifo_fill_condition { enum fifo_fill_condition {
after_sync_interrupt, after_sync_interrupt,
always always
......
...@@ -89,9 +89,11 @@ ...@@ -89,9 +89,11 @@
#define REG_AESKEY16 0x4D #define REG_AESKEY16 0x4D
#define REG_TEMP1 0x4E #define REG_TEMP1 0x4E
#define REG_TEMP2 0x4F #define REG_TEMP2 0x4F
#define REG_TESTLNA 0x58
#define REG_TESTPA1 0x5A /* only present on RFM69HW */ #define REG_TESTPA1 0x5A /* only present on RFM69HW */
#define REG_TESTPA2 0x5C /* only present on RFM69HW */ #define REG_TESTPA2 0x5C /* only present on RFM69HW */
#define REG_TESTDAGC 0x6F #define REG_TESTDAGC 0x6F
#define REG_TESTAFC 0x71
/******************************************************/ /******************************************************/
/* RF69/SX1231 bit definition */ /* RF69/SX1231 bit definition */
......
...@@ -4605,14 +4605,12 @@ static int qlge_probe(struct pci_dev *pdev, ...@@ -4605,14 +4605,12 @@ static int qlge_probe(struct pci_dev *pdev,
err = register_netdev(ndev); err = register_netdev(ndev);
if (err) { if (err) {
dev_err(&pdev->dev, "net device registration failed.\n"); dev_err(&pdev->dev, "net device registration failed.\n");
qlge_release_all(pdev); goto cleanup_pdev;
pci_disable_device(pdev);
goto netdev_free;
} }
err = qlge_health_create_reporters(qdev); err = qlge_health_create_reporters(qdev);
if (err) if (err)
goto netdev_free; goto unregister_netdev;
/* Start up the timer to trigger EEH if /* Start up the timer to trigger EEH if
* the bus goes dead * the bus goes dead
...@@ -4626,6 +4624,11 @@ static int qlge_probe(struct pci_dev *pdev, ...@@ -4626,6 +4624,11 @@ static int qlge_probe(struct pci_dev *pdev,
devlink_register(devlink); devlink_register(devlink);
return 0; return 0;
unregister_netdev:
unregister_netdev(ndev);
cleanup_pdev:
qlge_release_all(pdev);
pci_disable_device(pdev);
netdev_free: netdev_free:
free_netdev(ndev); free_netdev(ndev);
devlink_free: devlink_free:
......
...@@ -10,7 +10,6 @@ r8188eu-y = \ ...@@ -10,7 +10,6 @@ r8188eu-y = \
hal/hal_intf.o \ hal/hal_intf.o \
hal/hal_com.o \ hal/hal_com.o \
hal/odm.o \ hal/odm.o \
hal/odm_debug.o \
hal/odm_HWConfig.o \ hal/odm_HWConfig.o \
hal/odm_RegConfig8188E.o \ hal/odm_RegConfig8188E.o \
hal/odm_RTL8188E.o \ hal/odm_RTL8188E.o \
...@@ -37,6 +36,7 @@ r8188eu-y = \ ...@@ -37,6 +36,7 @@ r8188eu-y = \
core/rtw_br_ext.o \ core/rtw_br_ext.o \
core/rtw_cmd.o \ core/rtw_cmd.o \
core/rtw_efuse.o \ core/rtw_efuse.o \
core/rtw_fw.o \
core/rtw_ieee80211.o \ core/rtw_ieee80211.o \
core/rtw_ioctl_set.o \ core/rtw_ioctl_set.o \
core/rtw_iol.o \ core/rtw_iol.o \
......
This diff is collapsed.
...@@ -71,10 +71,8 @@ static int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag) ...@@ -71,10 +71,8 @@ static int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag)
int data_len; int data_len;
data_len = tag->tag_len + TAG_HDR_LEN; data_len = tag->tag_len + TAG_HDR_LEN;
if (skb_tailroom(skb) < data_len) { if (skb_tailroom(skb) < data_len)
_DEBUG_ERR("skb_tailroom() failed in add SID tag!\n");
return -1; return -1;
}
skb_put(skb, data_len); skb_put(skb, data_len);
/* have a room for new tag */ /* have a room for new tag */
...@@ -105,8 +103,7 @@ static int skb_pull_and_merge(struct sk_buff *skb, unsigned char *src, int len) ...@@ -105,8 +103,7 @@ static int skb_pull_and_merge(struct sk_buff *skb, unsigned char *src, int len)
return 0; return 0;
} }
static int __nat25_has_expired(struct adapter *priv, static int __nat25_has_expired(struct nat25_network_db_entry *fdb)
struct nat25_network_db_entry *fdb)
{ {
if (time_before_eq(fdb->ageing_timer, jiffies - NAT25_AGEING_TIME * HZ)) if (time_before_eq(fdb->ageing_timer, jiffies - NAT25_AGEING_TIME * HZ))
return 1; return 1;
...@@ -163,9 +160,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char ...@@ -163,9 +160,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
if (len >= 8) { if (len >= 8) {
mac = scan_tlv(&data[8], len-8, 1, 1); mac = scan_tlv(&data[8], len-8, 1, 1);
if (mac) { if (mac) {
_DEBUG_INFO("Router Solicitation, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
replace_mac[0], replace_mac[1], replace_mac[2], replace_mac[3], replace_mac[4], replace_mac[5]);
memcpy(mac, replace_mac, 6); memcpy(mac, replace_mac, 6);
return 1; return 1;
} }
...@@ -174,9 +168,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char ...@@ -174,9 +168,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
if (len >= 16) { if (len >= 16) {
mac = scan_tlv(&data[16], len-16, 1, 1); mac = scan_tlv(&data[16], len-16, 1, 1);
if (mac) { if (mac) {
_DEBUG_INFO("Router Advertisement, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
replace_mac[0], replace_mac[1], replace_mac[2], replace_mac[3], replace_mac[4], replace_mac[5]);
memcpy(mac, replace_mac, 6); memcpy(mac, replace_mac, 6);
return 1; return 1;
} }
...@@ -185,9 +176,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char ...@@ -185,9 +176,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
if (len >= 24) { if (len >= 24) {
mac = scan_tlv(&data[24], len-24, 1, 1); mac = scan_tlv(&data[24], len-24, 1, 1);
if (mac) { if (mac) {
_DEBUG_INFO("Neighbor Solicitation, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
replace_mac[0], replace_mac[1], replace_mac[2], replace_mac[3], replace_mac[4], replace_mac[5]);
memcpy(mac, replace_mac, 6); memcpy(mac, replace_mac, 6);
return 1; return 1;
} }
...@@ -196,9 +184,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char ...@@ -196,9 +184,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
if (len >= 24) { if (len >= 24) {
mac = scan_tlv(&data[24], len-24, 2, 1); mac = scan_tlv(&data[24], len-24, 2, 1);
if (mac) { if (mac) {
_DEBUG_INFO("Neighbor Advertisement, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
replace_mac[0], replace_mac[1], replace_mac[2], replace_mac[3], replace_mac[4], replace_mac[5]);
memcpy(mac, replace_mac, 6); memcpy(mac, replace_mac, 6);
return 1; return 1;
} }
...@@ -207,9 +192,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char ...@@ -207,9 +192,6 @@ static int update_nd_link_layer_addr(unsigned char *data, int len, unsigned char
if (len >= 40) { if (len >= 40) {
mac = scan_tlv(&data[40], len-40, 2, 1); mac = scan_tlv(&data[40], len-40, 2, 1);
if (mac) { if (mac) {
_DEBUG_INFO("Redirect, replace MAC From: %02x:%02x:%02x:%02x:%02x:%02x, To: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
replace_mac[0], replace_mac[1], replace_mac[2], replace_mac[3], replace_mac[4], replace_mac[5]);
memcpy(mac, replace_mac, 6); memcpy(mac, replace_mac, 6);
return 1; return 1;
} }
...@@ -319,10 +301,6 @@ static void __nat25_db_network_insert(struct adapter *priv, ...@@ -319,10 +301,6 @@ static void __nat25_db_network_insert(struct adapter *priv,
spin_unlock_bh(&priv->br_ext_lock); spin_unlock_bh(&priv->br_ext_lock);
} }
static void __nat25_db_print(struct adapter *priv)
{
}
/* /*
* NAT2.5 interface * NAT2.5 interface
*/ */
...@@ -367,7 +345,7 @@ void nat25_db_expire(struct adapter *priv) ...@@ -367,7 +345,7 @@ void nat25_db_expire(struct adapter *priv)
struct nat25_network_db_entry *g; struct nat25_network_db_entry *g;
g = f->next_hash; g = f->next_hash;
if (__nat25_has_expired(priv, f)) { if (__nat25_has_expired(f)) {
if (atomic_dec_and_test(&f->use_count)) { if (atomic_dec_and_test(&f->use_count)) {
if (priv->scdb_entry == f) { if (priv->scdb_entry == f) {
memset(priv->scdb_mac, 0, ETH_ALEN); memset(priv->scdb_mac, 0, ETH_ALEN);
...@@ -404,10 +382,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) ...@@ -404,10 +382,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
if (protocol == ETH_P_IP) { if (protocol == ETH_P_IP) {
struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN); struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN);
if (((unsigned char *)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len)) { if (((unsigned char *)(iph) + (iph->ihl << 2)) >= (skb->data + ETH_HLEN + skb->len))
DEBUG_WARN("NAT25: malformed IP packet !\n");
return -1; return -1;
}
switch (method) { switch (method) {
case NAT25_CHECK: case NAT25_CHECK:
...@@ -418,12 +394,9 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) ...@@ -418,12 +394,9 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
if (iph->saddr == 0) if (iph->saddr == 0)
return 0; return 0;
tmp = be32_to_cpu(iph->saddr); tmp = be32_to_cpu(iph->saddr);
DEBUG_INFO("NAT25: Insert IP, SA =%08x, DA =%08x\n", tmp, iph->daddr);
__nat25_generate_ipv4_network_addr(networkAddr, &tmp); __nat25_generate_ipv4_network_addr(networkAddr, &tmp);
/* record source IP address and , source mac address into db */ /* record source IP address and , source mac address into db */
__nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr);
__nat25_db_print(priv);
return 0; return 0;
default: default:
return -1; return -1;
...@@ -436,25 +409,19 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) ...@@ -436,25 +409,19 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
unsigned char *arp_ptr = (unsigned char *)(arp + 1); unsigned char *arp_ptr = (unsigned char *)(arp + 1);
unsigned int *sender; unsigned int *sender;
if (arp->ar_pro != __constant_htons(ETH_P_IP)) { if (arp->ar_pro != htons(ETH_P_IP))
DEBUG_WARN("NAT25: arp protocol unknown (%4x)!\n", be16_to_cpu(arp->ar_pro));
return -1; return -1;
}
switch (method) { switch (method) {
case NAT25_CHECK: case NAT25_CHECK:
return 0; /* skb_copy for all ARP frame */ return 0; /* skb_copy for all ARP frame */
case NAT25_INSERT: case NAT25_INSERT:
DEBUG_INFO("NAT25: Insert ARP, MAC =%02x%02x%02x%02x%02x%02x\n", arp_ptr[0],
arp_ptr[1], arp_ptr[2], arp_ptr[3], arp_ptr[4], arp_ptr[5]);
/* change to ARP sender mac address to wlan STA address */ /* change to ARP sender mac address to wlan STA address */
memcpy(arp_ptr, GET_MY_HWADDR(priv), ETH_ALEN); memcpy(arp_ptr, GET_MY_HWADDR(priv), ETH_ALEN);
arp_ptr += arp->ar_hln; arp_ptr += arp->ar_hln;
sender = (unsigned int *)arp_ptr; sender = (unsigned int *)arp_ptr;
__nat25_generate_ipv4_network_addr(networkAddr, sender); __nat25_generate_ipv4_network_addr(networkAddr, sender);
__nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr);
__nat25_db_print(priv);
return 0; return 0;
default: default:
return -1; return -1;
...@@ -484,18 +451,19 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) ...@@ -484,18 +451,19 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
pOldTag = (struct pppoe_tag *)__nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID)); pOldTag = (struct pppoe_tag *)__nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID));
if (pOldTag) { /* if SID existed, copy old value and delete it */ if (pOldTag) { /* if SID existed, copy old value and delete it */
old_tag_len = ntohs(pOldTag->tag_len); old_tag_len = ntohs(pOldTag->tag_len);
if (old_tag_len+TAG_HDR_LEN+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN > sizeof(tag_buf)) { if (old_tag_len +
DEBUG_ERR("SID tag length too long!\n"); TAG_HDR_LEN +
MAGIC_CODE_LEN +
RTL_RELAY_TAG_LEN >
sizeof(tag_buf))
return -1; return -1;
}
memcpy(tag->tag_data+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN, memcpy(tag->tag_data+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN,
pOldTag->tag_data, old_tag_len); pOldTag->tag_data, old_tag_len);
if (skb_pull_and_merge(skb, (unsigned char *)pOldTag, TAG_HDR_LEN+old_tag_len) < 0) { if (skb_pull_and_merge(skb, (unsigned char *)pOldTag, TAG_HDR_LEN+old_tag_len) < 0)
DEBUG_ERR("call skb_pull_and_merge() failed in PADI/R packet!\n");
return -1; return -1;
}
ph->length = htons(ntohs(ph->length)-TAG_HDR_LEN-old_tag_len); ph->length = htons(ntohs(ph->length)-TAG_HDR_LEN-old_tag_len);
} }
...@@ -510,15 +478,12 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) ...@@ -510,15 +478,12 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
/* Add relay tag */ /* Add relay tag */
if (__nat25_add_pppoe_tag(skb, tag) < 0) if (__nat25_add_pppoe_tag(skb, tag) < 0)
return -1; return -1;
DEBUG_INFO("NAT25: Insert PPPoE, forward %s packet\n",
(ph->code == PADI_CODE ? "PADI" : "PADR"));
} else { /* not add relay tag */ } else { /* not add relay tag */
if (priv->pppoe_connection_in_progress && if (priv->pppoe_connection_in_progress &&
memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN)) { memcmp(skb->data + ETH_ALEN,
DEBUG_ERR("Discard PPPoE packet due to another PPPoE connection is in progress!\n"); priv->pppoe_addr,
ETH_ALEN))
return -2; return -2;
}
if (priv->pppoe_connection_in_progress == 0) if (priv->pppoe_connection_in_progress == 0)
memcpy(priv->pppoe_addr, skb->data+ETH_ALEN, ETH_ALEN); memcpy(priv->pppoe_addr, skb->data+ETH_ALEN, ETH_ALEN);
...@@ -529,14 +494,10 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) ...@@ -529,14 +494,10 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
return -1; return -1;
} }
} else { /* session phase */ } else { /* session phase */
DEBUG_INFO("NAT25: Insert PPPoE, insert session packet to %s\n", skb->dev->name);
__nat25_generate_pppoe_network_addr(networkAddr, skb->data, &ph->sid); __nat25_generate_pppoe_network_addr(networkAddr, skb->data, &ph->sid);
__nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr);
__nat25_db_print(priv);
if (!priv->ethBrExtInfo.addPPPoETag && if (!priv->ethBrExtInfo.addPPPoETag &&
priv->pppoe_connection_in_progress && priv->pppoe_connection_in_progress &&
!memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN)) !memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN))
...@@ -576,10 +537,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) ...@@ -576,10 +537,8 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
/*------------------------------------------------*/ /*------------------------------------------------*/
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN); struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);
if (sizeof(*iph) >= (skb->len - ETH_HLEN)) { if (sizeof(*iph) >= (skb->len - ETH_HLEN))
DEBUG_WARN("NAT25: malformed IPv6 packet !\n");
return -1; return -1;
}
switch (method) { switch (method) {
case NAT25_CHECK: case NAT25_CHECK:
...@@ -587,17 +546,9 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) ...@@ -587,17 +546,9 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
return 0; return 0;
return -1; return -1;
case NAT25_INSERT: case NAT25_INSERT:
DEBUG_INFO("NAT25: Insert IP, SA =%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x,"
" DA =%4x:%4x:%4x:%4x:%4x:%4x:%4x:%4x\n",
iph->saddr.s6_addr16[0], iph->saddr.s6_addr16[1], iph->saddr.s6_addr16[2], iph->saddr.s6_addr16[3],
iph->saddr.s6_addr16[4], iph->saddr.s6_addr16[5], iph->saddr.s6_addr16[6], iph->saddr.s6_addr16[7],
iph->daddr.s6_addr16[0], iph->daddr.s6_addr16[1], iph->daddr.s6_addr16[2], iph->daddr.s6_addr16[3],
iph->daddr.s6_addr16[4], iph->daddr.s6_addr16[5], iph->daddr.s6_addr16[6], iph->daddr.s6_addr16[7]);
if (memcmp(&iph->saddr, "\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0", 16)) { if (memcmp(&iph->saddr, "\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0", 16)) {
__nat25_generate_ipv6_network_addr(networkAddr, (unsigned int *)&iph->saddr); __nat25_generate_ipv6_network_addr(networkAddr, (unsigned int *)&iph->saddr);
__nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr); __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr);
__nat25_db_print(priv);
if (iph->nexthdr == IPPROTO_ICMPV6 && if (iph->nexthdr == IPPROTO_ICMPV6 &&
skb->len > (ETH_HLEN + sizeof(*iph) + 4)) { skb->len > (ETH_HLEN + sizeof(*iph) + 4)) {
...@@ -669,7 +620,6 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb) ...@@ -669,7 +620,6 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)
/* if not broadcast */ /* if not broadcast */
register int sum = 0; register int sum = 0;
DEBUG_INFO("DHCP: change flag of DHCP request to broadcast.\n");
/* or BROADCAST flag */ /* or BROADCAST flag */
dhcph->flags |= htons(BROADCAST_FLAG); dhcph->flags |= htons(BROADCAST_FLAG);
/* recalculate checksum */ /* recalculate checksum */
......
...@@ -65,7 +65,6 @@ static int _rtw_init_evt_priv(struct evt_priv *pevtpriv) ...@@ -65,7 +65,6 @@ static int _rtw_init_evt_priv(struct evt_priv *pevtpriv)
/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
atomic_set(&pevtpriv->event_seq, 0); atomic_set(&pevtpriv->event_seq, 0);
pevtpriv->evt_done_cnt = 0;
INIT_WORK(&pevtpriv->c2h_wk, c2h_wk_callback); INIT_WORK(&pevtpriv->c2h_wk, c2h_wk_callback);
pevtpriv->c2h_wk_alive = false; pevtpriv->c2h_wk_alive = false;
...@@ -133,7 +132,7 @@ static struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue) ...@@ -133,7 +132,7 @@ static struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue)
obj = NULL; obj = NULL;
} else { } else {
obj = container_of((&queue->queue)->next, struct cmd_obj, list); obj = container_of((&queue->queue)->next, struct cmd_obj, list);
rtw_list_delete(&obj->list); list_del_init(&obj->list);
} }
spin_unlock_irqrestore(&queue->lock, flags); spin_unlock_irqrestore(&queue->lock, flags);
...@@ -252,12 +251,8 @@ int rtw_cmd_thread(void *context) ...@@ -252,12 +251,8 @@ int rtw_cmd_thread(void *context)
_next: _next:
if (padapter->bDriverStopped || if (padapter->bDriverStopped ||
padapter->bSurpriseRemoved) { padapter->bSurpriseRemoved)
netdev_dbg(padapter->pnetdev,
"DriverStopped(%d) SurpriseRemoved(%d) break\n",
padapter->bDriverStopped, padapter->bSurpriseRemoved);
break; break;
}
pcmd = rtw_dequeue_cmd(pcmdpriv); pcmd = rtw_dequeue_cmd(pcmdpriv);
if (!pcmd) if (!pcmd)
...@@ -574,8 +569,6 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) ...@@ -574,8 +569,6 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
else else
padapter->pwrctrlpriv.smart_ps = padapter->registrypriv.smart_ps; padapter->pwrctrlpriv.smart_ps = padapter->registrypriv.smart_ps;
netdev_dbg(padapter->pnetdev, "smart_ps = %d\n", padapter->pwrctrlpriv.smart_ps);
pcmd->cmdsz = get_wlan_bssid_ex_sz(psecnetwork);/* get cmdsz before endian conversion */ pcmd->cmdsz = get_wlan_bssid_ex_sz(psecnetwork);/* get cmdsz before endian conversion */
INIT_LIST_HEAD(&pcmd->list); INIT_LIST_HEAD(&pcmd->list);
...@@ -836,7 +829,7 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter) ...@@ -836,7 +829,7 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
return res; return res;
} }
u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue) u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan)
{ {
struct cmd_obj *pcmdobj; struct cmd_obj *pcmdobj;
struct SetChannelPlan_param *setChannelPlan_param; struct SetChannelPlan_param *setChannelPlan_param;
...@@ -859,25 +852,17 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue) ...@@ -859,25 +852,17 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue)
} }
setChannelPlan_param->channel_plan = chplan; setChannelPlan_param->channel_plan = chplan;
if (enqueue) { /* need enqueue, prepare cmd_obj and enqueue */
/* need enqueue, prepare cmd_obj and enqueue */ pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); if (!pcmdobj) {
if (!pcmdobj) {
kfree(setChannelPlan_param);
res = _FAIL;
goto exit;
}
init_h2fwcmd_w_parm_no_rsp(pcmdobj, setChannelPlan_param, GEN_CMD_CODE(_SetChannelPlan));
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
} else {
/* no need to enqueue, do the cmd hdl directly and free cmd parameter */
if (H2C_SUCCESS != set_chplan_hdl(padapter, (unsigned char *)setChannelPlan_param))
res = _FAIL;
kfree(setChannelPlan_param); kfree(setChannelPlan_param);
res = _FAIL;
goto exit;
} }
init_h2fwcmd_w_parm_no_rsp(pcmdobj, setChannelPlan_param, GEN_CMD_CODE(_SetChannelPlan));
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
/* do something based on res... */ /* do something based on res... */
if (res == _SUCCESS) if (res == _SUCCESS)
padapter->mlmepriv.ChannelPlan = chplan; padapter->mlmepriv.ChannelPlan = chplan;
...@@ -951,10 +936,8 @@ static void rtl8188e_sreset_xmit_status_check(struct adapter *padapter) ...@@ -951,10 +936,8 @@ static void rtl8188e_sreset_xmit_status_check(struct adapter *padapter)
u32 txdma_status; u32 txdma_status;
txdma_status = rtw_read32(padapter, REG_TXDMA_STATUS); txdma_status = rtw_read32(padapter, REG_TXDMA_STATUS);
if (txdma_status != 0x00) { if (txdma_status != 0x00)
DBG_88E("%s REG_TXDMA_STATUS:0x%08x\n", __func__, txdma_status);
rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status); rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status);
}
/* total xmit irp = 4 */ /* total xmit irp = 4 */
} }
...@@ -1335,9 +1318,10 @@ static void c2h_wk_callback(struct work_struct *work) ...@@ -1335,9 +1318,10 @@ static void c2h_wk_callback(struct work_struct *work)
evtpriv->c2h_wk_alive = true; evtpriv->c2h_wk_alive = true;
while (!rtw_cbuf_empty(evtpriv->c2h_queue)) { while (!rtw_cbuf_empty(evtpriv->c2h_queue)) {
if ((c2h_evt = (struct c2h_evt_hdr *)rtw_cbuf_pop(evtpriv->c2h_queue)) != NULL) { c2h_evt = (struct c2h_evt_hdr *)rtw_cbuf_pop(evtpriv->c2h_queue);
if (c2h_evt) {
/* This C2H event is read, clear it */ /* This C2H event is read, clear it */
c2h_evt_clear(adapter); rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE);
} else { } else {
c2h_evt = kmalloc(16, GFP_KERNEL); c2h_evt = kmalloc(16, GFP_KERNEL);
if (c2h_evt) { if (c2h_evt) {
...@@ -1466,7 +1450,6 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) ...@@ -1466,7 +1450,6 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
{ {
u8 timer_cancelled;
struct sta_info *psta = NULL; struct sta_info *psta = NULL;
struct wlan_network *pwlan = NULL; struct wlan_network *pwlan = NULL;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
...@@ -1476,7 +1459,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) ...@@ -1476,7 +1459,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
if (pcmd->res != H2C_SUCCESS) if (pcmd->res != H2C_SUCCESS)
_set_timer(&pmlmepriv->assoc_timer, 1); _set_timer(&pmlmepriv->assoc_timer, 1);
_cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled); del_timer_sync(&pmlmepriv->assoc_timer);
spin_lock_bh(&pmlmepriv->lock); spin_lock_bh(&pmlmepriv->lock);
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2007 - 2011 Realtek Corporation. */
#include <linux/firmware.h>
#include "../include/rtw_fw.h"
#define MAX_REG_BOLCK_SIZE 196
#define FW_8188E_START_ADDRESS 0x1000
#define MAX_PAGE_SIZE 4096
#define IS_FW_HEADER_EXIST(_fwhdr) \
((le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x92C0 || \
(le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88C0 || \
(le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x2300 || \
(le16_to_cpu(_fwhdr->Signature) & 0xFFF0) == 0x88E0)
/* This structure must be careful with byte-ordering */
struct rt_firmware_hdr {
/* 8-byte alinment required */
/* LONG WORD 0 ---- */
__le16 Signature; /* 92C0: test chip; 92C,
* 88C0: test chip; 88C1: MP A-cut;
* 92C1: MP A-cut */
u8 Category; /* AP/NIC and USB/PCI */
u8 Function; /* Reserved for different FW function
* indcation, for further use when
* driver needs to download different
* FW for different conditions */
__le16 Version; /* FW Version */
u8 Subversion; /* FW Subversion, default 0x00 */
u16 Rsvd1;
/* LONG WORD 1 ---- */
u8 Month; /* Release time Month field */
u8 Date; /* Release time Date field */
u8 Hour; /* Release time Hour field */
u8 Minute; /* Release time Minute field */
__le16 RamCodeSize; /* The size of RAM code */
u8 Foundry;
u8 Rsvd2;
/* LONG WORD 2 ---- */
__le32 SvnIdx; /* The SVN entry index */
u32 Rsvd3;
/* LONG WORD 3 ---- */
u32 Rsvd4;
u32 Rsvd5;
};
static void fw_download_enable(struct adapter *padapter, bool enable)
{
u8 tmp;
if (enable) {
/* MCU firmware download enable. */
tmp = rtw_read8(padapter, REG_MCUFWDL);
rtw_write8(padapter, REG_MCUFWDL, tmp | 0x01);
/* 8051 reset */
tmp = rtw_read8(padapter, REG_MCUFWDL + 2);
rtw_write8(padapter, REG_MCUFWDL + 2, tmp & 0xf7);
} else {
/* MCU firmware download disable. */
tmp = rtw_read8(padapter, REG_MCUFWDL);
rtw_write8(padapter, REG_MCUFWDL, tmp & 0xfe);
/* Reserved for fw extension. */
rtw_write8(padapter, REG_MCUFWDL + 1, 0x00);
}
}
static int block_write(struct adapter *padapter, void *buffer, u32 buffSize)
{
int ret = _SUCCESS;
u32 blockSize_p1 = 4; /* (Default) Phase #1 : PCI muse use 4-byte write to download FW */
u32 blockSize_p2 = 8; /* Phase #2 : Use 8-byte, if Phase#1 use big size to write FW. */
u32 blockSize_p3 = 1; /* Phase #3 : Use 1-byte, the remnant of FW image. */
u32 blockCount_p1 = 0, blockCount_p2 = 0, blockCount_p3 = 0;
u32 remainSize_p1 = 0, remainSize_p2 = 0;
u8 *bufferPtr = (u8 *)buffer;
u32 i = 0, offset = 0;
blockSize_p1 = MAX_REG_BOLCK_SIZE;
/* 3 Phase #1 */
blockCount_p1 = buffSize / blockSize_p1;
remainSize_p1 = buffSize % blockSize_p1;
for (i = 0; i < blockCount_p1; i++) {
ret = rtw_writeN(padapter, (FW_8188E_START_ADDRESS + i * blockSize_p1), blockSize_p1, (bufferPtr + i * blockSize_p1));
if (ret == _FAIL)
goto exit;
}
/* 3 Phase #2 */
if (remainSize_p1) {
offset = blockCount_p1 * blockSize_p1;
blockCount_p2 = remainSize_p1 / blockSize_p2;
remainSize_p2 = remainSize_p1 % blockSize_p2;
for (i = 0; i < blockCount_p2; i++) {
ret = rtw_writeN(padapter, (FW_8188E_START_ADDRESS + offset + i * blockSize_p2), blockSize_p2, (bufferPtr + offset + i * blockSize_p2));
if (ret == _FAIL)
goto exit;
}
}
/* 3 Phase #3 */
if (remainSize_p2) {
offset = (blockCount_p1 * blockSize_p1) + (blockCount_p2 * blockSize_p2);
blockCount_p3 = remainSize_p2 / blockSize_p3;
for (i = 0; i < blockCount_p3; i++) {
ret = rtw_write8(padapter, (FW_8188E_START_ADDRESS + offset + i), *(bufferPtr + offset + i));
if (ret == _FAIL)
goto exit;
}
}
exit:
return ret;
}
static int page_write(struct adapter *padapter, u32 page, void *buffer, u32 size)
{
u8 value8;
u8 u8Page = (u8)(page & 0x07);
value8 = (rtw_read8(padapter, REG_MCUFWDL + 2) & 0xF8) | u8Page;
rtw_write8(padapter, REG_MCUFWDL + 2, value8);
return block_write(padapter, buffer, size);
}
static int write_fw(struct adapter *padapter, void *buffer, u32 size)
{
/* Since we need dynamic decide method of dwonload fw, so we call this function to get chip version. */
/* We can remove _ReadChipVersion from ReadpadapterInfo8192C later. */
int ret = _SUCCESS;
u32 pageNums, remainSize;
u32 page, offset;
u8 *bufferPtr = (u8 *)buffer;
pageNums = size / MAX_PAGE_SIZE;
remainSize = size % MAX_PAGE_SIZE;
for (page = 0; page < pageNums; page++) {
offset = page * MAX_PAGE_SIZE;
ret = page_write(padapter, page, bufferPtr + offset, MAX_PAGE_SIZE);
if (ret == _FAIL)
goto exit;
}
if (remainSize) {
offset = pageNums * MAX_PAGE_SIZE;
page = pageNums;
ret = page_write(padapter, page, bufferPtr + offset, remainSize);
if (ret == _FAIL)
goto exit;
}
exit:
return ret;
}
void rtw_reset_8051(struct adapter *padapter)
{
u8 val8;
val8 = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val8 & (~BIT(2)));
rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val8 | (BIT(2)));
}
static int fw_free_to_go(struct adapter *padapter)
{
u32 counter = 0;
u32 value32;
/* polling CheckSum report */
do {
value32 = rtw_read32(padapter, REG_MCUFWDL);
if (value32 & FWDL_CHKSUM_RPT)
break;
} while (counter++ < POLLING_READY_TIMEOUT_COUNT);
if (counter >= POLLING_READY_TIMEOUT_COUNT)
return _FAIL;
value32 = rtw_read32(padapter, REG_MCUFWDL);
value32 |= MCUFWDL_RDY;
value32 &= ~WINTINI_RDY;
rtw_write32(padapter, REG_MCUFWDL, value32);
rtw_reset_8051(padapter);
/* polling for FW ready */
counter = 0;
do {
value32 = rtw_read32(padapter, REG_MCUFWDL);
if (value32 & WINTINI_RDY)
return _SUCCESS;
udelay(5);
} while (counter++ < POLLING_READY_TIMEOUT_COUNT);
return _FAIL;
}
static int load_firmware(struct rt_firmware *rtfw, struct device *device)
{
int ret = _SUCCESS;
const struct firmware *fw;
const char *fw_name = "rtlwifi/rtl8188eufw.bin";
int err = request_firmware(&fw, fw_name, device);
if (err) {
pr_err("Request firmware failed with error 0x%x\n", err);
ret = _FAIL;
goto exit;
}
if (!fw) {
pr_err("Firmware %s not available\n", fw_name);
ret = _FAIL;
goto exit;
}
rtfw->data = kmemdup(fw->data, fw->size, GFP_KERNEL);
if (!rtfw->data) {
pr_err("Failed to allocate rtfw->data\n");
ret = _FAIL;
goto exit;
}
rtfw->size = fw->size;
exit:
release_firmware(fw);
return ret;
}
int rtl8188e_firmware_download(struct adapter *padapter)
{
int ret = _SUCCESS;
u8 write_fw_retry = 0;
u32 fwdl_start_time;
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
struct device *device = dvobj_to_dev(dvobj);
struct rt_firmware_hdr *fwhdr = NULL;
u16 fw_version, fw_subversion, fw_signature;
u8 *fw_data;
u32 fw_size;
static int log_version;
if (!dvobj->firmware.data)
ret = load_firmware(&dvobj->firmware, device);
if (ret == _FAIL) {
dvobj->firmware.data = NULL;
goto exit;
}
fw_data = dvobj->firmware.data;
fw_size = dvobj->firmware.size;
/* To Check Fw header. Added by tynli. 2009.12.04. */
fwhdr = (struct rt_firmware_hdr *)dvobj->firmware.data;
fw_version = le16_to_cpu(fwhdr->Version);
fw_subversion = fwhdr->Subversion;
fw_signature = le16_to_cpu(fwhdr->Signature);
if (!log_version++)
pr_info("%sFirmware Version %d, SubVersion %d, Signature 0x%x\n",
DRIVER_PREFIX, fw_version, fw_subversion, fw_signature);
if (IS_FW_HEADER_EXIST(fwhdr)) {
/* Shift 32 bytes for FW header */
fw_data = fw_data + 32;
fw_size = fw_size - 32;
}
/* Suggested by Filen. If 8051 is running in RAM code, driver should inform Fw to reset by itself, */
/* or it will cause download Fw fail. 2010.02.01. by tynli. */
if (rtw_read8(padapter, REG_MCUFWDL) & RAM_DL_SEL) { /* 8051 RAM code */
rtw_write8(padapter, REG_MCUFWDL, 0x00);
rtw_reset_8051(padapter);
}
fw_download_enable(padapter, true);
fwdl_start_time = jiffies;
while (1) {
/* reset the FWDL chksum */
rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL) | FWDL_CHKSUM_RPT);
ret = write_fw(padapter, fw_data, fw_size);
if (ret == _SUCCESS ||
(rtw_get_passing_time_ms(fwdl_start_time) > 500 && write_fw_retry++ >= 3))
break;
}
fw_download_enable(padapter, false);
if (ret != _SUCCESS)
goto exit;
ret = fw_free_to_go(padapter);
if (ret != _SUCCESS)
goto exit;
exit:
return ret;
}
...@@ -68,7 +68,7 @@ int rtw_get_bit_value_from_ieee_value(u8 val) ...@@ -68,7 +68,7 @@ int rtw_get_bit_value_from_ieee_value(u8 val)
return 0; return 0;
} }
uint rtw_is_cckrates_included(u8 *rate) bool rtw_is_cckrates_included(u8 *rate)
{ {
u32 i = 0; u32 i = 0;
...@@ -81,7 +81,7 @@ uint rtw_is_cckrates_included(u8 *rate) ...@@ -81,7 +81,7 @@ uint rtw_is_cckrates_included(u8 *rate)
return false; return false;
} }
uint rtw_is_cckratesonly_included(u8 *rate) bool rtw_is_cckratesonly_included(u8 *rate)
{ {
u32 i = 0; u32 i = 0;
...@@ -653,13 +653,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, ...@@ -653,13 +653,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
/* first 3 bytes in vendor specific information element are the IEEE /* first 3 bytes in vendor specific information element are the IEEE
* OUI of the vendor. The following byte is used a vendor specific * OUI of the vendor. The following byte is used a vendor specific
* sub-type. */ * sub-type. */
if (elen < 4) { if (elen < 4)
if (show_errors) {
DBG_88E("short vendor specific information element ignored (len=%lu)\n",
(unsigned long)elen);
}
return -1; return -1;
}
oui = RTW_GET_BE24(pos); oui = RTW_GET_BE24(pos);
switch (oui) { switch (oui) {
...@@ -674,11 +669,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, ...@@ -674,11 +669,8 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
elems->wpa_ie_len = elen; elems->wpa_ie_len = elen;
break; break;
case WME_OUI_TYPE: /* this is a Wi-Fi WME info. element */ case WME_OUI_TYPE: /* this is a Wi-Fi WME info. element */
if (elen < 5) { if (elen < 5)
DBG_88E("short WME information element ignored (len=%lu)\n",
(unsigned long)elen);
return -1; return -1;
}
switch (pos[4]) { switch (pos[4]) {
case WME_OUI_SUBTYPE_INFORMATION_ELEMENT: case WME_OUI_SUBTYPE_INFORMATION_ELEMENT:
case WME_OUI_SUBTYPE_PARAMETER_ELEMENT: case WME_OUI_SUBTYPE_PARAMETER_ELEMENT:
...@@ -690,8 +682,6 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, ...@@ -690,8 +682,6 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
elems->wme_tspec_len = elen; elems->wme_tspec_len = elen;
break; break;
default: default:
DBG_88E("unknown WME information element ignored (subtype=%d len=%lu)\n",
pos[4], (unsigned long)elen);
return -1; return -1;
} }
break; break;
...@@ -701,8 +691,6 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, ...@@ -701,8 +691,6 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
elems->wps_ie_len = elen; elems->wps_ie_len = elen;
break; break;
default: default:
DBG_88E("Unknown Microsoft information element ignored (type=%d len=%lu)\n",
pos[3], (unsigned long)elen);
return -1; return -1;
} }
break; break;
...@@ -714,14 +702,10 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, ...@@ -714,14 +702,10 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
elems->vendor_ht_cap_len = elen; elems->vendor_ht_cap_len = elen;
break; break;
default: default:
DBG_88E("Unknown Broadcom information element ignored (type=%d len=%lu)\n",
pos[3], (unsigned long)elen);
return -1; return -1;
} }
break; break;
default: default:
DBG_88E("unknown vendor specific information element ignored (vendor OUI %02x:%02x:%02x len=%lu)\n",
pos[0], pos[1], pos[2], (unsigned long)elen);
return -1; return -1;
} }
return 0; return 0;
...@@ -752,13 +736,8 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len, ...@@ -752,13 +736,8 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len,
elen = *pos++; elen = *pos++;
left -= 2; left -= 2;
if (elen > left) { if (elen > left)
if (show_errors) {
DBG_88E("IEEE 802.11 element parse failed (id=%d elen=%d left=%lu)\n",
id, elen, (unsigned long)left);
}
return ParseFailed; return ParseFailed;
}
switch (id) { switch (id) {
case WLAN_EID_SSID: case WLAN_EID_SSID:
...@@ -839,10 +818,6 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len, ...@@ -839,10 +818,6 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len,
break; break;
default: default:
unknown++; unknown++;
if (!show_errors)
break;
DBG_88E("IEEE 802.11 element parse ignored unknown element (id=%d elen=%d)\n",
id, elen);
break; break;
} }
left -= elen; left -= elen;
...@@ -890,12 +865,8 @@ void rtw_macaddr_cfg(u8 *mac_addr) ...@@ -890,12 +865,8 @@ void rtw_macaddr_cfg(u8 *mac_addr)
ether_addr_copy(mac, mac_addr); ether_addr_copy(mac, mac_addr);
} }
if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) { if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac))
eth_random_addr(mac_addr); eth_random_addr(mac_addr);
DBG_88E("MAC Address from efuse error, assign random one !!!\n");
}
DBG_88E("rtw_macaddr_cfg MAC Address = %pM\n", mac_addr);
} }
/** /**
......
...@@ -110,8 +110,6 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid) ...@@ -110,8 +110,6 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
u32 cur_time = 0; u32 cur_time = 0;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
netdev_dbg(padapter->pnetdev, "set bssid:%pM\n", bssid);
if ((bssid[0] == 0x00 && bssid[1] == 0x00 && bssid[2] == 0x00 && if ((bssid[0] == 0x00 && bssid[1] == 0x00 && bssid[2] == 0x00 &&
bssid[3] == 0x00 && bssid[4] == 0x00 && bssid[5] == 0x00) || bssid[3] == 0x00 && bssid[4] == 0x00 && bssid[5] == 0x00) ||
(bssid[0] == 0xFF && bssid[1] == 0xFF && bssid[2] == 0xFF && (bssid[0] == 0xFF && bssid[1] == 0xFF && bssid[2] == 0xFF &&
...@@ -122,7 +120,6 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid) ...@@ -122,7 +120,6 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
spin_lock_bh(&pmlmepriv->lock); spin_lock_bh(&pmlmepriv->lock);
DBG_88E("Set BSSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
goto handle_tkip_countermeasure; goto handle_tkip_countermeasure;
else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
...@@ -185,9 +182,6 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid) ...@@ -185,9 +182,6 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_network *pnetwork = &pmlmepriv->cur_network; struct wlan_network *pnetwork = &pmlmepriv->cur_network;
netdev_dbg(padapter->pnetdev, "set ssid [%s] fw_state=0x%08x\n",
ssid->Ssid, get_fwstate(pmlmepriv));
if (!padapter->hw_init_completed) { if (!padapter->hw_init_completed) {
status = _FAIL; status = _FAIL;
goto exit; goto exit;
...@@ -195,7 +189,6 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid) ...@@ -195,7 +189,6 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
spin_lock_bh(&pmlmepriv->lock); spin_lock_bh(&pmlmepriv->lock);
DBG_88E("Set SSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) { if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) {
goto handle_tkip_countermeasure; goto handle_tkip_countermeasure;
} else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { } else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
...@@ -280,8 +273,6 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter, ...@@ -280,8 +273,6 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,
if (*pold_state != networktype) { if (*pold_state != networktype) {
spin_lock_bh(&pmlmepriv->lock); spin_lock_bh(&pmlmepriv->lock);
/* DBG_88E("change mode, old_mode =%d, new_mode =%d, fw_state = 0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); */
if (*pold_state == Ndis802_11APMode) { if (*pold_state == Ndis802_11APMode) {
/* change to other mode from Ndis802_11APMode */ /* change to other mode from Ndis802_11APMode */
cur_network->join_res = -1; cur_network->join_res = -1;
...@@ -364,7 +355,6 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s ...@@ -364,7 +355,6 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s
res = true; res = true;
} else { } else {
if (rtw_is_scan_deny(padapter)) { if (rtw_is_scan_deny(padapter)) {
DBG_88E(FUNC_ADPT_FMT": scan deny\n", FUNC_ADPT_ARG(padapter));
indicate_wx_scan_complete_event(padapter); indicate_wx_scan_complete_event(padapter);
return _SUCCESS; return _SUCCESS;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -101,23 +101,15 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv) ...@@ -101,23 +101,15 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta) inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta)
{ {
int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info); return (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info);
if (!stainfo_offset_valid(offset))
DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset);
return offset;
} }
inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset) inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset)
{ {
if (!stainfo_offset_valid(offset))
DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset);
return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info)); return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info));
} }
u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) void _rtw_free_sta_priv(struct sta_priv *pstapriv)
{ {
struct list_head *phead, *plist; struct list_head *phead, *plist;
struct sta_info *psta = NULL; struct sta_info *psta = NULL;
...@@ -147,8 +139,6 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) ...@@ -147,8 +139,6 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)
vfree(pstapriv->pallocated_stainfo_buf); vfree(pstapriv->pallocated_stainfo_buf);
} }
return _SUCCESS;
} }
struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment