Re: [PATCH v3 09/13] net: Rework ucc_geth driver to use of_mdio infrastructure

2009-04-26 Thread Joakim Tjernlund
Change in fixed link case, see inline.

 
 From: Grant Likely grant.lik...@secretlab.ca
 
 This patch simplifies the driver by making use of more common code.
 
 Signed-off-by: Grant Likely grant.lik...@secretlab.ca
 Acked-by: Andy Fleming aflem...@freescale.com
 ---
 
  drivers/net/ucc_geth.c |   47 
---
  drivers/net/ucc_geth.h |2 +-
  2 files changed, 13 insertions(+), 36 deletions(-)
 
 
 diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
 index d3f39e8..195b490 100644
 --- a/drivers/net/ucc_geth.c
 +++ b/drivers/net/ucc_geth.c
 @@ -27,6 +27,7 @@
  #include linux/mii.h
  #include linux/phy.h
  #include linux/workqueue.h
 +#include linux/of_mdio.h
  #include linux/of_platform.h
 
  #include asm/uaccess.h
 @@ -1542,12 +1543,14 @@ static int init_phy(struct net_device *dev)
 priv-oldspeed = 0;
 priv-oldduplex = -1;
 
 -   phydev = phy_connect(dev, ug_info-phy_bus_id, adjust_link, 0,
 -  priv-phy_interface);
 +   if (!ug_info-phy_node)
 +  return 0;
 
 -   if (IS_ERR(phydev)) {
 +   phydev = of_phy_connect(dev, ug_info-phy_node, adjust_link, 0,
 +priv-phy_interface);
 +   if (!phydev) {
printk(%s: Could not attach to PHY\n, dev-name);
 -  return PTR_ERR(phydev);
 +  return -ENODEV;
 }
 
 phydev-supported = (ADVERTISED_10baseT_Half |
 @@ -3519,14 +3522,12 @@ static int ucc_geth_probe(struct of_device* 
ofdev, const struct of_device_id *ma
  {
 struct device *device = ofdev-dev;
 struct device_node *np = ofdev-node;
 -   struct device_node *mdio;
 struct net_device *dev = NULL;
 struct ucc_geth_private *ugeth = NULL;
 struct ucc_geth_info *ug_info;
 struct resource res;
 struct device_node *phy;
 int err, ucc_num, max_speed = 0;
 -   const phandle *ph;
 const u32 *fixed_link;
 const unsigned int *prop;
 const char *sprop;
 @@ -3626,45 +3627,21 @@ static int ucc_geth_probe(struct of_device* 
ofdev, const struct of_device_id *ma
 ug_info-uf_info.irq = irq_of_parse_and_map(np, 0);
 fixed_link = of_get_property(np, fixed-link, NULL);
 if (fixed_link) {
 -  snprintf(ug_info-phy_bus_id, sizeof(ug_info-phy_bus_id),
 -  PHY_ID_FMT, 0, fixed_link[0]);
phy = NULL;

phy assigned to NULL ...

 } else {
 -  char bus_name[MII_BUS_ID_SIZE];
 -
 -  ph = of_get_property(np, phy-handle, NULL);
 -  phy = of_find_node_by_phandle(*ph);
 -
 +  phy = of_parse_phandle(np, phy-handle, 0);
if (phy == NULL)
   return -ENODEV;
 -
 -  /* set the PHY address */
 -  prop = of_get_property(phy, reg, NULL);
 -  if (prop == NULL)
 - return -1;
 -
 -  /* Set the bus id */
 -  mdio = of_get_parent(phy);
 -
 -  if (mdio == NULL)
 - return -ENODEV;
 -
 -  err = of_address_to_resource(mdio, 0, res);
 -
 -  if (err) {
 - of_node_put(mdio);
 - return err;
 -  }
 -  fsl_pq_mdio_bus_name(bus_name, mdio);
 -  of_node_put(mdio);
 -  snprintf(ug_info-phy_bus_id, sizeof(ug_info-phy_bus_id),
 - %s:%02x, bus_name, *prop);
 }
 +   ug_info-phy_node = phy;
 
 /* get the phy interface type, or default to MII */
 prop = of_get_property(np, phy-connection-type, NULL);
 if (!prop) {
/* handle interface property present in old trees */
 +  if (!phy)
 + return -ENODEV;

.. here an error is returned. Is this intentional?

 +
prop = of_get_property(phy, interface, NULL);
if (prop != NULL) {
   phy_interface = enet_to_phy_interface[*prop];
 diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
 index 2f8ee7c..bc31975 100644
 --- a/drivers/net/ucc_geth.h
 +++ b/drivers/net/ucc_geth.h
 @@ -1100,7 +1100,7 @@ struct ucc_geth_info {
 u32 eventRegMask;
 u16 pausePeriod;
 u16 extensionField;
 -   char phy_bus_id[BUS_ID_SIZE];
 +   struct device_node *phy_node;
 u8 weightfactor[NUM_TX_QUEUES];
 u8 interruptcoalescingmaxvalue[NUM_RX_QUEUES];
 u8 l2qt[UCC_GETH_VLAN_PRIORITY_MAX];
 
 ___
 Linuxppc-dev mailing list
 Linuxppc-dev@ozlabs.org
 https://ozlabs.org/mailman/listinfo/linuxppc-dev
 
 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[2.6.30-rc3] powerpc: compilation error of mace module

2009-04-26 Thread Rogério Brito
Hi there, people.

I am attempting to compile a new kernel for my OldWorld ppc box and I'm
having some problems. The first one that appears to happen is the following:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  CC [M]  drivers/net/mace.o
drivers/net/mace.c: In function ‘mace_probe’:
drivers/net/mace.c:210: error: ‘struct net_device’ has no member named ‘open’
drivers/net/mace.c:211: error: ‘struct net_device’ has no member named ‘stop’
drivers/net/mace.c:212: error: ‘struct net_device’ has no member named 
‘hard_start_xmit’
drivers/net/mace.c:213: error: ‘struct net_device’ has no member named 
‘set_multicast_list’
drivers/net/mace.c:214: error: ‘struct net_device’ has no member named 
‘set_mac_address’
make[3]: *** [drivers/net/mace.o] Error 1
make[2]: *** [drivers/net] Error 2
make[1]: *** [drivers] Error 2
make[1]: Leaving directory `/usr/local/media/cross-compile/linux'
make: *** [debian/stamp/build/kernel] Error 2
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Any help is appreciated.


Thanks, Rogério Brito.

-- 
Rogério Brito : rbr...@{mackenzie,ime.usp}.br : GPG key 1024D/7C2CAEB8
http://www.ime.usp.br/~rbrito : http://meusite.mackenzie.com.br/rbrito
Projects: algorithms.berlios.de : lame.sf.net : vrms.alioth.debian.org
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[PATCH V1 0/3] Split the DMA core out from mpc5200_psc_i2s.c

2009-04-26 Thread Jon Smirl
Patch series to separate out the mpc5200 core DMA routines from
mpc5200_psc_i2s.c into a standalone mpc5200_dma.c. No intention
to change how anything works, this is just a code reorg needed for
later patches to build on.

---

Jon Smirl (3):
  Rename exports in mpc5200_dma.c
  Rename the PSC functions to DMA
  Basic split of mpc5200 DMA code out from mpc5200_psc_i2s


 sound/soc/fsl/Kconfig   |4
 sound/soc/fsl/Makefile  |2
 sound/soc/fsl/mpc5200_dma.c |  463 
 sound/soc/fsl/mpc5200_dma.h |   81 +
 sound/soc/fsl/mpc5200_psc_i2s.c |  644 +--
 5 files changed, 632 insertions(+), 562 deletions(-)
 create mode 100644 sound/soc/fsl/mpc5200_dma.c
 create mode 100644 sound/soc/fsl/mpc5200_dma.h

--
Jon Smirl
jonsm...@gmail.com

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH V1 1/3] Basic split of mpc5200 DMA code out from mpc5200_psc_i2s

2009-04-26 Thread Jon Smirl
Basic split of mpc5200 DMA code out from i2s into a standalone file.

Signed-off-by: Jon Smirl jonsm...@gmail.com
---
 sound/soc/fsl/Kconfig   |4 
 sound/soc/fsl/Makefile  |2 
 sound/soc/fsl/mpc5200_dma.c |  457 +
 sound/soc/fsl/mpc5200_dma.h |   81 +++
 sound/soc/fsl/mpc5200_psc_i2s.c |  484 ---
 5 files changed, 546 insertions(+), 482 deletions(-)
 create mode 100644 sound/soc/fsl/mpc5200_dma.c
 create mode 100644 sound/soc/fsl/mpc5200_dma.h

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 9fc9082..dc79bdf 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -1,5 +1,8 @@
 config SND_SOC_OF_SIMPLE
tristate
+   
+config SND_MPC52xx_DMA
+   tristate
 
 # ASoC platform support for the Freescale MPC8610 SOC.  This compiles drivers
 # for the SSI and the Elo DMA controller.  You will still need to select
@@ -23,6 +26,7 @@ config SND_SOC_MPC5200_I2S
tristate Freescale MPC5200 PSC in I2S mode driver
depends on PPC_MPC52xx  PPC_BESTCOMM
select SND_SOC_OF_SIMPLE
+   select SND_MPC52xx_DMA
select PPC_BESTCOMM_GEN_BD
help
  Say Y here to support the MPC5200 PSCs in I2S mode.
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index f85134c..7731ef2 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -10,5 +10,7 @@ snd-soc-fsl-ssi-objs := fsl_ssi.o
 snd-soc-fsl-dma-objs := fsl_dma.o
 obj-$(CONFIG_SND_SOC_MPC8610) += snd-soc-fsl-ssi.o snd-soc-fsl-dma.o
 
+# MPC5200 Platform Support
+obj-$(CONFIG_SND_MPC52xx_DMA) += mpc5200_dma.o
 obj-$(CONFIG_SND_SOC_MPC5200_I2S) += mpc5200_psc_i2s.o
 
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
new file mode 100644
index 000..cccaff4
--- /dev/null
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -0,0 +1,457 @@
+/*
+ * Freescale MPC5200 PSC DMA
+ * ALSA SoC Platform driver
+ *
+ * Copyright (C) 2008 Secret Lab Technologies Ltd.
+ */
+
+#include linux/init.h
+#include linux/module.h
+#include linux/interrupt.h
+#include linux/device.h
+#include linux/delay.h
+#include linux/of_device.h
+#include linux/of_platform.h
+#include linux/dma-mapping.h
+
+#include sound/core.h
+#include sound/pcm.h
+#include sound/pcm_params.h
+#include sound/initval.h
+#include sound/soc.h
+#include sound/soc-of-simple.h
+
+#include sysdev/bestcomm/bestcomm.h
+#include sysdev/bestcomm/gen_bd.h
+#include asm/mpc52xx_psc.h
+
+#include mpc5200_dma.h
+
+MODULE_AUTHOR(Grant Likely grant.lik...@secretlab.ca);
+MODULE_DESCRIPTION(Freescale MPC5200 PSC in DMA mode ASoC Driver);
+MODULE_LICENSE(GPL);
+
+/*
+ * Interrupt handlers
+ */
+static irqreturn_t psc_i2s_status_irq(int irq, void *_psc_i2s)
+{
+   struct psc_i2s *psc_i2s = _psc_i2s;
+   struct mpc52xx_psc __iomem *regs = psc_i2s-psc_regs;
+   u16 isr;
+
+   isr = in_be16(regs-mpc52xx_psc_isr);
+
+   /* Playback underrun error */
+   if (psc_i2s-playback.active  (isr  MPC52xx_PSC_IMR_TXEMP))
+   psc_i2s-stats.underrun_count++;
+
+   /* Capture overrun error */
+   if (psc_i2s-capture.active  (isr  MPC52xx_PSC_IMR_ORERR))
+   psc_i2s-stats.overrun_count++;
+
+   out_8(regs-command, 4  4);  /* reset the error status */
+
+   return IRQ_HANDLED;
+}
+
+/**
+ * psc_i2s_bcom_enqueue_next_buffer - Enqueue another audio buffer
+ * @s: pointer to stream private data structure
+ *
+ * Enqueues another audio period buffer into the bestcomm queue.
+ *
+ * Note: The routine must only be called when there is space available in
+ * the queue.  Otherwise the enqueue will fail and the audio ring buffer
+ * will get out of sync
+ */
+static void psc_i2s_bcom_enqueue_next_buffer(struct psc_i2s_stream *s)
+{
+   struct bcom_bd *bd;
+
+   /* Prepare and enqueue the next buffer descriptor */
+   bd = bcom_prepare_next_buffer(s-bcom_task);
+   bd-status = s-period_bytes;
+   bd-data[0] = s-period_next_pt;
+   bcom_submit_next_buffer(s-bcom_task, NULL);
+
+   /* Update for next period */
+   s-period_next_pt += s-period_bytes;
+   if (s-period_next_pt = s-period_end)
+   s-period_next_pt = s-period_start;
+}
+
+/* Bestcomm DMA irq handler */
+static irqreturn_t psc_i2s_bcom_irq(int irq, void *_psc_i2s_stream)
+{
+   struct psc_i2s_stream *s = _psc_i2s_stream;
+
+   /* For each finished period, dequeue the completed period buffer
+* and enqueue a new one in it's place. */
+   while (bcom_buffer_done(s-bcom_task)) {
+   bcom_retrieve_buffer(s-bcom_task, NULL, NULL);
+   s-period_current_pt += s-period_bytes;
+   if (s-period_current_pt = s-period_end)
+   s-period_current_pt = s-period_start;
+   psc_i2s_bcom_enqueue_next_buffer(s);
+   bcom_enable(s-bcom_task);
+   }
+
+   /* If the stream is active, then also inform the PCM 

[PATCH V1 3/3] Rename exports in mpc5200_dma.c

2009-04-26 Thread Jon Smirl
Rename the public DMA exports into the global name space so that the DMA code 
can be built as a module.

Signed-off-by: Jon Smirl jonsm...@gmail.com
---
 sound/soc/fsl/mpc5200_dma.c |   18 --
 sound/soc/fsl/mpc5200_dma.h |   10 +-
 sound/soc/fsl/mpc5200_psc_i2s.c |   14 +++---
 3 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index c82ef75..df73755 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -113,7 +113,7 @@ static irqreturn_t psc_dma_bcom_irq(int irq, void 
*_psc_dma_stream)
  * If this is the first stream open, then grab the IRQ and program most of
  * the PSC registers.
  */
-int psc_dma_startup(struct snd_pcm_substream *substream,
+int mpc5200_dma_startup(struct snd_pcm_substream *substream,
   struct snd_soc_dai *dai)
 {
struct snd_soc_pcm_runtime *rtd = substream-private_data;
@@ -145,13 +145,16 @@ int psc_dma_startup(struct snd_pcm_substream *substream,
 
return 0;
 }
+EXPORT_SYMBOL_GPL(mpc5200_dma_startup);
 
-int psc_dma_hw_free(struct snd_pcm_substream *substream,
+int mpc5200_dma_hw_free(struct snd_pcm_substream *substream,
   struct snd_soc_dai *dai)
 {
snd_pcm_set_runtime_buffer(substream, NULL);
return 0;
 }
+EXPORT_SYMBOL_GPL(mpc5200_dma_hw_free);
+
 
 /**
  * psc_dma_trigger: start and stop the DMA transfer.
@@ -159,7 +162,7 @@ int psc_dma_hw_free(struct snd_pcm_substream *substream,
  * This function is called by ALSA to start, stop, pause, and resume the DMA
  * transfer of data.
  */
-int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd,
+int mpc5200_dma_trigger(struct snd_pcm_substream *substream, int cmd,
   struct snd_soc_dai *dai)
 {
struct snd_soc_pcm_runtime *rtd = substream-private_data;
@@ -269,13 +272,15 @@ int psc_dma_trigger(struct snd_pcm_substream *substream, 
int cmd,
 
return 0;
 }
+EXPORT_SYMBOL_GPL(mpc5200_dma_trigger);
+
 
 /**
  * psc_dma_shutdown: shutdown the data transfer on a stream
  *
  * Shutdown the PSC if there are no other substreams open.
  */
-void psc_dma_shutdown(struct snd_pcm_substream *substream,
+void mpc5200_dma_shutdown(struct snd_pcm_substream *substream,
 struct snd_soc_dai *dai)
 {
struct snd_soc_pcm_runtime *rtd = substream-private_data;
@@ -303,6 +308,7 @@ void psc_dma_shutdown(struct snd_pcm_substream *substream,
free_irq(psc_dma-playback.irq, psc_dma-playback);
}
 }
+EXPORT_SYMBOL_GPL(mpc5200_dma_shutdown);
 
 /* -
  * The PSC DMA 'ASoC platform' driver
@@ -448,10 +454,10 @@ static void psc_dma_pcm_free(struct snd_pcm *pcm)
}
 }
 
-struct snd_soc_platform psc_dma_pcm_soc_platform = {
+struct snd_soc_platform mpc5200_dma_platform = {
.name   = mpc5200-psc-audio,
.pcm_ops= psc_dma_pcm_ops,
.pcm_new= psc_dma_pcm_new,
.pcm_free   = psc_dma_pcm_free,
 };
-
+EXPORT_SYMBOL_GPL(mpc5200_dma_platform);
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
index a33232c..e52b90e 100644
--- a/sound/soc/fsl/mpc5200_dma.h
+++ b/sound/soc/fsl/mpc5200_dma.h
@@ -64,18 +64,18 @@ struct psc_dma {
 };
 
 
-int psc_dma_startup(struct snd_pcm_substream *substream,
+int mpc5200_dma_startup(struct snd_pcm_substream *substream,
   struct snd_soc_dai *dai);
 
-int psc_dma_hw_free(struct snd_pcm_substream *substream,
+int mpc5200_dma_hw_free(struct snd_pcm_substream *substream,
   struct snd_soc_dai *dai);
 
-void psc_dma_shutdown(struct snd_pcm_substream *substream,
+void mpc5200_dma_shutdown(struct snd_pcm_substream *substream,
 struct snd_soc_dai *dai);
 
-int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd,
+int mpc5200_dma_trigger(struct snd_pcm_substream *substream, int cmd,
   struct snd_soc_dai *dai);
 
-extern struct snd_soc_platform psc_dma_pcm_soc_platform;
+extern struct snd_soc_platform mpc5200_dma_platform;
 
 #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index 12a7917..a4a439c 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -140,11 +140,11 @@ static int psc_i2s_set_fmt(struct snd_soc_dai *cpu_dai, 
unsigned int format)
  * psc_i2s_dai_template: template CPU Digital Audio Interface
  */
 static struct snd_soc_dai_ops psc_i2s_dai_ops = {
-   .startup= psc_dma_startup,
+   .startup= mpc5200_dma_startup,
.hw_params  = psc_i2s_hw_params,
-   .hw_free= psc_dma_hw_free,
-   .shutdown   = psc_dma_shutdown,
-   .trigger= psc_dma_trigger,
+   .hw_free= mpc5200_dma_hw_free,
+  

[PATCH V1 2/3] Rename the PSC functions to DMA

2009-04-26 Thread Jon Smirl
Rename the functions in the mpc5200 DMA file from i2s to dma to reflect the 
file they are in.

Signed-off-by: Jon Smirl jonsm...@gmail.com
---
 sound/soc/fsl/mpc5200_dma.c |  194 ---
 sound/soc/fsl/mpc5200_dma.h |   26 +++--
 sound/soc/fsl/mpc5200_psc_i2s.c |  160 
 3 files changed, 190 insertions(+), 190 deletions(-)

diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index cccaff4..c82ef75 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -34,21 +34,21 @@ MODULE_LICENSE(GPL);
 /*
  * Interrupt handlers
  */
-static irqreturn_t psc_i2s_status_irq(int irq, void *_psc_i2s)
+static irqreturn_t psc_dma_status_irq(int irq, void *_psc_dma)
 {
-   struct psc_i2s *psc_i2s = _psc_i2s;
-   struct mpc52xx_psc __iomem *regs = psc_i2s-psc_regs;
+   struct psc_dma *psc_dma = _psc_dma;
+   struct mpc52xx_psc __iomem *regs = psc_dma-psc_regs;
u16 isr;
 
isr = in_be16(regs-mpc52xx_psc_isr);
 
/* Playback underrun error */
-   if (psc_i2s-playback.active  (isr  MPC52xx_PSC_IMR_TXEMP))
-   psc_i2s-stats.underrun_count++;
+   if (psc_dma-playback.active  (isr  MPC52xx_PSC_IMR_TXEMP))
+   psc_dma-stats.underrun_count++;
 
/* Capture overrun error */
-   if (psc_i2s-capture.active  (isr  MPC52xx_PSC_IMR_ORERR))
-   psc_i2s-stats.overrun_count++;
+   if (psc_dma-capture.active  (isr  MPC52xx_PSC_IMR_ORERR))
+   psc_dma-stats.overrun_count++;
 
out_8(regs-command, 4  4);  /* reset the error status */
 
@@ -56,7 +56,7 @@ static irqreturn_t psc_i2s_status_irq(int irq, void *_psc_i2s)
 }
 
 /**
- * psc_i2s_bcom_enqueue_next_buffer - Enqueue another audio buffer
+ * psc_dma_bcom_enqueue_next_buffer - Enqueue another audio buffer
  * @s: pointer to stream private data structure
  *
  * Enqueues another audio period buffer into the bestcomm queue.
@@ -65,7 +65,7 @@ static irqreturn_t psc_i2s_status_irq(int irq, void *_psc_i2s)
  * the queue.  Otherwise the enqueue will fail and the audio ring buffer
  * will get out of sync
  */
-static void psc_i2s_bcom_enqueue_next_buffer(struct psc_i2s_stream *s)
+static void psc_dma_bcom_enqueue_next_buffer(struct psc_dma_stream *s)
 {
struct bcom_bd *bd;
 
@@ -82,9 +82,9 @@ static void psc_i2s_bcom_enqueue_next_buffer(struct 
psc_i2s_stream *s)
 }
 
 /* Bestcomm DMA irq handler */
-static irqreturn_t psc_i2s_bcom_irq(int irq, void *_psc_i2s_stream)
+static irqreturn_t psc_dma_bcom_irq(int irq, void *_psc_dma_stream)
 {
-   struct psc_i2s_stream *s = _psc_i2s_stream;
+   struct psc_dma_stream *s = _psc_dma_stream;
 
/* For each finished period, dequeue the completed period buffer
 * and enqueue a new one in it's place. */
@@ -93,7 +93,7 @@ static irqreturn_t psc_i2s_bcom_irq(int irq, void 
*_psc_i2s_stream)
s-period_current_pt += s-period_bytes;
if (s-period_current_pt = s-period_end)
s-period_current_pt = s-period_start;
-   psc_i2s_bcom_enqueue_next_buffer(s);
+   psc_dma_bcom_enqueue_next_buffer(s);
bcom_enable(s-bcom_task);
}
 
@@ -106,39 +106,39 @@ static irqreturn_t psc_i2s_bcom_irq(int irq, void 
*_psc_i2s_stream)
 }
 
 /**
- * psc_i2s_startup: create a new substream
+ * psc_dma_startup: create a new substream
  *
  * This is the first function called when a stream is opened.
  *
  * If this is the first stream open, then grab the IRQ and program most of
  * the PSC registers.
  */
-int psc_i2s_startup(struct snd_pcm_substream *substream,
+int psc_dma_startup(struct snd_pcm_substream *substream,
   struct snd_soc_dai *dai)
 {
struct snd_soc_pcm_runtime *rtd = substream-private_data;
-   struct psc_i2s *psc_i2s = rtd-dai-cpu_dai-private_data;
+   struct psc_dma *psc_dma = rtd-dai-cpu_dai-private_data;
int rc;
 
-   dev_dbg(psc_i2s-dev, psc_i2s_startup(substream=%p)\n, substream);
+   dev_dbg(psc_dma-dev, psc_dma_startup(substream=%p)\n, substream);
 
-   if (!psc_i2s-playback.active 
-   !psc_i2s-capture.active) {
+   if (!psc_dma-playback.active 
+   !psc_dma-capture.active) {
/* Setup the IRQs */
-   rc = request_irq(psc_i2s-irq, psc_i2s_status_irq, IRQF_SHARED,
-psc-i2s-status, psc_i2s);
-   rc |= request_irq(psc_i2s-capture.irq,
- psc_i2s_bcom_irq, IRQF_SHARED,
- psc-i2s-capture, psc_i2s-capture);
-   rc |= request_irq(psc_i2s-playback.irq,
- psc_i2s_bcom_irq, IRQF_SHARED,
- psc-i2s-playback, psc_i2s-playback);
+   rc = request_irq(psc_dma-irq, psc_dma_status_irq, IRQF_SHARED,
+

Re: Porting the ibm_newemac driver to use phylib (and other PHY/MAC questions)

2009-04-26 Thread Benjamin Herrenschmidt
On Mon, 2009-04-20 at 20:10 -0400, Kyle Moffett wrote:
  IIRC, Ben had some issues with how phylib and the EMAC would need to
  interact.  Not sure if he has those written down somewhere or not.
  (CC'd).
 
 Hmm, yeah, I'd be interested to see those.  There's enough similar
 between phylib and the EMAC and sungem drivers that I'm considering a
 series of somewhat-mechanical patches to make EMAC and sungem use the
 struct phy_device and struct mii_bus from phylib, possibly
 abstracting out some helper functions along the way.

Yup, emac and sungem predate phylib.

I had a quick look at what it would take to port at least emac over, the
main issue was that I want to be able to sleep (ie, take a mutex) in my
mdio read/write functions, and back then, phylib wouldn't let me do that
due to spinlock and timer/softirq usage.

Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] powerpc: Add 2.06 tlbie mnemonics

2009-04-26 Thread Benjamin Herrenschmidt
On Fri, 2009-04-24 at 16:24 +1000, Michael Neuling wrote:
 From: Milton Miller milt...@bga.com
 
 This adds the PowerPC 2.06 tlbie mnemonics and keeps backwards
 compatibilty for CPUs before 2.06.
 
 Only useful for bare metal systems.  

I'd rather stick that in mmu features rather than cpu features to
save space in the later...

Cheers,
Ben.

 Signed-off-by: Milton Miller milt...@bga.com
 Signed-off-by: Michael Neuling mi...@neuling.org
 ---
 As they say, better out than in
 ---
 
  arch/powerpc/include/asm/cputable.h |3 ++-
  arch/powerpc/mm/hash_native_64.c|   13 +++--
  2 files changed, 13 insertions(+), 3 deletions(-)
 
 Index: linux-2.6-ozlabs/arch/powerpc/include/asm/cputable.h
 ===
 --- linux-2.6-ozlabs.orig/arch/powerpc/include/asm/cputable.h
 +++ linux-2.6-ozlabs/arch/powerpc/include/asm/cputable.h
 @@ -195,6 +195,7 @@ extern const char *powerpc_base_platform
  #define CPU_FTR_SAO  LONG_ASM_CONST(0x0020)
  #define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x0040)
  #define CPU_FTR_UNALIGNED_LD_STD LONG_ASM_CONST(0x0080)
 +#define CPU_FTR_TLBIE_206LONG_ASM_CONST(0x0100)
  
  #ifndef __ASSEMBLY__
  
 @@ -409,7 +410,7 @@ extern const char *powerpc_base_platform
   CPU_FTR_MMCRA | CPU_FTR_SMT | \
   CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
   CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
 - CPU_FTR_DSCR | CPU_FTR_SAO)
 + CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_TLBIE_206)
  #define CPU_FTRS_CELL(CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
   CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
   CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
 Index: linux-2.6-ozlabs/arch/powerpc/mm/hash_native_64.c
 ===
 --- linux-2.6-ozlabs.orig/arch/powerpc/mm/hash_native_64.c
 +++ linux-2.6-ozlabs/arch/powerpc/mm/hash_native_64.c
 @@ -38,6 +38,9 @@
  
  static DEFINE_SPINLOCK(native_tlbie_lock);
  
 +#define TLBIE(lp,a) \
 + stringify_in_c(.long 0x7c000264 | ((a)  11) | ((lp)  21))
 +
  static inline void __tlbie(unsigned long va, int psize, int ssize)
  {
   unsigned int penc;
 @@ -49,14 +52,19 @@ static inline void __tlbie(unsigned long
   case MMU_PAGE_4K:
   va = ~0xffful;
   va |= ssize  8;
 - asm volatile(tlbie %0,0 : : r (va) : memory);
 + asm volatile(ASM_FTR_IFCLR(tlbie %0,0, TLBIE(%1,%0), %2)
 +  : : r (va), r(0), i (CPU_FTR_TLBIE_206)
 +  : memory);
   break;
   default:
   penc = mmu_psize_defs[psize].penc;
   va = ~((1ul  mmu_psize_defs[psize].shift) - 1);
   va |= penc  12;
   va |= ssize  8;
 - asm volatile(tlbie %0,1 : : r (va) : memory);
 + va |= 1; /* L */
 + asm volatile(ASM_FTR_IFCLR(tlbie %0,1, TLBIE(%1,%0), %2)
 +  : : r (va), r(0), i (CPU_FTR_TLBIE_206)
 +  : memory);
   break;
   }
  }
 @@ -80,6 +88,7 @@ static inline void __tlbiel(unsigned lon
   va = ~((1ul  mmu_psize_defs[psize].shift) - 1);
   va |= penc  12;
   va |= ssize  8;
 + va |= 1; /* L */
   asm volatile(.long 0x7c000224 | (%0  11) | (1  21)
: : r(va) : memory);
   break;

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH V1 1/3] Basic split of mpc5200 DMA code out from mpc5200_psc_i2s

2009-04-26 Thread Grant Likely
On Sun, Apr 26, 2009 at 1:53 PM, Jon Smirl jonsm...@gmail.com wrote:
 Basic split of mpc5200 DMA code out from i2s into a standalone file.

 Signed-off-by: Jon Smirl jonsm...@gmail.com

Acked-by: Grant Likely grant.lik...@secretlab.ca

But you should really also send this to the ALSA list.  I cannot merge
this patch.

g.

 ---
  sound/soc/fsl/Kconfig           |    4
  sound/soc/fsl/Makefile          |    2
  sound/soc/fsl/mpc5200_dma.c     |  457 +
  sound/soc/fsl/mpc5200_dma.h     |   81 +++
  sound/soc/fsl/mpc5200_psc_i2s.c |  484 
 ---
  5 files changed, 546 insertions(+), 482 deletions(-)
  create mode 100644 sound/soc/fsl/mpc5200_dma.c
  create mode 100644 sound/soc/fsl/mpc5200_dma.h

 diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
 index 9fc9082..dc79bdf 100644
 --- a/sound/soc/fsl/Kconfig
 +++ b/sound/soc/fsl/Kconfig
 @@ -1,5 +1,8 @@
  config SND_SOC_OF_SIMPLE
        tristate
 +
 +config SND_MPC52xx_DMA
 +       tristate

  # ASoC platform support for the Freescale MPC8610 SOC.  This compiles drivers
  # for the SSI and the Elo DMA controller.  You will still need to select
 @@ -23,6 +26,7 @@ config SND_SOC_MPC5200_I2S
        tristate Freescale MPC5200 PSC in I2S mode driver
        depends on PPC_MPC52xx  PPC_BESTCOMM
        select SND_SOC_OF_SIMPLE
 +       select SND_MPC52xx_DMA
        select PPC_BESTCOMM_GEN_BD
        help
          Say Y here to support the MPC5200 PSCs in I2S mode.
 diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
 index f85134c..7731ef2 100644
 --- a/sound/soc/fsl/Makefile
 +++ b/sound/soc/fsl/Makefile
 @@ -10,5 +10,7 @@ snd-soc-fsl-ssi-objs := fsl_ssi.o
  snd-soc-fsl-dma-objs := fsl_dma.o
  obj-$(CONFIG_SND_SOC_MPC8610) += snd-soc-fsl-ssi.o snd-soc-fsl-dma.o

 +# MPC5200 Platform Support
 +obj-$(CONFIG_SND_MPC52xx_DMA) += mpc5200_dma.o
  obj-$(CONFIG_SND_SOC_MPC5200_I2S) += mpc5200_psc_i2s.o

 diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
 new file mode 100644
 index 000..cccaff4
 --- /dev/null
 +++ b/sound/soc/fsl/mpc5200_dma.c
 @@ -0,0 +1,457 @@
 +/*
 + * Freescale MPC5200 PSC DMA
 + * ALSA SoC Platform driver
 + *
 + * Copyright (C) 2008 Secret Lab Technologies Ltd.
 + */
 +
 +#include linux/init.h
 +#include linux/module.h
 +#include linux/interrupt.h
 +#include linux/device.h
 +#include linux/delay.h
 +#include linux/of_device.h
 +#include linux/of_platform.h
 +#include linux/dma-mapping.h
 +
 +#include sound/core.h
 +#include sound/pcm.h
 +#include sound/pcm_params.h
 +#include sound/initval.h
 +#include sound/soc.h
 +#include sound/soc-of-simple.h
 +
 +#include sysdev/bestcomm/bestcomm.h
 +#include sysdev/bestcomm/gen_bd.h
 +#include asm/mpc52xx_psc.h
 +
 +#include mpc5200_dma.h
 +
 +MODULE_AUTHOR(Grant Likely grant.lik...@secretlab.ca);
 +MODULE_DESCRIPTION(Freescale MPC5200 PSC in DMA mode ASoC Driver);
 +MODULE_LICENSE(GPL);
 +
 +/*
 + * Interrupt handlers
 + */
 +static irqreturn_t psc_i2s_status_irq(int irq, void *_psc_i2s)
 +{
 +       struct psc_i2s *psc_i2s = _psc_i2s;
 +       struct mpc52xx_psc __iomem *regs = psc_i2s-psc_regs;
 +       u16 isr;
 +
 +       isr = in_be16(regs-mpc52xx_psc_isr);
 +
 +       /* Playback underrun error */
 +       if (psc_i2s-playback.active  (isr  MPC52xx_PSC_IMR_TXEMP))
 +               psc_i2s-stats.underrun_count++;
 +
 +       /* Capture overrun error */
 +       if (psc_i2s-capture.active  (isr  MPC52xx_PSC_IMR_ORERR))
 +               psc_i2s-stats.overrun_count++;
 +
 +       out_8(regs-command, 4  4);  /* reset the error status */
 +
 +       return IRQ_HANDLED;
 +}
 +
 +/**
 + * psc_i2s_bcom_enqueue_next_buffer - Enqueue another audio buffer
 + * @s: pointer to stream private data structure
 + *
 + * Enqueues another audio period buffer into the bestcomm queue.
 + *
 + * Note: The routine must only be called when there is space available in
 + * the queue.  Otherwise the enqueue will fail and the audio ring buffer
 + * will get out of sync
 + */
 +static void psc_i2s_bcom_enqueue_next_buffer(struct psc_i2s_stream *s)
 +{
 +       struct bcom_bd *bd;
 +
 +       /* Prepare and enqueue the next buffer descriptor */
 +       bd = bcom_prepare_next_buffer(s-bcom_task);
 +       bd-status = s-period_bytes;
 +       bd-data[0] = s-period_next_pt;
 +       bcom_submit_next_buffer(s-bcom_task, NULL);
 +
 +       /* Update for next period */
 +       s-period_next_pt += s-period_bytes;
 +       if (s-period_next_pt = s-period_end)
 +               s-period_next_pt = s-period_start;
 +}
 +
 +/* Bestcomm DMA irq handler */
 +static irqreturn_t psc_i2s_bcom_irq(int irq, void *_psc_i2s_stream)
 +{
 +       struct psc_i2s_stream *s = _psc_i2s_stream;
 +
 +       /* For each finished period, dequeue the completed period buffer
 +        * and enqueue a new one in it's place. */
 +       while (bcom_buffer_done(s-bcom_task)) {
 +               bcom_retrieve_buffer(s-bcom_task, NULL, NULL);
 +          

Re: [PATCH V1 2/3] Rename the PSC functions to DMA

2009-04-26 Thread Grant Likely
On Sun, Apr 26, 2009 at 1:53 PM, Jon Smirl jonsm...@gmail.com wrote:
 Rename the functions in the mpc5200 DMA file from i2s to dma to reflect the 
 file they are in.

 Signed-off-by: Jon Smirl jonsm...@gmail.com

Acked-by: Grant Likely grant.lik...@secretlab.ca


 ---
  sound/soc/fsl/mpc5200_dma.c     |  194 
 ---
  sound/soc/fsl/mpc5200_dma.h     |   26 +++--
  sound/soc/fsl/mpc5200_psc_i2s.c |  160 
  3 files changed, 190 insertions(+), 190 deletions(-)

 diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
 index cccaff4..c82ef75 100644
 --- a/sound/soc/fsl/mpc5200_dma.c
 +++ b/sound/soc/fsl/mpc5200_dma.c
 @@ -34,21 +34,21 @@ MODULE_LICENSE(GPL);
  /*
  * Interrupt handlers
  */
 -static irqreturn_t psc_i2s_status_irq(int irq, void *_psc_i2s)
 +static irqreturn_t psc_dma_status_irq(int irq, void *_psc_dma)
  {
 -       struct psc_i2s *psc_i2s = _psc_i2s;
 -       struct mpc52xx_psc __iomem *regs = psc_i2s-psc_regs;
 +       struct psc_dma *psc_dma = _psc_dma;
 +       struct mpc52xx_psc __iomem *regs = psc_dma-psc_regs;
        u16 isr;

        isr = in_be16(regs-mpc52xx_psc_isr);

        /* Playback underrun error */
 -       if (psc_i2s-playback.active  (isr  MPC52xx_PSC_IMR_TXEMP))
 -               psc_i2s-stats.underrun_count++;
 +       if (psc_dma-playback.active  (isr  MPC52xx_PSC_IMR_TXEMP))
 +               psc_dma-stats.underrun_count++;

        /* Capture overrun error */
 -       if (psc_i2s-capture.active  (isr  MPC52xx_PSC_IMR_ORERR))
 -               psc_i2s-stats.overrun_count++;
 +       if (psc_dma-capture.active  (isr  MPC52xx_PSC_IMR_ORERR))
 +               psc_dma-stats.overrun_count++;

        out_8(regs-command, 4  4);  /* reset the error status */

 @@ -56,7 +56,7 @@ static irqreturn_t psc_i2s_status_irq(int irq, void 
 *_psc_i2s)
  }

  /**
 - * psc_i2s_bcom_enqueue_next_buffer - Enqueue another audio buffer
 + * psc_dma_bcom_enqueue_next_buffer - Enqueue another audio buffer
  * @s: pointer to stream private data structure
  *
  * Enqueues another audio period buffer into the bestcomm queue.
 @@ -65,7 +65,7 @@ static irqreturn_t psc_i2s_status_irq(int irq, void 
 *_psc_i2s)
  * the queue.  Otherwise the enqueue will fail and the audio ring buffer
  * will get out of sync
  */
 -static void psc_i2s_bcom_enqueue_next_buffer(struct psc_i2s_stream *s)
 +static void psc_dma_bcom_enqueue_next_buffer(struct psc_dma_stream *s)
  {
        struct bcom_bd *bd;

 @@ -82,9 +82,9 @@ static void psc_i2s_bcom_enqueue_next_buffer(struct 
 psc_i2s_stream *s)
  }

  /* Bestcomm DMA irq handler */
 -static irqreturn_t psc_i2s_bcom_irq(int irq, void *_psc_i2s_stream)
 +static irqreturn_t psc_dma_bcom_irq(int irq, void *_psc_dma_stream)
  {
 -       struct psc_i2s_stream *s = _psc_i2s_stream;
 +       struct psc_dma_stream *s = _psc_dma_stream;

        /* For each finished period, dequeue the completed period buffer
         * and enqueue a new one in it's place. */
 @@ -93,7 +93,7 @@ static irqreturn_t psc_i2s_bcom_irq(int irq, void 
 *_psc_i2s_stream)
                s-period_current_pt += s-period_bytes;
                if (s-period_current_pt = s-period_end)
                        s-period_current_pt = s-period_start;
 -               psc_i2s_bcom_enqueue_next_buffer(s);
 +               psc_dma_bcom_enqueue_next_buffer(s);
                bcom_enable(s-bcom_task);
        }

 @@ -106,39 +106,39 @@ static irqreturn_t psc_i2s_bcom_irq(int irq, void 
 *_psc_i2s_stream)
  }

  /**
 - * psc_i2s_startup: create a new substream
 + * psc_dma_startup: create a new substream
  *
  * This is the first function called when a stream is opened.
  *
  * If this is the first stream open, then grab the IRQ and program most of
  * the PSC registers.
  */
 -int psc_i2s_startup(struct snd_pcm_substream *substream,
 +int psc_dma_startup(struct snd_pcm_substream *substream,
                           struct snd_soc_dai *dai)
  {
        struct snd_soc_pcm_runtime *rtd = substream-private_data;
 -       struct psc_i2s *psc_i2s = rtd-dai-cpu_dai-private_data;
 +       struct psc_dma *psc_dma = rtd-dai-cpu_dai-private_data;
        int rc;

 -       dev_dbg(psc_i2s-dev, psc_i2s_startup(substream=%p)\n, substream);
 +       dev_dbg(psc_dma-dev, psc_dma_startup(substream=%p)\n, substream);

 -       if (!psc_i2s-playback.active 
 -           !psc_i2s-capture.active) {
 +       if (!psc_dma-playback.active 
 +           !psc_dma-capture.active) {
                /* Setup the IRQs */
 -               rc = request_irq(psc_i2s-irq, psc_i2s_status_irq, 
 IRQF_SHARED,
 -                                psc-i2s-status, psc_i2s);
 -               rc |= request_irq(psc_i2s-capture.irq,
 -                                 psc_i2s_bcom_irq, IRQF_SHARED,
 -                                 psc-i2s-capture, psc_i2s-capture);
 -               rc |= request_irq(psc_i2s-playback.irq,
 -                                 psc_i2s_bcom_irq, 

Re: [PATCH V1 3/3] Rename exports in mpc5200_dma.c

2009-04-26 Thread Grant Likely
On Sun, Apr 26, 2009 at 1:53 PM, Jon Smirl jonsm...@gmail.com wrote:
 Rename the public DMA exports into the global name space so that the DMA code 
 can be built as a module.

 Signed-off-by: Jon Smirl jonsm...@gmail.com

Nack.  mpc5200_dma is too generic for the global namespace... (in
fact, I should also relook at the previous patch; I might need to nack
my ack).  Some variant of 'mpc5200_psc_snd_dma' would be more
appropriate.  Even mpc5200_psc_dma is too generic because other
non-sound PSC modes can use DMA also.

g.

 ---
  sound/soc/fsl/mpc5200_dma.c     |   18 --
  sound/soc/fsl/mpc5200_dma.h     |   10 +-
  sound/soc/fsl/mpc5200_psc_i2s.c |   14 +++---
  3 files changed, 24 insertions(+), 18 deletions(-)

 diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
 index c82ef75..df73755 100644
 --- a/sound/soc/fsl/mpc5200_dma.c
 +++ b/sound/soc/fsl/mpc5200_dma.c
 @@ -113,7 +113,7 @@ static irqreturn_t psc_dma_bcom_irq(int irq, void 
 *_psc_dma_stream)
  * If this is the first stream open, then grab the IRQ and program most of
  * the PSC registers.
  */
 -int psc_dma_startup(struct snd_pcm_substream *substream,
 +int mpc5200_dma_startup(struct snd_pcm_substream *substream,
                           struct snd_soc_dai *dai)
  {
        struct snd_soc_pcm_runtime *rtd = substream-private_data;
 @@ -145,13 +145,16 @@ int psc_dma_startup(struct snd_pcm_substream *substream,

        return 0;
  }
 +EXPORT_SYMBOL_GPL(mpc5200_dma_startup);

 -int psc_dma_hw_free(struct snd_pcm_substream *substream,
 +int mpc5200_dma_hw_free(struct snd_pcm_substream *substream,
                           struct snd_soc_dai *dai)
  {
        snd_pcm_set_runtime_buffer(substream, NULL);
        return 0;
  }
 +EXPORT_SYMBOL_GPL(mpc5200_dma_hw_free);
 +

  /**
  * psc_dma_trigger: start and stop the DMA transfer.
 @@ -159,7 +162,7 @@ int psc_dma_hw_free(struct snd_pcm_substream *substream,
  * This function is called by ALSA to start, stop, pause, and resume the DMA
  * transfer of data.
  */
 -int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd,
 +int mpc5200_dma_trigger(struct snd_pcm_substream *substream, int cmd,
                           struct snd_soc_dai *dai)
  {
        struct snd_soc_pcm_runtime *rtd = substream-private_data;
 @@ -269,13 +272,15 @@ int psc_dma_trigger(struct snd_pcm_substream 
 *substream, int cmd,

        return 0;
  }
 +EXPORT_SYMBOL_GPL(mpc5200_dma_trigger);
 +

  /**
  * psc_dma_shutdown: shutdown the data transfer on a stream
  *
  * Shutdown the PSC if there are no other substreams open.
  */
 -void psc_dma_shutdown(struct snd_pcm_substream *substream,
 +void mpc5200_dma_shutdown(struct snd_pcm_substream *substream,
                             struct snd_soc_dai *dai)
  {
        struct snd_soc_pcm_runtime *rtd = substream-private_data;
 @@ -303,6 +308,7 @@ void psc_dma_shutdown(struct snd_pcm_substream *substream,
                free_irq(psc_dma-playback.irq, psc_dma-playback);
        }
  }
 +EXPORT_SYMBOL_GPL(mpc5200_dma_shutdown);

  /* -
  * The PSC DMA 'ASoC platform' driver
 @@ -448,10 +454,10 @@ static void psc_dma_pcm_free(struct snd_pcm *pcm)
        }
  }

 -struct snd_soc_platform psc_dma_pcm_soc_platform = {
 +struct snd_soc_platform mpc5200_dma_platform = {
        .name           = mpc5200-psc-audio,
        .pcm_ops        = psc_dma_pcm_ops,
        .pcm_new        = psc_dma_pcm_new,
        .pcm_free       = psc_dma_pcm_free,
  };
 -
 +EXPORT_SYMBOL_GPL(mpc5200_dma_platform);
 diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
 index a33232c..e52b90e 100644
 --- a/sound/soc/fsl/mpc5200_dma.h
 +++ b/sound/soc/fsl/mpc5200_dma.h
 @@ -64,18 +64,18 @@ struct psc_dma {
  };


 -int psc_dma_startup(struct snd_pcm_substream *substream,
 +int mpc5200_dma_startup(struct snd_pcm_substream *substream,
                           struct snd_soc_dai *dai);

 -int psc_dma_hw_free(struct snd_pcm_substream *substream,
 +int mpc5200_dma_hw_free(struct snd_pcm_substream *substream,
                           struct snd_soc_dai *dai);

 -void psc_dma_shutdown(struct snd_pcm_substream *substream,
 +void mpc5200_dma_shutdown(struct snd_pcm_substream *substream,
                             struct snd_soc_dai *dai);

 -int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd,
 +int mpc5200_dma_trigger(struct snd_pcm_substream *substream, int cmd,
                           struct snd_soc_dai *dai);

 -extern struct snd_soc_platform psc_dma_pcm_soc_platform;
 +extern struct snd_soc_platform mpc5200_dma_platform;

  #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */
 diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
 index 12a7917..a4a439c 100644
 --- a/sound/soc/fsl/mpc5200_psc_i2s.c
 +++ b/sound/soc/fsl/mpc5200_psc_i2s.c
 @@ -140,11 +140,11 @@ static int psc_i2s_set_fmt(struct snd_soc_dai *cpu_dai, 
 unsigned int 

microblaze: Statically linking device tree blobs into the kernel

2009-04-26 Thread John Williams
To MicroBlazers and other interested parties:

Currently the MicroBlaze kernel boot-time ABI requires r7 to point to
a valid DTB, whereupon in early kernel setup the DTB is copied to a
statically allocated 16k memory region inside the kernel. From there
it is later queried by the platform startup code.

For simple boot scenarios the ability to statically bind a DTB into
the kernel image would clearly be useful.  In PPC land, this is
achieved through the simpleboot bootloader that lives in
arch/powerpc/boot.  The DTB becomes part of the simpleboot payload,
and is passed to the kernel through the normal means.

I'm not convinced duplicating this for MicroBlaze is a good idea, I
think it would be overkill.  However, the make syntax that PPC uses to
achieve DTB binding is quite nice:

$ make simpleImage.board

which binds arch/powerpc/boot/dts/board.dts into the boot payload.

My feeling is that we should make use of the fact that the DTB region
is statically allocated in the MicroBlaze kernel anyway.  From
arch/microblaze/kernel/vmlinux.lds.S:

. = ALIGN (4) ;
   _fdt_start = . ; /* place for fdt blob */
   . = . + 0x4000;
   _fdt_end = . ;

and in head.S, the DTB at r7 is copied into place at _fdt_start

/* save fdt to kernel location */
/* r7 stores pointer to fdt blob */
beqir7, no_fdt_arg
or  r11, r0, r0 /* incremment */
ori r4, r0, TOPHYS(_fdt_start) /* save bram context */
ori r3, r0, (0x4000 - 4)
_copy_fdt:
   simple copy loop
no_fdt_arg:

Since this memory is already allocated in the kernel image but is
normally just zeros, to bind a DTB to the kernel we could just store
it in-situ.  This way, if a non-zero r7 is passed in at boot time,
head.S will naturally overwrite (and thus override) the default DTB
that was inside the kernel image.

What I'm not so sure about is how best to achieve this in the kbuild
sequence.  I see two options:

 (a) use .incbin in a .S file, similar to how the initramfs gets
linked in in /usr/Makefile etc, or
 (b) use objcopy to manipulate vmlinux after final link, by directly
inserting the DTB into the appropriate ELF section.

(a) seems nice because it means that our standard make targets, such
as linux.bin etc, would still work unchanged.  (b) seems to go a bit
against the grain of kbuild, but maybe I'm wrong there.

I've hacked around with (a) a bit, part of the problem is that it
seems arch/microblaze/Makefile would need something like

core-y += arch/microblaze/boot

because the DTB object file must be ready before final vmlinux link.

Instead of how it's done now (and in PPC), which is:

$(BOOT_TARGETS): vmlinux
$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)

where vmlinux is a dependency of the whole simpleImage/DTB binding process.

Anyway input on both the approach, and how to achieve it, would be
greatly appreciated before we go working to deeply on the
implementation.

Thanks,

John
-- 
John Williams,
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com  p: +61-7-30090663  f: +61-7-30090663
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH V1 3/3] Rename exports in mpc5200_dma.c

2009-04-26 Thread Jon Smirl
On Mon, Apr 27, 2009 at 12:08 AM, Grant Likely
grant.lik...@secretlab.ca wrote:
 On Sun, Apr 26, 2009 at 1:53 PM, Jon Smirl jonsm...@gmail.com wrote:
 Rename the public DMA exports into the global name space so that the DMA 
 code can be built as a module.

 Signed-off-by: Jon Smirl jonsm...@gmail.com

 Nack.  mpc5200_dma is too generic for the global namespace... (in
 fact, I should also relook at the previous patch; I might need to nack
 my ack).  Some variant of 'mpc5200_psc_snd_dma' would be more
 appropriate.  Even mpc5200_psc_dma is too generic because other
 non-sound PSC modes can use DMA also.

I'll change it to mpc5200_audio_dma and resend this to the series to
the alsa list.

Does your stuff still work with these patches? I want to get these
mechanical changes in so we can focus on the real changes in my later
patches.


 g.

 ---
  sound/soc/fsl/mpc5200_dma.c     |   18 --
  sound/soc/fsl/mpc5200_dma.h     |   10 +-
  sound/soc/fsl/mpc5200_psc_i2s.c |   14 +++---
  3 files changed, 24 insertions(+), 18 deletions(-)

 diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
 index c82ef75..df73755 100644
 --- a/sound/soc/fsl/mpc5200_dma.c
 +++ b/sound/soc/fsl/mpc5200_dma.c
 @@ -113,7 +113,7 @@ static irqreturn_t psc_dma_bcom_irq(int irq, void 
 *_psc_dma_stream)
  * If this is the first stream open, then grab the IRQ and program most of
  * the PSC registers.
  */
 -int psc_dma_startup(struct snd_pcm_substream *substream,
 +int mpc5200_dma_startup(struct snd_pcm_substream *substream,
                           struct snd_soc_dai *dai)
  {
        struct snd_soc_pcm_runtime *rtd = substream-private_data;
 @@ -145,13 +145,16 @@ int psc_dma_startup(struct snd_pcm_substream 
 *substream,

        return 0;
  }
 +EXPORT_SYMBOL_GPL(mpc5200_dma_startup);

 -int psc_dma_hw_free(struct snd_pcm_substream *substream,
 +int mpc5200_dma_hw_free(struct snd_pcm_substream *substream,
                           struct snd_soc_dai *dai)
  {
        snd_pcm_set_runtime_buffer(substream, NULL);
        return 0;
  }
 +EXPORT_SYMBOL_GPL(mpc5200_dma_hw_free);
 +

  /**
  * psc_dma_trigger: start and stop the DMA transfer.
 @@ -159,7 +162,7 @@ int psc_dma_hw_free(struct snd_pcm_substream *substream,
  * This function is called by ALSA to start, stop, pause, and resume the DMA
  * transfer of data.
  */
 -int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd,
 +int mpc5200_dma_trigger(struct snd_pcm_substream *substream, int cmd,
                           struct snd_soc_dai *dai)
  {
        struct snd_soc_pcm_runtime *rtd = substream-private_data;
 @@ -269,13 +272,15 @@ int psc_dma_trigger(struct snd_pcm_substream 
 *substream, int cmd,

        return 0;
  }
 +EXPORT_SYMBOL_GPL(mpc5200_dma_trigger);
 +

  /**
  * psc_dma_shutdown: shutdown the data transfer on a stream
  *
  * Shutdown the PSC if there are no other substreams open.
  */
 -void psc_dma_shutdown(struct snd_pcm_substream *substream,
 +void mpc5200_dma_shutdown(struct snd_pcm_substream *substream,
                             struct snd_soc_dai *dai)
  {
        struct snd_soc_pcm_runtime *rtd = substream-private_data;
 @@ -303,6 +308,7 @@ void psc_dma_shutdown(struct snd_pcm_substream 
 *substream,
                free_irq(psc_dma-playback.irq, psc_dma-playback);
        }
  }
 +EXPORT_SYMBOL_GPL(mpc5200_dma_shutdown);

  /* -
  * The PSC DMA 'ASoC platform' driver
 @@ -448,10 +454,10 @@ static void psc_dma_pcm_free(struct snd_pcm *pcm)
        }
  }

 -struct snd_soc_platform psc_dma_pcm_soc_platform = {
 +struct snd_soc_platform mpc5200_dma_platform = {
        .name           = mpc5200-psc-audio,
        .pcm_ops        = psc_dma_pcm_ops,
        .pcm_new        = psc_dma_pcm_new,
        .pcm_free       = psc_dma_pcm_free,
  };
 -
 +EXPORT_SYMBOL_GPL(mpc5200_dma_platform);
 diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
 index a33232c..e52b90e 100644
 --- a/sound/soc/fsl/mpc5200_dma.h
 +++ b/sound/soc/fsl/mpc5200_dma.h
 @@ -64,18 +64,18 @@ struct psc_dma {
  };


 -int psc_dma_startup(struct snd_pcm_substream *substream,
 +int mpc5200_dma_startup(struct snd_pcm_substream *substream,
                           struct snd_soc_dai *dai);

 -int psc_dma_hw_free(struct snd_pcm_substream *substream,
 +int mpc5200_dma_hw_free(struct snd_pcm_substream *substream,
                           struct snd_soc_dai *dai);

 -void psc_dma_shutdown(struct snd_pcm_substream *substream,
 +void mpc5200_dma_shutdown(struct snd_pcm_substream *substream,
                             struct snd_soc_dai *dai);

 -int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd,
 +int mpc5200_dma_trigger(struct snd_pcm_substream *substream, int cmd,
                           struct snd_soc_dai *dai);

 -extern struct snd_soc_platform psc_dma_pcm_soc_platform;
 +extern struct snd_soc_platform mpc5200_dma_platform;

  #endif /* 

Re: [PATCH V1 2/3] Rename the PSC functions to DMA

2009-04-26 Thread Grant Likely
On Sun, Apr 26, 2009 at 10:04 PM, Grant Likely
grant.lik...@secretlab.ca wrote:
 On Sun, Apr 26, 2009 at 1:53 PM, Jon Smirl jonsm...@gmail.com wrote:
 Rename the functions in the mpc5200 DMA file from i2s to dma to reflect the 
 file they are in.

 Signed-off-by: Jon Smirl jonsm...@gmail.com

 Acked-by: Grant Likely grant.lik...@secretlab.ca

Okay, I've taken a second look now (as per my comment on 3/3), and
yes, I'm still okay with the name changes because the header file
scope is restricted.  If this header was in include/linux/, then I'd
say the prefix should be more specific.

g.



 ---
  sound/soc/fsl/mpc5200_dma.c     |  194 
 ---
  sound/soc/fsl/mpc5200_dma.h     |   26 +++--
  sound/soc/fsl/mpc5200_psc_i2s.c |  160 
  3 files changed, 190 insertions(+), 190 deletions(-)

 diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
 index cccaff4..c82ef75 100644
 --- a/sound/soc/fsl/mpc5200_dma.c
 +++ b/sound/soc/fsl/mpc5200_dma.c
 @@ -34,21 +34,21 @@ MODULE_LICENSE(GPL);
  /*
  * Interrupt handlers
  */
 -static irqreturn_t psc_i2s_status_irq(int irq, void *_psc_i2s)
 +static irqreturn_t psc_dma_status_irq(int irq, void *_psc_dma)
  {
 -       struct psc_i2s *psc_i2s = _psc_i2s;
 -       struct mpc52xx_psc __iomem *regs = psc_i2s-psc_regs;
 +       struct psc_dma *psc_dma = _psc_dma;
 +       struct mpc52xx_psc __iomem *regs = psc_dma-psc_regs;
        u16 isr;

        isr = in_be16(regs-mpc52xx_psc_isr);

        /* Playback underrun error */
 -       if (psc_i2s-playback.active  (isr  MPC52xx_PSC_IMR_TXEMP))
 -               psc_i2s-stats.underrun_count++;
 +       if (psc_dma-playback.active  (isr  MPC52xx_PSC_IMR_TXEMP))
 +               psc_dma-stats.underrun_count++;

        /* Capture overrun error */
 -       if (psc_i2s-capture.active  (isr  MPC52xx_PSC_IMR_ORERR))
 -               psc_i2s-stats.overrun_count++;
 +       if (psc_dma-capture.active  (isr  MPC52xx_PSC_IMR_ORERR))
 +               psc_dma-stats.overrun_count++;

        out_8(regs-command, 4  4);  /* reset the error status */

 @@ -56,7 +56,7 @@ static irqreturn_t psc_i2s_status_irq(int irq, void 
 *_psc_i2s)
  }

  /**
 - * psc_i2s_bcom_enqueue_next_buffer - Enqueue another audio buffer
 + * psc_dma_bcom_enqueue_next_buffer - Enqueue another audio buffer
  * @s: pointer to stream private data structure
  *
  * Enqueues another audio period buffer into the bestcomm queue.
 @@ -65,7 +65,7 @@ static irqreturn_t psc_i2s_status_irq(int irq, void 
 *_psc_i2s)
  * the queue.  Otherwise the enqueue will fail and the audio ring buffer
  * will get out of sync
  */
 -static void psc_i2s_bcom_enqueue_next_buffer(struct psc_i2s_stream *s)
 +static void psc_dma_bcom_enqueue_next_buffer(struct psc_dma_stream *s)
  {
        struct bcom_bd *bd;

 @@ -82,9 +82,9 @@ static void psc_i2s_bcom_enqueue_next_buffer(struct 
 psc_i2s_stream *s)
  }

  /* Bestcomm DMA irq handler */
 -static irqreturn_t psc_i2s_bcom_irq(int irq, void *_psc_i2s_stream)
 +static irqreturn_t psc_dma_bcom_irq(int irq, void *_psc_dma_stream)
  {
 -       struct psc_i2s_stream *s = _psc_i2s_stream;
 +       struct psc_dma_stream *s = _psc_dma_stream;

        /* For each finished period, dequeue the completed period buffer
         * and enqueue a new one in it's place. */
 @@ -93,7 +93,7 @@ static irqreturn_t psc_i2s_bcom_irq(int irq, void 
 *_psc_i2s_stream)
                s-period_current_pt += s-period_bytes;
                if (s-period_current_pt = s-period_end)
                        s-period_current_pt = s-period_start;
 -               psc_i2s_bcom_enqueue_next_buffer(s);
 +               psc_dma_bcom_enqueue_next_buffer(s);
                bcom_enable(s-bcom_task);
        }

 @@ -106,39 +106,39 @@ static irqreturn_t psc_i2s_bcom_irq(int irq, void 
 *_psc_i2s_stream)
  }

  /**
 - * psc_i2s_startup: create a new substream
 + * psc_dma_startup: create a new substream
  *
  * This is the first function called when a stream is opened.
  *
  * If this is the first stream open, then grab the IRQ and program most of
  * the PSC registers.
  */
 -int psc_i2s_startup(struct snd_pcm_substream *substream,
 +int psc_dma_startup(struct snd_pcm_substream *substream,
                           struct snd_soc_dai *dai)
  {
        struct snd_soc_pcm_runtime *rtd = substream-private_data;
 -       struct psc_i2s *psc_i2s = rtd-dai-cpu_dai-private_data;
 +       struct psc_dma *psc_dma = rtd-dai-cpu_dai-private_data;
        int rc;

 -       dev_dbg(psc_i2s-dev, psc_i2s_startup(substream=%p)\n, substream);
 +       dev_dbg(psc_dma-dev, psc_dma_startup(substream=%p)\n, substream);

 -       if (!psc_i2s-playback.active 
 -           !psc_i2s-capture.active) {
 +       if (!psc_dma-playback.active 
 +           !psc_dma-capture.active) {
                /* Setup the IRQs */
 -               rc = request_irq(psc_i2s-irq, psc_i2s_status_irq, 
 IRQF_SHARED,
 -                                

MPC8548 eTsec

2009-04-26 Thread jay_chen
Dear All:

I am using linux 2.6.14.5 (with many modification) and MPC8548.
Sometimes(very rare) the nic will boot up with rx problem. (tx is just fine)
I see pkts are all dropped in chip but no any RX or BSY interrupt are ever
raised.
(Receive Drop Counter is increased)

If I down and up the nic, the problem will gone.

Any suggestion is welcome. Thanks.
 
 
Jay...
 
Some dumps:
 
eth 3:

root@/# cat /proc/interrupts
   CPU0
 19:  0   OpenPIC   Level enet_tx
 20:  0   OpenPIC   Level enet_rx
 21:  12433   OpenPIC   Level enet_tx  == nic with problem, tx good
 22:  0   OpenPIC   Level enet_rx  == nic with problem, no rx
 23:  0   OpenPIC   Level enet_error
 24:  0   OpenPIC   Level enet_error
 26:   5604   OpenPIC   Level serial
 27:   1698   OpenPIC   Level i2c-mpc, i2c-mpc
 50:  0   OpenPIC   Edge  isr
 51:  0   OpenPIC   Edge  isr
 52:  0   OpenPIC   Edge  isr
 53:  1   OpenPIC   Edge  isr
 54:  1   OpenPIC   Edge  isr
 55:  0   OpenPIC   Edge  isr
 56:  1   OpenPIC   Edge  isr
 57:  0   OpenPIC   Edge  isr
BAD:  0
root@/#

ctrl:
tsec_id : 0x124
ievent  : 0x80
imask   : 0xF1710083
edis: 0x0
ecntrl  : 0x1010
minflr  : 0x0
ptv : 0x0
dmactrl : 0xC3
tbipa   : 0x1F
tctrl   : 0x6000
tstat   : 0x80008000
dfvlan  : 0x8100
tbdlen  : 0x0
txic: 0x8215
tqueue  : 0x8000
tbdbph  : 0x0
tbptr0  : 0x7E16B470
tbaseh  : 0x0
tbase0  : 0x7E16B000
rctrl   : 0x7C0
rstat   : 0x0
rxic: 0x0
rqueue  : 0x800080
rbifx   : 0x0
rqfar   : 0x0
rqfcr   : 0xF666
rqfpr   : 0xBFEBFFBE
mrblr   : 0x600
rbdbph  : 0x0
rbptr0  : 0x7E16B800
rbaseh  : 0x0
rbase0  : 0x7E16B800
maccfg1 : 0x3F
maccfg2 : 0x7205
ipgifg  : 0x40605060
hafdup  : 0xA1F037
maxfrm  : 0x600
miimcfg : 0x7
miimcom : 0x0
miimadd : 0x0
miimcon : 0x0
miimstat: 0x0
miimind : 0x0
ifstat  : 0x0
attr: 0xC0
attreli : 0x0
rmon:
Transmit and Receive 64-byte Frame Counter : 25360
Transmit and Receive 65-127 byte Frame Counter : 12546
Transmit and Receive 128-255 byte Frame Counter: 0
Transmit and Receive 256-511 byte Frame Counter: 0
Transmit and Receive 512-1023 byte Frame Counter   : 0
Transmit and Receive 1024-1518 byte Frame Counter  : 0
Transmit and Receive 1519-1522 byte Good VLAN Frame: 0
Receive Byte Counter   : 2053580
Receive Packet Counter : 25475
Receive FCS Error Counter  : 0
Receive Multicast Packet Counter   : 0
Receive Broadcast Packet Counter   : 4
Receive Control Frame Packet Counter   : 0
Receive Pause Frame Packet Counter : 0
Receive Unknown OP Code Counter: 0
Receive Alignment Error Counter: 0
Receive Frame Length Error Counter : 0
Receive Code Error Counter : 0
Receive Carrier Sense Error Counter: 0
Receive Undersize Packet Counter   : 0
Receive Oversize Packet Counter: 0
Receive Fragments Counter  : 0
Receive Jabber Counter : 0
Receive Drop Counter   : 25449
Transmit Byte Counter Counter  : 795584
Transmit Packet Counter: 12431
Transmit Multicast Packet Counter  : 1
Transmit Broadcast Packet Counter  : 12430
Transmit Pause Control Frame Counter   : 1
Transmit Deferral Packet Counter   : 0
Transmit Excessive Deferral Packet Counter : 0
Transmit Single Collision Packet Counter   : 0
Transmit Multiple Collision Packet Counter : 0
Transmit Late Collision Packet Counter : 0
Transmit Excessive Collision Packet Counter: 0
Transmit Total Collision Counter   : 0
Transmit Drop Frame Counter: 0
Transmit Jabber Frame Counter  : 0
Transmit FCS Error Counter : 0
Transmit Control Frame Counter : 1
Transmit Oversize Frame Counter: 0
Transmit Undersize Frame Counter   : 0
Transmit Fragments Frame Counter   : 0
Carry Register One : 0x0
Carry Register Two : 0x0
Carry Mask Register One: 0xFE03
Carry Mask