-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from siemens/staging
Merge staging to master for V2.1.2
- Loading branch information
Showing
23 changed files
with
884 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
...ecipes-kernel/linux/files/0007-serial-8250_pci-Add-support-for-accessing-red-LED-vi.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
From 403bfe046b658799a8735cf890da21f8e42280bc Mon Sep 17 00:00:00 2001 | ||
From: Frank Ehlis <[email protected]> | ||
Date: Thu, 29 Sep 2016 14:48:52 +0200 | ||
Subject: [PATCH] serial: 8250_pci: Add support for accessing red LED via ledfs | ||
|
||
The LED-init was moved past pci_default_setup() so that | ||
port.membase is valid when saving it to our private data. | ||
|
||
Signed-off-by: Frank Ehlis <[email protected]> | ||
--- | ||
drivers/tty/serial/8250/8250_pci.c | 72 +++++++++++++++++++++++++++++++++++++- | ||
1 file changed, 71 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c | ||
index 34baa78..829e9fc 100644 | ||
--- a/drivers/tty/serial/8250/8250_pci.c | ||
+++ b/drivers/tty/serial/8250/8250_pci.c | ||
@@ -23,6 +23,7 @@ | ||
#include <linux/bitops.h> | ||
#include <linux/rational.h> | ||
#include <linux/dmi.h> | ||
+#include <linux/leds.h> | ||
|
||
#include <asm/byteorder.h> | ||
#include <asm/io.h> | ||
@@ -1806,6 +1807,12 @@ xr17v35x_has_slave(struct serial_private *priv) | ||
|
||
/* IOT2000 MPIOs 8..15 */ | ||
#define IOT2000_UARTS_ENABLE 0x03 | ||
+#define IOT2000_UART_LED_RED 0x04 | ||
+ | ||
+#define IOT2000_UART_LEDFS_NAME "mpio_uart_led:red:user" | ||
+static struct iot2000_serial_private { | ||
+ u8 __iomem *membase; | ||
+}iot2000_priv; | ||
|
||
static int pci_iot2000_rs485_config(struct uart_port *port, | ||
struct serial_rs485 *rs485) | ||
@@ -1851,11 +1858,47 @@ static int pci_iot2000_rs485_config(struct uart_port *port, | ||
return 0; | ||
} | ||
|
||
+static void | ||
+iot2000_brightness_set(struct led_classdev *cdev, | ||
+ enum led_brightness brightness) | ||
+{ | ||
+ u8 __iomem *p = iot2000_priv.membase; | ||
+ u8 value; | ||
+ | ||
+ if ( iot2000_priv.membase == NULL ) | ||
+ return; | ||
+ | ||
+ value = readb(p + UART_EXAR_MPIOLVL_15_8); | ||
+ if (brightness == LED_OFF) | ||
+ value &= ~IOT2000_UART_LED_RED; | ||
+ else | ||
+ value |= IOT2000_UART_LED_RED; | ||
+ | ||
+ writeb(value, p + UART_EXAR_MPIOLVL_15_8); | ||
+} | ||
+ | ||
+static enum led_brightness | ||
+iot2000_brightness_get(struct led_classdev *cdev) | ||
+{ | ||
+ u8 __iomem *p = iot2000_priv.membase; | ||
+ u8 value; | ||
+ | ||
+ if ( iot2000_priv.membase == NULL ) | ||
+ return LED_OFF; | ||
+ | ||
+ value = readb(p + UART_EXAR_MPIOLVL_15_8); | ||
+ if (value & IOT2000_UART_LED_RED) | ||
+ return 1; | ||
+ | ||
+ return LED_OFF; | ||
+} | ||
+ | ||
static int | ||
pci_xr17v35x_setup(struct serial_private *priv, | ||
const struct pciserial_board *board, | ||
struct uart_8250_port *port, int idx) | ||
{ | ||
+ int ret; | ||
bool is_iot2000; | ||
u8 __iomem *p; | ||
|
||
@@ -1901,9 +1944,36 @@ pci_xr17v35x_setup(struct serial_private *priv, | ||
writeb(UART_FCTR_EXAR_TRGD, p + UART_EXAR_FCTR); | ||
writeb(128, p + UART_EXAR_TXTRG); | ||
writeb(128, p + UART_EXAR_RXTRG); | ||
+ | ||
iounmap(p); | ||
|
||
- return pci_default_setup(priv, board, port, idx); | ||
+ ret = pci_default_setup(priv, board, port, idx); | ||
+ | ||
+ /* on IOT2000, register the red LED attached to the MPIO */ | ||
+ if (is_iot2000 && (ret == 0) && (idx == 0)) { | ||
+ int err; | ||
+ struct led_classdev *led; | ||
+ char *name; | ||
+ size_t namesz = strlen(IOT2000_UART_LEDFS_NAME) + 1; | ||
+ | ||
+ led = kzalloc(sizeof(*led) + namesz, GFP_KERNEL); | ||
+ if (led) | ||
+ { | ||
+ name = (void*)&led[1]; | ||
+ snprintf(name, namesz, "%s", IOT2000_UART_LEDFS_NAME); | ||
+ iot2000_priv.membase = port->port.membase; | ||
+ led->name = name; | ||
+ led->max_brightness = 1; | ||
+ led->brightness_set = iot2000_brightness_set; | ||
+ led->brightness_get = iot2000_brightness_get; | ||
+ led->default_trigger = name; | ||
+ err = led_classdev_register((struct device *) | ||
+ port->port.dev, led); | ||
+ printk("IOT2000: Registered Led with err=%d\n", err); | ||
+ } | ||
+ } | ||
+ | ||
+ return ret; | ||
} | ||
|
||
#define PCI_DEVICE_ID_COMMTECH_4222PCI335 0x0004 | ||
-- | ||
2.1.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,6 @@ CONFIG_IE6XX_WDT=y | |
|
||
CONFIG_IP_NF_NAT=y | ||
|
||
CONFIG_R8712U=y | ||
CONFIG_RTL8XXXU=y | ||
CONFIG_RTL8192CU=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
meta-iot2000-bsp/recipes-tools/setledcolor/files/setledcolor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/python | ||
|
||
|
||
import mraa | ||
import sys | ||
import os | ||
|
||
def redled(state): | ||
redLedFile = "/sys/class/leds/mpio_uart_led:red:user/brightness" | ||
if(not os.path.isfile(redledFile)): | ||
print("Red LED not available") | ||
return | ||
file = open(redLedFile,'w') | ||
if(1==state): | ||
file.write("1") | ||
else: | ||
file.write("0") | ||
file.close() | ||
|
||
def greenled(state): | ||
ledpin = mraa.Gpio(13) | ||
ledpin.dir(mraa.DIR_OUT) | ||
if(1==state): | ||
ledpin.write(1) | ||
else: | ||
ledpin.write(0) | ||
|
||
if(len(sys.argv)<2): | ||
print("Usage: " + sys.argv[0] + " color") | ||
print("color:") | ||
print("0\t\tout") | ||
print("1\t\tgreen") | ||
print("2\t\tred") | ||
print("3\t\torange") | ||
sys.exit() | ||
|
||
x = int(sys.argv[1]) | ||
|
||
if(x%2 == 0): | ||
greenled(0) | ||
else: | ||
greenled(1) | ||
|
||
if(x/2 == 0): | ||
redled(0) | ||
else: | ||
redled(1) | ||
|
||
|
||
|
17 changes: 17 additions & 0 deletions
17
meta-iot2000-bsp/recipes-tools/setledcolor/setledcolor_0.1.bb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
DESCRIPTION = "This installs a small python script to handle the led color for the SIMATIC IOT2040" | ||
LICENSE = "MIT" | ||
LIC_FILES_CHKSUM = "file://${IOT2000_MIT_LICENSE};md5=838c366f69b72c5df05c96dff79b35f2" | ||
|
||
SRC_URI = "file://setledcolor.py" | ||
|
||
S = "${WORKDIR}" | ||
|
||
FILES_${PN} += "${sysconfdir}/setledcolor/setledcolor.py \ | ||
${bindir}/setledcolor" | ||
|
||
do_install() { | ||
install -d ${D}${sysconfdir}/setledcolor | ||
install -d ${D}${bindir} | ||
install -m 755 ${WORKDIR}/setledcolor.py ${D}${sysconfdir}/setledcolor/ | ||
ln -sf /etc/setledcolor/setledcolor.py ${D}${bindir}/setledcolor | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
meta-iot2000-example/recipes-core/firmware/firmware-nonfree.bb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
DESCRIPTION = "includes the firmware files for broadcom and realtek wifi devices" | ||
LICENSE = "MIT" | ||
LIC_FILES_CHKSUM = "file://${IOT2000_MIT_LICENSE};md5=838c366f69b72c5df05c96dff79b35f2" | ||
|
||
SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git" | ||
SRCREV = "a179db97914da5e650c21ba8f9b0bae04a0f8a41" | ||
S = "${WORKDIR}" | ||
INSTDIR = "/lib/firmware/" | ||
|
||
FILES_${PN} = "${INSTDIR}*" | ||
|
||
do_install() { | ||
install -d ${D}${INSTDIR} | ||
install -d ${D}${INSTDIR}brcm/ | ||
install -d ${D}${INSTDIR}rtlwifi/ | ||
cp -R ${S}/git/brcm/* ${D}${INSTDIR}brcm/ | ||
cp -R ${S}/git/rtlwifi/* ${D}${INSTDIR}rtlwifi/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CONFIG_LSUSB=y |
4 changes: 4 additions & 0 deletions
4
meta-iot2000-example/recipes-example/e2fsprogs/e2fsprogs_%.bbappend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#This recipe adds "resize2fs" as dependencie so it will be installed with the | ||
#default package | ||
|
||
RDEPENDS_e2fsprogs += " e2fsprogs-resize2fs" |
Oops, something went wrong.