From owner-svn-src-all@freebsd.org Tue Sep 1 21:30:53 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9044D37A284; Tue, 1 Sep 2020 21:30:53 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bh0cF1ndCz4LkF; Tue, 1 Sep 2020 21:30:52 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-il1-x142.google.com with SMTP id h11so2971102ilj.11; Tue, 01 Sep 2020 14:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-transfer-encoding; bh=n+FNW19uFYdsOaPTEUuqlzyxmv5suKlD0r3zziDciJw=; b=AphmAyXtkpBFjEzCff1gUogfbYD9bEnYrS2zN2VVpVsLicIUxC6pn5ZoUG2Jt2M6Sg 9ip9rl1gWAp1a/i2XyObIwpx15uZWBQI9wVKK+v2/iHkyRGvtOIOjW0InJrsCyr4Qi5o y7Qn3nadDjZsVgeEqMlt5BJ7Y0WEpbjrkHfL3qdiyEYbjB/Tt9/TG+IZ0+qadhjAbB09 uS7smwEQik05Z98H6Su9D/hRInSRTtCF2L8M1GYfjoFCneRvMqL4iYw5Fm6CDlJtV7ev QoZRvwxmoVNNI8FVuyGRFgLMgZ6KCRoYMNfWV6AtffdhvhR3ThtzbsvFYI6Zx4NhtKxY 1Piw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to :references:subject:mime-version:content-transfer-encoding; bh=n+FNW19uFYdsOaPTEUuqlzyxmv5suKlD0r3zziDciJw=; b=GGhbW5lTCzyIWSD72xvswsevRCjVdoqElOsL7a9REPORWkNKviKAsSlzI522DHKADE PtEElKAV2wiinNKt0YjOCwbjBImHy8jul5ZmdHslzrdyg+80vgGxJSNEMcZPxVN22vnh bdyiv8tGAeG/aOOS1vq1tp05NFxLE/wsRyAWPQHV3EuqPZnAdLDa3uyBSh4tEUG/sqpp CrnR7We4OKrKT8KMS/rzawxWnKOAW1XH2a2eyC6TNVUjzLIoLhuIWz3sT+JLu0OFSHdg 3MqpNplK3Gc8Q+UlBKRBKQA/W8bIN3/687IVpCmg8juJ4tJ97vIrGWJ9pzF45u6vAsax 1hCw== X-Gm-Message-State: AOAM531VJqJy4bAMF6G6yBIQs4fTGZOueSiAam6CnRMbfUWhGf3vFfMy 1ZIKnCbFpcFAhnC35nmqG+SwYwGrfOI= X-Google-Smtp-Source: ABdhPJy4W7FaGyqUegB7Jl5JibasV0D7orhqnnqDSjdoaVn6CaE9poPJtL3KGmSkVG42cujadSKNfQ== X-Received: by 2002:a92:d902:: with SMTP id s2mr894645iln.21.1598995851613; Tue, 01 Sep 2020 14:30:51 -0700 (PDT) Received: from [127.0.0.1] (173-19-125-130.client.mchsi.com. [173.19.125.130]) by smtp.gmail.com with ESMTPSA id e22sm1083599ioc.43.2020.09.01.14.30.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Sep 2020 14:30:51 -0700 (PDT) Date: Tue, 1 Sep 2020 21:30:48 +0000 (UTC) From: Justin Hibbits To: Marcin Wojtas Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: In-Reply-To: <202009011617.081GHL8e031671@repo.freebsd.org> References: <202009011617.081GHL8e031671@repo.freebsd.org> Subject: Re: svn commit: r365054 - in head/sys: conf dev/sdhci MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: X-Rspamd-Queue-Id: 4Bh0cF1ndCz4LkF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Sep 2020 21:30:53 -0000 Sep 1, 2020 11:17:35 Marcin Wojtas : > Author: mw > Date: Tue Sep=C2=A0 1 16:17:21 2020 > New Revision: 365054 > URL: https://svnweb.freebsd.org/changeset/base/365054 > > Log: > Introduce the SDHCI driver for NXP QorIQ Layerscape SoCs > > Implement support for an eSDHC controller found in NXP QorIQ Layerscape S= oCs. > > This driver has been tested with NXP LS1046A and LX2160A (Honeycomb board= ), > which is incompatible with the existing sdhci_fsl driver (aiming at older > chips from this family). As such, it is not intended as replacement for > the old driver, but rather serves as an improved alternative for SoCs tha= t > support it. > It comes with support for both PIO and Single DMA modes and samples the > clock from the extres clk API. How is it incompatible? > > Submitted by: Artur Rojek > Reviewed by: manu, mmel, kibab > Obtained from: Semihalf > Sponsored by: Alstom Group > Differential Revision: https://reviews.freebsd.org/D26153 > > Added: > head/sys/dev/sdhci/sdhci_fsl_fdt.c=C2=A0=C2=A0 (contents, props changed) The name choice here is odd, given there is already fsl_sdhci.c > Modified: > head/sys/conf/files > > Modified: head/sys/conf/files > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/conf/files Tue Sep=C2=A0 1 16:13:09 2020=C2=A0 (r365053) > +++ head/sys/conf/files Tue Sep=C2=A0 1 16:17:21 2020=C2=A0 (r365054) > @@ -3058,6 +3058,7 @@ dev/scc/scc_dev_z8530.c=C2=A0=C2=A0 optional scc > dev/sdhci/sdhci.c=C2=A0=C2=A0=C2=A0 optional sdhci > dev/sdhci/sdhci_fdt.c=C2=A0=C2=A0=C2=A0 optional sdhci fdt > dev/sdhci/sdhci_fdt_gpio.c optional sdhci fdt gpio > +dev/sdhci/sdhci_fsl_fdt.c=C2=A0 optional sdhci fdt gpio > dev/sdhci/sdhci_if.m=C2=A0=C2=A0 optional sdhci > dev/sdhci/sdhci_acpi.c=C2=A0=C2=A0 optional sdhci acpi > dev/sdhci/sdhci_pci.c=C2=A0=C2=A0=C2=A0 optional sdhci pci > > Added: head/sys/dev/sdhci/sdhci_fsl_fdt.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/sdhci/sdhci_fsl_fdt.c=C2=A0 Tue Sep=C2=A0 1 16:17:21 202= 0=C2=A0 (r365054) > @@ -0,0 +1,680 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2020 Alstom Group. > + * Copyright (c) 2020 Semihalf. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + *=C2=A0=C2=A0=C2=A0 notice, this list of conditions and the following d= isclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + *=C2=A0=C2=A0=C2=A0 notice, this list of conditions and the following d= isclaimer in the > + *=C2=A0=C2=A0=C2=A0 documentation and/or other materials provided with = the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AN= D > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU= RPOSE > + * ARE DISCLAIMED.=C2=A0 IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE= LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUE= NTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOO= DS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S= TRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY= WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O= F > + * SUCH DAMAGE. > + */ > + > +/* eSDHC controller driver for NXP QorIQ Layerscape SoCs. */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "mmcbr_if.h" > +#include "sdhci_if.h" > + > +#define=C2=A0 RD4 (sc->read) > +#define=C2=A0 WR4 (sc->write) > + > +#define=C2=A0 SDHCI_FSL_PRES_STATE=C2=A0=C2=A0=C2=A0 0x24 > +#define=C2=A0 SDHCI_FSL_PRES_SDSTB=C2=A0=C2=A0=C2=A0 (1 << 3) > +#define=C2=A0 SDHCI_FSL_PRES_COMPAT_MASK=C2=A0 0x000f0f07 > + > +#define=C2=A0 SDHCI_FSL_PROT_CTRL=C2=A0=C2=A0 0x28 > +#define=C2=A0 SDHCI_FSL_PROT_CTRL_WIDTH_1BIT=C2=A0 (0 << 1) > +#define=C2=A0 SDHCI_FSL_PROT_CTRL_WIDTH_4BIT=C2=A0 (1 << 1) > +#define=C2=A0 SDHCI_FSL_PROT_CTRL_WIDTH_8BIT=C2=A0 (2 << 1) > +#define=C2=A0 SDHCI_FSL_PROT_CTRL_WIDTH_MASK=C2=A0 (3 << 1) > +#define=C2=A0 SDHCI_FSL_PROT_CTRL_BYTE_SWAP (0 << 4) > +#define=C2=A0 SDHCI_FSL_PROT_CTRL_BYTE_NATIVE (2 << 4) > +#define=C2=A0 SDHCI_FSL_PROT_CTRL_BYTE_MASK (3 << 4) > +#define=C2=A0 SDHCI_FSL_PROT_CTRL_DMA_MASK=C2=A0 (3 << 8) > + > +#define=C2=A0 SDHCI_FSL_SYS_CTRL=C2=A0=C2=A0=C2=A0 0x2c > +#define=C2=A0 SDHCI_FSL_CLK_IPGEN=C2=A0=C2=A0 (1 << 0) > +#define=C2=A0 SDHCI_FSL_CLK_SDCLKEN=C2=A0=C2=A0 (1 << 3) > +#define=C2=A0 SDHCI_FSL_CLK_DIVIDER_MASK=C2=A0 0x000000f0 > +#define=C2=A0 SDHCI_FSL_CLK_DIVIDER_SHIFT 4 > +#define=C2=A0 SDHCI_FSL_CLK_PRESCALE_MASK 0x0000ff00 > +#define=C2=A0 SDHCI_FSL_CLK_PRESCALE_SHIFT=C2=A0 8 > + > +#define=C2=A0 SDHCI_FSL_WTMK_LVL=C2=A0=C2=A0=C2=A0 0x44 > +#define=C2=A0 SDHCI_FSL_WTMK_RD_512B=C2=A0=C2=A0=C2=A0 (0 << 0) > +#define=C2=A0 SDHCI_FSL_WTMK_WR_512B=C2=A0=C2=A0=C2=A0 (0 << 15) > + > +#define=C2=A0 SDHCI_FSL_HOST_VERSION=C2=A0=C2=A0=C2=A0 0xfc > +#define=C2=A0 SDHCI_FSL_CAPABILITIES2=C2=A0=C2=A0 0x114 > + > +#define=C2=A0 SDHCI_FSL_ESDHC_CTRL=C2=A0=C2=A0=C2=A0 0x40c > +#define=C2=A0 SDHCI_FSL_ESDHC_CTRL_SNOOP=C2=A0 (1 << 6) > +#define=C2=A0 SDHCI_FSL_ESDHC_CTRL_CLK_DIV2 (1 << 19) > + > +struct sdhci_fsl_fdt_softc { > + device_t=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev; > + const struct sdhci_fsl_fdt_soc_data *soc_data; > + struct resource=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *mem_res; > + struct resource=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *irq_res; > + void=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *irq_cookie; > + uint32_t=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 baseclk_hz; > + struct sdhci_fdt_gpio=C2=A0=C2=A0=C2=A0=C2=A0 *gpio; > + struct sdhci_slot=C2=A0=C2=A0=C2=A0=C2=A0 slot; > + bool=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 slot_init_do= ne; > + uint32_t=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cmd_and_mode; > + uint16_t=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sdclk_bits; > + > + uint32_t (* read)(struct sdhci_fsl_fdt_softc *, bus_size_t); > + void (* write)(struct sdhci_fsl_fdt_softc *, bus_size_t, uint32_t); > +}; > + > +struct sdhci_fsl_fdt_soc_data { > + int quirks; > +}; > + > +static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_ls1046a_soc_dat= a =3D { > + .quirks =3D SDHCI_QUIRK_DONT_SET_HISPD_BIT | SDHCI_QUIRK_BROKEN_AUTO_ST= OP > +}; > + > +static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_gen_data =3D { > + .quirks =3D 0, > +}; > + > +static const struct ofw_compat_data sdhci_fsl_fdt_compat_data[] =3D { > + {"fsl,ls1046a-esdhc", (uintptr_t)&sdhci_fsl_fdt_ls1046a_soc_data}, > + {"fsl,esdhc",=C2=A0=C2=A0 (uintptr_t)&sdhci_fsl_fdt_gen_data}, > + {NULL,=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0} > +}; The existing driver is compatible with fsl,esdhc.=C2=A0 How are you prevent= ing collisions? Why couldn't you make these changes to the existing driver?=C2=A0 I see som= e improvements in this one that would be nice to have in the other driver. - Justin