aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/dts/ar-5387un.dts
blob: 209eda37f40330956defa6b0ad51d40f0a7aa7c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/dts-v1/;

#include "bcm6328.dtsi"

#include <dt-bindings/input/input.h>

/ {
	model = "Comtrend AR-5387un";
	compatible = "comtrend,ar-5387un", "brcm,bcm6328";

	chosen {
		bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
		stdout-path = "serial0:115200n8";
	};

	keys {
		compatible = "gpio-keys-polled";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

		reset {
			label = "reset";
			gpios = <&pinctrl 23 1>;
			linux,code = <KEY_RESTART>;
			debounce-interval = <60>;
		};
	};

	leds {
		compatible = "gpio-leds";

		inet_red {
			label = "AR-5387un:red:inet";
			gpios = <&pinctrl 1 0>;
		};
		power_red {
			label = "AR-5387un:red:power";
			gpios = <&pinctrl 4 0>;
		};
		inet_green {
			label = "AR-5387un:green:inet";
			gpios = <&pinctrl 7 0>;
		};
		power_green {
			label = "AR-5387un:green:power";
			gpios = <&pinctrl 8 0>;
			default-state = "on";
		};
		dsl_green {
			label = "AR-5387un:green:dsl";
			gpios = <&pinctrl 11 1>;
		};
	};
};

&hsspi {
	status = "ok";

	flash@0 {
		compatible = "jedec,spi-nor";
		spi-max-frequency = <16666667>;
		spi-tx-bus-width = <2>;
		spi-rx-bus-width = <2>;
		reg = <0>;

		#address-cells = <1>;
		#size-cells = <1>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			cfe@0 {
				reg = <0x000000 0x010000>;
				label = "cfe";
				read-only;
			};

			linux@10000 {
				reg = <0x010000 0xfe0000>;
				label = "linux";
				compatible = "brcm,bcm963xx-imagetag";
			};

			nvram@ff0000 {
				reg = <0xff0000 0x010000>;
				label = "nvram";
			};
		};
	};
};

&uart0 {
	status = "ok";
};
char nvram_buf[NVRAM_SPACE]; --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c @@ -42,7 +42,7 @@ #include <asm/reboot.h> #include <asm/time.h> #include <bcm47xx.h> -#include <bcm47xx_nvram.h> +#include <linux/bcm47xx_nvram.h> #include <bcm47xx_board.h> union bcm47xx_bus bcm47xx_bus; --- a/arch/mips/bcm47xx/sprom.c +++ b/arch/mips/bcm47xx/sprom.c @@ -27,7 +27,7 @@ */ #include <bcm47xx.h> -#include <bcm47xx_nvram.h> +#include <linux/bcm47xx_nvram.h> #include <linux/if_ether.h> #include <linux/etherdevice.h> --- a/arch/mips/bcm47xx/time.c +++ b/arch/mips/bcm47xx/time.c @@ -27,7 +27,7 @@ #include <linux/ssb/ssb.h> #include <asm/time.h> #include <bcm47xx.h> -#include <bcm47xx_nvram.h> +#include <linux/bcm47xx_nvram.h> #include <bcm47xx_board.h> void __init plat_time_init(void) --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2005, Broadcom Corporation - * Copyright (C) 2006, Felix Fietkau <nbd@openwrt.org> - * - * 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. - */ - -#ifndef __BCM47XX_NVRAM_H -#define __BCM47XX_NVRAM_H - -#include <linux/types.h> -#include <linux/kernel.h> - -struct nvram_header { - u32 magic; - u32 len; - u32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:31 sdram_init */ - u32 config_refresh; /* 0:15 sdram_config, 16:31 sdram_refresh */ - u32 config_ncdl; /* ncdl values for memc */ -}; - -#define NVRAM_HEADER 0x48534C46 /* 'FLSH' */ -#define NVRAM_VERSION 1 -#define NVRAM_HEADER_SIZE 20 -#define NVRAM_SPACE 0x8000 - -#define FLASH_MIN 0x00020000 /* Minimum flash size */ - -#define NVRAM_MAX_VALUE_LEN 255 -#define NVRAM_MAX_PARAM_LEN 64 - -extern int bcm47xx_nvram_getenv(char *name, char *val, size_t val_len); - -static inline void bcm47xx_nvram_parse_macaddr(char *buf, u8 macaddr[6]) -{ - if (strchr(buf, ':')) - sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], - &macaddr[1], &macaddr[2], &macaddr[3], &macaddr[4], - &macaddr[5]); - else if (strchr(buf, '-')) - sscanf(buf, "%hhx-%hhx-%hhx-%hhx-%hhx-%hhx", &macaddr[0], - &macaddr[1], &macaddr[2], &macaddr[3], &macaddr[4], - &macaddr[5]); - else - printk(KERN_WARNING "Can not parse mac address: %s\n", buf); -} - -int bcm47xx_nvram_gpio_pin(const char *name); - -#endif /* __BCM47XX_NVRAM_H */ --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c @@ -31,6 +31,7 @@ #include <linux/ssb/ssb.h> #include <linux/slab.h> #include <linux/phy.h> +#include <linux/bcm47xx_nvram.h> #include <asm/uaccess.h> #include <asm/io.h> @@ -399,8 +400,6 @@ static void b44_set_flow_ctrl(struct b44 __b44_set_flow_ctrl(bp, pause_enab); } -#ifdef CONFIG_BCM47XX -#include <bcm47xx_nvram.h> static void b44_wap54g10_workaround(struct b44 *bp) { char buf[20]; @@ -429,11 +428,6 @@ static void b44_wap54g10_workaround(stru error: pr_warn("PHY: cannot reset MII transceiver isolate bit\n"); } -#else -static inline void b44_wap54g10_workaround(struct b44 *bp) -{ -} -#endif static int b44_setup_phy(struct b44 *bp) { --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -17,7 +17,7 @@ #include <linux/interrupt.h> #include <linux/dma-mapping.h> #include <linux/platform_data/b53.h> -#include <bcm47xx_nvram.h> +#include <linux/bcm47xx_nvram.h> static const struct bcma_device_id bgmac_bcma_tbl[] = { BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS), --- a/drivers/ssb/driver_chipcommon_pmu.c +++ b/drivers/ssb/driver_chipcommon_pmu.c @@ -13,9 +13,7 @@ #include <linux/ssb/ssb_driver_chipcommon.h> #include <linux/delay.h> #include <linux/export.h> -#ifdef CONFIG_BCM47XX -#include <bcm47xx_nvram.h> -#endif +#include <linux/bcm47xx_nvram.h> #include "ssb_private.h" @@ -320,11 +318,9 @@ static void ssb_pmu_pll_init(struct ssb_ u32 crystalfreq = 0; /* in kHz. 0 = keep default freq. */ if (bus->bustype == SSB_BUSTYPE_SSB) { -#ifdef CONFIG_BCM47XX char buf[20]; if (bcm47xx_nvram_getenv("xtalfreq", buf, sizeof(buf)) >= 0) crystalfreq = simple_strtoul(buf, NULL, 0); -#endif } switch (bus->chip_id) { --- /dev/null +++ b/include/linux/bcm47xx_nvram.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2005, Broadcom Corporation + * Copyright (C) 2006, Felix Fietkau <nbd@openwrt.org> + * Copyright (C) 2014 Hauke Mehrtens <hauke@hauke-m.de> + * + * 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. + */ + +#ifndef __BCM47XX_NVRAM_H +#define __BCM47XX_NVRAM_H + +#include <linux/types.h> +#include <linux/kernel.h> + +struct nvram_header { + u32 magic; + u32 len; + u32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:31 sdram_init */ + u32 config_refresh; /* 0:15 sdram_config, 16:31 sdram_refresh */ + u32 config_ncdl; /* ncdl values for memc */ +}; + +#define NVRAM_HEADER 0x48534C46 /* 'FLSH' */ +#define NVRAM_VERSION 1 +#define NVRAM_HEADER_SIZE 20 +#define NVRAM_SPACE 0x8000 + +#define FLASH_MIN 0x00020000 /* Minimum flash size */ + +#define NVRAM_MAX_VALUE_LEN 255 +#define NVRAM_MAX_PARAM_LEN 64 + +#ifdef CONFIG_BCM47XX +int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len); + +int bcm47xx_nvram_gpio_pin(const char *name); +#else +static inline int bcm47xx_nvram_getenv(const char *name, char *val, + size_t val_len) +{ + return -ENXIO; +} + +static inline int bcm47xx_nvram_gpio_pin(const char *name) +{ + return -ENXIO; +} +#endif + +static inline void bcm47xx_nvram_parse_macaddr(char *buf, u8 macaddr[6]) +{ + if (strchr(buf, ':')) + sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], + &macaddr[1], &macaddr[2], &macaddr[3], &macaddr[4], + &macaddr[5]); + else if (strchr(buf, '-')) + sscanf(buf, "%hhx-%hhx-%hhx-%hhx-%hhx-%hhx", &macaddr[0], + &macaddr[1], &macaddr[2], &macaddr[3], &macaddr[4], + &macaddr[5]); + else + pr_warn("Can not parse mac address: %s\n", buf); +} +#endif /* __BCM47XX_NVRAM_H */