All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	 Oliver Graute <oliver.graute@kococonnector.com>,
	Michael Walle <michael@walle.cc>,
	 Anup Patel <anup.patel@wdc.com>,
	Jonathan Balkind <jbalkind@ucsb.edu>,
	 Tianrui Wei <tianrui-wei@outlook.com>,
	Padmarao Begari <padmarao.begari@microchip.com>,
	 Kishon Vijay Abraham I <kishon@ti.com>,
	Stephan Gerhold <stephan@gerhold.net>,
	 Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Bin Meng <bin.meng@windriver.com>,
	 Asherah Connor <ashe@kivikakk.ee>,
	Michal Simek <michal.simek@xilinx.com>,
	 Wasim Khan <wasim.khan@nxp.com>, Ye Li <ye.li@nxp.com>,
	 Igor Opaniuk <igor.opaniuk@foundries.io>,
	Stefan Roese <sr@denx.de>,  Minkyu Kang <mk7.kang@samsung.com>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	 Weijie Gao <weijie.gao@mediatek.com>,
	Vabhav Sharma <vabhav.sharma@nxp.com>,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Pratyush Yadav <p.yadav@ti.com>
Subject: Re: [PATCH 0/5] Apple M1 Support
Date: Tue, 28 Sep 2021 06:07:23 -0600	[thread overview]
Message-ID: <CAPnjgZ1+7fzNbMOfbW8EEmKUykbV+yNwa+4biRn6biijLMjQUA@mail.gmail.com> (raw)
In-Reply-To: <56148deea122ffbb@bloch.sibelius.xs4all.nl>

Hi Mark,

On Tue, 28 Sept 2021 at 01:36, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>
> > From: Simon Glass <sjg@chromium.org>
> > Date: Mon, 27 Sep 2021 21:46:56 -0600
> >
> > Hi Mark,
> >
> > On Sun, 26 Sept 2021 at 09:53, Simon Glass <sjg@chromium.org> wrote:
> > >
> > > Hi Mark,
> > >
> > > On Sat, 25 Sept 2021 at 10:46, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> > > >
> > > > > From: Simon Glass <sjg@chromium.org>
> > > > > Date: Sat, 25 Sep 2021 08:42:30 -0600
> > > > >
> > > > > Hi Mark,
> > > > >
> > > > > On Sat, 25 Sept 2021 at 07:52, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> > > > > >
> > > > > > > From: Simon Glass <sjg@chromium.org>
> > > > > > > Date: Sat, 25 Sep 2021 07:27:41 -0600
> > > > > > >
> > > > > > > Hi Mark,
> > > > > > >
> > > > > > > On Sat, 25 Sept 2021 at 02:11, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> > > > > > > >
> > > > > > > > > From: Simon Glass <sjg@chromium.org>
> > > > > > > > > Date: Fri, 24 Sep 2021 19:20:32 -0600
> > > > > > > > >
> > > > > > > > > Hi Mark,
> > > > > > > > >
> > > > > > > > > On Sat, 18 Sept 2021 at 07:54, Mark Kettenis <kettenis@openbsd.org> 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.
>
> Maybe ask on #asahi; apparently not all type-C to type-C cables have
> all the necessary wires.  But when we briefly tried this during the
> last OpenBSD hackathon, I couldn't get it to work either.

Thanks for the tip. I asked on irc and found I was not setting the
baud rate, and screen doesn't seem to work. But this works:

sudo picocom -q --omap crlf --imap lfcrlf -b 115200 /dev/tty.debug-console

Regards,
Simon

      reply	other threads:[~2021-09-28 12:07 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
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 [this message]

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=CAPnjgZ1+7fzNbMOfbW8EEmKUykbV+yNwa+4biRn6biijLMjQUA@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=anup.patel@wdc.com \
    --cc=ashe@kivikakk.ee \
    --cc=bin.meng@windriver.com \
    --cc=igor.opaniuk@foundries.io \
    --cc=jbalkind@ucsb.edu \
    --cc=kettenis@openbsd.org \
    --cc=kishon@ti.com \
    --cc=mark.kettenis@xs4all.nl \
    --cc=michael@walle.cc \
    --cc=michal.simek@xilinx.com \
    --cc=mk7.kang@samsung.com \
    --cc=oliver.graute@kococonnector.com \
    --cc=p.yadav@ti.com \
    --cc=padmarao.begari@microchip.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=ye.li@nxp.com \
    /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 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.