Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

CRIS: Better handling of pinmux settings

Depending on eth, eth_mido and geth fields in wr_hwprot, don't set
corresponding pins on gpio port b to gpio mode. This avoids
re-resetting the ethernet PHY should this already have been done.

Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>

+26 -2
+26 -2
arch/cris/include/arch-v32/mach-a3/mach/startup.inc
··· 1 + #ifndef STARTUP_INC_INCLUDED 2 + #define STARTUP_INC_INCLUDED 3 + 1 4 #include <hwregs/asm/reg_map_asm.h> 2 5 #include <hwregs/asm/gio_defs_asm.h> 3 6 #include <hwregs/asm/pio_defs_asm.h> 4 7 #include <hwregs/asm/clkgen_defs_asm.h> 5 8 #include <hwregs/asm/pinmux_defs_asm.h> 9 + 10 + .macro GIO_SET_P BITS, OUTREG 11 + bmi 1f ; btstq: bit -> N flag 12 + nop 13 + or.d \BITS, \OUTREG 14 + 1: 15 + .endm 6 16 7 17 .macro GIO_INIT 8 18 move.d CONFIG_ETRAX_DEF_GIO_PA_OUT, $r0 ··· 42 32 move.d 0xFFFFFFFF, $r0 43 33 move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pa), $r1 44 34 move.d $r0, [$r1] 45 - move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pb), $r1 46 - move.d $r0, [$r1] 47 35 move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pc), $r1 48 36 move.d $r0, [$r1] 37 + 38 + ;; If eth_mdio, eth, geth bits are set in hwprot, don't 39 + ;; set them to gpio, as this means they have been configured 40 + ;; earlier and shouldn't be changed. 41 + move.d 0xFC000000, $r2 ; pins 25..0 are eth_mdio, eth, geth 42 + move.d REG_ADDR(pinmux, regi_pinmux, rw_hwprot), $r1 43 + move.d [$r1], $r0 44 + btstq REG_BIT(pinmux, rw_hwprot, eth), $r0 45 + GIO_SET_P 0x00FFFF00, $r2 ;; pins 8..23 are eth 46 + btstq REG_BIT(pinmux, rw_hwprot, eth_mdio), $r0 47 + GIO_SET_P 0x03000000, $r2 ;; pins 24..25 are eth_mdio 48 + btstq REG_BIT(pinmux, rw_hwprot, geth), $r0 49 + GIO_SET_P 0x000000FF, $r2 ;; pins 0..7 are geth 50 + move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pb), $r1 51 + move.d $r2, [$r1] 49 52 .endm 50 53 51 54 .macro START_CLOCKS ··· 81 58 move.d CONFIG_ETRAX_PIO_CE2_CFG, $r1 82 59 move.d $r1, [$r0] 83 60 .endm 61 + #endif