linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mkl@pengutronix.de (Marc Kleine-Budde)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] can: c_can: Add d_can raminit support
Date: Wed, 21 Nov 2012 09:48:56 +0100	[thread overview]
Message-ID: <50AC9578.4030505@pengutronix.de> (raw)
In-Reply-To: <1353476650-24398-1-git-send-email-anilkumar@ti.com>

On 11/21/2012 06:44 AM, AnilKumar Ch wrote:
> Add D_CAN raminit support to C_CAN driver to enable D_CAN RAM,
> which holds all the message objects during transmission or
> receiving of data. This initialization/de-initialization should
> be done in synchronous with D_CAN clock.
> 
> In case of AM335X-EVM (current user of D_CAN driver) message RAM is
> controlled through control module register for both instances. So
> control module register details is required to initialization or
> de-initialization of message RAM according to instance number.
> 
> Control module memory resource is obtained from D_CAN dt node and
> instance number obtained from device tree aliases node.
> 
> This patch was tested on AM335x-EVM along with pinctrl data addition
> patch, d_can dt aliases addition and control module data addition.
> pinctrl data addition is not added to am335x-evm.dts (only supports
> CPLD profile#0) because d_can1 is supported under CPLD profile#1.
> 
> Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
> ---

[...]

> @@ -178,6 +195,20 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
>  		priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
>  		priv->read_reg = c_can_plat_read_reg_aligned_to_16bit;
>  		priv->write_reg = c_can_plat_write_reg_aligned_to_16bit;
> +
> +		if (pdev->dev.of_node)
> +			priv->instance = pdev->id < 0 ?
> +				of_alias_get_id(pdev->dev.of_node, "d_can") :
> +				pdev->id;

This wouldn't work with non DT kernels, what about:

if (pdev->dev.of_node)
	priv->instance = of_alias_get_id(pdev->dev.of_node, "d_can");
else
	priv->instance = pdev->id;

Marc
> +
> +		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> +		priv->raminit_ctrlreg =
> +				devm_request_and_ioremap(&pdev->dev, res);
> +		if (!priv->raminit_ctrlreg || priv->instance < 0) {
> +			dev_info(&pdev->dev, "control memory is not used for raminit\n");
> +			break;
> +		}
> +		priv->ram_init = c_can_hw_raminit;
>  		break;
>  	default:
>  		ret = -EINVAL;
> 


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121121/54fc9e3c/attachment.sig>

  parent reply	other threads:[~2012-11-21  8:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21  5:44 [PATCH v2] can: c_can: Add d_can raminit support AnilKumar Ch
2012-11-21  8:27 ` Marc Kleine-Budde
2012-11-21  8:37   ` AnilKumar, Chimata
2012-11-21  8:48 ` Marc Kleine-Budde [this message]
2012-11-21  8:58   ` AnilKumar, Chimata

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=50AC9578.4030505@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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).