Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 362967
b: refs/heads/master
c: 477ac77
h: refs/heads/master
i:
  362965: 3963090
  362963: b6e9b51
  362959: 3a15edf
v: v3
  • Loading branch information
Haojian Zhuang authored and Linus Walleij committed Mar 7, 2013
1 parent 5b8eae2 commit 539cbfc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9cfd1724f070ffce27861cb7dcfca6808fd722b8
refs/heads/master: 477ac771dd25d1cacfb832394f5207343508bdb4
26 changes: 22 additions & 4 deletions trunk/drivers/pinctrl/pinctrl-single.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector,
int i;

pcs = pinctrl_dev_get_drvdata(pctldev);
/* If function mask is null, needn't enable it. */
if (!pcs->fmask)
return 0;
func = radix_tree_lookup(&pcs->ftree, fselector);
if (!func)
return -EINVAL;
Expand Down Expand Up @@ -384,6 +387,10 @@ static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector,
int i;

pcs = pinctrl_dev_get_drvdata(pctldev);
/* If function mask is null, needn't disable it. */
if (!pcs->fmask)
return;

func = radix_tree_lookup(&pcs->ftree, fselector);
if (!func) {
dev_err(pcs->dev, "%s could not find function%i\n",
Expand Down Expand Up @@ -427,6 +434,10 @@ static int pcs_request_gpio(struct pinctrl_dev *pctldev,
int mux_bytes = 0;
unsigned data;

/* If function mask is null, return directly. */
if (!pcs->fmask)
return -ENOTSUPP;

list_for_each_safe(pos, tmp, &pcs->gpiofuncs) {
frange = list_entry(pos, struct pcs_gpiofunc_range, node);
if (pin >= frange->offset + frange->npins
Expand Down Expand Up @@ -969,10 +980,17 @@ static int pcs_probe(struct platform_device *pdev)
PCS_GET_PROP_U32("pinctrl-single,register-width", &pcs->width,
"register width not specified\n");

PCS_GET_PROP_U32("pinctrl-single,function-mask", &pcs->fmask,
"function register mask not specified\n");
pcs->fshift = ffs(pcs->fmask) - 1;
pcs->fmax = pcs->fmask >> pcs->fshift;
ret = of_property_read_u32(np, "pinctrl-single,function-mask",
&pcs->fmask);
if (!ret) {
pcs->fshift = ffs(pcs->fmask) - 1;
pcs->fmax = pcs->fmask >> pcs->fshift;
} else {
/* If mask property doesn't exist, function mux is invalid. */
pcs->fmask = 0;
pcs->fshift = 0;
pcs->fmax = 0;
}

ret = of_property_read_u32(np, "pinctrl-single,function-off",
&pcs->foff);
Expand Down

0 comments on commit 539cbfc

Please sign in to comment.