* [PATCH v3] ARM: dts: ls1021a: add support for Moxa UC-8410A open platform
From: SZ Lin @ 2017-12-26 4:54 UTC (permalink / raw)
Cc: shawnguo, SZ Lin, Jimmy Chen, Harry YJ Jhou, Rob Herring,
Mark Rutland, Russell King, devicetree, linux-arm-kernel,
linux-kernel
Add support for Moxa UC-8410A open platform
The UC-8410A computing platform is designed
for embedded communication-centric industrial applications
The features of UC-8410A are:
* QSPI flash
* SD slot
* 3x LAN
* 8x RS-232/422/485 ports, software-selectable
* Mini PCIe form factor with PCIe/USB signal
* 2x USB host
* TPM
* Watchdog
* RTC
* User LEDs
* Beeper
* Push button
Signed-off-by: Jimmy Chen <jimmy.chen@moxa.com>
Signed-off-by: Harry YJ Jhou <harryyj.jhou@moxa.com>
Signed-off-by: SZ Lin <sz.lin@moxa.com>
---
Changes from v2:
- Replace underscore with hyphen in node name
- Add unit address after nodes with 'reg' property
- Sort nodes with unit-address in order of the address
- Fix up unit-address in partitions node
arch/arm/boot/dts/Makefile | 1 +
arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts | 241 ++++++++++++++++++++++++++++
2 files changed, 242 insertions(+)
create mode 100644 arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index d0381e9caf21..62ce9b27ad30 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -520,6 +520,7 @@ dtb-$(CONFIG_SOC_IMX7D) += \
imx7s-colibri-eval-v3.dtb \
imx7s-warp.dtb
dtb-$(CONFIG_SOC_LS1021A) += \
+ ls1021a-moxa-uc-8410a.dtb \
ls1021a-qds.dtb \
ls1021a-twr.dtb
dtb-$(CONFIG_SOC_VF610) += \
diff --git a/arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts b/arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts
new file mode 100644
index 000000000000..d01f64b252b1
--- /dev/null
+++ b/arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2017 Moxa Inc. - https://www.moxa.com/
+ *
+ * Author: Harry YJ Jhou (周亞諄) <harryyj.jhou@moxa.com>
+ * Jimmy Chen (陳永達) <jimmy.chen@moxa.com>
+ * SZ Lin (林上智) <sz.lin@moxa.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include "ls1021a.dtsi"
+
+/ {
+ model = "Moxa UC-8410A";
+
+ aliases {
+ enet0_rgmii_phy = &rgmii_phy0;
+ enet1_rgmii_phy = &rgmii_phy1;
+ enet2_rgmii_phy = &rgmii_phy2;
+ };
+
+ sys_mclk: clock-mclk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <24576000>;
+ };
+
+ reg_3p3v: regulator-3p3v {
+ compatible = "regulator-fixed";
+ regulator-name = "3P3V";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-always-on;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ cel-pwr {
+ label = "UC8410A:CEL-PWR";
+ gpios = <&gpio3 27 GPIO_ACTIVE_LOW>;
+ default-state = "off";
+ };
+
+ cel-reset {
+ label = "UC8410A:CEL-RESET";
+ gpios = <&gpio3 28 GPIO_ACTIVE_LOW>;
+ default-state = "off";
+ };
+
+ str-led {
+ label = "UC8410A:RED:PROG";
+ gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "mmc0";
+ };
+
+ sw-ready {
+ label = "UC8410A:GREEN:SWRDY";
+ gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+
+ beeper {
+ label = "UC8410A:BEEP";
+ gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ prog-led0 {
+ label = "UC8410A:GREEN:PROG2";
+ gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ prog-led1 {
+ label = "UC8410A:GREEN:PROG1";
+ gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ prog-led2 {
+ label = "UC8410A:GREEN:PROG0";
+ gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ wifi-signal0 {
+ label = "UC8410A:GREEN:CEL2";
+ gpios = <&gpio3 17 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ wifi-signal1 {
+ label = "UC8410A:GREEN:CEL1";
+ gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ wifi-signal2 {
+ label = "UC8410A:GREEN:CEL0";
+ gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ cpu-diag-red {
+ label = "UC8410A:RED:DIA";
+ gpios = <&gpio3 20 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ cpu-diag-green {
+ label = "UC8410A:GREEN:DIA";
+ gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ cpu-diag-yellow {
+ label = "UC8410A:YELLOW:DIA";
+ gpios = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ pushbtn-key {
+ label = "push button key";
+ gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
+ linux,code = <BTN_MISC>;
+ default-state = "on";
+ };
+ };
+};
+
+&enet0 {
+ phy-handle = <&rgmii_phy0>;
+ phy-connection-type = "rgmii-id";
+ status = "okay";
+};
+
+&enet1 {
+ phy-handle = <&rgmii_phy1>;
+ phy-connection-type = "rgmii-id";
+ status = "okay";
+};
+
+&enet2 {
+ phy-handle = <&rgmii_phy2>;
+ phy-connection-type = "rgmii-id";
+ status = "okay";
+};
+
+&i2c0 {
+ clock-frequency = <100000>;
+ status = "okay";
+
+ tpm@20 {
+ compatible = "infineon,slb9635tt";
+ reg = <0x20>;
+ };
+
+ rtc@68 {
+ compatible = "dallas,ds1374";
+ reg = <0x68>;
+ };
+};
+
+&lpuart0 {
+ status = "okay";
+};
+
+&mdio0 {
+ rgmii_phy0: ethernet-phy@0 {
+ compatible = "marvell,88e1118";
+ reg = <0x0>;
+ marvell,reg-init =
+ <3 0x11 0 0x4415>, /* Reg 3,17 */
+ <3 0x10 0 0x77>; /* Reg 3,16 */
+ };
+
+ rgmii_phy1: ethernet-phy@1 {
+ compatible = "marvell,88e1118";
+ reg = <0x1>;
+ marvell,reg-init =
+ <3 0x11 0 0x4415>, /* Reg 3,17 */
+ <3 0x10 0 0x77>; /* Reg 3,16 */
+ };
+
+ rgmii_phy2: ethernet-phy@2 {
+ compatible = "marvell,88e1118";
+ reg = <0x2>;
+ marvell,reg-init =
+ <3 0x11 0 0x4415>, /* Reg 3,17 */
+ <3 0x10 0 0x77>; /* Reg 3,16 */
+ };
+};
+
+&qspi {
+ bus-num = <0>;
+ fsl,spi-num-chipselects = <2>;
+ fsl,spi-flash-chipselects = <0>;
+ fsl,qspi-has-second-chip;
+ status = "okay";
+
+ flash: flash@0 {
+ compatible = "spansion,s25fl064l", "spansion,s25fl164k";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ spi-max-frequency = <20000000>;
+ reg = <0>;
+
+ partitions@0 {
+ label = "U-Boot";
+ reg = <0x0 0x180000>;
+ };
+
+ partitions@180000 {
+ label = "U-Boot Env";
+ reg = <0x180000 0x680000>;
+ };
+ };
+};
+
+&sata {
+ status = "okay";
+};
+
+&uart0 {
+ status = "okay";
+};
+
+&uart1 {
+ status = "okay";
+};
--
2.15.1
^ permalink raw reply related
* Re: [PATCH 05/25] arm: imx: dts: Remove leading 0x and 0s from bindings notation
From: Shawn Guo @ 2017-12-26 4:17 UTC (permalink / raw)
To: Mathieu Malaterre
Cc: Mark Rutland, Andrew Lunn, Heiko Stuebner, Tony Lindgren,
Sekhar Nori, linux-kernel, Matthias Brugger, Alexandre Belloni,
linux-arm-kernel, Baoyou Xie, Jason Cooper, Jesper Nilsson,
Florian Fainelli, Kevin Hilman, Viresh Kumar, Russell King,
Krzysztof Kozlowski, linux-samsung-soc, Alexandre Torgue,
Kukjin Kim, bcm-kernel-feedback-list, Niklas Cassel,
linux-rockchip, Sebastian Hesselbarth <sebastian>
In-Reply-To: <20171215111620.20379-5-malat@debian.org>
On Fri, Dec 15, 2017 at 12:15:55PM +0100, Mathieu Malaterre wrote:
> Improve the DTS files by removing all the leading "0x" and zeros to fix the
> following dtc warnings:
>
> Warning (unit_address_format): Node /XXX unit name should not have leading "0x"
>
> and
>
> Warning (unit_address_format): Node /XXX unit name should not have leading 0s
>
> Converted using the following command:
>
> find . -type f \( -iname *.dts -o -iname *.dtsi \) -exec sed -i -e "s/@\([0-9a-fA-FxX\.;:#]+\)\s*{/@\L\1 {/g" -e "s/@0x\(.*\) {/@\1 {/g" -e "s/@0+\(.*\) {/@\1 {/g" {} +^C
>
> For simplicity, two sed expressions were used to solve each warnings separately.
>
> To make the regex expression more robust a few other issues were resolved,
> namely setting unit-address to lower case, and adding a whitespace before the
> the opening curly brace:
>
> https://elinux.org/Device_Tree_Linux#Linux_conventions
>
> This will solve as a side effect warning:
>
> Warning (simple_bus_reg): Node /XXX@<UPPER> simple-bus unit address format error, expected "<lower>"
>
> This is a follow up to commit 4c9847b7375a ("dt-bindings: Remove leading 0x from bindings notation")
>
> Reported-by: David Daney <ddaney@caviumnetworks.com>
> Suggested-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> ---
> arch/arm/boot/dts/imx6q-display5.dtsi | 2 +-
> arch/arm/boot/dts/imx7d.dtsi | 2 +-
> arch/arm/boot/dts/imx7s.dtsi | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/boot/dts/imx6q-display5.dtsi b/arch/arm/boot/dts/imx6q-display5.dtsi
> index 4084de43d4d9..09085fde3341 100644
> --- a/arch/arm/boot/dts/imx6q-display5.dtsi
> +++ b/arch/arm/boot/dts/imx6q-display5.dtsi
> @@ -255,7 +255,7 @@
> pinctrl-0 = <&pinctrl_i2c1>;
> status = "okay";
>
> - codec: tfa9879@6C {
> + codec: tfa9879@6c {
> #sound-dai-cells = <0>;
> compatible = "nxp,tfa9879";
> reg = <0x6C>;
> diff --git a/arch/arm/boot/dts/imx7d.dtsi b/arch/arm/boot/dts/imx7d.dtsi
> index 4d308d17f040..369d5a166b3e 100644
> --- a/arch/arm/boot/dts/imx7d.dtsi
> +++ b/arch/arm/boot/dts/imx7d.dtsi
> @@ -129,7 +129,7 @@
> status = "disabled";
> };
>
> - pcie: pcie@0x33800000 {
> + pcie: pcie@33800000 {
> compatible = "fsl,imx7d-pcie", "snps,dw-pcie";
> reg = <0x33800000 0x4000>,
> <0x4ff00000 0x80000>;
> diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
> index 82ad26e766eb..a00ba897e58d 100644
> --- a/arch/arm/boot/dts/imx7s.dtsi
> +++ b/arch/arm/boot/dts/imx7s.dtsi
> @@ -583,7 +583,7 @@
> #address-cells = <1>;
> #size-cells = <0>;
>
> - pgc_pcie_phy: pgc-power-domain@IMX7_POWER_DOMAIN_PCIE_PHY {
> + pgc_pcie_phy: pgc-power-domain@imx7_power_domain_pcie_phy {
I think this is broken, as IMX7_POWER_DOMAIN_PCIE_PHY is a define here.
Shawn
> #power-domain-cells = <0>;
> reg = <IMX7_POWER_DOMAIN_PCIE_PHY>;
> power-supply = <®_1p0d>;
> --
> 2.11.0
>
^ permalink raw reply
* Re: [PATCH 00/20] Add Hummingboard 2 support
From: Shawn Guo @ 2017-12-26 4:05 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Fabio Estevam, Sascha Hauer, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Mark Rutland,
Rob Herring
In-Reply-To: <20171211165631.GW10595-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
On Mon, Dec 11, 2017 at 04:56:31PM +0000, Russell King - ARM Linux wrote:
> Hi,
>
> This series adds the long awaited Hummingboard 2 support to the
> mainline kernel.
>
> While I could squash the patch set down, I've not done this because
> this is the result of several different people over the course of
> the last couple of years, and I believe it's not right to lose the
> detail of their contributions.
>
> This builds upon the previous set of changes for the Hummingboard,
> which re-organised the way we deal with the uSOM and baseboards.
>
> arch/arm/boot/dts/Makefile | 6 +
> .../boot/dts/imx6dl-hummingboard2-emmc-som-v15.dts | 55 +++
> arch/arm/boot/dts/imx6dl-hummingboard2-som-v15.dts | 54 +++
> arch/arm/boot/dts/imx6dl-hummingboard2.dts | 53 ++
> .../boot/dts/imx6q-hummingboard2-emmc-som-v15.dts | 63 +++
> arch/arm/boot/dts/imx6q-hummingboard2-som-v15.dts | 62 +++
> arch/arm/boot/dts/imx6q-hummingboard2.dts | 61 +++
> arch/arm/boot/dts/imx6qdl-hummingboard2-emmc.dtsi | 72 +++
> arch/arm/boot/dts/imx6qdl-hummingboard2.dtsi | 540 +++++++++++++++++++++
> 9 files changed, 966 insertions(+)
Applied all, thanks.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v2] ARM: dts: ls1021a: add support for Moxa UC-8410A open platform
From: Shawn Guo @ 2017-12-26 3:55 UTC (permalink / raw)
To: SZ Lin
Cc: Jimmy Chen, Harry YJ Jhou, Rob Herring, Mark Rutland,
Russell King, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20171211115126.14553-1-sz.lin-D4fb9hXD9d4@public.gmane.org>
On Mon, Dec 11, 2017 at 07:51:25PM +0800, SZ Lin wrote:
> Add support for Moxa UC-8410A open platform
>
> The UC-8410A computing platform is designed
> for embedded communication-centric industrial applications
>
> The features of UC-8410A are:
> * QSPI flash
> * SD slot
> * 3x LAN
> * 8x RS-232/422/485 ports, software-selectable
> * Mini PCIe form factor with PCIe/USB signal
> * 2x USB host
> * TPM
> * Watchdog
> * RTC
> * User LEDs
> * Beeper
> * Push button
>
> Signed-off-by: Jimmy Chen <jimmy.chen-D4fb9hXD9d4@public.gmane.org>
> Signed-off-by: Harry YJ Jhou <harryyj.jhou-D4fb9hXD9d4@public.gmane.org>
> Signed-off-by: SZ Lin <sz.lin-D4fb9hXD9d4@public.gmane.org>
>
> --
> Changes from v1:
> - Add newline between nodes
> - Add push button node
> - Insert newline between property list and child node
> - Include file of "include/dt-bindings/gpio/gpio.h"
> - Include file of "include/dt-bindings/input/input.h"
> - Use polartiy defines for gpios to make it more readable
> - Put 'status' at the end of property list
> - Change GPIO pin number in cel_pwr and cel_reset
> - Sort the labeled node alphabetically
> - Drop container node of regulator and put fixed regulator directly
> under root
> ---
> arch/arm/boot/dts/Makefile | 1 +
> arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts | 241 ++++++++++++++++++++++++++++
> 2 files changed, 242 insertions(+)
> create mode 100644 arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts
>
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index d0381e9caf21..62ce9b27ad30 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -520,6 +520,7 @@ dtb-$(CONFIG_SOC_IMX7D) += \
> imx7s-colibri-eval-v3.dtb \
> imx7s-warp.dtb
> dtb-$(CONFIG_SOC_LS1021A) += \
> + ls1021a-moxa-uc-8410a.dtb \
> ls1021a-qds.dtb \
> ls1021a-twr.dtb
> dtb-$(CONFIG_SOC_VF610) += \
> diff --git a/arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts b/arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts
> new file mode 100644
> index 000000000000..bc73b5187990
> --- /dev/null
> +++ b/arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts
> @@ -0,0 +1,241 @@
> +/*
> + * Copyright (C) 2017 Moxa Inc. - https://www.moxa.com/
> + *
> + * Author: Harry YJ Jhou (周亞諄) <harryyj.jhou-D4fb9hXD9d4@public.gmane.org>
> + * Jimmy Chen (陳永達) <jimmy.chen-D4fb9hXD9d4@public.gmane.org>
> + * SZ Lin (林上智) <sz.lin-D4fb9hXD9d4@public.gmane.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +/dts-v1/;
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +#include "ls1021a.dtsi"
> +
> +/ {
> + model = "Moxa UC-8410A";
> +
> + aliases {
> + enet0_rgmii_phy = &rgmii_phy0;
> + enet1_rgmii_phy = &rgmii_phy1;
> + enet2_rgmii_phy = &rgmii_phy2;
> + };
> +
> + sys_mclk: clock-mclk {
> + compatible = "fixed-clock";
> + #clock-cells = <0>;
> + clock-frequency = <24576000>;
> + };
> +
> + reg_3p3v: regulator-3p3v {
> + compatible = "regulator-fixed";
> + regulator-name = "3P3V";
> + regulator-min-microvolt = <3300000>;
> + regulator-max-microvolt = <3300000>;
> + regulator-always-on;
> + };
> +
> + leds {
> + compatible = "gpio-leds";
> +
> + cel_pwr {
We generally use hyphen rather than underscore in node name.
> + label = "UC8410A:CEL-PWR";
> + gpios = <&gpio3 27 GPIO_ACTIVE_LOW>;
> + default-state = "off";
> + };
> +
> + cel_reset {
> + label = "UC8410A:CEL-RESET";
> + gpios = <&gpio3 28 GPIO_ACTIVE_LOW>;
> + default-state = "off";
> + };
> +
> + str_led {
> + label = "UC8410A:RED:PROG";
> + gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
> + linux,default-trigger = "mmc0";
> + };
> +
> + sw_ready {
> + label = "UC8410A:GREEN:SWRDY";
> + gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>;
> + default-state = "on";
> + };
> +
> + beeper {
> + label = "UC8410A:BEEP";
> + gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> +
> + prog_led0 {
> + label = "UC8410A:GREEN:PROG2";
> + gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> +
> + prog_led1 {
> + label = "UC8410A:GREEN:PROG1";
> + gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> +
> + prog_led2 {
> + label = "UC8410A:GREEN:PROG0";
> + gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> +
> + wifi_signal0 {
> + label = "UC8410A:GREEN:CEL2";
> + gpios = <&gpio3 17 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> +
> + wifi_signal1 {
> + label = "UC8410A:GREEN:CEL1";
> + gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> +
> + wifi_signal2 {
> + label = "UC8410A:GREEN:CEL0";
> + gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> +
> + cpu_diag_red {
> + label = "UC8410A:RED:DIA";
> + gpios = <&gpio3 20 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> +
> + cpu_diag_green {
> + label = "UC8410A:GREEN:DIA";
> + gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> +
> + cpu_diag_yellow {
> + label = "UC8410A:YELLOW:DIA";
> + gpios = <&gpio3 22 GPIO_ACTIVE_HIGH>;
> + default-state = "off";
> + };
> + };
> +
> + gpio-keys {
> + compatible = "gpio-keys";
> +
> + pushbtn-key {
> + label = "push button key";
> + gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
> + linux,code = <BTN_MISC>;
> + default-state = "on";
> + };
> + };
> +};
> +
> +&enet0 {
> + phy-handle = <&rgmii_phy0>;
> + phy-connection-type = "rgmii-id";
> + status = "okay";
> +};
> +
> +&enet1 {
> + phy-handle = <&rgmii_phy1>;
> + phy-connection-type = "rgmii-id";
> + status = "okay";
> +};
> +
> +&enet2 {
> + phy-handle = <&rgmii_phy2>;
> + phy-connection-type = "rgmii-id";
> + status = "okay";
> +};
> +
> +&i2c0 {
> + clock-frequency = <100000>;
> + status = "okay";
> +
> + rtc {
Nodes with 'reg' property should have a match unit-address after node name.
> + compatible = "dallas,ds1374";
> + reg = <0x68>;
> + };
> +
> + tpm {
Sort nodes with unit-address in order of the address.
> + compatible = "infineon,slb9635tt";
> + reg = <0x20>;
> + };
> +};
> +
> +&lpuart0 {
> + status = "okay";
> +};
> +
> +&mdio0 {
> + rgmii_phy0: ethernet-phy@0 {
> + compatible = "marvell,88e1118";
> + reg = <0x0>;
> + marvell,reg-init =
> + <3 0x11 0 0x4415>, /* Reg 3,17 */
> + <3 0x10 0 0x77>; /* Reg 3,16 */
> + };
> +
> + rgmii_phy1: ethernet-phy@1 {
> + compatible = "marvell,88e1118";
> + reg = <0x1>;
> + marvell,reg-init =
> + <3 0x11 0 0x4415>, /* Reg 3,17 */
> + <3 0x10 0 0x77>; /* Reg 3,16 */
> + };
> +
> + rgmii_phy2: ethernet-phy@2 {
> + compatible = "marvell,88e1118";
> + reg = <0x2>;
> + marvell,reg-init =
> + <3 0x11 0 0x4415>, /* Reg 3,17 */
> + <3 0x10 0 0x77>; /* Reg 3,16 */
> + };
> +};
> +
> +&qspi {
> + bus-num = <0>;
> + fsl,spi-num-chipselects = <2>;
> + fsl,spi-flash-chipselects = <0>;
> + fsl,qspi-has-second-chip;
> + status = "okay";
> +
> + flash: flash@0 {
> + compatible = "spansion,s25fl064l", "spansion,s25fl164k";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + spi-max-frequency = <20000000>;
> + reg = <0>;
> +
> + partitions@0 {
> + label = "U-Boot";
> + reg = <0x0 0x180000>;
> + };
> +
> + partitions@1 {
The unit-address doesn't match 'reg' property.
Shawn
> + label = "U-Boot Env";
> + reg = <0x180000 0x680000>;
> + };
> + };
> +};
> +
> +&sata {
> + status = "okay";
> +};
> +
> +&uart0 {
> + status = "okay";
> +};
> +
> +&uart1 {
> + status = "okay";
> +};
> --
> 2.15.1
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH] Input: mms114 - drop platform data and use generic APIs
From: Simon Shields @ 2017-12-26 3:25 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Andi Shyti, linux-input, devicetree, Simon Shields
The MMS114 platform data has no in-tree users, so drop it,
and make the driver depend on CONFIG_OF.
Switch to using the standard touchscreen properties via
touchscreen_parse_properties(), and move the old DT parsing code
to use device_property_*() APIs.
Finally, use touchscreen_report_pos to report x/y coordinates
and drop the custom x/y inversion code.
Signed-off-by: Simon Shields <simon@lineageos.org>
---
.../bindings/input/touchscreen/mms114.txt | 29 ++--
drivers/input/touchscreen/Kconfig | 1 +
drivers/input/touchscreen/mms114.c | 146 +++++++++------------
include/linux/platform_data/mms114.h | 24 ----
4 files changed, 77 insertions(+), 123 deletions(-)
delete mode 100644 include/linux/platform_data/mms114.h
diff --git a/Documentation/devicetree/bindings/input/touchscreen/mms114.txt b/Documentation/devicetree/bindings/input/touchscreen/mms114.txt
index 89d4c56c5671..8f9f9f38eff4 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/mms114.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/mms114.txt
@@ -4,14 +4,18 @@ Required properties:
- compatible: must be "melfas,mms114"
- reg: I2C address of the chip
- interrupts: interrupt to which the chip is connected
-- x-size: horizontal resolution of touchscreen
-- y-size: vertical resolution of touchscreen
+- touchscreen-size-x: See [1]
+- touchscreen-size-y: See [1]
Optional properties:
-- contact-threshold:
-- moving-threshold:
-- x-invert: invert X axis
-- y-invert: invert Y axis
+- touchscreen-fuzz-x: See [1]
+- touchscreen-fuzz-y: See [1]
+- touchscreen-fuzz-pressure: See [1]
+- touchscreen-inverted-x: See [1]
+- touchscreen-inverted-y: See [1]
+- touchscreen-swapped-x-y: See [1]
+
+[1]: Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
Example:
@@ -22,12 +26,13 @@ Example:
compatible = "melfas,mms114";
reg = <0x48>;
interrupts = <39 0>;
- x-size = <720>;
- y-size = <1280>;
- contact-threshold = <10>;
- moving-threshold = <10>;
- x-invert;
- y-invert;
+ touchscreen-size-x = <720>;
+ touchscreen-size-y = <1280>;
+ touchscreen-fuzz-x = <10>;
+ touchscreen-fuzz-y = <10>;
+ touchscreen-fuzz-pressure = <10>;
+ touchscreen-inverted-x;
+ touchscreen-inverted-y;
};
/* ... */
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 38a226f9fcbd..f7ea5522ef91 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -524,6 +524,7 @@ config TOUCHSCREEN_MCS5000
config TOUCHSCREEN_MMS114
tristate "MELFAS MMS114 touchscreen"
depends on I2C
+ depends on OF
help
Say Y here if you have the MELFAS MMS114 touchscreen controller
chip in your system.
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c
index e5eeb6311f7d..2ca22faa10aa 100644
--- a/drivers/input/touchscreen/mms114.c
+++ b/drivers/input/touchscreen/mms114.c
@@ -12,8 +12,8 @@
#include <linux/of.h>
#include <linux/i2c.h>
#include <linux/input/mt.h>
+#include <linux/input/touchscreen.h>
#include <linux/interrupt.h>
-#include <linux/platform_data/mms114.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
@@ -55,7 +55,9 @@ struct mms114_data {
struct input_dev *input_dev;
struct regulator *core_reg;
struct regulator *io_reg;
- const struct mms114_platform_data *pdata;
+ struct touchscreen_properties props;
+ unsigned int contact_threshold;
+ unsigned int moving_threshold;
/* Use cache data for mode control register(write only) */
u8 cache_mode_control;
@@ -143,7 +145,6 @@ static int mms114_write_reg(struct mms114_data *data, unsigned int reg,
static void mms114_process_mt(struct mms114_data *data, struct mms114_touch *touch)
{
- const struct mms114_platform_data *pdata = data->pdata;
struct i2c_client *client = data->client;
struct input_dev *input_dev = data->input_dev;
unsigned int id;
@@ -163,16 +164,6 @@ static void mms114_process_mt(struct mms114_data *data, struct mms114_touch *tou
id = touch->id - 1;
x = touch->x_lo | touch->x_hi << 8;
y = touch->y_lo | touch->y_hi << 8;
- if (x > pdata->x_size || y > pdata->y_size) {
- dev_dbg(&client->dev,
- "Wrong touch coordinates (%d, %d)\n", x, y);
- return;
- }
-
- if (pdata->x_invert)
- x = pdata->x_size - x;
- if (pdata->y_invert)
- y = pdata->y_size - y;
dev_dbg(&client->dev,
"id: %d, type: %d, pressed: %d, x: %d, y: %d, width: %d, strength: %d\n",
@@ -183,9 +174,8 @@ static void mms114_process_mt(struct mms114_data *data, struct mms114_touch *tou
input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, touch->pressed);
if (touch->pressed) {
+ touchscreen_report_pos(input_dev, &data->props, x, y, true);
input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, touch->width);
- input_report_abs(input_dev, ABS_MT_POSITION_X, x);
- input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
input_report_abs(input_dev, ABS_MT_PRESSURE, touch->strength);
}
}
@@ -263,7 +253,7 @@ static int mms114_get_version(struct mms114_data *data)
static int mms114_setup_regs(struct mms114_data *data)
{
- const struct mms114_platform_data *pdata = data->pdata;
+ const struct touchscreen_properties *props = &data->props;
int val;
int error;
@@ -275,32 +265,32 @@ static int mms114_setup_regs(struct mms114_data *data)
if (error < 0)
return error;
- val = (pdata->x_size >> 8) & 0xf;
- val |= ((pdata->y_size >> 8) & 0xf) << 4;
+ val = (props->max_x >> 8) & 0xf;
+ val |= ((props->max_y >> 8) & 0xf) << 4;
error = mms114_write_reg(data, MMS114_XY_RESOLUTION_H, val);
if (error < 0)
return error;
- val = pdata->x_size & 0xff;
+ val = props->max_x & 0xff;
error = mms114_write_reg(data, MMS114_X_RESOLUTION, val);
if (error < 0)
return error;
- val = pdata->y_size & 0xff;
+ val = props->max_x & 0xff;
error = mms114_write_reg(data, MMS114_Y_RESOLUTION, val);
if (error < 0)
return error;
- if (pdata->contact_threshold) {
+ if (data->contact_threshold) {
error = mms114_write_reg(data, MMS114_CONTACT_THRESHOLD,
- pdata->contact_threshold);
+ data->contact_threshold);
if (error < 0)
return error;
}
- if (pdata->moving_threshold) {
+ if (data->moving_threshold) {
error = mms114_write_reg(data, MMS114_MOVING_THRESHOLD,
- pdata->moving_threshold);
+ data->moving_threshold);
if (error < 0)
return error;
}
@@ -335,9 +325,6 @@ static int mms114_start(struct mms114_data *data)
return error;
}
- if (data->pdata->cfg_pin)
- data->pdata->cfg_pin(true);
-
enable_irq(client->irq);
return 0;
@@ -350,9 +337,6 @@ static void mms114_stop(struct mms114_data *data)
disable_irq(client->irq);
- if (data->pdata->cfg_pin)
- data->pdata->cfg_pin(false);
-
error = regulator_disable(data->io_reg);
if (error)
dev_warn(&client->dev, "Failed to disable vdd: %d\n", error);
@@ -376,67 +360,43 @@ static void mms114_input_close(struct input_dev *dev)
mms114_stop(data);
}
-#ifdef CONFIG_OF
-static struct mms114_platform_data *mms114_parse_dt(struct device *dev)
+static int mms114_parse_dt(struct mms114_data *data)
{
- struct mms114_platform_data *pdata;
- struct device_node *np = dev->of_node;
-
- if (!np)
- return NULL;
+ struct device *dev = &data->client->dev;
+ struct touchscreen_properties *props = &data->props;
- pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata) {
- dev_err(dev, "failed to allocate platform data\n");
- return NULL;
+ if (device_property_read_u32(dev, "x-size", &props->max_x)) {
+ dev_dbg(dev, "failed to get legacy x-size property\n");
+ return -EINVAL;
}
- if (of_property_read_u32(np, "x-size", &pdata->x_size)) {
- dev_err(dev, "failed to get x-size property\n");
- return NULL;
+ if (device_property_read_u32(dev, "y-size", &props->max_y)) {
+ dev_dbg(dev, "failed to get legacy y-size property\n");
+ return -EINVAL;
}
- if (of_property_read_u32(np, "y-size", &pdata->y_size)) {
- dev_err(dev, "failed to get y-size property\n");
- return NULL;
- }
+ device_property_read_u32(dev, "contact-threshold",
+ &data->contact_threshold);
+ device_property_read_u32(dev, "moving-threshold",
+ &data->moving_threshold);
- of_property_read_u32(np, "contact-threshold",
- &pdata->contact_threshold);
- of_property_read_u32(np, "moving-threshold",
- &pdata->moving_threshold);
+ if (device_property_read_bool(dev, "x-invert"))
+ props->invert_x = true;
+ if (device_property_read_bool(dev, "y-invert"))
+ props->invert_y = true;
- if (of_find_property(np, "x-invert", NULL))
- pdata->x_invert = true;
- if (of_find_property(np, "y-invert", NULL))
- pdata->y_invert = true;
+ props->swap_x_y = false;
- return pdata;
-}
-#else
-static inline struct mms114_platform_data *mms114_parse_dt(struct device *dev)
-{
- return NULL;
+ return 0;
}
-#endif
static int mms114_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- const struct mms114_platform_data *pdata;
struct mms114_data *data;
struct input_dev *input_dev;
int error;
- pdata = dev_get_platdata(&client->dev);
- if (!pdata)
- pdata = mms114_parse_dt(&client->dev);
-
- if (!pdata) {
- dev_err(&client->dev, "Need platform data\n");
- return -EINVAL;
- }
-
if (!i2c_check_functionality(client->adapter,
I2C_FUNC_PROTOCOL_MANGLING)) {
dev_err(&client->dev,
@@ -453,8 +413,33 @@ static int mms114_probe(struct i2c_client *client,
}
data->client = client;
+
+ input_set_capability(input_dev, EV_KEY, BTN_TOUCH);
+ input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_X);
+ input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_Y);
+ input_set_capability(input_dev, EV_ABS, ABS_MT_PRESSURE);
+ input_set_capability(input_dev, EV_ABS, ABS_MT_TOUCH_MAJOR);
+
+ input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 255, 0, 0);
+
+ if (mms114_parse_dt(data) < 0) {
+ /* No valid legacy binding found, try the common one */
+ touchscreen_parse_properties(input_dev, true, &data->props);
+
+ /* The firmware handles movement and pressure fuzz, so
+ * don't duplicate that in software.
+ */
+ data->moving_threshold =
+ input_dev->absinfo[ABS_MT_POSITION_X].fuzz;
+ data->contact_threshold =
+ input_dev->absinfo[ABS_MT_PRESSURE].fuzz;
+
+ input_dev->absinfo[ABS_MT_POSITION_X].fuzz = 0;
+ input_dev->absinfo[ABS_MT_POSITION_Y].fuzz = 0;
+ input_dev->absinfo[ABS_MT_PRESSURE].fuzz = 0;
+ }
+
data->input_dev = input_dev;
- data->pdata = pdata;
input_dev->name = "MELFAS MMS114 Touchscreen";
input_dev->id.bustype = BUS_I2C;
@@ -462,21 +447,10 @@ static int mms114_probe(struct i2c_client *client,
input_dev->open = mms114_input_open;
input_dev->close = mms114_input_close;
- __set_bit(EV_ABS, input_dev->evbit);
- __set_bit(EV_KEY, input_dev->evbit);
- __set_bit(BTN_TOUCH, input_dev->keybit);
- input_set_abs_params(input_dev, ABS_X, 0, data->pdata->x_size, 0, 0);
- input_set_abs_params(input_dev, ABS_Y, 0, data->pdata->y_size, 0, 0);
-
/* For multi touch */
input_mt_init_slots(input_dev, MMS114_MAX_TOUCH, 0);
input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
0, MMS114_MAX_AREA, 0, 0);
- input_set_abs_params(input_dev, ABS_MT_POSITION_X,
- 0, data->pdata->x_size, 0, 0);
- input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
- 0, data->pdata->y_size, 0, 0);
- input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 255, 0, 0);
input_set_drvdata(input_dev, data);
i2c_set_clientdata(client, data);
@@ -567,13 +541,11 @@ static const struct i2c_device_id mms114_id[] = {
};
MODULE_DEVICE_TABLE(i2c, mms114_id);
-#ifdef CONFIG_OF
static const struct of_device_id mms114_dt_match[] = {
{ .compatible = "melfas,mms114" },
{ }
};
MODULE_DEVICE_TABLE(of, mms114_dt_match);
-#endif
static struct i2c_driver mms114_driver = {
.driver = {
diff --git a/include/linux/platform_data/mms114.h b/include/linux/platform_data/mms114.h
deleted file mode 100644
index 5722ebfb2738..000000000000
--- a/include/linux/platform_data/mms114.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2012 Samsung Electronics Co.Ltd
- * Author: Joonyoung Shim <jy0922.shim@samsung.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundationr
- */
-
-#ifndef __LINUX_MMS114_H
-#define __LINUX_MMS114_H
-
-struct mms114_platform_data {
- unsigned int x_size;
- unsigned int y_size;
- unsigned int contact_threshold;
- unsigned int moving_threshold;
- bool x_invert;
- bool y_invert;
-
- void (*cfg_pin)(bool);
-};
-
-#endif /* __LINUX_MMS114_H */
--
2.15.1
^ permalink raw reply related
* Re: [PATCH net-next v8 1/2] dt-bindings: net: add DT bindings for Socionext UniPhier AVE
From: Florian Fainelli @ 2017-12-26 3:03 UTC (permalink / raw)
To: Kunihiko Hayashi, David Miller, netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Andrew Lunn, Rob Herring, Mark Rutland,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Masahiro Yamada,
Masami Hiramatsu, Jassi Brar
In-Reply-To: <1514164238-28901-2-git-send-email-hayashi.kunihiko-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
On December 24, 2017 5:10:37 PM PST, Kunihiko Hayashi <hayashi.kunihiko@socionext.com> wrote:
>DT bindings for the AVE ethernet controller found on Socionext's
>UniPhier platforms.
>
>Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
>Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
>Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [RFC PATCH v12 5/5] arm64: dts: rockchip: Move PCIe WAKE# irq to pcie port for Gru
From: Jeffy Chen @ 2017-12-26 2:36 UTC (permalink / raw)
To: linux-kernel, bhelgaas
Cc: linux-pm, tony, shawn.lin, briannorris, rjw, dianders, Jeffy Chen,
Matthias Kaehlcke, Heiko Stuebner, devicetree, Klaus Goger,
linux-rockchip, Rob Herring, linux-arm-kernel, Will Deacon,
Mark Rutland, Catalin Marinas
In-Reply-To: <20171226023646.17722-1-jeffy.chen@rock-chips.com>
Currently we are handling PCIe WAKE# irq in mrvl wifi driver.
Move it to rockchip pcie port since we are going to handle it in the
pci core.
Also avoid this irq been considered as the PCI interrupt pin in the
of_irq_parse_pci().
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
Changes in v13: None
Changes in v12: None
Changes in v11:
Move to pcie port as Brian suggested.
Changes in v10: None
Changes in v9:
Rewrite the commit message.
Changes in v8:
Rewrite the commit message.
Changes in v7: None
Changes in v6: None
Changes in v5:
Use "wakeup" instead of "wake"
Changes in v3: None
Changes in v2: None
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
index 03f195025390..be41d363efd8 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
@@ -719,15 +719,16 @@ ap_i2c_audio: &i2c8 {
#size-cells = <2>;
ranges;
+ interrupts-extended = <&pcie0 1>, <&gpio0 8 IRQ_TYPE_LEVEL_LOW>;
+ interrupt-names = "pci", "wakeup";
+ pinctrl-names = "default";
+ pinctrl-0 = <&wlan_host_wake_l>;
+ wakeup-source;
+
mvl_wifi: wifi@0,0 {
compatible = "pci1b4b,2b42";
reg = <0x83010000 0x0 0x00000000 0x0 0x00100000
0x83010000 0x0 0x00100000 0x0 0x00100000>;
- interrupt-parent = <&gpio0>;
- interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
- pinctrl-names = "default";
- pinctrl-0 = <&wlan_host_wake_l>;
- wakeup-source;
};
};
};
--
2.11.0
^ permalink raw reply related
* [RFC PATCH v12 4/5] PCI / PM: Add support for the PCIe WAKE# signal for OF
From: Jeffy Chen @ 2017-12-26 2:36 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
bhelgaas-hpIqsD4AKlfQT0dZR+AlfA
Cc: linux-pm-u79uwXL29TY76Z2rM5mHXA, tony-4v6yS6AI5VpBDgjK7y7TUQ,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw, rjw-LthD3rsA81gm4RdzfppkhA,
dianders-F7+t8E8rja9g9hUCZPvPmw, Jeffy Chen,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-pci-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Frank Rowand
In-Reply-To: <20171226023646.17722-1-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Add of_pci_setup_wake_irq() and of_pci_teardown_wake_irq() to handle
the PCIe WAKE# interrupt.
Also use the dedicated wakeirq infrastructure to simplify it.
And add pci-of.c to enable/disable the wakeup irq in noirq stage to
avoid possible irq storm.
Signed-off-by: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
Changes in v13:
Fix compiler error reported by kbuild test robot <fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Changes in v12:
Enable the wake irq in noirq stage to avoid possible irq storm.
Changes in v11:
Only support 1-per-device PCIe WAKE# pin as suggested.
Changes in v10:
Use device_set_wakeup_capable() instead of device_set_wakeup_enable(),
since dedicated wakeirq will be lost in device_set_wakeup_enable(false).
Changes in v9:
Fix check error in .cleanup().
Move dedicated wakeirq setup to setup() callback and use
device_set_wakeup_enable() to enable/disable.
Changes in v8:
Add pci-of.c and use platform_pm_ops to handle the PCIe WAKE# signal.
Changes in v7:
Move PCIE_WAKE handling into pci core.
Changes in v6:
Fix device_init_wake error handling, and add some comments.
Changes in v5:
Rebase.
Changes in v3:
Fix error handling.
Changes in v2:
Use dev_pm_set_dedicated_wake_irq.
drivers/of/of_pci_irq.c | 49 +++++++++++++++++++++++++++++++
drivers/pci/Makefile | 1 +
drivers/pci/pci-driver.c | 10 +++++++
drivers/pci/pci-of.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/of_pci.h | 9 ++++++
5 files changed, 144 insertions(+)
create mode 100644 drivers/pci/pci-of.c
diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c
index d39565d5477b..abec3a44853b 100644
--- a/drivers/of/of_pci_irq.c
+++ b/drivers/of/of_pci_irq.c
@@ -1,8 +1,57 @@
#include <linux/kernel.h>
#include <linux/of_pci.h>
#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
#include <linux/export.h>
+int of_pci_setup_wake_irq(struct pci_dev *pdev)
+{
+ struct pci_dev *ppdev;
+ struct device_node *dn;
+ int ret, irq;
+
+ /* Get the pci_dev of our parent. Hopefully it's a port. */
+ ppdev = pdev->bus->self;
+ /* Nope, it's a host bridge. */
+ if (!ppdev)
+ return 0;
+
+ dn = pci_device_to_OF_node(ppdev);
+ if (!dn)
+ return 0;
+
+ irq = of_irq_get_byname(dn, "wakeup");
+ if (irq == -EPROBE_DEFER) {
+ return irq;
+ } else if (irq < 0) {
+ /* Ignore other errors, since a missing wakeup is non-fatal. */
+ dev_info(&pdev->dev, "cannot get wakeup interrupt: %d\n", irq);
+ return 0;
+ }
+
+ device_init_wakeup(&pdev->dev, true);
+
+ ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, irq);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to set wake IRQ: %d\n", ret);
+ device_init_wakeup(&pdev->dev, false);
+ return ret;
+ }
+
+ /* Start out disabled to avoid irq storm */
+ dev_pm_disable_wake_irq(&pdev->dev);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(of_pci_setup_wake_irq);
+
+void of_pci_teardown_wake_irq(struct pci_dev *pdev)
+{
+ dev_pm_clear_wake_irq(&pdev->dev);
+ device_init_wakeup(&pdev->dev, false);
+}
+EXPORT_SYMBOL_GPL(of_pci_teardown_wake_irq);
+
/**
* of_irq_parse_pci - Resolve the interrupt for a PCI device
* @pdev: the device whose interrupt is to be resolved
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index c7819b973df7..d0182c82162a 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_PCI_IOV) += iov.o
# ACPI _DSM provided firmware instance and string name
#
obj-$(CONFIG_ACPI) += pci-acpi.o
+obj-$(CONFIG_OF) += pci-of.o
# SMBIOS provided firmware instance and labels
obj-$(CONFIG_PCI_LABEL) += pci-label.o
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index d79dbc377b9c..b4475ff35d97 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -17,6 +17,7 @@
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/cpu.h>
+#include <linux/of_pci.h>
#include <linux/pm_runtime.h>
#include <linux/suspend.h>
#include <linux/kexec.h>
@@ -421,10 +422,17 @@ static int pci_device_probe(struct device *dev)
if (error < 0)
return error;
+ error = of_pci_setup_wake_irq(pci_dev);
+ if (error < 0) {
+ pcibios_free_irq(pci_dev);
+ return error;
+ }
+
pci_dev_get(pci_dev);
if (pci_device_can_probe(pci_dev)) {
error = __pci_device_probe(drv, pci_dev);
if (error) {
+ of_pci_teardown_wake_irq(pci_dev);
pcibios_free_irq(pci_dev);
pci_dev_put(pci_dev);
}
@@ -438,6 +446,8 @@ static int pci_device_remove(struct device *dev)
struct pci_dev *pci_dev = to_pci_dev(dev);
struct pci_driver *drv = pci_dev->driver;
+ of_pci_teardown_wake_irq(pci_dev);
+
if (drv) {
if (drv->remove) {
pm_runtime_get_sync(dev);
diff --git a/drivers/pci/pci-of.c b/drivers/pci/pci-of.c
new file mode 100644
index 000000000000..ad413b2de508
--- /dev/null
+++ b/drivers/pci/pci-of.c
@@ -0,0 +1,75 @@
+/*
+ * File: pci-of.c
+ * Purpose: Provide PCI PM/wakeup support in OF systems
+ *
+ * Copyright (C) 2017 Google, Inc.
+ * Brian Norris <briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
+ *
+ * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
+ * Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include <linux/acpi.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/pm_wakeirq.h>
+#include "pci.h"
+
+static bool of_pci_power_manageable(struct pci_dev *dev)
+{
+ return false;
+}
+
+static int of_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
+{
+ return -ENOSYS;
+}
+
+static pci_power_t of_pci_get_power_state(struct pci_dev *dev)
+{
+ return PCI_UNKNOWN;
+}
+
+static pci_power_t of_pci_choose_state(struct pci_dev *pdev)
+{
+ return PCI_POWER_ERROR;
+}
+
+static int of_pci_wakeup(struct pci_dev *dev, bool enable)
+{
+ if (enable)
+ dev_pm_enable_wake_irq(&dev->dev);
+ else
+ dev_pm_disable_wake_irq(&dev->dev);
+ return 0;
+}
+
+static bool of_pci_need_resume(struct pci_dev *dev)
+{
+ return false;
+}
+
+static const struct pci_platform_pm_ops of_pci_platform_pm = {
+ .is_manageable = of_pci_power_manageable,
+ .set_state = of_pci_set_power_state,
+ .get_state = of_pci_get_power_state,
+ .choose_state = of_pci_choose_state,
+ .set_wakeup = of_pci_wakeup,
+ .need_resume = of_pci_need_resume,
+};
+
+static int __init of_pci_init(void)
+{
+ if (!acpi_disabled)
+ return 0;
+
+ pci_set_platform_pm(&of_pci_platform_pm);
+
+ return 0;
+}
+arch_initcall(of_pci_init);
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index bf588a05d0d0..80fe8ae3393e 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -10,6 +10,8 @@ struct of_phandle_args;
struct device_node;
#ifdef CONFIG_OF_PCI
+int of_pci_setup_wake_irq(struct pci_dev *pdev);
+void of_pci_teardown_wake_irq(struct pci_dev *pdev);
int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq);
struct device_node *of_pci_find_child_device(struct device_node *parent,
unsigned int devfn);
@@ -23,6 +25,13 @@ int of_pci_map_rid(struct device_node *np, u32 rid,
const char *map_name, const char *map_mask_name,
struct device_node **target, u32 *id_out);
#else
+static inline int of_pci_setup_wake_irq(struct pci_dev *pdev)
+{
+ return 0;
+}
+
+static void of_pci_teardown_wake_irq(struct pci_dev *pdev) { };
+
static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
{
return 0;
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [RFC PATCH v12 2/5] of/irq: Adjust of_pci_irq parsing for multiple interrupts
From: Jeffy Chen @ 2017-12-26 2:36 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
bhelgaas-hpIqsD4AKlfQT0dZR+AlfA
Cc: linux-pm-u79uwXL29TY76Z2rM5mHXA, tony-4v6yS6AI5VpBDgjK7y7TUQ,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw, rjw-LthD3rsA81gm4RdzfppkhA,
dianders-F7+t8E8rja9g9hUCZPvPmw, Jeffy Chen, Frank Rowand,
devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring
In-Reply-To: <20171226023646.17722-1-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Currently we are considering the first irq as the PCI interrupt pin,
but a PCI device may have multiple interrupts(e.g. PCIe WAKE# pin).
Only parse the PCI interrupt pin when the irq is unnamed or named as
"pci".
Signed-off-by: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
Changes in v13: None
Changes in v12: None
Changes in v11:
Address Brian's comments.
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v3: None
Changes in v2: None
drivers/of/of_pci_irq.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c
index 3a05568f65df..d39565d5477b 100644
--- a/drivers/of/of_pci_irq.c
+++ b/drivers/of/of_pci_irq.c
@@ -27,9 +27,25 @@ int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq
*/
dn = pci_device_to_OF_node(pdev);
if (dn) {
- rc = of_irq_parse_one(dn, 0, out_irq);
- if (!rc)
- return rc;
+ struct property *prop;
+ const char *name;
+ int index = 0;
+
+ of_property_for_each_string(dn, "interrupt-names", prop, name) {
+ if (!strcmp(name, "pci"))
+ break;
+ index++;
+ }
+
+ /*
+ * Only parse from DT if we have no "interrupt-names",
+ * or if we found an interrupt named "pci".
+ */
+ if (index == 0 || name) {
+ rc = of_irq_parse_one(dn, index, out_irq);
+ if (!rc)
+ return rc;
+ }
}
/* Ok, we don't, time to have fun. Let's start by building up an
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [RFC PATCH v12 1/5] dt-bindings: PCI: Add definition of PCIe WAKE# irq and PCI irq
From: Jeffy Chen @ 2017-12-26 2:36 UTC (permalink / raw)
To: linux-kernel, bhelgaas
Cc: linux-pm, tony, shawn.lin, briannorris, rjw, dianders, Jeffy Chen,
devicetree, linux-pci, Rob Herring, Mark Rutland
In-Reply-To: <20171226023646.17722-1-jeffy.chen@rock-chips.com>
We are going to handle PCIe WAKE# pin for PCI devices in the pci core,
so add definitions of the optional PCIe WAKE# pin for PCI devices.
Also add an definition of the optional PCI interrupt pin for PCI
devices to distinguish it from the PCIe WAKE# pin.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
Changes in v13: None
Changes in v12:
Only add irq definitions for PCI devices and rewrite the commit message.
Changes in v11: None
Changes in v10: None
Changes in v9:
Add section for PCI devices and rewrite the commit message.
Changes in v8:
Add optional "pci", and rewrite commit message.
Changes in v7: None
Changes in v6: None
Changes in v5:
Move to pci.txt
Changes in v3: None
Changes in v2: None
Documentation/devicetree/bindings/pci/pci.txt | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/pci/pci.txt b/Documentation/devicetree/bindings/pci/pci.txt
index c77981c5dd18..3045ac452f27 100644
--- a/Documentation/devicetree/bindings/pci/pci.txt
+++ b/Documentation/devicetree/bindings/pci/pci.txt
@@ -24,3 +24,13 @@ driver implementation may support the following properties:
unsupported link speed, for instance, trying to do training for
unsupported link speed, etc. Must be '4' for gen4, '3' for gen3, '2'
for gen2, and '1' for gen1. Any other values are invalid.
+
+PCI devices may support the following properties:
+
+- interrupts: Interrupt specifier for each name in interrupt-names.
+- interrupt-names:
+ May contain "wakeup" for PCIe WAKE# interrupt and "pci" for PCI interrupt.
+ The PCI devices may optionally include an 'interrupts' property that
+ represents the legacy PCI interrupt. And when we try to specify the PCIe
+ WAKE# pin, a corresponding 'interrupt-names' property is required to
+ distinguish them.
--
2.11.0
^ permalink raw reply related
* [RFC PATCH v12 0/5] PCI: rockchip: Move PCIe WAKE# handling into pci core
From: Jeffy Chen @ 2017-12-26 2:36 UTC (permalink / raw)
To: linux-kernel, bhelgaas
Cc: linux-pm, tony, shawn.lin, briannorris, rjw, dianders, Jeffy Chen,
Xinming Hu, linux-pci, Rob Herring, Catalin Marinas, Kalle Valo,
Heiko Stuebner, linux-rockchip, Nishant Sarmukadam, Will Deacon,
Matthias Kaehlcke, devicetree, Ganapathi Bhat, Frank Rowand,
Amitkumar Karwar, linux-arm-kernel, netdev, linux-wireless
Currently we are handling wake irq in mrvl wifi driver. Move it into
pci core.
Tested on my chromebook bob(with cros 4.4 kernel and mrvl wifi).
Changes in v13:
Fix compiler error reported by kbuild test robot <fengguang.wu@intel.com>
Changes in v12:
Only add irq definitions for PCI devices and rewrite the commit message.
Enable the wake irq in noirq stage to avoid possible irq storm.
Changes in v11:
Address Brian's comments.
Only support 1-per-device PCIe WAKE# pin as suggested.
Move to pcie port as Brian suggested.
Changes in v10:
Use device_set_wakeup_capable() instead of device_set_wakeup_enable(),
since dedicated wakeirq will be lost in device_set_wakeup_enable(false).
Changes in v9:
Add section for PCI devices and rewrite the commit message.
Fix check error in .cleanup().
Move dedicated wakeirq setup to setup() callback and use
device_set_wakeup_enable() to enable/disable.
Rewrite the commit message.
Changes in v8:
Add optional "pci", and rewrite commit message.
Add pci-of.c and use platform_pm_ops to handle the PCIe WAKE# signal.
Rewrite the commit message.
Changes in v7:
Move PCIE_WAKE handling into pci core.
Changes in v6:
Fix device_init_wake error handling, and add some comments.
Changes in v5:
Move to pci.txt
Rebase.
Use "wakeup" instead of "wake"
Changes in v3:
Fix error handling.
Changes in v2:
Use dev_pm_set_dedicated_wake_irq.
Jeffy Chen (5):
dt-bindings: PCI: Add definition of PCIe WAKE# irq and PCI irq
of/irq: Adjust of_pci_irq parsing for multiple interrupts
mwifiex: Disable wakeup irq handling for pcie
PCI / PM: Add support for the PCIe WAKE# signal for OF
arm64: dts: rockchip: Move PCIe WAKE# irq to pcie port for Gru
Documentation/devicetree/bindings/pci/pci.txt | 10 ++++
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 11 ++--
drivers/net/wireless/marvell/mwifiex/main.c | 4 ++
drivers/of/of_pci_irq.c | 71 +++++++++++++++++++++++--
drivers/pci/Makefile | 1 +
drivers/pci/pci-driver.c | 10 ++++
drivers/pci/pci-of.c | 75 +++++++++++++++++++++++++++
include/linux/of_pci.h | 9 ++++
8 files changed, 183 insertions(+), 8 deletions(-)
create mode 100644 drivers/pci/pci-of.c
--
2.11.0
^ permalink raw reply
* Re: [PATCH 1/2] [media] Add Rockchip RK1608 driver
From: 温暖 @ 2017-12-26 2:20 UTC (permalink / raw)
To: Philippe Ombredanne
Cc: Mauro Carvalho Chehab, Rob Herring, Mark Rutland, David S. Miller,
Greg Kroah-Hartman, rdunlap@infradead.org,
Linux Media Mailing List,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, LKML,
open list:ARM/Rockchip SoC..., Eddie Cai, Jacob Chen
In-Reply-To: <CAOFm3uGWgYs06NRrrjJSrvDG5ebR_K0y2e_qQeOALMSsNnpXsQ@mail.gmail.com>
[-- Attachment #1: Type: text/html, Size: 8366 bytes --]
^ permalink raw reply
* [RFC PATCH v12 5/5] arm64: dts: rockchip: Move PCIe WAKE# irq to pcie port for Gru
From: Jeffy Chen @ 2017-12-26 2:08 UTC (permalink / raw)
To: linux-kernel, bhelgaas
Cc: linux-pm, tony, shawn.lin, briannorris, rjw, dianders, Jeffy Chen,
Matthias Kaehlcke, devicetree, Enric Balletbo i Serra,
Heiko Stuebner, Klaus Goger, linux-rockchip, Rob Herring,
linux-arm-kernel, Will Deacon, Mark Rutland, Caesar Wang,
Catalin Marinas
In-Reply-To: <20171226020806.32710-1-jeffy.chen@rock-chips.com>
Currently we are handling PCIe WAKE# irq in mrvl wifi driver.
Move it to rockchip pcie port since we are going to handle it in the
pci core.
Also avoid this irq been considered as the PCI interrupt pin in the
of_irq_parse_pci().
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
Changes in v12: None
Changes in v11:
Move to pcie port as Brian suggested.
Changes in v10: None
Changes in v9:
Rewrite the commit message.
Changes in v8:
Rewrite the commit message.
Changes in v7: None
Changes in v6: None
Changes in v5:
Use "wakeup" instead of "wake"
Changes in v3: None
Changes in v2: None
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
index 03f195025390..be41d363efd8 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
@@ -719,15 +719,16 @@ ap_i2c_audio: &i2c8 {
#size-cells = <2>;
ranges;
+ interrupts-extended = <&pcie0 1>, <&gpio0 8 IRQ_TYPE_LEVEL_LOW>;
+ interrupt-names = "pci", "wakeup";
+ pinctrl-names = "default";
+ pinctrl-0 = <&wlan_host_wake_l>;
+ wakeup-source;
+
mvl_wifi: wifi@0,0 {
compatible = "pci1b4b,2b42";
reg = <0x83010000 0x0 0x00000000 0x0 0x00100000
0x83010000 0x0 0x00100000 0x0 0x00100000>;
- interrupt-parent = <&gpio0>;
- interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
- pinctrl-names = "default";
- pinctrl-0 = <&wlan_host_wake_l>;
- wakeup-source;
};
};
};
--
2.11.0
^ permalink raw reply related
* [RFC PATCH v12 4/5] PCI / PM: Add support for the PCIe WAKE# signal for OF
From: Jeffy Chen @ 2017-12-26 2:08 UTC (permalink / raw)
To: linux-kernel, bhelgaas
Cc: linux-pm, tony, shawn.lin, briannorris, rjw, dianders, Jeffy Chen,
devicetree, linux-pci, Rob Herring, Frank Rowand
In-Reply-To: <20171226020806.32710-1-jeffy.chen@rock-chips.com>
Add of_pci_setup_wake_irq() and of_pci_teardown_wake_irq() to handle
the PCIe WAKE# interrupt.
Also use the dedicated wakeirq infrastructure to simplify it.
And add pci-of.c to enable/disable the wakeup irq in noirq stage to
avoid possible irq storm.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
Changes in v12:
Enable the wake irq in noirq stage to avoid possible irq storm.
Changes in v11:
Only support 1-per-device PCIe WAKE# pin as suggested.
Changes in v10:
Use device_set_wakeup_capable() instead of device_set_wakeup_enable(),
since dedicated wakeirq will be lost in device_set_wakeup_enable(false).
Changes in v9:
Fix check error in .cleanup().
Move dedicated wakeirq setup to setup() callback and use
device_set_wakeup_enable() to enable/disable.
Changes in v8:
Add pci-of.c and use platform_pm_ops to handle the PCIe WAKE# signal.
Changes in v7:
Move PCIE_WAKE handling into pci core.
Changes in v6:
Fix device_init_wake error handling, and add some comments.
Changes in v5:
Rebase.
Changes in v3:
Fix error handling.
Changes in v2:
Use dev_pm_set_dedicated_wake_irq.
drivers/of/of_pci_irq.c | 52 +++++++++++++++++++++++++++++++++
drivers/pci/Makefile | 1 +
drivers/pci/pci-driver.c | 10 +++++++
drivers/pci/pci-of.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/of_pci.h | 9 ++++++
5 files changed, 147 insertions(+)
create mode 100644 drivers/pci/pci-of.c
diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c
index d39565d5477b..af7afe6cbce2 100644
--- a/drivers/of/of_pci_irq.c
+++ b/drivers/of/of_pci_irq.c
@@ -1,8 +1,60 @@
#include <linux/kernel.h>
#include <linux/of_pci.h>
#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
#include <linux/export.h>
+int of_pci_setup_wake_irq(struct pci_dev *pdev)
+{
+ struct pci_dev *ppdev;
+ struct device_node *dn;
+ int ret, irq;
+
+ /* Get the pci_dev of our parent. Hopefully it's a port. */
+ ppdev = pdev->bus->self;
+ /* Nope, it's a host bridge. */
+ if (!ppdev)
+ return 0;
+
+ dn = pci_device_to_OF_node(ppdev);
+ if (!dn)
+ return 0;
+
+ irq = of_irq_get_byname(dn, "wakeup");
+ if (irq == -EPROBE_DEFER) {
+ return irq;
+ } else if (irq < 0) {
+ /* Ignore other errors, since a missing wakeup is non-fatal. */
+ dev_info(&pdev->dev, "cannot get wakeup interrupt: %d\n", irq);
+ return 0;
+ }
+
+ device_init_wakeup(&pdev->dev, true);
+
+ ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, irq);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to set wake IRQ: %d\n", ret);
+ device_init_wakeup(&pdev->dev, false);
+ return ret;
+ }
+
+ /* Start out disabled to avoid irq storm */
+ dev_pm_disable_wake_irq(&pdev->dev);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(of_pci_setup_wake_irq);
+
+void of_pci_teardown_wake_irq(struct pci_dev *pdev)
+{
+ if (!pdev->dev.power.wakeirq)
+ return;
+
+ dev_pm_clear_wake_irq(&pdev->dev);
+ device_init_wakeup(&pdev->dev, false);
+}
+EXPORT_SYMBOL_GPL(of_pci_teardown_wake_irq);
+
/**
* of_irq_parse_pci - Resolve the interrupt for a PCI device
* @pdev: the device whose interrupt is to be resolved
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index c7819b973df7..d0182c82162a 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_PCI_IOV) += iov.o
# ACPI _DSM provided firmware instance and string name
#
obj-$(CONFIG_ACPI) += pci-acpi.o
+obj-$(CONFIG_OF) += pci-of.o
# SMBIOS provided firmware instance and labels
obj-$(CONFIG_PCI_LABEL) += pci-label.o
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index d79dbc377b9c..b4475ff35d97 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -17,6 +17,7 @@
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/cpu.h>
+#include <linux/of_pci.h>
#include <linux/pm_runtime.h>
#include <linux/suspend.h>
#include <linux/kexec.h>
@@ -421,10 +422,17 @@ static int pci_device_probe(struct device *dev)
if (error < 0)
return error;
+ error = of_pci_setup_wake_irq(pci_dev);
+ if (error < 0) {
+ pcibios_free_irq(pci_dev);
+ return error;
+ }
+
pci_dev_get(pci_dev);
if (pci_device_can_probe(pci_dev)) {
error = __pci_device_probe(drv, pci_dev);
if (error) {
+ of_pci_teardown_wake_irq(pci_dev);
pcibios_free_irq(pci_dev);
pci_dev_put(pci_dev);
}
@@ -438,6 +446,8 @@ static int pci_device_remove(struct device *dev)
struct pci_dev *pci_dev = to_pci_dev(dev);
struct pci_driver *drv = pci_dev->driver;
+ of_pci_teardown_wake_irq(pci_dev);
+
if (drv) {
if (drv->remove) {
pm_runtime_get_sync(dev);
diff --git a/drivers/pci/pci-of.c b/drivers/pci/pci-of.c
new file mode 100644
index 000000000000..ad413b2de508
--- /dev/null
+++ b/drivers/pci/pci-of.c
@@ -0,0 +1,75 @@
+/*
+ * File: pci-of.c
+ * Purpose: Provide PCI PM/wakeup support in OF systems
+ *
+ * Copyright (C) 2017 Google, Inc.
+ * Brian Norris <briannorris@chromium.org>
+ *
+ * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
+ * Jeffy Chen <jeffy.chen@rock-chips.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include <linux/acpi.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/pm_wakeirq.h>
+#include "pci.h"
+
+static bool of_pci_power_manageable(struct pci_dev *dev)
+{
+ return false;
+}
+
+static int of_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
+{
+ return -ENOSYS;
+}
+
+static pci_power_t of_pci_get_power_state(struct pci_dev *dev)
+{
+ return PCI_UNKNOWN;
+}
+
+static pci_power_t of_pci_choose_state(struct pci_dev *pdev)
+{
+ return PCI_POWER_ERROR;
+}
+
+static int of_pci_wakeup(struct pci_dev *dev, bool enable)
+{
+ if (enable)
+ dev_pm_enable_wake_irq(&dev->dev);
+ else
+ dev_pm_disable_wake_irq(&dev->dev);
+ return 0;
+}
+
+static bool of_pci_need_resume(struct pci_dev *dev)
+{
+ return false;
+}
+
+static const struct pci_platform_pm_ops of_pci_platform_pm = {
+ .is_manageable = of_pci_power_manageable,
+ .set_state = of_pci_set_power_state,
+ .get_state = of_pci_get_power_state,
+ .choose_state = of_pci_choose_state,
+ .set_wakeup = of_pci_wakeup,
+ .need_resume = of_pci_need_resume,
+};
+
+static int __init of_pci_init(void)
+{
+ if (!acpi_disabled)
+ return 0;
+
+ pci_set_platform_pm(&of_pci_platform_pm);
+
+ return 0;
+}
+arch_initcall(of_pci_init);
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index bf588a05d0d0..80fe8ae3393e 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -10,6 +10,8 @@ struct of_phandle_args;
struct device_node;
#ifdef CONFIG_OF_PCI
+int of_pci_setup_wake_irq(struct pci_dev *pdev);
+void of_pci_teardown_wake_irq(struct pci_dev *pdev);
int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq);
struct device_node *of_pci_find_child_device(struct device_node *parent,
unsigned int devfn);
@@ -23,6 +25,13 @@ int of_pci_map_rid(struct device_node *np, u32 rid,
const char *map_name, const char *map_mask_name,
struct device_node **target, u32 *id_out);
#else
+static inline int of_pci_setup_wake_irq(struct pci_dev *pdev)
+{
+ return 0;
+}
+
+static void of_pci_teardown_wake_irq(struct pci_dev *pdev) { };
+
static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
{
return 0;
--
2.11.0
^ permalink raw reply related
* [RFC PATCH v12 2/5] of/irq: Adjust of_pci_irq parsing for multiple interrupts
From: Jeffy Chen @ 2017-12-26 2:08 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
bhelgaas-hpIqsD4AKlfQT0dZR+AlfA
Cc: linux-pm-u79uwXL29TY76Z2rM5mHXA, tony-4v6yS6AI5VpBDgjK7y7TUQ,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw, rjw-LthD3rsA81gm4RdzfppkhA,
dianders-F7+t8E8rja9g9hUCZPvPmw, Jeffy Chen, Frank Rowand,
devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring
In-Reply-To: <20171226020806.32710-1-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Currently we are considering the first irq as the PCI interrupt pin,
but a PCI device may have multiple interrupts(e.g. PCIe WAKE# pin).
Only parse the PCI interrupt pin when the irq is unnamed or named as
"pci".
Signed-off-by: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
Changes in v12: None
Changes in v11:
Address Brian's comments.
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v3: None
Changes in v2: None
drivers/of/of_pci_irq.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c
index 3a05568f65df..d39565d5477b 100644
--- a/drivers/of/of_pci_irq.c
+++ b/drivers/of/of_pci_irq.c
@@ -27,9 +27,25 @@ int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq
*/
dn = pci_device_to_OF_node(pdev);
if (dn) {
- rc = of_irq_parse_one(dn, 0, out_irq);
- if (!rc)
- return rc;
+ struct property *prop;
+ const char *name;
+ int index = 0;
+
+ of_property_for_each_string(dn, "interrupt-names", prop, name) {
+ if (!strcmp(name, "pci"))
+ break;
+ index++;
+ }
+
+ /*
+ * Only parse from DT if we have no "interrupt-names",
+ * or if we found an interrupt named "pci".
+ */
+ if (index == 0 || name) {
+ rc = of_irq_parse_one(dn, index, out_irq);
+ if (!rc)
+ return rc;
+ }
}
/* Ok, we don't, time to have fun. Let's start by building up an
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [RFC PATCH v12 1/5] dt-bindings: PCI: Add definition of PCIe WAKE# irq and PCI irq
From: Jeffy Chen @ 2017-12-26 2:08 UTC (permalink / raw)
To: linux-kernel, bhelgaas
Cc: linux-pm, tony, shawn.lin, briannorris, rjw, dianders, Jeffy Chen,
devicetree, linux-pci, Rob Herring, Mark Rutland
In-Reply-To: <20171226020806.32710-1-jeffy.chen@rock-chips.com>
We are going to handle PCIe WAKE# pin for PCI devices in the pci core,
so add definitions of the optional PCIe WAKE# pin for PCI devices.
Also add an definition of the optional PCI interrupt pin for PCI
devices to distinguish it from the PCIe WAKE# pin.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
Changes in v12: None
Changes in v11:
Only add irq definitions for PCI devices and rewrite the commit message.
Changes in v10: None
Changes in v9:
Add section for PCI devices and rewrite the commit message.
Changes in v8:
Add optional "pci", and rewrite commit message.
Changes in v7: None
Changes in v6: None
Changes in v5:
Move to pci.txt
Changes in v3: None
Changes in v2: None
Documentation/devicetree/bindings/pci/pci.txt | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/pci/pci.txt b/Documentation/devicetree/bindings/pci/pci.txt
index c77981c5dd18..3045ac452f27 100644
--- a/Documentation/devicetree/bindings/pci/pci.txt
+++ b/Documentation/devicetree/bindings/pci/pci.txt
@@ -24,3 +24,13 @@ driver implementation may support the following properties:
unsupported link speed, for instance, trying to do training for
unsupported link speed, etc. Must be '4' for gen4, '3' for gen3, '2'
for gen2, and '1' for gen1. Any other values are invalid.
+
+PCI devices may support the following properties:
+
+- interrupts: Interrupt specifier for each name in interrupt-names.
+- interrupt-names:
+ May contain "wakeup" for PCIe WAKE# interrupt and "pci" for PCI interrupt.
+ The PCI devices may optionally include an 'interrupts' property that
+ represents the legacy PCI interrupt. And when we try to specify the PCIe
+ WAKE# pin, a corresponding 'interrupt-names' property is required to
+ distinguish them.
--
2.11.0
^ permalink raw reply related
* [RFC PATCH v12 0/5] PCI: rockchip: Move PCIe WAKE# handling into pci core
From: Jeffy Chen @ 2017-12-26 2:08 UTC (permalink / raw)
To: linux-kernel, bhelgaas
Cc: linux-pm, tony, shawn.lin, briannorris, rjw, dianders, Jeffy Chen,
Xinming Hu, linux-pci, Rob Herring, Catalin Marinas, Kalle Valo,
Enric Balletbo i Serra, Heiko Stuebner, linux-rockchip,
Nishant Sarmukadam, Will Deacon, Matthias Kaehlcke, devicetree,
Ganapathi Bhat, Frank Rowand, Amitkumar Karwar, linux-arm-kernel
Currently we are handling wake irq in mrvl wifi driver. Move it into
pci core.
Tested on my chromebook bob(with cros 4.4 kernel and mrvl wifi).
Changes in v12:
Enable the wake irq in noirq stage to avoid possible irq storm.
Changes in v11:
Only add irq definitions for PCI devices and rewrite the commit message.
Address Brian's comments.
Only support 1-per-device PCIe WAKE# pin as suggested.
Move to pcie port as Brian suggested.
Changes in v10:
Use device_set_wakeup_capable() instead of device_set_wakeup_enable(),
since dedicated wakeirq will be lost in device_set_wakeup_enable(false).
Changes in v9:
Add section for PCI devices and rewrite the commit message.
Fix check error in .cleanup().
Move dedicated wakeirq setup to setup() callback and use
device_set_wakeup_enable() to enable/disable.
Rewrite the commit message.
Changes in v8:
Add optional "pci", and rewrite commit message.
Add pci-of.c and use platform_pm_ops to handle the PCIe WAKE# signal.
Rewrite the commit message.
Changes in v7:
Move PCIE_WAKE handling into pci core.
Changes in v6:
Fix device_init_wake error handling, and add some comments.
Changes in v5:
Move to pci.txt
Rebase.
Use "wakeup" instead of "wake"
Changes in v3:
Fix error handling.
Changes in v2:
Use dev_pm_set_dedicated_wake_irq.
Jeffy Chen (5):
dt-bindings: PCI: Add definition of PCIe WAKE# irq and PCI irq
of/irq: Adjust of_pci_irq parsing for multiple interrupts
mwifiex: Disable wakeup irq handling for pcie
PCI / PM: Add support for the PCIe WAKE# signal for OF
arm64: dts: rockchip: Move PCIe WAKE# irq to pcie port for Gru
Documentation/devicetree/bindings/pci/pci.txt | 10 ++++
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 11 ++--
drivers/net/wireless/marvell/mwifiex/main.c | 4 ++
drivers/of/of_pci_irq.c | 74 ++++++++++++++++++++++++--
drivers/pci/Makefile | 1 +
drivers/pci/pci-driver.c | 10 ++++
drivers/pci/pci-of.c | 75 +++++++++++++++++++++++++++
include/linux/of_pci.h | 9 ++++
8 files changed, 186 insertions(+), 8 deletions(-)
create mode 100644 drivers/pci/pci-of.c
--
2.11.0
^ permalink raw reply
* Re: [PATCH v4 2/2] PCI: mediatek: Set up class type and vendor ID for MT7622
From: Honghui Zhang @ 2017-12-26 1:41 UTC (permalink / raw)
To: Ryder Lee
Cc: bhelgaas-hpIqsD4AKlfQT0dZR+AlfA,
matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-pci-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w,
eddie.huang-NuS5LvNUpcJWk0Htik3J/w, lorenzo.pieralisi-5wv7dgnIgG8,
hongkun.cao-NuS5LvNUpcJWk0Htik3J/w,
youlin.pei-NuS5LvNUpcJWk0Htik3J/w, yong.wu-NuS5LvNUpcJWk0Htik3J/w,
yt.shen-NuS5LvNUpcJWk0Htik3J/w, sean.wang-NuS5LvNUpcJWk0Htik3J/w,
xinping.qian-NuS5LvNUpcJWk0Htik3J/w
In-Reply-To: <1514197661.25015.9.camel@mtkswgap22>
On Mon, 2017-12-25 at 18:27 +0800, Ryder Lee wrote:
> On Fri, 2017-12-22 at 13:39 +0800, honghui.zhang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org wrote:
> > From: Honghui Zhang <honghui.zhang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> >
> > The hardware default value of IDs and class type is not correct,
> > fix that by setup the correct values before start up.
> >
> > Signed-off-by: Honghui Zhang <honghui.zhang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> > ---
> > drivers/pci/host/pcie-mediatek.c | 12 ++++++++++++
> > include/linux/pci_ids.h | 3 +++
> > 2 files changed, 15 insertions(+)
> >
> > diff --git a/drivers/pci/host/pcie-mediatek.c b/drivers/pci/host/pcie-mediatek.c
> > index fc29a9a..0ef33e4 100644
> > --- a/drivers/pci/host/pcie-mediatek.c
> > +++ b/drivers/pci/host/pcie-mediatek.c
> > @@ -74,6 +74,10 @@
> >
> > /* PCIe V2 per-port registers */
> > #define PCIE_MSI_VECTOR 0x0c0
> > +
> > +#define PCIE_CONF_ID 0x100
> > +#define PCIE_CONF_CLASS 0x104
> > +
> > #define PCIE_INT_MASK 0x420
> > #define INTX_MASK GENMASK(19, 16)
> > #define INTX_SHIFT 16
> > @@ -393,6 +397,14 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_port *port)
> > val |= PCIE_CSR_LTSSM_EN(port->slot) |
> > PCIE_CSR_ASPM_L1_EN(port->slot);
> > writel(val, pcie->base + PCIE_SYS_CFG_V2);
> > +
> > + /* Set up vendor ID and device ID for MT7622*/
> > + val = PCI_VENDOR_ID_MEDIATEK | (PCI_DEVICE_ID_MT7622 << 16);
> > + writel(val, port->base + PCIE_CONF_ID);
>
> IMHO, this is a general function so you can ignore "device ID for
> MT7622" here, but just make sure class code/vendor ID correct.
Hmm, this condition is only for MT7622 for now.
Well, host driver and framework does not cares about the device ID for
host bridge. I guess I can bypass the setting of device ID.
thanks.
>
> > + /* Set up class code for MT7622 */
> > + val = PCI_CLASS_BRIDGE_PCI << 16;
> > + writel(val, port->base + PCIE_CONF_CLASS);
> > }
> >
> > /* Assert all reset signals */
> > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> > index ab20dc5..000c5df 100644
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [RFC PATCH v11 4/5] PCI / PM: Add support for the PCIe WAKE# signal for OF
From: JeffyChen @ 2017-12-26 1:06 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: linux-kernel, bhelgaas, linux-pm, tony, shawn.lin, briannorris,
dianders, devicetree, linux-pci, Rob Herring, Frank Rowand
In-Reply-To: <9593014.U0c2JQdoEZ@aspire.rjw.lan>
Hi Rafael,
Thanks for your reply :)
On 12/26/2017 08:11 AM, Rafael J. Wysocki wrote:
>> >+
>> >+ dn = pci_device_to_OF_node(ppdev);
>> >+ if (!dn)
>> >+ return 0;
>> >+
>> >+ irq = of_irq_get_byname(dn, "wakeup");
> Why is this a property of the bridge and not of the device itself?
That is suggested by Brian, because in that way, the wakeup pin would
not "tied to what exact device is installed (or no device, if it's a slot)."
>
>> >+ if (irq == -EPROBE_DEFER)
> Braces here, please.
ok, will fix in the next version.
>
>> >+ return irq;
>> >+ /* Ignore other errors, since a missing wakeup is non-fatal. */
>> >+ else if (irq < 0) {
>> >+ dev_info(&pdev->dev, "cannot get wakeup interrupt: %d\n", irq);
>> >+ return 0;
>> >+ }
>> >+
>> >+ device_init_wakeup(&pdev->dev, true);
> Why do you call this before dev_pm_set_dedicated_wake_irq()?
hmmm, i thought so too, but it turns out the dedicated wake irq
framework requires device_init_wakeup(dev, true) before attach the wake irq:
int device_wakeup_attach_irq(struct device *dev,
struct wake_irq *wakeirq)
{
struct wakeup_source *ws;
ws = dev->power.wakeup;
if (!ws) {
dev_err(dev, "forgot to call device_init_wakeup?\n");
return -EINVAL;
>
>> >+
>> >+ ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, irq);
>> >+ if (ret < 0) {
>> >+ dev_err(&pdev->dev, "failed to set wake IRQ: %d\n", ret);
>> >+ device_init_wakeup(&pdev->dev, false);
>> >+ return ret;
>> >+ }
>> >+
> It would be more straightforward to call device_init_wakeup() here.
>
>> >+ return 0;
>> >+}
>> >+EXPORT_SYMBOL_GPL(of_pci_setup_wake_irq);
>> >+
>> >+void of_pci_teardown_wake_irq(struct pci_dev *pdev)
>> >+{
>> >+ if (!pdev->dev.power.wakeirq)
>> >+ return;
>> >+
>> >+ dev_pm_clear_wake_irq(&pdev->dev);
>> >+ device_init_wakeup(&pdev->dev, false);
>> >+}
>> >+EXPORT_SYMBOL_GPL(of_pci_teardown_wake_irq);
>> >+
>> > /**
>> > * of_irq_parse_pci - Resolve the interrupt for a PCI device
>> > * @pdev: the device whose interrupt is to be resolved
> Thanks,
> Rafael
>
>
>
>
^ permalink raw reply
* Re: [PATCH v4 0/2] Initial Allwinner V3s CSI Support
From: Yong @ 2017-12-26 0:56 UTC (permalink / raw)
To: Ondřej Jirman
Cc: Maxime Ripard, Mauro Carvalho Chehab, Rob Herring, Mark Rutland,
Chen-Yu Tsai, David S. Miller, Greg Kroah-Hartman, Randy Dunlap,
Hans Verkuil, Stanimir Varbanov, Hugues Fruchet, Yannick Fertre,
Philipp Zabel, Arnd Bergmann, Benjamin Gaignard,
Ramesh Shanmugasundaram, Sakari Ailus, Rick Chang,
linux-media-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TaqPxH82wqD4g
In-Reply-To: <20171225085802.lfyk4blmbqxq6r2m-9v8tmBix7cb9zxVx7UNMDg@public.gmane.org>
On Mon, 25 Dec 2017 09:58:02 +0100
Ondřej Jirman <megous-5qf/QAjKc83QT0dZR+AlfA@public.gmane.org> wrote:
> Hello,
>
> On Mon, Dec 25, 2017 at 11:15:26AM +0800, Yong wrote:
> > Hi,
> >
> > On Fri, 22 Dec 2017 14:46:48 +0100
> > Ondřej Jirman <megous-5qf/QAjKc83QT0dZR+AlfA@public.gmane.org> wrote:
> >
> > > Hello,
> > >
> > > Yong Deng píše v Pá 22. 12. 2017 v 17:32 +0800:
> > > >
> > > > Test input 0:
> > > >
> > > > Control ioctls:
> > > > test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported)
> > > > test VIDIOC_QUERYCTRL: OK (Not Supported)
> > > > test VIDIOC_G/S_CTRL: OK (Not Supported)
> > > > test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
> > > > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
> > > > test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
> > > > Standard Controls: 0 Private Controls: 0
> > >
> > > I'm not sure if your driver passes control queries to the subdev. It
> > > did not originally, and I'm not sure you picked up the change from my
> > > version of the driver. "Not supported" here seems to indicate that it
> > > does not.
> > >
> > > I'd be interested what's the recommended practice here. It sure helps
> > > with some apps that expect to be able to modify various input controls
> > > directly on the /dev/video# device. These are then supported out of the
> > > box.
> > >
> > > It's a one-line change. See:
> > >
> > > https://www.kernel.org/doc/html/latest/media/kapi/v4l2-controls.html#in
> > > heriting-controls
> >
> > I think this is a feature and not affect the driver's main function.
> > I just focused on making the CSI main function to work properly in
> > the initial version. Is this feature mandatory or most commonly used?
>
> I grepped the platform/ code and it seems, that inheriting controls
> from subdevs is pretty common for input drivers. (there are varying
> approaches though, some inherit by hand in the link function, some
> just register and empty ctrl_handler on the v4l2_dev and leave the
> rest to the core).
>
> Practically, I haven't found a common app that would allow me to enter
> both /dev/video0 and /dev/v4l-subdevX. I'm sure anyone can write one
> themselves, but it would be better if current controls were available
> at the /dev/video0 device automatically.
>
> It's much simpler for the userspace apps than the alternative, which
> is trying to identify the correct subdev that is currently
> associated with the CSI driver at runtime, which is not exactly
> straightforward and requires much more code, than a few lines in
> the kernel, that are required to inherit controls:
>
>
> ret = v4l2_ctrl_handler_init(&csi->ctrl_handler, 0);
> if (ret) {
> dev_err(csi->dev,
> "V4L2 controls handler init failed (%d)\n",
> ret);
> goto handle_error;
> }
>
> csi->v4l2_dev.ctrl_handler = &csi->ctrl_handler;
>
> See: https://github.com/megous/linux/blob/linux-tbs/drivers/media/platform/sun6i-csi/sun6i_csi.c#L1005
Ok, I will add this. Thanks for your explication.
>
> regards,
> o.j.
>
> > Thanks,
> > Yong
Thanks,
Yong
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply
* Re: [RFC PATCH v11 4/5] PCI / PM: Add support for the PCIe WAKE# signal for OF
From: Rafael J. Wysocki @ 2017-12-26 0:11 UTC (permalink / raw)
To: Jeffy Chen
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
bhelgaas-hpIqsD4AKlfQT0dZR+AlfA, linux-pm-u79uwXL29TY76Z2rM5mHXA,
tony-4v6yS6AI5VpBDgjK7y7TUQ, shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
dianders-F7+t8E8rja9g9hUCZPvPmw,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-pci-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Frank Rowand
In-Reply-To: <20171225114742.18920-5-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
On Monday, December 25, 2017 12:47:41 PM CET Jeffy Chen wrote:
> Add of_pci_setup_wake_irq() and of_pci_teardown_wake_irq() to handle
> the PCIe WAKE# interrupt.
>
> Also use the dedicated wakeirq infrastructure to simplify it.
>
> Signed-off-by: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
>
> Changes in v11:
> Only support 1-per-device PCIe WAKE# pin as suggested.
>
> Changes in v10:
> Use device_set_wakeup_capable() instead of device_set_wakeup_enable(),
> since dedicated wakeirq will be lost in device_set_wakeup_enable(false).
>
> Changes in v9:
> Fix check error in .cleanup().
> Move dedicated wakeirq setup to setup() callback and use
> device_set_wakeup_enable() to enable/disable.
>
> Changes in v8:
> Add pci-of.c and use platform_pm_ops to handle the PCIe WAKE# signal.
>
> Changes in v7:
> Move PCIE_WAKE handling into pci core.
>
> Changes in v6:
> Fix device_init_wake error handling, and add some comments.
>
> Changes in v5:
> Rebase.
>
> Changes in v3:
> Fix error handling.
>
> Changes in v2:
> Use dev_pm_set_dedicated_wake_irq.
>
> drivers/of/of_pci_irq.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
> drivers/pci/pci-driver.c | 10 ++++++++++
> include/linux/of_pci.h | 9 +++++++++
> 3 files changed, 68 insertions(+)
>
> diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c
> index d39565d5477b..def884c1a37a 100644
> --- a/drivers/of/of_pci_irq.c
> +++ b/drivers/of/of_pci_irq.c
> @@ -1,8 +1,57 @@
> #include <linux/kernel.h>
> #include <linux/of_pci.h>
> #include <linux/of_irq.h>
> +#include <linux/pm_wakeirq.h>
> #include <linux/export.h>
>
> +int of_pci_setup_wake_irq(struct pci_dev *pdev)
> +{
> + struct pci_dev *ppdev;
> + struct device_node *dn;
> + int ret, irq;
> +
> + /* Get the pci_dev of our parent. Hopefully it's a port. */
> + ppdev = pdev->bus->self;
> + /* Nope, it's a host bridge. */
> + if (!ppdev)
> + return 0;
> +
> + dn = pci_device_to_OF_node(ppdev);
> + if (!dn)
> + return 0;
> +
> + irq = of_irq_get_byname(dn, "wakeup");
Why is this a property of the bridge and not of the device itself?
> + if (irq == -EPROBE_DEFER)
Braces here, please.
> + return irq;
> + /* Ignore other errors, since a missing wakeup is non-fatal. */
> + else if (irq < 0) {
> + dev_info(&pdev->dev, "cannot get wakeup interrupt: %d\n", irq);
> + return 0;
> + }
> +
> + device_init_wakeup(&pdev->dev, true);
Why do you call this before dev_pm_set_dedicated_wake_irq()?
> +
> + ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, irq);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "failed to set wake IRQ: %d\n", ret);
> + device_init_wakeup(&pdev->dev, false);
> + return ret;
> + }
> +
It would be more straightforward to call device_init_wakeup() here.
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(of_pci_setup_wake_irq);
> +
> +void of_pci_teardown_wake_irq(struct pci_dev *pdev)
> +{
> + if (!pdev->dev.power.wakeirq)
> + return;
> +
> + dev_pm_clear_wake_irq(&pdev->dev);
> + device_init_wakeup(&pdev->dev, false);
> +}
> +EXPORT_SYMBOL_GPL(of_pci_teardown_wake_irq);
> +
> /**
> * of_irq_parse_pci - Resolve the interrupt for a PCI device
> * @pdev: the device whose interrupt is to be resolved
Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [patch v15 0/4] JTAG driver introduction
From: Florian Fainelli @ 2017-12-25 23:17 UTC (permalink / raw)
To: Oleksandr Shamray, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
arnd-r2nGTMty4D4
Cc: system-sw-low-level-VPRAkNaXOzVWk0Htik3J/w,
devicetree-u79uwXL29TY76Z2rM5mHXA, jiri-rHqAuBHg3fBzbRFIqnYvSA,
vadimp-VPRAkNaXOzVWk0Htik3J/w, linux-api-u79uwXL29TY76Z2rM5mHXA,
openbmc-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
openocd-devel-owner-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, joel-U3u1mxZcP9KHXe+LvDLADg,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
tklauser-93Khv+1bN0NyDzI6CaY1VQ, mchehab-DgEjT+Ai2ygdnm+yROfE0A,
davem-fT/PcQaiUtIeIZ0/mPfg9Q,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <1514202808-29747-1-git-send-email-oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Le 12/25/17 à 03:53, Oleksandr Shamray a écrit :
> When a need raise up to use JTAG interface for system's devices
> programming or CPU debugging, usually the user layer
> application implements jtag protocol by bit-bang or using a
> proprietary connection to vendor hardware.
> This method can be slow and not generic.
>
> We propose to implement general JTAG interface and infrastructure
> to communicate with user layer application. In such way, we can
> have the standard JTAG interface core part and separation from
> specific HW implementation.
Well, the framework in its current shape is still extremely simplistic,
therefore leaving a lot of room (read: bugs, inconsistencies) within the
hands of the driver, so while the user-space interface is standard
through the proposed character device, the user experience, likely might
not.
> This allow new capability to debug the CPU or program system's
> device via BMC without additional devices nor cost.
If that is the case, should not we leverage the kernel's device driver
model and expect the JTAG framework to create specific devices for the
different pieces of HW discovered on the scan chain? That would also
presumably allow the core JTAG framework to retain the necessary state
changes in order to address one particular device within the scan chain.
>
> This patch purpose is to add JTAG master core infrastructure by
> defining new JTAG class and provide generic JTAG interface
> to allow hardware specific drivers to connect this interface.
> This will enable all JTAG drivers to use the common interface
> part and will have separate for hardware implementation.
Let's consider I want to get rid of OpenOCD, or rather, move its driver
interface within the kernel and replace it on the OpenOCD side with a
generic character device interface. I could presumably amortize the
costly operations which are currently I/O and/or system call limiting
when running in user-space, what would it look like with your proposed
framework, have you given some thoughts about that?
Thanks!
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] ASoC: max98373: Added Amplifier Driver
From: Kuninori Morimoto @ 2017-12-25 23:17 UTC (permalink / raw)
To: Ryan Lee
Cc: mark.rutland@arm.com, bryce.ferguson@rockwellcollins.com,
alsa-devel@alsa-project.org, ryan.lee.maxim@gmail.com,
arnd@arndb.de, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, tiwai@suse.com, robh+dt@kernel.org,
lgirdwood@gmail.com, m-stecklein@ti.com, broonie@kernel.org,
afd@ti.com, romain.perier@collabora.com, dannenberg@ti.com,
robert.jarzmik@free.fr, supercraig0719@gmail.com,
jbrunet@baylibre.com
In-Reply-To: <BY2PR11MB0837C049BCA0C1B5103EA3FBE7010@BY2PR11MB0837.namprd11.prod.outlook.com>
Hi Ryan
> >About this max98373->codec.
> >This user is only max98373_set_clock(), and it is called from
> >max98373_dai_hw_params().
> >You are getting *codec from dai->codec in this function, and max98373 is
> >came from it.
> >This means, we can remove max98373->codec ?
>
> Thanks for your feedback.
> I will remove max98373->codec and change related things.
Thanks
> I'm sorry but I don't fully understand the benefit of this.
> Keeping regmap information in private driver data is very common and I can see many ASoC drivers are using it.
> I was able to see only a few driver use ' snd_soc_component_read'.
> I would like to keep regmap_read/write if it is still acceptable.
I checked other drivers.
Having private regmap seems a little bit duplicate for me,
because we can get it from component or dev.
But sometimes, in some drivers, it seems can be difficult.
Sorry for my noise.
Best regards
---
Kuninori Morimoto
^ permalink raw reply
* Re: [patch v15 1/4] drivers: jtag: Add JTAG core driver
From: Florian Fainelli @ 2017-12-25 23:09 UTC (permalink / raw)
To: Oleksandr Shamray, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
arnd-r2nGTMty4D4
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-u79uwXL29TY76Z2rM5mHXA, openbmc-uLR06cmDAlY/bJ5BZ2RsiQ,
joel-U3u1mxZcP9KHXe+LvDLADg, jiri-rHqAuBHg3fBzbRFIqnYvSA,
tklauser-93Khv+1bN0NyDzI6CaY1VQ,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
vadimp-VPRAkNaXOzVWk0Htik3J/w,
system-sw-low-level-VPRAkNaXOzVWk0Htik3J/w,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
openocd-devel-owner-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-api-u79uwXL29TY76Z2rM5mHXA, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
mchehab-DgEjT+Ai2ygdnm+yROfE0A, Jiri Pirko
In-Reply-To: <1514202808-29747-2-git-send-email-oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Le 12/25/17 à 03:53, Oleksandr Shamray a écrit :
> Initial patch for JTAG driver
> JTAG class driver provide infrastructure to support hardware/software
> JTAG platform drivers. It provide user layer API interface for flashing
> and debugging external devices which equipped with JTAG interface
> using standard transactions.
>
> Driver exposes set of IOCTL to user space for:
> - XFER:
> - SIR (Scan Instruction Register, IEEE 1149.1 Data Register scan);
> - SDR (Scan Data Register, IEEE 1149.1 Instruction Register scan);
> - RUNTEST (Forces the IEEE 1149.1 bus to a run state for a specified
> number of clocks).
> - SIOCFREQ/GIOCFREQ for setting and reading JTAG frequency.
>
> Driver core provides set of internal APIs for allocation and
> registration:
> - jtag_register;
> - jtag_unregister;
> - jtag_alloc;
> - jtag_free;
>
> Platform driver on registration with jtag-core creates the next
> entry in dev folder:
> /dev/jtagX
Just some general comment, I am really surprised to see that there is
not a whole lot of generic code, actually, there is none, which tries to
manage the JTAG devices command queue, e.g: ala OpenOCD. All that this
is doing here is create a special character device with a bunch of
custom ioctl(), which means that a lot of code is going to be put within
in individual drivers. Have you given some thoughts on how you would
expand this framework for non ASPEED JTAG adapters? For instance, one
expectation is to see a bit-banged GPIO master, since that's quite
common, what would it look like here? How much code would I have to write?
[snip]
> +
> +void *jtag_priv(struct jtag *jtag)
> +{
> + return jtag->priv;
> +}
> +EXPORT_SYMBOL_GPL(jtag_priv);
Can't you just create a static inline function in the public header for
that? This is usually what subsystems do, I can understand why you would
not want to expose struct jtag to other parts of the kernel, but still,
this looks ugly, so maybe consider splitting the header between provider
and consumer?
> +
> +static long jtag_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> +{
> + struct jtag *jtag = file->private_data;
> + struct jtag_run_test_idle idle;
> + struct jtag_xfer xfer;
> + u8 *xfer_data;
> + u32 data_size;
> + u32 value;
> + int err;
> +
> + if (!arg)
> + return -EINVAL;
> +
> + switch (cmd) {
> + case JTAG_GIOCFREQ:
> +
> + if (jtag->ops->freq_get)
> + err = jtag->ops->freq_get(jtag, &value);
> + else
> + err = -EOPNOTSUPP;
> + if (err)
> + break;
> +
> + if (put_user(value, (__u32 *)arg))
> + err = -EFAULT;
> + break;
> +
> + case JTAG_SIOCFREQ:
> + if (get_user(value, (__u32 *)arg))
> + return -EFAULT;
> + if (value == 0)
> + return -EINVAL;
> +
> + if (jtag->ops->freq_set)
> + err = jtag->ops->freq_set(jtag, value);
> + else
> + err = -EOPNOTSUPP;
You should check that before get_user()
> + break;
> +
> + case JTAG_IOCRUNTEST:
> + if (copy_from_user(&idle, (void *)arg,
> + sizeof(struct jtag_run_test_idle)))
> + return -EFAULT;
> +
> + if (idle.endstate > JTAG_STATE_PAUSEDR)
> + return -EINVAL;
> +
> + if (jtag->ops->idle)
> + err = jtag->ops->idle(jtag, &idle);
> + else
> + err = -EOPNOTSUPP;
> + break;
Same here.
> +
> + case JTAG_IOCXFER:
> + if (copy_from_user(&xfer, (void *)arg,
> + sizeof(struct jtag_xfer)))
> + return -EFAULT;
> +
> + if (xfer.length >= JTAG_MAX_XFER_DATA_LEN)
> + return -EINVAL;
> +
> + if (xfer.type > JTAG_SDR_XFER)
> + return -EINVAL;
> +
> + if (xfer.direction > JTAG_WRITE_XFER)
> + return -EINVAL;
> +
> + if (xfer.endstate > JTAG_STATE_PAUSEDR)
> + return -EINVAL;
> +
> + data_size = DIV_ROUND_UP(xfer.length, BITS_PER_BYTE);
> + xfer_data = memdup_user(u64_to_user_ptr(xfer.tdio), data_size);
> +
> + if (!xfer_data)
> + return -EFAULT;
> +
> + if (jtag->ops->xfer) {
> + err = jtag->ops->xfer(jtag, &xfer, xfer_data);
> + } else {
> + kfree(xfer_data);
> + return -EOPNOTSUPP;
> + }
Why don't you move all of the code here into a function which will make
the error handling consistent? Also, checking whether the jtag adapter
implements ops->xfer should probably be done before you do the
memdup_user().
> +
> + if (err) {
> + kfree(xfer_data);
> + return -EFAULT;
> + }
> +
> + err = copy_to_user(u64_to_user_ptr(xfer.tdio),
> + (void *)(xfer_data), data_size);
> +
> + if (err) {
> + kfree(xfer_data);
> + return -EFAULT;
> + }
> +
> + kfree(xfer_data);
> + if (copy_to_user((void *)arg, &xfer, sizeof(struct jtag_xfer)))
> + return -EFAULT;
> + break;
> +
> + case JTAG_GIOCSTATUS:
> + if (jtag->ops->status_get)
> + err = jtag->ops->status_get(jtag, &value);
> + else
> + err = -EOPNOTSUPP;
> + if (err)
> + break;
> +
> + err = put_user(value, (__u32 *)arg);
> + if (err)
> + err = -EFAULT;
> + break;
> + case JTAG_SIOCMODE:
> + if (get_user(value, (__u32 *)arg))
> + return -EFAULT;
> + if (value == 0)
> + return -EINVAL;
> +
> + if (jtag->ops->mode_set)
> + err = jtag->ops->mode_set(jtag, value);
> + else
> + err = -EOPNOTSUPP;
> + break;
Same here, this can be checked before get_user().
> +
> + default:
> + return -EINVAL;
> + }
> + return err;
> +}
> +
> +static int jtag_open(struct inode *inode, struct file *file)
> +{
> + struct jtag *jtag = container_of(file->private_data, struct jtag,
> + miscdev);
> +
> + if (mutex_lock_interruptible(&jtag->open_lock))
> + return -ERESTARTSYS;
> +
> + if (jtag->opened) {
> + mutex_unlock(&jtag->open_lock);
> + return -EINVAL;
-EBUSY maybe?
> + }
> +
> + nonseekable_open(inode, file);
> + file->private_data = jtag;
> + jtag->opened = true;
> + mutex_unlock(&jtag->open_lock);
> + return 0;
> +}
> +
> +static int jtag_release(struct inode *inode, struct file *file)
> +{
> + struct jtag *jtag = file->private_data;
> +
> + mutex_lock(&jtag->open_lock);
> + jtag->opened = false;
> + mutex_unlock(&jtag->open_lock);
> + return 0;
> +}
> +
> +static const struct file_operations jtag_fops = {
> + .owner = THIS_MODULE,
> + .open = jtag_open,
> + .release = jtag_release,
> + .llseek = noop_llseek,
> + .unlocked_ioctl = jtag_ioctl,
> +};
> +
> +struct jtag *jtag_alloc(size_t priv_size, const struct jtag_ops *ops)
> +{
> + struct jtag *jtag;
> +
> + jtag = kzalloc(sizeof(*jtag) + round_up(priv_size, ARCH_DMA_MINALIGN),
> + GFP_KERNEL);
> + if (!jtag)
> + return NULL;
If you set ARCH_DMA_MINALIGN to 1 when not defined, what is this
achieving that kmalloc() is not already doing?
> +
> + jtag->ops = ops;
> + return jtag;
> +}
> +EXPORT_SYMBOL_GPL(jtag_alloc);
> +
> +void jtag_free(struct jtag *jtag)
> +{
> + kfree(jtag);
> +}
> +EXPORT_SYMBOL_GPL(jtag_free);
> +
> +int jtag_register(struct jtag *jtag)
> +{
> + char *name;
> + int err;
> + int id;
> +
> + id = ida_simple_get(&jtag_ida, 0, 0, GFP_KERNEL);
> + if (id < 0)
> + return id;
> +
> + jtag->id = id;
> +
> + name = kzalloc(MAX_JTAG_NAME_LEN, GFP_KERNEL);
> + if (!name) {
> + err = -ENOMEM;
> + goto err_jtag_alloc;
> + }
Can't you use jtag->miscdev.dev here to simplify the allocation error
handling?
> +
> + err = snprintf(name, MAX_JTAG_NAME_LEN, "jtag%d", id);
> + if (err < 0)
> + goto err_jtag_name;
> +
> + mutex_init(&jtag->open_lock);
> + jtag->miscdev.fops = &jtag_fops;
> + jtag->miscdev.minor = MISC_DYNAMIC_MINOR;
> + jtag->miscdev.name = name;
> +
> + err = misc_register(&jtag->miscdev);
> + if (err)
> + dev_err(jtag->dev, "Unable to register device\n");
> + else
> + return 0;
> + jtag->opened = false;
> +
> +err_jtag_name:
> + kfree(name);
> +err_jtag_alloc:
> + ida_simple_remove(&jtag_ida, id);
> + return err;
> +}
> +EXPORT_SYMBOL_GPL(jtag_register);
> +
> +void jtag_unregister(struct jtag *jtag)
> +{
> + misc_deregister(&jtag->miscdev);
> + kfree(jtag->miscdev.name);
> + ida_simple_remove(&jtag_ida, jtag->id);
> +}
> +EXPORT_SYMBOL_GPL(jtag_unregister);
> +
> +static void __exit jtag_exit(void)
> +{
> + ida_destroy(&jtag_ida);
> +}
> +
> +module_exit(jtag_exit);
> +
> +MODULE_AUTHOR("Oleksandr Shamray <oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>");
> +MODULE_DESCRIPTION("Generic jtag support");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/jtag.h b/include/linux/jtag.h
> new file mode 100644
> index 0000000..312c641
> --- /dev/null
> +++ b/include/linux/jtag.h
> @@ -0,0 +1,45 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// include/linux/jtag.h - JTAG class driver
> +//
> +// Copyright (c) 2017 Mellanox Technologies. All rights reserved.
> +// Copyright (c) 2017 Oleksandr Shamray <oleksandrs-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> +
> +#ifndef __JTAG_H
> +#define __JTAG_H
> +
> +#include <uapi/linux/jtag.h>
> +
> +#ifndef ARCH_DMA_MINALIGN
> +#define ARCH_DMA_MINALIGN 1
> +#endif
Why?
> +
> +#define jtag_u64_to_ptr(arg) ((void *)(uintptr_t)arg)
> +
> +#define JTAG_MAX_XFER_DATA_LEN 65535
> +
> +struct jtag;
> +/**
> + * struct jtag_ops - callbacks for jtag control functions:
> + *
> + * @freq_get: get frequency function. Filled by device driver
> + * @freq_set: set frequency function. Filled by device driver
> + * @status_get: set status function. Filled by device driver
> + * @idle: set JTAG to idle state function. Filled by device driver
> + * @xfer: send JTAG xfer function. Filled by device driver
> + */
> +struct jtag_ops {
> + int (*freq_get)(struct jtag *jtag, u32 *freq);
> + int (*freq_set)(struct jtag *jtag, u32 freq);
> + int (*status_get)(struct jtag *jtag, u32 *state);
> + int (*idle)(struct jtag *jtag, struct jtag_run_test_idle *idle);
> + int (*xfer)(struct jtag *jtag, struct jtag_xfer *xfer, u8 *xfer_data);
> + int (*mode_set)(struct jtag *jtag, u32 mode_mask);
> +};
> +
> +void *jtag_priv(struct jtag *jtag);
> +int jtag_register(struct jtag *jtag);
> +void jtag_unregister(struct jtag *jtag);
> +struct jtag *jtag_alloc(size_t priv_size, const struct jtag_ops *ops);
> +void jtag_free(struct jtag *jtag);
> +
> +#endif /* __JTAG_H */
> diff --git a/include/uapi/linux/jtag.h b/include/uapi/linux/jtag.h
> new file mode 100644
> index 0000000..cda2520
> --- /dev/null
> +++ b/include/uapi/linux/jtag.h
[snip]
> +struct jtag_xfer {
> + __u8 type;
> + __u8 direction;
Can these two be an enum referring to what you defined earlier?
> + __u8 endstate;
> + __u32 length;
> + __u64 tdio;
> +};
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH v7] i2c: Add support for NXP PCA984x family.
From: Adrian Fiergolski @ 2017-12-25 21:26 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Cc: peda-koto5C5qi+TLoDKTGw+V6w, devicetree-u79uwXL29TY76Z2rM5mHXA,
robh-DgEjT+Ai2ygdnm+yROfE0A, Adrian Fiergolski
In-Reply-To: <20171220182745.lo6i27ucfhjekmjp@rob-hp-laptop>
This patch extends the current i2c-mux-pca954x driver and adds support for
a newer PCA984x family of the I2C switches and multiplexers from NXP.
Signed-off-by: Adrian Fiergolski <adrian.fiergolski-vJEk5272eHo@public.gmane.org>
---
Following Rob's and Peter's remarks, bindings contain now one valid
combination of compatibles per line.
.../devicetree/bindings/i2c/i2c-mux-pca954x.txt | 13 ++++++--
drivers/i2c/muxes/Kconfig | 6 ++--
drivers/i2c/muxes/i2c-mux-pca954x.c | 38 +++++++++++++++++++---
3 files changed, 48 insertions(+), 9 deletions(-)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt
index aa097045a10e..34d91501342e 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt
@@ -1,10 +1,19 @@
* NXP PCA954x I2C bus switch
+The driver supports NXP PCA954x and PCA984x I2C mux/switch devices.
+
Required Properties:
- compatible: Must contain one of the following.
- "nxp,pca9540", "nxp,pca9542", "nxp,pca9543", "nxp,pca9544",
- "nxp,pca9545", "nxp,pca9546", "nxp,pca9547", "nxp,pca9548"
+ "nxp,pca9540",
+ "nxp,pca9542",
+ "nxp,pca9543",
+ "nxp,pca9544",
+ "nxp,pca9545",
+ "nxp,pca9546", "nxp,pca9846",
+ "nxp,pca9547", "nxp,pca9847",
+ "nxp,pca9548", "nxp,pca9848",
+ "nxp,pca9849"
- reg: The I2C address of the device.
diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig
index 0f5c8fc36625..52a4a922e7e6 100644
--- a/drivers/i2c/muxes/Kconfig
+++ b/drivers/i2c/muxes/Kconfig
@@ -64,11 +64,11 @@ config I2C_MUX_PCA9541
will be called i2c-mux-pca9541.
config I2C_MUX_PCA954x
- tristate "Philips PCA954x I2C Mux/switches"
+ tristate "NXP PCA954x and PCA984x I2C Mux/switches"
depends on GPIOLIB || COMPILE_TEST
help
- If you say yes here you get support for the Philips PCA954x
- I2C mux/switch devices.
+ If you say yes here you get support for the NXP PCA954x
+ and PCA984x I2C mux/switch devices.
This driver can also be built as a module. If so, the module
will be called i2c-mux-pca954x.
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 2ca068d8b92d..fbb84c7ef282 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -4,11 +4,11 @@
* Copyright (c) 2008-2009 Rodolfo Giometti <giometti-k2GhghHVRtY@public.gmane.org>
* Copyright (c) 2008-2009 Eurotech S.p.A. <info-ymFC7zkAqBI1GQ1Ptb7lUw@public.gmane.org>
*
- * This module supports the PCA954x series of I2C multiplexer/switch chips
- * made by Philips Semiconductors.
+ * This module supports the PCA954x and PCA954x series of I2C multiplexer/switch
+ * chips made by NXP Semiconductors.
* This includes the:
- * PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547
- * and PCA9548.
+ * PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547,
+ * PCA9548, PCA9846, PCA9847, PCA9848 and PCA9849.
*
* These chips are all controlled via the I2C bus itself, and all have a
* single 8-bit register. The upstream "parent" bus fans out to two,
@@ -63,6 +63,10 @@ enum pca_type {
pca_9546,
pca_9547,
pca_9548,
+ pca_9846,
+ pca_9847,
+ pca_9848,
+ pca_9849,
};
struct chip_desc {
@@ -129,6 +133,24 @@ static const struct chip_desc chips[] = {
.nchans = 8,
.muxtype = pca954x_isswi,
},
+ [pca_9846] = {
+ .nchans = 4,
+ .muxtype = pca954x_isswi,
+ },
+ [pca_9847] = {
+ .nchans = 8,
+ .enable = 0x8,
+ .muxtype = pca954x_ismux,
+ },
+ [pca_9848] = {
+ .nchans = 8,
+ .muxtype = pca954x_isswi,
+ },
+ [pca_9849] = {
+ .nchans = 4,
+ .enable = 0x4,
+ .muxtype = pca954x_ismux,
+ },
};
static const struct i2c_device_id pca954x_id[] = {
@@ -140,6 +162,10 @@ static const struct i2c_device_id pca954x_id[] = {
{ "pca9546", pca_9546 },
{ "pca9547", pca_9547 },
{ "pca9548", pca_9548 },
+ { "pca9846", pca_9846 },
+ { "pca9847", pca_9847 },
+ { "pca9848", pca_9848 },
+ { "pca9849", pca_9849 },
{ }
};
MODULE_DEVICE_TABLE(i2c, pca954x_id);
@@ -154,6 +180,10 @@ static const struct of_device_id pca954x_of_match[] = {
{ .compatible = "nxp,pca9546", .data = &chips[pca_9546] },
{ .compatible = "nxp,pca9547", .data = &chips[pca_9547] },
{ .compatible = "nxp,pca9548", .data = &chips[pca_9548] },
+ { .compatible = "nxp,pca9846", .data = &chips[pca_9846] },
+ { .compatible = "nxp,pca9847", .data = &chips[pca_9847] },
+ { .compatible = "nxp,pca9848", .data = &chips[pca_9848] },
+ { .compatible = "nxp,pca9849", .data = &chips[pca_9849] },
{}
};
MODULE_DEVICE_TABLE(of, pca954x_of_match);
--
2.14.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox