* [PATCH 0/8 v3] pm9g45/pm9253/pm9261: add 1-wire support @ 2012-10-30 20:54 Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD 2012-11-01 15:29 ` [PATCH 0/8 v3] pm9g45/pm9253/pm9261: add 1-wire support Sascha Hauer 0 siblings, 2 replies; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 20:54 UTC (permalink / raw) To: barebox Hi, v3: comment v2: fixup and add comment add 1-wire support for: - pm9g45 - pm9263 - pm9261 use the 1-wire uniq id to generate a local mac address The OUI will be 'ron' => 72:6F:6E The patch series go on the top of the 1-wire support v2 The following changes since commit acaa716bce8cd1373cb5dabff54332fb1da7355b: 1-wire: add ds2433 support (2012-10-29 04:46:21 +0800) are available in the git repository at: git://git.jcrosoft.org/barebox.git delivery/ronetix_w1 for you to fetch changes up to 7fb0cb2ce2f7800341ab8de711dccbd2c4753c84: pm9261: use w1 serial number to generate local mac address (2012-10-30 13:44:54 +0800) ---------------------------------------------------------------- Jean-Christophe PLAGNIOL-VILLARD (8): arm: at91: add gpio_is_valid support w1: introduce helper to generate mac address from 1-wire id pm9g45: add 1-wire support pm9g45: use w1 serial number to generate local mac address pm9263: add 1-wire support pm9263: use w1 serial number to generate local mac address pm9261: add 1-wire support pm9261: use w1 serial number to generate local mac address arch/arm/boards/pm9261/init.c | 10 ++++++++++ arch/arm/boards/pm9263/init.c | 38 ++++++++++++++++++++++++++++++-------- arch/arm/boards/pm9g45/init.c | 22 +++++++++++++++++++--- arch/arm/configs/pm9261_defconfig | 2 ++ arch/arm/configs/pm9263_defconfig | 2 ++ arch/arm/configs/pm9g45_defconfig | 2 ++ arch/arm/mach-at91/include/mach/gpio.h | 11 +++++++++++ include/w1_mac_address.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 141 insertions(+), 11 deletions(-) create mode 100644 include/w1_mac_address.h Best Regards, J. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/8] arm: at91: add gpio_is_valid support 2012-10-30 20:54 [PATCH 0/8 v3] pm9g45/pm9253/pm9261: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 ` Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 2/8] w1: introduce helper to generate mac address from 1-wire id Jean-Christophe PLAGNIOL-VILLARD ` (6 more replies) 2012-11-01 15:29 ` [PATCH 0/8 v3] pm9g45/pm9253/pm9261: add 1-wire support Sascha Hauer 1 sibling, 7 replies; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/mach-at91/include/mach/gpio.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h index 3533bf9..fa695a6 100644 --- a/arch/arm/mach-at91/include/mach/gpio.h +++ b/arch/arm/mach-at91/include/mach/gpio.h @@ -22,6 +22,17 @@ /* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */ +#define ARCH_NR_GPIOS 256 + +static inline int gpio_is_valid(int gpio) +{ + if (gpio < 1) + return 0; + if (gpio < ARCH_NR_GPIOS) + return 1; + return 0; +} + #define AT91_PIN_PA0 (PIN_BASE + 0x00 + 0) #define AT91_PIN_PA1 (PIN_BASE + 0x00 + 1) #define AT91_PIN_PA2 (PIN_BASE + 0x00 + 2) -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/8] w1: introduce helper to generate mac address from 1-wire id 2012-10-30 21:00 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 ` Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 3/8] pm9g45: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD ` (5 subsequent siblings) 6 siblings, 0 replies; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 UTC (permalink / raw) To: barebox use the first 3 byte of the id of a 1-wire or 6 if no OUI provided device to provide an Ethernet address Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- include/w1_mac_address.h | 65 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 include/w1_mac_address.h diff --git a/include/w1_mac_address.h b/include/w1_mac_address.h new file mode 100644 index 0000000..89dd914 --- /dev/null +++ b/include/w1_mac_address.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com> + * + * Under GPLv2 only + */ + +#ifndef __W1_MAC_ADDRESS_H__ +#define __W1_MAC_ADDRESS_H__ + +/** + * w1_local_mac_address_register - use the first 3 byte of the id of a 1-wire + * or 6 if no OUI provided device to provide an Ethernet address + * @ethid: ethernet device id + * @oui: Ethernet OUI (3 bytes) + * @w1_dev: 1-wire device name + * + * Generate a local Ethernet address (MAC) that is not multicast using a 1-wire id. + */ +static inline int w1_local_mac_address_register(int ethid, char * oui, char *w1_dev) +{ + char addr[6]; + const char *val; + u64 id; + int nb_oui = 0; + int i, shift; + char *tmp = NULL; + int ret = 0; + + if (oui) { + nb_oui = 3; + + for (i = 0; i < nb_oui; i++) + addr[i] = oui[i]; + } + + tmp = asprintf("%s.id", w1_dev); + if (!tmp) + return -ENOMEM; + + val = getenv(tmp); + if (!val) { + ret = -EINVAL; + goto err; + } + + id = simple_strtoull(val, NULL, 16); + if (!id) { + ret = -EINVAL; + goto err; + } + + for (i = nb_oui, shift = 40; i < 6; i++, shift -= 8) + addr[i] = (id >> shift) & 0xff; + + addr[0] &= 0xfe; /* clear multicast bit */ + addr[0] |= 0x02; /* set local assignment bit (IEEE802) */ + + eth_register_ethaddr(ethid, addr); + +err: + free(tmp); + return ret; +} + +#endif /* __W1_MAC_ADDRESS_H__ */ -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/8] pm9g45: add 1-wire support 2012-10-30 21:00 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 2/8] w1: introduce helper to generate mac address from 1-wire id Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 ` Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 4/8] pm9g45: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD ` (4 subsequent siblings) 6 siblings, 0 replies; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/boards/pm9g45/init.c | 11 ++++++++++- arch/arm/configs/pm9g45_defconfig | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c index a12896b..907c6bb 100644 --- a/arch/arm/boards/pm9g45/init.c +++ b/arch/arm/boards/pm9g45/init.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com> + * Copyright (C) 2009-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com> * * Copyright (C) 2007 Sascha Hauer, Pengutronix * @@ -35,6 +35,12 @@ #include <mach/io.h> #include <mach/at91sam9_smc.h> #include <mach/sam9_smc.h> +#include <linux/w1-gpio.h> + +struct w1_gpio_platform_data w1_pdata = { + .pin = AT91_PIN_PA31, + .is_open_drain = 0, +}; static struct atmel_nand_data nand_pdata = { .ale = 21, @@ -132,6 +138,9 @@ mem_initcall(pm9g45_mem_init); static int pm9g45_devices_init(void) { + at91_set_gpio_input(w1_pdata.pin, 0); + add_generic_device_res("w1-gpio", DEVICE_ID_SINGLE, NULL, 0, &w1_pdata); + pm_add_device_nand(); pm9g45_add_device_mci(); pm9g45_phy_init(); diff --git a/arch/arm/configs/pm9g45_defconfig b/arch/arm/configs/pm9g45_defconfig index 958301d..d242bdc 100644 --- a/arch/arm/configs/pm9g45_defconfig +++ b/arch/arm/configs/pm9g45_defconfig @@ -56,6 +56,8 @@ CONFIG_USB_OHCI_AT91=y CONFIG_USB_STORAGE=y CONFIG_MCI=y CONFIG_MCI_ATMEL=y +CONFIG_W1=y +CONFIG_W1_MASTER_GPIO=y CONFIG_FS_TFTP=y CONFIG_FS_FAT=y CONFIG_FS_FAT_WRITE=y -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/8] pm9g45: use w1 serial number to generate local mac address 2012-10-30 21:00 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 2/8] w1: introduce helper to generate mac address from 1-wire id Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 3/8] pm9g45: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 ` Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 5/8] pm9263: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD ` (3 subsequent siblings) 6 siblings, 0 replies; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 UTC (permalink / raw) To: barebox The OUI will be 'ron' => 72:6F:6E Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/boards/pm9g45/init.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c index 907c6bb..675ebe8 100644 --- a/arch/arm/boards/pm9g45/init.c +++ b/arch/arm/boards/pm9g45/init.c @@ -36,6 +36,7 @@ #include <mach/at91sam9_smc.h> #include <mach/sam9_smc.h> #include <linux/w1-gpio.h> +#include <w1_mac_address.h> struct w1_gpio_platform_data w1_pdata = { .pin = AT91_PIN_PA31, @@ -128,6 +129,13 @@ static void pm9g45_phy_init(void) at91_set_gpio_value(AT91_PIN_PD2, 1); } +static void pm9g45_add_device_eth(void) +{ + w1_local_mac_address_register(0, "ron", "w1-1-0"); + pm9g45_phy_init(); + at91_add_device_eth(0, &macb_pdata); +} + static int pm9g45_mem_init(void) { at91_add_device_sdram(128 * 1024 * 1024); @@ -143,8 +151,7 @@ static int pm9g45_devices_init(void) pm_add_device_nand(); pm9g45_add_device_mci(); - pm9g45_phy_init(); - at91_add_device_eth(0, &macb_pdata); + pm9g45_add_device_eth(); pm9g45_add_device_usbh(); devfs_add_partition("nand0", 0x00000, SZ_128K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw"); -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 5/8] pm9263: add 1-wire support 2012-10-30 21:00 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD ` (2 preceding siblings ...) 2012-10-30 21:00 ` [PATCH 4/8] pm9g45: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 ` Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 6/8] pm9263: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD ` (2 subsequent siblings) 6 siblings, 0 replies; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/boards/pm9263/init.c | 11 +++++++++++ arch/arm/configs/pm9263_defconfig | 2 ++ 2 files changed, 13 insertions(+) diff --git a/arch/arm/boards/pm9263/init.c b/arch/arm/boards/pm9263/init.c index b17a90a..1d13e03 100644 --- a/arch/arm/boards/pm9263/init.c +++ b/arch/arm/boards/pm9263/init.c @@ -1,4 +1,6 @@ /* + * Copyright (C) 2009-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com> + * * Copyright (C) 2007 Sascha Hauer, Pengutronix * * This program is free software; you can redistribute it and/or @@ -34,6 +36,12 @@ #include <mach/io.h> #include <mach/at91sam9_smc.h> #include <mach/sam9_smc.h> +#include <linux/w1-gpio.h> + +struct w1_gpio_platform_data w1_pdata = { + .pin = AT91_PIN_PB31, + .is_open_drain = 0, +}; static struct atmel_nand_data nand_pdata = { .ale = 21, @@ -95,6 +103,9 @@ mem_initcall(pm9263_mem_init); static int pm9263_devices_init(void) { + at91_set_gpio_input(w1_pdata.pin, 0); + add_generic_device_res("w1-gpio", DEVICE_ID_SINGLE, NULL, 0, &w1_pdata); + /* * PB27 enables the 50MHz oscillator for Ethernet PHY * 1 - enable diff --git a/arch/arm/configs/pm9263_defconfig b/arch/arm/configs/pm9263_defconfig index 8c92894..e223e77 100644 --- a/arch/arm/configs/pm9263_defconfig +++ b/arch/arm/configs/pm9263_defconfig @@ -35,3 +35,5 @@ CONFIG_DRIVER_NET_MACB=y # CONFIG_SPI is not set CONFIG_DRIVER_CFI=y CONFIG_CFI_BUFFER_WRITE=y +CONFIG_W1=y +CONFIG_W1_MASTER_GPIO=y -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 6/8] pm9263: use w1 serial number to generate local mac address 2012-10-30 21:00 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD ` (3 preceding siblings ...) 2012-10-30 21:00 ` [PATCH 5/8] pm9263: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 ` Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 7/8] pm9261: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 8/8] pm9261: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD 6 siblings, 0 replies; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 UTC (permalink / raw) To: barebox The OUI will be 'ron' => 72:6F:6E Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/boards/pm9263/init.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/arch/arm/boards/pm9263/init.c b/arch/arm/boards/pm9263/init.c index 1d13e03..14e821f 100644 --- a/arch/arm/boards/pm9263/init.c +++ b/arch/arm/boards/pm9263/init.c @@ -37,6 +37,7 @@ #include <mach/at91sam9_smc.h> #include <mach/sam9_smc.h> #include <linux/w1-gpio.h> +#include <w1_mac_address.h> struct w1_gpio_platform_data w1_pdata = { .pin = AT91_PIN_PB31, @@ -93,6 +94,24 @@ static struct at91_ether_platform_data macb_pdata = { .phy_addr = 0, }; +static void pm9263_phy_init(void) +{ + /* + * PB27 enables the 50MHz oscillator for Ethernet PHY + * 1 - enable + * 0 - disable + */ + at91_set_gpio_output(AT91_PIN_PB27, 1); + at91_set_gpio_value(AT91_PIN_PB27, 1); /* 1- enable, 0 - disable */ +} + +static void pm9263_add_device_eth(void) +{ + w1_local_mac_address_register(0, "ron", "w1-1-0"); + pm9263_phy_init(); + at91_add_device_eth(0, &macb_pdata); +} + static int pm9263_mem_init(void) { at91_add_device_sdram(64 * 1024 * 1024); @@ -106,16 +125,8 @@ static int pm9263_devices_init(void) at91_set_gpio_input(w1_pdata.pin, 0); add_generic_device_res("w1-gpio", DEVICE_ID_SINGLE, NULL, 0, &w1_pdata); - /* - * PB27 enables the 50MHz oscillator for Ethernet PHY - * 1 - enable - * 0 - disable - */ - at91_set_gpio_output(AT91_PIN_PB27, 1); - at91_set_gpio_value(AT91_PIN_PB27, 1); /* 1- enable, 0 - disable */ - pm_add_device_nand(); - at91_add_device_eth(0, &macb_pdata); + pm9263_add_device_eth(); add_cfi_flash_device(0, AT91_CHIPSELECT_0, 4 * 1024 * 1024, 0); devfs_add_partition("nor0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self0"); -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 7/8] pm9261: add 1-wire support 2012-10-30 21:00 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD ` (4 preceding siblings ...) 2012-10-30 21:00 ` [PATCH 6/8] pm9263: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 ` Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 8/8] pm9261: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD 6 siblings, 0 replies; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/boards/pm9261/init.c | 8 ++++++++ arch/arm/configs/pm9261_defconfig | 2 ++ 2 files changed, 10 insertions(+) diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c index 5214394..2c3615f 100644 --- a/arch/arm/boards/pm9261/init.c +++ b/arch/arm/boards/pm9261/init.c @@ -1,4 +1,6 @@ /* + * Copyright (C) 2009-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com> + * * Copyright (C) 2007 Sascha Hauer, Pengutronix * * This program is free software; you can redistribute it and/or @@ -34,6 +36,12 @@ #include <mach/at91sam9_smc.h> #include <mach/sam9_smc.h> #include <dm9000.h> +#include <linux/w1-gpio.h> + +struct w1_gpio_platform_data w1_pdata = { + .pin = AT91_PIN_PA7, + .is_open_drain = 0, +}; static struct atmel_nand_data nand_pdata = { .ale = 22, diff --git a/arch/arm/configs/pm9261_defconfig b/arch/arm/configs/pm9261_defconfig index 1db16d5..0aea2c9 100644 --- a/arch/arm/configs/pm9261_defconfig +++ b/arch/arm/configs/pm9261_defconfig @@ -50,3 +50,5 @@ CONFIG_MTD=y CONFIG_NAND=y CONFIG_NAND_ATMEL=y CONFIG_UBI=y +CONFIG_W1=y +CONFIG_W1_MASTER_GPIO=y -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 8/8] pm9261: use w1 serial number to generate local mac address 2012-10-30 21:00 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD ` (5 preceding siblings ...) 2012-10-30 21:00 ` [PATCH 7/8] pm9261: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 ` Jean-Christophe PLAGNIOL-VILLARD 6 siblings, 0 replies; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-30 21:00 UTC (permalink / raw) To: barebox The OUI will be 'ron' => 72:6F:6E Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/boards/pm9261/init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c index 2c3615f..6d2ac98 100644 --- a/arch/arm/boards/pm9261/init.c +++ b/arch/arm/boards/pm9261/init.c @@ -37,6 +37,7 @@ #include <mach/sam9_smc.h> #include <dm9000.h> #include <linux/w1-gpio.h> +#include <w1_mac_address.h> struct w1_gpio_platform_data w1_pdata = { .pin = AT91_PIN_PA7, @@ -120,6 +121,7 @@ static struct sam9_smc_config __initdata dm9000_smc_config = { static void __init pm_add_device_dm9000(void) { + w1_local_mac_address_register(0, "ron", "w1-1-0"); /* Configure chip-select 2 (DM9000) */ sam9_smc_configure(2, &dm9000_smc_config); -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/8 v3] pm9g45/pm9253/pm9261: add 1-wire support 2012-10-30 20:54 [PATCH 0/8 v3] pm9g45/pm9253/pm9261: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-01 15:29 ` Sascha Hauer 1 sibling, 0 replies; 12+ messages in thread From: Sascha Hauer @ 2012-11-01 15:29 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox On Tue, Oct 30, 2012 at 09:54:59PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote: > Hi, > > v3: comment > > v2: fixup and add comment > > add 1-wire support for: > - pm9g45 > - pm9263 > - pm9261 > > use the 1-wire uniq id to generate a local mac address > The OUI will be 'ron' => 72:6F:6E > > The patch series go on the top of the 1-wire support v2 > > The following changes since commit acaa716bce8cd1373cb5dabff54332fb1da7355b: > > 1-wire: add ds2433 support (2012-10-29 04:46:21 +0800) > > are available in the git repository at: > > git://git.jcrosoft.org/barebox.git delivery/ronetix_w1 > > for you to fetch changes up to 7fb0cb2ce2f7800341ab8de711dccbd2c4753c84: > > pm9261: use w1 serial number to generate local mac address (2012-10-30 13:44:54 +0800) Applied, thanks. Sascha -- 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 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 0/8 v2:wqa] pm9g45/pm9253/pm9261: add 1-wire support @ 2012-10-29 13:40 Jean-Christophe PLAGNIOL-VILLARD 2012-10-29 13:46 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 1 reply; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-29 13:40 UTC (permalink / raw) To: barebox Hi, v2: fixup and add comment add 1-wire support for: - pm9g45 - pm9263 - pm9261 use the 1-wire uniq id to generate a local mac address The OUI will be 'ron' => 72:6F:6E The patch series go on the top of the 1-wire support v2 The following changes since commit acaa716bce8cd1373cb5dabff54332fb1da7355b: 1-wire: add ds2433 support (2012-10-29 04:46:21 +0800) are available in the git repository at: git://git.jcrosoft.org/barebox.git delivery/ronetix_w1 for you to fetch changes up to f64064f91ca518f538c5f9e92d4d4a80c75acdf4: pm9261: use w1 serial number to generate local mac address (2012-10-29 05:19:04 +0800) ---------------------------------------------------------------- Jean-Christophe PLAGNIOL-VILLARD (8): arm: at91: add gpio_is_valid support w1: introduce helper to generate mac address from 1-wire id pm9g45: add 1-wire support pm9g45: use w1 serial number to generate local mac address pm9263: add 1-wire support pm9263: use w1 serial number to generate local mac address pm9261: add 1-wire support pm9261: use w1 serial number to generate local mac address arch/arm/boards/pm9261/init.c | 10 ++++++++++ arch/arm/boards/pm9263/init.c | 38 ++++++++++++++++++++++++++++++-------- arch/arm/boards/pm9g45/init.c | 22 +++++++++++++++++++--- arch/arm/configs/pm9261_defconfig | 2 ++ arch/arm/configs/pm9263_defconfig | 2 ++ arch/arm/configs/pm9g45_defconfig | 2 ++ arch/arm/mach-at91/include/mach/gpio.h | 11 +++++++++++ include/w1_mac_address.h | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 148 insertions(+), 11 deletions(-) create mode 100644 include/w1_mac_address.h Best Regards, J. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/8] arm: at91: add gpio_is_valid support 2012-10-29 13:40 [PATCH 0/8 v2:wqa] " Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-29 13:46 ` Jean-Christophe PLAGNIOL-VILLARD 2012-10-29 13:46 ` [PATCH 3/8] pm9g45: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 1 reply; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-29 13:46 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/mach-at91/include/mach/gpio.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h index 3533bf9..fa695a6 100644 --- a/arch/arm/mach-at91/include/mach/gpio.h +++ b/arch/arm/mach-at91/include/mach/gpio.h @@ -22,6 +22,17 @@ /* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */ +#define ARCH_NR_GPIOS 256 + +static inline int gpio_is_valid(int gpio) +{ + if (gpio < 1) + return 0; + if (gpio < ARCH_NR_GPIOS) + return 1; + return 0; +} + #define AT91_PIN_PA0 (PIN_BASE + 0x00 + 0) #define AT91_PIN_PA1 (PIN_BASE + 0x00 + 1) #define AT91_PIN_PA2 (PIN_BASE + 0x00 + 2) -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/8] pm9g45: add 1-wire support 2012-10-29 13:46 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-29 13:46 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 0 replies; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-29 13:46 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/boards/pm9g45/init.c | 11 ++++++++++- arch/arm/configs/pm9g45_defconfig | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c index a12896b..907c6bb 100644 --- a/arch/arm/boards/pm9g45/init.c +++ b/arch/arm/boards/pm9g45/init.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com> + * Copyright (C) 2009-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com> * * Copyright (C) 2007 Sascha Hauer, Pengutronix * @@ -35,6 +35,12 @@ #include <mach/io.h> #include <mach/at91sam9_smc.h> #include <mach/sam9_smc.h> +#include <linux/w1-gpio.h> + +struct w1_gpio_platform_data w1_pdata = { + .pin = AT91_PIN_PA31, + .is_open_drain = 0, +}; static struct atmel_nand_data nand_pdata = { .ale = 21, @@ -132,6 +138,9 @@ mem_initcall(pm9g45_mem_init); static int pm9g45_devices_init(void) { + at91_set_gpio_input(w1_pdata.pin, 0); + add_generic_device_res("w1-gpio", DEVICE_ID_SINGLE, NULL, 0, &w1_pdata); + pm_add_device_nand(); pm9g45_add_device_mci(); pm9g45_phy_init(); diff --git a/arch/arm/configs/pm9g45_defconfig b/arch/arm/configs/pm9g45_defconfig index 958301d..d242bdc 100644 --- a/arch/arm/configs/pm9g45_defconfig +++ b/arch/arm/configs/pm9g45_defconfig @@ -56,6 +56,8 @@ CONFIG_USB_OHCI_AT91=y CONFIG_USB_STORAGE=y CONFIG_MCI=y CONFIG_MCI_ATMEL=y +CONFIG_W1=y +CONFIG_W1_MASTER_GPIO=y CONFIG_FS_TFTP=y CONFIG_FS_FAT=y CONFIG_FS_FAT_WRITE=y -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 0/8] pm9g45/pm9253/pm9261: add 1-wire support @ 2012-10-28 0:21 Jean-Christophe PLAGNIOL-VILLARD 2012-10-28 0:24 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 1 reply; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-28 0:21 UTC (permalink / raw) To: barebox Hi, add 1-wire support for: - pm9g45 - pm9263 - pm9261 use the 1-wire uniq id to generate a local mac address The OUI will be 'ron' => 72:6F:6E The patch series go on the top of the 1-wire support The following changes since commit 91413767b35d5f9f66d14376c925386a42d1db0e: 1-wire: add ds2433 support (2012-10-27 12:47:20 +0800) are available in the git repository at: git://git.jcrosoft.org/barebox.git delivery/ronetix_w1 for you to fetch changes up to 32c1cc8c210614799454e63cd2728470ab8732b5: pm9261: use w1 serial number to generate local mac address (2012-10-27 17:08:03 +0800) ---------------------------------------------------------------- Jean-Christophe PLAGNIOL-VILLARD (8): arm: at91: add gpio_is_valid support w1: introduce helper to generate mac address from 1-wire id pm9g45: add 1-wire support pm9g45: use w1 serial number to generate local mac address pm9263: add 1-wire support pm9263: use w1 serial number to generate local mac address pm9261: add 1-wire support pm9261: use w1 serial number to generate local mac address arch/arm/boards/pm9261/init.c | 10 ++++++++++ arch/arm/boards/pm9263/init.c | 38 ++++++++++++++++++++++++++++++-------- arch/arm/boards/pm9g45/init.c | 22 +++++++++++++++++++--- arch/arm/configs/pm9261_defconfig | 2 ++ arch/arm/configs/pm9263_defconfig | 2 ++ arch/arm/configs/pm9g45_defconfig | 2 ++ arch/arm/mach-at91/include/mach/gpio.h | 11 +++++++++++ include/w1_mac_address.h | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 140 insertions(+), 11 deletions(-) create mode 100644 include/w1_mac_address.h Best Regards, J. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/8] arm: at91: add gpio_is_valid support 2012-10-28 0:21 [PATCH 0/8] pm9g45/pm9253/pm9261: " Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-28 0:24 ` Jean-Christophe PLAGNIOL-VILLARD 2012-10-28 0:24 ` [PATCH 3/8] pm9g45: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 1 reply; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-28 0:24 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/mach-at91/include/mach/gpio.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h index 3533bf9..4edfd25 100644 --- a/arch/arm/mach-at91/include/mach/gpio.h +++ b/arch/arm/mach-at91/include/mach/gpio.h @@ -22,6 +22,17 @@ /* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */ +#define ARCH_NR_GPIOS 256 + +static inline int gpio_is_valid(int gpio) +{ + if (gpio < 0) + return 0; + if (gpio < ARCH_NR_GPIOS) + return 1; + return 0; +} + #define AT91_PIN_PA0 (PIN_BASE + 0x00 + 0) #define AT91_PIN_PA1 (PIN_BASE + 0x00 + 1) #define AT91_PIN_PA2 (PIN_BASE + 0x00 + 2) -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/8] pm9g45: add 1-wire support 2012-10-28 0:24 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-28 0:24 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 0 replies; 12+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-28 0:24 UTC (permalink / raw) To: barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> --- arch/arm/boards/pm9g45/init.c | 11 ++++++++++- arch/arm/configs/pm9g45_defconfig | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c index a12896b..907c6bb 100644 --- a/arch/arm/boards/pm9g45/init.c +++ b/arch/arm/boards/pm9g45/init.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com> + * Copyright (C) 2009-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com> * * Copyright (C) 2007 Sascha Hauer, Pengutronix * @@ -35,6 +35,12 @@ #include <mach/io.h> #include <mach/at91sam9_smc.h> #include <mach/sam9_smc.h> +#include <linux/w1-gpio.h> + +struct w1_gpio_platform_data w1_pdata = { + .pin = AT91_PIN_PA31, + .is_open_drain = 0, +}; static struct atmel_nand_data nand_pdata = { .ale = 21, @@ -132,6 +138,9 @@ mem_initcall(pm9g45_mem_init); static int pm9g45_devices_init(void) { + at91_set_gpio_input(w1_pdata.pin, 0); + add_generic_device_res("w1-gpio", DEVICE_ID_SINGLE, NULL, 0, &w1_pdata); + pm_add_device_nand(); pm9g45_add_device_mci(); pm9g45_phy_init(); diff --git a/arch/arm/configs/pm9g45_defconfig b/arch/arm/configs/pm9g45_defconfig index 958301d..d242bdc 100644 --- a/arch/arm/configs/pm9g45_defconfig +++ b/arch/arm/configs/pm9g45_defconfig @@ -56,6 +56,8 @@ CONFIG_USB_OHCI_AT91=y CONFIG_USB_STORAGE=y CONFIG_MCI=y CONFIG_MCI_ATMEL=y +CONFIG_W1=y +CONFIG_W1_MASTER_GPIO=y CONFIG_FS_TFTP=y CONFIG_FS_FAT=y CONFIG_FS_FAT_WRITE=y -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-11-01 15:29 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-10-30 20:54 [PATCH 0/8 v3] pm9g45/pm9253/pm9261: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 2/8] w1: introduce helper to generate mac address from 1-wire id Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 3/8] pm9g45: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 4/8] pm9g45: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 5/8] pm9263: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 6/8] pm9263: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 7/8] pm9261: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD 2012-10-30 21:00 ` [PATCH 8/8] pm9261: use w1 serial number to generate local mac address Jean-Christophe PLAGNIOL-VILLARD 2012-11-01 15:29 ` [PATCH 0/8 v3] pm9g45/pm9253/pm9261: add 1-wire support Sascha Hauer -- strict thread matches above, loose matches on Subject: below -- 2012-10-29 13:40 [PATCH 0/8 v2:wqa] " Jean-Christophe PLAGNIOL-VILLARD 2012-10-29 13:46 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD 2012-10-29 13:46 ` [PATCH 3/8] pm9g45: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD 2012-10-28 0:21 [PATCH 0/8] pm9g45/pm9253/pm9261: " Jean-Christophe PLAGNIOL-VILLARD 2012-10-28 0:24 ` [PATCH 1/8] arm: at91: add gpio_is_valid support Jean-Christophe PLAGNIOL-VILLARD 2012-10-28 0:24 ` [PATCH 3/8] pm9g45: add 1-wire support Jean-Christophe PLAGNIOL-VILLARD
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox