Root/target/linux/lantiq/files/arch/mips/lantiq/xway/mach-h201l.c

1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License version 2 as published
4 * by the Free Software Foundation.
5 *
6 * Copyright (C) 2012 Luka Perkov <openwrt@lukaperkov.net>
7 */
8
9#include <linux/init.h>
10#include <linux/platform_device.h>
11#include <linux/leds.h>
12#include <linux/gpio.h>
13#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h>
15#include <linux/mtd/physmap.h>
16#include <linux/input.h>
17#include <linux/kernel.h>
18#include <linux/delay.h>
19#include <linux/io.h>
20#include <linux/if_ether.h>
21#include <linux/etherdevice.h>
22#include <linux/string.h>
23
24#include <lantiq_soc.h>
25#include <lantiq_platform.h>
26#include <dev-gpio-leds.h>
27#include <dev-gpio-buttons.h>
28
29#include "../machtypes.h"
30#include "devices.h"
31#include "dev-dwc_otg.h"
32
33static u8 ltq_ethaddr[6] = { 0 };
34
35static int __init
36setup_ethaddr(char *str)
37{
38    if (!mac_pton(str, ltq_ethaddr))
39        memset(ltq_ethaddr, 0, 6);
40    return 0;
41}
42__setup("ethaddr=", setup_ethaddr);
43
44static struct mtd_partition h201l_partitions[] __initdata =
45{
46    {
47        .name = "uboot",
48        .offset = 0x0,
49        .size = 0x20000,
50    },
51    {
52        .name = "uboot_env",
53        .offset = 0x20000,
54        .size = 0x10000,
55    },
56    {
57        .name = "linux",
58        .offset = 0x30000,
59        .size = 0x7d0000,
60    },
61};
62
63static struct physmap_flash_data h201l_flash_data __initdata = {
64    .nr_parts = ARRAY_SIZE(h201l_partitions),
65    .parts = h201l_partitions,
66};
67
68static struct gpio_led
69h201l_leds_gpio[] __initdata = {
70};
71
72static struct gpio_keys_button
73h201l_gpio_keys[] __initdata = {
74};
75
76static struct ltq_eth_data ltq_eth_data = {
77    .mii_mode = PHY_INTERFACE_MODE_RMII,
78};
79
80static void __init
81h201l_init(void)
82{
83    ltq_register_gpio_stp();
84    ltq_register_nor(&h201l_flash_data);
85    ltq_add_device_gpio_leds(-1, ARRAY_SIZE(h201l_leds_gpio), h201l_leds_gpio);
86    ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(h201l_gpio_keys), h201l_gpio_keys);
87
88    if (!is_valid_ether_addr(ltq_ethaddr))
89        random_ether_addr(ltq_ethaddr);
90
91    memcpy(&ltq_eth_data.mac.sa_data, ltq_ethaddr, 6);
92    ltq_register_etop(&ltq_eth_data);
93
94    xway_register_dwc(-1);
95}
96
97MIPS_MACHINE(LANTIQ_MACH_H201L,
98            "H201L",
99            "ZTE ZXV10 H201L",
100            h201l_init);
101

Archive Download this file



interactive