Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6903bb49 authored by Gabor Juhos's avatar Gabor Juhos Committed by Ralf Baechle
Browse files

MIPS: ath79: Separate AR913x SoC specific WMAC setup code



The device registration code can be shared between the different SoCs, but
the required setup code varies Move AR913x specific setup code into a
separate function in order to make adding support for another SoCs easier.

Signed-off-by: default avatarGabor Juhos <juhosg@openwrt.org>
Cc: Imre Kaloz <kaloz@openwrt.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/3029/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 67b0f0f1
Loading
Loading
Loading
Loading
+17 −7
Original line number Original line Diff line number Diff line
@@ -23,8 +23,7 @@ static struct ath9k_platform_data ath79_wmac_data;


static struct resource ath79_wmac_resources[] = {
static struct resource ath79_wmac_resources[] = {
	{
	{
		.start	= AR913X_WMAC_BASE,
		/* .start and .end fields are filled dynamically */
		.end	= AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1,
		.flags	= IORESOURCE_MEM,
		.flags	= IORESOURCE_MEM,
	}, {
	}, {
		.start	= ATH79_CPU_IRQ_IP2,
		.start	= ATH79_CPU_IRQ_IP2,
@@ -43,12 +42,8 @@ static struct platform_device ath79_wmac_device = {
	},
	},
};
};


void __init ath79_register_wmac(u8 *cal_data)
static void __init ar913x_wmac_setup(void)
{
{
	if (cal_data)
		memcpy(ath79_wmac_data.eeprom_data, cal_data,
		       sizeof(ath79_wmac_data.eeprom_data));

	/* reset the WMAC */
	/* reset the WMAC */
	ath79_device_reset_set(AR913X_RESET_AMBA2WMAC);
	ath79_device_reset_set(AR913X_RESET_AMBA2WMAC);
	mdelay(10);
	mdelay(10);
@@ -56,5 +51,20 @@ void __init ath79_register_wmac(u8 *cal_data)
	ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC);
	ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC);
	mdelay(10);
	mdelay(10);


	ath79_wmac_resources[0].start = AR913X_WMAC_BASE;
	ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1;
}

void __init ath79_register_wmac(u8 *cal_data)
{
	if (soc_is_ar913x())
		ar913x_wmac_setup();
	else
		BUG();

	if (cal_data)
		memcpy(ath79_wmac_data.eeprom_data, cal_data,
		       sizeof(ath79_wmac_data.eeprom_data));

	platform_device_register(&ath79_wmac_device);
	platform_device_register(&ath79_wmac_device);
}
}