* Re: [PATCH v2] drivers/ata: add support to Freescale 3.0Gbps SATA Controller
From: Arnd Bergmann @ 2007-10-15 11:45 UTC (permalink / raw)
To: Kalra Ashish-B00888; +Cc: linuxppc-dev, jgarzik, linux-ide
In-Reply-To: <2A6F278C5B66C4459AF4013E77A40CD3FCBB59@zin33exm20.fsl.freescale.net>
On Monday 15 October 2007, Kalra Ashish-B00888 wrote:
> Thanks for your comments and feedback.
>
> Actually, for PowerPC platforms iowrite32/ioread32 internally call
> writel/readl, which are again mapped to out_le32/in_le32,
This is correct on 6xx and e500 for now, but it's a little more
complicated than that in general:
iowriteXX/ioreadXX are either the simple readX/writeX wrappers
from arch/powerpc/kernel/iomap.c, or the more complex functions
from lib/iomap.c, depending on whether any of the active platforms
has set CONFIG_PPC_INDIRECT_IO.
writeX/readX can either map directly to out_leXX/in_leXX, or do
something more complicated, again depending on the platform.
In general, writeX/readX may need to consider PCI specific error
handling or synchronization requirements, while out_leXX/in_leXX
are low-level accessors that should only be used by device drivers
when they are used on directly connected (non-PCI) devices.
Since iowriteXX/ioreadXX is supposed to be the most generic
variant covering both PCI MMIO (writeX/readX) and PCI PIO
(outX/inX) transfers, it would make sense to extend them to
also do SOC MMIO (out_leXX/in_leXX/out_beXX/in_beXX) and
DCR (dcr_write/dcr_read) accesses in the future.
Arnd <><
^ permalink raw reply
* Re: [PATCH v2 4/7] bestcomm: core bestcomm support for Freescale MPC5200
From: Matt Sealey @ 2007-10-15 11:55 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-dev, paulus, domen.puncer
In-Reply-To: <20071014044205.23438.36036.stgit@trillian.cg.shawcable.net>
My nits:
Grant Likely wrote:
> From: Sylvain Munaut <tnt@246tNt.com>
> +static int __devinit
> +bcom_engine_init(void)
Why "bcom" and not "bestcomm"?
> + /* Disable COMM Bus Prefetch, apparently it's not reliable yet */
> + /* FIXME: This should be done on 5200 and not 5200B ... */
> + out_be16(&bcom_eng->regs->PtdCntrl, in_be16(&bcom_eng->regs->PtdCntrl) | 1);
This really, really shouldn't even be here, could it be moved to a platform
init, or switched on a PVR/SVR here?
> +int bcom_sram_init(struct device_node *sram_node, char *owner)
> +{
> + int rv;
> + const u32 *regaddr_p;
> + u64 regaddr64, size64;
> + unsigned int psize;
> +
> + /* Create our state struct */
> + if (bcom_sram) {
> + printk(KERN_ERR "%s: bcom_sram_init: "
> + "Already initialiwed !\n", owner);
> + return -EBUSY;
> + }
initialised or initialized :)
> + printk(KERN_ERR "%s: bcom_sram_init: "
> + "Couln't request region !\n", owner);
> + rv = -EBUSY;
> + goto error_free;
Couldn't or could not.
--
Matt Sealey <matt@genesi-usa.com>
Genesi, Manager, Developer Relations
^ permalink raw reply
* RE: [PATCH v3 3/9] add Freescale SerDes PHY support
From: Li Yang-r58472 @ 2007-10-15 12:30 UTC (permalink / raw)
To: Arnd Bergmann, linuxppc-dev; +Cc: linuxppc-dev, paulus
In-Reply-To: <200710121633.49263.arnd@arndb.de>
> -----Original Message-----
> From: linuxppc-dev-bounces+leoli=3Dfreescale.com@ozlabs.org=20
> [mailto:linuxppc-dev-bounces+leoli=3Dfreescale.com@ozlabs.org]=20
> On Behalf Of Arnd Bergmann
> Sent: Friday, October 12, 2007 10:34 PM
> To: linuxppc-dev@ozlabs.org
> Cc: linuxppc-dev@ozlabs.org; paulus@samba.org
> Subject: Re: [PATCH v3 3/9] add Freescale SerDes PHY support
>=20
> On Friday 12 October 2007, Li Yang wrote:
> > The SerDes(serializer/deserializer) PHY block is a new SoC=20
> block used=20
> > in Freescale chips to support multiple serial interfaces,=20
> such as PCI=20
> > Express, SGMII, SATA.
>=20
> Some of my comments here are similar to those for the ata=20
> driver, so I won't be as verbose here
>=20
> > +static int __init setup_serdes(struct device_node *np) {
> > + void __iomem *regs;
> > + const void *prot;
> > + const unsigned int *freq;
> > + struct resource res;
> > + u32 rfcks;
> > +
> > + of_address_to_resource(np, 0, &res);
> > + regs =3D ioremap(res.start, res.end - res.start + 1);
>=20
> of_iomap?
I'd like to but of_iomap() couldn't provide the physical address of the
device used as identification.
- Leo
^ permalink raw reply
* [PATCH 1/2] i2c: ibm_iic: Whitespace cleanup
From: Stefan Roese @ 2007-10-15 13:28 UTC (permalink / raw)
To: i2c, linuxppc-dev; +Cc: Jean Delvare
Signed-off-by: Stefan Roese <sr@denx.de>
=2D--
drivers/i2c/busses/i2c-ibm_iic.c | 192 +++++++++++++++++++---------------=
=2D---
drivers/i2c/busses/i2c-ibm_iic.h | 8 +-
2 files changed, 100 insertions(+), 100 deletions(-)
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_=
iic.c
index e08baca..956b947 100644
=2D-- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -6,7 +6,7 @@
* Copyright (c) 2003, 2004 Zultys Technologies.
* Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
*
=2D * Based on original work by=20
+ * Based on original work by
* Ian DaSilva <idasilva@mvista.com>
* Armin Kuster <akuster@mvista.com>
* Matt Porter <mporter@mvista.com>
@@ -18,7 +18,7 @@
* Copyright 1995-97 Simon G. Vogl
* 1998-99 Hans Berglund
*
=2D * With some changes from Ky=F6sti M=E4lkki <kmalkki@cc.hut.fi>=20
+ * With some changes from Ky=F6sti M=E4lkki <kmalkki@cc.hut.fi>
* and even Frodo Looijaard <frodol@dds.nl>
*
* This program is free software; you can redistribute it and/or modify it
@@ -86,8 +86,8 @@ static void dump_iic_regs(const char* header, struct ibm_=
iic_private* dev)
KERN_DEBUG " sts =3D 0x%02x, extsts =3D 0x%02x\n"
KERN_DEBUG " clkdiv =3D 0x%02x, xfrcnt =3D 0x%02x\n"
KERN_DEBUG " xtcntlss =3D 0x%02x, directcntl =3D 0x%02x\n",
=2D in_8(&iic->cntl), in_8(&iic->mdcntl), in_8(&iic->sts),=20
=2D in_8(&iic->extsts), in_8(&iic->clkdiv), in_8(&iic->xfrcnt),=20
+ in_8(&iic->cntl), in_8(&iic->mdcntl), in_8(&iic->sts),
+ in_8(&iic->extsts), in_8(&iic->clkdiv), in_8(&iic->xfrcnt),
in_8(&iic->xtcntlss), in_8(&iic->directcntl));
}
# define DUMP_REGS(h,dev) dump_iic_regs((h),(dev))
@@ -125,7 +125,7 @@ static inline void iic_interrupt_mode(struct ibm_iic_pr=
ivate* dev, int enable)
{
out_8(&dev->vaddr->intmsk, enable ? INTRMSK_EIMTC : 0);
}
=2D=20
+
/*
* Initialize IIC interface.
*/
@@ -134,7 +134,7 @@ static void iic_dev_init(struct ibm_iic_private* dev)
volatile struct iic_regs __iomem *iic =3D dev->vaddr;
=20
DBG("%d: init\n", dev->idx);
=2D=09
+
/* Clear master address */
out_8(&iic->lmadr, 0);
out_8(&iic->hmadr, 0);
@@ -160,7 +160,7 @@ static void iic_dev_init(struct ibm_iic_private* dev)
=20
/* Clear control register */
out_8(&iic->cntl, 0);
=2D=09
+
/* Enable interrupts if possible */
iic_interrupt_mode(dev, dev->irq >=3D 0);
=20
@@ -171,7 +171,7 @@ static void iic_dev_init(struct ibm_iic_private* dev)
DUMP_REGS("iic_init", dev);
}
=20
=2D/*=20
+/*
* Reset IIC interface
*/
static void iic_dev_reset(struct ibm_iic_private* dev)
@@ -179,42 +179,42 @@ static void iic_dev_reset(struct ibm_iic_private* dev)
volatile struct iic_regs __iomem *iic =3D dev->vaddr;
int i;
u8 dc;
=2D=09
+
DBG("%d: soft reset\n", dev->idx);
DUMP_REGS("reset", dev);
=2D=09
+
/* Place chip in the reset state */
out_8(&iic->xtcntlss, XTCNTLSS_SRST);
=2D=09
+
/* Check if bus is free */
=2D dc =3D in_8(&iic->directcntl);=09
+ dc =3D in_8(&iic->directcntl);
if (!DIRCTNL_FREE(dc)){
DBG("%d: trying to regain bus control\n", dev->idx);
=2D=09
+
/* Try to set bus free state */
=2D out_8(&iic->directcntl, DIRCNTL_SDAC | DIRCNTL_SCC);=09
=2D=09
+ out_8(&iic->directcntl, DIRCNTL_SDAC | DIRCNTL_SCC);
+
/* Wait until we regain bus control */
for (i =3D 0; i < 100; ++i){
dc =3D in_8(&iic->directcntl);
if (DIRCTNL_FREE(dc))
break;
=2D =09
+
/* Toggle SCL line */
dc ^=3D DIRCNTL_SCC;
out_8(&iic->directcntl, dc);
udelay(10);
dc ^=3D DIRCNTL_SCC;
out_8(&iic->directcntl, dc);
=2D =09
+
/* be nice */
cond_resched();
}
}
=2D=09
+
/* Remove reset */
out_8(&iic->xtcntlss, 0);
=2D=09
+
/* Reinitialize interface */
iic_dev_init(dev);
}
@@ -324,14 +324,14 @@ static irqreturn_t iic_handler(int irq, void *dev_id)
{
struct ibm_iic_private* dev =3D (struct ibm_iic_private*)dev_id;
volatile struct iic_regs __iomem *iic =3D dev->vaddr;
=2D=09
=2D DBG2("%d: irq handler, STS =3D 0x%02x, EXTSTS =3D 0x%02x\n",=20
+
+ DBG2("%d: irq handler, STS =3D 0x%02x, EXTSTS =3D 0x%02x\n",
dev->idx, in_8(&iic->sts), in_8(&iic->extsts));
=2D=09
+
/* Acknowledge IRQ and wakeup iic_wait_for_tc */
out_8(&iic->sts, STS_IRQA | STS_SCMP);
wake_up_interruptible(&dev->wq);
=2D=09
+
return IRQ_HANDLED;
}
=20
@@ -341,19 +341,19 @@ static irqreturn_t iic_handler(int irq, void *dev_id)
*/
static int iic_xfer_result(struct ibm_iic_private* dev)
{
=2D volatile struct iic_regs __iomem *iic =3D dev->vaddr;=09
=2D=09
+ volatile struct iic_regs __iomem *iic =3D dev->vaddr;
+
if (unlikely(in_8(&iic->sts) & STS_ERR)){
=2D DBG("%d: xfer error, EXTSTS =3D 0x%02x\n", dev->idx,=20
+ DBG("%d: xfer error, EXTSTS =3D 0x%02x\n", dev->idx,
in_8(&iic->extsts));
=2D =09
+
/* Clear errors and possible pending IRQs */
=2D out_8(&iic->extsts, EXTSTS_IRQP | EXTSTS_IRQD |=20
+ out_8(&iic->extsts, EXTSTS_IRQP | EXTSTS_IRQD |
EXTSTS_LA | EXTSTS_ICT | EXTSTS_XFRA);
=2D =09
+
/* Flush master data buffer */
out_8(&iic->mdcntl, in_8(&iic->mdcntl) | MDCNTL_FMDB);
=2D =09
+
/* Is bus free?
* If error happened during combined xfer
* IIC interface is usually stuck in some strange
@@ -376,11 +376,11 @@ static void iic_abort_xfer(struct ibm_iic_private* de=
v)
{
volatile struct iic_regs __iomem *iic =3D dev->vaddr;
unsigned long x;
=2D=09
+
DBG("%d: iic_abort_xfer\n", dev->idx);
=2D=09
+
out_8(&iic->cntl, CNTL_HMT);
=2D=09
+
/*
* Wait for the abort command to complete.
* It's not worth to be optimized, just poll (timeout >=3D 1 tick)
@@ -405,13 +405,13 @@ static void iic_abort_xfer(struct ibm_iic_private* de=
v)
* Returns the number of transferred bytes or error (<0)
*/
static int iic_wait_for_tc(struct ibm_iic_private* dev){
=2D=09
+
volatile struct iic_regs __iomem *iic =3D dev->vaddr;
int ret =3D 0;
=2D=09
+
if (dev->irq >=3D 0){
/* Interrupt mode */
=2D ret =3D wait_event_interruptible_timeout(dev->wq,=20
+ ret =3D wait_event_interruptible_timeout(dev->wq,
!(in_8(&iic->sts) & STS_PT), dev->adap.timeout * HZ);
=20
if (unlikely(ret < 0))
@@ -424,37 +424,37 @@ static int iic_wait_for_tc(struct ibm_iic_private* de=
v){
else {
/* Polling mode */
unsigned long x =3D jiffies + dev->adap.timeout * HZ;
=2D =09
+
while (in_8(&iic->sts) & STS_PT){
if (unlikely(time_after(jiffies, x))){
DBG("%d: poll timeout\n", dev->idx);
ret =3D -ETIMEDOUT;
break;
}
=2D =09
+
if (unlikely(signal_pending(current))){
DBG("%d: poll interrupted\n", dev->idx);
ret =3D -ERESTARTSYS;
break;
}
schedule();
=2D }=09
+ }
}
=2D=09
+
if (unlikely(ret < 0))
iic_abort_xfer(dev);
else
ret =3D iic_xfer_result(dev);
=2D=09
+
DBG2("%d: iic_wait_for_tc -> %d\n", dev->idx, ret);
=2D=09
+
return ret;
}
=20
/*
* Low level master transfer routine
*/
=2Dstatic int iic_xfer_bytes(struct ibm_iic_private* dev, struct i2c_msg* p=
m,=20
+static int iic_xfer_bytes(struct ibm_iic_private* dev, struct i2c_msg* pm,
int combined_xfer)
{
volatile struct iic_regs __iomem *iic =3D dev->vaddr;
@@ -465,48 +465,48 @@ static int iic_xfer_bytes(struct ibm_iic_private* dev=
, struct i2c_msg* pm,
u8 cntl =3D (in_8(&iic->cntl) & CNTL_AMD) | CNTL_PT;
if (pm->flags & I2C_M_RD)
cntl |=3D CNTL_RW;
=2D=09
+
loops =3D (len + 3) / 4;
for (i =3D 0; i < loops; ++i, len -=3D 4){
int count =3D len > 4 ? 4 : len;
u8 cmd =3D cntl | ((count - 1) << CNTL_TCT_SHIFT);
=2D =09
+
if (!(cntl & CNTL_RW))
for (j =3D 0; j < count; ++j)
out_8((void __iomem *)&iic->mdbuf, *buf++);
=2D =09
+
if (i < loops - 1)
cmd |=3D CNTL_CHT;
else if (combined_xfer)
cmd |=3D CNTL_RPST;
=2D =09
+
DBG2("%d: xfer_bytes, %d, CNTL =3D 0x%02x\n", dev->idx, count, cmd);
=2D =09
+
/* Start transfer */
out_8(&iic->cntl, cmd);
=2D =09
+
/* Wait for completion */
ret =3D iic_wait_for_tc(dev);
=20
if (unlikely(ret < 0))
break;
else if (unlikely(ret !=3D count)){
=2D DBG("%d: xfer_bytes, requested %d, transfered %d\n",=20
+ DBG("%d: xfer_bytes, requested %d, transfered %d\n",
dev->idx, count, ret);
=2D =09
+
/* If it's not a last part of xfer, abort it */
if (combined_xfer || (i < loops - 1))
iic_abort_xfer(dev);
=2D =09
+
ret =3D -EREMOTEIO;
=2D break; =09
+ break;
}
=2D =09
+
if (cntl & CNTL_RW)
for (j =3D 0; j < count; ++j)
*buf++ =3D in_8((void __iomem *)&iic->mdbuf);
}
=2D=09
+
return ret > 0 ? 0 : ret;
}
=20
@@ -517,10 +517,10 @@ static inline void iic_address(struct ibm_iic_private=
* dev, struct i2c_msg* msg)
{
volatile struct iic_regs __iomem *iic =3D dev->vaddr;
u16 addr =3D msg->addr;
=2D=09
=2D DBG2("%d: iic_address, 0x%03x (%d-bit)\n", dev->idx,=20
+
+ DBG2("%d: iic_address, 0x%03x (%d-bit)\n", dev->idx,
addr, msg->flags & I2C_M_TEN ? 10 : 7);
=2D=09
+
if (msg->flags & I2C_M_TEN){
out_8(&iic->cntl, CNTL_AMD);
out_8(&iic->lmadr, addr);
@@ -537,15 +537,15 @@ static inline int iic_invalid_address(const struct i2=
c_msg* p)
return (p->addr > 0x3ff) || (!(p->flags & I2C_M_TEN) && (p->addr > 0x7f));
}
=20
=2Dstatic inline int iic_address_neq(const struct i2c_msg* p1,=20
+static inline int iic_address_neq(const struct i2c_msg* p1,
const struct i2c_msg* p2)
{
=2D return (p1->addr !=3D p2->addr)=20
+ return (p1->addr !=3D p2->addr)
|| ((p1->flags & I2C_M_TEN) !=3D (p2->flags & I2C_M_TEN));
=2D}=20
+}
=20
/*
=2D * Generic master transfer entrypoint.=20
+ * Generic master transfer entrypoint.
* Returns the number of processed messages or error (<0)
*/
static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int nu=
m)
@@ -553,20 +553,20 @@ static int iic_xfer(struct i2c_adapter *adap, struct =
i2c_msg *msgs, int num)
struct ibm_iic_private* dev =3D (struct ibm_iic_private*)(i2c_get_ada=
pdata(adap));
volatile struct iic_regs __iomem *iic =3D dev->vaddr;
int i, ret =3D 0;
=2D=09
+
DBG2("%d: iic_xfer, %d msg(s)\n", dev->idx, num);
=2D=09
+
if (!num)
return 0;
=2D=09
+
/* Check the sanity of the passed messages.
* Uhh, generic i2c layer is more suitable place for such code...
*/
if (unlikely(iic_invalid_address(&msgs[0]))){
=2D DBG("%d: invalid address 0x%03x (%d-bit)\n", dev->idx,=20
+ DBG("%d: invalid address 0x%03x (%d-bit)\n", dev->idx,
msgs[0].addr, msgs[0].flags & I2C_M_TEN ? 10 : 7);
return -EINVAL;
=2D } =09
+ }
for (i =3D 0; i < num; ++i){
if (unlikely(msgs[i].len <=3D 0)){
if (num =3D=3D 1 && !msgs[0].len){
@@ -576,7 +576,7 @@ static int iic_xfer(struct i2c_adapter *adap, struct i2=
c_msg *msgs, int num)
*/
return iic_smbus_quick(dev, &msgs[0]);
}
=2D DBG("%d: invalid len %d in msg[%d]\n", dev->idx,=20
+ DBG("%d: invalid len %d in msg[%d]\n", dev->idx,
msgs[i].len, i);
return -EINVAL;
}
@@ -585,34 +585,34 @@ static int iic_xfer(struct i2c_adapter *adap, struct =
i2c_msg *msgs, int num)
return -EINVAL;
}
}
=2D=09
+
/* Check bus state */
if (unlikely((in_8(&iic->extsts) & EXTSTS_BCS_MASK) !=3D EXTSTS_BCS_FREE)=
){
DBG("%d: iic_xfer, bus is not free\n", dev->idx);
=2D =09
+
/* Usually it means something serious has happend.
* We *cannot* have unfinished previous transfer
* so it doesn't make any sense to try to stop it.
=2D * Probably we were not able to recover from the=20
+ * Probably we were not able to recover from the
* previous error.
* The only *reasonable* thing I can think of here
* is soft reset. --ebs
*/
iic_dev_reset(dev);
=2D =09
+
if ((in_8(&iic->extsts) & EXTSTS_BCS_MASK) !=3D EXTSTS_BCS_FREE){
DBG("%d: iic_xfer, bus is still not free\n", dev->idx);
return -EREMOTEIO;
}
=2D }=20
+ }
else {
/* Flush master data buffer (just in case) */
out_8(&iic->mdcntl, in_8(&iic->mdcntl) | MDCNTL_FMDB);
}
=2D=09
+
/* Load slave address */
iic_address(dev, &msgs[0]);
=2D=09
+
/* Do real transfer */
for (i =3D 0; i < num && !ret; ++i)
ret =3D iic_xfer_bytes(dev, &msgs[i], i < num - 1);
@@ -648,7 +648,7 @@ static inline u8 iic_clckdiv(unsigned int opb)
=20
/* Convert to MHz */
opb /=3D 1000000;
=2D=09
+
if (opb < 20 || opb > 150){
printk(KERN_CRIT "ibm-iic: invalid OPB clock frequency %u MHz\n",
opb);
@@ -666,7 +666,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
struct i2c_adapter* adap;
struct ocp_func_iic_data* iic_data =3D ocp->def->additions;
int ret;
=2D=09
+
if (!iic_data)
printk(KERN_WARNING"ibm-iic%d: missing additional data!\n",
ocp->def->index);
@@ -679,7 +679,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
=20
dev->idx =3D ocp->def->index;
ocp_set_drvdata(ocp, dev);
=2D=09
+
if (!request_mem_region(ocp->def->paddr, sizeof(struct iic_regs),
"ibm_iic")) {
ret =3D -EBUSY;
@@ -692,7 +692,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
ret =3D -ENXIO;
goto fail2;
}
=2D=09
+
init_waitqueue_head(&dev->wq);
=20
dev->irq =3D iic_force_poll ? -1 : ocp->def->irq;
@@ -702,29 +702,29 @@ static int __devinit iic_probe(struct ocp_device *ocp=
){
*/
iic_interrupt_mode(dev, 0);
if (request_irq(dev->irq, iic_handler, 0, "IBM IIC", dev)){
=2D printk(KERN_ERR "ibm-iic%d: request_irq %d failed\n",=20
+ printk(KERN_ERR "ibm-iic%d: request_irq %d failed\n",
dev->idx, dev->irq);
=2D /* Fallback to the polling mode */=09
+ /* Fallback to the polling mode */
dev->irq =3D -1;
}
}
=2D=09
+
if (dev->irq < 0)
=2D printk(KERN_WARNING "ibm-iic%d: using polling mode\n",=20
+ printk(KERN_WARNING "ibm-iic%d: using polling mode\n",
dev->idx);
=2D =09
+
/* Board specific settings */
dev->fast_mode =3D iic_force_fast ? 1 : (iic_data ? iic_data->fast_mode :=
0);
=2D=09
=2D /* clckdiv is the same for *all* IIC interfaces,=20
+
+ /* clckdiv is the same for *all* IIC interfaces,
* but I'd rather make a copy than introduce another global. --ebs
*/
dev->clckdiv =3D iic_clckdiv(ocp_sys_info.opb_bus_freq);
DBG("%d: clckdiv =3D %d\n", dev->idx, dev->clckdiv);
=2D=09
+
/* Initialize IIC interface */
iic_dev_init(dev);
=2D=09
+
/* Register it with i2c layer */
adap =3D &dev->adap;
adap->dev.parent =3D &ocp->dev;
@@ -750,24 +750,24 @@ static int __devinit iic_probe(struct ocp_device *ocp=
){
dev->idx);
goto fail;
}
=2D=09
+
printk(KERN_INFO "ibm-iic%d: using %s mode\n", dev->idx,
dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
=20
return 0;
=20
=2Dfail:=09
+fail:
if (dev->irq >=3D 0){
iic_interrupt_mode(dev, 0);
free_irq(dev->irq, dev);
=2D }=09
+ }
=20
iounmap(dev->vaddr);
=2Dfail2:=09
+fail2:
release_mem_region(ocp->def->paddr, sizeof(struct iic_regs));
fail1:
ocp_set_drvdata(ocp, NULL);
=2D kfree(dev);=09
+ kfree(dev);
return ret;
}
=20
@@ -783,13 +783,13 @@ static void __devexit iic_remove(struct ocp_device *o=
cp)
dev->idx);
/* That's *very* bad, just shutdown IRQ ... */
if (dev->irq >=3D 0){
=2D iic_interrupt_mode(dev, 0);=09
+ iic_interrupt_mode(dev, 0);
free_irq(dev->irq, dev);
dev->irq =3D -1;
}
} else {
if (dev->irq >=3D 0){
=2D iic_interrupt_mode(dev, 0);=09
+ iic_interrupt_mode(dev, 0);
free_irq(dev->irq, dev);
}
iounmap(dev->vaddr);
@@ -798,7 +798,7 @@ static void __devexit iic_remove(struct ocp_device *ocp)
}
}
=20
=2Dstatic struct ocp_device_id ibm_iic_ids[] __devinitdata =3D=20
+static struct ocp_device_id ibm_iic_ids[] __devinitdata =3D
{
{ .vendor =3D OCP_VENDOR_IBM, .function =3D OCP_FUNC_IIC },
{ .vendor =3D OCP_VENDOR_INVALID }
diff --git a/drivers/i2c/busses/i2c-ibm_iic.h b/drivers/i2c/busses/i2c-ibm_=
iic.h
index 59d7b43..fdaa482 100644
=2D-- a/drivers/i2c/busses/i2c-ibm_iic.h
+++ b/drivers/i2c/busses/i2c-ibm_iic.h
@@ -2,11 +2,11 @@
* drivers/i2c/busses/i2c-ibm_iic.h
*
* Support for the IIC peripheral on IBM PPC 4xx
=2D *=20
+ *
* Copyright (c) 2003 Zultys Technologies.
* Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
*
=2D * Based on original work by=20
+ * Based on original work by
* Ian DaSilva <idasilva@mvista.com>
* Armin Kuster <akuster@mvista.com>
* Matt Porter <mporter@mvista.com>
@@ -22,7 +22,7 @@
#ifndef __I2C_IBM_IIC_H_
#define __I2C_IBM_IIC_H_
=20
=2D#include <linux/i2c.h>=20
+#include <linux/i2c.h>
=20
struct iic_regs {
u16 mdbuf;
@@ -58,7 +58,7 @@ struct ibm_iic_private {
#define CNTL_TCT_MASK 0x30
#define CNTL_TCT_SHIFT 4
#define CNTL_RPST 0x08
=2D#define CNTL_CHT 0x04=20
+#define CNTL_CHT 0x04
#define CNTL_RW 0x02
#define CNTL_PT 0x01
=20
=2D-=20
1.5.3.4
^ permalink raw reply
* can and mpc5200b
From: S. Fricke @ 2007-10-15 13:32 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 514 bytes --]
Hello Friends,
what is the reasonable can-driver for a mpc5200b?
I have seen for the peak-3.17 driver a port for the mpc5200 from denx on their
website, but with kernel 2.6.23 I dont have a chance to use this?
greetings,
Silvio Fricke
--
-- S. Fricke ----------------------------- MAILTO:silvio.fricke@gmail.com --
Diplom-Informatiker (FH)
Linux-Entwicklung JABBER: silvio@jabber.ccc.de
----------------------------------------------------------------------------
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: libfdt: Test rw functions on more trees
From: Jon Loeliger @ 2007-10-15 13:34 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev
In-Reply-To: <20070928045701.GB25743@localhost.localdomain>
So, like, the other day David Gibson mumbled:
> At present, the testcases for read/write functions (setprop,
> del_property and del_node) are only invoked on the single
> asm-generated tree, not on any of the other tree images which should
> be equivalent. The functions in question will (correctly) not work on
> the "unfinished" tree output from sw_tree1, but should work on most of
> the others.
>
> This patch extends the run_tests script to invoke the r/w testcases on
> more example trees. The testsuite still passes clean with this
> addition.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Applied.
Thanks,
jdl
^ permalink raw reply
* Re: libfdt: Make unit address optional for finding nodes
From: Jon Loeliger @ 2007-10-15 13:35 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev
In-Reply-To: <20070928055104.GE25743@localhost.localdomain>
So, like, the other day David Gibson mumbled:
> At present, the fdt_subnode_offset() and fdt_path_offset() functions
> in libfdt require the exact name of the nodes in question be passed,
> including unit address.
>
> This is contrary to traditional OF-like finddevice() behaviour, which
> allows the unit address to be omitted (which is useful when the device
> name is unambiguous without the address).
>
> This patch introduces similar behaviour to
> fdt_subnode_offset_namelen(), and hence to fdt_subnode_offset() and
> fdt_path_offset() which are implemented in terms of the former. The
> unit address can be omitted from the given node name. If this is
> ambiguous, the first such node in the flattened tree will be selected
> (this behaviour is consistent with IEEE1275 which specifies only that
> an arbitrary node matching the given information be selected).
>
> This very small change is then followed by many more diffs which
> change the test examples and testcases to exercise this behaviour.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
Applied.
> Jon, I initially considered making this behaviour optional,
> i.e. adding a flag to subnode_offset() determining if it needed exact
> matches or name-without-address matches. I couldn't see that it was
> actually any use, though.
Yeah, sounds fine to me too.
Thanks,
jdl
^ permalink raw reply
* [PATCH 2/2] i2c: Add devtree-aware iic support for PPC4xx
From: Stefan Roese @ 2007-10-15 13:29 UTC (permalink / raw)
To: i2c, linuxppc-dev; +Cc: Jean Delvare
This patch reworks existing ibm-iic driver to support of_platform_device
and enables it to talk to device tree directly. The "old" OCP interface
for arch/ppc is still supported via #ifdef's and shall be removed when
arch/ppc is gone in a few months.
This is done to enable I2C support for the PPC4xx platforms now
being moved from arch/ppc (ocp) to arch/powerpc (of).
Signed-off-by: Stefan Roese <sr@denx.de>
---
drivers/i2c/busses/Kconfig | 2 +-
drivers/i2c/busses/i2c-ibm_iic.c | 209 +++++++++++++++++++++++++++++++++++++-
drivers/i2c/busses/i2c-ibm_iic.h | 2 +
3 files changed, 211 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index de95c75..a47b5e6 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -241,7 +241,7 @@ config I2C_PIIX4
config I2C_IBM_IIC
tristate "IBM PPC 4xx on-chip I2C interface"
- depends on IBM_OCP
+ depends on 4xx
help
Say Y here if you want to use IIC peripheral found on
embedded IBM PPC 4xx based systems.
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 956b947..78c6bf4 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -39,8 +39,13 @@
#include <asm/io.h>
#include <linux/i2c.h>
#include <linux/i2c-id.h>
+
+#ifdef CONFIG_PPC_MERGE
+#include <linux/of_platform.h>
+#else
#include <asm/ocp.h>
#include <asm/ibm4xx.h>
+#endif
#include "i2c-ibm_iic.h"
@@ -57,6 +62,10 @@ static int iic_force_fast;
module_param(iic_force_fast, bool, 0);
MODULE_PARM_DESC(iic_fast_poll, "Force fast mode (400 kHz)");
+#ifdef CONFIG_PPC_MERGE
+static int device_idx = -1;
+#endif
+
#define DBG_LEVEL 0
#ifdef DBG
@@ -660,8 +669,205 @@ static inline u8 iic_clckdiv(unsigned int opb)
/*
* Register single IIC interface
*/
-static int __devinit iic_probe(struct ocp_device *ocp){
+#ifdef CONFIG_PPC_MERGE
+/*
+ * device-tree (of) when used from arch/powerpc
+ */
+static int __devinit iic_probe(struct of_device *ofdev,
+ const struct of_device_id *match)
+{
+ struct ibm_iic_private* dev;
+ struct i2c_adapter* adap;
+ struct device_node *np;
+ int ret = -ENODEV;
+ int irq, len;
+ const u32 *prop;
+ struct resource res;
+
+ np = ofdev->node;
+ if (!(dev = kzalloc(sizeof(*dev), GFP_KERNEL))) {
+ printk(KERN_CRIT "ibm-iic(%s): failed to allocate device data\n",
+ np->full_name);
+ return -ENOMEM;
+ }
+
+ dev_set_drvdata(&ofdev->dev, dev);
+
+ dev->np = np;
+ irq = irq_of_parse_and_map(np, 0);
+
+ if (of_address_to_resource(np, 0, &res)) {
+ printk(KERN_ERR "ibd-iic(%s): Can't get registers address\n",
+ np->full_name);
+ goto fail1;
+ }
+ dev->paddr = res.start;
+
+ if (!request_mem_region(dev->paddr, sizeof(struct iic_regs), "ibm_iic")) {
+ ret = -EBUSY;
+ goto fail1;
+ }
+ dev->vaddr = ioremap(dev->paddr, sizeof(struct iic_regs));
+
+ if (dev->vaddr == NULL) {
+ printk(KERN_CRIT "ibm-iic(%s): failed to ioremap device regs\n",
+ dev->np->full_name);
+ ret = -ENXIO;
+ goto fail2;
+ }
+
+ init_waitqueue_head(&dev->wq);
+
+ dev->irq = iic_force_poll ? -1 : (irq == NO_IRQ) ? -1 : irq;
+ if (dev->irq >= 0){
+ /* Disable interrupts until we finish initialization,
+ * assumes level-sensitive IRQ setup...
+ */
+ iic_interrupt_mode(dev, 0);
+ if (request_irq(dev->irq, iic_handler, 0, "IBM IIC", dev)) {
+ printk(KERN_ERR "ibm-iic(%s): request_irq %d failed\n",
+ dev->np->full_name, dev->irq);
+ /* Fallback to the polling mode */
+ dev->irq = -1;
+ }
+ }
+
+ if (dev->irq < 0)
+ printk(KERN_WARNING "ibm-iic(%s): using polling mode\n",
+ dev->np->full_name);
+
+ /* Board specific settings */
+ prop = of_get_property(np, "iic-mode", &len);
+ /* use 400kHz only if stated in dts, 100kHz otherwise */
+ dev->fast_mode = (prop && (*prop == 400));
+ /* clckdiv is the same for *all* IIC interfaces,
+ * but I'd rather make a copy than introduce another global. --ebs
+ */
+ /* Parent bus should have frequency filled */
+ prop = of_get_property(of_get_parent(np), "clock-frequency", &len);
+ if (prop == NULL) {
+ printk(KERN_ERR
+ "ibm-iic(%s):no clock-frequency prop on parent bus!\n",
+ dev->np->full_name);
+ goto fail;
+ }
+
+ dev->clckdiv = iic_clckdiv(*prop);
+ DBG("%s: clckdiv = %d\n", dev->np->full_name, dev->clckdiv);
+
+ /* Initialize IIC interface */
+ iic_dev_init(dev);
+
+ /* Register it with i2c layer */
+ adap = &dev->adap;
+ adap->dev.parent = &ofdev->dev;
+ strcpy(adap->name, "IBM IIC");
+ i2c_set_adapdata(adap, dev);
+ adap->id = I2C_HW_OCP;
+ adap->class = I2C_CLASS_HWMON;
+ adap->algo = &iic_algo;
+ adap->client_register = NULL;
+ adap->client_unregister = NULL;
+ adap->timeout = 1;
+ adap->retries = 1;
+
+ dev->idx = ++device_idx;
+ adap->nr = dev->idx;
+ if ((ret = i2c_add_numbered_adapter(adap)) < 0) {
+ printk(KERN_CRIT"ibm-iic(%s): failed to register i2c adapter\n",
+ dev->np->full_name);
+ goto fail;
+ }
+
+ printk(KERN_INFO "ibm-iic(%s): using %s mode\n", dev->np->full_name,
+ dev->fast_mode ?
+ "fast (400 kHz)" : "standard (100 kHz)");
+
+ return 0;
+
+fail:
+ if (dev->irq >= 0){
+ iic_interrupt_mode(dev, 0);
+ free_irq(dev->irq, dev);
+ }
+
+ iounmap(dev->vaddr);
+fail2:
+ release_mem_region(dev->paddr, sizeof(struct iic_regs));
+fail1:
+ dev_set_drvdata(&ofdev->dev, NULL);
+ kfree(dev);
+
+ return ret;
+}
+
+/*
+ * Cleanup initialized IIC interface
+ */
+static int __devexit iic_remove(struct of_device *ofdev)
+{
+ struct ibm_iic_private *dev =
+ (struct ibm_iic_private *)dev_get_drvdata(&ofdev->dev);
+ BUG_ON(dev == NULL);
+ if (i2c_del_adapter(&dev->adap)){
+ printk(KERN_CRIT "ibm-iic(%s): failed to delete i2c adapter\n",
+ dev->np->full_name);
+ /* That's *very* bad, just shutdown IRQ ... */
+ if (dev->irq >= 0){
+ iic_interrupt_mode(dev, 0);
+ free_irq(dev->irq, dev);
+ dev->irq = -1;
+ }
+ } else {
+ if (dev->irq >= 0){
+ iic_interrupt_mode(dev, 0);
+ free_irq(dev->irq, dev);
+ }
+ iounmap(dev->vaddr);
+ release_mem_region(dev->paddr, sizeof(struct iic_regs));
+ kfree(dev);
+ }
+ return 0;
+}
+
+static struct of_device_id ibm_iic_match[] = {
+ {
+ .type = "i2c",
+ .compatible = "ibm,iic",
+ },
+ {},
+};
+
+MODULE_DEVICE_TABLE(of, ibm_iic_match);
+
+static struct of_platform_driver ibm_iic_driver = {
+ .name = "ibm-iic",
+ .match_table = ibm_iic_match,
+ .probe = iic_probe,
+ .remove = iic_remove,
+#if defined(CONFIG_PM)
+ .suspend = NULL,
+ .resume = NULL,
+#endif
+};
+
+static int __init iic_init(void)
+{
+ printk(KERN_INFO "IBM IIC driver v" DRIVER_VERSION "\n");
+ return of_register_platform_driver(&ibm_iic_driver);
+}
+
+static void __exit iic_exit(void)
+{
+ of_unregister_platform_driver(&ibm_iic_driver);
+}
+#else
+/*
+ * OCP when used from arch/ppc
+ */
+static int __devinit iic_probe(struct ocp_device *ocp)
+{
struct ibm_iic_private* dev;
struct i2c_adapter* adap;
struct ocp_func_iic_data* iic_data = ocp->def->additions;
@@ -828,6 +1034,7 @@ static void __exit iic_exit(void)
{
ocp_unregister_driver(&ibm_iic_driver);
}
+#endif /* CONFIG_PPC_MERGE */
module_init(iic_init);
module_exit(iic_exit);
diff --git a/drivers/i2c/busses/i2c-ibm_iic.h b/drivers/i2c/busses/i2c-ibm_iic.h
index fdaa482..c15b091 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.h
+++ b/drivers/i2c/busses/i2c-ibm_iic.h
@@ -50,6 +50,8 @@ struct ibm_iic_private {
int irq;
int fast_mode;
u8 clckdiv;
+ struct device_node *np;
+ phys_addr_t paddr;
};
/* IICx_CNTL register */
--
1.5.3.4
^ permalink raw reply related
* Re: dtc: Refactor Makefiles (v2)
From: Jon Loeliger @ 2007-10-15 13:35 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev
In-Reply-To: <20071004053743.GI6024@localhost.localdomain>
So, like, the other day David Gibson mumbled:
>
> Here's a corrected version.
>
> dtc: Refactor Makefiles
>
> This patch makes a number of Makefile cleanups and improvements:
> - We use more generic rules to invoke flex and bison, which is
> useful for some of the other changes.
> - We use the name dtc-lexer.lex.c for the flex output, instead
> of the default lex.yy.c. That means less potential for confusion if
> dtc is embedded into other projects (e.g. the kernel).
> - We separate out a Makefile.dtc designed for embedding into
> other projects, analagous to Makefile.libfdt.
> - Makefile.libfdt is cleaned up to be more useful based on
> some actual trial runs of embedding libfdt in the kernel bootwrapper.
> - Versioning related rules and variables are collected into
> one place in the Makefile.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Applied.
Thanks,
jdl
^ permalink raw reply
* Re: libfdt: Add functions to get/add/delete memory reservemap entries
From: Jon Loeliger @ 2007-10-15 13:37 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev
In-Reply-To: <20071010071212.GC6135@localhost.localdomain>
So, like, the other day David Gibson mumbled:
> This patch adds functions to libfdt for accessing the memory
> reservation map section of a device tree blob. fdt_num_mem_rsv()
> retreives the number of reservation entries in a dtb, and
> fdt_get_mem_rsv() retreives a specific reservation entry.
> fdt_add_mem_rsv() adds a new entry, and fdt_del_mem_rsv() removes a
> specific numbered entry.
>
> Testcases for these new functions are also included.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Applied.
Thanks,
jdl
^ permalink raw reply
* Re: [PATCH v2 2/7] rheap: Changes config mechanism
From: Kumar Gala @ 2007-10-15 13:43 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-dev, paulus, domen.puncer
In-Reply-To: <20071014044154.23438.58701.stgit@trillian.cg.shawcable.net>
On Oct 13, 2007, at 11:41 PM, Grant Likely wrote:
> From: Sylvain Munaut <tnt@246tNt.com>
>
> Instead of having in the makefile all the option that
> requires rheap, we define a configuration symbol
> and when needed we make sure it's selected.
>
> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>
> arch/powerpc/Kconfig | 4 ++++
> arch/powerpc/lib/Makefile | 5 +----
> arch/powerpc/platforms/Kconfig | 2 ++
> arch/powerpc/platforms/Kconfig.cputype | 1 +
> arch/ppc/Kconfig | 6 ++++++
> 5 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 037664d..8300e6a 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -698,3 +698,7 @@ source "crypto/Kconfig"
> config PPC_CLOCK
> bool
> default n
> +
> +config PPC_LIB_RHEAP
we should really have help for this option.
> + bool
> +
- k
^ permalink raw reply
* [PATCH v2] [POWERPC] ucc_geth: Fix build break introduced by commit 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0
From: Emil Medve @ 2007-10-15 13:43 UTC (permalink / raw)
To: akpm, jgarzik, leoli, netdev, linuxppc-dev; +Cc: Emil Medve
drivers/net/ucc_geth.c: In function 'ucc_geth_rx':
drivers/net/ucc_geth.c:3483: error: 'dev' undeclared (first use in this function)
drivers/net/ucc_geth.c:3483: error: (Each undeclared identifier is reported only once
drivers/net/ucc_geth.c:3483: error: for each function it appears in.)
make[2]: *** [drivers/net/ucc_geth.o] Error 1
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
---
Here is a convenient link for the culprit patch: http://git.kernel.org/?p=linux/kernel/git/jgarzik/netdev-2.6.git;a=commit;h=09f75cd7bf13720738e6a196cc0107ce9a5bd5a0
netdev-2.6> scripts/checkpatch.pl 0001-POWERPC-ucc_geth-Fix-build-break-introduced-by-co.patch
Your patch has no obvious style problems and is ready for submission.
drivers/net/ucc_geth.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index d00e7d4..bec413b 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -63,7 +63,7 @@
#define UGETH_MSG_DEFAULT (NETIF_MSG_IFUP << 1 ) - 1
void uec_set_ethtool_ops(struct net_device *netdev);
-
+
static DEFINE_SPINLOCK(ugeth_lock);
static struct {
@@ -3454,9 +3454,12 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
u16 length, howmany = 0;
u32 bd_status;
u8 *bdBuffer;
+ struct net_device * dev;
ugeth_vdbg("%s: IN", __FUNCTION__);
+ dev = ugeth->dev;
+
/* collect received buffers */
bd = ugeth->rxBd[rxQ];
--
1.5.3.GIT
^ permalink raw reply related
* Re: [PATCH] powerpc: Add 1TB workaround for PA6T
From: Olof Johansson @ 2007-10-15 13:59 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <18194.62797.632192.458851@cargo.ozlabs.ibm.com>
On Mon, Oct 15, 2007 at 03:06:21PM +1000, Paul Mackerras wrote:
> Olof Johansson writes:
>
> > @@ -367,7 +368,7 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
> > #define CPU_FTRS_PA6T (CPU_FTR_USE_TB | \
> > CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
> > CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
> > - CPU_FTR_PURR | CPU_FTR_REAL_LE)
> > + CPU_FTR_PURR | CPU_FTR_REAL_LE | CPU_FTR_NO_SLBIE_B)
> > #define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | \
> > CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
> >
> > @@ -375,7 +376,8 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
> > #define CPU_FTRS_POSSIBLE \
> > (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \
> > CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \
> > - CPU_FTRS_CELL | CPU_FTRS_PA6T | CPU_FTR_1T_SEGMENT)
> > + CPU_FTRS_CELL | CPU_FTRS_PA6T | CPU_FTR_1T_SEGMENT | \
> > + CPU_FTR_NO_SLBIE_B)
> > #else
> > enum {
> > CPU_FTRS_POSSIBLE =
>
> I don't think the second hunk there is necessary, since
> CPU_FTRS_POSSIBLE will already get CPU_FTR_NO_SLBIE_B via
> CPU_FTRS_PA6T.
Oh, you're right. I just tacked it on with the 1T_SEGMENT.
I'll respin today. Ben wanted me to add some comments to the _switch
code as well regarding the slbie.
-Olof
^ permalink raw reply
* Re: [PATCH v2 2/7] rheap: Changes config mechanism
From: Grant Likely @ 2007-10-15 13:55 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, paulus, domen.puncer
In-Reply-To: <751956FC-6B75-416C-A62A-67915652EA51@kernel.crashing.org>
On 10/15/07, Kumar Gala <galak@kernel.crashing.org> wrote:
>
> On Oct 13, 2007, at 11:41 PM, Grant Likely wrote:
>
> > From: Sylvain Munaut <tnt@246tNt.com>
> >
> > Instead of having in the makefile all the option that
> > requires rheap, we define a configuration symbol
> > and when needed we make sure it's selected.
> >
> > Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
> > Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> > ---
> >
> > +
> > +config PPC_LIB_RHEAP
>
> we should really have help for this option.
This is a non-user-selectable option; none of the other
non-user-selectable options have help text.
I can add a comment; want to give me some text to squirt in there?
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: [PATCH v2 2/7] rheap: Changes config mechanism
From: Kumar Gala @ 2007-10-15 14:03 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-dev, paulus, domen.puncer
In-Reply-To: <fa686aa40710150655s37d8c7d5ye9122034f768a897@mail.gmail.com>
On Oct 15, 2007, at 8:55 AM, Grant Likely wrote:
> On 10/15/07, Kumar Gala <galak@kernel.crashing.org> wrote:
>>
>> On Oct 13, 2007, at 11:41 PM, Grant Likely wrote:
>>
>>> From: Sylvain Munaut <tnt@246tNt.com>
>>>
>>> Instead of having in the makefile all the option that
>>> requires rheap, we define a configuration symbol
>>> and when needed we make sure it's selected.
>>>
>>> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
>>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>>> ---
>>>
>>> +
>>> +config PPC_LIB_RHEAP
>>
>> we should really have help for this option.
>
> This is a non-user-selectable option; none of the other
> non-user-selectable options have help text.
I don't see why we can't let users select it (saying that
differently, we should let users have this ability)
> I can add a comment; want to give me some text to squirt in there?
grab something out of the comment at the top of lib/rheap.c
- k
^ permalink raw reply
* Re: [PATCH v2 4/7] bestcomm: core bestcomm support for Freescale MPC5200
From: Grant Likely @ 2007-10-15 14:04 UTC (permalink / raw)
To: Matt Sealey; +Cc: linuxppc-dev, paulus, domen.puncer
In-Reply-To: <4713551B.9040103@genesi-usa.com>
On 10/15/07, Matt Sealey <matt@genesi-usa.com> wrote:
>
> My nits:
>
> Grant Likely wrote:
> > From: Sylvain Munaut <tnt@246tNt.com>
> > +static int __devinit
> > +bcom_engine_init(void)
>
> Why "bcom" and not "bestcomm"?
I can type 'bcom' twice as fast. :-) bcom is a suitable shortening;
I'm not concerned about it.
>
> > + /* Disable COMM Bus Prefetch, apparently it's not reliable yet */
> > + /* FIXME: This should be done on 5200 and not 5200B ... */
> > + out_be16(&bcom_eng->regs->PtdCntrl, in_be16(&bcom_eng->regs->PtdCntrl) | 1);
>
> This really, really shouldn't even be here, could it be moved to a platform
> init, or switched on a PVR/SVR here?
I think I'd like to leave it here for getting this series merged; it
may not be good to have it here; but it's not dangerous either. I'm
trying to keep churn on this series down to a minimum.
Please submit a patch to make this change once it's merged.
>
> > +int bcom_sram_init(struct device_node *sram_node, char *owner)
> > +{
> > + int rv;
> > + const u32 *regaddr_p;
> > + u64 regaddr64, size64;
> > + unsigned int psize;
> > +
> > + /* Create our state struct */
> > + if (bcom_sram) {
> > + printk(KERN_ERR "%s: bcom_sram_init: "
> > + "Already initialiwed !\n", owner);
> > + return -EBUSY;
> > + }
>
> initialised or initialized :)
fixed
>
> > + printk(KERN_ERR "%s: bcom_sram_init: "
> > + "Couln't request region !\n", owner);
> > + rv = -EBUSY;
> > + goto error_free;
>
> Couldn't or could not.
fixed; thanks.
Cheers,
g.
>
> --
> Matt Sealey <matt@genesi-usa.com>
> Genesi, Manager, Developer Relations
>
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: can and mpc5200b
From: Pradyumna Sampath @ 2007-10-15 14:05 UTC (permalink / raw)
To: S. Fricke; +Cc: linuxppc-dev
In-Reply-To: <20071015133233.GB4859@sfrouter>
Hi Silvio,
On 10/15/07, S. Fricke <silvio.fricke@googlemail.com> wrote:
> Hello Friends,
> what is the reasonable can-driver for a mpc5200b?
>
> I have seen for the peak-3.17 driver a port for the mpc5200 from denx on their
> website, but with kernel 2.6.23 I dont have a chance to use this?
Check this out http://developer.berlios.de/projects/socketcan/ . This
is the CAN driver we use and it works pretty well for us. It is very
updated and supports the mscan chipset that is available with the
mpc5200b.
HTH
regards
/prady
--
htp://prady.livejournal.com
^ permalink raw reply
* Re: [PATCH v2 4/7] bestcomm: core bestcomm support for Freescale MPC5200
From: Kumar Gala @ 2007-10-15 14:06 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-dev, paulus, domen.puncer
In-Reply-To: <20071014044205.23438.36036.stgit@trillian.cg.shawcable.net>
(Comments just on SRAM code)
I think this should be made generic and be utility functionality to
rheap.
CPM, CPM2, QE, L2 SRAM, etc can all use this. I'd rather we didn't
have 3 ways to do the exact same functionality. (cpm_dpalloc,
cpm_dpfree, qe_muram_alloc, qe_muram_free)
see other comments inline.
> +
> diff --git a/arch/powerpc/sysdev/bestcomm/sram.c b/arch/powerpc/
> sysdev/bestcomm/sram.c
> new file mode 100644
> index 0000000..b3f2ed1
> --- /dev/null
> +++ b/arch/powerpc/sysdev/bestcomm/sram.c
> @@ -0,0 +1,177 @@
> +/*
> + * Simple memory allocator for on-board SRAM
> + *
> + *
> + * Maintainer : Sylvain Munaut <tnt@246tNt.com>
> + *
> + * Copyright (C) 2005 Sylvain Munaut <tnt@246tNt.com>
> + *
> + * This file is licensed under the terms of the GNU General Public
> License
> + * version 2. This program is licensed "as is" without any
> warranty of any
> + * kind, whether express or implied.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/slab.h>
> +#include <linux/spinlock.h>
> +#include <linux/string.h>
> +#include <linux/ioport.h>
> +#include <linux/of.h>
> +
> +#include <asm/io.h>
> +#include <asm/mmu.h>
> +
> +#include "sram.h"
> +
> +
> +/* Struct keeping our 'state' */
> +struct bcom_sram *bcom_sram = NULL;
shouldn't be global, so we can support more than one SRAM.
> +EXPORT_SYMBOL_GPL(bcom_sram); /* needed for inline functions */
> +
> +
> +/*
> ======================================================================
> == */
> +/* Public
> API */
> +/*
> ======================================================================
> == */
> +/* DO NOT USE in interrupts, if needed in irq handler, we should
> use the
> + _irqsave version of the spin_locks */
> +
> +int bcom_sram_init(struct device_node *sram_node, char *owner)
> +{
> + int rv;
> + const u32 *regaddr_p;
> + u64 regaddr64, size64;
> + unsigned int psize;
> +
> + /* Create our state struct */
> + if (bcom_sram) {
> + printk(KERN_ERR "%s: bcom_sram_init: "
> + "Already initialiwed !\n", owner);
> + return -EBUSY;
> + }
> +
> + bcom_sram = kmalloc(sizeof(struct bcom_sram), GFP_KERNEL);
should return this handle to the user.
> + if (!bcom_sram) {
> + printk(KERN_ERR "%s: bcom_sram_init: "
> + "Couldn't allocate internal state !\n", owner);
> + return -ENOMEM;
> + }
> +
> + /* Get address and size of the sram */
> + regaddr_p = of_get_address(sram_node, 0, &size64, NULL);
> + if (!regaddr_p) {
> + printk(KERN_ERR "%s: bcom_sram_init: "
> + "Invalid device node !\n", owner);
> + rv = -EINVAL;
> + goto error_free;
> + }
> +
> + regaddr64 = of_translate_address(sram_node, regaddr_p);
> +
> + bcom_sram->base_phys = (phys_addr_t) regaddr64;
> + bcom_sram->size = (unsigned int) size64;
> +
> + /* Request region */
> + if (!request_mem_region(bcom_sram->base_phys, bcom_sram->size,
> owner)) {
> + printk(KERN_ERR "%s: bcom_sram_init: "
> + "Couln't request region !\n", owner);
> + rv = -EBUSY;
> + goto error_free;
> + }
> +
> + /* Map SRAM */
> + /* sram is not really __iomem */
> + bcom_sram->base_virt = (void*) ioremap(bcom_sram->base_phys,
> bcom_sram->size);
> +
> + if (!bcom_sram->base_virt) {
> + printk(KERN_ERR "%s: bcom_sram_init: "
> + "Map error SRAM zone 0x%08lx (0x%0x)!\n",
> + owner, bcom_sram->base_phys, bcom_sram->size );
> + rv = -ENOMEM;
> + goto error_release;
> + }
> +
> + /* Create an rheap (defaults to 32 bits word alignment) */
> + bcom_sram->rh = rh_create(4);
> +
> + /* Attach the free zones */
> +#if 0
> + /* Currently disabled ... for future use only */
> + reg_addr_p = of_get_property(sram_node, "available", &psize);
> +#else
> + regaddr_p = NULL;
> + psize = 0;
> +#endif
> +
> + if (!regaddr_p || !psize) {
> + /* Attach the whole zone */
> + rh_attach_region(bcom_sram->rh, 0, bcom_sram->size);
> + } else {
> + /* Attach each zone independently */
> + while (psize >= 2 * sizeof(u32)) {
> + phys_addr_t zbase = of_translate_address(sram_node, regaddr_p);
> + rh_attach_region(bcom_sram->rh, zbase - bcom_sram->base_phys,
> regaddr_p[1]);
> + regaddr_p += 2;
> + psize -= 2 * sizeof(u32);
> + }
> + }
> +
> + /* Init our spinlock */
> + spin_lock_init(&bcom_sram->lock);
> +
> + return 0;
> +
> +error_release:
> + release_mem_region(bcom_sram->base_phys, bcom_sram->size);
> +error_free:
> + kfree(bcom_sram);
> + bcom_sram = NULL;
> +
> + return rv;
> +}
> +EXPORT_SYMBOL_GPL(bcom_sram_init);
> +
> +void bcom_sram_cleanup(void)
> +{
> + /* Free resources */
should take bcom_sram handle as a param
> + if (bcom_sram) {
> + rh_destroy(bcom_sram->rh);
> + iounmap((void __iomem *)bcom_sram->base_virt);
> + release_mem_region(bcom_sram->base_phys, bcom_sram->size);
> + kfree(bcom_sram);
> + bcom_sram = NULL;
> + }
> +}
> +EXPORT_SYMBOL_GPL(bcom_sram_cleanup);
> +
> +void* bcom_sram_alloc(int size, int align, phys_addr_t *phys)
> +{
> + unsigned long offset;
should take bcom_sram handle as a param
> +
> + spin_lock(&bcom_sram->lock);
> + offset = rh_alloc_align(bcom_sram->rh, size, align, NULL);
> + spin_unlock(&bcom_sram->lock);
> +
> + if (IS_ERR_VALUE(offset))
> + return NULL;
> +
> + *phys = bcom_sram->base_phys + offset;
> + return bcom_sram->base_virt + offset;
> +}
> +EXPORT_SYMBOL_GPL(bcom_sram_alloc);
> +
> +void bcom_sram_free(void *ptr)
> +{
> + unsigned long offset;
> +
should take bcom_sram handle as a param
> + if (!ptr)
> + return;
> +
> + offset = ptr - bcom_sram->base_virt;
> +
> + spin_lock(&bcom_sram->lock);
> + rh_free(bcom_sram->rh, offset);
> + spin_unlock(&bcom_sram->lock);
> +}
> +EXPORT_SYMBOL_GPL(bcom_sram_free);
> +
> diff --git a/arch/powerpc/sysdev/bestcomm/sram.h b/arch/powerpc/
> sysdev/bestcomm/sram.h
> new file mode 100644
> index 0000000..b6d6689
> --- /dev/null
> +++ b/arch/powerpc/sysdev/bestcomm/sram.h
> @@ -0,0 +1,54 @@
> +/*
> + * Handling of a sram zone for bestcomm
> + *
> + *
> + * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com>
> + *
> + * This file is licensed under the terms of the GNU General Public
> License
> + * version 2. This program is licensed "as is" without any
> warranty of any
> + * kind, whether express or implied.
> + */
> +
> +#ifndef __BESTCOMM_SRAM_H__
> +#define __BESTCOMM_SRAM_H__
> +
> +#include <asm/rheap.h>
> +#include <asm/mmu.h>
> +#include <linux/spinlock.h>
> +
> +
> +/* Structure used internally */
> + /* The internals are here for the inline functions
> + * sake, certainly not for the user to mess with !
> + */
> +struct bcom_sram {
> + phys_addr_t base_phys;
> + void *base_virt;
__iomem for base_virt?
> + unsigned int size;
> + rh_info_t *rh;
> + spinlock_t lock;
> +};
> +
> +extern struct bcom_sram *bcom_sram;
> +
> +
> +/* Public API */
> +extern int bcom_sram_init(struct device_node *sram_node, char
> *owner);
> +extern void bcom_sram_cleanup(void);
> +
> +extern void* bcom_sram_alloc(int size, int align, phys_addr_t *phys);
> +extern void bcom_sram_free(void *ptr);
> +
> +static inline phys_addr_t bcom_sram_va2pa(void *va) {
should take bcom_sram handle as a param
> + return bcom_sram->base_phys +
> + (unsigned long)(va - bcom_sram->base_virt);
shouldn't this cast be phys_addr_t?
> +}
> +
> +static inline void *bcom_sram_pa2va(phys_addr_t pa) {
should take bcom_sram handle as a param
> + return bcom_sram->base_virt +
> + (unsigned long)(pa - bcom_sram->base_phys);
shouldn't this cast be phys_addr_t?
> +}
> +
> +
> +#endif /* __BESTCOMM_SRAM_H__ */
> +
^ permalink raw reply
* Re: [PATCH v2 2/7] rheap: Changes config mechanism
From: Grant Likely @ 2007-10-15 14:06 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, paulus, domen.puncer
In-Reply-To: <5D5FEAFA-AFB9-4F8D-941E-11686E8992F4@kernel.crashing.org>
On 10/15/07, Kumar Gala <galak@kernel.crashing.org> wrote:
>
> On Oct 15, 2007, at 8:55 AM, Grant Likely wrote:
>
> > On 10/15/07, Kumar Gala <galak@kernel.crashing.org> wrote:
> >>
> >> On Oct 13, 2007, at 11:41 PM, Grant Likely wrote:
> >>
> >>> From: Sylvain Munaut <tnt@246tNt.com>
> >>>
> >>> Instead of having in the makefile all the option that
> >>> requires rheap, we define a configuration symbol
> >>> and when needed we make sure it's selected.
> >>>
> >>> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
> >>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> >>> ---
> >>>
> >>> +
> >>> +config PPC_LIB_RHEAP
> >>
> >> we should really have help for this option.
> >
> > This is a non-user-selectable option; none of the other
> > non-user-selectable options have help text.
>
> I don't see why we can't let users select it (saying that
> differently, we should let users have this ability)
Sure; but not in this patch. This patch just changes from one fixed
method for selecting rheap to another.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: [PATCH v3 3/9] add Freescale SerDes PHY support
From: Arnd Bergmann @ 2007-10-15 14:10 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulus
In-Reply-To: <989B956029373F45A0B8AF0297081890019B590F@zch01exm26.fsl.freescale.net>
On Monday 15 October 2007, Li Yang-r58472 wrote:
> I'd like to but of_iomap() couldn't provide the physical address of the
> device used as identification.
It looks like you only use the physical address for a single printk,
so you could change that to print the full-name of the device node
instead, or do a dev_printk of the parent of_device if you can change
it the way I suggested in my second comment.
Arnd <><
^ permalink raw reply
* RE: [PATCH v2] [POWERPC] ucc_geth: Fix build break introduced by commit 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0
From: Li Yang-r58472 @ 2007-10-15 14:09 UTC (permalink / raw)
To: Medve Emilian-EMMEDVE1, akpm, jgarzik, netdev, linuxppc-dev
In-Reply-To: <1192455830-1028-1-git-send-email-Emilian.Medve@Freescale.com>
> -----Original Message-----
> From: Medve Emilian-EMMEDVE1=20
> Sent: Monday, October 15, 2007 9:44 PM
> To: akpm@linux-foundation.org; jgarzik@pobox.com; Li=20
> Yang-r58472; netdev@vger.kernel.org; linuxppc-dev@ozlabs.org
> Cc: Medve Emilian-EMMEDVE1
> Subject: [PATCH v2] [POWERPC] ucc_geth: Fix build break=20
> introduced by commit 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0
>=20
> drivers/net/ucc_geth.c: In function 'ucc_geth_rx':
> drivers/net/ucc_geth.c:3483: error: 'dev' undeclared (first=20
> use in this function)
> drivers/net/ucc_geth.c:3483: error: (Each undeclared=20
> identifier is reported only once
> drivers/net/ucc_geth.c:3483: error: for each function it appears in.)
> make[2]: *** [drivers/net/ucc_geth.o] Error 1
>=20
> Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Acked-by: Li Yang <leoli@freescale.com>
> ---
>=20
> Here is a convenient link for the culprit patch:=20
> http://git.kernel.org/?p=3Dlinux/kernel/git/jgarzik/netdev-2.6.g
> it;a=3Dcommit;h=3D09f75cd7bf13720738e6a196cc0107ce9a5bd5a0
>=20
> netdev-2.6> scripts/checkpatch.pl=20
> 0001-POWERPC-ucc_geth-Fix-build-break-introduced-by-co.patch
> Your patch has no obvious style problems and is ready for submission.
>=20
> drivers/net/ucc_geth.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>=20
> diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c=20
> index d00e7d4..bec413b 100644
> --- a/drivers/net/ucc_geth.c
> +++ b/drivers/net/ucc_geth.c
> @@ -63,7 +63,7 @@
> #define UGETH_MSG_DEFAULT (NETIF_MSG_IFUP << 1 ) - 1
> =20
> void uec_set_ethtool_ops(struct net_device *netdev);
> -=09
> +
> static DEFINE_SPINLOCK(ugeth_lock);
> =20
> static struct {
> @@ -3454,9 +3454,12 @@ static int ucc_geth_rx(struct=20
> ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
> u16 length, howmany =3D 0;
> u32 bd_status;
> u8 *bdBuffer;
> + struct net_device * dev;
> =20
> ugeth_vdbg("%s: IN", __FUNCTION__);
> =20
> + dev =3D ugeth->dev;
> +
> /* collect received buffers */
> bd =3D ugeth->rxBd[rxQ];
> =20
> --
> 1.5.3.GIT
>=20
^ permalink raw reply
* Re: [PATCH v2 4/7] bestcomm: core bestcomm support for Freescale MPC5200
From: Grant Likely @ 2007-10-15 14:20 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, paulus, domen.puncer
In-Reply-To: <C2B03958-38CC-4B5C-96C1-E8B5366C4D49@kernel.crashing.org>
On 10/15/07, Kumar Gala <galak@kernel.crashing.org> wrote:
> (Comments just on SRAM code)
>
> I think this should be made generic and be utility functionality to
> rheap.
>
> CPM, CPM2, QE, L2 SRAM, etc can all use this. I'd rather we didn't
> have 3 ways to do the exact same functionality. (cpm_dpalloc,
> cpm_dpfree, qe_muram_alloc, qe_muram_free)
Fair enough; but not in this patch set. This series is working
support for bestcomm. To go to the more generic level of being used
by multiple parts should be done in a separate series.
>
> see other comments inline.
>
> > +
> > diff --git a/arch/powerpc/sysdev/bestcomm/sram.c b/arch/powerpc/
> > sysdev/bestcomm/sram.c
> > new file mode 100644
> > index 0000000..b3f2ed1
> > --- /dev/null
> > +++ b/arch/powerpc/sysdev/bestcomm/sram.c
> > @@ -0,0 +1,177 @@
> > +/*
> > + * Simple memory allocator for on-board SRAM
> > + *
> > + *
> > + * Maintainer : Sylvain Munaut <tnt@246tNt.com>
> > + *
> > + * Copyright (C) 2005 Sylvain Munaut <tnt@246tNt.com>
> > + *
> > + * This file is licensed under the terms of the GNU General Public
> > License
> > + * version 2. This program is licensed "as is" without any
> > warranty of any
> > + * kind, whether express or implied.
> > + */
> > +
> > +#include <linux/kernel.h>
> > +#include <linux/module.h>
> > +#include <linux/slab.h>
> > +#include <linux/spinlock.h>
> > +#include <linux/string.h>
> > +#include <linux/ioport.h>
> > +#include <linux/of.h>
> > +
> > +#include <asm/io.h>
> > +#include <asm/mmu.h>
> > +
> > +#include "sram.h"
> > +
> > +
> > +/* Struct keeping our 'state' */
> > +struct bcom_sram *bcom_sram = NULL;
>
> shouldn't be global, so we can support more than one SRAM.
Again; I agree, but I'm not going to make that change in this series.
>
> > +EXPORT_SYMBOL_GPL(bcom_sram); /* needed for inline functions */
> > +
> > +
> > +/*
> > ======================================================================
> > == */
> > +/* Public
> > API */
> > +/*
> > ======================================================================
> > == */
> > +/* DO NOT USE in interrupts, if needed in irq handler, we should
> > use the
> > + _irqsave version of the spin_locks */
> > +
> > +int bcom_sram_init(struct device_node *sram_node, char *owner)
> > +{
> > + int rv;
> > + const u32 *regaddr_p;
> > + u64 regaddr64, size64;
> > + unsigned int psize;
> > +
> > + /* Create our state struct */
> > + if (bcom_sram) {
> > + printk(KERN_ERR "%s: bcom_sram_init: "
> > + "Already initialiwed !\n", owner);
> > + return -EBUSY;
> > + }
> > +
> > + bcom_sram = kmalloc(sizeof(struct bcom_sram), GFP_KERNEL);
>
> should return this handle to the user.
To be done when this driver is changed to support multiple sram regions.
> > diff --git a/arch/powerpc/sysdev/bestcomm/sram.h b/arch/powerpc/
> > sysdev/bestcomm/sram.h
> > new file mode 100644
> > index 0000000..b6d6689
> > --- /dev/null
> > +++ b/arch/powerpc/sysdev/bestcomm/sram.h
> > @@ -0,0 +1,54 @@
> > +/*
> > + * Handling of a sram zone for bestcomm
> > + *
> > + *
> > + * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com>
> > + *
> > + * This file is licensed under the terms of the GNU General Public
> > License
> > + * version 2. This program is licensed "as is" without any
> > warranty of any
> > + * kind, whether express or implied.
> > + */
> > +
> > +#ifndef __BESTCOMM_SRAM_H__
> > +#define __BESTCOMM_SRAM_H__
> > +
> > +#include <asm/rheap.h>
> > +#include <asm/mmu.h>
> > +#include <linux/spinlock.h>
> > +
> > +
> > +/* Structure used internally */
> > + /* The internals are here for the inline functions
> > + * sake, certainly not for the user to mess with !
> > + */
> > +struct bcom_sram {
> > + phys_addr_t base_phys;
> > + void *base_virt;
>
> __iomem for base_virt?
I'll take a look
>
> > + unsigned int size;
> > + rh_info_t *rh;
> > + spinlock_t lock;
> > +};
> > +
> > +extern struct bcom_sram *bcom_sram;
> > +
> > +
> > +/* Public API */
> > +extern int bcom_sram_init(struct device_node *sram_node, char
> > *owner);
> > +extern void bcom_sram_cleanup(void);
> > +
> > +extern void* bcom_sram_alloc(int size, int align, phys_addr_t *phys);
> > +extern void bcom_sram_free(void *ptr);
> > +
> > +static inline phys_addr_t bcom_sram_va2pa(void *va) {
>
> should take bcom_sram handle as a param
>
> > + return bcom_sram->base_phys +
> > + (unsigned long)(va - bcom_sram->base_virt);
>
> shouldn't this cast be phys_addr_t?
I don't think so. ->base_phys is of type phys_addr_t;
(va-bcom_sram->base_virt) is just an offset from ->base_phys.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: [PATCH v3 4/4] FEC mpc52xx: phy part of the driver\
From: Grant Likely @ 2007-10-15 14:30 UTC (permalink / raw)
To: Domen Puncer; +Cc: linuxppc-dev, jgarzik, netdev
In-Reply-To: <20071015105601.GM3000@nd47.coderock.org>
On 10/15/07, Domen Puncer <domen.puncer@telargo.com> wrote:
> On 14/10/07 16:05 -0600, Grant Likely wrote:
> > On 10/14/07, Domen Puncer <domen.puncer@telargo.com> wrote:
> > > PHY part of the driver for mpc5200(b) ethernet.
> >
> > Assuming I understand correctly, this comment is not correct and this
> > patch just adds an MDIO bus driver. PHY drivers are in phylib and
> > data transfer is setup via the core driver, correct?
>
> Right.
>
> >
> > It is conceivable that the PHY is connected to an alternate MDIO bus,
> > or the MDIO bus is used for a PHY connected to an external Ethernet
> > controller.
> >
> > Speaking of which, is it possible to use this MDIO bus without the
> > core FEC being initialized?
>
> IIRC fec doesn't need any initialization for MDIO bus registers to work.
>
> >
> > > +static struct of_device_id fec_mdio_match[] = {
> > > + {
> > > + .type = "mdio",
> > > + .compatible = "mpc5200b-fec-phy",
> >
> > This is not a phy; it's an MDIO bus. Also, shouldn't this be
> > "mpc5200-..." instead of "mpc5200b-..."?
>
> Didn't know if it's ok for mpc5200, guess it is?
I believe it is.
>
> >
> > > + },
> > > + {},
> > > +};
> > > +
> > > +struct of_platform_driver mpc52xx_fec_mdio_driver = {
> > > + .name = "mpc5200b-fec-phy",
> > > + .probe = fec_mdio_probe,
> > > + .remove = fec_mdio_remove,
> > > + .match_table = fec_mdio_match,
> >
> > Inconsistent naming. Please use the same prefix on all global/static
> > symbols (ie. use "mpc52xx_mdio_" instead of the mix of
> > "mpc52xx_fec_mdio_", "fec_mdio_", etc.) I also thing that "fec_mdio_"
> > is too generic because there are a number of different incompatible
> > FEC devices.
>
> OK.
>
> >
> > > +};
> > > +
> > > +/* let fec driver call it, since this has to be registered before it */
> > > +EXPORT_SYMBOL_GPL(mpc52xx_fec_mdio_driver);
> >
> > Why not have a module_init()/module_exit() in this file? I don't
> > think the FEC driver calls this driver's functions directly anymore,
> > and it's still dependent on the of_platform bus probe order anyway.
>
> It was one way of making sure mdio driver is registered before fec.
> (and of_platform bus probe order won't work for modules)
> Nicer alternatives?
However, that assumption only works when the PHY is accessed via the
on-chip MDIO controller. What happens with a different MDIO bus is
used?
...
Need to take a look at how phylib handles the probing order problem;
but really this is something that PHYLIB needs to handle; not the FEC
driver.
> > > --- linux.git.orig/drivers/net/fec_mpc52xx/Kconfig
> > > +++ linux.git/drivers/net/fec_mpc52xx/Kconfig
> > > @@ -11,5 +11,18 @@ config FEC_MPC52xx
> > > ---help---
> > > This option enables support for the MPC5200's on-chip
> > > Fast Ethernet Controller
> > > + If compiled as module, it will be called 'fec_mpc52xx.ko'.
> >
> > Drop this line and make the help text the same format as the other eth
> > drivers in drivers/net.
>
> How exactly is it different now?
> And most of them have the "Module will be called xxx" line.
Okay, you're right. There is a real hodgepodge of help text format in
drivers/net/Kconfig. Do what seems best to you.
>
> >
> > > +
> > > +config FEC_MPC52xx_MDIO
> > > + bool "FEC MII PHY driver"
> > > + depends on FEC_MPC52xx
> > > + default y
> > > + ---help---
> > > + The MPC5200's FEC can connect to the Ethernet either with
> > > + an external MII PHY chip or 10 Mbps 7-wire interface
> > > + (Motorola? industry standard).
> > > + If your board uses an external PHY, enable this.
> >
> > Not strictly true. This enables talking to a PHY using the internal
> > MDIO controller. PHY register access could just as easily be accessed
> > via an alternate interface.
>
> Not just that is also selects which mode will it use.
> If you don't enable this, fec will be set up as 7-wire
> ( 696 rcntrl |= FEC_RCNTRL_MII_MODE;)
Looking at fec.c:
That line is dependent on priv->has_phy. priv->has_phy is set on line
949 which is conditional on the node having the property "phy-handle".
It doesn't look like it is conditional on CONFIG_FEC_MPC52xx_MDIO at
all.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: [PATCH v2 4/7] bestcomm: core bestcomm support for Freescale MPC5200
From: Matt Sealey @ 2007-10-15 14:39 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-dev, paulus, domen.puncer
In-Reply-To: <fa686aa40710150720x6c0ab76hf45d434740d5718f@mail.gmail.com>
Grant Likely wrote:
> On 10/15/07, Kumar Gala <galak@kernel.crashing.org> wrote:
>> (Comments just on SRAM code)
>>
>> I think this should be made generic and be utility functionality to
>> rheap.
>>
>> CPM, CPM2, QE, L2 SRAM, etc can all use this. I'd rather we didn't
>> have 3 ways to do the exact same functionality. (cpm_dpalloc,
>> cpm_dpfree, qe_muram_alloc, qe_muram_free)
>
> Fair enough; but not in this patch set. This series is working
> support for bestcomm. To go to the more generic level of being used
> by multiple parts should be done in a separate series.
I suggested this a couple months ago and a couple people here said a
generic SRAM driver would be a bad idea.. (even the tsi1xx and Marvell
chips could use a generic SRAM driver)?
Module probe order comes into play, which is why it was a bad idea; how
do you make sure that SRAM and all it's finer points (which may not be
handled by a generic rheap library - after all, the address, size,
alignment needs to be *passed* to rheap init) is there and probed before
bestcomm, qe ethernet units or cryptography, axe on the 5121e, gigabit
on the marvell, deep sleep code on the 5200b (just listing users atm)
or something or other, without turning the drivers into a hard
dependency of the sram subsystem?
--
Matt Sealey <matt@genesi-usa.com>
Genesi, Manager, Developer Relations
^ permalink raw reply
* [PATCH v4 3/9] add Freescale SerDes PHY support
From: Li Yang @ 2007-10-15 14:56 UTC (permalink / raw)
To: galak, paulus, linuxppc-dev; +Cc: Li Yang
The SerDes(serializer/deserializer) PHY block is a new SoC block used
in Freescale chips to support multiple serial interfaces, such as PCI
Express, SGMII, SATA.
Signed-off-by: Li Yang <leoli@freescale.com>
---
arch/powerpc/platforms/Kconfig | 3 +
arch/powerpc/sysdev/Makefile | 1 +
arch/powerpc/sysdev/fsl_serdes.c | 195 ++++++++++++++++++++++++++++++++++++++
3 files changed, 199 insertions(+), 0 deletions(-)
create mode 100644 arch/powerpc/sysdev/fsl_serdes.c
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index cc6013f..ff4fddc 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -313,4 +313,7 @@ config FSL_ULI1575
config CPM
bool
+config FSL_SERDES
+ bool
+
endmenu
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 1a6f564..a892aa0 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_MV64X60) += $(mv64x60-y) mv64x60_pic.o mv64x60_dev.o \
mv64x60_udbg.o
obj-$(CONFIG_RTC_DRV_CMOS) += rtc_cmos_setup.o
obj-$(CONFIG_AXON_RAM) += axonram.o
+obj-$(CONFIG_FSL_SERDES) += fsl_serdes.o
ifeq ($(CONFIG_PPC_MERGE),y)
obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
diff --git a/arch/powerpc/sysdev/fsl_serdes.c b/arch/powerpc/sysdev/fsl_serdes.c
new file mode 100644
index 0000000..670015d
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_serdes.c
@@ -0,0 +1,195 @@
+/*
+ * arch/powerpc/sysdev/fsl_serdes.c
+ *
+ * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: Li Yang <leoli@freescale.com>
+ *
+ * Freescale SerDes initialization routines
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+
+#include <asm/system.h>
+#include <asm/io.h>
+#include <asm/machdep.h>
+
+#define FSL_SRDSCR0_OFFS 0x0
+#define FSL_SRDSCR0_DPP_1V2 0x00008800
+#define FSL_SRDSCR1_OFFS 0x4
+#define FSL_SRDSCR1_PLLBW 0x00000040
+#define FSL_SRDSCR2_OFFS 0x8
+#define FSL_SRDSCR2_VDD_1V2 0x00800000
+#define FSL_SRDSCR2_SEIC_MASK 0x00001c1c
+#define FSL_SRDSCR2_SEIC_SATA 0x00001414
+#define FSL_SRDSCR2_SEIC_PEX 0x00001010
+#define FSL_SRDSCR2_SEIC_SGMII 0x00000101
+#define FSL_SRDSCR3_OFFS 0xc
+#define FSL_SRDSCR3_KFR_SATA 0x10100000
+#define FSL_SRDSCR3_KPH_SATA 0x04040000
+#define FSL_SRDSCR3_SDFM_SATA_PEX 0x01010000
+#define FSL_SRDSCR3_SDTXL_SATA 0x00000505
+#define FSL_SRDSCR4_OFFS 0x10
+#define FSL_SRDSCR4_PROT_SATA 0x00000808
+#define FSL_SRDSCR4_PROT_PEX 0x00000101
+#define FSL_SRDSCR4_PROT_SGMII 0x00000505
+#define FSL_SRDSCR4_PLANE_X2 0x01000000
+#define FSL_SRDSCR4_RFCKS_100 0x00000000
+#define FSL_SRDSCR4_RFCKS_125 0x10000000
+#define FSL_SRDSCR4_RFCKS_150 0x30000000
+#define FSL_SRDSRSTCTL_OFFS 0x20
+#define FSL_SRDSRSTCTL_RST 0x80000000
+#define FSL_SRDSRSTCTL_SATA_RESET 0xf
+
+static int fsl_serdes_probe(struct of_device *ofdev,
+ const struct of_device_id *match)
+{
+ struct device_node *np = ofdev->node;
+ void __iomem *regs;
+ const char *prot;
+ const unsigned int *freq;
+ u32 rfcks;
+
+ regs = of_iomap(np, 0);
+ if (!regs)
+ return -ENOMEM;
+
+ prot = of_get_property(np, "protocol", NULL);
+ if (!prot)
+ goto out;
+ freq = of_get_property(np, "clock", NULL);
+ if (!freq)
+ goto out;
+ switch (*freq) {
+ case 100:
+ rfcks = FSL_SRDSCR4_RFCKS_100;
+ break;
+ case 125:
+ rfcks = FSL_SRDSCR4_RFCKS_125;
+ break;
+ case 150:
+ rfcks = FSL_SRDSCR4_RFCKS_150;
+ break;
+ default:
+ printk(KERN_ERR "SerDes: Wrong frequency\n");
+ goto out;
+ }
+
+ /* Use default prescale and counter */
+
+ /* 1.0V corevdd */
+ if (of_get_property(np, "vdd-1v", NULL)) {
+ /* DPPE/DPPA = 0 */
+ clrbits32(regs + FSL_SRDSCR0_OFFS, FSL_SRDSCR0_DPP_1V2);
+
+ /* VDD = 0 */
+ clrbits32(regs + FSL_SRDSCR2_OFFS, FSL_SRDSCR2_VDD_1V2);
+ }
+
+ /* protocol specific configuration */
+ if (!strcmp(prot, "sata")) {
+ /* Set and clear reset bits */
+ setbits32(regs + FSL_SRDSRSTCTL_OFFS,
+ FSL_SRDSRSTCTL_SATA_RESET);
+ mdelay(1);
+ clrbits32(regs + FSL_SRDSRSTCTL_OFFS,
+ FSL_SRDSRSTCTL_SATA_RESET);
+
+ /* Configure SRDSCR1 */
+ clrbits32(regs + FSL_SRDSCR1_OFFS, FSL_SRDSCR1_PLLBW);
+
+ /* Configure SRDSCR2 */
+ clrsetbits_be32(regs + FSL_SRDSCR2_OFFS,
+ FSL_SRDSCR2_SEIC_MASK, FSL_SRDSCR2_SEIC_SATA);
+
+ /* Configure SRDSCR3 */
+ out_be32(regs + FSL_SRDSCR3_OFFS, FSL_SRDSCR3_KFR_SATA |
+ FSL_SRDSCR3_KPH_SATA |
+ FSL_SRDSCR3_SDFM_SATA_PEX |
+ FSL_SRDSCR3_SDTXL_SATA);
+
+ /* Configure SRDSCR4 */
+ out_be32(regs + FSL_SRDSCR4_OFFS, rfcks |
+ FSL_SRDSCR4_PROT_SATA);
+
+ } else if (!strcmp(prot, "pcie")) {
+ /* Configure SRDSCR1 */
+ setbits32(regs + FSL_SRDSCR1_OFFS, FSL_SRDSCR1_PLLBW);
+
+ /* Configure SRDSCR2 */
+ clrsetbits_be32(regs + FSL_SRDSCR2_OFFS, FSL_SRDSCR2_SEIC_MASK,
+ FSL_SRDSCR2_SEIC_PEX);
+
+ /* Configure SRDSCR3 */
+ out_be32(regs + FSL_SRDSCR3_OFFS, FSL_SRDSCR3_SDFM_SATA_PEX);
+
+ /* Configure SRDSCR4 */
+ if (of_get_property(np, "pcie-x2", NULL))
+ out_be32(regs + FSL_SRDSCR4_OFFS, rfcks |
+ FSL_SRDSCR4_PROT_PEX | FSL_SRDSCR4_PLANE_X2);
+ else
+ out_be32(regs + FSL_SRDSCR4_OFFS, rfcks |
+ FSL_SRDSCR4_PROT_PEX);
+
+ } else if (!strcmp(prot, "sgmii")) {
+ /* Configure SRDSCR1 */
+ clrbits32(regs + FSL_SRDSCR1_OFFS, FSL_SRDSCR1_PLLBW);
+
+ /* Configure SRDSCR2 */
+ clrsetbits_be32(regs + FSL_SRDSCR2_OFFS, FSL_SRDSCR2_SEIC_MASK,
+ FSL_SRDSCR2_SEIC_SGMII);
+
+ /* Configure SRDSCR3 */
+ out_be32(regs + FSL_SRDSCR3_OFFS, 0);
+
+ /* Configure SRDSCR4 */
+ out_be32(regs + FSL_SRDSCR4_OFFS, rfcks |
+ FSL_SRDSCR4_PROT_SGMII);
+
+ } else {
+ printk(KERN_ERR "SerDes: Wrong protocol\n");
+ goto out;
+ }
+
+ /* Do a software reset */
+ setbits32(regs + FSL_SRDSRSTCTL_OFFS, FSL_SRDSRSTCTL_RST);
+ iounmap(regs);
+
+ dev_printk(KERN_INFO, &ofdev->dev, "Initialized as %s\n", prot);
+
+ return 0;
+out:
+ iounmap(regs);
+ return -EINVAL;
+}
+
+static struct of_device_id fsl_serdes_match[] = {
+ {
+ .compatible = "fsl,serdes",
+ },
+ {},
+};
+
+static struct of_platform_driver fsl_serdes_driver = {
+ .name = "fsl-serdes",
+ .match_table = fsl_serdes_match,
+ .probe = fsl_serdes_probe,
+};
+
+static int __init fsl_serdes_init(void)
+{
+ of_register_platform_driver(&fsl_serdes_driver);
+ return 0;
+}
+device_initcall(fsl_serdes_init);
--
1.5.3.2.104.g41ef
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox