diff mbox

[v4,3/8] net: can: c_can: Add RAMINIT register information to driver data

Message ID 1415371762-29885-4-git-send-email-rogerq@ti.com
State New
Headers show

Commit Message

Roger Quadros Nov. 7, 2014, 2:49 p.m. UTC
Some platforms (e.g. TI) need special RAMINIT register handling.
Provide a way to store RAMINIT register description in driver data.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/net/can/c_can/c_can.h          | 6 ++++++
 drivers/net/can/c_can/c_can_platform.c | 1 +
 2 files changed, 7 insertions(+)

Comments

Marc Kleine-Budde Nov. 13, 2014, 10:59 a.m. UTC | #1
On 11/07/2014 03:49 PM, Roger Quadros wrote:
> Some platforms (e.g. TI) need special RAMINIT register handling.
> Provide a way to store RAMINIT register description in driver data.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/net/can/c_can/c_can.h          | 6 ++++++
>  drivers/net/can/c_can/c_can_platform.c | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
> index 26c975d..3c305a1 100644
> --- a/drivers/net/can/c_can/c_can.h
> +++ b/drivers/net/can/c_can/c_can.h
> @@ -171,6 +171,12 @@ enum c_can_dev_id {
>  
>  struct c_can_driver_data {
>  	enum c_can_dev_id id;
> +
> +	/* RAMINIT register description. Optional. */
> +	u8 num_can;		/* Number of CAN instances on the SoC */
> +	u8 *raminit_start_bits;	/* Array of START bit positions */
> +	u8 *raminit_done_bits;	/* Array of DONE bit positions */
> +	bool raminit_pulse;	/* If set, sets and clears START bit (pulse) */
>  };
>  
>  /* c_can private data structure */
> diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
> index 1546c2b..20deb67 100644
> --- a/drivers/net/can/c_can/c_can_platform.c
> +++ b/drivers/net/can/c_can/c_can_platform.c
> @@ -250,6 +250,7 @@ static int c_can_plat_probe(struct platform_device *pdev)
>  	}
>  
>  	priv = netdev_priv(dev);
> +

Dropped this hunk while applying.

Marc
Marc Kleine-Budde Nov. 14, 2014, 5:55 p.m. UTC | #2
On 11/07/2014 03:49 PM, Roger Quadros wrote:
> Some platforms (e.g. TI) need special RAMINIT register handling.
> Provide a way to store RAMINIT register description in driver data.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/net/can/c_can/c_can.h          | 6 ++++++
>  drivers/net/can/c_can/c_can_platform.c | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
> index 26c975d..3c305a1 100644
> --- a/drivers/net/can/c_can/c_can.h
> +++ b/drivers/net/can/c_can/c_can.h
> @@ -171,6 +171,12 @@ enum c_can_dev_id {
>  
>  struct c_can_driver_data {
>  	enum c_can_dev_id id;
> +
> +	/* RAMINIT register description. Optional. */
> +	u8 num_can;		/* Number of CAN instances on the SoC */
> +	u8 *raminit_start_bits;	/* Array of START bit positions */
> +	u8 *raminit_done_bits;	/* Array of DONE bit positions */

What do you think about making this a struct:

+struct raminit_bits {
+       u8 start;
+       u8 done;
+};

 struct c_can_driver_data {
        enum c_can_dev_id id;
+
+       /* RAMINIT register description. Optional. */
+       const struct raminit_bits *raminit_bits; /* Array of START/DONE bit positions */
+       u8 raminit_num;         /* Number of CAN instances on the SoC */
+       bool raminit_pulse;     /* If set, sets and clears START bit (pulse) */
 };

The driver data looks like this:

+static const struct raminit_bits dra7_raminit_bits[] = {
+       [0] = { .start = 3, .done = 1, },
+       [1] = { .start = 5, .done = 2, },
+};
+
+static const struct c_can_driver_data dra7_dcan_drvdata = {
+       .id = BOSCH_D_CAN,
+       .raminit_num = ARRAY_SIZE(dra7_raminit_bits),
+       .raminit_bits = dra7_raminit_bits,
+       .raminit_pulse = true,
+};

I'll send an updated series.

Marc
Roger Quadros Nov. 17, 2014, 11:17 a.m. UTC | #3
On 11/14/2014 07:55 PM, Marc Kleine-Budde wrote:
> On 11/07/2014 03:49 PM, Roger Quadros wrote:
>> Some platforms (e.g. TI) need special RAMINIT register handling.
>> Provide a way to store RAMINIT register description in driver data.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  drivers/net/can/c_can/c_can.h          | 6 ++++++
>>  drivers/net/can/c_can/c_can_platform.c | 1 +
>>  2 files changed, 7 insertions(+)
>>
>> diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
>> index 26c975d..3c305a1 100644
>> --- a/drivers/net/can/c_can/c_can.h
>> +++ b/drivers/net/can/c_can/c_can.h
>> @@ -171,6 +171,12 @@ enum c_can_dev_id {
>>  
>>  struct c_can_driver_data {
>>  	enum c_can_dev_id id;
>> +
>> +	/* RAMINIT register description. Optional. */
>> +	u8 num_can;		/* Number of CAN instances on the SoC */
>> +	u8 *raminit_start_bits;	/* Array of START bit positions */
>> +	u8 *raminit_done_bits;	/* Array of DONE bit positions */
> 
> What do you think about making this a struct:
> 
> +struct raminit_bits {
> +       u8 start;
> +       u8 done;
> +};
> 
>  struct c_can_driver_data {
>         enum c_can_dev_id id;
> +
> +       /* RAMINIT register description. Optional. */
> +       const struct raminit_bits *raminit_bits; /* Array of START/DONE bit positions */
> +       u8 raminit_num;         /* Number of CAN instances on the SoC */
> +       bool raminit_pulse;     /* If set, sets and clears START bit (pulse) */
>  };
> 
> The driver data looks like this:
> 
> +static const struct raminit_bits dra7_raminit_bits[] = {
> +       [0] = { .start = 3, .done = 1, },
> +       [1] = { .start = 5, .done = 2, },
> +};
> +
> +static const struct c_can_driver_data dra7_dcan_drvdata = {
> +       .id = BOSCH_D_CAN,
> +       .raminit_num = ARRAY_SIZE(dra7_raminit_bits),
> +       .raminit_bits = dra7_raminit_bits,
> +       .raminit_pulse = true,
> +};
> 
> I'll send an updated series.

Looks better. Thanks.

cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marc Kleine-Budde Nov. 17, 2014, 11:22 a.m. UTC | #4
On 11/17/2014 12:17 PM, Roger Quadros wrote:
>> I'll send an updated series.
> 
> Looks better. Thanks.

Can you make a quick test with the new series on real hardware.

Thanks,
Marc
Roger Quadros Nov. 17, 2014, 11:29 a.m. UTC | #5
On 11/17/2014 01:22 PM, Marc Kleine-Budde wrote:
> On 11/17/2014 12:17 PM, Roger Quadros wrote:
>>> I'll send an updated series.
>>
>> Looks better. Thanks.
> 
> Can you make a quick test with the new series on real hardware.

Yes. I'll let you know in a while and respond on the v8 thread.

cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
index 26c975d..3c305a1 100644
--- a/drivers/net/can/c_can/c_can.h
+++ b/drivers/net/can/c_can/c_can.h
@@ -171,6 +171,12 @@  enum c_can_dev_id {
 
 struct c_can_driver_data {
 	enum c_can_dev_id id;
+
+	/* RAMINIT register description. Optional. */
+	u8 num_can;		/* Number of CAN instances on the SoC */
+	u8 *raminit_start_bits;	/* Array of START bit positions */
+	u8 *raminit_done_bits;	/* Array of DONE bit positions */
+	bool raminit_pulse;	/* If set, sets and clears START bit (pulse) */
 };
 
 /* c_can private data structure */
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index 1546c2b..20deb67 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -250,6 +250,7 @@  static int c_can_plat_probe(struct platform_device *pdev)
 	}
 
 	priv = netdev_priv(dev);
+
 	switch (drvdata->id) {
 	case BOSCH_C_CAN:
 		priv->regs = reg_map_c_can;