mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 07:34:31 +00:00
pinctrl: exynos: add support for multiple pin banks
Iterate all pin banks to find a pin Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com> Cc: Minkyu Kang <mk7.kang@samsung.com>
This commit is contained in:
parent
85fcf94160
commit
d8428f73c3
1 changed files with 22 additions and 6 deletions
|
@ -5,6 +5,7 @@
|
||||||
* Thomas Abraham <thomas.ab@samsung.com>
|
* Thomas Abraham <thomas.ab@samsung.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <log.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -38,9 +39,9 @@ static unsigned long pin_to_bank_base(struct udevice *dev, const char *pin_name,
|
||||||
u32 *pin)
|
u32 *pin)
|
||||||
{
|
{
|
||||||
struct exynos_pinctrl_priv *priv = dev_get_priv(dev);
|
struct exynos_pinctrl_priv *priv = dev_get_priv(dev);
|
||||||
const struct samsung_pin_ctrl *pin_ctrl = priv->pin_ctrl;
|
const struct samsung_pin_ctrl *pin_ctrl_array = priv->pin_ctrl;
|
||||||
const struct samsung_pin_bank_data *bank_data = pin_ctrl->pin_banks;
|
const struct samsung_pin_bank_data *bank_data;
|
||||||
u32 nr_banks = pin_ctrl->nr_banks, idx = 0;
|
u32 nr_banks, pin_ctrl_idx = 0, idx = 0, bank_base;
|
||||||
char bank[10];
|
char bank[10];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -55,11 +56,26 @@ static unsigned long pin_to_bank_base(struct udevice *dev, const char *pin_name,
|
||||||
*pin = pin_name[++idx] - '0';
|
*pin = pin_name[++idx] - '0';
|
||||||
|
|
||||||
/* lookup the pin bank data using the pin bank name */
|
/* lookup the pin bank data using the pin bank name */
|
||||||
for (idx = 0; idx < nr_banks; idx++)
|
while (true) {
|
||||||
if (!strcmp(bank, bank_data[idx].name))
|
const struct samsung_pin_ctrl *pin_ctrl = &pin_ctrl_array[pin_ctrl_idx];
|
||||||
|
|
||||||
|
nr_banks = pin_ctrl->nr_banks;
|
||||||
|
if (!nr_banks)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
return priv->base + bank_data[idx].offset;
|
bank_data = pin_ctrl->pin_banks;
|
||||||
|
for (idx = 0; idx < nr_banks; idx++) {
|
||||||
|
debug("pinctrl[%d] bank_data[%d] name is: %s\n",
|
||||||
|
pin_ctrl_idx, idx, bank_data[idx].name);
|
||||||
|
if (!strcmp(bank, bank_data[idx].name)) {
|
||||||
|
bank_base = priv->base + bank_data[idx].offset;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pin_ctrl_idx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bank_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue