linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* xilinx gpio in kernel 2.6
@ 2007-04-30 15:01 Mirek23
  2007-05-02 12:33 ` Mirek23
  0 siblings, 1 reply; 4+ messages in thread
From: Mirek23 @ 2007-04-30 15:01 UTC (permalink / raw)
  To: linuxppc-embedded


Hi All,

           I am trying to build the kernel 2.6 for my ml403 board. I use the
kernel 2.6 by Grant.
The ethernet (Temac) and serial drivers work fine. It is however no support
for xilinx gpio in the kernel tree.

To satisfy that I have generated the xilinx_gpio driver by means of the EDK
8.2 .

I have tried to place the xilinx_gpio to the kernel 2.6 tree under
drivers/char/xilinx_gpio.

I have done the suitable configuration on the Makefile and Kconfig level.
When I build the kernel, the crosscompiler complaines about the
xgpio_ioctl.h which comes
from the adapter.c file.

It seems to be that xgpio_ioctl.h conatins the missing macros:
XGPIO_IN
XGPIO_OUT
XGPIO_TRISTATE
XGPIO_OPEN_DRAIN
.
.
.

Does sombody of you faced the same problem? 
The second thing is that I did not find any documentation how to use GPIO on
the user level to access things like LEDS and Swiches on my xilinx board. Do
you have an idea how to do that (ie. which function calls to use).

Many thanks in advance for any hint.

Best Regards

Mirek





 

-- 
View this message in context: http://www.nabble.com/xilinx-gpio-in-kernel-2.6-tf3670122.html#a10254948
Sent from the linuxppc-embedded mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* xilinx gpio in kernel 2.6
@ 2007-04-30 15:05 Mirek23
  0 siblings, 0 replies; 4+ messages in thread
From: Mirek23 @ 2007-04-30 15:05 UTC (permalink / raw)
  To: linuxppc-dev


Hi All,

           I am trying to build the kernel 2.6 for my ml403 board. I use the
kernel 2.6 by Grant.
The ethernet (Temac) and serial drivers work fine. It is however no support
for xilinx gpio in the kernel tree.

To satisfy that I have generated the xilinx_gpio driver by means of the EDK
8.2 .

I have tried to place the xilinx_gpio to the kernel 2.6 tree under
drivers/char/xilinx_gpio.

I have done the suitable configuration on the Makefile and Kconfig level.
When I build the kernel, the crosscompiler complaines about the
xgpio_ioctl.h which comes
from the adapter.c file.

It seems to be that xgpio_ioctl.h conatins the missing macros:
XGPIO_IN
XGPIO_OUT
XGPIO_TRISTATE
XGPIO_OPEN_DRAIN
.
.
.

Did sombody of you face the same problem? 
The second thing is that I did not find any documentation how to use GPIO on
the user level to access things like LEDS and Swiches on my xilinx board. Do
you have an idea how to do that (ie. which function calls to use).

Many thanks in advance for any hint.

Best Regards

Mirek
-- 
View this message in context: http://www.nabble.com/xilinx-gpio-in-kernel-2.6-tf3670144.html#a10255005
Sent from the linuxppc-dev mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: xilinx gpio in kernel 2.6
  2007-04-30 15:01 xilinx gpio in kernel 2.6 Mirek23
@ 2007-05-02 12:33 ` Mirek23
  2007-07-10 15:52   ` Mirek23
  0 siblings, 1 reply; 4+ messages in thread
From: Mirek23 @ 2007-05-02 12:33 UTC (permalink / raw)
  To: linuxppc-embedded


Finally I was able to incorporate the xilinx_gpio driver to the kernel 2.6
tree.
To do so I have created the file xgpio_ioctl.h which is basically identical
to  
the file include/linux/ibm_ocp_gpio.h in the kernel linuxppc_2_4. The
differences are 
the macro names (I have replaced IBM with X and ibm_ with x).

I have modified also arch/ppc/syslib/virtex_devices.c. I have added into
this file the entries which refer to GPIO definitions.

At the end I have modified the drivers/char/Kconfig and the
drivers/char/xilinx_gpio/Makefile.

After all I was able to compile the kernel.

I did not find however how to deal with the GPIO driver on the user's level.
I am sure that I have to use: open and ioctl function calls but I do not
know how to distinguish between 
two differenet GPIO interfaces to control respectively (LEDs and DIP
switches).

I would appreciate very much any hint on that

Best Regards

Mierk


Mirek23 wrote:
> 
> Hi All,
> 
>            I am trying to build the kernel 2.6 for my ml403 board. I use
> the kernel 2.6 by Grant.
> The ethernet (Temac) and serial drivers work fine. It is however no
> support for xilinx gpio in the kernel tree.
> 
> To satisfy that I have generated the xilinx_gpio driver by means of the
> EDK 8.2 .
> 
> I have tried to place the xilinx_gpio to the kernel 2.6 tree under
> drivers/char/xilinx_gpio.
> 
> I have done the suitable configuration on the Makefile and Kconfig level.
> When I build the kernel, the crosscompiler complaines about the
> xgpio_ioctl.h which comes
> from the adapter.c file.
> 
> It seems to be that xgpio_ioctl.h conatins the missing macros:
> XGPIO_IN
> XGPIO_OUT
> XGPIO_TRISTATE
> XGPIO_OPEN_DRAIN
> .
> .
> .
> 
> Does sombody of you faced the same problem? 
> The second thing is that I did not find any documentation how to use GPIO
> on the user level to access things like LEDS and Swiches on my xilinx
> board. Do you have an idea how to do that (ie. which function calls to
> use).
> 
> Many thanks in advance for any hint.
> 
> Best Regards
> 
> Mirek
> 
> 
> 
> 
> 
>  
> 
> 

-- 
View this message in context: http://www.nabble.com/xilinx-gpio-in-kernel-2.6-tf3670122.html#a10285090
Sent from the linuxppc-embedded mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: xilinx gpio in kernel 2.6
  2007-05-02 12:33 ` Mirek23
@ 2007-07-10 15:52   ` Mirek23
  0 siblings, 0 replies; 4+ messages in thread
From: Mirek23 @ 2007-07-10 15:52 UTC (permalink / raw)
  To: linuxppc-embedded


Hi All,

 After some time I have found the way how to deal with GPIO driver from the
user space:

First you have to mknod xgpio under /dev :
crw-rw-rw-    1 root     root      10, 185 Jun  1 13:59 /dev/xgpio

Example program below shows how to read from the GPIO channel.
To write to the channel change the call:
ioctl(fgpio,XGPIO_IN,&sGpioData); to ioctl(fgpio,XGPIO_OUT,&sGpioData);

#include <stdlib.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>

#include <linux/xgpio_ioctl.h>


main(){


  int fgpio =0;
  struct xgpio_ioctl_data sGpioData;
    /* {
        __u32 device;
        __u32 mask;
        __u32 data;
        }*/

  sGpioData.device=0; /* N=0,1,2,3-> GPIO DEV NR   2*N   (Lower 32 bit part
)
                                                   2*N+1 (Upper 32 bit part
)*/
  sGpioData.mask=0xffffffff;
  sGpioData.data=0x55555555;

fgpio = open ("/dev/xgpio",O_RDWR);
 if( fgpio != -1){

   ioctl(fgpio,XGPIO_IN,&sGpioData);//pointer here to  xgpio_ioctl_data
   printf("Dip Swich readout 0x%X\n",sGpioData.data);
 }
 else
   printf("Can not open GPIO\n");

 close(fgpio);
}// end main












 



-- 
View this message in context: http://www.nabble.com/xilinx-gpio-in-kernel-2.6-tf3670122.html#a11523745
Sent from the linuxppc-embedded mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-10 15:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-30 15:01 xilinx gpio in kernel 2.6 Mirek23
2007-05-02 12:33 ` Mirek23
2007-07-10 15:52   ` Mirek23
  -- strict thread matches above, loose matches on Subject: below --
2007-04-30 15:05 Mirek23

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).