mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 13:43:28 +00:00
pinctrl: exynos: Convert to use livetree API for fdt access
Use counterpart dev_read_* functions instead of fdt* ones. It fixes checkpatch warnings like this: WARNING: Use the livetree API (dev_read_...) #54: FILE: drivers/pinctrl/exynos/pinctrl-exynos.c:137: pinvals[idx] = fdtdec_get_int(fdt, node, and also makes it possible to avoid using the global data pointer in the driver. No functional change. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
This commit is contained in:
parent
da06fefcef
commit
5bf111b77c
1 changed files with 8 additions and 12 deletions
|
@ -9,12 +9,9 @@
|
|||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <errno.h>
|
||||
#include <asm/global_data.h>
|
||||
#include <asm/io.h>
|
||||
#include "pinctrl-exynos.h"
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* CON, DAT, PUD, DRV */
|
||||
const struct samsung_pin_bank_type bank_type_alive = {
|
||||
.fld_width = { 4, 1, 2, 2, },
|
||||
|
@ -118,8 +115,6 @@ static void exynos_pinctrl_set_pincfg(unsigned long reg_base, u32 pin_num,
|
|||
int exynos_pinctrl_set_state(struct udevice *dev, struct udevice *config)
|
||||
{
|
||||
struct exynos_pinctrl_priv *priv = dev_get_priv(dev);
|
||||
const void *fdt = gd->fdt_blob;
|
||||
int node = dev_of_offset(config);
|
||||
unsigned int count, idx;
|
||||
unsigned int pinvals[PINCFG_TYPE_NUM];
|
||||
|
||||
|
@ -127,13 +122,13 @@ int exynos_pinctrl_set_state(struct udevice *dev, struct udevice *config)
|
|||
* refer to the following document for the pinctrl bindings
|
||||
* linux/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
|
||||
*/
|
||||
count = fdt_stringlist_count(fdt, node, "samsung,pins");
|
||||
count = dev_read_string_count(config, "samsung,pins");
|
||||
if (count <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
for (idx = 0; idx < PINCFG_TYPE_NUM; ++idx) {
|
||||
pinvals[idx] = fdtdec_get_int(fdt, node,
|
||||
exynos_pinctrl_props[idx], -1);
|
||||
pinvals[idx] = dev_read_u32_default(config,
|
||||
exynos_pinctrl_props[idx], -1);
|
||||
}
|
||||
pinvals[PINCFG_TYPE_DAT] = -1; /* ignore GPIO data register */
|
||||
|
||||
|
@ -142,12 +137,13 @@ int exynos_pinctrl_set_state(struct udevice *dev, struct udevice *config)
|
|||
unsigned int pin_num;
|
||||
char bank_name[10];
|
||||
unsigned long reg;
|
||||
const char *name;
|
||||
int pincfg;
|
||||
const char *name = NULL;
|
||||
int pincfg, err;
|
||||
|
||||
name = fdt_stringlist_get(fdt, node, "samsung,pins", idx, NULL);
|
||||
if (!name)
|
||||
err = dev_read_string_index(config, "samsung,pins", idx, &name);
|
||||
if (err || !name)
|
||||
continue;
|
||||
|
||||
parse_pin(name, &pin_num, bank_name);
|
||||
bank = get_bank(dev, bank_name);
|
||||
reg = priv->base + bank->offset;
|
||||
|
|
Loading…
Reference in a new issue