aboutsummaryrefslogtreecommitdiff
path: root/arch/sandbox
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-04 21:22:09 -0700
committerTom Rini <trini@konsulko.com>2021-03-03 15:40:47 -0500
commit8a45b2205749252f61d26508d5de9dcce020b2ef (patch)
treefac56f635fb7a10236dd41868a0b1629184ab39c /arch/sandbox
parentbe04f1ab4291c724a65d86a743b8b7938f15a54c (diff)
downloadu-boot-8a45b2205749252f61d26508d5de9dcce020b2ef.zip
u-boot-8a45b2205749252f61d26508d5de9dcce020b2ef.tar.gz
u-boot-8a45b2205749252f61d26508d5de9dcce020b2ef.tar.bz2
gpio: Add a way to read 3-way strapping pinsWIP/2021-03-03-gpio-improvements
Using the internal vs. external pull resistors it is possible to get 27 different combinations from 3 strapping pins. Add an implementation of this. This involves updating the sandbox GPIO driver to model external and (weaker) internal pull resistors. The get_value() method now takes account of what is driving a pin: sandbox: GPIOD_EXT_DRIVEN - in which case GPIO_EXT_HIGH provides the value outside source - in which case GPIO_EXT_PULL_UP/DOWN indicates the external state and we work the final state using those flags and the internal GPIOD_PULL_UP/DOWN flags Of course the outside source does not really exist in sandbox. We are just modelling it for test purpose. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox')
-rw-r--r--arch/sandbox/include/asm/gpio.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/sandbox/include/asm/gpio.h b/arch/sandbox/include/asm/gpio.h
index 33b83ea..9e10052 100644
--- a/arch/sandbox/include/asm/gpio.h
+++ b/arch/sandbox/include/asm/gpio.h
@@ -26,8 +26,11 @@
/* Our own private GPIO flags, which musn't conflict with GPIOD_... */
#define GPIOD_EXT_HIGH BIT(31) /* external source is high (else low) */
#define GPIOD_EXT_DRIVEN BIT(30) /* external source is driven */
+#define GPIOD_EXT_PULL_UP BIT(29) /* GPIO has external pull-up */
+#define GPIOD_EXT_PULL_DOWN BIT(28) /* GPIO has external pull-down */
-#define GPIOD_SANDBOX_MASK GENMASK(31, 30)
+#define GPIOD_EXT_PULL (BIT(28) | BIT(29))
+#define GPIOD_SANDBOX_MASK GENMASK(31, 28)
/**
* Return the simulated value of a GPIO (used only in sandbox test code)