Skip to content

Commit

Permalink
sh-pfc: Constify all SoC data
Browse files Browse the repository at this point in the history
None of the SoC data need to be modified. Constify it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Laurent Pinchart committed Mar 15, 2013
1 parent 861601d commit cd3c1be
Show file tree
Hide file tree
Showing 21 changed files with 125 additions and 123 deletions.
19 changes: 10 additions & 9 deletions drivers/pinctrl/sh-pfc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin)
return -1;
}

static int sh_pfc_enum_in_range(pinmux_enum_t enum_id, struct pinmux_range *r)
static int sh_pfc_enum_in_range(pinmux_enum_t enum_id,
const struct pinmux_range *r)
{
if (enum_id < r->begin)
return 0;
Expand Down Expand Up @@ -142,7 +143,7 @@ void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width,
}

static void sh_pfc_config_reg_helper(struct sh_pfc *pfc,
struct pinmux_cfg_reg *crp,
const struct pinmux_cfg_reg *crp,
unsigned long in_pos,
void __iomem **mapped_regp,
unsigned long *maskp,
Expand All @@ -164,7 +165,7 @@ static void sh_pfc_config_reg_helper(struct sh_pfc *pfc,
}

static void sh_pfc_write_config_reg(struct sh_pfc *pfc,
struct pinmux_cfg_reg *crp,
const struct pinmux_cfg_reg *crp,
unsigned long field, unsigned long value)
{
void __iomem *mapped_reg;
Expand Down Expand Up @@ -192,10 +193,10 @@ static void sh_pfc_write_config_reg(struct sh_pfc *pfc,
}

static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id,
struct pinmux_cfg_reg **crp, int *fieldp,
const struct pinmux_cfg_reg **crp, int *fieldp,
int *valuep)
{
struct pinmux_cfg_reg *config_reg;
const struct pinmux_cfg_reg *config_reg;
unsigned long r_width, f_width, curr_width, ncomb;
int k, m, n, pos, bit_pos;

Expand Down Expand Up @@ -238,7 +239,7 @@ static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id,
static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, pinmux_enum_t mark, int pos,
pinmux_enum_t *enum_idp)
{
pinmux_enum_t *data = pfc->info->gpio_data;
const pinmux_enum_t *data = pfc->info->gpio_data;
int k;

if (pos) {
Expand All @@ -259,9 +260,9 @@ static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, pinmux_enum_t mark, int pos,

int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type)
{
struct pinmux_cfg_reg *cr = NULL;
const struct pinmux_cfg_reg *cr = NULL;
pinmux_enum_t enum_id;
struct pinmux_range *range;
const struct pinmux_range *range;
int in_range, pos, field, value;

switch (pinmux_type) {
Expand Down Expand Up @@ -352,7 +353,7 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type)

static int sh_pfc_probe(struct platform_device *pdev)
{
struct sh_pfc_soc_info *info;
const struct sh_pfc_soc_info *info;
struct sh_pfc *pfc;
int ret;

Expand Down
34 changes: 17 additions & 17 deletions drivers/pinctrl/sh-pfc/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct sh_pfc_pinctrl;

struct sh_pfc {
struct device *dev;
struct sh_pfc_soc_info *info;
const struct sh_pfc_soc_info *info;
spinlock_t lock;

unsigned int num_windows;
Expand Down Expand Up @@ -54,21 +54,21 @@ void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width,
int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin);
int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type);

extern struct sh_pfc_soc_info r8a7740_pinmux_info;
extern struct sh_pfc_soc_info r8a7779_pinmux_info;
extern struct sh_pfc_soc_info sh7203_pinmux_info;
extern struct sh_pfc_soc_info sh7264_pinmux_info;
extern struct sh_pfc_soc_info sh7269_pinmux_info;
extern struct sh_pfc_soc_info sh7372_pinmux_info;
extern struct sh_pfc_soc_info sh73a0_pinmux_info;
extern struct sh_pfc_soc_info sh7720_pinmux_info;
extern struct sh_pfc_soc_info sh7722_pinmux_info;
extern struct sh_pfc_soc_info sh7723_pinmux_info;
extern struct sh_pfc_soc_info sh7724_pinmux_info;
extern struct sh_pfc_soc_info sh7734_pinmux_info;
extern struct sh_pfc_soc_info sh7757_pinmux_info;
extern struct sh_pfc_soc_info sh7785_pinmux_info;
extern struct sh_pfc_soc_info sh7786_pinmux_info;
extern struct sh_pfc_soc_info shx3_pinmux_info;
extern const struct sh_pfc_soc_info r8a7740_pinmux_info;
extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
extern const struct sh_pfc_soc_info sh7203_pinmux_info;
extern const struct sh_pfc_soc_info sh7264_pinmux_info;
extern const struct sh_pfc_soc_info sh7269_pinmux_info;
extern const struct sh_pfc_soc_info sh7372_pinmux_info;
extern const struct sh_pfc_soc_info sh73a0_pinmux_info;
extern const struct sh_pfc_soc_info sh7720_pinmux_info;
extern const struct sh_pfc_soc_info sh7722_pinmux_info;
extern const struct sh_pfc_soc_info sh7723_pinmux_info;
extern const struct sh_pfc_soc_info sh7724_pinmux_info;
extern const struct sh_pfc_soc_info sh7734_pinmux_info;
extern const struct sh_pfc_soc_info sh7757_pinmux_info;
extern const struct sh_pfc_soc_info sh7785_pinmux_info;
extern const struct sh_pfc_soc_info sh7786_pinmux_info;
extern const struct sh_pfc_soc_info shx3_pinmux_info;

#endif /* __SH_PFC_CORE_H__ */
2 changes: 1 addition & 1 deletion drivers/pinctrl/sh-pfc/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static void gpio_setup_data_reg(struct sh_pfc_chip *chip, unsigned gpio)
{
struct sh_pfc *pfc = chip->pfc;
struct sh_pfc_gpio_pin *gpio_pin = &chip->pins[gpio];
struct sh_pfc_pin *pin = &pfc->info->pins[gpio];
const struct sh_pfc_pin *pin = &pfc->info->pins[gpio];
const struct pinmux_data_reg *dreg;
unsigned int bit;
unsigned int i;
Expand Down
12 changes: 6 additions & 6 deletions drivers/pinctrl/sh-pfc/pfc-r8a7740.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ enum {
PINMUX_MARK_END,
};

static pinmux_enum_t pinmux_data[] = {
static const pinmux_enum_t pinmux_data[] = {
/* specify valid pin states for each pin in GPIO mode */

/* I/O and Pull U/D */
Expand Down Expand Up @@ -1660,7 +1660,7 @@ static struct sh_pfc_pin pinmux_pins[] = {

#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)

static struct pinmux_func pinmux_func_gpios[] = {
static const struct pinmux_func pinmux_func_gpios[] = {
/* IRQ */
GPIO_FN(IRQ0_PORT2), GPIO_FN(IRQ0_PORT13),
GPIO_FN(IRQ1),
Expand Down Expand Up @@ -2128,7 +2128,7 @@ static struct pinmux_func pinmux_func_gpios[] = {
GPIO_FN(TRACEAUD_FROM_MEMC),
};

static struct pinmux_cfg_reg pinmux_config_regs[] = {
static const struct pinmux_cfg_reg pinmux_config_regs[] = {
PORTCR(0, 0xe6050000), /* PORT0CR */
PORTCR(1, 0xe6050001), /* PORT1CR */
PORTCR(2, 0xe6050002), /* PORT2CR */
Expand Down Expand Up @@ -2442,7 +2442,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
{ },
};

static struct pinmux_data_reg pinmux_data_regs[] = {
static const struct pinmux_data_reg pinmux_data_regs[] = {
{ PINMUX_DATA_REG("PORTL031_000DR", 0xe6054800, 32) {
PORT31_DATA, PORT30_DATA, PORT29_DATA, PORT28_DATA,
PORT27_DATA, PORT26_DATA, PORT25_DATA, PORT24_DATA,
Expand Down Expand Up @@ -2546,7 +2546,7 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
{ },
};

static struct pinmux_irq pinmux_irqs[] = {
static const struct pinmux_irq pinmux_irqs[] = {
PINMUX_IRQ(evt2irq(0x0200), GPIO_PORT2, GPIO_PORT13), /* IRQ0A */
PINMUX_IRQ(evt2irq(0x0220), GPIO_PORT20), /* IRQ1A */
PINMUX_IRQ(evt2irq(0x0240), GPIO_PORT11, GPIO_PORT12), /* IRQ2A */
Expand Down Expand Up @@ -2581,7 +2581,7 @@ static struct pinmux_irq pinmux_irqs[] = {
PINMUX_IRQ(evt2irq(0x33E0), GPIO_PORT41, GPIO_PORT167),/* IRQ31A */
};

struct sh_pfc_soc_info r8a7740_pinmux_info = {
const struct sh_pfc_soc_info r8a7740_pinmux_info = {
.name = "r8a7740_pfc",
.input = { PINMUX_INPUT_BEGIN,
PINMUX_INPUT_END },
Expand Down
10 changes: 5 additions & 5 deletions drivers/pinctrl/sh-pfc/pfc-r8a7779.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ enum {
PINMUX_MARK_END,
};

static pinmux_enum_t pinmux_data[] = {
static const pinmux_enum_t pinmux_data[] = {
PINMUX_DATA_GP_ALL(), /* PINMUX_DATA(GP_M_N_DATA, GP_M_N_FN...), */

PINMUX_DATA(AVS1_MARK, FN_AVS1),
Expand Down Expand Up @@ -1438,7 +1438,7 @@ static struct sh_pfc_pin pinmux_pins[] = {

#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)

static struct pinmux_func pinmux_func_gpios[] = {
static const struct pinmux_func pinmux_func_gpios[] = {
GPIO_FN(AVS1), GPIO_FN(AVS2), GPIO_FN(A17), GPIO_FN(A18),
GPIO_FN(A19),

Expand Down Expand Up @@ -1710,7 +1710,7 @@ static struct pinmux_func pinmux_func_gpios[] = {
GPIO_FN(VI3_DATA7), GPIO_FN(GPS_MAG), GPIO_FN(FCE), GPIO_FN(SCK4_B),
};

static struct pinmux_cfg_reg pinmux_config_regs[] = {
static const struct pinmux_cfg_reg pinmux_config_regs[] = {
{ PINMUX_CFG_REG("GPSR0", 0xfffc0004, 32, 1) {
GP_0_31_FN, FN_IP3_31_29,
GP_0_30_FN, FN_IP3_26_24,
Expand Down Expand Up @@ -2571,7 +2571,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
{ },
};

static struct pinmux_data_reg pinmux_data_regs[] = {
static const struct pinmux_data_reg pinmux_data_regs[] = {
{ PINMUX_DATA_REG("INDT0", 0xffc40008, 32) { GP_INDT(0) } },
{ PINMUX_DATA_REG("INDT1", 0xffc41008, 32) { GP_INDT(1) } },
{ PINMUX_DATA_REG("INDT2", 0xffc42008, 32) { GP_INDT(2) } },
Expand All @@ -2587,7 +2587,7 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
{ },
};

struct sh_pfc_soc_info r8a7779_pinmux_info = {
const struct sh_pfc_soc_info r8a7779_pinmux_info = {
.name = "r8a7779_pfc",

.unlock_reg = 0xfffc0000, /* PMMR */
Expand Down
10 changes: 5 additions & 5 deletions drivers/pinctrl/sh-pfc/pfc-sh7203.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ enum {
PINMUX_MARK_END,
};

static pinmux_enum_t pinmux_data[] = {
static const pinmux_enum_t pinmux_data[] = {

/* PA */
PINMUX_DATA(PA7_DATA, PA7_IN),
Expand Down Expand Up @@ -819,7 +819,7 @@ static struct sh_pfc_pin pinmux_pins[] = {

#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)

static struct pinmux_func pinmux_func_gpios[] = {
static const struct pinmux_func pinmux_func_gpios[] = {
/* INTC */
GPIO_FN(PINT7_PB),
GPIO_FN(PINT6_PB),
Expand Down Expand Up @@ -1077,7 +1077,7 @@ static struct pinmux_func pinmux_func_gpios[] = {
GPIO_FN(LCD_DATA0),
};

static struct pinmux_cfg_reg pinmux_config_regs[] = {
static const struct pinmux_cfg_reg pinmux_config_regs[] = {
{ PINMUX_CFG_REG("PBIORL", 0xfffe3886, 16, 1) {
0, 0,
0, 0,
Expand Down Expand Up @@ -1529,7 +1529,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
{}
};

static struct pinmux_data_reg pinmux_data_regs[] = {
static const struct pinmux_data_reg pinmux_data_regs[] = {
{ PINMUX_DATA_REG("PADRL", 0xfffe3802, 16) {
0, 0, 0, 0,
0, 0, 0, 0,
Expand Down Expand Up @@ -1575,7 +1575,7 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
{ },
};

struct sh_pfc_soc_info sh7203_pinmux_info = {
const struct sh_pfc_soc_info sh7203_pinmux_info = {
.name = "sh7203_pfc",
.input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END, FORCE_IN },
.output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT },
Expand Down
10 changes: 5 additions & 5 deletions drivers/pinctrl/sh-pfc/pfc-sh7264.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ enum {
PINMUX_MARK_END,
};

static pinmux_enum_t pinmux_data[] = {
static const pinmux_enum_t pinmux_data[] = {

/* Port A */
PINMUX_DATA(PA3_DATA, PA3_IN),
Expand Down Expand Up @@ -1220,7 +1220,7 @@ static struct sh_pfc_pin pinmux_pins[] = {

#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)

static struct pinmux_func pinmux_func_gpios[] = {
static const struct pinmux_func pinmux_func_gpios[] = {
/* INTC */
GPIO_FN(PINT7_PG),
GPIO_FN(PINT6_PG),
Expand Down Expand Up @@ -1470,7 +1470,7 @@ static struct pinmux_func pinmux_func_gpios[] = {
GPIO_FN(LCD_M_DISP),
};

static struct pinmux_cfg_reg pinmux_config_regs[] = {
static const struct pinmux_cfg_reg pinmux_config_regs[] = {
{ PINMUX_CFG_REG("PAIOR0", 0xfffe3812, 16, 1) {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -2036,7 +2036,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
{}
};

static struct pinmux_data_reg pinmux_data_regs[] = {
static const struct pinmux_data_reg pinmux_data_regs[] = {
{ PINMUX_DATA_REG("PADR1", 0xfffe3814, 16) {
0, 0, 0, 0, 0, 0, 0, PA3_DATA,
0, 0, 0, 0, 0, 0, 0, PA2_DATA }
Expand Down Expand Up @@ -2114,7 +2114,7 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
{ }
};

struct sh_pfc_soc_info sh7264_pinmux_info = {
const struct sh_pfc_soc_info sh7264_pinmux_info = {
.name = "sh7264_pfc",
.input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END, FORCE_IN },
.output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT },
Expand Down
10 changes: 5 additions & 5 deletions drivers/pinctrl/sh-pfc/pfc-sh7269.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ enum {
PINMUX_MARK_END,
};

static pinmux_enum_t pinmux_data[] = {
static const pinmux_enum_t pinmux_data[] = {

/* Port A */
PINMUX_DATA(PA1_DATA, PA1_IN),
Expand Down Expand Up @@ -1617,7 +1617,7 @@ static struct sh_pfc_pin pinmux_pins[] = {

#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)

static struct pinmux_func pinmux_func_gpios[] = {
static const struct pinmux_func pinmux_func_gpios[] = {
/* INTC */
GPIO_FN(IRQ7_PG),
GPIO_FN(IRQ6_PG),
Expand Down Expand Up @@ -1949,7 +1949,7 @@ static struct pinmux_func pinmux_func_gpios[] = {
GPIO_FN(LCD_M_DISP),
};

static struct pinmux_cfg_reg pinmux_config_regs[] = {
static const struct pinmux_cfg_reg pinmux_config_regs[] = {
/* "name" addr register_size Field_Width */

/* where Field_Width is 1 for single mode registers or 4 for upto 16
Expand Down Expand Up @@ -2738,7 +2738,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
{}
};

static struct pinmux_data_reg pinmux_data_regs[] = {
static const struct pinmux_data_reg pinmux_data_regs[] = {
{ PINMUX_DATA_REG("PADR0", 0xfffe3816, 16) {
0, 0, 0, 0, 0, 0, 0, PA1_DATA,
0, 0, 0, 0, 0, 0, 0, PA0_DATA }
Expand Down Expand Up @@ -2817,7 +2817,7 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
{ }
};

struct sh_pfc_soc_info sh7269_pinmux_info = {
const struct sh_pfc_soc_info sh7269_pinmux_info = {
.name = "sh7269_pfc",
.input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END, FORCE_IN },
.output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT },
Expand Down
Loading

0 comments on commit cd3c1be

Please sign in to comment.