1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries
7 #include <asm/arch/at91_common.h>
8 #include <asm/arch/clk.h>
9 #include <asm/arch/gpio.h>
12 unsigned int get_chip_id(void)
14 /* The 0x40 is the offset of cidr in DBGU */
15 return readl(ATMEL_BASE_DBGU + 0x40) & ~ARCH_ID_VERSION_MASK;
18 unsigned int get_extension_chip_id(void)
20 /* The 0x44 is the offset of exid in DBGU */
21 return readl(ATMEL_BASE_DBGU + 0x44);
24 unsigned int has_emac1(void)
26 return cpu_is_sam9x60();
29 unsigned int has_emac0(void)
31 return cpu_is_sam9x60();
34 unsigned int has_lcdc(void)
36 return cpu_is_sam9x60();
39 char *get_cpu_name(void)
41 unsigned int extension_id = get_extension_chip_id();
43 if (cpu_is_sam9x60()) {
44 switch (extension_id) {
45 case ARCH_EXID_SAM9X60:
48 return "Unknown CPU type";
51 return "Unknown CPU type";
55 void at91_seriald_hw_init(void)
57 at91_pio3_set_a_periph(AT91_PIO_PORTA, 9, 1); /* DRXD */
58 at91_pio3_set_a_periph(AT91_PIO_PORTA, 10, 1); /* DTXD */
60 at91_periph_clk_enable(ATMEL_ID_DBGU);
63 void at91_mci_hw_init(void)
65 /* Initialize the SDMMC0 */
66 at91_pio3_set_a_periph(AT91_PIO_PORTA, 17, 1); /* CLK */
67 at91_pio3_set_a_periph(AT91_PIO_PORTA, 16, 1); /* CMD */
68 at91_pio3_set_a_periph(AT91_PIO_PORTA, 15, 1); /* DAT0 */
69 at91_pio3_set_a_periph(AT91_PIO_PORTA, 18, 1); /* DAT1 */
70 at91_pio3_set_a_periph(AT91_PIO_PORTA, 19, 1); /* DAT2 */
71 at91_pio3_set_a_periph(AT91_PIO_PORTA, 20, 1); /* DAT3 */
73 at91_periph_clk_enable(ATMEL_ID_SDMMC0);
77 void at91_macb_hw_init(void)
80 /* Enable EMAC0 clock */
81 at91_periph_clk_enable(ATMEL_ID_EMAC0);
82 /* EMAC0 pins setup */
83 at91_pio3_set_a_periph(AT91_PIO_PORTB, 4, 0); /* ETXCK */
84 at91_pio3_set_a_periph(AT91_PIO_PORTB, 3, 0); /* ERXDV */
85 at91_pio3_set_a_periph(AT91_PIO_PORTB, 0, 0); /* ERX0 */
86 at91_pio3_set_a_periph(AT91_PIO_PORTB, 1, 0); /* ERX1 */
87 at91_pio3_set_a_periph(AT91_PIO_PORTB, 2, 0); /* ERXER */
88 at91_pio3_set_a_periph(AT91_PIO_PORTB, 7, 0); /* ETXEN */
89 at91_pio3_set_a_periph(AT91_PIO_PORTB, 9, 0); /* ETX0 */
90 at91_pio3_set_a_periph(AT91_PIO_PORTB, 10, 0); /* ETX1 */
91 at91_pio3_set_a_periph(AT91_PIO_PORTB, 5, 0); /* EMDIO */
92 at91_pio3_set_a_periph(AT91_PIO_PORTB, 6, 0); /* EMDC */
96 /* Enable EMAC1 clock */
97 at91_periph_clk_enable(ATMEL_ID_EMAC1);
98 /* EMAC1 pins setup */
99 at91_pio3_set_b_periph(AT91_PIO_PORTC, 29, 0); /* ETXCK */
100 at91_pio3_set_b_periph(AT91_PIO_PORTC, 28, 0); /* ECRSDV */
101 at91_pio3_set_b_periph(AT91_PIO_PORTC, 20, 0); /* ERXO */
102 at91_pio3_set_b_periph(AT91_PIO_PORTC, 21, 0); /* ERX1 */
103 at91_pio3_set_b_periph(AT91_PIO_PORTC, 16, 0); /* ERXER */
104 at91_pio3_set_b_periph(AT91_PIO_PORTC, 27, 0); /* ETXEN */
105 at91_pio3_set_b_periph(AT91_PIO_PORTC, 18, 0); /* ETX0 */
106 at91_pio3_set_b_periph(AT91_PIO_PORTC, 19, 0); /* ETX1 */
107 at91_pio3_set_b_periph(AT91_PIO_PORTC, 31, 0); /* EMDIO */
108 at91_pio3_set_b_periph(AT91_PIO_PORTC, 30, 0); /* EMDC */
112 /* Only emac0 support MII */
114 at91_pio3_set_a_periph(AT91_PIO_PORTB, 16, 0); /* ECRS */
115 at91_pio3_set_a_periph(AT91_PIO_PORTB, 17, 0); /* ECOL */
116 at91_pio3_set_a_periph(AT91_PIO_PORTB, 13, 0); /* ERX2 */
117 at91_pio3_set_a_periph(AT91_PIO_PORTB, 14, 0); /* ERX3 */
118 at91_pio3_set_a_periph(AT91_PIO_PORTB, 15, 0); /* ERXCK */
119 at91_pio3_set_a_periph(AT91_PIO_PORTB, 11, 0); /* ETX2 */
120 at91_pio3_set_a_periph(AT91_PIO_PORTB, 12, 0); /* ETX3 */
121 at91_pio3_set_a_periph(AT91_PIO_PORTB, 8, 0); /* ETXER */