Re: [PATCH v4] Terasic DE0-Nano-SoC: add support
Hi Sascha Thanks for your hints. Am Freitag, 12. Februar 2016, 09:33:20 schrieb Sascha Hauer: > Hi Tim, > > On Thu, Feb 11, 2016 at 03:40:41PM +0100, Tim Sander wrote: > > Hi > > > > Am Montag, 1. Februar 2016, 11:08:10 schrieb Andrey Smirnov: > > ... > > > > > > 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 000..22f8291 > > > > --- /dev/null > > > > +++ b/arch/arm/boards/terasic-de0-nano-soc/board.c > > > > @@ -0,0 +1,37 @@ > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > + > > > > +static int phy_fixup(struct phy_device *dev) > > > > +{ > > > > + /* min rx data delay */ > > > > + phy_write(dev, 0x0b, 0x8105); > > > > + phy_write(dev, 0x0c, 0x); > > > > + > > > > + /* max rx/tx clock delay, min rx/tx control delay */ > > > > + phy_write(dev, 0x0b, 0x8104); > > > > + phy_write(dev, 0x0c, 0xa0d0); > > > > + phy_write(dev, 0x0b, 0x104); > > > > + > > > > + return 0; > > > > +} > > > > + > > > > +static int socfpga_console_init(void) > > > > > > I know that this names comes from the source code for SoCKit, but I'd > > > argue that the name of this function should be changed to something > > > more descriptive. This function doesn't really initialize console in > > > any way and just happen to be executed on "console_initcall" level of > > > execution. > > > > > > > +{ > > > > + if (!of_machine_is_compatible("altr,socfpga-cyclone5")) > > > > The string above will be replaced with "terasic,de0-nano-soc" but see > > below...> > > > > + return 0; > > > > > > Since Altera is not really a vendor of this board and, I'd suggest the > > > compatibility string be renamed to "terrasic,de0-nano-soc" > > > > Besides that the company is named Terasic i concur with you but there > > is one problem: I have now just patched the kernel with the folowing patch > > to add the device tree compatiblility information needed: > > > > diff --git a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts > > b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts index > > 555e9caf21e1..3a427423168e 100644 > > --- a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts > > +++ b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts > > @@ -18,7 +18,7 @@ > > > > / { > > > > model = "Terasic DE-0(Atlas)"; > > > > - compatible = "altr,socfpga-cyclone5", "altr,socfpga"; > > + compatible = "terasic,de0-nano-soc"," altr,socfpga-cyclone5", > > "altr,socfpga";> > > chosen { > > > > bootargs = "earlyprintk"; > > Ok, barebox finds a device tree compatible to "terasic,de0-nano-soc" on > the SD card, but thinks it itself is not compatible to that. It seems > the patch above has no effect. Could you check with of_dump that > /compatible is indeed what you expect it to be? > Note that you have a typo in your compatible string. " > altr,socfpga-cyclone5" should be "altr,socfpga-cyclone5". That should cause > your problem > though. Well i found out that i forgot to add the "terasic,de0-nano-soc" string to the dts file within barebox. So just adding it in board.c and in linux kernel dts didn't suffice. Best regards Tim ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v4] Terasic DE0-Nano-SoC: add support
Hi Tim, On Thu, Feb 11, 2016 at 03:40:41PM +0100, Tim Sander wrote: > Hi > > Am Montag, 1. Februar 2016, 11:08:10 schrieb Andrey Smirnov: > ... > > > 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 000..22f8291 > > > --- /dev/null > > > +++ b/arch/arm/boards/terasic-de0-nano-soc/board.c > > > @@ -0,0 +1,37 @@ > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +static int phy_fixup(struct phy_device *dev) > > > +{ > > > + /* min rx data delay */ > > > + phy_write(dev, 0x0b, 0x8105); > > > + phy_write(dev, 0x0c, 0x); > > > + > > > + /* max rx/tx clock delay, min rx/tx control delay */ > > > + phy_write(dev, 0x0b, 0x8104); > > > + phy_write(dev, 0x0c, 0xa0d0); > > > + phy_write(dev, 0x0b, 0x104); > > > + > > > + return 0; > > > +} > > > + > > > +static int socfpga_console_init(void) > > > > I know that this names comes from the source code for SoCKit, but I'd > > argue that the name of this function should be changed to something > > more descriptive. This function doesn't really initialize console in > > any way and just happen to be executed on "console_initcall" level of > > execution. > > > > > +{ > > > + if (!of_machine_is_compatible("altr,socfpga-cyclone5")) > The string above will be replaced with "terasic,de0-nano-soc" but see below... > > > + return 0; > > > > Since Altera is not really a vendor of this board and, I'd suggest the > > compatibility string be renamed to "terrasic,de0-nano-soc" > Besides that the company is named Terasic i concur with you but there > is one problem: I have now just patched the kernel with the folowing patch to > add the device tree compatiblility information needed: > > diff --git a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts > b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts > index 555e9caf21e1..3a427423168e 100644 > --- a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts > +++ b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts > @@ -18,7 +18,7 @@ > > / { > model = "Terasic DE-0(Atlas)"; > - compatible = "altr,socfpga-cyclone5", "altr,socfpga"; > + compatible = "terasic,de0-nano-soc"," altr,socfpga-cyclone5", > "altr,socfpga"; > > chosen { > bootargs = "earlyprintk"; > -- > 1.9.1 > > But now i have the barebox bootmessage which states the following on boot: > -- > blspec: blspec_scan_directory: mmc loader/entries > blspec: blspec_scan_directory: /mnt/mmc0.2 loader/entries > blspec: ignoring entry with incompatible devicetree "terasic,de0-nano-soc" > -- Ok, barebox finds a device tree compatible to "terasic,de0-nano-soc" on the SD card, but thinks it itself is not compatible to that. It seems the patch above has no effect. Could you check with of_dump that /compatible is indeed what you expect it to be? Note that you have a typo in your compatible string. " altr,socfpga-cyclone5" should be "altr,socfpga-cyclone5". That should cause your problem though. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v4] Terasic DE0-Nano-SoC: add support
Hi Am Montag, 1. Februar 2016, 11:08:10 schrieb Andrey Smirnov: ... > > 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 000..22f8291 > > --- /dev/null > > +++ b/arch/arm/boards/terasic-de0-nano-soc/board.c > > @@ -0,0 +1,37 @@ > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +static int phy_fixup(struct phy_device *dev) > > +{ > > + /* min rx data delay */ > > + phy_write(dev, 0x0b, 0x8105); > > + phy_write(dev, 0x0c, 0x); > > + > > + /* max rx/tx clock delay, min rx/tx control delay */ > > + phy_write(dev, 0x0b, 0x8104); > > + phy_write(dev, 0x0c, 0xa0d0); > > + phy_write(dev, 0x0b, 0x104); > > + > > + return 0; > > +} > > + > > +static int socfpga_console_init(void) > > I know that this names comes from the source code for SoCKit, but I'd > argue that the name of this function should be changed to something > more descriptive. This function doesn't really initialize console in > any way and just happen to be executed on "console_initcall" level of > execution. > > > +{ > > + if (!of_machine_is_compatible("altr,socfpga-cyclone5")) The string above will be replaced with "terasic,de0-nano-soc" but see below... > > + return 0; > > Since Altera is not really a vendor of this board and, I'd suggest the > compatibility string be renamed to "terrasic,de0-nano-soc" Besides that the company is named Terasic i concur with you but there is one problem: I have now just patched the kernel with the folowing patch to add the device tree compatiblility information needed: diff --git a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts index 555e9caf21e1..3a427423168e 100644 --- a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts +++ b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts @@ -18,7 +18,7 @@ / { model = "Terasic DE-0(Atlas)"; - compatible = "altr,socfpga-cyclone5", "altr,socfpga"; + compatible = "terasic,de0-nano-soc"," altr,socfpga-cyclone5", "altr,socfpga"; chosen { bootargs = "earlyprintk"; -- 1.9.1 But now i have the barebox bootmessage which states the following on boot: -- blspec: blspec_scan_directory: mmc loader/entries blspec: blspec_scan_directory: /mnt/mmc0.2 loader/entries blspec: ignoring entry with incompatible devicetree "terasic,de0-nano-soc" -- Looking into loader/entries on the SD-card shows the follwing contents of socfpga_cyclone5_de0_sockit.conf: -- title PTXdist - HBM-Altera Soc Test socfpga_cyclone5_de0_sockit version 4.4.1 options root=/dev/mmcblk0p3 rootwait rootfstype=ext4 rw linux /boot/zImage devicetree /boot/socfpga_cyclone5_de0_sockit.dtb -- dtc -I dtb -O dts socfpga_cyclone5_de0_sockit.dtb |head outputs -- /dts-v1/; /memreserve/0x 0x1000; / { #address-cells = <0x1>; #size-cells = <0x1>; model = "Terasic DE-0(Atlas)"; compatible = "terasic,de0-nano-soc", " altr,socfpga-cyclone5", "altr,socfpga"; -- All files are taken directly from the SD-card so i am pretty sure i made no errors there. But currently i fail to see why this error occurs? I seems to me that all the device tree magic is in place but unfortunatly barebox does not seem to know... Best Regards Tim ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v4] Terasic DE0-Nano-SoC: add support
On Tue, Feb 2, 2016 at 3:30 PM, Trent Piepho wrote: > On Mon, 2016-02-01 at 11:08 -0800, Andrey Smirnov wrote: >> On Mon, Feb 1, 2016 at 8:09 AM, Tim Sander wrote: > >> > + >> > + if (IS_ENABLED(CONFIG_PHYLIB)) >> > + phy_register_fixup_for_uid(PHY_ID_KSZ9021, >> > MICREL_PHY_ID_MASK, phy_fixup); >> >> I don't think this code is correct. To the best of my knowledge, both >> Atlas and DE0-Nano version of the board come with KSZ9031 as a PHY, >> which requires different fixup. See arm/boards/tqma6x/board.c for >> example. > > I think all the fixups for the micrel phys should probably be replaced > with device tree properties. If you look in drivers/net/phy/micrel.c, > ksz9031_config_init() will read skew properties from the DT and program > the phy that way. This would make it easier to use the phy DT > properties already in the Linux dts files. > I haven't thought about that, that does sound like a better idea. ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v4] Terasic DE0-Nano-SoC: add support
On Mon, 2016-02-01 at 11:08 -0800, Andrey Smirnov wrote: > On Mon, Feb 1, 2016 at 8:09 AM, Tim Sander wrote: > > + > > + if (IS_ENABLED(CONFIG_PHYLIB)) > > + phy_register_fixup_for_uid(PHY_ID_KSZ9021, > > MICREL_PHY_ID_MASK, phy_fixup); > > I don't think this code is correct. To the best of my knowledge, both > Atlas and DE0-Nano version of the board come with KSZ9031 as a PHY, > which requires different fixup. See arm/boards/tqma6x/board.c for > example. I think all the fixups for the micrel phys should probably be replaced with device tree properties. If you look in drivers/net/phy/micrel.c, ksz9031_config_init() will read skew properties from the DT and program the phy that way. This would make it easier to use the phy DT properties already in the Linux dts files. ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v4] Terasic DE0-Nano-SoC: add support
On Mon, Feb 01, 2016 at 11:08:10AM -0800, Andrey Smirnov wrote: > On Mon, Feb 1, 2016 at 8:09 AM, Tim Sander wrote: > > v4: use the amended patch not the old one, doh. Sorry for the noise. > > > > +static inline void ledon(int led) > > +{ > > + u32 val; > > + > > + val = readl(0xFF709000); > > + val |= 1 << (led + 24); > > + writel(val, 0xFF709000); > > + > > + val = readl(0xFF709004); > > + val |= 1 << (led + 24); > > + writel(val, 0xFF709004); > > +} > > + > > +static inline void ledoff(int led) > > +{ > > + u32 val; > > + > > + val = readl(0xFF709000); > > + val &= ~(1 << (led + 24)); > > + writel(val, 0xFF709000); > > + > > + val = readl(0xFF709004); > > + val &= ~(1 << (led + 24)); > > + writel(val, 0xFF709004); > > +} > > Where are those "ledoff" and "ledon" functions used? I assume they are for early debugging and otherwise unused. It's ok to leave them here. Maybe add a comment why they are here, also some indication for valid led values would be nice. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v4] Terasic DE0-Nano-SoC: add support
On Mon, Feb 1, 2016 at 8:09 AM, Tim Sander wrote: > v4: use the amended patch not the old one, doh. Sorry for the noise. > > 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 > Its only tested at room temperatures and i am not 100% sure about the device > tree: > One known problem is the fact that the board identifier is pretty generic but > its the same in the linux kernel so i resorted to that. > > Signed-off-by: Tim Sander > --- > arch/arm/boards/Makefile | 1 + > arch/arm/boards/terasic-de0-nano-soc/Makefile | 2 + > arch/arm/boards/terasic-de0-nano-soc/board.c | 37 ++ > arch/arm/boards/terasic-de0-nano-soc/config.h | 1 + > .../terasic-de0-nano-soc/iocsr_config_cyclone5.c | 675 > + > arch/arm/boards/terasic-de0-nano-soc/lowlevel.c| 102 > .../boards/terasic-de0-nano-soc/pinmux_config.c| 240 > arch/arm/boards/terasic-de0-nano-soc/pll_config.h | 107 > .../arm/boards/terasic-de0-nano-soc/sdram_config.h | 108 > .../boards/terasic-de0-nano-soc/sequencer_auto.h | 228 +++ > .../terasic-de0-nano-soc/sequencer_auto_ac_init.c | 69 +++ > .../sequencer_auto_inst_init.c | 161 + > .../terasic-de0-nano-soc/sequencer_defines.h | 160 + > arch/arm/configs/socfpga-xload_defconfig | 1 + > arch/arm/configs/socfpga_defconfig | 1 + > arch/arm/dts/Makefile | 1 + > arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts | 34 ++ > arch/arm/mach-socfpga/Kconfig | 4 + > images/Makefile.socfpga| 8 + > 19 files changed, 1940 insertions(+) > create mode 100644 arch/arm/boards/terasic-de0-nano-soc/Makefile > create mode 100644 arch/arm/boards/terasic-de0-nano-soc/board.c > create mode 100644 arch/arm/boards/terasic-de0-nano-soc/config.h > create mode 100644 > arch/arm/boards/terasic-de0-nano-soc/iocsr_config_cyclone5.c > create mode 100644 arch/arm/boards/terasic-de0-nano-soc/lowlevel.c > create mode 100644 arch/arm/boards/terasic-de0-nano-soc/pinmux_config.c > create mode 100644 arch/arm/boards/terasic-de0-nano-soc/pll_config.h > create mode 100644 arch/arm/boards/terasic-de0-nano-soc/sdram_config.h > create mode 100644 arch/arm/boards/terasic-de0-nano-soc/sequencer_auto.h > create mode 100644 > arch/arm/boards/terasic-de0-nano-soc/sequencer_auto_ac_init.c > create mode 100644 > arch/arm/boards/terasic-de0-nano-soc/sequencer_auto_inst_init.c > create mode 100644 arch/arm/boards/terasic-de0-nano-soc/sequencer_defines.h > create mode 100644 arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts > > diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile > index 1029e8f..4d572a6 100644 > --- a/arch/arm/boards/Makefile > +++ b/arch/arm/boards/Makefile > @@ -106,6 +106,7 @@ obj-$(CONFIG_MACH_SAMA5D4EK)+= > sama5d4ek/ > obj-$(CONFIG_MACH_SCB9328) += scb9328/ > obj-$(CONFIG_MACH_SOCFPGA_ALTERA_SOCDK)+= altera-socdk/ > obj-$(CONFIG_MACH_SOCFPGA_EBV_SOCRATES)+= ebv-socrates/ > +obj-$(CONFIG_MACH_SOCFPGA_TERASIC_DE0_NANO_SOC)+= > terasic-de0-nano-soc/ > obj-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT) += terasic-sockit/ > obj-$(CONFIG_MACH_SOLIDRUN_CUBOX) += solidrun-cubox/ > obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += solidrun-microsom/ > diff --git a/arch/arm/boards/terasic-de0-nano-soc/Makefile > b/arch/arm/boards/terasic-de0-nano-soc/Makefile > new file mode 100644 > index 000..8c927fe > --- /dev/null > +++ b/arch/arm/boards/terasic-de0-nano-soc/Makefile > @@ -0,0 +1,2 @@ > +obj-y += lowlevel.o board.o > +pbl-y += lowlevel.o > 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 000..22f8291 > --- /dev/null > +++ b/arch/arm/boards/terasic-de0-nano-soc/board.c > @@ -0,0 +1,37 @@ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +static int phy_fixup(struct phy_device *dev) > +{ > + /* min rx data delay */ > + phy_write(dev, 0x0b, 0x8105); > + phy_write(dev, 0x0c, 0x); > + > + /* max rx/tx clock delay, min rx/tx control delay */ > + phy_write(dev, 0x0b, 0x8104); > + phy_write(dev, 0x0c, 0xa0d0); > + phy_write(dev, 0x0b, 0x104); > + > + return 0; > +} > + > +static int socfpga_console_init(void) I know that this names comes from the source code for SoCKit, but I'd argue that the name of this function should be changed to something more descriptive. This function doesn't really initialize console
[PATCH v4] Terasic DE0-Nano-SoC: add support
v4: use the amended patch not the old one, doh. Sorry for the noise. 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 Its only tested at room temperatures and i am not 100% sure about the device tree: One known problem is the fact that the board identifier is pretty generic but its the same in the linux kernel so i resorted to that. Signed-off-by: Tim Sander --- arch/arm/boards/Makefile | 1 + arch/arm/boards/terasic-de0-nano-soc/Makefile | 2 + arch/arm/boards/terasic-de0-nano-soc/board.c | 37 ++ arch/arm/boards/terasic-de0-nano-soc/config.h | 1 + .../terasic-de0-nano-soc/iocsr_config_cyclone5.c | 675 + arch/arm/boards/terasic-de0-nano-soc/lowlevel.c| 102 .../boards/terasic-de0-nano-soc/pinmux_config.c| 240 arch/arm/boards/terasic-de0-nano-soc/pll_config.h | 107 .../arm/boards/terasic-de0-nano-soc/sdram_config.h | 108 .../boards/terasic-de0-nano-soc/sequencer_auto.h | 228 +++ .../terasic-de0-nano-soc/sequencer_auto_ac_init.c | 69 +++ .../sequencer_auto_inst_init.c | 161 + .../terasic-de0-nano-soc/sequencer_defines.h | 160 + arch/arm/configs/socfpga-xload_defconfig | 1 + arch/arm/configs/socfpga_defconfig | 1 + arch/arm/dts/Makefile | 1 + arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts | 34 ++ arch/arm/mach-socfpga/Kconfig | 4 + images/Makefile.socfpga| 8 + 19 files changed, 1940 insertions(+) create mode 100644 arch/arm/boards/terasic-de0-nano-soc/Makefile create mode 100644 arch/arm/boards/terasic-de0-nano-soc/board.c create mode 100644 arch/arm/boards/terasic-de0-nano-soc/config.h create mode 100644 arch/arm/boards/terasic-de0-nano-soc/iocsr_config_cyclone5.c create mode 100644 arch/arm/boards/terasic-de0-nano-soc/lowlevel.c create mode 100644 arch/arm/boards/terasic-de0-nano-soc/pinmux_config.c create mode 100644 arch/arm/boards/terasic-de0-nano-soc/pll_config.h create mode 100644 arch/arm/boards/terasic-de0-nano-soc/sdram_config.h create mode 100644 arch/arm/boards/terasic-de0-nano-soc/sequencer_auto.h create mode 100644 arch/arm/boards/terasic-de0-nano-soc/sequencer_auto_ac_init.c create mode 100644 arch/arm/boards/terasic-de0-nano-soc/sequencer_auto_inst_init.c create mode 100644 arch/arm/boards/terasic-de0-nano-soc/sequencer_defines.h create mode 100644 arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile index 1029e8f..4d572a6 100644 --- a/arch/arm/boards/Makefile +++ b/arch/arm/boards/Makefile @@ -106,6 +106,7 @@ obj-$(CONFIG_MACH_SAMA5D4EK)+= sama5d4ek/ obj-$(CONFIG_MACH_SCB9328) += scb9328/ obj-$(CONFIG_MACH_SOCFPGA_ALTERA_SOCDK)+= altera-socdk/ obj-$(CONFIG_MACH_SOCFPGA_EBV_SOCRATES)+= ebv-socrates/ +obj-$(CONFIG_MACH_SOCFPGA_TERASIC_DE0_NANO_SOC)+= terasic-de0-nano-soc/ obj-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT) += terasic-sockit/ obj-$(CONFIG_MACH_SOLIDRUN_CUBOX) += solidrun-cubox/ obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += solidrun-microsom/ diff --git a/arch/arm/boards/terasic-de0-nano-soc/Makefile b/arch/arm/boards/terasic-de0-nano-soc/Makefile new file mode 100644 index 000..8c927fe --- /dev/null +++ b/arch/arm/boards/terasic-de0-nano-soc/Makefile @@ -0,0 +1,2 @@ +obj-y += lowlevel.o board.o +pbl-y += lowlevel.o 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 000..22f8291 --- /dev/null +++ b/arch/arm/boards/terasic-de0-nano-soc/board.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int phy_fixup(struct phy_device *dev) +{ + /* min rx data delay */ + phy_write(dev, 0x0b, 0x8105); + phy_write(dev, 0x0c, 0x); + + /* max rx/tx clock delay, min rx/tx control delay */ + phy_write(dev, 0x0b, 0x8104); + phy_write(dev, 0x0c, 0xa0d0); + phy_write(dev, 0x0b, 0x104); + + return 0; +} + +static int socfpga_console_init(void) +{ + if (!of_machine_is_compatible("altr,socfpga-cyclone5")) + return 0; + + if (IS_ENABLED(CONFIG_PHYLIB)) + phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK, phy_fixup); + + return 0; +} +console_initcall(socfpga_console_init); diff --git a/arch/arm/boards/terasic-de0-nano-soc/config.h b/arch/arm/boards/terasic-de0-nano-soc/config.h new file mode 100644 index 000..da84fa5 --- /dev/null +++ b/arch/arm