Skip to content

Commit

Permalink
Merge tag 'pinctrl-fixes-rc6' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/linusw/linux-pinctrl

Pull pinctrl fixes from Linus Walleij:
 "This is a late pinctrl fix pull request, we had to revert out the
  pinctrl-single GPIO backend, because of, well, design issues.  We're
  cooking a better thing for the next cycle.

   - Revert gpio request/free backend, new patch set in the works, will
     be for v3.9.  Get this old cruft out before anyone hurts himself on
     it.
   - Kconfig buzz
   - Various compile warnings
   - MPP6 value for the Kirkwood"

* tag 'pinctrl-fixes-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
  pinctrl: nomadik: nmk_prcm_gpiocr_get_mode may be unused
  pinctrl: exynos: don't mark probing functions as __init
  Revert "pinctrl: single: support gpio request and free"
  pinctrl: mvebu: fix MPP6 value for kirkwood driver
  pinctrl: mvebu: Fix compiler warnings
  pinctrl: pinctrl-mxs: Fix variables' definition type
  pinctrl: samsung: removing duplicated condition for PINCTRL_SAMSUNG
  • Loading branch information
Linus Torvalds committed Jan 30, 2013
2 parents 6abb7c2 + 0fafd50 commit d6a3bf9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 94 deletions.
1 change: 0 additions & 1 deletion drivers/pinctrl/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ config PINCTRL_COH901

config PINCTRL_SAMSUNG
bool
depends on OF && GPIOLIB
select PINMUX
select PINCONF

Expand Down
2 changes: 1 addition & 1 deletion drivers/pinctrl/mvebu/pinctrl-dove.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ static int dove_pinctrl_probe(struct platform_device *pdev)
{
const struct of_device_id *match =
of_match_device(dove_pinctrl_of_match, &pdev->dev);
pdev->dev.platform_data = match->data;
pdev->dev.platform_data = (void *)match->data;

/*
* General MPP Configuration Register is part of pdma registers.
Expand Down
8 changes: 4 additions & 4 deletions drivers/pinctrl/mvebu/pinctrl-kirkwood.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ static struct mvebu_mpp_mode mv88f6xxx_mpp_modes[] = {
MPP_VAR_FUNCTION(0x5, "sata0", "act", V(0, 1, 1, 1, 1, 0)),
MPP_VAR_FUNCTION(0xb, "lcd", "vsync", V(0, 0, 0, 0, 1, 0))),
MPP_MODE(6,
MPP_VAR_FUNCTION(0x0, "sysrst", "out", V(1, 1, 1, 1, 1, 1)),
MPP_VAR_FUNCTION(0x1, "spi", "mosi", V(1, 1, 1, 1, 1, 1)),
MPP_VAR_FUNCTION(0x2, "ptp", "trig", V(1, 1, 1, 1, 0, 0))),
MPP_VAR_FUNCTION(0x1, "sysrst", "out", V(1, 1, 1, 1, 1, 1)),
MPP_VAR_FUNCTION(0x2, "spi", "mosi", V(1, 1, 1, 1, 1, 1)),
MPP_VAR_FUNCTION(0x3, "ptp", "trig", V(1, 1, 1, 1, 0, 0))),
MPP_MODE(7,
MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1, 1)),
MPP_VAR_FUNCTION(0x1, "pex", "rsto", V(1, 1, 1, 1, 0, 1)),
Expand Down Expand Up @@ -458,7 +458,7 @@ static int kirkwood_pinctrl_probe(struct platform_device *pdev)
{
const struct of_device_id *match =
of_match_device(kirkwood_pinctrl_of_match, &pdev->dev);
pdev->dev.platform_data = match->data;
pdev->dev.platform_data = (void *)match->data;
return mvebu_pinctrl_probe(pdev);
}

Expand Down
10 changes: 5 additions & 5 deletions drivers/pinctrl/pinctrl-exynos5440.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offse
}

/* parse the pin numbers listed in the 'samsung,exynos5440-pins' property */
static int __init exynos5440_pinctrl_parse_dt_pins(struct platform_device *pdev,
static int exynos5440_pinctrl_parse_dt_pins(struct platform_device *pdev,
struct device_node *cfg_np, unsigned int **pin_list,
unsigned int *npins)
{
Expand Down Expand Up @@ -630,7 +630,7 @@ static int __init exynos5440_pinctrl_parse_dt_pins(struct platform_device *pdev,
* Parse the information about all the available pin groups and pin functions
* from device node of the pin-controller.
*/
static int __init exynos5440_pinctrl_parse_dt(struct platform_device *pdev,
static int exynos5440_pinctrl_parse_dt(struct platform_device *pdev,
struct exynos5440_pinctrl_priv_data *priv)
{
struct device *dev = &pdev->dev;
Expand Down Expand Up @@ -723,7 +723,7 @@ static int __init exynos5440_pinctrl_parse_dt(struct platform_device *pdev,
}

/* register the pinctrl interface with the pinctrl subsystem */
static int __init exynos5440_pinctrl_register(struct platform_device *pdev,
static int exynos5440_pinctrl_register(struct platform_device *pdev,
struct exynos5440_pinctrl_priv_data *priv)
{
struct device *dev = &pdev->dev;
Expand Down Expand Up @@ -798,7 +798,7 @@ static int __init exynos5440_pinctrl_register(struct platform_device *pdev,
}

/* register the gpiolib interface with the gpiolib subsystem */
static int __init exynos5440_gpiolib_register(struct platform_device *pdev,
static int exynos5440_gpiolib_register(struct platform_device *pdev,
struct exynos5440_pinctrl_priv_data *priv)
{
struct gpio_chip *gc;
Expand Down Expand Up @@ -831,7 +831,7 @@ static int __init exynos5440_gpiolib_register(struct platform_device *pdev,
}

/* unregister the gpiolib interface with the gpiolib subsystem */
static int __init exynos5440_gpiolib_unregister(struct platform_device *pdev,
static int exynos5440_gpiolib_unregister(struct platform_device *pdev,
struct exynos5440_pinctrl_priv_data *priv)
{
int ret = gpiochip_remove(priv->gc);
Expand Down
9 changes: 4 additions & 5 deletions drivers/pinctrl/pinctrl-mxs.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev,
static void mxs_dt_free_map(struct pinctrl_dev *pctldev,
struct pinctrl_map *map, unsigned num_maps)
{
int i;
u32 i;

for (i = 0; i < num_maps; i++) {
if (map[i].type == PIN_MAP_TYPE_MUX_GROUP)
Expand Down Expand Up @@ -203,7 +203,7 @@ static int mxs_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned selector,
void __iomem *reg;
u8 bank, shift;
u16 pin;
int i;
u32 i;

for (i = 0; i < g->npins; i++) {
bank = PINID_TO_BANK(g->pins[i]);
Expand Down Expand Up @@ -256,7 +256,7 @@ static int mxs_pinconf_group_set(struct pinctrl_dev *pctldev,
void __iomem *reg;
u8 ma, vol, pull, bank, shift;
u16 pin;
int i;
u32 i;

ma = CONFIG_TO_MA(config);
vol = CONFIG_TO_VOL(config);
Expand Down Expand Up @@ -345,8 +345,7 @@ static int mxs_pinctrl_parse_group(struct platform_device *pdev,
const char *propname = "fsl,pinmux-ids";
char *group;
int length = strlen(np->name) + SUFFIX_LEN;
int i;
u32 val;
u32 val, i;

group = devm_kzalloc(&pdev->dev, length, GFP_KERNEL);
if (!group)
Expand Down
2 changes: 1 addition & 1 deletion drivers/pinctrl/pinctrl-nomadik.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ int nmk_gpio_set_mode(int gpio, int gpio_mode)
}
EXPORT_SYMBOL(nmk_gpio_set_mode);

static int nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, int gpio)
static int __maybe_unused nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, int gpio)
{
int i;
u16 reg;
Expand Down
79 changes: 2 additions & 77 deletions drivers/pinctrl/pinctrl-single.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#define PCS_MUX_BITS_NAME "pinctrl-single,bits"
#define PCS_REG_NAME_LEN ((sizeof(unsigned long) * 2) + 1)
#define PCS_OFF_DISABLED ~0U
#define PCS_MAX_GPIO_VALUES 2

/**
* struct pcs_pingroup - pingroups for a function
Expand Down Expand Up @@ -77,16 +76,6 @@ struct pcs_function {
struct list_head node;
};

/**
* struct pcs_gpio_range - pinctrl gpio range
* @range: subrange of the GPIO number space
* @gpio_func: gpio function value in the pinmux register
*/
struct pcs_gpio_range {
struct pinctrl_gpio_range range;
int gpio_func;
};

/**
* struct pcs_data - wrapper for data needed by pinctrl framework
* @pa: pindesc array
Expand Down Expand Up @@ -414,26 +403,9 @@ static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector,
}

static int pcs_request_gpio(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, unsigned pin)
struct pinctrl_gpio_range *range, unsigned offset)
{
struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
struct pcs_gpio_range *gpio = NULL;
int end, mux_bytes;
unsigned data;

gpio = container_of(range, struct pcs_gpio_range, range);
end = range->pin_base + range->npins - 1;
if (pin < range->pin_base || pin > end) {
dev_err(pctldev->dev,
"pin %d isn't in the range of %d to %d\n",
pin, range->pin_base, end);
return -EINVAL;
}
mux_bytes = pcs->width / BITS_PER_BYTE;
data = pcs->read(pcs->base + pin * mux_bytes) & ~pcs->fmask;
data |= gpio->gpio_func;
pcs->write(data, pcs->base + pin * mux_bytes);
return 0;
return -ENOTSUPP;
}

static struct pinmux_ops pcs_pinmux_ops = {
Expand Down Expand Up @@ -907,49 +879,6 @@ static void pcs_free_resources(struct pcs_device *pcs)

static struct of_device_id pcs_of_match[];

static int pcs_add_gpio_range(struct device_node *node, struct pcs_device *pcs)
{
struct pcs_gpio_range *gpio;
struct device_node *child;
struct resource r;
const char name[] = "pinctrl-single";
u32 gpiores[PCS_MAX_GPIO_VALUES];
int ret, i = 0, mux_bytes = 0;

for_each_child_of_node(node, child) {
ret = of_address_to_resource(child, 0, &r);
if (ret < 0)
continue;
memset(gpiores, 0, sizeof(u32) * PCS_MAX_GPIO_VALUES);
ret = of_property_read_u32_array(child, "pinctrl-single,gpio",
gpiores, PCS_MAX_GPIO_VALUES);
if (ret < 0)
continue;
gpio = devm_kzalloc(pcs->dev, sizeof(*gpio), GFP_KERNEL);
if (!gpio) {
dev_err(pcs->dev, "failed to allocate pcs gpio\n");
return -ENOMEM;
}
gpio->range.name = devm_kzalloc(pcs->dev, sizeof(name),
GFP_KERNEL);
if (!gpio->range.name) {
dev_err(pcs->dev, "failed to allocate range name\n");
return -ENOMEM;
}
memcpy((char *)gpio->range.name, name, sizeof(name));

gpio->range.id = i++;
gpio->range.base = gpiores[0];
gpio->gpio_func = gpiores[1];
mux_bytes = pcs->width / BITS_PER_BYTE;
gpio->range.pin_base = (r.start - pcs->res->start) / mux_bytes;
gpio->range.npins = (r.end - r.start) / mux_bytes + 1;

pinctrl_add_gpio_range(pcs->pctl, &gpio->range);
}
return 0;
}

static int pcs_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
Expand Down Expand Up @@ -1046,10 +975,6 @@ static int pcs_probe(struct platform_device *pdev)
goto free;
}

ret = pcs_add_gpio_range(np, pcs);
if (ret < 0)
goto free;

dev_info(pcs->dev, "%i pins at pa %p size %u\n",
pcs->desc.npins, pcs->base, pcs->size);

Expand Down

0 comments on commit d6a3bf9

Please sign in to comment.