From: Geert Uytterhoeven <geert@linux-m68k.org>
To: devicetree@vger.kernel.org
Cc: Wolfram Sang <wsa@the-dreams.de>,
Linus Walleij <linus.walleij@linaro.org>,
Matt Porter <mporter@konsulko.com>,
Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [RFC] C64 DTS
Date: Sun, 18 Nov 2018 17:39:09 +0100 [thread overview]
Message-ID: <20181118163909.9202-1-geert@linux-m68k.org> (raw)
Hi all,
Sometimes it's just fun to apply modern practices to old hardware.
Hence below is an attempt to write a DTS for the Commodore 64.
DT binding documentation is not yet included.
Thanks for your comments ;-)
---8<-------------------------------------------------------------------
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
/* FIXME <dt-bindings/6502.h> */
#define CPU_IRQ 0
#define CPU_NMI 1
/ {
model = "Commodore 64";
compatible = "cbm,c64";
#address-cells = <1>;
#size-cells = <1>;
interrupt-parent = <&cpu>;
color_clock: color_clock {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <17734472>; // PAL
};
dot_clock: dot_clock {
compatible = "fixed-factor-clock";
#clock-cells = <0>;
clock-div = <9>;
clock-mul = <4>;
clocks = <&color_clock>;
};
phi0: phi0_clock {
compatible = "fixed-factor-clock";
#clock-cells = <0>;
clock-div = <8>;
clock-mul = <1>;
clocks = <&dot_clock>;
};
phi2: phi2_clock {
compatible = "fixed-factor-clock";
#clock-cells = <0>;
clock-div = <1>;
clock-mul = <1>;
clocks = <&phi0>;
};
ps_freq: ps_freq {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <50>;
};
cpus {
#address-cells = <0>;
#size-cells = <0>;
cpu: cpu {
device_type = "cpu";
compatible = "cbm,6510", "mos,6502";
clock-frequency = <985000>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <1>;
};
};
// FIXME sub-node with ranges to describe bank switching
// cbm,loram-gpios = <&cpu 0 GPIO_ACTIVE_LOW>,
// cbm,hiram-gpios = <&cpu 1 GPIO_ACTIVE_LOW>,
// cbm,charen-gpios = <&cpu 2 GPIO_ACTIVE_LOW>,
ram: memory@0 {
device_type = "memory";
reg = <0 0x10000>;
};
basic_rom: memory@a000 {
reg = <0xa000 0x2000>;
// FIXME ROM, reserved
};
character_rom: memory@d000 {
reg = <0xd000 0x1000>;
// FIXME ROM, reserved
};
vic: video-controller@d000 {
reg = <0xd000 0x400>;
compatible = "cbm,6569", "cbm,vic-ii"; // PAL
clocks = <&color_clock>, <&dot_clock>;
clock-names = "color", "dot";
interrupts = <CPU_IRQ>;
cbm,vic-bank-gpios = <&cia2 0 GPIO_ACTIVE_HIGH>,
<&cia2 1 GPIO_ACTIVE_HIGH>;
};
sid: sound@d400 {
reg = <0xd400 0x400>;
compatible = "cbm,6581", "cbm,sid";
};
color_ram: memory@d800 {
reg = <0xd800 0x400>;
// FIXME Nibble RAM, reserved
};
cia1: system-controller@dc00 {
reg = <0xdc00 0x100>;
compatible = "cbm,6526", "mos,cia";
#clock-cells = <0>; // CNT
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <1>;
clocks = <&phi2>, <&ps_freq>;
clock-names = "phi2", "tod";
interrupts = <CPU_IRQ>;
};
cia2: system-controller@dd00 {
reg = <0xdd00 0x100>;
compatible = "cbm,6526", "mos,cia";
#clock-cells = <0>; // CNT
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <1>;
clocks = <&phi2>, <&ps_freq>;
clock-names = "phi2", "tod";
interrupts = <CPU_IRQ>;
};
kernal_rom: memory@e000 {
reg = <0xe000 0x2000>;
// FIXME ROM, reserved
};
keyboard {
compatible = "cbm,c64-keyboard", "gpio-matrix-keypad";
col-gpios = <&cia1 0 GPIO_ACTIVE_HIGH>,
<&cia1 1 GPIO_ACTIVE_HIGH>,
<&cia1 2 GPIO_ACTIVE_HIGH>,
<&cia1 3 GPIO_ACTIVE_HIGH>,
<&cia1 4 GPIO_ACTIVE_HIGH>,
<&cia1 5 GPIO_ACTIVE_HIGH>,
<&cia1 6 GPIO_ACTIVE_HIGH>,
<&cia1 7 GPIO_ACTIVE_HIGH>;
row-gpios = <&cia1 8 GPIO_ACTIVE_HIGH>,
<&cia1 9 GPIO_ACTIVE_HIGH>,
<&cia1 10 GPIO_ACTIVE_HIGH>,
<&cia1 11 GPIO_ACTIVE_HIGH>,
<&cia1 12 GPIO_ACTIVE_HIGH>,
<&cia1 13 GPIO_ACTIVE_HIGH>,
<&cia1 14 GPIO_ACTIVE_HIGH>,
<&cia1 15 GPIO_ACTIVE_HIGH>;
interrupts = <CPU_NMI>;
linux,keymap = <0 /* FIXME */>;
};
iec {
compatible = "cbm,c64-iec-bus";
cbm,atn-gpios = <&cia2 3 GPIO_ACTIVE_LOW>;
cbm,clock-out-gpios = <&cia2 4 GPIO_ACTIVE_LOW>;
cbm,data-out-gpios = <&cia2 5 GPIO_ACTIVE_LOW>;
cbm,clock-in-gpios = <&cia2 6 GPIO_ACTIVE_LOW>;
cbm,data-in-gpios = <&cia2 7 GPIO_ACTIVE_LOW>;
};
};
------------------------------------------------------------------->8---
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next reply other threads:[~2018-11-19 3:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-18 16:39 Geert Uytterhoeven [this message]
2018-11-18 19:10 ` [RFC] C64 DTS Linus Walleij
2018-11-18 20:15 ` Geert Uytterhoeven
2018-11-19 14:37 ` Linus Walleij
2018-11-18 21:28 ` Wolfram Sang
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=20181118163909.9202-1-geert@linux-m68k.org \
--to=geert@linux-m68k.org \
--cc=devicetree@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=mporter@konsulko.com \
--cc=wsa@the-dreams.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).