misc: Add simple driver to enable the legacy UART on Winbond Super IO chips
Subsystems (2)
PATCH 1/3 misc: Add simple driver to enable the legacy UART on Winbond Super IO chips
On most x86 boards, the legacy serial ports (io address 0x3f8/0x2f8) are provided by a superio chip connected to the LPC bus. We must program the superio chip so that serial ports are available for us.
--- drivers/misc/Kconfig | 7 +++++++ drivers/misc/Makefile | 1 + drivers/misc/winbond_w83627.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/winbond_w83627.h | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 drivers/misc/winbond_w83627.c create mode 100644 include/winbond_w83627.h
drivers/misc/Kconfig +7 -0
@@ -112,4 +112,11 @@ config RESET effect a reset. The uclass will try all available drivers when reset_walk() is called. +config WINBOND_W83627 + bool "Enable Winbond legacy UART driver" + help + If you say Y here, you will get support for the Winbond + W83627 legacy UART driver. This can be used to enable the + legacy UART in the Winbond Super IO chips on X86 platforms. + endmenu
drivers/misc/Makefile +1 -0
@@ -38,3 +38,4 @@ obj-$(CONFIG_FSL_SEC_MON) += fsl_sec_mon.o obj-$(CONFIG_PCA9551_LED) += pca9551_led.o obj-$(CONFIG_RESET) += reset-uclass.o obj-$(CONFIG_FSL_DEVICE_DISABLE) += fsl_devdis.o +obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o
drivers/misc/winbond_w83627.c new file +41 -0
41 lines not on this page · raw message
include/winbond_w83627.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright (C) 2016 Stefan Roese <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _WINBOND_W83627_H_ +#define _WINBOND_W83627_H_ + +/* I/O address of Winbond Super IO chip */ +#define WINBOND_IO_PORT 0x2e + +/* Logical device number */ +#define W83627DHG_FDC 0/* Floppy */ +#define W83627DHG_PP 1/* Parallel port */ +#define W83627DHG_SP1 2/* Com1 */ +#define W83627DHG_SP2 3/* Com2 */ +#define W83627DHG_KBC 5/* PS/2 keyboard & mouse */ +#define W83627DHG_SPI 6/* Serial peripheral interface */ +#define W83627DHG_WDTO_PLED 8/* WDTO#, PLED */ +#define W83627DHG_ACPI 10/* ACPI */ +#define W83627DHG_HWM 11/* Hardware monitor */ +#define W83627DHG_PECI_SST 12/* PECI, SST */ + +/** +* Configure the base I/O port of the specified serial device and enable the +* serial device. +* +* @dev: high 8 bits = super I/O port, low 8 bits = logical device number +* @iobase: processor I/O port address to assign to this serial device +* @irq: processor IRQ number to assign to this serial device +*/ +void winbond_enable_serial (uint dev,uint iobase,uint irq); + +#endif /* _WINBOND_W83627_H_ */
Signature · 1 line
2.6.5
PATCH 2/3 x86: BayTrail: Add function to disable the internal legacy UART
Some BayTrail boards may want to use a different legacy UART than the internal one. E.g. one provided by a Winbond Super IO chip, like the W83627. This patch adds a function to disable this BayTrail internal UART for this purpose.
--- arch/x86/cpu/baytrail/early_uart.c | 9 +++++++++ arch/x86/include/asm/u-boot-x86.h | 3 +++ 2 files changed, 12 insertions(+)
arch/x86/cpu/baytrail/early_uart.c +9 -0
@@ -76,3 +76,12 @@ int setup_early_uart(void)return 0 ; } + +int disable_internal_uart (void ) +{ +/* Disable the legacy UART hardware. */ +x86_pci_write_config32 (PCI_DEV_CONFIG (0 ,LPC_DEV ,LPC_FUNC ),UART_CONT , +0 ); + +return 0 ; +}
arch/x86/include/asm/u-boot-x86.h +3 -0
@@ -47,6 +47,9 @@ int default_print_cpuinfo(void);/* Set up a UART which can be used with printch(), printhex8(), etc. */ int setup_early_uart (void ); +/* Disable the internal legacy UART */ +int disable_internal_uart (void ); +void setup_pcat_compatibility (void );void isa_unmap_rom (u32 addr);
Signature · 1 line
2.6.5
PATCH 3/3 x86: fsp: Disable legacy internal UART if necessary
In reply to Stefan RoeseThe FSP enables the BayTrail internal UART (again). Boards that don't use this UART but an external one instead (e.g. provided by a Super IO chip) need to disable this internal UART. So that the one from the Super IO chip can be used. This patch adds the necessary code, to disable the internal legacy UART if the Winbond Super IO chip is enabled.
--- arch/x86/lib/fsp/fsp_support.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/x86/lib/fsp/fsp_support.c +14 -0
@@ -89,6 +89,13 @@ struct fsp_header *__attribute__((optimize("O0"))) find_fsp_header(void)void fsp_continue (u32 status,void *hob_list) { +/* +* The FSP enables the BayTrail internal legacy UART (again). +* Disable it again, so that the Winbond one can be used. +*/ +if (IS_ENABLED (CONFIG_WINBOND_W83627 )) +disable_internal_uart (); +post_code (POST_MRC );assert (status ==0 );
@@ -114,6 +121,13 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)setup_early_uart ();#endif +/* +* To use the Winbond legacy UART (COM1), the BayTrail internal +* legacy UART needs to get disabled first. +*/ +if (IS_ENABLED (CONFIG_WINBOND_W83627 )) +disable_internal_uart (); + fsp_hdr =find_fsp_header ();if (fsp_hdr ==NULL ) {/* No valid FSP info header was found */
Signature · 1 line
2.6.5
PATCH 1/3 misc: Add simple driver to enable the legacy UART on Winbond Super IO chips
In reply to Stefan RoeseHi Stefan,
Quoted 21 lines · Stefan Roese
On most x86 boards, the legacy serial ports (io address 0x3f8/0x2f8) are provided by a superio chip connected to the LPC bus. We must program the superio chip so that serial ports are available for us.
Signed-off-by Stefan Roese <[email protected]>Cc Bin Meng <[email protected]>Cc Simon Glass <[email protected]>--- drivers/misc/Kconfig | 7 +++++++ drivers/misc/Makefile | 1 + drivers/misc/winbond_w83627.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/winbond_w83627.h | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 drivers/misc/winbond_w83627.c create mode 100644 include/winbond_w83627.hdrivers/misc/Kconfig +0
-0
drivers/misc/Kconfig config RESET · line 116
Quoted 5 lines
drivers/misc/Kconfig +2
-0@@ -112,4 +112,11 @@ config RESET effect a reset. The uclass will try all available drivers when reset_walk() is called. +config WINBOND_W83627 + bool "Enable Winbond legacy UART driver"
Winbond 83627 Super I/O driver? As we may extend its support in the future so that it is not only for legacy UART.
Quoted 23 lines
drivers/misc/Kconfig +5
-0+ help + If you say Y here, you will get support for the Winbond + W83627 legacy UART driver. This can be used to enable the + legacy UART in the Winbond Super IO chips on X86 platforms. + endmenudrivers/misc/Makefile +1
-0@@ -38,3 +38,4 @@ obj-$(CONFIG_FSL_SEC_MON) += fsl_sec_mon.o obj-$(CONFIG_PCA9551_LED) += pca9551_led.o obj-$(CONFIG_RESET) += reset-uclass.o obj-$(CONFIG_FSL_DEVICE_DISABLE) += fsl_devdis.o +obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.odrivers/misc/winbond_w83627.c new file +2
-0@@ -0,0 +1,41 @@ +/* +* Copyright (C) 2016 Stefan Roese <[email protected]>
drivers/misc/winbond_w83627.c line 12
Quoted 10 lines
drivers/misc/winbond_w83627.c new file +10
-0+* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/pnp_def.h> + +#define WINBOND_ENTRY_KEY 0x87 +#define WINBOND_EXIT_KEY 0xAA
nits: use lower case 0xaa
drivers/misc/winbond_w83627.c line 14
Quoted 2 lines
drivers/misc/winbond_w83627.c new file +2
-0+ +/* Enable configuration: pass entry key '0x87' into index port dev. */
nits: please remove the ending period. please fix this globally.
And based on the codes below, probably it's better to say: pass entry key '0x87' into index port dev _twice_?
Quoted 59 lines
drivers/misc/winbond_w83627.c new file +27
-0+static void pnp_enter_conf_state (u16 dev) +{ +u16 port = dev >>8 ; + +outb (WINBOND_ENTRY_KEY , port); +outb (WINBOND_ENTRY_KEY , port); +} + +/* Disable configuration: pass exit key '0xAA' into index port dev. */ +static void pnp_exit_conf_state (u16 dev) +{ +u16 port = dev >>8 ; + +outb (WINBOND_EXIT_KEY , port); +} + +/* Bring up early serial debugging output before the RAM is initialized. */ +void winbond_enable_serial (uint dev,uint iobase,uint irq) +{ +pnp_enter_conf_state (dev); +pnp_set_logical_device (dev); +pnp_set_enable (dev,0 ); +pnp_set_iobase (dev,PNP_IDX_IO0 , iobase); +pnp_set_irq (dev,PNP_IDX_IRQ0 , irq); +pnp_set_enable (dev,1 ); +pnp_exit_conf_state (dev); +}include/winbond_w83627.h new file +26
-0@@ -0,0 +1,35 @@ +/* +* Copyright (C) 2016 Stefan Roese <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _WINBOND_W83627_H_ +#define _WINBOND_W83627_H_ + +/* I/O address of Winbond Super IO chip */ +#define WINBOND_IO_PORT 0x2e + +/* Logical device number */ +#define W83627DHG_FDC 0/* Floppy */ +#define W83627DHG_PP 1/* Parallel port */ +#define W83627DHG_SP1 2/* Com1 */ +#define W83627DHG_SP2 3/* Com2 */ +#define W83627DHG_KBC 5/* PS/2 keyboard & mouse */ +#define W83627DHG_SPI 6/* Serial peripheral interface */ +#define W83627DHG_WDTO_PLED 8/* WDTO#, PLED */ +#define W83627DHG_ACPI 10/* ACPI */ +#define W83627DHG_HWM 11/* Hardware monitor */ +#define W83627DHG_PECI_SST 12/* PECI, SST */ + +/** +* Configure the base I/O port of the specified serial device and enable the
include/winbond_w83627.h
Quoted 10 lines
include/winbond_w83627.h new file +9
-1+* serial device. +* +* @dev: high 8 bits = super I/O port, low 8 bits = logical device number +* @iobase: processor I/O port address to assign to this serial device +* @irq: processor IRQ number to assign to this serial device +*/ +void winbond_enable_serial (uint dev,uint iobase,uint irq); + +#endif /* _WINBOND_W83627_H_ */ --
Regards,
Bin
PATCH 2/3 x86: BayTrail: Add function to disable the internal legacy UART
In reply to Stefan RoeseHi Stefan,
Quoted 18 lines · Stefan Roese
Some BayTrail boards may want to use a different legacy UART than the internal one. E.g. one provided by a Winbond Super IO chip, like the W83627. This patch adds a function to disable this BayTrail internal UART for this purpose.
Signed-off-by Stefan Roese <[email protected]>Cc Bin Meng <[email protected]>Cc Simon Glass <[email protected]>--- arch/x86/cpu/baytrail/early_uart.c | 9 +++++++++ arch/x86/include/asm/u-boot-x86.h | 3 +++ 2 files changed, 12 insertions(+)arch/x86/cpu/baytrail/early_uart.c +0
-0
arch/x86/cpu/baytrail/early_uart.c int setup_early_uart(void) · line 82
Quoted 7 lines
arch/x86/cpu/baytrail/early_uart.c +4
-0@@ -76,3 +76,12 @@ int setup_early_uart(void)return 0 ; } + +int disable_internal_uart (void ) +{ +/* Disable the legacy UART hardware. */
nits: please remove the ending peirod.
Quoted 10 lines
arch/x86/cpu/baytrail/early_uart.c +5
-0+x86_pci_write_config32 (PCI_DEV_CONFIG (0 ,LPC_DEV ,LPC_FUNC ),UART_CONT , +0 ); + +return 0 ; +}arch/x86/include/asm/u-boot-x86.h +0
-0
arch/x86/include/asm/u-boot-x86.h int default_print_cpuinfo(void);
Quoted 10 lines
arch/x86/include/asm/u-boot-x86.h +3
-1@@ -47,6 +47,9 @@ int default_print_cpuinfo(void);/* Set up a UART which can be used with printch(), printhex8(), etc. */ int setup_early_uart (void ); +/* Disable the internal legacy UART */ +int disable_internal_uart (void ); +void setup_pcat_compatibility (void );void isa_unmap_rom (u32 addr); --
PATCH 3/3 x86: fsp: Disable legacy internal UART if necessary
In reply to Stefan RoeseHi Stefan,
Quoted 18 lines · Stefan Roese
The FSP enables the BayTrail internal UART (again). Boards that don't use this UART but an external one instead (e.g. provided by a Super IO chip) need to disable this internal UART. So that the one from the Super IO chip can be used. This patch adds the necessary code, to disable the internal legacy UART if the Winbond Super IO chip is enabled.
Signed-off-by Stefan Roese <[email protected]>Cc Bin Meng <[email protected]>Cc Simon Glass <[email protected]>--- arch/x86/lib/fsp/fsp_support.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)arch/x86/lib/fsp/fsp_support.c +0
-0
arch/x86/lib/fsp/fsp_support.c struct fsp_header *__attribute__((optimize("O0"))) find_fsp_header(void) · line 98
Quoted 10 lines
arch/x86/lib/fsp/fsp_support.c +7
-0@@ -89,6 +89,13 @@ struct fsp_header *__attribute__((optimize("O0"))) find_fsp_header(void)void fsp_continue (u32 status,void *hob_list) { +/* +* The FSP enables the BayTrail internal legacy UART (again). +* Disable it again, so that the Winbond one can be used. +*/ +if (IS_ENABLED (CONFIG_WINBOND_W83627 )) +disable_internal_uart (); +
I would put this into the board_init_f(), right before enabling super I/O legacy UART. This way we avoid changing the generic FSP codes.
Quoted 4 lines
arch/x86/lib/fsp/fsp_support.c +0
-0post_code (POST_MRC );assert (status ==0 );
arch/x86/lib/fsp/fsp_support.c void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf) · line 130
Quoted 10 lines
arch/x86/lib/fsp/fsp_support.c +7
-0@@ -114,6 +121,13 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)setup_early_uart ();#endif +/* +* To use the Winbond legacy UART (COM1), the BayTrail internal +* legacy UART needs to get disabled first. +*/ +if (IS_ENABLED (CONFIG_WINBOND_W83627 )) +disable_internal_uart (); +
I don't think this change is needed as fsp_init() will enable legacy UART anyway.
arch/x86/lib/fsp/fsp_support.c void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
Quoted 4 lines
arch/x86/lib/fsp/fsp_support.c +0
-1fsp_hdr =find_fsp_header ();if (fsp_hdr ==NULL ) {/* No valid FSP info header was found */ --
Regards,
Bin
PATCH 2/3 x86: BayTrail: Add function to disable the internal legacy UART
In reply to Bin MengHi Stefan,
Quoted 44 lines · Bin Meng
Hi Stefan,
Quoted 18 lines · Stefan Roese
Some BayTrail boards may want to use a different legacy UART than the internal one. E.g. one provided by a Winbond Super IO chip, like the W83627. This patch adds a function to disable this BayTrail internal UART for this purpose.
Signed-off-by Stefan Roese <[email protected]>Cc Bin Meng <[email protected]>Cc Simon Glass <[email protected]>--- arch/x86/cpu/baytrail/early_uart.c | 9 +++++++++ arch/x86/include/asm/u-boot-x86.h | 3 +++ 2 files changed, 12 insertions(+)arch/x86/cpu/baytrail/early_uart.c +0
-0arch/x86/cpu/baytrail/early_uart.c int setup_early_uart(void) · line 82
Quoted 7 lines
arch/x86/cpu/baytrail/early_uart.c +4
-0@@ -76,3 +76,12 @@ int setup_early_uart(void)return 0 ; } + +int disable_internal_uart (void ) +{ +/* Disable the legacy UART hardware. */ nits: please remove the ending peirod.
Quoted 13 lines
arch/x86/cpu/baytrail/early_uart.c +5
-0+x86_pci_write_config32 (PCI_DEV_CONFIG (0 ,LPC_DEV ,LPC_FUNC ),UART_CONT , +0 ); + +return 0 ; +}arch/x86/include/asm/u-boot-x86.h +0
-0@@ -47,6 +47,9 @@ int default_print_cpuinfo(void);/* Set up a UART which can be used with printch(), printhex8(), etc. */ int setup_early_uart (void );
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h int default_print_cpuinfo(void); · line 51
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h +2
-0+/* Disable the internal legacy UART */ +int disable_internal_uart (void );
If we can call disable_internal_uart() in board-specific codes, then this declaration can be moved to SoC-specific header instead of x86 generic one.
Quoted 7 lines
arch/x86/include/asm/u-boot-x86.h int default_print_cpuinfo(void);
Quoted 5 lines
arch/x86/include/asm/u-boot-x86.h +1
-1+void setup_pcat_compatibility (void );void isa_unmap_rom (u32 addr); --Reviewed-by Bin Meng <[email protected]>
Regards,
Bin
PATCH 2/3 x86: BayTrail: Add function to disable the internal legacy UART
Hi Bin,
Quoted 45 lines · Bin Meng
Quoted 44 lines · Bin Meng
Hi Stefan,
Quoted 18 lines · Stefan Roese
Some BayTrail boards may want to use a different legacy UART than the internal one. E.g. one provided by a Winbond Super IO chip, like the W83627. This patch adds a function to disable this BayTrail internal UART for this purpose.
Signed-off-by Stefan Roese <[email protected]>Cc Bin Meng <[email protected]>Cc Simon Glass <[email protected]>--- arch/x86/cpu/baytrail/early_uart.c | 9 +++++++++ arch/x86/include/asm/u-boot-x86.h | 3 +++ 2 files changed, 12 insertions(+)arch/x86/cpu/baytrail/early_uart.c +0
-0arch/x86/cpu/baytrail/early_uart.c int setup_early_uart(void) · line 82
Quoted 7 lines
arch/x86/cpu/baytrail/early_uart.c +4
-0@@ -76,3 +76,12 @@ int setup_early_uart(void)return 0 ; } + +int disable_internal_uart (void ) +{ +/* Disable the legacy UART hardware. */ nits: please remove the ending peirod.
Quoted 13 lines
arch/x86/cpu/baytrail/early_uart.c +5
-0+x86_pci_write_config32 (PCI_DEV_CONFIG (0 ,LPC_DEV ,LPC_FUNC ),UART_CONT , +0 ); + +return 0 ; +}arch/x86/include/asm/u-boot-x86.h +0
-0@@ -47,6 +47,9 @@ int default_print_cpuinfo(void);/* Set up a UART which can be used with printch(), printhex8(), etc. */ int setup_early_uart (void );
Quoted 6 lines
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h int default_print_cpuinfo(void); · line 51
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h +2
-0+/* Disable the internal legacy UART */ +int disable_internal_uart (void );If we can call
disable_internal_uart()in board-specific codes, then this declaration can be moved to SoC-specific header instead of x86 generic one.
Let me check if your suggestion to patch 3/3 works and I'll re-spin the patch series.
Thanks for the review,
Stefan
PATCH 3/3 x86: fsp: Disable legacy internal UART if necessary
In reply to Bin MengHi Bin,
Quoted 42 lines · Bin Meng
Hi Stefan,
Quoted 18 lines · Stefan Roese
The FSP enables the BayTrail internal UART (again). Boards that don't use this UART but an external one instead (e.g. provided by a Super IO chip) need to disable this internal UART. So that the one from the Super IO chip can be used. This patch adds the necessary code, to disable the internal legacy UART if the Winbond Super IO chip is enabled.
Signed-off-by Stefan Roese <[email protected]>Cc Bin Meng <[email protected]>Cc Simon Glass <[email protected]>--- arch/x86/lib/fsp/fsp_support.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)arch/x86/lib/fsp/fsp_support.c +0
-0arch/x86/lib/fsp/fsp_support.c struct fsp_header *__attribute__((optimize("O0"))) find_fsp_header(void) · line 98
Quoted 10 lines
arch/x86/lib/fsp/fsp_support.c +7
-0@@ -89,6 +89,13 @@ struct fsp_header *__attribute__((optimize("O0"))) find_fsp_header(void)void fsp_continue (u32 status,void *hob_list) { +/* +* The FSP enables the BayTrail internal legacy UART (again). +* Disable it again, so that the Winbond one can be used. +*/ +if (IS_ENABLED (CONFIG_WINBOND_W83627 )) +disable_internal_uart (); +I would put this into the
board_init_f(), right before enabling super I/O legacy UART. This way we avoid changing the generic FSP codes.Quoted 7 lines
arch/x86/lib/fsp/fsp_support.c +0
-0post_code (POST_MRC );assert (status ==0 );@@ -114,6 +121,13 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)setup_early_uart ();#endif
Quoted 10 lines
arch/x86/lib/fsp/fsp_support.c void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf) · line 130
Quoted 7 lines
arch/x86/lib/fsp/fsp_support.c +7
-0+/* +* To use the Winbond legacy UART (COM1), the BayTrail internal +* legacy UART needs to get disabled first. +*/ +if (IS_ENABLED (CONFIG_WINBOND_W83627 )) +disable_internal_uart (); +I don't think this change is needed as
fsp_init()will enable legacy UART anyway.
You are correct. This patch is not needed at all, when I move the call to disable_internal_uart() to the board specific code.
So I withdraw this patch and will send updated versions of the other 2 patches.
Thanks,
Stefan
PATCH 2/3 x86: BayTrail: Add function to disable the internal legacy UART
In reply to Bin MengHi Bin,
(added Simon again to Cc)
Quoted 47 lines · Bin Meng
Hi Stefan,
Quoted 44 lines · Bin Meng
Hi Stefan,
Quoted 18 lines · Stefan Roese
Some BayTrail boards may want to use a different legacy UART than the internal one. E.g. one provided by a Winbond Super IO chip, like the W83627. This patch adds a function to disable this BayTrail internal UART for this purpose.
Signed-off-by Stefan Roese <[email protected]>Cc Bin Meng <[email protected]>Cc Simon Glass <[email protected]>--- arch/x86/cpu/baytrail/early_uart.c | 9 +++++++++ arch/x86/include/asm/u-boot-x86.h | 3 +++ 2 files changed, 12 insertions(+)arch/x86/cpu/baytrail/early_uart.c +0
-0arch/x86/cpu/baytrail/early_uart.c int setup_early_uart(void) · line 82
Quoted 7 lines
arch/x86/cpu/baytrail/early_uart.c +4
-0@@ -76,3 +76,12 @@ int setup_early_uart(void)return 0 ; } + +int disable_internal_uart (void ) +{ +/* Disable the legacy UART hardware. */ nits: please remove the ending peirod.
Quoted 13 lines
arch/x86/cpu/baytrail/early_uart.c +5
-0+x86_pci_write_config32 (PCI_DEV_CONFIG (0 ,LPC_DEV ,LPC_FUNC ),UART_CONT , +0 ); + +return 0 ; +}arch/x86/include/asm/u-boot-x86.h +0
-0@@ -47,6 +47,9 @@ int default_print_cpuinfo(void);/* Set up a UART which can be used with printch(), printhex8(), etc. */ int setup_early_uart (void );
Quoted 6 lines
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h int default_print_cpuinfo(void); · line 51
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h +2
-0+/* Disable the internal legacy UART */ +int disable_internal_uart (void );If we can call
disable_internal_uart()in board-specific codes, then this declaration can be moved to SoC-specific header instead of x86 generic one.
Do you have a preferred header for this in mind?
Another idea would be, to add a parameter to the existing function setup_early_uart() to either enable or disable the internal UART:
Like this:
int setup_early_uart(int enable)
{
/* Enable the legacy UART hardware. */
x86_pci_write_config32(PCI_DEV_CONFIG(0, LPC_DEV, LPC_FUNC), UART_CONT,
enable);
if (!enable)
return 0;
...What do you think? Should I change it this way?
Thanks,
Stefan
PATCH 2/3 x86: BayTrail: Add function to disable the internal legacy UART
Hi Stefan,
Quoted 52 lines · Stefan Roese
Hi Bin,
(added Simon again to Cc)
Quoted 47 lines · Bin Meng
Hi Stefan,
Quoted 44 lines · Bin Meng
Hi Stefan,
Quoted 18 lines · Stefan Roese
Some BayTrail boards may want to use a different legacy UART than the internal one. E.g. one provided by a Winbond Super IO chip, like the W83627. This patch adds a function to disable this BayTrail internal UART for this purpose.
Signed-off-by Stefan Roese <[email protected]>Cc Bin Meng <[email protected]>Cc Simon Glass <[email protected]>--- arch/x86/cpu/baytrail/early_uart.c | 9 +++++++++ arch/x86/include/asm/u-boot-x86.h | 3 +++ 2 files changed, 12 insertions(+)arch/x86/cpu/baytrail/early_uart.c +0
-0arch/x86/cpu/baytrail/early_uart.c int setup_early_uart(void) · line 82
Quoted 7 lines
arch/x86/cpu/baytrail/early_uart.c +4
-0@@ -76,3 +76,12 @@ int setup_early_uart(void)return 0 ; } + +int disable_internal_uart (void ) +{ +/* Disable the legacy UART hardware. */ nits: please remove the ending peirod.
Quoted 13 lines
arch/x86/cpu/baytrail/early_uart.c +5
-0+x86_pci_write_config32 (PCI_DEV_CONFIG (0 ,LPC_DEV ,LPC_FUNC ),UART_CONT , +0 ); + +return 0 ; +}arch/x86/include/asm/u-boot-x86.h +0
-0@@ -47,6 +47,9 @@ int default_print_cpuinfo(void);/* Set up a UART which can be used with printch(), printhex8(), etc. */ int setup_early_uart (void );
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h int default_print_cpuinfo(void); · line 51
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h +2
-0+/* Disable the internal legacy UART */ +int disable_internal_uart (void );If we can call
disable_internal_uart()in board-specific codes, then this declaration can be moved to SoC-specific header instead of x86 generic one.Do you have a preferred header for this in mind?
How about arch/x86/include/asm/arch-baytrail/baytrail.h?
Quoted 14 lines
Another idea would be, to add a parameter to the existing function
setup_early_uart()to either enable or disable the internal UART:Like this:
int
setup_early_uart(int enable){ /* Enable the legacy UART hardware. */ x86_pci_write_config32(PCI_DEV_CONFIG(0, LPC_DEV, LPC_FUNC), UART_CONT, enable); if (!enable) return 0; ...
Quoted 2 lines
What do you think? Should I change it this way?
The issue with setup_early_uart() is that it is only called when CONFIG_DEBUG_UART is on. I think CONFIG_DEBUG_UART is only for debug purpose IOW it's still legal to have a U-Boot booting without CONFIG_DEBUG_UART.
Regards,
Bin
PATCH 2/3 x86: BayTrail: Add function to disable the internal legacy UART
Hi Bin,
Quoted 79 lines · Bin Meng
Quoted 52 lines · Stefan Roese
Hi Bin,
(added Simon again to Cc)
Quoted 47 lines · Bin Meng
Hi Stefan,
Quoted 44 lines · Bin Meng
Hi Stefan,
Quoted 18 lines · Stefan Roese
Some BayTrail boards may want to use a different legacy UART than the internal one. E.g. one provided by a Winbond Super IO chip, like the W83627. This patch adds a function to disable this BayTrail internal UART for this purpose.
Signed-off-by Stefan Roese <[email protected]>Cc Bin Meng <[email protected]>Cc Simon Glass <[email protected]>--- arch/x86/cpu/baytrail/early_uart.c | 9 +++++++++ arch/x86/include/asm/u-boot-x86.h | 3 +++ 2 files changed, 12 insertions(+)arch/x86/cpu/baytrail/early_uart.c +0
-0arch/x86/cpu/baytrail/early_uart.c int setup_early_uart(void) · line 82
Quoted 7 lines
arch/x86/cpu/baytrail/early_uart.c +4
-0@@ -76,3 +76,12 @@ int setup_early_uart(void)return 0 ; } + +int disable_internal_uart (void ) +{ +/* Disable the legacy UART hardware. */ nits: please remove the ending peirod.
Quoted 13 lines
arch/x86/cpu/baytrail/early_uart.c +5
-0+x86_pci_write_config32 (PCI_DEV_CONFIG (0 ,LPC_DEV ,LPC_FUNC ),UART_CONT , +0 ); + +return 0 ; +}arch/x86/include/asm/u-boot-x86.h +0
-0@@ -47,6 +47,9 @@ int default_print_cpuinfo(void);/* Set up a UART which can be used with printch(), printhex8(), etc. */ int setup_early_uart (void );Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h int default_print_cpuinfo(void); · line 51
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h +2
-0+/* Disable the internal legacy UART */ +int disable_internal_uart (void );If we can call
disable_internal_uart()in board-specific codes, then this declaration can be moved to SoC-specific header instead of x86 generic one.Do you have a preferred header for this in mind?
How about
arch/x86/include/asm/arch-baytrail/baytrail.h?Quoted 14 lines
Another idea would be, to add a parameter to the existing function
setup_early_uart()to either enable or disable the internal UART:Like this:
int
setup_early_uart(int enable){ /* Enable the legacy UART hardware. */ x86_pci_write_config32(PCI_DEV_CONFIG(0, LPC_DEV, LPC_FUNC), UART_CONT, enable); if (!enable) return 0; ...
Quoted 5 lines
Quoted 2 lines
What do you think? Should I change it this way?
The issue with
setup_early_uart()is that it is only called whenCONFIG_DEBUG_UARTis on.
In fsp_init(), yes. But I can nevertheless call it from the board specific code in my case to *disable* the internal legacy UART.
Quoted 3 lines
I think
CONFIG_DEBUG_UARTis only for debug
purpose IOW it's still legal to have a U-Boot booting withoutCONFIG_DEBUG_UART.
Correct. But as mentioned above, I can call it from my board code before the Windond enable function to disable the internal UART (when changed to provide this functionality as suggested in the last mail).
Or am I missing something? The function naming would be not really matching its purpose any more. Perhaps I should also rename it to setup_internal_uart() instead?
Thanks,
Stefan
PATCH 2/3 x86: BayTrail: Add function to disable the internal legacy UART
Hi Stefan,
Quoted 99 lines · Stefan Roese
Hi Bin,
Quoted 95 lines · Bin Meng
Quoted 70 lines · Stefan Roese
Hi Bin,
(added Simon again to Cc)
Quoted 55 lines · Bin Meng
Hi Stefan,
Quoted 51 lines · Bin Meng
Hi Stefan,
Quoted 20 lines · Stefan Roese
Some BayTrail boards may want to use a different legacy UART than the internal one. E.g. one provided by a Winbond Super IO chip, like the W83627. This patch adds a function to disable this BayTrail internal UART for this purpose.
Signed-off-by Stefan Roese <[email protected]>Cc Bin Meng <[email protected]>Cc Simon Glass <[email protected]>--- arch/x86/cpu/baytrail/early_uart.c | 9 +++++++++ arch/x86/include/asm/u-boot-x86.h | 3 +++ 2 files changed, 12 insertions(+)arch/x86/cpu/baytrail/early_uart.c +0
-0arch/x86/cpu/baytrail/early_uart.c int setup_early_uart(void) · line 82
Quoted 7 lines
arch/x86/cpu/baytrail/early_uart.c +4
-0@@ -76,3 +76,12 @@ int setup_early_uart(void)return 0 ; } + +int disable_internal_uart (void ) +{ +/* Disable the legacy UART hardware. */ nits: please remove the ending peirod.
Quoted 16 lines
arch/x86/cpu/baytrail/early_uart.c +1
-0+ x86_pci_write_config32(PCI_DEV_CONFIG(0, LPC_DEV, LPC_FUNC),
UART_CONT,arch/x86/cpu/baytrail/early_uart.c +4
-0+ 0); + +return 0 ; +}arch/x86/include/asm/u-boot-x86.h +0
-0@@ -47,6 +47,9 @@ int default_print_cpuinfo(void);/* Set up a UART which can be used with printch(), printhex8(), etc. */
intsetup_early_uart(void);Quoted 7 lines
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h int default_print_cpuinfo(void); · line 51
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h +2
-0+/* Disable the internal legacy UART */ +int disable_internal_uart (void );If we can call
disable_internal_uart()in board-specific codes, then this declaration can be moved to SoC-specific header instead of x86 generic one.Quoted 2 lines
Do you have a preferred header for this in mind?
How about
arch/x86/include/asm/arch-baytrail/baytrail.h?Quoted 17 lines
Another idea would be, to add a parameter to the existing function
setup_early_uart()to either enable or disable the internal UART:Like this:
int
setup_early_uart(int enable){ /* Enable the legacy UART hardware. */ x86_pci_write_config32(PCI_DEV_CONFIG(0, LPC_DEV, LPC_FUNC), UART_CONT, enable); if (!enable) return 0; ...What do you think? Should I change it this way?
Quoted 8 lines
Quoted 2 lines
The issue with
setup_early_uart()is that it is only called whenCONFIG_DEBUG_UARTis on.In
fsp_init(), yes. But I can nevertheless call it from the board specific code in my case to *disable* the internal legacy UART.
Ah, yes! I thought you wanted to use the existing call.
Quoted 10 lines
Quoted 3 lines
I think
CONFIG_DEBUG_UARTis only for debug
purpose IOW it's still legal to have a U-Boot booting withoutCONFIG_DEBUG_UART.Correct. But as mentioned above, I can call it from my board code before the Windond enable function to disable the internal UART (when changed to provide this functionality as suggested in the last mail).
Yes.
Quoted 4 lines
Or am I missing something? The function naming would be not really matching its purpose any more. Perhaps I should also rename it to
setup_internal_uart()instead?
Yep, makes sense. Let's see how Simon thinks.
Regards,
Bin
PATCH 2/3 x86: BayTrail: Add function to disable the internal legacy UART
Hi Bin,
Quoted 124 lines · Bin Meng
Hi Stefan,
Quoted 99 lines · Stefan Roese
Hi Bin,
Quoted 95 lines · Bin Meng
Quoted 70 lines · Stefan Roese
Hi Bin,
(added Simon again to Cc)
Quoted 55 lines · Bin Meng
Hi Stefan,
Quoted 51 lines · Bin Meng
Hi Stefan,
Quoted 20 lines · Stefan Roese
Some BayTrail boards may want to use a different legacy UART than the internal one. E.g. one provided by a Winbond Super IO chip, like the W83627. This patch adds a function to disable this BayTrail internal UART for this purpose.
Signed-off-by Stefan Roese <[email protected]>Cc Bin Meng <[email protected]>Cc Simon Glass <[email protected]>--- arch/x86/cpu/baytrail/early_uart.c | 9 +++++++++ arch/x86/include/asm/u-boot-x86.h | 3 +++ 2 files changed, 12 insertions(+)arch/x86/cpu/baytrail/early_uart.c +0
-0arch/x86/cpu/baytrail/early_uart.c int setup_early_uart(void) · line 82
Quoted 7 lines
arch/x86/cpu/baytrail/early_uart.c +4
-0@@ -76,3 +76,12 @@ int setup_early_uart(void)return 0 ; } + +int disable_internal_uart (void ) +{ +/* Disable the legacy UART hardware. */ nits: please remove the ending peirod.
Quoted 16 lines
arch/x86/cpu/baytrail/early_uart.c +1
-0+ x86_pci_write_config32(PCI_DEV_CONFIG(0, LPC_DEV, LPC_FUNC),
UART_CONT,arch/x86/cpu/baytrail/early_uart.c +4
-0+ 0); + +return 0 ; +}arch/x86/include/asm/u-boot-x86.h +0
-0@@ -47,6 +47,9 @@ int default_print_cpuinfo(void);/* Set up a UART which can be used with printch(), printhex8(), etc. */
int setup_early_uart(void);Quoted 7 lines
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h
Quoted 2 lines
arch/x86/include/asm/u-boot-x86.h +2
-0+/* Disable the internal legacy UART */ +int disable_internal_uart (void );If we can call
disable_internal_uart()in board-specific codes, then this declaration can be moved to SoC-specific header instead of x86 generic one.Quoted 2 lines
Do you have a preferred header for this in mind?
How about
arch/x86/include/asm/arch-baytrail/baytrail.h?Quoted 17 lines
Another idea would be, to add a parameter to the existing function
setup_early_uart()to either enable or disable the internal UART:Like this:
int
setup_early_uart(int enable){ /* Enable the legacy UART hardware. */ x86_pci_write_config32(PCI_DEV_CONFIG(0, LPC_DEV, LPC_FUNC), UART_CONT, enable); if (!enable) return 0; ...What do you think? Should I change it this way?
Quoted 8 lines
Quoted 2 lines
The issue with
setup_early_uart()is that it is only called whenCONFIG_DEBUG_UARTis on.In
fsp_init(), yes. But I can nevertheless call it from the board specific code in my case to *disable* the internal legacy UART.Ah, yes! I thought you wanted to use the existing call.
Quoted 10 lines
Quoted 3 lines
I think
CONFIG_DEBUG_UARTis only for debug
purpose IOW it's still legal to have a U-Boot booting withoutCONFIG_DEBUG_UART.Correct. But as mentioned above, I can call it from my board code before the Windond enable function to disable the internal UART (when changed to provide this functionality as suggested in the last mail).
Quoted 8 lines
Yes.
Quoted 4 lines
Or am I missing something? The function naming would be not really matching its purpose any more. Perhaps I should also rename it to
setup_internal_uart()instead?Yep, makes sense. Let's see how Simon thinks.
I've just created a new patchset, with 2 patches now and the suggested change from above implemented.
Thanks,
Stefan