From: Vitaly Bordug <vbordug@ru.mvista.com>
To: Kalle Pokki <kalle.pokki@iki.fi>
Cc: Paul Mackerras <paulus@samba.org>, linuxppc-embedded@ozlabs.org
Subject: Re: [PATCH] CPM_UART: Fixed SMC handling for CPM2 processors
Date: Mon, 6 Nov 2006 20:55:43 +0300 [thread overview]
Message-ID: <20061106205543.43b2aacb@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.64.0611061523360.12023@host32.eke.fi>
[-- Attachment #1: Type: text/plain, Size: 3992 bytes --]
On Mon, 6 Nov 2006 15:29:47 +0200 (EET)
Kalle Pokki wrote:
> SMC handling is broken in two places when using then platform device
> approach with CPM2 devices.
>
> 1. The resources in pq2_devices are not named "regs" and "pram", thus
> they are not found in cpm_uart_drv_get_platform_data().
>
> 2. The code in cpm_uart_drv_get_platform_data() assumes the parameter
> RAM is at "pram". With SMCs of CPM2 devices, "pram" is just a pointer
> to the actual parameter RAM, which the code should reserve somewhere
> in DPRAM.
>
Right, since I had nothing to probe with pq2/smc, that part of code remain intact since creation.
Nice to see this stuff tuned finally :)
> This patch renames these the two existing resources, and introduces a
> new one, "pram_base", which is a pointer to the parameter RAM. The
> parameter RAM for SMC1 and SMC2 is put in the first 128 bytes of the
> DPRAM. This memory was already reserved from the DPRAM memory
> allocator for this purpose.
>
Well just one objection. pram_base should not be a device unless it applies to all the stuff of
SoC family which is not the case.
For this aim, I'd put what you need into the platform_data, or follow the same approach 8xx stuff having.
Thanks, Vitaly
> Signed-off-by: Kalle Pokki <kalle.pokki@iki.fi>
> ---
> arch/ppc/syslib/pq2_devices.c | 24
> ++++++++++++++++++------ drivers/serial/cpm_uart/cpm_uart_core.c |
> 8 +++++++- 2 files changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/arch/ppc/syslib/pq2_devices.c
> b/arch/ppc/syslib/pq2_devices.c index fefbc21..e8f7ba2 100644
> --- a/arch/ppc/syslib/pq2_devices.c
> +++ b/arch/ppc/syslib/pq2_devices.c
> @@ -286,16 +286,22 @@ struct platform_device ppc_sys_platform_
> [MPC82xx_CPM_SMC1] = {
> .name = "fsl-cpm-smc",
> .id = 1,
> - .num_resources = 3,
> + .num_resources = 4,
> .resource = (struct resource[]) {
> {
> - .name = "smc_mem",
> + .name = "regs",
> .start = 0x11A80,
> .end = 0x11A8F,
> .flags = IORESOURCE_MEM,
> },
> {
> - .name = "smc_pram",
> + .name = "pram",
> + .start = PROFF_SMC1,
> + .end = PROFF_SMC1 + 63,
> + .flags = IORESOURCE_MEM,
> + },
> + {
> + .name = "pram_base",
> .start = 0x87fc,
> .end = 0x87fd,
> .flags = IORESOURCE_MEM,
> @@ -310,16 +316,22 @@ struct platform_device ppc_sys_platform_
> [MPC82xx_CPM_SMC2] = {
> .name = "fsl-cpm-smc",
> .id = 2,
> - .num_resources = 3,
> + .num_resources = 4,
> .resource = (struct resource[]) {
> {
> - .name = "smc_mem",
> + .name = "regs",
> .start = 0x11A90,
> .end = 0x11A9F,
> .flags = IORESOURCE_MEM,
> },
> {
> - .name = "smc_pram",
> + .name = "pram",
> + .start = PROFF_SMC2,
> + .end = PROFF_SMC2 + 63,
> + .flags = IORESOURCE_MEM,
> + },
> + {
> + .name = "pram_base",
> .start = 0x88fc,
> .end = 0x88fd,
> .flags = IORESOURCE_MEM,
> diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c
> b/drivers/serial/cpm_uart/cpm_uart_core.c index 4047530..55419b1
> 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c
> +++ b/drivers/serial/cpm_uart/cpm_uart_core.c
> @@ -1024,7 +1024,7 @@ int cpm_uart_drv_get_platform_data(struc
> int idx = pdata->fs_no; /* It is UART_SMCx or
> UART_SCCx index */ struct uart_cpm_port *pinfo;
> int line;
> - u32 mem, pram;
> + u32 mem, pram, pram_base;
>
> line = cpm_uart_id2nr(idx);
> if(line < 0) {
> @@ -1049,6 +1049,12 @@ int cpm_uart_drv_get_platform_data(struc
> return -EINVAL;
> pram = r->start;
>
> + r = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> "pram_base");
> + if (r) {
> + pram_base = r->start;
> + out_be16((u16 *)pram_base, pram & 0xffff);
> + }
> +
> if(idx > fsid_smc2_uart) {
> pinfo->sccp = (scc_t *)mem;
> pinfo->sccup = (scc_uart_t *)pram;
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2006-11-06 17:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-06 13:29 [PATCH] CPM_UART: Fixed SMC handling for CPM2 processors Kalle Pokki
2006-11-06 17:55 ` Vitaly Bordug [this message]
2006-11-06 20:49 ` Kalle Pokki
2006-11-07 12:08 ` Vitaly Bordug
2006-11-07 13:21 ` Kalle Pokki
2006-11-07 14:47 ` Vitaly Bordug
-- strict thread matches above, loose matches on Subject: below --
2007-02-12 10:33 Heiko Schocher
2007-02-12 17:55 ` Vitaly Bordug
2007-02-13 8:09 ` Heiko Schocher
2007-02-13 11:42 ` Vitaly Bordug
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=20061106205543.43b2aacb@localhost.localdomain \
--to=vbordug@ru.mvista.com \
--cc=kalle.pokki@iki.fi \
--cc=linuxppc-embedded@ozlabs.org \
--cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).