Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1406637 > unrolled thread
| Started by | Rich Felker <dalias@libc.org> |
|---|---|
| First post | 2016-05-25 07:50 +0200 |
| Last post | 2016-05-26 02:50 +0200 |
| Articles | 20 on this page of 35 — 8 participants |
Back to article view | Back to linux.kernel
[PATCH v3 00/12] J-core J2 cpu and SoC peripherals support Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
[PATCH v3 10/12] spi: add driver for J-Core SPI controller Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
Re: [PATCH v3 10/12] spi: add driver for J-Core SPI controller Mark Brown <broonie@kernel.org> - 2016-05-25 12:20 +0200
Re: [PATCH v3 10/12] spi: add driver for J-Core SPI controller Rich Felker <dalias@libc.org> - 2016-05-27 03:20 +0200
Re: [PATCH v3 10/12] spi: add driver for J-Core SPI controller Mark Brown <broonie@kernel.org> - 2016-05-27 13:40 +0200
[PATCH v3 11/12] sh: add defconfig for J-Core J2 Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
[PATCH v3 05/12] of: add J-Core SPI master bindings Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
Re: [PATCH v3 05/12] of: add J-Core SPI master bindings Rob Herring <robh@kernel.org> - 2016-05-25 21:20 +0200
[PATCH v3 04/12] of: add J-Core timer bindings Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
[PATCH v3 09/12] clocksource: add J-Core timer/clocksource driver Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
[PATCH v3 01/12] of: add vendor prefix for J-Core Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
Re: [PATCH v3 01/12] of: add vendor prefix for J-Core Rob Herring <robh+dt@kernel.org> - 2016-05-25 15:20 +0200
[PATCH v3 12/12] sh: add device tree source for J2 FPGA on Mimas v2 board Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
Re: [PATCH v3 12/12] sh: add device tree source for J2 FPGA on Mimas v2 board Mark Rutland <mark.rutland@arm.com> - 2016-05-25 12:40 +0200
Re: [PATCH v3 12/12] sh: add device tree source for J2 FPGA on Mimas v2 board Rich Felker <dalias@libc.org> - 2016-05-26 01:20 +0200
Re: [PATCH v3 12/12] sh: add device tree source for J2 FPGA on Mimas v2 board Mark Rutland <mark.rutland@arm.com> - 2016-05-26 12:40 +0200
[PATCH v3 03/12] of: add J-Core interrupt controller bindings Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
Re: [PATCH v3 03/12] of: add J-Core interrupt controller bindings Mark Rutland <mark.rutland@arm.com> - 2016-05-25 12:30 +0200
Re: [PATCH v3 03/12] of: add J-Core interrupt controller bindings Rich Felker <dalias@libc.org> - 2016-05-26 01:10 +0200
[PATCH v3 02/12] of: add J-Core cpu bindings Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
Re: [PATCH v3 02/12] of: add J-Core cpu bindings Mark Rutland <mark.rutland@arm.com> - 2016-05-25 12:30 +0200
Re: [PATCH v3 02/12] of: add J-Core cpu bindings Rich Felker <dalias@libc.org> - 2016-05-26 01:10 +0200
Re: [PATCH v3 02/12] of: add J-Core cpu bindings Geert Uytterhoeven <geert@linux-m68k.org> - 2016-05-26 10:00 +0200
Re: [PATCH v3 02/12] of: add J-Core cpu bindings Mark Rutland <mark.rutland@arm.com> - 2016-05-26 12:40 +0200
Re: [PATCH v3 02/12] of: add J-Core cpu bindings Rich Felker <dalias@libc.org> - 2016-05-26 17:40 +0200
Re: [PATCH v3 02/12] of: add J-Core cpu bindings Mark Rutland <mark.rutland@arm.com> - 2016-05-27 11:20 +0200
Re: [PATCH v3 02/12] of: add J-Core cpu bindings Rob Landley <rob@landley.net> - 2016-05-26 23:50 +0200
Re: [PATCH v3 02/12] of: add J-Core cpu bindings Afzal Mohammed <afzal.mohd.ma@gmail.com> - 2016-05-27 14:00 +0200
[PATCH v3 08/12] irqchip: add J-Core AIC driver Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
[PATCH v3 07/12] sh: add AT_HWCAP flag for J-Core cas.l instruction Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
[PATCH v3 06/12] sh: add support for J-Core J2 processor Rich Felker <dalias@libc.org> - 2016-05-25 07:50 +0200
Re: [PATCH v3 00/12] J-core J2 cpu and SoC peripherals support Geert Uytterhoeven <geert@linux-m68k.org> - 2016-05-25 09:30 +0200
Re: [PATCH v3 00/12] J-core J2 cpu and SoC peripherals support Mark Brown <broonie@kernel.org> - 2016-05-25 12:00 +0200
Re: [PATCH v3 00/12] J-core J2 cpu and SoC peripherals support Rich Felker <dalias@libc.org> - 2016-05-26 00:30 +0200
Re: [PATCH v3 00/12] J-core J2 cpu and SoC peripherals support Mark Brown <broonie@kernel.org> - 2016-05-26 02:50 +0200
Page 1 of 2 [1] 2 Next page →
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-25 07:50 +0200 |
| Subject | [PATCH v3 00/12] J-core J2 cpu and SoC peripherals support |
| Message-ID | <rCzRD-5z7-3@gated-at.bofh.it> |
The following patchset adds support for the J-core J2, an open-source VHDL reimplementation of the SH-2 ISA, and drivers for the associated SoC devices (interrupt controller, clocksource, and SPI). As arch/sh co-maintainer my intent is to include as much as possible in my pull request for the linux-sh tree. If there are parts outside of arch/sh that can be included in this, please let me know. I'm not clear yet on what the right path to upstream is for the clocksource and irq drivers that are currently only useful/interesting for one arch, or for the DT binding patches. Even if some drivers are delayed going upstream, I would really like to get DT bindings acked and ideally merged, because we want to go ahead with moving the DTB into J2 boot rom where it belongs, and that should only happen with stable bindings. Rich Felker (12): of: add vendor prefix for J-Core of: add J-Core cpu bindings of: add J-Core interrupt controller bindings of: add J-Core timer bindings of: add J-Core SPI master bindings sh: add support for J-Core J2 processor sh: add AT_HWCAP flag for J-Core cas.l instruction irqchip: add J-Core AIC driver clocksource: add J-Core timer/clocksource driver spi: add driver for J-Core SPI controller sh: add defconfig for J-Core J2 sh: add device tree source for J2 FPGA on Mimas v2 board .../bindings/interrupt-controller/jcore,aic.txt | 29 +++ Documentation/devicetree/bindings/jcore/cpus.txt | 92 +++++++ .../devicetree/bindings/spi/jcore,spi.txt | 23 ++ .../devicetree/bindings/timer/jcore,pit.txt | 28 ++ .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/sh/Kconfig | 8 + arch/sh/Makefile | 1 + arch/sh/boot/dts/j2_mimas_v2.dts | 87 +++++++ arch/sh/configs/j2_defconfig | 38 +++ arch/sh/include/asm/processor.h | 2 +- arch/sh/include/uapi/asm/cpu-features.h | 1 + arch/sh/kernel/cpu/init.c | 2 +- arch/sh/kernel/cpu/proc.c | 1 + arch/sh/kernel/cpu/sh2/entry.S | 5 + arch/sh/kernel/cpu/sh2/probe.c | 36 ++- arch/sh/mm/Makefile | 3 +- arch/sh/mm/cache-j2.c | 58 +++++ arch/sh/mm/cache.c | 6 +- drivers/clocksource/Kconfig | 8 + drivers/clocksource/Makefile | 1 + drivers/clocksource/jcore-pit.c | 282 +++++++++++++++++++++ drivers/irqchip/Kconfig | 6 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-jcore-aic.c | 95 +++++++ drivers/spi/Kconfig | 4 + drivers/spi/Makefile | 1 + drivers/spi/spi-jcore.c | 209 +++++++++++++++ 27 files changed, 1023 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt create mode 100644 Documentation/devicetree/bindings/jcore/cpus.txt create mode 100644 Documentation/devicetree/bindings/spi/jcore,spi.txt create mode 100644 Documentation/devicetree/bindings/timer/jcore,pit.txt create mode 100755 arch/sh/boot/dts/j2_mimas_v2.dts create mode 100644 arch/sh/configs/j2_defconfig create mode 100644 arch/sh/mm/cache-j2.c create mode 100644 drivers/clocksource/jcore-pit.c create mode 100644 drivers/irqchip/irq-jcore-aic.c create mode 100644 drivers/spi/spi-jcore.c -- 2.8.1
[toc] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-25 07:50 +0200 |
| Subject | [PATCH v3 10/12] spi: add driver for J-Core SPI controller |
| Message-ID | <rCzRD-5z7-5@gated-at.bofh.it> |
| In reply to | #1406637 |
The J-Core "spi2" device is a PIO-based SPI master controller. It
differs from "bitbang" devices in that that it's clocked in hardware
rather than via soft clock modulation over gpio, and performs
byte-at-a-time transfers between the cpu and SPI controller.
This driver will be extended to support future versions of the J-Core
SPI controller with DMA transfers when they become available.
Signed-off-by: Rich Felker <dalias@libc.org>
---
This version of the SPI patch eliminates USE_MESSAGE_MODE (the open
coding of transfer_one_message logic) and makes severl other minor
changes based on ml discussion of the v2 patch. The chipselect change
has not been made yet, except for rewriting the current logic to be
more clear. If the decision is that it's needed, I can do it easily,
but it needs testing still.
drivers/spi/Kconfig | 4 +
drivers/spi/Makefile | 1 +
drivers/spi/spi-jcore.c | 209 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 214 insertions(+)
create mode 100644 drivers/spi/spi-jcore.c
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 9d8c84b..5bd2ccf 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -285,6 +285,10 @@ config SPI_IMX
This enables using the Freescale i.MX SPI controllers in master
mode.
+config SPI_JCORE
+ tristate "J-Core SPI Master"
+ depends on OF
+
config SPI_LM70_LLP
tristate "Parallel port adapter for LM70 eval board (DEVELOPMENT)"
depends on PARPORT
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index fbb255c..6a34124 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-spi.o
obj-$(CONFIG_SPI_GPIO) += spi-gpio.o
obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o
obj-$(CONFIG_SPI_IMX) += spi-imx.o
+obj-$(CONFIG_SPI_JCORE) += spi-jcore.o
obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o
obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o
obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o
diff --git a/drivers/spi/spi-jcore.c b/drivers/spi/spi-jcore.c
new file mode 100644
index 0000000..f239087
--- /dev/null
+++ b/drivers/spi/spi-jcore.c
@@ -0,0 +1,209 @@
+/*
+ * J-Core SPI controller driver
+ *
+ * Copyright (C) 2012-2016 Smart Energy Instruments, Inc.
+ *
+ * Current version by Rich Felker
+ * Based loosely on initial version by Oleksandr G Zhadan
+ *
+ */
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/errno.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/spi/spi.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/delay.h>
+
+#define DRV_NAME "jcore_spi"
+
+#define MAX_SPI_SPEED 12500000 /* 12.5 MHz */
+
+#define CTRL_REG 0x0
+#define DATA_REG 0x4
+
+#define SPI_NOCHIP_CS 0
+#define SPI_FLASH_CS 1
+#define SPI_CONF_CS 2
+#define SPI_SD_CS 2
+#define SPI_CODEC_CS 3
+
+#define JCORE_SPI_CTRL_XMIT 0x02
+#define JCORE_SPI_STAT_BUSY 0x02
+#define JCORE_SPI_CTRL_LOOP 0x08
+#define JCORE_SPI_CTRL_CS_BITS 0x15
+
+#define JCORE_SPI_WAIT_RDY_MAX_LOOP 2000000
+
+struct jcore_spi {
+ struct spi_master *master;
+ void __iomem *base;
+ volatile unsigned int ctrlReg;
+ unsigned int csReg;
+ unsigned int speedReg;
+ unsigned int speed_hz;
+};
+
+static void jcore_spi_wait_till_ready(struct jcore_spi *hw, int timeout)
+{
+ while (timeout--) {
+ hw->ctrlReg = readl(hw->base + CTRL_REG);
+ if (!(hw->ctrlReg & JCORE_SPI_STAT_BUSY))
+ return;
+ cpu_relax();
+ }
+ dev_err(hw->master->dev.parent, "%s: Timeout..\n", __func__);
+}
+
+static void jcore_spi_program(struct jcore_spi *hw)
+{
+ jcore_spi_wait_till_ready(hw, JCORE_SPI_WAIT_RDY_MAX_LOOP);
+ writel(hw->csReg | hw->speedReg, hw->base + CTRL_REG);
+}
+
+static void jcore_spi_chipsel(struct spi_device *spi, bool value)
+{
+ struct jcore_spi *hw = spi_master_get_devdata(spi->master);
+
+ dev_dbg(hw->master->dev.parent, "%s: CS=%d\n", __func__, value);
+
+ hw->csReg = JCORE_SPI_CTRL_CS_BITS ^ (!value << 2*spi->chip_select);
+
+ jcore_spi_program(hw);
+}
+
+static void jcore_spi_baudrate(struct jcore_spi *hw, int speed)
+{
+ if (speed == hw->speed_hz) return;
+ hw->speed_hz = speed;
+ hw->speedReg = ((MAX_SPI_SPEED / speed) - 1) << 27;
+ jcore_spi_program(hw);
+ dev_dbg(hw->master->dev.parent, "%s: speed=%d pre=0x%x\n",
+ __func__, speed, hw->speedReg);
+}
+
+static int jcore_spi_txrx(struct spi_master *master, struct spi_device *spi,
+ struct spi_transfer *t)
+{
+ struct jcore_spi *hw = spi_master_get_devdata(master);
+
+ void *ctrl_reg = hw->base + CTRL_REG;
+ void *data_reg = hw->base + DATA_REG;
+ unsigned int timeout;
+ u32 xmit;
+ u32 status;
+
+ /* data buffers */
+ const unsigned char *tx;
+ unsigned char *rx;
+ unsigned int len;
+ unsigned int count;
+
+ jcore_spi_baudrate(hw, t->speed_hz);
+
+ xmit = hw->csReg | hw->speedReg | JCORE_SPI_CTRL_XMIT;
+ tx = t->tx_buf;
+ rx = t->rx_buf;
+ len = t->len;
+
+ for (count = 0; count < len; count++) {
+ timeout = JCORE_SPI_WAIT_RDY_MAX_LOOP;
+ do {
+ status = readl(ctrl_reg);
+ } while ((status & JCORE_SPI_STAT_BUSY) && --timeout);
+ if (!timeout)
+ break;
+
+ writel(tx ? *tx++ : 0, data_reg);
+ writel(xmit, ctrl_reg);
+
+ timeout = JCORE_SPI_WAIT_RDY_MAX_LOOP;
+ do {
+ status = readl(ctrl_reg);
+ } while ((status & JCORE_SPI_STAT_BUSY) && --timeout);
+ if (!timeout)
+ break;
+
+ if (rx)
+ *rx++ = readl(data_reg);
+ }
+
+ spi_finalize_current_transfer(master);
+
+ return count<len ? -EREMOTEIO : 0;
+}
+
+static int jcore_spi_probe(struct platform_device *pdev)
+{
+ struct device_node *node = pdev->dev.of_node;
+ struct jcore_spi *hw;
+ struct spi_master *master;
+ struct resource *res;
+ int err = -ENODEV;
+
+ master = spi_alloc_master(&pdev->dev, sizeof(struct jcore_spi));
+ if (!master)
+ return err;
+
+ /* setup the master state. */
+ master->num_chipselect = 3;
+ master->mode_bits = SPI_MODE_3;
+ master->transfer_one = jcore_spi_txrx;
+ master->set_cs = jcore_spi_chipsel;
+ master->dev.of_node = node;
+
+ hw = spi_master_get_devdata(master);
+ hw->master = master;
+ platform_set_drvdata(pdev, hw);
+
+ /* find and map our resources */
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ goto exit_busy;
+ if (!devm_request_mem_region
+ (&pdev->dev, res->start, resource_size(res), pdev->name))
+ goto exit_busy;
+ hw->base =
+ devm_ioremap_nocache(&pdev->dev, res->start, resource_size(res));
+ if (!hw->base)
+ goto exit_busy;
+
+ jcore_spi_baudrate(hw, 400000);
+
+ pdev->dev.dma_mask = 0;
+ /* register our spi controller */
+ err = devm_spi_register_master(&pdev->dev, master);
+ if (err)
+ goto exit;
+ dev_info(&pdev->dev, "base %p, noirq\n", hw->base);
+
+ return 0;
+
+exit_busy:
+ err = -EBUSY;
+exit:
+ platform_set_drvdata(pdev, NULL);
+ spi_master_put(master);
+ return err;
+}
+
+static const struct of_device_id jcore_spi_of_match[] = {
+ { .compatible = "jcore,spi2" },
+ {},
+};
+
+static struct platform_driver jcore_spi_driver = {
+ .probe = jcore_spi_probe,
+ .driver = {
+ .name = DRV_NAME,
+ .of_match_table = jcore_spi_of_match,
+ },
+};
+
+module_platform_driver(jcore_spi_driver);
+
+MODULE_DESCRIPTION("J-Core SPI driver");
+MODULE_AUTHOR("Rich Felker <dalias@libc.org>");
+MODULE_ALIAS("platform:" DRV_NAME);
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2016-05-25 12:20 +0200 |
| Subject | Re: [PATCH v3 10/12] spi: add driver for J-Core SPI controller |
| Message-ID | <rCE4W-8dd-21@gated-at.bofh.it> |
| In reply to | #1406638 |
[Multipart message — attachments visible in raw view] — view raw
On Wed, May 25, 2016 at 05:43:03AM +0000, Rich Felker wrote: > changes based on ml discussion of the v2 patch. The chipselect change > has not been made yet, except for rewriting the current logic to be > more clear. If the decision is that it's needed, I can do it easily, > but it needs testing still. You need to fix that, it's not good to just decide to ignore review comments. It is astonishing that you are doing this while expecting to bypass the normal process for merging things. I'm not going to look at this version, please ensure you have addressed all the feedback from the previous review before any new version you submit.
[toc] | [prev] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-27 03:20 +0200 |
| Subject | Re: [PATCH v3 10/12] spi: add driver for J-Core SPI controller |
| Message-ID | <rDeBr-5fS-1@gated-at.bofh.it> |
| In reply to | #1406813 |
On Wed, May 25, 2016 at 11:17:08AM +0100, Mark Brown wrote: > On Wed, May 25, 2016 at 05:43:03AM +0000, Rich Felker wrote: > > > changes based on ml discussion of the v2 patch. The chipselect change > > has not been made yet, except for rewriting the current logic to be > > more clear. If the decision is that it's needed, I can do it easily, > > but it needs testing still. > > You need to fix that, it's not good to just decide to ignore review > comments. It is astonishing that you are doing this while expecting to > bypass the normal process for merging things. I'm not going to look at > this version, please ensure you have addressed all the feedback from the > previous review before any new version you submit. I've made and tested a change that looks like what you want, with the hw->csReg's chipselect bits set initially high in the probe function, and only the requested bit being modified by the chipselect function. Would you prefer I continue to submit this driver with new versions of the patch series, or separate it out for further review on its own? Rich
[toc] | [prev] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2016-05-27 13:40 +0200 |
| Subject | Re: [PATCH v3 10/12] spi: add driver for J-Core SPI controller |
| Message-ID | <rDohr-2Qd-7@gated-at.bofh.it> |
| In reply to | #1407766 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, May 26, 2016 at 09:16:21PM -0400, Rich Felker wrote: > Would you prefer I continue to submit this driver with new versions of > the patch series, or separate it out for further review on its own? It would be clearer to submit it separately.
[toc] | [prev] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-25 07:50 +0200 |
| Subject | [PATCH v3 11/12] sh: add defconfig for J-Core J2 |
| Message-ID | <rCzRD-5z7-7@gated-at.bofh.it> |
| In reply to | #1406637 |
This defconfig is intended not to be specific to a particular board; it enables drivers for all currently-supported hardware, and should be updated to include additional drivers as they are added. Signed-off-by: Rich Felker <dalias@libc.org> --- arch/sh/configs/j2_defconfig | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 arch/sh/configs/j2_defconfig diff --git a/arch/sh/configs/j2_defconfig b/arch/sh/configs/j2_defconfig new file mode 100644 index 0000000..fca167f --- /dev/null +++ b/arch/sh/configs/j2_defconfig @@ -0,0 +1,38 @@ +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_CPU_SUBTYPE_J2=y +CONFIG_MEMORY_START=0x10000000 +CONFIG_MEMORY_SIZE=0x04000000 +CONFIG_CPU_BIG_ENDIAN=y +CONFIG_SH_DEVICE_TREE=y +CONFIG_HZ_100=y +CONFIG_CMDLINE_OVERWRITE=y +CONFIG_CMDLINE="console=ttyUL0 earlycon" +CONFIG_BINFMT_ELF_FDPIC=y +CONFIG_BINFMT_FLAT=y +CONFIG_NET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_NETDEVICES=y +CONFIG_SERIAL_UARTLITE=y +CONFIG_SERIAL_UARTLITE_CONSOLE=y +CONFIG_I2C=y +CONFIG_SPI=y +CONFIG_SPI_JCORE=y +CONFIG_WATCHDOG=y +CONFIG_MMC=y +CONFIG_MMC_SPI=y +CONFIG_CLKSRC_JCORE_PIT=y +CONFIG_JCORE_AIC=y +CONFIG_EXT4_FS=y +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +CONFIG_FAT_DEFAULT_UTF8=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_UTF8=y -- 2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-25 07:50 +0200 |
| Subject | [PATCH v3 05/12] of: add J-Core SPI master bindings |
| Message-ID | <rCzRD-5z7-9@gated-at.bofh.it> |
| In reply to | #1406637 |
Signed-off-by: Rich Felker <dalias@libc.org>
---
.../devicetree/bindings/spi/jcore,spi.txt | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 Documentation/devicetree/bindings/spi/jcore,spi.txt
diff --git a/Documentation/devicetree/bindings/spi/jcore,spi.txt b/Documentation/devicetree/bindings/spi/jcore,spi.txt
new file mode 100644
index 0000000..7bff8c0
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/jcore,spi.txt
@@ -0,0 +1,23 @@
+J-Core SPI master
+
+Required properties:
+
+- compatible: Must be "jcore,spi2".
+
+- reg: Memory region for registers.
+
+- #address-cells: Must be 1.
+
+- #size-cells: Must be 0.
+
+See spi-bus.txt for additional properties not specific to this device.
+
+Example:
+
+spi@40 {
+ compatible = "jcore,spi2";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = < 0x40 0x8 >;
+ spi-max-frequency = <12500000>;
+}
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2016-05-25 21:20 +0200 |
| Subject | Re: [PATCH v3 05/12] of: add J-Core SPI master bindings |
| Message-ID | <rCMvv-4LK-7@gated-at.bofh.it> |
| In reply to | #1406640 |
On Wed, May 25, 2016 at 05:43:03AM +0000, Rich Felker wrote: > Signed-off-by: Rich Felker <dalias@libc.org> > --- > .../devicetree/bindings/spi/jcore,spi.txt | 23 ++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > create mode 100644 Documentation/devicetree/bindings/spi/jcore,spi.txt Acked-by: Rob Herring <robh@kernel.org>
[toc] | [prev] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-25 07:50 +0200 |
| Subject | [PATCH v3 04/12] of: add J-Core timer bindings |
| Message-ID | <rCzRD-5z7-13@gated-at.bofh.it> |
| In reply to | #1406637 |
Signed-off-by: Rich Felker <dalias@libc.org>
---
.../devicetree/bindings/timer/jcore,pit.txt | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 Documentation/devicetree/bindings/timer/jcore,pit.txt
diff --git a/Documentation/devicetree/bindings/timer/jcore,pit.txt b/Documentation/devicetree/bindings/timer/jcore,pit.txt
new file mode 100644
index 0000000..96c6815
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/jcore,pit.txt
@@ -0,0 +1,28 @@
+J-Core Programmable Interval Timer and Clocksource
+
+Required properties:
+
+- compatible: Must be "jcore,pit".
+
+- reg: Memory region for timer/clocksource registers.
+
+- interrupts: An interrupt to assign for the timer. The actual pit
+ core is integrated with the aic and allows the timer interrupt
+ assignment to be programmed by software, but this property is
+ required in order to reserve an interrupt number that doesn't
+ conflict with other devices.
+
+Optional properties:
+
+- cpu-offset: For SMP, the per-cpu offset to the local timer
+ programming memory range.
+
+
+Example:
+
+timer@200 {
+ compatible = "jcore,pit";
+ reg = < 0x200 0x30 >;
+ cpu-offset = < 0x300 >;
+ interrupts = < 0x48 >;
+};
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-25 07:50 +0200 |
| Subject | [PATCH v3 09/12] clocksource: add J-Core timer/clocksource driver |
| Message-ID | <rCzRD-5z7-17@gated-at.bofh.it> |
| In reply to | #1406637 |
At the hardware level, the J-Core PIT is integrated with the interrupt
controller, but it is represented as its own device and has an
independent programming interface. It provides a 12-bit countdown
timer, which is not presently used, and a periodic timer. The interval
length for the latter is programmable via a 32-bit throttle register
whose units are determined by a bus-period register. The periodic
timer is used to implement both periodic and oneshot clock event
modes; in oneshot mode the interrupt handler simply disables the timer
as soon as it fires.
Despite its device tree node representing an interrupt for the PIT,
the actual irq generated is programmable, not hard-wired. The driver
is responsible for programming the PIT to generate the hardware irq
number that the DT assigns to it.
On SMP configurations, J-Core provides cpu-local instances of the PIT;
no broadcast timer is needed. This driver supports the creation of the
necessary per-cpu clock_event_device instances. The code has been
tested and works on SMP, but will not be usable without additional
J-Core SMP-support patches and appropriate hardware capable of running
SMP.
A nanosecond-resolution clocksource is provided using the J-Core "RTC"
registers, which give a 64-bit seconds count and 32-bit nanoseconds.
The driver converts these to a 64-bit nanoseconds count.
Signed-off-by: Rich Felker <dalias@libc.org>
---
This driver has undergone significant changes based on feedback from
Daniel Lezcano. I've split out helper functions, eliminated the
repeated percpu offset computations, properly mapped each percpu base,
used container_of instead of static storage for driver data, added
comments for enable_val setup, removed confusing use of "RTC" name,
removed excess includes, used the "jcore_" prefix in naming
identifiers, and made error handling more extensive.
drivers/clocksource/Kconfig | 8 ++
drivers/clocksource/Makefile | 1 +
drivers/clocksource/jcore-pit.c | 282 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 291 insertions(+)
create mode 100644 drivers/clocksource/jcore-pit.c
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index c346be6..7bd39d2 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -297,6 +297,14 @@ config SYS_SUPPORTS_SH_TMU
config SYS_SUPPORTS_EM_STI
bool
+config CLKSRC_JCORE_PIT
+ bool "J-Core PIT timer driver"
+ depends on GENERIC_CLOCKEVENTS
+ depends on HAS_IOMEM
+ help
+ This enables build of clocksource and clockevent driver for
+ the integrated PIT in the J-Core synthesizable, open source SoC.
+
config SH_TIMER_CMT
bool "Renesas CMT timer driver" if COMPILE_TEST
depends on GENERIC_CLOCKEVENTS
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index dc2b899..d825fcf 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_ATMEL_TCB_CLKSRC) += tcb_clksrc.o
obj-$(CONFIG_X86_PM_TIMER) += acpi_pm.o
obj-$(CONFIG_SCx200HR_TIMER) += scx200_hrt.o
obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC) += cs5535-clockevt.o
+obj-$(CONFIG_CLKSRC_JCORE_PIT) += jcore-pit.o
obj-$(CONFIG_SH_TIMER_CMT) += sh_cmt.o
obj-$(CONFIG_SH_TIMER_MTU2) += sh_mtu2.o
obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o
diff --git a/drivers/clocksource/jcore-pit.c b/drivers/clocksource/jcore-pit.c
new file mode 100644
index 0000000..dd78fcd
--- /dev/null
+++ b/drivers/clocksource/jcore-pit.c
@@ -0,0 +1,282 @@
+/*
+ * J-Core SoC PIT/clocksource driver
+ *
+ * Copyright (C) 2015-2016 Smart Energy Instruments, Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/interrupt.h>
+#include <linux/clockchips.h>
+#include <linux/clocksource.h>
+#include <linux/cpu.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+#define PIT_IRQ_SHIFT 12
+#define PIT_PRIO_SHIFT 20
+#define PIT_ENABLE_SHIFT 26
+#define PIT_IRQ_MASK 0x3f
+#define PIT_PRIO_MASK 0xf
+
+#define REG_PITEN 0x00
+#define REG_THROT 0x10
+#define REG_COUNT 0x14
+#define REG_BUSPD 0x18
+#define REG_SECHI 0x20
+#define REG_SECLO 0x24
+#define REG_NSEC 0x28
+
+struct jcore_clocksource {
+ struct clocksource cs;
+ __iomem void *base;
+};
+
+struct jcore_pit {
+ struct clock_event_device ced;
+ __iomem void *base;
+ unsigned long periodic_delta;
+ unsigned cpu;
+ phys_addr_t paddr;
+ resource_size_t psize;
+ u32 enable_val;
+};
+
+struct jcore_pit_nb {
+ struct notifier_block nb;
+ struct jcore_pit __percpu *pit_percpu;
+};
+
+static cycle_t jcore_clocksource_read(struct clocksource *cs)
+{
+ __iomem void *base =
+ container_of(cs, struct jcore_clocksource, cs)->base;
+ u32 sechi, seclo, nsec, sechi0, seclo0;
+
+ sechi = __raw_readl(base + REG_SECHI);
+ seclo = __raw_readl(base + REG_SECLO);
+ do {
+ sechi0 = sechi;
+ seclo0 = seclo;
+ nsec = __raw_readl(base + REG_NSEC);
+ sechi = __raw_readl(base + REG_SECHI);
+ seclo = __raw_readl(base + REG_SECLO);
+ } while (sechi0 != sechi || seclo0 != seclo);
+
+ return ((u64)sechi << 32 | seclo) * NSEC_PER_SEC + nsec;
+}
+
+static int jcore_pit_disable(struct jcore_pit *pit)
+{
+ __raw_writel(0, pit->base + REG_PITEN);
+ return 0;
+}
+
+static int jcore_pit_set(unsigned long delta, struct jcore_pit *pit)
+{
+ jcore_pit_disable(pit);
+ __raw_writel(delta, pit->base + REG_THROT);
+ __raw_writel(pit->enable_val, pit->base + REG_PITEN);
+ return 0;
+}
+
+static int jcore_pit_set_state_shutdown(struct clock_event_device *ced)
+{
+ struct jcore_pit *pit = container_of(ced, struct jcore_pit, ced);
+ return jcore_pit_disable(pit);
+}
+
+static int jcore_pit_set_state_oneshot(struct clock_event_device *ced)
+{
+ struct jcore_pit *pit = container_of(ced, struct jcore_pit, ced);
+ return jcore_pit_disable(pit);
+}
+
+static int jcore_pit_set_state_periodic(struct clock_event_device *ced)
+{
+ struct jcore_pit *pit = container_of(ced, struct jcore_pit, ced);
+ return jcore_pit_set(pit->periodic_delta, pit);
+}
+
+static int jcore_pit_set_next_event(unsigned long delta,
+ struct clock_event_device *ced)
+{
+ struct jcore_pit *pit = container_of(ced, struct jcore_pit, ced);
+ return jcore_pit_set(delta, pit);
+}
+
+static int jcore_pit_local_init(struct jcore_pit *pit)
+{
+ unsigned buspd;
+
+ pr_info("Local J-Core PIT init on cpu %u\n", pit->cpu);
+
+ pit->base = ioremap(pit->paddr, pit->psize);
+ if (!pit->base)
+ return -ENOMEM;
+
+ buspd = __raw_readl(pit->base + REG_BUSPD);
+ pit->periodic_delta = DIV_ROUND_CLOSEST(NSEC_PER_SEC, HZ*buspd);
+
+ clockevents_config_and_register(&pit->ced,
+ DIV_ROUND_CLOSEST(NSEC_PER_SEC, buspd),
+ 1, 0xffffffff);
+
+ return 0;
+}
+
+static int jcore_pit_cpu_notify(struct notifier_block *self,
+ unsigned long action, void *hcpu)
+{
+ struct jcore_pit_nb *nb = container_of(self, struct jcore_pit_nb, nb);
+ switch (action & ~CPU_TASKS_FROZEN) {
+ case CPU_STARTING:
+ jcore_pit_local_init(this_cpu_ptr(nb->pit_percpu));
+ break;
+ }
+ return NOTIFY_OK;
+}
+
+static irqreturn_t timer_interrupt(int irq, void *dev_id)
+{
+ struct jcore_pit *pit = this_cpu_ptr(dev_id);
+
+ if (clockevent_state_oneshot(&pit->ced))
+ jcore_pit_disable(pit);
+
+ pit->ced.event_handler(&pit->ced);
+
+ return IRQ_HANDLED;
+}
+
+static void __init jcore_pit_init(struct device_node *node)
+{
+ int err;
+ __iomem void *pit_base;
+ unsigned pit_irq;
+ u32 percpu_offset = 0;
+ unsigned cpu;
+ struct resource res;
+ struct jcore_pit_nb *nb = 0;
+ struct jcore_clocksource *cs = 0;
+ struct jcore_pit __percpu *pit_percpu = 0;
+ unsigned long hwirq;
+ u32 irqprio, enable_val;
+
+ pit_base = of_iomap(node, 0);
+ if (!pit_base) {
+ pr_err("Error: Cannot map base address for J-Core PIT\n");
+ goto out;
+ }
+
+ pit_irq = irq_of_parse_and_map(node, 0);
+ if (!pit_irq) {
+ pr_err("Error: J-Core PIT has no IRQ\n");
+ goto out;
+ }
+
+ of_address_to_resource(node, 0, &res);
+ of_property_read_u32(node, "cpu-offset", &percpu_offset);
+
+ pr_info("Initializing J-Core PIT at %p IRQ %d\n", pit_base, pit_irq);
+
+ cs = kzalloc(sizeof *cs, GFP_KERNEL);
+ if (!cs) {
+ pr_err("Failed to allocate memory for clocksource\n");
+ goto out;
+ }
+
+ cs->base = pit_base;
+ cs->cs.name = "jcore_pit_cs";
+ cs->cs.rating = 400;
+ cs->cs.read = jcore_clocksource_read;
+ cs->cs.mult = 1;
+ cs->cs.shift = 0;
+ cs->cs.mask = CLOCKSOURCE_MASK(64);
+ cs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS;
+
+ err = clocksource_register_hz(&cs->cs, NSEC_PER_SEC);
+ if (err) {
+ pr_err("Error registering clocksource device: %d\n", err);
+ goto out;
+ }
+
+ pit_percpu = alloc_percpu(struct jcore_pit);
+ if (!pit_percpu) {
+ pr_err("Failed to allocate memory for clock event device\n");
+ goto out;
+ }
+
+ for_each_possible_cpu(cpu) {
+ struct jcore_pit *pit = per_cpu_ptr(pit_percpu, cpu);
+
+ pit->ced.name = "jcore_pit";
+ pit->ced.features = CLOCK_EVT_FEAT_PERIODIC
+ | CLOCK_EVT_FEAT_ONESHOT
+ | CLOCK_EVT_FEAT_PERCPU;
+ pit->ced.cpumask = cpumask_of(cpu);
+ pit->ced.rating = 400;
+ pit->ced.irq = pit_irq;
+ pit->ced.set_state_shutdown = jcore_pit_set_state_shutdown;
+ pit->ced.set_state_periodic = jcore_pit_set_state_periodic;
+ pit->ced.set_state_oneshot = jcore_pit_set_state_oneshot;
+ pit->ced.set_next_event = jcore_pit_set_next_event;
+
+ pit->paddr = res.start;
+ pit->psize = resource_size(&res);
+ res.start += percpu_offset;
+
+ pit->cpu = cpu;
+ }
+
+ nb = kzalloc(sizeof *nb, GFP_KERNEL);
+ if (!nb) {
+ pr_err("Failed to allocate memory for J-Core PIT notifier\n");
+ goto out;
+ }
+
+ nb->pit_percpu = pit_percpu;
+ nb->nb.notifier_call = jcore_pit_cpu_notify;
+ err = register_cpu_notifier(&nb->nb);
+ if (err) {
+ pr_err("Error registering J-Core PIT notifier: %d\n", err);
+ goto out;
+ }
+
+ err = request_irq(pit_irq, timer_interrupt,
+ IRQF_TIMER | IRQF_PERCPU, "jcore_pit", pit_percpu);
+ if (err) {
+ pr_err("pit irq request failed: %d\n", err);
+ goto out;
+ }
+
+ /* The J-Core PIT is not hard-wired to a particular IRQ, but
+ * integrated with the interrupt controller such that the IRQ it
+ * generates is programmable. The programming interface has a
+ * legacy field which was an interrupt priority for AIC1, but
+ * which is OR'd onto bits 2-5 of the generated IRQ number when
+ * used with J-Core AIC2, so set it to match these bits. */
+ hwirq = irq_get_irq_data(pit_irq)->hwirq;
+ irqprio = (hwirq >> 2) & PIT_PRIO_MASK;
+ enable_val = (1U << PIT_ENABLE_SHIFT)
+ | (hwirq << PIT_IRQ_SHIFT)
+ | (irqprio << PIT_PRIO_SHIFT);
+
+ for_each_possible_cpu(cpu) {
+ struct jcore_pit *pit = per_cpu_ptr(pit_percpu, cpu);
+ pit->enable_val = enable_val;
+ }
+
+ jcore_pit_local_init(this_cpu_ptr(pit_percpu));
+
+ return;
+
+out:
+ pr_err("Could not initialize J-Core PIT driver\n");
+}
+
+CLOCKSOURCE_OF_DECLARE(jcore_pit, "jcore,pit", jcore_pit_init);
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-25 07:50 +0200 |
| Subject | [PATCH v3 01/12] of: add vendor prefix for J-Core |
| Message-ID | <rCzRE-5z7-23@gated-at.bofh.it> |
| In reply to | #1406637 |
The J-Core project (j-core.org) produces open source cpu and SoC peripheral cores synthesizable as FPGA bitstreams or ASICs. Signed-off-by: Rich Felker <dalias@libc.org> --- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 86740d4..9c070b8 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -126,6 +126,7 @@ invensense InvenSense Inc. isee ISEE 2007 S.L. isil Intersil issi Integrated Silicon Solutions Inc. +jcore J-Core.org jedec JEDEC Solid State Technology Association karo Ka-Ro electronics GmbH keymile Keymile GmbH -- 2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh+dt@kernel.org> |
|---|---|
| Date | 2016-05-25 15:20 +0200 |
| Subject | Re: [PATCH v3 01/12] of: add vendor prefix for J-Core |
| Message-ID | <rCGT8-1qe-17@gated-at.bofh.it> |
| In reply to | #1406644 |
On Wed, May 25, 2016 at 12:43 AM, Rich Felker <dalias@libc.org> wrote: > The J-Core project (j-core.org) produces open source cpu and SoC > peripheral cores synthesizable as FPGA bitstreams or ASICs. > > Signed-off-by: Rich Felker <dalias@libc.org> Please add acks when posting subsequent versions. > --- > Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt > index 86740d4..9c070b8 100644 > --- a/Documentation/devicetree/bindings/vendor-prefixes.txt > +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt > @@ -126,6 +126,7 @@ invensense InvenSense Inc. > isee ISEE 2007 S.L. > isil Intersil > issi Integrated Silicon Solutions Inc. > +jcore J-Core.org > jedec JEDEC Solid State Technology Association > karo Ka-Ro electronics GmbH > keymile Keymile GmbH > -- > 2.8.1 > >
[toc] | [prev] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-25 07:50 +0200 |
| Subject | [PATCH v3 12/12] sh: add device tree source for J2 FPGA on Mimas v2 board |
| Message-ID | <rCzRD-5z7-15@gated-at.bofh.it> |
| In reply to | #1406637 |
Signed-off-by: Rich Felker <dalias@libc.org>
---
arch/sh/boot/dts/j2_mimas_v2.dts | 87 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
create mode 100755 arch/sh/boot/dts/j2_mimas_v2.dts
diff --git a/arch/sh/boot/dts/j2_mimas_v2.dts b/arch/sh/boot/dts/j2_mimas_v2.dts
new file mode 100755
index 0000000..4a66cda
--- /dev/null
+++ b/arch/sh/boot/dts/j2_mimas_v2.dts
@@ -0,0 +1,87 @@
+/dts-v1/;
+
+/ {
+ compatible = "jcore,j2-soc";
+ model = "J2 FPGA SoC on Mimas v2 board";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ interrupt-parent = <&aic>;
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cpu@0 {
+ device_type = "cpu";
+ compatible = "jcore,j2";
+ reg = < 0 >;
+ clock-frequency = < 50000000 >;
+ };
+ };
+
+ memory@10000000 {
+ device_type = "memory";
+ reg = < 0x10000000 0x4000000 >;
+ };
+
+ chosen {
+ stdout-path = "/soc@abcd0000/serial@100";
+ };
+
+ soc@abcd0000 {
+ compatible = "simple-bus";
+ ranges = <0 0xabcd0000 0x100000>;
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ aic: interrupt-controller@200 {
+ compatible = "jcore,aic1";
+ reg = < 0x200 0x10 >;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+
+ cache-controller@c0 {
+ compatible = "jcore,cache";
+ reg = < 0xc0 4 >;
+ };
+
+ timer@200 {
+ compatible = "jcore,pit";
+ reg = < 0x200 0x30 >;
+ interrupts = < 0x48 >;
+ };
+
+ spi@40 {
+ compatible = "jcore,spi2";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ spi-max-frequency = <12500000>;
+
+ reg = < 0x40 0x8 >;
+
+ sdcard@0 {
+ compatible = "mmc-spi-slot";
+ reg = <0>;
+ spi-max-frequency = <12500000>;
+ voltage-ranges = <3200 3400>;
+ mode = <0>;
+ };
+ };
+
+ serial@100 {
+ clock-frequency = <125000000>;
+ compatible = "xlnx,xps-uartlite-1.00.a";
+ current-speed = <19200>;
+ device_type = "serial";
+ interrupts = < 0x12 >;
+ port-number = <0>;
+ reg = < 0x100 0x10 >;
+ };
+ };
+};
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Date | 2016-05-25 12:40 +0200 |
| Subject | Re: [PATCH v3 12/12] sh: add device tree source for J2 FPGA on Mimas v2 board |
| Message-ID | <rCEoi-8jG-23@gated-at.bofh.it> |
| In reply to | #1406645 |
On Wed, May 25, 2016 at 05:43:03AM +0000, Rich Felker wrote:
> Signed-off-by: Rich Felker <dalias@libc.org>
> ---
> arch/sh/boot/dts/j2_mimas_v2.dts | 87 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 87 insertions(+)
> create mode 100755 arch/sh/boot/dts/j2_mimas_v2.dts
>
> diff --git a/arch/sh/boot/dts/j2_mimas_v2.dts b/arch/sh/boot/dts/j2_mimas_v2.dts
> new file mode 100755
> index 0000000..4a66cda
> --- /dev/null
> +++ b/arch/sh/boot/dts/j2_mimas_v2.dts
> @@ -0,0 +1,87 @@
> +/dts-v1/;
> +
> +/ {
> + compatible = "jcore,j2-soc";
> + model = "J2 FPGA SoC on Mimas v2 board";
> +
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + interrupt-parent = <&aic>;
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + cpu@0 {
> + device_type = "cpu";
> + compatible = "jcore,j2";
> + reg = < 0 >;
> + clock-frequency = < 50000000 >;
Nit: please remove the spacing around the '<' and '>' here. If nothing
else, it's inconsistent with the rest of this file.
> + };
> + };
> +
> + memory@10000000 {
> + device_type = "memory";
> + reg = < 0x10000000 0x4000000 >;
> + };
Likewise.
> +
> + chosen {
> + stdout-path = "/soc@abcd0000/serial@100";
> + };
Please use a label for the serial node, have an alias, and describe the
pre-configured rate per the stdout-path binding, e.g.
aliases {
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:19200n8";
};
...
soc@abcd0000 {
...
uart0: serial@100 {
...
};
};
Note that using stdout-path is preferable to current-speed or other
UART-specific bindings.
Thanks,
Mark.
> +
> + soc@abcd0000 {
> + compatible = "simple-bus";
> + ranges = <0 0xabcd0000 0x100000>;
> +
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + aic: interrupt-controller@200 {
> + compatible = "jcore,aic1";
> + reg = < 0x200 0x10 >;
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> +
> + cache-controller@c0 {
> + compatible = "jcore,cache";
> + reg = < 0xc0 4 >;
> + };
> +
> + timer@200 {
> + compatible = "jcore,pit";
> + reg = < 0x200 0x30 >;
> + interrupts = < 0x48 >;
> + };
> +
> + spi@40 {
> + compatible = "jcore,spi2";
> +
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + spi-max-frequency = <12500000>;
> +
> + reg = < 0x40 0x8 >;
> +
> + sdcard@0 {
> + compatible = "mmc-spi-slot";
> + reg = <0>;
> + spi-max-frequency = <12500000>;
> + voltage-ranges = <3200 3400>;
> + mode = <0>;
> + };
> + };
> +
> + serial@100 {
> + clock-frequency = <125000000>;
> + compatible = "xlnx,xps-uartlite-1.00.a";
> + current-speed = <19200>;
> + device_type = "serial";
> + interrupts = < 0x12 >;
> + port-number = <0>;
> + reg = < 0x100 0x10 >;
> + };
> + };
> +};
> --
> 2.8.1
>
[toc] | [prev] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-26 01:20 +0200 |
| Subject | Re: [PATCH v3 12/12] sh: add device tree source for J2 FPGA on Mimas v2 board |
| Message-ID | <rCQfL-727-5@gated-at.bofh.it> |
| In reply to | #1406828 |
On Wed, May 25, 2016 at 11:33:50AM +0100, Mark Rutland wrote:
> On Wed, May 25, 2016 at 05:43:03AM +0000, Rich Felker wrote:
> > Signed-off-by: Rich Felker <dalias@libc.org>
> > ---
> > arch/sh/boot/dts/j2_mimas_v2.dts | 87 ++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 87 insertions(+)
> > create mode 100755 arch/sh/boot/dts/j2_mimas_v2.dts
> >
> > diff --git a/arch/sh/boot/dts/j2_mimas_v2.dts b/arch/sh/boot/dts/j2_mimas_v2.dts
> > new file mode 100755
> > index 0000000..4a66cda
> > --- /dev/null
> > +++ b/arch/sh/boot/dts/j2_mimas_v2.dts
> > @@ -0,0 +1,87 @@
> > +/dts-v1/;
> > +
> > +/ {
> > + compatible = "jcore,j2-soc";
> > + model = "J2 FPGA SoC on Mimas v2 board";
> > +
> > + #address-cells = <1>;
> > + #size-cells = <1>;
> > +
> > + interrupt-parent = <&aic>;
> > +
> > + cpus {
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > +
> > + cpu@0 {
> > + device_type = "cpu";
> > + compatible = "jcore,j2";
> > + reg = < 0 >;
> > + clock-frequency = < 50000000 >;
>
> Nit: please remove the spacing around the '<' and '>' here. If nothing
> else, it's inconsistent with the rest of this file.
>
> > + };
> > + };
> > +
> > + memory@10000000 {
> > + device_type = "memory";
> > + reg = < 0x10000000 0x4000000 >;
> > + };
>
> Likewise.
OK, I'll change both of these.
> > +
> > + chosen {
> > + stdout-path = "/soc@abcd0000/serial@100";
> > + };
>
> Please use a label for the serial node, have an alias, and describe the
> pre-configured rate per the stdout-path binding, e.g.
Per Documentation/devicetree/bindings/xilinx.txt, current-speed is a
required property for "xlnx,xps-uartlite-1.00.a". Note that uartlite
does not actually have a programmable baud rate; the property is
instead being used to describe the hardware-provided rate.
BTW our uartlite is not actually derived from Xilinx's IP core, just
interface-compatible with it, so I'd actually like to add a
"jcore,uartlite" binding too in order to express this, with
"xlnx,xps-uartlite-1.00.a" as the fallback compatible-tag. I'll
propose that as a separate patch later.
Rich
[toc] | [prev] | [next] | [standalone]
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Date | 2016-05-26 12:40 +0200 |
| Subject | Re: [PATCH v3 12/12] sh: add device tree source for J2 FPGA on Mimas v2 board |
| Message-ID | <rD0RP-5hu-11@gated-at.bofh.it> |
| In reply to | #1407288 |
On Wed, May 25, 2016 at 07:15:25PM -0400, Rich Felker wrote:
> On Wed, May 25, 2016 at 11:33:50AM +0100, Mark Rutland wrote:
> > On Wed, May 25, 2016 at 05:43:03AM +0000, Rich Felker wrote:
> > > Signed-off-by: Rich Felker <dalias@libc.org>
> > > ---
> > > arch/sh/boot/dts/j2_mimas_v2.dts | 87 ++++++++++++++++++++++++++++++++++++++++
> > > 1 file changed, 87 insertions(+)
> > > create mode 100755 arch/sh/boot/dts/j2_mimas_v2.dts
> > >
> > > diff --git a/arch/sh/boot/dts/j2_mimas_v2.dts b/arch/sh/boot/dts/j2_mimas_v2.dts
> > > new file mode 100755
> > > index 0000000..4a66cda
> > > --- /dev/null
> > > +++ b/arch/sh/boot/dts/j2_mimas_v2.dts
> > > @@ -0,0 +1,87 @@
> > > +/dts-v1/;
> > > +
> > > +/ {
> > > + compatible = "jcore,j2-soc";
> > > + model = "J2 FPGA SoC on Mimas v2 board";
> > > +
> > > + #address-cells = <1>;
> > > + #size-cells = <1>;
> > > +
> > > + interrupt-parent = <&aic>;
> > > +
> > > + cpus {
> > > + #address-cells = <1>;
> > > + #size-cells = <0>;
> > > +
> > > + cpu@0 {
> > > + device_type = "cpu";
> > > + compatible = "jcore,j2";
> > > + reg = < 0 >;
> > > + clock-frequency = < 50000000 >;
> >
> > Nit: please remove the spacing around the '<' and '>' here. If nothing
> > else, it's inconsistent with the rest of this file.
> >
> > > + };
> > > + };
> > > +
> > > + memory@10000000 {
> > > + device_type = "memory";
> > > + reg = < 0x10000000 0x4000000 >;
> > > + };
> >
> > Likewise.
>
> OK, I'll change both of these.
>
> > > +
> > > + chosen {
> > > + stdout-path = "/soc@abcd0000/serial@100";
> > > + };
> >
> > Please use a label for the serial node, have an alias, and describe the
> > pre-configured rate per the stdout-path binding, e.g.
>
> Per Documentation/devicetree/bindings/xilinx.txt, current-speed is a
> required property for "xlnx,xps-uartlite-1.00.a". Note that uartlite
> does not actually have a programmable baud rate; the property is
> instead being used to describe the hardware-provided rate.
Ah, ok. I was not aware of this.
> BTW our uartlite is not actually derived from Xilinx's IP core, just
> interface-compatible with it, so I'd actually like to add a
> "jcore,uartlite" binding too in order to express this, with
> "xlnx,xps-uartlite-1.00.a" as the fallback compatible-tag. I'll
> propose that as a separate patch later.
Please do.
Thanks,
Mark.
[toc] | [prev] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-25 07:50 +0200 |
| Subject | [PATCH v3 03/12] of: add J-Core interrupt controller bindings |
| Message-ID | <rCzRE-5z7-25@gated-at.bofh.it> |
| In reply to | #1406637 |
Signed-off-by: Rich Felker <dalias@libc.org>
---
.../bindings/interrupt-controller/jcore,aic.txt | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
diff --git a/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt b/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
new file mode 100644
index 0000000..5dc99b9
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
@@ -0,0 +1,29 @@
+J-Core Advanced Interrupt Controller
+
+Required properties:
+
+- compatible : Should be "jcore,aic1" for the (obsolete) first-generation aic
+ with 8 interrupt lines with programmable priorities, or "jcore,aic2" for
+ the "aic2" core with 64 interrupts.
+
+- reg : Memory region for configuration.
+
+- interrupt-controller : Identifies the node as an interrupt controller
+
+- #interrupt-cells : Specifies the number of cells needed to encode an
+ interrupt source. The value shall be 1.
+
+Optional properties:
+
+- cpu-offset : For SMP, the offset to the per-cpu memory region for
+ configuration, to be scaled by the cpu number.
+
+
+Example:
+
+aic: interrupt-controller@200 {
+ compatible = "jcore,aic2";
+ reg = < 0x200 0x10 >;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+};
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Date | 2016-05-25 12:30 +0200 |
| Subject | Re: [PATCH v3 03/12] of: add J-Core interrupt controller bindings |
| Message-ID | <rCEeD-8gC-47@gated-at.bofh.it> |
| In reply to | #1406647 |
On Wed, May 25, 2016 at 05:43:03AM +0000, Rich Felker wrote:
> Signed-off-by: Rich Felker <dalias@libc.org>
> ---
> .../bindings/interrupt-controller/jcore,aic.txt | 29 ++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
>
> diff --git a/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt b/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
> new file mode 100644
> index 0000000..5dc99b9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
> @@ -0,0 +1,29 @@
> +J-Core Advanced Interrupt Controller
> +
> +Required properties:
> +
> +- compatible : Should be "jcore,aic1" for the (obsolete) first-generation aic
> + with 8 interrupt lines with programmable priorities, or "jcore,aic2" for
> + the "aic2" core with 64 interrupts.
> +
> +- reg : Memory region for configuration.
> +
> +- interrupt-controller : Identifies the node as an interrupt controller
> +
> +- #interrupt-cells : Specifies the number of cells needed to encode an
> + interrupt source. The value shall be 1.
> +
> +Optional properties:
> +
> +- cpu-offset : For SMP, the offset to the per-cpu memory region for
> + configuration, to be scaled by the cpu number.
I take is that "cpu number" means the "sequential, zero-based hardware
cpu id" defined in patch 2. I would recommend that you explicitly
mention that (e.g. here say "hardware cpu id" rather than "cpu number"),
so as to not have this confused with Linux logical IDs.
Thanks,
Mark.
> +
> +
> +Example:
> +
> +aic: interrupt-controller@200 {
> + compatible = "jcore,aic2";
> + reg = < 0x200 0x10 >;
> + interrupt-controller;
> + #interrupt-cells = <1>;
> +};
> --
> 2.8.1
>
>
[toc] | [prev] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-26 01:10 +0200 |
| Subject | Re: [PATCH v3 03/12] of: add J-Core interrupt controller bindings |
| Message-ID | <rCQ65-6Yp-15@gated-at.bofh.it> |
| In reply to | #1406817 |
On Wed, May 25, 2016 at 11:25:04AM +0100, Mark Rutland wrote: > On Wed, May 25, 2016 at 05:43:03AM +0000, Rich Felker wrote: > > Signed-off-by: Rich Felker <dalias@libc.org> > > --- > > .../bindings/interrupt-controller/jcore,aic.txt | 29 ++++++++++++++++++++++ > > 1 file changed, 29 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt > > > > diff --git a/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt b/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt > > new file mode 100644 > > index 0000000..5dc99b9 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt > > @@ -0,0 +1,29 @@ > > +J-Core Advanced Interrupt Controller > > + > > +Required properties: > > + > > +- compatible : Should be "jcore,aic1" for the (obsolete) first-generation aic > > + with 8 interrupt lines with programmable priorities, or "jcore,aic2" for > > + the "aic2" core with 64 interrupts. > > + > > +- reg : Memory region for configuration. > > + > > +- interrupt-controller : Identifies the node as an interrupt controller > > + > > +- #interrupt-cells : Specifies the number of cells needed to encode an > > + interrupt source. The value shall be 1. > > + > > +Optional properties: > > + > > +- cpu-offset : For SMP, the offset to the per-cpu memory region for > > + configuration, to be scaled by the cpu number. > > I take is that "cpu number" means the "sequential, zero-based hardware > cpu id" defined in patch 2. I would recommend that you explicitly > mention that (e.g. here say "hardware cpu id" rather than "cpu number"), > so as to not have this confused with Linux logical IDs. OK. The current arch/sh SMP framework only has nominal support for hw cpuid != logical cpuid; it's not actually used/usable right now. But the DT binding spec should be clear on this anyway. Rich
[toc] | [prev] | [next] | [standalone]
| From | Rich Felker <dalias@libc.org> |
|---|---|
| Date | 2016-05-25 07:50 +0200 |
| Subject | [PATCH v3 02/12] of: add J-Core cpu bindings |
| Message-ID | <rCzRD-5z7-21@gated-at.bofh.it> |
| In reply to | #1406637 |
Signed-off-by: Rich Felker <dalias@libc.org> --- Documentation/devicetree/bindings/jcore/cpus.txt | 92 ++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Documentation/devicetree/bindings/jcore/cpus.txt diff --git a/Documentation/devicetree/bindings/jcore/cpus.txt b/Documentation/devicetree/bindings/jcore/cpus.txt new file mode 100644 index 0000000..9d77ec1 --- /dev/null +++ b/Documentation/devicetree/bindings/jcore/cpus.txt @@ -0,0 +1,92 @@ +=================== +J-Core cpu bindings +=================== + +The J-Core processors are open source CPU cores that can be built as FPGA +soft cores or ASICs. The device tree is also responsible for describing the +cache controls and, for SMP configurations, all details of the SMP method, +as documented below. + + +--------------------- +Top-level "cpus" node +--------------------- + +Required properties: + +- #address-cells: Must be 1. + +- #size-cells: Must be 0. + +Optional properties: + +- enable-method: Required only for SMP systems. If present, must be + "jcore,spin-table". + + +-------------------- +Individual cpu nodes +-------------------- + +Required properties: + +- device_type: Must be "cpu". + +- compatible: Must be "jcore,j2". + +- reg: Must be 0 on uniprocessor systems, or the sequential, zero-based + hardware cpu id on SMP systems. + +Optional properties: + +- clock-frequency: Clock frequency of the cpu in Hz. + +- cpu-release-addr: Necessary only for secondary processors on SMP systems + using the "jcore,spin-table" enable method. If present, must consist of + two cells containing physical addresses. The first cell contains an + address which, when written, unblocks the secondary cpu. The second cell + contains an address from which the cpu will read its initial program + counter when unblocked. + + +--------------------- +Cache controller node +--------------------- + +Required properties: + +- compatible: Must be "jcore,cache". + +- reg: A memory range for the cache controller registers. + + +-------- +IPI node +-------- + +Device trees for SMP systems must have an IPI node representing the mechanism +used for inter-processor interrupt generation. + +Required properties: + +- compatible: Must be "jcore,ipi-controller". + +- reg: A memory range used to IPI generation. + +- interrupts: An irq on which IPI will be received. + + +---------- +CPUID node +---------- + +Device trees for SMP systems must have a CPUID node representing the mechanism +used to identify the current processor on which execution is taking place. + +Required properties: + +- compatible: Must be "jcore,cpuid-mmio". + +- reg: A memory range containing a single 32-bit mmio register which produces + the current cpu id (matching the "reg" property of the cpu performing the + read) when read. -- 2.8.1
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web