{"id":209,"url":"http://patchwork.ozlabs.org/api/1.1/patches/209/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/e22122be022eb8d93b4eead4d9967769a4a139a6.1220877899.git.jwboyer@linux.vnet.ibm.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.1/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/"},"msgid":"<e22122be022eb8d93b4eead4d9967769a4a139a6.1220877899.git.jwboyer@linux.vnet.ibm.com>","date":"2008-09-04T14:03:45","name":"ibm_newemac: Introduce mal_has_feature","commit_ref":"ec4f9945b5b3e9e491a04eb1efe1c959371fa6de","pull_url":null,"state":"accepted","archived":true,"hash":"38439111dd211ce23f2b26ab9eb47055bfaac6e9","submitter":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.1/people/8/?format=json","name":"Josh Boyer","email":"jwboyer@linux.vnet.ibm.com"},"delegate":{"id":11,"url":"http://patchwork.ozlabs.org/api/1.1/users/11/?format=json","username":"jwboyer","first_name":"Josh","last_name":"Boyer","email":"jwboyer@gmail.com"},"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/e22122be022eb8d93b4eead4d9967769a4a139a6.1220877899.git.jwboyer@linux.vnet.ibm.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/209/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/209/checks/","tags":{},"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org>","X-Original-To":["patchwork@ozlabs.org","linuxppc-dev@ozlabs.org"],"Delivered-To":["patchwork@ozlabs.org","linuxppc-dev@ozlabs.org"],"Received":["from ozlabs.org (localhost [127.0.0.1])\n\tby ozlabs.org (Postfix) with ESMTP id 5F2E7DE296\n\tfor <patchwork@ozlabs.org>; Mon,  8 Sep 2008 23:05:24 +1000 (EST)","from py-out-1112.google.com (py-out-1112.google.com\n\t[64.233.166.182]) by ozlabs.org (Postfix) with ESMTP id C314ADDED8\n\tfor <linuxppc-dev@ozlabs.org>; Mon,  8 Sep 2008 23:04:38 +1000 (EST)","by py-out-1112.google.com with SMTP id a29so928314pyi.27\n\tfor <linuxppc-dev@ozlabs.org>; Mon, 08 Sep 2008 06:04:37 -0700 (PDT)","by 10.65.116.10 with SMTP id t10mr31356337qbm.68.1220879077086;\n\tMon, 08 Sep 2008 06:04:37 -0700 (PDT)","from ?192.168.1.101? ( [24.247.237.59])\n\tby mx.google.com with ESMTPS id k7sm5548151qba.3.2008.09.08.06.04.35\n\t(version=TLSv1/SSLv3 cipher=RC4-MD5);\n\tMon, 08 Sep 2008 06:04:36 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; \n\th=domainkey-signature:received:received:message-id:in-reply-to\n\t:references:from:date:subject:to:cc:mime-version:x-mailer\n\t:content-transfer-encoding:sender;\n\tbh=zcWwsrWosjifIR/uuevmM4QDAcSurwyTVF/OZuYhR48=;\n\tb=Muh3gQNfxU3AQZnR0/QBK7aKrx/NHAZlnslifmL4b7TJ5lnJg5sJyJSivvhEpwVgO7\n\t3REMzFYP6ChhTc3vcSuWSRVPlfreqHVz7Sxue7n3gAhfMg1QfB4RN0pcthmgY1nw4YNs\n\t2OPuO7vFfzcln8o7u5oe/mnTJ15ByTUpvAXBU=","DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\n\th=message-id:in-reply-to:references:from:date:subject:to:cc\n\t:mime-version:x-mailer:content-transfer-encoding:sender;\n\tb=Zjj8NF6K4DqvjHMWufioLtb2KO1/3vG8c5qv0Pm1B32/xEqSTI5K0fEApfE40BWP6g\n\tEEEwudsB/VpAuLJ52wGhmAHfWRFHCilRyFozDprlYjC0TRpY/rZoDM1s+4aZIgHvoMj7\n\tlkpsq/JfMJbaCfLtDxKBGFR7L7ibyip+E8CvI=","Message-Id":"<e22122be022eb8d93b4eead4d9967769a4a139a6.1220877899.git.jwboyer@linux.vnet.ibm.com>","In-Reply-To":"<cover.1220877899.git.jwboyer@linux.vnet.ibm.com>","References":"<cover.1220877899.git.jwboyer@linux.vnet.ibm.com>","From":"Josh Boyer <jwboyer@linux.vnet.ibm.com>","Date":"Thu, 4 Sep 2008 10:03:45 -0400","Subject":"[PATCH 2/3 v2] ibm_newemac: Introduce mal_has_feature","To":"benh@kernel.crashing.org, netdev@vger.kernel.org","Mime-Version":"1.0","X-Mailer":"Evolution 2.22.3.1 (2.22.3.1-1.fc9) ","Cc":"linuxppc-dev@ozlabs.org","X-BeenThere":"linuxppc-dev@ozlabs.org","X-Mailman-Version":"2.1.11","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List <linuxppc-dev.ozlabs.org>","List-Unsubscribe":"<https://ozlabs.org/mailman/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=unsubscribe>","List-Archive":"<http://ozlabs.org/pipermail/linuxppc-dev>","List-Post":"<mailto:linuxppc-dev@ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@ozlabs.org?subject=help>","List-Subscribe":"<https://ozlabs.org/mailman/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org","Errors-To":"linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org"},"content":"There are some PowerPC SoCs that do odd things with the MAL handling.  In\norder to accommodate them, we need to introduce a feature mechanism that is\nsimilar to the existing emac_has_feature function.\n\nThis adds a feature variable to the mal_instance structure, and adds a\nmal_has_feature function.  Two features are defined and are guarded\nby Kconfig options that are selected by the affected platforms.\n\nMAL_FTR_CLEAR_ICINSTAT is used for platforms that need to clear the\ninterrupt bits in the ICINTSTAT SDR for txeob/rxeob.  This is common\non MAL implementations that have interrupt coalescing.\n\nMAL_FTR_COMMON_ERR_INT is used for platforms that have SERR, TXDE,\nand RXDE OR'd into a single interrupt bit.\n\nSigned-of-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>","diff":"diff --git a/drivers/net/ibm_newemac/Kconfig b/drivers/net/ibm_newemac/Kconfig\nindex dfb6547..44e5a0e 100644\n--- a/drivers/net/ibm_newemac/Kconfig\n+++ b/drivers/net/ibm_newemac/Kconfig\n@@ -66,3 +66,11 @@ config IBM_NEW_EMAC_EMAC4\n config IBM_NEW_EMAC_NO_FLOW_CTRL\n \tbool\n \tdefault n\n+\n+config IBM_NEW_EMAC_MAL_CLR_ICINTSTAT\n+\tbool\n+\tdefault n\n+\n+config IBM_NEW_EMAC_MAL_COMMON_ERR\n+\tbool\n+\tdefault n\ndiff --git a/drivers/net/ibm_newemac/mal.h b/drivers/net/ibm_newemac/mal.h\nindex eaa7262..0b24138 100644\n--- a/drivers/net/ibm_newemac/mal.h\n+++ b/drivers/net/ibm_newemac/mal.h\n@@ -213,6 +213,8 @@ struct mal_instance {\n \tstruct of_device\t*ofdev;\n \tint\t\t\tindex;\n \tspinlock_t\t\tlock;\n+\n+\tunsigned int features;\n };\n \n static inline u32 get_mal_dcrn(struct mal_instance *mal, int reg)\n@@ -225,6 +227,38 @@ static inline void set_mal_dcrn(struct mal_instance *mal, int reg, u32 val)\n \tdcr_write(mal->dcr_host, reg, val);\n }\n \n+/* Features of various MAL implementations */\n+\n+/* Set if you have interrupt coalescing and you have to clear the SDR\n+ * register for TXEOB and RXEOB interrupts to work\n+ */\n+#define MAL_FTR_CLEAR_ICINTSTAT\t0x00000001\n+\n+/* Set if your MAL has SERR, TXDE, and RXDE OR'd into a single UIC\n+ * interrupt\n+ */\n+#define MAL_FTR_COMMON_ERR_INT\t0x00000002\n+\n+enum {\n+\tMAL_FTRS_ALWAYS = 0,\n+\n+\tMAL_FTRS_POSSIBLE =\n+#ifdef CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT\n+\t\tMAL_FTR_CLEAR_ICINTSTAT |\n+#endif\n+#ifdef CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR\n+\t\tMAL_FTR_COMMON_ERR_INT |\n+#endif\n+\t\t0,\n+};\n+\n+static inline int mal_has_feature(struct mal_instance *dev,\n+\t\tunsigned long feature)\n+{\n+\treturn (MAL_FTRS_ALWAYS & feature) ||\n+\t\t(MAL_FTRS_POSSIBLE & dev->features & feature);\n+}\n+\n /* Register MAL devices */\n int mal_init(void);\n void mal_exit(void);\n","prefixes":[]}