RE: [PATCH v3] ARM: DaVinci: DM646x Video: Platform and board specific setup

2009-08-04 Thread Karicheri, Muralidharan
Chaithrika,

Could you send the patches inline to Russell King r...@arm.linux.org.uk? This 
was what Mauro had suggested to me.

We need to get a resolution on this quickly since I have some patches waiting 
to be submitted against display driver and would like to base it on your 
patches. 

Regards,

Murali Karicheri
Software Design Engineer
Texas Instruments Inc.
Germantown, MD 20874
new phone: 301-407-9583
Old Phone : 301-515-3736 (will be deprecated)
email: m-kariche...@ti.com

-Original Message-
From: davinci-linux-open-source-boun...@linux.davincidsp.com
[mailto:davinci-linux-open-source-boun...@linux.davincidsp.com] On Behalf
Of Subrahmanya, Chaithrika
Sent: Monday, August 03, 2009 5:27 AM
To: 'Mauro Carvalho Chehab'
Cc: davinci-linux-open-source@linux.davincidsp.com; li...@arm.linux.org.uk;
linux-me...@vger.kernel.org
Subject: RE: [PATCH v3] ARM: DaVinci: DM646x Video: Platform and board
specific setup

Mauro,

OK. Thank you for taking care of this.

On Mon, Aug 03, 2009 at 11:20:03, Mauro Carvalho Chehab wrote:
 Em Mon, 3 Aug 2009 09:17:06 +0530
 chaithrika chaithr...@ti.com escreveu:

  Mauro/Russell,
 
  The previous version (v2) of this patch is on the linux-next tree.
  This patch has some updates done on top of that patch. Should I post
  an incremental patch for those changes to the Linux-next tree?
  Please suggest.
 
 It is not needed. After having Russell ack, I'll just replace the old
patch by the new one.



 Cheers,
 Mauro



Regards,
Chaithrika


___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: [PATCH v3] ARM: DaVinci: DM646x Video: Platform and board specific setup

2009-08-04 Thread Karicheri, Muralidharan


-Original Message-
From: davinci-linux-open-source-boun...@linux.davincidsp.com
[mailto:davinci-linux-open-source-boun...@linux.davincidsp.com] On Behalf
Of Subrahmanya, Chaithrika
Sent: Monday, July 20, 2009 4:01 AM
To: li...@arm.linux.org.uk
Cc: davinci-linux-open-source@linux.davincidsp.com; mche...@infradead.org;
linux-me...@vger.kernel.org
Subject: [PATCH v3] ARM: DaVinci: DM646x Video: Platform and board specific
setup

Platform specific display device setup for DM646x EVM

Add platform device and resource structures. Also define a platform
specific
clock setup function that can be accessed by the driver to configure the
clock
and CPLD.

Signed-off-by: Manjunath Hadli m...@ti.com
Signed-off-by: Brijesh Jadav brijes...@ti.com
Signed-off-by: Chaithrika U S chaithr...@ti.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
---
Applies to Davinci GIT tree. Minor updates like change in structure name-
subdev_info to vpif_subdev_info and correction to VDD3P3V_VID_MASK value.

 arch/arm/mach-davinci/board-dm646x-evm.c|  125
+++
 arch/arm/mach-davinci/dm646x.c  |   62 +
 arch/arm/mach-davinci/include/mach/dm646x.h |   24 +
 3 files changed, 211 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-
davinci/board-dm646x-evm.c
index b1bf18c..8c88fd0 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -63,6 +63,19 @@
 #define DM646X_EVM_PHY_MASK   (0x2)
 #define DM646X_EVM_MDIO_FREQUENCY (220) /* PHY bus frequency */

+#define VIDCLKCTL_OFFSET  (0x38)
+#define VSCLKDIS_OFFSET   (0x6c)
+
+#define VCH2CLK_MASK  (BIT_MASK(10) | BIT_MASK(9) | BIT_MASK(8))
+#define VCH2CLK_SYSCLK8   (BIT(9))
+#define VCH2CLK_AUXCLK(BIT(9) | BIT(8))
+#define VCH3CLK_MASK  (BIT_MASK(14) | BIT_MASK(13) | BIT_MASK(12))
+#define VCH3CLK_SYSCLK8   (BIT(13))
+#define VCH3CLK_AUXCLK(BIT(14) | BIT(13))
+
+#define VIDCH2CLK (BIT(10))
+#define VIDCH3CLK (BIT(11))
+
 static struct davinci_uart_config uart_config __initdata = {
   .enabled_uarts = (1  0),
 };
@@ -288,6 +301,40 @@ static struct snd_platform_data dm646x_evm_snd_data[]
= {
   },
 };

+static struct i2c_client *cpld_client;
+
+static int cpld_video_probe(struct i2c_client *client,
+  const struct i2c_device_id *id)
+{
+  cpld_client = client;
+  return 0;
+}
+
+static int __devexit cpld_video_remove(struct i2c_client *client)
+{
+  cpld_client = NULL;
+  return 0;
+}
+
+static const struct i2c_device_id cpld_video_id[] = {
+  { cpld_video, 0 },
+  { }
+};
+
+static struct i2c_driver cpld_video_driver = {
+  .driver = {
+  .name   = cpld_video,
+  },
+  .probe  = cpld_video_probe,
+  .remove = cpld_video_remove,
+  .id_table   = cpld_video_id,
+};
+
+static void evm_init_cpld(void)
+{
+  i2c_add_driver(cpld_video_driver);
+}
+
 static struct i2c_board_info __initdata i2c_info[] =  {
   {
   I2C_BOARD_INFO(24c256, 0x50),
@@ -300,6 +347,9 @@ static struct i2c_board_info __initdata i2c_info[] =  {
   {
   I2C_BOARD_INFO(cpld_reg0, 0x3a),
   },
+  {
+  I2C_BOARD_INFO(cpld_video, 0x3B),
+  },
 };

 static struct davinci_i2c_platform_data i2c_pdata = {
@@ -307,11 +357,85 @@ static struct davinci_i2c_platform_data i2c_pdata = {
   .bus_delay  = 0 /* usec */,
 };

+static int set_vpif_clock(int mux_mode, int hd)
+{
+  int val = 0;
+  int err = 0;
+  unsigned int value;
+  void __iomem *base = IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE);
+
+  if (!cpld_client)
+  return -ENXIO;
+
+  /* disable the clock */
+  value = __raw_readl(base + VSCLKDIS_OFFSET);
+  value |= (VIDCH3CLK | VIDCH2CLK);
+  __raw_writel(value, base + VSCLKDIS_OFFSET);
+
+  val = i2c_smbus_read_byte(cpld_client);
+  if (val  0)
+  return val;
+
+  if (mux_mode == 1)
+  val = ~0x40;
+  else
+  val |= 0x40;
+
+  err = i2c_smbus_write_byte(cpld_client, val);
+  if (err)
+  return err;
+
+  value = __raw_readl(base + VIDCLKCTL_OFFSET);
+  value = ~(VCH2CLK_MASK);
+  value = ~(VCH3CLK_MASK);
+
+  if (hd = 1)
+  value |= (VCH2CLK_SYSCLK8 | VCH3CLK_SYSCLK8);
+  else
+  value |= (VCH2CLK_AUXCLK | VCH3CLK_AUXCLK);
+
+  __raw_writel(value, base + VIDCLKCTL_OFFSET);
+
+  /* enable the clock */
+  value = __raw_readl(base + VSCLKDIS_OFFSET);
+  value = ~(VIDCH3CLK | VIDCH2CLK);
+  __raw_writel(value, base + VSCLKDIS_OFFSET);
+
+  return 0;
+}
+
+static const struct vpif_subdev_info dm646x_vpif_subdev[] = {
+  {
+  .addr   = 0x2A,
+  .name   = adv7343,
+  },
+

RE: [PATCH v3] ARM: DaVinci: DM646x Video: Platform and board specific setup

2009-08-04 Thread chaithrika
On Wed, Aug 05, 2009 at 02:45:36, Karicheri, Muralidharan wrote:
 
 
 -Original Message-
 From: davinci-linux-open-source-boun...@linux.davincidsp.com
 [mailto:davinci-linux-open-source-boun...@linux.davincidsp.com] On Behalf
 Of Subrahmanya, Chaithrika
 Sent: Monday, July 20, 2009 4:01 AM
 To: li...@arm.linux.org.uk
 Cc: davinci-linux-open-source@linux.davincidsp.com;
mche...@infradead.org;
 linux-me...@vger.kernel.org
 Subject: [PATCH v3] ARM: DaVinci: DM646x Video: Platform and board
specific
 setup
 
 Platform specific display device setup for DM646x EVM
 
 Add platform device and resource structures. Also define a platform
 specific
 clock setup function that can be accessed by the driver to configure the
 clock
 and CPLD.
 
 Signed-off-by: Manjunath Hadli m...@ti.com
 Signed-off-by: Brijesh Jadav brijes...@ti.com
 Signed-off-by: Chaithrika U S chaithr...@ti.com
 Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
 ---
 Applies to Davinci GIT tree. Minor updates like change in structure name-
 subdev_info to vpif_subdev_info and correction to VDD3P3V_VID_MASK value.
 
  arch/arm/mach-davinci/board-dm646x-evm.c|  125
 +++
  arch/arm/mach-davinci/dm646x.c  |   62 +
  arch/arm/mach-davinci/include/mach/dm646x.h |   24 +
  3 files changed, 211 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-
 davinci/board-dm646x-evm.c
 index b1bf18c..8c88fd0 100644
 --- a/arch/arm/mach-davinci/board-dm646x-evm.c
 +++ b/arch/arm/mach-davinci/board-dm646x-evm.c
 @@ -63,6 +63,19 @@
  #define DM646X_EVM_PHY_MASK (0x2)
  #define DM646X_EVM_MDIO_FREQUENCY   (220) /* PHY bus frequency */
 
 +#define VIDCLKCTL_OFFSET(0x38)
 +#define VSCLKDIS_OFFSET (0x6c)
 +
 +#define VCH2CLK_MASK(BIT_MASK(10) | BIT_MASK(9) |
BIT_MASK(8))
 +#define VCH2CLK_SYSCLK8 (BIT(9))
 +#define VCH2CLK_AUXCLK  (BIT(9) | BIT(8))
 +#define VCH3CLK_MASK(BIT_MASK(14) | BIT_MASK(13) |
BIT_MASK(12))
 +#define VCH3CLK_SYSCLK8 (BIT(13))
 +#define VCH3CLK_AUXCLK  (BIT(14) | BIT(13))
 +
 +#define VIDCH2CLK   (BIT(10))
 +#define VIDCH3CLK   (BIT(11))
 +
  static struct davinci_uart_config uart_config __initdata = {
  .enabled_uarts = (1  0),
  };
 @@ -288,6 +301,40 @@ static struct snd_platform_data
dm646x_evm_snd_data[]
 = {
  },
  };
 
 +static struct i2c_client *cpld_client;
 +
 +static int cpld_video_probe(struct i2c_client *client,
 +const struct i2c_device_id *id)
 +{
 +cpld_client = client;
 +return 0;
 +}
 +
 +static int __devexit cpld_video_remove(struct i2c_client *client)
 +{
 +cpld_client = NULL;
 +return 0;
 +}
 +
 +static const struct i2c_device_id cpld_video_id[] = {
 +{ cpld_video, 0 },
 +{ }
 +};
 +
 +static struct i2c_driver cpld_video_driver = {
 +.driver = {
 +.name   = cpld_video,
 +},
 +.probe  = cpld_video_probe,
 +.remove = cpld_video_remove,
 +.id_table   = cpld_video_id,
 +};
 +
 +static void evm_init_cpld(void)
 +{
 +i2c_add_driver(cpld_video_driver);
 +}
 +
  static struct i2c_board_info __initdata i2c_info[] =  {
  {
  I2C_BOARD_INFO(24c256, 0x50),
 @@ -300,6 +347,9 @@ static struct i2c_board_info __initdata i2c_info[] =
{
  {
  I2C_BOARD_INFO(cpld_reg0, 0x3a),
  },
 +{
 +I2C_BOARD_INFO(cpld_video, 0x3B),
 +},
  };
 
  static struct davinci_i2c_platform_data i2c_pdata = {
 @@ -307,11 +357,85 @@ static struct davinci_i2c_platform_data i2c_pdata =
{
  .bus_delay  = 0 /* usec */,
  };
 
 +static int set_vpif_clock(int mux_mode, int hd)
 +{
 +int val = 0;
 +int err = 0;
 +unsigned int value;
 +void __iomem *base = IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE);
 +
 +if (!cpld_client)
 +return -ENXIO;
 +
 +/* disable the clock */
 +value = __raw_readl(base + VSCLKDIS_OFFSET);
 +value |= (VIDCH3CLK | VIDCH2CLK);
 +__raw_writel(value, base + VSCLKDIS_OFFSET);
 +
 +val = i2c_smbus_read_byte(cpld_client);
 +if (val  0)
 +return val;
 +
 +if (mux_mode == 1)
 +val = ~0x40;
 +else
 +val |= 0x40;
 +
 +err = i2c_smbus_write_byte(cpld_client, val);
 +if (err)
 +return err;
 +
 +value = __raw_readl(base + VIDCLKCTL_OFFSET);
 +value = ~(VCH2CLK_MASK);
 +value = ~(VCH3CLK_MASK);
 +
 +if (hd = 1)
 +value |= (VCH2CLK_SYSCLK8 | VCH3CLK_SYSCLK8);
 +else
 +value |= (VCH2CLK_AUXCLK | VCH3CLK_AUXCLK);
 +
 +__raw_writel(value, base + VIDCLKCTL_OFFSET);
 +
 +/* enable the clock */
 +value = __raw_readl(base + VSCLKDIS_OFFSET);
 +value = ~(VIDCH3CLK | VIDCH2CLK);
 +__raw_writel(value, base + VSCLKDIS_OFFSET);
 +
 +return 0;
 +}
 +
 +static const struct vpif_subdev_info 

RE: [PATCH v3] ARM: DaVinci: DM646x Video: Platform and board specific setup

2009-08-03 Thread chaithrika
Mauro,

OK. Thank you for taking care of this.

On Mon, Aug 03, 2009 at 11:20:03, Mauro Carvalho Chehab wrote:
 Em Mon, 3 Aug 2009 09:17:06 +0530
 chaithrika chaithr...@ti.com escreveu:
 
  Mauro/Russell,
  
  The previous version (v2) of this patch is on the linux-next tree.
  This patch has some updates done on top of that patch. Should I post 
  an incremental patch for those changes to the Linux-next tree?
  Please suggest.
  
 It is not needed. After having Russell ack, I'll just replace the old
patch by the new one.
 
 
 
 Cheers,
 Mauro
 


Regards, 
Chaithrika


___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: [PATCH v3] ARM: DaVinci: DM646x Video: Platform and board specific setup

2009-08-02 Thread chaithrika
Mauro/Russell,

The previous version (v2) of this patch is on the linux-next tree.
This patch has some updates done on top of that patch. Should I
post an incremental patch for those changes to the Linux-next tree?
Please suggest.

Regards,
Chaithrika

On Mon, Jul 20, 2009 at 13:31:22, Chaithrika U S wrote:
 Platform specific display device setup for DM646x EVM
 
 Add platform device and resource structures. Also define a platform
specific
 clock setup function that can be accessed by the driver to configure the
clock
 and CPLD.
 
 Signed-off-by: Manjunath Hadli m...@ti.com
 Signed-off-by: Brijesh Jadav brijes...@ti.com
 Signed-off-by: Chaithrika U S chaithr...@ti.com
 Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
 ---
 Applies to Davinci GIT tree. Minor updates like change in structure name-
 subdev_info to vpif_subdev_info and correction to VDD3P3V_VID_MASK value.
 
  arch/arm/mach-davinci/board-dm646x-evm.c|  125
+++
  arch/arm/mach-davinci/dm646x.c  |   62 +
  arch/arm/mach-davinci/include/mach/dm646x.h |   24 +
  3 files changed, 211 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c
b/arch/arm/mach-davinci/board-dm646x-evm.c
 index b1bf18c..8c88fd0 100644
 --- a/arch/arm/mach-davinci/board-dm646x-evm.c
 +++ b/arch/arm/mach-davinci/board-dm646x-evm.c
 @@ -63,6 +63,19 @@
  #define DM646X_EVM_PHY_MASK  (0x2)
  #define DM646X_EVM_MDIO_FREQUENCY(220) /* PHY bus frequency */
  
 +#define VIDCLKCTL_OFFSET (0x38)
 +#define VSCLKDIS_OFFSET  (0x6c)
 +
 +#define VCH2CLK_MASK (BIT_MASK(10) | BIT_MASK(9) | BIT_MASK(8))
 +#define VCH2CLK_SYSCLK8  (BIT(9))
 +#define VCH2CLK_AUXCLK   (BIT(9) | BIT(8))
 +#define VCH3CLK_MASK (BIT_MASK(14) | BIT_MASK(13) | BIT_MASK(12))
 +#define VCH3CLK_SYSCLK8  (BIT(13))
 +#define VCH3CLK_AUXCLK   (BIT(14) | BIT(13))
 +
 +#define VIDCH2CLK(BIT(10))
 +#define VIDCH3CLK(BIT(11))
 +
  static struct davinci_uart_config uart_config __initdata = {
   .enabled_uarts = (1  0),
  };
 @@ -288,6 +301,40 @@ static struct snd_platform_data dm646x_evm_snd_data[]
= {
   },
  };
  
 +static struct i2c_client *cpld_client;
 +
 +static int cpld_video_probe(struct i2c_client *client,
 + const struct i2c_device_id *id)
 +{
 + cpld_client = client;
 + return 0;
 +}
 +
 +static int __devexit cpld_video_remove(struct i2c_client *client)
 +{
 + cpld_client = NULL;
 + return 0;
 +}
 +
 +static const struct i2c_device_id cpld_video_id[] = {
 + { cpld_video, 0 },
 + { }
 +};
 +
 +static struct i2c_driver cpld_video_driver = {
 + .driver = {
 + .name   = cpld_video,
 + },
 + .probe  = cpld_video_probe,
 + .remove = cpld_video_remove,
 + .id_table   = cpld_video_id,
 +};
 +
 +static void evm_init_cpld(void)
 +{
 + i2c_add_driver(cpld_video_driver);
 +}
 +
  static struct i2c_board_info __initdata i2c_info[] =  {
   {
   I2C_BOARD_INFO(24c256, 0x50),
 @@ -300,6 +347,9 @@ static struct i2c_board_info __initdata i2c_info[] =
{
   {
   I2C_BOARD_INFO(cpld_reg0, 0x3a),
   },
 + {
 + I2C_BOARD_INFO(cpld_video, 0x3B),
 + },
  };
  
  static struct davinci_i2c_platform_data i2c_pdata = {
 @@ -307,11 +357,85 @@ static struct davinci_i2c_platform_data i2c_pdata =
{
   .bus_delay  = 0 /* usec */,
  };
  
 +static int set_vpif_clock(int mux_mode, int hd)
 +{
 + int val = 0;
 + int err = 0;
 + unsigned int value;
 + void __iomem *base = IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE);
 +
 + if (!cpld_client)
 + return -ENXIO;
 +
 + /* disable the clock */
 + value = __raw_readl(base + VSCLKDIS_OFFSET);
 + value |= (VIDCH3CLK | VIDCH2CLK);
 + __raw_writel(value, base + VSCLKDIS_OFFSET);
 +
 + val = i2c_smbus_read_byte(cpld_client);
 + if (val  0)
 + return val;
 +
 + if (mux_mode == 1)
 + val = ~0x40;
 + else
 + val |= 0x40;
 +
 + err = i2c_smbus_write_byte(cpld_client, val);
 + if (err)
 + return err;
 +
 + value = __raw_readl(base + VIDCLKCTL_OFFSET);
 + value = ~(VCH2CLK_MASK);
 + value = ~(VCH3CLK_MASK);
 +
 + if (hd = 1)
 + value |= (VCH2CLK_SYSCLK8 | VCH3CLK_SYSCLK8);
 + else
 + value |= (VCH2CLK_AUXCLK | VCH3CLK_AUXCLK);
 +
 + __raw_writel(value, base + VIDCLKCTL_OFFSET);
 +
 + /* enable the clock */
 + value = __raw_readl(base + VSCLKDIS_OFFSET);
 + value = ~(VIDCH3CLK | VIDCH2CLK);
 + __raw_writel(value, base + VSCLKDIS_OFFSET);
 +
 + return 0;
 +}
 +
 +static const struct vpif_subdev_info dm646x_vpif_subdev[] = {
 + {
 + .addr   = 0x2A,
 + .name   = adv7343,
 + },
 + {
 + .addr   = 0x2C,
 +