zephyr/boards/arm/arduino_zero/pinmux.c
Henrik Brix Andersen f3077da379 boards: arduino_zero: Fix SPI pinmux configuration.
This commit changes the Arduino Zero pinmux configuration to use PA12
as MISO.

According to the schematic, the Arduino Zero provides a SPI bus on
SERCOM4 with the following pads/pins:
 - MISO: PA12/pad0 (pin 21)
 - MOSI: PB10/pad2 (pin 19)
 - SCK:  PB11/pad3 (pin 20)

The MISO signal is incorrectly labeled as PB12_S4_SPI_MISO on the
schematic. It should be labeled PA12_S4_SPI_MISO.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-03-12 21:40:24 -05:00

75 lines
1.9 KiB
C

/*
* Copyright (c) 2018 Google LLC.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <init.h>
#include <pinmux.h>
static int board_pinmux_init(struct device *dev)
{
struct device *muxa = device_get_binding(CONFIG_PINMUX_SAM0_A_LABEL);
struct device *muxb = device_get_binding(CONFIG_PINMUX_SAM0_B_LABEL);
ARG_UNUSED(dev);
#if CONFIG_UART_SAM0_SERCOM0_BASE_ADDRESS
/* SERCOM0 on RX=PA11, TX=PA10 */
pinmux_pin_set(muxa, 11, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 10, PINMUX_FUNC_C);
#endif
#if CONFIG_UART_SAM0_SERCOM5_BASE_ADDRESS
/* SERCOM5 on RX=PB23, TX=PB22 */
pinmux_pin_set(muxb, 23, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 22, PINMUX_FUNC_D);
#endif
#if CONFIG_UART_SAM0_SERCOM1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if CONFIG_UART_SAM0_SERCOM2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if CONFIG_UART_SAM0_SERCOM3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if CONFIG_UART_SAM0_SERCOM4_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if CONFIG_SPI_SAM0_SERCOM4_BASE_ADDRESS
/* SPI SERCOM4 on MISO=PA12/pad 0, MOSI=PB10/pad 2, SCK=PB11/pad 3 */
pinmux_pin_set(muxa, 12, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 10, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 11, PINMUX_FUNC_D);
#endif
#if CONFIG_SPI_SAM0_SERCOM0_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if CONFIG_SPI_SAM0_SERCOM1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if CONFIG_SPI_SAM0_SERCOM2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if CONFIG_SPI_SAM0_SERCOM3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if CONFIG_SPI_SAM0_SERCOM5_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#ifdef CONFIG_USB_DC_SAM0
/* USB DP on PA25, USB DM on PA24 */
pinmux_pin_set(muxa, 25, PINMUX_FUNC_G);
pinmux_pin_set(muxa, 24, PINMUX_FUNC_G);
#endif
return 0;
}
SYS_INIT(board_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);