aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Dembicki <paweldembicki@gmail.com>2020-10-27 09:52:31 +0100
committerPetr Štetiar <ynezz@true.cz>2020-11-23 22:53:15 +0100
commit4dc27a026b7e308477adecbdf8e6da58e1d57716 (patch)
tree3bf02dcd1000926f7c44f529bfc4b42ea845821c
parenta1158b3170b9bfcc346972242a62efeda8cf80b0 (diff)
downloadupstream-4dc27a026b7e308477adecbdf8e6da58e1d57716.tar.gz
upstream-4dc27a026b7e308477adecbdf8e6da58e1d57716.tar.bz2
upstream-4dc27a026b7e308477adecbdf8e6da58e1d57716.zip
layerscape: add i2c peripherials on LS1012A-RDB
LS1012A-RDB equipped in some i2c devices: - 3x GPIO Expander: PCAL9555A (NXP) - Gyro: FXAS21002 (NXP) - Accelerometer: FXOS8700 (NXP) - Current & Power Monitor: INA220 (TI) This patch enables i2c peripherials installed on LS1012A-RDB. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
-rw-r--r--target/linux/layerscape/armv8_64b/config-5.43
-rw-r--r--target/linux/layerscape/image/armv8_64b.mk3
-rw-r--r--target/linux/layerscape/patches-5.4/900-layerscape_fix_support_of_LS1012A-RDB.patch107
-rw-r--r--target/linux/layerscape/patches-5.4/901-fix_irq_type_of_pca953x.patch28
4 files changed, 141 insertions, 0 deletions
diff --git a/target/linux/layerscape/armv8_64b/config-5.4 b/target/linux/layerscape/armv8_64b/config-5.4
index 6da7ff01a5..8c398f4a2b 100644
--- a/target/linux/layerscape/armv8_64b/config-5.4
+++ b/target/linux/layerscape/armv8_64b/config-5.4
@@ -419,9 +419,12 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
# CONFIG_GIANFAR is not set
CONFIG_GLOB=y
CONFIG_GPIOLIB=y
+CONFIG_GPIOLIB_IRQCHIP=y
CONFIG_GPIO_GENERIC=y
CONFIG_GPIO_GENERIC_PLATFORM=y
CONFIG_GPIO_MPC8XXX=y
+CONFIG_GPIO_PCA953X=y
+CONFIG_GPIO_PCA953X_IRQ=y
CONFIG_HANDLE_DOMAIN_IRQ=y
CONFIG_HARDEN_BRANCH_PREDICTOR=y
CONFIG_HARDIRQS_SW_RESEND=y
diff --git a/target/linux/layerscape/image/armv8_64b.mk b/target/linux/layerscape/image/armv8_64b.mk
index bedf272f79..264f7dfd84 100644
--- a/target/linux/layerscape/image/armv8_64b.mk
+++ b/target/linux/layerscape/image/armv8_64b.mk
@@ -63,6 +63,9 @@ define Device/fsl_ls1012a-rdb
DEVICE_PACKAGES += \
layerscape-ppfe \
tfa-ls1012a-rdb \
+ kmod-hwmon-ina2xx \
+ kmod-iio-fxas21002c-i2c \
+ kmod-iio-fxos8700-i2c \
kmod-ppfe
IMAGE/firmware.bin := \
ls-clean | \
diff --git a/target/linux/layerscape/patches-5.4/900-layerscape_fix_support_of_LS1012A-RDB.patch b/target/linux/layerscape/patches-5.4/900-layerscape_fix_support_of_LS1012A-RDB.patch
new file mode 100644
index 0000000000..bcad654e5c
--- /dev/null
+++ b/target/linux/layerscape/patches-5.4/900-layerscape_fix_support_of_LS1012A-RDB.patch
@@ -0,0 +1,107 @@
+From 650480191492845c8eb7e0c2e5b1e37cabc59eff Mon Sep 17 00:00:00 2001
+From: Pawel Dembicki <paweldembicki@gmail.com>
+Date: Fri, 13 Nov 2020 07:17:39 +0100
+Subject: [PATCH 1/2] arm64: dts: fsl-ls1012a-rdb: add i2c devices
+
+LS1012A-RDB equipped in some i2c devices:
+ - 3x GPIO Expander: PCAL9555A (NXP)
+ - Gyro: FXAS21002 (NXP)
+ - Accelerometer: FXOS8700 (NXP)
+ - Current & Power Monitor: INA220 (TI)
+
+This patch add listed devices to dts.
+
+Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
+---
+ .../boot/dts/freescale/fsl-ls1012a-rdb.dts | 66 +++++++++++++++++++
+ 1 file changed, 66 insertions(+)
+
+--- a/arch/arm64/boot/dts/freescale/fsl-ls1012a-rdb.dts
++++ b/arch/arm64/boot/dts/freescale/fsl-ls1012a-rdb.dts
+@@ -7,6 +7,7 @@
+ */
+ /dts-v1/;
+
++#include <dt-bindings/interrupt-controller/irq.h>
+ #include "fsl-ls1012a.dtsi"
+
+ / {
+@@ -16,6 +17,25 @@
+ aliases {
+ ethernet0 = &pfe_mac0;
+ ethernet1 = &pfe_mac1;
++ serial0 = &duart0;
++ };
++
++ dummy3v3: dummy_reg {
++ compatible = "regulator-fixed";
++ regulator-name = "dummy_regulator_3v3";
++
++ regulator-min-microvolt = <3300000>;
++ regulator-max-microvolt = <3300000>;
++ regulator-always-on;
++ };
++
++ dummy1v8: dummy_reg {
++ compatible = "regulator-fixed";
++ regulator-name = "dummy_regulator_1v8";
++
++ regulator-min-microvolt = <1800000>;
++ regulator-max-microvolt = <1800000>;
++ regulator-always-on;
+ };
+ };
+
+@@ -42,6 +62,52 @@
+
+ &i2c0 {
+ status = "okay";
++
++ accelerometer@1e {
++ compatible = "nxp,fxos8700";
++ reg = <0x1e>;
++ interrupt-parent = <&gpio26>;
++ interrupts = <13 IRQ_TYPE_EDGE_RISING>;
++ interrupt-names = "INT1";
++ };
++
++ gyroscope@20 {
++ compatible = "nxp,fxas21002c";
++ reg = <0x20>;
++ vdd-supply = <&dummy3v3>;
++ vddio-supply = <&dummy1v8>;
++ };
++
++ gpio@24 {
++ compatible = "nxp,pcal9555a";
++ reg = <0x24>;
++ gpio-controller;
++ #gpio-cells = <2>;
++ };
++
++ gpio25: gpio@25 {
++ compatible = "nxp,pcal9555a";
++ reg = <0x25>;
++ gpio-controller;
++ #gpio-cells = <2>;
++ };
++
++ gpio26: gpio@26 {
++ compatible = "nxp,pcal9555a";
++ reg = <0x26>;
++ interrupt-parent = <&gpio0>;
++ interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
++ interrupt-controller;
++ #interrupt-cells = <2>;
++ gpio-controller;
++ #gpio-cells = <2>;
++ };
++
++ current-sensor@40 {
++ compatible = "ti,ina220";
++ reg = <0x40>;
++ shunt-resistor = <2000>;
++ };
+ };
+
+ &sata {
diff --git a/target/linux/layerscape/patches-5.4/901-fix_irq_type_of_pca953x.patch b/target/linux/layerscape/patches-5.4/901-fix_irq_type_of_pca953x.patch
new file mode 100644
index 0000000000..a00a240135
--- /dev/null
+++ b/target/linux/layerscape/patches-5.4/901-fix_irq_type_of_pca953x.patch
@@ -0,0 +1,28 @@
+From 12de4b5e7cbcd193d5abb753ca511fe8f2236846 Mon Sep 17 00:00:00 2001
+From: Pawel Dembicki <paweldembicki@gmail.com>
+Date: Fri, 13 Nov 2020 07:30:03 +0100
+Subject: [PATCH 1/1] gpio-pca953x: hack: Allow to use falling trigger
+
+Gpio-mpc8xxx driver of Layerscape gpio support only edge interrupts.
+Gpio-pca953x allow only low state trigger. This hack fix the problem.
+
+Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
+---
+
+--- a/drivers/gpio/gpio-pca953x.c
++++ b/drivers/gpio/gpio-pca953x.c
+@@ -879,10 +879,12 @@ static int pca953x_irq_setup(struct pca9
+ for (i = 0; i < NBANK(chip); i++)
+ chip->irq_stat[i] &= reg_direction[i];
+ mutex_init(&chip->irq_lock);
+-
++ /* gpio-mpc8xxx driver of Layerscape gpio support only edge interrupts.
++ * This hack fix the problem.
++ */
+ ret = devm_request_threaded_irq(&client->dev, client->irq,
+ NULL, pca953x_irq_handler,
+- IRQF_TRIGGER_LOW | IRQF_ONESHOT |
++ IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
+ IRQF_SHARED,
+ dev_name(&client->dev), chip);
+ if (ret) {