From patchwork Thu Jul 6 08:33:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 785043 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3x3B554VcWz9s75 for ; Thu, 6 Jul 2017 18:40:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 62704C21D71; Thu, 6 Jul 2017 08:39:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 6A07DC21F64; Thu, 6 Jul 2017 08:34:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BC0D9C21F64; Thu, 6 Jul 2017 08:33:32 +0000 (UTC) Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lists.denx.de (Postfix) with ESMTPS id ECFF4C21EC4 for ; Thu, 6 Jul 2017 08:33:28 +0000 (UTC) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 3x39x72mB3z9ttBk; Thu, 6 Jul 2017 10:33:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 3hUJls5kJ7UI; Thu, 6 Jul 2017 10:33:15 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 3x39x7286bz9ttBT; Thu, 6 Jul 2017 10:33:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 46D028B7A5; Thu, 6 Jul 2017 10:33:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id z_xts899k-uw; Thu, 6 Jul 2017 10:33:28 +0200 (CEST) Received: from pc13941vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.8]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1E7AD8B74B; Thu, 6 Jul 2017 10:33:28 +0200 (CEST) Received: by pc13941vm.idsi0.si.c-s.fr (Postfix, from userid 0) id EB20B69745; Thu, 6 Jul 2017 10:33:27 +0200 (CEST) Message-Id: <454b9707707edd8a7e522129046faceea5681e4e.1499329461.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy To: Wolfgang Denk , Heiko Schocher , Tom Rini Date: Thu, 6 Jul 2017 10:33:27 +0200 (CEST) Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 10/10] powerpc, 8xx: move Serial driver to drivers/serial/ X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At the same time, move to Kconfig Signed-off-by: Christophe Leroy --- README | 19 -------- arch/powerpc/cpu/mpc8xx/Makefile | 1 - drivers/serial/Kconfig | 53 ++++++++++++++++++++++ drivers/serial/Makefile | 1 + .../serial.c => drivers/serial/serial_mpc8xx.c | 23 ---------- scripts/config_whitelist.txt | 7 --- 6 files changed, 54 insertions(+), 50 deletions(-) rename arch/powerpc/cpu/mpc8xx/serial.c => drivers/serial/serial_mpc8xx.c (93%) diff --git a/README b/README index 0f204be0ca..c5ddf326b3 100644 --- a/README +++ b/README @@ -691,29 +691,10 @@ The following options need to be configured: Define this variable to enable hw flow control in serial driver. Current user of this option is drivers/serial/nsl16550.c driver -- Console Interface: - Depending on board, define exactly one serial port - (CONFIG_8xx_CONS_SMC1 or CONFIG_8xx_CONS_SMC2), - or switch off the serial console by defining - CONFIG_8xx_CONS_NONE - - Note: if CONFIG_8xx_CONS_NONE is defined, the serial - port routines must be defined elsewhere - (i.e. serial_init(), serial_getc(), ...) - - Console Baudrate: CONFIG_BAUDRATE - in bps Select one of the baudrates listed in CONFIG_SYS_BAUDRATE_TABLE, see below. - CONFIG_SYS_BRGCLK_PRESCALE, baudrate prescale - -- Console Rx buffer length - With CONFIG_SYS_SMC_RXBUFLEN it is possible to define - the maximum receive buffer length for the SMC. - This option is actual only for 8xx possible. - If using CONFIG_SYS_SMC_RXBUFLEN also CONFIG_SYS_MAXIDLE - must be defined, to setup the maximum idle timeout for - the SMC. - Autoboot Command: CONFIG_BOOTCOMMAND diff --git a/arch/powerpc/cpu/mpc8xx/Makefile b/arch/powerpc/cpu/mpc8xx/Makefile index 173cf01869..b40bffb047 100644 --- a/arch/powerpc/cpu/mpc8xx/Makefile +++ b/arch/powerpc/cpu/mpc8xx/Makefile @@ -13,5 +13,4 @@ obj-$(CONFIG_OF_LIBFDT) += fdt.o obj-$(CONFIG_CMD_IMMAP) += immap.o obj-y += interrupts.o obj-$(CONFIG_CMD_REGINFO) += reginfo.o -obj-y += serial.o obj-y += speed.o diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index c64f4a6d7b..b7dd2ac103 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -491,4 +491,57 @@ config STI_ASC_SERIAL on STiH410 SoC. This is a basic implementation, it supports following baudrate 9600, 19200, 38400, 57600 and 115200. +config MPC8XX_CONS + bool "Console driver for MPC8XX" + depends on 8xx + default y + +choice + prompt "Console port" + default 8xx_CONS_SMC1 + depends on MPC8XX_CONS + help + Depending on board, select one serial port + (CONFIG_8xx_CONS_SMC1 or CONFIG_8xx_CONS_SMC2) + +config 8xx_CONS_SMC1 + bool "SMC1" + +config 8xx_CONS_SMC2 + bool "SMC2" + +endchoice + +config SYS_SMC_RXBUFLEN + int "Console Rx buffer length" + depends on MPC8XX_CONS + default 1 + help + With CONFIG_SYS_SMC_RXBUFLEN it is possible to define + the maximum receive buffer length for the SMC. + This option is actual only for 8xx possible. + If using CONFIG_SYS_SMC_RXBUFLEN also CONFIG_SYS_MAXIDLE + must be defined, to setup the maximum idle timeout for + the SMC. + +config SYS_MAXIDLE + int "maximum idle timeout" + depends on MPC8XX_CONS + default 0 + +config SYS_BRGCLK_PRESCALE + int "BRG Clock Prescale" + depends on MPC8XX_CONS + default 1 + +config SYS_SDSR + hex "SDSR Value" + depends on MPC8XX_CONS + default 0x83 + +config SYS_SDMR + hex "SDMR Value" + depends on MPC8XX_CONS + default 0 + endmenu diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index dca31b295c..72a6996a0a 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -48,6 +48,7 @@ obj-$(CONFIG_STM32X7_SERIAL) += serial_stm32x7.o obj-$(CONFIG_BCM283X_MU_SERIAL) += serial_bcm283x_mu.o obj-$(CONFIG_MSM_SERIAL) += serial_msm.o obj-$(CONFIG_MVEBU_A3700_UART) += serial_mvebu_a3700.o +obj-$(CONFIG_MPC8XX_CONS) += serial_mpc8xx.o ifndef CONFIG_SPL_BUILD obj-$(CONFIG_USB_TTY) += usbtty.o diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/drivers/serial/serial_mpc8xx.c similarity index 93% rename from arch/powerpc/cpu/mpc8xx/serial.c rename to drivers/serial/serial_mpc8xx.c index 114dfe9b4b..26a8085a69 100644 --- a/arch/powerpc/cpu/mpc8xx/serial.c +++ b/drivers/serial/serial_mpc8xx.c @@ -14,8 +14,6 @@ DECLARE_GLOBAL_DATA_PTR; -#if !defined(CONFIG_8xx_CONS_NONE) /* No Console at all */ - #if defined(CONFIG_8xx_CONS_SMC1) /* Console on SMC1 */ #define SMC_INDEX 0 #define PROFF_SMC PROFF_SMC1 @@ -30,15 +28,6 @@ DECLARE_GLOBAL_DATA_PTR; #endif /* CONFIG_8xx_CONS_SMCx */ -#if !defined(CONFIG_SYS_SMC_RXBUFLEN) -#define CONFIG_SYS_SMC_RXBUFLEN 1 -#define CONFIG_SYS_MAXIDLE 0 -#else -#if !defined(CONFIG_SYS_MAXIDLE) -#error "you must define CONFIG_SYS_MAXIDLE" -#endif -#endif - struct serialbuffer { cbd_t rxbd; /* Rx BD */ cbd_t txbd; /* Tx BD */ @@ -56,9 +45,7 @@ static void serial_setdivisor(cpm8xx_t __iomem *cp) divisor = (50 * 1000 * 1000 + 8 * 9600) / 16 / 9600; } -#ifdef CONFIG_SYS_BRGCLK_PRESCALE divisor /= CONFIG_SYS_BRGCLK_PRESCALE; -#endif if (divisor <= 0x1000) out_be32(&cp->cp_brgc1, ((divisor - 1) << 1) | CPM_BRG_EN); @@ -110,18 +97,10 @@ static int smc_init(void) out_be32(&im->im_siu_conf.sc_sdcr, 1); /* clear error conditions */ -#ifdef CONFIG_SYS_SDSR out_8(&im->im_sdma.sdma_sdsr, CONFIG_SYS_SDSR); -#else - out_8(&im->im_sdma.sdma_sdsr, 0x83); -#endif /* clear SDMA interrupt mask */ -#ifdef CONFIG_SYS_SDMR out_8(&im->im_sdma.sdma_sdmr, CONFIG_SYS_SDMR); -#else - out_8(&im->im_sdma.sdma_sdmr, 0x00); -#endif /* Use Port B for SMCx instead of other functions. */ setbits_be32(&cp->cp_pbpar, IOPINS); @@ -275,5 +254,3 @@ void mpc8xx_serial_initialize(void) { serial_register(&serial_smc_device); } - -#endif /* CONFIG_8xx_CONS_NONE */ diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 43b44025dd..95f27b6ead 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -12,9 +12,6 @@ CONFIG_83XX_GENERIC_PCIE_REGISTER_HOSES CONFIG_83XX_PCICLK CONFIG_83XX_PCI_STREAMING CONFIG_88F5182 -CONFIG_8xx_CONS_NONE -CONFIG_8xx_CONS_SMC1 -CONFIG_8xx_CONS_SMC2 CONFIG_A003399_NOR_WORKAROUND CONFIG_A008044_WORKAROUND CONFIG_ACX517AKN @@ -2518,7 +2515,6 @@ CONFIG_SYS_BR6_64M CONFIG_SYS_BR6_8M CONFIG_SYS_BR6_PRELIM CONFIG_SYS_BR7_PRELIM -CONFIG_SYS_BRGCLK_PRESCALE CONFIG_SYS_BUSCLK CONFIG_SYS_CACHELINE_SHIFT CONFIG_SYS_CACHE_ACR0 @@ -4675,7 +4671,6 @@ CONFIG_SYS_SDIO_BASE0 CONFIG_SYS_SDIO_BASE1 CONFIG_SYS_SDIO_BASE2 CONFIG_SYS_SDIO_BASE3 -CONFIG_SYS_SDMR CONFIG_SYS_SDRAM CONFIG_SYS_SDRAM1 CONFIG_SYS_SDRAM_BASE @@ -4721,7 +4716,6 @@ CONFIG_SYS_SDRC_MR_VAL5 CONFIG_SYS_SDRC_TR_VAL CONFIG_SYS_SDRC_TR_VAL1 CONFIG_SYS_SDRC_TR_VAL2 -CONFIG_SYS_SDSR CONFIG_SYS_SD_VOLTAGE CONFIG_SYS_SEC_MON_ADDR CONFIG_SYS_SEC_MON_OFFSET @@ -4754,7 +4748,6 @@ CONFIG_SYS_SMC0_MODE0_VAL CONFIG_SYS_SMC0_PULSE0_VAL CONFIG_SYS_SMC0_SETUP0_VAL CONFIG_SYS_SMC_CSR0_VAL -CONFIG_SYS_SMC_RXBUFLEN CONFIG_SYS_SMI_BASE CONFIG_SYS_SPANSION_BASE CONFIG_SYS_SPANSION_BOOT