[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] Adding SPI Driver causes Kernel to Hang



Based on the Blackfin's SPI documentation on writing a similar SPI driver:

http://docs.blackfin.uclinux.org/doku.php?id=spi

I feel I should be placing my code in the c file for my board, which I believe is linux-2.6.x-petalogix/arch/microblaze/platform/Xilinx-Spartan3E500-RevD/setup.c.

Is this correct?  Thanks.

Matt

On Thu, Feb 26, 2009 at 09:07, Matt Staniszewski <matt.staniszewski@xxxxxxxxx> wrote:
Hi Nicolas,

Sorry for the misunderstanding.  This started out as a user app, but looks like it has become a kernel driver.

Where should I be developing this so that it would be considered part of the kernel?  I'm new to kernel driver development, so I'd appreciate any guidance.  Thanks!

Matt

-----Original Message-----
From: Nicolas Schier <schier@xxxxxx>
Sent: Thursday, February 26, 2009 12:27 AM
To: microblaze-uclinux@xxxxxxxxxxxxxx
Subject: Re: [microblaze-uclinux] Adding SPI Driver causes Kernel to Hang

Hi Matt,

> I found out that I was actually missing a required #define.  In order
> to get
> types.h to register types such as u32, I need to include the
> following in my
> code:
>
> #define __KERNEL__

The __KERNEL__ define is there to prevent user space applications from
using internal kernel stuff. To define __KERNEL__ on your own is only
rarely a good solution to whatever problem you want to solve.

> As a side note, I'm doing all my development on this C source file in
> the
> user-apps directory, not the kernel directory.  Moving the source files over
> to the kernel source then compiling had no effect.

It seems to be a misunderstanding. I supposed you were trying write a
kernel driver. The standard SPI interface does no more support a char
device as user space interface, thus you will need to write a kernel
driver to access your SPI devices. The code snips I have presented were
actually copied from a kernel driver that connects to the SPI subsystem
(using "xilinx_spi").

> Any suggestions?  I'm glad to see that people are interested, I
> really hope
> to get this working.  Thanks.
>
> Matt
>

Regards,
Nicolas

--
gpg public key: ID 0xACBC3B35, jabber: nicolas@xxxxxxxxx
 -- frykten for herren er opphav til kunnskap --