Inconsistent fsl_get_sys_freq() implementation

2009-03-31 Thread Wolfgang Grandegger
Hello,

we realized an inconsistent implementation of fsl_get_sys_freq():

http://lxr.linux.no/linux+v2.6.29/arch/powerpc/sysdev/fsl_soc.c#L80

For 826x and 827x boards, the function is available but it cannot be
used because the "bus-frequency" property is not defined for the SOC and
U-Boot also does not try to do a fixup. I think that's a mistake, and
the DTS files and U-Boot should be fixed, right?
Furthermore, I find the name confusing. fsl_get_soc_bus_freq() would be
more appropriate also to distinguish from the frequencies of the CPU.
And why does the MPC52xx use a different name mpc52xx_find_ipb_freq()
for that frequency? It makes support for common hardware like I2C awkward.

Thanks.

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


Re: Inconsistent fsl_get_sys_freq() implementation

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 1:28 AM, Wolfgang Grandegger  
wrote:
>
> Hello,
>
> we realized an inconsistent implementation of fsl_get_sys_freq():
>
> http://lxr.linux.no/linux+v2.6.29/arch/powerpc/sysdev/fsl_soc.c#L80
>
> For 826x and 827x boards, the function is available but it cannot be
> used because the "bus-frequency" property is not defined for the SOC and
> U-Boot also does not try to do a fixup. I think that's a mistake, and
> the DTS files and U-Boot should be fixed, right?
> Furthermore, I find the name confusing. fsl_get_soc_bus_freq() would be
> more appropriate also to distinguish from the frequencies of the CPU.
> And why does the MPC52xx use a different name mpc52xx_find_ipb_freq()
> for that frequency? It makes support for common hardware like I2C awkward.

I haven't looked at fsl_get_soc_bus_freq(), but if the functions are
duplicated, then I've got no problem changing the 52xx support to use
common code.

g.

--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Inconsistent fsl_get_sys_freq() implementation

2009-03-31 Thread Wolfgang Grandegger
Grant Likely wrote:
> On Tue, Mar 31, 2009 at 1:28 AM, Wolfgang Grandegger  
> wrote:
>> Hello,
>>
>> we realized an inconsistent implementation of fsl_get_sys_freq():
>>
>> http://lxr.linux.no/linux+v2.6.29/arch/powerpc/sysdev/fsl_soc.c#L80
>>
>> For 826x and 827x boards, the function is available but it cannot be
>> used because the "bus-frequency" property is not defined for the SOC and
>> U-Boot also does not try to do a fixup. I think that's a mistake, and
>> the DTS files and U-Boot should be fixed, right?
>> Furthermore, I find the name confusing. fsl_get_soc_bus_freq() would be
>> more appropriate also to distinguish from the frequencies of the CPU.
>> And why does the MPC52xx use a different name mpc52xx_find_ipb_freq()
>> for that frequency? It makes support for common hardware like I2C awkward.
> 
> I haven't looked at fsl_get_soc_bus_freq(), but if the functions are
> duplicated, then I've got no problem changing the 52xx support to use
> common code.

The name used for devices using CONFIG_FSL_SOC is fsl_get_sys_freq(),
see the link above. Both functions return the bus frequency of the SOC
but they are implemented differently and allow some variation (which
needs some double-checking).

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


Re: [PATCH] linux-next remove wmb() from ide-dma-sff.c and scc_pata.c

2009-03-31 Thread Geert Uytterhoeven
On Mon, 30 Mar 2009, Grant Grundler wrote:
> Followup to "[PATCH 03/10] ide: destroy DMA mappings after ending DMA"
> email on March 14th:
> http://lkml.org/lkml/2009/3/14/17
> 
> No maintainer is listed for "Toshiba CELL Reference Set IDE" (BLK_DEV_CELLEB)
> or tx4939ide.c in MAINTAINERS. I've CC'd "Ishizaki Kou" @Toshiba (Maintainer 
> for
> "Spidernet Network Driver for CELL") and linuxppc-dev list in the hope
> someone else
> would know or would be able to ACK this patch.

tx49xx is MIPS, for Nemoto-san.

> This patch:
> o replaces "mask" variable in ide_dma_end() with #define.
> o removes use of wmb() in ide-dma-sff.c and scc_pata.c.
> o is not tested - I don't have (or want) the HW.
> 
> I did NOT remove wmb() use in tx4939ide.c. tx4939ide.c __raw_writeb()
> for MMIO transactions. __raw_writeb() does NOT guarantee memory
> transaction ordering.
> 
> tx4939ide also uses mmiowb(). AFAIK, mmiowb() only has an effect on
> SGI IA64 NUMA machines. I'm not going to guess how this driver might work.
> 
> Gmail is broken for sending patches (word wrap). My apologies.
> I've attached the patch: diff-next-remove_wmb_from_ide-01.txt
> 
> Patch is against linux-next tree:
>  git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next
> 
> Signed-off-by: Grant Grundler 

[ attachment converted to inline ]

> diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c
> index 16fc46e..e4cdf78 100644
> --- a/drivers/ide/ide-dma-sff.c
> +++ b/drivers/ide/ide-dma-sff.c
> @@ -277,8 +277,6 @@ void ide_dma_start(ide_drive_t *drive)
>   dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
>   outb(dma_cmd | ATA_DMA_START, hwif->dma_base + ATA_DMA_CMD);
>   }
> -
> - wmb();
>  }
>  EXPORT_SYMBOL_GPL(ide_dma_start);
>  
> @@ -286,7 +284,7 @@ EXPORT_SYMBOL_GPL(ide_dma_start);
>  int ide_dma_end(ide_drive_t *drive)
>  {
>   ide_hwif_t *hwif = drive->hwif;
> - u8 dma_stat = 0, dma_cmd = 0, mask;
> + u8 dma_stat = 0, dma_cmd = 0;
>  
>   /* stop DMA */
>   if (hwif->host_flags & IDE_HFLAG_MMIO) {
> @@ -304,11 +302,10 @@ int ide_dma_end(ide_drive_t *drive)
>   /* clear INTR & ERROR bits */
>   ide_dma_sff_write_status(hwif, dma_stat | ATA_DMA_ERR | ATA_DMA_INTR);
>  
> - wmb();
> +#define CHECK_DMA_MASK (ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR)
>  
>   /* verify good DMA status */
> - mask = ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR;
> - if ((dma_stat & mask) != ATA_DMA_INTR)
> + if ((dma_stat & CHECK_DMA_MASK) != ATA_DMA_INTR)
>   return 0x10 | dma_stat;
>   return 0;
>  }
> diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
> index 97f8e0e..dcbb299 100644
> --- a/drivers/ide/scc_pata.c
> +++ b/drivers/ide/scc_pata.c
> @@ -337,7 +337,6 @@ static void scc_dma_start(ide_drive_t *drive)
>  
>   /* start DMA */
>   scc_ide_outb(dma_cmd | 1, hwif->dma_base);
> - wmb();
>  }
>  
>  static int __scc_dma_end(ide_drive_t *drive)
> @@ -354,7 +353,6 @@ static int __scc_dma_end(ide_drive_t *drive)
>   /* clear the INTR & ERROR bits */
>   scc_ide_outb(dma_stat | 6, hwif->dma_base + 4);
>   /* verify good DMA status */
> - wmb();
>   return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0;
>  }

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:+32 (0)2 700 8453
Fax:  +32 (0)2 700 8622
E-mail:   geert.uytterhoe...@sonycom.com
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] ucc_geth: Rework the TX logic.

2009-03-31 Thread Li Yang
On Tue, Mar 31, 2009 at 1:22 AM, Scott Wood  wrote:
> Joakim Tjernlund wrote:
>>
>> gianfar does not seem to use in_/out_ functions for the BDs. Works just
>> fine that too it seems.
>
> It does now that it has explicit barriers in a few places.  Before they were
> added, it would sometimes fail under load.  That was due to a compiler
> reordering, but CPU reordering was possible as well.

I noticed that in gianfar these memory access is not protected by
"volatile".  Can this be the reason why the compiler did some unwanted
optimization?

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

[PATCH 00/14] Add common OF device tree support for MDIO busses

2009-03-31 Thread Grant Likely
This series adds common code for reading PHY connection data out of
the OpenFirmware device tree.  This simplifies the network drivers
which use the device tree and which currently implement their own
solutions for reading the PHY data out of the device tree directly.

This series was depending on changes in both the netdev and powerpc
-next trees.  Now that both trees have been merged by Linus, I'm
able to post this series in a usable form.

David, as I mentioned below, I'd really like to get the core changes
(1, 4, 5  6) merged into 2.6.30 (assuming Andy confirms they are okay).
Due to dependencies, I think it is easiest if all of them go in via the
same tree.  Are you willing to merge them via yours?  Two of the patches
are outside of drivers/net (patches 1 and 6 touch drivers/of/), but I
personally have no issues if those changes go through you.  I just need
to double check with BenH.

Patches 1, 4, 5 and 6 are the core changes.  They have been tested and
I think they are ready to be merged.  Andy, can you please reply and
confirm that you're okay with these 4?  I'd like to see them go in the
2.6.30 merge window.
[01/14] of: add of_parse_phandle() helper for parsing phandle
[04/14] phylib: rework to prepare for OF registration of PHYs
[05/14] phylib: add *_direct() variants of phy_connect and phy_attach
[06/14] openfirmware: Add OF phylib support code

Patches 2, 3, and 7 (sorry about the funny ordering) are changes to the
fec_mpc52xx driver.  Actually, 2 & 3 are a cleanup and bug fix, but
patch 7 depends on them so I'm including them here.  All three are
tested and working.
[02/14] net/fec_mpc52xx: Migrate to net_device_ops.
[03/14] net/fec_mpc52xx: Don't dereference phy_device if it is NULL
[07/14] net: Rework mpc5200 fec driver to use of_mdio infrastructure.

Patches 8, 9, 10, 12 & 13 are compile tested, but not tested with
hardware.  They are not ready to be merged, and I would like it if
someone with hardware can try them out.  I need to review these ones
again.
[08/14] net: rework fsl_pq_mdio driver to use of_mdio infrastructure
[09/14] net: Rework gianfar driver to use of_mdio infrastructure.
[10/14] net: Rework ucc_geth driver to use of_mdio infrastructure
[12/14] powerpc/82xx: Rework Embedded Planet ep8248e platform to use 
of_mdio
[13/14] net: Rework fs_enet driver to use of_mdio infrastructure

Patch 11 has been tested by Olof Johansson.  It is ready to be merged.
[11/14] net: Rework pasemi_mac driver to use of_mdio infrastructure

Patch 14 is a new Ethernet driver.  It needs review, but it has been
tested with the new of_mdio infrastructure.  It is not ready.
[14/14] net: add Xilinx ll_temac device driver

For those who are interested, I've pushed these changes out to by git
server along with a bug fix patch to fec_52xx.c:

The following changes since commit 15f7176eb1cccec0a332541285ee752b935c1c85:
  Linus Torvalds (1):
Merge git://git.kernel.org/.../davem/net-2.6

are available in the git repository at:

  git://git.secretlab.ca/git/linux-2.6-mpc52xx for-davem

Grant Likely (15):
  net/fec_mpc52xx: fix BUG on missing dma_ops
  of: add of_parse_phandle() helper for parsing phandle properties
  net/fec_mpc52xx: Migrate to net_device_ops.
  net/fec_mpc52xx: Don't dereference phy_device if it is NULL
  phylib: rework to prepare for OF registration of PHYs
  phylib: add *_direct() variants of phy_connect and phy_attach functions
  openfirmware: Add OF phylib support code
  net: Rework mpc5200 fec driver to use of_mdio infrastructure.
  net: rework fsl_pq_mdio driver to use of_mdio infrastructure
  net: Rework gianfar driver to use of_mdio infrastructure.
  net: Rework ucc_geth driver to use of_mdio infrastructure
  net: Rework pasemi_mac driver to use of_mdio infrastructure
  powerpc/82xx: Rework Embedded Planet ep8248e platform to use of_mdio
  net: Rework fs_enet driver to use of_mdio infrastructure
  net: add Xilinx ll_temac device driver

 arch/powerpc/platforms/82xx/ep8248e.c |9 +-
 arch/powerpc/platforms/pasemi/gpio_mdio.c |   32 +-
 drivers/net/Kconfig   |8 +
 drivers/net/Makefile  |2 +
 drivers/net/fec_mpc52xx.c |  256 +++-
 drivers/net/fec_mpc52xx_phy.c |   26 +-
 drivers/net/fs_enet/fs_enet-main.c|   69 +--
 drivers/net/fs_enet/mii-bitbang.c |   29 +-
 drivers/net/fs_enet/mii-fec.c |   26 +-
 drivers/net/fsl_pq_mdio.c |   53 +--
 drivers/net/gianfar.c |  103 ++--
 drivers/net/gianfar.h |3 +-
 drivers/net/pasemi_mac.c  |   28 +-
 drivers/net/pasemi_mac.h  |1 -
 drivers/net/phy/mdio_bus.c|   29 +-
 drivers/net/phy/phy_device.c  |  163 --
 drivers/net/ucc_geth.c 

[PATCH 01/14] of: add of_parse_phandle() helper for parsing phandle properties

2009-03-31 Thread Grant Likely
From: Grant Likely 

of_parse_phandle() is a helper function to read and parse a phandle
property and return a pointer to the resulting device_node.

Signed-off-by: Grant Likely 
CC: Michael Ellerman 
---

 drivers/of/base.c  |   24 
 include/linux/of.h |3 +++
 2 files changed, 27 insertions(+), 0 deletions(-)


diff --git a/drivers/of/base.c b/drivers/of/base.c
index cd17092..104b8c0 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -494,6 +494,30 @@ int of_modalias_node(struct device_node *node, char 
*modalias, int len)
 EXPORT_SYMBOL_GPL(of_modalias_node);
 
 /**
+ * of_parse_phandle - Resolve a phandle property to a device_node pointer
+ * @np: Pointer to device node holding phandle property
+ * @phandle_name: Name of property holding a phandle value
+ * @index: For properties holding a table of phandles, this is the index into
+ * the table
+ *
+ * Returns the device_node pointer with refcount incremented.  Use
+ * of_node_put() on it when done.
+ */
+struct device_node *
+of_parse_phandle(struct device_node *np, const char *phandle_name, int index)
+{
+   const phandle *phandle;
+   int size;
+
+   phandle = of_get_property(np, phandle_name, &size);
+   if ((!phandle) || (size < sizeof(*phandle) * (index + 1)))
+   return NULL;
+
+   return of_find_node_by_phandle(phandle[index]);
+}
+EXPORT_SYMBOL(of_parse_phandle);
+
+/**
  * of_parse_phandles_with_args - Find a node pointed by phandle in a list
  * @np:pointer to a device tree node containing a list
  * @list_name: property name that contains a list
diff --git a/include/linux/of.h b/include/linux/of.h
index 6a7efa2..7be2d10 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -77,6 +77,9 @@ extern int of_n_size_cells(struct device_node *np);
 extern const struct of_device_id *of_match_node(
const struct of_device_id *matches, const struct device_node *node);
 extern int of_modalias_node(struct device_node *node, char *modalias, int len);
+extern struct device_node *of_parse_phandle(struct device_node *np,
+   const char *phandle_name,
+   int index);
 extern int of_parse_phandles_with_args(struct device_node *np,
const char *list_name, const char *cells_name, int index,
struct device_node **out_node, const void **out_args);

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


[PATCH 02/14] net/fec_mpc52xx: Migrate to net_device_ops.

2009-03-31 Thread Grant Likely
From: Grant Likely 

Since not using net_device_ops gets you shunned out the cool crowd,
this patch modifies the fec_mpc52xx Ethernet driver to provide the
management hooks via a struct net_device_ops.

Reported-by: Henk Stegeman 
Signed-off-by: Grant Likely 
---

 drivers/net/fec_mpc52xx.c |   35 +++
 1 files changed, 19 insertions(+), 16 deletions(-)


diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index f99463f..75d0569 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -371,7 +371,7 @@ static int mpc52xx_fec_close(struct net_device *dev)
  * invariant will hold if you make sure that the netif_*_queue()
  * calls are done at the proper times.
  */
-static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, struct net_device 
*dev)
+static int mpc52xx_fec_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
struct bcom_fec_bd *bd;
@@ -379,7 +379,7 @@ static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, 
struct net_device *d
if (bcom_queue_full(priv->tx_dmatsk)) {
if (net_ratelimit())
dev_err(&dev->dev, "transmit queue overrun\n");
-   return 1;
+   return NETDEV_TX_BUSY;
}
 
spin_lock_irq(&priv->lock);
@@ -400,7 +400,7 @@ static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, 
struct net_device *d
 
spin_unlock_irq(&priv->lock);
 
-   return 0;
+   return NETDEV_TX_OK;
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -890,6 +890,21 @@ static int mpc52xx_fec_ioctl(struct net_device *dev, 
struct ifreq *rq, int cmd)
return mpc52xx_fec_phy_mii_ioctl(priv, if_mii(rq), cmd);
 }
 
+static const struct net_device_ops mpc52xx_fec_netdev_ops = {
+   .ndo_open = mpc52xx_fec_open,
+   .ndo_stop = mpc52xx_fec_close,
+   .ndo_start_xmit = mpc52xx_fec_start_xmit,
+   .ndo_set_multicast_list = mpc52xx_fec_set_multicast_list,
+   .ndo_set_mac_address = mpc52xx_fec_set_mac_address,
+   .ndo_validate_addr = eth_validate_addr,
+   .ndo_do_ioctl = mpc52xx_fec_ioctl,
+   .ndo_tx_timeout = mpc52xx_fec_tx_timeout,
+   .ndo_get_stats = mpc52xx_fec_get_stats,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+   .ndo_poll_controller = mpc52xx_fec_poll_controller,
+#endif
+};
+
 /*  */
 /* OF Driver*/
 /*  */
@@ -934,22 +949,10 @@ mpc52xx_fec_probe(struct of_device *op, const struct 
of_device_id *match)
return -EBUSY;
 
/* Init ether ndev with what we have */
-   ndev->open  = mpc52xx_fec_open;
-   ndev->stop  = mpc52xx_fec_close;
-   ndev->hard_start_xmit   = mpc52xx_fec_hard_start_xmit;
-   ndev->do_ioctl  = mpc52xx_fec_ioctl;
+   ndev->netdev_ops= &mpc52xx_fec_netdev_ops;
ndev->ethtool_ops   = &mpc52xx_fec_ethtool_ops;
-   ndev->get_stats = mpc52xx_fec_get_stats;
-   ndev->set_mac_address   = mpc52xx_fec_set_mac_address;
-   ndev->set_multicast_list = mpc52xx_fec_set_multicast_list;
-   ndev->tx_timeout= mpc52xx_fec_tx_timeout;
ndev->watchdog_timeo= FEC_WATCHDOG_TIMEOUT;
ndev->base_addr = mem.start;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-   ndev->poll_controller = mpc52xx_fec_poll_controller;
-#endif
-
-   priv->t_irq = priv->r_irq = ndev->irq = NO_IRQ; /* IRQ are free for now 
*/
 
spin_lock_init(&priv->lock);
 

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


[PATCH 03/14] net/fec_mpc52xx: Don't dereference phy_device if it is NULL

2009-03-31 Thread Grant Likely
From: Grant Likely 

The FEC Ethernet device isn't always attached to a phy.  Be careful
not to dereference phy_device if it is NULL.

Reported-by: Henk Stegeman 
Signed-off-by: Grant Likely 
---

 drivers/net/fec_mpc52xx.c |   22 --
 1 files changed, 12 insertions(+), 10 deletions(-)


diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 75d0569..e10eb2c 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -271,15 +271,6 @@ static void mpc52xx_fec_phy_stop(struct net_device *dev)
phy_write(priv->phydev, MII_BMCR, BMCR_PDOWN);
 }
 
-static int mpc52xx_fec_phy_mii_ioctl(struct mpc52xx_fec_priv *priv,
-   struct mii_ioctl_data *mii_data, int cmd)
-{
-   if (!priv->phydev)
-   return -ENOTSUPP;
-
-   return phy_mii_ioctl(priv->phydev, mii_data, cmd);
-}
-
 static void mpc52xx_fec_phy_hw_init(struct mpc52xx_fec_priv *priv)
 {
struct mpc52xx_fec __iomem *fec = priv->fec;
@@ -852,12 +843,20 @@ static void mpc52xx_fec_get_drvinfo(struct net_device 
*dev,
 static int mpc52xx_fec_get_settings(struct net_device *dev, struct ethtool_cmd 
*cmd)
 {
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
+
+   if (!priv->phydev)
+   return -ENODEV;
+
return phy_ethtool_gset(priv->phydev, cmd);
 }
 
 static int mpc52xx_fec_set_settings(struct net_device *dev, struct ethtool_cmd 
*cmd)
 {
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
+
+   if (!priv->phydev)
+   return -ENODEV;
+
return phy_ethtool_sset(priv->phydev, cmd);
 }
 
@@ -887,7 +886,10 @@ static int mpc52xx_fec_ioctl(struct net_device *dev, 
struct ifreq *rq, int cmd)
 {
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
 
-   return mpc52xx_fec_phy_mii_ioctl(priv, if_mii(rq), cmd);
+   if (!priv->phydev)
+   return -ENOTSUPP;
+
+   return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
 }
 
 static const struct net_device_ops mpc52xx_fec_netdev_ops = {

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


[PATCH 04/14] phylib: rework to prepare for OF registration of PHYs

2009-03-31 Thread Grant Likely
From: Grant Likely 

This patch makes changes in preparation for supporting open firmware
device tree descriptions of MDIO busses.  Changes include:
- Cleanup handling of phy_map[] entries; they are already NULLed when
  registering and so don't need to be re-cleared, and it is good practice
  to clear them out when unregistering.
- Split phy_device registration out into a new function so that the
  OF helpers can do two stage registration (separate allocation and
  registration steps).

Signed-off-by: Grant Likely 
CC: linuxppc-dev@ozlabs.org
CC: net...@vger.kernel.org
CC: Andy Fleming 
---

 drivers/net/phy/mdio_bus.c   |   29 +++
 drivers/net/phy/phy_device.c |   45 ++
 include/linux/phy.h  |1 +
 3 files changed, 45 insertions(+), 30 deletions(-)


diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index b754020..bd4e8d7 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -113,7 +113,6 @@ int mdiobus_register(struct mii_bus *bus)
bus->reset(bus);
 
for (i = 0; i < PHY_MAX_ADDR; i++) {
-   bus->phy_map[i] = NULL;
if ((bus->phy_mask & (1 << i)) == 0) {
struct phy_device *phydev;
 
@@ -150,6 +149,7 @@ void mdiobus_unregister(struct mii_bus *bus)
for (i = 0; i < PHY_MAX_ADDR; i++) {
if (bus->phy_map[i])
device_unregister(&bus->phy_map[i]->dev);
+   bus->phy_map[i] = NULL;
}
 }
 EXPORT_SYMBOL(mdiobus_unregister);
@@ -188,35 +188,12 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int 
addr)
if (IS_ERR(phydev) || phydev == NULL)
return phydev;
 
-   /* There's a PHY at this address
-* We need to set:
-* 1) IRQ
-* 2) bus_id
-* 3) parent
-* 4) bus
-* 5) mii_bus
-* And, we need to register it */
-
-   phydev->irq = bus->irq != NULL ? bus->irq[addr] : PHY_POLL;
-
-   phydev->dev.parent = bus->parent;
-   phydev->dev.bus = &mdio_bus_type;
-   dev_set_name(&phydev->dev, PHY_ID_FMT, bus->id, addr);
-
-   phydev->bus = bus;
-
-   /* Run all of the fixups for this PHY */
-   phy_scan_fixups(phydev);
-
-   err = device_register(&phydev->dev);
+   err = phy_device_register(phydev);
if (err) {
-   printk(KERN_ERR "phy %d failed to register\n", addr);
phy_device_free(phydev);
-   phydev = NULL;
+   return NULL;
}
 
-   bus->phy_map[addr] = phydev;
-
return phydev;
 }
 EXPORT_SYMBOL(mdiobus_scan);
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 0a06e4f..9352ca8 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -39,20 +39,21 @@ MODULE_DESCRIPTION("PHY library");
 MODULE_AUTHOR("Andy Fleming");
 MODULE_LICENSE("GPL");
 
-static struct phy_driver genphy_driver;
-extern int mdio_bus_init(void);
-extern void mdio_bus_exit(void);
-
 void phy_device_free(struct phy_device *phydev)
 {
kfree(phydev);
 }
+EXPORT_SYMBOL(phy_device_free);
 
 static void phy_device_release(struct device *dev)
 {
phy_device_free(to_phy_device(dev));
 }
 
+static struct phy_driver genphy_driver;
+extern int mdio_bus_init(void);
+extern void mdio_bus_exit(void);
+
 static LIST_HEAD(phy_fixup_list);
 static DEFINE_MUTEX(phy_fixup_lock);
 
@@ -166,6 +167,10 @@ struct phy_device* phy_device_create(struct mii_bus *bus, 
int addr, int phy_id)
dev->addr = addr;
dev->phy_id = phy_id;
dev->bus = bus;
+   dev->dev.parent = bus->parent;
+   dev->dev.bus = &mdio_bus_type;
+   dev->irq = bus->irq != NULL ? bus->irq[addr] : PHY_POLL;
+   dev_set_name(&dev->dev, PHY_ID_FMT, bus->id, addr);
 
dev->state = PHY_DOWN;
 
@@ -235,6 +240,38 @@ struct phy_device * get_phy_device(struct mii_bus *bus, 
int addr)
 
return dev;
 }
+EXPORT_SYMBOL(get_phy_device);
+
+/**
+ * phy_device_register - Register the phy device on the MDIO bus
+ * @phy_device: phy_device structure to be added to the MDIO bus
+ */
+int phy_device_register(struct phy_device *phydev)
+{
+   int err;
+
+   /* Don't register a phy if one is already registered at this
+* address */
+   if (phydev->bus->phy_map[phydev->addr])
+   return -EINVAL;
+   phydev->bus->phy_map[phydev->addr] = phydev;
+
+   /* Run all of the fixups for this PHY */
+   phy_scan_fixups(phydev);
+
+   err = device_register(&phydev->dev);
+   if (err) {
+   pr_err("phy %d failed to register\n", phydev->addr);
+   goto out;
+   }
+
+   return 0;
+
+ out:
+   phydev->bus->phy_map[phydev->addr] = NULL;
+   return err;
+}
+EXPORT_SYMBOL(phy_device_register);
 
 /**
  * phy_prepare_link - prepares the PHY layer to monitor link status
diff --git a/include/linux/phy.h 

[PATCH 05/14] phylib: add *_direct() variants of phy_connect and phy_attach functions

2009-03-31 Thread Grant Likely
From: Grant Likely 

Add phy_connect_direct() and phy_attach_direct() functions so that
drivers can use a pointer to the phy_device instead of trying to determine
the phy's bus_id string.

This patch is useful for OF device tree descriptions of phy devices where
the driver doesn't need or know what the bus_id value in order to get a
phy_device pointer.

Signed-off-by: Grant Likely 
---

 drivers/net/phy/phy_device.c |  118 ++
 include/linux/phy.h  |5 ++
 2 files changed, 90 insertions(+), 33 deletions(-)


diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 9352ca8..3c8c1de 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -292,6 +292,33 @@ void phy_prepare_link(struct phy_device *phydev,
 }
 
 /**
+ * phy_connect_direct - connect an ethernet device to a specific phy_device
+ * @dev: the network device to connect
+ * @phydev: the pointer to the phy device
+ * @handler: callback function for state change notifications
+ * @flags: PHY device's dev_flags
+ * @interface: PHY device's interface
+ */
+int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
+  void (*handler)(struct net_device *), u32 flags,
+  phy_interface_t interface)
+{
+   int rc;
+
+   rc = phy_attach_direct(dev, phydev, flags, interface);
+   if (rc)
+   return rc;
+
+   phy_prepare_link(phydev, handler);
+   phy_start_machine(phydev, NULL);
+   if (phydev->irq > 0)
+   phy_start_interrupts(phydev);
+
+   return 0;
+}
+EXPORT_SYMBOL(phy_connect_direct);
+
+/**
  * phy_connect - connect an ethernet device to a PHY device
  * @dev: the network device to connect
  * @bus_id: the id string of the PHY device to connect
@@ -312,18 +339,21 @@ struct phy_device * phy_connect(struct net_device *dev, 
const char *bus_id,
phy_interface_t interface)
 {
struct phy_device *phydev;
+   struct device *d;
+   int rc;
 
-   phydev = phy_attach(dev, bus_id, flags, interface);
-
-   if (IS_ERR(phydev))
-   return phydev;
-
-   phy_prepare_link(phydev, handler);
-
-   phy_start_machine(phydev, NULL);
+   /* Search the list of PHY devices on the mdio bus for the
+* PHY with the requested name */
+   d = bus_find_device_by_name(&mdio_bus_type, NULL, bus_id);
+   if (!d) {
+   pr_err("PHY %s not found\n", bus_id);
+   return ERR_PTR(-ENODEV);
+   }
+   phydev = to_phy_device(d);
 
-   if (phydev->irq > 0)
-   phy_start_interrupts(phydev);
+   rc = phy_attach_direct(dev, phydev, flags, interface);
+   if (rc)
+   return ERR_PTR(rc);
 
return phydev;
 }
@@ -347,9 +377,9 @@ void phy_disconnect(struct phy_device *phydev)
 EXPORT_SYMBOL(phy_disconnect);
 
 /**
- * phy_attach - attach a network device to a particular PHY device
+ * phy_attach_direct - attach a network device to a given PHY device pointer
  * @dev: network device to attach
- * @bus_id: PHY device to attach
+ * @phydev: Pointer to phy_device to attach
  * @flags: PHY device's dev_flags
  * @interface: PHY device's interface
  *
@@ -360,22 +390,10 @@ EXPORT_SYMBOL(phy_disconnect);
  * the attaching device, and given a callback for link status
  * change.  The phy_device is returned to the attaching driver.
  */
-struct phy_device *phy_attach(struct net_device *dev,
-   const char *bus_id, u32 flags, phy_interface_t interface)
+int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
+ u32 flags, phy_interface_t interface)
 {
-   struct bus_type *bus = &mdio_bus_type;
-   struct phy_device *phydev;
-   struct device *d;
-
-   /* Search the list of PHY devices on the mdio bus for the
-* PHY with the requested name */
-   d = bus_find_device_by_name(bus, NULL, bus_id);
-   if (d) {
-   phydev = to_phy_device(d);
-   } else {
-   printk(KERN_ERR "%s not found\n", bus_id);
-   return ERR_PTR(-ENODEV);
-   }
+   struct device *d = &phydev->dev;
 
/* Assume that if there is no driver, that it doesn't
 * exist, and we should use the genphy driver. */
@@ -388,13 +406,12 @@ struct phy_device *phy_attach(struct net_device *dev,
err = device_bind_driver(d);
 
if (err)
-   return ERR_PTR(err);
+   return err;
}
 
if (phydev->attached_dev) {
-   printk(KERN_ERR "%s: %s already attached\n",
-   dev->name, bus_id);
-   return ERR_PTR(-EBUSY);
+   dev_err(&dev->dev, "PHY already attached\n");
+   return -EBUSY;
}
 
phydev->attached_dev = dev;
@@ -412,13 +429,48 @@ struct phy_device *phy_attach(struct net_device *dev,
   

[PATCH 06/14] openfirmware: Add OF phylib support code

2009-03-31 Thread Grant Likely
From: Grant Likely 

Add support for parsing the device tree for PHY devices on an MDIO bus

CC: Andy Fleming 
CC: linuxppc-dev@ozlabs.org
CC: devtree-disc...@ozlabs.org

Signed-off-by: Grant Likely 
---

 drivers/of/Kconfig  |6 ++
 drivers/of/Makefile |1 
 drivers/of/of_mdio.c|  139 +++
 include/linux/of_mdio.h |   22 +++
 4 files changed, 168 insertions(+), 0 deletions(-)
 create mode 100644 drivers/of/of_mdio.c
 create mode 100644 include/linux/of_mdio.h


diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index f821dbc..6fe043b 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -19,3 +19,9 @@ config OF_SPI
depends on OF && PPC_OF && SPI
help
  OpenFirmware SPI accessors
+
+config OF_MDIO
+   def_tristate PHYLIB
+   depends on OF && PHYLIB
+   help
+ OpenFirmware MDIO bus (Ethernet PHY) accessors
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index 4c3c6f8..bdfb5f5 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -3,3 +3,4 @@ obj-$(CONFIG_OF_DEVICE) += device.o platform.o
 obj-$(CONFIG_OF_GPIO)   += gpio.o
 obj-$(CONFIG_OF_I2C)   += of_i2c.o
 obj-$(CONFIG_OF_SPI)   += of_spi.o
+obj-$(CONFIG_OF_MDIO)  += of_mdio.o
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
new file mode 100644
index 000..aee967d
--- /dev/null
+++ b/drivers/of/of_mdio.c
@@ -0,0 +1,139 @@
+/*
+ * OF helpers for the MDIO (Ethernet PHY) API
+ *
+ * Copyright (c) 2009 Secret Lab Technologies, Ltd.
+ *
+ * This file is released under the GPLv2
+ *
+ * This file provides helper functions for extracting PHY device information
+ * out of the OpenFirmware device tree and using it to populate an mii_bus.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+MODULE_AUTHOR("Grant Likely ");
+MODULE_LICENSE("GPL");
+
+/**
+ * of_mdiobus_register - Register mii_bus and create PHYs from the device tree
+ * @mdio: pointer to mii_bus structure
+ * @np: pointer to device_node of MDIO bus.
+ *
+ * This function registers the mii_bus structure and registers a phy_device
+ * for each child node of @np.
+ */
+int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
+{
+   struct phy_device *phy;
+   struct device_node *child;
+   int rc, i;
+
+   /* Mask out all PHYs from auto probing.  Instead the PHYs listed in
+* the device tree are populated after the bus has been registered */
+   mdio->phy_mask = ~0;
+
+   /* Clear all the IRQ properties */
+   if (mdio->irq)
+   for (i=0; iirq[i] = PHY_POLL;
+
+   /* Register the MDIO bus */
+   rc = mdiobus_register(mdio);
+   if (rc)
+   return rc;
+
+   /* Loop over the child nodes and register a phy_device for each one */
+   for_each_child_of_node(np, child) {
+   const u32 *addr;
+   int len;
+
+   /* A PHY must have a reg property in the range [0-31] */
+   addr = of_get_property(child, "reg", &len);
+   if (!addr || len < sizeof(*addr) || *addr >= 32 || *addr < 0) {
+   dev_err(&mdio->dev, "%s has invalid PHY address\n",
+   child->full_name);
+   continue;
+   }
+
+   if (mdio->irq) {
+   mdio->irq[*addr] = irq_of_parse_and_map(child, 0);
+   if (!mdio->irq[*addr])
+   mdio->irq[*addr] = PHY_POLL;
+   }
+
+   phy = get_phy_device(mdio, *addr);
+   if (!phy) {
+   dev_err(&mdio->dev, "error probing PHY at address %i\n",
+   *addr);
+   continue;
+   }
+   phy_scan_fixups(phy);
+
+   /* Associate the OF node with the device structure so it
+* can be looked up later */
+   of_node_get(child);
+   dev_archdata_set_node(&phy->dev.archdata, child);
+
+   /* All data is now stored in the phy struct; register it */
+   rc = phy_device_register(phy);
+   if (rc) {
+   phy_device_free(phy);
+   of_node_put(child);
+   continue;
+   }
+
+   dev_dbg(&mdio->dev, "registered phy %s at address %i\n",
+   child->name, *addr);
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(of_mdiobus_register);
+
+/**
+ * of_phy_find_device - Give a PHY node, find the phy_device
+ * @phy_np: Pointer to the phy's device tree node
+ *
+ * Returns a pointer to the phy_device.
+ */
+struct phy_device *of_phy_find_device(struct device_node *phy_np)
+{
+   struct device *d;
+   int match(struct device *dev, void *phy_np)
+   {
+   return dev_archdata_get_node(&dev->archdata) == phy_np;
+   }
+
+   if (!phy_np)
+   return NULL;

[PATCH 07/14] net: Rework mpc5200 fec driver to use of_mdio infrastructure.

2009-03-31 Thread Grant Likely
From: Grant Likely 

The patch reworks the MPC5200 Fast Ethernet Controller (FEC) driver to
use the of_mdio infrastructure for registering PHY devices from data out
openfirmware device tree, and eliminates the assumption that the PHY
for the FEC is always attached to the FEC's own MDIO bus.  With this
patch, the FEC can use a PHY attached to any MDIO bus if it is described
in the device tree.

Signed-off-by: Grant Likely 
---

 drivers/net/fec_mpc52xx.c |  180 -
 drivers/net/fec_mpc52xx_phy.c |   26 +-
 2 files changed, 59 insertions(+), 147 deletions(-)


diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index e10eb2c..0ebd4ec 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -43,11 +44,9 @@
 
 #define DRIVER_NAME "mpc52xx-fec"
 
-#define FEC5200_PHYADDR_NONE   (-1)
-#define FEC5200_PHYADDR_7WIRE  (-2)
-
 /* Private driver data structure */
 struct mpc52xx_fec_priv {
+   struct net_device *ndev;
int duplex;
int speed;
int r_irq;
@@ -59,10 +58,11 @@ struct mpc52xx_fec_priv {
int msg_enable;
 
/* MDIO link details */
-   int phy_addr;
-   unsigned int phy_speed;
+   unsigned int mdio_speed;
+   struct device_node *phy_node;
struct phy_device *phydev;
enum phy_state link;
+   int seven_wire_mode;
 };
 
 
@@ -211,85 +211,25 @@ static void mpc52xx_fec_adjust_link(struct net_device 
*dev)
phy_print_status(phydev);
 }
 
-static int mpc52xx_fec_init_phy(struct net_device *dev)
-{
-   struct mpc52xx_fec_priv *priv = netdev_priv(dev);
-   struct phy_device *phydev;
-   char phy_id[BUS_ID_SIZE];
-
-   snprintf(phy_id, sizeof(phy_id), "%x:%02x",
-   (unsigned int)dev->base_addr, priv->phy_addr);
-
-   priv->link = PHY_DOWN;
-   priv->speed = 0;
-   priv->duplex = -1;
-
-   phydev = phy_connect(dev, phy_id, &mpc52xx_fec_adjust_link, 0, 
PHY_INTERFACE_MODE_MII);
-   if (IS_ERR(phydev)) {
-   dev_err(&dev->dev, "phy_connect failed\n");
-   return PTR_ERR(phydev);
-   }
-   dev_info(&dev->dev, "attached phy %i to driver %s\n",
-   phydev->addr, phydev->drv->name);
-
-   priv->phydev = phydev;
-
-   return 0;
-}
-
-static int mpc52xx_fec_phy_start(struct net_device *dev)
-{
-   struct mpc52xx_fec_priv *priv = netdev_priv(dev);
-   int err;
-
-   if (priv->phy_addr < 0)
-   return 0;
-
-   err = mpc52xx_fec_init_phy(dev);
-   if (err) {
-   dev_err(&dev->dev, "mpc52xx_fec_init_phy failed\n");
-   return err;
-   }
-
-   /* reset phy - this also wakes it from PDOWN */
-   phy_write(priv->phydev, MII_BMCR, BMCR_RESET);
-   phy_start(priv->phydev);
-
-   return 0;
-}
-
-static void mpc52xx_fec_phy_stop(struct net_device *dev)
-{
-   struct mpc52xx_fec_priv *priv = netdev_priv(dev);
-
-   if (!priv->phydev)
-   return;
-
-   phy_disconnect(priv->phydev);
-   /* power down phy */
-   phy_stop(priv->phydev);
-   phy_write(priv->phydev, MII_BMCR, BMCR_PDOWN);
-}
-
-static void mpc52xx_fec_phy_hw_init(struct mpc52xx_fec_priv *priv)
-{
-   struct mpc52xx_fec __iomem *fec = priv->fec;
-
-   if (priv->phydev)
-   return;
-
-   out_be32(&fec->mii_speed, priv->phy_speed);
-}
-
 static int mpc52xx_fec_open(struct net_device *dev)
 {
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
int err = -EBUSY;
 
+   if (priv->phy_node) {
+   priv->phydev = of_phy_connect(priv->ndev, priv->phy_node,
+ mpc52xx_fec_adjust_link, 0, 0);
+   if (!priv->phydev) {
+   dev_err(&dev->dev, "of_phy_connect failed\n");
+   return -ENODEV;
+   }
+   phy_start(priv->phydev);
+   }
+
if (request_irq(dev->irq, &mpc52xx_fec_interrupt, IRQF_SHARED,
DRIVER_NAME "_ctrl", dev)) {
dev_err(&dev->dev, "ctrl interrupt request failed\n");
-   goto out;
+   goto free_phy;
}
if (request_irq(priv->r_irq, &mpc52xx_fec_rx_interrupt, 0,
DRIVER_NAME "_rx", dev)) {
@@ -311,10 +251,6 @@ static int mpc52xx_fec_open(struct net_device *dev)
goto free_irqs;
}
 
-   err = mpc52xx_fec_phy_start(dev);
-   if (err)
-   goto free_skbs;
-
bcom_enable(priv->rx_dmatsk);
bcom_enable(priv->tx_dmatsk);
 
@@ -324,16 +260,18 @@ static int mpc52xx_fec_open(struct net_device *dev)
 
return 0;
 
- free_skbs:
-   mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk);
-
  free_irqs:
free_irq(priv->t_irq, dev);
  free_2irqs:
free_irq(priv->r_irq, 

[PATCH 08/14] net: rework fsl_pq_mdio driver to use of_mdio infrastructure

2009-03-31 Thread Grant Likely
From: Grant Likely 

This patch simplifies the driver by making use of more common code.

Signed-off-by: Grant Likely 
---

 drivers/net/fsl_pq_mdio.c |   53 +++--
 1 files changed, 4 insertions(+), 49 deletions(-)


diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index b3079a5..83a98f4 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -154,44 +155,6 @@ static int fsl_pq_mdio_reset(struct mii_bus *bus)
return 0;
 }
 
-/* Allocate an array which provides irq #s for each PHY on the given bus */
-static int *create_irq_map(struct device_node *np)
-{
-   int *irqs;
-   int i;
-   struct device_node *child = NULL;
-
-   irqs = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
-
-   if (!irqs)
-   return NULL;
-
-   for (i = 0; i < PHY_MAX_ADDR; i++)
-   irqs[i] = PHY_POLL;
-
-   while ((child = of_get_next_child(np, child)) != NULL) {
-   int irq = irq_of_parse_and_map(child, 0);
-   const u32 *id;
-
-   if (irq == NO_IRQ)
-   continue;
-
-   id = of_get_property(child, "reg", NULL);
-
-   if (!id)
-   continue;
-
-   if (*id < PHY_MAX_ADDR && *id >= 0)
-   irqs[*id] = irq;
-   else
-   printk(KERN_WARNING "%s: "
-   "%d is not a valid PHY address\n",
-   np->full_name, *id);
-   }
-
-   return irqs;
-}
-
 void fsl_pq_mdio_bus_name(char *name, struct device_node *np)
 {
const u32 *addr;
@@ -314,7 +277,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
 
new_bus->priv = (void __force *)regs;
 
-   new_bus->irq = create_irq_map(np);
+   new_bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
 
if (NULL == new_bus->irq) {
err = -ENOMEM;
@@ -383,16 +346,8 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
 
out_be32(tbipa, tbiaddr);
 
-   /*
-* The TBIPHY-only buses will find PHYs at every address,
-* so we mask them all but the TBI
-*/
-   if (!of_device_is_compatible(np, "fsl,gianfar-mdio"))
-   new_bus->phy_mask = ~(1 << tbiaddr);
-
-   err = mdiobus_register(new_bus);
-
-   if (err) {
+   err = of_mdiobus_register(new_bus, np);
+   if (err != 0) {
printk (KERN_ERR "%s: Cannot register as MDIO bus\n",
new_bus->name);
goto err_free_irqs;

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


[PATCH 09/14] net: Rework gianfar driver to use of_mdio infrastructure.

2009-03-31 Thread Grant Likely
From: Grant Likely 

This patch simplifies the driver by making use of more common code.

Signed-off-by: Grant Likely 
---

 drivers/net/gianfar.c |  103 ++---
 drivers/net/gianfar.h |3 +
 2 files changed, 40 insertions(+), 66 deletions(-)


diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 65f5587..c22eba9 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -75,6 +75,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -168,17 +169,13 @@ static inline int gfar_uses_fcb(struct gfar_private *priv)
 
 static int gfar_of_init(struct net_device *dev)
 {
-   struct device_node *phy, *mdio;
-   const unsigned int *id;
const char *model;
const char *ctype;
const void *mac_addr;
-   const phandle *ph;
u64 addr, size;
int err = 0;
struct gfar_private *priv = netdev_priv(dev);
struct device_node *np = priv->node;
-   char bus_name[MII_BUS_ID_SIZE];
const u32 *stash;
const u32 *stash_len;
const u32 *stash_idx;
@@ -264,8 +261,8 @@ static int gfar_of_init(struct net_device *dev)
if (of_get_property(np, "fsl,magic-packet", NULL))
priv->device_flags |= FSL_GIANFAR_DEV_HAS_MAGIC_PACKET;
 
-   ph = of_get_property(np, "phy-handle", NULL);
-   if (ph == NULL) {
+   priv->phy_node = of_parse_phandle(np, "phy-device", 0);
+   if (!priv->phy_node) {
u32 *fixed_link;
 
fixed_link = (u32 *)of_get_property(np, "fixed-link", NULL);
@@ -273,57 +270,10 @@ static int gfar_of_init(struct net_device *dev)
err = -ENODEV;
goto err_out;
}
-
-   snprintf(priv->phy_bus_id, sizeof(priv->phy_bus_id),
-   PHY_ID_FMT, "0", fixed_link[0]);
-   } else {
-   phy = of_find_node_by_phandle(*ph);
-
-   if (phy == NULL) {
-   err = -ENODEV;
-   goto err_out;
-   }
-
-   mdio = of_get_parent(phy);
-
-   id = of_get_property(phy, "reg", NULL);
-
-   of_node_put(phy);
-
-   fsl_pq_mdio_bus_name(bus_name, mdio);
-   of_node_put(mdio);
-   snprintf(priv->phy_bus_id, sizeof(priv->phy_bus_id), "%s:%02x",
-   bus_name, *id);
}
 
/* Find the TBI PHY.  If it's not there, we don't support SGMII */
-   ph = of_get_property(np, "tbi-handle", NULL);
-   if (ph) {
-   struct device_node *tbi = of_find_node_by_phandle(*ph);
-   struct of_device *ofdev;
-   struct mii_bus *bus;
-
-   if (!tbi)
-   return 0;
-
-   mdio = of_get_parent(tbi);
-   if (!mdio)
-   return 0;
-
-   ofdev = of_find_device_by_node(mdio);
-
-   of_node_put(mdio);
-
-   id = of_get_property(tbi, "reg", NULL);
-   if (!id)
-   return 0;
-
-   of_node_put(tbi);
-
-   bus = dev_get_drvdata(&ofdev->dev);
-
-   priv->tbiphy = bus->phy_map[*id];
-   }
+   priv->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
 
return 0;
 
@@ -529,6 +479,10 @@ static int gfar_probe(struct of_device *ofdev,
 register_fail:
iounmap(priv->regs);
 regs_fail:
+   if (priv->phy_node)
+   of_node_put(priv->phy_node);
+   if (priv->tbi_node)
+   of_node_put(priv->tbi_node);
free_netdev(dev);
return err;
 }
@@ -537,6 +491,11 @@ static int gfar_remove(struct of_device *ofdev)
 {
struct gfar_private *priv = dev_get_drvdata(&ofdev->dev);
 
+   if (priv->phy_node)
+   of_node_put(priv->phy_node);
+   if (priv->tbi_node)
+   of_node_put(priv->tbi_node);
+
dev_set_drvdata(&ofdev->dev, NULL);
 
iounmap(priv->regs);
@@ -690,7 +649,6 @@ static int init_phy(struct net_device *dev)
uint gigabit_support =
priv->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT ?
SUPPORTED_1000baseT_Full : 0;
-   struct phy_device *phydev;
phy_interface_t interface;
 
priv->oldlink = 0;
@@ -699,23 +657,38 @@ static int init_phy(struct net_device *dev)
 
interface = gfar_get_interface(dev);
 
-   phydev = phy_connect(dev, priv->phy_bus_id, &adjust_link, 0, interface);
+   if (priv->phy_node) {
+   priv->phydev = of_phy_connect(dev, priv->phy_node, &adjust_link,
+ 0, interface);
+   if (!priv->phydev) {
+   dev_err(&dev->dev, "error: Could not attach to PHY\n");
+   return -ENODEV;
+   }
+   }
+
+   if (priv->tbi_node) {
+   priv->tbiphy = of

[PATCH 10/14] net: Rework ucc_geth driver to use of_mdio infrastructure

2009-03-31 Thread Grant Likely
From: Grant Likely 

This patch simplifies the driver by making use of more common code.

Signed-off-by: Grant Likely 
---

 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 933fcfb..471a30a 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1543,12 +1544,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 |
@@ -3520,14 +3523,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;
@@ -3627,45 +3628,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;
} 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;
+
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 e3a25e6..77e01de 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -1101,7 +1101,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


[PATCH 11/14] net: Rework pasemi_mac driver to use of_mdio infrastructure

2009-03-31 Thread Grant Likely
From: Grant Likely 

This patch simplifies the driver by making use of more common code.

Tested-by: Olof Johansson 
Acked-by: Olof Johansson 
Signed-off-by: Grant Likely 
---

 arch/powerpc/platforms/pasemi/gpio_mdio.c |   32 +
 drivers/net/pasemi_mac.c  |   28 -
 drivers/net/pasemi_mac.h  |1 -
 3 files changed, 9 insertions(+), 52 deletions(-)


diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c 
b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index 75cc165..3bf5467 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -29,7 +29,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #define DELAY 1
@@ -39,6 +39,7 @@ static void __iomem *gpio_regs;
 struct gpio_priv {
int mdc_pin;
int mdio_pin;
+   int mdio_irqs[PHY_MAX_ADDR];
 };
 
 #define MDC_PIN(bus)   (((struct gpio_priv *)bus->priv)->mdc_pin)
@@ -218,12 +219,11 @@ static int __devinit gpio_mdio_probe(struct of_device 
*ofdev,
 const struct of_device_id *match)
 {
struct device *dev = &ofdev->dev;
-   struct device_node *phy_dn, *np = ofdev->node;
+   struct device_node *np = ofdev->node;
struct mii_bus *new_bus;
struct gpio_priv *priv;
const unsigned int *prop;
int err;
-   int i;
 
err = -ENOMEM;
priv = kzalloc(sizeof(struct gpio_priv), GFP_KERNEL);
@@ -244,27 +244,7 @@ static int __devinit gpio_mdio_probe(struct of_device 
*ofdev,
snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", *prop);
new_bus->priv = priv;
 
-   new_bus->phy_mask = 0;
-
-   new_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
-
-   if (!new_bus->irq)
-   goto out_free_bus;
-
-   for (i = 0; i < PHY_MAX_ADDR; i++)
-   new_bus->irq[i] = NO_IRQ;
-
-   for (phy_dn = of_get_next_child(np, NULL);
-phy_dn != NULL;
-phy_dn = of_get_next_child(np, phy_dn)) {
-   const unsigned int *ip, *regp;
-
-   ip = of_get_property(phy_dn, "interrupts", NULL);
-   regp = of_get_property(phy_dn, "reg", NULL);
-   if (!ip || !regp || *regp >= PHY_MAX_ADDR)
-   continue;
-   new_bus->irq[*regp] = irq_create_mapping(NULL, *ip);
-   }
+   new_bus->irq = priv->mdio_irqs;
 
prop = of_get_property(np, "mdc-pin", NULL);
priv->mdc_pin = *prop;
@@ -275,7 +255,7 @@ static int __devinit gpio_mdio_probe(struct of_device 
*ofdev,
new_bus->parent = dev;
dev_set_drvdata(dev, new_bus);
 
-   err = mdiobus_register(new_bus);
+   err = of_mdiobus_register(new_bus, np);
 
if (err != 0) {
printk(KERN_ERR "%s: Cannot register as MDIO bus, err %d\n",
@@ -286,8 +266,6 @@ static int __devinit gpio_mdio_probe(struct of_device 
*ofdev,
return 0;
 
 out_free_irq:
-   kfree(new_bus->irq);
-out_free_bus:
kfree(new_bus);
 out_free_priv:
kfree(priv);
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 5eeb5a8..2edbba3 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1086,34 +1087,17 @@ static int pasemi_mac_phy_init(struct net_device *dev)
struct pasemi_mac *mac = netdev_priv(dev);
struct device_node *dn, *phy_dn;
struct phy_device *phydev;
-   unsigned int phy_id;
-   const phandle *ph;
-   const unsigned int *prop;
-   struct resource r;
-   int ret;
 
dn = pci_device_to_OF_node(mac->pdev);
-   ph = of_get_property(dn, "phy-handle", NULL);
-   if (!ph)
-   return -ENODEV;
-   phy_dn = of_find_node_by_phandle(*ph);
-
-   prop = of_get_property(phy_dn, "reg", NULL);
-   ret = of_address_to_resource(phy_dn->parent, 0, &r);
-   if (ret)
-   goto err;
-
-   phy_id = *prop;
-   snprintf(mac->phy_id, sizeof(mac->phy_id), "%x:%02x",
-(int)r.start, phy_id);
-
+   phy_dn = of_parse_phandle(dn, "phy-handle", 0);
of_node_put(phy_dn);
 
mac->link = 0;
mac->speed = 0;
mac->duplex = -1;
 
-   phydev = phy_connect(dev, mac->phy_id, &pasemi_adjust_link, 0, 
PHY_INTERFACE_MODE_SGMII);
+   phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0,
+   PHY_INTERFACE_MODE_SGMII);
 
if (IS_ERR(phydev)) {
printk(KERN_ERR "%s: Could not attach to phy\n", dev->name);
@@ -1123,10 +1107,6 @@ static int pasemi_mac_phy_init(struct net_device *dev)
mac->phydev = phydev;
 
return 0;
-
-err:
-   of_node_put(phy_dn);
-   return -ENODEV;
 }
 
 
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h
index 1a115ec..e2f4efa 100644
--- a/dr

[PATCH 12/14] powerpc/82xx: Rework Embedded Planet ep8248e platform to use of_mdio

2009-03-31 Thread Grant Likely
From: Grant Likely 

This patch modifies the bitbanged MDIO driver in the ep8248e platform
code to use the common of_mdio infrastructure.

Signed-off-by: Grant Likely 
---

 arch/powerpc/platforms/82xx/ep8248e.c |9 +++--
 1 files changed, 3 insertions(+), 6 deletions(-)


diff --git a/arch/powerpc/platforms/82xx/ep8248e.c 
b/arch/powerpc/platforms/82xx/ep8248e.c
index 0eb6d7f..51fcae4 100644
--- a/arch/powerpc/platforms/82xx/ep8248e.c
+++ b/arch/powerpc/platforms/82xx/ep8248e.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -115,7 +116,7 @@ static int __devinit ep8248e_mdio_probe(struct of_device 
*ofdev,
struct mii_bus *bus;
struct resource res;
struct device_node *node;
-   int ret, i;
+   int ret;
 
node = of_get_parent(ofdev->node);
of_node_put(node);
@@ -130,17 +131,13 @@ static int __devinit ep8248e_mdio_probe(struct of_device 
*ofdev,
if (!bus)
return -ENOMEM;
 
-   bus->phy_mask = 0;
bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
 
-   for (i = 0; i < PHY_MAX_ADDR; i++)
-   bus->irq[i] = -1;
-
bus->name = "ep8248e-mdio-bitbang";
bus->parent = &ofdev->dev;
snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
 
-   return mdiobus_register(bus);
+   return of_mdiobus_register(bus, ofdev->node);
 }
 
 static int ep8248e_mdio_remove(struct of_device *ofdev)

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


[PATCH 14/14] net: add Xilinx ll_temac device driver

2009-03-31 Thread Grant Likely
From: Grant Likely 

This patch adds support for the Xilinx ll_temac 10/100/1000 Ethernet
device.  The ll_temac ipcore is typically used on Xilinx Virtex and
Spartan designs attached to either a PowerPC 4xx or Microblaze
processor.

At the present moment, this driver only works with Virtex5 PowerPC
designs because it assumes DCR is used to access the DMA registers.
However, the low level access to DMA registers is abstracted and
it should be easy to adapt for the other implementations.

I'm posting this driver now as an RFC.  There are still some things that
need to be tightened up, but it does appear to be stable.

Derived from driver code written by Yoshio Kashiwagi and David H. Lynch Jr.

CC: Yoshio Kashiwagi 
CC: David H. Lynch Jr. 
CC: John Linn 
CC: John Bonesio 
CC: David DeBonis 
CC: Wilson Yang 
Signed-off-by: Grant Likely 
---

 drivers/net/Kconfig |8 
 drivers/net/Makefile|2 
 drivers/net/xilinx_temac.c  |  970 +++
 drivers/net/xilinx_temac.h  |  374 +++
 drivers/net/xilinx_temac_mdio.c |  119 +
 5 files changed, 1473 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/xilinx_temac.c
 create mode 100644 drivers/net/xilinx_temac.h
 create mode 100644 drivers/net/xilinx_temac_mdio.c


diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index f062b42..9578ee0 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2339,6 +2339,14 @@ config MV643XX_ETH
  Some boards that use the Discovery chipset are the Momenco
  Ocelot C and Jaguar ATX and Pegasos II.
 
+config XILINX_TEMAC
+   tristate "Xilinx TEMAC 10/100/1000 Ethernet MAC driver"
+   select PHYLIB
+   depends on PPC_DCR_NATIVE
+   help
+ This driver supports the Xilinx 10/100/1000 LocalLink TEMAC
+ device found in Virtex FPGAs
+
 config QLA3XXX
tristate "QLogic QLA3XXX Network Driver Support"
depends on PCI
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 98409c9..ba98bf5 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -133,6 +133,8 @@ obj-$(CONFIG_AX88796) += ax88796.o
 
 obj-$(CONFIG_TSI108_ETH) += tsi108_eth.o
 obj-$(CONFIG_MV643XX_ETH) += mv643xx_eth.o
+xilinxtemac-objs := xilinx_temac.o xilinx_temac_mdio.o
+obj-$(CONFIG_XILINX_TEMAC) += xilinxtemac.o
 obj-$(CONFIG_QLA3XXX) += qla3xxx.o
 obj-$(CONFIG_QLGE) += qlge/
 
diff --git a/drivers/net/xilinx_temac.c b/drivers/net/xilinx_temac.c
new file mode 100644
index 000..d778a55
--- /dev/null
+++ b/drivers/net/xilinx_temac.c
@@ -0,0 +1,970 @@
+/*
+ * Driver for Xilinx TEMAC Ethernet device
+ *
+ * Copyright (c) 2008 Nissin Systems Co., Ltd.,  Yoshio Kashiwagi
+ * Copyright (c) 2005-2008 DLA Systems,  David H. Lynch Jr. 
+ * Copyright (c) 2008-2009 Secret Lab Technologies Ltd.
+ *
+ * This is a driver for the Xilinx ll_temac ipcore which is often used
+ * in the Virtex and Spartan series of chips.
+ *
+ * Notes:
+ * - The ll_temac hardware uses indirect access for many of the TEMAC
+ *   registers, include the MDIO bus.  However, indirect access to MDIO
+ *   registers take considerably more clock cycles than to TEMAC registers.
+ *   MDIO accesses are long, so threads doing them should probably sleep
+ *   rather than busywait.  However, since only one indirect access can be
+ *   in progress at any given time, that means that *all* indirect accesses
+ *   could end up sleeping (to wait for an MDIO access to complete).
+ *   Fortunately none of the indirect accesses are on the 'hot' path for tx
+ *   or rx, so this should be okay.
+ *
+ * TODO:
+ * - Fix driver to work on more than just Virtex5.  Right now the driver
+ *   assumes that the locallink DMA registers are accessed via DCR
+ *   instructions.
+ * - Factor out locallink DMA code into separate driver
+ * - Fix multicast assignment.
+ * - Fix support for hardware checksumming.
+ * - Testing.  Lots and lots of testing.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include   /* needed for sizeof(tcphdr) */
+#include   /* needed for sizeof(udphdr) */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "xilinx_temac.h"
+
+#define TX_BD_NUM   64
+#define RX_BD_NUM   128
+
+/* -
+ * Low level register access functions
+ */
+
+u32 temac_ior(struct temac_local *lp, int offset)
+{
+   return in_be32((u32 *)(lp->regs + offset));
+}
+
+void temac_iow(struct temac_local *lp, int offset, u32 value)
+{
+   out_be32((u32 *) (lp->regs + offset), value);
+}
+
+int temac_indirect_busywait(struct temac_local *lp)
+{
+   long end = jiffies + 2;
+
+   while (!(temac_ior(lp, XTE_RDY0_OFFSET) & XTE_RDY0_HARD_ACS_RDY_MASK)) {
+   if (end - jiffies <= 0) {
+   WARN_ON(1);
+   return -ETIMEDOU

Re: [PATCH] ucc_geth: Rework the TX logic.

2009-03-31 Thread Joakim Tjernlund
Scott Wood  wrote on 30/03/2009 21:32:23:
> 
> Joakim Tjernlund wrote:
> >> different since descriptors are in MURAM which is ioremap()ed -- 
though 
> >> switching to a cacheable mapping with barriers should be a 
performance 
> >> improvement.
> > 
> > I always thought that MURAM was very fast. The whole reason to have 
BDs in
> > MURAM is that it is faster than normal RAM, at least that is what I 
> > thought.
> 
> Yeah, on second thought it probably wouldn't be worth it.  There's also 
> the question of under what circumstances the QE's MURAM accesses will be 

> cache-coherent.

I am a bit confused, what isn't worth it? Currently MURAM isn't used by 
ucc_geth, but
it is easy to change. Swap MEM_PART_SYSTEM to MEM_PART_MURAM, however, 
just
tried that and the driver stopped working. I known this worked earlier 
because
I tried it and I even think I sent a patch to Leo.

What choices do we have, I see three:

1) MEM_PART_SYSTEM, as today.
2) MEM_PART_MURAM. I guess this should be uncacheable memory?
3) as gianfar, dma_alloc_coherent(). I presume this is uncacheable memory?

My guess would be 2 or 3. Do they have the same synchronization
sematics?

> 
> As for the CPU not reordering guarded+cache inhibited accesses, that 
> initially seemed to be true for the new arch stuff (book3e/book3s, but 
> not really, see below), but the classic arch documentation only 
> guarantees stores to such regions to be in-order (and the 
> explicitly-specified operation of eieio on I+G accesses wouldn't make 
> much sense if they were already guaranteed to be in-order).
> 
> Then I looked at the EREF to see what older book E documents had to say 
> on the issue, and it suggests that when the architecture document says 
> "out of order", it really means "speculative" (and reading the arch 
> doc's definition of "out of order" seems to confirm this -- redefining 
> terms is bad, m'kay?).  So it seems that the simple answer is no, 
> guarded storage is not guaranteed to be in order, unless the only thing 
> that can cause an out-of-order access is speculative execution.

Very informative, thanks.

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


[ppc64] 2.6.29-git7 : offlining a cpu causes an exception

2009-03-31 Thread Sachin Sant

While executing CPU HotPlug[1] tests i observed that during
every cpu offline process an exception is thrown.

cpu 0x2: Vector: 700 (Program Check) at [c74c7ca0]
   pc: 007b6640
   lr: 0079ddc0
   sp: c74c7f20
  msr: 80081002
 current = 0xc000fe1c8580
 paca= 0xc0ab2800
   pid   = 0, comm = swapper
2:mon> r
R00 =    R16 = 0002
R01 = c74c7f20   R17 = 
R02 = 009e8dc0   R18 = 
R03 = 8278   R19 = 
R04 = 8000   R20 = 
R05 = 0002   R21 = 
R06 = 0002   R22 = c0b33ae0
R07 =    R23 = 
R08 =    R24 = 0002
R09 = 82fc   R25 = 
R10 =    R26 = 0004
R11 = a0001002   R27 = c0a95bd8
R12 = a000   R28 = 0008
R13 = c0ab2800   R29 = 
R14 =    R30 = c095e750
R15 = 07531868   R31 = 07d70b20
pc  = 007b6640
lr  = 0079ddc0
msr = 80081002   cr  = 2204
ctr =    xer = 0020   trap =  700
2:mon> u
SLB contents of cpu 2
00 c800 40004f7ca3000500  1T  ESID=   c0  VSID=   4f7ca3 
LLP:100
01 d800 4000eb71b510  1T  ESID=   d0  VSID=   eb71b0 
LLP:110
24 0800 0c80 256M ESID=0  VSID=0 
LLP:  0
2:mon>

I can recreate this problem very easily on power5
as well as power6 box.

2.6.29-git6 did not have this problem. Let me know if there
is any other information i can provide. I have attached the
dmesg log here.

Thanks
-Sachin

[1] -> CPU Hotplug test which is part of LTP.

--

-
Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India
-


<6>Phyp-dump disabled at boot time.
<6>Using pSeries machine description.
<7>Page orders: linear mapping = 24, virtual = 16, io = 12.
<6>Using 1TB segments.
<4>Found initrd at 0xc34d:0xc3c7f14f.
<6>console [udbg0] enabled.
<6>Partition configured for 4 cpus..
<6>CPU maps initialized for 2 threads per core.
<7> (thread shift is 1).
<4>Starting Linux PPC64 #3 SMP Tue Mar 31 14:33:34 IST 2009.
<4>-.
<4>ppc64_pft_size= 0x1a.
<4>physicalMemorySize= 0x1.
<4>htab_hash_mask= 0x7.
<4>-.
<6>Initializing cgroup subsys cpuset.
<6>Initializing cgroup subsys cpu.
<5>Linux version 2.6.29-git7 (r...@llm62) (gcc version 4.3.2 [gcc-4_3-branch 
revision 141291] (SUSE Linux) ) #3 SMP Tue Mar 31 14:33:34 IST 2009.
<4>[boot]0012 Setup Arch.
<7>Node 0 Memory: 0x0-0x1.
<4>EEH: No capable adapters found.
<6>PPC64 nvram contains 15360 bytes.
<7>Using shared processor idle loop.
<4>Zone PFN ranges:.
<4>  DMA  0x -> 0x0001.
<4>  Normal   0x0001 -> 0x0001.
<4>Movable zone start PFN for each node.
<4>early_node_map[1] active PFN ranges.
<4>0: 0x -> 0x0001.
<7>On node 0 totalpages: 65536.
<7>  DMA zone: 56 pages used for memmap.
<7>  DMA zone: 0 pages reserved.
<7>  DMA zone: 65480 pages, LIFO batch:1.
<4>[boot]0015 Setup Done.
<4>Built 1 zonelists in Node order, mobility grouping on.  Total pages: 65480.
<4>Policy zone: DMA.
<5>Kernel command line: root=/dev/sda5 sysrq=1 insmod=sym53c8xx insmod=ipr 
crashkernel=512M-:256M  .
<6>NR_IRQS:512.
<4>[boot]0020 XICS Init.
<4>[boot]0021 XICS Done.
<7>pic: no ISA interrupt controller.
<4>PID hash table entries: 4096 (order: 12, 32768 bytes).
<7>time_init: decrementer frequency = 512.00 MHz.
<7>time_init: processor frequency   = 4704.00 MHz.
<6>clocksource: timebase mult[7d] shift[22] registered.
<7>clockevent: decrementer mult[8312] shift[16] cpu[0].
<4>Console: colour dummy device 80x25.
<6>console handover: boot [udbg0] -> real [hvc0].
<6>Dentry cache hash table entries: 524288 (order: 6, 4194304 bytes).
<6>Inode-cache hash table entries: 262144 (order: 5, 2097152 bytes).
<6>allocated 2621440 bytes of page_cgroup.
<6>please try cgroup_disable=memory option if you don't want.
<4>freeing bootmem node 0.
<6>Memory: 4119872k/4194304k available (8192k kernel code, 74432k reserved, 
1984k data, 4194k bss, 448k init).
<6>Calibrating delay loop... 1022.36 BogoMIPS (lpj=5111808).
<6>Security Framework initialized.
<6>SELinux:  Disabled at boot..
<4>Mount-cache hash table entries: 4096.
<6>Initializing cgroup subsys debug.
<6>Initializing cgroup subsys ns.
<6>Initializing cgroup subsys cpuacct.
<6>Initializing cgroup subsys memory.
<6>Initializing cgroup subsys devices.
<6>Initializing cgroup subsys freezer.
<7>clockevent: decrementer mult[8312] shift[16] cpu[1].
<4>Processor 1 found..
<7>

Re: powerpc/85xx: Add support for the "socrates" board (MPC8544)

2009-03-31 Thread Wolfgang Grandegger
Grant Likely wrote:
> I agree 100% with David's comments, and I have some additional ones below.
> 
> On Thu, Mar 19, 2009 at 9:26 AM, Wolfgang Grandegger  
> wrote:
>> +   soc8...@e000 {
>> +   #address-cells = <1>;
>> +   #size-cells = <1>;
>> +   device_type = "soc";
> 
> Drop device_type here too.

Grrr, I just realized that removing the devices type "soc" has broken
fsl_get_sys_freq(). See:

http://lxr.linux.no/linux+v2.6.29/arch/powerpc/sysdev/fsl_soc.c#L80

We need a quick fix and we could take the occasion to establish a common
function for the MPC52xx as well, but it's not obvious to me how to find
the SOC node without the device type property.

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


Re: [PATCH] linux-next remove wmb() from ide-dma-sff.c and scc_pata.c

2009-03-31 Thread KOBAYASHI Yoshitake
2009/03/31 16:51, Geert Uytterhoeven wrote:
> On Mon, 30 Mar 2009, Grant Grundler wrote:
>> Followup to "[PATCH 03/10] ide: destroy DMA mappings after ending DMA"
>> email on March 14th:
>> http://lkml.org/lkml/2009/3/14/17
>>
>> No maintainer is listed for "Toshiba CELL Reference Set IDE" (BLK_DEV_CELLEB)
>> or tx4939ide.c in MAINTAINERS. I've CC'd "Ishizaki Kou" @Toshiba (Maintainer 
>> for
>> "Spidernet Network Driver for CELL") and linuxppc-dev list in the hope
>> someone else
>> would know or would be able to ACK this patch.
> 
> tx49xx is MIPS, for Nemoto-san.

The patch looks good for Toshiba Cell Reference Set.
I think the patch will be acked by IDE maintainer.

Thank you for informing me of the contribution.

Regards,

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


[PATCH 13/14] net: Rework fs_enet driver to use of_mdio infrastructure

2009-03-31 Thread Grant Likely
From: Grant Likely 

This patch simplifies the driver by making use of more common code.

Signed-off-by: Grant Likely 
---

 drivers/net/fs_enet/fs_enet-main.c |   69 ++--
 drivers/net/fs_enet/mii-bitbang.c  |   29 +--
 drivers/net/fs_enet/mii-fec.c  |   26 +-
 include/linux/fs_enet_pd.h |6 +--
 4 files changed, 16 insertions(+), 114 deletions(-)


diff --git a/drivers/net/fs_enet/fs_enet-main.c 
b/drivers/net/fs_enet/fs_enet-main.c
index b037ce9..387e0e9 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -36,6 +36,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -752,9 +754,10 @@ static int fs_init_phy(struct net_device *dev)
fep->oldlink = 0;
fep->oldspeed = 0;
fep->oldduplex = -1;
-   if(fep->fpi->bus_id)
-   phydev = phy_connect(dev, fep->fpi->bus_id, &fs_adjust_link, 0,
-   PHY_INTERFACE_MODE_MII);
+   if(fep->fpi->phy_node)
+   phydev = of_phy_connect(dev, fep->fpi->phy_node,
+   &fs_adjust_link, 0,
+   PHY_INTERFACE_MODE_MII);
else {
printk("No phy bus ID specified in BSP code\n");
return -EINVAL;
@@ -962,57 +965,6 @@ static void cleanup_immap(void)
 
 
/**/
 
-static int __devinit find_phy(struct device_node *np,
-  struct fs_platform_info *fpi)
-{
-   struct device_node *phynode, *mdionode;
-   int ret = 0, len, bus_id;
-   const u32 *data;
-
-   data  = of_get_property(np, "fixed-link", NULL);
-   if (data) {
-   snprintf(fpi->bus_id, 16, "%x:%02x", 0, *data);
-   return 0;
-   }
-
-   data = of_get_property(np, "phy-handle", &len);
-   if (!data || len != 4)
-   return -EINVAL;
-
-   phynode = of_find_node_by_phandle(*data);
-   if (!phynode)
-   return -EINVAL;
-
-   data = of_get_property(phynode, "reg", &len);
-   if (!data || len != 4) {
-   ret = -EINVAL;
-   goto out_put_phy;
-   }
-
-   mdionode = of_get_parent(phynode);
-   if (!mdionode) {
-   ret = -EINVAL;
-   goto out_put_phy;
-   }
-
-   bus_id = of_get_gpio(mdionode, 0);
-   if (bus_id < 0) {
-   struct resource res;
-   ret = of_address_to_resource(mdionode, 0, &res);
-   if (ret)
-   goto out_put_mdio;
-   bus_id = res.start;
-   }
-
-   snprintf(fpi->bus_id, 16, "%x:%02x", bus_id, *data);
-
-out_put_mdio:
-   of_node_put(mdionode);
-out_put_phy:
-   of_node_put(phynode);
-   return ret;
-}
-
 #ifdef CONFIG_FS_ENET_HAS_FEC
 #define IS_FEC(match) ((match)->data == &fs_fec_ops)
 #else
@@ -1046,9 +998,9 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
fpi->rx_copybreak = 240;
fpi->use_napi = 1;
fpi->napi_weight = 17;
-
-   ret = find_phy(ofdev->node, fpi);
-   if (ret)
+   fpi->phy_node = of_parse_phandle(ofdev->node, "phy-handle", 0);
+   if ((!fpi->phy_node) && (!of_get_property(ofdev->node, "fixed-link",
+ NULL)))
goto out_free_fpi;
 
privsize = sizeof(*fep) +
@@ -1129,6 +1081,7 @@ out_cleanup_data:
 out_free_dev:
free_netdev(ndev);
dev_set_drvdata(&ofdev->dev, NULL);
+   of_node_put(fpi->phy_node);
 out_free_fpi:
kfree(fpi);
return ret;
@@ -1144,7 +1097,7 @@ static int fs_enet_remove(struct of_device *ofdev)
fep->ops->free_bd(ndev);
fep->ops->cleanup_data(ndev);
dev_set_drvdata(fep->dev, NULL);
-
+   of_node_put(fep->fpi->phy_node);
free_netdev(ndev);
return 0;
 }
diff --git a/drivers/net/fs_enet/mii-bitbang.c 
b/drivers/net/fs_enet/mii-bitbang.c
index 49b6645..93b481b 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "fs_enet.h"
@@ -149,31 +150,12 @@ static int __devinit fs_mii_bitbang_init(struct mii_bus 
*bus,
return 0;
 }
 
-static void __devinit add_phy(struct mii_bus *bus, struct device_node *np)
-{
-   const u32 *data;
-   int len, id, irq;
-
-   data = of_get_property(np, "reg", &len);
-   if (!data || len != 4)
-   return;
-
-   id = *data;
-   bus->phy_mask &= ~(1 << id);
-
-   irq = of_irq_to_resource(np, 0, NULL);
-   if (irq != NO_IRQ)
-   bus->irq[id] = irq;
-}
-
 static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,
 const struct of_device_id *match)
 {
-   struct device_nod

8641D with linux 2.6.29 did'n show second cpu

2009-03-31 Thread Eduard Fuchs
Hi,

I'm testing the evaluation board from freescale (MPC8641DHPCN) with the latest  
linux kernel (2.6.29) and the second core seems disabled. CONFIG_SPM is 
enabled but the /proc/cpuinfo shows only one cpu. With original 2.6.27 kernel 
both cpu cores appears in /proc/cpuinfo.

Has anyone an idea how can i enable the second core?

Best regards.

Eduard Fuchs

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


Patch: Fix fec_mpc52xx driver to use net_device_ops

2009-03-31 Thread Henk Stegeman
Fix fec_mpc52xx driver to use net_device_ops and to be careful not to
dereference phy_device if a phy has not yet been connected.

Signed-off-by: Henk Stegeman 

diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index cd8e98b..ca76b95 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -847,24 +847,40 @@ static void mpc52xx_fec_get_drvinfo(struct
net_device *dev,
 static int mpc52xx_fec_get_settings(struct net_device *dev, struct
ethtool_cmd *cmd)
 {
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
+
+   if (!priv->phydev)
+   return -ENODEV;
+
return phy_ethtool_gset(priv->phydev, cmd);
 }

 static int mpc52xx_fec_set_settings(struct net_device *dev, struct
ethtool_cmd *cmd)
 {
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
+
+   if (!priv->phydev)
+   return -ENODEV;
+
return phy_ethtool_sset(priv->phydev, cmd);
 }

 static u32 mpc52xx_fec_get_msglevel(struct net_device *dev)
 {
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
+
+   if (!priv->phydev)
+   return 0;
+
return priv->msg_enable;
 }

 static void mpc52xx_fec_set_msglevel(struct net_device *dev, u32 level)
 {
struct mpc52xx_fec_priv *priv = netdev_priv(dev);
+
+   if (!priv->phydev)
+   return;
+
priv->msg_enable = level;
 }

@@ -882,12 +898,31 @@ static int mpc52xx_fec_ioctl(struct net_device
*dev, struct ifreq *rq, int cmd)
 {
struct mpc52xx_fec_priv *priv = netdev_priv(dev);

+   if (!priv->phydev)
+   return -ENODEV;
+
return mpc52xx_fec_phy_mii_ioctl(priv, if_mii(rq), cmd);
 }

 /*  */
 /* OF Driver*/
 /*  */
+static const struct net_device_ops mpc52xx_fec_netdev_ops = {
+   .ndo_open   = mpc52xx_fec_open,
+   .ndo_stop   = mpc52xx_fec_close,
+   .ndo_start_xmit = mpc52xx_fec_hard_start_xmit,
+   .ndo_tx_timeout = mpc52xx_fec_tx_timeout,
+   .ndo_get_stats  = mpc52xx_fec_get_stats,
+   .ndo_set_multicast_list = mpc52xx_fec_set_multicast_list,
+   .ndo_validate_addr  = eth_validate_addr,
+   .ndo_set_mac_address= mpc52xx_fec_set_mac_address,
+   .ndo_do_ioctl   = mpc52xx_fec_ioctl,
+
+#ifdef CONFIG_NET_POLL_CONTROLLER
+   .ndo_poll_controller = mpc52xx_fec_poll_controller,
+#endif
+};
+

 static int __devinit
 mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match)
@@ -929,20 +964,10 @@ mpc52xx_fec_probe(struct of_device *op, const
struct of_device_id *match)
return -EBUSY;

/* Init ether ndev with what we have */
-   ndev->open  = mpc52xx_fec_open;
-   ndev->stop  = mpc52xx_fec_close;
-   ndev->hard_start_xmit   = mpc52xx_fec_hard_start_xmit;
-   ndev->do_ioctl  = mpc52xx_fec_ioctl;
ndev->ethtool_ops   = &mpc52xx_fec_ethtool_ops;
-   ndev->get_stats = mpc52xx_fec_get_stats;
-   ndev->set_mac_address   = mpc52xx_fec_set_mac_address;
-   ndev->set_multicast_list = mpc52xx_fec_set_multicast_list;
-   ndev->tx_timeout= mpc52xx_fec_tx_timeout;
ndev->watchdog_timeo= FEC_WATCHDOG_TIMEOUT;
ndev->base_addr = mem.start;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-   ndev->poll_controller = mpc52xx_fec_poll_controller;
-#endif
+   ndev->netdev_ops = &mpc52xx_fec_netdev_ops;

priv->t_irq = priv->r_irq = ndev->irq = NO_IRQ; /* IRQ are free for now 
*/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] ucc_geth: Rework the TX logic.

2009-03-31 Thread Li Yang
On Tue, Mar 31, 2009 at 5:07 PM, Joakim Tjernlund
 wrote:
> Scott Wood  wrote on 30/03/2009 21:32:23:
>>
>> Joakim Tjernlund wrote:
>> >> different since descriptors are in MURAM which is ioremap()ed --
> though
>> >> switching to a cacheable mapping with barriers should be a
> performance
>> >> improvement.
>> >
>> > I always thought that MURAM was very fast. The whole reason to have
> BDs in
>> > MURAM is that it is faster than normal RAM, at least that is what I
>> > thought.
>>
>> Yeah, on second thought it probably wouldn't be worth it.  There's also
>> the question of under what circumstances the QE's MURAM accesses will be
>
>> cache-coherent.
>
> I am a bit confused, what isn't worth it? Currently MURAM isn't used by
> ucc_geth, but
> it is easy to change. Swap MEM_PART_SYSTEM to MEM_PART_MURAM, however,
> just
> tried that and the driver stopped working. I known this worked earlier
> because
> I tried it and I even think I sent a patch to Leo.
>
> What choices do we have, I see three:
>
> 1) MEM_PART_SYSTEM, as today.
> 2) MEM_PART_MURAM. I guess this should be uncacheable memory?
> 3) as gianfar, dma_alloc_coherent(). I presume this is uncacheable memory?
>

1 and 3 are the same.  All of them use cacheable memory as we have a
hardware coherency module to take care of the cache coherency problem.
 However it might be better to use dma_alloc_coherent() for the code
to be more readible.  Thanks.

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

configuring the DMA for using the SCPLC on the MPC5121

2009-03-31 Thread Jacquemin, Jean-Philippe
Dear all,
 
I am trying to configure the MPC5121 to perform DMA transfers from the
CPU RAM to the RAM of an FPGA attached on ChipSelect 2.
I have to use the LocalPlus Bus and configure the chipselect2 for bust
mode and non-multiplexed.
I also have to configure a DMA task to copy the content of my buffer to
the local bus Fifo and then kick this content to the wanted address on
chipselect 2.
 
I have some code (thanks to Grant Likely) to implement a LocalPlus Bus
Fifo driver (SCPLC) but have no clue how to configure the DMA for using
the SCPLC... Can someone help me??
 
The 5121 fifo is directly derived from the 5200 fifo, only it is :
* deeper (1024bytes instead of 512), 
* up to 56 bytes can be transfered with one transaction
* increased SCPLC packet size register to 31 bits
 
 
best regards,
 
Jean-Philippe Jacquemin
 


DISCLAIMER:
Unless indicated otherwise, the information contained in this message is 
privileged and confidential, and is intended only for the use of the 
addressee(s) named above and others who have been specifically authorized to 
receive it. If you are not the intended recipient, you are hereby notified that 
any dissemination, distribution or copying of this message and/or attachments 
is strictly prohibited. The company accepts no liability for any damage caused 
by any virus transmitted by this email. Furthermore, the company does not 
warrant a proper and complete transmission of this information, nor does it 
accept liability for any delays. If you have received this message in error, 
please contact the sender and delete the message. Thank you.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[PATCH] powerpc: Make LOWMEM_CAM_NUM depend on FSL_BOOKE

2009-03-31 Thread Josh Boyer
The recent addition of CONFIG_LOWMEM_CAM_BOOL and
CONFIG_LOWMEM_CAM_NUM cause the latter to show up in configs
that do not need it during 'make oldconfig'.  Make LOWMEM_CAM_NUM
depend on FSL_BOOKE.

Signed-off-by: Josh Boyer 

---

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index ad6b1c0..7d1a535 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -772,6 +772,7 @@ config LOWMEM_CAM_NUM_BOOL
  Say N here unless you know what you are doing.
 
 config LOWMEM_CAM_NUM
+   depends on FSL_BOOKE
int "Number of CAMs to use to map low memory" if LOWMEM_CAM_NUM_BOOL
default 3
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 4/8] powerpc: i2c-mpc: preserve I2C clocking

2009-03-31 Thread Wolfgang Grandegger
The I2c node property "fsl,preserve-clocking" allows to overtake the
clock settings from the boot loader and avoids the hard-coded setting.

Signed-off-by: Wolfgang Grandegger 
---
 drivers/i2c/busses/i2c-mpc.c |   24 
 1 file changed, 16 insertions(+), 8 deletions(-)

Index: linux-2.6/drivers/i2c/busses/i2c-mpc.c
===
--- linux-2.6.orig/drivers/i2c/busses/i2c-mpc.c 2009-03-31 13:25:08.0 
+0200
+++ linux-2.6/drivers/i2c/busses/i2c-mpc.c  2009-03-31 13:28:03.0 
+0200
@@ -318,17 +318,24 @@
 {
int result = 0;
struct mpc_i2c *i2c;
+   int set_clock;
 
i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
if (!i2c)
return -ENOMEM;
 
-   if (of_get_property(op->node, "dfsrr", NULL))
-   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
-
-   if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
-   of_device_is_compatible(op->node, "mpc5200-i2c"))
-   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
+   if (of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
+   set_clock = 0;
+   } else {
+   set_clock = 1;
+
+   if (of_get_property(op->node, "dfsrr", NULL))
+   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
+
+   if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
+   of_device_is_compatible(op->node, "mpc5200-i2c"))
+   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
+   }
 
init_waitqueue_head(&i2c->queue);
 
@@ -348,8 +355,9 @@
goto fail_request;
}
}
-   
-   mpc_i2c_setclock(i2c);
+
+   if (set_clock)
+   mpc_i2c_setclock(i2c);
 
dev_set_drvdata(&op->dev, i2c);
 

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


[PATCH 6/8] --- arch/powerpc/boot/dts/socrates.dts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)

2009-03-31 Thread Wolfgang Grandegger
Index: linux-2.6/arch/powerpc/boot/dts/socrates.dts
===
--- linux-2.6.orig/arch/powerpc/boot/dts/socrates.dts   2009-03-31 
13:24:38.078719288 +0200
+++ linux-2.6/arch/powerpc/boot/dts/socrates.dts2009-03-31 
13:47:56.986720719 +0200
@@ -52,6 +52,7 @@
soc8...@e000 {
#address-cells = <1>;
#size-cells = <1>;
+   device_type = "soc";
 
ranges = <0x 0xe000 0x0010>;
reg = <0xe000 0x1000>;  // CCSRBAR 1M
@@ -78,10 +79,11 @@
#address-cells = <1>;
#size-cells = <0>;
cell-index = <0>;
-   compatible = "fsl-i2c";
+   compatible = "fsl,mpc8544-i2c", "fsl-i2c";
reg = <0x3000 0x100>;
interrupts = <43 2>;
interrupt-parent = <&mpic>;
+   clock-frequency = <103000>;
dfsrr;
 
d...@28 {
@@ -110,10 +112,12 @@
#address-cells = <1>;
#size-cells = <0>;
cell-index = <1>;
-   compatible = "fsl-i2c";
+   compatible = "fsl,mpc8544-i2c", "fsl-i2c";
reg = <0x3100 0x100>;
interrupts = <43 2>;
interrupt-parent = <&mpic>;
+   fsl,preserve-clocking;
+   clock-frequency = <40>;
dfsrr;
};
 
@@ -207,6 +211,7 @@
compatible = "fsl,mpc8548-guts";
reg = <0xe 0x1000>;
fsl,has-rstcr;
+   fsl,has-sec-cfg;
};
 
mpic: p...@4 {

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


[PATCH 0/8] powerpc: i2c-mpc: make I2C bus speed configurable

2009-03-31 Thread Wolfgang Grandegger
Following (most of) Grant's suggestions to my RFC:

http://ozlabs.org/pipermail/linuxppc-dev/2009-March/069820.html

this new patch series now uses:

- the I2c node property "fsl,preserve-clocking" to overtake the
  clock settings from the boot loader. The first patch provides this
  feature and can be applied *without* delay. This rest will take
  more time and discussion, I'm afraid :-(.

- the OF match table to define the I2C clock properties, especially
  the source clock pre-scaler:

  static const struct of_device_id mpc_i2c_of_match[] = {
{.compatible = "fsl,mpc5200b-i2c",
 .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
{.compatible = "fsl,mpc5200-i2c",
 .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
{.compatible = "fsl,mpc8313-i2c",
 .data = (void *)FSL_I2C_DEV_SEPARATE_DFSRR, },
{.compatible = "fsl,mpc8543-i2c",
 .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
  FSL_I2C_DEV_CLOCK_DIV2), },
{.compatible = "fsl,mpc8544-i2c",
 .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
  FSL_I2C_DEV_CLOCK_DIV23), },
/* Backward compatibility */
{.compatible = "fsl-i2c", },
{},
  };

  The "data" field defines the relevant I2C flags.

- arch-specific tables and functions to get the proper Freqency
  Divider Register (fdr). I added them to sysdev/fsl_soc.c for
  the MPC8xxx and to platforms/52xx/mpc52xx_common.c for the
  MPC52xx. This also solves the problem with arch-specific
  functions, e.g. for getting the bus frequency.

- dev_dbg() and dev_info() to profit from a more descriptive output.

Hope this solution is OK now?

Thanks,

Wolfgang.


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


[PATCH 5/8] powerpc: i2c-mpc: make I2C bus speed configurable

2009-03-31 Thread Wolfgang Grandegger
This patch makes the I2C bus speed configurable by using the I2C node
property "clock-frequency". If the property is not defined, the old
fixed clock settings will be used for backward comptibility.

The generic I2C clock properties, especially the CPU-specific source
clock pre-scaler are defined via the OF match table:

  static const struct of_device_id mpc_i2c_of_match[] = {
{.compatible = "fsl,mpc5200b-i2c",
 .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
{.compatible = "fsl,mpc5200-i2c",
 .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
{.compatible = "fsl,mpc8313-i2c",
 .data = (void *)FSL_I2C_DEV_SEPARATE_DFSRR, },
{.compatible = "fsl,mpc8543-i2c",
 .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
  FSL_I2C_DEV_CLOCK_DIV2), },
{.compatible = "fsl,mpc8544-i2c",
 .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
  FSL_I2C_DEV_CLOCK_DIV23), },
/* Backward compatibility */
{.compatible = "fsl-i2c", },
{},
  };

The "data" field defines the relevant I2C flags for the comptible CPU.

It used arch-specific tables and functions to determine the proper
Freqency Divider Register (fdr).

Furthermore dev_dbg() and dev_info() are now used to profit from a more
comprehensive output.

Signed-off-by: Wolfgang Grandegger 
---
 arch/powerpc/platforms/52xx/mpc52xx_common.c |   48 
 arch/powerpc/sysdev/fsl_soc.c|   90 +++
 drivers/i2c/busses/i2c-mpc.c |  104 +++
 include/linux/fsl_devices.h  |6 +
 4 files changed, 221 insertions(+), 27 deletions(-)

Index: linux-2.6/drivers/i2c/busses/i2c-mpc.c
===
--- linux-2.6.orig/drivers/i2c/busses/i2c-mpc.c 2009-03-31 13:28:03.0 
+0200
+++ linux-2.6/drivers/i2c/busses/i2c-mpc.c  2009-03-31 13:38:01.355720989 
+0200
@@ -20,12 +20,14 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+#include 
+
 #define DRV_NAME "mpc-i2c"
 
 #define MPC_I2C_FDR0x04
@@ -50,6 +52,7 @@
 #define CSR_RXAK 0x01
 
 struct mpc_i2c {
+   struct device *dev;
void __iomem *base;
u32 interrupt;
wait_queue_head_t queue;
@@ -105,7 +108,7 @@
while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) {
schedule();
if (time_after(jiffies, orig_jiffies + timeout)) {
-   pr_debug("I2C: timeout\n");
+   dev_dbg(i2c->dev, "timeout\n");
writeccr(i2c, 0);
result = -EIO;
break;
@@ -119,10 +122,10 @@
(i2c->interrupt & CSR_MIF), timeout * HZ);
 
if (unlikely(result < 0)) {
-   pr_debug("I2C: wait interrupted\n");
+   dev_dbg(i2c->dev, "wait interrupted\n");
writeccr(i2c, 0);
} else if (unlikely(!(i2c->interrupt & CSR_MIF))) {
-   pr_debug("I2C: wait timeout\n");
+   dev_dbg(i2c->dev, "wait timeout\n");
writeccr(i2c, 0);
result = -ETIMEDOUT;
}
@@ -135,17 +138,17 @@
return result;
 
if (!(x & CSR_MCF)) {
-   pr_debug("I2C: unfinished\n");
+   dev_dbg(i2c->dev, "unfinished\n");
return -EIO;
}
 
if (x & CSR_MAL) {
-   pr_debug("I2C: MAL\n");
+   dev_dbg(i2c->dev, "MAL\n");
return -EIO;
}
 
if (writing && (x & CSR_RXAK)) {
-   pr_debug("I2C: No RXAK\n");
+   dev_dbg(i2c->dev, "No RXAK\n");
/* generate stop */
writeccr(i2c, CCR_MEN);
return -EIO;
@@ -153,17 +156,38 @@
return 0;
 }
 
-static void mpc_i2c_setclock(struct mpc_i2c *i2c)
+static void mpc_i2c_setclock(struct device_node *node,
+struct mpc_i2c *i2c, u32 clock)
 {
-   /* Set clock and filters */
-   if (i2c->flags & FSL_I2C_DEV_SEPARATE_DFSRR) {
-   writeb(0x31, i2c->base + MPC_I2C_FDR);
-   writeb(0x10, i2c->base + MPC_I2C_DFSRR);
-   } else if (i2c->flags & FSL_I2C_DEV_CLOCK_5200)
-   writeb(0x3f, i2c->base + MPC_I2C_FDR);
-   else
-   writel(0x1031, i2c->base + MPC_I2C_FDR);
-}
+   int fdr;
+
+   fdr = fsl_i2c_get_fdr(node, clock, i2c->flags);
+
+   if (i2c->flags & FSL_I2C_DEV_CLOCK_5200) {
+   pr_debug("I2C: old fdr=%d\n", readb(i2c->base + MPC_I2C_FDR));
+   if (fdr < 0)
+   fdr = 0x3f; /* backward compatibility */
+   writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR);
+   dev_i

[PATCH 2/8] [PATCH 01/28] RTC: Add support for RX8025 chip.

2009-03-31 Thread Wolfgang Grandegger
This patch adds support for the Epson RX-8025SA/NB RTC chips. It
includes support for alarms update interrupts (1 Hz) and clock
precision adjustment.

For clock precision adjustment, the SYSFS file "clock_adjust_ppb" gets
created in "/sys/class/rtc/rtcX/device". It permits to set and get the
clock adjustment in ppb (parts per billion), e.g.:

  # echo -183000 > /sys/class/rtc/rtc0/device/clock_adjust_ppb
  # cat /sys/class/rtc/rtc0/device/clock_adjust_ppb
  -183000

This allows to compensate temperature dependent clock drifts. According
to the RX8025 SA/NB application manual the frequency and temperature 
charateristics can be approximated using the following equation:

  df = a * (ut - t)**2

  df: Frequency deviation in any temperature
  a : Coefficient = (-35 +-5) * 10**-9  
  ut: Ultimate temperature in degree = +25 +-5 degree  
  t : Any temperature in degree  


Signed-off-by: Wolfgang Grandegger 
Signed-off-by: Sergei Poselenov 
Signed-off-by: Yuri Tikhonov 
Signed-off-by: Dmitry Rakhchev 
Signed-off-by: Matthias Fuchs 
---
 drivers/rtc/Kconfig  |9 
 drivers/rtc/Makefile |1 
 drivers/rtc/rtc-rx8025.c |  891 +++
 3 files changed, 901 insertions(+)
 create mode 100644 drivers/rtc/rtc-rx8025.c

Index: linux-2.6/drivers/rtc/Kconfig
===
--- linux-2.6.orig/drivers/rtc/Kconfig
+++ linux-2.6/drivers/rtc/Kconfig
@@ -295,6 +295,15 @@ config RTC_DRV_RX8581
  This driver can also be built as a module. If so the module
  will be called rtc-rx8581.
 
+config RTC_DRV_RX8025
+   tristate "Epson RX-8025SA/NB"
+   help
+ If you say yes here you get support for the Epson
+ RX-8025SA/NB RTC chips.
+
+ This driver can also be built as a module. If so, the module
+ will be called rtc-rx8025.
+
 endif # I2C
 
 comment "SPI RTC drivers"
Index: linux-2.6/drivers/rtc/Makefile
===
--- linux-2.6.orig/drivers/rtc/Makefile
+++ linux-2.6/drivers/rtc/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_RTC_DRV_R9701)   += rtc-r9701
 obj-$(CONFIG_RTC_DRV_RS5C313)  += rtc-rs5c313.o
 obj-$(CONFIG_RTC_DRV_RS5C348)  += rtc-rs5c348.o
 obj-$(CONFIG_RTC_DRV_RS5C372)  += rtc-rs5c372.o
+obj-$(CONFIG_RTC_DRV_RX8025)   += rtc-rx8025.o
 obj-$(CONFIG_RTC_DRV_RX8581)   += rtc-rx8581.o
 obj-$(CONFIG_RTC_DRV_S35390A)  += rtc-s35390a.o
 obj-$(CONFIG_RTC_DRV_S3C)  += rtc-s3c.o
Index: linux-2.6/drivers/rtc/rtc-rx8025.c
===
--- /dev/null
+++ linux-2.6/drivers/rtc/rtc-rx8025.c
@@ -0,0 +1,891 @@
+/*
+ * Driver for Epson's RTC module RX-8025 SA/NB
+ *
+ * Copyright (C) 2005 by Digi International Inc.
+ * All rights reserved.
+ *
+ * Modify by fengjh at rising.com.cn
+ * 
+ * 2006.11
+ *
+ * Code cleanup by Sergei Poselenov, 
+ * Converted to new style by Wolfgang Grandegger 
+ * Alarm and periodic interrupt added by Dmitry Rakhchev 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* registers */
+#define RX8025_REG_SEC 0x00
+#define RX8025_REG_MIN 0x01
+#define RX8025_REG_HOUR0x02
+#define RX8025_REG_WDAY0x03
+#define RX8025_REG_MDAY0x04
+#define RX8025_REG_MONTH   0x05
+#define RX8025_REG_YEAR0x06
+#define RX8025_REG_DIGOFF  0x07
+#define RX8025_REG_ALWMIN  0x08
+#define RX8025_REG_ALWHOUR 0x09
+#define RX8025_REG_ALWWDAY 0x0a
+#define RX8025_REG_ALDMIN  0x0b
+#define RX8025_REG_ALDHOUR 0x0c
+/* 0x0d is reserved */
+#define RX8025_REG_CTRL1   0x0e
+#define RX8025_REG_CTRL2   0x0f
+
+#define RX8025_BIT_CTRL1_CT(7 << 0)
+/* 1 Hz periodic level irq */
+#define RX8025_BIT_CTRL1_CT_1HZ4
+#define RX8025_BIT_CTRL1_TEST  (1 << 3)
+#define RX8025_BIT_CTRL1_1224  (1 << 5)
+#define RX8025_BIT_CTRL1_DALE  (1 << 6)
+#define RX8025_BIT_CTRL1_WALE  (1 << 7)
+
+#define RX8025_BIT_CTRL2_DAFG  (1 << 0)
+#define RX8025_BIT_CTRL2_WAFG  (1 << 1)
+#define RX8025_BIT_CTRL2_CTFG  (1 << 2)
+#define RX8025_BIT_CTRL2_PON   (1 << 4)
+#define RX8025_BIT_CTRL2_XST   (1 << 5)
+#define RX8025_BIT_CTRL2_VDET  (1 << 6)
+
+/* Clock precision adjustment */
+#define RX8025_ADJ_RESOLUTION  3050 /* in ppb */
+#define RX8025_ADJ_DATA_MAX62
+#define RX8025_ADJ_DATA_MIN-62
+
+static const struct i2c_device_id rx8025_id[] = {
+   { "rx8025", 0 },
+   { }
+};
+MODULE_DEVICE_TABLE(i2c, rx8025_id);
+
+struct rx8025_data {
+   struct i2c_client *client;
+   struct rtc_device *rtc;
+   struct work_struct work;
+   struct mut

[PATCH 7/8] Re: [PATCH 1/2] NAND: Add support for oob size 128

2009-03-31 Thread Wolfgang Grandegger
* Wolfgang Grandegger | 2009-03-25 11:48:37 [+0100]:

>Signed-off-by: Ilya Yanok 
>Acked-by: Wolfgang Grandegger 

You seem to forgot a few bits (subpage_sft & max page size). I had this
patch in my tree like for ever and forgot post it here. I did however
merge the mtd-utils bits allready :)

From: Thomas Gleixner 
Date: Wed, 12 Dec 2007 17:27:03 +0100
Subject: [PATCH 7/8] [PATCH] [MTD] Add support for 4k pages.

Signed-off-by: Thomas Gleixner 
Signed-off-by: Sebastian Siewior 
---
 drivers/mtd/nand/nand_base.c |   18 ++
 include/linux/mtd/nand.h |4 ++--
 2 files changed, 20 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/mtd/nand/nand_base.c
===
--- linux-2.6.orig/drivers/mtd/nand/nand_base.c 2009-03-30 12:47:55.673721571 
+0200
+++ linux-2.6/drivers/mtd/nand/nand_base.c  2009-03-30 12:48:07.896719130 
+0200
@@ -82,6 +82,20 @@
 .length = 38}}
 };
 
+static struct nand_ecclayout nand_oob_128 = {
+   .eccbytes = 48,
+   .eccpos = {
+  80, 81, 82, 83, 84, 85, 86, 87,
+  88, 89, 90, 91, 92, 93, 94, 95,
+  96, 97, 98, 99, 100, 101, 102, 103,
+  104, 105, 106, 107, 108, 109, 110, 111,
+  112, 113, 114, 115, 116, 117, 118, 119,
+  120, 121, 122, 123, 124, 125, 126, 127},
+   .oobfree = {
+   {.offset = 2,
+.length = 78}}
+};
+
 static int nand_get_device(struct nand_chip *chip, struct mtd_info *mtd,
   int new_state);
 
@@ -2555,6 +2569,9 @@
case 64:
chip->ecc.layout = &nand_oob_64;
break;
+   case 128:
+   chip->ecc.layout = &nand_oob_128;
+   break;
default:
printk(KERN_WARNING "No oob scheme defined for "
   "oobsize %d\n", mtd->oobsize);
@@ -2676,6 +2693,7 @@
break;
case 4:
case 8:
+   case 16:
mtd->subpage_sft = 2;
break;
}
Index: linux-2.6/include/linux/mtd/nand.h
===
--- linux-2.6.orig/include/linux/mtd/nand.h 2009-03-30 12:47:55.673721571 
+0200
+++ linux-2.6/include/linux/mtd/nand.h  2009-03-30 12:48:07.910718894 +0200
@@ -43,8 +43,8 @@
  * is supported now. If you add a chip with bigger oobsize/page
  * adjust this accordingly.
  */
-#define NAND_MAX_OOBSIZE   64
-#define NAND_MAX_PAGESIZE  2048
+#define NAND_MAX_OOBSIZE   128
+#define NAND_MAX_PAGESIZE  4096
 
 /*
  * Constants for hardware specific CLE/ALE/NCE function

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


[PATCH 8/8] NAND: Add support for NAND on the Socrates board

2009-03-31 Thread Wolfgang Grandegger
Signed-off-by: Ilya Yanok 
Acked-by: Wolfgang Grandegger 
---
 drivers/mtd/nand/Kconfig |6 
 drivers/mtd/nand/Makefile|1 
 drivers/mtd/nand/socrates_nand.c |  324 +++
 3 files changed, 331 insertions(+)

Index: linux-2.6/drivers/mtd/nand/Kconfig
===
--- linux-2.6.orig/drivers/mtd/nand/Kconfig 2009-03-26 17:22:32.459721679 
+0100
+++ linux-2.6/drivers/mtd/nand/Kconfig  2009-03-30 12:48:26.554740302 +0200
@@ -427,4 +427,10 @@
  Several Renesas SuperH CPU has FLCTL. This option enables support
  for NAND Flash using FLCTL. This driver support SH7723.
 
+config MTD_NAND_SOCRATES
+   tristate "Support for NAND on Socrates board"
+   depends on MTD_NAND && SOCRATES
+   help
+ Enables support for NAND Flash chips wired onto Socrates board.
+
 endif # MTD_NAND
Index: linux-2.6/drivers/mtd/nand/Makefile
===
--- linux-2.6.orig/drivers/mtd/nand/Makefile2009-03-26 17:22:32.459721679 
+0100
+++ linux-2.6/drivers/mtd/nand/Makefile 2009-03-30 12:48:26.555971204 +0200
@@ -36,5 +36,6 @@
 obj-$(CONFIG_MTD_NAND_FSL_UPM) += fsl_upm.o
 obj-$(CONFIG_MTD_NAND_SH_FLCTL)+= sh_flctl.o
 obj-$(CONFIG_MTD_NAND_MXC) += mxc_nand.o
+obj-$(CONFIG_MTD_NAND_SOCRATES)+= socrates_nand.o
 
 nand-objs := nand_base.o nand_bbt.o
Index: linux-2.6/drivers/mtd/nand/socrates_nand.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6/drivers/mtd/nand/socrates_nand.c  2009-03-30 12:48:26.560971080 
+0200
@@ -0,0 +1,324 @@
+/*
+ * drivers/mtd/nand/socrates_nand.c
+ *
+ *  Copyright (C) 2008 Ilya Yanok, Emcraft Systems
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define FPGA_NAND_CMD_MASK (0x7 << 28)
+#define FPGA_NAND_CMD_COMMAND  (0x0 << 28)
+#define FPGA_NAND_CMD_ADDR (0x1 << 28)
+#define FPGA_NAND_CMD_READ (0x2 << 28)
+#define FPGA_NAND_CMD_WRITE(0x3 << 28)
+#define FPGA_NAND_BUSY (0x1 << 15)
+#define FPGA_NAND_ENABLE   (0x1 << 31)
+#define FPGA_NAND_DATA_SHIFT   16
+
+struct socrates_nand_host {
+   struct nand_chipnand_chip;
+   struct mtd_info mtd;
+   void __iomem*io_base;
+   struct device   *dev;
+};
+
+/**
+ * socrates_nand_write_buf -  write buffer to chip
+ * @mtd:   MTD device structure
+ * @buf:   data buffer
+ * @len:   number of bytes to write
+ */
+static void socrates_nand_write_buf(struct mtd_info *mtd,
+   const uint8_t *buf, int len)
+{
+   int i;
+   struct nand_chip *this = mtd->priv;
+   struct socrates_nand_host *host = this->priv;
+
+   for (i = 0; i < len; i++) {
+   out_be32(host->io_base, FPGA_NAND_ENABLE |
+   FPGA_NAND_CMD_WRITE |
+   (buf[i] << FPGA_NAND_DATA_SHIFT));
+   }
+}
+
+/**
+ * socrates_nand_read_buf -  read chip data into buffer
+ * @mtd:   MTD device structure
+ * @buf:   buffer to store date
+ * @len:   number of bytes to read
+ */
+static void socrates_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
+{
+   int i;
+   struct nand_chip *this = mtd->priv;
+   struct socrates_nand_host *host = this->priv;
+   uint32_t val;
+
+   val = FPGA_NAND_ENABLE | FPGA_NAND_CMD_READ;
+
+   out_be32(host->io_base, val);
+   for (i = 0; i < len; i++) {
+   buf[i] = (in_be32(host->io_base) >>
+   FPGA_NAND_DATA_SHIFT) & 0xff;
+   }
+}
+
+/**
+ * socrates_nand_read_byte -  read one byte from the chip
+ * @mtd:   MTD device structure
+ */
+static uint8_t socrates_nand_read_byte(struct mtd_info *mtd)
+{
+   uint8_t byte;
+   socrates_nand_read_buf(mtd, (uint8_t *)&byte, sizeof(byte));
+   return byte;
+}
+
+/**
+ * socrates_nand_read_word -  read one word from the chip
+ * @mtd:   MTD device structure
+ */
+static uint16_t socrates_nand_read_word(struct mtd_info *mtd)
+{
+   uint16_t word;
+   socrates_nand_read_buf(mtd, (uint8_t *)&word, sizeof(word));
+   return word;
+}
+
+/**
+ * socrates_nand_verify_buf -  Verify chip data against buffer
+ * @mtd:   MTD device structure
+ * @buf:   buffer containing the data to compare
+ * @len:   number of bytes to compare
+ */
+static int socrates_nand_verify_buf(struct mtd_info *mtd, const u8 *buf,
+   int len)
+{
+   int i;
+
+   for (i = 0; i < len; i++) {
+   if (buf

[PATCH 1/3] powerpc: remove duplicated #include's

2009-03-31 Thread Huang Weiyi
Remove duplicated #include's in
  - arch/powerpc/include/asm/ps3fb.h 
  - arch/powerpc/kernel/setup-common.c

Signed-off-by: Huang Weiyi 
---
 arch/powerpc/include/asm/ps3fb.h   |1 -
 arch/powerpc/kernel/setup-common.c |1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/ps3fb.h b/arch/powerpc/include/asm/ps3fb.h
index 90dbefb..e7233a8 100644
--- a/arch/powerpc/include/asm/ps3fb.h
+++ b/arch/powerpc/include/asm/ps3fb.h
@@ -21,7 +21,6 @@
 
 #include 
 #include 
-#include 
 
 /* ioctl */
 #define PS3FB_IOCTL_SETMODE   _IOW('r',  1, int) /* set video mode */
diff --git a/arch/powerpc/kernel/setup-common.c 
b/arch/powerpc/kernel/setup-common.c
index 9774f9f..02fed27 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -36,7 +36,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.6.0.4

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


[PATCH 1/2] powerpc: i2c-mpc: preserve I2C clocking

2009-03-31 Thread Wolfgang Grandegger
The I2c node property "fsl,preserve-clocking" allows to overtake the
clock settings from the boot loader and avoids the hard-coded setting.

Signed-off-by: Wolfgang Grandegger 
---
 drivers/i2c/busses/i2c-mpc.c |   24 
 1 file changed, 16 insertions(+), 8 deletions(-)

Index: linux-2.6/drivers/i2c/busses/i2c-mpc.c
===
--- linux-2.6.orig/drivers/i2c/busses/i2c-mpc.c 2009-03-31 13:25:08.0 
+0200
+++ linux-2.6/drivers/i2c/busses/i2c-mpc.c  2009-03-31 13:28:03.0 
+0200
@@ -318,17 +318,24 @@
 {
int result = 0;
struct mpc_i2c *i2c;
+   int set_clock;
 
i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
if (!i2c)
return -ENOMEM;
 
-   if (of_get_property(op->node, "dfsrr", NULL))
-   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
-
-   if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
-   of_device_is_compatible(op->node, "mpc5200-i2c"))
-   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
+   if (of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
+   set_clock = 0;
+   } else {
+   set_clock = 1;
+
+   if (of_get_property(op->node, "dfsrr", NULL))
+   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
+
+   if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
+   of_device_is_compatible(op->node, "mpc5200-i2c"))
+   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
+   }
 
init_waitqueue_head(&i2c->queue);
 
@@ -348,8 +355,9 @@
goto fail_request;
}
}
-   
-   mpc_i2c_setclock(i2c);
+
+   if (set_clock)
+   mpc_i2c_setclock(i2c);
 
dev_set_drvdata(&op->dev, i2c);
 

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


[PATCH 0/2] test

2009-03-31 Thread Wolfgang Grandegger
test 

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


[PATCH 2/2] powerpc: i2c-mpc: make I2C bus speed configurable

2009-03-31 Thread Wolfgang Grandegger
This patch makes the I2C bus speed configurable by using the I2C node
property "clock-frequency". If the property is not defined, the old
fixed clock settings will be used for backward comptibility.

The generic I2C clock properties, especially the CPU-specific source
clock pre-scaler are defined via the OF match table:

  static const struct of_device_id mpc_i2c_of_match[] = {
{.compatible = "fsl,mpc5200b-i2c",
 .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
{.compatible = "fsl,mpc5200-i2c",
 .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
{.compatible = "fsl,mpc8313-i2c",
 .data = (void *)FSL_I2C_DEV_SEPARATE_DFSRR, },
{.compatible = "fsl,mpc8543-i2c",
 .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
  FSL_I2C_DEV_CLOCK_DIV2), },
{.compatible = "fsl,mpc8544-i2c",
 .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
  FSL_I2C_DEV_CLOCK_DIV23), },
/* Backward compatibility */
{.compatible = "fsl-i2c", },
{},
  };

The "data" field defines the relevant I2C flags for the comptible CPU.

It used arch-specific tables and functions to determine the proper
Freqency Divider Register (fdr).

Furthermore dev_dbg() and dev_info() are now used to profit from a more
comprehensive output.

Signed-off-by: Wolfgang Grandegger 
---
 arch/powerpc/platforms/52xx/mpc52xx_common.c |   48 
 arch/powerpc/sysdev/fsl_soc.c|   90 +++
 drivers/i2c/busses/i2c-mpc.c |  104 +++
 include/linux/fsl_devices.h  |6 +
 4 files changed, 221 insertions(+), 27 deletions(-)

Index: linux-2.6/drivers/i2c/busses/i2c-mpc.c
===
--- linux-2.6.orig/drivers/i2c/busses/i2c-mpc.c 2009-03-31 13:28:03.0 
+0200
+++ linux-2.6/drivers/i2c/busses/i2c-mpc.c  2009-03-31 13:38:01.355720989 
+0200
@@ -20,12 +20,14 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+#include 
+
 #define DRV_NAME "mpc-i2c"
 
 #define MPC_I2C_FDR0x04
@@ -50,6 +52,7 @@
 #define CSR_RXAK 0x01
 
 struct mpc_i2c {
+   struct device *dev;
void __iomem *base;
u32 interrupt;
wait_queue_head_t queue;
@@ -105,7 +108,7 @@
while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) {
schedule();
if (time_after(jiffies, orig_jiffies + timeout)) {
-   pr_debug("I2C: timeout\n");
+   dev_dbg(i2c->dev, "timeout\n");
writeccr(i2c, 0);
result = -EIO;
break;
@@ -119,10 +122,10 @@
(i2c->interrupt & CSR_MIF), timeout * HZ);
 
if (unlikely(result < 0)) {
-   pr_debug("I2C: wait interrupted\n");
+   dev_dbg(i2c->dev, "wait interrupted\n");
writeccr(i2c, 0);
} else if (unlikely(!(i2c->interrupt & CSR_MIF))) {
-   pr_debug("I2C: wait timeout\n");
+   dev_dbg(i2c->dev, "wait timeout\n");
writeccr(i2c, 0);
result = -ETIMEDOUT;
}
@@ -135,17 +138,17 @@
return result;
 
if (!(x & CSR_MCF)) {
-   pr_debug("I2C: unfinished\n");
+   dev_dbg(i2c->dev, "unfinished\n");
return -EIO;
}
 
if (x & CSR_MAL) {
-   pr_debug("I2C: MAL\n");
+   dev_dbg(i2c->dev, "MAL\n");
return -EIO;
}
 
if (writing && (x & CSR_RXAK)) {
-   pr_debug("I2C: No RXAK\n");
+   dev_dbg(i2c->dev, "No RXAK\n");
/* generate stop */
writeccr(i2c, CCR_MEN);
return -EIO;
@@ -153,17 +156,38 @@
return 0;
 }
 
-static void mpc_i2c_setclock(struct mpc_i2c *i2c)
+static void mpc_i2c_setclock(struct device_node *node,
+struct mpc_i2c *i2c, u32 clock)
 {
-   /* Set clock and filters */
-   if (i2c->flags & FSL_I2C_DEV_SEPARATE_DFSRR) {
-   writeb(0x31, i2c->base + MPC_I2C_FDR);
-   writeb(0x10, i2c->base + MPC_I2C_DFSRR);
-   } else if (i2c->flags & FSL_I2C_DEV_CLOCK_5200)
-   writeb(0x3f, i2c->base + MPC_I2C_FDR);
-   else
-   writel(0x1031, i2c->base + MPC_I2C_FDR);
-}
+   int fdr;
+
+   fdr = fsl_i2c_get_fdr(node, clock, i2c->flags);
+
+   if (i2c->flags & FSL_I2C_DEV_CLOCK_5200) {
+   pr_debug("I2C: old fdr=%d\n", readb(i2c->base + MPC_I2C_FDR));
+   if (fdr < 0)
+   fdr = 0x3f; /* backward compatibility */
+   writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR);
+   dev_i

Re: [PATCH 0/8] powerpc: i2c-mpc: make I2C bus speed configurable

2009-03-31 Thread Wolfgang Grandegger
Please *FORGET* this series of patches. Only the I2C related patches are
relevant but I accidentally sent out the complete patch stack :-(. I
will resent them in a second.

Sorry for any inconvenience this has caused.

Wolfgang.

Wolfgang Grandegger wrote:
> Following (most of) Grant's suggestions to my RFC:
> 
> http://ozlabs.org/pipermail/linuxppc-dev/2009-March/069820.html
> 
> this new patch series now uses:
> 
> - the I2c node property "fsl,preserve-clocking" to overtake the
>   clock settings from the boot loader. The first patch provides this
>   feature and can be applied *without* delay. This rest will take
>   more time and discussion, I'm afraid :-(.
> 
> - the OF match table to define the I2C clock properties, especially
>   the source clock pre-scaler:
> 
>   static const struct of_device_id mpc_i2c_of_match[] = {
>   {.compatible = "fsl,mpc5200b-i2c",
>.data = (void *)FSL_I2C_DEV_CLOCK_5200, },
>   {.compatible = "fsl,mpc5200-i2c",
>.data = (void *)FSL_I2C_DEV_CLOCK_5200, },
>   {.compatible = "fsl,mpc8313-i2c",
>.data = (void *)FSL_I2C_DEV_SEPARATE_DFSRR, },
>   {.compatible = "fsl,mpc8543-i2c",
>.data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
> FSL_I2C_DEV_CLOCK_DIV2), },
>   {.compatible = "fsl,mpc8544-i2c",
>.data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
> FSL_I2C_DEV_CLOCK_DIV23), },
>   /* Backward compatibility */
>   {.compatible = "fsl-i2c", },
>   {},
>   };
> 
>   The "data" field defines the relevant I2C flags.
> 
> - arch-specific tables and functions to get the proper Freqency
>   Divider Register (fdr). I added them to sysdev/fsl_soc.c for
>   the MPC8xxx and to platforms/52xx/mpc52xx_common.c for the
>   MPC52xx. This also solves the problem with arch-specific
>   functions, e.g. for getting the bus frequency.
> 
> - dev_dbg() and dev_info() to profit from a more descriptive output.
> 
> Hope this solution is OK now?
> 
> Thanks,
> 
> Wolfgang.
> 
> 
> ___
> 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


configuring the DMA for using the SCPLC on the MPC5121

2009-03-31 Thread Jacquemin, Jean-Philippe
Dear all,
 
I am trying to configure the MPC5121 to perform DMA transfers from the
CPU RAM to the RAM of an FPGA attached on ChipSelect 2.
I have to use the LocalPlus Bus and configure the chipselect2 for bust
mode and non-multiplexed.
I also have to configure a DMA task to copy the content of my buffer to
the local bus Fifo and then kick this content to the wanted address on
chipselect 2.
 
I have some code (thanks to Grant Likely) to implement a LocalPlus Bus
Fifo driver (SCPLC) but have no clue how to configure the DMA for using
the SCPLC... Can someone help me??
 
The 5121 fifo is directly derived from the 5200 fifo, only it is :
* deeper (1024bytes instead of 512), 
* up to 56 bytes can be transfered with one transaction
* increased SCPLC packet size register to 31 bits
 
 
best regards,
 
 
Jean-Philippe Jacquemin
Sofware Engineer
Barco Media & Entertainment Division
Noordlaan 5
B-8520 Kurrne, Belgium
Tel : +32 56 36 82 28
Fax : +32 56 36 88 62
 


DISCLAIMER:
Unless indicated otherwise, the information contained in this message is 
privileged and confidential, and is intended only for the use of the 
addressee(s) named above and others who have been specifically authorized to 
receive it. If you are not the intended recipient, you are hereby notified that 
any dissemination, distribution or copying of this message and/or attachments 
is strictly prohibited. The company accepts no liability for any damage caused 
by any virus transmitted by this email. Furthermore, the company does not 
warrant a proper and complete transmission of this information, nor does it 
accept liability for any delays. If you have received this message in error, 
please contact the sender and delete the message. Thank you.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[PATCH 0/2] powerpc: i2c-mpc: make I2C bus speed configurable

2009-03-31 Thread Wolfgang Grandegger
Following (most of) Grant's suggestions to my RFC:

http://ozlabs.org/pipermail/linuxppc-dev/2009-March/069820.html

this new patch series now uses:

- the I2c node property "fsl,preserve-clocking" to overtake the
  clock settings from the boot loader. The first patch provides this
  feature and can be applied *without* delay. This rest will take
  more time and discussion, I'm afraid  :-( .

- the OF match table to define the I2C clock properties, especially
  the source clock pre-scaler:

  static const struct of_device_id mpc_i2c_of_match[] = {
{.compatible = "fsl,mpc5200b-i2c",
 .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
{.compatible = "fsl,mpc5200-i2c",
 .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
{.compatible = "fsl,mpc8313-i2c",
 .data = (void *)FSL_I2C_DEV_SEPARATE_DFSRR, },
{.compatible = "fsl,mpc8543-i2c",
 .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
  FSL_I2C_DEV_CLOCK_DIV2), },
{.compatible = "fsl,mpc8544-i2c",
 .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
  FSL_I2C_DEV_CLOCK_DIV23), },
/* Backward compatibility */
{.compatible = "fsl-i2c", },
{},
  };

  The "data" field defines the relevant I2C flags.

- arch-specific tables and functions to get the proper Freqency
  Divider Register (fdr). I added them to sysdev/fsl_soc.c for
  the MPC8xxx and to platforms/52xx/mpc52xx_common.c for the
  MPC52xx. This also solves the problem with arch-specific
  functions, e.g. for getting the bus frequency.

- dev_dbg() and dev_info() to profit from a more descriptive output.

Hope this solution is OK now?

Thanks,

Wolfgang.

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


[PATCH 2/2] powerpc: i2c-mpc: make I2C bus speed configurable

2009-03-31 Thread Wolfgang Grandegger
This patch makes the I2C bus speed configurable by using the I2C node
property "clock-frequency". If the property is not defined, the old
fixed clock settings will be used for backward comptibility.

The generic I2C clock properties, especially the CPU-specific source
clock pre-scaler are defined via the OF match table:

  static const struct of_device_id mpc_i2c_of_match[] = {
{.compatible = "fsl,mpc5200b-i2c",
 .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
{.compatible = "fsl,mpc5200-i2c",
 .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
{.compatible = "fsl,mpc8313-i2c",
 .data = (void *)FSL_I2C_DEV_SEPARATE_DFSRR, },
{.compatible = "fsl,mpc8543-i2c",
 .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
  FSL_I2C_DEV_CLOCK_DIV2), },
{.compatible = "fsl,mpc8544-i2c",
 .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
  FSL_I2C_DEV_CLOCK_DIV23), },
/* Backward compatibility */
{.compatible = "fsl-i2c", },
{},
  };

The "data" field defines the relevant I2C flags for the comptible CPU.

It used arch-specific tables and functions to determine the proper
Freqency Divider Register (fdr).

Furthermore dev_dbg() and dev_info() are now used to profit from a more
comprehensive output.

Signed-off-by: Wolfgang Grandegger 
---
 arch/powerpc/platforms/52xx/mpc52xx_common.c |   48 
 arch/powerpc/sysdev/fsl_soc.c|   90 +++
 drivers/i2c/busses/i2c-mpc.c |  104 +++
 include/linux/fsl_devices.h  |6 +
 4 files changed, 221 insertions(+), 27 deletions(-)

Index: linux-2.6/drivers/i2c/busses/i2c-mpc.c
===
--- linux-2.6.orig/drivers/i2c/busses/i2c-mpc.c 2009-03-31 13:28:03.0 
+0200
+++ linux-2.6/drivers/i2c/busses/i2c-mpc.c  2009-03-31 13:38:01.355720989 
+0200
@@ -20,12 +20,14 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+#include 
+
 #define DRV_NAME "mpc-i2c"
 
 #define MPC_I2C_FDR0x04
@@ -50,6 +52,7 @@
 #define CSR_RXAK 0x01
 
 struct mpc_i2c {
+   struct device *dev;
void __iomem *base;
u32 interrupt;
wait_queue_head_t queue;
@@ -105,7 +108,7 @@
while (!(readb(i2c->base + MPC_I2C_SR) & CSR_MIF)) {
schedule();
if (time_after(jiffies, orig_jiffies + timeout)) {
-   pr_debug("I2C: timeout\n");
+   dev_dbg(i2c->dev, "timeout\n");
writeccr(i2c, 0);
result = -EIO;
break;
@@ -119,10 +122,10 @@
(i2c->interrupt & CSR_MIF), timeout * HZ);
 
if (unlikely(result < 0)) {
-   pr_debug("I2C: wait interrupted\n");
+   dev_dbg(i2c->dev, "wait interrupted\n");
writeccr(i2c, 0);
} else if (unlikely(!(i2c->interrupt & CSR_MIF))) {
-   pr_debug("I2C: wait timeout\n");
+   dev_dbg(i2c->dev, "wait timeout\n");
writeccr(i2c, 0);
result = -ETIMEDOUT;
}
@@ -135,17 +138,17 @@
return result;
 
if (!(x & CSR_MCF)) {
-   pr_debug("I2C: unfinished\n");
+   dev_dbg(i2c->dev, "unfinished\n");
return -EIO;
}
 
if (x & CSR_MAL) {
-   pr_debug("I2C: MAL\n");
+   dev_dbg(i2c->dev, "MAL\n");
return -EIO;
}
 
if (writing && (x & CSR_RXAK)) {
-   pr_debug("I2C: No RXAK\n");
+   dev_dbg(i2c->dev, "No RXAK\n");
/* generate stop */
writeccr(i2c, CCR_MEN);
return -EIO;
@@ -153,17 +156,38 @@
return 0;
 }
 
-static void mpc_i2c_setclock(struct mpc_i2c *i2c)
+static void mpc_i2c_setclock(struct device_node *node,
+struct mpc_i2c *i2c, u32 clock)
 {
-   /* Set clock and filters */
-   if (i2c->flags & FSL_I2C_DEV_SEPARATE_DFSRR) {
-   writeb(0x31, i2c->base + MPC_I2C_FDR);
-   writeb(0x10, i2c->base + MPC_I2C_DFSRR);
-   } else if (i2c->flags & FSL_I2C_DEV_CLOCK_5200)
-   writeb(0x3f, i2c->base + MPC_I2C_FDR);
-   else
-   writel(0x1031, i2c->base + MPC_I2C_FDR);
-}
+   int fdr;
+
+   fdr = fsl_i2c_get_fdr(node, clock, i2c->flags);
+
+   if (i2c->flags & FSL_I2C_DEV_CLOCK_5200) {
+   pr_debug("I2C: old fdr=%d\n", readb(i2c->base + MPC_I2C_FDR));
+   if (fdr < 0)
+   fdr = 0x3f; /* backward compatibility */
+   writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR);
+   dev_i

Re: please disable several items in 44x/canyonlands_defconfig

2009-03-31 Thread Josh Boyer
On Tue, Mar 31, 2009 at 10:16:01AM +0800, Cheng Renquan wrote:
>These 3 items are generally not used in 44x/canyonlands board, please
>consider disable them when you change 44x/canyonlands_defconfig next
>time,
>
>CONFIG_PCI_LEGACY
>CONFIG_DAB
>CONFIG_VIDEO_OUTPUT_CONTROL

I've done a bit broader patch that did this for the rest of the 4xx boards
as well.  It should be sitting in my -next tree.

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


Re: 8641D with linux 2.6.29 did'n show second cpu

2009-03-31 Thread Kumar Gala


On Mar 31, 2009, at 5:15 AM, Eduard Fuchs wrote:


Hi,

I'm testing the evaluation board from freescale (MPC8641DHPCN) with  
the latest
linux kernel (2.6.29) and the second core seems disabled. CONFIG_SPM  
is
enabled but the /proc/cpuinfo shows only one cpu. With original  
2.6.27 kernel

both cpu cores appears in /proc/cpuinfo.

Has anyone an idea how can i enable the second core?


Are you using u-boot?  I can't remember if you need a newer u-boot to  
deal with changes in how we bring up the second core.


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


Re: powerpc/85xx: Add support for the "socrates" board (MPC8544)

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 3:35 AM, Wolfgang Grandegger  
wrote:
> Grant Likely wrote:
>> I agree 100% with David's comments, and I have some additional ones below.
>>
>> On Thu, Mar 19, 2009 at 9:26 AM, Wolfgang Grandegger  
>> wrote:
>>> +       soc8...@e000 {
>>> +               #address-cells = <1>;
>>> +               #size-cells = <1>;
>>> +               device_type = "soc";
>>
>> Drop device_type here too.
>
> Grrr, I just realized that removing the devices type "soc" has broken
> fsl_get_sys_freq(). See:
>
> http://lxr.linux.no/linux+v2.6.29/arch/powerpc/sysdev/fsl_soc.c#L80
>
> We need a quick fix and we could take the occasion to establish a common
> function for the MPC52xx as well, but it's not obvious to me how to find
> the SOC node without the device type property.

SoC node should have a compatible property, just like everything else.

compatible = "fsl,mpc8544-immr";  (immr == Internally Memory Mapped Registers)

Many other boards already do this.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] Add hvc_console to MAINTAINERS

2009-03-31 Thread Josh Boyer
Add a MAINTAINERS entry for the hypervisor virtual console support
used on IBM POWER servers.

Signed-off-by: Josh Boyer 
---

diff --git a/MAINTAINERS b/MAINTAINERS
index c5f4e9d..387ad45 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2176,6 +2176,11 @@ W:   http://www.ia64-linux.org/
 T: git kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
 S: Maintained
 
+IBM HYPERVISOR VIRTUAL CONSOLE
+P: Several
+L: linuxppc-dev@ozlabs.org
+S: Maintained
+
 IBM MCA SCSI SUBSYSTEM DRIVER
 P: Michael Lang
 M: lan...@kph.uni-mainz.de

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


Re: [PATCH] powerpc: Make LOWMEM_CAM_NUM depend on FSL_BOOKE

2009-03-31 Thread Kumar Gala


On Mar 31, 2009, at 7:05 AM, Josh Boyer wrote:


The recent addition of CONFIG_LOWMEM_CAM_BOOL and
CONFIG_LOWMEM_CAM_NUM cause the latter to show up in configs
that do not need it during 'make oldconfig'.  Make LOWMEM_CAM_NUM
depend on FSL_BOOKE.

Signed-off-by: Josh Boyer 

---


fixed up an applied

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


Re: [PATCH] powerpc: Remove unused symbols from fsl_devices.h

2009-03-31 Thread Kumar Gala


On Mar 28, 2009, at 4:07 PM, Grant Likely wrote:


From: Grant Likely 

Remove old artifacts leftover from the platform driver gianfar and
fsl_i2c drivers.  These symbols became unused when the drivers
were migrated over to use the of_platform bus.

Signed-off-by: Grant Likely 
---

include/linux/fsl_devices.h |   22 --
1 files changed, 0 insertions(+), 22 deletions(-)



applied

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


Re: powerpc/85xx: Add support for the "socrates" board (MPC8544)

2009-03-31 Thread Wolfgang Grandegger
Grant Likely wrote:
> On Tue, Mar 31, 2009 at 3:35 AM, Wolfgang Grandegger  
> wrote:
>> Grant Likely wrote:
>>> I agree 100% with David's comments, and I have some additional ones below.
>>>
>>> On Thu, Mar 19, 2009 at 9:26 AM, Wolfgang Grandegger  
>>> wrote:
 +   soc8...@e000 {
 +   #address-cells = <1>;
 +   #size-cells = <1>;
 +   device_type = "soc";
>>> Drop device_type here too.
>> Grrr, I just realized that removing the devices type "soc" has broken
>> fsl_get_sys_freq(). See:
>>
>> http://lxr.linux.no/linux+v2.6.29/arch/powerpc/sysdev/fsl_soc.c#L80
>>
>> We need a quick fix and we could take the occasion to establish a common
>> function for the MPC52xx as well, but it's not obvious to me how to find
>> the SOC node without the device type property.
> 
> SoC node should have a compatible property, just like everything else.
> 
> compatible = "fsl,mpc8544-immr";  (immr == Internally Memory Mapped Registers)
> 
> Many other boards already do this.

Yes, it does, but searching for the SOC node is not straight-forward
because there is no common compatibility string but many CPU-specific
compatibility strings, e.g. "fsl,mpc8560-immr", etc. Have I missed
something?

Unfortunately, other 85xx functions search for the device type "soc" as
well. Therefore I think we must keep the devices type "soc" for the time
being. Kumar?

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


Re: [PATCH 1/2] powerpc: i2c-mpc: preserve I2C clocking

2009-03-31 Thread Wolfram Sang
On Tue, Mar 31, 2009 at 02:50:29PM +0200, Wolfgang Grandegger wrote:
> The I2c node property "fsl,preserve-clocking" allows to overtake the
> clock settings from the boot loader and avoids the hard-coded setting.
> 
> Signed-off-by: Wolfgang Grandegger 
> ---
>  drivers/i2c/busses/i2c-mpc.c |   24 
>  1 file changed, 16 insertions(+), 8 deletions(-)
> 
> Index: linux-2.6/drivers/i2c/busses/i2c-mpc.c
> ===
> --- linux-2.6.orig/drivers/i2c/busses/i2c-mpc.c   2009-03-31 
> 13:25:08.0 +0200
> +++ linux-2.6/drivers/i2c/busses/i2c-mpc.c2009-03-31 13:28:03.0 
> +0200
> @@ -318,17 +318,24 @@
>  {
>   int result = 0;
>   struct mpc_i2c *i2c;
> + int set_clock;
>  
>   i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
>   if (!i2c)
>   return -ENOMEM;
>  
> - if (of_get_property(op->node, "dfsrr", NULL))
> - i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
> -
> - if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
> - of_device_is_compatible(op->node, "mpc5200-i2c"))
> - i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
> + if (of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
> + set_clock = 0;
> + } else {
> + set_clock = 1;
> +
> + if (of_get_property(op->node, "dfsrr", NULL))
> + i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
> +
> + if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
> + of_device_is_compatible(op->node, "mpc5200-i2c"))
> + i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
> + }
>  
>   init_waitqueue_head(&i2c->queue);
>  
> @@ -348,8 +355,9 @@
>   goto fail_request;
>   }
>   }
> - 
> - mpc_i2c_setclock(i2c);
> +
> + if (set_clock)
> + mpc_i2c_setclock(i2c);

Can't we drop 'set_clock' with something like this here?

+   if (!of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
+
+   if (of_get_property(op->node, "dfsrr", NULL))
+   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
+
+   if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
+   of_device_is_compatible(op->node, "mpc5200-i2c"))
+   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
+
+   mpc_i2c_setclock(i2c);
+   }

>  
>   dev_set_drvdata(&op->dev, i2c);
>  
> 
> ___
> devicetree-discuss mailing list
> devicetree-disc...@ozlabs.org
> https://ozlabs.org/mailman/listinfo/devicetree-discuss

Regards,

   Wolfram

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


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

[PATCH 1/2] powerpc: i2c-mpc: preserve I2C clocking

2009-03-31 Thread Wolfgang Grandegger
The I2c node property "fsl,preserve-clocking" allows to overtake the
clock settings from the boot loader and avoids the hard-coded setting.

Signed-off-by: Wolfgang Grandegger 
---
 drivers/i2c/busses/i2c-mpc.c |   24 
 1 file changed, 16 insertions(+), 8 deletions(-)

Index: linux-2.6/drivers/i2c/busses/i2c-mpc.c
===
--- linux-2.6.orig/drivers/i2c/busses/i2c-mpc.c 2009-03-31 13:25:08.0 
+0200
+++ linux-2.6/drivers/i2c/busses/i2c-mpc.c  2009-03-31 13:28:03.0 
+0200
@@ -318,17 +318,24 @@
 {
int result = 0;
struct mpc_i2c *i2c;
+   int set_clock;
 
i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
if (!i2c)
return -ENOMEM;
 
-   if (of_get_property(op->node, "dfsrr", NULL))
-   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
-
-   if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
-   of_device_is_compatible(op->node, "mpc5200-i2c"))
-   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
+   if (of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
+   set_clock = 0;
+   } else {
+   set_clock = 1;
+
+   if (of_get_property(op->node, "dfsrr", NULL))
+   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
+
+   if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
+   of_device_is_compatible(op->node, "mpc5200-i2c"))
+   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
+   }
 
init_waitqueue_head(&i2c->queue);
 
@@ -348,8 +355,9 @@
goto fail_request;
}
}
-   
-   mpc_i2c_setclock(i2c);
+
+   if (set_clock)
+   mpc_i2c_setclock(i2c);
 
dev_set_drvdata(&op->dev, i2c);
 

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


[PATCH 1/2] gianfar: Remove unused header

2009-03-31 Thread Kumar Gala
Now that the driver is exclusively an of_platform driver we no longer
use the structs and #defines in fsl_devices.h

Signed-off-by: Kumar Gala 
---
 drivers/net/gianfar.h |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index dd499d7..0642d52 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -45,7 +45,6 @@
 #include 
 #include 
 #include 
-#include 
 
 /* The maximum number of packets to be handled in one call of gfar_poll */
 #define GFAR_DEV_WEIGHT 64
-- 
1.5.6.6

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


[PATCH 2/2] ucc_geth: Remove unused header

2009-03-31 Thread Kumar Gala
Now that the driver is exclusively an of_platform driver we no longer
use the structs and #defines in fsl_devices.h

Signed-off-by: Kumar Gala 
---
 drivers/net/ucc_geth.c |1 -
 drivers/net/ucc_geth.h |1 -
 drivers/net/ucc_geth_ethtool.c |1 -
 3 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 933fcfb..a124615 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index e3a25e6..48fde5a 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -20,7 +20,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 #include 
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index a755bea..6fcb500 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.5.6.6

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


Re: [PATCH 1/2] powerpc: i2c-mpc: preserve I2C clocking

2009-03-31 Thread Wolfgang Grandegger
Wolfram Sang wrote:
> On Tue, Mar 31, 2009 at 02:50:29PM +0200, Wolfgang Grandegger wrote:
>> The I2c node property "fsl,preserve-clocking" allows to overtake the
>> clock settings from the boot loader and avoids the hard-coded setting.
>>
>> Signed-off-by: Wolfgang Grandegger 
>> ---
>>  drivers/i2c/busses/i2c-mpc.c |   24 
>>  1 file changed, 16 insertions(+), 8 deletions(-)
>>
>> Index: linux-2.6/drivers/i2c/busses/i2c-mpc.c
>> ===
>> --- linux-2.6.orig/drivers/i2c/busses/i2c-mpc.c  2009-03-31 
>> 13:25:08.0 +0200
>> +++ linux-2.6/drivers/i2c/busses/i2c-mpc.c   2009-03-31 13:28:03.0 
>> +0200
>> @@ -318,17 +318,24 @@
>>  {
>>  int result = 0;
>>  struct mpc_i2c *i2c;
>> +int set_clock;
>>  
>>  i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
>>  if (!i2c)
>>  return -ENOMEM;
>>  
>> -if (of_get_property(op->node, "dfsrr", NULL))
>> -i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
>> -
>> -if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
>> -of_device_is_compatible(op->node, "mpc5200-i2c"))
>> -i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
>> +if (of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
>> +set_clock = 0;
>> +} else {
>> +set_clock = 1;
>> +
>> +if (of_get_property(op->node, "dfsrr", NULL))
>> +i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
>> +
>> +if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
>> +of_device_is_compatible(op->node, "mpc5200-i2c"))
>> +i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
>> +}
>>  
>>  init_waitqueue_head(&i2c->queue);
>>  
>> @@ -348,8 +355,9 @@
>>  goto fail_request;
>>  }
>>  }
>> -
>> -mpc_i2c_setclock(i2c);
>> +
>> +if (set_clock)
>> +mpc_i2c_setclock(i2c);
> 
> Can't we drop 'set_clock' with something like this here?
> 
> + if (!of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
> +
> + if (of_get_property(op->node, "dfsrr", NULL))
> + i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
> +
> + if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
> + of_device_is_compatible(op->node, "mpc5200-i2c"))
> + i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
> +
> + mpc_i2c_setclock(i2c);
> + }

No, because the I2C registers are not yet mapped.

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


[PATCH] powerpc/85xx: Use fsl, mpc85.. as prefix for memory ctrl & l2-cache nodes

2009-03-31 Thread Kumar Gala
Older devices tree's used "fsl,85.." instead of the preferred
"fsl,mpc85.." for the memory controller & l2 cache controller nodes.
The EDAC code is the only use of these and has been updated for some
time to support both "fsl,85.." and "fsl,mpc85.."

Signed-off-by: Kumar Gala 
---
 arch/powerpc/boot/dts/ksi8560.dts  |4 ++--
 arch/powerpc/boot/dts/sbc8548.dts  |4 ++--
 arch/powerpc/boot/dts/sbc8560.dts  |4 ++--
 arch/powerpc/boot/dts/stx_gp3_8560.dts |4 ++--
 arch/powerpc/boot/dts/tqm8540.dts  |4 ++--
 arch/powerpc/boot/dts/tqm8541.dts  |4 ++--
 arch/powerpc/boot/dts/tqm8555.dts  |4 ++--
 arch/powerpc/boot/dts/tqm8560.dts  |4 ++--
 8 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/boot/dts/ksi8560.dts 
b/arch/powerpc/boot/dts/ksi8560.dts
index 308fe7c..c9cfd37 100644
--- a/arch/powerpc/boot/dts/ksi8560.dts
+++ b/arch/powerpc/boot/dts/ksi8560.dts
@@ -57,14 +57,14 @@
bus-frequency = <0>;/* Fixed by 
bootwrapper */
 
memory-control...@2000 {
-   compatible = "fsl,8540-memory-controller";
+   compatible = "fsl,mpc8540-memory-controller";
reg = <0x2000 0x1000>;
interrupt-parent = <&mpic>;
interrupts = <0x12 0x2>;
};
 
L2: l2-cache-control...@2 {
-   compatible = "fsl,8540-l2-cache-controller";
+   compatible = "fsl,mpc8540-l2-cache-controller";
reg = <0x2 0x1000>;
cache-line-size = <0x20>;   /* 32 bytes */
cache-size = <0x4>; /* L2, 256K */
diff --git a/arch/powerpc/boot/dts/sbc8548.dts 
b/arch/powerpc/boot/dts/sbc8548.dts
index 9c5079f..b1f1416 100644
--- a/arch/powerpc/boot/dts/sbc8548.dts
+++ b/arch/powerpc/boot/dts/sbc8548.dts
@@ -156,14 +156,14 @@
compatible = "simple-bus";
 
memory-control...@2000 {
-   compatible = "fsl,8548-memory-controller";
+   compatible = "fsl,mpc8548-memory-controller";
reg = <0x2000 0x1000>;
interrupt-parent = <&mpic>;
interrupts = <0x12 0x2>;
};
 
L2: l2-cache-control...@2 {
-   compatible = "fsl,8548-l2-cache-controller";
+   compatible = "fsl,mpc8548-l2-cache-controller";
reg = <0x2 0x1000>;
cache-line-size = <0x20>;   // 32 bytes
cache-size = <0x8>; // L2, 512K
diff --git a/arch/powerpc/boot/dts/sbc8560.dts 
b/arch/powerpc/boot/dts/sbc8560.dts
index b772405..c4564b8 100644
--- a/arch/powerpc/boot/dts/sbc8560.dts
+++ b/arch/powerpc/boot/dts/sbc8560.dts
@@ -61,14 +61,14 @@
clock-frequency = <0>;
 
memory-control...@2000 {
-   compatible = "fsl,8560-memory-controller";
+   compatible = "fsl,mpc8560-memory-controller";
reg = <0x2000 0x1000>;
interrupt-parent = <&mpic>;
interrupts = <0x12 0x2>;
};
 
L2: l2-cache-control...@2 {
-   compatible = "fsl,8560-l2-cache-controller";
+   compatible = "fsl,mpc8560-l2-cache-controller";
reg = <0x2 0x1000>;
cache-line-size = <0x20>;   // 32 bytes
cache-size = <0x4>; // L2, 256K
diff --git a/arch/powerpc/boot/dts/stx_gp3_8560.dts 
b/arch/powerpc/boot/dts/stx_gp3_8560.dts
index 8b17395..ea6b151 100644
--- a/arch/powerpc/boot/dts/stx_gp3_8560.dts
+++ b/arch/powerpc/boot/dts/stx_gp3_8560.dts
@@ -57,14 +57,14 @@
compatible = "fsl,mpc8560-immr", "simple-bus";
 
memory-control...@2000 {
-   compatible = "fsl,8540-memory-controller";
+   compatible = "fsl,mpc8540-memory-controller";
reg = <0x2000 0x1000>;
interrupt-parent = <&mpic>;
interrupts = <18 2>;
};
 
L2: l2-cache-control...@2 {
-   compatible = "fsl,8540-l2-cache-controller";
+   compatible = "fsl,mpc8540-l2-cache-controller";
reg = <0x2 0x1000>;
cache-line-size = <32>;
cache-size = <0x4>; // L2, 256K
diff --git a/arch/powerpc/boot/dts/tqm8540.dts 
b/arch/powerpc/boot/dts/tqm8540.dts
index ac9413a..231bae7 100644
--- a/arch/powerpc/boot/dts/tqm8540.dts
+++ b/arch/powerpc/boot/dts/tqm8540.dts
@@ -59,14 +59,14 @@
compatible = "fsl,mpc8540-immr", 

Re: [PATCH 1/2] powerpc: i2c-mpc: preserve I2C clocking

2009-03-31 Thread Wolfram Sang

> >> -  
> >> -  mpc_i2c_setclock(i2c);
> >> +
> >> +  if (set_clock)
> >> +  mpc_i2c_setclock(i2c);
> > 
> > Can't we drop 'set_clock' with something like this here?
> > 
> > +   if (!of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
> > +
> > +   if (of_get_property(op->node, "dfsrr", NULL))
> > +   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
> > +
> > +   if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
> > +   of_device_is_compatible(op->node, "mpc5200-i2c"))
> > +   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
> > +
> > +   mpc_i2c_setclock(i2c);
> > +   }
> 
> No, because the I2C registers are not yet mapped.

Sorry, I used misleading words :) With 'here' I meant 'at this
position', i.e. insert my above block where mpc_i2c_setclock was used
anyway.

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


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

[PATCH v3] powerpc: Add support for CoreInt delivery of interrupts on MPIC

2009-03-31 Thread Kumar Gala
CoreInt provides a mechansim to deliver the IRQ vector directly
into the core on an interrupt (via the SPR EPR) rather than having
to go IACK on the PIC.  This is suppose to provide an improvment
in interrupt latency by reducing the time to get the IRQ vector.

Signed-off-by: Kumar Gala 
---
Ben, this version is pretty much identical to v2 with the following changes.
Please look to pull it into your tree for .30

* Add comment about mode field on FSL mpics
* Fixed build issue on non-booke parts since SPRN_EPR doesn't exist there

 arch/powerpc/include/asm/mpic.h |   12 
 arch/powerpc/sysdev/mpic.c  |   34 ++
 2 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
index c2ccca5..a002682 100644
--- a/arch/powerpc/include/asm/mpic.h
+++ b/arch/powerpc/include/asm/mpic.h
@@ -22,6 +22,14 @@
 #define MPIC_GREG_FEATURE_10x00010
 #define MPIC_GREG_GLOBAL_CONF_00x00020
 #defineMPIC_GREG_GCONF_RESET   0x8000
+/* On the FSL mpic implementations the Mode field is expand to be
+ * 2 bits wide:
+ * 0b00 = pass through (interrupts routed to IRQ0)
+ * 0b01 = Mixed mode
+ * 0b10 = reserved
+ * 0b11 = External proxy / coreint
+ */
+#defineMPIC_GREG_GCONF_COREINT 0x6000
 #defineMPIC_GREG_GCONF_8259_PTHROU_DIS 0x2000
 #defineMPIC_GREG_GCONF_NO_BIAS 0x1000
 #defineMPIC_GREG_GCONF_BASE_MASK   0x000f
@@ -357,6 +365,8 @@ struct mpic
 #define MPIC_BROKEN_FRR_NIRQS  0x0800
 /* Destination only supports a single CPU at a time */
 #define MPIC_SINGLE_DEST_CPU   0x1000
+/* Enable CoreInt delivery of interrupts */
+#define MPIC_ENABLE_COREINT0x2000
 
 /* MPIC HW modification ID */
 #define MPIC_REGSET_MASK   0xf000
@@ -470,6 +480,8 @@ extern void mpic_end_irq(unsigned int irq);
 extern unsigned int mpic_get_one_irq(struct mpic *mpic);
 /* This one gets from the primary mpic */
 extern unsigned int mpic_get_irq(void);
+/* This one gets from the primary mpic via CoreInt*/
+extern unsigned int mpic_get_coreint_irq(void);
 /* Fetch Machine Check interrupt from primary mpic */
 extern unsigned int mpic_get_mcirq(void);
 
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 532e205..21b9567 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1170,6 +1170,12 @@ struct mpic * __init mpic_alloc(struct device_node *node,
mb();
}
 
+   /* CoreInt */
+   if (flags & MPIC_ENABLE_COREINT)
+   mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0),
+  mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0))
+  | MPIC_GREG_GCONF_COREINT);
+
if (flags & MPIC_ENABLE_MCK)
mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0),
   mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0))
@@ -1525,6 +1531,34 @@ unsigned int mpic_get_irq(void)
return mpic_get_one_irq(mpic);
 }
 
+unsigned int mpic_get_coreint_irq(void)
+{
+#ifdef CONFIG_BOOKE
+   struct mpic *mpic = mpic_primary;
+   u32 src;
+
+   BUG_ON(mpic == NULL);
+
+   src = mfspr(SPRN_EPR);
+
+   if (unlikely(src == mpic->spurious_vec)) {
+   if (mpic->flags & MPIC_SPV_EOI)
+   mpic_eoi(mpic);
+   return NO_IRQ;
+   }
+   if (unlikely(mpic->protected && test_bit(src, mpic->protected))) {
+   if (printk_ratelimit())
+   printk(KERN_WARNING "%s: Got protected source %d !\n",
+  mpic->name, (int)src);
+   return NO_IRQ;
+   }
+
+   return irq_linear_revmap(mpic->irqhost, src);
+#else
+   return NO_IRQ;
+#endif
+}
+
 unsigned int mpic_get_mcirq(void)
 {
struct mpic *mpic = mpic_primary;
-- 
1.5.6.6

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


Re: [PATCH] ucc_geth: Rework the TX logic.

2009-03-31 Thread Scott Wood

Joakim Tjernlund wrote:

I am a bit confused, what isn't worth it?


Enabling cacheing on MURAM, at least when used for buffer descriptors. 
The cache line ping-pong would probably outweigh the cost of the 
uncached accesses.



Currently MURAM isn't used by ucc_geth,


Hmm.  I looked in the driver and saw numerous muram allocations, but I 
didn't try to follow the driver enough to ensure that they were for the 
ring.  I'd assumed it was similar to the CPM1/CPM2 driver.



3) as gianfar, dma_alloc_coherent(). I presume this is uncacheable memory?


It would be uncacheable on systems without coherent DMA, but I don't 
think there are any such systems that use gianfar.



My guess would be 2 or 3. Do they have the same synchronization
sematics?


No, unfortunately.  PowerPC sync instructions are a bit complicated. 
For example, you can use eieio to sync between reading the interrupt 
status register and checking the ring buffer, if they're both mapped 
I+G, but not if the former is I+G and the latter is cacheable (you need 
a full sync in that case).


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


Re: Patch: Fix fec_mpc52xx driver to use net_device_ops

2009-03-31 Thread Stephen Hemminger
On Tue, 31 Mar 2009 12:44:15 +0200
Henk Stegeman  wrote:

> Fix fec_mpc52xx driver to use net_device_ops and to be careful not to
> dereference phy_device if a phy has not yet been connected.
> 
> Signed-off-by: Henk Stegeman 
> 
> diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
> index cd8e98b..ca76b95 100644
> --- a/drivers/net/fec_mpc52xx.c
> +++ b/drivers/net/fec_mpc52xx.c
> @@ -847,24 +847,40 @@ static void mpc52xx_fec_get_drvinfo(struct
> net_device *dev,
>  static int mpc52xx_fec_get_settings(struct net_device *dev, struct
> ethtool_cmd *cmd)
>  {
>   struct mpc52xx_fec_priv *priv = netdev_priv(dev);
> +
> + if (!priv->phydev)
> + return -ENODEV;
> +
>   return phy_ethtool_gset(priv->phydev, cmd);
>  }
> 
>  static int mpc52xx_fec_set_settings(struct net_device *dev, struct
> ethtool_cmd *cmd)
>  {
>   struct mpc52xx_fec_priv *priv = netdev_priv(dev);
> +
> + if (!priv->phydev)
> + return -ENODEV;
> +
>   return phy_ethtool_sset(priv->phydev, cmd);
>  }
> 
>  static u32 mpc52xx_fec_get_msglevel(struct net_device *dev)
>  {
>   struct mpc52xx_fec_priv *priv = netdev_priv(dev);
> +
> + if (!priv->phydev)
> + return 0;
> +
>   return priv->msg_enable;
>  }
> 
>  static void mpc52xx_fec_set_msglevel(struct net_device *dev, u32 level)
>  {
>   struct mpc52xx_fec_priv *priv = netdev_priv(dev);
> +
> + if (!priv->phydev)
> + return;
> +
>   priv->msg_enable = level;
>  }
> 
> @@ -882,12 +898,31 @@ static int mpc52xx_fec_ioctl(struct net_device
> *dev, struct ifreq *rq, int cmd)
>  {
>   struct mpc52xx_fec_priv *priv = netdev_priv(dev);
> 
> + if (!priv->phydev)
> + return -ENODEV;
> +
>   return mpc52xx_fec_phy_mii_ioctl(priv, if_mii(rq), cmd);
>  }
> 
>  /*  
> */
>  /* OF Driver
> */
>  /*  
> */
> +static const struct net_device_ops mpc52xx_fec_netdev_ops = {
> +   .ndo_open   = mpc52xx_fec_open,
> +   .ndo_stop   = mpc52xx_fec_close,
> +   .ndo_start_xmit = mpc52xx_fec_hard_start_xmit,
> +   .ndo_tx_timeout = mpc52xx_fec_tx_timeout,
> +   .ndo_get_stats  = mpc52xx_fec_get_stats,
> +   .ndo_set_multicast_list = mpc52xx_fec_set_multicast_list,
> +   .ndo_validate_addr  = eth_validate_addr,
> +   .ndo_set_mac_address= mpc52xx_fec_set_mac_address,
> +   .ndo_do_ioctl   = mpc52xx_fec_ioctl,
> 
What about change_mtu? Don't you want:
  .ndo_change_mtu = eth_change_mtu,
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: powerpc/85xx: Add support for the "socrates" board (MPC8544)

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 7:36 AM, Wolfgang Grandegger  
wrote:
> Grant Likely wrote:
>> On Tue, Mar 31, 2009 at 3:35 AM, Wolfgang Grandegger  
>> wrote:
>>> Grant Likely wrote:
 I agree 100% with David's comments, and I have some additional ones below.

 On Thu, Mar 19, 2009 at 9:26 AM, Wolfgang Grandegger  
 wrote:
> +       soc8...@e000 {
> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +               device_type = "soc";
 Drop device_type here too.
>>> Grrr, I just realized that removing the devices type "soc" has broken
>>> fsl_get_sys_freq(). See:
>>>
>>> http://lxr.linux.no/linux+v2.6.29/arch/powerpc/sysdev/fsl_soc.c#L80
>>>
>>> We need a quick fix and we could take the occasion to establish a common
>>> function for the MPC52xx as well, but it's not obvious to me how to find
>>> the SOC node without the device type property.
>>
>> SoC node should have a compatible property, just like everything else.
>>
>> compatible = "fsl,mpc8544-immr";  (immr == Internally Memory Mapped 
>> Registers)
>>
>> Many other boards already do this.
>
> Yes, it does, but searching for the SOC node is not straight-forward
> because there is no common compatibility string but many CPU-specific
> compatibility strings, e.g. "fsl,mpc8560-immr", etc. Have I missed
> something?

Choose a new value ("fsl,mpc-immr" perhaps?), document exactly what it
means, and add add it to the end of the compatible list.

> Unfortunately, other 85xx functions search for the device type "soc" as
> well. Therefore I think we must keep the devices type "soc" for the time
> being. Kumar?

Fix them!  :-)

Most troublesome places are where of_find_node_by_type() is used (I
see two cases in fsl_soc.c).  I added the of_find_matching_node()
function specifically to rework code that was only matching on a
single compatible or type value.  See usage of mpc52xx_bus_ids in
arch/powerpc/platforms/52xx/mpc52xx_common.c for an example.

It is a pain, but I think it is important to be reducing device_type
usage as we hit against them.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 8641D with linux 2.6.29 did'n show second cpu

2009-03-31 Thread Eduard Fuchs
Hi,

Am Dienstag 31 März 2009 15:20:21 schrieb Kumar Gala:
> On Mar 31, 2009, at 5:15 AM, Eduard Fuchs wrote:
> > Hi,
> >
> > I'm testing the evaluation board from freescale (MPC8641DHPCN) with
> > the latest
> > linux kernel (2.6.29) and the second core seems disabled. CONFIG_SPM
> > is
> > enabled but the /proc/cpuinfo shows only one cpu. With original
> > 2.6.27 kernel
> > both cpu cores appears in /proc/cpuinfo.
> >
> > Has anyone an idea how can i enable the second core?
>
> Are you using u-boot?  I can't remember if you need a newer u-boot to
> deal with changes in how we bring up the second core.

Yes. My u-boot version is 2009.03. Are there some additional config keys for 
SMP support in u-boot?

Best regard

Eduard

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


Re: [PATCH 5/8] powerpc: i2c-mpc: make I2C bus speed configurable

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 6:37 AM, Wolfgang Grandegger  
wrote:
> This patch makes the I2C bus speed configurable by using the I2C node
> property "clock-frequency". If the property is not defined, the old
> fixed clock settings will be used for backward comptibility.
>
> The generic I2C clock properties, especially the CPU-specific source
> clock pre-scaler are defined via the OF match table:
>
>  static const struct of_device_id mpc_i2c_of_match[] = {
>        {.compatible = "fsl,mpc5200b-i2c",
>         .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
>        {.compatible = "fsl,mpc5200-i2c",
>         .data = (void *)FSL_I2C_DEV_CLOCK_5200, },
>        {.compatible = "fsl,mpc8313-i2c",
>         .data = (void *)FSL_I2C_DEV_SEPARATE_DFSRR, },
>        {.compatible = "fsl,mpc8543-i2c",
>         .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
>                          FSL_I2C_DEV_CLOCK_DIV2), },
>        {.compatible = "fsl,mpc8544-i2c",
>         .data = (void *)(FSL_I2C_DEV_SEPARATE_DFSRR |
>                          FSL_I2C_DEV_CLOCK_DIV23), },
>        /* Backward compatibility */
>        {.compatible = "fsl-i2c", },
>        {},
>  };


Instead passing in a flag (and using an ugly cast to do it) which is
then checked inside the mpc_i2c_setclock(), you should do this
instead:

struct fsl_i2c_match_data {
int static void *(setclock)(struct device_node *node, struct
mpc_i2c *i2c, u32 clock);
int flags;
/* Other stuff can go here */
};

static const struct of_device_id mpc_i2c_of_match[] = {
{.compatible = "fsl,mpc5200b-i2c",
 .data = (struct fsl_i2c_match_data[]) { .setclock =
mpc_i2c_setclock_mpc5200, },
},
{.compatible = "fsl,mpc5200-i2c",
 .data = (struct fsl_i2c_match_data[]) { .setclock =
mpc_i2c_setclock_mpc5200, },
},
{.compatible = "fsl,mpc8313-i2c",
 .data = (struct fsl_i2c_match_data[]) { .setclock =
mpc_i2c_setclock_separate_dfsrr, },
},
{.compatible = "fsl,mpc8543-i2c",
 .data = (struct fsl_i2c_match_data[]) { .setclock =
mpc_i2c_setclock_separate_dfsrr, },
 .flags = FSL_I2C_DEV_CLOCK_DIV2,
},
{.compatible = "fsl,mpc8544-i2c",
 .data = (struct fsl_i2c_match_data[]) { .setclock =
mpc_i2c_setclock_separate_dfsrr, },
 .flags = FSL_I2C_DEV_CLOCK_DIV23,
},
/* Backward compatibility */
{.compatible = "fsl-i2c",
 .data = (struct fsl_i2c_match_data[]) { .setclock =
mpc_i2c_setclock, },
},
{},
  };

The table definition is more verbose this way, but I think it results
in more understandable and easier to extend code.  It also adds lets
the compiler do more type checking for you.


Also, this ...

> --- linux-2.6.orig/arch/powerpc/sysdev/fsl_soc.c        2009-03-31 
> 13:25:08.0 +0200
> +++ linux-2.6/arch/powerpc/sysdev/fsl_soc.c     2009-03-31 13:34:40.531721011 
> +0200
> +int fsl_i2c_get_fdr(struct device_node *node, u32 i2c_clock, u32 i2c_flags)
> +{
> [...]
> +}
> +EXPORT_SYMBOL(fsl_i2c_get_fdr);

... and this ...

> --- linux-2.6.orig/arch/powerpc/platforms/52xx/mpc52xx_common.c 2009-03-31 
> 13:25:08.0 +0200
> +++ linux-2.6/arch/powerpc/platforms/52xx/mpc52xx_common.c      2009-03-31 
> 13:28:54.309718526 +0200
> +int fsl_i2c_get_fdr(struct device_node *node, u32 i2c_clock, u32 i2c_flags)
> +{
> [...]
> +}
> +EXPORT_SYMBOL(fsl_i2c_get_fdr);

does not work on a multiplatform kernel.  Both 8xxx and 52xx support
can be selected at the same time.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc: i2c-mpc: preserve I2C clocking

2009-03-31 Thread Grant Likely
2009/3/31 Wolfram Sang :
>
>> >> -
>> >> -  mpc_i2c_setclock(i2c);
>> >> +
>> >> +  if (set_clock)
>> >> +          mpc_i2c_setclock(i2c);
>> >
>> > Can't we drop 'set_clock' with something like this here?
>> >
>> > +   if (!of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
>> > +
>> > +           if (of_get_property(op->node, "dfsrr", NULL))
>> > +                   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
>> > +
>> > +           if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
>> > +               of_device_is_compatible(op->node, "mpc5200-i2c"))
>> > +                   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
>> > +
>> > +           mpc_i2c_setclock(i2c);
>> > +   }
>>
>> No, because the I2C registers are not yet mapped.
>
> Sorry, I used misleading words :) With 'here' I meant 'at this
> position', i.e. insert my above block where mpc_i2c_setclock was used
> anyway.

I agree.  The extra flag makes the flow more complex.  The code block
should be moved down.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: powerpc/85xx: Add support for the "socrates" board (MPC8544)

2009-03-31 Thread Anton Vorontsov
On Tue, Mar 31, 2009 at 09:05:28AM -0600, Grant Likely wrote:
[...]
> > +       soc8...@e000 {
> > +               #address-cells = <1>;
> > +               #size-cells = <1>;
> > +               device_type = "soc";
>  Drop device_type here too.
> >>> Grrr, I just realized that removing the devices type "soc" has broken
> >>> fsl_get_sys_freq(). See:
> >>>
> >>> http://lxr.linux.no/linux+v2.6.29/arch/powerpc/sysdev/fsl_soc.c#L80
> >>>
> >>> We need a quick fix and we could take the occasion to establish a common
> >>> function for the MPC52xx as well, but it's not obvious to me how to find
> >>> the SOC node without the device type property.
> >>
> >> SoC node should have a compatible property, just like everything else.
> >>
> >> compatible = "fsl,mpc8544-immr";  (immr == Internally Memory Mapped 
> >> Registers)
> >>
> >> Many other boards already do this.
> >
> > Yes, it does, but searching for the SOC node is not straight-forward
> > because there is no common compatibility string but many CPU-specific
> > compatibility strings, e.g. "fsl,mpc8560-immr", etc. Have I missed
> > something?
> 
> Choose a new value ("fsl,mpc-immr" perhaps?), document exactly what it
> means, and add add it to the end of the compatible list.

As Scott Wood once pointed out, IMMR does not exists for MPC85xx
parts. There it's called CCSR.

See this thread:

http://www.mail-archive.com/linuxppc-dev@ozlabs.org/msg12665.html

I still think that
"fsl,mpc83NN-immr", "fsl,soc", "simple-bus" for 83xx
and
"fsl,mpc85NN-ccsr", "fsl,soc", "simple-bus" for 85xx

would be OK, at least to start with. We can always deprecate "fsl,soc"
compatible in favour of something more elegant, but "fsl,soc" should be
just fine to replace device_type = "soc".

Also, there is another good thing about "fsl,soc" -- U-Boot already
finds it for 83xx CPUs. ;-)

-- 
Anton Vorontsov
email: cbouatmai...@gmail.com
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 3/8] powerpc/85xx: Add support for the "socrates" board (MPC8544).

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 6:37 AM, Wolfgang Grandegger  
wrote:
> Supported are Ethernet, serial console, I2C, I2C-based RTC and
> temperature sensors, NOR and NAND flash, PCI, USB, CAN and Lime
> display controller.
>
> The multiplexing of FPGA interrupts onto PowerPC interrupt lines is
> supported through our own fpga_pic interrupt controller driver.
>
> For example the SJA1000 controller is level low sensitive connected to
> fpga_pic line 2 and is routed to the second (of three) irq lines to
> the CPU:
>
>    ...@3,100 {
>            compatible = "philips,sja1000";
>            reg = <3 0x100 0x80>;
>            interrupts = <2 2>;
>            interrupts = <2 8 1>;   // number, type, routing
>            interrupt-parent = <&fpga_pic>;
>    };
>
> Signed-off-by: Sergei Poselenov 
> Signed-off-by: Yuri Tikhonov 
> Signed-off-by: Ilya Yanok 
> Signed-off-by: Wolfgang Grandegger 
> Signed-off-by: Anatolij Gustschin 
> Signed-off-by: Dmitry Rakhchev 
> ---
>  arch/powerpc/boot/dts/socrates.dts              |  338 +
>  arch/powerpc/configs/85xx/socrates_defconfig    | 1410 
> 

I always ask this question: Do you really need a board specific
defconfig file?  We are multiplatform now.

>  arch/powerpc/platforms/85xx/Kconfig             |    6
>  arch/powerpc/platforms/85xx/Makefile            |    1
>  arch/powerpc/platforms/85xx/socrates.c          |  133 ++
>  arch/powerpc/platforms/85xx/socrates_fpga_pic.c |  327 +
>  arch/powerpc/platforms/85xx/socrates_fpga_pic.h |   16

socrates_fpga_pic is only ever going to be used by socrates.c.  I'd
roll the two socrates.c files into one and eliminate the header file.

> Index: linux-2.6/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
> ===
> --- /dev/null
> +++ linux-2.6/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
[...]
> +struct socrates_fpga_irq_info {
> +       unsigned int irq_line;
> +       int type;
> +};
> +
> +/*
> + * Interrupt routing and type table
> + *
> + * IRQ_TYPE_NONE means the interrupt type is configurable,
> + * otherwise it's fixed to the specified value.
> + */
> +static struct socrates_fpga_irq_info fpga_irqs[SOCRATES_FPGA_NUM_IRQS] = {
> +       [0] = {0, IRQ_TYPE_NONE},
> +       [1] = {0, IRQ_TYPE_LEVEL_HIGH},
> +       [2] = {0, IRQ_TYPE_LEVEL_LOW},
> +       [3] = {0, IRQ_TYPE_NONE},
> +       [4] = {0, IRQ_TYPE_NONE},
> +       [5] = {0, IRQ_TYPE_NONE},
> +       [6] = {0, IRQ_TYPE_NONE},
> +       [7] = {0, IRQ_TYPE_NONE},
> +       [8] = {0, IRQ_TYPE_LEVEL_HIGH},
> +};

It is good practice to use named elements in initializers: {.type =
IRQ_TYPE_LEVEL_HIGH},

Static variables are initialized to zero.  Everything that is 0 can be
dropped from this initializer (lines 0 and 3-7, and the irq_line
field).

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: powerpc/85xx: Add support for the "socrates" board (MPC8544)

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 9:54 AM, Anton Vorontsov
 wrote:
> On Tue, Mar 31, 2009 at 09:05:28AM -0600, Grant Likely wrote:
> [...]
>> > +       soc8...@e000 {
>> > +               #address-cells = <1>;
>> > +               #size-cells = <1>;
>> > +               device_type = "soc";
>>  Drop device_type here too.
>> >>> Grrr, I just realized that removing the devices type "soc" has broken
>> >>> fsl_get_sys_freq(). See:
>> >>>
>> >>> http://lxr.linux.no/linux+v2.6.29/arch/powerpc/sysdev/fsl_soc.c#L80
>> >>>
>> >>> We need a quick fix and we could take the occasion to establish a common
>> >>> function for the MPC52xx as well, but it's not obvious to me how to find
>> >>> the SOC node without the device type property.
>> >>
>> >> SoC node should have a compatible property, just like everything else.
>> >>
>> >> compatible = "fsl,mpc8544-immr";  (immr == Internally Memory Mapped 
>> >> Registers)
>> >>
>> >> Many other boards already do this.
>> >
>> > Yes, it does, but searching for the SOC node is not straight-forward
>> > because there is no common compatibility string but many CPU-specific
>> > compatibility strings, e.g. "fsl,mpc8560-immr", etc. Have I missed
>> > something?
>>
>> Choose a new value ("fsl,mpc-immr" perhaps?), document exactly what it
>> means, and add add it to the end of the compatible list.
>
> As Scott Wood once pointed out, IMMR does not exists for MPC85xx
> parts. There it's called CCSR.
>
> See this thread:
>
> http://www.mail-archive.com/linuxppc-dev@ozlabs.org/msg12665.html
>
> I still think that
> "fsl,mpc83NN-immr", "fsl,soc", "simple-bus" for 83xx
> and
> "fsl,mpc85NN-ccsr", "fsl,soc", "simple-bus" for 85xx
>
> would be OK, at least to start with. We can always deprecate "fsl,soc"
> compatible in favour of something more elegant, but "fsl,soc" should be
> just fine to replace device_type = "soc".
>
> Also, there is another good thing about "fsl,soc" -- U-Boot already
> finds it for 83xx CPUs. ;-)

I'm totally fine with fsl,soc *providing* that it is documented as to
exactly what it describes, what properties are expected, and how they
are used.  Since fsl,soc is not tied to a specific piece of silicon I
want to guard against the definition of "fsl,soc" drifting over time.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] linux-next remove wmb() from ide-dma-sff.c and scc_pata.c

2009-03-31 Thread Atsushi Nemoto
On Tue, 31 Mar 2009 09:51:53 +0200 (CEST), Geert Uytterhoeven 
 wrote:
> > Followup to "[PATCH 03/10] ide: destroy DMA mappings after ending DMA"
> > email on March 14th:
> > http://lkml.org/lkml/2009/3/14/17
> > 
> > No maintainer is listed for "Toshiba CELL Reference Set IDE" 
> > (BLK_DEV_CELLEB)
> > or tx4939ide.c in MAINTAINERS. I've CC'd "Ishizaki Kou" @Toshiba 
> > (Maintainer for
> > "Spidernet Network Driver for CELL") and linuxppc-dev list in the hope
> > someone else
> > would know or would be able to ACK this patch.
> 
> tx49xx is MIPS, for Nemoto-san.
> 
> > This patch:
> > o replaces "mask" variable in ide_dma_end() with #define.
> > o removes use of wmb() in ide-dma-sff.c and scc_pata.c.
> > o is not tested - I don't have (or want) the HW.
> > 
> > I did NOT remove wmb() use in tx4939ide.c. tx4939ide.c __raw_writeb()
> > for MMIO transactions. __raw_writeb() does NOT guarantee memory
> > transaction ordering.

The wmb() in tx4939ide.c was just copied from ide_dma_end().  On this
MIPS core memory operations are strictly ordered so that the wmb() can
be removed.

And on MIPS __raw_writeb() and writeb() do same thing except for
endian conversion.

I will send a patch just for tx4939ide.c.  Thank you for suggestion.

> > tx4939ide also uses mmiowb(). AFAIK, mmiowb() only has an effect on
> > SGI IA64 NUMA machines. I'm not going to guess how this driver might work.

On MIPS mmiowb() can be (ab)used to flush write buffer.  Please do not
drop this mmiowb().

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


Re: [PATCH 0/8] powerpc: i2c-mpc: make I2C bus speed configurable

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 6:49 AM, Wolfgang Grandegger  
wrote:
> Please *FORGET* this series of patches. Only the I2C related patches are
> relevant but I accidentally sent out the complete patch stack :-(. I
> will resent them in a second.
>
> Sorry for any inconvenience this has caused.

Heh, no worries.  At least this way you get a bonus round of review.  :-)

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


kexec: proc/device-tree/chosen/linux,kernel-end: No such file or directory

2009-03-31 Thread Geert Uytterhoeven
With today's kernel, I can no longer kexec any kernel on PS3:

| /proc/device-tree/chosen/linux,kernel-end: No such file or directory
| Could not get memory layout

Today's bad version: 15f7176eb1cccec0a332541285ee752b935c1c85
Yesterday's good version: 0d34fb8e93ceba7b6dad0062dbb4a0813bacd75b

Before I start bisecting (tomorrow or the day thereafter), anyone with an idea?
Thanks!

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:+32 (0)2 700 8453
Fax:  +32 (0)2 700 8622
E-mail:   geert.uytterhoe...@sonycom.com
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Patch: Fix fec_mpc52xx driver to use net_device_ops

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 8:48 AM, Stephen Hemminger
 wrote:
> On Tue, 31 Mar 2009 12:44:15 +0200
> Henk Stegeman  wrote:
>
>> Fix fec_mpc52xx driver to use net_device_ops and to be careful not to
>> dereference phy_device if a phy has not yet been connected.
>>
>> Signed-off-by: Henk Stegeman 

Hi Henk,

I hadn't heard from you for a while about the signed-off-by line, but
I really needed to get those changes queued because the 2.6.30 merge
window is open now, and some of my patches depend on it.  I ended up
rewriting your patch from scratch, testing it and posting it last
night.

I would really like to stick with the rewritten version since it is a
little tighter, and it is the one I've got tested.  However, now that
I've heard from you, I'm happy to change the patch author credit to
you.  You should look on the list for the patches I sent out last
night (labeled [PATCH 02/14] and [PATCH 03/14]) and reply to each of
them with an "Acked-by:" line if they look good to you.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Patch: Fix fec_mpc52xx driver to use net_device_ops

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 8:48 AM, Stephen Hemminger
 wrote:
> On Tue, 31 Mar 2009 12:44:15 +0200
>> +static const struct net_device_ops mpc52xx_fec_netdev_ops = {
>> +       .ndo_open               = mpc52xx_fec_open,
>> +       .ndo_stop               = mpc52xx_fec_close,
>> +       .ndo_start_xmit         = mpc52xx_fec_hard_start_xmit,
>> +       .ndo_tx_timeout         = mpc52xx_fec_tx_timeout,
>> +       .ndo_get_stats          = mpc52xx_fec_get_stats,
>> +       .ndo_set_multicast_list = mpc52xx_fec_set_multicast_list,
>> +       .ndo_validate_addr      = eth_validate_addr,
>> +       .ndo_set_mac_address    = mpc52xx_fec_set_mac_address,
>> +       .ndo_do_ioctl           = mpc52xx_fec_ioctl,
>>
> What about change_mtu? Don't you want:
>          .ndo_change_mtu         = eth_change_mtu,

Yes, you're right.  fixed.

Thanks,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] fsl_pq_mdio: Revive UCC MDIO support

2009-03-31 Thread Anton Vorontsov
commit 1577ecef766650a57fceb171acee2b13cbfaf1d3 ("netdev: Merge UCC
and gianfar MDIO bus drivers") introduced a regression so that UCC
MDIO buses no longer work.

This is because fsl_pq_mdio driver wrongly masks all non-TBI PHYs
for !fsl,gianfar-mdio buses, while it should do that only for
fsl,gianfar-tbi buses.

Signed-off-by: Anton Vorontsov 
---
 drivers/net/fsl_pq_mdio.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index b3079a5..d9e1ecf 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -387,7 +387,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
 * The TBIPHY-only buses will find PHYs at every address,
 * so we mask them all but the TBI
 */
-   if (!of_device_is_compatible(np, "fsl,gianfar-mdio"))
+   if (of_device_is_compatible(np, "fsl,gianfar-tbi"))
new_bus->phy_mask = ~(1 << tbiaddr);
 
err = mdiobus_register(new_bus);
-- 
1.5.6.5
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Problem with module_init?

2009-03-31 Thread Sean MacLennan
With the latest from Linus' tree, I get the following oops:

Oops: Kernel access of bad area, sig: 11 [#1]
Warp
Modules linked in: simple(+)
NIP: d14b8000 LR: c0001420 CTR: 
REGS: cf2a1df0 TRAP: 0400   Not tainted  (2.6.29-pika)
MSR: 00029000   CR: 2422  XER: 
TASK = cf896100[1673] 'insmod' THREAD: cf2a
GPR00:  cf2a1ea0 cf896100 d14b8000 0001 d14b5360 
 GPR08: c03312fc c03312fc c0546018 c0546018 2422 100872cc
0ffa7d00 007fff99 GPR16: 00400450 0080 007fff00 0ffa7cec 
  1008323c GPR24: 10083254  c033 c031
c03110a4 d14b8000 cf2a d14b5360 NIP [d14b8000] simple_init+0x0/0x8
[simple] LR [c0001420] do_one_initcall+0x34/0x1a0
Call Trace:
[cf2a1f20] [c0045e18] sys_init_module+0xb0/0x1b8
[cf2a1f40] [c000dbbc] ret_from_syscall+0x0/0x3c
Instruction dump:
        
    <3860> 4e800020 
 ---[ end trace 9ac3b092cfc75a75 ]---

This is the entire driver:

#include 

static int __init simple_init(void)
{
return 0;
}
module_init(simple_init);

static void __exit simple_exit(void)
{
}
module_exit(simple_exit);

MODULE_DESCRIPTION("simple driver");
MODULE_LICENSE("GPL");

Has something changed for module?

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


[PATCH] ucc_geth: Pass proper device to DMA routines, otherwise oops happens

2009-03-31 Thread Anton Vorontsov
The driver should pass a device that actually specifies internal DMA
ops, but currently it passes netdev's device, which is wrong and that
causes following oops:

Kernel BUG at c01c4df8 [verbose debug info unavailable]
Oops: Exception in kernel mode, sig: 5 [#1]
[...]
NIP [c01c4df8] get_new_skb+0x7c/0xf8
LR [c01c4da4] get_new_skb+0x28/0xf8
Call Trace:
[ef82be00] [c01c4da4] get_new_skb+0x28/0xf8 (unreliable)
[ef82be20] [c01c4eb8] rx_bd_buffer_set+0x44/0x98
[ef82be40] [c01c62bc] ucc_geth_startup+0x11b0/0x147c
[ef82be80] [c01c6674] ucc_geth_open+0xec/0x2a4
[ef82bea0] [c02288a4] dev_open+0xc0/0x11c
[...]

Fix this by passing of_device's device that specifies DMA ops in its
archdata.

Signed-off-by: Anton Vorontsov 
---
 drivers/net/ucc_geth.c |   21 +++--
 drivers/net/ucc_geth.h |3 ++-
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 933fcfb..3ed402c 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -223,10 +223,10 @@ static struct sk_buff *get_new_skb(struct 
ucc_geth_private *ugeth,
(((unsigned)skb->data) & (UCC_GETH_RX_DATA_BUF_ALIGNMENT -
  1)));
 
-   skb->dev = ugeth->dev;
+   skb->dev = ugeth->ndev;
 
out_be32(&((struct qe_bd __iomem *)bd)->buf,
- dma_map_single(&ugeth->dev->dev,
+ dma_map_single(ugeth->dev,
 skb->data,
 ugeth->ug_info->uf_info.max_rx_buf_length +
 UCC_GETH_RX_DATA_BUF_ALIGNMENT,
@@ -1872,7 +1872,7 @@ static void ucc_geth_memclean(struct ucc_geth_private 
*ugeth)
continue;
for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) {
if (ugeth->tx_skbuff[i][j]) {
-   dma_unmap_single(&ugeth->dev->dev,
+   dma_unmap_single(ugeth->dev,
 in_be32(&((struct qe_bd 
__iomem *)bd)->buf),
 (in_be32((u32 __iomem *)bd) &
  BD_LENGTH_MASK),
@@ -1900,7 +1900,7 @@ static void ucc_geth_memclean(struct ucc_geth_private 
*ugeth)
bd = ugeth->p_rx_bd_ring[i];
for (j = 0; j < ugeth->ug_info->bdRingLenRx[i]; j++) {
if (ugeth->rx_skbuff[i][j]) {
-   dma_unmap_single(&ugeth->dev->dev,
+   dma_unmap_single(ugeth->dev,
in_be32(&((struct qe_bd __iomem 
*)bd)->buf),
ugeth->ug_info->
uf_info.max_rx_buf_length +
@@ -3071,7 +3071,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, 
struct net_device *dev)
 
/* set up the buffer descriptor */
out_be32(&((struct qe_bd __iomem *)bd)->buf,
- dma_map_single(&ugeth->dev->dev, skb->data,
+ dma_map_single(ugeth->dev, skb->data,
  skb->len, DMA_TO_DEVICE));
 
/* printk(KERN_DEBUG"skb->data is 0x%x\n",skb->data); */
@@ -3127,7 +3127,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 
rxQ, int rx_work_limit
 
ugeth_vdbg("%s: IN", __func__);
 
-   dev = ugeth->dev;
+   dev = ugeth->ndev;
 
/* collect received buffers */
bd = ugeth->rxBd[rxQ];
@@ -3161,7 +3161,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 
rxQ, int rx_work_limit
skb_put(skb, length);
 
/* Tell the skb what kind of packet this is */
-   skb->protocol = eth_type_trans(skb, ugeth->dev);
+   skb->protocol = eth_type_trans(skb, ugeth->ndev);
 
dev->stats.rx_bytes += length;
/* Send the packet up the stack */
@@ -3432,7 +3432,7 @@ static int ucc_geth_close(struct net_device *dev)
 
ucc_geth_stop(ugeth);
 
-   free_irq(ugeth->ug_info->uf_info.irq, ugeth->dev);
+   free_irq(ugeth->ug_info->uf_info.irq, ugeth->ndev);
 
netif_stop_queue(dev);
 
@@ -3446,7 +3446,7 @@ static void ucc_geth_timeout_work(struct work_struct 
*work)
struct net_device *dev;
 
ugeth = container_of(work, struct ucc_geth_private, timeout_work);
-   dev = ugeth->dev;
+   dev = ugeth->ndev;
 
ugeth_vdbg("%s: IN", __func__);
 
@@ -3756,7 +3756,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma
memcpy(dev->dev_addr, mac_addr, 6);
 
ugeth->ug_info = ug_info;
-   ugeth->dev = dev;
+   ugeth->dev = device;
+   ugeth->ndev = dev;
ugeth->node = np;
 
retur

Re: [PATCH v4 1/4] NAND: FSL-UPM: add multi chip support

2009-03-31 Thread Anton Vorontsov
On Mon, Mar 30, 2009 at 12:02:42PM +0200, Wolfgang Grandegger wrote:
> This patch adds support for multi-chip NAND devices to the FSL-UPM
> driver. This requires support for multiple GPIOs for the RNB pins.
> The NAND chips are selected through address lines defined by the
> FDT property "fsl,upm-addr-line-cs-offsets".
> 
> Signed-off-by: Wolfgang Grandegger 

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


Re: [PATCH v4 2/4] NAND: FSL-UPM: Add wait flags to support board/chip specific delays

2009-03-31 Thread Anton Vorontsov
On Mon, Mar 30, 2009 at 12:02:43PM +0200, Wolfgang Grandegger wrote:
> The NAND flash on the TQM8548_BE modules requires a short delay after
> running the UPM pattern. The TQM8548_BE requires a further short delay
> after writing out a buffer. Normally the R/B pin should be checked, but
> it's not connected on the TQM8548_BE. The existing driver uses similar
> fixed delay points. To manage these extra delays in a more general way,
> I introduced the "fsl,ump-wait-flags" property allowing the board-
> specific driver to specify various types of extra delay.
> 
> Signed-off-by: Wolfgang Grandegger 

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


Re: [PATCH v4 3/4] powerpc: NAND: FSL UPM: document new bindings

2009-03-31 Thread Anton Vorontsov
On Mon, Mar 30, 2009 at 12:02:44PM +0200, Wolfgang Grandegger wrote:
> This patch adds documentation for the new NAND FSL UPM bindings for:
> 
>  NAND: FSL-UPM: add multi chip support
>  NAND: FSL-UPM: Add wait flags to support board/chip specific delays
> 
> It also documents the old binding for "chip-delay".
> 
> Signed-off-by: Wolfgang Grandegger 

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


Re: [PATCH] net/fec_mpc52xx: fix BUG on missing dma_ops

2009-03-31 Thread Grant Likely
Thanks Becky.

g.

2009/3/31 Becky Bruce :
>
> On Mar 30, 2009, at 9:25 PM, Grant Likely wrote:
>
>> From: Grant Likely 
>>
>> The driver triggers a BUG_ON() when allocating DMA buffers if the
>> arch/powerpc dma_ops from the of_platform device are not copied
>> into net_device structure.
>>
>> Signed-off-by: Grant Likely 
>> ---
>>
>> Becky, does this look better to you?
>
> Reviewed-by: Becky Bruce 
>
> I think this is OK now, and Kumar agrees
>
> Thanks!
> B
>
>>
>>
>> g.
>>
>> drivers/net/fec_mpc52xx.c |   19 ---
>> 1 files changed, 12 insertions(+), 7 deletions(-)
>>
>>
>> diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
>> index 049b0a7..f99463f 100644
>> --- a/drivers/net/fec_mpc52xx.c
>> +++ b/drivers/net/fec_mpc52xx.c
>> @@ -129,7 +129,8 @@ static void mpc52xx_fec_free_rx_buffers(struct
>> net_device *dev, struct bcom_task
>>                struct sk_buff *skb;
>>
>>                skb = bcom_retrieve_buffer(s, NULL, (struct bcom_bd
>> **)&bd);
>> -               dma_unmap_single(&dev->dev, bd->skb_pa, skb->len,
>> DMA_FROM_DEVICE);
>> +               dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len,
>> +                                DMA_FROM_DEVICE);
>>                kfree_skb(skb);
>>        }
>> }
>> @@ -150,7 +151,7 @@ static int mpc52xx_fec_alloc_rx_buffers(struct
>> net_device *dev, struct bcom_task
>>                bd = (struct bcom_fec_bd *)bcom_prepare_next_buffer(rxtsk);
>>
>>                bd->status = FEC_RX_BUFFER_SIZE;
>> -               bd->skb_pa = dma_map_single(&dev->dev, skb->data,
>> +               bd->skb_pa = dma_map_single(dev->dev.parent, skb->data,
>>                                FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);
>>
>>                bcom_submit_next_buffer(rxtsk, skb);
>> @@ -388,7 +389,8 @@ static int mpc52xx_fec_hard_start_xmit(struct sk_buff
>> *skb, struct net_device *d
>>                bcom_prepare_next_buffer(priv->tx_dmatsk);
>>
>>        bd->status = skb->len | BCOM_FEC_TX_BD_TFD | BCOM_FEC_TX_BD_TC;
>> -       bd->skb_pa = dma_map_single(&dev->dev, skb->data, skb->len,
>> DMA_TO_DEVICE);
>> +       bd->skb_pa = dma_map_single(dev->dev.parent, skb->data, skb->len,
>> +                                   DMA_TO_DEVICE);
>>
>>        bcom_submit_next_buffer(priv->tx_dmatsk, skb);
>>
>> @@ -430,7 +432,8 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq,
>> void *dev_id)
>>                struct bcom_fec_bd *bd;
>>                skb = bcom_retrieve_buffer(priv->tx_dmatsk, NULL,
>>                                (struct bcom_bd **)&bd);
>> -               dma_unmap_single(&dev->dev, bd->skb_pa, skb->len,
>> DMA_TO_DEVICE);
>> +               dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len,
>> +                                DMA_TO_DEVICE);
>>
>>                dev_kfree_skb_irq(skb);
>>        }
>> @@ -455,7 +458,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq,
>> void *dev_id)
>>
>>                rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status,
>>                                (struct bcom_bd **)&bd);
>> -               dma_unmap_single(&dev->dev, bd->skb_pa, rskb->len,
>> DMA_FROM_DEVICE);
>> +               dma_unmap_single(dev->dev.parent, bd->skb_pa, rskb->len,
>> +                                DMA_FROM_DEVICE);
>>
>>                /* Test for errors in received frame */
>>                if (status & BCOM_FEC_RX_BD_ERRORS) {
>> @@ -464,7 +468,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq,
>> void *dev_id)
>>                                bcom_prepare_next_buffer(priv->rx_dmatsk);
>>
>>                        bd->status = FEC_RX_BUFFER_SIZE;
>> -                       bd->skb_pa = dma_map_single(&dev->dev, rskb->data,
>> +                       bd->skb_pa = dma_map_single(dev->dev.parent,
>> +                                       rskb->data,
>>                                        FEC_RX_BUFFER_SIZE,
>> DMA_FROM_DEVICE);
>>
>>                        bcom_submit_next_buffer(priv->rx_dmatsk, rskb);
>> @@ -499,7 +504,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq,
>> void *dev_id)
>>                        bcom_prepare_next_buffer(priv->rx_dmatsk);
>>
>>                bd->status = FEC_RX_BUFFER_SIZE;
>> -               bd->skb_pa = dma_map_single(&dev->dev, skb->data,
>> +               bd->skb_pa = dma_map_single(dev->dev.parent, skb->data,
>>                                FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);
>>
>>                bcom_submit_next_buffer(priv->rx_dmatsk, skb);
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] net/fec_mpc52xx: fix BUG on missing dma_ops

2009-03-31 Thread Becky Bruce


On Mar 30, 2009, at 9:25 PM, Grant Likely wrote:


From: Grant Likely 

The driver triggers a BUG_ON() when allocating DMA buffers if the
arch/powerpc dma_ops from the of_platform device are not copied
into net_device structure.

Signed-off-by: Grant Likely 
---

Becky, does this look better to you?


Reviewed-by: Becky Bruce 

I think this is OK now, and Kumar agrees

Thanks!
B




g.

drivers/net/fec_mpc52xx.c |   19 ---
1 files changed, 12 insertions(+), 7 deletions(-)


diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 049b0a7..f99463f 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -129,7 +129,8 @@ static void mpc52xx_fec_free_rx_buffers(struct  
net_device *dev, struct bcom_task

struct sk_buff *skb;

skb = bcom_retrieve_buffer(s, NULL, (struct bcom_bd **)&bd);
-   dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, 
DMA_FROM_DEVICE);
+   dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len,
+DMA_FROM_DEVICE);
kfree_skb(skb);
}
}
@@ -150,7 +151,7 @@ static int mpc52xx_fec_alloc_rx_buffers(struct  
net_device *dev, struct bcom_task

bd = (struct bcom_fec_bd *)bcom_prepare_next_buffer(rxtsk);

bd->status = FEC_RX_BUFFER_SIZE;
-   bd->skb_pa = dma_map_single(&dev->dev, skb->data,
+   bd->skb_pa = dma_map_single(dev->dev.parent, skb->data,
FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);

bcom_submit_next_buffer(rxtsk, skb);
@@ -388,7 +389,8 @@ static int mpc52xx_fec_hard_start_xmit(struct  
sk_buff *skb, struct net_device *d

bcom_prepare_next_buffer(priv->tx_dmatsk);

bd->status = skb->len | BCOM_FEC_TX_BD_TFD | BCOM_FEC_TX_BD_TC;
-	bd->skb_pa = dma_map_single(&dev->dev, skb->data, skb->len,  
DMA_TO_DEVICE);

+   bd->skb_pa = dma_map_single(dev->dev.parent, skb->data, skb->len,
+   DMA_TO_DEVICE);

bcom_submit_next_buffer(priv->tx_dmatsk, skb);

@@ -430,7 +432,8 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int  
irq, void *dev_id)

struct bcom_fec_bd *bd;
skb = bcom_retrieve_buffer(priv->tx_dmatsk, NULL,
(struct bcom_bd **)&bd);
-   dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, 
DMA_TO_DEVICE);
+   dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len,
+DMA_TO_DEVICE);

dev_kfree_skb_irq(skb);
}
@@ -455,7 +458,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int  
irq, void *dev_id)


rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status,
(struct bcom_bd **)&bd);
-		dma_unmap_single(&dev->dev, bd->skb_pa, rskb->len,  
DMA_FROM_DEVICE);

+   dma_unmap_single(dev->dev.parent, bd->skb_pa, rskb->len,
+DMA_FROM_DEVICE);

/* Test for errors in received frame */
if (status & BCOM_FEC_RX_BD_ERRORS) {
@@ -464,7 +468,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int  
irq, void *dev_id)

bcom_prepare_next_buffer(priv->rx_dmatsk);

bd->status = FEC_RX_BUFFER_SIZE;
-   bd->skb_pa = dma_map_single(&dev->dev, rskb->data,
+   bd->skb_pa = dma_map_single(dev->dev.parent,
+   rskb->data,
FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);

bcom_submit_next_buffer(priv->rx_dmatsk, rskb);
@@ -499,7 +504,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int  
irq, void *dev_id)

bcom_prepare_next_buffer(priv->rx_dmatsk);

bd->status = FEC_RX_BUFFER_SIZE;
-   bd->skb_pa = dma_map_single(&dev->dev, skb->data,
+   bd->skb_pa = dma_map_single(dev->dev.parent, skb->data,
FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);

bcom_submit_next_buffer(priv->rx_dmatsk, skb);


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


Re: [PATCH 3/8] powerpc/85xx: Add support for the "socrates" board (MPC8544).

2009-03-31 Thread Wolfgang Grandegger
Hi Grant,

Grant Likely wrote:
> On Tue, Mar 31, 2009 at 6:37 AM, Wolfgang Grandegger  
> wrote:
>> Supported are Ethernet, serial console, I2C, I2C-based RTC and
>> temperature sensors, NOR and NAND flash, PCI, USB, CAN and Lime
>> display controller.
>>
>> The multiplexing of FPGA interrupts onto PowerPC interrupt lines is
>> supported through our own fpga_pic interrupt controller driver.
>>
>> For example the SJA1000 controller is level low sensitive connected to
>> fpga_pic line 2 and is routed to the second (of three) irq lines to
>> the CPU:
>>
>>c...@3,100 {
>>compatible = "philips,sja1000";
>>reg = <3 0x100 0x80>;
>>interrupts = <2 2>;
>>interrupts = <2 8 1>;   // number, type, routing
>>interrupt-parent = <&fpga_pic>;
>>};
>>
>> Signed-off-by: Sergei Poselenov 
>> Signed-off-by: Yuri Tikhonov 
>> Signed-off-by: Ilya Yanok 
>> Signed-off-by: Wolfgang Grandegger 
>> Signed-off-by: Anatolij Gustschin 
>> Signed-off-by: Dmitry Rakhchev 
>> ---
>>  arch/powerpc/boot/dts/socrates.dts  |  338 +
>>  arch/powerpc/configs/85xx/socrates_defconfig| 1410 
>> 
> 
> I always ask this question: Do you really need a board specific
> defconfig file?  We are multiplatform now.
> 
>>  arch/powerpc/platforms/85xx/Kconfig |6
>>  arch/powerpc/platforms/85xx/Makefile|1
>>  arch/powerpc/platforms/85xx/socrates.c  |  133 ++
>>  arch/powerpc/platforms/85xx/socrates_fpga_pic.c |  327 +
>>  arch/powerpc/platforms/85xx/socrates_fpga_pic.h |   16
> 
> socrates_fpga_pic is only ever going to be used by socrates.c.  I'd
> roll the two socrates.c files into one and eliminate the header file.
> 
>> Index: linux-2.6/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
>> ===
>> --- /dev/null
>> +++ linux-2.6/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
> [...]
>> +struct socrates_fpga_irq_info {
>> +   unsigned int irq_line;
>> +   int type;
>> +};
>> +
>> +/*
>> + * Interrupt routing and type table
>> + *
>> + * IRQ_TYPE_NONE means the interrupt type is configurable,
>> + * otherwise it's fixed to the specified value.
>> + */
>> +static struct socrates_fpga_irq_info fpga_irqs[SOCRATES_FPGA_NUM_IRQS] = {
>> +   [0] = {0, IRQ_TYPE_NONE},
>> +   [1] = {0, IRQ_TYPE_LEVEL_HIGH},
>> +   [2] = {0, IRQ_TYPE_LEVEL_LOW},
>> +   [3] = {0, IRQ_TYPE_NONE},
>> +   [4] = {0, IRQ_TYPE_NONE},
>> +   [5] = {0, IRQ_TYPE_NONE},
>> +   [6] = {0, IRQ_TYPE_NONE},
>> +   [7] = {0, IRQ_TYPE_NONE},
>> +   [8] = {0, IRQ_TYPE_LEVEL_HIGH},
>> +};
> 
> It is good practice to use named elements in initializers: {.type =
> IRQ_TYPE_LEVEL_HIGH},
> 
> Static variables are initialized to zero.  Everything that is 0 can be
> dropped from this initializer (lines 0 and 3-7, and the irq_line
> field).

Right, missed that.

This is one of the patches I sent accidentally. I think Kumar already
applied it to his tree.

Sorry for the noise.

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


[PATCH v2] powerpc: i2c-mpc: preserve I2C clocking

2009-03-31 Thread Wolfgang Grandegger
The i2c node property "fsl,preserve-clocking" allows to overtake the
clock settings from the boot loader avoiding the hard-coded settings.

Signed-off-by: Wolfgang Grandegger 
---
 Documentation/powerpc/dts-bindings/fsl/i2c.txt |2 ++
 drivers/i2c/busses/i2c-mpc.c   |   20 +++-
 2 files changed, 13 insertions(+), 9 deletions(-)

Index: linux-2.6/drivers/i2c/busses/i2c-mpc.c
===
--- linux-2.6.orig/drivers/i2c/busses/i2c-mpc.c 2009-03-31 13:25:08.0 
+0200
+++ linux-2.6/drivers/i2c/busses/i2c-mpc.c  2009-03-31 21:29:21.615721143 
+0200
@@ -323,13 +323,6 @@
if (!i2c)
return -ENOMEM;
 
-   if (of_get_property(op->node, "dfsrr", NULL))
-   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
-
-   if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
-   of_device_is_compatible(op->node, "mpc5200-i2c"))
-   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
-
init_waitqueue_head(&i2c->queue);
 
i2c->base = of_iomap(op->node, 0);
@@ -348,8 +341,17 @@
goto fail_request;
}
}
-   
-   mpc_i2c_setclock(i2c);
+
+   if (!of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
+   if (of_get_property(op->node, "dfsrr", NULL))
+   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
+
+   if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
+   of_device_is_compatible(op->node, "mpc5200-i2c"))
+   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
+
+   mpc_i2c_setclock(i2c);
+   }
 
dev_set_drvdata(&op->dev, i2c);
 
Index: linux-2.6/Documentation/powerpc/dts-bindings/fsl/i2c.txt
===
--- linux-2.6.orig/Documentation/powerpc/dts-bindings/fsl/i2c.txt   
2009-03-17 10:28:07.0 +0100
+++ linux-2.6/Documentation/powerpc/dts-bindings/fsl/i2c.txt2009-03-31 
21:35:51.527901532 +0200
@@ -20,6 +20,8 @@
a digital filter sampling rate register
  - fsl5200-clocking : boolean; if defined, indicated that this device
uses the FSL 5200 clocking mechanism.
+ - fsl,preserve-clocking : boolean; if defined, the clock settings
+   from the bootloader are preserved (not touched).
 
 Example :
i...@3000 {
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: 8641D with linux 2.6.29 did'n show second cpu

2009-03-31 Thread Becky Bruce

On Mar 31, 2009, at 10:06 AM, Eduard Fuchs wrote:


Hi,

Am Dienstag 31 März 2009 15:20:21 schrieb Kumar Gala:

On Mar 31, 2009, at 5:15 AM, Eduard Fuchs wrote:

Hi,

I'm testing the evaluation board from freescale (MPC8641DHPCN) with
the latest
linux kernel (2.6.29) and the second core seems disabled. CONFIG_SPM
is
enabled but the /proc/cpuinfo shows only one cpu. With original
2.6.27 kernel
both cpu cores appears in /proc/cpuinfo.

Has anyone an idea how can i enable the second core?


Are you using u-boot?  I can't remember if you need a newer u-boot to
deal with changes in how we bring up the second core.


Yes. My u-boot version is 2009.03. Are there some additional config  
keys for

SMP support in u-boot?


Hrm, I am able to reproduce this here - the second processor is  
reported as stuck and once we're booted, I only see one CPU online.   
Let me poke around and see if I can figure out what's going on here.


Cheers,
Becky

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


Re: [PATCH 1/2] powerpc: i2c-mpc: preserve I2C clocking

2009-03-31 Thread Wolfgang Grandegger
Grant Likely wrote:
> 2009/3/31 Wolfram Sang :
> -
> -  mpc_i2c_setclock(i2c);
> +
> +  if (set_clock)
> +  mpc_i2c_setclock(i2c);
 Can't we drop 'set_clock' with something like this here?

 +   if (!of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
 +
 +   if (of_get_property(op->node, "dfsrr", NULL))
 +   i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
 +
 +   if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
 +   of_device_is_compatible(op->node, "mpc5200-i2c"))
 +   i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
 +
 +   mpc_i2c_setclock(i2c);
 +   }
>>> No, because the I2C registers are not yet mapped.
>> Sorry, I used misleading words :) With 'here' I meant 'at this
>> position', i.e. insert my above block where mpc_i2c_setclock was used
>> anyway.
> 
> I agree.  The extra flag makes the flow more complex.  The code block
> should be moved down.

OK, I just resent the patch standalone also including documentation. I
think it can go in immediately without waiting for the full clock
setting patch.

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


Re: [PATCH v2] powerpc: i2c-mpc: preserve I2C clocking

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 2:01 PM, Wolfgang Grandegger  
wrote:
> The i2c node property "fsl,preserve-clocking" allows to overtake the
> clock settings from the boot loader avoiding the hard-coded settings.
>
> Signed-off-by: Wolfgang Grandegger 
Acked-by: Grant Likely 

> ---
>  Documentation/powerpc/dts-bindings/fsl/i2c.txt |    2 ++
>  drivers/i2c/busses/i2c-mpc.c                   |   20 +++-
>  2 files changed, 13 insertions(+), 9 deletions(-)
>
> Index: linux-2.6/drivers/i2c/busses/i2c-mpc.c
> ===
> --- linux-2.6.orig/drivers/i2c/busses/i2c-mpc.c 2009-03-31 13:25:08.0 
> +0200
> +++ linux-2.6/drivers/i2c/busses/i2c-mpc.c      2009-03-31 21:29:21.615721143 
> +0200
> @@ -323,13 +323,6 @@
>        if (!i2c)
>                return -ENOMEM;
>
> -       if (of_get_property(op->node, "dfsrr", NULL))
> -               i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
> -
> -       if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
> -                       of_device_is_compatible(op->node, "mpc5200-i2c"))
> -               i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
> -
>        init_waitqueue_head(&i2c->queue);
>
>        i2c->base = of_iomap(op->node, 0);
> @@ -348,8 +341,17 @@
>                        goto fail_request;
>                }
>        }
> -
> -       mpc_i2c_setclock(i2c);
> +
> +       if (!of_get_property(op->node, "fsl,preserve-clocking", NULL)) {
> +               if (of_get_property(op->node, "dfsrr", NULL))
> +                       i2c->flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
> +
> +               if (of_device_is_compatible(op->node, "fsl,mpc5200-i2c") ||
> +                   of_device_is_compatible(op->node, "mpc5200-i2c"))
> +                       i2c->flags |= FSL_I2C_DEV_CLOCK_5200;
> +
> +               mpc_i2c_setclock(i2c);
> +       }
>
>        dev_set_drvdata(&op->dev, i2c);
>
> Index: linux-2.6/Documentation/powerpc/dts-bindings/fsl/i2c.txt
> ===
> --- linux-2.6.orig/Documentation/powerpc/dts-bindings/fsl/i2c.txt       
> 2009-03-17 10:28:07.0 +0100
> +++ linux-2.6/Documentation/powerpc/dts-bindings/fsl/i2c.txt    2009-03-31 
> 21:35:51.527901532 +0200
> @@ -20,6 +20,8 @@
>    a digital filter sampling rate register
>  - fsl5200-clocking : boolean; if defined, indicated that this device
>    uses the FSL 5200 clocking mechanism.
> + - fsl,preserve-clocking : boolean; if defined, the clock settings
> +   from the bootloader are preserved (not touched).
>
>  Example :
>        ...@3000 {
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


MPC83xx console

2009-03-31 Thread Matthew L. Creech
Hi,

I'm trying to get Linux booting on a custom board based on the MPC8313
ERDB, but there's no output after the console is transferred.  I get
the following:

Using MPC831x RDB machine description
Linux version 2.6.29 (mlcre...@lap) (gcc version 4.3.2 (Sourcery G++ Lite 4.3-50
) ) #2 PREEMPT Tue Mar 31 14:54:27 EDT 2009
console [udbg0] enabled

... (normal boot output) ...

Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
console handover: boot [udbg0] -> real [ttyS0]
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17) is a 16550A

If I boot with "console=udbg0,115200", then it gets much further along
before printing "turn off boot console udbg0".  So presumably the
kernel is booting beyond this point, but my console isn't printing any
output.  I traced from that last line back up the call stack to the
end of drivers/serial/8250.c:serial8250_init(), and everything seems
okay (it returns 0, and pritnk() still works fine at that point).  I'm
not sure where to go from there to figure out where the problem lies.
Could someone point me in the right direction, or suggest what might
cause a console problem like this?

Thanks!

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


RE: [PATCH 4/6] powerpc: Add mmc-spi-slot bindings

2009-03-31 Thread Yann Pelletier

Original post:

Anton Vorontsov avorontsov at ru.mvista.com
Sat Jan 24 06:50:37 EST 2009

Sorry if this looks crappy, it's paste from web archive since I was not on the 
list at that time.

I've applied this patch set [1 to 6] to enable SPI device to be listed in the 
device tree instead of platform kernel file.

It is working fine but ...

> The bindings describes a case where MMC/SD/SDIO slot directly connected
> to a SPI bus. Such setups are widely used on embedded PowerPC boards.
>
> The patch also adds the mmc-spi-slot entry to the OpenFirmware modalias
> table.
>
> Signed-off-by: Anton Vorontsov 
> ---
>  .../powerpc/dts-bindings/mmc-spi-slot.txt  |   23
> 
>  drivers/of/base.c  |1 +
>  2 files changed, 24 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/powerpc/dts-bindings/mmc-spi-slot.txt
>
> diff --git a/Documentation/powerpc/dts-bindings/mmc-spi-slot.txt 
> b/Documentation/powerpc/dts-bindings/mmc-spi-slot.txt
> new file mode 100644
> index 000..c39ac28
> --- /dev/null
> +++ b/Documentation/powerpc/dts-bindings/mmc-spi-slot.txt
> @@ -0,0 +1,23 @@
> +MMC/SD/SDIO slot directly connected to a SPI bus
> +
> +Required properties:
> +- compatible : should be "mmc-spi-slot".
> +- reg : should specify SPI address (chip-select number).
> +- spi-max-frequency : maximum frequency for this device (Hz).
> +- voltage-ranges : two cells are required, first cell specifies minimum
> +  slot voltage (mV), second cell specifies maximum slot voltage (mV).
> +  Several ranges could be specified.
> +- gpios : (optional) may specify GPIOs in this order: Card-Detect GPIO,
> +  Write-Protect GPIO.
> +
> +Example:
> +
> + mmc-slot at 0 {
> + compatible = "fsl,mpc8323rdb-mmc-slot",
> +  "mmc-spi-slot";
> + reg = <0>;
> + gpios = <&qe_pio_d 14 1
> +  &qe_pio_d 15 0>;
> + voltage-ranges = <3300 3300>;
> + spi-max-frequency = <5000>;
> + };
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index cd17092..41c5dfd 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -446,6 +446,7 @@ struct of_modalias_table {
>  };
>  static struct of_modalias_table of_modalias_table[] = {
>   { "fsl,mcu-mpc8349emitx", "mcu-mpc8349emitx" },
> + { "mmc-spi-slot", "mmc_spi" },


Here I had to add 

  { "gs2970", "gs2970" },
  { "spidev", "spidev" },

>  };

To make my device get probed.  Otherwise I receive error

spi_master spi32766: cannot find modalias for 
/soc8...@e000/s...@7000/gs2...@0 
spi_master spi32766: cannot find modalias for 
/soc8...@e000/s...@7000/spi...@4


I wonder if those modalias are absolutely required.  I would prefer not to add 
platform specific stuff to the kernel as this was my motivation to apply the 
patch.  Would there be a way to get around this ?




Also, from patch 3/6 in the same patch set

+static int __devinit of_mpc83xx_spi_probe(struct of_device *ofdev,
+ const struct of_device_id *ofid)
.
+   /* SPI controller is either clocked from QE or SoC clock. */
+   pdata->sysclk = get_brgfreq();
+   if (pdata->sysclk == -1) {
+   pdata->sysclk = fsl_get_sys_freq();
+   if (pdata->sysclk == -1) {
+   ret = -ENODEV;
+   goto err_clk;
+   }
+   }

get_brgfreq() in not defined in my system as I do not use QUICK_ENGINE


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


MPC83xx console : no output after handover

2009-03-31 Thread Matthew L. Creech
(Sorry if this is a dupe, but I think my first attempt was filtered out)

Hi,

I'm trying to get Linux booting on a custom board based on the MPC8313
ERDB, but there's no output after the console is transferred.  I get
the following:

Using MPC831x RDB machine description
Linux version 2.6.29 (mlcre...@lap) (gcc version 4.3.2 (Sourcery G++ Lite 4.3-50
) ) #2 PREEMPT Tue Mar 31 14:54:27 EDT 2009
console [udbg0] enabled

... (normal boot output) ...

Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
console handover: boot [udbg0] -> real [ttyS0]
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17) is a 16550A

If I boot with "console=udbg0,115200", then it gets much further along
before printing "turn off boot console udbg0".  So presumably the
kernel is booting beyond this point, but my console isn't printing any
output.  I traced from that last line back up the call stack to the
end of drivers/serial/8250.c:serial8250_init(), and everything seems
okay (it returns 0, and pritnk() still works fine at that point).  I'm
not sure where to go from there to figure out where the problem lies.
Could someone point me in the right direction, or suggest what might
cause a console problem like this?

Thanks!

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


Re: Build error

2009-03-31 Thread Segher Boessenkool

ERROR: "fsl_pq_mdio_bus_name" [drivers/net/gianfar_driver.ko]
undefined!

I'll ask Linus to pull anyway though.

Cheers,
Ben.


I believe this is fixed in net-next (and possible linus has already
pulled that in.)


FWIW, I can't reproduce the issue neither in benh/powerpc.git `next'
branch nor in `merge' branch...


Ah .. .weird :-)


I had this happen a few days ago already, on Linus' tree.  I also told
you about it (on IRC), but you were too busy or something :-)

A simple ppc6xx_defconfig is enough to reproduce, fwiw.

Here's the patch I used, sorry if my mailer wraps it, it's a one-liner,
you can handle it I'm sure :-)


Segher


Signed-off-by: Segher Boessenkool 


Author: Segher Boessenkool 
Date:   Fri Mar 27 21:10:59 2009 +0100

powerpc: EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name)

diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index b3079a5..a108332 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -204,6 +204,7 @@ void fsl_pq_mdio_bus_name(char *name, struct  
device_node *np

snprintf(name, MII_BUS_ID_SIZE, "%...@%llx", np->name,
(unsigned long long)taddr);
 }
+EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name);

 /* Scan the bus in reverse, looking for an empty spot */
 static int fsl_pq_mdio_find_free(struct mii_bus *new_bus)

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


Re: MPC83xx console : no output after handover

2009-03-31 Thread Gary Thomas
Matthew L. Creech wrote:
> (Sorry if this is a dupe, but I think my first attempt was filtered out)

Nope, it made it.

> Hi,
> 
> I'm trying to get Linux booting on a custom board based on the MPC8313
> ERDB, but there's no output after the console is transferred.  I get
> the following:
> 
> Using MPC831x RDB machine description
> Linux version 2.6.29 (mlcre...@lap) (gcc version 4.3.2 (Sourcery G++ Lite 
> 4.3-50
> ) ) #2 PREEMPT Tue Mar 31 14:54:27 EDT 2009
> console [udbg0] enabled
> 
> ... (normal boot output) ...
> 
> Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
> serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
> console handover: boot [udbg0] -> real [ttyS0]
> serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17) is a 16550A
> 
> If I boot with "console=udbg0,115200", then it gets much further along
> before printing "turn off boot console udbg0".  So presumably the
> kernel is booting beyond this point, but my console isn't printing any
> output.  I traced from that last line back up the call stack to the
> end of drivers/serial/8250.c:serial8250_init(), and everything seems
> okay (it returns 0, and pritnk() still works fine at that point).  I'm
> not sure where to go from there to figure out where the problem lies.
> Could someone point me in the right direction, or suggest what might
> cause a console problem like this?

What does your command line (boot args) when it fails?  It should
probably have something like "console=ttyS0,115200" in it.

-- 

Gary Thomas |  Consulting for the
MLB Associates  |Embedded world

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


Re: Build error

2009-03-31 Thread Grant Likely
On Mon, Mar 30, 2009 at 5:18 PM, Benjamin Herrenschmidt
 wrote:
> On Mon, 2009-03-30 at 17:59 +0400, Anton Vorontsov wrote:
>> On Mon, Mar 30, 2009 at 08:51:38AM -0500, Kumar Gala wrote:
>> >
>> > On Mar 29, 2009, at 10:25 PM, Benjamin Herrenschmidt wrote:
>> >
>> >> My next branch (after merging from you):
>> >>
>> >> ERROR: "fsl_pq_mdio_bus_name" [drivers/net/gianfar_driver.ko]
>> >> undefined!
>> >>
>> >> I'll ask Linus to pull anyway though.
>> >>
>> >> Cheers,
>> >> Ben.
>> >
>> > I believe this is fixed in net-next (and possible linus has already
>> > pulled that in.)
>>
>> FWIW, I can't reproduce the issue neither in benh/powerpc.git `next'
>> branch nor in `merge' branch...
>
> Ah .. .weird :-)
>
> Oh well, I'll see if it still happens after I pull back from Linus (who
> merged all our stuff) and if it does, I'll send you my .config.

It is triggered when the driver is built as a module.  I'm going to
post the fix right now.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Build error

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 2:41 PM, Segher Boessenkool
 wrote:
> ERROR: "fsl_pq_mdio_bus_name" [drivers/net/gianfar_driver.ko]
> undefined!
>
 I believe this is fixed in net-next (and possible linus has already
 pulled that in.)
>>>
>>> FWIW, I can't reproduce the issue neither in benh/powerpc.git `next'
>>> branch nor in `merge' branch...
>>
>> Ah .. .weird :-)
>
> I had this happen a few days ago already, on Linus' tree.  I also told
> you about it (on IRC), but you were too busy or something :-)
>
> A simple ppc6xx_defconfig is enough to reproduce, fwiw.
>
> Here's the patch I used, sorry if my mailer wraps it, it's a one-liner,
> you can handle it I'm sure :-)
>
> Signed-off-by: Segher Boessenkool 

Heh, you beat me to it Segher.

Acked-by: Grant Likely 

g.

>
>
> Author: Segher Boessenkool 
> Date:   Fri Mar 27 21:10:59 2009 +0100
>
>    powerpc: EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name)
>
> diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
> index b3079a5..a108332 100644
> --- a/drivers/net/fsl_pq_mdio.c
> +++ b/drivers/net/fsl_pq_mdio.c
> @@ -204,6 +204,7 @@ void fsl_pq_mdio_bus_name(char *name, struct device_node
> *np
>        snprintf(name, MII_BUS_ID_SIZE, "%...@%llx", np->name,
>                (unsigned long long)taddr);
>  }
> +EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name);
>
>  /* Scan the bus in reverse, looking for an empty spot */
>  static int fsl_pq_mdio_find_free(struct mii_bus *new_bus)
>
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Build error

2009-03-31 Thread Anton Vorontsov
On Tue, Mar 31, 2009 at 10:41:38PM +0200, Segher Boessenkool wrote:
> ERROR: "fsl_pq_mdio_bus_name" [drivers/net/gianfar_driver.ko]
> undefined!
>
> I'll ask Linus to pull anyway though.
>
> Cheers,
> Ben.

 I believe this is fixed in net-next (and possible linus has already
 pulled that in.)
>>>
>>> FWIW, I can't reproduce the issue neither in benh/powerpc.git `next'
>>> branch nor in `merge' branch...
>>
>> Ah .. .weird :-)
>
> I had this happen a few days ago already, on Linus' tree.  I also told
> you about it (on IRC), but you were too busy or something :-)
>
> A simple ppc6xx_defconfig is enough to reproduce, fwiw.
>
> Here's the patch I used, sorry if my mailer wraps it, it's a one-liner,
> you can handle it I'm sure :-)

Ah, the modular build. Yeah, I didn't try it, but should have... :-(

Thanks!

> Segher
>
>
> Signed-off-by: Segher Boessenkool 
>
>
> Author: Segher Boessenkool 
> Date:   Fri Mar 27 21:10:59 2009 +0100
>
> powerpc: EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name)
>
> diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
> index b3079a5..a108332 100644
> --- a/drivers/net/fsl_pq_mdio.c
> +++ b/drivers/net/fsl_pq_mdio.c
> @@ -204,6 +204,7 @@ void fsl_pq_mdio_bus_name(char *name, struct  
> device_node *np
> snprintf(name, MII_BUS_ID_SIZE, "%...@%llx", np->name,
> (unsigned long long)taddr);
>  }
> +EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name);
>
>  /* Scan the bus in reverse, looking for an empty spot */
>  static int fsl_pq_mdio_find_free(struct mii_bus *new_bus)
>

-- 
Anton Vorontsov
email: cbouatmai...@gmail.com
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


RE: Interrupts on GPIO

2009-03-31 Thread Yann Pelletier
> Message: 7
> Date: Mon, 30 Mar 2009 10:32:17 -0600
> From: Grant Likely 
> Subject: > To: Yann Pelletier 
> Cc: "linuxppc-dev@ozlabs.org" 
> Message-ID:
>   
> Content-Type: text/plain; charset=ISO-8859-1
> 
> On Mon, Mar 30, 2009 at 9:57 AM, Yann Pelletier
>  wrote:
> >
> > Hi,
> > I'd like to add supports for interrupts handling from GPIO controller.
> ?Some of these interrupts are from I2C devices and some others are from
> SPI devices.
> >
> > What is the best approach to enable interrupts handling for those
> devices through GPIO.
> 
> Modify the GPIO driver to also be a cascaded IRQ driver (see
> http://patchwork.ozlabs.org/patch/21914/ for an example).
> 

I've looked at the patch but I wonder if this would be applicable to the 
MPC8313.  If my understanding is good, in the MPC52xx you have 8 gpio only 
interrupts and 8 gpio/gpt.  With the MPC8313, each GPIO can act as an interrupt 
but they are all muxed to only 1 interrupt in the IPIC.  So I'm concern about 
making the GPIO controller act as an interrupt controller.



> > Also,
> >
> > # cat /proc/interrupts
> > ? ? ? ? ? CPU0
> > ?16: ? ? ? ? 60 ? IPIC ? Level ? ? serial
> > ?17: ? ? ? ? ?0 ? IPIC ? Level ? ? fpga
> > ?18: ? ? ? ? ?4 ? IPIC ? Level ? ? mpc83xx_spi
> > ?21: ? ? ? ? ?0 ? IPIC ? Level ? ? i2c-mpc
> > ?22: ? ? ? ? ?7 ? IPIC ? Level ? ? i2c-mpc
> >
> > According to my platform device tree, serial irq should be on int9, SPI
> on int16 and i2c on int14,15. ?This causes me some problems as I need
> int18 to map to external IRQ2.
> 
> These numbers are *Linux internal* virtual irq numbers.  They have no
> relation to the physical IRQ number for each interrupt controller.
> Just make sure your Device Tree maps the IRQs correctly and you'll be
> okay.
> 

This is good now, thanks

> g.
> 
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
> 
> 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: MPC83xx console : no output after handover

2009-03-31 Thread Matthew L. Creech
On Tue, Mar 31, 2009 at 4:45 PM, Gary Thomas  wrote:
>
> What does your command line (boot args) when it fails?  It should
> probably have something like "console=ttyS0,115200" in it.
>

Yes, that's what I'm using.  It also seems to be the default if none
is supplied.

For the sake of completeness, here's a full dump:


Using MPC831x RDB machine description
Linux version 2.6.29 (mlcre...@lap) (gcc version 4.3.2 (Sourcery G++ Lite 4.3-50
) ) #3 PREEMPT Tue Mar 31 15:10:02 EDT 2009
console [udbg0] enabled
setup_arch: bootmem
mpc831x_rdb_setup_arch()
arch: exit
Zone PFN ranges:
  DMA  0x -> 0x8000
  Normal   0x8000 -> 0x8000
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0: 0x -> 0x8000
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: root=/dev/mtdblock1 init=/bin/sh console=ttyS0,115200
IPIC (128 IRQ sources) at fdffd700
PID hash table entries: 512 (order: 9, 2048 bytes)
clocksource: timebase mult[781] shift[22] registered
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 126236k/131072k available (3260k kernel code, 4692k reserved, 136k data,
 98k bss, 160k init)
SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Calibrating delay loop... 66.30 BogoMIPS (lpj=33152)
Mount-cache hash table entries: 512
net_namespace: 708 bytes
NET: Registered protocol family 16

bio: create slab  at 0
Freescale Elo / Elo Plus DMA driver
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
NET: Registered protocol family 1
WDT driver for MPC8xxx initialized. mode:reset timeout=65535 (32 seconds)
fsl-elo-dma e00082a8.dma: Probe the Freescale DMA driver for fsl,elo-dma control
ler at e00082a8...
fsl-elo-dma e00082a8.dma: #0 (fsl,elo-dma-channel), irq 71
fsl-elo-dma e00082a8.dma: #1 (fsl,elo-dma-channel), irq 71
fsl-elo-dma e00082a8.dma: #2 (fsl,elo-dma-channel), irq 71
fsl-elo-dma e00082a8.dma: #3 (fsl,elo-dma-channel), irq 71
squashfs: version 4.0 (2009/01/31) Phillip Lougher
Registering unionfs 2.5.1 (for 2.6.29-rc2)
yaffs Mar 31 2009 02:31:59 Installing.
msgmni has been set to 246
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered (default)
io scheduler cfq registered
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
console handover: boot [udbg0] -> real [ttyS0]
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17) is a 16550A


(nothing after this)

Thanks

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


Re: [PATCH] Add hvc_console to MAINTAINERS

2009-03-31 Thread Joe Perches
On Tue, 2009-03-31 at 09:29 -0400, Josh Boyer wrote:
> Add a MAINTAINERS entry for the hypervisor virtual console support
> used on IBM POWER servers.
> 
> Signed-off-by: Josh Boyer 
> ---
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c5f4e9d..387ad45 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2176,6 +2176,11 @@ W:   http://www.ia64-linux.org/
>  T: git kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
>  S: Maintained
>  
> +IBM HYPERVISOR VIRTUAL CONSOLE
> +P: Several
> +L: linuxppc-dev@ozlabs.org
> +S: Maintained
> +
>  IBM MCA SCSI SUBSYSTEM DRIVER
>  P: Michael Lang
>  M: lan...@kph.uni-mainz.de

I think this sort of entry should not be acceptable.
Maintainers should have individual names and contact addresses.

An exploder entry should be OK though.
For instance, the DVB subsystem:

DVB SUBSYSTEM AND DRIVERS
P:  LinuxTV.org Project
M:  linux-me...@vger.kernel.org

A list entry could be something like:

P:  Linux PCMCIA Team
L:  linux-pcm...@lists.infradead.org


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


Re: [PATCH] Add hvc_console to MAINTAINERS

2009-03-31 Thread Andrew Morton
On Tue, 31 Mar 2009 14:10:23 -0700
Joe Perches  wrote:

> On Tue, 2009-03-31 at 09:29 -0400, Josh Boyer wrote:
> > Add a MAINTAINERS entry for the hypervisor virtual console support
> > used on IBM POWER servers.
> > 
> > Signed-off-by: Josh Boyer 
> > ---
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index c5f4e9d..387ad45 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -2176,6 +2176,11 @@ W:   http://www.ia64-linux.org/
> >  T: git kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
> >  S: Maintained
> >  
> > +IBM HYPERVISOR VIRTUAL CONSOLE
> > +P: Several
> > +L: linuxppc-dev@ozlabs.org
> > +S: Maintained
> > +
> >  IBM MCA SCSI SUBSYSTEM DRIVER
> >  P: Michael Lang
> >  M: lan...@kph.uni-mainz.de
> 
> I think this sort of entry should not be acceptable.
> Maintainers should have individual names and contact addresses.

There isn't a maintainer.

But people send patches to the wrong list, so the ppc guys (who use
this driver) don't get to see them.

That's a practical, real-world problem.  We should have a fix for it.

> An exploder entry should be OK though.
> For instance, the DVB subsystem:
> 
>   DVB SUBSYSTEM AND DRIVERS
>   P:  LinuxTV.org Project
>   M:  linux-me...@vger.kernel.org
> 
> A list entry could be something like:
> 
>   P:  Linux PCMCIA Team
>   L:  linux-pcm...@lists.infradead.org
> 

I'm unclear on what the difference is here..
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: MPC83xx console : no output after handover

2009-03-31 Thread Gary Thomas
Matthew L. Creech wrote:
> On Tue, Mar 31, 2009 at 4:45 PM, Gary Thomas  wrote:
>> What does your command line (boot args) when it fails?  It should
>> probably have something like "console=ttyS0,115200" in it.
>>
> 
> Yes, that's what I'm using.  It also seems to be the default if none
> is supplied.
> 
> For the sake of completeness, here's a full dump:
> 
> 
> Using MPC831x RDB machine description
> Linux version 2.6.29 (mlcre...@lap) (gcc version 4.3.2 (Sourcery G++ Lite 
> 4.3-50
> ) ) #3 PREEMPT Tue Mar 31 15:10:02 EDT 2009
> console [udbg0] enabled
> setup_arch: bootmem
> mpc831x_rdb_setup_arch()
> arch: exit
> Zone PFN ranges:
>   DMA  0x -> 0x8000
>   Normal   0x8000 -> 0x8000
> Movable zone start PFN for each node
> early_node_map[1] active PFN ranges
> 0: 0x -> 0x8000
> Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
> Kernel command line: root=/dev/mtdblock1 init=/bin/sh console=ttyS0,115200
> IPIC (128 IRQ sources) at fdffd700
> PID hash table entries: 512 (order: 9, 2048 bytes)
> clocksource: timebase mult[781] shift[22] registered
> Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
> Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
> Memory: 126236k/131072k available (3260k kernel code, 4692k reserved, 136k 
> data,
>  98k bss, 160k init)
> SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> Calibrating delay loop... 66.30 BogoMIPS (lpj=33152)
> Mount-cache hash table entries: 512
> net_namespace: 708 bytes
> NET: Registered protocol family 16
> 
> bio: create slab  at 0
> Freescale Elo / Elo Plus DMA driver
> NET: Registered protocol family 2
> IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
> TCP established hash table entries: 4096 (order: 3, 32768 bytes)
> TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
> TCP: Hash tables configured (established 4096 bind 4096)
> TCP reno registered
> NET: Registered protocol family 1
> WDT driver for MPC8xxx initialized. mode:reset timeout=65535 (32 seconds)
> fsl-elo-dma e00082a8.dma: Probe the Freescale DMA driver for fsl,elo-dma 
> control
> ler at e00082a8...
> fsl-elo-dma e00082a8.dma: #0 (fsl,elo-dma-channel), irq 71
> fsl-elo-dma e00082a8.dma: #1 (fsl,elo-dma-channel), irq 71
> fsl-elo-dma e00082a8.dma: #2 (fsl,elo-dma-channel), irq 71
> fsl-elo-dma e00082a8.dma: #3 (fsl,elo-dma-channel), irq 71
> squashfs: version 4.0 (2009/01/31) Phillip Lougher
> Registering unionfs 2.5.1 (for 2.6.29-rc2)
> yaffs Mar 31 2009 02:31:59 Installing.
> msgmni has been set to 246
> alg: No test for stdrng (krng)
> io scheduler noop registered
> io scheduler anticipatory registered
> io scheduler deadline registered (default)
> io scheduler cfq registered
> Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
> serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16) is a 16550A
> console handover: boot [udbg0] -> real [ttyS0]
> serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17) is a 16550A
> 

The fact that you get the ttyS1 line printed is interesting.  At
this point, the kernel is switching from raw console I/O (only
suitable for bring-up messages) to the general serial driver
(interrupt driven, etc).  I'm curious about what the ttyS1 driver
is causing to break...

A couple of things you could try:
  * Disable ttyS1 (take it out of your device tree)
  * Look at the console log when this happens.  Look in your system
map for the symbol '__log_buf', e.g.
   c031ca54 b __log_buf
This will get stored at physical location '0x31ca54' and will
often contain data that didn't get a chance to print, for example
if you have stuck interrupts that prevent the console from working.
I'd just run it to this point and then examine the memory - either
using a BDI if one is attached, or press RESET (I hope you have one!)
and then look using your boot loader (uBoot, RedBoot, ...)



-- 

Gary Thomas |  Consulting for the
MLB Associates  |Embedded world

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


Re: Interrupts on GPIO

2009-03-31 Thread Grant Likely
On Tue, Mar 31, 2009 at 2:59 PM, Yann Pelletier
 wrote:
>> Message: 7
>> Date: Mon, 30 Mar 2009 10:32:17 -0600
>> From: Grant Likely 
>> Subject: > To: Yann Pelletier 
>> Cc: "linuxppc-dev@ozlabs.org" 
>> Message-ID:
>>       
>> Content-Type: text/plain; charset=ISO-8859-1
>>
>> On Mon, Mar 30, 2009 at 9:57 AM, Yann Pelletier
>>  wrote:
>> >
>> > Hi,
>> > I'd like to add supports for interrupts handling from GPIO controller.
>> ?Some of these interrupts are from I2C devices and some others are from
>> SPI devices.
>> >
>> > What is the best approach to enable interrupts handling for those
>> devices through GPIO.
>>
>> Modify the GPIO driver to also be a cascaded IRQ driver (see
>> http://patchwork.ozlabs.org/patch/21914/ for an example).
>>
>
> I've looked at the patch but I wonder if this would be applicable to the 
> MPC8313.  If my understanding is good, in the MPC52xx you have 8 gpio only 
> interrupts and 8 gpio/gpt.  With the MPC8313, each GPIO can act as an 
> interrupt but they are all muxed to only 1 interrupt in the IPIC.  So I'm 
> concern about making the GPIO controller act as an interrupt controller.

Why?  The situation really isn't any different.  Using the GPIO
controller hardware as a Linux interrupt controller means that other
drivers can just use it without having to do anything special.  It's
just and IRQ.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


  1   2   >