Re: DMA coherency in drivers/tty/serial/mpsc.c
On Wed, Jun 26, 2019 at 08:48:37AM +0200, Christoph Hellwig wrote: > On Tue, Jun 25, 2019 at 09:37:22AM -0700, Mark Greer wrote: > > Yeah, the mpsc driver had lots of ugly cache related hacks because of > > cache coherency bugs in the early version of the MV64x60 bridge chips > > that it was embedded in. That chip is pretty much dead now and I've > > removed core support for it from the powerpc tree. Removing the mpsc > > driver is on my todo list but I've been busy and lazy. So, to sum it > > up, don't spend any more time worrying about it as it should be removed. > > > > I'll post a patch to do that tonight and I'm sorry for any time you've > > spent looking at it so far. > > No problem. And if future such broken chips show up we now have > support for per-device DMA coherency settings and could actually > handle it in a reaѕonably clean way. Ah, good to know - thanks. BTW, I just submitted a patch to remove the driver. Mark --
Re: DMA coherency in drivers/tty/serial/mpsc.c
On Tue, Jun 25, 2019 at 02:26:41PM +0200, Christoph Hellwig wrote: > Hi Paul, Dale and Mark (I hope this reaches the right Mark), Hi Christoph. Yes, you did reach the right Mark. :) > I've started auditing all users of DMA_ATTR_NON_CONSISTENT ot prepare > for major API improvements in that area. > > One of the odd users is the mpsc ѕerial driver, which allocates DMA > memory with the above flag, and then actually properly calls > dma_cache_sync. So far, so good. But it turns out it also has > "#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)" > ifdef blocks next to the dma_cache_sync calls that perform cache > maintainance for platforms that according to the ifdef claim to > be cache coherent. According to the Kconfig the driver can > only build if the MV64X60 symbol is set, which is a ppc embedded 6xx > SOC, which appears to be configurable as either cache coherent, or > not. But according to the code in the driver at least this device > always is not cache coherent. > > It seems like we need to always mark that platform as potentially > not coherent, and then use the per-device flag to mark all device > except for this one as coherent. Or did I miss anything? Maybe > all this is actually dead code and can go away? Yeah, the mpsc driver had lots of ugly cache related hacks because of cache coherency bugs in the early version of the MV64x60 bridge chips that it was embedded in. That chip is pretty much dead now and I've removed core support for it from the powerpc tree. Removing the mpsc driver is on my todo list but I've been busy and lazy. So, to sum it up, don't spend any more time worrying about it as it should be removed. I'll post a patch to do that tonight and I'm sorry for any time you've spent looking at it so far. Mark --
Re: [1/5] powerpc/embedded6xx: Remove C2K board support
On Tue, Jun 05, 2018 at 12:10:31AM +1000, Michael Ellerman wrote: > On Fri, 2018-04-06 at 01:17:16 UTC, Mark Greer wrote: > > The C2K platform appears to be orphaned so remove code supporting it. > > > > CC: Remi Machet > > Signed-off-by: Mark Greer > > Acked-by: Remi Machet > > Signed-off-by: Mark Greer > > Series applied to powerpc next, thanks. > > https://git.kernel.org/powerpc/c/92c8c16f345759e87c5d5b771d438f Thanks Michael. Mark --
[PATCH 5/5] powerpc: Remove core support for Marvell mv64x60 hostbridges
There are no longer any platforms that use Marvell's mv64x60 hostbridges so remove the supporting kernel code. CC: Dale Farnsworth <d...@farnsworth.org> Signed-off-by: Mark Greer <mgr...@animalcreek.com> --- Documentation/devicetree/bindings/marvell.txt | 516 - arch/powerpc/sysdev/Makefile | 3 - arch/powerpc/sysdev/mv64x60.h | 13 - arch/powerpc/sysdev/mv64x60_dev.c | 535 -- arch/powerpc/sysdev/mv64x60_pci.c | 171 arch/powerpc/sysdev/mv64x60_pic.c | 297 -- arch/powerpc/sysdev/mv64x60_udbg.c| 152 7 files changed, 1687 deletions(-) delete mode 100644 Documentation/devicetree/bindings/marvell.txt delete mode 100644 arch/powerpc/sysdev/mv64x60.h delete mode 100644 arch/powerpc/sysdev/mv64x60_dev.c delete mode 100644 arch/powerpc/sysdev/mv64x60_pci.c delete mode 100644 arch/powerpc/sysdev/mv64x60_pic.c delete mode 100644 arch/powerpc/sysdev/mv64x60_udbg.c diff --git a/Documentation/devicetree/bindings/marvell.txt b/Documentation/devicetree/bindings/marvell.txt deleted file mode 100644 index 7f722316458a.. --- a/Documentation/devicetree/bindings/marvell.txt +++ /dev/null @@ -1,516 +0,0 @@ -Marvell Discovery mv64[345]6x System Controller chips -=== - -The Marvell mv64[345]60 series of system controller chips contain -many of the peripherals needed to implement a complete computer -system. In this section, we define device tree nodes to describe -the system controller chip itself and each of the peripherals -which it contains. Compatible string values for each node are -prefixed with the string "marvell,", for Marvell Technology Group Ltd. - -1) The /system-controller node - - This node is used to represent the system-controller and must be - present when the system uses a system controller chip. The top-level - system-controller node contains information that is global to all - devices within the system controller chip. The node name begins - with "system-controller" followed by the unit address, which is - the base address of the memory-mapped register set for the system - controller chip. - - Required properties: - -- ranges : Describes the translation of system controller addresses - for memory mapped registers. -- clock-frequency: Contains the main clock frequency for the system - controller chip. -- reg : This property defines the address and size of the - memory-mapped registers contained within the system controller - chip. The address specified in the "reg" property should match - the unit address of the system-controller node. -- #address-cells : Address representation for system controller - devices. This field represents the number of cells needed to - represent the address of the memory-mapped registers of devices - within the system controller chip. -- #size-cells : Size representation for the memory-mapped - registers within the system controller chip. -- #interrupt-cells : Defines the width of cells used to represent - interrupts. - - Optional properties: - -- model : The specific model of the system controller chip. Such - as, "mv64360", "mv64460", or "mv64560". -- compatible : A string identifying the compatibility identifiers - of the system controller chip. - - The system-controller node contains child nodes for each system - controller device that the platform uses. Nodes should not be created - for devices which exist on the system controller chip but are not used - - Example Marvell Discovery mv64360 system-controller node: - -system-controller@f100 { /* Marvell Discovery mv64360 */ - #address-cells = <1>; - #size-cells = <1>; - model = "mv64360"; /* Default */ - compatible = "marvell,mv64360"; - clock-frequency = <1>; - reg = <0xf100 0x1>; - virtual-reg = <0xf100>; - ranges = <0x8800 0x8800 0x100 /* PCI 0 I/O Space */ - 0x8000 0x8000 0x800 /* PCI 0 MEM Space */ - 0xa000 0xa000 0x400 /* User FLASH */ - 0x 0xf100 0x001 /* Bridge's regs */ - 0xf200 0xf200 0x004>;/* Integrated SRAM */ - - [ child node definitions... ] -} - -2) Child nodes of /system-controller - - a) Marvell Discovery MDIO bus - - The MDIO is a bus to which the PHY devices are connected. For each - device that exists on this bus, a child node should be created. See - the definition of the PHY node below for an example of how to define - a PHY. - - Required proper
[PATCH 0/5] powerpc: Remove support for Marvell mv64x60 hostbridges
Hello. As far as I can tell, the c2k platform is abandoned so it should be removed. Once it is removed, there are no more platforms that use the mv64x60 hostbridge so remove that code too (and related drivers). If and when this series of patches is accepted, I will submit patches to the appropriate maintainers to remote drivers/tty/serial/mpsc.c and drivers/watchdog/mv64x60_wdt.c. The i2c and ethernet drivers are used by ARM SoCs/platforms so they will be left alone. Based on git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux, 'merge' branch which is currently 6c5c24035003 (Automatic merge of branches 'master', 'next' and 'fixes' into merge) Thanks, Mark -- Mark Greer (5): powerpc/embedded6xx: Remove C2K board support powerpc/boot: Remove support for Marvell MPSC serial controller powerpc/boot: Remove support for Marvell mv64x60 i2c controller powerpc/boot: Remove core support for Marvell mv64x60 hostbridges powerpc: Remove core support for Marvell mv64x60 hostbridges Documentation/devicetree/bindings/marvell.txt | 516 --- arch/powerpc/boot/Makefile| 7 +- arch/powerpc/boot/cuboot-c2k.c| 189 - arch/powerpc/boot/dts/c2k.dts | 366 arch/powerpc/boot/mpsc.c | 169 arch/powerpc/boot/mv64x60.c | 581 -- arch/powerpc/boot/mv64x60.h | 70 arch/powerpc/boot/mv64x60_i2c.c | 204 - arch/powerpc/boot/ops.h | 1 - arch/powerpc/boot/serial.c| 4 - arch/powerpc/configs/c2k_defconfig| 390 - arch/powerpc/platforms/embedded6xx/Kconfig| 10 - arch/powerpc/platforms/embedded6xx/Makefile | 1 - arch/powerpc/platforms/embedded6xx/c2k.c | 148 --- arch/powerpc/sysdev/Makefile | 3 - arch/powerpc/sysdev/mv64x60.h | 13 - arch/powerpc/sysdev/mv64x60_dev.c | 535 arch/powerpc/sysdev/mv64x60_pci.c | 171 arch/powerpc/sysdev/mv64x60_pic.c | 297 - arch/powerpc/sysdev/mv64x60_udbg.c| 152 --- 20 files changed, 3 insertions(+), 3824 deletions(-) delete mode 100644 Documentation/devicetree/bindings/marvell.txt delete mode 100644 arch/powerpc/boot/cuboot-c2k.c delete mode 100644 arch/powerpc/boot/dts/c2k.dts delete mode 100644 arch/powerpc/boot/mpsc.c delete mode 100644 arch/powerpc/boot/mv64x60.c delete mode 100644 arch/powerpc/boot/mv64x60.h delete mode 100644 arch/powerpc/boot/mv64x60_i2c.c delete mode 100644 arch/powerpc/configs/c2k_defconfig delete mode 100644 arch/powerpc/platforms/embedded6xx/c2k.c delete mode 100644 arch/powerpc/sysdev/mv64x60.h delete mode 100644 arch/powerpc/sysdev/mv64x60_dev.c delete mode 100644 arch/powerpc/sysdev/mv64x60_pci.c delete mode 100644 arch/powerpc/sysdev/mv64x60_pic.c delete mode 100644 arch/powerpc/sysdev/mv64x60_udbg.c -- 2.16.2
[PATCH 1/5] powerpc/embedded6xx: Remove C2K board support
The C2K platform appears to be orphaned so remove code supporting it. CC: Remi Machet <rmac...@nvidia.com> Signed-off-by: Mark Greer <mgr...@animalcreek.com> --- arch/powerpc/boot/Makefile | 5 +- arch/powerpc/boot/cuboot-c2k.c | 189 -- arch/powerpc/boot/dts/c2k.dts | 366 -- arch/powerpc/configs/c2k_defconfig | 390 arch/powerpc/platforms/embedded6xx/Kconfig | 10 - arch/powerpc/platforms/embedded6xx/Makefile | 1 - arch/powerpc/platforms/embedded6xx/c2k.c| 148 --- 7 files changed, 2 insertions(+), 1107 deletions(-) delete mode 100644 arch/powerpc/boot/cuboot-c2k.c delete mode 100644 arch/powerpc/boot/dts/c2k.dts delete mode 100644 arch/powerpc/configs/c2k_defconfig delete mode 100644 arch/powerpc/platforms/embedded6xx/c2k.c diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 26d5d2a5b8e9..70bf9b409fae 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -143,8 +143,8 @@ src-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c src-plat-$(CONFIG_PPC_83xx) += cuboot-83xx.c fixed-head.S redboot-83xx.c src-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \ - cuboot-c2k.c gamecube-head.S \ - gamecube.c wii-head.S wii.c holly.c \ + gamecube-head.S gamecube.c \ + wii-head.S wii.c holly.c \ fixed-head.S mvme5100.c src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c @@ -339,7 +339,6 @@ image-$(CONFIG_MVME7100)+= dtbImage.mvme7100 # Board ports in arch/powerpc/platform/embedded6xx/Kconfig image-$(CONFIG_STORCENTER) += cuImage.storcenter image-$(CONFIG_MPC7448HPC2)+= cuImage.mpc7448hpc2 -image-$(CONFIG_PPC_C2K)+= cuImage.c2k image-$(CONFIG_GAMECUBE) += dtbImage.gamecube image-$(CONFIG_WII)+= dtbImage.wii image-$(CONFIG_MVME5100) += dtbImage.mvme5100 diff --git a/arch/powerpc/boot/cuboot-c2k.c b/arch/powerpc/boot/cuboot-c2k.c deleted file mode 100644 index 9309c51f1d65.. --- a/arch/powerpc/boot/cuboot-c2k.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * GEFanuc C2K platform code. - * - * Author: Remi Machet <rmac...@slac.stanford.edu> - * - * Originated from prpmc2800.c - * - * 2008 (c) Stanford University - * 2007 (c) MontaVista, Software, Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include "types.h" -#include "stdio.h" -#include "io.h" -#include "ops.h" -#include "elf.h" -#include "mv64x60.h" -#include "cuboot.h" -#include "ppcboot.h" - -static u8 *bridge_base; - -static void c2k_bridge_setup(u32 mem_size) -{ - u32 i, v[30], enables, acc_bits; - u32 pci_base_hi, pci_base_lo, size, buf[2]; - unsigned long cpu_base; - int rc; - void *devp, *mv64x60_devp; - u8 *bridge_pbase, is_coherent; - struct mv64x60_cpu2pci_win *tbl; - int bus; - - bridge_pbase = mv64x60_get_bridge_pbase(); - is_coherent = mv64x60_is_coherent(); - - if (is_coherent) - acc_bits = MV64x60_PCI_ACC_CNTL_SNOOP_WB - | MV64x60_PCI_ACC_CNTL_SWAP_NONE - | MV64x60_PCI_ACC_CNTL_MBURST_32_BYTES - | MV64x60_PCI_ACC_CNTL_RDSIZE_32_BYTES; - else - acc_bits = MV64x60_PCI_ACC_CNTL_SNOOP_NONE - | MV64x60_PCI_ACC_CNTL_SWAP_NONE - | MV64x60_PCI_ACC_CNTL_MBURST_128_BYTES - | MV64x60_PCI_ACC_CNTL_RDSIZE_256_BYTES; - - mv64x60_config_ctlr_windows(bridge_base, bridge_pbase, is_coherent); - mv64x60_devp = find_node_by_compatible(NULL, "marvell,mv64360"); - if (mv64x60_devp == NULL) - fatal("Error: Missing marvell,mv64360 device tree node\n\r"); - - enables = in_le32((u32 *)(bridge_base + MV64x60_CPU_BAR_ENABLE)); - enables |= 0x007ffe00; /* Disable all cpu->pci windows */ - out_le32((u32 *)(bridge_base + MV64x60_CPU_BAR_ENABLE), enables); - - /* Get the cpu -> pci i/o & mem mappings from the device tree */ - devp = NULL; - for (bus = 0; ; bus++) { - char name[] = "pci "; - - name[strlen(name)-1] = bus+'0'; - - devp = find_node_by_alias(name); - if
[PATCH 2/5] powerpc/boot: Remove support for Marvell MPSC serial controller
There are no longer any platforms that use Marvell's MPSC serial controller so remove its driver. Signed-off-by: Mark Greer <mgr...@animalcreek.com> --- arch/powerpc/boot/Makefile | 2 +- arch/powerpc/boot/mpsc.c | 169 - arch/powerpc/boot/ops.h| 1 - arch/powerpc/boot/serial.c | 4 -- 4 files changed, 1 insertion(+), 175 deletions(-) delete mode 100644 arch/powerpc/boot/mpsc.c diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 70bf9b409fae..58f2dbfba275 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -120,7 +120,7 @@ src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c src-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c -src-wlib-$(CONFIG_EMBEDDED6xx) += mpsc.c mv64x60.c mv64x60_i2c.c ugecon.c fsl-soc.c +src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c fsl-soc.c src-wlib-$(CONFIG_XILINX_VIRTEX) += uartlite.c src-wlib-$(CONFIG_CPM) += cpm-serial.c diff --git a/arch/powerpc/boot/mpsc.c b/arch/powerpc/boot/mpsc.c deleted file mode 100644 index 425ad88cce8d.. --- a/arch/powerpc/boot/mpsc.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * MPSC/UART driver for the Marvell mv64360, mv64460, ... - * - * Author: Mark A. Greer <mgr...@mvista.com> - * - * 2007 (c) MontaVista Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. - */ - -#include -#include -#include "types.h" -#include "string.h" -#include "stdio.h" -#include "io.h" -#include "ops.h" - - -#define MPSC_CHR_1 0x000c - -#define MPSC_CHR_2 0x0010 -#define MPSC_CHR_2_TA (1<<7) -#define MPSC_CHR_2_TCS (1<<9) -#define MPSC_CHR_2_RA (1<<23) -#define MPSC_CHR_2_CRD (1<<25) -#define MPSC_CHR_2_EH (1<<31) - -#define MPSC_CHR_4 0x0018 -#define MPSC_CHR_4_Z (1<<29) - -#define MPSC_CHR_5 0x001c -#define MPSC_CHR_5_CTL1_INTR (1<<12) -#define MPSC_CHR_5_CTL1_VALID (1<<15) - -#define MPSC_CHR_100x0030 - -#define MPSC_INTR_CAUSE0x -#define MPSC_INTR_CAUSE_RCC(1<<6) -#define MPSC_INTR_MASK 0x0080 - -#define SDMA_SDCM 0x0008 -#define SDMA_SDCM_AR (1<<15) -#define SDMA_SDCM_AT (1<<31) - -static volatile char *mpsc_base; -static volatile char *mpscintr_base; -static u32 chr1, chr2; - -static int mpsc_open(void) -{ - chr1 = in_le32((u32 *)(mpsc_base + MPSC_CHR_1)) & 0x00ff; - chr2 = in_le32((u32 *)(mpsc_base + MPSC_CHR_2)) & ~(MPSC_CHR_2_TA - | MPSC_CHR_2_TCS | MPSC_CHR_2_RA | MPSC_CHR_2_CRD - | MPSC_CHR_2_EH); - out_le32((u32 *)(mpsc_base + MPSC_CHR_4), MPSC_CHR_4_Z); - out_le32((u32 *)(mpsc_base + MPSC_CHR_5), - MPSC_CHR_5_CTL1_INTR | MPSC_CHR_5_CTL1_VALID); - out_le32((u32 *)(mpsc_base + MPSC_CHR_2), chr2 | MPSC_CHR_2_EH); - return 0; -} - -static void mpsc_putc(unsigned char c) -{ - while (in_le32((u32 *)(mpsc_base + MPSC_CHR_2)) & MPSC_CHR_2_TCS); - - out_le32((u32 *)(mpsc_base + MPSC_CHR_1), chr1 | c); - out_le32((u32 *)(mpsc_base + MPSC_CHR_2), chr2 | MPSC_CHR_2_TCS); -} - -static unsigned char mpsc_getc(void) -{ - u32 cause = 0; - unsigned char c; - - while (!(cause & MPSC_INTR_CAUSE_RCC)) - cause = in_le32((u32 *)(mpscintr_base + MPSC_INTR_CAUSE)); - - c = in_8((u8 *)(mpsc_base + MPSC_CHR_10 + 2)); - out_8((u8 *)(mpsc_base + MPSC_CHR_10 + 2), c); - out_le32((u32 *)(mpscintr_base + MPSC_INTR_CAUSE), - cause & ~MPSC_INTR_CAUSE_RCC); - - return c; -} - -static u8 mpsc_tstc(void) -{ - return (u8)((in_le32((u32 *)(mpscintr_base + MPSC_INTR_CAUSE)) - & MPSC_INTR_CAUSE_RCC) != 0); -} - -static void mpsc_stop_dma(volatile char *sdma_base) -{ - out_le32((u32 *)(mpsc_base + MPSC_CHR_2),MPSC_CHR_2_TA | MPSC_CHR_2_RA); - out_le32((u32 *)(sdma_base + SDMA_SDCM), SDMA_SDCM_AR | SDMA_SDCM_AT); - - while ((in_le32((u32 *)(sdma_base + SDMA_SDCM)) - & (SDMA_SDCM_AR | SDMA_SDCM_AT)) != 0) - udelay(100); -} - -static volatile char *mpsc_get_virtreg_of_phandle(void *devp, char *prop) -{ - void *v; - int n; - - n = getprop(devp, prop, , sizeof(v)); - if (n != sizeof(v)) - goto err_out; - - devp = find_node_by_linuxphandle((u32)v); - if (devp == NULL) - goto err_out; - - n = getprop(de
[PATCH 4/5] powerpc/boot: Remove core support for Marvell mv64x60 hostbridges
There are no longer any platforms that use Marvell's mv64x60 hostbridges so remove the supporting boot code. Signed-off-by: Mark Greer <mgr...@animalcreek.com> --- arch/powerpc/boot/Makefile | 2 +- arch/powerpc/boot/mv64x60.c | 581 arch/powerpc/boot/mv64x60.h | 70 -- 3 files changed, 1 insertion(+), 652 deletions(-) delete mode 100644 arch/powerpc/boot/mv64x60.c delete mode 100644 arch/powerpc/boot/mv64x60.h diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index bf6a46055ba7..fa16626849f4 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -120,7 +120,7 @@ src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c src-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c -src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c ugecon.c fsl-soc.c +src-wlib-$(CONFIG_EMBEDDED6xx) += ugecon.c fsl-soc.c src-wlib-$(CONFIG_XILINX_VIRTEX) += uartlite.c src-wlib-$(CONFIG_CPM) += cpm-serial.c diff --git a/arch/powerpc/boot/mv64x60.c b/arch/powerpc/boot/mv64x60.c deleted file mode 100644 index d9bb302b91d2.. --- a/arch/powerpc/boot/mv64x60.c +++ /dev/null @@ -1,581 +0,0 @@ -/* - * Marvell hostbridge routines - * - * Author: Mark A. Greer <sou...@mvista.com> - * - * 2004, 2005, 2007 (c) MontaVista Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. - */ - -#include -#include -#include "types.h" -#include "elf.h" -#include "page.h" -#include "string.h" -#include "stdio.h" -#include "io.h" -#include "ops.h" -#include "mv64x60.h" - -#define PCI_DEVFN(slot,func) slot) & 0x1f) << 3) | ((func) & 0x07)) - -#define MV64x60_CPU2MEM_WINDOWS4 -#define MV64x60_CPU2MEM_0_BASE 0x0008 -#define MV64x60_CPU2MEM_0_SIZE 0x0010 -#define MV64x60_CPU2MEM_1_BASE 0x0208 -#define MV64x60_CPU2MEM_1_SIZE 0x0210 -#define MV64x60_CPU2MEM_2_BASE 0x0018 -#define MV64x60_CPU2MEM_2_SIZE 0x0020 -#define MV64x60_CPU2MEM_3_BASE 0x0218 -#define MV64x60_CPU2MEM_3_SIZE 0x0220 - -#define MV64x60_ENET2MEM_BAR_ENABLE0x2290 -#define MV64x60_ENET2MEM_0_BASE0x2200 -#define MV64x60_ENET2MEM_0_SIZE0x2204 -#define MV64x60_ENET2MEM_1_BASE0x2208 -#define MV64x60_ENET2MEM_1_SIZE0x220c -#define MV64x60_ENET2MEM_2_BASE0x2210 -#define MV64x60_ENET2MEM_2_SIZE0x2214 -#define MV64x60_ENET2MEM_3_BASE0x2218 -#define MV64x60_ENET2MEM_3_SIZE0x221c -#define MV64x60_ENET2MEM_4_BASE0x2220 -#define MV64x60_ENET2MEM_4_SIZE0x2224 -#define MV64x60_ENET2MEM_5_BASE0x2228 -#define MV64x60_ENET2MEM_5_SIZE0x222c -#define MV64x60_ENET2MEM_ACC_PROT_00x2294 -#define MV64x60_ENET2MEM_ACC_PROT_10x2298 -#define MV64x60_ENET2MEM_ACC_PROT_20x229c - -#define MV64x60_MPSC2MEM_BAR_ENABLE0xf250 -#define MV64x60_MPSC2MEM_0_BASE0xf200 -#define MV64x60_MPSC2MEM_0_SIZE0xf204 -#define MV64x60_MPSC2MEM_1_BASE0xf208 -#define MV64x60_MPSC2MEM_1_SIZE0xf20c -#define MV64x60_MPSC2MEM_2_BASE0xf210 -#define MV64x60_MPSC2MEM_2_SIZE0xf214 -#define MV64x60_MPSC2MEM_3_BASE0xf218 -#define MV64x60_MPSC2MEM_3_SIZE0xf21c -#define MV64x60_MPSC_0_REMAP 0xf240 -#define MV64x60_MPSC_1_REMAP 0xf244 -#define MV64x60_MPSC2MEM_ACC_PROT_00xf254 -#define MV64x60_MPSC2MEM_ACC_PROT_10xf258 -#define MV64x60_MPSC2REGS_BASE 0xf25c - -#define MV64x60_IDMA2MEM_BAR_ENABLE0x0a80 -#define MV64x60_IDMA2MEM_0_BASE0x0a00 -#define MV64x60_IDMA2MEM_0_SIZE0x0a04 -#define MV64x60_IDMA2MEM_1_BASE0x0a08 -#define MV64x60_IDMA2MEM_1_SIZE0x0a0c -#define MV64x60_IDMA2MEM_2_BASE0x0a10 -#define MV64x60_IDMA2MEM_2_SIZE0x0a14 -#define MV64x60_IDMA2MEM_3_BASE0x0a18 -#define MV64x60_IDMA2MEM_3_SIZE0x0a1c -#define MV64x60_IDMA2MEM_4_BASE0x0a20 -#define MV64x60_IDMA2MEM_4_SIZE
[PATCH 3/5] powerpc/boot: Remove support for Marvell mv64x60 i2c controller
There are no longer any platforms that use Marvell's mv64x60's i2c controller so remove its driver. Signed-off-by: Mark Greer <mgr...@animalcreek.com> --- arch/powerpc/boot/Makefile | 2 +- arch/powerpc/boot/mv64x60_i2c.c | 204 2 files changed, 1 insertion(+), 205 deletions(-) delete mode 100644 arch/powerpc/boot/mv64x60_i2c.c diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 58f2dbfba275..bf6a46055ba7 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -120,7 +120,7 @@ src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c src-wlib-$(CONFIG_PPC_8xx) += mpc8xx.c planetcore.c fsl-soc.c src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c -src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c fsl-soc.c +src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c ugecon.c fsl-soc.c src-wlib-$(CONFIG_XILINX_VIRTEX) += uartlite.c src-wlib-$(CONFIG_CPM) += cpm-serial.c diff --git a/arch/powerpc/boot/mv64x60_i2c.c b/arch/powerpc/boot/mv64x60_i2c.c deleted file mode 100644 index 52a3212b6638.. --- a/arch/powerpc/boot/mv64x60_i2c.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Bootloader version of the i2c driver for the MV64x60. - * - * Author: Dale Farnsworth <dfarnswo...@mvista.com> - * Maintained by: Mark A. Greer <mgr...@mvista.com> - * - * 2003, 2007 (c) MontaVista, Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program is - * licensed "as is" without any warranty of any kind, whether express or - * implied. - */ - -#include -#include -#include "types.h" -#include "elf.h" -#include "page.h" -#include "string.h" -#include "stdio.h" -#include "io.h" -#include "ops.h" -#include "mv64x60.h" - -/* Register defines */ -#define MV64x60_I2C_REG_SLAVE_ADDR 0x00 -#define MV64x60_I2C_REG_DATA 0x04 -#define MV64x60_I2C_REG_CONTROL0x08 -#define MV64x60_I2C_REG_STATUS 0x0c -#define MV64x60_I2C_REG_BAUD 0x0c -#define MV64x60_I2C_REG_EXT_SLAVE_ADDR 0x10 -#define MV64x60_I2C_REG_SOFT_RESET 0x1c - -#define MV64x60_I2C_CONTROL_ACK0x04 -#define MV64x60_I2C_CONTROL_IFLG 0x08 -#define MV64x60_I2C_CONTROL_STOP 0x10 -#define MV64x60_I2C_CONTROL_START 0x20 -#define MV64x60_I2C_CONTROL_TWSIEN 0x40 -#define MV64x60_I2C_CONTROL_INTEN 0x80 - -#define MV64x60_I2C_STATUS_BUS_ERR 0x00 -#define MV64x60_I2C_STATUS_MAST_START 0x08 -#define MV64x60_I2C_STATUS_MAST_REPEAT_START 0x10 -#define MV64x60_I2C_STATUS_MAST_WR_ADDR_ACK0x18 -#define MV64x60_I2C_STATUS_MAST_WR_ADDR_NO_ACK 0x20 -#define MV64x60_I2C_STATUS_MAST_WR_ACK 0x28 -#define MV64x60_I2C_STATUS_MAST_WR_NO_ACK 0x30 -#define MV64x60_I2C_STATUS_MAST_LOST_ARB 0x38 -#define MV64x60_I2C_STATUS_MAST_RD_ADDR_ACK0x40 -#define MV64x60_I2C_STATUS_MAST_RD_ADDR_NO_ACK 0x48 -#define MV64x60_I2C_STATUS_MAST_RD_DATA_ACK0x50 -#define MV64x60_I2C_STATUS_MAST_RD_DATA_NO_ACK 0x58 -#define MV64x60_I2C_STATUS_MAST_WR_ADDR_2_ACK 0xd0 -#define MV64x60_I2C_STATUS_MAST_WR_ADDR_2_NO_ACK 0xd8 -#define MV64x60_I2C_STATUS_MAST_RD_ADDR_2_ACK 0xe0 -#define MV64x60_I2C_STATUS_MAST_RD_ADDR_2_NO_ACK 0xe8 -#define MV64x60_I2C_STATUS_NO_STATUS 0xf8 - -static u8 *ctlr_base; - -static int mv64x60_i2c_wait_for_status(int wanted) -{ - int i; - int status; - - for (i=0; i<1000; i++) { - udelay(10); - status = in_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_STATUS)) - & 0xff; - if (status == wanted) - return status; - } - return -status; -} - -static int mv64x60_i2c_control(int control, int status) -{ - out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control & 0xff); - return mv64x60_i2c_wait_for_status(status); -} - -static int mv64x60_i2c_read_byte(int control, int status) -{ - out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control & 0xff); - if (mv64x60_i2c_wait_for_status(status) < 0) - return -1; - return in_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_DATA)) & 0xff; -} - -static int mv64x60_i2c_write_byte(int data, int control, int status) -{ - out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_DATA), data & 0xff); - out_le32((u32 *)(ctlr_base + MV64x60_I2C_REG_CONTROL), control & 0xff); - return mv6
Re: [PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h
On Thu, Mar 29, 2018 at 07:26:52PM -0700, Mark Greer wrote: > On Thu, Mar 29, 2018 at 07:22:50PM -0700, Mark Greer wrote: > > On Tue, Mar 20, 2018 at 10:55:07AM +1100, Oliver wrote: > > > > Yeah that's pretty odd. It might be a bug in your specific version of > > > GCC since I can't replicate it with this dumb test case: > > > > > > #include > > > typedef unsigned intu32; > > > > > > typedef u32 uint32_t; > > > typedef u32 uint32_t; > > > > > > int main(void) { > > > uint32_t test = 0; > > > printf("%u\n", test); > > > return 0; > > > } > > > > > > Does that result in an error? > > > > Hi Oliver. I'm very sorry for the long delay in responding. > > > > This fail to compile too: > > > > $ cat test.c > > #include > > typedef unsigned int u32; > > > > typedef u32 uint32_t; > > typedef u32 uint32_t; > > > > int main(void) { > > uint32_t test = 0; > > printf("%u\n", test); > > return 0; > > } > > $ > > $ powerpc-linux-gnu-gcc -o test test.c > > test.c:5:13: error: redefinition of typedef 'uint32_t' > > test.c:4:13: note: previous declaration of 'uint32_t' was here > > And I meant to add: > > $ powerpc-linux-gnu-gcc --version > powerpc-linux-gnu-gcc (Sourcery G++ Lite 2010.09-55) 4.5.1 > Copyright (C) 2010 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > So, yeah, its really old. > > I'll get a newer one and test it. I downloaded this version from denx.de (thank you, Wolfgang): $ powerpc-linux-gcc --version powerpc-linux-gcc (GCC) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Its still dated but its the best prebuilt version that I could find easily available. With this version, the kernel (ppc6xx_defconfig) built without issue. Thanks to all who helped me through this. To Ben or whoever, I think the original patch is still worth applying even if it isn't critical. Thanks, Mark --
Re: [PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h
On Thu, Mar 29, 2018 at 07:22:50PM -0700, Mark Greer wrote: > On Tue, Mar 20, 2018 at 10:55:07AM +1100, Oliver wrote: > > Yeah that's pretty odd. It might be a bug in your specific version of > > GCC since I can't replicate it with this dumb test case: > > > > #include > > typedef unsigned intu32; > > > > typedef u32 uint32_t; > > typedef u32 uint32_t; > > > > int main(void) { > > uint32_t test = 0; > > printf("%u\n", test); > > return 0; > > } > > > > Does that result in an error? > > Hi Oliver. I'm very sorry for the long delay in responding. > > This fail to compile too: > > $ cat test.c > #include > typedef unsigned int u32; > > typedef u32 uint32_t; > typedef u32 uint32_t; > > int main(void) { > uint32_t test = 0; > printf("%u\n", test); > return 0; > } > $ > $ powerpc-linux-gnu-gcc -o test test.c > test.c:5:13: error: redefinition of typedef 'uint32_t' > test.c:4:13: note: previous declaration of 'uint32_t' was here And I meant to add: $ powerpc-linux-gnu-gcc --version powerpc-linux-gnu-gcc (Sourcery G++ Lite 2010.09-55) 4.5.1 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. So, yeah, its really old. I'll get a newer one and test it. Mark --
Re: [PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h
On Tue, Mar 20, 2018 at 10:55:07AM +1100, Oliver wrote: > On Tue, Mar 20, 2018 at 3:02 AM, Mark Greer <mgr...@animalcreek.com> wrote: > > On Mon, Mar 19, 2018 at 09:53:09AM +0100, Christophe LEROY wrote: > >> > >> > >> Le 16/03/2018 à 22:54, Mark Greer a écrit : > >> >When building a uImage or zImage using ppc6xx_defconfig and some other > >> >defconfigs, the following error occurs: > >> > > >> > BOOTCC arch/powerpc/boot/fdt.o > >> > In file included from arch/powerpc/boot/fdt.c:51:0: > >> > ../arch/powerpc/boot/libfdt_env.h:10:13: error: redefinition of > >> > typedef 'uint32_t' > >> > ../arch/powerpc/boot/types.h:21:13: note: previous declaration of > >> > 'uint32_t' was here > >> > ../arch/powerpc/boot/libfdt_env.h:11:13: error: redefinition of > >> > typedef 'uint64_t' > >> > ../arch/powerpc/boot/types.h:22:13: note: previous declaration of > >> > 'uint64_t' was here > >> > ../arch/powerpc/boot/Makefile:210: recipe for target > >> > 'arch/powerpc/boot/fdt.o' failed > >> > make[2]: *** [arch/powerpc/boot/fdt.o] Error 1 > >> > > >> >The problem is that commit 656ad58ef19e (powerpc/boot: Add OPAL console > >> >to epapr wrappers) adds typedefs for uint32_t and uint64_t to type.h but > >> >doesn't remove the pre-existing (and now duplicate) typedefs from > >> >libfdt_env.h. Fix the error by removing the duplicat typedefs from > >> >libfdt_env.h > >> > > >> >CC: David Gibson <da...@gibson.dropbear.id.au> > >> >CC: Oliver O'Halloran <ooh...@gmail.com> > >> >Signed-off-by: Mark Greer <mgr...@animalcreek.com> > >> >--- > >> >Having said all of that, commit 656ad58ef19e (powerpc/boot: Add OPAL > >> >console to epapr wrappers) went into mainline back in 2016 so, AFAICT, > >> >this has been broken since then. That seems unlikely so I must be > >> >missing something... Any ideas what that is? > >> > >> I just compiled uImage for ppc6xx_defconfig, and I don't get such error. > >> I looked at what gcc -E outputs, u32 is defined twice but it doesn't seems > >> to bother GCC. > >> > >> What version of GCC do you use ? > >> I tried with 5.4.0 and 4.6.3, both seems to work. > >> > >> Christophe > > > > Hi Christophe. > > > > That's interesting. I would expect an error regardless of version. > > > > I used an old 4.5.1 gcc that I had laying around (from denx, iirc). > > I'll find a newer one and try it. > > Yeah that's pretty odd. It might be a bug in your specific version of > GCC since I can't replicate it with this dumb test case: > > #include > typedef unsigned intu32; > > typedef u32 uint32_t; > typedef u32 uint32_t; > > int main(void) { > uint32_t test = 0; > printf("%u\n", test); > return 0; > } > > Does that result in an error? Hi Oliver. I'm very sorry for the long delay in responding. This fail to compile too: $ cat test.c #include typedef unsigned int u32; typedef u32 uint32_t; typedef u32 uint32_t; int main(void) { uint32_t test = 0; printf("%u\n", test); return 0; } $ $ powerpc-linux-gnu-gcc -o test test.c test.c:5:13: error: redefinition of typedef 'uint32_t' test.c:4:13: note: previous declaration of 'uint32_t' was here > > Either way, it seems to me that we should remove the duplicate definitions. > > Do you agree? > > It wouldn't hurt to remove those definitions from libfdt_env.h. That > file includes types.h directly anyway so there's not much point in > them being there. +1 Mark --
Re: [PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h
On Mon, Mar 19, 2018 at 09:53:09AM +0100, Christophe LEROY wrote: > > > Le 16/03/2018 à 22:54, Mark Greer a écrit : > >When building a uImage or zImage using ppc6xx_defconfig and some other > >defconfigs, the following error occurs: > > > > BOOTCC arch/powerpc/boot/fdt.o > > In file included from arch/powerpc/boot/fdt.c:51:0: > > ../arch/powerpc/boot/libfdt_env.h:10:13: error: redefinition of typedef > > 'uint32_t' > > ../arch/powerpc/boot/types.h:21:13: note: previous declaration of > > 'uint32_t' was here > > ../arch/powerpc/boot/libfdt_env.h:11:13: error: redefinition of typedef > > 'uint64_t' > > ../arch/powerpc/boot/types.h:22:13: note: previous declaration of > > 'uint64_t' was here > > ../arch/powerpc/boot/Makefile:210: recipe for target > > 'arch/powerpc/boot/fdt.o' failed > > make[2]: *** [arch/powerpc/boot/fdt.o] Error 1 > > > >The problem is that commit 656ad58ef19e (powerpc/boot: Add OPAL console > >to epapr wrappers) adds typedefs for uint32_t and uint64_t to type.h but > >doesn't remove the pre-existing (and now duplicate) typedefs from > >libfdt_env.h. Fix the error by removing the duplicat typedefs from > >libfdt_env.h > > > >CC: David Gibson <da...@gibson.dropbear.id.au> > >CC: Oliver O'Halloran <ooh...@gmail.com> > >Signed-off-by: Mark Greer <mgr...@animalcreek.com> > >--- > >Having said all of that, commit 656ad58ef19e (powerpc/boot: Add OPAL > >console to epapr wrappers) went into mainline back in 2016 so, AFAICT, > >this has been broken since then. That seems unlikely so I must be > >missing something... Any ideas what that is? > > I just compiled uImage for ppc6xx_defconfig, and I don't get such error. > I looked at what gcc -E outputs, u32 is defined twice but it doesn't seems > to bother GCC. > > What version of GCC do you use ? > I tried with 5.4.0 and 4.6.3, both seems to work. > > Christophe Hi Christophe. That's interesting. I would expect an error regardless of version. I used an old 4.5.1 gcc that I had laying around (from denx, iirc). I'll find a newer one and try it. Either way, it seems to me that we should remove the duplicate definitions. Do you agree? Thanks, Mark --
[PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h
When building a uImage or zImage using ppc6xx_defconfig and some other defconfigs, the following error occurs: BOOTCC arch/powerpc/boot/fdt.o In file included from arch/powerpc/boot/fdt.c:51:0: ../arch/powerpc/boot/libfdt_env.h:10:13: error: redefinition of typedef 'uint32_t' ../arch/powerpc/boot/types.h:21:13: note: previous declaration of 'uint32_t' was here ../arch/powerpc/boot/libfdt_env.h:11:13: error: redefinition of typedef 'uint64_t' ../arch/powerpc/boot/types.h:22:13: note: previous declaration of 'uint64_t' was here ../arch/powerpc/boot/Makefile:210: recipe for target 'arch/powerpc/boot/fdt.o' failed make[2]: *** [arch/powerpc/boot/fdt.o] Error 1 The problem is that commit 656ad58ef19e (powerpc/boot: Add OPAL console to epapr wrappers) adds typedefs for uint32_t and uint64_t to type.h but doesn't remove the pre-existing (and now duplicate) typedefs from libfdt_env.h. Fix the error by removing the duplicat typedefs from libfdt_env.h CC: David Gibson <da...@gibson.dropbear.id.au> CC: Oliver O'Halloran <ooh...@gmail.com> Signed-off-by: Mark Greer <mgr...@animalcreek.com> --- Having said all of that, commit 656ad58ef19e (powerpc/boot: Add OPAL console to epapr wrappers) went into mainline back in 2016 so, AFAICT, this has been broken since then. That seems unlikely so I must be missing something... Any ideas what that is? I built all of the defconfigs that I had toolchains handy for (really just old-fashioned ppc32, non-booke) so I didn't test everything. Compile tested only as I no longer have any relevant hardware. Based on git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux fixes currently at e4b79900222b (powerpc/64s: Fix NULL AT_BASE_PLATFORM when using DT CPU features). arch/powerpc/boot/libfdt_env.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h index f52c31b1f48f..2a0c8b1bf147 100644 --- a/arch/powerpc/boot/libfdt_env.h +++ b/arch/powerpc/boot/libfdt_env.h @@ -7,8 +7,6 @@ #include "of.h" -typedef u32 uint32_t; -typedef u64 uint64_t; typedef unsigned long uintptr_t; typedef __be16 fdt16_t; -- 2.16.1