[plug] Kernel hacking advice needed
Owain
evansaussie at gmail.com
Mon Apr 15 16:06:28 UTC 2013
Hi Andrew,
Sorry - with hindsight maybe I should have given a bit more detail.
Ok - I'm running 2.6 kernel and there is actually a module that
someone has kindly written in linux/drivers/mcp23s08.c, so I followed
another board definition (arch/arm/mach-at91/board-cdu.c) which had
set up the driver and modified it to my own situation:
/*
* SPI devices.
*/
#define MCP23S08_GPIO_BASE 128
static const struct mcp23s08_platform_data mcp23s08_gpio_info = {
.chip[0].is_present = true,
.chip[0].pullups = 0,
.base = MCP23S08_GPIO_BASE,
};
and:
{ /* GPIO expander MCP23S08 */
.modalias = "mcp23s08",
.chip_select = 1,
.max_speed_hz = 1000000,
.bus_num = 3,
.platform_data = &mcp23s08_gpio_info,
.mode = SPI_MODE_3,
},
It looks like the kernel driver makes the device appear as a generic
gpio. So I looked for a spi device to appear in my sysfs and there it
was /sys/class/gpio/gpio128 and I can access what I think are the the
individual gpio pins. The problem is that when I bias the pins the
values don't change and when I put a my little logic analyser on the
spi pins of the chip I see spi traffic to other devices on the spi
bus, but the chip select (which I can toggle using the sysfs gpio
functions) from the arm processor is not being activated at all.
Now, I suppose I'm at a bit of a loss what to do, my experience in
kernel hacking is limited (hence the looking for online resources to
help :) ).
Firstly I'm in embedded land and don't really have the full set of
tools that I'm used to. When I modprobe the module I don't get any
errors on my serial console, but I don't have access to dmesg - so I'm
not too sure where any kernel messages are being put - I know that
printk messages are sent to the serial console I'm monitoring. And
when I tried to compile a debug kernel and run it with gdb I ran out
of memory!
So if you have any advice I'd be more than happy to get help!
Thanks,
Owain
P.S. Apologies for not putting a [plug] in the first message
On 15 April 2013 01:48, Andrew Cooks <acooks at gmail.com> wrote:
> Hi Owain
>
> On Mon, Apr 15, 2013 at 1:13 AM, Owain <evansaussie at gmail.com> wrote:
>>
>> I'm struggling with understanding how to add an spi chip (MCP23S08) to an
>> embedded linux board.
>>
>
> I see the device documentation is openly available, which is a great
> start. (http://ww1.microchip.com/downloads/en/devicedoc/21919e.pdf)
>
> Can you be more specific about what you're trying to do and what you
> need help with? What will this chip be connected to (both host and
> peripheral side)?
>
> a.
>
> PS. 1:50 AM on a Monday morning is an interesting time to start
> reading data sheets.
> _______________________________________________
> PLUG discussion list: plug at plug.org.au
> http://lists.plug.org.au/mailman/listinfo/plug
> Committee e-mail: committee at plug.org.au
> PLUG Membership: http://www.plug.org.au/membership
More information about the plug
mailing list