[PATCH 2/3][WiP] add atheros MIPS based ar2313 WiSoC chips

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 22 12:50:43 EDT 2013


Only some comments for now, I think you are still working on this
anyway, right?

On Mon, Apr 22, 2013 at 11:05:53AM +0200, Oleksij Rempel wrote:
 +
> +static void
> +ar231x_print_mac(unsigned char *mac)
> +{
> +	int i;
> +	for (i = 0; i < 5; i++) {
> +		printf("%02x:", mac[i]);
> +	}
> +	printf("%02x\n", mac[5]);
> +}

We have a ethaddr_to_string function which could be of use here.

> +ar231x_find_config(u8 *flash_limit)
> +{
> +	struct ar231x_board_config *config;
> +	u8 *bcfg, bsize;
> +	u8 brocken;
> +
> +	bcfg = ar231x_find_board_config(flash_limit);
> +
> +	bsize = sizeof(struct ar231x_board_config);
> +	config = xzalloc(bsize);
> +	ar231x_board.config = config;
> +
> +	if (bcfg) {
> +		u16 cksum;
> +		/* Copy the board and radio data to RAM, because accessing the mapped
> +		 * memory of the flash directly after booting is not safe */
> +		memcpy(config, bcfg, bsize);
> +		cksum= 0xca + ar231x_cksum16((unsigned char *)config + HDR_SIZE,
> +				sizeof(struct ar231x_board_config) - HDR_SIZE);
> +		if (cksum != config->cksum) {
> +			pr_err("config: checksum is invalid: %04x != %04x\n",
> +					cksum, config->cksum);
> +			brocken = 1;

This variable is unused.

 +
> +/*
> + * Platform device information for the Ethernet MAC
> + */
> +struct ar231x_eth_platform_data {
> +	u32 base_eth;
> +	u32 base_reset;
> +	u32 reset_mac;
> +	u32 reset_phy;
> +	u32 base_phy;
> +
> +	u8 *mac;
> +};

This should be part of the patch adding the ethernet driver.

> +
> +.globl lowlevel_init
> +lowlevel_init:
> +	li	t5, MEM_CFG0_X	# try x16
> +	li	t6, 0x23000	# use 8-word burst
> +
> +        /* Configure for a x16 SDRAM with 8-word burst */
> +        li      t5, MEM_CFG0_X           # try x16
> +        li      t6, 0x23000              # use 8-word burst

This could use a coding style cleanup, remove trailing whitespaces, use
tabs consistently, remove C++ comments.



-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list