Skip to content

Commit

Permalink
ptp: ocp: add serial port of mRO50 MAC on ART card
Browse files Browse the repository at this point in the history
ART card provides interface to access to serial port of miniature atomic
clock found on the card. Add support for this device and configure it
during init phase.

Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Co-developed-by: Charles Parent <charles.parent@orolia2s.com>
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: Vadim Fedorenko <vadfed@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vadim Fedorenko authored and David S. Miller committed Oct 24, 2022
1 parent 69dbe10 commit 9c44a7a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions drivers/ptp/ptp_ocp.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ struct frequency_reg {
u32 ctrl;
u32 status;
};

struct board_config_reg {
u32 mro50_serial_activate;
};

#define FREQ_STATUS_VALID BIT(31)
#define FREQ_STATUS_ERROR BIT(30)
#define FREQ_STATUS_OVERRUN BIT(29)
Expand Down Expand Up @@ -299,6 +304,7 @@ struct ptp_ocp {
struct tod_reg __iomem *tod;
struct pps_reg __iomem *pps_to_ext;
struct pps_reg __iomem *pps_to_clk;
struct board_config_reg __iomem *board_config;
struct gpio_reg __iomem *pps_select;
struct gpio_reg __iomem *sma_map1;
struct gpio_reg __iomem *sma_map2;
Expand Down Expand Up @@ -795,6 +801,17 @@ static struct ocp_resource ocp_art_resource[] = {
},
},
},
{
OCP_SERIAL_RESOURCE(mac_port),
.offset = 0x00190000, .irq_vec = 7,
.extra = &(struct ptp_ocp_serial_port) {
.baud = 9600,
},
},
{
OCP_MEM_RESOURCE(board_config),
.offset = 0x210000, .size = 0x1000,
},
{
.setup = ptp_ocp_art_board_init,
},
Expand Down Expand Up @@ -2532,6 +2549,9 @@ ptp_ocp_art_board_init(struct ptp_ocp *bp, struct ocp_resource *r)
bp->fw_tag = 2;
bp->sma_op = &ocp_art_sma_op;

/* Enable MAC serial port during initialisation */
iowrite32(1, &bp->board_config->mro50_serial_activate);

ptp_ocp_sma_init(bp);

err = ptp_ocp_attr_group_add(bp, art_timecard_groups);
Expand Down

0 comments on commit 9c44a7a

Please sign in to comment.