From 66f4e9f664515dbcb5a702f9800e3a99d0fe4d41 Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Wed, 21 Sep 2016 18:54:08 +0200 Subject: refactor USART support for AVR32 Grasshopper board - force enable USB-USART bridge - add config menu option and kernel patch for enabling second USART --- .../patches/4.7.3/0005-grasshopper-usart.patch | 54 ++++++++++++++++++++++ target/avr32/kernel/grasshopper | 1 + 2 files changed, 55 insertions(+) create mode 100644 target/avr32/grasshopper/patches/4.7.3/0005-grasshopper-usart.patch (limited to 'target/avr32') diff --git a/target/avr32/grasshopper/patches/4.7.3/0005-grasshopper-usart.patch b/target/avr32/grasshopper/patches/4.7.3/0005-grasshopper-usart.patch new file mode 100644 index 000000000..448647c29 --- /dev/null +++ b/target/avr32/grasshopper/patches/4.7.3/0005-grasshopper-usart.patch @@ -0,0 +1,54 @@ +diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/Kconfig linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Kconfig +--- linux-4.7.3/arch/avr32/boards/grasshopper/Kconfig 2016-09-20 11:43:03.645251779 +0200 ++++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Kconfig 2016-09-20 11:58:20.129642638 +0200 +@@ -49,4 +49,21 @@ + depends on I2C && I2C_GPIO + default y + ++config BOARD_GRASSHOPPER_USART0 ++ bool "Enable USART0" ++ depends on SERIAL_ATMEL_PDC ++ default n ++ help ++ USART0 is mapped to /dev/ttyS1 (or /dev/ttyAT1 resp.) and available via ++ connector J6 and J13. ++ ++config BOARD_GRASSHOPPER_USART1 ++ bool "Enable USART1 (CP2102 USB-Interface)" ++ depends on SERIAL_ATMEL_PDC ++ default y ++ help ++ USART1 is mapped to /dev/ttyS0 (or /dev/ttyAT0 resp.) and available via ++ the CP2002 USB-USART-bridge. If you disable this option, you won't be ++ able to access the serial console, so it is recommended to say 'y' here. ++ + endif # BOARD_GRASSHOPPER +diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/setup.c linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/setup.c +--- linux-4.7.3/arch/avr32/boards/grasshopper/setup.c 2016-09-20 11:43:03.646251793 +0200 ++++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/setup.c 2016-09-20 12:03:04.864496603 +0200 +@@ -166,7 +166,12 @@ + + void __init setup_board(void) + { ++#ifdef CONFIG_BOARD_GRASSHOPPER_USART1 + at32_map_usart(1, 0, 0); // USART 1: /dev/ttyS0, CP2102 ++#endif ++#ifdef CONFIG_BOARD_GRASSHOPPER_USART0 ++ at32_map_usart(0, 1, 0); // USART 0: /dev/ttyS1 ++#endif + at32_setup_serial_console(0); + + // grasshopper_add_spi(); +@@ -182,7 +187,12 @@ + */ + at32_reserve_pin(GPIO_PIOE_BASE, ATMEL_EBI_PE_DATA_ALL); + at32_add_device_usba(0, NULL); ++#ifdef CONFIG_BOARD_GRASSHOPPER_USART1 + at32_add_device_usart(0); ++#endif ++#ifdef CONFIG_BOARD_GRASSHOPPER_USART0 ++ at32_add_device_usart(1); ++#endif + + #ifdef CONFIG_GRASSHOPPER_LCD + at32_add_device_lcdc(0, &grasshopper_lcdc_data, diff --git a/target/avr32/kernel/grasshopper b/target/avr32/kernel/grasshopper index 88a636264..ced820163 100644 --- a/target/avr32/kernel/grasshopper +++ b/target/avr32/kernel/grasshopper @@ -7,3 +7,4 @@ CONFIG_BOARD_GRASSHOPPER=y CONFIG_SERIAL_ATMEL=y CONFIG_SERIAL_ATMEL_CONSOLE=y CONFIG_SERIAL_ATMEL_PDC=y +CONFIG_BOARD_GRASSHOPPER_USART1=y -- cgit v1.2.3