I connect some GPIO pins to a LCD, and most of them work fine. But
there some pins that I cannot control the OUTPUT value.
e.g. If I use the GPIO 132~143, I will just call the function below.
void gpio_config(void)
{
unsigned int snum = 132;
int j;
for(j = 0; j < 12; j ) {
omap_request_gpio(snum);
snum;
}
}
When I need to ouput a 12bit value, I just call function like this:
void gpio_output(unsigned short val)
{
unsigned int snum;
int i;
snum = 132;
for(i = 0; i < 12; i ) {
gpio_direction_output(snum, val&1);
snum;
>>=1;
}
}
After done the things before, I got the correct GPIO value and the LCD
works fine.
In another project, I used GPIO pin 40, 106, 107, 174, 173, 171 to
generate a serial data, they do NOT work. So in another way, the
program run like this. It works fine.
int num[6] = {40, 106, 107, 174, 173, 171};
static int hello_init(void)
{
int i, val, j, k;
int *p;
printk(KERN_ALERT "Hello, world!\n");
printk(KERN_ALERT "Testing...\n");
//40
p = ioremap_nocache(0x48002084, 0x4);
val = p[0];
p[0] = (val & 0x0000ffff) 0x01140000;
iounmap(p);
//106 107
p = ioremap_nocache(0x48002124, 0x4);
p[0] = 0x01140114;
iounmap(p);
//174 173
p = ioremap_nocache(0x480021C8, 0x8);
printk(KERN_ALERT "x...\n", p);
p[0] = 0x01140114;
p[1] = 0x01140114;
iounmap(p);
//171 172
/* p = ioremap_nocache(0x480021C8, 0x4);
p[0] = 0x01140114;
iounmap(p);
*/
for(i = 0; i < 6; i ) {
omap_request_gpio(num[i]);
}
for(k = 0; k < 10; k ) {
for(i = 0; i < 6; i ) {
gpio_direction_output(num[i], 1);
}
msleep(50);
for(i = 0; i < 6; i ) {
gpio_direction_output(num[i], 0);
}
msleep(50);
}
return 0;
}
It seems that I need to config some REGISTERs manually, before setting
value to GPIO pins.
It is also fine that they can work in this way, but there are some
other pins I cannot handle.
e.g. GPIO 100 does NOT work, but GPIO 111 works fine. They are in the
same bank(96~127)....
Anyone know why? I really need your help.
How should I to use the specified GPIO pins?