Re: [PATCH] pmac_zilog: Workaround problem due to interrupt on closed port
On Sunday 10 January 2010 21:51:42 Benjamin Herrenschmidt wrote: > It seems that in qemu, we can see an interrupt in R3 despite the > fact that it's masked in W1. The chip doesn't actually issue an > interrupt, but we can "see" it when taking an interrupt for the > other channel. This may be a qemu bug ... or not, so let's be > safe and avoid calling into the UART layer when that happens which > woulc cause a crash. > > Signed-off-by: Benjamin Herrenschmidt Acked-by: Rob Landley Tested it, and it worked for me. Thanks, Rob -- Latency is more important than throughput. It's that simple. - Linus Torvalds ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: PCI-PCI bridge scanning broken on 460EX
Hello Felix, I had a problem similar to this on the 440GX, the PCI code was not sending type 1 transactions when scanning behind bridges. Perhaps you could try this: Index: linux/arch/powerpc/sysdev/ppc4xx_pci.c === --- linux/arch/powerpc/sysdev/ppc4xx_pci.c (revision 26) +++ linux/arch/powerpc/sysdev/ppc4xx_pci.c (revision 27) @@ -569,7 +569,7 @@ hose->last_busno = bus_range ? bus_range[1] : 0xff; /* Setup config space */ - setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4, 0); + setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4, PPC_INDIRECT_TYPE_SET_CFG_TYPE); /* Disable all windows */ writel(0, reg + PCIX0_POM0SA); With kind regards / Met vriendelijke groet, Stef van Os Prodrive B.V. -Original Message- From: linuxppc-dev-bounces+stef.van.os=prodrive...@lists.ozlabs.org [mailto:linuxppc-dev-bounces+stef.van.os=prodrive...@lists.ozlabs.org] On Behalf Of Benjamin Herrenschmidt Sent: zondag 10 januari 2010 22:32 To: Felix Radensky Cc: linuxppc-...@ozlabs.org; Stefan Roese; Feng Kan Subject: Re: PCI-PCI bridge scanning broken on 460EX > OK, I'll try writing byte by byte. The funny thing is the u-boot also > writes the same value to PCI_PRIMARY_BUS register and it doesn't cause > reset. Maybe the bridge doesn't want to be programmed more than once on these registers ? In any case, that's very very fishy I wonder if the bridge is causing a PCI reset -upstream- (which would really be a weird thing to do) and the 460 is turning that into a system reset ? Check if there are ways to control how the 460 reacts to PCI resets... In any case, it looks like a fucked up bridge to me. I don't suppose you've seen anything in the bridge data sheet or errata sheet that could explain what it's doing ? Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev Disclaimer: The information contained in this email, including any attachments is confidential and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/3] ucc_geth: Fix empty TX queue processing
On Mon, Jan 11, 2010 at 11:47:37AM +0800, Wu Jiajun-B06378 wrote: > > 'bd == ugeth->txBd[txQ]' has two possible statuses: 1)full queue. > 2)empty queue. > Removing 'netif_queue_stopped() == 0' will make transmitting stopping > when the queue is full. > > I made a new patch for this oops. [...] > + if ((bd == ugeth->txBd[txQ]) && (skb == NULL)) > break; Hm. I wonder why do we need the 'bd == ugeth->txBd[txQ]' check at all? The null skb will cause a kernel oops anyway. I think the patch below should be sufficient for the fix. Can you try it? Or if you tell me how to reproduce the issue you observe, I can try it myself. Thanks a lot! diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 41ad2f3..a1a6d06 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -3279,13 +3279,12 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ) /* Handle the transmitted buffer and release */ /* the BD to be used with the current frame */ - if (bd == ugeth->txBd[txQ]) /* queue empty? */ + skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]; + if (!skb) break; dev->stats.tx_packets++; - skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]; - if (skb_queue_len(&ugeth->rx_recycle) < RX_BD_RING_LEN && skb_recycle_check(skb, ugeth->ug_info->uf_info.max_rx_buf_length + ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCHv2] spi_mpc8xxx: fix WARN_ON on remove after 4c1fba44296
On Thu, Jan 07, 2010 at 11:23:57AM +0100, Peter Korsgaard wrote: > Commit 4c1fba44296 (Add support for QE DMA mode and CPM1/CPM2 chips) > added unconditional calls to _cpm_init() / _cpm_free() from > probe()/remove(), but only checked if we're actually using CPM mode > in _init(), causing the WARN_ON in mpc8xxx_spi_free_dummy_rx() for !CPM. > > Fix it by adding the same check in _cpm_free() as well. > > Signed-off-by: Peter Korsgaard Acked-by: Anton Vorontsov Grant, can you please push it for 2.6.33? Thanks! > --- > drivers/spi/spi_mpc8xxx.c |3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > Changes since v1: > Fix return statement, mpc8xxx_spi_cpm_free() has void return type. > diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c > index 1fb2a6e..674e7a2 100644 > --- a/drivers/spi/spi_mpc8xxx.c > +++ b/drivers/spi/spi_mpc8xxx.c > @@ -946,6 +946,9 @@ static void mpc8xxx_spi_cpm_free(struct mpc8xxx_spi *mspi) > { > struct device *dev = mspi->dev; > > + if (!(mspi->flags & SPI_CPM_MODE)) > + return; > + > dma_unmap_single(dev, mspi->dma_dummy_rx, SPI_MRBLR, DMA_FROM_DEVICE); > dma_unmap_single(dev, mspi->dma_dummy_tx, PAGE_SIZE, DMA_TO_DEVICE); > cpm_muram_free(cpm_muram_offset(mspi->tx_bd)); > -- > 1.6.5 > -- Anton Vorontsov email: cbouatmai...@gmail.com irc://irc.freenode.net/bd2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: PCI-PCI bridge scanning broken on 460EX
Hi Stef, Stef van Os wrote: Hello Felix, I had a problem similar to this on the 440GX, the PCI code was not sending type 1 transactions when scanning behind bridges. Perhaps you could try this: Index: linux/arch/powerpc/sysdev/ppc4xx_pci.c === --- linux/arch/powerpc/sysdev/ppc4xx_pci.c (revision 26) +++ linux/arch/powerpc/sysdev/ppc4xx_pci.c (revision 27) @@ -569,7 +569,7 @@ hose->last_busno = bus_range ? bus_range[1] : 0xff; /* Setup config space */ - setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4, 0); + setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4, PPC_INDIRECT_TYPE_SET_CFG_TYPE); /* Disable all windows */ writel(0, reg + PCIX0_POM0SA); With kind regards / Met vriendelijke groet, Stef van Os Prodrive B.V. I think you patch is a valid one, and should be applied, but unfortunately it doesn't fix by problem. BTW, in u-boot transaction type bit is set correctly. Felix. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH 1/3] ucc_geth: Fix empty TX queue processing
Yes,'if (!skb)' is enough. You can reproduce transmitting stopping if you use 'if ((bd == ugeth->txBd[txQ])' and run ipforwarding with MTU=64 1Gbps 100%linerate. -Original Message- From: Anton Vorontsov [mailto:avoront...@ru.mvista.com] Sent: 2010年1月11日 18:53 To: Wu Jiajun-B06378 Cc: linuxppc-...@ozlabs.org; net...@vger.kernel.org; lsore...@csclub.uwaterloo.ca; da...@davemloft.net Subject: Re: [PATCH 1/3] ucc_geth: Fix empty TX queue processing On Mon, Jan 11, 2010 at 11:47:37AM +0800, Wu Jiajun-B06378 wrote: > > 'bd == ugeth->txBd[txQ]' has two possible statuses: 1)full queue. > 2)empty queue. > Removing 'netif_queue_stopped() == 0' will make transmitting stopping > when the queue is full. > > I made a new patch for this oops. [...] > + if ((bd == ugeth->txBd[txQ]) && (skb == NULL)) > break; Hm. I wonder why do we need the 'bd == ugeth->txBd[txQ]' check at all? The null skb will cause a kernel oops anyway. I think the patch below should be sufficient for the fix. Can you try it? Or if you tell me how to reproduce the issue you observe, I can try it myself. Thanks a lot! diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 41ad2f3..a1a6d06 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -3279,13 +3279,12 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ) /* Handle the transmitted buffer and release */ /* the BD to be used with the current frame */ - if (bd == ugeth->txBd[txQ]) /* queue empty? */ + skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]; + if (!skb) break; dev->stats.tx_packets++; - skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]; - if (skb_queue_len(&ugeth->rx_recycle) < RX_BD_RING_LEN && skb_recycle_check(skb, ugeth->ug_info->uf_info.max_rx_buf_length + ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 0/8] Update to GE powerpc/86xx based boards.
The following series implements some minor fixes and updates to the GE SBC310, SBC610 and PPC9A -- Martyn Welch MEng MPhil MIET (Principal Software Engineer) T:+44(0)1327322748 GE Fanuc Intelligent Platforms Ltd,|Registered in England and Wales Tove Valley Business Park, Towcester, |(3828642) at 100 Barbirolli Square, Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB VAT:GB 927559189 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/8] powerpc/86xx: Add MSI section to GE SBC310 DTS
Add the MSI section to the DTS file for the GE SBC310. Signed-off-by: Martyn Welch --- arch/powerpc/boot/dts/gef_sbc310.dts | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/boot/dts/gef_sbc310.dts b/arch/powerpc/boot/dts/gef_sbc310.dts index 820c2b3..8ea8d4a 100644 --- a/arch/powerpc/boot/dts/gef_sbc310.dts +++ b/arch/powerpc/boot/dts/gef_sbc310.dts @@ -338,6 +338,22 @@ device_type = "open-pic"; }; + m...@41600 { + compatible = "fsl,mpc8641-msi", "fsl,mpic-msi"; + reg = <0x41600 0x80>; + msi-available-ranges = <0 0x100>; + interrupts = < + 0xe0 0 + 0xe1 0 + 0xe2 0 + 0xe3 0 + 0xe4 0 + 0xe5 0 + 0xe6 0 + 0xe7 0>; + interrupt-parent = <&mpic>; + }; + global-utilit...@e { compatible = "fsl,mpc8641-guts"; reg = <0xe 0x1000>; -- Martyn Welch MEng MPhil MIET (Principal Software Engineer) T:+44(0)1327322748 GE Fanuc Intelligent Platforms Ltd,|Registered in England and Wales Tove Valley Business Park, Towcester, |(3828642) at 100 Barbirolli Square, Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB VAT:GB 927559189 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/8] powerpc/86xx: Fix GE SBC310 XMC site support
From: Malcolm Crossley Correction to interrupt map mask for GE SBC310 XMC site and addition of alias. Signed-off-by: Malcolm Crossley Signed-off-by: Martyn Welch --- arch/powerpc/boot/dts/gef_sbc310.dts |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/boot/dts/gef_sbc310.dts b/arch/powerpc/boot/dts/gef_sbc310.dts index 8ea8d4a..8e4efff 100644 --- a/arch/powerpc/boot/dts/gef_sbc310.dts +++ b/arch/powerpc/boot/dts/gef_sbc310.dts @@ -32,6 +32,7 @@ serial0 = &serial0; serial1 = &serial1; pci0 = &pci0; + pci1 = &pci1; }; cpus { @@ -374,7 +375,7 @@ clock-frequency = <>; interrupt-parent = <&mpic>; interrupts = <0x18 0x2>; - interrupt-map-mask = <0xf800 0x0 0x0 0x7>; + interrupt-map-mask = <0xff00 0x0 0x0 0x7>; interrupt-map = < 0x 0x0 0x0 0x1 &mpic 0x0 0x2 0x 0x0 0x0 0x2 &mpic 0x1 0x2 -- Martyn Welch MEng MPhil MIET (Principal Software Engineer) T:+44(0)1327322748 GE Fanuc Intelligent Platforms Ltd,|Registered in England and Wales Tove Valley Business Park, Towcester, |(3828642) at 100 Barbirolli Square, Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB VAT:GB 927559189 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 3/8] powerpc/86xx: Add MSI section to GE SBC610 DTS
From: Malcolm Crossley Add the MSI section to the DTS file for the GE SBC610. Signed-off-by: Malcolm Crossley Signed-off-by: Martyn Welch --- arch/powerpc/boot/dts/gef_sbc610.dts | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/boot/dts/gef_sbc610.dts b/arch/powerpc/boot/dts/gef_sbc610.dts index 30911ad..78c336f 100644 --- a/arch/powerpc/boot/dts/gef_sbc610.dts +++ b/arch/powerpc/boot/dts/gef_sbc610.dts @@ -305,6 +305,22 @@ device_type = "open-pic"; }; + m...@41600 { + compatible = "fsl,mpc8641-msi", "fsl,mpic-msi"; + reg = <0x41600 0x80>; + msi-available-ranges = <0 0x100>; + interrupts = < + 0xe0 0 + 0xe1 0 + 0xe2 0 + 0xe3 0 + 0xe4 0 + 0xe5 0 + 0xe6 0 + 0xe7 0>; + interrupt-parent = <&mpic>; + }; + global-utilit...@e { compatible = "fsl,mpc8641-guts"; reg = <0xe 0x1000>; -- Martyn Welch MEng MPhil MIET (Principal Software Engineer) T:+44(0)1327322748 GE Fanuc Intelligent Platforms Ltd,|Registered in England and Wales Tove Valley Business Park, Towcester, |(3828642) at 100 Barbirolli Square, Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB VAT:GB 927559189 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 4/8] powerpc: Basic flash support for GE SBC610
Support for the SBC610 VPX Single Board Computer from GE (PowerPC MPC8641D). This patch adds basic support for the on-board flash. Signed-off-by: Martyn Welch --- arch/powerpc/boot/dts/gef_sbc610.dts | 50 arch/powerpc/configs/86xx/gef_sbc610_defconfig | 23 +++ 2 files changed, 56 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/boot/dts/gef_sbc610.dts b/arch/powerpc/boot/dts/gef_sbc610.dts index 78c336f..bb70600 100644 --- a/arch/powerpc/boot/dts/gef_sbc610.dts +++ b/arch/powerpc/boot/dts/gef_sbc610.dts @@ -75,14 +75,48 @@ interrupts = <19 2>; interrupt-parent = <&mpic>; - ranges = <0 0 0xff00 0x0100 // 16MB Boot flash - 1 0 0xe800 0x0800 // Paged Flash 0 - 2 0 0xe000 0x0800 // Paged Flash 1 - 3 0 0xfc10 0x0002 // NVRAM - 4 0 0xfc00 0x8000 // FPGA - 5 0 0xfc008000 0x8000 // AFIX FPGA - 6 0 0xfd00 0x0080 // IO FPGA (8-bit) - 7 0 0xfd80 0x0080>; // IO FPGA (32-bit) + ranges = <0 0 0xff00 0x0100 // 16MB Boot flash + 1 0 0xe800 0x0800 // Paged Flash 0 + 2 0 0xe000 0x0800 // Paged Flash 1 + 3 0 0xfc10 0x0002 // NVRAM + 4 0 0xfc00 0x8000 // FPGA + 5 0 0xfc008000 0x8000 // AFIX FPGA + 6 0 0xfd00 0x0080 // IO FPGA (8-bit) + 7 0 0xfd80 0x0080>; // IO FPGA (32-bit) + + /* fl...@0,0 is a mirror of part of the memory in fl...@1,0 + fl...@0,0 { + compatible = "gef,sbc610-firmware-mirror", "cfi-flash"; + reg = <0x0 0x0 0x100>; + bank-width = <4>; + device-width = <2>; + #address-cells = <1>; + #size-cells = <1>; + partit...@0 { + label = "firmware"; + reg = <0x0 0x100>; + read-only; + }; + }; + */ + + fl...@1,0 { + compatible = "gef,sbc610-paged-flash", "cfi-flash"; + reg = <0x1 0x0 0x800>; + bank-width = <4>; + device-width = <2>; + #address-cells = <1>; + #size-cells = <1>; + partit...@0 { + label = "user"; + reg = <0x0 0x780>; + }; + partit...@780 { + label = "firmware"; + reg = <0x780 0x80>; + read-only; + }; + }; nv...@3,0 { device_type = "nvram"; diff --git a/arch/powerpc/configs/86xx/gef_sbc610_defconfig b/arch/powerpc/configs/86xx/gef_sbc610_defconfig index 1975d41..9284f04 100644 --- a/arch/powerpc/configs/86xx/gef_sbc610_defconfig +++ b/arch/powerpc/configs/86xx/gef_sbc610_defconfig @@ -623,7 +623,7 @@ CONFIG_MTD_CONCAT=y CONFIG_MTD_PARTITIONS=y # CONFIG_MTD_REDBOOT_PARTS is not set # CONFIG_MTD_CMDLINE_PARTS is not set -# CONFIG_MTD_OF_PARTS is not set +CONFIG_MTD_OF_PARTS=y # CONFIG_MTD_AR7_PARTS is not set # @@ -643,13 +643,9 @@ CONFIG_MTD_BLOCK=y # RAM/ROM/Flash chip drivers # CONFIG_MTD_CFI=y -# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_GEN_PROBE=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -# CONFIG_MTD_CFI_NOSWAP is not set -# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set -CONFIG_MTD_CFI_LE_BYTE_SWAP=y -# CONFIG_MTD_CFI_GEOMETRY is not set +# CONFIG_MTD_CFI_ADV_OPTIONS is not set CONFIG_MTD_MAP_BANK_WIDTH_1=y CONFIG_MTD_MAP_BANK_WIDTH_2=y CONFIG_MTD_MAP_BANK_WIDTH_4=y @@ -660,7 +656,6 @@ CONFIG_MTD_CFI_I1=y CONFIG_MTD_CFI_I2=y # CONFIG_MTD_CFI_I4 is not set # CONFIG_MTD_CFI_I8 is not set -# CONFIG_MTD_OTP is not set CONFIG_MTD_CFI_INTELEXT=y CONFIG_MTD_CFI_AMDSTD=y # CONFIG_MTD_CFI_STAA is not set @@ -1682,7 +1677,17 @@ CONFIG_MISC_FILESYSTEMS=y # CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_EFS_FS is not set -# CONFIG_JFFS2_FS is not set +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_FS_DEBUG=0 +CONFIG_JFFS2_FS_WRITEBUFFER=y +# CONFIG_JFFS2_FS_WBUF_VERIFY is not set +# CONFIG_JFFS2_SUMMARY is not set +# CONFIG_JFFS2_FS_XATTR is not set +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +CONFIG_JFFS2_ZLIB=y +# CONFIG_JFFS2_LZO is not set +CONFIG_JFFS2_RTIME=y +# CONFIG_
[PATCH 5/8] powerpc/86xx: Switch on highmem support on GE SBC610
Signed-off-by: Martyn Welch --- arch/powerpc/configs/86xx/gef_sbc610_defconfig |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/configs/86xx/gef_sbc610_defconfig b/arch/powerpc/configs/86xx/gef_sbc610_defconfig index 9284f04..4912602 100644 --- a/arch/powerpc/configs/86xx/gef_sbc610_defconfig +++ b/arch/powerpc/configs/86xx/gef_sbc610_defconfig @@ -234,7 +234,7 @@ CONFIG_MMIO_NVRAM=y # # Kernel options # -# CONFIG_HIGHMEM is not set +CONFIG_HIGHMEM=y CONFIG_TICK_ONESHOT=y # CONFIG_NO_HZ is not set CONFIG_HIGH_RES_TIMERS=y @@ -1832,6 +1832,7 @@ CONFIG_DEBUG_PREEMPT=y # CONFIG_DEBUG_SPINLOCK_SLEEP is not set # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_KOBJECT is not set +# CONFIG_DEBUG_HIGHMEM is not set # CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_DEBUG_INFO=y # CONFIG_DEBUG_VM is not set -- Martyn Welch MEng MPhil MIET (Principal Software Engineer) T:+44(0)1327322748 GE Fanuc Intelligent Platforms Ltd,|Registered in England and Wales Tove Valley Business Park, Towcester, |(3828642) at 100 Barbirolli Square, Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB VAT:GB 927559189 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 6/8] powerpc/86xx: Add MSI section to GE PPC9A DTS
From: Malcolm Crossley Add the MSI section to the DTS file for the GE PPC9A. Signed-off-by: Malcolm Crossley Signed-off-by: Martyn Welch --- arch/powerpc/boot/dts/gef_ppc9a.dts | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/boot/dts/gef_ppc9a.dts b/arch/powerpc/boot/dts/gef_ppc9a.dts index c86114e..977f260 100644 --- a/arch/powerpc/boot/dts/gef_ppc9a.dts +++ b/arch/powerpc/boot/dts/gef_ppc9a.dts @@ -341,6 +341,22 @@ device_type = "open-pic"; }; + m...@41600 { + compatible = "fsl,mpc8641-msi", "fsl,mpic-msi"; + reg = <0x41600 0x80>; + msi-available-ranges = <0 0x100>; + interrupts = < + 0xe0 0 + 0xe1 0 + 0xe2 0 + 0xe3 0 + 0xe4 0 + 0xe5 0 + 0xe6 0 + 0xe7 0>; + interrupt-parent = <&mpic>; + }; + global-utilit...@e { compatible = "fsl,mpc8641-guts"; reg = <0xe 0x1000>; -- Martyn Welch MEng MPhil MIET (Principal Software Engineer) T:+44(0)1327322748 GE Fanuc Intelligent Platforms Ltd,|Registered in England and Wales Tove Valley Business Park, Towcester, |(3828642) at 100 Barbirolli Square, Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB VAT:GB 927559189 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 7/8] powerpc/86xx: Enable VME driver on the GE PPC9A
Enable the VME driver (which is currently in staging) on the PPC9A Signed-off-by: Martyn Welch --- arch/powerpc/configs/86xx/gef_ppc9a_defconfig | 47 - 1 files changed, 46 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/configs/86xx/gef_ppc9a_defconfig b/arch/powerpc/configs/86xx/gef_ppc9a_defconfig index 6cd2cd6..1a37b69 100644 --- a/arch/powerpc/configs/86xx/gef_ppc9a_defconfig +++ b/arch/powerpc/configs/86xx/gef_ppc9a_defconfig @@ -1499,7 +1499,52 @@ CONFIG_RTC_DRV_RX8581=y # # TI VLYNQ # -# CONFIG_STAGING is not set +CONFIG_STAGING=y +# CONFIG_STAGING_EXCLUDE_BUILD is not set +# CONFIG_ET131X is not set +# CONFIG_ME4000 is not set +# CONFIG_MEILHAUS is not set +# CONFIG_USB_IP_COMMON is not set +# CONFIG_ECHO is not set +# CONFIG_COMEDI is not set +# CONFIG_ASUS_OLED is not set +# CONFIG_ALTERA_PCIE_CHDMA is not set +# CONFIG_INPUT_MIMIO is not set +# CONFIG_TRANZPORT is not set + +# +# Android +# +# CONFIG_ANDROID is not set +# CONFIG_DST is not set +# CONFIG_POHMELFS is not set +# CONFIG_B3DFG is not set +# CONFIG_IDE_PHISON is not set +# CONFIG_PLAN9AUTH is not set +# CONFIG_HECI is not set +# CONFIG_USB_CPC is not set + +# +# Qualcomm MSM Camera And Video +# + +# +# Camera Sensor Selection +# +# CONFIG_HYPERV_STORAGE is not set +# CONFIG_HYPERV_BLOCK is not set +# CONFIG_HYPERV_NET is not set +CONFIG_VME_BUS=y + +# +# VME Bridge Drivers +# +CONFIG_VME_TSI148=y + +# +# VME Device Drivers +# +# CONFIG_VME_USER is not set # # File systems -- Martyn Welch MEng MPhil MIET (Principal Software Engineer) T:+44(0)1327322748 GE Fanuc Intelligent Platforms Ltd,|Registered in England and Wales Tove Valley Business Park, Towcester, |(3828642) at 100 Barbirolli Square, Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB VAT:GB 927559189 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 8/8] powerpc/86xx: Enable VME driver on the GE SBC610
Enable the VME driver (which is currently in staging) on the SBC610. Signed-off-by: Martyn Welch --- arch/powerpc/configs/86xx/gef_sbc610_defconfig | 39 +++- 1 files changed, 38 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/configs/86xx/gef_sbc610_defconfig b/arch/powerpc/configs/86xx/gef_sbc610_defconfig index 4912602..37adfb6 100644 --- a/arch/powerpc/configs/86xx/gef_sbc610_defconfig +++ b/arch/powerpc/configs/86xx/gef_sbc610_defconfig @@ -1600,7 +1600,44 @@ CONFIG_RTC_DRV_RX8581=y # # TI VLYNQ # -# CONFIG_STAGING is not set +CONFIG_STAGING=y +# CONFIG_STAGING_EXCLUDE_BUILD is not set +# CONFIG_ET131X is not set +# CONFIG_ME4000 is not set +# CONFIG_MEILHAUS is not set +# CONFIG_USB_IP_COMMON is not set +# CONFIG_ECHO is not set +# CONFIG_COMEDI is not set +# CONFIG_ASUS_OLED is not set +# CONFIG_ALTERA_PCIE_CHDMA is not set +# CONFIG_INPUT_MIMIO is not set +# CONFIG_TRANZPORT is not set + +# +# Android +# +# CONFIG_ANDROID is not set +# CONFIG_DST is not set +# CONFIG_POHMELFS is not set +# CONFIG_B3DFG is not set +# CONFIG_IDE_PHISON is not set +# CONFIG_PLAN9AUTH is not set +# CONFIG_HECI is not set +# CONFIG_VT6655 is not set +# CONFIG_USB_CPC is not set +# CONFIG_RDC_17F3101X is not set +CONFIG_VME_BUS=y + +# +# VME Bridge Drivers +# +# CONFIG_VME_CA91CX42 is not set +CONFIG_VME_TSI148=y + +# +# VME Device Drivers +# +# CONFIG_VME_USER is not set # # File systems -- Martyn Welch MEng MPhil MIET (Principal Software Engineer) T:+44(0)1327322748 GE Fanuc Intelligent Platforms Ltd,|Registered in England and Wales Tove Valley Business Park, Towcester, |(3828642) at 100 Barbirolli Square, Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB VAT:GB 927559189 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH -tip tracing/kprobes v2] Powerpc port of the kprobe-based event tracer
This patch ports the kprobe-based event tracer to powerpc. This patch is based in x86 port. This brings powerpc on par with x86. ChangeLog - v2: - Removed regs_get_argument_nth() API as function argument access syntax is dropped from kprobe-tracer. Please refer to patches below on Linux PPC mailing list: http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-January/079331.html http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-January/079332.html - Rebased to commit f61d6b1dcb06d62bc20d40e51c7a1e80275a80ab of -tip This patch is dependent on following patch: http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-January/079331.html Port the following API's to ppc for accessing registers and stack entries from pt_regs. - regs_query_register_offset(const char *name) Query the offset of "name" register. - regs_query_register_name(unsigned int offset) Query the name of register by its offset. - regs_get_register(struct pt_regs *regs, unsigned int offset) Get the value of a register by its offset. - regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr) Check the address is in the kernel stack. - regs_get_kernel_stack_nth(struct pt_regs *reg, unsigned int nth) Get Nth entry of the kernel stack. (N >= 0) Signed-off-by: Mahesh Salgaonkar Acked-by: Masami Hiramatsu --- arch/powerpc/include/asm/ptrace.h | 61 ++ arch/powerpc/kernel/ptrace.c | 102 + kernel/trace/Kconfig |2 - 3 files changed, 164 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index cbd759e..cb2eeda 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h @@ -83,6 +83,7 @@ struct pt_regs { #define instruction_pointer(regs) ((regs)->nip) #define user_stack_pointer(regs) ((regs)->gpr[1]) +#define kernel_stack_pointer(regs) ((regs)->gpr[1]) #define regs_return_value(regs) ((regs)->gpr[3]) #ifdef CONFIG_SMP @@ -131,6 +132,66 @@ do { \ } while (0) #endif /* __powerpc64__ */ +/* Query offset/name of register from its name/offset */ +#include +#include +extern int regs_query_register_offset(const char *name); +extern const char *regs_query_register_name(unsigned int offset); +#define MAX_REG_OFFSET (offsetof(struct pt_regs, result)) + +/** + * regs_get_register() - get register value from its offset + * @regs: pt_regs from which register value is gotten + * @offset:offset number of the register. + * + * regs_get_register returns the value of a register whose offset from @regs. + * The @offset is the offset of the register in struct pt_regs. + * If @offset is bigger than MAX_REG_OFFSET, this returns 0. + */ +static inline unsigned long regs_get_register(struct pt_regs *regs, + unsigned int offset) +{ + if (unlikely(offset > MAX_REG_OFFSET)) + return 0; + return *(unsigned long *)((unsigned long)regs + offset); +} + +/** + * regs_within_kernel_stack() - check the address in the stack + * @regs: pt_regs which contains kernel stack pointer. + * @addr: address which is checked. + * + * regs_within_kernel_stack() checks @addr is within the kernel stack page(s). + * If @addr is within the kernel stack, it returns true. If not, returns false. + */ + +static inline bool regs_within_kernel_stack(struct pt_regs *regs, + unsigned long addr) +{ + return ((addr & ~(THREAD_SIZE - 1)) == + (kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1))); +} + +/** + * regs_get_kernel_stack_nth() - get Nth entry of the stack + * @regs: pt_regs which contains kernel stack pointer. + * @n: stack entry number. + * + * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which + * is specified by @regs. If the @n th entry is NOT in the kernel stack, + * this returns 0. + */ +static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, + unsigned int n) +{ + unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs); + addr += n; + if (regs_within_kernel_stack(regs, (unsigned long)addr)) + return *addr; + else + return 0; +} + /* * These are defined as per linux/ptrace.h, which see. */ diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index ef14988..e816aba 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -39,6 +39,108 @@ #include /* + * The parameter save area on the stack is used to store arguments being passed + * to callee function and is located at fixed offset from stack pointer. + */ +#ifdef CONFIG_PPC32 +#define PARAMETER_SAVE_AREA_OFFSET 24 /* bytes */ +#else /* CONFIG_PPC32 */ +#define PARAMETER
Re: fsldma: cleanup driver and fix async_tx compatibility
On Mon, Jan 11, 2010 at 11:17:04AM +0530, Dudhat Dipen-B09055 wrote: > > Hi Ira, > > I have tested your patches with async DMA memcpy support. Though I > haven't captured the improvement figures. > It works fine for RAID5 memcpy offload as interrupts are coming for > separate DMA channels while I have ran IOZONE onto RAID partition. > Excellent, thanks for running these tests. I'm glad to hear that the RAID offload is working now. You shouldn't notice any difference in performance. On a 32MB memcpy operation, broken into 32x 1MB memcpy(), 1x interrupt(), I noticed less than 0.1% difference (approx 100,000 ns / 0.1ms). This is probably at or near the limits of my measurement accuracy. Ira > Regards, > Dipen > > > -Original Message- > From: Dudhat Dipen-B09055 > Sent: Tuesday, January 05, 2010 11:38 AM > To: 'Ira W. Snyder'; dan.j.willi...@intel.com > Cc: ga...@kernel.crashing.org; herb...@gondor.apana.org.au; Tabi > Timur-B04825; linuxppc-...@ozlabs.org; Suresh Vishnu-B05022; Gupta > Maneesh-B18878; Li Yang-R58472 > Subject: RE: fsldma: cleanup driver and fix async_tx compatibility > > > Hi Ira, > > I will test it on 85xx hardware and let you know once done. > > Thanks > Dipen > > > -Original Message- > From: Ira W. Snyder [mailto:i...@ovro.caltech.edu] > Sent: Friday, January 01, 2010 11:41 AM > To: dan.j.willi...@intel.com > Cc: ga...@kernel.crashing.org; herb...@gondor.apana.org.au; Tabi > Timur-B04825; linuxppc-...@ozlabs.org; Suresh Vishnu-B05022; Dudhat > Dipen-B09055; Gupta Maneesh-B18878; Li Yang-R58472 > Subject: fsldma: cleanup driver and fix async_tx compatibility > > This patch series cleans up the Freescale DMAEngine driver, including > verifying the locking and making sure that all code paths are correct. > There were a few places that seemed suspicious, and they have been > fixed. > > I have written a quick memory->memory DMAEngine test driver, and the > performance is identical before and after my changes (<0.1% change). I > measured both setting up the DMA operation (via > device_prep_dma_interrupt() and device_prep_dma_memcpy()) and the actual > DMA transfer itself. > > As an added bonus, the interrupt load is measurably reduced. My test > driver transfers 32MB as 32x 1MB chunks + 1 interrupt descriptor, using > the functions noted above. Previous to this patch series, 31 interrupts > were generated. After this patch series, only a single interrupt is > generated for the whole transaction. > > Some testing on 85xx/86xx hardware would be appreciated. Also, some > testing by the users attempting to use async_tx and talitos to handle > RAID offload would be great as well. > > Documentation/powerpc/dts-bindings/fsl/dma.txt | 17 +- > drivers/dma/fsldma.c | 1036 > > drivers/dma/fsldma.h | 35 +- > 3 files changed, 556 insertions(+), 532 deletions(-) > > Thanks, > Ira > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: PCI-PCI bridge scanning broken on 460EX
Hi Stef Felix Radensky wrote: Hi Stef, Stef van Os wrote: Hello Felix, I had a problem similar to this on the 440GX, the PCI code was not sending type 1 transactions when scanning behind bridges. Perhaps you could try this: Index: linux/arch/powerpc/sysdev/ppc4xx_pci.c === --- linux/arch/powerpc/sysdev/ppc4xx_pci.c (revision 26) +++ linux/arch/powerpc/sysdev/ppc4xx_pci.c (revision 27) @@ -569,7 +569,7 @@ hose->last_busno = bus_range ? bus_range[1] : 0xff; /* Setup config space */ - setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4, 0); + setup_indirect_pci(hose, rsrc_cfg.start, rsrc_cfg.start + 0x4, PPC_INDIRECT_TYPE_SET_CFG_TYPE); /* Disable all windows */ writel(0, reg + PCIX0_POM0SA); With kind regards / Met vriendelijke groet, Stef van Os Prodrive B.V. I think you patch is a valid one, and should be applied, but unfortunately it doesn't fix by problem. BTW, in u-boot transaction type bit is set correctly. It seems I was wrong. I've manually applied the patch at the wrong place. After patching the correct function I'm not getting hard resets any more, which is a great improvement ! Thanks a lot, I really appreciate your help ! Unfortunately not all problems are gone. PLX is now identified correctly, but device behind it is not detected, although u-boot detects it correctly. See below. PCI: Probing PCI hardware pci_bus :00: scanning bus pci :00:02.0: found [3388:0020] class 000604 header type 01 pci :00:02.0: calling pcibios_fixup_resources+0x0/0xf4 pci :00:02.0: calling fixup_ppc4xx_pci_bridge+0x0/0x154 pci :00:02.0: calling quirk_resource_alignment+0x0/0x200 pci :00:02.0: supports D1 D2 pci :00:02.0: PME# supported from D0 D1 D2 D3hot pci :00:02.0: PME# disabled pci_bus :00: fixups for bus pci :00:02.0: scanning behind bridge, config 010100, pass 0 pci_bus :01: scanning bus pci :01:02.0: found [3388:0020] class 000604 header type 01 pci :01:02.0: calling pcibios_fixup_resources+0x0/0xf4 pci :01:02.0: calling fixup_ppc4xx_pci_bridge+0x0/0x154 pci :01:02.0: calling quirk_resource_alignment+0x0/0x200 pci :01:02.0: supports D1 D2 pci :01:02.0: PME# supported from D0 D1 D2 D3hot pci :01:02.0: PME# disabled pci_bus :01: fixups for bus pci :00:02.0: PCI bridge to [bus 01-01] pci :00:02.0: bridge window [mem 0x8000-0x8c0f] pci :01:02.0: scanning behind bridge, config 010100, pass 0 pci :01:02.0: bus configuration invalid, reconfiguring pci :01:02.0: scanning behind bridge, config 010100, pass 1 pci_bus :01: bus scan returning with max=01 pci :00:02.0: scanning behind bridge, config 010100, pass 1 pci_bus :00: bus scan returning with max=01 pci :00:02.0: disabling bridge window [mem 0xd8000-0xd8c0f] to [bus 01-01] (unused) pci :00:02.0: PCI bridge to [bus 01-01] pci :00:02.0: bridge window [io disabled] pci :00:02.0: bridge window [mem disabled] pci :00:02.0: bridge window [mem pref disabled] pci_bus :00: resource 0 [io 0x-0x] pci_bus :00: resource 1 [mem 0xd8000-0xd] pci_bus :01: resource 1 [??? 57982058496-58184433663 flags 0x0] Any ideas what could be wrong now ? Thanks a lot. Felix. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 01/13] powerpc/5200: LocalPlus driver: fix indentation and white space
Hi Roman. I'm finally getting some time to look at these with a bit more detail. On Mon, Dec 21, 2009 at 11:57 PM, Roman Fietze wrote: > > Signed-off-by: Roman Fietze > --- > arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 18 +- > 1 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > index 929d017..4c84aa5 100644 > --- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > +++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > @@ -165,7 +165,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > > bit_fields = req->cs << 24 | 0x08; > if (!write) > - bit_fields |= 0x01; /* read mode */ > + bit_fields |= 0x01; /* read mode */ > out_be32(lpbfifo.regs + LPBFIFO_REG_CONTROL, bit_fields); > > /* Kick it off */ > @@ -279,7 +279,7 @@ static irqreturn_t mpc52xx_lpbfifo_irq(int irq, void > *dev_id) > else > do_callback = 1; > > - out: > +out: The label 1 space indentation is intentional so coax diff into choosing the right line for the function name. There are plenty of examples of this in the kernel. The rest of the changes are valid, but unimportant. It's not worth the effort. In most cases I don't bother fixing whitespace unless they style violations are so gratuitous that it is hard to read the code otherwise, or if I'm already touching the offending line. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 02/13] powerpc/5200: LocalPlus driver: use SCLPC register structure
On Mon, Dec 21, 2009 at 11:59 PM, Roman Fietze wrote: No patch description? Very few patches are sufficiently described by the subject line alone. Tell me what the problem is, what the patch changes, and why. > Signed-off-by: Roman Fietze > --- > arch/powerpc/include/asm/mpc52xx.h | 24 > arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 79 > +++-- > 2 files changed, 59 insertions(+), 44 deletions(-) > > diff --git a/arch/powerpc/include/asm/mpc52xx.h > b/arch/powerpc/include/asm/mpc52xx.h > index b664ce7..57f8335 100644 > --- a/arch/powerpc/include/asm/mpc52xx.h > +++ b/arch/powerpc/include/asm/mpc52xx.h > @@ -193,6 +193,30 @@ struct mpc52xx_xlb { > #define MPC52xx_XLB_CFG_PLDIS (1 << 31) > #define MPC52xx_XLB_CFG_SNOOP (1 << 15) > > +/* SCLPC */ > +struct mpc52xx_sclpc { > + union { > + u8 restart; /* 0x00 restart bit */ > + u32 packet_size; /* 0x00 packet size register */ > + } packet_size; > + u32 start_address; /* 0x04 start Address register */ > + u32 control; /* 0x08 control register */ > + u32 enable; /* 0x0C enable register */ > + u32 unused0; /* 0x10 */ > + union { > + u8 status; /* 0x14 status register bits */ > + u32 bytes_done; /* 0x14 bytes done register bits, read only */ > + } bytes_done_status; > + > + u32 reserved1[(0x40-0x18) / sizeof(u32)]; /* 0x18 .. 0x3c */ > + > + u32 fifo_data; /* 0x40 FIFO data word register */ > + u32 fifo_status; /* 0x44 FIFO status register */ > + u8 fifo_control; /* 0x48 FIFO control register */ > + u8 reserved2[3]; > + u32 fifo_alarm; /* 0x4C FIFO alarm register */ > +}; Please don't. I know that a lot of other 5200 code uses register map structures in this way, but I consider it bad practice. I coded this driver without a structure for a reason. The reason I haven't removed the other 5200 register map structures is the code impact would be huge, it would probably cause breakage, and it would break all out-of-tree patches touching the same code for no measurable advantage. For this code, there is no advantage to changing the register access method, and it generates more work in other areas. Even if I preferred register map structures I would resist applying this patch. Please drop from your series. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 03/13] mpc52xx: add SCLPC register bit definitions
On Tue, Dec 22, 2009 at 12:00 AM, Roman Fietze wrote: > This should probably be merged with the first patch to actually use the bit definitions. More comments below. > Signed-off-by: Roman Fietze > --- > arch/powerpc/include/asm/mpc52xx.h | 40 +++ > 1 files changed, 31 insertions(+), 9 deletions(-) > > diff --git a/arch/powerpc/include/asm/mpc52xx.h > b/arch/powerpc/include/asm/mpc52xx.h > index 57f8335..c659d1d 100644 > --- a/arch/powerpc/include/asm/mpc52xx.h > +++ b/arch/powerpc/include/asm/mpc52xx.h > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #endif /* __ASSEMBLY__ */ > > #include > @@ -212,11 +213,34 @@ struct mpc52xx_sclpc { > > u32 fifo_data; /* 0x40 FIFO data word register */ > u32 fifo_status; /* 0x44 FIFO status register */ > - u8 fifo_control; /* 0x48 FIFO control register */ > - u8 reserved2[3]; > + u32 fifo_control; /* 0x48 FIFO control register */ > u32 fifo_alarm; /* 0x4C FIFO alarm register */ > }; > > +#define MPC52xx_SCLPC_FIFO_SIZE (0x200) /* > FIFO size 512 bytes */ > + > +#define MPC52xx_SCLPC_CONTROL_CS(cs) ((uint32_t)(cs) << 24) /* > CSX bits */ > +#define MPC52xx_SCLPC_CONTROL_FLUSH BIT(17) /* flush, > used in last packet */ > +#define MPC52xx_SCLPC_CONTROL_RWB_RECEIVE BIT(16) /* RWb bit, 1 > = receive */ > +#define MPC52xx_SCLPC_CONTROL_DAI BIT(8) > + > +#define MPC52xx_SCLPC_ENABLE_RC BIT(24) /* > reset controller bit */ > +#define MPC52xx_SCLPC_ENABLE_RF BIT(16) /* > reset FIFO bit */ > +#define MPC52xx_SCLPC_ENABLE_AIE BIT(9) /* abort > interrupt enable bit */ > +#define MPC52xx_SCLPC_ENABLE_NIE BIT(8) /* normal > interrupt enable bit */ > +#define MPC52xx_SCLPC_ENABLE_ME BIT(0) /* > master enable bit */ > + > +#define MPC52xx_SCLPC_PACKET_SIZE_RESTART BIT(24) > + > +#define MPC52xx_SCLPC_STATUS_AT BIT(28) /* > abort termination */ > +#define MPC52xx_SCLPC_STATUS_NT BIT(24) /* > normal termination */ > +#define MPC52xx_SCLPC_STATUS_BYTES_DONE_MASK (0x00FFU) /* bytes done > bit mask */ > + > +#define MPC52xx_SLPC_FIFO_STATUS_ERR BIT(22) /* error bit */ > + > +#define MPC52xx_SLPC_FIFO_CONTROL_GR(gr) ((gr) << 24) /* > granularity bits */ > + > + > /* Clock Distribution control */ > struct mpc52xx_cdm { > u32 jtag_id; /* CDM + 0x00 reg0 read only */ > @@ -304,19 +328,18 @@ extern void mpc52xx_restart(char *cmd); > struct mpc52xx_gpt_priv; > extern struct mpc52xx_gpt_priv *mpc52xx_gpt_from_irq(int irq); > extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 period, > - int continuous); > + int continuous); Unrelated whitespace change? > extern u64 mpc52xx_gpt_timer_period(struct mpc52xx_gpt_priv *gpt); > extern int mpc52xx_gpt_stop_timer(struct mpc52xx_gpt_priv *gpt); > > /* mpc52xx_lpbfifo.c */ > #define MPC52XX_LPBFIFO_FLAG_READ (0) > -#define MPC52XX_LPBFIFO_FLAG_WRITE (1<<0) > -#define MPC52XX_LPBFIFO_FLAG_NO_INCREMENT (1<<1) > -#define MPC52XX_LPBFIFO_FLAG_NO_DMA (1<<2) > -#define MPC52XX_LPBFIFO_FLAG_POLL_DMA (1<<3) > +#define MPC52XX_LPBFIFO_FLAG_WRITE BIT(0) > +#define MPC52XX_LPBFIFO_FLAG_NO_INCREMENT BIT(1) > +#define MPC52XX_LPBFIFO_FLAG_NO_DMA BIT(2) > +#define MPC52XX_LPBFIFO_FLAG_POLL_DMA BIT(3) I prefer the (1< > struct mpc52xx_lpbfifo_request { > - struct list_head list; Why is the list head being removed? g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 02/13] powerpc/5200: LocalPlus driver: use SCLPC register structure
Grant Likely wrote: Please don't. I know that a lot of other 5200 code uses register map structures in this way, but I consider it bad practice. I coded this driver without a structure for a reason. The reason I haven't removed the other 5200 register map structures is the code impact would be huge, it would probably cause breakage, and it would break all out-of-tree patches touching the same code for no measurable advantage. FWIW, over on the U-Boot side patches are getting NACKed by Wolfgang if they don't use register structures. :-P They're nice from a type-safety and namespacing perspective, though they get ugly pretty quickly if there are gaps. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 04/13] mpc52xx: LocalPlus driver: rewrite interrupt routines, fix errors
On Tue, Dec 22, 2009 at 12:01 AM, Roman Fietze wrote: > > Use SCLPC bit definitions from mpc52xx.h for better readability. The changes of is_write etc. are intermingled with the functional changes being made. The functional behaviour of this thing is subtle, and I'd prefer the stylistic stuff handled in a separate patch. > Rewrite IRQ handlers, make them work for DMA. Details please. As far as my testing goes, dma irqs are working fine. > Fix module unload error. ditto here. > > Signed-off-by: Roman Fietze > --- > arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 306 > - > 1 files changed, 149 insertions(+), 157 deletions(-) > > diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > index 2763d5e..2fd1f3f 100644 > --- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > +++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > @@ -46,6 +46,34 @@ struct mpc52xx_lpbfifo { > /* The MPC5200 has only one fifo, so only need one instance structure */ > static struct mpc52xx_lpbfifo lpbfifo; > > + > +/** > + * mpc52xx_lpbfifo_is_write - return true if it's a WRITE request > + */ > +static inline int mpc52xx_lpbfifo_is_write(int flags) > +{ > + return flags & MPC52XX_LPBFIFO_FLAG_WRITE; > +} > + > + > +/** > + * mpc52xx_lpbfifo_is_dma - return true if it's a DMA request > + */ > +static inline int mpc52xx_lpbfifo_is_dma(int flags) > +{ > + return !(flags & MPC52XX_LPBFIFO_FLAG_NO_DMA); > +} > + > + > +/** > + * mpc52xx_lpbfifo_is_poll_dma - return true if it's a polled DMA request > + */ > +static inline int mpc52xx_lpbfifo_is_poll_dma(int flags) > +{ > + return flags & MPC52XX_LPBFIFO_FLAG_POLL_DMA; > +} > + > + I'm not (yet) convinced that adding these is a benefit. > /** > * mpc52xx_lpbfifo_kick - Trigger the next block of data to be transfered > */ > @@ -57,16 +85,23 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > u32 *data; > int i; > int bit_fields; > - int dma = !(req->flags & MPC52XX_LPBFIFO_FLAG_NO_DMA); > - int write = req->flags & MPC52XX_LPBFIFO_FLAG_WRITE; > - int poll_dma = req->flags & MPC52XX_LPBFIFO_FLAG_POLL_DMA; > + int rflags = req->flags; > > /* Set and clear the reset bits; is good practice in User Manual */ > - out_be32(&lpbfifo.regs->enable, 0x0101); > + out_be32(&lpbfifo.regs->enable, MPC52xx_SCLPC_ENABLE_RC | > MPC52xx_SCLPC_ENABLE_RF); > + > + /* Set width, chip select and READ mode */ > + out_be32(&lpbfifo.regs->start_address, req->offset + req->pos); > + > + /* Set CS and BPT */ > + bit_fields = MPC52xx_SCLPC_CONTROL_CS(req->cs) | 0x8; > + if (!(mpc52xx_lpbfifo_is_write(rflags))) { > + bit_fields |= MPC52xx_SCLPC_CONTROL_RWB_RECEIVE; /* > read mode */ > + bit_fields |= MPC52xx_SCLPC_CONTROL_FLUSH; > + } > + out_be32(&lpbfifo.regs->control, bit_fields); > > - /* set master enable bit */ > - out_be32(&lpbfifo.regs->enable, 0x0001); My experimenting has found that clearing the reset bits and setting the master enable bit is needed before programming the FIFO. It looks to me like this patch drops the above line which does so. > - if (!dma) { > + if (!mpc52xx_lpbfifo_is_dma(rflags)) { > /* While the FIFO can be setup for transfer sizes as large as > * 16M-1, the FIFO itself is only 512 bytes deep and it does > * not generate interrupts for FIFO full events (only transfer > @@ -80,7 +115,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > transfer_size = 512; > > /* Load the FIFO with data */ > - if (write) { > + if (mpc52xx_lpbfifo_is_write(rflags)) { > reg = &lpbfifo.regs->fifo_data; > data = req->data + req->pos; > for (i = 0; i < transfer_size; i += 4) > @@ -88,7 +123,9 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > } > > /* Unmask both error and completion irqs */ > - out_be32(&lpbfifo.regs->enable, 0x0301); > + out_be32(&lpbfifo.regs->enable, (MPC52xx_SCLPC_ENABLE_AIE | > + MPC52xx_SCLPC_ENABLE_NIE | > + MPC52xx_SCLPC_ENABLE_ME)); > } else { > /* Choose the correct direction > * > @@ -97,16 +134,16 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > * there is a performance impacit. However, if it is wrong > there > * is a risk of DMA not transferring the last chunk of data > */ > - if (write) { > - out_be32(&lpbfifo.regs->fifo_alarm, 0x
Re: [PATCH 06/13] powerpc/5200: LocalPlus driver: map and unmap DMA areas
On Tue, Dec 22, 2009 at 12:04 AM, Roman Fietze wrote: > > Signed-off-by: Roman Fietze Yes, this is definitely needed. Please respin this patch and move it earlier in your series so I can apply it to mainline. More comments below. g. > --- > arch/powerpc/include/asm/mpc52xx.h | 2 +- > arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 26 +++- > 2 files changed, 21 insertions(+), 7 deletions(-) > > diff --git a/arch/powerpc/include/asm/mpc52xx.h > b/arch/powerpc/include/asm/mpc52xx.h > index c659d1d..043458e 100644 > --- a/arch/powerpc/include/asm/mpc52xx.h > +++ b/arch/powerpc/include/asm/mpc52xx.h > @@ -347,7 +347,7 @@ struct mpc52xx_lpbfifo_request { > > /* Memory address */ > void *data; > - phys_addr_t data_phys; > + dma_addr_t data_dma; > > /* Details of transfer */ > size_t size; > diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > index 1e4f725..8d8a63a 100644 > --- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > +++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -138,6 +139,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > out_be32(&lpbfifo.regs->fifo_alarm, > MPC52xx_SCLPC_FIFO_SIZE - 28); > out_be32(&lpbfifo.regs->fifo_control, > MPC52xx_SLPC_FIFO_CONTROL_GR(7)); > lpbfifo.bcom_cur_task = lpbfifo.bcom_tx_task; > + req->data_dma = dma_map_single(lpbfifo.dev, > req->data, req->size, DMA_TO_DEVICE); > } else { > out_be32(&lpbfifo.regs->fifo_alarm, > MPC52xx_SCLPC_FIFO_SIZE - 1); > out_be32(&lpbfifo.regs->fifo_control, > MPC52xx_SLPC_FIFO_CONTROL_GR(0)); > @@ -154,6 +156,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > lpbfifo.dma_irqs_enabled = 1; > } > } > + req->data_dma = dma_map_single(lpbfifo.dev, > req->data, req->size, DMA_FROM_DEVICE); > } Need to ensure the return value != NULL > > /* error irq & master enabled bit */ > @@ -161,7 +164,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > > bd = bcom_prepare_next_buffer(lpbfifo.bcom_cur_task); > bd->status = transfer_size; > - bd->data[0] = req->data_phys + req->pos; > + bd->data[0] = req->data_dma + req->pos; > bcom_submit_next_buffer(lpbfifo.bcom_cur_task, NULL); > } > > @@ -236,12 +239,13 @@ static irqreturn_t mpc52xx_lpbfifo_sclpc_irq(int irq, > void *dev_id) > } > > rflags = req->flags; > + status_count = in_be32(&lpbfifo.regs->bytes_done_status.bytes_done); > > - /* check normal termination bit */ > + /* Check normal termination bit */ > if (!(status_count & MPC52xx_SCLPC_STATUS_NT)) > goto out; > > - /* check abort bit */ > + /* Check abort bit */ unrelated changes > if (status_count & MPC52xx_SCLPC_STATUS_AT) { > out_be32(&lpbfifo.regs->enable, MPC52xx_SCLPC_ENABLE_RC | > MPC52xx_SCLPC_ENABLE_RF); > do_callback = 1; > @@ -250,7 +254,7 @@ static irqreturn_t mpc52xx_lpbfifo_sclpc_irq(int irq, > void *dev_id) > > if (!mpc52xx_lpbfifo_is_dma(rflags)) { > > - /* bytes done */ > + /* Bytes done */ ditto > status_count &= MPC52xx_SCLPC_STATUS_BYTES_DONE_MASK; > > if (!mpc52xx_lpbfifo_is_write(rflags)) { > @@ -336,6 +340,16 @@ static irqreturn_t mpc52xx_lpbfifo_bcom_irq(int irq, > void *dev_id) > bcom_retrieve_buffer(lpbfifo->bcom_cur_task, NULL, NULL); > // req->irq_ticks += get_tbl() - ts; > > + if (lpbfifo->req) { > + if (mpc52xx_lpbfifo_is_write(lpbfifo->req->flags)) > + dma_unmap_single(lpbfifo->dev, > lpbfifo->req->data_dma, lpbfifo->req->size, DMA_TO_DEVICE); > + else > + dma_unmap_single(lpbfifo->dev, > lpbfifo->req->data_dma, lpbfifo->req->size, DMA_FROM_DEVICE); > + } else > + { > + dev_err(lpbfifo->dev, "request is NULL\n"); > + } > + The ->req pointer was verified earlier in this function. It will never be null here. > spin_unlock_irqrestore(&lpbfifo->lock, flags); > > return IRQ_HANDLED; > @@ -439,7 +453,7 @@ mpc52xx_lpbfifo_probe(struct of_device *op, const struct > of_device_id *match) > goto err_irq; > > /* Request the Bestcomm receive (fifo --> memory) task and IRQ */ > - lpbfifo.bcom_rx_task = bcom_gen_bd_rx_init(16, > + lpbfifo.bcom_rx_task = bcom_gen_bd_
Re: [PATCH 02/13] powerpc/5200: LocalPlus driver: use SCLPC register structure
On Mon, Jan 11, 2010 at 12:42 PM, Scott Wood wrote: > Grant Likely wrote: >> >> Please don't. I know that a lot of other 5200 code uses register map >> structures in this way, but I consider it bad practice. I coded this >> driver without a structure for a reason. The reason I haven't removed >> the other 5200 register map structures is the code impact would be >> huge, it would probably cause breakage, and it would break all >> out-of-tree patches touching the same code for no measurable >> advantage. > > FWIW, over on the U-Boot side patches are getting NACKed by Wolfgang if they > don't use register structures. :-P > > They're nice from a type-safety and namespacing perspective, though they get > ugly pretty quickly if there are gaps. Regardless, I see no reason to change existing code in either direction. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 07/13] powerpc/5200: LocalPlus driver: reset BestComm when committing new request
On Tue, Dec 22, 2009 at 12:05 AM, Roman Fietze wrote: > Again, need a description as to 'why?' > Signed-off-by: Roman Fietze > --- > arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > index 8d8a63a..a7cd585 100644 > --- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > +++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > @@ -398,6 +398,8 @@ int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request > *req) > req->buffer_not_done_cnt = 0; > req->pos = 0; > > + bcom_gen_bd_rx_reset(lpbfifo.bcom_rx_task); > + bcom_gen_bd_tx_reset(lpbfifo.bcom_tx_task); > mpc52xx_lpbfifo_kick(req); > spin_unlock_irqrestore(&lpbfifo.lock, flags); > > @@ -456,7 +458,7 @@ mpc52xx_lpbfifo_probe(struct of_device *op, const struct > of_device_id *match) > lpbfifo.bcom_rx_task = bcom_gen_bd_rx_init(4, > res.start + offsetof(struct > mpc52xx_sclpc, fifo_data), > BCOM_INITIATOR_SCLPC, > BCOM_IPR_SCLPC, > - 16*1024*1024); > + 16 * 1024 * 1024); Unrelated change. Please drop. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 08/13] powerpc/5200: LocalPlus driver: smart flush of receive FIFO
On Tue, Dec 22, 2009 at 12:06 AM, Roman Fietze wrote: > Need patch description > Signed-off-by: Roman Fietze > --- > arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 40 > - > 1 files changed, 26 insertions(+), 14 deletions(-) > > diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > index a7cd585..48f2b4f 100644 > --- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > +++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > @@ -84,8 +84,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > struct bcom_bd *bd; > void __iomem *reg; > u32 *data; > - int i; > - int bit_fields; > + u32 bit_fields; > int rflags = req->flags; > > /* Set and clear the reset bits; is good practice in User Manual */ > @@ -96,27 +95,32 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > > /* Set CS and BPT */ > bit_fields = MPC52xx_SCLPC_CONTROL_CS(req->cs) | 0x8; > - if (!(mpc52xx_lpbfifo_is_write(rflags))) { > + if (!(mpc52xx_lpbfifo_is_write(rflags))) > bit_fields |= MPC52xx_SCLPC_CONTROL_RWB_RECEIVE; /* > read mode */ > - bit_fields |= MPC52xx_SCLPC_CONTROL_FLUSH; > - } > - out_be32(&lpbfifo.regs->control, bit_fields); Writing the control register is being deferred to later. I'm not convinced this is correct (see comment on previous patch). > > if (!mpc52xx_lpbfifo_is_dma(rflags)) { > - /* While the FIFO can be setup for transfer sizes as large as > - * 16M-1, the FIFO itself is only 512 bytes deep and it does > - * not generate interrupts for FIFO full events (only transfer > - * complete will raise an IRQ). Therefore when not using > - * Bestcomm to drive the FIFO it needs to either be polled, or > - * transfers need to constrained to the size of the fifo. > + /* While the FIFO can be setup for transfer sizes as > + * large as 16M-1, the FIFO itself is only 512 bytes > + * deep and it does not generate interrupts for FIFO > + * full events (only transfer complete will raise an > + * IRQ). Therefore when not using Bestcomm to drive the > + * FIFO it needs to either be polled, or transfers need > + * to constrained to the size of the fifo. Drop formatting changes or spilt to separate patch. > * > * This driver restricts the size of the transfer > + * > + * The last block of data will be received with the > + * flush bit set. This avoids stale read data. > */ > if (transfer_size > 512) > transfer_size = 512; > + else if (!(mpc52xx_lpbfifo_is_write(rflags))) > + bit_fields |= MPC52xx_SCLPC_CONTROL_FLUSH; > > /* Load the FIFO with data */ > if (mpc52xx_lpbfifo_is_write(rflags)) { > + size_t i; > + > reg = &lpbfifo.regs->fifo_data; > data = req->data + req->pos; > for (i = 0; i < transfer_size; i += 4) > @@ -128,6 +132,12 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > MPC52xx_SCLPC_ENABLE_NIE | > MPC52xx_SCLPC_ENABLE_ME)); > } else { > + > + /* In DMA mode we can always set the flush bit to avoid > + * stale read data. */ > + if (!(mpc52xx_lpbfifo_is_write(rflags))) > + bit_fields |= MPC52xx_SCLPC_CONTROL_FLUSH; > + > /* Choose the correct direction > * > * Configure the watermarks so DMA will always complete > correctly. > @@ -168,6 +178,8 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > bcom_submit_next_buffer(lpbfifo.bcom_cur_task, NULL); > } > > + out_be32(&lpbfifo.regs->control, bit_fields); > + > /* Set packet size and kick it off */ > out_be32(&lpbfifo.regs->packet_size.packet_size, > MPC52xx_SCLPC_PACKET_SIZE_RESTART | transfer_size); > if (mpc52xx_lpbfifo_is_dma(rflags)) > @@ -455,7 +467,7 @@ mpc52xx_lpbfifo_probe(struct of_device *op, const struct > of_device_id *match) > goto err_irq; > > /* Request the Bestcomm receive (fifo --> memory) task and IRQ */ > - lpbfifo.bcom_rx_task = bcom_gen_bd_rx_init(4, > + lpbfifo.bcom_rx_task = bcom_gen_bd_rx_init(2, unrelated change (and this line was also changed in an earlier patch) > res.start + offsetof(struct > mpc52xx_sclpc, fifo_
Sleep-capable GPIO slave-selects on MPC52xx?
Guys: A platform I have inherited utilizes a GPIO on an I2C expander chip (MAX7314) as a SPI slave-select. I'm using the actual MPC52xx SPI peripheral, not a PSC. It looks like the current version of the MPC52xx SPI driver won't work with sleep-capable GPIOs for slave-selects. In particular, it looks like mpc52xx_spi_fsmstate_transfer() is an interrupt handler that calls mpc52xx_spi_chipsel(), which itself calls gpio_set_value(). Or, at least my kernel thinks so, since I get a barrage of oops-type output screaming at me whenever I hit the SPI device. :) Am I missing something, or is this a known (or at least now-identified) limitation of the current mpc52xx_spi.c? Thanks! b.g. -- Bill Gatliff Embedded systems training and consulting http://billgatliff.com b...@billgatliff.com ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 09/13] powerpc/5200: LocalPlus driver: smarter calculation of BPT, bytes per transfer
On Tue, Dec 22, 2009 at 12:08 AM, Roman Fietze wrote: > > Signed-off-by: Roman Fietze > --- > arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 33 > +++-- > 1 files changed, 20 insertions(+), 13 deletions(-) > > diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > index 48f2b4f..21b2a40 100644 > --- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > +++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > @@ -80,11 +80,11 @@ static inline int mpc52xx_lpbfifo_is_poll_dma(int flags) > */ > static void mpc52xx_lpbfifo_kick(struct mpc52xx_lpbfifo_request *req) > { > - size_t transfer_size = req->size - req->pos; > + size_t tc = req->size - req->pos; > struct bcom_bd *bd; > void __iomem *reg; > u32 *data; > - u32 bit_fields; > + u32 control; Changing the name of these two variables makes it hard to review the functional change. A lot of unrelated housekeeping gets interwoven. > int rflags = req->flags; > > /* Set and clear the reset bits; is good practice in User Manual */ > @@ -93,10 +93,10 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > /* Set width, chip select and READ mode */ > out_be32(&lpbfifo.regs->start_address, req->offset + req->pos); > > - /* Set CS and BPT */ > - bit_fields = MPC52xx_SCLPC_CONTROL_CS(req->cs) | 0x8; > + /* Setup CS */ > + control = MPC52xx_SCLPC_CONTROL_CS(req->cs); > if (!(mpc52xx_lpbfifo_is_write(rflags))) > - bit_fields |= MPC52xx_SCLPC_CONTROL_RWB_RECEIVE; /* > read mode */ > + control |= MPC52xx_SCLPC_CONTROL_RWB_RECEIVE; /* read mode > */ > > if (!mpc52xx_lpbfifo_is_dma(rflags)) { > /* While the FIFO can be setup for transfer sizes as > @@ -112,10 +112,10 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > * The last block of data will be received with the > * flush bit set. This avoids stale read data. > */ > - if (transfer_size > 512) > - transfer_size = 512; > + if (tc > 512) > + tc = 512; > else if (!(mpc52xx_lpbfifo_is_write(rflags))) > - bit_fields |= MPC52xx_SCLPC_CONTROL_FLUSH; > + control |= MPC52xx_SCLPC_CONTROL_FLUSH; > > /* Load the FIFO with data */ > if (mpc52xx_lpbfifo_is_write(rflags)) { > @@ -123,7 +123,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > > reg = &lpbfifo.regs->fifo_data; > data = req->data + req->pos; > - for (i = 0; i < transfer_size; i += 4) > + for (i = 0; i < tc; i += 4) > out_be32(reg, *data++); > } > > @@ -136,7 +136,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > /* In DMA mode we can always set the flush bit to avoid > * stale read data. */ > if (!(mpc52xx_lpbfifo_is_write(rflags))) > - bit_fields |= MPC52xx_SCLPC_CONTROL_FLUSH; > + control |= MPC52xx_SCLPC_CONTROL_FLUSH; > > /* Choose the correct direction > * > @@ -173,15 +173,17 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > out_be32(&lpbfifo.regs->enable, MPC52xx_SCLPC_ENABLE_AIE | > MPC52xx_SCLPC_ENABLE_NIE | MPC52xx_SCLPC_ENABLE_ME); > > bd = bcom_prepare_next_buffer(lpbfifo.bcom_cur_task); > - bd->status = transfer_size; > + bd->status = tc; > bd->data[0] = req->data_dma + req->pos; > bcom_submit_next_buffer(lpbfifo.bcom_cur_task, NULL); > } > > - out_be32(&lpbfifo.regs->control, bit_fields); > + /* Setup BPT. tc is already screened and a multiple of 4 */ > + control |= tc & 7 ? 4 : 8; > + out_be32(&lpbfifo.regs->control, control); The calculation looks correct. However, why isn't the transfer size calculated up by the /* Setup CS and BPT */ comment? I don't think it needs to be down here. > > /* Set packet size and kick it off */ > - out_be32(&lpbfifo.regs->packet_size.packet_size, > MPC52xx_SCLPC_PACKET_SIZE_RESTART | transfer_size); > + out_be32(&lpbfifo.regs->packet_size.packet_size, > MPC52xx_SCLPC_PACKET_SIZE_RESTART | tc); > if (mpc52xx_lpbfifo_is_dma(rflags)) > bcom_enable(lpbfifo.bcom_cur_task); > } > @@ -395,6 +397,11 @@ int mpc52xx_lpbfifo_submit(struct > mpc52xx_lpbfifo_request *req) > if (!lpbfifo.regs) > return -ENODEV; > > + /* The gen bd BestComm task currently only allows an increment > + * of 4 */ > + if (!
Re: [PATCH 10/13] powerpc/5200: LocalPlus driver: fix problem caused by unpredictable IRQ order
On Tue, Dec 22, 2009 at 12:09 AM, Roman Fietze wrote: > > The order of the raised interrupts of SCLPC and BCOM cannot be > predicted, because it depends on the individual BCOM and CPU loads. So > in DMA mode we just wait for both until we finish the transaction. I'm really not convinced. It is true that the IRQ ordering may be different, but by definition the BCOM *must* be finished before the FIFO finishes on the TX path, and the FIFO definitely completes before the BCOM completes on the RX path, regardless of the order IRQs are actually processed. g. > > Signed-off-by: Roman Fietze > --- > arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 94 > + > 1 files changed, 64 insertions(+), 30 deletions(-) > > diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > index 21b2a40..cd8dc69 100644 > --- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > +++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > @@ -32,7 +32,7 @@ struct mpc52xx_lpbfifo { > struct device *dev; > phys_addr_t regs_phys; > struct mpc52xx_sclpc __iomem *regs; > - int irq; > + int sclpc_irq; > spinlock_t lock; > > struct bcom_task *bcom_tx_task; > @@ -41,6 +41,7 @@ struct mpc52xx_lpbfifo { > > /* Current state data */ > struct mpc52xx_lpbfifo_request *req; > + unsigned short irqs_pending; > int dma_irqs_enabled; > }; > > @@ -48,6 +49,14 @@ struct mpc52xx_lpbfifo { > static struct mpc52xx_lpbfifo lpbfifo; > > > +/* The order of the raised interrupts of SCLPC and BCOM cann not be > + * predicted, because it depends on the individual BCOM and CPU > + * loads. So in DMA mode we just wait for both until we finish the > + * transaction. */ > +#define MPC52XX_LPBFIFO_PENDING_SCLPC BIT(0) > +#define MPC52XX_LPBFIFO_PENDING_BCOM BIT(1) > + > + > /** > * mpc52xx_lpbfifo_is_write - return true if it's a WRITE request > */ > @@ -127,6 +136,8 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > out_be32(reg, *data++); > } > > + lpbfifo.irqs_pending = MPC52XX_LPBFIFO_PENDING_SCLPC; > + > /* Unmask both error and completion irqs */ > out_be32(&lpbfifo.regs->enable, (MPC52xx_SCLPC_ENABLE_AIE | > MPC52xx_SCLPC_ENABLE_NIE | > @@ -172,6 +183,8 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > /* error irq & master enabled bit */ > out_be32(&lpbfifo.regs->enable, MPC52xx_SCLPC_ENABLE_AIE | > MPC52xx_SCLPC_ENABLE_NIE | MPC52xx_SCLPC_ENABLE_ME); > > + lpbfifo.irqs_pending = MPC52XX_LPBFIFO_PENDING_BCOM | > MPC52XX_LPBFIFO_PENDING_SCLPC; > + > bd = bcom_prepare_next_buffer(lpbfifo.bcom_cur_task); > bd->status = tc; > bd->data[0] = req->data_dma + req->pos; > @@ -188,6 +201,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > bcom_enable(lpbfifo.bcom_cur_task); > } > > + > /** > * mpc52xx_lpbfifo_sclpc_irq - IRQ handler for LPB FIFO > * > @@ -232,8 +246,9 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > */ > static irqreturn_t mpc52xx_lpbfifo_sclpc_irq(int irq, void *dev_id) > { > + struct mpc52xx_lpbfifo *lpbfifo = dev_id; > struct mpc52xx_lpbfifo_request *req; > - u32 status_count = > in_be32(&lpbfifo.regs->bytes_done_status.bytes_done); > + u32 status_count = > in_be32(&lpbfifo->regs->bytes_done_status.bytes_done); > void __iomem *reg; > u32 *data; > size_t i; > @@ -242,18 +257,20 @@ static irqreturn_t mpc52xx_lpbfifo_sclpc_irq(int irq, > void *dev_id) > unsigned long flags; > int rflags; > > - spin_lock_irqsave(&lpbfifo.lock, flags); > + spin_lock_irqsave(&lpbfifo->lock, flags); > ts = get_tbl(); > > - req = lpbfifo.req; > + req = lpbfifo->req; > if (!req) { > - spin_unlock_irqrestore(&lpbfifo.lock, flags); > + spin_unlock_irqrestore(&lpbfifo->lock, flags); > pr_err("bogus SCLPC IRQ\n"); > return IRQ_HANDLED; > } > > + lpbfifo->irqs_pending &= ~MPC52XX_LPBFIFO_PENDING_SCLPC; > + > rflags = req->flags; > - status_count = in_be32(&lpbfifo.regs->bytes_done_status.bytes_done); > + status_count = in_be32(&lpbfifo->regs->bytes_done_status.bytes_done); > > /* Check normal termination bit */ > if (!(status_count & MPC52xx_SCLPC_STATUS_NT)) > @@ -261,19 +278,23 @@ static irqreturn_t mpc52xx_lpbfifo_sclpc_irq(int irq, > void *dev_id) > > /* Check abort bit */ > if (status_count & MPC52xx_SCLPC_STATUS_AT) { > - out_be32(&lpbfifo.regs->enable, MPC52xx_SCLPC_ENABLE_RC | > MPC52xx_SCLPC_ENABLE_RF); > + out_be32(&l
Re: [PATCH 11/13] powerpc/5200: LocalPlus driver: move RAM DMA address from request to driver
On Tue, Dec 22, 2009 at 12:10 AM, Roman Fietze wrote: > > Signed-off-by: Roman Fietze Please merge this change with the patch that adds the dma mapping g. > --- > arch/powerpc/include/asm/mpc52xx.h | 1 - > arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 13 +++-- > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/arch/powerpc/include/asm/mpc52xx.h > b/arch/powerpc/include/asm/mpc52xx.h > index 043458e..91c65d0 100644 > --- a/arch/powerpc/include/asm/mpc52xx.h > +++ b/arch/powerpc/include/asm/mpc52xx.h > @@ -347,7 +347,6 @@ struct mpc52xx_lpbfifo_request { > > /* Memory address */ > void *data; > - dma_addr_t data_dma; > > /* Details of transfer */ > size_t size; > diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > index cd8dc69..b2c92f5 100644 > --- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > +++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > @@ -41,6 +41,7 @@ struct mpc52xx_lpbfifo { > > /* Current state data */ > struct mpc52xx_lpbfifo_request *req; > + dma_addr_t data_dma; > unsigned short irqs_pending; > int dma_irqs_enabled; > }; > @@ -49,7 +50,7 @@ struct mpc52xx_lpbfifo { > static struct mpc52xx_lpbfifo lpbfifo; > > > -/* The order of the raised interrupts of SCLPC and BCOM cann not be > +/* The order of the raised interrupts of SCLPC and BCOM cannot be > * predicted, because it depends on the individual BCOM and CPU > * loads. So in DMA mode we just wait for both until we finish the > * transaction. */ > @@ -160,7 +161,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > out_be32(&lpbfifo.regs->fifo_alarm, > MPC52xx_SCLPC_FIFO_SIZE - 28); > out_be32(&lpbfifo.regs->fifo_control, > MPC52xx_SLPC_FIFO_CONTROL_GR(7)); > lpbfifo.bcom_cur_task = lpbfifo.bcom_tx_task; > - req->data_dma = dma_map_single(lpbfifo.dev, > req->data, req->size, DMA_TO_DEVICE); > + lpbfifo.data_dma = dma_map_single(lpbfifo.dev, > req->data, req->size, DMA_TO_DEVICE); > } else { > out_be32(&lpbfifo.regs->fifo_alarm, > MPC52xx_SCLPC_FIFO_SIZE - 1); > out_be32(&lpbfifo.regs->fifo_control, > MPC52xx_SLPC_FIFO_CONTROL_GR(0)); > @@ -177,7 +178,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > lpbfifo.dma_irqs_enabled = 1; > } > } > - req->data_dma = dma_map_single(lpbfifo.dev, > req->data, req->size, DMA_FROM_DEVICE); > + lpbfifo.data_dma = dma_map_single(lpbfifo.dev, > req->data, req->size, DMA_FROM_DEVICE); > } > > /* error irq & master enabled bit */ > @@ -187,7 +188,7 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > > bd = bcom_prepare_next_buffer(lpbfifo.bcom_cur_task); > bd->status = tc; > - bd->data[0] = req->data_dma + req->pos; > + bd->data[0] = lpbfifo.data_dma + req->pos; > bcom_submit_next_buffer(lpbfifo.bcom_cur_task, NULL); > } > > @@ -378,9 +379,9 @@ static irqreturn_t mpc52xx_lpbfifo_bcom_irq(int irq, void > *dev_id) > > if (req) { > if (mpc52xx_lpbfifo_is_write(lpbfifo->req->flags)) > - dma_unmap_single(lpbfifo->dev, > lpbfifo->req->data_dma, lpbfifo->req->size, DMA_TO_DEVICE); > + dma_unmap_single(lpbfifo->dev, > lpbfifo->data_dma, lpbfifo->req->size, DMA_TO_DEVICE); > else > - dma_unmap_single(lpbfifo->dev, > lpbfifo->req->data_dma, lpbfifo->req->size, DMA_FROM_DEVICE); > + dma_unmap_single(lpbfifo->dev, > lpbfifo->data_dma, lpbfifo->req->size, DMA_FROM_DEVICE); > > lpbfifo->req = NULL; > out_be32(&lpbfifo->regs->enable, > MPC52xx_SCLPC_ENABLE_RC | MPC52xx_SCLPC_ENABLE_RF); > -- > 1.6.5.5 > > > > -- > Roman Fietze Telemotive AG Büro Mühlhausen > Breitwiesen 73347 Mühlhausen > Tel.: +49(0)7335/18493-45 http://www.telemotive.de > ___ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev > -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 13/13] powerpc/5200: LocalPlus driver: clean up comments
On Tue, Dec 22, 2009 at 12:13 AM, Roman Fietze wrote: > > Signed-off-by: Roman Fietze If this description is no longer correct, then you must also add comments describing the new behaviour. Thanks for all the work on this. I hope I haven't been too brutal on my comments, but this device is subtle and the driver supports lots of different transfer modes so I'm being cautious. It will help if you can tighten up your patches to split apart unrelated changes and to write proper patch descriptions. I look forward to your respin. Cheers, g. > --- > arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 14 -- > 1 files changed, 0 insertions(+), 14 deletions(-) > > diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > index b2c92f5..a89072a 100644 > --- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > +++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c > @@ -206,17 +206,6 @@ static void mpc52xx_lpbfifo_kick(struct > mpc52xx_lpbfifo_request *req) > /** > * mpc52xx_lpbfifo_sclpc_irq - IRQ handler for LPB FIFO > * > - * On transmit, the dma completion irq triggers before the fifo > - * completion triggers. Handle the dma completion here instead of the > - * LPB FIFO Bestcomm task completion irq because everything is not > - * really done until the LPB FIFO completion irq triggers. > - * > - * In other words: > - * For DMA, on receive, the "Fat Lady" is the bestcom completion irq. on > - * transmit, the fifo completion irq is the "Fat Lady". The opera (or in > - * this case the DMA/FIFO operation) is not finished until the "Fat > - * Lady" sings. > - * > * Reasons for entering this routine: > * 1) PIO mode rx and tx completion irq > * 2) DMA interrupt mode tx completion irq > @@ -411,9 +400,6 @@ void mpc52xx_lpbfifo_poll(void) > { > struct mpc52xx_lpbfifo_request *req = lpbfifo.req; > > - /* > - * For more information, see comments on the "Fat Lady" > - */ > if (mpc52xx_lpbfifo_is_dma(req->flags) && (req->flags & > MPC52XX_LPBFIFO_FLAG_WRITE)) > mpc52xx_lpbfifo_sclpc_irq(0, NULL); > else > -- > 1.6.5.5 > > > > -- > Roman Fietze Telemotive AG Büro Mühlhausen > Breitwiesen 73347 Mühlhausen > Tel.: +49(0)7335/18493-45 http://www.telemotive.de > ___ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev > -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 02/13] powerpc/5200: LocalPlus driver: use SCLPC register structure
Dear Grant, In message you wrote: > > Please don't. I know that a lot of other 5200 code uses register map > structures in this way, but I consider it bad practice. I coded this May I ask _why_ you consider this bad practice? Is a structure not the most natural way to encode the specifics of a hardware interface (address offet, bus width, etc.) in C? What do you recommend instead? Using lists of register offsets (without any type information) as for example ARM is doing? > driver without a structure for a reason. The reason I haven't removed Could you please explain this reason? I'm trying to understand if this is a MPC52xx specific reasoning, or if you apply this to all of PowerPC, or generally to all kernel code? And: is this just your personal preferences, or generally agreed on? Thanks in advance, and sorry for asking stupid questions, but your reply surprised me... Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de Gods don't like people not doing much work. People who aren't busy all the time might start to _think_. - Terry Pratchett, _Small Gods_ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 03/13] mpc52xx: add SCLPC register bit definitions
Dear Grant Likely, In message you wrote: > > > /* mpc52xx_lpbfifo.c */ > > #define MPC52XX_LPBFIFO_FLAG_READ (0) > > -#define MPC52XX_LPBFIFO_FLAG_WRITE (1<<0) > > -#define MPC52XX_LPBFIFO_FLAG_NO_INCREMENT (1<<1) > > -#define MPC52XX_LPBFIFO_FLAG_NO_DMA(1<<2) > > -#define MPC52XX_LPBFIFO_FLAG_POLL_DMA (1<<3) > > +#define MPC52XX_LPBFIFO_FLAG_WRITE BIT(0) > > +#define MPC52XX_LPBFIFO_FLAG_NO_INCREMENT BIT(1) > > +#define MPC52XX_LPBFIFO_FLAG_NO_DMABIT(2) > > +#define MPC52XX_LPBFIFO_FLAG_POLL_DMA BIT(3) > > I prefer the (1
Re: PCI-PCI bridge scanning broken on 460EX
> It seems I was wrong. I've manually applied the patch at the wrong > place. After patching the correct function > I'm not getting hard resets any more, which is a great improvement ! > Thanks a lot, I really appreciate your help ! This is somewhat funny... I wonder how it would have managed to find anything behind the root complex P2P bridge with broken type 1 cycles... very very strange. > Unfortunately not all problems are gone. PLX is now identified > correctly, but device behind it is not detected, > although u-boot detects it correctly. See below. You have removed all your changes to that code right ? Also the log still looks weird: > pci :01:02.0: scanning behind bridge, config 010100, pass 0 > pci :01:02.0: bus configuration invalid, reconfiguring > pci :01:02.0: scanning behind bridge, config 010100, pass 1 > pci_bus :01: bus scan returning with max=01 > pci :00:02.0: scanning behind bridge, config 010100, pass 1 > pci_bus :00: bus scan returning with max=01 Unless you left some experimental changes in, the above isn't right, the "config" value should have changed due to the write of ~ff to it If the code running is indeed unmodified from upsteam, can you try with just that change: /* Check if setup is sensible at all */ -if (!pass && -((buses & 0xff) != bus->number || ((buses >> 8) & 0xff) <= bus->number)) { +if (((buses & 0xff) != bus->number || ((buses >> 8) & 0xff) <= bus->number)) { dev_dbg(&dev->dev, "bus configuration invalid, reconfiguring\n"); broken = 1; } (IE remove the check for !pass) Cheers, Ben. > pci :00:02.0: disabling bridge window [mem 0xd8000-0xd8c0f] > to [bus 01-01] (unused) > pci :00:02.0: PCI bridge to [bus 01-01] > pci :00:02.0: bridge window [io disabled] > pci :00:02.0: bridge window [mem disabled] > pci :00:02.0: bridge window [mem pref disabled] > pci_bus :00: resource 0 [io 0x-0x] > pci_bus :00: resource 1 [mem 0xd8000-0xd] > pci_bus :01: resource 1 [??? 57982058496-58184433663 flags 0x0] > > Any ideas what could be wrong now ? > > Thanks a lot. > > Felix. > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 02/13] powerpc/5200: LocalPlus driver: use SCLPC register structure
On Mon, Jan 11, 2010 at 1:43 PM, Wolfgang Denk wrote: > Dear Grant, > > In message you > wrote: >> >> Please don't. I know that a lot of other 5200 code uses register map >> structures in this way, but I consider it bad practice. I coded this > > May I ask _why_ you consider this bad practice? Many reasons. First off, while C structures somewhat represent the layout of a hardware register set, I still find them a poor fit. Registers do not data structures, and trying to describe them as such causes problems. Not all devices get mapped onto the bus in the same way. ie. a single device can get wired up with 8-bit wide addressing on one system and 32 wide on another. A struct cannot encode this. I also find I often need to access registers at "none-native" widths due to implementation details of the device which is made messy when the layout is encoded in a C struct. Finally, we're talking about a hardware interface here. Driver authors must understand exactly what they are doing when writing to registers and it is my opinion (though others may disagree with me) that using structs to describe register maps encourages a glosses over details that are best left explicit. I used to prefer C structs for register definitions, but my opinion changed as I gained more experience. > Is a structure not the most natural way to encode the specifics of a > hardware interface (address offet, bus width, etc.) in C? > > What do you recommend instead? Using lists of register offsets > (without any type information) as for example ARM is doing? Yes, that is what I prefer. That and, when needed, device-specific accessor functions that can be adapted for different bus attachements. >> driver without a structure for a reason. The reason I haven't removed > > Could you please explain this reason? As described above. > I'm trying to understand if this is a MPC52xx specific reasoning, or > if you apply this to all of PowerPC, or generally to all kernel code? I've stated what I prefer. I don't think I've rejected any code that uses structs over register offsets, but I do apply friction on any patch that changes a current driver from one to the other without need. > And: is this just your personal preferences, or generally agreed on? Others will need to answer that. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: PCI-PCI bridge scanning broken on 460EX
Hi, Ben Benjamin Herrenschmidt wrote: It seems I was wrong. I've manually applied the patch at the wrong place. After patching the correct function I'm not getting hard resets any more, which is a great improvement ! Thanks a lot, I really appreciate your help ! This is somewhat funny... I wonder how it would have managed to find anything behind the root complex P2P bridge with broken type 1 cycles... very very strange. Maybe because the bus behind root P2P bridge is bus 0, and type 1 cycles are needed for bus numbers greater than 0. That's what 460EX manual says. Unfortunately not all problems are gone. PLX is now identified correctly, but device behind it is not detected, although u-boot detects it correctly. See below. You have removed all your changes to that code right ? Yes, I've removed all experimental changes. Also the log still looks weird: pci :01:02.0: scanning behind bridge, config 010100, pass 0 pci :01:02.0: bus configuration invalid, reconfiguring pci :01:02.0: scanning behind bridge, config 010100, pass 1 pci_bus :01: bus scan returning with max=01 pci :00:02.0: scanning behind bridge, config 010100, pass 1 pci_bus :00: bus scan returning with max=01 Unless you left some experimental changes in, the above isn't right, the "config" value should have changed due to the write of ~ff to it You are correct, the log is from older version, without Stef's fix. I don't have access to a system with devices behind PLX, and the guy who did the testing used wrong kernel. I'll make sure he uses the correct one and get back to you. Maybe everything works after all :) I'm really sorry for confusion. Felix. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: PCI-PCI bridge scanning broken on 460EX
On Tue, 2010-01-12 at 00:48 +0200, Felix Radensky wrote: > > Maybe because the bus behind root P2P bridge is bus 0, and type 1 > cycles are > needed for bus numbers greater than 0. That's what 460EX manual says. Well, no... the bus behind the root P2P is bus 1 ... the root P2P itself is on bus 0... but then, it's some trick in the way they implemented it I suppose. > You are correct, the log is from older version, without Stef's fix. I > don't have access to a > system with devices behind PLX, and the guy who did the testing used > wrong kernel. > I'll make sure he uses the correct one and get back to you. Maybe > everything works after all :) > I'm really sorry for confusion. No worries :-) Feel free to send a proper patch to fix that problem upstream too ! Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] proc_devtree: fix THIS_MODULE without module.h
On Sat, Jan 9, 2010 at 4:01 AM, Alexey Dobriyan wrote: > On Thu, Jan 07, 2010 at 01:19:13PM +1100, Jeremy Kerr wrote: >> Commit e22f628395432b967f2f505858c64450f7835365 introduced a build >> breakage for ARM devtree work: the THIS_MODULE macro was added, but we >> don't have module.h >> >> This change adds the necessary #include to get THIS_MODULE defined. >> While we could just replace it with NULL (PROC_FS is a bool, not a >> tristate), using THIS_MODULE will prevent unexpected breakage if we >> ever do compile this as a module. > > I'd say, remove .owner line. > It definitely not needed in non-modular code. No. Jeremy's fix is the better one. Having the .owner line doesn't cost anything and it is better to have it populated; even if only as an example. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
linux-next: origin tree build failure
Hi all, Today's linux-next build (powerpc ppc64_defconfig) failed like this: cc1: error: include/linux/autoconf.h: No such file or directory (while building the boot wrappers - lots more of the same) Caused by commit ac4c2a3bbe5db5fc570b1d0ee1e474db7cb22585 ("zlib: optimize inffast when copying direct from output"). autoconf.h moved from include/linux to include/generated in commit 264a26838056fc2d759f58bec2e720e01fcb1bdb ("kbuild: move autoconf.h to include/generated") which was in linux-next since 14 Dec 2009 and in Linus' tree since 18 Dec 2009. I added the following patch for today: From: Stephen Rothwell Date: Tue, 12 Jan 2010 10:23:43 +1100 Subject: [PATCH] powerpc: fix boot Makefile for autoconf.h moving autoconf.h moved from include/linux to include/generated Signed-off-by: Stephen Rothwell --- arch/powerpc/boot/Makefile |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 826a30a..fb32a8e 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -34,7 +34,7 @@ BOOTCFLAGS+= -fno-stack-protector endif BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -BOOTCFLAGS += -include include/linux/autoconf.h -Iarch/powerpc/include +BOOTCFLAGS += -include include/generated/autoconf.h -Iarch/powerpc/include BOOTCFLAGS += -Iinclude DTS_FLAGS ?= -p 1024 -- 1.6.6 However, this then produced these errors: arch/powerpc/boot/inffast.c:7:27: error: asm/unaligned.h: No such file or directory arch/powerpc/boot/inffast.c:8:27: error: asm/byteorder.h: No such file or directory arch/powerpc/boot/inffast.c: In function 'inflate_fast': arch/powerpc/boot/inffast.c:263: warning: implicit declaration of function 'get_unaligned' arch/powerpc/boot/inffast.c:277:2: error: #error __BIG_ENDIAN nor __LITTLE_ENDIAN is defined So I just reverted the original commit (after removing my fix above). This latter build problem is probably only noticed if you build with a separate object directory (i.e. with O=.. on the make command). The previous PowerPC maintainer tells me that defining __KERNEL__ in the BOOTFLAGS is wrong and should have been noticed. -- Cheers, Stephen Rothwells...@canb.auug.org.au http://www.canb.auug.org.au/~sfr/ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: linux-next: origin tree build failure
Stephen Rothwell wrote on 12/01/2010 00:58:05: > > Hi all, > > Today's linux-next build (powerpc ppc64_defconfig) failed like this: > > cc1: error: include/linux/autoconf.h: No such file or directory > > (while building the boot wrappers - lots more of the same) > > Caused by commit ac4c2a3bbe5db5fc570b1d0ee1e474db7cb22585 ("zlib: > optimize inffast when copying direct from output"). autoconf.h moved > from include/linux to include/generated in commit > 264a26838056fc2d759f58bec2e720e01fcb1bdb ("kbuild: move autoconf.h to > include/generated") which was in linux-next since 14 Dec 2009 and in > Linus' tree since 18 Dec 2009. > > I added the following patch for today: > > From: Stephen Rothwell > Date: Tue, 12 Jan 2010 10:23:43 +1100 > Subject: [PATCH] powerpc: fix boot Makefile for autoconf.h moving > > autoconf.h moved from include/linux to include/generated > > Signed-off-by: Stephen Rothwell > --- > arch/powerpc/boot/Makefile |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile > index 826a30a..fb32a8e 100644 > --- a/arch/powerpc/boot/Makefile > +++ b/arch/powerpc/boot/Makefile > @@ -34,7 +34,7 @@ BOOTCFLAGS += -fno-stack-protector > endif > > BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) > -BOOTCFLAGS += -include include/linux/autoconf.h -Iarch/powerpc/include > +BOOTCFLAGS += -include include/generated/autoconf.h -Iarch/powerpc/include > BOOTCFLAGS += -Iinclude > > DTS_FLAGS ?= -p 1024 > -- > 1.6.6 > > However, this then produced these errors: > > arch/powerpc/boot/inffast.c:7:27: error: asm/unaligned.h: No such file or > directory > arch/powerpc/boot/inffast.c:8:27: error: asm/byteorder.h: No such file or > directory > arch/powerpc/boot/inffast.c: In function 'inflate_fast': > arch/powerpc/boot/inffast.c:263: warning: implicit declaration of function > 'get_unaligned' > arch/powerpc/boot/inffast.c:277:2: error: #error __BIG_ENDIAN nor > __LITTLE_ENDIAN is defined > > So I just reverted the original commit (after removing my fix above). > > This latter build problem is probably only noticed if you build with a > separate object directory (i.e. with O=.. on the make command). The > previous PowerPC maintainer tells me that defining __KERNEL__ in the > BOOTFLAGS is wrong and should have been noticed. I guess that the above problem will fixed by adding $(srctree): BOOTCFLAGS += -include include/generated/autoconf.h -I$(srctree)/arch/powerpc/include BOOTCFLAGS += -I$(srctree)/include But what to do with the __KERNEL__ define. If it isn't allowed I don't know what to do. Jocke ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 03/31] hvc_console: make the ops pointer const.
On Tue, 2009-12-22 at 20:04 +0530, Amit Shah wrote: > From: Rusty Russell > > This is nicer for modern R/O protection. And noone needs it non-const, so > constify the callers as well. Rusty, do you want me to take these via powerpc ? Cheers, Ben. > Signed-off-by: Rusty Russell > Signed-off-by: Amit Shah > To: Christian Borntraeger > Cc: linuxppc-...@ozlabs.org > --- > drivers/char/hvc_beat.c |2 +- > drivers/char/hvc_console.c|7 --- > drivers/char/hvc_console.h|7 --- > drivers/char/hvc_iseries.c|2 +- > drivers/char/hvc_iucv.c |2 +- > drivers/char/hvc_rtas.c |2 +- > drivers/char/hvc_udbg.c |2 +- > drivers/char/hvc_vio.c|2 +- > drivers/char/hvc_xen.c|2 +- > drivers/char/virtio_console.c |2 +- > 10 files changed, 16 insertions(+), 14 deletions(-) > > diff --git a/drivers/char/hvc_beat.c b/drivers/char/hvc_beat.c > index 0afc8b8..6913fc3 100644 > --- a/drivers/char/hvc_beat.c > +++ b/drivers/char/hvc_beat.c > @@ -84,7 +84,7 @@ static int hvc_beat_put_chars(uint32_t vtermno, const char > *buf, int cnt) > return cnt; > } > > -static struct hv_ops hvc_beat_get_put_ops = { > +static const struct hv_ops hvc_beat_get_put_ops = { > .get_chars = hvc_beat_get_chars, > .put_chars = hvc_beat_put_chars, > }; > diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c > index 416d342..d8dac58 100644 > --- a/drivers/char/hvc_console.c > +++ b/drivers/char/hvc_console.c > @@ -125,7 +125,7 @@ static struct hvc_struct *hvc_get_by_index(int index) > * console interfaces but can still be used as a tty device. This has to be > * static because kmalloc will not work during early console init. > */ > -static struct hv_ops *cons_ops[MAX_NR_HVC_CONSOLES]; > +static const struct hv_ops *cons_ops[MAX_NR_HVC_CONSOLES]; > static uint32_t vtermnos[MAX_NR_HVC_CONSOLES] = > {[0 ... MAX_NR_HVC_CONSOLES - 1] = -1}; > > @@ -247,7 +247,7 @@ static void destroy_hvc_struct(struct kref *kref) > * vty adapters do NOT get an hvc_instantiate() callback since they > * appear after early console init. > */ > -int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops) > +int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops) > { > struct hvc_struct *hp; > > @@ -749,7 +749,8 @@ static const struct tty_operations hvc_ops = { > }; > > struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int data, > - struct hv_ops *ops, int outbuf_size) > +const struct hv_ops *ops, > +int outbuf_size) > { > struct hvc_struct *hp; > int i; > diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h > index 10950ca..52ddf4d 100644 > --- a/drivers/char/hvc_console.h > +++ b/drivers/char/hvc_console.h > @@ -55,7 +55,7 @@ struct hvc_struct { > int outbuf_size; > int n_outbuf; > uint32_t vtermno; > - struct hv_ops *ops; > + const struct hv_ops *ops; > int irq_requested; > int data; > struct winsize ws; > @@ -76,11 +76,12 @@ struct hv_ops { > }; > > /* Register a vterm and a slot index for use as a console (console_init) */ > -extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops); > +extern int hvc_instantiate(uint32_t vtermno, int index, > +const struct hv_ops *ops); > > /* register a vterm for hvc tty operation (module_init or hotplug add) */ > extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int data, > - struct hv_ops *ops, int outbuf_size); > + const struct hv_ops *ops, int outbuf_size); > /* remove a vterm from hvc tty operation (module_exit or hotplug remove) */ > extern int hvc_remove(struct hvc_struct *hp); > > diff --git a/drivers/char/hvc_iseries.c b/drivers/char/hvc_iseries.c > index 936d05b..fd02426 100644 > --- a/drivers/char/hvc_iseries.c > +++ b/drivers/char/hvc_iseries.c > @@ -197,7 +197,7 @@ done: > return sent; > } > > -static struct hv_ops hvc_get_put_ops = { > +static const struct hv_ops hvc_get_put_ops = { > .get_chars = get_chars, > .put_chars = put_chars, > .notifier_add = notifier_add_irq, > diff --git a/drivers/char/hvc_iucv.c b/drivers/char/hvc_iucv.c > index fe62bd0..21681a8 100644 > --- a/drivers/char/hvc_iucv.c > +++ b/drivers/char/hvc_iucv.c > @@ -922,7 +922,7 @@ static int hvc_iucv_pm_restore_thaw(struct device *dev) > > > /* HVC operations */ > -static struct hv_ops hvc_iucv_ops = { > +static const struct hv_ops hvc_iucv_ops = { > .get_chars = hvc_iucv_get_chars, > .put_chars = hvc_iucv_put_chars, > .notifier_add = hvc_iucv_notifier_add, > diff --git a/drivers/char/hvc_rtas.c b/drivers/char/hvc_rtas.c > index 88590d0..61c4a61 100644 > --- a/drivers/char/hvc_rtas.c > +++ b/drivers/
Re: [PATCH] Make cpu hotplug driver lock part of ppc_md
> The intention of the cpu_hotplug_driver_locks to add additional serialization > during cpu hotplug operations. For pseries this is used during DLPAR of cpu > operations so that cpu hotplug actions cannot be initiated whiloe a DLPAR > operation is in flight. For example, during DLPAR add we take the lock while > acquiring the cpu from firmware and updating the device tree with the new > cpu information, after which we hotplug add the cpu to the system. > > There is nothing harmless about taking the lock on all platforms, I was just > trying to avoid taking the lock if the additional serialization is not needed. > > > > > If so, you could just make the mutex available to all powerpc code, and > > rename it, and then we wouldn't need all this jiggery pokery just to > > take & release a lock. > > I can make the lock available to all powerpc code and not go through the > ppc_md struct, it makes no difference to me personally. Of course this would > make all that fun pokery jiggery go away :) Yeah, Michael is right, just make it global to powerpc, it should make things simpler. Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH]: powerpc: Fix build breakage due to incorrect location of autoconf.h
commit ac4c2a3bbe5db5fc570b1d0ee1e474db7cb22585 (zlib: optimize inffast when copying direct from output) referenced include/linux/autoconf.h which is now called include/generated/autoconf.h. Signed-off-by: Anton Blanchard --- Index: linux-cpumask/arch/powerpc/boot/Makefile === --- linux-cpumask.orig/arch/powerpc/boot/Makefile 2010-01-12 13:15:26.266724762 +1100 +++ linux-cpumask/arch/powerpc/boot/Makefile2010-01-12 13:15:33.532974469 +1100 @@ -34,7 +34,7 @@ BOOTCFLAGS+= -fno-stack-protector endif BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -BOOTCFLAGS += -include include/linux/autoconf.h -Iarch/powerpc/include +BOOTCFLAGS += -include include/generated/autoconf.h -Iarch/powerpc/include BOOTCFLAGS += -Iinclude DTS_FLAGS ?= -p 1024 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
hibernation BookE patch
Hi Anton ! For some reason I can't find that patch in my mailbox (just saw it on patchwork :-) Here's a quick review. Looks good but two things: - Please make it swsusp_booke.c, 44x support is trivial and I don't want to rename the file :-) - Is there really an SDR1 register on FSL BookE ? It's supposed to be the pointer to the hash table on server ... - You probably should save/restore the TCR and ack pending crap DEC or FIT interrupts in the TSR right before you kick the decrementer - Nowadays, we still assume that the "loader" kernel is exactly the same as the "loaded" kernel on resume ? If not, you may need to save/restore IVORs, IVPR, ... Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] 8xx: fix user space TLB walk in dcbX fixup
On Fri, 2010-01-08 at 17:46 +0100, Joakim Tjernlund wrote: > The newly added fixup for buggy dcbX insn's has > a bug that always trigger a kernel TLB walk so a user space > dcbX insn will cause a Kernel Machine Check if it hits DTLB error. > > Signed-off-by: Joakim Tjernlund > --- > > I found this problem in 2.4 and forward ported it to 2.6. I > cannot test it so I cannot be 100% sure I got it right. > > arch/powerpc/kernel/head_8xx.S |4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) Do you have something to make sure that TASK_SIZE is never bigger than 2G ? Else userspace could be all the way to 0xbfff ... Cheers, Ben. > diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S > index ce327c5..91bef6e 100644 > --- a/arch/powerpc/kernel/head_8xx.S > +++ b/arch/powerpc/kernel/head_8xx.S > @@ -542,11 +542,11 @@ DARFixed:/* Return from dcbx instruction bug > workaround, r10 holds value of DAR > FixupDAR:/* Entry point for dcbx workaround. */ > /* fetch instruction from memory. */ > mfspr r10, SPRN_SRR0 > + andis. r11, r10, 0x8000/* Address >= 0x8000 */ > DO_8xx_CPU6(0x3780, r3) > mtspr SPRN_MD_EPN, r10 > mfspr r11, SPRN_M_TWB /* Get level 1 table entry address */ > - cmplwi cr0, r11, 0x0800 > - blt-3f /* Branch if user space */ > + beq-3f /* Branch if user space */ > lis r11, (swapper_pg_dir-PAGE_OFFSET)@h > ori r11, r11, (swapper_pg_dir-PAGE_OFFSET)@l > rlwimi r11, r10, 32-20, 0xffc /* r11 = r11&~0xffc|(r10>>20)&0xffc */ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH]: powerpc: Fix build breakage due to incorrect location of autoconf.h
Hi Anton, On Tue, 12 Jan 2010 13:21:51 +1100 Anton Blanchard wrote: > > commit ac4c2a3bbe5db5fc570b1d0ee1e474db7cb22585 (zlib: optimize inffast when > copying direct from output) referenced include/linux/autoconf.h which > is now called include/generated/autoconf.h. Even with this fix, you cannot build with a separate object directory. See my other posting "linux-next: origin tree build failure" ... -- Cheers, Stephen Rothwells...@canb.auug.org.au http://www.canb.auug.org.au/~sfr/ pgpS2xjFF3tze.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC,PATCH 2/7 v2] Generic support for fixed-rate clocks
Since most platforms will need a fixed-rate clock, add one. This will also serve as a basic example of an implementation of struct clk. Signed-off-by: Jeremy Kerr --- include/linux/clk.h | 12 kernel/Makefile |1 + kernel/clk.c| 25 + 3 files changed, 38 insertions(+) diff --git a/include/linux/clk.h b/include/linux/clk.h index 1a6199e..8293421 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -97,6 +97,18 @@ static inline struct clk *clk_get_parent(struct clk *clk) return ERR_PTR(-ENOSYS); } +/* Simple fixed-rate clock */ +struct clk_fixed { + struct clk clk; + unsigned long rate; +}; + +extern struct clk_operations clk_fixed_operations; + +#define DEFINE_CLK_FIXED(r) { \ + .clk = { .ops = &clk_fixed_operations }, \ + .rate = (r) \ +}; #else /* !CONFIG_USE_COMMON_STRUCT_CLK */ diff --git a/kernel/Makefile b/kernel/Makefile index 864ff75..f63d021 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -100,6 +100,7 @@ obj-$(CONFIG_SLOW_WORK_DEBUG) += slow-work-debugfs.o obj-$(CONFIG_PERF_EVENTS) += perf_event.o obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o obj-$(CONFIG_USER_RETURN_NOTIFIER) += user-return-notifier.o +obj-$(CONFIG_USE_COMMON_STRUCT_CLK) += clk.o ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y) # According to Alan Modra , the -fno-omit-frame-pointer is diff --git a/kernel/clk.c b/kernel/clk.c new file mode 100644 index 000..353736c --- /dev/null +++ b/kernel/clk.c @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2010 Canonical Ltd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Standard functionality for the common clock API. + */ + +#include +#include + +#define to_clk_fixed(clk) (container_of(clk, struct clk_fixed, clk)) + +static unsigned long clk_fixed_get_rate(struct clk *clk) +{ + return to_clk_fixed(clk)->rate; +} + +struct clk_operations clk_fixed_operations = { + .get_rate = clk_fixed_get_rate, +}; + +EXPORT_SYMBOL_GPL(clk_fixed_operations); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC,PATCH 7/7 v2] arm/icst307: remove icst307_ps_to_vco
icst307_ps_to_vco isn't used, so remove it. Signed-off-by: Jeremy Kerr --- arch/arm/common/icst307.c | 62 -- 1 file changed, 62 deletions(-) diff --git a/arch/arm/common/icst307.c b/arch/arm/common/icst307.c index cd45b88..9d8d087 100644 --- a/arch/arm/common/icst307.c +++ b/arch/arm/common/icst307.c @@ -96,68 +96,6 @@ icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq) return vco; } -static struct icst307_vco -icst307_ps_to_vco(const struct icst307_params *p, unsigned long period) -{ - struct icst307_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max }; - unsigned long f, ps; - unsigned int i = 0, rd, best = (unsigned int)-1; - - ps = 10UL / p->vco_max; - - /* -* First, find the PLL output divisor such -* that the PLL output is within spec. -*/ - do { - f = period / s2div[idx2s[i]]; - - /* -* f must be between 6MHz and 200MHz (3.3 or 5V) -*/ - if (f >= ps && f < 10UL / 6000 + 1) - break; - } while (i < ARRAY_SIZE(idx2s)); - - if (i >= ARRAY_SIZE(idx2s)) - return vco; - - vco.s = idx2s[i]; - - ps = 5UL / p->ref; - - /* -* Now find the closest divisor combination -* which gives a PLL output of 'f'. -*/ - for (rd = p->rd_min; rd <= p->rd_max; rd++) { - unsigned long f_in_div, f_pll; - unsigned int vd; - int f_diff; - - f_in_div = ps * rd; - - vd = (f_in_div + f / 2) / f; - if (vd < p->vd_min || vd > p->vd_max) - continue; - - f_pll = (f_in_div + vd / 2) / vd; - f_diff = f_pll - f; - if (f_diff < 0) - f_diff = -f_diff; - - if ((unsigned)f_diff < best) { - vco.v = vd - 8; - vco.r = rd - 2; - if (f_diff == 0) - break; - best = f_diff; - } - } - - return vco; -} - static unsigned long clk_icst307_get_rate(struct clk *clk) { return to_clk_icst307(clk)->rate; ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC,PATCH 4/7 v2] arm/versatile: remove oscoff from clk_versatile
We only use one value for oscoff, so remove it from the struct. Signed-off-by: Jeremy Kerr --- arch/arm/mach-versatile/clock.h |1 - arch/arm/mach-versatile/core.c |6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-versatile/clock.h b/arch/arm/mach-versatile/clock.h index d1c8791..6ac30c5 100644 --- a/arch/arm/mach-versatile/clock.h +++ b/arch/arm/mach-versatile/clock.h @@ -15,7 +15,6 @@ struct clk_versatile { struct clk clk; unsigned long rate; const struct icst307_params params; - u32 oscoff; void(*setvco)(struct clk_versatile *, struct icst307_vco); }; diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index b6964bc..2b670bb 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c @@ -384,13 +384,14 @@ static void versatile_oscvco_set(struct clk_versatile *clk, struct icst307_vco v { void __iomem *sys = __io_address(VERSATILE_SYS_BASE); void __iomem *sys_lock = sys + VERSATILE_SYS_LOCK_OFFSET; + void __iomem *sys_osc = sys + VERSATILE_SYS_OSCCLCD_OFFSET; u32 val; - val = readl(sys + clk->oscoff) & ~0x7; + val = readl(sys_osc) & ~0x7; val |= vco.v | (vco.r << 9) | (vco.s << 16); writel(0xa05f, sys_lock); - writel(val, sys + clk->oscoff); + writel(val, sys_osc); writel(0, sys_lock); } @@ -406,7 +407,6 @@ static struct clk_versatile osc4_clk = { .rd_min = 1 + 2, .rd_max = 127 + 2, }, - .oscoff = VERSATILE_SYS_OSCCLCD_OFFSET, .setvco = versatile_oscvco_set, }; ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC, PATCH 6/7 v2] arm/icst307: use common struct clk, unify realview and versatile clocks
Both the realview and versatile platforms use an icst307 clock, but have their own clock structures. This change introduces a struct icst307_clk, which is common between realview and versatile. This allows us to take out the platform-specific clock defintions. Tested on versatile, compiled only on realview. Signed-off-by: Jeremy Kerr --- arch/arm/common/Kconfig |1 arch/arm/common/icst307.c | 39 ++-- arch/arm/include/asm/hardware/icst307.h | 14 - arch/arm/mach-realview/Makefile |2 arch/arm/mach-realview/clock.c | 56 --- arch/arm/mach-realview/clock.h | 22 - arch/arm/mach-realview/core.c |7 +- arch/arm/mach-realview/realview_pba8.c |1 arch/arm/mach-versatile/Makefile|2 arch/arm/mach-versatile/clock.c | 58 arch/arm/mach-versatile/clock.h | 23 - arch/arm/mach-versatile/core.c |7 +- 12 files changed, 54 insertions(+), 178 deletions(-) diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index 4efbb9d..05e334c 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig @@ -17,6 +17,7 @@ config ICST525 config ICST307 bool + depends on USE_COMMON_STRUCT_CLK config SA bool diff --git a/arch/arm/common/icst307.c b/arch/arm/common/icst307.c index 6d094c1..cd45b88 100644 --- a/arch/arm/common/icst307.c +++ b/arch/arm/common/icst307.c @@ -19,6 +19,8 @@ #include +#define to_clk_icst307(clk) (container_of(clk, struct clk_icst307, clk)) + /* * Divisors for each OD setting. */ @@ -36,7 +38,7 @@ EXPORT_SYMBOL(icst307_khz); */ static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 }; -struct icst307_vco +static struct icst307_vco icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq) { struct icst307_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max }; @@ -94,9 +96,7 @@ icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq) return vco; } -EXPORT_SYMBOL(icst307_khz_to_vco); - -struct icst307_vco +static struct icst307_vco icst307_ps_to_vco(const struct icst307_params *p, unsigned long period) { struct icst307_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max }; @@ -158,4 +158,33 @@ icst307_ps_to_vco(const struct icst307_params *p, unsigned long period) return vco; } -EXPORT_SYMBOL(icst307_ps_to_vco); +static unsigned long clk_icst307_get_rate(struct clk *clk) +{ + return to_clk_icst307(clk)->rate; +} + +static long clk_icst307_round_rate(struct clk *clk, unsigned long rate) +{ + const struct icst307_params *params = &to_clk_icst307(clk)->params; + struct icst307_vco vco; + vco = icst307_khz_to_vco(params, rate / 1000); + return icst307_khz(params, vco) * 1000; +} + +static int clk_icst307_set_rate(struct clk *clk, unsigned long rate) +{ + struct clk_icst307 *v_clk = to_clk_icst307(clk); + struct icst307_vco vco; + + vco = icst307_khz_to_vco(&v_clk->params, rate / 1000); + v_clk->rate = icst307_khz(&v_clk->params, vco) * 1000; + v_clk->setvco(v_clk, vco); + + return 0; +} + +struct clk_operations clk_icst307_operations = { + .get_rate = clk_icst307_get_rate, + .round_rate = clk_icst307_round_rate, + .set_rate = clk_icst307_set_rate, +}; diff --git a/arch/arm/include/asm/hardware/icst307.h b/arch/arm/include/asm/hardware/icst307.h index 554f128..c7a3b83 100644 --- a/arch/arm/include/asm/hardware/icst307.h +++ b/arch/arm/include/asm/hardware/icst307.h @@ -16,6 +16,8 @@ #ifndef ASMARM_HARDWARE_ICST307_H #define ASMARM_HARDWARE_ICST307_H +#include + struct icst307_params { unsigned long ref; unsigned long vco_max;/* inclusive */ @@ -31,8 +33,14 @@ struct icst307_vco { unsigned char s; }; -unsigned long icst307_khz(const struct icst307_params *p, struct icst307_vco vco); -struct icst307_vco icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq); -struct icst307_vco icst307_ps_to_vco(const struct icst307_params *p, unsigned long period); +struct clk_icst307 { + struct clk clk; + unsigned long rate; + const struct icst307_params params; + void(*setvco)(struct clk_icst307 *, + struct icst307_vco); +}; + +extern struct clk_operations clk_icst307_operations; #endif diff --git a/arch/arm/mach-realview/Makefile b/arch/arm/mach-realview/Makefile index e704edb..a01b76b 100644 --- a/arch/arm/mach-realview/Makefile +++ b/arch/arm/mach-realview/Makefile @@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -obj-y := core.o clock.o +obj-y := core.o obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o obj-$(CO
[RFC,PATCH 5/7 v2] arm/realview: use generic struct clk
Use the common struct clk interface for the realview clocks. Compile tested only. Signed-off-by: Jeremy Kerr --- arch/arm/Kconfig |1 arch/arm/mach-realview/clock.c | 48 + arch/arm/mach-realview/clock.h | 17 ++- arch/arm/mach-realview/core.c | 46 +++ 4 files changed, 54 insertions(+), 58 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 34497ce..2ecef6b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -232,6 +232,7 @@ config ARCH_REALVIEW select ICST307 select GENERIC_TIME select GENERIC_CLOCKEVENTS + select USE_COMMON_STRUCT_CLK select ARCH_WANT_OPTIONAL_GPIOLIB help This enables support for ARM Ltd RealView boards. diff --git a/arch/arm/mach-realview/clock.c b/arch/arm/mach-realview/clock.c index a704311..472721c 100644 --- a/arch/arm/mach-realview/clock.c +++ b/arch/arm/mach-realview/clock.c @@ -22,43 +22,35 @@ #include "clock.h" -int clk_enable(struct clk *clk) -{ - return 0; -} -EXPORT_SYMBOL(clk_enable); +#define to_clk_realview(clk) (container_of(clk, struct clk_realview, clk)) -void clk_disable(struct clk *clk) +static unsigned long clk_realview_get_rate(struct clk *clk) { + return to_clk_realview(clk)->rate; } -EXPORT_SYMBOL(clk_disable); -unsigned long clk_get_rate(struct clk *clk) -{ - return clk->rate; -} -EXPORT_SYMBOL(clk_get_rate); - -long clk_round_rate(struct clk *clk, unsigned long rate) +static long clk_realview_round_rate(struct clk *clk, unsigned long rate) { + const struct icst307_params *params = &to_clk_realview(clk)->params; struct icst307_vco vco; - vco = icst307_khz_to_vco(clk->params, rate / 1000); - return icst307_khz(clk->params, vco) * 1000; + vco = icst307_khz_to_vco(params, rate / 1000); + return icst307_khz(params, vco) * 1000; } -EXPORT_SYMBOL(clk_round_rate); -int clk_set_rate(struct clk *clk, unsigned long rate) +static int clk_realview_set_rate(struct clk *clk, unsigned long rate) { - int ret = -EIO; + struct clk_realview *r_clk = to_clk_realview(clk); + struct icst307_vco vco; - if (clk->setvco) { - struct icst307_vco vco; + vco = icst307_khz_to_vco(&r_clk->params, rate / 1000); + r_clk->rate = icst307_khz(&r_clk->params, vco) * 1000; + r_clk->setvco(r_clk, vco); - vco = icst307_khz_to_vco(clk->params, rate / 1000); - clk->rate = icst307_khz(clk->params, vco) * 1000; - clk->setvco(clk, vco); - ret = 0; - } - return ret; + return 0; } -EXPORT_SYMBOL(clk_set_rate); + +struct clk_operations clk_realview_operations = { + .get_rate = clk_realview_get_rate, + .round_rate = clk_realview_round_rate, + .set_rate = clk_realview_set_rate, +}; diff --git a/arch/arm/mach-realview/clock.h b/arch/arm/mach-realview/clock.h index ebbb0f0..639a381 100644 --- a/arch/arm/mach-realview/clock.h +++ b/arch/arm/mach-realview/clock.h @@ -8,12 +8,15 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -struct module; -struct icst307_params; -struct clk { - unsigned long rate; - const struct icst307_params *params; - void*data; - void(*setvco)(struct clk *, struct icst307_vco vco); +#include + +struct clk_realview { + struct clk clk; + unsigned long rate; + const struct icst307_params params; + void(*setvco)(struct clk_realview *, + struct icst307_vco); }; + +extern struct clk_operations clk_realview_operations; diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 9f29343..8102c75 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c @@ -273,16 +273,8 @@ struct mmci_platform_data realview_mmc1_plat_data = { /* * Clock handling */ -static const struct icst307_params realview_oscvco_params = { - .ref= 24000, - .vco_max= 20, - .vd_min = 4 + 8, - .vd_max = 511 + 8, - .rd_min = 1 + 2, - .rd_max = 127 + 2, -}; -static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco) +static void realview_oscvco_set(struct clk_realview *clk, struct icst307_vco vco) { void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET; void __iomem *sys_osc; @@ -301,46 +293,54 @@ static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco) writel(0, sys_lock); } -static struct clk oscvco_clk = { - .params = &realview_oscvco_params, +static struct clk_realview oscvco_clk = { + .clk = { +
[RFC,PATCH 3/7 v2] arm/versatile: use generic struct clk
Use the common struct clk interface for the versatile clocks. Signed-off-by: Jeremy Kerr --- arch/arm/Kconfig|1 arch/arm/common/clkdev.c|2 + arch/arm/mach-versatile/clock.c | 51 +--- arch/arm/mach-versatile/clock.h | 20 +++- arch/arm/mach-versatile/core.c | 50 +++ 5 files changed, 62 insertions(+), 62 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 233a222..34497ce 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -245,6 +245,7 @@ config ARCH_VERSATILE select ICST307 select GENERIC_TIME select GENERIC_CLOCKEVENTS + select USE_COMMON_STRUCT_CLK select ARCH_WANT_OPTIONAL_GPIOLIB help This enables support for ARM Ltd Versatile board. diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c index aae5bc0..71e7596 100644 --- a/arch/arm/common/clkdev.c +++ b/arch/arm/common/clkdev.c @@ -85,11 +85,13 @@ struct clk *clk_get(struct device *dev, const char *con_id) } EXPORT_SYMBOL(clk_get); +#ifndef CONFIG_USE_COMMON_STRUCT_CLK void clk_put(struct clk *clk) { __clk_put(clk); } EXPORT_SYMBOL(clk_put); +#endif /* CONFIG_USE_COMMON_STRUCT_CLK */ void clkdev_add(struct clk_lookup *cl) { diff --git a/arch/arm/mach-versatile/clock.c b/arch/arm/mach-versatile/clock.c index c50a44e..16ab90b 100644 --- a/arch/arm/mach-versatile/clock.c +++ b/arch/arm/mach-versatile/clock.c @@ -17,49 +17,42 @@ #include #include #include +#include -#include #include #include "clock.h" -int clk_enable(struct clk *clk) -{ - return 0; -} -EXPORT_SYMBOL(clk_enable); +#define to_clk_versatile(clk) (container_of(clk, struct clk_versatile, clk)) -void clk_disable(struct clk *clk) +static unsigned long clk_versatile_get_rate(struct clk *clk) { + return to_clk_versatile(clk)->rate; } -EXPORT_SYMBOL(clk_disable); -unsigned long clk_get_rate(struct clk *clk) -{ - return clk->rate; -} -EXPORT_SYMBOL(clk_get_rate); - -long clk_round_rate(struct clk *clk, unsigned long rate) +static long clk_versatile_round_rate(struct clk *clk, unsigned long rate) { + const struct icst307_params *params = &to_clk_versatile(clk)->params; struct icst307_vco vco; - vco = icst307_khz_to_vco(clk->params, rate / 1000); - return icst307_khz(clk->params, vco) * 1000; + + vco = icst307_khz_to_vco(params, rate / 1000); + return icst307_khz(params, vco) * 1000; } -EXPORT_SYMBOL(clk_round_rate); -int clk_set_rate(struct clk *clk, unsigned long rate) +static int clk_versatile_set_rate(struct clk *clk, unsigned long rate) { - int ret = -EIO; + struct clk_versatile *v_clk = to_clk_versatile(clk); + struct icst307_vco vco; - if (clk->setvco) { - struct icst307_vco vco; + vco = icst307_khz_to_vco(&v_clk->params, rate / 1000); + v_clk->rate = icst307_khz(&v_clk->params, vco) * 1000; + v_clk->setvco(v_clk, vco); - vco = icst307_khz_to_vco(clk->params, rate / 1000); - clk->rate = icst307_khz(clk->params, vco) * 1000; - clk->setvco(clk, vco); - ret = 0; - } - return ret; + return 0; } -EXPORT_SYMBOL(clk_set_rate); + +struct clk_operations clk_versatile_operations = { + .get_rate = clk_versatile_get_rate, + .round_rate = clk_versatile_round_rate, + .set_rate = clk_versatile_set_rate, +}; diff --git a/arch/arm/mach-versatile/clock.h b/arch/arm/mach-versatile/clock.h index 03468fd..d1c8791 100644 --- a/arch/arm/mach-versatile/clock.h +++ b/arch/arm/mach-versatile/clock.h @@ -8,13 +8,17 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -struct module; -struct icst307_params; -struct clk { - unsigned long rate; - const struct icst307_params *params; - u32 oscoff; - void*data; - void(*setvco)(struct clk *, struct icst307_vco vco); +#include + +struct clk_versatile { + struct clk clk; + unsigned long rate; + const struct icst307_params params; + u32 oscoff; + void(*setvco)(struct clk_versatile *, + struct icst307_vco); }; + +extern struct clk_operations clk_versatile_operations; + diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index e13be7c..b6964bc 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c @@ -379,16 +379,8 @@ static struct mmci_platform_data mmc0_plat_data = { /* * Clock handling */ -static const struct icst307_params versatile_oscvco_params = { - .ref= 24000, - .vco_max= 20, - .vd_m
[RFC,PATCH 1/7 v2] Add a common struct clk
We currently have 21 definitions of struct clk in the ARM architecture, each defined on a per-platform basis. This makes it difficult to define platform- (or architecture-) independent clock sources without making assumptions about struct clk. This change is an effort to unify struct clk where possible, by defining a common struct clk, containing a set of clock operations. Different clock implementations can set their own operations, and have a standard interface for generic code. The callback interface is exposed to the kernel proper, while the clock implementations only need to be seen by the platform internals. This allows us to share clock code among platforms, and makes it possible to dynamically create clock devices in platform-independent code. Platforms can enable the generic struct clock through CONFIG_USE_COMMON_STRUCT_CLK. The common clock definitions are based on a development patch from Ben Herrenschmidt . Signed-off-by: Jeremy Kerr --- arch/Kconfig|3 include/linux/clk.h | 134 +++- 2 files changed, 110 insertions(+), 27 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 9d055b4..cefc026 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -140,4 +140,7 @@ config HAVE_HW_BREAKPOINT config HAVE_USER_RETURN_NOTIFIER bool +config USE_COMMON_STRUCT_CLK + bool + source "kernel/gcov/Kconfig" diff --git a/include/linux/clk.h b/include/linux/clk.h index 1d37f42..1a6199e 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -11,36 +11,101 @@ #ifndef __LINUX_CLK_H #define __LINUX_CLK_H -struct device; +#include -/* - * The base API. +#ifdef CONFIG_USE_COMMON_STRUCT_CLK + +/* If we're using the common struct clk, we define the base clk object here, + * which will be 'subclassed' by device-specific implementations. For example: + * + * struct clk_foo { + * struct clk; + * [device specific fields] + * }; + * + * We define the common clock API through a set of static inlines that call the + * corresponding clk_operations. The API is exactly the same as that documented + * in the !CONFIG_USE_COMMON_STRUCT_CLK case. */ +struct clk { + const struct clk_operations *ops; +}; + +struct clk_operations { + int (*enable)(struct clk *); + void(*disable)(struct clk *); + unsigned long (*get_rate)(struct clk *); + void(*put)(struct clk *); + long(*round_rate)(struct clk *, unsigned long); + int (*set_rate)(struct clk *, unsigned long); + int (*set_parent)(struct clk *, struct clk *); + struct clk* (*get_parent)(struct clk *); +}; + +static inline int clk_enable(struct clk *clk) +{ + if (clk->ops->enable) + return clk->ops->enable(clk); + return 0; +} + +static inline void clk_disable(struct clk *clk) +{ + if (clk->ops->disable) + clk->ops->disable(clk); +} + +static inline unsigned long clk_get_rate(struct clk *clk) +{ + if (clk->ops->get_rate) + return clk->ops->get_rate(clk); + return 0; +} + +static inline void clk_put(struct clk *clk) +{ + if (clk->ops->put) + clk->ops->put(clk); +} + +static inline long clk_round_rate(struct clk *clk, unsigned long rate) +{ + if (clk->ops->round_rate) + return clk->ops->round_rate(clk, rate); + return -ENOSYS; +} + +static inline int clk_set_rate(struct clk *clk, unsigned long rate) +{ + if (clk->ops->set_rate) + return clk->ops->set_rate(clk, rate); + return -ENOSYS; +} + +static inline int clk_set_parent(struct clk *clk, struct clk *parent) +{ + if (clk->ops->set_parent) + return clk->ops->set_parent(clk, parent); + return -ENOSYS; +} + +static inline struct clk *clk_get_parent(struct clk *clk) +{ + if (clk->ops->get_parent) + return clk->ops->get_parent(clk); + return ERR_PTR(-ENOSYS); +} + + +#else /* !CONFIG_USE_COMMON_STRUCT_CLK */ /* - * struct clk - an machine class defined object / cookie. + * Global clock object, actual structure is declared per-machine */ struct clk; /** - * clk_get - lookup and obtain a reference to a clock producer. - * @dev: device for clock "consumer" - * @id: clock comsumer ID - * - * Returns a struct clk corresponding to the clock producer, or - * valid IS_ERR() condition containing errno. The implementation - * uses @dev and @id to determine the clock consumer, and thereby - * the clock producer. (IOW, @id may be identical strings, but - * clk_get may return different clock producers depending on @dev.) - * - * Drivers must assume that the clock source is not enabled. - * - * clk_get should not be called from within interrupt context. - */ -struct clk *clk_get(struct device *dev, const char *id); - -/** * clk_enable - inform the system when the clock source should be running. * @clk: clock sourc
[RFC,PATCH 0/7 v2] Common struct clk implementation
Hi all, These patches are an attempt to allow platforms to share clock code. At present, the definitions of struct clk are local to platform code, which makes allocating and initialising cross-platform clock sources difficult. The first two patches are for the architecture-independent kernel code, introducing the common clk API. The remaining patches are specific to the ARM 'versatile' and 'realview' platforms. I've included them in this series to illustrate how the clock API is used, by using a generic interface for the icst307 clock, and sharing it between realview and versatile. Ben Herrenschmidt is looking at using common struct clk code for powerpc too, hence the kernel-wide approach. Comments most welcome. Cheers, Jeremy -- v2: * no longer ARM-specific * use clk_operations --- Jeremy Kerr (7): Add a common struct clk Generic support for fixed-rate clocks arm/versatile: use generic struct clk arm/versatile: remove oscoff from clk_versatile arm/realview: use generic struct clk arm/icst307: use common struct clk, unify realview and versatile clocks arm/icst307: remove icst307_ps_to_vco ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] 8xx: fix user space TLB walk in dcbX fixup
Benjamin Herrenschmidt wrote on 12/01/2010 03:40:45: > > On Fri, 2010-01-08 at 17:46 +0100, Joakim Tjernlund wrote: > > The newly added fixup for buggy dcbX insn's has > > a bug that always trigger a kernel TLB walk so a user space > > dcbX insn will cause a Kernel Machine Check if it hits DTLB error. > > > > Signed-off-by: Joakim Tjernlund > > --- > > > > I found this problem in 2.4 and forward ported it to 2.6. I > > cannot test it so I cannot be 100% sure I got it right. > > > > arch/powerpc/kernel/head_8xx.S |4 ++-- > > 1 files changed, 2 insertions(+), 2 deletions(-) > > Do you have something to make sure that TASK_SIZE is never bigger than > 2G ? Else userspace could be all the way to 0xbfff ... No, but this is 8xx :) The TLB handlers has the same "limitation" and has always been so. Jocke ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 02/13] powerpc/5200: LocalPlus driver: use SCLPC register structure
Hello Grant, On Monday 11 January 2010 20:15:58 Grant Likely wrote: > No patch description? Very few patches are sufficiently described by > the subject line alone. Tell me what the problem is, what the patch > changes, and why. And a lot of other information. Thank you very much for the effort you put into those patches. I almost knew that you will criticize e.g. patches that mix functional and "optical" changes, patches that are not describing more exactly what I did. As soon as I have some time left I will try to go once more from the original driver to the final driver using clear and separate, well bescribed patches, of course taking care of your and other people comments. Again, thanks Roman -- Roman FietzeTelemotive AG Büro Mühlhausen Breitwiesen 73347 Mühlhausen Tel.: +49(0)7335/18493-45http://www.telemotive.de Amtsgericht UlmHRB 541321 Vorstand: Peter Kersten, Markus Fischer, Franz Diller, Markus Stolz signature.asc Description: This is a digitally signed message part. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH]: powerpc: Fix build breakage due to incorrect location of autoconf.h
Anton Blanchard wrote on 12/01/2010 03:21:51: > > > commit ac4c2a3bbe5db5fc570b1d0ee1e474db7cb22585 (zlib: optimize inffast when > copying direct from output) referenced include/linux/autoconf.h which > is now called include/generated/autoconf.h. > > Signed-off-by: Anton Blanchard > --- > > Index: linux-cpumask/arch/powerpc/boot/Makefile > === > --- linux-cpumask.orig/arch/powerpc/boot/Makefile 2010-01-12 > 13:15:26.266724762 +1100 > +++ linux-cpumask/arch/powerpc/boot/Makefile 2010-01-12 13:15:33.532974469 > +1100 > @@ -34,7 +34,7 @@ BOOTCFLAGS += -fno-stack-protector > endif > > BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) > -BOOTCFLAGS += -include include/linux/autoconf.h -Iarch/powerpc/include > +BOOTCFLAGS += -include include/generated/autoconf.h -Iarch/powerpc/include > BOOTCFLAGS += -Iinclude Try making that: -BOOTCFLAGS += -include include/linux/autoconf.h -Iarch/powerpc/include -BOOTCFLAGS += -Iinclude +BOOTCFLAGS += -include include/generated/autoconf.h -I$(srctree)/arch/powerpc/include +BOOTCFLAGS += -I$(srctree)/include Jocke ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 10/13] powerpc/5200: LocalPlus driver: fix problem caused by unpredictable IRQ order
Hello Grant, On Monday 11 January 2010 21:19:14 Grant Likely wrote: > I'm really not convinced. At least you made me think about that some more. And of course, you are right, the order must be fixed, one way using TX, the other way using RX. I think delayed BCOM IRQs in TX direction, caused by a high FEC or ATA BCOM load, could cause starting the next job with a not yet cleand up BD ring. Please give me another change to come up with a hopefully much cleaner design, esp. after some tests under low and high load with alternating transfer directions. Probably we can stay with the original design, and only take some extra effort when the transfer directions changes. Roman -- Roman FietzeTelemotive AG Büro Mühlhausen Breitwiesen 73347 Mühlhausen Tel.: +49(0)7335/18493-45http://www.telemotive.de Amtsgericht UlmHRB 541321 Vorstand: Peter Kersten, Markus Fischer, Franz Diller, Markus Stolz signature.asc Description: This is a digitally signed message part. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 03/13] mpc52xx: add SCLPC register bit definitions
Hello Grant, On Monday 11 January 2010 20:21:22 Grant Likely wrote: > Unrelated whitespace change? My fault, as with some other white space changes. My Emacs is configured using some older setup found in a 2.4 Documentation/CodingStyle. Before saving a file my spine is used to reformat the whole source file, which then causes those artefacts. I'll fix the Emacs setup and try to fix my spine, and double check before commits. BTW: no Emacs users amongst the kernel coders any more? At least I have to read "So, you can either get rid of GNU emacs, or ...". > I prefer the (1< Why is the list head being removed? Not used at all, except in initialization? Of course a seperate patch would have been needed. Roman -- Roman FietzeTelemotive AG Büro Mühlhausen Breitwiesen 73347 Mühlhausen Tel.: +49(0)7335/18493-45http://www.telemotive.de Amtsgericht UlmHRB 541321 Vorstand: Peter Kersten, Markus Fischer, Franz Diller, Markus Stolz signature.asc Description: This is a digitally signed message part. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev