mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: Christian Hemp <christian.hemp@posteo.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH] ARM: phyCORE-i.MX8M SOM support
Date: Wed, 6 Feb 2019 17:20:37 -0800	[thread overview]
Message-ID: <CAHQ1cqHrTGZj0aHY3Wr46aAdjT0TQJHijXBo06Tns2FMh3qO1w@mail.gmail.com> (raw)
In-Reply-To: <20190206184122.14423-1-christian.hemp@posteo.de>

On Wed, Feb 6, 2019 at 10:42 AM Christian Hemp <christian.hemp@posteo.de> wrote:
>
> The phyCORE-i.MX8M aka PCL-066 is a SoM containing a i.MX8M SoC.
>
> phyCORE-i.MX8M:
>  - 1GB LPDDR4 RAM
>  - eMMC
>  - microSD
>  - Ethernet
>
> Signed-off-by: Christian Hemp <christian.hemp@posteo.de>
> ---
>  arch/arm/boards/Makefile                      |   1 +
>  arch/arm/boards/phytec-som-imx8m/.gitignore   |   1 +
>  arch/arm/boards/phytec-som-imx8m/Makefile     |   2 +
>  arch/arm/boards/phytec-som-imx8m/board.c      |  55 +
>  arch/arm/boards/phytec-som-imx8m/ddr.h        |  28 +
>  arch/arm/boards/phytec-som-imx8m/ddr_init.c   | 225 +++++
>  .../boards/phytec-som-imx8m/ddrphy_train.c    | 947 ++++++++++++++++++
>  .../flash-header-phycore-imx8mq.imxcfg        |   5 +
>  arch/arm/boards/phytec-som-imx8m/lowlevel.c   | 127 +++
>  arch/arm/configs/imx_v8_defconfig             |   2 +
>  arch/arm/dts/Makefile                         |   1 +
>  arch/arm/dts/imx8mq-phytec-phycore-som.dts    | 328 ++++++
>  arch/arm/mach-imx/Kconfig                     |   7 +
>  images/Makefile.imx                           |   5 +
>  14 files changed, 1734 insertions(+)
>  create mode 100644 arch/arm/boards/phytec-som-imx8m/.gitignore
>  create mode 100644 arch/arm/boards/phytec-som-imx8m/Makefile
>  create mode 100644 arch/arm/boards/phytec-som-imx8m/board.c
>  create mode 100644 arch/arm/boards/phytec-som-imx8m/ddr.h
>  create mode 100644 arch/arm/boards/phytec-som-imx8m/ddr_init.c
>  create mode 100644 arch/arm/boards/phytec-som-imx8m/ddrphy_train.c
>  create mode 100644 arch/arm/boards/phytec-som-imx8m/flash-header-phycore-imx8mq.imxcfg
>  create mode 100644 arch/arm/boards/phytec-som-imx8m/lowlevel.c
>  create mode 100644 arch/arm/dts/imx8mq-phytec-phycore-som.dts
>
> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> index ab5191fe0..b39bbe8c2 100644
> --- a/arch/arm/boards/Makefile
> +++ b/arch/arm/boards/Makefile
> @@ -95,6 +95,7 @@ obj-$(CONFIG_MACH_PCM049)                     += phytec-phycore-omap4460/
>  obj-$(CONFIG_MACH_PHYTEC_SOM_AM335X)           += phytec-som-am335x/
>  obj-$(CONFIG_MACH_PHYTEC_SOM_IMX6)             += phytec-som-imx6/
>  obj-$(CONFIG_MACH_PHYTEC_PHYCORE_IMX7)         += phytec-phycore-imx7/
> +obj-$(CONFIG_MACH_PHYTEC_SOM_IMX8M)            += phytec-som-imx8m/
>  obj-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3)     += plathome-openblocks-ax3/
>  obj-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6)      += plathome-openblocks-a6/
>  obj-$(CONFIG_MACH_PM9261)                      += pm9261/
> diff --git a/arch/arm/boards/phytec-som-imx8m/.gitignore b/arch/arm/boards/phytec-som-imx8m/.gitignore
> new file mode 100644
> index 000000000..ef13747c9
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-imx8m/.gitignore
> @@ -0,0 +1 @@
> +*.ddr-phy-fw*
> diff --git a/arch/arm/boards/phytec-som-imx8m/Makefile b/arch/arm/boards/phytec-som-imx8m/Makefile
> new file mode 100644
> index 000000000..2995f06f0
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-imx8m/Makefile
> @@ -0,0 +1,2 @@
> +obj-y += board.o
> +lwl-y += lowlevel.o ddr_init.o ddrphy_train.o
> diff --git a/arch/arm/boards/phytec-som-imx8m/board.c b/arch/arm/boards/phytec-som-imx8m/board.c
> new file mode 100644
> index 000000000..7779946d1
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-imx8m/board.c
> @@ -0,0 +1,55 @@
> +/*
> + * Copyright (C) 2018 Christian Hemp
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation.
> + *
> + */
> +
> +#include <asm/memory.h>
> +#include <bootsource.h>
> +#include <environment.h>
> +#include <common.h>
> +#include <init.h>
> +#include <linux/sizes.h>
> +#include <mach/bbu.h>
> +
> +#include <envfs.h>
> +
> +static int physom_imx8m_devices_init(void)
> +{
> +       int flags;
> +
> +       if (!of_machine_is_compatible("phytec,imx8mq-pcl066"))
> +               return 0;
> +
> +       barebox_set_hostname("phycore-imx8mq");
> +
> +       flags = bootsource_get_instance() == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0;
> +       imx8mq_bbu_internal_mmc_register_handler("eMMC",
> +                                                "/dev/mmc0.barebox", flags);
> +
> +       flags = bootsource_get_instance() == 1 ? BBU_HANDLER_FLAG_DEFAULT : 0;
> +       imx8mq_bbu_internal_mmc_register_handler("SD",
> +                                                "/dev/mmc1.barebox", flags);
> +
> +       if (bootsource_get_instance() == 0)
> +               of_device_enable_path("/chosen/environment-emmc");
> +       else
> +               of_device_enable_path("/chosen/environment-sd");
> +

I made a similar suggestion to Lucas when he submitted that code for
EVK board, so at the risk of sounding like a broken record, you can
simplify this to:

switch (bootsource_get_instance()) {
    case 0:
        flags_mmc = BBU_HANDLER_FLAG_DEFAULT;
        flags_sd  = 0;
        of_device_enable_path("/chosen/environment-emmc");
        break;
    case 1:
        flags_mmc = 0;
        flags_sd  = BBU_HANDLER_FLAG_DEFAULT;
        of_device_enable_path("/chosen/environment-sd");
    break;
}

imx8mq_bbu_internal_mmc_register_handler("eMMC", "/dev/mmc0.barebox",

   flags_mmc);
imx8mq_bbu_internal_mmc_register_handler("SD", "/dev/mmc1.barebox",

   flags_sd);


Thanks,
Andrey Smirnov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2019-02-07  1:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06 18:41 Christian Hemp
2019-02-07  1:20 ` Andrey Smirnov [this message]
2019-02-11  8:20 ` Sascha Hauer
2019-02-11 11:00 ` Lucas Stach
2019-02-13  6:14   ` Oleksij Rempel
2019-02-14 18:20     ` Christian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHQ1cqHrTGZj0aHY3Wr46aAdjT0TQJHijXBo06Tns2FMh3qO1w@mail.gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=christian.hemp@posteo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox