From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A00DEC433EF for ; Tue, 28 Sep 2021 03:47:20 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF8F961213 for ; Tue, 28 Sep 2021 03:47:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BF8F961213 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3BF4282D93; Tue, 28 Sep 2021 05:47:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YX2SQHyz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 77BF582D1C; Tue, 28 Sep 2021 05:47:15 +0200 (CEST) Received: from mail-vk1-xa34.google.com (mail-vk1-xa34.google.com [IPv6:2607:f8b0:4864:20::a34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 64C7582DB7 for ; Tue, 28 Sep 2021 05:47:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-vk1-xa34.google.com with SMTP id o204so7870790vko.9 for ; Mon, 27 Sep 2021 20:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wfJ0ajHttOg6xPrs7/F/2Ere/WJQQRadjEKxLDP64iY=; b=YX2SQHyzW670t5/N3Y7DME6dZODsJguQxH7q6/Arb7SlIzTHrtHhvtMV7+izRPjNsh OouATycw+RtoyseX1ncStMRIPyKR2btdkIN5YxnKZjotlzZXpWhEOhBO2VSK6sJKhHFI N0k8u1NX6aex5Y10Og3/C+3zrRWCrtz9JQztQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wfJ0ajHttOg6xPrs7/F/2Ere/WJQQRadjEKxLDP64iY=; b=LlqlAcsJpx3p1ZCZQNzKm/TYZWR0mSuncFA1mqL7nzu7KRCdVBBQBCcIvvoOJylhTi ZILSrz8RgdgUnrgkaLGIuzRV/WEeBeY/3wUSLjn47Oma+rGBWHJdMjTxgmU7HmHed2+H zJWFn3Uw3L/05te+ZuG8NpZb3Sq6JGHFhwQXFQ0RSQig+NsBjxfj/khEoIeM/9u3sXlU rRhwNAuxKZdCeB8bN2uUfxuekclJ8v4wz9y/gXWHmihgkPSZ2cTonop8smJ/iBwk8Sj9 qCl6ZRMWx1+qBCheQu0NlIbUfZGMkN+qNJ1uuljELFXKor0HqaBhVtIx2Jk1G3GJzu7y /CdQ== X-Gm-Message-State: AOAM531Qv1QYywruGep+Y6aw7T6tkaJL/rfxX9/7qmPYf3j2K7gQHbEn ackJvXi/wzQfq7oLyXD7DKjoe4FGSLSEHs5vUroXKg== X-Google-Smtp-Source: ABdhPJyZ+PaJ54nz2mTIDOfxXQtp2CiZrAmCvJllI3Rc7pVipwbm0P9FWiyjtjd25Q7lJ1J4vyxY0F3MeXIOH8dyf2A= X-Received: by 2002:a1f:2952:: with SMTP id p79mr3245418vkp.11.1632800827752; Mon, 27 Sep 2021 20:47:07 -0700 (PDT) MIME-Version: 1.0 References: <20210918135437.36667-1-kettenis@openbsd.org> <5614837a43225d79@bloch.sibelius.xs4all.nl> <561484633aa0ee25@bloch.sibelius.xs4all.nl> <561484ff0393d2bb@bloch.sibelius.xs4all.nl> In-Reply-To: From: Simon Glass Date: Mon, 27 Sep 2021 21:46:56 -0600 Message-ID: Subject: Re: [PATCH 0/5] Apple M1 Support To: Mark Kettenis Cc: Mark Kettenis , U-Boot Mailing List , Oliver Graute , Michael Walle , Anup Patel , Jonathan Balkind , Tianrui Wei , Padmarao Begari , Kishon Vijay Abraham I , Stephan Gerhold , Heinrich Schuchardt , Bin Meng , Asherah Connor , Michal Simek , Wasim Khan , Ye Li , Igor Opaniuk , Stefan Roese , Minkyu Kang , AKASHI Takahiro , Weijie Gao , Vabhav Sharma , Andy Shevchenko , Pratyush Yadav Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi Mark, On Sun, 26 Sept 2021 at 09:53, Simon Glass wrote: > > Hi Mark, > > On Sat, 25 Sept 2021 at 10:46, Mark Kettenis wrote: > > > > > From: Simon Glass > > > Date: Sat, 25 Sep 2021 08:42:30 -0600 > > > > > > Hi Mark, > > > > > > On Sat, 25 Sept 2021 at 07:52, Mark Kettenis wrote: > > > > > > > > > From: Simon Glass > > > > > Date: Sat, 25 Sep 2021 07:27:41 -0600 > > > > > > > > > > Hi Mark, > > > > > > > > > > On Sat, 25 Sept 2021 at 02:11, Mark Kettenis wrote: > > > > > > > > > > > > > From: Simon Glass > > > > > > > Date: Fri, 24 Sep 2021 19:20:32 -0600 > > > > > > > > > > > > > > Hi Mark, > > > > > > > > > > > > > > On Sat, 18 Sept 2021 at 07:54, Mark Kettenis wrote: > > > > > > > > > > > > > > > > This series adds basic support for Apple's M1 SoC to U-Boot. > > > > > > > > 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. > > > > > > > > > > > > > > > > The goal here is to privide an UEFI interface on these machines that > > > > > > > > > > > > > > provide > > > > > > > > > > > > > > > allows booting various open source OSes. This initial series provides > > > > > > > > support for the serial port, framebuffer and the USB 3.1 Type-C ports. > > > > > > > > It can boot a support OS (e.g. OpenBSD/arm64) from a USB disk. > > > > > > > > > > > > > > > > Mark Kettenis (5): > > > > > > > > arm: apple: Add initial support for Apple's M1 SoC > > > > > > > > serial: s5p: Add Apple M1 support > > > > > > > > misc: Add Apple DART driver > > > > > > > > arm: dts: apple: Add preliminary device trees > > > > > > > > doc: board: apple: Add Apple M1 documentation > > > > > > > > > > > > > > > > arch/arm/Kconfig | 22 + > > > > > > > > arch/arm/Makefile | 1 + > > > > > > > > arch/arm/dts/t8103-j274.dts | 135 +++++ > > > > > > > > arch/arm/dts/t8103-j293.dts | 97 ++++ > > > > > > > > arch/arm/dts/t8103.dtsi | 506 ++++++++++++++++++ > > > > > > > > arch/arm/include/asm/arch-m1/clk.h | 11 + > > > > > > > > arch/arm/include/asm/arch-m1/uart.h | 41 ++ > > > > > > > > arch/arm/mach-apple/Kconfig | 18 + > > > > > > > > arch/arm/mach-apple/Makefile | 4 + > > > > > > > > arch/arm/mach-apple/board.c | 163 ++++++ > > > > > > > > arch/arm/mach-apple/lowlevel_init.S | 16 + > > > > > > > > configs/apple_m1_defconfig | 14 + > > > > > > > > doc/board/apple/index.rst | 9 + > > > > > > > > doc/board/apple/m1.rst | 54 ++ > > > > > > > > doc/board/index.rst | 1 + > > > > > > > > drivers/misc/Kconfig | 7 + > > > > > > > > drivers/misc/Makefile | 1 + > > > > > > > > drivers/misc/apple_dart.c | 171 ++++++ > > > > > > > > drivers/serial/Kconfig | 2 +- > > > > > > > > drivers/serial/serial_s5p.c | 22 + > > > > > > > > include/configs/apple.h | 38 ++ > > > > > > > > .../interrupt-controller/apple-aic.h | 15 + > > > > > > > > include/dt-bindings/pinctrl/apple.h | 13 + > > > > > > > > include/dt-bindings/spmi/spmi.h | 10 + > > > > > > > > 24 files changed, 1370 insertions(+), 1 deletion(-) > > > > > > > > create mode 100644 arch/arm/dts/t8103-j274.dts > > > > > > > > create mode 100644 arch/arm/dts/t8103-j293.dts > > > > > > > > create mode 100644 arch/arm/dts/t8103.dtsi > > > > > > > > create mode 100644 arch/arm/include/asm/arch-m1/clk.h > > > > > > > > create mode 100644 arch/arm/include/asm/arch-m1/uart.h > > > > > > > > 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 doc/board/apple/index.rst > > > > > > > > create mode 100644 doc/board/apple/m1.rst > > > > > > > > create mode 100644 drivers/misc/apple_dart.c > > > > > > > > create mode 100644 include/configs/apple.h > > > > > > > > create mode 100644 include/dt-bindings/interrupt-controller/apple-aic.h > > > > > > > > create mode 100644 include/dt-bindings/pinctrl/apple.h > > > > > > > > create mode 100644 include/dt-bindings/spmi/spmi.h > > > > > > > > > > > > > > > > -- > > > > > > > > 2.33.0 > > > > > > > > > > > > > > > > > > > > > > I gave this a whirl on a Macbook Air A2337 and needed the patch below > > > > > > > to build the devicetree files. Sorry the formatting is broken. > > > > > > > > > > > > > > Also when booting I get this: > > > > > > > > > > > > > > ... > > > > > > > Preparing to boot kernel at 0x808200000 with fdt at 0x8082e8000 > > > > > > > Valid payload found > > > > > > > Preparing to run next stage at 0x808200000... > > > > > > > MMU: shutting down... > > > > > > > MMU: shutdown successful, clearing caches > > > > > > > > > > > > > > > > > > > > > Then the display clears and it hangs. If I try the J274 devicetree it > > > > > > > just reboots at that point. > > > > > > > > > > > > > > What should I expect? I was hoping for console output as I don't have > > > > > > > serial connected. I don't have a suitable serial cable, and the USB > > > > > > > gadget mode did not result in a ttyACM0 device appearing. > > > > > > > > > > > > For framebuffer support you also need the "30bpp framebuffer support" > > > > > > series I posted earlier: > > > > > > > > > > > > https://patchwork.ozlabs.org/project/uboot/list/?series=262617 > > > > > > > > > > > > With that your should get the usual U-Boot output on the screen. I've > > > > > > not tested the Air, but it should work there. > > > > > > > > > > Ah OK, yes that fixes it, thanks! > > > > > > > > > > So how do I get the keyboard to work in U-Boot? Or are you using > > > > > serial somehow? > > > > > > > > The laptop keyboard doesn't work yet, so I'm using a USB keyboard when > > > > I'm not using a serial console. You need the xhci-dwc3 diff I sent > > > > earlier for that: > > > > > > > > https://patchwork.ozlabs.org/project/uboot/patch/20210916140009.59009-1-kettenis@openbsd.org/ > > > > > > Actually that seems to be applied in mainline now. Yes USB keyboard works. > > > > > > It looks like the keyboard needs SPI and there is some sort of linux > > > keyboard driver, but perhaps not for M1. > > > > Yes. It is certaily doable in u-boot, but not a priority. I plan to > > revisit this once I have a driver going in OpenBSD and a better > > understanding of how the hardware works. > > Makes sense. > > > > > > > > Also it takes for ever to put a test version on the device...how are > > > > > you doing that for development? > > > > > > > > If you install m1n1.macho without a payload, you can then use the > > > > python scripts that come with m1n1 to upload kernels over serial. > > > > There is a USB gadget implementation in m1n1, so you don't need a real > > > > serial connection. Just connect a Linux machine to the M1 Mac using a > > > > USB cable and a USB serial device should show up on the Linux machine > > > > once m1n1 is running on the Mac. Set the M1N1DEVICE environment > > > > variable to the right device name and run: > > > > > > > > $ python3 linux.py --compression=none u-boot-nodtb.bin t8103-j274.dtb > > > > > > OK I see. I did try the USB serial thing but was missing the fact that > > > U-Boot seems to kill it. So this works fine, thank you will await your > > > next series. Any way to get U-Boot serial console going in the same > > > way? > > > > Probably, but the existing USB gadget code in u-boot doesn't seem to > > implement USB serial so it would be a significant amount of work. And > > it would only work after you bring the USB controller up, so it > > wouldn't be very useful for debugging purposes. > > Yse, usbtty.c is very old and doesn't even use driver model, so would > need a refresh. > > > > > There is a real serial port, and if you have another M1 Mac it should > > be fairly easy to access it: > > > > https://github.com/AsahiLinux/docs/wiki/Developer-Quickstart#using-an-m1-machine > > > > Otherwise you need to build some special hardware. > > Yes I saw that but I only have one. Will see if I can steal/find another. OK got a mini as a DUT. It works so far as running macvdmtool on the Air and I can see the /dev/cu.debug-console device, but don't see any serial output when I reboot the DUT. The display works fine, although the USB keyboard only works on the USB-C ports of the mini, not the USB-A ones. Do you use 'screen /dev/cu.debug-console' or something else? I have a cable with SS on it: This is what I see on the air. sudo ./macvdmtool reboot serial Mac type: J313AP Looking for HPM devices... Found: IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/i2c0@35010000/AppleS5L8940XI2CController/hpmBusManager@6B/AppleHPMBusController/hpm0/AppleHPMARM Connection: Sink Status: APP Unlocking... OK Entering DBMa mode... Status: DBMa Rebooting target into normal mode... OK Waiting for connection........ Connected Putting target into serial mode... OK Putting local end into serial mode... OK Exiting DBMa mode... OK sglass@Simons-MacBook-Air macvdmtool So it seems to be connected but I am not seeing serial output from m1n1 or U-Boot. Regards, Simon