diff options
author | Tim Sander <tim@krieglstein.org> | 2016-02-25 11:29:42 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-03-01 10:13:47 +0100 |
commit | f3b493750a304791b057eda246b473810aa8bf40 (patch) | |
tree | 6a8729eda433900ecf5c356bcc03f1fb68ca8c61 /arch/arm/boards/terasic-de0-nano-soc/board.c | |
parent | 246266c205b6608d785bdc2de1d71309f3c0e70c (diff) | |
download | barebox-f3b493750a304791b057eda246b473810aa8bf40.tar.gz barebox-f3b493750a304791b057eda246b473810aa8bf40.tar.xz |
Terasic DE0-Nano-SoC: add support
v7: eof whitespace fixes
A Patch for supporting the Terasic DE0 NANO-SoC with barebox.
The pretty similar Socrates Board was taken as a starting point with pulling
in the memory timings/pinmux from
http://rocketboards.org/foswiki/view/Documentation/AtlasSoCCompileHardwareDesign
Signed-off-by: Tim Sander <tim@krieglstein.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/terasic-de0-nano-soc/board.c')
-rw-r--r-- | arch/arm/boards/terasic-de0-nano-soc/board.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm/boards/terasic-de0-nano-soc/board.c b/arch/arm/boards/terasic-de0-nano-soc/board.c new file mode 100644 index 0000000000..919bfc8c54 --- /dev/null +++ b/arch/arm/boards/terasic-de0-nano-soc/board.c @@ -0,0 +1,35 @@ +#include <common.h> +#include <types.h> +#include <driver.h> +#include <init.h> +#include <asm/armlinux.h> +#include <linux/micrel_phy.h> +#include <linux/phy.h> +#include <linux/sizes.h> +#include <fcntl.h> +#include <fs.h> +#include <mach/socfpga-regs.h> + +static int phy_fixup(struct phy_device *dev) +{ + /* + * min rx data delay, max rx/tx clock delay, + * min rx/tx control delay + */ + phy_write_mmd_indirect(dev, 4, 2, 0); + phy_write_mmd_indirect(dev, 5, 2, 0); + phy_write_mmd_indirect(dev, 8, 2, 0x003ff); + return 0; +} + +static int socfpga_init(void) +{ + if (!of_machine_is_compatible("terasic,de0-nano-soc")) + return 0; + + if (IS_ENABLED(CONFIG_PHYLIB)) + phy_register_fixup_for_uid(PHY_ID_KSZ9031, MICREL_PHY_ID_MASK, phy_fixup); + + return 0; +} +console_initcall(socfpga_init); |