Re: [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature
Hi Thomas, On 10/26/2011 04:07 AM, Thomas Chou wrote: I forwarded your patches to Dalon Westergreen of Altera on Oct 20, who is the author of this driver. I asked Dalon to help to review your patches. Thanks. May I suggest, that Dalon adds his email address to the legal header? I just saw Altera there - no mail address, when I submitted the patchset. So I included only you, Thomas. I run checkpatch.pl and there are minors warnings. You may fix them after we get feedback from Dalon. I just did it immediately, so they are out of the way ;-), see new PATCH set - including other really, really minor stuff. I am going to test your patches on 3C120 and NEEK boards. And will let you know my results. Ok, thanks. -- Joachim Foerster Missing Link Electronics http://www.missinglinkelectronics.com Office EU: +49 (731) 141-149-0 Office US: +1 (408) 457-0700 email: joachim.foers...@missinglinkelectronics.com ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/5 v2] altera_tse: Several small, but relevant fixes/feature
This patch series comprises small, but relevant fixes, regarding the driver for Altera's TSE ip core. They are needed to make it run on a Terasic DE4 board. The new feature is the support for dedicated descriptor memory. Joachim Foerster (5): altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync case altera_tse: Fix SGDMA reset triggering altera_tse: Add support for dedicated descriptor memory altera_tse: m88es: Honor device flags regarding PHY interface mode altera_tse: Fix return of eth_device's recv() callback Changes for v2: - Fix checkpatch.pl warnings about brace around single-if-statements, PATCH 4/5 - Fix typo in added comment in code, PATCH 1/5 - Really minor commit message style fixes: - Remove periods from end of summary lines - Improve commit messages in PATCH 2/5 and 5/5 board/altera/nios2-generic/nios2-generic.c | 10 +- drivers/net/altera_tse.c | 45 ++- include/netdev.h |3 +- 3 files changed, 47 insertions(+), 11 deletions(-) -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/5 v2] altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync case
Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- Changes for v2: - Remove period from end of summary line - Fix typo in added comment in code drivers/net/altera_tse.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index 54a944b..47d0047 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -199,6 +199,12 @@ static int alt_sgdma_do_async_transfer(volatile struct alt_sgdma_registers *dev, debug(Timeout waiting sgdma in do async!\n); /* +* Clear the RUN bit in the control register. This is needed +* to restart the SGDMA engine later on. +*/ + dev-control = 0; + + /* * Clear any (previous) status register information * that might occlude our error checking later. */ -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/5 v2] altera_tse: Fix SGDMA reset triggering
The SW_RESET needs to be set instead of being masked out! Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- Changes for v2: - Remove period from end of summary line - Be more specific in commit message drivers/net/altera_tse.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index 47d0047..47b5761 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -357,8 +357,8 @@ static void tse_eth_reset(struct eth_device *dev) if (counter = ALT_TSE_SGDMA_BUSY_WATCHDOG_CNTR) { debug(Timeout waiting for rx sgdma!\n); - rx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; - rx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; + rx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; + rx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; } counter = 0; @@ -370,8 +370,8 @@ static void tse_eth_reset(struct eth_device *dev) if (counter = ALT_TSE_SGDMA_BUSY_WATCHDOG_CNTR) { debug(Timeout waiting for tx sgdma!\n); - tx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; - tx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; + tx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; + tx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; } /* reset the mac */ mac_dev-command_config.bits.transmit_enable = 1; -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/5 v2] altera_tse: Add support for dedicated descriptor memory
Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- Changes for v2: - Remove period from end of summary line board/altera/nios2-generic/nios2-generic.c | 10 +- drivers/net/altera_tse.c | 19 --- include/netdev.h |3 ++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c index 220a4c4..49ef80d 100644 --- a/board/altera/nios2-generic/nios2-generic.c +++ b/board/altera/nios2-generic/nios2-generic.c @@ -74,7 +74,15 @@ int board_eth_init(bd_t *bis) rc += altera_tse_initialize(0, CONFIG_SYS_ALTERA_TSE_MAC_BASE, CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE, - CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE); + CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE, +#if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) \ + (CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE 0) + CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE, + CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE); +#else + 0, + 0); +#endif #endif #ifdef CONFIG_ETHOC rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE); diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index 47b5761..afd8e31 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -882,7 +882,8 @@ static int tse_eth_init(struct eth_device *dev, bd_t * bd) /* TSE init code */ int altera_tse_initialize(u8 dev_num, int mac_base, - int sgdma_rx_base, int sgdma_tx_base) + int sgdma_rx_base, int sgdma_tx_base, + u32 sgdma_desc_base, u32 sgdma_desc_size) { struct altera_tse_priv *priv; struct eth_device *dev; @@ -903,8 +904,20 @@ int altera_tse_initialize(u8 dev_num, int mac_base, free(dev); return 0; } - tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX), -dma_handle); + if (sgdma_desc_size) { + if (sgdma_desc_size (sizeof(*tx_desc) * (3 + PKTBUFSRX))) { + printf(ALTERA_TSE-%hu: + descriptor memory is too small\n, dev_num); + free(priv); + free(dev); + return 0; + } + tx_desc = (struct alt_sgdma_descriptor *)sgdma_desc_base; + } else { + tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX), +dma_handle); + } + rx_desc = tx_desc + 2; debug(tx desc: address = 0x%x\n, (unsigned int)tx_desc); debug(rx desc: address = 0x%x\n, (unsigned int)rx_desc); diff --git a/include/netdev.h b/include/netdev.h index 54b52a5..04d9f75 100644 --- a/include/netdev.h +++ b/include/netdev.h @@ -42,7 +42,8 @@ int cpu_eth_init(bd_t *bis); /* Driver initialization prototypes */ int altera_tse_initialize(u8 dev_num, int mac_base, - int sgdma_rx_base, int sgdma_tx_base); + int sgdma_rx_base, int sgdma_tx_base, + u32 sgdma_desc_base, u32 sgdma_desc_size); int at91emac_register(bd_t *bis, unsigned long iobase); int au1x00_enet_initialize(bd_t*); int ax88180_initialize(bd_t *bis); -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 4/5 v2] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode
Note: This is kind of guess work. The current code is preserved for all RGMII related modes. It is different for flags=0 (GMII) and flags=5 (SGMII). The last case, SGMII, is successfully tested on Altera's Terasic DE4. Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- Changes for v2: - Remove period from end of summary line - Fix checkpatch.pl warnings about brace around single-if-statements drivers/net/altera_tse.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index afd8e31..8b18ad0 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -583,7 +583,11 @@ static uint mii_m88es_setmode_sr(uint mii_reg, struct altera_tse_priv *priv) { uint mii_data = tse_mdio_read(priv, mii_reg); mii_data = 0xfff0; - mii_data |= 0xb; + if ((priv-flags = 1) (priv-flags = 4)) + mii_data |= 0xb; + else if (priv-flags == 5) + mii_data |= 0x4; + return mii_data; } @@ -591,7 +595,9 @@ static uint mii_m88es_setmode_cr(uint mii_reg, struct altera_tse_priv *priv) { uint mii_data = tse_mdio_read(priv, mii_reg); mii_data = ~0x82; - mii_data |= 0x82; + if ((priv-flags = 1) (priv-flags = 4)) + mii_data |= 0x82; + return mii_data; } -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 5/5 v2] altera_tse: Fix return of eth_device's recv() callback
It seems to be good practice to return the number of received bytes in the eth_device's recv() callback, here: tse_eth_rx(). Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- Changes for v2: - Remove period from end of summary line - Be more precise why/add reason to commit message drivers/net/altera_tse.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index 8b18ad0..5b00717 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -323,6 +323,8 @@ static int tse_eth_rx(struct eth_device *dev) /* setup the sgdma */ alt_sgdma_do_async_transfer(priv-sgdma_rx, rx_desc[0]); + + return packet_length; } return -1; -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] nios2: Offer ft_board_setup() capability and call fdt_fixup_ethernet().
The main motivation is, to have the local-mac-address property of the ethernet peripherals fixed/synced with U-Boot's environment settings. Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- arch/nios2/cpu/Makefile |1 + arch/nios2/cpu/fdt.c| 53 +++ 2 files changed, 54 insertions(+), 0 deletions(-) create mode 100644 arch/nios2/cpu/fdt.c diff --git a/arch/nios2/cpu/Makefile b/arch/nios2/cpu/Makefile index aa41160..402fd74 100644 --- a/arch/nios2/cpu/Makefile +++ b/arch/nios2/cpu/Makefile @@ -28,6 +28,7 @@ LIB = $(obj)lib$(CPU).o START = start.o SOBJS = exceptions.o COBJS = cpu.o interrupts.o sysid.o traps.o epcs.o +COBJS += fdt.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) diff --git a/arch/nios2/cpu/fdt.c b/arch/nios2/cpu/fdt.c new file mode 100644 index 000..b1ed9e1 --- /dev/null +++ b/arch/nios2/cpu/fdt.c @@ -0,0 +1,53 @@ +/* + * (C) Copyright 2011, Missing Link Electronics + * Joachim Foerster joac...@missinglinkelectronics.com + * + * Taken from arch/powerpc/cpu/ppc4xx/fdt.c: + * + * (C) Copyright 2007-2008 + * Stefan Roese, DENX Software Engineering, s...@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h + +#if defined(CONFIG_OF_LIBFDT) defined(CONFIG_OF_BOARD_SETUP) +#include libfdt.h +#include libfdt_env.h +#include fdt_support.h + +DECLARE_GLOBAL_DATA_PTR; + +void __ft_board_setup(void *blob, bd_t *bd) +{ + ft_cpu_setup(blob, bd); +} +void ft_board_setup(void *blob, bd_t *bd) \ + __attribute__((weak, alias(__ft_board_setup))); + +void ft_cpu_setup(void *blob, bd_t *bd) +{ + /* +* Fixup all ethernet nodes +* Note: aliases in the dts are required for this +*/ + fdt_fixup_ethernet(blob); +} +#endif /* CONFIG_OF_LIBFDT CONFIG_OF_BOARD_SETUP */ -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature
Hi all, Did anybody get a chance to review those 5 small patches? I would like to get some feedback and work on it, if needed - to get them upstream. On 10/17/2011 05:24 PM, Joachim Foerster wrote: This patch series comprises small, but relevant fixes, regarding the driver for Altera's TSE ip core. They are needed to make it run on a Terasic DE4 board. The new feature is the support for dedicated descriptor memory. Joachim Foerster (5): altera_tse: Clear SGDMA's RUN bit in async case, too. altera_tse: Fix SGDMA reset triggering. altera_tse: Add support for dedicated descriptor memory. altera_tse: m88es: Honor device flags regarding PHY interface mode. altera_tse: Fix return of eth_device's recv() callback. board/altera/nios2-generic/nios2-generic.c | 10 +- drivers/net/altera_tse.c | 45 ++- include/netdev.h |3 +- 3 files changed, 47 insertions(+), 11 deletions(-) -- Joachim Foerster Missing Link Electronics http://www.missinglinkelectronics.com Office EU: +49 (731) 141-149-0 Office US: +1 (408) 457-0700 email: joachim.foers...@missinglinkelectronics.com ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/2] Replace nios2-generic's gpio.c with dedicated driver.
Let's have a dedicated driver for Altera's PIO ip core, which does not have to be duplicated for each board using PIO. Joachim Foerster (2): gpio: Add driver for Altera's PIO core board/nios2-generic: Use altera_pio driver and remove board specific driver Changes for v2: PATCH 1/2: - get rid of checkpatch warnings about init.ing static - use %d instead of %u together the usage of the space-flag PATCH 2/2: nothing arch/nios2/include/asm/gpio.h | 13 +- board/altera/nios2-generic/Makefile|1 - board/altera/nios2-generic/custom_fpga.h |1 + board/altera/nios2-generic/gpio.c | 71 --- board/altera/nios2-generic/nios2-generic.c |8 + drivers/gpio/Makefile |1 + drivers/gpio/altera_pio.c | 299 include/configs/nios2-generic.h|4 + 8 files changed, 324 insertions(+), 74 deletions(-) delete mode 100644 board/altera/nios2-generic/gpio.c create mode 100644 drivers/gpio/altera_pio.c -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2 v2] board/nios2-generic: Use altera_pio driver and remove board specific driver
Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- board/altera/nios2-generic/Makefile |1 - board/altera/nios2-generic/gpio.c | 71 --- include/configs/nios2-generic.h |4 ++ 3 files changed, 4 insertions(+), 72 deletions(-) delete mode 100644 board/altera/nios2-generic/gpio.c diff --git a/board/altera/nios2-generic/Makefile b/board/altera/nios2-generic/Makefile index 359f590..59fd465 100644 --- a/board/altera/nios2-generic/Makefile +++ b/board/altera/nios2-generic/Makefile @@ -32,7 +32,6 @@ LIB = $(obj)lib$(BOARD).o COBJS-y:= $(BOARD).o COBJS-$(CONFIG_CMD_IDE) += ../common/cfide.o COBJS-$(CONFIG_EPLED) += ../common/epled.o -COBJS-$(CONFIG_GPIO) += gpio.o COBJS-$(CONFIG_SEVENSEG) += ../common/sevenseg.o SOBJS-y:= text_base.o diff --git a/board/altera/nios2-generic/gpio.c b/board/altera/nios2-generic/gpio.c deleted file mode 100644 index 4a30564..000 --- a/board/altera/nios2-generic/gpio.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * board gpio driver - * - * Copyright (C) 2010 Thomas Chou tho...@wytron.com.tw - * Licensed under the GPL-2 or later. - */ -#include common.h -#include asm/io.h - -#ifndef CONFIG_SYS_GPIO_BASE - -#define ALTERA_PIO_BASE LED_PIO_BASE -#define ALTERA_PIO_WIDTH LED_PIO_WIDTH -#define ALTERA_PIO_DATA (ALTERA_PIO_BASE + 0) -#define ALTERA_PIO_DIR (ALTERA_PIO_BASE + 4) -static u32 pio_data_reg; -static u32 pio_dir_reg; - -int gpio_request(unsigned gpio, const char *label) -{ - return 0; -} - -int gpio_free(unsigned gpio) -{ - return 0; -} - -int gpio_direction_input(unsigned gpio) -{ - u32 mask = 1 gpio; - writel(pio_dir_reg = ~mask, ALTERA_PIO_DIR); - return 0; -} - -int gpio_direction_output(unsigned gpio, int value) -{ - u32 mask = 1 gpio; - if (value) - pio_data_reg |= mask; - else - pio_data_reg = ~mask; - writel(pio_data_reg, ALTERA_PIO_DATA); - writel(pio_dir_reg |= mask, ALTERA_PIO_DIR); - return 0; -} - -int gpio_get_value(unsigned gpio) -{ - u32 mask = 1 gpio; - if (pio_dir_reg mask) - return (pio_data_reg mask) ? 1 : 0; - else - return (readl(ALTERA_PIO_DATA) mask) ? 1 : 0; -} - -void gpio_set_value(unsigned gpio, int value) -{ - u32 mask = 1 gpio; - if (value) - pio_data_reg |= mask; - else - pio_data_reg = ~mask; - writel(pio_data_reg, ALTERA_PIO_DATA); -} - -int gpio_is_valid(int number) -{ - return ((unsigned)number) ALTERA_PIO_WIDTH; -} -#endif diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h index 1395939..9ba35e8 100644 --- a/include/configs/nios2-generic.h +++ b/include/configs/nios2-generic.h @@ -63,6 +63,10 @@ /* * STATUS LED */ +#define CONFIG_ALTERA_PIO +#define CONFIG_SYS_ALTERA_PIO_NUM 1 +#define CONFIG_SYS_ALTERA_PIO_GPIO_NUM LED_PIO_WIDTH + #define CONFIG_STATUS_LED /* Enable status driver */ #define CONFIG_GPIO_LED/* Enable GPIO LED driver */ #define CONFIG_GPIO/* Enable GPIO driver */ -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2 v2] gpio: Add driver for Altera's PIO core
This driver may handle multiple PIO cores and thus needs to be setup by calling the altera_pio_init() function within the early board setup routine. The driver comes with some extras, see below the copyleft header. Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com Tested-by: Thomas Chou tho...@wytron.com.tw --- arch/nios2/include/asm/gpio.h | 13 +- board/altera/nios2-generic/custom_fpga.h |1 + board/altera/nios2-generic/nios2-generic.c |8 + drivers/gpio/Makefile |1 + drivers/gpio/altera_pio.c | 299 5 files changed, 320 insertions(+), 2 deletions(-) create mode 100644 drivers/gpio/altera_pio.c diff --git a/arch/nios2/include/asm/gpio.h b/arch/nios2/include/asm/gpio.h index 4b21c8f..908381f 100644 --- a/arch/nios2/include/asm/gpio.h +++ b/arch/nios2/include/asm/gpio.h @@ -5,8 +5,8 @@ * bit[0] data * bit[1] output enable * - * when CONFIG_SYS_GPIO_BASE is not defined, board may provide - * its own driver. + * When CONFIG_SYS_GPIO_BASE is not defined, the board may either + * provide its own driver or the altera_pio driver may be used. * * Copyright (C) 2010 Thomas Chou tho...@wytron.com.tw * @@ -58,6 +58,15 @@ static inline int gpio_is_valid(int number) return ((unsigned)number) CONFIG_SYS_GPIO_WIDTH; } #else +#ifdef CONFIG_ALTERA_PIO +extern int altera_pio_init(u32 base, u8 width, char iot, + u32 rstval, u32 negmask, + const char *label); + +extern void altera_pio_info(void); +#define gpio_status() altera_pio_info() +#endif + extern int gpio_request(unsigned gpio, const char *label); extern int gpio_free(unsigned gpio); extern int gpio_direction_input(unsigned gpio); diff --git a/board/altera/nios2-generic/custom_fpga.h b/board/altera/nios2-generic/custom_fpga.h index f7f3853..fd3ec9a 100644 --- a/board/altera/nios2-generic/custom_fpga.h +++ b/board/altera/nios2-generic/custom_fpga.h @@ -51,6 +51,7 @@ /* led_pio.s1 is a altera_avalon_pio */ #define LED_PIO_BASE 0x82120870 #define LED_PIO_WIDTH 8 +#define LED_PIO_RSTVAL 0x0 /* high_res_timer.s1 is a altera_avalon_timer */ #define CONFIG_SYS_TIMER_BASE 0x82120820 diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c index 49ef80d..0f88275 100644 --- a/board/altera/nios2-generic/nios2-generic.c +++ b/board/altera/nios2-generic/nios2-generic.c @@ -26,6 +26,7 @@ #include netdev.h #include mtd/cfi_flash.h #include asm/io.h +#include asm/gpio.h void text_base_hook(void); /* nop hook for text_base.S */ @@ -43,6 +44,13 @@ void early_flash_cmd_reset(void) int board_early_init_f(void) { text_base_hook(); +#ifdef CONFIG_ALTERA_PIO +#ifdef LED_PIO_BASE + altera_pio_init(LED_PIO_BASE, LED_PIO_WIDTH, 'o', + LED_PIO_RSTVAL, (1 LED_PIO_WIDTH) - 1, + led); +#endif +#endif #if defined(CONFIG_ENV_IS_IN_FLASH) defined(CONFIG_ENV_ADDR) early_flash_cmd_reset(); #endif diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index beca1da..c874b1a 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -34,6 +34,7 @@ COBJS-$(CONFIG_PCA953X) += pca953x.o COBJS-$(CONFIG_S5P)+= s5p_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO)+= tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o +COBJS-$(CONFIG_ALTERA_PIO) += altera_pio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/gpio/altera_pio.c b/drivers/gpio/altera_pio.c new file mode 100644 index 000..fb03760 --- /dev/null +++ b/drivers/gpio/altera_pio.c @@ -0,0 +1,299 @@ +/* + * Driver for Altera's PIO ip core + * + * Copyright (C) 2011 Missing Link Electronics + * Joachim Foerster joac...@missinglinkelectronics.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * To use this driver, in your board's config. header: + * #define CONFIG_ALTERA_PIO + * #define CONFIG_SYS_ALTERA_PIO_NUM number-of-pio-cores + * #define CONFIG_SYS_ALTERA_PIO_GPIO_NUM total-number-of-gpios + * And in your board's early setup routine: + * altera_pio_init(baseaddr, width, 'i'|'o'|'t', + * reset-value, neg-mask, label); + * - 'i'|'o'|'t
Re: [U-Boot] [PATCH 1/2] gpio: Add driver for Altera's PIO core
On 10/21/2011 09:21 AM, Thomas Chou wrote: On 10/17/2011 11:36 PM, Joachim Foerster wrote: This driver may handle multiple PIO cores and thus needs to be setup by calling the altera_pio_init() function within the early board setup routine. The driver comes with some extras, see below the copyleft header. Signed-off-by: Joachim Foersterjoachim.foers...@missinglinkelectronics.com --- arch/nios2/include/asm/gpio.h | 13 +- board/altera/nios2-generic/custom_fpga.h | 1 + board/altera/nios2-generic/nios2-generic.c | 8 + drivers/gpio/Makefile | 1 + drivers/gpio/altera_pio.c | 299 5 files changed, 320 insertions(+), 2 deletions(-) create mode 100644 drivers/gpio/altera_pio.c Hi Joachim, Please fix these warning. Thanks. $ ./MAKEALL nios2-generic Configuring for nios2-generic board... altera_pio.c: In function `altera_pio_info': altera_pio.c:189: warning: ` ' flag used with `%u' printf format Ok, I'll use %d - in this case it is the same. Does anybody know why %u warns about space-flag usage? Is space-flag + %u indeed evil ? Otherwise, Tested-by: Thomas Chou tho...@wytron.com.tw Best regards, Thomas Thanks for reviewing. -- Joachim Foerster Missing Link Electronics http://www.missinglinkelectronics.com Office EU: +49 (731) 141-149-0 Office US: +1 (408) 457-0700 email: joachim.foers...@missinglinkelectronics.com ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3] nios2: Pseudo implement dcache_status/enable/disable()
AFAIK the NIOS2 architecture does not have any possibility to dynamically switch off the data cache. So _status() always reports 1 and _enable/_disable() just issue a flush of everything. For example, common/cmd_elf.c depends on these symbols. Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- Changes for v3: - #include proper header file for flush_dcache() Changes for v2: - Remove return; from added void functions arch/nios2/cpu/cpu.c | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c index ef360ee..edf2560 100644 --- a/arch/nios2/cpu/cpu.c +++ b/arch/nios2/cpu/cpu.c @@ -24,6 +24,7 @@ #include common.h #include nios2.h #include nios2-io.h +#include asm/cache.h #if defined (CONFIG_SYS_NIOS_SYSID_BASE) extern void display_sysid (void); @@ -47,3 +48,18 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) nios2_callr(CONFIG_SYS_RESET_ADDR); return 0; } + +int dcache_status(void) +{ + return 1; +} + +void dcache_enable(void) +{ + flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); +} + +void dcache_disable(void) +{ + flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); +} -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 4/5] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode.
Note: This is kind of guess work. The current code is preserved for all RGMII related modes. It is different for flags=0 (GMII) and flags=5 (SGMII). The last case, SGMII, is successfully tested on Altera's Terasic DE4. Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- drivers/net/altera_tse.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index f20f7d0..04e19cb 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -583,7 +583,11 @@ static uint mii_m88es_setmode_sr(uint mii_reg, struct altera_tse_priv *priv) { uint mii_data = tse_mdio_read(priv, mii_reg); mii_data = 0xfff0; - mii_data |= 0xb; + if ((priv-flags = 1) (priv-flags = 4)) { + mii_data |= 0xb; + } else if (priv-flags == 5) { + mii_data |= 0x4; + } return mii_data; } @@ -591,7 +595,9 @@ static uint mii_m88es_setmode_cr(uint mii_reg, struct altera_tse_priv *priv) { uint mii_data = tse_mdio_read(priv, mii_reg); mii_data = ~0x82; - mii_data |= 0x82; + if ((priv-flags = 1) (priv-flags = 4)) { + mii_data |= 0x82; + } return mii_data; } -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/5] altera_tse: Fix SGDMA reset triggering.
The SW_RESET needs to be set! Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- drivers/net/altera_tse.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index c7f8ba9..8bc600a 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -357,8 +357,8 @@ static void tse_eth_reset(struct eth_device *dev) if (counter = ALT_TSE_SGDMA_BUSY_WATCHDOG_CNTR) { debug(Timeout waiting for rx sgdma!\n); - rx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; - rx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; + rx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; + rx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; } counter = 0; @@ -370,8 +370,8 @@ static void tse_eth_reset(struct eth_device *dev) if (counter = ALT_TSE_SGDMA_BUSY_WATCHDOG_CNTR) { debug(Timeout waiting for tx sgdma!\n); - tx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; - tx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; + tx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; + tx_sgdma-control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK; } /* reset the mac */ mac_dev-command_config.bits.transmit_enable = 1; -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/5] altera_tse: Clear SGDMA's RUN bit in async case, too.
Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- drivers/net/altera_tse.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index 54a944b..c7f8ba9 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -199,6 +199,12 @@ static int alt_sgdma_do_async_transfer(volatile struct alt_sgdma_registers *dev, debug(Timeout waiting sgdma in do async!\n); /* +* Clear the RUN bit in the control register. This is needed +* restart the SGDMA engine later on. +*/ + dev-control = 0; + + /* * Clear any (previous) status register information * that might occlude our error checking later. */ -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature
This patch series comprises small, but relevant fixes, regarding the driver for Altera's TSE ip core. They are needed to make it run on a Terasic DE4 board. The new feature is the support for dedicated descriptor memory. Joachim Foerster (5): altera_tse: Clear SGDMA's RUN bit in async case, too. altera_tse: Fix SGDMA reset triggering. altera_tse: Add support for dedicated descriptor memory. altera_tse: m88es: Honor device flags regarding PHY interface mode. altera_tse: Fix return of eth_device's recv() callback. board/altera/nios2-generic/nios2-generic.c | 10 +- drivers/net/altera_tse.c | 45 ++- include/netdev.h |3 +- 3 files changed, 47 insertions(+), 11 deletions(-) -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/5] altera_tse: Add support for dedicated descriptor memory.
Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- board/altera/nios2-generic/nios2-generic.c | 10 +- drivers/net/altera_tse.c | 19 --- include/netdev.h |3 ++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c index 220a4c4..49ef80d 100644 --- a/board/altera/nios2-generic/nios2-generic.c +++ b/board/altera/nios2-generic/nios2-generic.c @@ -74,7 +74,15 @@ int board_eth_init(bd_t *bis) rc += altera_tse_initialize(0, CONFIG_SYS_ALTERA_TSE_MAC_BASE, CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE, - CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE); + CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE, +#if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) \ + (CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE 0) + CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE, + CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE); +#else + 0, + 0); +#endif #endif #ifdef CONFIG_ETHOC rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE); diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index 8bc600a..f20f7d0 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -882,7 +882,8 @@ static int tse_eth_init(struct eth_device *dev, bd_t * bd) /* TSE init code */ int altera_tse_initialize(u8 dev_num, int mac_base, - int sgdma_rx_base, int sgdma_tx_base) + int sgdma_rx_base, int sgdma_tx_base, + u32 sgdma_desc_base, u32 sgdma_desc_size) { struct altera_tse_priv *priv; struct eth_device *dev; @@ -903,8 +904,20 @@ int altera_tse_initialize(u8 dev_num, int mac_base, free(dev); return 0; } - tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX), -dma_handle); + if (sgdma_desc_size) { + if (sgdma_desc_size (sizeof(*tx_desc) * (3 + PKTBUFSRX))) { + printf(ALTERA_TSE-%hu: + descriptor memory is too small\n, dev_num); + free(priv); + free(dev); + return 0; + } + tx_desc = (struct alt_sgdma_descriptor *)sgdma_desc_base; + } else { + tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX), +dma_handle); + } + rx_desc = tx_desc + 2; debug(tx desc: address = 0x%x\n, (unsigned int)tx_desc); debug(rx desc: address = 0x%x\n, (unsigned int)rx_desc); diff --git a/include/netdev.h b/include/netdev.h index 669f60b..361df5c 100644 --- a/include/netdev.h +++ b/include/netdev.h @@ -42,7 +42,8 @@ int cpu_eth_init(bd_t *bis); /* Driver initialization prototypes */ int altera_tse_initialize(u8 dev_num, int mac_base, - int sgdma_rx_base, int sgdma_tx_base); + int sgdma_rx_base, int sgdma_tx_base, + u32 sgdma_desc_base, u32 sgdma_desc_size); int at91emac_register(bd_t *bis, unsigned long iobase); int au1x00_enet_initialize(bd_t*); int ax88180_initialize(bd_t *bis); -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 5/5] altera_tse: Fix return of eth_device's recv() callback.
Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- drivers/net/altera_tse.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index 04e19cb..c4ff8c7 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -323,6 +323,8 @@ static int tse_eth_rx(struct eth_device *dev) /* setup the sgdma */ alt_sgdma_do_async_transfer(priv-sgdma_rx, rx_desc[0]); + + return packet_length; } return -1; -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2] gpio: Add driver for Altera's PIO core
This driver may handle multiple PIO cores and thus needs to be setup by calling the altera_pio_init() function within the early board setup routine. The driver comes with some extras, see below the copyleft header. Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- arch/nios2/include/asm/gpio.h | 13 +- board/altera/nios2-generic/custom_fpga.h |1 + board/altera/nios2-generic/nios2-generic.c |8 + drivers/gpio/Makefile |1 + drivers/gpio/altera_pio.c | 299 5 files changed, 320 insertions(+), 2 deletions(-) create mode 100644 drivers/gpio/altera_pio.c diff --git a/arch/nios2/include/asm/gpio.h b/arch/nios2/include/asm/gpio.h index 4b21c8f..908381f 100644 --- a/arch/nios2/include/asm/gpio.h +++ b/arch/nios2/include/asm/gpio.h @@ -5,8 +5,8 @@ * bit[0] data * bit[1] output enable * - * when CONFIG_SYS_GPIO_BASE is not defined, board may provide - * its own driver. + * When CONFIG_SYS_GPIO_BASE is not defined, the board may either + * provide its own driver or the altera_pio driver may be used. * * Copyright (C) 2010 Thomas Chou tho...@wytron.com.tw * @@ -58,6 +58,15 @@ static inline int gpio_is_valid(int number) return ((unsigned)number) CONFIG_SYS_GPIO_WIDTH; } #else +#ifdef CONFIG_ALTERA_PIO +extern int altera_pio_init(u32 base, u8 width, char iot, + u32 rstval, u32 negmask, + const char *label); + +extern void altera_pio_info(void); +#define gpio_status() altera_pio_info() +#endif + extern int gpio_request(unsigned gpio, const char *label); extern int gpio_free(unsigned gpio); extern int gpio_direction_input(unsigned gpio); diff --git a/board/altera/nios2-generic/custom_fpga.h b/board/altera/nios2-generic/custom_fpga.h index f7f3853..fd3ec9a 100644 --- a/board/altera/nios2-generic/custom_fpga.h +++ b/board/altera/nios2-generic/custom_fpga.h @@ -51,6 +51,7 @@ /* led_pio.s1 is a altera_avalon_pio */ #define LED_PIO_BASE 0x82120870 #define LED_PIO_WIDTH 8 +#define LED_PIO_RSTVAL 0x0 /* high_res_timer.s1 is a altera_avalon_timer */ #define CONFIG_SYS_TIMER_BASE 0x82120820 diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c index 49ef80d..0f88275 100644 --- a/board/altera/nios2-generic/nios2-generic.c +++ b/board/altera/nios2-generic/nios2-generic.c @@ -26,6 +26,7 @@ #include netdev.h #include mtd/cfi_flash.h #include asm/io.h +#include asm/gpio.h void text_base_hook(void); /* nop hook for text_base.S */ @@ -43,6 +44,13 @@ void early_flash_cmd_reset(void) int board_early_init_f(void) { text_base_hook(); +#ifdef CONFIG_ALTERA_PIO +#ifdef LED_PIO_BASE + altera_pio_init(LED_PIO_BASE, LED_PIO_WIDTH, 'o', + LED_PIO_RSTVAL, (1 LED_PIO_WIDTH) - 1, + led); +#endif +#endif #if defined(CONFIG_ENV_IS_IN_FLASH) defined(CONFIG_ENV_ADDR) early_flash_cmd_reset(); #endif diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index beca1da..c874b1a 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -34,6 +34,7 @@ COBJS-$(CONFIG_PCA953X) += pca953x.o COBJS-$(CONFIG_S5P)+= s5p_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO)+= tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o +COBJS-$(CONFIG_ALTERA_PIO) += altera_pio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/gpio/altera_pio.c b/drivers/gpio/altera_pio.c new file mode 100644 index 000..1b8c19c --- /dev/null +++ b/drivers/gpio/altera_pio.c @@ -0,0 +1,299 @@ +/* + * Driver for Altera's PIO ip core + * + * Copyright (C) 2011 Missing Link Electronics + * Joachim Foerster joac...@missinglinkelectronics.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * To use this driver, in your board's config. header: + * #define CONFIG_ALTERA_PIO + * #define CONFIG_SYS_ALTERA_PIO_NUM number-of-pio-cores + * #define CONFIG_SYS_ALTERA_PIO_GPIO_NUM total-number-of-gpios + * And in your board's early setup routine: + * altera_pio_init(baseaddr, width, 'i'|'o'|'t', + * reset-value, neg-mask, label); + * - 'i'|'o'|'t': PIO is input-only/output-only/tri-state
[U-Boot] [PATCH 0/2] Replace nios2-generic's gpio.c with dedicated driver.
Let's have a dedicated driver for Altera's PIO ip core, which does not have to be duplicated for each board using PIO. Joachim Foerster (2): gpio: Add driver for Altera's PIO core board/nios2-generic: Use altera_pio driver and remove board specific driver arch/nios2/include/asm/gpio.h | 13 +- board/altera/nios2-generic/Makefile|1 - board/altera/nios2-generic/custom_fpga.h |1 + board/altera/nios2-generic/gpio.c | 71 --- board/altera/nios2-generic/nios2-generic.c |8 + drivers/gpio/Makefile |1 + drivers/gpio/altera_pio.c | 299 include/configs/nios2-generic.h|4 + 8 files changed, 324 insertions(+), 74 deletions(-) delete mode 100644 board/altera/nios2-generic/gpio.c create mode 100644 drivers/gpio/altera_pio.c -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] board/nios2-generic: Use altera_pio driver and remove board specific driver
Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- board/altera/nios2-generic/Makefile |1 - board/altera/nios2-generic/gpio.c | 71 --- include/configs/nios2-generic.h |4 ++ 3 files changed, 4 insertions(+), 72 deletions(-) delete mode 100644 board/altera/nios2-generic/gpio.c diff --git a/board/altera/nios2-generic/Makefile b/board/altera/nios2-generic/Makefile index 359f590..59fd465 100644 --- a/board/altera/nios2-generic/Makefile +++ b/board/altera/nios2-generic/Makefile @@ -32,7 +32,6 @@ LIB = $(obj)lib$(BOARD).o COBJS-y:= $(BOARD).o COBJS-$(CONFIG_CMD_IDE) += ../common/cfide.o COBJS-$(CONFIG_EPLED) += ../common/epled.o -COBJS-$(CONFIG_GPIO) += gpio.o COBJS-$(CONFIG_SEVENSEG) += ../common/sevenseg.o SOBJS-y:= text_base.o diff --git a/board/altera/nios2-generic/gpio.c b/board/altera/nios2-generic/gpio.c deleted file mode 100644 index 4a30564..000 --- a/board/altera/nios2-generic/gpio.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * board gpio driver - * - * Copyright (C) 2010 Thomas Chou tho...@wytron.com.tw - * Licensed under the GPL-2 or later. - */ -#include common.h -#include asm/io.h - -#ifndef CONFIG_SYS_GPIO_BASE - -#define ALTERA_PIO_BASE LED_PIO_BASE -#define ALTERA_PIO_WIDTH LED_PIO_WIDTH -#define ALTERA_PIO_DATA (ALTERA_PIO_BASE + 0) -#define ALTERA_PIO_DIR (ALTERA_PIO_BASE + 4) -static u32 pio_data_reg; -static u32 pio_dir_reg; - -int gpio_request(unsigned gpio, const char *label) -{ - return 0; -} - -int gpio_free(unsigned gpio) -{ - return 0; -} - -int gpio_direction_input(unsigned gpio) -{ - u32 mask = 1 gpio; - writel(pio_dir_reg = ~mask, ALTERA_PIO_DIR); - return 0; -} - -int gpio_direction_output(unsigned gpio, int value) -{ - u32 mask = 1 gpio; - if (value) - pio_data_reg |= mask; - else - pio_data_reg = ~mask; - writel(pio_data_reg, ALTERA_PIO_DATA); - writel(pio_dir_reg |= mask, ALTERA_PIO_DIR); - return 0; -} - -int gpio_get_value(unsigned gpio) -{ - u32 mask = 1 gpio; - if (pio_dir_reg mask) - return (pio_data_reg mask) ? 1 : 0; - else - return (readl(ALTERA_PIO_DATA) mask) ? 1 : 0; -} - -void gpio_set_value(unsigned gpio, int value) -{ - u32 mask = 1 gpio; - if (value) - pio_data_reg |= mask; - else - pio_data_reg = ~mask; - writel(pio_data_reg, ALTERA_PIO_DATA); -} - -int gpio_is_valid(int number) -{ - return ((unsigned)number) ALTERA_PIO_WIDTH; -} -#endif diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h index 1395939..9ba35e8 100644 --- a/include/configs/nios2-generic.h +++ b/include/configs/nios2-generic.h @@ -63,6 +63,10 @@ /* * STATUS LED */ +#define CONFIG_ALTERA_PIO +#define CONFIG_SYS_ALTERA_PIO_NUM 1 +#define CONFIG_SYS_ALTERA_PIO_GPIO_NUM LED_PIO_WIDTH + #define CONFIG_STATUS_LED /* Enable status driver */ #define CONFIG_GPIO_LED/* Enable GPIO LED driver */ #define CONFIG_GPIO/* Enable GPIO driver */ -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH] nios2: Pseudo implement dcache_status/enable/disable()
AFAIK the NIOS2 architecture does not have any possibility to dynamically switch off the data cache. So _status() always reports 1 and _enable/_disable() just issue a flush of everything. For example, common/cmd_elf.c depends on these symbols. Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- arch/nios2/cpu/cpu.c | 17 + 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c index ef360ee..01dd057 100644 --- a/arch/nios2/cpu/cpu.c +++ b/arch/nios2/cpu/cpu.c @@ -47,3 +47,20 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) nios2_callr(CONFIG_SYS_RESET_ADDR); return 0; } + +int dcache_status(void) +{ + return 1; +} + +void dcache_enable(void) +{ + flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); + return; +} + +void dcache_disable(void) +{ + flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); + return; +} -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] nios2: Pseudo implement dcache_status/enable/disable()
AFAIK the NIOS2 architecture does not have any possibility to dynamically switch off the data cache. So _status() always reports 1 and _enable/_disable() just issue a flush of everything. For example, common/cmd_elf.c depends on these symbols. Signed-off-by: Joachim Foerster joachim.foers...@missinglinkelectronics.com --- Changes for v2: - Remove return; from added void functions arch/nios2/cpu/cpu.c | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c index ef360ee..c9ce390 100644 --- a/arch/nios2/cpu/cpu.c +++ b/arch/nios2/cpu/cpu.c @@ -47,3 +47,18 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) nios2_callr(CONFIG_SYS_RESET_ADDR); return 0; } + +int dcache_status(void) +{ + return 1; +} + +void dcache_enable(void) +{ + flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); +} + +void dcache_disable(void) +{ + flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE); +} -- 1.7.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot