From dea54ca840f78e12e68ca0799ec841d0348b2ebd Mon Sep 17 00:00:00 2001 From: juhosg Date: Mon, 10 Dec 2012 15:46:15 +0000 Subject: mac80211: ath9k: allow to load EEPROM data via firmware API Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34606 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic/files/include/linux/ath9k_platform.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'target/linux/generic/files/include') diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h index 53b25d229..a0b7531fd 100644 --- a/target/linux/generic/files/include/linux/ath9k_platform.h +++ b/target/linux/generic/files/include/linux/ath9k_platform.h @@ -22,6 +22,8 @@ #define ATH9K_PLAT_EEP_MAX_WORDS 2048 struct ath9k_platform_data { + const char *eeprom_name; + u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; u8 *macaddr; -- cgit v1.2.3 From 7dfa4e540548edaf84a162475925755162bc9f04 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 14 Dec 2012 12:11:41 +0000 Subject: generic: disintegrate UAPI from include/linux/switch.h Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34677 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic/files/include/linux/switch.h | 85 +------------------ .../generic/files/include/uapi/linux/switch.h | 94 ++++++++++++++++++++++ 2 files changed, 98 insertions(+), 81 deletions(-) create mode 100644 target/linux/generic/files/include/uapi/linux/switch.h (limited to 'target/linux/generic/files/include') diff --git a/target/linux/generic/files/include/linux/switch.h b/target/linux/generic/files/include/linux/switch.h index 4f4085ef8..bd4fae4a1 100644 --- a/target/linux/generic/files/include/linux/switch.h +++ b/target/linux/generic/files/include/linux/switch.h @@ -13,86 +13,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ +#ifndef _LINUX_SWITCH_H +#define _LINUX_SWITCH_H -#ifndef __LINUX_SWITCH_H -#define __LINUX_SWITCH_H - -#include -#include -#include -#include -#ifndef __KERNEL__ -#include -#include -#include -#else #include -#endif - -/* main attributes */ -enum { - SWITCH_ATTR_UNSPEC, - /* global */ - SWITCH_ATTR_TYPE, - /* device */ - SWITCH_ATTR_ID, - SWITCH_ATTR_DEV_NAME, - SWITCH_ATTR_ALIAS, - SWITCH_ATTR_NAME, - SWITCH_ATTR_VLANS, - SWITCH_ATTR_PORTS, - SWITCH_ATTR_CPU_PORT, - /* attributes */ - SWITCH_ATTR_OP_ID, - SWITCH_ATTR_OP_TYPE, - SWITCH_ATTR_OP_NAME, - SWITCH_ATTR_OP_PORT, - SWITCH_ATTR_OP_VLAN, - SWITCH_ATTR_OP_VALUE_INT, - SWITCH_ATTR_OP_VALUE_STR, - SWITCH_ATTR_OP_VALUE_PORTS, - SWITCH_ATTR_OP_DESCRIPTION, - /* port lists */ - SWITCH_ATTR_PORT, - SWITCH_ATTR_MAX -}; - -/* commands */ -enum { - SWITCH_CMD_UNSPEC, - SWITCH_CMD_GET_SWITCH, - SWITCH_CMD_NEW_ATTR, - SWITCH_CMD_LIST_GLOBAL, - SWITCH_CMD_GET_GLOBAL, - SWITCH_CMD_SET_GLOBAL, - SWITCH_CMD_LIST_PORT, - SWITCH_CMD_GET_PORT, - SWITCH_CMD_SET_PORT, - SWITCH_CMD_LIST_VLAN, - SWITCH_CMD_GET_VLAN, - SWITCH_CMD_SET_VLAN -}; - -/* data types */ -enum switch_val_type { - SWITCH_TYPE_UNSPEC, - SWITCH_TYPE_INT, - SWITCH_TYPE_STRING, - SWITCH_TYPE_PORTS, - SWITCH_TYPE_NOVAL, -}; - -/* port nested attributes */ -enum { - SWITCH_PORT_UNSPEC, - SWITCH_PORT_ID, - SWITCH_PORT_FLAG_TAGGED, - SWITCH_PORT_ATTR_MAX -}; - -#define SWITCH_ATTR_DEFAULTS_OFFSET 0x1000 - -#ifdef __KERNEL__ +#include struct switch_dev; struct switch_op; @@ -232,6 +157,4 @@ struct switch_attr { int max; }; -#endif - -#endif +#endif /* _LINUX_SWITCH_H */ diff --git a/target/linux/generic/files/include/uapi/linux/switch.h b/target/linux/generic/files/include/uapi/linux/switch.h new file mode 100644 index 000000000..581caf168 --- /dev/null +++ b/target/linux/generic/files/include/uapi/linux/switch.h @@ -0,0 +1,94 @@ +/* + * switch.h: Switch configuration API + * + * Copyright (C) 2008 Felix Fietkau + * + * 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. + */ + +#ifndef _UAPI_LINUX_SWITCH_H +#define _UAPI_LINUX_SWITCH_H + +#include +#include +#include +#include +#ifndef __KERNEL__ +#include +#include +#include +#endif + +/* main attributes */ +enum { + SWITCH_ATTR_UNSPEC, + /* global */ + SWITCH_ATTR_TYPE, + /* device */ + SWITCH_ATTR_ID, + SWITCH_ATTR_DEV_NAME, + SWITCH_ATTR_ALIAS, + SWITCH_ATTR_NAME, + SWITCH_ATTR_VLANS, + SWITCH_ATTR_PORTS, + SWITCH_ATTR_CPU_PORT, + /* attributes */ + SWITCH_ATTR_OP_ID, + SWITCH_ATTR_OP_TYPE, + SWITCH_ATTR_OP_NAME, + SWITCH_ATTR_OP_PORT, + SWITCH_ATTR_OP_VLAN, + SWITCH_ATTR_OP_VALUE_INT, + SWITCH_ATTR_OP_VALUE_STR, + SWITCH_ATTR_OP_VALUE_PORTS, + SWITCH_ATTR_OP_DESCRIPTION, + /* port lists */ + SWITCH_ATTR_PORT, + SWITCH_ATTR_MAX +}; + +/* commands */ +enum { + SWITCH_CMD_UNSPEC, + SWITCH_CMD_GET_SWITCH, + SWITCH_CMD_NEW_ATTR, + SWITCH_CMD_LIST_GLOBAL, + SWITCH_CMD_GET_GLOBAL, + SWITCH_CMD_SET_GLOBAL, + SWITCH_CMD_LIST_PORT, + SWITCH_CMD_GET_PORT, + SWITCH_CMD_SET_PORT, + SWITCH_CMD_LIST_VLAN, + SWITCH_CMD_GET_VLAN, + SWITCH_CMD_SET_VLAN +}; + +/* data types */ +enum switch_val_type { + SWITCH_TYPE_UNSPEC, + SWITCH_TYPE_INT, + SWITCH_TYPE_STRING, + SWITCH_TYPE_PORTS, + SWITCH_TYPE_NOVAL, +}; + +/* port nested attributes */ +enum { + SWITCH_PORT_UNSPEC, + SWITCH_PORT_ID, + SWITCH_PORT_FLAG_TAGGED, + SWITCH_PORT_ATTR_MAX +}; + +#define SWITCH_ATTR_DEFAULTS_OFFSET 0x1000 + + +#endif /* _UAPI_LINUX_SWITCH_H */ -- cgit v1.2.3 From e1ab1fcace1fb828b007bafca84a70185cb2dd72 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 22 Dec 2012 12:12:35 +0000 Subject: generic: ar8216: rename cpuport_cfg to port0_cfg in ar8327_platform_data Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34846 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic/files/include/linux/ar8216_platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'target/linux/generic/files/include') diff --git a/target/linux/generic/files/include/linux/ar8216_platform.h b/target/linux/generic/files/include/linux/ar8216_platform.h index f5c2ef065..f1673dbb5 100644 --- a/target/linux/generic/files/include/linux/ar8216_platform.h +++ b/target/linux/generic/files/include/linux/ar8216_platform.h @@ -74,7 +74,7 @@ struct ar8327_platform_data { struct ar8327_pad_cfg *pad0_cfg; struct ar8327_pad_cfg *pad5_cfg; struct ar8327_pad_cfg *pad6_cfg; - struct ar8327_port_cfg cpuport_cfg; + struct ar8327_port_cfg port0_cfg; struct ar8327_led_cfg *led_cfg; }; -- cgit v1.2.3 From 565673cb046dbdc776fdfd34ab06884d6b3e4428 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 22 Dec 2012 12:12:37 +0000 Subject: generic: ar8316: allow to configure port 6 via platform data on AR8327 Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34847 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic/files/include/linux/ar8216_platform.h | 1 + 1 file changed, 1 insertion(+) (limited to 'target/linux/generic/files/include') diff --git a/target/linux/generic/files/include/linux/ar8216_platform.h b/target/linux/generic/files/include/linux/ar8216_platform.h index f1673dbb5..5c75777fc 100644 --- a/target/linux/generic/files/include/linux/ar8216_platform.h +++ b/target/linux/generic/files/include/linux/ar8216_platform.h @@ -75,6 +75,7 @@ struct ar8327_platform_data { struct ar8327_pad_cfg *pad5_cfg; struct ar8327_pad_cfg *pad6_cfg; struct ar8327_port_cfg port0_cfg; + struct ar8327_port_cfg port6_cfg; struct ar8327_led_cfg *led_cfg; }; -- cgit v1.2.3 From a735287d68606c95d42bceb571d83c40f6de458b Mon Sep 17 00:00:00 2001 From: juhosg Date: Tue, 25 Dec 2012 18:45:31 +0000 Subject: generic: ar8216: add sgmii_delay_en field to ar8327_platform_data Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34881 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic/files/include/linux/ar8216_platform.h | 1 + 1 file changed, 1 insertion(+) (limited to 'target/linux/generic/files/include') diff --git a/target/linux/generic/files/include/linux/ar8216_platform.h b/target/linux/generic/files/include/linux/ar8216_platform.h index 5c75777fc..c6c6144e8 100644 --- a/target/linux/generic/files/include/linux/ar8216_platform.h +++ b/target/linux/generic/files/include/linux/ar8216_platform.h @@ -44,6 +44,7 @@ struct ar8327_pad_cfg { bool pipe_rxclk_sel; bool txclk_delay_en; bool rxclk_delay_en; + bool sgmii_delay_en; enum ar8327_clk_delay_sel txclk_delay_sel; enum ar8327_clk_delay_sel rxclk_delay_sel; }; -- cgit v1.2.3 From 2ccb9e15c45b7159e5c09f49ab4062c8d34b779e Mon Sep 17 00:00:00 2001 From: jogo Date: Wed, 23 Jan 2013 10:12:33 +0000 Subject: generic: add b53 swconfig switch driver Add swconfig switch driver for Broadcom BCM53XX switch chips. Supports switches connected through MDIO, SPI or memory mapped registers, and supports BCM5325, BCM539x, BCM531x5 and the BCM63XX internal switch chips. Tested are BCM5325 trough MDIO, BCM53115 through SPI, and BCM6328. Signed-off-by: Jonas Gorski git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35305 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files/include/linux/platform_data/b53.h | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 target/linux/generic/files/include/linux/platform_data/b53.h (limited to 'target/linux/generic/files/include') diff --git a/target/linux/generic/files/include/linux/platform_data/b53.h b/target/linux/generic/files/include/linux/platform_data/b53.h new file mode 100644 index 000000000..78427417a --- /dev/null +++ b/target/linux/generic/files/include/linux/platform_data/b53.h @@ -0,0 +1,36 @@ +/* + * B53 platform data + * + * Copyright (C) 2013 Jonas Gorski + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef __B53_H +#define __B53_H + +#include + +struct b53_platform_data { + u32 chip_id; + u16 enabled_ports; + + /* allow to specify an ethX alias */ + const char *alias; + + /* only used by MMAP'd driver */ + unsigned big_endian:1; + void __iomem *regs; +}; + +#endif -- cgit v1.2.3 From ef55a217d20e3910d4a37af41447cfffb1178591 Mon Sep 17 00:00:00 2001 From: blogic Date: Tue, 9 Apr 2013 14:19:09 +0000 Subject: [swconfig] allow loading port maps from OF Signed-off-by: John Crispin git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36283 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic/files/include/linux/switch.h | 7 +++++++ target/linux/generic/files/include/uapi/linux/switch.h | 9 +++++++++ 2 files changed, 16 insertions(+) (limited to 'target/linux/generic/files/include') diff --git a/target/linux/generic/files/include/linux/switch.h b/target/linux/generic/files/include/linux/switch.h index bd4fae4a1..b53431e0a 100644 --- a/target/linux/generic/files/include/linux/switch.h +++ b/target/linux/generic/files/include/linux/switch.h @@ -98,6 +98,7 @@ struct switch_dev_ops { }; struct switch_dev { + struct device_node *of_node; const struct switch_dev_ops *ops; /* will be automatically filled */ char devname[IFNAMSIZ]; @@ -118,6 +119,7 @@ struct switch_dev { struct mutex sw_mutex; struct switch_port *portbuf; + struct switch_portmap *portmap; char buf[128]; @@ -131,6 +133,11 @@ struct switch_port { u32 flags; }; +struct switch_portmap { + u32 virt; + const char *s; +}; + struct switch_val { const struct switch_attr *attr; int port_vlan; diff --git a/target/linux/generic/files/include/uapi/linux/switch.h b/target/linux/generic/files/include/uapi/linux/switch.h index 581caf168..a59b23953 100644 --- a/target/linux/generic/files/include/uapi/linux/switch.h +++ b/target/linux/generic/files/include/uapi/linux/switch.h @@ -39,6 +39,7 @@ enum { SWITCH_ATTR_NAME, SWITCH_ATTR_VLANS, SWITCH_ATTR_PORTS, + SWITCH_ATTR_PORTMAP, SWITCH_ATTR_CPU_PORT, /* attributes */ SWITCH_ATTR_OP_ID, @@ -55,6 +56,14 @@ enum { SWITCH_ATTR_MAX }; +enum { + /* port map */ + SWITCH_PORTMAP_PORTS, + SWITCH_PORTMAP_SEGMENT, + SWITCH_PORTMAP_VIRT, + SWITCH_PORTMAP_MAX +}; + /* commands */ enum { SWITCH_CMD_UNSPEC, -- cgit v1.2.3 From ef77747cb21ddfb51a07925974a9656f8f05f6f1 Mon Sep 17 00:00:00 2001 From: jogo Date: Sun, 28 Apr 2013 11:10:42 +0000 Subject: kernel: add missing bcma defines and header file for bcrmfmac Fixes build failure when having kmod-mmc and brcmfmac selected. Signed-off-by: Jonas Gorski git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36468 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../include/linux/platform_data/brcmfmac-sdio.h | 124 +++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 target/linux/generic/files/include/linux/platform_data/brcmfmac-sdio.h (limited to 'target/linux/generic/files/include') diff --git a/target/linux/generic/files/include/linux/platform_data/brcmfmac-sdio.h b/target/linux/generic/files/include/linux/platform_data/brcmfmac-sdio.h new file mode 100644 index 000000000..1ade657d5 --- /dev/null +++ b/target/linux/generic/files/include/linux/platform_data/brcmfmac-sdio.h @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2013 Broadcom Corporation + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LINUX_BRCMFMAC_PLATFORM_H +#define _LINUX_BRCMFMAC_PLATFORM_H + +/* + * Platform specific driver functions and data. Through the platform specific + * device data functions can be provided to help the brcmfmac driver to + * operate with the device in combination with the used platform. + * + * Use the platform data in the following (similar) way: + * + * +#include + + +static void brcmfmac_power_on(void) +{ +} + +static void brcmfmac_power_off(void) +{ +} + +static void brcmfmac_reset(void) +{ +} + +static struct brcmfmac_sdio_platform_data brcmfmac_sdio_pdata = { + .power_on = brcmfmac_power_on, + .power_off = brcmfmac_power_off, + .reset = brcmfmac_reset +}; + +static struct platform_device brcmfmac_device = { + .name = BRCMFMAC_SDIO_PDATA_NAME, + .id = PLATFORM_DEVID_NONE, + .dev.platform_data = &brcmfmac_sdio_pdata +}; + +void __init brcmfmac_init_pdata(void) +{ + brcmfmac_sdio_pdata.oob_irq_supported = true; + brcmfmac_sdio_pdata.oob_irq_nr = gpio_to_irq(GPIO_BRCMF_SDIO_OOB); + brcmfmac_sdio_pdata.oob_irq_flags = IORESOURCE_IRQ | + IORESOURCE_IRQ_HIGHLEVEL; + platform_device_register(&brcmfmac_device); +} + * + * + * Note: the brcmfmac can be loaded as module or be statically built-in into + * the kernel. If built-in then do note that it uses module_init (and + * module_exit) routines which equal device_initcall. So if you intend to + * create a module with the platform specific data for the brcmfmac and have + * it built-in to the kernel then use a higher initcall then device_initcall + * (see init.h). If this is not done then brcmfmac will load without problems + * but will not pickup the platform data. + * + * When the driver does not "detect" platform driver data then it will continue + * without reporting anything and just assume there is no data needed. Which is + * probably true for most platforms. + * + * Explanation of the platform_data fields: + * + * drive_strength: is the preferred drive_strength to be used for the SDIO + * pins. If 0 then a default value will be used. This is the target drive + * strength, the exact drive strength which will be used depends on the + * capabilities of the device. + * + * oob_irq_supported: does the board have support for OOB interrupts. SDIO + * in-band interrupts are relatively slow and for having less overhead on + * interrupt processing an out of band interrupt can be used. If the HW + * supports this then enable this by setting this field to true and configure + * the oob related fields. + * + * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are + * used for registering the irq using request_irq function. + * + * power_on: This function is called by the brcmfmac when the module gets + * loaded. This can be particularly useful for low power devices. The platform + * spcific routine may for example decide to power up the complete device. + * If there is no use-case for this function then provide NULL. + * + * power_off: This function is called by the brcmfmac when the module gets + * unloaded. At this point the device can be powered down or otherwise be reset. + * So if an actual power_off is not supported but reset is then reset the device + * when this function gets called. This can be particularly useful for low power + * devices. If there is no use-case for this function (either power-down or + * reset) then provide NULL. + * + * reset: This function can get called if the device communication broke down. + * This functionality is particularly useful in case of SDIO type devices. It is + * possible to reset a dongle via sdio data interface, but it requires that + * this is fully functional. This function is chip/module specific and this + * function should return only after the complete reset has completed. + */ + +#define BRCMFMAC_SDIO_PDATA_NAME "brcmfmac_sdio" + +struct brcmfmac_sdio_platform_data { + unsigned int drive_strength; + bool oob_irq_supported; + unsigned int oob_irq_nr; + unsigned long oob_irq_flags; + void (*power_on)(void); + void (*power_off)(void); + void (*reset)(void); +}; + +#endif /* _LINUX_BRCMFMAC_PLATFORM_H */ -- cgit v1.2.3