No subject


Fri Nov 6 13:01:15 EST 2009


actually using the cfg_eint anywhere. For the S5PV210 it seems that the
gpio pin configuration is static for all gpio banks.

It is probably going to be easier to remove it from this code and look
at removing it altogether from the s3c_gpio_cfg configuration structure.

Also, but not a stopper to getting this merged, we should probably make
a standard config structure for this and then re-use it, as iirc this will
be the same as the 64xx case if we remove the cfg_eint.

> +static struct s3c_gpio_cfg gpio_cfg_noint = {
> +	.set_config	= s3c_gpio_setcfg_s3c64xx_4bit,
> +	.set_pull	= s3c_gpio_setpull_updown,
> +	.get_pull	= s3c_gpio_getpull_updown,
> +};
> +
> +/* GPIO bank's base address given the index of the bank in the
> + * list of all gpio banks.
> + */
> +#define S5PV210_BANK_BASE(bank_nr)	(S5P_VA_GPIO + ((bank_nr) * 0x20))
> +
> +/*
> + * Following are the gpio banks in v210.
> + *
> + * The 'config' member when left to NULL, is initialized to the default
> + * structure gpio_cfg in the init function below.
> + *
> + * The 'base' member is also initialized in the init function below.
> + * Note: The initialization of 'base' member of s3c_gpio_chip structure
> + * uses the above macro and depends on the banks being listed in order here.
> + */
> +static struct s3c_gpio_chip s5pv210_gpio_4bit[] = {
> +	{
> +		.chip	= {
> +			.base	= S5PV210_GPA0(0),
> +			.ngpio	= S5PV210_GPIO_A0_NR,
> +			.label	= "GPA0",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPA1(0),
> +			.ngpio	= S5PV210_GPIO_A1_NR,
> +			.label	= "GPA1",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPB(0),
> +			.ngpio	= S5PV210_GPIO_B_NR,
> +			.label	= "GPB",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPC0(0),
> +			.ngpio	= S5PV210_GPIO_C0_NR,
> +			.label	= "GPC0",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPC1(0),
> +			.ngpio	= S5PV210_GPIO_C1_NR,
> +			.label	= "GPC1",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPD0(0),
> +			.ngpio	= S5PV210_GPIO_D0_NR,
> +			.label	= "GPD0",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPD1(0),
> +			.ngpio	= S5PV210_GPIO_D1_NR,
> +			.label	= "GPD1",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPE0(0),
> +			.ngpio	= S5PV210_GPIO_E0_NR,
> +			.label	= "GPE0",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPE1(0),
> +			.ngpio	= S5PV210_GPIO_E1_NR,
> +			.label	= "GPE1",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPF0(0),
> +			.ngpio	= S5PV210_GPIO_F0_NR,
> +			.label	= "GPF0",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPF1(0),
> +			.ngpio	= S5PV210_GPIO_F1_NR,
> +			.label	= "GPF1",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPF2(0),
> +			.ngpio	= S5PV210_GPIO_F2_NR,
> +			.label	= "GPF2",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPF3(0),
> +			.ngpio	= S5PV210_GPIO_F3_NR,
> +			.label	= "GPF3",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPG0(0),
> +			.ngpio	= S5PV210_GPIO_G0_NR,
> +			.label	= "GPG0",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPG1(0),
> +			.ngpio	= S5PV210_GPIO_G1_NR,
> +			.label	= "GPG1",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPG2(0),
> +			.ngpio	= S5PV210_GPIO_G2_NR,
> +			.label	= "GPG2",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPG3(0),
> +			.ngpio	= S5PV210_GPIO_G3_NR,
> +			.label	= "GPG3",
> +		},
> +	}, {
> +		.config	= &gpio_cfg_noint,
> +		.chip	= {
> +			.base	= S5PV210_GPH0(0),
> +			.ngpio	= S5PV210_GPIO_H0_NR,
> +			.label	= "GPH0",
> +		},
> +	}, {
> +		.config	= &gpio_cfg_noint,
> +		.chip	= {
> +			.base	= S5PV210_GPH1(0),
> +			.ngpio	= S5PV210_GPIO_H1_NR,
> +			.label	= "GPH1",
> +		},
> +	}, {
> +		.config	= &gpio_cfg_noint,
> +		.chip	= {
> +			.base	= S5PV210_GPH2(0),
> +			.ngpio	= S5PV210_GPIO_H2_NR,
> +			.label	= "GPH2",
> +		},
> +	}, {
> +		.config	= &gpio_cfg_noint,
> +		.chip	= {
> +			.base	= S5PV210_GPH3(0),
> +			.ngpio	= S5PV210_GPIO_H3_NR,
> +			.label	= "GPH3",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPI(0),
> +			.ngpio	= S5PV210_GPIO_I_NR,
> +			.label	= "GPI",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPJ0(0),
> +			.ngpio	= S5PV210_GPIO_J0_NR,
> +			.label	= "GPJ0",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPJ1(0),
> +			.ngpio	= S5PV210_GPIO_J1_NR,
> +			.label	= "GPJ1",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPJ2(0),
> +			.ngpio	= S5PV210_GPIO_J2_NR,
> +			.label	= "GPJ2",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPJ3(0),
> +			.ngpio	= S5PV210_GPIO_J3_NR,
> +			.label	= "GPJ3",
> +		},
> +	}, {
> +		.chip	= {
> +			.base	= S5PV210_GPJ4(0),
> +			.ngpio	= S5PV210_GPIO_J4_NR,
> +			.label	= "GPJ4",
> +		},
> +	}, {
> +		.config	= &gpio_cfg_noint,
> +		.chip	= {
> +			.base	= S5PV210_MP01(0),
> +			.ngpio	= S5PV210_GPIO_MP01_NR,
> +			.label	= "MP01",
> +		},
> +	}, {
> +		.config	= &gpio_cfg_noint,
> +		.chip	= {
> +			.base	= S5PV210_MP02(0),
> +			.ngpio	= S5PV210_GPIO_MP02_NR,
> +			.label	= "MP02",
> +		},
> +	}, {
> +		.config	= &gpio_cfg_noint,
> +		.chip	= {
> +			.base	= S5PV210_MP03(0),
> +			.ngpio	= S5PV210_GPIO_MP03_NR,
> +			.label	= "MP03",
> +		},
> +	},
> +};
> +
> +static __init int s5pv210_gpiolib_init(void)
> +{
> +	struct s3c_gpio_chip *chip = s5pv210_gpio_4bit;
> +	int nr_chips = ARRAY_SIZE(s5pv210_gpio_4bit);
> +	int i = 0;
> +
> +	for (i = 0; i < nr_chips; i++, chip++) {
> +		if (chip->config == NULL)
> +			chip->config = &gpio_cfg;
> +		if (chip->base == NULL)
> +			chip->base = S5PV210_BANK_BASE(i);
> +	}
> +
> +	samsung_gpiolib_add_4bit_chips(s5pv210_gpio_4bit,
> +				       ARRAY_SIZE(s5pv210_gpio_4bit));
				       ^& replace with nr_chips.	

-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.




More information about the linux-arm-kernel mailing list