From: Jamie Iles <jamie@jamieiles.com> To: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: plagnioj@jcrosoft.com, Jamie Iles <jamie@jamieiles.com> Subject: [PATCHv3 8/9] macb: support DMA bus widths > 32 bits Date: Tue, 9 Aug 2011 10:16:50 +0100 [thread overview] Message-ID: <1312881411-2376-9-git-send-email-jamie@jamieiles.com> (raw) In-Reply-To: <1312881411-2376-1-git-send-email-jamie@jamieiles.com> Some GEM implementations may support DMA bus widths up to 128 bits. We can get the maximum supported DMA bus width from the design configuration register so use that to program the device up. Signed-off-by: Jamie Iles <jamie@jamieiles.com> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- drivers/net/macb.c | 23 +++++++++++++++++++++++ drivers/net/macb.h | 19 +++++++++++++++++++ 2 files changed, 42 insertions(+), 0 deletions(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 0e35804..a8a9b4b 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -836,6 +836,27 @@ static u32 macb_mdc_clk_div(struct macb *bp) return config; } +/* + * Get the DMA bus width field of the network configuration register that we + * should program. We find the width from decoding the design configuration + * register to find the maximum supported data bus width. + */ +static u32 macb_dbw(struct macb *bp) +{ + if (!macb_is_gem(bp)) + return 0; + + switch (GEM_BFEXT(DBWDEF, gem_readl(bp, DCFG1))) { + case 4: + return GEM_BF(DBW, GEM_DBW128); + case 2: + return GEM_BF(DBW, GEM_DBW64); + case 1: + default: + return GEM_BF(DBW, GEM_DBW32); + } +} + static void macb_init_hw(struct macb *bp) { u32 config; @@ -851,6 +872,7 @@ static void macb_init_hw(struct macb *bp) config |= MACB_BIT(CAF); /* Copy All Frames */ if (!(bp->dev->flags & IFF_BROADCAST)) config |= MACB_BIT(NBC); /* No BroadCast */ + config |= macb_dbw(bp); macb_writel(bp, NCFGR, config); /* Initialize TX and RX buffers */ @@ -1277,6 +1299,7 @@ static int __init macb_probe(struct platform_device *pdev) /* Set MII management clock divider */ config = macb_mdc_clk_div(bp); + config |= macb_dbw(bp); macb_writel(bp, NCFGR, config); macb_get_hwaddr(bp); diff --git a/drivers/net/macb.h b/drivers/net/macb.h index 1367b92..71424aa 100644 --- a/drivers/net/macb.h +++ b/drivers/net/macb.h @@ -69,6 +69,13 @@ #define GEM_SA1B 0x0088 #define GEM_SA1T 0x008C #define GEM_OTX 0x0100 +#define GEM_DCFG1 0x0280 +#define GEM_DCFG2 0x0284 +#define GEM_DCFG3 0x0288 +#define GEM_DCFG4 0x028c +#define GEM_DCFG5 0x0290 +#define GEM_DCFG6 0x0294 +#define GEM_DCFG7 0x0298 /* Bitfields in NCR */ #define MACB_LB_OFFSET 0 @@ -139,6 +146,14 @@ /* GEM specific NCFGR bitfields. */ #define GEM_CLK_OFFSET 18 #define GEM_CLK_SIZE 3 +#define GEM_DBW_OFFSET 21 +#define GEM_DBW_SIZE 2 + +/* Constants for data bus width. */ +#define GEM_DBW32 0 +#define GEM_DBW64 1 +#define GEM_DBW128 2 + /* Bitfields in NSR */ #define MACB_NSR_LINK_OFFSET 0 #define MACB_NSR_LINK_SIZE 1 @@ -247,6 +262,10 @@ #define MACB_REV_OFFSET 0 #define MACB_REV_SIZE 16 +/* Bitfields in DCFG1. */ +#define GEM_DBWDEF_OFFSET 25 +#define GEM_DBWDEF_SIZE 3 + /* Constants for CLK */ #define MACB_CLK_DIV8 0 #define MACB_CLK_DIV16 1 -- 1.7.4.1
WARNING: multiple messages have this Message-ID (diff)
From: jamie@jamieiles.com (Jamie Iles) To: linux-arm-kernel@lists.infradead.org Subject: [PATCHv3 8/9] macb: support DMA bus widths > 32 bits Date: Tue, 9 Aug 2011 10:16:50 +0100 [thread overview] Message-ID: <1312881411-2376-9-git-send-email-jamie@jamieiles.com> (raw) In-Reply-To: <1312881411-2376-1-git-send-email-jamie@jamieiles.com> Some GEM implementations may support DMA bus widths up to 128 bits. We can get the maximum supported DMA bus width from the design configuration register so use that to program the device up. Signed-off-by: Jamie Iles <jamie@jamieiles.com> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- drivers/net/macb.c | 23 +++++++++++++++++++++++ drivers/net/macb.h | 19 +++++++++++++++++++ 2 files changed, 42 insertions(+), 0 deletions(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 0e35804..a8a9b4b 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -836,6 +836,27 @@ static u32 macb_mdc_clk_div(struct macb *bp) return config; } +/* + * Get the DMA bus width field of the network configuration register that we + * should program. We find the width from decoding the design configuration + * register to find the maximum supported data bus width. + */ +static u32 macb_dbw(struct macb *bp) +{ + if (!macb_is_gem(bp)) + return 0; + + switch (GEM_BFEXT(DBWDEF, gem_readl(bp, DCFG1))) { + case 4: + return GEM_BF(DBW, GEM_DBW128); + case 2: + return GEM_BF(DBW, GEM_DBW64); + case 1: + default: + return GEM_BF(DBW, GEM_DBW32); + } +} + static void macb_init_hw(struct macb *bp) { u32 config; @@ -851,6 +872,7 @@ static void macb_init_hw(struct macb *bp) config |= MACB_BIT(CAF); /* Copy All Frames */ if (!(bp->dev->flags & IFF_BROADCAST)) config |= MACB_BIT(NBC); /* No BroadCast */ + config |= macb_dbw(bp); macb_writel(bp, NCFGR, config); /* Initialize TX and RX buffers */ @@ -1277,6 +1299,7 @@ static int __init macb_probe(struct platform_device *pdev) /* Set MII management clock divider */ config = macb_mdc_clk_div(bp); + config |= macb_dbw(bp); macb_writel(bp, NCFGR, config); macb_get_hwaddr(bp); diff --git a/drivers/net/macb.h b/drivers/net/macb.h index 1367b92..71424aa 100644 --- a/drivers/net/macb.h +++ b/drivers/net/macb.h @@ -69,6 +69,13 @@ #define GEM_SA1B 0x0088 #define GEM_SA1T 0x008C #define GEM_OTX 0x0100 +#define GEM_DCFG1 0x0280 +#define GEM_DCFG2 0x0284 +#define GEM_DCFG3 0x0288 +#define GEM_DCFG4 0x028c +#define GEM_DCFG5 0x0290 +#define GEM_DCFG6 0x0294 +#define GEM_DCFG7 0x0298 /* Bitfields in NCR */ #define MACB_LB_OFFSET 0 @@ -139,6 +146,14 @@ /* GEM specific NCFGR bitfields. */ #define GEM_CLK_OFFSET 18 #define GEM_CLK_SIZE 3 +#define GEM_DBW_OFFSET 21 +#define GEM_DBW_SIZE 2 + +/* Constants for data bus width. */ +#define GEM_DBW32 0 +#define GEM_DBW64 1 +#define GEM_DBW128 2 + /* Bitfields in NSR */ #define MACB_NSR_LINK_OFFSET 0 #define MACB_NSR_LINK_SIZE 1 @@ -247,6 +262,10 @@ #define MACB_REV_OFFSET 0 #define MACB_REV_SIZE 16 +/* Bitfields in DCFG1. */ +#define GEM_DBWDEF_OFFSET 25 +#define GEM_DBWDEF_SIZE 3 + /* Constants for CLK */ #define MACB_CLK_DIV8 0 #define MACB_CLK_DIV16 1 -- 1.7.4.1
next prev parent reply other threads:[~2011-08-09 9:18 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-08-09 9:16 [PATCHv3 0/9] macb: add support for Cadence GEM Jamie Iles 2011-08-09 9:16 ` Jamie Iles 2011-08-09 9:16 ` [PATCHv3 1/9] at91: provide macb clks with "pclk" and "hclk" name Jamie Iles 2011-08-09 9:16 ` Jamie Iles 2011-08-09 14:49 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:49 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:51 ` [PATCH 1/9 v4] " Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:51 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 9:16 ` [PATCHv3 2/9] macb: remove conditional clk handling Jamie Iles 2011-08-09 9:16 ` Jamie Iles 2011-08-09 14:52 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:52 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 9:16 ` [PATCHv3 3/9] macb: unify at91 and avr32 platform data Jamie Iles 2011-08-09 9:16 ` Jamie Iles 2011-08-09 14:53 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:53 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 9:16 ` [PATCHv3 4/9] macb: convert printk to netdev_ and friends Jamie Iles 2011-08-09 9:16 ` Jamie Iles 2011-08-09 20:20 ` Joe Perches 2011-08-09 20:20 ` Joe Perches 2011-08-11 9:01 ` Jamie Iles 2011-08-11 9:01 ` Jamie Iles 2011-08-09 9:16 ` [PATCHv3 5/9] macb: initial support for Cadence GEM Jamie Iles 2011-08-09 9:16 ` Jamie Iles 2011-08-09 14:55 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:55 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 9:16 ` [PATCHv3 6/9] macb: support higher rate GEM MDIO clock divisors Jamie Iles 2011-08-09 9:16 ` Jamie Iles 2011-08-09 14:56 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:56 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 9:16 ` [PATCHv3 7/9] macb: support statistics for GEM devices Jamie Iles 2011-08-09 9:16 ` Jamie Iles 2011-08-09 14:57 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:57 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 9:16 ` Jamie Iles [this message] 2011-08-09 9:16 ` [PATCHv3 8/9] macb: support DMA bus widths > 32 bits Jamie Iles 2011-08-09 14:57 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:57 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 9:16 ` [PATCHv3 9/9] macb: allow GEM to have configurable receive buffer size Jamie Iles 2011-08-09 9:16 ` Jamie Iles 2011-08-09 14:59 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:59 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:59 ` [PATCHv3 0/9] macb: add support for Cadence GEM Jean-Christophe PLAGNIOL-VILLARD 2011-08-09 14:59 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-11 9:21 ` Jamie Iles 2011-08-11 9:21 ` Jamie Iles 2011-08-23 9:34 ` Jamie Iles 2011-08-23 9:34 ` Jamie Iles 2011-08-28 6:08 ` Jean-Christophe PLAGNIOL-VILLARD 2011-08-28 6:08 ` Jean-Christophe PLAGNIOL-VILLARD
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1312881411-2376-9-git-send-email-jamie@jamieiles.com \ --to=jamie@jamieiles.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=netdev@vger.kernel.org \ --cc=plagnioj@jcrosoft.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.