From 392b385d9d90c2a94911bf3a765ba85c9e96f42e Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 11 Dec 2019 09:39:36 +0000 Subject: [PATCH 1/5] mpc83xx: make ARCH_MPC8309 select SYS_FSL_ERRATUM_ESDHC111 The mpc8309 is also affected by the "Manual Asynchronous CMD12 abort operation causes protocol violations" erratum, though it is enumerated as eSDHC16 in the errata sheet for mpc8309. Signed-off-by: Rasmus Villemoes Reviewed-by: Mario Six --- arch/powerpc/cpu/mpc83xx/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig index 72053ceab4c..e9f6e93c213 100644 --- a/arch/powerpc/cpu/mpc83xx/Kconfig +++ b/arch/powerpc/cpu/mpc83xx/Kconfig @@ -220,6 +220,7 @@ config ARCH_MPC8309 select MPC83XX_QUICC_ENGINE select MPC83XX_PCI_SUPPORT select MPC83XX_SECOND_I2C_SUPPORT + select SYS_FSL_ERRATUM_ESDHC111 config ARCH_MPC831X bool From a3c1e0e067ffaef6d594a2dc1f2c37177ebf570a Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 12 Dec 2019 08:11:46 +0000 Subject: [PATCH 2/5] powerpc: mpc83xx: convert CONFIG_FSL_ELBC to Kconfig This complements commit 068789773d0 which did the conversion for mpc85xx. Signed-off-by: Rasmus Villemoes Reviewed-by: Mario Six --- arch/powerpc/cpu/mpc83xx/Kconfig | 7 +++++++ include/configs/MPC8313ERDB_NAND.h | 1 - include/configs/MPC8313ERDB_NOR.h | 1 - include/configs/MPC8315ERDB.h | 2 -- include/configs/MPC837XEMDS.h | 2 -- include/configs/MPC837XERDB.h | 2 -- include/configs/ids8313.h | 2 -- include/configs/ve8313.h | 1 - 8 files changed, 7 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/cpu/mpc83xx/Kconfig b/arch/powerpc/cpu/mpc83xx/Kconfig index e9f6e93c213..5d7650294dd 100644 --- a/arch/powerpc/cpu/mpc83xx/Kconfig +++ b/arch/powerpc/cpu/mpc83xx/Kconfig @@ -221,6 +221,7 @@ config ARCH_MPC8309 select MPC83XX_PCI_SUPPORT select MPC83XX_SECOND_I2C_SUPPORT select SYS_FSL_ERRATUM_ESDHC111 + select FSL_ELBC config ARCH_MPC831X bool @@ -232,6 +233,7 @@ config ARCH_MPC8313 bool select ARCH_MPC831X select MPC83XX_SECOND_I2C_SUPPORT + select FSL_ELBC config ARCH_MPC8315 bool @@ -239,6 +241,7 @@ config ARCH_MPC8315 select MPC83XX_PCIE1_SUPPORT select MPC83XX_PCIE2_SUPPORT select MPC83XX_SATA_SUPPORT + select FSL_ELBC config ARCH_MPC832X bool @@ -275,6 +278,7 @@ config ARCH_MPC837X select MPC83XX_SATA_SUPPORT select MPC83XX_LDP_PIN select MPC83XX_SECOND_I2C_SUPPORT + select FSL_ELBC config SYS_IMMR hex "Value for IMMR" @@ -318,6 +322,9 @@ endif endmenu +config FSL_ELBC + bool + source "board/esd/vme8349/Kconfig" source "board/freescale/mpc8308rdb/Kconfig" source "board/freescale/mpc8313erdb/Kconfig" diff --git a/include/configs/MPC8313ERDB_NAND.h b/include/configs/MPC8313ERDB_NAND.h index 4389d66dc0c..ea5762a5ef8 100644 --- a/include/configs/MPC8313ERDB_NAND.h +++ b/include/configs/MPC8313ERDB_NAND.h @@ -43,7 +43,6 @@ #endif #define CONFIG_PCI_INDIRECT_BRIDGE -#define CONFIG_FSL_ELBC 1 /* * On-board devices diff --git a/include/configs/MPC8313ERDB_NOR.h b/include/configs/MPC8313ERDB_NOR.h index 20aaa83f460..9d4a6716c76 100644 --- a/include/configs/MPC8313ERDB_NOR.h +++ b/include/configs/MPC8313ERDB_NOR.h @@ -19,7 +19,6 @@ #endif #define CONFIG_PCI_INDIRECT_BRIDGE -#define CONFIG_FSL_ELBC 1 /* * On-board devices diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h index 169d747af9b..5085a95635e 100644 --- a/include/configs/MPC8315ERDB.h +++ b/include/configs/MPC8315ERDB.h @@ -116,8 +116,6 @@ #define CONFIG_SYS_GBL_DATA_OFFSET \ (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) -#define CONFIG_FSL_ELBC - /* * FLASH on the Local Bus */ diff --git a/include/configs/MPC837XEMDS.h b/include/configs/MPC837XEMDS.h index f6420da21de..e5b411b12cb 100644 --- a/include/configs/MPC837XEMDS.h +++ b/include/configs/MPC837XEMDS.h @@ -134,8 +134,6 @@ #define CONFIG_SYS_GBL_DATA_OFFSET \ (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) -#define CONFIG_FSL_ELBC 1 - /* * FLASH on the Local Bus */ diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h index 1ba6f07e929..2ceb123a078 100644 --- a/include/configs/MPC837XERDB.h +++ b/include/configs/MPC837XERDB.h @@ -158,8 +158,6 @@ #define CONFIG_SYS_GBL_DATA_OFFSET \ (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) -#define CONFIG_FSL_ELBC 1 - /* * FLASH on the Local Bus */ diff --git a/include/configs/ids8313.h b/include/configs/ids8313.h index d37a5b7a4f5..b96d4e82adf 100644 --- a/include/configs/ids8313.h +++ b/include/configs/ids8313.h @@ -14,8 +14,6 @@ /* * High Level Configuration Options */ -#define CONFIG_FSL_ELBC - #define CONFIG_BOOT_RETRY_TIME 900 #define CONFIG_BOOT_RETRY_MIN 30 #define CONFIG_RESET_TO_RETRY diff --git a/include/configs/ve8313.h b/include/configs/ve8313.h index a31e6f4abe3..34726b94253 100644 --- a/include/configs/ve8313.h +++ b/include/configs/ve8313.h @@ -18,7 +18,6 @@ #define CONFIG_E300 1 #define CONFIG_PCI_INDIRECT_BRIDGE 1 -#define CONFIG_FSL_ELBC 1 /* * On-board devices From 375d817d9ed3eabed13b9ddfa6efad8e6430891c Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 12 Dec 2019 08:35:49 +0000 Subject: [PATCH 3/5] mpc83xx: immap_83xx: add spi8xxx_t in immap for mpc8309 Allow drivers/spi/mpc8xxx_spi.c to be built for an mpc8309 target. Signed-off-by: Rasmus Villemoes Reviewed-by: Mario Six --- arch/powerpc/include/asm/immap_83xx.h | 3 +-- arch/powerpc/include/asm/mpc8xxx_spi.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/immap_83xx.h b/arch/powerpc/include/asm/immap_83xx.h index d02da6495ce..609869c7154 100644 --- a/arch/powerpc/include/asm/immap_83xx.h +++ b/arch/powerpc/include/asm/immap_83xx.h @@ -941,8 +941,7 @@ typedef struct immap { u8 res4[0x500]; fsl_lbc_t im_lbc; /* Local Bus Controller Regs */ u8 res5[0x1000]; - u8 spi[0x100]; - u8 res6[0xf00]; + spi8xxx_t spi; /* Serial Peripheral Interface */ dma83xx_t dma; /* DMA */ pciconf83xx_t pci_conf[1]; /* PCI Configuration Registers */ u8 res7[0x80]; diff --git a/arch/powerpc/include/asm/mpc8xxx_spi.h b/arch/powerpc/include/asm/mpc8xxx_spi.h index b583a3269d6..470ee955f30 100644 --- a/arch/powerpc/include/asm/mpc8xxx_spi.h +++ b/arch/powerpc/include/asm/mpc8xxx_spi.h @@ -11,6 +11,7 @@ #include #if defined(CONFIG_ARCH_MPC8308) || \ + defined(CONFIG_ARCH_MPC8309) || \ defined(CONFIG_ARCH_MPC8313) || \ defined(CONFIG_ARCH_MPC8315) || \ defined(CONFIG_ARCH_MPC834X) || \ From 42a13a0b9faf88da332675c997f06a063fc77133 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 12 Dec 2019 09:18:52 +0000 Subject: [PATCH 4/5] mpc83xx: set MPC83XX_GPIO_CTRLRS to 2 for MPC8309 The MPC8309 has two gpio controllers (which is already correctly reflected in its struct immap definition). Signed-off-by: Rasmus Villemoes Reviewed-by: Mario Six --- arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/arch-mpc83xx/gpio.h b/arch/powerpc/include/asm/arch-mpc83xx/gpio.h index 385d651d200..8a6896e6229 100644 --- a/arch/powerpc/include/asm/arch-mpc83xx/gpio.h +++ b/arch/powerpc/include/asm/arch-mpc83xx/gpio.h @@ -9,7 +9,8 @@ #if defined(CONFIG_ARCH_MPC8313) || defined(CONFIG_ARCH_MPC8308) || \ defined(CONFIG_ARCH_MPC8315) #define MPC83XX_GPIO_CTRLRS 1 -#elif defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC837X) +#elif defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC837X) || \ + defined(CONFIG_ARCH_MPC8309) #define MPC83XX_GPIO_CTRLRS 2 #else #define MPC83XX_GPIO_CTRLRS 0 From fddf876a8f56ff53d1354387ebf7fd3997189349 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Thu, 19 Dec 2019 09:46:08 +0000 Subject: [PATCH 5/5] mpc83xx_clk: always treat MPC83XX_CLK_PCI as invalid The current mpc83xx_clk driver is broken for any board for which mpc83xx_has_pci() is true, i.e. anything not MPC8308: When is_clk_valid() reports that MPC83XX_CLK_PCI is valid, init_all_clks() proceeds to call init_single_clk(), but that doesn't know about either MPC83XX_CLK_PCI or has any handling of the TYPE_SCCR_ONOFF mode correctly returned by retrieve_mode(). Hence init_single_clk() ends up returning -EINVAL, and the whole board hangs in serial_init(). The quickest fix is to simply pretend that clock is invalid for all, since nobody can have been relying on it. Adding proper support seems to be a bit more involved than just handling TYPE_SCCR_ONOFF: - The power-on-reset value of SCCR[PCICM] is 0, so mpc83xx_clk_enable() would probably need to be tought to enable the clock. - The frequency of PCI_SYNC_OUT is either SYS_CLK_IN or SYS_CLK_IN/2 depending on the CFG_CLKIN_DIV configuration input, but that can't be read from software, so to properly fill out ->speed[MPC83XX_CLK_PCI] I think one would need guidance from Kconfig or dtb. Partially fixes: 07d538d281 clk: Add MPC83xx clock driver Signed-off-by: Rasmus Villemoes Reviewed-by: Mario Six --- drivers/clk/mpc83xx_clk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/clk/mpc83xx_clk.c b/drivers/clk/mpc83xx_clk.c index cbccda55943..69c6207e49a 100644 --- a/drivers/clk/mpc83xx_clk.c +++ b/drivers/clk/mpc83xx_clk.c @@ -66,7 +66,10 @@ static inline bool is_clk_valid(struct udevice *clk, int id) case MPC83XX_CLK_DMAC: return (type == SOC_MPC8308) || (type == SOC_MPC8309); case MPC83XX_CLK_PCI: - return mpc83xx_has_pci(type); + /* + * FIXME: implement proper support for this. + */ + return 0 && mpc83xx_has_pci(type); case MPC83XX_CLK_CSB: return true; case MPC83XX_CLK_I2C2: