dm: gpio: Convert stm32f7 driver to livetree
Update the GPIO driver to support a live device tree. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
parent
77aace579a
commit
d876eaf2be
@ -16,14 +16,11 @@
|
|||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
|
||||||
#define MAX_SIZE_BANK_NAME 5
|
|
||||||
#define STM32_GPIOS_PER_BANK 16
|
#define STM32_GPIOS_PER_BANK 16
|
||||||
#define MODE_BITS(gpio_pin) (gpio_pin * 2)
|
#define MODE_BITS(gpio_pin) (gpio_pin * 2)
|
||||||
#define MODE_BITS_MASK 3
|
#define MODE_BITS_MASK 3
|
||||||
#define IN_OUT_BIT_INDEX(gpio_pin) (1UL << (gpio_pin))
|
#define IN_OUT_BIT_INDEX(gpio_pin) (1UL << (gpio_pin))
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
|
||||||
|
|
||||||
static int stm32_gpio_direction_input(struct udevice *dev, unsigned offset)
|
static int stm32_gpio_direction_input(struct udevice *dev, unsigned offset)
|
||||||
{
|
{
|
||||||
struct stm32_gpio_priv *priv = dev_get_priv(dev);
|
struct stm32_gpio_priv *priv = dev_get_priv(dev);
|
||||||
@ -82,17 +79,14 @@ static int gpio_stm32_probe(struct udevice *dev)
|
|||||||
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
|
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
|
||||||
struct stm32_gpio_priv *priv = dev_get_priv(dev);
|
struct stm32_gpio_priv *priv = dev_get_priv(dev);
|
||||||
fdt_addr_t addr;
|
fdt_addr_t addr;
|
||||||
char *name;
|
const char *name;
|
||||||
|
|
||||||
addr = devfdt_get_addr(dev);
|
addr = dev_read_addr(dev);
|
||||||
if (addr == FDT_ADDR_T_NONE)
|
if (addr == FDT_ADDR_T_NONE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
priv->regs = (struct stm32_gpio_regs *)addr;
|
priv->regs = (struct stm32_gpio_regs *)addr;
|
||||||
name = (char *)fdtdec_locate_byte_array(gd->fdt_blob,
|
name = dev_read_string(dev, "st,bank-name");
|
||||||
dev_of_offset(dev),
|
|
||||||
"st,bank-name",
|
|
||||||
MAX_SIZE_BANK_NAME);
|
|
||||||
if (!name)
|
if (!name)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
uc_priv->bank_name = name;
|
uc_priv->bank_name = name;
|
||||||
|
Loading…
Reference in New Issue
Block a user