mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
projects/RPi2/patches/linux: update RPi2 patches
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
8ec580f2b3
commit
884c7184f4
@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Automatically generated file; DO NOT EDIT.
|
# Automatically generated file; DO NOT EDIT.
|
||||||
# Linux/arm 3.18.5 Kernel Configuration
|
# Linux/arm 3.18.6 Kernel Configuration
|
||||||
#
|
#
|
||||||
CONFIG_ARM=y
|
CONFIG_ARM=y
|
||||||
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
|
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
|
||||||
@ -2792,6 +2792,7 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
|
|||||||
#
|
#
|
||||||
# CONFIG_LEDS_TRIGGER_TRANSIENT is not set
|
# CONFIG_LEDS_TRIGGER_TRANSIENT is not set
|
||||||
# CONFIG_LEDS_TRIGGER_CAMERA is not set
|
# CONFIG_LEDS_TRIGGER_CAMERA is not set
|
||||||
|
CONFIG_LEDS_TRIGGER_INPUT=y
|
||||||
# CONFIG_ACCESSIBILITY is not set
|
# CONFIG_ACCESSIBILITY is not set
|
||||||
# CONFIG_EDAC is not set
|
# CONFIG_EDAC is not set
|
||||||
CONFIG_RTC_LIB=y
|
CONFIG_RTC_LIB=y
|
||||||
|
@ -138440,3 +138440,637 @@ index 0000000..01fc81d
|
|||||||
+ };
|
+ };
|
||||||
+ };
|
+ };
|
||||||
+};
|
+};
|
||||||
|
|
||||||
|
From 5f1c4a04606c2fb2d0203bdbe364a6054b3bb0b7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Phil Elwell <phil@raspberrypi.org>
|
||||||
|
Date: Fri, 6 Feb 2015 13:50:57 +0000
|
||||||
|
Subject: [PATCH 1/5] BCM270x_DT: Add pwr_led, and the required "input" trigger
|
||||||
|
|
||||||
|
The "input" trigger makes the associated GPIO an input. This is to support
|
||||||
|
the Raspberry Pi PWR LED, which is driven by external hardware in normal use.
|
||||||
|
|
||||||
|
N.B. pwr_led is not available on Model A or B boards.
|
||||||
|
---
|
||||||
|
arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 18 ++++++++-
|
||||||
|
arch/arm/boot/dts/bcm2708-rpi-b.dts | 8 +++-
|
||||||
|
arch/arm/boot/dts/bcm2708.dtsi | 5 ---
|
||||||
|
arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 18 ++++++++-
|
||||||
|
arch/arm/boot/dts/bcm2709.dtsi | 5 ---
|
||||||
|
arch/arm/configs/bcm2709_defconfig | 1 +
|
||||||
|
arch/arm/configs/bcmrpi_defconfig | 1 +
|
||||||
|
drivers/leds/trigger/Kconfig | 7 ++++
|
||||||
|
drivers/leds/trigger/Makefile | 1 +
|
||||||
|
drivers/leds/trigger/ledtrig-input.c | 65 ++++++++++++++++++++++++++++++++
|
||||||
|
10 files changed, 113 insertions(+), 16 deletions(-)
|
||||||
|
create mode 100644 drivers/leds/trigger/ledtrig-input.c
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
|
||||||
|
index 6b9512b..7f84473 100644
|
||||||
|
--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
|
||||||
|
+++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
|
||||||
|
@@ -83,8 +83,18 @@
|
||||||
|
pinctrl-0 = <&i2s_pins>;
|
||||||
|
};
|
||||||
|
|
||||||
|
-&act_led {
|
||||||
|
- gpios = <&gpio 47 0>;
|
||||||
|
+&leds {
|
||||||
|
+ act_led: act {
|
||||||
|
+ label = "led0";
|
||||||
|
+ linux,default-trigger = "mmc0";
|
||||||
|
+ gpios = <&gpio 47 0>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ pwr_led: pwr {
|
||||||
|
+ label = "led1";
|
||||||
|
+ linux,default-trigger = "input";
|
||||||
|
+ gpios = <&gpio 35 0>;
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
|
||||||
|
/ {
|
||||||
|
@@ -99,5 +109,9 @@
|
||||||
|
act_led_gpio = <&act_led>,"gpios:4";
|
||||||
|
act_led_activelow = <&act_led>,"gpios:8";
|
||||||
|
act_led_trigger = <&act_led>,"linux,default-trigger";
|
||||||
|
+
|
||||||
|
+ pwr_led_gpio = <&pwr_led>,"gpios:4";
|
||||||
|
+ pwr_led_activelow = <&pwr_led>,"gpios:8";
|
||||||
|
+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts
|
||||||
|
index b8520b55..a39562f 100644
|
||||||
|
--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts
|
||||||
|
+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts
|
||||||
|
@@ -83,8 +83,12 @@
|
||||||
|
pinctrl-0 = <&i2s_pins>;
|
||||||
|
};
|
||||||
|
|
||||||
|
-&act_led {
|
||||||
|
- gpios = <&gpio 16 1>;
|
||||||
|
+&leds {
|
||||||
|
+ act_led: act {
|
||||||
|
+ label = "led0";
|
||||||
|
+ linux,default-trigger = "mmc0";
|
||||||
|
+ gpios = <&gpio 16 1>;
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
|
||||||
|
/ {
|
||||||
|
diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi
|
||||||
|
index af6b1d9..aeeabae 100644
|
||||||
|
--- a/arch/arm/boot/dts/bcm2708.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/bcm2708.dtsi
|
||||||
|
@@ -79,11 +79,6 @@
|
||||||
|
|
||||||
|
leds: leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
-
|
||||||
|
- act_led: act {
|
||||||
|
- label = "led0";
|
||||||
|
- linux,default-trigger = "mmc0";
|
||||||
|
- };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
|
||||||
|
index 63d3da4..75c222f 100644
|
||||||
|
--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
|
||||||
|
+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
|
||||||
|
@@ -83,8 +83,18 @@
|
||||||
|
pinctrl-0 = <&i2s_pins>;
|
||||||
|
};
|
||||||
|
|
||||||
|
-&act_led {
|
||||||
|
- gpios = <&gpio 47 0>;
|
||||||
|
+&leds {
|
||||||
|
+ act_led: act {
|
||||||
|
+ label = "led0";
|
||||||
|
+ linux,default-trigger = "mmc0";
|
||||||
|
+ gpios = <&gpio 47 0>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ pwr_led: pwr {
|
||||||
|
+ label = "led1";
|
||||||
|
+ linux,default-trigger = "input";
|
||||||
|
+ gpios = <&gpio 35 0>;
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
|
||||||
|
/ {
|
||||||
|
@@ -99,5 +109,9 @@
|
||||||
|
act_led_gpio = <&act_led>,"gpios:4";
|
||||||
|
act_led_activelow = <&act_led>,"gpios:8";
|
||||||
|
act_led_trigger = <&act_led>,"linux,default-trigger";
|
||||||
|
+
|
||||||
|
+ pwr_led_gpio = <&pwr_led>,"gpios:4";
|
||||||
|
+ pwr_led_activelow = <&pwr_led>,"gpios:8";
|
||||||
|
+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
diff --git a/arch/arm/boot/dts/bcm2709.dtsi b/arch/arm/boot/dts/bcm2709.dtsi
|
||||||
|
index fee2053..6986455 100644
|
||||||
|
--- a/arch/arm/boot/dts/bcm2709.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/bcm2709.dtsi
|
||||||
|
@@ -79,11 +79,6 @@
|
||||||
|
|
||||||
|
leds: leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
-
|
||||||
|
- act_led: act {
|
||||||
|
- label = "led0";
|
||||||
|
- linux,default-trigger = "mmc0";
|
||||||
|
- };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
|
||||||
|
index b5bf4cb..7bb9de6 100644
|
||||||
|
--- a/arch/arm/configs/bcm2709_defconfig
|
||||||
|
+++ b/arch/arm/configs/bcm2709_defconfig
|
||||||
|
@@ -959,6 +959,7 @@ CONFIG_LEDS_TRIGGER_GPIO=y
|
||||||
|
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
|
||||||
|
CONFIG_LEDS_TRIGGER_TRANSIENT=m
|
||||||
|
CONFIG_LEDS_TRIGGER_CAMERA=m
|
||||||
|
+CONFIG_LEDS_TRIGGER_INPUT=y
|
||||||
|
CONFIG_RTC_CLASS=y
|
||||||
|
# CONFIG_RTC_HCTOSYS is not set
|
||||||
|
CONFIG_RTC_DRV_DS1307=m
|
||||||
|
diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
|
||||||
|
index 81c4387..3b09de9 100644
|
||||||
|
--- a/arch/arm/configs/bcmrpi_defconfig
|
||||||
|
+++ b/arch/arm/configs/bcmrpi_defconfig
|
||||||
|
@@ -952,6 +952,7 @@ CONFIG_LEDS_TRIGGER_GPIO=y
|
||||||
|
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
|
||||||
|
CONFIG_LEDS_TRIGGER_TRANSIENT=m
|
||||||
|
CONFIG_LEDS_TRIGGER_CAMERA=m
|
||||||
|
+CONFIG_LEDS_TRIGGER_INPUT=y
|
||||||
|
CONFIG_RTC_CLASS=y
|
||||||
|
# CONFIG_RTC_HCTOSYS is not set
|
||||||
|
CONFIG_RTC_DRV_DS1307=m
|
||||||
|
diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig
|
||||||
|
index 49794b4..640756b 100644
|
||||||
|
--- a/drivers/leds/trigger/Kconfig
|
||||||
|
+++ b/drivers/leds/trigger/Kconfig
|
||||||
|
@@ -108,4 +108,11 @@ config LEDS_TRIGGER_CAMERA
|
||||||
|
This enables direct flash/torch on/off by the driver, kernel space.
|
||||||
|
If unsure, say Y.
|
||||||
|
|
||||||
|
+config LEDS_TRIGGER_INPUT
|
||||||
|
+ tristate "LED Input Trigger"
|
||||||
|
+ depends on LEDS_TRIGGERS
|
||||||
|
+ help
|
||||||
|
+ This allows the GPIOs assigned to be LEDs to be initialised to inputs.
|
||||||
|
+ If unsure, say Y.
|
||||||
|
+
|
||||||
|
endif # LEDS_TRIGGERS
|
||||||
|
diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile
|
||||||
|
index 1abf48d..c03afdc 100644
|
||||||
|
--- a/drivers/leds/trigger/Makefile
|
||||||
|
+++ b/drivers/leds/trigger/Makefile
|
||||||
|
@@ -8,3 +8,4 @@ obj-$(CONFIG_LEDS_TRIGGER_CPU) += ledtrig-cpu.o
|
||||||
|
obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
|
||||||
|
obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o
|
||||||
|
obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o
|
||||||
|
+obj-$(CONFIG_LEDS_TRIGGER_INPUT) += ledtrig-input.o
|
||||||
|
diff --git a/drivers/leds/trigger/ledtrig-input.c b/drivers/leds/trigger/ledtrig-input.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..2ca2b98
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/leds/trigger/ledtrig-input.c
|
||||||
|
@@ -0,0 +1,65 @@
|
||||||
|
+/*
|
||||||
|
+ * Set LED GPIO to Input "Trigger"
|
||||||
|
+ *
|
||||||
|
+ * Copyright 2015 Phil Elwell <phil@raspberrypi.org>
|
||||||
|
+ *
|
||||||
|
+ * Based on Nick Forbes's ledtrig-default-on.c.
|
||||||
|
+ *
|
||||||
|
+ * 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.
|
||||||
|
+ *
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <linux/module.h>
|
||||||
|
+#include <linux/kernel.h>
|
||||||
|
+#include <linux/init.h>
|
||||||
|
+#include <linux/leds.h>
|
||||||
|
+#include <linux/gpio.h>
|
||||||
|
+#include "../leds.h"
|
||||||
|
+
|
||||||
|
+/* This is a hack to get at the private 'gpio' member */
|
||||||
|
+
|
||||||
|
+struct gpio_led_data {
|
||||||
|
+ struct led_classdev cdev;
|
||||||
|
+ unsigned gpio;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static void input_trig_activate(struct led_classdev *led_cdev)
|
||||||
|
+{
|
||||||
|
+ struct gpio_led_data *led_dat =
|
||||||
|
+ container_of(led_cdev, struct gpio_led_data, cdev);
|
||||||
|
+ if (gpio_is_valid(led_dat->gpio))
|
||||||
|
+ gpio_direction_input(led_dat->gpio);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void input_trig_deactivate(struct led_classdev *led_cdev)
|
||||||
|
+{
|
||||||
|
+ struct gpio_led_data *led_dat =
|
||||||
|
+ container_of(led_cdev, struct gpio_led_data, cdev);
|
||||||
|
+ if (gpio_is_valid(led_dat->gpio))
|
||||||
|
+ gpio_direction_output(led_dat->gpio, 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static struct led_trigger input_led_trigger = {
|
||||||
|
+ .name = "input",
|
||||||
|
+ .activate = input_trig_activate,
|
||||||
|
+ .deactivate = input_trig_deactivate,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int __init input_trig_init(void)
|
||||||
|
+{
|
||||||
|
+ return led_trigger_register(&input_led_trigger);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void __exit input_trig_exit(void)
|
||||||
|
+{
|
||||||
|
+ led_trigger_unregister(&input_led_trigger);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+module_init(input_trig_init);
|
||||||
|
+module_exit(input_trig_exit);
|
||||||
|
+
|
||||||
|
+MODULE_AUTHOR("Phil Elwell <phil@raspberrypi.org>");
|
||||||
|
+MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\"");
|
||||||
|
+MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
|
From 7fa07e9f8c88a5a628b9ca8a843d3490a59fb9cb Mon Sep 17 00:00:00 2001
|
||||||
|
From: android <trevd1234@gmail.com>
|
||||||
|
Date: Mon, 25 Aug 2014 13:18:21 +0100
|
||||||
|
Subject: [PATCH 2/5] BCM2708_VCIO : Add automatic creation of device node
|
||||||
|
|
||||||
|
---
|
||||||
|
arch/arm/mach-bcm2708/vcio.c | 12 +++++++++++-
|
||||||
|
arch/arm/mach-bcm2709/vcio.c | 12 +++++++++++-
|
||||||
|
2 files changed, 22 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c
|
||||||
|
index 5e43e85..700bff4 100644
|
||||||
|
--- a/arch/arm/mach-bcm2708/vcio.c
|
||||||
|
+++ b/arch/arm/mach-bcm2708/vcio.c
|
||||||
|
@@ -61,7 +61,7 @@
|
||||||
|
#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4)
|
||||||
|
|
||||||
|
#define MBOX_MAGIC 0xd0d0c0de
|
||||||
|
-
|
||||||
|
+static struct class *vcio_class = NULL;
|
||||||
|
struct vc_mailbox {
|
||||||
|
struct device *dev; /* parent device */
|
||||||
|
void __iomem *status;
|
||||||
|
@@ -421,6 +421,13 @@ static int bcm_vcio_probe(struct platform_device *pdev)
|
||||||
|
"Failed registering the character device %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
+ vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME);
|
||||||
|
+ if (IS_ERR(vcio_class)) {
|
||||||
|
+ ret = PTR_ERR(vcio_class);
|
||||||
|
+ return ret ;
|
||||||
|
+ }
|
||||||
|
+ device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL,
|
||||||
|
+ "vcio");
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@@ -462,6 +469,9 @@ static int __init bcm_mbox_init(void)
|
||||||
|
|
||||||
|
static void __exit bcm_mbox_exit(void)
|
||||||
|
{
|
||||||
|
+ device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0));
|
||||||
|
+ class_destroy(vcio_class);
|
||||||
|
+ unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME);
|
||||||
|
platform_driver_unregister(&bcm_mbox_driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/arch/arm/mach-bcm2709/vcio.c b/arch/arm/mach-bcm2709/vcio.c
|
||||||
|
index 5e43e85..700bff4 100644
|
||||||
|
--- a/arch/arm/mach-bcm2709/vcio.c
|
||||||
|
+++ b/arch/arm/mach-bcm2709/vcio.c
|
||||||
|
@@ -61,7 +61,7 @@
|
||||||
|
#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4)
|
||||||
|
|
||||||
|
#define MBOX_MAGIC 0xd0d0c0de
|
||||||
|
-
|
||||||
|
+static struct class *vcio_class = NULL;
|
||||||
|
struct vc_mailbox {
|
||||||
|
struct device *dev; /* parent device */
|
||||||
|
void __iomem *status;
|
||||||
|
@@ -421,6 +421,13 @@ static int bcm_vcio_probe(struct platform_device *pdev)
|
||||||
|
"Failed registering the character device %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
+ vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME);
|
||||||
|
+ if (IS_ERR(vcio_class)) {
|
||||||
|
+ ret = PTR_ERR(vcio_class);
|
||||||
|
+ return ret ;
|
||||||
|
+ }
|
||||||
|
+ device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL,
|
||||||
|
+ "vcio");
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@@ -462,6 +469,9 @@ static int __init bcm_mbox_init(void)
|
||||||
|
|
||||||
|
static void __exit bcm_mbox_exit(void)
|
||||||
|
{
|
||||||
|
+ device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0));
|
||||||
|
+ class_destroy(vcio_class);
|
||||||
|
+ unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME);
|
||||||
|
platform_driver_unregister(&bcm_mbox_driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
From 58ee33ad32d4a00735252718f8bac3f7592af6e7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: jeanleflambeur <catalin.vasile@gmail.com>
|
||||||
|
Date: Sun, 1 Feb 2015 12:35:38 +0100
|
||||||
|
Subject: [PATCH 3/5] Fix grabbing lock from atomic context in i2c driver
|
||||||
|
|
||||||
|
2 main changes:
|
||||||
|
- check for timeouts in the bcm2708_bsc_setup function as indicated by this comment:
|
||||||
|
/* poll for transfer start bit (should only take 1-20 polls) */
|
||||||
|
This implies that the setup function can now fail so account for this everywhere it's called
|
||||||
|
- Removed the clk_get_rate call from inside the setup function as it locks a mutex and that's not ok since we call it from under a spin lock.
|
||||||
|
|
||||||
|
removed dead code and update comment
|
||||||
|
|
||||||
|
fixed typo in comment
|
||||||
|
---
|
||||||
|
drivers/i2c/busses/i2c-bcm2708.c | 90 +++++++++++++++++++++++++++++-----------
|
||||||
|
1 file changed, 65 insertions(+), 25 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c
|
||||||
|
index fda59ba..81e9374 100644
|
||||||
|
--- a/drivers/i2c/busses/i2c-bcm2708.c
|
||||||
|
+++ b/drivers/i2c/busses/i2c-bcm2708.c
|
||||||
|
@@ -68,6 +68,7 @@
|
||||||
|
#define BSC_S_TA 0x00000001
|
||||||
|
|
||||||
|
#define I2C_TIMEOUT_MS 150
|
||||||
|
+#define I2C_WAIT_LOOP_COUNT 40
|
||||||
|
|
||||||
|
#define DRV_NAME "bcm2708_i2c"
|
||||||
|
|
||||||
|
@@ -86,6 +87,7 @@ struct bcm2708_i2c {
|
||||||
|
void __iomem *base;
|
||||||
|
int irq;
|
||||||
|
struct clk *clk;
|
||||||
|
+ u32 cdiv;
|
||||||
|
|
||||||
|
struct completion done;
|
||||||
|
|
||||||
|
@@ -109,10 +111,10 @@ static void bcm2708_i2c_init_pinmode(int id)
|
||||||
|
int pin;
|
||||||
|
u32 *gpio = ioremap(GPIO_BASE, SZ_16K);
|
||||||
|
|
||||||
|
- BUG_ON(id != 0 && id != 1);
|
||||||
|
+ BUG_ON(id != 0 && id != 1);
|
||||||
|
/* BSC0 is on GPIO 0 & 1, BSC1 is on GPIO 2 & 3 */
|
||||||
|
for (pin = id*2+0; pin <= id*2+1; pin++) {
|
||||||
|
-printk("bcm2708_i2c_init_pinmode(%d,%d)\n", id, pin);
|
||||||
|
+ printk("bcm2708_i2c_init_pinmode(%d,%d)\n", id, pin);
|
||||||
|
INP_GPIO(pin); /* set mode to GPIO input first */
|
||||||
|
SET_GPIO_ALT(pin, 0); /* set mode to ALT 0 */
|
||||||
|
}
|
||||||
|
@@ -151,16 +153,16 @@ static inline void bcm2708_bsc_fifo_fill(struct bcm2708_i2c *bi)
|
||||||
|
bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static inline void bcm2708_bsc_setup(struct bcm2708_i2c *bi)
|
||||||
|
+static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi)
|
||||||
|
{
|
||||||
|
- unsigned long bus_hz;
|
||||||
|
u32 cdiv, s;
|
||||||
|
u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1;
|
||||||
|
+ int wait_loops = I2C_WAIT_LOOP_COUNT;
|
||||||
|
|
||||||
|
- bus_hz = clk_get_rate(bi->clk);
|
||||||
|
- cdiv = bus_hz / baudrate;
|
||||||
|
- if (cdiv > 0xffff)
|
||||||
|
- cdiv = 0xffff;
|
||||||
|
+ /* Can't call clk_get_rate as it locks a mutex and here we are spinlocked.
|
||||||
|
+ * Use the value that we cached in the probe.
|
||||||
|
+ */
|
||||||
|
+ cdiv = bi->cdiv;
|
||||||
|
|
||||||
|
if (bi->msg->flags & I2C_M_RD)
|
||||||
|
c |= BSC_C_INTR | BSC_C_READ;
|
||||||
|
@@ -177,17 +179,25 @@ static inline void bcm2708_bsc_setup(struct bcm2708_i2c *bi)
|
||||||
|
- Both messages to same slave address
|
||||||
|
- Write message can fit inside FIFO (16 bytes or less) */
|
||||||
|
if ( (bi->nmsgs > 1) &&
|
||||||
|
- !(bi->msg[0].flags & I2C_M_RD) && (bi->msg[1].flags & I2C_M_RD) &&
|
||||||
|
- (bi->msg[0].addr == bi->msg[1].addr) && (bi->msg[0].len <= 16)) {
|
||||||
|
+ !(bi->msg[0].flags & I2C_M_RD) && (bi->msg[1].flags & I2C_M_RD) &&
|
||||||
|
+ (bi->msg[0].addr == bi->msg[1].addr) && (bi->msg[0].len <= 16)) {
|
||||||
|
/* Fill FIFO with entire write message (16 byte FIFO) */
|
||||||
|
- while (bi->pos < bi->msg->len)
|
||||||
|
+ while (bi->pos < bi->msg->len) {
|
||||||
|
bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]);
|
||||||
|
+ }
|
||||||
|
/* Start write transfer (no interrupts, don't clear FIFO) */
|
||||||
|
bcm2708_wr(bi, BSC_C, BSC_C_I2CEN | BSC_C_ST);
|
||||||
|
+
|
||||||
|
/* poll for transfer start bit (should only take 1-20 polls) */
|
||||||
|
do {
|
||||||
|
s = bcm2708_rd(bi, BSC_S);
|
||||||
|
- } while (!(s & (BSC_S_TA | BSC_S_ERR | BSC_S_CLKT | BSC_S_DONE)));
|
||||||
|
+ } while (!(s & (BSC_S_TA | BSC_S_ERR | BSC_S_CLKT | BSC_S_DONE)) && --wait_loops >= 0);
|
||||||
|
+
|
||||||
|
+ /* did we time out or some error occured? */
|
||||||
|
+ if (wait_loops < 0 || (s & (BSC_S_ERR | BSC_S_CLKT))) {
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Send next read message before the write transfer finishes. */
|
||||||
|
bi->nmsgs--;
|
||||||
|
bi->msg++;
|
||||||
|
@@ -197,6 +207,8 @@ static inline void bcm2708_bsc_setup(struct bcm2708_i2c *bi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bcm2708_wr(bi, BSC_C, c);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id)
|
||||||
|
@@ -204,13 +216,15 @@ static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id)
|
||||||
|
struct bcm2708_i2c *bi = dev_id;
|
||||||
|
bool handled = true;
|
||||||
|
u32 s;
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
|
spin_lock(&bi->lock);
|
||||||
|
|
||||||
|
/* we may see camera interrupts on the "other" I2C channel
|
||||||
|
- Just return if we've not sent anything */
|
||||||
|
- if (!bi->nmsgs || !bi->msg )
|
||||||
|
+ Just return if we've not sent anything */
|
||||||
|
+ if (!bi->nmsgs || !bi->msg) {
|
||||||
|
goto early_exit;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
s = bcm2708_rd(bi, BSC_S);
|
||||||
|
|
||||||
|
@@ -218,13 +232,16 @@ static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id)
|
||||||
|
bcm2708_bsc_reset(bi);
|
||||||
|
bi->error = true;
|
||||||
|
|
||||||
|
+ bi->msg = 0; /* to inform the that all work is done */
|
||||||
|
+ bi->nmsgs = 0;
|
||||||
|
/* wake up our bh */
|
||||||
|
complete(&bi->done);
|
||||||
|
} else if (s & BSC_S_DONE) {
|
||||||
|
bi->nmsgs--;
|
||||||
|
|
||||||
|
- if (bi->msg->flags & I2C_M_RD)
|
||||||
|
+ if (bi->msg->flags & I2C_M_RD) {
|
||||||
|
bcm2708_bsc_fifo_drain(bi);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
bcm2708_bsc_reset(bi);
|
||||||
|
|
||||||
|
@@ -232,8 +249,19 @@ static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id)
|
||||||
|
/* advance to next message */
|
||||||
|
bi->msg++;
|
||||||
|
bi->pos = 0;
|
||||||
|
- bcm2708_bsc_setup(bi);
|
||||||
|
+ ret = bcm2708_bsc_setup(bi);
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ bcm2708_bsc_reset(bi);
|
||||||
|
+ bi->error = true;
|
||||||
|
+ bi->msg = 0; /* to inform the that all work is done */
|
||||||
|
+ bi->nmsgs = 0;
|
||||||
|
+ /* wake up our bh */
|
||||||
|
+ complete(&bi->done);
|
||||||
|
+ goto early_exit;
|
||||||
|
+ }
|
||||||
|
} else {
|
||||||
|
+ bi->msg = 0; /* to inform the that all work is done */
|
||||||
|
+ bi->nmsgs = 0;
|
||||||
|
/* wake up our bh */
|
||||||
|
complete(&bi->done);
|
||||||
|
}
|
||||||
|
@@ -266,22 +294,33 @@ static int bcm2708_i2c_master_xfer(struct i2c_adapter *adap,
|
||||||
|
bi->nmsgs = num;
|
||||||
|
bi->error = false;
|
||||||
|
|
||||||
|
- bcm2708_bsc_setup(bi);
|
||||||
|
+ ret = bcm2708_bsc_setup(bi);
|
||||||
|
|
||||||
|
- /* unlockig _after_ the setup to avoid races with the interrupt routine */
|
||||||
|
spin_unlock_irqrestore(&bi->lock, flags);
|
||||||
|
|
||||||
|
- ret = wait_for_completion_timeout(&bi->done,
|
||||||
|
- msecs_to_jiffies(I2C_TIMEOUT_MS));
|
||||||
|
+ /* check the result of the setup */
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ {
|
||||||
|
+ dev_err(&adap->dev, "transfer setup timed out\n");
|
||||||
|
+ goto error_timeout;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ret = wait_for_completion_timeout(&bi->done, msecs_to_jiffies(I2C_TIMEOUT_MS));
|
||||||
|
if (ret == 0) {
|
||||||
|
dev_err(&adap->dev, "transfer timed out\n");
|
||||||
|
- spin_lock_irqsave(&bi->lock, flags);
|
||||||
|
- bcm2708_bsc_reset(bi);
|
||||||
|
- spin_unlock_irqrestore(&bi->lock, flags);
|
||||||
|
- return -ETIMEDOUT;
|
||||||
|
+ goto error_timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return bi->error ? -EIO : num;
|
||||||
|
+ ret = bi->error ? -EIO : num;
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+error_timeout:
|
||||||
|
+ spin_lock_irqsave(&bi->lock, flags);
|
||||||
|
+ bcm2708_bsc_reset(bi);
|
||||||
|
+ bi->msg = 0; /* to inform the interrupt handler that there's nothing else to be done */
|
||||||
|
+ bi->nmsgs = 0;
|
||||||
|
+ spin_unlock_irqrestore(&bi->lock, flags);
|
||||||
|
+ return -ETIMEDOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static u32 bcm2708_i2c_functionality(struct i2c_adapter *adap)
|
||||||
|
@@ -406,6 +445,7 @@ static int bcm2708_i2c_probe(struct platform_device *pdev)
|
||||||
|
cdiv = 0xffff;
|
||||||
|
baudrate = bus_hz / cdiv;
|
||||||
|
}
|
||||||
|
+ bi->cdiv = cdiv;
|
||||||
|
|
||||||
|
dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n",
|
||||||
|
pdev->id, (unsigned long)regs->start, irq, baudrate);
|
||||||
|
|
||||||
|
From 72df98feb0561f3b249c853f7722d2939df1dfa1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: popcornmix <popcornmix@gmail.com>
|
||||||
|
Date: Sun, 8 Feb 2015 11:30:07 +0000
|
||||||
|
Subject: [PATCH 4/5] config: Add ENC28J60 SPI ethernet module
|
||||||
|
|
||||||
|
---
|
||||||
|
arch/arm/configs/bcm2709_defconfig | 1 +
|
||||||
|
arch/arm/configs/bcmrpi_defconfig | 1 +
|
||||||
|
2 files changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
|
||||||
|
index 7bb9de6..c8577f6 100644
|
||||||
|
--- a/arch/arm/configs/bcm2709_defconfig
|
||||||
|
+++ b/arch/arm/configs/bcm2709_defconfig
|
||||||
|
@@ -423,6 +423,7 @@ CONFIG_MACVLAN=m
|
||||||
|
CONFIG_NETCONSOLE=m
|
||||||
|
CONFIG_TUN=m
|
||||||
|
CONFIG_VETH=m
|
||||||
|
+CONFIG_ENC28J60=m
|
||||||
|
CONFIG_MDIO_BITBANG=m
|
||||||
|
CONFIG_PPP=m
|
||||||
|
CONFIG_PPP_BSDCOMP=m
|
||||||
|
diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
|
||||||
|
index 3b09de9..9303cfb 100644
|
||||||
|
--- a/arch/arm/configs/bcmrpi_defconfig
|
||||||
|
+++ b/arch/arm/configs/bcmrpi_defconfig
|
||||||
|
@@ -416,6 +416,7 @@ CONFIG_MACVLAN=m
|
||||||
|
CONFIG_NETCONSOLE=m
|
||||||
|
CONFIG_TUN=m
|
||||||
|
CONFIG_VETH=m
|
||||||
|
+CONFIG_ENC28J60=m
|
||||||
|
CONFIG_MDIO_BITBANG=m
|
||||||
|
CONFIG_PPP=m
|
||||||
|
CONFIG_PPP_BSDCOMP=m
|
||||||
|
|
||||||
|
From 89d56313537f161a0d9b3888c0f39770cbb994a7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: popcornmix <popcornmix@gmail.com>
|
||||||
|
Date: Sun, 8 Feb 2015 13:17:00 +0000
|
||||||
|
Subject: [PATCH 5/5] ntp: Patch to fix false positives on 32bit systems
|
||||||
|
|
||||||
|
See: https://bugzilla.kernel.org/show_bug.cgi?id=92481
|
||||||
|
---
|
||||||
|
kernel/time/ntp.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
|
||||||
|
index 28bf91c..242774d 100644
|
||||||
|
--- a/kernel/time/ntp.c
|
||||||
|
+++ b/kernel/time/ntp.c
|
||||||
|
@@ -634,9 +634,9 @@ int ntp_validate_timex(struct timex *txc)
|
||||||
|
return -EPERM;
|
||||||
|
|
||||||
|
if (txc->modes & ADJ_FREQUENCY) {
|
||||||
|
- if (LONG_MIN / PPM_SCALE > txc->freq)
|
||||||
|
+ if (LLONG_MIN / PPM_SCALE > txc->freq)
|
||||||
|
return -EINVAL;
|
||||||
|
- if (LONG_MAX / PPM_SCALE < txc->freq)
|
||||||
|
+ if (LLONG_MAX / PPM_SCALE < txc->freq)
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user