at91: Convert Ethernet and LCD to driver model
Subsystems (14)
v2 cover at91: Convert Ethernet and LCD to driver model
This series is mainly designed to move the macb Ethernet to driver model, along with the LCD controller. It also includes a few fixes:
- NAND with ECC doesn't build properly
- The instruction cache is off by default
- Ethernet macb doesn't send packets when the cache is enabled
A Snapper 9G45-based board is used for this work. It includes an AT91SAM9G45 CPU so is a good test of driver model on this chip.
Changes in v2:
- Correct commit author in several cases
- Rebase to master
Andre Renaud (7):
at91: Add support for the AT91 slow clock controller
net: Handle an empty bootp extension section
arm: at91: Add a header file for the real-time clock
at91: Correct NAND ECC register access
at91: nand: Set up the ECC strength correctly
mtd: nand: Drop a blank line in nand_wait()
arm: at91: Add support for gurnard
Simon Glass (11):
arm: Allow skipping of low-level init with I-cache on
bootm: Align cache flush end address correctly
net: macb: Prepare for driver-model conversion
net: macb: Flush correct cache portion when sending
net: macb: Convert to driver model
arm: at91: dts: Bring in device tree file for AT91SAM9G45
at91: Add driver-model GPIO devices for AT91SAM9G45
at91: mtd: nand: Add dev_warn() to correct build error in driver
at91: video: Prepare for driver-model conversion
at91: video: Support driver-model for the LCD driver
fdt: Correct return value in fdtdec_decode_display_timing()
README | 5 + arch/arm/cpu/arm1136/start.S | 2 + arch/arm/cpu/arm920t/start.S | 3 +- arch/arm/cpu/arm926ejs/start.S | 2 + arch/arm/cpu/arm946es/start.S | 2 + arch/arm/cpu/armv7/start.S | 5 +- arch/arm/cpu/sa1100/start.S | 2 + arch/arm/dts/Makefile | 1 + arch/arm/dts/at91sam9g45-gurnard.dts | 157 ++ arch/arm/dts/at91sam9g45.dtsi | 1335 ++++++++++ arch/arm/mach-at91/Kconfig | 9 + .../mach-at91/arm926ejs/at91sam9m10g45_devices.c | 18 + arch/arm/mach-at91/include/mach/at91_rtc.h | 71 + arch/arm/mach-at91/include/mach/at91_sck.h | 21 + arch/arm/mach-at91/include/mach/at91sam9g45.h | 1 + board/bluewater/gurnard/Kconfig | 12 + board/bluewater/gurnard/MAINTAINERS | 6 + board/bluewater/gurnard/Makefile | 11 + board/bluewater/gurnard/gurnard.c | 449 ++++ board/bluewater/gurnard/splash_logo.h | 2619 ++++++++++++++++++++ common/bootm.c | 2 +- configs/gurnard_defconfig | 19 + drivers/mtd/nand/atmel_nand.c | 7 +- drivers/mtd/nand/nand_base.c | 1 - drivers/net/macb.c | 320 ++- drivers/video/atmel_lcdfb.c | 197 +- include/atmel_lcd.h | 9 + include/configs/snapper9g45.h | 156 ++ include/dt-bindings/clock/at91.h | 23 + include/dt-bindings/dma/at91.h | 52 + include/dt-bindings/pinctrl/at91.h | 40 + lib/fdtdec.c | 2 +- net/bootp.c | 9 + 33 files changed, 5449 insertions(+), 119 deletions(-) create mode 100644 arch/arm/dts/at91sam9g45-gurnard.dts create mode 100644 arch/arm/dts/at91sam9g45.dtsi create mode 100644 arch/arm/mach-at91/include/mach/at91_rtc.h create mode 100644 arch/arm/mach-at91/include/mach/at91_sck.h create mode 100644 board/bluewater/gurnard/Kconfig create mode 100644 board/bluewater/gurnard/MAINTAINERS create mode 100644 board/bluewater/gurnard/Makefile create mode 100644 board/bluewater/gurnard/gurnard.c create mode 100644 board/bluewater/gurnard/splash_logo.h create mode 100644 configs/gurnard_defconfig create mode 100644 include/configs/snapper9g45.h create mode 100644 include/dt-bindings/clock/at91.h create mode 100644 include/dt-bindings/dma/at91.h create mode 100644 include/dt-bindings/pinctrl/at91.h
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 1/18 at91: Add support for the AT91 slow clock controller
From: Andre Renaud <[email protected]>
This is available on AT91SAM9G45. Add the peripheral address and flag definitions.
---
Changes in v2: None
arch/arm/mach-at91/include/mach/at91_sck.h | 21 +++++++++++++++++++++ arch/arm/mach-at91/include/mach/at91sam9g45.h | 1 + 2 files changed, 22 insertions(+) create mode 100644 arch/arm/mach-at91/include/mach/at91_sck.h
arch/arm/mach-at91/include/mach/at91_sck.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright (C) 2016 Google, Inc +* Written by Simon Glass <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef AT91_SCK_H +#define AT91_SCK_H + +/* +* SCKCR flags +*/ +#define AT91SAM9G45_SCKCR_RCEN (1 << 0)/* RC Oscillator Enable */ +#define AT91SAM9G45_SCKCR_OSC32EN (1 << 1)/* 32kHz Oscillator Enable */ +#define AT91SAM9G45_SCKCR_OSC32BYP (1 << 2)/* 32kHz Oscillator Bypass */ +#define AT91SAM9G45_SCKCR_OSCSEL (1 << 3)/* Slow Clock Selector */ +#define AT91SAM9G45_SCKCR_OSCSEL_RC (0 << 3) +#define AT91SAM9G45_SCKCR_OSCSEL_32 (1 << 3) + +#endif
arch/arm/mach-at91/include/mach/at91sam9g45.h +1 -0
@@ -109,6 +109,7 @@#define ATMEL_BASE_RTT 0xfffffd20#define ATMEL_BASE_PIT 0xfffffd30#define ATMEL_BASE_WDT 0xfffffd40 +#define ATMEL_BASE_SCKCR 0xfffffd50#define ATMEL_BASE_GPBR 0xfffffd60#define ATMEL_BASE_RTC 0xfffffdb0/* Reserved: 0xfffffdc0 - 0xffffffff */
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 2/18 arm: Allow skipping of low-level init with I-cache on
In reply to Simon GlassAt present CONFIG_SKIP_LOWLEVEL_INIT prevents U-Boot from calling lowlevel_init(). This means that the instruction cache is not enabled and the board runs very slowly.
What is really needed in many cases is to skip the call to lowlevel_init() but still perform CP15 init. Add an option to handle this.
Tested-on: smartweb, corvus, taurus, axm
---
Changes in v2: None
README | 5 +++++ arch/arm/cpu/arm1136/start.S | 2 ++ arch/arm/cpu/arm920t/start.S | 3 ++- arch/arm/cpu/arm926ejs/start.S | 2 ++ arch/arm/cpu/arm946es/start.S | 2 ++ arch/arm/cpu/armv7/start.S | 5 ++++- arch/arm/cpu/sa1100/start.S | 2 ++ 7 files changed, 19 insertions(+), 2 deletions(-)
README +5 -0
@@ -4829,6 +4829,11 @@ Low Level (hardware related) configuration options: other boot loader or by a debugger which performs these initializations itself. +- CONFIG_SKIP_LOWLEVEL_INIT_ONLY + [ARM926EJ-S only] This allows just the call to lowlevel_init() + to be skipped. The normal CPU15 init (such as enabling the + instruction cache) is still performed. + - CONFIG_SPL_BUILD Modifies the behaviour of start.S when compiling a loader that is executed before the actual U-Boot. E.g. when
arch/arm/cpu/arm1136/start.S +2 -0
@@ -82,6 +82,7 @@ cpu_init_crit: orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache mcr p15, 0, r0, c1, c0, 0 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY /* * Jump to board specific initialization... The Mask ROM will have already initialized * basic memory. Go here to bump up clock rate and handle wake up conditions.
@@ -89,5 +90,6 @@ cpu_init_crit: mov ip, lr /* persevere link reg across call */ bl lowlevel_init /* go setup pll,mux,memory */ mov lr, ip /* restore link */ +#endif mov pc, lr /* back to my caller */ #endif /* CONFIG_SKIP_LOWLEVEL_INIT */
arch/arm/cpu/arm920t/start.S +2 -1
@@ -135,6 +135,7 @@ cpu_init_crit: orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache mcr p15, 0, r0, c1, c0, 0 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY /* * before relocating, we have to setup RAM timing * because memory timing is board-dependend, you will
@@ -143,7 +144,7 @@ cpu_init_crit: mov ip, lr bl lowlevel_init - mov lr, ip +#endif mov pc, lr #endif /* CONFIG_SKIP_LOWLEVEL_INIT */
arch/arm/cpu/arm926ejs/start.S +2 -0
@@ -101,11 +101,13 @@ flush_dcache: #endif mcr p15, 0, r0, c1, c0, 0 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY /* * Go setup Memory and board specific bits prior to relocation. */ mov ip, lr /* perserve link reg across call */ bl lowlevel_init /* go setup pll,mux,memory */ mov lr, ip /* restore link */ +#endif mov pc, lr /* back to my caller */ #endif /* CONFIG_SKIP_LOWLEVEL_INIT */
arch/arm/cpu/arm946es/start.S +2 -0
@@ -90,11 +90,13 @@ cpu_init_crit: orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */ mcr p15, 0, r0, c1, c0, 0 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY /* * Go setup Memory and board specific bits prior to relocation. */ mov ip, lr /* perserve link reg across call */ bl lowlevel_init /* go setup memory */ mov lr, ip /* restore link */ +#endif mov pc, lr /* back to my caller */ #endif
arch/arm/cpu/armv7/start.S +4 -1
@@ -66,8 +66,10 @@ save_boot_params_ret: /* the mask ROM code should have PLL and others stable */ #ifndef CONFIG_SKIP_LOWLEVEL_INIT bl cpu_init_cp15 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY bl cpu_init_crit #endif +#endif bl _main
@@ -250,7 +252,8 @@ skip_errata_621766: mov pc, r5 @ back to my caller ENDPROC(cpu_init_cp15) -#ifndef CONFIG_SKIP_LOWLEVEL_INIT +#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && \ + !defined(CONFIG_SKIP_LOWLEVEL_INIT_ONLY) /************************************************************************* * * CPU_init_critical registers
arch/arm/cpu/sa1100/start.S +2 -0
@@ -96,6 +96,7 @@ cpu_init_crit: ldr r1, cpuspeed str r1, [r0, #PPCR] +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY /* * before relocating, we have to setup RAM timing * because memory timing is board-dependend, you will
@@ -104,6 +105,7 @@ cpu_init_crit: mov ip, lr bl lowlevel_init mov lr, ip +#endif /* * disable MMU stuff and enable I-cache
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 3/18 bootm: Align cache flush end address correctly
In reply to Simon GlassFlushing part of the cache should be done on cache boundaries. Trying to flush part of a cache line is not supported and the request may be ignored or print warnings.
Adjust the bootm code to align the end address to prevent this problem.
Tested-on: smartweb, corvus, taurus, axm
---
Changes in v2: None
common/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/bootm.c +1 -1
@@ -435,7 +435,7 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,bootstage_error (BOOTSTAGE_ID_DECOMP_IMAGE );return err; } -flush_cache (load, *load_end - load); +flush_cache (load,ALIGN (*load_end - load,ARCH_DMA_MINALIGN ));debug (" kernel loaded at 0x%08lx, end = 0x%08lx\n" , load, *load_end);bootstage_mark (BOOTSTAGE_ID_KERNEL_LOADED );
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 4/18 net: Handle an empty bootp extension section
In reply to Simon GlassFrom: Andre Renaud <[email protected]>
Avoid generating this section if there is nothing in it.
---
Changes in v2: None
net/bootp.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/bootp.c +9 -0
@@ -655,6 +655,15 @@ static int bootp_extended(u8 *e) *e++ =255 ;/* End of the list */ +/* +* If nothing in list, remove it altogether. Some DHCP servers get +* upset by this minor faux pas and do not respond at all. +*/ +if (e == start +3 ) { +printf ("*** Warning: no DHCP options requested\n" ); + e -=3 ; + } + return e - start; }#endif
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 5/18 net: macb: Prepare for driver-model conversion
In reply to Simon GlassAdjust this driver to avoid using struct netdev in functions that driver model will call. Also refactor the receive function to be compatible with driver model.
Tested-on: smartweb, corvus, taurus, axm
---
Changes in v2: None
drivers/net/macb.c | 199 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 124 insertions(+), 75 deletions(-)
drivers/net/macb.c +124 -75
@@ -84,6 +84,8 @@ struct macb_device {unsigned int rx_tail;unsigned int tx_head;unsigned int tx_tail; +unsigned int next_rx_tail; +bool wrapped;void *rx_buffer;void *tx_buffer;
@@ -255,9 +257,9 @@ static inline void macb_invalidate_rx_buffer(struct macb_device *macb)#if defined(CONFIG_CMD_NET ) -static int macb_send (struct eth_device *netdev,void *packet,int length) +static int _macb_send (struct macb_device *macb,const char *name,void *packet, +int length) { -struct macb_device *macb =to_macb (netdev);unsigned long paddr, ctrl;unsigned int tx_head = macb->tx_head;int i;
@@ -298,12 +300,11 @@ static int macb_send(struct eth_device *netdev, void *packet, int length)if (i <=MACB_TX_TIMEOUT ) {if (ctrl &TXBUF_UNDERRUN ) -printf ("%s: TX underrun\n" , netdev->name); +printf ("%s: TX underrun\n" , name);if (ctrl &TXBUF_EXHAUSTED ) -printf ("%s: TX buffers exhausted in mid frame\n" , - netdev->name); +printf ("%s: TX buffers exhausted in mid frame\n" , name); }else { -printf ("%s: TX timeout\n" , netdev->name); +printf ("%s: TX timeout\n" , name); }/* No one cares anyway */
@@ -335,26 +336,25 @@ static void reclaim_rx_buffers(struct macb_device *macb, macb->rx_tail = new_tail; } -static int macb_recv (struct eth_device *netdev) +static int _macb_recv (struct macb_device *macb,uchar **packetp) { -struct macb_device *macb =to_macb (netdev); -unsigned int rx_tail = macb->rx_tail; +unsigned int next_rx_tail = macb->next_rx_tail;void *buffer;int length; -int wrapped =0 ;u32 status; + macb->wrapped = false;for (;;) {macb_invalidate_ring_desc (macb,RX ); -if (!(macb->rx_ring[rx_tail].addr &RXADDR_USED )) -return -1 ; +if (!(macb->rx_ring[next_rx_tail].addr &RXADDR_USED )) +return -EAGAIN ; - status = macb->rx_ring[rx_tail].ctrl; + status = macb->rx_ring[next_rx_tail].ctrl;if (status &RXBUF_FRAME_START ) { -if (rx_tail != macb->rx_tail) -reclaim_rx_buffers (macb, rx_tail); - wrapped =0 ; +if (next_rx_tail != macb->rx_tail) +reclaim_rx_buffers (macb, next_rx_tail); + macb->wrapped = false; }if (status &RXBUF_FRAME_END ) {
@@ -362,7 +362,7 @@ static int macb_recv(struct eth_device *netdev) length = status &RXBUF_FRMLEN_MASK ;macb_invalidate_rx_buffer (macb); -if (wrapped) { +if (macb->wrapped) {unsigned int headlen, taillen; headlen = 128 * (MACB_RX_RING_SIZE
@@ -372,34 +372,33 @@ static int macb_recv(struct eth_device *netdev) buffer, headlen);memcpy ((void *)net_rx_packets[0 ] + headlen, macb->rx_buffer, taillen); - buffer = (void *)net_rx_packets[0 ]; + *packetp = (void *)net_rx_packets[0 ]; + }else { + *packetp = buffer; } -net_process_received_packet (buffer, length); -if (++rx_tail >=MACB_RX_RING_SIZE ) - rx_tail =0 ; -reclaim_rx_buffers (macb, rx_tail); +if (++next_rx_tail >=MACB_RX_RING_SIZE ) + next_rx_tail =0 ; + macb->next_rx_tail = next_rx_tail; +return length; }else { -if (++rx_tail >=MACB_RX_RING_SIZE ) { - wrapped =1 ; - rx_tail =0 ; +if (++next_rx_tail >=MACB_RX_RING_SIZE ) { + macb->wrapped = true; + next_rx_tail =0 ; } }barrier (); } - -return 0 ; } -static void macb_phy_reset (struct macb_device *macb) +static void macb_phy_reset (struct macb_device *macb,const char *name) { -struct eth_device *netdev = &macb->netdev;int i;u16 status, adv; adv =ADVERTISE_CSMA |ADVERTISE_ALL ;macb_mdio_write (macb,MII_ADVERTISE , adv); -printf ("%s: Starting autonegotiation...\n" , netdev->name); +printf ("%s: Starting autonegotiation...\n" , name);macb_mdio_write (macb,MII_BMCR , (BMCR_ANENABLE |BMCR_ANRESTART ));
@@ -411,10 +410,10 @@ static void macb_phy_reset(struct macb_device *macb) }if (status &BMSR_ANEGCOMPLETE ) -printf ("%s: Autonegotiation complete\n" , netdev->name); +printf ("%s: Autonegotiation complete\n" , name);else printf ("%s: Autonegotiation timed out (status=0x%04x)\n" , - netdev->name, status); + name, status); }#ifdef CONFIG_MACB_SEARCH_PHY
@@ -441,9 +440,8 @@ static int macb_phy_find(struct macb_device *macb)#endif /* CONFIG_MACB_SEARCH_PHY */ -static int macb_phy_init (struct macb_device *macb) +static int macb_phy_init (struct macb_device *macb,const char *name) { -struct eth_device *netdev = &macb->netdev;#ifdef CONFIG_PHYLIB struct phy_device *phydev;#endif
@@ -452,7 +450,7 @@ static int macb_phy_init(struct macb_device *macb)int media, speed, duplex;int i; -arch_get_mdio_control (netdev->name); +arch_get_mdio_control (name);#ifdef CONFIG_MACB_SEARCH_PHY /* Auto-detect phy_addr */ if (!macb_phy_find (macb))
@@ -462,13 +460,13 @@ static int macb_phy_init(struct macb_device *macb)/* Check if the PHY is up to snuff... */ phy_id =macb_mdio_read (macb,MII_PHYSID1 );if (phy_id ==0xffff ) { -printf ("%s: No PHY present\n" , netdev->name); +printf ("%s: No PHY present\n" , name);return 0 ; }#ifdef CONFIG_PHYLIB /* need to consider other phy interface mode */ - phydev =phy_connect (macb->bus, macb->phy_addr, netdev, + phydev =phy_connect (macb->bus, macb->phy_addr, &macb->netdev,PHY_INTERFACE_MODE_RGMII );if (!phydev) {printf ("phy_connect failed\n" );
@@ -481,7 +479,7 @@ static int macb_phy_init(struct macb_device *macb) status =macb_mdio_read (macb,MII_BMSR );if (!(status &BMSR_LSTATUS )) {/* Try to re-negotiate if we don't have link already. */ -macb_phy_reset (macb); +macb_phy_reset (macb, name);for (i =0 ; i <MACB_AUTONEG_TIMEOUT /100 ; i++) { status =macb_mdio_read (macb,MII_BMSR );
@@ -493,7 +491,7 @@ static int macb_phy_init(struct macb_device *macb)if (!(status &BMSR_LSTATUS )) {printf ("%s: link down (status: 0x%04x)\n" , - netdev->name, status); + name, status);return 0 ; }
@@ -505,7 +503,7 @@ static int macb_phy_init(struct macb_device *macb) duplex = ((lpa &LPA_1000FULL ) ?1 :0 );printf ("%s: link up, 1000Mbps %s-duplex (lpa: 0x%04x)\n" , - netdev->name, + name, duplex ?"full" :"half" , lpa);
@@ -530,7 +528,7 @@ static int macb_phy_init(struct macb_device *macb) ? 1 : 0); duplex = (media &ADVERTISE_FULL ) ?1 :0 ;printf ("%s: link up, %sMbps %s-duplex (lpa: 0x%04x)\n" , - netdev->name, + name, speed ?"100" :"10" , duplex ?"full" :"half" , lpa);
@@ -570,9 +568,8 @@ static int gmac_init_multi_queues(struct macb_device *macb)return 0 ; } -static int macb_init (struct eth_device *netdev,bd_t *bd) +static int _macb_init (struct macb_device *macb,const char *name) { -struct macb_device *macb =to_macb (netdev);unsigned long paddr;int i;
@@ -605,6 +602,7 @@ static int macb_init(struct eth_device *netdev, bd_t *bd) macb->rx_tail =0 ; macb->tx_head =0 ; macb->tx_tail =0 ; + macb->next_rx_tail =0 ;macb_writel (macb,RBQP , macb->rx_ring_dma);macb_writel (macb,TBQP , macb->tx_ring_dma);
@@ -641,7 +639,7 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)#endif /* CONFIG_RMII */ } -if (!macb_phy_init (macb)) +if (!macb_phy_init (macb, name))return -1 ;/* Enable TX and RX */
@@ -650,9 +648,8 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)return 0 ; } -static void macb_halt (struct eth_device *netdev) +static void _macb_halt (struct macb_device *macb) { -struct macb_device *macb =to_macb (netdev);u32 ncr, tsr;/* Halt the controller and wait for any ongoing transmission to end. */
@@ -668,17 +665,16 @@ static void macb_halt(struct eth_device *netdev)macb_writel (macb,NCR ,MACB_BIT (CLRSTAT )); } -static int macb_write_hwaddr (struct eth_device *dev) +static int _macb_write_hwaddr (struct macb_device *macb,unsigned char *enetaddr) { -struct macb_device *macb =to_macb (dev);u32 hwaddr_bottom;u16 hwaddr_top;/* set hardware address */ - hwaddr_bottom = dev->enetaddr[0 ] | dev->enetaddr[1 ] <<8 | - dev->enetaddr[2 ] <<16 | dev->enetaddr[3 ] <<24 ; + hwaddr_bottom = enetaddr[0 ] | enetaddr[1 ] <<8 | + enetaddr[2 ] <<16 | enetaddr[3 ] <<24 ;macb_writel (macb,SA1B , hwaddr_bottom); - hwaddr_top = dev->enetaddr[4 ] | dev->enetaddr[5 ] <<8 ; + hwaddr_top = enetaddr[4 ] | enetaddr[5 ] <<8 ;macb_writel (macb,SA1T , hwaddr_top);return 0 ; }
@@ -739,11 +735,86 @@ static u32 macb_dbw(struct macb_device *macb) } } +static void _macb_eth_initialize (struct macb_device *macb) +{ +int id =0 ;/* This is not used by functions we call */ +u32 ncfgr; + +/* TODO: we need check the rx/tx_ring_dma is dcache line aligned */ + macb->rx_buffer =dma_alloc_coherent (MACB_RX_BUFFER_SIZE , + &macb->rx_buffer_dma); + macb->rx_ring =dma_alloc_coherent (MACB_RX_DMA_DESC_SIZE , + &macb->rx_ring_dma); + macb->tx_ring =dma_alloc_coherent (MACB_TX_DMA_DESC_SIZE , + &macb->tx_ring_dma); + macb->dummy_desc =dma_alloc_coherent (MACB_TX_DUMMY_DMA_DESC_SIZE , + &macb->dummy_desc_dma); + +/* +* Do some basic initialization so that we at least can talk +* to the PHY +*/ +if (macb_is_gem (macb)) { + ncfgr =gem_mdc_clk_div (id, macb); + ncfgr |=macb_dbw (macb); + }else { + ncfgr =macb_mdc_clk_div (id, macb); + } + +macb_writel (macb,NCFGR , ncfgr); +} + +static int macb_send (struct eth_device *netdev,void *packet,int length) +{ +struct macb_device *macb =to_macb (netdev); + +return _macb_send (macb, netdev->name, packet, length); +} + +static int macb_recv (struct eth_device *netdev) +{ +struct macb_device *macb =to_macb (netdev); +uchar *packet; +int length; + + macb->wrapped = false; +for (;;) { + macb->next_rx_tail = macb->rx_tail; + length =_macb_recv (macb, &packet); +if (length >=0 ) { +net_process_received_packet (packet, length); +reclaim_rx_buffers (macb, macb->next_rx_tail); + }else if (length <0 ) { +return length; + } + } +} + +static int macb_init (struct eth_device *netdev,bd_t *bd) +{ +struct macb_device *macb =to_macb (netdev); + +return _macb_init (macb, netdev->name); +} + +static void macb_halt (struct eth_device *netdev) +{ +struct macb_device *macb =to_macb (netdev); + +return _macb_halt (macb); +} + +static int macb_write_hwaddr (struct eth_device *netdev) +{ +struct macb_device *macb =to_macb (netdev); + +return _macb_write_hwaddr (macb, netdev->enetaddr); +} +int macb_eth_initialize (int id,void *regs,unsigned int phy_addr) {struct macb_device *macb;struct eth_device *netdev; -u32 ncfgr; macb =malloc (sizeof (struct macb_device ));if (!macb) {
@@ -754,17 +825,6 @@ int macb_eth_initialize(int id, void *regs, unsigned int phy_addr) netdev = &macb->netdev; - macb->rx_buffer =dma_alloc_coherent (MACB_RX_BUFFER_SIZE , - &macb->rx_buffer_dma); - macb->rx_ring =dma_alloc_coherent (MACB_RX_DMA_DESC_SIZE , - &macb->rx_ring_dma); - macb->tx_ring =dma_alloc_coherent (MACB_TX_DMA_DESC_SIZE , - &macb->tx_ring_dma); - macb->dummy_desc =dma_alloc_coherent (MACB_TX_DUMMY_DMA_DESC_SIZE , - &macb->dummy_desc_dma); - -/* TODO: we need check the rx/tx_ring_dma is dcache line aligned */ - macb->regs = regs; macb->phy_addr = phy_addr;
@@ -779,18 +839,7 @@ int macb_eth_initialize(int id, void *regs, unsigned int phy_addr) netdev->recv = macb_recv; netdev->write_hwaddr = macb_write_hwaddr; -/* -* Do some basic initialization so that we at least can talk -* to the PHY -*/ -if (macb_is_gem (macb)) { - ncfgr =gem_mdc_clk_div (id, macb); - ncfgr |=macb_dbw (macb); - }else { - ncfgr =macb_mdc_clk_div (id, macb); - } - -macb_writel (macb,NCFGR , ncfgr); +_macb_eth_initialize (macb);eth_register (netdev);
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 6/18 net: macb: Flush correct cache portion when sending
In reply to Simon GlassThe end address of the cache flush must be cache-line-aligned since otherwise (at least on ARM926-EJS) the request is ignored. When the cache is enabled this means that packets are not sent.
---
Changes in v2: None
drivers/net/macb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macb.c +1 -1
@@ -280,7 +280,7 @@ static int _macb_send(struct macb_device *macb, const char *name, void *packet,barrier ();macb_flush_ring_desc (macb,TX );/* Do we need check paddr and length is dcache line aligned? */ -flush_dcache_range (paddr, paddr + length); +flush_dcache_range (paddr, paddr +ALIGN (length,ARCH_DMA_MINALIGN ));macb_writel (macb,NCR ,MACB_BIT (TE ) |MACB_BIT (RE ) |MACB_BIT (TSTART ));/*
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 7/18 net: macb: Convert to driver model
In reply to Simon GlassAdd driver-model support to this driver. The old code remains for now so that we can convert boards one at a time.
Tested-on: smartweb, corvus, taurus, axm
---
Changes in v2: None
drivers/net/macb.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+)
drivers/net/macb.c +119 -0
@@ -4,6 +4,7 @@* SPDX-License-Identifier: GPL-2.0+ */ #include <common.h> +#include <dm.h> /* * The u-boot networking stack is a little weird. It seems like the
@@ -28,7 +29,9 @@*/ #include <net.h> +#ifndef CONFIG_DM_ETH #include <netdev.h> +#endif #include <malloc.h> #include <miiphy.h>
@@ -100,11 +103,15 @@ struct macb_device {unsigned long dummy_desc_dma;const struct device *dev; +#ifndef CONFIG_DM_ETH struct eth_device netdev; +#endif unsigned short phy_addr;struct mii_dev *bus; }; +#ifndef CONFIG_DM_ETH #define to_macb (_nd) container_of(_nd, struct macb_device, netdev) +#endif static int macb_is_gem (struct macb_device *macb) {
@@ -194,8 +201,13 @@ void __weak arch_get_mdio_control(const char *name)int macb_miiphy_read (const char *devname,u8 phy_adr,u8 reg,u16 *value) { +#ifdef CONFIG_DM_ETH +struct udevice *dev =eth_get_dev_by_name (devname); +struct macb_device *macb =dev_get_priv (dev); +#else struct eth_device *dev =eth_get_dev_by_name (devname);struct macb_device *macb =to_macb (dev); +#endif if (macb->phy_addr != phy_adr)return -1 ;
@@ -208,8 +220,13 @@ int macb_miiphy_read(const char *devname, u8 phy_adr, u8 reg, u16 *value)int macb_miiphy_write (const char *devname,u8 phy_adr,u8 reg,u16 value) { +#ifdef CONFIG_DM_ETH +struct udevice *dev =eth_get_dev_by_name (devname); +struct macb_device *macb =dev_get_priv (dev); +#else struct eth_device *dev =eth_get_dev_by_name (devname);struct macb_device *macb =to_macb (dev); +#endif if (macb->phy_addr != phy_adr)return -1 ;
@@ -764,6 +781,7 @@ static void _macb_eth_initialize(struct macb_device *macb)macb_writel (macb,NCFGR , ncfgr); } +#ifndef CONFIG_DM_ETH static int macb_send (struct eth_device *netdev,void *packet,int length) {struct macb_device *macb =to_macb (netdev);
@@ -849,5 +867,106 @@ int macb_eth_initialize(int id, void *regs, unsigned int phy_addr)#endif return 0 ; } +#endif /* !CONFIG_DM_ETH */ + +#ifdef CONFIG_DM_ETH + +static int macb_start (struct udevice *dev) +{ +struct macb_device *macb =dev_get_priv (dev); + +return _macb_init (macb, dev->name); +} + +static int macb_send (struct udevice *dev,void *packet,int length) +{ +struct macb_device *macb =dev_get_priv (dev); + +return _macb_send (macb, dev->name, packet, length); +} + +static int macb_recv (struct udevice *dev,int flags,uchar **packetp) +{ +struct macb_device *macb =dev_get_priv (dev); + + macb->next_rx_tail = macb->rx_tail; + macb->wrapped = false; + +return _macb_recv (macb, packetp); +} + +static int macb_free_pkt (struct udevice *dev,uchar *packet,int length) +{ +struct macb_device *macb =dev_get_priv (dev); + +reclaim_rx_buffers (macb, macb->next_rx_tail); + +return 0 ; +} + +static void macb_stop (struct udevice *dev) +{ +struct macb_device *macb =dev_get_priv (dev); + +_macb_halt (macb); +} + +static int macb_write_hwaddr (struct udevice *dev) +{ +struct eth_pdata *plat =dev_get_platdata (dev); +struct macb_device *macb =dev_get_priv (dev); + +return _macb_write_hwaddr (macb, plat->enetaddr); +} + +static const struct eth_ops macb_eth_ops = { + .start = macb_start, + .send = macb_send, + .recv = macb_recv, + .stop = macb_stop, + .free_pkt = macb_free_pkt, + .write_hwaddr = macb_write_hwaddr, +}; + +static int macb_eth_probe (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); +struct macb_device *macb =dev_get_priv (dev); + + macb->regs = (void *)pdata->iobase; + +_macb_eth_initialize (macb); +#if defined(CONFIG_CMD_MII ) || defined(CONFIG_PHYLIB ) +miiphy_register (dev->name, macb_miiphy_read, macb_miiphy_write); + macb->bus =miiphy_get_dev_by_name (dev->name); +#endif + +return 0 ; +} + +static int macb_eth_ofdata_to_platdata (struct udevice *dev) +{ +struct eth_pdata *pdata =dev_get_platdata (dev); + + pdata->iobase =dev_get_addr (dev); +return 0 ; +} + +static const struct udevice_id macb_eth_ids[] = { + { .compatible ="cdns,macb" }, + { } +}; + +U_BOOT_DRIVER (eth_macb) = { + .name ="eth_macb" , + .id =UCLASS_ETH , + .of_match = macb_eth_ids, + .ofdata_to_platdata = macb_eth_ofdata_to_platdata, + .probe = macb_eth_probe, + .ops = &macb_eth_ops, + .priv_auto_alloc_size =sizeof (struct macb_device ), + .platdata_auto_alloc_size =sizeof (struct eth_pdata ), +}; +#endif #endif
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 8/18 arm: at91: dts: Bring in device tree file for AT91SAM9G45
In reply to Simon GlassAdd this file from Linux v4.5.
Tested-on: smartweb, corvus, taurus, axm
---
Changes in v2: None
arch/arm/dts/Makefile | 1 + arch/arm/dts/at91sam9g45.dtsi | 1335 ++++++++++++++++++++++++++++++++++++ include/dt-bindings/clock/at91.h | 23 + include/dt-bindings/dma/at91.h | 52 ++ include/dt-bindings/pinctrl/at91.h | 40 ++ 5 files changed, 1451 insertions(+) create mode 100644 arch/arm/dts/at91sam9g45.dtsi create mode 100644 include/dt-bindings/clock/at91.h create mode 100644 include/dt-bindings/dma/at91.h create mode 100644 include/dt-bindings/pinctrl/at91.h
arch/arm/dts/Makefile +1 -0
@@ -2,6 +2,7 @@ # SPDX-License-Identifier: GPL-2.0+ # +dtb-$(CONFIG_AT91FAMILY) += at91sam9g45-gurnard.dtb dtb-$(CONFIG_S5PC100) += s5pc1xx-smdkc100.dtb dtb-$(CONFIG_S5PC110) += s5pc1xx-goni.dtb dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \
arch/arm/dts/at91sam9g45.dtsi new file +1335 -0
1,335 lines not on this page · raw message
include/dt-bindings/clock/at91.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* This header provides constants for AT91 pmc status. +* +* The constants defined in this header are being used in dts. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef _DT_BINDINGS_CLK_AT91_H +#define _DT_BINDINGS_CLK_AT91_H + +#define AT91_PMC_MOSCS 0/* MOSCS Flag */ +#define AT91_PMC_LOCKA 1/* PLLA Lock */ +#define AT91_PMC_LOCKB 2/* PLLB Lock */ +#define AT91_PMC_MCKRDY 3/* Master Clock */ +#define AT91_PMC_LOCKU 6/* UPLL Lock */ +#define AT91_PMC_PCKRDY (id) (8 + (id))/* Programmable Clock */ +#define AT91_PMC_MOSCSELS 16/* Main Oscillator Selection */ +#define AT91_PMC_MOSCRCS 17/* Main On-Chip RC */ +#define AT91_PMC_CFDEV 18/* Clock Failure Detector Event */ +#define AT91_PMC_GCKRDY 24/* Generated Clocks */ + +#endif
include/dt-bindings/dma/at91.h new file +52 -0
52 lines not on this page · raw message
include/dt-bindings/pinctrl/at91.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* This header provides constants for most at91 pinctrl bindings. +* +* Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <[email protected]> +* +* GPLv2 only +*/ + +#ifndef __DT_BINDINGS_AT91_PINCTRL_H__ +#define __DT_BINDINGS_AT91_PINCTRL_H__ + +#define AT91_PINCTRL_NONE (0 << 0) +#define AT91_PINCTRL_PULL_UP (1 << 0) +#define AT91_PINCTRL_MULTI_DRIVE (1 << 1) +#define AT91_PINCTRL_DEGLITCH (1 << 2) +#define AT91_PINCTRL_PULL_DOWN (1 << 3) +#define AT91_PINCTRL_DIS_SCHMIT (1 << 4) +#define AT91_PINCTRL_DEBOUNCE (1 << 16) +#define AT91_PINCTRL_DEBOUNCE_VAL (x) (x << 17) + +#define AT91_PINCTRL_PULL_UP_DEGLITCH (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DEGLITCH) + +#define AT91_PINCTRL_DRIVE_STRENGTH_DEFAULT (0x0 << 5) +#define AT91_PINCTRL_DRIVE_STRENGTH_LOW (0x1 << 5) +#define AT91_PINCTRL_DRIVE_STRENGTH_MED (0x2 << 5) +#define AT91_PINCTRL_DRIVE_STRENGTH_HI (0x3 << 5) + +#define AT91_PIOA 0 +#define AT91_PIOB 1 +#define AT91_PIOC 2 +#define AT91_PIOD 3 +#define AT91_PIOE 4 + +#define AT91_PERIPH_GPIO 0 +#define AT91_PERIPH_A 1 +#define AT91_PERIPH_B 2 +#define AT91_PERIPH_C 3 +#define AT91_PERIPH_D 4 + +#endif /* __DT_BINDINGS_AT91_PINCTRL_H__ */
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 9/18 arm: at91: Add a header file for the real-time clock
In reply to Simon GlassFrom: Andre Renaud <[email protected]>
Add register definitions for the AT91 RTC so that this can potentially be used in U-Boot.
---
Changes in v2: None
arch/arm/mach-at91/include/mach/at91_rtc.h | 71 ++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 arch/arm/mach-at91/include/mach/at91_rtc.h
arch/arm/mach-at91/include/mach/at91_rtc.h new file +71 -0
@@ -0,0 +1,71 @@ +/* +* Copyright (C) 2005 Ivan Kokshaysky +* Copyright (C) SAN People +* +* Real Time Clock (RTC) - System peripheral registers. +* Based on AT91RM9200 datasheet revision E. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef AT91_RTC_H +#define AT91_RTC_H + +/* Control Register */ +#define AT91_RTC_CR (ATMEL_BASE_RTC + 0x00) +#define AT91_RTC_UPDTIM (1 << 0)/* Update Request Time */ +#define AT91_RTC_UPDCAL (1 << 1)/* Update Request Calendar */ +#define AT91_RTC_TIMEVSEL (3 << 8)/* Time Event Selection */ +#define AT91_RTC_TIMEVSEL_MINUTE (0 << 8) +#define AT91_RTC_TIMEVSEL_HOUR (1 << 8) +#define AT91_RTC_TIMEVSEL_DAY24 (2 << 8) +#define AT91_RTC_TIMEVSEL_DAY12 (3 << 8) +#define AT91_RTC_CALEVSEL (3 << 16)/* Calendar Event Selection */ +#define AT91_RTC_CALEVSEL_WEEK (0 << 16) +#define AT91_RTC_CALEVSEL_MONTH (1 << 16) +#define AT91_RTC_CALEVSEL_YEAR (2 << 16) + +#define AT91_RTC_MR (ATMEL_BASE_RTC + 0x04)/* Mode Register */ +#define AT91_RTC_HRMOD (1 << 0)/* 12/24 Hour Mode */ + +#define AT91_RTC_TIMR (ATMEL_BASE_RTC + 0x08)/* Time Register */ +#define AT91_RTC_SEC (0x7f << 0)/* Current Second */ +#define AT91_RTC_MIN (0x7f << 8)/* Current Minute */ +#define AT91_RTC_HOUR (0x3f << 16)/* Current Hour */ +#define AT91_RTC_AMPM (1 << 22)/* AM/PM */ + +#define AT91_RTC_CALR (ATMEL_BASE_RTC + 0x0c)/* Calendar Register */ +#define AT91_RTC_CENT (0x7f << 0)/* Current Century */ +#define AT91_RTC_YEAR (0xff << 8)/* Current Year */ +#define AT91_RTC_MONTH (0x1f << 16)/* Current Month */ +#define AT91_RTC_DAY (7 << 21)/* Current Day */ +#define AT91_RTC_DATE (0x3f << 24)/* Current Date */ + +#define AT91_RTC_TIMALR (ATMEL_BASE_RTC + 0x10)/* Time Alarm */ +#define AT91_RTC_SECEN (1 << 7)/* Second Alarm Enab */ +#define AT91_RTC_MINEN (1 << 15)/* Minute Alarm Enab */ +#define AT91_RTC_HOUREN (1 << 23)/* Hour Alarm Enable */ + +#define AT91_RTC_CALALR (ATMEL_BASE_RTC + 0x14)/* Calendar Alarm */ +#define AT91_RTC_MTHEN (1 << 23)/* Month Alarm Enable */ +#define AT91_RTC_DATEEN (1 << 31)/* Date Alarm Enable */ + +#define AT91_RTC_SR (ATMEL_BASE_RTC + 0x18)/* Status Register */ +#define AT91_RTC_ACKUPD (1 << 0)/* Ack for Update */ +#define AT91_RTC_ALARM (1 << 1)/* Alarm Flag */ +#define AT91_RTC_SECEV (1 << 2)/* Second Event */ +#define AT91_RTC_TIMEV (1 << 3)/* Time Event */ +#define AT91_RTC_CALEV (1 << 4)/* Calendar Event */ + +#define AT91_RTC_SCCR (ATMEL_BASE_RTC + 0x1c)/* Status Clear Cmd */ +#define AT91_RTC_IER (ATMEL_BASE_RTC + 0x20)/* Interrupt Enable */ +#define AT91_RTC_IDR (ATMEL_BASE_RTC + 0x24)/* Interrupt Disable */ +#define AT91_RTC_IMR (ATMEL_BASE_RTC + 0x28)/* Interrupt Mask */ + +#define AT91_RTC_VER (ATMEL_BASE_RTC + 0x2c)/* Valid Entry */ +#define AT91_RTC_NVTIM (1 << 0)/* Non-valid Time */ +#define AT91_RTC_NVCAL (1 << 1)/* Non-valid Calendar */ +#define AT91_RTC_NVTIMALR (1 << 2)/* .. Time Alarm */ +#define AT91_RTC_NVCALALR (1 << 3)/* .. Calendar Alarm */ + +#endif
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 10/18 at91: Correct NAND ECC register access
In reply to Simon GlassFrom: Andre Renaud <[email protected]>
This uses the wrote base register value. Fix it.
---
Changes in v2: None
drivers/mtd/nand/atmel_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/atmel_nand.c +2 -2
@@ -24,9 +24,9 @@/* Register access macros */ #define ecc_readl (add, reg) \ - readl(AT91_BASE_SYS + add + ATMEL_ECC_##reg) + readl(add + ATMEL_ECC_##reg)#define ecc_writel (add, reg, value) \ - writel((value), AT91_BASE_SYS + add + ATMEL_ECC_##reg) + writel((value), add + ATMEL_ECC_##reg)#include "atmel_nand_ecc.h" /* Hardware ECC registers */
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 11/18 at91: nand: Set up the ECC strength correctly
In reply to Simon GlassFrom: Andre Renaud <[email protected]>
This needs to be set to avoid a fatal error when ECC is used.
---
Changes in v2: None
drivers/mtd/nand/atmel_nand.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/atmel_nand.c +1 -0
@@ -1155,6 +1155,7 @@ int atmel_hwecc_nand_init_param(struct nand_chip *nand, struct mtd_info *mtd) nand->ecc.hwctl = atmel_nand_hwctl; nand->ecc.read_page = atmel_nand_read_page; nand->ecc.bytes =4 ; + nand->ecc.strength =4 ;if (nand->ecc.mode ==NAND_ECC_HW ) {/* ECC is calculated for the whole page (1 step) */
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 12/18 mtd: nand: Drop a blank line in nand_wait()
In reply to Simon GlassFrom: Andre Renaud <[email protected]>
This empty line should not be there. Remove it.
---
Changes in v2: None
drivers/mtd/nand/nand_base.c | 1 - 1 file changed, 1 deletion(-)
drivers/mtd/nand/nand_base.c +0 -1
@@ -877,7 +877,6 @@ static void panic_nand_wait(struct mtd_info *mtd, struct nand_chip *chip,*/ static int nand_wait (struct mtd_info *mtd,struct nand_chip *chip) { -int status, state = chip->state;unsigned long timeo = (state ==FL_ERASING ?400 :20 );
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 13/18 at91: Add driver-model GPIO devices for AT91SAM9G45
In reply to Simon GlassAdd these definitions so that GPIOs can be used with driver model.
Tested-on: smartweb, corvus, taurus, axm
---
Changes in v2: None
arch/arm/mach-at91/arm926ejs/at91sam9m10g45_devices.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/arm/mach-at91/arm926ejs/at91sam9m10g45_devices.c +18 -0
@@ -7,6 +7,7 @@*/ #include <common.h> +#include <dm.h> #include <asm/arch/at91_common.h> #include <asm/arch/clk.h> #include <asm/arch/gpio.h>
@@ -165,3 +166,20 @@ void at91_mci_hw_init(void) at91_periph_clk_enable(ATMEL_ID_MCI0); }#endif + +/* Platform data for the GPIOs */ +static const struct at91_port_platdata at91sam9260_plat[] = { + {ATMEL_BASE_PIOA ,"PA" }, + {ATMEL_BASE_PIOB ,"PB" }, + {ATMEL_BASE_PIOC ,"PC" }, + {ATMEL_BASE_PIOD ,"PD" }, + {ATMEL_BASE_PIOE ,"PE" }, +}; + +U_BOOT_DEVICES (at91sam9260_gpios) = { + {"gpio_at91" , &at91sam9260_plat[0 ] }, + {"gpio_at91" , &at91sam9260_plat[1 ] }, + {"gpio_at91" , &at91sam9260_plat[2 ] }, + {"gpio_at91" , &at91sam9260_plat[3 ] }, + {"gpio_at91" , &at91sam9260_plat[4 ] }, +};
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 14/18 at91: mtd: nand: Add dev_warn() to correct build error in driver
In reply to Simon GlassThe code does not compile if ECC is enabled.
---
Changes in v2: None
drivers/mtd/nand/atmel_nand.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/nand/atmel_nand.c +2 -0
@@ -20,6 +20,8 @@#include <watchdog.h> #include <linux/mtd/nand_ecc.h> +#define dev_warn(dev, msg...) +#ifdef CONFIG_ATMEL_NAND_HWECC /* Register access macros */
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 15/18 at91: video: Prepare for driver-model conversion
In reply to Simon GlassAdjust the driver to use struct display_timing for its display timing. This is what is used by driver-model and allows the LCD init code to be common.
---
Changes in v2: None
drivers/video/atmel_lcdfb.c | 106 +++++++++++++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 36 deletions(-)
drivers/video/atmel_lcdfb.c +70 -36
@@ -7,6 +7,7 @@*/ #include <common.h> +#include <fdtdec.h> #include <asm/io.h> #include <asm/arch/gpio.h> #include <asm/arch/clk.h>
@@ -91,39 +92,41 @@ void lcd_set_cmap(struct bmp_image *bmp, unsigned colors) } } -void lcd_ctrl_init (void *lcdbase) +static void atmel_fb_init (ulong addr,struct display_timing *timing,int bpix, +bool tft,bool cont_pol_low,ulong lcdbase) {unsigned long value; +void *reg = (void *)addr;/* Turn off the LCD controller and the DMA controller */ -lcdc_writel (panel_info.mmio,ATMEL_LCDC_PWRCON , +lcdc_writel (reg,ATMEL_LCDC_PWRCON ,ATMEL_LCDC_GUARD_TIME <<ATMEL_LCDC_GUARDT_OFFSET );/* Wait for the LCDC core to become idle */ -while (lcdc_readl (panel_info.mmio,ATMEL_LCDC_PWRCON ) &ATMEL_LCDC_BUSY ) +while (lcdc_readl (reg,ATMEL_LCDC_PWRCON ) &ATMEL_LCDC_BUSY )udelay (10 ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_DMACON ,0 ); +lcdc_writel (reg,ATMEL_LCDC_DMACON ,0 );/* Reset LCDC DMA */ -lcdc_writel (panel_info.mmio,ATMEL_LCDC_DMACON ,ATMEL_LCDC_DMARST ); +lcdc_writel (reg,ATMEL_LCDC_DMACON ,ATMEL_LCDC_DMARST );/* ...set frame size and burst length = 8 words (?) */ - value = (panel_info.vl_col * panel_info.vl_row * -NBITS (panel_info.vl_bpix)) /32 ; + value = (timing->hactive.typ * timing->vactive.typ * + (1 << bpix)) /32 ; value |= ((ATMEL_LCDC_DMA_BURST_LEN -1 ) <<ATMEL_LCDC_BLENGTH_OFFSET ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_DMAFRMCFG , value); +lcdc_writel (reg,ATMEL_LCDC_DMAFRMCFG , value);/* Set pixel clock */ - value =get_lcdc_clk_rate (0 ) / panel_info.vl_clk; -if (get_lcdc_clk_rate (0 ) % panel_info.vl_clk) + value =get_lcdc_clk_rate (0 ) / timing->pixelclock.typ; +if (get_lcdc_clk_rate (0 ) % timing->pixelclock.typ) value++; value = (value /2 ) -1 ;if (!value) { -lcdc_writel (panel_info.mmio,ATMEL_LCDC_LCDCON1 ,ATMEL_LCDC_BYPASS ); +lcdc_writel (reg,ATMEL_LCDC_LCDCON1 ,ATMEL_LCDC_BYPASS ); }else -lcdc_writel (panel_info.mmio,ATMEL_LCDC_LCDCON1 , +lcdc_writel (reg,ATMEL_LCDC_LCDCON1 , value <<ATMEL_LCDC_CLKVAL_OFFSET );/* Initialize control register 2 */
@@ -132,56 +135,87 @@ void lcd_ctrl_init(void *lcdbase)#else value =ATMEL_LCDC_MEMOR_LITTLE |ATMEL_LCDC_CLKMOD_ALWAYSACTIVE ;#endif -if (panel_info.vl_tft) +if (tft) value |=ATMEL_LCDC_DISTYPE_TFT ; - value |= panel_info.vl_sync; - value |= (panel_info.vl_bpix <<5 ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_LCDCON2 , value); +if (!(timing->flags &DISPLAY_FLAGS_HSYNC_HIGH )) + value |=ATMEL_LCDC_INVLINE_INVERTED ; +if (!(timing->flags &DISPLAY_FLAGS_VSYNC_HIGH )) + value |=ATMEL_LCDC_INVFRAME_INVERTED ; + value |= bpix <<5 ; +lcdc_writel (reg,ATMEL_LCDC_LCDCON2 , value);/* Vertical timing */ - value = (panel_info.vl_vsync_len -1 ) <<ATMEL_LCDC_VPW_OFFSET ; - value |= panel_info.vl_upper_margin <<ATMEL_LCDC_VBP_OFFSET ; - value |= panel_info.vl_lower_margin; -lcdc_writel (panel_info.mmio,ATMEL_LCDC_TIM1 , value); + value = (timing->vsync_len.typ -1 ) <<ATMEL_LCDC_VPW_OFFSET ; + value |= timing->vback_porch.typ <<ATMEL_LCDC_VBP_OFFSET ; + value |= timing->vfront_porch.typ; +/* Magic! (Datasheet says "Bit 31 must be written to 1") */ + value |=1U <<31 ; +lcdc_writel (reg,ATMEL_LCDC_TIM1 , value);/* Horizontal timing */ - value = (panel_info.vl_right_margin -1 ) <<ATMEL_LCDC_HFP_OFFSET ; - value |= (panel_info.vl_hsync_len -1 ) <<ATMEL_LCDC_HPW_OFFSET ; - value |= (panel_info.vl_left_margin -1 ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_TIM2 , value); + value = (timing->hfront_porch.typ -1 ) <<ATMEL_LCDC_HFP_OFFSET ; + value |= (timing->hsync_len.typ -1 ) <<ATMEL_LCDC_HPW_OFFSET ; + value |= (timing->hback_porch.typ -1 ); +lcdc_writel (reg,ATMEL_LCDC_TIM2 , value);/* Display size */ - value = (panel_info.vl_col -1 ) <<ATMEL_LCDC_HOZVAL_OFFSET ; - value |= panel_info.vl_row -1 ; -lcdc_writel (panel_info.mmio,ATMEL_LCDC_LCDFRMCFG , value); + value = (timing->hactive.typ -1 ) <<ATMEL_LCDC_HOZVAL_OFFSET ; + value |= timing->vactive.typ -1 ; +lcdc_writel (reg,ATMEL_LCDC_LCDFRMCFG , value);/* FIFO Threshold: Use formula from data sheet */ value =ATMEL_LCDC_FIFO_SIZE - (2 *ATMEL_LCDC_DMA_BURST_LEN +3 ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_FIFO , value); +lcdc_writel (reg,ATMEL_LCDC_FIFO , value);/* Toggle LCD_MODE every frame */ -lcdc_writel (panel_info.mmio,ATMEL_LCDC_MVAL ,0 ); +lcdc_writel (reg,ATMEL_LCDC_MVAL ,0 );/* Disable all interrupts */ -lcdc_writel (panel_info.mmio,ATMEL_LCDC_IDR , ~0UL ); +lcdc_writel (reg,ATMEL_LCDC_IDR , ~0UL );/* Set contrast */ value =ATMEL_LCDC_PS_DIV8 |ATMEL_LCDC_ENA_PWMENABLE ; -if (!panel_info.vl_cont_pol_low) +if (!cont_pol_low) value |=ATMEL_LCDC_POL_POSITIVE ; -lcdc_writel (panel_info.mmio,ATMEL_LCDC_CONTRAST_CTR , value); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_CONTRAST_VAL ,ATMEL_LCDC_CVAL_DEFAULT ); +lcdc_writel (reg,ATMEL_LCDC_CONTRAST_CTR , value); +lcdc_writel (reg,ATMEL_LCDC_CONTRAST_VAL ,ATMEL_LCDC_CVAL_DEFAULT );/* Set framebuffer DMA base address and pixel offset */ -lcdc_writel (panel_info.mmio,ATMEL_LCDC_DMABADDR1 , (u_long )lcdbase); +lcdc_writel (reg,ATMEL_LCDC_DMABADDR1 , lcdbase); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_DMACON ,ATMEL_LCDC_DMAEN ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_PWRCON , +lcdc_writel (reg,ATMEL_LCDC_DMACON ,ATMEL_LCDC_DMAEN ); +lcdc_writel (reg,ATMEL_LCDC_PWRCON , (ATMEL_LCDC_GUARD_TIME <<ATMEL_LCDC_GUARDT_OFFSET ) |ATMEL_LCDC_PWR ); } +void lcd_ctrl_init (void *lcdbase) +{ +struct display_timing timing; + + timing.flags =0 ; +if (!(panel_info.vl_sync &ATMEL_LCDC_INVLINE_INVERTED )) + timing.flags |=DISPLAY_FLAGS_HSYNC_HIGH ; +if (!(panel_info.vl_sync &ATMEL_LCDC_INVFRAME_INVERTED )) + timing.flags |=DISPLAY_FLAGS_VSYNC_LOW ; + timing.pixelclock.typ = panel_info.vl_clk; + + timing.hactive.typ = panel_info.vl_col; + timing.hfront_porch.typ = panel_info.vl_right_margin; + timing.hback_porch.typ = panel_info.vl_left_margin; + timing.hsync_len.typ = panel_info.vl_hsync_len; + + timing.vactive.typ = panel_info.vl_row; + timing.vfront_porch.typ = panel_info.vl_clk; + timing.vback_porch.typ = panel_info.vl_clk; + timing.vsync_len.typ = panel_info.vl_clk; + +atmel_fb_init (panel_info.mmio, &timing, panel_info.vl_bpix, + panel_info.vl_tft, panel_info.vl_cont_pol_low, + (ulong )lcdbase); +} +ulong calc_fbsize (void ) { return ((panel_info.vl_col * panel_info.vl_row *
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 16/18 at91: video: Support driver-model for the LCD driver
In reply to Simon GlassAdd driver-model support to this driver. Most features can be controlled from the device tree.
---
Changes in v2: None
drivers/video/atmel_lcdfb.c | 91 +++++++++++++++++++++++++++++++++++++++++++++ include/atmel_lcd.h | 9 +++++ 2 files changed, 100 insertions(+)
drivers/video/atmel_lcdfb.c +91 -0
@@ -7,7 +7,10 @@*/ #include <common.h> +#include <atmel_lcd.h> +#include <dm.h> #include <fdtdec.h> +#include <video.h> #include <asm/io.h> #include <asm/arch/gpio.h> #include <asm/arch/clk.h>
@@ -15,6 +18,21 @@#include <bmp_layout.h> #include <atmel_lcdc.h> +DECLARE_GLOBAL_DATA_PTR ; + +#ifdef CONFIG_DM_VIDEO +enum { +/* Maximum LCD size we support */ +LCD_MAX_WIDTH =1366 , +LCD_MAX_HEIGHT =768 , +LCD_MAX_LOG2_BPP =VIDEO_BPP16 , +}; +#endif + +struct atmel_fb_priv { +struct display_timing timing; +}; +/* configurable parameters */ #define ATMEL_LCDC_CVAL_DEFAULT 0xc8#define ATMEL_LCDC_DMA_BURST_LEN 8
@@ -31,6 +49,7 @@#define lcdc_readl (mmio, reg) __raw_readl((mmio)+(reg))#define lcdc_writel (mmio, reg, val) __raw_writel((val), (mmio)+(reg)) +#ifndef CONFIG_DM_VIDEO ushort *configuration_get_cmap (void ) {return (ushort *)(panel_info.mmio +ATMEL_LCDC_LUT (0 ));
@@ -91,6 +110,7 @@ void lcd_set_cmap(struct bmp_image *bmp, unsigned colors) lcd_setcolreg(i, cte.red, cte.green, cte.blue); } } +#endif static void atmel_fb_init (ulong addr,struct display_timing *timing,int bpix,bool tft,bool cont_pol_low,ulong lcdbase)
@@ -190,6 +210,7 @@ static void atmel_fb_init(ulong addr, struct display_timing *timing, int bpix, (ATMEL_LCDC_GUARD_TIME << ATMEL_LCDC_GUARDT_OFFSET) | ATMEL_LCDC_PWR); } +#ifndef CONFIG_DM_VIDEO void lcd_ctrl_init (void *lcdbase) {struct display_timing timing;
@@ -221,3 +242,73 @@ ulong calc_fbsize(void)return ((panel_info.vl_col * panel_info.vl_row *NBITS (panel_info.vl_bpix)) /8 ) +PAGE_SIZE ; } +#endif + +#ifdef CONFIG_DM_VIDEO +static int atmel_fb_lcd_probe (struct udevice *dev) +{ +struct video_uc_platdata *uc_plat =dev_get_uclass_platdata (dev); +struct video_priv *uc_priv =dev_get_uclass_priv (dev); +struct atmel_fb_priv *priv =dev_get_priv (dev); +struct display_timing *timing = &priv->timing; + +/* +* For now some values are hard-coded. We could use the device tree +* bindings in simple-framebuffer.txt to specify the format/bpp and +* some Atmel-specific binding for tft and cont_pol_low. +*/ +atmel_fb_init (ATMEL_BASE_LCDC , timing,VIDEO_BPP16 , true, false, + uc_plat->base); + uc_priv->xsize = timing->hactive.typ; + uc_priv->ysize = timing->vactive.typ; + uc_priv->bpix =VIDEO_BPP16 ; +video_set_flush_dcache (dev, true); +debug ("LCD frame buffer at %lx, size %x, %dx%d pixels\n" , uc_plat->base, + uc_plat->size, uc_priv->xsize, uc_priv->ysize); + +return 0 ; +} + +static int atmel_fb_ofdata_to_platdata (struct udevice *dev) +{ +struct atmel_lcd_platdata *plat =dev_get_platdata (dev); +struct atmel_fb_priv *priv =dev_get_priv (dev); +struct display_timing *timing = &priv->timing; +const void *blob = gd->fdt_blob; + +if (fdtdec_decode_display_timing (blob, dev->of_offset, + plat->timing_index, timing)) { +debug ("%s: Failed to decode display timing\n" , __func__); +return -EINVAL ; + } + +return 0 ; +} + +static int atmel_fb_lcd_bind (struct udevice *dev) +{ +struct video_uc_platdata *uc_plat =dev_get_uclass_platdata (dev); + + uc_plat->size =LCD_MAX_WIDTH *LCD_MAX_HEIGHT * + (1 <<VIDEO_BPP16 ) /8 ; +debug ("%s: Frame buffer size %x\n" , __func__, uc_plat->size); + +return 0 ; +} + +static const struct udevice_id atmel_fb_lcd_ids[] = { + { .compatible ="atmel,at91sam9g45-lcdc" }, + { } +}; + +U_BOOT_DRIVER (atmel_fb) = { + .name ="atmel_fb" , + .id =UCLASS_VIDEO , + .of_match = atmel_fb_lcd_ids, + .bind = atmel_fb_lcd_bind, + .ofdata_to_platdata = atmel_fb_ofdata_to_platdata, + .probe = atmel_fb_lcd_probe, + .platdata_auto_alloc_size =sizeof (struct atmel_lcd_platdata ), + .priv_auto_alloc_size =sizeof (struct atmel_fb_priv ), +}; +#endif
include/atmel_lcd.h +9 -0
@@ -10,6 +10,15 @@ #ifndef _ATMEL_LCD_H_ #define _ATMEL_LCD_H_ +/** + * struct atmel_lcd_platdata - platform data for Atmel LCDs with driver model + * + * @timing_index: Index of LCD timing to use in device tree node + */ +struct atmel_lcd_platdata { + int timing_index; +}; + typedef struct vidinfo { ushort vl_col; /* Number of columns (i.e. 640) */ ushort vl_row; /* Number of rows (i.e. 480) */
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 17/18 fdt: Correct return value in fdtdec_decode_display_timing()
In reply to Simon GlassThis should return a non-zero value if there is a missing property. Update the return value accordingly. The only expected error is -FDT_ERR_NOTFOUND.
---
Changes in v2: None
lib/fdtdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/fdtdec.c +1 -1
@@ -1169,7 +1169,7 @@ int fdtdec_decode_display_timing(const void *blob, int parent, int index,if (fdtdec_get_bool (blob, node,"doubleclk" )) dt->flags |=DISPLAY_FLAGS_DOUBLECLK ; -return 0 ; +return ret; }int fdtdec_setup (void )
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 18/18 arm: at91: Add support for gurnard
In reply to Simon GlassFrom: Andre Renaud <[email protected]>
This board is based on Snapper 9G45 which has an Atmel AT91SAM9G45 chip and 128MB of SDRAM. It includes a small LCD, 2xUSB host, SD card, Ethernet and two UARTs.
---
Changes in v2:
- Correct commit author in several cases
- Rebase to master
arch/arm/dts/at91sam9g45-gurnard.dts | 157 ++ arch/arm/mach-at91/Kconfig | 9 + board/bluewater/gurnard/Kconfig | 12 + board/bluewater/gurnard/MAINTAINERS | 6 + board/bluewater/gurnard/Makefile | 11 + board/bluewater/gurnard/gurnard.c | 449 ++++++ board/bluewater/gurnard/splash_logo.h | 2619 +++++++++++++++++++++++++++++++++ configs/gurnard_defconfig | 19 + include/configs/snapper9g45.h | 156 ++ 9 files changed, 3438 insertions(+) create mode 100644 arch/arm/dts/at91sam9g45-gurnard.dts create mode 100644 board/bluewater/gurnard/Kconfig create mode 100644 board/bluewater/gurnard/MAINTAINERS create mode 100644 board/bluewater/gurnard/Makefile create mode 100644 board/bluewater/gurnard/gurnard.c create mode 100644 board/bluewater/gurnard/splash_logo.h create mode 100644 configs/gurnard_defconfig create mode 100644 include/configs/snapper9g45.h
arch/arm/dts/at91sam9g45-gurnard.dts new file +157 -0
@@ -0,0 +1,157 @@ +/* + * at91sam9g20ek.dts - Device Tree file for Atmel at91sam9g20ek board + * + * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <[email protected]> + * + * Licensed under GPLv2. + */ +/dts-v1/; +#include "at91sam9g45.dtsi" + +/ { + model = "Bluewater Systems Gurnard"; + compatible = "atmel,at91sam9g45", "atmel,at91sam9"; + + chosen { + bootargs = "mem=64M root=/dev/mtdblock5 rw rootfstype=ubifs"; + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0x20000000 0x8000000>; + }; + + clocks { + slow_xtal { + clock-frequency = <32768>; + }; + + main_xtal { + clock-frequency = <18432000>; + }; + }; + + ahb { + u-boot,dm-pre-reloc; + + fb at 0x00500000 { + u-boot,dm-pre-reloc; + status = "okay"; + display-timings { + rev1 { + clock-frequency = <4166666>; + hactive = <480>; + vactive = <272>; + hfront-porch = <1>; + hback-porch = <1>; + hsync-len = <1>; + vback-porch = <4>; + vfront-porch = <2>; + vsync-len = <1>; + hsync-active = <0>; + vsync-active = <0>; + }; + + rev2 { + clock-frequency = <4166666>; + hactive = <480>; + vactive = <272>; + hfront-porch = <2>; + hback-porch = <2>; + hsync-len = <10>; + vback-porch = <2>; + vfront-porch = <2>; + vsync-len = <10>; + hsync-active = <0>; + vsync-active = <0>; + }; + }; + }; + + apb { + pinctrl at fffff400 { + board { + pinctrl_pck0_as_mck: pck0_as_mck { + atmel,pins = + <AT91_PIOC 1 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC1 periph B */ + }; + + }; + + mmc0_slot1 { + pinctrl_board_mmc0_slot1: mmc0_slot1-board { + atmel,pins = + <AT91_PIOC 9 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PC9 gpio CD pin pull up and deglitch */ + }; + }; + }; + + dbgu: serial at ffffee00 { + status = "okay"; + }; + + macb0: ethernet at fffbc000 { + phy-mode = "rmii"; + status = "okay"; + }; + + mmc0: mmc at fff80000 { + pinctrl-0 = < + &pinctrl_board_mmc0_slot1 + &pinctrl_mmc0_slot0_clk_cmd_dat0 + &pinctrl_mmc0_slot0_dat1_3>; + status = "okay"; + slot at 1 { + reg = <1>; + bus-width = <4>; + cd-gpios = <&pioC 9 GPIO_ACTIVE_HIGH>; + }; + }; + + ssc0: ssc at fff9c000 { + status = "okay"; + pinctrl-0 = <&pinctrl_ssc0_tx>; + }; + + spi0: spi at fffa4000 { + cs-gpios = <0>, <&pioC 11 0>, <0>, <0>; + mtd_dataflash at 0 { + compatible = "atmel,at45", "atmel,dataflash"; + spi-max-frequency = <50000000>; + reg = <1>; + }; + }; + + shdwc at fffffd10 { + atmel,wakeup-counter = <10>; + atmel,wakeup-rtt-timer; + }; + + rtc at fffffd20 { + atmel,rtt-rtc-time-reg = <&gpbr 0x0>; + status = "okay"; + }; + + watchdog at fffffd40 { + status = "okay"; + }; + + gpbr: syscon at fffffd60 { + status = "okay"; + }; + }; + + nand0: nand at 40000000 { + nand-bus-width = <8>; + nand-ecc-mode = "hardware"; + nand-on-flash-bbt; + status = "okay"; + }; + + usb1: ehci at 00800000 { + atmel,vbus-gpio = <&pioC 5 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + }; + +};
arch/arm/mach-at91/Kconfig +9 -0
@@ -23,6 +23,14 @@ config TARGET_SNAPPER9260 select DM_SERIAL select DM_GPIO +config TARGET_GURNARD + bool "Support gurnard" + select CPU_ARM926EJS + select DM + select DM_SERIAL + select DM_GPIO + select DM_ETH + config TARGET_AT91SAM9261EK bool "Atmel at91sam9261 reference board" select CPU_ARM926EJS
@@ -143,6 +151,7 @@ source "board/atmel/sama5d3_xplained/Kconfig" source "board/atmel/sama5d3xek/Kconfig" source "board/atmel/sama5d4_xplained/Kconfig" source "board/atmel/sama5d4ek/Kconfig" +source "board/bluewater/gurnard/Kconfig" source "board/bluewater/snapper9260/Kconfig" source "board/calao/usb_a9263/Kconfig" source "board/denx/ma5d4evk/Kconfig"
board/bluewater/gurnard/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +if TARGET_GURNARD + +config SYS_BOARD + default "gurnard" + +config SYS_VENDOR + default "bluewater" + +config SYS_CONFIG_NAME + default "snapper9g45" + +endif
board/bluewater/gurnard/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +GURNARD BOARD +M: Simon Glass <[email protected]> +S: Maintained +F: board/bluewater/gurnard/ +F: include/configs/snapper9g45.h +F: configs/gurnard_defconfig
board/bluewater/gurnard/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# +# (C) Copyright 2003-2008 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# (C) Copyright 2011 Bluewater Systems +# Ryan Mallon <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += gurnard.o
board/bluewater/gurnard/gurnard.c new file +449 -0
449 lines not on this page · raw message
board/bluewater/gurnard/splash_logo.h new file +2619 -0
2,344 lines not on this page · raw message
include/configs/snapper9g45.h new file +156 -0
156 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.8.0.rc3.226.g39d4020
Part of the diff is not shown here. View the raw message.
PATCH v2 2/18 arm: Allow skipping of low-level init with I-cache on
In reply to Simon GlassHi Simon,
Quoted 30 lines · Simon Glass
At present
CONFIG_SKIP_LOWLEVEL_INITprevents U-Boot from callinglowlevel_init(). This means that the instruction cache is not enabled and the board runs very slowly.What is really needed in many cases is to skip the call to
lowlevel_init()but still perform CP15 init. Add an option to handle this.Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>Reviewed-by Joe Hershberger <[email protected]>Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
README | 5 +++++ arch/arm/cpu/arm1136/start.S | 2 ++ arch/arm/cpu/arm920t/start.S | 3 ++- arch/arm/cpu/arm926ejs/start.S | 2 ++ arch/arm/cpu/arm946es/start.S | 2 ++ arch/arm/cpu/armv7/start.S | 5 ++++- arch/arm/cpu/sa1100/start.S | 2 ++ 7 files changed, 19 insertions(+), 2 deletions(-)README +0
-0
README Low Level (hardware related) configuration options: · line 4834
Quoted 6 lines
README +3
-0@@ -4829,6 +4829,11 @@ Low Level (hardware related) configuration options: other boot loader or by a debugger which performs these initializations itself. +- CONFIG_SKIP_LOWLEVEL_INIT_ONLY + [ARM926EJ-S only] This allows just the call to lowlevel_init() + to be skipped. The normal CPU15 init (such as enabling the
CPU15 -> CP15
Quoted 120 lines
README +2
-0+ instruction cache) is still performed. + - CONFIG_SPL_BUILD Modifies the behaviour of start.S when compiling a loader that is executed before the actual U-Boot. E.g. whenarch/arm/cpu/arm1136/start.S +2
-0@@ -82,6 +82,7 @@ cpu_init_crit: orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache mcr p15, 0, r0, c1, c0, 0 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY /* * Jump to board specific initialization... The Mask ROM will have already initialized * basic memory. Go here to bump up clock rate and handle wake up conditions.@@ -89,5 +90,6 @@ cpu_init_crit: mov ip, lr /* persevere link reg across call */ bl lowlevel_init /* go setup pll,mux,memory */ mov lr, ip /* restore link */ +#endif mov pc, lr /* back to my caller */ #endif /* CONFIG_SKIP_LOWLEVEL_INIT */arch/arm/cpu/arm920t/start.S +2
-1@@ -135,6 +135,7 @@ cpu_init_crit: orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache mcr p15, 0, r0, c1, c0, 0 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY /* * before relocating, we have to setup RAM timing * because memory timing is board-dependend, you will@@ -143,7 +144,7 @@ cpu_init_crit: mov ip, lr bl lowlevel_init - mov lr, ip +#endif mov pc, lr #endif /* CONFIG_SKIP_LOWLEVEL_INIT */arch/arm/cpu/arm926ejs/start.S +2
-0@@ -101,11 +101,13 @@ flush_dcache: #endif mcr p15, 0, r0, c1, c0, 0 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY /* * Go setup Memory and board specific bits prior to relocation. */ mov ip, lr /* perserve link reg across call */ bl lowlevel_init /* go setup pll,mux,memory */ mov lr, ip /* restore link */ +#endif mov pc, lr /* back to my caller */ #endif /* CONFIG_SKIP_LOWLEVEL_INIT */arch/arm/cpu/arm946es/start.S +2
-0@@ -90,11 +90,13 @@ cpu_init_crit: orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */ mcr p15, 0, r0, c1, c0, 0 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY /* * Go setup Memory and board specific bits prior to relocation. */ mov ip, lr /* perserve link reg across call */ bl lowlevel_init /* go setup memory */ mov lr, ip /* restore link */ +#endif mov pc, lr /* back to my caller */ #endifarch/arm/cpu/armv7/start.S +4
-1@@ -66,8 +66,10 @@ save_boot_params_ret: /* the mask ROM code should have PLL and others stable */ #ifndef CONFIG_SKIP_LOWLEVEL_INIT bl cpu_init_cp15 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY bl cpu_init_crit #endif +#endif bl _main@@ -250,7 +252,8 @@ skip_errata_621766: mov pc, r5 @ back to my caller ENDPROC(cpu_init_cp15) -#ifndef CONFIG_SKIP_LOWLEVEL_INIT +#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && \ + !defined(CONFIG_SKIP_LOWLEVEL_INIT_ONLY) /************************************************************************* * * CPU_init_critical registersarch/arm/cpu/sa1100/start.S +1
-0@@ -96,6 +96,7 @@ cpu_init_crit: ldr r1, cpuspeed str r1, [r0, #PPCR] +#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY /* * before relocating, we have to setup RAM timing * because memory timing is board-dependend, you will
arch/arm/cpu/sa1100/start.S cpu_init_crit: · line 111
Quoted 7 lines
arch/arm/cpu/sa1100/start.S +1
-0@@ -104,6 +105,7 @@ cpu_init_crit: mov ip, lr bl lowlevel_init mov lr, ip +#endif /* * disable MMU stuff and enable I-cache
PATCH v2 3/18 bootm: Align cache flush end address correctly
In reply to Simon GlassQuoted 24 lines · Simon Glass
Flushing part of the cache should be done on cache boundaries. Trying to flush part of a cache line is not supported and the request may be ignored or print warnings.
Adjust the bootm code to align the end address to prevent this problem.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>Reviewed-by Joe Hershberger <[email protected]>---
Changes in v2: None
common/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/bootm.c +0
-0
common/bootm.c static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end, · line 441
Quoted 8 lines
common/bootm.c +1
-1@@ -435,7 +435,7 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,bootstage_error (BOOTSTAGE_ID_DECOMP_IMAGE );return err; } -flush_cache (load, *load_end - load); +flush_cache (load,ALIGN (*load_end - load,ARCH_DMA_MINALIGN ));debug (" kernel loaded at 0x%08lx, end = 0x%08lx\n" , load, *load_end);bootstage_mark (BOOTSTAGE_ID_KERNEL_LOADED );
PATCH v2 5/18 net: macb: Prepare for driver-model conversion
In reply to Simon GlassQuoted 9 lines · Simon Glass
Adjust this driver to avoid using struct netdev in functions that driver model will call. Also refactor the receive function to be compatible with driver model.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>Reviewed-by Joe Hershberger <[email protected]>
Pretty sure I acked this last time...
PATCH v2 6/18 net: macb: Flush correct cache portion when sending
In reply to Simon GlassQuoted 7 lines · Simon Glass
The end address of the cache flush must be cache-line-aligned since otherwise (at least on ARM926-EJS) the request is ignored. When the cache is enabled this means that packets are not sent.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Acked-by Joe Hershberger <[email protected]>
Quoted 21 lines
---
Changes in v2: None
drivers/net/macb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/macb.c +1
-1@@ -280,7 +280,7 @@ static int _macb_send(struct macb_device *macb, const char *name, void *packet,barrier ();macb_flush_ring_desc (macb,TX );/* Do we need check paddr and length is dcache line aligned? */ -flush_dcache_range (paddr, paddr + length); +flush_dcache_range (paddr, paddr +ALIGN (length,ARCH_DMA_MINALIGN ));macb_writel (macb,NCR ,MACB_BIT (TE ) |MACB_BIT (RE ) |MACB_BIT (TSTART ));/*
PATCH v2 9/18 arm: at91: Add a header file for the real-time clock
In reply to Simon GlassQuoted 8 lines · Simon Glass
From: Andre Renaud <[email protected]>
Add register definitions for the AT91 RTC so that this can potentially be used in U-Boot.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>
PATCH v2 12/18 mtd: nand: Drop a blank line in nand_wait()
In reply to Simon GlassQuoted 6 lines · Simon Glass
From: Andre Renaud <[email protected]>
This empty line should not be there. Remove it.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>
PATCH v2 10/18 at91: Correct NAND ECC register access
In reply to Simon GlassQuoted 6 lines · Simon Glass
From: Andre Renaud <[email protected]>
This uses the wrote base register value. Fix it.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>
PATCH v2 11/18 at91: nand: Set up the ECC strength correctly
In reply to Simon GlassQuoted 6 lines · Simon Glass
From: Andre Renaud <[email protected]>
This needs to be set to avoid a fatal error when ECC is used.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>
PATCH v2 5/18 net: macb: Prepare for driver-model conversion
In reply to Simon GlassHi Simon,
Quoted 15 lines · Simon Glass
Adjust this driver to avoid using struct netdev in functions that driver model will call. Also refactor the receive function to be compatible with driver model.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>Reviewed-by Joe Hershberger <[email protected]>---
Changes in v2: None
drivers/net/macb.c | 199 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 124 insertions(+), 75 deletions(-)
<snip>
Quoted 19 lines
drivers/net/macb.c +2
-3-static int macb_phy_init (struct macb_device *macb) +static int macb_phy_init (struct macb_device *macb,const char *name) { -struct eth_device *netdev = &macb->netdev;#ifdef CONFIG_PHYLIB struct phy_device *phydev;#endif @@ -452,7 +450,7 @@ static int macb_phy_init(struct macb_device *macb)int media, speed, duplex;int i; -arch_get_mdio_control (netdev->name); +arch_get_mdio_control (name);#ifdef CONFIG_MACB_SEARCH_PHY /* Auto-detect phy_addr */ if (!macb_phy_find (macb))@@ -462,13 +460,13 @@ static int macb_phy_init(struct macb_device *macb)/* Check if the PHY is up to snuff... */ phy_id =macb_mdio_read (macb,MII_PHYSID1 );
drivers/net/macb.c static int macb_phy_init(struct macb_device *macb) · line 469
Quoted 10 lines
drivers/net/macb.c +2
-2if (phy_id ==0xffff ) { -printf ("%s: No PHY present\n" , netdev->name); +printf ("%s: No PHY present\n" , name);return 0 ; }#ifdef CONFIG_PHYLIB /* need to consider other phy interface mode */ - phydev = phy_connect(macb->bus, macb->phy_addr, netdev, + phydev = phy_connect(macb->bus, macb->phy_addr, &macb->netdev,
is this intentional? You removed every reference to netdev but retained this one.
Well, it's clear to me that you have to provide an eth_device to phy_connect() but why change the function then and add the *name to function parameters?
drivers/net/macb.c static int macb_phy_init(struct macb_device *macb) · line 472
Quoted 3 lines
drivers/net/macb.c +0
-0PHY_INTERFACE_MODE_RGMII);if (!phydev) {printf ("phy_connect failed\n" );
No more questions ...
PATCH v2 7/18 net: macb: Convert to driver model
In reply to Simon GlassQuoted 8 lines · Simon Glass
Add driver-model support to this driver. The old code remains for now so that we can convert boards one at a time.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>Acked-by Joe Hershberger <[email protected]>
PATCH v2 8/18 arm: at91: dts: Bring in device tree file for AT91SAM9G45
In reply to Simon GlassQuoted 6 lines · Simon Glass
Add this file from Linux v4.5.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>
PATCH v2 13/18 at91: Add driver-model GPIO devices for AT91SAM9G45
In reply to Simon GlassQuoted 6 lines · Simon Glass
Add these definitions so that GPIOs can be used with driver model.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>
PATCH v2 14/18 at91: mtd: nand: Add dev_warn() to correct build error in driver
In reply to Simon GlassHi Simon,
Quoted 16 lines · Simon Glass
The code does not compile if ECC is enabled.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
drivers/mtd/nand/atmel_nand.c | 2 ++ 1 file changed, 2 insertions(+)drivers/mtd/nand/atmel_nand.c +0
-0
drivers/mtd/nand/atmel_nand.c line 24
Quoted 5 lines
drivers/mtd/nand/atmel_nand.c +2
-0@@ -20,6 +20,8 @@#include <watchdog.h> #include <linux/mtd/nand_ecc.h> +#define dev_warn(dev, msg...) +
This change is good in general, but I think the better fix is to use dev_err() for the uncorrectable error and dev_dbg() for the rest.
Andreas
Quoted 4 lines
drivers/mtd/nand/atmel_nand.c +0
-0#ifdef CONFIG_ATMEL_NAND_HWECC /* Register access macros */
PATCH v2 15/18 at91: video: Prepare for driver-model conversion
In reply to Simon GlassQuoted 5 lines · Simon Glass
Adjust the driver to use struct
display_timingfor its display timing. This is what is used by driver-model and allows the LCD init code to be common.Signed-off-by Simon Glass <[email protected]>
Quoted 186 lines
---
Changes in v2: None
drivers/video/atmel_lcdfb.c | 106 +++++++++++++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 36 deletions(-)drivers/video/atmel_lcdfb.c +70
-36@@ -7,6 +7,7 @@*/ #include <common.h> +#include <fdtdec.h> #include <asm/io.h> #include <asm/arch/gpio.h> #include <asm/arch/clk.h> @@ -91,39 +92,41 @@ void lcd_set_cmap(struct bmp_image *bmp, unsigned colors) } } -void lcd_ctrl_init (void *lcdbase) +static void atmel_fb_init (ulong addr,struct display_timing *timing,int bpix, +bool tft,bool cont_pol_low,ulong lcdbase) {unsigned long value; +void *reg = (void *)addr;/* Turn off the LCD controller and the DMA controller */ -lcdc_writel (panel_info.mmio,ATMEL_LCDC_PWRCON , +lcdc_writel (reg,ATMEL_LCDC_PWRCON ,ATMEL_LCDC_GUARD_TIME <<ATMEL_LCDC_GUARDT_OFFSET );/* Wait for the LCDC core to become idle */ -while (lcdc_readl (panel_info.mmio,ATMEL_LCDC_PWRCON ) &ATMEL_LCDC_BUSY ) +while (lcdc_readl (reg,ATMEL_LCDC_PWRCON ) &ATMEL_LCDC_BUSY )udelay (10 ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_DMACON ,0 ); +lcdc_writel (reg,ATMEL_LCDC_DMACON ,0 );/* Reset LCDC DMA */ -lcdc_writel (panel_info.mmio,ATMEL_LCDC_DMACON ,ATMEL_LCDC_DMARST ); +lcdc_writel (reg,ATMEL_LCDC_DMACON ,ATMEL_LCDC_DMARST );/* ...set frame size and burst length = 8 words (?) */ - value = (panel_info.vl_col * panel_info.vl_row * -NBITS (panel_info.vl_bpix)) /32 ; + value = (timing->hactive.typ * timing->vactive.typ * + (1 << bpix)) /32 ; value |= ((ATMEL_LCDC_DMA_BURST_LEN -1 ) <<ATMEL_LCDC_BLENGTH_OFFSET ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_DMAFRMCFG , value); +lcdc_writel (reg,ATMEL_LCDC_DMAFRMCFG , value);/* Set pixel clock */ - value =get_lcdc_clk_rate (0 ) / panel_info.vl_clk; -if (get_lcdc_clk_rate (0 ) % panel_info.vl_clk) + value =get_lcdc_clk_rate (0 ) / timing->pixelclock.typ; +if (get_lcdc_clk_rate (0 ) % timing->pixelclock.typ) value++; value = (value /2 ) -1 ;if (!value) { -lcdc_writel (panel_info.mmio,ATMEL_LCDC_LCDCON1 ,ATMEL_LCDC_BYPASS ); +lcdc_writel (reg,ATMEL_LCDC_LCDCON1 ,ATMEL_LCDC_BYPASS ); }else -lcdc_writel (panel_info.mmio,ATMEL_LCDC_LCDCON1 , +lcdc_writel (reg,ATMEL_LCDC_LCDCON1 , value <<ATMEL_LCDC_CLKVAL_OFFSET );/* Initialize control register 2 */ @@ -132,56 +135,87 @@ void lcd_ctrl_init(void *lcdbase)#else value =ATMEL_LCDC_MEMOR_LITTLE |ATMEL_LCDC_CLKMOD_ALWAYSACTIVE ;#endif -if (panel_info.vl_tft) +if (tft) value |=ATMEL_LCDC_DISTYPE_TFT ; - value |= panel_info.vl_sync; - value |= (panel_info.vl_bpix <<5 ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_LCDCON2 , value); +if (!(timing->flags &DISPLAY_FLAGS_HSYNC_HIGH )) + value |=ATMEL_LCDC_INVLINE_INVERTED ; +if (!(timing->flags &DISPLAY_FLAGS_VSYNC_HIGH )) + value |=ATMEL_LCDC_INVFRAME_INVERTED ; + value |= bpix <<5 ; +lcdc_writel (reg,ATMEL_LCDC_LCDCON2 , value);/* Vertical timing */ - value = (panel_info.vl_vsync_len -1 ) <<ATMEL_LCDC_VPW_OFFSET ; - value |= panel_info.vl_upper_margin <<ATMEL_LCDC_VBP_OFFSET ; - value |= panel_info.vl_lower_margin; -lcdc_writel (panel_info.mmio,ATMEL_LCDC_TIM1 , value); + value = (timing->vsync_len.typ -1 ) <<ATMEL_LCDC_VPW_OFFSET ; + value |= timing->vback_porch.typ <<ATMEL_LCDC_VBP_OFFSET ; + value |= timing->vfront_porch.typ; +/* Magic! (Datasheet says "Bit 31 must be written to 1") */ + value |=1U <<31 ; +lcdc_writel (reg,ATMEL_LCDC_TIM1 , value);/* Horizontal timing */ - value = (panel_info.vl_right_margin -1 ) <<ATMEL_LCDC_HFP_OFFSET ; - value |= (panel_info.vl_hsync_len -1 ) <<ATMEL_LCDC_HPW_OFFSET ; - value |= (panel_info.vl_left_margin -1 ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_TIM2 , value); + value = (timing->hfront_porch.typ -1 ) <<ATMEL_LCDC_HFP_OFFSET ; + value |= (timing->hsync_len.typ -1 ) <<ATMEL_LCDC_HPW_OFFSET ; + value |= (timing->hback_porch.typ -1 ); +lcdc_writel (reg,ATMEL_LCDC_TIM2 , value);/* Display size */ - value = (panel_info.vl_col -1 ) <<ATMEL_LCDC_HOZVAL_OFFSET ; - value |= panel_info.vl_row -1 ; -lcdc_writel (panel_info.mmio,ATMEL_LCDC_LCDFRMCFG , value); + value = (timing->hactive.typ -1 ) <<ATMEL_LCDC_HOZVAL_OFFSET ; + value |= timing->vactive.typ -1 ; +lcdc_writel (reg,ATMEL_LCDC_LCDFRMCFG , value);/* FIFO Threshold: Use formula from data sheet */ value =ATMEL_LCDC_FIFO_SIZE - (2 *ATMEL_LCDC_DMA_BURST_LEN +3 ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_FIFO , value); +lcdc_writel (reg,ATMEL_LCDC_FIFO , value);/* Toggle LCD_MODE every frame */ -lcdc_writel (panel_info.mmio,ATMEL_LCDC_MVAL ,0 ); +lcdc_writel (reg,ATMEL_LCDC_MVAL ,0 );/* Disable all interrupts */ -lcdc_writel (panel_info.mmio,ATMEL_LCDC_IDR , ~0UL ); +lcdc_writel (reg,ATMEL_LCDC_IDR , ~0UL );/* Set contrast */ value =ATMEL_LCDC_PS_DIV8 |ATMEL_LCDC_ENA_PWMENABLE ; -if (!panel_info.vl_cont_pol_low) +if (!cont_pol_low) value |=ATMEL_LCDC_POL_POSITIVE ; -lcdc_writel (panel_info.mmio,ATMEL_LCDC_CONTRAST_CTR , value); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_CONTRAST_VAL ,ATMEL_LCDC_CVAL_DEFAULT ); +lcdc_writel (reg,ATMEL_LCDC_CONTRAST_CTR , value); +lcdc_writel (reg,ATMEL_LCDC_CONTRAST_VAL ,ATMEL_LCDC_CVAL_DEFAULT );/* Set framebuffer DMA base address and pixel offset */ -lcdc_writel (panel_info.mmio,ATMEL_LCDC_DMABADDR1 , (u_long )lcdbase); +lcdc_writel (reg,ATMEL_LCDC_DMABADDR1 , lcdbase); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_DMACON ,ATMEL_LCDC_DMAEN ); -lcdc_writel (panel_info.mmio,ATMEL_LCDC_PWRCON , +lcdc_writel (reg,ATMEL_LCDC_DMACON ,ATMEL_LCDC_DMAEN ); +lcdc_writel (reg,ATMEL_LCDC_PWRCON , (ATMEL_LCDC_GUARD_TIME <<ATMEL_LCDC_GUARDT_OFFSET ) |ATMEL_LCDC_PWR ); } +void lcd_ctrl_init (void *lcdbase) +{ +struct display_timing timing; + + timing.flags =0 ; +if (!(panel_info.vl_sync &ATMEL_LCDC_INVLINE_INVERTED )) + timing.flags |=DISPLAY_FLAGS_HSYNC_HIGH ; +if (!(panel_info.vl_sync &ATMEL_LCDC_INVFRAME_INVERTED )) + timing.flags |=DISPLAY_FLAGS_VSYNC_LOW ; + timing.pixelclock.typ = panel_info.vl_clk; + + timing.hactive.typ = panel_info.vl_col; + timing.hfront_porch.typ = panel_info.vl_right_margin; + timing.hback_porch.typ = panel_info.vl_left_margin; + timing.hsync_len.typ = panel_info.vl_hsync_len; + + timing.vactive.typ = panel_info.vl_row; + timing.vfront_porch.typ = panel_info.vl_clk; + timing.vback_porch.typ = panel_info.vl_clk; + timing.vsync_len.typ = panel_info.vl_clk; + +atmel_fb_init (panel_info.mmio, &timing, panel_info.vl_bpix, + panel_info.vl_tft, panel_info.vl_cont_pol_low, + (ulong )lcdbase); +} +ulong calc_fbsize (void ) { return ((panel_info.vl_col * panel_info.vl_row *
PATCH v2 16/18 at91: video: Support driver-model for the LCD driver
In reply to Simon GlassQuoted 4 lines · Simon Glass
Add driver-model support to this driver. Most features can be controlled from the device tree.
Signed-off-by Simon Glass <[email protected]>
Quoted 164 lines
---
Changes in v2: None
drivers/video/atmel_lcdfb.c | 91 +++++++++++++++++++++++++++++++++++++++++++++ include/atmel_lcd.h | 9 +++++ 2 files changed, 100 insertions(+)drivers/video/atmel_lcdfb.c +91
-0@@ -7,7 +7,10 @@*/ #include <common.h> +#include <atmel_lcd.h> +#include <dm.h> #include <fdtdec.h> +#include <video.h> #include <asm/io.h> #include <asm/arch/gpio.h> #include <asm/arch/clk.h> @@ -15,6 +18,21 @@#include <bmp_layout.h> #include <atmel_lcdc.h> +DECLARE_GLOBAL_DATA_PTR ; + +#ifdef CONFIG_DM_VIDEO +enum { +/* Maximum LCD size we support */ +LCD_MAX_WIDTH =1366 , +LCD_MAX_HEIGHT =768 , +LCD_MAX_LOG2_BPP =VIDEO_BPP16 , +}; +#endif + +struct atmel_fb_priv { +struct display_timing timing; +}; +/* configurable parameters */ #define ATMEL_LCDC_CVAL_DEFAULT 0xc8#define ATMEL_LCDC_DMA_BURST_LEN 8@@ -31,6 +49,7 @@#define lcdc_readl (mmio, reg) __raw_readl((mmio)+(reg))#define lcdc_writel (mmio, reg, val) __raw_writel((val), (mmio)+(reg)) +#ifndef CONFIG_DM_VIDEO ushort *configuration_get_cmap (void ) {return (ushort *)(panel_info.mmio +ATMEL_LCDC_LUT (0 ));@@ -91,6 +110,7 @@ void lcd_set_cmap(struct bmp_image *bmp, unsigned colors) lcd_setcolreg(i, cte.red, cte.green, cte.blue); } } +#endif static void atmel_fb_init (ulong addr,struct display_timing *timing,int bpix,bool tft,bool cont_pol_low,ulong lcdbase)@@ -190,6 +210,7 @@ static void atmel_fb_init(ulong addr, struct display_timing *timing, int bpix, (ATMEL_LCDC_GUARD_TIME << ATMEL_LCDC_GUARDT_OFFSET) | ATMEL_LCDC_PWR); } +#ifndef CONFIG_DM_VIDEO void lcd_ctrl_init (void *lcdbase) {struct display_timing timing;@@ -221,3 +242,73 @@ ulong calc_fbsize(void)return ((panel_info.vl_col * panel_info.vl_row *NBITS (panel_info.vl_bpix)) /8 ) +PAGE_SIZE ; } +#endif + +#ifdef CONFIG_DM_VIDEO +static int atmel_fb_lcd_probe (struct udevice *dev) +{ +struct video_uc_platdata *uc_plat =dev_get_uclass_platdata (dev); +struct video_priv *uc_priv =dev_get_uclass_priv (dev); +struct atmel_fb_priv *priv =dev_get_priv (dev); +struct display_timing *timing = &priv->timing; + +/* +* For now some values are hard-coded. We could use the device tree +* bindings in simple-framebuffer.txt to specify the format/bpp and +* some Atmel-specific binding for tft and cont_pol_low. +*/ +atmel_fb_init (ATMEL_BASE_LCDC , timing,VIDEO_BPP16 , true, false, + uc_plat->base); + uc_priv->xsize = timing->hactive.typ; + uc_priv->ysize = timing->vactive.typ; + uc_priv->bpix =VIDEO_BPP16 ; +video_set_flush_dcache (dev, true); +debug ("LCD frame buffer at %lx, size %x, %dx%d pixels\n" , uc_plat->base, + uc_plat->size, uc_priv->xsize, uc_priv->ysize); + +return 0 ; +} + +static int atmel_fb_ofdata_to_platdata (struct udevice *dev) +{ +struct atmel_lcd_platdata *plat =dev_get_platdata (dev); +struct atmel_fb_priv *priv =dev_get_priv (dev); +struct display_timing *timing = &priv->timing; +const void *blob = gd->fdt_blob; + +if (fdtdec_decode_display_timing (blob, dev->of_offset, + plat->timing_index, timing)) { +debug ("%s: Failed to decode display timing\n" , __func__); +return -EINVAL ; + } + +return 0 ; +} + +static int atmel_fb_lcd_bind (struct udevice *dev) +{ +struct video_uc_platdata *uc_plat =dev_get_uclass_platdata (dev); + + uc_plat->size =LCD_MAX_WIDTH *LCD_MAX_HEIGHT * + (1 <<VIDEO_BPP16 ) /8 ; +debug ("%s: Frame buffer size %x\n" , __func__, uc_plat->size); + +return 0 ; +} + +static const struct udevice_id atmel_fb_lcd_ids[] = { + { .compatible ="atmel,at91sam9g45-lcdc" }, + { } +}; + +U_BOOT_DRIVER (atmel_fb) = { + .name ="atmel_fb" , + .id =UCLASS_VIDEO , + .of_match = atmel_fb_lcd_ids, + .bind = atmel_fb_lcd_bind, + .ofdata_to_platdata = atmel_fb_ofdata_to_platdata, + .probe = atmel_fb_lcd_probe, + .platdata_auto_alloc_size =sizeof (struct atmel_lcd_platdata ), + .priv_auto_alloc_size =sizeof (struct atmel_fb_priv ), +}; +#endif include/atmel_lcd.h +9
-0@@ -10,6 +10,15 @@ #ifndef _ATMEL_LCD_H_ #define _ATMEL_LCD_H_ +/** + * struct atmel_lcd_platdata - platform data for Atmel LCDs with driver model + * + * @timing_index: Index of LCD timing to use in device tree node + */ +struct atmel_lcd_platdata { + int timing_index; +}; + typedef struct vidinfo { ushort vl_col; /* Number of columns (i.e. 640) */ ushort vl_row; /* Number of rows (i.e. 480) */
PATCH v2 17/18 fdt: Correct return value in fdtdec_decode_display_timing()
In reply to Simon GlassQuoted 4 lines · Simon Glass
This should return a non-zero value if there is a missing property. Update the return value accordingly. The only expected error is -FDT_ERR_NOTFOUND.
Signed-off-by Simon Glass <[email protected]>
Quoted 21 lines
---
Changes in v2: None
lib/fdtdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/fdtdec.c +1
-1@@ -1169,7 +1169,7 @@ int fdtdec_decode_display_timing(const void *blob, int parent, int index,if (fdtdec_get_bool (blob, node,"doubleclk" )) dt->flags |=DISPLAY_FLAGS_DOUBLECLK ; -return 0 ; +return ret; }int fdtdec_setup (void )
PATCH 1/1 linux/compat.h: add dev_warn()
In reply to Simon GlassIn order to prevent build errors for copied code from linux introduce dev_warn().
---
This is a replacement patch for '[PATCH v2 14/18] at91: mtd: nand: Add dev_warn() to correct build error in driver'
include/linux/compat.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/compat.h +2 -0
@@ -25,6 +25,8 @@ extern struct p_current *current; printf(fmt, ##args) #define dev_err(dev, fmt, args...) \ printf(fmt, ##args) +#define dev_warn(dev, fmt, args...) \ + printf(fmt, ##args) #define printk printf #define printk_once printf
Signature · 1 line
2.7.4 (Apple Git-66)
PATCH v2 18/18 arm: at91: Add support for gurnard
In reply to Simon GlassQuoted 8 lines · Simon Glass
From: Andre Renaud <[email protected]>
This board is based on Snapper 9G45 which has an Atmel AT91SAM9G45 chip and 128MB of SDRAM. It includes a small LCD, 2xUSB host, SD card, Ethernet and two UARTs.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>
PATCH 1/1 linux/compat.h: add dev_warn()
In reply to Andreas BießmannQuoted 11 lines · Andreas Bie?mann
In order to prevent build errors for copied code from linux introduce
dev_warn().Suggested-by Scott Wood <[email protected]>Signed-off-by Andreas Bie?mann <[email protected]>---
This is a replacement patch for '[PATCH v2 14/18] at91: mtd: nand: Adddev_warn()to correct build error in driver'include/linux/compat.h | 2 ++ 1 file changed, 2 insertions(+)
PATCH v2 1/18 at91: Add support for the AT91 slow clock controller
In reply to Simon GlassDear Simon Glass,
Quoted 9 lines · Simon Glass
From: Andre Renaud <[email protected]>
This is available on AT91SAM9G45. Add the peripheral address and flag definitions.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>
Quoted 8 lines
---
Changes in v2: None
arch/arm/mach-at91/include/mach/at91_sck.h| 21 +++++++++++++++++++++arch/arm/mach-at91/include/mach/at91sam9g45.h| 1 +2 files changed, 22 insertions(+)create mode 100644
arch/arm/mach-at91/include/mach/at91_sck.h
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 2/18 arm: Allow skipping of low-level init with I-cache on
In reply to Simon GlassDear Simon Glass,
Quoted 17 lines · Simon Glass
At present
CONFIG_SKIP_LOWLEVEL_INITprevents U-Boot from callinglowlevel_init(). This means that the instruction cache is not enabled and the board runs very slowly.What is really needed in many cases is to skip the call to
lowlevel_init()but still perform CP15 init. Add an option to handle this.Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>Reviewed-by Joe Hershberger <[email protected]>Signed-off-by Simon Glass <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>---
Changes in v2: None
Quoted 8 lines
README | 5 +++++ arch/arm/cpu/arm1136/start.S | 2 ++ arch/arm/cpu/arm920t/start.S | 3 ++- arch/arm/cpu/arm926ejs/start.S | 2 ++ arch/arm/cpu/arm946es/start.S | 2 ++ arch/arm/cpu/armv7/start.S | 5 ++++- arch/arm/cpu/sa1100/start.S | 2 ++ 7 files changed, 19 insertions(+), 2 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 3/18 bootm: Align cache flush end address correctly
In reply to Simon GlassDear Simon Glass,
Quoted 12 lines · Simon Glass
Flushing part of the cache should be done on cache boundaries. Trying to flush part of a cache line is not supported and the request may be ignored or print warnings.
Adjust the bootm code to align the end address to prevent this problem.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>Reviewed-by Joe Hershberger <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>
Quoted 6 lines
---
Changes in v2: None
common/bootm.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 4/18 net: Handle an empty bootp extension section
In reply to Simon GlassDear Simon Glass,
Quoted 7 lines · Simon Glass
From: Andre Renaud <[email protected]>
Avoid generating this section if there is nothing in it.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>Acked-by Joe Hershberger <[email protected]>
Quoted 6 lines
---
Changes in v2: None
net/bootp.c| 9 +++++++++1 file changed, 9 insertions(+)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 5/18 net: macb: Prepare for driver-model conversion
In reply to Simon GlassDear Simon Glass,
Quoted 11 lines · Simon Glass
Adjust this driver to avoid using struct netdev in functions that driver model will call. Also refactor the receive function to be compatible with driver model.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>Reviewed-by Joe Hershberger <[email protected]>Acked-by Joe Hershberger <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>
Quoted 6 lines
---
Changes in v2: None
drivers/net/macb.c| 199 +++++++++++++++++++++++++++++++++--------------------1 file changed, 124 insertions(+), 75 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 6/18 net: macb: Flush correct cache portion when sending
In reply to Simon GlassDear Simon Glass,
Quoted 8 lines · Simon Glass
The end address of the cache flush must be cache-line-aligned since otherwise (at least on ARM926-EJS) the request is ignored. When the cache is enabled this means that packets are not sent.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Acked-by Joe Hershberger <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>
Quoted 6 lines
---
Changes in v2: None
drivers/net/macb.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 7/18 net: macb: Convert to driver model
In reply to Simon GlassDear Simon Glass,
Quoted 9 lines · Simon Glass
Add driver-model support to this driver. The old code remains for now so that we can convert boards one at a time.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>Acked-by Joe Hershberger <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>
Quoted 6 lines
---
Changes in v2: None
drivers/net/macb.c| 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++1 file changed, 119 insertions(+)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 8/18 arm: at91: dts: Bring in device tree file for AT91SAM9G45
In reply to Simon GlassDear Simon Glass,
Quoted 17 lines · Simon Glass
Add this file from Linux v4.5.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>---
Changes in v2: None
arch/arm/dts/Makefile | 1 + arch/arm/dts/at91sam9g45.dtsi | 1335 ++++++++++++++++++++++++++++++++++++ include/dt-bindings/clock/at91.h | 23 + include/dt-bindings/dma/at91.h | 52 ++ include/dt-bindings/pinctrl/at91.h | 40 ++ 5 files changed, 1451 insertions(+)
Quoted 4 lines
create mode 100644
arch/arm/dts/at91sam9g45.dtsicreate mode 100644include/dt-bindings/clock/at91.hcreate mode 100644include/dt-bindings/dma/at91.hcreate mode 100644include/dt-bindings/pinctrl/at91.h
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 9/18 arm: at91: Add a header file for the real-time clock
In reply to Simon GlassDear Simon Glass,
Quoted 9 lines · Simon Glass
From: Andre Renaud <[email protected]>
Add register definitions for the AT91 RTC so that this can potentially be used in U-Boot.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>
Quoted 7 lines
---
Changes in v2: None
arch/arm/mach-at91/include/mach/at91_rtc.h| 71 ++++++++++++++++++++++++++++++1 file changed, 71 insertions(+)create mode 100644
arch/arm/mach-at91/include/mach/at91_rtc.h
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 10/18 at91: Correct NAND ECC register access
In reply to Simon GlassDear Simon Glass,
Quoted 7 lines · Simon Glass
From: Andre Renaud <[email protected]>
This uses the wrote base register value. Fix it.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>
Quoted 6 lines
---
Changes in v2: None
drivers/mtd/nand/atmel_nand.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 11/18 at91: nand: Set up the ECC strength correctly
In reply to Simon GlassDear Simon Glass,
Quoted 7 lines · Simon Glass
From: Andre Renaud <[email protected]>
This needs to be set to avoid a fatal error when ECC is used.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>
Quoted 6 lines
---
Changes in v2: None
drivers/mtd/nand/atmel_nand.c| 1 +1 file changed, 1 insertion(+)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 13/18 at91: Add driver-model GPIO devices for AT91SAM9G45
In reply to Simon GlassDear Simon Glass,
Quoted 5 lines · Simon Glass
Add these definitions so that GPIOs can be used with driver model.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Quoted 8 lines
Tested-by Heiko Schocher <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>---
Changes in v2: None
arch/arm/mach-at91/arm926ejs/at91sam9m10g45_devices.c| 18 ++++++++++++++++++1 file changed, 18 insertions(+)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
[U-Boot] linux/compat.h: add dev_warn()
In reply to Andreas BießmannDear =?utf-8?q?Andreas_Bie=C3=9Fmann?=,
Quoted 6 lines · <[email protected]> writes:
In order to prevent build errors for copied code from linux introduce
dev_warn().Suggested-by Scott Wood <[email protected]>Signed-off-by Andreas Bie?mann <[email protected]>Acked-by Simon Glass <[email protected]>
Quoted 6 lines
---
This is a replacement patch for '[PATCH v2 14/18] at91: mtd: nand: Adddev_warn()to correct build error in driver'
include/linux/compat.h| 2 ++1 file changed, 2 insertions(+)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 15/18 at91: video: Prepare for driver-model conversion
In reply to Simon GlassDear Simon Glass,
Quoted 4 lines · Simon Glass
Adjust the driver to use struct
display_timingfor its display timing. This is what is used by driver-model and allows the LCD init code to be common.
Quoted 8 lines
Signed-off-by Simon Glass <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>---
Changes in v2: None
drivers/video/atmel_lcdfb.c| 106 +++++++++++++++++++++++++++++---------------1 file changed, 70 insertions(+), 36 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 16/18 at91: video: Support driver-model for the LCD driver
In reply to Simon GlassDear Simon Glass,
Quoted 5 lines · Simon Glass
Add driver-model support to this driver. Most features can be controlled from the device tree.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>
Quoted 7 lines
---
Changes in v2: None
drivers/video/atmel_lcdfb.c| 91 +++++++++++++++++++++++++++++++++++++++++++++include/atmel_lcd.h| 9 +++++2 files changed, 100 insertions(+)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 17/18 fdt: Correct return value in fdtdec_decode_display_timing()
In reply to Simon GlassDear Simon Glass,
Quoted 11 lines · Simon Glass
This should return a non-zero value if there is a missing property. Update the return value accordingly. The only expected error is -FDT_ERR_NOTFOUND.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>---
Changes in v2: None
lib/fdtdec.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 18/18 arm: at91: Add support for gurnard
In reply to Simon GlassDear Simon Glass,
Quoted 27 lines · Simon Glass
From: Andre Renaud <[email protected]>
This board is based on Snapper 9G45 which has an Atmel AT91SAM9G45 chip and 128MB of SDRAM. It includes a small LCD, 2xUSB host, SD card, Ethernet and two UARTs.
Signed-off-by Andre Renaud <[email protected]>Signed-off-by Simon Glass <[email protected]>Reviewed-by Andreas Bie?mann <[email protected]>[apply CONFIG_BOOTDELAY transition]Signed-off-by Andreas Bie?mann <[email protected]>---
Changes in v2:
- Correct commit author in several cases
- Rebase to masterarch/arm/dts/at91sam9g45-gurnard.dts | 157 ++ arch/arm/mach-at91/Kconfig | 9 + board/bluewater/gurnard/Kconfig | 12 + board/bluewater/gurnard/MAINTAINERS | 6 + board/bluewater/gurnard/Makefile | 11 + board/bluewater/gurnard/gurnard.c | 449 ++++++ board/bluewater/gurnard/splash_logo.h | 2619 +++++++++++++++++++++++++++++++++ configs/gurnard_defconfig | 19 + include/configs/snapper9g45.h | 156 ++ 9 files changed, 3438 insertions(+)
Quoted 8 lines
create mode 100644
arch/arm/dts/at91sam9g45-gurnard.dtscreate mode 100644 board/bluewater/gurnard/Kconfig create mode 100644 board/bluewater/gurnard/MAINTAINERS create mode 100644 board/bluewater/gurnard/Makefile create mode 100644board/bluewater/gurnard/gurnard.ccreate mode 100644board/bluewater/gurnard/splash_logo.hcreate mode 100644 configs/gurnard_defconfig create mode 100644include/configs/snapper9g45.h
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann
PATCH v2 5/18 net: macb: Prepare for driver-model conversion
In reply to Andreas BießmannHi Andreas,
Quoted 57 lines · Andreas Bie?mann
Hi Simon,
Quoted 15 lines · Simon Glass
Adjust this driver to avoid using struct netdev in functions that driver model will call. Also refactor the receive function to be compatible with driver model.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heiko Schocher <[email protected]>Tested-on: smartweb, corvus, taurus, axm
Tested-by Heiko Schocher <[email protected]>Reviewed-by Joe Hershberger <[email protected]>---
Changes in v2: None
drivers/net/macb.c | 199 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 124 insertions(+), 75 deletions(-)<snip>
Quoted 19 lines
drivers/net/macb.c +2
-3-static int macb_phy_init (struct macb_device *macb) +static int macb_phy_init (struct macb_device *macb,const char *name) { -struct eth_device *netdev = &macb->netdev;#ifdef CONFIG_PHYLIB struct phy_device *phydev;#endif @@ -452,7 +450,7 @@ static int macb_phy_init(struct macb_device *macb)int media, speed, duplex;int i; -arch_get_mdio_control (netdev->name); +arch_get_mdio_control (name);#ifdef CONFIG_MACB_SEARCH_PHY /* Auto-detect phy_addr */ if (!macb_phy_find (macb))@@ -462,13 +460,13 @@ static int macb_phy_init(struct macb_device *macb)/* Check if the PHY is up to snuff... */ phy_id =macb_mdio_read (macb,MII_PHYSID1 );drivers/net/macb.c static int macb_phy_init(struct macb_device *macb) · line 469
Quoted 10 lines
drivers/net/macb.c +2
-2if (phy_id ==0xffff ) { -printf ("%s: No PHY present\n" , netdev->name); +printf ("%s: No PHY present\n" , name);return 0 ; }#ifdef CONFIG_PHYLIB /* need to consider other phy interface mode */ - phydev = phy_connect(macb->bus, macb->phy_addr, netdev, + phydev = phy_connect(macb->bus, macb->phy_addr, &macb->netdev,is this intentional? You removed every reference to netdev but retained this one.
Well, it's clear to me that you have to provide aneth_devicetophy_connect()but why change the function then and add the *name to function parameters?
Quoted 7 lines
drivers/net/macb.c static int macb_phy_init(struct macb_device *macb) · line 472
Quoted 3 lines
drivers/net/macb.c +0
-0PHY_INTERFACE_MODE_RGMII);if (!phydev) {printf ("phy_connect failed\n" );No more questions ...
Reviewed-by Andreas Bie?mann <[email protected]>
Sorry for missing this. Actually this will need tweaking - I think Joe pointed out that CONFIG_PHYLIB should not be used in modern code. But in any case it is closer to converted (to driver model) than it was. I think when something tries this out on a board that uses that they can fix it and test. It will need to call phy_connect_dev() instead.
Regards,
Simon