Source
58
58
59
59
return 0;
60
60
}
61
61
62
62
static int amd_fch_gpio_direction_output(struct gpio_chip *gc,
63
63
unsigned int gpio, int value)
64
64
{
65
65
unsigned long flags;
66
66
struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc);
67
67
void __iomem *ptr = amd_fch_gpio_addr(priv, gpio);
68
+
u32 val;
68
69
69
70
spin_lock_irqsave(&priv->lock, flags);
70
-
writel_relaxed(readl_relaxed(ptr) | AMD_FCH_GPIO_FLAG_DIRECTION, ptr);
71
+
72
+
val = readl_relaxed(ptr);
73
+
if (value)
74
+
val |= AMD_FCH_GPIO_FLAG_WRITE;
75
+
else
76
+
val &= ~AMD_FCH_GPIO_FLAG_WRITE;
77
+
78
+
writel_relaxed(val | AMD_FCH_GPIO_FLAG_DIRECTION, ptr);
79
+
71
80
spin_unlock_irqrestore(&priv->lock, flags);
72
81
73
82
return 0;
74
83
}
75
84
76
85
static int amd_fch_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
77
86
{
78
87
int ret;
79
88
unsigned long flags;
80
89
struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc);