macb: sync with linux and prepare for gmac support
cover macb: sync with linux and prepare for gmac support
HI,
The following changes since commit aff77ab814543ac61d0b3a00fcb6d1efefe24150:
Merge branch 'for-next/omap' into next (2013-01-28 08:29:48 +0100)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git delivery/macb
for you to fetch changes up to 7f3b3f22956d05718ab6a643afea26ada8c6d8c9:
macb: allow to pass the phy interface (2013-01-29 05:11:55 +0800)
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (2):
macb: sync register access and clock with the kernel
macb: allow to pass the phy interface
arch/arm/boards/at91rm9200ek/init.c | 2 +- arch/arm/boards/at91sam9260ek/init.c | 2 +- arch/arm/boards/at91sam9263ek/init.c | 2 +- arch/arm/boards/at91sam9m10g45ek/init.c | 2 +- arch/arm/boards/at91sam9x5ek/init.c | 2 +- arch/arm/boards/pm9263/init.c | 2 +- arch/arm/boards/pm9g45/init.c | 2 +- arch/arm/boards/qil-a9260/init.c | 2 +- arch/arm/boards/tny-a926x/init.c | 2 +- arch/arm/boards/usb-a926x/init.c | 2 +- arch/arm/mach-at91/at91rm9200_devices.c | 2 +- arch/arm/mach-at91/at91sam9260_devices.c | 2 +- arch/arm/mach-at91/at91sam9263_devices.c | 2 +- arch/arm/mach-at91/at91sam9g45_devices.c | 2 +- arch/arm/mach-at91/at91sam9x5_devices.c | 4 ++-- arch/arm/mach-at91/include/mach/board.h | 3 ++- drivers/net/at91_ether.c | 2 +- drivers/net/macb.c | 69 ++++++++++++++++++++++++++++++--------------------------------------- drivers/net/macb.h | 6 ++++++ 19 files changed, 55 insertions(+), 57 deletions(-)
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/2 macb: sync register access and clock with the kernel
--- drivers/net/macb.c | 63 ++++++++++++++++++++++------------------------------ drivers/net/macb.h | 6 +++++ 2 files changed, 33 insertions(+), 36 deletions(-)
drivers/net/macb.c +27 -36
@@ -121,7 +121,7 @@ static int macb_send(struct eth_device *edev, void *packet, macb->tx_ring[0 ].addr = (ulong )packet;barrier ();dma_flush_range ((ulong ) packet, (ulong )packet + length); -writel (MACB_BIT (TE ) |MACB_BIT (RE ) |MACB_BIT (TSTART ), macb->regs +MACB_NCR ); +macb_writel (macb,NCR ,MACB_BIT (TE ) |MACB_BIT (RE ) |MACB_BIT (TSTART ));wait_on_timeout (100 *MSECOND , !(macb->tx_ring[0 ].ctrl &TXBUF_USED ));
@@ -220,7 +220,7 @@ static void macb_adjust_link(struct eth_device *edev)struct macb_device *macb = edev->priv;u32 reg; - reg =readl (macb->regs +MACB_NCFGR ); + reg =macb_readl (macb,NCFGR ); reg &= ~(MACB_BIT (SPD ) |MACB_BIT (FD ));if (edev->phydev->duplex)
@@ -228,7 +228,7 @@ static void macb_adjust_link(struct eth_device *edev)if (edev->phydev->speed ==SPEED_100 ) reg |=MACB_BIT (SPD ); -writel (reg, macb->regs +MACB_NCFGR ); +macb_writel (macb,NCFGR , reg); }static int macb_open (struct eth_device *edev)
@@ -271,8 +271,8 @@ static int macb_init(struct eth_device *edev) macb->rx_tail = macb->tx_tail =0 ; -writel ((ulong )macb->rx_ring, macb->regs +MACB_RBQP ); -writel ((ulong )macb->tx_ring, macb->regs +MACB_TBQP ); +macb_writel (macb,RBQP , (ulong )macb->rx_ring); +macb_writel (macb,TBQP , (ulong )macb->tx_ring);if (macb->interface ==PHY_INTERFACE_MODE_RMII ) val |=MACB_BIT (RMII );
@@ -282,10 +282,10 @@ static int macb_init(struct eth_device *edev)#if defined(CONFIG_ARCH_AT91 ) val |=MACB_BIT (CLKEN );#endif -writel (val, macb->regs +MACB_USRIO ); +macb_writel (macb,USRIO , val);/* Enable TX and RX */ -writel (MACB_BIT (TE ) |MACB_BIT (RE ), macb->regs +MACB_NCR ); +macb_writel (macb,NCR ,MACB_BIT (TE ) |MACB_BIT (RE ));return 0 ; }
@@ -296,16 +296,16 @@ static void macb_halt(struct eth_device *edev)u32 ncr, tsr;/* Halt the controller and wait for any ongoing transmission to end. */ - ncr =readl (macb->regs +MACB_NCR ); + ncr =macb_readl (macb,NCR ); ncr |=MACB_BIT (THALT ); -writel (ncr, macb->regs +MACB_NCR ); +macb_writel (macb,NCR , ncr);do { - tsr =readl (macb->regs +MACB_TSR ); + tsr =macb_readl (macb,TSR ); }while (tsr &MACB_BIT (TGO ));/* Disable TX and RX, and clear statistics */ -writel (MACB_BIT (CLRSTAT ), macb->regs +MACB_NCR ); +macb_writel (macb,NCR ,MACB_BIT (CLRSTAT )); }static int macb_phy_read (struct mii_bus *bus,int addr,int reg)
@@ -320,32 +320,32 @@ static int macb_phy_read(struct mii_bus *bus, int addr, int reg)debug ("%s\n" , __func__); - netctl =readl (macb->regs +MACB_NCR ); + netctl =macb_readl (macb,NCR ); netctl |=MACB_BIT (MPE ); -writel (netctl, macb->regs +MACB_NCR ); +macb_writel (macb,NCR , netctl); frame = (MACB_BF (SOF ,1 ) |MACB_BF (RW ,2 ) |MACB_BF (PHYA , addr) |MACB_BF (REGA , reg) |MACB_BF (CODE ,2 )); -writel (frame, macb->regs +MACB_MAN ); +macb_writel (macb,MAN , frame); start =get_time_ns ();do { - netstat =readl (macb->regs +MACB_NSR ); + netstat =macb_readl (macb,NSR );if (is_timeout (start,SECOND )) {printf ("phy read timed out\n" );return -1 ; } }while (!(netstat &MACB_BIT (IDLE ))); - frame =readl (macb->regs +MACB_MAN ); + frame =macb_readl (macb,MAN ); value =MACB_BFEXT (DATA , frame); - netctl =readl (macb->regs +MACB_NCR ); + netctl =macb_readl (macb,NCR ); netctl &= ~MACB_BIT (MPE ); -writel (netctl, macb->regs +MACB_NCR ); +macb_writel (macb,NCR , netctl);return value; }
@@ -359,9 +359,9 @@ static int macb_phy_write(struct mii_bus *bus, int addr, int reg, u16 value)debug ("%s\n" , __func__); - netctl =readl (macb->regs +MACB_NCR ); + netctl =macb_readl (macb,NCR ); netctl |=MACB_BIT (MPE ); -writel (netctl, macb->regs +MACB_NCR ); +macb_writel (macb,NCR , netctl); frame = (MACB_BF (SOF ,1 ) | MACB_BF(RW, 1)
@@ -369,15 +369,15 @@ static int macb_phy_write(struct mii_bus *bus, int addr, int reg, u16 value) | MACB_BF(REGA, reg) |MACB_BF (CODE ,2 ) | MACB_BF(DATA, value)); -writel (frame, macb->regs +MACB_MAN ); +macb_writel (macb,MAN , frame);do { - netstat =readl (macb->regs +MACB_NSR ); + netstat =macb_readl (macb,NSR ); }while (!(netstat &MACB_BIT (IDLE ))); - netctl =readl (macb->regs +MACB_NCR ); + netctl =macb_readl (macb,NCR ); netctl &= ~MACB_BIT (MPE ); -writel (netctl, macb->regs +MACB_NCR ); +macb_writel (macb,NCR , netctl);return 0 ; }
@@ -396,9 +396,8 @@ static int macb_set_ethaddr(struct eth_device *edev, unsigned char *adr)debug ("%s\n" , __func__);/* set hardware address */ - -writel (adr[0 ] | adr[1 ] <<8 | adr[2 ] <<16 | adr[3 ] <<24 , macb->regs +MACB_SA1B ); -writel (adr[4 ] | adr[5 ] <<8 , macb->regs +MACB_SA1T ); +macb_writel (macb,SA1B , adr[0 ] | adr[1 ] <<8 | adr[2 ] <<16 | adr[3 ] <<24 ); +macb_writel (macb,SA1T , adr[4 ] | adr[5 ] <<8 );return 0 ; }
@@ -410,9 +409,7 @@ static int macb_probe(struct device_d *dev)unsigned long macb_hz;u32 ncfgr;struct at91_ether_platform_data *pdata; -#if defined(CONFIG_ARCH_AT91 )struct clk *pclk; -#endif if (!dev->platform_data) {printf ("macb: no platform_data\n" );
@@ -456,7 +453,6 @@ static int macb_probe(struct device_d *dev)* Do some basic initialization so that we at least can talk * to the PHY */ -#if defined(CONFIG_ARCH_AT91 ) pclk =clk_get (dev,"macb_clk" );if (IS_ERR (pclk)) {dev_err (dev,"no macb_clk\n" );
@@ -465,9 +461,6 @@ static int macb_probe(struct device_d *dev)clk_enable (pclk); macb_hz =clk_get_rate (pclk); -#else - macb_hz =get_macb_pclk_rate (0 ); -#endif if (macb_hz <20000000 ) ncfgr =MACB_BF (CLK ,MACB_CLK_DIV8 );else if (macb_hz <40000000 )
@@ -477,7 +470,7 @@ static int macb_probe(struct device_d *dev)else ncfgr =MACB_BF (CLK ,MACB_CLK_DIV64 ); -writel (ncfgr, macb->regs +MACB_NCFGR ); +macb_writel (macb,NCFGR , ncfgr);mdiobus_register (&macb->miibus);eth_register (edev);
@@ -496,6 +489,4 @@ static int macb_driver_init(void)platform_driver_register (&macb_driver);return 0 ; } -device_initcall (macb_driver_init); -
drivers/net/macb.h +6 -0
@@ -262,4 +262,10 @@ << MACB_##name##_OFFSET)) \ | MACB_BF(name,value)) +/* Register access macros */ +#define macb_readl (port,reg) \ + __raw_readl((port)->regs + MACB_##reg) +#define macb_writel (port,reg,value) \ + __raw_writel((value), (port)->regs + MACB_##reg) +#endif /* __DRIVERS_MACB_H__ */
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/2 macb: allow to pass the phy interface
as we will add later the GMAC IP verion support (GEM)
--- arch/arm/boards/at91rm9200ek/init.c | 2 +- arch/arm/boards/at91sam9260ek/init.c | 2 +- arch/arm/boards/at91sam9263ek/init.c | 2 +- arch/arm/boards/at91sam9m10g45ek/init.c | 2 +- arch/arm/boards/at91sam9x5ek/init.c | 2 +- arch/arm/boards/pm9263/init.c | 2 +- arch/arm/boards/pm9g45/init.c | 2 +- arch/arm/boards/qil-a9260/init.c | 2 +- arch/arm/boards/tny-a926x/init.c | 2 +- arch/arm/boards/usb-a926x/init.c | 2 +- arch/arm/mach-at91/at91rm9200_devices.c | 2 +- arch/arm/mach-at91/at91sam9260_devices.c | 2 +- arch/arm/mach-at91/at91sam9263_devices.c | 2 +- arch/arm/mach-at91/at91sam9g45_devices.c | 2 +- arch/arm/mach-at91/at91sam9x5_devices.c | 4 ++-- arch/arm/mach-at91/include/mach/board.h | 3 ++- drivers/net/at91_ether.c | 2 +- drivers/net/macb.c | 6 +++--- 18 files changed, 22 insertions(+), 21 deletions(-)
arch/arm/boards/at91rm9200ek/init.c +1 -1
@@ -33,7 +33,7 @@#include <spi/spi.h> static struct at91_ether_platform_data ether_pdata = { - .is_rmii =1 , + .phy_interface =PHY_INTERFACE_MODE_RMII , .phy_addr =0 , };
arch/arm/boards/at91sam9260ek/init.c +1 -1
@@ -127,7 +127,7 @@ static void ek_add_device_nand(void) }static struct at91_ether_platform_data macb_pdata = { - .is_rmii =1 , + .phy_interface =PHY_INTERFACE_MODE_RMII , .phy_addr =0 , };
arch/arm/boards/at91sam9263ek/init.c +1 -1
@@ -83,7 +83,7 @@ static void ek_add_device_nand(void) }static struct at91_ether_platform_data macb_pdata = { - .is_rmii =1 , + .phy_interface =PHY_INTERFACE_MODE_RMII , .phy_addr =0 , };
arch/arm/boards/at91sam9m10g45ek/init.c +1 -1
@@ -106,7 +106,7 @@ static void ek_add_device_nand(void) }static struct at91_ether_platform_data macb_pdata = { - .is_rmii =1 , + .phy_interface =PHY_INTERFACE_MODE_RMII , .phy_addr =0 , };
arch/arm/boards/at91sam9x5ek/init.c +1 -1
@@ -106,7 +106,7 @@ static void ek_add_device_nand(void) }static struct at91_ether_platform_data macb_pdata = { - .is_rmii =1 , + .phy_interface =PHY_INTERFACE_MODE_RMII , .phy_addr =0 , };
arch/arm/boards/pm9263/init.c +1 -1
@@ -89,7 +89,7 @@ static void pm_add_device_nand(void) }static struct at91_ether_platform_data macb_pdata = { - .is_rmii =1 , + .phy_interface =PHY_INTERFACE_MODE_RMII , .phy_addr =-1 , };
arch/arm/boards/pm9g45/init.c +1 -1
@@ -113,7 +113,7 @@ static void __init pm9g45_add_device_usbh(void) {}#endif static struct at91_ether_platform_data macb_pdata = { - .is_rmii =1 , + .phy_interface =PHY_INTERFACE_MODE_RMII , .phy_addr =0 , };
arch/arm/boards/qil-a9260/init.c +1 -1
@@ -78,7 +78,7 @@ static void qil_a9260_add_device_mci(void) {}#ifdef CONFIG_CALAO_MB_QIL_A9260 static struct at91_ether_platform_data macb_pdata = { - .is_rmii =1 , + .phy_interface =PHY_INTERFACE_MODE_RMII , .phy_addr =-1 , };
arch/arm/boards/tny-a926x/init.c +1 -1
@@ -113,7 +113,7 @@ static void tny_a9260_add_device_nand(void)#ifdef CONFIG_DRIVER_NET_MACB static struct at91_ether_platform_data macb_pdata = { - .is_rmii =1 , + .phy_interface =PHY_INTERFACE_MODE_RMII , .phy_addr =-1 , };
arch/arm/boards/usb-a926x/init.c +1 -1
@@ -113,7 +113,7 @@ static void usb_a9260_add_device_nand(void) }static struct at91_ether_platform_data macb_pdata = { - .is_rmii =1 , + .phy_interface =PHY_INTERFACE_MODE_RMII , .phy_addr =-1 , };
arch/arm/mach-at91/at91rm9200_devices.c +1 -1
@@ -103,7 +103,7 @@ void __init at91_add_device_eth(int id, struct at91_ether_platform_data *data)at91_set_A_periph (AT91_PIN_PA8 ,0 );/* ETXEN */ at91_set_A_periph (AT91_PIN_PA7 ,0 );/* ETXCK_EREFCK */ -if (!data->is_rmii) { +if (data->phy_interface !=PHY_INTERFACE_MODE_RMII ) {at91_set_B_periph (AT91_PIN_PB19 ,0 );/* ERXCK */ at91_set_B_periph (AT91_PIN_PB18 ,0 );/* ECOL */ at91_set_B_periph (AT91_PIN_PB17 ,0 );/* ERXDV */
arch/arm/mach-at91/at91sam9260_devices.c +1 -1
@@ -98,7 +98,7 @@ void at91_add_device_eth(int id, struct at91_ether_platform_data *data)at91_set_A_periph (AT91_PIN_PA21 ,0 );/* EMDIO */ at91_set_A_periph (AT91_PIN_PA20 ,0 );/* EMDC */ -if (!data->is_rmii) { +if (data->phy_interface !=PHY_INTERFACE_MODE_RMII ) {at91_set_B_periph (AT91_PIN_PA28 ,0 );/* ECRS */ at91_set_B_periph (AT91_PIN_PA29 ,0 );/* ECOL */ at91_set_B_periph (AT91_PIN_PA25 ,0 );/* ERX2 */
arch/arm/mach-at91/at91sam9263_devices.c +1 -1
@@ -97,7 +97,7 @@ void at91_add_device_eth(int id, struct at91_ether_platform_data *data)at91_set_A_periph (AT91_PIN_PE30 ,0 );/* EMDIO */ at91_set_A_periph (AT91_PIN_PE29 ,0 );/* EMDC */ -if (!data->is_rmii) { +if (data->phy_interface !=PHY_INTERFACE_MODE_RMII ) {at91_set_A_periph (AT91_PIN_PE22 ,0 );/* ECRS */ at91_set_B_periph (AT91_PIN_PC26 ,0 );/* ECOL */ at91_set_B_periph (AT91_PIN_PC22 ,0 );/* ERX2 */
arch/arm/mach-at91/at91sam9g45_devices.c +1 -1
@@ -99,7 +99,7 @@ void at91_add_device_eth(int id, struct at91_ether_platform_data *data)at91_set_A_periph (AT91_PIN_PA19 ,0 );/* EMDIO */ at91_set_A_periph (AT91_PIN_PA18 ,0 );/* EMDC */ -if (!data->is_rmii) { +if (data->phy_interface !=PHY_INTERFACE_MODE_RMII ) {at91_set_B_periph (AT91_PIN_PA29 ,0 );/* ECRS */ at91_set_B_periph (AT91_PIN_PA30 ,0 );/* ECOL */ at91_set_B_periph (AT91_PIN_PA8 ,0 );/* ERX2 */
arch/arm/mach-at91/at91sam9x5_devices.c +2 -2
@@ -111,7 +111,7 @@ void at91_add_device_eth(int id, struct at91_ether_platform_data *data)at91_set_A_periph (AT91_PIN_PB5 ,0 );/* EMDIO */ at91_set_A_periph (AT91_PIN_PB6 ,0 );/* EMDC */ -if (!data->is_rmii) { +if (data->phy_interface !=PHY_INTERFACE_MODE_RMII ) {at91_set_A_periph (AT91_PIN_PB16 ,0 );/* ECRS */ at91_set_A_periph (AT91_PIN_PB17 ,0 );/* ECOL */ at91_set_A_periph (AT91_PIN_PB13 ,0 );/* ERX2 */
@@ -124,7 +124,7 @@ void at91_add_device_eth(int id, struct at91_ether_platform_data *data)break ;case 1 : start =AT91SAM9X5_BASE_EMAC1 ; -if (!data->is_rmii) +if (data->phy_interface !=PHY_INTERFACE_MODE_RMII )pr_warn ("AT91: Only RMII available on interface macb%d.\n" , id);/* Pins used for RMII */
arch/arm/mach-at91/include/mach/board.h +2 -1
@@ -26,6 +26,7 @@#include <linux/mtd/mtd.h> #include <fb.h> #include <video/atmel_lcdc.h> +#include <linux/phy.h> /* USB Host */ struct at91_usbh_data {
@@ -74,7 +75,7 @@ struct at91_ether_platform_data {unsigned int phy_flags;unsigned int flags;int phy_addr; -int is_rmii; +phy_interface_t phy_interface;int (*get_ethaddr)(struct eth_device *,unsigned char *adr); };
drivers/net/at91_ether.c +1 -1
@@ -342,7 +342,7 @@ static int at91_ether_probe(struct device_d *dev) mac_cfg |=AT91_EMAC_CLK_DIV32 |AT91_EMAC_BIG ; -if (pdata->is_rmii) { +if (pdata->phy_interface ==PHY_INTERFACE_MODE_RMII ) { ether_dev->interface =PHY_INTERFACE_MODE_RGMII ; mac_cfg |=AT91_EMAC_RMII ; }else {
drivers/net/macb.c +3 -3
@@ -436,10 +436,10 @@ static int macb_probe(struct device_d *dev) macb->miibus.priv = macb; macb->miibus.parent = dev; -if (pdata->is_rmii) - macb->interface =PHY_INTERFACE_MODE_RMII ; -else +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) macb->interface =PHY_INTERFACE_MODE_MII ; +else + macb->interface = pdata->phy_interface; macb->phy_flags = pdata->phy_flags;
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
HI,
The following changes since commit
aff77ab814543ac61d0b3a00fcb6d1efefe24150:Merge branch 'for-next/omap' into next (2013-01-28 08:29:48 +0100)
are available in the git repository at:
git://git.jcrosoft.org/barebox.gitdelivery/macb
Applied, thanks
Sascha
Quoted 39 lines
for you to fetch changes up to
7f3b3f22956d05718ab6a643afea26ada8c6d8c9:macb: allow to pass the phy interface (2013-01-29 05:11:55 +0800)
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (2):
macb: sync register access and clock with the kernel
macb: allow to pass the phy interfacearch/arm/boards/at91rm9200ek/init.c | 2 +- arch/arm/boards/at91sam9260ek/init.c | 2 +- arch/arm/boards/at91sam9263ek/init.c | 2 +- arch/arm/boards/at91sam9m10g45ek/init.c | 2 +- arch/arm/boards/at91sam9x5ek/init.c | 2 +- arch/arm/boards/pm9263/init.c | 2 +- arch/arm/boards/pm9g45/init.c | 2 +- arch/arm/boards/qil-a9260/init.c | 2 +- arch/arm/boards/tny-a926x/init.c | 2 +- arch/arm/boards/usb-a926x/init.c | 2 +- arch/arm/mach-at91/at91rm9200_devices.c | 2 +- arch/arm/mach-at91/at91sam9260_devices.c | 2 +- arch/arm/mach-at91/at91sam9263_devices.c | 2 +- arch/arm/mach-at91/at91sam9g45_devices.c | 2 +- arch/arm/mach-at91/at91sam9x5_devices.c | 4 ++-- arch/arm/mach-at91/include/mach/board.h | 3 ++- drivers/net/at91_ether.c | 2 +- drivers/net/macb.c | 69 ++++++++++++++++++++++++++++++--------------------------------------- drivers/net/macb.h | 6 ++++++ 19 files changed, 55 insertions(+), 57 deletions(-)Best Regards,
J._______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox