Re: 2.6.33 -next tree
Hi Grant, Grant Likely wrote: Hi Ben, Stephen. I just prepared my next branch for 2.6.33: git://git.secretlab.ca/git/linux-2.6 next Just for curiosity: I noticed that you keep so far the further patches for the dedicated spi controller on mpc5200 in the next-spi tree. Any plan when they will be merged to the -next tree? Like mentioned before, some of them are essential, without which the driver doesn't work (at least on my board) sorry for nagging. ;-) thanks cheers Luotao Fu -- Pengutronix e.K. | Dipl.-Ing. Luotao Fu| Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] spi/mpc52xx-spi: cleanups
On Tue, Nov 17, 2009 at 03:31:08PM +0100, Wolfram Sang wrote: - drop own, obsolete include-file - drop IRQF_SAMPLE_RANDOM (deprecated feature) - drop 'if' above kfree() - typos, braces whitespaces Signed-off-by: Wolfram Sang w.s...@pengutronix.de Cc: Luotao Fu l...@pengutronix.de Cc: Grant Likely grant.lik...@secretlab.ca acked-by: Luotao Fu l...@pengutronix.de minor comments see below, --- This goes ontop of Grant's test-branch. drivers/spi/mpc52xx_spi.c | 24 ++-- include/linux/spi/mpc52xx_spi.h | 10 -- 2 files changed, 10 insertions(+), 24 deletions(-) delete mode 100644 include/linux/spi/mpc52xx_spi.h diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index 97beba2..7f4089c 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c @@ -18,7 +18,6 @@ #include linux/interrupt.h #include linux/delay.h #include linux/spi/spi.h -#include linux/spi/mpc52xx_spi.h #include linux/of_spi.h #include linux/io.h #include linux/of_gpio.h @@ -54,7 +53,7 @@ MODULE_LICENSE(GPL); /* FSM state return values */ #define FSM_STOP 0 /* Nothing more for the state machine to */ /* do. If something interesting happens */ - /* then and IRQ will be received */ + /* then an IRQ will be received */ #define FSM_POLL 1 /* need to poll for completion, an IRQ is */ /* not expected */ #define FSM_CONTINUE 2 /* Keep iterating the state machine */ @@ -62,13 +61,12 @@ MODULE_LICENSE(GPL); /* Driver internal data */ struct mpc52xx_spi { struct spi_master *master; - u32 sysclk; void __iomem *regs; int irq0; /* MODF irq */ int irq1; /* SPIF irq */ - int ipb_freq; + unsigned int ipb_freq; - /* Statistics */ + /* Statistics; not used now, but will be reintroduced for debugfs */ int msg_count; int wcol_count; int wcol_ticks; @@ -229,7 +227,7 @@ static int mpc52xx_spi_fsmstate_transfer(int irq, struct mpc52xx_spi *ms, ms-wcol_tx_timestamp = get_tbl(); data = 0; if (ms-tx_buf) - data = *(ms-tx_buf-1); + data = *(ms-tx_buf - 1); out_8(ms-regs + SPI_DATA, data); /* try again */ return FSM_CONTINUE; } else if (status SPI_STATUS_MODF) { @@ -481,8 +479,9 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, gpio_direction_output(gpio_cs, 1); ms-gpio_cs[i] = gpio_cs; } - } else + } else { master-num_chipselect = 1; + } spin_lock_init(ms-lock); INIT_LIST_HEAD(ms-queue); @@ -490,9 +489,9 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, /* Decide if interrupts can be used */ if (ms-irq0 ms-irq1) { - rc = request_irq(ms-irq0, mpc52xx_spi_irq, IRQF_SAMPLE_RANDOM, + rc = request_irq(ms-irq0, mpc52xx_spi_irq, 0, mpc5200-spi-modf, ms); - rc |= request_irq(ms-irq1, mpc52xx_spi_irq, IRQF_SAMPLE_RANDOM, + rc |= request_irq(ms-irq1, mpc52xx_spi_irq, 0, mpc5200-spi-spiF, ms); The spiF here is probably also a typo. if (rc) { free_irq(ms-irq0, ms); @@ -524,8 +523,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, while (i-- 0) gpio_free(ms-gpio_cs[i]); - if (ms-gpio_cs != NULL) - kfree(ms-gpio_cs); + kfree(ms-gpio_cs); err_alloc: err_init: iounmap(regs); @@ -544,9 +542,7 @@ static int __devexit mpc52xx_spi_remove(struct of_device *op) for (i = 0; i ms-gpio_cs_count; i++) gpio_free(ms-gpio_cs[i]); - if (ms-gpio_cs != NULL) - kfree(ms-gpio_cs); - + kfree(ms-gpio_cs); spi_unregister_master(master); spi_master_put(master); iounmap(ms-regs); diff --git a/include/linux/spi/mpc52xx_spi.h b/include/linux/spi/mpc52xx_spi.h deleted file mode 100644 index d1004cf..000 --- a/include/linux/spi/mpc52xx_spi.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef INCLUDE_MPC5200_SPI_H -#define INCLUDE_MPC5200_SPI_H - -extern void mpc52xx_spi_set_premessage_hook(struct spi_master *master, - void (*hook)(struct spi_message *m, - void *context), - void *hook_context); - -#endif -- 1.6.3.3 cheers Luotao Fu -- Pengutronix e.K. | Dipl.-Ing. Luotao Fu| Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany
[V2] Patches for mpc52xx_spi
Hi Grand, here are the V2 of my patchset for mpc52xx_spi. Besides Wolframs suggestions I also added some more fixes. Details of changes can be checked in the patch header. Please do consider to apply the patches. The patch 1/2 e.g. fix bugs, which prevent the driver to work in some cases, as seen on my board. cheers Luotao Fu ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/3] [V2] mpc52xx_spi: add missing mode_bits definition
V2 changes: * remove CS_HIGH mode Signed-off-by: Luotao Fu l...@pengutronix.de Acked-by: Wolfram Sang w.s...@pengutronix.de --- drivers/spi/mpc52xx_spi.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index 2322250..64862cf 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c @@ -430,6 +430,8 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, master-num_chipselect = 1; master-setup = mpc52xx_spi_setup; master-transfer = mpc52xx_spi_transfer; + master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST; + dev_set_drvdata(op-dev, master); ms = spi_master_get_devdata(master); -- 1.6.5.2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/3] [V2] mpc52xx_spi: fix clearing status register
Before reading status register to check MODF failure, we have to clear it first since the MODF flag will be set after initializing the spi master, if the hardware comes up with a low SS. The processor datasheet reads: Mode Fault flag -- bit sets if SS input goes low while SPI is configured as a master. Flag is cleared automatically by an SPI status register read (with MODF set) followed by a SPI control register 1 write. Hence simply rereading the register is not sufficient to clear the flag. We redo the write also to make sure to clear the flag. V2 Changes: * change variable type from int to u8 Signed-off-by: Luotao Fu l...@pengutronix.de Acked-by: Wolfram Sang w.s...@pengutronix.de --- drivers/spi/mpc52xx_spi.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index ef8379b..2322250 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c @@ -391,6 +391,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, struct mpc52xx_spi *ms; void __iomem *regs; int rc; + u8 ctrl1; /* MMIO registers */ dev_dbg(op-dev, probing mpc5200 SPI device\n); @@ -399,7 +400,8 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, return -ENODEV; /* initialize the device */ - out_8(regs+SPI_CTRL1, SPI_CTRL1_SPIE | SPI_CTRL1_SPE | SPI_CTRL1_MSTR); + ctrl1 = SPI_CTRL1_SPIE | SPI_CTRL1_SPE | SPI_CTRL1_MSTR; + out_8(regs + SPI_CTRL1, ctrl1); out_8(regs + SPI_CTRL2, 0x0); out_8(regs + SPI_DATADIR, 0xe); /* Set output pins */ out_8(regs + SPI_PORTDATA, 0x8);/* Deassert /SS signal */ @@ -409,6 +411,8 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, * on the SPI bus. This fault will also occur if the SPI signals * are not connected to any pins (port_config setting) */ in_8(regs + SPI_STATUS); + out_8(regs + SPI_CTRL1, ctrl1); + in_8(regs + SPI_DATA); if (in_8(regs + SPI_STATUS) SPI_STATUS_MODF) { dev_err(op-dev, mode fault; is port_config correct?\n); -- 1.6.5.2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 3/3] [V2] mpc52xx_spi: add gpio chipselect
This one enables the mpc52xx_spi driver for usage of user defined gpio lines as chipselect. This way we can control some more spi devices than only one V2 Changes: * preinitialize the gpio as output in probe function and call gpio_set_value in the chip select function instead of calling direction_output every time. * initialize the gpio line with output high, since we don't support CS_HIGH in the driver currently any way. change gpio value setting to default active low in chip select call. * free the gpio array while error or removing. Signed-off-by: Luotao Fu l...@pengutronix.de --- drivers/spi/mpc52xx_spi.c | 64 ++--- 1 files changed, 60 insertions(+), 4 deletions(-) diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index 64862cf..97beba2 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c @@ -21,6 +21,7 @@ #include linux/spi/mpc52xx_spi.h #include linux/of_spi.h #include linux/io.h +#include linux/of_gpio.h #include asm/time.h #include asm/mpc52xx.h @@ -79,7 +80,6 @@ struct mpc52xx_spi { spinlock_t lock; struct work_struct work; - /* Details of current transfer (length, and buffer pointers) */ struct spi_message *message;/* current message */ struct spi_transfer *transfer; /* current transfer */ @@ -89,6 +89,8 @@ struct mpc52xx_spi { u8 *rx_buf; const u8 *tx_buf; int cs_change; + int gpio_cs_count; + unsigned int *gpio_cs; }; /* @@ -96,7 +98,13 @@ struct mpc52xx_spi { */ static void mpc52xx_spi_chipsel(struct mpc52xx_spi *ms, int value) { - out_8(ms-regs + SPI_PORTDATA, value ? 0 : 0x08); + int cs; + + if (ms-gpio_cs_count 0) { + cs = ms-message-spi-chip_select; + gpio_set_value(ms-gpio_cs[cs], value ? 0 : 1); + } else + out_8(ms-regs + SPI_PORTDATA, value ? 0 : 0x08); } /* @@ -390,8 +398,9 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, struct spi_master *master; struct mpc52xx_spi *ms; void __iomem *regs; - int rc; u8 ctrl1; + int rc, i = 0; + int gpio_cs; /* MMIO registers */ dev_dbg(op-dev, probing mpc5200 SPI device\n); @@ -426,8 +435,8 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, rc = -ENOMEM; goto err_alloc; } + master-bus_num = -1; - master-num_chipselect = 1; master-setup = mpc52xx_spi_setup; master-transfer = mpc52xx_spi_transfer; master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST; @@ -441,6 +450,40 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, ms-irq1 = irq_of_parse_and_map(op-node, 1); ms-state = mpc52xx_spi_fsmstate_idle; ms-ipb_freq = mpc5xxx_get_bus_frequency(op-node); + ms-gpio_cs_count = of_gpio_count(op-node); + if (ms-gpio_cs_count 0) { + master-num_chipselect = ms-gpio_cs_count; + ms-gpio_cs = kmalloc(ms-gpio_cs_count * sizeof(unsigned int), + GFP_KERNEL); + if (!ms-gpio_cs) { + rc = -ENOMEM; + goto err_alloc; + } + + for (i = 0; i ms-gpio_cs_count; i++) { + gpio_cs = of_get_gpio(op-node, i); + if (gpio_cs 0) { + dev_err(op-dev, + could not parse the gpio field + in oftree\n); + rc = -ENODEV; + goto err_gpio; + } + + rc = gpio_request(gpio_cs, dev_name(op-dev)); + if (rc) { + dev_err(op-dev, + can't request spi cs gpio #%d + on gpio line %d\n, i, gpio_cs); + goto err_gpio; + } + + gpio_direction_output(gpio_cs, 1); + ms-gpio_cs[i] = gpio_cs; + } + } else + master-num_chipselect = 1; + spin_lock_init(ms-lock); INIT_LIST_HEAD(ms-queue); INIT_WORK(ms-work, mpc52xx_spi_wq); @@ -477,6 +520,12 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, err_register: dev_err(ms-master-dev, initialization failed\n); spi_master_put(master); + err_gpio: + while (i-- 0) + gpio_free(ms-gpio_cs[i]); + + if (ms-gpio_cs != NULL) + kfree(ms-gpio_cs); err_alloc: err_init: iounmap(regs); @@ -487,10 +536,17 @@ static int __devexit mpc52xx_spi_remove(struct of_device *op) { struct spi_master *master = dev_get_drvdata(op-dev); struct mpc52xx_spi *ms
Patches for mpc52xx_spi
Hi Grant, here are several patches for the dedicated spi controller on mpc5200 SOC. The patchset contains two fixes and an enhancement. I noticed that your original V4 Patch is still pending for mainline. So I made the patches against the latest version in your -next tree. Tested on a mpc5200b machine with 7 spi devices, (cs lines are conntected to gpios) on 2.6.31, should work with latest kernel also. Please review. cheers Luotao Fu ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/3] mpc52xx_spi: add missing mode_bits definition
Signed-off-by: Luotao Fu l...@pengutronix.de --- drivers/spi/mpc52xx_spi.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index 5b036f2..79ba678 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c @@ -430,6 +430,8 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, master-num_chipselect = 1; master-setup = mpc52xx_spi_setup; master-transfer = mpc52xx_spi_transfer; + master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST; + dev_set_drvdata(op-dev, master); ms = spi_master_get_devdata(master); -- 1.6.5.2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/3] mpc52xx_spi: fix clearing status register
Before reading status register to check MODF failure, we have to clear it first since the MODF flag will be set after initializing the spi master, if the hardware comes up with a low SS. The processor datasheet reads: Mode Fault flag -- bit sets if SS input goes low while SPI is configured as a master. Flag is cleared automatically by an SPI status register read (with MODF set) followed by a SPI control register 1 write. Hence simply rereading the register is not sufficient to clear the flag. We redo the write also to make sure to clear the flag. Signed-off-by: Luotao Fu l...@pengutronix.de --- drivers/spi/mpc52xx_spi.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index ef8379b..5b036f2 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c @@ -391,6 +391,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, struct mpc52xx_spi *ms; void __iomem *regs; int rc; + int ctrl1; /* MMIO registers */ dev_dbg(op-dev, probing mpc5200 SPI device\n); @@ -399,7 +400,8 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, return -ENODEV; /* initialize the device */ - out_8(regs+SPI_CTRL1, SPI_CTRL1_SPIE | SPI_CTRL1_SPE | SPI_CTRL1_MSTR); + ctrl1 = SPI_CTRL1_SPIE | SPI_CTRL1_SPE | SPI_CTRL1_MSTR; + out_8(regs + SPI_CTRL1, ctrl1); out_8(regs + SPI_CTRL2, 0x0); out_8(regs + SPI_DATADIR, 0xe); /* Set output pins */ out_8(regs + SPI_PORTDATA, 0x8);/* Deassert /SS signal */ @@ -409,6 +411,8 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, * on the SPI bus. This fault will also occur if the SPI signals * are not connected to any pins (port_config setting) */ in_8(regs + SPI_STATUS); + out_8(regs + SPI_CTRL1, ctrl1); + in_8(regs + SPI_DATA); if (in_8(regs + SPI_STATUS) SPI_STATUS_MODF) { dev_err(op-dev, mode fault; is port_config correct?\n); -- 1.6.5.2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 3/3] mpc52xx_spi: add gpio chipselect
This one enables the mpc52xx_spi driver for usage of user defined gpio lines as chipselect. This way we can control some more spi devices than only one Signed-off-by: Luotao Fu l...@pengutronix.de --- drivers/spi/mpc52xx_spi.c | 57 +--- 1 files changed, 53 insertions(+), 4 deletions(-) diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index 79ba678..58c2ce5 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c @@ -21,6 +21,7 @@ #include linux/spi/mpc52xx_spi.h #include linux/of_spi.h #include linux/io.h +#include linux/of_gpio.h #include asm/time.h #include asm/mpc52xx.h @@ -79,7 +80,6 @@ struct mpc52xx_spi { spinlock_t lock; struct work_struct work; - /* Details of current transfer (length, and buffer pointers) */ struct spi_message *message;/* current message */ struct spi_transfer *transfer; /* current transfer */ @@ -89,6 +89,8 @@ struct mpc52xx_spi { u8 *rx_buf; const u8 *tx_buf; int cs_change; + int gpio_cs_count; + unsigned int *gpio_cs; }; /* @@ -96,7 +98,13 @@ struct mpc52xx_spi { */ static void mpc52xx_spi_chipsel(struct mpc52xx_spi *ms, int value) { - out_8(ms-regs + SPI_PORTDATA, value ? 0 : 0x08); + int cs; + + if (ms-gpio_cs_count 0) { + cs = ms-message-spi-chip_select; + gpio_direction_output(ms-gpio_cs[cs], value); + } else + out_8(ms-regs + SPI_PORTDATA, value ? 0 : 0x08); } /* @@ -390,8 +398,9 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, struct spi_master *master; struct mpc52xx_spi *ms; void __iomem *regs; - int rc; int ctrl1; + int rc, i = 0; + int gpio_cs; /* MMIO registers */ dev_dbg(op-dev, probing mpc5200 SPI device\n); @@ -426,8 +435,8 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, rc = -ENOMEM; goto err_alloc; } + master-bus_num = -1; - master-num_chipselect = 1; master-setup = mpc52xx_spi_setup; master-transfer = mpc52xx_spi_transfer; master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST; @@ -441,6 +450,39 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, ms-irq1 = irq_of_parse_and_map(op-node, 1); ms-state = mpc52xx_spi_fsmstate_idle; ms-ipb_freq = mpc5xxx_get_bus_frequency(op-node); + ms-gpio_cs_count = of_gpio_count(op-node); + if (ms-gpio_cs_count 0) { + master-num_chipselect = ms-gpio_cs_count; + ms-gpio_cs = kmalloc(ms-gpio_cs_count * sizeof(unsigned int), + GFP_KERNEL); + if (!ms-gpio_cs) { + rc = -ENOMEM; + goto err_alloc; + } + + for (i = 0; i ms-gpio_cs_count; i++) { + gpio_cs = of_get_gpio(op-node, i); + if (gpio_cs 0) { + dev_err(op-dev, + could not parse the gpio field + in oftree\n); + rc = -ENODEV; + goto err_alloc; + } + + ms-gpio_cs[i] = gpio_cs; + rc = gpio_request(ms-gpio_cs[i], dev_name(op-dev)); + if (rc) { + dev_err(op-dev, + can't request spi cs gpio #%d + on gpio line %d\n, + i, gpio_cs); + goto err_gpio; + } + } + } else + master-num_chipselect = 1; + spin_lock_init(ms-lock); INIT_LIST_HEAD(ms-queue); INIT_WORK(ms-work, mpc52xx_spi_wq); @@ -477,6 +519,9 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, err_register: dev_err(ms-master-dev, initialization failed\n); spi_master_put(master); + err_gpio: + while (i-- 0) + gpio_free(ms-gpio_cs[i]); err_alloc: err_init: iounmap(regs); @@ -487,10 +532,14 @@ static int __devexit mpc52xx_spi_remove(struct of_device *op) { struct spi_master *master = dev_get_drvdata(op-dev); struct mpc52xx_spi *ms = spi_master_get_devdata(master); + int i; free_irq(ms-irq0, ms); free_irq(ms-irq1, ms); + for (i = 0; i ms-gpio_cs_count; i++) + gpio_free(ms-gpio_cs[i]); + spi_unregister_master(master); spi_master_put(master); iounmap(ms-regs); -- 1.6.5.2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: Booting uncompressed kernel image
Matteo Fortini wrote: Hi all, I built an uncompressed uImage using mkimage --no-gzip -C none in the wrapper scripts. Only, u-boot recognizes it as uncompressed and launches the kernel properly (it's around 4MB), but in the end linux just prints OK and stops. Powerpc make compress the bin image with gzip first, before it generates the image header. If the u-boot reads the image header properly doesn't mean that the kernel is really unpacked. Has anyone done the same? me ;-) I did it with a mpc5200b board and linux 2.6.23. You can try the patch attached to this mail. It worked for me[TM]. ;-) Cheers Luotao Fu -- Pengutronix e.K. | Dipl.-Ing. Luotao Fu| Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | Subject: Create an uncomrpessed uImage From: Luotao Fu l...@pengutronix.de This one adds a make target to create an uncomrpessed uImage format for powerpc, which is usable by uboot. We call the target nuImage for now. We need this to verify if we can boost up the boot speed. Signed-off-by: Luotao Fu l...@pengutrnoix.de --- arch/powerpc/Makefile |2 +- arch/powerpc/boot/Makefile |3 +++ arch/powerpc/boot/wrapper | 15 ++- 3 files changed, 18 insertions(+), 2 deletions(-) Index: arch/powerpc/boot/wrapper === --- arch/powerpc/boot/wrapper.orig +++ arch/powerpc/boot/wrapper @@ -133,7 +133,7 @@ coff) platformo=$object/of.o lds=$object/zImage.coff.lds ;; -miboot|uboot) +miboot|uboot|decuboot) # miboot and U-boot want just the bare bits, not an ELF binary ext=bin objflags=-O binary @@ -190,6 +190,19 @@ uboot) fi exit 0 ;; +decuboot) +rm -f $ofile +vmz_uncomp=`basename $vmz $gzip` +gunzip -c $vmz $vmz_uncomp +mkimage -A ppc -O linux -T kernel -C none -a -e \ + $uboot_version -d $vmz_uncomp $ofile +rm $vmz_uncomp +vmz=$vmz$gzip +if [ -z $cacheit ]; then + rm -f $vmz +fi +exit 0 +;; esac addsec() { Index: arch/powerpc/boot/Makefile === --- arch/powerpc/boot/Makefile.orig +++ arch/powerpc/boot/Makefile @@ -195,6 +195,9 @@ $(obj)/zImage.initrd.ps3: vmlinux $(wra $(obj)/uImage: vmlinux $(wrapperbits) $(call if_changed,wrap,uboot) +$(obj)/nuImage: vmlinux $(wrapperbits) + $(call if_changed,wrap,decuboot) + $(obj)/cuImage.%: vmlinux $(dts) $(wrapperbits) $(call if_changed,wrap,cuboot-$*,$(dts)) Index: arch/powerpc/Makefile === --- arch/powerpc/Makefile.orig +++ arch/powerpc/Makefile @@ -148,7 +148,7 @@ all: $(KBUILD_IMAGE) CPPFLAGS_vmlinux.lds := -Upowerpc -BOOT_TARGETS = zImage zImage.initrd uImage +BOOT_TARGETS = zImage zImage.initrd uImage nuImage PHONY += $(BOOT_TARGETS) ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: i2c-mpc clocking scheme
Timur Tabi wrote: On Thu, Nov 27, 2008 at 9:00 AM, Andre Schwarz [EMAIL PROTECTED] wrote: All, is anybody working on some improvements regarding configurable I2C frequency inside the i2c-mpc driver ? If not - would anybody be intersted in getting this done, i.e. configurable via device tree ? Maybe I'm missing something, but U-Boot configures the I2C bus speed. i2c-mpc sets the bus clock in kernel with mpc_i2c_setclock. The bus speed in kernel is indepedent from u-boot. It does this because the algorithm is specific to the SOC itself. For example, the 8544 is different from the 8548. It would be a mess to duplicate this code in the kernel. I did try to write some mechanismen to make the i2c bus speed configurable for mpc5200. I found it quite hard to find some algorithm to calculate the right values in the Timing table of the I2C bus controller. Anyhow I gave it up after starring at the datasheet for some time. ;-) I can't speak for other platforms, which are supported by i2c-mpc. Anyway, I do think it might be interesting to have configurable i2c bus speed. cheers Luotao Fu -- Dipl.-Ing. Luotao Fu | Phone: +49-5121-206917-5004 Pengutronix - Linux Solutions for Science and Industry Entwicklungszentrum Nord http://www.pengutronix.de ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[spi][mpc52xx][PATCH] Fix mpc52xx_psc_spi master driver
Hi, this is a fix for full duplex transfer mode on the mpc52xx_psc_spi driver. Details see the patch header. Tested on a mpc5200b board. Cheers Luotao fu -- Dipl.-Ing. Luotao Fu | Phone: +49-5121-206917-3 Pengutronix - Linux Solutions for Science and Industry Entwicklungszentrum Nord http://www.pengutronix.de From: Luotao Fu [EMAIL PROTECTED] Subject: fix block transfer on mpc52xx psc spi The block transfer routine in the mpc52xx psc spi driver misinterpret the datasheet. According to the processor datasheet the chipselect is held as long as the EOF is not written. Theoretically block of any sizes can be transferd in this way. The old routine however writes an EOF after every word, which has the size of size_of_word. This makes the transfer slow. Also fixed some duplicate code. Signed-off-by: Luotao Fu [EMAIL PROTECTED] --- drivers/spi/mpc52xx_psc_spi.c | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) Index: drivers/spi/mpc52xx_psc_spi.c === --- a/drivers/spi/mpc52xx_psc_spi.c.orig +++ b/drivers/spi/mpc52xx_psc_spi.c @@ -146,7 +146,6 @@ static int mpc52xx_psc_spi_transfer_rxtx unsigned rfalarm; unsigned send_at_once = MPC52xx_PSC_BUFSIZE; unsigned recv_at_once; - unsigned bpw = mps-bits_per_word / 8; if (!t-tx_buf !t-rx_buf t-len) return -EINVAL; @@ -162,22 +161,15 @@ static int mpc52xx_psc_spi_transfer_rxtx } dev_dbg(spi-dev, send %d bytes...\n, send_at_once); - if (tx_buf) { - for (; send_at_once; sb++, send_at_once--) { -/* set EOF flag */ -if (mps-bits_per_word - (sb + 1) % bpw == 0) - out_8(psc-ircr2, 0x01); + for (; send_at_once; sb++, send_at_once--) { + /* set EOF flag before the last word is sent */ + if (send_at_once == 1) +out_8(psc-ircr2, 0x01); + + if (tx_buf) out_8(psc-mpc52xx_psc_buffer_8, tx_buf[sb]); - } - } else { - for (; send_at_once; sb++, send_at_once--) { -/* set EOF flag */ -if (mps-bits_per_word - ((sb + 1) % bpw) == 0) - out_8(psc-ircr2, 0x01); + else out_8(psc-mpc52xx_psc_buffer_8, 0); - } } signature.asc Description: Digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev