Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separate upstreamable GPIO driver from downstream GPIO macros #25

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f5b077c
dt-bindings: usb: cdns,usb3: Fix interrupts order
geertu May 27, 2021
74e0b0f
mmc: dw_mmc-pltfm: Remove unused <linux/clk.h>
geertu May 27, 2021
6b2f79a
dt-bindings: add StarFive Technology Co. Ltd.
pdp7 May 31, 2021
78f22c9
[WIP] dt-bindings: clock: starfive: Add preliminary JH7100 bindings
geertu Jun 1, 2021
c611d3d
[WIP] dt-bindings: clock: starfive: Add preliminary JH7100 Clock Defi…
geertu Jun 1, 2021
b5b8622
[WIP] clk: starfive: Add preliminary JH7100 Clock Generator Driver
geertu Jun 1, 2021
d1d30dd
dt-bindings: gpio: add starfive,jh7100-gpio bindings
pdp7 May 31, 2021
ad78ee0
gpio: starfive-jh7100: Add StarFive JH7100 GPIO driver
huanfeng-sf Jan 7, 2021
20cdd18
[WIP] dt-bindings: dma: dw-axi-dmac: Increase DMA channel limit to 16
geertu May 27, 2021
293b778
drivers/hw_random: Add Starfive VIC Random Number Generator driver
huanfeng-sf Jan 7, 2021
cbba2ac
dt-bindings: hwmon: add starfive,jh7100-temp bindings
esmil Jun 6, 2021
12828f6
hwmon: (sfctemp) Add StarFive JH7100 temperature sensor
esmil Jun 6, 2021
b195ff5
sifive/sifive_l2_cache: Add sifive_l2_flush64_range function
Jan 7, 2021
ce0ed8c
sifive/sifive_l2_cache: Add Starfive support
Feb 15, 2021
e99d8e0
sifive/sifive_l2_cache: Add disabling IRQ option (workaround)
Feb 13, 2021
0197005
sifive/sifive_l2_cache: Print a backtrace on out-of-range flushes
geertu May 21, 2021
b3efff5
drivers/pwm: Add SiFive PWM PTC driver
Jan 7, 2021
24308b1
drivers/pwm/pwm-sifive-ptc: Clear PWM CNTR
Mar 15, 2021
13517e7
drivers/dma: Add dw-axi-dmac-starfive driver for VIC7100
Jan 7, 2021
59955b1
drivers/dma: Fix VIC7100 dw-axi-dmac-platform driver addition
mike-scott May 1, 2021
faa9ae9
drivers/i2c: Improve Synopsys DesignWare I2C adapter driver for StarF…
Jan 7, 2021
c7f839d
drivers/i2c: Add GPIO configuration for VIC7100.
Mar 13, 2021
2ae4c72
net: stmmac: use GFP_DMA32
teknoraver May 21, 2021
0e78566
net: stmmac: Configure gtxclk based on speed
Apr 6, 2021
afb0daa
riscv/starfive: Add VIC7100 support
Jan 7, 2021
d13ec3b
drivers/video/fbdev and drivers/media/platform: starfive drivers added
jackzhustf Jan 10, 2021
aba16a5
drivers/media and video: update fb driver(flush cache) and cam sensor…
jackzhustf Mar 5, 2021
f857e57
video: fbdev: starfive: workaround for unavailable pointer of dtb
jackzhustf Mar 16, 2021
564261f
video: fbdev: starfive: fix compiler warnings
esmil May 6, 2021
f4aa792
video: fbdev: starfive: improve error handling
esmil May 6, 2021
58574ed
video: fbdev: starfive: fix modpost build error (missing license)
sarnold May 13, 2021
535d4aa
video: fbdev: starfive: fix fb bug about HDMI display
May 15, 2021
dafd9d0
video: fbdev: starfive: FB_STARFIVE_HDMI_TDA998X depends on DRM_FBDEV…
geertu May 18, 2021
2a8470b
video: fbdev: starfive: Fix frame buffer reserved memory resource con…
geertu May 18, 2021
ca8a317
spi: cadence-quadspi: Allow compilation on RISC-V
esmil Apr 27, 2021
c40b18d
[HACK] mfd: tps65086: make interrupt line optional
esmil May 3, 2021
a7405e4
power: reset: Add TPS65086 restart driver
esmil May 3, 2021
c485ca4
riscv: dts: Add JH7100 and BeagleV Starlight support
Jan 22, 2021
cda003e
[Not for upstream] Add build instructions
esmil May 5, 2021
57f7282
net: stmmac: Add dcache flush functions for JH7100
Jan 7, 2021
7a144b2
drivers/mmc/host/dw_mmc: Add dcache flush(VIC7100 ONLY).
Jan 6, 2021
6bdd39b
drivers/usb: Add dcache flush(VIC7100 ONLY)
Jan 8, 2021
a7c861b
riscv: dts: jh7100: Add missing I2C3 entry
esmil May 14, 2021
3b0ce8c
riscv: dts: jh7100: Add missing SPI entries
esmil May 14, 2021
ffe3e1d
riscv: dts: jh7100: Cleanup sfivefb entry a bit
esmil May 14, 2021
f1f4dc8
dt-bindings: riscv: add starfive jh7100 bindings
pdp7 Jun 16, 2021
0b0891d
riscv: dts: jh7100: fix soc node compatible
pdp7 Jun 16, 2021
f3270a7
Revert "gpio: starfive-jh7100: Add StarFive JH7100 GPIO driver"
pdp7 Jun 17, 2021
694e3b9
[Not for upstream] add header file with GPIO macros
pdp7 Jun 17, 2021
eb905cd
[Not for upstream] remove unused header gpio-starfive-vic.h
pdp7 Jun 17, 2021
132e529
gpio: starfive-jh7100: Add StarFive JH7100 GPIO driver
pdp7 Jun 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/starfive,jh7100-clkgen.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: StarFive JH7100 Clock Generator

maintainers:
- FIXME <[email protected]>
- Geert Uytterhoeven <[email protected]>

properties:
compatible:
const: starfive,jh7100-clkgen

reg:
maxItems: 1

clocks:
items:
- description: Main clock source (default 25 MHz)
- description: Application-specific clock source (12-27 MHz)

clock-names:
items:
- const: osc0
- const: osc1

'#clock-cells':
const: 1
description:
See <dt-bindings/clock/starfive-jh7100-clkgen.h> for valid indices.

required:
- compatible
- reg
- clocks
- clock-names
- '#clock-cells'

additionalProperties: false

examples:
- |
clkgen: clock-controller@11800000 {
compatible = "starfive,jh7100-clkgen";
reg = <0x11800000 0x10000>;
clocks = <&osc0_clk>, <&osc1_clk>;
clock-names = "osc0", "osc1";
#clock-cells = <1>;
};
6 changes: 3 additions & 3 deletions Documentation/devicetree/bindings/dma/snps,dw-axi-dmac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ properties:

dma-channels:
minimum: 1
maximum: 8
maximum: 16

snps,dma-masters:
description: |
Expand All @@ -71,14 +71,14 @@ properties:
Channel priority specifier associated with the DMA channels.
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 8
maxItems: 16

snps,block-size:
description: |
Channel block size specifier associated with the DMA channels.
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 8
maxItems: 16

snps,axi-max-burst-len:
description: |
Expand Down
60 changes: 60 additions & 0 deletions Documentation/devicetree/bindings/gpio/starfive,jh7100-gpio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/gpio/starfive,jh7100-gpio.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: StarFive JH7100 GPIO controller

maintainers:
- Huan Feng <[email protected]>
- Drew Fustini <[email protected]>

properties:
compatible:
items:
- const: starfive,jh7100-gpio

reg:
maxItems: 1

interrupts:
description:
Interrupt mapping, one per GPIO. Maximum 32 GPIOs.
minItems: 1
maxItems: 32

gpio-controller: true

"#gpio-cells":
const: 2

interrupt-controller: true

"#interrupt-cells":
const: 2

required:
- compatible
- reg
- interrupts
- interrupt-controller
- "#interrupt-cells"
- "#gpio-cells"
- gpio-controller

additionalProperties: false

examples:
- |
gpio@11910000 {
compatible = "starfive,jh7100-gpio";
reg = <0x11910000 0x10000>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
interrupts = <32>;
};

...
43 changes: 43 additions & 0 deletions Documentation/devicetree/bindings/hwmon/starfive,jh7100-temp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/hwmon/starfive,jh7100-temp.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: StarFive JH7100 Temperature Sensor

maintainers:
- Emil Renner Berthing <[email protected]>

description: |
StarFive Technology Co. JH7100 embedded temperature sensor

properties:
compatible:
enum:
- starfive,jh7100-temp

reg:
maxItems: 1

'#thermal-sensor-cells':
const: 0

interrupts:
maxItems: 1

required:
- compatible
- reg
- interrupts

additionalProperties: false

examples:
- |
tmon: tmon@124a0000 {
compatible = "starfive,jh7100-temp";
reg = <0x124a0000 0x10000>;
#thermal-sensor-cells = <0>;
interrupts = <122>;
};
30 changes: 30 additions & 0 deletions Documentation/devicetree/bindings/riscv/starfive.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/riscv/starfive.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: StarFive SoC-based boards

maintainers:
- Michael Zhu <[email protected]>
- Drew Fustini <[email protected]>

description:
SiFive SoC-based boards

properties:
$nodename:
const: '/'
compatible:
oneOf:
- items:
- const: beagle,beaglev-starlight-jh7100
- const: starfive,jh7100

- items:
- const: starfive,jh7100

additionalProperties: true

...
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/usb/cdns,usb3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ properties:
interrupts:
minItems: 3
items:
- description: OTG/DRD controller interrupt
- description: XHCI host controller interrupt
- description: Device controller interrupt
- description: OTG/DRD controller interrupt
- description: interrupt used to wake up core, e.g when usbcmd.rs is
cleared by xhci core, this interrupt is optional

Expand Down
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,8 @@ patternProperties:
(formerly part of MStar Semiconductor, Inc.)
"^st,.*":
description: STMicroelectronics
"^starfive,.*":
description: StarFive Technology Co. Ltd.
"^starry,.*":
description: Starry Electronic Technology (ShenZhen) Co., LTD
"^startek,.*":
Expand Down
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -17423,6 +17423,13 @@ S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
F: drivers/staging/

SIFVE JH7100 SOC GPIO DRIVER
M: Drew Fustini <[email protected]>
L: [email protected]
L: [email protected]
F: Documentation/devicetree/bindings/gpio/starfive,jh7100-gpio.yaml
F: drivers/gpio/gpio-starfive-jh7100.c

STARFIRE/DURALAN NETWORK DRIVER
M: Ion Badulescu <[email protected]>
S: Odd Fixes
Expand Down
133 changes: 133 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Linux kernel for the BeagleV Starlight

## What is this?

The [BeagleV Starlight][bborg] board is a new Linux-capable 64bit RISC-V
development board. It has not shipped yet, but [beta versions][beta] are out to
developers. Consequently the board is not yet supported by upstream Linux. This
tree is meant to collect all the in-development patches for running Linux on
the board.

[bborg]: https://beagleboard.org/beaglev
[beta]: https://github.com/beagleboard/beaglev-starlight

## Cross-compiling

Cross-compiling the Linux kernel is surprisingly easy since it doesn't depend
on any (target) libraries and most distributions already have packages with a
working cross-compiler. We'll also need a few other tools to build everything:
```shell
# Debian/Ubuntu
sudo apt-get install libncurses-dev libssl-dev bc flex bison make gcc gcc-riscv64-linux-gnu
# Fedora
sudo dnf install ncurses-devel openssl openssl-devel bc flex bison make gcc gcc-riscv64-linux-gnu
# Archlinux
sudo pacman -S --needed ncurses openssl bc flex bison make gcc riscv64-linux-gnu-gcc
```

The build system needs to know that we want to cross-compile a kernel for
RISC-V by setting `ARCH=riscv`. It also needs to know the prefix of our
cross-compiler using `CROSS_COMPILE=riscv64-linux-gnu-`. Also let's assume
we're building on an 8-core machine so compilation can be greatly sped up by
telling make to use all 8 cores with `-j8`.

First we need to configure the kernel though. Linux has a *very* extensive
configuration system, but you can get a good baseline configuration for the
board using:
```shell
make -j8 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- starlight_defconfig
```

There is nothing magic about this configuration other than it has all the
drivers enabled that are working for the hardware on the board. In fact it has
very little extra features enabled which is great for compile times, but you
are very much encouraged to add additional drivers and configure your kernel
further using
```shell
make -j8 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- nconfig
```

Now compile the whole thing with
```
make -j8 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu-
```


## Installing

Once the build has finished the resulting kernel can be found at
```shell
arch/riscv/boot/Image
```
You'll also need the matching device tree at
```shell
arch/riscv/boot/dts/starfive/jh7100-beaglev-starlight.dtb
```
These two files should be copied to the boot partition on the SD card. That is
onto the same file system that contains the `extlinux/extlinux.conf`. On the
default Fedora image this is mounted at `/boot`.

Now add the following entry to the `extlinux/extlinux.conf` file:
```
label My New Kernel
kernel /Image
fdt /jh7100-beaglev-starlight.dtb
append earlycon console=ttyS0,115200n8 root=/dev/mmcblk0p2 rootwait stmmac.chain_mode=1
```

This assumes your root file system is at `/dev/mmcblk0p2` which it is on the
default Fedora image. Also if your kernel is very big it might be beneficial to
use the compressed `Image.gz` rather than the uncompressed `Image`.

The `starlight_defconfig` doesn't enable modules, but if you enabled them in
your build you'll also need to install them in `/lib/modules/` on the root file
system. How to do that best is out of scope for this README though.


## Status

#### SoC

- [x] GPIO
- [x] Serial port
- [x] I2C
- [x] SPI
- [x] MMC / SDIO / SD card
- [x] Random number generator
- [x] Temperature sensor
- [x] Ethernet, though a little flaky and `stmmac.chain_mode=1` needed on the cmdline
- [x] Framebuffer, fbdev driver so not upstreamable
- [ ] Clock tree, statically set up by u-boot, WIP clock driver
- [ ] Pinctrl/Pinmux, statically set up by u-boot
- [ ] Watchdog
- [ ] USB, USB 2.0 seems to work ok, but USB 3.0 is very flaky / broken
- [ ] Security Engine
- [ ] MIPI-DSI
- [ ] ISP
- [ ] MIPI-CSI
- [ ] Video Decode
- [ ] Video Encode
- [ ] NVDLA
- [ ] NNE50
- [ ] Vision DSP

#### Board

- [x] LED
- [x] PMIC / Reboot
- [x] Ethernet PHY
- [x] HDMI, working with [some screens][hdmi]
- [x] AP6236 Wifi
- [ ] AP6236 Bluetooth
- [ ] GD25LQ256D SPI flash

[hdmi]: https://forum.beagleboard.org/t/hdmi-displays-compatible-list/

## Contributing

If you're working on cleaning up or upstreaming some of this or adding support
for more of the SoC I'd very much like to incorporate it into this tree. Either
send a pull request, mail or contact Esmil on IRC/Slack.

Also I think of this tree mostly as a collection of patches that will hopefully
mature enough to be submitted upstream. So expect regular rebases.
Loading