Tool/software: Linux
Working on a beagle bone black derivative board with dual ethernet PHY. ETH_RESET is driven by GPIO_0_29, which is set as OUTPUT in u-boot. u-boot also properly resets PHY.
Also have
&gpio0 {
pinctrl-names = "default";
pinctrl-0 = <&gpio0_pins_default>;
status = "okay";
eth_reset {
gpio-hog;
gpios = <29 GPIO_ACTIVE_HIGH>;
output-low;
line-name = "ETH_RESET";
};
};
However, this is processed AFTER drivers/net/ethernet/ti/davinci_mdio.c, and some kernel code is flipping all GPIO pins back to INPUT. Current board has PULLUP on GPIO_0_29, which causes PHY to stay in reset when driver is looking for PHYs. So trying to track down where this is done in kernel. Added following to init/main.c to verify GPIO_0_29 is still in correct state from u-boot.
void __iomem *gpio0_base = NULL;
void __iomem *gpio3_base = NULL;
gpio0_base = ioremap( (unsigned int) 0x44E07000, 4096);
gpio3_base = ioremap( (unsigned int) 0x481AE000, 4096);
pr_notice("start_kernel: gpio0_oe=%0x, gpio3_oe=%0x, gpio0_dataout=%0x, gpio3_dataout=%0x\n",
__raw_readl(gpio0_base + 0x134), __raw_readl(gpio3_base + 0x134),
__raw_readl(gpio0_base + 0x13C), __raw_readl(gpio3_base + 0x13C));
iounmap(gpio0_base);
iounmap(gpio3_base);
This works fine, but when I duplicate this code elsewhere, for instance, drivers/pinctrl/core.c, I will get stuck at
Starting kernel ...
Any ideas why?