* Re: [PATCH v2 4/6] [POWERPC] QE: implement support for the GPIO LIB API
From: Anton Vorontsov @ 2008-04-30 22:59 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev
In-Reply-To: <4818F7C2.2030408@freescale.com>
On Wed, Apr 30, 2008 at 05:50:42PM -0500, Timur Tabi wrote:
> Anton Vorontsov wrote:
>
> > Per Grant Likely's comments, "fsl,qe-pario-bank" considered as a made up
> > stuff. MPC8323 is the first QE chip, so every next QE chips should be
> > compatible.
>
> Ok.
>
> >> Return value should be "u32", not "int".
> >
> > gpio.h disagree
> >
> > $ cat include/asm-generic/gpio.h | grep \*get
> > int (*get)(struct gpio_chip *chip,
> >
>
> In that case, perhaps you should return this:
>
> return in_be32(®s->cpdata) & pin_mask ? 1 : 0;
What is the problem with returning (int)(u32 & u32) value?
You've asked to remove "!!" stuff and now purposing exactly the
same... :-?
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* Re: [patch 2.6.25-git] spi_mpc83xx much improved driver
From: David Brownell @ 2008-04-30 22:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: spi-devel-general, 12o3l, linuxppc-dev
In-Reply-To: <20080430154631.b86797de.akpm@linux-foundation.org>
On Wednesday 30 April 2008, Andrew Morton wrote:
> > + spin_lock_irq(&mpc83xx_spi->lock);
>
> irq-safe.
>
> > ...
> >
> > + spin_lock(&mpc83xx_spi->lock);
>
> not irq-safe.
>
> Deliberate?
That latter one is inside an #if 0/#endif block, so it won't matter.
The #if 0 block bothered me. Maybe Joakim can remove it.
(By the way, I'd feel safer about this patch if there were an
ack or two from more PPC folk...)
^ permalink raw reply
* Re: [PATCH v2 4/6] [POWERPC] QE: implement support for the GPIO LIB API
From: Timur Tabi @ 2008-04-30 22:50 UTC (permalink / raw)
To: cbouatmailru; +Cc: linuxppc-dev
In-Reply-To: <20080430224726.GA5529@zarina>
Anton Vorontsov wrote:
> Per Grant Likely's comments, "fsl,qe-pario-bank" considered as a made up
> stuff. MPC8323 is the first QE chip, so every next QE chips should be
> compatible.
Ok.
>> Return value should be "u32", not "int".
>
> gpio.h disagree
>
> $ cat include/asm-generic/gpio.h | grep \*get
> int (*get)(struct gpio_chip *chip,
>
In that case, perhaps you should return this:
return in_be32(®s->cpdata) & pin_mask ? 1 : 0;
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Re: [PATCH v2 4/6] [POWERPC] QE: implement support for the GPIO LIB API
From: Anton Vorontsov @ 2008-04-30 22:47 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev
In-Reply-To: <4818CB8B.9010106@freescale.com>
On Wed, Apr 30, 2008 at 02:42:03PM -0500, Timur Tabi wrote:
> Anton Vorontsov wrote:
>
> > + Example:
> > + qe_pio_a: gpio-controller@1400 {
> > + #gpio-cells = <2>;
> > + compatible = "fsl,mpc8360-qe-pario-bank",
> > + "fsl,mpc8323-qe-pario-bank";
>
> I know this is an example, but would we ever include both compatible strings in
> one DTS? Isn't the norm something like:
>
> "fsl,mpc8360-qe-pario-bank", "fsl,qe-pario-bank";
>
> I.e. specific version, then generic version?
Per Grant Likely's comments, "fsl,qe-pario-bank" considered as a made up
stuff. MPC8323 is the first QE chip, so every next QE chips should be
compatible.
Though, for fsl,gtm we can't use this, since we really want generic
name.
> Otherwise, every time we introduce a new QE part, we'll have to update *every*
> QE-enabled device tree *and* the QE gpio driver.
Nope. If the the QE is compatible with the previous, just write
"fsl,newchip-qe-pario-bank", "fsl,mpc8323-qe-pario-bank".
Btw, the same we do for the 8349 compatible PCI.
> > +static int qe_gpio_get(struct gpio_chip *gc, unsigned int gpio)
> > +{
> > + struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
> > + struct qe_pio_regs __iomem *regs = mm_gc->regs;
> > + u32 pin_mask = 1 << (QE_PIO_PINS - 1 - gpio);
> > +
> > + return in_be32(®s->cpdata) & pin_mask;
> > +}
>
> Return value should be "u32", not "int".
gpio.h disagree
$ cat include/asm-generic/gpio.h | grep \*get
int (*get)(struct gpio_chip *chip,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* Re: [patch 2.6.25-git] spi_mpc83xx much improved driver
From: Andrew Morton @ 2008-04-30 22:46 UTC (permalink / raw)
To: David Brownell; +Cc: spi-devel-general, 12o3l, linuxppc-dev
In-Reply-To: <200804301537.07965.david-b@pacbell.net>
On Wed, 30 Apr 2008 15:37:07 -0700
David Brownell <david-b@pacbell.net> wrote:
> From: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> Date: Fri, 11 Apr 2008 18:57:21 +0200
> Subject: [PATCH] Much improved mpc83xx SPI driver.
>
> The current driver may cause glitches on SPI CLK line since one must
> disable the SPI controller before changing any HW settings. Fix this
> by implementing a local spi_transfer function that won't change speed
> and/or word size while CS is active.
>
> While doing that heavy lifting a few other issues were addressed too:
> - Make word size 16 and 32 work too.
> - Honor bits_per_word and speed_hz in spi transaction.
> - Optimize the common path.
>
> This also stops using the "bitbang" framework (except for a few
> constants).
>
> ...
>
> +static void mpc83xx_spi_work(struct work_struct *work)
> +{
> + struct mpc83xx_spi *mpc83xx_spi =
> + container_of(work, struct mpc83xx_spi, work);
> +
> + spin_lock_irq(&mpc83xx_spi->lock);
irq-safe.
> ...
>
> + spin_lock(&mpc83xx_spi->lock);
not irq-safe.
Deliberate?
^ permalink raw reply
* [patch 2.6.25-git] spi_mpc83xx much improved driver
From: David Brownell @ 2008-04-30 22:37 UTC (permalink / raw)
To: Andrew Morton; +Cc: spi-devel-general, Roel Kluin, linuxppc-dev
From: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Date: Fri, 11 Apr 2008 18:57:21 +0200
Subject: [PATCH] Much improved mpc83xx SPI driver.
The current driver may cause glitches on SPI CLK line since one must
disable the SPI controller before changing any HW settings. Fix this
by implementing a local spi_transfer function that won't change speed
and/or word size while CS is active.
While doing that heavy lifting a few other issues were addressed too:
- Make word size 16 and 32 work too.
- Honor bits_per_word and speed_hz in spi transaction.
- Optimize the common path.
This also stops using the "bitbang" framework (except for a few
constants).
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
[ Roel Kluin <12o3l@tiscali.nl>: "irq" needs to be signed ]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
drivers/spi/Kconfig | 1
drivers/spi/spi_mpc83xx.c | 409 +++++++++++++++++++++++++++++++---------------
2 files changed, 281 insertions(+), 129 deletions(-)
--- at91.orig/drivers/spi/Kconfig 2008-04-30 15:06:30.000000000 -0700
+++ at91/drivers/spi/Kconfig 2008-04-30 15:06:34.000000000 -0700
@@ -126,7 +126,6 @@ config SPI_MPC52xx_PSC
config SPI_MPC83xx
tristate "Freescale MPC83xx/QUICC Engine SPI controller"
depends on SPI_MASTER && (PPC_83xx || QUICC_ENGINE) && EXPERIMENTAL
- select SPI_BITBANG
help
This enables using the Freescale MPC83xx and QUICC Engine SPI
controllers in master mode.
--- at91.orig/drivers/spi/spi_mpc83xx.c 2008-04-30 14:58:33.000000000 -0700
+++ at91/drivers/spi/spi_mpc83xx.c 2008-04-30 15:35:51.000000000 -0700
@@ -49,6 +49,7 @@ struct mpc83xx_spi_reg {
#define SPMODE_LEN(x) ((x) << 20)
#define SPMODE_PM(x) ((x) << 16)
#define SPMODE_OP (1 << 14)
+#define SPMODE_CG(x) ((x) << 7)
/*
* Default for SPI Mode:
@@ -67,10 +68,6 @@ struct mpc83xx_spi_reg {
/* SPI Controller driver's private data. */
struct mpc83xx_spi {
- /* bitbang has to be first */
- struct spi_bitbang bitbang;
- struct completion done;
-
struct mpc83xx_spi_reg __iomem *base;
/* rx & tx bufs from the spi_transfer */
@@ -82,7 +79,7 @@ struct mpc83xx_spi {
u32(*get_tx) (struct mpc83xx_spi *);
unsigned int count;
- u32 irq;
+ int irq;
unsigned nsecs; /* (clock cycle time)/2 */
@@ -94,6 +91,25 @@ struct mpc83xx_spi {
void (*activate_cs) (u8 cs, u8 polarity);
void (*deactivate_cs) (u8 cs, u8 polarity);
+
+ u8 busy;
+
+ struct workqueue_struct *workqueue;
+ struct work_struct work;
+
+ struct list_head queue;
+ spinlock_t lock;
+
+ struct completion done;
+};
+
+struct spi_mpc83xx_cs {
+ /* functions to deal with different sized buffers */
+ void (*get_rx) (u32 rx_data, struct mpc83xx_spi *);
+ u32 (*get_tx) (struct mpc83xx_spi *);
+ u32 rx_shift; /* RX data reg shift when in qe mode */
+ u32 tx_shift; /* TX data reg shift when in qe mode */
+ u32 hw_mode; /* Holds HW mode register settings */
};
static inline void mpc83xx_spi_write_reg(__be32 __iomem * reg, u32 val)
@@ -137,6 +153,7 @@ static void mpc83xx_spi_chipselect(struc
{
struct mpc83xx_spi *mpc83xx_spi;
u8 pol = spi->mode & SPI_CS_HIGH ? 1 : 0;
+ struct spi_mpc83xx_cs *cs = spi->controller_state;
mpc83xx_spi = spi_master_get_devdata(spi->master);
@@ -147,50 +164,26 @@ static void mpc83xx_spi_chipselect(struc
if (value == BITBANG_CS_ACTIVE) {
u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
- u32 len = spi->bits_per_word;
- u8 pm;
-
- if (len == 32)
- len = 0;
- else
- len = len - 1;
- /* mask out bits we are going to set */
- regval &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH
- | SPMODE_LEN(0xF) | SPMODE_DIV16
- | SPMODE_PM(0xF) | SPMODE_REV | SPMODE_LOOP);
-
- if (spi->mode & SPI_CPHA)
- regval |= SPMODE_CP_BEGIN_EDGECLK;
- if (spi->mode & SPI_CPOL)
- regval |= SPMODE_CI_INACTIVEHIGH;
- if (!(spi->mode & SPI_LSB_FIRST))
- regval |= SPMODE_REV;
- if (spi->mode & SPI_LOOP)
- regval |= SPMODE_LOOP;
-
- regval |= SPMODE_LEN(len);
-
- if ((mpc83xx_spi->spibrg / spi->max_speed_hz) >= 64) {
- pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 64) - 1;
- if (pm > 0x0f) {
- dev_err(&spi->dev, "Requested speed is too "
- "low: %d Hz. Will use %d Hz instead.\n",
- spi->max_speed_hz,
- mpc83xx_spi->spibrg / 1024);
- pm = 0x0f;
- }
- regval |= SPMODE_PM(pm) | SPMODE_DIV16;
- } else {
- pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 4);
- if (pm)
- pm--;
- regval |= SPMODE_PM(pm);
+ mpc83xx_spi->rx_shift = cs->rx_shift;
+ mpc83xx_spi->tx_shift = cs->tx_shift;
+ mpc83xx_spi->get_rx = cs->get_rx;
+ mpc83xx_spi->get_tx = cs->get_tx;
+
+ if (cs->hw_mode != regval) {
+ unsigned long flags;
+ void *tmp_ptr = &mpc83xx_spi->base->mode;
+
+ regval = cs->hw_mode;
+ /* Turn off IRQs locally to minimize time that
+ * SPI is disabled
+ */
+ local_irq_save(flags);
+ /* Turn off SPI unit prior changing mode */
+ mpc83xx_spi_write_reg(tmp_ptr, regval & ~SPMODE_ENABLE);
+ mpc83xx_spi_write_reg(tmp_ptr, regval);
+ local_irq_restore(flags);
}
-
- /* Turn off SPI unit prior changing mode */
- mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
- mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
if (mpc83xx_spi->activate_cs)
mpc83xx_spi->activate_cs(spi->chip_select, pol);
}
@@ -201,8 +194,9 @@ int mpc83xx_spi_setup_transfer(struct sp
{
struct mpc83xx_spi *mpc83xx_spi;
u32 regval;
- u8 bits_per_word;
+ u8 bits_per_word, pm;
u32 hz;
+ struct spi_mpc83xx_cs *cs = spi->controller_state;
mpc83xx_spi = spi_master_get_devdata(spi->master);
@@ -223,72 +217,203 @@ int mpc83xx_spi_setup_transfer(struct sp
|| ((bits_per_word > 16) && (bits_per_word != 32)))
return -EINVAL;
- mpc83xx_spi->rx_shift = 0;
- mpc83xx_spi->tx_shift = 0;
+ if (!hz)
+ hz = spi->max_speed_hz;
+
+ cs->rx_shift = 0;
+ cs->tx_shift = 0;
if (bits_per_word <= 8) {
- mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;
- mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;
+ cs->get_rx = mpc83xx_spi_rx_buf_u8;
+ cs->get_tx = mpc83xx_spi_tx_buf_u8;
if (mpc83xx_spi->qe_mode) {
- mpc83xx_spi->rx_shift = 16;
- mpc83xx_spi->tx_shift = 24;
+ cs->rx_shift = 16;
+ cs->tx_shift = 24;
}
} else if (bits_per_word <= 16) {
- mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u16;
- mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u16;
+ cs->get_rx = mpc83xx_spi_rx_buf_u16;
+ cs->get_tx = mpc83xx_spi_tx_buf_u16;
if (mpc83xx_spi->qe_mode) {
- mpc83xx_spi->rx_shift = 16;
- mpc83xx_spi->tx_shift = 16;
+ cs->rx_shift = 16;
+ cs->tx_shift = 16;
}
} else if (bits_per_word <= 32) {
- mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u32;
- mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u32;
+ cs->get_rx = mpc83xx_spi_rx_buf_u32;
+ cs->get_tx = mpc83xx_spi_tx_buf_u32;
} else
return -EINVAL;
if (mpc83xx_spi->qe_mode && spi->mode & SPI_LSB_FIRST) {
- mpc83xx_spi->tx_shift = 0;
+ cs->tx_shift = 0;
if (bits_per_word <= 8)
- mpc83xx_spi->rx_shift = 8;
+ cs->rx_shift = 8;
else
- mpc83xx_spi->rx_shift = 0;
+ cs->rx_shift = 0;
}
- /* nsecs = (clock period)/2 */
- if (!hz)
- hz = spi->max_speed_hz;
- mpc83xx_spi->nsecs = (1000000000 / 2) / hz;
- if (mpc83xx_spi->nsecs > MAX_UDELAY_MS * 1000)
- return -EINVAL;
+ mpc83xx_spi->rx_shift = cs->rx_shift;
+ mpc83xx_spi->tx_shift = cs->tx_shift;
+ mpc83xx_spi->get_rx = cs->get_rx;
+ mpc83xx_spi->get_tx = cs->get_tx;
if (bits_per_word == 32)
bits_per_word = 0;
else
bits_per_word = bits_per_word - 1;
- regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
-
/* mask out bits we are going to set */
- regval &= ~(SPMODE_LEN(0xF) | SPMODE_REV);
- regval |= SPMODE_LEN(bits_per_word);
- if (!(spi->mode & SPI_LSB_FIRST))
- regval |= SPMODE_REV;
+ cs->hw_mode &= ~(SPMODE_LEN(0xF) | SPMODE_DIV16
+ | SPMODE_PM(0xF));
- /* Turn off SPI unit prior changing mode */
- mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
- mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
+ cs->hw_mode |= SPMODE_LEN(bits_per_word);
+ if ((mpc83xx_spi->spibrg / hz) >= 64) {
+ pm = mpc83xx_spi->spibrg / (hz * 64) - 1;
+ if (pm > 0x0f) {
+ dev_err(&spi->dev, "Requested speed is too "
+ "low: %d Hz. Will use %d Hz instead.\n",
+ hz, mpc83xx_spi->spibrg / 1024);
+ pm = 0x0f;
+ }
+ cs->hw_mode |= SPMODE_PM(pm) | SPMODE_DIV16;
+ } else {
+ pm = mpc83xx_spi->spibrg / (hz * 4);
+ if (pm)
+ pm--;
+ cs->hw_mode |= SPMODE_PM(pm);
+ }
+ regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
+ if (cs->hw_mode != regval) {
+ unsigned long flags;
+ void *tmp_ptr = &mpc83xx_spi->base->mode;
+
+ regval = cs->hw_mode;
+ /* Turn off IRQs locally to minimize time
+ * that SPI is disabled
+ */
+ local_irq_save(flags);
+ /* Turn off SPI unit prior changing mode */
+ mpc83xx_spi_write_reg(tmp_ptr, regval & ~SPMODE_ENABLE);
+ mpc83xx_spi_write_reg(tmp_ptr, regval);
+ local_irq_restore(flags);
+ }
return 0;
}
+static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
+{
+ struct mpc83xx_spi *mpc83xx_spi;
+ u32 word, len, bits_per_word;
+
+ mpc83xx_spi = spi_master_get_devdata(spi->master);
+
+ mpc83xx_spi->tx = t->tx_buf;
+ mpc83xx_spi->rx = t->rx_buf;
+ bits_per_word = spi->bits_per_word;
+ if (t->bits_per_word)
+ bits_per_word = t->bits_per_word;
+ len = t->len;
+ if (bits_per_word > 8)
+ len /= 2;
+ if (bits_per_word > 16)
+ len /= 2;
+ mpc83xx_spi->count = len;
+ INIT_COMPLETION(mpc83xx_spi->done);
+
+ /* enable rx ints */
+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, SPIM_NE);
+
+ /* transmit word */
+ word = mpc83xx_spi->get_tx(mpc83xx_spi);
+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit, word);
+
+ wait_for_completion(&mpc83xx_spi->done);
+
+ /* disable rx ints */
+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0);
+
+ return mpc83xx_spi->count;
+}
+
+static void mpc83xx_spi_work(struct work_struct *work)
+{
+ struct mpc83xx_spi *mpc83xx_spi =
+ container_of(work, struct mpc83xx_spi, work);
+
+ spin_lock_irq(&mpc83xx_spi->lock);
+ mpc83xx_spi->busy = 1;
+ while (!list_empty(&mpc83xx_spi->queue)) {
+ struct spi_message *m;
+ struct spi_device *spi;
+ struct spi_transfer *t = NULL;
+ unsigned cs_change;
+ int status, nsecs = 50;
+
+ m = container_of(mpc83xx_spi->queue.next,
+ struct spi_message, queue);
+ list_del_init(&m->queue);
+ spin_unlock_irq(&mpc83xx_spi->lock);
+
+ spi = m->spi;
+ cs_change = 1;
+ status = 0;
+ list_for_each_entry(t, &m->transfers, transfer_list) {
+ if (t->bits_per_word || t->speed_hz) {
+ /* Don't allow changes if CS is active */
+ status = -EINVAL;
+
+ if (cs_change)
+ status = mpc83xx_spi_setup_transfer(spi, t);
+ if (status < 0)
+ break;
+ }
+
+ if (cs_change)
+ mpc83xx_spi_chipselect(spi, BITBANG_CS_ACTIVE);
+ cs_change = t->cs_change;
+ if (t->len)
+ status = mpc83xx_spi_bufs(spi, t);
+ if (status) {
+ status = -EMSGSIZE;
+ break;
+ }
+ m->actual_length += t->len;
+
+ if (t->delay_usecs)
+ udelay(t->delay_usecs);
+
+ if (cs_change) {
+ ndelay(nsecs);
+ mpc83xx_spi_chipselect(spi, BITBANG_CS_INACTIVE);
+ ndelay(nsecs);
+ }
+ }
+
+ m->status = status;
+ m->complete(m->context);
+
+ if (status || !cs_change) {
+ ndelay(nsecs);
+ mpc83xx_spi_chipselect(spi, BITBANG_CS_INACTIVE);
+ }
+
+ mpc83xx_spi_setup_transfer(spi, NULL);
+
+ spin_lock_irq(&mpc83xx_spi->lock);
+ }
+ mpc83xx_spi->busy = 0;
+ spin_unlock_irq(&mpc83xx_spi->lock);
+}
+
/* the spi->mode bits understood by this driver: */
#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \
| SPI_LSB_FIRST | SPI_LOOP)
static int mpc83xx_spi_setup(struct spi_device *spi)
{
- struct spi_bitbang *bitbang;
struct mpc83xx_spi *mpc83xx_spi;
int retval;
+ u32 hw_mode;
+ struct spi_mpc83xx_cs *cs = spi->controller_state;
if (spi->mode & ~MODEBITS) {
dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n",
@@ -299,63 +424,56 @@ static int mpc83xx_spi_setup(struct spi_
if (!spi->max_speed_hz)
return -EINVAL;
- bitbang = spi_master_get_devdata(spi->master);
+ if (!cs) {
+ cs = kzalloc(sizeof *cs, GFP_KERNEL);
+ if (!cs)
+ return -ENOMEM;
+ spi->controller_state = cs;
+ }
mpc83xx_spi = spi_master_get_devdata(spi->master);
if (!spi->bits_per_word)
spi->bits_per_word = 8;
+ hw_mode = cs->hw_mode; /* Save orginal settings */
+ cs->hw_mode = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
+ /* mask out bits we are going to set */
+ cs->hw_mode &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH
+ | SPMODE_REV | SPMODE_LOOP);
+
+ if (spi->mode & SPI_CPHA)
+ cs->hw_mode |= SPMODE_CP_BEGIN_EDGECLK;
+ if (spi->mode & SPI_CPOL)
+ cs->hw_mode |= SPMODE_CI_INACTIVEHIGH;
+ if (!(spi->mode & SPI_LSB_FIRST))
+ cs->hw_mode |= SPMODE_REV;
+ if (spi->mode & SPI_LOOP)
+ cs->hw_mode |= SPMODE_LOOP;
+
retval = mpc83xx_spi_setup_transfer(spi, NULL);
- if (retval < 0)
+ if (retval < 0) {
+ cs->hw_mode = hw_mode; /* Restore settings */
return retval;
+ }
- dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n",
+ dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u Hz\n",
__func__, spi->mode & (SPI_CPOL | SPI_CPHA),
- spi->bits_per_word, 2 * mpc83xx_spi->nsecs);
-
+ spi->bits_per_word, spi->max_speed_hz);
+#if 0 /* Don't think this is needed */
/* NOTE we _need_ to call chipselect() early, ideally with adapter
* setup, unless the hardware defaults cooperate to avoid confusion
* between normal (active low) and inverted chipselects.
*/
/* deselect chip (low or high) */
- spin_lock(&bitbang->lock);
- if (!bitbang->busy) {
- bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
- ndelay(mpc83xx_spi->nsecs);
- }
- spin_unlock(&bitbang->lock);
-
+ spin_lock(&mpc83xx_spi->lock);
+ if (!mpc83xx_spi->busy)
+ mpc83xx_spi_chipselect(spi, BITBANG_CS_INACTIVE);
+ spin_unlock(&mpc83xx_spi->lock);
+#endif
return 0;
}
-static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
-{
- struct mpc83xx_spi *mpc83xx_spi;
- u32 word;
-
- mpc83xx_spi = spi_master_get_devdata(spi->master);
-
- mpc83xx_spi->tx = t->tx_buf;
- mpc83xx_spi->rx = t->rx_buf;
- mpc83xx_spi->count = t->len;
- INIT_COMPLETION(mpc83xx_spi->done);
-
- /* enable rx ints */
- mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, SPIM_NE);
-
- /* transmit word */
- word = mpc83xx_spi->get_tx(mpc83xx_spi);
- mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit, word);
-
- wait_for_completion(&mpc83xx_spi->done);
-
- /* disable rx ints */
- mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0);
-
- return t->len - mpc83xx_spi->count;
-}
-
irqreturn_t mpc83xx_spi_irq(s32 irq, void *context_data)
{
struct mpc83xx_spi *mpc83xx_spi = context_data;
@@ -395,6 +513,28 @@ irqreturn_t mpc83xx_spi_irq(s32 irq, voi
return ret;
}
+static int mpc83xx_spi_transfer(struct spi_device *spi,
+ struct spi_message *m)
+{
+ struct mpc83xx_spi *mpc83xx_spi = spi_master_get_devdata(spi->master);
+ unsigned long flags;
+
+ m->actual_length = 0;
+ m->status = -EINPROGRESS;
+
+ spin_lock_irqsave(&mpc83xx_spi->lock, flags);
+ list_add_tail(&m->queue, &mpc83xx_spi->queue);
+ queue_work(mpc83xx_spi->workqueue, &mpc83xx_spi->work);
+ spin_unlock_irqrestore(&mpc83xx_spi->lock, flags);
+
+ return 0;
+}
+
+
+static void mpc83xx_spi_cleanup(struct spi_device *spi)
+{
+ kfree(spi->controller_state);
+}
static int __init mpc83xx_spi_probe(struct platform_device *dev)
{
@@ -426,11 +566,11 @@ static int __init mpc83xx_spi_probe(stru
ret = -ENODEV;
goto free_master;
}
+ master->setup = mpc83xx_spi_setup;
+ master->transfer = mpc83xx_spi_transfer;
+ master->cleanup = mpc83xx_spi_cleanup;
+
mpc83xx_spi = spi_master_get_devdata(master);
- mpc83xx_spi->bitbang.master = spi_master_get(master);
- mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect;
- mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer;
- mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs;
mpc83xx_spi->activate_cs = pdata->activate_cs;
mpc83xx_spi->deactivate_cs = pdata->deactivate_cs;
mpc83xx_spi->qe_mode = pdata->qe_mode;
@@ -445,7 +585,6 @@ static int __init mpc83xx_spi_probe(stru
mpc83xx_spi->tx_shift = 24;
}
- mpc83xx_spi->bitbang.master->setup = mpc83xx_spi_setup;
init_completion(&mpc83xx_spi->done);
mpc83xx_spi->base = ioremap(r->start, r->end - r->start + 1);
@@ -483,11 +622,21 @@ static int __init mpc83xx_spi_probe(stru
regval |= SPMODE_OP;
mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
+ spin_lock_init(&mpc83xx_spi->lock);
+ init_completion(&mpc83xx_spi->done);
+ INIT_WORK(&mpc83xx_spi->work, mpc83xx_spi_work);
+ INIT_LIST_HEAD(&mpc83xx_spi->queue);
- ret = spi_bitbang_start(&mpc83xx_spi->bitbang);
-
- if (ret != 0)
+ mpc83xx_spi->workqueue = create_singlethread_workqueue(
+ master->dev.parent->bus_id);
+ if (mpc83xx_spi->workqueue == NULL) {
+ ret = -EBUSY;
goto free_irq;
+ }
+
+ ret = spi_register_master(master);
+ if (ret < 0)
+ goto unreg_master;
printk(KERN_INFO
"%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n",
@@ -495,6 +644,8 @@ static int __init mpc83xx_spi_probe(stru
return ret;
+unreg_master:
+ destroy_workqueue(mpc83xx_spi->workqueue);
free_irq:
free_irq(mpc83xx_spi->irq, mpc83xx_spi);
unmap_io:
@@ -515,10 +666,12 @@ static int __exit mpc83xx_spi_remove(str
master = platform_get_drvdata(dev);
mpc83xx_spi = spi_master_get_devdata(master);
- spi_bitbang_stop(&mpc83xx_spi->bitbang);
+ flush_workqueue(mpc83xx_spi->workqueue);
+ destroy_workqueue(mpc83xx_spi->workqueue);
+ spi_unregister_master(master);
+
free_irq(mpc83xx_spi->irq, mpc83xx_spi);
iounmap(mpc83xx_spi->base);
- spi_master_put(mpc83xx_spi->bitbang.master);
return 0;
}
^ permalink raw reply
* [patch 1/5] POWERPC: Fix slb.c compile warnings
From: Geoff Levand @ 2008-04-30 22:24 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20080430215644.655638516@am.sony.com>
Arrange for a syntax check to always be done on the powerpc/mm/slb.c
DBG() macro by defining it to pr_debug() for non-debug builds.
Also, fix these related compile warnings:
slb.c:273: warning: format '%04x' expects type 'unsigned int', but argument 2 has type 'long unsigned int
slb.c:274: warning: format '%04x' expects type 'unsigned int', but argument 2 has type 'long unsigned int'
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
arch/powerpc/mm/slb.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -30,7 +30,7 @@
#ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt)
#else
-#define DBG(fmt...)
+#define DBG pr_debug
#endif
extern void slb_allocate_realmode(unsigned long ea);
@@ -279,8 +279,8 @@ void slb_initialize(void)
patch_slb_encoding(slb_compare_rr_to_size,
mmu_slb_size);
- DBG("SLB: linear LLP = %04x\n", linear_llp);
- DBG("SLB: io LLP = %04x\n", io_llp);
+ DBG("SLB: linear LLP = %04lx\n", linear_llp);
+ DBG("SLB: io LLP = %04lx\n", io_llp);
}
get_paca()->stab_rr = SLB_NUM_BOLTED;
--
^ permalink raw reply
* [patch 3/5] PS3: Make ps3_virq_setup and ps3_virq_destroy static
From: Geoff Levand @ 2008-04-30 22:25 UTC (permalink / raw)
To: paulus; +Cc: Geert Uytterhoeven, linuxppc-dev
In-Reply-To: <20080430215644.655638516@am.sony.com>
From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
The routines ps3_virq_setup() and ps3_virq_destroy() are used
in only one file, so make them static.
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
arch/powerpc/platforms/ps3/interrupt.c | 6 +++---
include/asm-powerpc/ps3.h | 3 ---
2 files changed, 3 insertions(+), 6 deletions(-)
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -167,8 +167,8 @@ static struct irq_chip ps3_irq_chip = {
* ps3_private data.
*/
-int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
- unsigned int *virq)
+static int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
+ unsigned int *virq)
{
int result;
struct ps3_private *pd;
@@ -217,7 +217,7 @@ fail_create:
* Clears chip data and calls irq_dispose_mapping() for the virq.
*/
-int ps3_virq_destroy(unsigned int virq)
+static int ps3_virq_destroy(unsigned int virq)
{
const struct ps3_private *pd = get_irq_chip_data(virq);
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -178,9 +178,6 @@ enum ps3_cpu_binding {
PS3_BINDING_CPU_1 = 1,
};
-int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
- unsigned int *virq);
-int ps3_virq_destroy(unsigned int virq);
int ps3_irq_plug_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
unsigned int *virq);
int ps3_irq_plug_destroy(unsigned int virq);
--
^ permalink raw reply
* [patch 2/5] PS3: Add time include to lpm
From: Geoff Levand @ 2008-04-30 22:25 UTC (permalink / raw)
To: paulus; +Cc: FUJITA Tomonori, linuxppc-dev
In-Reply-To: <20080430215644.655638516@am.sony.com>
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Add an include <asm/time.h> statement for get_tb().
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
drivers/ps3/ps3-lpm.c:192: error: implicit declaration of function 'get_tb'
I could not recreate this error. asm/time.h seems to be included
from linux/module.h:
In file included from include2/asm/cputime.h:27,
from /home/geoff/projects/cell/linux-2.6/include/linux/sched.h:67,
from include2/asm/elf.h:6,
from /home/geoff/projects/cell/linux-2.6/include/linux/elf.h:8,
from /home/geoff/projects/cell/linux-2.6/include/linux/module.h:15,
from /home/geoff/projects/cell/linux-2.6/drivers/ps3/ps3-lpm.c:24:
include2/asm/time.h:134
drivers/ps3/ps3-lpm.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/ps3/ps3-lpm.c
+++ b/drivers/ps3/ps3-lpm.c
@@ -22,6 +22,7 @@
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/uaccess.h>
+#include <asm/time.h>
#include <asm/ps3.h>
#include <asm/lv1call.h>
#include <asm/cell-pmu.h>
--
^ permalink raw reply
* [patch 5/5] PS3: Update ps3_defconfig
From: Geoff Levand @ 2008-04-30 22:25 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20080430215644.655638516@am.sony.com>
Update ps3_defconfig.
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
arch/powerpc/configs/ps3_defconfig | 132 +++++++++++++++++++++++--------------
1 file changed, 84 insertions(+), 48 deletions(-)
--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Thu Mar 20 11:07:04 2008
+# Linux kernel version: 2.6.25
+# Mon Apr 28 12:39:10 2008
#
CONFIG_PPC64=y
@@ -30,6 +30,9 @@ CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_IRQ_PER_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_ILOG2_U32=y
CONFIG_ARCH_HAS_ILOG2_U64=y
@@ -73,8 +76,6 @@ CONFIG_POSIX_MQUEUE=y
CONFIG_LOG_BUF_SHIFT=17
# CONFIG_CGROUPS is not set
# CONFIG_GROUP_SCHED is not set
-# CONFIG_USER_SCHED is not set
-# CONFIG_CGROUP_SCHED is not set
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
# CONFIG_RELAY is not set
@@ -161,7 +162,6 @@ CONFIG_PPC_MULTIPLATFORM=y
# CONFIG_PPC_PMAC is not set
# CONFIG_PPC_MAPLE is not set
# CONFIG_PPC_PASEMI is not set
-# CONFIG_PPC_CELLEB is not set
CONFIG_PPC_PS3=y
#
@@ -181,6 +181,7 @@ CONFIG_PS3_LPM=m
CONFIG_PPC_CELL=y
# CONFIG_PPC_CELL_NATIVE is not set
# CONFIG_PPC_IBM_CELL_BLADE is not set
+# CONFIG_PPC_CELLEB is not set
#
# Cell Broadband Engine options
@@ -205,9 +206,9 @@ CONFIG_SPU_BASE=y
#
# Kernel options
#
-# CONFIG_TICK_ONESHOT is not set
+CONFIG_TICK_ONESHOT=y
# CONFIG_NO_HZ is not set
-# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
@@ -221,7 +222,6 @@ CONFIG_PREEMPT_NONE=y
CONFIG_BINFMT_ELF=y
CONFIG_COMPAT_BINFMT_ELF=y
CONFIG_BINFMT_MISC=y
-CONFIG_FORCE_MAX_ZONEORDER=13
# CONFIG_IOMMU_VMERGE is not set
CONFIG_IOMMU_HELPER=y
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
@@ -255,6 +255,7 @@ CONFIG_BOUNCE=y
CONFIG_ARCH_MEMORY_PROBE=y
# CONFIG_PPC_HAS_HASH_64K is not set
# CONFIG_PPC_64K_PAGES is not set
+CONFIG_FORCE_MAX_ZONEORDER=13
# CONFIG_SCHED_SMT is not set
CONFIG_PROC_DEVICETREE=y
# CONFIG_CMDLINE_BOOL is not set
@@ -272,7 +273,9 @@ CONFIG_GENERIC_ISA_DMA=y
# CONFIG_PCI_SYSCALL is not set
# CONFIG_ARCH_SUPPORTS_MSI is not set
# CONFIG_PCCARD is not set
+CONFIG_PAGE_OFFSET=0xc000000000000000
CONFIG_KERNEL_START=0xc000000000000000
+CONFIG_PHYSICAL_START=0x00000000
#
# Networking
@@ -292,7 +295,7 @@ CONFIG_XFRM=y
# CONFIG_XFRM_STATISTICS is not set
# CONFIG_NET_KEY is not set
CONFIG_INET=y
-# CONFIG_IP_MULTICAST is not set
+CONFIG_IP_MULTICAST=y
# CONFIG_IP_ADVANCED_ROUTER is not set
CONFIG_IP_FIB_HASH=y
CONFIG_IP_PNP=y
@@ -301,6 +304,7 @@ CONFIG_IP_PNP_DHCP=y
# CONFIG_IP_PNP_RARP is not set
# CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE is not set
+# CONFIG_IP_MROUTE is not set
# CONFIG_ARPD is not set
# CONFIG_SYN_COOKIES is not set
# CONFIG_INET_AH is not set
@@ -332,8 +336,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
CONFIG_INET6_XFRM_MODE_BEET=y
# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
CONFIG_IPV6_SIT=y
+CONFIG_IPV6_NDISC_NODETYPE=y
# CONFIG_IPV6_TUNNEL is not set
# CONFIG_IPV6_MULTIPLE_TABLES is not set
+# CONFIG_IPV6_MROUTE is not set
# CONFIG_NETWORK_SECMARK is not set
# CONFIG_NETFILTER is not set
# CONFIG_IP_DCCP is not set
@@ -392,8 +398,6 @@ CONFIG_IEEE80211=m
CONFIG_IEEE80211_CRYPT_WEP=m
CONFIG_IEEE80211_CRYPT_CCMP=m
CONFIG_IEEE80211_CRYPT_TKIP=m
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
# CONFIG_RFKILL is not set
# CONFIG_NET_9P is not set
@@ -507,6 +511,7 @@ CONFIG_WLAN_80211=y
# CONFIG_LIBERTAS is not set
# CONFIG_USB_ZD1201 is not set
# CONFIG_USB_NET_RNDIS_WLAN is not set
+# CONFIG_IWLWIFI_LEDS is not set
# CONFIG_HOSTAP is not set
#
@@ -578,6 +583,7 @@ CONFIG_INPUT_JOYSTICK=y
# CONFIG_JOYSTICK_SPACEBALL is not set
# CONFIG_JOYSTICK_STINGER is not set
# CONFIG_JOYSTICK_TWIDJOY is not set
+# CONFIG_JOYSTICK_ZHENHUA is not set
# CONFIG_JOYSTICK_JOYDUMP is not set
# CONFIG_JOYSTICK_XPAD is not set
# CONFIG_INPUT_TABLET is not set
@@ -641,6 +647,7 @@ CONFIG_SSB_POSSIBLE=y
# Multifunction device drivers
#
# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
#
# Multimedia devices
@@ -761,10 +768,6 @@ CONFIG_SND_PS3_DEFAULT_START_DELAY=2000
# CONFIG_SND_SOC is not set
#
-# SoC Audio support for SuperH
-#
-
-#
# ALSA SoC audio for Freescale SOCs
#
@@ -849,6 +852,7 @@ CONFIG_USB_STORAGE=m
# CONFIG_USB_STORAGE_ALAUDA is not set
# CONFIG_USB_STORAGE_ONETOUCH is not set
# CONFIG_USB_STORAGE_KARMA is not set
+# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
# CONFIG_USB_LIBUSUAL is not set
#
@@ -893,10 +897,6 @@ CONFIG_USB_MON=y
# CONFIG_EDAC is not set
# CONFIG_RTC_CLASS is not set
# CONFIG_DMADEVICES is not set
-
-#
-# Userspace I/O
-#
# CONFIG_UIO is not set
#
@@ -986,7 +986,6 @@ CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set
CONFIG_NFS_V4=y
-# CONFIG_NFS_DIRECTIO is not set
# CONFIG_NFSD is not set
CONFIG_ROOT_NFS=y
CONFIG_LOCKD=y
@@ -1059,9 +1058,10 @@ CONFIG_NLS_ISO8859_1=y
# Library routines
#
CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
# CONFIG_CRC_CCITT is not set
# CONFIG_CRC16 is not set
-# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC_ITU_T=m
CONFIG_CRC32=y
# CONFIG_CRC7 is not set
# CONFIG_LIBCRC32C is not set
@@ -1071,6 +1071,7 @@ CONFIG_PLIST=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
+CONFIG_HAVE_LMB=y
#
# Kernel hacking
@@ -1078,6 +1079,7 @@ CONFIG_HAS_DMA=y
# CONFIG_PRINTK_TIME is not set
CONFIG_ENABLE_WARN_DEPRECATED=y
CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=2048
CONFIG_MAGIC_SYSRQ=y
# CONFIG_UNUSED_SYMBOLS is not set
# CONFIG_DEBUG_FS is not set
@@ -1093,12 +1095,16 @@ CONFIG_SCHED_DEBUG=y
# CONFIG_RT_MUTEX_TESTER is not set
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
CONFIG_DEBUG_SPINLOCK_SLEEP=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
CONFIG_DEBUG_LIST=y
# CONFIG_DEBUG_SG is not set
# CONFIG_BOOT_PRINTK_DELAY is not set
@@ -1121,51 +1127,81 @@ CONFIG_IRQSTACKS=y
# CONFIG_SECURITY is not set
# CONFIG_SECURITY_FILE_CAPABILITIES is not set
CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_AEAD=m
CONFIG_CRYPTO_BLKCIPHER=y
-CONFIG_CRYPTO_SEQIV=m
CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_GF128MUL=m
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+CONFIG_CRYPTO_CCM=m
+CONFIG_CRYPTO_GCM=m
+CONFIG_CRYPTO_SEQIV=m
+
+#
+# Block modes
+#
+CONFIG_CRYPTO_CBC=y
+CONFIG_CRYPTO_CTR=m
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=m
+# CONFIG_CRYPTO_LRW is not set
+CONFIG_CRYPTO_PCBC=m
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
# CONFIG_CRYPTO_HMAC is not set
# CONFIG_CRYPTO_XCBC is not set
-# CONFIG_CRYPTO_NULL is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
# CONFIG_CRYPTO_MD4 is not set
CONFIG_CRYPTO_MD5=y
+CONFIG_CRYPTO_MICHAEL_MIC=m
# CONFIG_CRYPTO_SHA1 is not set
# CONFIG_CRYPTO_SHA256 is not set
# CONFIG_CRYPTO_SHA512 is not set
-# CONFIG_CRYPTO_WP512 is not set
# CONFIG_CRYPTO_TGR192 is not set
-CONFIG_CRYPTO_GF128MUL=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=y
-CONFIG_CRYPTO_PCBC=m
-# CONFIG_CRYPTO_LRW is not set
-# CONFIG_CRYPTO_XTS is not set
-CONFIG_CRYPTO_CTR=m
-CONFIG_CRYPTO_GCM=m
-CONFIG_CRYPTO_CCM=m
-# CONFIG_CRYPTO_CRYPTD is not set
-CONFIG_CRYPTO_DES=y
-# CONFIG_CRYPTO_FCRYPT is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
CONFIG_CRYPTO_AES=m
+# CONFIG_CRYPTO_ANUBIS is not set
+CONFIG_CRYPTO_ARC4=m
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
# CONFIG_CRYPTO_CAST5 is not set
# CONFIG_CRYPTO_CAST6 is not set
-# CONFIG_CRYPTO_TEA is not set
-CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
# CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_SEED is not set
CONFIG_CRYPTO_SALSA20=m
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
# CONFIG_CRYPTO_DEFLATE is not set
-CONFIG_CRYPTO_MICHAEL_MIC=m
-# CONFIG_CRYPTO_CRC32C is not set
-# CONFIG_CRYPTO_CAMELLIA is not set
-# CONFIG_CRYPTO_TEST is not set
-# CONFIG_CRYPTO_AUTHENC is not set
CONFIG_CRYPTO_LZO=m
CONFIG_CRYPTO_HW=y
# CONFIG_PPC_CLOCK is not set
+# CONFIG_VIRTUALIZATION is not set
--
^ permalink raw reply
* [patch 4/5] PS3: Remove unsupported wakeup sources
From: Geoff Levand @ 2008-04-30 22:25 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20080430215644.655638516@am.sony.com>
Other OS wakeup is not supported from the IR controller,
the bluetooth controller nor the RTC. Remove references
to these in the PS3 sys-manager source.
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
drivers/ps3/ps3-sys-manager.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
--- a/drivers/ps3/ps3-sys-manager.c
+++ b/drivers/ps3/ps3-sys-manager.c
@@ -184,10 +184,7 @@ enum ps3_sys_manager_next_op {
/**
* enum ps3_sys_manager_wake_source - Next-op wakeup source (bit position mask).
- * @PS3_SM_WAKE_DEFAULT: Disk insert, power button, eject button, IR
- * controller, and bluetooth controller.
- * @PS3_SM_WAKE_RTC:
- * @PS3_SM_WAKE_RTC_ERROR:
+ * @PS3_SM_WAKE_DEFAULT: Disk insert, power button, eject button.
* @PS3_SM_WAKE_W_O_L: Ether or wireless LAN.
* @PS3_SM_WAKE_P_O_R: Power on reset.
*
@@ -200,8 +197,6 @@ enum ps3_sys_manager_next_op {
enum ps3_sys_manager_wake_source {
/* version 3 */
PS3_SM_WAKE_DEFAULT = 0,
- PS3_SM_WAKE_RTC = 0x00000040,
- PS3_SM_WAKE_RTC_ERROR = 0x00000080,
PS3_SM_WAKE_W_O_L = 0x00000400,
PS3_SM_WAKE_P_O_R = 0x80000000,
};
--
^ permalink raw reply
* [patch 0/5] PS3 patches for 2.6.26
From: Geoff Levand @ 2008-04-30 22:24 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
Paul,
This is a small set of PS3 fixup patches for 2.6.26.
[patch 1/5] POWERPC: Fix slb.c compile warnings
[patch 2/5] PS3: Add time include to lpm
[patch 3/5] PS3: Make ps3_virq_setup and ps3_virq_destroy static
[patch 4/5] PS3: Remove unsupported wakeup sources
[patch 5/5] PS3: Update ps3_defconfig
-Geoff
--
^ permalink raw reply
* Re: [PATCH] [POWERPC] Rework EXC_LEVEL_EXCEPTION_PROLOG code
From: Benjamin Herrenschmidt @ 2008-04-30 22:22 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <12ECF63E-7CEA-48FD-9447-7D534C29271D@kernel.crashing.org>
On Wed, 2008-04-30 at 17:13 -0500, Kumar Gala wrote:
>
> If we don't handle reschedule or signal will we actually not
> function
> properly? I assume reschedule isn't an issue, but could we lose a
> signal?
Well, you can be in trouble if you lose TIF_SIGPENDING. You don't -have-
to actually take the signal, it will then be done on the next return to
userspace (next timer interrupt, next syscall, ...), but TIF_SIGPENDING
must not be lost.
> > Nothing specific to your patch, but those level##_STACK_TOP seem to
> > be pretty badly named if you end up -adding- THREAD_SIZE to actually
> > get to the stack's top. Do they really contain the stack top or do
> > they in fact contain the stack base/bottom ?
>
> That might be stale from how the old code worked. I can never
> remember what we consider the top and bottom of the stack. (please
> remind me and I'll fixup the comments and variables).
Well, top is the high address and bottom is the low address in my view
of things :-)
> I thought about that. The only case its a bit of an issue is for
> CriticalInput. I don't see Watchdog, Debug, or MachineCheck as
> being
> performance critical. I can use r10 if I save and restored the CR
> or
> some other register.
You can save CR first yeah and then interleave a bit using 2 registers
(ie. 2 loads, 2 stores, or something like load 1, load 2, store 1, load
3, store 2, etc...)
> just leaving it to C code. I assume that preempt_count should be
> the
> same value on entry and exit. Do think we should set HARDIRQ_OFFSET
> for debug level exceptions?
Well... I think all those things should run with EE disabled, and thus
be considered as far as linux is concerned, as interrupts. So the C code
should do irq_enter/exit.
> Where should I look for an example of how to convey that information
> to lockdep?
The irqtrace stuff in the asm would do maybe unless transfer_to_handler
does it already, I have to look at the code with all your patches
applied...
Ben.
^ permalink raw reply
* Re: [PATCH] [POWERPC] Rework EXC_LEVEL_EXCEPTION_PROLOG code
From: Benjamin Herrenschmidt @ 2008-04-30 22:18 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <12ECF63E-7CEA-48FD-9447-7D534C29271D@kernel.crashing.org>
On Wed, 2008-04-30 at 17:13 -0500, Kumar Gala wrote:
> >> stack there by make references go from GPR11-INT_FRAME_SIZE(r8) to
> >> just GPR(r8)
> > ^^ 11 ?
>
> r8 is correct for my example. My point is
> s/GPR11-INT_FRAME_SIZE/GPR11/
Sorry, I put the ^^ in the wrong place :-) I meant the example should
say GPR11(r8)
Ben.
^ permalink raw reply
* Re: [PATCH 1/7] Implement arch disable/enable irq hooks.
From: Paul Mackerras @ 2008-04-30 22:17 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: Scott Wood, linuxppc-dev
In-Reply-To: <Pine.LNX.4.64.0804301229310.5099@axis700.grange>
Guennadi Liakhovetski writes:
> The patch (with the _TLF_SLEEPING fix you mentioned in a later email)
> works for me.
Great, thanks.
> Shall I submit it "From: <you>" or would you prefer to post
> it yourself? But, I guess, you have to put your "S-o-b" under it yourself,
> don't you?
I'll post it as a stand-alone patch with my S-o-b.
Paul.
^ permalink raw reply
* Re: [PATCH] docbook: fix fatal rapidio yet again (and more to come)
From: Randy Dunlap @ 2008-04-30 22:17 UTC (permalink / raw)
To: Kumar Gala
Cc: linux-kernel, linuxppc-dev, Paul Mackerras, Andrew Morton,
torvalds, "Zhang Wei" rdunlap@xenotime.net
In-Reply-To: <63DC9937-3C82-4744-8281-B9FDB941FEE1@kernel.crashing.org>
Kumar Gala wrote:
>
> On Apr 30, 2008, at 5:11 PM, Randy Dunlap wrote:
>> On Thu, 1 May 2008 08:09:24 +1000 Paul Mackerras wrote:
>>
>>> Andrew Morton writes:
>>>
>>>>> Odd. I thought Paul had picked up a docbook RapidIO patch from you in
>>>>> the latest merge round.
>>>>>
>>>>
>>>> Well it's more than "a" patch. The six-week-old patch series is:
>>>>
>>>> rapidio-add-memory-mapping-driver-to-rapidio.patch
>>>> rapidio-add-rapidio-space-allocation-bitmap-arithmetic.patch
>>>> rapidio-add-fsl-rapidio-controller-memory-ops-functions.patch
>>>> rapidio-add-the-rapidio-master-port-maintance-and-doorbell-window-to-space-resources.patch
>>>>
>>>> rapidio-add-rapidio-proc-fs-for-memory-mapping-debugging.patch
>>>> rapidio-add-the-memory-mapping-support-in-rionet-driver.patch
>>>> rapidio-fix-docbook-references.patch
>>>> rapidio-fix-kernel-doc-problems.patch
>>>
>>> What happened is that you (Andrew) sent them on to me pretty much
>>> unexamined. I took a look at them and dropped one of them because it
>>> created a new /proc file. I asked Kumar to look at them and he had
>>> issues with another three of the patches, and dropping those meant
>>> that all the following ones (including the fix-kernel-doc one)
>>> wouldn't apply, so I dropped them too. I applied the rest and sent
>>> them to Linus.
>>>
>>>> (seems that I forgot to cc Jeff on the rionet change too).
>>>
>>> Yeah. I nearly dropped that one too. I probably should have. :)
>>>
>>>> Oh well. If nobody puts their hand up in the next 24 hours or so
>>>> I'll just
>>>> send it all in to Linus.
>>>
>>> Please don't. At this stage I think the best thing is for Kumar to
>>> talk to Zhang Wei (they both work for Freescale, so that should be
>>> possible in theory :) and get him to rework the remaining patches as
>>> required for inclusion in 2.6.27.
>>
>> Just to be clear, the docbook changes shouldn't wait for 2.6.27.
>> There's no need for that.
>
> Can the docbook be respun against linus's tree?
Sure, I'll do that later, hopefully tonight.
--
~Randy
^ permalink raw reply
* Re: [PATCH] docbook: fix fatal rapidio yet again (and more to come)
From: Kumar Gala @ 2008-04-30 22:14 UTC (permalink / raw)
To: Randy Dunlap
Cc: linux-kernel, linuxppc-dev, Paul Mackerras, Andrew Morton,
torvalds, "Zhang Wei" rdunlap@xenotime.net
In-Reply-To: <20080430151149.063920cf.randy.dunlap@oracle.com>
On Apr 30, 2008, at 5:11 PM, Randy Dunlap wrote:
> On Thu, 1 May 2008 08:09:24 +1000 Paul Mackerras wrote:
>
>> Andrew Morton writes:
>>
>>>> Odd. I thought Paul had picked up a docbook RapidIO patch from
>>>> you in
>>>> the latest merge round.
>>>>
>>>
>>> Well it's more than "a" patch. The six-week-old patch series is:
>>>
>>> rapidio-add-memory-mapping-driver-to-rapidio.patch
>>> rapidio-add-rapidio-space-allocation-bitmap-arithmetic.patch
>>> rapidio-add-fsl-rapidio-controller-memory-ops-functions.patch
>>> rapidio-add-the-rapidio-master-port-maintance-and-doorbell-window-
>>> to-space-resources.patch
>>> rapidio-add-rapidio-proc-fs-for-memory-mapping-debugging.patch
>>> rapidio-add-the-memory-mapping-support-in-rionet-driver.patch
>>> rapidio-fix-docbook-references.patch
>>> rapidio-fix-kernel-doc-problems.patch
>>
>> What happened is that you (Andrew) sent them on to me pretty much
>> unexamined. I took a look at them and dropped one of them because it
>> created a new /proc file. I asked Kumar to look at them and he had
>> issues with another three of the patches, and dropping those meant
>> that all the following ones (including the fix-kernel-doc one)
>> wouldn't apply, so I dropped them too. I applied the rest and sent
>> them to Linus.
>>
>>> (seems that I forgot to cc Jeff on the rionet change too).
>>
>> Yeah. I nearly dropped that one too. I probably should have. :)
>>
>>> Oh well. If nobody puts their hand up in the next 24 hours or so
>>> I'll just
>>> send it all in to Linus.
>>
>> Please don't. At this stage I think the best thing is for Kumar to
>> talk to Zhang Wei (they both work for Freescale, so that should be
>> possible in theory :) and get him to rework the remaining patches as
>> required for inclusion in 2.6.27.
>
> Just to be clear, the docbook changes shouldn't wait for 2.6.27.
> There's no need for that.
Can the docbook be respun against linus's tree?
-k
^ permalink raw reply
* Re: [PATCH] [POWERPC] Rework EXC_LEVEL_EXCEPTION_PROLOG code
From: Kumar Gala @ 2008-04-30 22:13 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1209592495.18023.246.camel@pasglop>
On Apr 30, 2008, at 4:54 PM, Benjamin Herrenschmidt wrote:
>
> On Wed, 2008-04-30 at 04:27 -0500, Kumar Gala wrote:
>> * Cleanup the code a bit my allocating an INT_FRAME on our exception
>> stack there by make references go from GPR11-INT_FRAME_SIZE(r8) to
>> just GPR(r8)
> ^^ 11 ?
r8 is correct for my example. My point is s/GPR11-INT_FRAME_SIZE/GPR11/
>> * simplify {lvl}_transfer_to_handler code by moving the copying of
>> the
>> temp registers we use if we come from user space into the PROLOG
>> * If the exception came from kernel mode copy thread_info flags,
>> preempt, and task pointer from the process thread_info.
>>
>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>> ---
>>
>> I'm not sure if the copying of TI_FLAGS, TI_PREEMPT, and TI_TASK
>> are really needed. I'm a bit concerned what to do if we get a
>> CriticalInput while in kernel mode and the handler causes a
>> reschedule.
>
> Well, reschedule or signal, either way, you can't handle them on the
> way
> out. Maybe an option there is to set the flag in the normal kernel
> stack's thread info and trigger an interrupt asap via the PIT so
> things
> get handled ?
If we don't handle reschedule or signal will we actually not function
properly? I assume reschedule isn't an issue, but could we lose a
signal?
>> diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/
>> head_booke.h
>> index d647e05..78baec5 100644
>> --- a/arch/powerpc/kernel/head_booke.h
>> +++ b/arch/powerpc/kernel/head_booke.h
>> @@ -78,12 +78,12 @@
>> slwi r8,r8,2; \
>> addis r8,r8,level##_STACK_TOP@ha; \
>> lwz r8,level##_STACK_TOP@l(r8); \
>> - addi r8,r8,THREAD_SIZE;
>> + addi r8,r8,THREAD_SIZE-INT_FRAME_SIZE;
>> #else
>> #define BOOKE_LOAD_EXC_LEVEL_STACK(level) \
>> lis r8,level##_STACK_TOP@ha; \
>> lwz r8,level##_STACK_TOP@l(r8); \
>> - addi r8,r8,THREAD_SIZE;
>> + addi r8,r8,THREAD_SIZE-INT_FRAME_SIZE;
>> #endif
>
> Nothing specific to your patch, but those level##_STACK_TOP seem to
> be pretty badly named if you end up -adding- THREAD_SIZE to actually
> get to the stack's top. Do they really contain the stack top or do
> they in fact contain the stack base/bottom ?
That might be stale from how the old code worked. I can never
remember what we consider the top and bottom of the stack. (please
remind me and I'll fixup the comments and variables).
>> /*
>> @@ -97,22 +97,35 @@
>> #define EXC_LEVEL_EXCEPTION_PROLOG(exc_level, exc_level_srr0,
>> exc_level_srr1) \
>> mtspr exc_level##_SPRG,r8; \
>> BOOKE_LOAD_EXC_LEVEL_STACK(exc_level);/* r8 points to the
>> exc_level stack*/ \
>> - stw r10,GPR10-INT_FRAME_SIZE(r8); \
>> - stw r11,GPR11-INT_FRAME_SIZE(r8); \
>> + stw r9,GPR9(r8); /* save various registers */\
>> + stw r10,GPR10(r8); \
>> + stw r11,GPR11(r8); \
>> + mfspr r11,SPRN_SPRG3; /* if from user, start at top of */\
>> + lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
>> + addi r11,r11,THREAD_SIZE-INT_FRAME_SIZE; /* Alloc exception frm */\
>
> So you do the above whether it will actually be needed or not right ?
good point I can move this down.
>> mfcr r10; /* save CR in r10 for now */\
>> - mfspr r11,exc_level_srr1; /* check whether user or kernel */\
>> - andi. r11,r11,MSR_PR; \
>> - mr r11,r8; \
>> - mfspr r8,exc_level##_SPRG; \
>> + mfspr r9,exc_level_srr1; /* check whether user or kernel */\
>> + andi. r9,r9,MSR_PR; \
>> beq 1f; \
>> /* COMING FROM USER MODE */ \
>> - mfspr r11,SPRN_SPRG3; /* if from user, start at top of */\
>> - lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
>> - addi r11,r11,THREAD_SIZE; \
>> -1: subi r11,r11,INT_FRAME_SIZE; /* Allocate an exception frame
>> */\
>> + lwz r9,GPR9(r8); /* copy regs from exception stack */\
>> + stw r9,GPR9(r11); \
>> + lwz r9,GPR10(r8); \
>> + stw r9,GPR10(r11); \
>> + lwz r9,GPR11(r8); \
>> + stw r9,GPR11(r11); \
>> + b 2f; \
>
> Are we concerned with performances here or not ? Because using the
> same
> reg all along isn't the best ...
I thought about that. The only case its a bit of an issue is for
CriticalInput. I don't see Watchdog, Debug, or MachineCheck as being
performance critical. I can use r10 if I save and restored the CR or
some other register.
>> + /* COMING FROM PRIV MODE */ \
>> +1: lwz r9,TI_FLAGS-THREAD_SIZE(r11); \
>> + stw r9,TI_FLAGS-THREAD_SIZE(r8); \
>> + lwz r9,TI_PREEMPT-THREAD_SIZE(r11); \
>> + stw r9,TI_PREEMPT-THREAD_SIZE(r8); \
>> + lwz r9,TI_TASK-THREAD_SIZE(r11); \
>> + stw r9,TI_TASK-THREAD_SIZE(r8); \
>> + mr r11,r8; \
>
> Don't you want to also stick in HARDIRQ_OFFSET in preempt_count or
> leave that to C code ?
just leaving it to C code. I assume that preempt_count should be the
same value on entry and exit. Do think we should set HARDIRQ_OFFSET
for debug level exceptions?
> Also, you might want at one point to tell
> lockdep about IRQs being disabled in case they were enabled when
> you took the exception. (Do that after you've saved enough
> stuff of crouse)
Where should I look for an example of how to convey that information
to lockdep?
- k
^ permalink raw reply
* Re: [spi-devel-general] [PATCH] spi_mpc83xx: test below 0 on unsigned irq in mpc83xx_spi_probe()
From: David Brownell @ 2008-04-30 22:12 UTC (permalink / raw)
To: spi-devel-general; +Cc: linuxppc-dev@ozlabs.org list, Roel Kluin, lkml
In-Reply-To: <7C711FFF-E1C5-4286-93A8-382055C6760C@kernel.crashing.org>
On Wednesday 23 April 2008, Kumar Gala wrote:
>
> On Apr 23, 2008, at 3:19 PM, Roel Kluin wrote:
> > mpc83xx_spi->irq is unsigned, so the test fails
> >
> > Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Any reason to not just make mpc83xx_spi->irq be "int",
following normal practice everywhere? If not, I'll
roll that into the patch from Joakim Tjernlund...
- Dave
^ permalink raw reply
* Re: [PATCH] docbook: fix fatal rapidio yet again (and more to come)
From: Paul Mackerras @ 2008-04-30 22:09 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, linuxppc-dev, rdunlap, torvalds, Zhang Wei
In-Reply-To: <20080430121239.28492328.akpm@linux-foundation.org>
Andrew Morton writes:
> > Odd. I thought Paul had picked up a docbook RapidIO patch from you in
> > the latest merge round.
> >
>
> Well it's more than "a" patch. The six-week-old patch series is:
>
> rapidio-add-memory-mapping-driver-to-rapidio.patch
> rapidio-add-rapidio-space-allocation-bitmap-arithmetic.patch
> rapidio-add-fsl-rapidio-controller-memory-ops-functions.patch
> rapidio-add-the-rapidio-master-port-maintance-and-doorbell-window-to-space-resources.patch
> rapidio-add-rapidio-proc-fs-for-memory-mapping-debugging.patch
> rapidio-add-the-memory-mapping-support-in-rionet-driver.patch
> rapidio-fix-docbook-references.patch
> rapidio-fix-kernel-doc-problems.patch
What happened is that you (Andrew) sent them on to me pretty much
unexamined. I took a look at them and dropped one of them because it
created a new /proc file. I asked Kumar to look at them and he had
issues with another three of the patches, and dropping those meant
that all the following ones (including the fix-kernel-doc one)
wouldn't apply, so I dropped them too. I applied the rest and sent
them to Linus.
> (seems that I forgot to cc Jeff on the rionet change too).
Yeah. I nearly dropped that one too. I probably should have. :)
> Oh well. If nobody puts their hand up in the next 24 hours or so I'll just
> send it all in to Linus.
Please don't. At this stage I think the best thing is for Kumar to
talk to Zhang Wei (they both work for Freescale, so that should be
possible in theory :) and get him to rework the remaining patches as
required for inclusion in 2.6.27.
Paul.
^ permalink raw reply
* Re: [PATCH] [POWERPC] convert transfer_to_handler into a macro
From: Kumar Gala @ 2008-04-30 22:04 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1209592794.18023.248.camel@pasglop>
On Apr 30, 2008, at 4:59 PM, Benjamin Herrenschmidt wrote:
>
> On Wed, 2008-04-30 at 03:02 -0500, Kumar Gala wrote:
>> got that. Does 40x/44x have anything similar we need to save/
>> restore?
>
> MMUCR I'd say... look at what our tlbie does there...
thanks. Will take a look. I just plan on overloading MMUCR with MAS0.
- k
^ permalink raw reply
* Re: [PATCH] [POWERPC] convert transfer_to_handler into a macro
From: Benjamin Herrenschmidt @ 2008-04-30 21:59 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <EDF2E889-4B04-42A8-8D93-E04B35162661@kernel.crashing.org>
On Wed, 2008-04-30 at 03:02 -0500, Kumar Gala wrote:
> got that. Does 40x/44x have anything similar we need to save/restore?
MMUCR I'd say... look at what our tlbie does there...
Ben.
^ permalink raw reply
* [PATCH v3] [POWERPC] devres: Add devm_ioremap_prot()
From: Kumar Gala @ 2008-04-30 21:54 UTC (permalink / raw)
To: linuxppc-dev
Cc: Andrew Morton, htejun, Jeff Garzik, linux-kernel, Emilian.Medve,
Greg KH
From: Emil Medve <Emilian.Medve@Freescale.com>
We provide an ioremap_flags so provide a corresponding devm_ioremap_prot.
The slight name difference is at Ben Herrenschmidt request as he plans
on changing ioremap_flags to ioremap_prot in the future.
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
Renamed at BenH's request to devm_ioremap_prot.
arch/powerpc/lib/Makefile | 1 +
arch/powerpc/lib/devres.c | 33 +++++++++++++++++++++++++++++++++
include/asm-powerpc/io.h | 8 +++++++-
include/linux/io.h | 1 +
lib/devres.c | 2 +-
5 files changed, 43 insertions(+), 2 deletions(-)
create mode 100644 arch/powerpc/lib/devres.c
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 4bb023f..f1d2cdc 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -23,3 +23,4 @@ obj-$(CONFIG_SMP) += locks.o
endif
obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
+obj-$(CONFIG_HAS_IOMEM) += devres.o
diff --git a/arch/powerpc/lib/devres.c b/arch/powerpc/lib/devres.c
new file mode 100644
index 0000000..b290845
--- /dev/null
+++ b/arch/powerpc/lib/devres.c
@@ -0,0 +1,33 @@
+#include <linux/device.h> /* devres_*(), devm_ioremap_release() */
+#include <linux/io.h> /* ioremap_flags() */
+#include <linux/module.h> /* EXPORT_SYMBOL() */
+
+/**
+ * devm_ioremap_prot - Managed ioremap_flags()
+ * @dev: Generic device to remap IO address for
+ * @offset: BUS offset to map
+ * @size: Size of map
+ * @flags: Page flags
+ *
+ * Managed ioremap_prot(). Map is automatically unmapped on driver
+ * detach.
+ */
+void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset,
+ size_t size, unsigned long flags)
+{
+ void __iomem **ptr, *addr;
+
+ ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL);
+ if (!ptr)
+ return NULL;
+
+ addr = ioremap_flags(offset, size, flags);
+ if (addr) {
+ *ptr = addr;
+ devres_add(dev, ptr);
+ } else
+ devres_free(ptr);
+
+ return addr;
+}
+EXPORT_SYMBOL(devm_ioremap_prot);
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index afae069..e0062d7 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -2,7 +2,7 @@
#define _ASM_POWERPC_IO_H
#ifdef __KERNEL__
-/*
+/*
* 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
@@ -18,6 +18,9 @@ extern int check_legacy_ioport(unsigned long base_port);
#define _PNPWRP 0xa79
#define PNPBIOS_BASE 0xf000
+#include <linux/device.h>
+#include <linux/io.h>
+
#include <linux/compiler.h>
#include <asm/page.h>
#include <asm/byteorder.h>
@@ -744,6 +747,9 @@ static inline void * bus_to_virt(unsigned long address)
#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
+void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset,
+ size_t size, unsigned long flags);
+
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_IO_H */
diff --git a/include/linux/io.h b/include/linux/io.h
index 831f57c..7a390cf 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -58,6 +58,7 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
}
#endif
+void devm_ioremap_release(struct device *dev, void *res);
void __iomem * devm_ioremap(struct device *dev, resource_size_t offset,
unsigned long size);
void __iomem * devm_ioremap_nocache(struct device *dev, resource_size_t offset,
diff --git a/lib/devres.c b/lib/devres.c
index 26c87c4..72c8909 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -2,7 +2,7 @@
#include <linux/io.h>
#include <linux/module.h>
-static void devm_ioremap_release(struct device *dev, void *res)
+void devm_ioremap_release(struct device *dev, void *res)
{
iounmap(*(void __iomem **)res);
}
--
1.5.4.1
^ permalink raw reply related
* Re: [PATCH] [POWERPC] Rework EXC_LEVEL_EXCEPTION_PROLOG code
From: Benjamin Herrenschmidt @ 2008-04-30 21:54 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <Pine.LNX.4.64.0804300424040.31028@blarg.am.freescale.net>
On Wed, 2008-04-30 at 04:27 -0500, Kumar Gala wrote:
> * Cleanup the code a bit my allocating an INT_FRAME on our exception
> stack there by make references go from GPR11-INT_FRAME_SIZE(r8) to
> just GPR(r8)
^^ 11 ?
> * simplify {lvl}_transfer_to_handler code by moving the copying of the
> temp registers we use if we come from user space into the PROLOG
> * If the exception came from kernel mode copy thread_info flags,
> preempt, and task pointer from the process thread_info.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
>
> I'm not sure if the copying of TI_FLAGS, TI_PREEMPT, and TI_TASK
> are really needed. I'm a bit concerned what to do if we get a
> CriticalInput while in kernel mode and the handler causes a reschedule.
Well, reschedule or signal, either way, you can't handle them on the way
out. Maybe an option there is to set the flag in the normal kernel
stack's thread info and trigger an interrupt asap via the PIT so things
get handled ?
>
> diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h
> index d647e05..78baec5 100644
> --- a/arch/powerpc/kernel/head_booke.h
> +++ b/arch/powerpc/kernel/head_booke.h
> @@ -78,12 +78,12 @@
> slwi r8,r8,2; \
> addis r8,r8,level##_STACK_TOP@ha; \
> lwz r8,level##_STACK_TOP@l(r8); \
> - addi r8,r8,THREAD_SIZE;
> + addi r8,r8,THREAD_SIZE-INT_FRAME_SIZE;
> #else
> #define BOOKE_LOAD_EXC_LEVEL_STACK(level) \
> lis r8,level##_STACK_TOP@ha; \
> lwz r8,level##_STACK_TOP@l(r8); \
> - addi r8,r8,THREAD_SIZE;
> + addi r8,r8,THREAD_SIZE-INT_FRAME_SIZE;
> #endif
Nothing specific to your patch, but those level##_STACK_TOP seem to
be pretty badly named if you end up -adding- THREAD_SIZE to actually
get to the stack's top. Do they really contain the stack top or do
they in fact contain the stack base/bottom ?
> /*
> @@ -97,22 +97,35 @@
> #define EXC_LEVEL_EXCEPTION_PROLOG(exc_level, exc_level_srr0, exc_level_srr1) \
> mtspr exc_level##_SPRG,r8; \
> BOOKE_LOAD_EXC_LEVEL_STACK(exc_level);/* r8 points to the exc_level stack*/ \
> - stw r10,GPR10-INT_FRAME_SIZE(r8); \
> - stw r11,GPR11-INT_FRAME_SIZE(r8); \
> + stw r9,GPR9(r8); /* save various registers */\
> + stw r10,GPR10(r8); \
> + stw r11,GPR11(r8); \
> + mfspr r11,SPRN_SPRG3; /* if from user, start at top of */\
> + lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
> + addi r11,r11,THREAD_SIZE-INT_FRAME_SIZE; /* Alloc exception frm */\
So you do the above whether it will actually be needed or not right ?
> mfcr r10; /* save CR in r10 for now */\
> - mfspr r11,exc_level_srr1; /* check whether user or kernel */\
> - andi. r11,r11,MSR_PR; \
> - mr r11,r8; \
> - mfspr r8,exc_level##_SPRG; \
> + mfspr r9,exc_level_srr1; /* check whether user or kernel */\
> + andi. r9,r9,MSR_PR; \
> beq 1f; \
> /* COMING FROM USER MODE */ \
> - mfspr r11,SPRN_SPRG3; /* if from user, start at top of */\
> - lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
> - addi r11,r11,THREAD_SIZE; \
> -1: subi r11,r11,INT_FRAME_SIZE; /* Allocate an exception frame */\
> + lwz r9,GPR9(r8); /* copy regs from exception stack */\
> + stw r9,GPR9(r11); \
> + lwz r9,GPR10(r8); \
> + stw r9,GPR10(r11); \
> + lwz r9,GPR11(r8); \
> + stw r9,GPR11(r11); \
> + b 2f; \
Are we concerned with performances here or not ? Because using the same
reg all along isn't the best ...
> + /* COMING FROM PRIV MODE */ \
> +1: lwz r9,TI_FLAGS-THREAD_SIZE(r11); \
> + stw r9,TI_FLAGS-THREAD_SIZE(r8); \
> + lwz r9,TI_PREEMPT-THREAD_SIZE(r11); \
> + stw r9,TI_PREEMPT-THREAD_SIZE(r8); \
> + lwz r9,TI_TASK-THREAD_SIZE(r11); \
> + stw r9,TI_TASK-THREAD_SIZE(r8); \
> + mr r11,r8; \
Don't you want to also stick in HARDIRQ_OFFSET in preempt_count or
leave that to C code ? Also, you might want at one point to tell
lockdep about IRQs being disabled in case they were enabled when
you took the exception. (Do that after you've saved enough
stuff of crouse)
Ben.
^ permalink raw reply
* Re: [PATCH v2] [POWERPC] devres: Add devm_ioremap_flags()
From: Kumar Gala @ 2008-04-30 21:49 UTC (permalink / raw)
To: benh
Cc: Andrew Morton, htejun, Jeff Garzik, Greg KH, linux-kernel,
Emilian.Medve, linuxppc-dev
In-Reply-To: <1209591750.18023.233.camel@pasglop>
On Apr 30, 2008, at 4:42 PM, Benjamin Herrenschmidt wrote:
>
> On Wed, 2008-04-30 at 11:08 -0500, Kumar Gala wrote:
>> From: Emil Medve <Emilian.Medve@Freescale.com>
>>
>> We provide an ioremap_flags so provide a coresphonding
>> devm_ioremap_flags.
>>
>> Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>> ---
>>
>> Forgot to commit the actual implemtation in arch/powerpc/lib/devres.c
>>
>> Which tree should this go through, powerpc.git?
>
> Let's call it ioremap_prot instead please. I'm about to change
> ioremap_flags to ioremap_prot anyways. Keep the flags/prot argument
> unsigned long for now (it can be argued it should be a pgprot but that
> hasn't been sorted out completely).
No problem. I've always wondered why ioremap_* aren't better
specified by generic code.
- k
^ permalink raw reply
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