Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Dec 2006 17:59:51 GMT
From:      Bernd Walter <ticso@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 111294 for review
Message-ID:  <200612081759.kB8HxpnS018149@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=111294

Change 111294 by ticso@ticso on 2006/12/08 17:59:00

	add BWCT BOOT_FLAVOR

Affected files ...

.. //depot/projects/arm/src/sys/boot/arm/at91/Makefile.inc#30 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/boot2/bwct_board.c#1 add
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/arm_init.S#6 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.h#10 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#38 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac_init.c#11 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/spi_flash.c#19 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/spi_flash.h#9 edit

Differences ...

==== //depot/projects/arm/src/sys/boot/arm/at91/Makefile.inc#30 (text+ko) ====

@@ -5,7 +5,7 @@
 
 __at91_boot_Makefile.inc__:
 
-# tsc, kb920x are the supported flavors
+# tsc, bwct, kb920x are the supported flavors
 BOOT_FLAVOR=kb920x
 
 CFLAGS=-Os -mcpu=arm9 -ffreestanding \

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/arm_init.S#6 (text+ko) ====

@@ -61,8 +61,12 @@
 #ifdef BOOT_IIC
 		.long	(TWI_EEPROM_SIZE >> 9)
 #else
+#ifdef BOOT_BWCT
+		.long	((528 << 17) | (13 << 13) | (12 * 2))
+#else
 		.long	((1056 << 17) | (13 << 13) | (12 * 2))
 #endif
+#endif
 irqvec:
                 ldr         pc, [pc,#-0xF20]    @; IRQ : read the AIC
 fiqvec:
@@ -110,10 +114,10 @@
 	.string "                 "
 #else
 #if 1
-	.string "m 42 53 44 0 0 1"
-	.string "ip 206 168 13 194"
-	.string "server_ip 206 168 13 207"
-	.string "tftp 0x20000000 kernel.bin"
+	.string "m 00 0e 42 02 00 21                    "
+	.string "ip 10 1 1 4                            "
+	.string "server_ip 10 1 1 9                     "
+	.string "tftp 0x20000000 kernel.bin             "
 	.string "e 0x20000000"
 #else
 	.string "m 42 53 44 0 0 1"

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.h#10 (text) ====

@@ -39,6 +39,14 @@
 #define OSC_MAIN_MULT		90
 #endif
 
+#ifdef BOOT_BWCT
+/* The following divisor sets PLLA frequency: e.g. 16/4 * 45 = 180MHz */
+#define OSC_MAIN_FREQ_DIV	4	/* for 16MHz osc */
+#define SDRAM_WIDTH	AT91C_SDRC_DBW_32_BITS
+typedef unsigned int sdram_size_t;
+#define OSC_MAIN_MULT		45
+#endif
+
 #ifdef BOOT_TSC
 /* The following divisor sets PLLA frequency: e.g. 16/4 * 45 = 180MHz */
 #define OSC_MAIN_FREQ_DIV	4	/* for 16MHz osc */

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#38 (text+ko) ====

@@ -337,6 +337,7 @@
  *  This private function reads the PHY device.
  * .KB_C_FN_DEFINITION_END
  */
+#ifndef BOOT_BWCT
 static unsigned short
 AT91F_MII_ReadPhy (AT91PS_EMAC pEmac, unsigned char addr)
 {
@@ -348,6 +349,7 @@
 	pEmac->EMAC_CTL &= ~AT91C_EMAC_MPE;
 	return (pEmac->EMAC_MAN & 0x0000ffff);
 }
+#endif
 
 /*
  * .KB_C_FN_DEFINITION_START
@@ -378,12 +380,20 @@
 static void
 MII_GetLinkSpeed(AT91PS_EMAC pEmac)
 {
+#if defined(BOOT_TSC) | defined(BOOT_KB920X)
 	unsigned short stat2; 
+#endif
 	unsigned update;
 #ifdef BOOT_TSC
 	unsigned sec;
 	int i;
 #endif
+#ifdef BOOT_BWCT
+	/* hardcoded link speed since we connect a switch via MII */
+	update = pEmac->EMAC_CFG & ~(AT91C_EMAC_SPD | AT91C_EMAC_FD);
+	update |= AT91C_EMAC_SPD;
+	update |= AT91C_EMAC_FD;
+#endif
 #ifdef BOOT_KB920X
 	stat2 = AT91F_MII_ReadPhy(pEmac, MII_STS2_REG);
 	if (!(stat2 & MII_STS2_LINK))

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac_init.c#11 (text+ko) ====

@@ -94,7 +94,7 @@
 	  AT91C_PA8_ETXEN | AT91C_PA16_EMDIO | AT91C_PA9_ETX0 |
 	  AT91C_PA10_ETX1 | AT91C_PA11_ECRS_ECRSDV | AT91C_PA15_EMDC |
 	  AT91C_PA7_ETXCK_EREFCK;
-#ifdef BOOT_KB920X	/* Really !RMII */
+#if defined(BOOT_KB920X) | defined(BOOT_BWCT)	/* Really !RMII */
 	AT91C_BASE_PIOB->PIO_BSR =
 	  AT91C_PB12_ETX2 | AT91C_PB13_ETX3 | AT91C_PB14_ETXER |
 	  AT91C_PB15_ERX2 | AT91C_PB16_ERX3 | AT91C_PB17_ERXDV |

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/spi_flash.c#19 (text+ko) ====

@@ -119,6 +119,23 @@
 	byteAddress = flash_addr % FLASH_PAGE_SIZE;
 
 	p_memset(tx_commandBuffer, 0, 8);
+#ifdef BOOT_BWCT
+	tx_commandBuffer[0] = 0xd2;
+	tx_commandBuffer[1] = ((pageAddress >> 6) & 0xFF);
+	tx_commandBuffer[2] = ((pageAddress << 2) & 0xFC) |
+				((byteAddress >> 8) & 0x3);
+	tx_commandBuffer[3] = byteAddress & 0xFF;
+	spi_command.tx_cmd = tx_commandBuffer;
+	spi_command.tx_cmd_size = 8;
+	spi_command.tx_data_size = size;
+	spi_command.tx_data = dest_addr;
+
+	p_memset(rx_commandBuffer, 0, 8);
+	spi_command.rx_cmd = rx_commandBuffer;
+	spi_command.rx_cmd_size = 8;
+	spi_command.rx_data_size = size;
+	spi_command.rx_data = dest_addr;
+#else
 	tx_commandBuffer[0] = CONTINUOUS_ARRAY_READ_HF;
 	tx_commandBuffer[1] = ((pageAddress >> 5) & 0xFF);
 	tx_commandBuffer[2] = ((pageAddress << 3) & 0xF8) |
@@ -134,6 +151,7 @@
 	spi_command.rx_cmd_size = 5;
 	spi_command.rx_data_size = size;
 	spi_command.rx_data = dest_addr;
+#endif
 
 	SendCommand(&spi_command);
 }
@@ -159,11 +177,19 @@
 	byteAddress = flash_addr % FLASH_PAGE_SIZE;
 
 	p_memset(tx_commandBuffer, 0, 8);
+#ifdef BOOT_BWCT
+	tx_commandBuffer[0] = 0x82;
+	tx_commandBuffer[1] = ((pageAddress >> 6) & 0xFF);
+	tx_commandBuffer[2] = ((pageAddress << 2) & 0xFC) |
+				((byteAddress >> 8) & 0x3);
+	tx_commandBuffer[3] = (byteAddress & 0xFF);
+#else
 	tx_commandBuffer[0] = PROGRAM_THROUGH_BUFFER;
 	tx_commandBuffer[1] = ((pageAddress >> 5) & 0xFF);
 	tx_commandBuffer[2] = ((pageAddress << 3) & 0xF8) |
 				((byteAddress >> 8) & 0x7);
 	tx_commandBuffer[3] = (byteAddress & 0xFF);
+#endif
 
 	p_memset(rx_commandBuffer, 0, 8);
 
@@ -233,6 +259,11 @@
 	// Increment real time counter every SLCK
 	AT91C_BASE_ST->ST_RTMR = 1;
 
+#ifdef BOOT_BWCT
+	if (((value = GetFlashStatus()) & 0xFC) != 0xB4)
+		printf(" Bad SPI status: 0x%x\n", value);
+#else
 	if (((value = GetFlashStatus()) & 0xFC) != 0xBC)
 		printf(" Bad SPI status: 0x%x\n", value);
+#endif
 }

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/spi_flash.h#9 (text+ko) ====

@@ -40,7 +40,11 @@
 
 void SPI_GetId(unsigned *id);
 
+#ifdef BOOT_BWCT
+#define FLASH_PAGE_SIZE	528
+#else
 #define FLASH_PAGE_SIZE	1056
+#endif
 
 // Flash commands
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200612081759.kB8HxpnS018149>