Commit d4e62d00 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Simon Horman

sh-pfc: Split platform data from the sh_pfc structure

Create a sh_pfc_platform_data structure to store platform data and
reference it from the core sh_pfc structure.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarPaul Mundt <lethal@linux-sh.org>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
parent e62ebcdb
...@@ -21,18 +21,13 @@ ...@@ -21,18 +21,13 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/pinctrl/machine.h> #include <linux/pinctrl/machine.h>
static struct sh_pfc *sh_pfc __read_mostly; static struct sh_pfc sh_pfc __read_mostly;
static inline bool sh_pfc_initialized(void)
{
return !!sh_pfc;
}
static void pfc_iounmap(struct sh_pfc *pfc) static void pfc_iounmap(struct sh_pfc *pfc)
{ {
int k; int k;
for (k = 0; k < pfc->num_resources; k++) for (k = 0; k < pfc->pdata->num_resources; k++)
if (pfc->window[k].virt) if (pfc->window[k].virt)
iounmap(pfc->window[k].virt); iounmap(pfc->window[k].virt);
...@@ -45,16 +40,16 @@ static int pfc_ioremap(struct sh_pfc *pfc) ...@@ -45,16 +40,16 @@ static int pfc_ioremap(struct sh_pfc *pfc)
struct resource *res; struct resource *res;
int k; int k;
if (!pfc->num_resources) if (!pfc->pdata->num_resources)
return 0; return 0;
pfc->window = kzalloc(pfc->num_resources * sizeof(*pfc->window), pfc->window = kzalloc(pfc->pdata->num_resources * sizeof(*pfc->window),
GFP_NOWAIT); GFP_NOWAIT);
if (!pfc->window) if (!pfc->window)
goto err1; goto err1;
for (k = 0; k < pfc->num_resources; k++) { for (k = 0; k < pfc->pdata->num_resources; k++) {
res = pfc->resource + k; res = pfc->pdata->resource + k;
WARN_ON(resource_type(res) != IORESOURCE_MEM); WARN_ON(resource_type(res) != IORESOURCE_MEM);
pfc->window[k].phys = res->start; pfc->window[k].phys = res->start;
pfc->window[k].size = resource_size(res); pfc->window[k].size = resource_size(res);
...@@ -79,7 +74,7 @@ static void __iomem *pfc_phys_to_virt(struct sh_pfc *pfc, ...@@ -79,7 +74,7 @@ static void __iomem *pfc_phys_to_virt(struct sh_pfc *pfc,
int k; int k;
/* scan through physical windows and convert address */ /* scan through physical windows and convert address */
for (k = 0; k < pfc->num_resources; k++) { for (k = 0; k < pfc->pdata->num_resources; k++) {
window = pfc->window + k; window = pfc->window + k;
if (address < window->phys) if (address < window->phys)
...@@ -232,8 +227,8 @@ static void write_config_reg(struct sh_pfc *pfc, ...@@ -232,8 +227,8 @@ static void write_config_reg(struct sh_pfc *pfc,
data &= mask; data &= mask;
data |= value; data |= value;
if (pfc->unlock_reg) if (pfc->pdata->unlock_reg)
gpio_write_raw_reg(pfc_phys_to_virt(pfc, pfc->unlock_reg), gpio_write_raw_reg(pfc_phys_to_virt(pfc, pfc->pdata->unlock_reg),
32, ~data); 32, ~data);
gpio_write_raw_reg(mapped_reg, crp->reg_width, data); gpio_write_raw_reg(mapped_reg, crp->reg_width, data);
...@@ -241,16 +236,16 @@ static void write_config_reg(struct sh_pfc *pfc, ...@@ -241,16 +236,16 @@ static void write_config_reg(struct sh_pfc *pfc,
static int setup_data_reg(struct sh_pfc *pfc, unsigned gpio) static int setup_data_reg(struct sh_pfc *pfc, unsigned gpio)
{ {
struct pinmux_gpio *gpiop = &pfc->gpios[gpio]; struct pinmux_gpio *gpiop = &pfc->pdata->gpios[gpio];
struct pinmux_data_reg *data_reg; struct pinmux_data_reg *data_reg;
int k, n; int k, n;
if (!enum_in_range(gpiop->enum_id, &pfc->data)) if (!enum_in_range(gpiop->enum_id, &pfc->pdata->data))
return -1; return -1;
k = 0; k = 0;
while (1) { while (1) {
data_reg = pfc->data_regs + k; data_reg = pfc->pdata->data_regs + k;
if (!data_reg->reg_width) if (!data_reg->reg_width)
break; break;
...@@ -279,12 +274,12 @@ static void setup_data_regs(struct sh_pfc *pfc) ...@@ -279,12 +274,12 @@ static void setup_data_regs(struct sh_pfc *pfc)
struct pinmux_data_reg *drp; struct pinmux_data_reg *drp;
int k; int k;
for (k = pfc->first_gpio; k <= pfc->last_gpio; k++) for (k = pfc->pdata->first_gpio; k <= pfc->pdata->last_gpio; k++)
setup_data_reg(pfc, k); setup_data_reg(pfc, k);
k = 0; k = 0;
while (1) { while (1) {
drp = pfc->data_regs + k; drp = pfc->pdata->data_regs + k;
if (!drp->reg_width) if (!drp->reg_width)
break; break;
...@@ -298,15 +293,15 @@ static void setup_data_regs(struct sh_pfc *pfc) ...@@ -298,15 +293,15 @@ static void setup_data_regs(struct sh_pfc *pfc)
int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio, int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio,
struct pinmux_data_reg **drp, int *bitp) struct pinmux_data_reg **drp, int *bitp)
{ {
struct pinmux_gpio *gpiop = &pfc->gpios[gpio]; struct pinmux_gpio *gpiop = &pfc->pdata->gpios[gpio];
int k, n; int k, n;
if (!enum_in_range(gpiop->enum_id, &pfc->data)) if (!enum_in_range(gpiop->enum_id, &pfc->pdata->data))
return -1; return -1;
k = (gpiop->flags & PINMUX_FLAG_DREG) >> PINMUX_FLAG_DREG_SHIFT; k = (gpiop->flags & PINMUX_FLAG_DREG) >> PINMUX_FLAG_DREG_SHIFT;
n = (gpiop->flags & PINMUX_FLAG_DBIT) >> PINMUX_FLAG_DBIT_SHIFT; n = (gpiop->flags & PINMUX_FLAG_DBIT) >> PINMUX_FLAG_DBIT_SHIFT;
*drp = pfc->data_regs + k; *drp = pfc->pdata->data_regs + k;
*bitp = n; *bitp = n;
return 0; return 0;
} }
...@@ -323,7 +318,7 @@ static int get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id, ...@@ -323,7 +318,7 @@ static int get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id,
k = 0; k = 0;
while (1) { while (1) {
config_reg = pfc->cfg_regs + k; config_reg = pfc->pdata->cfg_regs + k;
r_width = config_reg->reg_width; r_width = config_reg->reg_width;
f_width = config_reg->field_width; f_width = config_reg->field_width;
...@@ -361,12 +356,12 @@ static int get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id, ...@@ -361,12 +356,12 @@ static int get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id,
int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos,
pinmux_enum_t *enum_idp) pinmux_enum_t *enum_idp)
{ {
pinmux_enum_t enum_id = pfc->gpios[gpio].enum_id; pinmux_enum_t enum_id = pfc->pdata->gpios[gpio].enum_id;
pinmux_enum_t *data = pfc->gpio_data; pinmux_enum_t *data = pfc->pdata->gpio_data;
int k; int k;
if (!enum_in_range(enum_id, &pfc->data)) { if (!enum_in_range(enum_id, &pfc->pdata->data)) {
if (!enum_in_range(enum_id, &pfc->mark)) { if (!enum_in_range(enum_id, &pfc->pdata->mark)) {
pr_err("non data/mark enum_id for gpio %d\n", gpio); pr_err("non data/mark enum_id for gpio %d\n", gpio);
return -1; return -1;
} }
...@@ -377,7 +372,7 @@ int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, ...@@ -377,7 +372,7 @@ int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos,
return pos + 1; return pos + 1;
} }
for (k = 0; k < pfc->gpio_data_size; k++) { for (k = 0; k < pfc->pdata->gpio_data_size; k++) {
if (data[k] == enum_id) { if (data[k] == enum_id) {
*enum_idp = data[k + 1]; *enum_idp = data[k + 1];
return k + 1; return k + 1;
...@@ -405,19 +400,19 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, ...@@ -405,19 +400,19 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
break; break;
case PINMUX_TYPE_OUTPUT: case PINMUX_TYPE_OUTPUT:
range = &pfc->output; range = &pfc->pdata->output;
break; break;
case PINMUX_TYPE_INPUT: case PINMUX_TYPE_INPUT:
range = &pfc->input; range = &pfc->pdata->input;
break; break;
case PINMUX_TYPE_INPUT_PULLUP: case PINMUX_TYPE_INPUT_PULLUP:
range = &pfc->input_pu; range = &pfc->pdata->input_pu;
break; break;
case PINMUX_TYPE_INPUT_PULLDOWN: case PINMUX_TYPE_INPUT_PULLDOWN:
range = &pfc->input_pd; range = &pfc->pdata->input_pd;
break; break;
default: default:
...@@ -437,7 +432,7 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, ...@@ -437,7 +432,7 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
break; break;
/* first check if this is a function enum */ /* first check if this is a function enum */
in_range = enum_in_range(enum_id, &pfc->function); in_range = enum_in_range(enum_id, &pfc->pdata->function);
if (!in_range) { if (!in_range) {
/* not a function enum */ /* not a function enum */
if (range) { if (range) {
...@@ -502,7 +497,7 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, ...@@ -502,7 +497,7 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
} }
EXPORT_SYMBOL_GPL(sh_pfc_config_gpio); EXPORT_SYMBOL_GPL(sh_pfc_config_gpio);
int register_sh_pfc(struct sh_pfc *pfc) int register_sh_pfc(struct sh_pfc_platform_data *pdata)
{ {
int (*initroutine)(struct sh_pfc *) = NULL; int (*initroutine)(struct sh_pfc *) = NULL;
int ret; int ret;
...@@ -512,26 +507,28 @@ int register_sh_pfc(struct sh_pfc *pfc) ...@@ -512,26 +507,28 @@ int register_sh_pfc(struct sh_pfc *pfc)
*/ */
BUILD_BUG_ON(PINMUX_FLAG_TYPE > ((1 << PINMUX_FLAG_DBIT_SHIFT) - 1)); BUILD_BUG_ON(PINMUX_FLAG_TYPE > ((1 << PINMUX_FLAG_DBIT_SHIFT) - 1));
if (sh_pfc) if (sh_pfc.pdata)
return -EBUSY; return -EBUSY;
ret = pfc_ioremap(pfc); sh_pfc.pdata = pdata;
if (unlikely(ret < 0))
ret = pfc_ioremap(&sh_pfc);
if (unlikely(ret < 0)) {
sh_pfc.pdata = NULL;
return ret; return ret;
}
spin_lock_init(&pfc->lock); spin_lock_init(&sh_pfc.lock);
pinctrl_provide_dummies(); pinctrl_provide_dummies();
setup_data_regs(pfc); setup_data_regs(&sh_pfc);
sh_pfc = pfc;
/* /*
* Initialize pinctrl bindings first * Initialize pinctrl bindings first
*/ */
initroutine = symbol_request(sh_pfc_register_pinctrl); initroutine = symbol_request(sh_pfc_register_pinctrl);
if (initroutine) { if (initroutine) {
ret = (*initroutine)(pfc); ret = (*initroutine)(&sh_pfc);
symbol_put_addr(initroutine); symbol_put_addr(initroutine);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
...@@ -546,7 +543,7 @@ int register_sh_pfc(struct sh_pfc *pfc) ...@@ -546,7 +543,7 @@ int register_sh_pfc(struct sh_pfc *pfc)
*/ */
initroutine = symbol_request(sh_pfc_register_gpiochip); initroutine = symbol_request(sh_pfc_register_gpiochip);
if (initroutine) { if (initroutine) {
ret = (*initroutine)(pfc); ret = (*initroutine)(&sh_pfc);
symbol_put_addr(initroutine); symbol_put_addr(initroutine);
/* /*
...@@ -560,13 +557,13 @@ int register_sh_pfc(struct sh_pfc *pfc) ...@@ -560,13 +557,13 @@ int register_sh_pfc(struct sh_pfc *pfc)
} }
} }
pr_info("%s support registered\n", pfc->name); pr_info("%s support registered\n", sh_pfc.pdata->name);
return 0; return 0;
err: err:
pfc_iounmap(pfc); pfc_iounmap(&sh_pfc);
sh_pfc = NULL; sh_pfc.pdata = NULL;
return ret; return ret;
} }
...@@ -103,11 +103,11 @@ static int sh_gpio_to_irq(struct gpio_chip *gc, unsigned offset) ...@@ -103,11 +103,11 @@ static int sh_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
if (pos <= 0 || !enum_id) if (pos <= 0 || !enum_id)
break; break;
for (i = 0; i < pfc->gpio_irq_size; i++) { for (i = 0; i < pfc->pdata->gpio_irq_size; i++) {
enum_ids = pfc->gpio_irq[i].enum_ids; enum_ids = pfc->pdata->gpio_irq[i].enum_ids;
for (k = 0; enum_ids[k]; k++) { for (k = 0; enum_ids[k]; k++) {
if (enum_ids[k] == enum_id) if (enum_ids[k] == enum_id)
return pfc->gpio_irq[i].irq; return pfc->pdata->gpio_irq[i].irq;
} }
} }
} }
...@@ -128,12 +128,12 @@ static void sh_pfc_gpio_setup(struct sh_pfc_chip *chip) ...@@ -128,12 +128,12 @@ static void sh_pfc_gpio_setup(struct sh_pfc_chip *chip)
gc->set = sh_gpio_set; gc->set = sh_gpio_set;
gc->to_irq = sh_gpio_to_irq; gc->to_irq = sh_gpio_to_irq;
WARN_ON(pfc->first_gpio != 0); /* needs testing */ WARN_ON(pfc->pdata->first_gpio != 0); /* needs testing */
gc->label = pfc->name; gc->label = pfc->pdata->name;
gc->owner = THIS_MODULE; gc->owner = THIS_MODULE;
gc->base = pfc->first_gpio; gc->base = pfc->pdata->first_gpio;
gc->ngpio = (pfc->last_gpio - pfc->first_gpio) + 1; gc->ngpio = (pfc->pdata->last_gpio - pfc->pdata->first_gpio) + 1;
} }
int sh_pfc_register_gpiochip(struct sh_pfc *pfc) int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
...@@ -154,7 +154,8 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) ...@@ -154,7 +154,8 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
kfree(chip); kfree(chip);
pr_info("%s handling gpio %d -> %d\n", pr_info("%s handling gpio %d -> %d\n",
pfc->name, pfc->first_gpio, pfc->last_gpio); pfc->pdata->name, pfc->pdata->first_gpio,
pfc->pdata->last_gpio);
return ret; return ret;
} }
...@@ -179,7 +180,7 @@ static int sh_pfc_gpio_probe(struct platform_device *pdev) ...@@ -179,7 +180,7 @@ static int sh_pfc_gpio_probe(struct platform_device *pdev)
chip = gpio_to_pfc_chip(gc); chip = gpio_to_pfc_chip(gc);
platform_set_drvdata(pdev, chip); platform_set_drvdata(pdev, chip);
pr_info("attaching to GPIO chip %s\n", chip->pfc->name); pr_info("attaching to GPIO chip %s\n", chip->pfc->pdata->name);
return 0; return 0;
} }
......
...@@ -140,7 +140,7 @@ static int sh_pfc_reconfig_pin(struct sh_pfc *pfc, unsigned offset, ...@@ -140,7 +140,7 @@ static int sh_pfc_reconfig_pin(struct sh_pfc *pfc, unsigned offset,
spin_lock_irqsave(&pfc->lock, flags); spin_lock_irqsave(&pfc->lock, flags);
pinmux_type = pfc->gpios[offset].flags & PINMUX_FLAG_TYPE; pinmux_type = pfc->pdata->gpios[offset].flags & PINMUX_FLAG_TYPE;
/* /*
* See if the present config needs to first be de-configured. * See if the present config needs to first be de-configured.
...@@ -172,8 +172,8 @@ static int sh_pfc_reconfig_pin(struct sh_pfc *pfc, unsigned offset, ...@@ -172,8 +172,8 @@ static int sh_pfc_reconfig_pin(struct sh_pfc *pfc, unsigned offset,
GPIO_CFG_REQ) != 0) GPIO_CFG_REQ) != 0)
goto err; goto err;
pfc->gpios[offset].flags &= ~PINMUX_FLAG_TYPE; pfc->pdata->gpios[offset].flags &= ~PINMUX_FLAG_TYPE;
pfc->gpios[offset].flags |= new_type; pfc->pdata->gpios[offset].flags |= new_type;
ret = 0; ret = 0;
...@@ -195,7 +195,7 @@ static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev, ...@@ -195,7 +195,7 @@ static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
spin_lock_irqsave(&pfc->lock, flags); spin_lock_irqsave(&pfc->lock, flags);
pinmux_type = pfc->gpios[offset].flags & PINMUX_FLAG_TYPE; pinmux_type = pfc->pdata->gpios[offset].flags & PINMUX_FLAG_TYPE;
switch (pinmux_type) { switch (pinmux_type) {
case PINMUX_TYPE_FUNCTION: case PINMUX_TYPE_FUNCTION:
...@@ -236,7 +236,7 @@ static void sh_pfc_gpio_disable_free(struct pinctrl_dev *pctldev, ...@@ -236,7 +236,7 @@ static void sh_pfc_gpio_disable_free(struct pinctrl_dev *pctldev,
spin_lock_irqsave(&pfc->lock, flags); spin_lock_irqsave(&pfc->lock, flags);
pinmux_type = pfc->gpios[offset].flags & PINMUX_FLAG_TYPE; pinmux_type = pfc->pdata->gpios[offset].flags & PINMUX_FLAG_TYPE;
sh_pfc_config_gpio(pfc, offset, pinmux_type, GPIO_CFG_FREE); sh_pfc_config_gpio(pfc, offset, pinmux_type, GPIO_CFG_FREE);
...@@ -270,7 +270,7 @@ static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin, ...@@ -270,7 +270,7 @@ static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin,
struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
struct sh_pfc *pfc = pmx->pfc; struct sh_pfc *pfc = pmx->pfc;
*config = pfc->gpios[pin].flags & PINMUX_FLAG_TYPE; *config = pfc->pdata->gpios[pin].flags & PINMUX_FLAG_TYPE;
return 0; return 0;
} }
...@@ -356,7 +356,7 @@ static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) ...@@ -356,7 +356,7 @@ static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx)
unsigned long flags; unsigned long flags;
int i; int i;
pmx->nr_pads = pfc->last_gpio - pfc->first_gpio + 1; pmx->nr_pads = pfc->pdata->last_gpio - pfc->pdata->first_gpio + 1;
pmx->pads = kmalloc(sizeof(struct pinctrl_pin_desc) * pmx->nr_pads, pmx->pads = kmalloc(sizeof(struct pinctrl_pin_desc) * pmx->nr_pads,
GFP_KERNEL); GFP_KERNEL);
...@@ -375,9 +375,9 @@ static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) ...@@ -375,9 +375,9 @@ static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx)
*/ */
for (i = 0; i < pmx->nr_pads; i++) { for (i = 0; i < pmx->nr_pads; i++) {
struct pinctrl_pin_desc *pin = pmx->pads + i; struct pinctrl_pin_desc *pin = pmx->pads + i;
struct pinmux_gpio *gpio = pfc->gpios + i; struct pinmux_gpio *gpio = pfc->pdata->gpios + i;
pin->number = pfc->first_gpio + i; pin->number = pfc->pdata->first_gpio + i;
pin->name = gpio->name; pin->name = gpio->name;
/* XXX */ /* XXX */
...@@ -408,7 +408,7 @@ static int sh_pfc_map_functions(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) ...@@ -408,7 +408,7 @@ static int sh_pfc_map_functions(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx)
spin_lock_irqsave(&pmx->lock, flags); spin_lock_irqsave(&pmx->lock, flags);
for (i = fn = 0; i < pmx->nr_pads; i++) { for (i = fn = 0; i < pmx->nr_pads; i++) {
struct pinmux_gpio *gpio = pfc->gpios + i; struct pinmux_gpio *gpio = pfc->pdata->gpios + i;
if ((gpio->flags & PINMUX_FLAG_TYPE) == PINMUX_TYPE_FUNCTION) if ((gpio->flags & PINMUX_FLAG_TYPE) == PINMUX_TYPE_FUNCTION)
pmx->functions[fn++] = gpio; pmx->functions[fn++] = gpio;
...@@ -444,9 +444,10 @@ static int sh_pfc_pinctrl_probe(struct platform_device *pdev) ...@@ -444,9 +444,10 @@ static int sh_pfc_pinctrl_probe(struct platform_device *pdev)
goto free_functions; goto free_functions;
} }
sh_pfc_gpio_range.npins = pfc->last_gpio - pfc->first_gpio + 1; sh_pfc_gpio_range.npins = pfc->pdata->last_gpio
sh_pfc_gpio_range.base = pfc->first_gpio; - pfc->pdata->first_gpio + 1;
sh_pfc_gpio_range.pin_base = pfc->first_gpio; sh_pfc_gpio_range.base = pfc->pdata->first_gpio;
sh_pfc_gpio_range.pin_base = pfc->pdata->first_gpio;
pinctrl_add_gpio_range(sh_pfc_pmx->pctl, &sh_pfc_gpio_range); pinctrl_add_gpio_range(sh_pfc_pmx->pctl, &sh_pfc_gpio_range);
......
...@@ -94,7 +94,7 @@ struct pfc_window { ...@@ -94,7 +94,7 @@ struct pfc_window {
unsigned long size; unsigned long size;
}; };
struct sh_pfc { struct sh_pfc_platform_data {
char *name; char *name;
pinmux_enum_t reserved_id; pinmux_enum_t reserved_id;
struct pinmux_range data; struct pinmux_range data;
...@@ -117,17 +117,21 @@ struct sh_pfc { ...@@ -117,17 +117,21 @@ struct sh_pfc {
struct pinmux_irq *gpio_irq; struct pinmux_irq *gpio_irq;
unsigned int gpio_irq_size; unsigned int gpio_irq_size;
spinlock_t lock;
struct resource *resource; struct resource *resource;
unsigned int num_resources; unsigned int num_resources;
struct pfc_window *window;
unsigned long unlock_reg; unsigned long unlock_reg;
}; };
struct sh_pfc {
struct sh_pfc_platform_data *pdata;
spinlock_t lock;
struct pfc_window *window;
};
/* XXX compat for now */ /* XXX compat for now */
#define pinmux_info sh_pfc #define pinmux_info sh_pfc_platform_data
/* drivers/sh/pfc/gpio.c */ /* drivers/sh/pfc/gpio.c */
int sh_pfc_register_gpiochip(struct sh_pfc *pfc); int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
...@@ -136,7 +140,7 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc); ...@@ -136,7 +140,7 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
int sh_pfc_register_pinctrl(struct sh_pfc *pfc); int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
/* drivers/sh/pfc/core.c */ /* drivers/sh/pfc/core.c */
int register_sh_pfc(struct sh_pfc *pfc); int register_sh_pfc(struct sh_pfc_platform_data *pfc);
int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos); int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos);
void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos, void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos,
...@@ -151,8 +155,8 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, ...@@ -151,8 +155,8 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
/* xxx */ /* xxx */
static inline int register_pinmux(struct pinmux_info *pip) static inline int register_pinmux(struct pinmux_info *pip)
{ {
struct sh_pfc *pfc = pip; struct sh_pfc_platform_data *pdata = pip;
return register_sh_pfc(pfc); return register_sh_pfc(pdata);
} }
enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE }; enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment