summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Haustein <mario.haustein@hrz.tu-chemnitz.de>2016-09-21 18:54:08 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-09-22 17:31:31 +0200
commit66f4e9f664515dbcb5a702f9800e3a99d0fe4d41 (patch)
tree10088eec6ff5ab69588a2bfce753c3fa77cc3284
parent28eb01ea61a05be331b6bccd8fa5aac7781c48b9 (diff)
refactor USART support for AVR32 Grasshopper board
- force enable USB-USART bridge - add config menu option and kernel patch for enabling second USART
-rw-r--r--target/avr32/grasshopper/patches/4.7.3/0005-grasshopper-usart.patch54
-rw-r--r--target/avr32/kernel/grasshopper1
-rw-r--r--target/linux/config/Config.in.serial18
3 files changed, 73 insertions, 0 deletions
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
diff --git a/target/linux/config/Config.in.serial b/target/linux/config/Config.in.serial
index 34d1ec2de..83cb5b0e2 100644
--- a/target/linux/config/Config.in.serial
+++ b/target/linux/config/Config.in.serial
@@ -260,4 +260,22 @@ config ADK_KERNEL_SERIAL_UARTLITE
help
Serial driver for Microblaze S3ADSP1800
+config ADK_KERNEL_SERIAL_ATMEL
+ bool "AT32 serial driver"
+ select ADK_KERNEL_SERIAL_ATMEL_CONSOLE
+ select ADK_KERNEL_SERIAL_ATMEL_PDC
+ select ADK_KERNEL_BOARD_GRASSHOPPER_USART1 if ADK_TARGET_SYSTEM_GRASSHOPPER
+ depends on ADK_TARGET_CPU_AVR32
+ default y if ADK_TARGET_SYSTEM_GRASSHOPPER
+ default n
+ help
+ Serial driver for AVR32 Grasshopper boards
+
+config ADK_KERNEL_BOARD_GRASSHOPPER_USART0
+ bool "Enable USART0 on AVR32 Grasshopper boards"
+ depends on ADK_KERNEL_SERIAL_ATMEL && ADK_TARGET_SYSTEM_GRASSHOPPER
+ default n
+ help
+ Enable second USART on Grasshoper boards
+
endmenu