All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Wunderlich <frank-w@public-files.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/4] pci: mediatek: Add pci-driver for mt2701
Date: Wed, 31 Jul 2019 18:09:18 +0200	[thread overview]
Message-ID: <trinity-446d4e3c-6d01-494b-aec4-fb27ac07af17-1564589358834@3c-app-gmx-bs59> (raw)
In-Reply-To: <1564586588.18587.14.camel@mtkswgap22>

Hi Ryder,

you know that we cannot write a full, multi-device driver here :)

> Gesendet: Mittwoch, 31. Juli 2019 um 17:23 Uhr
> Von: "Ryder Lee" <ryder.lee@mediatek.com>
> > imho we can use single driver for different IP generation and that is
> > what we did in linux now.
> >
> > MT7623/MT2701 - mtk_pcie_soc_v1
> > MT7622/MT7629 - v2
> > gen3 IP - TBD

i ack that's the right way, but this cannot be done by people outside (that do not have knowledge about multiple chips the driver should cover) and not only in freetime, so our approach was to create a driver for this chip (that is also used by other soc) as base for future developement (extending for other boards).

on any time it needs to be replaced by a more universal variant to have not the same code multiple times. but thats far away from we can do here

it's not the best code (based on magic values and portability to other devices), but from my point of view we have working sata and do not modify existing code too much (to avoid side-effects), but only figuring out which consts are used in linux take much time for us

> > phy driver is used for configuring basic settings, there is no complex
> > logic in it. we can even copy and paste the entire block from that
> > driver.
you know the technical details :)
what we do is read out registers in linux and try to adapt this in uboot ;) because drivercode itself is too big for us to understand

> > .version = MTK_PHY_V1
> > case PHY_TYPE_PCIE:
> > 	pcie_phy_instance_init(tphy, instance);
> More specifically, we should use pci_generic_mmap_write/read_config()
> for standard set of confi read/write operations so that we can get rid
> of the helpers here.

a general way is right, but not possible to created by people not working for mtk :) without the right documentation

we do not have the knowledge to port a driver like this from linux to uboot

> I think the uboot driver end up dealing with nothing but just doing some
> initial parts (< 300 lines I guess), or you can take pcie_xilinx or
> pci_tegra as examples.
> > we can directly replace these chunks with mtk_pcie_startup_port()
> > (pcie-mediatek.c) and there are many defines for the registers/bit
> > field.

i tried this, but just C&P does not work ( i'm not that naive :) ) because of many depencies (functions used in linux-variant), i have already changed some things, but it ended in needed touching corefiles of uboot (e.g. extending pci.h) which may break other drivers.

but at least i have this version (with some fix-ups you've mentioned here) on my github-repo so that everybody can use it for my board/other boards using mt2701

https://github.com/frank-w/u-boot/commits/2019-07-bpi-r2-sata_new (will merge that in other main branches till official driver is there)

regards Frank

  reply	other threads:[~2019-07-31 16:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 11:51 [U-Boot] [PATCH 0/4] add pcie/ahci for mt7623/bpi-r2 Frank Wunderlich
2019-07-31 11:51 ` [U-Boot] [PATCH 1/4] ahci-pci: ASM1061 report wrong class, but support AHCI Frank Wunderlich
2019-07-31 11:51 ` [U-Boot] [PATCH 2/4] ata: ahci: Don't forget to clear upper address regs Frank Wunderlich
2019-07-31 11:51 ` [U-Boot] [PATCH 3/4] pci: mediatek: Add pci-driver for mt2701 Frank Wunderlich
2019-07-31 12:45   ` Ryder Lee
2019-07-31 14:13     ` Aleksandr Rybalko
2019-07-31 14:35       ` Ryder Lee
2019-07-31 15:23         ` Ryder Lee
2019-07-31 16:09           ` Frank Wunderlich [this message]
2019-08-01  7:32             ` Ryder Lee
2019-08-04 14:35   ` Frank Wunderlich
2019-07-31 11:51 ` [U-Boot] [PATCH 4/4] arm: dts: Add PCI-E controller for mt7623 Frank Wunderlich
2019-08-04 14:53 ` [U-Boot] [PATCH 0/4] add pcie/ahci for mt7623/bpi-r2 Frank Wunderlich

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=trinity-446d4e3c-6d01-494b-aec4-fb27ac07af17-1564589358834@3c-app-gmx-bs59 \
    --to=frank-w@public-files.de \
    --cc=u-boot@lists.denx.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 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.