* [PATCH] Add initial support for the EVB-KSZ9477 eval board
@ 2018-11-02 9:07 Sascha Hauer
2018-11-02 23:31 ` Sam Ravnborg
2018-11-07 13:37 ` Roland Hieber
0 siblings, 2 replies; 6+ messages in thread
From: Sascha Hauer @ 2018-11-02 9:07 UTC (permalink / raw)
To: Barebox List; +Cc: Ahmad Fatoum
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
The EVB-KSZ9477 is an evaluation board for the KSZ9477 ethernet switch.
This board is equipped with a atsama5d3 SoC with 256MiB of SDRAM, 256MiB
of NAND flash and a SD card slot.
For now only second stage booting is supported with AT91bootstrap as
first stage loader.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/Makefile | 1 +
.../arm/boards/microchip-ksz9477-evb/Makefile | 1 +
.../boards/microchip-ksz9477-evb/lowlevel.c | 28 ++++
.../configs/microchip_ksz9477_evb_defconfig | 74 +++++++++
arch/arm/dts/Makefile | 1 +
arch/arm/dts/at91-microchip-ksz9477-evb.dts | 153 ++++++++++++++++++
arch/arm/mach-at91/Kconfig | 7 +
arch/arm/mach-at91/Makefile | 2 +-
images/Makefile.at91 | 4 +
9 files changed, 270 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/boards/microchip-ksz9477-evb/Makefile
create mode 100644 arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
create mode 100644 arch/arm/configs/microchip_ksz9477_evb_defconfig
create mode 100644 arch/arm/dts/at91-microchip-ksz9477-evb.dts
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index c737cf3413..c183b89051 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -110,6 +110,7 @@ obj-$(CONFIG_MACH_SABRESD) += freescale-mx6-sabresd/
obj-$(CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB) += freescale-mx6sx-sabresdb/
obj-$(CONFIG_MACH_SAMA5D3XEK) += sama5d3xek/
obj-$(CONFIG_MACH_SAMA5D3_XPLAINED) += sama5d3_xplained/
+obj-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += microchip-ksz9477-evb/
obj-$(CONFIG_MACH_SAMA5D4_XPLAINED) += sama5d4_xplained/
obj-$(CONFIG_MACH_SAMA5D4EK) += sama5d4ek/
obj-$(CONFIG_MACH_SCB9328) += scb9328/
diff --git a/arch/arm/boards/microchip-ksz9477-evb/Makefile b/arch/arm/boards/microchip-ksz9477-evb/Makefile
new file mode 100644
index 0000000000..b08c4a93ca
--- /dev/null
+++ b/arch/arm/boards/microchip-ksz9477-evb/Makefile
@@ -0,0 +1 @@
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c b/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
new file mode 100644
index 0000000000..639958a459
--- /dev/null
+++ b/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2018 Ahmad Fatoum, Pengutronix
+ *
+ * Under GPLv2
+ */
+
+#include <common.h>
+#include <init.h>
+
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+#include <mach/hardware.h>
+
+extern char __dtb_at91_microchip_ksz9477_evb_start[];
+
+ENTRY_FUNCTION(start_sama5d3_xplained_ung8071, r0, r1, r2)
+{
+ void *fdt;
+
+ arm_cpu_lowlevel_init();
+
+ arm_setup_stack(SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE - 16);
+
+ fdt = __dtb_at91_microchip_ksz9477_evb_start + get_runtime_offset();
+
+ barebox_arm_entry(SAMA5_DDRCS, SZ_256M, fdt);
+}
diff --git a/arch/arm/configs/microchip_ksz9477_evb_defconfig b/arch/arm/configs/microchip_ksz9477_evb_defconfig
new file mode 100644
index 0000000000..e7d05bd13b
--- /dev/null
+++ b/arch/arm/configs/microchip_ksz9477_evb_defconfig
@@ -0,0 +1,74 @@
+CONFIG_ARCH_SAMA5D3=y
+CONFIG_AT91_MULTI_BOARDS=y
+CONFIG_MACH_MICROCHIP_KSZ9477_EVB=y
+CONFIG_AEABI=y
+CONFIG_MMU=y
+CONFIG_MALLOC_SIZE=0x0
+CONFIG_MALLOC_TLSF=y
+CONFIG_KALLSYMS=y
+CONFIG_RELOCATABLE=y
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_MENU=y
+CONFIG_BOOTM_SHOW_TYPE=y
+CONFIG_BOOTM_OFTREE=y
+CONFIG_BOOTM_OFTREE_UIMAGE=y
+CONFIG_CONSOLE_ALLOW_COLOR=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_DEBUG_INFO=y
+CONFIG_CMD_DMESG=y
+CONFIG_LONGHELP=y
+CONFIG_CMD_IOMEM=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_AT91_BOOT_TEST=y
+# CONFIG_CMD_BOOTU is not set
+CONFIG_CMD_GO=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_UIMAGE=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_DEFAULTENV=y
+CONFIG_CMD_LOADENV=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_MAGICVAR=y
+CONFIG_CMD_MAGICVAR_HELP=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_FILETYPE=y
+CONFIG_CMD_LN=y
+CONFIG_CMD_MD5SUM=y
+CONFIG_CMD_LET=y
+CONFIG_CMD_MSLEEP=y
+CONFIG_CMD_READF=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_CRC=y
+CONFIG_CMD_CRC_CMP=y
+CONFIG_CMD_MM=y
+CONFIG_CMD_CLK=y
+CONFIG_CMD_DETECT=y
+CONFIG_CMD_FLASH=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_BAREBOX_UPDATE=y
+CONFIG_CMD_OF_NODE=y
+CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_TIME=y
+CONFIG_NET=y
+CONFIG_NET_NFS=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_OF_BAREBOX_ENV_IN_FS=y
+CONFIG_DRIVER_NET_MACB=y
+CONFIG_DRIVER_NET_MICREL=y
+CONFIG_MCI=y
+CONFIG_MCI_STARTUP=y
+CONFIG_MCI_MMC_BOOT_PARTITIONS=y
+CONFIG_MCI_ATMEL=y
+CONFIG_FS_TFTP=y
+CONFIG_FS_NFS=y
+CONFIG_FS_FAT=y
+CONFIG_FS_FAT_WRITE=y
+CONFIG_FS_FAT_LFN=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 1caeca35b4..809ecf67b9 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -115,6 +115,7 @@ pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
vf610-zii-ssmb-spu3.dtb.o \
vf610-zii-scu4-aib-rev-c.dtb.o
pbl-dtb-$(CONFIG_MACH_AT91SAM9263EK_DT) += at91sam9263ek.dtb.o
+pbl-dtb-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += at91-microchip-ksz9477-evb.dtb.o
pbl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
pbl-dtb-$(CONFIG_MACH_ZII_IMX7D_RPU2) += imx7d-zii-rpu2.dtb.o
diff --git a/arch/arm/dts/at91-microchip-ksz9477-evb.dts b/arch/arm/dts/at91-microchip-ksz9477-evb.dts
new file mode 100644
index 0000000000..075cdcd088
--- /dev/null
+++ b/arch/arm/dts/at91-microchip-ksz9477-evb.dts
@@ -0,0 +1,153 @@
+/*
+ * at91-microchip-ksz9477-evb.dts - Device Tree file for the EVB-KSZ9477 board
+ *
+ * Copyright (C) 2014 Atmel,
+ * 2014 Nicolas Ferre <nicolas.ferre@atmel.com>
+ * 2018 Ahmad Fatoum <a.fatoum@pengutronix.de>
+ *
+ * Licensed under GPLv2 or later.
+ */
+/dts-v1/;
+#include <arm/sama5d36.dtsi>
+
+/ {
+ model = "Microchip EVB-KSZ9477";
+ compatible = "atmel,sama5d3-ksz9477-evb", "atmel,sama5d3", "atmel,sama5";
+
+ aliases {
+ mmc0 = &mmc0;
+ };
+
+ chosen {
+ stdout-path = &dbgu;
+
+ environment {
+ compatible = "barebox,environment";
+ device-path = &mmc0, "partname:0";
+ file-path = "barebox.env";
+ };
+ };
+
+ memory {
+ reg = <0x20000000 0x10000000>;
+ };
+};
+
+&pinctrl {
+ board {
+ pinctrl_mmc0_cd: mmc0_cd {
+ atmel,pins =
+ <AT91_PIOE 0 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
+ };
+
+ pinctrl_spi_ksz: spi_ksz {
+ atmel,pins =
+ <
+ AT91_PIOB 28 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH
+ AT91_PIOC 31 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH
+ >;
+ };
+ };
+};
+
+&slow_xtal {
+ clock-frequency = <32768>;
+};
+
+&main_xtal {
+ clock-frequency = <12000000>;
+};
+
+&dbgu {
+ status = "okay";
+};
+
+&macb0 {
+ phy-mode = "rgmii";
+ gpios = <&pioB 28 GPIO_ACTIVE_LOW>;
+ status = "okay";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+};
+
+&mmc0 {
+ pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_dat4_7 &pinctrl_mmc0_cd>;
+ status = "okay";
+ slot@0 {
+ reg = <0>;
+ bus-width = <8>;
+ cd-gpios = <&pioE 0 GPIO_ACTIVE_LOW>;
+ };
+};
+
+&pmc {
+ main: mainck {
+ clock-frequency = <12000000>;
+ };
+};
+
+&spi1 {
+ pinctrl-0 = <&pinctrl_spi_ksz>;
+ cs-gpios = <&pioC 25 0>;
+ id = <1>;
+ status = "okay";
+
+ ksz9477: ksz9477@0 {
+ compatible = "microchip,ksz9477", "microchip,ksz9893";
+ reg = <0>;
+
+ /* Bus clock is 132 MHz. */
+ spi-max-frequency = <44000000>;
+ spi-cpha;
+ spi-cpol;
+ gpios = <&pioB 28 GPIO_ACTIVE_LOW>;
+ status = "okay";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ label = "lan0";
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan1";
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan2";
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan3";
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan4";
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "cpu";
+ ethernet = <&macb0>;
+ phy-mode = "rgmii-id";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+
+ /* port 6 is connected to eth0 */
+ };
+ };
+};
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 0a9cf3ad13..2c949098f0 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -550,6 +550,13 @@ config MACH_AT91SAM9X5EK
Select this if you re using Atmel's AT91SAM9x5-EK Evaluation Kit.
Supported chips are sam9g15, sam9g25, sam9x25, sam9g35 and sam9x35.
+config MACH_MICROCHIP_KSZ9477_EVB
+ bool "Microchip EVB-KSZ9477 Evaluation Kit"
+ select OFDEVICE
+ select COMMON_CLK_OF_PROVIDER
+ help
+ Select this if you are using Microchip's EVB-KSZ9477 Evaluation Kit.
+
endif
comment "AT91 Board Options"
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 664201ceb6..afbc896eea 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -20,10 +20,10 @@ obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam9261_devices.o
obj-$(CONFIG_ARCH_AT91SAM9G10) += at91sam9261.o at91sam9261_devices.o
ifeq ($(CONFIG_OFDEVICE),)
obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam9263_devices.o
+obj-$(CONFIG_ARCH_SAMA5D3) += sama5d3.o sama5d3_devices.o
endif
obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam9260_devices.o
obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam9g45_devices.o
obj-$(CONFIG_ARCH_AT91SAM9X5) += at91sam9x5_devices.o
obj-$(CONFIG_ARCH_AT91SAM9N12) += at91sam9n12.o at91sam9n12_devices.o
-obj-$(CONFIG_ARCH_SAMA5D3) += sama5d3.o sama5d3_devices.o
obj-$(CONFIG_ARCH_SAMA5D4) += sama5d4.o sama5d4_devices.o
diff --git a/images/Makefile.at91 b/images/Makefile.at91
index c7d86563a7..90860fcc15 100644
--- a/images/Makefile.at91
+++ b/images/Makefile.at91
@@ -9,3 +9,7 @@ image-$(CONFIG_MACH_AT91SAM9X5EK) += barebox-at91sam9x5ek.img
pblx-$(CONFIG_MACH_AT91SAM9263EK) += start_at91sam9263ek
FILE_barebox-at91sam9263ek.img = start_at91sam9263ek.pblx
image-$(CONFIG_MACH_AT91SAM9263EK) += barebox-at91sam9263ek.img
+
+pblx-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += start_sama5d3_xplained_ung8071
+FILE_barebox-microchip-ksz9477-evb.img = start_sama5d3_xplained_ung8071.pblx
+image-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += barebox-microchip-ksz9477-evb.img
--
2.19.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add initial support for the EVB-KSZ9477 eval board
2018-11-02 9:07 [PATCH] Add initial support for the EVB-KSZ9477 eval board Sascha Hauer
@ 2018-11-02 23:31 ` Sam Ravnborg
2018-11-05 7:32 ` Sascha Hauer
2018-11-07 13:37 ` Roland Hieber
1 sibling, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2018-11-02 23:31 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List, Ahmad Fatoum
On Fri, Nov 02, 2018 at 10:07:43AM +0100, Sascha Hauer wrote:
> From: Ahmad Fatoum <a.fatoum@pengutronix.de>
>
> The EVB-KSZ9477 is an evaluation board for the KSZ9477 ethernet switch.
> This board is equipped with a atsama5d3 SoC with 256MiB of SDRAM, 256MiB
> of NAND flash and a SD card slot.
>
> For now only second stage booting is supported with AT91bootstrap as
> first stage loader.
Reminds me...
I have noticed a brown-paper-bug introduced by me that would
hurt first stage bootloaders.
But only for at91sam926x boards I think, that this is likely not
considered.
I have not yet come around to submit it as I wanted to check if
this fixed my first stage bootloader on my board.
But time for barebox hacking is limited at the moment :-(
It builds, but I dunno if there are other stupid bugs
yet to surface.
Sam
From 57be69a9b161f98837faa4c4233d79fef07ffe47 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sat, 25 Aug 2018 00:12:11 +0200
Subject: [PATCH 1/7] arm: at91: fix init in board_init
Revert part of previous commit that confused parameters to __raw_writel.
The value and the base address was mixed up.
This was found while looking for an unrelated bug and this
fix has no visible effect during my testing as at91bootstrap have
already done all the low-level init.
But this is an obvious bug that needs fixing and may have positive
impact when trying to use barebox as first stage bootloader.
Fixes: e739663535 (arm: at91: code cleanup in at91sam926x_board_init)
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
.../mach-at91/include/mach/at91sam926x_board_init.h | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-at91/include/mach/at91sam926x_board_init.h b/arch/arm/mach-at91/include/mach/at91sam926x_board_init.h
index 70ae90337..c595c86b1 100644
--- a/arch/arm/mach-at91/include/mach/at91sam926x_board_init.h
+++ b/arch/arm/mach-at91/include/mach/at91sam926x_board_init.h
@@ -48,6 +48,9 @@ struct at91sam926x_board_cfg {
};
+#define at91_sdramc_write(field, value) \
+ __raw_writel((value), cfg->sdramc + (field))
+
static void __always_inline access_sdram(void)
{
writel(0x00000000, AT91_SDRAM_BASE);
@@ -82,38 +85,38 @@ static void __always_inline at91sam926x_sdramc_init(struct at91sam926x_board_cfg
return;
/* SDRAMC_MR : Normal Mode */
- __raw_writel(AT91_SDRAMC_MR, cfg->sdramc + AT91_SDRAMC_MODE_NORMAL);
+ at91_sdramc_write(AT91_SDRAMC_MR, AT91_SDRAMC_MODE_NORMAL);
/* SDRAMC_TR - Refresh Timer register */
- __raw_writel(AT91_SDRAMC_TR, cfg->sdramc + cfg->sdrc_tr1);
+ at91_sdramc_write(AT91_SDRAMC_TR, cfg->sdrc_tr1);
/* SDRAMC_CR - Configuration register*/
- __raw_writel(AT91_SDRAMC_CR, cfg->sdramc + cfg->sdrc_cr);
+ at91_sdramc_write(AT91_SDRAMC_CR, cfg->sdrc_cr);
/* Memory Device Type */
- __raw_writel(AT91_SDRAMC_MDR, cfg->sdramc + cfg->sdrc_mdr);
+ at91_sdramc_write(AT91_SDRAMC_MDR, cfg->sdrc_mdr);
/* SDRAMC_MR : Precharge All */
- __raw_writel(AT91_SDRAMC_MR, cfg->sdramc + AT91_SDRAMC_MODE_PRECHARGE);
+ at91_sdramc_write(AT91_SDRAMC_MR, AT91_SDRAMC_MODE_PRECHARGE);
access_sdram();
/* SDRAMC_MR : refresh */
- __raw_writel(AT91_SDRAMC_MR, cfg->sdramc + AT91_SDRAMC_MODE_REFRESH);
+ at91_sdramc_write(AT91_SDRAMC_MR, AT91_SDRAMC_MODE_REFRESH);
/* access SDRAM 8 times */
for (i = 0; i < 8; i++)
access_sdram();
/* SDRAMC_MR : Load Mode Register */
- __raw_writel(AT91_SDRAMC_MR, cfg->sdramc + AT91_SDRAMC_MODE_LMR);
+ at91_sdramc_write(AT91_SDRAMC_MR, AT91_SDRAMC_MODE_LMR);
access_sdram();
/* SDRAMC_MR : Normal Mode */
- __raw_writel(AT91_SDRAMC_MR, cfg->sdramc + AT91_SDRAMC_MODE_NORMAL);
+ at91_sdramc_write(AT91_SDRAMC_MR, AT91_SDRAMC_MODE_NORMAL);
access_sdram();
/* SDRAMC_TR : Refresh Timer Counter */
- __raw_writel(AT91_SDRAMC_TR, cfg->sdramc + cfg->sdrc_tr2);
+ at91_sdramc_write(AT91_SDRAMC_TR, cfg->sdrc_tr2);
access_sdram();
}
--
2.12.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add initial support for the EVB-KSZ9477 eval board
2018-11-02 23:31 ` Sam Ravnborg
@ 2018-11-05 7:32 ` Sascha Hauer
2018-11-05 13:56 ` Sam Ravnborg
0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2018-11-05 7:32 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: Barebox List, Ahmad Fatoum
Hi Sam,
On Sat, Nov 03, 2018 at 12:31:12AM +0100, Sam Ravnborg wrote:
> On Fri, Nov 02, 2018 at 10:07:43AM +0100, Sascha Hauer wrote:
> > From: Ahmad Fatoum <a.fatoum@pengutronix.de>
> >
> > The EVB-KSZ9477 is an evaluation board for the KSZ9477 ethernet switch.
> > This board is equipped with a atsama5d3 SoC with 256MiB of SDRAM, 256MiB
> > of NAND flash and a SD card slot.
> >
> > For now only second stage booting is supported with AT91bootstrap as
> > first stage loader.
> Reminds me...
>
> I have noticed a brown-paper-bug introduced by me that would
> hurt first stage bootloaders.
> But only for at91sam926x boards I think, that this is likely not
> considered.
> +#define at91_sdramc_write(field, value) \
> + __raw_writel((value), cfg->sdramc + (field))
I prefer using plain __raw_writel rather than creating a new wrapper.
The reason is a series I created that gets rid of these kind of wrappers
in AT91 which decide during compile time on which SoC we are running.
The above is not one of these, but I think doing it without accessors
fits better into the series I created.
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-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add initial support for the EVB-KSZ9477 eval board
2018-11-05 7:32 ` Sascha Hauer
@ 2018-11-05 13:56 ` Sam Ravnborg
0 siblings, 0 replies; 6+ messages in thread
From: Sam Ravnborg @ 2018-11-05 13:56 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List, Ahmad Fatoum
On Mon, Nov 05, 2018 at 08:32:59AM +0100, Sascha Hauer wrote:
> Hi Sam,
>
> On Sat, Nov 03, 2018 at 12:31:12AM +0100, Sam Ravnborg wrote:
> > On Fri, Nov 02, 2018 at 10:07:43AM +0100, Sascha Hauer wrote:
> > > From: Ahmad Fatoum <a.fatoum@pengutronix.de>
> > >
> > > The EVB-KSZ9477 is an evaluation board for the KSZ9477 ethernet switch.
> > > This board is equipped with a atsama5d3 SoC with 256MiB of SDRAM, 256MiB
> > > of NAND flash and a SD card slot.
> > >
> > > For now only second stage booting is supported with AT91bootstrap as
> > > first stage loader.
> > Reminds me...
> >
> > I have noticed a brown-paper-bug introduced by me that would
> > hurt first stage bootloaders.
> > But only for at91sam926x boards I think, that this is likely not
> > considered.
>
>
> > +#define at91_sdramc_write(field, value) \
> > + __raw_writel((value), cfg->sdramc + (field))
>
> I prefer using plain __raw_writel rather than creating a new wrapper.
> The reason is a series I created that gets rid of these kind of wrappers
> in AT91 which decide during compile time on which SoC we are running.
> The above is not one of these, but I think doing it without accessors
> fits better into the series I created.
Fine, and thanks a lot for taking care of this!
Sam
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add initial support for the EVB-KSZ9477 eval board
2018-11-02 9:07 [PATCH] Add initial support for the EVB-KSZ9477 eval board Sascha Hauer
2018-11-02 23:31 ` Sam Ravnborg
@ 2018-11-07 13:37 ` Roland Hieber
2018-11-07 20:57 ` Sam Ravnborg
1 sibling, 1 reply; 6+ messages in thread
From: Roland Hieber @ 2018-11-07 13:37 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List, Ahmad Fatoum
On Fri, Nov 02, 2018 at 10:07:43AM +0100, Sascha Hauer wrote:
> From: Ahmad Fatoum <a.fatoum@pengutronix.de>
>
> The EVB-KSZ9477 is an evaluation board for the KSZ9477 ethernet switch.
> This board is equipped with a atsama5d3 SoC with 256MiB of SDRAM, 256MiB
> of NAND flash and a SD card slot.
>
> For now only second stage booting is supported with AT91bootstrap as
> first stage loader.
I think this fact should probably also documented in an additional
Documentation/boards/…, no?
- Roland
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> arch/arm/boards/Makefile | 1 +
> .../arm/boards/microchip-ksz9477-evb/Makefile | 1 +
> .../boards/microchip-ksz9477-evb/lowlevel.c | 28 ++++
> .../configs/microchip_ksz9477_evb_defconfig | 74 +++++++++
> arch/arm/dts/Makefile | 1 +
> arch/arm/dts/at91-microchip-ksz9477-evb.dts | 153 ++++++++++++++++++
> arch/arm/mach-at91/Kconfig | 7 +
> arch/arm/mach-at91/Makefile | 2 +-
> images/Makefile.at91 | 4 +
> 9 files changed, 270 insertions(+), 1 deletion(-)
> create mode 100644 arch/arm/boards/microchip-ksz9477-evb/Makefile
> create mode 100644 arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
> create mode 100644 arch/arm/configs/microchip_ksz9477_evb_defconfig
> create mode 100644 arch/arm/dts/at91-microchip-ksz9477-evb.dts
>
> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> index c737cf3413..c183b89051 100644
> --- a/arch/arm/boards/Makefile
> +++ b/arch/arm/boards/Makefile
> @@ -110,6 +110,7 @@ obj-$(CONFIG_MACH_SABRESD) += freescale-mx6-sabresd/
> obj-$(CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB) += freescale-mx6sx-sabresdb/
> obj-$(CONFIG_MACH_SAMA5D3XEK) += sama5d3xek/
> obj-$(CONFIG_MACH_SAMA5D3_XPLAINED) += sama5d3_xplained/
> +obj-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += microchip-ksz9477-evb/
> obj-$(CONFIG_MACH_SAMA5D4_XPLAINED) += sama5d4_xplained/
> obj-$(CONFIG_MACH_SAMA5D4EK) += sama5d4ek/
> obj-$(CONFIG_MACH_SCB9328) += scb9328/
> diff --git a/arch/arm/boards/microchip-ksz9477-evb/Makefile b/arch/arm/boards/microchip-ksz9477-evb/Makefile
> new file mode 100644
> index 0000000000..b08c4a93ca
> --- /dev/null
> +++ b/arch/arm/boards/microchip-ksz9477-evb/Makefile
> @@ -0,0 +1 @@
> +lwl-y += lowlevel.o
> diff --git a/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c b/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
> new file mode 100644
> index 0000000000..639958a459
> --- /dev/null
> +++ b/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
> @@ -0,0 +1,28 @@
> +/*
> + * Copyright (C) 2018 Ahmad Fatoum, Pengutronix
> + *
> + * Under GPLv2
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +
> +#include <asm/barebox-arm-head.h>
> +#include <asm/barebox-arm.h>
> +
> +#include <mach/hardware.h>
> +
> +extern char __dtb_at91_microchip_ksz9477_evb_start[];
> +
> +ENTRY_FUNCTION(start_sama5d3_xplained_ung8071, r0, r1, r2)
> +{
> + void *fdt;
> +
> + arm_cpu_lowlevel_init();
> +
> + arm_setup_stack(SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE - 16);
> +
> + fdt = __dtb_at91_microchip_ksz9477_evb_start + get_runtime_offset();
> +
> + barebox_arm_entry(SAMA5_DDRCS, SZ_256M, fdt);
> +}
> diff --git a/arch/arm/configs/microchip_ksz9477_evb_defconfig b/arch/arm/configs/microchip_ksz9477_evb_defconfig
> new file mode 100644
> index 0000000000..e7d05bd13b
> --- /dev/null
> +++ b/arch/arm/configs/microchip_ksz9477_evb_defconfig
> @@ -0,0 +1,74 @@
> +CONFIG_ARCH_SAMA5D3=y
> +CONFIG_AT91_MULTI_BOARDS=y
> +CONFIG_MACH_MICROCHIP_KSZ9477_EVB=y
> +CONFIG_AEABI=y
> +CONFIG_MMU=y
> +CONFIG_MALLOC_SIZE=0x0
> +CONFIG_MALLOC_TLSF=y
> +CONFIG_KALLSYMS=y
> +CONFIG_RELOCATABLE=y
> +CONFIG_HUSH_FANCY_PROMPT=y
> +CONFIG_CMDLINE_EDITING=y
> +CONFIG_AUTO_COMPLETE=y
> +CONFIG_MENU=y
> +CONFIG_BOOTM_SHOW_TYPE=y
> +CONFIG_BOOTM_OFTREE=y
> +CONFIG_BOOTM_OFTREE_UIMAGE=y
> +CONFIG_CONSOLE_ALLOW_COLOR=y
> +CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
> +CONFIG_DEBUG_INFO=y
> +CONFIG_CMD_DMESG=y
> +CONFIG_LONGHELP=y
> +CONFIG_CMD_IOMEM=y
> +CONFIG_CMD_MEMINFO=y
> +CONFIG_CMD_AT91_BOOT_TEST=y
> +# CONFIG_CMD_BOOTU is not set
> +CONFIG_CMD_GO=y
> +CONFIG_CMD_RESET=y
> +CONFIG_CMD_UIMAGE=y
> +CONFIG_CMD_EXPORT=y
> +CONFIG_CMD_DEFAULTENV=y
> +CONFIG_CMD_LOADENV=y
> +CONFIG_CMD_PRINTENV=y
> +CONFIG_CMD_MAGICVAR=y
> +CONFIG_CMD_MAGICVAR_HELP=y
> +CONFIG_CMD_SAVEENV=y
> +CONFIG_CMD_FILETYPE=y
> +CONFIG_CMD_LN=y
> +CONFIG_CMD_MD5SUM=y
> +CONFIG_CMD_LET=y
> +CONFIG_CMD_MSLEEP=y
> +CONFIG_CMD_READF=y
> +CONFIG_CMD_SLEEP=y
> +CONFIG_CMD_DHCP=y
> +CONFIG_CMD_PING=y
> +CONFIG_CMD_ECHO_E=y
> +CONFIG_CMD_EDIT=y
> +CONFIG_CMD_TIMEOUT=y
> +CONFIG_CMD_CRC=y
> +CONFIG_CMD_CRC_CMP=y
> +CONFIG_CMD_MM=y
> +CONFIG_CMD_CLK=y
> +CONFIG_CMD_DETECT=y
> +CONFIG_CMD_FLASH=y
> +CONFIG_CMD_GPIO=y
> +CONFIG_CMD_BAREBOX_UPDATE=y
> +CONFIG_CMD_OF_NODE=y
> +CONFIG_CMD_OF_PROPERTY=y
> +CONFIG_CMD_OFTREE=y
> +CONFIG_CMD_TIME=y
> +CONFIG_NET=y
> +CONFIG_NET_NFS=y
> +CONFIG_OF_BAREBOX_DRIVERS=y
> +CONFIG_OF_BAREBOX_ENV_IN_FS=y
> +CONFIG_DRIVER_NET_MACB=y
> +CONFIG_DRIVER_NET_MICREL=y
> +CONFIG_MCI=y
> +CONFIG_MCI_STARTUP=y
> +CONFIG_MCI_MMC_BOOT_PARTITIONS=y
> +CONFIG_MCI_ATMEL=y
> +CONFIG_FS_TFTP=y
> +CONFIG_FS_NFS=y
> +CONFIG_FS_FAT=y
> +CONFIG_FS_FAT_WRITE=y
> +CONFIG_FS_FAT_LFN=y
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 1caeca35b4..809ecf67b9 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -115,6 +115,7 @@ pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
> vf610-zii-ssmb-spu3.dtb.o \
> vf610-zii-scu4-aib-rev-c.dtb.o
> pbl-dtb-$(CONFIG_MACH_AT91SAM9263EK_DT) += at91sam9263ek.dtb.o
> +pbl-dtb-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += at91-microchip-ksz9477-evb.dtb.o
> pbl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
>
> pbl-dtb-$(CONFIG_MACH_ZII_IMX7D_RPU2) += imx7d-zii-rpu2.dtb.o
> diff --git a/arch/arm/dts/at91-microchip-ksz9477-evb.dts b/arch/arm/dts/at91-microchip-ksz9477-evb.dts
> new file mode 100644
> index 0000000000..075cdcd088
> --- /dev/null
> +++ b/arch/arm/dts/at91-microchip-ksz9477-evb.dts
> @@ -0,0 +1,153 @@
> +/*
> + * at91-microchip-ksz9477-evb.dts - Device Tree file for the EVB-KSZ9477 board
> + *
> + * Copyright (C) 2014 Atmel,
> + * 2014 Nicolas Ferre <nicolas.ferre@atmel.com>
> + * 2018 Ahmad Fatoum <a.fatoum@pengutronix.de>
> + *
> + * Licensed under GPLv2 or later.
> + */
> +/dts-v1/;
> +#include <arm/sama5d36.dtsi>
> +
> +/ {
> + model = "Microchip EVB-KSZ9477";
> + compatible = "atmel,sama5d3-ksz9477-evb", "atmel,sama5d3", "atmel,sama5";
> +
> + aliases {
> + mmc0 = &mmc0;
> + };
> +
> + chosen {
> + stdout-path = &dbgu;
> +
> + environment {
> + compatible = "barebox,environment";
> + device-path = &mmc0, "partname:0";
> + file-path = "barebox.env";
> + };
> + };
> +
> + memory {
> + reg = <0x20000000 0x10000000>;
> + };
> +};
> +
> +&pinctrl {
> + board {
> + pinctrl_mmc0_cd: mmc0_cd {
> + atmel,pins =
> + <AT91_PIOE 0 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
> + };
> +
> + pinctrl_spi_ksz: spi_ksz {
> + atmel,pins =
> + <
> + AT91_PIOB 28 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH
> + AT91_PIOC 31 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH
> + >;
> + };
> + };
> +};
> +
> +&slow_xtal {
> + clock-frequency = <32768>;
> +};
> +
> +&main_xtal {
> + clock-frequency = <12000000>;
> +};
> +
> +&dbgu {
> + status = "okay";
> +};
> +
> +&macb0 {
> + phy-mode = "rgmii";
> + gpios = <&pioB 28 GPIO_ACTIVE_LOW>;
> + status = "okay";
> +
> + fixed-link {
> + speed = <1000>;
> + full-duplex;
> + };
> +};
> +
> +&mmc0 {
> + pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_dat4_7 &pinctrl_mmc0_cd>;
> + status = "okay";
> + slot@0 {
> + reg = <0>;
> + bus-width = <8>;
> + cd-gpios = <&pioE 0 GPIO_ACTIVE_LOW>;
> + };
> +};
> +
> +&pmc {
> + main: mainck {
> + clock-frequency = <12000000>;
> + };
> +};
> +
> +&spi1 {
> + pinctrl-0 = <&pinctrl_spi_ksz>;
> + cs-gpios = <&pioC 25 0>;
> + id = <1>;
> + status = "okay";
> +
> + ksz9477: ksz9477@0 {
> + compatible = "microchip,ksz9477", "microchip,ksz9893";
> + reg = <0>;
> +
> + /* Bus clock is 132 MHz. */
> + spi-max-frequency = <44000000>;
> + spi-cpha;
> + spi-cpol;
> + gpios = <&pioB 28 GPIO_ACTIVE_LOW>;
> + status = "okay";
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + label = "lan0";
> + };
> +
> + port@1 {
> + reg = <1>;
> + label = "lan1";
> + };
> +
> + port@2 {
> + reg = <2>;
> + label = "lan2";
> + };
> +
> + port@3 {
> + reg = <3>;
> + label = "lan3";
> + };
> +
> + port@4 {
> + reg = <4>;
> + label = "lan4";
> + };
> +
> + port@5 {
> + reg = <5>;
> + label = "cpu";
> + ethernet = <&macb0>;
> + phy-mode = "rgmii-id";
> +
> + fixed-link {
> + speed = <1000>;
> + full-duplex;
> + };
> + };
> +
> + /* port 6 is connected to eth0 */
> + };
> + };
> +};
> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
> index 0a9cf3ad13..2c949098f0 100644
> --- a/arch/arm/mach-at91/Kconfig
> +++ b/arch/arm/mach-at91/Kconfig
> @@ -550,6 +550,13 @@ config MACH_AT91SAM9X5EK
> Select this if you re using Atmel's AT91SAM9x5-EK Evaluation Kit.
> Supported chips are sam9g15, sam9g25, sam9x25, sam9g35 and sam9x35.
>
> +config MACH_MICROCHIP_KSZ9477_EVB
> + bool "Microchip EVB-KSZ9477 Evaluation Kit"
> + select OFDEVICE
> + select COMMON_CLK_OF_PROVIDER
> + help
> + Select this if you are using Microchip's EVB-KSZ9477 Evaluation Kit.
> +
> endif
>
> comment "AT91 Board Options"
> diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
> index 664201ceb6..afbc896eea 100644
> --- a/arch/arm/mach-at91/Makefile
> +++ b/arch/arm/mach-at91/Makefile
> @@ -20,10 +20,10 @@ obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam9261_devices.o
> obj-$(CONFIG_ARCH_AT91SAM9G10) += at91sam9261.o at91sam9261_devices.o
> ifeq ($(CONFIG_OFDEVICE),)
> obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam9263_devices.o
> +obj-$(CONFIG_ARCH_SAMA5D3) += sama5d3.o sama5d3_devices.o
> endif
> obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam9260_devices.o
> obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam9g45_devices.o
> obj-$(CONFIG_ARCH_AT91SAM9X5) += at91sam9x5_devices.o
> obj-$(CONFIG_ARCH_AT91SAM9N12) += at91sam9n12.o at91sam9n12_devices.o
> -obj-$(CONFIG_ARCH_SAMA5D3) += sama5d3.o sama5d3_devices.o
> obj-$(CONFIG_ARCH_SAMA5D4) += sama5d4.o sama5d4_devices.o
> diff --git a/images/Makefile.at91 b/images/Makefile.at91
> index c7d86563a7..90860fcc15 100644
> --- a/images/Makefile.at91
> +++ b/images/Makefile.at91
> @@ -9,3 +9,7 @@ image-$(CONFIG_MACH_AT91SAM9X5EK) += barebox-at91sam9x5ek.img
> pblx-$(CONFIG_MACH_AT91SAM9263EK) += start_at91sam9263ek
> FILE_barebox-at91sam9263ek.img = start_at91sam9263ek.pblx
> image-$(CONFIG_MACH_AT91SAM9263EK) += barebox-at91sam9263ek.img
> +
> +pblx-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += start_sama5d3_xplained_ung8071
> +FILE_barebox-microchip-ksz9477-evb.img = start_sama5d3_xplained_ung8071.pblx
> +image-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += barebox-microchip-ksz9477-evb.img
> --
> 2.19.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Roland Hieber | r.hieber@pengutronix.de |
Pengutronix e.K. | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add initial support for the EVB-KSZ9477 eval board
2018-11-07 13:37 ` Roland Hieber
@ 2018-11-07 20:57 ` Sam Ravnborg
0 siblings, 0 replies; 6+ messages in thread
From: Sam Ravnborg @ 2018-11-07 20:57 UTC (permalink / raw)
To: Roland Hieber; +Cc: Barebox List, Ahmad Fatoum
On Wed, Nov 07, 2018 at 02:37:45PM +0100, Roland Hieber wrote:
> On Fri, Nov 02, 2018 at 10:07:43AM +0100, Sascha Hauer wrote:
> > From: Ahmad Fatoum <a.fatoum@pengutronix.de>
> >
> > The EVB-KSZ9477 is an evaluation board for the KSZ9477 ethernet switch.
> > This board is equipped with a atsama5d3 SoC with 256MiB of SDRAM, 256MiB
> > of NAND flash and a SD card slot.
> >
> > For now only second stage booting is supported with AT91bootstrap as
> > first stage loader.
>
> I think this fact should probably also documented in an additional
> Documentation/boards/…, no?
It is somewhere on my todo list to make some docs for at91.
But it should be easy to beat me here.
Sam
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-11-07 20:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-02 9:07 [PATCH] Add initial support for the EVB-KSZ9477 eval board Sascha Hauer
2018-11-02 23:31 ` Sam Ravnborg
2018-11-05 7:32 ` Sascha Hauer
2018-11-05 13:56 ` Sam Ravnborg
2018-11-07 13:37 ` Roland Hieber
2018-11-07 20:57 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox