Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Modified i.MX GPIO control module and PCIe module.
details: https://anonhg.NetBSD.org/src/rev/c6cb820b9937
branches: trunk
changeset: 962536:c6cb820b9937
user: hkenken <hkenken%NetBSD.org@localhost>
date: Wed Jul 24 12:33:18 2019 +0000
description:
Modified i.MX GPIO control module and PCIe module.
+ Add imxpcie.c
imx PCIe common driver
diffstat:
sys/arch/arm/imx/files.imx51 | 5 +-
sys/arch/arm/imx/files.imx6 | 10 +-
sys/arch/arm/imx/files.imx7 | 5 +-
sys/arch/arm/imx/imx51_gpio.c | 26 +-
sys/arch/arm/imx/imx51var.h | 7 +-
sys/arch/arm/imx/imx6_gpio.c | 30 +-
sys/arch/arm/imx/imx6_pcie.c | 849 +------------------------
sys/arch/arm/imx/imx6_usdhc.c | 14 +-
sys/arch/arm/imx/imx7_gpio.c | 26 +-
sys/arch/arm/imx/imx7_usdhc.c | 8 +-
sys/arch/arm/imx/imxgpio.c | 242 ++----
sys/arch/arm/imx/imxgpiovar.h | 58 +-
sys/arch/arm/imx/imxpcie.c | 798 ++++++++++++++++++++++++
sys/arch/arm/imx/imxpciereg.h | 297 +++++++++
sys/arch/arm/imx/imxpcievar.h | 75 ++
sys/arch/evbarm/conf/ARMADILLO-IOT-G3 | 3 +-
sys/arch/evbarm/conf/CUBOX-I | 3 +-
sys/arch/evbarm/conf/HUMMINGBOARD | 3 +-
sys/arch/evbarm/conf/IMX6UL-STARTER | 3 +-
sys/arch/evbarm/conf/KOBO | 3 +-
sys/arch/evbarm/conf/NETWALKER | 7 +-
sys/arch/evbarm/conf/NITROGEN6X | 230 +------
sys/arch/evbarm/conf/mk.nitrogen6 | 25 +-
sys/arch/evbarm/conf/std.nitrogen6 | 10 +-
sys/arch/evbarm/imx7/imx7_ioconfig.c | 11 +-
sys/arch/evbarm/kobo/kobo_machdep.c | 5 +-
sys/arch/evbarm/netwalker/netwalker_lcd.c | 23 +-
sys/arch/evbarm/netwalker/netwalker_machdep.c | 5 +-
sys/arch/evbarm/netwalker/netwalker_spi.c | 47 +-
sys/arch/evbarm/netwalker/netwalker_usb.c | 28 +-
sys/arch/evbarm/nitrogen6/nitrogen6_iomux.c | 58 +-
31 files changed, 1577 insertions(+), 1337 deletions(-)
diffs (truncated from 3904 to 300 lines):
diff -r 0052eab68c33 -r c6cb820b9937 sys/arch/arm/imx/files.imx51
--- a/sys/arch/arm/imx/files.imx51 Wed Jul 24 12:13:13 2019 +0000
+++ b/sys/arch/arm/imx/files.imx51 Wed Jul 24 12:33:18 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.imx51,v 1.18 2018/03/17 18:34:09 ryo Exp $
+# $NetBSD: files.imx51,v 1.19 2019/07/24 12:33:18 hkenken Exp $
#
# Configuration info for the Freescale i.MX5x
#
@@ -62,9 +62,8 @@
# iMX GPIO
device imxgpio: gpiobus
attach imxgpio at axi
-file arch/arm/imx/imxgpio.c imxgpio needs-flag
+file arch/arm/imx/imxgpio.c imxgpio
file arch/arm/imx/imx51_gpio.c imxgpio
-defflag opt_imxgpio.h IMX_GPIO_INTR_SPLIT
# iMX IOMUX
device imxiomux : bus_space_generic
diff -r 0052eab68c33 -r c6cb820b9937 sys/arch/arm/imx/files.imx6
--- a/sys/arch/arm/imx/files.imx6 Wed Jul 24 12:13:13 2019 +0000
+++ b/sys/arch/arm/imx/files.imx6 Wed Jul 24 12:33:18 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.imx6,v 1.16 2019/07/24 11:58:00 hkenken Exp $
+# $NetBSD: files.imx6,v 1.17 2019/07/24 12:33:18 hkenken Exp $
#
# Configuration info for the Freescale i.MX6
#
@@ -28,8 +28,9 @@
# iMX6 PCIe
device imxpcie: pcibus
-attach imxpcie at axi
-file arch/arm/imx/imx6_pcie.c imxpcie
+attach imxpcie at axi with imx6_pcie
+file arch/arm/imx/imxpcie.c imxpcie
+file arch/arm/imx/imx6_pcie.c imx6_pcie
# iMX6 Clock Control Module
device imxccm : clk
@@ -62,9 +63,8 @@
# iMX GPIO
device imxgpio: gpiobus
attach imxgpio at axi
-file arch/arm/imx/imxgpio.c imxgpio needs-flag
+file arch/arm/imx/imxgpio.c imxgpio
file arch/arm/imx/imx6_gpio.c imxgpio
-defflag opt_imxgpio.h IMX_GPIO_INTR_SPLIT
# iMX6 IOMUX
device imxiomux
diff -r 0052eab68c33 -r c6cb820b9937 sys/arch/arm/imx/files.imx7
--- a/sys/arch/arm/imx/files.imx7 Wed Jul 24 12:13:13 2019 +0000
+++ b/sys/arch/arm/imx/files.imx7 Wed Jul 24 12:33:18 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.imx7,v 1.6 2018/03/17 18:34:09 ryo Exp $
+# $NetBSD: files.imx7,v 1.7 2019/07/24 12:33:18 hkenken Exp $
#
# Configuration info for the Freescale i.MX7
#
@@ -52,9 +52,8 @@
# iMX GPIO
device imxgpio: gpiobus
attach imxgpio at axi
-file arch/arm/imx/imxgpio.c imxgpio needs-flag
+file arch/arm/imx/imxgpio.c imxgpio
file arch/arm/imx/imx7_gpio.c imxgpio
-defflag opt_imxgpio.h IMX_GPIO_INTR_SPLIT
# iMX7 IOMUX
device imxiomux
diff -r 0052eab68c33 -r c6cb820b9937 sys/arch/arm/imx/imx51_gpio.c
--- a/sys/arch/arm/imx/imx51_gpio.c Wed Jul 24 12:13:13 2019 +0000
+++ b/sys/arch/arm/imx/imx51_gpio.c Wed Jul 24 12:33:18 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: imx51_gpio.c,v 1.3 2014/07/25 07:49:56 hkenken Exp $ */
+/* $NetBSD: imx51_gpio.c,v 1.4 2019/07/24 12:33:18 hkenken Exp $ */
/* derived from imx31_gpio.c */
/*-
@@ -30,13 +30,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imx51_gpio.c,v 1.3 2014/07/25 07:49:56 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx51_gpio.c,v 1.4 2019/07/24 12:33:18 hkenken Exp $");
#include "opt_imx.h"
#include "locators.h"
#include "gpio.h"
+#define _INTR_PRIVATE
+
#include <sys/param.h>
#include <sys/evcnt.h>
#include <sys/atomic.h>
@@ -86,6 +88,7 @@
void
imxgpio_attach(device_t parent, device_t self, void *aux)
{
+ struct imxgpio_softc * const gpio = device_private(self);
struct axi_attach_args * const aa = aux;
bus_space_handle_t ioh;
int error;
@@ -100,21 +103,30 @@
aprint_error_dev(self, "missing irqbase in config\n");
return;
}
-
+
if (aa->aa_size == AXICF_SIZE_DEFAULT)
aa->aa_size = GPIO_SIZE;
error = bus_space_map(aa->aa_iot, aa->aa_addr, aa->aa_size,
0, &ioh);
-
if (error) {
aprint_error(": failed to map register %#lx@%#lx: %d\n",
aa->aa_size, aa->aa_addr, error);
return;
}
- imxgpio_attach_common(self, aa->aa_iot, ioh,
- (aa->aa_addr - GPIO1_BASE) / 0x4000,
- aa->aa_irq, aa->aa_irqbase);
+ gpio->gpio_is = intr_establish(aa->aa_irq,
+ IPL_HIGH, IST_LEVEL, pic_handle_intr, &gpio->gpio_pic);
+ KASSERT(gpio->gpio_is != NULL );
+ gpio->gpio_is_high = intr_establish(aa->aa_irq + 1,
+ IPL_HIGH, IST_LEVEL, pic_handle_intr, &gpio->gpio_pic);
+ KASSERT(gpio->gpio_is_high != NULL);
+
+ gpio->gpio_memt = aa->aa_iot;
+ gpio->gpio_memh = ioh;
+ gpio->gpio_unit = (aa->aa_addr - GPIO1_BASE) / 0x4000;
+ gpio->gpio_irqbase = aa->aa_irqbase;
+
+ imxgpio_attach_common(self);
}
diff -r 0052eab68c33 -r c6cb820b9937 sys/arch/arm/imx/imx51var.h
--- a/sys/arch/arm/imx/imx51var.h Wed Jul 24 12:13:13 2019 +0000
+++ b/sys/arch/arm/imx/imx51var.h Wed Jul 24 12:33:18 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: imx51var.h,v 1.6 2018/03/17 18:34:09 ryo Exp $ */
+/* $NetBSD: imx51var.h,v 1.7 2019/07/24 12:33:18 hkenken Exp $ */
/*
* Copyright (c) 2015 Genetec Corporation. All rights reserved.
@@ -49,10 +49,6 @@
extern struct arm32_bus_dma_tag arm_generic_dma_tag;
extern struct arm32_bus_dma_tag imx_bus_dma_tag;
-void gpio_set_direction(uint32_t, uint32_t);
-void gpio_data_write(uint32_t, uint32_t);
-bool gpio_data_read(uint32_t);
-
struct axi_attach_args {
const char *aa_name;
bus_space_tag_t aa_iot;
@@ -63,7 +59,6 @@
int aa_irqbase;
};
-
/* iomux utility functions */
struct iomux_conf {
u_int pin;
diff -r 0052eab68c33 -r c6cb820b9937 sys/arch/arm/imx/imx6_gpio.c
--- a/sys/arch/arm/imx/imx6_gpio.c Wed Jul 24 12:13:13 2019 +0000
+++ b/sys/arch/arm/imx/imx6_gpio.c Wed Jul 24 12:33:18 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: imx6_gpio.c,v 1.2 2017/06/09 18:14:59 ryo Exp $ */
+/* $NetBSD: imx6_gpio.c,v 1.3 2019/07/24 12:33:18 hkenken Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -29,7 +29,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imx6_gpio.c,v 1.2 2017/06/09 18:14:59 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_gpio.c,v 1.3 2019/07/24 12:33:18 hkenken Exp $");
+
+#define _INTR_PRIVATE
#include "opt_imx.h"
@@ -45,12 +47,12 @@
#include <arm/cpu.h>
#include <arm/armreg.h>
#include <arm/cpufunc.h>
+#include <arm/pic/picvar.h>
#include <sys/bus.h>
#include <arm/imx/imx6_reg.h>
#include <arm/imx/imx6var.h>
-#include <arm/pic/picvar.h>
#include <arm/imx/imxgpioreg.h>
#include <arm/imx/imxgpiovar.h>
@@ -88,9 +90,10 @@
void
imxgpio_attach(device_t parent, device_t self, void *aux)
{
+ struct imxgpio_softc * const gpio = device_private(self);
struct axi_attach_args * const aa = aux;
bus_space_handle_t ioh;
- int error, group;
+ int error;
if (aa->aa_irq == AXICF_IRQ_DEFAULT &&
aa->aa_irqbase != AXICF_IRQBASE_DEFAULT) {
@@ -114,8 +117,21 @@
return;
}
- group = (aa->aa_addr - IMX6_AIPS1_BASE - AIPS1_GPIO1_BASE) / 0x4000;
- imxgpio_attach_common(self, aa->aa_iot, ioh, group,
- aa->aa_irq, aa->aa_irqbase);
+ aprint_naive("\n");
+ aprint_normal(": GPIO\n");
+
+ gpio->gpio_memt = aa->aa_iot;
+ gpio->gpio_memh = ioh;
+ gpio->gpio_unit = (aa->aa_addr - IMX6_AIPS1_BASE - AIPS1_GPIO1_BASE) / 0x4000;
+ gpio->gpio_irqbase = aa->aa_irqbase;
+
+ gpio->gpio_is = intr_establish(aa->aa_irq,
+ IPL_HIGH, IST_LEVEL, pic_handle_intr, &gpio->gpio_pic);
+ KASSERT(gpio->gpio_is != NULL );
+ gpio->gpio_is_high = intr_establish(aa->aa_irq + 1,
+ IPL_HIGH, IST_LEVEL, pic_handle_intr, &gpio->gpio_pic);
+ KASSERT(gpio->gpio_is_high != NULL);
+
+ imxgpio_attach_common(self);
}
diff -r 0052eab68c33 -r c6cb820b9937 sys/arch/arm/imx/imx6_pcie.c
--- a/sys/arch/arm/imx/imx6_pcie.c Wed Jul 24 12:13:13 2019 +0000
+++ b/sys/arch/arm/imx/imx6_pcie.c Wed Jul 24 12:33:18 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: imx6_pcie.c,v 1.9 2019/06/20 08:16:19 hkenken Exp $ */
+/* $NetBSD: imx6_pcie.c,v 1.10 2019/07/24 12:33:18 hkenken Exp $ */
/*
* Copyright (c) 2016 Genetec Corporation. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.9 2019/06/20 08:16:19 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.10 2019/07/24 12:33:18 hkenken Exp $");
#include "opt_pci.h"
@@ -39,6 +39,8 @@
#include "imxgpio.h"
#include "locators.h"
+#define _INTR_PRIVATE
+
#include <sys/bus.h>
#include <sys/device.h>
#include <sys/intr.h>
@@ -58,17 +60,29 @@
#include <dev/pci/pcivar.h>
#include <dev/pci/pciconf.h>
+#include <arm/imx/imxpcievar.h>
#include <arm/imx/imxgpioreg.h>
#include <arm/imx/imxgpiovar.h>
#include <arm/imx/imx6var.h>
#include <arm/imx/imx6_reg.h>
-#include <arm/imx/imx6_pciereg.h>
#include <arm/imx/imx6_iomuxreg.h>
#include <arm/imx/imx6_ccmreg.h>
#include <arm/imx/imx6_ccmvar.h>
-static int imx6pcie_match(device_t, cfdata_t, void *);
-static void imx6pcie_attach(device_t, device_t, void *);
+struct imx6_pcie_softc {
+ struct imxpcie_softc sc_imxpcie;
+
+ int32_t sc_gpio_reset;
+ int32_t sc_gpio_reset_active;
+};
+
+static int imx6_pcie_match(device_t, cfdata_t, void *);
+static void imx6_pcie_attach(device_t, device_t, void *);
+
+static void imx6_pcie_configure(void *);
+static uint32_t imx6_pcie_gpr_read(void *, uint32_t);
+static void imx6_pcie_gpr_write(void *, uint32_t, uint32_t);
+static void imx6_pcie_reset(void *);
#define IMX6_PCIE_MEM_BASE 0x01000000
Home |
Main Index |
Thread Index |
Old Index