-/* $OpenBSD: if_cpsw.c,v 1.39 2016/08/06 10:07:45 jsg Exp $ */
+/* $OpenBSD: if_cpsw.c,v 1.40 2016/08/12 03:22:41 jsg Exp $ */
/* $NetBSD: if_cpsw.c,v 1.3 2013/04/17 14:36:34 bouyer Exp $ */
/*
#include <arch/armv7/armv7/armv7var.h>
#include <arch/armv7/omap/if_cpswreg.h>
-#include <arch/armv7/omap/sitara_cm.h>
#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_pinctrl.h>
#include <dev/ofw/fdt.h>
#define CPSW_TXFRAGS 16
*/
memsize = 0x4000;
- sitara_cm_pinctrlbyname(faa->fa_node, "default");
+ pinctrl_byname(faa->fa_node, "default");
for (node = OF_child(faa->fa_node); node; node = OF_peer(node)) {
memset(name, 0, sizeof(name));
if (strcmp(name, "ti,davinci_mdio") != 0)
continue;
- sitara_cm_pinctrlbyname(node, "default");
+ pinctrl_byname(node, "default");
}
timeout_set(&sc->sc_tick, cpsw_tick, sc);
-/* $OpenBSD: omap_com.c,v 1.9 2016/08/06 10:07:45 jsg Exp $ */
+/* $OpenBSD: omap_com.c,v 1.10 2016/08/12 03:22:41 jsg Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
* All rights reserved.
#include <armv7/armv7/armv7var.h>
#include <armv7/armv7/armv7_machdep.h>
-#include <armv7/omap/sitara_cm.h>
#include <dev/ofw/fdt.h>
#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_pinctrl.h>
#define com_isr 8
#define ISR_RECV (ISR_RXPL | ISR_XMODE | ISR_RCVEIR)
return;
}
- sitara_cm_pinctrlbyname(faa->fa_node, "default");
+ pinctrl_byname(faa->fa_node, "default");
com_attach_subr(sc);
-/* $OpenBSD: omgpio.c,v 1.9 2016/08/11 04:33:06 jsg Exp $ */
+/* $OpenBSD: omgpio.c,v 1.10 2016/08/12 03:22:41 jsg Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
#include <armv7/armv7/armv7var.h>
#include <armv7/omap/prcmvar.h>
-#include <armv7/omap/sitara_cm.h>
#include <armv7/omap/omgpiovar.h>
#include <dev/ofw/fdt.h>
-/* $OpenBSD: ommmc.c,v 1.28 2016/08/06 10:07:45 jsg Exp $ */
+/* $OpenBSD: ommmc.c,v 1.29 2016/08/12 03:22:41 jsg Exp $ */
/*
* Copyright (c) 2009 Dale Rahn <drahn@openbsd.org>
#include <armv7/armv7/armv7var.h>
#include <armv7/omap/prcmvar.h>
-#include <armv7/omap/sitara_cm.h>
#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_pinctrl.h>
#include <dev/ofw/fdt.h>
/*
printf("\n");
- sitara_cm_pinctrlbyname(faa->fa_node, "default");
+ pinctrl_byname(faa->fa_node, "default");
/* Enable ICLKEN, FCLKEN? */
prcm_enablemodule(PRCM_MMC0 + unit);
-/* $OpenBSD: sitara_cm.c,v 1.3 2016/07/17 02:45:05 jsg Exp $ */
+/* $OpenBSD: sitara_cm.c,v 1.4 2016/08/12 03:22:41 jsg Exp $ */
/* $NetBSD: sitara_cm.c,v 1.1 2013/04/17 14:31:02 bouyer Exp $ */
/*
* Copyright (c) 2010
#include <armv7/omap/sitara_cmreg.h>
#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_pinctrl.h>
void sitara_cm_attach(struct device *parent, struct device *self, void *aux);
-int sitara_cm_pinctrl(uint32_t);
+int sitara_cm_pinctrl(uint32_t, void *);
struct sitara_cm_softc {
struct device sc_dev;
struct sitara_cm_softc *sc = (struct sitara_cm_softc *)self;
struct armv7_attach_args *aa = aux;
uint32_t rev;
+ int node;
if (sitara_cm_sc)
panic("sitara_cm_attach: already attached");
aa->aa_dev->mem[0].size, 0, &sc->sc_ioh) != 0)
panic("%s: bus_space_map failed!\n", __func__);
+ node = OF_finddevice("/ocp/l4_wkup@44c00000/scm@210000/pinmux@800");
+ if (node != -1)
+ pinctrl_register(node, sitara_cm_pinctrl, sc);
+
sitara_cm_sc = sc;
if (sitara_cm_reg_read_4(OMAP2SCM_REVISION, &rev) != 0)
}
int
-sitara_cm_pinctrlbyid(int node, int id)
-{
- char pinctrl[32];
- uint32_t *phandles;
- int len, i;
-
- if (!sitara_cm_sc)
- return -1;
-
- snprintf(pinctrl, sizeof(pinctrl), "pinctrl-%d", id);
- len = OF_getproplen(node, pinctrl);
- if (len <= 0)
- return -1;
-
- phandles = malloc(len, M_TEMP, M_WAITOK);
- OF_getpropintarray(node, pinctrl, phandles, len);
- for (i = 0; i < len / sizeof(uint32_t); i++)
- sitara_cm_pinctrl(phandles[i]);
- free(phandles, M_TEMP, len);
- return 0;
-}
-
-int
-sitara_cm_pinctrlbyname(int node, const char *config)
-{
- char *names;
- char *name;
- char *end;
- int id = 0;
- int len;
-
- if (!sitara_cm_sc)
- return -1;
-
- len = OF_getproplen(node, "pinctrl-names");
- if (len <= 0)
- printf("no pinctrl-names\n");
-
- names = malloc(len, M_TEMP, M_WAITOK);
- OF_getprop(node, "pinctrl-names", names, len);
- end = names + len;
- name = names;
- while (name < end) {
- if (strcmp(name, config) == 0) {
- free(names, M_TEMP, len);
- return sitara_cm_pinctrlbyid(node, id);
- }
- name += strlen(name) + 1;
- id++;
- }
- free(names, M_TEMP, len);
- return -1;
-}
-
-int
-sitara_cm_pinctrl(uint32_t phandle)
+sitara_cm_pinctrl(uint32_t phandle, void *cookie)
{
- struct sitara_cm_softc *sc = sitara_cm_sc;
+ struct sitara_cm_softc *sc = cookie;
uint32_t *pins;
int npins;
int node;
-/* $OpenBSD: sitara_cm.h,v 1.2 2016/07/17 02:45:05 jsg Exp $ */
+/* $OpenBSD: sitara_cm.h,v 1.3 2016/08/12 03:22:41 jsg Exp $ */
/* $NetBSD: sitara_cm.h,v 1.1 2013/04/17 14:31:02 bouyer Exp $ */
/*
* Copyright (c) 2010
void sitara_cm_padconf_get_gpioflags(uint32_t gpio, uint32_t *flags);
int sitara_cm_reg_read_4(uint32_t reg, uint32_t *val);
int sitara_cm_reg_write_4(uint32_t reg, uint32_t val);
-int sitara_cm_pinctrlbyid(int node, int id);
-int sitara_cm_pinctrlbyname(int node, const char *);
#endif /* _OMAP_SCM_H_ */
-/* $OpenBSD: ti_iic.c,v 1.8 2016/08/06 10:07:45 jsg Exp $ */
+/* $OpenBSD: ti_iic.c,v 1.9 2016/08/12 03:22:41 jsg Exp $ */
/* $NetBSD: ti_iic.c,v 1.4 2013/04/25 13:04:27 rkujawa Exp $ */
/*
#include <armv7/armv7/armv7var.h>
#include <armv7/omap/prcmvar.h>
#include <armv7/omap/ti_iicreg.h>
-#include <armv7/omap/sitara_cm.h>
#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_pinctrl.h>
#include <dev/ofw/fdt.h>
#ifndef AM335X_I2C_SLAVE_ADDR
faa->fa_reg[0].size, 0, &sc->sc_ioh))
panic("%s: bus_space_map failed!", DEVNAME(sc));
- sitara_cm_pinctrlbyname(faa->fa_node, "default");
+ pinctrl_byname(faa->fa_node, "default");
sc->sc_ih = arm_intr_establish_fdt(faa->fa_node, IPL_NET,
ti_iic_intr, sc, DEVNAME(sc));