Re: adv7180 support

2010-03-11 Thread Raffaele Recalcati
2010/3/12 Nori, Sekhar 

>
> Hello Raffaele,
>
> On Thu, Mar 11, 2010 at 21:44:58, Raffaele Recalcati wrote:
> > We are starting developing adv7180 support compliant to arago tree.
> > I hope it is a good idea, and when khilman tree will be the possible
> > davinci standard tree we'll move to it changing adv7180 support.
> > Any suggestion is welcome.
>
> Note that patches are not accepted against arago tree. It is only
> a TI development tree. You can use it for testing, but the patch
> you submit should be against the tree V4L2 maintainer mandates.
>
> Typically only arch/arm/mach-davinci/* changes are merged through
> Kevin's tree.
>

I was writing now about adv7180 replying to Hilman.
So "the right thing" is moving my development to Kevin  branch.
I'd like to be as near as possible to the mainline, by now.
Any idea about evm-dm365 peripheral tests?


>
> Thanks,
> Sekhar
>



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


RE: adv7180 support

2010-03-11 Thread Nori, Sekhar

Hello Raffaele,

On Thu, Mar 11, 2010 at 21:44:58, Raffaele Recalcati wrote:
> We are starting developing adv7180 support compliant to arago tree.
> I hope it is a good idea, and when khilman tree will be the possible
> davinci standard tree we'll move to it changing adv7180 support.
> Any suggestion is welcome.

Note that patches are not accepted against arago tree. It is only
a TI development tree. You can use it for testing, but the patch
you submit should be against the tree V4L2 maintainer mandates.

Typically only arch/arm/mach-davinci/* changes are merged through
Kevin's tree.

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


Re: davinci git updated to v2.6.34-rc1

2010-03-11 Thread Raffaele Recalcati
2010/3/12 Kevin Hilman 

> FYI...
>
> Davinci git has now been updated to v2.6.34-rc1.  With this release,
> we have dramatically reduced the gap between davinci git and mainline
> with lots of stuff making it in for 2.6.34.   Nice work!
>
>
Nice!
I need anyway more explanations.
I see you are talking about:
http://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
and not:
http://arago-project.org/git/projects/linux-davinci.git

So,
the best thing for me should be to move exactly now to it for testing input
video with adv7180 on dm365?

Maybe I spend more time at this moment, but if it is "the right thing" I
will spend less time in the future rebasing my code from arago old tree.

Suggestions?
___
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 3/4] OMAP3 : clock data: Update name string for EMAC clocks.

2010-03-11 Thread Paul Walmsley
On Thu, 11 Mar 2010, Sriramakrishnan wrote:

> The emac driver uses generic name for the module and phy
> clocks. Updated the omap3xxx_clks table to match the names
> used by the Davinci emac driver.
> 
> Signed-off-by: Sriramakrishnan 

Acked-by: Paul Walmsley 

At some point, someone should go through that davinci_emac.c driver and 
change the DaVinci references to "TI" or something generic, now that this 
core exists on DaVinci, OMAP, etc.

> ---
>  arch/arm/mach-omap2/clock3xxx_data.c |4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
> b/arch/arm/mach-omap2/clock3xxx_data.c
> index d5153b6..989da2e 100644
> --- a/arch/arm/mach-omap2/clock3xxx_data.c
> +++ b/arch/arm/mach-omap2/clock3xxx_data.c
> @@ -3472,8 +3472,8 @@ static struct omap_clk omap3xxx_clks[] = {
>   CLK(NULL,   "ipss_ick", &ipss_ick,  CK_AM35XX),
>   CLK(NULL,   "rmii_ck",  &rmii_ck,   CK_AM35XX),
>   CLK(NULL,   "pclk_ck",  &pclk_ck,   CK_AM35XX),
> - CLK("davinci_emac", "ick",  &emac_ick,  CK_AM35XX),
> - CLK("davinci_emac", "fck",  &emac_fck,  CK_AM35XX),
> + CLK("davinci_emac", "emac_clk", &emac_ick,  CK_AM35XX),
> + CLK("davinci_emac", "phy_clk",  &emac_fck,  CK_AM35XX),
>   CLK("vpfe-capture", "master",   &vpfe_ick,  CK_AM35XX),
>   CLK("vpfe-capture", "slave",&vpfe_fck,  CK_AM35XX),
>   CLK("musb_hdrc","ick",  &hsotgusb_ick_am35xx,   
> CK_AM35XX),
> -- 
> 1.6.2.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


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


davinci git updated to v2.6.34-rc1

2010-03-11 Thread Kevin Hilman
FYI...

Davinci git has now been updated to v2.6.34-rc1.  With this release,
we have dramatically reduced the gap between davinci git and mainline
with lots of stuff making it in for 2.6.34.   Nice work!

Currently there are only 21 patches in davinci git that are not in
mainline, and several of those are fixes that will be queued for
2.6.34-rc.

Kevin

___
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] davinci: MMC: Pass number of SG segments as platform data

2010-03-11 Thread Kevin Hilman
Sudhakar Rajashekhara  writes:

> On some platforms like DM355, the number of EDMA parameter
> slots available for EDMA_SLOT_ANY usage are few. In such cases,
> if MMC/SD uses 16 slots for each instance of MMC controller,
> then the number of slots available for other modules will be
> very few.
>
> By passing the number of EDMA slots to be used in MMC driver
> from platform data, EDMA slots available for other purposes
> can be controlled.
>
> Signed-off-by: Sudhakar Rajashekhara 
> ---
>  arch/arm/mach-davinci/include/mach/mmc.h |3 +++
>  drivers/mmc/host/davinci_mmc.c   |   22 +++---
>  2 files changed, 18 insertions(+), 7 deletions(-)
>

[...]

> @@ -1202,6 +1206,10 @@ static int __init davinci_mmcsd_probe(struct 
> platform_device *pdev)
>  
>   init_mmcsd_host(host);
>  
> + host->nr_sg = pdata->nr_sg - 1;

If a board doesn't setup pdata->nr_sg it will be zero, leaving
host->nr_sg = -1.

> + if (host->nr_sg > MAX_NR_SG || host->nr_sg == 0)
> + host->nr_sg = MAX_NR_SG;

Since host->nr_sg is unsigned, you get lucky and fix it up here, but
for readability, this not too clean and should be more thorough.

Wrapping the above in 'if (pdata->nr_sg)' is a more standard way
of handling optional platform_data paramaters.

Kevin
___
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] davinci: edma: clear events in edma_start()

2010-03-11 Thread Kevin Hilman
Brian Niebuhr  writes:

> This patch fixes an issue where a DMA channel can erroneously process an
> event generated by a previous transfer.  A failure case is where DMA is
> being used for SPI transmit and receive channels on OMAP L138.  In this
> case there is a single bit that controls all event generation from the
> SPI peripheral.  Therefore it is possible that between when edma_stop()
> has been called for the transmit channel on a previous transfer and
> edma_start() is called for the transmit channel on a subsequent transfer,
> that a transmit event has been generated.
>
> The fix is to clear events in edma_start().  This prevents false events
> from being processed when events are enabled for that channel.
>
> Signed-off-by: Brian Niebuhr 

Thanks, applying and queuing in davinci-fixes for v2.6.34-rc

Kevin

> ---
>  arch/arm/mach-davinci/dma.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
> index 5cd48fa..52c16ff 100644
> --- a/arch/arm/mach-davinci/dma.c
> +++ b/arch/arm/mach-davinci/dma.c
> @@ -1290,7 +1290,8 @@ int edma_start(unsigned channel)
>   /* EDMA channel with event association */
>   pr_debug("EDMA: ER%d %08x\n", j,
>   edma_shadow0_read_array(ctlr, SH_ER, j));
> - /* Clear any pending error */
> + /* Clear any pending event or error */
> + edma_write_array(ctlr, EDMA_ECR, j, mask);
>   edma_write_array(ctlr, EDMA_EMCR, j, mask);
>   /* Clear any SER */
>   edma_shadow0_write_array(ctlr, SH_SECR, j, mask);
> -- 
> 1.6.3.3
>
> ___
> 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] net: davinci emac: use dma_{map, unmap}_single API for cache coherency

2010-03-11 Thread Kevin Hilman
Sekhar Nori  writes:

> The davinci emac driver uses some ARM specific DMA APIs
> for cache coherency which have been removed from kernel
> with the 2.6.34 merge.
>
> Modify the driver to use the dma_{map, unmap}_single() APIs
> defined in dma-mapping.h
>
> Without this fix, the driver fails to compile on Linus's
> tree.
>
> Tested on DM365 and OMAP-L138 EVMs.
>
> Signed-off-by: Sekhar Nori 

Acked-by: Kevin Hilman 

Verified that this is compiling/running again with v2.6.34-rc1.

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


RE: DM365, NAND and FS

2010-03-11 Thread Bill Goetz
Hi Sandeep,

To fix the "jffs2_get_inode_nodes: Node header CRC failed at 0x190c6f48"
errors, I've been using the "nand markbad" from U-Boot to mark the bad
blocks (in the above case, the command would be 'nand markbad
0x190c').  Now that I've updated to the latest U-Boot code, Linux
now does pick up the bad block tables written from U-Boot (thanks for
that!)  Once the particular block(s) as bad, I then reflash the NAND
partition that was affected and the CRC errors are gone.

However, we're seeing quite a few CRC errors.  On one unit, after
marking a bunch of bad blocks, then reflashing, we're seeing a few more
CRC errors so we have to repeat the process.  Again, after the reflash,
CRC errors appeared on yet a different address!!  Is this common
We've got an FPGA also on the EMIFA bus (using a different CS).  That
shouldn't be causing it.  If it were, I'm sure we'd be seeing errors on
many other units.  Any insights?

Thanks,
 Bill

-Original Message-
From: davinci-linux-open-source-boun...@linux.davincidsp.com
[mailto:davinci-linux-open-source-boun...@linux.davincidsp.com] On
Behalf Of Paulraj, Sandeep
Sent: Wednesday, March 10, 2010 7:25 AM
To: Mile Davidovic; davinci
Subject: RE: DM365, NAND and FS


> 
> Hello
> On DM365 board I saw following printout:
> U-Boot 2009.03 (Nov 16 2009 - 13:02:47)
> 
> I2C:   ready
> DRAM:  128 MB
> NAND:  NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron NAND
> 1GiB 3,3V 8-bit)
> Bad block table found at page 524224, version 0x01
> Bad block table found at page 524160, version 0x01
> NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron NAND 1GiB
3,3V
> 8-bit)
> Bad block table found at page 524224, version 0x01
> Bad block table found at page 524096, version 0x01
> 2048 MiB
> In:serial
> 
> NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron NAND 1GiB
3,3V
> 8-bit)
> 2 NAND chips detected
> Bad block table found at page 524224, version 0x01
> Bad block table found at page 1048512, version 0x01
> Bad block table found at page 524160, version 0x01
> Bad block table found at page 1048384, version 0x01
> nand_read_bbt: Bad block at 0x0082
> nand_read_bbt: Bad block at 0x08aa
> nand_read_bbt: Bad block at 0x0fac
> nand_read_bbt: Bad block at 0x1528
> nand_read_bbt: Bad block at 0x16ea
> nand_read_bbt: Bad block at 0x1a72
> nand_read_bbt: Bad block at 0x1c12
> nand_read_bbt: Bad block at 0x238e
> nand_read_bbt: Bad block at 0x2834
> nand_read_bbt: Bad block at 0x2868
> nand_read_bbt: Bad block at 0x3064
> nand_read_bbt: Bad block at 0x3256
> nand_read_bbt: Bad block at 0x382c
> nand_read_bbt: Bad block at 0x3bec
> nand_read_bbt: Bad block at 0x3c24
> nand_read_bbt: Bad block at 0x4bd6
> nand_read_bbt: Bad block at 0x4be4
> nand_read_bbt: Bad block at 0x685c
> nand_read_bbt: Bad block at 0x6ea2
> nand_read_bbt: Bad block at 0x6ede
> nand_read_bbt: Bad block at 0x6fda
> nand_read_bbt: Bad block at 0x7602
> nand_read_bbt: Bad block at 0x7df4
> nand_read_bbt: Bad block at 0x7e72
> nand_read_bbt: Bad block at 0x7ffc


There is nothing wrong in getting these messages. U-boot is merely
reporting bad blocks


> Creating 5 MTD partitions on "davinci_nand.0":
> 0x-0x00f0 : "bootloader"
> 0x00f0-0x0100 : "params"
> 0x0100-0x0140 : "kernel"
> 0x0140-0x2140 : "filesystem1"
> 0x2140-0x8000 : "filesystem2"
> davinci_nand davinci_nand.0: controller rev. 2.3
> ...
> mtd->read(0xb8 bytes from 0x190c6f48) returned ECC error
> JFFS2 notice: (1007) jffs2_get_inode_nodes: Node header CRC failed at
> 0x190c6f48. {0219,c0e0,7100,99faccda}
> JFFS2 notice: (1007) jffs2_get_inode_nodes: Node header CRC failed at
> 0x190c6e88. {0219,c0e0,7100,99faccda}
> JFFS2 notice: (1007) jffs2_get_inode_nodes: Node header CRC failed at
> 0x190c6d20. {0219,68e0,ac01,9973d181}
> JFFS2 notice: (1007) jffs2_get_inode_nodes: Node header CRC failed at
> 0x190c6c60. {0219,c0e0,7100,99faccda}
> JFFS2 notice: (1007) jffs2_get_inode_nodes: Node header CRC failed at
> 0x190c6ba0. {0219,c0e0,7100,99faccda}
> ...
> Also during boot I got following:
> Empty flash at 0x092b9700 ends at 0x092b9800
> Empty flash at 0x460b4d44 ends at 0x460b5000
> Empty flash at 0x59a0d8dc ends at 0x59a0e000
> 
> My questions are:
> - is it normal board behavior (we have issues with JFFS2 and NAND)
from
> start
> - is it possible that we somehow "repair" this board?
> - what is "recommended" FS for NAND?
> - is any chance that problems with NAND is caused with wrong u-boot,
> linux, ...
> 
> Kind regards
> mile
> ___
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-op

Re: [PATCH] davinci: MMC: Pass number of SG segments as platform data

2010-03-11 Thread Sergei Shtylyov

Hello.

Sudhakar Rajashekhara wrote:


On some platforms like DM355, the number of EDMA parameter
slots available for EDMA_SLOT_ANY usage are few. In such cases,
if MMC/SD uses 16 slots for each instance of MMC controller,
then the number of slots available for other modules will be
very few.

By passing the number of EDMA slots to be used in MMC driver
from platform data, EDMA slots available for other purposes
can be controlled.

Signed-off-by: Sudhakar Rajashekhara 
---
 arch/arm/mach-davinci/include/mach/mmc.h |3 +++
 drivers/mmc/host/davinci_mmc.c   |   22 +++---
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/mmc.h 
b/arch/arm/mach-davinci/include/mach/mmc.h
index 5a85e24..384fc0e 100644
--- a/arch/arm/mach-davinci/include/mach/mmc.h
+++ b/arch/arm/mach-davinci/include/mach/mmc.h
@@ -22,6 +22,9 @@ struct davinci_mmc_config {
 
 	/* Version of the MMC/SD controller */

u8  version;
+
+   /* Number of sg segments */
+   u32 nr_sg;
  


 Why waste 4 bytres if the maximum number is 16?


diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 3bd0ba2..19c050c 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -137,15 +137,15 @@
 
 /*

  * One scatterlist dma "segment" is at most MAX_CCNT rw_threshold units,
- * and we handle up to NR_SG segments.  MMC_BLOCK_BOUNCE kicks in only
+ * and we handle up to MAX_NR_SG segments.  MMC_BLOCK_BOUNCE kicks in only
  * for drivers with max_hw_segs == 1, making the segments bigger (64KB)
- * than the page or two that's otherwise typical.  NR_SG == 16 gives at
- * least the same throughput boost, using EDMA transfer linkage instead
- * of spending CPU time copying pages.
+ * than the page or two that's otherwise typical. nr_sg (passed from
+ * platform data) == 16 gives at least the same throughput boost, using
+ * EDMA transfer linkage instead of spending CPU time copying pages.
  */
 #define MAX_CCNT   ((1 << 16) - 1)
 
-#define NR_SG		16

+#define MAX_NR_SG  16
 
 static unsigned rw_threshold = 32;

 module_param(rw_threshold, uint, S_IRUGO);
@@ -192,7 +192,7 @@ struct mmc_davinci_host {
struct edmacc_param tx_template;
struct edmacc_param rx_template;
unsignedn_link;
-   u32 links[NR_SG - 1];
+   u32 links[MAX_NR_SG - 1];
 
 	/* For PIO we walk scatterlists one segment at a time. */
  



unsigned intsg_len;
@@ -202,6 +202,8 @@ struct mmc_davinci_host {
u8 version;
/* for ns in one cycle calculation */
unsigned ns_in_one_cycle;
+   /* Number of sg segments */
+   u32 nr_sg;
  


  Same question.

WBR, Sergei

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


xDM vs xDAIS

2010-03-11 Thread Wendy Wang
Any examples (ie fft dct) of using cache memory instead of external memory? 


___
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 6/6] i2c: davinci: bus recovery procedure to clear the bus

2010-03-11 Thread Griffis, Brad
> -Original Message-
> From: Philby John [mailto:pj...@mvista.com]
> Sent: Monday, March 08, 2010 7:37 AM
> To: Griffis, Brad
> Cc: Nori, Sekhar; davinci-linux-open-source@linux.davincidsp.com; linux-
> i...@vger.kernel.org
> Subject: Re: [PATCH 6/6] i2c: davinci: bus recovery procedure to clear the
> bus
> 
> I did go through your document, but what does "free data format" mean?
> It would be good to expand the procedure that enables you to move into
> this mode. If this wouldn't require modfying pinmux settings shouldn't
> it be part of the core i2c implementation?

Just to make sure my point was clear, I think the GPIO method is simpler/easier 
if you're just looking at a single device and assuming that device has muxed 
the I2C with GPIO.  That said, my method is a little more 
complicated/convoluted when looking at a single device, but I think the code 
would scale better across the entire Davinci tree since it requires no 
knowledge of whether the pin-muxing option is available and how the pin-muxing 
is implemented for that particular device.

You enter the "free data format" mode by setting the FDF bit in the ICMDR 
register.  It is described in Section 2.6.3 of the OMAP-L138 I2C Guide:

http://www.ti.com/lit/sprufl9

The advantage of using this mode is that you would not require any 
device-specific pin-muxing knowledge/changes.  The entire recovery can occur 
within the context of the I2C controller.

So to do a read in the "free data format" mode you would write ICMDR.FDF = 1 
(free data format), ICMDR.TRX = 0 (read), ICMDR.STT = 1 (start), ICMDR.STP = 1. 
 This should cause it to clock in 8 bits of data plus an ack, freeing up the 
bus.

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


adv7180 support

2010-03-11 Thread Raffaele Recalcati
We are starting developing adv7180 support compliant to arago tree.
I hope it is a good idea, and when khilman tree will be the possible davinci
standard tree we'll move to it changing adv7180 support.
Any suggestion is welcome.

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


[PATCH v2 1/5] MFD: DaVinci Voice Codec

2010-03-11 Thread miguel . aguilar
From: Miguel Aguilar 

This is the MFD driver for the DaVinci Voice codec, it has two clients:

* Voice codec interface
* Voice codec CQ93VC

Signed-off-by: Miguel Aguilar 
---
 drivers/mfd/Kconfig|4 +
 drivers/mfd/Makefile   |1 +
 drivers/mfd/davinci_voicecodec.c   |  189 
 include/linux/mfd/davinci_voicecodec.h |  126 +
 4 files changed, 320 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/davinci_voicecodec.c
 create mode 100644 include/linux/mfd/davinci_voicecodec.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 8782978..6e93c0b 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -43,6 +43,10 @@ config MFD_SH_MOBILE_SDHI
  This driver supports the SDHI hardware block found in many
  SuperH Mobile SoCs.
 
+config MFD_DAVINCI_VOICECODEC
+   tristate
+   select MFD_CORE
+
 config MFD_DM355EVM_MSP
bool "DaVinci DM355 EVM microcontroller"
depends on I2C && MACH_DAVINCI_DM355_EVM
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index ca2f2c4..f5c617f 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_MFD_SH_MOBILE_SDHI)+= 
sh_mobile_sdhi.o
 obj-$(CONFIG_HTC_EGPIO)+= htc-egpio.o
 obj-$(CONFIG_HTC_PASIC3)   += htc-pasic3.o
 
+obj-$(CONFIG_MFD_DAVINCI_VOICECODEC)   += davinci_voicecodec.o
 obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o
 
 obj-$(CONFIG_MFD_T7L66XB)  += t7l66xb.o
diff --git a/drivers/mfd/davinci_voicecodec.c b/drivers/mfd/davinci_voicecodec.c
new file mode 100644
index 000..9886aa8
--- /dev/null
+++ b/drivers/mfd/davinci_voicecodec.c
@@ -0,0 +1,189 @@
+/*
+ * DaVinci Voice Codec Core Interface for TI platforms
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc
+ *
+ * Author: Miguel Aguilar 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+u32 davinci_vc_read(struct davinci_vc *davinci_vc, int reg)
+{
+   return __raw_readl(davinci_vc->base + reg);
+}
+
+void davinci_vc_write(struct davinci_vc *davinci_vc,
+  int reg, u32 val)
+{
+   __raw_writel(val, davinci_vc->base + reg);
+}
+
+static int __init davinci_vc_probe(struct platform_device *pdev)
+{
+   struct davinci_vc *davinci_vc;
+   struct resource *res, *mem;
+   struct mfd_cell *cell = NULL;
+   int ret;
+
+   davinci_vc = kzalloc(sizeof(struct davinci_vc), GFP_KERNEL);
+   if (!davinci_vc) {
+   dev_dbg(&pdev->dev,
+   "could not allocate memory for private data\n");
+   return -ENOMEM;
+   }
+
+   davinci_vc->clk = clk_get(&pdev->dev, NULL);
+   if (IS_ERR(davinci_vc->clk)) {
+   dev_dbg(&pdev->dev,
+   "could not get the clock for voice codec\n");
+   ret = -ENODEV;
+   goto fail1;
+   }
+   clk_enable(davinci_vc->clk);
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!res) {
+   dev_err(&pdev->dev, "no mem resource\n");
+   ret = -ENODEV;
+   goto fail2;
+   }
+
+   davinci_vc->pbase = res->start;
+   davinci_vc->base_size = resource_size(res);
+
+   mem = request_mem_region(davinci_vc->pbase, davinci_vc->base_size,
+pdev->name);
+   if (!mem) {
+   dev_err(&pdev->dev, "VCIF region already claimed\n");
+   ret = -EBUSY;
+   goto fail2;
+   }
+
+   davinci_vc->base = ioremap(davinci_vc->pbase, davinci_vc->base_size);
+   if (!davinci_vc->base) {
+   dev_err(&pdev->dev, "can't ioremap mem resource.\n");
+   ret = -ENOMEM;
+   goto fail3;
+   }
+
+   res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+   if (!res) {
+   dev_err(&pdev->dev, "no DMA resource\n");
+   return -ENXIO;
+   }
+
+   davinci_vc->davinci_vcif.dma_tx_channel = res->start;
+   davinci_vc->davinci_vcif.dma_tx_addr =
+   (dma_addr_t)(io_v2p(davinci_vc->base) + DAVINCI_VC_WFIFO);
+
+ 

[PATCH 4/5] DaVinci: DM365: Voice codec support for the DM365 SoC

2010-03-11 Thread miguel . aguilar
From: Miguel Aguilar 

This patch adds the generic Voice Codec support for the DM365 based
platforms.

Signed-off-by: Miguel Aguilar 
---
 arch/arm/mach-davinci/dm365.c  |   37 +++-
 arch/arm/mach-davinci/include/mach/dm365.h |5 
 arch/arm/mach-davinci/include/mach/mux.h   |2 +
 3 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index c63afc0..b5345d5 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -455,7 +455,7 @@ static struct clk_lookup dm365_clks[] = {
CLK(NULL, "timer3", &timer3_clk),
CLK(NULL, "usb", &usb_clk),
CLK("davinci_emac.1", NULL, &emac_clk),
-   CLK("voice_codec", NULL, &voicecodec_clk),
+   CLK("davinci_voicecodec", NULL, &voicecodec_clk),
CLK("davinci-asp.0", NULL, &asp0_clk),
CLK(NULL, "rto", &rto_clk),
CLK(NULL, "mjcp", &mjcp_clk),
@@ -606,6 +606,8 @@ INT_CFG(DM365,  INT_NSF_DISABLE, 25,1,0, 
false)
 
 EVT_CFG(DM365, EVT2_ASP_TX, 0, 1,0, false)
 EVT_CFG(DM365, EVT3_ASP_RX, 1, 1,0, false)
+EVT_CFG(DM365, EVT2_VC_TX,  0, 1,1, false)
+EVT_CFG(DM365, EVT3_VC_RX,  1, 1,1, false)
 #endif
 };
 
@@ -835,6 +837,31 @@ static struct platform_device dm365_asp_device = {
.resource   = dm365_asp_resources,
 };
 
+static struct resource dm365_vc_resources[] = {
+   {
+   .start  = DAVINCI_DM365_VC_BASE,
+   .end= DAVINCI_DM365_VC_BASE + SZ_1K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = DAVINCI_DMA_VC_TX,
+   .end= DAVINCI_DMA_VC_TX,
+   .flags  = IORESOURCE_DMA,
+   },
+   {
+   .start  = DAVINCI_DMA_VC_RX,
+   .end= DAVINCI_DMA_VC_RX,
+   .flags  = IORESOURCE_DMA,
+   },
+};
+
+static struct platform_device dm365_vc_device = {
+   .name   = "davinci_voicecodec",
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(dm365_vc_resources),
+   .resource   = dm365_vc_resources,
+};
+
 static struct resource dm365_rtc_resources[] = {
{
.start = DM365_RTC_BASE,
@@ -991,6 +1018,14 @@ void __init dm365_init_asp(struct snd_platform_data 
*pdata)
platform_device_register(&dm365_asp_device);
 }
 
+void __init dm365_init_vc(struct snd_platform_data *pdata)
+{
+   davinci_cfg_reg(DM365_EVT2_VC_TX);
+   davinci_cfg_reg(DM365_EVT3_VC_RX);
+   dm365_vc_device.dev.platform_data = pdata;
+   platform_device_register(&dm365_vc_device);
+}
+
 void __init dm365_init_ks(struct davinci_ks_platform_data *pdata)
 {
dm365_ks_device.dev.platform_data = pdata;
diff --git a/arch/arm/mach-davinci/include/mach/dm365.h 
b/arch/arm/mach-davinci/include/mach/dm365.h
index 3c07a88..57e51eb 100644
--- a/arch/arm/mach-davinci/include/mach/dm365.h
+++ b/arch/arm/mach-davinci/include/mach/dm365.h
@@ -31,8 +31,13 @@
 
 #define DM365_RTC_BASE (0x01C69000)
 
+#define DAVINCI_DM365_VC_BASE  (0x01D0C000)
+#define DAVINCI_DMA_VC_TX  2
+#define DAVINCI_DMA_VC_RX  3
+
 void __init dm365_init(void);
 void __init dm365_init_asp(struct snd_platform_data *pdata);
+void __init dm365_init_vc(struct snd_platform_data *pdata);
 void __init dm365_init_ks(struct davinci_ks_platform_data *pdata);
 void __init dm365_init_rtc(void);
 
diff --git a/arch/arm/mach-davinci/include/mach/mux.h 
b/arch/arm/mach-davinci/include/mach/mux.h
index 137bfba..2a68c1d 100644
--- a/arch/arm/mach-davinci/include/mach/mux.h
+++ b/arch/arm/mach-davinci/include/mach/mux.h
@@ -327,6 +327,8 @@ enum davinci_dm365_index {
/* EDMA event muxing */
DM365_EVT2_ASP_TX,
DM365_EVT3_ASP_RX,
+   DM365_EVT2_VC_TX,
+   DM365_EVT3_VC_RX,
DM365_EVT26_MMC0_RX,
 };
 
-- 
1.6.0.4

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


[PATCH v2 2/5] ASoC: DaVinci: Voice Codec Interface

2010-03-11 Thread miguel . aguilar
From: Miguel Aguilar 

This patch adds the support for the interface needed by the DaVinci
Voice Codec CQ93VC.

Signed-off-by: Miguel Aguilar 
---
 sound/soc/davinci/Kconfig|3 +
 sound/soc/davinci/Makefile   |2 +
 sound/soc/davinci/davinci-vcif.c |  272 ++
 sound/soc/davinci/davinci-vcif.h |   28 
 4 files changed, 305 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/davinci/davinci-vcif.c
 create mode 100644 sound/soc/davinci/davinci-vcif.h

diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig
index 047ee39..47e7cce 100644
--- a/sound/soc/davinci/Kconfig
+++ b/sound/soc/davinci/Kconfig
@@ -12,6 +12,9 @@ config SND_DAVINCI_SOC_I2S
 config SND_DAVINCI_SOC_MCASP
tristate
 
+config SND_DAVINCI_SOC_VCIF
+   tristate
+
 config SND_DAVINCI_SOC_EVM
tristate "SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM"
depends on SND_DAVINCI_SOC
diff --git a/sound/soc/davinci/Makefile b/sound/soc/davinci/Makefile
index a6939d7..a93679d 100644
--- a/sound/soc/davinci/Makefile
+++ b/sound/soc/davinci/Makefile
@@ -2,10 +2,12 @@
 snd-soc-davinci-objs := davinci-pcm.o
 snd-soc-davinci-i2s-objs := davinci-i2s.o
 snd-soc-davinci-mcasp-objs:= davinci-mcasp.o
+snd-soc-davinci-vcif-objs:= davinci-vcif.o
 
 obj-$(CONFIG_SND_DAVINCI_SOC) += snd-soc-davinci.o
 obj-$(CONFIG_SND_DAVINCI_SOC_I2S) += snd-soc-davinci-i2s.o
 obj-$(CONFIG_SND_DAVINCI_SOC_MCASP) += snd-soc-davinci-mcasp.o
+obj-$(CONFIG_SND_DAVINCI_SOC_VCIF) += snd-soc-davinci-vcif.o
 
 # DAVINCI Machine Support
 snd-soc-evm-objs := davinci-evm.o
diff --git a/sound/soc/davinci/davinci-vcif.c b/sound/soc/davinci/davinci-vcif.c
new file mode 100644
index 000..03f3feb
--- /dev/null
+++ b/sound/soc/davinci/davinci-vcif.c
@@ -0,0 +1,272 @@
+/*
+ * ALSA SoC Voice Codec Interface for TI DAVINCI processor
+ *
+ * Copyright (C) 2010 Texas Instruments.
+ *
+ * Author: Miguel Aguilar 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "davinci-pcm.h"
+#include "davinci-i2s.h"
+#include "davinci-vcif.h"
+
+#define MOD_REG_BIT(val, mask, set) do { \
+   if (set) { \
+   val |= mask; \
+   } else { \
+   val &= ~mask; \
+   } \
+} while (0)
+
+struct davinci_vcif_dev {
+   struct davinci_vc *davinci_vc;
+   struct davinci_pcm_dma_params   dma_params[2];
+};
+
+static void davinci_vcif_start(struct snd_pcm_substream *substream)
+{
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct davinci_vcif_dev *davinci_vcif_dev =
+   rtd->dai->cpu_dai->private_data;
+   struct davinci_vc *davinci_vc = davinci_vcif_dev->davinci_vc;
+   u32 w;
+
+   /* Start the sample generator and enable transmitter/receiver */
+   w = readl(davinci_vc->base + DAVINCI_VC_CTRL);
+
+   if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+   MOD_REG_BIT(w, DAVINCI_VC_CTRL_RSTDAC, 1);
+   else
+   MOD_REG_BIT(w, DAVINCI_VC_CTRL_RSTADC, 1);
+
+   writel(w, davinci_vc->base + DAVINCI_VC_CTRL);
+}
+
+static void davinci_vcif_stop(struct snd_pcm_substream *substream)
+{
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct davinci_vcif_dev *davinci_vcif_dev =
+   rtd->dai->cpu_dai->private_data;
+   struct davinci_vc *davinci_vc = davinci_vcif_dev->davinci_vc;
+   u32 w;
+
+   /* Reset transmitter/receiver and sample rate/frame sync generators */
+   w = readl(davinci_vc->base + DAVINCI_VC_CTRL);
+   if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+   MOD_REG_BIT(w, DAVINCI_VC_CTRL_RSTDAC, 0);
+   else
+   MOD_REG_BIT(w, DAVINCI_VC_CTRL_RSTADC, 0);
+
+   writel(w, davinci_vc->base + DAVINCI_VC_CTRL);
+}
+
+static int davinci_vcif_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+   struct davinci_vcif_dev *davinci_vcif_dev = dai->private_data;
+   struct davinci_vc *davinci_vc = davinci_vcif_dev-

[PATCH v2 3/5] ASoC: DaVinci: CQ93VC Voice Codec

2010-03-11 Thread miguel . aguilar
From: Miguel Aguilar 

Currently the DM365 is the only SoC that includes this Voice Codec.

Signed-off-by: Miguel Aguilar 
---
 sound/soc/codecs/Kconfig  |4 +
 sound/soc/codecs/Makefile |2 +
 sound/soc/codecs/cq93vc.c |  298 +
 sound/soc/codecs/cq93vc.h |   29 +
 4 files changed, 333 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/cq93vc.c
 create mode 100644 sound/soc/codecs/cq93vc.h

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 52b005f..0daca22 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -21,6 +21,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_AK4535 if I2C
select SND_SOC_AK4642 if I2C
select SND_SOC_AK4671 if I2C
+   select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC
select SND_SOC_CS4270 if I2C
select SND_SOC_MAX9877 if I2C
select SND_SOC_PCM3008
@@ -108,6 +109,9 @@ config SND_SOC_AK4642
 config SND_SOC_AK4671
tristate
 
+config SND_SOC_CQ0093VC
+   tristate
+
 # Cirrus Logic CS4270 Codec
 config SND_SOC_CS4270
tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index dbaecb1..dff91fb 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -8,6 +8,7 @@ snd-soc-ak4104-objs := ak4104.o
 snd-soc-ak4535-objs := ak4535.o
 snd-soc-ak4642-objs := ak4642.o
 snd-soc-ak4671-objs := ak4671.o
+snd-soc-cq93vc-objs := cq93vc.o
 snd-soc-cs4270-objs := cs4270.o
 snd-soc-cx20442-objs := cx20442.o
 snd-soc-l3-objs := l3.o
@@ -64,6 +65,7 @@ obj-$(CONFIG_SND_SOC_AK4104)  += snd-soc-ak4104.o
 obj-$(CONFIG_SND_SOC_AK4535)   += snd-soc-ak4535.o
 obj-$(CONFIG_SND_SOC_AK4642)   += snd-soc-ak4642.o
 obj-$(CONFIG_SND_SOC_AK4671)   += snd-soc-ak4671.o
+obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o
 obj-$(CONFIG_SND_SOC_CS4270)   += snd-soc-cs4270.o
 obj-$(CONFIG_SND_SOC_CX20442)  += snd-soc-cx20442.o
 obj-$(CONFIG_SND_SOC_L3)   += snd-soc-l3.o
diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c
new file mode 100644
index 000..5132974
--- /dev/null
+++ b/sound/soc/codecs/cq93vc.c
@@ -0,0 +1,298 @@
+/*
+ * ALSA SoC CQ0093 Voice Codec Driver for DaVinci platforms
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc
+ *
+ * Author: Miguel Aguilar 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "cq93vc.h"
+
+static inline unsigned int cq93vc_read(struct snd_soc_codec *codec,
+   unsigned int reg)
+{
+   struct davinci_vc *davinci_vc = codec->control_data;
+
+   return readl(davinci_vc->base + reg);
+}
+
+static inline int cq93vc_write(struct snd_soc_codec *codec, unsigned int reg,
+  unsigned int value)
+{
+   struct davinci_vc *davinci_vc = codec->control_data;
+
+   writel(value, davinci_vc->base + reg);
+
+   return 0;
+}
+
+static const struct snd_kcontrol_new cq93vc_snd_controls[] = {
+   SOC_SINGLE("PGA Capture Volume", DAVINCI_VC_REG05, 0, 0x03, 0),
+   SOC_SINGLE("Mono DAC Playback Volume", DAVINCI_VC_REG09, 0, 0x3f, 0),
+};
+
+static int cq93vc_mute(struct snd_soc_dai *dai, int mute)
+{
+   struct snd_soc_codec *codec = dai->codec;
+   u8 reg = cq93vc_read(codec, DAVINCI_VC_REG09) & ~DAVINCI_VC_REG09_MUTE;
+
+   if (mute)
+   cq93vc_write(codec, DAVINCI_VC_REG09,
+reg | DAVINCI_VC_REG09_MUTE);
+   else
+   cq93vc_write(codec, DAVINCI_VC_REG09, reg);
+
+   return 0;
+}
+
+static int cq93vc_set_dai_sysclk(struct snd_soc_dai *codec_dai,
+int clk_id, unsigned int freq, int dir)
+{
+   struct snd_soc_codec *codec = codec_dai->codec;
+   struct davinci_vc *davinci_vc = codec->control_data;
+
+   switch (freq) {
+   case 22579200:
+   case 2700:
+   case 33868800:
+   davinci_vc->cq93vc.sysclk = freq;
+   return 0;
+   }
+
+   return -EINVAL;
+}
+
+static int cq93vc_set_bias_level(struct snd_soc_codec *codec,
+ 

[PATCH 5/5] DaVinci: DM365: Voice Codec support for the DM365 EVM

2010-03-11 Thread miguel . aguilar
From: Miguel Aguilar 

The DM365 EVM has two codecs: the Audio Codec (AIC3x) and the Voice Codec,
the idea is to have both enabled in the same kernel simultaneously. However,
the current soc-core doesn't support simultaneous codecs, once that
support will have added, a patch will be posted to enable both codecs in
the DM365 EVM.

Signed-off-by: Miguel Aguilar 
---
 arch/arm/mach-davinci/board-dm365-evm.c |4 +++
 sound/soc/davinci/Kconfig   |   24 +++-
 sound/soc/davinci/davinci-evm.c |   45 +-
 3 files changed, 69 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm365-evm.c 
b/arch/arm/mach-davinci/board-dm365-evm.c
index 5c2636c..865d06a 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -516,7 +516,11 @@ static __init void dm365_evm_init(void)
/* maybe setup mmc1/etc ... _after_ mmc0 */
evm_init_cpld();
 
+#ifdef CONFIG_SND_DM365_AIC3X_CODEC
dm365_init_asp(&dm365_evm_snd_data);
+#elif defined(CONFIG_SND_DM365_VOICE_CODEC)
+   dm365_init_vc(&dm365_evm_snd_data);
+#endif
dm365_init_rtc();
dm365_init_ks(&dm365evm_ks_data);
 }
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig
index 47e7cce..6bbf001 100644
--- a/sound/soc/davinci/Kconfig
+++ b/sound/soc/davinci/Kconfig
@@ -18,12 +18,32 @@ config SND_DAVINCI_SOC_VCIF
 config SND_DAVINCI_SOC_EVM
tristate "SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM"
depends on SND_DAVINCI_SOC
-   depends on MACH_DAVINCI_EVM || MACH_DAVINCI_DM355_EVM  || 
MACH_DAVINCI_DM365_EVM
+   depends on MACH_DAVINCI_EVM || MACH_DAVINCI_DM355_EVM || 
MACH_DAVINCI_DM365_EVM
select SND_DAVINCI_SOC_I2S
select SND_SOC_TLV320AIC3X
help
  Say Y if you want to add support for SoC audio on TI
- DaVinci DM6446 or DM355 EVM platforms.
+ DaVinci DM6446, DM355 or DM365 EVM platforms.
+
+choice
+   prompt "DM365 codec select"
+   depends on SND_DAVINCI_SOC_EVM
+   depends on MACH_DAVINCI_DM365_EVM
+   default SND_DM365_EXTERNAL_CODEC
+
+config SND_DM365_AIC3X_CODEC
+   bool "Audio Codec - AIC3101"
+   help
+ Say Y if you want to add support for AIC3101 audio codec
+
+config SND_DM365_VOICE_CODEC
+   bool "Voice Codec - CQ93VC"
+   select MFD_DAVINCI_VOICECODEC
+   select SND_DAVINCI_SOC_VCIF
+   select SND_SOC_CQ0093VC
+   help
+ Say Y if you want to add support for SoC On-chip voice codec
+endchoice
 
 config  SND_DM6467_SOC_EVM
tristate "SoC Audio support for DaVinci DM6467 EVM"
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 7ccbe66..ef63096 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -28,10 +28,12 @@
 #include 
 
 #include "../codecs/tlv320aic3x.h"
+#include "../codecs/cq93vc.h"
 #include "../codecs/spdif_transciever.h"
 #include "davinci-pcm.h"
 #include "davinci-i2s.h"
 #include "davinci-mcasp.h"
+#include "davinci-vcif.h"
 
 #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \
SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF)
@@ -151,6 +153,22 @@ static struct snd_soc_dai_link evm_dai = {
.ops = &evm_ops,
 };
 
+static struct snd_soc_dai_link dm365_evm_dai = {
+#ifdef CONFIG_SND_DM365_AIC3X_CODEC
+   .name = "TLV320AIC3X",
+   .stream_name = "AIC3X",
+   .cpu_dai = &davinci_i2s_dai,
+   .codec_dai = &aic3x_dai,
+   .init = evm_aic3x_init,
+   .ops = &evm_ops,
+#elif defined(CONFIG_SND_DM365_VOICE_CODEC)
+   .name = "Voice Codec - CQ93VC",
+   .stream_name = "CQ93",
+   .cpu_dai = &davinci_vcif_dai,
+   .codec_dai = &cq93vc_dai,
+#endif
+};
+
 static struct snd_soc_dai_link dm6467_evm_dai[] = {
{
.name = "TLV320AIC3X",
@@ -177,7 +195,7 @@ static struct snd_soc_dai_link da8xx_evm_dai = {
.ops = &evm_ops,
 };
 
-/* davinci dm6446, dm355 or dm365 evm audio machine driver */
+/* davinci dm6446, dm355 evm audio machine driver */
 static struct snd_soc_card snd_soc_card_evm = {
.name = "DaVinci EVM",
.platform = &davinci_soc_platform,
@@ -185,6 +203,15 @@ static struct snd_soc_card snd_soc_card_evm = {
.num_links = 1,
 };
 
+/* davinci dm365 evm audio machine driver */
+static struct snd_soc_card dm365_snd_soc_card_evm = {
+   .name = "DaVinci DM365 EVM",
+   .platform = &davinci_soc_platform,
+   .dai_link = &dm365_evm_dai,
+   .num_links = 1,
+};
+
+
 /* davinci dm6467 evm audio machine driver */
 static struct snd_soc_card dm6467_snd_soc_card_evm = {
.name = "DaVinci DM6467 EVM",
@@ -217,6 +244,17 @@ static struct snd_soc_device evm_snd_devdata = {
 };
 
 /* evm audio subsystem */
+static struct snd_soc_device dm365_evm_snd_devdata = {
+   .card = &dm365_snd_soc_card_evm,
+#ifdef CONFIG_SND_DM365_AIC3X_CODEC
+   .codec_dev = &soc_codec_d

[PATCH 4/4] AM3517 defconfig update : enable EMAC support

2010-03-11 Thread Sriramakrishnan
Update the default configuration for AM3517EVM to enable
support for EMAC peripheral.

Signed-off-by: Sriramakrishnan 
---
 arch/arm/configs/am3517_evm_defconfig |   70 -
 1 files changed, 69 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/am3517_evm_defconfig 
b/arch/arm/configs/am3517_evm_defconfig
index 66a10b5..8d79b20 100644
--- a/arch/arm/configs/am3517_evm_defconfig
+++ b/arch/arm/configs/am3517_evm_defconfig
@@ -517,7 +517,75 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_OSD_INITIATOR is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
-# CONFIG_NETDEVICES is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_VETH is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+# CONFIG_LXT_PHY is not set
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+# CONFIG_SMSC_PHY is not set
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+CONFIG_NET_ETHERNET=y
+# CONFIG_MII is not set
+# CONFIG_AX88796 is not set
+# CONFIG_SMC91X is not set
+CONFIG_TI_DAVINCI_EMAC=y
+# CONFIG_DM9000 is not set
+# CONFIG_ETHOC is not set
+# CONFIG_SMC911X is not set
+# CONFIG_SMSC911X is not set
+# CONFIG_DNET is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_1 is not set
+# CONFIG_WLAN is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 # CONFIG_ISDN is not set
 # CONFIG_PHONE is not set
 
-- 
1.6.2.4

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


[PATCH 2/4] AM35xx : Platform specific hookup for EMAC module

2010-03-11 Thread Sriramakrishnan
Modified AM35xx EVM init sequence to handle EMAC
initialization.

Signed-off-by: Sriramakrishnan 
---
 arch/arm/mach-omap2/board-am3517evm.c |   98 +
 1 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index 6ae8805..a454995 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -30,11 +31,106 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include "mux.h"
 
+#define AM35XX_EVM_PHY_MASK(0xF)
+#define AM35XX_EVM_MDIO_FREQUENCY  (100)
+
+static struct emac_platform_data am3517_evm_emac_pdata = {
+   .phy_mask   = AM35XX_EVM_PHY_MASK,
+   .mdio_max_freq  = AM35XX_EVM_MDIO_FREQUENCY,
+   .rmii_en= 1,
+};
+
+static struct resource am3517_emac_resources[] = {
+   {
+   .start  = AM35XX_IPSS_EMAC_BASE,
+   .end= AM35XX_IPSS_EMAC_BASE + 0x3,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_35XX_EMAC_C0_RXTHRESH_IRQ,
+   .end= INT_35XX_EMAC_C0_RXTHRESH_IRQ,
+   .flags  = IORESOURCE_IRQ,
+   },
+   {
+   .start  = INT_35XX_EMAC_C0_RX_PULSE_IRQ,
+   .end= INT_35XX_EMAC_C0_RX_PULSE_IRQ,
+   .flags  = IORESOURCE_IRQ,
+   },
+   {
+   .start  = INT_35XX_EMAC_C0_TX_PULSE_IRQ,
+   .end= INT_35XX_EMAC_C0_TX_PULSE_IRQ,
+   .flags  = IORESOURCE_IRQ,
+   },
+   {
+   .start  = INT_35XX_EMAC_C0_MISC_PULSE_IRQ,
+   .end= INT_35XX_EMAC_C0_MISC_PULSE_IRQ,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct platform_device am3517_emac_device = {
+   .name   = "davinci_emac",
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(am3517_emac_resources),
+   .resource   = am3517_emac_resources,
+};
+
+static void am3517_enable_ethernet_int(void)
+{
+   u32 regval;
+
+   regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
+   regval = (regval | AM35XX_CPGMAC_C0_RX_PULSE_CLR |
+   AM35XX_CPGMAC_C0_TX_PULSE_CLR |
+   AM35XX_CPGMAC_C0_MISC_PULSE_CLR |
+   AM35XX_CPGMAC_C0_RX_THRESH_CLR);
+   omap_ctrl_writel(regval, AM35XX_CONTROL_LVL_INTR_CLEAR);
+   regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
+}
+
+static void am3517_disable_ethernet_int(void)
+{
+   u32 regval;
+
+   regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
+   regval = (regval | AM35XX_CPGMAC_C0_RX_PULSE_CLR |
+   AM35XX_CPGMAC_C0_TX_PULSE_CLR);
+   omap_ctrl_writel(regval, AM35XX_CONTROL_LVL_INTR_CLEAR);
+   regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
+}
+
+void am3517_evm_ethernet_init(struct emac_platform_data *pdata)
+{
+   unsigned int regval;
+
+   pdata->ctrl_reg_offset  = AM35XX_EMAC_CNTRL_OFFSET;
+   pdata->ctrl_mod_reg_offset  = AM35XX_EMAC_CNTRL_MOD_OFFSET;
+   pdata->ctrl_ram_offset  = AM35XX_EMAC_CNTRL_RAM_OFFSET;
+   pdata->mdio_reg_offset  = AM35XX_EMAC_MDIO_OFFSET;
+   pdata->ctrl_ram_size= AM35XX_EMAC_CNTRL_RAM_SIZE;
+   pdata->version  = EMAC_VERSION_2;
+   pdata->hw_ram_addr  = AM35XX_EMAC_HW_RAM_ADDR;
+   pdata->interrupt_enable = am3517_enable_ethernet_int;
+   pdata->interrupt_disable= am3517_disable_ethernet_int;
+   am3517_emac_device.dev.platform_data= pdata;
+   platform_device_register(&am3517_emac_device);
+
+   regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
+   regval = regval & (~(AM35XX_CPGMACSS_SW_RST));
+   omap_ctrl_writel(regval, AM35XX_CONTROL_IP_SW_RESET);
+   regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
+
+   return ;
+}
+
+
+
 #define LCD_PANEL_PWR  176
 #define LCD_PANEL_BKLIGHT_PWR  182
 #define LCD_PANEL_PWM  181
@@ -313,6 +409,8 @@ static void __init am3517_evm_init(void)
 
i2c_register_board_info(1, am3517evm_i2c_boardinfo,
ARRAY_SIZE(am3517evm_i2c_boardinfo));
+   /*Ethernet*/
+   am3517_evm_ethernet_init(&am3517_evm_emac_pdata);
 }
 
 static void __init am3517_evm_map_io(void)
-- 
1.6.2.4

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


[PATCH 1/4] AM35xx EMAC : define submodule offsets.

2010-03-11 Thread Sriramakrishnan
Define offsets for EMAC sub modules.

Signed-off-by: Sriramakrishnan 
---
 arch/arm/mach-omap2/include/mach/am35xx.h |   11 ++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/include/mach/am35xx.h 
b/arch/arm/mach-omap2/include/mach/am35xx.h
index a705f94..472867e 100644
--- a/arch/arm/mach-omap2/include/mach/am35xx.h
+++ b/arch/arm/mach-omap2/include/mach/am35xx.h
@@ -23,4 +23,13 @@
 #define AM35XX_IPSS_HECC_BASE  0x5C05
 #define AM35XX_IPSS_VPFE_BASE  0x5C06
 
-#endif /*  __ASM_ARCH_AM35XX_H */
+#define AM35XX_EMAC_CNTRL_OFFSET   (0x1)
+#define AM35XX_EMAC_CNTRL_MOD_OFFSET   (0x0)
+#define AM35XX_EMAC_CNTRL_RAM_OFFSET   (0x2)
+#define AM35XX_EMAC_MDIO_OFFSET(0x3)
+#define AM35XX_EMAC_CNTRL_RAM_SIZE (0x2000)
+#define AM35XX_EMAC_RAM_ADDR   (AM3517_EMAC_BASE + \
+   AM3517_EMAC_CNTRL_RAM_OFFSET)
+#define AM35XX_EMAC_HW_RAM_ADDR(0x01E2)
+
+#endif  /*  __ASM_ARCH_AM35XX_H */
-- 
1.6.2.4

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


[PATCH 3/4] OMAP3 : clock data: Update name string for EMAC clocks.

2010-03-11 Thread Sriramakrishnan
The emac driver uses generic name for the module and phy
clocks. Updated the omap3xxx_clks table to match the names
used by the Davinci emac driver.

Signed-off-by: Sriramakrishnan 
---
 arch/arm/mach-omap2/clock3xxx_data.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index d5153b6..989da2e 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3472,8 +3472,8 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "ipss_ick", &ipss_ick,  CK_AM35XX),
CLK(NULL,   "rmii_ck",  &rmii_ck,   CK_AM35XX),
CLK(NULL,   "pclk_ck",  &pclk_ck,   CK_AM35XX),
-   CLK("davinci_emac", "ick",  &emac_ick,  CK_AM35XX),
-   CLK("davinci_emac", "fck",  &emac_fck,  CK_AM35XX),
+   CLK("davinci_emac", "emac_clk", &emac_ick,  CK_AM35XX),
+   CLK("davinci_emac", "phy_clk",  &emac_fck,  CK_AM35XX),
CLK("vpfe-capture", "master",   &vpfe_ick,  CK_AM35XX),
CLK("vpfe-capture", "slave",&vpfe_fck,  CK_AM35XX),
CLK("musb_hdrc","ick",  &hsotgusb_ick_am35xx,   
CK_AM35XX),
-- 
1.6.2.4

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


[PATCH 0/4] AM35xx : Add support for EMAC Peripheral

2010-03-11 Thread Sriramakrishnan
This patch series adds support for EMAC peripheral on AM35xx
platform. The EMAC peripheral is borrowed from the DaVinci
platform and hence the same driver(davinci_emac) is used.

This patch series has been generated against tip of linux-omap and
depends on the following patches submitted to netdev/linux-davinci
list.

[1].http://patchwork.ozlabs.org/patch/47331/
[2].http://patchwork.ozlabs.org/patch/47332/

Sriramakrishnan (4):
  AM35xx EMAC : define submodule offsets.
  AM35xx : Platform specific hookup for EMAC module
  OMAP3 : clock data: Update name string for EMAC clocks.
  AM3517 defconfig update : enable EMAC support

 arch/arm/configs/am3517_evm_defconfig |   70 -
 arch/arm/mach-omap2/board-am3517evm.c |   98 +
 arch/arm/mach-omap2/clock3xxx_data.c  |4 +-
 arch/arm/mach-omap2/include/mach/am35xx.h |   11 +++-
 4 files changed, 179 insertions(+), 4 deletions(-)

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


[PATCH 2/2] davinci: introduce EMAC PHY clock usage

2010-03-11 Thread Sriramakrishnan
From: Sekhar Nori 

The patch "TI DaVinci EMAC: Add EMAC PHY clock handling" adds
support for enabling and disabling the EMAC PHY clock.

The PHY clock on all DaVinci boards is derived from a fixed
on board clock. This patch adds the PHY clock definition to
the clock tree for all the DaVinci boards using EMAC. Also,
the existing input to EMAC module is differentiated from the
PHY clock using the clock name "emac_clk".

Without this patch ethernet fails to initialize since it cannot
get the PHY clock and EMAC clock.

Tested on EVM boards for DM365, DM6467, DM644x, DA830 and DA850.

Signed-off-by: Sekhar Nori 
---
Though i have made changes for Neuros OSD2 and SFFSDR boards, i
do not have the hardware to test. Appreciate if folks having this
hardware ack the patch.

 arch/arm/mach-davinci/board-da830-evm.c   |   19 +++
 arch/arm/mach-davinci/board-da850-evm.c   |   21 +
 arch/arm/mach-davinci/board-dm365-evm.c   |   18 ++
 arch/arm/mach-davinci/board-dm644x-evm.c  |   18 ++
 arch/arm/mach-davinci/board-dm646x-evm.c  |   15 +++
 arch/arm/mach-davinci/board-neuros-osd2.c |   19 +++
 arch/arm/mach-davinci/board-sffsdr.c  |   19 +++
 arch/arm/mach-davinci/da830.c |2 +-
 arch/arm/mach-davinci/da850.c |2 +-
 arch/arm/mach-davinci/dm365.c |2 +-
 arch/arm/mach-davinci/dm644x.c|2 +-
 arch/arm/mach-davinci/dm646x.c|2 +-
 12 files changed, 134 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da830-evm.c 
b/arch/arm/mach-davinci/board-da830-evm.c
index dc19870..54e8567 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -20,9 +20,11 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -30,6 +32,8 @@
 #include 
 #include 
 
+#include "clock.h"
+
 #define DA830_EVM_PHY_MASK 0x0
 #define DA830_EVM_MDIO_FREQUENCY   220 /* PHY bus frequency */
 
@@ -557,9 +561,24 @@ static __init void da830_evm_irq_init(void)
soc_info->intc_irq_prios);
 }
 
+#define EMAC_PHY_CLK_RATE  5000
+
+static struct clk emac_phy = {
+   .name   = "emac_phy",
+   .rate   = EMAC_PHY_CLK_RATE,
+};
+
+static struct clk_lookup emac_phy_clks[] = {
+   CLK("davinci_emac.1", "phy_clk", &emac_phy),
+   CLK(NULL, NULL, NULL),
+};
+
 static void __init da830_evm_map_io(void)
 {
da830_init();
+
+   clkdev_add(emac_phy_clks);
+   clk_register(&emac_phy);
 }
 
 MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137 EVM")
diff --git a/arch/arm/mach-davinci/board-da850-evm.c 
b/arch/arm/mach-davinci/board-da850-evm.c
index 411284d..c43ae45 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -32,6 +33,9 @@
 #include 
 #include 
 #include 
+#include 
+
+#include "clock.h"
 
 #define DA850_EVM_PHY_MASK 0x1
 #define DA850_EVM_MDIO_FREQUENCY   220 /* PHY bus frequency */
@@ -551,6 +555,18 @@ static const short da850_evm_lcdc_pins[] = {
-1
 };
 
+#define EMAC_MII_PHY_CLK_RATE  2500
+#define EMAC_RMII_PHY_CLK_RATE 5000
+
+static struct clk emac_phy = {
+   .name   = "emac_phy",
+};
+
+static struct clk_lookup emac_phy_clks[] = {
+   CLK("davinci_emac.1", "phy_clk", &emac_phy),
+   CLK(NULL, NULL, NULL),
+};
+
 static int __init da850_evm_config_emac(void)
 {
void __iomem *cfg_chip3_base;
@@ -571,17 +587,22 @@ static int __init da850_evm_config_emac(void)
ret = da8xx_pinmux_setup(da850_rmii_pins);
pr_info("EMAC: RMII PHY configured, MII PHY will not be"
" functional\n");
+   emac_phy.rate = EMAC_RMII_PHY_CLK_RATE;
} else {
val &= ~BIT(8);
ret = da8xx_pinmux_setup(da850_cpgmac_pins);
pr_info("EMAC: MII PHY configured, RMII PHY will not be"
" functional\n");
+   emac_phy.rate = EMAC_MII_PHY_CLK_RATE;
}
 
if (ret)
pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n",
ret);
 
+   clkdev_add(emac_phy_clks);
+   clk_register(&emac_phy);
+
/* configure the CFGCHIP3 register for RMII or MII */
__raw_writel(val, cfg_chip3_base);
 
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c 
b/arch/arm/mach-davinci/board-dm365-evm.c
index d15bece..c36e034 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -38,9 +38,12 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
+#include "clock.h"
+
 static inline int have_imager(v

[PATCH 0/2] TI DaVinci EMAC: Add support for handling PHY Clock.

2010-03-11 Thread Sriramakrishnan
In addition to the EMAC module clock, the EMAC PHY clock needs to be 
managed separately. Until now, on most DaVinci platforms, the PHY clock
is always enabled. On AM35x platform where the same EMAC module is
used, the PHY clock needs to be managed explicitly. This patch 
series add support for handling PHY clock in the EMAC driver. Clock
definitions for platforms using the EMAC module have be modified
accordingly.

This patch series is generated against tip of Linus tree and depends
on the following patches submitted earlier

[1].http://patchwork.ozlabs.org/patch/47156/
[2].http://patchwork.ozlabs.org/patch/47303/

Sekhar Nori (1):
  davinci: introduce EMAC PHY clock usage

Sriramakrishnan (1):
  TI DaVinci EMAC: Add EMAC PHY clock handling.

 arch/arm/mach-davinci/board-da830-evm.c   |   19 +++
 arch/arm/mach-davinci/board-da850-evm.c   |   21 +
 arch/arm/mach-davinci/board-dm365-evm.c   |   18 ++
 arch/arm/mach-davinci/board-dm644x-evm.c  |   18 ++
 arch/arm/mach-davinci/board-dm646x-evm.c  |   15 +++
 arch/arm/mach-davinci/board-neuros-osd2.c |   19 +++
 arch/arm/mach-davinci/board-sffsdr.c  |   19 +++
 arch/arm/mach-davinci/da830.c |2 +-
 arch/arm/mach-davinci/da850.c |2 +-
 arch/arm/mach-davinci/dm365.c |2 +-
 arch/arm/mach-davinci/dm644x.c|2 +-
 arch/arm/mach-davinci/dm646x.c|2 +-
 drivers/net/davinci_emac.c|   22 --
 13 files changed, 154 insertions(+), 7 deletions(-)

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


[PATCH 1/2] TI DaVinci EMAC: Add EMAC PHY clock handling.

2010-03-11 Thread Sriramakrishnan
Source for the EMAC PHY clock can be different from the
module clock and driver needs to request/enable the EMAC
phy clock explicitly. This was not required earlier as on
most Davinci platforms the phy clock is always on . On AM35x
platform the phy clock needs to be managed explicitly , hence
adding clock management for phy clock.

Signed-off-by: Sriramakrishnan 
---
 drivers/net/davinci_emac.c |   22 --
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 8a42dbe..d9ae6ee 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -491,6 +491,7 @@ struct emac_priv {
 
 /* clock frequency for EMAC */
 static struct clk *emac_clk;
+static struct clk *emac_phy_clk;
 static unsigned long emac_bus_frequency;
 static unsigned long mdio_max_freq;
 
@@ -2637,18 +2638,28 @@ static int __devinit davinci_emac_probe(struct 
platform_device *pdev)
struct emac_platform_data *pdata;
struct device *emac_dev;
 
-   /* obtain emac clock from kernel */
-   emac_clk = clk_get(&pdev->dev, NULL);
+   /* obtain emac module clock from kernel */
+   emac_clk = clk_get(&pdev->dev, "emac_clk");
if (IS_ERR(emac_clk)) {
printk(KERN_ERR "DaVinci EMAC: Failed to get EMAC clock\n");
return -EBUSY;
}
+
+   /* obtain emac phy clock from kernel */
+   emac_phy_clk = clk_get(&pdev->dev, "phy_clk");
+   if (IS_ERR(emac_phy_clk)) {
+   printk(KERN_ERR "DaVinci EMAC: Failed to get PHY clock\n");
+   clk_put(emac_clk);
+   return -EBUSY;
+   }
+
emac_bus_frequency = clk_get_rate(emac_clk);
/* TODO: Probe PHY here if possible */
 
ndev = alloc_etherdev(sizeof(struct emac_priv));
if (!ndev) {
printk(KERN_ERR "DaVinci EMAC: Error allocating net_device\n");
+   clk_put(emac_phy_clk);
clk_put(emac_clk);
return -ENOMEM;
}
@@ -2734,6 +2745,7 @@ static int __devinit davinci_emac_probe(struct 
platform_device *pdev)
netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT);
 
clk_enable(emac_clk);
+   clk_enable(emac_phy_clk);
 
/* register the network device */
SET_NETDEV_DEV(ndev, &pdev->dev);
@@ -2783,6 +2795,7 @@ mdiobus_quit:
 
 netdev_reg_err:
 mdio_alloc_err:
+   clk_disable(emac_phy_clk);
clk_disable(emac_clk);
 no_irq_res:
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -2790,6 +2803,7 @@ no_irq_res:
iounmap(priv->remap_addr);
 
 probe_quit:
+   clk_put(emac_phy_clk);
clk_put(emac_clk);
free_netdev(ndev);
return rc;
@@ -2821,7 +2835,9 @@ static int __devexit davinci_emac_remove(struct 
platform_device *pdev)
free_netdev(ndev);
iounmap(priv->remap_addr);
 
+   clk_disable(emac_phy_clk);
clk_disable(emac_clk);
+   clk_put(emac_phy_clk);
clk_put(emac_clk);
 
return 0;
@@ -2835,6 +2851,7 @@ static int davinci_emac_suspend(struct device *dev)
if (netif_running(ndev))
emac_dev_stop(ndev);
 
+   clk_disable(emac_phy_clk);
clk_disable(emac_clk);
 
return 0;
@@ -2846,6 +2863,7 @@ static int davinci_emac_resume(struct device *dev)
struct net_device *ndev = platform_get_drvdata(pdev);
 
clk_enable(emac_clk);
+   clk_enable(emac_phy_clk);
 
if (netif_running(ndev))
emac_dev_open(ndev);
-- 
1.6.2.4

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


[PATCH] TI DaVinci EMAC: Convert to dev_pm_ops

2010-03-11 Thread Chaithrika U S
Migrate from the legacy PM hooks to use dev_pm_ops structure.

Signed-off-by: Chaithrika U S 
---

This patch applies to Linus' kernel tree.
The fixes provided in this patch[1] are needed for EMAC driver to build.
[1]http://patchwork.kernel.org/patch/84267/

 drivers/net/davinci_emac.c |   27 ---
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 2526a9b..eb67fa6 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2829,31 +2829,37 @@ static int __devexit davinci_emac_remove(struct 
platform_device *pdev)
return 0;
 }
 
-static
-int davinci_emac_suspend(struct platform_device *pdev, pm_message_t state)
+static int davinci_emac_suspend(struct device *dev)
 {
-   struct net_device *dev = platform_get_drvdata(pdev);
+   struct platform_device *pdev = to_platform_device(dev);
+   struct net_device *ndev = platform_get_drvdata(pdev);
 
-   if (netif_running(dev))
-   emac_dev_stop(dev);
+   if (netif_running(ndev))
+   emac_dev_stop(ndev);
 
clk_disable(emac_clk);
 
return 0;
 }
 
-static int davinci_emac_resume(struct platform_device *pdev)
+static int davinci_emac_resume(struct device *dev)
 {
-   struct net_device *dev = platform_get_drvdata(pdev);
+   struct platform_device *pdev = to_platform_device(dev);
+   struct net_device *ndev = platform_get_drvdata(pdev);
 
clk_enable(emac_clk);
 
-   if (netif_running(dev))
-   emac_dev_open(dev);
+   if (netif_running(ndev))
+   emac_dev_open(ndev);
 
return 0;
 }
 
+static const struct dev_pm_ops davinci_emac_pm_ops = {
+   .suspend= davinci_emac_suspend,
+   .resume = davinci_emac_resume,
+};
+
 /**
  * davinci_emac_driver: EMAC platform driver structure
  */
@@ -2861,11 +2867,10 @@ static struct platform_driver davinci_emac_driver = {
.driver = {
.name= "davinci_emac",
.owner   = THIS_MODULE,
+   .pm  = &davinci_emac_pm_ops,
},
.probe = davinci_emac_probe,
.remove = __devexit_p(davinci_emac_remove),
-   .suspend = davinci_emac_suspend,
-   .resume = davinci_emac_resume,
 };
 
 /**
-- 
1.5.6

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


[PATCH] davinci: MMC: Pass number of SG segments as platform data

2010-03-11 Thread Sudhakar Rajashekhara
On some platforms like DM355, the number of EDMA parameter
slots available for EDMA_SLOT_ANY usage are few. In such cases,
if MMC/SD uses 16 slots for each instance of MMC controller,
then the number of slots available for other modules will be
very few.

By passing the number of EDMA slots to be used in MMC driver
from platform data, EDMA slots available for other purposes
can be controlled.

Signed-off-by: Sudhakar Rajashekhara 
---
 arch/arm/mach-davinci/include/mach/mmc.h |3 +++
 drivers/mmc/host/davinci_mmc.c   |   22 +++---
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/mmc.h 
b/arch/arm/mach-davinci/include/mach/mmc.h
index 5a85e24..384fc0e 100644
--- a/arch/arm/mach-davinci/include/mach/mmc.h
+++ b/arch/arm/mach-davinci/include/mach/mmc.h
@@ -22,6 +22,9 @@ struct davinci_mmc_config {
 
/* Version of the MMC/SD controller */
u8  version;
+
+   /* Number of sg segments */
+   u32 nr_sg;
 };
 void davinci_setup_mmc(int module, struct davinci_mmc_config *config);
 
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 3bd0ba2..19c050c 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -137,15 +137,15 @@
 
 /*
  * One scatterlist dma "segment" is at most MAX_CCNT rw_threshold units,
- * and we handle up to NR_SG segments.  MMC_BLOCK_BOUNCE kicks in only
+ * and we handle up to MAX_NR_SG segments.  MMC_BLOCK_BOUNCE kicks in only
  * for drivers with max_hw_segs == 1, making the segments bigger (64KB)
- * than the page or two that's otherwise typical.  NR_SG == 16 gives at
- * least the same throughput boost, using EDMA transfer linkage instead
- * of spending CPU time copying pages.
+ * than the page or two that's otherwise typical. nr_sg (passed from
+ * platform data) == 16 gives at least the same throughput boost, using
+ * EDMA transfer linkage instead of spending CPU time copying pages.
  */
 #define MAX_CCNT   ((1 << 16) - 1)
 
-#define NR_SG  16
+#define MAX_NR_SG  16
 
 static unsigned rw_threshold = 32;
 module_param(rw_threshold, uint, S_IRUGO);
@@ -192,7 +192,7 @@ struct mmc_davinci_host {
struct edmacc_param tx_template;
struct edmacc_param rx_template;
unsignedn_link;
-   u32 links[NR_SG - 1];
+   u32 links[MAX_NR_SG - 1];
 
/* For PIO we walk scatterlists one segment at a time. */
unsigned intsg_len;
@@ -202,6 +202,8 @@ struct mmc_davinci_host {
u8 version;
/* for ns in one cycle calculation */
unsigned ns_in_one_cycle;
+   /* Number of sg segments */
+   u32 nr_sg;
 #ifdef CONFIG_CPU_FREQ
struct notifier_block   freq_transition;
 #endif
@@ -568,6 +570,7 @@ davinci_release_dma_channels(struct mmc_davinci_host *host)
 
 static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host)
 {
+   u32 link_size;
int r, i;
 
/* Acquire master DMA write channel */
@@ -593,7 +596,8 @@ static int __init davinci_acquire_dma_channels(struct 
mmc_davinci_host *host)
/* Allocate parameter RAM slots, which will later be bound to a
 * channel as needed to handle a scatterlist.
 */
-   for (i = 0; i < ARRAY_SIZE(host->links); i++) {
+   link_size = min_t(unsigned, host->nr_sg, ARRAY_SIZE(host->links));
+   for (i = 0; i < link_size; i++) {
r = edma_alloc_slot(EDMA_CTLR(host->txdma), EDMA_SLOT_ANY);
if (r < 0) {
dev_dbg(mmc_dev(host->mmc), "dma PaRAM alloc --> %d\n",
@@ -1202,6 +1206,10 @@ static int __init davinci_mmcsd_probe(struct 
platform_device *pdev)
 
init_mmcsd_host(host);
 
+   host->nr_sg = pdata->nr_sg - 1;
+   if (host->nr_sg > MAX_NR_SG || host->nr_sg == 0)
+   host->nr_sg = MAX_NR_SG;
+
host->use_dma = use_dma;
host->irq = irq;
 
-- 
1.5.6

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