From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: ashlesha@kenati.com
Cc: linux-mips@linux-mips.org
Subject: Re: serial console: platform_device
Date: Wed, 06 Dec 2006 22:54:59 +0300 [thread overview]
Message-ID: <45772013.70907@ru.mvista.com> (raw)
In-Reply-To: <1165434577.6516.8.camel@sandbar.kenati.com>
Hello.
Ashlesha Shintre wrote:
> There is already an interrupt handler in place for the AU1000_GPIO_0
> that takes care of the cascaded interrupts -- so I *can* say
> .irq= AU1000_GPIO_0 ----right?
No, you can't. You'll have to specify to what 8259's IRQ4 maps to on your
platform.
> Also, how will I make sure my board specific encm3_platform_init is
> called during the arch init calls?
Mentioning it in arch_initcall() arranges for that. :-/
> I have put in an entry in the Makefile for the board specific
> encm3_platform.c file -- so it is built - but when control goes to the
> static int __devinit serial8250_probe(struct device *dev) function in
> the 8250.c it never executes the serial8250_register_port function.
> I know this cus I m using the JTAG port on the board to look inside and
> step through the code..
That's strange. Although the UART declaration has a grave defect....
> Here is my /arch/mips/au1000/encm3/encm3_platform.c file:
>>/*
>> * Platform device support for Au1x00 SoCs.
>> *
>> * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
>> *
>> * This file is licensed under the terms of the GNU General Public
>> * License version 2. This program is licensed "as is" without any
>> * warranty of any kind, whether express or implied.
>> */
That boilerplate is no longer applicable. :-)
>>#include <linux/device.h>
>>#include <linux/kernel.h>
>>#include <linux/init.h>
>>#include <linux/resource.h>
>>#include <linux/serial_8250.h>
>>#include <linux/tty.h>
>>
>>#include <asm/mach-au1x00/au1000.h>
>>#include <asm/mach-encm3/encm3.h>
>>static struct plat_serial8250_port encm3_via_uart_data[] = {
>> {
>> .mapbase =
>>0x3f8, //resource base
Damn, I didn't notice: .mapbase should be changed to .iobase!
>>// .membase = (char *)(0x50000000 +
>>0x3f8), // is a pointer - ioremap cookie or NULL
>> .irq = AU1000_GPIO_0,
>> .flags = UPF_SHARE_IRQ, //|
>>UPF_IOREMAP, //UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
>> .iotype = UPIO_PORT,
>> .regshift = 1,
>> .uartclk = 1843200,
>>
>> },
>> { },
>>};
>>static struct resource encm3_via_uart_resource = {
>> .start = VIA_COM1_ADDR,
>> .end = VIA_COM1_ADDR + 0x7,
>> .flags = IORESOURCE_IO,
>>};
Still, you don't need to declare the resources for the 8250 devices -- the
driver should handle requesting them for you -- as they're alredy specified by
struct plat_serial8250_port.
>>static struct platform_device encm3_via_uart = {
>> .name = "serial8250",
>> .id = 1,
I guess it should be PLAT8250_DEV_LEGACY...
>> .dev = {
>> .platform_data = encm3_via_uart_data,
>> },
So, you also don't need the following 2 lines:
>> .num_resources = 1,
>> .resource = &encm3_via_uart_resource,
>>};
>>static struct platform_device *encm3_platform_devices[] __initdata = {
>> &encm3_via_uart,
>>};
>>int encm3_platform_init(void)
>>{
>> printk("size of encm3 platform devices is %d
>>\n",ARRAY_SIZE(encm3_platform_devices));
>> return platform_add_devices(encm3_platform_devices,
>>ARRAY_SIZE(encm3_platform_devices));
I think it's better to call platform_device_register() for a single device...
WBR, Sergei
next prev parent reply other threads:[~2006-12-06 19:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-05 19:23 serial console: platform_device Ashlesha Shintre
2006-12-05 19:42 ` Sergei Shtylyov
2006-12-05 20:48 ` Ashlesha Shintre
2006-12-05 20:46 ` Sergei Shtylyov
2006-12-06 0:30 ` Ashlesha Shintre
2006-12-06 12:59 ` Sergei Shtylyov
2006-12-06 19:49 ` Ashlesha Shintre
2006-12-06 19:54 ` Sergei Shtylyov [this message]
2006-12-07 0:13 ` Cant analyze prologue code Ashlesha Shintre
2006-12-07 1:37 ` Atsushi Nemoto
2006-12-07 3:39 ` Ashlesha Shintre
2006-12-07 4:13 ` Atsushi Nemoto
[not found] ` <1165534711.6512.10.camel@sandbar.kenati.com>
[not found] ` <20061208.101112.108306293.nemoto@toshiba-tops.co.jp>
2006-12-08 2:01 ` Serial 8250 driver registration: Ashlesha Shintre
2006-12-08 12:59 ` Sergei Shtylyov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45772013.70907@ru.mvista.com \
--to=sshtylyov@ru.mvista.com \
--cc=ashlesha@kenati.com \
--cc=linux-mips@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox