code removed from regs-gpio.h in linux 3.1

miniarm
Hi,

I am using pengutronics bsp which has linux 3.1 support. but what I
could'nt find is below value in regs-gpio.h header file.

/* S3C2400 doesn't have a 1:1 mapping to S3C2410 gpio base pins */

#define S3C2400_BANKNUM(pin)     (((pin) & ~31) / 32)
#define S3C2400_BASEA2B(pin)     ((((pin) & ~31) >> 2))
#define S3C2400_BASEC2H(pin)     ((S3C2400_BANKNUM(pin) * 10) + \ (2 *
(S3C2400_BANKNUM(pin)-2)))

#define S3C2400_GPIO_BASE(pin)   (pin < S3C2410_GPIO_BANKC ? \
S3C2400_BASEA2B(pin)+S3C24XX_VA_GPIO : \
S3C2400_BASEC2H(pin)+S3C24XX_VA_GPIO)


#define (pin)   ((((pin) & ~31) >> 1) + S3C24XX_VA_GPIO)
#define S3C2410_GPIO_OFFSET(pin) ((pin) & 31)


In older kernel i was using S3C2410_GPIO_BASE to configure/set gpio, but
this newer kenel doesn't come with the S3C2410_GPIO_BASE.

can you please tell me how to implement S3C2410_GPIO_BASE in newew kernel.

All I want is to drive GPIO using address, rather than individual.

in older kernel I was able to do it using S3C2410_GPIO_BASE.

Juergen Beisert
Use the in-kernel goiolib instead.

miniarm
@Juergen,

How to use gpiolib function 'gpio_set_value', as I want to set value on
whole address?

nap_D
#ifndef S3C2410_GPIO_BASE
#define S3C2410_GPIO_BASE <get value from old kernel files or datasheet>
#endif

//Similarly define whatever else you need.
//Better rename to something specific like
//#define MINIARM_S3C2410_GPIO_BASE and refactor your existing code.

Are you sure you want to do this? What happens if another module uses
gpios? What happens if gpios are available and modified in userspace? What
happens if some pins that are not configured as gpios are changed? etc etc

Better to follow J.B's advice. Use the functions request, direction_output,
set & free.

At least use request and free to ensure another "responsible" process does
not overwrite your values or assume they have exclusive access to the pins
at the time.

miniarm
@nap_D

Thanks for the explanation. Yes I am sure to do this. because my hardware
connected to GPIO only and I need to access hardware as fast as I can. So I
am trying to set data directly on GPIO instead of operating a pin one by
one.


Let me try your solution and I will be back to you soon with some updates.