summaryrefslogtreecommitdiffstats
path: root/kernel/Documentation/networking/alias.txt
blob: 85046f53fcfccb09633167a81b40017aae30884e (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
IP-Aliasing:
============

IP-aliases are an obsolete way to manage multiple IP-addresses/masks
per interface. Newer tools such as iproute2 support multiple
address/prefixes per interface, but aliases are still supported
for backwards compatibility.

An alias is formed by adding a colon and a string when running ifconfig.
This string is usually numeric, but this is not a must.

o Alias creation.
  Alias creation is done by 'magic' interface naming: eg. to create a
  200.1.1.1 alias for eth0 ...
  
    # ifconfig eth0:0 200.1.1.1  etc,etc....
                   ~~ -> request alias #0 creation (if not yet exists) for eth0

    The corresponding route is also set up by this command. 
    Please note: The route always points to the base interface.
	

o Alias deletion.
  The alias is removed by shutting the alias down:

    # ifconfig eth0:0 down
                 ~~~~~~~~~~ -> will delete alias

  		   		   
o Alias (re-)configuring

  Aliases are not real devices, but programs should be able to configure and
  refer to them as usual (ifconfig, route, etc).


o Relationship with main device

  If the base device is shut down the added aliases will be deleted 
  too.
* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/mfd/pcf50633/core.h> #include <linux/mfd/pcf50633/gpio.h> #include <linux/mfd/pcf50633/pmic.h> static const u8 pcf50633_regulator_registers[PCF50633_NUM_REGULATORS] = { [PCF50633_REGULATOR_AUTO] = PCF50633_REG_AUTOOUT, [PCF50633_REGULATOR_DOWN1] = PCF50633_REG_DOWN1OUT, [PCF50633_REGULATOR_DOWN2] = PCF50633_REG_DOWN2OUT, [PCF50633_REGULATOR_MEMLDO] = PCF50633_REG_MEMLDOOUT, [PCF50633_REGULATOR_LDO1] = PCF50633_REG_LDO1OUT, [PCF50633_REGULATOR_LDO2] = PCF50633_REG_LDO2OUT, [PCF50633_REGULATOR_LDO3] = PCF50633_REG_LDO3OUT, [PCF50633_REGULATOR_LDO4] = PCF50633_REG_LDO4OUT, [PCF50633_REGULATOR_LDO5] = PCF50633_REG_LDO5OUT, [PCF50633_REGULATOR_LDO6] = PCF50633_REG_LDO6OUT, [PCF50633_REGULATOR_HCLDO] = PCF50633_REG_HCLDOOUT, }; int pcf50633_gpio_set(struct pcf50633 *pcf, int gpio, u8 val) { u8 reg; reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG; return pcf50633_reg_set_bit_mask(pcf, reg, 0x07, val); } EXPORT_SYMBOL_GPL(pcf50633_gpio_set); u8 pcf50633_gpio_get(struct pcf50633 *pcf, int gpio) { u8 reg, val; reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG; val = pcf50633_reg_read(pcf, reg) & 0x07; return val; } EXPORT_SYMBOL_GPL(pcf50633_gpio_get); int pcf50633_gpio_invert_set(struct pcf50633 *pcf, int gpio, int invert) { u8 val, reg; reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG; val = !!invert << 3; return pcf50633_reg_set_bit_mask(pcf, reg, 1 << 3, val); } EXPORT_SYMBOL_GPL(pcf50633_gpio_invert_set); int pcf50633_gpio_invert_get(struct pcf50633 *pcf, int gpio) { u8 reg, val; reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG; val = pcf50633_reg_read(pcf, reg); return val & (1 << 3); } EXPORT_SYMBOL_GPL(pcf50633_gpio_invert_get); int pcf50633_gpio_power_supply_set(struct pcf50633 *pcf, int gpio, int regulator, int on) { u8 reg, val, mask; /* the *ENA register is always one after the *OUT register */ reg = pcf50633_regulator_registers[regulator] + 1; val = !!on << (gpio - PCF50633_GPIO1); mask = 1 << (gpio - PCF50633_GPIO1); return pcf50633_reg_set_bit_mask(pcf, reg, mask, val); } EXPORT_SYMBOL_GPL(pcf50633_gpio_power_supply_set); MODULE_LICENSE("GPL");