mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-15 19:51:37 +00:00
Merge branch 'CR_4446_pinctrl_hal.feng' into 'jh7110-master'
CR 4446 pinctrl hal.feng See merge request sdk/u-boot!46
This commit is contained in:
commit
bd7c43e2d4
2 changed files with 20 additions and 2 deletions
|
@ -555,6 +555,7 @@
|
|||
reg-names = "control";
|
||||
interrupts = <91>;
|
||||
interrupt-controller;
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
ngpios = <64>;
|
||||
status = "okay";
|
||||
|
@ -566,6 +567,7 @@
|
|||
reg-names = "control";
|
||||
interrupts = <90>;
|
||||
interrupt-controller;
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
ngpios = <4>;
|
||||
status = "okay";
|
||||
|
|
|
@ -275,10 +275,25 @@ const struct pinctrl_ops starfive_pinctrl_ops = {
|
|||
.pinconf_set = starfive_pinconf_set,
|
||||
};
|
||||
|
||||
static int starfive_gpio_get_direction(struct udevice *dev, unsigned int off)
|
||||
{
|
||||
struct udevice *pdev = dev->parent;
|
||||
struct starfive_pinctrl_priv *priv = dev_get_priv(pdev);
|
||||
struct starfive_pinctrl_soc_info *info = priv->info;
|
||||
|
||||
unsigned int offset = 4 * (off / 4);
|
||||
unsigned int shift = 8 * (off % 4);
|
||||
u32 doen = readl(priv->base + info->doen_reg_base + offset);
|
||||
|
||||
doen = (doen >> shift) & info->doen_mask;
|
||||
|
||||
return doen == GPOEN_ENABLE ? GPIOF_OUTPUT : GPIOF_INPUT;
|
||||
}
|
||||
|
||||
static int starfive_gpio_direction_input(struct udevice *dev, unsigned int off)
|
||||
{
|
||||
struct udevice *pdev = dev->parent;
|
||||
struct starfive_pinctrl_priv *priv = dev_get_priv(dev);
|
||||
struct starfive_pinctrl_priv *priv = dev_get_priv(pdev);
|
||||
struct starfive_pinctrl_soc_info *info = priv->info;
|
||||
|
||||
/* enable input and schmitt trigger */
|
||||
|
@ -297,7 +312,7 @@ static int starfive_gpio_direction_output(struct udevice *dev,
|
|||
unsigned int off, int val)
|
||||
{
|
||||
struct udevice *pdev = dev->parent;
|
||||
struct starfive_pinctrl_priv *priv = dev_get_priv(dev);
|
||||
struct starfive_pinctrl_priv *priv = dev_get_priv(pdev);
|
||||
struct starfive_pinctrl_soc_info *info = priv->info;
|
||||
|
||||
if (info->set_one_pinmux)
|
||||
|
@ -365,6 +380,7 @@ static int starfive_gpio_probe(struct udevice *dev)
|
|||
}
|
||||
|
||||
static const struct dm_gpio_ops starfive_gpio_ops = {
|
||||
.get_function = starfive_gpio_get_direction,
|
||||
.direction_input = starfive_gpio_direction_input,
|
||||
.direction_output = starfive_gpio_direction_output,
|
||||
.get_value = starfive_gpio_get_value,
|
||||
|
|
Loading…
Add table
Reference in a new issue