SAMA5D2: Add logic to enable Flexcom clocking and to configure Flexcom pins

This commit is contained in:
Gregory Nutt 2015-09-11 14:54:30 -06:00
parent b19c3d7cbe
commit 972ae84d95
2 changed files with 80 additions and 1 deletions

View File

@ -231,7 +231,7 @@
#define PIO_FLEXCOM3_IO0_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN15)
#define PIO_FLEXCOM3_IO0_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN23)
#define PIO_FLEXCOM3_IO0 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN20)
#define PIO_FLEXCOM3_IO0_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN20)
#define PIO_FLEXCOM3_IO1_1 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOA | PIO_PIN13)
#define PIO_FLEXCOM3_IO1_2 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOB | PIO_PIN22)
#define PIO_FLEXCOM3_IO1_3 (PIO_PERIPHE | PIO_CFG_DEFAULT | PIO_PORT_PIOC | PIO_PIN19)

View File

@ -390,6 +390,21 @@ void sam_lowsetup(void)
#ifdef CONFIG_SAMA5_USART3
sam_usart3_enableclk();
#endif
#ifdef CONFIG_SAMA5_FLEXCOM0
sam_flexcom0_enableclk();
#endif
#ifdef CONFIG_SAMA5_FLEXCOM1
sam_flexcom1_enableclk();
#endif
#ifdef CONFIG_SAMA5_FLEXCOM2
sam_flexcom2_enableclk();
#endif
#ifdef CONFIG_SAMA5_FLEXCOM3
sam_flexcom3_enableclk();
#endif
#ifdef CONFIG_SAMA5_FLEXCOM4
sam_flexcom4_enableclk();
#endif
/* Configure UART pins for all selected UART/USARTs. USARTs pins are
* only configured if the USART is also configured as as a UART.
@ -473,6 +488,70 @@ void sam_lowsetup(void)
#ifdef CONFIG_USART4_IFLOWCONTROL
(void)sam_configpio(PIO_USART4_RTS);
#endif
#endif
/* For Flexcom USARTs:
*
* FLEXCOM_IO0 = TXD
* FLEXCOM_IO1 = RXD
* FLEXCOM_IO2 = SCK
* FLEXCOM_IO3 = CTS
* FLEXCOM_IO4 = RTS
*/
#if defined(CONFIG_USART0_ISUART) && defined(CONFIG_SAMA5_USART0)
(void)sam_configpio(PIO_FLEXCOM0_IO0);
(void)sam_configpio(PIO_FLEXCOM0_IO1);
#ifdef CONFIG_USART0_OFLOWCONTROL
(void)sam_configpio(PIO_FLEXCOM0_IO3);
#endif
#ifdef CONFIG_USART0_IFLOWCONTROL
(void)sam_configpio(PIO_FLEXCOM0_IO4);
#endif
#endif
#if defined(CONFIG_USART1_ISUART) && defined(CONFIG_SAMA5_USART1)
(void)sam_configpio(PIO_FLEXCOM1_IO0);
(void)sam_configpio(PIO_FLEXCOM1_IO1);
#ifdef CONFIG_USART1_OFLOWCONTROL
(void)sam_configpio(PIO_FLEXCOM1_IO3);
#endif
#ifdef CONFIG_USART1_IFLOWCONTROL
(void)sam_configpio(PIO_FLEXCOM1_IO4);
#endif
#endif
#if defined(CONFIG_USART2_ISUART) && defined(CONFIG_SAMA5_USART2)
(void)sam_configpio(PIO_FLEXCOM2_IO0);
(void)sam_configpio(PIO_FLEXCOM2_IO1);
#ifdef CONFIG_USART2_OFLOWCONTROL
(void)sam_configpio(PIO_FLEXCOM2_IO3);
#endif
#ifdef CONFIG_USART2_IFLOWCONTROL
(void)sam_configpio(PIO_FLEXCOM2_IO4);
#endif
#endif
#if defined(CONFIG_USART3_ISUART) && defined(CONFIG_SAMA5_USART3)
(void)sam_configpio(PIO_FLEXCOM3_IO0);
(void)sam_configpio(PIO_FLEXCOM3_IO1);
#ifdef CONFIG_USART3_OFLOWCONTROL
(void)sam_configpio(PIO_FLEXCOM3_IO3);
#endif
#ifdef CONFIG_USART3_IFLOWCONTROL
(void)sam_configpio(PIO_FLEXCOM3_IO4);
#endif
#endif
#if defined(CONFIG_USART4_ISUART) && defined(CONFIG_SAMA5_USART4)
(void)sam_configpio(PIO_FLEXCOM4_IO0);
(void)sam_configpio(PIO_FLEXCOM4_IO0);
#ifdef CONFIG_USART4_OFLOWCONTROL
(void)sam_configpio(PIO_FLEXCOM4_IO3);
#endif
#ifdef CONFIG_USART4_IFLOWCONTROL
(void)sam_configpio(PIO_FLEXCOM4_IO4);
#endif
#endif
/* Configure the console (only) */