From: Simon Glass <sjg@chromium.org> To: Mark Kettenis <mark.kettenis@xs4all.nl> Cc: "Mark Kettenis" <kettenis@openbsd.org>, "U-Boot Mailing List" <u-boot@lists.denx.de>, "Bharat Gooty" <bharat.gooty@broadcom.com>, "Rayagonda Kokatanur" <rayagonda.kokatanur@broadcom.com>, "Oliver Graute" <oliver.graute@kococonnector.com>, "Bin Meng" <bin.meng@windriver.com>, "Leo Liang" <ycliang@andestech.com>, "Tianrui Wei" <tianrui-wei@outlook.com>, "Stephan Gerhold" <stephan@gerhold.net>, "Padmarao Begari" <padmarao.begari@microchip.com>, "Kishon Vijay Abraham I" <kishon@ti.com>, "Heinrich Schuchardt" <xypron.glpk@gmx.de>, "Michael Walle" <michael@walle.cc>, "Masami Hiramatsu" <masami.hiramatsu@linaro.org>, "Asherah Connor" <ashe@kivikakk.ee>, "Wasim Khan" <wasim.khan@nxp.com>, "Michal Simek" <michal.simek@xilinx.com>, "Igor Opaniuk" <igor.opaniuk@foundries.io>, "Heiko Schocher" <hs@denx.de>, "Ye Li" <ye.li@nxp.com>, "Stefan Roese" <sr@denx.de>, "Vabhav Sharma" <vabhav.sharma@nxp.com>, "Marek Behún" <marek.behun@nic.cz>, "Weijie Gao" <weijie.gao@mediatek.com>, "AKASHI Takahiro" <takahiro.akashi@linaro.org>, "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>, "Pratyush Yadav" <p.yadav@ti.com> Subject: Re: [PATCH 1/5] arm: apple: Add initial support for Apple's M1 SoC Date: Mon, 20 Sep 2021 19:11:24 -0600 [thread overview] Message-ID: <CAPnjgZ1LzL5KFf-nuZA71qcPCkQ0A6jF99tcO_eNWT8+dguMfg@mail.gmail.com> (raw) In-Reply-To: <56146ded1ff993a7@bloch.sibelius.xs4all.nl> Hi Mark, On Mon, 20 Sept 2021 at 02:49, Mark Kettenis <mark.kettenis@xs4all.nl> wrote: > > > From: Simon Glass <sjg@chromium.org> > > Date: Sun, 19 Sep 2021 21:15:57 -0600 > > > > Hi Mark, > > > > On Sat, 18 Sept 2021 at 07:55, Mark Kettenis <kettenis@openbsd.org> wrote: > > > > > > Add support for Apple's M1 SoC that is used in "Apple Silicon" > > > Macs. This builds a basic U-Boot that can be used as a payload > > > for the m1n1 boot loader being developed by the Asahi Linux > > > project. > > > > > > Signed-off-by: Mark Kettenis <kettenis@openbsd.org> > > > --- > > > arch/arm/Kconfig | 22 ++++ > > > arch/arm/Makefile | 1 + > > > arch/arm/mach-apple/Kconfig | 18 ++++ > > > arch/arm/mach-apple/Makefile | 4 + > > > arch/arm/mach-apple/board.c | 158 ++++++++++++++++++++++++++++ > > > arch/arm/mach-apple/lowlevel_init.S | 16 +++ > > > configs/apple_m1_defconfig | 14 +++ > > > include/configs/apple.h | 38 +++++++ > > > 8 files changed, 271 insertions(+) > > > create mode 100644 arch/arm/mach-apple/Kconfig > > > create mode 100644 arch/arm/mach-apple/Makefile > > > create mode 100644 arch/arm/mach-apple/board.c > > > create mode 100644 arch/arm/mach-apple/lowlevel_init.S > > > create mode 100644 configs/apple_m1_defconfig > > > create mode 100644 include/configs/apple.h > > > > > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig > > > index b5bd3284cd..7cdea1f615 100644 > > > --- a/arch/arm/Kconfig > > > +++ b/arch/arm/Kconfig > > > @@ -895,6 +895,26 @@ config ARCH_NEXELL > > > select DM > > > select GPIO_EXTRA_HEADER > > > > > > +config ARCH_APPLE > > > + bool "Apple SoCs" > > > + select ARM64 > > > + select LINUX_KERNEL_IMAGE_HEADER > > > + select POSITION_INDEPENDENT > > > + select BLK > > > + select DM > > > + select DM_KEYBOARD > > > + select DM_SERIAL > > > + select DM_USB > > > + select DM_VIDEO > > > + select CMD_USB > > > + select MISC > > > + select OF_CONTROL > > > + select OF_BOARD > > > + select USB > > > + imply CMD_DM > > > + imply CMD_GPT > > > + imply DISTRO_DEFAULTS > > > > Suggest sorting these > > As in sort all the selects alphabetically and sort all the implies > alphabetically seperately? I suppose so. > > Does my use of impy here even make sense? It allows people to disable it, whereas select does not. It looks OK to me. > > This whole Kconfig stuff is a bit alien to me and I must say that it > isn't obvious what "best-practice" is in this area... We try to avoid select so only use it if it really cannot build/run without that feature. From what I can tell you have done that. I know this is a different project, but there are some ideas here: https://docs.zephyrproject.org/1.14.0/guides/kconfig/index.html [..] > > > +int dram_init(void) > > > +{ > > > + int index, node, ret; > > > + fdt_addr_t base; > > > + fdt_size_t size; > > > + > > > + ret = fdtdec_setup_mem_size_base(); > > > + if (ret) > > > + return ret; > > > + > > > + /* Update RAM mapping. */ > > > > Do you want the period at the end of that? > > Given that Bin brought up the same thing, I gather that not having a > full stop at the end of single-line comments is preferred? Yes, the periods just clutter things and people start adding them only when it is a valid sentence, etc. Best to just leave them out. > > > > + index = ARRAY_SIZE(apple_mem_map) - 3; > > > + apple_mem_map[index].virt = gd->ram_base; > > > + apple_mem_map[index].phys = gd->ram_base; > > > + apple_mem_map[index].size = gd->ram_size; > > > + > > > + node = fdt_path_offset(gd->fdt_blob, "/chosen/framebuffer"); > > > > Can you use the ofnode interface here and below? > > I can try... Something like: ofnode node; node = ofnode_path("/chosen/framebuffer"); then use ofnode_get_addr_size() > > > > + if (node < 0) > > > + return 0; > > > + > > > + base = fdtdec_get_addr_size(gd->fdt_blob, node, "reg", &size); > > > + if (base == FDT_ADDR_T_NONE) > > > + return 0; > > > + > > > + /* Add framebuffer mapping. */ > > > + index = ARRAY_SIZE(apple_mem_map) - 2; > > > + apple_mem_map[index].virt = base; > > > + apple_mem_map[index].phys = base; > > > + apple_mem_map[index].size = size; > > > + apple_mem_map[index].attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) | > > > + PTE_BLOCK_INNER_SHARE | PTE_BLOCK_PXN | PTE_BLOCK_UXN; > > > + > > > + return 0; > > > +} [..] > > > diff --git a/arch/arm/mach-apple/lowlevel_init.S b/arch/arm/mach-apple/lowlevel_init.S > > > new file mode 100644 > > > index 0000000000..0f5313163e > > > --- /dev/null > > > +++ b/arch/arm/mach-apple/lowlevel_init.S > > > @@ -0,0 +1,16 @@ > > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > > +/* > > > + * (C) Copyright 2021 Mark Kettenis <kettenis@openbsd.org> > > > + */ > > > + > > > +.align 8 > > > +.global fw_dtb_pointer > > > +fw_dtb_pointer: > > > + .quad 0 > > > + > > > +.global save_boot_params > > > +save_boot_params: > > > + adr x1, fw_dtb_pointer > > > > could use a comment as to where this is set up. Previous-stage > > firmware, I suppose? > > Yes. I'm basically making U-Boot look like a Linux kernel, and m1n1 > passes the DT in x1 just like the Linux kernel expects. > > I suspect using CONFIG_OF_PRIOR_STAGE would make it more obvious what > is happening here. But (a) I didn't know that existed and (b) we > discussed removing that option in the near future. That sounds right to me, but a comment would help. Regards, Simon
next prev parent reply other threads:[~2021-09-21 1:12 UTC|newest] Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-18 13:54 [PATCH 0/5] Apple M1 Support Mark Kettenis 2021-09-18 13:54 ` [PATCH 1/5] arm: apple: Add initial support for Apple's M1 SoC Mark Kettenis 2021-09-19 1:04 ` Bin Meng 2021-09-19 1:17 ` Bin Meng 2021-09-19 20:33 ` Mark Kettenis 2021-09-21 12:42 ` Tom Rini 2021-09-21 15:53 ` Bin Meng 2021-09-21 16:04 ` Tom Rini 2021-09-21 16:08 ` Mark Kettenis 2021-09-25 13:27 ` Simon Glass 2021-09-19 20:05 ` Mark Kettenis 2021-09-20 3:15 ` Simon Glass 2021-09-20 8:49 ` Mark Kettenis 2021-09-21 1:11 ` Simon Glass [this message] 2021-09-18 13:54 ` [PATCH 2/5] serial: s5p: Add Apple M1 support Mark Kettenis 2021-09-19 1:11 ` Bin Meng 2021-09-19 20:30 ` Mark Kettenis 2021-09-20 3:15 ` Simon Glass 2021-09-25 13:27 ` Simon Glass 2021-10-02 22:15 ` Mark Kettenis 2021-10-03 2:01 ` Simon Glass 2021-09-18 13:54 ` [PATCH 3/5] misc: Add Apple DART driver Mark Kettenis 2021-09-20 3:16 ` Simon Glass 2021-09-20 8:33 ` Mark Kettenis 2021-09-21 1:11 ` Simon Glass 2021-09-25 13:27 ` Simon Glass 2021-09-26 20:53 ` Mark Kettenis 2021-09-27 20:14 ` Simon Glass 2021-09-18 13:54 ` [PATCH 4/5] arm: dts: apple: Add preliminary device trees Mark Kettenis 2021-09-20 3:16 ` Simon Glass 2021-09-25 13:27 ` Simon Glass 2021-09-18 13:54 ` [PATCH 5/5] doc: board: apple: Add Apple M1 documentation Mark Kettenis 2021-09-19 1:22 ` Bin Meng 2021-09-20 3:16 ` Simon Glass 2021-09-25 13:27 ` Simon Glass 2021-09-20 8:45 ` Igor Opaniuk 2021-09-25 1:20 ` [PATCH 0/5] Apple M1 Support Simon Glass 2021-09-25 8:11 ` Mark Kettenis 2021-09-25 13:27 ` Simon Glass 2021-09-25 13:52 ` Mark Kettenis 2021-09-25 14:42 ` Simon Glass 2021-09-25 16:45 ` Mark Kettenis 2021-09-26 15:53 ` Simon Glass 2021-09-28 3:46 ` Simon Glass 2021-09-28 7:36 ` Mark Kettenis 2021-09-28 12:07 ` Simon Glass
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=CAPnjgZ1LzL5KFf-nuZA71qcPCkQ0A6jF99tcO_eNWT8+dguMfg@mail.gmail.com \ --to=sjg@chromium.org \ --cc=andriy.shevchenko@linux.intel.com \ --cc=ashe@kivikakk.ee \ --cc=bharat.gooty@broadcom.com \ --cc=bin.meng@windriver.com \ --cc=hs@denx.de \ --cc=igor.opaniuk@foundries.io \ --cc=kettenis@openbsd.org \ --cc=kishon@ti.com \ --cc=marek.behun@nic.cz \ --cc=mark.kettenis@xs4all.nl \ --cc=masami.hiramatsu@linaro.org \ --cc=michael@walle.cc \ --cc=michal.simek@xilinx.com \ --cc=oliver.graute@kococonnector.com \ --cc=p.yadav@ti.com \ --cc=padmarao.begari@microchip.com \ --cc=rayagonda.kokatanur@broadcom.com \ --cc=sr@denx.de \ --cc=stephan@gerhold.net \ --cc=takahiro.akashi@linaro.org \ --cc=tianrui-wei@outlook.com \ --cc=u-boot@lists.denx.de \ --cc=vabhav.sharma@nxp.com \ --cc=wasim.khan@nxp.com \ --cc=weijie.gao@mediatek.com \ --cc=xypron.glpk@gmx.de \ --cc=ycliang@andestech.com \ --cc=ye.li@nxp.com \ --subject='Re: [PATCH 1/5] arm: apple: Add initial support for Apple'\''s M1 SoC' \ /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
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.