Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lategoodbye/2a54ebc710f91a1a9703d66da170e0b8 to your computer and use it in GitHub Desktop.
Save lategoodbye/2a54ebc710f91a1a9703d66da170e0b8 to your computer and use it in GitHub Desktop.
Add virtual pinctrl function in order to reserve them for videocore
From d188c03c1fba7d1223c1dafcb8b977e383298ef4 Mon Sep 17 00:00:00 2001
From: Linus Walleij <[email protected]>
Date: Wed, 15 Mar 2017 09:45:37 +0100
Subject: [PATCH] Stab at videocore function
Signed-off-by: Linus Walleij <[email protected]>
---
drivers/pinctrl/bcm/pinctrl-bcm2835.c | 9 +++++++++
include/dt-bindings/pinctrl/bcm2835.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 85d009112864..213ca5117bd3 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -41,6 +41,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/types.h>
+#include <dt-bindings/pinctrl/bcm2835.h>
#define MODULE_NAME "pinctrl-bcm2835"
#define BCM2835_NUM_GPIOS 54
@@ -226,6 +227,9 @@ enum bcm2835_fsel {
BCM2835_FSEL_MASK = 0x7,
};
+/* This function can no be configured in the hardware register */
+#define BCM2835_FSEL_VIDEOCORE 8
+
static const char * const bcm2835_functions[BCM2835_FSEL_COUNT] = {
[BCM2835_FSEL_GPIO_IN] = "gpio_in",
[BCM2835_FSEL_GPIO_OUT] = "gpio_out",
@@ -235,6 +239,7 @@ static const char * const
bcm2835_functions[BCM2835_FSEL_COUNT] = {
[BCM2835_FSEL_ALT3] = "alt3",
[BCM2835_FSEL_ALT4] = "alt4",
[BCM2835_FSEL_ALT5] = "alt5",
+ [BCM2835_FSEL_VIDEOCORE] = "videocore",
};
static const char * const irq_type_names[] = {
@@ -879,6 +884,10 @@ static int bcm2835_pmx_set(struct pinctrl_dev *pctldev,
{
struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev);
+ /* This pin is set as used by the videocore - do nothing */
+ if (func_selector == BCM2835_FSEL_VIDEOCORE)
+ return 0;
+
bcm2835_pinctrl_fsel_set(pc, group_selector, func_selector);
return 0;
diff --git a/include/dt-bindings/pinctrl/bcm2835.h
b/include/dt-bindings/pinctrl/bcm2835.h
index e4e4fdf5d38f..2de2a2eb2fbc 100644
--- a/include/dt-bindings/pinctrl/bcm2835.h
+++ b/include/dt-bindings/pinctrl/bcm2835.h
@@ -23,6 +23,7 @@
#define BCM2835_FSEL_ALT1 5
#define BCM2835_FSEL_ALT2 6
#define BCM2835_FSEL_ALT3 7
+#define BCM2835_FSEL_VIDEOCORE 8
/* brcm,pull property */
#define BCM2835_PUD_OFF 0
--
2.9.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment